be clear where we're referencing gbuffer render targets

This commit is contained in:
AzaezelX 2021-08-28 17:21:45 -05:00
parent c04f3ae166
commit 2287c28d32
9 changed files with 24 additions and 154 deletions

View file

@ -1192,13 +1192,13 @@ void DiffuseFeatureHLSL::processPix( Vector<ShaderComponent*> &componentList,
diffuseMaterialColor->constSortPos = cspPotentialPrimitive;
MultiLine* meta = new MultiLine;
Var *col = (Var*)LangElement::find("col");
Var *col = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget;
if (fd.features[MFT_isDeferred])
{
targ = ShaderFeature::RenderTarget1;
col = (Var*)LangElement::find("col1");
col = (Var*)LangElement::find(getOutputTargetVarName(targ));
if (!col)
{
// create color var
@ -2403,7 +2403,7 @@ void FogFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
fogColor->constSortPos = cspPass;
// Get the out color.
Var *color = (Var*) LangElement::find( "col" );
Var *color = (Var*) LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( !color )
{
color = new Var;
@ -2535,7 +2535,7 @@ void VisibilityFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
// Translucent objects do a simple alpha fade.
if ( fd.features[ MFT_IsTranslucent ] )
{
Var *color = (Var*)LangElement::find( "col" );
Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
meta->addStatement( new GenOp( " @.a *= @;\r\n", color, visibility ) );
return;
}
@ -2577,9 +2577,9 @@ void AlphaTestHLSL::processPix( Vector<ShaderComponent*> &componentList,
}
// If we don't have a color var then we cannot do an alpha test.
Var *color = (Var*)LangElement::find( "col1" );
Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::RenderTarget1));
if (!color)
color = (Var*)LangElement::find("col");
color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( !color )
{
output = NULL;
@ -2612,7 +2612,7 @@ void GlowMaskHLSL::processPix( Vector<ShaderComponent*> &componentList,
//
// The shader compiler will optimize out all the other
// code above that doesn't contribute to the alpha mask.
Var *color = (Var*)LangElement::find( "col" );
Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( color )
output = new GenOp( " @.rgb = 0;\r\n", color );
}
@ -2644,7 +2644,7 @@ void HDROutHLSL::processPix( Vector<ShaderComponent*> &componentList,
const MaterialFeatureData &fd )
{
// Let the helper function do the work.
Var *color = (Var*)LangElement::find( "col" );
Var *color = (Var*)LangElement::find(getOutputTargetVarName(ShaderFeature::DefaultTarget));
if ( color )
output = new GenOp( " @ = hdrEncode( @ );\r\n", color, color );
}