From ca113e955e1629a5b952fb64502b21ac7835d219 Mon Sep 17 00:00:00 2001 From: Sam Collier Date: Tue, 26 Dec 2023 17:54:07 -0500 Subject: [PATCH] fix compile issue for editor --- CMakeLists.txt | 2 +- goop/sys/platform/vulkan/Renderer_Vulkan.cpp | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 66da640..8050279 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ file(GLOB STB_IMAGE_HEADER "libs/stb/stb_image.h") add_executable(${PROJECT_NAME} ${ENGINE_SRC_FILES} ${STB_VORBIS_SOURCE}) #define app type -#target_compile_definitions(${PROJECT_NAME} PRIVATE GOOP_APPTYPE_EDITOR=1) +target_compile_definitions(${PROJECT_NAME} PRIVATE GOOP_APPTYPE_EDITOR=1) # define systems target_compile_definitions(${PROJECT_NAME} PRIVATE GOOP_RENDERER_VULKAN=1) diff --git a/goop/sys/platform/vulkan/Renderer_Vulkan.cpp b/goop/sys/platform/vulkan/Renderer_Vulkan.cpp index a780d5d..a2de4dd 100644 --- a/goop/sys/platform/vulkan/Renderer_Vulkan.cpp +++ b/goop/sys/platform/vulkan/Renderer_Vulkan.cpp @@ -414,7 +414,7 @@ bool Renderer_Vulkan::renderScene(uint32_t width, uint32_t height, uint32_t imag vkCmdBindPipeline(cb, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline->getPipeline()); - if (buffers->getVertexCount(currentFrame) && buffers->getIndexCount(currentFrame) != 0 && + if (buffers->getVertexCount(currentFrame) && buffers->getIndexCount(currentFrame, 0) != 0 && buffers->getVertexBuffer(currentFrame) != VK_NULL_HANDLE && buffers->getIndexBuffer(currentFrame) != VK_NULL_HANDLE) { @@ -426,9 +426,14 @@ bool Renderer_Vulkan::renderScene(uint32_t width, uint32_t height, uint32_t imag vkCmdBindDescriptorSets(cb, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline->getPipelineLayout(), 0, 1, descriptor->getSet(currentFrame), 0, nullptr); - if (buffers->getIndexCount(currentFrame) != 0) + if (buffers->getIndexCount(currentFrame, 0) != 0 && + buffers->getIndexBuffer(currentFrame) != nullptr) { - vkCmdDrawIndexed(cb, buffers->getIndexCount(currentFrame), 1, 0, 0, 0); + for (size_t i = 0; i < buffers->getIndexCountSize(currentFrame); i++) + { + vkCmdDrawIndexed(cb, buffers->getIndexCount(currentFrame, i), 1, + buffers->getIndexOffset(currentFrame, i), 0, 0); + } } vkCmdEndRenderPass(cb);