Skip to content

Commit 93f1101

Browse files
azhirnovTheMostDiligent
authored andcommitted
Updated RayTracingProperties struct, updated RT tests
1 parent 42d3b14 commit 93f1101

File tree

7 files changed

+159
-55
lines changed

7 files changed

+159
-55
lines changed

Graphics/GraphicsEngine/include/DeviceContextBase.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ bool VerifyStateTransitionDesc(const IRenderDevice* pDevice,
8282
DeviceContextIndex ExecutionCtxId,
8383
const DeviceContextDesc& CtxDesc);
8484

85-
bool VerifyBuildBLASAttribs(const IRenderDevice* pDevice, const BuildBLASAttribs& Attribs);
86-
bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs);
85+
bool VerifyBuildBLASAttribs(const BuildBLASAttribs& Attribs, const RayTracingProperties& RTProps);
86+
bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs, const RayTracingProperties& RTProps);
8787
bool VerifyCopyBLASAttribs(const IRenderDevice* pDevice, const CopyBLASAttribs& Attribs);
8888
bool VerifyCopyTLASAttribs(const CopyTLASAttribs& Attribs);
8989
bool VerifyWriteBLASCompactedSizeAttribs(const IRenderDevice* pDevice, const WriteBLASCompactedSizeAttribs& Attribs);
@@ -1727,7 +1727,7 @@ void DeviceContextBase<ImplementationTraits>::BuildBLAS(const BuildBLASAttribs&
17271727
DVP_CHECK_QUEUE_TYPE_COMPATIBILITY(COMMAND_QUEUE_TYPE_COMPUTE, "BuildBLAS");
17281728
DEV_CHECK_ERR(m_pDevice->GetFeatures().RayTracing, "IDeviceContext::BuildBLAS: ray tracing is not supported by this device");
17291729
DEV_CHECK_ERR(m_pActiveRenderPass == nullptr, "IDeviceContext::BuildBLAS command must be performed outside of render pass");
1730-
DEV_CHECK_ERR(VerifyBuildBLASAttribs(m_pDevice, Attribs), "BuildBLASAttribs are invalid");
1730+
DEV_CHECK_ERR(VerifyBuildBLASAttribs(Attribs, m_pDevice->GetAdapterInfo().RayTracing), "BuildBLASAttribs are invalid");
17311731
}
17321732

17331733
template <typename ImplementationTraits>
@@ -1736,7 +1736,7 @@ void DeviceContextBase<ImplementationTraits>::BuildTLAS(const BuildTLASAttribs&
17361736
DVP_CHECK_QUEUE_TYPE_COMPATIBILITY(COMMAND_QUEUE_TYPE_COMPUTE, "BuildTLAS");
17371737
DEV_CHECK_ERR(m_pDevice->GetFeatures().RayTracing, "IDeviceContext::BuildTLAS: ray tracing is not supported by this device");
17381738
DEV_CHECK_ERR(m_pActiveRenderPass == nullptr, "IDeviceContext::BuildTLAS command must be performed outside of render pass");
1739-
DEV_CHECK_ERR(VerifyBuildTLASAttribs(Attribs), "BuildTLASAttribs are invalid");
1739+
DEV_CHECK_ERR(VerifyBuildTLASAttribs(Attribs, m_pDevice->GetAdapterInfo().RayTracing), "BuildTLASAttribs are invalid");
17401740
}
17411741

17421742
template <typename ImplementationTraits>

Graphics/GraphicsEngine/interface/DeviceContext.h

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,9 +990,11 @@ struct BLASBuildTriangleData
990990
IBuffer* pVertexBuffer DEFAULT_INITIALIZER(nullptr);
991991

992992
/// Data offset in bytes in pVertexBuffer.
993+
/// Offset must be aligned by RayTracingProperties::VertexBufferAlignmnent and a multiple of VertexStride.
993994
Uint32 VertexOffset DEFAULT_INITIALIZER(0);
994995

995996
/// Stride in bytes between vertices.
997+
/// Stride must be a multiple of the VertexValueType size.
996998
Uint32 VertexStride DEFAULT_INITIALIZER(0);
997999

9981000
/// The number of triangle vertices.
@@ -1017,17 +1019,21 @@ struct BLASBuildTriangleData
10171019
IBuffer* pIndexBuffer DEFAULT_INITIALIZER(nullptr);
10181020

