From 44cffab389377638c619309dfe30b15c07b24521 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Fri, 25 Mar 2016 18:23:45 -0500 Subject: [PATCH] SPIR-V Max4 --- src/xenia/gpu/spirv_shader_translator.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/xenia/gpu/spirv_shader_translator.cc b/src/xenia/gpu/spirv_shader_translator.cc index f7a1660fb..2749aad01 100644 --- a/src/xenia/gpu/spirv_shader_translator.cc +++ b/src/xenia/gpu/spirv_shader_translator.cc @@ -701,6 +701,7 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction( } break; default: // TODO: the rest of these + assert_always(); break; } @@ -909,6 +910,23 @@ void SpirvShaderTranslator::ProcessVectorAluInstruction( } break; case AluVectorOpcode::kMax4: { + auto src0_x = b.createCompositeExtract(sources[0], float_type_, 0); + auto src0_y = b.createCompositeExtract(sources[0], float_type_, 1); + auto src0_z = b.createCompositeExtract(sources[0], float_type_, 2); + auto src0_w = b.createCompositeExtract(sources[0], float_type_, 3); + + auto max_xy = CreateGlslStd450InstructionCall( + spv::NoPrecision, float_type_, spv::GLSLstd450::kFMax, + {src0_x, src0_y}); + auto max_zw = CreateGlslStd450InstructionCall( + spv::NoPrecision, float_type_, spv::GLSLstd450::kFMax, + {src0_z, src0_w}); + auto max_xyzw = CreateGlslStd450InstructionCall( + spv::NoPrecision, float_type_, spv::GLSLstd450::kFMax, + {max_xy, max_zw}); + + // FIXME: Docs say this only updates pv.x? + dest = b.smearScalar(spv::NoPrecision, max_xyzw, vec4_float_type_); } break; case AluVectorOpcode::kMaxA: {