X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fattrib.c;h=7fd1287368fa3e3c92d312195e29104fc0042d7e;hb=751fe9058bc15f4f8608f0fdc02209542991ff23;hp=0299525f46bf84e2f382ae81633d1e78c04508f9;hpb=a62efdf82c20747feb11dfd7756f0579aa914b57;p=mesa.git diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 0299525f46b..7fd1287368f 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -43,6 +43,7 @@ #include "lines.h" #include "macros.h" #include "matrix.h" +#include "mfeatures.h" #include "multisample.h" #include "points.h" #include "polygon.h" @@ -473,7 +474,7 @@ end: static void -pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) +pop_enable_group(struct gl_context *ctx, const struct gl_enable_attrib *enable) { const GLuint curTexUnitSave = ctx->Texture.CurrentUnit; GLuint i; @@ -669,7 +670,7 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) * Pop/restore texture attribute/group state. */ static void -pop_texture_group(GLcontext *ctx, struct texture_state *texstate) +pop_texture_group(struct gl_context *ctx, struct texture_state *texstate) { GLuint u; @@ -953,20 +954,39 @@ _mesa_PopAttrib(void) _mesa_set_enable(ctx, GL_BLEND, (color->BlendEnabled & 1)); } } - _mesa_BlendFuncSeparateEXT(color->BlendSrcRGB, - color->BlendDstRGB, - color->BlendSrcA, - color->BlendDstA); - /* This special case is because glBlendEquationSeparateEXT - * cannot take GL_LOGIC_OP as a parameter. - */ - if ( color->BlendEquationRGB == color->BlendEquationA ) { - _mesa_BlendEquation(color->BlendEquationRGB); - } - else { - _mesa_BlendEquationSeparateEXT(color->BlendEquationRGB, - color->BlendEquationA); - } + if (ctx->Color._BlendFuncPerBuffer || + ctx->Color._BlendEquationPerBuffer) { + /* set blend per buffer */ + GLuint buf; + for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) { + _mesa_BlendFuncSeparatei(buf, color->Blend[buf].SrcRGB, + color->Blend[buf].DstRGB, + color->Blend[buf].SrcA, + color->Blend[buf].DstA); + _mesa_BlendEquationSeparatei(buf, + color->Blend[buf].EquationRGB, + color->Blend[buf].EquationA); + } + } + else { + /* set same blend modes for all buffers */ + _mesa_BlendFuncSeparateEXT(color->Blend[0].SrcRGB, + color->Blend[0].DstRGB, + color->Blend[0].SrcA, + color->Blend[0].DstA); + /* This special case is because glBlendEquationSeparateEXT + * cannot take GL_LOGIC_OP as a parameter. + */ + if (color->Blend[0].EquationRGB == + color->Blend[0].EquationA) { + _mesa_BlendEquation(color->Blend[0].EquationRGB); + } + else { + _mesa_BlendEquationSeparateEXT( + color->Blend[0].EquationRGB, + color->Blend[0].EquationA); + } + } _mesa_BlendColor(color->BlendColor[0], color->BlendColor[1], color->BlendColor[2], @@ -1323,7 +1343,7 @@ adjust_buffer_object_ref_counts(struct gl_array_object *arrayObj, GLint step) * object refcounts. */ static void -copy_pixelstore(GLcontext *ctx, +copy_pixelstore(struct gl_context *ctx, struct gl_pixelstore_attrib *dst, const struct gl_pixelstore_attrib *src) { @@ -1506,7 +1526,7 @@ _mesa_init_attrib_dispatch(struct _glapi_table *disp) * Free any attribute state data that might be attached to the context. */ void -_mesa_free_attrib_data(GLcontext *ctx) +_mesa_free_attrib_data(struct gl_context *ctx) { while (ctx->AttribStackDepth > 0) { struct gl_attrib_node *attr, *next; @@ -1538,7 +1558,7 @@ _mesa_free_attrib_data(GLcontext *ctx) } -void _mesa_init_attrib( GLcontext *ctx ) +void _mesa_init_attrib( struct gl_context *ctx ) { /* Renderer and client attribute stacks */ ctx->AttribStackDepth = 0;