Skip to content

Commit

Permalink
fix compile issue for editor
Browse files Browse the repository at this point in the history
  • Loading branch information
goopey7 committed Dec 26, 2023
1 parent a8eb6e4 commit ca113e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 8 additions & 3 deletions goop/sys/platform/vulkan/Renderer_Vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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);
Expand Down

0 comments on commit ca113e9

Please sign in to comment.