diff options
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_cc.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs_emit.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.c | 4 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_wm_emit.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen6_cc.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_extensions.c | 1 |
9 files changed, 28 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index 412d82ab3ca..74a66af31a5 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -238,10 +238,10 @@ static void upload_blend_constant_color(struct brw_context *brw) BEGIN_BATCH(5); OUT_BATCH(_3DSTATE_BLEND_CONSTANT_COLOR << 16 | (5-2)); - OUT_BATCH_F(ctx->Color.BlendColor[0]); - OUT_BATCH_F(ctx->Color.BlendColor[1]); - OUT_BATCH_F(ctx->Color.BlendColor[2]); - OUT_BATCH_F(ctx->Color.BlendColor[3]); + OUT_BATCH_F(ctx->Color.BlendColorUnclamped[0]); + OUT_BATCH_F(ctx->Color.BlendColorUnclamped[1]); + OUT_BATCH_F(ctx->Color.BlendColorUnclamped[2]); + OUT_BATCH_F(ctx->Color.BlendColorUnclamped[3]); CACHED_BATCH(); } diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index 6ae75d22c14..63ae13191f9 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -132,6 +132,9 @@ static void brw_upload_vs_prog(struct brw_context *brw) ctx->Polygon.BackMode != GL_FILL); key.two_side_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide); + /* _NEW_LIGHT | _NEW_BUFFERS */ + key.clamp_vertex_color = ctx->Light._ClampVertexColor; + /* _NEW_POINT */ if (ctx->Point.PointSprite) { for (i = 0; i < 8; i++) { @@ -158,7 +161,8 @@ static void brw_upload_vs_prog(struct brw_context *brw) */ const struct brw_tracked_state brw_vs_prog = { .dirty = { - .mesa = _NEW_TRANSFORM | _NEW_POLYGON | _NEW_POINT | _NEW_LIGHT, + .mesa = (_NEW_TRANSFORM | _NEW_POLYGON | _NEW_POINT | _NEW_LIGHT | + _NEW_BUFFERS), .brw = BRW_NEW_VERTEX_PROGRAM, .cache = 0 }, diff --git a/src/mesa/drivers/dri/i965/brw_vs.h b/src/mesa/drivers/dri/i965/brw_vs.h index 0b88cc1ec76..7ca84a54b01 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.h +++ b/src/mesa/drivers/dri/i965/brw_vs.h @@ -45,6 +45,7 @@ struct brw_vs_prog_key { GLuint copy_edgeflag:1; GLuint point_coord_replace:8; GLuint two_side_color: 1; + GLuint clamp_vertex_color:1; }; diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 96150ecc377..dd4e1e6c6ad 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -2221,7 +2221,8 @@ void brw_vs_emit(struct brw_vs_compile *c ) * instructions. Instead, we directly modify the header * of the last (already stored) instruction. */ - if (inst->DstReg.File == PROGRAM_OUTPUT) { + if (inst->DstReg.File == PROGRAM_OUTPUT && + c->key.clamp_vertex_color) { if ((inst->DstReg.Index == VERT_RESULT_COL0) || (inst->DstReg.Index == VERT_RESULT_COL1) || (inst->DstReg.Index == VERT_RESULT_BFC0) diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index ab731a807a7..65af227d831 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -363,6 +363,9 @@ static void brw_wm_populate_key( struct brw_context *brw, /* _NEW_HINT */ key->linear_color = (ctx->Hint.PerspectiveCorrection == GL_FASTEST); + /* _NEW_FRAG_CLAMP | _NEW_BUFFERS */ + key->clamp_fragment_color = ctx->Color._ClampFragmentColor; + /* _NEW_TEXTURE */ for (i = 0; i < BRW_MAX_TEX_UNIT; i++) { const struct gl_texture_unit *unit = &ctx->Texture.Unit[i]; @@ -486,6 +489,7 @@ const struct brw_tracked_state brw_wm_prog = { _NEW_POLYGON | _NEW_LINE | _NEW_LIGHT | + _NEW_FRAG_CLAMP | _NEW_BUFFERS | _NEW_TEXTURE), .brw = (BRW_NEW_FRAGMENT_PROGRAM | diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index c40d7bfae0a..40659f26025 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -65,6 +65,7 @@ struct brw_wm_prog_key { GLuint nr_color_regions:5; GLuint render_to_fbo:1; GLuint alpha_test:1; + GLuint clamp_fragment_color:1; GLbitfield proj_attrib_mask; /**< one bit per fragment program attribute */ GLuint shadowtex_mask:16; diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index ecfd21d4399..cdc1f367e5c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1408,6 +1408,9 @@ void emit_fb_write(struct brw_wm_compile *c, */ brw_push_insn_state(p); + if (c->key.clamp_fragment_color) + brw_set_saturate(p, 1); + for (channel = 0; channel < 4; channel++) { if (intel->gen >= 6) { /* gen6 SIMD16 single source DP write looks like: @@ -1459,6 +1462,9 @@ void emit_fb_write(struct brw_wm_compile *c, } } } + + brw_set_saturate(p, 0); + /* skip over the regs populated above: */ if (c->dispatch_width == 16) diff --git a/src/mesa/drivers/dri/i965/gen6_cc.c b/src/mesa/drivers/dri/i965/gen6_cc.c index d1648a102d4..1b935fb5e70 100644 --- a/src/mesa/drivers/dri/i965/gen6_cc.c +++ b/src/mesa/drivers/dri/i965/gen6_cc.c @@ -210,10 +210,10 @@ color_calc_state_populate_key(struct brw_context *brw, if (ctx->Color.AlphaEnabled) key->alpha_ref = ctx->Color.AlphaRef; - key->blend_constant_color[0] = ctx->Color.BlendColor[0]; - key->blend_constant_color[1] = ctx->Color.BlendColor[1]; - key->blend_constant_color[2] = ctx->Color.BlendColor[2]; - key->blend_constant_color[3] = ctx->Color.BlendColor[3]; + key->blend_constant_color[0] = ctx->Color.BlendColorUnclamped[0]; + key->blend_constant_color[1] = ctx->Color.BlendColorUnclamped[1]; + key->blend_constant_color[2] = ctx->Color.BlendColorUnclamped[2]; + key->blend_constant_color[3] = ctx->Color.BlendColorUnclamped[3]; } /** diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index ad37a985cc4..e107534a4da 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -160,6 +160,7 @@ static const struct dri_extension i915_extensions[] = { /** i965-only extensions */ static const struct dri_extension brw_extensions[] = { + { "GL_ARB_color_buffer_float", NULL }, { "GL_ARB_depth_clamp", NULL }, { "GL_ARB_depth_texture", NULL }, { "GL_ARB_fragment_coord_conventions", NULL }, |