[GPU] Vulkan: Fixed FSI render target path
AlphaToMask was causing crashes on linux due to missing SelectionMerge
This commit is contained in:
@@ -3798,6 +3798,7 @@ void SpirvShaderTranslator::FSI_AlphaToMask() {
|
|||||||
spv::Block& block_msaa_4x = builder_->makeNewBlock();
|
spv::Block& block_msaa_4x = builder_->makeNewBlock();
|
||||||
spv::Block& block_msaa_check_2x = builder_->makeNewBlock();
|
spv::Block& block_msaa_check_2x = builder_->makeNewBlock();
|
||||||
spv::Block& block_msaa_merge = builder_->makeNewBlock();
|
spv::Block& block_msaa_merge = builder_->makeNewBlock();
|
||||||
|
spv::Block& block_msaa_merge_2x_1x = builder_->makeNewBlock();
|
||||||
|
|
||||||
// Check if 4x MSAA
|
// Check if 4x MSAA
|
||||||
spv::Id is_4x = builder_->createBinOp(
|
spv::Id is_4x = builder_->createBinOp(
|
||||||
@@ -3826,6 +3827,8 @@ void SpirvShaderTranslator::FSI_AlphaToMask() {
|
|||||||
builder_->setBuildPoint(&block_msaa_check_2x);
|
builder_->setBuildPoint(&block_msaa_check_2x);
|
||||||
spv::Id is_2x = builder_->createBinOp(
|
spv::Id is_2x = builder_->createBinOp(
|
||||||
spv::OpIEqual, type_bool_, msaa_samples, builder_->makeUintConstant(1));
|
spv::OpIEqual, type_bool_, msaa_samples, builder_->makeUintConstant(1));
|
||||||
|
builder_->createSelectionMerge(&block_msaa_merge_2x_1x,
|
||||||
|
spv::SelectionControlDontFlattenMask);
|
||||||
builder_->createConditionalBranch(is_2x, &block_msaa_2x_actual,
|
builder_->createConditionalBranch(is_2x, &block_msaa_2x_actual,
|
||||||
&block_msaa_1x);
|
&block_msaa_1x);
|
||||||
|
|
||||||
@@ -3836,13 +3839,24 @@ void SpirvShaderTranslator::FSI_AlphaToMask() {
|
|||||||
coverage_2x);
|
coverage_2x);
|
||||||
FSI_AlphaToMaskSample(false, 1, 1.0f, threshold_offset, 1.0f / 8.0f, alpha,
|
FSI_AlphaToMaskSample(false, 1, 1.0f, threshold_offset, 1.0f / 8.0f, alpha,
|
||||||
coverage_2x);
|
coverage_2x);
|
||||||
builder_->createBranch(&block_msaa_merge);
|
builder_->createBranch(&block_msaa_merge_2x_1x);
|
||||||
|
|
||||||
// 1x MSAA path
|
// 1x MSAA path
|
||||||
builder_->setBuildPoint(&block_msaa_1x);
|
builder_->setBuildPoint(&block_msaa_1x);
|
||||||
spv::Id coverage_1x = main_fsi_sample_mask_;
|
spv::Id coverage_1x = main_fsi_sample_mask_;
|
||||||
FSI_AlphaToMaskSample(false, 0, 1.0f, threshold_offset, 1.0f / 4.0f, alpha,
|
FSI_AlphaToMaskSample(false, 0, 1.0f, threshold_offset, 1.0f / 4.0f, alpha,
|
||||||
coverage_1x);
|
coverage_1x);
|
||||||
|
builder_->createBranch(&block_msaa_merge_2x_1x);
|
||||||
|
|
||||||
|
// Merge 2x/1x MSAA paths
|
||||||
|
builder_->setBuildPoint(&block_msaa_merge_2x_1x);
|
||||||
|
id_vector_temp_.clear();
|
||||||
|
id_vector_temp_.push_back(coverage_2x);
|
||||||
|
id_vector_temp_.push_back(block_msaa_2x_actual.getId());
|
||||||
|
id_vector_temp_.push_back(coverage_1x);
|
||||||
|
id_vector_temp_.push_back(block_msaa_1x.getId());
|
||||||
|
spv::Id coverage_2x_1x =
|
||||||
|
builder_->createOp(spv::OpPhi, type_uint_, id_vector_temp_);
|
||||||
builder_->createBranch(&block_msaa_merge);
|
builder_->createBranch(&block_msaa_merge);
|
||||||
|
|
||||||
// Merge MSAA paths with PHI
|
// Merge MSAA paths with PHI
|
||||||
@@ -3850,10 +3864,8 @@ void SpirvShaderTranslator::FSI_AlphaToMask() {
|
|||||||
id_vector_temp_.clear();
|
id_vector_temp_.clear();
|
||||||
id_vector_temp_.push_back(coverage_4x);
|
id_vector_temp_.push_back(coverage_4x);
|
||||||
id_vector_temp_.push_back(block_msaa_4x.getId());
|
id_vector_temp_.push_back(block_msaa_4x.getId());
|
||||||
id_vector_temp_.push_back(coverage_2x);
|
id_vector_temp_.push_back(coverage_2x_1x);
|
||||||
id_vector_temp_.push_back(block_msaa_2x_actual.getId());
|
id_vector_temp_.push_back(block_msaa_merge_2x_1x.getId());
|
||||||
id_vector_temp_.push_back(coverage_1x);
|
|
||||||
id_vector_temp_.push_back(block_msaa_1x.getId());
|
|
||||||
spv::Id coverage_final =
|
spv::Id coverage_final =
|
||||||
builder_->createOp(spv::OpPhi, type_uint_, id_vector_temp_);
|
builder_->createOp(spv::OpPhi, type_uint_, id_vector_temp_);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user