From ef1c1e25d67efdb2d05e8226d1b6dd6f2568caf8 Mon Sep 17 00:00:00 2001 From: mlefrancois Date: Wed, 30 Aug 2023 10:39:32 +0200 Subject: [PATCH] Fixed maxVertex value Following specification: maxVertex is the highest index of a vertex that will be addressed by a build command using this structure. --- docs/vkrt_tuto_indirect_scissor.md.html | 2 +- docs/vkrt_tutorial.md.html | 2 +- ray_tracing__advance/raytrace.cpp | 2 +- ray_tracing__simple/hello_vulkan.cpp | 2 +- ray_tracing_advanced_compilation/hello_vulkan.cpp | 2 +- ray_tracing_animation/hello_vulkan.cpp | 2 +- ray_tracing_anyhit/hello_vulkan.cpp | 2 +- ray_tracing_ao/hello_vulkan.cpp | 2 +- ray_tracing_callable/hello_vulkan.cpp | 2 +- ray_tracing_gltf/README.md | 2 +- ray_tracing_gltf/hello_vulkan.cpp | 2 +- ray_tracing_indirect_scissor/hello_vulkan.cpp | 4 ++-- ray_tracing_instances/hello_vulkan.cpp | 2 +- ray_tracing_intersection/hello_vulkan.cpp | 2 +- ray_tracing_jitter_cam/hello_vulkan.cpp | 2 +- ray_tracing_manyhits/hello_vulkan.cpp | 2 +- ray_tracing_motionblur/hello_vulkan.cpp | 2 +- ray_tracing_rayquery/hello_vulkan.cpp | 2 +- ray_tracing_reflections/hello_vulkan.cpp | 2 +- ray_tracing_specialization/hello_vulkan.cpp | 2 +- 20 files changed, 21 insertions(+), 21 deletions(-) diff --git a/docs/vkrt_tuto_indirect_scissor.md.html b/docs/vkrt_tuto_indirect_scissor.md.html index 67e772d..e16d8dc 100644 --- a/docs/vkrt_tuto_indirect_scissor.md.html +++ b/docs/vkrt_tuto_indirect_scissor.md.html @@ -604,7 +604,7 @@ triangles.indexType = VK_INDEX_TYPE_UINT32; triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; -triangles.maxVertex = uint32_t(vertices.size()); +triangles.maxVertex = uint32_t(vertices.size()) - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/docs/vkrt_tutorial.md.html b/docs/vkrt_tutorial.md.html index 394145c..13fc7f0 100644 --- a/docs/vkrt_tutorial.md.html +++ b/docs/vkrt_tutorial.md.html @@ -301,7 +301,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing__advance/raytrace.cpp b/ray_tracing__advance/raytrace.cpp index e7d959c..d84269f 100644 --- a/ray_tracing__advance/raytrace.cpp +++ b/ray_tracing__advance/raytrace.cpp @@ -75,7 +75,7 @@ auto Raytracer::objectToVkGeometryKHR(const ObjModel& model) triangles.indexType = VK_INDEX_TYPE_UINT32; triangles.indexData.deviceAddress = indexAddress; triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Setting up the build info of the acceleration VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing__simple/hello_vulkan.cpp b/ray_tracing__simple/hello_vulkan.cpp index d8e6aec..f33e2d1 100644 --- a/ray_tracing__simple/hello_vulkan.cpp +++ b/ray_tracing__simple/hello_vulkan.cpp @@ -615,7 +615,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_advanced_compilation/hello_vulkan.cpp b/ray_tracing_advanced_compilation/hello_vulkan.cpp index 50b4f3c..b1ce6bb 100644 --- a/ray_tracing_advanced_compilation/hello_vulkan.cpp +++ b/ray_tracing_advanced_compilation/hello_vulkan.cpp @@ -622,7 +622,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_animation/hello_vulkan.cpp b/ray_tracing_animation/hello_vulkan.cpp index e36b035..e063de0 100644 --- a/ray_tracing_animation/hello_vulkan.cpp +++ b/ray_tracing_animation/hello_vulkan.cpp @@ -624,7 +624,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_anyhit/hello_vulkan.cpp b/ray_tracing_anyhit/hello_vulkan.cpp index d39c97b..3893b8c 100644 --- a/ray_tracing_anyhit/hello_vulkan.cpp +++ b/ray_tracing_anyhit/hello_vulkan.cpp @@ -617,7 +617,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_ao/hello_vulkan.cpp b/ray_tracing_ao/hello_vulkan.cpp index 15b0b34..65fe564 100644 --- a/ray_tracing_ao/hello_vulkan.cpp +++ b/ray_tracing_ao/hello_vulkan.cpp @@ -659,7 +659,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_callable/hello_vulkan.cpp b/ray_tracing_callable/hello_vulkan.cpp index 75bef57..64a8d32 100644 --- a/ray_tracing_callable/hello_vulkan.cpp +++ b/ray_tracing_callable/hello_vulkan.cpp @@ -618,7 +618,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_gltf/README.md b/ray_tracing_gltf/README.md index f5efc6b..8cf9fc0 100644 --- a/ray_tracing_gltf/README.md +++ b/ray_tracing_gltf/README.md @@ -229,7 +229,7 @@ auto HelloVulkan::primitiveToGeometry(const nvh::GltfPrimMesh& prim) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = prim.vertexCount; + triangles.maxVertex = prim.vertexCount - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_gltf/hello_vulkan.cpp b/ray_tracing_gltf/hello_vulkan.cpp index 5107bc9..69ee0f2 100644 --- a/ray_tracing_gltf/hello_vulkan.cpp +++ b/ray_tracing_gltf/hello_vulkan.cpp @@ -606,7 +606,7 @@ auto HelloVulkan::primitiveToVkGeometry(const nvh::GltfPrimMesh& prim) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = prim.vertexCount; + triangles.maxVertex = prim.vertexCount - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_indirect_scissor/hello_vulkan.cpp b/ray_tracing_indirect_scissor/hello_vulkan.cpp index 58b3fa7..1f4efea 100644 --- a/ray_tracing_indirect_scissor/hello_vulkan.cpp +++ b/ray_tracing_indirect_scissor/hello_vulkan.cpp @@ -631,7 +631,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; @@ -767,7 +767,7 @@ void HelloVulkan::createLanternModel() triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = uint32_t(vertices.size()); + triangles.maxVertex = uint32_t(vertices.size()) - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_instances/hello_vulkan.cpp b/ray_tracing_instances/hello_vulkan.cpp index 31f0040..004042e 100644 --- a/ray_tracing_instances/hello_vulkan.cpp +++ b/ray_tracing_instances/hello_vulkan.cpp @@ -619,7 +619,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_intersection/hello_vulkan.cpp b/ray_tracing_intersection/hello_vulkan.cpp index f95039e..f1a970e 100644 --- a/ray_tracing_intersection/hello_vulkan.cpp +++ b/ray_tracing_intersection/hello_vulkan.cpp @@ -630,7 +630,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_jitter_cam/hello_vulkan.cpp b/ray_tracing_jitter_cam/hello_vulkan.cpp index a8c6e2d..f2b1260 100644 --- a/ray_tracing_jitter_cam/hello_vulkan.cpp +++ b/ray_tracing_jitter_cam/hello_vulkan.cpp @@ -617,7 +617,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_manyhits/hello_vulkan.cpp b/ray_tracing_manyhits/hello_vulkan.cpp index aaeed5b..a02610d 100644 --- a/ray_tracing_manyhits/hello_vulkan.cpp +++ b/ray_tracing_manyhits/hello_vulkan.cpp @@ -624,7 +624,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_motionblur/hello_vulkan.cpp b/ray_tracing_motionblur/hello_vulkan.cpp index dcd8369..c183c99 100644 --- a/ray_tracing_motionblur/hello_vulkan.cpp +++ b/ray_tracing_motionblur/hello_vulkan.cpp @@ -616,7 +616,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_rayquery/hello_vulkan.cpp b/ray_tracing_rayquery/hello_vulkan.cpp index 8ef66b0..9185264 100644 --- a/ray_tracing_rayquery/hello_vulkan.cpp +++ b/ray_tracing_rayquery/hello_vulkan.cpp @@ -618,7 +618,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_reflections/hello_vulkan.cpp b/ray_tracing_reflections/hello_vulkan.cpp index 1b48dc0..598a94e 100644 --- a/ray_tracing_reflections/hello_vulkan.cpp +++ b/ray_tracing_reflections/hello_vulkan.cpp @@ -615,7 +615,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR}; diff --git a/ray_tracing_specialization/hello_vulkan.cpp b/ray_tracing_specialization/hello_vulkan.cpp index ea98960..5e16aff 100644 --- a/ray_tracing_specialization/hello_vulkan.cpp +++ b/ray_tracing_specialization/hello_vulkan.cpp @@ -618,7 +618,7 @@ auto HelloVulkan::objectToVkGeometryKHR(const ObjModel& model) triangles.indexData.deviceAddress = indexAddress; // Indicate identity transform by setting transformData to null device pointer. //triangles.transformData = {}; - triangles.maxVertex = model.nbVertices; + triangles.maxVertex = model.nbVertices - 1; // Identify the above data as containing opaque triangles. VkAccelerationStructureGeometryKHR asGeom{VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR};