Fixed warning C4204: nonstandard extension used: non-constant aggregate initializer when built with Visual Studio 2019

main
Sam Lantinga 2024-02-07 13:16:35 -08:00
parent 1269590dfc
commit faeb2b1f22
6 changed files with 35 additions and 30 deletions

View File

@ -265,7 +265,9 @@ static void WASAPI_DetectDevices(SDL_AudioDevice **default_output, SDL_AudioDevi
{
int rc;
// this blocks because it needs to finish before the audio subsystem inits
mgmtthrtask_DetectDevicesData data = { default_output, default_capture };
mgmtthrtask_DetectDevicesData data;
data.default_output = default_output;
data.default_capture = default_capture;
WASAPI_ProxyToManagementThread(mgmtthrtask_DetectDevices, &data, &rc);
}

View File

@ -187,11 +187,10 @@ int hid_winapi_descriptor_reconstruct_pp_data(void *preparsed_data, unsigned cha
return -1;
}
struct rd_buffer rpt_desc = {
.buf = buf,
.buf_size = buf_size,
.byte_idx = 0
};
struct rd_buffer rpt_desc;
rpt_desc.buf = buf;
rpt_desc.buf_size = buf_size;
rpt_desc.byte_idx = 0;
// Set pointer to the first node of link_collection_nodes
phid_pp_link_collection_node link_collection_nodes = (phid_pp_link_collection_node)(((unsigned char*)&pp_data->caps[0]) + pp_data->FirstByteOfLinkCollectionArray);

View File

@ -2349,20 +2349,20 @@ static int D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
}
#if SDL_HAVE_YUV
if (textureData->yuv) {
ID3D11ShaderResourceView *shaderResources[] = {
textureData->mainTextureResourceView,
textureData->mainTextureResourceViewU,
textureData->mainTextureResourceViewV
};
ID3D11ShaderResourceView *shaderResources[3];
shaderResources[0] = textureData->mainTextureResourceView;
shaderResources[1] = textureData->mainTextureResourceViewU;
shaderResources[2] = textureData->mainTextureResourceViewV;
return D3D11_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params,
SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
} else if (textureData->nv12) {
ID3D11ShaderResourceView *shaderResources[] = {
textureData->mainTextureResourceView,
textureData->mainTextureResourceViewNV,
};
ID3D11ShaderResourceView *shaderResources[2];
shaderResources[0] = textureData->mainTextureResourceView;
shaderResources[1] = textureData->mainTextureResourceViewNV;
return D3D11_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params,
SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);

View File

@ -2701,11 +2701,11 @@ static int D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
}
#if SDL_HAVE_YUV
if (textureData->yuv) {
D3D12_CPU_DESCRIPTOR_HANDLE shaderResources[] = {
textureData->mainTextureResourceView,
textureData->mainTextureResourceViewU,
textureData->mainTextureResourceViewV
};
D3D12_CPU_DESCRIPTOR_HANDLE shaderResources[3];
shaderResources[0] = textureData->mainTextureResourceView;
shaderResources[1] = textureData->mainTextureResourceViewU;
shaderResources[2] = textureData->mainTextureResourceViewV;
/* Make sure each texture is in the correct state to be accessed by the pixel shader. */
D3D12_TransitionResource(rendererData, textureData->mainTexture, textureData->mainResourceState, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
@ -2717,10 +2717,10 @@ static int D3D12_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *c
return D3D12_SetDrawState(renderer, cmd, textureData->shader, textureData->shader_params, D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE, SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix);
} else if (textureData->nv12) {
D3D12_CPU_DESCRIPTOR_HANDLE shaderResources[] = {
textureData->mainTextureResourceView,
textureData->mainTextureResourceViewNV,
};
D3D12_CPU_DESCRIPTOR_HANDLE shaderResources[2];
shaderResources[0] = textureData->mainTextureResourceView;
shaderResources[1] = textureData->mainTextureResourceViewNV;
/* Make sure each texture is in the correct state to be accessed by the pixel shader. */
D3D12_TransitionResource(rendererData, textureData->mainTexture, textureData->mainResourceState, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);

View File

@ -966,11 +966,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (IS_HIGH_SURROGATE(wParam)) {
data->high_surrogate = (WCHAR)wParam;
} else {
WCHAR utf16[] = {
data->high_surrogate ? data->high_surrogate : (WCHAR)wParam,
data->high_surrogate ? (WCHAR)wParam : L'\0',
L'\0'
};
WCHAR utf16[3];
utf16[0] = data->high_surrogate ? data->high_surrogate : (WCHAR)wParam;
utf16[1] = data->high_surrogate ? (WCHAR)wParam : L'\0';
utf16[2] = L'\0';
char utf8[5];
int result = WIN_WideCharToMultiByte(CP_UTF8, WC_ERR_INVALID_CHARS, utf16, -1, utf8, sizeof(utf8), NULL, NULL);

View File

@ -719,7 +719,11 @@ int WIN_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesI
We can use (-1, -1, 0, 0) boundary to make sure no pixels are being blurred
*/
HRGN rgn = CreateRectRgn(-1, -1, 0, 0);
DWM_BLURBEHIND bb = {DWM_BB_ENABLE | DWM_BB_BLURREGION, TRUE, rgn, FALSE};
DWM_BLURBEHIND bb;
bb.flags = (DWM_BB_ENABLE | DWM_BB_BLURREGION);
bb.enable = TRUE;
bb.blur_region = rgn;
bb.transition_on_maxed = FALSE;
DwmEnableBlurBehindWindowFunc(hwnd, &bb);
DeleteObject(rgn);
}