mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-16 17:58:27 +00:00
Renamed GPU device creation properties
This commit is contained in:
parent
d70578b9aa
commit
b8e7ef27f3
5 changed files with 47 additions and 47 deletions
|
@ -948,28 +948,28 @@ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDevice(
|
|||
*
|
||||
* These are the supported properties:
|
||||
*
|
||||
* - `SDL_PROP_GPU_CREATEDEVICE_DEBUGMODE_BOOL`: enable debug mode properties
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL`: enable debug mode properties
|
||||
* and validations, default is true
|
||||
* - `SDL_PROP_GPU_CREATEDEVICE_PREFERLOWPOWER_BOOL`: enable to prefer energy
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL`: enable to prefer energy
|
||||
* efficiency over maximum GPU performance
|
||||
* - `SDL_PROP_GPU_CREATEDEVICE_NAME_STRING`: the name of the GPU driver to
|
||||
* - `SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING`: the name of the GPU driver to
|
||||
* use, if a specific one is desired
|
||||
*
|
||||
* These are the current shader format properties:
|
||||
*
|
||||
* `SDL_PROP_GPU_CREATEDEVICE_SHADERS_SECRET_BOOL`: The app is able to provide
|
||||
* shaders for an NDA platform `SDL_PROP_GPU_CREATEDEVICE_SHADERS_SPIRV_BOOL`:
|
||||
* `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SECRET_BOOL`: The app is able to provide
|
||||
* shaders for an NDA platform `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL`:
|
||||
* The app is able to provide SPIR-V shaders if applicable
|
||||
* `SDL_PROP_GPU_CREATEDEVICE_SHADERS_DXBC_BOOL`: The app is able to provide
|
||||
* DXBC shaders if applicable `SDL_PROP_GPU_CREATEDEVICE_SHADERS_DXIL_BOOL`:
|
||||
* `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL`: The app is able to provide
|
||||
* DXBC shaders if applicable `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL`:
|
||||
* The app is able to provide DXIL shaders if applicable
|
||||
* `SDL_PROP_GPU_CREATEDEVICE_SHADERS_MSL_BOOL`: The app is able to provide
|
||||
* `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL`: The app is able to provide
|
||||
* MSL shaders if applicable
|
||||
* `SDL_PROP_GPU_CREATEDEVICE_SHADERS_METALLIB_BOOL`: The app is able to
|
||||
* `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL`: The app is able to
|
||||
* provide Metal shader libraries if applicable
|
||||
*
|
||||
* With the D3D12 renderer: -
|
||||
* `SDL_PROP_GPU_CREATEDEVICE_D3D12_SEMANTIC_NAME_STRING`: the prefix to use
|
||||
* `SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING`: the prefix to use
|
||||
* for all vertex semantics, default is "TEXCOORD"
|
||||
*
|
||||
* \param props the properties to use.
|
||||
|
@ -983,16 +983,16 @@ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDevice(
|
|||
extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDeviceWithProperties(
|
||||
SDL_PropertiesID props);
|
||||
|
||||
#define SDL_PROP_GPU_CREATEDEVICE_DEBUGMODE_BOOL "SDL.gpu.createdevice.debugmode"
|
||||
#define SDL_PROP_GPU_CREATEDEVICE_PREFERLOWPOWER_BOOL "SDL.gpu.createdevice.preferlowpower"
|
||||
#define SDL_PROP_GPU_CREATEDEVICE_NAME_STRING "SDL.gpu.createdevice.name"
|
||||
#define SDL_PROP_GPU_CREATEDEVICE_SHADERS_SECRET_BOOL "SDL.gpu.createdevice.shaders.secret"
|
||||
#define SDL_PROP_GPU_CREATEDEVICE_SHADERS_SPIRV_BOOL "SDL.gpu.createdevice.shaders.spirv"
|
||||
#define SDL_PROP_GPU_CREATEDEVICE_SHADERS_DXBC_BOOL "SDL.gpu.createdevice.shaders.dxbc"
|
||||
#define SDL_PROP_GPU_CREATEDEVICE_SHADERS_DXIL_BOOL "SDL.gpu.createdevice.shaders.dxil"
|
||||
#define SDL_PROP_GPU_CREATEDEVICE_SHADERS_MSL_BOOL "SDL.gpu.createdevice.shaders.msl"
|
||||
#define SDL_PROP_GPU_CREATEDEVICE_SHADERS_METALLIB_BOOL "SDL.gpu.createdevice.shaders.metallib"
|
||||
#define SDL_PROP_GPU_CREATEDEVICE_D3D12_SEMANTIC_NAME_STRING "SDL.gpu.createdevice.d3d12.semantic"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL "SDL.gpu.device.create.debugmode"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL "SDL.gpu.device.create.preferlowpower"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING "SDL.gpu.device.create.name"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SECRET_BOOL "SDL.gpu.device.create.shaders.secret"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL "SDL.gpu.device.create.shaders.spirv"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL "SDL.gpu.device.create.shaders.dxbc"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL "SDL.gpu.device.create.shaders.dxil"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL "SDL.gpu.device.create.shaders.msl"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL "SDL.gpu.device.create.shaders.metallib"
|
||||
#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING "SDL.gpu.device.create.d3d12.semantic"
|
||||
|
||||
/**
|
||||
* Destroys a GPU context previously returned by SDL_CreateGPUDevice.
|
||||
|
|
|
@ -400,26 +400,26 @@ SDL_GPUDevice *SDL_CreateGPUDevice(
|
|||
SDL_GPUDevice *result;
|
||||
SDL_PropertiesID props = SDL_CreateProperties();
|
||||
if (formatFlags & SDL_GPU_SHADERFORMAT_SECRET) {
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_SECRET_BOOL, SDL_TRUE);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SECRET_BOOL, SDL_TRUE);
|
||||
}
|
||||
if (formatFlags & SDL_GPU_SHADERFORMAT_SPIRV) {
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_SPIRV_BOOL, SDL_TRUE);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL, SDL_TRUE);
|
||||
}
|
||||
if (formatFlags & SDL_GPU_SHADERFORMAT_DXBC) {
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_DXBC_BOOL, SDL_TRUE);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL, SDL_TRUE);
|
||||
}
|
||||
if (formatFlags & SDL_GPU_SHADERFORMAT_DXIL) {
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_DXIL_BOOL, SDL_TRUE);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL, SDL_TRUE);
|
||||
}
|
||||
if (formatFlags & SDL_GPU_SHADERFORMAT_MSL) {
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_MSL_BOOL, SDL_TRUE);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL, SDL_TRUE);
|
||||
}
|
||||
if (formatFlags & SDL_GPU_SHADERFORMAT_METALLIB) {
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_METALLIB_BOOL, SDL_TRUE);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL, SDL_TRUE);
|
||||
}
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_DEBUGMODE_BOOL, debugMode);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_PREFERLOWPOWER_BOOL, preferLowPower);
|
||||
SDL_SetStringProperty(props, SDL_PROP_GPU_CREATEDEVICE_NAME_STRING, name);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, debugMode);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL, preferLowPower);
|
||||
SDL_SetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING, name);
|
||||
result = SDL_CreateGPUDeviceWithProperties(props);
|
||||
SDL_DestroyProperties(props);
|
||||
return result;
|
||||
|
@ -442,31 +442,31 @@ SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_SECRET_BOOL, SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SECRET_BOOL, SDL_FALSE)) {
|
||||
formatFlags |= SDL_GPU_SHADERFORMAT_SECRET;
|
||||
}
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_SPIRV_BOOL, SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL, SDL_FALSE)) {
|
||||
formatFlags |= SDL_GPU_SHADERFORMAT_SPIRV;
|
||||
}
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_DXBC_BOOL, SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL, SDL_FALSE)) {
|
||||
formatFlags |= SDL_GPU_SHADERFORMAT_DXBC;
|
||||
}
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_DXIL_BOOL, SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL, SDL_FALSE)) {
|
||||
formatFlags |= SDL_GPU_SHADERFORMAT_DXIL;
|
||||
}
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_MSL_BOOL, SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL, SDL_FALSE)) {
|
||||
formatFlags |= SDL_GPU_SHADERFORMAT_MSL;
|
||||
}
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_METALLIB_BOOL, SDL_FALSE)) {
|
||||
if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL, SDL_FALSE)) {
|
||||
formatFlags |= SDL_GPU_SHADERFORMAT_METALLIB;
|
||||
}
|
||||
|
||||
debugMode = SDL_GetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_DEBUGMODE_BOOL, SDL_TRUE);
|
||||
preferLowPower = SDL_GetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_PREFERLOWPOWER_BOOL, SDL_TRUE);
|
||||
debugMode = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, SDL_TRUE);
|
||||
preferLowPower = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL, SDL_TRUE);
|
||||
|
||||
gpudriver = SDL_GetHint(SDL_HINT_GPU_DRIVER);
|
||||
if (gpudriver == NULL) {
|
||||
gpudriver = SDL_GetStringProperty(props, SDL_PROP_GPU_CREATEDEVICE_NAME_STRING, NULL);
|
||||
gpudriver = SDL_GetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING, NULL);
|
||||
}
|
||||
|
||||
selectedBackend = SDL_GPUSelectBackend(_this, gpudriver, formatFlags);
|
||||
|
|
|
@ -8161,7 +8161,7 @@ static SDL_GPUDevice *D3D12_CreateDevice(SDL_bool debugMode, SDL_bool preferLowP
|
|||
|
||||
renderer->debugMode = debugMode;
|
||||
|
||||
renderer->semantic = SDL_GetStringProperty(props, SDL_PROP_GPU_CREATEDEVICE_D3D12_SEMANTIC_NAME_STRING, "TEXCOORD");
|
||||
renderer->semantic = SDL_GetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING, "TEXCOORD");
|
||||
|
||||
// Blit resources
|
||||
D3D12_INTERNAL_InitBlitResources(renderer);
|
||||
|
|
|
@ -1193,15 +1193,15 @@ static bool GPU_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_P
|
|||
goto error;
|
||||
}
|
||||
|
||||
bool debug = SDL_GetBooleanProperty(create_props, SDL_PROP_GPU_CREATEDEVICE_DEBUGMODE_BOOL, false);
|
||||
bool lowpower = SDL_GetBooleanProperty(create_props, SDL_PROP_GPU_CREATEDEVICE_PREFERLOWPOWER_BOOL, false);
|
||||
bool debug = SDL_GetBooleanProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, false);
|
||||
bool lowpower = SDL_GetBooleanProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL, false);
|
||||
|
||||
// Prefer environment variables/hints if they exist, otherwise defer to properties
|
||||
debug = SDL_GetHintBoolean(SDL_HINT_RENDER_GPU_DEBUG, debug);
|
||||
lowpower = SDL_GetHintBoolean(SDL_HINT_RENDER_GPU_LOW_POWER, lowpower);
|
||||
|
||||
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_CREATEDEVICE_DEBUGMODE_BOOL, debug);
|
||||
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_CREATEDEVICE_PREFERLOWPOWER_BOOL, lowpower);
|
||||
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, debug);
|
||||
SDL_SetBooleanProperty(create_props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL, lowpower);
|
||||
|
||||
GPU_FillSupportedShaderFormats(create_props);
|
||||
data->device = SDL_CreateGPUDeviceWithProperties(create_props);
|
||||
|
|
|
@ -232,10 +232,10 @@ SDL_GPUShader *GPU_GetFragmentShader(GPU_Shaders *shaders, GPU_FragmentShaderID
|
|||
|
||||
void GPU_FillSupportedShaderFormats(SDL_PropertiesID props)
|
||||
{
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_SPIRV_BOOL, HAVE_SPIRV_SHADERS);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_DXBC_BOOL, HAVE_DXBC50_SHADERS);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_DXIL_BOOL, HAVE_DXIL60_SHADERS);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_CREATEDEVICE_SHADERS_MSL_BOOL, HAVE_METAL_SHADERS);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL, HAVE_SPIRV_SHADERS);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL, HAVE_DXBC50_SHADERS);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL, HAVE_DXIL60_SHADERS);
|
||||
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL, HAVE_METAL_SHADERS);
|
||||
}
|
||||
|
||||
#endif // SDL_VIDEO_RENDER_GPU
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue