summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2018-03-17 13:55:42 -0500
committerGravatar Subv2018-03-17 13:55:42 -0500
commit579000e747413b9af3860c0b92e143d4ddc44e36 (patch)
tree4e6804833eb2f74686d14a62d8cdae58a8d06b0f /src
parentMerge pull request #242 from Subv/set_shader (diff)
downloadyuzu-579000e747413b9af3860c0b92e143d4ddc44e36.tar.gz
yuzu-579000e747413b9af3860c0b92e143d4ddc44e36.tar.xz
yuzu-579000e747413b9af3860c0b92e143d4ddc44e36.zip
GPU: Corrected the parameter documentation for the SetShader macro call.
Register 0xE24 is actually a macro that sets some shader parameters in the register structure. Macros are uploaded to the GPU at startup and have their own ISA, we'll probably write an interpreter for this in the future.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp11
-rw-r--r--src/video_core/engines/maxwell_3d.h12
2 files changed, 12 insertions, 11 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 603a2edaf..9784ee069 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -15,6 +15,7 @@ const std::unordered_map<u32, Maxwell3D::MethodInfo> Maxwell3D::method_handlers
15Maxwell3D::Maxwell3D(MemoryManager& memory_manager) : memory_manager(memory_manager) {} 15Maxwell3D::Maxwell3D(MemoryManager& memory_manager) : memory_manager(memory_manager) {}
16 16
17void Maxwell3D::CallMethod(u32 method, const std::vector<u32>& parameters) { 17void Maxwell3D::CallMethod(u32 method, const std::vector<u32>& parameters) {
18 // TODO(Subv): Write an interpreter for the macros uploaded via registers 0x45 and 0x47
18 auto itr = method_handlers.find(method); 19 auto itr = method_handlers.find(method);
19 if (itr == method_handlers.end()) { 20 if (itr == method_handlers.end()) {
20 LOG_ERROR(HW_GPU, "Unhandled method call %08X", method); 21 LOG_ERROR(HW_GPU, "Unhandled method call %08X", method);
@@ -86,19 +87,19 @@ void Maxwell3D::SetShader(const std::vector<u32>& parameters) {
86 * [1] = Unknown. 87 * [1] = Unknown.
87 * [2] = Offset to the start of the shader, after the 0x30 bytes header. 88 * [2] = Offset to the start of the shader, after the 0x30 bytes header.
88 * [3] = Shader Type. 89 * [3] = Shader Type.
89 * [4] = Shader End Address >> 8. 90 * [4] = Const Buffer Address >> 8.
90 */ 91 */
91 auto shader_program = static_cast<Regs::ShaderProgram>(parameters[0]); 92 auto shader_program = static_cast<Regs::ShaderProgram>(parameters[0]);
92 // TODO(Subv): This address is probably an offset from the CODE_ADDRESS register. 93 // TODO(Subv): This address is probably an offset from the CODE_ADDRESS register.
93 GPUVAddr begin_address = parameters[2]; 94 GPUVAddr address = parameters[2];
94 auto shader_type = static_cast<Regs::ShaderType>(parameters[3]); 95 auto shader_type = static_cast<Regs::ShaderType>(parameters[3]);
95 GPUVAddr end_address = parameters[4] << 8; 96 GPUVAddr cb_address = parameters[4] << 8;
96 97
97 auto& shader = state.shaders[static_cast<size_t>(shader_program)]; 98 auto& shader = state.shaders[static_cast<size_t>(shader_program)];
98 shader.program = shader_program; 99 shader.program = shader_program;
99 shader.type = shader_type; 100 shader.type = shader_type;
100 shader.begin_address = begin_address; 101 shader.address = address;
101 shader.end_address = end_address; 102 shader.cb_address = cb_address;
102} 103}
103 104
104} // namespace Engines 105} // namespace Engines
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index c979d4e61..47df43c97 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -139,9 +139,9 @@ public:
139 INSERT_PADDING_WORDS(0x5D0); 139 INSERT_PADDING_WORDS(0x5D0);
140 140
141 struct { 141 struct {
142 u32 shader_code_call; 142 u32 set_shader_call;
143 u32 shader_code_args; 143 u32 set_shader_args;
144 } shader_code; 144 } set_shader;
145 INSERT_PADDING_WORDS(0x10); 145 INSERT_PADDING_WORDS(0x10);
146 }; 146 };
147 std::array<u32, NUM_REGS> reg_array; 147 std::array<u32, NUM_REGS> reg_array;
@@ -154,8 +154,8 @@ public:
154 struct ShaderInfo { 154 struct ShaderInfo {
155 Regs::ShaderType type; 155 Regs::ShaderType type;
156 Regs::ShaderProgram program; 156 Regs::ShaderProgram program;
157 GPUVAddr begin_address; 157 GPUVAddr address;
158 GPUVAddr end_address; 158 GPUVAddr cb_address;
159 }; 159 };
160 160
161 std::array<ShaderInfo, Regs::MaxShaderProgram> shaders; 161 std::array<ShaderInfo, Regs::MaxShaderProgram> shaders;
@@ -194,7 +194,7 @@ ASSERT_REG_POSITION(query, 0x6C0);
194ASSERT_REG_POSITION(vertex_array[0], 0x700); 194ASSERT_REG_POSITION(vertex_array[0], 0x700);
195ASSERT_REG_POSITION(vertex_array_limit[0], 0x7C0); 195ASSERT_REG_POSITION(vertex_array_limit[0], 0x7C0);
196ASSERT_REG_POSITION(shader_config[0], 0x800); 196ASSERT_REG_POSITION(shader_config[0], 0x800);
197ASSERT_REG_POSITION(shader_code, 0xE24); 197ASSERT_REG_POSITION(set_shader, 0xE24);
198 198
199#undef ASSERT_REG_POSITION 199#undef ASSERT_REG_POSITION
200 200