Skip to content

[D3D] Add B5G6R5 and B4G4R4 texture formats - #258

Open
aeTunga wants to merge 2 commits into
LukasBanana:masterfrom
aeTunga:fix/d3d-texture-formats
Open

[D3D] Add B5G6R5 and B4G4R4 texture formats#258
aeTunga wants to merge 2 commits into
LukasBanana:masterfrom
aeTunga:fix/d3d-texture-formats

Conversation

@aeTunga

@aeTunga aeTunga commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Adds the missing format mappings and unit-test coverage for the two packed 16-bit formats.

@LukasBanana LukasBanana left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'm happy to add those new entries if you have a use for them. Preferably, new entries to the public interface should implement them for all backends or otherwise document what backends supported them.

Comment thread include/LLGL/Format.h Outdated
Comment thread sources/Renderer/Format.cpp Outdated
Comment thread include/LLGL/Format.h Outdated
Comment thread sources/Renderer/DXCommon/DXTypes.cpp
@LukasBanana LukasBanana added the feature request Requested features and TODO lists label Aug 12, 2026

@LukasBanana LukasBanana left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I left a few more comments, but mostly looks good.

case Format::RG11B10Float: return MTLPixelFormatRG11B10Float;
case Format::RGB9E5Float: return MTLPixelFormatRGB9E5Float;
case Format::BGR5A1UNorm: break; //return MTLPixelFormatBGR5A1Unorm;
case Format::B5G6R5UNorm: return MTLPixelFormatB5G6R5Unorm;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please add a dummy case for BGRA4UNorm here analogous to BGRA8SInt above, to make it clear that this is intentionally left out.

InitializeGLTextureSwizzle(target, swizzle);
break;

case GLSwizzleFormat::BGR:

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This should have its own case and new functions that set TextureSwizzleRGBA::a to TextureSwizzle::Zero analogous to GetTextureSwizzlePermutationBGRAComponent() and GetTextureSwizzlePermutationBGRA() that acknowledge that no alpha component exists.

switch (swizzle)
{
case GLSwizzleFormat::Alpha: return MapGLSwizzleFormatAlpha(format);
case GLSwizzleFormat::BGR: return format;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can you please add a brief comment here why we forward the input for BGR? I presume this is because we only use GL_RGB565 and GL_RGBA4 for BGR/BGRA formats.

@LukasBanana
LukasBanana force-pushed the master branch 2 times, most recently from 7ec5c01 to e08bb6b Compare August 16, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Requested features and TODO lists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants