few little things

This commit is contained in:
Mars 2024-10-01 19:00:31 -04:00
parent 7fd7beea60
commit 76fa86d622
Signed by: pupbrained
GPG key ID: 0FF5B8826803F895

View file

@ -110,7 +110,6 @@ class VulkanApp {
vkfw::WindowHints hints;
hints.clientAPI = vkfw::ClientAPI::eNone;
hints.resizable = vkfw::eFalse;
mWindow = vkfw::createWindowUnique(WIDTH, HEIGHT, "Vulkan", hints);
}
@ -500,23 +499,21 @@ class VulkanApp {
}
fn recordCommandBuffer(vk::CommandBuffer commandBuffer, u32 imageIndex) -> void {
// might break
vk::CommandBufferBeginInfo beginInfo {};
commandBuffer.begin(beginInfo);
vk::ClearValue clearColor { { std::array<float, 4> { 0.0F, 0.0F, 0.0F, 1.0F } } };
vk::ClearValue clearColor { .color = { .float32 = std::array<float, 4> { 0.0F, 0.0F, 0.0F, 1.0F } } };
vk::RenderPassBeginInfo renderPassInfo {
.renderPass = mRenderPass.get(),
.framebuffer = mSwapChainFramebuffers[imageIndex].get(),
.renderArea = { .offset = { 0, 0 }, .extent = mSwapChainExtent },
.renderArea = { .offset = { .x = 0, .y = 0 }, .extent = mSwapChainExtent },
.clearValueCount = 1,
.pClearValues = &clearColor,
};
commandBuffer.beginRenderPass(renderPassInfo, vk::SubpassContents::eInline);
commandBuffer.bindPipeline(vk::PipelineBindPoint::eGraphics, mGraphicsPipeline.get());
vk::Viewport viewport {
@ -527,20 +524,17 @@ class VulkanApp {
.minDepth = 0.0F,
.maxDepth = 1.0F,
};
commandBuffer.setViewport(0, viewport);
vk::Rect2D scissor {
.offset = { 0, 0 },
.extent = mSwapChainExtent,
};
commandBuffer.setViewport(0, viewport);
commandBuffer.setScissor(0, scissor);
commandBuffer.draw(3, 1, 0, 0);
commandBuffer.endRenderPass();
commandBuffer.end();
}
@ -591,6 +585,7 @@ class VulkanApp {
};
vk::Result presentResult = mPresentQueue.presentKHR(presentInfo);
if (presentResult != vk::Result::eSuccess)
throw std::runtime_error("Failed to present swap chain image!");
}