switch
This commit is contained in:
@@ -22,6 +22,9 @@ Pipeline* pipeline_create(GraphicsDevice* device, SwapChain* swap, Shader* shade
|
||||
pipeline->Swap = swap;
|
||||
pipeline->RelaventShader = shader;
|
||||
|
||||
pipeline->DescriptorSetLayoutCount = descriptorSetLayoutCount;
|
||||
pipeline->DescriptorSetLayouts = layouts;
|
||||
|
||||
auto bindingDescription
|
||||
= new VkVertexInputBindingDescription(scene::get_vert_binding_description());
|
||||
auto attributeDescriptions = new std::array<VkVertexInputAttributeDescription, 2>(
|
||||
@@ -56,7 +59,7 @@ Pipeline* pipeline_create(GraphicsDevice* device, SwapChain* swap, Shader* shade
|
||||
pipeline->Rasterizer.rasterizerDiscardEnable = VK_FALSE;
|
||||
pipeline->Rasterizer.polygonMode = VK_POLYGON_MODE_FILL;
|
||||
pipeline->Rasterizer.lineWidth = 1.f;
|
||||
pipeline->Rasterizer.cullMode = VK_CULL_MODE_NONE;
|
||||
pipeline->Rasterizer.cullMode = VK_CULL_MODE_BACK_BIT;
|
||||
pipeline->Rasterizer.frontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE;
|
||||
pipeline->Rasterizer.depthBiasEnable = VK_FALSE;
|
||||
pipeline->Rasterizer.depthBiasConstantFactor = 0.f; // Optional
|
||||
@@ -187,4 +190,20 @@ void pipeline_cleanup(Pipeline* pipeline)
|
||||
delete pipeline;
|
||||
}
|
||||
|
||||
void pipeline_recreate(Pipeline* pipeline)
|
||||
{
|
||||
vkDeviceWaitIdle(pipeline->Device->VulkanDevice);
|
||||
GraphicsDevice* device = pipeline->Device;
|
||||
SwapChain* swap = pipeline->Swap;
|
||||
|
||||
swapchain_recreate(swap);
|
||||
|
||||
Shader* shader = pipeline->RelaventShader;
|
||||
uint32_t descriptorSetLayoutCount = pipeline->DescriptorSetLayoutCount;
|
||||
VkDescriptorSetLayout* layouts = pipeline->DescriptorSetLayouts;
|
||||
|
||||
pipeline_cleanup(pipeline);
|
||||
pipeline = pipeline_create(device, swap, shader, descriptorSetLayoutCount, layouts);
|
||||
}
|
||||
|
||||
} // namespace inferno::graphics
|
||||
|
||||
@@ -14,6 +14,9 @@ typedef struct Pipeline {
|
||||
SwapChain* Swap;
|
||||
Shader* RelaventShader;
|
||||
|
||||
uint32_t DescriptorSetLayoutCount;
|
||||
VkDescriptorSetLayout* DescriptorSetLayouts;
|
||||
|
||||
VkPipeline GraphicsPipeline;
|
||||
VkPipelineLayout Layout;
|
||||
|
||||
@@ -32,4 +35,6 @@ Pipeline* pipeline_create(GraphicsDevice* device, SwapChain* swap, Shader* shade
|
||||
uint32_t descriptorSetLayoutCount, VkDescriptorSetLayout* layouts);
|
||||
void pipeline_cleanup(Pipeline* pipeline);
|
||||
|
||||
void pipeline_recreate(Pipeline* pipeline);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
#include "graphics/device.hpp"
|
||||
#include "window.hpp"
|
||||
|
||||
namespace inferno {
|
||||
#include "yolo/yolo.hpp"
|
||||
|
||||
inline void setupImGui(graphics::GraphicsDevice* device)
|
||||
namespace inferno::gui {
|
||||
|
||||
inline void imgui_init(graphics::GraphicsDevice* device)
|
||||
{
|
||||
// 1: create descriptor pool for IMGUI
|
||||
// the size of the pool is very oversize, but it's copied from imgui demo itself.
|
||||
VkDescriptorPoolSize pool_sizes[] = {
|
||||
{ VK_DESCRIPTOR_TYPE_SAMPLER, 1000 },
|
||||
{ VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 1000 },
|
||||
@@ -38,8 +38,7 @@ inline void setupImGui(graphics::GraphicsDevice* device)
|
||||
// this initializes the core structures of imgui
|
||||
ImGui::CreateContext();
|
||||
|
||||
// this initializes imgui for SDL
|
||||
ImGui_ImplGlfw_InitForVulkan(graphics::Window, true);
|
||||
ImGui_ImplGlfw_InitForVulkan(graphics::Window, false);
|
||||
|
||||
// this initializes imgui for Vulkan
|
||||
ImGui_ImplVulkan_InitInfo init_info = {};
|
||||
@@ -67,6 +66,8 @@ inline void setupImGui(graphics::GraphicsDevice* device)
|
||||
// vkDestroyDescriptorPool(_device, imguiPool, nullptr);
|
||||
// ImGui_ImplVulkan_Shutdown();
|
||||
// });
|
||||
|
||||
yolo::info("Initialized ImGUI");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <graphics.hpp>
|
||||
#include <version.hpp>
|
||||
|
||||
// #include "gui/layout.hpp"
|
||||
#include "gui/gui.hpp"
|
||||
// #include "renderer/renderer.hpp"
|
||||
// #include "scene/scene.hpp"
|
||||
#include "graphics/buffer.hpp"
|
||||
@@ -97,6 +97,8 @@ InfernoApp* inferno_create()
|
||||
app->Renderer = graphics::renderer_create(app->Device);
|
||||
graphics::renderer_configure_command_buffer(app->Renderer);
|
||||
|
||||
gui::imgui_init(app->Device);
|
||||
|
||||
app->Shader = graphics::shader_create(app->Device, app->Renderer->Swap);
|
||||
graphics::shader_load(app->Shader, "res/shaders/basic");
|
||||
graphics::shader_build(app->Shader);
|
||||
|
||||
Reference in New Issue
Block a user