diff options
author | Liam <byteslice@airmail.cc> | 2023-09-22 05:12:45 +0200 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-09-22 06:39:09 +0200 |
commit | 1e24d024342d94a54831623d59305eab8ff4e06f (patch) | |
tree | db8077f366b44238e341a205524056e3de46ec38 /src/shader_recompiler/backend/spirv/emit_spirv_image_atomic.cpp | |
parent | Merge pull request #11564 from t895/overlay-inset-fix (diff) | |
download | yuzu-1e24d024342d94a54831623d59305eab8ff4e06f.tar yuzu-1e24d024342d94a54831623d59305eab8ff4e06f.tar.gz yuzu-1e24d024342d94a54831623d59305eab8ff4e06f.tar.bz2 yuzu-1e24d024342d94a54831623d59305eab8ff4e06f.tar.lz yuzu-1e24d024342d94a54831623d59305eab8ff4e06f.tar.xz yuzu-1e24d024342d94a54831623d59305eab8ff4e06f.tar.zst yuzu-1e24d024342d94a54831623d59305eab8ff4e06f.zip |
Diffstat (limited to 'src/shader_recompiler/backend/spirv/emit_spirv_image_atomic.cpp')
-rw-r--r-- | src/shader_recompiler/backend/spirv/emit_spirv_image_atomic.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_image_atomic.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_image_atomic.cpp index 2a12feddc..dde0f6e9c 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_image_atomic.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_image_atomic.cpp @@ -7,15 +7,12 @@ namespace Shader::Backend::SPIRV { namespace { -Id Image(EmitContext& ctx, const IR::Value& index, IR::TextureInstInfo info) { - if (!index.IsImmediate()) { - throw NotImplementedException("Indirect image indexing"); - } +Id Image(EmitContext& ctx, IR::TextureInstInfo info) { if (info.type == TextureType::Buffer) { - const ImageBufferDefinition def{ctx.image_buffers.at(index.U32())}; + const ImageBufferDefinition def{ctx.image_buffers.at(info.descriptor_index)}; return def.id; } else { - const ImageDefinition def{ctx.images.at(index.U32())}; + const ImageDefinition def{ctx.images.at(info.descriptor_index)}; return def.id; } } @@ -28,8 +25,12 @@ std::pair<Id, Id> AtomicArgs(EmitContext& ctx) { Id ImageAtomicU32(EmitContext& ctx, IR::Inst* inst, const IR::Value& index, Id coords, Id value, Id (Sirit::Module::*atomic_func)(Id, Id, Id, Id, Id)) { + if (!index.IsImmediate() || index.U32() != 0) { + // TODO: handle layers + throw NotImplementedException("Image indexing"); + } const auto info{inst->Flags<IR::TextureInstInfo>()}; - const Id image{Image(ctx, index, info)}; + const Id image{Image(ctx, info)}; const Id pointer{ctx.OpImageTexelPointer(ctx.image_u32, image, coords, ctx.Const(0U))}; const auto [scope, semantics]{AtomicArgs(ctx)}; return (ctx.*atomic_func)(ctx.U32[1], pointer, scope, semantics, value); |