summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOmniscient <omniscient.oce@gmail.com>2024-06-07 12:13:22 +1000
committerOmniscient <omniscient.oce@gmail.com>2024-06-07 12:13:22 +1000
commit5751ffae2eb8f786edb2dcd9e7f635fd1d0c1331 (patch)
tree237e4cf25f97210d180395871e75550352e9badb /src
parent44188d921c13111b61904f98ad06f8249e41d050 (diff)
chore: fmt
Diffstat (limited to 'src')
-rw-r--r--src/renderer/backends/backend_vulkan.c2
-rw-r--r--src/renderer/backends/backend_vulkan.h2
-rw-r--r--src/renderer/backends/opengl/backend_opengl.c27
-rw-r--r--src/renderer/backends/opengl/backend_opengl.h24
-rw-r--r--src/renderer/ral_types.h7
-rw-r--r--src/renderer/render_types.h4
-rw-r--r--src/std/mem.c2
-rw-r--r--src/std/mem.h2
8 files changed, 35 insertions, 35 deletions
diff --git a/src/renderer/backends/backend_vulkan.c b/src/renderer/backends/backend_vulkan.c
index 4ef1e31..06d8898 100644
--- a/src/renderer/backends/backend_vulkan.c
+++ b/src/renderer/backends/backend_vulkan.c
@@ -1699,6 +1699,4 @@ void vulkan_transition_image_layout(gpu_texture* texture, VkFormat format, VkIma
/* context.resource_pools = res_pools; */
/* } */
-
-
#endif
diff --git a/src/renderer/backends/backend_vulkan.h b/src/renderer/backends/backend_vulkan.h
index d92aa77..21a80ba 100644
--- a/src/renderer/backends/backend_vulkan.h
+++ b/src/renderer/backends/backend_vulkan.h
@@ -1,5 +1,5 @@
#pragma once
-#if defined (CEL_REND_BACKEND_VULKAN)
+#if defined(CEL_REND_BACKEND_VULKAN)
#include <vulkan/vk_platform.h>
#include <vulkan/vulkan.h>
#include <vulkan/vulkan_core.h>
diff --git a/src/renderer/backends/opengl/backend_opengl.c b/src/renderer/backends/opengl/backend_opengl.c
index cb25b46..0cd2925 100644
--- a/src/renderer/backends/opengl/backend_opengl.c
+++ b/src/renderer/backends/opengl/backend_opengl.c
@@ -105,9 +105,7 @@ void gpu_cmd_encoder_begin_render(gpu_cmd_encoder* encoder, gpu_renderpass* rend
}
void gpu_cmd_encoder_end_render(gpu_cmd_encoder* encoder) {}
void gpu_cmd_encoder_begin_compute() {}
-gpu_cmd_encoder* gpu_get_default_cmd_encoder() {
- return &context.command_buffer;
-}
+gpu_cmd_encoder* gpu_get_default_cmd_encoder() { return &context.command_buffer; }
/** @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) {}
@@ -138,7 +136,6 @@ void encode_bind_shader_data(gpu_cmd_encoder* encoder, u32 group, shader_data* d
for (u32 i = 0; i < sdl.bindings_count; i++) {
shader_binding binding = sdl.bindings[i];
-
}
}
void encode_set_default_settings(gpu_cmd_encoder* encoder) {}
@@ -193,18 +190,16 @@ bytebuffer vertices_as_bytebuffer(arena* a, vertex_format format, vertex_darray*
// --- TEMP
bool gpu_backend_begin_frame() { return true; }
-void gpu_backend_end_frame() {
- glfwSwapBuffers(context.window);
-}
+void gpu_backend_end_frame() { glfwSwapBuffers(context.window); }
void gpu_temp_draw(size_t n_verts) {}
-u32 shader_create_separate(const char *vert_shader, const char *frag_shader){
+u32 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);
+ const char* vertex_shader_src = string_from_file(vert_shader);
if (vertex_shader_src == NULL) {
ERROR("EXIT: couldnt load shader");
exit(-1);
@@ -221,7 +216,7 @@ u32 shader_create_separate(const char *vert_shader, const char *frag_shader){
// fragment shader
u32 fragment = glCreateShader(GL_FRAGMENT_SHADER);
- const char *fragment_shader_src = string_from_file(frag_shader);
+ const char* fragment_shader_src = string_from_file(frag_shader);
if (fragment_shader_src == NULL) {
ERROR("EXIT: couldnt load shader");
exit(-1);
@@ -244,8 +239,8 @@ u32 shader_create_separate(const char *vert_shader, const char *frag_shader){
glLinkProgram(shader_prog);
glDeleteShader(vertex);
glDeleteShader(fragment);
- free((char *)vertex_shader_src);
- free((char *)fragment_shader_src);
+ free((char*)vertex_shader_src);
+ free((char*)fragment_shader_src);
return shader_prog;
}
@@ -282,16 +277,16 @@ u32 shader_create_separate(const char *vert_shader, const char *frag_shader){
// void gfx_backend_shutdown(renderer *ren) {}
-void uniform_vec3f(u32 program_id, const char *uniform_name, vec3 *value) {
+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) {
+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) {
+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) {
+void uniform_mat4f(u32 program_id, const char* uniform_name, mat4* value) {
glUniformMatrix4fv(glGetUniformLocation(program_id, uniform_name), 1, GL_FALSE, value->data);
}
diff --git a/src/renderer/backends/opengl/backend_opengl.h b/src/renderer/backends/opengl/backend_opengl.h
index 0ce765a..14a46f9 100644
--- a/src/renderer/backends/opengl/backend_opengl.h
+++ b/src/renderer/backends/opengl/backend_opengl.h
@@ -8,15 +8,24 @@
typedef struct gpu_swapchain {
u32x2 dimensions;
} gpu_swapchain;
-typedef struct gpu_device {} gpu_device;
-typedef struct gpu_pipeline_layout { void* pad } gpu_pipeline_layout;
+typedef struct gpu_device {
+} gpu_device;
+typedef struct gpu_pipeline_layout {
+ void *pad
+} gpu_pipeline_layout;
typedef struct gpu_pipeline {
u32 shader_id;
u32 pad;
} gpu_pipeline;
-typedef struct gpu_renderpass { void* pad } gpu_renderpass;
-typedef struct gpu_cmd_encoder { void* pad } gpu_cmd_encoder; // Recording
-typedef struct gpu_cmd_buffer { void* pad } gpu_cmd_buffer; // Ready for submission
+typedef struct gpu_renderpass {
+ void *pad
+} gpu_renderpass;
+typedef struct gpu_cmd_encoder {
+ void *pad
+} gpu_cmd_encoder; // Recording
+typedef struct gpu_cmd_buffer {
+ void *pad
+} gpu_cmd_buffer; // Ready for submission
typedef struct gpu_buffer {
union {
@@ -25,8 +34,9 @@ typedef struct gpu_buffer {
} id;
u32 pad;
} gpu_buffer;
-typedef struct gpu_texture { void* pad } gpu_texture;
-
+typedef struct gpu_texture {
+ void *pad
+} gpu_texture;
u32 shader_create_separate(const char *vert_shader, const char *frag_shader);
diff --git a/src/renderer/ral_types.h b/src/renderer/ral_types.h
index 5cbf6fd..415796c 100644
--- a/src/renderer/ral_types.h
+++ b/src/renderer/ral_types.h
@@ -78,11 +78,8 @@ typedef enum gpu_buffer_type {
} gpu_buffer_type;
static const char* buffer_type_names[] = {
- "RAL Buffer Default",
- "RAL Buffer Vertex",
- "RAL Buffer Index",
- "RAL Buffer Uniform",
- "RAL Buffer Count",
+ "RAL Buffer Default", "RAL Buffer Vertex", "RAL Buffer Index",
+ "RAL Buffer Uniform", "RAL Buffer Count",
};
typedef enum gpu_buffer_flag {
diff --git a/src/renderer/render_types.h b/src/renderer/render_types.h
index aeedf85..63e5b29 100644
--- a/src/renderer/render_types.h
+++ b/src/renderer/render_types.h
@@ -15,9 +15,9 @@
#if defined(CEL_PLATFORM_WINDOWS)
// #include "backend_dx11.h"
#endif
-#if defined (CEL_REND_BACKEND_VULKAN)
+#if defined(CEL_REND_BACKEND_VULKAN)
#include "backend_vulkan.h"
-#elif defined (CEL_REND_BACKEND_OPENGL)
+#elif defined(CEL_REND_BACKEND_OPENGL)
#include "backend_opengl.h"
#endif
diff --git a/src/std/mem.c b/src/std/mem.c
index a5a0b88..ede1db4 100644
--- a/src/std/mem.c
+++ b/src/std/mem.c
@@ -50,7 +50,7 @@ void_pool void_pool_create(arena* a, const char* debug_label, u64 capacity, u64
size_t memory_requirements = capacity * entry_size;
void* backing_buf = arena_alloc(a, memory_requirements);
- assert(entry_size >= sizeof(void_pool_header)); // TODO: create my own assert with error message
+ assert(entry_size >= sizeof(void_pool_header)); // TODO: create my own assert with error message
void_pool pool = { .capacity = capacity,
.entry_size = entry_size,
diff --git a/src/std/mem.h b/src/std/mem.h
index b256e27..6e76763 100644
--- a/src/std/mem.h
+++ b/src/std/mem.h
@@ -69,7 +69,7 @@ void void_pool_dealloc(void_pool* pool, u32 raw_handle);
} Name##_pool; \
\
static Name##_pool Name##_pool_create(arena* a, u64 cap, u64 entry_size) { \
- void_pool p = void_pool_create(a, "\""#Name"\"", cap, entry_size); \
+ void_pool p = void_pool_create(a, "\"" #Name "\"", cap, entry_size); \
return (Name##_pool){ .inner = p }; \
} \
static inline T* Name##_pool_get(Name##_pool* pool, Name##_handle handle) { \