Bulk update NvPro-Samples 05/21/21

This commit is contained in:
Mathias Heyer 2021-05-21 16:15:58 -07:00
parent 3b0c3536e0
commit b3e6d84807
53 changed files with 359 additions and 366 deletions

View file

@ -120,10 +120,9 @@ void HelloVulkan::updateUniformBuffer(const vk::CommandBuffer& cmdBuf)
//
void HelloVulkan::createDescriptorSetLayout()
{
using vkDS = vk::DescriptorSetLayoutBinding;
using vkDT = vk::DescriptorType;
using vkSS = vk::ShaderStageFlagBits;
uint32_t nbTxt = static_cast<uint32_t>(m_textures.size());
using vkDS = vk::DescriptorSetLayoutBinding;
using vkDT = vk::DescriptorType;
using vkSS = vk::ShaderStageFlagBits;
auto& bind = m_descSetLayoutBind;
// Camera matrices (binding = 0)
@ -417,7 +416,6 @@ void HelloVulkan::destroyResources()
void HelloVulkan::rasterize(const vk::CommandBuffer& cmdBuf)
{
using vkPBP = vk::PipelineBindPoint;
using vkSS = vk::ShaderStageFlagBits;
std::vector<vk::DeviceSize> offsets = {0, 0, 0};
@ -691,7 +689,6 @@ void HelloVulkan::createTopLevelAS()
{
std::vector<nvvk::RaytracingBuilderKHR::Instance> tlas;
tlas.reserve(m_gltfScene.m_nodes.size());
uint32_t instID = 0;
for(auto& node : m_gltfScene.m_nodes)
{
nvvk::RaytracingBuilderKHR::Instance rayInst;
@ -834,8 +831,9 @@ void HelloVulkan::createRtPipeline()
rayPipelineInfo.setMaxPipelineRayRecursionDepth(2); // Ray depth
rayPipelineInfo.setLayout(m_rtPipelineLayout);
m_rtPipeline = static_cast<const vk::Pipeline&>(
m_device.createRayTracingPipelineKHR({}, {}, rayPipelineInfo));
m_rtPipeline = m_device.createRayTracingPipelineKHR({}, {}, rayPipelineInfo).value;
// Creating the SBT

View file

@ -24,7 +24,6 @@
#include "nvvk/appbase_vkpp.hpp"
#include "nvvk/debug_util_vk.hpp"
#include "nvvk/descriptorsets_vk.hpp"
#include "nvvk/resourceallocator_vk.hpp"
#include "nvvk/memallocator_dma_vk.hpp"
// #VKRay
@ -119,7 +118,7 @@ public:
nvvk::Texture m_offscreenColor;
vk::Format m_offscreenColorFormat{vk::Format::eR32G32B32A32Sfloat};
nvvk::Texture m_offscreenDepth;
vk::Format m_offscreenDepthFormat;
vk::Format m_offscreenDepthFormat{vk::Format::eX8D24UnormPack32};
// #VKRay
auto primitiveToGeometry(const nvh::GltfPrimMesh& prim);

View file

@ -236,7 +236,7 @@ int main(int argc, char** argv)
helloVk.updateUniformBuffer(cmdBuf);
// Clearing screen
vk::ClearValue clearValues[2];
std::array<vk::ClearValue, 2> clearValues;
clearValues[0].setColor(
std::array<float, 4>({clearColor[0], clearColor[1], clearColor[2], clearColor[3]}));
clearValues[1].setDepthStencil({1.0f, 0});
@ -245,7 +245,7 @@ int main(int argc, char** argv)
{
vk::RenderPassBeginInfo offscreenRenderPassBeginInfo;
offscreenRenderPassBeginInfo.setClearValueCount(2);
offscreenRenderPassBeginInfo.setPClearValues(clearValues);
offscreenRenderPassBeginInfo.setPClearValues(clearValues.data());
offscreenRenderPassBeginInfo.setRenderPass(helloVk.m_offscreenRenderPass);
offscreenRenderPassBeginInfo.setFramebuffer(helloVk.m_offscreenFramebuffer);
offscreenRenderPassBeginInfo.setRenderArea({{}, helloVk.getSize()});
@ -267,7 +267,7 @@ int main(int argc, char** argv)
{
vk::RenderPassBeginInfo postRenderPassBeginInfo;
postRenderPassBeginInfo.setClearValueCount(2);
postRenderPassBeginInfo.setPClearValues(clearValues);
postRenderPassBeginInfo.setPClearValues(clearValues.data());
postRenderPassBeginInfo.setRenderPass(helloVk.getRenderPass());
postRenderPassBeginInfo.setFramebuffer(helloVk.getFramebuffers()[curFrame]);
postRenderPassBeginInfo.setRenderArea({{}, helloVk.getSize()});