diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-05-29 14:10:55 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-05-29 14:10:55 +1000 |
commit | 824579234685171f0ca78674c7c18dfe6b43fe6e (patch) | |
tree | af7d9de2d81fb0b16db26ee09ea9456aae248ec9 | |
parent | 8d116bd23d9441e33cb3377e90c08169109b438a (diff) |
start adding opengl backend
-rw-r--r-- | examples/cube/ex_cube.c | 4 | ||||
-rw-r--r-- | src/renderer/backends/backend_opengl.c | 171 | ||||
-rw-r--r-- | src/renderer/backends/backend_vulkan.c | 4 | ||||
-rw-r--r-- | src/renderer/backends/backend_vulkan.h | 3 | ||||
-rw-r--r-- | src/renderer/backends/opengl/backend_opengl.c | 265 | ||||
-rw-r--r-- | src/renderer/backends/opengl/backend_opengl.h | 28 | ||||
-rw-r--r-- | src/renderer/render_types.h | 4 | ||||
-rw-r--r-- | xmake.lua | 14 |
8 files changed, 314 insertions, 179 deletions
diff --git a/examples/cube/ex_cube.c b/examples/cube/ex_cube.c index 68ce0d5..b87071f 100644 --- a/examples/cube/ex_cube.c +++ b/examples/cube/ex_cube.c @@ -125,8 +125,8 @@ int main() { .scale = 1.0 }; mat4 model = transform_to_mat(&transform); mat4 view, proj; - camera_view_projection(&cam, g_core.renderer.swapchain.extent.width, - g_core.renderer.swapchain.extent.height, &view, &proj); + camera_view_projection(&cam, g_core.renderer.swapchain.dimensions.x, + g_core.renderer.swapchain.dimensions.y, &view, &proj); mvp_uniforms mvp_data = { .model = model, .view = view, .projection = proj }; my_shader_bind_group shader_bind_data = { .mvp = mvp_data, .tex = texture }; mvp_uniforms_data.data = &shader_bind_data; diff --git a/src/renderer/backends/backend_opengl.c b/src/renderer/backends/backend_opengl.c deleted file mode 100644 index 4cd97b5..0000000 --- a/src/renderer/backends/backend_opengl.c +++ /dev/null @@ -1,171 +0,0 @@ -#include <stdlib.h> -#include "camera.h" -#define CEL_PLATFORM_LINUX - -#include "defines.h" -#include "file.h" -#include "log.h" -#include "maths_types.h" -#include "ral.h" - -#if CEL_REND_BACKEND_OPENGL - -#include <glad/glad.h> - -#include <glfw3.h> - -/** @brief Internal backend state */ -typedef struct opengl_state { -} opengl_state; - -bool gfx_backend_init(renderer *ren) { - INFO("loading OpenGL backend"); - - // glfwInit(); // Already handled in `renderer_init` - glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); - glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); - - // glad: load all OpenGL function pointers - if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { - ERROR("Failed to initialise GLAD \n"); - - return false; - } - - glEnable(GL_DEPTH_TEST); - - opengl_state *internal = malloc(sizeof(opengl_state)); - ren->backend_context = (void *)internal; - - return true; -} - -void gfx_backend_draw_frame(renderer *ren, camera *cam, mat4 model, texture *tex) {} - -void gfx_backend_shutdown(renderer *ren) {} - -void uniform_vec3f(u32 program_id, const char *uniform_name, vec3 *value) { - glUniform3fv(glGetUniformLocation(program_id, uniform_name), 1, &value->x); -} -void uniform_f32(u32 program_id, const char *uniform_name, f32 value) { - glUniform1f(glGetUniformLocation(program_id, uniform_name), value); -} -void uniform_i32(u32 program_id, const char *uniform_name, i32 value) { - glUniform1i(glGetUniformLocation(program_id, uniform_name), value); -} -void uniform_mat4f(u32 program_id, const char *uniform_name, mat4 *value) { - glUniformMatrix4fv(glGetUniformLocation(program_id, uniform_name), 1, GL_FALSE, value->data); -} - -void clear_screen(vec3 colour) { - glClearColor(colour.x, colour.y, colour.z, 1.0f); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); -} - -void texture_data_upload(texture *tex) { - printf("Texture name %s\n", tex->name); - TRACE("Upload texture data"); - u32 texture_id; - glGenTextures(1, &texture_id); - glBindTexture(GL_TEXTURE_2D, texture_id); - tex->texture_id = texture_id; - - // set the texture wrapping parameters - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, - GL_REPEAT); // set texture wrapping to GL_REPEAT (default wrapping method) - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - // set texture filtering parameters - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, tex->width, tex->height, 0, tex->channel_type, - GL_UNSIGNED_BYTE, tex->image_data); - glGenerateMipmap(GL_TEXTURE_2D); - DEBUG("Freeing texture image data after uploading to GPU"); - // stbi_image_free(tex->image_data); // data is on gpu now so we dont need it around -} - -void bind_texture(shader s, texture *tex, u32 slot) { - // printf("bind texture slot %d with texture id %d \n", slot, tex->texture_id); - glActiveTexture(GL_TEXTURE0 + slot); - glBindTexture(GL_TEXTURE_2D, tex->texture_id); -} - -void bind_mesh_vertex_buffer(void *_backend, mesh *mesh) { glBindVertexArray(mesh->vao); } - -static inline GLenum to_gl_prim_topology(enum cel_primitive_topology primitive) { - switch (primitive) { - case CEL_PRIMITIVE_TOPOLOGY_TRIANGLE: - return GL_TRIANGLES; - case CEL_PRIMITIVE_TOPOLOGY_POINT: - case CEL_PRIMITIVE_TOPOLOGY_LINE: - case CEL_PRIMITIVE_TOPOLOGY_LINE_STRIP: - case CEL_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP: - case CEL_PRIMITIVE_TOPOLOGY_COUNT: - break; - } -} - -void draw_primitives(cel_primitive_topology primitive, u32 start_index, u32 count) { - u32 gl_primitive = to_gl_prim_topology(primitive); - glDrawArrays(gl_primitive, start_index, count); -} - -shader shader_create_separate(const char *vert_shader, const char *frag_shader) { - INFO("Load shaders at %s and %s", vert_shader, frag_shader); - int success; - char info_log[512]; - - u32 vertex = glCreateShader(GL_VERTEX_SHADER); - const char *vertex_shader_src = string_from_file(vert_shader); - if (vertex_shader_src == NULL) { - ERROR("EXIT: couldnt load shader"); - exit(-1); - } - glShaderSource(vertex, 1, &vertex_shader_src, NULL); - glCompileShader(vertex); - glGetShaderiv(vertex, GL_COMPILE_STATUS, &success); - if (!success) { - glGetShaderInfoLog(vertex, 512, NULL, info_log); - printf("%s\n", info_log); - ERROR("EXIT: vertex shader compilation failed"); - exit(-1); - } - - // fragment shader - u32 fragment = glCreateShader(GL_FRAGMENT_SHADER); - const char *fragment_shader_src = string_from_file(frag_shader); - if (fragment_shader_src == NULL) { - ERROR("EXIT: couldnt load shader"); - exit(-1); - } - glShaderSource(fragment, 1, &fragment_shader_src, NULL); - glCompileShader(fragment); - glGetShaderiv(fragment, GL_COMPILE_STATUS, &success); - if (!success) { - glGetShaderInfoLog(fragment, 512, NULL, info_log); - printf("%s\n", info_log); - ERROR("EXIT: fragment shader compilation failed"); - exit(-1); - } - - u32 shader_prog; - shader_prog = glCreateProgram(); - - glAttachShader(shader_prog, vertex); - glAttachShader(shader_prog, fragment); - glLinkProgram(shader_prog); - glDeleteShader(vertex); - glDeleteShader(fragment); - free((char *)vertex_shader_src); - free((char *)fragment_shader_src); - - shader s = { .program_id = shader_prog }; - return s; -} - -void set_shader(shader s) { glUseProgram(s.program_id); } - -#endif
\ No newline at end of file diff --git a/src/renderer/backends/backend_vulkan.c b/src/renderer/backends/backend_vulkan.c index 2f8fdf7..10358f1 100644 --- a/src/renderer/backends/backend_vulkan.c +++ b/src/renderer/backends/backend_vulkan.c @@ -1,3 +1,5 @@ +#if defined (CEL_REND_BACKEND_VULKAN) + #include <assert.h> #include <glfw3.h> #include <stddef.h> @@ -1708,3 +1710,5 @@ void backend_pools_init(arena* a, gpu_backend_pools* backend_pools) { context.gpu_pools; } + +#endif
\ No newline at end of file diff --git a/src/renderer/backends/backend_vulkan.h b/src/renderer/backends/backend_vulkan.h index dc0f7bd..d92aa77 100644 --- a/src/renderer/backends/backend_vulkan.h +++ b/src/renderer/backends/backend_vulkan.h @@ -1,4 +1,5 @@ #pragma once +#if defined (CEL_REND_BACKEND_VULKAN) #include <vulkan/vk_platform.h> #include <vulkan/vulkan.h> #include <vulkan/vulkan_core.h> @@ -35,6 +36,7 @@ typedef struct gpu_swapchain { VkSwapchainKHR handle; arena swapchain_arena; VkExtent2D extent; + u32x2 dimensions; VkSurfaceFormatKHR image_format; VkPresentModeKHR present_mode; u32 image_count; @@ -113,3 +115,4 @@ typedef struct gpu_texture { VkSampler sampler; char* debug_label; } gpu_texture; +#endif
\ No newline at end of file diff --git a/src/renderer/backends/opengl/backend_opengl.c b/src/renderer/backends/opengl/backend_opengl.c new file mode 100644 index 0000000..4ceba8f --- /dev/null +++ b/src/renderer/backends/opengl/backend_opengl.c @@ -0,0 +1,265 @@ +#define CEL_REND_BACKEND_OPENGL +#if defined(CEL_REND_BACKEND_OPENGL) +#include <stdlib.h> +#include "camera.h" + +#include "defines.h" +#include "file.h" +#include "log.h" +#include "maths_types.h" +#include "ral.h" +#include "backend_opengl.h" + +#include <glad/glad.h> +#include <glfw3.h> + +typedef struct opengl_context {} opengl_context; + +static opengl_context context; + +struct GLFWwindow; + +bool gpu_backend_init(const char* window_name, struct GLFWwindow* window) { + INFO("loading OpenGL backend"); + glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); + glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); + + return true; +} + +void gpu_backend_shutdown() {} +void resource_pools_init(arena* a, struct resource_pools* res_pools) {} + +bool gpu_device_create(gpu_device* out_device) {} +void gpu_device_destroy() {} + +// --- Render Pipeline +gpu_pipeline* gpu_graphics_pipeline_create(struct graphics_pipeline_desc description) {} +void gpu_pipeline_destroy(gpu_pipeline* pipeline) {} + +// --- Renderpass +gpu_renderpass* gpu_renderpass_create(const gpu_renderpass_desc* description) {} +void gpu_renderpass_destroy(gpu_renderpass* pass) {} + +// --- Swapchain +bool gpu_swapchain_create(gpu_swapchain* out_swapchain) {} +void gpu_swapchain_destroy(gpu_swapchain* swapchain) {} + +// --- Command buffer +gpu_cmd_encoder gpu_cmd_encoder_create(); +void gpu_cmd_encoder_destroy(gpu_cmd_encoder* encoder) {} +void gpu_cmd_encoder_begin(gpu_cmd_encoder encoder) {} +void gpu_cmd_encoder_begin_render(gpu_cmd_encoder* encoder, gpu_renderpass* renderpass) {} +void gpu_cmd_encoder_end_render(gpu_cmd_encoder* encoder) {} +void gpu_cmd_encoder_begin_compute() {} +gpu_cmd_encoder* gpu_get_default_cmd_encoder() {} + +/** @brief Finish recording and return a command buffer that can be submitted to a queue */ +gpu_cmd_buffer gpu_cmd_encoder_finish(gpu_cmd_encoder* encoder) {} + +void gpu_queue_submit(gpu_cmd_buffer* buffer) {} + +// --- Data copy commands +/** @brief Copy data from one buffer to another */ +void encode_buffer_copy(gpu_cmd_encoder* encoder, buffer_handle src, u64 src_offset, + buffer_handle dst, u64 dst_offset, u64 copy_size) {} +/** @brief Upload CPU-side data as array of bytes to a GPU buffer */ +void buffer_upload_bytes(buffer_handle gpu_buf, bytebuffer cpu_buf, u64 offset, u64 size) {} + +/** @brief Copy data from buffer to buffer using a one time submit command buffer and a wait */ +void copy_buffer_to_buffer_oneshot(buffer_handle src, u64 src_offset, buffer_handle dst, + u64 dst_offset, u64 copy_size) {} +/** @brief Copy data from buffer to an image using a one time submit command buffer */ +void copy_buffer_to_image_oneshot(buffer_handle src, texture_handle dst) {} + +// --- Render commands +void encode_bind_pipeline(gpu_cmd_encoder* encoder, pipeline_kind kind, gpu_pipeline* pipeline) {} +void encode_bind_shader_data(gpu_cmd_encoder* encoder, u32 group, shader_data* data) {} +void encode_set_default_settings(gpu_cmd_encoder* encoder) {} +void encode_set_vertex_buffer(gpu_cmd_encoder* encoder, buffer_handle buf) {} +void encode_set_index_buffer(gpu_cmd_encoder* encoder, buffer_handle buf) {} +void encode_draw(gpu_cmd_encoder* encoder) {} +void encode_draw_indexed(gpu_cmd_encoder* encoder, u64 index_count) {} +void encode_clear_buffer(gpu_cmd_encoder* encoder, buffer_handle buf) {} + +// --- Buffers +buffer_handle gpu_buffer_create(u64 size, gpu_buffer_type buf_type, gpu_buffer_flags flags, + const void* data) {} +void gpu_buffer_destroy(buffer_handle buffer) {} +void gpu_buffer_upload(const void* data) {} + +// Textures +/** @brief Create a new GPU texture resource. + * @param create_view creates a texture view (with same dimensions) at the same time + * @param data if not NULL then the data stored at the pointer will be uploaded to the GPU texture + * @note automatically creates a sampler for you */ +texture_handle gpu_texture_create(texture_desc desc, bool create_view, const void* data) {} +void gpu_texture_destroy(texture_handle) {} +void gpu_texture_upload(texture_handle texture, const void* data) {} + +// --- Vertex formats +bytebuffer vertices_as_bytebuffer(arena* a, vertex_format format, vertex_darray* vertices) {} + +// --- TEMP +bool gpu_backend_begin_frame() { return true; } +void gpu_backend_end_frame() {} +void gpu_temp_draw(size_t n_verts) {} + + +// /** @brief Internal backend state */ +// typedef struct opengl_state { +// } opengl_state; + +// bool gfx_backend_init(renderer *ren) { +// INFO("loading OpenGL backend"); + +// // glfwInit(); // Already handled in `renderer_init` +// glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4); +// glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1); +// glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); +// glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); + +// // glad: load all OpenGL function pointers +// if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) { +// ERROR("Failed to initialise GLAD \n"); + +// return false; +// } + +// glEnable(GL_DEPTH_TEST); + +// opengl_state *internal = malloc(sizeof(opengl_state)); +// ren->backend_context = (void *)internal; + +// return true; +// } + +// void gfx_backend_draw_frame(renderer *ren, camera *cam, mat4 model, texture *tex) {} + +// void gfx_backend_shutdown(renderer *ren) {} + +// void uniform_vec3f(u32 program_id, const char *uniform_name, vec3 *value) { +// glUniform3fv(glGetUniformLocation(program_id, uniform_name), 1, &value->x); +// } +// void uniform_f32(u32 program_id, const char *uniform_name, f32 value) { +// glUniform1f(glGetUniformLocation(program_id, uniform_name), value); +// } +// void uniform_i32(u32 program_id, const char *uniform_name, i32 value) { +// glUniform1i(glGetUniformLocation(program_id, uniform_name), value); +// } +// void uniform_mat4f(u32 program_id, const char *uniform_name, mat4 *value) { +// glUniformMatrix4fv(glGetUniformLocation(program_id, uniform_name), 1, GL_FALSE, value->data); +// } + +// void clear_screen(vec3 colour) { +// glClearColor(colour.x, colour.y, colour.z, 1.0f); +// glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +// } + +// void texture_data_upload(texture *tex) { +// printf("Texture name %s\n", tex->name); +// TRACE("Upload texture data"); +// u32 texture_id; +// glGenTextures(1, &texture_id); +// glBindTexture(GL_TEXTURE_2D, texture_id); +// tex->texture_id = texture_id; + +// // set the texture wrapping parameters +// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, +// GL_REPEAT); // set texture wrapping to GL_REPEAT (default wrapping method) +// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); +// // set texture filtering parameters +// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); +// glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + +// glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, tex->width, tex->height, 0, tex->channel_type, +// GL_UNSIGNED_BYTE, tex->image_data); +// glGenerateMipmap(GL_TEXTURE_2D); +// DEBUG("Freeing texture image data after uploading to GPU"); +// // stbi_image_free(tex->image_data); // data is on gpu now so we dont need it around +// } + +// void bind_texture(shader s, texture *tex, u32 slot) { +// // printf("bind texture slot %d with texture id %d \n", slot, tex->texture_id); +// glActiveTexture(GL_TEXTURE0 + slot); +// glBindTexture(GL_TEXTURE_2D, tex->texture_id); +// } + +// void bind_mesh_vertex_buffer(void *_backend, mesh *mesh) { glBindVertexArray(mesh->vao); } + +// static inline GLenum to_gl_prim_topology(enum cel_primitive_topology primitive) { +// switch (primitive) { +// case CEL_PRIMITIVE_TOPOLOGY_TRIANGLE: +// return GL_TRIANGLES; +// case CEL_PRIMITIVE_TOPOLOGY_POINT: +// case CEL_PRIMITIVE_TOPOLOGY_LINE: +// case CEL_PRIMITIVE_TOPOLOGY_LINE_STRIP: +// case CEL_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP: +// case CEL_PRIMITIVE_TOPOLOGY_COUNT: +// break; +// } +// } + +// void draw_primitives(cel_primitive_topology primitive, u32 start_index, u32 count) { +// u32 gl_primitive = to_gl_prim_topology(primitive); +// glDrawArrays(gl_primitive, start_index, count); +// } + +// shader shader_create_separate(const char *vert_shader, const char *frag_shader) { +// INFO("Load shaders at %s and %s", vert_shader, frag_shader); +// int success; +// char info_log[512]; + +// u32 vertex = glCreateShader(GL_VERTEX_SHADER); +// const char *vertex_shader_src = string_from_file(vert_shader); +// if (vertex_shader_src == NULL) { +// ERROR("EXIT: couldnt load shader"); +// exit(-1); +// } +// glShaderSource(vertex, 1, &vertex_shader_src, NULL); +// glCompileShader(vertex); +// glGetShaderiv(vertex, GL_COMPILE_STATUS, &success); +// if (!success) { +// glGetShaderInfoLog(vertex, 512, NULL, info_log); +// printf("%s\n", info_log); +// ERROR("EXIT: vertex shader compilation failed"); +// exit(-1); +// } + +// // fragment shader +// u32 fragment = glCreateShader(GL_FRAGMENT_SHADER); +// const char *fragment_shader_src = string_from_file(frag_shader); +// if (fragment_shader_src == NULL) { +// ERROR("EXIT: couldnt load shader"); +// exit(-1); +// } +// glShaderSource(fragment, 1, &fragment_shader_src, NULL); +// glCompileShader(fragment); +// glGetShaderiv(fragment, GL_COMPILE_STATUS, &success); +// if (!success) { +// glGetShaderInfoLog(fragment, 512, NULL, info_log); +// printf("%s\n", info_log); +// ERROR("EXIT: fragment shader compilation failed"); +// exit(-1); +// } + +// u32 shader_prog; +// shader_prog = glCreateProgram(); + +// glAttachShader(shader_prog, vertex); +// glAttachShader(shader_prog, fragment); +// glLinkProgram(shader_prog); +// glDeleteShader(vertex); +// glDeleteShader(fragment); +// free((char *)vertex_shader_src); +// free((char *)fragment_shader_src); + +// shader s = { .program_id = shader_prog }; +// return s; +// } + +// void set_shader(shader s) { glUseProgram(s.program_id); } + +#endif
\ No newline at end of file diff --git a/src/renderer/backends/opengl/backend_opengl.h b/src/renderer/backends/opengl/backend_opengl.h new file mode 100644 index 0000000..3bc742d --- /dev/null +++ b/src/renderer/backends/opengl/backend_opengl.h @@ -0,0 +1,28 @@ +#pragma once + +#define CEL_REND_BACKEND_OPENGL + +#if defined(CEL_REND_BACKEND_OPENGL) + +#include "defines.h" +#include "maths_types.h" + +typedef struct gpu_swapchain { + u32x2 dimensions; +} gpu_swapchain; +typedef struct gpu_device {} gpu_device; +typedef struct gpu_pipeline_layout {} gpu_pipeline_layout; +typedef struct gpu_pipeline {} gpu_pipeline; +typedef struct gpu_renderpass {} gpu_renderpass; +typedef struct gpu_cmd_encoder {} gpu_cmd_encoder; // Recording +typedef struct gpu_cmd_buffer {} gpu_cmd_buffer; // Ready for submission + +typedef struct gpu_buffer { + union { + u32 vbo; + u32 ibo; + } id; +} gpu_buffer; +typedef struct gpu_texture {} gpu_texture; + +#endif
\ No newline at end of file diff --git a/src/renderer/render_types.h b/src/renderer/render_types.h index cc5fd93..ed5c6e1 100644 --- a/src/renderer/render_types.h +++ b/src/renderer/render_types.h @@ -15,7 +15,11 @@ #if defined(CEL_PLATFORM_WINDOWS) // #include "backend_dx11.h" #endif +#if defined (CEL_REND_BACKEND_VULKAN) #include "backend_vulkan.h" +#elif defined (CEL_REND_BACKEND_OPENGL) +#include "backend_opengl.h" +#endif struct GLFWwindow; @@ -62,6 +62,7 @@ local core_sources = { "src/physics/*.c", "src/renderer/*.c", "src/renderer/backends/*.c", + "src/renderer/backends/opengl/*.c", "src/resources/*.c", "src/std/*.c", "src/std/containers/*.c", @@ -113,17 +114,18 @@ target("core_config") add_includedirs("src/physics/", {public = true}) add_includedirs("src/renderer/", {public = true}) add_includedirs("src/renderer/backends/", {public = true}) + add_includedirs("src/renderer/backends/opengl", {public = true}) add_includedirs("src/resources/", {public = true}) add_includedirs("src/std/", {public = true}) add_includedirs("src/std/containers", {public = true}) add_includedirs("src/systems/", {public = true}) add_files("src/empty.c") -- for some reason we need this on Mac so it doesnt call 'ar' with no files and error - add_rules("compile_glsl_vert_shaders") - add_rules("compile_glsl_frag_shaders") - add_files("assets/shaders/triangle.vert") - add_files("assets/shaders/triangle.frag") - add_files("assets/shaders/cube.vert") - add_files("assets/shaders/cube.frag") + -- add_rules("compile_glsl_vert_shaders") + -- add_rules("compile_glsl_frag_shaders") + -- add_files("assets/shaders/triangle.vert") + -- add_files("assets/shaders/triangle.frag") + -- add_files("assets/shaders/cube.vert") + -- add_files("assets/shaders/cube.frag") -- add_files("assets/shaders/*.frag") if is_plat("windows") then add_includedirs("$(env VULKAN_SDK)/Include", {public = true}) |