create graphics pipelines
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
#include "buffer/opengl_buffer.h"
|
#include "buffer/opengl_buffer.h"
|
||||||
#include "textures/opengl_texture.h"
|
#include "textures/opengl_texture.h"
|
||||||
#include "framebuffer/opengl_framebuffer.h"
|
#include "framebuffer/opengl_framebuffer.h"
|
||||||
|
#include "graphics_pipeline/opengl_graphics_pipeline.h"
|
||||||
|
|
||||||
gnDeviceFunctions loadOpenGLDeviceFunctions() {
|
gnDeviceFunctions loadOpenGLDeviceFunctions() {
|
||||||
return (gnDeviceFunctions){
|
return (gnDeviceFunctions){
|
||||||
@@ -22,8 +23,8 @@ gnDeviceFunctions loadOpenGLDeviceFunctions() {
|
|||||||
._gnCreateRenderPassDescriptor = openglCreateRenderPass,
|
._gnCreateRenderPassDescriptor = openglCreateRenderPass,
|
||||||
._gnDestroyRenderPassDescriptor = openglDestroyRenderPass,
|
._gnDestroyRenderPassDescriptor = openglDestroyRenderPass,
|
||||||
|
|
||||||
._gnCreateGraphicsPipeline = NULL,
|
._gnCreateGraphicsPipeline = openglCreateGraphicsPipeline,
|
||||||
._gnDestroyGraphicsPipeline = NULL,
|
._gnDestroyGraphicsPipeline = openglDestroyGraphicsPipeline,
|
||||||
|
|
||||||
._gnCreateFramebuffer = openglCreateFramebuffer,
|
._gnCreateFramebuffer = openglCreateFramebuffer,
|
||||||
._gnDestroyFramebuffer = openglDestroyFramebuffer,
|
._gnDestroyFramebuffer = openglDestroyFramebuffer,
|
||||||
|
@@ -0,0 +1,16 @@
|
|||||||
|
#include "opengl_graphics_pipeline.h"
|
||||||
|
#include "shaders/opengl_shader_module.h"
|
||||||
|
|
||||||
|
gnReturnCode openglCreateGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gnOutputDevice device, gnGraphicsPipelineInfo info) {
|
||||||
|
graphicsPipeline->graphicsPipeline = malloc(sizeof(gnPlatformGraphicsPipeline));
|
||||||
|
graphicsPipeline->graphicsPipeline->program = glCreateProgram();
|
||||||
|
for (int i = 0; i < info.shaderModuleCount; i++) {
|
||||||
|
glAttachShader(graphicsPipeline->graphicsPipeline->program, info.shaderModules[i]->shaderModule->id);
|
||||||
|
}
|
||||||
|
glLinkProgram(graphicsPipeline->graphicsPipeline->program);
|
||||||
|
return GN_SUCCESS;
|
||||||
|
}
|
||||||
|
void openglDestroyGraphicsPipeline(gnGraphicsPipeline graphicsPipeline) {
|
||||||
|
glDeleteProgram(graphicsPipeline->graphicsPipeline->program);
|
||||||
|
free(graphicsPipeline->graphicsPipeline);
|
||||||
|
}
|
@@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
#include "glad/glad.h"
|
||||||
|
#include "core/src/pipelines/graphics_pipeline/gryphn_graphics_pipeline.h"
|
||||||
|
|
||||||
|
typedef struct gnPlatformGraphicsPipeline_t {
|
||||||
|
GLuint program;
|
||||||
|
} gnPlatformGraphicsPipeline;
|
||||||
|
|
||||||
|
gnReturnCode openglCreateGraphicsPipeline(gnGraphicsPipeline graphicsPipeline, gnOutputDevice device, gnGraphicsPipelineInfo info);
|
||||||
|
void openglDestroyGraphicsPipeline(gnGraphicsPipeline graphicsPipeline);
|
Reference in New Issue
Block a user