From 875bd2976689a87930e0a068b903a8da38dcd3e3 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 22 May 2015 23:13:09 -0400 Subject: vertex_shader: Implement MIN instruction. --- src/video_core/vertex_shader.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/video_core/vertex_shader.cpp') diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index 4ebb42429..582712bde 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp @@ -208,6 +208,15 @@ static void ProcessShaderCode(VertexShaderState& state) { } break; + case OpCode::Id::MIN: + for (int i = 0; i < 4; ++i) { + if (!swizzle.DestComponentEnabled(i)) + continue; + + dest[i] = std::min(src1[i], src2[i]); + } + break; + case OpCode::Id::DP3: case OpCode::Id::DP4: { -- cgit v1.2.3 From 4ac6c1a3b51b80cfd5b914fe87cf4a4663eeea32 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 22 May 2015 23:40:43 -0400 Subject: vertex_shader: Implement SLT/SLTI instructions. --- src/video_core/vertex_shader.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/video_core/vertex_shader.cpp') diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index 582712bde..ac4483659 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp @@ -120,10 +120,6 @@ static void ProcessShaderCode(VertexShaderState& state) { case OpCode::Type::Arithmetic: { bool is_inverted = 0 != (instr.opcode.Value().GetInfo().subtype & OpCode::Info::SrcInversed); - // TODO: We don't really support this properly: For instance, the address register - // offset needs to be applied to SRC2 instead, etc. - // For now, we just abort in this situation. - ASSERT_MSG(!is_inverted, "Bad condition..."); const int address_offset = (instr.common.address_register_index == 0) ? 0 : state.address_registers[instr.common.address_register_index - 1]; @@ -288,6 +284,16 @@ static void ProcessShaderCode(VertexShaderState& state) { break; } + case OpCode::Id::SLT: + case OpCode::Id::SLTI: + for (int i = 0; i < 4; ++i) { + if (!swizzle.DestComponentEnabled(i)) + continue; + + dest[i] = (src1[i] < src2[i]) ? float24::FromFloat32(1.0f) : float24::FromFloat32(0.0f); + } + break; + case OpCode::Id::CMP: for (int i = 0; i < 2; ++i) { // TODO: Can you restrict to one compare via dest masking? -- cgit v1.2.3 From 1574c44586e46607bb951f898956c6240bc92596 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 24 May 2015 10:27:31 -0400 Subject: vertex_shader: Use address offset on src2 in inverted mode. --- src/video_core/vertex_shader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/video_core/vertex_shader.cpp') diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp index ac4483659..87006a832 100644 --- a/src/video_core/vertex_shader.cpp +++ b/src/video_core/vertex_shader.cpp @@ -119,13 +119,13 @@ static void ProcessShaderCode(VertexShaderState& state) { switch (instr.opcode.Value().GetInfo().type) { case OpCode::Type::Arithmetic: { - bool is_inverted = 0 != (instr.opcode.Value().GetInfo().subtype & OpCode::Info::SrcInversed); + const bool is_inverted = (0 != (instr.opcode.Value().GetInfo().subtype & OpCode::Info::SrcInversed)); const int address_offset = (instr.common.address_register_index == 0) ? 0 : state.address_registers[instr.common.address_register_index - 1]; - const float24* src1_ = LookupSourceRegister(instr.common.GetSrc1(is_inverted) + address_offset); - const float24* src2_ = LookupSourceRegister(instr.common.GetSrc2(is_inverted)); + const float24* src1_ = LookupSourceRegister(instr.common.GetSrc1(is_inverted) + (!is_inverted * address_offset)); + const float24* src2_ = LookupSourceRegister(instr.common.GetSrc2(is_inverted) + ( is_inverted * address_offset)); const bool negate_src1 = ((bool)swizzle.negate_src1 != false); const bool negate_src2 = ((bool)swizzle.negate_src2 != false); -- cgit v1.2.3