mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-29 16:09:13 +00:00
Use stdbool internally in SDL
This commit is contained in:
parent
dfcabc3db8
commit
5518aca054
11 changed files with 698 additions and 698 deletions
|
@ -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)));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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<MTLSamplerState> vertexSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE];
|
||||
id<MTLTexture> vertexTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE];
|
||||
|
@ -538,7 +538,7 @@ struct MetalRenderer
|
|||
id<MTLDevice> device;
|
||||
id<MTLCommandQueue> 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;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue