Advertisement
Guest User

shader

a guest
Dec 13th, 2013
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #version 430 core
  2. #extension GL_ARB_compute_shader : enable
  3. #extension GL_ARB_shader_storage_buffer_object: enable
  4.  
  5. //this is the copy saved at above-level
  6.  
  7. layout( std430, binding=4) buffer bufferKey {
  8. uint KeyString[]; // array of structures
  9. //may need to change to uint for the atomics
  10. };
  11. layout( std430, binding=5) buffer bufferTXT {
  12. uint BufString[]; // array of structures
  13. //may need to change to uint for the atomics
  14. };
  15.  
  16. layout (location=0) uniform uint keyByteLength;
  17. layout (local_size_x = 1) in;
  18.  
  19. uint cryptoXORop(uint left_in, uint right_in){
  20.  
  21. //atomicXOR(left_in, right_in);
  22. //return left_in;
  23. uint result = left_in ^ right_in;
  24. return result;
  25.  
  26. //we can still do the null terminator check with some clever modulo
  27. }
  28.  
  29.  
  30. void main(void)
  31. {
  32.  
  33. uint gid = gl_GlobalInvocationID.x;
  34. uint lid = gl_LocalInvocationIndex;
  35.  
  36. uint index = gid;
  37. /*
  38. uint result = cryptoXORop(BufString[index].x, KeyString[index%keyByteLength].x);
  39.  
  40. BufString[index] = atomicAdd( BufString[index],result); //the usual for loop has been overtaken by the workgroup forking
  41.  
  42. uint i = 0;
  43.  
  44. */
  45. for (uint i = 0; i < keyByteLength; i++)
  46. BufString[index+i] = 0;
  47. memoryBarrier();
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement