Mesa (master): tgsi_from_mesa: add pipe_shader_type_from_mesa

Nicolai Hähnle nh at kemper.freedesktop.org
Wed Jul 5 10:32:00 UTC 2017


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

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Wed May 17 18:09:03 2017 +0200

tgsi_from_mesa: add pipe_shader_type_from_mesa

So... the pipe_ prefix doesn't really fit into a TGSI header; on the
other hand, the return type has the pipe_ prefix.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/auxiliary/tgsi/tgsi_from_mesa.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h b/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h
index 4c708f4e59..d0f211e31e 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h
+++ b/src/gallium/auxiliary/tgsi/tgsi_from_mesa.h
@@ -26,6 +26,8 @@
 
 #include <stdbool.h>
 
+#include "pipe/p_compiler.h"
+#include "pipe/p_defines.h"
 #include "pipe/p_shader_tokens.h"
 
 #include "compiler/shader_enums.h"
@@ -40,4 +42,25 @@ unsigned
 tgsi_get_generic_gl_varying_index(gl_varying_slot attr,
                                   bool needs_texcoord_semantic);
 
+static inline enum pipe_shader_type
+pipe_shader_type_from_mesa(gl_shader_stage stage)
+{
+   switch (stage) {
+   case MESA_SHADER_VERTEX:
+      return PIPE_SHADER_VERTEX;
+   case MESA_SHADER_TESS_CTRL:
+      return PIPE_SHADER_TESS_CTRL;
+   case MESA_SHADER_TESS_EVAL:
+      return PIPE_SHADER_TESS_EVAL;
+   case MESA_SHADER_GEOMETRY:
+      return PIPE_SHADER_GEOMETRY;
+   case MESA_SHADER_FRAGMENT:
+      return PIPE_SHADER_FRAGMENT;
+   case MESA_SHADER_COMPUTE:
+      return PIPE_SHADER_COMPUTE;
+   default:
+      unreachable("bad shader stage");
+   }
+}
+
 #endif /* TGSI_FROM_MESA_H */




More information about the mesa-commit mailing list