@@ -213,8 +213,7 @@ static void ImGui_ImplDX12_SetupRenderState(ImDrawData* draw_data, ID3D12Graphic
213
213
}
214
214
215
215
// Setup viewport
216
- D3D12_VIEWPORT vp;
217
- memset (&vp, 0 , sizeof (D3D12_VIEWPORT));
216
+ D3D12_VIEWPORT vp = {};
218
217
vp.Width = draw_data->DisplaySize .x ;
219
218
vp.Height = draw_data->DisplaySize .y ;
220
219
vp.MinDepth = 0 .0f ;
@@ -225,14 +224,12 @@ static void ImGui_ImplDX12_SetupRenderState(ImDrawData* draw_data, ID3D12Graphic
225
224
// Bind shader and vertex buffers
226
225
unsigned int stride = sizeof (ImDrawVert);
227
226
unsigned int offset = 0 ;
228
- D3D12_VERTEX_BUFFER_VIEW vbv;
229
- memset (&vbv, 0 , sizeof (D3D12_VERTEX_BUFFER_VIEW));
227
+ D3D12_VERTEX_BUFFER_VIEW vbv = {};
230
228
vbv.BufferLocation = fr->VertexBuffer ->GetGPUVirtualAddress () + offset;
231
229
vbv.SizeInBytes = fr->VertexBufferSize * stride;
232
230
vbv.StrideInBytes = stride;
233
231
command_list->IASetVertexBuffers (0 , 1 , &vbv);
234
- D3D12_INDEX_BUFFER_VIEW ibv;
235
- memset (&ibv, 0 , sizeof (D3D12_INDEX_BUFFER_VIEW));
232
+ D3D12_INDEX_BUFFER_VIEW ibv = {};
236
233
ibv.BufferLocation = fr->IndexBuffer ->GetGPUVirtualAddress ();
237
234
ibv.SizeInBytes = fr->IndexBufferSize * sizeof (ImDrawIdx);
238
235
ibv.Format = sizeof (ImDrawIdx) == 2 ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT;
@@ -273,13 +270,11 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
273
270
{
274
271
SafeRelease (fr->VertexBuffer );
275
272
fr->VertexBufferSize = draw_data->TotalVtxCount + 5000 ;
276
- D3D12_HEAP_PROPERTIES props;
277
- memset (&props, 0 , sizeof (D3D12_HEAP_PROPERTIES));
273
+ D3D12_HEAP_PROPERTIES props = {};
278
274
props.Type = D3D12_HEAP_TYPE_UPLOAD;
279
275
props.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
280
276
props.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
281
- D3D12_RESOURCE_DESC desc;
282
- memset (&desc, 0 , sizeof (D3D12_RESOURCE_DESC));
277
+ D3D12_RESOURCE_DESC desc = {};
283
278
desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
284
279
desc.Width = fr->VertexBufferSize * sizeof (ImDrawVert);
285
280
desc.Height = 1 ;
@@ -296,13 +291,11 @@ void ImGui_ImplDX12_RenderDrawData(ImDrawData* draw_data, ID3D12GraphicsCommandL
296
291
{
297
292
SafeRelease (fr->IndexBuffer );
298
293
fr->IndexBufferSize = draw_data->TotalIdxCount + 10000 ;
299
- D3D12_HEAP_PROPERTIES props;
300
- memset (&props, 0 , sizeof (D3D12_HEAP_PROPERTIES));
294
+ D3D12_HEAP_PROPERTIES props = {};
301
295
props.Type = D3D12_HEAP_TYPE_UPLOAD;
302
296
props.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
303
297
props.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
304
- D3D12_RESOURCE_DESC desc;
305
- memset (&desc, 0 , sizeof (D3D12_RESOURCE_DESC));
298
+ D3D12_RESOURCE_DESC desc = {};
306
299
desc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
307
300
desc.Width = fr->IndexBufferSize * sizeof (ImDrawIdx);
308
301
desc.Height = 1 ;
@@ -410,8 +403,7 @@ static void ImGui_ImplDX12_CreateFontsTexture()
410
403
// Upload texture to graphics system
411
404
ImGui_ImplDX12_Texture* font_tex = &bd->FontTexture ;
412
405
{
413
- D3D12_HEAP_PROPERTIES props;
414
- memset (&props, 0 , sizeof (D3D12_HEAP_PROPERTIES));
406
+ D3D12_HEAP_PROPERTIES props = {};
415
407
props.Type = D3D12_HEAP_TYPE_DEFAULT;
416
408
props.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
417
409
props.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
@@ -638,8 +630,7 @@ bool ImGui_ImplDX12_CreateDeviceObjects()
638
630
// 2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL.
639
631
// See https://github.com/ocornut/imgui/pull/638 for sources and details.
640
632
641
- D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc;
642
- memset (&psoDesc, 0 , sizeof (D3D12_GRAPHICS_PIPELINE_STATE_DESC));
633
+ D3D12_GRAPHICS_PIPELINE_STATE_DESC psoDesc = {};
643
634
psoDesc.NodeMask = 1 ;
644
635
psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
645
636
psoDesc.pRootSignature = bd->pRootSignature ;
0 commit comments