summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2001-05-29 15:23:48 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2001-05-29 15:23:48 +0000
commit736fcbec4732830e7976fb5eb309b13e03be132c (patch)
tree746d1eb07d2e140c2a6d7964767403f131e86080 /src/mesa
parent5ff1c613ea25be455eda9037a4955d47669a8c79 (diff)
infrastructure for GL_ARB_multisample
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/glapi/glapi.c3
-rw-r--r--src/mesa/main/attrib.c43
-rw-r--r--src/mesa/main/buffers.c23
-rw-r--r--src/mesa/main/buffers.h5
-rw-r--r--src/mesa/main/context.c10
-rw-r--r--src/mesa/main/dlist.c30
-rw-r--r--src/mesa/main/enable.c101
-rw-r--r--src/mesa/main/extensions.c3
-rw-r--r--src/mesa/main/get.c266
-rw-r--r--src/mesa/main/mtypes.h44
-rw-r--r--src/mesa/main/state.c5
11 files changed, 508 insertions, 25 deletions
diff --git a/src/mesa/glapi/glapi.c b/src/mesa/glapi/glapi.c
index 18c9642c06..b2a10133b2 100644
--- a/src/mesa/glapi/glapi.c
+++ b/src/mesa/glapi/glapi.c
@@ -1,4 +1,4 @@
-/* $Id: glapi.c,v 1.53 2001/03/28 17:39:12 brianp Exp $ */
+/* $Id: glapi.c,v 1.54 2001/05/29 15:23:49 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -912,7 +912,6 @@ static struct name_address_offset static_functions[] = {
#else
#define NAME(X) (GLvoid *) NotImplemented
#endif
- { "glSamplePassARB", NAME(glSamplePassARB), _gloffset_SamplePassARB },
{ "glSampleCoverageARB", NAME(glSampleCoverageARB), _gloffset_SampleCoverageARB },
#undef NAME
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 772e304d09..145ff9e938 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -1,4 +1,4 @@
-/* $Id: attrib.c,v 1.50 2001/05/03 14:11:18 brianp Exp $ */
+/* $Id: attrib.c,v 1.51 2001/05/29 15:23:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -233,6 +233,11 @@ _mesa_PushAttrib(GLbitfield mask)
attr->RescaleNormals = ctx->Transform.RescaleNormals;
attr->Scissor = ctx->Scissor.Enabled;
attr->Stencil = ctx->Stencil.Enabled;
+ attr->MultisampleEnabled = ctx->Multisample.Enabled;
+ attr->SampleAlphaToCoverage = ctx->Multisample.SampleAlphaToCoverage;
+ attr->SampleAlphaToOne = ctx->Multisample.SampleAlphaToOne;
+ attr->SampleCoverage = ctx->Multisample.SampleCoverage;
+ attr->SampleCoverageInvert = ctx->Multisample.SampleCoverageInvert;
for (i=0; i<MAX_TEXTURE_UNITS; i++) {
attr->Texture[i] = ctx->Texture.Unit[i].Enabled;
attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled;
@@ -411,6 +416,17 @@ _mesa_PushAttrib(GLbitfield mask)
head = newnode;
}
+ /* GL_ARB_multisample */
+ if (mask & GL_MULTISAMPLE_BIT_ARB) {
+ struct gl_multisample_attrib *attr;
+ attr = MALLOC_STRUCT( gl_multisample_attrib );
+ MEMCPY( attr, &ctx->Multisample, sizeof(struct gl_multisample_attrib) );
+ newnode = new_attrib_node( GL_MULTISAMPLE_BIT_ARB );
+ newnode->data = attr;
+ newnode->next = head;
+ head = newnode;
+ }
+
ctx->AttribStack[ctx->AttribStackDepth] = head;
ctx->AttribStackDepth++;
}
@@ -506,6 +522,20 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable)
GL_POLYGON_STIPPLE);
TEST_AND_UPDATE(ctx->Scissor.Enabled, enable->Scissor, GL_SCISSOR_TEST);
TEST_AND_UPDATE(ctx->Stencil.Enabled, enable->Stencil, GL_STENCIL_TEST);
+ TEST_AND_UPDATE(ctx->Multisample.Enabled, enable->MultisampleEnabled,
+ GL_MULTISAMPLE_ARB);
+ TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToCoverage,
+ enable->SampleAlphaToCoverage,
+ GL_SAMPLE_ALPHA_TO_COVERAGE_ARB);
+ TEST_AND_UPDATE(ctx->Multisample.SampleAlphaToOne,
+ enable->SampleAlphaToOne,
+ GL_SAMPLE_ALPHA_TO_ONE_ARB);
+ TEST_AND_UPDATE(ctx->Multisample.SampleCoverage,
+ enable->SampleCoverage,
+ GL_SAMPLE_COVERAGE_ARB);
+ TEST_AND_UPDATE(ctx->Multisample.SampleCoverageInvert,
+ enable->SampleCoverageInvert,
+ GL_SAMPLE_COVERAGE_INVERT_ARB);
#undef TEST_AND_UPDATE
/* texture unit enables */
@@ -993,11 +1023,20 @@ _mesa_PopAttrib(void)
case GL_VIEWPORT_BIT:
{
const struct gl_viewport_attrib *vp;
- vp = (const struct gl_viewport_attrib *)attr->data;
+ vp = (const struct gl_viewport_attrib *) attr->data;
_mesa_Viewport(vp->X, vp->Y, vp->Width, vp->Height);
_mesa_DepthRange(vp->Near, vp->Far);
}
break;
+ case GL_MULTISAMPLE_BIT_ARB:
+ {
+ const struct gl_multisample_attrib *ms;
+ ms = (const struct gl_multisample_attrib *) attr->data;
+ _mesa_SampleCoverageARB(ms->SampleCoverageValue,
+ ms->SampleCoverageInvert);
+ }
+ break;
+
default:
_mesa_problem( ctx, "Bad attrib flag in PopAttrib");
break;
diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index c2737ad5f0..82afb401a8 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -1,4 +1,4 @@
-/* $Id: buffers.c,v 1.28 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: buffers.c,v 1.29 2001/05/29 15:23:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -370,3 +370,24 @@ _mesa_ResizeBuffersMESA( void )
ctx->Driver.ResizeBuffersMESA( ctx );
}
+
+
+/*
+ * XXX move somewhere else someday?
+ */
+void
+_mesa_SampleCoverageARB(GLclampf value, GLboolean invert)
+{
+ GLcontext *ctx = _mesa_get_current_context();
+
+ if (!ctx->Extensions.ARB_multisample) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "glSampleCoverageARB");
+ return;
+ }
+
+ ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx );
+ ctx->Multisample.SampleCoverageValue = CLAMP(value, 0.0, 1.0);
+ ctx->Multisample.SampleCoverageInvert = invert;
+ ctx->NewState |= _NEW_MULTISAMPLE;
+}
+
diff --git a/src/mesa/main/buffers.h b/src/mesa/main/buffers.h
index a453c3e1a2..ca0cdafd05 100644
--- a/src/mesa/main/buffers.h
+++ b/src/mesa/main/buffers.h
@@ -1,4 +1,4 @@
-/* $Id: buffers.h,v 1.3 2001/03/12 00:48:37 gareth Exp $ */
+/* $Id: buffers.h,v 1.4 2001/05/29 15:23:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -51,5 +51,8 @@ _mesa_ReadBuffer( GLenum mode );
extern void
_mesa_ResizeBuffersMESA( void );
+extern void
+_mesa_SampleCoverageARB(GLclampf value, GLboolean invert);
+
#endif
diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c
index d7cdf10b00..4ff1941f13 100644
--- a/src/mesa/main/context.c
+++ b/src/mesa/main/context.c
@@ -1,4 +1,4 @@
-/* $Id: context.c,v 1.138 2001/05/21 16:41:03 brianp Exp $ */
+/* $Id: context.c,v 1.139 2001/05/29 15:23:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -988,6 +988,14 @@ init_attrib_groups( GLcontext *ctx )
/* Display List group */
ctx->List.ListBase = 0;
+ /* Multisample */
+ ctx->Multisample.Enabled = GL_FALSE;
+ ctx->Multisample.SampleAlphaToCoverage = GL_FALSE;
+ ctx->Multisample.SampleAlphaToOne = GL_FALSE;
+ ctx->Multisample.SampleCoverage = GL_FALSE;
+ ctx->Multisample.SampleCoverageValue = 1.0;
+ ctx->Multisample.SampleCoverageInvert = GL_FALSE;
+
/* Pixel group */
ctx->Pixel.RedBias = 0.0;
ctx->Pixel.RedScale = 1.0;
diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index 3ac0667afa..c889b67f8b 100644
--- a/src/mesa/main/dlist.c
+++ b/src/mesa/main/dlist.c
@@ -1,4 +1,4 @@
-/* $Id: dlist.c,v 1.71 2001/05/14 08:57:36 keithw Exp $ */
+/* $Id: dlist.c,v 1.72 2001/05/29 15:23:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -246,6 +246,8 @@ typedef enum {
OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D,
OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D,
OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D,
+ /* GL_ARB_multisample */
+ OPCODE_SAMPLE_COVERAGE,
/* The following three are meta instructions */
OPCODE_ERROR, /* raise compiled-in error */
OPCODE_CONTINUE,
@@ -627,6 +629,8 @@ void _mesa_init_lists( void )
InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D] = 8;
InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D] = 10;
InstSize[OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D] = 12;
+ /* GL_ARB_multisample */
+ InstSize[OPCODE_SAMPLE_COVERAGE] = 3;
/* GL_ARB_multitexture */
InstSize[OPCODE_ACTIVE_TEXTURE] = 2;
InstSize[OPCODE_CLIENT_ACTIVE_TEXTURE] = 2;
@@ -3887,6 +3891,24 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
}
+/* GL_ARB_multisample */
+static void
+save_SampleCoverageARB(GLclampf value, GLboolean invert)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ Node *n;
+ ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
+ n = ALLOC_INSTRUCTION( ctx, OPCODE_SAMPLE_COVERAGE, 2 );
+ if (n) {
+ n[1].f = value;
+ n[2].b = invert;
+ }
+ if (ctx->ExecuteFlag) {
+ (*ctx->Exec->SampleCoverageARB)( value, invert );
+ }
+}
+
+
/* GL_SGIS_pixel_texture */
static void
@@ -4608,6 +4630,9 @@ execute_list( GLcontext *ctx, GLuint list )
n[4].i, n[5].i, n[6].i, n[7].i, n[8].i,
n[9].e, n[10].i, n[11].data);
break;
+ case OPCODE_SAMPLE_COVERAGE: /* GL_ARB_multisample */
+ (*ctx->Exec->SampleCoverageARB)(n[1].f, n[2].b);
+ break;
case OPCODE_CONTINUE:
n = (Node *) n[1].next;
break;
@@ -5870,6 +5895,9 @@ _mesa_init_dlist_table( struct _glapi_table *table, GLuint tableSize )
table->MultTransposeMatrixdARB = save_MultTransposeMatrixdARB;
table->MultTransposeMatrixfARB = save_MultTransposeMatrixfARB;
+ /* GL_ARB_multisample */
+ table->SampleCoverageARB = save_SampleCoverageARB;
+
/* ARB 12. GL_ARB_texture_compression */
table->CompressedTexImage3DARB = save_CompressedTexImage3DARB;
table->CompressedTexImage2DARB = save_CompressedTexImage2DARB;
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 173b4b0f22..4516f48f84 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.48 2001/03/29 21:16:25 keithw Exp $ */
+/* $Id: enable.c,v 1.49 2001/05/29 15:23:48 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -733,6 +733,63 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
break;
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ if (!ctx->Extensions.ARB_multisample) {
+ _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Multisample.Enabled == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.Enabled = state;
+ ctx->NewState |= _NEW_MULTISAMPLE;
+ break;
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ if (!ctx->Extensions.ARB_multisample) {
+ _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Multisample.SampleAlphaToCoverage == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.SampleAlphaToCoverage = state;
+ ctx->NewState |= _NEW_MULTISAMPLE;
+ break;
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ if (!ctx->Extensions.ARB_multisample) {
+ _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Multisample.SampleAlphaToOne == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.SampleAlphaToOne = state;
+ ctx->NewState |= _NEW_MULTISAMPLE;
+ break;
+ case GL_SAMPLE_COVERAGE_ARB:
+ if (!ctx->Extensions.ARB_multisample) {
+ _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Multisample.SampleCoverage == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.SampleCoverage = state;
+ ctx->NewState |= _NEW_MULTISAMPLE;
+ break;
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ if (!ctx->Extensions.ARB_multisample) {
+ _mesa_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
+ return;
+ }
+ if (ctx->Multisample.SampleCoverageInvert == state)
+ return;
+ FLUSH_VERTICES(ctx, _NEW_MULTISAMPLE);
+ ctx->Multisample.SampleCoverageInvert = state;
+ ctx->NewState |= _NEW_MULTISAMPLE;
+ break;
+
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
if (!ctx->Extensions.MESA_sprite_point) {
@@ -993,6 +1050,48 @@ _mesa_IsEnabled( GLenum cap )
return GL_FALSE;
}
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ return ctx->Multisample.Enabled;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
+ return GL_FALSE;
+ }
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ return ctx->Multisample.SampleAlphaToCoverage;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
+ return GL_FALSE;
+ }
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ return ctx->Multisample.SampleAlphaToOne;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
+ return GL_FALSE;
+ }
+ case GL_SAMPLE_COVERAGE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ return ctx->Multisample.SampleCoverage;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
+ return GL_FALSE;
+ }
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ return ctx->Multisample.SampleCoverageInvert;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
+ return GL_FALSE;
+ }
+
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
return ctx->Point.SpriteMode;
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 1d14a82288..fc26efbb62 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -1,4 +1,4 @@
-/* $Id: extensions.c,v 1.60 2001/05/24 14:47:56 brianp Exp $ */
+/* $Id: extensions.c,v 1.61 2001/05/29 15:23:49 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -57,6 +57,7 @@ static struct {
int flag_offset;
} default_extensions[] = {
{ OFF, "GL_ARB_imaging", F(ARB_imaging) },
+ { OFF, "GL_ARB_multisample", F(ARB_multisample) },
{ OFF, "GL_ARB_multitexture", F(ARB_multitexture) },
{ OFF, "GL_ARB_texture_border_clamp", F(ARB_texture_border_clamp) },
{ OFF, "GL_ARB_texture_compression", F(ARB_texture_compression) },
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index b16343831d..cdd86ebf08 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -1,4 +1,4 @@
-/* $Id: get.c,v 1.60 2001/05/21 16:41:03 brianp Exp $ */
+/* $Id: get.c,v 1.61 2001/05/29 15:23:49 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1269,6 +1269,72 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params )
}
break;
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = ctx->Multisample.Enabled;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ }
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = ctx->Multisample.SampleAlphaToCoverage;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ }
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = ctx->Multisample.SampleAlphaToOne;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = ctx->Multisample.SampleCoverage;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_VALUE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = FLOAT_TO_BOOL(ctx->Multisample.SampleCoverageValue);
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = ctx->Multisample.SampleCoverageInvert;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ }
+ case GL_SAMPLE_BUFFERS_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = 0; /* XXX fix someday */
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ }
+ case GL_SAMPLES_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = 0; /* XXX fix someday */
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetBooleanv");
+ return;
+ }
+
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
if (ctx->Extensions.MESA_sprite_point) {
@@ -2484,6 +2550,72 @@ _mesa_GetDoublev( GLenum pname, GLdouble *params )
}
break;
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLdouble) ctx->Multisample.Enabled;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev");
+ return;
+ }
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLdouble) ctx->Multisample.SampleAlphaToCoverage;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev");
+ return;
+ }
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLdouble) ctx->Multisample.SampleAlphaToOne;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLdouble) ctx->Multisample.SampleCoverage;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_VALUE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = ctx->Multisample.SampleCoverageValue;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLdouble) ctx->Multisample.SampleCoverageInvert;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev");
+ return;
+ }
+ case GL_SAMPLE_BUFFERS_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = 0.0; /* XXX fix someday */
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev");
+ return;
+ }
+ case GL_SAMPLES_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = 0.0; /* XXX fix someday */
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetDoublev");
+ return;
+ }
+
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
if (ctx->Extensions.MESA_sprite_point) {
@@ -3673,6 +3805,72 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params )
}
break;
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLfloat) ctx->Multisample.Enabled;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv");
+ return;
+ }
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLfloat) ctx->Multisample.SampleAlphaToCoverage;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv");
+ return;
+ }
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLfloat) ctx->Multisample.SampleAlphaToOne;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLfloat) ctx->Multisample.SampleCoverage;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_VALUE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = ctx->Multisample.SampleCoverageValue;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLfloat) ctx->Multisample.SampleCoverageInvert;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv");
+ return;
+ }
+ case GL_SAMPLE_BUFFERS_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = 0.0; /* XXX fix someday */
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv");
+ return;
+ }
+ case GL_SAMPLES_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = 0.0; /* XXX fix someday */
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetFloatv");
+ return;
+ }
+
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
if (ctx->Extensions.MESA_sprite_point) {
@@ -4911,6 +5109,72 @@ _mesa_GetIntegerv( GLenum pname, GLint *params )
}
break;
+ /* GL_ARB_multisample */
+ case GL_MULTISAMPLE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLint) ctx->Multisample.Enabled;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv");
+ return;
+ }
+ case GL_SAMPLE_ALPHA_TO_COVERAGE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLint) ctx->Multisample.SampleAlphaToCoverage;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv");
+ return;
+ }
+ case GL_SAMPLE_ALPHA_TO_ONE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLint) ctx->Multisample.SampleAlphaToOne;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLint) ctx->Multisample.SampleCoverage;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_VALUE_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLint) ctx->Multisample.SampleCoverageValue;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv");
+ return;
+ }
+ case GL_SAMPLE_COVERAGE_INVERT_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = (GLint) ctx->Multisample.SampleCoverageInvert;
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv");
+ return;
+ }
+ case GL_SAMPLE_BUFFERS_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = 0; /* XXX fix someday */
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv");
+ return;
+ }
+ case GL_SAMPLES_ARB:
+ if (ctx->Extensions.ARB_multisample) {
+ *params = 0; /* XXX fix someday */
+ }
+ else {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glGetIntegerv");
+ return;
+ }
+
/* GL_MESA_sprite_point */
case GL_SPRITE_POINT_MESA:
if (ctx->Extensions.MESA_sprite_point) {
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index b8c2ec7af6..d82d806cc8 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.42 2001/05/21 16:41:03 brianp Exp $ */
+/* $Id: mtypes.h,v 1.43 2001/05/29 15:23:49 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -375,6 +375,11 @@ struct gl_enable_attrib {
GLboolean RescaleNormals;
GLboolean Scissor;
GLboolean Stencil;
+ GLboolean MultisampleEnabled; /* GL_ARB_multisample */
+ GLboolean SampleAlphaToCoverage; /* GL_ARB_multisample */
+ GLboolean SampleAlphaToOne; /* GL_ARB_multisample */
+ GLboolean SampleCoverage; /* GL_ARB_multisample */
+ GLboolean SampleCoverageInvert; /* GL_ARB_multisample */
GLuint Texture[MAX_TEXTURE_UNITS];
GLuint TexGen[MAX_TEXTURE_UNITS];
};
@@ -524,6 +529,17 @@ struct gl_list_extensions {
GLuint nr_opcodes;
};
+
+struct gl_multisample_attrib {
+ GLboolean Enabled;
+ GLboolean SampleAlphaToCoverage;
+ GLboolean SampleAlphaToOne;
+ GLboolean SampleCoverage;
+ GLfloat SampleCoverageValue;
+ GLboolean SampleCoverageInvert;
+};
+
+
struct gl_pixel_attrib {
GLenum ReadBuffer; /* src buffer for glRead/CopyPixels */
GLenum DriverReadBuffer; /* Driver's current source buffer */
@@ -1175,6 +1191,7 @@ struct gl_extensions {
* Not every extension needs to have such a flag, but it's encouraged.
*/
GLboolean ARB_imaging;
+ GLboolean ARB_multisample;
GLboolean ARB_multitexture;
GLboolean ARB_texture_border_clamp;
GLboolean ARB_texture_compression;
@@ -1273,21 +1290,21 @@ struct gl_extensions {
#define _NEW_FOG 0x100 /* ctx->Fog */
#define _NEW_HINT 0x200 /* ctx->Hint */
#define _NEW_LIGHT 0x400 /* ctx->Light */
-#define _NEW_LINE 0x800 /* ctx->Line */
+#define _NEW_LINE 0x800 /* ctx->Line */
#define _NEW_PIXEL 0x1000 /* ctx->Pixel */
-#define _NEW_POINT 0x2000 /* ctx->Point */
-#define _NEW_POLYGON 0x4000 /* ctx->Polygon */
-#define _NEW_POLYGONSTIPPLE 0x8000 /* ctx->PolygonStipple */
+#define _NEW_POINT 0x2000 /* ctx->Point */
+#define _NEW_POLYGON 0x4000 /* ctx->Polygon */
+#define _NEW_POLYGONSTIPPLE 0x8000 /* ctx->PolygonStipple */
#define _NEW_SCISSOR 0x10000 /* ctx->Scissor */
-#define _NEW_STENCIL 0x20000 /* ctx->Stencil */
-#define _NEW_TEXTURE 0x40000 /* ctx->Texture */
-#define _NEW_TRANSFORM 0x80000 /* ctx->Transform */
+#define _NEW_STENCIL 0x20000 /* ctx->Stencil */
+#define _NEW_TEXTURE 0x40000 /* ctx->Texture */
+#define _NEW_TRANSFORM 0x80000 /* ctx->Transform */
#define _NEW_VIEWPORT 0x100000 /* ctx->Viewport */
-#define _NEW_PACKUNPACK 0x200000 /* ctx->Pack, ctx->Unpack */
-#define _NEW_ARRAY 0x400000 /* ctx->Array */
-#define _NEW_RENDERMODE 0x800000 /* RenderMode, Feedback, Select */
-#define _NEW_BUFFERS 0x1000000 /* ctx->Visual, ctx->DrawBuffer, */
-
+#define _NEW_PACKUNPACK 0x200000 /* ctx->Pack, ctx->Unpack */
+#define _NEW_ARRAY 0x400000 /* ctx->Array */
+#define _NEW_RENDERMODE 0x800000 /* RenderMode, Feedback, Select */
+#define _NEW_BUFFERS 0x1000000 /* ctx->Visual, ctx->DrawBuffer, */
+#define _NEW_MULTISAMPLE 0x2000000 /* ctx->Multisample */
#define _NEW_ALL ~0
@@ -1482,6 +1499,7 @@ struct __GLcontextRec {
struct gl_light_attrib Light;
struct gl_line_attrib Line;
struct gl_list_attrib List;
+ struct gl_multisample_attrib Multisample;
struct gl_pixel_attrib Pixel;
struct gl_point_attrib Point;
struct gl_polygon_attrib Polygon;
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index e699ac0752..6b7682144d 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,4 +1,4 @@
-/* $Id: state.c,v 1.65 2001/05/10 15:42:43 keithw Exp $ */
+/* $Id: state.c,v 1.66 2001/05/29 15:23:49 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -475,6 +475,9 @@ _mesa_init_exec_table(struct _glapi_table *exec, GLuint tableSize)
exec->MultTransposeMatrixdARB = _mesa_MultTransposeMatrixdARB;
exec->MultTransposeMatrixfARB = _mesa_MultTransposeMatrixfARB;
+ /* ARB 5. GL_ARB_multisample */
+ exec->SampleCoverageARB = _mesa_SampleCoverageARB;
+
/* ARB 12. GL_ARB_texture_compression */
exec->CompressedTexImage3DARB = _mesa_CompressedTexImage3DARB;
exec->CompressedTexImage2DARB = _mesa_CompressedTexImage2DARB;