├── .gitignore ├── .gitlab-ci.yml ├── CMakeLists.txt ├── NOTICES.txt ├── build ├── .gitignore └── GenerateSolutions.bat ├── common.cmake ├── libs ├── AGS │ ├── CMakeLists.txt │ ├── amd_ags.h │ ├── amd_ags_x64.dll │ ├── amd_ags_x64.lib │ └── license.txt ├── DX12AgilitySDK │ ├── 1.600.10 │ │ ├── bin │ │ │ └── x64 │ │ │ │ ├── D3D12Core.dll │ │ │ │ ├── D3D12Core.pdb │ │ │ │ ├── d3d12SDKLayers.dll │ │ │ │ ├── d3d12SDKLayers.pdb │ │ │ │ ├── d3dconfig.exe │ │ │ │ └── d3dconfig.pdb │ │ └── include │ │ │ ├── d3d12.h │ │ │ ├── d3d12.idl │ │ │ ├── d3d12sdklayers.h │ │ │ ├── d3d12sdklayers.idl │ │ │ ├── d3d12shader.h │ │ │ ├── d3d12video.h │ │ │ ├── d3d12video.idl │ │ │ ├── d3dcommon.h │ │ │ ├── d3dcommon.idl │ │ │ ├── dxgiformat.h │ │ │ └── dxgiformat.idl │ └── CMakeLists.txt ├── DXC │ ├── CMakeLists.txt │ ├── bin │ │ └── x64 │ │ │ ├── dxc.exe │ │ │ ├── dxcompiler.dll │ │ │ └── dxil.dll │ ├── inc │ │ ├── d3d12shader.h │ │ └── dxcapi.h │ └── lib │ │ └── x64 │ │ └── dxcompiler.lib ├── VulkanMemoryAllocator │ ├── CMakeLists.txt │ ├── license.txt │ └── vk_mem_alloc.h ├── WinPixEventRuntime │ ├── CMakeLists.txt │ ├── PIXEvents.h │ ├── PIXEventsCommon.h │ ├── WinPixEventRuntime.dll │ ├── WinPixEventRuntime.lib │ ├── pix3.h │ └── pix3_win.h ├── d3d12x │ ├── CMakeLists.txt │ ├── d3dx12.h │ └── license.txt ├── imgui │ ├── CMakeLists.txt │ ├── License.txt │ ├── README.md │ ├── ReadMe.txt │ ├── TODO.txt │ ├── extra_fonts │ │ ├── Cousine-Regular.ttf │ │ ├── DroidSans.ttf │ │ ├── Karla-Regular.ttf │ │ ├── ProggyClean.ttf │ │ ├── ProggyTiny.ttf │ │ ├── README.txt │ │ ├── Roboto-Medium.ttf │ │ └── binary_to_compressed_c.cpp │ ├── imconfig.h │ ├── imgui.cpp │ ├── imgui.h │ ├── imgui_demo.cpp │ ├── imgui_draw.cpp │ ├── imgui_internal.h │ ├── stb_rect_pack.h │ ├── stb_textedit.h │ └── stb_truetype.h ├── json │ ├── CMakeLists.txt │ ├── License.txt │ └── json.h ├── stb │ ├── CMakeLists.txt │ ├── stb_image.h │ └── stb_image_write.h └── vectormath │ ├── CMakeLists.txt │ ├── LICENSE.txt │ ├── README.md │ ├── common.hpp │ ├── docs │ └── VectorMath-Library-Overview.pdf │ ├── scalar │ ├── matrix.hpp │ ├── quaternion.hpp │ ├── vector.hpp │ └── vectormath.hpp │ ├── sse │ ├── boolinvec.hpp │ ├── floatinvec.hpp │ ├── internal.hpp │ ├── matrix.hpp │ ├── quaternion.hpp │ ├── vecidx.hpp │ ├── vector.hpp │ └── vectormath.hpp │ ├── vec2d.hpp │ └── vectormath.hpp ├── license.txt ├── media ├── BrdfLut.dds └── readme.md ├── readme.md └── src ├── DX12 ├── CMakeLists.txt ├── GLTF │ ├── GLTFTexturesAndBuffers.cpp │ ├── GLTFTexturesAndBuffers.h │ ├── GltfBBoxPass.cpp │ ├── GltfBBoxPass.h │ ├── GltfDepthPass.cpp │ ├── GltfDepthPass.h │ ├── GltfHelpers.cpp │ ├── GltfHelpers.h │ ├── GltfMotionVectorsPass.cpp │ ├── GltfMotionVectorsPass.h │ ├── GltfPbrPass.cpp │ └── GltfPbrPass.h ├── PostProc │ ├── BakeSkinning.cpp │ ├── BakeSkinning.h │ ├── Bloom.cpp │ ├── Bloom.h │ ├── BlurPS.cpp │ ├── BlurPS.h │ ├── ColorConversionPS.cpp │ ├── ColorConversionPS.h │ ├── Debug.cpp │ ├── Debug.h │ ├── DownSamplePS.cpp │ ├── DownSamplePS.h │ ├── MagnifierPS.cpp │ ├── MagnifierPS.h │ ├── PostProcCS.cpp │ ├── PostProcCS.h │ ├── PostProcPS.cpp │ ├── PostProcPS.h │ ├── ShadowResolvePass.cpp │ ├── ShadowResolvePass.h │ ├── SkyDome.cpp │ ├── SkyDome.h │ ├── SkyDomeProc.cpp │ ├── SkyDomeProc.h │ ├── TAA.cpp │ ├── TAA.h │ ├── Tonemapping.cpp │ ├── Tonemapping.h │ ├── TonemappingCS.cpp │ └── TonemappingCS.h ├── base │ ├── Buffer.cpp │ ├── Buffer.h │ ├── CommandListRing.cpp │ ├── CommandListRing.h │ ├── Device.cpp │ ├── Device.h │ ├── DynamicBufferRing.cpp │ ├── DynamicBufferRing.h │ ├── Fence.cpp │ ├── Fence.h │ ├── FrameworkWindows.cpp │ ├── FrameworkWindows.h │ ├── FreesyncHDR.cpp │ ├── FreesyncHDR.h │ ├── GBuffer.cpp │ ├── GBuffer.h │ ├── GPUTimestamps.cpp │ ├── GPUTimestamps.h │ ├── Helper.cpp │ ├── Helper.h │ ├── Imgui.cpp │ ├── Imgui.h │ ├── ResourceViewHeaps.cpp │ ├── ResourceViewHeaps.h │ ├── SaveTexture.cpp │ ├── SaveTexture.h │ ├── ShaderCompilerHelper.cpp │ ├── ShaderCompilerHelper.h │ ├── StaticBufferPool.cpp │ ├── StaticBufferPool.h │ ├── StaticConstantBufferPool.cpp │ ├── StaticConstantBufferPool.h │ ├── SwapChain.cpp │ ├── SwapChain.h │ ├── Texture.cpp │ ├── Texture.h │ ├── UploadHeap.cpp │ ├── UploadHeap.h │ ├── UploadHeapSimple.cpp │ ├── UploadHeapSimple.h │ ├── UserMarkers.cpp │ └── UserMarkers.h ├── readme.md ├── shaders │ ├── BakeSkinning.hlsl │ ├── ColorConversionPS.hlsl │ ├── Debug.hlsl │ ├── DownSamplePS.hlsl │ ├── GLTFDepthPass.hlsl │ ├── GLTFMotionVectorsPass.hlsl │ ├── GLTFNormals.hlsl │ ├── GLTFPBRLighting.hlsl │ ├── GLTFPbrPass-IO.h │ ├── GLTFPbrPass-PS.hlsl │ ├── GLTFPbrPass-VS.hlsl │ ├── GLTFVertexFactory.hlsl │ ├── LPMTonemapperHelper.hlsl │ ├── MagnifierPS.hlsl │ ├── PBRPixelParams.hlsl │ ├── PBRTextures.hlsl │ ├── ShadowResolve.hlsl │ ├── Skinning.hlsl │ ├── SkyDome.hlsl │ ├── SkyDomeProc.hlsl │ ├── TAASharpenerCS.hlsl │ ├── Tonemappers.hlsl │ ├── Tonemapping.hlsl │ ├── TonemappingCS.hlsl │ ├── blend.hlsl │ ├── blur.hlsl │ ├── common.h │ ├── functions.hlsl │ ├── motionBlur.hlsl │ ├── perFrameStruct.h │ ├── shadowFiltering.h │ ├── taa.hlsl │ └── transferFunction.h ├── stdafx.cpp ├── stdafx.h └── widgets │ ├── Wireframe.cpp │ ├── Wireframe.h │ ├── WireframeBox.h │ └── WireframeSphere.h ├── VK ├── CMakeLists.txt ├── GLTF │ ├── GLTFTexturesAndBuffers.cpp │ ├── GLTFTexturesAndBuffers.h │ ├── GltfBBoxPass.cpp │ ├── GltfBBoxPass.h │ ├── GltfDepthPass.cpp │ ├── GltfDepthPass.h │ ├── GltfHelpers.cpp │ ├── GltfHelpers.h │ ├── GltfMotionVectorsPass.cpp │ ├── GltfMotionVectorsPass.h │ ├── GltfPbrPass.cpp │ └── GltfPbrPass.h ├── PostProc │ ├── Bloom.cpp │ ├── Bloom.h │ ├── BlurPS.cpp │ ├── BlurPS.h │ ├── ColorConversionPS.cpp │ ├── ColorConversionPS.h │ ├── DownSamplePS.cpp │ ├── DownSamplePS.h │ ├── MagnifierPS.cpp │ ├── MagnifierPS.h │ ├── PostProcCS.cpp │ ├── PostProcCS.h │ ├── PostProcPS.cpp │ ├── PostProcPS.h │ ├── SkyDome.cpp │ ├── SkyDome.h │ ├── SkyDomeProc.cpp │ ├── SkyDomeProc.h │ ├── TAA.cpp │ ├── TAA.h │ ├── Tonemapping.cpp │ ├── Tonemapping.h │ ├── TonemappingCS.cpp │ └── TonemappingCS.h ├── base │ ├── CommandListRing.cpp │ ├── CommandListRing.h │ ├── Device.cpp │ ├── Device.h │ ├── DeviceProperties.cpp │ ├── DeviceProperties.h │ ├── DynamicBufferRing.cpp │ ├── DynamicBufferRing.h │ ├── ExtDebugUtils.cpp │ ├── ExtDebugUtils.h │ ├── ExtFp16.cpp │ ├── ExtFp16.h │ ├── ExtFreeSyncHDR.cpp │ ├── ExtFreeSyncHDR.h │ ├── ExtRayTracing.cpp │ ├── ExtRayTracing.h │ ├── ExtVRS.cpp │ ├── ExtVRS.h │ ├── ExtValidation.cpp │ ├── ExtValidation.h │ ├── FrameworkWindows.cpp │ ├── FrameworkWindows.h │ ├── FreeSyncHDR.cpp │ ├── FreeSyncHDR.h │ ├── GBuffer.cpp │ ├── GBuffer.h │ ├── GPUTimestamps.cpp │ ├── GPUTimestamps.h │ ├── Helper.cpp │ ├── Helper.h │ ├── Imgui.cpp │ ├── Imgui.h │ ├── Instance.cpp │ ├── Instance.h │ ├── InstanceProperties.cpp │ ├── InstanceProperties.h │ ├── ResourceViewHeaps.cpp │ ├── ResourceViewHeaps.h │ ├── ShaderCompilerHelper.cpp │ ├── ShaderCompilerHelper.h │ ├── StaticBufferPool.cpp │ ├── StaticBufferPool.h │ ├── SwapChain.cpp │ ├── SwapChain.h │ ├── Texture.cpp │ ├── Texture.h │ ├── UploadHeap.cpp │ └── UploadHeap.h ├── readme.md ├── shaders │ ├── ColorConversionPS.glsl │ ├── DownSamplePS.glsl │ ├── GLTFDepthPass-frag.glsl │ ├── GLTFDepthPass-vert.glsl │ ├── GLTFMotionVectorsPass-frag.glsl │ ├── GLTFMotionVectorsPass-vert.glsl │ ├── GLTFPBRLighting.h │ ├── GLTFPbrPass-frag.glsl │ ├── GLTFPbrPass-vert.glsl │ ├── GLTFVertexFactory.glsl │ ├── GLTF_VS2PS_IO.glsl │ ├── LPMTonemapperHelper.glsl │ ├── MagnifierPS.glsl │ ├── PBRTextures.glsl │ ├── PixelParams.glsl │ ├── SkyDome.glsl │ ├── SkyDome.hlsl │ ├── SkyDomeProc.glsl │ ├── SkyDomeProc.hlsl │ ├── TAA.hlsl │ ├── TAASharpenerCS.hlsl │ ├── blend.glsl │ ├── blur.glsl │ ├── functions.glsl │ ├── glTF20-IO.glsl │ ├── perFrameStruct.h │ ├── shadowFiltering.h │ ├── skinning.h │ ├── tonemappers.glsl │ ├── tonemapping.glsl │ ├── tonemappingCS.glsl │ └── transferFunction.h ├── stdafx.cpp ├── stdafx.h └── widgets │ ├── Axis.cpp │ ├── Axis.h │ ├── CheckerBoardFloor.cpp │ ├── CheckerboardFloor.h │ ├── Wireframe.cpp │ ├── Wireframe.h │ ├── WireframeBox.h │ └── WireframeSphere.h └── common ├── CMakeLists.txt ├── FidelityFX └── include │ └── gpu │ ├── ffx_common_types.h │ ├── ffx_core.h │ ├── ffx_core_cpu.h │ ├── ffx_core_glsl.h │ ├── ffx_core_gpu_common.h │ ├── ffx_core_gpu_common_half.h │ ├── ffx_core_hlsl.h │ ├── ffx_core_portability.h │ └── ffx_lpm.h ├── GLTF ├── GltfCommon.cpp ├── GltfCommon.h ├── GltfHelpers.cpp ├── GltfHelpers.h ├── GltfPbrMaterial.cpp ├── GltfPbrMaterial.h └── GltfStructures.h ├── Icon ├── Cauldron_Common.rc ├── GPUOpenChip.ico └── resource.h ├── Misc ├── Async.cpp ├── Async.h ├── AsyncCache.h ├── Camera.cpp ├── Camera.h ├── ColorConversion.cpp ├── ColorConversion.h ├── DDSLoader.cpp ├── DDSLoader.h ├── DxgiFormatHelper.cpp ├── DxgiFormatHelper.h ├── Error.cpp ├── Error.h ├── Hash.cpp ├── Hash.h ├── ImgLoader.cpp ├── ImgLoader.h ├── Misc.cpp ├── Misc.h ├── Ring.h ├── ThreadPool.cpp ├── WICLoader.cpp ├── WICLoader.h ├── WirePrimitive.h ├── WirePrimitives.cpp ├── WirePrimitives.h └── threadpool.h ├── base ├── Benchmark.cpp ├── Benchmark.h ├── DXCHelper.cpp ├── DXCHelper.h ├── ImGuiHelper.cpp ├── ImGuiHelper.h ├── Sequence.cpp ├── Sequence.h ├── ShaderCompiler.cpp ├── ShaderCompiler.h ├── ShaderCompilerCache.cpp └── ShaderCompilerCache.h ├── readme.md └── stdafx.h /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | CMakeConfig: -G "Visual Studio 16 2019" -A x64 3 | FF_USE_FASTZIP: "true" 4 | ARTIFACT_COMPRESSION_LEVEL: "fast" 5 | 6 | stages: 7 | - build 8 | 9 | build_dx12_debug: 10 | tags: 11 | - windows 12 | - amd64 13 | stage: build 14 | script: 15 | - 'cmake -S . -B build/DX12 -DGFX_API=DX12 %CMakeConfig%' 16 | - 'cmake --build build/DX12 --config Debug --parallel 4 -- /p:CL_MPcount=16' 17 | 18 | build_dx12_release: 19 | tags: 20 | - windows 21 | - amd64 22 | stage: build 23 | script: 24 | - 'cmake -S . -B build/DX12 -DGFX_API=DX12 %CMakeConfig%' 25 | - 'cmake --build build/DX12 --config Release --parallel 4 -- /p:CL_MPcount=16' 26 | 27 | build_vk_debug: 28 | tags: 29 | - windows 30 | - amd64 31 | stage: build 32 | script: 33 | - 'cmake -S . -B build/Vk -DGFX_API=VK %CMakeConfig%' 34 | - 'cmake --build build/Vk --config Debug --parallel 4 -- /p:CL_MPcount=16' 35 | 36 | build_vk_release: 37 | tags: 38 | - windows 39 | - amd64 40 | stage: build 41 | script: 42 | - 'cmake -S . -B build/Vk -DGFX_API=VK %CMakeConfig%' 43 | - 'cmake --build build/Vk --config Release --parallel 4 -- /p:CL_MPcount=16' 44 | -------------------------------------------------------------------------------- /build/.gitignore: -------------------------------------------------------------------------------- 1 | DX12/ 2 | VK/ -------------------------------------------------------------------------------- /build/GenerateSolutions.bat: -------------------------------------------------------------------------------- 1 | mkdir DX12 2 | cd DX12 3 | cmake -A x64 ..\.. -DGFX_API=DX12 4 | cd .. 5 | 6 | mkdir VK 7 | cd VK 8 | cmake -A x64 ..\.. -DGFX_API=VK 9 | cd .. -------------------------------------------------------------------------------- /common.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copies a set of files to a directory (only if they already don't exist or are different) 3 | # Usage example: 4 | # set(media_src ${CMAKE_CURRENT_SOURCE_DIR}/../../media/brdfLut.dds ) 5 | # copyCommand("${media_src}" ${CMAKE_HOME_DIRECTORY}/bin) 6 | # 7 | # Sometimes a proper dependency between target and copied files cannot be created 8 | # and you should try copyTargetCommand() below instead 9 | # 10 | function(copyCommand list dest) 11 | foreach(fullFileName ${list}) 12 | get_filename_component(file ${fullFileName} NAME) 13 | message("Generating custom command for ${fullFileName}") 14 | add_custom_command( 15 | OUTPUT ${dest}/${file} 16 | PRE_BUILD 17 | COMMAND ${CMAKE_COMMAND} -E make_directory ${dest} 18 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${fullFileName} ${dest} 19 | MAIN_DEPENDENCY ${fullFileName} 20 | COMMENT "Updating ${file} into ${dest}" 21 | ) 22 | list(APPEND dest_files ${dest}/${file}) 23 | endforeach() 24 | 25 | #return output file list 26 | set(copyCommand_dest_files ${dest_files} PARENT_SCOPE) 27 | endfunction() 28 | 29 | # 30 | # Same as copyCommand() but you can give a target name 31 | # This custom target will depend on all those copied files 32 | # Then the target can be properly set as a dependency of other executable or library 33 | # Usage example: 34 | # add_library(my_lib ...) 35 | # set(media_src ${CMAKE_CURRENT_SOURCE_DIR}/../../media/brdfLut.dds ) 36 | # copyTargetCommand("${media_src}" ${CMAKE_HOME_DIRECTORY}/bin copied_media_src) 37 | # add_dependencies(my_lib copied_media_src) 38 | # 39 | function(copyTargetCommand list dest returned_target_name) 40 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 41 | 42 | foreach(fullFileName ${list}) 43 | get_filename_component(file ${fullFileName} NAME) 44 | message("Generating custom command for ${fullFileName}") 45 | add_custom_command( 46 | OUTPUT ${dest}/${file} 47 | PRE_BUILD 48 | COMMAND ${CMAKE_COMMAND} -E make_directory ${dest} 49 | COMMAND ${CMAKE_COMMAND} -E copy_if_different ${fullFileName} ${dest} 50 | MAIN_DEPENDENCY ${fullFileName} 51 | COMMENT "Updating ${file} into ${dest}" 52 | ) 53 | list(APPEND dest_list ${dest}/${file}) 54 | endforeach() 55 | 56 | add_custom_target(${returned_target_name} DEPENDS "${dest_list}") 57 | 58 | set_target_properties(${returned_target_name} PROPERTIES FOLDER CopyTargets) 59 | endfunction() 60 | -------------------------------------------------------------------------------- /libs/AGS/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(common) 2 | 3 | add_library(amd_ags SHARED IMPORTED GLOBAL) 4 | set_property(TARGET amd_ags PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/amd_ags_x64.lib) 5 | 6 | copyTargetCommand(${CMAKE_CURRENT_SOURCE_DIR}/amd_ags_x64.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} copied_amd_ags_bin) 7 | add_dependencies(amd_ags copied_amd_ags_bin) 8 | -------------------------------------------------------------------------------- /libs/AGS/amd_ags.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/AGS/amd_ags.h -------------------------------------------------------------------------------- /libs/AGS/amd_ags_x64.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/AGS/amd_ags_x64.dll -------------------------------------------------------------------------------- /libs/AGS/amd_ags_x64.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/AGS/amd_ags_x64.lib -------------------------------------------------------------------------------- /libs/AGS/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020 Advanced Micro Devices, Inc. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /libs/DX12AgilitySDK/1.600.10/bin/x64/D3D12Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/DX12AgilitySDK/1.600.10/bin/x64/D3D12Core.dll -------------------------------------------------------------------------------- /libs/DX12AgilitySDK/1.600.10/bin/x64/D3D12Core.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/DX12AgilitySDK/1.600.10/bin/x64/D3D12Core.pdb -------------------------------------------------------------------------------- /libs/DX12AgilitySDK/1.600.10/bin/x64/d3d12SDKLayers.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/DX12AgilitySDK/1.600.10/bin/x64/d3d12SDKLayers.dll -------------------------------------------------------------------------------- /libs/DX12AgilitySDK/1.600.10/bin/x64/d3d12SDKLayers.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/DX12AgilitySDK/1.600.10/bin/x64/d3d12SDKLayers.pdb -------------------------------------------------------------------------------- /libs/DX12AgilitySDK/1.600.10/bin/x64/d3dconfig.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/DX12AgilitySDK/1.600.10/bin/x64/d3dconfig.exe -------------------------------------------------------------------------------- /libs/DX12AgilitySDK/1.600.10/bin/x64/d3dconfig.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/DX12AgilitySDK/1.600.10/bin/x64/d3dconfig.pdb -------------------------------------------------------------------------------- /libs/DX12AgilitySDK/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(common) 2 | 3 | add_library(DX12AgilitySDK INTERFACE) 4 | target_include_directories(DX12AgilitySDK INTERFACE BEFORE "inc/") 5 | 6 | set(DX12AgilitySDK_BIN 7 | "${CMAKE_CURRENT_SOURCE_DIR}/1.600.10/bin/x64/D3D12Core.dll" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/1.600.10/bin/x64/d3d12SDKLayers.dll" 9 | ) 10 | 11 | copyTargetCommand("${DX12AgilitySDK_BIN}" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/D3D12/ copied_dx12_agility_adk_bin) 12 | add_dependencies(DX12AgilitySDK copied_dx12_agility_adk_bin) 13 | -------------------------------------------------------------------------------- /libs/DXC/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(common) 2 | 3 | add_library(DXC INTERFACE) 4 | target_include_directories(DXC INTERFACE BEFORE "inc/") 5 | 6 | set(DXC_BIN 7 | "${CMAKE_CURRENT_SOURCE_DIR}/bin/x64/dxcompiler.dll" 8 | "${CMAKE_CURRENT_SOURCE_DIR}/bin/x64/dxil.dll" 9 | ) 10 | 11 | copyTargetCommand("${DXC_BIN}" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} copied_dxc_bin) 12 | add_dependencies(DXC copied_dxc_bin) 13 | -------------------------------------------------------------------------------- /libs/DXC/bin/x64/dxc.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/DXC/bin/x64/dxc.exe -------------------------------------------------------------------------------- /libs/DXC/bin/x64/dxcompiler.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/DXC/bin/x64/dxcompiler.dll -------------------------------------------------------------------------------- /libs/DXC/bin/x64/dxil.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/DXC/bin/x64/dxil.dll -------------------------------------------------------------------------------- /libs/DXC/lib/x64/dxcompiler.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/DXC/lib/x64/dxcompiler.lib -------------------------------------------------------------------------------- /libs/VulkanMemoryAllocator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(VMA INTERFACE) 2 | target_include_directories(VMA INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /libs/VulkanMemoryAllocator/license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /libs/WinPixEventRuntime/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(common) 2 | 3 | add_library(winpixeventruntimelib SHARED IMPORTED GLOBAL) 4 | set_property(TARGET winpixeventruntimelib PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/WinPixEventRuntime.lib) 5 | 6 | set(WINPIXEVENT_BIN 7 | "${CMAKE_CURRENT_SOURCE_DIR}/WinPixEventRuntime.dll" 8 | ) 9 | 10 | copyTargetCommand("${WINPIXEVENT_BIN}" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} copied_winpixevent_bin) 11 | add_dependencies(winpixeventruntimelib copied_winpixevent_bin) 12 | -------------------------------------------------------------------------------- /libs/WinPixEventRuntime/WinPixEventRuntime.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/WinPixEventRuntime/WinPixEventRuntime.dll -------------------------------------------------------------------------------- /libs/WinPixEventRuntime/WinPixEventRuntime.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/WinPixEventRuntime/WinPixEventRuntime.lib -------------------------------------------------------------------------------- /libs/WinPixEventRuntime/pix3_win.h: -------------------------------------------------------------------------------- 1 | /*==========================================================================; 2 | * 3 | * Copyright (C) Microsoft Corporation. All Rights Reserved. 4 | * 5 | * File: PIX3_win.h 6 | * Content: PIX include file 7 | * Don't include this file directly - use pix3.h 8 | * 9 | ****************************************************************************/ 10 | 11 | #pragma once 12 | 13 | #ifndef _PIX3_H_ 14 | #error Don't include this file directly - use pix3.h 15 | #endif 16 | 17 | #ifndef _PIX3_WIN_H_ 18 | #define _PIX3_WIN_H_ 19 | 20 | // PIXEventsThreadInfo is defined in PIXEventsCommon.h 21 | struct PIXEventsThreadInfo; 22 | 23 | extern "C" PIXEventsThreadInfo* PIXGetThreadInfo() noexcept; 24 | 25 | #if defined(USE_PIX) && defined(USE_PIX_SUPPORTED_ARCHITECTURE) 26 | // Notifies PIX that an event handle was set as a result of a D3D12 fence being signaled. 27 | // The event specified must have the same handle value as the handle 28 | // used in ID3D12Fence::SetEventOnCompletion. 29 | extern "C" void WINAPI PIXNotifyWakeFromFenceSignal(_In_ HANDLE event); 30 | #endif 31 | 32 | // The following defines denote the different metadata values that have been used 33 | // by tools to denote how to parse pix marker event data. The first two values 34 | // are legacy values. 35 | #define WINPIX_EVENT_UNICODE_VERSION 0 36 | #define WINPIX_EVENT_ANSI_VERSION 1 37 | #define WINPIX_EVENT_PIX3BLOB_VERSION 2 38 | 39 | #define D3D12_EVENT_METADATA WINPIX_EVENT_PIX3BLOB_VERSION 40 | 41 | __forceinline UINT64 PIXGetTimestampCounter() 42 | { 43 | LARGE_INTEGER time = {}; 44 | QueryPerformanceCounter(&time); 45 | return time.QuadPart; 46 | } 47 | 48 | #endif //_PIX3_WIN_H_ 49 | -------------------------------------------------------------------------------- /libs/d3d12x/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(D3D12X INTERFACE) 2 | target_include_directories(D3D12X INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /libs/d3d12x/license.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Microsoft 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /libs/imgui/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.6) 2 | set(CMAKE_SUPPRESS_REGENERATION true) 3 | set(CMAKE_GENERATOR_PLATFORM x64) 4 | project (ImGUI) 5 | 6 | set(imgui_src "imgui.h" "imgui.cpp" "imgui_draw.cpp") 7 | add_library (${PROJECT_NAME} STATIC ${imgui_src}) 8 | 9 | target_include_directories (${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /libs/imgui/License.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2017 Omar Cornut and ImGui contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /libs/imgui/ReadMe.txt: -------------------------------------------------------------------------------- 1 | ======================================================================== 2 | STATIC LIBRARY : imgui Project Overview 3 | ======================================================================== 4 | 5 | AppWizard has created this imgui library project for you. 6 | 7 | No source files were created as part of your project. 8 | 9 | 10 | imgui.vcxproj 11 | This is the main project file for VC++ projects generated using an Application Wizard. 12 | It contains information about the version of Visual C++ that generated the file, and 13 | information about the platforms, configurations, and project features selected with the 14 | Application Wizard. 15 | 16 | imgui.vcxproj.filters 17 | This is the filters file for VC++ projects generated using an Application Wizard. 18 | It contains information about the association between the files in your project 19 | and the filters. This association is used in the IDE to show grouping of files with 20 | similar extensions under a specific node (for e.g. ".cpp" files are associated with the 21 | "Source Files" filter). 22 | 23 | ///////////////////////////////////////////////////////////////////////////// 24 | Other notes: 25 | 26 | AppWizard uses "TODO:" comments to indicate parts of the source code you 27 | should add to or customize. 28 | 29 | ///////////////////////////////////////////////////////////////////////////// 30 | -------------------------------------------------------------------------------- /libs/imgui/extra_fonts/Cousine-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/imgui/extra_fonts/Cousine-Regular.ttf -------------------------------------------------------------------------------- /libs/imgui/extra_fonts/DroidSans.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/imgui/extra_fonts/DroidSans.ttf -------------------------------------------------------------------------------- /libs/imgui/extra_fonts/Karla-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/imgui/extra_fonts/Karla-Regular.ttf -------------------------------------------------------------------------------- /libs/imgui/extra_fonts/ProggyClean.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/imgui/extra_fonts/ProggyClean.ttf -------------------------------------------------------------------------------- /libs/imgui/extra_fonts/ProggyTiny.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/imgui/extra_fonts/ProggyTiny.ttf -------------------------------------------------------------------------------- /libs/imgui/extra_fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/imgui/extra_fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /libs/json/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(NJSON INTERFACE) 2 | target_include_directories(NJSON INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /libs/json/License.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2013-2017 Niels Lohmann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /libs/stb/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(STB INTERFACE) 2 | target_include_directories(STB INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -------------------------------------------------------------------------------- /libs/vectormath/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | add_library(VECTORMATH INTERFACE) 2 | target_include_directories(VECTORMATH INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) -------------------------------------------------------------------------------- /libs/vectormath/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Vector Math library for 3-D linear algebra (vector, matrix, quaternion) 2 | SIMD support for SSE. Also includes generic multi-platform scalar version. 3 | 4 | Copyright (C) 2006, 2007 Sony Computer Entertainment Inc. 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, 8 | with or without modification, are permitted provided that the 9 | following conditions are met: 10 | * Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright 13 | notice, this list of conditions and the following disclaimer in the 14 | documentation and/or other materials provided with the distribution. 15 | * Neither the name of the Sony Computer Entertainment Inc nor the names 16 | of its contributors may be used to endorse or promote products derived 17 | from this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 23 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 | POSSIBILITY OF SUCH DAMAGE. 30 | 31 | -------------------------------------------------------------------------------- /libs/vectormath/docs/VectorMath-Library-Overview.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/vectormath/docs/VectorMath-Library-Overview.pdf -------------------------------------------------------------------------------- /libs/vectormath/sse/matrix.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/libs/vectormath/sse/matrix.hpp -------------------------------------------------------------------------------- /libs/vectormath/vectormath.hpp: -------------------------------------------------------------------------------- 1 | 2 | // ================================================================================================ 3 | // -*- C++ -*- 4 | // File: vectormath/vectormath.hpp 5 | // Author: Guilherme R. Lampert 6 | // Created on: 30/12/16 7 | // Brief: This header exposes the Sony Vectormath library types and functions into the global scope. 8 | // ================================================================================================ 9 | 10 | #ifndef VECTORMATH_HPP 11 | #define VECTORMATH_HPP 12 | 13 | #if (!defined(VECTORMATH_DEBUG) && (defined(DEBUG) || defined(_DEBUG))) 14 | #define VECTORMATH_DEBUG 1 15 | #endif // DEBUG || _DEBUG 16 | 17 | // Detecting the availability of SSE at compile-time is a bit more involving with Visual Studio... 18 | #ifdef _MSC_VER 19 | #if (defined(__AVX__) || defined(__AVX2__) || defined(_M_AMD64) || defined(_M_X64) || (_M_IX86_FP == 1) || (_M_IX86_FP == 2)) 20 | #define VECTORMATH_CPU_HAS_SSE1_OR_BETTER 1 21 | #else // SSE support 22 | #define VECTORMATH_CPU_HAS_SSE1_OR_BETTER 0 23 | #endif // SSE support 24 | #else // !_MSC_VER 25 | #if defined(__SSE__) 26 | #define VECTORMATH_CPU_HAS_SSE1_OR_BETTER 1 27 | #else // !__SSE__ 28 | #define VECTORMATH_CPU_HAS_SSE1_OR_BETTER 0 29 | #endif // __SSE__ 30 | #endif // _MSC_VER 31 | 32 | // Sony's library includes: 33 | #if (VECTORMATH_CPU_HAS_SSE1_OR_BETTER && !VECTORMATH_FORCE_SCALAR_MODE) 34 | #include "sse/vectormath.hpp" 35 | namespace Vectormath 36 | { 37 | using namespace SSE; 38 | } 39 | #define VECTORMATH_MODE_SCALAR 0 40 | #define VECTORMATH_MODE_SSE 1 41 | #else // !SSE 42 | #include "scalar/vectormath.hpp" 43 | namespace Vectormath 44 | { 45 | using namespace Scalar; 46 | } 47 | #define VECTORMATH_MODE_SCALAR 1 48 | #define VECTORMATH_MODE_SSE 0 49 | #endif // Vectormath mode selection 50 | 51 | #include "vec2d.hpp" // - Extended 2D vector and point classes; not aligned and always in scalar floats mode. 52 | #include "common.hpp" // - Miscellaneous helper functions. 53 | 54 | namespace math 55 | { 56 | using namespace Vectormath; 57 | } 58 | #endif // VECTORMATH_HPP 59 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019-2020 Advanced Micro Devices, Inc. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /media/BrdfLut.dds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/media/BrdfLut.dds -------------------------------------------------------------------------------- /media/readme.md: -------------------------------------------------------------------------------- 1 | BRDF LUT generated using https://github.com/HectorMF/BRDFGenerator -------------------------------------------------------------------------------- /src/DX12/GLTF/GltfBBoxPass.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "Base/StaticBufferPool.h" 22 | #include "Base/ResourceViewHeaps.h" 23 | #include "Base/DynamicBufferRing.h" 24 | #include "GLTFTexturesAndBuffers.h" 25 | #include "widgets/WireframeBox.h" 26 | 27 | namespace CAULDRON_DX12 28 | { 29 | class GltfBBoxPass 30 | { 31 | public: 32 | void OnCreate( 33 | Device *pDevice, 34 | UploadHeap *pUploadHeap, 35 | ResourceViewHeaps *pHeaps, 36 | DynamicBufferRing *pDynamicBufferRing, 37 | StaticBufferPool *pStaticBufferPool, 38 | GLTFTexturesAndBuffers *pGLTFTexturesAndBuffers, 39 | Wireframe *pWireframe); 40 | 41 | void OnDestroy(); 42 | void Draw(ID3D12GraphicsCommandList* pCommandList, math::Matrix4 cameraViewProjMatrix); 43 | private: 44 | GLTFTexturesAndBuffers *m_pGLTFTexturesAndBuffers; 45 | 46 | Wireframe *m_pWireframe; 47 | WireframeBox m_wireframeBox; 48 | }; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/DX12/GLTF/GltfHelpers.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "../common/GLTF/glTFHelpers.h" 22 | 23 | namespace CAULDRON_DX12 24 | { 25 | DXGI_FORMAT GetFormat(const std::string &str, int id); 26 | void CreateSamplerForPBR(uint32_t samplerIndex, D3D12_STATIC_SAMPLER_DESC *pSamplerDesc); 27 | void CreateSamplerForBrdfLut(uint32_t samplerIndex, D3D12_STATIC_SAMPLER_DESC *pSamplerDesc); 28 | void CreateSamplerForShadowMap(uint32_t samplerIndex, D3D12_STATIC_SAMPLER_DESC *pSamplerDesc); 29 | void CreateSamplerForShadowBuffer(uint32_t samplerIndex, D3D12_STATIC_SAMPLER_DESC *pSamplerDesc); 30 | } 31 | 32 | -------------------------------------------------------------------------------- /src/DX12/PostProc/BakeSkinning.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | namespace CAULDRON_DX12 22 | { 23 | class BakeSkinning 24 | { 25 | public: 26 | BakeSkinning(); 27 | ~BakeSkinning(); 28 | 29 | void OnCreate(Device *pDevice, ResourceViewHeaps *pResourceViewHeaps, int weightsJointsSets); 30 | void OnDestroy(); 31 | void Draw(ID3D12GraphicsCommandList* pCommandList, CBV_SRV_UAV *pUAVInputs, D3D12_GPU_VIRTUAL_ADDRESS skinningMatrices, D3D12_GPU_VIRTUAL_ADDRESS outputUAV, int size); 32 | private: 33 | Device *m_pDevice; 34 | ResourceViewHeaps *m_pResourceViewHeaps; 35 | 36 | ID3D12RootSignature *m_pRootSignature; 37 | ID3D12PipelineState *m_pPipeline = NULL; 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /src/DX12/PostProc/ColorConversionPS.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "PostProcPS.h" 22 | 23 | namespace CAULDRON_DX12 24 | { 25 | class ColorConversionPS 26 | { 27 | public: 28 | void OnCreate(Device* pDevice, ResourceViewHeaps *pResourceViewHeaps, DynamicBufferRing *pDynamicBufferRing, StaticBufferPool *pStaticBufferPool, DXGI_FORMAT outFormat); 29 | void OnDestroy(); 30 | void UpdatePipelines(DXGI_FORMAT outFormat, DisplayMode displayMode); 31 | void Draw(ID3D12GraphicsCommandList* pCommandList, CBV_SRV_UAV *pHDRSRV, uint32_t isLPMToneMapperSelected = 0); 32 | 33 | private: 34 | PostProcPS m_ColorConversion; 35 | 36 | DynamicBufferRing *m_pDynamicBufferRing = NULL; 37 | 38 | struct ColorConversionConsts 39 | { 40 | math::Matrix4 m_contentToMonitorRecMatrix; 41 | DisplayMode m_displayMode; 42 | float m_displayMinLuminancePerNits; 43 | float m_displayMaxLuminancePerNits; 44 | uint32_t m_isLPMToneMapperSelected; 45 | }; 46 | 47 | ColorConversionConsts m_colorConversionConsts; 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /src/DX12/PostProc/Debug.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | namespace CAULDRON_DX12 22 | { 23 | class Debug 24 | { 25 | public: 26 | void OnCreate(Device *pDevice, ResourceViewHeaps *pResourceViewHeaps, StaticBufferPool *pStaticBufferPool, DXGI_FORMAT outFormat); 27 | void OnDestroy(); 28 | 29 | void UpdatePipelines(DXGI_FORMAT outFormat); 30 | void Draw(ID3D12GraphicsCommandList *pCommandList, CBV_SRV_UAV *pDebugBufferSRV); 31 | 32 | private: 33 | PostProcPS m_debug; 34 | }; 35 | } 36 | -------------------------------------------------------------------------------- /src/DX12/PostProc/ShadowResolvePass.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | namespace CAULDRON_DX12 22 | { 23 | class PostProcCS; 24 | class GLTFTexturesAndBuffers; 25 | 26 | class ShadowResolveFrame 27 | { 28 | public: 29 | uint32_t m_Width; 30 | uint32_t m_Height; 31 | CBV_SRV_UAV m_ShadowMapSRV; 32 | CBV_SRV_UAV m_DepthBufferSRV; 33 | CBV_SRV_UAV m_ShadowBufferUAV; 34 | }; 35 | 36 | class ShadowResolvePass 37 | { 38 | const int s_TileSize = 16; 39 | 40 | public: 41 | void OnCreate( 42 | Device *pDevice, 43 | ResourceViewHeaps *pResourceViewHeaps, 44 | DynamicBufferRing *pDynamicBufferRing); 45 | void OnDestroy(); 46 | 47 | void Draw(ID3D12GraphicsCommandList *pCommandList, GLTFTexturesAndBuffers *pGLTFTexturesAndBuffers, ShadowResolveFrame *pShadowResolveFrame); 48 | 49 | protected: 50 | ResourceViewHeaps *m_pResourceViewHeaps; 51 | DynamicBufferRing *m_pDynamicBufferRing; 52 | 53 | ID3D12RootSignature *m_pRootSignature; 54 | ID3D12PipelineState *m_pPipelineState; 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /src/DX12/PostProc/SkyDome.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "PostProcPS.h" 22 | #include "Base/Texture.h" 23 | #include "Base/UploadHeap.h" 24 | #include "Base/StaticBufferPool.h" 25 | #include "Base/DynamicBufferRing.h" 26 | 27 | #include "../../libs/vectormath/vectormath.hpp" 28 | 29 | namespace CAULDRON_DX12 30 | { 31 | class SkyDome 32 | { 33 | public: 34 | void OnCreate(Device* pDevice, UploadHeap* pUploadHeap, ResourceViewHeaps *pResourceViewHeaps, DynamicBufferRing *pDynamicBufferRing, StaticBufferPool *pStaticBufferPool, const char *pDiffuseCubemap, const char *pSpecularCubemap, DXGI_FORMAT outFormat, uint32_t sampleDescCount, bool bInvertedDepth); 35 | void OnDestroy(); 36 | void Draw(ID3D12GraphicsCommandList* pCommandList, const math::Matrix4& invViewProj); 37 | void GenerateDiffuseMapFromEnvironmentMap(); 38 | 39 | void SetDescriptorDiff(uint32_t textureIndex, CBV_SRV_UAV *pTextureTable, uint32_t samplerIndex, D3D12_STATIC_SAMPLER_DESC *pSamplerDesc); 40 | void SetDescriptorSpec(uint32_t textureIndex, CBV_SRV_UAV *pTextureTable, uint32_t samplerIndex, D3D12_STATIC_SAMPLER_DESC *pSamplerDesc); 41 | 42 | private: 43 | Texture m_CubeDiffuseTexture; 44 | Texture m_CubeSpecularTexture; 45 | 46 | CBV_SRV_UAV m_CubeSpecularTextureSRV; 47 | 48 | PostProcPS m_skydome; 49 | 50 | DynamicBufferRing *m_pDynamicBufferRing = NULL; 51 | }; 52 | } 53 | -------------------------------------------------------------------------------- /src/DX12/PostProc/SkyDomeProc.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "PostProcPS.h" 22 | 23 | #include "../../libs/vectormath/vectormath.hpp" 24 | 25 | namespace CAULDRON_DX12 26 | { 27 | // This renders a procedural sky, see the SkyDomeProc.glsl for more references and credits 28 | class SkyDomeProc 29 | { 30 | public: 31 | 32 | struct Constants 33 | { 34 | math::Matrix4 invViewProj; 35 | math::Vector4 vSunDirection; 36 | float rayleigh; 37 | float turbidity; 38 | float mieCoefficient; 39 | float luminance; 40 | float mieDirectionalG; 41 | }; 42 | 43 | void OnCreate(Device* pDevice, ResourceViewHeaps *pResourceViewHeaps, DynamicBufferRing *pDynamicBufferRing, StaticBufferPool *pStaticBufferPool, DXGI_FORMAT outFormat, uint32_t sampleDescCount, bool bInvertedDepth); 44 | void OnDestroy(); 45 | void Draw(ID3D12GraphicsCommandList* pCommandList, SkyDomeProc::Constants constants); 46 | 47 | private: 48 | Device *m_pDevice; 49 | 50 | ResourceViewHeaps *m_pResourceViewHeaps; 51 | 52 | PostProcPS m_skydome; 53 | 54 | DynamicBufferRing *m_pDynamicBufferRing = NULL; 55 | }; 56 | } 57 | -------------------------------------------------------------------------------- /src/DX12/PostProc/Tonemapping.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "Misc/ColorConversion.h" 22 | #include "PostProcPS.h" 23 | 24 | namespace CAULDRON_DX12 25 | { 26 | class ToneMapping 27 | { 28 | public: 29 | void OnCreate(Device* pDevice, ResourceViewHeaps *pResourceViewHeaps, DynamicBufferRing *pDynamicBufferRing, StaticBufferPool *pStaticBufferPool, DXGI_FORMAT outFormat, uint32_t srvTableSize = 1, const char* shaderSource = "Tonemapping.hlsl"); 30 | void OnDestroy(); 31 | void UpdatePipelines(DXGI_FORMAT outFormat); 32 | void Draw(ID3D12GraphicsCommandList* pCommandList, CBV_SRV_UAV *pHDRSRV, float exposure, int toneMapper, bool gamma2 = false); 33 | 34 | protected: 35 | PostProcPS m_toneMapping; 36 | DynamicBufferRing *m_pDynamicBufferRing = NULL; 37 | 38 | struct ToneMappingConsts { 39 | float exposure; int toneMapper; int gamma2; float pad1; 40 | LPMConsts lpmConsts; 41 | }; 42 | }; 43 | } 44 | -------------------------------------------------------------------------------- /src/DX12/PostProc/TonemappingCS.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "PostProcCS.h" 22 | 23 | namespace CAULDRON_DX12 24 | { 25 | class ToneMappingCS 26 | { 27 | public: 28 | void OnCreate(Device* pDevice, ResourceViewHeaps *pResourceViewHeaps, DynamicBufferRing *pDynamicBufferRing); 29 | void OnDestroy(); 30 | void Draw(ID3D12GraphicsCommandList* pCommandList, CBV_SRV_UAV *pHDRSRV, float exposure, int toneMapper, int width, int height); 31 | 32 | private: 33 | PostProcCS m_toneMapping; 34 | DynamicBufferRing *m_pDynamicBufferRing = NULL; 35 | 36 | struct ToneMappingConsts { 37 | float exposure; int toneMapper; int applyGamma; float pad1; 38 | LPMConsts lpmConsts; 39 | }; 40 | }; 41 | } 42 | 43 | -------------------------------------------------------------------------------- /src/DX12/base/Buffer.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #pragma once 21 | 22 | #include "ResourceViewHeaps.h" 23 | #include "UploadHeap.h" 24 | #include "Misc/ImgLoader.h" 25 | 26 | namespace CAULDRON_DX12 27 | { 28 | class Buffer 29 | { 30 | public: 31 | void InitFromMem(Device *pDevice, const char *pDebugName, UploadHeap *pUploadHeap, const void *pData, int numElements, int elementSize); 32 | void Release(); 33 | void CreateSRV(uint32_t index, CBV_SRV_UAV *pRV); 34 | 35 | private: 36 | Device *m_pDevice; 37 | ID3D12Resource *m_pBuffer; 38 | 39 | int m_numElements; 40 | int m_elementSize; 41 | }; 42 | } -------------------------------------------------------------------------------- /src/DX12/base/CommandListRing.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "Device.h" 22 | 23 | namespace CAULDRON_DX12 24 | { 25 | // This class manages command allocators and command lists. 26 | // For each backbuffer creates a command list allocator and creates command lists. 27 | // 28 | class CommandListRing 29 | { 30 | public: 31 | void OnCreate(Device *pDevice, uint32_t numberOfBackBuffers, uint32_t commandListsPerBackBuffer, const D3D12_COMMAND_QUEUE_DESC& queueDesc); 32 | void OnDestroy(); 33 | void OnBeginFrame(); 34 | ID3D12GraphicsCommandList2 *GetNewCommandList(); 35 | ID3D12CommandAllocator *GetAllocator() { return m_pCurrentFrame->m_pCommandAllocator; } 36 | 37 | private: 38 | uint32_t m_frameIndex; 39 | uint32_t m_numberOfAllocators; 40 | uint32_t m_commandListsPerBackBuffer; 41 | 42 | struct CommandBuffersPerFrame 43 | { 44 | ID3D12CommandAllocator *m_pCommandAllocator; 45 | ID3D12GraphicsCommandList2 **m_ppCommandLists; 46 | uint32_t m_UsedCls; 47 | } *m_pCommandBuffers, *m_pCurrentFrame; 48 | }; 49 | } 50 | -------------------------------------------------------------------------------- /src/DX12/base/Fence.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "Device.h" 22 | 23 | namespace CAULDRON_DX12 24 | { 25 | // 26 | // Just a simple class that automatically increments the fence counter 27 | // 28 | class Fence 29 | { 30 | public: 31 | Fence(); 32 | ~Fence(); 33 | void OnCreate(Device *pDevice, const char* pDebugName); 34 | void OnDestroy(); 35 | void IssueFence(ID3D12CommandQueue* pCommandQueue); 36 | 37 | // This member is useful for tracking how ahead the CPU is from the GPU 38 | // 39 | // If the fence is used once per frame, calling this function with 40 | // WaitForFence(3) will make sure the CPU is no more than 3 frames ahead 41 | // 42 | void CpuWaitForFence(UINT64 olderFence); 43 | void GpuWaitForFence(ID3D12CommandQueue* pCommandQueue); 44 | 45 | private: 46 | HANDLE m_hEvent; 47 | ID3D12Fence *m_pFence; 48 | UINT64 m_fenceCounter; 49 | }; 50 | } -------------------------------------------------------------------------------- /src/DX12/base/FreesyncHDR.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2019 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #pragma once 21 | 22 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 23 | // Windows Header Files: 24 | #include 25 | #include "..\AGS\amd_ags.h" 26 | 27 | #include "Misc/ColorConversion.h" 28 | 29 | namespace CAULDRON_DX12 30 | { 31 | bool fsHdrInit(AGSContext *pAGSContext, AGSGPUInfo *pGPUInfo, HWND hwnd); 32 | void fsHdrDestroy(); 33 | bool fsHdrEnumerateDisplayModes(std::vector *pModes); 34 | DXGI_FORMAT fsHdrGetFormat(DisplayMode displayMode); 35 | bool fsHdrSetDisplayMode(DisplayMode displayMode, bool disableLocalDimming, IDXGISwapChain4 *pSwapchain); 36 | const char *fsHdrGetDisplayModeString(DisplayMode displayMode); 37 | const DXGI_OUTPUT_DESC1 *GetDisplayInfo(); 38 | const bool CheckIfWindowModeHdrOn(); 39 | } 40 | -------------------------------------------------------------------------------- /src/DX12/base/Helper.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | namespace CAULDRON_DX12 22 | { 23 | void SetViewportAndScissor(ID3D12GraphicsCommandList* pCommandList, uint32_t topLeftX, uint32_t topLeftY, uint32_t width, uint32_t height); 24 | void SetName(ID3D12Object *pObj, const char* name); 25 | void SetName(ID3D12Object *pObj, const std::string &name); 26 | } 27 | -------------------------------------------------------------------------------- /src/DX12/base/Imgui.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "ResourceViewHeaps.h" 22 | #include "DynamicBufferRing.h" 23 | #include "CommandListRing.h" 24 | #include "UploadHeap.h" 25 | #include "../imgui\imgui.h" 26 | 27 | namespace CAULDRON_DX12 28 | { 29 | // This is the rendering backend for the excellent ImGUI library. 30 | 31 | class ImGUI 32 | { 33 | public: 34 | void OnCreate(Device *pDevice, UploadHeap *pUploadHeap, ResourceViewHeaps *pHeaps, DynamicBufferRing *pConstantBufferRing, DXGI_FORMAT outFormat, float fontSize = 13.f); // Initializer to not break the API 35 | void OnDestroy(); 36 | void UpdatePipeline(DXGI_FORMAT outFormat); 37 | void Draw(ID3D12GraphicsCommandList *pCmdLst); 38 | 39 | private: 40 | Device *m_pDevice = nullptr; 41 | ResourceViewHeaps *m_pResourceViewHeaps = nullptr; 42 | DynamicBufferRing *m_pConstBuf = nullptr; 43 | 44 | ID3D12Resource *m_pTexture2D = nullptr; 45 | ID3D12PipelineState *m_pPipelineState = nullptr; 46 | ID3D12RootSignature *m_pRootSignature = nullptr; 47 | 48 | D3D12_SHADER_BYTECODE m_shaderVert, m_shaderPixel; 49 | 50 | CBV_SRV_UAV m_pTextureSRV; 51 | }; 52 | } 53 | -------------------------------------------------------------------------------- /src/DX12/base/SaveTexture.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include 22 | 23 | namespace CAULDRON_DX12 24 | { 25 | class SaveTexture 26 | { 27 | UINT64 UplHeapSize = 0; 28 | D3D12_RESOURCE_DESC bufferFromDesc = { }; 29 | ID3D12Resource* pResourceReadBack = nullptr; 30 | public: 31 | // 32 | // Call this function first so the resource gets copied into the staging one 33 | // 34 | void CopyRenderTargetIntoStagingTexture(ID3D12Device *pDevice, ID3D12GraphicsCommandList* pCmdLst2, ID3D12Resource* pResourceFrom, D3D12_RESOURCE_STATES state); 35 | 36 | // 37 | // Then, only after the commandlist of the above call has been submitted call this one to actually save the image to disk. 38 | // 39 | void SaveStagingTextureAsJpeg(ID3D12Device *pDevice, ID3D12CommandQueue *pDirectQueue, const char *pFilename); 40 | }; 41 | } -------------------------------------------------------------------------------- /src/DX12/base/ShaderCompilerHelper.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include 22 | #include "Device.h" 23 | #include "Base/DXCHelper.h" 24 | #include "Base/ShaderCompiler.h" 25 | #include 26 | 27 | namespace CAULDRON_DX12 28 | { 29 | void CreateShaderCache(); 30 | void DestroyShaderCache(Device *pDevice); 31 | 32 | void CompileMacros(const DefineList *pMacros, std::vector *pOut); 33 | 34 | // Does as the function name says and uses a cache 35 | bool CompileShaderFromString( 36 | const char *pShaderCode, 37 | const DefineList* pDefines, 38 | const char *pEntrypoint, 39 | const char *pParams, 40 | D3D12_SHADER_BYTECODE* pOutBytecode); 41 | 42 | bool CompileShaderFromFile( 43 | const char* pFileName, 44 | const DefineList* pMacro, 45 | const char *pEntryPoint, 46 | const char *pParams, 47 | D3D12_SHADER_BYTECODE* pOutBytecode); 48 | } -------------------------------------------------------------------------------- /src/DX12/base/StaticConstantBufferPool.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include 22 | #include "ResourceViewHeaps.h" 23 | 24 | namespace CAULDRON_DX12 25 | { 26 | // Simulates DX11 style static buffers. For dynamic buffers please see 'DynamicBufferRingDX12.h' 27 | // 28 | // This class allows suballocating small chuncks of memory from a huge buffer that is allocated on creation 29 | // This class is specialized in constant buffers. 30 | // 31 | class StaticConstantBufferPool 32 | { 33 | public: 34 | void OnCreate(Device* pDevice, uint32_t totalMemSize, ResourceViewHeaps *pHeaps, uint32_t cbvEntriesSize, bool bUseVidMem); 35 | void OnDestroy(); 36 | bool AllocConstantBuffer(uint32_t size, void **pData, uint32_t *pIndex); 37 | bool CreateCBV(uint32_t index, int srvOffset, CBV_SRV_UAV *pCBV); 38 | void UploadData(ID3D12GraphicsCommandList *pCmdList); 39 | void FreeUploadHeap(); 40 | 41 | private: 42 | Device *m_pDevice; 43 | ID3D12Resource *m_pMemBuffer; 44 | ID3D12Resource *m_pSysMemBuffer; 45 | ID3D12Resource *m_pVidMemBuffer; 46 | 47 | char *m_pData; 48 | uint32_t m_memOffset; 49 | uint32_t m_totalMemSize; 50 | 51 | uint32_t m_cbvOffset; 52 | uint32_t m_cbvEntriesSize; 53 | 54 | D3D12_CONSTANT_BUFFER_VIEW_DESC *m_pCBVDesc; 55 | 56 | bool m_bUseVidMem; 57 | }; 58 | } 59 | 60 | -------------------------------------------------------------------------------- /src/DX12/base/UserMarkers.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | #include "stdafx.h" 23 | #include "UserMarkers.h" 24 | #include "../../libs/AGS/amd_ags.h" 25 | #include "../../libs/WinPixEventRuntime/pix3.h" 26 | 27 | namespace CAULDRON_DX12 28 | { 29 | AGSContext* UserMarker::m_agsContext = nullptr; 30 | 31 | UserMarker::UserMarker(ID3D12GraphicsCommandList* commandBuffer, const char* name) 32 | { 33 | m_commandBuffer = commandBuffer; 34 | 35 | if (m_agsContext) 36 | agsDriverExtensionsDX12_PushMarker(m_agsContext, m_commandBuffer, name); 37 | 38 | PIXBeginEvent(m_commandBuffer, 0, name); 39 | } 40 | 41 | UserMarker::~UserMarker() 42 | { 43 | if (m_agsContext) 44 | agsDriverExtensionsDX12_PopMarker(m_agsContext, m_commandBuffer); 45 | 46 | PIXEndEvent(m_commandBuffer); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /src/DX12/base/UserMarkers.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2019 Advanced Micro Devices, Inc. All rights reserved. 3 | // 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files (the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | // 22 | #pragma once 23 | 24 | #include 25 | #include "../../libs/AGS/amd_ags.h" 26 | 27 | namespace CAULDRON_DX12 28 | { 29 | 30 | // For adding markers in RGP 31 | class UserMarker 32 | { 33 | public: 34 | UserMarker(ID3D12GraphicsCommandList* commandBuffer, const char* name); 35 | ~UserMarker(); 36 | static void SetAgsContext(AGSContext* agsContext) { 37 | m_agsContext = agsContext; 38 | } 39 | 40 | private: 41 | 42 | static AGSContext* m_agsContext; 43 | ID3D12GraphicsCommandList* m_commandBuffer = nullptr; 44 | }; 45 | } -------------------------------------------------------------------------------- /src/DX12/readme.md: -------------------------------------------------------------------------------- 1 | The DX12 backend 2 | ================ 3 | 4 | Here lives all the DX12 specific code. It should be as similar as possible to the VK directory. 5 | 6 | ### Directory structure 7 | 8 | * **base**: All the basic code to manage and load textures/buffers/command buffers 9 | * **GLTF**: Code to render the scene using different techniques 10 | * GLTFBBoxPass: Renders just the bounding boxes of the objects 11 | * GLTFBDepthPass: Creates optimized geometry, descriptor sets and pipelines for a depth pass. It also renders the pass and supports skinning. 12 | * GLTFPbrPass: Same as above but for the forward PBR pass. (Credits go to the glTF-WebGL-PBR github project for its fantastic PBR shader.) 13 | * GLTFMotionVectorPass: Generates a small gbuffer with depth, normals and motion vectors. This is needed for the TAA pass. 14 | * TexturesAndBuffers: It loads the texture and buffers from disk and uploads into video memory it also uploads the skinning matrices buffer. 15 | * **PostProc** 16 | * PostProcCS/PostProcPS: Takes a shader and some inputs and draws a full screen quad (used by the effects below) 17 | * Bloom: Combines the DownsamplePS and the Blur passes to create a Bloom effect. (All the credits go to Jorge Jimenez!) 18 | * BlurPS: Takes a mip chain and blurs every mip element 19 | * BakeSkinning: Takes a vertex buffer and the skinning matrices and computes the skinned vertices into a UAV 20 | * DownSamplePS: Takes a render target and generates a mip chain 21 | * ShadowResolvePass: Takes an atlas of 4 shadowmaps and creates a shadow mask 22 | * Sharpen: Sharpens the render target, needed after applying TAA. 23 | * SkyDome: Loads a diffuse+LUT and a specular skydome cubemap. This is used for Image Based Lighting (IBL) and also for drawing a skydome. 24 | * SkydomeProc: Draws a skydome procedurally using the Preetham Model. (Credits go to Simon Wallner and Martin Upitis.) TODO: Generate a diffuse cubemap for IBL. 25 | * TAA: Applies TAA, needs motion vectors, depth and normals. 26 | * ToneMapping: Implements a number of tonemapping methods. 27 | * **Shaders** 28 | * All the shaders used by the above classes 29 | * **Widgets** 30 | * Axis: Renders an axis 31 | * WireFrameBox: Renders a box in wireframe 32 | * WireFrameSphere: Renders a sphere in wireframe 33 | * CheckerBoardFloor: As stated. 34 | 35 | Note: All the code that may be common with VK is in [src/common](src/common) 36 | -------------------------------------------------------------------------------- /src/DX12/shaders/Debug.hlsl: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | //-------------------------------------------------------------------------------------- 21 | // I/O Structures 22 | //-------------------------------------------------------------------------------------- 23 | 24 | struct VERTEX 25 | { 26 | float2 vTexcoord : TEXCOORD; 27 | }; 28 | 29 | //-------------------------------------------------------------------------------------- 30 | // Texture definitions 31 | //-------------------------------------------------------------------------------------- 32 | 33 | Texture2D DebugBuffer : register(t0); 34 | SamplerState DebugSampler : register(s0); 35 | 36 | //-------------------------------------------------------------------------------------- 37 | // Main function 38 | //-------------------------------------------------------------------------------------- 39 | 40 | float4 mainPS(VERTEX Input) : SV_Target 41 | { 42 | return float4(DebugBuffer.SampleLevel(DebugSampler, Input.vTexcoord, 0.0f).xxx, 1.0f); 43 | } 44 | -------------------------------------------------------------------------------- /src/DX12/shaders/GLTFPbrPass-IO.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | // 20 | #ifndef GLTFPBRPassIO 21 | #define GLTFPBRPassIO 22 | 23 | //-------------------------------------------------------------------------------------- 24 | // For PS input struct 25 | //-------------------------------------------------------------------------------------- 26 | 27 | struct VS_OUTPUT_SCENE 28 | { 29 | float4 svPosition : SV_POSITION; // vertex position 30 | float3 WorldPos : WORLDPOS; // vertex position 31 | #ifdef HAS_NORMAL 32 | float3 Normal : NORMAL; // this normal comes in per-vertex 33 | #endif 34 | #ifdef HAS_TANGENT 35 | float3 Tangent : TANGENT; // this normal comes in per-vertex 36 | float3 Binormal : BINORMAL; // this normal comes in per-vertex 37 | #endif 38 | #ifdef HAS_COLOR_0 39 | float4 Color0 : COLOR0; 40 | #endif 41 | #ifdef HAS_TEXCOORD_0 42 | float2 UV0 : TEXCOORD0; // vertex texture coords 43 | #endif 44 | #ifdef HAS_TEXCOORD_1 45 | float2 UV1 : TEXCOORD1; // vertex texture coords 46 | #endif 47 | 48 | #ifdef HAS_MOTION_VECTORS 49 | float4 svCurrPosition : TEXCOORD2; // current's frame vertex position 50 | float4 svPrevPosition : TEXCOORD3; // previous' frame vertex position 51 | #endif 52 | }; 53 | 54 | #endif -------------------------------------------------------------------------------- /src/DX12/shaders/LPMTonemapperHelper.hlsl: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2022 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | 21 | #define FFX_GPU 1 22 | #define FFX_HLSL 1 23 | #include "ffx_core.h" 24 | 25 | uint4 LpmFilterCtl(uint i) 26 | { 27 | return u_ctl[i]; 28 | } 29 | 30 | #define LPM_NO_SETUP 1 31 | #include "ffx_lpm.h" 32 | 33 | float3 LPMTonemapper(float3 color, bool shoulder, bool con, bool soft, bool con2, bool clip, bool scaleOnly, matrix inputToOutputMatrix) 34 | { 35 | color = mul(inputToOutputMatrix, color); 36 | 37 | // This code is there to make sure no negative values make it down to tonemappers. 38 | // Make sure to never hit this case and convert content to correct colourspace 39 | color.r = max(0, color.r); 40 | color.g = max(0, color.g); 41 | color.b = max(0, color.b); 42 | // 43 | 44 | LpmFilter(color.r, color.g, color.b, shoulder, con, soft, con2, clip, scaleOnly); 45 | return color; 46 | } -------------------------------------------------------------------------------- /src/DX12/shaders/Skinning.hlsl: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | //-------------------------------------------------------------------------------------- 21 | // Constant buffers 22 | //-------------------------------------------------------------------------------------- 23 | #ifdef ID_SKINNING_MATRICES 24 | 25 | struct Matrix2 26 | { 27 | matrix m_current; 28 | matrix m_previous; 29 | }; 30 | 31 | cbuffer cbPerSkeleton : register(CB(ID_SKINNING_MATRICES)) 32 | { 33 | Matrix2 myPerSkeleton_u_ModelMatrix[200]; 34 | }; 35 | 36 | matrix GetCurrentSkinningMatrix(float4 Weights, uint4 Joints) 37 | { 38 | matrix skinningMatrix = 39 | Weights.x * myPerSkeleton_u_ModelMatrix[Joints.x].m_current + 40 | Weights.y * myPerSkeleton_u_ModelMatrix[Joints.y].m_current + 41 | Weights.z * myPerSkeleton_u_ModelMatrix[Joints.z].m_current + 42 | Weights.w * myPerSkeleton_u_ModelMatrix[Joints.w].m_current; 43 | return skinningMatrix; 44 | } 45 | 46 | matrix GetPreviousSkinningMatrix(float4 Weights, uint4 Joints) 47 | { 48 | matrix skinningMatrix = 49 | Weights.x * myPerSkeleton_u_ModelMatrix[Joints.x].m_previous + 50 | Weights.y * myPerSkeleton_u_ModelMatrix[Joints.y].m_previous + 51 | Weights.z * myPerSkeleton_u_ModelMatrix[Joints.z].m_previous + 52 | Weights.w * myPerSkeleton_u_ModelMatrix[Joints.w].m_previous; 53 | return skinningMatrix; 54 | } 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /src/DX12/shaders/SkyDome.hlsl: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | //-------------------------------------------------------------------------------------- 21 | // Constant Buffer 22 | //-------------------------------------------------------------------------------------- 23 | cbuffer cbPerFrame : register(b0) 24 | { 25 | matrix u_mClipToWord; 26 | } 27 | 28 | //-------------------------------------------------------------------------------------- 29 | // I/O Structures 30 | //-------------------------------------------------------------------------------------- 31 | struct VERTEX 32 | { 33 | float2 vTexcoord : TEXCOORD; 34 | }; 35 | 36 | //-------------------------------------------------------------------------------------- 37 | // Texture definitions 38 | //-------------------------------------------------------------------------------------- 39 | TextureCube inputTex :register(t0); 40 | SamplerState samLinearWrap :register(s0); 41 | 42 | //-------------------------------------------------------------------------------------- 43 | // Main function 44 | //-------------------------------------------------------------------------------------- 45 | float4 mainPS(VERTEX Input) : SV_Target 46 | { 47 | float4 clip = float4(2 * Input.vTexcoord.x - 1, 1 - 2 * Input.vTexcoord.y, FAR_DEPTH, 1); 48 | 49 | float4 pixelDir = mul(u_mClipToWord, clip); 50 | 51 | return inputTex.Sample(samLinearWrap, pixelDir.xyz); 52 | } 53 | -------------------------------------------------------------------------------- /src/DX12/shaders/Tonemappers.hlsl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/src/DX12/shaders/Tonemappers.hlsl -------------------------------------------------------------------------------- /src/DX12/shaders/blend.hlsl: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | //-------------------------------------------------------------------------------------- 21 | // Constant Buffer 22 | //-------------------------------------------------------------------------------------- 23 | cbuffer cbPerFrame : register(b0) 24 | { 25 | float u_weight; 26 | } 27 | 28 | //-------------------------------------------------------------------------------------- 29 | // I/O Structures 30 | //-------------------------------------------------------------------------------------- 31 | struct VERTEX 32 | { 33 | float2 vTexcoord : TEXCOORD; 34 | }; 35 | 36 | //-------------------------------------------------------------------------------------- 37 | // Texture definitions 38 | //-------------------------------------------------------------------------------------- 39 | Texture2D inputTex :register(t0); 40 | SamplerState samLinearMirror :register(s0); 41 | 42 | //-------------------------------------------------------------------------------------- 43 | // Main function 44 | //-------------------------------------------------------------------------------------- 45 | 46 | float4 mainPS(VERTEX Input) : SV_Target 47 | { 48 | return u_weight * inputTex.Sample(samLinearMirror, Input.vTexcoord).rgba; 49 | } 50 | -------------------------------------------------------------------------------- /src/DX12/shaders/common.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #define CONCAT(a,b) a ## b 21 | #define CB(v) CONCAT(b,v) 22 | #define UA(v) CONCAT(u,v) 23 | #define TEX(v) CONCAT(T,v) 24 | #define SMP(v) CONCAT(s,v) 25 | #define TARGET(v) CONCAT(SV_Target,v) 26 | 27 | -------------------------------------------------------------------------------- /src/DX12/shaders/motionBlur.hlsl: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | Texture2D Input : register(t0); 21 | Texture2D MotionVectors : register(t1); 22 | RWTexture2D Result : register(u0); 23 | 24 | [numthreads(WIDTH, HEIGHT, DEPTH)] 25 | void main(uint3 threadID : SV_DispatchThreadID) 26 | { 27 | uint2 coord = threadID.xy; 28 | 29 | /* 30 | int steps = 25; 31 | 32 | float2 velocity = -1000 * MotionVectors.Load(int3(coord, 0)) / float(steps); 33 | velocity = float2(velocity.x, -velocity.y); 34 | 35 | float4 vColor = float4(0, 0, 0, 0); 36 | 37 | for (int i = 0; i < steps; ++i) 38 | { 39 | vColor += Input.Load(int3(coord + ((float)i)*velocity, 0)); 40 | } 41 | 42 | Result[coord] = vColor / float(steps); 43 | */ 44 | float ax = ((float) coord.x) / 20.0; 45 | float ay = ((float) coord.y) / 20.0; 46 | int2 distortion = int2(20 * sin(ay), 20 * cos(ax)); 47 | 48 | Result[coord] = Input.Load(int3(coord + distortion, 0)); 49 | } -------------------------------------------------------------------------------- /src/DX12/shaders/transferFunction.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2022 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | enum DisplayMode 21 | { 22 | SDR, 23 | FS2_Gamma22, 24 | FS2_SCRGB, 25 | HDR10_PQ, 26 | HDR10_SCRGB 27 | }; 28 | 29 | float3 ApplyGamma(float3 color) 30 | { 31 | color.xyz = pow(color.xyz, 1.0f / 2.2f); 32 | return color; 33 | } 34 | 35 | float3 ApplyPQ(float3 color) 36 | { 37 | // Apply ST2084 curve 38 | float m1 = 2610.0 / 4096.0 / 4; 39 | float m2 = 2523.0 / 4096.0 * 128; 40 | float c1 = 3424.0 / 4096.0; 41 | float c2 = 2413.0 / 4096.0 * 32; 42 | float c3 = 2392.0 / 4096.0 * 32; 43 | float3 cp = pow(abs(color.xyz), m1); 44 | color.xyz = pow((c1 + c2 * cp) / (1 + c3 * cp), m2); 45 | return color; 46 | } 47 | 48 | float3 ApplyscRGBScale(float3 color, float minLuminancePerNits, float maxLuminancePerNits) 49 | { 50 | color.xyz = (color.xyz * (maxLuminancePerNits - minLuminancePerNits)) + float3(minLuminancePerNits, minLuminancePerNits, minLuminancePerNits); 51 | return color; 52 | } -------------------------------------------------------------------------------- /src/DX12/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // FrameworkDX12.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | 10 | #pragma comment(lib,"d3dcompiler.lib") 11 | #pragma comment(lib, "D3D12.lib") 12 | 13 | -------------------------------------------------------------------------------- /src/DX12/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #define NOMINMAX 11 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 12 | 13 | // Windows Header Files: 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | // C RunTime Header Files 21 | #include 22 | #include 23 | #include 24 | 25 | // GFX API 26 | #include 27 | #include 28 | #include "..\d3d12x\d3dx12.h" 29 | 30 | // math API 31 | #include 32 | using namespace DirectX; 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #include "..\common\Misc\Error.h" 45 | #include "base\UserMarkers.h" 46 | #include "base\Helper.h" 47 | #include "..\common\misc\misc.h" 48 | 49 | 50 | // TODO: reference additional headers your program requires here 51 | -------------------------------------------------------------------------------- /src/DX12/widgets/Wireframe.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "../Base/Device.h" 22 | #include "../Base/DynamicBufferRing.h" 23 | #include "../Base/StaticBufferPool.h" 24 | #include "../Base/ResourceViewHeaps.h" 25 | #include "../Base/UploadHeap.h" 26 | #include "../../common/Misc/Camera.h" 27 | 28 | namespace CAULDRON_DX12 29 | { 30 | class Wireframe 31 | { 32 | public: 33 | void OnCreate( 34 | Device* pDevice, 35 | ResourceViewHeaps *pHeaps, 36 | DynamicBufferRing *pDynamicBufferRing, 37 | StaticBufferPool *pStaticBufferPool, 38 | DXGI_FORMAT outFormat, 39 | uint32_t sampleDescCount, 40 | bool bInvertedDepth = false); 41 | 42 | void OnDestroy(); 43 | void Draw(ID3D12GraphicsCommandList* pCommandList, int numIndices, D3D12_INDEX_BUFFER_VIEW IBV, D3D12_VERTEX_BUFFER_VIEW VBV, const math::Matrix4& WorldViewProj, const math::Vector4& vCenter, const math::Vector4& vRadius, const math::Vector4& vColor); 44 | 45 | private: 46 | DynamicBufferRing *m_pDynamicBufferRing; 47 | ResourceViewHeaps *m_pResourceViewHeaps; 48 | 49 | ID3D12PipelineState* m_pPipeline; 50 | ID3D12RootSignature* m_RootSignature; 51 | 52 | struct per_object 53 | { 54 | math::Matrix4 m_mWorldViewProj; 55 | math::Vector4 m_vCenter; 56 | math::Vector4 m_vRadius; 57 | math::Vector4 m_vColor; 58 | }; 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /src/VK/GLTF/GltfBBoxPass.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "Base/Device.h" 22 | #include "Base/StaticBufferPool.h" 23 | #include "Base/ResourceViewHeaps.h" 24 | #include "Base/DynamicBufferRing.h" 25 | #include "GLTFTexturesAndBuffers.h" 26 | #include "Widgets/WireframeBox.h" 27 | 28 | namespace CAULDRON_VK 29 | { 30 | class GltfBBoxPass 31 | { 32 | public: 33 | void OnCreate( 34 | Device* pDevice, 35 | VkRenderPass renderPass, 36 | ResourceViewHeaps *pHeaps, 37 | DynamicBufferRing *pDynamicBufferRing, 38 | StaticBufferPool *pStaticBufferPool, 39 | GLTFTexturesAndBuffers *pGLTFTexturesAndBuffers, 40 | Wireframe *pWireframe); 41 | 42 | void OnDestroy(); 43 | void Draw(VkCommandBuffer cmd_buf, const math::Matrix4& cameraViewProjMatrix, const math::Vector4& color); 44 | inline void Draw(VkCommandBuffer cmd_buf, const math::Matrix4& cameraViewProjMatrix) { Draw(cmd_buf, cameraViewProjMatrix, math::Vector4(1.0f, 1.0f, 1.0f, 1.0f)); } 45 | private: 46 | GLTFTexturesAndBuffers *m_pGLTFTexturesAndBuffers; 47 | 48 | Wireframe *m_pWireframe; 49 | WireframeBox m_wireframeBox; 50 | }; 51 | } 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/VK/GLTF/GltfHelpers.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "vulkan/vulkan.h" 22 | #include "../common/GLTF/GltfHelpers.h" 23 | 24 | namespace CAULDRON_VK 25 | { 26 | VkFormat GetFormat(const std::string &str, int id); 27 | uint32_t SizeOfFormat(VkFormat format); 28 | } 29 | -------------------------------------------------------------------------------- /src/VK/PostProc/PostProcCS.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "Base/Device.h" 22 | #include "Base/ShaderCompilerHelper.h" 23 | 24 | namespace CAULDRON_VK 25 | { 26 | class PostProcCS 27 | { 28 | public: 29 | void OnCreate( 30 | Device* pDevice, 31 | const std::string &shaderFilename, 32 | const std::string &shaderEntryPoint, 33 | const std::string &shaderCompilerParams, 34 | VkDescriptorSetLayout descriptorSetLayout, 35 | uint32_t dwWidth, uint32_t dwHeight, uint32_t dwDepth, 36 | DefineList* userDefines = 0 37 | ); 38 | void OnDestroy(); 39 | void Draw(VkCommandBuffer cmd_buf, VkDescriptorBufferInfo *pConstantBuffer, VkDescriptorSet descSet, uint32_t dispatchX, uint32_t dispatchY, uint32_t dispatchZ); 40 | 41 | private: 42 | Device* m_pDevice; 43 | 44 | VkPipeline m_pipeline = VK_NULL_HANDLE; 45 | VkPipelineLayout m_pipelineLayout; 46 | }; 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/VK/PostProc/SkyDomeProc.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #pragma once 21 | #include "PostProcPS.h" 22 | 23 | #include "../../libs/vectormath/vectormath.hpp" 24 | 25 | namespace CAULDRON_VK 26 | { 27 | // This renders a procedural sky, see the SkyDomeProc.glsl for more references and credits 28 | 29 | class SkyDomeProc 30 | { 31 | public: 32 | 33 | struct Constants 34 | { 35 | math::Matrix4 invViewProj; 36 | math::Vector4 vSunDirection; 37 | float rayleigh; 38 | float turbidity; 39 | float mieCoefficient; 40 | float luminance; 41 | float mieDirectionalG; 42 | }; 43 | 44 | void OnCreate(Device* pDevice, VkRenderPass renderPass, UploadHeap* pUploadHeap, VkFormat outFormat, ResourceViewHeaps *pResourceViewHeaps, DynamicBufferRing *pDynamicBufferRing, StaticBufferPool *pStaticBufferPool, VkSampleCountFlagBits sampleDescCount, bool invertedDepth = false); 45 | void OnDestroy(); 46 | void Draw(VkCommandBuffer cmd_buf, SkyDomeProc::Constants constants); 47 | 48 | private: 49 | Device* m_pDevice; 50 | 51 | ResourceViewHeaps *m_pResourceViewHeaps; 52 | 53 | VkDescriptorSet m_descriptorSet; 54 | VkDescriptorSetLayout m_descriptorLayout; 55 | 56 | PostProcPS m_skydome; 57 | 58 | DynamicBufferRing *m_pDynamicBufferRing = NULL; 59 | 60 | bool m_bInvertedDepth; 61 | }; 62 | } 63 | -------------------------------------------------------------------------------- /src/VK/PostProc/Tonemapping.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "PostProcPS.h" 22 | #include "Base/ResourceViewHeaps.h" 23 | #include "Misc/ColorConversion.h" 24 | 25 | namespace CAULDRON_VK 26 | { 27 | class ToneMapping 28 | { 29 | public: 30 | void OnCreate(Device* pDevice, VkRenderPass renderPass, ResourceViewHeaps *pResourceViewHeaps, StaticBufferPool *pStaticBufferPool, DynamicBufferRing *pDynamicBufferRing, uint32_t srvTableSize = 1, const char* shaderSource = "Tonemapping.glsl"); 31 | void OnDestroy(); 32 | 33 | void UpdatePipelines(VkRenderPass renderPass); 34 | 35 | void Draw(VkCommandBuffer cmd_buf, VkImageView HDRSRV, float exposure, int toneMapper); 36 | 37 | protected: 38 | Device* m_pDevice; 39 | ResourceViewHeaps *m_pResourceViewHeaps; 40 | 41 | PostProcPS m_toneMapping; 42 | DynamicBufferRing *m_pDynamicBufferRing = NULL; 43 | 44 | VkSampler m_sampler; 45 | 46 | uint32_t m_descriptorIndex; 47 | static const uint32_t s_descriptorBuffers = 10; 48 | 49 | VkDescriptorSet m_descriptorSet[s_descriptorBuffers]; 50 | VkDescriptorSetLayout m_descriptorSetLayout; 51 | 52 | struct ToneMappingConsts { 53 | float exposure; int toneMapper; float pad0; float pad1; 54 | LPMConsts lpmConsts; 55 | }; 56 | }; 57 | } 58 | -------------------------------------------------------------------------------- /src/VK/PostProc/TonemappingCS.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "Misc/ColorConversion.h" 22 | #include "PostProcCS.h" 23 | #include "Base/ResourceViewHeaps.h" 24 | 25 | namespace CAULDRON_VK 26 | { 27 | class ToneMappingCS 28 | { 29 | public: 30 | void OnCreate(Device* pDevice, ResourceViewHeaps *pResourceViewHeaps, DynamicBufferRing *pDynamicBufferRing); 31 | void OnDestroy(); 32 | 33 | void Draw(VkCommandBuffer cmd_buf, VkImageView HDRSRV, float exposure, int toneMapper, int width, int height); 34 | 35 | private: 36 | Device* m_pDevice; 37 | ResourceViewHeaps *m_pResourceViewHeaps; 38 | 39 | PostProcCS m_toneMapping; 40 | DynamicBufferRing *m_pDynamicBufferRing = NULL; 41 | 42 | uint32_t m_descriptorIndex; 43 | static const uint32_t s_descriptorBuffers = 10; 44 | 45 | VkDescriptorSet m_descriptorSet[s_descriptorBuffers]; 46 | VkDescriptorSetLayout m_descriptorSetLayout; 47 | 48 | struct ToneMappingConsts { 49 | float exposure; int toneMapper; float pad0; float pad1; 50 | LPMConsts lpmConsts; 51 | }; 52 | }; 53 | } 54 | -------------------------------------------------------------------------------- /src/VK/base/CommandListRing.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "Misc/Ring.h" 22 | 23 | namespace CAULDRON_VK 24 | { 25 | // This class, on creation allocates a number of command lists. Using a ring buffer 26 | // these commandLists are recycled when they are no longer used by the GPU. See the 27 | // 'ring.h' for more details on allocation and recycling 28 | // 29 | class CommandListRing 30 | { 31 | public: 32 | void OnCreate(Device *pDevice, uint32_t numberOfBackBuffers, uint32_t commandListsPerframe, bool compute = false); 33 | void OnDestroy(); 34 | void OnBeginFrame(); 35 | VkCommandBuffer GetNewCommandList(); 36 | VkCommandPool GetPool() { return m_pCommandBuffers->m_commandPool; } 37 | 38 | private: 39 | uint32_t m_frameIndex; 40 | uint32_t m_numberOfAllocators; 41 | uint32_t m_commandListsPerBackBuffer; 42 | 43 | Device *m_pDevice; 44 | 45 | struct CommandBuffersPerFrame 46 | { 47 | VkCommandPool m_commandPool; 48 | VkCommandBuffer *m_pCommandBuffer; 49 | VkFence m_cmdBufExecutedFences; 50 | uint32_t m_UsedCls; 51 | } *m_pCommandBuffers, *m_pCurrentFrame; 52 | 53 | }; 54 | } 55 | -------------------------------------------------------------------------------- /src/VK/base/DeviceProperties.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "vulkan/vulkan.h" 22 | #include 23 | 24 | namespace CAULDRON_VK 25 | { 26 | class DeviceProperties 27 | { 28 | VkPhysicalDevice m_physicaldevice; 29 | 30 | std::vector m_device_extension_names; 31 | 32 | std::vector m_deviceExtensionProperties; 33 | 34 | 35 | void *m_pNext = NULL; 36 | public: 37 | VkResult Init(VkPhysicalDevice physicaldevice); 38 | bool IsExtensionPresent(const char *pExtName); 39 | bool AddDeviceExtensionName(const char *deviceExtensionName); 40 | void *GetNext() { return m_pNext; } 41 | void SetNewNext(void *pNext) { m_pNext = pNext; } 42 | 43 | VkPhysicalDevice GetPhysicalDevice() { return m_physicaldevice; } 44 | void GetExtensionNamesAndConfigs(std::vector *pDevice_extension_names); 45 | private: 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /src/VK/base/ExtDebugUtils.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "vulkan/vulkan.h" 22 | #include "InstanceProperties.h" 23 | 24 | namespace CAULDRON_VK 25 | { 26 | // helpers functions to use debug markers 27 | void ExtDebugUtilsGetProcAddresses(VkDevice device); 28 | bool ExtDebugUtilsCheckInstanceExtensions(InstanceProperties *pDP); 29 | void SetResourceName(VkDevice device, VkObjectType objectType, uint64_t handle, const char* name); 30 | void SetPerfMarkerBegin(VkCommandBuffer cmd_buf, const char* name); 31 | void SetPerfMarkerEnd(VkCommandBuffer cmd_buf); 32 | } -------------------------------------------------------------------------------- /src/VK/base/ExtFp16.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "DeviceProperties.h" 22 | #include "InstanceProperties.h" 23 | 24 | namespace CAULDRON_VK 25 | { 26 | bool ExtFp16CheckExtensions(DeviceProperties *pDP); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/VK/base/ExtRayTracing.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "DeviceProperties.h" 22 | #include "InstanceProperties.h" 23 | 24 | namespace CAULDRON_VK 25 | { 26 | void ExtRTCheckExtensions(DeviceProperties* pDP, bool& RT10Supported, bool& RT11Supported); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/VK/base/ExtVRS.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "DeviceProperties.h" 22 | #include "InstanceProperties.h" 23 | 24 | namespace CAULDRON_VK 25 | { 26 | void ExtVRSCheckExtensions(DeviceProperties* pDP, bool& Tier1Supported, bool& Tier2Supported, VkExtent2D& FragmentShadingRateAttachmentTexelSize, VkExtent2D& MaxFragmentSize); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/VK/base/ExtValidation.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #pragma once 21 | 22 | #include "InstanceProperties.h" 23 | #include "DeviceProperties.h" 24 | 25 | namespace CAULDRON_VK 26 | { 27 | bool ExtDebugReportCheckInstanceExtensions(InstanceProperties *pIP, bool gpuValidation); 28 | void ExtDebugReportGetProcAddresses(VkInstance instance); 29 | 30 | void ExtDebugReportOnCreate(VkInstance instance); 31 | void ExtDebugReportOnDestroy(VkInstance instance); 32 | } 33 | -------------------------------------------------------------------------------- /src/VK/base/FreeSyncHDR.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "DeviceProperties.h" 22 | #include "InstanceProperties.h" 23 | #include 24 | 25 | #include "Misc/ColorConversion.h" 26 | 27 | namespace CAULDRON_VK 28 | { 29 | // only the swapchain should be using these functions 30 | 31 | bool fsHdrInit(VkDevice device, VkSurfaceKHR surface, VkPhysicalDevice physicalDevice, HWND hWnd); 32 | bool fsHdrEnumerateDisplayModes(std::vector *pModes, bool includeFreesyncHDR, PresentationMode fullscreenMode = PRESENTATIONMODE_WINDOWED, bool enableLocalDimming = true); 33 | VkSurfaceFormatKHR fsHdrGetFormat(DisplayMode displayMode); 34 | bool fsHdrSetDisplayMode(DisplayMode displayMode, VkSwapchainKHR swapChain); 35 | const char *fsHdrGetDisplayModeString(DisplayMode displayMode); 36 | const VkHdrMetadataEXT* fsHdrGetDisplayInfo(); 37 | 38 | void fsHdrSetLocalDimmingMode(VkSwapchainKHR swapchain, VkBool32 localDimmingEnable); 39 | void fsHdrSetFullscreenState(bool fullscreen, VkSwapchainKHR swapchain); 40 | 41 | void fsHdrGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfCapabilities); 42 | VkSurfaceFullScreenExclusiveInfoEXT *GetVkSurfaceFullScreenExclusiveInfoEXT(); 43 | 44 | const bool CheckIfWindowModeHdrOn(); 45 | } 46 | -------------------------------------------------------------------------------- /src/VK/base/GPUTimestamps.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include 22 | #include 23 | #include "Base/Benchmark.h" 24 | 25 | namespace CAULDRON_VK 26 | { 27 | // This class helps insert queries in the command buffer and readback the results. 28 | // The tricky part in fact is reading back the results without stalling the GPU. 29 | // For that it splits the readback heap in pieces and it reads 30 | // from the last used chuck. 31 | 32 | class GPUTimestamps 33 | { 34 | public: 35 | void OnCreate(Device *pDevice, uint32_t numberOfBackBuffers); 36 | void OnDestroy(); 37 | 38 | void GetTimeStamp(VkCommandBuffer cmd_buf, const char *label); 39 | void GetTimeStampUser(TimeStamp ts); 40 | void OnBeginFrame(VkCommandBuffer cmd_buf, std::vector *pTimestamp); 41 | void OnEndFrame(); 42 | 43 | private: 44 | Device* m_pDevice; 45 | 46 | const uint32_t MaxValuesPerFrame = 128; 47 | 48 | VkQueryPool m_QueryPool; 49 | 50 | uint32_t m_frame = 0; 51 | uint32_t m_NumberOfBackBuffers = 0; 52 | 53 | std::vector m_labels[5]; 54 | std::vector m_cpuTimeStamps[5]; 55 | }; 56 | } -------------------------------------------------------------------------------- /src/VK/base/Instance.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "vulkan/vulkan.h" 22 | #include "InstanceProperties.h" 23 | 24 | namespace CAULDRON_VK 25 | { 26 | // 27 | // Crate/Destroys a Vulkan instance 28 | // 29 | 30 | bool CreateInstance(const char *pAppName, const char *pEngineName, VkInstance *pVulkanInstance, VkPhysicalDevice *pPhysicalDevice, InstanceProperties *pIp); 31 | VkInstance CreateInstance(VkApplicationInfo app_info, InstanceProperties *pIp); 32 | void DestroyInstance(VkInstance instance); 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/VK/base/InstanceProperties.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "vulkan/vulkan.h" 22 | 23 | namespace CAULDRON_VK 24 | { 25 | class InstanceProperties 26 | { 27 | std::vector m_instanceLayerProperties; 28 | std::vector m_instanceExtensionProperties; 29 | 30 | std::vector m_instance_layer_names; 31 | std::vector m_instance_extension_names; 32 | void *m_pNext = NULL; 33 | public: 34 | VkResult Init(); 35 | bool AddInstanceLayerName(const char *instanceLayerName); 36 | bool AddInstanceExtensionName(const char *instanceExtensionName); 37 | void *GetNext() { return m_pNext; } 38 | void SetNewNext(void *pNext) { m_pNext = pNext; } 39 | 40 | void GetExtensionNamesAndConfigs(std::vector *pInstance_layer_names, std::vector *pInstance_extension_names); 41 | private: 42 | bool IsLayerPresent(const char *pExtName); 43 | bool IsExtensionPresent(const char *pExtName); 44 | }; 45 | } 46 | -------------------------------------------------------------------------------- /src/VK/base/ShaderCompilerHelper.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "Base/Device.h" 22 | #include "Base/ShaderCompiler.h" 23 | #include "base/DXCHelper.h" 24 | 25 | class Sync; 26 | 27 | namespace CAULDRON_VK 28 | { 29 | enum ShaderSourceType 30 | { 31 | SST_HLSL, 32 | SST_GLSL 33 | }; 34 | 35 | void CreateShaderCache(); 36 | void DestroyShaderCache(Device *pDevice); 37 | 38 | 39 | // Does as the function name says and uses a cache 40 | VkResult VKCompileFromString(VkDevice device, ShaderSourceType sourceType, const VkShaderStageFlagBits shader_type, const char *pShaderCode, const char *pShaderEntryPoint, const char *pExtraParams, const DefineList *pDefines, VkPipelineShaderStageCreateInfo *pShader); 41 | VkResult VKCompileFromFile(VkDevice device, const VkShaderStageFlagBits shader_type, const char *pFilename, const char *pShaderEntryPoint, const char *pExtraParams, const DefineList *pDefines, VkPipelineShaderStageCreateInfo *pShader); 42 | } 43 | -------------------------------------------------------------------------------- /src/VK/readme.md: -------------------------------------------------------------------------------- 1 | The VK backend 2 | ================ 3 | 4 | Here lives all the VK specific code. It should be as similar as possible to the DX12 directory. 5 | 6 | ### Directory structure 7 | 8 | * **base**: All the basic code to manage and load textures/buffers/command buffers 9 | * **GLTF**: Code to render the scene using different techniques 10 | * GLTFBBoxPass: renders just the bounding boxes of the objects 11 | * GLTFBDepthPass: creates optimized geometry, descriptor sets and pipelines for a depth pass. It also renders the pass and supports skinning. 12 | * GLTFPbrPass: same as above but for the forward PBR pass. (Credits go to the glTF-WebGL-PBR github project for its fantastic PBR shader.) 13 | * TexturesAndBuffers: It loads the texture and buffers from disk and uploads into video memory it also uploads the skinning matrices buffer. 14 | * **PostProc** 15 | * PostProcCS/PostProcPS: that takes a shader and some inputs and draws a full screen quad (used by the effects below) 16 | * Bloom: combines the DownsamplePS and the Blur passes to create a Bloom effect. (All the credits go to Jorge Jimenez!) 17 | * BlurPS: takes a mip chain and blurs every mip element 18 | * DownSamplePS: takes a render target and generates a mip chain 19 | * SkyDome: loads a diffuse+LUT and a specular skydome cubemap. This is used for Image Based Lighting (IBL) and also for drawing a skydome. 20 | * SkydomeProc: draws a skydome procedurally using the Preetham Model. (Credits go to Simon Wallner and Martin Upitis.) TODO: Generate a diffuse cubemap for IBL. 21 | * ToneMapping: implements a number of tonemapping methods. 22 | * **Shaders** 23 | * all the shaders used by the above classes 24 | * **Widgets** 25 | * Axis: Renders an axis 26 | * WireFrameBox: Renders a box in wireframe 27 | * WireFrameSphere: Renders a sphere in wireframe 28 | * CheckerBoardFloor: as stated. 29 | 30 | Note: All the code that may be common with DX12 is in [src/common](src/common) 31 | -------------------------------------------------------------------------------- /src/VK/shaders/GLTFDepthPass-frag.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | // AMD Cauldron code 4 | // 5 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files(the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions : 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #extension GL_ARB_separate_shader_objects : enable 23 | #extension GL_ARB_shading_language_420pack : enable 24 | 25 | precision highp float; 26 | 27 | //-------------------------------------------------------------------------------------- 28 | // I/O Structures 29 | //-------------------------------------------------------------------------------------- 30 | 31 | #include "GLTF_VS2PS_IO.glsl" 32 | layout (location = 0) in VS2PS Input; 33 | 34 | #include "perFrameStruct.h" 35 | 36 | PerFrame myPerFrame; 37 | 38 | //-------------------------------------------------------------------------------------- 39 | // Texture definitions 40 | //-------------------------------------------------------------------------------------- 41 | 42 | #include "PixelParams.glsl" 43 | 44 | //-------------------------------------------------------------------------------------- 45 | // Pixel Shader 46 | //-------------------------------------------------------------------------------------- 47 | 48 | void main() 49 | { 50 | myPerFrame.u_LodBias = 0.0; 51 | discardPixelIfAlphaCutOff(Input); 52 | } 53 | -------------------------------------------------------------------------------- /src/VK/shaders/GLTFDepthPass-vert.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | // AMD Cauldron code 4 | // 5 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files(the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions : 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | //-------------------------------------------------------------------------------------- 23 | // I/O Structures 24 | //-------------------------------------------------------------------------------------- 25 | 26 | #include "GLTF_VS2PS_IO.glsl" 27 | 28 | //-------------------------------------------------------------------------------------- 29 | // Constant Buffer 30 | //-------------------------------------------------------------------------------------- 31 | #include "perFrameStruct.h" 32 | 33 | layout (std140, binding = ID_PER_FRAME) uniform _PerFrame 34 | { 35 | PerFrame myPerFrame; 36 | }; 37 | 38 | layout (std140, binding = ID_PER_OBJECT) uniform perObject 39 | { 40 | mat4 u_ModelMatrix; 41 | } myPerObject; 42 | 43 | mat4 GetWorldMatrix() 44 | { 45 | return myPerObject.u_ModelMatrix; 46 | } 47 | 48 | mat4 GetCameraViewProj() 49 | { 50 | return myPerFrame.u_mCameraCurrViewProj; 51 | } 52 | 53 | #include "GLTFVertexFactory.glsl" 54 | 55 | //-------------------------------------------------------------------------------------- 56 | // main 57 | //-------------------------------------------------------------------------------------- 58 | void main() 59 | { 60 | gltfVertexFactory(); 61 | } 62 | -------------------------------------------------------------------------------- /src/VK/shaders/GLTFPbrPass-vert.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | // AMD Cauldron code 4 | // 5 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files(the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions : 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | //-------------------------------------------------------------------------------------- 23 | // Include IO structures 24 | //-------------------------------------------------------------------------------------- 25 | 26 | #include "GLTF_VS2PS_IO.glsl" 27 | 28 | //-------------------------------------------------------------------------------------- 29 | // Constant buffers 30 | //-------------------------------------------------------------------------------------- 31 | #include "perFrameStruct.h" 32 | 33 | layout (std140, binding = ID_PER_FRAME) uniform _PerFrame 34 | { 35 | PerFrame myPerFrame; 36 | }; 37 | 38 | layout (std140, binding = ID_PER_OBJECT) uniform perObject 39 | { 40 | mat4 u_mCurrWorld; 41 | mat4 u_mPrevWorld; 42 | } myPerObject; 43 | 44 | mat4 GetWorldMatrix() 45 | { 46 | return myPerObject.u_mCurrWorld; 47 | } 48 | 49 | mat4 GetCameraViewProj() 50 | { 51 | return myPerFrame.u_mCameraCurrViewProj; 52 | } 53 | 54 | mat4 GetPrevWorldMatrix() 55 | { 56 | return myPerObject.u_mPrevWorld; 57 | } 58 | 59 | mat4 GetPrevCameraViewProj() 60 | { 61 | return myPerFrame.u_mCameraPrevViewProj; 62 | } 63 | 64 | #include "GLTFVertexFactory.glsl" 65 | 66 | //-------------------------------------------------------------------------------------- 67 | // Main 68 | //-------------------------------------------------------------------------------------- 69 | void main() 70 | { 71 | gltfVertexFactory(); 72 | } 73 | 74 | -------------------------------------------------------------------------------- /src/VK/shaders/GLTF_VS2PS_IO.glsl: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #ifndef VS2PS_struct 21 | #define VS2PS_struct 22 | 23 | struct VS2PS 24 | { 25 | #ifdef ID_COLOR_0 26 | vec3 Color0; 27 | #endif 28 | 29 | #ifdef ID_TEXCOORD_0 30 | vec2 UV0; 31 | #endif 32 | 33 | #ifdef ID_TEXCOORD_1 34 | vec2 UV1; 35 | #endif 36 | 37 | #ifdef ID_NORMAL 38 | vec3 Normal; 39 | #endif 40 | 41 | #ifdef ID_TANGENT 42 | vec3 Tangent; 43 | vec3 Binormal; 44 | #endif 45 | 46 | vec3 WorldPos; 47 | 48 | #ifdef HAS_MOTION_VECTORS 49 | vec4 CurrPosition; 50 | vec4 PrevPosition; 51 | #endif 52 | 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /src/VK/shaders/LPMTonemapperHelper.glsl: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2022 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | 21 | #define FFX_GPU 1 22 | #define FFX_GLSL 1 23 | #include "ffx_core.h" 24 | 25 | FfxUInt32x4 LpmFilterCtl(FfxUInt32 i) 26 | { 27 | return myPerScene.u_ctl[i]; 28 | } 29 | 30 | #define LPM_NO_SETUP 1 31 | #include "ffx_lpm.h" 32 | 33 | vec3 LPMTonemapper(vec3 color, bool shoulder, bool con, bool soft, bool con2, bool clip, bool scaleOnly, mat4 inputToOutputMatrix) 34 | { 35 | color = (inputToOutputMatrix * vec4(color, 0.0f)).xyz; 36 | 37 | // This code is there to make sure no negative values make it down to tonemappers. 38 | // Make sure to never hit this case and convert content to correct colourspace 39 | color.r = max(0, color.r); 40 | color.g = max(0, color.g); 41 | color.b = max(0, color.b); 42 | // 43 | 44 | LpmFilter(color.r, color.g, color.b, shoulder, con, soft, con2, clip, scaleOnly); 45 | return color; 46 | } -------------------------------------------------------------------------------- /src/VK/shaders/SkyDome.hlsl: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | //-------------------------------------------------------------------------------------- 21 | // Constant Buffer 22 | //-------------------------------------------------------------------------------------- 23 | [[vk::binding(0)]] cbuffer cbPerFrame : register(b0) 24 | { 25 | matrix u_mClipToWord; 26 | } 27 | 28 | //-------------------------------------------------------------------------------------- 29 | // I/O Structures 30 | //-------------------------------------------------------------------------------------- 31 | struct VERTEX 32 | { 33 | [[vk::location(0)]] float2 vTexcoord : TEXCOORD; 34 | }; 35 | 36 | //-------------------------------------------------------------------------------------- 37 | // Texture definitions 38 | //-------------------------------------------------------------------------------------- 39 | [[vk::binding(1)]] TextureCube inputTex :register(t0); 40 | [[vk::binding(1)]] SamplerState samLinearWrap :register(s0); 41 | 42 | //-------------------------------------------------------------------------------------- 43 | // Main function 44 | //-------------------------------------------------------------------------------------- 45 | [[vk::location(0)]] float4 main(VERTEX Input) : SV_Target 46 | { 47 | float4 clip = float4(2 * Input.vTexcoord.x - 1, 1 - 2 * Input.vTexcoord.y, FAR_DEPTH, 1); 48 | 49 | float4 pixelDir = mul(u_mClipToWord, clip); 50 | 51 | return inputTex.Sample(samLinearWrap, pixelDir.xyz)*.02; 52 | } 53 | -------------------------------------------------------------------------------- /src/VK/shaders/blend.glsl: -------------------------------------------------------------------------------- 1 | #version 400 2 | 3 | // AMD Cauldron code 4 | // 5 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 6 | // Permission is hereby granted, free of charge, to any person obtaining a copy 7 | // of this software and associated documentation files(the "Software"), to deal 8 | // in the Software without restriction, including without limitation the rights 9 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 10 | // copies of the Software, and to permit persons to whom the Software is 11 | // furnished to do so, subject to the following conditions : 12 | // The above copyright notice and this permission notice shall be included in 13 | // all copies or substantial portions of the Software. 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | #extension GL_ARB_separate_shader_objects : enable 23 | #extension GL_ARB_shading_language_420pack : enable 24 | 25 | //-------------------------------------------------------------------------------------- 26 | // Constant Buffer 27 | //-------------------------------------------------------------------------------------- 28 | layout (std140, binding = 0) uniform perFrame 29 | { 30 | float u_weight; 31 | } myPerFrame; 32 | 33 | //-------------------------------------------------------------------------------------- 34 | // I/O Structures 35 | //-------------------------------------------------------------------------------------- 36 | layout (location = 0) in vec2 inTexCoord; 37 | 38 | layout (location = 0) out vec4 outColor; 39 | 40 | //-------------------------------------------------------------------------------------- 41 | // Texture definitions 42 | //-------------------------------------------------------------------------------------- 43 | layout(set=0, binding=1) uniform sampler2D inputSampler; 44 | 45 | //-------------------------------------------------------------------------------------- 46 | // Main function 47 | //-------------------------------------------------------------------------------------- 48 | 49 | void main() 50 | { 51 | outColor = myPerFrame.u_weight * texture( inputSampler, inTexCoord).rgba; 52 | } 53 | -------------------------------------------------------------------------------- /src/VK/shaders/glTF20-IO.glsl: -------------------------------------------------------------------------------- 1 | // AMD AMDUtils code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | // 20 | 21 | -------------------------------------------------------------------------------- /src/VK/shaders/perFrameStruct.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | // KHR_lights_punctual extension. 21 | // see https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_lights_punctual 22 | 23 | #define MAX_LIGHT_INSTANCES 80 24 | #define MAX_SHADOW_INSTANCES 32 25 | 26 | struct Light 27 | { 28 | mat4 mLightViewProj; 29 | mat4 mLightView; 30 | 31 | vec3 direction; 32 | float range; 33 | 34 | vec3 color; 35 | float intensity; 36 | 37 | vec3 position; 38 | float innerConeCos; 39 | 40 | float outerConeCos; 41 | int type; 42 | float depthBias; 43 | int shadowMapIndex; 44 | }; 45 | 46 | const int LightType_Directional = 0; 47 | const int LightType_Point = 1; 48 | const int LightType_Spot = 2; 49 | 50 | struct PerFrame 51 | { 52 | mat4 u_mCameraCurrViewProj; 53 | mat4 u_mCameraPrevViewProj; 54 | mat4 u_mCameraCurrViewProjInverse; 55 | 56 | vec4 u_CameraPos; 57 | float u_iblFactor; 58 | float u_EmissiveFactor; 59 | vec2 u_invScreenResolution; 60 | 61 | vec4 u_WireframeOptions; 62 | 63 | vec2 u_mCameraCurrJitter; 64 | vec2 u_mCameraPrevJitter; 65 | 66 | Light u_lights[MAX_LIGHT_INSTANCES]; 67 | int u_lightCount; 68 | float u_LodBias; 69 | 70 | vec2 u_padding; 71 | }; 72 | -------------------------------------------------------------------------------- /src/VK/shaders/skinning.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2018 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #ifdef ID_SKINNING_MATRICES 21 | 22 | struct Matrix2 23 | { 24 | mat4 m_current; 25 | mat4 m_previous; 26 | }; 27 | 28 | 29 | layout (std140, binding = ID_SKINNING_MATRICES) uniform perSkeleton 30 | { 31 | Matrix2 u_ModelMatrix[200]; 32 | } myPerSkeleton; 33 | 34 | mat4 GetCurrentSkinningMatrix(vec4 Weights, uvec4 Joints) 35 | { 36 | mat4 skinningMatrix = 37 | Weights.x * myPerSkeleton.u_ModelMatrix[Joints.x].m_current + 38 | Weights.y * myPerSkeleton.u_ModelMatrix[Joints.y].m_current + 39 | Weights.z * myPerSkeleton.u_ModelMatrix[Joints.z].m_current + 40 | Weights.w * myPerSkeleton.u_ModelMatrix[Joints.w].m_current; 41 | return skinningMatrix; 42 | } 43 | 44 | mat4 GetPreviousSkinningMatrix(vec4 Weights, uvec4 Joints) 45 | { 46 | mat4 skinningMatrix = 47 | Weights.x * myPerSkeleton.u_ModelMatrix[Joints.x].m_previous + 48 | Weights.y * myPerSkeleton.u_ModelMatrix[Joints.y].m_previous + 49 | Weights.z * myPerSkeleton.u_ModelMatrix[Joints.z].m_previous + 50 | Weights.w * myPerSkeleton.u_ModelMatrix[Joints.w].m_previous; 51 | return skinningMatrix; 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/VK/shaders/tonemappers.glsl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/src/VK/shaders/tonemappers.glsl -------------------------------------------------------------------------------- /src/VK/shaders/transferFunction.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2022 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #define DisplayMode_SDR 0 21 | #define DisplayMode_FS2_Gamma22 1 22 | #define DisplayMode_FS2_SCRGB 2 23 | #define DisplayMode_HDR10_PQ 3 24 | #define DisplayMode_HDR10_SCRGB 4 25 | 26 | vec3 ApplyGamma(vec3 color) 27 | { 28 | float invGamma = 1.0 / 2.2; 29 | color.xyz = pow(color.rgb, vec3(invGamma, invGamma, invGamma)); 30 | return color; 31 | } 32 | 33 | vec3 ApplyPQ(vec3 color) 34 | { 35 | // Apply ST2084 curve 36 | float m1 = 2610.0 / 4096.0 / 4; 37 | float m2 = 2523.0 / 4096.0 * 128; 38 | float c1 = 3424.0 / 4096.0; 39 | float c2 = 2413.0 / 4096.0 * 32; 40 | float c3 = 2392.0 / 4096.0 * 32; 41 | vec3 cp = pow(abs(color.xyz), vec3(m1)); 42 | color.xyz = pow((c1 + c2 * cp) / (1 + c3 * cp), vec3(m2)); 43 | return color; 44 | } 45 | 46 | vec3 ApplyscRGBScale(vec3 color, float minLuminancePerNits, float maxLuminancePerNits) 47 | { 48 | color.xyz = (color.xyz * (maxLuminancePerNits - minLuminancePerNits)) + vec3(minLuminancePerNits, minLuminancePerNits, minLuminancePerNits); 49 | return color; 50 | } -------------------------------------------------------------------------------- /src/VK/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // FrameworkDX12.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/VK/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #define NOMINMAX 11 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 12 | 13 | // Windows Header Files: 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | // C RunTime Header Files 21 | #include 22 | #include 23 | #include 24 | 25 | // GFX API 26 | #include 27 | 28 | // math API 29 | #include 30 | using namespace DirectX; 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | //#include 43 | 44 | // TODO: reference additional headers your program requires here 45 | -------------------------------------------------------------------------------- /src/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(common) 2 | 3 | set(base_src 4 | "base/Sequence.cpp" 5 | "base/Sequence.h" 6 | "base/Benchmark.cpp" 7 | "base/Benchmark.h" 8 | "base/ImGuiHelper.cpp" 9 | "base/ImGuiHelper.h" 10 | ) 11 | 12 | set(shader_compiler_src 13 | "base/ShaderCompiler.cpp" 14 | "base/ShaderCompiler.h" 15 | "base/ShaderCompilerCache.cpp" 16 | "base/ShaderCompilerCache.h" 17 | "base/DXCHelper.cpp" 18 | "base/DXCHelper.h" 19 | ) 20 | 21 | set(GLTF_src 22 | "GLTF/GltfStructures.h" 23 | "GLTF/GltfCommon.cpp" 24 | "GLTF/GltfCommon.h" 25 | "GLTF/GltfPbrMaterial.cpp" 26 | "GLTF/GltfPbrMaterial.h" 27 | "GLTF/GltfHelpers.cpp" 28 | "GLTF/GltfHelpers.h" 29 | ) 30 | 31 | file(GLOB_RECURSE Misc_src 32 | "Misc/*.cpp" 33 | "Misc/*.h" 34 | ) 35 | 36 | set(FidelityFX_src 37 | ${CMAKE_CURRENT_SOURCE_DIR}/FidelityFX/include/gpu/ffx_common_types.h 38 | ${CMAKE_CURRENT_SOURCE_DIR}/FidelityFX/include/gpu/ffx_core.h 39 | ${CMAKE_CURRENT_SOURCE_DIR}/FidelityFX/include/gpu/ffx_core_cpu.h 40 | ${CMAKE_CURRENT_SOURCE_DIR}/FidelityFX/include/gpu/ffx_lpm.h 41 | ${CMAKE_CURRENT_SOURCE_DIR}/FidelityFX/include/gpu/ffx_core_hlsl.h 42 | ${CMAKE_CURRENT_SOURCE_DIR}/FidelityFX/include/gpu/ffx_core_glsl.h 43 | ${CMAKE_CURRENT_SOURCE_DIR}/FidelityFX/include/gpu/ffx_core_gpu_common.h 44 | ${CMAKE_CURRENT_SOURCE_DIR}/FidelityFX/include/gpu/ffx_core_gpu_common_half.h 45 | ${CMAKE_CURRENT_SOURCE_DIR}/FidelityFX/include/gpu/ffx_core_portability.h 46 | ) 47 | 48 | add_library (Cauldron_Common STATIC ${base_src} ${GLTF_src} ${Misc_src} ${shader_compiler_src} ${media_src}) 49 | target_link_libraries (Cauldron_Common PUBLIC NJSON STB DXC Shcore) 50 | target_include_directories (Cauldron_Common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 51 | 52 | set(media_src 53 | ${CMAKE_CURRENT_SOURCE_DIR}/../../media/brdfLut.dds 54 | ) 55 | 56 | copyTargetCommand("${media_src}" ${CMAKE_HOME_DIRECTORY}/bin copied_common_media_src) 57 | copyTargetCommand("${FidelityFX_src}" ${CMAKE_HOME_DIRECTORY}/bin/ShaderLibVK copied_vk_FidelityFX_src) 58 | copyTargetCommand("${FidelityFX_src}" ${CMAKE_HOME_DIRECTORY}/bin/ShaderLibDX copied_dx_FidelityFX_src) 59 | add_dependencies (Cauldron_Common copied_common_media_src copied_vk_FidelityFX_src copied_dx_FidelityFX_src) 60 | 61 | source_group("Base" FILES ${base_src}) 62 | source_group("GLTF" FILES ${GLTF_src}) 63 | source_group("Misc" FILES ${Misc_src}) 64 | source_group("SC" FILES ${shader_compiler_src}) 65 | 66 | set_source_files_properties(${FidelityFX_src} PROPERTIES VS_TOOL_OVERRIDE "Text") -------------------------------------------------------------------------------- /src/common/FidelityFX/include/gpu/ffx_core.h: -------------------------------------------------------------------------------- 1 | // This file is part of the FidelityFX SDK. 2 | // 3 | // Copyright (c) 2022 Advanced Micro Devices, Inc. All rights reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | /// @defgroup Core 23 | /// @defgroup HLSL 24 | /// @defgroup GLSL 25 | /// @defgroup GPU 26 | /// @defgroup CPU 27 | /// @defgroup CAS 28 | /// @defgroup FSR1 29 | 30 | #if !defined(FFX_CORE_H) 31 | #define FFX_CORE_H 32 | 33 | #include "ffx_common_types.h" 34 | 35 | #if defined(FFX_CPU) 36 | #include "ffx_core_cpu.h" 37 | #endif // #if defined(FFX_CPU) 38 | 39 | #if defined(FFX_GLSL) && defined(FFX_GPU) 40 | #include "ffx_core_glsl.h" 41 | #endif // #if defined(FFX_GLSL) && defined(FFX_GPU) 42 | 43 | #if defined(FFX_HLSL) && defined(FFX_GPU) 44 | #include "ffx_core_hlsl.h" 45 | #endif // #if defined(FFX_HLSL) && defined(FFX_GPU) 46 | 47 | #if defined(FFX_GPU) 48 | #include "ffx_core_gpu_common.h" 49 | #include "ffx_core_gpu_common_half.h" 50 | #include "ffx_core_portability.h" 51 | #endif // #if defined(FFX_GPU) 52 | #endif // #if !defined(FFX_CORE_H) -------------------------------------------------------------------------------- /src/common/FidelityFX/include/gpu/ffx_core_portability.h: -------------------------------------------------------------------------------- 1 | // This file is part of the FidelityFX SDK. 2 | // 3 | // Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. 4 | // 5 | // Permission is hereby granted, free of charge, to any person obtaining a copy 6 | // of this software and associated documentation files (the "Software"), to deal 7 | // in the Software without restriction, including without limitation the rights 8 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | // copies of the Software, and to permit persons to whom the Software is 10 | // furnished to do so, subject to the following conditions: 11 | // The above copyright notice and this permission notice shall be included in 12 | // all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | // THE SOFTWARE. 21 | 22 | FfxFloat32x3 opAAddOneF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b) 23 | { 24 | d = a + ffxBroadcast3(b); 25 | return d; 26 | } 27 | 28 | FfxFloat32x3 opACpyF3(FfxFloat32x3 d, FfxFloat32x3 a) 29 | { 30 | d = a; 31 | return d; 32 | } 33 | 34 | FfxFloat32x3 opAMulF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32x3 b) 35 | { 36 | d = a * b; 37 | return d; 38 | } 39 | 40 | FfxFloat32x3 opAMulOneF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b) 41 | { 42 | d = a * ffxBroadcast3(b); 43 | return d; 44 | } 45 | 46 | FfxFloat32x3 opARcpF3(FfxFloat32x3 d, FfxFloat32x3 a) 47 | { 48 | d = rcp(a); 49 | return d; 50 | } 51 | -------------------------------------------------------------------------------- /src/common/GLTF/GltfHelpers.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #pragma once 21 | #include "../json/json.h" 22 | 23 | #include "../../libs/vectormath/vectormath.hpp" 24 | 25 | using json = nlohmann::json; 26 | 27 | int GetFormatSize(int id); 28 | int GetDimensions(const std::string &str); 29 | void SplitGltfAttribute(std::string attribute, std::string *semanticName, uint32_t *semanticIndex); 30 | 31 | math::Vector4 GetVector(const json::array_t &accessor); 32 | math::Matrix4 GetMatrix(const json::array_t &accessor); 33 | std::string GetElementString(const json::object_t &root, const char *path, std::string pDefault); 34 | float GetElementFloat(const json::object_t &root, const char *path, float pDefault); 35 | int GetElementInt(const json::object_t &root, const char *path, int pDefault); 36 | bool GetElementBoolean(const json::object_t &root, const char *path, bool pDefault); 37 | json::array_t GetElementJsonArray(const json::object_t &root, const char *path, json::array_t pDefault); 38 | math::Vector4 GetElementVector(json::object_t &root, const char *path, math::Vector4 default); 39 | 40 | -------------------------------------------------------------------------------- /src/common/GLTF/GltfPbrMaterial.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #pragma once 21 | #include "GltfHelpers.h" 22 | #include "Base/ShaderCompiler.h" 23 | 24 | struct PBRMaterialParametersConstantBuffer 25 | { 26 | math::Vector4 m_emissiveFactor; 27 | 28 | // pbrMetallicRoughness 29 | math::Vector4 m_baseColorFactor; 30 | math::Vector4 m_metallicRoughnessValues; 31 | 32 | // KHR_materials_pbrSpecularGlossiness 33 | math::Vector4 m_DiffuseFactor; 34 | math::Vector4 m_specularGlossinessFactor; 35 | }; 36 | 37 | 38 | struct PBRMaterialParameters 39 | { 40 | bool m_doubleSided = false; 41 | bool m_blending = false; 42 | 43 | DefineList m_defines; 44 | 45 | PBRMaterialParametersConstantBuffer m_params; 46 | }; 47 | 48 | 49 | // Read GLTF material and store it in our structure 50 | // 51 | void SetDefaultMaterialParamters(PBRMaterialParameters *pPbrMaterialParameters); 52 | void ProcessMaterials(const json::object_t &material, PBRMaterialParameters *tfmat, std::map &textureIds); 53 | bool DoesMaterialUseSemantic(DefineList &defines, const std::string semanticName); 54 | bool ProcessGetTextureIndexAndTextCoord(const json::object_t &material, const std::string &textureName, int *pIndex, int *pTexCoord); 55 | void GetSrgbAndCutOffOfImageGivenItsUse(int imageIndex, const json &materials, std::unordered_map const &textureToImage, bool *pSrgbOut, float *pCutoff); -------------------------------------------------------------------------------- /src/common/Icon/Cauldron_Common.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #include "winres.h" 11 | 12 | ///////////////////////////////////////////////////////////////////////////// 13 | #undef APSTUDIO_READONLY_SYMBOLS 14 | 15 | ///////////////////////////////////////////////////////////////////////////// 16 | // English (United States) resources 17 | 18 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 19 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 20 | #pragma code_page(1252) 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_ICON1 ICON "GPUOpenChip.ico" 56 | 57 | #endif // English (United States) resources 58 | ///////////////////////////////////////////////////////////////////////////// 59 | 60 | 61 | 62 | #ifndef APSTUDIO_INVOKED 63 | ///////////////////////////////////////////////////////////////////////////// 64 | // 65 | // Generated from the TEXTINCLUDE 3 resource. 66 | // 67 | 68 | 69 | ///////////////////////////////////////////////////////////////////////////// 70 | #endif // not APSTUDIO_INVOKED 71 | 72 | -------------------------------------------------------------------------------- /src/common/Icon/GPUOpenChip.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GPUOpen-LibrariesAndSDKs/Cauldron/b92d559bd083f44df9f8f42a6ad149c1584ae94c/src/common/Icon/GPUOpenChip.ico -------------------------------------------------------------------------------- /src/common/Icon/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Cauldron_Common.rc 4 | // 5 | #define IDI_ICON1 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /src/common/Misc/DDSLoader.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #pragma once 21 | #include 22 | #include "ImgLoader.h" 23 | 24 | //Loads a DDS file 25 | 26 | class DDSLoader : public ImgLoader 27 | { 28 | public: 29 | ~DDSLoader(); 30 | bool Load(const char *pFilename, float cutOff, IMG_INFO *pInfo); 31 | // after calling Load, calls to CopyPixels return each time a lower mip level 32 | void CopyPixels(void *pDest, uint32_t stride, uint32_t width, uint32_t height); 33 | private: 34 | HANDLE m_handle = INVALID_HANDLE_VALUE; 35 | }; 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/common/Misc/DxgiFormatHelper.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #pragma once 21 | #include 22 | 23 | // Return the BPP for a particular format 24 | size_t BitsPerPixel(DXGI_FORMAT fmt); 25 | size_t GetPixelByteSize(DXGI_FORMAT fmt); 26 | 27 | // Convert a *_SRGB format into a non-gamma one 28 | DXGI_FORMAT ConvertIntoNonGammaFormat(DXGI_FORMAT format); 29 | 30 | DXGI_FORMAT ConvertIntoGammaFormat(DXGI_FORMAT format); 31 | 32 | DXGI_FORMAT SetFormatGamma(DXGI_FORMAT format, bool addGamma); 33 | 34 | bool IsBCFormat(DXGI_FORMAT format); -------------------------------------------------------------------------------- /src/common/Misc/Error.cpp: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #include "stdafx.h" 21 | #include "Error.h" 22 | 23 | void ShowErrorMessageBox(LPCWSTR lpErrorString) 24 | { 25 | int msgboxID = MessageBoxW(NULL, lpErrorString, L"Error", MB_OK); 26 | } 27 | 28 | void ShowCustomErrorMessageBox(_In_opt_ LPCWSTR lpErrorString) 29 | { 30 | int msgboxID = MessageBoxW(NULL, lpErrorString, L"Error", MB_OK | MB_TOPMOST); 31 | } -------------------------------------------------------------------------------- /src/common/Misc/Error.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #pragma once 21 | #include "Misc.h" 22 | 23 | void ShowErrorMessageBox(LPCWSTR lpErrorString); 24 | void ShowCustomErrorMessageBox(_In_opt_ LPCWSTR lpErrorString); 25 | 26 | inline void ThrowIfFailed(HRESULT hr) 27 | { 28 | if (FAILED(hr)) 29 | { 30 | wchar_t err[256]; 31 | memset(err, 0, 256); 32 | FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), err, 255, NULL); 33 | char errA[256]; 34 | size_t returnSize; 35 | wcstombs_s(&returnSize, errA, 255, err, 255); 36 | Trace(errA); 37 | #ifdef _DEBUG 38 | ShowErrorMessageBox(err); 39 | #endif 40 | throw 1; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/common/Misc/Hash.cpp: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #include "Hash.h" 20 | 21 | // 22 | // Compute a hash of an array 23 | // 24 | size_t Hash(const void *ptr, size_t size, size_t result) 25 | { 26 | for (size_t i = 0; i < size; ++i) 27 | { 28 | result = (result * 16777619) ^ ((char *)ptr)[i]; 29 | } 30 | 31 | return result; 32 | } 33 | 34 | size_t HashString(const char *str, size_t result) 35 | { 36 | return Hash(str, strlen(str), result); 37 | } 38 | 39 | size_t HashString(const std::string &str, size_t result) 40 | { 41 | return HashString(str.c_str(), result); 42 | } 43 | 44 | size_t HashInt(const int type, size_t result) { return Hash(&type, sizeof(int), result); } 45 | size_t HashFloat(const float type, size_t result) { return Hash(&type, sizeof(float), result); } 46 | size_t HashPtr(const void *type, size_t result) { return Hash(&type, sizeof(void *), result); } -------------------------------------------------------------------------------- /src/common/Misc/Hash.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include 22 | 23 | #define HASH_SEED 2166136261 24 | 25 | size_t Hash(const void *ptr, size_t size, size_t result = HASH_SEED); 26 | size_t HashString(const char *str, size_t result = HASH_SEED); 27 | size_t HashString(const std::string &str, size_t result = HASH_SEED); 28 | size_t HashInt(const int type, size_t result = HASH_SEED); 29 | size_t HashFloat(const float type, size_t result = HASH_SEED); 30 | size_t HashPtr(const void *type, size_t result = HASH_SEED); 31 | 32 | -------------------------------------------------------------------------------- /src/common/Misc/ImgLoader.cpp: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #include "stdafx.h" 21 | #include "ImgLoader.h" 22 | #include "DDSLoader.h" 23 | #include "WICLoader.h" 24 | 25 | 26 | ImgLoader *CreateImageLoader(const char *pFilename) 27 | { 28 | // get the last 4 char (assuming this is the file extension) 29 | size_t len = strlen(pFilename); 30 | const char* ext = pFilename + (len - 4); 31 | if(_stricmp(ext, ".dds") == 0) 32 | { 33 | return new DDSLoader(); 34 | } 35 | else 36 | { 37 | return new WICLoader(); 38 | } 39 | } 40 | 41 | 42 | -------------------------------------------------------------------------------- /src/common/Misc/ImgLoader.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include 22 | 23 | struct IMG_INFO 24 | { 25 | UINT32 width; 26 | UINT32 height; 27 | UINT32 depth; 28 | UINT32 arraySize; 29 | UINT32 mipMapCount; 30 | DXGI_FORMAT format; 31 | UINT32 bitCount; 32 | }; 33 | 34 | //Loads a Image file 35 | 36 | class ImgLoader 37 | { 38 | public: 39 | virtual ~ImgLoader() {}; 40 | virtual bool Load(const char *pFilename, float cutOff, IMG_INFO *pInfo) = 0; 41 | // after calling Load, calls to CopyPixels return each time a lower mip level 42 | virtual void CopyPixels(void *pDest, uint32_t stride, uint32_t width, uint32_t height) = 0; 43 | }; 44 | 45 | 46 | ImgLoader *CreateImageLoader(const char *pFilename); 47 | 48 | 49 | -------------------------------------------------------------------------------- /src/common/Misc/WICLoader.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #pragma once 21 | #include "ImgLoader.h" 22 | 23 | // Loads a JPEGs, PNGs, BMPs and any image the Windows Imaging Component can load. 24 | // It even applies some alpha scaling to prevent cutouts to fade away when lower mips are used. 25 | 26 | class WICLoader : public ImgLoader 27 | { 28 | public: 29 | ~WICLoader(); 30 | bool Load(const char *pFilename, float cutOff, IMG_INFO *pInfo); 31 | // after calling Load, calls to CopyPixels return each time a lower mip level 32 | void CopyPixels(void *pDest, uint32_t stride, uint32_t width, uint32_t height); 33 | private: 34 | void MipImage(uint32_t width, uint32_t height); 35 | // scale alpha to prevent thinning when lower mips are used 36 | float GetAlphaCoverage(uint32_t width, uint32_t height, float scale, int cutoff) const; 37 | void ScaleAlpha(uint32_t width, uint32_t height, float scale); 38 | 39 | char *m_pData; 40 | 41 | float m_alphaTestCoverage; 42 | float m_cutOff; 43 | }; 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/common/Misc/WirePrimitive.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | void GenerateSphere(int sides, std::vector &outIndices, std::vector &outVertices); 22 | void GenerateBox(std::vector &outIndices, std::vector &outVertices); 23 | -------------------------------------------------------------------------------- /src/common/Misc/WirePrimitives.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | void GenerateSphere(int sides, std::vector &outIndices, std::vector &outVertices); 22 | void GenerateBox(std::vector &outIndices, std::vector &outVertices); 23 | -------------------------------------------------------------------------------- /src/common/Misc/threadpool.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | struct Task 29 | { 30 | std::function m_job; 31 | std::vector m_childtasks; 32 | }; 33 | 34 | class ThreadPool 35 | { 36 | public: 37 | ThreadPool(); 38 | ~ThreadPool(); 39 | void JobStealerLoop(); 40 | void AddJob(std::function New_Job); 41 | private: 42 | bool bExiting; 43 | int Num_Threads; 44 | int m_activeThreads = 0; 45 | std::vector Pool; 46 | std::deque Queue; 47 | std::condition_variable condition; 48 | std::mutex Queue_Mutex; 49 | }; 50 | 51 | 52 | ThreadPool *GetThreadPool(); 53 | 54 | 55 | -------------------------------------------------------------------------------- /src/common/base/Benchmark.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2017 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "../json/json.h" 22 | #include "../common/Misc/Camera.h" 23 | #include "../common/GLTF/GltfCommon.h" 24 | 25 | using json = nlohmann::json; 26 | 27 | struct TimeStamp 28 | { 29 | std::string m_label; 30 | float m_microseconds; 31 | }; 32 | 33 | void BenchmarkConfig(const json& benchmark, int cameraId, GLTFCommon *pGltfLoader, const std::string& deviceName = "not set", const std::string& driverVersion = "not set"); 34 | float BenchmarkLoop(const std::vector &timeStamps, Camera *pCam, std::string& outScreenShotName); 35 | -------------------------------------------------------------------------------- /src/common/base/DXCHelper.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "Base/ShaderCompiler.h" 22 | 23 | #include 24 | 25 | bool InitDirectXCompiler(); 26 | 27 | bool DXCompileToDXO(size_t hash, 28 | const char *pSrcCode, 29 | const DefineList* pDefines, 30 | const char *pEntryPoint, 31 | const char *pParams, 32 | char **outSpvData, 33 | size_t *outSpvSize); 34 | -------------------------------------------------------------------------------- /src/common/base/ImGuiHelper.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "../imgui/imgui.h" 22 | 23 | bool ImGUI_Init(void *hwnd); 24 | void ImGUI_Shutdown(); 25 | void ImGUI_UpdateIO(int w, int h); 26 | LRESULT ImGUI_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); 27 | 28 | -------------------------------------------------------------------------------- /src/common/base/Sequence.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2017 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #include "../json/json.h" 20 | #include "../common/Misc/Camera.h" 21 | #include "../common/GLTF/GltfCommon.h" 22 | 23 | using json = nlohmann::json; 24 | 25 | class BenchmarkSequence 26 | { 27 | public: 28 | struct KeyFrame 29 | { 30 | float m_time; 31 | int m_camera; 32 | math::Vector4 m_from, m_to; 33 | std::string m_screenShotName; 34 | }; 35 | 36 | void ReadKeyframes(const json& jSequence, float timeStart, float timeEnd); 37 | float GetTimeStart() { return m_timeStart; } 38 | float GetTimeEnd() { return m_timeEnd; } 39 | 40 | // 41 | // Given a time return the time of the next keyframe, that way we know how long we have to wait until we apply the next keyframe 42 | // 43 | float GetNextKeyTime(float time); 44 | const KeyFrame GetNextKeyFrame(float time) const; 45 | 46 | private: 47 | float m_timeStart; 48 | float m_timeEnd; 49 | 50 | std::vector m_keyFrames; 51 | }; 52 | -------------------------------------------------------------------------------- /src/common/base/ShaderCompiler.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | 21 | #include "../Misc/Misc.h" 22 | #include "../Misc/Hash.h" 23 | #include 24 | 25 | // 26 | // Hash a string of source code and recurse over its #include files 27 | // 28 | size_t HashShaderString(const char *pRootDir, const char *pShader, size_t result = 2166136261); 29 | 30 | // 31 | // DefineList, holds pairs of key & value that will be used by the compiler as defines 32 | // 33 | class DefineList : public std::map 34 | { 35 | public: 36 | bool Has(const std::string &str) const 37 | { 38 | return find(str) != end(); 39 | } 40 | 41 | size_t Hash(size_t result = HASH_SEED) const 42 | { 43 | for (auto it = begin(); it != end(); it++) 44 | { 45 | result = ::HashString(it->first, result); 46 | result = ::HashString(it->second, result); 47 | } 48 | return result; 49 | } 50 | 51 | friend DefineList operator+(DefineList def1, // passing lhs by value helps optimize chained a+b+c 52 | const DefineList & def2) // otherwise, both parameters may be const references 53 | { 54 | for (auto it = def2.begin(); it != def2.end(); it++) 55 | def1[it->first] = it->second; 56 | return def1; 57 | } 58 | }; 59 | -------------------------------------------------------------------------------- /src/common/base/ShaderCompilerCache.cpp: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | 20 | #include "stdafx.h" 21 | #include "ShaderCompilerCache.h" 22 | 23 | std::string s_shaderLibDir; 24 | std::string s_shaderCacheDir; 25 | 26 | bool InitShaderCompilerCache(const std::string shaderLibDir, std::string shaderCacheDir) 27 | { 28 | s_shaderLibDir = shaderLibDir; 29 | s_shaderCacheDir = shaderCacheDir; 30 | 31 | return true; 32 | } 33 | 34 | std::string GetShaderCompilerLibDir() 35 | { 36 | return s_shaderLibDir; 37 | } 38 | 39 | std::string GetShaderCompilerCacheDir() 40 | { 41 | return s_shaderCacheDir; 42 | } -------------------------------------------------------------------------------- /src/common/base/ShaderCompilerCache.h: -------------------------------------------------------------------------------- 1 | // AMD Cauldron code 2 | // 3 | // Copyright(c) 2020 Advanced Micro Devices, Inc.All rights reserved. 4 | // Permission is hereby granted, free of charge, to any person obtaining a copy 5 | // of this software and associated documentation files(the "Software"), to deal 6 | // in the Software without restriction, including without limitation the rights 7 | // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 8 | // copies of the Software, and to permit persons to whom the Software is 9 | // furnished to do so, subject to the following conditions : 10 | // The above copyright notice and this permission notice shall be included in 11 | // all copies or substantial portions of the Software. 12 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 14 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 15 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 16 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 17 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 18 | // THE SOFTWARE. 19 | #pragma once 20 | #include 21 | 22 | bool InitShaderCompilerCache(const std::string shaderLibDir, std::string shaderCacheDir); 23 | std::string GetShaderCompilerLibDir(); 24 | std::string GetShaderCompilerCacheDir(); -------------------------------------------------------------------------------- /src/common/readme.md: -------------------------------------------------------------------------------- 1 | Common 2 | ====== 3 | 4 | Here lives all the code that is common to the DX12 and VK backends 5 | 6 | ### Directory structure: 7 | 8 | Note that it it tries to follow the directory structure of the DX12/VK backends 9 | 10 | * **base**: 11 | * ShaderCompiler: generates a hash of shader code 12 | * **GLTF**: 13 | * GLTFStructures: all the structures needed by the GLTF specs 14 | * GLTFCommon: Loads, animates and transform the scene. The DX12/VK rendering passes will pick the data they need from this class. 15 | * **Misc** 16 | * Camera: The typical camera code 17 | * DDSLoader: loads DDS imges 18 | * WICLoader: loads other types of images(PNG,JPGs,...) and can generate mip maps 19 | * WirePrimitives 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/common/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | 10 | #define NOMINMAX 11 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 12 | 13 | // Windows Header Files: 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | // C RunTime Header Files 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | // math API 27 | #include 28 | using namespace DirectX; 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | 41 | 42 | // TODO: reference additional headers your program requires here 43 | --------------------------------------------------------------------------------