framework update 4/29/2020
This commit is contained in:
parent
21fc655237
commit
60103dd1ce
62 changed files with 2931 additions and 2743 deletions
|
|
@ -26,16 +26,14 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "nvvkpp/allocator_dedicated_vkpp.hpp"
|
||||
#include "nvvkpp/appbase_vkpp.hpp"
|
||||
#include "nvvkpp/debug_util_vkpp.hpp"
|
||||
#define NVVK_ALLOC_DEDICATED
|
||||
#include "nvvk/allocator_vk.hpp"
|
||||
#include "nvvk/appbase_vkpp.hpp"
|
||||
#include "nvvk/debug_util_vk.hpp"
|
||||
#include "nvvk/descriptorsets_vk.hpp"
|
||||
|
||||
// #VKRay
|
||||
#define ALLOC_DEDICATED
|
||||
#include "nvvkpp/raytraceKHR_vkpp.hpp"
|
||||
|
||||
using nvvkBuffer = nvvkpp::BufferDedicated;
|
||||
using nvvkTexture = nvvkpp::TextureDedicated;
|
||||
#include "nvvk/raytraceKHR_vk.hpp"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
// Simple rasterizer of OBJ objects
|
||||
|
|
@ -44,10 +42,11 @@ using nvvkTexture = nvvkpp::TextureDedicated;
|
|||
// - Rendering is done in an offscreen framebuffer
|
||||
// - The image of the framebuffer is displayed in post-process in a full-screen quad
|
||||
//
|
||||
class HelloVulkan : public nvvkpp::AppBase
|
||||
class HelloVulkan : public nvvk::AppBase
|
||||
{
|
||||
public:
|
||||
void setup(const vk::Device& device,
|
||||
void setup(const vk::Instance& instance,
|
||||
const vk::Device& device,
|
||||
const vk::PhysicalDevice& physicalDevice,
|
||||
uint32_t queueFamily) override;
|
||||
void createDescriptorSetLayout();
|
||||
|
|
@ -66,12 +65,12 @@ public:
|
|||
// The OBJ model
|
||||
struct ObjModel
|
||||
{
|
||||
uint32_t nbIndices{0};
|
||||
uint32_t nbVertices{0};
|
||||
nvvkBuffer vertexBuffer; // Device buffer of all 'Vertex'
|
||||
nvvkBuffer indexBuffer; // Device buffer of the indices forming triangles
|
||||
nvvkBuffer matColorBuffer; // Device buffer of array of 'Wavefront material'
|
||||
nvvkBuffer matIndexBuffer; // Device buffer of array of 'Wavefront material'
|
||||
uint32_t nbIndices{0};
|
||||
uint32_t nbVertices{0};
|
||||
nvvk::Buffer vertexBuffer; // Device buffer of all 'Vertex'
|
||||
nvvk::Buffer indexBuffer; // Device buffer of the indices forming triangles
|
||||
nvvk::Buffer matColorBuffer; // Device buffer of array of 'Wavefront material'
|
||||
nvvk::Buffer matIndexBuffer; // Device buffer of array of 'Wavefront material'
|
||||
};
|
||||
|
||||
// Instance of the OBJ
|
||||
|
|
@ -98,19 +97,19 @@ public:
|
|||
std::vector<ObjInstance> m_objInstance;
|
||||
|
||||
// Graphic pipeline
|
||||
vk::PipelineLayout m_pipelineLayout;
|
||||
vk::Pipeline m_graphicsPipeline;
|
||||
std::vector<vk::DescriptorSetLayoutBinding> m_descSetLayoutBind;
|
||||
vk::DescriptorPool m_descPool;
|
||||
vk::DescriptorSetLayout m_descSetLayout;
|
||||
vk::DescriptorSet m_descSet;
|
||||
vk::PipelineLayout m_pipelineLayout;
|
||||
vk::Pipeline m_graphicsPipeline;
|
||||
nvvk::DescriptorSetBindings m_descSetLayoutBind;
|
||||
vk::DescriptorPool m_descPool;
|
||||
vk::DescriptorSetLayout m_descSetLayout;
|
||||
vk::DescriptorSet m_descSet;
|
||||
|
||||
nvvkBuffer m_cameraMat; // Device-Host of the camera matrices
|
||||
nvvkBuffer m_sceneDesc; // Device buffer of the OBJ instances
|
||||
std::vector<nvvkTexture> m_textures; // vector of all textures of the scene
|
||||
nvvk::Buffer m_cameraMat; // Device-Host of the camera matrices
|
||||
nvvk::Buffer m_sceneDesc; // Device buffer of the OBJ instances
|
||||
std::vector<nvvk::Texture> m_textures; // vector of all textures of the scene
|
||||
|
||||
nvvkpp::AllocatorDedicated m_alloc; // Allocator for buffer, images, acceleration structures
|
||||
nvvkpp::DebugUtil m_debug; // Utility to name objects
|
||||
nvvk::AllocatorDedicated m_alloc; // Allocator for buffer, images, acceleration structures
|
||||
nvvk::DebugUtil m_debug; // Utility to name objects
|
||||
|
||||
// #Post
|
||||
void createOffscreenRender();
|
||||
|
|
@ -119,44 +118,44 @@ public:
|
|||
void updatePostDescriptorSet();
|
||||
void drawPost(vk::CommandBuffer cmdBuf);
|
||||
|
||||
std::vector<vk::DescriptorSetLayoutBinding> m_postDescSetLayoutBind;
|
||||
vk::DescriptorPool m_postDescPool;
|
||||
vk::DescriptorSetLayout m_postDescSetLayout;
|
||||
vk::DescriptorSet m_postDescSet;
|
||||
vk::Pipeline m_postPipeline;
|
||||
vk::PipelineLayout m_postPipelineLayout;
|
||||
vk::RenderPass m_offscreenRenderPass;
|
||||
vk::Framebuffer m_offscreenFramebuffer;
|
||||
nvvkTexture m_offscreenColor;
|
||||
vk::Format m_offscreenColorFormat{vk::Format::eR32G32B32A32Sfloat};
|
||||
nvvkTexture m_offscreenDepth;
|
||||
vk::Format m_offscreenDepthFormat{vk::Format::eD32Sfloat};
|
||||
nvvk::DescriptorSetBindings m_postDescSetLayoutBind;
|
||||
vk::DescriptorPool m_postDescPool;
|
||||
vk::DescriptorSetLayout m_postDescSetLayout;
|
||||
vk::DescriptorSet m_postDescSet;
|
||||
vk::Pipeline m_postPipeline;
|
||||
vk::PipelineLayout m_postPipelineLayout;
|
||||
vk::RenderPass m_offscreenRenderPass;
|
||||
vk::Framebuffer m_offscreenFramebuffer;
|
||||
nvvk::Texture m_offscreenColor;
|
||||
vk::Format m_offscreenColorFormat{vk::Format::eR32G32B32A32Sfloat};
|
||||
nvvk::Texture m_offscreenDepth;
|
||||
vk::Format m_offscreenDepthFormat{vk::Format::eD32Sfloat};
|
||||
|
||||
// #VKRay
|
||||
void initRayTracing();
|
||||
nvvkpp::RaytracingBuilderKHR::Blas objectToVkGeometryKHR(const ObjModel& model);
|
||||
void createBottomLevelAS();
|
||||
void createTopLevelAS();
|
||||
void createRtDescriptorSet();
|
||||
void updateRtDescriptorSet();
|
||||
void createRtPipeline();
|
||||
void createRtShaderBindingTable();
|
||||
void initRayTracing();
|
||||
nvvk::RaytracingBuilderKHR::Blas objectToVkGeometryKHR(const ObjModel& model);
|
||||
void createBottomLevelAS();
|
||||
void createTopLevelAS();
|
||||
void createRtDescriptorSet();
|
||||
void updateRtDescriptorSet();
|
||||
void createRtPipeline();
|
||||
void createRtShaderBindingTable();
|
||||
void raytrace(const vk::CommandBuffer& cmdBuf, const nvmath::vec4f& clearColor);
|
||||
|
||||
|
||||
vk::PhysicalDeviceRayTracingPropertiesKHR m_rtProperties;
|
||||
nvvkpp::RaytracingBuilderKHR m_rtBuilder;
|
||||
std::vector<vk::DescriptorSetLayoutBinding> m_rtDescSetLayoutBind;
|
||||
nvvk::RaytracingBuilderKHR m_rtBuilder;
|
||||
nvvk::DescriptorSetBindings m_rtDescSetLayoutBind;
|
||||
vk::DescriptorPool m_rtDescPool;
|
||||
vk::DescriptorSetLayout m_rtDescSetLayout;
|
||||
vk::DescriptorSet m_rtDescSet;
|
||||
std::vector<vk::RayTracingShaderGroupCreateInfoKHR> m_rtShaderGroups;
|
||||
vk::PipelineLayout m_rtPipelineLayout;
|
||||
vk::Pipeline m_rtPipeline;
|
||||
nvvkBuffer m_rtSBTBuffer;
|
||||
nvvk::Buffer m_rtSBTBuffer;
|
||||
|
||||
std::vector<nvvkpp::RaytracingBuilderKHR::Instance> m_tlas;
|
||||
std::vector<nvvkpp::RaytracingBuilderKHR::Blas> m_blas;
|
||||
std::vector<nvvk::RaytracingBuilderKHR::Instance> m_tlas;
|
||||
std::vector<nvvk::RaytracingBuilderKHR::Blas> m_blas;
|
||||
|
||||
struct RtPushConstant
|
||||
{
|
||||
|
|
@ -172,13 +171,13 @@ public:
|
|||
|
||||
// #VK_compute
|
||||
void createCompDescriptors();
|
||||
void updateCompDescriptors(nvvkBuffer& vertex);
|
||||
void updateCompDescriptors(nvvk::Buffer& vertex);
|
||||
void createCompPipelines();
|
||||
|
||||
std::vector<vk::DescriptorSetLayoutBinding> m_compDescSetLayoutBind;
|
||||
vk::DescriptorPool m_compDescPool;
|
||||
vk::DescriptorSetLayout m_compDescSetLayout;
|
||||
vk::DescriptorSet m_compDescSet;
|
||||
vk::Pipeline m_compPipeline;
|
||||
vk::PipelineLayout m_compPipelineLayout;
|
||||
nvvk::DescriptorSetBindings m_compDescSetLayoutBind;
|
||||
vk::DescriptorPool m_compDescPool;
|
||||
vk::DescriptorSetLayout m_compDescSetLayout;
|
||||
vk::DescriptorSet m_compDescSet;
|
||||
vk::Pipeline m_compPipeline;
|
||||
vk::PipelineLayout m_compPipelineLayout;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue