Skip to content

Commit

Permalink
Update for latest SDL_GPU ABI
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Aug 9, 2024
1 parent afe8286 commit 6540970
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions mojoshader_sdlgpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ MOJOSHADER_sdlProgram *MOJOSHADER_sdlLinkProgram(
createInfo.samplerCount = vshader->samplerSlots;
createInfo.uniformBufferCount = 1;

if (SDL_GpuGetBackend(ctx->device) != SDL_GPU_BACKEND_VULKAN)
if (SDL_GpuGetDriver(ctx->device) != SDL_GPU_DRIVER_VULKAN)
{
result->vertexShader = SDL_CompileFromSPIRV(
ctx->device,
Expand Down Expand Up @@ -402,7 +402,7 @@ MOJOSHADER_sdlProgram *MOJOSHADER_sdlLinkProgram(
createInfo.stage = SDL_GPU_SHADERSTAGE_FRAGMENT;
createInfo.samplerCount = pshader->samplerSlots;

if (SDL_GpuGetBackend(ctx->device) != SDL_GPU_BACKEND_VULKAN)
if (SDL_GpuGetDriver(ctx->device) != SDL_GPU_DRIVER_VULKAN)
{
result->pixelShader = SDL_CompileFromSPIRV(
ctx->device,
Expand Down
14 changes: 7 additions & 7 deletions spirv/SDL_gpu_shadercross.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ typedef void ID3DInclude; /* hack, unused */
#ifdef __stdcall
#undef __stdcall
#endif
#ifdef __x86_64__
#if defined(__x86_64__) || defined(__arm64__)
#define __stdcall __attribute__((ms_abi))
#else
#if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
Expand Down Expand Up @@ -152,7 +152,7 @@ void *SDL_CompileFromHLSL(
SDL_LogError(
SDL_LOG_CATEGORY_GPU,
"HLSL compilation failed: %s",
errorBlob->lpVtbl->GetBufferPointer(errorBlob));
(char*)errorBlob->lpVtbl->GetBufferPointer(errorBlob));
return NULL;
}

Expand Down Expand Up @@ -250,13 +250,13 @@ void *SDL_CompileFromSPIRV(
*/
createInfo = (SDL_GpuShaderCreateInfo *)originalCreateInfo;

switch (SDL_GpuGetBackend(device)) {
case SDL_GPU_BACKEND_D3D11:
case SDL_GPU_BACKEND_D3D12:
switch (SDL_GpuGetDriver(device)) {
case SDL_GPU_DRIVER_D3D11:
case SDL_GPU_DRIVER_D3D12:
backend = SPVC_BACKEND_HLSL;
format = SDL_GPU_SHADERFORMAT_DXBC;
break;
case SDL_GPU_BACKEND_METAL:
case SDL_GPU_DRIVER_METAL:
backend = SPVC_BACKEND_MSL;
format = SDL_GPU_SHADERFORMAT_MSL;
break;
Expand Down Expand Up @@ -325,7 +325,7 @@ void *SDL_CompileFromSPIRV(
}

if (backend == SPVC_BACKEND_HLSL) {
if (SDL_GpuGetBackend(device) == SDL_GPU_BACKEND_D3D11) {
if (SDL_GpuGetDriver(device) == SDL_GPU_DRIVER_D3D11) {
shadermodel = 50;
} else {
shadermodel = 51;
Expand Down

0 comments on commit 6540970

Please sign in to comment.