summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOmniscient <omniscient.oce@gmail.com>2024-05-19 00:04:31 +1000
committerOmniscient <omniscient.oce@gmail.com>2024-05-19 00:04:31 +1000
commitebee348781e68e61f97c31411512dc0aabab7acb (patch)
tree2ce223f1ed3c60cdf617f319e8638eeea58e5d77 /src
parentb1b2d988e8f2fa3b0f63ff3aeb02849497433647 (diff)
chore: fmt
Diffstat (limited to 'src')
-rw-r--r--src/renderer/backends/backend_vulkan.c15
-rw-r--r--src/renderer/ral.h4
-rw-r--r--src/renderer/render.h10
-rw-r--r--src/renderer/render_types.h4
-rw-r--r--src/scene.h8
5 files changed, 21 insertions, 20 deletions
diff --git a/src/renderer/backends/backend_vulkan.c b/src/renderer/backends/backend_vulkan.c
index ae49cc3..33e0860 100644
--- a/src/renderer/backends/backend_vulkan.c
+++ b/src/renderer/backends/backend_vulkan.c
@@ -425,7 +425,7 @@ gpu_pipeline* gpu_graphics_pipeline_create(struct graphics_pipeline_desc descrip
attribute_descs[i].location = i;
attribute_descs[i].format = format_from_vertex_attr(description.vertex_desc.attributes[i]);
attribute_descs[i].offset = offset;
- size_t this_offset = vertex_attrib_size(description.vertex_desc.attributes[i]);
+ size_t this_offset = vertex_attrib_size(description.vertex_desc.attributes[i]);
printf("offset total %d this attr %ld\n", offset, this_offset);
printf("sizeof vertex %ld\n", sizeof(vertex));
/* printf("%d \n", offsetof(vertex, static_3d)); */
@@ -446,7 +446,9 @@ gpu_pipeline* gpu_graphics_pipeline_create(struct graphics_pipeline_desc descrip
// TODO: Generate this from descroiption now
VkVertexInputBindingDescription binding_desc;
binding_desc.binding = 0;
- binding_desc.stride = description.vertex_desc.use_full_vertex_size ? sizeof(vertex) : description.vertex_desc.stride;
+ binding_desc.stride = description.vertex_desc.use_full_vertex_size
+ ? sizeof(vertex)
+ : description.vertex_desc.stride;
binding_desc.inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
VkPipelineVertexInputStateCreateInfo vertex_input_info = {
@@ -561,8 +563,8 @@ gpu_pipeline* gpu_graphics_pipeline_create(struct graphics_pipeline_desc descrip
pipeline->desc_set_layouts = desc_set_layouts;
pipeline->desc_set_layouts_count = description.data_layouts_count;
if (description.data_layouts_count > 0) {
- pipeline->uniform_pointers =
- malloc(description.data_layouts_count * sizeof(desc_set_uniform_buffer));
+ pipeline->uniform_pointers =
+ malloc(description.data_layouts_count * sizeof(desc_set_uniform_buffer));
} else {
pipeline->uniform_pointers = NULL;
}
@@ -1349,8 +1351,7 @@ buffer_handle gpu_buffer_create(u64 size, gpu_buffer_type buf_type, gpu_buffer_f
}
void gpu_buffer_destroy(buffer_handle buffer) {
- gpu_buffer* b =
- buffer_pool_get(&context.resource_pools->buffers, buffer);
+ gpu_buffer* b = buffer_pool_get(&context.resource_pools->buffers, buffer);
vkDestroyBuffer(context.device->logical_device, b->handle, context.allocator);
vkFreeMemory(context.device->logical_device, b->memory, context.allocator);
buffer_pool_dealloc(&context.resource_pools->buffers, buffer);
@@ -1493,7 +1494,7 @@ texture_handle gpu_texture_create(texture_desc desc, const void* data) {
vkBindImageMemory(context.device->logical_device, image, image_memory, 0);
-gpu_buffer_destroy(staging);
+ gpu_buffer_destroy(staging);
texture_handle handle;
gpu_texture* texture = texture_pool_alloc(&context.resource_pools->textures, &handle);
diff --git a/src/renderer/ral.h b/src/renderer/ral.h
index 48be83a..a82a2ba 100644
--- a/src/renderer/ral.h
+++ b/src/renderer/ral.h
@@ -176,8 +176,8 @@ struct resource_pools {
// Must be implemented by backends
void resource_pools_init(arena* a, struct resource_pools* res_pools);
-void copy_buffer_to_buffer_oneshot(buffer_handle src, u64 src_offset, buffer_handle dst, u64 dst_offset,
- u64 copy_size);
+void copy_buffer_to_buffer_oneshot(buffer_handle src, u64 src_offset, buffer_handle dst,
+ u64 dst_offset, u64 copy_size);
void copy_buffer_to_image_oneshot(buffer_handle src, texture_handle dst);
// --- Helpers
diff --git a/src/renderer/render.h b/src/renderer/render.h
index 9a7ff2f..c193ff9 100644
--- a/src/renderer/render.h
+++ b/src/renderer/render.h
@@ -37,11 +37,11 @@ texture_handle texture_create(const char* debug_name, texture_desc description,
texture_data texture_data_load(const char* path, bool invert_y);
/**
- * @brief
- *
- * @param data
- * @param free_on_upload frees the CPU-side pixel data stored in `data`
- * @return texture_handle
+ * @brief
+ *
+ * @param data
+ * @param free_on_upload frees the CPU-side pixel data stored in `data`
+ * @return texture_handle
*/
texture_handle texture_data_upload(texture_data data, bool free_on_upload);
diff --git a/src/renderer/render_types.h b/src/renderer/render_types.h
index c6aec8e..cc5fd93 100644
--- a/src/renderer/render_types.h
+++ b/src/renderer/render_types.h
@@ -69,14 +69,14 @@ typedef struct model {
u32 mesh_count;
} model;
-typedef struct texture {} texture;
+typedef struct texture {
+} texture;
typedef struct texture_data {
texture_desc description;
void* image_data;
} texture_data;
-
typedef struct blinn_phong_material {
char name[256];
texture diffuse_texture;
diff --git a/src/scene.h b/src/scene.h
index 5a85e2e..5ac7542 100644
--- a/src/scene.h
+++ b/src/scene.h
@@ -32,10 +32,10 @@ void scene_free(scene* s);
// Simplified API - no scene pointer; gets and sets global scene
// Add/Remove objects from the scene
- /* vec3 direction; */
- /* vec3 ambient; */
- /* vec3 diffuse; */
- /* vec3 specular; */
+/* vec3 direction; */
+/* vec3 ambient; */
+/* vec3 diffuse; */
+/* vec3 specular; */
void scene_set_dir_light(directional_light light);
void _scene_set_dir_light(vec3 ambient, vec3 diffuse, vec3 specular, vec3 direction);