diff options
| author | 2021-05-29 02:49:40 -0300 | |
|---|---|---|
| committer | 2021-07-22 21:51:34 -0400 | |
| commit | d738ad4d0ba02be5603712b3f615d4794a71df9c (patch) | |
| tree | 06ea70d5086dba1709fc8a198d2230503081c082 /src/shader_recompiler | |
| parent | glasm: Fix immediate texture coordinate (diff) | |
| download | yuzu-d738ad4d0ba02be5603712b3f615d4794a71df9c.tar.gz yuzu-d738ad4d0ba02be5603712b3f615d4794a71df9c.tar.xz yuzu-d738ad4d0ba02be5603712b3f615d4794a71df9c.zip | |
spirv: Fix image and image buffer descriptor index usage
Diffstat (limited to 'src/shader_recompiler')
| -rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_image.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp index 99b883746..cf842e1e0 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_image.cpp | |||
| @@ -162,8 +162,10 @@ Id Texture(EmitContext& ctx, IR::TextureInstInfo info, [[maybe_unused]] const IR | |||
| 162 | } | 162 | } |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | Id TextureImage(EmitContext& ctx, IR::TextureInstInfo info, | 165 | Id TextureImage(EmitContext& ctx, IR::TextureInstInfo info, const IR::Value& index) { |
| 166 | [[maybe_unused]] const IR::Value& index) { | 166 | if (!index.IsImmediate() || index.U32() != 0) { |
| 167 | throw NotImplementedException("Indirect image indexing"); | ||
| 168 | } | ||
| 167 | if (info.type == TextureType::Buffer) { | 169 | if (info.type == TextureType::Buffer) { |
| 168 | const TextureBufferDefinition& def{ctx.texture_buffers.at(info.descriptor_index)}; | 170 | const TextureBufferDefinition& def{ctx.texture_buffers.at(info.descriptor_index)}; |
| 169 | if (def.count > 1) { | 171 | if (def.count > 1) { |
| @@ -182,14 +184,14 @@ Id TextureImage(EmitContext& ctx, IR::TextureInstInfo info, | |||
| 182 | } | 184 | } |
| 183 | 185 | ||
| 184 | Id Image(EmitContext& ctx, const IR::Value& index, IR::TextureInstInfo info) { | 186 | Id Image(EmitContext& ctx, const IR::Value& index, IR::TextureInstInfo info) { |
| 185 | if (!index.IsImmediate()) { | 187 | if (!index.IsImmediate() || index.U32() != 0) { |
| 186 | throw NotImplementedException("Indirect image indexing"); | 188 | throw NotImplementedException("Indirect image indexing"); |
| 187 | } | 189 | } |
| 188 | if (info.type == TextureType::Buffer) { | 190 | if (info.type == TextureType::Buffer) { |
| 189 | const ImageBufferDefinition def{ctx.image_buffers.at(index.U32())}; | 191 | const ImageBufferDefinition def{ctx.image_buffers.at(info.descriptor_index)}; |
| 190 | return ctx.OpLoad(def.image_type, def.id); | 192 | return ctx.OpLoad(def.image_type, def.id); |
| 191 | } else { | 193 | } else { |
| 192 | const ImageDefinition def{ctx.images.at(index.U32())}; | 194 | const ImageDefinition def{ctx.images.at(info.descriptor_index)}; |
| 193 | return ctx.OpLoad(def.image_type, def.id); | 195 | return ctx.OpLoad(def.image_type, def.id); |
| 194 | } | 196 | } |
| 195 | } | 197 | } |