Mesa (master): gallium: add a a new cap for changing the TGSI TG4 instruction encoding

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Oct 11 00:32:40 UTC 2019


Module: Mesa
Branch: master
Commit: 0c09df52e10f0339973f44cef68ff5e237720c8a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0c09df52e10f0339973f44cef68ff5e237720c8a

Author: Dave Airlie <airlied at redhat.com>
Date:   Wed Oct  9 13:07:04 2019 +1000

gallium: add a a new cap for changing the TGSI TG4 instruction encoding

Accessing the TG4 component via immediates in the llvmpipe backend is quite
messy (like really messy). Roland suggested we change the instruction encoding,
so introduce a cap to allow the component to be selected to be store in the
sampler swizzle, which should be otherwise unused.

I could probably switch all drivers over, but virgl would need some work that
I'd prefer not to rush it.

Signed-off-by: Dave Airlie <airlied at redhat.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>

---

 src/gallium/auxiliary/util/u_screen.c | 1 +
 src/gallium/docs/source/screen.rst    | 1 +
 src/gallium/docs/source/tgsi.rst      | 8 ++++++++
 src/gallium/include/pipe/p_defines.h  | 1 +
 4 files changed, 11 insertions(+)

diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c
index ba99ec0615d..bf5b9daad7e 100644
--- a/src/gallium/auxiliary/util/u_screen.c
+++ b/src/gallium/auxiliary/util/u_screen.c
@@ -341,6 +341,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
    case PIPE_CAP_ATOMIC_FLOAT_MINMAX:
    case PIPE_CAP_SHADER_SAMPLES_IDENTICAL:
    case PIPE_CAP_TGSI_ATOMINC_WRAP:
+   case PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE:
       return 0;
 
    case PIPE_CAP_MAX_GS_INVOCATIONS:
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 9acab6fafc5..1c402b03391 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -558,6 +558,7 @@ The integer capabilities:
 * ``PIPE_CAP_GL_SPIRV``: True if the driver supports ARB_gl_spirv extension.
 * ``PIPE_CAP_GL_SPIRV_VARIABLE_POINTERS``: True if the driver supports Variable Pointers in SPIR-V shaders.
 * ``PIPE_CAP_DEMOTE_TO_HELPER_INVOCATION``: True if driver supports demote keyword in GLSL programs.
+* ``PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE``: True if driver wants the TG4 component encoded in sampler swizzle rather than as a separate source.
 
 .. _pipe_capf:
 
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index d58b23f024b..e053e821ecd 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -962,14 +962,22 @@ XXX doesn't look like most of the opcodes really belong here.
   require another CAP is hw can do it natively. For now we lower that before
   TGSI.
 
+  PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE changes the encoding so that component
+  is stored in the sampler source swizzle x.
+
 .. math::
 
    coord = src0
 
+   (without TGSI_TG4_COMPONENT_IN_SWIZZLE)
    component = src1
 
    dst = texture\_gather4 (unit, coord, component)
 
+   (with TGSI_TG4_COMPONENT_IN_SWIZZLE)
+   dst = texture\_gather4 (unit, coord)
+   component is encoded in sampler swizzle.
+
 (with SM5 - cube array shadow)
 
 .. math::
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 564f37dd1b5..6657271cbf6 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -903,6 +903,7 @@ enum pipe_cap
    PIPE_CAP_GL_SPIRV,
    PIPE_CAP_GL_SPIRV_VARIABLE_POINTERS,
    PIPE_CAP_DEMOTE_TO_HELPER_INVOCATION,
+   PIPE_CAP_TGSI_TG4_COMPONENT_IN_SWIZZLE,
 };
 
 /**




More information about the mesa-commit mailing list