@ -542,11 +542,10 @@ private:
return ;
return ;
}
}
for ( u32 rt = 0 ; rt < static_cast < u32 > ( frag_colors. size ( ) ) ; + + rt ) {
for ( u32 rt = 0 ; rt < static_cast < u32 > ( std: : size ( frag_colors ) ) ; + + rt ) {
if ( ! specialization. enabled_rendertargets [ rt ] ) {
if ( ! IsRenderTargetEnabled( rt ) ) {
continue ;
continue ;
}
}
const Id id = AddGlobalVariable ( OpVariable ( t_out_float4 , spv : : StorageClass : : Output ) ) ;
const Id id = AddGlobalVariable ( OpVariable ( t_out_float4 , spv : : StorageClass : : Output ) ) ;
Name ( id , fmt : : format ( " frag_color{} " , rt ) ) ;
Name ( id , fmt : : format ( " frag_color{} " , rt ) ) ;
Decorate ( id , spv : : Decoration : : Location , rt ) ;
Decorate ( id , spv : : Decoration : : Location , rt ) ;
@ -852,6 +851,15 @@ private:
return binding ;
return binding ;
}
}
bool IsRenderTargetEnabled ( u32 rt ) const {
for ( u32 component = 0 ; component < 4 ; + + component ) {
if ( header . ps . IsColorComponentOutputEnabled ( rt , component ) ) {
return true ;
}
}
return false ;
}
bool IsInputAttributeArray ( ) const {
bool IsInputAttributeArray ( ) const {
return stage = = ShaderType : : TesselationControl | | stage = = ShaderType : : TesselationEval | |
return stage = = ShaderType : : TesselationControl | | stage = = ShaderType : : TesselationEval | |
stage = = ShaderType : : Geometry ;
stage = = ShaderType : : Geometry ;
@ -1889,19 +1897,14 @@ private:
// rendertargets/components are skipped in the register assignment.
// rendertargets/components are skipped in the register assignment.
u32 current_reg = 0 ;
u32 current_reg = 0 ;
for ( u32 rt = 0 ; rt < Maxwell : : NumRenderTargets ; + + rt ) {
for ( u32 rt = 0 ; rt < Maxwell : : NumRenderTargets ; + + rt ) {
if ( ! specialization . enabled_rendertargets [ rt ] ) {
// Skip rendertargets that are not enabled
continue ;
}
// TODO(Subv): Figure out how dual-source blending is configured in the Switch.
// TODO(Subv): Figure out how dual-source blending is configured in the Switch.
for ( u32 component = 0 ; component < 4 ; + + component ) {
for ( u32 component = 0 ; component < 4 ; + + component ) {
const Id pointer = AccessElement ( t_out_float , frag_colors . at ( rt ) , component ) ;
if ( ! header . ps . IsColorComponentOutputEnabled ( rt , component ) ) {
if ( header . ps . IsColorComponentOutputEnabled ( rt , component ) ) {
continue ;
}
const Id pointer = AccessElement ( t_out_float , frag_colors [ rt ] , component ) ;
OpStore ( pointer , SafeGetRegister ( current_reg ) ) ;
OpStore ( pointer , SafeGetRegister ( current_reg ) ) ;
+ + current_reg ;
+ + current_reg ;
} else {
OpStore ( pointer , component = = 3 ? v_float_one : v_float_zero ) ;
}
}
}
}
}
if ( header . ps . omap . depth ) {
if ( header . ps . omap . depth ) {