mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-01 15:38:29 +00:00
Fixed build warnings
This commit is contained in:
@@ -2061,7 +2061,7 @@ static D3D11Texture *D3D11_INTERNAL_CreateTexture(
|
||||
desc2D.MipLevels = 1;
|
||||
desc2D.MiscFlags = 0;
|
||||
desc2D.SampleDesc.Count = SDLToD3D11_SampleCount[createInfo->sampleCount];
|
||||
desc2D.SampleDesc.Quality = D3D11_STANDARD_MULTISAMPLE_PATTERN;
|
||||
desc2D.SampleDesc.Quality = (UINT)D3D11_STANDARD_MULTISAMPLE_PATTERN;
|
||||
desc2D.Usage = D3D11_USAGE_DEFAULT;
|
||||
|
||||
res = ID3D11Device_CreateTexture2D(
|
||||
@@ -5232,7 +5232,7 @@ static SDL_GPUTexture *D3D11_AcquireSwapchainTexture(
|
||||
IDXGISwapChain_GetDesc(windowData->swapchain, &swapchainDesc);
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
|
||||
if (w != swapchainDesc.BufferDesc.Width || h != swapchainDesc.BufferDesc.Height) {
|
||||
if ((UINT)w != swapchainDesc.BufferDesc.Width || (UINT)h != swapchainDesc.BufferDesc.Height) {
|
||||
res = D3D11_INTERNAL_ResizeSwapchain(
|
||||
renderer,
|
||||
windowData,
|
||||
|
@@ -786,11 +786,11 @@ typedef struct D3D12ComputeRootSignature
|
||||
{
|
||||
ID3D12RootSignature *handle;
|
||||
|
||||
Uint32 readOnlyStorageTextureRootIndex;
|
||||
Uint32 readOnlyStorageBufferRootIndex;
|
||||
Uint32 writeOnlyStorageTextureRootIndex;
|
||||
Uint32 writeOnlyStorageBufferRootIndex;
|
||||
Uint32 uniformBufferRootIndex[MAX_UNIFORM_BUFFERS_PER_STAGE];
|
||||
Sint32 readOnlyStorageTextureRootIndex;
|
||||
Sint32 readOnlyStorageBufferRootIndex;
|
||||
Sint32 writeOnlyStorageTextureRootIndex;
|
||||
Sint32 writeOnlyStorageBufferRootIndex;
|
||||
Sint32 uniformBufferRootIndex[MAX_UNIFORM_BUFFERS_PER_STAGE];
|
||||
} D3D12ComputeRootSignature;
|
||||
|
||||
struct D3D12ComputePipeline
|
||||
@@ -2745,8 +2745,8 @@ static D3D12Texture *D3D12_INTERNAL_CreateTexture(
|
||||
desc.Alignment = isSwapchainTexture ? 0 : D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
|
||||
desc.Width = textureCreateInfo->width;
|
||||
desc.Height = textureCreateInfo->height;
|
||||
desc.DepthOrArraySize = textureCreateInfo->layerCountOrDepth;
|
||||
desc.MipLevels = textureCreateInfo->levelCount;
|
||||
desc.DepthOrArraySize = (UINT16)textureCreateInfo->layerCountOrDepth;
|
||||
desc.MipLevels = (UINT16)textureCreateInfo->levelCount;
|
||||
desc.Format = SDLToD3D12_TextureFormat[textureCreateInfo->format];
|
||||
desc.SampleDesc.Count = 1;
|
||||
desc.SampleDesc.Quality = 0;
|
||||
@@ -2757,8 +2757,8 @@ static D3D12Texture *D3D12_INTERNAL_CreateTexture(
|
||||
desc.Alignment = D3D12_DEFAULT_RESOURCE_PLACEMENT_ALIGNMENT;
|
||||
desc.Width = textureCreateInfo->width;
|
||||
desc.Height = textureCreateInfo->height;
|
||||
desc.DepthOrArraySize = textureCreateInfo->layerCountOrDepth;
|
||||
desc.MipLevels = textureCreateInfo->levelCount;
|
||||
desc.DepthOrArraySize = (UINT16)textureCreateInfo->layerCountOrDepth;
|
||||
desc.MipLevels = (UINT16)textureCreateInfo->levelCount;
|
||||
desc.Format = SDLToD3D12_TextureFormat[textureCreateInfo->format];
|
||||
desc.SampleDesc.Count = 1;
|
||||
desc.SampleDesc.Quality = 0;
|
||||
@@ -6105,7 +6105,7 @@ static bool D3D12_INTERNAL_ResizeSwapchainIfNeeded(
|
||||
IDXGISwapChain_GetDesc(windowData->swapchain, &swapchainDesc);
|
||||
SDL_GetWindowSize(windowData->window, &w, &h);
|
||||
|
||||
if (w != swapchainDesc.BufferDesc.Width || h != swapchainDesc.BufferDesc.Height) {
|
||||
if ((UINT)w != swapchainDesc.BufferDesc.Width || (UINT)h != swapchainDesc.BufferDesc.Height) {
|
||||
// Wait so we don't release in-flight views
|
||||
D3D12_Wait((SDL_GPURenderer *)renderer);
|
||||
|
||||
|
@@ -1514,7 +1514,7 @@ static void VULKAN_INTERNAL_NewMemoryFreeRegion(
|
||||
}
|
||||
|
||||
// perform insertion sort
|
||||
if (allocation->allocator->sortedFreeRegionCount > 0 && insertionIndex != allocation->allocator->sortedFreeRegionCount) {
|
||||
if (allocation->allocator->sortedFreeRegionCount > 0 && (Uint32)insertionIndex != allocation->allocator->sortedFreeRegionCount) {
|
||||
for (Sint32 i = allocation->allocator->sortedFreeRegionCount; i > insertionIndex && i > 0; i -= 1) {
|
||||
allocation->allocator->sortedFreeRegions[i] = allocation->allocator->sortedFreeRegions[i - 1];
|
||||
allocation->allocator->sortedFreeRegions[i]->sortedIndex = i;
|
||||
@@ -1955,7 +1955,7 @@ static Uint8 VULKAN_INTERNAL_BindResourceMemory(
|
||||
VulkanMemoryUsedRegion *usedRegion;
|
||||
|
||||
VkDeviceSize requiredSize, allocationSize;
|
||||
VkDeviceSize alignedOffset;
|
||||
VkDeviceSize alignedOffset = 0;
|
||||
VkDeviceSize newRegionSize, newRegionOffset;
|
||||
Uint8 isHostVisible, smallAllocation, allocationResult;
|
||||
Sint32 i;
|
||||
@@ -11272,7 +11272,8 @@ static Uint8 VULKAN_INTERNAL_DeterminePhysicalDevice(VulkanRenderer *renderer)
|
||||
VkResult vulkanResult;
|
||||
VkPhysicalDevice *physicalDevices;
|
||||
VulkanExtensions *physicalDeviceExtensions;
|
||||
Uint32 physicalDeviceCount, i, suitableIndex;
|
||||
Uint32 i, physicalDeviceCount;
|
||||
Sint32 suitableIndex;
|
||||
Uint32 queueFamilyIndex, suitableQueueFamilyIndex;
|
||||
Uint8 deviceRank, highestRank;
|
||||
|
||||
|
@@ -84,8 +84,10 @@ bool GPU_InitPipelineCache(GPU_PipelineCache *cache, SDL_GPUDevice *device)
|
||||
{
|
||||
// FIXME how many buckets do we need?
|
||||
cache->table = SDL_CreateHashTable(device, 32, HashPassthrough, MatchPipelineCacheKey, NukePipelineCacheEntry, true);
|
||||
|
||||
return (bool)cache->table;
|
||||
if (!cache->table) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void GPU_DestroyPipelineCache(GPU_PipelineCache *cache)
|
||||
|
@@ -248,12 +248,16 @@ static bool GPU_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
GPU_TextureData *data = (GPU_TextureData *)texture->internal;
|
||||
const Uint32 texturebpp = SDL_BYTESPERPIXEL(texture->format);
|
||||
|
||||
Uint32 row_size = texturebpp * rect->w;
|
||||
Uint32 data_size = row_size * rect->h;
|
||||
size_t row_size, data_size;
|
||||
|
||||
if (!SDL_size_mul_check_overflow(rect->w, texturebpp, &row_size) ||
|
||||
!SDL_size_mul_check_overflow(rect->h, row_size, &data_size)) {
|
||||
return SDL_SetError("update size overflow");
|
||||
}
|
||||
|
||||
SDL_GPUTransferBufferCreateInfo tbci;
|
||||
SDL_zero(tbci);
|
||||
tbci.sizeInBytes = data_size;
|
||||
tbci.sizeInBytes = (Uint32)data_size;
|
||||
tbci.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
|
||||
|
||||
SDL_GPUTransferBuffer *tbuf = SDL_CreateGPUTransferBuffer(renderdata->device, &tbci);
|
||||
@@ -264,7 +268,7 @@ static bool GPU_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||
|
||||
Uint8 *output = SDL_MapGPUTransferBuffer(renderdata->device, tbuf, false);
|
||||
|
||||
if (pitch == row_size) {
|
||||
if ((size_t)pitch == row_size) {
|
||||
memcpy(output, pixels, data_size);
|
||||
} else {
|
||||
// FIXME is negative pitch supposed to work?
|
||||
|
Reference in New Issue
Block a user