@@ -891,9 +891,10 @@ void BindShaderGeneric3D( Material* material ) {
891891 gl_genericShaderMaterial->SetTCGenEnvironment ( material->tcGenEnvironment );
892892 gl_genericShaderMaterial->SetTCGenLightmap ( material->tcGen_Lightmap );
893893 gl_genericShaderMaterial->SetDepthFade ( material->hasDepthFade );
894+ gl_genericShaderMaterial->SetDeform ( material->deformIndex );
894895
895896 // Bind shader program.
896- gl_genericShaderMaterial->BindProgram ( material-> deformIndex );
897+ gl_genericShaderMaterial->BindProgram ();
897898
898899 // Set shader uniforms.
899900 if ( material->tcGenEnvironment ) {
@@ -926,9 +927,10 @@ void BindShaderLightMapping( Material* material ) {
926927 because we don't have cubemaps built yet at this point, but for the purposes of the material ordering there's no difference */
927928 gl_lightMappingShaderMaterial->SetReflectiveSpecular ( glConfig.reflectionMapping && material->enableSpecularMapping && !( tr.refdef .rdflags & RDF_NOCUBEMAP ) );
928929 gl_lightMappingShaderMaterial->SetPhysicalShading ( material->enablePhysicalMapping );
930+ gl_lightMappingShaderMaterial->SetDeform ( material->deformIndex );
929931
930932 // Bind shader program.
931- gl_lightMappingShaderMaterial->BindProgram ( material-> deformIndex );
933+ gl_lightMappingShaderMaterial->BindProgram ();
932934
933935 // Set shader uniforms.
934936 if ( tr.world ) {
@@ -1011,35 +1013,37 @@ void BindShaderReflection( Material* material ) {
10111013 // Select shader permutation.
10121014 gl_reflectionShaderMaterial->SetHeightMapInNormalMap ( material->hasHeightMapInNormalMap );
10131015 gl_reflectionShaderMaterial->SetReliefMapping ( material->enableReliefMapping );
1016+ gl_reflectionShaderMaterial->SetDeform ( material->deformIndex );
10141017
10151018 // Bind shader program.
1016- gl_reflectionShaderMaterial->BindProgram ( material-> deformIndex );
1019+ gl_reflectionShaderMaterial->BindProgram ();
10171020
10181021 // Set shader uniforms.
10191022 gl_reflectionShaderMaterial->SetUniform_ViewOrigin ( backEnd.viewParms .orientation .origin );
10201023 gl_reflectionShaderMaterial->SetUniform_ModelMatrix ( backEnd.orientation .transformMatrix );
10211024 gl_reflectionShaderMaterial->SetUniform_ModelViewProjectionMatrix ( glState.modelViewProjectionMatrix [glState.stackIndex ] );
10221025}
10231026
1024- void BindShaderSkybox ( Material* material ) {
1027+ void BindShaderSkybox ( Material* ) {
10251028 // Bind shader program.
1026- gl_skyboxShaderMaterial->BindProgram ( material-> deformIndex );
1029+ gl_skyboxShaderMaterial->BindProgram ();
10271030
10281031 // Set shader uniforms.
10291032 gl_skyboxShaderMaterial->SetUniform_ModelViewProjectionMatrix ( glState.modelViewProjectionMatrix [glState.stackIndex ] );
10301033}
10311034
1032- void BindShaderScreen ( Material* material ) {
1035+ void BindShaderScreen ( Material* ) {
10331036 // Bind shader program.
1034- gl_screenShaderMaterial->BindProgram ( material-> deformIndex );
1037+ gl_screenShaderMaterial->BindProgram ();
10351038
10361039 // Set shader uniforms.
10371040 gl_screenShaderMaterial->SetUniform_ModelViewProjectionMatrix ( glState.modelViewProjectionMatrix [glState.stackIndex ] );
10381041}
10391042
10401043void BindShaderHeatHaze ( Material* material ) {
10411044 // Bind shader program.
1042- gl_heatHazeShaderMaterial->BindProgram ( material->deformIndex );
1045+ gl_heatHazeShaderMaterial->SetDeform ( material->deformIndex );
1046+ gl_heatHazeShaderMaterial->BindProgram ();
10431047
10441048 // Set shader uniforms.
10451049 gl_heatHazeShaderMaterial->SetUniform_ModelViewProjectionMatrix ( glState.modelViewProjectionMatrix [glState.stackIndex ] );
@@ -1067,7 +1071,7 @@ void BindShaderLiquid( Material* material ) {
10671071 gl_liquidShaderMaterial->SetGridLighting ( material->enableGridLighting );
10681072
10691073 // Bind shader program.
1070- gl_liquidShaderMaterial->BindProgram ( material-> deformIndex );
1074+ gl_liquidShaderMaterial->BindProgram ();
10711075
10721076 // Set shader uniforms.
10731077 gl_liquidShaderMaterial->SetUniform_ViewOrigin ( backEnd.viewParms .orientation .origin );
@@ -1084,7 +1088,8 @@ void BindShaderLiquid( Material* material ) {
10841088
10851089void BindShaderFog ( Material* material ) {
10861090 // Bind shader program.
1087- gl_fogQuake3ShaderMaterial->BindProgram ( material->deformIndex );
1091+ gl_fogQuake3ShaderMaterial->SetDeform ( material->deformIndex );
1092+ gl_fogQuake3ShaderMaterial->BindProgram ();
10881093
10891094 // Set shader uniforms.
10901095 const fog_t * fog = tr.world ->fogs + material->fog ;
@@ -1140,7 +1145,9 @@ void ProcessMaterialGeneric3D( Material* material, shaderStage_t* pStage, Materi
11401145 material->hasDepthFade = hasDepthFade;
11411146 gl_genericShaderMaterial->SetDepthFade ( hasDepthFade );
11421147
1143- material->program = gl_genericShaderMaterial->GetProgram ( pStage->deformIndex , materialSystem.buildOneShader );
1148+ gl_genericShaderMaterial->SetDeform ( pStage->deformIndex );
1149+
1150+ material->program = gl_genericShaderMaterial->GetProgram ( materialSystem.buildOneShader );
11441151}
11451152
11461153void ProcessMaterialLightMapping ( Material* material, shaderStage_t* pStage, MaterialSurface* surface ) {
@@ -1181,7 +1188,9 @@ void ProcessMaterialLightMapping( Material* material, shaderStage_t* pStage, Mat
11811188
11821189 gl_lightMappingShaderMaterial->SetPhysicalShading ( pStage->enablePhysicalMapping );
11831190
1184- material->program = gl_lightMappingShaderMaterial->GetProgram ( pStage->deformIndex , materialSystem.buildOneShader );
1191+ gl_lightMappingShaderMaterial->SetDeform ( pStage->deformIndex );
1192+
1193+ material->program = gl_lightMappingShaderMaterial->GetProgram ( materialSystem.buildOneShader );
11851194}
11861195
11871196void ProcessMaterialReflection ( Material* material, shaderStage_t* pStage, MaterialSurface* /* surface */ ) {
@@ -1195,31 +1204,35 @@ void ProcessMaterialReflection( Material* material, shaderStage_t* pStage, Mater
11951204
11961205 gl_reflectionShaderMaterial->SetReliefMapping ( pStage->enableReliefMapping );
11971206
1198- material->program = gl_reflectionShaderMaterial->GetProgram ( pStage->deformIndex , materialSystem.buildOneShader );
1207+ gl_reflectionShaderMaterial->SetDeform ( pStage->deformIndex );
1208+
1209+ material->program = gl_reflectionShaderMaterial->GetProgram ( materialSystem.buildOneShader );
11991210}
12001211
12011212void ProcessMaterialSkybox ( Material* material, shaderStage_t* pStage, MaterialSurface* /* surface */ ) {
12021213 material->shader = gl_skyboxShaderMaterial;
12031214
12041215 material->deformIndex = pStage->deformIndex ;
12051216
1206- material->program = gl_skyboxShaderMaterial->GetProgram ( pStage-> deformIndex , materialSystem.buildOneShader );
1217+ material->program = gl_skyboxShaderMaterial->GetProgram ( materialSystem.buildOneShader );
12071218}
12081219
12091220void ProcessMaterialScreen ( Material* material, shaderStage_t* pStage, MaterialSurface* /* surface */ ) {
12101221 material->shader = gl_screenShaderMaterial;
12111222
12121223 material->deformIndex = pStage->deformIndex ;
12131224
1214- material->program = gl_screenShaderMaterial->GetProgram ( pStage-> deformIndex , materialSystem.buildOneShader );
1225+ material->program = gl_screenShaderMaterial->GetProgram ( materialSystem.buildOneShader );
12151226}
12161227
12171228void ProcessMaterialHeatHaze ( Material* material, shaderStage_t* pStage, MaterialSurface* ) {
12181229 material->shader = gl_heatHazeShaderMaterial;
12191230
12201231 material->deformIndex = pStage->deformIndex ;
12211232
1222- material->program = gl_heatHazeShaderMaterial->GetProgram ( pStage->deformIndex , materialSystem.buildOneShader );
1233+ gl_heatHazeShaderMaterial->SetDeform ( pStage->deformIndex );
1234+
1235+ material->program = gl_heatHazeShaderMaterial->GetProgram ( materialSystem.buildOneShader );
12231236}
12241237
12251238void ProcessMaterialLiquid ( Material* material, shaderStage_t* pStage, MaterialSurface* surface ) {
@@ -1243,14 +1256,16 @@ void ProcessMaterialLiquid( Material* material, shaderStage_t* pStage, MaterialS
12431256
12441257 gl_liquidShaderMaterial->SetGridLighting ( lightMode == lightMode_t::GRID );
12451258
1246- material->program = gl_liquidShaderMaterial->GetProgram ( pStage-> deformIndex , materialSystem.buildOneShader );
1259+ material->program = gl_liquidShaderMaterial->GetProgram ( materialSystem.buildOneShader );
12471260}
12481261
12491262void ProcessMaterialFog ( Material* material, shaderStage_t* pStage, MaterialSurface* surface ) {
12501263 material->shader = gl_fogQuake3ShaderMaterial;
12511264 material->fog = surface->fog ;
12521265
1253- material->program = gl_fogQuake3ShaderMaterial->GetProgram ( pStage->deformIndex , materialSystem.buildOneShader );
1266+ gl_fogQuake3ShaderMaterial->SetDeform ( pStage->deformIndex );
1267+
1268+ material->program = gl_fogQuake3ShaderMaterial->GetProgram ( materialSystem.buildOneShader );
12541269}
12551270
12561271void MaterialSystem::AddStage ( MaterialSurface* surface, shaderStage_t* pStage, uint32_t stage,
@@ -1607,7 +1622,7 @@ void MaterialSystem::UpdateDynamicSurfaces() {
16071622}
16081623
16091624void MaterialSystem::UpdateFrameData () {
1610- gl_clearSurfacesShader->BindProgram ( 0 );
1625+ gl_clearSurfacesShader->BindProgram ();
16111626 gl_clearSurfacesShader->SetUniform_Frame ( nextFrame );
16121627 gl_clearSurfacesShader->DispatchCompute ( MAX_VIEWS, 1 , 1 );
16131628
@@ -1632,7 +1647,7 @@ void MaterialSystem::DepthReduction() {
16321647 int width = depthImage->width ;
16331648 int height = depthImage->height ;
16341649
1635- gl_depthReductionShader->BindProgram ( 0 );
1650+ gl_depthReductionShader->BindProgram ();
16361651
16371652 uint32_t globalWorkgroupX = ( width + 7 ) / 8 ;
16381653 uint32_t globalWorkgroupY = ( height + 7 ) / 8 ;
@@ -1690,7 +1705,7 @@ void MaterialSystem::CullSurfaces() {
16901705 MatrixCopy ( backEnd.viewParms .world .modelViewMatrix , viewMatrix );
16911706 }
16921707
1693- gl_cullShader->BindProgram ( 0 );
1708+ gl_cullShader->BindProgram ();
16941709 uint32_t globalWorkGroupX = surfaceDescriptorsCount % MAX_COMMAND_COUNTERS == 0 ?
16951710 surfaceDescriptorsCount / MAX_COMMAND_COUNTERS : surfaceDescriptorsCount / MAX_COMMAND_COUNTERS + 1 ;
16961711 GL_Bind ( depthImage );
@@ -1733,7 +1748,7 @@ void MaterialSystem::CullSurfaces() {
17331748
17341749 gl_cullShader->DispatchCompute ( globalWorkGroupX, 1 , 1 );
17351750
1736- gl_processSurfacesShader->BindProgram ( 0 );
1751+ gl_processSurfacesShader->BindProgram ();
17371752 gl_processSurfacesShader->SetUniform_Frame ( nextFrame );
17381753 gl_processSurfacesShader->SetUniform_ViewID ( view );
17391754 gl_processSurfacesShader->SetUniform_SurfaceCommandsOffset ( surfaceCommandsCount * ( MAX_VIEWS * nextFrame + view ) );
0 commit comments