summaryrefslogtreecommitdiffstats
path: root/src/cplusplus.cpp
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2024-06-14 00:10:58 +0300
committergramanas <anastasis.gramm2@gmail.com>2024-06-14 00:10:58 +0300
commit5c2677df733fc7f8a5d12ae3d0e1e648566db2bb (patch)
tree2f5dc7d30a16b4751ae68b2a1d3a641613ba4206 /src/cplusplus.cpp
parenteb5d40f92c6d2d1d7491c350cbdcef2e8bf96e06 (diff)
downloadcgame-5c2677df733fc7f8a5d12ae3d0e1e648566db2bb.tar.gz
cgame-5c2677df733fc7f8a5d12ae3d0e1e648566db2bb.tar.bz2
cgame-5c2677df733fc7f8a5d12ae3d0e1e648566db2bb.zip
VMA initial integration
Diffstat (limited to 'src/cplusplus.cpp')
-rw-r--r--src/cplusplus.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/cplusplus.cpp b/src/cplusplus.cpp
index 750a5bf..35876f5 100644
--- a/src/cplusplus.cpp
+++ b/src/cplusplus.cpp
@@ -2,6 +2,9 @@
#include "cplusplus.h"
#include "vksetup.h"
+#define VMA_DEBUG_INITIALIZE_ALLOCATIONS 1
+#define VMA_STATIC_VULKAN_FUNCTIONS 0
+#define VMA_DYNAMIC_VULKAN_FUNCTIONS 1
#define VMA_IMPLEMENTATION
#include "vk_mem_alloc.h"
@@ -39,10 +42,12 @@ imgui_new_frame(vks_context vk)
ImGui::NewFrame();
-
+
ImGui::ShowDemoWindow();
-}
+ ImGui::Text("dear imgui says hello! (%s) (%d)", IMGUI_VERSION, IMGUI_VERSION_NUM);
+
+}
bool
imgui_proc_event(SDL_Event* e)
@@ -52,7 +57,7 @@ imgui_proc_event(SDL_Event* e)
static VkDescriptorPool imguiPool;
void
-init_imgui(vks_context vk)
+init_imgui(vks_context *vk)
{
VkDescriptorPoolSize pool_sizes[] = {
{ VK_DESCRIPTOR_TYPE_SAMPLER, 1000 },
@@ -75,7 +80,7 @@ init_imgui(vks_context vk)
pool_info.poolSizeCount = std::size(pool_sizes);
pool_info.pPoolSizes = pool_sizes;
- VK_CHECK(vkCreateDescriptorPool(vk.device, &pool_info, nullptr, &imguiPool));
+ VK_CHECK(vkCreateDescriptorPool(vk->device, &pool_info, nullptr, &imguiPool));
IMGUI_CHECKVERSION();
ImGui::CreateContext();
@@ -84,27 +89,27 @@ init_imgui(vks_context vk)
io.ConfigFlags |=
ImGuiConfigFlags_NavEnableGamepad; // Enable Gamepad Controls
- ImGui_ImplSDL2_InitForVulkan(vk.window);
+ ImGui_ImplSDL2_InitForVulkan(vk->window);
ImGui_ImplVulkan_InitInfo init_info = {};
- init_info.Instance = vk.instance;
- init_info.PhysicalDevice = vk.physical_device;
- init_info.Device = vk.device;
+ init_info.Instance = vk->instance;
+ init_info.PhysicalDevice = vk->physical_device;
+ init_info.Device = vk->device;
//init_info.QueueFamily = ;
- init_info.Queue = vk.graphics_and_compute_queue;
+ init_info.Queue = vk->graphics_and_compute_queue;
//init_info.PipelineCache = YOUR_PIPELINE_CACHE;
init_info.DescriptorPool = imguiPool;
init_info.Subpass = 0;
init_info.MinImageCount = 2;
init_info.ImageCount = 2;
- init_info.MSAASamples = vk.msaa_samples;
+ init_info.MSAASamples = vk->msaa_samples;
init_info.CheckVkResultFn = check_vk_result;
init_info.UseDynamicRendering = true;
//init_info.
init_info.PipelineRenderingCreateInfo.sType =
VK_STRUCTURE_TYPE_PIPELINE_RENDERING_CREATE_INFO_KHR;
init_info.PipelineRenderingCreateInfo.colorAttachmentCount = 1;
- init_info.PipelineRenderingCreateInfo.pColorAttachmentFormats = &vk.swapchain.image_format;
- init_info.PipelineRenderingCreateInfo.depthAttachmentFormat = findDepthFormat(vk);
+ init_info.PipelineRenderingCreateInfo.pColorAttachmentFormats = &vk->swapchain.image_format;
+ init_info.PipelineRenderingCreateInfo.depthAttachmentFormat = findDepthFormat(*vk);
ImGui_ImplVulkan_Init(&init_info);
// (this gets a bit more complicated, see example app for full reference)