Clean-up FEATURE_ARB_shader_objects #ifdefs. Bug 7492.
authorMichal Krol <mjkrol@gmail.org>
Tue, 1 Aug 2006 20:07:31 +0000 (20:07 +0000)
committerMichal Krol <mjkrol@gmail.org>
Tue, 1 Aug 2006 20:07:31 +0000 (20:07 +0000)
12 files changed:
src/mesa/main/context.c
src/mesa/main/getstring.c
src/mesa/main/texstate.c
src/mesa/shader/shaderobjects.c
src/mesa/shader/shaderobjects.h
src/mesa/shader/shaderobjects_3dlabs.c
src/mesa/shader/shaderobjects_3dlabs.h
src/mesa/swrast/s_arbshader.c
src/mesa/swrast/s_arbshader.h
src/mesa/swrast/s_span.c
src/mesa/tnl/t_pipeline.h
src/mesa/tnl/t_vb_arbshader.c

index b30d55236234408c4f2ba00c1118ee55c65e9251..afe6048c802945f0aa467423db67d1a1866666b5 100644 (file)
@@ -704,7 +704,9 @@ alloc_shared_state( GLcontext *ctx )
 
    ss->ArrayObjects = _mesa_NewHashTable();
 
+#if FEATURE_ARB_shader_objects
    ss->GL2Objects = _mesa_NewHashTable ();
+#endif
 
    ss->Default1D = (*ctx->Driver.NewTextureObject)(ctx, 0, GL_TEXTURE_1D);
    if (!ss->Default1D)
@@ -775,8 +777,10 @@ alloc_shared_state( GLcontext *ctx )
    if (ss->ArrayObjects)
       _mesa_DeleteHashTable (ss->ArrayObjects);
 
+#if FEATURE_ARB_shader_objects
    if (ss->GL2Objects)
       _mesa_DeleteHashTable (ss->GL2Objects);
+#endif
 
 #if FEATURE_EXT_framebuffer_object
    if (ss->FrameBuffers)
@@ -929,7 +933,9 @@ free_shared_state( GLcontext *ctx, struct gl_shared_state *ss )
    _mesa_HashDeleteAll(ss->ArrayObjects, delete_arrayobj_cb, ctx);
    _mesa_DeleteHashTable(ss->ArrayObjects);
 
+#if FEATURE_ARB_shader_objects
    _mesa_DeleteHashTable(ss->GL2Objects);
+#endif
 
 #if FEATURE_EXT_framebuffer_object
    _mesa_DeleteHashTable(ss->FrameBuffers);
index a741f8310be2a924192518205b4bddcf5af4fab7..fba8e1634f466e1817b863bad0049451b1b6b610 100644 (file)
@@ -55,7 +55,10 @@ _mesa_GetString( GLenum name )
    static const char *version_1_4 = "1.4 Mesa " MESA_VERSION_STRING;
    static const char *version_1_5 = "1.5 Mesa " MESA_VERSION_STRING;
    static const char *version_2_0 = "1.5 Mesa " MESA_VERSION_STRING;/*XXX FIX*/
+
+#if FEATURE_ARB_shading_language_100
    static const char *sl_version_110 = "1.10 Mesa " MESA_VERSION_STRING;
+#endif
 
    ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, NULL);
 
@@ -144,7 +147,9 @@ _mesa_GetString( GLenum name )
          }
          /* FALL-THROUGH */
 #endif
+#if FEATURE_ARB_shading_language_100
       error:
+#endif
       default:
          _mesa_error( ctx, GL_INVALID_ENUM, "glGetString" );
          return (const GLubyte *) 0;
