<div dir="ltr"><div><div><div>Hi Brian,<br><br></div>Thanks for review comments! We've just finished v3 of this patch. <br></div>Regarding Piglit test I'll try to implement appropriate changes. <br><br></div><div>Regards,<br></div><div>Vadym<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 7, 2018 at 5:58 PM, Brian Paul <span dir="ltr"><<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 02/07/2018 03:01 AM, Vadym Shovkoplias wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Add support for GL_NUM_SHADING_LANGUAGE_VERSIO<wbr>NS<br>
and glGetStringi for GL_SHADING_LANGUAGE_VERSION<br>
<br>
v2:<br>
- Combine similar functionality into<br>
_mesa_get_shading_language_ve<wbr>rsion() function.<br>
- Cahnge GLSL version return mechanism.<br>
</blockquote>
<br></span>
"Change"<div><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=104915" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/s<wbr>how_bug.cgi?id=104915</a><br>
Signed-off-by: Andriy Khulap <<a href="mailto:andriy.khulap@globallogic.com" target="_blank">andriy.khulap@globallogic.com</a><wbr>><br>
Signed-off-by: Vadym Shovkoplias <<a href="mailto:vadim.shovkoplias@gmail.com" target="_blank">vadim.shovkoplias@gmail.com</a>><br>
---<br>
src/mapi/glapi/gen/GL4x.xml | 1 +<br>
src/mesa/main/get.c | 4 +++<br>
src/mesa/main/get_hash_params.<wbr>py | 3 ++<br>
src/mesa/main/getstring.c | 74 ++++++++++++++++++++++++++++++<wbr>++++++++++<br>
src/mesa/main/version.h | 5 +++<br>
5 files changed, 87 insertions(+)<br>
<br>
diff --git a/src/mapi/glapi/gen/GL4x.xml b/src/mapi/glapi/gen/GL4x.xml<br>
index cd2e3b831e..2116286b35 100644<br>
--- a/src/mapi/glapi/gen/GL4x.xml<br>
+++ b/src/mapi/glapi/gen/GL4x.xml<br>
@@ -42,6 +42,7 @@<br>
<category name="4.3"><br>
<enum name="SHADER_STORAGE_BARRIER_B<wbr>IT" value="0x2000" /><br>
+ <enum name="NUM_SHADING_LANGUAGE_VER<wbr>SIONS" value="0x82E9" /><br>
<enum name="MAX_COMBINED_SHADER_OUTP<wbr>UT_RESOURCES" value="0x8F39" /><br>
<enum name="SHADER_STORAGE_BUFFER" value="0x90D2"/><br>
<enum name="SHADER_STORAGE_BUFFER_BI<wbr>NDING" value="0x90D3"/><br>
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c<br>
index 516e8d174c..9a677a18d9 100644<br>
--- a/src/mesa/main/get.c<br>
+++ b/src/mesa/main/get.c<br>
@@ -1084,6 +1084,10 @@ find_custom_value(struct gl_context *ctx, const struct value_desc *d, union valu<br>
v->value_int = 0;<br>
}<br>
break;<br>
+ /* GL 4.3 */<br>
+ case GL_NUM_SHADING_LANGUAGE_VERSIO<wbr>NS:<br>
+ v->value_int = _mesa_get_shading_language_ver<wbr>sion(ctx, -1, NULL);<br>
+ break;<br>
/* GL_ARB_draw_indirect */<br>
case GL_DRAW_INDIRECT_BUFFER_BINDIN<wbr>G:<br>
v->value_int = ctx->DrawIndirectBuffer->Name;<br>
diff --git a/src/mesa/main/get_hash_param<wbr>s.py b/src/mesa/main/get_hash_param<wbr>s.py<br>
index df082af207..be716f6f6e 100644<br>
--- a/src/mesa/main/get_hash_param<wbr>s.py<br>
+++ b/src/mesa/main/get_hash_param<wbr>s.py<br>
@@ -543,6 +543,9 @@ descriptor=[<br>
# GL_ARB_texture_cube_map_array<br>
[ "TEXTURE_BINDING_CUBE_MAP_ARRA<wbr>Y_ARB", "LOC_CUSTOM, TYPE_INT, TEXTURE_CUBE_ARRAY_INDEX, extra_ARB_texture_cube_map_arr<wbr>ay_OES_texture_cube_map_array" ],<br>
+<br>
+ # GL_NUM_SHADING_LANGUAGE_VERSIO<wbr>NS<br>
+ [ "NUM_SHADING_LANGUAGE_VERSIONS<wbr>", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],<br>
]},<br>
# Enums in OpenGL Core profile and ES 3.0<br>
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c<br>
index 931f6a476c..1b4ec1193a 100644<br>
--- a/src/mesa/main/getstring.c<br>
+++ b/src/mesa/main/getstring.c<br>
</blockquote>
<br></div></div>
I think this new function should go into version.c (you already have the prototype in version.h).<span class=""><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
@@ -32,6 +32,7 @@<br>
#include "extensions.h"<br>
#include "mtypes.h"<br>
#include "macros.h"<br>
+#include "version.h"<br>
/**<br>
* Return the string for a glGetString(GL_SHADING_LANGUAG<wbr>E_VERSION) query.<br>
@@ -99,6 +100,68 @@ shading_language_version(struc<wbr>t gl_context *ctx)<br>
}<br>
+/**<br>
+ * Get the i-th GLSL version string. If index=0, return the most recent<br>
+ * supported version.<br>
+ * \param ctx context to query<br>
+ * \param index which version string to return, or -1 if none<br>
+ * \param versionOut returns the vesrion string, NULL if index=-1<br>
</blockquote>
<br></span>
"version" And it doesn't look like we really return versionOut=NULL if index=-1. I think you can just drop that part of the comment.<div><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ * \return total number of shading language versions.<br>
+ */<br>
+int<br>
+_mesa_get_shading_language_ve<wbr>rsion(const struct gl_context *ctx,<br>
+ int index,<br>
+ char **versionOut)<br>
+{<br>
+ int n = 0;<br>
+<br>
+#define GLSL_VERSION(S) \<br>
+ if (n++ == index) \<br>
+ *versionOut = S<br>
+<br>
+ /* GLSL core */<br>
+ if (ctx->Const.GLSLVersion >= 460)<br>
+ GLSL_VERSION("460");<br>
+ if (ctx->Const.GLSLVersion >= 450)<br>
+ GLSL_VERSION("450");<br>
+ if (ctx->Const.GLSLVersion >= 440)<br>
+ GLSL_VERSION("440");<br>
+ if (ctx->Const.GLSLVersion >= 430)<br>
+ GLSL_VERSION("430");<br>
+ if (ctx->Const.GLSLVersion >= 420)<br>
+ GLSL_VERSION("420");<br>
+ if (ctx->Const.GLSLVersion >= 410)<br>
+ GLSL_VERSION("410");<br>
+ if (ctx->Const.GLSLVersion >= 400)<br>
+ GLSL_VERSION("400");<br>
+ if (ctx->Const.GLSLVersion >= 330)<br>
+ GLSL_VERSION("330");<br>
+ if (ctx->Const.GLSLVersion >= 150)<br>
+ GLSL_VERSION("150");<br>
+ if (ctx->Const.GLSLVersion >= 140)<br>
+ GLSL_VERSION("140");<br>
+ if (ctx->Const.GLSLVersion >= 130)<br>
+ GLSL_VERSION("130");<br>
+ if (ctx->Const.GLSLVersion >= 120)<br>
+ GLSL_VERSION("120");<br>
+ /* GLSL es */<br>
+ if ((ctx->API == API_OPENGLES2 && ctx->Version >= 32) ||<br>
+ ctx->Extensions.ARB_ES3_2_comp<wbr>atibility)<br>
+ GLSL_VERSION("320 es");<br>
+ if (_mesa_is_gles31(ctx) || ctx->Extensions.ARB_ES3_1_comp<wbr>atibility)<br>
+ GLSL_VERSION("310 es");<br>
+ if (_mesa_is_gles3(ctx) || ctx->Extensions.ARB_ES3_compat<wbr>ibility)<br>
+ GLSL_VERSION("300 es");<br>
+ if (ctx->API == API_OPENGLES2 || ctx->Extensions.ARB_ES2_compat<wbr>ibility)<br>
+ GLSL_VERSION("100");<br>
+<br>
+ /* XXX the spec also says to return the empty string for GLSL 1.10 */<br>
</blockquote>
<br></div></div>
I meant that you should implement this case too. So:<br>
<br>
if (ctx->Const.GLSLVersion >= 110) {<br>
/* the GL spec says to return the empty string for GLSL 1.10 */<br>
GLSL_VERSION("");<span class=""><br>
}<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+#undef GLSL_VERSION<br>
+<br>
+ return n;<br>
+}<br>
+<br>
+<br>
/**<br>
* Query string-valued state. The return value should _not_ be freed by<br>
* the caller.<br>
@@ -186,6 +249,17 @@ _mesa_GetStringi(GLenum name, GLuint index)<br>
return (const GLubyte *) 0;<br>
}<br>
return _mesa_get_enabled_extension(ct<wbr>x, index);<br>
+ case GL_SHADING_LANGUAGE_VERSION:<br>
+ {<br>
+ char *version;<br>
+ int num = _mesa_get_shading_language_ver<wbr>sion(ctx, index, &version);<br>
+ if (index >= num) {<br>
+ _mesa_error(ctx, GL_INVALID_VALUE,<br>
+ "glGetStringi(GL_SHADING_LANG<wbr>UAGE_VERSION, index=%d", index);<br>
</blockquote>
<br></span>
Missing the closing parenthesis in the string.<span class=""><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ return (const GLubyte *) 0;<br>
+ }<br>
+ return (const GLubyte *) version;<br>
+ }<br>
default:<br>
_mesa_error(ctx, GL_INVALID_ENUM, "glGetStringi");<br>
return (const GLubyte *) 0;<br>
diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h<br>
index 4cb5e5f0fa..adfec6f828 100644<br>
--- a/src/mesa/main/version.h<br>
+++ b/src/mesa/main/version.h<br>
@@ -53,4 +53,9 @@ _mesa_get_driver_uuid(struct gl_context *ctx, GLint *uuid);<br>
extern void<br>
_mesa_get_device_uuid(struct gl_context *ctx, GLint *uuid);<br>
+extern int<br>
+_mesa_get_shading_language_ve<wbr>rsion(const struct gl_context *ctx,<br>
+ int index,<br>
+ char **versionOut);<br>
+<br>
#endif /* VERSION_H */<br>
<br>
</blockquote>
<br></span>
Looks good otherwise. Thanks for working on this.<br>
<br>
Are you going to write/modify a Piglit test to exercise these queries?<span class="HOEnZb"><font color="#888888"><br>
<br>
-Brian</font></span><div class="HOEnZb"><div class="h5"><br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><font size="-1"><br><span style="vertical-align:baseline;font-variant:normal;font-style:normal;font-size:12px;background-color:transparent;text-decoration:none;font-family:Arial;font-weight:bold">Vadym Shovkoplias | Software engineer</span><br><span style="vertical-align:baseline;font-variant:normal;font-style:normal;font-size:12px;background-color:transparent;text-decoration:none;font-family:Arial;font-weight:normal">GlobalLogic</span><br><span style="vertical-align:baseline;font-variant:normal;font-style:normal;font-size:12px;background-color:transparent;text-decoration:none;font-family:Arial;font-weight:normal">P +x.xxx.xxx.xxxx M +3.8050.931.7304 S vadym.shovkoplias</span><br><a href="http://www.globallogic.com/" target="_blank"><span style="font-size:12px;font-family:Arial;color:#1155cc;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline">www.globallogic.com</span></a><span style="vertical-align:baseline;font-variant:normal;font-style:normal;font-size:12px;background-color:transparent;text-decoration:none;font-family:Arial;font-weight:normal"></span><br><a href="http://www.globallogic.com/" target="_blank"><span style="font-size:12px;font-family:Arial;color:#1155cc;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline"></span></a><br><a href="http://www.globallogic.com/email_disclaimer.txt" target="_blank"><span style="font-size:11px;font-family:Arial;color:#1155cc;background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline">http://www.globallogic.com/email_disclaimer.txt</span></a><span style="vertical-align:baseline;font-variant:normal;font-style:normal;font-size:11px;background-color:transparent;text-decoration:none;font-family:Arial;font-weight:normal"></span></font></div></div></div>
</div></div>