ray_tracing_gltf/hello_vulkan.cpp
void HelloVulkan::createDescriptorSetLayout()
{
  auto& bind = m_descSetLayoutBind;
  // Camera matrices
  bind.addBinding(SceneBindings::eGlobals, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1,
                  VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_RAYGEN_BIT_KHR);
  // Array of textures
  auto nbTextures = static_cast<uint32_t>(m_textures.size());
  bind.addBinding(SceneBindings::eTextures, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, nbTextures,
                  VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR | VK_SHADER_STAGE_ANY_HIT_BIT_KHR);
  // Scene buffers
  bind.addBinding(eSceneDesc, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1,
                  VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR
                      | VK_SHADER_STAGE_ANY_HIT_BIT_KHR);

  m_descSetLayout = m_descSetLayoutBind.createLayout(m_device);
  m_descPool      = m_descSetLayoutBind.createPool(m_device, 1);
  m_descSet       = nvvk::allocateDescriptorSet(m_device, m_descPool, m_descSetLayout);
}
//--------------------------------------------------------------------------------------------------
// Describing the layout pushed when rendering
//
Describing the layout pushed when rendering
Describing the layout pushed when rendering
void HelloVulkan::createDescriptorSetLayout()
{
  auto& bind = m_descSetLayoutBind;
  bind.addBinding(SceneBindings::eGlobals, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, 1,
                  VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_RAYGEN_BIT_KHR);
  auto nbTextures = static_cast<uint32_t>(m_textures.size());
  bind.addBinding(SceneBindings::eTextures, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, nbTextures,
                  VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR | VK_SHADER_STAGE_ANY_HIT_BIT_KHR);
  bind.addBinding(eSceneDesc, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1,
                  VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR
                      | VK_SHADER_STAGE_ANY_HIT_BIT_KHR);
  m_descSetLayout = m_descSetLayoutBind.createLayout(m_device);
  m_descPool      = m_descSetLayoutBind.createPool(m_device, 1);
  m_descSet       = nvvk::allocateDescriptorSet(m_device, m_descPool, m_descSetLayout);
}
void HelloVulkan :: createDescriptorSetLayout ( ) { auto & bind = m_descSetLayoutBind ; bind . addBinding ( SceneBindings :: eGlobals , VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER , 1 , VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_RAYGEN_BIT_KHR ) ; auto nbTextures = static_cast < uint32_t > ( m_textures . size ( ) ) ; bind . addBinding ( SceneBindings :: eTextures , VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER , nbTextures , VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR | VK_SHADER_STAGE_ANY_HIT_BIT_KHR ) ; bind . addBinding ( eSceneDesc , VK_DESCRIPTOR_TYPE_STORAGE_BUFFER , 1 , VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT | VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR | VK_SHADER_STAGE_ANY_HIT_BIT_KHR ) ; m_descSetLayout = m_descSetLayoutBind . createLayout ( m_device ) ; m_descPool = m_descSetLayoutBind . createPool ( m_device , 1 ) ; m_descSet = nvvk :: allocateDescriptorSet ( m_device , m_descPool , m_descSetLayout ) ; }
Describing the layout pushed when rendering
Describing the layout pushed when rendering
// Camera matrices // Array of textures // Scene buffers