mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Fix GLSL out fragment shader color.
This commit is contained in:
parent
80482753e1
commit
4409a12af6
9 changed files with 59 additions and 17 deletions
|
|
@ -89,10 +89,11 @@ LangElement* ShaderFeatureGLSL::assignColor( LangElement *elem,
|
|||
{
|
||||
// create color var
|
||||
color = new Var;
|
||||
color->setName( getOutputTargetVarName( outputTarget ) );
|
||||
color->setType( "vec4" );
|
||||
color->setName( getOutputTargetVarName( outputTarget ) );
|
||||
color->setStructName( "OUT" );
|
||||
|
||||
return new GenOp( "@ = @", new DecOp(color), elem );
|
||||
return new GenOp( "@ = @", color, elem );
|
||||
}
|
||||
|
||||
LangElement *assign;
|
||||
|
|
@ -2186,6 +2187,7 @@ void FogFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
color = new Var;
|
||||
color->setType( "vec4" );
|
||||
color->setName( "col" );
|
||||
color->setStructName("OUT");
|
||||
}
|
||||
|
||||
Var *fogAmount;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@
|
|||
|
||||
#include "platform/platform.h"
|
||||
#include "shaderGen/GLSL/shaderGenGLSL.h"
|
||||
|
||||
#include "shaderGen/GLSL/shaderCompGLSL.h"
|
||||
#include "shaderGen/featureMgr.h"
|
||||
#include "gfx/gl/tGL/tGL.h"
|
||||
|
||||
|
||||
void ShaderGenPrinterGLSL::printShaderHeader( Stream& stream )
|
||||
|
|
@ -64,13 +65,31 @@ void ShaderGenPrinterGLSL::printVertexShaderCloser( Stream& stream )
|
|||
|
||||
void ShaderGenPrinterGLSL::printPixelShaderOutputStruct( Stream& stream, const MaterialFeatureData &featureData )
|
||||
{
|
||||
// Nothing here
|
||||
// Determine the number of output targets we need
|
||||
U32 numMRTs = 0;
|
||||
for (U32 i = 0; i < FEATUREMGR->getFeatureCount(); i++)
|
||||
{
|
||||
const FeatureInfo &info = FEATUREMGR->getAt(i);
|
||||
if (featureData.features.hasFeature(*info.type))
|
||||
numMRTs |= info.feature->getOutputTargets(featureData);
|
||||
}
|
||||
|
||||
WRITESTR(avar("//Fragment shader OUT\r\n"));
|
||||
//WRITESTR(avar("out vec4 OUT_col;\r\n", i)); // @todo OUT_col defined on hlslCompat.glsl
|
||||
for( U32 i = 1; i < 4; i++ )
|
||||
{
|
||||
if( numMRTs & 1 << i )
|
||||
WRITESTR(avar("out vec4 OUT_col%d;\r\n", i));
|
||||
}
|
||||
|
||||
WRITESTR("\r\n");
|
||||
WRITESTR("\r\n");
|
||||
}
|
||||
|
||||
void ShaderGenPrinterGLSL::printPixelShaderCloser( Stream& stream )
|
||||
{
|
||||
const char *closer = " OUT_FragColor0 = col;\r\n}\r\n";
|
||||
stream.write( dStrlen(closer), closer );
|
||||
const char *closer = " \r\n}\r\n";
|
||||
stream.write( dStrlen(closer), closer );
|
||||
}
|
||||
|
||||
void ShaderGenPrinterGLSL::printLine(Stream& stream, const String& line)
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ void _initShaderGenGLSL( ShaderGen *shaderGen )
|
|||
|
||||
FEATUREMGR->registerFeature( MFT_ImposterVert, new ImposterVertFeatureGLSL );
|
||||
|
||||
//FEATUREMGR->registerFeature( MFT_LightbufferMRT, new NamedFeatureGLSL( "Lightbuffer MRT" ) );
|
||||
FEATUREMGR->registerFeature( MFT_LightbufferMRT, new NamedFeatureGLSL( "Lightbuffer MRT" ) );
|
||||
//FEATUREMGR->registerFeature( MFT_IsTranslucentZWrite, new NamedFeatureGLSL( "Translucent ZWrite" ) );
|
||||
//FEATUREMGR->registerFeature( MFT_InterlacedPrePass, new NamedFeatureGLSL( "Interlaced Pre Pass" ) );
|
||||
|
||||
|
|
|
|||
|
|
@ -78,9 +78,9 @@ LangElement *ConditionerFeature::assignOutput( Var *unconditionedOutput, ShaderF
|
|||
{
|
||||
color->setName( getOutputTargetVarName(outputTarget) );
|
||||
color->setType( "vec4" );
|
||||
DecOp* colDecl = new DecOp(color);
|
||||
color->setStructName( "OUT" );
|
||||
|
||||
assign = new GenOp( "@ = vec4(@)", colDecl, conditionedOutput );
|
||||
assign = new GenOp( "@ = vec4(@)", color, conditionedOutput );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue