gallium: add TGSI_SEMANTIC_TEXCOORD,PCOORD v3
This makes it possible to identify gl_TexCoord and gl_PointCoord for drivers where sprite coordinate replacement is restricted. The new PIPE_CAP_TGSI_TEXCOORD decides whether these varyings should be hidden behind the GENERIC semantic or not. With this patch only nvc0 and nv30 will request that they be used. v2: introduce a CAP so other drivers don't have to bother with the new semantic v3: adapt to introduction gl_varying_slot enum
This commit is contained in:
@@ -159,13 +159,18 @@ Points
|
||||
|
||||
sprite_coord_enable
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
The effect of this state depends on PIPE_CAP_TGSI_TEXCOORD !
|
||||
|
||||
Controls automatic texture coordinate generation for rendering sprite points.
|
||||
|
||||
If PIPE_CAP_TGSI_TEXCOORD is false:
|
||||
When bit k in the sprite_coord_enable bitfield is set, then generic
|
||||
input k to the fragment shader will get an automatically computed
|
||||
texture coordinate.
|
||||
|
||||
If PIPE_CAP_TGSI_TEXCOORD is true:
|
||||
The bitfield refers to inputs with TEXCOORD semantic instead of generic inputs.
|
||||
|
||||
The texture coordinate will be of the form (s, t, 0, 1) where s varies
|
||||
from 0 to 1 from left to right while t varies from 0 to 1 according to
|
||||
the state of 'sprite_coord_mode' (see below).
|
||||
|
@@ -137,6 +137,14 @@ The integer capabilities:
|
||||
* ``PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT``: Describes the required
|
||||
alignment for pipe_sampler_view::u.buf.first_element, in bytes.
|
||||
If a driver does not support first/last_element, it should return 0.
|
||||
* ``PIPE_CAP_TGSI_TEXCOORD``: This CAP describes a hw limitation.
|
||||
If true, the hardware cannot replace arbitrary shader inputs with sprite
|
||||
coordinates and hence the inputs that are desired to be replaceable must
|
||||
be declared with TGSI_SEMANTIC_TEXCOORD instead of TGSI_SEMANTIC_GENERIC.
|
||||
The rasterizer's sprite_coord_enable state therefore also applies to the
|
||||
TEXCOORD semantic.
|
||||
Also, TGSI_SEMANTIC_PCOORD becomes available, which labels a fragment shader
|
||||
input that will always be replaced with sprite coordinates.
|
||||
|
||||
|
||||
.. _pipe_capf:
|
||||
|
@@ -1949,6 +1949,35 @@ When using this semantic, be sure to set the appropriate state in the
|
||||
:ref:`rasterizer` first.
|
||||
|
||||
|
||||
TGSI_SEMANTIC_TEXCOORD
|
||||
""""""""""""""""""""""
|
||||
|
||||
Only available if PIPE_CAP_TGSI_TEXCOORD is exposed !
|
||||
|
||||
Vertex shader outputs and fragment shader inputs may be labeled with
|
||||
this semantic to make them replaceable by sprite coordinates via the
|
||||
sprite_coord_enable state in the :ref:`rasterizer`.
|
||||
The semantic index permitted with this semantic is limited to <= 7.
|
||||
|
||||
If the driver does not support TEXCOORD, sprite coordinate replacement
|
||||
applies to inputs with the GENERIC semantic instead.
|
||||
|
||||
The intended use case for this semantic is gl_TexCoord.
|
||||
|
||||
|
||||
TGSI_SEMANTIC_PCOORD
|
||||
""""""""""""""""""""
|
||||
|
||||
Only available if PIPE_CAP_TGSI_TEXCOORD is exposed !
|
||||
|
||||
Fragment shader inputs may be labeled with TGSI_SEMANTIC_PCOORD to indicate
|
||||
that the register contains sprite coordinates in the form (x, y, 0, 1), if
|
||||
the current primitive is a point and point sprites are enabled. Otherwise,
|
||||
the contents of the register are undefined.
|
||||
|
||||
The intended use case for this semantic is gl_PointCoord.
|
||||
|
||||
|
||||
TGSI_SEMANTIC_GENERIC
|
||||
"""""""""""""""""""""
|
||||
|
||||
|
Reference in New Issue
Block a user