10191021
/// Data offset in bytes in pIndexBuffer.
1022+
/// Offset must be aligned by RayTracingProperties::IndexBufferAlignment
1023+
/// and must be a multiple of index size.
10201024
Uint32 IndexOffset DEFAULT_INITIALIZER(0);
10211025

10221026
/// The type of triangle indices, see Diligent::VALUE_TYPE.
10231027
/// This is an optional value. Must be undefined or same as in BLASTriangleDesc.
10241028
VALUE_TYPE IndexType DEFAULT_INITIALIZER(VT_UNDEFINED);
10251029

1026-
/// Geometry transformation data source.
1030+
/// Geometry transformation data source, must contain a float4x3 matrix aka Diligent::InstanceMatrix.
10271031
/// The buffer must be created with BIND_RAY_TRACING flag.
1032+
/// \note Transform buffer is not supported in Metal backend.
10281033
IBuffer* pTransformBuffer DEFAULT_INITIALIZER(nullptr);
10291034

10301035
/// Data offset in bytes in pTransformBuffer.
1036+
/// Offset must be aligned by RayTracingProperties::TransformBufferAlignment.
10311037
Uint32 TransformBufferOffset DEFAULT_INITIALIZER(0);
10321038

10331039
/// Geometry flags, se Diligent::RAYTRACING_GEOMETRY_FLAGS.
@@ -1054,9 +1060,12 @@ struct BLASBuildBoundingBoxData
10541060
IBuffer* pBoxBuffer DEFAULT_INITIALIZER(nullptr);
10551061

10561062
/// Data offset in bytes in pBoxBuffer.
1063+
/// Offset must be aligned by RayTracingProperties::BoxBufferAlignment
1064+
/// and must be a multiple of BoxStride.
10571065
Uint32 BoxOffset DEFAULT_INITIALIZER(0);
10581066

10591067
/// Stride in bytes between each AABB.
1068+
/// Stride must be aligned by RayTracingProperties::BoxBufferAlignment.
10601069
Uint32 BoxStride DEFAULT_INITIALIZER(0);
10611070

10621071
/// Number of AABBs.
@@ -1116,6 +1125,7 @@ struct BuildBLASAttribs
11161125
IBuffer* pScratchBuffer DEFAULT_INITIALIZER(nullptr);
11171126

11181127
/// Offset from the beginning of the buffer.
1128+
/// Offset must be aligned by RayTracingProperties::ScratchBufferAlignment.
11191129
Uint32 ScratchBufferOffset DEFAULT_INITIALIZER(0);
11201130

11211131
/// Scratch buffer state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
@@ -1268,6 +1278,7 @@ struct BuildTLASAttribs
12681278
IBuffer* pInstanceBuffer DEFAULT_INITIALIZER(nullptr);
12691279

12701280
/// Offset from the beginning of the buffer to the location of instance data.
1281+
/// Offset must be aligned by RayTracingProperties::InstanceBufferAlignment.
12711282
Uint32 InstanceBufferOffset DEFAULT_INITIALIZER(0);
12721283

12731284
/// Instance buffer state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).
@@ -1297,6 +1308,7 @@ struct BuildTLASAttribs
12971308
IBuffer* pScratchBuffer DEFAULT_INITIALIZER(nullptr);
12981309

12991310
/// Offset from the beginning of the buffer.
1311+
/// Offset must be aligned by RayTracingProperties::ScratchBufferAlignment.
13001312
Uint32 ScratchBufferOffset DEFAULT_INITIALIZER(0);
13011313

13021314
/// Scratch buffer state transition mode (see Diligent::RESOURCE_STATE_TRANSITION_MODE).

Graphics/GraphicsEngine/interface/GraphicsTypes.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,6 +1995,24 @@ struct RayTracingProperties
19951995
/// The maximum number of geometries in a bottom-level AS.
19961996
Uint32 MaxGeometriesPerBLAS DEFAULT_INITIALIZER(0);
19971997

