mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-25 14:09:10 +00:00
Renamed SDL_GetGPUDeviceDebugProperties() to SDL_GetGPUDeviceProperties()
We may want to extend this with additional properties in the future. Also removed SDL_PROP_GPU_DEVICE_DEBUG_VULKAN_CONFORMANCE_STRING. If we need feature level queries we can add them in the future.
This commit is contained in:
parent
ca613b9d8f
commit
39a3b14dfe
9 changed files with 60 additions and 84 deletions
|
@ -2261,15 +2261,13 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGPUDeviceDriver(SDL_GPUDevice *d
|
|||
extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUDevice *device);
|
||||
|
||||
/**
|
||||
* Returns a property group containing read-only debug information associated
|
||||
* with this GPU context.
|
||||
* Get the properties associated with a GPU device.
|
||||
*
|
||||
* All properties are optionally provided and may differ between GPU backends
|
||||
* and SDL versions.
|
||||
* All properties are optional and may differ between GPU backends and SDL versions.
|
||||
*
|
||||
* The following properties are provided by SDL:
|
||||
*
|
||||
* ### `SDL_PROP_GPU_DEVICE_DEBUG_NAME_STRING`
|
||||
* ### `SDL_PROP_GPU_DEVICE_NAME_STRING`
|
||||
*
|
||||
* Contains the name of the underlying device as reported by the system
|
||||
* driver. This string has no standardized format, is highly inconsistent
|
||||
|
@ -2306,7 +2304,7 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD
|
|||
* of a translation interface, the device may be emulated in software, or the
|
||||
* string may contain generic text that does not identify the device at all.
|
||||
*
|
||||
* ### `SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_NAME_STRING`
|
||||
* ### `SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING`
|
||||
*
|
||||
* Contains the self-reported name of the underlying system driver.
|
||||
*
|
||||
|
@ -2319,11 +2317,11 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD
|
|||
* - Mali-G715
|
||||
* - venus
|
||||
*
|
||||
* ### `SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_VERSION_STRING`
|
||||
* ### `SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING`
|
||||
*
|
||||
* Contains the self-reported version of the underlying system driver. This is
|
||||
* a relatively short version string in an unspecified format. If
|
||||
* SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_INFO_STRING is available then that
|
||||
* SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING is available then that
|
||||
* property should be preferred over this one as it may contain additional
|
||||
* information that is useful for identifying the exact driver version used.
|
||||
*
|
||||
|
@ -2333,12 +2331,12 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD
|
|||
* - 0.405.2463
|
||||
* - 32.0.15.6614
|
||||
*
|
||||
* ### `SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_INFO_STRING`
|
||||
* ### `SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING`
|
||||
*
|
||||
* Contains the detailed version information of the underlying system driver
|
||||
* as reported by the driver. This is an arbitrary string with no standardized
|
||||
* format and it may contain newlines. This property should be preferred over
|
||||
* SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_VERSION_STRING if it is available as it
|
||||
* SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING if it is available as it
|
||||
* usually contains the same information but in a format that is easier to
|
||||
* read.
|
||||
*
|
||||
|
@ -2359,35 +2357,17 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD
|
|||
* Driver Branch: promo490_3_Google
|
||||
* ```
|
||||
*
|
||||
* ### `SDL_PROP_GPU_DEVICE_DEBUG_VULKAN_CONFORMANCE_STRING`
|
||||
*
|
||||
* When using the Vulkan backend, contains the highest Vulkan version number
|
||||
* that the system driver claims that the underlying hardware conforms to.
|
||||
* This is self-reported and may not be truthful.
|
||||
*
|
||||
* Strings that have been found in the wild include:
|
||||
*
|
||||
* - 0.0.0.0
|
||||
* - 1.0.0.0
|
||||
* - 1.3.8.2
|
||||
*
|
||||
* \param device a GPU context to query.
|
||||
* \returns a valid property ID or 0. A value of 0 indicates that no
|
||||
* properties are available and is not an error. The returned
|
||||
* property group is owned by SDL and has the same lifetime as the
|
||||
* containing context. It should not be destroyed manually when no
|
||||
* longer needed.
|
||||
* \returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information.
|
||||
*
|
||||
* \since This function is available since SDL 3.4.0.
|
||||
*/
|
||||
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetGPUDeviceDebugProperties(
|
||||
SDL_GPUDevice *device);
|
||||
extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetGPUDeviceProperties(SDL_GPUDevice *device);
|
||||
|
||||
#define SDL_PROP_GPU_DEVICE_DEBUG_NAME_STRING "SDL.gpu.device.debug.name"
|
||||
#define SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_NAME_STRING "SDL.gpu.device.debug.driver_name"
|
||||
#define SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_VERSION_STRING "SDL.gpu.device.debug.driver_version"
|
||||
#define SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_INFO_STRING "SDL.gpu.device.debug.driver_info"
|
||||
#define SDL_PROP_GPU_DEVICE_DEBUG_VULKAN_CONFORMANCE_STRING "SDL.gpu.device.debug.vulkan.conformance"
|
||||
#define SDL_PROP_GPU_DEVICE_NAME_STRING "SDL.gpu.device.name"
|
||||
#define SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING "SDL.gpu.device.driver_name"
|
||||
#define SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING "SDL.gpu.device.driver_version"
|
||||
#define SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING "SDL.gpu.device.driver_info"
|
||||
|
||||
/* State Creation */
|
||||
|
||||
|
|
|
@ -1248,7 +1248,7 @@ SDL3_0.0.0 {
|
|||
SDL_GetWindowProgressValue;
|
||||
SDL_SetRenderTextureAddressMode;
|
||||
SDL_GetRenderTextureAddressMode;
|
||||
SDL_GetGPUDeviceDebugProperties;
|
||||
SDL_GetGPUDeviceProperties;
|
||||
# extra symbols go here (don't modify this line)
|
||||
local: *;
|
||||
};
|
||||
|
|
|
@ -1273,4 +1273,4 @@
|
|||
#define SDL_GetWindowProgressValue SDL_GetWindowProgressValue_REAL
|
||||
#define SDL_SetRenderTextureAddressMode SDL_SetRenderTextureAddressMode_REAL
|
||||
#define SDL_GetRenderTextureAddressMode SDL_GetRenderTextureAddressMode_REAL
|
||||
#define SDL_GetGPUDeviceDebugProperties SDL_GetGPUDeviceDebugProperties_REAL
|
||||
#define SDL_GetGPUDeviceProperties SDL_GetGPUDeviceProperties_REAL
|
||||
|
|
|
@ -1281,4 +1281,4 @@ SDL_DYNAPI_PROC(SDL_ProgressState,SDL_GetWindowProgressState,(SDL_Window *a),(a)
|
|||
SDL_DYNAPI_PROC(float,SDL_GetWindowProgressValue,(SDL_Window *a),(a),return)
|
||||
SDL_DYNAPI_PROC(bool,SDL_SetRenderTextureAddressMode,(SDL_Renderer *a,SDL_TextureAddressMode b,SDL_TextureAddressMode c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(bool,SDL_GetRenderTextureAddressMode,(SDL_Renderer *a,SDL_TextureAddressMode *b,SDL_TextureAddressMode *c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetGPUDeviceDebugProperties,(SDL_GPUDevice *a),(a),return)
|
||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetGPUDeviceProperties,(SDL_GPUDevice *a),(a),return)
|
||||
|
|
|
@ -586,11 +586,11 @@ SDL_GPUShaderFormat SDL_GetGPUShaderFormats(SDL_GPUDevice *device)
|
|||
return device->shader_formats;
|
||||
}
|
||||
|
||||
SDL_PropertiesID SDL_GetGPUDeviceDebugProperties(SDL_GPUDevice *device)
|
||||
SDL_PropertiesID SDL_GetGPUDeviceProperties(SDL_GPUDevice *device)
|
||||
{
|
||||
CHECK_DEVICE_MAGIC(device, 0);
|
||||
|
||||
return device->GetDeviceDebugProperties(device);
|
||||
return device->GetDeviceProperties(device);
|
||||
}
|
||||
|
||||
Uint32 SDL_GPUTextureFormatTexelBlockSize(
|
||||
|
|
|
@ -463,7 +463,7 @@ struct SDL_GPUDevice
|
|||
|
||||
void (*DestroyDevice)(SDL_GPUDevice *device);
|
||||
|
||||
SDL_PropertiesID (*GetDeviceDebugProperties)(SDL_GPUDevice *device);
|
||||
SDL_PropertiesID (*GetDeviceProperties)(SDL_GPUDevice *device);
|
||||
|
||||
// State Creation
|
||||
|
||||
|
@ -896,7 +896,7 @@ struct SDL_GPUDevice
|
|||
result->func = name##_##func;
|
||||
#define ASSIGN_DRIVER(name) \
|
||||
ASSIGN_DRIVER_FUNC(DestroyDevice, name) \
|
||||
ASSIGN_DRIVER_FUNC(GetDeviceDebugProperties, name) \
|
||||
ASSIGN_DRIVER_FUNC(GetDeviceProperties, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateComputePipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateGraphicsPipeline, name) \
|
||||
ASSIGN_DRIVER_FUNC(CreateSampler, name) \
|
||||
|
|
|
@ -765,7 +765,7 @@ struct D3D12Renderer
|
|||
// FIXME: these might not be necessary since we're not using custom heaps
|
||||
bool UMA;
|
||||
bool UMACacheCoherent;
|
||||
SDL_PropertiesID debugProps;
|
||||
SDL_PropertiesID props;
|
||||
Uint32 allowedFramesInFlight;
|
||||
|
||||
// Indirect command signatures
|
||||
|
@ -1536,7 +1536,7 @@ static void D3D12_INTERNAL_DestroyRenderer(D3D12Renderer *renderer)
|
|||
SDL_free(renderer->graphicsPipelinesToDestroy);
|
||||
SDL_free(renderer->computePipelinesToDestroy);
|
||||
|
||||
SDL_DestroyProperties(renderer->debugProps);
|
||||
SDL_DestroyProperties(renderer->props);
|
||||
|
||||
// Tear down D3D12 objects
|
||||
if (renderer->indirectDrawCommandSignature) {
|
||||
|
@ -1625,10 +1625,10 @@ static void D3D12_DestroyDevice(SDL_GPUDevice *device)
|
|||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_PropertiesID D3D12_GetDeviceDebugProperties(SDL_GPUDevice *device)
|
||||
static SDL_PropertiesID D3D12_GetDeviceProperties(SDL_GPUDevice *device)
|
||||
{
|
||||
D3D12Renderer *renderer = (D3D12Renderer *)device->driverData;
|
||||
return renderer->debugProps;
|
||||
return renderer->props;
|
||||
}
|
||||
|
||||
// Barriers
|
||||
|
@ -8626,7 +8626,7 @@ static SDL_GPUDevice *D3D12_CreateDevice(bool debugMode, bool preferLowPower, SD
|
|||
CHECK_D3D12_ERROR_AND_RETURN("Could not get adapter driver version", NULL);
|
||||
}
|
||||
|
||||
renderer->debugProps = SDL_CreateProperties();
|
||||
renderer->props = SDL_CreateProperties();
|
||||
if (verboseLogs) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_GPU, "SDL_GPU Driver: D3D12");
|
||||
}
|
||||
|
@ -8634,8 +8634,8 @@ static SDL_GPUDevice *D3D12_CreateDevice(bool debugMode, bool preferLowPower, SD
|
|||
// Record device name
|
||||
char *deviceName = SDL_iconv_wchar_utf8(&adapterDesc.Description[0]);
|
||||
SDL_SetStringProperty(
|
||||
renderer->debugProps,
|
||||
SDL_PROP_GPU_DEVICE_DEBUG_NAME_STRING,
|
||||
renderer->props,
|
||||
SDL_PROP_GPU_DEVICE_NAME_STRING,
|
||||
deviceName);
|
||||
if (verboseLogs) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_GPU, "D3D12 Adapter: %s", deviceName);
|
||||
|
@ -8653,8 +8653,8 @@ static SDL_GPUDevice *D3D12_CreateDevice(bool debugMode, bool preferLowPower, SD
|
|||
HIWORD(umdVersion.LowPart),
|
||||
LOWORD(umdVersion.LowPart));
|
||||
SDL_SetStringProperty(
|
||||
renderer->debugProps,
|
||||
SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_VERSION_STRING,
|
||||
renderer->props,
|
||||
SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING,
|
||||
driverVer);
|
||||
if (verboseLogs) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_GPU, "D3D12 Driver: %s", driverVer);
|
||||
|
|
|
@ -643,7 +643,7 @@ struct MetalRenderer
|
|||
id<MTLCommandQueue> queue;
|
||||
|
||||
bool debugMode;
|
||||
SDL_PropertiesID debugProps;
|
||||
SDL_PropertiesID props;
|
||||
Uint32 allowedFramesInFlight;
|
||||
|
||||
MetalWindowData **claimedWindows;
|
||||
|
@ -766,18 +766,18 @@ static void METAL_DestroyDevice(SDL_GPUDevice *device)
|
|||
// Release the command queue
|
||||
renderer->queue = nil;
|
||||
|
||||
// Release debug properties
|
||||
SDL_DestroyProperties(renderer->debugProps);
|
||||
// Release properties
|
||||
SDL_DestroyProperties(renderer->props);
|
||||
|
||||
// Free the primary structures
|
||||
SDL_free(renderer);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
static SDL_PropertiesID METAL_GetDeviceDebugProperties(SDL_GPUDevice *device)
|
||||
static SDL_PropertiesID METAL_GetDeviceProperties(SDL_GPUDevice *device)
|
||||
{
|
||||
MetalRenderer *renderer = (MetalRenderer *)device->driverData;
|
||||
return renderer->debugProps;
|
||||
return renderer->props;
|
||||
}
|
||||
|
||||
// Resource tracking
|
||||
|
@ -4512,7 +4512,7 @@ static SDL_GPUDevice *METAL_CreateDevice(bool debugMode, bool preferLowPower, SD
|
|||
renderer->device = device;
|
||||
renderer->queue = [device newCommandQueue];
|
||||
|
||||
renderer->debugProps = SDL_CreateProperties();
|
||||
renderer->props = SDL_CreateProperties();
|
||||
if (verboseLogs) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_GPU, "SDL_GPU Driver: Metal");
|
||||
}
|
||||
|
@ -4520,8 +4520,8 @@ static SDL_GPUDevice *METAL_CreateDevice(bool debugMode, bool preferLowPower, SD
|
|||
// Record device name
|
||||
const char *deviceName = [device.name UTF8String];
|
||||
SDL_SetStringProperty(
|
||||
renderer->debugProps,
|
||||
SDL_PROP_GPU_DEVICE_DEBUG_NAME_STRING,
|
||||
renderer->props,
|
||||
SDL_PROP_GPU_DEVICE_NAME_STRING,
|
||||
deviceName);
|
||||
if (verboseLogs) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_GPU, "Metal Device: %s", deviceName);
|
||||
|
|
|
@ -1096,7 +1096,7 @@ struct VulkanRenderer
|
|||
|
||||
bool debugMode;
|
||||
bool preferLowPower;
|
||||
SDL_PropertiesID debugProps;
|
||||
SDL_PropertiesID props;
|
||||
Uint32 allowedFramesInFlight;
|
||||
|
||||
VulkanExtensions supports;
|
||||
|
@ -4918,18 +4918,18 @@ static void VULKAN_DestroyDevice(
|
|||
renderer->vkDestroyDevice(renderer->logicalDevice, NULL);
|
||||
renderer->vkDestroyInstance(renderer->instance, NULL);
|
||||
|
||||
SDL_DestroyProperties(renderer->debugProps);
|
||||
SDL_DestroyProperties(renderer->props);
|
||||
|
||||
SDL_free(renderer);
|
||||
SDL_free(device);
|
||||
SDL_Vulkan_UnloadLibrary();
|
||||
}
|
||||
|
||||
static SDL_PropertiesID VULKAN_GetDeviceDebugProperties(
|
||||
static SDL_PropertiesID VULKAN_GetDeviceProperties(
|
||||
SDL_GPUDevice *device)
|
||||
{
|
||||
VulkanRenderer *renderer = (VulkanRenderer *)device->driverData;
|
||||
return renderer->debugProps;
|
||||
return renderer->props;
|
||||
}
|
||||
|
||||
static DescriptorSetCache *VULKAN_INTERNAL_AcquireDescriptorSetCache(
|
||||
|
@ -11600,7 +11600,7 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S
|
|||
SET_STRING_ERROR_AND_RETURN("Failed to initialize Vulkan!", NULL);
|
||||
}
|
||||
|
||||
renderer->debugProps = SDL_CreateProperties();
|
||||
renderer->props = SDL_CreateProperties();
|
||||
if (verboseLogs) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_GPU, "SDL_GPU Driver: Vulkan");
|
||||
}
|
||||
|
@ -11608,8 +11608,8 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S
|
|||
// Record device name
|
||||
const char *deviceName = renderer->physicalDeviceProperties.properties.deviceName;
|
||||
SDL_SetStringProperty(
|
||||
renderer->debugProps,
|
||||
SDL_PROP_GPU_DEVICE_DEBUG_NAME_STRING,
|
||||
renderer->props,
|
||||
SDL_PROP_GPU_DEVICE_NAME_STRING,
|
||||
deviceName);
|
||||
if (verboseLogs) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_GPU, "Vulkan Device: %s", deviceName);
|
||||
|
@ -11659,8 +11659,8 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S
|
|||
rawDriverVer & 0xfff);
|
||||
}
|
||||
SDL_SetStringProperty(
|
||||
renderer->debugProps,
|
||||
SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_VERSION_STRING,
|
||||
renderer->props,
|
||||
SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING,
|
||||
driverVer);
|
||||
// Log this only if VK_KHR_driver_properties is not available.
|
||||
|
||||
|
@ -11669,12 +11669,12 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S
|
|||
const char *driverName = renderer->physicalDeviceDriverProperties.driverName;
|
||||
const char *driverInfo = renderer->physicalDeviceDriverProperties.driverInfo;
|
||||
SDL_SetStringProperty(
|
||||
renderer->debugProps,
|
||||
SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_NAME_STRING,
|
||||
renderer->props,
|
||||
SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING,
|
||||
driverName);
|
||||
SDL_SetStringProperty(
|
||||
renderer->debugProps,
|
||||
SDL_PROP_GPU_DEVICE_DEBUG_DRIVER_INFO_STRING,
|
||||
renderer->props,
|
||||
SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING,
|
||||
driverInfo);
|
||||
if (verboseLogs) {
|
||||
// FIXME: driverInfo can be a multiline string.
|
||||
|
@ -11682,20 +11682,16 @@ static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, S
|
|||
}
|
||||
|
||||
// Record conformance level
|
||||
char conformance[64];
|
||||
(void)SDL_snprintf(
|
||||
conformance,
|
||||
SDL_arraysize(conformance),
|
||||
"%u.%u.%u.%u",
|
||||
renderer->physicalDeviceDriverProperties.conformanceVersion.major,
|
||||
renderer->physicalDeviceDriverProperties.conformanceVersion.minor,
|
||||
renderer->physicalDeviceDriverProperties.conformanceVersion.subminor,
|
||||
renderer->physicalDeviceDriverProperties.conformanceVersion.patch);
|
||||
SDL_SetStringProperty(
|
||||
renderer->debugProps,
|
||||
SDL_PROP_GPU_DEVICE_DEBUG_VULKAN_CONFORMANCE_STRING,
|
||||
conformance);
|
||||
if (verboseLogs) {
|
||||
char conformance[64];
|
||||
(void)SDL_snprintf(
|
||||
conformance,
|
||||
SDL_arraysize(conformance),
|
||||
"%u.%u.%u.%u",
|
||||
renderer->physicalDeviceDriverProperties.conformanceVersion.major,
|
||||
renderer->physicalDeviceDriverProperties.conformanceVersion.minor,
|
||||
renderer->physicalDeviceDriverProperties.conformanceVersion.subminor,
|
||||
renderer->physicalDeviceDriverProperties.conformanceVersion.patch);
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_GPU, "Vulkan Conformance: %s", conformance);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue