mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-25 06:15:36 +00:00
Removes Direct3D9 functionality.
This commit is contained in:
parent
5ac6f6beb3
commit
edd1e0a270
86 changed files with 382 additions and 10445 deletions
|
|
@ -37,7 +37,6 @@ void AccuTexFeatGLSL::processVert(Vector<ShaderComponent*> &componentList,
|
|||
MultiLine *meta = new MultiLine;
|
||||
getOutTexCoord( "texCoord",
|
||||
"vec2",
|
||||
true,
|
||||
false,
|
||||
meta,
|
||||
componentList );
|
||||
|
|
@ -130,8 +129,8 @@ void AccuTexFeatGLSL::processPix(Vector<ShaderComponent*> &componentList,
|
|||
accuSpecular->constSortPos = cspPotentialPrimitive;
|
||||
}
|
||||
|
||||
Var *inTex = getInTexCoord( "texCoord", "vec2", true, componentList );
|
||||
Var *accuVec = getInTexCoord( "accuVec", "vec3", true, componentList );
|
||||
Var *inTex = getInTexCoord( "texCoord", "vec2", componentList );
|
||||
Var *accuVec = getInTexCoord( "accuVec", "vec3", componentList );
|
||||
Var *bumpNorm = (Var *)LangElement::find( "bumpSample" );
|
||||
if( bumpNorm == NULL ) {
|
||||
bumpNorm = (Var *)LangElement::find( "bumpNormal" );
|
||||
|
|
@ -232,7 +231,6 @@ Var* AccuTexFeatGLSL::addOutAccuVec(Vector<ShaderComponent*> &componentList, Mul
|
|||
outAccuVec->setName( "accuVec" );
|
||||
outAccuVec->setStructName( "OUT" );
|
||||
outAccuVec->setType( "float3" );
|
||||
outAccuVec->mapsToSampler = false;
|
||||
|
||||
getAccuVec( meta, outAccuVec );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ void BumpFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
// Output the texture coord.
|
||||
getOutTexCoord( "texCoord",
|
||||
"vec2",
|
||||
true,
|
||||
useTexAnim,
|
||||
meta,
|
||||
componentList );
|
||||
|
|
@ -64,7 +63,7 @@ void BumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
output = meta;
|
||||
|
||||
// Get the texture coord.
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", true, componentList );
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", componentList );
|
||||
|
||||
// Sample the bumpmap.
|
||||
Var *bumpMap = getNormalMapTex();
|
||||
|
|
@ -156,7 +155,7 @@ void BumpFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
bumpMap->sampler = true;
|
||||
bumpMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
texCoord = getInTexCoord( "detCoord", "vec2", true, componentList );
|
||||
texCoord = getInTexCoord( "detCoord", "vec2", componentList );
|
||||
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
|
||||
|
||||
Var *detailBump = new Var;
|
||||
|
|
@ -267,7 +266,6 @@ void ParallaxFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
// Add the texture coords.
|
||||
getOutTexCoord( "texCoord",
|
||||
"vec2",
|
||||
true,
|
||||
fd.features[MFT_TexAnim],
|
||||
meta,
|
||||
componentList );
|
||||
|
|
@ -312,7 +310,7 @@ void ParallaxFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
MultiLine *meta = new MultiLine;
|
||||
|
||||
// Order matters... get this first!
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", true, componentList );
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", componentList );
|
||||
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
|
||||
|
||||
|
|
@ -408,7 +406,6 @@ void NormalsOutFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outNormal->setName( "wsNormal" );
|
||||
outNormal->setStructName( "OUT" );
|
||||
outNormal->setType( "vec3" );
|
||||
outNormal->mapsToSampler = false;
|
||||
|
||||
// Find the incoming vertex normal.
|
||||
Var *inNormal = (Var*)LangElement::find( "normal" );
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ void EyeSpaceDepthOutGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
wsEyeVec->setName( "wsEyeVec" );
|
||||
wsEyeVec->setStructName( "IN" );
|
||||
wsEyeVec->setType( "float4" );
|
||||
wsEyeVec->mapsToSampler = false;
|
||||
wsEyeVec->uniform = false;
|
||||
|
||||
// get shader constants
|
||||
|
|
@ -153,7 +152,6 @@ void DepthOutGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
depthVar->setName( "depth" );
|
||||
depthVar->setStructName( "IN" );
|
||||
depthVar->setType( "float" );
|
||||
depthVar->mapsToSampler = false;
|
||||
depthVar->uniform = false;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ void SpecularMapGLSL::processVert(Vector<ShaderComponent*> &componentList, const
|
|||
// Add the texture coords.
|
||||
getOutTexCoord("texCoord",
|
||||
"vec2",
|
||||
true,
|
||||
fd.features[MFT_TexAnim],
|
||||
meta,
|
||||
componentList);
|
||||
|
|
@ -129,7 +128,7 @@ void SpecularMapGLSL::processVert(Vector<ShaderComponent*> &componentList, const
|
|||
void SpecularMapGLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
|
||||
{
|
||||
// Get the texture coord.
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", true, componentList );
|
||||
Var *texCoord = getInTexCoord( "texCoord", "vec2", componentList );
|
||||
|
||||
// create texture var
|
||||
Var *specularMap = new Var;
|
||||
|
|
|
|||
|
|
@ -333,7 +333,6 @@ Var* ShaderFeatureGLSL::getOutViewToTangent( Vector<ShaderComponent*> &component
|
|||
|
||||
Var* ShaderFeatureGLSL::getOutTexCoord( const char *name,
|
||||
const char *type,
|
||||
bool mapsToSampler,
|
||||
bool useTexAnim,
|
||||
MultiLine *meta,
|
||||
Vector<ShaderComponent*> &componentList )
|
||||
|
|
@ -351,7 +350,6 @@ Var* ShaderFeatureGLSL::getOutTexCoord( const char *name,
|
|||
texCoord->setName( outTexName );
|
||||
texCoord->setStructName( "OUT" );
|
||||
texCoord->setType( type );
|
||||
texCoord->mapsToSampler = mapsToSampler;
|
||||
|
||||
if( useTexAnim )
|
||||
{
|
||||
|
|
@ -386,7 +384,6 @@ Var* ShaderFeatureGLSL::getOutTexCoord( const char *name,
|
|||
|
||||
Var* ShaderFeatureGLSL::getInTexCoord( const char *name,
|
||||
const char *type,
|
||||
bool mapsToSampler,
|
||||
Vector<ShaderComponent*> &componentList )
|
||||
{
|
||||
Var* texCoord = (Var*)LangElement::find( name );
|
||||
|
|
@ -397,7 +394,6 @@ Var* ShaderFeatureGLSL::getInTexCoord( const char *name,
|
|||
texCoord->setName( name );
|
||||
texCoord->setStructName( "IN" );
|
||||
texCoord->setType( type );
|
||||
texCoord->mapsToSampler = mapsToSampler;
|
||||
}
|
||||
|
||||
AssertFatal( dStrcmp( type, (const char*)texCoord->type ) == 0,
|
||||
|
|
@ -447,7 +443,6 @@ Var* ShaderFeatureGLSL::addOutVpos( MultiLine *meta,
|
|||
outVpos->setName( "outVpos" );
|
||||
outVpos->setStructName( "OUT" );
|
||||
outVpos->setType( "vec4" );
|
||||
outVpos->mapsToSampler = false;
|
||||
|
||||
Var *outPosition = (Var*) LangElement::find( "gl_Position" );
|
||||
AssertFatal( outPosition, "ShaderFeatureGLSL::addOutVpos - Didn't find the output position." );
|
||||
|
|
@ -725,7 +720,6 @@ Var* ShaderFeatureGLSL::addOutWsPosition( Vector<ShaderComponent*> &componentLis
|
|||
outWsPosition->setName( "outWsPosition" );
|
||||
outWsPosition->setStructName( "OUT" );
|
||||
outWsPosition->setType( "vec3" );
|
||||
outWsPosition->mapsToSampler = false;
|
||||
|
||||
getWsPosition( componentList, useInstancing, meta, outWsPosition );
|
||||
}
|
||||
|
|
@ -797,7 +791,6 @@ Var* ShaderFeatureGLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
|
|||
outTex->setName( "detCoord" );
|
||||
outTex->setStructName( "OUT" );
|
||||
outTex->setType( "vec2" );
|
||||
outTex->mapsToSampler = true;
|
||||
|
||||
if ( useTexAnim )
|
||||
{
|
||||
|
|
@ -841,7 +834,6 @@ void DiffuseMapFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
MultiLine *meta = new MultiLine;
|
||||
getOutTexCoord( "texCoord",
|
||||
"vec2",
|
||||
true,
|
||||
fd.features[MFT_TexAnim],
|
||||
meta,
|
||||
componentList );
|
||||
|
|
@ -857,7 +849,7 @@ void DiffuseMapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
const MaterialFeatureData &fd )
|
||||
{
|
||||
// grab connector texcoord register
|
||||
Var *inTex = getInTexCoord( "texCoord", "vec2", true, componentList );
|
||||
Var *inTex = getInTexCoord( "texCoord", "vec2", componentList );
|
||||
|
||||
//determine output target
|
||||
ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget;
|
||||
|
|
@ -1023,7 +1015,6 @@ void OverlayTexFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outTex->setName( "outTexCoord2" );
|
||||
outTex->setStructName( "OUT" );
|
||||
outTex->setType( "vec2" );
|
||||
outTex->mapsToSampler = true;
|
||||
|
||||
if( fd.features[MFT_TexAnim] )
|
||||
{
|
||||
|
|
@ -1058,7 +1049,6 @@ void OverlayTexFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
inTex->setName( "texCoord2" );
|
||||
inTex->setStructName( "IN" );
|
||||
inTex->setType( "vec2" );
|
||||
inTex->mapsToSampler = true;
|
||||
|
||||
// create texture var
|
||||
Var *diffuseMap = new Var;
|
||||
|
|
@ -1219,7 +1209,6 @@ void LightmapFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outTex->setName( "texCoord2" );
|
||||
outTex->setStructName( "OUT" );
|
||||
outTex->setType( "vec2" );
|
||||
outTex->mapsToSampler = true;
|
||||
|
||||
// setup language elements to output incoming tex coords to output
|
||||
output = new GenOp( " @ = @;\r\n", outTex, inTex );
|
||||
|
|
@ -1234,7 +1223,6 @@ void LightmapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
inTex->setName( "texCoord2" );
|
||||
inTex->setStructName( "IN" );
|
||||
inTex->setType( "vec2" );
|
||||
inTex->mapsToSampler = true;
|
||||
|
||||
// create texture var
|
||||
Var *lightMap = new Var;
|
||||
|
|
@ -1343,7 +1331,6 @@ void TonemapFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outTex2->setName( "texCoord2" );
|
||||
outTex2->setStructName( "OUT" );
|
||||
outTex2->setType( "vec2" );
|
||||
outTex2->mapsToSampler = true;
|
||||
|
||||
output = new GenOp( " @ = @;\r\n", outTex2, inTex2 );
|
||||
}
|
||||
|
|
@ -1359,7 +1346,6 @@ void TonemapFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
inTex2->setName( "texCoord2" );
|
||||
inTex2->setStructName( "IN" );
|
||||
inTex2->setType( "vec2" );
|
||||
inTex2->mapsToSampler = true;
|
||||
|
||||
// create texture var
|
||||
Var *toneMap = new Var;
|
||||
|
|
@ -1596,7 +1582,7 @@ void DetailFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
const MaterialFeatureData &fd )
|
||||
{
|
||||
// Get the detail texture coord.
|
||||
Var *inTex = getInTexCoord( "detCoord", "vec2", true, componentList );
|
||||
Var *inTex = getInTexCoord( "detCoord", "vec2", componentList );
|
||||
|
||||
// create texture var
|
||||
Var *detailMap = new Var;
|
||||
|
|
@ -1715,7 +1701,6 @@ void ReflectCubeFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outTex->setName( "texCoord" );
|
||||
outTex->setStructName( "OUT" );
|
||||
outTex->setType( "vec2" );
|
||||
outTex->mapsToSampler = true;
|
||||
|
||||
// setup language elements to output incoming tex coords to output
|
||||
meta->addStatement( new GenOp( " @ = @;\r\n", outTex, inTex ) );
|
||||
|
|
@ -1771,7 +1756,6 @@ void ReflectCubeFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
reflectVec->setName( "reflectVec" );
|
||||
reflectVec->setStructName( "OUT" );
|
||||
reflectVec->setType( "vec3" );
|
||||
reflectVec->mapsToSampler = true;
|
||||
|
||||
meta->addStatement( new GenOp( " @ = reflect(@, @);\r\n", reflectVec, eyeToVert, cubeNormal ) );
|
||||
|
||||
|
|
@ -1794,7 +1778,7 @@ void ReflectCubeFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
fd.materialFeatures[MFT_NormalMap] )
|
||||
{
|
||||
// grab connector texcoord register
|
||||
Var *inTex = getInTexCoord( "texCoord", "vec2", true, componentList );
|
||||
Var *inTex = getInTexCoord( "texCoord", "vec2", componentList );
|
||||
|
||||
// create texture var
|
||||
Var *newMap = new Var;
|
||||
|
|
@ -1833,7 +1817,6 @@ void ReflectCubeFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
reflectVec->setName( "reflectVec" );
|
||||
reflectVec->setStructName( "IN" );
|
||||
reflectVec->setType( "vec3" );
|
||||
reflectVec->mapsToSampler = true;
|
||||
|
||||
// create cubemap var
|
||||
Var *cubeMap = new Var;
|
||||
|
|
@ -2007,7 +1990,6 @@ void RTLightingFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outNormal->setName( "wsNormal" );
|
||||
outNormal->setStructName( "OUT" );
|
||||
outNormal->setType( "vec3" );
|
||||
outNormal->mapsToSampler = false;
|
||||
|
||||
// Transform the normal to world space.
|
||||
meta->addStatement( new GenOp( " @ = normalize( @ - @.xyz );\r\n", outNormal, eyePos, inPosition ) );
|
||||
|
|
@ -2039,7 +2021,6 @@ void RTLightingFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outNormal->setName( "wsNormal" );
|
||||
outNormal->setStructName( "OUT" );
|
||||
outNormal->setType( "vec3" );
|
||||
outNormal->mapsToSampler = false;
|
||||
|
||||
// Get the transform to world space.
|
||||
Var *objTrans = getObjTrans( componentList, fd.features[MFT_UseInstancing], meta );
|
||||
|
|
@ -2228,7 +2209,6 @@ void FogFeatGLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
fogAmount->setName( "fogAmount" );
|
||||
fogAmount->setStructName( "OUT" );
|
||||
fogAmount->setType( "float" );
|
||||
fogAmount->mapsToSampler = false;
|
||||
|
||||
meta->addStatement( new GenOp( " @ = saturate( computeSceneFog( @, @, @.r, @.g, @.b ) );\r\n",
|
||||
fogAmount, eyePos, wsPosition, fogData, fogData, fogData ) );
|
||||
|
|
@ -2368,7 +2348,7 @@ void VisibilityFeatGLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// Get the visibility constant.
|
||||
Var *visibility = NULL;
|
||||
if ( fd.features[ MFT_UseInstancing ] )
|
||||
visibility = getInTexCoord( "visibility", "float", false, componentList );
|
||||
visibility = getInTexCoord( "visibility", "float", componentList );
|
||||
else
|
||||
{
|
||||
visibility = (Var*)LangElement::find( "visibility" );
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ public:
|
|||
///
|
||||
Var* getOutTexCoord( const char *name,
|
||||
const char *type,
|
||||
bool mapsToSampler,
|
||||
bool useTexAnim,
|
||||
MultiLine *meta,
|
||||
Vector<ShaderComponent*> &componentList );
|
||||
|
|
@ -48,7 +47,6 @@ public:
|
|||
/// to the input connector if it doesn't exist.
|
||||
static Var* getInTexCoord( const char *name,
|
||||
const char *type,
|
||||
bool mapsToSampler,
|
||||
Vector<ShaderComponent*> &componentList );
|
||||
|
||||
static Var* getInColor( const char *name,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ void AccuTexFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
MultiLine *meta = new MultiLine;
|
||||
getOutTexCoord( "texCoord",
|
||||
"float2",
|
||||
true,
|
||||
false,
|
||||
meta,
|
||||
componentList );
|
||||
|
|
@ -65,10 +64,7 @@ void AccuTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// accu map
|
||||
Var *accuMap = new Var;
|
||||
if (mIsDirect3D11)
|
||||
accuMap->setType("SamplerState");
|
||||
else
|
||||
accuMap->setType("sampler2D");
|
||||
accuMap->setType("SamplerState");
|
||||
|
||||
accuMap->setName( "accuMap" );
|
||||
accuMap->uniform = true;
|
||||
|
|
@ -139,8 +135,8 @@ void AccuTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
accuSpecular->constSortPos = cspPotentialPrimitive;
|
||||
}
|
||||
|
||||
Var *inTex = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
Var *accuVec = getInTexCoord( "accuVec", "float3", true, componentList );
|
||||
Var *inTex = getInTexCoord( "texCoord", "float2", componentList );
|
||||
Var *accuVec = getInTexCoord( "accuVec", "float3", componentList );
|
||||
Var *bumpNorm = (Var *)LangElement::find( "bumpSample" );
|
||||
if( bumpNorm == NULL )
|
||||
{
|
||||
|
|
@ -150,18 +146,14 @@ void AccuTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
}
|
||||
|
||||
// get the accu pixel color
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
Var *accuMapTex = new Var;
|
||||
accuMapTex->setType("Texture2D");
|
||||
accuMapTex->setName("accuMapTex");
|
||||
accuMapTex->uniform = true;
|
||||
accuMapTex->texture = true;
|
||||
accuMapTex->constNum = accuMap->constNum;
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @ * @);\r\n", colorAccuDecl, accuMapTex, accuMap, inTex, accuScale));
|
||||
}
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @ * @);\r\n", colorAccuDecl, accuMap, inTex, accuScale));
|
||||
|
||||
Var *accuMapTex = new Var;
|
||||
accuMapTex->setType("Texture2D");
|
||||
accuMapTex->setName("accuMapTex");
|
||||
accuMapTex->uniform = true;
|
||||
accuMapTex->texture = true;
|
||||
accuMapTex->constNum = accuMap->constNum;
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @ * @);\r\n", colorAccuDecl, accuMapTex, accuMap, inTex, accuScale));
|
||||
|
||||
// scale up normals
|
||||
meta->addStatement( new GenOp( " @.xyz = @.xyz * 2.0 - 0.5;\r\n", bumpNorm, bumpNorm ) );
|
||||
|
|
@ -250,7 +242,6 @@ Var* AccuTexFeatHLSL::addOutAccuVec( Vector<ShaderComponent*> &componentList, Mu
|
|||
outAccuVec->setName( "accuVec" );
|
||||
outAccuVec->setStructName( "OUT" );
|
||||
outAccuVec->setType( "float3" );
|
||||
outAccuVec->mapsToSampler = false;
|
||||
|
||||
getAccuVec( meta, outAccuVec );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ void BumpFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
// Output the texture coord.
|
||||
getOutTexCoord( "texCoord",
|
||||
"float2",
|
||||
true,
|
||||
useTexAnim,
|
||||
meta,
|
||||
componentList );
|
||||
|
|
@ -64,18 +63,14 @@ void BumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
output = meta;
|
||||
|
||||
// Get the texture coord.
|
||||
Var *texCoord = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
Var *texCoord = getInTexCoord("texCoord", "float2", componentList);
|
||||
|
||||
// Sample the bumpmap.
|
||||
Var *bumpMap = getNormalMapTex();
|
||||
LangElement *texOp = NULL;
|
||||
|
||||
//if it's D3D11 let's create the texture object
|
||||
Var* bumpMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
bumpMapTex = (Var*)LangElement::find("bumpMapTex");
|
||||
}
|
||||
Var* bumpMapTex = (Var*)LangElement::find("bumpMapTex");
|
||||
|
||||
// Handle atlased textures
|
||||
// http://www.infinity-universe.com/Infinity/index.php?option=com_content&task=view&id=65&Itemid=47
|
||||
|
|
@ -134,25 +129,11 @@ void BumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// Add a newline
|
||||
meta->addStatement( new GenOp( "\r\n" ) );
|
||||
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
texOp = new GenOp("@.SampleLevel(@, @, mipLod_bump)", bumpMapTex, bumpMap, texCoord);
|
||||
}
|
||||
else if (is_sm3)
|
||||
{
|
||||
texOp = new GenOp("tex2Dlod(@, float4(@, 0.0, mipLod_bump))", bumpMap, texCoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
}
|
||||
texOp = new GenOp("@.SampleLevel(@, @, mipLod_bump)", bumpMapTex, bumpMap, texCoord);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
texOp = new GenOp("@.Sample(@, @)", bumpMapTex, bumpMap, texCoord);
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
texOp = new GenOp("@.Sample(@, @)", bumpMapTex, bumpMap, texCoord);
|
||||
}
|
||||
|
||||
Var *bumpNorm = new Var( "bumpNormal", "float4" );
|
||||
|
|
@ -164,32 +145,22 @@ void BumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
if ( fd.features.hasFeature( MFT_DetailNormalMap ) )
|
||||
{
|
||||
bumpMap = new Var;
|
||||
bumpMap->setType( "sampler2D" );
|
||||
bumpMap->setType( "SamplerState" );
|
||||
bumpMap->setName( "detailBumpMap" );
|
||||
bumpMap->uniform = true;
|
||||
bumpMap->sampler = true;
|
||||
bumpMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
Var* detailBumpTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
bumpMap->setType("SamplerState");
|
||||
detailBumpTex = new Var;
|
||||
detailBumpTex->setName("detailBumpTex");
|
||||
detailBumpTex->setType("Texture2D");
|
||||
detailBumpTex->uniform = true;
|
||||
detailBumpTex->texture = true;
|
||||
detailBumpTex->constNum = bumpMap->constNum;
|
||||
}
|
||||
else
|
||||
bumpMap->setType("sampler2D");
|
||||
Var* detailBumpTex = new Var;
|
||||
detailBumpTex->setName("detailBumpTex");
|
||||
detailBumpTex->setType("Texture2D");
|
||||
detailBumpTex->uniform = true;
|
||||
detailBumpTex->texture = true;
|
||||
detailBumpTex->constNum = bumpMap->constNum;
|
||||
|
||||
texCoord = getInTexCoord( "detCoord", "float2", true, componentList );
|
||||
texCoord = getInTexCoord( "detCoord", "float2", componentList );
|
||||
|
||||
if (mIsDirect3D11)
|
||||
texOp = new GenOp("@.Sample(@, @)", detailBumpTex, bumpMap, texCoord);
|
||||
else
|
||||
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
|
||||
texOp = new GenOp("@.Sample(@, @)", detailBumpTex, bumpMap, texCoord);
|
||||
|
||||
Var *detailBump = new Var;
|
||||
detailBump->setName( "detailBump" );
|
||||
|
|
@ -299,7 +270,6 @@ void ParallaxFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
// Add the texture coords.
|
||||
getOutTexCoord( "texCoord",
|
||||
"float2",
|
||||
true,
|
||||
fd.features[MFT_TexAnim],
|
||||
meta,
|
||||
componentList );
|
||||
|
|
@ -344,7 +314,7 @@ void ParallaxFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
MultiLine *meta = new MultiLine;
|
||||
|
||||
// Order matters... get this first!
|
||||
Var *texCoord = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
Var *texCoord = getInTexCoord( "texCoord", "float2", componentList );
|
||||
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
|
||||
|
||||
|
|
@ -374,21 +344,13 @@ void ParallaxFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// Call the library function to do the rest.
|
||||
if (fd.features.hasFeature(MFT_IsDXTnm, getProcessIndex()))
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffsetDxtnm( @, @, @.xy, @, @ );\r\n",
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffsetDxtnm( @, @, @.xy, @, @ );\r\n",
|
||||
texCoord, bumpMapTexture, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffsetDxtnm( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffset( @, @, @.xy, @, @ );\r\n",
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffset( @, @, @.xy, @, @ );\r\n",
|
||||
texCoord, bumpMapTexture, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @.xy += parallaxOffset( @, @.xy, @, @ );\r\n",
|
||||
texCoord, normalMap, texCoord, negViewTS, parallaxInfo));
|
||||
}
|
||||
|
||||
// TODO: Fix second UV maybe?
|
||||
|
|
@ -449,7 +411,6 @@ void NormalsOutFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outNormal->setName( "wsNormal" );
|
||||
outNormal->setStructName( "OUT" );
|
||||
outNormal->setType( "float3" );
|
||||
outNormal->mapsToSampler = false;
|
||||
|
||||
// Find the incoming vertex normal.
|
||||
Var *inNormal = (Var*)LangElement::find( "normal" );
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ void EyeSpaceDepthOutHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
wsEyeVec->setName( "wsEyeVec" );
|
||||
wsEyeVec->setStructName( "IN" );
|
||||
wsEyeVec->setType( "float4" );
|
||||
wsEyeVec->mapsToSampler = false;
|
||||
wsEyeVec->uniform = false;
|
||||
|
||||
// get shader constants
|
||||
|
|
@ -153,7 +152,6 @@ void DepthOutHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
depthVar->setName( "depth" );
|
||||
depthVar->setStructName( "IN" );
|
||||
depthVar->setType( "float" );
|
||||
depthVar->mapsToSampler = false;
|
||||
depthVar->uniform = false;
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -46,9 +46,7 @@ void ParaboloidVertTransformHLSL::processVert( Vector<ShaderComponent*> &compon
|
|||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
|
||||
|
||||
// Grab connector out position.
|
||||
RegisterType type = RT_POSITION;
|
||||
if (mIsDirect3D11)
|
||||
type = RT_SVPOSITION;
|
||||
RegisterType type = RT_SVPOSITION;
|
||||
|
||||
Var *outPosition = connectComp->getElement(type);
|
||||
outPosition->setName("hpos");
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ void SpecularMapHLSL::processVert(Vector<ShaderComponent*> &componentList, const
|
|||
// Add the texture coords.
|
||||
getOutTexCoord("texCoord",
|
||||
"float2",
|
||||
true,
|
||||
fd.features[MFT_TexAnim],
|
||||
meta,
|
||||
componentList);
|
||||
|
|
@ -133,31 +132,22 @@ void SpecularMapHLSL::processVert(Vector<ShaderComponent*> &componentList, const
|
|||
void SpecularMapHLSL::processPix( Vector<ShaderComponent*> &componentList, const MaterialFeatureData &fd )
|
||||
{
|
||||
// Get the texture coord.
|
||||
Var *texCoord = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
Var *texCoord = getInTexCoord("texCoord", "float2", componentList);
|
||||
|
||||
// create texture var
|
||||
Var *specularMap = new Var;
|
||||
specularMap->setType( "sampler2D" );
|
||||
specularMap->setType( "SamplerState" );
|
||||
specularMap->setName( "specularMap" );
|
||||
specularMap->uniform = true;
|
||||
specularMap->sampler = true;
|
||||
specularMap->constNum = Var::getTexUnitNum();
|
||||
Var *specularMapTex = NULL;
|
||||
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
specularMap->setType("SamplerState");
|
||||
specularMapTex = new Var;
|
||||
specularMapTex->setName("specularMapTex");
|
||||
specularMapTex->setType("Texture2D");
|
||||
specularMapTex->uniform = true;
|
||||
specularMapTex->texture = true;
|
||||
specularMapTex->constNum = specularMap->constNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
specularMap->setType("sampler2D");
|
||||
}
|
||||
Var *specularMapTex = new Var;
|
||||
specularMapTex->setName("specularMapTex");
|
||||
specularMapTex->setType("Texture2D");
|
||||
specularMapTex->uniform = true;
|
||||
specularMapTex->texture = true;
|
||||
specularMapTex->constNum = specularMap->constNum;
|
||||
|
||||
LangElement *texOp = NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,6 @@ LangElement *ShaderFeatureHLSL::expandNormalMap( LangElement *sampleNormalOp,
|
|||
ShaderFeatureHLSL::ShaderFeatureHLSL()
|
||||
{
|
||||
output = NULL;
|
||||
mIsDirect3D11 = GFX->getAdapterType() == Direct3D11;
|
||||
}
|
||||
|
||||
Var * ShaderFeatureHLSL::getVertTexCoord( const String &name )
|
||||
|
|
@ -334,7 +333,6 @@ Var* ShaderFeatureHLSL::getOutViewToTangent( Vector<ShaderComponent*> &component
|
|||
|
||||
Var* ShaderFeatureHLSL::getOutTexCoord( const char *name,
|
||||
const char *type,
|
||||
bool mapsToSampler,
|
||||
bool useTexAnim,
|
||||
MultiLine *meta,
|
||||
Vector<ShaderComponent*> &componentList )
|
||||
|
|
@ -352,7 +350,6 @@ Var* ShaderFeatureHLSL::getOutTexCoord( const char *name,
|
|||
texCoord->setName( outTexName );
|
||||
texCoord->setStructName( "OUT" );
|
||||
texCoord->setType( type );
|
||||
texCoord->mapsToSampler = mapsToSampler;
|
||||
|
||||
if ( useTexAnim )
|
||||
{
|
||||
|
|
@ -387,7 +384,6 @@ Var* ShaderFeatureHLSL::getOutTexCoord( const char *name,
|
|||
|
||||
Var* ShaderFeatureHLSL::getInTexCoord( const char *name,
|
||||
const char *type,
|
||||
bool mapsToSampler,
|
||||
Vector<ShaderComponent*> &componentList )
|
||||
{
|
||||
Var* texCoord = (Var*)LangElement::find( name );
|
||||
|
|
@ -398,7 +394,6 @@ Var* ShaderFeatureHLSL::getInTexCoord( const char *name,
|
|||
texCoord->setName( name );
|
||||
texCoord->setStructName( "IN" );
|
||||
texCoord->setType( type );
|
||||
texCoord->mapsToSampler = mapsToSampler;
|
||||
}
|
||||
|
||||
AssertFatal( dStrcmp( type, (const char*)texCoord->type ) == 0,
|
||||
|
|
@ -446,7 +441,6 @@ Var* ShaderFeatureHLSL::addOutVpos( MultiLine *meta,
|
|||
outVpos->setName( "outVpos" );
|
||||
outVpos->setStructName( "OUT" );
|
||||
outVpos->setType( "float4" );
|
||||
outVpos->mapsToSampler = false;
|
||||
|
||||
Var *outPosition = (Var*) LangElement::find( "hpos" );
|
||||
AssertFatal( outPosition, "ShaderFeatureHLSL::addOutVpos - Didn't find the output position." );
|
||||
|
|
@ -464,36 +458,13 @@ Var* ShaderFeatureHLSL::getInVpos( MultiLine *meta,
|
|||
if ( inVpos )
|
||||
return inVpos;
|
||||
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector*>( componentList[C_CONNECTOR] );
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector*>(componentList[C_CONNECTOR]);
|
||||
|
||||
F32 pixelShaderVer = GFX->getPixelShaderVersion();
|
||||
|
||||
if ( pixelShaderVer >= 4.0f )
|
||||
{
|
||||
inVpos = connectComp->getElement( RT_SVPOSITION );
|
||||
inVpos->setName( "vpos" );
|
||||
inVpos->setStructName( "IN" );
|
||||
inVpos->setType( "float4" );
|
||||
return inVpos;
|
||||
}
|
||||
else if ( pixelShaderVer >= 3.0f )
|
||||
{
|
||||
inVpos = connectComp->getElement( RT_VPOS );
|
||||
inVpos->setName( "vpos" );
|
||||
inVpos->setStructName( "IN" );
|
||||
inVpos->setType( "float2" );
|
||||
return inVpos;
|
||||
}
|
||||
|
||||
inVpos = connectComp->getElement( RT_TEXCOORD );
|
||||
inVpos->setName( "inVpos" );
|
||||
inVpos = connectComp->getElement( RT_SVPOSITION );
|
||||
inVpos->setName( "vpos" );
|
||||
inVpos->setStructName( "IN" );
|
||||
inVpos->setType( "float4" );
|
||||
|
||||
Var *vpos = new Var( "vpos", "float2" );
|
||||
meta->addStatement( new GenOp( " @ = @.xy / @.w;\r\n", new DecOp( vpos ), inVpos, inVpos ) );
|
||||
|
||||
return vpos;
|
||||
return inVpos;
|
||||
}
|
||||
|
||||
Var* ShaderFeatureHLSL::getInWorldToTangent( Vector<ShaderComponent*> &componentList )
|
||||
|
|
@ -532,26 +503,18 @@ Var* ShaderFeatureHLSL::getNormalMapTex()
|
|||
if (!normalMap)
|
||||
{
|
||||
normalMap = new Var;
|
||||
normalMap->setType("sampler2D");
|
||||
normalMap->setType("SamplerState");
|
||||
normalMap->setName("bumpMap");
|
||||
normalMap->uniform = true;
|
||||
normalMap->sampler = true;
|
||||
normalMap->constNum = Var::getTexUnitNum();
|
||||
|
||||
// D3D11
|
||||
Var* normalMapTex = NULL;
|
||||
if (GFX->getAdapterType() == Direct3D11)
|
||||
{
|
||||
normalMap->setType("SamplerState");
|
||||
normalMapTex = new Var;
|
||||
normalMapTex->setName("bumpMapTex");
|
||||
normalMapTex->setType("Texture2D");
|
||||
normalMapTex->uniform = true;
|
||||
normalMapTex->texture = true;
|
||||
normalMapTex->constNum = normalMap->constNum;
|
||||
}
|
||||
|
||||
|
||||
Var* normalMapTex = new Var;
|
||||
normalMapTex->setName("bumpMapTex");
|
||||
normalMapTex->setType("Texture2D");
|
||||
normalMapTex->uniform = true;
|
||||
normalMapTex->texture = true;
|
||||
normalMapTex->constNum = normalMap->constNum;
|
||||
}
|
||||
|
||||
return normalMap;
|
||||
|
|
@ -749,7 +712,6 @@ Var* ShaderFeatureHLSL::addOutWsPosition( Vector<ShaderComponent*> &componentLis
|
|||
outWsPosition->setName( "outWsPosition" );
|
||||
outWsPosition->setStructName( "OUT" );
|
||||
outWsPosition->setType( "float3" );
|
||||
outWsPosition->mapsToSampler = false;
|
||||
|
||||
getWsPosition( componentList, useInstancing, meta, outWsPosition );
|
||||
}
|
||||
|
|
@ -822,7 +784,6 @@ Var* ShaderFeatureHLSL::addOutDetailTexCoord( Vector<ShaderComponent*> &compon
|
|||
outTex->setName( "detCoord" );
|
||||
outTex->setStructName( "OUT" );
|
||||
outTex->setType( "float2" );
|
||||
outTex->mapsToSampler = true;
|
||||
|
||||
if ( useTexAnim )
|
||||
{
|
||||
|
|
@ -864,7 +825,6 @@ void DiffuseMapFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
MultiLine *meta = new MultiLine;
|
||||
getOutTexCoord( "texCoord",
|
||||
"float2",
|
||||
true,
|
||||
fd.features[MFT_TexAnim],
|
||||
meta,
|
||||
componentList );
|
||||
|
|
@ -880,7 +840,7 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
const MaterialFeatureData &fd )
|
||||
{
|
||||
// grab connector texcoord register
|
||||
Var *inTex = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
Var *inTex = getInTexCoord( "texCoord", "float2", componentList );
|
||||
|
||||
//determine output target
|
||||
ShaderFeature::OutputTarget targ = ShaderFeature::DefaultTarget;
|
||||
|
|
@ -889,24 +849,18 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// create texture var
|
||||
Var *diffuseMap = new Var;
|
||||
diffuseMap->setType( "sampler2D" );
|
||||
diffuseMap->setType( "SamplerState" );
|
||||
diffuseMap->setName( "diffuseMap" );
|
||||
diffuseMap->uniform = true;
|
||||
diffuseMap->sampler = true;
|
||||
diffuseMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* diffuseMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
diffuseMap->setType("SamplerState");
|
||||
|
||||
diffuseMapTex = new Var;
|
||||
diffuseMapTex->setName("diffuseMapTex");
|
||||
diffuseMapTex->setType("Texture2D");
|
||||
diffuseMapTex->uniform = true;
|
||||
diffuseMapTex->texture = true;
|
||||
diffuseMapTex->constNum = diffuseMap->constNum;
|
||||
}
|
||||
Var* diffuseMapTex = new Var;
|
||||
diffuseMapTex->setName("diffuseMapTex");
|
||||
diffuseMapTex->setType("Texture2D");
|
||||
diffuseMapTex->uniform = true;
|
||||
diffuseMapTex->texture = true;
|
||||
diffuseMapTex->constNum = diffuseMap->constNum;
|
||||
|
||||
// create sample color
|
||||
Var *diffColor = new Var;
|
||||
|
|
@ -919,10 +873,7 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
if ( fd.features[MFT_CubeMap] )
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @);\r\n", colorDecl, diffuseMapTex, diffuseMap, inTex));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", colorDecl, diffuseMap, inTex));
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @);\r\n", colorDecl, diffuseMapTex, diffuseMap, inTex));
|
||||
|
||||
if (!fd.features[MFT_Imposter])
|
||||
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", diffColor, diffColor));
|
||||
|
|
@ -940,14 +891,14 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
LangElement *atDecl = new DecOp(atlasedTex);
|
||||
|
||||
// Parameters of the texture atlas
|
||||
Var *atParams = new Var;
|
||||
Var *atParams = new Var;
|
||||
atParams->setType("float4");
|
||||
atParams->setName("diffuseAtlasParams");
|
||||
atParams->uniform = true;
|
||||
atParams->constSortPos = cspPotentialPrimitive;
|
||||
|
||||
// Parameters of the texture (tile) this object is using in the atlas
|
||||
Var *tileParams = new Var;
|
||||
Var *tileParams = new Var;
|
||||
tileParams->setType("float4");
|
||||
tileParams->setName("diffuseAtlasTileParams");
|
||||
tileParams->uniform = true;
|
||||
|
|
@ -998,21 +949,9 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
meta->addStatement(new GenOp(" @ = @.SampleLevel(@,@,mipLod);\r\n",
|
||||
new DecOp(diffColor), diffuseMapTex, diffuseMap, inTex));
|
||||
}
|
||||
else if(is_sm3)
|
||||
{
|
||||
meta->addStatement(new GenOp( " @ = tex2Dlod(@, float4(@, 0.0, mipLod));\r\n",
|
||||
new DecOp(diffColor), diffuseMap, inTex));
|
||||
}
|
||||
else
|
||||
{
|
||||
meta->addStatement(new GenOp( " @ = tex2D(@, @);\r\n",
|
||||
new DecOp(diffColor), diffuseMap, inTex));
|
||||
}
|
||||
meta->addStatement(new GenOp(" @ = @.SampleLevel(@,@,mipLod);\r\n",
|
||||
new DecOp(diffColor), diffuseMapTex, diffuseMap, inTex));
|
||||
|
||||
if (!fd.features[MFT_Imposter])
|
||||
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", diffColor, diffColor));
|
||||
|
||||
|
|
@ -1020,10 +959,7 @@ void DiffuseMapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp("@ = @.Sample(@, @);\r\n", colorDecl, diffuseMapTex, diffuseMap, inTex));
|
||||
else
|
||||
meta->addStatement(new GenOp("@ = tex2D(@, @);\r\n", colorDecl, diffuseMap, inTex));
|
||||
meta->addStatement(new GenOp("@ = @.Sample(@, @);\r\n", colorDecl, diffuseMapTex, diffuseMap, inTex));
|
||||
|
||||
if (!fd.features[MFT_Imposter])
|
||||
meta->addStatement(new GenOp(" @ = toLinear(@);\r\n", diffColor, diffColor));
|
||||
|
|
@ -1070,7 +1006,6 @@ void OverlayTexFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outTex->setName( "outTexCoord2" );
|
||||
outTex->setStructName( "OUT" );
|
||||
outTex->setType( "float2" );
|
||||
outTex->mapsToSampler = true;
|
||||
|
||||
if( fd.features[MFT_TexAnim] )
|
||||
{
|
||||
|
|
@ -1105,33 +1040,23 @@ void OverlayTexFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
inTex->setName( "texCoord2" );
|
||||
inTex->setStructName( "IN" );
|
||||
inTex->setType( "float2" );
|
||||
inTex->mapsToSampler = true;
|
||||
|
||||
// create texture var
|
||||
Var *diffuseMap = new Var;
|
||||
diffuseMap->setType( "sampler2D" );
|
||||
diffuseMap->setType( "SamplerState" );
|
||||
diffuseMap->setName( "overlayMap" );
|
||||
diffuseMap->uniform = true;
|
||||
diffuseMap->sampler = true;
|
||||
diffuseMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* diffuseMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
diffuseMap->setType("SamplerState");
|
||||
diffuseMapTex = new Var;
|
||||
diffuseMapTex->setName("overlayMapTex");
|
||||
diffuseMapTex->setType("Texture2D");
|
||||
diffuseMapTex->uniform = true;
|
||||
diffuseMapTex->texture = true;
|
||||
diffuseMapTex->constNum = diffuseMap->constNum;
|
||||
}
|
||||
Var* diffuseMapTex = new Var;
|
||||
diffuseMapTex->setName("overlayMapTex");
|
||||
diffuseMapTex->setType("Texture2D");
|
||||
diffuseMapTex->uniform = true;
|
||||
diffuseMapTex->texture = true;
|
||||
diffuseMapTex->constNum = diffuseMap->constNum;
|
||||
|
||||
LangElement *statement = NULL;
|
||||
if (mIsDirect3D11)
|
||||
statement = new GenOp("@.Sample(@, @)", diffuseMapTex, diffuseMap, inTex);
|
||||
else
|
||||
statement = new GenOp("tex2D(@, @)", diffuseMap, inTex);
|
||||
LangElement *statement = new GenOp("@.Sample(@, @)", diffuseMapTex, diffuseMap, inTex);
|
||||
|
||||
output = new GenOp( " @;\r\n", assignColor( statement, Material::LerpAlpha ) );
|
||||
}
|
||||
|
|
@ -1283,7 +1208,6 @@ void LightmapFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outTex->setName( "texCoord2" );
|
||||
outTex->setStructName( "OUT" );
|
||||
outTex->setType( "float2" );
|
||||
outTex->mapsToSampler = true;
|
||||
|
||||
// setup language elements to output incoming tex coords to output
|
||||
output = new GenOp( " @ = @;\r\n", outTex, inTex );
|
||||
|
|
@ -1298,27 +1222,21 @@ void LightmapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
inTex->setName( "texCoord2" );
|
||||
inTex->setStructName( "IN" );
|
||||
inTex->setType( "float2" );
|
||||
inTex->mapsToSampler = true;
|
||||
|
||||
// create texture var
|
||||
Var *lightMap = new Var;
|
||||
lightMap->setType( "sampler2D" );
|
||||
lightMap->setType( "SamplerState" );
|
||||
lightMap->setName( "lightMap" );
|
||||
lightMap->uniform = true;
|
||||
lightMap->sampler = true;
|
||||
lightMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var *lightMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
lightMap->setType("SamplerState");
|
||||
lightMapTex->setName("lightMapTex");
|
||||
lightMapTex->setType("Texture2D");
|
||||
lightMapTex->uniform = true;
|
||||
lightMapTex->texture = true;
|
||||
lightMapTex->constNum = lightMap->constNum;
|
||||
}
|
||||
|
||||
Var *lightMapTex = new Var;
|
||||
lightMapTex->setName("lightMapTex");
|
||||
lightMapTex->setType("Texture2D");
|
||||
lightMapTex->uniform = true;
|
||||
lightMapTex->texture = true;
|
||||
lightMapTex->constNum = lightMap->constNum;
|
||||
|
||||
// argh, pixel specular should prob use this too
|
||||
if( fd.features[MFT_NormalMap] )
|
||||
|
|
@ -1328,10 +1246,8 @@ void LightmapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
lmColor->setType( "float4" );
|
||||
LangElement *lmColorDecl = new DecOp( lmColor );
|
||||
|
||||
if (mIsDirect3D11)
|
||||
output = new GenOp(" @ = @.Sample(@, @);\r\n", lmColorDecl, lightMapTex, lightMap, inTex);
|
||||
else
|
||||
output = new GenOp(" @ = tex2D(@, @);\r\n", lmColorDecl, lightMap, inTex);
|
||||
output = new GenOp(" @ = @.Sample(@, @);\r\n", lmColorDecl, lightMapTex, lightMap, inTex);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1355,10 +1271,7 @@ void LightmapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
statement = new GenOp("float4(@, 1.0)", inColor);
|
||||
else
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
statement = new GenOp("@.Sample(@, @) + float4(@.rgb, 0.0)", lightMapTex, lightMap, inTex, inColor);
|
||||
else
|
||||
statement = new GenOp("tex2D(@, @) + float4(@.rgb, 0.0)", lightMap, inTex, inColor);
|
||||
statement = new GenOp("@.Sample(@, @) + float4(@.rgb, 0.0)", lightMapTex, lightMap, inTex, inColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1366,10 +1279,7 @@ void LightmapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// If we still don't have it... then just sample the lightmap.
|
||||
if (!statement)
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
statement = new GenOp("@.Sample(@, @)", lightMapTex, lightMap, inTex);
|
||||
else
|
||||
statement = new GenOp("tex2D(@, @)", lightMap, inTex);
|
||||
statement = new GenOp("@.Sample(@, @)", lightMapTex, lightMap, inTex);
|
||||
}
|
||||
|
||||
// Assign to proper render target
|
||||
|
|
@ -1431,7 +1341,6 @@ void TonemapFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outTex2->setName( "texCoord2" );
|
||||
outTex2->setStructName( "OUT" );
|
||||
outTex2->setType( "float2" );
|
||||
outTex2->mapsToSampler = true;
|
||||
|
||||
output = new GenOp( " @ = @;\r\n", outTex2, inTex2 );
|
||||
}
|
||||
|
|
@ -1447,27 +1356,21 @@ void TonemapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
inTex2->setName( "texCoord2" );
|
||||
inTex2->setStructName( "IN" );
|
||||
inTex2->setType( "float2" );
|
||||
inTex2->mapsToSampler = true;
|
||||
|
||||
// create texture var
|
||||
Var *toneMap = new Var;
|
||||
toneMap->setType( "sampler2D" );
|
||||
toneMap->setType( "SamplerState" );
|
||||
toneMap->setName( "toneMap" );
|
||||
toneMap->uniform = true;
|
||||
toneMap->sampler = true;
|
||||
toneMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var *toneMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
toneMap->setType("SamplerState");
|
||||
toneMapTex = new Var;
|
||||
toneMapTex->setName("toneMapTex");
|
||||
toneMapTex->setType("Texture2D");
|
||||
toneMapTex->uniform = true;
|
||||
toneMapTex->texture = true;
|
||||
toneMapTex->constNum = toneMap->constNum;
|
||||
}
|
||||
Var *toneMapTex = new Var;
|
||||
toneMapTex->setName("toneMapTex");
|
||||
toneMapTex->setType("Texture2D");
|
||||
toneMapTex->uniform = true;
|
||||
toneMapTex->texture = true;
|
||||
toneMapTex->constNum = toneMap->constNum;
|
||||
|
||||
MultiLine * meta = new MultiLine;
|
||||
|
||||
|
|
@ -1477,10 +1380,7 @@ void TonemapFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
toneMapColor->setName( "toneMapColor" );
|
||||
LangElement *toneMapColorDecl = new DecOp( toneMapColor );
|
||||
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @);\r\n", toneMapColorDecl, toneMapTex, toneMap, inTex2));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2D(@, @);\r\n", toneMapColorDecl, toneMap, inTex2));
|
||||
meta->addStatement(new GenOp(" @ = @.Sample(@, @);\r\n", toneMapColorDecl, toneMapTex, toneMap, inTex2));
|
||||
|
||||
// We do a different calculation if there is a diffuse map or not
|
||||
Material::BlendOp blendOp = Material::Mul;
|
||||
|
|
@ -1699,27 +1599,22 @@ void DetailFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
const MaterialFeatureData &fd )
|
||||
{
|
||||
// Get the detail texture coord.
|
||||
Var *inTex = getInTexCoord( "detCoord", "float2", true, componentList );
|
||||
Var *inTex = getInTexCoord( "detCoord", "float2", componentList );
|
||||
|
||||
// create texture var
|
||||
Var *detailMap = new Var;
|
||||
detailMap->setType( "sampler2D" );
|
||||
detailMap->setType( "SamplerState" );
|
||||
detailMap->setName( "detailMap" );
|
||||
detailMap->uniform = true;
|
||||
detailMap->sampler = true;
|
||||
detailMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* detailMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
detailMap->setType("SamplerState");
|
||||
detailMapTex = new Var;
|
||||
detailMapTex->setName("detailMapTex");
|
||||
detailMapTex->setType("Texture2D");
|
||||
detailMapTex->uniform = true;
|
||||
detailMapTex->texture = true;
|
||||
detailMapTex->constNum = detailMap->constNum;
|
||||
}
|
||||
Var* detailMapTex = new Var;
|
||||
detailMapTex->setName("detailMapTex");
|
||||
detailMapTex->setType("Texture2D");
|
||||
detailMapTex->uniform = true;
|
||||
detailMapTex->texture = true;
|
||||
detailMapTex->constNum = detailMap->constNum;
|
||||
|
||||
// We're doing the standard greyscale detail map
|
||||
// technique which can darken and lighten the
|
||||
|
|
@ -1728,11 +1623,7 @@ void DetailFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// TODO: We could add a feature to toggle between this
|
||||
// and a simple multiplication with the detail map.
|
||||
|
||||
LangElement *statement = NULL;
|
||||
if (mIsDirect3D11)
|
||||
statement = new GenOp("( @.Sample(@, @) * 2.0 ) - 1.0", detailMapTex, detailMap, inTex);
|
||||
else
|
||||
statement = new GenOp("( tex2D(@, @) * 2.0 ) - 1.0", detailMap, inTex);
|
||||
LangElement *statement = new GenOp("( @.Sample(@, @) * 2.0 ) - 1.0", detailMapTex, detailMap, inTex);
|
||||
|
||||
if ( fd.features[MFT_isDeferred])
|
||||
output = new GenOp( " @;\r\n", assignColor( statement, Material::Add, NULL, ShaderFeature::RenderTarget1 ) );
|
||||
|
|
@ -1789,11 +1680,7 @@ void VertPositionHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
// grab connector position
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>( componentList[C_CONNECTOR] );
|
||||
Var *outPosition = NULL;
|
||||
if (mIsDirect3D11)
|
||||
outPosition = connectComp->getElement(RT_SVPOSITION);
|
||||
else
|
||||
outPosition = connectComp->getElement(RT_POSITION);
|
||||
Var *outPosition = connectComp->getElement(RT_SVPOSITION);
|
||||
|
||||
outPosition->setName( "hpos" );
|
||||
outPosition->setStructName( "OUT" );
|
||||
|
|
@ -1811,14 +1698,11 @@ void VertPositionHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
void VertPositionHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
||||
const MaterialFeatureData &fd)
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
// grab connector position
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>(componentList[C_CONNECTOR]);
|
||||
Var *outPosition = connectComp->getElement(RT_SVPOSITION);
|
||||
outPosition->setName("vpos");
|
||||
outPosition->setStructName("IN");
|
||||
}
|
||||
// grab connector position
|
||||
ShaderConnector *connectComp = dynamic_cast<ShaderConnector *>(componentList[C_CONNECTOR]);
|
||||
Var *outPosition = connectComp->getElement(RT_SVPOSITION);
|
||||
outPosition->setName("vpos");
|
||||
outPosition->setStructName("IN");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1854,7 +1738,6 @@ void ReflectCubeFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outTex->setName( "texCoord" );
|
||||
outTex->setStructName( "OUT" );
|
||||
outTex->setType( "float2" );
|
||||
outTex->mapsToSampler = true;
|
||||
|
||||
// setup language elements to output incoming tex coords to output
|
||||
meta->addStatement( new GenOp( " @ = @;\r\n", outTex, inTex ) );
|
||||
|
|
@ -1910,7 +1793,6 @@ void ReflectCubeFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
reflectVec->setName( "reflectVec" );
|
||||
reflectVec->setStructName( "OUT" );
|
||||
reflectVec->setType( "float3" );
|
||||
reflectVec->mapsToSampler = true;
|
||||
|
||||
meta->addStatement( new GenOp( " @ = reflect(@, @);\r\n", reflectVec, eyeToVert, cubeNormal ) );
|
||||
|
||||
|
|
@ -1933,28 +1815,22 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
fd.materialFeatures[MFT_NormalMap])
|
||||
{
|
||||
// grab connector texcoord register
|
||||
Var *inTex = getInTexCoord( "texCoord", "float2", true, componentList );
|
||||
|
||||
Var *inTex = getInTexCoord("texCoord", "float2", componentList);
|
||||
|
||||
// create texture var
|
||||
Var *newMap = new Var;
|
||||
newMap->setType( "sampler2D" );
|
||||
newMap->setType( "SamplerState" );
|
||||
newMap->setName( "glossMap" );
|
||||
newMap->uniform = true;
|
||||
newMap->sampler = true;
|
||||
newMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* glowMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
newMap->setType("SamplerState");
|
||||
|
||||
glowMapTex = new Var;
|
||||
glowMapTex->setName("glowMapTex");
|
||||
glowMapTex->setType("Texture2D");
|
||||
glowMapTex->uniform = true;
|
||||
glowMapTex->texture = true;
|
||||
glowMapTex->constNum = newMap->constNum;
|
||||
}
|
||||
Var* glowMapTex = new Var;
|
||||
glowMapTex->setName("glowMapTex");
|
||||
glowMapTex->setType("Texture2D");
|
||||
glowMapTex->uniform = true;
|
||||
glowMapTex->texture = true;
|
||||
glowMapTex->constNum = newMap->constNum;
|
||||
|
||||
// create sample color
|
||||
Var *color = new Var;
|
||||
|
|
@ -1964,10 +1840,7 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
glossColor = color;
|
||||
|
||||
if (mIsDirect3D11)
|
||||
meta->addStatement(new GenOp(" @ = @.Sample( @, @ );\r\n", colorDecl, glowMapTex, newMap, inTex));
|
||||
else
|
||||
meta->addStatement(new GenOp(" @ = tex2D( @, @ );\r\n", colorDecl, newMap, inTex));
|
||||
meta->addStatement(new GenOp(" @ = @.Sample( @, @ );\r\n", colorDecl, glowMapTex, newMap, inTex));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -1988,27 +1861,21 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
reflectVec->setName( "reflectVec" );
|
||||
reflectVec->setStructName( "IN" );
|
||||
reflectVec->setType( "float3" );
|
||||
reflectVec->mapsToSampler = true;
|
||||
|
||||
// create cubemap var
|
||||
Var *cubeMap = new Var;
|
||||
cubeMap->setType( "samplerCUBE" );
|
||||
cubeMap->setType( "SamplerState" );
|
||||
cubeMap->setName( "cubeMap" );
|
||||
cubeMap->uniform = true;
|
||||
cubeMap->sampler = true;
|
||||
cubeMap->constNum = Var::getTexUnitNum(); // used as texture unit num here
|
||||
|
||||
Var* cubeMapTex = NULL;
|
||||
if (mIsDirect3D11)
|
||||
{
|
||||
cubeMap->setType("SamplerState");
|
||||
cubeMapTex = new Var;
|
||||
cubeMapTex->setName("cubeMapTex");
|
||||
cubeMapTex->setType("TextureCube"); // cubeMapTex->setType("TextureCube");
|
||||
cubeMapTex->uniform = true;
|
||||
cubeMapTex->texture = true;
|
||||
cubeMapTex->constNum = cubeMap->constNum;
|
||||
}
|
||||
Var* cubeMapTex = new Var;
|
||||
cubeMapTex->setName("cubeMapTex");
|
||||
cubeMapTex->setType("TextureCube"); // cubeMapTex->setType("TextureCube");
|
||||
cubeMapTex->uniform = true;
|
||||
cubeMapTex->texture = true;
|
||||
cubeMapTex->constNum = cubeMap->constNum;
|
||||
|
||||
// TODO: Restore the lighting attenuation here!
|
||||
Var *attn = NULL;
|
||||
|
|
@ -2029,34 +1896,22 @@ void ReflectCubeFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
|
||||
if (fd.features[MFT_DeferredSpecMap])
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
texCube = new GenOp("@.SampleLevel( @, @, @.a*5)", cubeMapTex, cubeMap, reflectVec, matinfo);
|
||||
else
|
||||
texCube = new GenOp("texCUBElod( @, float4(@, (@.a*5)) )", cubeMap, reflectVec, matinfo);
|
||||
texCube = new GenOp("@.SampleLevel( @, @, @.a*5)", cubeMapTex, cubeMap, reflectVec, matinfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
texCube = new GenOp("@.SampleLevel( @, @, (1.0-@.a)*6 )", cubeMapTex, cubeMap, reflectVec, matinfo);
|
||||
else
|
||||
texCube = new GenOp("texCUBElod( @, float4(@, ((1.0-@.a)*6)) )", cubeMap, reflectVec, matinfo);
|
||||
texCube = new GenOp("@.SampleLevel( @, @, (1.0-@.a)*6 )", cubeMapTex, cubeMap, reflectVec, matinfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (glossColor) //failing that, rtry and find color data
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
texCube = new GenOp("@.SampleLevel( @, @, @.a*5)", cubeMapTex, cubeMap, reflectVec, glossColor);
|
||||
else
|
||||
texCube = new GenOp("texCUBElod( @, float4(@, @.a*5))", cubeMap, reflectVec, glossColor);
|
||||
texCube = new GenOp("@.SampleLevel( @, @, @.a*5)", cubeMapTex, cubeMap, reflectVec, glossColor);
|
||||
}
|
||||
else //failing *that*, just draw the cubemap
|
||||
{
|
||||
if (mIsDirect3D11)
|
||||
texCube = new GenOp("@.Sample( @, @ )", cubeMapTex, cubeMap, reflectVec);
|
||||
else
|
||||
texCube = new GenOp("texCUBE( @, @ )", cubeMap, reflectVec);
|
||||
texCube = new GenOp("@.Sample( @, @ )", cubeMapTex, cubeMap, reflectVec);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2200,7 +2055,6 @@ void RTLightingFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outNormal->setName( "wsNormal" );
|
||||
outNormal->setStructName( "OUT" );
|
||||
outNormal->setType( "float3" );
|
||||
outNormal->mapsToSampler = false;
|
||||
|
||||
// Transform the normal to world space.
|
||||
meta->addStatement( new GenOp( " @ = normalize( @ - @.xyz );\r\n", outNormal, eyePos, inPosition ) );
|
||||
|
|
@ -2232,7 +2086,6 @@ void RTLightingFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
outNormal->setName( "wsNormal" );
|
||||
outNormal->setStructName( "OUT" );
|
||||
outNormal->setType( "float3" );
|
||||
outNormal->mapsToSampler = false;
|
||||
|
||||
// Get the transform to world space.
|
||||
Var *objTrans = getObjTrans( componentList, fd.features[MFT_UseInstancing], meta );
|
||||
|
|
@ -2421,7 +2274,6 @@ void FogFeatHLSL::processVert( Vector<ShaderComponent*> &componentList,
|
|||
fogAmount->setName( "fogAmount" );
|
||||
fogAmount->setStructName( "OUT" );
|
||||
fogAmount->setType( "float" );
|
||||
fogAmount->mapsToSampler = false;
|
||||
|
||||
meta->addStatement( new GenOp( " @ = saturate( computeSceneFog( @, @, @.r, @.g, @.b ) );\r\n",
|
||||
fogAmount, eyePos, wsPosition, fogData, fogData, fogData ) );
|
||||
|
|
@ -2561,7 +2413,7 @@ void VisibilityFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
|
|||
// Get the visibility constant.
|
||||
Var *visibility = NULL;
|
||||
if ( fd.features[ MFT_UseInstancing ] )
|
||||
visibility = getInTexCoord( "visibility", "float", false, componentList );
|
||||
visibility = getInTexCoord( "visibility", "float", componentList );
|
||||
else
|
||||
{
|
||||
visibility = (Var*)LangElement::find( "visibility" );
|
||||
|
|
|
|||
|
|
@ -33,15 +33,12 @@ struct RenderPassData;
|
|||
|
||||
class ShaderFeatureHLSL : public ShaderFeature
|
||||
{
|
||||
protected:
|
||||
bool mIsDirect3D11;
|
||||
public:
|
||||
ShaderFeatureHLSL();
|
||||
|
||||
///
|
||||
Var* getOutTexCoord( const char *name,
|
||||
const char *type,
|
||||
bool mapsToSampler,
|
||||
bool useTexAnim,
|
||||
MultiLine *meta,
|
||||
Vector<ShaderComponent*> &componentList );
|
||||
|
|
@ -50,7 +47,6 @@ public:
|
|||
/// to the input connector if it doesn't exist.
|
||||
static Var* getInTexCoord( const char *name,
|
||||
const char *type,
|
||||
bool mapsToSampler,
|
||||
Vector<ShaderComponent*> &componentList );
|
||||
|
||||
static Var* getInColor( const char *name,
|
||||
|
|
|
|||
|
|
@ -69,24 +69,14 @@ void ShaderGenPrinterHLSL::printPixelShaderOutputStruct(Stream& stream, const Ma
|
|||
|
||||
WRITESTR("struct Fragout\r\n");
|
||||
WRITESTR("{\r\n");
|
||||
if (GFX->getAdapterType() == Direct3D11)
|
||||
|
||||
WRITESTR(" float4 col : SV_Target0;\r\n");
|
||||
for (U32 i = 1; i < 4; i++)
|
||||
{
|
||||
WRITESTR(" float4 col : SV_Target0;\r\n");
|
||||
for (U32 i = 1; i < 4; i++)
|
||||
{
|
||||
if (numMRTs & 1 << i)
|
||||
WRITESTR(avar(" float4 col%d : SV_Target%d;\r\n", i, i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WRITESTR(" float4 col : COLOR0;\r\n");
|
||||
for (U32 i = 1; i < 4; i++)
|
||||
{
|
||||
if (numMRTs & 1 << i)
|
||||
WRITESTR(avar(" float4 col%d : COLOR%d;\r\n", i, i));
|
||||
}
|
||||
if (numMRTs & 1 << i)
|
||||
WRITESTR(avar(" float4 col%d : SV_Target%d;\r\n", i, i));
|
||||
}
|
||||
|
||||
WRITESTR("};\r\n");
|
||||
WRITESTR("\r\n");
|
||||
WRITESTR("\r\n");
|
||||
|
|
|
|||
|
|
@ -117,8 +117,6 @@ MODULE_BEGIN( ShaderGenHLSL )
|
|||
MODULE_INIT
|
||||
{
|
||||
sInitDelegate.bind(_initShaderGenHLSL);
|
||||
SHADERGEN->registerInitDelegate(Direct3D9, sInitDelegate);
|
||||
SHADERGEN->registerInitDelegate(Direct3D9_360, sInitDelegate);
|
||||
SHADERGEN->registerInitDelegate(Direct3D11, sInitDelegate);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,7 +97,6 @@ Var::Var()
|
|||
vertData = false;
|
||||
connector = false;
|
||||
sampler = false;
|
||||
mapsToSampler = false;
|
||||
arraySize = 1;
|
||||
texture = false;
|
||||
rank = 0;
|
||||
|
|
@ -111,7 +110,6 @@ Var::Var( const char *inName, const char *inType )
|
|||
vertData = false;
|
||||
connector = false;
|
||||
sampler = false;
|
||||
mapsToSampler = false;
|
||||
texCoordNum = 0;
|
||||
constSortPos = cspUninit;
|
||||
arraySize = 1;
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ struct Var : public LangElement
|
|||
bool connector; // variable that will be passed to pixel shader
|
||||
bool sampler; // texture
|
||||
bool texture; //for D3D11 texture variables
|
||||
bool mapsToSampler; // for ps 1.x shaders - texcoords must be mapped to same sampler stage
|
||||
U32 arraySize; // 1 = no array, > 1 array of "type"
|
||||
U32 rank; // optional rank system to assist in sorting vars if needed
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue