Rename uv to uv_a and VERTEX_UVS to VERTEX_UVS_A in shaders.#10237
Closed
pcwalton wants to merge 1 commit intobevyengine:mainfrom
Closed
Rename uv to uv_a and VERTEX_UVS to VERTEX_UVS_A in shaders.#10237pcwalton wants to merge 1 commit intobevyengine:mainfrom
uv to uv_a and VERTEX_UVS to VERTEX_UVS_A in shaders.#10237pcwalton wants to merge 1 commit intobevyengine:mainfrom
Conversation
We now support two sets of UVs, so `uv` and `VERTEX_UVS` in shaders are now ambiguous. To solve this, we explicitly mark the UV set we're using in the shaders, so as to distinguish it from the second UV set used for lightmaps in PR The obvious question is "why use `UV_A` and `UV_B` instead of UV0 and UV1?" The answer is that Naga doesn't currently allow preprocessor definitions that end in numbers. To work around this restriction, I renamed UV0 to `UV_A` and UV1 to `UV_B`.
Merged
Contributor
|
a quick correction - preprocessor definitions that end in numbers or _ should be fine i think. the problem is that struct members can't end in numbers or underscores - the |
Contributor
Author
|
Closing per discussion on Discord. The preference is to leave |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Objective
We now support two sets of UVs, so
uvandVERTEX_UVSin shaders are now ambiguous.Solution
To solve this, we explicitly mark the UV set we're using in the shaders, so as to distinguish it from the second UV set used for lightmaps in PR #10231.
The obvious question is "why use
UV_AandUV_Binstead of UV0 and UV1?" The answer is that Naga doesn't currently allow preprocessor definitions that end in numbers. To work around this restriction, I renamed UV0 toUV_Aand UV1 toUV_B.Changelog
Changed
uvfield is nowuv_a, and the corresponding define changed fromVERTEX_UVStoVERTEX_UVS_A, for clarity when multiple UV sets are involved.Migration Guide
uvfield of the vertex input or output in a custom shaders, change it touv_a. Likewise, the corresponding define should be changed fromVERTEX_UVStoVERTEX_UVS_A.