From 7e088ca46558592fa9ff15baefe4100b5a0c7601 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Wed, 16 Mar 2022 20:49:25 +0000 Subject: [PATCH] Fix constbuf updates to actually increment the write offset Uses the register directly now as when we modify it we want the changes to be visible from macros too. --- .../cpp/skyline/gpu/interconnect/graphics_context.h | 10 ++-------- .../main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp | 11 ++++------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h index 51154475..81c083e2 100644 --- a/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h +++ b/app/src/main/cpp/skyline/gpu/interconnect/graphics_context.h @@ -609,8 +609,6 @@ namespace skyline::gpu::interconnect { }; ConstantBuffer constantBufferSelector; //!< The constant buffer selector is used to bind a constant buffer to a stage or update data in it - u32 constantBufferUpdateOffset{}; //!< The offset at which any inline constant buffer updata data is written - public: void SetConstantBufferSelectorSize(u32 size) { constantBufferSelector.size = size; @@ -644,13 +642,9 @@ namespace skyline::gpu::interconnect { return constantBufferSelector; } - void SetConstantBufferUpdateOffset(u32 offset) { - constantBufferUpdateOffset = offset; - } - - void ConstantBufferUpdate(u32 data) { + void ConstantBufferUpdate(u32 data, u32 offset) { auto constantBuffer{GetConstantBufferSelector().value()}; - constantBuffer.Write(data, constantBufferUpdateOffset); + constantBuffer.Write(data, offset); } /* Shader Program */ diff --git a/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp b/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp index 6b25196e..10aa0f33 100644 --- a/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp +++ b/app/src/main/cpp/skyline/soc/gm20b/engines/maxwell_3d.cpp @@ -570,10 +570,6 @@ namespace skyline::soc::gm20b::engine::maxwell3d { context.SetTexturePoolMaximumIndex(maximumIndex); }) - MAXWELL3D_STRUCT_CASE(constantBufferUpdate, offset, { - context.SetConstantBufferUpdateOffset(offset); - }) - default: break; } @@ -663,9 +659,10 @@ namespace skyline::soc::gm20b::engine::maxwell3d { registers.raw[0xD00] = 1; }) - #define CBUF_UPDATE_CALLBACKS(z, index, data_) \ - MAXWELL3D_STRUCT_ARRAY_CASE(constantBufferUpdate, data, index, { \ - context.ConstantBufferUpdate(data); \ + #define CBUF_UPDATE_CALLBACKS(z, index, data_) \ + MAXWELL3D_STRUCT_ARRAY_CASE(constantBufferUpdate, data, index, { \ + context.ConstantBufferUpdate(data, registers.constantBufferUpdate->offset); \ + registers.constantBufferUpdate->offset += 4; \ }) BOOST_PP_REPEAT(16, CBUF_UPDATE_CALLBACKS, 0)