From 30dee62a7f860ca194337b1feff4f69f32a6f0bf Mon Sep 17 00:00:00 2001 From: IndecisiveTurtle <47210458+raphaelthegreat@users.noreply.github.com> Date: Thu, 18 Jul 2024 23:59:57 +0300 Subject: [PATCH] spirv: Fix indices during buffer load --- .../backend/spirv/emit_spirv_context_get_set.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp index aa8e72e37..bd62f7ff4 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp @@ -226,9 +226,9 @@ static Id EmitLoadBufferF32xN(EmitContext& ctx, u32 handle, Id address) { } else { boost::container::static_vector ids; for (u32 i = 0; i < N; i++) { - index = ctx.OpIAdd(ctx.U32[1], index, ctx.ConstU32(i)); + const Id index_i = ctx.OpIAdd(ctx.U32[1], index, ctx.ConstU32(i)); const Id ptr{ - ctx.OpAccessChain(buffer.pointer_type, buffer.id, ctx.u32_zero_value, index)}; + ctx.OpAccessChain(buffer.pointer_type, buffer.id, ctx.u32_zero_value, index_i)}; ids.push_back(ctx.OpLoad(buffer.data_types->Get(1), ptr)); } return ctx.OpCompositeConstruct(buffer.data_types->Get(N), ids); @@ -432,9 +432,9 @@ static void EmitStoreBufferF32xN(EmitContext& ctx, u32 handle, Id address, Id va ctx.OpStore(ptr, value); } else { for (u32 i = 0; i < N; i++) { - index = ctx.OpIAdd(ctx.U32[1], index, ctx.ConstU32(i)); + const Id index_i = ctx.OpIAdd(ctx.U32[1], index, ctx.ConstU32(i)); const Id ptr = - ctx.OpAccessChain(buffer.pointer_type, buffer.id, ctx.u32_zero_value, index); + ctx.OpAccessChain(buffer.pointer_type, buffer.id, ctx.u32_zero_value, index_i); ctx.OpStore(ptr, ctx.OpCompositeExtract(ctx.F32[1], value, i)); } }