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

Support Per-Axis Sampler Repeat Mode #100777

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

IsaacMarovitz
Copy link

@IsaacMarovitz IsaacMarovitz commented Dec 23, 2024

Closes godotengine/godot-proposals#246, #44553, and #51625

Supporting this feature requires quite a few fundamental changes to parts of the core.

  • Rather than building a fixed list of a small subset of possible sampler permutations in material_storage, samplers can now be created as needed by calling material_storage->sampler_rd_get(). They are stored in a HashMap with the RD::SamplerState as the key, ensuring that duplicate samplers are never made. This HashMap is never trimmed unless the whole list is delloc'd. It's, therefore, possible to build a huge number of sampler variants by requesting many different states, but I don't think this will be much of an issue in reality.
  • samplers_inc.glsl is removed, as this fixed subset of samplers no longer exists. This means that every shader is expected to bind the required samplers as needed.
  • DefaultIdentifierActions.custom_samplers has been renamed to just samplers and can be used to define a mapping to an existing sampler binding when needed
  • DefaultIdentifierActions.default_filter and DefaultIdentifierActions.default_repeat have been removed
  • GLTF & FBX document classes have been updated to use the correct sampler state, resolving an unsupported part of their respective specs.

TODO:

  • Fix missing canvas samplers
  • Fix up missing changes in Fog, Sky, and GI
  • Convert shaders using append_uniforms
  • Finalise hashing method
  • Finalise shader changes
  • Fix up mobile renderer
  • Sort out anisotropy and LOD bias

@@ -394,8 +394,21 @@ const ShaderLanguage::KeyWord ShaderLanguage::keyword_list[] = {
{ TK_FILTER_LINEAR_MIPMAP, "filter_linear_mipmap", CF_UNSPECIFIED, {}, {} },
{ TK_FILTER_NEAREST_MIPMAP_ANISOTROPIC, "filter_nearest_mipmap_anisotropic", CF_UNSPECIFIED, {}, {} },
{ TK_FILTER_LINEAR_MIPMAP_ANISOTROPIC, "filter_linear_mipmap_anisotropic", CF_UNSPECIFIED, {}, {} },
{ TK_REPEAT_ENABLE, "repeat_enable", CF_UNSPECIFIED, {}, {} },
{ TK_REPEAT_DISABLE, "repeat_disable", CF_UNSPECIFIED, {}, {} },
{ TK_U_REPEAT_REPEAT, "u_repeat_repeat", CF_UNSPECIFIED, {}, {} },
Copy link
Author

Choose a reason for hiding this comment

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

Open to suggestions for better syntax here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate Texture clamp/repeat/mirror flags into an enum for each axis
2 participants