Skip to content

Commit

Permalink
shaders are in their own folder now
Browse files Browse the repository at this point in the history
  • Loading branch information
hakasapl committed Jul 23, 2024
1 parent b5864d6 commit 1219323
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 5 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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} $<IF:$<CONFIG:DEBUG>,/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} $<IF:$<CONFIG:DEBUG>,/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}
Expand All @@ -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 . )
2 changes: 1 addition & 1 deletion src/ParallaxGenD3D/ParallaxGenD3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void ParallaxGenD3D::initShaders()
}

vector<char> 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);
Expand Down

0 comments on commit 1219323

Please sign in to comment.