Changes

319 bytes added ,  11:38, 2 October 2023
Clarify LITP instruction
Line 349: Line 349:  
|  1u
 
|  1u
 
|  LITP
 
|  LITP
Appears to be related to Microsoft's [https://msdn.microsoft.com/en-us/library/windows/desktop/bb174703.aspx lit] instruction; DST = clamp(SRC1, min={0, -127.9961, 0, 0}, max={inf, 127.9961, 0, inf}); n.b.: 127.9961 = 0x7FFF / 0x100
+
Partial lighting computation, may be used in conjunction with EX2, LG2, etc to compute the vertex lighting coefficients. See the [https://msdn.microsoft.com/en-us/library/windows/desktop/bb174703.aspx Microsoft] and [https://registry.khronos.org/OpenGL/extensions/ARB/ARB_vertex_program.txt ARB] docs for more information on how to implement the full lit function; DST = {max(src.x, 0), max(min(src.y, 127.9961), -127.9961), 0, max(src.w, 0)} and it sets the cmp.x and cmp.y flags based on if the respective src.x and src.w components are >= 0.
 
|-
 
|-
 
|  0x08
 
|  0x08
Line 664: Line 664:     
a0.x and a0.y are set manually through the MOVA instruction by rounding a float value to integer precision. Hence, they may take negative values. The way out-of-bounds values behave when reading uniforms is as follows:
 
a0.x and a0.y are set manually through the MOVA instruction by rounding a float value to integer precision. Hence, they may take negative values. The way out-of-bounds values behave when reading uniforms is as follows:
* If the value is out of byte bounds (less than -128 or greater than 127), the result is the vector (0, 0, 0, 0).
+
* If the offset is out of byte bounds (less than -128 or greater than 127), the offset is not applied (treated as 0).
* If the value without its sign bit (value & 0x7F) is greater than 95, the result is the vector (1, 1, 1, 1).
+
* The offset is added to the constant register index and masked by 0x7F.
* Otherwise, the index of the resulting uniform value is the value without its sign bit (value & 0x7F).
+
* If the resulting index is greater than 95, the result is (1, 1, 1, 1).
 +
* Otherwise, the result is the value at the indexed constant register.
    
aL can only be set indirectly by the LOOP instruction. It is still accessible and valid after exiting a LOOP block, though.
 
aL can only be set indirectly by the LOOP instruction. It is still accessible and valid after exiting a LOOP block, though.
35

edits