diff options
| author | DrChat <arkolbed@gmail.com> | 2018-04-20 15:24:42 -0500 |
|---|---|---|
| committer | DrChat <arkolbed@gmail.com> | 2018-04-20 15:25:07 -0500 |
| commit | 86f387ed42655ca66686b4f3a48cc88b1aa262ce (patch) | |
| tree | 2915b9d424c3ed101cdf6cab388fb8f476d76128 | |
| parent | 2b66a1b68fca2be2a6827f69f9774f7b88287c5a (diff) | |
[SPIR-V] Fix 1D texture fetches. Fixes #1124
| -rw-r--r-- | src/xenia/gpu/spirv_shader_translator.cc | 12 | ||||
| -rw-r--r-- | src/xenia/gpu/spirv_shader_translator.h | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/xenia/gpu/spirv_shader_translator.cc b/src/xenia/gpu/spirv_shader_translator.cc index 0387ad5fe..8375e51c6 100644 --- a/src/xenia/gpu/spirv_shader_translator.cc +++ b/src/xenia/gpu/spirv_shader_translator.cc @@ -1795,6 +1795,12 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction( tex_[dim_idx], std::vector<Id>({texture_index})); auto texture = b.createLoad(texture_ptr); + if (instr.dimension == TextureDimension::k1D) { + // Upgrade 1D src coordinate into 2D + src = b.createCompositeConstruct(vec2_float_type_, + {src, b.makeFloatConstant(0.f)}); + } + spv::Builder::TextureParameters params = {0}; params.coords = src; params.sampler = texture; @@ -1917,6 +1923,12 @@ void SpirvShaderTranslator::ProcessTextureFetchInstruction( tex_[dim_idx], std::vector<Id>({texture_index})); auto texture = b.createLoad(texture_ptr); + if (instr.dimension == TextureDimension::k1D) { + // Upgrade 1D src coordinate into 2D + src = b.createCompositeConstruct(vec2_float_type_, + {src, b.makeFloatConstant(0.f)}); + } + spv::Builder::TextureParameters params = {}; params.sampler = texture; params.coords = src; diff --git a/src/xenia/gpu/spirv_shader_translator.h b/src/xenia/gpu/spirv_shader_translator.h index b55f9a55a..3a7ead2f8 100644 --- a/src/xenia/gpu/spirv_shader_translator.h +++ b/src/xenia/gpu/spirv_shader_translator.h @@ -29,7 +29,7 @@ namespace gpu { // supported size). struct SpirvPushConstants { // Accessible to vertex shader only: - float window_scale[4]; // scale x/y, viewport width/height (pixels) + float window_scale[4]; // scale x/y, offset x/y (pixels) float vtx_fmt[4]; // Accessible to geometry shader only: |
