mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-01 15:38:29 +00:00
GPU: Update to set supported shader formats inside CreateDevice
This commit is contained in:
@@ -672,7 +672,6 @@ SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props)
|
|||||||
result = selectedBackend->CreateDevice(debug_mode, preferLowPower, props);
|
result = selectedBackend->CreateDevice(debug_mode, preferLowPower, props);
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
result->backend = selectedBackend->name;
|
result->backend = selectedBackend->name;
|
||||||
result->shader_formats = selectedBackend->shader_formats;
|
|
||||||
result->debug_mode = debug_mode;
|
result->debug_mode = debug_mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9182,8 +9182,23 @@ static SDL_GPUDevice *D3D12_CreateDevice(bool debugMode, bool preferLowPower, SD
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SDL_GPUShaderFormat shaderFormats = SDL_GPU_SHADERFORMAT_DXBC;
|
||||||
|
|
||||||
|
D3D12_FEATURE_DATA_SHADER_MODEL shaderModel;
|
||||||
|
shaderModel.HighestShaderModel = D3D_SHADER_MODEL_6_0;
|
||||||
|
|
||||||
|
res = ID3D12Device_CheckFeatureSupport(
|
||||||
|
renderer->device,
|
||||||
|
D3D12_FEATURE_SHADER_MODEL,
|
||||||
|
&shaderModel,
|
||||||
|
sizeof(shaderModel));
|
||||||
|
if (SUCCEEDED(res) && shaderModel.HighestShaderModel >= D3D_SHADER_MODEL_6_0) {
|
||||||
|
shaderFormats |= SDL_GPU_SHADERFORMAT_DXIL;
|
||||||
|
}
|
||||||
|
|
||||||
ASSIGN_DRIVER(D3D12)
|
ASSIGN_DRIVER(D3D12)
|
||||||
result->driverData = (SDL_GPURenderer *)renderer;
|
result->driverData = (SDL_GPURenderer *)renderer;
|
||||||
|
result->shader_formats = shaderFormats;
|
||||||
result->debug_mode = debugMode;
|
result->debug_mode = debugMode;
|
||||||
renderer->sdlGPUDevice = result;
|
renderer->sdlGPUDevice = result;
|
||||||
|
|
||||||
|
@@ -4610,6 +4610,7 @@ static SDL_GPUDevice *METAL_CreateDevice(bool debugMode, bool preferLowPower, SD
|
|||||||
SDL_GPUDevice *result = SDL_calloc(1, sizeof(SDL_GPUDevice));
|
SDL_GPUDevice *result = SDL_calloc(1, sizeof(SDL_GPUDevice));
|
||||||
ASSIGN_DRIVER(METAL)
|
ASSIGN_DRIVER(METAL)
|
||||||
result->driverData = (SDL_GPURenderer *)renderer;
|
result->driverData = (SDL_GPURenderer *)renderer;
|
||||||
|
result->shader_formats = SDL_GPU_SHADERFORMAT_MSL | SDL_GPU_SHADERFORMAT_METALLIB;
|
||||||
renderer->sdlGPUDevice = result;
|
renderer->sdlGPUDevice = result;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@@ -11793,6 +11793,7 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S
|
|||||||
ASSIGN_DRIVER(VULKAN)
|
ASSIGN_DRIVER(VULKAN)
|
||||||
|
|
||||||
result->driverData = (SDL_GPURenderer *)renderer;
|
result->driverData = (SDL_GPURenderer *)renderer;
|
||||||
|
result->shader_formats = SDL_GPU_SHADERFORMAT_SPIRV;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create initial swapchain array
|
* Create initial swapchain array
|
||||||
|
Reference in New Issue
Block a user