Browse Source

Fixes [shader_recompiler] fix CBuf get/set VUUID due to using composite for U32[1], F32[1] (#3790) (#3823)

Fixes Megaman Starforce Legacy Collection crashing.

Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3823
Reviewed-by: crueter <crueter@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Co-authored-by: John <john@eden-emu.dev>
Co-committed-by: John <john@eden-emu.dev>
remotes/1775727140679917760/master
John 2 weeks ago
committed by crueter
parent
commit
fd0c5655c4
No known key found for this signature in database GPG Key ID: 425ACD2D4830EBC6
  1. 8
      src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp

8
src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp

@ -140,14 +140,8 @@ Id GetCbuf(EmitContext& ctx, Id result_type, Id UniformDefinitions::*member_ptr,
return val;
}
const auto is_float = UniformDefinitions::IsFloat(member_ptr);
const auto num_elements = UniformDefinitions::NumElements(member_ptr);
auto const zero_const = is_float ? ctx.Const(0.0f) : ctx.Const(0u);
const std::array zero_vec{zero_const, zero_const, zero_const, zero_const};
const Id cond = ctx.OpULessThanEqual(ctx.TypeBool(), buffer_offset, ctx.Const(0xFFFFu));
const Id zero = num_elements > 1
? ctx.OpCompositeConstruct(result_type, std::span(zero_vec.data(), num_elements))
: zero_const;
const Id zero = ctx.ConstantNull(result_type);
return ctx.OpSelect(result_type, cond, val, zero);
}

Loading…
Cancel
Save