diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index e50170583a..86478ac178 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 0ec5ef5f66..7c04e65a68 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 71a3f38d26..0c63b9d33d 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 9269dd402a..3d3912f489 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 8c5778a395..1bebc3291e 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 D3D11TextureContainer *container, Uint32 layer, Uint32 level, - SDL_bool cycle) + bool cycle) { D3D11TextureSubresource *subresource = D3D11_INTERNAL_FetchTextureSubresource( container, @@ -2495,7 +2495,7 @@ static void D3D11_INTERNAL_CycleActiveBuffer( static D3D11Buffer *D3D11_INTERNAL_PrepareBufferForWrite( D3D11Renderer *renderer, D3D11BufferContainer *container, - SDL_bool cycle) + bool cycle) { if ( cycle && @@ -2585,7 +2585,7 @@ static void D3D11_INTERNAL_CycleActiveTransferBuffer( static void *D3D11_MapTransferBuffer( SDL_GPURenderer *driverData, SDL_GPUTransferBuffer *transferBuffer, - SDL_bool cycle) + bool cycle) { D3D11Renderer *renderer = (D3D11Renderer *)driverData; D3D11TransferBufferContainer *container = (D3D11TransferBufferContainer *)transferBuffer; @@ -2625,7 +2625,7 @@ static void D3D11_UploadToTexture( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUTextureTransferInfo *source, SDL_GPUTextureRegion *destination, - SDL_bool cycle) + bool cycle) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = (D3D11Renderer *)d3d11CommandBuffer->renderer; @@ -2715,7 +2715,7 @@ static void D3D11_UploadToBuffer( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUTransferBufferLocation *source, SDL_GPUBufferRegion *destination, - SDL_bool cycle) + bool cycle) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = (D3D11Renderer *)d3d11CommandBuffer->renderer; @@ -2938,7 +2938,7 @@ static void D3D11_CopyTextureToTexture( Uint32 w, Uint32 h, Uint32 d, - SDL_bool cycle) + bool cycle) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = (D3D11Renderer *)d3d11CommandBuffer->renderer; @@ -2979,7 +2979,7 @@ static void D3D11_CopyBufferToBuffer( SDL_GPUBufferLocation *source, SDL_GPUBufferLocation *destination, Uint32 size, - SDL_bool cycle) + bool cycle) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = (D3D11Renderer *)d3d11CommandBuffer->renderer; @@ -3111,7 +3111,7 @@ static D3D11CommandBuffer *D3D11_INTERNAL_GetInactiveCommandBufferFromPool( return commandBuffer; } -static SDL_bool D3D11_INTERNAL_CreateFence( +static bool D3D11_INTERNAL_CreateFence( D3D11Renderer *renderer) { D3D11_QUERY_DESC queryDesc; @@ -3142,10 +3142,10 @@ static SDL_bool D3D11_INTERNAL_CreateFence( renderer->availableFences[renderer->availableFenceCount] = fence; renderer->availableFenceCount += 1; - return SDL_TRUE; + return true; } -static SDL_bool D3D11_INTERNAL_AcquireFence( +static bool D3D11_INTERNAL_AcquireFence( D3D11CommandBuffer *commandBuffer) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; @@ -3159,7 +3159,7 @@ static SDL_bool D3D11_INTERNAL_AcquireFence( if (!D3D11_INTERNAL_CreateFence(renderer)) { SDL_UnlockMutex(renderer->fenceLock); SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to create fence!"); - return SDL_FALSE; + return false; } } @@ -3172,7 +3172,7 @@ static SDL_bool D3D11_INTERNAL_AcquireFence( commandBuffer->fence = fence; (void)SDL_AtomicIncRef(&commandBuffer->fence->referenceCount); - return SDL_TRUE; + return true; } static SDL_GPUCommandBuffer *D3D11_AcquireCommandBuffer( @@ -3200,15 +3200,15 @@ static SDL_GPUCommandBuffer *D3D11_AcquireCommandBuffer( commandBuffer->computeUniformBuffers[i] = NULL; } - commandBuffer->needVertexSamplerBind = SDL_TRUE; - commandBuffer->needVertexResourceBind = SDL_TRUE; - commandBuffer->needVertexUniformBufferBind = SDL_TRUE; - commandBuffer->needFragmentSamplerBind = SDL_TRUE; - commandBuffer->needFragmentResourceBind = SDL_TRUE; - commandBuffer->needFragmentUniformBufferBind = SDL_TRUE; - commandBuffer->needComputeUAVBind = SDL_TRUE; - commandBuffer->needComputeSRVBind = SDL_TRUE; - commandBuffer->needComputeUniformBufferBind = SDL_TRUE; + commandBuffer->needVertexSamplerBind = true; + commandBuffer->needVertexResourceBind = true; + commandBuffer->needVertexUniformBufferBind = true; + commandBuffer->needFragmentSamplerBind = true; + commandBuffer->needFragmentResourceBind = true; + commandBuffer->needFragmentUniformBufferBind = true; + commandBuffer->needComputeUAVBind = true; + commandBuffer->needComputeSRVBind = true; + commandBuffer->needComputeUniformBufferBind = true; SDL_zeroa(commandBuffer->vertexSamplers); SDL_zeroa(commandBuffer->vertexShaderResourceViews); @@ -3356,11 +3356,11 @@ static void D3D11_INTERNAL_PushUniformData( d3d11UniformBuffer->writeOffset += d3d11UniformBuffer->currentBlockSize; if (shaderStage == SDL_GPU_SHADERSTAGE_VERTEX) { - d3d11CommandBuffer->needVertexUniformBufferBind = SDL_TRUE; + d3d11CommandBuffer->needVertexUniformBufferBind = true; } else if (shaderStage == SDL_GPU_SHADERSTAGE_FRAGMENT) { - d3d11CommandBuffer->needFragmentUniformBufferBind = SDL_TRUE; + d3d11CommandBuffer->needFragmentUniformBufferBind = true; } else if (shaderStage == SDL_GPU_SHADERSTAGE_COMPUTE) { - d3d11CommandBuffer->needComputeUniformBufferBind = SDL_TRUE; + d3d11CommandBuffer->needComputeUniformBufferBind = true; } else { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Unrecognized shader stage!"); } @@ -3381,10 +3381,10 @@ static void D3D11_BeginRenderPass( D3D11_VIEWPORT viewport; D3D11_RECT scissorRect; - d3d11CommandBuffer->needVertexSamplerBind = SDL_TRUE; - d3d11CommandBuffer->needVertexResourceBind = SDL_TRUE; - d3d11CommandBuffer->needFragmentSamplerBind = SDL_TRUE; - d3d11CommandBuffer->needFragmentResourceBind = SDL_TRUE; + d3d11CommandBuffer->needVertexSamplerBind = true; + d3d11CommandBuffer->needVertexResourceBind = true; + d3d11CommandBuffer->needFragmentSamplerBind = true; + d3d11CommandBuffer->needFragmentResourceBind = true; // Clear the bound targets for the current command buffer for (Uint32 i = 0; i < MAX_COLOR_TARGET_BINDINGS; i += 1) { @@ -3590,8 +3590,8 @@ static void D3D11_BindGraphicsPipeline( } // Mark that uniform bindings are needed - d3d11CommandBuffer->needVertexUniformBufferBind = SDL_TRUE; - d3d11CommandBuffer->needFragmentUniformBufferBind = SDL_TRUE; + d3d11CommandBuffer->needVertexUniformBufferBind = true; + d3d11CommandBuffer->needFragmentUniformBufferBind = true; } static void D3D11_SetViewport( @@ -3650,7 +3650,7 @@ static void D3D11_BindVertexBuffers( d3d11CommandBuffer->vertexBufferCount = SDL_max(d3d11CommandBuffer->vertexBufferCount, firstBinding + bindingCount); - d3d11CommandBuffer->needVertexBufferBind = SDL_TRUE; + d3d11CommandBuffer->needVertexBufferBind = true; } static void D3D11_BindIndexBuffer( @@ -3692,8 +3692,8 @@ static void D3D11_BindVertexSamplers( textureContainer->activeTexture->shaderView; } - d3d11CommandBuffer->needVertexSamplerBind = SDL_TRUE; - d3d11CommandBuffer->needVertexResourceBind = SDL_TRUE; + d3d11CommandBuffer->needVertexSamplerBind = true; + d3d11CommandBuffer->needVertexResourceBind = true; } static void D3D11_BindVertexStorageTextures( @@ -3715,7 +3715,7 @@ static void D3D11_BindVertexStorageTextures( d3d11CommandBuffer->graphicsPipeline->vertexSamplerCount] = textureContainer->activeTexture->shaderView; } - d3d11CommandBuffer->needVertexResourceBind = SDL_TRUE; + d3d11CommandBuffer->needVertexResourceBind = true; } static void D3D11_BindVertexStorageBuffers( @@ -3740,7 +3740,7 @@ static void D3D11_BindVertexStorageBuffers( d3d11CommandBuffer->graphicsPipeline->vertexStorageTextureCount] = bufferContainer->activeBuffer->srv; } - d3d11CommandBuffer->needVertexResourceBind = SDL_TRUE; + d3d11CommandBuffer->needVertexResourceBind = true; } static void D3D11_BindFragmentSamplers( @@ -3765,8 +3765,8 @@ static void D3D11_BindFragmentSamplers( textureContainer->activeTexture->shaderView; } - d3d11CommandBuffer->needFragmentSamplerBind = SDL_TRUE; - d3d11CommandBuffer->needFragmentResourceBind = SDL_TRUE; + d3d11CommandBuffer->needFragmentSamplerBind = true; + d3d11CommandBuffer->needFragmentResourceBind = true; } static void D3D11_BindFragmentStorageTextures( @@ -3788,7 +3788,7 @@ static void D3D11_BindFragmentStorageTextures( d3d11CommandBuffer->graphicsPipeline->fragmentSamplerCount] = textureContainer->activeTexture->shaderView; } - d3d11CommandBuffer->needFragmentResourceBind = SDL_TRUE; + d3d11CommandBuffer->needFragmentResourceBind = true; } static void D3D11_BindFragmentStorageBuffers( @@ -3813,7 +3813,7 @@ static void D3D11_BindFragmentStorageBuffers( d3d11CommandBuffer->graphicsPipeline->fragmentStorageTextureCount] = bufferContainer->activeBuffer->srv; } - d3d11CommandBuffer->needFragmentResourceBind = SDL_TRUE; + d3d11CommandBuffer->needFragmentResourceBind = true; } static void D3D11_INTERNAL_BindGraphicsResources( @@ -3853,7 +3853,7 @@ static void D3D11_INTERNAL_BindGraphicsResources( commandBuffer->vertexSamplers); } - commandBuffer->needVertexSamplerBind = SDL_FALSE; + commandBuffer->needVertexSamplerBind = false; } if (commandBuffer->needVertexResourceBind) { @@ -3865,7 +3865,7 @@ static void D3D11_INTERNAL_BindGraphicsResources( commandBuffer->vertexShaderResourceViews); } - commandBuffer->needVertexResourceBind = SDL_FALSE; + commandBuffer->needVertexResourceBind = false; } if (commandBuffer->needVertexUniformBufferBind) { @@ -3891,7 +3891,7 @@ static void D3D11_INTERNAL_BindGraphicsResources( &blockSizeInConstants); } - commandBuffer->needVertexUniformBufferBind = SDL_FALSE; + commandBuffer->needVertexUniformBufferBind = false; } if (commandBuffer->needFragmentSamplerBind) { @@ -3903,7 +3903,7 @@ static void D3D11_INTERNAL_BindGraphicsResources( commandBuffer->fragmentSamplers); } - commandBuffer->needFragmentSamplerBind = SDL_FALSE; + commandBuffer->needFragmentSamplerBind = false; } if (commandBuffer->needFragmentResourceBind) { @@ -3915,7 +3915,7 @@ static void D3D11_INTERNAL_BindGraphicsResources( commandBuffer->fragmentShaderResourceViews); } - commandBuffer->needFragmentResourceBind = SDL_FALSE; + commandBuffer->needFragmentResourceBind = false; } if (commandBuffer->needFragmentUniformBufferBind) { @@ -3941,7 +3941,7 @@ static void D3D11_INTERNAL_BindGraphicsResources( &blockSizeInConstants); } - commandBuffer->needFragmentUniformBufferBind = SDL_FALSE; + commandBuffer->needFragmentUniformBufferBind = false; } } @@ -4108,7 +4108,7 @@ static void D3D11_Blit( SDL_GPUBlitRegion *destination, SDL_FlipMode flipMode, SDL_GPUFilter filterMode, - SDL_bool cycle) + bool cycle) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = (D3D11Renderer *)d3d11CommandBuffer->renderer; @@ -4184,7 +4184,7 @@ static void D3D11_BeginComputePass( d3d11CommandBuffer->computeUnorderedAccessViews[i + storageTextureBindingCount] = buffer->uav; } - d3d11CommandBuffer->needComputeUAVBind = SDL_TRUE; + d3d11CommandBuffer->needComputeUAVBind = true; } static void D3D11_BindComputePipeline( @@ -4210,7 +4210,7 @@ static void D3D11_BindComputePipeline( } } - d3d11CommandBuffer->needComputeUniformBufferBind = SDL_TRUE; + d3d11CommandBuffer->needComputeUniformBufferBind = true; } static void D3D11_BindComputeStorageTextures( @@ -4232,7 +4232,7 @@ static void D3D11_BindComputeStorageTextures( textureContainer->activeTexture->shaderView; } - d3d11CommandBuffer->needComputeSRVBind = SDL_TRUE; + d3d11CommandBuffer->needComputeSRVBind = true; } static void D3D11_BindComputeStorageBuffers( @@ -4256,7 +4256,7 @@ static void D3D11_BindComputeStorageBuffers( d3d11CommandBuffer->computePipeline->readOnlyStorageTextureCount] = bufferContainer->activeBuffer->srv; } - d3d11CommandBuffer->needComputeSRVBind = SDL_TRUE; + d3d11CommandBuffer->needComputeSRVBind = true; } static void D3D11_PushComputeUniformData( @@ -4297,7 +4297,7 @@ static void D3D11_INTERNAL_BindComputeResources( commandBuffer->computeUnorderedAccessViews, NULL); - commandBuffer->needComputeUAVBind = SDL_FALSE; + commandBuffer->needComputeUAVBind = false; } if (commandBuffer->needComputeSRVBind) { @@ -4307,7 +4307,7 @@ static void D3D11_INTERNAL_BindComputeResources( readOnlyResourceCount, commandBuffer->computeShaderResourceViews); - commandBuffer->needComputeSRVBind = SDL_FALSE; + commandBuffer->needComputeSRVBind = false; } if (commandBuffer->needComputeUniformBufferBind) { @@ -4332,7 +4332,7 @@ static void D3D11_INTERNAL_BindComputeResources( &offsetInConstants, &blockSizeInConstants); } - commandBuffer->needComputeUniformBufferBind = SDL_FALSE; + commandBuffer->needComputeUniformBufferBind = false; } } @@ -4675,7 +4675,7 @@ static void D3D11_INTERNAL_WaitForFence( static void D3D11_WaitForFences( SDL_GPURenderer *driverData, - SDL_bool waitAll, + bool waitAll, SDL_GPUFence **pFences, Uint32 fenceCount) { @@ -4732,7 +4732,7 @@ static void D3D11_WaitForFences( SDL_UnlockMutex(renderer->contextLock); } -static SDL_bool D3D11_QueryFence( +static bool D3D11_QueryFence( SDL_GPURenderer *driverData, SDL_GPUFence *fence) { @@ -4764,7 +4764,7 @@ static D3D11WindowData *D3D11_INTERNAL_FetchWindowData( return (D3D11WindowData *)SDL_GetPointerProperty(properties, WINDOW_PROPERTY_DATA, NULL); } -static SDL_bool D3D11_INTERNAL_InitializeSwapchainTexture( +static bool D3D11_INTERNAL_InitializeSwapchainTexture( D3D11Renderer *renderer, IDXGISwapChain *swapchain, DXGI_FORMAT swapchainFormat, @@ -4800,7 +4800,7 @@ static SDL_bool D3D11_INTERNAL_InitializeSwapchainTexture( if (FAILED(res)) { ID3D11Texture2D_Release(swapchainTexture); D3D11_INTERNAL_LogError(renderer->device, "Swapchain RTV creation failed", res); - return SDL_FALSE; + return false; } // Create container @@ -4826,10 +4826,10 @@ static SDL_bool D3D11_INTERNAL_InitializeSwapchainTexture( // Cleanup ID3D11Texture2D_Release(swapchainTexture); - return SDL_TRUE; + return true; } -static SDL_bool D3D11_INTERNAL_CreateSwapchain( +static bool D3D11_INTERNAL_CreateSwapchain( D3D11Renderer *renderer, D3D11WindowData *windowData, SDL_GPUSwapchainComposition swapchainComposition, @@ -4960,7 +4960,7 @@ static SDL_bool D3D11_INTERNAL_CreateSwapchain( (swapchainComposition == SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR) ? DXGI_FORMAT_B8G8R8A8_UNORM_SRGB : windowData->swapchainFormat, &windowData->texture)) { IDXGISwapChain_Release(swapchain); - return SDL_FALSE; + return false; } // Initialize dummy container, width/height will be filled out in AcquireSwapchainTexture @@ -4968,7 +4968,7 @@ static SDL_bool D3D11_INTERNAL_CreateSwapchain( windowData->textureContainer.textures = SDL_calloc(1, sizeof(D3D11Texture *)); windowData->textureContainer.activeTexture = &windowData->texture; windowData->textureContainer.textures[0] = &windowData->texture; - windowData->textureContainer.canBeCycled = SDL_FALSE; + windowData->textureContainer.canBeCycled = false; windowData->textureContainer.textureCount = 1; windowData->textureContainer.textureCapacity = 1; @@ -4982,10 +4982,10 @@ static SDL_bool D3D11_INTERNAL_CreateSwapchain( windowData->texture.container = &windowData->textureContainer; windowData->texture.containerIndex = 0; - return SDL_TRUE; + return true; } -static SDL_bool D3D11_INTERNAL_ResizeSwapchain( +static bool D3D11_INTERNAL_ResizeSwapchain( D3D11Renderer *renderer, D3D11WindowData *windowData, Sint32 width, @@ -5015,7 +5015,7 @@ static SDL_bool D3D11_INTERNAL_ResizeSwapchain( &windowData->texture); } -static SDL_bool D3D11_SupportsSwapchainComposition( +static bool D3D11_SupportsSwapchainComposition( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUSwapchainComposition swapchainComposition) @@ -5035,17 +5035,17 @@ static SDL_bool D3D11_SupportsSwapchainComposition( &formatSupport); if (FAILED(res)) { // Format is apparently unknown - return SDL_FALSE; + return false; } if (!(formatSupport & D3D11_FORMAT_SUPPORT_DISPLAY)) { - return SDL_FALSE; + return false; } D3D11WindowData *windowData = D3D11_INTERNAL_FetchWindowData(window); if (windowData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Must claim window before querying swapchain composition support!"); - return SDL_FALSE; + return false; } // Check the color space support if necessary @@ -5062,18 +5062,18 @@ static SDL_bool D3D11_SupportsSwapchainComposition( IDXGISwapChain3_Release(swapchain3); if (!(colorSpaceSupport & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT)) { - return SDL_FALSE; + return false; } } else { SDL_LogError(SDL_LOG_CATEGORY_GPU, "DXGI 1.4 not supported, cannot use composition other than SDL_GPU_SWAPCHAINCOMPOSITION_SDR!"); - return SDL_FALSE; + return false; } } - return SDL_TRUE; + return true; } -static SDL_bool D3D11_SupportsPresentMode( +static bool D3D11_SupportsPresentMode( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUPresentMode presentMode) @@ -5083,15 +5083,15 @@ static SDL_bool D3D11_SupportsPresentMode( switch (presentMode) { case SDL_GPU_PRESENTMODE_IMMEDIATE: case SDL_GPU_PRESENTMODE_VSYNC: - return SDL_TRUE; + return true; case SDL_GPU_PRESENTMODE_MAILBOX: return renderer->supportsFlipDiscard; } SDL_assert(!"Unrecognized present mode"); - return SDL_FALSE; + return false; } -static SDL_bool D3D11_ClaimWindow( +static bool D3D11_ClaimWindow( SDL_GPURenderer *driverData, SDL_Window *window) { @@ -5118,15 +5118,15 @@ static SDL_bool D3D11_ClaimWindow( SDL_UnlockMutex(renderer->windowLock); - return SDL_TRUE; + return true; } else { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Could not create swapchain, failed to claim window!"); SDL_free(windowData); - return SDL_FALSE; + return false; } } else { SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "Window already claimed!"); - return SDL_FALSE; + return false; } } @@ -5227,7 +5227,7 @@ static SDL_GPUTexture *D3D11_AcquireSwapchainTexture( // In VSYNC mode, block until the least recent presented frame is done D3D11_WaitForFences( (SDL_GPURenderer *)renderer, - SDL_TRUE, + true, (SDL_GPUFence **)&windowData->inFlightFences[windowData->frameCounter], 1); } else { @@ -5293,7 +5293,7 @@ static SDL_GPUTextureFormat D3D11_GetSwapchainTextureFormat( return windowData->textureContainer.header.info.format; } -static SDL_bool D3D11_SetSwapchainParameters( +static bool D3D11_SetSwapchainParameters( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUSwapchainComposition swapchainComposition, @@ -5304,17 +5304,17 @@ static SDL_bool D3D11_SetSwapchainParameters( if (windowData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Cannot set swapchain parameters on unclaimed window!"); - return SDL_FALSE; + return false; } if (!D3D11_SupportsSwapchainComposition(driverData, window, swapchainComposition)) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Swapchain composition not supported!"); - return SDL_FALSE; + return false; } if (!D3D11_SupportsPresentMode(driverData, window, presentMode)) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Present mode not supported!"); - return SDL_FALSE; + return false; } if ( @@ -5334,7 +5334,7 @@ static SDL_bool D3D11_SetSwapchainParameters( presentMode); } - return SDL_TRUE; + return true; } // Submission @@ -5498,7 +5498,7 @@ static void D3D11_Wait( // Format Info -static SDL_bool D3D11_SupportsTextureFormat( +static bool D3D11_SupportsTextureFormat( SDL_GPURenderer *driverData, SDL_GPUTextureFormat format, SDL_GPUTextureType type, @@ -5516,7 +5516,7 @@ static SDL_bool D3D11_SupportsTextureFormat( &formatSupport); if (FAILED(res)) { // Format is apparently unknown - return SDL_FALSE; + return false; } /* Depth textures are stored as typeless textures, but interpreted as color textures for sampling. @@ -5534,42 +5534,42 @@ static SDL_bool D3D11_SupportsTextureFormat( // Is the texture type supported? if (type == SDL_GPU_TEXTURETYPE_2D && !(formatSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D)) { - return SDL_FALSE; + return false; } if (type == SDL_GPU_TEXTURETYPE_2D_ARRAY && !(formatSupport & D3D11_FORMAT_SUPPORT_TEXTURE2D)) { - return SDL_FALSE; + return false; } if (type == SDL_GPU_TEXTURETYPE_3D && !(formatSupport & D3D11_FORMAT_SUPPORT_TEXTURE3D)) { - return SDL_FALSE; + return false; } if (type == SDL_GPU_TEXTURETYPE_CUBE && !(formatSupport & D3D11_FORMAT_SUPPORT_TEXTURECUBE)) { - return SDL_FALSE; + return false; } // Are the usage flags supported? if ((usage & SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT) && !(formatSupport & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE)) { - return SDL_FALSE; + return false; } if ((usage & (SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ_BIT | SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ_BIT)) && !(formatSupport & D3D11_FORMAT_SUPPORT_SHADER_LOAD)) { - return SDL_FALSE; + return false; } if ((usage & (SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE_BIT) && !(formatSupport & D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW))) { // TYPED_UNORDERED_ACCESS_VIEW implies support for typed UAV stores - return SDL_FALSE; + return false; } if ((usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT) && !(formatSupport & D3D11_FORMAT_SUPPORT_RENDER_TARGET)) { - return SDL_FALSE; + return false; } if ((usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT) && !(formatSupport & D3D11_FORMAT_SUPPORT_DEPTH_STENCIL)) { - return SDL_FALSE; + return false; } - return SDL_TRUE; + return true; } // Device Creation -static SDL_bool D3D11_PrepareDriver(SDL_VideoDevice *_this) +static bool D3D11_PrepareDriver(SDL_VideoDevice *_this) { void *d3d11_dll, *dxgi_dll; PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc; @@ -5582,7 +5582,7 @@ static SDL_bool D3D11_PrepareDriver(SDL_VideoDevice *_this) d3d11_dll = SDL_LoadObject(D3D11_DLL); if (d3d11_dll == NULL) { SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D11: Could not find " D3D11_DLL); - return SDL_FALSE; + return false; } D3D11CreateDeviceFunc = (PFN_D3D11_CREATE_DEVICE)SDL_LoadFunction( @@ -5591,7 +5591,7 @@ static SDL_bool D3D11_PrepareDriver(SDL_VideoDevice *_this) if (D3D11CreateDeviceFunc == NULL) { SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D11: Could not find function " D3D11_CREATE_DEVICE_FUNC " in " D3D11_DLL); SDL_UnloadObject(d3d11_dll); - return SDL_FALSE; + return false; } // Can we create a device? @@ -5612,7 +5612,7 @@ static SDL_bool D3D11_PrepareDriver(SDL_VideoDevice *_this) if (FAILED(res)) { SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D11: Could not create D3D11Device with feature level 11_1"); - return SDL_FALSE; + return false; } // Can we load DXGI? @@ -5620,7 +5620,7 @@ static SDL_bool D3D11_PrepareDriver(SDL_VideoDevice *_this) dxgi_dll = SDL_LoadObject(DXGI_DLL); if (dxgi_dll == NULL) { SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D11: Could not find " DXGI_DLL); - return SDL_FALSE; + return false; } CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY1)SDL_LoadFunction( @@ -5629,10 +5629,10 @@ static SDL_bool D3D11_PrepareDriver(SDL_VideoDevice *_this) SDL_UnloadObject(dxgi_dll); // We're not going to call this function, so we can just unload now. if (CreateDXGIFactoryFunc == NULL) { SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D11: Could not find function " CREATE_DXGI_FACTORY1_FUNC " in " DXGI_DLL); - return SDL_FALSE; + return false; } - return SDL_TRUE; + return true; } static void D3D11_INTERNAL_TryInitializeDXGIDebug(D3D11Renderer *renderer) @@ -5758,7 +5758,7 @@ static void D3D11_INTERNAL_InitBlitPipelines( 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 = fullscreenVertexShader; blitPipelineCreateInfo.fragmentShader = blitFrom2DPixelShader; @@ -5879,7 +5879,7 @@ static void D3D11_INTERNAL_DestroyBlitPipelines( } } -static SDL_GPUDevice *D3D11_CreateDevice(SDL_bool debugMode, SDL_bool preferLowPower, SDL_PropertiesID props) +static SDL_GPUDevice *D3D11_CreateDevice(bool debugMode, bool preferLowPower, SDL_PropertiesID props) { D3D11Renderer *renderer; PFN_CREATE_DXGI_FACTORY1 CreateDXGIFactoryFunc; diff --git a/src/gpu/d3d12/SDL_gpu_d3d12.c b/src/gpu/d3d12/SDL_gpu_d3d12.c index ddd244ce54..0a07ca80d6 100644 --- a/src/gpu/d3d12/SDL_gpu_d3d12.c +++ b/src/gpu/d3d12/SDL_gpu_d3d12.c @@ -361,8 +361,8 @@ static D3D12_FILTER SDLToD3D12_Filter( SDL_GPUFilter minFilter, SDL_GPUFilter magFilter, SDL_GPUSamplerMipmapMode mipmapMode, - SDL_bool comparisonEnabled, - SDL_bool anisotropyEnabled) + bool comparisonEnabled, + bool anisotropyEnabled) { D3D12_FILTER result = D3D12_ENCODE_BASIC_FILTER( (minFilter == SDL_GPU_FILTER_LINEAR) ? 1 : 0, @@ -403,14 +403,14 @@ struct D3D12DescriptorHeap ID3D12DescriptorHeap *handle; D3D12_DESCRIPTOR_HEAP_TYPE heapType; D3D12_CPU_DESCRIPTOR_HANDLE descriptorHeapCPUStart; - D3D12_GPU_DESCRIPTOR_HANDLE descriptorHeapGPUStart; // only exists if staging is SDL_TRUE + D3D12_GPU_DESCRIPTOR_HANDLE descriptorHeapGPUStart; // only exists if staging is true Uint32 maxDescriptors; Uint32 descriptorSize; - SDL_bool staging; + bool staging; Uint32 currentDescriptorIndex; - Uint32 *inactiveDescriptorIndices; // only exists if staging is SDL_TRUE + Uint32 *inactiveDescriptorIndices; // only exists if staging is true Uint32 inactiveDescriptorCount; }; @@ -440,7 +440,7 @@ typedef struct D3D12TextureContainer Uint32 textureCount; // Swapchain images cannot be cycled - SDL_bool canBeCycled; + bool canBeCycled; char *debugName; } D3D12TextureContainer; @@ -520,7 +520,7 @@ struct D3D12Renderer void *dxgidebug_dll; #endif ID3D12Debug *d3d12Debug; - SDL_bool supportsTearing; + bool supportsTearing; void *d3d12_dll; ID3D12Device *device; PFN_D3D12_SERIALIZE_ROOT_SIGNATURE D3D12SerializeRootSignature_func; @@ -529,11 +529,11 @@ struct D3D12Renderer ID3D12CommandQueue *commandQueue; - SDL_bool debugMode; - SDL_bool GPUUploadHeapSupported; + bool debugMode; + bool GPUUploadHeapSupported; // FIXME: these might not be necessary since we're not using custom heaps - SDL_bool UMA; - SDL_bool UMACacheCoherent; + bool UMA; + bool UMACacheCoherent; // Indirect command signatures ID3D12CommandSignature *indirectDrawCommandSignature; @@ -622,7 +622,7 @@ struct D3D12CommandBuffer ID3D12CommandAllocator *commandAllocator; ID3D12GraphicsCommandList *graphicsCommandList; D3D12Fence *inFlightFence; - SDL_bool autoReleaseFence; + bool autoReleaseFence; // Presentation data D3D12PresentData *presentDatas; @@ -643,19 +643,19 @@ struct D3D12CommandBuffer Uint32 usedUniformBufferCapacity; // Resource slot state - SDL_bool needVertexBufferBind; - SDL_bool needVertexSamplerBind; - SDL_bool needVertexStorageTextureBind; - SDL_bool needVertexStorageBufferBind; - SDL_bool needVertexUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE]; - SDL_bool needFragmentSamplerBind; - SDL_bool needFragmentStorageTextureBind; - SDL_bool needFragmentStorageBufferBind; - SDL_bool needFragmentUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE]; + bool needVertexBufferBind; + bool needVertexSamplerBind; + bool needVertexStorageTextureBind; + bool needVertexStorageBufferBind; + bool needVertexUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE]; + bool needFragmentSamplerBind; + bool needFragmentStorageTextureBind; + bool needFragmentStorageBufferBind; + bool needFragmentUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE]; - SDL_bool needComputeReadOnlyStorageTextureBind; - SDL_bool needComputeReadOnlyStorageBufferBind; - SDL_bool needComputeUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE]; + bool needComputeReadOnlyStorageTextureBind; + bool needComputeReadOnlyStorageBufferBind; + bool needComputeUniformBufferBind[MAX_UNIFORM_BUFFERS_PER_STAGE]; D3D12Buffer *vertexBuffers[MAX_BUFFER_BINDINGS]; Uint32 vertexBufferOffsets[MAX_BUFFER_BINDINGS]; @@ -813,7 +813,7 @@ struct D3D12Buffer D3D12_GPU_VIRTUAL_ADDRESS virtualAddress; Uint8 *mapPointer; // NULL except for upload buffers and fast uniform buffers SDL_AtomicInt referenceCount; - SDL_bool transitioned; // used for initial resource barrier + bool transitioned; // used for initial resource barrier }; struct D3D12BufferContainer @@ -845,7 +845,7 @@ struct D3D12UniformBuffer static void D3D12_UnclaimWindow(SDL_GPURenderer *driverData, SDL_Window *window); static void D3D12_Wait(SDL_GPURenderer *driverData); -static void D3D12_WaitForFences(SDL_GPURenderer *driverData, SDL_bool waitAll, SDL_GPUFence **pFences, Uint32 fenceCount); +static void D3D12_WaitForFences(SDL_GPURenderer *driverData, bool waitAll, SDL_GPUFence **pFences, Uint32 fenceCount); static void D3D12_INTERNAL_ReleaseBlitPipelines(SDL_GPURenderer *driverData); // Helpers @@ -1192,7 +1192,7 @@ static void D3D12_ReleaseFence( } } -static SDL_bool D3D12_QueryFence( +static bool D3D12_QueryFence( SDL_GPURenderer *driverData, SDL_GPUFence *fence) { @@ -1412,7 +1412,7 @@ static void D3D12_INTERNAL_ResourceBarrier( D3D12_RESOURCE_STATES destinationState, ID3D12Resource *resource, Uint32 subresourceIndex, - SDL_bool needsUavBarrier) + bool needsUavBarrier) { D3D12_RESOURCE_BARRIER barrierDesc[2]; Uint32 numBarriers = 0; @@ -1568,7 +1568,7 @@ static void D3D12_INTERNAL_BufferBarrier( 0, buffer->container->usageFlags & SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE_BIT); - buffer->transitioned = SDL_TRUE; + buffer->transitioned = true; } static void D3D12_INTERNAL_BufferTransitionFromDefaultUsage( @@ -1684,7 +1684,7 @@ static D3D12DescriptorHeap *D3D12_INTERNAL_CreateDescriptorHeap( D3D12Renderer *renderer, D3D12_DESCRIPTOR_HEAP_TYPE type, Uint32 descriptorCount, - SDL_bool staging) + bool staging) { D3D12DescriptorHeap *heap; ID3D12DescriptorHeap *handle; @@ -1755,7 +1755,7 @@ static D3D12DescriptorHeap *D3D12_INTERNAL_AcquireDescriptorHeapFromPool( renderer, descriptorHeapType, descriptorHeapType == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV ? VIEW_GPU_DESCRIPTOR_COUNT : SAMPLER_GPU_DESCRIPTOR_COUNT, - SDL_FALSE); + false); } SDL_UnlockMutex(pool->lock); @@ -2057,7 +2057,7 @@ static D3D12GraphicsRootSignature *D3D12_INTERNAL_CreateGraphicsRootSignature( return d3d12GraphicsRootSignature; } -static SDL_bool D3D12_INTERNAL_CreateShaderBytecode( +static bool D3D12_INTERNAL_CreateShaderBytecode( D3D12Renderer *renderer, Uint32 stage, SDL_GPUShaderFormat format, @@ -2070,13 +2070,13 @@ static SDL_bool D3D12_INTERNAL_CreateShaderBytecode( if (pBytecode != NULL) { *pBytecode = SDL_malloc(codeSize); if (!*pBytecode) { - return SDL_FALSE; + return false; } SDL_memcpy(*pBytecode, code, codeSize); *pBytecodeSize = codeSize; } - return SDL_TRUE; + return true; } static D3D12ComputeRootSignature *D3D12_INTERNAL_CreateComputeRootSignature( @@ -2311,10 +2311,10 @@ static SDL_GPUComputePipeline *D3D12_CreateComputePipeline( return (SDL_GPUComputePipeline *)computePipeline; } -static SDL_bool D3D12_INTERNAL_ConvertRasterizerState(SDL_GPURasterizerState rasterizerState, D3D12_RASTERIZER_DESC *desc) +static bool D3D12_INTERNAL_ConvertRasterizerState(SDL_GPURasterizerState rasterizerState, D3D12_RASTERIZER_DESC *desc) { if (!desc) { - return SDL_FALSE; + return false; } desc->FillMode = SDLToD3D12_FillMode[rasterizerState.fillMode]; @@ -2328,7 +2328,7 @@ static SDL_bool D3D12_INTERNAL_ConvertRasterizerState(SDL_GPURasterizerState ras desc->FrontCounterClockwise = FALSE; break; default: - return SDL_FALSE; + return false; } if (rasterizerState.depthBiasEnable) { @@ -2347,13 +2347,13 @@ static SDL_bool D3D12_INTERNAL_ConvertRasterizerState(SDL_GPURasterizerState ras desc->ForcedSampleCount = 0; desc->ConservativeRaster = D3D12_CONSERVATIVE_RASTERIZATION_MODE_OFF; - return SDL_TRUE; + return true; } -static SDL_bool D3D12_INTERNAL_ConvertBlendState(SDL_GPUGraphicsPipelineCreateInfo *pipelineInfo, D3D12_BLEND_DESC *blendDesc) +static bool D3D12_INTERNAL_ConvertBlendState(SDL_GPUGraphicsPipelineCreateInfo *pipelineInfo, D3D12_BLEND_DESC *blendDesc) { if (!blendDesc) { - return SDL_FALSE; + return false; } SDL_zerop(blendDesc); @@ -2395,19 +2395,19 @@ static SDL_bool D3D12_INTERNAL_ConvertBlendState(SDL_GPUGraphicsPipelineCreateIn blendDesc->RenderTarget[i] = rtBlendDesc; } - return SDL_TRUE; + return true; } -static SDL_bool D3D12_INTERNAL_ConvertDepthStencilState(SDL_GPUDepthStencilState depthStencilState, D3D12_DEPTH_STENCIL_DESC *desc) +static bool D3D12_INTERNAL_ConvertDepthStencilState(SDL_GPUDepthStencilState depthStencilState, D3D12_DEPTH_STENCIL_DESC *desc) { if (desc == NULL) { - return SDL_FALSE; + return false; } - desc->DepthEnable = depthStencilState.depthTestEnable == SDL_TRUE ? TRUE : FALSE; - desc->DepthWriteMask = depthStencilState.depthWriteEnable == SDL_TRUE ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO; + desc->DepthEnable = depthStencilState.depthTestEnable == true ? TRUE : FALSE; + desc->DepthWriteMask = depthStencilState.depthWriteEnable == true ? D3D12_DEPTH_WRITE_MASK_ALL : D3D12_DEPTH_WRITE_MASK_ZERO; desc->DepthFunc = SDLToD3D12_CompareOp[depthStencilState.compareOp]; - desc->StencilEnable = depthStencilState.stencilTestEnable == SDL_TRUE ? TRUE : FALSE; + desc->StencilEnable = depthStencilState.stencilTestEnable == true ? TRUE : FALSE; desc->StencilReadMask = depthStencilState.compareMask; desc->StencilWriteMask = depthStencilState.writeMask; @@ -2421,13 +2421,13 @@ static SDL_bool D3D12_INTERNAL_ConvertDepthStencilState(SDL_GPUDepthStencilState desc->BackFace.StencilPassOp = SDLToD3D12_StencilOp[depthStencilState.backStencilState.passOp]; desc->BackFace.StencilFunc = SDLToD3D12_CompareOp[depthStencilState.backStencilState.compareOp]; - return SDL_TRUE; + return true; } -static SDL_bool D3D12_INTERNAL_ConvertVertexInputState(SDL_GPUVertexInputState vertexInputState, D3D12_INPUT_ELEMENT_DESC *desc, const char *semantic) +static bool D3D12_INTERNAL_ConvertVertexInputState(SDL_GPUVertexInputState vertexInputState, D3D12_INPUT_ELEMENT_DESC *desc, const char *semantic) { if (desc == NULL || vertexInputState.vertexAttributeCount == 0) { - return SDL_FALSE; + return false; } for (Uint32 i = 0; i < vertexInputState.vertexAttributeCount; i += 1) { @@ -2442,7 +2442,7 @@ static SDL_bool D3D12_INTERNAL_ConvertVertexInputState(SDL_GPUVertexInputState v desc[i].InstanceDataStepRate = (vertexInputState.vertexBindings[attribute.binding].inputRate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) ? vertexInputState.vertexBindings[attribute.binding].instanceStepRate : 0; } - return SDL_TRUE; + return true; } static void D3D12_INTERNAL_AssignCpuDescriptorHandle( @@ -2670,7 +2670,7 @@ static SDL_GPUShader *D3D12_CreateShader( static D3D12Texture *D3D12_INTERNAL_CreateTexture( D3D12Renderer *renderer, SDL_GPUTextureCreateInfo *textureCreateInfo, - SDL_bool isSwapchainTexture) + bool isSwapchainTexture) { D3D12Texture *texture; ID3D12Resource *handle; @@ -2680,7 +2680,7 @@ static D3D12Texture *D3D12_INTERNAL_CreateTexture( D3D12_RESOURCE_FLAGS resourceFlags = (D3D12_RESOURCE_FLAGS)0; D3D12_RESOURCE_STATES initialState = (D3D12_RESOURCE_STATES)0; D3D12_CLEAR_VALUE clearValue; - SDL_bool useClearValue = SDL_FALSE; + bool useClearValue = false; HRESULT res; texture = (D3D12Texture *)SDL_calloc(1, sizeof(D3D12Texture)); @@ -2693,7 +2693,7 @@ static D3D12Texture *D3D12_INTERNAL_CreateTexture( if (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT) { resourceFlags |= D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; - useClearValue = SDL_TRUE; + useClearValue = true; clearValue.Color[0] = SDL_GetFloatProperty(textureCreateInfo->props, SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT, 0); clearValue.Color[1] = SDL_GetFloatProperty(textureCreateInfo->props, SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT, 0); clearValue.Color[2] = SDL_GetFloatProperty(textureCreateInfo->props, SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT, 0); @@ -2702,7 +2702,7 @@ static D3D12Texture *D3D12_INTERNAL_CreateTexture( if (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT) { resourceFlags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL; - useClearValue = SDL_TRUE; + useClearValue = true; clearValue.DepthStencil.Depth = SDL_GetFloatProperty(textureCreateInfo->props, SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT, 0); clearValue.DepthStencil.Stencil = (UINT8)SDL_GetNumberProperty(textureCreateInfo->props, SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8, 0); } @@ -2959,12 +2959,12 @@ static SDL_GPUTexture *D3D12_CreateTexture( } container->debugName = NULL; - container->canBeCycled = SDL_TRUE; + container->canBeCycled = true; D3D12Texture *texture = D3D12_INTERNAL_CreateTexture( (D3D12Renderer *)driverData, textureCreateInfo, - SDL_FALSE); + false); if (!texture) { SDL_free(container->textures); @@ -3313,7 +3313,7 @@ static void D3D12_SetTextureName( * on D3D12... works on renderdoc! */ -static SDL_bool D3D12_INTERNAL_StrToWStr( +static bool D3D12_INTERNAL_StrToWStr( D3D12Renderer *renderer, const char *str, wchar_t *wstr, @@ -3346,12 +3346,12 @@ static SDL_bool D3D12_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 D3D12_InsertDebugLabel( @@ -3606,7 +3606,7 @@ static void D3D12_INTERNAL_CycleActiveTexture( texture = D3D12_INTERNAL_CreateTexture( renderer, &container->header.info, - SDL_FALSE); + false); if (!texture) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to cycle active texture!"); @@ -3640,7 +3640,7 @@ static D3D12TextureSubresource *D3D12_INTERNAL_PrepareTextureSubresourceForWrite D3D12TextureContainer *container, Uint32 layer, Uint32 level, - SDL_bool cycle, + bool cycle, D3D12_RESOURCE_STATES destinationUsageMode) { D3D12TextureSubresource *subresource = D3D12_INTERNAL_FetchTextureSubresource( @@ -3720,7 +3720,7 @@ static void D3D12_INTERNAL_CycleActiveBuffer( static D3D12Buffer *D3D12_INTERNAL_PrepareBufferForWrite( D3D12CommandBuffer *commandBuffer, D3D12BufferContainer *container, - SDL_bool cycle, + bool cycle, D3D12_RESOURCE_STATES destinationState) { if ( @@ -3875,7 +3875,7 @@ static void D3D12_BeginRenderPass( d3d12CommandBuffer->graphicsCommandList, colorAttachmentCount, rtvs, - SDL_FALSE, + false, (depthStencilAttachmentInfo == NULL) ? NULL : &dsv); // Set sensible default viewport state @@ -4061,11 +4061,11 @@ static void D3D12_INTERNAL_PushUniformData( uniformBuffer->writeOffset += uniformBuffer->currentBlockSize; if (shaderStage == SDL_GPU_SHADERSTAGE_VERTEX) { - commandBuffer->needVertexUniformBufferBind[slotIndex] = SDL_TRUE; + commandBuffer->needVertexUniformBufferBind[slotIndex] = true; } else if (shaderStage == SDL_GPU_SHADERSTAGE_FRAGMENT) { - commandBuffer->needFragmentUniformBufferBind[slotIndex] = SDL_TRUE; + commandBuffer->needFragmentUniformBufferBind[slotIndex] = true; } else if (shaderStage == SDL_GPU_SHADERSTAGE_COMPUTE) { - commandBuffer->needComputeUniformBufferBind[slotIndex] = SDL_TRUE; + commandBuffer->needComputeUniformBufferBind[slotIndex] = true; } else { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Unrecognized shader stage!"); } @@ -4099,16 +4099,16 @@ static void D3D12_BindGraphicsPipeline( ID3D12GraphicsCommandList_OMSetStencilRef(d3d12CommandBuffer->graphicsCommandList, pipeline->stencilRef); // Mark that bindings are needed - d3d12CommandBuffer->needVertexSamplerBind = SDL_TRUE; - d3d12CommandBuffer->needVertexStorageTextureBind = SDL_TRUE; - d3d12CommandBuffer->needVertexStorageBufferBind = SDL_TRUE; - d3d12CommandBuffer->needFragmentSamplerBind = SDL_TRUE; - d3d12CommandBuffer->needFragmentStorageTextureBind = SDL_TRUE; - d3d12CommandBuffer->needFragmentStorageBufferBind = SDL_TRUE; + d3d12CommandBuffer->needVertexSamplerBind = true; + d3d12CommandBuffer->needVertexStorageTextureBind = true; + d3d12CommandBuffer->needVertexStorageBufferBind = true; + d3d12CommandBuffer->needFragmentSamplerBind = true; + d3d12CommandBuffer->needFragmentStorageTextureBind = true; + d3d12CommandBuffer->needFragmentStorageBufferBind = true; for (i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) { - d3d12CommandBuffer->needVertexUniformBufferBind[i] = SDL_TRUE; - d3d12CommandBuffer->needFragmentUniformBufferBind[i] = SDL_TRUE; + d3d12CommandBuffer->needVertexUniformBufferBind[i] = true; + d3d12CommandBuffer->needFragmentUniformBufferBind[i] = true; } for (i = 0; i < pipeline->vertexUniformBufferCount; i += 1) { @@ -4146,7 +4146,7 @@ static void D3D12_BindVertexBuffers( d3d12CommandBuffer->vertexBufferCount = SDL_max(d3d12CommandBuffer->vertexBufferCount, firstBinding + bindingCount); - d3d12CommandBuffer->needVertexBufferBind = SDL_TRUE; + d3d12CommandBuffer->needVertexBufferBind = true; } static void D3D12_BindIndexBuffer( @@ -4194,7 +4194,7 @@ static void D3D12_BindVertexSamplers( d3d12CommandBuffer->vertexSamplerTextures[firstSlot + i] = container->activeTexture; } - d3d12CommandBuffer->needVertexSamplerBind = SDL_TRUE; + d3d12CommandBuffer->needVertexSamplerBind = true; } static void D3D12_BindVertexStorageTextures( @@ -4214,7 +4214,7 @@ static void D3D12_BindVertexStorageTextures( d3d12CommandBuffer->vertexStorageTextures[firstSlot + i] = texture; } - d3d12CommandBuffer->needVertexStorageTextureBind = SDL_TRUE; + d3d12CommandBuffer->needVertexStorageTextureBind = true; } static void D3D12_BindVertexStorageBuffers( @@ -4235,7 +4235,7 @@ static void D3D12_BindVertexStorageBuffers( d3d12CommandBuffer->vertexStorageBuffers[firstSlot + i] = container->activeBuffer; } - d3d12CommandBuffer->needVertexStorageBufferBind = SDL_TRUE; + d3d12CommandBuffer->needVertexStorageBufferBind = true; } static void D3D12_BindFragmentSamplers( @@ -4262,7 +4262,7 @@ static void D3D12_BindFragmentSamplers( d3d12CommandBuffer->fragmentSamplerTextures[firstSlot + i] = container->activeTexture; } - d3d12CommandBuffer->needFragmentSamplerBind = SDL_TRUE; + d3d12CommandBuffer->needFragmentSamplerBind = true; } static void D3D12_BindFragmentStorageTextures( @@ -4282,7 +4282,7 @@ static void D3D12_BindFragmentStorageTextures( d3d12CommandBuffer->fragmentStorageTextures[firstSlot + i] = texture; } - d3d12CommandBuffer->needFragmentStorageTextureBind = SDL_TRUE; + d3d12CommandBuffer->needFragmentStorageTextureBind = true; } static void D3D12_BindFragmentStorageBuffers( @@ -4303,7 +4303,7 @@ static void D3D12_BindFragmentStorageBuffers( d3d12CommandBuffer->fragmentStorageBuffers[firstSlot + i] = container->activeBuffer; } - d3d12CommandBuffer->needFragmentStorageBufferBind = SDL_TRUE; + d3d12CommandBuffer->needFragmentStorageBufferBind = true; } static void D3D12_PushVertexUniformData( @@ -4422,7 +4422,7 @@ static void D3D12_INTERNAL_BindGraphicsResources( graphicsPipeline->rootSignature->vertexSamplerTextureRootIndex, gpuDescriptorHandle); } - commandBuffer->needVertexSamplerBind = SDL_FALSE; + commandBuffer->needVertexSamplerBind = false; } if (commandBuffer->needVertexStorageTextureBind) { @@ -4443,7 +4443,7 @@ static void D3D12_INTERNAL_BindGraphicsResources( graphicsPipeline->rootSignature->vertexStorageTextureRootIndex, gpuDescriptorHandle); } - commandBuffer->needVertexStorageTextureBind = SDL_FALSE; + commandBuffer->needVertexStorageTextureBind = false; } if (commandBuffer->needVertexStorageBufferBind) { @@ -4464,7 +4464,7 @@ static void D3D12_INTERNAL_BindGraphicsResources( graphicsPipeline->rootSignature->vertexStorageBufferRootIndex, gpuDescriptorHandle); } - commandBuffer->needVertexStorageBufferBind = SDL_FALSE; + commandBuffer->needVertexStorageBufferBind = false; } for (Uint32 i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) { @@ -4475,7 +4475,7 @@ static void D3D12_INTERNAL_BindGraphicsResources( graphicsPipeline->rootSignature->vertexUniformBufferRootIndex[i], commandBuffer->vertexUniformBuffers[i]->buffer->virtualAddress + commandBuffer->vertexUniformBuffers[i]->drawOffset); } - commandBuffer->needVertexUniformBufferBind[i] = SDL_FALSE; + commandBuffer->needVertexUniformBufferBind[i] = false; } } @@ -4513,7 +4513,7 @@ static void D3D12_INTERNAL_BindGraphicsResources( graphicsPipeline->rootSignature->fragmentSamplerTextureRootIndex, gpuDescriptorHandle); } - commandBuffer->needFragmentSamplerBind = SDL_FALSE; + commandBuffer->needFragmentSamplerBind = false; } if (commandBuffer->needFragmentStorageTextureBind) { @@ -4534,7 +4534,7 @@ static void D3D12_INTERNAL_BindGraphicsResources( graphicsPipeline->rootSignature->fragmentStorageTextureRootIndex, gpuDescriptorHandle); } - commandBuffer->needFragmentStorageTextureBind = SDL_FALSE; + commandBuffer->needFragmentStorageTextureBind = false; } if (commandBuffer->needFragmentStorageBufferBind) { @@ -4555,7 +4555,7 @@ static void D3D12_INTERNAL_BindGraphicsResources( graphicsPipeline->rootSignature->fragmentStorageBufferRootIndex, gpuDescriptorHandle); } - commandBuffer->needFragmentStorageBufferBind = SDL_FALSE; + commandBuffer->needFragmentStorageBufferBind = false; } for (Uint32 i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) { @@ -4566,7 +4566,7 @@ static void D3D12_INTERNAL_BindGraphicsResources( graphicsPipeline->rootSignature->fragmentUniformBufferRootIndex[i], commandBuffer->fragmentUniformBuffers[i]->buffer->virtualAddress + commandBuffer->fragmentUniformBuffers[i]->drawOffset); } - commandBuffer->needFragmentUniformBufferBind[i] = SDL_FALSE; + commandBuffer->needFragmentUniformBufferBind[i] = false; } } } @@ -4720,7 +4720,7 @@ static void D3D12_EndRenderPass( d3d12CommandBuffer->graphicsCommandList, 0, NULL, - SDL_FALSE, + false, NULL); // Reset bind state @@ -4823,11 +4823,11 @@ static void D3D12_BindComputePipeline( d3d12CommandBuffer->currentComputePipeline = pipeline; - d3d12CommandBuffer->needComputeReadOnlyStorageTextureBind = SDL_TRUE; - d3d12CommandBuffer->needComputeReadOnlyStorageBufferBind = SDL_TRUE; + d3d12CommandBuffer->needComputeReadOnlyStorageTextureBind = true; + d3d12CommandBuffer->needComputeReadOnlyStorageBufferBind = true; for (Uint32 i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) { - d3d12CommandBuffer->needComputeUniformBufferBind[i] = SDL_TRUE; + d3d12CommandBuffer->needComputeUniformBufferBind[i] = true; } for (Uint32 i = 0; i < pipeline->uniformBufferCount; i += 1) { @@ -4906,7 +4906,7 @@ static void D3D12_BindComputeStorageTextures( container->activeTexture); } - d3d12CommandBuffer->needComputeReadOnlyStorageTextureBind = SDL_TRUE; + d3d12CommandBuffer->needComputeReadOnlyStorageTextureBind = true; } static void D3D12_BindComputeStorageBuffers( @@ -4940,7 +4940,7 @@ static void D3D12_BindComputeStorageBuffers( buffer); } - d3d12CommandBuffer->needComputeReadOnlyStorageBufferBind = SDL_TRUE; + d3d12CommandBuffer->needComputeReadOnlyStorageBufferBind = true; } static void D3D12_PushComputeUniformData( @@ -4985,7 +4985,7 @@ static void D3D12_INTERNAL_BindComputeResources( computePipeline->rootSignature->readOnlyStorageTextureRootIndex, gpuDescriptorHandle); } - commandBuffer->needComputeReadOnlyStorageTextureBind = SDL_FALSE; + commandBuffer->needComputeReadOnlyStorageTextureBind = false; } if (commandBuffer->needComputeReadOnlyStorageBufferBind) { @@ -5006,7 +5006,7 @@ static void D3D12_INTERNAL_BindComputeResources( computePipeline->rootSignature->readOnlyStorageBufferRootIndex, gpuDescriptorHandle); } - commandBuffer->needComputeReadOnlyStorageBufferBind = SDL_FALSE; + commandBuffer->needComputeReadOnlyStorageBufferBind = false; } for (Uint32 i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) { @@ -5018,7 +5018,7 @@ static void D3D12_INTERNAL_BindComputeResources( commandBuffer->computeUniformBuffers[i]->buffer->virtualAddress + commandBuffer->computeUniformBuffers[i]->drawOffset); } } - commandBuffer->needComputeUniformBufferBind[i] = SDL_FALSE; + commandBuffer->needComputeUniformBufferBind[i] = false; } } @@ -5116,7 +5116,7 @@ static void D3D12_EndComputePass( static void *D3D12_MapTransferBuffer( SDL_GPURenderer *driverData, SDL_GPUTransferBuffer *transferBuffer, - SDL_bool cycle) + bool cycle) { D3D12Renderer *renderer = (D3D12Renderer *)driverData; D3D12BufferContainer *container = (D3D12BufferContainer *)transferBuffer; @@ -5173,7 +5173,7 @@ static void D3D12_UploadToTexture( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUTextureTransferInfo *source, SDL_GPUTextureRegion *destination, - SDL_bool cycle) + bool cycle) { D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; D3D12BufferContainer *transferBufferContainer = (D3D12BufferContainer *)source->transferBuffer; @@ -5185,8 +5185,8 @@ static void D3D12_UploadToTexture( Uint32 alignedRowPitch; Uint32 rowsPerSlice = source->imageHeight; Uint32 bytesPerSlice; - SDL_bool needsRealignment; - SDL_bool needsPlacementCopy; + bool needsRealignment; + bool needsPlacementCopy; // Note that the transfer buffer does not need a barrier, as it is synced by the client. @@ -5349,7 +5349,7 @@ static void D3D12_UploadToBuffer( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUTransferBufferLocation *source, SDL_GPUBufferRegion *destination, - SDL_bool cycle) + bool cycle) { D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; D3D12BufferContainer *transferBufferContainer = (D3D12BufferContainer *)source->transferBuffer; @@ -5387,7 +5387,7 @@ static void D3D12_CopyTextureToTexture( Uint32 w, Uint32 h, Uint32 d, - SDL_bool cycle) + bool cycle) { D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; D3D12_TEXTURE_COPY_LOCATION sourceLocation; @@ -5454,7 +5454,7 @@ static void D3D12_CopyBufferToBuffer( SDL_GPUBufferLocation *source, SDL_GPUBufferLocation *destination, Uint32 size, - SDL_bool cycle) + bool cycle) { D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; D3D12BufferContainer *sourceContainer = (D3D12BufferContainer *)source->buffer; @@ -5506,8 +5506,8 @@ static void D3D12_DownloadFromTexture( Uint32 rowPitch; Uint32 alignedRowPitch; Uint32 rowsPerSlice = destination->imageHeight; - SDL_bool needsRealignment; - SDL_bool needsPlacementCopy; + bool needsRealignment; + bool needsPlacementCopy; D3D12TextureDownload *textureDownload = NULL; D3D12TextureContainer *sourceContainer = (D3D12TextureContainer *)source->texture; D3D12TextureSubresource *sourceSubresource = D3D12_INTERNAL_FetchTextureSubresource( @@ -5728,7 +5728,7 @@ static void D3D12_GenerateMipmaps( &dstRegion, SDL_FLIP_NONE, SDL_GPU_FILTER_LINEAR, - SDL_FALSE); + false); } } @@ -5741,7 +5741,7 @@ static void D3D12_Blit( SDL_GPUBlitRegion *destination, SDL_FlipMode flipMode, SDL_GPUFilter filterMode, - SDL_bool cycle) + bool cycle) { D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; D3D12Renderer *renderer = (D3D12Renderer *)d3d12CommandBuffer->renderer; @@ -5774,7 +5774,7 @@ static D3D12WindowData *D3D12_INTERNAL_FetchWindowData( return (D3D12WindowData *)SDL_GetPointerProperty(properties, WINDOW_PROPERTY_DATA, NULL); } -static SDL_bool D3D12_SupportsSwapchainComposition( +static bool D3D12_SupportsSwapchainComposition( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUSwapchainComposition swapchainComposition) @@ -5800,17 +5800,17 @@ static SDL_bool D3D12_SupportsSwapchainComposition( sizeof(formatSupport)); if (FAILED(res)) { // Format is apparently unknown - return SDL_FALSE; + return false; } if (!(formatSupport.Support1 & D3D12_FORMAT_SUPPORT1_DISPLAY)) { - return SDL_FALSE; + return false; } D3D12WindowData *windowData = D3D12_INTERNAL_FetchWindowData(window); if (windowData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Must claim window before querying swapchain composition support!"); - return SDL_FALSE; + return false; } // Check the color space support if necessary @@ -5821,15 +5821,15 @@ static SDL_bool D3D12_SupportsSwapchainComposition( &colorSpaceSupport); if (!(colorSpaceSupport & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT)) { - return SDL_FALSE; + return false; } } #endif - return SDL_TRUE; + return true; } -static SDL_bool D3D12_SupportsPresentMode( +static bool D3D12_SupportsPresentMode( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUPresentMode presentMode) @@ -5840,21 +5840,21 @@ static SDL_bool D3D12_SupportsPresentMode( switch (presentMode) { case SDL_GPU_PRESENTMODE_IMMEDIATE: case SDL_GPU_PRESENTMODE_VSYNC: - return SDL_TRUE; + return true; case SDL_GPU_PRESENTMODE_MAILBOX: #if (defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) - return SDL_FALSE; + return false; #else - return SDL_TRUE; + return true; #endif default: SDL_assert(!"Unrecognized present mode"); - return SDL_FALSE; + return false; } } #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) -static SDL_bool D3D12_INTERNAL_CreateSwapchain( +static bool D3D12_INTERNAL_CreateSwapchain( D3D12Renderer *renderer, D3D12WindowData *windowData, SDL_GPUSwapchainComposition swapchainComposition, @@ -5878,10 +5878,10 @@ static SDL_bool D3D12_INTERNAL_CreateSwapchain( createInfo.levelCount = 1; for (Uint32 i = 0; i < MAX_FRAMES_IN_FLIGHT; i += 1) { - texture = D3D12_INTERNAL_CreateTexture(renderer, &createInfo, SDL_TRUE); + texture = D3D12_INTERNAL_CreateTexture(renderer, &createInfo, true); texture->container = &windowData->textureContainers[i]; windowData->textureContainers[i].activeTexture = texture; - windowData->textureContainers[i].canBeCycled = SDL_FALSE; + windowData->textureContainers[i].canBeCycled = false; windowData->textureContainers[i].header.info = createInfo; windowData->textureContainers[i].textureCapacity = 1; windowData->textureContainers[i].textureCount = 1; @@ -5912,7 +5912,7 @@ static SDL_bool D3D12_INTERNAL_CreateSwapchain( &renderer->blitPipelineCapacity); } - return SDL_TRUE; + return true; } static void D3D12_INTERNAL_DestroySwapchain( @@ -5927,7 +5927,7 @@ static void D3D12_INTERNAL_DestroySwapchain( } } -static SDL_bool D3D12_INTERNAL_ResizeSwapchainIfNeeded( +static bool D3D12_INTERNAL_ResizeSwapchainIfNeeded( D3D12Renderer *renderer, D3D12WindowData *windowData) { @@ -5956,10 +5956,10 @@ static SDL_bool D3D12_INTERNAL_ResizeSwapchainIfNeeded( windowData->presentMode); } - return SDL_TRUE; + return true; } #else -static SDL_bool D3D12_INTERNAL_InitializeSwapchainTexture( +static bool D3D12_INTERNAL_InitializeSwapchainTexture( D3D12Renderer *renderer, IDXGISwapChain3 *swapchain, SDL_GPUSwapchainComposition composition, @@ -5984,7 +5984,7 @@ static SDL_bool D3D12_INTERNAL_InitializeSwapchainTexture( pTexture = (D3D12Texture *)SDL_calloc(1, sizeof(D3D12Texture)); if (!pTexture) { ID3D12Resource_Release(swapchainTexture); - return SDL_FALSE; + return false; } pTexture->resource = NULL; // This will be set in AcquireSwapchainTexture SDL_AtomicSet(&pTexture->referenceCount, 0); @@ -5993,7 +5993,7 @@ static SDL_bool D3D12_INTERNAL_InitializeSwapchainTexture( if (!pTexture->subresources) { SDL_free(pTexture); ID3D12Resource_Release(swapchainTexture); - return SDL_FALSE; + return false; } pTexture->subresources[0].rtvHandles = SDL_calloc(1, sizeof(D3D12CPUDescriptor)); pTexture->subresources[0].uavHandle.heap = NULL; @@ -6020,14 +6020,14 @@ static SDL_bool D3D12_INTERNAL_InitializeSwapchainTexture( SDL_free(pTexture->subresources); SDL_free(pTexture); ID3D12Resource_Release(swapchainTexture); - return SDL_FALSE; + return false; } pTextureContainer->textureCapacity = 1; pTextureContainer->textureCount = 1; pTextureContainer->textures[0] = pTexture; pTextureContainer->activeTexture = pTexture; - pTextureContainer->canBeCycled = SDL_FALSE; + pTextureContainer->canBeCycled = false; pTexture->container = pTextureContainer; pTexture->containerIndex = 0; @@ -6071,10 +6071,10 @@ static SDL_bool D3D12_INTERNAL_InitializeSwapchainTexture( ID3D12Resource_Release(swapchainTexture); - return SDL_TRUE; + return true; } -static SDL_bool D3D12_INTERNAL_ResizeSwapchainIfNeeded( +static bool D3D12_INTERNAL_ResizeSwapchainIfNeeded( D3D12Renderer *renderer, D3D12WindowData *windowData) { @@ -6121,12 +6121,12 @@ static SDL_bool D3D12_INTERNAL_ResizeSwapchainIfNeeded( windowData->swapchainComposition, i, &windowData->textureContainers[i])) { - return SDL_FALSE; + return false; } } } - return SDL_TRUE; + return true; } static void D3D12_INTERNAL_DestroySwapchain( @@ -6152,7 +6152,7 @@ static void D3D12_INTERNAL_DestroySwapchain( windowData->swapchain = NULL; } -static SDL_bool D3D12_INTERNAL_CreateSwapchain( +static bool D3D12_INTERNAL_CreateSwapchain( D3D12Renderer *renderer, D3D12WindowData *windowData, SDL_GPUSwapchainComposition swapchainComposition, @@ -6199,7 +6199,7 @@ static SDL_bool D3D12_INTERNAL_CreateSwapchain( fullscreenDesc.RefreshRate.Denominator = 0; fullscreenDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; fullscreenDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED; - fullscreenDesc.Windowed = SDL_TRUE; + fullscreenDesc.Windowed = true; if (renderer->supportsTearing) { swapchainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; @@ -6209,7 +6209,7 @@ static SDL_bool D3D12_INTERNAL_CreateSwapchain( #ifndef SDL_PLATFORM_WINRT if (!IsWindow(dxgiHandle)) { - return SDL_FALSE; + return false; } #endif @@ -6305,15 +6305,15 @@ static SDL_bool D3D12_INTERNAL_CreateSwapchain( i, &windowData->textureContainers[i])) { IDXGISwapChain3_Release(swapchain3); - return SDL_FALSE; + return false; } } - return SDL_TRUE; + return true; } #endif -static SDL_bool D3D12_ClaimWindow( +static bool D3D12_ClaimWindow( SDL_GPURenderer *driverData, SDL_Window *window) { @@ -6323,7 +6323,7 @@ static SDL_bool D3D12_ClaimWindow( if (windowData == NULL) { windowData = (D3D12WindowData *)SDL_calloc(1, sizeof(D3D12WindowData)); if (!windowData) { - return SDL_FALSE; + return false; } windowData->window = window; @@ -6343,15 +6343,15 @@ static SDL_bool D3D12_ClaimWindow( SDL_UnlockMutex(renderer->windowLock); - return SDL_TRUE; + return true; } else { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create swapchain, failed to claim window!"); SDL_free(windowData); - return SDL_FALSE; + return false; } } else { SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Window already claimed!"); - return SDL_FALSE; + return false; } } @@ -6394,7 +6394,7 @@ static void D3D12_UnclaimWindow( SDL_ClearProperty(SDL_GetWindowProperties(window), WINDOW_PROPERTY_DATA); } -static SDL_bool D3D12_SetSwapchainParameters( +static bool D3D12_SetSwapchainParameters( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUSwapchainComposition swapchainComposition, @@ -6405,17 +6405,17 @@ static SDL_bool D3D12_SetSwapchainParameters( if (windowData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Cannot set swapchain parameters on unclaimed window!"); - return SDL_FALSE; + return false; } if (!D3D12_SupportsSwapchainComposition(driverData, window, swapchainComposition)) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Swapchain composition not supported!"); - return SDL_FALSE; + return false; } if (!D3D12_SupportsPresentMode(driverData, window, presentMode)) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Present mode not supported!"); - return SDL_FALSE; + return false; } if ( @@ -6435,7 +6435,7 @@ static SDL_bool D3D12_SetSwapchainParameters( presentMode); } - return SDL_TRUE; + return true; } static SDL_GPUTextureFormat D3D12_GetSwapchainTextureFormat( @@ -6701,7 +6701,7 @@ static SDL_GPUCommandBuffer *D3D12_AcquireCommandBuffer( SDL_zeroa(commandBuffer->computeWriteOnlyStorageBuffers); SDL_zeroa(commandBuffer->computeUniformBuffers); - commandBuffer->autoReleaseFence = SDL_TRUE; + commandBuffer->autoReleaseFence = true; return (SDL_GPUCommandBuffer *)commandBuffer; } @@ -6733,7 +6733,7 @@ static SDL_GPUTexture *D3D12_AcquireSwapchainTexture( // In VSYNC mode, block until the least recent presented frame is done D3D12_WaitForFences( (SDL_GPURenderer *)renderer, - SDL_TRUE, + true, (SDL_GPUFence **)&windowData->inFlightFences[windowData->frameCounter], 1); } else { @@ -7183,7 +7183,7 @@ static SDL_GPUFence *D3D12_SubmitAndAcquireFence( SDL_GPUCommandBuffer *commandBuffer) { D3D12CommandBuffer *d3d12CommandBuffer = (D3D12CommandBuffer *)commandBuffer; - d3d12CommandBuffer->autoReleaseFence = SDL_FALSE; + d3d12CommandBuffer->autoReleaseFence = false; D3D12_Submit(commandBuffer); return (SDL_GPUFence *)d3d12CommandBuffer->inFlightFence; } @@ -7236,7 +7236,7 @@ static void D3D12_Wait( static void D3D12_WaitForFences( SDL_GPURenderer *driverData, - SDL_bool waitAll, + bool waitAll, SDL_GPUFence **pFences, Uint32 fenceCount) { @@ -7286,7 +7286,7 @@ static void D3D12_WaitForFences( // Feature Queries -static SDL_bool D3D12_SupportsTextureFormat( +static bool D3D12_SupportsTextureFormat( SDL_GPURenderer *driverData, SDL_GPUTextureFormat format, SDL_GPUTextureType type, @@ -7304,44 +7304,44 @@ static SDL_bool D3D12_SupportsTextureFormat( sizeof(formatSupport)); if (FAILED(res)) { // Format is apparently unknown - return SDL_FALSE; + return false; } // Is the texture type supported? if (type == SDL_GPU_TEXTURETYPE_2D && !(formatSupport.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURE2D)) { - return SDL_FALSE; + return false; } if (type == SDL_GPU_TEXTURETYPE_2D_ARRAY && !(formatSupport.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURE2D)) { - return SDL_FALSE; + return false; } if (type == SDL_GPU_TEXTURETYPE_3D && !(formatSupport.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURE3D)) { - return SDL_FALSE; + return false; } if (type == SDL_GPU_TEXTURETYPE_CUBE && !(formatSupport.Support1 & D3D12_FORMAT_SUPPORT1_TEXTURECUBE)) { - return SDL_FALSE; + return false; } // Are the usage flags supported? if ((usage & SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT) && !(formatSupport.Support1 & D3D12_FORMAT_SUPPORT1_SHADER_SAMPLE)) { - return SDL_FALSE; + return false; } if ((usage & (SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ_BIT | SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ_BIT)) && !(formatSupport.Support1 & D3D12_FORMAT_SUPPORT1_SHADER_LOAD)) { - return SDL_FALSE; + return false; } if ((usage & SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE_BIT) && !(formatSupport.Support2 & D3D12_FORMAT_SUPPORT2_UAV_TYPED_STORE)) { - return SDL_FALSE; + return false; } if ((usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT) && !(formatSupport.Support1 & D3D12_FORMAT_SUPPORT1_RENDER_TARGET)) { - return SDL_FALSE; + return false; } if ((usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT) && !(formatSupport.Support1 & D3D12_FORMAT_SUPPORT1_DEPTH_STENCIL)) { - return SDL_FALSE; + return false; } - return SDL_TRUE; + return true; } -static SDL_bool D3D12_SupportsSampleCount( +static bool D3D12_SupportsSampleCount( SDL_GPURenderer *driverData, SDL_GPUTextureFormat format, SDL_GPUSampleCount sampleCount) @@ -7480,10 +7480,10 @@ static void D3D12_INTERNAL_InitBlitResources( } } -static SDL_bool D3D12_PrepareDriver(SDL_VideoDevice *_this) +static bool D3D12_PrepareDriver(SDL_VideoDevice *_this) { #if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) - return SDL_TRUE; + return true; #else void *d3d12_dll; void *dxgi_dll; @@ -7501,7 +7501,7 @@ static SDL_bool D3D12_PrepareDriver(SDL_VideoDevice *_this) d3d12_dll = SDL_LoadObject(D3D12_DLL); if (d3d12_dll == NULL) { SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "D3D12: Could not find " D3D12_DLL); - return SDL_FALSE; + return false; } D3D12CreateDeviceFunc = (PFN_D3D12_CREATE_DEVICE)SDL_LoadFunction( @@ -7510,7 +7510,7 @@ static SDL_bool D3D12_PrepareDriver(SDL_VideoDevice *_this) if (D3D12CreateDeviceFunc == NULL) { SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "D3D12: Could not find function " D3D12_CREATE_DEVICE_FUNC " in " D3D12_DLL); SDL_UnloadObject(d3d12_dll); - return SDL_FALSE; + return false; } // Can we load DXGI? @@ -7518,7 +7518,7 @@ static SDL_bool D3D12_PrepareDriver(SDL_VideoDevice *_this) dxgi_dll = SDL_LoadObject(DXGI_DLL); if (dxgi_dll == NULL) { SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "D3D12: Could not find " DXGI_DLL); - return SDL_FALSE; + return false; } CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY1)SDL_LoadFunction( @@ -7527,7 +7527,7 @@ static SDL_bool D3D12_PrepareDriver(SDL_VideoDevice *_this) if (CreateDXGIFactoryFunc == NULL) { SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "D3D12: Could not find function " CREATE_DXGI_FACTORY1_FUNC " in " DXGI_DLL); SDL_UnloadObject(dxgi_dll); - return SDL_FALSE; + return false; } // Can we create a device? @@ -7540,7 +7540,7 @@ static SDL_bool D3D12_PrepareDriver(SDL_VideoDevice *_this) SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "D3D12: Could not create DXGIFactory"); SDL_UnloadObject(d3d12_dll); SDL_UnloadObject(dxgi_dll); - return SDL_FALSE; + return false; } // Check for DXGI 1.4 support @@ -7553,7 +7553,7 @@ static SDL_bool D3D12_PrepareDriver(SDL_VideoDevice *_this) SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "D3D12: Failed to find DXGI1.4 support, required for DX12"); SDL_UnloadObject(d3d12_dll); SDL_UnloadObject(dxgi_dll); - return SDL_FALSE; + return false; } IDXGIFactory4_Release(factory4); @@ -7580,7 +7580,7 @@ static SDL_bool D3D12_PrepareDriver(SDL_VideoDevice *_this) IDXGIFactory1_Release(factory); SDL_UnloadObject(d3d12_dll); SDL_UnloadObject(dxgi_dll); - return SDL_FALSE; + return false; } res = D3D12CreateDeviceFunc( @@ -7600,10 +7600,10 @@ static SDL_bool D3D12_PrepareDriver(SDL_VideoDevice *_this) if (FAILED(res)) { SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "D3D12: Could not create D3D12Device with feature level " D3D_FEATURE_LEVEL_CHOICE_STR); - return SDL_FALSE; + return false; } - return SDL_TRUE; + return true; #endif } @@ -7687,18 +7687,18 @@ static void D3D12_INTERNAL_TryInitializeD3D12DebugInfoQueue(D3D12Renderer *rende ID3D12InfoQueue_SetBreakOnSeverity( infoQueue, D3D12_MESSAGE_SEVERITY_ERROR, - SDL_TRUE); + true); ID3D12InfoQueue_SetBreakOnSeverity( infoQueue, D3D12_MESSAGE_SEVERITY_CORRUPTION, - SDL_TRUE); + true); ID3D12InfoQueue_Release(infoQueue); } #endif -static SDL_GPUDevice *D3D12_CreateDevice(SDL_bool debugMode, SDL_bool preferLowPower, SDL_PropertiesID props) +static SDL_GPUDevice *D3D12_CreateDevice(bool debugMode, bool preferLowPower, SDL_PropertiesID props) { SDL_GPUDevice *result; D3D12Renderer *renderer; @@ -7776,7 +7776,7 @@ static SDL_GPUDevice *D3D12_CreateDevice(SDL_bool debugMode, SDL_bool preferLowP &renderer->supportsTearing, sizeof(renderer->supportsTearing)); if (FAILED(res)) { - renderer->supportsTearing = SDL_FALSE; + renderer->supportsTearing = false; } IDXGIFactory5_Release(factory5); } @@ -7940,15 +7940,15 @@ static SDL_GPUDevice *D3D12_CreateDevice(SDL_bool debugMode, SDL_bool preferLowP ERROR_CHECK_RETURN("Could not get device architecture", NULL); } - renderer->UMA = (SDL_bool)architecture.UMA; - renderer->UMACacheCoherent = (SDL_bool)architecture.CacheCoherentUMA; + renderer->UMA = (bool)architecture.UMA; + renderer->UMACacheCoherent = (bool)architecture.CacheCoherentUMA; #if (defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) - renderer->GPUUploadHeapSupported = SDL_FALSE; + renderer->GPUUploadHeapSupported = false; #else // Check "GPU Upload Heap" support (for fast uniform buffers) D3D12_FEATURE_DATA_D3D12_OPTIONS16 options16; // 15 wasn't enough, huh? - renderer->GPUUploadHeapSupported = SDL_FALSE; + renderer->GPUUploadHeapSupported = false; res = ID3D12Device_CheckFeatureSupport( renderer->device, D3D12_FEATURE_D3D12_OPTIONS16, @@ -8083,7 +8083,7 @@ static SDL_GPUDevice *D3D12_CreateDevice(SDL_bool debugMode, SDL_bool preferLowP renderer, (D3D12_DESCRIPTOR_HEAP_TYPE)i, (i <= D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER) ? VIEW_SAMPLER_STAGING_DESCRIPTOR_COUNT : TARGET_STAGING_DESCRIPTOR_COUNT, - SDL_TRUE); + true); } // Initialize GPU descriptor heaps @@ -8099,7 +8099,7 @@ static SDL_GPUDevice *D3D12_CreateDevice(SDL_bool debugMode, SDL_bool preferLowP renderer, (D3D12_DESCRIPTOR_HEAP_TYPE)i, i == D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV ? VIEW_GPU_DESCRIPTOR_COUNT : SAMPLER_GPU_DESCRIPTOR_COUNT, - SDL_FALSE); + false); } } diff --git a/src/gpu/metal/SDL_gpu_metal.m b/src/gpu/metal/SDL_gpu_metal.m index 64b7591e18..02a94e3066 100644 --- a/src/gpu/metal/SDL_gpu_metal.m +++ b/src/gpu/metal/SDL_gpu_metal.m @@ -425,8 +425,8 @@ typedef struct MetalBufferContainer Uint32 bufferCount; MetalBuffer **buffers; - SDL_bool isPrivate; - SDL_bool isWriteOnly; + bool isPrivate; + bool isWriteOnly; char *debugName; } MetalBufferContainer; @@ -467,19 +467,19 @@ typedef struct MetalCommandBuffer MetalComputePipeline *computePipeline; // Resource slot state - SDL_bool needVertexSamplerBind; - SDL_bool needVertexStorageTextureBind; - SDL_bool needVertexStorageBufferBind; - SDL_bool needVertexUniformBind; + bool needVertexSamplerBind; + bool needVertexStorageTextureBind; + bool needVertexStorageBufferBind; + bool needVertexUniformBind; - SDL_bool needFragmentSamplerBind; - SDL_bool needFragmentStorageTextureBind; - SDL_bool needFragmentStorageBufferBind; - SDL_bool needFragmentUniformBind; + bool needFragmentSamplerBind; + bool needFragmentStorageTextureBind; + bool needFragmentStorageBufferBind; + bool needFragmentUniformBind; - SDL_bool needComputeTextureBind; - SDL_bool needComputeBufferBind; - SDL_bool needComputeUniformBind; + bool needComputeTextureBind; + bool needComputeBufferBind; + bool needComputeUniformBind; id vertexSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; id vertexTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE]; @@ -538,7 +538,7 @@ struct MetalRenderer id device; id queue; - SDL_bool debugMode; + bool debugMode; MetalWindowData **claimedWindows; Uint32 claimedWindowCount; @@ -1346,7 +1346,7 @@ static MetalTexture *METAL_INTERNAL_CreateTexture( return metalTexture; } -static SDL_bool METAL_SupportsSampleCount( +static bool METAL_SupportsSampleCount( SDL_GPURenderer *driverData, SDL_GPUTextureFormat format, SDL_GPUSampleCount sampleCount) @@ -1395,7 +1395,7 @@ static SDL_GPUTexture *METAL_CreateTexture( static MetalTexture *METAL_INTERNAL_PrepareTextureForWrite( MetalRenderer *renderer, MetalTextureContainer *container, - SDL_bool cycle) + bool cycle) { Uint32 i; @@ -1459,8 +1459,8 @@ static MetalBuffer *METAL_INTERNAL_CreateBuffer( static MetalBufferContainer *METAL_INTERNAL_CreateBufferContainer( MetalRenderer *renderer, Uint32 sizeInBytes, - SDL_bool isPrivate, - SDL_bool isWriteOnly) + bool isPrivate, + bool isWriteOnly) { MetalBufferContainer *container = SDL_malloc(sizeof(MetalBufferContainer)); MTLResourceOptions resourceOptions; @@ -1502,8 +1502,8 @@ static SDL_GPUBuffer *METAL_CreateBuffer( return (SDL_GPUBuffer *)METAL_INTERNAL_CreateBufferContainer( (MetalRenderer *)driverData, sizeInBytes, - SDL_TRUE, - SDL_FALSE); + true, + false); } } @@ -1516,7 +1516,7 @@ static SDL_GPUTransferBuffer *METAL_CreateTransferBuffer( return (SDL_GPUTransferBuffer *)METAL_INTERNAL_CreateBufferContainer( (MetalRenderer *)driverData, sizeInBytes, - SDL_FALSE, + false, usage == SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD); } } @@ -1547,7 +1547,7 @@ static MetalUniformBuffer *METAL_INTERNAL_CreateUniformBuffer( static MetalBuffer *METAL_INTERNAL_PrepareBufferForWrite( MetalRenderer *renderer, MetalBufferContainer *container, - SDL_bool cycle) + bool cycle) { MTLResourceOptions resourceOptions; Uint32 i; @@ -1599,7 +1599,7 @@ static MetalBuffer *METAL_INTERNAL_PrepareBufferForWrite( static void *METAL_MapTransferBuffer( SDL_GPURenderer *driverData, SDL_GPUTransferBuffer *transferBuffer, - SDL_bool cycle) + bool cycle) { @autoreleasepool { MetalRenderer *renderer = (MetalRenderer *)driverData; @@ -1640,7 +1640,7 @@ static void METAL_UploadToTexture( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUTextureTransferInfo *source, SDL_GPUTextureRegion *destination, - SDL_bool cycle) + bool cycle) { @autoreleasepool { MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer; @@ -1670,7 +1670,7 @@ static void METAL_UploadToBuffer( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUTransferBufferLocation *source, SDL_GPUBufferRegion *destination, - SDL_bool cycle) + bool cycle) { @autoreleasepool { MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer; @@ -1702,7 +1702,7 @@ static void METAL_CopyTextureToTexture( Uint32 w, Uint32 h, Uint32 d, - SDL_bool cycle) + bool cycle) { @autoreleasepool { MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer; @@ -1737,7 +1737,7 @@ static void METAL_CopyBufferToBuffer( SDL_GPUBufferLocation *source, SDL_GPUBufferLocation *destination, Uint32 size, - SDL_bool cycle) + bool cycle) { @autoreleasepool { MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer; @@ -1781,7 +1781,7 @@ static void METAL_DownloadFromTexture( MetalBuffer *dstBuffer = METAL_INTERNAL_PrepareBufferForWrite( renderer, bufferContainer, - SDL_FALSE); + false); MTLOrigin regionOrigin = MTLOriginMake( source->x, @@ -1831,7 +1831,7 @@ static void METAL_DownloadFromBuffer( &sourceLocation, (SDL_GPUBufferLocation *)destination, source->size, - SDL_FALSE); + false); } static void METAL_EndCopyPass( @@ -1994,17 +1994,17 @@ static SDL_GPUCommandBuffer *METAL_AcquireCommandBuffer( } // FIXME: Do we actually need to set this? - commandBuffer->needVertexSamplerBind = SDL_TRUE; - commandBuffer->needVertexStorageTextureBind = SDL_TRUE; - commandBuffer->needVertexStorageBufferBind = SDL_TRUE; - commandBuffer->needVertexUniformBind = SDL_TRUE; - commandBuffer->needFragmentSamplerBind = SDL_TRUE; - commandBuffer->needFragmentStorageTextureBind = SDL_TRUE; - commandBuffer->needFragmentStorageBufferBind = SDL_TRUE; - commandBuffer->needFragmentUniformBind = SDL_TRUE; - commandBuffer->needComputeBufferBind = SDL_TRUE; - commandBuffer->needComputeTextureBind = SDL_TRUE; - commandBuffer->needComputeUniformBind = SDL_TRUE; + commandBuffer->needVertexSamplerBind = true; + commandBuffer->needVertexStorageTextureBind = true; + commandBuffer->needVertexStorageBufferBind = true; + commandBuffer->needVertexUniformBind = true; + commandBuffer->needFragmentSamplerBind = true; + commandBuffer->needFragmentStorageTextureBind = true; + commandBuffer->needFragmentStorageBufferBind = true; + commandBuffer->needFragmentUniformBind = true; + commandBuffer->needComputeBufferBind = true; + commandBuffer->needComputeTextureBind = true; + commandBuffer->needComputeUniformBind = true; METAL_INTERNAL_AcquireFence(renderer, commandBuffer); commandBuffer->autoReleaseFence = 1; @@ -2240,8 +2240,8 @@ static void METAL_BindGraphicsPipeline( } } - metalCommandBuffer->needVertexUniformBind = SDL_TRUE; - metalCommandBuffer->needFragmentUniformBind = SDL_TRUE; + metalCommandBuffer->needVertexUniformBind = true; + metalCommandBuffer->needFragmentUniformBind = true; } } @@ -2345,7 +2345,7 @@ static void METAL_BindVertexSamplers( textureContainer->activeTexture->handle; } - metalCommandBuffer->needVertexSamplerBind = SDL_TRUE; + metalCommandBuffer->needVertexSamplerBind = true; } static void METAL_BindVertexStorageTextures( @@ -2368,7 +2368,7 @@ static void METAL_BindVertexStorageTextures( textureContainer->activeTexture->handle; } - metalCommandBuffer->needVertexStorageTextureBind = SDL_TRUE; + metalCommandBuffer->needVertexStorageTextureBind = true; } static void METAL_BindVertexStorageBuffers( @@ -2391,7 +2391,7 @@ static void METAL_BindVertexStorageBuffers( bufferContainer->activeBuffer->handle; } - metalCommandBuffer->needVertexStorageBufferBind = SDL_TRUE; + metalCommandBuffer->needVertexStorageBufferBind = true; } static void METAL_BindFragmentSamplers( @@ -2417,7 +2417,7 @@ static void METAL_BindFragmentSamplers( textureContainer->activeTexture->handle; } - metalCommandBuffer->needFragmentSamplerBind = SDL_TRUE; + metalCommandBuffer->needFragmentSamplerBind = true; } static void METAL_BindFragmentStorageTextures( @@ -2440,7 +2440,7 @@ static void METAL_BindFragmentStorageTextures( textureContainer->activeTexture->handle; } - metalCommandBuffer->needFragmentStorageTextureBind = SDL_TRUE; + metalCommandBuffer->needFragmentStorageTextureBind = true; } static void METAL_BindFragmentStorageBuffers( @@ -2463,7 +2463,7 @@ static void METAL_BindFragmentStorageBuffers( bufferContainer->activeBuffer->handle; } - metalCommandBuffer->needFragmentStorageBufferBind = SDL_TRUE; + metalCommandBuffer->needFragmentStorageBufferBind = true; } // This function assumes that it's called from within an autorelease pool @@ -2480,7 +2480,7 @@ static void METAL_INTERNAL_BindGraphicsResources( withRange:NSMakeRange(0, graphicsPipeline->vertexSamplerCount)]; [commandBuffer->renderEncoder setVertexTextures:commandBuffer->vertexTextures withRange:NSMakeRange(0, graphicsPipeline->vertexSamplerCount)]; - commandBuffer->needVertexSamplerBind = SDL_FALSE; + commandBuffer->needVertexSamplerBind = false; } // Vertex Storage Textures @@ -2489,7 +2489,7 @@ static void METAL_INTERNAL_BindGraphicsResources( [commandBuffer->renderEncoder setVertexTextures:commandBuffer->vertexStorageTextures withRange:NSMakeRange(graphicsPipeline->vertexSamplerCount, graphicsPipeline->vertexStorageTextureCount)]; - commandBuffer->needVertexStorageTextureBind = SDL_FALSE; + commandBuffer->needVertexStorageTextureBind = false; } // Vertex Storage Buffers @@ -2499,7 +2499,7 @@ static void METAL_INTERNAL_BindGraphicsResources( offsets:offsets withRange:NSMakeRange(graphicsPipeline->vertexUniformBufferCount, graphicsPipeline->vertexStorageBufferCount)]; - commandBuffer->needVertexStorageBufferBind = SDL_FALSE; + commandBuffer->needVertexStorageBufferBind = false; } // Vertex Uniform Buffers @@ -2511,7 +2511,7 @@ static void METAL_INTERNAL_BindGraphicsResources( offset:commandBuffer->vertexUniformBuffers[i]->drawOffset atIndex:i]; } - commandBuffer->needVertexUniformBind = SDL_FALSE; + commandBuffer->needVertexUniformBind = false; } // Fragment Samplers+Textures @@ -2521,7 +2521,7 @@ static void METAL_INTERNAL_BindGraphicsResources( withRange:NSMakeRange(0, graphicsPipeline->fragmentSamplerCount)]; [commandBuffer->renderEncoder setFragmentTextures:commandBuffer->fragmentTextures withRange:NSMakeRange(0, graphicsPipeline->fragmentSamplerCount)]; - commandBuffer->needFragmentSamplerBind = SDL_FALSE; + commandBuffer->needFragmentSamplerBind = false; } // Fragment Storage Textures @@ -2530,7 +2530,7 @@ static void METAL_INTERNAL_BindGraphicsResources( [commandBuffer->renderEncoder setFragmentTextures:commandBuffer->fragmentStorageTextures withRange:NSMakeRange(graphicsPipeline->fragmentSamplerCount, graphicsPipeline->fragmentStorageTextureCount)]; - commandBuffer->needFragmentStorageTextureBind = SDL_FALSE; + commandBuffer->needFragmentStorageTextureBind = false; } // Fragment Storage Buffers @@ -2540,7 +2540,7 @@ static void METAL_INTERNAL_BindGraphicsResources( offsets:offsets withRange:NSMakeRange(graphicsPipeline->fragmentUniformBufferCount, graphicsPipeline->fragmentStorageBufferCount)]; - commandBuffer->needFragmentStorageBufferBind = SDL_FALSE; + commandBuffer->needFragmentStorageBufferBind = false; } // Fragment Uniform Buffers @@ -2551,7 +2551,7 @@ static void METAL_INTERNAL_BindGraphicsResources( offset:commandBuffer->fragmentUniformBuffers[i]->drawOffset atIndex:i]; } - commandBuffer->needFragmentUniformBind = SDL_FALSE; + commandBuffer->needFragmentUniformBind = false; } } @@ -2576,7 +2576,7 @@ static void METAL_INTERNAL_BindComputeResources( computePipeline->readOnlyStorageTextureCount, computePipeline->writeOnlyStorageTextureCount)]; } - commandBuffer->needComputeTextureBind = SDL_FALSE; + commandBuffer->needComputeTextureBind = false; } if (commandBuffer->needComputeBufferBind) { @@ -2596,7 +2596,7 @@ static void METAL_INTERNAL_BindComputeResources( computePipeline->readOnlyStorageBufferCount, computePipeline->writeOnlyStorageBufferCount)]; } - commandBuffer->needComputeBufferBind = SDL_FALSE; + commandBuffer->needComputeBufferBind = false; } if (commandBuffer->needComputeUniformBind) { @@ -2607,7 +2607,7 @@ static void METAL_INTERNAL_BindComputeResources( atIndex:i]; } - commandBuffer->needComputeUniformBind = SDL_FALSE; + commandBuffer->needComputeUniformBind = false; } } @@ -2808,11 +2808,11 @@ static void METAL_INTERNAL_PushUniformData( metalUniformBuffer->writeOffset += alignedDataLength; if (shaderStage == SDL_GPU_SHADERSTAGE_VERTEX) { - metalCommandBuffer->needVertexUniformBind = SDL_TRUE; + metalCommandBuffer->needVertexUniformBind = true; } else if (shaderStage == SDL_GPU_SHADERSTAGE_FRAGMENT) { - metalCommandBuffer->needFragmentUniformBind = SDL_TRUE; + metalCommandBuffer->needFragmentUniformBind = true; } else if (shaderStage == SDL_GPU_SHADERSTAGE_COMPUTE) { - metalCommandBuffer->needComputeUniformBind = SDL_TRUE; + metalCommandBuffer->needComputeUniformBind = true; } else { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Unrecognized shader stage!"); } @@ -2858,7 +2858,7 @@ static void METAL_Blit( SDL_GPUBlitRegion *destination, SDL_FlipMode flipMode, SDL_GPUFilter filterMode, - SDL_bool cycle) + bool cycle) { MetalCommandBuffer *metalCommandBuffer = (MetalCommandBuffer *)commandBuffer; MetalRenderer *renderer = (MetalRenderer *)metalCommandBuffer->renderer; @@ -2917,7 +2917,7 @@ static void METAL_BeginComputePass( slices:NSMakeRange(storageTextureBindings[i].layer, 1)]; metalCommandBuffer->computeWriteOnlyTextures[i] = textureView; - metalCommandBuffer->needComputeTextureBind = SDL_TRUE; + metalCommandBuffer->needComputeTextureBind = true; } for (Uint32 i = 0; i < storageBufferBindingCount; i += 1) { @@ -2933,7 +2933,7 @@ static void METAL_BeginComputePass( buffer); metalCommandBuffer->computeWriteOnlyBuffers[i] = buffer->handle; - metalCommandBuffer->needComputeBufferBind = SDL_TRUE; + metalCommandBuffer->needComputeBufferBind = true; } } } @@ -2957,7 +2957,7 @@ static void METAL_BindComputePipeline( } } - metalCommandBuffer->needComputeUniformBind = SDL_TRUE; + metalCommandBuffer->needComputeUniformBind = true; } } @@ -2981,7 +2981,7 @@ static void METAL_BindComputeStorageTextures( textureContainer->activeTexture->handle; } - metalCommandBuffer->needComputeTextureBind = SDL_TRUE; + metalCommandBuffer->needComputeTextureBind = true; } static void METAL_BindComputeStorageBuffers( @@ -3004,7 +3004,7 @@ static void METAL_BindComputeStorageBuffers( bufferContainer->activeBuffer->handle; } - metalCommandBuffer->needComputeBufferBind = SDL_TRUE; + metalCommandBuffer->needComputeBufferBind = true; } static void METAL_PushComputeUniformData( @@ -3254,13 +3254,13 @@ static void METAL_INTERNAL_PerformPendingDestroys( static void METAL_WaitForFences( SDL_GPURenderer *driverData, - SDL_bool waitAll, + bool waitAll, SDL_GPUFence **pFences, Uint32 fenceCount) { @autoreleasepool { MetalRenderer *renderer = (MetalRenderer *)driverData; - SDL_bool waiting; + bool waiting; if (waitAll) { for (Uint32 i = 0; i < fenceCount; i += 1) { @@ -3284,7 +3284,7 @@ static void METAL_WaitForFences( } } -static SDL_bool METAL_QueryFence( +static bool METAL_QueryFence( SDL_GPURenderer *driverData, SDL_GPUFence *fence) { @@ -3300,19 +3300,19 @@ static MetalWindowData *METAL_INTERNAL_FetchWindowData(SDL_Window *window) return (MetalWindowData *)SDL_GetPointerProperty(properties, WINDOW_PROPERTY_DATA, NULL); } -static SDL_bool METAL_SupportsSwapchainComposition( +static bool METAL_SupportsSwapchainComposition( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUSwapchainComposition swapchainComposition) { #ifndef SDL_PLATFORM_MACOS if (swapchainComposition == SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048) { - return SDL_FALSE; + return false; } #endif if (@available(macOS 11.0, *)) { - return SDL_TRUE; + return true; } else { return swapchainComposition != SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048; } @@ -3382,7 +3382,7 @@ static Uint8 METAL_INTERNAL_CreateSwapchain( return 1; } -static SDL_bool METAL_SupportsPresentMode( +static bool METAL_SupportsPresentMode( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUPresentMode presentMode) @@ -3392,13 +3392,13 @@ static SDL_bool METAL_SupportsPresentMode( case SDL_GPU_PRESENTMODE_IMMEDIATE: #endif case SDL_GPU_PRESENTMODE_VSYNC: - return SDL_TRUE; + return true; default: - return SDL_FALSE; + return false; } } -static SDL_bool METAL_ClaimWindow( +static bool METAL_ClaimWindow( SDL_GPURenderer *driverData, SDL_Window *window) { @@ -3426,15 +3426,15 @@ static SDL_bool METAL_ClaimWindow( SDL_UnlockMutex(renderer->windowLock); - return SDL_TRUE; + return true; } else { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Could not create swapchain, failed to claim window!"); SDL_free(windowData); - return SDL_FALSE; + return false; } } else { SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "Window already claimed!"); - return SDL_FALSE; + return false; } } } @@ -3528,7 +3528,7 @@ static SDL_GPUTextureFormat METAL_GetSwapchainTextureFormat( return windowData->textureContainer.header.info.format; } -static SDL_bool METAL_SetSwapchainParameters( +static bool METAL_SetSwapchainParameters( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUSwapchainComposition swapchainComposition, @@ -3540,17 +3540,17 @@ static SDL_bool METAL_SetSwapchainParameters( if (windowData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Cannot set swapchain parameters, window has not been claimed!"); - return SDL_FALSE; + return false; } if (!METAL_SupportsSwapchainComposition(driverData, window, swapchainComposition)) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Swapchain composition not supported!"); - return SDL_FALSE; + return false; } if (!METAL_SupportsPresentMode(driverData, window, presentMode)) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Present mode not supported!"); - return SDL_FALSE; + return false; } METAL_Wait(driverData); @@ -3569,7 +3569,7 @@ static SDL_bool METAL_SetSwapchainParameters( windowData->textureContainer.header.info.format = SwapchainCompositionToFormat[swapchainComposition]; - return SDL_TRUE; + return true; } } @@ -3669,7 +3669,7 @@ static void METAL_Wait( // Format Info -static SDL_bool METAL_SupportsTextureFormat( +static bool METAL_SupportsTextureFormat( SDL_GPURenderer *driverData, SDL_GPUTextureFormat format, SDL_GPUTextureType type, @@ -3681,7 +3681,7 @@ static SDL_bool METAL_SupportsTextureFormat( // Only depth textures can be used as... depth textures if ((usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT)) { if (!IsDepthFormat(format)) { - return SDL_FALSE; + return false; } } @@ -3705,11 +3705,11 @@ static SDL_bool METAL_SupportsTextureFormat( [renderer->device supportsBCTextureCompression] && !(usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT)); } else { - return SDL_FALSE; + return false; } #else // FIXME: iOS 16.4+ allows these formats! - return SDL_FALSE; + return false; #endif // Requires D24S8 support @@ -3718,18 +3718,18 @@ static SDL_bool METAL_SupportsTextureFormat( #ifdef SDL_PLATFORM_MACOS return [renderer->device isDepth24Stencil8PixelFormatSupported]; #else - return SDL_FALSE; + return false; #endif default: - return SDL_TRUE; + return true; } } } // Device Creation -static SDL_bool METAL_PrepareDriver(SDL_VideoDevice *_this) +static bool METAL_PrepareDriver(SDL_VideoDevice *_this) { // FIXME: Add a macOS / iOS version check! Maybe support >= 10.14? return (_this->Metal_CreateView != NULL); @@ -3872,7 +3872,7 @@ static void METAL_INTERNAL_DestroyBlitResources( SDL_free(renderer->blitPipelines); } -static SDL_GPUDevice *METAL_CreateDevice(SDL_bool debugMode, SDL_bool preferLowPower, SDL_PropertiesID props) +static SDL_GPUDevice *METAL_CreateDevice(bool debugMode, bool preferLowPower, SDL_PropertiesID props) { @autoreleasepool { MetalRenderer *renderer; diff --git a/src/gpu/vulkan/SDL_gpu_vulkan.c b/src/gpu/vulkan/SDL_gpu_vulkan.c index d919886118..be14c2f32d 100644 --- a/src/gpu/vulkan/SDL_gpu_vulkan.c +++ b/src/gpu/vulkan/SDL_gpu_vulkan.c @@ -256,7 +256,7 @@ static VkFormat SwapchainCompositionToFallbackFormat[] = { static SDL_GPUTextureFormat SwapchainCompositionToSDLFormat( SDL_GPUSwapchainComposition composition, - SDL_bool usingFallback) + bool usingFallback) { switch (composition) { case SDL_GPU_SWAPCHAINCOMPOSITION_SDR: @@ -542,7 +542,7 @@ struct VulkanBuffer VulkanBufferHandle *handle; - SDL_bool transitioned; + bool transitioned; Uint8 markedForDestroy; // so that defrag doesn't double-free }; @@ -615,7 +615,7 @@ typedef struct VulkanTextureSubresource VulkanTextureHandle *msaaTexHandle; // NULL if parent sample count is 1 or is depth target - SDL_bool transitioned; // used for layout tracking + bool transitioned; // used for layout tracking } VulkanTextureSubresource; struct VulkanTexture @@ -722,7 +722,7 @@ typedef struct VulkanSwapchainData VkColorSpaceKHR colorSpace; VkComponentMapping swapchainSwizzle; VkPresentModeKHR presentMode; - SDL_bool usingFallbackFormat; + bool usingFallbackFormat; // Swapchain images VulkanTextureContainer *textureContainers; // use containers so that swapchain textures can use the same API as other textures @@ -742,7 +742,7 @@ typedef struct WindowData SDL_GPUSwapchainComposition swapchainComposition; SDL_GPUPresentMode presentMode; VulkanSwapchainData *swapchainData; - SDL_bool needsSwapchainRecreate; + bool needsSwapchainRecreate; } WindowData; typedef struct SwapchainSupportDetails @@ -959,17 +959,17 @@ typedef struct VulkanCommandBuffer // Resource bind state - SDL_bool needNewVertexResourceDescriptorSet; - SDL_bool needNewVertexUniformDescriptorSet; - SDL_bool needNewVertexUniformOffsets; - SDL_bool needNewFragmentResourceDescriptorSet; - SDL_bool needNewFragmentUniformDescriptorSet; - SDL_bool needNewFragmentUniformOffsets; + bool needNewVertexResourceDescriptorSet; + bool needNewVertexUniformDescriptorSet; + bool needNewVertexUniformOffsets; + bool needNewFragmentResourceDescriptorSet; + bool needNewFragmentUniformDescriptorSet; + bool needNewFragmentUniformOffsets; - SDL_bool needNewComputeReadOnlyDescriptorSet; - SDL_bool needNewComputeWriteOnlyDescriptorSet; - SDL_bool needNewComputeUniformDescriptorSet; - SDL_bool needNewComputeUniformOffsets; + bool needNewComputeReadOnlyDescriptorSet; + bool needNewComputeWriteOnlyDescriptorSet; + bool needNewComputeUniformDescriptorSet; + bool needNewComputeUniformOffsets; VkDescriptorSet vertexResourceDescriptorSet; VkDescriptorSet vertexUniformDescriptorSet; @@ -1067,13 +1067,13 @@ struct VulkanRenderer Uint8 outofBARMemoryWarning; Uint8 fillModeOnlyWarning; - SDL_bool debugMode; - SDL_bool preferLowPower; + bool debugMode; + bool preferLowPower; VulkanExtensions supports; - SDL_bool supportsDebugUtils; - SDL_bool supportsColorspace; - SDL_bool supportsFillModeNonSolid; - SDL_bool supportsMultiDrawIndirect; + bool supportsDebugUtils; + bool supportsColorspace; + bool supportsFillModeNonSolid; + bool supportsMultiDrawIndirect; VulkanMemoryAllocator *memoryAllocator; VkPhysicalDeviceMemoryProperties memoryProperties; @@ -1162,7 +1162,7 @@ static Uint8 VULKAN_INTERNAL_DefragmentMemory(VulkanRenderer *renderer); static void VULKAN_INTERNAL_BeginCommandBuffer(VulkanRenderer *renderer, VulkanCommandBuffer *commandBuffer); static void VULKAN_UnclaimWindow(SDL_GPURenderer *driverData, SDL_Window *window); static void VULKAN_Wait(SDL_GPURenderer *driverData); -static void VULKAN_WaitForFences(SDL_GPURenderer *driverData, SDL_bool waitAll, SDL_GPUFence **pFences, Uint32 fenceCount); +static void VULKAN_WaitForFences(SDL_GPURenderer *driverData, bool waitAll, SDL_GPUFence **pFences, Uint32 fenceCount); static void VULKAN_Submit(SDL_GPUCommandBuffer *commandBuffer); static VulkanTexture *VULKAN_INTERNAL_CreateTexture( VulkanRenderer *renderer, @@ -1177,7 +1177,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture( VkComponentMapping swizzle, VkImageAspectFlags aspectMask, SDL_GPUTextureUsageFlags textureUsageFlags, - SDL_bool isMSAAColorTarget); + bool isMSAAColorTarget); // Error Handling @@ -1229,7 +1229,7 @@ static inline void LogVulkanResultAsError( // Utility -static inline SDL_bool VULKAN_INTERNAL_IsVulkanDepthFormat(VkFormat format) +static inline bool VULKAN_INTERNAL_IsVulkanDepthFormat(VkFormat format) { // FIXME: Can we refactor and use the regular IsDepthFormat for this? return ( @@ -1557,7 +1557,7 @@ static void VULKAN_INTERNAL_RemoveMemoryUsedRegion( SDL_UnlockMutex(renderer->allocatorLock); } -static SDL_bool VULKAN_INTERNAL_CheckMemoryTypeArrayUnique( +static bool VULKAN_INTERNAL_CheckMemoryTypeArrayUnique( Uint32 memoryTypeIndex, Uint32 *memoryTypeIndexArray, Uint32 count) @@ -1566,11 +1566,11 @@ static SDL_bool VULKAN_INTERNAL_CheckMemoryTypeArrayUnique( for (i = 0; i < count; i += 1) { if (memoryTypeIndexArray[i] == memoryTypeIndex) { - return SDL_FALSE; + return false; } } - return SDL_TRUE; + return true; } /* Returns an array of memory type indices in order of preference. @@ -2597,7 +2597,7 @@ static void VULKAN_INTERNAL_BufferMemoryBarrier( 0, NULL); - buffer->transitioned = SDL_TRUE; + buffer->transitioned = true; } static void VULKAN_INTERNAL_TextureSubresourceMemoryBarrier( @@ -2720,7 +2720,7 @@ static void VULKAN_INTERNAL_TextureSubresourceMemoryBarrier( 1, &memoryBarrier); - textureSubresource->transitioned = SDL_TRUE; + textureSubresource->transitioned = true; } static VulkanBufferUsageMode VULKAN_INTERNAL_DefaultBufferUsageMode( @@ -2906,14 +2906,14 @@ static void VULKAN_INTERNAL_RemoveFramebuffersContainingView( SDL_LockMutex(renderer->framebufferFetchLock); while (SDL_IterateHashTable(renderer->framebufferHashTable, (const void **)&key, (const void **)&value, &iter)) { - SDL_bool remove = SDL_FALSE; + bool remove = false; for (Uint32 i = 0; i < key->colorAttachmentCount; i += 1) { if (key->colorAttachmentViews[i] == view) { - remove = SDL_TRUE; + remove = true; } } if (key->depthStencilAttachmentView == view) { - remove = SDL_TRUE; + remove = true; } if (remove) { @@ -3411,7 +3411,7 @@ static void VULKAN_INTERNAL_FramebufferHashNuke(const void *key, const void *val // Descriptor pool stuff -static SDL_bool VULKAN_INTERNAL_CreateDescriptorPool( +static bool VULKAN_INTERNAL_CreateDescriptorPool( VulkanRenderer *renderer, VulkanDescriptorInfo *descriptorInfos, Uint32 descriptorInfoCount, @@ -3451,13 +3451,13 @@ static SDL_bool VULKAN_INTERNAL_CreateDescriptorPool( if (vulkanResult != VK_SUCCESS) { LogVulkanResultAsError("vkCreateDescriptorPool", vulkanResult); - return SDL_FALSE; + return false; } - return SDL_TRUE; + return true; } -static SDL_bool VULKAN_INTERNAL_AllocateDescriptorSets( +static bool VULKAN_INTERNAL_AllocateDescriptorSets( VulkanRenderer *renderer, VkDescriptorPool descriptorPool, VkDescriptorSetLayout descriptorSetLayout, @@ -3487,11 +3487,11 @@ static SDL_bool VULKAN_INTERNAL_AllocateDescriptorSets( if (vulkanResult != VK_SUCCESS) { LogVulkanResultAsError("vkAllocateDescriptorSets", vulkanResult); SDL_stack_free(descriptorSetLayouts); - return SDL_FALSE; + return false; } SDL_stack_free(descriptorSetLayouts); - return SDL_TRUE; + return true; } static void VULKAN_INTERNAL_InitializeDescriptorSetPool( @@ -3526,7 +3526,7 @@ static void VULKAN_INTERNAL_InitializeDescriptorSetPool( descriptorSetPool->inactiveDescriptorSets); } -static SDL_bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout( +static bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout( VulkanRenderer *renderer, VulkanShader *vertexShader, VulkanShader *fragmentShader, @@ -3616,7 +3616,7 @@ static SDL_bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout( if (vulkanResult != VK_SUCCESS) { LogVulkanResultAsError("vkCreateDescriptorSetLayout", vulkanResult); - return SDL_FALSE; + return false; } // Vertex UBOs @@ -3657,7 +3657,7 @@ static SDL_bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout( if (vulkanResult != VK_SUCCESS) { LogVulkanResultAsError("vkCreateDescriptorSetLayout", vulkanResult); - return SDL_FALSE; + return false; } // Fragment resources @@ -3724,7 +3724,7 @@ static SDL_bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout( if (vulkanResult != VK_SUCCESS) { LogVulkanResultAsError("vkCreateDescriptorSetLayout", vulkanResult); - return SDL_FALSE; + return false; } // Fragment UBOs @@ -3767,7 +3767,7 @@ static SDL_bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout( if (vulkanResult != VK_SUCCESS) { LogVulkanResultAsError("vkCreateDescriptorSetLayout", vulkanResult); - return SDL_FALSE; + return false; } // Create the pipeline layout @@ -3788,7 +3788,7 @@ static SDL_bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout( if (vulkanResult != VK_SUCCESS) { LogVulkanResultAsError("vkCreatePipelineLayout", vulkanResult); - return SDL_FALSE; + return false; } for (i = 0; i < 4; i += 1) { @@ -3797,10 +3797,10 @@ static SDL_bool VULKAN_INTERNAL_InitializeGraphicsPipelineResourceLayout( &pipelineResourceLayout->descriptorSetPools[i]); } - return SDL_TRUE; + return true; } -static SDL_bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout( +static bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout( VulkanRenderer *renderer, SDL_GPUComputePipelineCreateInfo *pipelineCreateInfo, VulkanComputePipelineResourceLayout *pipelineResourceLayout) @@ -3873,7 +3873,7 @@ static SDL_bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout( if (vulkanResult != VK_SUCCESS) { LogVulkanResultAsError("vkCreateDescriptorSetLayout", vulkanResult); - return SDL_FALSE; + return false; } // Write-only resources @@ -3928,7 +3928,7 @@ static SDL_bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout( if (vulkanResult != VK_SUCCESS) { LogVulkanResultAsError("vkCreateDescriptorSetLayout", vulkanResult); - return SDL_FALSE; + return false; } // Uniform buffers @@ -3969,7 +3969,7 @@ static SDL_bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout( if (vulkanResult != VK_SUCCESS) { LogVulkanResultAsError("vkCreateDescriptorSetLayout", vulkanResult); - return SDL_FALSE; + return false; } // Create the pipeline layout @@ -3990,7 +3990,7 @@ static SDL_bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout( if (vulkanResult != VK_SUCCESS) { LogVulkanResultAsError("vkCreatePipelineLayout", vulkanResult); - return SDL_FALSE; + return false; } for (i = 0; i < 3; i += 1) { @@ -3999,7 +3999,7 @@ static SDL_bool VULKAN_INTERNAL_InitializeComputePipelineResourceLayout( &pipelineResourceLayout->descriptorSetPools[i]); } - return SDL_TRUE; + return true; } // Data Buffer @@ -4047,7 +4047,7 @@ static VulkanBuffer *VULKAN_INTERNAL_CreateBuffer( buffer->usageFlags = usageFlags; buffer->type = type; buffer->markedForDestroy = 0; - buffer->transitioned = SDL_FALSE; + buffer->transitioned = false; bufferCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; bufferCreateInfo.pNext = NULL; @@ -4372,7 +4372,7 @@ static Uint8 VULKAN_INTERNAL_QuerySwapchainSupport( return 1; } -static SDL_bool VULKAN_INTERNAL_VerifySwapSurfaceFormat( +static bool VULKAN_INTERNAL_VerifySwapSurfaceFormat( VkFormat desiredFormat, VkColorSpaceKHR desiredColorSpace, VkSurfaceFormatKHR *availableFormats, @@ -4382,13 +4382,13 @@ static SDL_bool VULKAN_INTERNAL_VerifySwapSurfaceFormat( for (i = 0; i < availableFormatsLength; i += 1) { if (availableFormats[i].format == desiredFormat && availableFormats[i].colorSpace == desiredColorSpace) { - return SDL_TRUE; + return true; } } - return SDL_FALSE; + return false; } -static SDL_bool VULKAN_INTERNAL_VerifySwapPresentMode( +static bool VULKAN_INTERNAL_VerifySwapPresentMode( VkPresentModeKHR presentMode, VkPresentModeKHR *availablePresentModes, Uint32 availablePresentModesLength) @@ -4396,13 +4396,13 @@ static SDL_bool VULKAN_INTERNAL_VerifySwapPresentMode( Uint32 i; for (i = 0; i < availablePresentModesLength; i += 1) { if (availablePresentModes[i] == presentMode) { - return SDL_TRUE; + return true; } } - return SDL_FALSE; + return false; } -static SDL_bool VULKAN_INTERNAL_CreateSwapchain( +static bool VULKAN_INTERNAL_CreateSwapchain( VulkanRenderer *renderer, WindowData *windowData) { @@ -4412,7 +4412,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( VkImage *swapchainImages; VkSemaphoreCreateInfo semaphoreCreateInfo; SwapchainSupportDetails swapchainSupportDetails; - SDL_bool hasValidSwapchainComposition, hasValidPresentMode; + bool hasValidSwapchainComposition, hasValidPresentMode; Sint32 drawableWidth, drawableHeight; Uint32 i; SDL_VideoDevice *_this = SDL_GetVideoDevice(); @@ -4435,7 +4435,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( SDL_LOG_CATEGORY_GPU, "Vulkan_CreateSurface failed: %s", SDL_GetError()); - return SDL_FALSE; + return false; } if (!VULKAN_INTERNAL_QuerySwapchainSupport( @@ -4455,7 +4455,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( } SDL_free(swapchainData); SDL_LogError(SDL_LOG_CATEGORY_GPU, "Device does not support swap chain creation"); - return SDL_FALSE; + return false; } if (swapchainSupportDetails.capabilities.currentExtent.width == 0 || @@ -4472,7 +4472,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( SDL_free(swapchainSupportDetails.presentModes); } SDL_free(swapchainData); - return SDL_FALSE; + return false; } // Verify that we can use the requested composition and present mode @@ -4480,7 +4480,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( swapchainData->format = SwapchainCompositionToFormat[windowData->swapchainComposition]; swapchainData->colorSpace = SwapchainCompositionToColorSpace[windowData->swapchainComposition]; swapchainData->swapchainSwizzle = SwapchainCompositionSwizzle[windowData->swapchainComposition]; - swapchainData->usingFallbackFormat = SDL_FALSE; + swapchainData->usingFallbackFormat = false; hasValidSwapchainComposition = VULKAN_INTERNAL_VerifySwapSurfaceFormat( swapchainData->format, @@ -4491,7 +4491,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( if (!hasValidSwapchainComposition) { // Let's try again with the fallback format... swapchainData->format = SwapchainCompositionToFallbackFormat[windowData->swapchainComposition]; - swapchainData->usingFallbackFormat = SDL_TRUE; + swapchainData->usingFallbackFormat = true; hasValidSwapchainComposition = VULKAN_INTERNAL_VerifySwapSurfaceFormat( swapchainData->format, swapchainData->colorSpace, @@ -4527,7 +4527,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( if (!hasValidPresentMode) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Device does not support requested presentMode!"); } - return SDL_FALSE; + return false; } // Sync now to be sure that our swapchain size is correct @@ -4563,7 +4563,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( } SDL_free(swapchainData); SDL_LogError(SDL_LOG_CATEGORY_GPU, "No fallback swapchain size available!"); - return SDL_FALSE; + return false; } } @@ -4626,7 +4626,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( NULL); SDL_free(swapchainData); LogVulkanResultAsError("vkCreateSwapchainKHR", vulkanResult); - return SDL_FALSE; + return false; } renderer->vkGetSwapchainImagesKHR( @@ -4644,7 +4644,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( swapchainData->surface, NULL); SDL_free(swapchainData); - return SDL_FALSE; + return false; } swapchainImages = SDL_stack_alloc(VkImage, swapchainData->imageCount); @@ -4659,7 +4659,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( // Initialize dummy container SDL_zero(swapchainData->textureContainers[i]); - swapchainData->textureContainers[i].canBeCycled = SDL_FALSE; + swapchainData->textureContainers[i].canBeCycled = false; swapchainData->textureContainers[i].header.info.width = drawableWidth; swapchainData->textureContainers[i].header.info.height = drawableHeight; swapchainData->textureContainers[i].header.info.layerCountOrDepth = 1; @@ -4702,7 +4702,7 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->subresources[0].parent = swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture; swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->subresources[0].layer = 0; swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->subresources[0].level = 0; - swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->subresources[0].transitioned = SDL_TRUE; + swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->subresources[0].transitioned = true; swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->subresources[0].msaaTexHandle = NULL; swapchainData->textureContainers[i].activeTextureHandle->vulkanTexture->subresources[0].renderTargetViews = SDL_malloc(sizeof(VkImageView)); VULKAN_INTERNAL_CreateRenderTargetView( @@ -4737,8 +4737,8 @@ static SDL_bool VULKAN_INTERNAL_CreateSwapchain( } windowData->swapchainData = swapchainData; - windowData->needsSwapchainRecreate = SDL_FALSE; - return SDL_TRUE; + windowData->needsSwapchainRecreate = false; + return true; } // Command Buffers @@ -5057,7 +5057,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets( bufferInfoCount = 0; imageInfoCount = 0; - commandBuffer->needNewVertexResourceDescriptorSet = SDL_FALSE; + commandBuffer->needNewVertexResourceDescriptorSet = false; } if (commandBuffer->needNewVertexUniformDescriptorSet) { @@ -5105,8 +5105,8 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets( bufferInfoCount = 0; imageInfoCount = 0; - commandBuffer->needNewVertexUniformDescriptorSet = SDL_FALSE; - commandBuffer->needNewVertexUniformOffsets = SDL_TRUE; + commandBuffer->needNewVertexUniformDescriptorSet = false; + commandBuffer->needNewVertexUniformOffsets = true; } if (commandBuffer->needNewVertexUniformOffsets) { @@ -5124,7 +5124,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets( resourceLayout->vertexUniformBufferCount, dynamicOffsets); - commandBuffer->needNewVertexUniformOffsets = SDL_FALSE; + commandBuffer->needNewVertexUniformOffsets = false; } if (commandBuffer->needNewFragmentResourceDescriptorSet) { @@ -5227,7 +5227,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets( bufferInfoCount = 0; imageInfoCount = 0; - commandBuffer->needNewFragmentResourceDescriptorSet = SDL_FALSE; + commandBuffer->needNewFragmentResourceDescriptorSet = false; } if (commandBuffer->needNewFragmentUniformDescriptorSet) { @@ -5275,8 +5275,8 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets( bufferInfoCount = 0; imageInfoCount = 0; - commandBuffer->needNewFragmentUniformDescriptorSet = SDL_FALSE; - commandBuffer->needNewFragmentUniformOffsets = SDL_TRUE; + commandBuffer->needNewFragmentUniformDescriptorSet = false; + commandBuffer->needNewFragmentUniformOffsets = true; } if (commandBuffer->needNewFragmentUniformOffsets) { @@ -5294,7 +5294,7 @@ static void VULKAN_INTERNAL_BindGraphicsDescriptorSets( resourceLayout->fragmentUniformBufferCount, dynamicOffsets); - commandBuffer->needNewFragmentUniformOffsets = SDL_FALSE; + commandBuffer->needNewFragmentUniformOffsets = false; } } @@ -5574,7 +5574,7 @@ static VulkanTextureHandle *VULKAN_INTERNAL_CreateTextureHandle( VkComponentMapping swizzle, VkImageAspectFlags aspectMask, SDL_GPUTextureUsageFlags textureUsageFlags, - SDL_bool isMSAAColorTarget) + bool isMSAAColorTarget) { VulkanTextureHandle *textureHandle; VulkanTexture *texture; @@ -5621,7 +5621,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture( VkComponentMapping swizzle, VkImageAspectFlags aspectMask, SDL_GPUTextureUsageFlags textureUsageFlags, - SDL_bool isMSAAColorTarget) + bool isMSAAColorTarget) { VkResult vulkanResult; VkImageCreateInfo imageCreateInfo; @@ -5823,7 +5823,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture( texture->subresources[subresourceIndex].layer = i; texture->subresources[subresourceIndex].level = j; texture->subresources[subresourceIndex].msaaTexHandle = NULL; - texture->subresources[subresourceIndex].transitioned = SDL_FALSE; + texture->subresources[subresourceIndex].transitioned = false; if ( sampleCount > VK_SAMPLE_COUNT_1_BIT && @@ -5843,7 +5843,7 @@ static VulkanTexture *VULKAN_INTERNAL_CreateTexture( texture->swizzle, aspectMask, SDL_GPU_TEXTUREUSAGE_COLOR_TARGET_BIT, - SDL_TRUE); + true); } } } @@ -5925,7 +5925,7 @@ static void VULKAN_INTERNAL_CycleActiveTexture( textureContainer->activeTextureHandle->vulkanTexture->swizzle, textureContainer->activeTextureHandle->vulkanTexture->aspectFlags, textureContainer->activeTextureHandle->vulkanTexture->usageFlags, - SDL_FALSE); + false); textureContainer->activeTextureHandle->container = textureContainer; @@ -5954,7 +5954,7 @@ static VulkanBuffer *VULKAN_INTERNAL_PrepareBufferForWrite( VulkanRenderer *renderer, VulkanCommandBuffer *commandBuffer, VulkanBufferContainer *bufferContainer, - SDL_bool cycle, + bool cycle, VulkanBufferUsageMode destinationUsageMode) { if ( @@ -5980,7 +5980,7 @@ static VulkanTextureSubresource *VULKAN_INTERNAL_PrepareTextureSubresourceForWri VulkanTextureContainer *textureContainer, Uint32 layer, Uint32 level, - SDL_bool cycle, + bool cycle, VulkanTextureUsageMode destinationUsageMode) { VulkanTextureSubresource *textureSubresource = VULKAN_INTERNAL_FetchTextureSubresource( @@ -6867,7 +6867,7 @@ static SDL_GPUShader *VULKAN_CreateShader( return (SDL_GPUShader *)vulkanShader; } -static SDL_bool VULKAN_SupportsSampleCount( +static bool VULKAN_SupportsSampleCount( SDL_GPURenderer *driverData, SDL_GPUTextureFormat format, SDL_GPUSampleCount sampleCount) @@ -6916,7 +6916,7 @@ static SDL_GPUTexture *VULKAN_CreateTexture( swizzle, imageAspectFlags, textureCreateInfo->usageFlags, - SDL_FALSE); + false); if (textureHandle == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to create texture container!"); @@ -7234,7 +7234,7 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass( SDL_LockMutex(renderer->renderPassFetchLock); - SDL_bool result = SDL_FindInHashTable( + bool result = SDL_FindInHashTable( renderer->renderPassHashTable, (const void *)&key, (const void **)&renderPassWrapper); @@ -7330,7 +7330,7 @@ static VulkanFramebuffer *VULKAN_INTERNAL_FetchFramebuffer( SDL_LockMutex(renderer->framebufferFetchLock); - SDL_bool findResult = SDL_FindInHashTable( + bool findResult = SDL_FindInHashTable( renderer->framebufferHashTable, (const void *)&key, (const void **)&vulkanFramebuffer); @@ -7503,7 +7503,7 @@ static void VULKAN_BindVertexSamplers( textureContainer->activeTextureHandle->vulkanTexture); } - vulkanCommandBuffer->needNewVertexResourceDescriptorSet = SDL_TRUE; + vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true; } static void VULKAN_BindVertexStorageTextures( @@ -7524,7 +7524,7 @@ static void VULKAN_BindVertexStorageTextures( textureContainer->activeTextureHandle->vulkanTexture); } - vulkanCommandBuffer->needNewVertexResourceDescriptorSet = SDL_TRUE; + vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true; } static void VULKAN_BindVertexStorageBuffers( @@ -7547,7 +7547,7 @@ static void VULKAN_BindVertexStorageBuffers( bufferContainer->activeBufferHandle->vulkanBuffer); } - vulkanCommandBuffer->needNewVertexResourceDescriptorSet = SDL_TRUE; + vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true; } static void VULKAN_BindFragmentSamplers( @@ -7572,7 +7572,7 @@ static void VULKAN_BindFragmentSamplers( textureContainer->activeTextureHandle->vulkanTexture); } - vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = SDL_TRUE; + vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true; } static void VULKAN_BindFragmentStorageTextures( @@ -7594,7 +7594,7 @@ static void VULKAN_BindFragmentStorageTextures( textureContainer->activeTextureHandle->vulkanTexture); } - vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = SDL_TRUE; + vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true; } static void VULKAN_BindFragmentStorageBuffers( @@ -7617,7 +7617,7 @@ static void VULKAN_BindFragmentStorageBuffers( bufferContainer->activeBufferHandle->vulkanBuffer); } - vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = SDL_TRUE; + vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true; } static VulkanUniformBuffer *VULKAN_INTERNAL_AcquireUniformBufferFromPool( @@ -7708,13 +7708,13 @@ static void VULKAN_INTERNAL_PushUniformData( if (uniformBufferStage == VULKAN_UNIFORM_BUFFER_STAGE_VERTEX) { commandBuffer->vertexUniformBuffers[slotIndex] = uniformBuffer; - commandBuffer->needNewVertexUniformDescriptorSet = SDL_TRUE; + commandBuffer->needNewVertexUniformDescriptorSet = true; } else if (uniformBufferStage == VULKAN_UNIFORM_BUFFER_STAGE_FRAGMENT) { commandBuffer->fragmentUniformBuffers[slotIndex] = uniformBuffer; - commandBuffer->needNewFragmentUniformDescriptorSet = SDL_TRUE; + commandBuffer->needNewFragmentUniformDescriptorSet = true; } else if (uniformBufferStage == VULKAN_UNIFORM_BUFFER_STAGE_COMPUTE) { commandBuffer->computeUniformBuffers[slotIndex] = uniformBuffer; - commandBuffer->needNewComputeUniformDescriptorSet = SDL_TRUE; + commandBuffer->needNewComputeUniformDescriptorSet = true; } else { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Unrecognized shader stage!"); return; @@ -7736,11 +7736,11 @@ static void VULKAN_INTERNAL_PushUniformData( uniformBuffer->writeOffset += blockSize; if (uniformBufferStage == VULKAN_UNIFORM_BUFFER_STAGE_VERTEX) { - commandBuffer->needNewVertexUniformOffsets = SDL_TRUE; + commandBuffer->needNewVertexUniformOffsets = true; } else if (uniformBufferStage == VULKAN_UNIFORM_BUFFER_STAGE_FRAGMENT) { - commandBuffer->needNewFragmentUniformOffsets = SDL_TRUE; + commandBuffer->needNewFragmentUniformOffsets = true; } else if (uniformBufferStage == VULKAN_UNIFORM_BUFFER_STAGE_COMPUTE) { - commandBuffer->needNewComputeUniformOffsets = SDL_TRUE; + commandBuffer->needNewComputeUniformOffsets = true; } else { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Unrecognized shader stage!"); return; @@ -8005,12 +8005,12 @@ static void VULKAN_BindGraphicsPipeline( } // Mark bindings as needed - vulkanCommandBuffer->needNewVertexResourceDescriptorSet = SDL_TRUE; - vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = SDL_TRUE; - vulkanCommandBuffer->needNewVertexUniformDescriptorSet = SDL_TRUE; - vulkanCommandBuffer->needNewFragmentUniformDescriptorSet = SDL_TRUE; - vulkanCommandBuffer->needNewVertexUniformOffsets = SDL_TRUE; - vulkanCommandBuffer->needNewFragmentUniformOffsets = SDL_TRUE; + vulkanCommandBuffer->needNewVertexResourceDescriptorSet = true; + vulkanCommandBuffer->needNewFragmentResourceDescriptorSet = true; + vulkanCommandBuffer->needNewVertexUniformDescriptorSet = true; + vulkanCommandBuffer->needNewFragmentUniformDescriptorSet = true; + vulkanCommandBuffer->needNewVertexUniformOffsets = true; + vulkanCommandBuffer->needNewFragmentUniformOffsets = true; } static void VULKAN_BindVertexBuffers( @@ -8224,10 +8224,10 @@ static void VULKAN_BindComputePipeline( } // Mark binding as needed - vulkanCommandBuffer->needNewComputeWriteOnlyDescriptorSet = SDL_TRUE; - vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = SDL_TRUE; - vulkanCommandBuffer->needNewComputeUniformDescriptorSet = SDL_TRUE; - vulkanCommandBuffer->needNewComputeUniformOffsets = SDL_TRUE; + vulkanCommandBuffer->needNewComputeWriteOnlyDescriptorSet = true; + vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true; + vulkanCommandBuffer->needNewComputeUniformDescriptorSet = true; + vulkanCommandBuffer->needNewComputeUniformOffsets = true; } static void VULKAN_BindComputeStorageTextures( @@ -8264,7 +8264,7 @@ static void VULKAN_BindComputeStorageTextures( textureContainer->activeTextureHandle->vulkanTexture); } - vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = SDL_TRUE; + vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true; } static void VULKAN_BindComputeStorageBuffers( @@ -8302,7 +8302,7 @@ static void VULKAN_BindComputeStorageBuffers( bufferContainer->activeBufferHandle->vulkanBuffer); } - vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = SDL_TRUE; + vulkanCommandBuffer->needNewComputeReadOnlyDescriptorSet = true; } static void VULKAN_PushComputeUniformData( @@ -8415,7 +8415,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets( bufferInfoCount = 0; imageInfoCount = 0; - commandBuffer->needNewComputeReadOnlyDescriptorSet = SDL_FALSE; + commandBuffer->needNewComputeReadOnlyDescriptorSet = false; } if (commandBuffer->needNewComputeWriteOnlyDescriptorSet) { @@ -8496,7 +8496,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets( bufferInfoCount = 0; imageInfoCount = 0; - commandBuffer->needNewComputeWriteOnlyDescriptorSet = SDL_FALSE; + commandBuffer->needNewComputeWriteOnlyDescriptorSet = false; } if (commandBuffer->needNewComputeUniformDescriptorSet) { @@ -8544,8 +8544,8 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets( bufferInfoCount = 0; imageInfoCount = 0; - commandBuffer->needNewComputeUniformDescriptorSet = SDL_FALSE; - commandBuffer->needNewComputeUniformOffsets = SDL_TRUE; + commandBuffer->needNewComputeUniformDescriptorSet = false; + commandBuffer->needNewComputeUniformOffsets = true; } if (commandBuffer->needNewComputeUniformOffsets) { @@ -8563,7 +8563,7 @@ static void VULKAN_INTERNAL_BindComputeDescriptorSets( resourceLayout->uniformBufferCount, dynamicOffsets); - commandBuffer->needNewComputeUniformOffsets = SDL_FALSE; + commandBuffer->needNewComputeUniformOffsets = false; } } @@ -8666,7 +8666,7 @@ static void VULKAN_EndComputePass( static void *VULKAN_MapTransferBuffer( SDL_GPURenderer *driverData, SDL_GPUTransferBuffer *transferBuffer, - SDL_bool cycle) + bool cycle) { VulkanRenderer *renderer = (VulkanRenderer *)driverData; VulkanBufferContainer *transferBufferContainer = (VulkanBufferContainer *)transferBuffer; @@ -8706,7 +8706,7 @@ static void VULKAN_UploadToTexture( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUTextureTransferInfo *source, SDL_GPUTextureRegion *destination, - SDL_bool cycle) + bool cycle) { VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer; VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer; @@ -8762,7 +8762,7 @@ static void VULKAN_UploadToBuffer( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUTransferBufferLocation *source, SDL_GPUBufferRegion *destination, - SDL_bool cycle) + bool cycle) { VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer; VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer; @@ -8905,7 +8905,7 @@ static void VULKAN_CopyTextureToTexture( Uint32 w, Uint32 h, Uint32 d, - SDL_bool cycle) + bool cycle) { VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer; VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer; @@ -8981,7 +8981,7 @@ static void VULKAN_CopyBufferToBuffer( SDL_GPUBufferLocation *source, SDL_GPUBufferLocation *destination, Uint32 size, - SDL_bool cycle) + bool cycle) { VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer; VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer; @@ -9136,7 +9136,7 @@ static void VULKAN_Blit( SDL_GPUBlitRegion *destination, SDL_FlipMode flipMode, SDL_GPUFilter filterMode, - SDL_bool cycle) + bool cycle) { VulkanCommandBuffer *vulkanCommandBuffer = (VulkanCommandBuffer *)commandBuffer; VulkanRenderer *renderer = (VulkanRenderer *)vulkanCommandBuffer->renderer; @@ -9300,17 +9300,17 @@ static void VULKAN_INTERNAL_AllocateCommandBuffers( // Resource bind tracking - commandBuffer->needNewVertexResourceDescriptorSet = SDL_TRUE; - commandBuffer->needNewVertexUniformDescriptorSet = SDL_TRUE; - commandBuffer->needNewVertexUniformOffsets = SDL_TRUE; - commandBuffer->needNewFragmentResourceDescriptorSet = SDL_TRUE; - commandBuffer->needNewFragmentUniformDescriptorSet = SDL_TRUE; - commandBuffer->needNewFragmentUniformOffsets = SDL_TRUE; + commandBuffer->needNewVertexResourceDescriptorSet = true; + commandBuffer->needNewVertexUniformDescriptorSet = true; + commandBuffer->needNewVertexUniformOffsets = true; + commandBuffer->needNewFragmentResourceDescriptorSet = true; + commandBuffer->needNewFragmentUniformDescriptorSet = true; + commandBuffer->needNewFragmentUniformOffsets = true; - commandBuffer->needNewComputeWriteOnlyDescriptorSet = SDL_TRUE; - commandBuffer->needNewComputeReadOnlyDescriptorSet = SDL_TRUE; - commandBuffer->needNewComputeUniformDescriptorSet = SDL_TRUE; - commandBuffer->needNewComputeUniformOffsets = SDL_TRUE; + commandBuffer->needNewComputeWriteOnlyDescriptorSet = true; + commandBuffer->needNewComputeReadOnlyDescriptorSet = true; + commandBuffer->needNewComputeUniformDescriptorSet = true; + commandBuffer->needNewComputeUniformOffsets = true; commandBuffer->vertexResourceDescriptorSet = VK_NULL_HANDLE; commandBuffer->vertexUniformDescriptorSet = VK_NULL_HANDLE; @@ -9377,7 +9377,7 @@ static VulkanCommandPool *VULKAN_INTERNAL_FetchCommandPool( CommandPoolHashTableKey key; key.threadID = threadID; - SDL_bool result = SDL_FindInHashTable( + bool result = SDL_FindInHashTable( renderer->commandPoolHashTable, (const void *)&key, (const void **)&vulkanCommandPool); @@ -9491,16 +9491,16 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer( commandBuffer->depthStencilAttachmentSubresource = NULL; - commandBuffer->needNewVertexResourceDescriptorSet = SDL_TRUE; - commandBuffer->needNewVertexUniformDescriptorSet = SDL_TRUE; - commandBuffer->needNewVertexUniformOffsets = SDL_TRUE; - commandBuffer->needNewFragmentResourceDescriptorSet = SDL_TRUE; - commandBuffer->needNewFragmentUniformDescriptorSet = SDL_TRUE; - commandBuffer->needNewFragmentUniformOffsets = SDL_TRUE; + commandBuffer->needNewVertexResourceDescriptorSet = true; + commandBuffer->needNewVertexUniformDescriptorSet = true; + commandBuffer->needNewVertexUniformOffsets = true; + commandBuffer->needNewFragmentResourceDescriptorSet = true; + commandBuffer->needNewFragmentUniformDescriptorSet = true; + commandBuffer->needNewFragmentUniformOffsets = true; - commandBuffer->needNewComputeReadOnlyDescriptorSet = SDL_TRUE; - commandBuffer->needNewComputeUniformDescriptorSet = SDL_TRUE; - commandBuffer->needNewComputeUniformOffsets = SDL_TRUE; + commandBuffer->needNewComputeReadOnlyDescriptorSet = true; + commandBuffer->needNewComputeUniformDescriptorSet = true; + commandBuffer->needNewComputeUniformOffsets = true; commandBuffer->vertexResourceDescriptorSet = VK_NULL_HANDLE; commandBuffer->vertexUniformDescriptorSet = VK_NULL_HANDLE; @@ -9547,7 +9547,7 @@ static SDL_GPUCommandBuffer *VULKAN_AcquireCommandBuffer( return (SDL_GPUCommandBuffer *)commandBuffer; } -static SDL_bool VULKAN_QueryFence( +static bool VULKAN_QueryFence( SDL_GPURenderer *driverData, SDL_GPUFence *fence) { @@ -9611,13 +9611,13 @@ static SDL_bool VULKAN_INTERNAL_OnWindowResize(void *userdata, SDL_Event *e) WindowData *data; if (e->type == SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED) { data = VULKAN_INTERNAL_FetchWindowData(w); - data->needsSwapchainRecreate = SDL_TRUE; + data->needsSwapchainRecreate = true; } - return SDL_FALSE; + return true; } -static SDL_bool VULKAN_SupportsSwapchainComposition( +static bool VULKAN_SupportsSwapchainComposition( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUSwapchainComposition swapchainComposition) @@ -9626,11 +9626,11 @@ static SDL_bool VULKAN_SupportsSwapchainComposition( WindowData *windowData = VULKAN_INTERNAL_FetchWindowData(window); VkSurfaceKHR surface; SwapchainSupportDetails supportDetails; - SDL_bool result = SDL_FALSE; + bool result = false; if (windowData == NULL || windowData->swapchainData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Must claim window before querying swapchain composition support!"); - return SDL_FALSE; + return false; } surface = windowData->swapchainData->surface; @@ -9663,7 +9663,7 @@ static SDL_bool VULKAN_SupportsSwapchainComposition( return result; } -static SDL_bool VULKAN_SupportsPresentMode( +static bool VULKAN_SupportsPresentMode( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUPresentMode presentMode) @@ -9672,11 +9672,11 @@ static SDL_bool VULKAN_SupportsPresentMode( WindowData *windowData = VULKAN_INTERNAL_FetchWindowData(window); VkSurfaceKHR surface; SwapchainSupportDetails supportDetails; - SDL_bool result = SDL_FALSE; + bool result = false; if (windowData == NULL || windowData->swapchainData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Must claim window before querying present mode support!"); - return SDL_FALSE; + return false; } surface = windowData->swapchainData->surface; @@ -9699,7 +9699,7 @@ static SDL_bool VULKAN_SupportsPresentMode( return result; } -static SDL_bool VULKAN_ClaimWindow( +static bool VULKAN_ClaimWindow( SDL_GPURenderer *driverData, SDL_Window *window) { @@ -9781,7 +9781,7 @@ static void VULKAN_UnclaimWindow( SDL_DelEventWatch(VULKAN_INTERNAL_OnWindowResize, window); } -static SDL_bool VULKAN_INTERNAL_RecreateSwapchain( +static bool VULKAN_INTERNAL_RecreateSwapchain( VulkanRenderer *renderer, WindowData *windowData) { @@ -9847,7 +9847,7 @@ static SDL_GPUTexture *VULKAN_AcquireSwapchainTexture( // In VSYNC mode, block until the least recent presented frame is done VULKAN_WaitForFences( (SDL_GPURenderer *)renderer, - SDL_TRUE, + true, (SDL_GPUFence **)&swapchainData->inFlightFences[swapchainData->frameCounter], 1); } else { @@ -10011,7 +10011,7 @@ static SDL_GPUTextureFormat VULKAN_GetSwapchainTextureFormat( windowData->swapchainData->usingFallbackFormat); } -static SDL_bool VULKAN_SetSwapchainParameters( +static bool VULKAN_SetSwapchainParameters( SDL_GPURenderer *driverData, SDL_Window *window, SDL_GPUSwapchainComposition swapchainComposition, @@ -10021,17 +10021,17 @@ static SDL_bool VULKAN_SetSwapchainParameters( if (windowData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Cannot set swapchain parameters on unclaimed window!"); - return SDL_FALSE; + return false; } if (!VULKAN_SupportsSwapchainComposition(driverData, window, swapchainComposition)) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Swapchain composition not supported!"); - return SDL_FALSE; + return false; } if (!VULKAN_SupportsPresentMode(driverData, window, presentMode)) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Present mode not supported!"); - return SDL_FALSE; + return false; } windowData->presentMode = presentMode; @@ -10300,7 +10300,7 @@ static void VULKAN_INTERNAL_CleanCommandBuffer( static void VULKAN_WaitForFences( SDL_GPURenderer *driverData, - SDL_bool waitAll, + bool waitAll, SDL_GPUFence **pFences, Uint32 fenceCount) { @@ -10398,7 +10398,7 @@ static void VULKAN_Submit( VulkanTextureSubresource *swapchainTextureSubresource; Uint8 commandBufferCleaned = 0; VulkanMemorySubAllocator *allocator; - SDL_bool presenting = SDL_FALSE; + bool presenting = false; SDL_LockMutex(renderer->submitLock); @@ -10465,7 +10465,7 @@ static void VULKAN_Submit( // Present, if applicable for (Uint32 j = 0; j < vulkanCommandBuffer->presentDataCount; j += 1) { - presenting = SDL_TRUE; + presenting = true; presentData = &vulkanCommandBuffer->presentDatas[j]; @@ -10761,7 +10761,7 @@ static Uint8 VULKAN_INTERNAL_DefragmentMemory( // Format Info -static SDL_bool VULKAN_SupportsTextureFormat( +static bool VULKAN_SupportsTextureFormat( SDL_GPURenderer *driverData, SDL_GPUTextureFormat format, SDL_GPUTextureType type, @@ -10874,8 +10874,8 @@ static inline Uint8 SupportsInstanceExtension( static Uint8 VULKAN_INTERNAL_CheckInstanceExtensions( const char **requiredExtensions, Uint32 requiredExtensionsLength, - SDL_bool *supportsDebugUtils, - SDL_bool *supportsColorspace) + bool *supportsDebugUtils, + bool *supportsColorspace) { Uint32 extensionCount, i; VkExtensionProperties *availableExtensions; @@ -11109,7 +11109,7 @@ static Uint8 VULKAN_INTERNAL_IsDeviceSuitable( { Uint32 queueFamilyCount, queueFamilyRank, queueFamilyBest; VkQueueFamilyProperties *queueProps; - SDL_bool supportsPresent; + bool supportsPresent; VkPhysicalDeviceProperties deviceProperties; Uint32 i; @@ -11378,12 +11378,12 @@ static Uint8 VULKAN_INTERNAL_CreateLogicalDevice( if (haveDeviceFeatures.fillModeNonSolid) { desiredDeviceFeatures.fillModeNonSolid = VK_TRUE; - renderer->supportsFillModeNonSolid = SDL_TRUE; + renderer->supportsFillModeNonSolid = true; } if (haveDeviceFeatures.multiDrawIndirect) { desiredDeviceFeatures.multiDrawIndirect = VK_TRUE; - renderer->supportsMultiDrawIndirect = SDL_TRUE; + renderer->supportsMultiDrawIndirect = true; } // creating the logical device @@ -11487,14 +11487,14 @@ static void VULKAN_INTERNAL_LoadEntryPoints(void) #include "SDL_gpu_vulkan_vkfuncs.h" } -static SDL_bool VULKAN_INTERNAL_PrepareVulkan( +static bool VULKAN_INTERNAL_PrepareVulkan( VulkanRenderer *renderer) { VULKAN_INTERNAL_LoadEntryPoints(); if (!VULKAN_INTERNAL_CreateInstance(renderer)) { SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "Vulkan: Could not create Vulkan instance"); - return SDL_FALSE; + return false; } #define VULKAN_INSTANCE_FUNCTION(func) \ @@ -11503,23 +11503,23 @@ static SDL_bool VULKAN_INTERNAL_PrepareVulkan( if (!VULKAN_INTERNAL_DeterminePhysicalDevice(renderer)) { SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "Vulkan: Failed to determine a suitable physical device"); - return SDL_FALSE; + return false; } - return SDL_TRUE; + return true; } -static SDL_bool VULKAN_PrepareDriver(SDL_VideoDevice *_this) +static bool VULKAN_PrepareDriver(SDL_VideoDevice *_this) { // Set up dummy VulkanRenderer VulkanRenderer *renderer; Uint8 result; if (_this->Vulkan_CreateSurface == NULL) { - return SDL_FALSE; + return false; } if (!SDL_Vulkan_LoadLibrary(NULL)) { - return SDL_FALSE; + return false; } renderer = (VulkanRenderer *)SDL_malloc(sizeof(VulkanRenderer)); @@ -11535,7 +11535,7 @@ static SDL_bool VULKAN_PrepareDriver(SDL_VideoDevice *_this) return result; } -static SDL_GPUDevice *VULKAN_CreateDevice(SDL_bool debugMode, SDL_bool preferLowPower, SDL_PropertiesID props) +static SDL_GPUDevice *VULKAN_CreateDevice(bool debugMode, bool preferLowPower, SDL_PropertiesID props) { VulkanRenderer *renderer; @@ -11665,7 +11665,7 @@ static SDL_GPUDevice *VULKAN_CreateDevice(SDL_bool debugMode, SDL_bool preferLow VULKAN_INTERNAL_CommandPoolHashFunction, VULKAN_INTERNAL_CommandPoolHashKeyMatch, VULKAN_INTERNAL_CommandPoolHashNuke, - SDL_FALSE); + false); renderer->renderPassHashTable = SDL_CreateHashTable( (void *)renderer, @@ -11673,7 +11673,7 @@ static SDL_GPUDevice *VULKAN_CreateDevice(SDL_bool debugMode, SDL_bool preferLow VULKAN_INTERNAL_RenderPassHashFunction, VULKAN_INTERNAL_RenderPassHashKeyMatch, VULKAN_INTERNAL_RenderPassHashNuke, - SDL_FALSE); + false); renderer->framebufferHashTable = SDL_CreateHashTable( (void *)renderer, @@ -11681,7 +11681,7 @@ static SDL_GPUDevice *VULKAN_CreateDevice(SDL_bool debugMode, SDL_bool preferLow VULKAN_INTERNAL_FramebufferHashFunction, VULKAN_INTERNAL_FramebufferHashKeyMatch, VULKAN_INTERNAL_FramebufferHashNuke, - SDL_FALSE); + false); // Initialize fence pool diff --git a/src/thread/windows/SDL_syssem.c b/src/thread/windows/SDL_syssem.c index a87fea961f..dcfd2c9f00 100644 --- a/src/thread/windows/SDL_syssem.c +++ b/src/thread/windows/SDL_syssem.c @@ -252,7 +252,7 @@ static bool SDL_WaitSemaphoreTimeoutNS_kern(SDL_Semaphore *_sem, Sint64 timeoutN DWORD dwMilliseconds; if (!sem) { - return SDL_TRUE; + return true; } if (timeoutNS < 0) { diff --git a/src/video/SDL_pixels.c b/src/video/SDL_pixels.c index ee5d189a03..eca7c41fcf 100644 --- a/src/video/SDL_pixels.c +++ b/src/video/SDL_pixels.c @@ -578,7 +578,7 @@ SDL_PixelFormat SDL_GetPixelFormatForMasks(int bpp, Uint32 Rmask, Uint32 Gmask, static SDL_HashTable *SDL_format_details; static SDL_Mutex *SDL_format_details_lock; -static SDL_bool SDL_InitPixelFormatDetails(SDL_PixelFormatDetails *details, SDL_PixelFormat format) +static bool SDL_InitPixelFormatDetails(SDL_PixelFormatDetails *details, SDL_PixelFormat format) { int bpp; Uint32 Rmask, Gmask, Bmask, Amask; diff --git a/src/video/android/SDL_androidwindow.c b/src/video/android/SDL_androidwindow.c index 40ecf405ed..f2a5757be7 100644 --- a/src/video/android/SDL_androidwindow.c +++ b/src/video/android/SDL_androidwindow.c @@ -65,7 +65,7 @@ bool Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Proper data = (SDL_WindowData *)SDL_calloc(1, sizeof(*data)); if (!data) { - result = SDL_FALSE; + result = false; goto endfunction; } @@ -86,7 +86,7 @@ bool Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Proper if (data->egl_surface == EGL_NO_SURFACE) { ANativeWindow_release(data->native_window); SDL_free(data); - result = SDL_FALSE; + result = false; goto endfunction; } }