Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/engine/renderer/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -908,10 +908,8 @@ void BindShaderLightMapping( Material* material ) {

const float interpolation = 1.0 - trilerp[0];

if ( r_logFile->integer ) {
GLimp_LogComment( va( "Probe 0 distance = %f, probe 1 distance = %f, interpolation = %f\n",
Distance( position, probes[0]->origin ), Distance( position, probes[1]->origin ), interpolation ) );
}
GLIMP_LOGCOMMENT( "Probe 0 distance = %f, probe 1 distance = %f, interpolation = %f",
Distance( position, probes[0]->origin ), Distance( position, probes[1]->origin ), interpolation );

// bind u_EnvironmentMap0
gl_lightMappingShaderMaterial->SetUniform_EnvironmentMap0Bindless(
Expand Down
7 changes: 4 additions & 3 deletions src/engine/renderer/gl_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2351,13 +2351,14 @@ void GLShader::BindProgram( int deformIndex ) {

currentProgram = &shaderPrograms[index];

if ( r_logFile->integer ) {
if ( GLimp_isLogging() )
{
std::string macros;

GetCompileMacrosString( index, macros, GLCompileMacro::VERTEX | GLCompileMacro::FRAGMENT );

auto msg = Str::Format( "--- GL_BindProgram( name = '%s', macros = '%s' ) ---\n", this->GetName(), macros );
GLimp_LogComment( msg.c_str() );
GLIMP_LOGCOMMENT( "--- GL_BindProgram( name = '%s', macros = '%s' ) ---",
this->GetName(), macros );
}

GL_BindProgram( &shaderPrograms[index] );
Expand Down
125 changes: 6 additions & 119 deletions src/engine/renderer/gl_shader.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "tr_local.h"
#include <stdexcept>

#define LOG_GLSL_UNIFORMS 1
#define USE_UNIFORM_FIREWALL 1

// *INDENT-OFF*
Expand Down Expand Up @@ -684,14 +683,6 @@ class GLUniform1i : protected GLUniform
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer )
{
GLimp_LogComment( va( "GLSL_SetUniform1i( %s, shader: %s, value: %d ) ---\n",
this->GetName(), _shader->GetName().c_str(), value ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
currentValue = value;
return;
Expand Down Expand Up @@ -737,13 +728,6 @@ class GLUniform1ui : protected GLUniform {
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer ) {
GLimp_LogComment( va( "GLSL_SetUniform1i( %s, shader: %s, value: %d ) ---\n",
this->GetName(), _shader->GetName().c_str(), value ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
currentValue = value;
return;
Expand Down Expand Up @@ -788,13 +772,6 @@ class GLUniform1Bool : protected GLUniform {
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer ) {
GLimp_LogComment( va( "GLSL_SetUniform1i( %s, shader: %s, value: %d ) ---\n",
this->GetName(), _shader->GetName().c_str(), value ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
currentValue = value;
return;
Expand Down Expand Up @@ -842,14 +819,6 @@ class GLUniform1f : protected GLUniform
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer )
{
GLimp_LogComment( va( "GLSL_SetUniform1f( %s, shader: %s, value: %f ) ---\n",
this->GetName(), _shader->GetName().c_str(), value ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
currentValue = value;
return;
Expand Down Expand Up @@ -899,14 +868,6 @@ class GLUniform1fv : protected GLUniform
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer )
{
GLimp_LogComment( va( "GLSL_SetUniform1fv( %s, shader: %s, numFloats: %d ) ---\n",
this->GetName(), _shader->GetName().c_str(), numFloats ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
memcpy( currentValue.data(), f, numFloats * sizeof( float ) );
return;
Expand Down Expand Up @@ -942,14 +903,6 @@ class GLUniform2f : protected GLUniform
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer )
{
GLimp_LogComment( va( "GLSL_SetUniform2f( %s, shader: %s, value: [ %f, %f ] ) ---\n",
this->GetName(), _shader->GetName().c_str(), v[ 0 ], v[ 1 ] ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
Vector2Copy( v, currentValue );
return;
Expand Down Expand Up @@ -1002,14 +955,6 @@ class GLUniform3f : protected GLUniform
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer )
{
GLimp_LogComment( va( "GLSL_SetUniform3f( %s, shader: %s, value: [ %f, %f, %f ] ) ---\n",
this->GetName(), _shader->GetName().c_str(), v[ 0 ], v[ 1 ], v[ 2 ] ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
VectorCopy( v, currentValue );
return;
Expand Down Expand Up @@ -1062,14 +1007,6 @@ class GLUniform4f : protected GLUniform
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer )
{
GLimp_LogComment( va( "GLSL_SetUniform4f( %s, shader: %s, value: [ %f, %f, %f, %f ] ) ---\n",
this->GetName(), _shader->GetName().c_str(), v[ 0 ], v[ 1 ], v[ 2 ], v[ 3 ] ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
Vector4Copy( v, currentValue );
return;
Expand Down Expand Up @@ -1119,14 +1056,6 @@ class GLUniform4fv : protected GLUniform
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer )
{
GLimp_LogComment( va( "GLSL_SetUniform4fv( %s, shader: %s, numV: %d ) ---\n",
this->GetName(), _shader->GetName().c_str(), numV ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
memcpy( currentValue.data(), v, numV * sizeof( vec4_t ) );
return;
Expand Down Expand Up @@ -1162,16 +1091,6 @@ class GLUniformMatrix4f : protected GLUniform
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer )
{
GLimp_LogComment( va( "GLSL_SetUniformMatrix4f( %s, shader: %s, transpose: %d, [ %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f, %f ] ) ---\n",
this->GetName(), _shader->GetName().c_str(), transpose,
m[ 0 ], m[ 1 ], m[ 2 ], m[ 3 ], m[ 4 ], m[ 5 ], m[ 6 ], m[ 7 ], m[ 8 ], m[ 9 ], m[ 10 ], m[ 11 ], m[ 12 ],
m[ 13 ], m[ 14 ], m[ 15 ] ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
MatrixCopy( m, currentValue );
return;
Expand Down Expand Up @@ -1217,14 +1136,6 @@ class GLUniformMatrix32f : protected GLUniform {
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer ) {
GLimp_LogComment( va( "GLSL_SetUniformMatrix32f( %s, shader: %s, transpose: %d, [ %f, %f, %f, %f, %f, %f ] ) ---\n",
this->GetName(), _shader->GetName().c_str(), transpose,
m[0], m[1], m[2], m[3], m[4], m[5] ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
memcpy( currentValue, m, 6 * sizeof( float ) );
return;
Expand Down Expand Up @@ -1263,14 +1174,6 @@ class GLUniformMatrix4fv : protected GLUniform
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer )
{
GLimp_LogComment( va( "GLSL_SetUniformMatrix4fv( %s, shader: %s, numMatrices: %d, transpose: %d ) ---\n",
this->GetName(), _shader->GetName().c_str(), numMatrices, transpose ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
memcpy( currentValue.data(), m, numMatrices * sizeof( matrix_t ) );
return;
Expand Down Expand Up @@ -1305,14 +1208,6 @@ class GLUniformMatrix34fv : protected GLUniform
ASSERT_EQ( p, glState.currentProgram );
}

#if defined( LOG_GLSL_UNIFORMS )
if ( r_logFile->integer )
{
GLimp_LogComment( va( "GLSL_SetUniformMatrix34fv( %s, shader: %s, numMatrices: %d, transpose: %d ) ---\n",
this->GetName(), _shader->GetName().c_str(), numMatrices, transpose ) );
}
#endif

if ( _shader->UseMaterialSystem() && !_global ) {
memcpy( currentValue.data(), m, numMatrices * sizeof( matrix_t ) );
return;
Expand Down Expand Up @@ -3786,13 +3681,9 @@ class u_ColorModulateColorGen_Float :
const bool vertexOverbright = false,
const bool useMapLightFactor = false )
{
if ( r_logFile->integer ) {
GLimp_LogComment(
va( "--- u_ColorModulate::SetUniform_ColorModulateColorGen_Float( "
"program = %s, colorGen = %s, alphaGen = %s ) ---\n",
_shader->GetName().c_str(), Util::enum_str( colorGen ), Util::enum_str( alphaGen ) )
);
}
GLIMP_LOGCOMMENT( "--- u_ColorModulate::SetUniform_ColorModulateColorGen_Float( "
"program = %s, colorGen = %s, alphaGen = %s ) ---",
_shader->GetName().c_str(), Util::enum_str( colorGen ), Util::enum_str( alphaGen ) );

colorModulation_t colorModulation = ColorModulateColorGen(
colorGen, alphaGen, vertexOverbright, useMapLightFactor );
Expand Down Expand Up @@ -3821,13 +3712,9 @@ class u_ColorModulateColorGen_Uint :
const bool vertexOverbright = false,
const bool useMapLightFactor = false )
{
if ( r_logFile->integer ) {
GLimp_LogComment(
va( "--- u_ColorModulate::SetUniform_ColorModulateColorGen_Uint( "
"program = %s, colorGen = %s, alphaGen = %s ) ---\n",
_shader->GetName().c_str(), Util::enum_str( colorGen ), Util::enum_str( alphaGen ) )
);
}
GLIMP_LOGCOMMENT( "--- u_ColorModulate::SetUniform_ColorModulateColorGen_Uint( "
"program = %s, colorGen = %s, alphaGen = %s ) ---",
_shader->GetName().c_str(), Util::enum_str( colorGen ), Util::enum_str( alphaGen ) );

colorModulation_t colorModulation = ColorModulateColorGen(
colorGen, alphaGen, vertexOverbright, useMapLightFactor );
Expand Down
Loading