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);
|
ASSERT(state == 0 || state == 1);
|
||||||
switch (cap) {
|
switch (cap) {
|
||||||
case GL_BLEND:
|
case GL_BLEND:
|
||||||
|
if (!ctx->Extensions.EXT_draw_buffers2) {
|
||||||
|
goto bad_cap_error;
|
||||||
|
}
|
||||||
if (index >= ctx->Const.MaxDrawBuffers) {
|
if (index >= ctx->Const.MaxDrawBuffers) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)",
|
_mesa_error(ctx, GL_INVALID_VALUE, "%s(index=%u)",
|
||||||
state ? "glEnableIndexed" : "glDisableIndexed", index);
|
state ? "glEnableIndexed" : "glDisableIndexed", index);
|
||||||
@@ -1047,10 +1050,14 @@ _mesa_set_enablei(GLcontext *ctx, GLenum cap, GLuint index, GLboolean state)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_mesa_error(ctx, GL_INVALID_ENUM, "%s(cap=%s)",
|
goto bad_cap_error;
|
||||||
state ? "glEnableIndexed" : "glDisableIndexed",
|
|
||||||
_mesa_lookup_enum_by_nr(cap));
|
|
||||||
}
|
}
|
||||||
|
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) },
|
{ OFF, "GL_EXT_convolution", F(EXT_convolution) },
|
||||||
{ ON, "GL_EXT_copy_texture", F(EXT_copy_texture) },
|
{ ON, "GL_EXT_copy_texture", F(EXT_copy_texture) },
|
||||||
{ OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) },
|
{ 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) },
|
{ ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) },
|
||||||
{ OFF, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit) },
|
{ OFF, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit) },
|
||||||
{ OFF, "GL_EXT_framebuffer_multisample", F(EXT_framebuffer_multisample) },
|
{ OFF, "GL_EXT_framebuffer_multisample", F(EXT_framebuffer_multisample) },
|
||||||
|
@@ -7448,12 +7448,14 @@ _mesa_GetBooleanIndexedv( GLenum pname, GLuint index, GLboolean *params )
|
|||||||
|
|
||||||
switch (pname) {
|
switch (pname) {
|
||||||
case GL_BLEND:
|
case GL_BLEND:
|
||||||
|
CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv");
|
||||||
if (index >= ctx->Const.MaxDrawBuffers) {
|
if (index >= ctx->Const.MaxDrawBuffers) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
|
_mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
|
||||||
}
|
}
|
||||||
params[0] = INT_TO_BOOLEAN(((ctx->Color.BlendEnabled >> index) & 1));
|
params[0] = INT_TO_BOOLEAN(((ctx->Color.BlendEnabled >> index) & 1));
|
||||||
break;
|
break;
|
||||||
case GL_COLOR_WRITEMASK:
|
case GL_COLOR_WRITEMASK:
|
||||||
|
CHECK_EXT1(EXT_draw_buffers2, "GetBooleanIndexedv");
|
||||||
if (index >= ctx->Const.MaxDrawBuffers) {
|
if (index >= ctx->Const.MaxDrawBuffers) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetBooleanIndexedv(index=%u), index", pname);
|
_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) {
|
switch (pname) {
|
||||||
case GL_BLEND:
|
case GL_BLEND:
|
||||||
|
CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv");
|
||||||
if (index >= ctx->Const.MaxDrawBuffers) {
|
if (index >= ctx->Const.MaxDrawBuffers) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
|
_mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
|
||||||
}
|
}
|
||||||
params[0] = ((ctx->Color.BlendEnabled >> index) & 1);
|
params[0] = ((ctx->Color.BlendEnabled >> index) & 1);
|
||||||
break;
|
break;
|
||||||
case GL_COLOR_WRITEMASK:
|
case GL_COLOR_WRITEMASK:
|
||||||
|
CHECK_EXT1(EXT_draw_buffers2, "GetIntegerIndexedv");
|
||||||
if (index >= ctx->Const.MaxDrawBuffers) {
|
if (index >= ctx->Const.MaxDrawBuffers) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetIntegerIndexedv(index=%u), index", pname);
|
_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) {
|
switch (pname) {
|
||||||
case GL_BLEND:
|
case GL_BLEND:
|
||||||
|
CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv");
|
||||||
if (index >= ctx->Const.MaxDrawBuffers) {
|
if (index >= ctx->Const.MaxDrawBuffers) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
|
_mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
|
||||||
}
|
}
|
||||||
params[0] = (GLint64)(((ctx->Color.BlendEnabled >> index) & 1));
|
params[0] = (GLint64)(((ctx->Color.BlendEnabled >> index) & 1));
|
||||||
break;
|
break;
|
||||||
case GL_COLOR_WRITEMASK:
|
case GL_COLOR_WRITEMASK:
|
||||||
|
CHECK_EXT1(EXT_draw_buffers2, "GetInteger64Indexedv");
|
||||||
if (index >= ctx->Const.MaxDrawBuffers) {
|
if (index >= ctx->Const.MaxDrawBuffers) {
|
||||||
_mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
|
_mesa_error(ctx, GL_INVALID_VALUE, "glGetInteger64Indexedv(index=%u), index", pname);
|
||||||
}
|
}
|
||||||
|
@@ -1036,13 +1036,13 @@ StateVars = [
|
|||||||
# These are queried via glGetIntegetIndexdvEXT() or glGetIntegeri_v()
|
# These are queried via glGetIntegetIndexdvEXT() or glGetIntegeri_v()
|
||||||
IndexedStateVars = [
|
IndexedStateVars = [
|
||||||
( "GL_BLEND", GLint, ["((ctx->Color.BlendEnabled >> index) & 1)"],
|
( "GL_BLEND", GLint, ["((ctx->Color.BlendEnabled >> index) & 1)"],
|
||||||
"ctx->Const.MaxDrawBuffers", None ),
|
"ctx->Const.MaxDrawBuffers", ["EXT_draw_buffers2"] ),
|
||||||
( "GL_COLOR_WRITEMASK", GLint,
|
( "GL_COLOR_WRITEMASK", GLint,
|
||||||
[ "ctx->Color.ColorMask[index][RCOMP] ? 1 : 0",
|
[ "ctx->Color.ColorMask[index][RCOMP] ? 1 : 0",
|
||||||
"ctx->Color.ColorMask[index][GCOMP] ? 1 : 0",
|
"ctx->Color.ColorMask[index][GCOMP] ? 1 : 0",
|
||||||
"ctx->Color.ColorMask[index][BCOMP] ? 1 : 0",
|
"ctx->Color.ColorMask[index][BCOMP] ? 1 : 0",
|
||||||
"ctx->Color.ColorMask[index][ACOMP] ? 1 : 0" ],
|
"ctx->Color.ColorMask[index][ACOMP] ? 1 : 0" ],
|
||||||
"ctx->Const.MaxDrawBuffers", None ),
|
"ctx->Const.MaxDrawBuffers", ["EXT_draw_buffers2"] ),
|
||||||
# XXX more to come...
|
# XXX more to come...
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -1137,11 +1137,6 @@ def EmitGetFunction(stateVars, returnType, indexed):
|
|||||||
(name, varType, state, optionalCode, extensions) = state
|
(name, varType, state, optionalCode, extensions) = state
|
||||||
indexMax = 0
|
indexMax = 0
|
||||||
print " case " + name + ":"
|
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 extensions:
|
||||||
if len(extensions) == 1:
|
if len(extensions) == 1:
|
||||||
print (' CHECK_EXT1(%s, "%s");' %
|
print (' CHECK_EXT1(%s, "%s");' %
|
||||||
@@ -1156,6 +1151,11 @@ def EmitGetFunction(stateVars, returnType, indexed):
|
|||||||
assert len(extensions) == 4
|
assert len(extensions) == 4
|
||||||
print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' %
|
print (' CHECK_EXT4(%s, %s, %s, %s, "%s");' %
|
||||||
(extensions[0], extensions[1], extensions[2], extensions[3], function))
|
(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)
|
conversion = ConversionFunc(varType, returnType)
|
||||||
if optionalCode:
|
if optionalCode:
|
||||||
optionalCode = string.replace(optionalCode, "CONVERSION", conversion);
|
optionalCode = string.replace(optionalCode, "CONVERSION", conversion);
|
||||||
|
@@ -2434,6 +2434,7 @@ struct gl_extensions
|
|||||||
GLboolean EXT_compiled_vertex_array;
|
GLboolean EXT_compiled_vertex_array;
|
||||||
GLboolean EXT_copy_texture;
|
GLboolean EXT_copy_texture;
|
||||||
GLboolean EXT_depth_bounds_test;
|
GLboolean EXT_depth_bounds_test;
|
||||||
|
GLboolean EXT_draw_buffers2;
|
||||||
GLboolean EXT_draw_range_elements;
|
GLboolean EXT_draw_range_elements;
|
||||||
GLboolean EXT_fog_coord;
|
GLboolean EXT_fog_coord;
|
||||||
GLboolean EXT_framebuffer_blit;
|
GLboolean EXT_framebuffer_blit;
|
||||||
|
Reference in New Issue
Block a user