Get depth buffer working

This commit is contained in:
bailwillharr 2023-03-13 20:35:15 +00:00
parent 9e7c6e923d
commit 2f46fe21ef
3 changed files with 11 additions and 8 deletions

View File

@ -752,11 +752,12 @@ namespace engine {
{ // RECORDING
VkClearValue clearValue{}; // Using same value for all components enables compression according to NVIDIA Best Practices
clearValue.color.float32[0] = 1.0f;
clearValue.color.float32[1] = 1.0f;
clearValue.color.float32[2] = 1.0f;
clearValue.color.float32[3] = 1.0f;
std::array<VkClearValue, 2> clearValues{}; // Using same value for all components enables compression according to NVIDIA Best Practices
clearValues[0].color.float32[0] = 1.0f;
clearValues[0].color.float32[1] = 1.0f;
clearValues[0].color.float32[2] = 1.0f;
clearValues[0].color.float32[3] = 1.0f;
clearValues[1].depthStencil.depth = 1.0f;
VkRenderPassBeginInfo passBegin{};
passBegin.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
@ -765,8 +766,8 @@ namespace engine {
passBegin.framebuffer = std::get<2>(pimpl->swapchain.images[swapchainImageIndex]);
passBegin.renderArea.extent = pimpl->swapchain.extent;
passBegin.renderArea.offset = { 0, 0 };
passBegin.clearValueCount = 1;
passBegin.pClearValues = &clearValue;
passBegin.clearValueCount = clearValues.size();
passBegin.pClearValues = clearValues.data();
vkCmdBeginRenderPass(frameData.drawBuf, &passBegin, VK_SUBPASS_CONTENTS_INLINE);
VkViewport viewport{};

View File

@ -1,5 +1,6 @@
#include <stdexcept>
#include <vector>
#include <array>
#include <algorithm>
#include <assert.h>
@ -146,6 +147,7 @@ namespace engine {
imageInfo.format = sc->depthStencil.format;
imageInfo.extent.width = sc->extent.width;
imageInfo.extent.height = sc->extent.height;
imageInfo.extent.depth = 1;
imageInfo.mipLevels = 1;
imageInfo.arrayLayers = 1;
imageInfo.samples = VK_SAMPLE_COUNT_1_BIT;

View File

@ -153,7 +153,7 @@ void CameraControllerSystem::onUpdate(float ts)
" y: " + std::to_string(t->position.y) +
" z: " + std::to_string(t->position.z)
};
m_scene->app()->window()->infoBox("POSITION", pos_string);
//m_scene->app()->window()->infoBox("POSITION", pos_string);
LOG_INFO("position: " + pos_string);
}