mesa: added infrastructure for GL_EXT_draw_buffers2
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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) },
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user