#version 430 core
#extension GL_ARB_compute_shader : enable
#extension GL_ARB_shader_storage_buffer_object: enable
//this is the copy saved at above-level
layout( std430, binding=4) buffer bufferKey {
uint KeyString[]; // array of structures
//may need to change to uint for the atomics
};
layout( std430, binding=5) buffer bufferTXT {
uint BufString[]; // array of structures
//may need to change to uint for the atomics
};
layout (location=0) uniform uint keyByteLength;
layout (local_size_x = 1) in;
uint cryptoXORop(uint left_in, uint right_in){
//atomicXOR(left_in, right_in);
//return left_in;
uint result = left_in ^ right_in;
return result;
//we can still do the null terminator check with some clever modulo
}
void main(void)
{
uint gid = gl_GlobalInvocationID.x;
uint lid = gl_LocalInvocationIndex;
uint index = gid;
/*
uint result = cryptoXORop(BufString[index].x, KeyString[index%keyByteLength].x);
BufString[index] = atomicAdd( BufString[index],result); //the usual for loop has been overtaken by the workgroup forking
uint i = 0;
*/
for (uint i = 0; i < keyByteLength; i++)
BufString[index+i] = 0;
memoryBarrier();
}