1998+
/// The minimum alignment for vertex buffer offset in BLASBuildTriangleData::VertexOffset.
1999+
Uint32 VertexBufferAlignmnent DEFAULT_INITIALIZER(0);
2000+
2001+
/// The minimum alignment for index buffer offset in BLASBuildTriangleData::IndexOffset.
2002+
Uint32 IndexBufferAlignment DEFAULT_INITIALIZER(0);
2003+
2004+
/// The minimum alignment for transform buffer offset in BLASBuildTriangleData::TransformBufferOffset.
2005+
Uint32 TransformBufferAlignment DEFAULT_INITIALIZER(0);
2006+
2007+
/// The minimum alignment for box buffer offset in BLASBuildBoundingBoxData::BoxOffset.
2008+
Uint32 BoxBufferAlignment DEFAULT_INITIALIZER(0);
2009+
2010+
/// The minimum alignment for scratch buffer offset in BuildBLASAttribs::ScratchBufferOffset and BuildTLASAttribs::ScratchBufferOffset.
2011+
Uint32 ScratchBufferAlignment DEFAULT_INITIALIZER(0);
2012+
2013+
/// The minimum alignment for instance buffer offset in BuildTLASAttribs::InstanceBufferOffset.
2014+
Uint32 InstanceBufferAlignment DEFAULT_INITIALIZER(0);
2015+
19982016
/// Ray tracing capability flags, see Diligent::RAY_TRACING_CAP_FLAGS.
19992017
RAY_TRACING_CAP_FLAGS CapFlags DEFAULT_INITIALIZER(RAY_TRACING_CAP_FLAG_NONE);
20002018
};

Graphics/GraphicsEngine/src/DeviceContextBase.cpp

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ bool VerifyStateTransitionDesc(const IRenderDevice* pDevice,
433433
}
434434

435435

