early-access version 3795
This commit is contained in:
@@ -106,6 +106,43 @@ bool IsASTCSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HasSlowSoftwareAstc(std::string_view vendor_name, std::string_view renderer) {
|
||||
// ifdef for Unix reduces string comparisons for non-Windows drivers, and Intel
|
||||
#ifdef YUZU_UNIX
|
||||
// Sorted vaguely by how likely a vendor is to appear
|
||||
if (vendor_name == "AMD") {
|
||||
// RadeonSI
|
||||
return true;
|
||||
}
|
||||
if (vendor_name == "Intel") {
|
||||
// Must be inside YUZU_UNIX ifdef as the Windows driver uses the same vendor string
|
||||
// iris, crocus
|
||||
const bool is_intel_dg = (renderer.find("DG") != std::string_view::npos);
|
||||
return is_intel_dg;
|
||||
}
|
||||
if (vendor_name == "nouveau") {
|
||||
return true;
|
||||
}
|
||||
if (vendor_name == "X.Org") {
|
||||
// R600
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
if (vendor_name == "Collabora Ltd") {
|
||||
// Zink
|
||||
return true;
|
||||
}
|
||||
if (vendor_name == "Microsoft Corporation") {
|
||||
// d3d12
|
||||
return true;
|
||||
}
|
||||
if (vendor_name == "Mesa/X.org") {
|
||||
// llvmpipe, softpipe, virgl
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
[[nodiscard]] bool IsDebugToolAttached(std::span<const std::string_view> extensions) {
|
||||
const bool nsight = std::getenv("NVTX_INJECTION64_PATH") || std::getenv("NSIGHT_LAUNCHED");
|
||||
return nsight || HasExtension(extensions, "GL_EXT_debug_tool") ||
|
||||
@@ -120,12 +157,16 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) {
|
||||
}
|
||||
vendor_name = reinterpret_cast<const char*>(glGetString(GL_VENDOR));
|
||||
const std::string_view version = reinterpret_cast<const char*>(glGetString(GL_VERSION));
|
||||
const std::string_view renderer = reinterpret_cast<const char*>(glGetString(GL_RENDERER));
|
||||
const std::vector extensions = GetExtensions();
|
||||
|
||||
const bool is_nvidia = vendor_name == "NVIDIA Corporation";
|
||||
const bool is_amd = vendor_name == "ATI Technologies Inc.";
|
||||
const bool is_intel = vendor_name == "Intel";
|
||||
|
||||
const bool has_slow_software_astc =
|
||||
!is_nvidia && !is_amd && HasSlowSoftwareAstc(vendor_name, renderer);
|
||||
|
||||
#ifdef __unix__
|
||||
constexpr bool is_linux = true;
|
||||
#else
|
||||
@@ -152,7 +193,7 @@ Device::Device(Core::Frontend::EmuWindow& emu_window) {
|
||||
has_vertex_viewport_layer = GLAD_GL_ARB_shader_viewport_layer_array;
|
||||
has_image_load_formatted = HasExtension(extensions, "GL_EXT_shader_image_load_formatted");
|
||||
has_texture_shadow_lod = HasExtension(extensions, "GL_EXT_texture_shadow_lod");
|
||||
has_astc = IsASTCSupported();
|
||||
has_astc = !has_slow_software_astc && IsASTCSupported();
|
||||
has_variable_aoffi = TestVariableAoffi();
|
||||
has_component_indexing_bug = is_amd;
|
||||
has_precise_bug = TestPreciseBug();
|
||||
|
||||
@@ -27,7 +27,7 @@ constexpr GLenum GetTarget(VideoCore::QueryType type) {
|
||||
} // Anonymous namespace
|
||||
|
||||
QueryCache::QueryCache(RasterizerOpenGL& rasterizer_, Core::Memory::Memory& cpu_memory_)
|
||||
: QueryCacheBase(rasterizer_, cpu_memory_), gl_rasterizer{rasterizer_} {}
|
||||
: QueryCacheLegacy(rasterizer_, cpu_memory_), gl_rasterizer{rasterizer_} {}
|
||||
|
||||
QueryCache::~QueryCache() = default;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class RasterizerOpenGL;
|
||||
using CounterStream = VideoCommon::CounterStreamBase<QueryCache, HostCounter>;
|
||||
|
||||
class QueryCache final
|
||||
: public VideoCommon::QueryCacheBase<QueryCache, CachedQuery, CounterStream, HostCounter> {
|
||||
: public VideoCommon::QueryCacheLegacy<QueryCache, CachedQuery, CounterStream, HostCounter> {
|
||||
public:
|
||||
explicit QueryCache(RasterizerOpenGL& rasterizer_, Core::Memory::Memory& cpu_memory_);
|
||||
~QueryCache();
|
||||
|
||||
@@ -385,13 +385,39 @@ void RasterizerOpenGL::DispatchCompute() {
|
||||
has_written_global_memory |= pipeline->WritesGlobalMemory();
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::ResetCounter(VideoCore::QueryType type) {
|
||||
query_cache.ResetCounter(type);
|
||||
void RasterizerOpenGL::ResetCounter(VideoCommon::QueryType type) {
|
||||
if (type == VideoCommon::QueryType::ZPassPixelCount64) {
|
||||
query_cache.ResetCounter(VideoCore::QueryType::SamplesPassed);
|
||||
}
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::Query(GPUVAddr gpu_addr, VideoCore::QueryType type,
|
||||
std::optional<u64> timestamp) {
|
||||
query_cache.Query(gpu_addr, type, timestamp);
|
||||
void RasterizerOpenGL::Query(GPUVAddr gpu_addr, VideoCommon::QueryType type,
|
||||
VideoCommon::QueryPropertiesFlags flags, u32 payload, u32 subreport) {
|
||||
if (type == VideoCommon::QueryType::ZPassPixelCount64) {
|
||||
if (True(flags & VideoCommon::QueryPropertiesFlags::HasTimeout)) {
|
||||
query_cache.Query(gpu_addr, VideoCore::QueryType::SamplesPassed, {gpu.GetTicks()});
|
||||
} else {
|
||||
query_cache.Query(gpu_addr, VideoCore::QueryType::SamplesPassed, std::nullopt);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (type != VideoCommon::QueryType::Payload) {
|
||||
payload = 1u;
|
||||
}
|
||||
std::function<void()> func([this, gpu_addr, flags, memory_manager = gpu_memory, payload]() {
|
||||
if (True(flags & VideoCommon::QueryPropertiesFlags::HasTimeout)) {
|
||||
u64 ticks = gpu.GetTicks();
|
||||
memory_manager->Write<u64>(gpu_addr + 8, ticks);
|
||||
memory_manager->Write<u64>(gpu_addr, static_cast<u64>(payload));
|
||||
} else {
|
||||
memory_manager->Write<u32>(gpu_addr, payload);
|
||||
}
|
||||
});
|
||||
if (True(flags & VideoCommon::QueryPropertiesFlags::IsAFence)) {
|
||||
SignalFence(std::move(func));
|
||||
return;
|
||||
}
|
||||
func();
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr,
|
||||
@@ -562,8 +588,8 @@ void RasterizerOpenGL::SignalReference() {
|
||||
fence_manager.SignalOrdering();
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::ReleaseFences() {
|
||||
fence_manager.WaitPendingFences();
|
||||
void RasterizerOpenGL::ReleaseFences(bool force) {
|
||||
fence_manager.WaitPendingFences(force);
|
||||
}
|
||||
|
||||
void RasterizerOpenGL::FlushAndInvalidateRegion(VAddr addr, u64 size,
|
||||
|
||||
@@ -86,8 +86,9 @@ public:
|
||||
void DrawTexture() override;
|
||||
void Clear(u32 layer_count) override;
|
||||
void DispatchCompute() override;
|
||||
void ResetCounter(VideoCore::QueryType type) override;
|
||||
void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional<u64> timestamp) override;
|
||||
void ResetCounter(VideoCommon::QueryType type) override;
|
||||
void Query(GPUVAddr gpu_addr, VideoCommon::QueryType type,
|
||||
VideoCommon::QueryPropertiesFlags flags, u32 payload, u32 subreport) override;
|
||||
void BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size) override;
|
||||
void DisableGraphicsUniformBuffer(size_t stage, u32 index) override;
|
||||
void FlushAll() override;
|
||||
@@ -107,7 +108,7 @@ public:
|
||||
void SyncOperation(std::function<void()>&& func) override;
|
||||
void SignalSyncPoint(u32 value) override;
|
||||
void SignalReference() override;
|
||||
void ReleaseFences() override;
|
||||
void ReleaseFences(bool force = true) override;
|
||||
void FlushAndInvalidateRegion(
|
||||
VAddr addr, u64 size, VideoCommon::CacheType which = VideoCommon::CacheType::All) override;
|
||||
void WaitForIdle() override;
|
||||
|
||||
Reference in New Issue
Block a user