Skip to content

Commit f018086

Browse files
committed
Ship shaders with binaries
1 parent d39619f commit f018086

File tree

8 files changed

+18
-43
lines changed

8 files changed

+18
-43
lines changed

CHANGELOG.md

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,3 @@
11
# Changes
22

3-
- rayx-core:
4-
- Added optical elements
5-
- Paraboloid
6-
- Added light sources
7-
- Simple Undulator
8-
- Pixel Source
9-
- Dipole Source
10-
- Improved code consistency for optical elements and light sources
11-
- Improved test suite
12-
- Fixes for RZP tracing
13-
- rayx:
14-
- Added more options to customize the export of rays and speed up the tracing
15-
- Added option to choose GPU
16-
- Improved runtime by optimizing data handling
17-
- rayx-ui:
18-
- Added orthographic camera
19-
- Added footprints/heatmaps/histograms for simple optical elements
20-
- Changed default camera position and orientation
21-
- Jump to light source is possible now
22-
- Correctly render slits
23-
- Fixed positioning of light sources
24-
- Fixed triangulation bugs
25-
- Fixed general rendering bugs
26-
- General bugfixes and documentation updates
3+
- Fixing shader distribution with binaries

Intern/rayx-core/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ if(Vulkan_FOUND)
123123
# This is most likely not an optimal solution, but it will work
124124
# until we find a better one.
125125
add_dependencies(${PROJECT_NAME} RAYX_CORE_COMPILE_SHADER)
126-
set(RAYX_CORE_SHADER ${CMAKE_BINARY_DIR}/bin/comp.spv)
126+
set(RAYX_CORE_SHADER ${CMAKE_BINARY_DIR}/bin/shaders/comp.spv)
127127
set(RAYX_CORE_SHADER_FAKE ${CMAKE_BINARY_DIR}/bin/___comp.spv) # this exists so file cannot be found -> always execute command
128128

129129
add_custom_command(

Intern/rayx-core/src/Tracer/VulkanTracer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void VulkanTracer::initEngine() {
100100
#ifdef RAYX_DEBUG_MODE
101101
m_engine.declareBuffer("debug-buffer", {.binding = 6, .isInput = false, .isOutput = true});
102102
#endif
103-
m_engine.init({.shaderFileName = "build/bin/comp.spv", .deviceID = m_deviceID});
103+
m_engine.init({.shaderFileName = "build/bin/shaders/comp.spv", .deviceID = m_deviceID});
104104
}
105105
} // namespace RAYX
106106

Intern/rayx-ui/CMakeLists.txt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,19 @@ if(Vulkan_FOUND)
3232
target_compile_definitions(${PROJECT_NAME} PRIVATE
3333
GLM_FORCE_RADIANS
3434
GLM_FORCE_DEPTH_ZERO_TO_ONE)
35+
# -----------------
3536

36-
# ---- Install ----
37-
38-
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
3937

4038
# ---- CPack ----
41-
39+
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
40+
install(DIRECTORY ${CMAKE_BINARY_DIR}/bin/shaders
41+
DESTINATION ./
42+
FILES_MATCHING PATTERN "*_*.spv")
4243
include(InstallRequiredSystemLibraries)
43-
4444
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../../LICENSE")
4545
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
4646
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "rayx-ui - RAYX GUI Application")
47-
4847
include(CPack)
49-
5048
# -----------------
5149

5250
# ---- GLFW Options ----
@@ -55,7 +53,6 @@ if(Vulkan_FOUND)
5553
option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF)
5654
option(GLFW_INSTALL "Generate installation target" OFF)
5755
option(GLFW_DOCUMENT_INTERNALS "Include internals in documentation" OFF)
58-
5956
# ----------------------
6057

6158
# ---- Dependencies ----
@@ -69,7 +66,6 @@ if(Vulkan_FOUND)
6966
${STB_DIR}
7067
..
7168
)
72-
7369
# ----------------------
7470

7571
# ---- Compile Shaders ----
@@ -87,7 +83,7 @@ if(Vulkan_FOUND)
8783
string(SUBSTRING ${SHADER_EXT} 1 -1 SHADER_STAGE) # Remove the leading '.' from the extension
8884

8985
# Set output file name
90-
set(OUTPUT_FILE "${CMAKE_BINARY_DIR}/bin/${SHADER_NAME}_${SHADER_STAGE}.spv")
86+
set(OUTPUT_FILE "${CMAKE_BINARY_DIR}/bin/shaders/${SHADER_NAME}_${SHADER_STAGE}.spv")
9187

9288
# Create a custom command for each shader file
9389
add_custom_command(
@@ -108,6 +104,5 @@ if(Vulkan_FOUND)
108104

109105
# Call the function to compile all shaders in the specified directory
110106
compile_shaders(RAYX_UI_COMPILE_SHADER "${PROJECT_SOURCE_DIR}/src/Shaders")
111-
112107
# ------------------------
113108
endif() # Vulkan_FOUND

Intern/rayx-ui/src/RenderSystem/GridRenderSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ void GridRenderSystem::createPipeline(VkRenderPass renderPass) {
4949
pipelineConfig.depthStencilInfo.depthCompareOp = VK_COMPARE_OP_LESS_OR_EQUAL;
5050

5151
// Use the grid-specific shaders
52-
const std::string vertexShader = RAYX::canonicalizeRepositoryPath("build/bin/grid_shader_vert.spv").string();
53-
const std::string fragmentShader = RAYX::canonicalizeRepositoryPath("build/bin/grid_shader_frag.spv").string();
52+
const std::string vertexShader = RAYX::canonicalizeRepositoryPath("build/bin/shaders/grid_shader_vert.spv").string();
53+
const std::string fragmentShader = RAYX::canonicalizeRepositoryPath("build/bin/shaders/grid_shader_frag.spv").string();
5454
m_Pipeline = std::make_unique<GraphicsPipeline>(m_Device, vertexShader, fragmentShader, pipelineConfig);
5555
}

Intern/rayx-ui/src/RenderSystem/ObjectRenderSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ void ObjectRenderSystem::createPipeline(VkRenderPass renderPass) {
4747
GraphicsPipeline::defaultPipelineConfigInfo(pipelineConfig, GraphicsPipeline::VertexMode::TEXTURED);
4848
pipelineConfig.renderPass = renderPass;
4949
pipelineConfig.pipelineLayout = m_PipelineLayout;
50-
const std::string vertexShader = RAYX::canonicalizeRepositoryPath("build/bin/shader_vert.spv").string();
51-
const std::string fragmentShader = RAYX::canonicalizeRepositoryPath("build/bin/shader_frag.spv").string();
50+
const std::string vertexShader = RAYX::canonicalizeRepositoryPath("build/bin/shaders/shader_vert.spv").string();
51+
const std::string fragmentShader = RAYX::canonicalizeRepositoryPath("build/bin/shaders/shader_frag.spv").string();
5252
m_Pipeline = std::make_unique<GraphicsPipeline>(m_Device, vertexShader, fragmentShader, pipelineConfig);
5353
}
5454

Intern/rayx-ui/src/RenderSystem/RayRenderSystem.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void RayRenderSystem::createPipeline(VkRenderPass renderPass) {
4646
pipelineConfig.renderPass = renderPass;
4747
pipelineConfig.pipelineLayout = m_PipelineLayout;
4848

49-
const std::string vertexShader = RAYX::canonicalizeRepositoryPath("build/bin/ray_shader_vert.spv").string();
50-
const std::string fragmentShader = RAYX::canonicalizeRepositoryPath("build/bin/ray_shader_frag.spv").string();
49+
const std::string vertexShader = RAYX::canonicalizeRepositoryPath("build/bin/shaders/ray_shader_vert.spv").string();
50+
const std::string fragmentShader = RAYX::canonicalizeRepositoryPath("build/bin/shaders/ray_shader_frag.spv").string();
5151
m_Pipeline = std::make_unique<GraphicsPipeline>(m_Device, vertexShader, fragmentShader, pipelineConfig);
5252
}

Intern/rayx/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_BINARY_DIR})
4141
# ----------------------
4242

4343
# ---- CPack ----
44+
install(DIRECTORY ${CMAKE_BINARY_DIR}/bin/shaders
45+
DESTINATION ./
46+
FILES_MATCHING PATTERN "comp.spv")
4447
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "rayx - A RAYX Beamline Simulation Tool")
4548
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
4649
set(CPACK_PACKAGE_INSTALL_DIRECTORY "rayx")

0 commit comments

Comments
 (0)