From 01aad5aee954e7c1e9494dcc98af8eba3901e3d8 Mon Sep 17 00:00:00 2001 From: assiduous Date: Fri, 6 Nov 2020 22:53:33 -0800 Subject: Updated handling of BLASTriangleDesc::VertexValueType and VertexComponentCount --- Graphics/GraphicsEngine/interface/BottomLevelAS.h | 13 +++++++++++-- Graphics/GraphicsEngine/src/BottomLevelASBase.cpp | 10 +++++----- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/interface/BottomLevelAS.h b/Graphics/GraphicsEngine/interface/BottomLevelAS.h index bd80e3e4..c93319da 100644 --- a/Graphics/GraphicsEngine/interface/BottomLevelAS.h +++ b/Graphics/GraphicsEngine/interface/BottomLevelAS.h @@ -58,15 +58,24 @@ struct BLASTriangleDesc Uint32 MaxVertexCount DEFAULT_INITIALIZER(0); /// The type of vertices in this geometry, see Diligent::VALUE_TYPE. + + /// \remarks Only the following combinations of VertexValueType and VertexComponentCount + /// are allowed: + /// * FLOAT32 x 2 (third component is assumed 0) + /// * FLOAT32 x 3 + /// * FLOAT16 x 2 (third component is assumed 0) + /// * FLOAT16 x 4 (fourth component is ignored) + /// * INT16 x 2 (16-bit signed-normalized, third component is assumed 0) + /// * INT16 x 4 (16-bit signed-normalized, fourth component is ignored) VALUE_TYPE VertexValueType DEFAULT_INITIALIZER(VT_UNDEFINED); /// The number of components in the vertex. - /// 2 and 3 are supported. + /// See VertexValueType for the list of allowed VertexValueType and VertexComponentCount combinations. Uint8 VertexComponentCount DEFAULT_INITIALIZER(0); /// The maximum primitive count in this geometry. /// The current number of primitives is defined in BLASBuildTriangleData::PrimitiveCount. - Uint32 MaxPrimitiveCount DEFAULT_INITIALIZER(0); + Uint32 MaxPrimitiveCount DEFAULT_INITIALIZER(0); /// Index type of this geometry, see Diligent::VALUE_TYPE. /// Must be VT_UINT16, VT_UINT32 or VT_UNDEFINED. diff --git a/Graphics/GraphicsEngine/src/BottomLevelASBase.cpp b/Graphics/GraphicsEngine/src/BottomLevelASBase.cpp index 46d82244..c0e8f058 100644 --- a/Graphics/GraphicsEngine/src/BottomLevelASBase.cpp +++ b/Graphics/GraphicsEngine/src/BottomLevelASBase.cpp @@ -63,11 +63,11 @@ void ValidateBottomLevelASDesc(const BottomLevelASDesc& Desc) noexcept(false) if (tri.GeometryName == nullptr) LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].GeometryName must not be null"); - if (tri.VertexValueType >= VT_NUM_TYPES) - LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].VertexValueType must be a valid type"); - - if (tri.VertexComponentCount != 2 && tri.VertexComponentCount != 3) - LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].VertexComponentCount must be 2 or 3"); + if (!((tri.VertexValueType == VT_FLOAT32 && (tri.VertexComponentCount == 2 || tri.VertexComponentCount == 3)) || + (tri.VertexValueType == VT_FLOAT16 && (tri.VertexComponentCount == 2 || tri.VertexComponentCount == 4)) || + (tri.VertexValueType == VT_INT16 && (tri.VertexComponentCount == 2 || tri.VertexComponentCount == 4)))) + LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].VertexValueType (", GetValueTypeString(tri.VertexValueType), + ") and .VertexComponentCount (", tri.VertexComponentCount, ") is not a valid combination"); if (tri.MaxVertexCount == 0) LOG_BLAS_ERROR_AND_THROW("pTriangles[", i, "].MaxVertexCount must be greater than 0"); -- cgit v1.2.3