Re: [Mesa-dev] [PATCH 3/9] glsl: Create a _mesa_shader_stage_to_abbrev() function.

2015-02-19 Thread Ian Romanick
On 02/18/2015 09:00 PM, Kenneth Graunke wrote:
 This is similar to _mesa_shader_stage_to_string(), but returns VS
 instead of vertex.
 
 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---
  src/glsl/glsl_parser_extras.cpp | 17 +
  src/glsl/glsl_parser_extras.h   |  3 +++
  2 files changed, 20 insertions(+)
 
 diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
 index ccdf031..0334e4a 100644
 --- a/src/glsl/glsl_parser_extras.cpp
 +++ b/src/glsl/glsl_parser_extras.cpp
 @@ -376,6 +376,23 @@ _mesa_shader_stage_to_string(unsigned stage)
 return unknown;
  }
  
 +/**
 + * Translate a gl_shader_stage to a shader stage abbreviation (VS, GS, FS)
 + * for debug printouts and error messages.
 + */
 +const char *
 +_mesa_shader_stage_to_abbrev(unsigned stage)
 +{
 +   switch (stage) {
 +   case MESA_SHADER_VERTEX:   return VS;
 +   case MESA_SHADER_FRAGMENT: return FS;
 +   case MESA_SHADER_GEOMETRY: return GS;

The next patch has some compute bits, should this also do compute?

 +   }
 +
 +   assert(!Should not get here.);
 +   return unknown;

  unreachable(Bad shader stage.);

 +}
 +
  /* This helper function will append the given message to the shader's
 info log and report it via GL_ARB_debug_output. Per that extension,
 'type' is one of the enum values classifying the message, and
 diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
 index 843fdae..6861fac 100644
 --- a/src/glsl/glsl_parser_extras.h
 +++ b/src/glsl/glsl_parser_extras.h
 @@ -576,6 +576,9 @@ extern C {
  extern const char *
  _mesa_shader_stage_to_string(unsigned stage);
  
 +extern const char *
 +_mesa_shader_stage_to_abbrev(unsigned stage);
 +
  extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log,
const struct gl_extensions *extensions, struct 
 gl_context *gl_ctx);
  
 

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/9] glsl: Create a _mesa_shader_stage_to_abbrev() function.

2015-02-19 Thread Ian Romanick
On 02/19/2015 11:43 AM, Ian Romanick wrote:
 On 02/18/2015 09:00 PM, Kenneth Graunke wrote:
 This is similar to _mesa_shader_stage_to_string(), but returns VS
 instead of vertex.

 Signed-off-by: Kenneth Graunke kenn...@whitecape.org
 ---
  src/glsl/glsl_parser_extras.cpp | 17 +
  src/glsl/glsl_parser_extras.h   |  3 +++
  2 files changed, 20 insertions(+)

 diff --git a/src/glsl/glsl_parser_extras.cpp 
 b/src/glsl/glsl_parser_extras.cpp
 index ccdf031..0334e4a 100644
 --- a/src/glsl/glsl_parser_extras.cpp
 +++ b/src/glsl/glsl_parser_extras.cpp
 @@ -376,6 +376,23 @@ _mesa_shader_stage_to_string(unsigned stage)
 return unknown;
  }
  
 +/**
 + * Translate a gl_shader_stage to a shader stage abbreviation (VS, GS, FS)
 + * for debug printouts and error messages.
 + */
 +const char *
 +_mesa_shader_stage_to_abbrev(unsigned stage)
 +{
 +   switch (stage) {
 +   case MESA_SHADER_VERTEX:   return VS;
 +   case MESA_SHADER_FRAGMENT: return FS;
 +   case MESA_SHADER_GEOMETRY: return GS;
 
 The next patch has some compute bits, should this also do compute?
 
 +   }
 +
 +   assert(!Should not get here.);
 +   return unknown;
 
   unreachable(Bad shader stage.);

With that fixed, this patch is

Reviewed-by: Ian Romanick ian.d.roman...@intel.com

Either way, the rest of the series is

Reviewed-by: Ian Romanick ian.d.roman...@intel.com

 +}
 +
  /* This helper function will append the given message to the shader's
 info log and report it via GL_ARB_debug_output. Per that extension,
 'type' is one of the enum values classifying the message, and
 diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
 index 843fdae..6861fac 100644
 --- a/src/glsl/glsl_parser_extras.h
 +++ b/src/glsl/glsl_parser_extras.h
 @@ -576,6 +576,9 @@ extern C {
  extern const char *
  _mesa_shader_stage_to_string(unsigned stage);
  
 +extern const char *
 +_mesa_shader_stage_to_abbrev(unsigned stage);
 +
  extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log,
const struct gl_extensions *extensions, struct 
 gl_context *gl_ctx);
  

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/9] glsl: Create a _mesa_shader_stage_to_abbrev() function.

2015-02-18 Thread Kenneth Graunke
This is similar to _mesa_shader_stage_to_string(), but returns VS
instead of vertex.

Signed-off-by: Kenneth Graunke kenn...@whitecape.org
---
 src/glsl/glsl_parser_extras.cpp | 17 +
 src/glsl/glsl_parser_extras.h   |  3 +++
 2 files changed, 20 insertions(+)

diff --git a/src/glsl/glsl_parser_extras.cpp b/src/glsl/glsl_parser_extras.cpp
index ccdf031..0334e4a 100644
--- a/src/glsl/glsl_parser_extras.cpp
+++ b/src/glsl/glsl_parser_extras.cpp
@@ -376,6 +376,23 @@ _mesa_shader_stage_to_string(unsigned stage)
return unknown;
 }
 
+/**
+ * Translate a gl_shader_stage to a shader stage abbreviation (VS, GS, FS)
+ * for debug printouts and error messages.
+ */
+const char *
+_mesa_shader_stage_to_abbrev(unsigned stage)
+{
+   switch (stage) {
+   case MESA_SHADER_VERTEX:   return VS;
+   case MESA_SHADER_FRAGMENT: return FS;
+   case MESA_SHADER_GEOMETRY: return GS;
+   }
+
+   assert(!Should not get here.);
+   return unknown;
+}
+
 /* This helper function will append the given message to the shader's
info log and report it via GL_ARB_debug_output. Per that extension,
'type' is one of the enum values classifying the message, and
diff --git a/src/glsl/glsl_parser_extras.h b/src/glsl/glsl_parser_extras.h
index 843fdae..6861fac 100644
--- a/src/glsl/glsl_parser_extras.h
+++ b/src/glsl/glsl_parser_extras.h
@@ -576,6 +576,9 @@ extern C {
 extern const char *
 _mesa_shader_stage_to_string(unsigned stage);
 
+extern const char *
+_mesa_shader_stage_to_abbrev(unsigned stage);
+
 extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log,
   const struct gl_extensions *extensions, struct 
gl_context *gl_ctx);
 
-- 
2.2.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev