Skip to content

Commit 2844ec5

Browse files
committed
transfer buffers specify upload or download usage
1 parent ba814c8 commit 2844ec5

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

include/SDL3/SDL_gpu.h

+8-2
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ typedef enum SDL_GpuBufferUsageFlagBits
177177

178178
typedef Uint32 SDL_GpuBufferUsageFlags;
179179

180+
typedef enum SDL_GpuTransferBufferUsage
181+
{
182+
SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD,
183+
SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD
184+
} SDL_GpuTransferBufferUsage;
185+
180186
typedef enum SDL_GpuShaderStage
181187
{
182188
SDL_GPU_SHADERSTAGE_VERTEX,
@@ -936,7 +942,7 @@ extern SDL_DECLSPEC SDL_GpuBuffer *SDLCALL SDL_GpuCreateBuffer(
936942
* Creates a transfer buffer to be used when uploading to or downloading from graphics resources.
937943
*
938944
* \param device a GPU Context
939-
* \param uploadOnly specifies that the transfer buffer will only be used for uploads, allows optimizations on certain backends
945+
* \param usage whether the transfer buffer will be used for uploads or downloads
940946
* \param sizeInBytes the size of the transfer buffer
941947
* \returns a transfer buffer on success, or NULL on failure
942948
*
@@ -950,7 +956,7 @@ extern SDL_DECLSPEC SDL_GpuBuffer *SDLCALL SDL_GpuCreateBuffer(
950956
*/
951957
extern SDL_DECLSPEC SDL_GpuTransferBuffer *SDLCALL SDL_GpuCreateTransferBuffer(
952958
SDL_GpuDevice *device,
953-
SDL_bool uploadOnly,
959+
SDL_GpuTransferBufferUsage usage,
954960
Uint32 sizeInBytes);
955961

956962
/* Debug Naming */

src/dynapi/SDL_dynapi_procs.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,7 @@ SDL_DYNAPI_PROC(SDL_GpuSampler*,SDL_GpuCreateSampler,(SDL_GpuDevice *a, SDL_GpuS
10601060
SDL_DYNAPI_PROC(SDL_GpuShader*,SDL_GpuCreateShader,(SDL_GpuDevice *a, SDL_GpuShaderCreateInfo *b),(a,b),return)
10611061
SDL_DYNAPI_PROC(SDL_GpuTexture*,SDL_GpuCreateTexture,(SDL_GpuDevice *a, SDL_GpuTextureCreateInfo *b),(a,b),return)
10621062
SDL_DYNAPI_PROC(SDL_GpuBuffer*,SDL_GpuCreateBuffer,(SDL_GpuDevice *a, SDL_GpuBufferUsageFlags b, Uint32 c),(a,b,c),return)
1063-
SDL_DYNAPI_PROC(SDL_GpuTransferBuffer*,SDL_GpuCreateTransferBuffer,(SDL_GpuDevice *a, SDL_bool b, Uint32 c),(a,b,c),return)
1063+
SDL_DYNAPI_PROC(SDL_GpuTransferBuffer*,SDL_GpuCreateTransferBuffer,(SDL_GpuDevice *a, SDL_GpuTransferBufferUsage b, Uint32 c),(a,b,c),return)
10641064
SDL_DYNAPI_PROC(void,SDL_GpuSetBufferName,(SDL_GpuDevice *a, SDL_GpuBuffer *b, const char *c),(a,b,c),)
10651065
SDL_DYNAPI_PROC(void,SDL_GpuSetTextureName,(SDL_GpuDevice *a, SDL_GpuTexture *b, const char *c),(a,b,c),)
10661066
SDL_DYNAPI_PROC(void,SDL_GpuSetStringMarker,(SDL_GpuCommandBuffer *a, const char *b),(a,b),)

src/gpu/SDL_gpu.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,13 @@ SDL_GpuBuffer *SDL_GpuCreateBuffer(
444444

445445
SDL_GpuTransferBuffer *SDL_GpuCreateTransferBuffer(
446446
SDL_GpuDevice *device,
447-
SDL_bool uploadOnly,
447+
SDL_GpuTransferBufferUsage usage,
448448
Uint32 sizeInBytes)
449449
{
450450
NULL_ASSERT(device)
451451
return device->CreateTransferBuffer(
452452
device->driverData,
453-
uploadOnly,
453+
usage,
454454
sizeInBytes);
455455
}
456456

src/gpu/SDL_gpu_driver.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ struct SDL_GpuDevice
231231

232232
SDL_GpuTransferBuffer *(*CreateTransferBuffer)(
233233
SDL_GpuRenderer *driverData,
234-
SDL_bool uploadOnly,
234+
SDL_GpuTransferBufferUsage usage,
235235
Uint32 sizeInBytes);
236236

237237
/* Debug Naming */

src/gpu/vulkan/SDL_gpu_vulkan.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6766,7 +6766,7 @@ static VulkanUniformBuffer *VULKAN_INTERNAL_CreateUniformBuffer(
67666766

67676767
static SDL_GpuTransferBuffer *VULKAN_CreateTransferBuffer(
67686768
SDL_GpuRenderer *driverData,
6769-
SDL_bool uploadOnly, /* ignored on Vulkan */
6769+
SDL_GpuTransferBufferUsage usage, /* ignored on Vulkan */
67706770
Uint32 sizeInBytes)
67716771
{
67726772
return (SDL_GpuTransferBuffer *)VULKAN_INTERNAL_CreateBufferContainer(

0 commit comments

Comments
 (0)