From ace895d4f3949bb3cce92c287bcb99ec74ede2ae Mon Sep 17 00:00:00 2001 From: Ben Vanik Date: Sun, 21 Feb 2016 15:44:09 -0800 Subject: [PATCH] Fixing 1/w0 correction. --- src/xenia/gpu/spirv_shader_translator.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xenia/gpu/spirv_shader_translator.cc b/src/xenia/gpu/spirv_shader_translator.cc index b33cc7a75..5684a24e3 100644 --- a/src/xenia/gpu/spirv_shader_translator.cc +++ b/src/xenia/gpu/spirv_shader_translator.cc @@ -279,14 +279,14 @@ std::vector SpirvShaderTranslator::CompleteTranslation() { auto p = b.createLoad(pos_); auto c = b.createBinOp(spv::Op::OpFOrdNotEqual, vec4_bool_type_, vtx_fmt, - b.makeFloatConstant(0.f)); + vec4_float_zero_); - // pos.w = vtx_fmt.w != 0.0 ? 1.0 / pos.w : pos.w + // pos.w = vtx_fmt.w == 0.0 ? 1.0 / pos.w : pos.w auto c_w = b.createCompositeExtract(c, bool_type_, 3); auto p_w = b.createCompositeExtract(p, float_type_, 3); auto p_w_inv = b.createBinOp(spv::Op::OpFDiv, float_type_, b.makeFloatConstant(1.f), p_w); - p_w = b.createTriOp(spv::Op::OpSelect, float_type_, c_w, p_w_inv, p_w); + p_w = b.createTriOp(spv::Op::OpSelect, float_type_, c_w, p_w, p_w_inv); // pos.xyz = vtx_fmt.xyz != 0.0 ? pos.xyz / pos.w : pos.xyz auto p_all_w = b.smearScalar(spv::Decoration::DecorationInvariant, p_w,