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

fix blended textures for dx, opengl, and metal #393

Merged
merged 1 commit into from
Dec 13, 2023

Conversation

Archez
Copy link
Contributor

@Archez Archez commented Dec 8, 2023

This PR adds some fixes around the masked/blended texture shaders

The blended textures shader effect was not fully implemented on DirectX. DirectX has 3 code paths:

  1. Tri-point filtering is off
  2. Tri-point filtering is on with linear filtering enabled for the texture
  3. Tri-point filtering is on but linear filtering is disabled for the texture

This third path was missing the logic for masked/blended texture effects. I have copied the patterns from code path 1 to here.


OpenGL, unlike the other renders, seems to require a dedicated sampler for each texture. We were only setting a sampler for the main textures (index 0 and 1), but not for the blended textures (index 4 and 5). This meant that any parameters needed for the texture were not applied to the blended texture in OpenGL like GL_MIRRORED_REPEAT to mirror a texture outside the texture coordinates. This PR checks if the texture has a blended texture and then applies the same sampler parameters to the blended texture index so OpenGL renders the texture as expected.


I also noticed a buffer size mismatch in the metal shader where it was updated to 8192 in the parent caller that passes the buffer through, but the function signature was still at the old size.

@Kenix3 Kenix3 merged commit eec8b86 into Kenix3:1.x Dec 13, 2023
4 checks passed
briaguya-ai pushed a commit to briaguya-ai/libultraship that referenced this pull request Dec 13, 2023
Kenix3 pushed a commit that referenced this pull request Dec 14, 2023
Co-authored-by: Adam Bird <Archez@users.noreply.github.com>
@Archez Archez deleted the fix-blended-textures branch December 16, 2023 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants