Reduces vertex maximum stride to 16

https://wikis.khronos.org/opengl/Vertex_Specification_Best_Practices

> The alignment of any attribute's data should be no less than 4 bytes.

But to make it a bit safer for older drivers we prefer to use 16 bytes
alignment (vec4) for now to match std140.
This commit is contained in:
Vladislav Belov
2026-07-12 17:54:26 +02:00
parent db8c05572f
commit abf444d91c
3 changed files with 4 additions and 7 deletions
+2 -2
View File
@@ -62,7 +62,7 @@ namespace
//
// Created on a model load and read by a compute shader for each frame where
// the model is visible.
// InputVertex(size/stride=64):
// InputVertex(size/stride=48):
// vec4/CVector4D tangent (offset=0)
// vec3/CVector3D normal (offset=16)
// vec3/CVector3D position (offset=32)
@@ -251,7 +251,7 @@ ModelDefRData::ModelDefRData(const CModelDefPtr& modelDef)
m_UVArray.FreeBackingStore();
}
ENSURE(m_Array.GetStride() == INPUT_VERTEX_ATTRIBUTE_ALIGNMENT * 4);
ENSURE(m_Array.GetStride() == INPUT_VERTEX_ATTRIBUTE_ALIGNMENT * 3);
ENSURE(m_Position.offset == INPUT_VERTEX_POSITION_OFFSET);
ENSURE(m_Normal.offset == INPUT_VERTEX_NORMAL_OFFSET);
ENSURE(m_Tangent.offset == INPUT_VERTEX_TANGENT_OFFSET);