Skip to content

Commit

Permalink
Update SDL_gpu_shadercross.h for DXC support
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Aug 18, 2024
1 parent 74c5001 commit 0b3b01b
Show file tree
Hide file tree
Showing 2 changed files with 459 additions and 45 deletions.
40 changes: 10 additions & 30 deletions mojoshader_sdlgpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,21 +377,11 @@ MOJOSHADER_sdlProgram *MOJOSHADER_sdlLinkProgram(
createInfo.samplerCount = vshader->samplerSlots;
createInfo.uniformBufferCount = 1;

if (SDL_GpuGetDriver(ctx->device) != SDL_GPU_DRIVER_VULKAN)
{
result->vertexShader = SDL_ShaderCross_CompileFromSPIRV(
ctx->device,
&createInfo,
SDL_FALSE
);
} // if
else
{
result->vertexShader = SDL_GpuCreateShader(
ctx->device,
&createInfo
);
} // else
result->vertexShader = SDL_ShaderCross_CompileFromSPIRV(
ctx->device,
&createInfo,
SDL_FALSE
);

if (result->vertexShader == NULL)
{
Expand All @@ -407,21 +397,11 @@ MOJOSHADER_sdlProgram *MOJOSHADER_sdlLinkProgram(
createInfo.stage = SDL_GPU_SHADERSTAGE_FRAGMENT;
createInfo.samplerCount = pshader->samplerSlots;

if (SDL_GpuGetDriver(ctx->device) != SDL_GPU_DRIVER_VULKAN)
{
result->pixelShader = SDL_ShaderCross_CompileFromSPIRV(
ctx->device,
&createInfo,
SDL_FALSE
);
} // if
else
{
result->pixelShader = SDL_GpuCreateShader(
ctx->device,
&createInfo
);
} // else
result->pixelShader = SDL_ShaderCross_CompileFromSPIRV(
ctx->device,
&createInfo,
SDL_FALSE
);

if (result->pixelShader == NULL)
{
Expand Down
Loading

0 comments on commit 0b3b01b

Please sign in to comment.