Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/01-basic_usage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main()
const std::string shader_path{"../examples/shader/headless.comp.spv"}; // suppose we run this program on build dir

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

cov::App::init("HelloCOV");
Expand Down
9 changes: 5 additions & 4 deletions examples/shader/headless.comp
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#version 450

layout(set = 0, binding = 0) buffer Pos {
uint in_values[ ];
uint length;
uint in_values[ ];
};

layout(set = 1, binding = 0) buffer Pos1 {
uint in_values1[ ];
uint in_values1[ ];
};

layout(set = 2, binding = 0) buffer Pos2 {
uint out_values[ ];
uint out_values[ ];
};

layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
Expand All @@ -33,7 +34,7 @@ uint fibonacci(uint n) {
void main()
{
uint index = gl_GlobalInvocationID.x;
if (index >= BUFFER_ELEMENTS)
if (index >= length)
return;
out_values[index] = fibonacci(in_values[index]);
}
Binary file modified examples/shader/headless.comp.spv
Binary file not shown.