Difference between revisions of "NV2A/Vertex attributes"

From xboxdevwiki
Jump to: navigation, search
(Tried to document draw methods / vertex uploads. Still very wip and unverified)
(Markup for FIXME)
 
(3 intermediate revisions by 2 users not shown)
Line 17: Line 17:
 
==== NV097_SET_VERTEX_DATA4F_M ... NV097_SET_VERTEX_DATA4F_M + 0xfc ====
 
==== NV097_SET_VERTEX_DATA4F_M ... NV097_SET_VERTEX_DATA4F_M + 0xfc ====
 
==== NV097_SET_VERTEX_DATA2S ... NV097_SET_VERTEX_DATA2S + 0x3c ====
 
==== 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_DATA4UB ... NV097_SET_VERTEX_DATA4UB + 0x3c ====
 
==== NV097_SET_VERTEX_DATA4S_M ... NV097_SET_VERTEX_DATA4S_M + 0x7c ====
 
==== NV097_SET_VERTEX_DATA4S_M ... NV097_SET_VERTEX_DATA4S_M + 0x7c ====
Line 22: Line 28:
 
=== Inline Array ===
 
=== Inline Array ===
  
Data uploaded through PHRAPH method NV097_INLINE_ARRAY.
+
Data uploaded through PGRAPH method NV097_INLINE_ARRAY.
 
The attributes are tightly packed in that buffer.
 
The attributes are tightly packed in that buffer.
 
Decoded using the attribute information.
 
Decoded using the attribute information.
Line 36: Line 42:
  
 
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) ===
Line 70: 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?