Skip to content

Commit

Permalink
Set VkAccelerationStructureGeometryTrianglesDataKHR::maxVertex to be …
Browse files Browse the repository at this point in the history
…maximum vertex index (KhronosGroup#1097)

VkAccelerationStructureGeometryTrianglesDataKHR::maxVertex is the maximum vertex index in the VkAccelerationStructureGeometryTrianglesDataKHR::vertexData buffer i.e. the spec states "maxVertex is the number of vertices in vertexData minus one".

Currently the maxVertex value in the ray_queries and ray_tracing_extended is being set to the number of vertices, so this patch fixes them.  It's not caused any problems so far as both examples use an index buffer - but it's better to be technically correct!
  • Loading branch information
cmannett85-arm authored Jul 15, 2024
1 parent d74fd8b commit b76f0f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion samples/extensions/ray_queries/ray_queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ void RayQueries::create_bottom_level_acceleration_structure()
index_buffer,
transform_matrix_buffer,
static_cast<uint32_t>(model.indices.size()),
static_cast<uint32_t>(model.vertices.size()),
static_cast<uint32_t>(model.vertices.size()) - 1,
sizeof(Vertex),
0, VK_FORMAT_R32G32B32_SFLOAT, VK_GEOMETRY_OPAQUE_BIT_KHR,
get_buffer_device_address(vertex_buffer->get_handle()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void RaytracingExtended::create_bottom_level_acceleration_structure(bool is_upda
model_buffer.is_static ? index_buffer : dynamic_index_buffer,
model_buffer.transform_matrix_buffer,
static_cast<uint32_t>(model_buffer.num_triangles),
static_cast<uint32_t>(model_buffer.num_vertices),
static_cast<uint32_t>(model_buffer.num_vertices) - 1,
sizeof(NewVertex),
0, VK_FORMAT_R32G32B32_SFLOAT, VK_GEOMETRY_OPAQUE_BIT_KHR,
model_buffer.vertex_offset + (model_buffer.is_static ? static_vertex_handle : dynamic_vertex_handle),
Expand All @@ -399,7 +399,7 @@ void RaytracingExtended::create_bottom_level_acceleration_structure(bool is_upda
dynamic_index_buffer,
model_buffer.transform_matrix_buffer,
static_cast<uint32_t>(model_buffer.num_triangles),
static_cast<uint32_t>(model_buffer.num_vertices),
static_cast<uint32_t>(model_buffer.num_vertices) - 1,
sizeof(NewVertex),
0, VK_FORMAT_R32G32B32_SFLOAT, VK_GEOMETRY_OPAQUE_BIT_KHR,
model_buffer.vertex_offset + (model_buffer.is_static ? static_vertex_handle : dynamic_vertex_handle),
Expand Down

0 comments on commit b76f0f0

Please sign in to comment.