tgsi: add properties for fragment coord conventions (v3)

Changes in v3:
- Documented the new properties
- Added comments for property values
- Rebased to current master

Changes in v2:
- Caps are added in a separate, subsequent patch

This adds two TGSI fragment program properties that indicate the
fragment coord conventions.

The properties behave as described in the extension spec for
GL_ARB_fragment_coord_conventions, but the default origin in
upper left instead of lower left as in OpenGL.

The syntax is:
PROPERTY FS_COORD_ORIGIN [UPPER_LEFT|LOWER_LEFT]
PROPERTY FS_COORD_PIXEL_CENTER [HALF_INTEGER|INTEGER]

The names have been chosen for consistency with the GS properties
and the OpenGL extension spec.

The defaults are of course the previously assumed conventions:
UPPER_LEFT and HALF_INTEGER.
This commit is contained in:
Luca Barbieri
2010-01-21 05:36:14 +01:00
parent 3cea5525d0
commit 73317139a4
6 changed files with 175 additions and 6 deletions

View File

@@ -1319,9 +1319,8 @@ are the Cartesian coordinates, and ``w`` is the homogenous coordinate and used
for the perspective divide, if enabled.
As a vertex shader output, position should be scaled to the viewport. When
used in fragment shaders, position will ---
XXX --- wait a minute. Should position be in [0,1] for x and y?
used in fragment shaders, position will be in window coordinates. The convention
used depends on the FS_COORD_ORIGIN and FS_COORD_PIXEL_CENTER properties.
XXX additionally, is there a way to configure the perspective divide? it's
accelerated on most chipsets AFAIK...
@@ -1400,3 +1399,45 @@ TGSI_SEMANTIC_EDGEFLAG
""""""""""""""""""""""
XXX no clue
Properties
^^^^^^^^^^^^^^^^^^^^^^^^
Properties are general directives that apply to the whole TGSI program.
FS_COORD_ORIGIN
"""""""""""""""
Specifies the fragment shader TGSI_SEMANTIC_POSITION coordinate origin.
The default value is UPPER_LEFT.
If UPPER_LEFT, the position will be (0,0) at the upper left corner and
increase downward and rightward.
If LOWER_LEFT, the position will be (0,0) at the lower left corner and
increase upward and rightward.
OpenGL defaults to LOWER_LEFT, and is configurable with the
GL_ARB_fragment_coord_conventions extension.
DirectX 9/10 use UPPER_LEFT.
FS_COORD_PIXEL_CENTER
"""""""""""""""""""""
Specifies the fragment shader TGSI_SEMANTIC_POSITION pixel center convention.
The default value is HALF_INTEGER.
If HALF_INTEGER, the fractionary part of the position will be 0.5
If INTEGER, the fractionary part of the position will be 0.0
Note that this does not affect the set of fragments generated by
rasterization, which is instead controlled by gl_rasterization_rules in the
rasterizer.
OpenGL defaults to HALF_INTEGER, and is configurable with the
GL_ARB_fragment_coord_conventions extension.
DirectX 9 uses INTEGER.
DirectX 10 uses HALF_INTEGER.