index ea3873c3804ed94a40afb3c2b169c1535e951ca0..0687e5760c9b96303f22cf726c6da41880e95a7b 100644 (file)
@@ -2894,8 +2894,11 @@ static void
 update_texture_state( GLcontext *ctx )
 {
    GLuint unit;
+
+#if FEATURE_ARB_fragment_shader
    struct gl2_program_intf **prog = ctx->ShaderObjects.CurrentProgram;
    GLbitfield progteximageusage[MAX_TEXTURE_IMAGE_UNITS];
+#endif
 
    ctx->NewState |= _NEW_TEXTURE; /* TODO: only set this if there are 
                                   * actual changes. 
@@ -2906,6 +2909,7 @@ update_texture_state( GLcontext *ctx )
    ctx->Texture._TexMatEnabled = 0;
    ctx->Texture._TexGenEnabled = 0;
 
+#if FEATURE_ARB_fragment_shader
    /*
     * Grab texture image usage state from shader program. It must be
     * grabbed every time uniform sampler changes, so maybe there is a
@@ -2914,6 +2918,7 @@ update_texture_state( GLcontext *ctx )
    if (ctx->ShaderObjects._FragmentShaderPresent) {
       (**prog).GetTextureImageUsage (prog, progteximageusage);
    }
+#endif /* FEATURE_ARB_fragment_shader */
 
    /*
     * Update texture unit state.
@@ -2927,10 +2932,13 @@ update_texture_state( GLcontext *ctx )
       texUnit->_GenFlags = 0;
 
       /* Get the bitmask of texture enables */
+#if FEATURE_ARB_fragment_shader
       if (ctx->ShaderObjects._FragmentShaderPresent) {
          enableBits = progteximageusage[unit];
       }
-      else if (ctx->FragmentProgram._Enabled) {
+      else
+#endif
+      if (ctx->FragmentProgram._Enabled) {
          enableBits = ctx->FragmentProgram.Current->TexturesUsed[unit];
       }
       else {
index 3d315464530dbd42b596f60cf26c1e598d44cfac..f26ff12adf12c7536845b8e4c09ba8fca7619eb3 100644 (file)
@@ -36,6 +36,8 @@
 #include "shaderobjects_3dlabs.h"
 
 
+#if FEATURE_ARB_shader_objects
+
 #define RELEASE_GENERIC(x)\
    (**x)._unknown.Release ((struct gl2_unknown_intf **) (x))
 
@@ -1198,6 +1200,8 @@ _mesa_GetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name)
        return loc;
 }
 
+#endif
+
 GLvoid
 _mesa_init_shaderobjects (GLcontext *ctx)
 {
index 818049d17b22e78d2c04ad934aa364ab95cc75c7..cc670216292777c658368f103c31384b14848362 100644 (file)
@@ -27,6 +27,8 @@
 
 #include "context.h"
 
+#if FEATURE_ARB_shader_objects
+
 /**
  * gl2 unique interface identifier.
  * Each gl2 interface has its own interface id used for object queries.
@@ -40,7 +42,8 @@ enum gl2_uiid
    UIID_FRAGMENT_SHADER,       /* fragment shader */
    UIID_VERTEX_SHADER,         /* vertex shader */
    UIID_PROGRAM,               /* program object */
-   UIID_3DLABS_SHHANDLE                /* encapsulates 3dlabs' ShHandle */
+   UIID_3DLABS_SHHANDLE,         /* encapsulates 3DLabs' ShHandle */
+   UIID_DEBUG                    /* debug object */
 };
 
 struct gl2_unknown_intf
@@ -127,8 +130,15 @@ struct gl2_3dlabs_shhandle_intf
    GLvoid *(* GetShHandle) (struct gl2_3dlabs_shhandle_intf **);
 };
 
