Skip to content

Commit 0153fcb

Browse files
committed
Works with structure input
1 parent 1dfcf15 commit 0153fcb

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

examples/01-basic_usage.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ int main()
1919
const std::string shader_path{"../examples/shader/headless.comp.spv"}; // suppose we run this program on build dir
2020

2121
// std::vector<int> in_data{1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7};
22-
std::vector<int> in_data{7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7};
22+
std::vector<int> in_data{3, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7};
2323
std::vector<int> out_data(in_data.size());
2424

2525
cov::App::init("HelloCOV");

examples/shader/headless.comp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#version 450
22

33
layout(set = 0, binding = 0) buffer Pos {
4-
uint in_values[ ];
4+
uint length;
5+
uint in_values[ ];
56
};
67

78
layout(set = 1, binding = 0) buffer Pos1 {
8-
uint in_values1[ ];
9+
uint in_values1[ ];
910
};
1011

1112
layout(set = 2, binding = 0) buffer Pos2 {
12-
uint out_values[ ];
13+
uint out_values[ ];
1314
};
1415

1516
layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -33,7 +34,7 @@ uint fibonacci(uint n) {
3334
void main()
3435
{
3536
uint index = gl_GlobalInvocationID.x;
36-
if (index >= BUFFER_ELEMENTS)
37+
if (index >= length)
3738
return;
3839
out_values[index] = fibonacci(in_values[index]);
3940
}

examples/shader/headless.comp.spv

80 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)