Vertex Descriptor/PlayStation 3

From Burnout Wiki

Structures

renderengine::VertexDescriptor

Offset Length Type Name Description Comments
0x0 0x4 int32_t m_refCount Always 0?
0x4 0x4 uint32_t m_typesFlags Denotes which element types are present See flags
General formula is 1 << elementType for each element, combined with a bitwise OR.
0x8 0x2 uint16_t m_numStreams Number of streams Always 1?
0xA 0x2 uint16_t m_numElements Number of elements Maximum allowed is 16
0xC 0x2 uint16_t m_frequencyDividerOperation Frequency divider operation for each element One bit per element. See operation
Always modulo?
0xE 0x2 uint16_t m_pad0 Padding
0x10 0x8 Element[1] m_elements Elements

renderengine::VertexDescriptor::Element

Offset Length Type Name Description Comments
0x0 0x1 uint8_t vertexType Datatype of each coordinate See vertex type
0x1 0x1 uint8_t numComponents Number of components
0x2 0x1 uint8_t stream Stream index
0x3 0x1 uint8_t offset Starting offset of the vertex attribute array
0x4 0x2 uint16_t stride Offset bytes between consecutive vertices
0x6 0x1 uint8_t type Element type See element type
0x7 0x1 uint8_t elementClass Element class See element class

Footer

The resource always ends with 0xFF00FF0000000000. It is unclear what this is and it does not appear to be pointed to or a part of any other structure.

Enumerations

Type flags

Note that flags do not appear to affect elements in any way.

Name Value Comments
ELEMENTTYPEFLAG_XYZ 0x1
ELEMENTTYPEFLAG_WEIGHTS 0x2
ELEMENTTYPEFLAG_NORMAL 0x4
ELEMENTTYPEFLAG_VERTEXCOLOR 0x8
ELEMENTTYPEFLAG_SPECULAR 0x10
ELEMENTTYPEFLAG_INDICES 0x80
ELEMENTTYPEFLAG_TEX0 0x100
ELEMENTTYPEFLAG_TEX1 0x200
ELEMENTTYPEFLAG_TEX2 0x400
ELEMENTTYPEFLAG_TEX3 0x800
ELEMENTTYPEFLAG_TEX4 0x1000
ELEMENTTYPEFLAG_TEX5 0x2000
ELEMENTTYPEFLAG_TEX6 0x4000
ELEMENTTYPEFLAG_TANGENT 0x4000
ELEMENTTYPEFLAG_TEX7 0x8000
ELEMENTTYPEFLAG_BINORMAL 0x8000

Attributes 5 and 6 (flag values 0x20 and 0x40) are legal values, but they do not have an assigned use on PS3.

Frequency divider operation

From the SCE PS3 SDK.

Name Value Comments
CELL_GCM_FREQUENCY_DIVIDE 0 index = vertex / VertexAttribute.Frequency
CELL_GCM_FREQUENCY_MODULO 1 index = vertex % VertexAttribute.Frequency

Vertex type

From the SCE PS3 SDK.

Name Value Comments
CELL_GCM_VERTEX_S1 1 Use an array of a 16-bit signed integer-type vertex attribute
Value normalized to [-1 - 1] will be passed to the vertex shader
CELL_GCM_VERTEX_F 2 Use an array of a 32-bit float-type vertex attribute
Not normalized
CELL_GCM_VERTEX_SF 3 Use an array of a 16-bit float-type vertex attribute
Not normalized
CELL_GCM_VERTEX_UB 4 Use an array of an 8-bit unsigned integer-type vertex attribute
Value normalized to [0 - 1] will be passed to the vertex shader
CELL_GCM_VERTEX_S32K 5 Use an array of a 16-bit signed integer-type vertex attribute
Not normalized
CELL_GCM_VERTEX_CMP 6 Use an array of a vertex attribute compressed to 32 bits (11:11:10)
CELL_GCM_VERTEX_UB256 7 Use an array of an 8-bit unsigned integer-type vertex attribute
Not normalized

renderengine::VertexDescriptor::ElementType

Name Platform Name Value Comments
ELEMENTTYPE_XYZ ELEMENTTYPE_PS3ATTRIBUTE0 0
ELEMENTTYPE_WEIGHTS ELEMENTTYPE_PS3ATTRIBUTE1 1
ELEMENTTYPE_NORMAL ELEMENTTYPE_PS3ATTRIBUTE2 2
ELEMENTTYPE_VERTEXCOLOR ELEMENTTYPE_PS3ATTRIBUTE3 3
ELEMENTTYPE_SPECULAR ELEMENTTYPE_PS3ATTRIBUTE4 4
unassigned ELEMENTTYPE_PS3ATTRIBUTE5 5
unassigned ELEMENTTYPE_PS3ATTRIBUTE6 6
ELEMENTTYPE_INDICES ELEMENTTYPE_PS3ATTRIBUTE7 7
ELEMENTTYPE_TEX0 ELEMENTTYPE_PS3ATTRIBUTE8 8
ELEMENTTYPE_TEX1 ELEMENTTYPE_PS3ATTRIBUTE9 9
ELEMENTTYPE_TEX2 ELEMENTTYPE_PS3ATTRIBUTE10 10
ELEMENTTYPE_TEX3 ELEMENTTYPE_PS3ATTRIBUTE11 11
ELEMENTTYPE_TEX4 ELEMENTTYPE_PS3ATTRIBUTE12 12
ELEMENTTYPE_TEX5 ELEMENTTYPE_PS3ATTRIBUTE13 13
ELEMENTTYPE_TEX6
ELEMENTTYPE_TANGENT
ELEMENTTYPE_PS3ATTRIBUTE14 14
ELEMENTTYPE_TEX7
ELEMENTTYPE_BINORMAL
ELEMENTTYPE_PS3ATTRIBUTE15 15
ELEMENTTYPE_MAX 15
ELEMENTTYPE_NUM 16
ELEMENTTYPE_NA 255
ELEMENTTYPE_FORCEENUMSIZEINT 0x7FFFFFFF

renderengine::VertexDescriptor::ElementClass

Name Value Comments
ELEMENTCLASS_NA 0
ELEMENTCLASS_PERVERTEX 1
ELEMENTCLASS_PERINSTANCE 2
ELEMENTCLASS_FORCEENUMSIZEINT 0x7FFFFFFF