<div dir="ltr"><div><div>Is the sampled level _always_ zero or is it effected by pipe_sampler_view::u.tex.first_level?<br><br></div>Either way, can you clarify that in the docs?<br><br></div>-Brian<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 7, 2017 at 5:32 AM, Marek Olšák <span dir="ltr"><<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Marek Olšák <<a href="mailto:marek.olsak@amd.com">marek.olsak@amd.com</a>><br>
<br>
for better code generation in radeonsi<br>
---<br>
src/gallium/auxiliary/tgsi/<wbr>tgsi_info.c | 5 +++--<br>
src/gallium/auxiliary/tgsi/<wbr>tgsi_scan.c | 2 ++<br>
src/gallium/docs/source/tgsi.<wbr>rst | 24 ++++++++++++++++++++++++<br>
src/gallium/include/pipe/p_<wbr>shader_tokens.h | 4 ++--<br>
4 files changed, 31 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/gallium/auxiliary/tgsi/<wbr>tgsi_info.c b/src/gallium/auxiliary/tgsi/<wbr>tgsi_info.c<br>
index f8bedee..42521d7 100644<br>
--- a/src/gallium/auxiliary/tgsi/<wbr>tgsi_info.c<br>
+++ b/src/gallium/auxiliary/tgsi/<wbr>tgsi_info.c<br>
@@ -47,29 +47,29 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =<br>
{ 1, 2, 0, 0, 0, 0, 0, COMP, "MUL", TGSI_OPCODE_MUL },<br>
{ 1, 2, 0, 0, 0, 0, 0, COMP, "ADD", TGSI_OPCODE_ADD },<br>
{ 1, 2, 0, 0, 0, 0, 0, REPL, "DP3", TGSI_OPCODE_DP3 },<br>
{ 1, 2, 0, 0, 0, 0, 0, REPL, "DP4", TGSI_OPCODE_DP4 },<br>
{ 1, 2, 0, 0, 0, 0, 0, CHAN, "DST", TGSI_OPCODE_DST },<br>
{ 1, 2, 0, 0, 0, 0, 0, COMP, "MIN", TGSI_OPCODE_MIN },<br>
{ 1, 2, 0, 0, 0, 0, 0, COMP, "MAX", TGSI_OPCODE_MAX },<br>
{ 1, 2, 0, 0, 0, 0, 0, COMP, "SLT", TGSI_OPCODE_SLT },<br>
{ 1, 2, 0, 0, 0, 0, 0, COMP, "SGE", TGSI_OPCODE_SGE },<br>
{ 1, 3, 0, 0, 0, 0, 0, COMP, "MAD", TGSI_OPCODE_MAD },<br>
- { 1, 2, 0, 0, 0, 0, 0, COMP, "", 17 }, /* removed */<br>
+ { 1, 2, 1, 0, 0, 0, 0, OTHR, "TEX_LZ", TGSI_OPCODE_TEX_LZ },<br>
{ 1, 3, 0, 0, 0, 0, 0, COMP, "LRP", TGSI_OPCODE_LRP },<br>
{ 1, 3, 0, 0, 0, 0, 0, COMP, "FMA", TGSI_OPCODE_FMA },<br>
{ 1, 1, 0, 0, 0, 0, 0, REPL, "SQRT", TGSI_OPCODE_SQRT },<br>
{ 1, 3, 0, 0, 0, 0, 0, REPL, "DP2A", TGSI_OPCODE_DP2A },<br>
{ 1, 1, 0, 0, 0, 0, 0, COMP, "F2U64", TGSI_OPCODE_F2U64 },<br>
{ 1, 1, 0, 0, 0, 0, 0, COMP, "F2I64", TGSI_OPCODE_F2I64 },<br>
{ 1, 1, 0, 0, 0, 0, 0, COMP, "FRC", TGSI_OPCODE_FRC },<br>
- { 1, 3, 0, 0, 0, 0, 0, COMP, "", 25 }, /* removed */<br>
+ { 1, 2, 1, 0, 0, 0, 0, OTHR, "TXF_LZ", TGSI_OPCODE_TXF_LZ },<br>
{ 1, 1, 0, 0, 0, 0, 0, COMP, "FLR", TGSI_OPCODE_FLR },<br>
{ 1, 1, 0, 0, 0, 0, 0, COMP, "ROUND", TGSI_OPCODE_ROUND },<br>
{ 1, 1, 0, 0, 0, 0, 0, REPL, "EX2", TGSI_OPCODE_EX2 },<br>
{ 1, 1, 0, 0, 0, 0, 0, REPL, "LG2", TGSI_OPCODE_LG2 },<br>
{ 1, 2, 0, 0, 0, 0, 0, REPL, "POW", TGSI_OPCODE_POW },<br>
{ 1, 2, 0, 0, 0, 0, 0, COMP, "XPD", TGSI_OPCODE_XPD },<br>
{ 1, 1, 0, 0, 0, 0, 0, COMP, "U2I64", TGSI_OPCODE_U2I64 },<br>
{ 1, 1, 0, 0, 0, 0, 0, COMP, "", 33 }, /* removed */<br>
{ 1, 1, 0, 0, 0, 0, 0, COMP, "I2I64", TGSI_OPCODE_I2I64 },<br>
{ 1, 2, 0, 0, 0, 0, 0, REPL, "DPH", TGSI_OPCODE_DPH },<br>
@@ -469,20 +469,21 @@ tgsi_opcode_infer_type( uint opcode )<br>
<br>
/*<br>
* infer the source type of a TGSI opcode.<br>
*/<br>
enum tgsi_opcode_type<br>
tgsi_opcode_infer_src_type( uint opcode )<br>
{<br>
switch (opcode) {<br>
case TGSI_OPCODE_UIF:<br>
case TGSI_OPCODE_TXF:<br>
+ case TGSI_OPCODE_TXF_LZ:<br>
case TGSI_OPCODE_BREAKC:<br>
case TGSI_OPCODE_U2F:<br>
case TGSI_OPCODE_U2D:<br>
case TGSI_OPCODE_UADD:<br>
case TGSI_OPCODE_SWITCH:<br>
case TGSI_OPCODE_CASE:<br>
case TGSI_OPCODE_SAMPLE_I:<br>
case TGSI_OPCODE_SAMPLE_I_MS:<br>
case TGSI_OPCODE_UMUL_HI:<br>
case TGSI_OPCODE_UP2H:<br>
diff --git a/src/gallium/auxiliary/tgsi/<wbr>tgsi_scan.c b/src/gallium/auxiliary/tgsi/<wbr>tgsi_scan.c<br>
index 99799fa..bf614db 100644<br>
--- a/src/gallium/auxiliary/tgsi/<wbr>tgsi_scan.c<br>
+++ b/src/gallium/auxiliary/tgsi/<wbr>tgsi_scan.c<br>
@@ -80,20 +80,22 @@ is_texture_inst(unsigned opcode)<br>
* Is the opcode an instruction which computes a derivative explicitly or<br>
* implicitly?<br>
*/<br>
static bool<br>
computes_derivative(unsigned opcode)<br>
{<br>
if (tgsi_get_opcode_info(opcode)-<wbr>>is_tex) {<br>
return opcode != TGSI_OPCODE_TG4 &&<br>
opcode != TGSI_OPCODE_TXD &&<br>
opcode != TGSI_OPCODE_TXF &&<br>
+ opcode != TGSI_OPCODE_TXF_LZ &&<br>
+ opcode != TGSI_OPCODE_TEX_LZ &&<br>
opcode != TGSI_OPCODE_TXL &&<br>
opcode != TGSI_OPCODE_TXL2 &&<br>
opcode != TGSI_OPCODE_TXQ &&<br>
opcode != TGSI_OPCODE_TXQ_LZ &&<br>
opcode != TGSI_OPCODE_TXQS;<br>
}<br>
<br>
return opcode == TGSI_OPCODE_DDX || opcode == TGSI_OPCODE_DDX_FINE ||<br>
opcode == TGSI_OPCODE_DDY || opcode == TGSI_OPCODE_DDY_FINE ||<br>
opcode == TGSI_OPCODE_SAMPLE ||<br>
diff --git a/src/gallium/docs/source/<wbr>tgsi.rst b/src/gallium/docs/source/<wbr>tgsi.rst<br>
index 32ec4ef..b77271a 100644<br>
--- a/src/gallium/docs/source/<wbr>tgsi.rst<br>
+++ b/src/gallium/docs/source/<wbr>tgsi.rst<br>
@@ -748,20 +748,39 @@ This instruction replicates its result.<br>
<br>
.. opcode:: DP2 - 2-component Dot Product<br>
<br>
This instruction replicates its result.<br>
<br>
.. math::<br>
<br>
dst = src0.x \times src1.x + src0.y \times src1.y<br>
<br>
<br>
+.. opcode:: TEX_LZ - Texture Lookup With LOD = 0<br>
+<br>
+.. math::<br>
+<br>
+ coord.x = src0.x<br>
+<br>
+ coord.y = src0.y<br>
+<br>
+ coord.z = src0.z<br>
+<br>
+ coord.w = none<br>
+<br>
+ lod = 0<br>
+<br>
+ unit = src1<br>
+<br>
+ dst = texture\_sample(unit, coord, lod)<br>
+<br>
+<br>
.. opcode:: TXL - Texture Lookup With explicit LOD<br>
<br>
for cube map array textures, the explicit lod value<br>
cannot be passed in src0.w, and TXL2 must be used instead.<br>
<br>
if the target is a shadow texture, the reference value is always<br>
in src.z (this prevents shadow 3d / 2d array / cube targets from<br>
using this instruction, but this is not needed).<br>
<br>
.. math::<br>
@@ -915,20 +934,25 @@ XXX doesn't look like most of the opcodes really belong here.<br>
<br>
As per NV_gpu_shader4, extract a single texel from a specified texture<br>
image. The source sampler may not be a CUBE or SHADOW. src 0 is a<br>
four-component signed integer vector used to identify the single texel<br>
accessed. 3 components + level. Just like texture instructions, an optional<br>
offset vector is provided, which is subject to various driver restrictions<br>
(regarding range, source of offsets).<br>
TXF(uint_vec coord, int_vec offset).<br>
<br>
<br>
+.. opcode:: TXF_LZ - Texel Fetch<br>
+<br>
+ Same as TXF, but the fetched mipmap level is 0.<br>
+<br>
+<br>
.. opcode:: TXQ - Texture Size Query<br>
<br>
As per NV_gpu_program4, retrieve the dimensions of the texture depending on<br>
the target. For 1D (width), 2D/RECT/CUBE (width, height), 3D (width, height,<br>
depth), 1D array (width, layers), 2D array (width, height, layers).<br>
Also return the number of accessible levels (last_level - first_level + 1)<br>
in W.<br>
<br>
For components which don't return a resource dimension, their value<br>
is undefined.<br>
diff --git a/src/gallium/include/pipe/p_<wbr>shader_tokens.h b/src/gallium/include/pipe/p_<wbr>shader_tokens.h<br>
index 1118604..6a3fb98 100644<br>
--- a/src/gallium/include/pipe/p_<wbr>shader_tokens.h<br>
+++ b/src/gallium/include/pipe/p_<wbr>shader_tokens.h<br>
@@ -339,29 +339,29 @@ struct tgsi_property_data {<br>
#define TGSI_OPCODE_MUL 7<br>
#define TGSI_OPCODE_ADD 8<br>
#define TGSI_OPCODE_DP3 9<br>
#define TGSI_OPCODE_DP4 10<br>
#define TGSI_OPCODE_DST 11<br>
#define TGSI_OPCODE_MIN 12<br>
#define TGSI_OPCODE_MAX 13<br>
#define TGSI_OPCODE_SLT 14<br>
#define TGSI_OPCODE_SGE 15<br>
#define TGSI_OPCODE_MAD 16<br>
-/* gap */<br>
+#define TGSI_OPCODE_TEX_LZ 17<br>
#define TGSI_OPCODE_LRP 18<br>
#define TGSI_OPCODE_FMA 19<br>
#define TGSI_OPCODE_SQRT 20<br>
#define TGSI_OPCODE_DP2A 21<br>
#define TGSI_OPCODE_F2U64 22<br>
#define TGSI_OPCODE_F2I64 23<br>
#define TGSI_OPCODE_FRC 24<br>
-/* gap */<br>
+#define TGSI_OPCODE_TXF_LZ 25<br>
#define TGSI_OPCODE_FLR 26<br>
#define TGSI_OPCODE_ROUND 27<br>
#define TGSI_OPCODE_EX2 28<br>
#define TGSI_OPCODE_LG2 29<br>
#define TGSI_OPCODE_POW 30<br>
#define TGSI_OPCODE_XPD 31<br>
#define TGSI_OPCODE_U2I64 32<br>
/* gap */<br>
#define TGSI_OPCODE_I2I64 34<br>
#define TGSI_OPCODE_DPH 35<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div>