Various coding convention changes.
This commit is contained in:
parent
3221cfd1c7
commit
707f4d9451
|
|
@ -489,8 +489,7 @@ SHADERS = \
|
||||||
shaders/shaders_spotlight \
|
shaders/shaders_spotlight \
|
||||||
shaders/shaders_hot_reloading \
|
shaders/shaders_hot_reloading \
|
||||||
shaders/shaders_mesh_instancing \
|
shaders/shaders_mesh_instancing \
|
||||||
shaders/shaders_multi_sample2d \
|
shaders/shaders_multi_sample2d
|
||||||
shaders/shaders_compute_gol
|
|
||||||
|
|
||||||
AUDIO = \
|
AUDIO = \
|
||||||
audio/audio_module_playing \
|
audio/audio_module_playing \
|
||||||
|
|
|
||||||
|
|
@ -6,53 +6,59 @@
|
||||||
layout (local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
|
layout (local_size_x = 16, local_size_y = 16, local_size_z = 1) in;
|
||||||
|
|
||||||
layout(std430, binding = 1) readonly restrict buffer golLayout {
|
layout(std430, binding = 1) readonly restrict buffer golLayout {
|
||||||
uint golBuffer[]; // golBuffer[x, y] = golBuffer[x + gl_NumWorkGroups.x * y]
|
uint golBuffer[]; // golBuffer[x, y] = golBuffer[x + gl_NumWorkGroups.x * y]
|
||||||
};
|
};
|
||||||
|
|
||||||
layout(std430, 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]
|
uint golBufferDest[]; // golBufferDest[x, y] = golBufferDest[x + gl_NumWorkGroups.x * y]
|
||||||
};
|
};
|
||||||
|
|
||||||
#define fetchGol(x, y) ((((x) < 0) || ((y) < 0) || ((x) > GOL_WIDTH) || ((y) > GOL_WIDTH)) \
|
#define fetchGol(x, y) ((((x) < 0) || ((y) < 0) || ((x) > GOL_WIDTH) || ((y) > GOL_WIDTH)) \
|
||||||
? (0) \
|
? (0) \
|
||||||
: golBuffer[(x) + GOL_WIDTH * (y)])
|
: golBuffer[(x) + GOL_WIDTH * (y)])
|
||||||
|
|
||||||
#define setGol(x, y, value) golBufferDest[(x) + GOL_WIDTH * (y)] = value
|
#define setGol(x, y, value) golBufferDest[(x) + GOL_WIDTH * (y)] = value
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
uint neighbour_count = 0;
|
uint neighbour_count = 0;
|
||||||
uint x = gl_GlobalInvocationID.x;
|
uint x = gl_GlobalInvocationID.x;
|
||||||
uint y = gl_GlobalInvocationID.y;
|
uint y = gl_GlobalInvocationID.y;
|
||||||
|
|
||||||
// Top left
|
// Top left
|
||||||
neighbour_count += fetchGol(x - 1, y - 1);
|
neighbour_count += fetchGol(x - 1, y - 1);
|
||||||
|
|
||||||
// Top middle
|
// Top middle
|
||||||
neighbour_count += fetchGol(x, y - 1);
|
neighbour_count += fetchGol(x, y - 1);
|
||||||
|
|
||||||
// Top right
|
// Top right
|
||||||
neighbour_count += fetchGol(x + 1, y - 1);
|
neighbour_count += fetchGol(x + 1, y - 1);
|
||||||
|
|
||||||
// Left
|
// Left
|
||||||
neighbour_count += fetchGol(x - 1, y);
|
neighbour_count += fetchGol(x - 1, y);
|
||||||
|
|
||||||
// Right
|
// Right
|
||||||
neighbour_count += fetchGol(x + 1, y);
|
neighbour_count += fetchGol(x + 1, y);
|
||||||
|
|
||||||
// Bottom left
|
// Bottom left
|
||||||
neighbour_count += fetchGol(x - 1, y + 1);
|
neighbour_count += fetchGol(x - 1, y + 1);
|
||||||
|
|
||||||
// Bottom middle
|
// Bottom middle
|
||||||
neighbour_count += fetchGol(x, y + 1);
|
neighbour_count += fetchGol(x, y + 1);
|
||||||
|
|
||||||
// Bottom right
|
// Bottom right
|
||||||
neighbour_count += fetchGol(x + 1, y + 1);
|
neighbour_count += fetchGol(x + 1, y + 1);
|
||||||
|
|
||||||
if (neighbour_count == 3)
|
if (neighbour_count == 3)
|
||||||
setGol(x, y, 1);
|
{
|
||||||
else if (neighbour_count == 2)
|
setGol(x, y, 1);
|
||||||
setGol(x, y, fetchGol(x, y));
|
}
|
||||||
else
|
else if (neighbour_count == 2)
|
||||||
setGol(x, y, 0);
|
{
|
||||||
|
setGol(x, y, fetchGol(x, y));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setGol(x, y, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
// Game of Life rendering shader
|
|
||||||
// Just renders the content of the ssbo at binding 1 to screen.
|
|
||||||
#version 430
|
|
||||||
|
|
||||||
#define GOL_WIDTH 768
|
|
||||||
|
|
||||||
out vec4 finalColor;
|
|
||||||
in vec2 fragTexCoord;
|
|
||||||
|
|
||||||
layout(std430, binding = 1) readonly buffer golLayout {
|
|
||||||
uint golBuffer[];
|
|
||||||
};
|
|
||||||
|
|
||||||
uniform vec2 res;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
ivec2 coords = ivec2(fragTexCoord * res);
|
|
||||||
|
|
||||||
if (golBuffer[coords.x + coords.y * uvec2(res).x] == 1)
|
|
||||||
finalColor = vec4(1.0);
|
|
||||||
else
|
|
||||||
finalColor = vec4(0.0, 0.0, 0.0, 1.0);
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
// Game of life transfert shader.
|
|
||||||
#version 430
|
|
||||||
#define GOL_WIDTH 768
|
|
||||||
|
|
||||||
struct GolUpdateCmd {
|
|
||||||
uint x; // x coordinate of the gol command
|
|
||||||
uint y; // y coordinate of the gol command
|
|
||||||
uint w; // width of the filled zone
|
|
||||||
uint enabled; // whether to enable or disable zone
|
|
||||||
};
|
|
||||||
|
|
||||||
layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
|
||||||
|
|
||||||
layout(std430, binding = 1) buffer golBufferLayout {
|
|
||||||
uint golBuffer[]; // golBuffer[x, y] = golBuffer[x + GOL_WIDTH * y]
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std430, binding = 3) readonly restrict buffer golUpdateLayout {
|
|
||||||
uint count;
|
|
||||||
GolUpdateCmd commands[];
|
|
||||||
};
|
|
||||||
|
|
||||||
#define isInside(x, y) (((x) >= 0) && ((y) >= 0) && ((x) < GOL_WIDTH) && ((y) < GOL_WIDTH))
|
|
||||||
#define getBufferIndex(x, y) ((x) + GOL_WIDTH * (y))
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
uint cmd_index = gl_GlobalInvocationID.x;
|
|
||||||
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++) {
|
|
||||||
if (isInside(x, y)) {
|
|
||||||
if (cmd.enabled != 0) {
|
|
||||||
atomicOr(golBuffer[getBufferIndex(x, y)], 1);
|
|
||||||
} else {
|
|
||||||
atomicAnd(golBuffer[getBufferIndex(x, y)], 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
34
examples/shaders/resources/shaders/glsl430/gol_render.glsl
Normal file
34
examples/shaders/resources/shaders/glsl430/gol_render.glsl
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
// Game of Life rendering shader
|
||||||
|
// Just renders the content of the ssbo at binding 1 to screen.
|
||||||
|
#version 430
|
||||||
|
|
||||||
|
#define GOL_WIDTH 768
|
||||||
|
|
||||||
|
// Input vertex attributes (from vertex shader)
|
||||||
|
in vec2 fragTexCoord;
|
||||||
|
|
||||||
|
// Output fragment color
|
||||||
|
out vec4 finalColor;
|
||||||
|
|
||||||
|
// Input game of life grid.
|
||||||
|
layout(std430, binding = 1) readonly buffer golLayout
|
||||||
|
{
|
||||||
|
uint golBuffer[];
|
||||||
|
};
|
||||||
|
|
||||||
|
// Output resolution
|
||||||
|
uniform vec2 res;
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
ivec2 coords = ivec2(fragTexCoord * res);
|
||||||
|
|
||||||
|
if (golBuffer[coords.x + coords.y * uvec2(res).x] == 1)
|
||||||
|
{
|
||||||
|
finalColor = vec4(1.0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
finalColor = vec4(0.0, 0.0, 0.0, 1.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
// Game of life transfert shader.
|
||||||
|
#version 430
|
||||||
|
#define GOL_WIDTH 768
|
||||||
|
|
||||||
|
// Structure definitions
|
||||||
|
struct GolUpdateCmd {
|
||||||
|
uint x; // x coordinate of the gol command
|
||||||
|
uint y; // y coordinate of the gol command
|
||||||
|
uint w; // width of the filled zone
|
||||||
|
uint enabled; // whether to enable or disable zone
|
||||||
|
};
|
||||||
|
|
||||||
|
// Local compute unit size.
|
||||||
|
layout (local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||||
|
|
||||||
|
// Output game of life grid buffer.
|
||||||
|
layout(std430, binding = 1) buffer golBufferLayout
|
||||||
|
{
|
||||||
|
uint golBuffer[]; // golBuffer[x, y] = golBuffer[x + GOL_WIDTH * y]
|
||||||
|
};
|
||||||
|
|
||||||
|
// Command buffer
|
||||||
|
layout(std430, binding = 3) readonly restrict buffer golUpdateLayout
|
||||||
|
{
|
||||||
|
uint count;
|
||||||
|
GolUpdateCmd commands[];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define isInside(x, y) (((x) >= 0) && ((y) >= 0) && ((x) < GOL_WIDTH) && ((y) < GOL_WIDTH))
|
||||||
|
#define getBufferIndex(x, y) ((x) + GOL_WIDTH * (y))
|
||||||
|
|
||||||
|
void main()
|
||||||
|
{
|
||||||
|
uint cmd_index = gl_GlobalInvocationID.x;
|
||||||
|
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++)
|
||||||
|
{
|
||||||
|
if (isInside(x, y))
|
||||||
|
{
|
||||||
|
if (cmd.enabled != 0)
|
||||||
|
{
|
||||||
|
atomicOr(golBuffer[getBufferIndex(x, y)], 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
atomicAnd(golBuffer[getBufferIndex(x, y)], 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -24,124 +24,141 @@
|
||||||
// This must be a multiple of 16 (check golLogic compute dispatch).
|
// This must be a multiple of 16 (check golLogic compute dispatch).
|
||||||
#define GOL_WIDTH 768
|
#define GOL_WIDTH 768
|
||||||
|
|
||||||
#define SSBO_SIZE (sizeof(unsigned int) * GOL_WIDTH * GOL_WIDTH)
|
|
||||||
|
|
||||||
// Maximum amount of queued draw commands (squares draw from mouse down events).
|
// Maximum amount of queued draw commands (squares draw from mouse down events).
|
||||||
#define MAX_BUFFERED_TRANSFERTS 48
|
#define MAX_BUFFERED_TRANSFERTS 48
|
||||||
|
|
||||||
struct GolUpdateCmd {
|
struct GolUpdateCmd
|
||||||
unsigned int x; // x coordinate of the gol command
|
{
|
||||||
unsigned int y; // y coordinate of the gol command
|
unsigned int x; // x coordinate of the gol command
|
||||||
unsigned int w; // width of the filled zone
|
unsigned int y; // y coordinate of the gol command
|
||||||
unsigned int enabled; // whether to enable or disable zone
|
unsigned int w; // width of the filled zone
|
||||||
|
unsigned int enabled; // whether to enable or disable zone
|
||||||
};
|
};
|
||||||
|
|
||||||
struct GolUpdateSSBO {
|
struct GolUpdateSSBO
|
||||||
unsigned int count;
|
{
|
||||||
struct GolUpdateCmd commands[MAX_BUFFERED_TRANSFERTS];
|
unsigned int count;
|
||||||
|
struct GolUpdateCmd commands[MAX_BUFFERED_TRANSFERTS];
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
InitWindow(GOL_WIDTH, GOL_WIDTH, "raylib [shaders] example - compute shader gol");
|
// Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
InitWindow(GOL_WIDTH, GOL_WIDTH, "raylib [shaders] example - compute shader gol");
|
||||||
|
|
||||||
const Vector2 resolution = { GOL_WIDTH, GOL_WIDTH };
|
const Vector2 resolution = { GOL_WIDTH, GOL_WIDTH };
|
||||||
unsigned int brush_size = 1;
|
unsigned int brushSize = 1;
|
||||||
|
|
||||||
// Game of Life logic compute shader
|
// Game of Life logic compute shader
|
||||||
char *golLogicCode = LoadFileText("resources/shaders/glsl430/gol.glsl");
|
char *golLogicCode = LoadFileText("resources/shaders/glsl430/gol.glsl");
|
||||||
unsigned int golLogicShader = rlCompileShader(golLogicCode, RL_COMPUTE_SHADER);
|
unsigned int golLogicShader = rlCompileShader(golLogicCode, RL_COMPUTE_SHADER);
|
||||||
unsigned int golLogicProgram = rlLoadComputeShaderProgram(golLogicShader);
|
unsigned int golLogicProgram = rlLoadComputeShaderProgram(golLogicShader);
|
||||||
MemFree(golLogicCode);
|
MemFree(golLogicCode);
|
||||||
|
|
||||||
// Game of Life logic compute shader
|
// Game of Life logic compute shader
|
||||||
Shader golRenderShader = LoadShader(NULL, "resources/shaders/glsl430/golRender.glsl");
|
Shader golRenderShader = LoadShader(NULL, "resources/shaders/glsl430/gol_render.glsl");
|
||||||
int resUniformLoc = GetShaderLocation(golRenderShader, "res");
|
int resUniformLoc = GetShaderLocation(golRenderShader, "res");
|
||||||
|
|
||||||
// Game of Life transfert shader
|
// Game of Life transfert shader
|
||||||
char *golTransfertCode = LoadFileText("resources/shaders/glsl430/golTransfert.glsl");
|
char *golTransfertCode = LoadFileText("resources/shaders/glsl430/gol_transfert.glsl");
|
||||||
unsigned int golTransfertShader = rlCompileShader(golTransfertCode, RL_COMPUTE_SHADER);
|
unsigned int golTransfertShader = rlCompileShader(golTransfertCode, RL_COMPUTE_SHADER);
|
||||||
unsigned int golTransfertProgram = rlLoadComputeShaderProgram(golTransfertShader);
|
unsigned int golTransfertProgram = rlLoadComputeShaderProgram(golTransfertShader);
|
||||||
MemFree(golTransfertCode);
|
MemFree(golTransfertCode);
|
||||||
|
|
||||||
// SSBOs
|
// SSBOs
|
||||||
unsigned int ssboA = rlLoadShaderBuffer(SSBO_SIZE, NULL, RL_DYNAMIC_COPY);
|
unsigned int ssboA = rlLoadShaderBuffer(sizeof(unsigned int) * GOL_WIDTH * GOL_WIDTH, NULL, RL_DYNAMIC_COPY);
|
||||||
unsigned int ssboB = rlLoadShaderBuffer(SSBO_SIZE, NULL, RL_DYNAMIC_COPY);
|
unsigned int ssboB = rlLoadShaderBuffer(sizeof(unsigned int) * GOL_WIDTH * GOL_WIDTH, NULL, RL_DYNAMIC_COPY);
|
||||||
|
|
||||||
struct GolUpdateSSBO transfertBuffer;
|
struct GolUpdateSSBO transfertBuffer;
|
||||||
transfertBuffer.count = 0;
|
transfertBuffer.count = 0;
|
||||||
|
|
||||||
int transfertSSBO = rlLoadShaderBuffer(sizeof(struct GolUpdateSSBO), NULL, RL_DYNAMIC_COPY);
|
int transfertSSBO = rlLoadShaderBuffer(sizeof(struct GolUpdateSSBO), NULL, RL_DYNAMIC_COPY);
|
||||||
|
|
||||||
Image whiteImage = GenImageColor(GOL_WIDTH, GOL_WIDTH, WHITE);
|
// Create a white texture of the size of the window to update
|
||||||
Texture whiteTex = LoadTextureFromImage(whiteImage);
|
// each pixel of the window using the fragment shader.
|
||||||
UnloadImage(whiteImage);
|
Image whiteImage = GenImageColor(GOL_WIDTH, GOL_WIDTH, WHITE);
|
||||||
|
Texture whiteTex = LoadTextureFromImage(whiteImage);
|
||||||
|
UnloadImage(whiteImage);
|
||||||
|
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose())
|
||||||
if (IsKeyPressed(KEY_UP))
|
{
|
||||||
brush_size *= 2;
|
if (IsKeyPressed(KEY_UP)) brushSize *= 2;
|
||||||
else if (IsKeyPressed(KEY_DOWN) && brush_size != 1)
|
else if (IsKeyPressed(KEY_DOWN) && (brushSize != 1)) brushSize /= 2;
|
||||||
brush_size /= 2;
|
|
||||||
|
|
||||||
if ((IsMouseButtonDown(MOUSE_BUTTON_LEFT) || IsMouseButtonDown(MOUSE_BUTTON_RIGHT))
|
if ((IsMouseButtonDown(MOUSE_BUTTON_LEFT) || IsMouseButtonDown(MOUSE_BUTTON_RIGHT))
|
||||||
&& transfertBuffer.count < MAX_BUFFERED_TRANSFERTS) {
|
&& (transfertBuffer.count < MAX_BUFFERED_TRANSFERTS))
|
||||||
// Buffer a new command
|
{
|
||||||
transfertBuffer.commands[transfertBuffer.count].x = GetMouseX();
|
// Buffer a new command
|
||||||
transfertBuffer.commands[transfertBuffer.count].y = GetMouseY();
|
transfertBuffer.commands[transfertBuffer.count].x = GetMouseX();
|
||||||
transfertBuffer.commands[transfertBuffer.count].w = brush_size;
|
transfertBuffer.commands[transfertBuffer.count].y = GetMouseY();
|
||||||
transfertBuffer.commands[transfertBuffer.count].enabled = IsMouseButtonDown(MOUSE_BUTTON_LEFT);
|
transfertBuffer.commands[transfertBuffer.count].w = brushSize;
|
||||||
transfertBuffer.count++;
|
transfertBuffer.commands[transfertBuffer.count].enabled = IsMouseButtonDown(MOUSE_BUTTON_LEFT);
|
||||||
} else if (transfertBuffer.count > 0) {
|
transfertBuffer.count++;
|
||||||
// Process transfert buffer
|
}
|
||||||
|
else if (transfertBuffer.count > 0)
|
||||||
|
{
|
||||||
|
// Process transfert buffer
|
||||||
|
|
||||||
// Send SSBO buffer to GPU
|
// Send SSBO buffer to GPU
|
||||||
rlUpdateShaderBufferElements(transfertSSBO, &transfertBuffer, sizeof(struct GolUpdateSSBO), 0);
|
rlUpdateShaderBufferElements(transfertSSBO, &transfertBuffer, sizeof(struct GolUpdateSSBO), 0);
|
||||||
// Process ssbo command
|
// Process ssbo command
|
||||||
rlEnableShader(golTransfertProgram);
|
rlEnableShader(golTransfertProgram);
|
||||||
rlBindShaderBuffer(ssboA, 1);
|
rlBindShaderBuffer(ssboA, 1);
|
||||||
rlBindShaderBuffer(transfertSSBO, 3);
|
rlBindShaderBuffer(transfertSSBO, 3);
|
||||||
rlComputeShaderDispatch(transfertBuffer.count, 1, 1); // each GPU unit will process a command
|
rlComputeShaderDispatch(transfertBuffer.count, 1, 1); // each GPU unit will process a command
|
||||||
rlDisableShader();
|
rlDisableShader();
|
||||||
|
|
||||||
transfertBuffer.count = 0;
|
transfertBuffer.count = 0;
|
||||||
} else {
|
}
|
||||||
// Process game of life logic
|
else
|
||||||
rlEnableShader(golLogicProgram);
|
{
|
||||||
rlBindShaderBuffer(ssboA, 1);
|
// Process game of life logic
|
||||||
rlBindShaderBuffer(ssboB, 2);
|
rlEnableShader(golLogicProgram);
|
||||||
rlComputeShaderDispatch(GOL_WIDTH / 16, GOL_WIDTH / 16, 1);
|
rlBindShaderBuffer(ssboA, 1);
|
||||||
rlDisableShader();
|
rlBindShaderBuffer(ssboB, 2);
|
||||||
|
rlComputeShaderDispatch(GOL_WIDTH / 16, GOL_WIDTH / 16, 1);
|
||||||
|
rlDisableShader();
|
||||||
|
|
||||||
// ssboA <-> ssboB
|
// ssboA <-> ssboB
|
||||||
int temp = ssboA;
|
int temp = ssboA;
|
||||||
ssboA = ssboB;
|
ssboA = ssboB;
|
||||||
ssboB = temp;
|
ssboB = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
rlBindShaderBuffer(ssboA, 1);
|
||||||
|
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(BLANK);
|
||||||
|
SetShaderValue(golRenderShader, resUniformLoc, &resolution, SHADER_UNIFORM_VEC2);
|
||||||
|
|
||||||
|
BeginShaderMode(golRenderShader);
|
||||||
|
DrawTexture(whiteTex, 0, 0, WHITE);
|
||||||
|
EndShaderMode();
|
||||||
|
|
||||||
|
DrawFPS(0, 0);
|
||||||
|
|
||||||
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
||||||
rlBindShaderBuffer(ssboA, 1);
|
// De-Initialization
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
BeginDrawing();
|
// Unload shader buffers objects.
|
||||||
|
rlUnloadShaderBuffer(ssboA);
|
||||||
|
rlUnloadShaderBuffer(ssboB);
|
||||||
|
rlUnloadShaderBuffer(transfertSSBO);
|
||||||
|
|
||||||
ClearBackground(BLANK);
|
// Unload compute shader programs
|
||||||
SetShaderValue(golRenderShader, resUniformLoc, &resolution, SHADER_UNIFORM_VEC2);
|
rlUnloadShaderProgram(golTransfertProgram);
|
||||||
|
rlUnloadShaderProgram(golLogicProgram);
|
||||||
|
|
||||||
BeginShaderMode(golRenderShader);
|
UnloadTexture(whiteTex); // Unload white texture
|
||||||
DrawTexture(whiteTex, 0, 0, WHITE);
|
UnloadShader(golRenderShader); // Unload rendering fragment shader
|
||||||
EndShaderMode();
|
|
||||||
|
|
||||||
DrawFPS(0, 0);
|
CloseWindow(); // Close window and OpenGL context
|
||||||
|
//--------------------------------------------------------------------------------------
|
||||||
|
|
||||||
EndDrawing();
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
rlUnloadShaderBuffer(ssboA);
|
|
||||||
rlUnloadShaderBuffer(ssboB);
|
|
||||||
rlUnloadShaderBuffer(transfertSSBO);
|
|
||||||
rlUnloadShaderProgram(golTransfertProgram);
|
|
||||||
rlUnloadShaderProgram(golLogicProgram);
|
|
||||||
|
|
||||||
UnloadTexture(whiteTex);
|
|
||||||
UnloadShader(golRenderShader);
|
|
||||||
|
|
||||||
CloseWindow();
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user