Skip to content

Commit a691dc9

Browse files
committed
HDR10Viewer2 1.0
1 parent e9cc7a6 commit a691dc9

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

HDR10Viewer2/MLDX12App.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ MLDX12App::OnInit(void) {
9191

9292
LoadAssets();
9393

94-
mDx12Imgui.Init(mDevice.Get());
94+
mDx12Imgui.Init(mDevice.Get(), mBackBufferFmt);
9595
CreateImguiTexture();
9696

9797
//OutputDebugString(L"OnInit end\n");
@@ -105,7 +105,7 @@ MLDX12App::ReInit(void)
105105
{
106106
LoadPipeline();
107107
LoadAssets();
108-
mDx12Imgui.Init(mDevice.Get());
108+
mDx12Imgui.Init(mDevice.Get(), mBackBufferFmt);
109109
CreateImguiTexture();
110110
}
111111

@@ -387,7 +387,7 @@ MLDX12App::LoadAssets(void) {
387387
}
388388

389389
mPipelineState.Reset();
390-
MLDX12Common::SetupPSO(mDevice.Get(), mRootSignature.Get(), L"shaderVS.hlsl", L"shaderColorConvPS.hlsl", mPipelineState);
390+
MLDX12Common::SetupPSO(mDevice.Get(), mBackBufferFmt, mRootSignature.Get(), L"shaderVS.hlsl", L"shaderColorConvPS.hlsl", mPipelineState);
391391
NAME_D3D12_OBJECT(mPipelineState);
392392

393393
mCmdList.Reset();

HDR10Viewer2/MLDX12Common.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ std::wstring GetAssetFullPath(const std::wstring & assetsPath, const wchar_t * a
66
}
77

88
void
9-
MLDX12Common::SetupPSO(ID3D12Device *device, ID3D12RootSignature * rootSignature, const wchar_t* vsShaderName, const wchar_t *psShaderName, ComPtr<ID3D12PipelineState> & pso) {
9+
MLDX12Common::SetupPSO(ID3D12Device *device, DXGI_FORMAT rtvFormat, ID3D12RootSignature * rootSignature, const wchar_t* vsShaderName, const wchar_t *psShaderName, ComPtr<ID3D12PipelineState> & pso) {
1010
WCHAR s[512];
1111
GetAssetsPath(s, _countof(s));
1212
std::wstring assetsPath = assetsPath;
@@ -73,7 +73,7 @@ MLDX12Common::SetupPSO(ID3D12Device *device, ID3D12RootSignature * rootSignature
7373
psoDesc.SampleMask = UINT_MAX;
7474
psoDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
7575
psoDesc.NumRenderTargets = 1;
76-
psoDesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
76+
psoDesc.RTVFormats[0] = rtvFormat;
7777
psoDesc.SampleDesc.Count = 1;
7878
ThrowIfFailed(device->CreateGraphicsPipelineState(&psoDesc, IID_PPV_ARGS(&pso)));
7979
}

HDR10Viewer2/MLDX12Common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ using Microsoft::WRL::ComPtr;
66

77
class MLDX12Common {
88
public:
9-
static void SetupPSO(ID3D12Device *device, ID3D12RootSignature * rootSign, const wchar_t *vsShaderName, const wchar_t* psShaderName, ComPtr<ID3D12PipelineState> & pso);
9+
static void SetupPSO(ID3D12Device *device, DXGI_FORMAT rtvFormat, ID3D12RootSignature * rootSign, const wchar_t *vsShaderName, const wchar_t* psShaderName, ComPtr<ID3D12PipelineState> & pso);
1010
};

HDR10Viewer2/MLDX12Imgui.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ struct VERTEX_CONSTANT_BUFFER
1616
float mvp[4][4];
1717
};
1818

19-
void MLDX12Imgui::Init(ID3D12Device *device)
19+
void MLDX12Imgui::Init(ID3D12Device *device, DXGI_FORMAT rtvFmt)
2020
{
2121
mDevice = device;
22+
mRtvFmt = rtvFmt;
2223

2324
IMGUI_CHECKVERSION();
2425
ImGui::CreateContext();
@@ -116,7 +117,7 @@ void MLDX12Imgui::SetupPso(void)
116117
psoDesc.pRootSignature = mRootSig.Get();
117118
psoDesc.SampleMask = UINT_MAX;
118119
psoDesc.NumRenderTargets = 1;
119-
psoDesc.RTVFormats[0] = DXGI_FORMAT_R8G8B8A8_UNORM;
120+
psoDesc.RTVFormats[0] = mRtvFmt;
120121
psoDesc.SampleDesc.Count = 1;
121122
psoDesc.Flags = D3D12_PIPELINE_STATE_FLAG_NONE;
122123

HDR10Viewer2/MLDX12Imgui.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ struct ImDrawData;
88

99
class MLDX12Imgui {
1010
public:
11-
void Init(ID3D12Device *device);
11+
void Init(ID3D12Device *device, DXGI_FORMAT rtvFmt);
1212
void Term(void);
1313

1414
void Render(ImDrawData* draw_data, ID3D12GraphicsCommandList* ctx, int frameIdx);
@@ -23,6 +23,7 @@ class MLDX12Imgui {
2323

2424
FrameResources mFrameResources[2];
2525
ID3D12Device * mDevice;
26+
DXGI_FORMAT mRtvFmt;
2627
ComPtr<ID3D12RootSignature> mRootSig;
2728
ComPtr<ID3D12PipelineState> mPso;
2829

0 commit comments

Comments
 (0)