Skip to content

Commit c6dd9ac

Browse files
author
kevyuu
committed
Transform data minimum alignment fix
1 parent e0b30d0 commit c6dd9ac

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

include/nbl/asset/IAccelerationStructure.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ namespace nbl::asset
2323
class IAccelerationStructure : public virtual core::IReferenceCounted
2424
{
2525
public:
26+
static constexpr inline size_t TRANSFORM_DATA_MIN_ALIGNMENT = 16;
27+
2628
// build flags, we don't expose flags that don't make sense for certain levels
2729
enum class BUILD_FLAGS : uint8_t
2830
{

src/nbl/video/utilities/CAssetConverter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3024,7 +3024,7 @@ auto CAssetConverter::reserve(const SInputs& inputs) -> SReserveResult
30243024
uint16_t alignment = hlsl::max(0x1u<<hlsl::findLSB(geom.vertexStride),32u);
30253025
if (geom.hasTransform())
30263026
{
3027-
size = core::alignUp(size,alignof(float))+sizeof(hlsl::float32_t3x4);
3027+
size = core::alignUp(size, IAccelerationStructure::TRANSFORM_DATA_MIN_ALIGNMENT)+sizeof(hlsl::float32_t3x4);
30283028
alignment = hlsl::max<uint16_t>(alignof(float),alignment);
30293029
}
30303030
uint16_t indexSize = 0;
@@ -5061,7 +5061,7 @@ ISemaphore::future_t<IQueue::RESULT> CAssetConverter::convert_impl(SReserveResul
50615061
uint16_t alignment = hlsl::max(0x1u<<hlsl::findLSB(geom.vertexStride),32u);
50625062
if (geom.hasTransform())
50635063
{
5064-
size = core::alignUp(size,alignof(float))+sizeof(hlsl::float32_t3x4);
5064+
size = core::alignUp(size, IAccelerationStructure::TRANSFORM_DATA_MIN_ALIGNMENT)+sizeof(hlsl::float32_t3x4);
50655065
alignment = hlsl::max<uint16_t>(alignof(float),alignment);
50665066
}
50675067
uint16_t indexSize = 0u;
@@ -5265,7 +5265,7 @@ ISemaphore::future_t<IQueue::RESULT> CAssetConverter::convert_impl(SReserveResul
52655265
}
52665266
if (geom.hasTransform())
52675267
{
5268-
offset = core::alignUp(offset,alignof(float));
5268+
offset = core::alignUp(offset, IAccelerationStructure::TRANSFORM_DATA_MIN_ALIGNMENT);
52695269
outGeom.transform = {.offset=offset,.buffer=smart_refctd_ptr<const IGPUBuffer>(scratchBuffer)};
52705270
memcpyCallback.data = &geom.transform;
52715271
if (!streamDataToScratch(offset,sizeof(geom.transform),memcpyCallback))

0 commit comments

Comments
 (0)