Fix various shaders problems, and tune command buffer size.

This commit is contained in:
TSnake41 2021-10-30 17:11:36 +02:00
parent 58c206aa41
commit 3221cfd1c7
3 changed files with 15 additions and 15 deletions

View File

@ -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]
};

View File

@ -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++) {

View File

@ -15,7 +15,7 @@
*
********************************************************************************************/
#include <stdint.h>
#include <stdlib.h>
#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