| 12345678910111213141516171819202122232425262728293031323334 |
- #version 430 core
- struct cell_t {
- float pheromone;
- float result;
- int population;
- };
- uniform uint map_width;
- uniform uint map_height;
- layout(std430, binding = 2) coherent buffer map_buffer
- {
- cell_t map[];
- };
- uint cell_id(uint x, uint y){
- return uint(mod(y, map_height) * map_width + mod(x, map_width));
- }
- layout(local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
- void main(){
- uint x = gl_GlobalInvocationID.x;
- uint y = gl_GlobalInvocationID.y;
- if(x >= map_width || y >= map_height){
- return;
- }
- uint id = cell_id(x, y);
- map[id].pheromone = map[id].result;
- map[id].result = 0;
- map[id].population = 0;
- }
|