[D3D12] ROV: A bit of non-working blending code
This commit is contained in:
@@ -1798,19 +1798,23 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
|
||||
// Color exponent bias and output index mapping or ROV writing.
|
||||
uint32_t rb_color_mask = regs[XE_GPU_REG_RB_COLOR_MASK].u32;
|
||||
for (uint32_t i = 0; i < 4; ++i) {
|
||||
uint32_t color_info;
|
||||
uint32_t color_info, blend_control;
|
||||
switch (i) {
|
||||
case 1:
|
||||
color_info = regs[XE_GPU_REG_RB_COLOR1_INFO].u32;
|
||||
blend_control = regs[XE_GPU_REG_RB_BLENDCONTROL_1].u32;
|
||||
break;
|
||||
case 2:
|
||||
color_info = regs[XE_GPU_REG_RB_COLOR2_INFO].u32;
|
||||
blend_control = regs[XE_GPU_REG_RB_BLENDCONTROL_2].u32;
|
||||
break;
|
||||
case 3:
|
||||
color_info = regs[XE_GPU_REG_RB_COLOR3_INFO].u32;
|
||||
blend_control = regs[XE_GPU_REG_RB_BLENDCONTROL_3].u32;
|
||||
break;
|
||||
default:
|
||||
color_info = regs[XE_GPU_REG_RB_COLOR_INFO].u32;
|
||||
blend_control = regs[XE_GPU_REG_RB_BLENDCONTROL_0].u32;
|
||||
}
|
||||
// Exponent bias is in bits 20:25 of RB_COLOR_INFO.
|
||||
int32_t color_exp_bias = int32_t(color_info << 6) >> 26;
|
||||
@@ -1834,6 +1838,8 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
|
||||
dirty |= system_constants_.color_exp_bias[i] != color_exp_bias_scale;
|
||||
system_constants_.color_exp_bias[i] = color_exp_bias_scale;
|
||||
if (render_target_cache_->IsROVUsedForEDRAM()) {
|
||||
uint32_t rt_pair_index = i >> 1;
|
||||
uint32_t rt_pair_comp = (i & 1) << 1;
|
||||
uint32_t edram_base_dwords = (color_info & 0xFFF) * 1280;
|
||||
dirty |= system_constants_.edram_base_dwords[i] != edram_base_dwords;
|
||||
system_constants_.edram_base_dwords[i] = edram_base_dwords;
|
||||
@@ -1892,6 +1898,27 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
|
||||
if (rt_mask != rt_mask_all) {
|
||||
rt_flags |= DxbcShaderTranslator::kRTFlag_Load;
|
||||
}
|
||||
uint32_t blend_x, blend_y;
|
||||
if (DxbcShaderTranslator::GetBlendConstants(blend_control, blend_x,
|
||||
blend_y)) {
|
||||
rt_flags |= DxbcShaderTranslator::kRTFlag_Load |
|
||||
DxbcShaderTranslator::kRTFlag_Blend;
|
||||
if (system_constants_
|
||||
.edram_blend_rt01_rt23[rt_pair_index][rt_pair_comp] !=
|
||||
blend_x) {
|
||||
dirty = true;
|
||||
system_constants_
|
||||
.edram_blend_rt01_rt23[rt_pair_index][rt_pair_comp] = blend_x;
|
||||
}
|
||||
if (system_constants_
|
||||
.edram_blend_rt01_rt23[rt_pair_index][rt_pair_comp + 1] !=
|
||||
blend_x) {
|
||||
dirty = true;
|
||||
system_constants_
|
||||
.edram_blend_rt01_rt23[rt_pair_index][rt_pair_comp + 1] =
|
||||
blend_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
dirty |= system_constants_.edram_rt_flags[i] != rt_flags;
|
||||
system_constants_.edram_rt_flags[i] = rt_flags;
|
||||
@@ -2001,8 +2028,6 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
|
||||
assert_always();
|
||||
break;
|
||||
}
|
||||
uint32_t rt_pair_index = i >> 1;
|
||||
uint32_t rt_pair_comp = (i & 1) << 1;
|
||||
system_constants_
|
||||
.edram_load_mask_rt01_rt23[rt_pair_index][rt_pair_comp] =
|
||||
color_mask;
|
||||
@@ -2035,6 +2060,26 @@ void D3D12CommandProcessor::UpdateSystemConstantValues(
|
||||
}
|
||||
}
|
||||
|
||||
// Blend constant for ROV blending.
|
||||
if (render_target_cache_->IsROVUsedForEDRAM()) {
|
||||
dirty |= system_constants_.edram_blend_constant[0] !=
|
||||
regs[XE_GPU_REG_RB_BLEND_RED].f32;
|
||||
system_constants_.edram_blend_constant[0] =
|
||||
regs[XE_GPU_REG_RB_BLEND_RED].f32;
|
||||
dirty |= system_constants_.edram_blend_constant[1] !=
|
||||
regs[XE_GPU_REG_RB_BLEND_GREEN].f32;
|
||||
system_constants_.edram_blend_constant[1] =
|
||||
regs[XE_GPU_REG_RB_BLEND_GREEN].f32;
|
||||
dirty |= system_constants_.edram_blend_constant[2] !=
|
||||
regs[XE_GPU_REG_RB_BLEND_BLUE].f32;
|
||||
system_constants_.edram_blend_constant[2] =
|
||||
regs[XE_GPU_REG_RB_BLEND_BLUE].f32;
|
||||
dirty |= system_constants_.edram_blend_constant[3] !=
|
||||
regs[XE_GPU_REG_RB_BLEND_ALPHA].f32;
|
||||
system_constants_.edram_blend_constant[3] =
|
||||
regs[XE_GPU_REG_RB_BLEND_ALPHA].f32;
|
||||
}
|
||||
|
||||
cbuffer_bindings_system_.up_to_date &= !dirty;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user