mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-06 03:18:13 +00:00
Fixed warnings building with Visual Studio
This commit is contained in:
@@ -613,7 +613,7 @@ static bool InitVertexBuffer(GPU_RenderData *data, Uint32 size)
|
|||||||
data->vertices.buffer = SDL_CreateGPUBuffer(data->device, &bci);
|
data->vertices.buffer = SDL_CreateGPUBuffer(data->device, &bci);
|
||||||
|
|
||||||
if (!data->vertices.buffer) {
|
if (!data->vertices.buffer) {
|
||||||
return -1;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GPUTransferBufferCreateInfo tbci;
|
SDL_GPUTransferBufferCreateInfo tbci;
|
||||||
@@ -622,7 +622,12 @@ static bool InitVertexBuffer(GPU_RenderData *data, Uint32 size)
|
|||||||
tbci.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
|
tbci.usage = SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD;
|
||||||
|
|
||||||
data->vertices.transfer_buf = SDL_CreateGPUTransferBuffer(data->device, &tbci);
|
data->vertices.transfer_buf = SDL_CreateGPUTransferBuffer(data->device, &tbci);
|
||||||
return (bool)data->vertices.transfer_buf;
|
|
||||||
|
if (!data->vertices.transfer_buf) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool UploadVertices(GPU_RenderData *data, void *vertices, size_t vertsize)
|
static bool UploadVertices(GPU_RenderData *data, void *vertices, size_t vertsize)
|
||||||
@@ -852,8 +857,13 @@ static SDL_Surface *GPU_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect
|
|||||||
}
|
}
|
||||||
|
|
||||||
Uint32 bpp = SDL_BYTESPERPIXEL(pixfmt);
|
Uint32 bpp = SDL_BYTESPERPIXEL(pixfmt);
|
||||||
Uint32 row_size = rect->w * bpp;
|
size_t row_size, image_size;
|
||||||
Uint32 image_size = row_size * rect->h;
|
|
||||||
|
if (!SDL_size_mul_check_overflow(rect->w, bpp, &row_size) ||
|
||||||
|
!SDL_size_mul_check_overflow(rect->h, row_size, &image_size)) {
|
||||||
|
SDL_SetError("read size overflow");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
SDL_Surface *surface = SDL_CreateSurface(rect->w, rect->h, pixfmt);
|
SDL_Surface *surface = SDL_CreateSurface(rect->w, rect->h, pixfmt);
|
||||||
|
|
||||||
@@ -863,7 +873,7 @@ static SDL_Surface *GPU_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect
|
|||||||
|
|
||||||
SDL_GPUTransferBufferCreateInfo tbci;
|
SDL_GPUTransferBufferCreateInfo tbci;
|
||||||
SDL_zero(tbci);
|
SDL_zero(tbci);
|
||||||
tbci.sizeInBytes = image_size;
|
tbci.sizeInBytes = (Uint32)image_size;
|
||||||
tbci.usage = SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD;
|
tbci.usage = SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD;
|
||||||
|
|
||||||
SDL_GPUTransferBuffer *tbuf = SDL_CreateGPUTransferBuffer(data->device, &tbci);
|
SDL_GPUTransferBuffer *tbuf = SDL_CreateGPUTransferBuffer(data->device, &tbci);
|
||||||
@@ -899,7 +909,7 @@ static SDL_Surface *GPU_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect
|
|||||||
|
|
||||||
void *mapped_tbuf = SDL_MapGPUTransferBuffer(data->device, tbuf, false);
|
void *mapped_tbuf = SDL_MapGPUTransferBuffer(data->device, tbuf, false);
|
||||||
|
|
||||||
if (surface->pitch == row_size) {
|
if ((size_t)surface->pitch == row_size) {
|
||||||
memcpy(surface->pixels, mapped_tbuf, image_size);
|
memcpy(surface->pixels, mapped_tbuf, image_size);
|
||||||
} else {
|
} else {
|
||||||
Uint8 *input = mapped_tbuf;
|
Uint8 *input = mapped_tbuf;
|
||||||
@@ -935,7 +945,11 @@ static bool CreateBackbuffer(GPU_RenderData *data, Uint32 w, Uint32 h, SDL_GPUTe
|
|||||||
data->backbuffer.height = h;
|
data->backbuffer.height = h;
|
||||||
data->backbuffer.format = fmt;
|
data->backbuffer.format = fmt;
|
||||||
|
|
||||||
return (bool)data->backbuffer.texture;
|
if (!data->backbuffer.texture) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GPU_RenderPresent(SDL_Renderer *renderer)
|
static bool GPU_RenderPresent(SDL_Renderer *renderer)
|
||||||
|
@@ -83,7 +83,7 @@ typedef struct GPU_ShaderSources
|
|||||||
IF_VULKAN(.spirv = { code, sizeof(code), SDL_GPU_SHADERFORMAT_SPIRV }, )
|
IF_VULKAN(.spirv = { code, sizeof(code), SDL_GPU_SHADERFORMAT_SPIRV }, )
|
||||||
|
|
||||||
#define SHADER_DXBC50(code) \
|
#define SHADER_DXBC50(code) \
|
||||||
IF_D3D11(.dxbc50 = { code, sizeof(code), SDL_GPU_SHADERFORMAT_DXBC }, )
|
IF_D3D11(.dxbc50 = { (const unsigned char *)code, sizeof(code), SDL_GPU_SHADERFORMAT_DXBC }, )
|
||||||
|
|
||||||
#define SHADER_DXIL60(code) \
|
#define SHADER_DXIL60(code) \
|
||||||
IF_D3D12(.dxil60 = { code, sizeof(code), SDL_GPU_SHADERFORMAT_DXIL }, )
|
IF_D3D12(.dxil60 = { code, sizeof(code), SDL_GPU_SHADERFORMAT_DXIL }, )
|
||||||
|
4
src/render/sdlgpu/shaders/color.frag.sm50.dxbc.h
generated
4
src/render/sdlgpu/shaders/color.frag.sm50.dxbc.h
generated
@@ -1,4 +1,4 @@
|
|||||||
const unsigned char color_frag_sm50_dxbc[] =
|
const signed char color_frag_sm50_dxbc[] =
|
||||||
{
|
{
|
||||||
68, 88, 66, 67, 114,-117,
|
68, 88, 66, 67, 114,-117,
|
||||||
-124, 82, -97, 76, -66, -74,
|
-124, 82, -97, 76, -66, -74,
|
||||||
@@ -82,4 +82,4 @@ const unsigned char color_frag_sm50_dxbc[] =
|
|||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 0
|
0, 0
|
||||||
};
|
};
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
const unsigned char linepoint_vert_sm50_dxbc[] =
|
const signed char linepoint_vert_sm50_dxbc[] =
|
||||||
{
|
{
|
||||||
68, 88, 66, 67, 0, 119,
|
68, 88, 66, 67, 0, 119,
|
||||||
101, -18, 103, 113, 34, 52,
|
101, -18, 103, 113, 34, 52,
|
||||||
@@ -169,4 +169,4 @@ const unsigned char linepoint_vert_sm50_dxbc[] =
|
|||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0
|
0, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
const unsigned char texture_rgb_frag_sm50_dxbc[] =
|
const signed char texture_rgb_frag_sm50_dxbc[] =
|
||||||
{
|
{
|
||||||
68, 88, 66, 67, -22, -54,
|
68, 88, 66, 67, -22, -54,
|
||||||
-48, 73, -47, -40, -92, -21,
|
-48, 73, -47, -40, -92, -21,
|
||||||
@@ -120,4 +120,4 @@ const unsigned char texture_rgb_frag_sm50_dxbc[] =
|
|||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 0
|
0, 0
|
||||||
};
|
};
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
const unsigned char texture_rgba_frag_sm50_dxbc[] =
|
const signed char texture_rgba_frag_sm50_dxbc[] =
|
||||||
{
|
{
|
||||||
68, 88, 66, 67, -83, 124,
|
68, 88, 66, 67, -83, 124,
|
||||||
-3, -84,-102, 126, 29, -62,
|
-3, -84,-102, 126, 29, -62,
|
||||||
@@ -117,4 +117,4 @@ const unsigned char texture_rgba_frag_sm50_dxbc[] =
|
|||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 0, 0
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
const unsigned char tri_color_vert_sm50_dxbc[] =
|
const signed char tri_color_vert_sm50_dxbc[] =
|
||||||
{
|
{
|
||||||
68, 88, 66, 67, -99, -1,
|
68, 88, 66, 67, -99, -1,
|
||||||
-83, -50, 75, -96, -1, 28,
|
-83, -50, 75, -96, -1, 28,
|
||||||
@@ -175,4 +175,4 @@ const unsigned char tri_color_vert_sm50_dxbc[] =
|
|||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0
|
0, 0, 0, 0, 0, 0
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
const unsigned char tri_texture_vert_sm50_dxbc[] =
|
const signed char tri_texture_vert_sm50_dxbc[] =
|
||||||
{
|
{
|
||||||
68, 88, 66, 67, 108, 113,
|
68, 88, 66, 67, 108, 113,
|
||||||
-108, 81, -2, 27, 41, 94,
|
-108, 81, -2, 27, 41, 94,
|
||||||
@@ -192,4 +192,4 @@ const unsigned char tri_texture_vert_sm50_dxbc[] =
|
|||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 0, 0, 0, 0, 0,
|
0, 0, 0, 0, 0, 0,
|
||||||
0, 0
|
0, 0
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user