From 3f2113bf7db6c06493850e674ee0576de7e0a3c1 Mon Sep 17 00:00:00 2001 From: AzaezelX Date: Mon, 1 May 2023 17:09:15 -0500 Subject: [PATCH] revert some removals of vert to pixel shader getters to avoid register mismatches. (cherry picked from commit 1e1e39f4f72ac6d4ce19704f69ba34bbff29d89c) --- Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp | 12 ++++++++++++ Engine/source/shaderGen/HLSL/debugVizFeatureHLSL.cpp | 11 +++++++++++ Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp | 12 ++++++++++++ Engine/source/terrain/glsl/terrFeatureGLSL.cpp | 6 ++++++ Engine/source/terrain/hlsl/terrFeatureHLSL.cpp | 3 ++- 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 1eea4db1b..ca937ac7f 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -2141,6 +2141,12 @@ void RTLightingFeatGLSL::processPix( Vector &componentList, MultiLine *meta = new MultiLine; + // Now the wsPosition and wsView. + Var *wsPosition = getInWsPosition( componentList ); + Var* worldToTangent = getInWorldToTangent(componentList); + Var* wsNormal = getInWorldNormal(componentList); + Var *wsView = getWsView( wsPosition, meta ); + // Look for a light mask generated from a previous // feature (this is done for BL terrain lightmaps). LangElement *lightMask = LangElement::find( "lightMask" ); @@ -2948,6 +2954,12 @@ void ReflectionProbeFeatGLSL::processPix(Vector& componentList MultiLine * meta = new MultiLine; + // Now the wsPosition and wsView. + Var *wsPosition = getInWsPosition(componentList); + Var *worldToTangent = getInWorldToTangent(componentList); + Var *wsNormal = getInWorldNormal(componentList); + Var *wsView = getWsView(wsPosition, meta); + //Reflection Probe WIP U32 MAX_FORWARD_PROBES = 4; diff --git a/Engine/source/shaderGen/HLSL/debugVizFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/debugVizFeatureHLSL.cpp index 823b7da76..bef95f4fd 100644 --- a/Engine/source/shaderGen/HLSL/debugVizFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/debugVizFeatureHLSL.cpp @@ -122,6 +122,17 @@ void DebugVizHLSL::processPix(Vector& componentList, if (fd.features[MFT_LightMap] || fd.features[MFT_ToneMap] || fd.features[MFT_VertLit]) return; + MultiLine* meta = new MultiLine; + + // Now the wsPosition and wsView. + Var* worldToTangent = getInWorldToTangent(componentList); + Var* wsNormal = getInWorldNormal(componentList); + Var* wsPosition = getInWsPosition(componentList); + Var* wsView = getWsView(wsPosition, meta); + + //Reflection Probe WIP + U32 MAX_FORWARD_PROBES = 4; + Var* numProbes = (Var*)LangElement::find("inNumProbes"); Var* cubeMips = (Var*)LangElement::find("cubeMips"); Var* skylightCubemapIdx = (Var*)LangElement::find("inSkylightCubemapIdx"); diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 51e782605..0af9f770c 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -2221,6 +2221,12 @@ void RTLightingFeatHLSL::processPix( Vector &componentList, MultiLine *meta = new MultiLine; + // Now the wsPosition and wsView. + Var *wsPosition = getInWsPosition( componentList ); + Var* worldToTangent = getInWorldToTangent(componentList); + Var* wsNormal = getInWorldNormal(componentList); + Var *wsView = getWsView( wsPosition, meta ); + // Look for a light mask generated from a previous // feature (this is done for BL terrain lightmaps). LangElement *lightMask = LangElement::find( "lightMask" ); @@ -3030,6 +3036,12 @@ void ReflectionProbeFeatHLSL::processPix(Vector &componentList MultiLine *meta = new MultiLine; + // Now the wsPosition and wsView. + Var* wsPosition = getInWsPosition(componentList); + Var* worldToTangent = getInWorldToTangent(componentList); + Var *wsNormal = getInWorldNormal(componentList); + Var *wsView = getWsView(wsPosition, meta); + //Reflection Probe WIP U32 MAX_FORWARD_PROBES = 4; diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp index 3fdd21eec..a2154b736 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp @@ -347,6 +347,8 @@ void TerrainBaseMapFeatGLSL::processPix( Vector &componentLis meta->addStatement(new GenOp(" @ = float4(1.0f/255.0f, 1.0, 1.0, 0.0);\r\n", ormConfig)); output = meta; + + Var* viewToTangent = getInViewToTangent(componentList); } ShaderFeature::Resources TerrainBaseMapFeatGLSL::getResources( const MaterialFeatureData &fd ) @@ -542,6 +544,9 @@ void TerrainDetailMapFeatGLSL::processPix( Vector &component // Get the detail id. Var *detailInfo = _getDetailIdStrengthParallax(); + // This is done here to make sure the macro arrays are the correct size + Var* macroInfo = _getMacroIdStrengthParallax(); + // Create the detail blend var. Var *detailBlend = new Var; detailBlend->setType( "float" ); @@ -1319,6 +1324,7 @@ void TerrainHeightMapBlendGLSL::processPix(Vector& componentLi { for (S32 idx = 0; idx < detailCount; ++idx) { + Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", idx)); Var* detailH = (Var*)LangElement::find(String::ToString("detailH%d", idx)); Var* blendHardness = (Var*)LangElement::find(String::ToString("blendHardness%d", idx)); if (!blendHardness) diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp index 1c2003590..dd111ddb4 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp @@ -624,7 +624,7 @@ void TerrainDetailMapFeatHLSL::processPix( Vector &component Var *detailInfo = _getDetailIdStrengthParallax(); // Done here to keep array indexes aligned - _getMacroIdStrengthParallax(); + Var* macroInfo = _getMacroIdStrengthParallax(); // Create the detail blend var. Var *detailBlend = new Var; @@ -1414,6 +1414,7 @@ void TerrainHeightMapBlendHLSL::processPix(Vector& componentLi { for (S32 idx = 0; idx < detailCount; ++idx) { + Var* detailBlend = (Var*)LangElement::find(String::ToString("detailBlend%d", idx)); Var* detailH = (Var*)LangElement::find(String::ToString("detailH%d", idx)); Var* blendHardness = (Var*)LangElement::find(String::ToString("blendHardness%d", idx)); if (!blendHardness)