map_reset.glsl 534 B

1234567891011121314151617181920212223242526
  1. #version 430 core
  2. struct cell_t {
  3. float pheromone;
  4. float result;
  5. int population;
  6. };
  7. uniform int map_width;
  8. uniform int map_height;
  9. layout(std430, binding = 2) coherent buffer map_buffer
  10. {
  11. cell_t map[];
  12. };
  13. layout(local_size_x = 256, local_size_y = 1, local_size_z = 1) in;
  14. void main(){
  15. uint cell_id = gl_GlobalInvocationID.x;
  16. if(cell_id >= uint(map_width * map_height)){
  17. return;
  18. }
  19. map[cell_id].pheromone = map[cell_id].result;
  20. map[cell_id].result = 0;
  21. map[cell_id].population = 0;
  22. }