diff options
| author | 2014-08-14 23:28:55 +0200 | |
|---|---|---|
| committer | 2014-08-25 22:03:18 +0200 | |
| commit | 62c36a4ef0a37fe83bb8f8680f928970bead545b (patch) | |
| tree | d1431dd4a6115dcb4c93abd068149a35058bfa7d /src/video_core/vertex_shader.cpp | |
| parent | Pica/citra-qt: Replace command list view and command list debugging code with... (diff) | |
| download | yuzu-62c36a4ef0a37fe83bb8f8680f928970bead545b.tar.gz yuzu-62c36a4ef0a37fe83bb8f8680f928970bead545b.tar.xz yuzu-62c36a4ef0a37fe83bb8f8680f928970bead545b.zip | |
Pica/VertexShader: Fix a bug in the bitfield definitions and add the "negate" field for swizzlers.
Diffstat (limited to 'src/video_core/vertex_shader.cpp')
| -rw-r--r-- | src/video_core/vertex_shader.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index 8df14b51f..cdecbff3c 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp | |||
| @@ -65,26 +65,32 @@ static void ProcessShaderCode(VertexShaderState& state) { | |||
| 65 | const Instruction& instr = *(const Instruction*)state.program_counter; | 65 | const Instruction& instr = *(const Instruction*)state.program_counter; |
| 66 | state.debug.max_offset = std::max<u32>(state.debug.max_offset, 1 + (state.program_counter - shader_memory)); | 66 | state.debug.max_offset = std::max<u32>(state.debug.max_offset, 1 + (state.program_counter - shader_memory)); |
| 67 | 67 | ||
| 68 | const float24* src1_ = (instr.common.src1 < 0x10) ? state.input_register_table[instr.common.src1] | 68 | const float24* src1_ = (instr.common.src1 < 0x10) ? state.input_register_table[instr.common.src1.GetIndex()] |
| 69 | : (instr.common.src1 < 0x20) ? &state.temporary_registers[instr.common.src1-0x10].x | 69 | : (instr.common.src1 < 0x20) ? &state.temporary_registers[instr.common.src1.GetIndex()].x |
| 70 | : (instr.common.src1 < 0x80) ? &shader_uniforms.f[instr.common.src1-0x20].x | 70 | : (instr.common.src1 < 0x80) ? &shader_uniforms.f[instr.common.src1.GetIndex()].x |
| 71 | : nullptr; | ||
| 72 | const float24* src2_ = (instr.common.src2 < 0x10) ? state.input_register_table[instr.common.src2] | ||
| 73 | : &state.temporary_registers[instr.common.src2-0x10].x; | ||
| 74 | // TODO: Unsure about the limit values | ||
| 75 | float24* dest = (instr.common.dest <= 0x1C) ? state.output_register_table[instr.common.dest] | ||
| 76 | : (instr.common.dest <= 0x3C) ? nullptr | ||
| 77 | : (instr.common.dest <= 0x7C) ? &state.temporary_registers[(instr.common.dest-0x40)/4][instr.common.dest%4] | ||
| 78 | : nullptr; | 71 | : nullptr; |
| 72 | const float24* src2_ = (instr.common.src2 < 0x10) ? state.input_register_table[instr.common.src2.GetIndex()] | ||
| 73 | : &state.temporary_registers[instr.common.src2.GetIndex()].x; | ||
| 74 | float24* dest = (instr.common.dest < 0x08) ? state.output_register_table[4*instr.common.dest.GetIndex()] | ||
| 75 | : (instr.common.dest < 0x10) ? nullptr | ||
| 76 | : (instr.common.dest < 0x20) ? &state.temporary_registers[instr.common.dest.GetIndex()][0] | ||
| 77 | : nullptr; | ||
| 79 | 78 | ||
| 80 | const SwizzlePattern& swizzle = *(SwizzlePattern*)&swizzle_data[instr.common.operand_desc_id]; | 79 | const SwizzlePattern& swizzle = *(SwizzlePattern*)&swizzle_data[instr.common.operand_desc_id]; |
| 80 | const bool negate_src1 = swizzle.negate; | ||
| 81 | 81 | ||
| 82 | const float24 src1[4] = { | 82 | float24 src1[4] = { |
| 83 | src1_[(int)swizzle.GetSelectorSrc1(0)], | 83 | src1_[(int)swizzle.GetSelectorSrc1(0)], |
| 84 | src1_[(int)swizzle.GetSelectorSrc1(1)], | 84 | src1_[(int)swizzle.GetSelectorSrc1(1)], |
| 85 | src1_[(int)swizzle.GetSelectorSrc1(2)], | 85 | src1_[(int)swizzle.GetSelectorSrc1(2)], |
| 86 | src1_[(int)swizzle.GetSelectorSrc1(3)], | 86 | src1_[(int)swizzle.GetSelectorSrc1(3)], |
| 87 | }; | 87 | }; |
| 88 | if (negate_src1) { | ||
| 89 | src1[0] = src1[0] * float24::FromFloat32(-1); | ||
| 90 | src1[1] = src1[1] * float24::FromFloat32(-1); | ||
| 91 | src1[2] = src1[2] * float24::FromFloat32(-1); | ||
| 92 | src1[3] = src1[3] * float24::FromFloat32(-1); | ||
| 93 | } | ||
| 88 | const float24 src2[4] = { | 94 | const float24 src2[4] = { |
| 89 | src2_[(int)swizzle.GetSelectorSrc2(0)], | 95 | src2_[(int)swizzle.GetSelectorSrc2(0)], |
| 90 | src2_[(int)swizzle.GetSelectorSrc2(1)], | 96 | src2_[(int)swizzle.GetSelectorSrc2(1)], |