diff options
Diffstat (limited to 'src/mesa/drivers')
31 files changed, 263 insertions, 169 deletions
diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index fc67bee98c6..3c6ecb83f0a 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -231,13 +231,14 @@ _mesa_init_driver_state(struct gl_context *ctx) ctx->Driver.BlendColor(ctx, ctx->Color.BlendColor); ctx->Driver.BlendEquationSeparate(ctx, - ctx->Color.BlendEquationRGB, - ctx->Color.BlendEquationA); + ctx->Color.Blend[0].EquationRGB, + ctx->Color.Blend[0].EquationA); ctx->Driver.BlendFuncSeparate(ctx, - ctx->Color.BlendSrcRGB, - ctx->Color.BlendDstRGB, - ctx->Color.BlendSrcA, ctx->Color.BlendDstA); + ctx->Color.Blend[0].SrcRGB, + ctx->Color.Blend[0].DstRGB, + ctx->Color.Blend[0].SrcA, + ctx->Color.Blend[0].DstA); if (ctx->Driver.ColorMaskIndexed) { GLuint i; diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 3e699912bb4..fd12e4d0a66 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2319,7 +2319,7 @@ _mesa_meta_GenerateMipmap(struct gl_context *ctx, GLenum target, } _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO); - _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE); _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index a5b71bd40ad..bf8cf6eec07 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -790,6 +790,9 @@ driCreateNewScreen(int scrn, static const __DRIextension *emptyExtensionList[] = { NULL }; __DRIscreen *psp; + if (driDriverAPI.InitScreen == NULL) + return NULL; + psp = calloc(1, sizeof *psp); if (!psp) return NULL; diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c index 7c3fbb1424d..6040abf7fac 100644 --- a/src/mesa/drivers/dri/i810/i810state.c +++ b/src/mesa/drivers/dri/i810/i810state.c @@ -95,7 +95,7 @@ static void i810BlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLuint a = SDM_UPDATE_SRC_BLEND | SDM_UPDATE_DST_BLEND; GLboolean fallback = GL_FALSE; - switch (ctx->Color.BlendSrcRGB) { + switch (ctx->Color.Blend[0].SrcRGB) { case GL_ZERO: a |= SDM_SRC_ZERO; break; case GL_ONE: a |= SDM_SRC_ONE; break; case GL_SRC_COLOR: a |= SDM_SRC_SRC_COLOR; break; @@ -124,7 +124,7 @@ static void i810BlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, return; } - switch (ctx->Color.BlendDstRGB) { + switch (ctx->Color.Blend[0].DstRGB) { case GL_ZERO: a |= SDM_DST_ZERO; break; case GL_ONE: a |= SDM_DST_ONE; break; case GL_SRC_COLOR: a |= SDM_DST_SRC_COLOR; break; diff --git a/src/mesa/drivers/dri/i915/i830_state.c b/src/mesa/drivers/dri/i915/i830_state.c index 147192adc7a..ef5b8d971da 100644 --- a/src/mesa/drivers/dri/i915/i830_state.c +++ b/src/mesa/drivers/dri/i915/i830_state.c @@ -291,10 +291,10 @@ i830_set_blend_state(struct gl_context * ctx) funcRGB = - SRC_BLND_FACT(intel_translate_blend_factor(ctx->Color.BlendSrcRGB)) - | DST_BLND_FACT(intel_translate_blend_factor(ctx->Color.BlendDstRGB)); + SRC_BLND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].SrcRGB)) + | DST_BLND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].DstRGB)); - switch (ctx->Color.BlendEquationRGB) { + switch (ctx->Color.Blend[0].EquationRGB) { case GL_FUNC_ADD: eqnRGB = BLENDFUNC_ADD; break; @@ -314,15 +314,15 @@ i830_set_blend_state(struct gl_context * ctx) break; default: fprintf(stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationRGB); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationRGB); return; } - funcA = SRC_ABLEND_FACT(intel_translate_blend_factor(ctx->Color.BlendSrcA)) - | DST_ABLEND_FACT(intel_translate_blend_factor(ctx->Color.BlendDstA)); + funcA = SRC_ABLEND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].SrcA)) + | DST_ABLEND_FACT(intel_translate_blend_factor(ctx->Color.Blend[0].DstA)); - switch (ctx->Color.BlendEquationA) { + switch (ctx->Color.Blend[0].EquationA) { case GL_FUNC_ADD: eqnA = BLENDFUNC_ADD; break; @@ -342,7 +342,7 @@ i830_set_blend_state(struct gl_context * ctx) break; default: fprintf(stderr, "[%s:%u] Invalid alpha blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationA); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationA); return; } diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 9508fbaf942..63c6e78ebe9 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -267,12 +267,12 @@ i915UpdateBlendState(struct gl_context * ctx) ~(S6_CBUF_SRC_BLEND_FACT_MASK | S6_CBUF_DST_BLEND_FACT_MASK | S6_CBUF_BLEND_FUNC_MASK)); - GLuint eqRGB = ctx->Color.BlendEquationRGB; - GLuint eqA = ctx->Color.BlendEquationA; - GLuint srcRGB = ctx->Color.BlendSrcRGB; - GLuint dstRGB = ctx->Color.BlendDstRGB; - GLuint srcA = ctx->Color.BlendSrcA; - GLuint dstA = ctx->Color.BlendDstA; + GLuint eqRGB = ctx->Color.Blend[0].EquationRGB; + GLuint eqA = ctx->Color.Blend[0].EquationA; + GLuint srcRGB = ctx->Color.Blend[0].SrcRGB; + GLuint dstRGB = ctx->Color.Blend[0].DstRGB; + GLuint srcA = ctx->Color.Blend[0].SrcA; + GLuint dstA = ctx->Color.Blend[0].DstA; if (eqRGB == GL_MIN || eqRGB == GL_MAX) { srcRGB = dstRGB = GL_ONE; diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index d286c9dbdc7..c986970a757 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -141,12 +141,12 @@ static void upload_cc_unit(struct brw_context *brw) cc.cc2.logicop_enable = 1; cc.cc5.logicop_func = intel_translate_logic_op(ctx->Color.LogicOp); } else if (ctx->Color.BlendEnabled) { - GLenum eqRGB = ctx->Color.BlendEquationRGB; - GLenum eqA = ctx->Color.BlendEquationA; - GLenum srcRGB = ctx->Color.BlendSrcRGB; - GLenum dstRGB = ctx->Color.BlendDstRGB; - GLenum srcA = ctx->Color.BlendSrcA; - GLenum dstA = ctx->Color.BlendDstA; + GLenum eqRGB = ctx->Color.Blend[0].EquationRGB; + GLenum eqA = ctx->Color.Blend[0].EquationA; + GLenum srcRGB = ctx->Color.Blend[0].SrcRGB; + GLenum dstRGB = ctx->Color.Blend[0].DstRGB; + GLenum srcA = ctx->Color.Blend[0].SrcA; + GLenum dstA = ctx->Color.Blend[0].DstA; /* If the renderbuffer is XRGB, we have to frob the blend function to * force the destination alpha to 1.0. This means replacing GL_DST_ALPHA diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index 395f306f1b5..d0b0c22abf6 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -36,8 +36,6 @@ #include "swrast/swrast.h" #include "tnl/tnl.h" #include "brw_context.h" -#include "intel_fbo.h" -#include "intel_regions.h" #define FILE_DEBUG_FLAG DEBUG_FALLBACKS diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index 22e6e2e7368..a35687d5991 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -48,6 +48,7 @@ extern "C" { #include "../glsl/ir_optimization.h" #include "../glsl/ir_print_visitor.h" +#define MAX_INSTRUCTION (1 << 30) static struct brw_reg brw_reg_from_fs_reg(class fs_reg *reg); struct gl_shader * @@ -534,25 +535,40 @@ fs_visitor::emit_general_interpolation(ir_variable *ir) continue; } - for (unsigned int c = 0; c < type->vector_elements; c++) { - struct brw_reg interp = interp_reg(location, c); - emit(fs_inst(FS_OPCODE_LINTERP, - attr, - this->delta_x, - this->delta_y, - fs_reg(interp))); - attr.reg_offset++; - } - - if (intel->gen < 6) { - attr.reg_offset -= type->vector_elements; + if (c->key.flat_shade && (location == FRAG_ATTRIB_COL0 || + location == FRAG_ATTRIB_COL1)) { + /* Constant interpolation (flat shading) case. The SF has + * handed us defined values in only the constant offset + * field of the setup reg. + */ for (unsigned int c = 0; c < type->vector_elements; c++) { - emit(fs_inst(BRW_OPCODE_MUL, - attr, + struct brw_reg interp = interp_reg(location, c); + interp = suboffset(interp, 3); + emit(fs_inst(FS_OPCODE_CINTERP, attr, fs_reg(interp))); + attr.reg_offset++; + } + } else { + /* Perspective interpolation case. */ + for (unsigned int c = 0; c < type->vector_elements; c++) { + struct brw_reg interp = interp_reg(location, c); + emit(fs_inst(FS_OPCODE_LINTERP, attr, - this->pixel_w)); + this->delta_x, + this->delta_y, + fs_reg(interp))); attr.reg_offset++; } + + if (intel->gen < 6) { + attr.reg_offset -= type->vector_elements; + for (unsigned int c = 0; c < type->vector_elements; c++) { + emit(fs_inst(BRW_OPCODE_MUL, + attr, + attr, + this->pixel_w)); + attr.reg_offset++; + } + } } location++; } @@ -859,6 +875,7 @@ fs_visitor::visit(ir_expression *ir) break; case ir_unop_abs: op[0].abs = true; + op[0].negate = false; this->result = op[0]; break; case ir_unop_sign: @@ -2556,12 +2573,15 @@ fs_visitor::assign_urb_setup() foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); - if (inst->opcode != FS_OPCODE_LINTERP) - continue; - - assert(inst->src[2].file == FIXED_HW_REG); + if (inst->opcode == FS_OPCODE_LINTERP) { + assert(inst->src[2].file == FIXED_HW_REG); + inst->src[2].fixed_hw_reg.nr += urb_start; + } - inst->src[2].fixed_hw_reg.nr += urb_start; + if (inst->opcode == FS_OPCODE_CINTERP) { + assert(inst->src[0].file == FIXED_HW_REG); + inst->src[0].fixed_hw_reg.nr += urb_start; + } } this->first_non_payload_grf = urb_start + c->prog_data.urb_read_length; @@ -2652,6 +2672,7 @@ fs_visitor::split_virtual_grfs() } } } + this->live_intervals_valid = false; } /** @@ -2726,8 +2747,11 @@ fs_visitor::calculate_live_intervals() int loop_start = 0; int bb_header_ip = 0; + if (this->live_intervals_valid) + return; + for (int i = 0; i < num_vars; i++) { - def[i] = 1 << 30; + def[i] = MAX_INSTRUCTION; use[i] = -1; } @@ -2805,6 +2829,8 @@ fs_visitor::calculate_live_intervals() talloc_free(this->virtual_grf_use); this->virtual_grf_def = def; this->virtual_grf_use = use; + + this->live_intervals_valid = true; } /** @@ -2820,6 +2846,8 @@ fs_visitor::propagate_constants() { bool progress = false; + calculate_live_intervals(); + foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); @@ -2877,6 +2905,7 @@ fs_visitor::propagate_constants() /* Fit this constant in by commuting the operands */ scan_inst->src[0] = scan_inst->src[1]; scan_inst->src[1] = inst->src[0]; + progress = true; } break; case BRW_OPCODE_CMP: @@ -2897,6 +2926,9 @@ fs_visitor::propagate_constants() } } + if (progress) + this->live_intervals_valid = false; + return progress; } /** @@ -2911,6 +2943,8 @@ fs_visitor::dead_code_eliminate() bool progress = false; int pc = 0; + calculate_live_intervals(); + foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); @@ -2922,6 +2956,9 @@ fs_visitor::dead_code_eliminate() pc++; } + if (progress) + live_intervals_valid = false; + return progress; } @@ -2929,10 +2966,35 @@ bool fs_visitor::register_coalesce() { bool progress = false; + int if_depth = 0; + int loop_depth = 0; foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); + /* Make sure that we dominate the instructions we're going to + * scan for interfering with our coalescing, or we won't have + * scanned enough to see if anything interferes with our + * coalescing. We don't dominate the following instructions if + * we're in a loop or an if block. + */ + switch (inst->opcode) { + case BRW_OPCODE_DO: + loop_depth++; + break; + case BRW_OPCODE_WHILE: + loop_depth--; + break; + case BRW_OPCODE_IF: + if_depth++; + break; + case BRW_OPCODE_ENDIF: + if_depth--; + break; + } + if (loop_depth || if_depth) + continue; + if (inst->opcode != BRW_OPCODE_MOV || inst->predicated || inst->saturate || @@ -2950,14 +3012,6 @@ fs_visitor::register_coalesce() for (; scan_iter.has_next(); scan_iter.next()) { fs_inst *scan_inst = (fs_inst *)scan_iter.get(); - if (scan_inst->opcode == BRW_OPCODE_DO || - scan_inst->opcode == BRW_OPCODE_WHILE || - scan_inst->opcode == BRW_OPCODE_ENDIF) { - interfered = true; - iter = scan_iter; - break; - } - if (scan_inst->dst.file == GRF) { if (scan_inst->dst.reg == inst->dst.reg && (scan_inst->dst.reg_offset == inst->dst.reg_offset || @@ -2977,10 +3031,6 @@ fs_visitor::register_coalesce() continue; } - /* Update live interval so we don't have to recalculate. */ - this->virtual_grf_use[inst->src[0].reg] = MAX2(virtual_grf_use[inst->src[0].reg], - virtual_grf_use[inst->dst.reg]); - /* Rewrite the later usage to point at the source of the move to * be removed. */ @@ -3005,6 +3055,9 @@ fs_visitor::register_coalesce() progress = true; } + if (progress) + live_intervals_valid = false; + return progress; } @@ -3015,6 +3068,8 @@ fs_visitor::compute_to_mrf() bool progress = false; int next_ip = 0; + calculate_live_intervals(); + foreach_iter(exec_list_iterator, iter, this->instructions) { fs_inst *inst = (fs_inst *)iter.get(); @@ -3218,15 +3273,16 @@ fs_visitor::virtual_grf_interferes(int a, int b) int start = MAX2(this->virtual_grf_def[a], this->virtual_grf_def[b]); int end = MIN2(this->virtual_grf_use[a], this->virtual_grf_use[b]); - /* For dead code, just check if the def interferes with the other range. */ - if (this->virtual_grf_use[a] == -1) { - return (this->virtual_grf_def[a] >= this->virtual_grf_def[b] && - this->virtual_grf_def[a] < this->virtual_grf_use[b]); - } - if (this->virtual_grf_use[b] == -1) { - return (this->virtual_grf_def[b] >= this->virtual_grf_def[a] && - this->virtual_grf_def[b] < this->virtual_grf_use[a]); - } + /* We can't handle dead register writes here, without iterating + * over the whole instruction stream to find every single dead + * write to that register to compare to the live interval of the + * other register. Just assert that dead_code_eliminate() has been + * called. + */ + assert((this->virtual_grf_use[a] != -1 || + this->virtual_grf_def[a] == MAX_INSTRUCTION) && + (this->virtual_grf_use[b] != -1 || + this->virtual_grf_def[b] == MAX_INSTRUCTION)); return start < end; } @@ -3466,6 +3522,9 @@ fs_visitor::generate_code() case FS_OPCODE_COS: generate_math(inst, dst, src); break; + case FS_OPCODE_CINTERP: + brw_MOV(p, dst, src[0]); + break; case FS_OPCODE_LINTERP: generate_linterp(inst, dst, src); break; @@ -3614,7 +3673,6 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) progress = v.remove_duplicate_mrf_writes() || progress; - v.calculate_live_intervals(); progress = v.propagate_constants() || progress; progress = v.register_coalesce() || progress; progress = v.compute_to_mrf() || progress; @@ -3627,7 +3685,6 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) for (int i = 1; i < virtual_grf_count; i++) { v.spill_reg(i); } - v.calculate_live_intervals(); } if (0) @@ -3636,8 +3693,6 @@ brw_wm_fs_emit(struct brw_context *brw, struct brw_wm_compile *c) while (!v.assign_regs()) { if (v.fail) break; - - v.calculate_live_intervals(); } } } diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h index 00a000855c5..82d96f6ac02 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.h +++ b/src/mesa/drivers/dri/i965/brw_fs.h @@ -68,6 +68,7 @@ enum fs_opcodes { FS_OPCODE_COS, FS_OPCODE_DDX, FS_OPCODE_DDY, + FS_OPCODE_CINTERP, FS_OPCODE_LINTERP, FS_OPCODE_TEX, FS_OPCODE_TXB, @@ -378,6 +379,7 @@ public: this->virtual_grf_array_size = 0; this->virtual_grf_def = NULL; this->virtual_grf_use = NULL; + this->live_intervals_valid = false; this->kill_emitted = false; } @@ -479,6 +481,7 @@ public: int virtual_grf_array_size; int *virtual_grf_def; int *virtual_grf_use; + bool live_intervals_valid; struct hash_table *variable_ht; ir_variable *frag_color, *frag_data, *frag_depth; diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp index bbb210cd449..078a349abdf 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp @@ -94,6 +94,8 @@ fs_visitor::assign_regs() int class_count = 0; int aligned_pair_class = -1; + calculate_live_intervals(); + /* Set up the register classes. * * The base registers store a scalar value. For texture samples, @@ -416,4 +418,6 @@ fs_visitor::spill_reg(int spill_reg) } } } + + this->live_intervals_valid = false; } diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index fe9737d043a..0411ce0b36c 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1942,6 +1942,7 @@ void brw_vs_emit(struct brw_vs_compile *c ) switch (inst->Opcode) { case OPCODE_ABS: + args[0].negate = false; brw_MOV(p, dst, brw_abs(args[0])); break; case OPCODE_ADD: diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c index e921d8a9a1d..a372554555c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -120,7 +120,8 @@ brw_render_target_supported(gl_format format) static GLuint translate_tex_format( gl_format mesa_format, GLenum internal_format, - GLenum depth_mode ) + GLenum depth_mode, + GLenum srgb_decode ) { switch( mesa_format ) { @@ -146,7 +147,14 @@ static GLuint translate_tex_format( gl_format mesa_format, return BRW_SURFACEFORMAT_R24_UNORM_X8_TYPELESS; else return BRW_SURFACEFORMAT_L24X8_UNORM; - + + case MESA_FORMAT_SARGB8: + case MESA_FORMAT_SLA8: + case MESA_FORMAT_SL8: + if (srgb_decode == GL_DECODE_EXT) + return brw_format_for_mesa_format[mesa_format]; + else if (srgb_decode == GL_SKIP_DECODE_EXT) + return brw_format_for_mesa_format[_mesa_get_srgb_format_linear(mesa_format)]; default: assert(brw_format_for_mesa_format[mesa_format] != 0); return brw_format_for_mesa_format[mesa_format]; @@ -189,7 +197,7 @@ brw_update_texture_surface( struct gl_context *ctx, GLuint unit ) surf.ss0.surface_type = translate_tex_target(tObj->Target); surf.ss0.surface_format = translate_tex_format(firstImage->TexFormat, firstImage->InternalFormat, - tObj->DepthMode); + tObj->DepthMode, tObj->sRGBDecode); /* This is ok for all textures with channel width 8bit or less: */ @@ -435,6 +443,11 @@ brw_update_renderbuffer_surface(struct brw_context *brw, */ surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break; + case MESA_FORMAT_SARGB8: + /* without GL_EXT_framebuffer_sRGB we shouldn't bind sRGB + surfaces to the blend/update as sRGB */ + surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; + break; default: surf.ss0.surface_format = brw_format_for_mesa_format[irb->Base.Format]; assert(surf.ss0.surface_format != 0); diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c b/src/mesa/drivers/dri/i965/gen6_cc.c index dbcdc5b8693..f51afa40716 100644 --- a/src/mesa/drivers/dri/i965/gen6_cc.c +++ b/src/mesa/drivers/dri/i965/gen6_cc.c @@ -66,12 +66,12 @@ blend_state_populate_key(struct brw_context *brw, /* _NEW_COLOR */ key->color_blend = ctx->Color.BlendEnabled; if (key->color_blend) { - key->blend_eq_rgb = ctx->Color.BlendEquationRGB; - key->blend_eq_a = ctx->Color.BlendEquationA; - key->blend_src_rgb = ctx->Color.BlendSrcRGB; - key->blend_dst_rgb = ctx->Color.BlendDstRGB; - key->blend_src_a = ctx->Color.BlendSrcA; - key->blend_dst_a = ctx->Color.BlendDstA; + key->blend_eq_rgb = ctx->Color.Blend[0].EquationRGB; + key->blend_eq_a = ctx->Color.Blend[0].EquationA; + key->blend_src_rgb = ctx->Color.Blend[0].SrcRGB; + key->blend_dst_rgb = ctx->Color.Blend[0].DstRGB; + key->blend_src_a = ctx->Color.Blend[0].SrcA; + key->blend_dst_a = ctx->Color.Blend[0].DstA; } /* _NEW_COLOR */ diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 00c2f99f80b..747e9dcb717 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -33,6 +33,7 @@ #include "utils.h" +#define need_GL_ARB_ES2_compatibility #define need_GL_ARB_draw_elements_base_vertex #define need_GL_ARB_framebuffer_object #define need_GL_ARB_map_buffer_range @@ -80,6 +81,7 @@ * i965_dri. */ static const struct dri_extension card_extensions[] = { + { "GL_ARB_ES2_compatibility", GL_ARB_ES2_compatibility_functions }, { "GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions }, { "GL_ARB_explicit_attrib_location", NULL }, { "GL_ARB_framebuffer_object", GL_ARB_framebuffer_object_functions}, @@ -176,6 +178,7 @@ static const struct dri_extension brw_extensions[] = { { "GL_EXT_shadow_funcs", NULL }, { "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions }, { "GL_EXT_texture_sRGB", NULL }, + { "GL_EXT_texture_sRGB_decode", NULL }, { "GL_EXT_texture_swizzle", NULL }, { "GL_EXT_vertex_array_bgra", NULL }, { "GL_ATI_envmap_bumpmap", GL_ATI_envmap_bumpmap_functions }, diff --git a/src/mesa/drivers/dri/intel/intel_extensions_es2.c b/src/mesa/drivers/dri/intel/intel_extensions_es2.c index 38b92d5b55b..5ef6b0561de 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions_es2.c +++ b/src/mesa/drivers/dri/intel/intel_extensions_es2.c @@ -81,6 +81,17 @@ static const char *es2_extensions[] = { }; /** + * \brief Extensions to disable. + * + * These extensions must be manually disabled because they may have been + * enabled by default. + */ +static const char* es2_extensions_disabled[] = { + "GL_OES_standard_derivatives", + NULL, +}; + +/** * Initializes potential list of extensions if ctx == NULL, or actually enables * extensions for a context. */ @@ -94,4 +105,6 @@ intelInitExtensionsES2(struct gl_context *ctx) for (i = 0; es2_extensions[i]; i++) _mesa_enable_extension(ctx, es2_extensions[i]); + for (i = 0; es2_extensions_disabled[i]; i++) + _mesa_disable_extension(ctx, es2_extensions_disabled[i]); } diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index cbb6275e9ce..0db5a491c8f 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -454,7 +454,6 @@ intel_render_texture(struct gl_context * ctx, struct gl_framebuffer *fb, struct gl_renderbuffer_attachment *att) { - struct intel_context *intel = intel_context(ctx); struct gl_texture_image *newImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer); @@ -517,6 +516,7 @@ intel_render_texture(struct gl_context * ctx, * instead, we just make a new single-level miptree and render * into that. */ + struct intel_context *intel = intel_context(ctx); struct intel_mipmap_tree *old_mt = intel_image->mt; struct intel_mipmap_tree *new_mt; int comp_byte = 0, texel_bytes; diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index d5c35775ce4..f97256e59bb 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -66,12 +66,12 @@ intel_check_blit_fragment_ops(struct gl_context * ctx, GLboolean src_alpha_is_on } if (ctx->Color.BlendEnabled && - (effective_func(ctx->Color.BlendSrcRGB, src_alpha_is_one) != GL_ONE || - effective_func(ctx->Color.BlendDstRGB, src_alpha_is_one) != GL_ZERO || - ctx->Color.BlendEquationRGB != GL_FUNC_ADD || - effective_func(ctx->Color.BlendSrcA, src_alpha_is_one) != GL_ONE || - effective_func(ctx->Color.BlendDstA, src_alpha_is_one) != GL_ZERO || - ctx->Color.BlendEquationA != GL_FUNC_ADD)) { + (effective_func(ctx->Color.Blend[0].SrcRGB, src_alpha_is_one) != GL_ONE || + effective_func(ctx->Color.Blend[0].DstRGB, src_alpha_is_one) != GL_ZERO || + ctx->Color.Blend[0].EquationRGB != GL_FUNC_ADD || + effective_func(ctx->Color.Blend[0].SrcA, src_alpha_is_one) != GL_ONE || + effective_func(ctx->Color.Blend[0].DstA, src_alpha_is_one) != GL_ZERO || + ctx->Color.Blend[0].EquationA != GL_FUNC_ADD)) { DBG("fallback due to blend\n"); return GL_FALSE; } diff --git a/src/mesa/drivers/dri/mach64/mach64_state.c b/src/mesa/drivers/dri/mach64/mach64_state.c index 8e795955c2c..c1a4e63204f 100644 --- a/src/mesa/drivers/dri/mach64/mach64_state.c +++ b/src/mesa/drivers/dri/mach64/mach64_state.c @@ -102,7 +102,7 @@ static void mach64UpdateAlphaMode( struct gl_context *ctx ) MACH64_ALPHA_BLEND_DST_MASK | MACH64_ALPHA_BLEND_SAT); - switch ( ctx->Color.BlendSrcRGB ) { + switch ( ctx->Color.Blend[0].SrcRGB ) { case GL_ZERO: s |= MACH64_ALPHA_BLEND_SRC_ZERO; break; @@ -135,7 +135,7 @@ static void mach64UpdateAlphaMode( struct gl_context *ctx ) FALLBACK( mmesa, MACH64_FALLBACK_BLEND_FUNC, GL_TRUE ); } - switch ( ctx->Color.BlendDstRGB ) { + switch ( ctx->Color.Blend[0].DstRGB ) { case GL_ZERO: s |= MACH64_ALPHA_BLEND_DST_ZERO; break; diff --git a/src/mesa/drivers/dri/mga/mgastate.c b/src/mesa/drivers/dri/mga/mgastate.c index 25d7de28fe8..2fac2b49cd2 100644 --- a/src/mesa/drivers/dri/mga/mgastate.c +++ b/src/mesa/drivers/dri/mga/mgastate.c @@ -141,7 +141,7 @@ static void mgaDDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, GLuint src; GLuint dst; - switch (ctx->Color.BlendSrcRGB) { + switch (ctx->Color.Blend[0].SrcRGB) { case GL_ZERO: src = AC_src_zero; break; case GL_SRC_ALPHA: @@ -169,7 +169,7 @@ static void mgaDDBlendFuncSeparate( struct gl_context *ctx, GLenum sfactorRGB, break; } - switch (ctx->Color.BlendDstRGB) { + switch (ctx->Color.Blend[0].DstRGB) { case GL_SRC_ALPHA: dst = AC_dst_src_alpha; break; case GL_ONE_MINUS_SRC_ALPHA: diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c index 98f2f98f1d0..ecfbdfedff6 100644 --- a/src/mesa/drivers/dri/nouveau/nv04_state_raster.c +++ b/src/mesa/drivers/dri/nouveau/nv04_state_raster.c @@ -264,8 +264,8 @@ nv04_emit_blend(struct gl_context *ctx, int emit) NV04_MULTITEX_TRIANGLE_BLEND_TEXTURE_PERSPECTIVE_ENABLE; /* Alpha blending. */ - blend |= get_blend_func(ctx->Color.BlendDstRGB) << 28 | - get_blend_func(ctx->Color.BlendSrcRGB) << 24; + blend |= get_blend_func(ctx->Color.Blend[0].DstRGB) << 28 | + get_blend_func(ctx->Color.Blend[0].SrcRGB) << 24; if (ctx->Color.BlendEnabled) blend |= NV04_MULTITEX_TRIANGLE_BLEND_BLEND_ENABLE; @@ -296,8 +296,8 @@ nv04_emit_blend(struct gl_context *ctx, int emit) NV04_TEXTURED_TRIANGLE_BLEND_TEXTURE_PERSPECTIVE_ENABLE; /* Alpha blending. */ - blend |= get_blend_func(ctx->Color.BlendDstRGB) << 28 | - get_blend_func(ctx->Color.BlendSrcRGB) << 24; + blend |= get_blend_func(ctx->Color.Blend[0].DstRGB) << 28 | + get_blend_func(ctx->Color.Blend[0].SrcRGB) << 24; if (ctx->Color.BlendEnabled) blend |= NV04_TEXTURED_TRIANGLE_BLEND_BLEND_ENABLE; diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c index bb1084ed11b..50021b0a7bf 100644 --- a/src/mesa/drivers/dri/nouveau/nv10_state_raster.c +++ b/src/mesa/drivers/dri/nouveau/nv10_state_raster.c @@ -68,7 +68,7 @@ nv10_emit_blend_equation(struct gl_context *ctx, int emit) OUT_RINGb(chan, ctx->Color.BlendEnabled); BEGIN_RING(chan, celsius, NV10_3D_BLEND_EQUATION, 1); - OUT_RING(chan, nvgl_blend_eqn(ctx->Color.BlendEquationRGB)); + OUT_RING(chan, nvgl_blend_eqn(ctx->Color.Blend[0].EquationRGB)); } void @@ -78,8 +78,8 @@ nv10_emit_blend_func(struct gl_context *ctx, int emit) struct nouveau_grobj *celsius = context_eng3d(ctx); BEGIN_RING(chan, celsius, NV10_3D_BLEND_FUNC_SRC, 2); - OUT_RING(chan, nvgl_blend_func(ctx->Color.BlendSrcRGB)); - OUT_RING(chan, nvgl_blend_func(ctx->Color.BlendDstRGB)); + OUT_RING(chan, nvgl_blend_func(ctx->Color.Blend[0].SrcRGB)); + OUT_RING(chan, nvgl_blend_func(ctx->Color.Blend[0].DstRGB)); } void diff --git a/src/mesa/drivers/dri/r128/r128_state.c b/src/mesa/drivers/dri/r128/r128_state.c index 4a49e8fc70f..d6725cdd0ec 100644 --- a/src/mesa/drivers/dri/r128/r128_state.c +++ b/src/mesa/drivers/dri/r128/r128_state.c @@ -178,12 +178,12 @@ static void r128UpdateAlphaMode( struct gl_context *ctx ) (R128_ALPHA_BLEND_MASK << R128_ALPHA_BLEND_DST_SHIFT) | R128_ALPHA_COMB_FCN_MASK); - a |= blend_factor( rmesa, ctx->Color.BlendSrcRGB, GL_TRUE ) + a |= blend_factor( rmesa, ctx->Color.Blend[0].SrcRGB, GL_TRUE ) << R128_ALPHA_BLEND_SRC_SHIFT; - a |= blend_factor( rmesa, ctx->Color.BlendDstRGB, GL_FALSE ) + a |= blend_factor( rmesa, ctx->Color.Blend[0].DstRGB, GL_FALSE ) << R128_ALPHA_BLEND_DST_SHIFT; - switch (ctx->Color.BlendEquationRGB) { + switch (ctx->Color.Blend[0].EquationRGB) { case GL_FUNC_ADD: a |= R128_ALPHA_COMB_ADD_CLAMP; break; diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index b523edcb5d9..0a1e0b47577 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -245,10 +245,10 @@ static void r200_set_blend_state( struct gl_context * ctx ) } } - func = (blend_factor( ctx->Color.BlendSrcRGB, GL_TRUE ) << R200_SRC_BLEND_SHIFT) | - (blend_factor( ctx->Color.BlendDstRGB, GL_FALSE ) << R200_DST_BLEND_SHIFT); + func = (blend_factor( ctx->Color.Blend[0].SrcRGB, GL_TRUE ) << R200_SRC_BLEND_SHIFT) | + (blend_factor( ctx->Color.Blend[0].DstRGB, GL_FALSE ) << R200_DST_BLEND_SHIFT); - switch(ctx->Color.BlendEquationRGB) { + switch(ctx->Color.Blend[0].EquationRGB) { case GL_FUNC_ADD: eqn = R200_COMB_FCN_ADD_CLAMP; break; @@ -275,7 +275,7 @@ static void r200_set_blend_state( struct gl_context * ctx ) default: fprintf( stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationRGB ); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationRGB ); return; } @@ -284,10 +284,10 @@ static void r200_set_blend_state( struct gl_context * ctx ) return; } - funcA = (blend_factor( ctx->Color.BlendSrcA, GL_TRUE ) << R200_SRC_BLEND_SHIFT) | - (blend_factor( ctx->Color.BlendDstA, GL_FALSE ) << R200_DST_BLEND_SHIFT); + funcA = (blend_factor( ctx->Color.Blend[0].SrcA, GL_TRUE ) << R200_SRC_BLEND_SHIFT) | + (blend_factor( ctx->Color.Blend[0].DstA, GL_FALSE ) << R200_DST_BLEND_SHIFT); - switch(ctx->Color.BlendEquationA) { + switch(ctx->Color.Blend[0].EquationA) { case GL_FUNC_ADD: eqnA = R200_COMB_FCN_ADD_CLAMP; break; @@ -314,7 +314,7 @@ static void r200_set_blend_state( struct gl_context * ctx ) default: fprintf( stderr, "[%s:%u] Invalid A blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationA ); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationA ); return; } diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index ab8c1df5f74..9df9101bcd3 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -220,12 +220,12 @@ static void r300SetBlendState(struct gl_context * ctx) } func = - (blend_factor(ctx->Color.BlendSrcRGB, GL_TRUE) << - R300_SRC_BLEND_SHIFT) | (blend_factor(ctx->Color.BlendDstRGB, + (blend_factor(ctx->Color.Blend[0].SrcRGB, GL_TRUE) << + R300_SRC_BLEND_SHIFT) | (blend_factor(ctx->Color.Blend[0].DstRGB, GL_FALSE) << R300_DST_BLEND_SHIFT); - switch (ctx->Color.BlendEquationRGB) { + switch (ctx->Color.Blend[0].EquationRGB) { case GL_FUNC_ADD: eqn = R300_COMB_FCN_ADD_CLAMP; break; @@ -253,17 +253,17 @@ static void r300SetBlendState(struct gl_context * ctx) default: fprintf(stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationRGB); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationRGB); return; } funcA = - (blend_factor(ctx->Color.BlendSrcA, GL_TRUE) << - R300_SRC_BLEND_SHIFT) | (blend_factor(ctx->Color.BlendDstA, + (blend_factor(ctx->Color.Blend[0].SrcA, GL_TRUE) << + R300_SRC_BLEND_SHIFT) | (blend_factor(ctx->Color.Blend[0].DstA, GL_FALSE) << R300_DST_BLEND_SHIFT); - switch (ctx->Color.BlendEquationA) { + switch (ctx->Color.Blend[0].EquationA) { case GL_FUNC_ADD: eqnA = R300_COMB_FCN_ADD_CLAMP; break; @@ -291,7 +291,7 @@ static void r300SetBlendState(struct gl_context * ctx) default: fprintf(stderr, "[%s:%u] Invalid A blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationA); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationA); return; } diff --git a/src/mesa/drivers/dri/r600/evergreen_state.c b/src/mesa/drivers/dri/r600/evergreen_state.c index 648cda0078e..006e50007b6 100644 --- a/src/mesa/drivers/dri/r600/evergreen_state.c +++ b/src/mesa/drivers/dri/r600/evergreen_state.c @@ -363,13 +363,13 @@ static void evergreenSetBlendState(struct gl_context * ctx) //diff : CB_COLOR_CO } SETfield(blend_reg, - evergreenblend_factor(ctx->Color.BlendSrcRGB, GL_TRUE), + evergreenblend_factor(ctx->Color.Blend[0].SrcRGB, GL_TRUE), COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); SETfield(blend_reg, - evergreenblend_factor(ctx->Color.BlendDstRGB, GL_FALSE), + evergreenblend_factor(ctx->Color.Blend[0].DstRGB, GL_FALSE), COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); - switch (ctx->Color.BlendEquationRGB) { + switch (ctx->Color.Blend[0].EquationRGB) { case GL_FUNC_ADD: eqn = COMB_DST_PLUS_SRC; break; @@ -401,20 +401,20 @@ static void evergreenSetBlendState(struct gl_context * ctx) //diff : CB_COLOR_CO default: fprintf(stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationRGB); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationRGB); return; } SETfield(blend_reg, eqn, COLOR_COMB_FCN_shift, COLOR_COMB_FCN_mask); SETfield(blend_reg, - evergreenblend_factor(ctx->Color.BlendSrcA, GL_TRUE), + evergreenblend_factor(ctx->Color.Blend[0].SrcA, GL_TRUE), ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); SETfield(blend_reg, - evergreenblend_factor(ctx->Color.BlendDstA, GL_FALSE), + evergreenblend_factor(ctx->Color.Blend[0].DstA, GL_FALSE), ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); - switch (ctx->Color.BlendEquationA) { + switch (ctx->Color.Blend[0].EquationA) { case GL_FUNC_ADD: eqnA = COMB_DST_PLUS_SRC; break; @@ -445,7 +445,7 @@ static void evergreenSetBlendState(struct gl_context * ctx) //diff : CB_COLOR_CO default: fprintf(stderr, "[%s:%u] Invalid A blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationA); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationA); return; } diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index bd04a633b48..f8770690ff6 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -474,13 +474,13 @@ static void r700SetBlendState(struct gl_context * ctx) } SETfield(blend_reg, - blend_factor(ctx->Color.BlendSrcRGB, GL_TRUE), + blend_factor(ctx->Color.Blend[0].SrcRGB, GL_TRUE), COLOR_SRCBLEND_shift, COLOR_SRCBLEND_mask); SETfield(blend_reg, - blend_factor(ctx->Color.BlendDstRGB, GL_FALSE), + blend_factor(ctx->Color.Blend[0].DstRGB, GL_FALSE), COLOR_DESTBLEND_shift, COLOR_DESTBLEND_mask); - switch (ctx->Color.BlendEquationRGB) { + switch (ctx->Color.Blend[0].EquationRGB) { case GL_FUNC_ADD: eqn = COMB_DST_PLUS_SRC; break; @@ -512,20 +512,20 @@ static void r700SetBlendState(struct gl_context * ctx) default: fprintf(stderr, "[%s:%u] Invalid RGB blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationRGB); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationRGB); return; } SETfield(blend_reg, eqn, COLOR_COMB_FCN_shift, COLOR_COMB_FCN_mask); SETfield(blend_reg, - blend_factor(ctx->Color.BlendSrcA, GL_TRUE), + blend_factor(ctx->Color.Blend[0].SrcA, GL_TRUE), ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); SETfield(blend_reg, - blend_factor(ctx->Color.BlendDstA, GL_FALSE), + blend_factor(ctx->Color.Blend[0].DstA, GL_FALSE), ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); - switch (ctx->Color.BlendEquationA) { + switch (ctx->Color.Blend[0].EquationA) { case GL_FUNC_ADD: eqnA = COMB_DST_PLUS_SRC; break; @@ -556,7 +556,7 @@ static void r700SetBlendState(struct gl_context * ctx) default: fprintf(stderr, "[%s:%u] Invalid A blend equation (0x%04x).\n", - __FUNCTION__, __LINE__, ctx->Color.BlendEquationA); + __FUNCTION__, __LINE__, ctx->Color.Blend[0].EquationA); return; } diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index cae12f192c3..ca42aa39474 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -136,7 +136,7 @@ static void radeonBlendEquationSeparate( struct gl_context *ctx, RADEON_STATECHANGE( rmesa, ctx ); rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = b; if ( (ctx->Color.ColorLogicOpEnabled || (ctx->Color.BlendEnabled - && ctx->Color.BlendEquationRGB == GL_LOGIC_OP)) ) { + && ctx->Color.Blend[0].EquationRGB == GL_LOGIC_OP)) ) { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE; } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE; @@ -153,7 +153,7 @@ static void radeonBlendFuncSeparate( struct gl_context *ctx, ~(RADEON_SRC_BLEND_MASK | RADEON_DST_BLEND_MASK); GLboolean fallback = GL_FALSE; - switch ( ctx->Color.BlendSrcRGB ) { + switch ( ctx->Color.Blend[0].SrcRGB ) { case GL_ZERO: b |= RADEON_SRC_BLEND_GL_ZERO; break; @@ -200,7 +200,7 @@ static void radeonBlendFuncSeparate( struct gl_context *ctx, break; } - switch ( ctx->Color.BlendDstRGB ) { + switch ( ctx->Color.Blend[0].DstRGB ) { case GL_ZERO: b |= RADEON_DST_BLEND_GL_ZERO; break; @@ -1602,7 +1602,7 @@ static void radeonEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ALPHA_BLEND_ENABLE; } if ( (ctx->Color.ColorLogicOpEnabled || (ctx->Color.BlendEnabled - && ctx->Color.BlendEquationRGB == GL_LOGIC_OP)) ) { + && ctx->Color.Blend[0].EquationRGB == GL_LOGIC_OP)) ) { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE; } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE; @@ -1612,12 +1612,12 @@ static void radeonEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) */ if (state) { ctx->Driver.BlendEquationSeparate( ctx, - ctx->Color.BlendEquationRGB, - ctx->Color.BlendEquationA ); - ctx->Driver.BlendFuncSeparate( ctx, ctx->Color.BlendSrcRGB, - ctx->Color.BlendDstRGB, - ctx->Color.BlendSrcA, - ctx->Color.BlendDstA ); + ctx->Color.Blend[0].EquationRGB, + ctx->Color.Blend[0].EquationA ); + ctx->Driver.BlendFuncSeparate( ctx, ctx->Color.Blend[0].SrcRGB, + ctx->Color.Blend[0].DstRGB, + ctx->Color.Blend[0].SrcA, + ctx->Color.Blend[0].DstA ); } else { FALLBACK( rmesa, RADEON_FALLBACK_BLEND_FUNC, GL_FALSE ); @@ -1741,7 +1741,7 @@ static void radeonEnable( struct gl_context *ctx, GLenum cap, GLboolean state ) case GL_COLOR_LOGIC_OP: RADEON_STATECHANGE( rmesa, ctx ); if ( (ctx->Color.ColorLogicOpEnabled || (ctx->Color.BlendEnabled - && ctx->Color.BlendEquationRGB == GL_LOGIC_OP)) ) { + && ctx->Color.Blend[0].EquationRGB == GL_LOGIC_OP)) ) { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] |= RADEON_ROP_ENABLE; } else { rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] &= ~RADEON_ROP_ENABLE; diff --git a/src/mesa/drivers/dri/savage/savagestate.c b/src/mesa/drivers/dri/savage/savagestate.c index 0906f85b1fa..1feffa0b0a2 100644 --- a/src/mesa/drivers/dri/savage/savagestate.c +++ b/src/mesa/drivers/dri/savage/savagestate.c @@ -136,7 +136,7 @@ static void savageBlendFunc_s4(struct gl_context *ctx) * blend modes */ if(ctx->Color.BlendEnabled){ - switch (ctx->Color.BlendDstRGB) + switch (ctx->Color.Blend[0].DstRGB) { case GL_ZERO: imesa->regs.s4.drawLocalCtrl.ni.dstAlphaMode = DAM_Zero; @@ -192,7 +192,7 @@ static void savageBlendFunc_s4(struct gl_context *ctx) break; } - switch (ctx->Color.BlendSrcRGB) + switch (ctx->Color.Blend[0].SrcRGB) { case GL_ZERO: imesa->regs.s4.drawLocalCtrl.ni.srcAlphaMode = SAM_Zero; @@ -310,7 +310,7 @@ static void savageBlendFunc_s3d(struct gl_context *ctx) * blend modes */ if(ctx->Color.BlendEnabled){ - switch (ctx->Color.BlendDstRGB) + switch (ctx->Color.Blend[0].DstRGB) { case GL_ZERO: imesa->regs.s3d.drawCtrl.ni.dstAlphaMode = DAM_Zero; @@ -366,7 +366,7 @@ static void savageBlendFunc_s3d(struct gl_context *ctx) break; } - switch (ctx->Color.BlendSrcRGB) + switch (ctx->Color.Blend[0].SrcRGB) { case GL_ZERO: imesa->regs.s3d.drawCtrl.ni.srcAlphaMode = SAM_Zero; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c index 3f6822d4574..b26b2c710b9 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_state.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c @@ -84,7 +84,7 @@ static void tdfxUpdateAlphaMode( struct gl_context *ctx ) if ( ctx->Color.BlendEnabled && (fxMesa->Fallback & TDFX_FALLBACK_BLEND) == 0 ) { - switch ( ctx->Color.BlendSrcRGB ) { + switch ( ctx->Color.Blend[0].SrcRGB ) { case GL_ZERO: srcRGB = GR_BLEND_ZERO; break; @@ -126,7 +126,7 @@ static void tdfxUpdateAlphaMode( struct gl_context *ctx ) srcRGB = GR_BLEND_ONE; } - switch ( ctx->Color.BlendSrcA ) { + switch ( ctx->Color.Blend[0].SrcA ) { case GL_ZERO: srcA = GR_BLEND_ZERO; break; @@ -156,7 +156,7 @@ static void tdfxUpdateAlphaMode( struct gl_context *ctx ) srcA = GR_BLEND_ONE; } - switch ( ctx->Color.BlendDstRGB ) { + switch ( ctx->Color.Blend[0].DstRGB ) { case GL_ZERO: dstRGB = GR_BLEND_ZERO; break; @@ -195,7 +195,7 @@ static void tdfxUpdateAlphaMode( struct gl_context *ctx ) dstRGB = GR_BLEND_ZERO; } - switch ( ctx->Color.BlendDstA ) { + switch ( ctx->Color.Blend[0].DstA ) { case GL_ZERO: dstA = GR_BLEND_ZERO; break; @@ -222,7 +222,7 @@ static void tdfxUpdateAlphaMode( struct gl_context *ctx ) dstA = GR_BLEND_ZERO; } - switch ( ctx->Color.BlendEquationRGB ) { + switch ( ctx->Color.Blend[0].EquationRGB ) { case GL_FUNC_SUBTRACT: eqRGB = GR_BLEND_OP_SUB; break; @@ -235,7 +235,7 @@ static void tdfxUpdateAlphaMode( struct gl_context *ctx ) break; } - switch ( ctx->Color.BlendEquationA ) { + switch ( ctx->Color.Blend[0].EquationA ) { case GL_FUNC_SUBTRACT: eqA = GR_BLEND_OP_SUB; break; diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index 033352188d4..774f439bfb6 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -552,7 +552,7 @@ static void viaBlendFunc(struct gl_context *ctx, GLenum sfactor, GLenum dfactor) if (VIA_DEBUG & DEBUG_STATE) fprintf(stderr, "%s in\n", __FUNCTION__); - switch (ctx->Color.BlendSrcRGB) { + switch (ctx->Color.Blend[0].SrcRGB) { case GL_SRC_ALPHA_SATURATE: case GL_CONSTANT_COLOR: case GL_ONE_MINUS_CONSTANT_COLOR: @@ -564,7 +564,7 @@ static void viaBlendFunc(struct gl_context *ctx, GLenum sfactor, GLenum dfactor) break; } - switch (ctx->Color.BlendDstRGB) { + switch (ctx->Color.Blend[0].DstRGB) { case GL_CONSTANT_COLOR: case GL_ONE_MINUS_CONSTANT_COLOR: case GL_CONSTANT_ALPHA: @@ -757,14 +757,14 @@ void viaInitState(struct gl_context *ctx) */ ctx->Driver.BlendEquationSeparate( ctx, - ctx->Color.BlendEquationRGB, - ctx->Color.BlendEquationA); + ctx->Color.Blend[0].EquationRGB, + ctx->Color.Blend[0].EquationA); ctx->Driver.BlendFuncSeparate( ctx, - ctx->Color.BlendSrcRGB, - ctx->Color.BlendDstRGB, - ctx->Color.BlendSrcA, - ctx->Color.BlendDstA); + ctx->Color.Blend[0].SrcRGB, + ctx->Color.Blend[0].DstRGB, + ctx->Color.Blend[0].SrcA, + ctx->Color.Blend[0].DstA); ctx->Driver.Scissor( ctx, ctx->Scissor.X, ctx->Scissor.Y, ctx->Scissor.Width, ctx->Scissor.Height ); @@ -953,8 +953,8 @@ static GLboolean viaChooseTextureState(struct gl_context *ctx) static void viaChooseColorState(struct gl_context *ctx) { struct via_context *vmesa = VIA_CONTEXT(ctx); - GLenum s = ctx->Color.BlendSrcRGB; - GLenum d = ctx->Color.BlendDstRGB; + GLenum s = ctx->Color.Blend[0].SrcRGB; + GLenum d = ctx->Color.Blend[0].DstRGB; /* The HW's blending equation is: * (Ca * FCa + Cbias + Cb * FCb) << Cshift |