From cbca29dd9074b153c692ab43d61e21d69136a0e5 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Wed, 1 Jun 2022 19:52:53 +0200 Subject: [PATCH] tests: Fix -Wstringop-overread warnings. Signed-off-by: Georg Lehmann --- tests/d3d12_clear.c | 4 ++-- tests/d3d12_render_target.c | 8 ++++---- tests/d3d12_shaders.c | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/d3d12_clear.c b/tests/d3d12_clear.c index d095cbcb..826511cc 100644 --- a/tests/d3d12_clear.c +++ b/tests/d3d12_clear.c @@ -325,7 +325,7 @@ void test_clear_render_target_view(void) ID3D12Device_CreateRenderTargetView(device, resource, &rtv_desc, rtv_handle); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, rtv_handle, &array_colors[i].x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, rtv_handle, (float *)&array_colors[i], 0, NULL); } transition_resource_state(command_list, resource, @@ -356,7 +356,7 @@ void test_clear_render_target_view(void) ID3D12Device_CreateRenderTargetView(device, resource, &rtv_desc, rtv_handle); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, rtv_handle, &array_colors[i].x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, rtv_handle, (float *)&array_colors[i], 0, NULL); } transition_resource_state(command_list, resource, diff --git a/tests/d3d12_render_target.c b/tests/d3d12_render_target.c index af2723bd..27382381 100644 --- a/tests/d3d12_render_target.c +++ b/tests/d3d12_render_target.c @@ -24,8 +24,8 @@ void test_unbound_rtv_rendering(void) { - static const struct vec4 white = { 1.0f, 1.0f, 1.0f, 1.0f }; static const struct vec4 red = { 1.0f, 0.0f, 0.0f, 1.0f }; + static const float white[] = { 1.0f, 1.0f, 1.0f, 1.0f }; D3D12_GRAPHICS_PIPELINE_STATE_DESC pso_desc; ID3D12GraphicsCommandList *command_list; D3D12_CPU_DESCRIPTOR_HANDLE rt_handle; @@ -91,8 +91,8 @@ void test_unbound_rtv_rendering(void) &IID_ID3D12PipelineState, (void **)&context.pipeline_state); ok(hr == S_OK, "Failed to create state, hr %#x.\n", hr); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, &white.x, 0, NULL); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, rt_handle, &white.x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, rt_handle, white, 0, NULL); ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); ID3D12GraphicsCommandList_SetPipelineState(command_list, context.pipeline_state); ID3D12GraphicsCommandList_IASetPrimitiveTopology(command_list, D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST); @@ -185,7 +185,7 @@ void test_unknown_rtv_format(void) create_render_target(&context, &desc, &render_targets[1], &rtvs[2]); for (i = 0; i < ARRAY_SIZE(rtvs); ++i) - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, rtvs[i], &white.x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, rtvs[i], (float *)&white, 0, NULL); /* NULL RTV */ memset(&rtv_desc, 0, sizeof(rtv_desc)); diff --git a/tests/d3d12_shaders.c b/tests/d3d12_shaders.c index 5a7ffbf2..180e3061 100644 --- a/tests/d3d12_shaders.c +++ b/tests/d3d12_shaders.c @@ -5134,7 +5134,7 @@ void test_gather(void) {0.3f, 1.3f, 1.2f, 0.2f}, {1.3f, 2.3f, 2.2f, 1.2f}, {2.3f, 3.3f, 3.2f, 2.2f}, {3.3f, 3.3f, 3.2f, 3.2f}, {0.3f, 1.3f, 1.3f, 0.3f}, {1.3f, 2.3f, 2.3f, 1.3f}, {2.3f, 3.3f, 3.3f, 2.3f}, {3.3f, 3.3f, 3.3f, 3.3f}, }; - static const struct vec4 white = {1.0f, 1.0f, 1.0f, 1.0f}; + static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; static const D3D12_SUBRESOURCE_DATA resource_data = {&texture_data, sizeof(texture_data) / 4}; memset(&desc, 0, sizeof(desc)); @@ -5171,7 +5171,7 @@ void test_gather(void) context.pipeline_state = create_pipeline_state(context.device, context.root_signature, desc.rt_format, NULL, &ps_gather4, NULL); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, &white.x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL); ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); @@ -5209,7 +5209,7 @@ void test_gather(void) context.pipeline_state = create_pipeline_state(context.device, context.root_signature, desc.rt_format, NULL, &ps_gather4_offset, NULL); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, &white.x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL); ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); @@ -5247,7 +5247,7 @@ void test_gather(void) context.pipeline_state = create_pipeline_state(context.device, context.root_signature, desc.rt_format, NULL, &ps_gather4_green, NULL); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, &white.x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL); ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); @@ -5285,7 +5285,7 @@ void test_gather(void) context.pipeline_state = create_pipeline_state(context.device, context.root_signature, desc.rt_format, NULL, &ps_gather4_po, NULL); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, &white.x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL); ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); @@ -5321,7 +5321,7 @@ void test_gather(void) constants.offset_x = 0; constants.offset_y = 0; - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, &white.x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL); ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); @@ -5455,7 +5455,7 @@ void test_gather_c(void) {0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 1.0f, 0.0f}, {1.0f, 1.0f, 1.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 1.0f, 0.0f}, {1.0f, 1.0f, 1.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}, }; - static const struct vec4 white = {1.0f, 1.0f, 1.0f, 1.0f}; + static const float white[] = {1.0f, 1.0f, 1.0f, 1.0f}; static const D3D12_SUBRESOURCE_DATA resource_data = {&texture_data, sizeof(texture_data) / 4}; static const D3D12_STATIC_SAMPLER_DESC sampler_desc = { @@ -5511,7 +5511,7 @@ void test_gather_c(void) context.pipeline_state = create_pipeline_state(context.device, context.root_signature, desc.rt_format, NULL, &ps_gather4_c, NULL); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, &white.x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL); ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); @@ -5549,7 +5549,7 @@ void test_gather_c(void) context.pipeline_state = create_pipeline_state(context.device, context.root_signature, desc.rt_format, NULL, &ps_gather4_po_c, NULL); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, &white.x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL); ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); @@ -5585,7 +5585,7 @@ void test_gather_c(void) constants.offset_x = 0; constants.offset_y = 0; - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, &white.x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, context.rtv, white, 0, NULL); ID3D12GraphicsCommandList_OMSetRenderTargets(command_list, 1, &context.rtv, false, NULL); ID3D12GraphicsCommandList_SetGraphicsRootSignature(command_list, context.root_signature); @@ -6387,7 +6387,7 @@ void test_multisample_array_texture(void) rtv_desc.Texture2DMSArray.ArraySize = 1; ID3D12Device_CreateRenderTargetView(device, texture, &rtv_desc, cpu_handle); - ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, cpu_handle, &colors[i].x, 0, NULL); + ID3D12GraphicsCommandList_ClearRenderTargetView(command_list, cpu_handle, (float *)&colors[i], 0, NULL); } transition_resource_state(command_list, texture,