Added gpu compute memcpy + cpu side timing statistics
This commit is contained in:
28
src/main/resources/assets/voxy/shaders/util/memcpy.comp
Normal file
28
src/main/resources/assets/voxy/shaders/util/memcpy.comp
Normal file
@@ -0,0 +1,28 @@
|
||||
#version 460 core
|
||||
#define WORK_SIZE 256
|
||||
layout(local_size_x=WORK_SIZE) in;
|
||||
|
||||
//Header data about destination, size and location of what is being copied (NOTE: can probably make it a uvec2?)
|
||||
layout(binding = INPUT_HEADER_BUFFER_BINDING, std430) restrict readonly buffer InputHeaderBuffer {
|
||||
uvec4[] dataCopyHeader;
|
||||
};
|
||||
|
||||
layout(binding = INPUT_DATA_BUFFER_BINDING, std430) restrict readonly buffer InputDataBuffer {
|
||||
uvec2[] dataInBuffer;
|
||||
};
|
||||
|
||||
layout(binding = OUTPUT_BUFFER_BINDING, std430) restrict writeonly buffer OutputBuffer {
|
||||
uvec2[] outputBuffer;
|
||||
};
|
||||
|
||||
void main() {
|
||||
uvec4 job = dataCopyHeader[gl_WorkGroupID.x];
|
||||
//Copy from input to output
|
||||
uint src = job.x;
|
||||
uint dst = job.y;
|
||||
uint siz = job.z;
|
||||
|
||||
for (uint i = gl_LocalInvocationID.x; i < siz; i+=WORK_SIZE) {
|
||||
outputBuffer[dst+i] = dataInBuffer[src+i];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user