Skip to content

Commit

Permalink
Fix property naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
thatcosmonaut committed Jan 14, 2025
1 parent f13b936 commit c8cf555
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 40 deletions.
32 changes: 16 additions & 16 deletions include/SDL3/SDL_gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -2247,7 +2247,7 @@ extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUD
*
* There are optional properties that can be provided through `props`. These are the supported properties:
*
* - `SDL_PROP_GPU_CREATECOMPUTEPIPELINE_NAME_STRING`: a name that can be displayed in debugging tools.
* - `SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING`: a name that can be displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the compute pipeline to
Expand All @@ -2264,14 +2264,14 @@ extern SDL_DECLSPEC SDL_GPUComputePipeline *SDLCALL SDL_CreateGPUComputePipeline
SDL_GPUDevice *device,
const SDL_GPUComputePipelineCreateInfo *createinfo);

#define SDL_PROP_GPU_CREATECOMPUTEPIPELINE_NAME_STRING "SDL.gpu.createcomputepipeline.name"
#define SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING "SDL.gpu.computepipeline.create.name"

/**
* Creates a pipeline object to be used in a graphics workflow.
*
* There are optional properties that can be provided through `props`. These are the supported properties:
*
* - `SDL_PROP_GPU_CREATEGRAPHICSPIPELINE_NAME_STRING`: a name that can be displayed in debugging tools.
* - `SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING`: a name that can be displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the graphics pipeline to
Expand All @@ -2289,15 +2289,15 @@ extern SDL_DECLSPEC SDL_GPUGraphicsPipeline *SDLCALL SDL_CreateGPUGraphicsPipeli
SDL_GPUDevice *device,
const SDL_GPUGraphicsPipelineCreateInfo *createinfo);

#define SDL_PROP_GPU_CREATEGRAPHICSPIPELINE_NAME_STRING "SDL.gpu.creategraphicspipeline.name"
#define SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING "SDL.gpu.graphicspipeline.create.name"

/**
* Creates a sampler object to be used when binding textures in a graphics
* workflow.
*
* There are optional properties that can be provided through `props`. These are the supported properties:
*
* - `SDL_PROP_GPU_CREATESAMPLER_NAME_STRING`: a name that can be displayed in debugging tools.
* - `SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the sampler to create.
Expand All @@ -2314,7 +2314,7 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler(
SDL_GPUDevice *device,
const SDL_GPUSamplerCreateInfo *createinfo);

#define SDL_PROP_GPU_CREATESAMPLER_NAME_STRING "SDL.gpu.createsampler.name"
#define SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING "SDL.gpu.sampler.create.name"

/**
* Creates a shader to be used when creating a graphics pipeline.
Expand Down Expand Up @@ -2375,7 +2375,7 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler(
*
* There are optional properties that can be provided through `props`. These are the supported properties:
*
* - `SDL_PROP_GPU_CREATESHADER_NAME_STRING`: a name that can be displayed in debugging tools.
* - `SDL_PROP_GPU_SHADER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the shader to create.
Expand All @@ -2391,7 +2391,7 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader(
SDL_GPUDevice *device,
const SDL_GPUShaderCreateInfo *createinfo);

#define SDL_PROP_GPU_CREATESHADER_NAME_STRING "SDL.gpu.createshader.name"
#define SDL_PROP_GPU_SHADER_CREATE_NAME_STRING "SDL.gpu.shader.create.name"

/**
* Creates a texture object to be used in graphics or compute workflows.
Expand Down Expand Up @@ -2430,7 +2430,7 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader(
* - `SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8`: (Direct3D 12
* only) if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET,
* clear the texture to a stencil of this value. Defaults to zero.
* - `SDL_PROP_GPU_CREATETEXTURE_NAME_STRING`: a name that can be displayed in debugging tools.
* - `SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`: a name that can be displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the texture to create.
Expand Down Expand Up @@ -2460,7 +2460,7 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture(
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT "SDL.gpu.createtexture.d3d12.clear.a"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT "SDL.gpu.createtexture.d3d12.clear.depth"
#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8 "SDL.gpu.createtexture.d3d12.clear.stencil"
#define SDL_PROP_GPU_CREATETEXTURE_NAME_STRING "SDL.gpu.createtexture.name"
#define SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING "SDL.gpu.texture.create.name"

/**
* Creates a buffer object to be used in graphics or compute workflows.
Expand All @@ -2478,7 +2478,7 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture(
*
* There are optional properties that can be provided through `props`. These are the supported properties:
*
* - `SDL_PROP_GPU_CREATEBUFFER_NAME_STRING`: a name that can be displayed in debugging tools.
* - `SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the buffer to create.
Expand All @@ -2504,7 +2504,7 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer(
SDL_GPUDevice *device,
const SDL_GPUBufferCreateInfo *createinfo);

#define SDL_PROP_GPU_CREATEBUFFER_NAME_STRING "SDL.gpu.createbuffer.name"
#define SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING "SDL.gpu.buffer.create.name"

/**
* Creates a transfer buffer to be used when uploading to or downloading from
Expand All @@ -2515,7 +2515,7 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer(
*
* There are optional properties that can be provided through `props`. These are the supported properties:
*
* - `SDL_PROP_GPU_CREATETRANSFERBUFFER_NAME_STRING`: a name that can be displayed in debugging tools.
* - `SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING`: a name that can be displayed in debugging tools.
*
* \param device a GPU Context.
* \param createinfo a struct describing the state of the transfer buffer to
Expand All @@ -2535,14 +2535,14 @@ extern SDL_DECLSPEC SDL_GPUTransferBuffer *SDLCALL SDL_CreateGPUTransferBuffer(
SDL_GPUDevice *device,
const SDL_GPUTransferBufferCreateInfo *createinfo);

#define SDL_PROP_GPU_CREATETRANSFERBUFFER_NAME_STRING "SDL.gpu.createtransferbuffer.name"
#define SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING "SDL.gpu.transferbuffer.create.name"

/* Debug Naming */

/**
* Sets an arbitrary string constant to label a buffer.
*
* It is recommended to use SDL_PROP_GPU_CREATEBUFFER_NAME_STRING with SDL_CreateGPUBuffer instead of this function to avoid thread safety issues.
* It is recommended to use SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING with SDL_CreateGPUBuffer instead of this function to avoid thread safety issues.
*
* \param device a GPU Context.
* \param buffer a buffer to attach the name to.
Expand All @@ -2562,7 +2562,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBufferName(
/**
* Sets an arbitrary string constant to label a texture.
*
* It is recommended to use SDL_PROP_GPU_CREATETEXTURE_NAME_STRING with SDL_CreateGPUTexture instead of this function to avoid thread safety issues.
* It is recommended to use SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING with SDL_CreateGPUTexture instead of this function to avoid thread safety issues.
*
* \param device a GPU Context.
* \param texture a texture to attach the name to.
Expand Down
4 changes: 2 additions & 2 deletions src/gpu/SDL_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ SDL_GPUBuffer *SDL_CreateGPUBuffer(
return NULL;
}

const char *debugName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATEBUFFER_NAME_STRING, NULL);
const char *debugName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING, NULL);

return device->CreateBuffer(
device->driverData,
Expand All @@ -1074,7 +1074,7 @@ SDL_GPUTransferBuffer *SDL_CreateGPUTransferBuffer(
return NULL;
}

const char *debugName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATETRANSFERBUFFER_NAME_STRING, NULL);
const char *debugName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING, NULL);

return device->CreateTransferBuffer(
device->driverData,
Expand Down
8 changes: 4 additions & 4 deletions src/gpu/d3d12/SDL_gpu_d3d12.c
Original file line number Diff line number Diff line change
Expand Up @@ -2785,11 +2785,11 @@ static SDL_GPUComputePipeline *D3D12_CreateComputePipeline(
computePipeline->numUniformBuffers = createinfo->num_uniform_buffers;
SDL_SetAtomicInt(&computePipeline->referenceCount, 0);

if (renderer->debug_mode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_CREATECOMPUTEPIPELINE_NAME_STRING)) {
if (renderer->debug_mode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING)) {
D3D12_INTERNAL_SetPipelineStateName(
renderer,
computePipeline->pipelineState,
SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATECOMPUTEPIPELINE_NAME_STRING, NULL));
SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING, NULL));
}

return (SDL_GPUComputePipeline *)computePipeline;
Expand Down Expand Up @@ -3077,11 +3077,11 @@ static SDL_GPUGraphicsPipeline *D3D12_CreateGraphicsPipeline(

SDL_SetAtomicInt(&pipeline->referenceCount, 0);

if (renderer->debug_mode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_CREATEGRAPHICSPIPELINE_NAME_STRING)) {
if (renderer->debug_mode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING)) {
D3D12_INTERNAL_SetPipelineStateName(
renderer,
pipeline->pipelineState,
SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATEGRAPHICSPIPELINE_NAME_STRING, NULL));
SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING, NULL));
}

return (SDL_GPUGraphicsPipeline *)pipeline;
Expand Down
16 changes: 8 additions & 8 deletions src/gpu/metal/SDL_gpu_metal.m
Original file line number Diff line number Diff line change
Expand Up @@ -1046,8 +1046,8 @@ static void METAL_ReleaseGraphicsPipeline(
MTLComputePipelineDescriptor *descriptor = [MTLComputePipelineDescriptor new];
descriptor.computeFunction = libraryFunction.function;

if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_CREATECOMPUTEPIPELINE_NAME_STRING)) {
const char *name = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATECOMPUTEPIPELINE_NAME_STRING, NULL);
if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING)) {
const char *name = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING, NULL);
descriptor.label = @(name);
}

Expand Down Expand Up @@ -1191,8 +1191,8 @@ static void METAL_ReleaseGraphicsPipeline(
pipelineDescriptor.vertexDescriptor = vertexDescriptor;
}

if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_CREATEGRAPHICSPIPELINE_NAME_STRING)) {
const char *name = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATEGRAPHICSPIPELINE_NAME_STRING, NULL);
if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING)) {
const char *name = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING, NULL);
pipelineDescriptor.label = @(name);
}

Expand Down Expand Up @@ -1362,8 +1362,8 @@ static void METAL_PopDebugGroup(
samplerDesc.maxAnisotropy = (NSUInteger)((createinfo->enable_anisotropy) ? createinfo->max_anisotropy : 1);
samplerDesc.compareFunction = (createinfo->enable_compare) ? SDLToMetal_CompareOp[createinfo->compare_op] : MTLCompareFunctionAlways;

if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_CREATESAMPLER_NAME_STRING)) {
const char *name = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATESAMPLER_NAME_STRING, NULL);
if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING)) {
const char *name = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING, NULL);
samplerDesc.label = @(name);
}

Expand Down Expand Up @@ -1468,8 +1468,8 @@ static void METAL_PopDebugGroup(
metalTexture->handle = texture;
SDL_SetAtomicInt(&metalTexture->referenceCount, 0);

if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_CREATETEXTURE_NAME_STRING)) {
metalTexture->handle.label = @(SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATETEXTURE_NAME_STRING, NULL));
if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING)) {
metalTexture->handle.label = @(SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING, NULL));
}

return metalTexture;
Expand Down
16 changes: 8 additions & 8 deletions src/gpu/vulkan/SDL_gpu_vulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -6506,11 +6506,11 @@ static SDL_GPUGraphicsPipeline *VULKAN_CreateGraphicsPipeline(

SDL_SetAtomicInt(&graphicsPipeline->referenceCount, 0);

if (renderer->debugMode && renderer->supportsDebugUtils && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_CREATEGRAPHICSPIPELINE_NAME_STRING)) {
if (renderer->debugMode && renderer->supportsDebugUtils && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING)) {
VkDebugUtilsObjectNameInfoEXT nameInfo;
nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
nameInfo.pNext = NULL;
nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATEGRAPHICSPIPELINE_NAME_STRING, NULL);
nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING, NULL);
nameInfo.objectType = VK_OBJECT_TYPE_PIPELINE;
nameInfo.objectHandle = (uint64_t)graphicsPipeline->pipeline;

Expand Down Expand Up @@ -6600,11 +6600,11 @@ static SDL_GPUComputePipeline *VULKAN_CreateComputePipeline(

SDL_SetAtomicInt(&vulkanComputePipeline->referenceCount, 0);

if (renderer->debugMode && renderer->supportsDebugUtils && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_CREATECOMPUTEPIPELINE_NAME_STRING)) {
if (renderer->debugMode && renderer->supportsDebugUtils && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING)) {
VkDebugUtilsObjectNameInfoEXT nameInfo;
nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
nameInfo.pNext = NULL;
nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATECOMPUTEPIPELINE_NAME_STRING, NULL);
nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING, NULL);
nameInfo.objectType = VK_OBJECT_TYPE_PIPELINE;
nameInfo.objectHandle = (uint64_t)vulkanComputePipeline->pipeline;

Expand Down Expand Up @@ -6657,11 +6657,11 @@ static SDL_GPUSampler *VULKAN_CreateSampler(

SDL_SetAtomicInt(&vulkanSampler->referenceCount, 0);

if (renderer->debugMode && renderer->supportsDebugUtils && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_CREATESAMPLER_NAME_STRING)) {
if (renderer->debugMode && renderer->supportsDebugUtils && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING)) {
VkDebugUtilsObjectNameInfoEXT nameInfo;
nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
nameInfo.pNext = NULL;
nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATESAMPLER_NAME_STRING, NULL);
nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING, NULL);
nameInfo.objectType = VK_OBJECT_TYPE_SAMPLER;
nameInfo.objectHandle = (uint64_t)vulkanSampler->sampler;

Expand Down Expand Up @@ -6713,11 +6713,11 @@ static SDL_GPUShader *VULKAN_CreateShader(

SDL_SetAtomicInt(&vulkanShader->referenceCount, 0);

if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_CREATESHADER_NAME_STRING)) {
if (renderer->debugMode && SDL_HasProperty(createinfo->props, SDL_PROP_GPU_SHADER_CREATE_NAME_STRING)) {
VkDebugUtilsObjectNameInfoEXT nameInfo;
nameInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT;
nameInfo.pNext = NULL;
nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_CREATESHADER_NAME_STRING, NULL);
nameInfo.pObjectName = SDL_GetStringProperty(createinfo->props, SDL_PROP_GPU_SHADER_CREATE_NAME_STRING, NULL);
nameInfo.objectType = VK_OBJECT_TYPE_SHADER_MODULE;
nameInfo.objectHandle = (uint64_t)vulkanShader->shaderModule;

Expand Down
4 changes: 2 additions & 2 deletions test/testgpu_spinning_cube.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ init_render_state(int msaa)
buffer_desc.usage = SDL_GPU_BUFFERUSAGE_VERTEX;
buffer_desc.size = sizeof(vertex_data);
buffer_desc.props = SDL_CreateProperties();
SDL_SetStringProperty(buffer_desc.props, SDL_PROP_GPU_CREATEBUFFER_NAME_STRING, "космонавт");
SDL_SetStringProperty(buffer_desc.props, SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING, "космонавт");
render_state.buf_vertex = SDL_CreateGPUBuffer(
gpu_device,
&buffer_desc
Expand All @@ -550,7 +550,7 @@ init_render_state(int msaa)
transfer_buffer_desc.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
transfer_buffer_desc.size = sizeof(vertex_data);
transfer_buffer_desc.props = SDL_CreateProperties();
SDL_SetStringProperty(transfer_buffer_desc.props, SDL_PROP_GPU_CREATETRANSFERBUFFER_NAME_STRING, "Transfer Buffer");
SDL_SetStringProperty(transfer_buffer_desc.props, SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING, "Transfer Buffer");
buf_transfer = SDL_CreateGPUTransferBuffer(
gpu_device,
&transfer_buffer_desc
Expand Down

0 comments on commit c8cf555

Please sign in to comment.