tu6_update_msaa_samples(cmd, rasterizationSamples);
}
+VKAPI_ATTR void VKAPI_CALL
+tu_CmdSetAlphaToCoverageEnableEXT(VkCommandBuffer commandBuffer,
+ VkBool32 alphaToCoverageEnable)
+{
+ TU_FROM_HANDLE(tu_cmd_buffer, cmd, commandBuffer);
+
+ cmd->state.alpha_to_coverage = alphaToCoverageEnable;
+ cmd->state.rb_blend_cntl =
+ (cmd->state.rb_blend_cntl & ~A6XX_RB_BLEND_CNTL_ALPHA_TO_COVERAGE) |
+ COND(alphaToCoverageEnable, A6XX_RB_BLEND_CNTL_ALPHA_TO_COVERAGE);
+ cmd->state.sp_blend_cntl =
+ (cmd->state.sp_blend_cntl & ~A6XX_RB_BLEND_CNTL_ALPHA_TO_COVERAGE) |
+ COND(alphaToCoverageEnable, A6XX_RB_BLEND_CNTL_ALPHA_TO_COVERAGE);
+
+ cmd->state.dirty |= TU_CMD_DIRTY_BLEND;
+}
+
static void
tu_flush_for_access(struct tu_cache_state *cache,
enum tu_cmd_access_mask src_mask,
: A6XX_LATE_Z;
}
- if ((cmd->state.pipeline->lrz.force_late_z &&
- !cmd->state.pipeline->lrz.fs.force_early_z) || !depth_test_enable)
+ bool force_late_z = cmd->state.pipeline->lrz.force_late_z ||
+ /* If enabled dynamically, alpha-to-coverage can behave like a discard.
+ */
+ ((cmd->state.pipeline->dynamic_state_mask &
+ BIT(TU_DYNAMIC_STATE_ALPHA_TO_COVERAGE)) &&
+ cmd->state.alpha_to_coverage);
+ if ((force_late_z && !cmd->state.pipeline->lrz.fs.force_early_z) ||
+ !depth_test_enable)
zmode = A6XX_LATE_Z;
/* User defined early tests take precedence above all else */
BIT(TU_DYNAMIC_STATE_COLOR_WRITE_ENABLE))
color_write_enable &= cmd->state.color_write_enable;
- for (unsigned i = 0; i < pipeline->blend.num_rts; i++) {
+ unsigned num_rts = pipeline->blend.num_rts;
+ if (num_rts == 0 &&
+ (pipeline->dynamic_state_mask & BIT(TU_DYNAMIC_STATE_ALPHA_TO_COVERAGE)) &&
+ cmd->state.alpha_to_coverage) {
+ num_rts = 1;
+ }
+
+ for (unsigned i = 0; i < num_rts; i++) {
tu_cs_emit_pkt4(cs, REG_A6XX_RB_MRT_CONTROL(i), 2);
if (color_write_enable & BIT(i)) {
tu_cs_emit(cs, cmd->state.rb_mrt_control[i] |
if (!(cmd->state.logic_op_enabled && cmd->state.rop_reads_dst))
blend_enable_mask &= cmd->state.pipeline_blend_enable;
- tu_cs_emit_regs(cs, A6XX_SP_FS_OUTPUT_CNTL1(.mrt = pipeline->blend.num_rts));
- tu_cs_emit_regs(cs, A6XX_RB_FS_OUTPUT_CNTL1(.mrt = pipeline->blend.num_rts));
+ tu_cs_emit_regs(cs, A6XX_SP_FS_OUTPUT_CNTL1(.mrt = num_rts));
+ tu_cs_emit_regs(cs, A6XX_RB_FS_OUTPUT_CNTL1(.mrt = num_rts));
tu_cs_emit_pkt4(cs, REG_A6XX_SP_BLEND_CNTL, 1);
tu_cs_emit(cs, cmd->state.sp_blend_cntl |
(A6XX_SP_BLEND_CNTL_ENABLE_BLEND(blend_enable_mask) &
case VK_DYNAMIC_STATE_RASTERIZATION_SAMPLES_EXT:
pipeline->dynamic_state_mask |= BIT(TU_DYNAMIC_STATE_MSAA_SAMPLES);
break;
+ case VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT:
+ pipeline->dynamic_state_mask |=
+ BIT(TU_DYNAMIC_STATE_ALPHA_TO_COVERAGE) |
+ BIT(TU_DYNAMIC_STATE_BLEND);
+ pipeline->blend.rb_blend_cntl_mask &=
+ ~A6XX_RB_BLEND_CNTL_ALPHA_TO_COVERAGE;
+ pipeline->blend.sp_blend_cntl_mask &=
+ ~A6XX_SP_BLEND_CNTL_ALPHA_TO_COVERAGE;
+ break;
default:
assert(!"unsupported dynamic state");
break;
BIT(TU_DYNAMIC_STATE_LOGIC_OP) |
BIT(TU_DYNAMIC_STATE_LOGIC_OP_ENABLE) |
BIT(TU_DYNAMIC_STATE_COLOR_WRITE_ENABLE) |
- BIT(TU_DYNAMIC_STATE_MSAA_SAMPLES);
+ BIT(TU_DYNAMIC_STATE_MSAA_SAMPLES) |
+ BIT(TU_DYNAMIC_STATE_ALPHA_TO_COVERAGE);
}
if ((library->state &
builder->use_color_attachments ? builder->create_info->pColorBlendState
: &dummy_blend_info;
+ bool alpha_to_coverage =
+ !(pipeline->dynamic_state_mask &
+ BIT(TU_DYNAMIC_STATE_ALPHA_TO_COVERAGE)) &&
+ msaa_info->alphaToCoverageEnable;
+
bool no_earlyz = builder->depth_attachment_format == VK_FORMAT_S8_UINT ||
/* alpha to coverage can behave like a discard */
- msaa_info->alphaToCoverageEnable;
+ alpha_to_coverage;
pipeline->lrz.force_late_z |= no_earlyz;
pipeline->output.subpass_feedback_loop_color =
&pipeline->blend.rop_reads_dst,
&pipeline->output.color_bandwidth_per_sample);
- if (msaa_info->alphaToCoverageEnable && pipeline->blend.num_rts == 0) {
+ if (alpha_to_coverage && pipeline->blend.num_rts == 0) {
/* In addition to changing the *_OUTPUT_CNTL1 registers, this will also
* make sure we disable memory writes for MRT0 rather than using
* whatever setting was leftover.