mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-23 03:10:33 +01:00
anv: Handle VkAccelerationStructureBuildRangeInfoKHR::transformOffset
Previously it was not actually handled. This meant that all geometries
with the same transform buffer were using the same (first) transformation
matrix.
Fixes: f3ddfd81 ("anv: Build BVHs on the GPU with GRL")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7575
Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21227>
This commit is contained in:
parent
465c241266
commit
9b2ddd2c5e
1 changed files with 7 additions and 2 deletions
|
|
@ -524,7 +524,8 @@ vk_to_grl_VertexFormat(VkFormat format)
|
|||
|
||||
static struct Geo
|
||||
vk_to_grl_Geo(const VkAccelerationStructureGeometryKHR *pGeometry,
|
||||
uint32_t prim_count)
|
||||
uint32_t prim_count,
|
||||
uint32_t transform_offset)
|
||||
{
|
||||
struct Geo geo = {
|
||||
.Flags = vk_to_grl_GeometryFlags(pGeometry->flags),
|
||||
|
|
@ -545,6 +546,9 @@ vk_to_grl_Geo(const VkAccelerationStructureGeometryKHR *pGeometry,
|
|||
vk_tri->vertexData.deviceAddress;
|
||||
geo.Desc.Triangles.VertexBufferByteStride = vk_tri->vertexStride;
|
||||
|
||||
if (geo.Desc.Triangles.pTransformBuffer)
|
||||
geo.Desc.Triangles.pTransformBuffer += transform_offset;
|
||||
|
||||
if (vk_tri->indexType == VK_INDEX_TYPE_NONE_KHR) {
|
||||
geo.Desc.Triangles.IndexCount = 0;
|
||||
geo.Desc.Triangles.VertexCount = prim_count * 3;
|
||||
|
|
@ -819,7 +823,8 @@ cmd_build_acceleration_structures(
|
|||
for (unsigned g = 0; g < bs->num_geometries; g++) {
|
||||
const VkAccelerationStructureGeometryKHR *pGeometry = get_geometry(pInfo, g);
|
||||
uint32_t prim_count = pBuildRangeInfos[g].primitiveCount;
|
||||
geos[g] = vk_to_grl_Geo(pGeometry, prim_count);
|
||||
geos[g] = vk_to_grl_Geo(pGeometry, prim_count,
|
||||
pBuildRangeInfos[g].transformOffset);
|
||||
|
||||
prefixes[g] = prefix_sum;
|
||||
prefix_sum += prim_count;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue