From 4596a34dfe1c7bf3e0a55c4322ee834e670b1619 Mon Sep 17 00:00:00 2001 From: Stephen Saunders Date: Sat, 3 Feb 2024 11:26:31 -0500 Subject: [PATCH] nvrhi rebase 013124 and shaderCompiler to ShaderMake migration changes --- neo/CMakeLists.txt | 6 + neo/compileshaders.cmake | 60 +++-- neo/renderer/NVRHI/RenderProgs_NVRHI.cpp | 56 ++++- neo/renderer/Passes/MipMapGenPass.cpp | 1 + .../SSGI/DeepGBufferRadiosity_blur.ps.hlsl | 2 +- neo/shaders/shaders.cfg | 238 +++++++++--------- neo/sys/DeviceManager.h | 2 + neo/sys/DeviceManager_VK.cpp | 10 +- 8 files changed, 213 insertions(+), 162 deletions(-) diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index a99f27d2..104f4513 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -441,6 +441,9 @@ set(NVRHI_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/nvrhi) add_subdirectory(${NVRHI_DIR}) add_definitions(-DUSE_NVRHI) +set(SHADERMAKE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extern/ShaderMake) +add_subdirectory(${SHADERMAKE_DIR}) + if(USE_DX11) find_package(FXC REQUIRED) endif() @@ -455,6 +458,7 @@ if(USE_VULKAN) endif() include_directories(${NVRHI_DIR}/include) +include_directories(${SHADERMAKE_DIR}/include) include_directories("libs/optick") @@ -1827,7 +1831,9 @@ endif() # needs to come after nvrhi_d3d11 etc. for link order target_link_libraries(RBDoom3BFG nvrhi) +target_link_libraries(RBDoom3BFG ShaderMakeBlob) add_subdirectory(shaders) +add_dependencies(Shaders ShaderMake) add_dependencies(RBDoom3BFG Shaders) diff --git a/neo/compileshaders.cmake b/neo/compileshaders.cmake index 87f8ee74..fcc78d3f 100644 --- a/neo/compileshaders.cmake +++ b/neo/compileshaders.cmake @@ -53,7 +53,7 @@ function(compile_shaders) set_source_files_properties(${params_SOURCES} PROPERTIES VS_TOOL_OVERRIDE "None") add_custom_target(${params_TARGET} - DEPENDS shaderCompiler + DEPENDS ShaderMake SOURCES ${params_SOURCES}) if (params_DXIL AND (USE_DX12 AND USE_DXIL_ON_DX12)) @@ -62,20 +62,21 @@ function(compile_shaders) endif() if (NOT params_CFLAGS) - set(CFLAGS "$,-Zi -Qembed_debug,-Qstrip_debug -Qstrip_reflect> -O3 -WX -Zpr") + set(CFLAGS $,--embedPDB,--stripReflection> --shaderModel=6_0 -O3 --WX --matrixRowMajor) else() set(CFLAGS ${params_CFLAGS}) endif() add_custom_command(TARGET ${params_TARGET} PRE_BUILD - COMMAND shaderCompiler - --infile ${params_CONFIG} - --parallel - --out ${params_DXIL} - --platform dxil - --cflags "${CFLAGS}" + COMMAND ShaderMake + --config=${params_CONFIG} + --out=${params_DXIL} + --platform=DXIL + --binaryBlob + --outputExt=.bin -I ${SHADER_INCLUDE_DIR} - --compiler ${DXC_DXIL_EXECUTABLE}) + ${CFLAGS} + --compiler=${DXC_DXIL_EXECUTABLE}) endif() if (params_DXBC AND (USE_DX11 OR (USE_DX12 AND NOT USE_DXIL_ON_DX12))) @@ -84,20 +85,21 @@ function(compile_shaders) endif() if (NOT params_CFLAGS) - set(CFLAGS "$,-Zi,-Qstrip_priv -Qstrip_debug -Qstrip_reflect> -O3 -WX -Zpr") + set(CFLAGS $,--PDB,--stripReflection> --shaderModel=6_0 -O3 --WX --matrixRowMajor) else() set(CFLAGS ${params_CFLAGS}) endif() add_custom_command(TARGET ${params_TARGET} PRE_BUILD - COMMAND shaderCompiler - --infile ${params_CONFIG} - --parallel - --out ${params_DXBC} - --platform dxbc - --cflags "${CFLAGS}" + COMMAND ShaderMake + --config=${params_CONFIG} + --out=${params_DXBC} + --platform=DXBC + --binaryBlob + --outputExt=.bin -I ${SHADER_INCLUDE_DIR} - --compiler ${FXC_EXECUTABLE}) + ${CFLAGS} + --compiler=${FXC_EXECUTABLE}) endif() if (params_SPIRV_DXC AND USE_VULKAN) @@ -106,28 +108,22 @@ function(compile_shaders) endif() if (NOT params_CFLAGS) - set(CFLAGS "$,-Zi,> -fspv-target-env=vulkan1.2 -O3 -WX -Zpr") + set(CFLAGS $,--PDB,> --vulkanVersion=1.2 --shaderModel=6_0 -O3 --WX --matrixRowMajor --tRegShift=0 --sRegShift=128 --bRegShift=256 --uRegShift=384) else() set(CFLAGS ${params_CFLAGS}) endif() - # SRS - Parallel shader compilation sometimes fails, disable for now until issue is resolved - if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set(PARALLEL_SHADERS "") - else() - set(PARALLEL_SHADERS "--parallel") - endif() - add_custom_command(TARGET ${params_TARGET} PRE_BUILD - COMMAND shaderCompiler - --infile ${params_CONFIG} - ${PARALLEL_SHADERS} - --out ${params_SPIRV_DXC} - --platform spirv + COMMAND ShaderMake + --config=${params_CONFIG} + --out=${params_SPIRV_DXC} + --platform=SPIRV + --binaryBlob + --outputExt=.bin -I ${SHADER_INCLUDE_DIR} -D SPIRV - --cflags "${CFLAGS}" - --compiler ${DXC_SPIRV_EXECUTABLE}) + ${CFLAGS} + --compiler=${DXC_SPIRV_EXECUTABLE}) endif() if(params_FOLDER) diff --git a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp index facf8069..6805b951 100644 --- a/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp +++ b/neo/renderer/NVRHI/RenderProgs_NVRHI.cpp @@ -32,7 +32,7 @@ If you have questions concerning this license or the applicable additional terms #pragma hdrstop #include "../RenderCommon.h" -#include "nvrhi/common/shader-blob.h" +#include #include @@ -88,6 +88,52 @@ void idRenderProgManager::LoadShader( int index, rpStage_t stage ) extern DeviceManager* deviceManager; +/* +================================================================================================ + createShaderPermutation + + * Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * +================================================================================================ +*/ +nvrhi::ShaderHandle createShaderPermutation( nvrhi::IDevice* device, const nvrhi::ShaderDesc& d, const void* blob, size_t blobSize, + const ShaderMake::ShaderConstant* constants, uint32_t numConstants, bool errorIfNotFound = true ) +{ + const void* binary = nullptr; + size_t binarySize = 0; + + if( ShaderMake::FindPermutationInBlob( blob, blobSize, constants, numConstants, &binary, &binarySize ) ) + { + return device->createShader( d, binary, binarySize ); + } + + if( errorIfNotFound ) + { + std::string message = ShaderMake::FormatShaderNotFoundMessage( blob, blobSize, constants, numConstants ); + device->getMessageCallback()->message( nvrhi::MessageSeverity::Error, message.c_str() ); + } + + return nullptr; +} + /* ================================================================================================ idRenderProgManager::LoadGLSLShader @@ -136,11 +182,11 @@ void idRenderProgManager::LoadShader( shader_t& shader ) return; } - idList constants; + idList constants; for( int i = 0; i < shader.macros.Num(); i++ ) { - constants.Append( nvrhi::ShaderConstant + constants.Append( ShaderMake::ShaderConstant { shader.macros[i].name.c_str(), shader.macros[i].definition.c_str() @@ -154,9 +200,9 @@ void idRenderProgManager::LoadShader( shader_t& shader ) // TODO(Stephen): Might not want to hard-code this. descCopy.entryName = "main"; - nvrhi::ShaderConstant* shaderConstant( nullptr ); + ShaderMake::ShaderConstant* shaderConstant( nullptr ); - nvrhi::ShaderHandle shaderHandle = nvrhi::createShaderPermutation( device, descCopy, shaderBlob.data, shaderBlob.size, + nvrhi::ShaderHandle shaderHandle = createShaderPermutation( device, descCopy, shaderBlob.data, shaderBlob.size, ( constants.Num() > 0 ) ? &constants[0] : shaderConstant, uint32_t( constants.Num() ) ); shader.handle = shaderHandle; diff --git a/neo/renderer/Passes/MipMapGenPass.cpp b/neo/renderer/Passes/MipMapGenPass.cpp index 50091f29..d534c1f9 100644 --- a/neo/renderer/Passes/MipMapGenPass.cpp +++ b/neo/renderer/Passes/MipMapGenPass.cpp @@ -69,6 +69,7 @@ static nvrhi::TextureHandle createNullTexture( nvrhi::DeviceHandle device ) desc.useClearValue = false; desc.sampleCount = 1; desc.dimension = nvrhi::TextureDimension::Texture2D; + desc.initialState = nvrhi::ResourceStates::UnorderedAccess; desc.keepInitialState = true; desc.arraySize = 1; desc.isUAV = true; diff --git a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl index ee379ec0..07ae4927 100644 --- a/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl +++ b/neo/shaders/builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl @@ -107,7 +107,7 @@ float3 sampleNormal( Texture2D normalBuffer, int2 ssC, int mipLevel ) /** Used for preventing AO computation on the sky (at infinite depth) and defining the CS Z to bilateral depth key scaling. This need not match the real far plane but should not be much more than it.*/ -const float FAR_PLANE_Z = -16000.0; +static const float FAR_PLANE_Z = -16000.0; float CSZToKey( float z ) { diff --git a/neo/shaders/shaders.cfg b/neo/shaders/shaders.cfg index 2e74f58d..d50525bc 100644 --- a/neo/shaders/shaders.cfg +++ b/neo/shaders/shaders.cfg @@ -1,132 +1,132 @@ -## Note: A lot of the defines for a vertex shader are there just to -## satisfy the requirement in the engine. In the future, we can -## remove these if we load the shaders as separate units instead of as -## packaged programs. +// Note: A lot of the defines for a vertex shader are there just to +// satisfy the requirement in the engine. In the future, we can +// remove these if we load the shaders as separate units instead of as +// packaged programs. -builtin/debug/lightgrid.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/debug/lightgrid.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/debug/octahedron.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/debug/octahedron.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/debug/debug_shadowmap.vs.hlsl -T vs_5_0 -builtin/debug/debug_shadowmap.ps.hlsl -T ps_5_0 +builtin/debug/lightgrid.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +builtin/debug/lightgrid.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +builtin/debug/octahedron.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +builtin/debug/octahedron.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +builtin/debug/debug_shadowmap.vs.hlsl -T vs +builtin/debug/debug_shadowmap.ps.hlsl -T ps -builtin/gui.vs.hlsl -T vs_5_0 -builtin/gui.ps.hlsl -T ps_5_0 -builtin/color.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/color.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/vertex_color.vs.hlsl -T vs_5_0 -builtin/vertex_color.ps.hlsl -T ps_5_0 -builtin/texture_color.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_SRGB={0,1} -builtin/texture_color.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_SRGB={0,1} -builtin/texture_color_texgen.vs.hlsl -T vs_5_0 -builtin/texture_color_texgen.ps.hlsl -T ps_5_0 -builtin/texture.vs.hlsl -T vs_5_0 -builtin/texture.ps.hlsl -T ps_5_0 -builtin/gbuffer.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -builtin/gbuffer.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -builtin/depth.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/depth.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/blit.ps.hlsl -T ps_5_0 -D TEXTURE_ARRAY={0,1} -builtin/rect.vs.hlsl -T vs_5_0 +builtin/gui.vs.hlsl -T vs +builtin/gui.ps.hlsl -T ps +builtin/color.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +builtin/color.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +builtin/vertex_color.vs.hlsl -T vs +builtin/vertex_color.ps.hlsl -T ps +builtin/texture_color.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} -D USE_SRGB={0,1} +builtin/texture_color.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} -D USE_SRGB={0,1} +builtin/texture_color_texgen.vs.hlsl -T vs +builtin/texture_color_texgen.ps.hlsl -T ps +builtin/texture.vs.hlsl -T vs +builtin/texture.ps.hlsl -T ps +builtin/gbuffer.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} -D USE_NORMAL_FMT_RGB8={0,1} +builtin/gbuffer.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} -D USE_NORMAL_FMT_RGB8={0,1} +builtin/depth.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +builtin/depth.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +builtin/blit.ps.hlsl -T ps -D TEXTURE_ARRAY={0,1} +builtin/rect.vs.hlsl -T vs -builtin/legacy/environment.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/legacy/environment.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/legacy/bumpyenvironment.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/legacy/bumpyenvironment.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/legacy/skybox.vs.hlsl -T vs_5_0 -builtin/legacy/skybox.ps.hlsl -T ps_5_0 -builtin/legacy/wobblesky.vs.hlsl -T vs_5_0 -builtin/legacy/wobblesky.ps.hlsl -T ps_5_0 +builtin/legacy/environment.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +builtin/legacy/environment.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +builtin/legacy/bumpyenvironment.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +builtin/legacy/bumpyenvironment.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +builtin/legacy/skybox.vs.hlsl -T vs +builtin/legacy/skybox.ps.hlsl -T ps +builtin/legacy/wobblesky.vs.hlsl -T vs +builtin/legacy/wobblesky.ps.hlsl -T ps -builtin/lighting/ambient_lighting_IBL.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/ambient_lighting_IBL.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/ambient_lightgrid_IBL.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/ambient_lightgrid_IBL.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/interaction.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/interaction.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/interactionAmbient.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/interactionAmbient.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} -builtin/lighting/interactionSM.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_SHADOW_ATLAS={0,1} -builtin/lighting/interactionSM.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_SHADOW_ATLAS={0,1} +builtin/lighting/ambient_lighting_IBL.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} +builtin/lighting/ambient_lighting_IBL.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} +builtin/lighting/ambient_lightgrid_IBL.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} +builtin/lighting/ambient_lightgrid_IBL.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} +builtin/lighting/interaction.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} +builtin/lighting/interaction.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} +builtin/lighting/interactionAmbient.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} +builtin/lighting/interactionAmbient.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} -D USE_PBR={0,1} +builtin/lighting/interactionSM.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_SHADOW_ATLAS={0,1} +builtin/lighting/interactionSM.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} -D LIGHT_POINT={0,1} -D LIGHT_PARALLEL={0,1} -D USE_PBR={0,1} -D USE_NORMAL_FMT_RGB8={0,1} -D USE_SHADOW_ATLAS={0,1} -builtin/post/postprocess.vs.hlsl -T vs_5_0 -builtin/post/postprocess.ps.hlsl -T ps_5_0 -builtin/post/screen.vs.hlsl -T vs_5_0 -builtin/post/screen.ps.hlsl -T ps_5_0 -builtin/post/tonemap.vs.hlsl -T vs_5_0 -D BRIGHTPASS={0,1} -D HDR_DEBUG={0,1} -builtin/post/tonemap.ps.hlsl -T ps_5_0 -D BRIGHTPASS={0,1} -D HDR_DEBUG={0,1} -builtin/post/hdr_glare_chromatic.vs.hlsl -T vs_5_0 -builtin/post/hdr_glare_chromatic.ps.hlsl -T ps_5_0 -builtin/post/SMAA_edge_detection.vs.hlsl -T vs_5_0 -builtin/post/SMAA_edge_detection.ps.hlsl -T ps_5_0 -builtin/post/SMAA_blending_weight_calc.vs.hlsl -T vs_5_0 -builtin/post/SMAA_blending_weight_calc.ps.hlsl -T ps_5_0 -builtin/post/SMAA_final.vs.hlsl -T vs_5_0 -builtin/post/SMAA_final.ps.hlsl -T ps_5_0 -builtin/post/motionBlur.vs.hlsl -T vs_5_0 -D VECTORS_ONLY={0,1} -builtin/post/motionBlur.ps.hlsl -T ps_5_0 -D VECTORS_ONLY={0,1} -builtin/post/exposure.cs.hlsl -T cs_5_0 -D HISTOGRAM_BINS=256 -builtin/post/histogram.cs.hlsl -T cs_5_0 -D HISTOGRAM_BINS=256 -D SOURCE_ARRAY={0,1} -builtin/post/tonemapping.ps.hlsl -T ps_5_0 -D HISTOGRAM_BINS=256 -D SOURCE_ARRAY={0,1} -D QUAD_Z={0,1} -builtin/post/tonemapping.vs.hlsl -T vs_5_0 -D HISTOGRAM_BINS=256 -D SOURCE_ARRAY={0,1} -D QUAD_Z={0,1} -builtin/post/taa.cs.hlsl -T cs_5_0 -D SAMPLE_COUNT={1,2,4,8} -D USE_CATMULL_ROM_FILTER={0,1} +builtin/post/postprocess.vs.hlsl -T vs +builtin/post/postprocess.ps.hlsl -T ps +builtin/post/screen.vs.hlsl -T vs +builtin/post/screen.ps.hlsl -T ps +builtin/post/tonemap.vs.hlsl -T vs -D BRIGHTPASS={0,1} -D HDR_DEBUG={0,1} +builtin/post/tonemap.ps.hlsl -T ps -D BRIGHTPASS={0,1} -D HDR_DEBUG={0,1} +builtin/post/hdr_glare_chromatic.vs.hlsl -T vs +builtin/post/hdr_glare_chromatic.ps.hlsl -T ps +builtin/post/SMAA_edge_detection.vs.hlsl -T vs +builtin/post/SMAA_edge_detection.ps.hlsl -T ps +builtin/post/SMAA_blending_weight_calc.vs.hlsl -T vs +builtin/post/SMAA_blending_weight_calc.ps.hlsl -T ps +builtin/post/SMAA_final.vs.hlsl -T vs +builtin/post/SMAA_final.ps.hlsl -T ps +builtin/post/motionBlur.vs.hlsl -T vs -D VECTORS_ONLY={0,1} +builtin/post/motionBlur.ps.hlsl -T ps -D VECTORS_ONLY={0,1} +builtin/post/exposure.cs.hlsl -T cs -D HISTOGRAM_BINS=256 +builtin/post/histogram.cs.hlsl -T cs -D HISTOGRAM_BINS=256 -D SOURCE_ARRAY={0,1} +builtin/post/tonemapping.ps.hlsl -T ps -D HISTOGRAM_BINS=256 -D SOURCE_ARRAY={0,1} -D QUAD_Z={0,1} +builtin/post/tonemapping.vs.hlsl -T vs -D HISTOGRAM_BINS=256 -D SOURCE_ARRAY={0,1} -D QUAD_Z={0,1} +builtin/post/taa.cs.hlsl -T cs -D SAMPLE_COUNT={1,2,4,8} -D USE_CATMULL_ROM_FILTER={0,1} -builtin/SSAO/AmbientOcclusion_AO.vs.hlsl -T vs_5_0 -D BRIGHTPASS={0,1} -builtin/SSAO/AmbientOcclusion_AO.ps.hlsl -T ps_5_0 -D BRIGHTPASS={0,1} -builtin/SSAO/AmbientOcclusion_blur.vs.hlsl -T vs_5_0 -D BRIGHTPASS={0,1} -builtin/SSAO/AmbientOcclusion_blur.ps.hlsl -T ps_5_0 -D BRIGHTPASS={0,1} +builtin/SSAO/AmbientOcclusion_AO.vs.hlsl -T vs -D BRIGHTPASS={0,1} +builtin/SSAO/AmbientOcclusion_AO.ps.hlsl -T ps -D BRIGHTPASS={0,1} +builtin/SSAO/AmbientOcclusion_blur.vs.hlsl -T vs -D BRIGHTPASS={0,1} +builtin/SSAO/AmbientOcclusion_blur.ps.hlsl -T ps -D BRIGHTPASS={0,1} -builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl -T vs_5_0 -builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl -T ps_5_0 -builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl -T vs_5_0 -builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl -T ps_5_0 +builtin/SSGI/DeepGBufferRadiosity_blur.vs.hlsl -T vs +builtin/SSGI/DeepGBufferRadiosity_blur.ps.hlsl -T ps +builtin/SSGI/DeepGBufferRadiosity_radiosity.vs.hlsl -T vs +builtin/SSGI/DeepGBufferRadiosity_radiosity.ps.hlsl -T ps -builtin/fog/blendLight.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/fog/blendLight.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -builtin/fog/fog.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -builtin/fog/fog.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} +builtin/fog/blendLight.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +builtin/fog/blendLight.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +builtin/fog/fog.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +builtin/fog/fog.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} -builtin/video/bink.vs.hlsl -T vs_5_0 -D USE_SRGB={0,1} -builtin/video/bink.ps.hlsl -T ps_5_0 -D USE_SRGB={0,1} -builtin/video/bink_gui.vs.hlsl -T vs_5_0 -builtin/video/bink_gui.ps.hlsl -T ps_5_0 +builtin/video/bink.vs.hlsl -T vs -D USE_SRGB={0,1} +builtin/video/bink.ps.hlsl -T ps -D USE_SRGB={0,1} +builtin/video/bink_gui.vs.hlsl -T vs +builtin/video/bink_gui.ps.hlsl -T ps -builtin/VR/stereoDeGhost.vs.hlsl -T vs_5_0 -builtin/VR/stereoDeGhost.ps.hlsl -T ps_5_0 -builtin/VR/stereoInterlace.vs.hlsl -T vs_5_0 -builtin/VR/stereoInterlace.ps.hlsl -T ps_5_0 -builtin/VR/stereoWarp.vs.hlsl -T vs_5_0 -builtin/VR/stereoWarp.ps.hlsl -T ps_5_0 +builtin/VR/stereoDeGhost.vs.hlsl -T vs +builtin/VR/stereoDeGhost.ps.hlsl -T ps +builtin/VR/stereoInterlace.vs.hlsl -T vs +builtin/VR/stereoInterlace.ps.hlsl -T ps +builtin/VR/stereoWarp.vs.hlsl -T vs +builtin/VR/stereoWarp.ps.hlsl -T ps -# Compute shaders -builtin/mipmapgen.cs.hlsl -T cs_5_0 -D MODE={0,1,2,3} -builtin/SSAO/ssao_blur.cs.hlsl -T cs_5_0 -D DIRECTIONAL_OCCLUSION={0,1} -builtin/SSAO/ssao_compute.cs.hlsl -T cs_5_0 -D OCT_ENCODED_NORMALS={0,1} -D DIRECTIONAL_OCCLUSION={0,1} -builtin/SSAO/ssao_deinterleave.cs.hlsl -T cs_5_0 -D LINEAR_DEPTH={0,1} +// Compute shaders +builtin/mipmapgen.cs.hlsl -T cs -D MODE={0,1,2,3} +builtin/SSAO/ssao_blur.cs.hlsl -T cs -D DIRECTIONAL_OCCLUSION={0,1} +builtin/SSAO/ssao_compute.cs.hlsl -T cs -D OCT_ENCODED_NORMALS={0,1} -D DIRECTIONAL_OCCLUSION={0,1} +builtin/SSAO/ssao_deinterleave.cs.hlsl -T cs -D LINEAR_DEPTH={0,1} -# User shaders -bloodorb_draw.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb_draw.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb1_capture.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb1_capture.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb2_capture.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb2_capture.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb3_capture.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -bloodorb3_capture.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -colorProcess.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -colorProcess.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -enviroSuit.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -enviroSuit.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -fogwithlights.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -fogwithlights.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -heathaze.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -heathaze.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -heatHazeWithMask.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -heatHazeWithMask.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -heatHazeWithMaskAndVertex.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -heatHazeWithMaskAndVertex.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -mattiascrt.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -mattiascrt.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} -vornoipattern.vs.hlsl -T vs_5_0 -D USE_GPU_SKINNING={0,1} -vornoipattern.ps.hlsl -T ps_5_0 -D USE_GPU_SKINNING={0,1} \ No newline at end of file +// User shaders +bloodorb_draw.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +bloodorb_draw.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +bloodorb1_capture.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +bloodorb1_capture.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +bloodorb2_capture.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +bloodorb2_capture.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +bloodorb3_capture.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +bloodorb3_capture.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +colorProcess.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +colorProcess.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +enviroSuit.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +enviroSuit.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +fogwithlights.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +fogwithlights.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +heathaze.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +heathaze.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +heatHazeWithMask.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +heatHazeWithMask.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +heatHazeWithMaskAndVertex.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +heatHazeWithMaskAndVertex.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +mattiascrt.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +mattiascrt.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} +vornoipattern.vs.hlsl -T vs -D USE_GPU_SKINNING={0,1} +vornoipattern.ps.hlsl -T ps -D USE_GPU_SKINNING={0,1} diff --git a/neo/sys/DeviceManager.h b/neo/sys/DeviceManager.h index 7cfd8e34..0875e1cc 100644 --- a/neo/sys/DeviceManager.h +++ b/neo/sys/DeviceManager.h @@ -41,6 +41,8 @@ #if USE_VK #include + #define VULKAN_HPP_DISPATCH_LOADER_DYNAMIC 1 + #include #endif struct DeviceCreationParameters diff --git a/neo/sys/DeviceManager_VK.cpp b/neo/sys/DeviceManager_VK.cpp index 98135277..e4a9670c 100644 --- a/neo/sys/DeviceManager_VK.cpp +++ b/neo/sys/DeviceManager_VK.cpp @@ -480,7 +480,7 @@ bool DeviceManager_VK::createInstance() const vk::Result res = vk::createInstance( &info, nullptr, &m_VulkanInstance ); if( res != vk::Result::eSuccess ) { - common->FatalError( "Failed to create a Vulkan instance, error code = %s", nvrhi::vulkan::resultToString( res ) ); + common->FatalError( "Failed to create a Vulkan instance, error code = %s", nvrhi::vulkan::resultToString( ( VkResult )res ) ); return false; } @@ -505,7 +505,7 @@ void DeviceManager_VK::installDebugCallback() bool DeviceManager_VK::pickPhysicalDevice() { - vk::Format requestedFormat = nvrhi::vulkan::convertFormat( m_DeviceParams.swapChainFormat ); + vk::Format requestedFormat = vk::Format( nvrhi::vulkan::convertFormat( m_DeviceParams.swapChainFormat ) ); vk::Extent2D requestedExtent( m_DeviceParams.backBufferWidth, m_DeviceParams.backBufferHeight ); auto devices = m_VulkanInstance.enumeratePhysicalDevices(); @@ -891,7 +891,7 @@ bool DeviceManager_VK::createDevice() const vk::Result res = m_VulkanPhysicalDevice.createDevice( &deviceDesc, nullptr, &m_VulkanDevice ); if( res != vk::Result::eSuccess ) { - common->FatalError( "Failed to create a Vulkan physical device, error code = %s", nvrhi::vulkan::resultToString( res ) ); + common->FatalError( "Failed to create a Vulkan physical device, error code = %s", nvrhi::vulkan::resultToString( ( VkResult )res ) ); return false; } @@ -974,7 +974,7 @@ bool DeviceManager_VK::createWindowSurface() if( res != vk::Result::eSuccess ) { - common->FatalError( "Failed to create a Vulkan window surface, error code = %s", nvrhi::vulkan::resultToString( res ) ); + common->FatalError( "Failed to create a Vulkan window surface, error code = %s", nvrhi::vulkan::resultToString( ( VkResult )res ) ); return false; } @@ -1063,7 +1063,7 @@ bool DeviceManager_VK::createSwapChain() const vk::Result res = m_VulkanDevice.createSwapchainKHR( &desc, nullptr, &m_SwapChain ); if( res != vk::Result::eSuccess ) { - common->FatalError( "Failed to create a Vulkan swap chain, error code = %s", nvrhi::vulkan::resultToString( res ) ); + common->FatalError( "Failed to create a Vulkan swap chain, error code = %s", nvrhi::vulkan::resultToString( ( VkResult )res ) ); return false; }