intel: Add support for ARB_color_buffer_float.

Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Eric Anholt 2011-04-15 14:40:09 -07:00
parent 99fa449bb9
commit d22e2ebe35
9 changed files with 28 additions and 10 deletions

View file

@ -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();
}

View file

@ -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
},

View file

@ -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;
};

View file

@ -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)

View file

@ -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 |

View file

@ -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;

View file

@ -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)

View file

@ -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];
}
/**

View file

@ -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 },