File tree Expand file tree Collapse file tree 3 files changed +33
-10
lines changed Expand file tree Collapse file tree 3 files changed +33
-10
lines changed Original file line number Diff line number Diff line change @@ -95,11 +95,12 @@ endforeach(GLSL_FILE)
95
95
# create a command to generate the source file that depends on the shader headers
96
96
set (SPVRC_SRC "${CMAKE_CURRENT_BINARY_DIR} /spvrc.cpp" )
97
97
add_custom_command (
98
- COMMAND ${CMAKE_COMMAND}
99
- -DSPVRC_SRC=${SPVRC_SRC}
100
- -DSPVRC_SPIRV_HEADERS=${SPVRC_SPIRV_HEADERS}
101
- -DSPVRC_SPIRV_FILES=${SPVRC_SPIRV_FILES}
102
- -DSPVRC_SPIRV_SYMBOLS=${SPVRC_SPIRV_SYMBOLS}
98
+ COMMAND_EXPAND_LISTS
99
+ COMMAND ${CMAKE_COMMAND}
100
+ -DSPVRC_SRC=${SPVRC_SRC}
101
+ -DSPVRC_SPIRV_HEADERS= "${SPVRC_SPIRV_HEADERS} "
102
+ -DSPVRC_SPIRV_FILES= "${SPVRC_SPIRV_FILES} "
103
+ -DSPVRC_SPIRV_SYMBOLS= "${SPVRC_SPIRV_SYMBOLS} "
103
104
-P "${CMAKE_CURRENT_SOURCE_DIR} /cmake/generate_spvrc_source.cmake"
104
105
DEPENDS ${SPVRC_SPIRV_HEADERS}
105
106
OUTPUT ${SPVRC_SRC}
Original file line number Diff line number Diff line change
1
+ string (REPLACE " " ";" SPVRC_SPIRV_HEADERS ${SPVRC_SPIRV_HEADERS} )
2
+ string (REPLACE " " ";" SPVRC_SPIRV_FILES ${SPVRC_SPIRV_FILES} )
3
+ string (REPLACE " " ";" SPVRC_SPIRV_SYMBOLS ${SPVRC_SPIRV_SYMBOLS} )
4
+
1
5
file (WRITE "${SPVRC_SRC} "
2
6
"#include <string_view>
3
7
#include <cstdint>
8
+ #include <cassert>
4
9
#include <vector>
5
10
#include \" spvrc/spvrc.hpp\"
6
11
" )
@@ -22,17 +27,17 @@ constexpr uint32_t hash(std::string_view data) noexcept {
22
27
namespace spvrc {
23
28
auto load(std::string_view path) -> std::vector<uint32_t> {
24
29
std::vector<uint32_t> data;
25
- switch (hash(path)) {
26
- " )
30
+ switch (hash(path)) {"
31
+ )
27
32
# insert shader data
28
33
foreach (SPIRV_FILE SPIRV_SYMBOL IN ZIP_LISTS SPVRC_SPIRV_FILES SPVRC_SPIRV_SYMBOLS )
29
- file (APPEND "${SPVRC_SRC} "
30
- " case hash(\" ${SPIRV_FILE} \" ): data = { ${SPIRV_SYMBOL} , ${SPIRV_SYMBOL} + std::size(${SPIRV_SYMBOL} )}; break;\n "
34
+ file (APPEND "${SPVRC_SRC} " "
35
+ case hash(\" ${SPIRV_FILE} \" ): data = { ${SPIRV_SYMBOL} , ${SPIRV_SYMBOL} + std::size(${SPIRV_SYMBOL} )}; break;"
31
36
)
32
37
endforeach (SPIRV_FILE SPIRV_SYMBOL )
33
38
# end namespace
34
39
file (APPEND "${SPVRC_SRC} " "
35
- default: break ;
40
+ default: assert(false && \" Shader not found \" ) ;
36
41
}
37
42
return data;
38
43
}
Original file line number Diff line number Diff line change
1
+ #version 460
2
+
3
+ layout(set = 0, binding = 0, rgba16f) uniform image2D image;
4
+ layout(constant_id = 0) const uint image_size_x = 1280;
5
+ layout(constant_id = 1) const uint image_size_y = 720;
6
+ const uvec2 image_size = uvec2(image_size_x, image_size_y);
7
+
8
+ layout (local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
9
+ void main() {
10
+ uvec2 texelCoord = gl_GlobalInvocationID.xy;
11
+ vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
12
+ if(gl_LocalInvocationID.x != 0 && gl_LocalInvocationID.y != 0) {
13
+ color.x = float(texelCoord.x)/float(image_size.x);
14
+ color.y = float(texelCoord.y)/float(image_size.y);
15
+ }
16
+ imageStore(image, ivec2(texelCoord), color);
17
+ }
You can’t perform that action at this time.
0 commit comments