+struct gl2_debug_intf
+{
+   struct gl2_generic_intf _generic;
+   GLvoid (* ClearDebugLog) (struct gl2_debug_intf **, GLenum logType, GLenum shaderType);
+   GLvoid (* GetDebugLog) (struct gl2_debug_intf **, GLenum logType, GLenum shaderType,
+                           GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
+   GLsizei (* GetDebugLogLength) (struct gl2_debug_intf **, GLenum logType, GLenum shaderType);
+};
 
-#if FEATURE_ARB_shader_objects
 
 extern void GLAPIENTRY
 _mesa_DeleteObjectARB(GLhandleARB obj);
@@ -260,9 +270,9 @@ _mesa_GetAttribLocationARB (GLhandleARB, const GLcharARB *);
 
 #endif /* FEATURE_ARB_vertex_shader */
 
+#endif /* FEATURE_ARB_shader_objects */
+
 extern void
 _mesa_init_shaderobjects (GLcontext *ctx);
 
-#endif /* FEATURE_ARB_shader_objects */
-
 #endif /* SHADEROBJECTS_H */
index deeb40332a08a61f372669444779f761e23265f6..0def13d3b81dc7fd0a4d7615b26aec4f8773bc86 100755 (executable)
@@ -44,6 +44,8 @@
 #include "slang_link.h"
 #endif
 
+#if FEATURE_ARB_shader_objects
+
 struct gl2_unknown_obj
 {
        GLuint reference_count;
@@ -1774,6 +1776,101 @@ _vertex_shader_constructor (struct gl2_vertex_shader_impl *impl)
 #endif
 }
 
+struct gl2_debug_obj
+{
+   struct gl2_generic_obj _generic;
+};
+
+struct gl2_debug_impl
+{
+   struct gl2_debug_intf *_vftbl;
+   struct gl2_debug_obj _obj;
+};
+
+static GLvoid
+_debug_destructor (struct gl2_unknown_intf **intf)
+{
+   struct gl2_debug_impl *impl = (struct gl2_debug_impl *) (intf);
+
+   (void) (impl);
+   /* TODO */
+
+   _generic_destructor (intf);
+}
+
+static struct gl2_unknown_intf **
+_debug_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)
+{
+   if (uiid == UIID_DEBUG) {
+      (**intf).AddRef (intf);
+      return intf;
+   }
+   return _generic_QueryInterface (intf, uiid);
+}
+
+static GLenum
+_debug_GetType (struct gl2_generic_intf **intf)
+{
+   return /*GL_DEBUG_OBJECT_MESA*/0;
+}
+
+static GLvoid
+_debug_ClearDebugLog (struct gl2_debug_intf **intf, GLenum logType, GLenum shaderType)
+{
+   struct gl2_debug_impl *impl = (struct gl2_debug_impl *) (intf);
+
+   (void) (impl);
+   /* TODO */
+}
+
+static GLvoid
+_debug_GetDebugLog (struct gl2_debug_intf **intf, GLenum logType, GLenum shaderType,
+                    GLsizei maxLength, GLsizei *length, GLcharARB *infoLog)
+{
+   struct gl2_debug_impl *impl = (struct gl2_debug_impl *) (intf);
+
+   (void) (impl);
+   /* TODO */
+}
+
+static GLsizei
+_debug_GetDebugLogLength (struct gl2_debug_intf **intf, GLenum logType, GLenum shaderType)
+{
+   struct gl2_debug_impl *impl = (struct gl2_debug_impl *) (intf);
+
+   (void) (impl);
+   /* TODO */
+
+   return 0;
+}
+
+static struct gl2_debug_intf _debug_vftbl = {
+   {
+      {
+         _unknown_AddRef,
+         _unknown_Release,
+         _debug_QueryInterface
+      },
+      _generic_Delete,
+      _debug_GetType,
+      _generic_GetName,
+      _generic_GetDeleteStatus,
+      _generic_GetInfoLog,
+      _generic_GetInfoLogLength
+   },
+   _debug_ClearDebugLog,
+   _debug_GetDebugLog,
+   _debug_GetDebugLogLength
+};
+
+static GLvoid
+_debug_constructor (struct gl2_debug_impl *impl)
+{
+   _generic_constructor ((struct gl2_generic_impl *) (impl));
+   impl->_vftbl = &_debug_vftbl;
+   impl->_obj._generic._unknown._destructor = _debug_destructor;
+}
+
 GLhandleARB
 _mesa_3dlabs_create_shader_object (GLenum shaderType)
 {
@@ -1823,6 +1920,19 @@ _mesa_3dlabs_create_program_object (void)
        return 0;
 }
 
+GLhandleARB
+_mesa_3dlabs_create_debug_object (GLvoid)
+{
+   struct gl2_debug_impl *obj;
+
+   obj = (struct gl2_debug_impl *) (_mesa_malloc (sizeof (struct gl2_debug_impl)));
+   if (obj != NULL) {
+      _debug_constructor (obj);
+      return obj->_obj._generic.name;
+   }
+   return 0;
+}
+
 #include "slang_assemble.h"
 #include "slang_execute.h"
 
@@ -1859,6 +1969,8 @@ GLvoid _slang_exec_vertex_shader (struct gl2_program_intf **pro)
        exec_shader (pro, SLANG_SHADER_VERTEX);
 }
 
