Fixed crash in glslang when compiling new lightgrid shaders

This commit is contained in:
Robert Beckebans 2021-04-29 12:52:40 +02:00
parent 0b4be8c73a
commit d5b9fbc7e8
5 changed files with 14 additions and 59 deletions

View file

@ -44,8 +44,6 @@ uniform sampler2D samp8 : register(s8); // texture 8 is the radiance cube map 1
uniform sampler2D samp9 : register(s9); // texture 9 is the radiance cube map 2
uniform sampler2D samp10 : register(s10); // texture 10 is the radiance cube map 3
uniform float4 rpUser0 : register( c128 );
struct PS_IN
{
half4 position : VPOS;
@ -394,10 +392,9 @@ void main( PS_IN fragment, out PS_OUT result )
normalizedOctCoord = octEncode( reflectionVector );
normalizedOctCoordZeroOne = ( normalizedOctCoord + float2( 1.0 ) ) * 0.5;
float3 radiance = textureLod( samp8, normalizedOctCoordZeroOne, mip ).rgb * rpUser0.x;
radiance += textureLod( samp9, normalizedOctCoordZeroOne, mip ).rgb * rpUser0.y;
radiance += textureLod( samp10, normalizedOctCoordZeroOne, mip ).rgb * rpUser0.z;
float3 radiance = textureLod( samp8, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.x;
radiance += textureLod( samp9, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.y;
radiance += textureLod( samp10, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.z;
//radiance = float3( 0.0 );
// RB: HACK dim down room radiance by better local irradiance brightness

View file

@ -135,10 +135,6 @@ void main( VS_IN vertex, out VS_OUT result )
float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );
//calculate vector to light
//float4 toLight = rpLocalLightOrigin;
float4 toLight = normalize( float4( 0.0f, 0.5f, 1.0f, 1.0f ) );
//--------------------------------------------------------------

View file

@ -272,9 +272,9 @@ void main( PS_IN fragment, out PS_OUT result )
normalizedOctCoordZeroOne = OctTexCoord( reflectionVector );
float3 radiance = textureLod( samp8, normalizedOctCoordZeroOne, mip ).rgb * rpGlobalLightOrigin.x;
radiance += textureLod( samp9, normalizedOctCoordZeroOne, mip ).rgb * rpGlobalLightOrigin.y;
radiance += textureLod( samp10, normalizedOctCoordZeroOne, mip ).rgb * rpGlobalLightOrigin.z;
float3 radiance = textureLod( samp8, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.x;
radiance += textureLod( samp9, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.y;
radiance += textureLod( samp10, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.z;
//radiance = float3( 0.0 );
float2 envBRDF = texture( samp3, float2( max( vDotN, 0.0 ), roughness ) ).rg;

View file

@ -1366,7 +1366,7 @@ void idRenderBackend::DrawSingleInteraction( drawInteraction_t* din, bool useFas
renderProgManager.SetUniformValue( RENDERPARM_SCREENCORRECTIONFACTOR, probeSize.ToFloatPtr() ); // rpScreenCorrectionFactor
// specular cubemap blend weights
renderProgManager.SetUniformValue( RENDERPARM_USER0, viewDef->radianceImageBlends.ToFloatPtr() );
renderProgManager.SetUniformValue( RENDERPARM_LOCALLIGHTORIGIN, viewDef->radianceImageBlends.ToFloatPtr() );
if( specUsage == TD_SPECULAR_PBR_RMAO || specUsage == TD_SPECULAR_PBR_RMAOD )
{
@ -1448,7 +1448,7 @@ void idRenderBackend::DrawSingleInteraction( drawInteraction_t* din, bool useFas
SetVertexParm( RENDERPARM_WOBBLESKY_Z, probeCenter.ToFloatPtr() );
// specular cubemap blend weights
renderProgManager.SetUniformValue( RENDERPARM_GLOBALLIGHTORIGIN, viewDef->radianceImageBlends.ToFloatPtr() );
renderProgManager.SetUniformValue( RENDERPARM_LOCALLIGHTORIGIN, viewDef->radianceImageBlends.ToFloatPtr() );
if( specUsage == TD_SPECULAR_PBR_RMAO || specUsage == TD_SPECULAR_PBR_RMAOD )
{
@ -2411,16 +2411,6 @@ void idRenderBackend::AmbientPass( const drawSurf_t* const* drawSurfs, int numDr
R_GlobalPointToLocal( drawSurf->space->modelMatrix, viewDef->renderView.vieworg, localViewOrigin.ToVec3() );
SetVertexParm( RENDERPARM_LOCALVIEWORIGIN, localViewOrigin.ToFloatPtr() );
//if( !isWorldModel )
//{
// // tranform the light direction into model local space
// idVec3 globalLightDirection( 0.0f, 0.0f, -1.0f ); // HACK
// idVec4 localLightDirection( 0.0f );
// R_GlobalVectorToLocal( drawSurf->space->modelMatrix, globalLightDirection, localLightDirection.ToVec3() );
//
// SetVertexParm( RENDERPARM_LOCALLIGHTORIGIN, localLightDirection.ToFloatPtr() );
//}
// RB: if we want to store the normals in world space so we need the model -> world matrix
idRenderMatrix modelMatrix;
idRenderMatrix::Transpose( *( idRenderMatrix* )drawSurf->space->modelMatrix, modelMatrix );
@ -2433,27 +2423,6 @@ void idRenderBackend::AmbientPass( const drawSurf_t* const* drawSurfs, int numDr
SetVertexParms( RENDERPARM_MODELVIEWMATRIX_X, modelViewMatrixTranspose, 4 );
}
#if 0
if( !isWorldModel )
{
idVec4 directedColor;
directedColor.x = drawSurf->space->gridDirectedLight.x;
directedColor.y = drawSurf->space->gridDirectedLight.y;
directedColor.z = drawSurf->space->gridDirectedLight.z;
directedColor.w = 1;
idVec4 ambientColor;
ambientColor.x = drawSurf->space->gridAmbientLight.x;
ambientColor.y = drawSurf->space->gridAmbientLight.y;
ambientColor.z = drawSurf->space->gridAmbientLight.z;
ambientColor.w = 1;
renderProgManager.SetRenderParm( RENDERPARM_COLOR, directedColor.ToFloatPtr() );
renderProgManager.SetRenderParm( RENDERPARM_AMBIENT_COLOR, ambientColor.ToFloatPtr() );
}
float ambientBoost = r_useHDR.GetBool() ? 1.5 : 1.0;
#endif
/*
uint64 surfGLState = 0;

View file

@ -5039,9 +5039,9 @@ static const cgShaderDef_t cg_renderprogs[] =
"\n"
" normalizedOctCoordZeroOne = OctTexCoord( reflectionVector );\n"
"\n"
" float3 radiance = textureLod( samp8, normalizedOctCoordZeroOne, mip ).rgb * rpGlobalLightOrigin.x;\n"
" radiance += textureLod( samp9, normalizedOctCoordZeroOne, mip ).rgb * rpGlobalLightOrigin.y;\n"
" radiance += textureLod( samp10, normalizedOctCoordZeroOne, mip ).rgb * rpGlobalLightOrigin.z;\n"
" float3 radiance = textureLod( samp8, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.x;\n"
" radiance += textureLod( samp9, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.y;\n"
" radiance += textureLod( samp10, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.z;\n"
" //radiance = float3( 0.0 );\n"
"\n"
" float2 envBRDF = texture( samp3, float2( max( vDotN, 0.0 ), roughness ) ).rg;\n"
@ -5331,8 +5331,6 @@ static const cgShaderDef_t cg_renderprogs[] =
"uniform sampler2D samp9 : register(s9); // texture 9 is the radiance cube map 2\n"
"uniform sampler2D samp10 : register(s10); // texture 10 is the radiance cube map 3\n"
"\n"
"uniform float4 rpUser0 : register( c128 );\n"
"\n"
"struct PS_IN \n"
"{\n"
" half4 position : VPOS;\n"
@ -5681,10 +5679,9 @@ static const cgShaderDef_t cg_renderprogs[] =
" normalizedOctCoord = octEncode( reflectionVector );\n"
" normalizedOctCoordZeroOne = ( normalizedOctCoord + float2( 1.0 ) ) * 0.5;\n"
"\n"
" float3 radiance = textureLod( samp8, normalizedOctCoordZeroOne, mip ).rgb * rpUser0.x;\n"
" radiance += textureLod( samp9, normalizedOctCoordZeroOne, mip ).rgb * rpUser0.y;\n"
" radiance += textureLod( samp10, normalizedOctCoordZeroOne, mip ).rgb * rpUser0.z;\n"
"\n"
" float3 radiance = textureLod( samp8, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.x;\n"
" radiance += textureLod( samp9, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.y;\n"
" radiance += textureLod( samp10, normalizedOctCoordZeroOne, mip ).rgb * rpLocalLightOrigin.z;\n"
" //radiance = float3( 0.0 );\n"
"\n"
" // RB: HACK dim down room radiance by better local irradiance brightness\n"
@ -5866,10 +5863,6 @@ static const cgShaderDef_t cg_renderprogs[] =
"\n"
" float4 defaultTexCoord = float4( 0.0f, 0.5f, 0.0f, 1.0f );\n"
"\n"
" //calculate vector to light\n"
" //float4 toLight = rpLocalLightOrigin;\n"
" float4 toLight = normalize( float4( 0.0f, 0.5f, 1.0f, 1.0f ) );\n"
"\n"
" //--------------------------------------------------------------\n"
"\n"
"\n"