Removes Direct3D9 functionality.

This commit is contained in:
Areloch 2017-05-28 16:51:31 -05:00
parent 5ac6f6beb3
commit edd1e0a270
86 changed files with 382 additions and 10445 deletions

View file

@ -120,23 +120,18 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
// create texture var
Var *lightInfoBuffer = new Var;
lightInfoBuffer->setType( "sampler2D" );
lightInfoBuffer->setType( "SamplerState" );
lightInfoBuffer->setName( "lightInfoBuffer" );
lightInfoBuffer->uniform = true;
lightInfoBuffer->sampler = true;
lightInfoBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
Var* lightBufferTex = NULL;
if (mIsDirect3D11)
{
lightInfoBuffer->setType("SamplerState");
lightBufferTex = new Var;
lightBufferTex->setName("lightInfoBufferTex");
lightBufferTex->setType("Texture2D");
lightBufferTex->uniform = true;
lightBufferTex->texture = true;
lightBufferTex->constNum = lightInfoBuffer->constNum;
}
Var* lightBufferTex = new Var;
lightBufferTex->setName("lightInfoBufferTex");
lightBufferTex->setType("Texture2D");
lightBufferTex->uniform = true;
lightBufferTex->texture = true;
lightBufferTex->constNum = lightInfoBuffer->constNum;
// Declare the RTLighting variables in this feature, they will either be assigned
// in this feature, or in the tonemap/lightmap feature
@ -152,12 +147,8 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
// Perform the uncondition here.
String unconditionLightInfo = String::ToLower( AdvancedLightBinManager::smBufferName ) + "Uncondition";
if (mIsDirect3D11)
meta->addStatement(new GenOp(avar(" %s(@.Sample(@, @), @, @, @);\r\n",
unconditionLightInfo.c_str()), lightBufferTex, lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular));
else
meta->addStatement(new GenOp(avar(" %s(tex2D(@, @), @, @, @);\r\n",
unconditionLightInfo.c_str()), lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular));
meta->addStatement(new GenOp(avar(" %s(@.Sample(@, @), @, @, @);\r\n",
unconditionLightInfo.c_str()), lightBufferTex, lightInfoBuffer, uvScene, d_lightcolor, d_NL_Att, d_specular));
// If this has an interlaced pre-pass, do averaging here
if( fd.features[MFT_InterlacedDeferred] )
@ -173,12 +164,8 @@ void DeferredRTLightingFeatHLSL::processPix( Vector<ShaderComponent*> &component
}
meta->addStatement( new GenOp( " float id_NL_Att, id_specular;\r\n float3 id_lightcolor;\r\n" ) );
if (mIsDirect3D11)
meta->addStatement(new GenOp(avar(" %s(@.Sample(@, @ + float2(0.0, @.y)), id_lightcolor, id_NL_Att, id_specular);\r\n",
unconditionLightInfo.c_str()), lightBufferTex, lightInfoBuffer, uvScene, oneOverTargetSize));
else
meta->addStatement(new GenOp(avar(" %s(tex2D(@, @ + float2(0.0, @.y)), id_lightcolor, id_NL_Att, id_specular);\r\n",
unconditionLightInfo.c_str()), lightInfoBuffer, uvScene, oneOverTargetSize));
meta->addStatement(new GenOp(avar(" %s(@.Sample(@, @ + float2(0.0, @.y)), id_lightcolor, id_NL_Att, id_specular);\r\n",
unconditionLightInfo.c_str()), lightBufferTex, lightInfoBuffer, uvScene, oneOverTargetSize));
meta->addStatement( new GenOp(" @ = lerp(@, id_lightcolor, 0.5);\r\n", d_lightcolor, d_lightcolor ) );
meta->addStatement( new GenOp(" @ = lerp(@, id_NL_Att, 0.5);\r\n", d_NL_Att, d_NL_Att ) );
@ -252,7 +239,6 @@ void DeferredBumpFeatHLSL::processVert( Vector<ShaderComponent*> &componentLis
getOutTexCoord( "texCoord",
"float2",
true,
useTexAnim,
meta,
componentList );
@ -292,17 +278,10 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
// create texture var
Var *bumpMap = getNormalMapTex();
Var *texCoord = getInTexCoord("texCoord", "float2", true, componentList);
Var *texCoord = getInTexCoord("texCoord", "float2", componentList);
LangElement *texOp = NULL;
if (mIsDirect3D11)
{
Var *bumpMapTex = (Var*)LangElement::find("bumpMapTex");
texOp = new GenOp("@.Sample(@, @)", bumpMapTex, bumpMap, texCoord);
}
else
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
Var *bumpMapTex = (Var*)LangElement::find("bumpMapTex");
LangElement *texOp = new GenOp("@.Sample(@, @)", bumpMapTex, bumpMap, texCoord);
// create bump normal
Var *bumpNorm = new Var;
@ -318,31 +297,22 @@ void DeferredBumpFeatHLSL::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* detailNormalTex = NULL;
if (mIsDirect3D11)
{
bumpMap->setType("SamplerState");
detailNormalTex = new Var;
detailNormalTex->setName("detailBumpMapTex");
detailNormalTex->setType("Texture2D");
detailNormalTex->uniform = true;
detailNormalTex->texture = true;
detailNormalTex->constNum = bumpMap->constNum;
}
Var* detailNormalTex = new Var;
detailNormalTex->setName("detailBumpMapTex");
detailNormalTex->setType("Texture2D");
detailNormalTex->uniform = true;
detailNormalTex->texture = true;
detailNormalTex->constNum = bumpMap->constNum;
texCoord = getInTexCoord("detCoord", "float2", componentList);
texCoord = getInTexCoord("detCoord", "float2", true, componentList);
if (mIsDirect3D11)
texOp = new GenOp("@.Sample(@, @)", detailNormalTex, bumpMap, texCoord);
else
texOp = new GenOp("tex2D(@, @)", bumpMap, texCoord);
texOp = new GenOp("@.Sample(@, @)", detailNormalTex, bumpMap, texCoord);
Var *detailBump = new Var;
detailBump->setName( "detailBump" );
@ -383,7 +353,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
{
MultiLine *meta = new MultiLine;
Var *texCoord = getInTexCoord("texCoord", "float2", true, componentList);
Var *texCoord = getInTexCoord("texCoord", "float2", componentList);
Var *bumpMap = getNormalMapTex();
@ -392,13 +362,8 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
bumpSample->setName("bumpSample");
LangElement *bumpSampleDecl = new DecOp(bumpSample);
if (mIsDirect3D11)
{
Var *bumpMapTex = (Var *)LangElement::find("bumpMapTex");
output = new GenOp(" @ = @.Sample(@, @);\r\n", bumpSampleDecl, bumpMapTex, bumpMap, texCoord);
}
else
output = new GenOp(" @ = tex2D(@, @);\r\n", bumpSampleDecl, bumpMap, texCoord);
Var *bumpMapTex = (Var *)LangElement::find("bumpMapTex");
output = new GenOp(" @ = @.Sample(@, @);\r\n", bumpSampleDecl, bumpMapTex, bumpMap, texCoord);
if ( fd.features.hasFeature( MFT_DetailNormalMap ) )
{
@ -414,7 +379,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
}
Var* bumpMapTex = (Var*)LangElement::find("detailBumpMap");
if (mIsDirect3D11 && !bumpMapTex)
if (!bumpMapTex)
{
bumpMap->setType("SamplerState");
bumpMapTex = new Var;
@ -425,12 +390,8 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
bumpMapTex->constNum = bumpMap->constNum;
}
texCoord = getInTexCoord( "detCoord", "float2", true, componentList );
LangElement *texOp = NULL;
if (mIsDirect3D11)
texOp = new GenOp("@.Sample(@, @)", bumpMap, bumpMapTex, texCoord);
else
texOp = new GenOp( "tex2D(@, @)", bumpMap, texCoord );
texCoord = getInTexCoord( "detCoord", "float2", componentList );
LangElement *texOp = new GenOp("@.Sample(@, @)", bumpMap, bumpMapTex, texCoord);
Var *detailBump = new Var;
detailBump->setName( "detailBump" );
@ -462,7 +423,7 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
Var *bumpSample = (Var *)LangElement::find( "bumpSample" );
if( bumpSample == NULL )
{
Var *texCoord = getInTexCoord( "texCoord", "float2", true, componentList );
Var *texCoord = getInTexCoord( "texCoord", "float2", componentList );
Var *bumpMap = getNormalMapTex();
@ -471,13 +432,8 @@ void DeferredBumpFeatHLSL::processPix( Vector<ShaderComponent*> &componentList,
bumpSample->setName( "bumpSample" );
LangElement *bumpSampleDecl = new DecOp( bumpSample );
if (mIsDirect3D11)
{
Var *bumpMapTex = (Var *)LangElement::find("bumpMapTex");
output = new GenOp(" @ = @.Sample(@, @);\r\n", bumpSampleDecl, bumpMapTex, bumpMap, texCoord);
}
else
output = new GenOp(" @ = tex2D(@, @);\r\n", bumpSampleDecl, bumpMap, texCoord);
Var *bumpMapTex = (Var *)LangElement::find("bumpMapTex");
output = new GenOp(" @ = @.Sample(@, @);\r\n", bumpSampleDecl, bumpMapTex, bumpMap, texCoord);
return;
}
@ -742,23 +698,18 @@ void DeferredMinnaertHLSL::processPix( Vector<ShaderComponent*> &componentList,
// create texture var
Var *deferredBuffer = new Var;
deferredBuffer->setType( "sampler2D" );
deferredBuffer->setType( "SamplerState" );
deferredBuffer->setName( "deferredBuffer" );
deferredBuffer->uniform = true;
deferredBuffer->sampler = true;
deferredBuffer->constNum = Var::getTexUnitNum(); // used as texture unit num here
Var* prePassTex = NULL;
if (mIsDirect3D11)
{
deferredBuffer->setType("SamplerState");
prePassTex = new Var;
prePassTex->setName("prePassTex");
prePassTex->setType("Texture2D");
prePassTex->uniform = true;
prePassTex->texture = true;
prePassTex->constNum = deferredBuffer->constNum;
}
Var* prePassTex = new Var;
prePassTex->setName("prePassTex");
prePassTex->setType("Texture2D");
prePassTex->uniform = true;
prePassTex->texture = true;
prePassTex->constNum = deferredBuffer->constNum;
// Texture coord
Var *uvScene = (Var*) LangElement::find( "uvScene" );
@ -773,10 +724,7 @@ void DeferredMinnaertHLSL::processPix( Vector<ShaderComponent*> &componentList,
Var *d_NL_Att = (Var*)LangElement::find( "d_NL_Att" );
if (mIsDirect3D11)
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, ,@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, prePassTex, uvScene));
else
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, uvScene));
meta->addStatement(new GenOp(avar(" float4 normalDepth = %s(@, ,@, @);\r\n", unconditionDeferredMethod.c_str()), deferredBuffer, prePassTex, uvScene));
meta->addStatement( new GenOp( " float vDotN = dot(normalDepth.xyz, @);\r\n", wsViewVec ) );
meta->addStatement( new GenOp( " float Minnaert = pow( @, @) * pow(vDotN, 1.0 - @);\r\n", d_NL_Att, minnaertConstant, minnaertConstant ) );