Skip to content

Commit

Permalink
glTFSample v1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rys committed Jul 27, 2021
1 parent 929c172 commit cfec7c0
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 54 deletions.
4 changes: 1 addition & 3 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
variables:
SampleName: GLTFSample
CMakeConfig: -G "Visual Studio 16 2019" -A x64
CaudronMediaUrl: http://isvgit.amd.com/raguaviv/cauldron-media/-/archive/master/cauldron-media-master.zip
GIT_SUBMODULE_STRATEGY: normal

stages:
Expand Down Expand Up @@ -42,7 +41,6 @@ package_sample:
- build_vk
script:
- copy %VULKAN_SDK%\Bin\glslc.exe bin
- move NOTICES.txt %SampleName%
- echo cd .\bin\ > %SampleName%_VK.bat
- echo start %SampleName%_VK.exe >> %SampleName%_VK.bat
- echo cd .\bin\ > %SampleName%_DX12.bat
Expand All @@ -51,7 +49,7 @@ package_sample:
name: "%SampleName%-%CI_COMMIT_TAG%-%CI_COMMIT_REF_NAME%-%CI_COMMIT_SHORT_SHA%"
paths:
- "bin/"
- "NOTICES.txt"
- "license.txt"
- "media/cauldron-media/"
- "%SampleName%_VK.bat"
- "%SampleName%_DX12.bat"
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
url = ../Cauldron.git
[submodule "media/Cauldron-Media"]
path = media/Cauldron-Media
url = ../../GPUOpen-LibrariesAndSDKs/Cauldron-Media
url = ../Cauldron-Media.git
24 changes: 0 additions & 24 deletions NOTICES.txt

This file was deleted.

2 changes: 1 addition & 1 deletion libs/cauldron
Submodule cauldron updated 58 files
+3 −3 src/DX12/GLTF/GltfDepthPass.cpp
+1 −6 src/DX12/GLTF/GltfDepthPass.h
+8 −0 src/DX12/PostProc/MagnifierPS.cpp
+3 −0 src/DX12/PostProc/MagnifierPS.h
+38 −9 src/DX12/PostProc/TAA.cpp
+5 −3 src/DX12/PostProc/TAA.h
+4 −4 src/DX12/PostProc/Tonemapping.cpp
+4 −4 src/DX12/PostProc/Tonemapping.h
+17 −2 src/DX12/base/Device.cpp
+39 −47 src/DX12/base/FrameworkWindows.cpp
+3 −6 src/DX12/base/FrameworkWindows.h
+40 −31 src/DX12/base/FreesyncHDR.cpp
+1 −1 src/DX12/base/FreesyncHDR.h
+10 −3 src/DX12/base/ShaderCompilerHelper.cpp
+1 −1 src/DX12/base/SwapChain.cpp
+1 −0 src/DX12/base/SwapChain.h
+6 −3 src/DX12/base/Texture.cpp
+1 −1 src/DX12/base/Texture.h
+3 −2 src/DX12/shaders/GLTFDepthPass.hlsl
+4 −2 src/DX12/shaders/GLTFNormals.hlsl
+4 −4 src/DX12/shaders/PBRTextures.hlsl
+9 −0 src/DX12/shaders/TAASharpenerCS.hlsl
+3 −1 src/DX12/shaders/Tonemapping.hlsl
+2 −2 src/DX12/shaders/blur.hlsl
+2 −1 src/DX12/shaders/perFrameStruct.h
+42 −0 src/DX12/shaders/taa.hlsl
+2 −0 src/DX12/stdafx.h
+6 −1 src/VK/PostProc/MagnifierPS.cpp
+2 −2 src/VK/PostProc/MagnifierPS.h
+18 −6 src/VK/PostProc/TAA.cpp
+5 −1 src/VK/PostProc/TAA.h
+3 −3 src/VK/PostProc/Tonemapping.cpp
+2 −2 src/VK/PostProc/Tonemapping.h
+39 −58 src/VK/base/FrameworkWindows.cpp
+3 −6 src/VK/base/FrameworkWindows.h
+6 −1 src/VK/base/FreeSyncHDR.cpp
+58 −12 src/VK/base/Instance.cpp
+11 −4 src/VK/base/ShaderCompilerHelper.cpp
+5 −5 src/VK/base/SwapChain.cpp
+9 −5 src/VK/base/Texture.cpp
+2 −2 src/VK/base/Texture.h
+5 −0 src/VK/shaders/GLTFDepthPass-frag.glsl
+4 −13 src/VK/shaders/PBRTextures.glsl
+4 −2 src/VK/shaders/PixelParams.glsl
+42 −0 src/VK/shaders/TAA.hlsl
+9 −0 src/VK/shaders/TAASharpenerCS.hlsl
+2 −2 src/VK/shaders/blur.glsl
+2 −2 src/VK/shaders/perFrameStruct.h
+2 −0 src/VK/stdafx.h
+1 −1 src/common/GLTF/GltfCommon.cpp
+2 −2 src/common/GLTF/GltfCommon.h
+10 −19 src/common/Misc/Camera.cpp
+3 −2 src/common/Misc/Camera.h
+8 −0 src/common/Misc/DxgiFormatHelper.cpp
+3 −1 src/common/Misc/DxgiFormatHelper.h
+6 −1 src/common/Misc/Misc.cpp
+1 −1 src/common/base/Benchmark.cpp
+2 −0 src/common/stdafx.h
2 changes: 1 addition & 1 deletion license.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved.
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
22 changes: 14 additions & 8 deletions src/DX12/GLTFSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void GLTFSample::OnCreate()
ImGUI_Init((void *)m_windowHwnd);
m_UIState.Initialize();

