Run OpenGL commands

This commit is contained in:
Gregory Wells
2025-08-18 22:09:05 -04:00
parent be2f91e2bb
commit 7b1266281c
5 changed files with 21 additions and 1 deletions

View File

@@ -10,6 +10,7 @@
#include "textures/opengl_texture.h"
#include "framebuffer/opengl_framebuffer.h"
#include "graphics_pipeline/opengl_graphics_pipeline.h"
#include "submit/opengl_submit.h"
gnDeviceFunctions loadOpenGLDeviceFunctions() {
return (gnDeviceFunctions){
@@ -51,7 +52,7 @@ gnDeviceFunctions loadOpenGLDeviceFunctions() {
._gnTextureData = openglTextureData,
._gnDestroyTexture = openglDestroyTexture,
._gnSubmit = NULL,
._gnSubmit = openglSubmit,
._gnPresent = NULL,
._gnWaitForDevice = waitForOpenGLDevice

View File

@@ -6,6 +6,10 @@ typedef struct openglCommandRunner_t {
} glCommandRunner;
GN_CPP_FUNCTION openglCommandRunner openglCreateCommandRunner() { return new glCommandRunner(); }
GN_CPP_FUNCTION void openglRunCommandRunner(openglCommandRunner runner) {
for (int i = 0; i < runner->commands.size(); i++)
runner->commands[i]();
}
GN_CPP_FUNCTION void openglResetCommandRunner(openglCommandRunner runner) { runner->commands.clear(); }
GN_CPP_FUNCTION void openglDestroyCommandRunner(openglCommandRunner* runner) {
*runner = NULL;

View File

@@ -5,6 +5,7 @@ typedef void (*openglFunctionBinding)();
GN_CPP_FUNCTION openglCommandRunner openglCreateCommandRunner();
GN_CPP_FUNCTION void openglResetCommandRunner(openglCommandRunner runner);
GN_CPP_FUNCTION void openglRunCommandRunner(openglCommandRunner runner);
GN_CPP_FUNCTION void openglDestroyCommandRunner(openglCommandRunner* runner);
void openglCommandRunnerBindFunction(openglCommandRunner runner, openglFunctionBinding binding);

View File

@@ -0,0 +1,11 @@
#include "core/src/submit/gryphn_submit.h"
#include "commands/buffers/opengl_command_buffer.h"
gnReturnCode openglSubmit(gnOutputDevice device, gnSubmitInfo info) {
if (device == GN_NULL_HANDLE) return GN_INVALID_HANDLE;
for (uint32_t i = 0; i < info.commandBufferCount; i++)
openglRunCommandRunner(info.commandBuffers[i]->commandBuffer->commmandRunner);
return GN_SUCCESS;
}

View File

@@ -0,0 +1,3 @@
#pragma once
#include "core/src/submit/gryphn_submit.h"
gnReturnCode openglSubmit(gnOutputDevice device, gnSubmitInfo info);