With mesa 7.0.3-rc2 (debian build), attempting to compile a GLSL shader
containing the following preprocessor directive fails:
  #extension GL_ARB_texture_rectangle : require

With:
  Error: GL_ARB_texture_rectangle: required extension is not supported.

I note that the spec says this is implicitly defined for all
shaders:
  see 'Additions to version 1.10.59 of the OpenGL Shading Language...
  in http://opengl.org/registry/specs/ARB/texture_rectangle.txt

However, This seems to be contrary to question 18 of the same document:
  Yes, a shader can still include all variations of #extension
  GL_ARB_texture_rectangle in its source code. This includes #extension
  GL_ARB_texture_rectangle : disable, to disable support for it.

This doesn't feel like a correct fix, since it always enables the extension
and there seems to be no way to check ctx->Extensions.NV_texture_rectangle
from within the preprocessor. (Ignoring the fact that there is no checking
later on in the shader if it were disabled.)
---
 src/mesa/shader/slang/slang_preprocess.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mesa/shader/slang/slang_preprocess.c 
b/src/mesa/shader/slang/slang_preprocess.c
index 72281ed..51afdb9 100644
--- a/src/mesa/shader/slang/slang_preprocess.c
+++ b/src/mesa/shader/slang/slang_preprocess.c
@@ -483,6 +483,7 @@ pp_cond_stack_reevaluate (pp_cond_stack *self)
 typedef struct
 {
    GLboolean MESA_shader_debug;        /* GL_MESA_shader_debug enable */
+   GLboolean GL_ARB_texture_rectangle; /* GL_ARB_texture_rectangle enable */
 } pp_ext;
 
 /*
@@ -498,6 +499,7 @@ static GLvoid
 pp_ext_init (pp_ext *self)
 {
    pp_ext_disable_all (self);
+   self->GL_ARB_texture_rectangle = GL_TRUE;
    /* Other initialization code goes here. */
 }
 
@@ -506,6 +508,8 @@ pp_ext_set (pp_ext *self, const char *name, GLboolean 
enable)
 {
    if (_mesa_strcmp (name, "MESA_shader_debug") == 0)
       self->MESA_shader_debug = enable;
+   else if (_mesa_strcmp (name, "GL_ARB_texture_rectangle") == 0)
+      self->GL_ARB_texture_rectangle = enable;
    /* Next extension name tests go here. */
    else
       return GL_FALSE;
-- 
1.5.4.3



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to