OnResize();
OnResize(true);
OnUpdateDisplay();

// Init Camera, looking at the origin
Expand Down Expand Up @@ -196,15 +196,15 @@ bool GLTFSample::OnEvent(MSG msg)
// OnResize
//
//--------------------------------------------------------------------------------------
void GLTFSample::OnResize()
void GLTFSample::OnResize(bool resizeRender)
{
// Destroy resources (if we are not minimized)
if (m_Width && m_Height && m_pRenderer)
if (resizeRender && m_Width && m_Height && m_pRenderer)
{
m_pRenderer->OnDestroyWindowSizeDependentResources();
m_pRenderer->OnCreateWindowSizeDependentResources(&m_swapChain, m_Width, m_Height);
}

m_camera.SetFov(AMD_PI_OVER_4, m_Width, m_Height, 0.1f, 1000.0f);
}

Expand Down Expand Up @@ -283,7 +283,7 @@ void GLTFSample::LoadScene(int sceneIndex)

// Allocate shadow information (if any)
m_pRenderer->AllocateShadowMaps(m_pGltfLoader);

// set default camera
json camera = scene["camera"];
m_activeCamera = scene.value("activeCamera", m_activeCamera);
Expand Down Expand Up @@ -322,14 +322,16 @@ void GLTFSample::OnUpdate()
io.MouseDelta.y = 0;
io.MouseWheel = 0;
}

// Update Camera
UpdateCamera(m_camera, io);
if (m_UIState.bUseTAA)
{
static uint32_t Seed;
m_camera.SetProjectionJitter(m_Width, m_Height, Seed);
}
else
m_camera.SetProjectionJitter(0.f, 0.f);

// Keyboard & Mouse
HandleInput(io);
Expand All @@ -347,7 +349,7 @@ void GLTFSample::OnUpdate()
void GLTFSample::HandleInput(const ImGuiIO& io)
{
auto fnIsKeyTriggered = [&io](char key) { return io.KeysDown[key] && io.KeysDownDuration[key] == 0.0f; };

// Handle Keyboard/Mouse input here

/* MAGNIFIER CONTROLS */
Expand Down Expand Up @@ -375,6 +377,10 @@ void GLTFSample::UpdateCamera(Camera& cam, const ImGuiIO& io)
// Choose camera movement depending on setting
if (m_activeCamera == 0)
{
// If nothing has changed, don't calculate an update (we are getting micro changes in view causing bugs)
if (!io.MouseWheel && (!io.MouseDown[0] || (!io.MouseDelta.x && !io.MouseDelta.y) ))
return;

// Orbiting
distance -= (float)io.MouseWheel / 3.0f;
distance = std::max<float>(distance, 0.1f);
Expand Down Expand Up @@ -452,7 +458,7 @@ int WINAPI WinMain(HINSTANCE hInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
LPCSTR Name = "SampleDX12 v1.4";
LPCSTR Name = "SampleDX12 v1.4.1";

// create new DX sample
return RunFramework(hInstance, lpCmdLine, nCmdShow, new GLTFSample(Name));
Expand Down
2 changes: 1 addition & 1 deletion src/DX12/GLTFSample.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GLTFSample : public FrameworkWindows
void OnDestroy() override;
void OnRender() override;
bool OnEvent(MSG msg) override;
void OnResize() override;
void OnResize(bool resizeRender) override;
void OnUpdateDisplay() override;

void BuildUI();
Expand Down
7 changes: 4 additions & 3 deletions src/DX12/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ void Renderer::OnRender(const UIState* pState, const Camera& Cam, SwapChain* pSw
pPerFrame->wireframeOptions.setY(pState->WireframeColor[1]);
pPerFrame->wireframeOptions.setZ(pState->WireframeColor[2]);
pPerFrame->wireframeOptions.setW(pState->WireframeMode == UIState::WireframeMode::WIREFRAME_MODE_SOLID_COLOR ? 1.0f : 0.0f);

pPerFrame->lodBias = 0.0f;
m_pGLTFTexturesAndBuffers->SetPerFrameConstants();
m_pGLTFTexturesAndBuffers->SetSkinningMatricesForSkeletons();
}
Expand Down Expand Up @@ -475,8 +475,9 @@ void Renderer::OnRender(const UIState* pState, const Camera& Cam, SwapChain* pSw
SetViewportAndScissor(pCmdLst1, 0, 0, ShadowMap->ShadowResolution, ShadowMap->ShadowResolution);
pCmdLst1->OMSetRenderTargets(0, NULL, false, &m_ShadowMapPoolDSV.GetCPU(ShadowMap->ShadowIndex));

GltfDepthPass::per_frame* cbDepthPerFrame = m_GLTFDepth->SetPerFrameConstants();
cbDepthPerFrame->mViewProj = pPerFrame->lights[ShadowMap->LightIndex].mLightViewProj;
per_frame* cbDepthPerFrame = m_GLTFDepth->SetPerFrameConstants();
cbDepthPerFrame->mCameraCurrViewProj = pPerFrame->lights[ShadowMap->LightIndex].mLightViewProj;
cbDepthPerFrame->lodBias = 0.0f;

m_GLTFDepth->Draw(pCmdLst1);

Expand Down
6 changes: 3 additions & 3 deletions src/DX12/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ void GLTFSample::BuildUI()
{
if (m_fullscreenMode != PRESENTATIONMODE_WINDOWED)
{
UpdateDisplay(m_displayModesAvailable[m_currentDisplayModeNamesIndex], m_disableLocalDimming);
UpdateDisplay(m_disableLocalDimming);
m_previousDisplayModeNamesIndex = m_currentDisplayModeNamesIndex;
}
else if (CheckIfWindowModeHdrOn() &&
(m_displayModesAvailable[m_currentDisplayModeNamesIndex] == DISPLAYMODE_SDR ||
m_displayModesAvailable[m_currentDisplayModeNamesIndex] == DISPLAYMODE_HDR10_2084 ||
m_displayModesAvailable[m_currentDisplayModeNamesIndex] == DISPLAYMODE_HDR10_SCRGB))
{
UpdateDisplay(m_displayModesAvailable[m_currentDisplayModeNamesIndex], m_disableLocalDimming);
UpdateDisplay(m_disableLocalDimming);
m_previousDisplayModeNamesIndex = m_currentDisplayModeNamesIndex;
}
else
Expand All @@ -266,7 +266,7 @@ void GLTFSample::BuildUI()
{
static bool selectedDisableLocaldimmingSetting = false;
if (ImGui::Checkbox("Disable Local Dimming", &selectedDisableLocaldimmingSetting))
UpdateDisplay(m_displayModesAvailable[m_currentDisplayModeNamesIndex], selectedDisableLocaldimmingSetting);
UpdateDisplay(selectedDisableLocaldimmingSetting);
}
}

Expand Down
16 changes: 11 additions & 5 deletions src/VK/GLTFSample.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void GLTFSample::OnCreate()
ImGUI_Init((void *)m_windowHwnd);
m_UIState.Initialize();

OnResize();
OnResize(true);
OnUpdateDisplay();

// Init Camera, looking at the origin
Expand Down Expand Up @@ -190,10 +190,10 @@ bool GLTFSample::OnEvent(MSG msg)
// OnResize
//
//--------------------------------------------------------------------------------------
void GLTFSample::OnResize()
void GLTFSample::OnResize(bool resizeRender)
{
// destroy resources (if we are not minimized)
if (m_Width && m_Height && m_pRenderer)
if (resizeRender && m_Width && m_Height && m_pRenderer)
{
m_pRenderer->OnDestroyWindowSizeDependentResources();
m_pRenderer->OnCreateWindowSizeDependentResources(&m_swapChain, m_Width, m_Height);
Expand Down Expand Up @@ -326,6 +326,8 @@ void GLTFSample::OnUpdate()
static uint32_t Seed;
m_camera.SetProjectionJitter(m_Width, m_Height, Seed);
}
else
m_camera.SetProjectionJitter(0.f, 0.f);

// Keyboard & Mouse
HandleInput(io);
Expand Down Expand Up @@ -381,6 +383,10 @@ void GLTFSample::UpdateCamera(Camera& cam, const ImGuiIO& io)
// Choose camera movement depending on setting
if (m_activeCamera == 0)
{
// If nothing has changed, don't calculate an update (we are getting micro changes in view causing bugs)
if (!io.MouseWheel && (!io.MouseDown[0] || (!io.MouseDelta.x && !io.MouseDelta.y)))
return;

// Orbiting
distance -= (float)io.MouseWheel / 3.0f;
distance = std::max<float>(distance, 0.1f);
Expand Down Expand Up @@ -459,8 +465,8 @@ int WINAPI WinMain(HINSTANCE hInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
LPCSTR Name = "SampleVK v1.4";
LPCSTR Name = "SampleVK v1.4.1";

// create new Vulkan sample
return RunFramework(hInstance, lpCmdLine, nCmdShow, new GLTFSample(Name));
}
}
2 changes: 1 addition & 1 deletion src/VK/GLTFSample.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class GLTFSample : public FrameworkWindows
void OnDestroy() override;
void OnRender() override;
bool OnEvent(MSG msg) override;
void OnResize() override;
void OnResize(bool resizeRender) override;
void OnUpdateDisplay() override;

void BuildUI();
Expand Down
2 changes: 1 addition & 1 deletion src/VK/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ void Renderer::OnRender(const UIState* pState, const Camera& Cam, SwapChain* pSw
pPerFrame->wireframeOptions.setY(pState->WireframeColor[1]);
pPerFrame->wireframeOptions.setZ(pState->WireframeColor[2]);
pPerFrame->wireframeOptions.setW(pState->WireframeMode == UIState::WireframeMode::WIREFRAME_MODE_SOLID_COLOR ? 1.0f : 0.0f);

pPerFrame->lodBias = 0.0f;
m_pGLTFTexturesAndBuffers->SetPerFrameConstants();
m_pGLTFTexturesAndBuffers->SetSkinningMatricesForSkeletons();
}
Expand Down
4 changes: 2 additions & 2 deletions src/VK/UI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,15 @@ void GLTFSample::BuildUI()
{
if (m_fullscreenMode != PRESENTATIONMODE_WINDOWED)
{
UpdateDisplay(m_displayModesAvailable[m_currentDisplayModeNamesIndex]);
UpdateDisplay();
m_previousDisplayModeNamesIndex = m_currentDisplayModeNamesIndex;
}
else if (CheckIfWindowModeHdrOn() &&
(m_displayModesAvailable[m_currentDisplayModeNamesIndex] == DISPLAYMODE_SDR ||
m_displayModesAvailable[m_currentDisplayModeNamesIndex] == DISPLAYMODE_HDR10_2084 ||
m_displayModesAvailable[m_currentDisplayModeNamesIndex] == DISPLAYMODE_HDR10_SCRGB))
{
UpdateDisplay(m_displayModesAvailable[m_currentDisplayModeNamesIndex]);
UpdateDisplay();
m_previousDisplayModeNamesIndex = m_currentDisplayModeNamesIndex;
}
else
Expand Down

0 comments on commit cfec7c0

Please sign in to comment.