SPIR-V: Smear one-component scalars
This commit is contained in:
parent
14a6fd838a
commit
abdf071c7d
|
@ -467,12 +467,10 @@ std::vector<uint8_t> SpirvShaderTranslator::CompleteTranslation() {
|
||||||
std::vector<Id>({b.makeUintConstant(2)}));
|
std::vector<Id>({b.makeUintConstant(2)}));
|
||||||
auto alpha_test = b.createLoad(alpha_test_ptr);
|
auto alpha_test = b.createLoad(alpha_test_ptr);
|
||||||
|
|
||||||
auto alpha_test_enabled = b.createCompositeExtract(
|
auto alpha_test_enabled =
|
||||||
alpha_test, float_type_, std::vector<uint32_t>{0});
|
b.createCompositeExtract(alpha_test, float_type_, 0);
|
||||||
auto alpha_test_func = b.createCompositeExtract(alpha_test, float_type_,
|
auto alpha_test_func = b.createCompositeExtract(alpha_test, float_type_, 1);
|
||||||
std::vector<uint32_t>{1});
|
auto alpha_test_ref = b.createCompositeExtract(alpha_test, float_type_, 2);
|
||||||
auto alpha_test_ref = b.createCompositeExtract(alpha_test, float_type_,
|
|
||||||
std::vector<uint32_t>{2});
|
|
||||||
|
|
||||||
alpha_test_func =
|
alpha_test_func =
|
||||||
b.createUnaryOp(spv::Op::OpConvertFToU, uint_type_, alpha_test_func);
|
b.createUnaryOp(spv::Op::OpConvertFToU, uint_type_, alpha_test_func);
|
||||||
|
@ -2455,13 +2453,18 @@ void SpirvShaderTranslator::StoreToResult(Id source_value_id,
|
||||||
auto n_el = b.getNumComponents(source_value_id);
|
auto n_el = b.getNumComponents(source_value_id);
|
||||||
auto n_dst = b.getNumTypeComponents(storage_type);
|
auto n_dst = b.getNumTypeComponents(storage_type);
|
||||||
|
|
||||||
std::vector<uint32_t> channels;
|
if (n_el != 1) {
|
||||||
for (int i = 0; i < n_dst; i++) {
|
std::vector<uint32_t> channels;
|
||||||
channels.push_back(i % n_el);
|
for (int i = 0; i < n_dst; i++) {
|
||||||
}
|
channels.push_back(i % n_el);
|
||||||
|
}
|
||||||
|
|
||||||
source_value_id = b.createRvalueSwizzle(spv::NoPrecision, storage_type,
|
source_value_id = b.createRvalueSwizzle(spv::NoPrecision, storage_type,
|
||||||
source_value_id, channels);
|
source_value_id, channels);
|
||||||
|
} else {
|
||||||
|
source_value_id =
|
||||||
|
b.smearScalar(spv::NoPrecision, source_value_id, storage_type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// swizzle
|
// swizzle
|
||||||
|
|
Loading…
Reference in New Issue