Skip to content

Commit 8289656

Browse files
gyxos-loganslouken
authored andcommitted
GPU: Update to set supported shader formats inside CreateDevice
1 parent 514d96d commit 8289656

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

src/gpu/SDL_gpu.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,6 @@ SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props)
672672
result = selectedBackend->CreateDevice(debug_mode, preferLowPower, props);
673673
if (result != NULL) {
674674
result->backend = selectedBackend->name;
675-
result->shader_formats = selectedBackend->shader_formats;
676675
result->debug_mode = debug_mode;
677676
}
678677
}

src/gpu/d3d12/SDL_gpu_d3d12.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9182,8 +9182,23 @@ static SDL_GPUDevice *D3D12_CreateDevice(bool debugMode, bool preferLowPower, SD
91829182
return NULL;
91839183
}
91849184

9185+
SDL_GPUShaderFormat shaderFormats = SDL_GPU_SHADERFORMAT_DXBC;
9186+
9187+
D3D12_FEATURE_DATA_SHADER_MODEL shaderModel;
9188+
shaderModel.HighestShaderModel = D3D_SHADER_MODEL_6_0;
9189+
9190+
res = ID3D12Device_CheckFeatureSupport(
9191+
renderer->device,
9192+
D3D12_FEATURE_SHADER_MODEL,
9193+
&shaderModel,
9194+
sizeof(shaderModel));
9195+
if (SUCCEEDED(res) && shaderModel.HighestShaderModel >= D3D_SHADER_MODEL_6_0) {
9196+
shaderFormats |= SDL_GPU_SHADERFORMAT_DXIL;
9197+
}
9198+
91859199
ASSIGN_DRIVER(D3D12)
91869200
result->driverData = (SDL_GPURenderer *)renderer;
9201+
result->shader_formats = shaderFormats;
91879202
result->debug_mode = debugMode;
91889203
renderer->sdlGPUDevice = result;
91899204

src/gpu/metal/SDL_gpu_metal.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4610,6 +4610,7 @@ static void METAL_INTERNAL_DestroyBlitResources(
46104610
SDL_GPUDevice *result = SDL_calloc(1, sizeof(SDL_GPUDevice));
46114611
ASSIGN_DRIVER(METAL)
46124612
result->driverData = (SDL_GPURenderer *)renderer;
4613+
result->shader_formats = SDL_GPU_SHADERFORMAT_MSL | SDL_GPU_SHADERFORMAT_METALLIB;
46134614
renderer->sdlGPUDevice = result;
46144615

46154616
return result;

src/gpu/vulkan/SDL_gpu_vulkan.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11793,6 +11793,7 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S
1179311793
ASSIGN_DRIVER(VULKAN)
1179411794

1179511795
result->driverData = (SDL_GPURenderer *)renderer;
11796+
result->shader_formats = SDL_GPU_SHADERFORMAT_SPIRV;
1179611797

1179711798
/*
1179811799
* Create initial swapchain array

0 commit comments

Comments
 (0)