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

[Metal] Always set the swizzle of the render target. #3399

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/renderer_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,11 @@ bool init(const Init& _init)
BX_UNUSED(_init);
BX_TRACE("Init.");

#define CHECK_FEATURE_AVAILABLE(feature, ...) if (@available(__VA_ARGS__)) { feature = true; } else { feature = false; }
#define CHECK_FEATURE_AVAILABLE(feature, ...) \
BX_MACRO_BLOCK_BEGIN \
if (@available(__VA_ARGS__)) { feature = true; } else { feature = false; } \
BX_TRACE("[MTL] OS feature %s: %d", (#feature) + 2, feature); \
BX_MACRO_BLOCK_END

CHECK_FEATURE_AVAILABLE(m_usesMTLBindings, macOS 13.0, iOS 16.0, tvOS 16.0, macCatalyst 16.0, VISION_OS_MINIMUM *);
CHECK_FEATURE_AVAILABLE(m_hasCPUCacheModesAndStorageModes, iOS 9.0, macOS 10.11, macCatalyst 13.1, tvOS 9.0, VISION_OS_MINIMUM *);
Expand Down Expand Up @@ -3672,6 +3676,7 @@ void writeString(bx::WriterI* _writer, const char* _str)
desc.mipmapLevelCount = 1;
desc.sampleCount = sampleCount;
desc.arrayLength = 1;
desc.swizzle = { MTLTextureSwizzleRed, MTLTextureSwizzleGreen, MTLTextureSwizzleBlue, MTLTextureSwizzleAlpha };

if (s_renderMtl->m_hasCPUCacheModesAndStorageModes)
{
Expand Down