summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-12-29 16:30:54 -0700
committerBrian Paul <brianp@vmware.com>2009-12-29 20:51:20 -0700
commit8f6f1124634cf659dde4c75549b84e35505d892d (patch)
tree2a41c7324530fca4c320fd6b4592bf5df83f51b6 /src
parenta856d635d300f842e9fa6413b0255bdb64142838 (diff)
mesa: added infrastructure for GL_EXT_draw_buffers2
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/enable.c13
-rw-r--r--src/mesa/main/extensions.c1
-rw-r--r--src/mesa/main/get.c6
-rw-r--r--src/mesa/main/get_gen.py14
-rw-r--r--src/mesa/main/mtypes.h1
5 files changed, 25 insertions, 10 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 6f9f57f5cb..cd6e881ad2 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1033,6 +1033,9 @@ _mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state)
ASSERT(state == 0 || state == 1);
switch (cap) {
case GL_BLEND:
+ if (!ctx->Extensions.EXT_draw_buffers2) {
+ goto bad_cap_error;
+ }
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)",
state ? "glEnableIndexed" : "glDisableIndexed", index);
@@ -1047,10 +1050,14 @@ _mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state)
}
break;
default:
- _mesa_error(ctx, GL_INVALID_ENUM, "%s(cap=%s)",
- state ? "glEnableIndexed" : "glDisableIndexed",
- _mesa_lookup_enum_by_nr(cap));
+ goto bad_cap_error;
}
+ return;
+
+bad_cap_error:
+ _mesa_error(ctx, GL_INVALID_ENUM, "%s(cap=%s)",
+ state ? "glEnablei" : "glDisablei",
+ _mesa_lookup_enum_by_nr(cap));
}
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 2138bfe40e..9e96eb0403 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -103,6 +103,7 @@ static const struct {
{ OFF, "GL_EXT_convolution", F(EXT_convolution) },
{ ON, "GL_EXT_copy_texture", F(EXT_copy_texture) },
{ OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) },
+ { OFF, "GL_EXT_draw_buffers2", F(EXT_draw_buffers2) },
{ ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) },
{ OFF, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit) },
{ OFF, "GL_EXT_framebuffer_multisample", F(EXT_framebuffer_multisample) },
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 44396a0491..99478f0ec4 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -7448,12 +7448,14 @@ _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
switch (pname) {
case GL_BLEND:
+ CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
}
params[0] = INT_TO_BOOLEAN(((ctx->Color.BlendEnabled >> index) & 1));
break;
case GL_COLOR_WRITEMASK:
+ CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
}
@@ -7481,12 +7483,14 @@ _mesa_GetIntegerIndexedv( GLenum pname, GLuint index, GLint *params )
switch (pname) {
case GL_BLEND:
+ CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
}
params[0] = ((ctx->Color.BlendEnabled >> index) & 1);
break;
case GL_COLOR_WRITEMASK:
+ CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
}
@@ -7515,12 +7519,14 @@ _mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
switch (pname) {
case GL_BLEND:
+ CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
}
params[0] = (GLint64)(((ctx->Color.BlendEnabled >> index) & 1));
break;
case GL_COLOR_WRITEMASK:
+ CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv");
if (index >= ctx->Const.MaxDrawBuffers) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
}
diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py
index 18708be260..82eacf0314 100644
--- a/src/mesa/main/get_gen.py
+++ b/src/mesa/main/get_gen.py
@@ -1036,13 +1036,13 @@ StateVars = [
# These are queried via glGetIntegetIndexdvEXT() or glGetIntegeri_v()
IndexedStateVars = [
( "GL_BLEND", GLint, ["((ctx->Color.BlendEnabled >> index) & 1)"],
- "ctx->Const.MaxDrawBuffers", None ),
+ "ctx->Const.MaxDrawBuffers", ["EXT_draw_buffers2"] ),
( "GL_COLOR_WRITEMASK", GLint,
[ "ctx->Color.ColorMask[index][RCOMP] ? 1 : 0",
"ctx->Color.ColorMask[index][GCOMP] ? 1 : 0",
"ctx->Color.ColorMask[index][BCOMP] ? 1 : 0",
"ctx->Color.ColorMask[index][ACOMP] ? 1 : 0" ],
- "ctx->Const.MaxDrawBuffers", None ),
+ "ctx->Const.MaxDrawBuffers", ["EXT_draw_buffers2"] ),
# XXX more to come...
]
@@ -1137,11 +1137,6 @@ def EmitGetFunction(stateVars, returnType, indexed):
(name, varType, state, optionalCode, extensions) = state
indexMax = 0
print " case " + name + ":"
- if indexMax:
- print (' if (index >= %s) {' % indexMax)
- print (' _mesa_error(ctx, GL_INVALID_VALUE, "gl%s(index=%%u), index", pname);' % function)
- print (' }')
-
if extensions:
if len(extensions) == 1:
print (' CHECK_EXT1(%s, "%s");' %
@@ -1156,6 +1151,11 @@ def EmitGetFunction(stateVars, returnType, indexed):
assert len(extensions) == 4
print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' %
(extensions[0], extensions[1], extensions[2], extensions[3], function))
+ if indexMax:
+ print (' if (index >= %s) {' % indexMax)
+ print (' _mesa_error(ctx, GL_INVALID_VALUE, "gl%s(index=%%u), index", pname);' % function)
+ print (' }')
+
conversion = ConversionFunc(varType, returnType)
if optionalCode:
optionalCode = string.replace(optionalCode, "CONVERSION", conversion);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7ef2852242..3a48c8bf00 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2434,6 +2434,7 @@ struct gl_extensions
GLboolean EXT_compiled_vertex_array;
GLboolean EXT_copy_texture;
GLboolean EXT_depth_bounds_test;
+ GLboolean EXT_draw_buffers2;
GLboolean EXT_draw_range_elements;
GLboolean EXT_fog_coord;
GLboolean EXT_framebuffer_blit;