+#endif
+
 void
 _mesa_init_shaderobjects_3dlabs (GLcontext *ctx)
 {
index 8bf273ae9d75dfb9b1b8749d573c2ef97de4d081..2092dd923e654f4769f6fdcb247d24358eb8fa55 100755 (executable)
@@ -25,6 +25,8 @@
 #ifndef SHADEROBJECTS_3DLABS_H
 #define SHADEROBJECTS_3DLABS_H
 
+#if FEATURE_ARB_shader_objects
+
 extern int _slang_fetch_discard (struct gl2_program_intf **pro, GLboolean *val);
 
 extern GLvoid _slang_exec_fragment_shader (struct gl2_program_intf **pro);
@@ -37,6 +39,11 @@ _mesa_3dlabs_create_shader_object (GLenum);
 extern GLhandleARB
 _mesa_3dlabs_create_program_object (GLvoid);
 
+extern GLhandleARB
+_mesa_3dlabs_create_debug_object (GLvoid);
+
+#endif /* FEATURE_ARB_shader_objects */
+
 extern void
 _mesa_init_shaderobjects_3dlabs (GLcontext *ctx);
 
index a2dc1353f044fe9c7e0e68ac55a3d3f96d4db93c..c3f85ee15747c8799b11515a76b05628bdea2178 100644 (file)
@@ -35,6 +35,8 @@
 #include "slang_utility.h"
 #include "slang_link.h"
 
+#if FEATURE_ARB_fragment_shader
+
 void
 _swrast_exec_arbshader(GLcontext *ctx, struct sw_span *span)
 {
@@ -113,3 +115,6 @@ _swrast_exec_arbshader(GLcontext *ctx, struct sw_span *span)
       }
    }
 }
+
+#endif /* FEATURE_ARB_fragment_shader */
+
index 7cce6f83625508903edfe13ab3ef4862a76f8e2f..805cd4da38f089281fd0bd68a27ac612c2a503ff 100644 (file)
 
 #include "s_context.h"
 
+#if FEATURE_ARB_fragment_shader
+
 extern void _swrast_exec_arbshader (GLcontext *ctx, struct sw_span *span);
 
+#endif /* FEATURE_ARB_fragment_shader */
+
 #endif
 
index ff3ed420c4b1c18687cf8a6e95daafb065140a2b..d14310541627082e0e20c78b69b12e07e0fad221 100644 (file)
@@ -1197,12 +1197,15 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span)
          interpolate_fog(ctx, span);
 
       /* Compute fragment colors with fragment program or texture lookups */
+#if FEATURE_ARB_fragment_shader
       if (ctx->ShaderObjects._FragmentShaderPresent) {
          if (span->interpMask & SPAN_Z)
             _swrast_span_interpolate_z (ctx, span);
          _swrast_exec_arbshader (ctx, span);
       }
-      else if (ctx->FragmentProgram._Active) {
+      else
+#endif
+      if (ctx->FragmentProgram._Active) {
          /* frag prog may need Z values */
          if (span->interpMask & SPAN_Z)
             _swrast_span_interpolate_z(ctx, span);
@@ -1281,12 +1284,15 @@ _swrast_write_rgba_span( GLcontext *ctx, struct sw_span *span)
       if (span->interpMask & SPAN_FOG)
          interpolate_fog(ctx, span);
 
+#if FEATURE_ARB_fragment_shader
       if (ctx->ShaderObjects._FragmentShaderPresent) {
          if (span->interpMask & SPAN_Z)
             _swrast_span_interpolate_z (ctx, span);
          _swrast_exec_arbshader (ctx, span);
       }
-      else if (ctx->FragmentProgram._Active)
+      else
+#endif
+      if (ctx->FragmentProgram._Active)
          _swrast_exec_fragment_program( ctx, span );
       else if (ctx->ATIFragmentShader._Enabled)
          _swrast_exec_fragment_shader( ctx, span );
index e5622c9d5664fb1c420c5671357c77489683044f..b987ba4116f90a8aafb0bf31fab3a0dcd1e3b574 100644 (file)
@@ -54,7 +54,9 @@ extern const struct tnl_pipeline_stage _tnl_texture_transform_stage;
 extern const struct tnl_pipeline_stage _tnl_point_attenuation_stage;
 extern const struct tnl_pipeline_stage _tnl_arb_vertex_program_stage;
 extern const struct tnl_pipeline_stage _tnl_vertex_program_stage;
+#if FEATURE_ARB_vertex_shader
 extern const struct tnl_pipeline_stage _tnl_arb_vertex_shader_stage;
+#endif
 extern const struct tnl_pipeline_stage _tnl_render_stage;
 
 /* Shorthand to plug in the default pipeline:
index 174d7985432fcf1892f3eb90253483cf651b53dc..13aa3ea91050e4b1973beec8857f974aea9b6ca8 100644 (file)
@@ -34,6 +34,8 @@
 #include "slang_utility.h"
 #include "slang_link.h"
 
+#if FEATURE_ARB_vertex_shader
+
 typedef struct
 {
        GLvector4f outputs[VERT_RESULT_MAX];
@@ -295,3 +297,5 @@ const struct tnl_pipeline_stage _tnl_arb_vertex_shader_stage = {
        run_arb_vertex_shader
 };
 
+#endif /* FEATURE_ARB_vertex_shader */
+