Skip to content

Commit

Permalink
Might as well set the shader format at compile time for now
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSpydog committed Nov 3, 2024
1 parent 898bf5f commit 87fec04
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions mojoshader_sdlgpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
#define MAX_REG_FILE_I 2047
#define MAX_REG_FILE_B 2047

/* The shader format to use. Initialized by MOJOSHADER_sdlGetShaderFormats. */
static SDL_GPUShaderFormat shader_format;
/* The destination shader format to use */
static SDL_GPUShaderFormat shader_format =
#ifdef __APPLE__
SDL_GPU_SHADERFORMAT_MSL;
#else
SDL_GPU_SHADERFORMAT_SPIRV:
#endif

typedef struct ShaderEntry
{
Expand Down Expand Up @@ -249,17 +254,6 @@ static uint8_t update_uniform_buffer(

unsigned int MOJOSHADER_sdlGetShaderFormats(void)
{
const char *platform = SDL_GetPlatform();
if (SDL_strcmp(platform, "macOS") == 0 ||
SDL_strcmp(platform, "iOS") == 0 ||
SDL_strcmp(platform, "tvOS") == 0)
{
shader_format = SDL_GPU_SHADERFORMAT_MSL;
}
else
{
shader_format = SDL_GPU_SHADERFORMAT_SPIRV;
}
return shader_format;
} // MOJOSHADER_sdlGetShaderFormats

Expand Down

0 comments on commit 87fec04

Please sign in to comment.