Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/cauldron
Submodule cauldron updated 174 files
6 changes: 3 additions & 3 deletions src/DX12/GLTFSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void GLTFSample::LoadScene(int sceneIndex)
if (m_pGltfLoader->m_lights.size() == 0)
{
tfNode n;
n.m_tranform.LookAt(PolarToVector(AMD_PI_OVER_2, 0.58f) * 3.5f, math::Vector4(0, 0, 0, 0));
n.m_transform.LookAt(PolarToVector(AMD_PI_OVER_2, 0.58f) * 3.5f, math::Vector4(0, 0, 0, 0));

tfLight l;
l.m_type = tfLight::LIGHT_SPOTLIGHT;
Expand Down Expand Up @@ -414,7 +414,7 @@ void GLTFSample::OnRender()
// Do any start of frame necessities
BeginFrame();

ImGUI_UpdateIO();
ImGUI_UpdateIO(m_Width,m_Height);
ImGui::NewFrame();

if (m_loadingScene)
Expand Down Expand Up @@ -458,7 +458,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
LPCSTR Name = "SampleDX12 v1.4.1";
LPCSTR Name = "SampleDX12 v1.4.5";

// create new DX sample
return RunFramework(hInstance, lpCmdLine, nCmdShow, new GLTFSample(Name));
Expand Down
24 changes: 21 additions & 3 deletions src/DX12/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,20 @@ void Renderer::OnCreate(Device* pDevice, SwapChain *pSwapChain, float FontSize)
m_ResourceViewHeaps.AllocCBV_SRV_UAVDescriptor(1, &m_ShadowMaskSRV);
#endif

m_SkyDome.OnCreate(pDevice, &m_UploadHeap, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, "..\\media\\cauldron-media\\envmaps\\papermill\\diffuse.dds", "..\\media\\cauldron-media\\envmaps\\papermill\\specular.dds", DXGI_FORMAT_R16G16B16A16_FLOAT, 4);
m_SkyDomeProc.OnCreate(pDevice, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, DXGI_FORMAT_R16G16B16A16_FLOAT, 1);
constexpr bool bInvertedDepth = false;
m_SkyDome.OnCreate(
pDevice,
&m_UploadHeap,
&m_ResourceViewHeaps,
&m_ConstantBufferRing,
&m_VidMemBufferPool,
"..\\media\\cauldron-media\\envmaps\\papermill\\diffuse.dds",
"..\\media\\cauldron-media\\envmaps\\papermill\\specular.dds",
DXGI_FORMAT_R16G16B16A16_FLOAT,
4,
bInvertedDepth
);
m_SkyDomeProc.OnCreate(pDevice, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, DXGI_FORMAT_R16G16B16A16_FLOAT, 1, bInvertedDepth);
m_Wireframe.OnCreate(pDevice, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, DXGI_FORMAT_R16G16B16A16_FLOAT, 1);
m_WireframeBox.OnCreate(pDevice, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool);
m_DownSample.OnCreate(pDevice, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, DXGI_FORMAT_R16G16B16A16_FLOAT);
Expand Down Expand Up @@ -403,7 +415,13 @@ void Renderer::AllocateShadowMaps(GLTFCommon* pGLTFCommon)
std::vector<SceneShadowInfo>::iterator CurrentShadow = m_shadowMapPool.begin();
for( uint32_t i = 0; CurrentShadow < m_shadowMapPool.end(); ++i, ++CurrentShadow)
{
CurrentShadow->ShadowMap.InitDepthStencil(m_pDevice, "m_pShadowMap", &CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_D32_FLOAT, CurrentShadow->ShadowResolution, CurrentShadow->ShadowResolution, 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL));
constexpr float fClearValue = 1.0f;
CurrentShadow->ShadowMap.InitDepthStencil(
m_pDevice,
"m_pShadowMap",
&CD3DX12_RESOURCE_DESC::Tex2D(DXGI_FORMAT_D32_FLOAT, CurrentShadow->ShadowResolution, CurrentShadow->ShadowResolution, 1, 1, 1, 0, D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL),
fClearValue
);
CurrentShadow->ShadowMap.CreateDSV(CurrentShadow->ShadowIndex, &m_ShadowMapPoolDSV);
CurrentShadow->ShadowMap.CreateSRV(CurrentShadow->ShadowIndex, &m_ShadowMapPoolSRV);
}
Expand Down
4 changes: 2 additions & 2 deletions src/DX12/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ void GLTFSample::BuildUI()
if (ImGui::Button("Set Spot Light 0 to Camera's View"))
{
int idx = m_pGltfLoader->m_lightInstances[0].m_nodeIndex;
m_pGltfLoader->m_nodes[idx].m_tranform.LookAt(m_camera.GetPosition(), m_camera.GetPosition() - m_camera.GetDirection());
m_pGltfLoader->m_animatedMats[idx] = m_pGltfLoader->m_nodes[idx].m_tranform.GetWorldMat();
m_pGltfLoader->m_nodes[idx].m_transform.LookAt(m_camera.GetPosition(), m_camera.GetPosition() - m_camera.GetDirection());
m_pGltfLoader->m_animatedMats[idx] = m_pGltfLoader->m_nodes[idx].m_transform.GetWorldMat();
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/VK/GLTFSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ void GLTFSample::LoadScene(int sceneIndex)
if (m_pGltfLoader->m_lights.size() == 0)
{
tfNode n;
n.m_tranform.LookAt(PolarToVector(AMD_PI_OVER_2, 0.58f) * 3.5f, math::Vector4(0, 0, 0, 0));
n.m_transform.LookAt(PolarToVector(AMD_PI_OVER_2, 0.58f) * 3.5f, math::Vector4(0, 0, 0, 0));

tfLight l;
l.m_type = tfLight::LIGHT_SPOTLIGHT;
Expand Down Expand Up @@ -420,12 +420,12 @@ void GLTFSample::OnRender()
// Do any start of frame necessities
BeginFrame();

ImGUI_UpdateIO();
ImGUI_UpdateIO(m_Width, m_Height);
ImGui::NewFrame();

if (m_loadingScene)
{
// the scene loads in chuncks, that way we can show a progress bar
// the scene loads in chunks, that way we can show a progress bar
static int loadingStage = 0;
loadingStage = m_pRenderer->LoadScene(m_pGltfLoader, loadingStage);
if (loadingStage == 0)
Expand Down Expand Up @@ -465,7 +465,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
LPCSTR Name = "SampleVK v1.4.1";
LPCSTR Name = "SampleVK v1.4.5";

// create new Vulkan sample
return RunFramework(hInstance, lpCmdLine, nCmdShow, new GLTFSample(Name));
Expand Down
29 changes: 21 additions & 8 deletions src/VK/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,23 @@ void Renderer::OnCreate(Device *pDevice, SwapChain *pSwapChain, float FontSize)
{
VkAttachmentDescription depthAttachments;
AttachClearBeforeUse(VK_FORMAT_D32_SFLOAT, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, &depthAttachments);
m_Render_pass_shadow = CreateRenderPassOptimal(m_pDevice->GetDevice(), 0, NULL, &depthAttachments);
}

m_SkyDome.OnCreate(pDevice, m_RenderPassJustDepthAndHdr.GetRenderPass(), &m_UploadHeap, VK_FORMAT_R16G16B16A16_SFLOAT, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, "..\\media\\cauldron-media\\envmaps\\papermill\\diffuse.dds", "..\\media\\cauldron-media\\envmaps\\papermill\\specular.dds", VK_SAMPLE_COUNT_1_BIT);
m_Render_pass_shadow = CreateRenderPassOptimal(m_pDevice->GetDevice(), 0, NULL, &depthAttachments, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL);
}

constexpr bool bInvertedDepth = false;
m_SkyDome.OnCreate(
pDevice,
m_RenderPassJustDepthAndHdr.GetRenderPass(),
&m_UploadHeap,
VK_FORMAT_R16G16B16A16_SFLOAT,
&m_ResourceViewHeaps,
&m_ConstantBufferRing,
&m_VidMemBufferPool,
"..\\media\\cauldron-media\\envmaps\\papermill\\diffuse.dds",
"..\\media\\cauldron-media\\envmaps\\papermill\\specular.dds",
VK_SAMPLE_COUNT_1_BIT,
bInvertedDepth
);
m_SkyDomeProc.OnCreate(pDevice, m_RenderPassJustDepthAndHdr.GetRenderPass(), &m_UploadHeap, VK_FORMAT_R16G16B16A16_SFLOAT, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, VK_SAMPLE_COUNT_1_BIT);
m_Wireframe.OnCreate(pDevice, m_RenderPassJustDepthAndHdr.GetRenderPass(), &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool, VK_SAMPLE_COUNT_1_BIT);
m_WireframeBox.OnCreate(pDevice, &m_ResourceViewHeaps, &m_ConstantBufferRing, &m_VidMemBufferPool);
Expand Down Expand Up @@ -190,7 +203,7 @@ void Renderer::OnCreateWindowSizeDependentResources(SwapChain *pSwapChain, uint3
m_DownSample.OnCreateWindowSizeDependentResources(Width, Height, &m_GBuffer.m_HDR, 6); //downsample the HDR texture 6 times
m_Bloom.OnCreateWindowSizeDependentResources(Width / 2, Height / 2, m_DownSample.GetTexture(), 6, &m_GBuffer.m_HDR);
m_TAA.OnCreateWindowSizeDependentResources(Width, Height, &m_GBuffer);
m_MagnifierPS.OnCreateWindowSizeDependentResources(&m_GBuffer.m_HDR);
m_MagnifierPS.OnCreateWindowSizeDependentResources(Width, Height);
m_bMagResourceReInit = true;
}

Expand Down Expand Up @@ -541,8 +554,8 @@ void Renderer::OnRender(const UIState* pState, const Camera& Cam, SwapChain* pSw
SetViewportAndScissor(cmdBuf1, 0, 0, ShadowMap->ShadowResolution, ShadowMap->ShadowResolution);

// Set per frame constant buffer values
GltfDepthPass::per_frame* cbPerFrame = m_GLTFDepth->SetPerFrameConstants();
cbPerFrame->mViewProj = pPerFrame->lights[ShadowMap->LightIndex].mLightViewProj;
per_frame* cbPerFrame = m_GLTFDepth->SetPerFrameConstants();
cbPerFrame->mCameraCurrViewProj = pPerFrame->lights[ShadowMap->LightIndex].mLightViewProj;

m_GLTFDepth->Draw(cmdBuf1);

Expand Down Expand Up @@ -773,7 +786,7 @@ void Renderer::OnRender(const UIState* pState, const Camera& Cam, SwapChain* pSw
}

// Note: assumes the input texture (specified in OnCreateWindowSizeDependentResources()) is in read state
m_MagnifierPS.Draw(cmdBuf1, pState->MagnifierParams);
m_MagnifierPS.Draw(cmdBuf1, pState->MagnifierParams, m_GBuffer.m_HDRSRV);
m_GPUTimer.GetTimeStamp(cmdBuf1, "Magnifier");
}

Expand Down
6 changes: 3 additions & 3 deletions src/VK/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ void GLTFSample::BuildUI()
if (ImGui::Button("Set Spot Light 0 to Camera's View"))
{
int idx = m_pGltfLoader->m_lightInstances[0].m_nodeIndex;
m_pGltfLoader->m_nodes[idx].m_tranform.LookAt(m_camera.GetPosition(), m_camera.GetPosition() - m_camera.GetDirection());
m_pGltfLoader->m_animatedMats[idx] = m_pGltfLoader->m_nodes[idx].m_tranform.GetWorldMat();
m_pGltfLoader->m_nodes[idx].m_transform.LookAt(m_camera.GetPosition(), m_camera.GetPosition() - m_camera.GetDirection());
m_pGltfLoader->m_animatedMats[idx] = m_pGltfLoader->m_nodes[idx].m_transform.GetWorldMat();
}
}

Expand Down Expand Up @@ -270,7 +270,7 @@ void GLTFSample::BuildUI()
if (m_displayModesAvailable[m_currentDisplayModeNamesIndex] == DisplayMode::DISPLAYMODE_FSHDR_Gamma22 ||
m_displayModesAvailable[m_currentDisplayModeNamesIndex] == DisplayMode::DISPLAYMODE_FSHDR_SCRGB)
{
if (ImGui::Checkbox("Enable Local Dimming", &m_enableLocalDimming))
if (ImGui::Checkbox("Disable Local Dimming", &m_disableLocalDimming))
{
OnLocalDimmingChanged();
}
Expand Down