Commit 5041f530 authored by Zack Rusin's avatar Zack Rusin

gallium: add docs for resources and new opcodes

parent 063dcfcf
......@@ -3640,11 +3640,11 @@ exec_instruction(
break;
case TGSI_OPCODE_SAMPLE_C:
assert(0);
exec_sample(mach, inst, TEX_MODIFIER_NONE);
break;
case TGSI_OPCODE_SAMPLE_C_LZ:
assert(0);
exec_sample(mach, inst, TEX_MODIFIER_LOD_BIAS);
break;
case TGSI_OPCODE_SAMPLE_D:
......
......@@ -1174,6 +1174,110 @@ Double Opcodes
dst.zw = \sqrt{src.zw}
.. _resourceopcodes:
Resource Access Opcodes
^^^^^^^^^^^^^^^^^^^^^^^^
Those opcodes follow very closely semantics of the respective Direct3D
instructions. If in doubt double check Direct3D documentation.
.. opcode:: LOAD - Simplified alternative to the "SAMPLE" instruction.
Using the provided integer address, LOAD fetches data
from the specified buffer/texture without any filtering.
The source data may come from any resource type other
than CUBE.
LOAD dst, address, resource
e.g.
LOAD TEMP[0], TEMP[1], RES[0]
.. opcode:: LOAD_MS - Just like LOAD but allows fetch data from
multi-sampled surfaces.
.. opcode:: SAMPLE - Using provided address, sample data from the
specified texture using the filtering mode identified
by the gven sampler. The source data may come from
any resource type other than buffers.
SAMPLE dst, address, resource, sampler
e.g.
SAMPLE TEMP[0], TEMP[1], RES[0], SAMP[0]
.. opcode:: SAMPLE_B - Just like the SAMPLE instruction with the
exception that an additiona bias is applied to the
level of detail computed as part of the instruction
execution.
SAMPLE_B dst, address, resource, sampler, lod_bias
e.g.
SAMPLE_B TEMP[0], TEMP[1], RES[0], SAMP[0], TEMP[2].x
.. opcode:: SAMPLE_C - Similar to the SAMPLE instruction but it
performs a comparison filter. The operands to SAMPLE_C
are identical to SAMPLE, except that tere is an additional
float32 operand, reference value, which must be a register
with single-component, or a scalar literal.
SAMPLE_C makes the hardware use the current samplers
compare_func (in pipe_sampler_state) to compare
reference value against the red component value for the
surce resource at each texel that the currently configured
texture filter covers based on the provided coordinates.
SAMPLE_C dst, address, resource.r, sampler, ref_value
e.g.
SAMPLE_C TEMP[0], TEMP[1], RES[0].r, SAMP[0], TEMP[2].x
.. opcode:: SAMPLE_C_LZ - Same as SAMPLE_C, but LOD is 0 and derivatives
are ignored. The LZ stands for level-zero.
SAMPLE_C_LZ dst, address, resource.r, sampler, ref_value
e.g.
SAMPLE_C_LZ TEMP[0], TEMP[1], RES[0].r, SAMP[0], TEMP[2].x
.. opcode:: SAMPLE_D - SAMPLE_D is identical to the SAMPLE opcode except
that the derivatives for the source address in the x
direction and the y direction are provided by extra
parameters.
SAMPLE_D dst, address, resource, sampler, der_x, der_y
e.g.
SAMPLE_D TEMP[0], TEMP[1], RES[0], SAMP[0], TEMP[2], TEMP[3]
.. opcode:: SAMPLE_L - SAMPLE_L is identical to the SAMPLE opcode except
that the LOD is provided directly as a scalar value,
representing no anisotropy. Source addresses A channel
is used as the LOD.
SAMPLE_L dst, address, resource, sampler
e.g.
SAMPLE_L TEMP[0], TEMP[1], RES[0], SAMP[0]
.. opcode:: GATHER4 - Gathers the four texels to be used in a bi-linear
filtering operation and packs them into a single register.
Only woth with 2D, 2D array, cubemaps, and cubemaps arrays.
For 2D textures, only the addressing modes of the sampler and
the top level of any mip pyramid are used. Set W to zero.
It behaves like the SAMPLE instruction, but a filtered
sample is not generated. The four samples that contribute
to filtering are places into xyzw in cunter-clockwise order,
starting with the (u,v) texture coordinate delta at the
following locations (-, +), (+, +), (+, -), (-, -), where
the magnitude of the deltas are half a texel.
.. opcode:: RESINFO - query the dimentions of a given input buffer.
dst receives width, height, depth or array size and
total mip count (also can be slected by writemask).
RESINFO dst, src_mip_level, resource
e.g.
RESINFO TEMP[0], TEMP[1].x, RES[0]
.. opcode:: SAMPLE_POS - query the position of a given sample.
dst receives float4 (x, y, 0, 0) indicated where the
sample is located. If the resource is not a multi-sample
resource and not a render target, the result is 0.
.. opcode:: SAMPLE_INFO - dst receives number of components in x.
If the resource is not a multi-sample resource and
not a render target, the result is 0.
Explanation of symbols used
------------------------------
......@@ -1256,6 +1360,8 @@ wrapping when interpolating by the rasteriser. If TGSI_CYLINDRICAL_WRAP_X
is set to 1, the X component should be interpolated according to cylindrical
wrapping rules.
If file is TGSI_FILE_RESOURCE, a Declaration Resource token follows.
Declaration Semantic
^^^^^^^^^^^^^^^^^^^^^^^^
......@@ -1366,6 +1472,23 @@ TGSI_SEMANTIC_EDGEFLAG
XXX no clue
Declaration Resource
^^^^^^^^^^^^^^^^^^^^^^^^
Follows Declaration token if file is TGSI_FILE_RESOURCE.
DCL RES[#], resource, type(s)
Declares a shader input resource and assigns it to a RES[#]
register.
resource can be one of BUFFER, 1D, 2D, 3D, CUBE, 1DArray and
2DArray.
type must be 1 or 4 entries (if specifying on a per-component
level) out of UNORM, SNORM, SINT, UINT and FLOAT.
Properties
^^^^^^^^^^^^^^^^^^^^^^^^
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment