fix blended textures for dx, opengl, and metal #393
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
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.