mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 06:06:35 +00:00
Pass render target format in ImGui_ImplDX12_Init() instead of hard-coded.
This commit is contained in:
parent
f6b6dace9e
commit
3fd5790814
@ -32,6 +32,7 @@ static ID3D10Blob* g_pVertexShaderBlob = NULL;
|
||||
static ID3D10Blob* g_pPixelShaderBlob = NULL;
|
||||
static ID3D12RootSignature* g_pRootSignature = NULL;
|
||||
static ID3D12PipelineState* g_pPipelineState = NULL;
|
||||
static DXGI_FORMAT g_RTVFormat = DXGI_FORMAT_UNKNOWN;
|
||||
static ID3D12Resource* g_pFontTextureResource = NULL;
|
||||
static D3D12_CPU_DESCRIPTOR_HANDLE g_hFontSrvCpuDescHandle = {};
|
||||
static D3D12_GPU_DESCRIPTOR_HANDLE g_hFontSrvGpuDescHandle = {};
|
||||
@ -489,7 +490,7 @@ bool ImGui_ImplDX12_CreateDeviceObjects()
|
||||
psoDesc.pRootSignature = g_pRootSignature;
|
||||
psoDesc.SampleMask = UINT_MAX;
|
||||
psoDesc.NumRenderTargets = 1;
|
||||
psoDesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
psoDesc.RTVFormats[0] = g_RTVFormat;
|
||||
psoDesc.SampleDesc.Count = 1;
|
||||
psoDesc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
|
||||
|
||||
@ -630,11 +631,13 @@ void ImGui_ImplDX12_InvalidateDeviceObjects()
|
||||
|
||||
bool ImGui_ImplDX12_Init(void* hwnd, int num_frames_in_flight,
|
||||
ID3D12Device* device,
|
||||
DXGI_FORMAT rtv_format,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE font_srv_cpu_desc_handle,
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE font_srv_gpu_desc_handle)
|
||||
{
|
||||
g_hWnd = (HWND)hwnd;
|
||||
g_pd3dDevice = device;
|
||||
g_RTVFormat = rtv_format;
|
||||
g_hFontSrvCpuDescHandle = font_srv_cpu_desc_handle;
|
||||
g_hFontSrvGpuDescHandle = font_srv_gpu_desc_handle;
|
||||
g_pFrameResources = new FrameResources [num_frames_in_flight];
|
||||
|
@ -6,6 +6,7 @@
|
||||
// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.
|
||||
// https://github.com/ocornut/imgui
|
||||
|
||||
enum DXGI_FORMAT;
|
||||
struct ID3D12Device;
|
||||
struct ID3D12GraphicsCommandList;
|
||||
struct D3D12_CPU_DESCRIPTOR_HANDLE;
|
||||
@ -22,6 +23,7 @@ struct D3D12_GPU_DESCRIPTOR_HANDLE;
|
||||
// descriptor to use for the internal font texture.
|
||||
IMGUI_API bool ImGui_ImplDX12_Init(void* hwnd, int numFramesInFlight,
|
||||
ID3D12Device* device,
|
||||
DXGI_FORMAT rtv_format,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE fontSrvCpuDescHandle,
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE fontSrvGpuDescHandle);
|
||||
IMGUI_API void ImGui_ImplDX12_Shutdown();
|
||||
|
@ -301,6 +301,7 @@ int main(int, char**)
|
||||
|
||||
// Setup ImGui binding
|
||||
ImGui_ImplDX12_Init(hwnd, NUM_FRAMES_IN_FLIGHT, g_pd3dDevice,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
g_pd3dSrvDescHeap->GetCPUDescriptorHandleForHeapStart(),
|
||||
g_pd3dSrvDescHeap->GetGPUDescriptorHandleForHeapStart());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user