From 0d99b7962d8e06958668168cdae155fd1e3d1757 Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 19 Aug 2022 22:15:23 -0400 Subject: state_tracker: workaround channel setup for homebrew --- src/video_core/query_cache.h | 6 ++++-- src/video_core/renderer_opengl/gl_state_tracker.cpp | 2 +- src/video_core/renderer_opengl/gl_state_tracker.h | 1 + src/video_core/renderer_vulkan/vk_state_tracker.cpp | 3 ++- src/video_core/renderer_vulkan/vk_state_tracker.h | 1 + 5 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src/video_core') diff --git a/src/video_core/query_cache.h b/src/video_core/query_cache.h index eb68ea638..b0ebe71b7 100644 --- a/src/video_core/query_cache.h +++ b/src/video_core/query_cache.h @@ -135,8 +135,10 @@ public: /// Updates counters from GPU state. Expected to be called once per draw, clear or dispatch. void UpdateCounters() { std::unique_lock lock{mutex}; - const auto& regs = maxwell3d->regs; - Stream(VideoCore::QueryType::SamplesPassed).Update(regs.samplecnt_enable); + if (maxwell3d) { + const auto& regs = maxwell3d->regs; + Stream(VideoCore::QueryType::SamplesPassed).Update(regs.samplecnt_enable); + } } /// Resets a counter to zero. It doesn't disable the query after resetting. diff --git a/src/video_core/renderer_opengl/gl_state_tracker.cpp b/src/video_core/renderer_opengl/gl_state_tracker.cpp index 3657f867d..a8f3a0f57 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.cpp +++ b/src/video_core/renderer_opengl/gl_state_tracker.cpp @@ -237,6 +237,6 @@ void StateTracker::InvalidateState() { flags->set(); } -StateTracker::StateTracker() : flags{} {} +StateTracker::StateTracker() : flags{&default_flags} {} } // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_state_tracker.h b/src/video_core/renderer_opengl/gl_state_tracker.h index 97d32768b..19bcf3f35 100644 --- a/src/video_core/renderer_opengl/gl_state_tracker.h +++ b/src/video_core/renderer_opengl/gl_state_tracker.h @@ -223,6 +223,7 @@ public: private: Tegra::Engines::Maxwell3D::DirtyState::Flags* flags; + Tegra::Engines::Maxwell3D::DirtyState::Flags default_flags{}; GLuint framebuffer = 0; GLuint index_buffer = 0; diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp index 5a11d3267..f234e1a31 100644 --- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp +++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp @@ -206,6 +206,7 @@ void StateTracker::InvalidateState() { flags->set(); } -StateTracker::StateTracker() : flags{}, invalidation_flags{MakeInvalidationFlags()} {} +StateTracker::StateTracker() + : flags{&default_flags}, default_flags{}, invalidation_flags{MakeInvalidationFlags()} {} } // namespace Vulkan diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.h b/src/video_core/renderer_vulkan/vk_state_tracker.h index c107d9c24..2296dea60 100644 --- a/src/video_core/renderer_vulkan/vk_state_tracker.h +++ b/src/video_core/renderer_vulkan/vk_state_tracker.h @@ -161,6 +161,7 @@ private: } Tegra::Engines::Maxwell3D::DirtyState::Flags* flags; + Tegra::Engines::Maxwell3D::DirtyState::Flags default_flags; Tegra::Engines::Maxwell3D::DirtyState::Flags invalidation_flags; Maxwell::PrimitiveTopology current_topology = INVALID_TOPOLOGY; }; -- cgit v1.2.3