diff options
Diffstat (limited to 'src/video_core/shader')
| -rw-r--r-- | src/video_core/shader/shader.cpp | 6 | ||||
| -rw-r--r-- | src/video_core/shader/shader.h | 3 | ||||
| -rw-r--r-- | src/video_core/shader/shader_jit_x64_compiler.cpp | 8 |
3 files changed, 13 insertions, 4 deletions
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index c860375a1..67ed19ba8 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp @@ -8,7 +8,8 @@ #include "common/logging/log.h" #include "common/microprofile.h" #include "video_core/pica_state.h" -#include "video_core/regs.h" +#include "video_core/regs_rasterizer.h" +#include "video_core/regs_shader.h" #include "video_core/shader/shader.h" #include "video_core/shader/shader_interpreter.h" #ifdef ARCHITECTURE_x86_64 @@ -39,9 +40,8 @@ OutputVertex OutputVertex::FromAttributeBuffer(const RasterizerRegs& regs, Attri for (unsigned comp = 0; comp < 4; ++comp) { RasterizerRegs::VSOutputAttributes::Semantic semantic = semantics[comp]; - float24* out = &vertex_slots[semantic]; if (semantic < vertex_slots.size()) { - *out = input.attr[i][comp]; + vertex_slots[semantic] = input.attr[i][comp]; } else if (semantic != RasterizerRegs::VSOutputAttributes::INVALID) { LOG_ERROR(HW_GPU, "Invalid/unknown semantic id: %u", (unsigned int)semantic); } diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h index d52682479..38ea717ab 100644 --- a/src/video_core/shader/shader.h +++ b/src/video_core/shader/shader.h @@ -13,7 +13,8 @@ #include "common/common_types.h" #include "common/vector_math.h" #include "video_core/pica_types.h" -#include "video_core/regs.h" +#include "video_core/regs_rasterizer.h" +#include "video_core/regs_shader.h" using nihstro::RegisterType; using nihstro::SourceRegister; diff --git a/src/video_core/shader/shader_jit_x64_compiler.cpp b/src/video_core/shader/shader_jit_x64_compiler.cpp index 92b35dbc0..2dbc8b147 100644 --- a/src/video_core/shader/shader_jit_x64_compiler.cpp +++ b/src/video_core/shader/shader_jit_x64_compiler.cpp @@ -295,14 +295,22 @@ void JitShader::Compile_DestEnable(Instruction instr, Xmm src) { } void JitShader::Compile_SanitizedMul(Xmm src1, Xmm src2, Xmm scratch) { + // 0 * inf and inf * 0 in the PICA should return 0 instead of NaN. This can be implemented by + // checking for NaNs before and after the multiplication. If the multiplication result is NaN + // where neither source was, this NaN was generated by a 0 * inf multiplication, and so the + // result should be transformed to 0 to match PICA fp rules. + + // Set scratch to mask of (src1 != NaN and src2 != NaN) movaps(scratch, src1); cmpordps(scratch, src2); mulps(src1, src2); + // Set src2 to mask of (result == NaN) movaps(src2, src1); cmpunordps(src2, src2); + // Clear components where scratch != src2 (i.e. if result is NaN where neither source was NaN) xorps(scratch, src2); andps(src1, scratch); } |
