summaryrefslogtreecommitdiffstats
path: root/src/video_core/engines/maxwell_3d.cpp
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-03-18 21:22:06 +0100
committerSubv <subv2112@gmail.com>2018-03-18 22:50:42 +0100
commit7b6868e908319b91785712410b481e9112621175 (patch)
treed86384f4fed07fc791541e49b8ef0f7834461c35 /src/video_core/engines/maxwell_3d.cpp
parentGPU: Handle writes to the CB_DATA method. (diff)
downloadyuzu-7b6868e908319b91785712410b481e9112621175.tar
yuzu-7b6868e908319b91785712410b481e9112621175.tar.gz
yuzu-7b6868e908319b91785712410b481e9112621175.tar.bz2
yuzu-7b6868e908319b91785712410b481e9112621175.tar.lz
yuzu-7b6868e908319b91785712410b481e9112621175.tar.xz
yuzu-7b6868e908319b91785712410b481e9112621175.tar.zst
yuzu-7b6868e908319b91785712410b481e9112621175.zip
Diffstat (limited to 'src/video_core/engines/maxwell_3d.cpp')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 9985e0d50..3a4e88e4e 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -13,6 +13,7 @@ constexpr u32 MacroRegistersStart = 0xE00;
const std::unordered_map<u32, Maxwell3D::MethodInfo> Maxwell3D::method_handlers = {
{0xE24, {"SetShader", 5, &Maxwell3D::SetShader}},
+ {0xE2A, {"BindStorageBuffer", 1, &Maxwell3D::BindStorageBuffer}},
};
Maxwell3D::Maxwell3D(MemoryManager& memory_manager) : memory_manager(memory_manager) {}
@@ -200,6 +201,26 @@ void Maxwell3D::SetShader(const std::vector<u32>& parameters) {
ProcessCBBind(shader_stage);
}
+void Maxwell3D::BindStorageBuffer(const std::vector<u32>& parameters) {
+ /**
+ * Parameters description:
+ * [0] = Buffer offset >> 2
+ */
+
+ u32 buffer_offset = parameters[0] << 2;
+
+ // Perform the same operations as the real macro code.
+ // Note: This value is hardcoded in the macro's code.
+ static constexpr u32 DefaultCBSize = 0x5F00;
+ regs.const_buffer.cb_size = DefaultCBSize;
+
+ GPUVAddr address = regs.ssbo_info.BufferAddress();
+ regs.const_buffer.cb_address_high = address >> 32;
+ regs.const_buffer.cb_address_low = address & 0xFFFFFFFF;
+
+ regs.const_buffer.cb_pos = buffer_offset;
+}
+
void Maxwell3D::ProcessCBBind(Regs::ShaderStage stage) {
// Bind the buffer currently in CB_ADDRESS to the specified index in the desired shader stage.
auto& shader = state.shader_stages[static_cast<size_t>(stage)];