summaryrefslogtreecommitdiff
path: root/src/window.cpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-09-01 10:10:51 -0400
committerJonathan Bradley <jcb@pikum.xyz>2023-09-06 17:24:27 -0400
commitb9f90793c8c0468d5f35d7af976a6e3bcd206aad (patch)
treebff30852d5bb594c7ad84c5f7f3d5a385e18fc4a /src/window.cpp
parent092e287ba5669f6ed40b721c0bdf2450dae95af8 (diff)
add first graphics binding component
Diffstat (limited to 'src/window.cpp')
-rw-r--r--src/window.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/window.cpp b/src/window.cpp
index eb2ecff..8293c81 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1,3 +1,4 @@
+#include <vulkan/vulkan_core.h>
#define GLFW_INCLUDE_NONE
#define GLFW_INCLUDE_VULKAN
@@ -997,6 +998,19 @@ void RecordCommandBuffer(VkCommandBuffer commandBuffer, uint32_t imageIndex) {
vkCmdSetViewport(commandBuffer, 0, 1, &viewport);
vkCmdSetScissor(commandBuffer, 0, 1, &scissor);
+ const uint64_t bindBucketCount = ECS_GetGrBinds_BucketCount();
+ for (long b = 0; b < bindBucketCount; ++b) {
+ uint64_t itemCount;
+ CompGrBinds *items = ECS_GetGrBinds(b, itemCount);
+ for (long i = 0; i < itemCount; ++i) {
+ CompGrBinds *binder = &items[i];
+ vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, binder->vkPipelineLayout, 0U, 1U, &binder->vkDescriptorSet, 0, {});
+ vkCmdBindVertexBuffers(commandBuffer, binder->indexFirstBinding, binder->vertexCount, &binder->vertexBuffer, &binder->vertexOffsets);
+ vkCmdBindIndexBuffer(commandBuffer, binder->indexBuffer, binder->vertexOffsets, VK_INDEX_TYPE_UINT16);
+ vkCmdBindVertexBuffers(commandBuffer, binder->indexFirstBinding, binder->instanceCount, &binder->instanceBuffer, &binder->instanceOffsets);
+ }
+ }
+
// reminder that present.vert is a triangle
vkCmdDraw(commandBuffer, 3, 1, 0, 0);