Mesa (master): main: Allow ctx == NULL in _mesa_validate_shader_target().
Paul Berry
stereotype441 at kemper.freedesktop.org
Wed Jan 22 04:58:56 UTC 2014
Module: Mesa
Branch: master
Commit: 020919b2ae76192f0f35c0901be0e1069a87b7f2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=020919b2ae76192f0f35c0901be0e1069a87b7f2
Author: Paul Berry <stereotype441 at gmail.com>
Date: Thu Jan 9 15:30:10 2014 -0800
main: Allow ctx == NULL in _mesa_validate_shader_target().
This will allow this function to be used in circumstances where there
is no context available, such as when building built-in GLSL
functions.
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>
Reviewed-by: Brian Paul <brianp at vmware.com>
---
src/mesa/main/shaderapi.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 716e659..2ab0a0c 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -174,13 +174,20 @@ _mesa_copy_string(GLchar *dst, GLsizei maxLength,
bool
_mesa_validate_shader_target(const struct gl_context *ctx, GLenum type)
{
+ /* Note: when building built-in GLSL functions, this function may be
+ * invoked with ctx == NULL. In that case, we can only validate that it's
+ * a shader target we recognize, not that it's supported in the current
+ * context. But that's fine--we don't need any further validation than
+ * that when building built-in GLSL functions.
+ */
+
switch (type) {
case GL_FRAGMENT_SHADER:
- return ctx->Extensions.ARB_fragment_shader;
+ return ctx == NULL || ctx->Extensions.ARB_fragment_shader;
case GL_VERTEX_SHADER:
- return ctx->Extensions.ARB_vertex_shader;
+ return ctx == NULL || ctx->Extensions.ARB_vertex_shader;
case GL_GEOMETRY_SHADER_ARB:
- return _mesa_has_geometry_shaders(ctx);
+ return ctx == NULL || _mesa_has_geometry_shaders(ctx);
default:
return false;
}
More information about the mesa-commit
mailing list