From ec2c805e48123dc4396266d38a1d5389781be2c0 Mon Sep 17 00:00:00 2001 From: Jack Knobel Date: Sat, 11 Jun 2022 20:52:27 +1000 Subject: [PATCH] Backends: support for unity builds for dx10/dx11/dx12 backends (#5387) --- backends/imgui_impl_dx10.cpp | 6 +++--- backends/imgui_impl_dx11.cpp | 6 +++--- backends/imgui_impl_dx12.cpp | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/backends/imgui_impl_dx10.cpp b/backends/imgui_impl_dx10.cpp index 8f29c67ae..81df59b39 100644 --- a/backends/imgui_impl_dx10.cpp +++ b/backends/imgui_impl_dx10.cpp @@ -62,7 +62,7 @@ struct ImGui_ImplDX10_Data ImGui_ImplDX10_Data() { memset((void*)this, 0, sizeof(*this)); VertexBufferSize = 5000; IndexBufferSize = 10000; } }; -struct VERTEX_CONSTANT_BUFFER +struct VERTEX_CONSTANT_BUFFER_DX10 { float mvp[4][4]; }; @@ -171,7 +171,7 @@ void ImGui_ImplDX10_RenderDrawData(ImDrawData* draw_data) void* mapped_resource; if (bd->pVertexConstantBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &mapped_resource) != S_OK) return; - VERTEX_CONSTANT_BUFFER* constant_buffer = (VERTEX_CONSTANT_BUFFER*)mapped_resource; + VERTEX_CONSTANT_BUFFER_DX10* constant_buffer = (VERTEX_CONSTANT_BUFFER_DX10*)mapped_resource; float L = draw_data->DisplayPos.x; float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x; float T = draw_data->DisplayPos.y; @@ -423,7 +423,7 @@ bool ImGui_ImplDX10_CreateDeviceObjects() // Create the constant buffer { D3D10_BUFFER_DESC desc; - desc.ByteWidth = sizeof(VERTEX_CONSTANT_BUFFER); + desc.ByteWidth = sizeof(VERTEX_CONSTANT_BUFFER_DX10); desc.Usage = D3D10_USAGE_DYNAMIC; desc.BindFlags = D3D10_BIND_CONSTANT_BUFFER; desc.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE; diff --git a/backends/imgui_impl_dx11.cpp b/backends/imgui_impl_dx11.cpp index feb4cf438..52da01f29 100644 --- a/backends/imgui_impl_dx11.cpp +++ b/backends/imgui_impl_dx11.cpp @@ -63,7 +63,7 @@ struct ImGui_ImplDX11_Data ImGui_ImplDX11_Data() { memset((void*)this, 0, sizeof(*this)); VertexBufferSize = 5000; IndexBufferSize = 10000; } }; -struct VERTEX_CONSTANT_BUFFER +struct VERTEX_CONSTANT_BUFFER_DX11 { float mvp[4][4]; }; @@ -177,7 +177,7 @@ void ImGui_ImplDX11_RenderDrawData(ImDrawData* draw_data) D3D11_MAPPED_SUBRESOURCE mapped_resource; if (ctx->Map(bd->pVertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_resource) != S_OK) return; - VERTEX_CONSTANT_BUFFER* constant_buffer = (VERTEX_CONSTANT_BUFFER*)mapped_resource.pData; + VERTEX_CONSTANT_BUFFER_DX11* constant_buffer = (VERTEX_CONSTANT_BUFFER_DX11*)mapped_resource.pData; float L = draw_data->DisplayPos.x; float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x; float T = draw_data->DisplayPos.y; @@ -435,7 +435,7 @@ bool ImGui_ImplDX11_CreateDeviceObjects() // Create the constant buffer { D3D11_BUFFER_DESC desc; - desc.ByteWidth = sizeof(VERTEX_CONSTANT_BUFFER); + desc.ByteWidth = sizeof(VERTEX_CONSTANT_BUFFER_DX11); desc.Usage = D3D11_USAGE_DYNAMIC; desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; diff --git a/backends/imgui_impl_dx12.cpp b/backends/imgui_impl_dx12.cpp index e6b141d4b..b2de8249d 100644 --- a/backends/imgui_impl_dx12.cpp +++ b/backends/imgui_impl_dx12.cpp @@ -74,7 +74,7 @@ struct ImGui_ImplDX12_Data ImGui_ImplDX12_Data() { memset((void*)this, 0, sizeof(*this)); frameIndex = UINT_MAX; } }; -struct VERTEX_CONSTANT_BUFFER +struct VERTEX_CONSTANT_BUFFER_DX12 { float mvp[4][4]; }; @@ -93,7 +93,7 @@ static void ImGui_ImplDX12_SetupRenderState(ImDrawData* draw_data, ID3D12Graphic // Setup orthographic projection matrix into our constant buffer // Our visible imgui space lies from draw_data->DisplayPos (top left) to draw_data->DisplayPos+data_data->DisplaySize (bottom right). - VERTEX_CONSTANT_BUFFER vertex_constant_buffer; + VERTEX_CONSTANT_BUFFER_DX12 vertex_constant_buffer; { float L = draw_data->DisplayPos.x; float R = draw_data->DisplayPos.x + draw_data->DisplaySize.x;