From 12193230655b02666e348d053c1e0947473260a2 Mon Sep 17 00:00:00 2001 From: hakasapl Date: Tue, 23 Jul 2024 00:32:46 -0400 Subject: [PATCH] shaders are in their own folder now --- CHANGELOG.md | 2 ++ CMakeLists.txt | 7 +++++-- src/ParallaxGenD3D/ParallaxGenD3D.cpp | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e091890..b3bba6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - Fixed non ASCII characters in loose file extension causing crashes - Added global exception handler w/ stack trace +- Dynamic cubemaps overwrite oold cubemap value for CM meshes now +- Shaders are in their own folder now ## [0.4.3] - 2024-07-22 diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fb80c8..42c75a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,8 @@ set(HLSL_COMPUTE_SHADER_FILES shaders/MergeToComplexMaterial.hlsl ) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/shaders) + set_source_files_properties(${HLSL_COMPUTE_SHADER_FILES} PROPERTIES ShaderType "cs") set_source_files_properties(${HLSL_COMPUTE_SHADER_FILES} PROPERTIES ShaderModel "5_0") @@ -127,7 +129,7 @@ foreach(FILE ${HLSL_COMPUTE_SHADER_FILES}) get_source_file_property(shadertype ${FILE} ShaderType) get_source_file_property(shadermodel ${FILE} ShaderModel) add_custom_command(TARGET shaders - COMMAND fxc.exe /nologo /Emain /T${shadertype}_${shadermodel} $,/Od,/O1> /Zi /Fo ${CMAKE_BINARY_DIR}/${FILE_WE}.cso /Fd ${CMAKE_BINARY_DIR}/${FILE_WE}.pdb ${FILE} + COMMAND fxc.exe /nologo /Emain /T${shadertype}_${shadermodel} $,/Od,/O1> /Zi /Fo ${CMAKE_BINARY_DIR}/shaders/${FILE_WE}.cso /Fd ${CMAKE_BINARY_DIR}/shaders/${FILE_WE}.pdb ${FILE} MAIN_DEPENDENCY ${FILE} COMMENT "HLSL ${FILE}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -148,7 +150,8 @@ install(FILES ${CMAKE_BINARY_DIR}/lz4.dll DESTINATION . ) install(FILES ${CMAKE_BINARY_DIR}/zlib1.dll DESTINATION . ) # Copy compiled shaders to install -install(FILES ${CMAKE_BINARY_DIR}/MergeToComplexMaterial.cso DESTINATION . ) +file(GLOB CSO_FILES "${CMAKE_BINARY_DIR}/shaders/*.cso") +install(FILES ${CSO_FILES} DESTINATION ./shaders/ ) # Copy assets to install install(DIRECTORY ${CMAKE_BINARY_DIR}/assets DESTINATION . ) diff --git a/src/ParallaxGenD3D/ParallaxGenD3D.cpp b/src/ParallaxGenD3D/ParallaxGenD3D.cpp index 0ae18ea..0bbbd65 100644 --- a/src/ParallaxGenD3D/ParallaxGenD3D.cpp +++ b/src/ParallaxGenD3D/ParallaxGenD3D.cpp @@ -87,7 +87,7 @@ void ParallaxGenD3D::initShaders() } vector ParallaxGenD3D::loadCompiledShader(const std::filesystem::path& filename) { - ifstream shaderFile(filename, ios::binary); + ifstream shaderFile("shaders" / filename, ios::binary); if (!shaderFile) { spdlog::critical(L"Failed to load shader file {}", filename.wstring()); ParallaxGenUtil::exitWithUserInput(1);