summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2006-08-01 20:07:31 +0000
committerMichal Krol <[email protected]>2006-08-01 20:07:31 +0000
commit365582dd6f632aafbc1c817aa57926d679bb2efc (patch)
tree75f3184e471793c06cd16ef1bdd3e10629f2a28a /src/mesa
parentcc738e004f083566f3e1723f72623ef9875f72ec (diff)
Clean-up FEATURE_ARB_shader_objects #ifdefs. Bug 7492.
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/context.c6
-rw-r--r--src/mesa/main/getstring.c5
-rw-r--r--src/mesa/main/texstate.c10
-rw-r--r--src/mesa/shader/shaderobjects.c4
-rw-r--r--src/mesa/shader/shaderobjects.h18
-rwxr-xr-xsrc/mesa/shader/shaderobjects_3dlabs.c112
-rwxr-xr-xsrc/mesa/shader/shaderobjects_3dlabs.h7
-rw-r--r--src/mesa/swrast/s_arbshader.c5
-rw-r--r--src/mesa/swrast/s_arbshader.h4
-rw-r--r--src/mesa/swrast/s_span.c10
-rw-r--r--src/mesa/tnl/t_pipeline.h2
-rw-r--r--src/mesa/tnl/t_vb_arbshader.c4
12 files changed, 180 insertions, 7 deletions
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index b30d5523623..afe6048c802 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -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);
diff --git a/src/mesa/main/getstring.c b/src/mesa/main/getstring.c
index a741f8310be..fba8e1634f4 100644
--- a/src/mesa/main/getstring.c
+++ b/src/mesa/main/getstring.c
@@ -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;
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index ea3873c3804..0687e5760c9 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -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 {
diff --git a/src/mesa/shader/shaderobjects.c b/src/mesa/shader/shaderobjects.c
index 3d315464530..f26ff12adf1 100644
--- a/src/mesa/shader/shaderobjects.c
+++ b/src/mesa/shader/shaderobjects.c
@@ -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)
{
diff --git a/src/mesa/shader/shaderobjects.h b/src/mesa/shader/shaderobjects.h
index 818049d17b2..cc670216292 100644
--- a/src/mesa/shader/shaderobjects.h
+++ b/src/mesa/shader/shaderobjects.h
@@ -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 */
diff --git a/src/mesa/shader/shaderobjects_3dlabs.c b/src/mesa/shader/shaderobjects_3dlabs.c
index deeb40332a0..0def13d3b81 100755
--- a/src/mesa/shader/shaderobjects_3dlabs.c
+++ b/src/mesa/shader/shaderobjects_3dlabs.c
@@ -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)
{
diff --git a/src/mesa/shader/shaderobjects_3dlabs.h b/src/mesa/shader/shaderobjects_3dlabs.h
index 8bf273ae9d7..2092dd923e6 100755
--- a/src/mesa/shader/shaderobjects_3dlabs.h
+++ b/src/mesa/shader/shaderobjects_3dlabs.h
@@ -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);
diff --git a/src/mesa/swrast/s_arbshader.c b/src/mesa/swrast/s_arbshader.c
index a2dc1353f04..c3f85ee1574 100644
--- a/src/mesa/swrast/s_arbshader.c
+++ b/src/mesa/swrast/s_arbshader.c
@@ -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 */
+
diff --git a/src/mesa/swrast/s_arbshader.h b/src/mesa/swrast/s_arbshader.h
index 7cce6f83625..805cd4da38f 100644
--- a/src/mesa/swrast/s_arbshader.h
+++ b/src/mesa/swrast/s_arbshader.h
@@ -28,7 +28,11 @@
#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
diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c
index ff3ed420c4b..d1431054162 100644
--- a/src/mesa/swrast/s_span.c
+++ b/src/mesa/swrast/s_span.c
@@ -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 );
diff --git a/src/mesa/tnl/t_pipeline.h b/src/mesa/tnl/t_pipeline.h
index e5622c9d566..b987ba4116f 100644
--- a/src/mesa/tnl/t_pipeline.h
+++ b/src/mesa/tnl/t_pipeline.h
@@ -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:
diff --git a/src/mesa/tnl/t_vb_arbshader.c b/src/mesa/tnl/t_vb_arbshader.c
index 174d7985432..13aa3ea9105 100644
--- a/src/mesa/tnl/t_vb_arbshader.c
+++ b/src/mesa/tnl/t_vb_arbshader.c
@@ -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 */
+