1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Update shader handling for macOS and iOS

This commit is contained in:
Leon Lysak 2025-11-17 12:50:52 -05:00 committed by GitHub
parent 4e502e588b
commit 6df445ab8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -452,14 +452,33 @@ static void ImGui_ImplSDLGPU3_CreateShaders()
#ifdef __APPLE__
else
{
vertex_shader_info.entrypoint = "main0";
vertex_shader_info.format = SDL_GPU_SHADERFORMAT_METALLIB;
vertex_shader_info.code = metallib_vertex;
vertex_shader_info.code_size = sizeof(metallib_vertex);
fragment_shader_info.entrypoint = "main0";
fragment_shader_info.format = SDL_GPU_SHADERFORMAT_METALLIB;
fragment_shader_info.code = metallib_fragment;
fragment_shader_info.code_size = sizeof(metallib_fragment);
#include <TargetConditionals.h>
#if TARGET_OS_OSX
/* macOS: using MSL source */
vertex_shader_info.entrypoint = "main0";
vertex_shader_info.format = SDL_GPU_SHADERFORMAT_MSL;
vertex_shader_info.code = msl_vertex;
vertex_shader_info.code_size = sizeof(msl_vertex);
fragment_shader_info.entrypoint = "main0";
fragment_shader_info.format = SDL_GPU_SHADERFORMAT_MSL;
fragment_shader_info.code = msl_fragment;
fragment_shader_info.code_size = sizeof(msl_fragment);
#elif TARGET_OS_IPHONE
/* iOS device: using metallib blobs */
vertex_shader_info.entrypoint = "main0";
vertex_shader_info.format = SDL_GPU_SHADERFORMAT_METALLIB;
vertex_shader_info.code = metallib_vertex;
vertex_shader_info.code_size = sizeof(metallib_vertex);
fragment_shader_info.entrypoint = "main0";
fragment_shader_info.format = SDL_GPU_SHADERFORMAT_METALLIB;
fragment_shader_info.code = metallib_fragment;
fragment_shader_info.code_size = sizeof(metallib_fragment);
#endif
}
#endif
bd->VertexShader = SDL_CreateGPUShader(v->Device, &vertex_shader_info);