Run OpenGL commands
This commit is contained in:
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
|
11
projects/apis/opengl/src/submit/opengl_submit.c
Normal file
11
projects/apis/opengl/src/submit/opengl_submit.c
Normal 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;
|
||||
}
|
3
projects/apis/opengl/src/submit/opengl_submit.h
Normal file
3
projects/apis/opengl/src/submit/opengl_submit.h
Normal file
@@ -0,0 +1,3 @@
|
||||
#pragma once
|
||||
#include "core/src/submit/gryphn_submit.h"
|
||||
gnReturnCode openglSubmit(gnOutputDevice device, gnSubmitInfo info);
|
Reference in New Issue
Block a user