From 5f108246b63d610855a3fa0403081d23579a527a Mon Sep 17 00:00:00 2001 From: Triang3l Date: Fri, 12 Oct 2018 22:28:07 +0300 Subject: [PATCH] [D3D12] ROV: Blending constant declaration --- .../gpu/d3d12/d3d12_command_processor.cc | 52 +- .../shaders/dxbc/primitive_point_list_gs.cso | Bin 6828 -> 7004 bytes .../shaders/dxbc/primitive_point_list_gs.h | 809 +++++++++--------- .../shaders/dxbc/primitive_point_list_gs.txt | 15 +- src/xenia/gpu/d3d12/shaders/xenos_draw.hlsli | 16 +- src/xenia/gpu/dxbc_shader_translator.cc | 57 +- src/xenia/gpu/dxbc_shader_translator.h | 147 +++- 7 files changed, 640 insertions(+), 456 deletions(-) diff --git a/src/xenia/gpu/d3d12/d3d12_command_processor.cc b/src/xenia/gpu/d3d12/d3d12_command_processor.cc index a43429eda..268c50b83 100644 --- a/src/xenia/gpu/d3d12/d3d12_command_processor.cc +++ b/src/xenia/gpu/d3d12/d3d12_command_processor.cc @@ -1548,31 +1548,33 @@ void D3D12CommandProcessor::UpdateFixedFunctionState( ff_scissor_update_needed_ = false; } - // Blend factor. - ff_blend_factor_update_needed_ |= - ff_blend_factor_[0] != regs[XE_GPU_REG_RB_BLEND_RED].f32; - ff_blend_factor_update_needed_ |= - ff_blend_factor_[1] != regs[XE_GPU_REG_RB_BLEND_GREEN].f32; - ff_blend_factor_update_needed_ |= - ff_blend_factor_[2] != regs[XE_GPU_REG_RB_BLEND_BLUE].f32; - ff_blend_factor_update_needed_ |= - ff_blend_factor_[3] != regs[XE_GPU_REG_RB_BLEND_ALPHA].f32; - if (ff_blend_factor_update_needed_) { - ff_blend_factor_[0] = regs[XE_GPU_REG_RB_BLEND_RED].f32; - ff_blend_factor_[1] = regs[XE_GPU_REG_RB_BLEND_GREEN].f32; - ff_blend_factor_[2] = regs[XE_GPU_REG_RB_BLEND_BLUE].f32; - ff_blend_factor_[3] = regs[XE_GPU_REG_RB_BLEND_ALPHA].f32; - command_list->OMSetBlendFactor(ff_blend_factor_); - ff_blend_factor_update_needed_ = false; - } + if (!render_target_cache_->IsROVUsedForEDRAM()) { + // Blend factor. + ff_blend_factor_update_needed_ |= + ff_blend_factor_[0] != regs[XE_GPU_REG_RB_BLEND_RED].f32; + ff_blend_factor_update_needed_ |= + ff_blend_factor_[1] != regs[XE_GPU_REG_RB_BLEND_GREEN].f32; + ff_blend_factor_update_needed_ |= + ff_blend_factor_[2] != regs[XE_GPU_REG_RB_BLEND_BLUE].f32; + ff_blend_factor_update_needed_ |= + ff_blend_factor_[3] != regs[XE_GPU_REG_RB_BLEND_ALPHA].f32; + if (ff_blend_factor_update_needed_) { + ff_blend_factor_[0] = regs[XE_GPU_REG_RB_BLEND_RED].f32; + ff_blend_factor_[1] = regs[XE_GPU_REG_RB_BLEND_GREEN].f32; + ff_blend_factor_[2] = regs[XE_GPU_REG_RB_BLEND_BLUE].f32; + ff_blend_factor_[3] = regs[XE_GPU_REG_RB_BLEND_ALPHA].f32; + command_list->OMSetBlendFactor(ff_blend_factor_); + ff_blend_factor_update_needed_ = false; + } - // Stencil reference value. - uint32_t stencil_ref = regs[XE_GPU_REG_RB_STENCILREFMASK].u32 & 0xFF; - ff_stencil_ref_update_needed_ |= ff_stencil_ref_ != stencil_ref; - if (ff_stencil_ref_update_needed_) { - ff_stencil_ref_ = stencil_ref; - command_list->OMSetStencilRef(stencil_ref); - ff_stencil_ref_update_needed_ = false; + // Stencil reference value. + uint32_t stencil_ref = regs[XE_GPU_REG_RB_STENCILREFMASK].u32 & 0xFF; + ff_stencil_ref_update_needed_ |= ff_stencil_ref_ != stencil_ref; + if (ff_stencil_ref_update_needed_) { + ff_stencil_ref_ = stencil_ref; + command_list->OMSetStencilRef(stencil_ref); + ff_stencil_ref_update_needed_ = false; + } } } @@ -1888,7 +1890,7 @@ void D3D12CommandProcessor::UpdateSystemConstantValues( if (rt_mask != 0) { rt_flags |= DxbcShaderTranslator::kRTFlag_Used; if (rt_mask != rt_mask_all) { - rt_flags |= DxbcShaderTranslator::kRTFlag_LoadingNeeded; + rt_flags |= DxbcShaderTranslator::kRTFlag_Load; } } dirty |= system_constants_.edram_rt_flags[i] != rt_flags; diff --git a/src/xenia/gpu/d3d12/shaders/dxbc/primitive_point_list_gs.cso b/src/xenia/gpu/d3d12/shaders/dxbc/primitive_point_list_gs.cso index 85476b9965de25803a2c187521b3441357b1edf7..e02813e1704aa9cf4fd83264710a370e70265346 100644 GIT binary patch delta 987 zcmZY7JxC)#6bJCP%euQ7jhics8pXgNT8Ko^kO+$ST^vUc4#OeDr~!+Z1TTtZI&JRQ zFol(0SZHA(D5#CtSa=*F2nTYnvxmKZgW-|r(6F+5 z-@fE?9r#_z`~JJ}3yFxPeMA+QdoV&SBBO>VP)l^#NHjSzI`)(2Sp=lLRRX~uJOK~ zpnj;c_A9i*R-3eHO=tkh_aS2(So#YZawxlzydLPFL;2HQpc6&KRP5kF!-$|Q&?vOD z-@@YfYPm`QuAH3nusOlm*R^tEAKALV{_@$w`@F>J^oqw GXuJbF{-Kfp delta 863 zcmZY7IZFdU6bJCxC3{3e*aR_46buS!v`C>6MJ2>|6b2GeNM!=)tWsH6NE8tZ#Vq3o zh}AYh0=8b2poLfn9(V*r#6n47spx-lz%KJ(c+8JCGjE1@7%UA8#ZuAn^VY3s_=^gpiV-5DB>-W3z>jjEj)Gn-C2?8=IJ%F@`#X9%DWm>_$ZaqsW#uqQaIU z9Q8!1lJV5;ZIkO_*IuZ~)kdH=(!PT;3Dux3unAi=5!Gn;dB)`-B6^)4iuW;)P$y>_B$U!Gf;LH7Pqw?exNzb znyRa;vk^3!=QIf|aGHe{IbDO6Io*Sva(W8A;`A9>;q(t$wJALoeVP-5zn~$p(CN0M zdw`l1+0{I0Xuzs8?&xrbtWtY|9n?iET7NDRn&9*Vn&I>YnzJeWa`@eO8?o1R;;$EM zN>}7b@k63#@{+JXN0lkjl<9^N6{|A6P=