diff --git a/examples/shaders/resources/shaders/glsl430/gol.glsl b/examples/shaders/resources/shaders/glsl430/gol.glsl index 5c74f7b1b..b0b5bfe76 100644 --- a/examples/shaders/resources/shaders/glsl430/gol.glsl +++ b/examples/shaders/resources/shaders/glsl430/gol.glsl @@ -3,13 +3,13 @@ #define GOL_WIDTH 768 -layout (local_size_x = 16, local_size_y = 16, local_size_x = 1) in; +layout (local_size_x = 16, local_size_y = 16, local_size_z = 1) in; layout(std430, binding = 1) readonly restrict buffer golLayout { uint golBuffer[]; // golBuffer[x, y] = golBuffer[x + gl_NumWorkGroups.x * y] }; -layout(std430, set = 1, binding = 2) writeonly restrict buffer golLayout2 { +layout(std430, binding = 2) writeonly restrict buffer golLayout2 { uint golBufferDest[]; // golBufferDest[x, y] = golBufferDest[x + gl_NumWorkGroups.x * y] }; @@ -27,25 +27,25 @@ void main() // Top left neighbour_count += fetchGol(x - 1, y - 1); - + // Top middle neighbour_count += fetchGol(x, y - 1); - + // Top right neighbour_count += fetchGol(x + 1, y - 1); - + // Left neighbour_count += fetchGol(x - 1, y); // Right neighbour_count += fetchGol(x + 1, y); - + // Bottom left neighbour_count += fetchGol(x - 1, y + 1); - + // Bottom middle neighbour_count += fetchGol(x, y + 1); - + // Bottom right neighbour_count += fetchGol(x + 1, y + 1); @@ -55,4 +55,4 @@ void main() setGol(x, y, fetchGol(x, y)); else setGol(x, y, 0); -} \ No newline at end of file +} diff --git a/examples/shaders/resources/shaders/glsl430/golTransfert.glsl b/examples/shaders/resources/shaders/glsl430/golTransfert.glsl index e09f85cc5..85b5a6dc4 100644 --- a/examples/shaders/resources/shaders/glsl430/golTransfert.glsl +++ b/examples/shaders/resources/shaders/glsl430/golTransfert.glsl @@ -9,9 +9,9 @@ struct GolUpdateCmd { uint enabled; // whether to enable or disable zone }; -layout (local_size_x = 1, local_size_y = 1, local_size_x = 1) in; +layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in; -layout(std430, binding = 1) writeonly restrict buffer golBufferLayout { +layout(std430, binding = 1) buffer golBufferLayout { uint golBuffer[]; // golBuffer[x, y] = golBuffer[x + GOL_WIDTH * y] }; @@ -26,7 +26,7 @@ layout(std430, binding = 3) readonly restrict buffer golUpdateLayout { void main() { uint cmd_index = gl_GlobalInvocationID.x; - struct GolUpdateCmd cmd = commands[cmd_index]; + GolUpdateCmd cmd = commands[cmd_index]; for (uint x = cmd.x; x < (cmd.x + cmd.w); x++) { for (uint y = cmd.y; y < (cmd.y + cmd.w); y++) { @@ -39,4 +39,4 @@ void main() } } } -} \ No newline at end of file +} diff --git a/examples/shaders/shaders_compute_gol.c b/examples/shaders/shaders_compute_gol.c index 3624b2a88..6efe4d52c 100644 --- a/examples/shaders/shaders_compute_gol.c +++ b/examples/shaders/shaders_compute_gol.c @@ -15,7 +15,7 @@ * ********************************************************************************************/ -#include +#include #include "raylib.h" #include "rlgl.h" @@ -27,7 +27,7 @@ #define SSBO_SIZE (sizeof(unsigned int) * GOL_WIDTH * GOL_WIDTH) // Maximum amount of queued draw commands (squares draw from mouse down events). -#define MAX_BUFFERED_TRANSFERTS 128 +#define MAX_BUFFERED_TRANSFERTS 48 struct GolUpdateCmd { unsigned int x; // x coordinate of the gol command