Convert MeshPack into the ray tracing geometry used to build the BLAS.
- Returns
- Returns VulkanRayTracing::BlasInput.
BLAS builder requires raw device addresses.
device pointer to the buffers holding triangle vertex/index data, along with information for interpreting it as an array (stride, data type, etc.)
wrapper around the above with the geometry type enum (triangles in this case) plus flags for the AS builder.
the indices within the vertex arrays to source input geometry for the BLAS.
Our blas is made from only one geometry, but could be made of many geometries.
BLAS builder requires raw device addresses.
device pointer to the buffers holding triangle vertex/index data, along with information for interpreting it as an array (stride, data type, etc.)
wrapper around the above with the geometry type enum (triangles in this case) plus flags for the AS builder.
the indices within the vertex arrays to source input geometry for the BLAS.
Our blas is made from only one geometry, but could be made of many geometries.
Definition at line 195 of file MeshPack.cpp.
196 {
198
204
206 const uint32_t maxPrimitiveCount = lod0.nPrimitives;
207
212 VkAccelerationStructureGeometryTrianglesDataKHR triangles {};
213 triangles.sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR;
214 triangles.vertexFormat = VK_FORMAT_R32G32B32_SFLOAT;
215 triangles.vertexData.deviceAddress = vertexAddress;
216 triangles.vertexStride = sizeof(glm::vec3);
217 triangles.indexType = VK_INDEX_TYPE_UINT32;
218 triangles.indexData.deviceAddress = indicesAddress;
219
221
225 VkAccelerationStructureGeometryKHR asGeom {};
226 asGeom.sType = VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR;
227 asGeom.geometryType = VK_GEOMETRY_TYPE_TRIANGLES_KHR;
228 asGeom.flags = VK_GEOMETRY_OPAQUE_BIT_KHR;
229 asGeom.geometry.triangles = triangles;
230
234 VkAccelerationStructureBuildRangeInfoKHR offset {};
235 offset.firstVertex = 0;
236 offset.primitiveCount = maxPrimitiveCount;
237 offset.primitiveOffset = lod0.primVertexOffset;
238 offset.transformOffset = 0;
239
243 VulkanRayTracing::BlasInput input;
244 input.asGeometry.emplace_back(asGeom);
245 input.asBuildOffsetInfo.emplace_back(offset);
247
248 return input;
249 }
#define SPICES_PROFILE_ZONE
AccelKHR m_Accel
This meshPack blas accel.
MeshResource m_MeshResource
Mesh Resources.
std::shared_ptr< VulkanBuffer > buffer
Attribute Buffer.
std::shared_ptr< std::vector< T > > attributes
Attribute Data Array.
Positions positions
Declare value.
PrimitivePoints primitivePoints
References Spices::Lod::nPrimitives.