Difference between revisions of "NV2A/Vertex attributes"

From xboxdevwiki
Jump to: navigation, search
(Very rough info)
 
(Markup for FIXME)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
This article documents the attribute types which are supported by the Xbox GPU.
 
This article documents the attribute types which are supported by the Xbox GPU.
 +
Please take everything with a grain of salt - it's still being researched.
  
=== Normalized unsigned Byte (D3D) ===  
+
== Draw methods ==
 +
 
 +
=== Draw Arrays ===
 +
 
 +
Data uploaded through DMA.
 +
Each attribute has it's own offset and stride.
 +
Decoded using the attribute information.
 +
 
 +
=== Inline Buffer ===
 +
 
 +
Data uploaded and decoded through PGRAPH methods.
 +
 
 +
==== NV097_SET_VERTEX_DATA2F_M ... NV097_SET_VERTEX_DATA2F_M + 0x7c ====
 +
==== NV097_SET_VERTEX_DATA4F_M ... NV097_SET_VERTEX_DATA4F_M + 0xfc ====
 +
==== NV097_SET_VERTEX_DATA2S ... NV097_SET_VERTEX_DATA2S + 0x3c ====
 +
 
 +
Vertex attribute values provided via NV097_SET_VERTEX_DATA2S are
 +
apparently two 16-bit signed integers, packed into 32 bits, which are
 +
then to be directly mapped to floating point values in the range
 +
[-32768.0, 32767.0].
 +
 
 +
==== NV097_SET_VERTEX_DATA4UB ... NV097_SET_VERTEX_DATA4UB + 0x3c ====
 +
==== NV097_SET_VERTEX_DATA4S_M ... NV097_SET_VERTEX_DATA4S_M + 0x7c ====
 +
 
 +
=== Inline Array ===
 +
 
 +
Data uploaded through PGRAPH method NV097_INLINE_ARRAY.
 +
The attributes are tightly packed in that buffer.
 +
Decoded using the attribute information.
 +
 
 +
=== Inline Elements ===
 +
 
 +
Same as "Draw Arrays" but with an extra index buffer.
 +
The index buffer is uploaded through PGRAPH methods NV097_ARRAY_ELEMENT16 and NV097_ARRAY_ELEMENT32.
 +
 
 +
== Attribute Types ==
 +
 
 +
=== Normalized unsigned byte (D3D) ===  
  
 
Unsigned bytes aranged as ZYXW (BGRA) in memory (Also see [http://www.opengl.org/registry/specs/ARB/vertex_array_bgra.txt this GL extension]).
 
Unsigned bytes aranged as ZYXW (BGRA) in memory (Also see [http://www.opengl.org/registry/specs/ARB/vertex_array_bgra.txt this GL extension]).
This is commonly used with an attribute count of 4.
+
This is commonly used with an attribute count of 4{{FIXME|reason=Does this still work with attribute count =/= 4 ?}}.
FIXME: Does this still work with attribute count =/= 4 ?
+
Each byte will be mapped into the range{{FIXME|reason=Verify}} 0.0 to 1.0.
Each byte will be mapped into the range 0.0 to 1.0.
 
FIXME: Verify
 
  
=== Normalized unsigned Byte (GL) ===
+
=== Normalized unsigned byte (GL) ===
  
 
Unsigned bytes arranged as XYZW (RGBA) in memory.
 
Unsigned bytes arranged as XYZW (RGBA) in memory.
Line 38: Line 74:
 
FIXME: Verify
 
FIXME: Verify
 
FIXME: Is the attribute count ignored?
 
FIXME: Is the attribute count ignored?
 +
 +
 +
[[Category:NV2A]]

Latest revision as of 23:32, 22 January 2019

This article documents the attribute types which are supported by the Xbox GPU. Please take everything with a grain of salt - it's still being researched.

Draw methods

Draw Arrays

Data uploaded through DMA. Each attribute has it's own offset and stride. Decoded using the attribute information.

Inline Buffer

Data uploaded and decoded through PGRAPH methods.

NV097_SET_VERTEX_DATA2F_M ... NV097_SET_VERTEX_DATA2F_M + 0x7c

NV097_SET_VERTEX_DATA4F_M ... NV097_SET_VERTEX_DATA4F_M + 0xfc

NV097_SET_VERTEX_DATA2S ... NV097_SET_VERTEX_DATA2S + 0x3c

Vertex attribute values provided via NV097_SET_VERTEX_DATA2S are apparently two 16-bit signed integers, packed into 32 bits, which are then to be directly mapped to floating point values in the range [-32768.0, 32767.0].

NV097_SET_VERTEX_DATA4UB ... NV097_SET_VERTEX_DATA4UB + 0x3c

NV097_SET_VERTEX_DATA4S_M ... NV097_SET_VERTEX_DATA4S_M + 0x7c

Inline Array

Data uploaded through PGRAPH method NV097_INLINE_ARRAY. The attributes are tightly packed in that buffer. Decoded using the attribute information.

Inline Elements

Same as "Draw Arrays" but with an extra index buffer. The index buffer is uploaded through PGRAPH methods NV097_ARRAY_ELEMENT16 and NV097_ARRAY_ELEMENT32.

Attribute Types

Normalized unsigned byte (D3D)

Unsigned bytes aranged as ZYXW (BGRA) in memory (Also see this GL extension). This is commonly used with an attribute count of 4[FIXME]. Each byte will be mapped into the range[FIXME] 0.0 to 1.0.

Normalized unsigned byte (GL)

Unsigned bytes arranged as XYZW (RGBA) in memory. Each byte will be mapped into the range 0.0 to 1.0. FIXME: Verify

Normalized short

Shorts, arranged as XYZW. Each short will be mapped into the range -1.0 to 1.0 FIXME: Verify

Float

IEEE-754 single precision float arranged as XYZW. FIXME: What happens to NaN or denormals?

Short

Shorts, arranged as XYZW. Each short will be mapped into the range -32768.0 to 32767.0 FIXME: Verify

Compressed normal

Each 32 bit attribute is consisting of 11 bit X, 11 bit Y, 10 bit Z. Each component is signed and will be mapped into the range -1.0 to 1.0. FIXME: Verify FIXME: Is the attribute count ignored?