X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fi965%2Fgen8_sf_state.c;h=0c4f1df6a8d271ec0b08fc6aa61aac0ef27240b0;hb=ac08bc8ac220f22333536a9f881fde1e5607148e;hp=0a15d9c2984ff3565b4d21ae5e654d22ffcc4d33;hpb=48157b904a9a7a1b9a574945b43e201822402ce0;p=mesa.git diff --git a/src/mesa/drivers/dri/i965/gen8_sf_state.c b/src/mesa/drivers/dri/i965/gen8_sf_state.c index 0a15d9c2984..0c4f1df6a8d 100644 --- a/src/mesa/drivers/dri/i965/gen8_sf_state.c +++ b/src/mesa/drivers/dri/i965/gen8_sf_state.c @@ -33,12 +33,12 @@ static void upload_sbe(struct brw_context *brw) { struct gl_context *ctx = &brw->ctx; - /* CACHE_NEW_WM_PROG */ + /* BRW_NEW_FS_PROG_DATA */ uint32_t num_outputs = brw->wm.prog_data->num_varying_inputs; uint16_t attr_overrides[VARYING_SLOT_MAX]; uint32_t urb_entry_read_length; + uint32_t urb_entry_read_offset; uint32_t point_sprite_enables; - uint32_t flat_enables; int sbe_cmd_length; uint32_t dw1 = @@ -61,12 +61,12 @@ upload_sbe(struct brw_context *brw) dw1 |= GEN6_SF_POINT_SPRITE_UPPERLEFT; /* BRW_NEW_VUE_MAP_GEOM_OUT | BRW_NEW_FRAGMENT_PROGRAM | - * _NEW_POINT | _NEW_LIGHT | _NEW_PROGRAM | CACHE_NEW_WM_PROG + * _NEW_POINT | _NEW_LIGHT | _NEW_PROGRAM | BRW_NEW_FS_PROG_DATA */ calculate_attr_overrides(brw, attr_overrides, &point_sprite_enables, - &flat_enables, - &urb_entry_read_length); + &urb_entry_read_length, + &urb_entry_read_offset); /* Typically, the URB entry read length and offset should be programmed in * 3DSTATE_VS and 3DSTATE_GS; SBE inherits it from the last active stage @@ -78,7 +78,7 @@ upload_sbe(struct brw_context *brw) */ dw1 |= urb_entry_read_length << GEN7_SBE_URB_ENTRY_READ_LENGTH_SHIFT | - BRW_SF_URB_ENTRY_READ_OFFSET << GEN8_SBE_URB_ENTRY_READ_OFFSET_SHIFT | + urb_entry_read_offset << GEN8_SBE_URB_ENTRY_READ_OFFSET_SHIFT | GEN8_SBE_FORCE_URB_ENTRY_READ_LENGTH | GEN8_SBE_FORCE_URB_ENTRY_READ_OFFSET; @@ -93,10 +93,12 @@ upload_sbe(struct brw_context *brw) if (!(brw->fragment_program->Base.InputsRead & BITFIELD64_BIT(attr))) continue; + assert(input_index < 32); + if (input_index < 16) dw4 |= (GEN9_SBE_ACTIVE_COMPONENT_XYZW << (input_index << 1)); else - dw5 |= (GEN9_SBE_ACTIVE_COMPONENT_XYZW << (input_index << 1)); + dw5 |= (GEN9_SBE_ACTIVE_COMPONENT_XYZW << ((input_index - 16) << 1)); ++input_index; } @@ -105,7 +107,7 @@ upload_sbe(struct brw_context *brw) OUT_BATCH(_3DSTATE_SBE << 16 | (sbe_cmd_length - 2)); OUT_BATCH(dw1); OUT_BATCH(point_sprite_enables); - OUT_BATCH(flat_enables); + OUT_BATCH(brw->wm.prog_data->flat_inputs); if (sbe_cmd_length >= 6) { OUT_BATCH(dw4); OUT_BATCH(dw5); @@ -127,11 +129,15 @@ upload_sbe(struct brw_context *brw) const struct brw_tracked_state gen8_sbe_state = { .dirty = { - .mesa = _NEW_BUFFERS | _NEW_LIGHT | _NEW_POINT | _NEW_PROGRAM, - .brw = BRW_NEW_CONTEXT | + .mesa = _NEW_BUFFERS | + _NEW_LIGHT | + _NEW_POINT | + _NEW_PROGRAM, + .brw = BRW_NEW_BLORP | + BRW_NEW_CONTEXT | BRW_NEW_FRAGMENT_PROGRAM | + BRW_NEW_FS_PROG_DATA | BRW_NEW_VUE_MAP_GEOM_OUT, - .cache = CACHE_NEW_WM_PROG, }, .emit = upload_sbe, }; @@ -149,27 +155,29 @@ upload_sf(struct brw_context *brw) dw1 |= GEN6_SF_VIEWPORT_TRANSFORM_ENABLE; /* _NEW_LINE */ - uint32_t line_width_u3_7 = U_FIXED(CLAMP(ctx->Line.Width, 0.0, 7.99), 7); - if (line_width_u3_7 == 0) - line_width_u3_7 = 1; - dw2 |= line_width_u3_7 << GEN6_SF_LINE_WIDTH_SHIFT; + uint32_t line_width_u3_7 = brw_get_line_width(brw); + if (brw->gen >= 9 || brw->is_cherryview) { + dw1 |= line_width_u3_7 << GEN9_SF_LINE_WIDTH_SHIFT; + } else { + dw2 |= line_width_u3_7 << GEN6_SF_LINE_WIDTH_SHIFT; + } if (ctx->Line.SmoothFlag) { dw2 |= GEN6_SF_LINE_END_CAP_WIDTH_1_0; } - /* Clamp to ARB_point_parameters user limits */ + /* _NEW_POINT - Clamp to ARB_point_parameters user limits */ point_size = CLAMP(ctx->Point.Size, ctx->Point.MinSize, ctx->Point.MaxSize); /* Clamp to the hardware limits and convert to fixed point */ - dw3 |= U_FIXED(CLAMP(point_size, 0.125, 255.875), 3); + dw3 |= U_FIXED(CLAMP(point_size, 0.125f, 255.875f), 3); - /* _NEW_PROGRAM | _NEW_POINT */ - if (!(ctx->VertexProgram.PointSizeEnabled || ctx->Point._Attenuated)) + /* _NEW_PROGRAM | _NEW_POINT, BRW_NEW_VUE_MAP_GEOM_OUT */ + if (use_state_point_size(brw)) dw3 |= GEN6_SF_USE_STATE_POINT_WIDTH; /* _NEW_POINT | _NEW_MULTISAMPLE */ - if ((ctx->Point.SmoothFlag || ctx->Multisample._Enabled) && + if ((ctx->Point.SmoothFlag || _mesa_is_multisample_enabled(ctx)) && !ctx->Point.PointSprite) { dw3 |= GEN8_SF_SMOOTH_POINT_ENABLE; } @@ -200,8 +208,9 @@ const struct brw_tracked_state gen8_sf_state = { _NEW_LINE | _NEW_MULTISAMPLE | _NEW_POINT, - .brw = BRW_NEW_CONTEXT, - .cache = 0, + .brw = BRW_NEW_BLORP | + BRW_NEW_CONTEXT | + BRW_NEW_VUE_MAP_GEOM_OUT, }, .emit = upload_sf, }; @@ -216,7 +225,7 @@ upload_raster(struct brw_context *brw) bool render_to_fbo = _mesa_is_user_fbo(brw->ctx.DrawBuffer); /* _NEW_POLYGON */ - if ((ctx->Polygon.FrontFace == GL_CCW) ^ render_to_fbo) + if (ctx->Polygon._FrontBit == render_to_fbo) dw1 |= GEN8_RASTER_FRONT_WINDING_CCW; if (ctx->Polygon.CullFlag) { @@ -241,7 +250,7 @@ upload_raster(struct brw_context *brw) if (ctx->Point.SmoothFlag) dw1 |= GEN8_RASTER_SMOOTH_POINT_ENABLE; - if (ctx->Multisample._Enabled) + if (_mesa_is_multisample_enabled(ctx)) dw1 |= GEN8_RASTER_API_MULTISAMPLE_ENABLE; if (ctx->Polygon.OffsetFill) @@ -291,15 +300,21 @@ upload_raster(struct brw_context *brw) dw1 |= GEN8_RASTER_SCISSOR_ENABLE; /* _NEW_TRANSFORM */ - if (!ctx->Transform.DepthClamp) - dw1 |= GEN8_RASTER_VIEWPORT_Z_CLIP_TEST_ENABLE; + if (!ctx->Transform.DepthClamp) { + if (brw->gen >= 9) { + dw1 |= GEN9_RASTER_VIEWPORT_Z_NEAR_CLIP_TEST_ENABLE | + GEN9_RASTER_VIEWPORT_Z_FAR_CLIP_TEST_ENABLE; + } else { + dw1 |= GEN8_RASTER_VIEWPORT_Z_CLIP_TEST_ENABLE; + } + } BEGIN_BATCH(5); OUT_BATCH(_3DSTATE_RASTER << 16 | (5 - 2)); OUT_BATCH(dw1); OUT_BATCH_F(ctx->Polygon.OffsetUnits * 2); /* constant. copied from gen4 */ OUT_BATCH_F(ctx->Polygon.OffsetFactor); /* scale */ - OUT_BATCH_F(0.0); + OUT_BATCH_F(ctx->Polygon.OffsetClamp); /* global depth offset clamp */ ADVANCE_BATCH(); } @@ -312,8 +327,8 @@ const struct brw_tracked_state gen8_raster_state = { _NEW_POLYGON | _NEW_SCISSOR | _NEW_TRANSFORM, - .brw = BRW_NEW_CONTEXT, - .cache = 0, + .brw = BRW_NEW_BLORP | + BRW_NEW_CONTEXT, }, .emit = upload_raster, };