Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some uniforms global #1317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

VReaperV
Copy link
Contributor

Don't put data that doesn't change into the material buffer.

@VReaperV VReaperV added T-Improvement Improvement for an existing feature A-Renderer T-Performance labels Sep 20, 2024
@@ -1104,6 +1105,107 @@ void BindShaderLightMapping( Material* material ) {
}
// FIXME: else

// bind u_LightGrid1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a lot of new code here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that can be removed since light/deluxe grid textures don't change and they're set always set elsewhere.

@@ -3496,7 +3496,7 @@ class u_VertexInterpolation :
{
public:
u_VertexInterpolation( GLShader *shader ) :
GLUniform1f( shader, "u_VertexInterpolation" )
GLUniform1f( shader, "u_VertexInterpolation", true )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems wrong. This one is set for surfaces that are part of an MD3 model

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that uniform can just be removed from the shader since it will likely use other means to do vertex skinning/animation.

@@ -2497,7 +2497,7 @@ class u_EnvironmentMap0 :
GLUniformSamplerCube {
public:
u_EnvironmentMap0( GLShader* shader ) :
GLUniformSamplerCube( shader, "u_EnvironmentMap0" ) {
GLUniformSamplerCube( shader, "u_EnvironmentMap0", true ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine this should be dependent on the surface's position? Currently it is determined from the viewing position but I assume that's just because the old reflective specular code was half unfinished and written while drunk.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be, yeah. I was just going off of whatever code we already had.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be more specific, binding cubemaps based on where the surface is will also give bad results, especially if the surface is large. Ideally we'd further divide the frustum (further from the current tiled implementation) into clusters and assign a cubemap to each cluster.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this would pretty much require changing from tiled renderer to clustered, because I plan to merge stages with the same data in the buffer, which means that they will point to the wrong cubemaps for most surfaces (right now having separate data for each stage in the material buffer makes it take up about ~10x the space on average and decreases performance).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Renderer T-Improvement Improvement for an existing feature T-Performance
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants