Skip to content

Commit d314a57

Browse files
committed
Use separate binds/uniforms for depthtile1/2 textures
1 parent 86edc23 commit d314a57

File tree

5 files changed

+34
-10
lines changed

5 files changed

+34
-10
lines changed

src/engine/renderer/gl_shader.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,7 +2950,7 @@ void GLShader_depthtile1::SetShaderProgramUniforms( ShaderProgramDescriptor *sha
29502950
GLShader_depthtile2::GLShader_depthtile2() :
29512951
GLShader( "depthtile2", ATTR_POSITION,
29522952
false, "screenSpace", "depthtile2" ),
2953-
u_DepthMap( this ) {
2953+
u_DepthTile1( this ) {
29542954
}
29552955

29562956
void GLShader_depthtile2::SetShaderProgramUniforms( ShaderProgramDescriptor *shaderProgram )
@@ -2961,7 +2961,7 @@ void GLShader_depthtile2::SetShaderProgramUniforms( ShaderProgramDescriptor *sha
29612961
GLShader_lighttile::GLShader_lighttile() :
29622962
GLShader( "lighttile", ATTR_POSITION | ATTR_TEXCOORD,
29632963
false, "lighttile", "lighttile" ),
2964-
u_DepthMap( this ),
2964+
u_DepthTile2( this ),
29652965
u_Lights( this ),
29662966
u_numLights( this ),
29672967
u_lightLayer( this ),

src/engine/renderer/gl_shader.h

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,6 +1840,30 @@ class u_FogMap :
18401840
}
18411841
};
18421842

1843+
class u_DepthTile1 :
1844+
GLUniformSampler2D {
1845+
public:
1846+
u_DepthTile1( GLShader* shader ) :
1847+
GLUniformSampler2D( shader, "u_DepthTile1" ) {
1848+
}
1849+
1850+
void SetUniform_DepthTile1Bindless( GLuint64 bindlessHandle ) {
1851+
this->SetValueBindless( bindlessHandle );
1852+
}
1853+
};
1854+
1855+
class u_DepthTile2 :
1856+
GLUniformSampler2D {
1857+
public:
1858+
u_DepthTile2( GLShader* shader ) :
1859+
GLUniformSampler2D( shader, "u_DepthTile2" ) {
1860+
}
1861+
1862+
void SetUniform_DepthTile2Bindless( GLuint64 bindlessHandle ) {
1863+
this->SetValueBindless( bindlessHandle );
1864+
}
1865+
};
1866+
18431867
class u_LightTiles :
18441868
GLUniformSampler3D {
18451869
public:
@@ -3674,15 +3698,15 @@ class GLShader_depthtile1 :
36743698

36753699
class GLShader_depthtile2 :
36763700
public GLShader,
3677-
public u_DepthMap {
3701+
public u_DepthTile1 {
36783702
public:
36793703
GLShader_depthtile2();
36803704
void SetShaderProgramUniforms( ShaderProgramDescriptor *shaderProgram ) override;
36813705
};
36823706

36833707
class GLShader_lighttile :
36843708
public GLShader,
3685-
public u_DepthMap,
3709+
public u_DepthTile2,
36863710
public u_Lights,
36873711
public u_numLights,
36883712
public u_lightLayer,

src/engine/renderer/glsl_source/depthtile2_fp.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3434

3535
/* depthtile2_fp.glsl */
3636

37-
uniform sampler2D u_DepthMap;
37+
uniform sampler2D u_DepthTile1;
3838

3939
#if __VERSION__ > 120
4040
out vec4 outputColor;
@@ -51,7 +51,7 @@ void main()
5151

5252
for( x = -0.375; x < 0.5; x += 0.25 ) {
5353
for( y = -0.375; y < 0.5; y += 0.25 ) {
54-
vec4 data = texture2D( u_DepthMap, st + vec2(x, y) * r_tileStep );
54+
vec4 data = texture2D( u_DepthTile1, st + vec2(x, y) * r_tileStep );
5555
if( data.y < 99999.0 ) {
5656
accum.x = max( accum.x, data.x );
5757
accum.y = min( accum.y, data.y );

src/engine/renderer/glsl_source/lighttile_fp.glsl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Light GetLight( in uint idx ) {
5959

6060
uniform int u_numLights;
6161
uniform mat4 u_ModelMatrix;
62-
uniform sampler2D u_DepthMap;
62+
uniform sampler2D u_DepthTile2;
6363
uniform int u_lightLayer;
6464
uniform vec3 u_zFar;
6565

@@ -96,7 +96,7 @@ vec3 ProjToView( vec2 inp ) {
9696
}
9797

9898
void main() {
99-
vec2 minmax = texture2D( u_DepthMap, 0.5 * vPosition + 0.5 ).xy;
99+
vec2 minmax = texture2D( u_DepthTile2, 0.5 * vPosition + 0.5 ).xy;
100100

101101
float minx = vPosition.x - r_tileStep.x;
102102
float maxx = vPosition.x + r_tileStep.x;

src/engine/renderer/tr_backend.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,7 +1160,7 @@ void RB_RenderPostDepthLightTile()
11601160
GL_Scissor( 0, 0, w, h );
11611161
gl_depthtile2Shader->BindProgram( 0 );
11621162

1163-
gl_depthtile2Shader->SetUniform_DepthMapBindless(
1163+
gl_depthtile2Shader->SetUniform_DepthTile1Bindless(
11641164
GL_BindToTMU( 0, tr.depthtile1RenderImage )
11651165
);
11661166

@@ -1180,7 +1180,7 @@ void RB_RenderPostDepthLightTile()
11801180

11811181
gl_lighttileShader->SetUniformBlock_Lights( tr.dlightUBO );
11821182

1183-
gl_lighttileShader->SetUniform_DepthMapBindless(
1183+
gl_lighttileShader->SetUniform_DepthTile2Bindless(
11841184
GL_BindToTMU( 1, tr.depthtile2RenderImage )
11851185
);
11861186

0 commit comments

Comments
 (0)