mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-23 17:00:57 +01:00
Merge pull request #6400 from ameerj/disable-uniform-simplify
buffer_cache: Simplify uniform disabling logic
This commit is contained in:
commit
afd0e2eb0b
8 changed files with 29 additions and 6 deletions
|
@ -110,6 +110,8 @@ public:
|
||||||
|
|
||||||
void BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size);
|
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 UpdateGraphicsBuffers(bool is_indexed);
|
||||||
|
|
||||||
void UpdateComputeBuffers();
|
void UpdateComputeBuffers();
|
||||||
|
@ -419,10 +421,6 @@ template <class P>
|
||||||
void BufferCache<P>::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr,
|
void BufferCache<P>::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr,
|
||||||
u32 size) {
|
u32 size) {
|
||||||
const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr);
|
const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr);
|
||||||
if (!cpu_addr) {
|
|
||||||
uniform_buffers[stage][index] = NULL_BINDING;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const Binding binding{
|
const Binding binding{
|
||||||
.cpu_addr = *cpu_addr,
|
.cpu_addr = *cpu_addr,
|
||||||
.size = size,
|
.size = size,
|
||||||
|
@ -431,6 +429,11 @@ void BufferCache<P>::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr
|
||||||
uniform_buffers[stage][index] = binding;
|
uniform_buffers[stage][index] = binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <class P>
|
||||||
|
void BufferCache<P>::DisableGraphicsUniformBuffer(size_t stage, u32 index) {
|
||||||
|
uniform_buffers[stage][index] = NULL_BINDING;
|
||||||
|
}
|
||||||
|
|
||||||
template <class P>
|
template <class P>
|
||||||
void BufferCache<P>::UpdateGraphicsBuffers(bool is_indexed) {
|
void BufferCache<P>::UpdateGraphicsBuffers(bool is_indexed) {
|
||||||
MICROPROFILE_SCOPE(GPU_PrepareBuffers);
|
MICROPROFILE_SCOPE(GPU_PrepareBuffers);
|
||||||
|
|
|
@ -578,8 +578,12 @@ void Maxwell3D::ProcessCBBind(size_t stage_index) {
|
||||||
buffer.size = regs.const_buffer.cb_size;
|
buffer.size = regs.const_buffer.cb_size;
|
||||||
|
|
||||||
const bool is_enabled = bind_data.valid.Value() != 0;
|
const bool is_enabled = bind_data.valid.Value() != 0;
|
||||||
const GPUVAddr gpu_addr = is_enabled ? regs.const_buffer.BufferAddress() : 0;
|
if (!is_enabled) {
|
||||||
const u32 size = is_enabled ? regs.const_buffer.cb_size : 0;
|
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);
|
rasterizer->BindGraphicsUniformBuffer(stage_index, bind_data.index, gpu_addr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,9 @@ std::optional<GPUVAddr> MemoryManager::FindFreeRange(std::size_t size, std::size
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<VAddr> MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) const {
|
std::optional<VAddr> MemoryManager::GpuToCpuAddress(GPUVAddr gpu_addr) const {
|
||||||
|
if (gpu_addr == 0) {
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
const auto page_entry{GetPageEntry(gpu_addr)};
|
const auto page_entry{GetPageEntry(gpu_addr)};
|
||||||
if (!page_entry.IsValid()) {
|
if (!page_entry.IsValid()) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
|
@ -54,6 +54,9 @@ public:
|
||||||
virtual void BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr,
|
virtual void BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr,
|
||||||
u32 size) = 0;
|
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
|
/// Signal a GPU based semaphore as a fence
|
||||||
virtual void SignalSemaphore(GPUVAddr addr, u32 value) = 0;
|
virtual void SignalSemaphore(GPUVAddr addr, u32 value) = 0;
|
||||||
|
|
||||||
|
|
|
@ -526,6 +526,10 @@ void RasterizerOpenGL::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAd
|
||||||
buffer_cache.BindGraphicsUniformBuffer(stage, index, gpu_addr, size);
|
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::FlushAll() {}
|
||||||
|
|
||||||
void RasterizerOpenGL::FlushRegion(VAddr addr, u64 size) {
|
void RasterizerOpenGL::FlushRegion(VAddr addr, u64 size) {
|
||||||
|
|
|
@ -72,6 +72,7 @@ public:
|
||||||
void ResetCounter(VideoCore::QueryType type) override;
|
void ResetCounter(VideoCore::QueryType type) override;
|
||||||
void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional<u64> timestamp) 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 BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size) override;
|
||||||
|
void DisableGraphicsUniformBuffer(size_t stage, u32 index) override;
|
||||||
void FlushAll() override;
|
void FlushAll() override;
|
||||||
void FlushRegion(VAddr addr, u64 size) override;
|
void FlushRegion(VAddr addr, u64 size) override;
|
||||||
bool MustFlushRegion(VAddr addr, u64 size) override;
|
bool MustFlushRegion(VAddr addr, u64 size) override;
|
||||||
|
|
|
@ -476,6 +476,10 @@ void RasterizerVulkan::BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAd
|
||||||
buffer_cache.BindGraphicsUniformBuffer(stage, index, gpu_addr, size);
|
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::FlushAll() {}
|
||||||
|
|
||||||
void RasterizerVulkan::FlushRegion(VAddr addr, u64 size) {
|
void RasterizerVulkan::FlushRegion(VAddr addr, u64 size) {
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
void ResetCounter(VideoCore::QueryType type) override;
|
void ResetCounter(VideoCore::QueryType type) override;
|
||||||
void Query(GPUVAddr gpu_addr, VideoCore::QueryType type, std::optional<u64> timestamp) 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 BindGraphicsUniformBuffer(size_t stage, u32 index, GPUVAddr gpu_addr, u32 size) override;
|
||||||
|
void DisableGraphicsUniformBuffer(size_t stage, u32 index) override;
|
||||||
void FlushAll() override;
|
void FlushAll() override;
|
||||||
void FlushRegion(VAddr addr, u64 size) override;
|
void FlushRegion(VAddr addr, u64 size) override;
|
||||||
bool MustFlushRegion(VAddr addr, u64 size) override;
|
bool MustFlushRegion(VAddr addr, u64 size) override;
|
||||||
|
|
Loading…
Reference in a new issue