diff options
Diffstat (limited to '')
-rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 11 | ||||
-rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 8 | ||||
-rw-r--r-- | src/video_core/memory_manager.cpp | 3 | ||||
-rw-r--r-- | src/video_core/rasterizer_interface.h | 3 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 4 | ||||
-rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.h | 1 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 4 | ||||
-rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.h | 1 |
8 files changed, 29 insertions, 6 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 9e6b87960..d371b842f 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h @@ -110,6 +110,8 @@ public: void BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size); + void DisableGraphicsUniformBuffer(size_t stage, u32 index); + void UpdateGraphicsBuffers(bool is_indexed); void UpdateComputeBuffers(); @@ -419,10 +421,6 @@ template <class P> void BufferCache<P>::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size) { const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr); - if (!cpu_addr) { - uniform_buffers[stage][index] = NULL_BINDING; - return; - } const Binding binding{ .cpu_addr = *cpu_addr, .size = size, @@ -432,6 +430,11 @@ void BufferCache<P>::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr } template <class P> +void BufferCache<P>::DisableGraphicsUniformBuffer(size_t stage, u32 index) { + uniform_buffers[stage][index] = NULL_BINDING; +} + +template <class P> void BufferCache<P>::UpdateGraphicsBuffers(bool is_indexed) { MICROPROFILE_SCOPE(GPU_PrepareBuffers); do { diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 75517a4f7..aab6b8f7a 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp @@ -578,8 +578,12 @@ void Maxwell3D::ProcessCBBind(size_t stage_index) { buffer.size = regs.const_buffer.cb_size; const bool is_enabled = bind_data.valid.Value() != 0; - const GPUVAddr gpu_addr = is_enabled ? regs.const_buffer.BufferAddress() : 0; - const u32 size = is_enabled ? regs.const_buffer.cb_size : 0; + if (!is_enabled) { + rasterizer->DisableGraphicsUniformBuffer(stage_index, bind_data.index); + return; + } + const GPUVAddr gpu_addr = regs.const_buffer.BufferAddress(); + const u32 size = regs.const_buffer.cb_size; rasterizer->BindGraphicsUniformBuffer(stage_index, bind_data.index, gpu_addr, size); } diff --git a/src/video_core/memory_manager.cpp b/src/video_core/memory_manager.cpp index eb58ac6b6..7124c755c 100644 --- a/src/video_core/memory_manager.cpp +++ b/src/video_core/memory_manager.cpp @@ -163,6 +163,9 @@ std::optional<GPUVAddr> MemoryManager::FindFreeRange(std::size_t size, std::size } std::optional<VAddr> MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) const { + if (gpu_addr == 0) { + return std::nullopt; + } const auto page_entry{GetPageEntry(gpu_addr)}; if (!page_entry.IsValid()) { return std::nullopt; diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h index 50491b758..f968b5b16 100644 --- a/src/video_core/rasterizer_interface.h +++ b/src/video_core/rasterizer_interface.h @@ -54,6 +54,9 @@ public: virtual void BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size) = 0; + /// Signal disabling of a uniform buffer + virtual void DisableGraphicsUniformBuffer(size_t stage, u32 index) = 0; + /// Signal a GPU based semaphore as a fence virtual void SignalSemaphore(GPUVAddr addr, u32 value) = 0; diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index a5dbb9adf..f87bb269b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -526,6 +526,10 @@ void RasterizerOpenGL::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAd buffer_cache.BindGraphicsUniformBuffer(stage, index, gpu_addr, size); } +void RasterizerOpenGL::DisableGraphicsUniformBuffer(size_t stage, u32 index) { + buffer_cache.DisableGraphicsUniformBuffer(stage, index); +} + void RasterizerOpenGL::FlushAll() {} void RasterizerOpenGL::FlushRegion(VAddr addr, u64 size) { diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 3745cf637..76298517f 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -72,6 +72,7 @@ public: void ResetCounter(VideoCore::QueryType type) override; void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional<u64> timestamp) 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; void FlushRegion(VAddr addr, u64 size) override; bool MustFlushRegion(VAddr addr, u64 size) override; diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index e9a0e7811..1c9120170 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -476,6 +476,10 @@ void RasterizerVulkan::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAd buffer_cache.BindGraphicsUniformBuffer(stage, index, gpu_addr, size); } +void Vulkan::RasterizerVulkan::DisableGraphicsUniformBuffer(size_t stage, u32 index) { + buffer_cache.DisableGraphicsUniformBuffer(stage, index); +} + void RasterizerVulkan::FlushAll() {} void RasterizerVulkan::FlushRegion(VAddr addr, u64 size) { diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h index 235afc6f3..cb8c5c279 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.h +++ b/src/video_core/renderer_vulkan/vk_rasterizer.h @@ -64,6 +64,7 @@ public: void ResetCounter(VideoCore::QueryType type) override; void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional<u64> timestamp) 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; void FlushRegion(VAddr addr, u64 size) override; bool MustFlushRegion(VAddr addr, u64 size) override; |