differentiate forward lit and deferred ibl vars

since we're not currently using the same arrays et al for the whole pass, need to make sure those don't fight
This commit is contained in:
AzaezelX 2021-10-26 12:32:37 -05:00
parent 8c2aaaad18
commit 42bc6fa358
7 changed files with 44 additions and 43 deletions

View file

@ -780,8 +780,8 @@ void RenderProbeMgr::render( SceneRenderState *state )
mProbeArrayEffect->setShaderConst("$probeContribColors", contribColors);
mProbeArrayEffect->setShaderConst("$inProbePosArray", mProbeData.probePositionArray);
mProbeArrayEffect->setShaderConst("$inRefPosArray", mProbeData.probeRefPositionArray);
mProbeArrayEffect->setShaderConst("$probePosArray", mProbeData.probePositionArray);
mProbeArrayEffect->setShaderConst("$refPosArray", mProbeData.probeRefPositionArray);
mProbeArrayEffect->setShaderConst("$worldToObjArray", mProbeData.probeWorldToObjArray);
mProbeArrayEffect->setShaderConst("$refScaleArray", mProbeData.refScaleArray);
mProbeArrayEffect->setShaderConst("$probeConfigData", mProbeData.probeConfigArray);

View file

@ -2981,7 +2981,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
//Reflection Probe WIP
U32 MAX_FORWARD_PROBES = 4;
Var * numProbes = new Var("numProbes", "int");
Var * numProbes = new Var("inNumProbes", "int");
numProbes->uniform = true;
numProbes->constSortPos = cspPotentialPrimitive;
@ -2989,7 +2989,7 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
cubeMips->uniform = true;
cubeMips->constSortPos = cspPotentialPrimitive;
Var * skylightCubemapIdx = new Var("skylightCubemapIdx", "float");
Var * skylightCubemapIdx = new Var("inSkylightCubemapIdx", "float");
skylightCubemapIdx->uniform = true;
skylightCubemapIdx->constSortPos = cspPotentialPrimitive;
@ -3008,12 +3008,12 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
refScaleArray->uniform = true;
refScaleArray->constSortPos = cspPotentialPrimitive;
Var * probeConfigData = new Var("probeConfigData", "vec4");
Var * probeConfigData = new Var("inProbeConfigData", "vec4");
probeConfigData->arraySize = MAX_FORWARD_PROBES;
probeConfigData->uniform = true;
probeConfigData->constSortPos = cspPotentialPrimitive;
Var * worldToObjArray = new Var("worldToObjArray", "mat4");
Var * worldToObjArray = new Var("inWorldToObjArray", "mat4");
worldToObjArray->arraySize = MAX_FORWARD_PROBES;
worldToObjArray->uniform = true;
worldToObjArray->constSortPos = cspPotentialPrimitive;
@ -3026,12 +3026,12 @@ void ReflectionProbeFeatGLSL::processPix(Vector<ShaderComponent*>& componentList
BRDFTexture->sampler = true;
BRDFTexture->constNum = Var::getTexUnitNum(); // used as texture unit num here
Var * specularCubemapAR = new Var("specularCubemapAR", "samplerCubeArray");
Var * specularCubemapAR = new Var("inSpecularCubemapAR", "samplerCubeArray");
specularCubemapAR->uniform = true;
specularCubemapAR->sampler = true;
specularCubemapAR->constNum = Var::getTexUnitNum();
Var * irradianceCubemapAR = new Var("irradianceCubemapAR", "samplerCubeArray");
Var * irradianceCubemapAR = new Var("inIrradianceCubemapAR", "samplerCubeArray");
irradianceCubemapAR->uniform = true;
irradianceCubemapAR->sampler = true;
irradianceCubemapAR->constNum = Var::getTexUnitNum();
@ -3078,9 +3078,9 @@ void ReflectionProbeFeatGLSL::setTexData(Material::StageData& stageDat,
passData.mSamplerNames[texIndex] = "BRDFTexture";
passData.mTexType[texIndex++] = Material::Standard;
// assuming here that it is a scenegraph cubemap
passData.mSamplerNames[texIndex] = "specularCubemapAR";
passData.mSamplerNames[texIndex] = "inSpecularCubemapAR";
passData.mTexType[texIndex++] = Material::SGCube;
passData.mSamplerNames[texIndex] = "irradianceCubemapAR";
passData.mSamplerNames[texIndex] = "inIrradianceCubemapAR";
passData.mTexType[texIndex++] = Material::SGCube;
}
}

View file

@ -135,24 +135,24 @@ void DebugVizHLSL::processPix(Vector<ShaderComponent*>& componentList,
//Reflection Probe WIP
U32 MAX_FORWARD_PROBES = 4;
Var* numProbes = (Var*)LangElement::find("numProbes");
Var* numProbes = (Var*)LangElement::find("inNumProbes");
Var* cubeMips = (Var*)LangElement::find("cubeMips");
Var* skylightCubemapIdx = (Var*)LangElement::find("skylightCubemapIdx");
Var* skylightCubemapIdx = (Var*)LangElement::find("inSkylightCubemapIdx");
Var* inProbePosArray = (Var*)LangElement::find("inProbePosArray");
Var* inRefPosArray = (Var*)LangElement::find("inRefPosArray");
Var* refScaleArray = (Var*)LangElement::find("inRefScale");
Var* probeConfigData = (Var*)LangElement::find("probeConfigData");
Var* worldToObjArray = (Var*)LangElement::find("worldToObjArray");
Var* probeConfigData = (Var*)LangElement::find("inProbeConfigData");
Var* worldToObjArray = (Var*)LangElement::find("inWorldToObjArray");
Var* BRDFTexture = (Var*)LangElement::find("BRDFTexture");
Var* BRDFTextureTex = (Var*)LangElement::find("texture_BRDFTexture");
Var* specularCubemapAR = (Var*)LangElement::find("specularCubemapAR");
Var* specularCubemapARTex = (Var*)LangElement::find("texture_specularCubemapAR");
Var* specularCubemapAR = (Var*)LangElement::find("inSpecularCubemapAR");
Var* specularCubemapARTex = (Var*)LangElement::find("texture_inSpecularCubemapAR");
Var* irradianceCubemapAR = (Var*)LangElement::find("irradianceCubemapAR");
Var* irradianceCubemapARTex = (Var*)LangElement::find("texture_irradianceCubemapAR");
Var* irradianceCubemapAR = (Var*)LangElement::find("inIrradianceCubemapAR");
Var* irradianceCubemapARTex = (Var*)LangElement::find("texture_inIrradianceCubemapAR");
Var* matinfo = (Var*)LangElement::find("ORMConfig");
Var* metalness = (Var*)LangElement::find("metalness");

View file

@ -3054,7 +3054,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
//Reflection Probe WIP
U32 MAX_FORWARD_PROBES = 4;
Var *numProbes = new Var("numProbes", "int");
Var *numProbes = new Var("inNumProbes", "int");
numProbes->uniform = true;
numProbes->constSortPos = cspPotentialPrimitive;
@ -3062,7 +3062,7 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
cubeMips->uniform = true;
cubeMips->constSortPos = cspPotentialPrimitive;
Var * skylightCubemapIdx = new Var("skylightCubemapIdx", "float");
Var * skylightCubemapIdx = new Var("inSkylightCubemapIdx", "float");
skylightCubemapIdx->uniform = true;
skylightCubemapIdx->constSortPos = cspPotentialPrimitive;
@ -3081,12 +3081,12 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
refScaleArray->uniform = true;
refScaleArray->constSortPos = cspPotentialPrimitive;
Var *probeConfigData = new Var("probeConfigData", "float4");
Var *probeConfigData = new Var("inProbeConfigData", "float4");
probeConfigData->arraySize = MAX_FORWARD_PROBES;
probeConfigData->uniform = true;
probeConfigData->constSortPos = cspPotentialPrimitive;
Var *worldToObjArray = new Var("worldToObjArray", "float4x4");
Var *worldToObjArray = new Var("inWorldToObjArray", "float4x4");
worldToObjArray->arraySize = MAX_FORWARD_PROBES;
worldToObjArray->uniform = true;
worldToObjArray->constSortPos = cspPotentialPrimitive;
@ -3101,22 +3101,22 @@ void ReflectionProbeFeatHLSL::processPix(Vector<ShaderComponent*> &componentList
BRDFTextureTex->texture = true;
BRDFTextureTex->constNum = BRDFTexture->constNum;
Var *specularCubemapAR = new Var("specularCubemapAR", "SamplerState");
Var *specularCubemapAR = new Var("inSpecularCubemapAR", "SamplerState");
specularCubemapAR->uniform = true;
specularCubemapAR->sampler = true;
specularCubemapAR->constNum = Var::getTexUnitNum(); // used as texture unit num here
Var *specularCubemapARTex = new Var("texture_specularCubemapAR", "TextureCubeArray");
Var *specularCubemapARTex = new Var("texture_inSpecularCubemapAR", "TextureCubeArray");
specularCubemapARTex->uniform = true;
specularCubemapARTex->texture = true;
specularCubemapARTex->constNum = specularCubemapAR->constNum;
Var *irradianceCubemapAR = new Var("irradianceCubemapAR", "SamplerState");
Var *irradianceCubemapAR = new Var("inIrradianceCubemapAR", "SamplerState");
irradianceCubemapAR->uniform = true;
irradianceCubemapAR->sampler = true;
irradianceCubemapAR->constNum = Var::getTexUnitNum(); // used as texture unit num here
Var *irradianceCubemapARTex = new Var("texture_irradianceCubemapAR", "TextureCubeArray");
Var *irradianceCubemapARTex = new Var("texture_inIrradianceCubemapAR", "TextureCubeArray");
irradianceCubemapARTex->uniform = true;
irradianceCubemapARTex->texture = true;
irradianceCubemapARTex->constNum = irradianceCubemapAR->constNum;
@ -3171,9 +3171,9 @@ void ReflectionProbeFeatHLSL::setTexData(Material::StageData &stageDat,
passData.mSamplerNames[texIndex] = "BRDFTexture";
passData.mTexType[texIndex++] = Material::Standard;
// assuming here that it is a scenegraph cubemap
passData.mSamplerNames[texIndex] = "specularCubemapAR";
passData.mSamplerNames[texIndex] = "inSpecularCubemapAR";
passData.mTexType[texIndex++] = Material::SGCube;
passData.mSamplerNames[texIndex] = "irradianceCubemapAR";
passData.mSamplerNames[texIndex] = "inIrradianceCubemapAR";
passData.mTexType[texIndex++] = Material::SGCube;
}
}

View file

@ -78,20 +78,21 @@ const String ShaderGenVars::roughness("$roughness");
const String ShaderGenVars::metalness("$metalness");
const String ShaderGenVars::glowMul("$glowMul");
//Reflection Probes
//Reflection Probes - Forward lit. not to be confused with the deferred handwritten vars
//change to parity once we've got the same arrays used for both routes
const String ShaderGenVars::probePosition("$inProbePosArray");
const String ShaderGenVars::probeRefPos("$inRefPosArray");
const String ShaderGenVars::refScale("$inRefScale");
const String ShaderGenVars::worldToObjArray("$worldToObjArray");
const String ShaderGenVars::probeConfigData("$probeConfigData");
const String ShaderGenVars::specularCubemapAR("$specularCubemapAR");
const String ShaderGenVars::irradianceCubemapAR("$irradianceCubemapAR");
const String ShaderGenVars::probeCount("$numProbes");
const String ShaderGenVars::worldToObjArray("inWorldToObjArray");
const String ShaderGenVars::probeConfigData("$inProbeConfigData");
const String ShaderGenVars::specularCubemapAR("$inSpecularCubemapAR");
const String ShaderGenVars::irradianceCubemapAR("$inIrradianceCubemapAR");
const String ShaderGenVars::probeCount("$inNumProbes");
const String ShaderGenVars::BRDFTextureMap("$BRDFTexture");
//Skylight
const String ShaderGenVars::skylightCubemapIdx("$skylightCubemapIdx");
const String ShaderGenVars::skylightCubemapIdx("$inSkylightCubemapIdx");
// These are ignored by the D3D layers.
const String ShaderGenVars::fogMap("$fogMap");