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

Author: Dave Airlie <[email protected]>
Date:   Tue Jul 26 13:39:00 2022 +1000

gallium: use gl shader types as the basis for the gallium ones

This should enable a rename transistion.

Trace needs to swap over to a non-generated version, but that should be fine.

Reviewed-by: Marek Olšák <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17747>

---

 src/compiler/shader_enums.h                       |  9 ++++++++-
 src/gallium/auxiliary/driver_trace/enums2names.py |  1 -
 src/gallium/auxiliary/driver_trace/tr_screen.h    |  6 ++++++
 src/gallium/include/pipe/p_defines.h              | 15 ++-------------
 4 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h
index 7c7c7afe037..30b8d432e08 100644
--- a/src/compiler/shader_enums.h
+++ b/src/compiler/shader_enums.h
@@ -44,16 +44,23 @@ extern "C" {
  * The GLSL linker assumes that if i<j, then the j-th shader is
  * executed later than the i-th shader.
  */
-typedef enum
+typedef enum pipe_shader_type
 {
    MESA_SHADER_NONE = -1,
    MESA_SHADER_VERTEX = 0,
+   PIPE_SHADER_VERTEX = MESA_SHADER_VERTEX,
    MESA_SHADER_TESS_CTRL = 1,
+   PIPE_SHADER_TESS_CTRL = MESA_SHADER_TESS_CTRL,
    MESA_SHADER_TESS_EVAL = 2,
+   PIPE_SHADER_TESS_EVAL = MESA_SHADER_TESS_EVAL,
    MESA_SHADER_GEOMETRY = 3,
+   PIPE_SHADER_GEOMETRY = MESA_SHADER_GEOMETRY,
    MESA_SHADER_FRAGMENT = 4,
+   PIPE_SHADER_FRAGMENT = MESA_SHADER_FRAGMENT,
    MESA_SHADER_COMPUTE = 5,
+   PIPE_SHADER_COMPUTE = MESA_SHADER_COMPUTE,
 
+   PIPE_SHADER_TYPES = (PIPE_SHADER_COMPUTE + 1),
    /* Vulkan-only stages. */
    MESA_SHADER_TASK         = 6,
    MESA_SHADER_MESH         = 7,
diff --git a/src/gallium/auxiliary/driver_trace/enums2names.py 
b/src/gallium/auxiliary/driver_trace/enums2names.py
index dd346900d92..32e00e80dfa 100755
--- a/src/gallium/auxiliary/driver_trace/enums2names.py
+++ b/src/gallium/auxiliary/driver_trace/enums2names.py
@@ -43,7 +43,6 @@ assert sys.version_info >= (3, 6)
 #
 lst_enum_include = [
     "pipe_texture_target",
-    "pipe_shader_type",
     "pipe_shader_cap",
     "pipe_shader_ir",
     "pipe_cap",
diff --git a/src/gallium/auxiliary/driver_trace/tr_screen.h 
b/src/gallium/auxiliary/driver_trace/tr_screen.h
index 2350ec95f59..76b04e9d98d 100644
--- a/src/gallium/auxiliary/driver_trace/tr_screen.h
+++ b/src/gallium/auxiliary/driver_trace/tr_screen.h
@@ -45,6 +45,12 @@ extern "C" {
  */
 #define TRACE_FLAG_USER_BUFFER  (1 << 31)
 
+static inline const char *
+tr_util_pipe_shader_type_name(gl_shader_stage stage)
+{
+   return gl_shader_stage_name(stage);
+}
+
 
 struct trace_screen
 {
diff --git a/src/gallium/include/pipe/p_defines.h 
b/src/gallium/include/pipe/p_defines.h
index eeaa8a30c5d..ff858881fbf 100644
--- a/src/gallium/include/pipe/p_defines.h
+++ b/src/gallium/include/pipe/p_defines.h
@@ -30,6 +30,8 @@
 
 #include "p_compiler.h"
 
+#include "compiler/shader_enums.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -546,19 +548,6 @@ enum pipe_resource_usage {
    PIPE_USAGE_STAGING,        /* fast CPU access */
 };
 
-/**
- * Shaders
- */
-enum pipe_shader_type {
-   PIPE_SHADER_VERTEX,
-   PIPE_SHADER_TESS_CTRL,
-   PIPE_SHADER_TESS_EVAL,
-   PIPE_SHADER_GEOMETRY,
-   PIPE_SHADER_FRAGMENT,
-   PIPE_SHADER_COMPUTE,
-   PIPE_SHADER_TYPES,
-};
-
 /**
  * Primitive types:
  */

Reply via email to