ray_tracing_gltf/hello_vulkan.cpp
void HelloVulkan::rasterize(const VkCommandBuffer& cmdBuf)
{
  using vkPBP = VkPipelineBindPoint;

  std::vector<VkDeviceSize> offsets = {0, 0, 0};

  m_debug.beginLabel(cmdBuf, "Rasterize");

  // Dynamic Viewport
  setViewport(cmdBuf);

  // Drawing all triangles
  vkCmdBindPipeline(cmdBuf, VK_PIPELINE_BIND_POINT_GRAPHICS, m_graphicsPipeline);
  vkCmdBindDescriptorSets(cmdBuf, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1, &m_descSet, 0, nullptr);

  std::vector<VkBuffer> vertexBuffers = {m_vertexBuffer.buffer, m_normalBuffer.buffer, m_uvBuffer.buffer};
  vkCmdBindVertexBuffers(cmdBuf, 0, static_cast<uint32_t>(vertexBuffers.size()), vertexBuffers.data(), offsets.data());
  vkCmdBindIndexBuffer(cmdBuf, m_indexBuffer.buffer, 0, VK_INDEX_TYPE_UINT32);

  uint32_t idxNode = 0;
  for(auto& node : m_gltfScene.m_nodes)
  {
    auto& primitive = m_gltfScene.m_primMeshes[node.primMesh];

    m_pcRaster.modelMatrix = node.worldMatrix;
    m_pcRaster.objIndex    = node.primMesh;
    m_pcRaster.materialId  = primitive.materialIndex;
    vkCmdPushConstants(cmdBuf, m_pipelineLayout, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0,
                       sizeof(PushConstantRaster), &m_pcRaster);
    vkCmdDrawIndexed(cmdBuf, primitive.indexCount, 1, primitive.firstIndex, primitive.vertexOffset, 0);
  }

  m_debug.endLabel(cmdBuf);
}
//--------------------------------------------------------------------------------------------------
// Drawing the scene in raster mode
//
Drawing the scene in raster mode
Drawing the scene in raster mode
void HelloVulkan::rasterize(const VkCommandBuffer& cmdBuf)
{
  using vkPBP = VkPipelineBindPoint;
  std::vector<VkDeviceSize> offsets = {0, 0, 0};
  m_debug.beginLabel(cmdBuf, "Rasterize");
  setViewport(cmdBuf);
  vkCmdBindPipeline(cmdBuf, VK_PIPELINE_BIND_POINT_GRAPHICS, m_graphicsPipeline);
  vkCmdBindDescriptorSets(cmdBuf, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1, &m_descSet, 0, nullptr);
  std::vector<VkBuffer> vertexBuffers = {m_vertexBuffer.buffer, m_normalBuffer.buffer, m_uvBuffer.buffer};
  vkCmdBindVertexBuffers(cmdBuf, 0, static_cast<uint32_t>(vertexBuffers.size()), vertexBuffers.data(), offsets.data());
  vkCmdBindIndexBuffer(cmdBuf, m_indexBuffer.buffer, 0, VK_INDEX_TYPE_UINT32);
  uint32_t idxNode = 0;
  for(auto& node : m_gltfScene.m_nodes)
  {
    auto& primitive = m_gltfScene.m_primMeshes[node.primMesh];
    m_pcRaster.modelMatrix = node.worldMatrix;
    m_pcRaster.objIndex    = node.primMesh;
    m_pcRaster.materialId  = primitive.materialIndex;
    vkCmdPushConstants(cmdBuf, m_pipelineLayout, VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT, 0,
                       sizeof(PushConstantRaster), &m_pcRaster);
    vkCmdDrawIndexed(cmdBuf, primitive.indexCount, 1, primitive.firstIndex, primitive.vertexOffset, 0);
  }
  m_debug.endLabel(cmdBuf);
}
void HelloVulkan :: rasterize ( const VkCommandBuffer & cmdBuf ) { using vkPBP = VkPipelineBindPoint ; std :: vector < VkDeviceSize > offsets = { 0 , 0 , 0 } ; m_debug . beginLabel ( cmdBuf , " " ) ; setViewport ( cmdBuf ) ; vkCmdBindPipeline ( cmdBuf , VK_PIPELINE_BIND_POINT_GRAPHICS , m_graphicsPipeline ) ; vkCmdBindDescriptorSets ( cmdBuf , VK_PIPELINE_BIND_POINT_GRAPHICS , m_pipelineLayout , 0 , 1 , & m_descSet , 0 , nullptr ) ; std :: vector < VkBuffer > vertexBuffers = { m_vertexBuffer . buffer , m_normalBuffer . buffer , m_uvBuffer . buffer } ; vkCmdBindVertexBuffers ( cmdBuf , 0 , static_cast < uint32_t > ( vertexBuffers . size ( ) ) , vertexBuffers . data ( ) , offsets . data ( ) ) ; vkCmdBindIndexBuffer ( cmdBuf , m_indexBuffer . buffer , 0 , VK_INDEX_TYPE_UINT32 ) ; uint32_t idxNode = 0 ; for ( auto & node : m_gltfScene . m_nodes ) { auto & primitive = m_gltfScene . m_primMeshes [ node . primMesh ] ; m_pcRaster . modelMatrix = node . worldMatrix ; m_pcRaster . objIndex = node . primMesh ; m_pcRaster . materialId = primitive . materialIndex ; vkCmdPushConstants ( cmdBuf , m_pipelineLayout , VK_SHADER_STAGE_VERTEX_BIT | VK_SHADER_STAGE_FRAGMENT_BIT , 0 , sizeof ( PushConstantRaster ) , & m_pcRaster ) ; vkCmdDrawIndexed ( cmdBuf , primitive . indexCount , 1 , primitive . firstIndex , primitive . vertexOffset , 0 ) ; } m_debug . endLabel ( cmdBuf ) ; }
Drawing the scene in raster mode
Drawing the scene in raster mode
// Dynamic Viewport // Drawing all triangles