Skip to content

gltfio: Support textures bound to both sRGB and Linear parameters#10037

Open
bejado wants to merge 1 commit into
mainfrom
bjd/gltfio-parameter-flags
Open

gltfio: Support textures bound to both sRGB and Linear parameters#10037
bejado wants to merge 1 commit into
mainfrom
bjd/gltfio-parameter-flags

Conversation

@bejado
Copy link
Copy Markdown
Member

@bejado bejado commented May 20, 2026

Previously, gltfio assumed that each cgltf_texture slot could only ever be bound in a single color space, mapping it to a single Filament Texture format. If a single texture index was bound to parameters with conflicting color-space requirements (for example, an sRGB baseColorTexture and a Linear occlusionTexture), the loader would trigger an assertion panic.

This PR resolves this limitation by allowing a single cgltf_texture to resolve to separate sRGB and Linear Filament texture resources under the hood when conflicting color space requirements are requested.

Fixes #8449

TextureProvider* provider = foundProvider->second;
assert_invariant(provider);

const size_t cacheIdx = (uint64_t) flags & 1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we make this a little more clear like

    const size_t cacheIdx = any(flags & TextureFlags::sRGB) ? 1 : 0;

@pixelflinger pixelflinger added the internal Issue/PR does not affect clients label May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Issue/PR does not affect clients

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertion failure when reusing texture in different material properties

3 participants