diff options
| author | 2014-12-21 02:49:45 +0100 | |
|---|---|---|
| committer | 2014-12-31 15:33:09 +0100 | |
| commit | b7a48c422aa7293525909ac7b32575bce8575bde (patch) | |
| tree | c8d237cce5c9b116f2b808ec3ae9348dc4998d89 /src | |
| parent | citra-qt: Fix displaying RGBA5551 framebuffers. (diff) | |
| download | yuzu-b7a48c422aa7293525909ac7b32575bce8575bde.tar.gz yuzu-b7a48c422aa7293525909ac7b32575bce8575bde.tar.xz yuzu-b7a48c422aa7293525909ac7b32575bce8575bde.zip | |
Pica/CommandProcessor: Add support for integer uniforms.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/command_processor.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/pica.h | 10 | ||||
| -rw-r--r-- | src/video_core/vertex_shader.cpp | 7 | ||||
| -rw-r--r-- | src/video_core/vertex_shader.h | 1 |
4 files changed, 30 insertions, 1 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 9602779f4..9e1975ddb 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp | |||
| @@ -173,6 +173,19 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 173 | 173 | ||
| 174 | break; | 174 | break; |
| 175 | 175 | ||
| 176 | case PICA_REG_INDEX_WORKAROUND(vs_int_uniforms[0], 0x2b1): | ||
| 177 | case PICA_REG_INDEX_WORKAROUND(vs_int_uniforms[1], 0x2b2): | ||
| 178 | case PICA_REG_INDEX_WORKAROUND(vs_int_uniforms[2], 0x2b3): | ||
| 179 | case PICA_REG_INDEX_WORKAROUND(vs_int_uniforms[3], 0x2b4): | ||
| 180 | { | ||
| 181 | int index = (id - PICA_REG_INDEX_WORKAROUND(vs_int_uniforms[0], 0x2b1)); | ||
| 182 | auto values = registers.vs_int_uniforms[index]; | ||
| 183 | VertexShader::GetIntUniform(index) = Math::Vec4<u8>(values.x, values.y, values.z, values.w); | ||
| 184 | LOG_ERROR(HW_GPU, "Set integer uniform %d to %02x %02x %02x %02x", | ||
| 185 | index, values.x.Value(), values.y.Value(), values.z.Value(), values.w.Value()); | ||
| 186 | break; | ||
| 187 | } | ||
| 188 | |||
| 176 | case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[0], 0x2c1): | 189 | case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[0], 0x2c1): |
| 177 | case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[1], 0x2c2): | 190 | case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[1], 0x2c2): |
| 178 | case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[2], 0x2c3): | 191 | case PICA_REG_INDEX_WORKAROUND(vs_uniform_setup.set_value[2], 0x2c3): |
diff --git a/src/video_core/pica.h b/src/video_core/pica.h index 38bac748c..f518cc98b 100644 --- a/src/video_core/pica.h +++ b/src/video_core/pica.h | |||
| @@ -495,8 +495,14 @@ struct Regs { | |||
| 495 | INSERT_PADDING_WORDS(0x51); | 495 | INSERT_PADDING_WORDS(0x51); |
| 496 | 496 | ||
| 497 | BitField<0, 16, u32> vs_bool_uniforms; | 497 | BitField<0, 16, u32> vs_bool_uniforms; |
| 498 | union { | ||
| 499 | BitField< 0, 8, u32> x; | ||
| 500 | BitField< 8, 8, u32> y; | ||
| 501 | BitField<16, 8, u32> z; | ||
| 502 | BitField<24, 8, u32> w; | ||
| 503 | } vs_int_uniforms[4]; | ||
| 498 | 504 | ||
| 499 | INSERT_PADDING_WORDS(0x9); | 505 | INSERT_PADDING_WORDS(0x5); |
| 500 | 506 | ||
| 501 | // Offset to shader program entry point (in words) | 507 | // Offset to shader program entry point (in words) |
| 502 | BitField<0, 16, u32> vs_main_offset; | 508 | BitField<0, 16, u32> vs_main_offset; |
| @@ -625,6 +631,7 @@ struct Regs { | |||
| 625 | ADD_FIELD(trigger_draw_indexed); | 631 | ADD_FIELD(trigger_draw_indexed); |
| 626 | ADD_FIELD(triangle_topology); | 632 | ADD_FIELD(triangle_topology); |
| 627 | ADD_FIELD(vs_bool_uniforms); | 633 | ADD_FIELD(vs_bool_uniforms); |
| 634 | ADD_FIELD(vs_int_uniforms); | ||
| 628 | ADD_FIELD(vs_main_offset); | 635 | ADD_FIELD(vs_main_offset); |
| 629 | ADD_FIELD(vs_input_register_map); | 636 | ADD_FIELD(vs_input_register_map); |
| 630 | ADD_FIELD(vs_uniform_setup); | 637 | ADD_FIELD(vs_uniform_setup); |
| @@ -696,6 +703,7 @@ ASSERT_REG_POSITION(trigger_draw, 0x22e); | |||
| 696 | ASSERT_REG_POSITION(trigger_draw_indexed, 0x22f); | 703 | ASSERT_REG_POSITION(trigger_draw_indexed, 0x22f); |
| 697 | ASSERT_REG_POSITION(triangle_topology, 0x25e); | 704 | ASSERT_REG_POSITION(triangle_topology, 0x25e); |
| 698 | ASSERT_REG_POSITION(vs_bool_uniforms, 0x2b0); | 705 | ASSERT_REG_POSITION(vs_bool_uniforms, 0x2b0); |
| 706 | ASSERT_REG_POSITION(vs_int_uniforms, 0x2b1); | ||
| 699 | ASSERT_REG_POSITION(vs_main_offset, 0x2ba); | 707 | ASSERT_REG_POSITION(vs_main_offset, 0x2ba); |
| 700 | ASSERT_REG_POSITION(vs_input_register_map, 0x2bb); | 708 | ASSERT_REG_POSITION(vs_input_register_map, 0x2bb); |
| 701 | ASSERT_REG_POSITION(vs_uniform_setup, 0x2c0); | 709 | ASSERT_REG_POSITION(vs_uniform_setup, 0x2c0); |
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index bed5081a0..090ffd420 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp | |||
| @@ -30,6 +30,8 @@ static struct { | |||
| 30 | Math::Vec4<float24> f[96]; | 30 | Math::Vec4<float24> f[96]; |
| 31 | 31 | ||
| 32 | std::array<bool,16> b; | 32 | std::array<bool,16> b; |
| 33 | |||
| 34 | std::array<Math::Vec4<u8>,4> i; | ||
| 33 | } shader_uniforms; | 35 | } shader_uniforms; |
| 34 | 36 | ||
| 35 | // TODO: Not sure where the shader binary and swizzle patterns are supposed to be loaded to! | 37 | // TODO: Not sure where the shader binary and swizzle patterns are supposed to be loaded to! |
| @@ -57,6 +59,11 @@ bool& GetBoolUniform(u32 index) | |||
| 57 | return shader_uniforms.b[index]; | 59 | return shader_uniforms.b[index]; |
| 58 | } | 60 | } |
| 59 | 61 | ||
| 62 | Math::Vec4<u8>& GetIntUniform(u32 index) | ||
| 63 | { | ||
| 64 | return shader_uniforms.i[index]; | ||
| 65 | } | ||
| 66 | |||
| 60 | const std::array<u32, 1024>& GetShaderBinary() | 67 | const std::array<u32, 1024>& GetShaderBinary() |
| 61 | { | 68 | { |
| 62 | return shader_memory; | 69 | return shader_memory; |
diff --git a/src/video_core/vertex_shader.h b/src/video_core/vertex_shader.h index af3fb2a2f..3a68a3409 100644 --- a/src/video_core/vertex_shader.h +++ b/src/video_core/vertex_shader.h | |||
| @@ -73,6 +73,7 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes); | |||
| 73 | 73 | ||
| 74 | Math::Vec4<float24>& GetFloatUniform(u32 index); | 74 | Math::Vec4<float24>& GetFloatUniform(u32 index); |
| 75 | bool& GetBoolUniform(u32 index); | 75 | bool& GetBoolUniform(u32 index); |
| 76 | Math::Vec4<u8>& GetIntUniform(u32 index); | ||
| 76 | 77 | ||
| 77 | const std::array<u32, 1024>& GetShaderBinary(); | 78 | const std::array<u32, 1024>& GetShaderBinary(); |
| 78 | const std::array<u32, 1024>& GetSwizzlePatterns(); | 79 | const std::array<u32, 1024>& GetSwizzlePatterns(); |