436-
bool VerifyBuildBLASAttribs(const IRenderDevice* pDevice, const BuildBLASAttribs& Attribs)
436+
bool VerifyBuildBLASAttribs(const BuildBLASAttribs& Attribs, const RayTracingProperties& RTProps)
437437
{
438438
#define CHECK_BUILD_BLAS_ATTRIBS(Expr, ...) CHECK_PARAMETER(Expr, "Build BLAS attribs are invalid: ", __VA_ARGS__)
439439

@@ -443,8 +443,7 @@ bool VerifyBuildBLASAttribs(const IRenderDevice* pDevice, const BuildBLASAttribs
443443
CHECK_BUILD_BLAS_ATTRIBS(Attribs.pBoxData != nullptr || Attribs.BoxDataCount == 0, "BoxDataCount is ", Attribs.BoxDataCount, ", but pBoxData is null.");
444444
CHECK_BUILD_BLAS_ATTRIBS(Attribs.pTriangleData != nullptr || Attribs.TriangleDataCount == 0, "TriangleDataCount is ", Attribs.TriangleDataCount, ", but pTriangleData is null.");
445445

446-
const auto& BLASDesc = Attribs.pBLAS->GetDesc();
447-
const auto DeviceType = pDevice->GetDeviceInfo().Type;
446+
const auto& BLASDesc = Attribs.pBLAS->GetDesc();
448447

449448
CHECK_BUILD_BLAS_ATTRIBS(Attribs.BoxDataCount <= BLASDesc.BoxCount, "BoxDataCount (", Attribs.BoxDataCount, ") must be less than or equal to pBLAS->GetDesc().BoxCount (", BLASDesc.BoxCount, ").");
450449
CHECK_BUILD_BLAS_ATTRIBS(Attribs.TriangleDataCount <= BLASDesc.TriangleCount, "TriangleDataCount (", Attribs.TriangleDataCount, ") must be less than or equal to pBLAS->GetDesc().TriangleCount (", BLASDesc.TriangleCount, ").");
@@ -496,6 +495,10 @@ bool VerifyBuildBLASAttribs(const IRenderDevice* pDevice, const BuildBLASAttribs
496495
"pTriangleData[", i, "].VertexOffset (", tri.VertexOffset, ") must be a multiple of VertexStride (",
497496
tri.VertexStride, ").");
498497

498+
CHECK_BUILD_BLAS_ATTRIBS(tri.VertexOffset % RTProps.VertexBufferAlignmnent == 0,
499+
"pTriangleData[", i, "].VertexOffset (", tri.VertexOffset, ") must be aligned by ", RTProps.VertexBufferAlignmnent,
500+
" (RayTracingProperties::VertexBufferAlignmnent)");
501+
499502
CHECK_BUILD_BLAS_ATTRIBS(tri.VertexOffset + VertexDataSize <= VertBufDesc.uiSizeInBytes,
500503
"pTriangleData[", i, "].pVertexBuffer is too small for the specified VertexStride (", tri.VertexStride, ") and VertexCount (",
501504
tri.VertexCount, "): at least ", tri.VertexOffset + VertexDataSize, " bytes are required.");
@@ -519,19 +522,15 @@ bool VerifyBuildBLASAttribs(const IRenderDevice* pDevice, const BuildBLASAttribs
519522
"pTriangleData[", i, "].pIndexBuffer was not created with BIND_RAY_TRACING flag.");
520523

521524
CHECK_BUILD_BLAS_ATTRIBS(tri.IndexOffset + IndexDataSize <= InstBufDesc.uiSizeInBytes,
522-
"pTriangleData[", i, "].pIndexBuffer is too small for specified IndexType and IndexCount: at least",
525+
"pTriangleData[", i, "].pIndexBuffer is too small for specified IndexType and IndexCount: at least ",
523526
tri.IndexOffset + IndexDataSize, " bytes are required.");
524527

525528
CHECK_BUILD_BLAS_ATTRIBS(tri.IndexOffset % GetValueSize(TriDesc.IndexType) == 0,
526529
"pTriangleData[", i, "].IndexOffset (", tri.IndexOffset, ") must be a multiple of (", GetValueSize(TriDesc.IndexType), ") bytes.");
527530

528-
if (DeviceType == RENDER_DEVICE_TYPE_METAL)
529-
{
530-
const Uint32 MtlIndexOffsetAlignment = 32;
531-
CHECK_BUILD_BLAS_ATTRIBS(tri.IndexOffset % MtlIndexOffsetAlignment == 0,
532-
"pTriangleData[", i, "].IndexOffset (", tri.IndexOffset,
533-
") must be a multiple of the platform buffer offset alignment (", MtlIndexOffsetAlignment, ").");
534-
}
531+
CHECK_BUILD_BLAS_ATTRIBS(tri.IndexOffset % RTProps.IndexBufferAlignment == 0,
532+
"pTriangleData[", i, "].IndexOffset (", tri.IndexOffset, ") must be aligned by ", RTProps.IndexBufferAlignment,
533+
" (RayTracingProperties::IndexBufferAlignment).");
535534
}
536535
else
537536
{
@@ -544,18 +543,28 @@ bool VerifyBuildBLASAttribs(const IRenderDevice* pDevice, const BuildBLASAttribs
544543

545544
if (tri.pTransformBuffer != nullptr)
546545
{
547-
CHECK_BUILD_BLAS_ATTRIBS((tri.pTransformBuffer->GetDesc().BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING,
546+
const auto& TrfrmBufDesc = tri.pTransformBuffer->GetDesc();
547+
548+
CHECK_BUILD_BLAS_ATTRIBS((TrfrmBufDesc.BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING,
548549
"pTriangleData[", i, "].pTransformBuffer was not created with BIND_RAY_TRACING flag.");
549550

550551
CHECK_BUILD_BLAS_ATTRIBS(TriDesc.AllowsTransforms, "pTriangleData[", i, "] uses transform buffer, but AllowsTransforms is false.");
552+
553+
CHECK_BUILD_BLAS_ATTRIBS(tri.TransformBufferOffset + sizeof(InstanceMatrix) <= TrfrmBufDesc.uiSizeInBytes,
554+
"pTriangleData[", i, "].pTransformBuffer is too small: at least ", tri.TransformBufferOffset + sizeof(InstanceMatrix), " bytes are required.");
555+
556+
CHECK_BUILD_BLAS_ATTRIBS(tri.TransformBufferOffset % RTProps.TransformBufferAlignment == 0,
557+
"pTriangleData[", i, "].TransformBufferOffset (", tri.TransformBufferOffset, ") must be aligned by ", RTProps.TransformBufferAlignment,
558+
" (RayTracingProperties::TransformBufferAlignment).");
551559
}
552560
}
553561

554562
for (Uint32 i = 0; i < Attribs.BoxDataCount; ++i)
555563
{
556-
const auto& box = Attribs.pBoxData[i];
557-
const Uint32 BoxSize = sizeof(float) * 6;
558-
const Uint32 GeomIndex = Attribs.pBLAS->GetGeometryDescIndex(box.GeometryName);
564+
const auto& box = Attribs.pBoxData[i];
565+
const Uint32 BoxSize = sizeof(float) * 6;
566+
const Uint32 BoxBufferSize = box.BoxCount * box.BoxStride;
567+
const Uint32 GeomIndex = Attribs.pBLAS->GetGeometryDescIndex(box.GeometryName);
559568

560569
CHECK_BUILD_BLAS_ATTRIBS(GeomIndex != INVALID_INDEX,
561570
"pBoxData[", i, "].GeometryName (", box.GeometryName, ") is not found in BLAS description.");
@@ -567,12 +576,24 @@ bool VerifyBuildBLASAttribs(const IRenderDevice* pDevice, const BuildBLASAttribs
567576

568577
CHECK_BUILD_BLAS_ATTRIBS(box.BoxStride >= BoxSize,
569578
"pBoxData[", i, "].BoxStride (", box.BoxStride, ") must be at least ", BoxSize, " bytes.");
570-
CHECK_BUILD_BLAS_ATTRIBS(box.BoxStride % 8 == 0,
571-
"pBoxData[", i, "].BoxStride (", box.BoxStride, ") must be aligned to 8 bytes.");
579+
580+
const Uint32 BoxStrideAlignment = 8;
581+
CHECK_BUILD_BLAS_ATTRIBS(box.BoxStride % BoxStrideAlignment == 0,
582+
"pBoxData[", i, "].BoxStride (", box.BoxStride, ") must be aligned by ", BoxStrideAlignment, ".");
583+
584+
CHECK_BUILD_BLAS_ATTRIBS(box.BoxOffset % RTProps.BoxBufferAlignment == 0,
585+
"pBoxData[", i, "].BoxOffset (", box.BoxOffset, ") must be aligned by ", RTProps.BoxBufferAlignment,
586+
" (RayTracingProperties::BoxBufferAlignment).");
572587

573588
CHECK_BUILD_BLAS_ATTRIBS(box.pBoxBuffer != nullptr, "pBoxData[", i, "].pBoxBuffer must not be null.");
574589

575-
CHECK_BUILD_BLAS_ATTRIBS((box.pBoxBuffer->GetDesc().BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING,
590+
const auto& BoxBufDesc = box.pBoxBuffer->GetDesc();
591+
592+
CHECK_BUILD_BLAS_ATTRIBS(box.BoxOffset + BoxBufferSize <= BoxBufDesc.uiSizeInBytes,
593+
"pBoxData[", i, "].pBoxBuffer is too small for the specified BoxStride (", box.BoxStride,
594+
") and BoxCount (", box.BoxCount, "): at least", box.BoxOffset + BoxBufferSize, " bytes are required.");
595+
596+
CHECK_BUILD_BLAS_ATTRIBS((BoxBufDesc.BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING,
576597
"pBoxData[", i, "].pBoxBuffer was not created with BIND_RAY_TRACING flag.");
577598
}
578599

@@ -581,6 +602,10 @@ bool VerifyBuildBLASAttribs(const IRenderDevice* pDevice, const BuildBLASAttribs
581602
CHECK_BUILD_BLAS_ATTRIBS(Attribs.ScratchBufferOffset <= ScratchDesc.uiSizeInBytes,
582603
"ScratchBufferOffset (", Attribs.ScratchBufferOffset, ") is greater than the buffer size (", ScratchDesc.uiSizeInBytes, ").");
583604

605+
CHECK_BUILD_BLAS_ATTRIBS(Attribs.ScratchBufferOffset % RTProps.ScratchBufferAlignment == 0,
606+
"ScratchBufferOffset (", Attribs.ScratchBufferOffset, ") must be aligned by ", RTProps.ScratchBufferAlignment,
607+
" (RayTracingProperties::ScratchBufferAlignment).");
608+
584609
if (Attribs.Update)
585610
{
586611
CHECK_BUILD_BLAS_ATTRIBS(ScratchDesc.uiSizeInBytes - Attribs.ScratchBufferOffset >= Attribs.pBLAS->GetScratchBufferSizes().Update,
@@ -601,7 +626,7 @@ bool VerifyBuildBLASAttribs(const IRenderDevice* pDevice, const BuildBLASAttribs
601626
}
602627

603628

604-
bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs)
629+
bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs, const RayTracingProperties& RTProps)
605630
{
606631
#define CHECK_BUILD_TLAS_ATTRIBS(Expr, ...) CHECK_PARAMETER(Expr, "Build TLAS attribs are invalid: ", __VA_ARGS__)
607632

@@ -673,6 +698,10 @@ bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs)
673698
"pInstanceBuffer size (", InstDesc.uiSizeInBytes, ") is too small: at least ",
674699
InstDataSize + Attribs.InstanceBufferOffset, " bytes are required.");
675700

701+
CHECK_BUILD_TLAS_ATTRIBS(Attribs.InstanceBufferOffset % RTProps.InstanceBufferAlignment == 0,
702+
"InstanceBufferOffset (", Attribs.InstanceBufferOffset, ") must be aligned by ", RTProps.InstanceBufferAlignment,
703+
" (RayTracingProperties::InstanceBufferAlignment).");
704+
676705
CHECK_BUILD_TLAS_ATTRIBS((InstDesc.BindFlags & BIND_RAY_TRACING) == BIND_RAY_TRACING,
677706
"pInstanceBuffer was not created with BIND_RAY_TRACING flag.");
678707

@@ -681,6 +710,10 @@ bool VerifyBuildTLASAttribs(const BuildTLASAttribs& Attribs)
681710
CHECK_BUILD_TLAS_ATTRIBS(Attribs.ScratchBufferOffset <= ScratchDesc.uiSizeInBytes,
682711
"ScratchBufferOffset (", Attribs.ScratchBufferOffset, ") is greater than the buffer size (", ScratchDesc.uiSizeInBytes, ").");
683712

713+
CHECK_BUILD_TLAS_ATTRIBS(Attribs.ScratchBufferOffset % RTProps.ScratchBufferAlignment == 0,
714+
"ScratchBufferOffset (", Attribs.ScratchBufferOffset, ") must be aligned by ", RTProps.ScratchBufferAlignment,
715+
" (RayTracingProperties::ScratchBufferAlignment).");
716+
684717
if (Attribs.Update)
685718
{
686719
CHECK_BUILD_TLAS_ATTRIBS(ScratchDesc.uiSizeInBytes - Attribs.ScratchBufferOffset >= Attribs.pTLAS->GetScratchBufferSizes().Update,

Graphics/GraphicsEngineD3D12/src/EngineFactoryD3D12.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,14 +816,20 @@ GraphicsAdapterInfo EngineFactoryD3D12Impl::GetGraphicsAdapterInfo(void*
816816
RayTracingProps.MaxInstancesPerTLAS = D3D12_RAYTRACING_MAX_INSTANCES_PER_TOP_LEVEL_ACCELERATION_STRUCTURE;
817817
RayTracingProps.MaxPrimitivesPerBLAS = D3D12_RAYTRACING_MAX_PRIMITIVES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE;
818818
RayTracingProps.MaxGeometriesPerBLAS = D3D12_RAYTRACING_MAX_GEOMETRIES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE;
819+
RayTracingProps.VertexBufferAlignmnent = 1;
820+
RayTracingProps.IndexBufferAlignment = 1;
821+
RayTracingProps.TransformBufferAlignment = D3D12_RAYTRACING_TRANSFORM3X4_BYTE_ALIGNMENT;
822+
RayTracingProps.BoxBufferAlignment = D3D12_RAYTRACING_AABB_BYTE_ALIGNMENT;
823+
RayTracingProps.ScratchBufferAlignment = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_BYTE_ALIGNMENT;
824+
RayTracingProps.InstanceBufferAlignment = D3D12_RAYTRACING_INSTANCE_DESCS_BYTE_ALIGNMENT;
819825
RayTracingProps.CapFlags |= RAY_TRACING_CAP_FLAG_STANDALONE_SHADERS;
820826
}
821827
if (d3d12Features5.RaytracingTier >= D3D12_RAYTRACING_TIER_1_1)
822828
{
823829
RayTracingProps.CapFlags |= RAY_TRACING_CAP_FLAG_INLINE_RAY_TRACING | RAY_TRACING_CAP_FLAG_INDIRECT_RAY_TRACING;
824830
}
825831
#if defined(_MSC_VER) && defined(_WIN64)
826-
static_assert(sizeof(RayTracingProps) == 36, "Did you add a new member to RayTracingProperites? Please initialize it here.");
832+
static_assert(sizeof(RayTracingProps) == 60, "Did you add a new member to RayTracingProperites? Please initialize it here.");
827833
#endif
828834
}
829835
}

0 commit comments

Comments
 (0)