From 5518aca0546b842bc2ad29a41c5dfd26a02e3e72 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 29 Aug 2024 18:45:30 -0700
Subject: [PATCH] Use stdbool internally in SDL
---
src/audio/SDL_audio.c | 2 +-
src/file/SDL_iostream.c | 4 +-
src/gpu/SDL_gpu.c | 152 +++++------
src/gpu/SDL_sysgpu.h | 62 ++---
src/gpu/d3d11/SDL_gpu_d3d11.c | 238 ++++++++--------
src/gpu/d3d12/SDL_gpu_d3d12.c | 378 +++++++++++++-------------
src/gpu/metal/SDL_gpu_metal.m | 188 ++++++-------
src/gpu/vulkan/SDL_gpu_vulkan.c | 366 ++++++++++++-------------
src/thread/windows/SDL_syssem.c | 2 +-
src/video/SDL_pixels.c | 2 +-
src/video/android/SDL_androidwindow.c | 4 +-
11 files changed, 699 insertions(+), 699 deletions(-)
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index e50170583a499..86478ac178629 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -1897,7 +1897,7 @@ SDL_bool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams
SDL_AudioStream *stream = streams[i];
if (!stream) {
SDL_SetError("Stream #%d is NULL", i);
- result = false; // to pacify the static analyzer, that doesn't realize SDL_SetError() always returns SDL_FALSE.
+ result = false; // to pacify the static analyzer, that doesn't realize SDL_SetError() always returns false.
} else {
SDL_LockMutex(stream->lock);
SDL_assert((stream->bound_device == NULL) == ((stream->prev_binding == NULL) || (stream->next_binding == NULL)));
diff --git a/src/file/SDL_iostream.c b/src/file/SDL_iostream.c
index 0ec5ef5f66968..7c04e65a685c8 100644
--- a/src/file/SDL_iostream.c
+++ b/src/file/SDL_iostream.c
@@ -286,7 +286,7 @@ static SDL_bool SDLCALL windows_file_close(void *userdata)
}
SDL_free(iodata->data);
SDL_free(iodata);
- return SDL_TRUE;
+ return true;
}
#endif // defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
@@ -514,7 +514,7 @@ static size_t SDLCALL mem_write(void *userdata, const void *ptr, size_t size, SD
static SDL_bool SDLCALL mem_close(void *userdata)
{
SDL_free(userdata);
- return SDL_TRUE;
+ return true;
}
// Functions to create SDL_IOStream structures from various data sources
diff --git a/src/gpu/SDL_gpu.c b/src/gpu/SDL_gpu.c
index 71a3f38d26901..0c63b9d33dc2e 100644
--- a/src/gpu/SDL_gpu.c
+++ b/src/gpu/SDL_gpu.c
@@ -176,7 +176,7 @@ SDL_GPUGraphicsPipeline *SDL_GPU_FetchBlitPipeline(
blitPipelineCreateInfo.attachmentInfo.colorAttachmentDescriptions = &colorAttachmentDesc;
blitPipelineCreateInfo.attachmentInfo.colorAttachmentCount = 1;
blitPipelineCreateInfo.attachmentInfo.depthStencilFormat = SDL_GPU_TEXTUREFORMAT_D16_UNORM; // arbitrary
- blitPipelineCreateInfo.attachmentInfo.hasDepthStencilAttachment = SDL_FALSE;
+ blitPipelineCreateInfo.attachmentInfo.hasDepthStencilAttachment = false;
blitPipelineCreateInfo.vertexShader = blitVertexShader;
if (sourceTextureType == SDL_GPU_TEXTURETYPE_CUBE) {
@@ -230,7 +230,7 @@ void SDL_GPU_BlitCommon(
SDL_GPUBlitRegion *destination,
SDL_FlipMode flipMode,
SDL_GPUFilter filterMode,
- SDL_bool cycle,
+ bool cycle,
SDL_GPUSampler *blitLinearSampler,
SDL_GPUSampler *blitNearestSampler,
SDL_GPUShader *blitVertexShader,
@@ -399,22 +399,22 @@ SDL_GPUDevice *SDL_CreateGPUDevice(
SDL_GPUDevice *result;
SDL_PropertiesID props = SDL_CreateProperties();
if (formatFlags & SDL_GPU_SHADERFORMAT_SECRET) {
- SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SECRET_BOOL, SDL_TRUE);
+ SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SECRET_BOOL, true);
}
if (formatFlags & SDL_GPU_SHADERFORMAT_SPIRV) {
- SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL, SDL_TRUE);
+ SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL, true);
}
if (formatFlags & SDL_GPU_SHADERFORMAT_DXBC) {
- SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL, SDL_TRUE);
+ SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL, true);
}
if (formatFlags & SDL_GPU_SHADERFORMAT_DXIL) {
- SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL, SDL_TRUE);
+ SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL, true);
}
if (formatFlags & SDL_GPU_SHADERFORMAT_MSL) {
- SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL, SDL_TRUE);
+ SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL, true);
}
if (formatFlags & SDL_GPU_SHADERFORMAT_METALLIB) {
- SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL, SDL_TRUE);
+ SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL, true);
}
SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, debugMode);
SDL_SetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING, name);
@@ -426,8 +426,8 @@ SDL_GPUDevice *SDL_CreateGPUDevice(
SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props)
{
SDL_GPUShaderFormat formatFlags = 0;
- SDL_bool debugMode;
- SDL_bool preferLowPower;
+ bool debugMode;
+ bool preferLowPower;
int i;
const char *gpudriver;
@@ -440,27 +440,27 @@ SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props)
return NULL;
}
- if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SECRET_BOOL, SDL_FALSE)) {
+ if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SECRET_BOOL, false)) {
formatFlags |= SDL_GPU_SHADERFORMAT_SECRET;
}
- if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL, SDL_FALSE)) {
+ if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL, false)) {
formatFlags |= SDL_GPU_SHADERFORMAT_SPIRV;
}
- if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL, SDL_FALSE)) {
+ if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL, false)) {
formatFlags |= SDL_GPU_SHADERFORMAT_DXBC;
}
- if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL, SDL_FALSE)) {
+ if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL, false)) {
formatFlags |= SDL_GPU_SHADERFORMAT_DXIL;
}
- if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL, SDL_FALSE)) {
+ if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL, false)) {
formatFlags |= SDL_GPU_SHADERFORMAT_MSL;
}
- if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL, SDL_FALSE)) {
+ if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL, false)) {
formatFlags |= SDL_GPU_SHADERFORMAT_METALLIB;
}
- 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_FALSE);
+ debugMode = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, true);
+ preferLowPower = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL, false);
gpudriver = SDL_GetHint(SDL_HINT_GPU_DRIVER);
if (gpudriver == NULL) {
@@ -552,10 +552,10 @@ SDL_bool SDL_SupportsGPUTextureFormat(
SDL_GPUTextureType type,
SDL_GPUTextureUsageFlags usage)
{
- CHECK_DEVICE_MAGIC(device, SDL_FALSE);
+ CHECK_DEVICE_MAGIC(device, false);
if (device->debugMode) {
- CHECK_TEXTUREFORMAT_ENUM_INVALID(format, SDL_FALSE)
+ CHECK_TEXTUREFORMAT_ENUM_INVALID(format, false)
}
return device->SupportsTextureFormat(
@@ -701,7 +701,7 @@ SDL_GPUTexture *SDL_CreateGPUTexture(
}
if (device->debugMode) {
- SDL_bool failed = SDL_FALSE;
+ bool failed = false;
const Uint32 MAX_2D_DIMENSION = 16384;
const Uint32 MAX_3D_DIMENSION = 2048;
@@ -711,86 +711,86 @@ SDL_GPUTexture *SDL_CreateGPUTexture(
if (textureCreateInfo->width <= 0 || textureCreateInfo->height <= 0 || textureCreateInfo->layerCountOrDepth <= 0) {
SDL_assert_release(!"For any texture: width, height, and layerCountOrDepth must be >= 1");
- failed = SDL_TRUE;
+ failed = true;
}
if (textureCreateInfo->levelCount <= 0) {
SDL_assert_release(!"For any texture: levelCount must be >= 1");
- failed = SDL_TRUE;
+ failed = true;
}
if ((textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ_BIT) && (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT)) {
SDL_assert_release(!"For any texture: usageFlags cannot contain both GRAPHICS_STORAGE_READ_BIT and SAMPLER_BIT");
- failed = SDL_TRUE;
+ failed = true;
}
if (IsDepthFormat(textureCreateInfo->format) && (textureCreateInfo->usageFlags & ~(SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT | SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT))) {
SDL_assert_release(!"For depth textures: usageFlags cannot contain any flags except for DEPTH_STENCIL_TARGET_BIT and SAMPLER_BIT");
- failed = SDL_TRUE;
+ failed = true;
}
if (IsIntegerFormat(textureCreateInfo->format) && (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT)) {
SDL_assert_release(!"For any texture: usageFlags cannot contain SAMPLER_BIT for textures with an integer format");
- failed = SDL_TRUE;
+ failed = true;
}
if (textureCreateInfo->type == SDL_GPU_TEXTURETYPE_CUBE) {
// Cubemap validation
if (textureCreateInfo->width != textureCreateInfo->height) {
SDL_assert_release(!"For cube textures: width and height must be identical");
- failed = SDL_TRUE;
+ failed = true;
}
if (textureCreateInfo->width > MAX_2D_DIMENSION || textureCreateInfo->height > MAX_2D_DIMENSION) {
SDL_assert_release(!"For cube textures: width and height must be <= 16384");
- failed = SDL_TRUE;
+ failed = true;
}
if (textureCreateInfo->layerCountOrDepth != 6) {
SDL_assert_release(!"For cube textures: layerCountOrDepth must be 6");
- failed = SDL_TRUE;
+ failed = true;
}
if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1) {
SDL_assert_release(!"For cube textures: sampleCount must be SDL_GPU_SAMPLECOUNT_1");
- failed = SDL_TRUE;
+ failed = true;
}
if (!SDL_SupportsGPUTextureFormat(device, textureCreateInfo->format, SDL_GPU_TEXTURETYPE_CUBE, textureCreateInfo->usageFlags)) {
SDL_assert_release(!"For cube textures: the format is unsupported for the given usageFlags");
- failed = SDL_TRUE;
+ failed = true;
}
} else if (textureCreateInfo->type == SDL_GPU_TEXTURETYPE_3D) {
// 3D Texture Validation
if (textureCreateInfo->width > MAX_3D_DIMENSION || textureCreateInfo->height > MAX_3D_DIMENSION || textureCreateInfo->layerCountOrDepth > MAX_3D_DIMENSION) {
SDL_assert_release(!"For 3D textures: width, height, and layerCountOrDepth must be <= 2048");
- failed = SDL_TRUE;
+ failed = true;
}
if (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT) {
SDL_assert_release(!"For 3D textures: usageFlags must not contain DEPTH_STENCIL_TARGET_BIT");
- failed = SDL_TRUE;
+ failed = true;
}
if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1) {
SDL_assert_release(!"For 3D textures: sampleCount must be SDL_GPU_SAMPLECOUNT_1");
- failed = SDL_TRUE;
+ failed = true;
}
if (!SDL_SupportsGPUTextureFormat(device, textureCreateInfo->format, SDL_GPU_TEXTURETYPE_3D, textureCreateInfo->usageFlags)) {
SDL_assert_release(!"For 3D textures: the format is unsupported for the given usageFlags");
- failed = SDL_TRUE;
+ failed = true;
}
} else {
if (textureCreateInfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY) {
// Array Texture Validation
if (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT) {
SDL_assert_release(!"For array textures: usageFlags must not contain DEPTH_STENCIL_TARGET_BIT");
- failed = SDL_TRUE;
+ failed = true;
}
if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1) {
SDL_assert_release(!"For array textures: sampleCount must be SDL_GPU_SAMPLECOUNT_1");
- failed = SDL_TRUE;
+ failed = true;
}
} else {
// 2D Texture Validation
if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1 && textureCreateInfo->levelCount > 1) {
SDL_assert_release(!"For 2D textures: if sampleCount is >= SDL_GPU_SAMPLECOUNT_1, then levelCount must be 1");
- failed = SDL_TRUE;
+ failed = true;
}
}
if (!SDL_SupportsGPUTextureFormat(device, textureCreateInfo->format, SDL_GPU_TEXTURETYPE_2D, textureCreateInfo->usageFlags)) {
SDL_assert_release(!"For 2D textures: the format is unsupported for the given usageFlags");
- failed = SDL_TRUE;
+ failed = true;
}
}
@@ -1058,14 +1058,14 @@ SDL_GPUCommandBuffer *SDL_AcquireGPUCommandBuffer(
commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer;
commandBufferHeader->device = device;
commandBufferHeader->renderPass.commandBuffer = commandBuffer;
- commandBufferHeader->renderPass.inProgress = SDL_FALSE;
- commandBufferHeader->graphicsPipelineBound = SDL_FALSE;
+ commandBufferHeader->renderPass.inProgress = false;
+ commandBufferHeader->graphicsPipelineBound = false;
commandBufferHeader->computePass.commandBuffer = commandBuffer;
- commandBufferHeader->computePass.inProgress = SDL_FALSE;
- commandBufferHeader->computePipelineBound = SDL_FALSE;
+ commandBufferHeader->computePass.inProgress = false;
+ commandBufferHeader->computePipelineBound = false;
commandBufferHeader->copyPass.commandBuffer = commandBuffer;
- commandBufferHeader->copyPass.inProgress = SDL_FALSE;
- commandBufferHeader->submitted = SDL_FALSE;
+ commandBufferHeader->copyPass.inProgress = false;
+ commandBufferHeader->submitted = false;
return commandBuffer;
}
@@ -1196,7 +1196,7 @@ SDL_GPURenderPass *SDL_BeginGPURenderPass(
depthStencilAttachmentInfo);
commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer;
- commandBufferHeader->renderPass.inProgress = SDL_TRUE;
+ commandBufferHeader->renderPass.inProgress = true;
return (SDL_GPURenderPass *)&(commandBufferHeader->renderPass);
}
@@ -1220,7 +1220,7 @@ void SDL_BindGPUGraphicsPipeline(
graphicsPipeline);
commandBufferHeader = (CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER;
- commandBufferHeader->graphicsPipelineBound = SDL_TRUE;
+ commandBufferHeader->graphicsPipelineBound = true;
}
void SDL_SetGPUViewport(
@@ -1601,8 +1601,8 @@ void SDL_EndGPURenderPass(
RENDERPASS_COMMAND_BUFFER);
commandBufferCommonHeader = (CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER;
- commandBufferCommonHeader->renderPass.inProgress = SDL_FALSE;
- commandBufferCommonHeader->graphicsPipelineBound = SDL_FALSE;
+ commandBufferCommonHeader->renderPass.inProgress = false;
+ commandBufferCommonHeader->graphicsPipelineBound = false;
}
// Compute Pass
@@ -1649,7 +1649,7 @@ SDL_GPUComputePass *SDL_BeginGPUComputePass(
storageBufferBindingCount);
commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer;
- commandBufferHeader->computePass.inProgress = SDL_TRUE;
+ commandBufferHeader->computePass.inProgress = true;
return (SDL_GPUComputePass *)&(commandBufferHeader->computePass);
}
@@ -1677,7 +1677,7 @@ void SDL_BindGPUComputePipeline(
computePipeline);
commandBufferHeader = (CommandBufferCommonHeader *)COMPUTEPASS_COMMAND_BUFFER;
- commandBufferHeader->computePipelineBound = SDL_TRUE;
+ commandBufferHeader->computePipelineBound = true;
}
void SDL_BindGPUComputeStorageTextures(
@@ -1794,8 +1794,8 @@ void SDL_EndGPUComputePass(
COMPUTEPASS_COMMAND_BUFFER);
commandBufferCommonHeader = (CommandBufferCommonHeader *)COMPUTEPASS_COMMAND_BUFFER;
- commandBufferCommonHeader->computePass.inProgress = SDL_FALSE;
- commandBufferCommonHeader->computePipelineBound = SDL_FALSE;
+ commandBufferCommonHeader->computePass.inProgress = false;
+ commandBufferCommonHeader->computePipelineBound = false;
}
// TransferBuffer Data
@@ -1853,7 +1853,7 @@ SDL_GPUCopyPass *SDL_BeginGPUCopyPass(
commandBuffer);
commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer;
- commandBufferHeader->copyPass.inProgress = SDL_TRUE;
+ commandBufferHeader->copyPass.inProgress = true;
return (SDL_GPUCopyPass *)&(commandBufferHeader->copyPass);
}
@@ -2036,7 +2036,7 @@ void SDL_EndGPUCopyPass(
COPYPASS_DEVICE->EndCopyPass(
COPYPASS_COMMAND_BUFFER);
- ((CommandBufferCommonHeader *)COPYPASS_COMMAND_BUFFER)->copyPass.inProgress = SDL_FALSE;
+ ((CommandBufferCommonHeader *)COPYPASS_COMMAND_BUFFER)->copyPass.inProgress = false;
}
void SDL_GenerateGPUMipmaps(
@@ -2099,7 +2099,7 @@ void SDL_BlitGPU(
CHECK_ANY_PASS_IN_PROGRESS("Cannot blit during a pass!", )
// Validation
- SDL_bool failed = SDL_FALSE;
+ bool failed = false;
TextureCommonHeader *srcHeader = (TextureCommonHeader *)source->texture;
TextureCommonHeader *dstHeader = (TextureCommonHeader *)destination->texture;
@@ -2109,19 +2109,19 @@ void SDL_BlitGPU(
}
if ((srcHeader->info.usageFlags & SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT) == 0) {
SDL_assert_release(!"Blit source texture must be created with the SAMPLER_BIT usage flag");
- failed = SDL_TRUE;
+ failed = true;
}
if ((dstHeader->info.usageFlags & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT) == 0) {
SDL_assert_release(!"Blit destination texture must be created with the COLOR_TARGET_BIT usage flag");
- failed = SDL_TRUE;
+ failed = true;
}
if (IsDepthFormat(srcHeader->info.format)) {
SDL_assert_release(!"Blit source texture cannot have a depth format");
- failed = SDL_TRUE;
+ failed = true;
}
if (source->w == 0 || source->h == 0 || destination->w == 0 || destination->h == 0) {
SDL_assert_release(!"Blit source/destination regions must have non-zero width, height, and depth");
- failed = SDL_TRUE;
+ failed = true;
}
if (failed) {
@@ -2145,14 +2145,14 @@ SDL_bool SDL_SupportsGPUSwapchainComposition(
SDL_Window *window,
SDL_GPUSwapchainComposition swapchainComposition)
{
- CHECK_DEVICE_MAGIC(device, SDL_FALSE);
+ CHECK_DEVICE_MAGIC(device, false);
if (window == NULL) {
SDL_InvalidParamError("window");
- return SDL_FALSE;
+ return false;
}
if (device->debugMode) {
- CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchainComposition, SDL_FALSE)
+ CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchainComposition, false)
}
return device->SupportsSwapchainComposition(
@@ -2166,14 +2166,14 @@ SDL_bool SDL_SupportsGPUPresentMode(
SDL_Window *window,
SDL_GPUPresentMode presentMode)
{
- CHECK_DEVICE_MAGIC(device, SDL_FALSE);
+ CHECK_DEVICE_MAGIC(device, false);
if (window == NULL) {
SDL_InvalidParamError("window");
- return SDL_FALSE;
+ return false;
}
if (device->debugMode) {
- CHECK_PRESENTMODE_ENUM_INVALID(presentMode, SDL_FALSE)
+ CHECK_PRESENTMODE_ENUM_INVALID(presentMode, false)
}
return device->SupportsPresentMode(
@@ -2186,10 +2186,10 @@ SDL_bool SDL_ClaimGPUWindow(
SDL_GPUDevice *device,
SDL_Window *window)
{
- CHECK_DEVICE_MAGIC(device, SDL_FALSE);
+ CHECK_DEVICE_MAGIC(device, false);
if (window == NULL) {
SDL_InvalidParamError("window");
- return SDL_FALSE;
+ return false;
}
return device->ClaimWindow(
@@ -2218,15 +2218,15 @@ SDL_bool SDL_SetGPUSwapchainParameters(
SDL_GPUSwapchainComposition swapchainComposition,
SDL_GPUPresentMode presentMode)
{
- CHECK_DEVICE_MAGIC(device, SDL_FALSE);
+ CHECK_DEVICE_MAGIC(device, false);
if (window == NULL) {
SDL_InvalidParamError("window");
- return SDL_FALSE;
+ return false;
}
if (device->debugMode) {
- CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchainComposition, SDL_FALSE)
- CHECK_PRESENTMODE_ENUM_INVALID(presentMode, SDL_FALSE)
+ CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchainComposition, false)
+ CHECK_PRESENTMODE_ENUM_INVALID(presentMode, false)
}
return device->SetSwapchainParameters(
@@ -2307,7 +2307,7 @@ void SDL_SubmitGPU(
}
}
- commandBufferHeader->submitted = SDL_TRUE;
+ commandBufferHeader->submitted = true;
COMMAND_BUFFER_DEVICE->Submit(
commandBuffer);
@@ -2334,7 +2334,7 @@ SDL_GPUFence *SDL_SubmitGPUAndAcquireFence(
}
}
- commandBufferHeader->submitted = SDL_TRUE;
+ commandBufferHeader->submitted = true;
return COMMAND_BUFFER_DEVICE->SubmitAndAcquireFence(
commandBuffer);
@@ -2372,10 +2372,10 @@ SDL_bool SDL_QueryGPUFence(
SDL_GPUDevice *device,
SDL_GPUFence *fence)
{
- CHECK_DEVICE_MAGIC(device, SDL_FALSE);
+ CHECK_DEVICE_MAGIC(device, false);
if (fence == NULL) {
SDL_InvalidParamError("fence");
- return SDL_FALSE;
+ return false;
}
return device->QueryFence(
diff --git a/src/gpu/SDL_sysgpu.h b/src/gpu/SDL_sysgpu.h
index 9269dd402a366..3d3912f48996d 100644
--- a/src/gpu/SDL_sysgpu.h
+++ b/src/gpu/SDL_sysgpu.h
@@ -29,18 +29,18 @@
typedef struct Pass
{
SDL_GPUCommandBuffer *commandBuffer;
- SDL_bool inProgress;
+ bool inProgress;
} Pass;
typedef struct CommandBufferCommonHeader
{
SDL_GPUDevice *device;
Pass renderPass;
- SDL_bool graphicsPipelineBound;
+ bool graphicsPipelineBound;
Pass computePass;
- SDL_bool computePipelineBound;
+ bool computePipelineBound;
Pass copyPass;
- SDL_bool submitted;
+ bool submitted;
} CommandBufferCommonHeader;
typedef struct TextureCommonHeader
@@ -117,7 +117,7 @@ static inline Sint32 Texture_GetBlockSize(
}
}
-static inline SDL_bool IsDepthFormat(
+static inline bool IsDepthFormat(
SDL_GPUTextureFormat format)
{
switch (format) {
@@ -126,27 +126,27 @@ static inline SDL_bool IsDepthFormat(
case SDL_GPU_TEXTUREFORMAT_D32_FLOAT:
case SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT:
case SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT:
- return SDL_TRUE;
+ return true;
default:
- return SDL_FALSE;
+ return false;
}
}
-static inline SDL_bool IsStencilFormat(
+static inline bool IsStencilFormat(
SDL_GPUTextureFormat format)
{
switch (format) {
case SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT:
case SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT:
- return SDL_TRUE;
+ return true;
default:
- return SDL_FALSE;
+ return false;
}
}
-static inline SDL_bool IsIntegerFormat(
+static inline bool IsIntegerFormat(
SDL_GPUTextureFormat format)
{
switch (format) {
@@ -156,10 +156,10 @@ static inline SDL_bool IsIntegerFormat(
case SDL_GPU_TEXTUREFORMAT_R16_UINT:
case SDL_GPU_TEXTUREFORMAT_R16G16_UINT:
case SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT:
- return SDL_TRUE;
+ return true;
default:
- return SDL_FALSE;
+ return false;
}
}
@@ -252,7 +252,7 @@ void SDL_GPU_BlitCommon(
SDL_GPUBlitRegion *destination,
SDL_FlipMode flipMode,
SDL_GPUFilter filterMode,
- SDL_bool cycle,
+ bool cycle,
SDL_GPUSampler *blitLinearSampler,
SDL_GPUSampler *blitNearestSampler,
SDL_GPUShader *blitVertexShader,
@@ -524,7 +524,7 @@ struct SDL_GPUDevice
void *(*MapTransferBuffer)(
SDL_GPURenderer *device,
SDL_GPUTransferBuffer *transferBuffer,
- SDL_bool cycle);
+ bool cycle);
void (*UnmapTransferBuffer)(
SDL_GPURenderer *device,
@@ -539,13 +539,13 @@ struct SDL_GPUDevice
SDL_GPUCommandBuffer *commandBuffer,
SDL_GPUTextureTransferInfo *source,
SDL_GPUTextureRegion *destination,
- SDL_bool cycle);
+ bool cycle);
void (*UploadToBuffer)(
SDL_GPUCommandBuffer *commandBuffer,
SDL_GPUTransferBufferLocation *source,
SDL_GPUBufferRegion *destination,
- SDL_bool cycle);
+ bool cycle);
void (*CopyTextureToTexture)(
SDL_GPUCommandBuffer *commandBuffer,
@@ -554,14 +554,14 @@ struct SDL_GPUDevice
Uint32 w,
Uint32 h,
Uint32 d,
- SDL_bool cycle);
+ bool cycle);
void (*CopyBufferToBuffer)(
SDL_GPUCommandBuffer *commandBuffer,
SDL_GPUBufferLocation *source,
SDL_GPUBufferLocation *destination,
Uint32 size,
- SDL_bool cycle);
+ bool cycle);
void (*GenerateMipmaps)(
SDL_GPUCommandBuffer *commandBuffer,
@@ -586,21 +586,21 @@ struct SDL_GPUDevice
SDL_GPUBlitRegion *destination,
SDL_FlipMode flipMode,
SDL_GPUFilter filterMode,
- SDL_bool cycle);
+ bool cycle);
// Submission/Presentation
- SDL_bool (*SupportsSwapchainComposition)(
+ bool (*SupportsSwapchainComposition)(
SDL_GPURenderer *driverData,
SDL_Window *window,
SDL_GPUSwapchainComposition swapchainComposition);
- SDL_bool (*SupportsPresentMode)(
+ bool (*SupportsPresentMode)(
SDL_GPURenderer *driverData,
SDL_Window *window,
SDL_GPUPresentMode presentMode);
- SDL_bool (*ClaimWindow)(
+ bool (*ClaimWindow)(
SDL_GPURenderer *driverData,
SDL_Window *window);
@@ -608,7 +608,7 @@ struct SDL_GPUDevice
SDL_GPURenderer *driverData,
SDL_Window *window);
- SDL_bool (*SetSwapchainParameters)(
+ bool (*SetSwapchainParameters)(
SDL_GPURenderer *driverData,
SDL_Window *window,
SDL_GPUSwapchainComposition swapchainComposition,
@@ -638,11 +638,11 @@ struct SDL_GPUDevice
void (*WaitForFences)(
SDL_GPURenderer *driverData,
- SDL_bool waitAll,
+ bool waitAll,
SDL_GPUFence **pFences,
Uint32 fenceCount);
- SDL_bool (*QueryFence)(
+ bool (*QueryFence)(
SDL_GPURenderer *driverData,
SDL_GPUFence *fence);
@@ -652,13 +652,13 @@ struct SDL_GPUDevice
// Feature Queries
- SDL_bool (*SupportsTextureFormat)(
+ bool (*SupportsTextureFormat)(
SDL_GPURenderer *driverData,
SDL_GPUTextureFormat format,
SDL_GPUTextureType type,
SDL_GPUTextureUsageFlags usage);
- SDL_bool (*SupportsSampleCount)(
+ bool (*SupportsSampleCount)(
SDL_GPURenderer *driverData,
SDL_GPUTextureFormat format,
SDL_GPUSampleCount desiredSampleCount);
@@ -670,7 +670,7 @@ struct SDL_GPUDevice
SDL_GPUDriver backend;
// Store this for SDL_gpu.c's debug layer
- SDL_bool debugMode;
+ bool debugMode;
SDL_GPUShaderFormat shaderFormats;
};
@@ -758,8 +758,8 @@ typedef struct SDL_GPUBootstrap
const char *Name;
const SDL_GPUDriver backendflag;
const SDL_GPUShaderFormat shaderFormats;
- SDL_bool (*PrepareDriver)(SDL_VideoDevice *_this);
- SDL_GPUDevice *(*CreateDevice)(SDL_bool debugMode, SDL_bool preferLowPower, SDL_PropertiesID props);
+ bool (*PrepareDriver)(SDL_VideoDevice *_this);
+ SDL_GPUDevice *(*CreateDevice)(bool debugMode, bool preferLowPower, SDL_PropertiesID props);
} SDL_GPUBootstrap;
#ifdef __cplusplus
diff --git a/src/gpu/d3d11/SDL_gpu_d3d11.c b/src/gpu/d3d11/SDL_gpu_d3d11.c
index 8c5778a395bdd..1bebc3291e92f 100644
--- a/src/gpu/d3d11/SDL_gpu_d3d11.c
+++ b/src/gpu/d3d11/SDL_gpu_d3d11.c
@@ -383,7 +383,7 @@ typedef struct D3D11TextureContainer
TextureCommonHeader header;
D3D11Texture *activeTexture;
- SDL_bool canBeCycled;
+ bool canBeCycled;
Uint32 textureCapacity;
Uint32 textureCount;
@@ -612,19 +612,19 @@ typedef struct D3D11CommandBuffer
// Resource slot state
- SDL_bool needVertexBufferBind;
+ bool needVertexBufferBind;
- SDL_bool needVertexSamplerBind;
- SDL_bool needVertexResourceBind;
- SDL_bool needVertexUniformBufferBind;
+ bool needVertexSamplerBind;
+ bool needVertexResourceBind;
+ bool needVertexUniformBufferBind;
- SDL_bool needFragmentSamplerBind;
- SDL_bool needFragmentResourceBind;
- SDL_bool needFragmentUniformBufferBind;
+ bool needFragmentSamplerBind;
+ bool needFragmentResourceBind;
+ bool needFragmentUniformBufferBind;
- SDL_bool needComputeUAVBind;
- SDL_bool needComputeSRVBind;
- SDL_bool needComputeUniformBufferBind;
+ bool needComputeUAVBind;
+ bool needComputeSRVBind;
+ bool needComputeUniformBufferBind;
ID3D11Buffer *vertexBuffers[MAX_BUFFER_BINDINGS];
Uint32 vertexBufferOffsets[MAX_BUFFER_BINDINGS];
@@ -1678,7 +1678,7 @@ static void D3D11_SetTextureName(
}
}
-static SDL_bool D3D11_INTERNAL_StrToWStr(
+static bool D3D11_INTERNAL_StrToWStr(
D3D11Renderer *renderer,
const char *str,
wchar_t *wstr,
@@ -1708,12 +1708,12 @@ static SDL_bool D3D11_INTERNAL_StrToWStr(
case SDL_ICONV_EILSEQ:
case SDL_ICONV_EINVAL:
SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "Failed to convert string to wchar_t!");
- return SDL_FALSE;
+ return false;
default:
break;
}
- return SDL_TRUE;
+ return true;
}
static void D3D11_InsertDebugLabel(
@@ -2150,7 +2150,7 @@ static D3D11Texture *D3D11_INTERNAL_CreateTexture(
return d3d11Texture;
}
-static SDL_bool D3D11_SupportsSampleCount(
+static bool D3D11_SupportsSampleCount(
SDL_GPURenderer *driverData,
SDL_GPUTextureFormat format,
SDL_GPUSampleCount sampleCount)
@@ -2263,7 +2263,7 @@ static D3D11TextureSubresource *D3D11_INTERNAL_PrepareTextureSubresourceForWrite
D3D11Texture
(Patch may be truncated, please check the link at the top of this post.)