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

Merged
merged 1 commit into from
Nov 2, 2024

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
src/engine/renderer/Material.cpp Show resolved Hide resolved
src/engine/renderer/gl_shader.h Outdated Show resolved Hide resolved
@@ -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).

@VReaperV VReaperV force-pushed the material-uniform-global branch 4 times, most recently from 32a79ec to 3c3bed8 Compare October 31, 2024 23:36
@VReaperV
Copy link
Contributor Author

Rebased/ready for review again.

Copy link
Member

@slipher slipher left a comment

Choose a reason for hiding this comment

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

LGTM modulo comment

src/engine/renderer/gl_shader.h Outdated Show resolved Hide resolved
@VReaperV VReaperV merged commit 88c856d into DaemonEngine:master Nov 2, 2024
9 checks passed
@VReaperV VReaperV deleted the material-uniform-global branch November 2, 2024 22:07
@VReaperV VReaperV mentioned this pull request Nov 2, 2024
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: Done
Development

Successfully merging this pull request may close these issues.

2 participants