diff options
Diffstat (limited to 'src/renderer/cleanroom')
-rw-r--r-- | src/renderer/cleanroom/backend_vulkan.c | 65 | ||||
-rw-r--r-- | src/renderer/cleanroom/backend_vulkan.h | 28 | ||||
-rw-r--r-- | src/renderer/cleanroom/immediate.c | 18 | ||||
-rw-r--r-- | src/renderer/cleanroom/immediate.h | 20 | ||||
-rw-r--r-- | src/renderer/cleanroom/types.h | 60 |
5 files changed, 0 insertions, 191 deletions
diff --git a/src/renderer/cleanroom/backend_vulkan.c b/src/renderer/cleanroom/backend_vulkan.c deleted file mode 100644 index 71a09f3..0000000 --- a/src/renderer/cleanroom/backend_vulkan.c +++ /dev/null @@ -1,65 +0,0 @@ -#include <stdlib.h> -#include "ral.h" -#include "types.h" -// #include "render_types.h" - -#define VULKAN_QUEUES_COUNT 2 -const char* queue_names[VULKAN_QUEUES_COUNT] = { "GRAPHICS", "TRANSFER" }; - -typedef struct gpu_device { -} gpu_device; - -typedef struct vulkan_context { - gpu_device device; - - VkInstance instance; - -} vulkan_context; - -static vulkan_context context; - -static bool select_physical_device(gpu_device* out_device) {} - -bool gpu_device_create(gpu_device* out_device) { - // Physical device - if (!select_physical_device(out_device)) { - return false; - } - INFO("Physical device selected"); - - // Logical device - VkDeviceQueueCreateInfo queue_create_info[2]; - //.. - VkDeviceCreateInfo device_create_info = { VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO }; - - VkResult result = vkCreateDevice(); - if (result != VK_SUCCESS) { - FATAL("Error creating logical device with status %u\n", result); - exit(1); - } - INFO("Logical device created"); - - // Queues - - // Create the command pool -} - -gpu_renderpass* gpu_renderpass_create() { - // Allocate it - // sets everything up - // return pointer to it -} - -void encode_set_pipeline(gpu_cmd_encoder* encoder, pipeline_type kind, gpu_pipeline* pipeline) { - // VK_PIPELINE_BIND_POINT_GRAPHICS, &shader->pipeline); - if (kind == PIPELINE_GRAPHICS) { - // ... - } else { - // ... - } -} - -// --- Drawing -inline void encode_draw_indexed(gpu_cmd_encoder* encoder, u64 index_count) { - vkCmdDrawIndexed(encoder->cmd_buffer, index_count, 1, 0, 0, 0); -}
\ No newline at end of file diff --git a/src/renderer/cleanroom/backend_vulkan.h b/src/renderer/cleanroom/backend_vulkan.h deleted file mode 100644 index c8d5777..0000000 --- a/src/renderer/cleanroom/backend_vulkan.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once -#include "cleanroom/ral.h" - -#define GPU_SWAPCHAIN_IMG_COUNT 2 - -typedef struct gpu_swapchain { -} gpu_swapchain; -typedef struct gpu_device { - // In Vulkan we store both physical and logical device here - VkPhysicalDevice physical_device; - VkDevice logical_device; - VkPhysicalDeviceProperties properties; - VkPhysicalDeviceFeatures features; - VkPhysicalDeviceMemoryProperties memory; - VkCommandPool pool; -} gpu_device; -typedef struct gpu_pipeline { -} gpu_pipeline; - -typedef struct gpu_renderpass { - VkRenderPass vk_handle; - VkFramebuffer framebuffers[GPU_SWAPCHAIN_IMG_COUNT]; - u32 -} gpu_renderpass; - -typedef struct gpu_cmd_encoder { - VkCommandBuffer cmd_buffer; -} gpu_cmd_encoder;
\ No newline at end of file diff --git a/src/renderer/cleanroom/immediate.c b/src/renderer/cleanroom/immediate.c deleted file mode 100644 index 8e4bf7e..0000000 --- a/src/renderer/cleanroom/immediate.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "immediate.h" -#include "maths.h" -#include "primitives.h" -#include "render.h" -#include "types.h" - -void imm_draw_sphere(vec3 pos, f32 radius, vec4 colour) { - // Create the vertices - geometry_data geometry = geo_create_uvsphere(radius, 16, 16); - geo_set_vertex_colours(&geometry, colour); - - // Upload to GPU - mat4 model = mat4_translation(pos); - - // Set pipeline - - // Draw -}
\ No newline at end of file diff --git a/src/renderer/cleanroom/immediate.h b/src/renderer/cleanroom/immediate.h deleted file mode 100644 index 6d93c53..0000000 --- a/src/renderer/cleanroom/immediate.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -#include "geometry.h" -#include "maths_types.h" - -// 3. SIMA (simplified immediate mode api) / render.h -// - dont need to worry about uploading mesh data -// - very useful for debugging -void imm_draw_cuboid(vec3 pos, quat rotation, f32x3 extents, vec4 colour); -void imm_draw_sphere(vec3 pos, f32 radius, vec4 colour); -void imm_draw_camera_frustum(); - -// static void imm_draw_model( -// const char* model_filepath); // tracks internally whether the model is loaded - -// static void imm_draw_model(const char* model_filepath) { - // check that model is loaded - // if not loaded, load model and upload to gpu - LRU cache for models - // else submit draw call -// }
\ No newline at end of file diff --git a/src/renderer/cleanroom/types.h b/src/renderer/cleanroom/types.h index 0a28b1c..7360ebe 100644 --- a/src/renderer/cleanroom/types.h +++ b/src/renderer/cleanroom/types.h @@ -4,63 +4,3 @@ #include "maths_types.h" #include "str.h" #include "render_types.h" - -// typedef struct transform_hierarchy { -// } transform_hierarchy; - - -/* - - render_types.h - - ral_types.h - - ral.h - - render.h ? -*/ - -/* render_types */ -typedef struct model pbr_material; -typedef struct model bp_material; // blinn-phong - - -// ? How to tie together materials and shaders - -// Three registers -// 1. low level graphics api calls "ral" -// 2. higher level render calls -// 3. simplified immediate mode API - -// 3 - you don't need to know how the renderer works at all -// 2 - you need to know how the overall renderer is designed -// 1 - you need to understand graphics API specifics - -/* ral.h */ - -// command buffer gubbins - -/* --- Backends */ - -// struct vulkan_backend { -// gpu_pipeline static_opaque_pipeline; -// gpu_pipeline skinned_opaque_pipeline; -// }; - -/* --- Renderer layer */ -/* render.h */ - - -// Drawing - -// void draw_mesh(gpu_cmd_encoder* encoder, mesh* mesh) { -// encode_set_vertex_buffer(encoder, mesh->vertex_buffer); -// encode_set_index_buffer(encoder, mesh->index_buffer); -// encode_draw_indexed(encoder, mesh->index_count) -// // vkCmdDrawIndexed -// } - -// void draw_scene(arena* frame, model_darray* models, renderer* ren, camera* camera, -// transform_hierarchy* tfh, scene* scene) { -// // set the pipeline first -// encode_set_pipeline() -// // in open this sets the shader -// // in vulkan it sets the whole pipeline - -// }
\ No newline at end of file |