mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-09-27 22:30:52 +08:00
Use stdbool internally in SDL
This commit is contained in:
@@ -1897,7 +1897,7 @@ SDL_bool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams
|
|||||||
SDL_AudioStream *stream = streams[i];
|
SDL_AudioStream *stream = streams[i];
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
SDL_SetError("Stream #%d is NULL", i);
|
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 {
|
} else {
|
||||||
SDL_LockMutex(stream->lock);
|
SDL_LockMutex(stream->lock);
|
||||||
SDL_assert((stream->bound_device == NULL) == ((stream->prev_binding == NULL) || (stream->next_binding == NULL)));
|
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->data);
|
||||||
SDL_free(iodata);
|
SDL_free(iodata);
|
||||||
return SDL_TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
#endif // defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)
|
#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)
|
static SDL_bool SDLCALL mem_close(void *userdata)
|
||||||
{
|
{
|
||||||
SDL_free(userdata);
|
SDL_free(userdata);
|
||||||
return SDL_TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Functions to create SDL_IOStream structures from various data sources
|
// Functions to create SDL_IOStream structures from various data sources
|
||||||
|
|||||||
+76
-76
@@ -176,7 +176,7 @@ SDL_GPUGraphicsPipeline *SDL_GPU_FetchBlitPipeline(
|
|||||||
blitPipelineCreateInfo.attachmentInfo.colorAttachmentDescriptions = &colorAttachmentDesc;
|
blitPipelineCreateInfo.attachmentInfo.colorAttachmentDescriptions = &colorAttachmentDesc;
|
||||||
blitPipelineCreateInfo.attachmentInfo.colorAttachmentCount = 1;
|
blitPipelineCreateInfo.attachmentInfo.colorAttachmentCount = 1;
|
||||||
blitPipelineCreateInfo.attachmentInfo.depthStencilFormat = SDL_GPU_TEXTUREFORMAT_D16_UNORM; // arbitrary
|
blitPipelineCreateInfo.attachmentInfo.depthStencilFormat = SDL_GPU_TEXTUREFORMAT_D16_UNORM; // arbitrary
|
||||||
blitPipelineCreateInfo.attachmentInfo.hasDepthStencilAttachment = SDL_FALSE;
|
blitPipelineCreateInfo.attachmentInfo.hasDepthStencilAttachment = false;
|
||||||
|
|
||||||
blitPipelineCreateInfo.vertexShader = blitVertexShader;
|
blitPipelineCreateInfo.vertexShader = blitVertexShader;
|
||||||
if (sourceTextureType == SDL_GPU_TEXTURETYPE_CUBE) {
|
if (sourceTextureType == SDL_GPU_TEXTURETYPE_CUBE) {
|
||||||
@@ -230,7 +230,7 @@ void SDL_GPU_BlitCommon(
|
|||||||
SDL_GPUBlitRegion *destination,
|
SDL_GPUBlitRegion *destination,
|
||||||
SDL_FlipMode flipMode,
|
SDL_FlipMode flipMode,
|
||||||
SDL_GPUFilter filterMode,
|
SDL_GPUFilter filterMode,
|
||||||
SDL_bool cycle,
|
bool cycle,
|
||||||
SDL_GPUSampler *blitLinearSampler,
|
SDL_GPUSampler *blitLinearSampler,
|
||||||
SDL_GPUSampler *blitNearestSampler,
|
SDL_GPUSampler *blitNearestSampler,
|
||||||
SDL_GPUShader *blitVertexShader,
|
SDL_GPUShader *blitVertexShader,
|
||||||
@@ -399,22 +399,22 @@ SDL_GPUDevice *SDL_CreateGPUDevice(
|
|||||||
SDL_GPUDevice *result;
|
SDL_GPUDevice *result;
|
||||||
SDL_PropertiesID props = SDL_CreateProperties();
|
SDL_PropertiesID props = SDL_CreateProperties();
|
||||||
if (formatFlags & SDL_GPU_SHADERFORMAT_SECRET) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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) {
|
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_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, debugMode);
|
||||||
SDL_SetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING, name);
|
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_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props)
|
||||||
{
|
{
|
||||||
SDL_GPUShaderFormat formatFlags = 0;
|
SDL_GPUShaderFormat formatFlags = 0;
|
||||||
SDL_bool debugMode;
|
bool debugMode;
|
||||||
SDL_bool preferLowPower;
|
bool preferLowPower;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
const char *gpudriver;
|
const char *gpudriver;
|
||||||
@@ -440,27 +440,27 @@ SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props)
|
|||||||
return NULL;
|
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;
|
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;
|
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;
|
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;
|
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;
|
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;
|
formatFlags |= SDL_GPU_SHADERFORMAT_METALLIB;
|
||||||
}
|
}
|
||||||
|
|
||||||
debugMode = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, SDL_TRUE);
|
debugMode = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, true);
|
||||||
preferLowPower = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL, SDL_FALSE);
|
preferLowPower = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL, false);
|
||||||
|
|
||||||
gpudriver = SDL_GetHint(SDL_HINT_GPU_DRIVER);
|
gpudriver = SDL_GetHint(SDL_HINT_GPU_DRIVER);
|
||||||
if (gpudriver == NULL) {
|
if (gpudriver == NULL) {
|
||||||
@@ -552,10 +552,10 @@ SDL_bool SDL_SupportsGPUTextureFormat(
|
|||||||
SDL_GPUTextureType type,
|
SDL_GPUTextureType type,
|
||||||
SDL_GPUTextureUsageFlags usage)
|
SDL_GPUTextureUsageFlags usage)
|
||||||
{
|
{
|
||||||
CHECK_DEVICE_MAGIC(device, SDL_FALSE);
|
CHECK_DEVICE_MAGIC(device, false);
|
||||||
|
|
||||||
if (device->debugMode) {
|
if (device->debugMode) {
|
||||||
CHECK_TEXTUREFORMAT_ENUM_INVALID(format, SDL_FALSE)
|
CHECK_TEXTUREFORMAT_ENUM_INVALID(format, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return device->SupportsTextureFormat(
|
return device->SupportsTextureFormat(
|
||||||
@@ -701,7 +701,7 @@ SDL_GPUTexture *SDL_CreateGPUTexture(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (device->debugMode) {
|
if (device->debugMode) {
|
||||||
SDL_bool failed = SDL_FALSE;
|
bool failed = false;
|
||||||
|
|
||||||
const Uint32 MAX_2D_DIMENSION = 16384;
|
const Uint32 MAX_2D_DIMENSION = 16384;
|
||||||
const Uint32 MAX_3D_DIMENSION = 2048;
|
const Uint32 MAX_3D_DIMENSION = 2048;
|
||||||
@@ -711,86 +711,86 @@ SDL_GPUTexture *SDL_CreateGPUTexture(
|
|||||||
|
|
||||||
if (textureCreateInfo->width <= 0 || textureCreateInfo->height <= 0 || textureCreateInfo->layerCountOrDepth <= 0) {
|
if (textureCreateInfo->width <= 0 || textureCreateInfo->height <= 0 || textureCreateInfo->layerCountOrDepth <= 0) {
|
||||||
SDL_assert_release(!"For any texture: width, height, and layerCountOrDepth must be >= 1");
|
SDL_assert_release(!"For any texture: width, height, and layerCountOrDepth must be >= 1");
|
||||||
failed = SDL_TRUE;
|
failed = true;
|
||||||
}
|
}
|
||||||
if (textureCreateInfo->levelCount <= 0) {
|
if (textureCreateInfo->levelCount <= 0) {
|
||||||
SDL_assert_release(!"For any texture: levelCount must be >= 1");
|
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)) {
|
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");
|
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))) {
|
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");
|
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)) {
|
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");
|
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) {
|
if (textureCreateInfo->type == SDL_GPU_TEXTURETYPE_CUBE) {
|
||||||
// Cubemap validation
|
// Cubemap validation
|
||||||
if (textureCreateInfo->width != textureCreateInfo->height) {
|
if (textureCreateInfo->width != textureCreateInfo->height) {
|
||||||
SDL_assert_release(!"For cube textures: width and height must be identical");
|
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) {
|
if (textureCreateInfo->width > MAX_2D_DIMENSION || textureCreateInfo->height > MAX_2D_DIMENSION) {
|
||||||
SDL_assert_release(!"For cube textures: width and height must be <= 16384");
|
SDL_assert_release(!"For cube textures: width and height must be <= 16384");
|
||||||
failed = SDL_TRUE;
|
failed = true;
|
||||||
}
|
}
|
||||||
if (textureCreateInfo->layerCountOrDepth != 6) {
|
if (textureCreateInfo->layerCountOrDepth != 6) {
|
||||||
SDL_assert_release(!"For cube textures: layerCountOrDepth must be 6");
|
SDL_assert_release(!"For cube textures: layerCountOrDepth must be 6");
|
||||||
failed = SDL_TRUE;
|
failed = true;
|
||||||
}
|
}
|
||||||
if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1) {
|
if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1) {
|
||||||
SDL_assert_release(!"For cube textures: sampleCount must be 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)) {
|
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");
|
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) {
|
} else if (textureCreateInfo->type == SDL_GPU_TEXTURETYPE_3D) {
|
||||||
// 3D Texture Validation
|
// 3D Texture Validation
|
||||||
if (textureCreateInfo->width > MAX_3D_DIMENSION || textureCreateInfo->height > MAX_3D_DIMENSION || textureCreateInfo->layerCountOrDepth > MAX_3D_DIMENSION) {
|
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");
|
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) {
|
if (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT) {
|
||||||
SDL_assert_release(!"For 3D textures: usageFlags must not contain 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) {
|
if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1) {
|
||||||
SDL_assert_release(!"For 3D textures: sampleCount must be 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)) {
|
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");
|
SDL_assert_release(!"For 3D textures: the format is unsupported for the given usageFlags");
|
||||||
failed = SDL_TRUE;
|
failed = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (textureCreateInfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY) {
|
if (textureCreateInfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY) {
|
||||||
// Array Texture Validation
|
// Array Texture Validation
|
||||||
if (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT) {
|
if (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET_BIT) {
|
||||||
SDL_assert_release(!"For array textures: usageFlags must not contain 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) {
|
if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1) {
|
||||||
SDL_assert_release(!"For array textures: sampleCount must be SDL_GPU_SAMPLECOUNT_1");
|
SDL_assert_release(!"For array textures: sampleCount must be SDL_GPU_SAMPLECOUNT_1");
|
||||||
failed = SDL_TRUE;
|
failed = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 2D Texture Validation
|
// 2D Texture Validation
|
||||||
if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1 && textureCreateInfo->levelCount > 1) {
|
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");
|
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)) {
|
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");
|
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 = (CommandBufferCommonHeader *)commandBuffer;
|
||||||
commandBufferHeader->device = device;
|
commandBufferHeader->device = device;
|
||||||
commandBufferHeader->renderPass.commandBuffer = commandBuffer;
|
commandBufferHeader->renderPass.commandBuffer = commandBuffer;
|
||||||
commandBufferHeader->renderPass.inProgress = SDL_FALSE;
|
commandBufferHeader->renderPass.inProgress = false;
|
||||||
commandBufferHeader->graphicsPipelineBound = SDL_FALSE;
|
commandBufferHeader->graphicsPipelineBound = false;
|
||||||
commandBufferHeader->computePass.commandBuffer = commandBuffer;
|
commandBufferHeader->computePass.commandBuffer = commandBuffer;
|
||||||
commandBufferHeader->computePass.inProgress = SDL_FALSE;
|
commandBufferHeader->computePass.inProgress = false;
|
||||||
commandBufferHeader->computePipelineBound = SDL_FALSE;
|
commandBufferHeader->computePipelineBound = false;
|
||||||
commandBufferHeader->copyPass.commandBuffer = commandBuffer;
|
commandBufferHeader->copyPass.commandBuffer = commandBuffer;
|
||||||
commandBufferHeader->copyPass.inProgress = SDL_FALSE;
|
commandBufferHeader->copyPass.inProgress = false;
|
||||||
commandBufferHeader->submitted = SDL_FALSE;
|
commandBufferHeader->submitted = false;
|
||||||
|
|
||||||
return commandBuffer;
|
return commandBuffer;
|
||||||
}
|
}
|
||||||
@@ -1196,7 +1196,7 @@ SDL_GPURenderPass *SDL_BeginGPURenderPass(
|
|||||||
depthStencilAttachmentInfo);
|
depthStencilAttachmentInfo);
|
||||||
|
|
||||||
commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer;
|
commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer;
|
||||||
commandBufferHeader->renderPass.inProgress = SDL_TRUE;
|
commandBufferHeader->renderPass.inProgress = true;
|
||||||
return (SDL_GPURenderPass *)&(commandBufferHeader->renderPass);
|
return (SDL_GPURenderPass *)&(commandBufferHeader->renderPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1220,7 +1220,7 @@ void SDL_BindGPUGraphicsPipeline(
|
|||||||
graphicsPipeline);
|
graphicsPipeline);
|
||||||
|
|
||||||
commandBufferHeader = (CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER;
|
commandBufferHeader = (CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER;
|
||||||
commandBufferHeader->graphicsPipelineBound = SDL_TRUE;
|
commandBufferHeader->graphicsPipelineBound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_SetGPUViewport(
|
void SDL_SetGPUViewport(
|
||||||
@@ -1601,8 +1601,8 @@ void SDL_EndGPURenderPass(
|
|||||||
RENDERPASS_COMMAND_BUFFER);
|
RENDERPASS_COMMAND_BUFFER);
|
||||||
|
|
||||||
commandBufferCommonHeader = (CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER;
|
commandBufferCommonHeader = (CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER;
|
||||||
commandBufferCommonHeader->renderPass.inProgress = SDL_FALSE;
|
commandBufferCommonHeader->renderPass.inProgress = false;
|
||||||
commandBufferCommonHeader->graphicsPipelineBound = SDL_FALSE;
|
commandBufferCommonHeader->graphicsPipelineBound = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute Pass
|
// Compute Pass
|
||||||
@@ -1649,7 +1649,7 @@ SDL_GPUComputePass *SDL_BeginGPUComputePass(
|
|||||||
storageBufferBindingCount);
|
storageBufferBindingCount);
|
||||||
|
|
||||||
commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer;
|
commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer;
|
||||||
commandBufferHeader->computePass.inProgress = SDL_TRUE;
|
commandBufferHeader->computePass.inProgress = true;
|
||||||
return (SDL_GPUComputePass *)&(commandBufferHeader->computePass);
|
return (SDL_GPUComputePass *)&(commandBufferHeader->computePass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1677,7 +1677,7 @@ void SDL_BindGPUComputePipeline(
|
|||||||
computePipeline);
|
computePipeline);
|
||||||
|
|
||||||
commandBufferHeader = (CommandBufferCommonHeader *)COMPUTEPASS_COMMAND_BUFFER;
|
commandBufferHeader = (CommandBufferCommonHeader *)COMPUTEPASS_COMMAND_BUFFER;
|
||||||
commandBufferHeader->computePipelineBound = SDL_TRUE;
|
commandBufferHeader->computePipelineBound = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_BindGPUComputeStorageTextures(
|
void SDL_BindGPUComputeStorageTextures(
|
||||||
@@ -1794,8 +1794,8 @@ void SDL_EndGPUComputePass(
|
|||||||
COMPUTEPASS_COMMAND_BUFFER);
|
COMPUTEPASS_COMMAND_BUFFER);
|
||||||
|
|
||||||
commandBufferCommonHeader = (CommandBufferCommonHeader *)COMPUTEPASS_COMMAND_BUFFER;
|
commandBufferCommonHeader = (CommandBufferCommonHeader *)COMPUTEPASS_COMMAND_BUFFER;
|
||||||
commandBufferCommonHeader->computePass.inProgress = SDL_FALSE;
|
commandBufferCommonHeader->computePass.inProgress = false;
|
||||||
commandBufferCommonHeader->computePipelineBound = SDL_FALSE;
|
commandBufferCommonHeader->computePipelineBound = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TransferBuffer Data
|
// TransferBuffer Data
|
||||||
@@ -1853,7 +1853,7 @@ SDL_GPUCopyPass *SDL_BeginGPUCopyPass(
|
|||||||
commandBuffer);
|
commandBuffer);
|
||||||
|
|
||||||
commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer;
|
commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer;
|
||||||
commandBufferHeader->copyPass.inProgress = SDL_TRUE;
|
commandBufferHeader->copyPass.inProgress = true;
|
||||||
return (SDL_GPUCopyPass *)&(commandBufferHeader->copyPass);
|
return (SDL_GPUCopyPass *)&(commandBufferHeader->copyPass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2036,7 +2036,7 @@ void SDL_EndGPUCopyPass(
|
|||||||
COPYPASS_DEVICE->EndCopyPass(
|
COPYPASS_DEVICE->EndCopyPass(
|
||||||
COPYPASS_COMMAND_BUFFER);
|
COPYPASS_COMMAND_BUFFER);
|
||||||
|
|
||||||
((CommandBufferCommonHeader *)COPYPASS_COMMAND_BUFFER)->copyPass.inProgress = SDL_FALSE;
|
((CommandBufferCommonHeader *)COPYPASS_COMMAND_BUFFER)->copyPass.inProgress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SDL_GenerateGPUMipmaps(
|
void SDL_GenerateGPUMipmaps(
|
||||||
@@ -2099,7 +2099,7 @@ void SDL_BlitGPU(
|
|||||||
CHECK_ANY_PASS_IN_PROGRESS("Cannot blit during a pass!", )
|
CHECK_ANY_PASS_IN_PROGRESS("Cannot blit during a pass!", )
|
||||||
|
|
||||||
// Validation
|
// Validation
|
||||||
SDL_bool failed = SDL_FALSE;
|
bool failed = false;
|
||||||
TextureCommonHeader *srcHeader = (TextureCommonHeader *)source->texture;
|
TextureCommonHeader *srcHeader = (TextureCommonHeader *)source->texture;
|
||||||
TextureCommonHeader *dstHeader = (TextureCommonHeader *)destination->texture;
|
TextureCommonHeader *dstHeader = (TextureCommonHeader *)destination->texture;
|
||||||
|
|
||||||
@@ -2109,19 +2109,19 @@ void SDL_BlitGPU(
|
|||||||
}
|
}
|
||||||
if ((srcHeader->info.usageFlags & SDL_GPU_TEXTUREUSAGE_SAMPLER_BIT) == 0) {
|
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");
|
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) {
|
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");
|
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)) {
|
if (IsDepthFormat(srcHeader->info.format)) {
|
||||||
SDL_assert_release(!"Blit source texture cannot have a depth 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) {
|
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");
|
SDL_assert_release(!"Blit source/destination regions must have non-zero width, height, and depth");
|
||||||
failed = SDL_TRUE;
|
failed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failed) {
|
if (failed) {
|
||||||
@@ -2145,14 +2145,14 @@ SDL_bool SDL_SupportsGPUSwapchainComposition(
|
|||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
SDL_GPUSwapchainComposition swapchainComposition)
|
SDL_GPUSwapchainComposition swapchainComposition)
|
||||||
{
|
{
|
||||||
CHECK_DEVICE_MAGIC(device, SDL_FALSE);
|
CHECK_DEVICE_MAGIC(device, false);
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
SDL_InvalidParamError("window");
|
SDL_InvalidParamError("window");
|
||||||
return SDL_FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->debugMode) {
|
if (device->debugMode) {
|
||||||
CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchainComposition, SDL_FALSE)
|
CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchainComposition, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return device->SupportsSwapchainComposition(
|
return device->SupportsSwapchainComposition(
|
||||||
@@ -2166,14 +2166,14 @@ SDL_bool SDL_SupportsGPUPresentMode(
|
|||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
SDL_GPUPresentMode presentMode)
|
SDL_GPUPresentMode presentMode)
|
||||||
{
|
{
|
||||||
CHECK_DEVICE_MAGIC(device, SDL_FALSE);
|
CHECK_DEVICE_MAGIC(device, false);
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
SDL_InvalidParamError("window");
|
SDL_InvalidParamError("window");
|
||||||
return SDL_FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->debugMode) {
|
if (device->debugMode) {
|
||||||
CHECK_PRESENTMODE_ENUM_INVALID(presentMode, SDL_FALSE)
|
CHECK_PRESENTMODE_ENUM_INVALID(presentMode, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return device->SupportsPresentMode(
|
return device->SupportsPresentMode(
|
||||||
@@ -2186,10 +2186,10 @@ SDL_bool SDL_ClaimGPUWindow(
|
|||||||
SDL_GPUDevice *device,
|
SDL_GPUDevice *device,
|
||||||
SDL_Window *window)
|
SDL_Window *window)
|
||||||
{
|
{
|
||||||
CHECK_DEVICE_MAGIC(device, SDL_FALSE);
|
CHECK_DEVICE_MAGIC(device, false);
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
SDL_InvalidParamError("window");
|
SDL_InvalidParamError("window");
|
||||||
return SDL_FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return device->ClaimWindow(
|
return device->ClaimWindow(
|
||||||
@@ -2218,15 +2218,15 @@ SDL_bool SDL_SetGPUSwapchainParameters(
|
|||||||
SDL_GPUSwapchainComposition swapchainComposition,
|
SDL_GPUSwapchainComposition swapchainComposition,
|
||||||
SDL_GPUPresentMode presentMode)
|
SDL_GPUPresentMode presentMode)
|
||||||
{
|
{
|
||||||
CHECK_DEVICE_MAGIC(device, SDL_FALSE);
|
CHECK_DEVICE_MAGIC(device, false);
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
SDL_InvalidParamError("window");
|
SDL_InvalidParamError("window");
|
||||||
return SDL_FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device->debugMode) {
|
if (device->debugMode) {
|
||||||
CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchainComposition, SDL_FALSE)
|
CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchainComposition, false)
|
||||||
CHECK_PRESENTMODE_ENUM_INVALID(presentMode, SDL_FALSE)
|
CHECK_PRESENTMODE_ENUM_INVALID(presentMode, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return device->SetSwapchainParameters(
|
return device->SetSwapchainParameters(
|
||||||
@@ -2307,7 +2307,7 @@ void SDL_SubmitGPU(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
commandBufferHeader->submitted = SDL_TRUE;
|
commandBufferHeader->submitted = true;
|
||||||
|
|
||||||
COMMAND_BUFFER_DEVICE->Submit(
|
COMMAND_BUFFER_DEVICE->Submit(
|
||||||
commandBuffer);
|
commandBuffer);
|
||||||
@@ -2334,7 +2334,7 @@ SDL_GPUFence *SDL_SubmitGPUAndAcquireFence(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
commandBufferHeader->submitted = SDL_TRUE;
|
commandBufferHeader->submitted = true;
|
||||||
|
|
||||||
return COMMAND_BUFFER_DEVICE->SubmitAndAcquireFence(
|
return COMMAND_BUFFER_DEVICE->SubmitAndAcquireFence(
|
||||||
commandBuffer);
|
commandBuffer);
|
||||||
@@ -2372,10 +2372,10 @@ SDL_bool SDL_QueryGPUFence(
|
|||||||
SDL_GPUDevice *device,
|
SDL_GPUDevice *device,
|
||||||
SDL_GPUFence *fence)
|
SDL_GPUFence *fence)
|
||||||
{
|
{
|
||||||
CHECK_DEVICE_MAGIC(device, SDL_FALSE);
|
CHECK_DEVICE_MAGIC(device, false);
|
||||||
if (fence == NULL) {
|
if (fence == NULL) {
|
||||||
SDL_InvalidParamError("fence");
|
SDL_InvalidParamError("fence");
|
||||||
return SDL_FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return device->QueryFence(
|
return device->QueryFence(
|
||||||
|
|||||||
+31
-31
@@ -29,18 +29,18 @@
|
|||||||
typedef struct Pass
|
typedef struct Pass
|
||||||
{
|
{
|
||||||
SDL_GPUCommandBuffer *commandBuffer;
|
SDL_GPUCommandBuffer *commandBuffer;
|
||||||
SDL_bool inProgress;
|
bool inProgress;
|
||||||
} Pass;
|
} Pass;
|
||||||
|
|
||||||
typedef struct CommandBufferCommonHeader
|
typedef struct CommandBufferCommonHeader
|
||||||
{
|
{
|
||||||
SDL_GPUDevice *device;
|
SDL_GPUDevice *device;
|
||||||
Pass renderPass;
|
Pass renderPass;
|
||||||
SDL_bool graphicsPipelineBound;
|
bool graphicsPipelineBound;
|
||||||
Pass computePass;
|
Pass computePass;
|
||||||
SDL_bool computePipelineBound;
|
bool computePipelineBound;
|
||||||
Pass copyPass;
|
Pass copyPass;
|
||||||
SDL_bool submitted;
|
bool submitted;
|
||||||
} CommandBufferCommonHeader;
|
} CommandBufferCommonHeader;
|
||||||
|
|
||||||
typedef struct TextureCommonHeader
|
typedef struct TextureCommonHeader
|
||||||
@@ -117,7 +117,7 @@ static inline Sint32 Texture_GetBlockSize(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline SDL_bool IsDepthFormat(
|
static inline bool IsDepthFormat(
|
||||||
SDL_GPUTextureFormat format)
|
SDL_GPUTextureFormat format)
|
||||||
{
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
@@ -126,27 +126,27 @@ static inline SDL_bool IsDepthFormat(
|
|||||||
case SDL_GPU_TEXTUREFORMAT_D32_FLOAT:
|
case SDL_GPU_TEXTUREFORMAT_D32_FLOAT:
|
||||||
case SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT:
|
case SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT:
|
||||||
case SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT:
|
case SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT:
|
||||||
return SDL_TRUE;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return SDL_FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline SDL_bool IsStencilFormat(
|
static inline bool IsStencilFormat(
|
||||||
SDL_GPUTextureFormat format)
|
SDL_GPUTextureFormat format)
|
||||||
{
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
case SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT:
|
case SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT:
|
||||||
case SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT:
|
case SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT:
|
||||||
return SDL_TRUE;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return SDL_FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline SDL_bool IsIntegerFormat(
|
static inline bool IsIntegerFormat(
|
||||||
SDL_GPUTextureFormat format)
|
SDL_GPUTextureFormat format)
|
||||||
{
|
{
|
||||||
switch (format) {
|
switch (format) {
|
||||||
@@ -156,10 +156,10 @@ static inline SDL_bool IsIntegerFormat(
|
|||||||
case SDL_GPU_TEXTUREFORMAT_R16_UINT:
|
case SDL_GPU_TEXTUREFORMAT_R16_UINT:
|
||||||
case SDL_GPU_TEXTUREFORMAT_R16G16_UINT:
|
case SDL_GPU_TEXTUREFORMAT_R16G16_UINT:
|
||||||
case SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT:
|
case SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT:
|
||||||
return SDL_TRUE;
|
return true;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return SDL_FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ void SDL_GPU_BlitCommon(
|
|||||||
SDL_GPUBlitRegion *destination,
|
SDL_GPUBlitRegion *destination,
|
||||||
SDL_FlipMode flipMode,
|
SDL_FlipMode flipMode,
|
||||||
SDL_GPUFilter filterMode,
|
SDL_GPUFilter filterMode,
|
||||||
SDL_bool cycle,
|
bool cycle,
|
||||||
SDL_GPUSampler *blitLinearSampler,
|
SDL_GPUSampler *blitLinearSampler,
|
||||||
SDL_GPUSampler *blitNearestSampler,
|
SDL_GPUSampler *blitNearestSampler,
|
||||||
SDL_GPUShader *blitVertexShader,
|
SDL_GPUShader *blitVertexShader,
|
||||||
@@ -524,7 +524,7 @@ struct SDL_GPUDevice
|
|||||||
void *(*MapTransferBuffer)(
|
void *(*MapTransferBuffer)(
|
||||||
SDL_GPURenderer *device,
|
SDL_GPURenderer *device,
|
||||||
SDL_GPUTransferBuffer *transferBuffer,
|
SDL_GPUTransferBuffer *transferBuffer,
|
||||||
SDL_bool cycle);
|
bool cycle);
|
||||||
|
|
||||||
void (*UnmapTransferBuffer)(
|
void (*UnmapTransferBuffer)(
|
||||||
SDL_GPURenderer *device,
|
SDL_GPURenderer *device,
|
||||||
@@ -539,13 +539,13 @@ struct SDL_GPUDevice
|
|||||||
SDL_GPUCommandBuffer *commandBuffer,
|
SDL_GPUCommandBuffer *commandBuffer,
|
||||||
SDL_GPUTextureTransferInfo *source,
|
SDL_GPUTextureTransferInfo *source,
|
||||||
SDL_GPUTextureRegion *destination,
|
SDL_GPUTextureRegion *destination,
|
||||||
SDL_bool cycle);
|
bool cycle);
|
||||||
|
|
||||||
void (*UploadToBuffer)(
|
void (*UploadToBuffer)(
|
||||||
SDL_GPUCommandBuffer *commandBuffer,
|
SDL_GPUCommandBuffer *commandBuffer,
|
||||||
SDL_GPUTransferBufferLocation *source,
|
SDL_GPUTransferBufferLocation *source,
|
||||||
SDL_GPUBufferRegion *destination,
|
SDL_GPUBufferRegion *destination,
|
||||||
SDL_bool cycle);
|
bool cycle);
|
||||||
|
|
||||||
void (*CopyTextureToTexture)(
|
void (*CopyTextureToTexture)(
|
||||||
SDL_GPUCommandBuffer *commandBuffer,
|
SDL_GPUCommandBuffer *commandBuffer,
|
||||||
@@ -554,14 +554,14 @@ struct SDL_GPUDevice
|
|||||||
Uint32 w,
|
Uint32 w,
|
||||||
Uint32 h,
|
Uint32 h,
|
||||||
Uint32 d,
|
Uint32 d,
|
||||||
SDL_bool cycle);
|
bool cycle);
|
||||||
|
|
||||||
void (*CopyBufferToBuffer)(
|
void (*CopyBufferToBuffer)(
|
||||||
SDL_GPUCommandBuffer *commandBuffer,
|
SDL_GPUCommandBuffer *commandBuffer,
|
||||||
SDL_GPUBufferLocation *source,
|
SDL_GPUBufferLocation *source,
|
||||||
SDL_GPUBufferLocation *destination,
|
SDL_GPUBufferLocation *destination,
|
||||||
Uint32 size,
|
Uint32 size,
|
||||||
SDL_bool cycle);
|
bool cycle);
|
||||||
|
|
||||||
void (*GenerateMipmaps)(
|
void (*GenerateMipmaps)(
|
||||||
SDL_GPUCommandBuffer *commandBuffer,
|
SDL_GPUCommandBuffer *commandBuffer,
|
||||||
@@ -586,21 +586,21 @@ struct SDL_GPUDevice
|
|||||||
SDL_GPUBlitRegion *destination,
|
SDL_GPUBlitRegion *destination,
|
||||||
SDL_FlipMode flipMode,
|
SDL_FlipMode flipMode,
|
||||||
SDL_GPUFilter filterMode,
|
SDL_GPUFilter filterMode,
|
||||||
SDL_bool cycle);
|
bool cycle);
|
||||||
|
|
||||||
// Submission/Presentation
|
// Submission/Presentation
|
||||||
|
|
||||||
SDL_bool (*SupportsSwapchainComposition)(
|
bool (*SupportsSwapchainComposition)(
|
||||||
SDL_GPURenderer *driverData,
|
SDL_GPURenderer *driverData,
|
||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
SDL_GPUSwapchainComposition swapchainComposition);
|
SDL_GPUSwapchainComposition swapchainComposition);
|
||||||
|
|
||||||
SDL_bool (*SupportsPresentMode)(
|
bool (*SupportsPresentMode)(
|
||||||
SDL_GPURenderer *driverData,
|
SDL_GPURenderer *driverData,
|
||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
SDL_GPUPresentMode presentMode);
|
SDL_GPUPresentMode presentMode);
|
||||||
|
|
||||||
SDL_bool (*ClaimWindow)(
|
bool (*ClaimWindow)(
|
||||||
SDL_GPURenderer *driverData,
|
SDL_GPURenderer *driverData,
|
||||||
SDL_Window *window);
|
SDL_Window *window);
|
||||||
|
|
||||||
@@ -608,7 +608,7 @@ struct SDL_GPUDevice
|
|||||||
SDL_GPURenderer *driverData,
|
SDL_GPURenderer *driverData,
|
||||||
SDL_Window *window);
|
SDL_Window *window);
|
||||||
|
|
||||||
SDL_bool (*SetSwapchainParameters)(
|
bool (*SetSwapchainParameters)(
|
||||||
SDL_GPURenderer *driverData,
|
SDL_GPURenderer *driverData,
|
||||||
SDL_Window *window,
|
SDL_Window *window,
|
||||||
SDL_GPUSwapchainComposition swapchainComposition,
|
SDL_GPUSwapchainComposition swapchainComposition,
|
||||||
@@ -638,11 +638,11 @@ struct SDL_GPUDevice
|
|||||||
|
|
||||||
void (*WaitForFences)(
|
void (*WaitForFences)(
|
||||||
SDL_GPURenderer *driverData,
|
SDL_GPURenderer *driverData,
|
||||||
SDL_bool waitAll,
|
bool waitAll,
|
||||||
SDL_GPUFence **pFences,
|
SDL_GPUFence **pFences,
|
||||||
Uint32 fenceCount);
|
Uint32 fenceCount);
|
||||||
|
|
||||||
SDL_bool (*QueryFence)(
|
bool (*QueryFence)(
|
||||||
SDL_GPURenderer *driverData,
|
SDL_GPURenderer *driverData,
|
||||||
SDL_GPUFence *fence);
|
SDL_GPUFence *fence);
|
||||||
|
|
||||||
@@ -652,13 +652,13 @@ struct SDL_GPUDevice
|
|||||||
|
|
||||||
// Feature Queries
|
// Feature Queries
|
||||||
|
|
||||||
SDL_bool (*SupportsTextureFormat)(
|
bool (*SupportsTextureFormat)(
|
||||||
SDL_GPURenderer *driverData,
|
SDL_GPURenderer *driverData,
|
||||||
SDL_GPUTextureFormat format,
|
SDL_GPUTextureFormat format,
|
||||||
SDL_GPUTextureType type,
|
SDL_GPUTextureType type,
|
||||||
SDL_GPUTextureUsageFlags usage);
|
SDL_GPUTextureUsageFlags usage);
|
||||||
|
|
||||||
SDL_bool (*SupportsSampleCount)(
|
bool (*SupportsSampleCount)(
|
||||||
SDL_GPURenderer *driverData,
|
SDL_GPURenderer *driverData,
|
||||||
SDL_GPUTextureFormat format,
|
SDL_GPUTextureFormat format,
|
||||||
SDL_GPUSampleCount desiredSampleCount);
|
SDL_GPUSampleCount desiredSampleCount);
|
||||||
@@ -670,7 +670,7 @@ struct SDL_GPUDevice
|
|||||||
SDL_GPUDriver backend;
|
SDL_GPUDriver backend;
|
||||||
|
|
||||||
// Store this for SDL_gpu.c's debug layer
|
// Store this for SDL_gpu.c's debug layer
|
||||||
SDL_bool debugMode;
|
bool debugMode;
|
||||||
SDL_GPUShaderFormat shaderFormats;
|
SDL_GPUShaderFormat shaderFormats;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -758,8 +758,8 @@ typedef struct SDL_GPUBootstrap
|
|||||||
const char *Name;
|
const char *Name;
|
||||||
const SDL_GPUDriver backendflag;
|
const SDL_GPUDriver backendflag;
|
||||||
const SDL_GPUShaderFormat shaderFormats;
|
const SDL_GPUShaderFormat shaderFormats;
|
||||||
SDL_bool (*PrepareDriver)(SDL_VideoDevice *_this);
|
bool (*PrepareDriver)(SDL_VideoDevice *_this);
|
||||||
SDL_GPUDevice *(*CreateDevice)(SDL_bool debugMode, SDL_bool preferLowPower, SDL_PropertiesID props);
|
SDL_GPUDevice *(*CreateDevice)(bool debugMode, bool preferLowPower, SDL_PropertiesID props);
|
||||||
} SDL_GPUBootstrap;
|
} SDL_GPUBootstrap;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
+119
-119
File diff suppressed because it is too large
Load Diff
+188
-188
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+183
-183
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;
|
DWORD dwMilliseconds;
|
||||||
|
|
||||||
if (!sem) {
|
if (!sem) {
|
||||||
return SDL_TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timeoutNS < 0) {
|
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_HashTable *SDL_format_details;
|
||||||
static SDL_Mutex *SDL_format_details_lock;
|
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;
|
int bpp;
|
||||||
Uint32 Rmask, Gmask, Bmask, Amask;
|
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));
|
data = (SDL_WindowData *)SDL_calloc(1, sizeof(*data));
|
||||||
if (!data) {
|
if (!data) {
|
||||||
result = SDL_FALSE;
|
result = false;
|
||||||
goto endfunction;
|
goto endfunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +86,7 @@ bool Android_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_Proper
|
|||||||
if (data->egl_surface == EGL_NO_SURFACE) {
|
if (data->egl_surface == EGL_NO_SURFACE) {
|
||||||
ANativeWindow_release(data->native_window);
|
ANativeWindow_release(data->native_window);
|
||||||
SDL_free(data);
|
SDL_free(data);
|
||||||
result = SDL_FALSE;
|
result = false;
|
||||||
goto endfunction;
|
goto endfunction;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user