[Vulkan] Smear scalar bools.

Addresses some shader validation warnings
This commit is contained in:
Herman S.
2025-12-14 00:42:08 +09:00
parent d505b6b53a
commit 6de637b794
2 changed files with 7 additions and 3 deletions

View File

@@ -3333,7 +3333,8 @@ spv::Id SpirvShaderTranslator::EndianSwap128Uint4(spv::Id value,
uint_vector_temp_.push_back(3);
uint_vector_temp_.push_back(2);
value = builder_->createTriOp(
spv::OpSelect, type_uint4_, is_8in64,
spv::OpSelect, type_uint4_,
builder_->smearScalar(spv::NoPrecision, is_8in64, type_bool4_),
builder_->createRvalueSwizzle(spv::NoPrecision, type_uint4_, value,
uint_vector_temp_),
value);
@@ -3348,7 +3349,8 @@ spv::Id SpirvShaderTranslator::EndianSwap128Uint4(spv::Id value,
uint_vector_temp_.push_back(1);
uint_vector_temp_.push_back(0);
value = builder_->createTriOp(
spv::OpSelect, type_uint4_, is_8in128,
spv::OpSelect, type_uint4_,
builder_->smearScalar(spv::NoPrecision, is_8in128, type_bool4_),
builder_->createRvalueSwizzle(spv::NoPrecision, type_uint4_, value,
uint_vector_temp_),
value);

View File

@@ -172,9 +172,11 @@ void SpirvShaderTranslator::ExportToMemory(uint8_t export_eM) {
uint_vector_temp_.push_back(1);
uint_vector_temp_.push_back(0);
uint_vector_temp_.push_back(3);
spv::Id swap_red_blue_bool4 =
builder_->smearScalar(spv::NoPrecision, swap_red_blue, type_bool4_);
for_each_eM([&](uint32_t eM_index) {
eM_swapped[eM_index] = builder_->createTriOp(
spv::OpSelect, type_float4_, swap_red_blue,
spv::OpSelect, type_float4_, swap_red_blue_bool4,
builder_->createRvalueSwizzle(spv::NoPrecision, type_float4_,
eM_original[eM_index], uint_vector_temp_),
eM_original[eM_index]);