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

StdGL: Move gamma calculation to shaders if shaders are enabled #93

Merged
merged 17 commits into from
Sep 10, 2024

Conversation

Fulgen301
Copy link
Member

@Fulgen301 Fulgen301 commented Oct 29, 2022

unknown

GLSL shaders now do the gamma calculation. For this purpose, the gamma ramp is directly copied into a 256x3 texture.
The old way of setting the system's gamma ramp directly is still used for the non-shader code path for older systems.

TODO:

  • 256x3 is a non power-of-two texture, which requires OpenGL 2.0 and won't be handled well by old GPUs. While those could just use the non-shader path, increasing the texture size to 256x4 at the expense of 256 bytes would solve that issue.
  • Add error checking for texture creation - at the moment, the game will start with a black screen with no error logged even if it couldn't be created properly.
  • DrawQuadDw looks weird with certain gamma values, e.g. the example given in the docs.
  • Implement Graphics.DisableGamma properly - the shader currently still samples the gamma texture even if gamma is disabled. DisableGamma should disable any gamma-related code entirely.

@Fulgen301 Fulgen301 added the enhancement New feature or request label Oct 29, 2022
@Fulgen301 Fulgen301 self-assigned this Oct 29, 2022
@Somebodyisnobody
Copy link
Contributor

Somebodyisnobody commented Oct 30, 2022

[...] if it fails, the game will start with a black screen with nothing in the logs indicating an error.

Is this the desired or current behaviour?

@Fulgen301
Copy link
Member Author

The current behavior - all other components (e.g. the shaders) log an error and exit the game if they cannot be created.

@Fulgen301 Fulgen301 merged commit 3dc4420 into master Sep 10, 2024
12 checks passed
@Fulgen301 Fulgen301 deleted the gamma_shader branch September 10, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants