From ff7ef050632fb0c85760383f911bb9328e42176c Mon Sep 17 00:00:00 2001 From: Triang3l Date: Tue, 26 Jul 2022 17:08:12 +0300 Subject: [PATCH] [SPIR-V] Clamp cube face using NClamp, not NMax/FMin --- src/xenia/gpu/spirv_shader_translator_fetch.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/xenia/gpu/spirv_shader_translator_fetch.cc b/src/xenia/gpu/spirv_shader_translator_fetch.cc index 7be662460..88d3bd5ab 100644 --- a/src/xenia/gpu/spirv_shader_translator_fetch.cc +++ b/src/xenia/gpu/spirv_shader_translator_fetch.cc @@ -1296,18 +1296,14 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction( builder_->addDecoration(face, spv::DecorationNoContraction); } id_vector_temp_.clear(); - id_vector_temp_.reserve(2); + id_vector_temp_.reserve(3); + id_vector_temp_.push_back(face); id_vector_temp_.push_back(const_float_0_); - id_vector_temp_.push_back(face); - face = builder_->createBuiltinCall(type_float_, ext_inst_glsl_std_450_, - GLSLstd450NMax, id_vector_temp_); - id_vector_temp_.clear(); - id_vector_temp_.reserve(2); id_vector_temp_.push_back(builder_->makeFloatConstant(5.0f)); - id_vector_temp_.push_back(face); - face = builder_->createBuiltinCall(type_float_, ext_inst_glsl_std_450_, - GLSLstd450FMin, id_vector_temp_); - face = builder_->createUnaryOp(spv::OpConvertFToU, type_uint_, face); + face = builder_->createUnaryOp( + spv::OpConvertFToU, type_uint_, + builder_->createBuiltinCall(type_float_, ext_inst_glsl_std_450_, + GLSLstd450NClamp, id_vector_temp_)); // Split the face index into the axis and the sign. spv::Id const_uint_1 = builder_->makeUintConstant(1); spv::Id face_axis = builder_->createBinOp(