diff options
| author | DrChat <arkolbed@gmail.com> | 2017-12-22 22:23:43 -0600 |
|---|---|---|
| committer | DrChat <arkolbed@gmail.com> | 2017-12-22 22:24:19 -0600 |
| commit | 366e8b1b6a912ecc711cb9abe9f338bab1417472 (patch) | |
| tree | 60012262d93fd52a4497a2f7f6fae9d57e078446 | |
| parent | fb89973266f9696bccc65dc8cf161d8824bba885 (diff) | |
[SPIR-V] Fix invalid 1D texture offsets
| -rw-r--r-- | src/xenia/gpu/spirv_shader_translator.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/xenia/gpu/spirv_shader_translator.cc b/src/xenia/gpu/spirv_shader_translator.cc index ebec4ce7e..b4fb42e05 100644 --- a/src/xenia/gpu/spirv_shader_translator.cc +++ b/src/xenia/gpu/spirv_shader_translator.cc @@ -905,11 +905,9 @@ void SpirvShaderTranslator::ProcessLoopStartInstruction( // loop_count_ = uvec4(loop_count_value, loop_count_.xyz); auto loop_count = b.createLoad(loop_count_); - loop_count = - b.createRvalueSwizzle(spv::NoPrecision, vec4_uint_type_, loop_count, - std::vector<uint32_t>({0, 0, 1, 2})); - loop_count = - b.createCompositeInsert(loop_count_value, loop_count, vec4_uint_type_, 0); + loop_count = b.createRvalueSwizzle(spv::NoPrecision, vec4_uint_type_, loop_count, + std::vector<uint32_t>({0, 0, 1, 2})); + loop_count = b.createCompositeInsert(loop_count_value, loop_count, vec4_uint_type_, 0); b.createStore(loop_count, loop_count_); // aL = aL.xxyz; @@ -1461,9 +1459,14 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction( if (instr.dimension == TextureDimension::k1D) { if (instr.attributes.offset_x) { - auto offset = b.makeFloatConstant(instr.attributes.offset_x + 0.5f); - offset = b.createBinOp(spv::Op::OpFDiv, float_type_, offset, size); - src = b.createBinOp(spv::Op::OpFAdd, float_type_, src, offset); + auto offset = b.makeCompositeConstant( + vec2_float_type_, + std::vector<Id>( + {b.makeFloatConstant(instr.attributes.offset_x + 0.5f), + b.makeFloatConstant(0.f)})); + offset = + b.createBinOp(spv::Op::OpFDiv, vec2_float_type_, offset, size); + src = b.createBinOp(spv::Op::OpFAdd, vec2_float_type_, src, offset); } // https://msdn.microsoft.com/en-us/library/windows/desktop/bb944006.aspx // "Because the runtime does not support 1D textures, the compiler will |
