Vertex Descriptor/PlayStation 3: Difference between revisions

From Burnout Wiki
Content added Content deleted
(Created page.)
 
(flag info)
Line 6: Line 6:
| 0x0 || 0x4 || int32_t || m_refCount || || Always 0?
| 0x0 || 0x4 || int32_t || m_refCount || || Always 0?
|-
|-
| 0x4 || 0x4 || uint32_t || m_typesFlags || Type flags? || See [[#Type flags|flags]]
| 0x4 || 0x4 || uint32_t || m_typesFlags || Denotes which element types are present || See [[#Type flags|flags]]<br />General formula is <code>1 << elementType</code> for each element, combined with a bitwise AND.
|-
|-
| 0x8 || 0x2 || uint16_t || m_numStreams || Number of streams || Always 1?
| 0x8 || 0x2 || uint16_t || m_numStreams || Number of streams || Always 1?
|-
|-
| 0xA || 0x2 || uint16_t || m_numElements || Number of elements ||
| 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 || Always 1?<br />One bit per element. See [[#Frequency divider operation|operation]]
| 0xC || 0x2 || uint16_t || m_frequencyDividerOperation || Frequency divider operation for each element || One bit per element. See [[#Frequency divider operation|operation]]<br />Always modulo?
|-
|-
| 0xE || 0x2 || uint16_t || m_pad0 || Padding ||
| 0xE || 0x2 || uint16_t || m_pad0 || Padding ||
Line 47: Line 47:
! Name !! Value !! Comments
! Name !! Value !! Comments
|-
|-
| ? || 0x1 ||
| ELEMENTTYPEFLAG_XYZ || 0x1 ||
|-
|-
| ? || 0x2 ||
| ELEMENTTYPEFLAG_WEIGHTS || 0x2 ||
|-
|-
| ? || 0x4 ||
| ELEMENTTYPEFLAG_NORMAL || 0x4 ||
|-
|-
| ? || 0x8 ||
| ELEMENTTYPEFLAG_VERTEXCOLOR || 0x8 ||
|-
|-
| ? || 0x10 ||
| ELEMENTTYPEFLAG_SPECULAR || 0x10 ||
|-
|-
| ? || 0x20 ||
| || 0x20 ||
|-
|-
| ? || 0x40 ||
| || 0x40 ||
|-
|-
| ? || 0x80 ||
| ELEMENTTYPEFLAG_INDICES || 0x80 ||
|-
|-
| ? || 0x100 ||
| ELEMENTTYPEFLAG_TEX0 || 0x100 ||
|-
|-
| ? || 0x200 ||
| ELEMENTTYPEFLAG_TEX1 || 0x200 ||
|-
|-
| ? || 0x400 ||
| ELEMENTTYPEFLAG_TEX2 || 0x400 ||
|-
|-
| ? || 0x800 ||
| ELEMENTTYPEFLAG_TEX3 || 0x800 ||
|-
|-
| ? || 0x1000 ||
| ELEMENTTYPEFLAG_TEX4 || 0x1000 ||
|-
|-
| ? || 0x2000 ||
| ELEMENTTYPEFLAG_TEX5 || 0x2000 ||
|-
|-
| ? || 0x4000 ||
| ELEMENTTYPEFLAG_TEX6 || 0x4000 ||
|-
| ELEMENTTYPEFLAG_TANGENT || 0x4000 ||
|-
| ELEMENTTYPEFLAG_TEX7 || 0x8000 ||
|-
| ELEMENTTYPEFLAG_BINORMAL || 0x8000 ||
|}
|}



Revision as of 02:51, 12 February 2023

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 AND.
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
0x20
0x40
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

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 Value Comments
ELEMENTTYPE_XYZ 0
ELEMENTTYPE_PS3ATTRIBUTE0 0
ELEMENTTYPE_WEIGHTS 1
ELEMENTTYPE_PS3ATTRIBUTE1 1
ELEMENTTYPE_NORMAL 2
ELEMENTTYPE_PS3ATTRIBUTE2 2
ELEMENTTYPE_PS3ATTRIBUTE3 3
ELEMENTTYPE_VERTEXCOLOR 3
ELEMENTTYPE_SPECULAR 4
ELEMENTTYPE_PS3ATTRIBUTE4 4
ELEMENTTYPE_PS3ATTRIBUTE5 5
ELEMENTTYPE_PS3ATTRIBUTE6 6
ELEMENTTYPE_PS3ATTRIBUTE7 7
ELEMENTTYPE_INDICES 7
ELEMENTTYPE_TEX0 8
ELEMENTTYPE_PS3ATTRIBUTE8 8
ELEMENTTYPE_TEX1 9
ELEMENTTYPE_PS3ATTRIBUTE9 9
ELEMENTTYPE_TEX2 10
ELEMENTTYPE_PS3ATTRIBUTE10 10
ELEMENTTYPE_PS3ATTRIBUTE11 11
ELEMENTTYPE_TEX3 11
ELEMENTTYPE_TEX4 12
ELEMENTTYPE_PS3ATTRIBUTE12 12
ELEMENTTYPE_PS3ATTRIBUTE13 13
ELEMENTTYPE_TEX5 13
ELEMENTTYPE_PS3ATTRIBUTE14 14
ELEMENTTYPE_TEX6 14
ELEMENTTYPE_TANGENT 14
ELEMENTTYPE_BINORMAL 15
ELEMENTTYPE_TEX7 15
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