gallium: add TGSI opcodes TEX_LZ and TXF_LZ

for better code generation in radeonsi
This commit is contained in:
Marek Olšák 2017-03-07 02:15:14 +01:00
parent bf3cdf0fd3
commit cca0389c72
4 changed files with 39 additions and 5 deletions

View File

@ -54,7 +54,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 2, 0, 0, 0, 0, 0, COMP, "SLT", TGSI_OPCODE_SLT },
{ 1, 2, 0, 0, 0, 0, 0, COMP, "SGE", TGSI_OPCODE_SGE },
{ 1, 3, 0, 0, 0, 0, 0, COMP, "MAD", TGSI_OPCODE_MAD },
{ 1, 2, 0, 0, 0, 0, 0, COMP, "", 17 }, /* removed */
{ 1, 2, 1, 0, 0, 0, 0, OTHR, "TEX_LZ", TGSI_OPCODE_TEX_LZ },
{ 1, 3, 0, 0, 0, 0, 0, COMP, "LRP", TGSI_OPCODE_LRP },
{ 1, 3, 0, 0, 0, 0, 0, COMP, "FMA", TGSI_OPCODE_FMA },
{ 1, 1, 0, 0, 0, 0, 0, REPL, "SQRT", TGSI_OPCODE_SQRT },
@ -62,7 +62,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 1, 0, 0, 0, 0, 0, COMP, "F2U64", TGSI_OPCODE_F2U64 },
{ 1, 1, 0, 0, 0, 0, 0, COMP, "F2I64", TGSI_OPCODE_F2I64 },
{ 1, 1, 0, 0, 0, 0, 0, COMP, "FRC", TGSI_OPCODE_FRC },
{ 1, 3, 0, 0, 0, 0, 0, COMP, "", 25 }, /* removed */
{ 1, 2, 1, 0, 0, 0, 0, OTHR, "TXF_LZ", TGSI_OPCODE_TXF_LZ },
{ 1, 1, 0, 0, 0, 0, 0, COMP, "FLR", TGSI_OPCODE_FLR },
{ 1, 1, 0, 0, 0, 0, 0, COMP, "ROUND", TGSI_OPCODE_ROUND },
{ 1, 1, 0, 0, 0, 0, 0, REPL, "EX2", TGSI_OPCODE_EX2 },
@ -478,6 +478,7 @@ tgsi_opcode_infer_src_type( uint opcode )
switch (opcode) {
case TGSI_OPCODE_UIF:
case TGSI_OPCODE_TXF:
case TGSI_OPCODE_TXF_LZ:
case TGSI_OPCODE_BREAKC:
case TGSI_OPCODE_U2F:
case TGSI_OPCODE_U2D:

View File

@ -87,6 +87,8 @@ computes_derivative(unsigned opcode)
return opcode != TGSI_OPCODE_TG4 &&
opcode != TGSI_OPCODE_TXD &&
opcode != TGSI_OPCODE_TXF &&
opcode != TGSI_OPCODE_TXF_LZ &&
opcode != TGSI_OPCODE_TEX_LZ &&
opcode != TGSI_OPCODE_TXL &&
opcode != TGSI_OPCODE_TXL2 &&
opcode != TGSI_OPCODE_TXQ &&

View File

@ -755,6 +755,29 @@ This instruction replicates its result.
dst = src0.x \times src1.x + src0.y \times src1.y
.. opcode:: TEX_LZ - Texture Lookup With LOD = 0
This is the same as TXL with LOD = 0. Like every texture opcode, it obeys
pipe_sampler_view::u.tex.first_level and pipe_sampler_state::min_lod.
There is no way to override those two in shaders.
.. math::
coord.x = src0.x
coord.y = src0.y
coord.z = src0.z
coord.w = none
lod = 0
unit = src1
dst = texture\_sample(unit, coord, lod)
.. opcode:: TXL - Texture Lookup With explicit LOD
for cube map array textures, the explicit lod value
@ -918,10 +941,18 @@ XXX doesn't look like most of the opcodes really belong here.
four-component signed integer vector used to identify the single texel
accessed. 3 components + level. Just like texture instructions, an optional
offset vector is provided, which is subject to various driver restrictions
(regarding range, source of offsets).
(regarding range, source of offsets). This instruction ignores the sampler
state.
TXF(uint_vec coord, int_vec offset).
.. opcode:: TXF_LZ - Texel Fetch
This is the same as TXF with level = 0. Like TXF, it obeys
pipe_sampler_view::u.tex.first_level.
.. opcode:: TXQ - Texture Size Query
As per NV_gpu_program4, retrieve the dimensions of the texture depending on

View File

@ -346,7 +346,7 @@ struct tgsi_property_data {
#define TGSI_OPCODE_SLT 14
#define TGSI_OPCODE_SGE 15
#define TGSI_OPCODE_MAD 16
/* gap */
#define TGSI_OPCODE_TEX_LZ 17
#define TGSI_OPCODE_LRP 18
#define TGSI_OPCODE_FMA 19
#define TGSI_OPCODE_SQRT 20
@ -354,7 +354,7 @@ struct tgsi_property_data {
#define TGSI_OPCODE_F2U64 22
#define TGSI_OPCODE_F2I64 23
#define TGSI_OPCODE_FRC 24
/* gap */
#define TGSI_OPCODE_TXF_LZ 25
#define TGSI_OPCODE_FLR 26
#define TGSI_OPCODE_ROUND 27
#define TGSI_OPCODE_EX2 28