[Mesa-dev] [PATCH v2 11/11] gallium/compute: Drop TGSI dependency.

Francisco Jerez currojerez at riseup.net
Fri Apr 20 09:04:51 PDT 2012


Add a shader cap for specifying the preferred shader representation.
Right now the only supported value is TGSI, other enum values will be
added as they are needed.

This is mainly to accommodate AMD's LLVM compiler back-end by letting
it bypass the TGSI representation for compute programs.  Other drivers
will keep using the common TGSI instruction set.
---
v2: Use an enumeration instead of a string, and make it a shader cap
    instead of a compute-specific cap.

 src/gallium/docs/source/screen.rst   |    2 ++
 src/gallium/include/pipe/p_defines.h |   11 ++++++++++-
 src/gallium/include/pipe/p_state.h   |    2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index 7f0f462..afaefb2 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -173,6 +173,8 @@ to be 0.
   If unsupported, only float opcodes are supported.
 * ``PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS``: THe maximum number of texture
   samplers.
+* ``PIPE_SHADER_CAP_PREFERRED_IR``: Preferred representation of the
+  program.  It should be one of the ``pipe_shader_ir`` enum values.
 
 
 .. _pipe_compute_cap:
diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h
index 9a74ea3..b6caff7 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -519,7 +519,16 @@ enum pipe_shader_cap
    PIPE_SHADER_CAP_INDIRECT_CONST_ADDR = 15,
    PIPE_SHADER_CAP_SUBROUTINES = 16, /* BGNSUB, ENDSUB, CAL, RET */
    PIPE_SHADER_CAP_INTEGERS = 17,
-   PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS = 18
+   PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS = 18,
+   PIPE_SHADER_CAP_PREFERRED_IR = 19
+};
+
+/**
+ * Shader intermediate representation.
+ */
+enum pipe_shader_ir
+{
+   PIPE_SHADER_IR_TGSI
 };
 
 /**
diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index 8b6dc7e..bffe46f 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -580,7 +580,7 @@ struct pipe_resolve_info
 
 struct pipe_compute_state
 {
-   const struct tgsi_token *tokens; /**< Compute program to be executed. */
+   const void *prog; /**< Compute program to be executed. */
    unsigned req_local_mem; /**< Required size of the LOCAL resource. */
    unsigned req_private_mem; /**< Required size of the PRIVATE resource. */
    unsigned req_input_mem; /**< Required size of the INPUT resource. */
-- 
1.7.9.2



More information about the mesa-dev mailing list