Lines Matching defs:state

30  * This is the main state upload code.
32 * Gallium uses Constant State Objects, or CSOs, for most state. Large,
33 * complex, or highly reusable state can be created once, and bound and
35 * and pipe->bind_*_state() hooks. Highly dynamic or inexpensive state is
38 * OpenGL involves frequently mutating context state, which is mirrored in
42 * than inventing new state all the time, applications usually mutate to swap
45 * Gallium isolates us from this mutation by tracking API state, and
47 * complex, or typically reusable state can be created once, then reused
52 * Some state is cheap to create, or expected to be highly dynamic. Rather
56 * To reduce draw time overhead, we try to compute as much state at create
57 * time as possible. Wherever possible, we translate the Gallium pipe state
68 * create/bind/track state. The second are the draw-time upload functions,
70 * the context state and emit the commands into the actual batch.
333 uint32_t offset = ALIGN(batch->state.used, alignment);
337 offset = ALIGN(batch->state.used, alignment);
338 } else if (offset + size >= batch->state.bo->size) {
340 MIN2(batch->state.bo->size + batch->state.bo->size / 2,
342 crocus_grow_buffer(batch, true, batch->state.used, new_size);
343 assert(offset + size < batch->state.bo->size);
348 batch->state.used = offset + size;
351 return (uint32_t *)batch->state.map + (offset >> 2);
383 pp.PointertoVSState = ro_bo(batch->state.bo, vs_offset);
386 pp.PointertoGSState = ro_bo(batch->state.bo, gs_offset);
388 pp.PointertoCLIPState = ro_bo(batch->state.bo, clip_offset);
389 pp.PointertoSFState = ro_bo(batch->state.bo, sf_offset);
390 pp.PointertoWMState = ro_bo(batch->state.bo, wm_offset);
391 pp.PointertoColorCalcState = ro_bo(batch->state.bo, cc_offset);
412 * necessary prior to changing the surface state base adress. We've
414 * command buffers which clear depth, reset state base address, and then
443 /* After re-setting the surface state base address, we have to do some
448 * Coherency with system memory in the state cache, like the texture
457 * Surface_State_Base_Addr are altered, the L1 state cache must be
458 * invalidated to ensure the new surface or sampler state is fetched
466 * This bit controls the invalidation of the L1 and L2 state caches
469 * Unfortunately, experimentation seems to indicate that state cache
471 * regards to surface state and binding tables. In stead, it seems that
649 * Gallium CSO for rasterizer state.
843 if (ice->state.cso_rast->cso.clip_plane_enable) {
844 unsigned nr_planes = 6 + util_bitcount(ice->state.cso_rast->cso.clip_plane_enable);
935 cmap = pipe_buffer_map_range(&ice->ctx, ice->state.shaders[stage].constbufs[block_index].buffer,
936 ice->state.shaders[stage].constbufs[block_index].buffer_offset + start, len,
996 unsigned mask = ice->state.cso_rast->cso.clip_plane_enable;
997 struct pipe_clip_state *cp = &ice->state.clip_planes;
1033 * 1. Change state so that all depth related fields in CC_STATE are
1038 * The recommended workaround is to emit a non-pipelined state change after
1050 ice->state.global_depth_offset_clamp = 0;
1359 * Upload the initial GPU state for a render context.
1361 * This sets some invariant state that needs to be programmed a particular
1427 * Generation-specific context state (ice->state.genx->...).
1429 * Most state can go in crocus_context directly, but these encode hardware
1451 const struct pipe_blend_color *state)
1456 memcpy(&ice->state.blend_color, state, sizeof(struct pipe_blend_color));
1458 ice->state.dirty |= CROCUS_DIRTY_GEN4_CONSTANT_COLOR;
1460 ice->state.dirty |= CROCUS_DIRTY_COLOR_CALC_STATE;
1465 * Gallium CSO for blend state (see pipe_blend_state).
1511 for (unsigned i = 0; i < ice->state.framebuffer.nr_cbufs; i++) {
1512 if (ice->state.framebuffer.cbufs[i]) {
1513 pformat = ice->state.framebuffer.cbufs[i]->format;
1591 const struct pipe_blend_state *state)
1599 cso->cso = *state;
1600 cso->dual_color_blending = util_blend_state_is_dual(state, 0);
1607 &state->rt[state->independent_blend_enable ? i : 0];
1614 fix_blendfactor(rt->rgb_src_factor, state->alpha_to_one);
1616 fix_blendfactor(rt->alpha_src_factor, state->alpha_to_one);
1618 fix_blendfactor(rt->rgb_dst_factor, state->alpha_to_one);
1620 fix_blendfactor(rt->alpha_dst_factor, state->alpha_to_one);
1637 pb.AlphaToCoverageEnable = state->alpha_to_coverage;
1642 (int) fix_blendfactor(state->rt[0].rgb_src_factor, state->alpha_to_one);
1644 (int) fix_blendfactor(state->rt[0].alpha_src_factor, state->alpha_to_one);
1646 (int) fix_blendfactor(state->rt[0].rgb_dst_factor, state->alpha_to_one);
1648 (int) fix_blendfactor(state->rt[0].alpha_dst_factor, state->alpha_to_one);
1660 crocus_bind_blend_state(struct pipe_context *ctx, void *state)
1663 struct crocus_blend_state *cso = state;
1665 ice->state.cso_blend = cso;
1666 ice->state.blend_enables = cso ? cso->blend_enables : 0;
1668 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_BINDINGS_FS;
1669 ice->state.dirty |= CROCUS_DIRTY_WM;
1671 ice->state.dirty |= CROCUS_DIRTY_GEN6_BLEND_STATE;
1674 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_FS;
1677 ice->state.dirty |= CROCUS_DIRTY_GEN8_PMA_FIX;
1678 ice->state.dirty |= CROCUS_DIRTY_GEN8_PS_BLEND;
1680 ice->state.dirty |= CROCUS_DIRTY_COLOR_CALC_STATE;
1681 ice->state.dirty |= CROCUS_DIRTY_RENDER_RESOLVES_AND_FLUSHES;
1682 ice->state.stage_dirty |= ice->state.stage_dirty_for_nos[CROCUS_NOS_BLEND];
1705 * Gallium CSO for depth, stencil, and alpha testing state.
1718 * testing state since we need pieces of it in a variety of places.
1722 const struct pipe_depth_stencil_alpha_state *state)
1727 bool two_sided_stencil = state->stencil[1].enabled;
1728 cso->cso = *state;
1730 cso->depth_writes_enabled = state->depth_writemask;
1732 state->stencil[0].writemask != 0 ||
1733 (two_sided_stencil && state->stencil[1].writemask != 0);
1735 /* The state tracker needs to optimize away EQUAL writes for us. */
1736 assert(!(state->depth_func == PIPE_FUNC_EQUAL && state->depth_writemask));
1747 crocus_bind_zsa_state(struct pipe_context *ctx, void *state)
1750 struct crocus_depth_stencil_alpha_state *old_cso = ice->state.cso_zsa;
1751 struct crocus_depth_stencil_alpha_state *new_cso = state;
1755 ice->state.dirty |= CROCUS_DIRTY_COLOR_CALC_STATE;
1758 ice->state.dirty |= CROCUS_DIRTY_WM;
1761 ice->state.dirty |= CROCUS_DIRTY_GEN6_BLEND_STATE;
1764 ice->state.dirty |= CROCUS_DIRTY_GEN6_BLEND_STATE;
1768 ice->state.dirty |= CROCUS_DIRTY_GEN8_PS_BLEND;
1772 ice->state.dirty |= CROCUS_DIRTY_RENDER_RESOLVES_AND_FLUSHES;
1774 ice->state.depth_writes_enabled = new_cso->depth_writes_enabled;
1775 ice->state.stencil_writes_enabled = new_cso->stencil_writes_enabled;
1778 ice->state.dirty |= CROCUS_DIRTY_COLOR_CALC_STATE;
1782 ice->state.cso_zsa = new_cso;
1783 ice->state.dirty |= CROCUS_DIRTY_CC_VIEWPORT;
1785 ice->state.dirty |= CROCUS_DIRTY_GEN6_WM_DEPTH_STENCIL;
1788 ice->state.dirty |= CROCUS_DIRTY_GEN8_PMA_FIX;
1790 ice->state.stage_dirty |= ice->state.stage_dirty_for_nos[CROCUS_NOS_DEPTH_STENCIL_ALPHA];
1801 const struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
1802 const struct crocus_depth_stencil_alpha_state *cso_zsa = ice->state.cso_zsa;
1803 const struct crocus_blend_state *cso_blend = ice->state.cso_blend;
1805 /* In very specific combinations of state, we can instruct Gfx8-9 hardware
1806 * to avoid stalling at the pixel mask array. The state equations are
1922 struct crocus_genx_state *genx = ice->state.genx;
1964 get_line_width(const struct pipe_rasterizer_state *state)
1966 float line_width = state->line_width;
1974 if (!state->multisample && !state->line_smooth)
1975 line_width = roundf(state->line_width);
1977 if (!state->multisample && state->line_smooth && line_width < 1.5f) {
1998 const struct pipe_rasterizer_state *state)
2004 state->fill_front == PIPE_POLYGON_MODE_LINE ||
2005 state->fill_front == PIPE_POLYGON_MODE_POINT ||
2006 state->fill_back == PIPE_POLYGON_MODE_LINE ||
2007 state->fill_back == PIPE_POLYGON_MODE_POINT;
2009 if (state->clip_plane_enable != 0)
2010 cso->num_clip_plane_consts = util_logbase2(state->clip_plane_enable) + 1;
2014 cso->cso = *state;
2017 float line_width = get_line_width(state);
2023 state->line_smooth ? _10pixels : _05pixels;
2024 sf.LastPixelEnable = state->line_last_pixel;
2026 sf.AntialiasingEnable = state->line_smooth;
2037 sf.PointWidthSource = state->point_size_per_vertex ? Vertex : State;
2038 sf.PointWidth = state->point_size;
2040 if (state->flatshade_first) {
2050 if (state->sprite_coord_mode == PIPE_SPRITE_COORD_LOWER_LEFT)
2057 sf.FrontWinding = state->front_ccw ? 1 : 0; // Or the other way...
2060 sf.GlobalDepthOffsetEnableSolid = state->offset_tri;
2061 sf.GlobalDepthOffsetEnableWireframe = state->offset_line;
2062 sf.GlobalDepthOffsetEnablePoint = state->offset_point;
2063 sf.GlobalDepthOffsetConstant = state->offset_units * 2;
2064 sf.GlobalDepthOffsetScale = state->offset_scale;
2065 sf.GlobalDepthOffsetClamp = state->offset_clamp;
2067 sf.FrontFaceFillMode = translate_fill_mode(state->fill_front);
2068 sf.BackFaceFillMode = translate_fill_mode(state->fill_back);
2071 sf.CullMode = translate_cull_mode(state->cull_face);
2075 sf.LineStippleEnable = state->line_stipple_enable;
2083 rr.FrontWinding = state->front_ccw ? CounterClockwise : Clockwise;
2084 rr.CullMode = translate_cull_mode(state->cull_face);
2085 rr.FrontFaceFillMode = translate_fill_mode(state->fill_front);
2086 rr.BackFaceFillMode = translate_fill_mode(state->fill_back);
2087 rr.DXMultisampleRasterizationEnable = state->multisample;
2088 rr.GlobalDepthOffsetEnableSolid = state->offset_tri;
2089 rr.GlobalDepthOffsetEnableWireframe = state->offset_line;
2090 rr.GlobalDepthOffsetEnablePoint = state->offset_point;
2091 rr.GlobalDepthOffsetConstant = state->offset_units * 2;
2092 rr.GlobalDepthOffsetScale = state->offset_scale;
2093 rr.GlobalDepthOffsetClamp = state->offset_clamp;
2094 rr.SmoothPointEnable = state->point_smooth;
2095 rr.AntialiasingEnable = state->line_smooth;
2096 rr.ScissorRectangleEnable = state->scissor;
2097 rr.ViewportZClipTestEnable = (state->depth_clip_near || state->depth_clip_far);
2111 cl.FrontWinding = state->front_ccw ? 1 : 0;
2112 cl.CullMode = translate_cull_mode(state->cull_face);
2114 cl.UserClipDistanceClipTestEnableBitmask = state->clip_plane_enable;
2116 cl.ViewportZClipTestEnable = (state->depth_clip_near || state->depth_clip_far);
2118 cl.APIMode = state->clip_halfz ? APIMODE_D3D : APIMODE_OGL;
2128 if (state->flatshade_first) {
2139 const unsigned line_stipple_factor = state->line_stipple_factor + 1;
2142 if (state->line_stipple_enable) {
2143 line.LineStipplePattern = state->line_stipple_pattern;
2158 crocus_bind_rasterizer_state(struct pipe_context *ctx, void *state)
2161 struct crocus_rasterizer_state *old_cso = ice->state.cso_rast;
2162 struct crocus_rasterizer_state *new_cso = state;
2167 ice->state.dirty |= CROCUS_DIRTY_LINE_STIPPLE;
2170 ice->state.dirty |= CROCUS_DIRTY_GEN6_MULTISAMPLE;
2172 ice->state.dirty |= CROCUS_DIRTY_GEN6_SCISSOR_RECT;
2174 ice->state.dirty |= CROCUS_DIRTY_WM;
2177 ice->state.dirty |= CROCUS_DIRTY_SF_CL_VIEWPORT;
2181 ice->state.dirty |= CROCUS_DIRTY_WM;
2185 ice->state.dirty |= CROCUS_DIRTY_STREAMOUT | CROCUS_DIRTY_CLIP;
2188 ice->state.dirty |= CROCUS_DIRTY_STREAMOUT;
2193 ice->state.dirty |= CROCUS_DIRTY_CC_VIEWPORT;
2199 ice->state.dirty |= CROCUS_DIRTY_GEN7_SBE;
2203 ice->state.dirty |= CROCUS_DIRTY_GEN4_CURBE;
2207 ice->state.cso_rast = new_cso;
2208 ice->state.dirty |= CROCUS_DIRTY_RASTER;
2209 ice->state.dirty |= CROCUS_DIRTY_CLIP;
2211 ice->state.dirty |= CROCUS_DIRTY_GEN4_CLIP_PROG | CROCUS_DIRTY_GEN4_SF_PROG;
2212 ice->state.dirty |= CROCUS_DIRTY_WM;
2215 ice->state.dirty |= CROCUS_DIRTY_GEN4_FF_GS_PROG;
2217 ice->state.stage_dirty |= ice->state.stage_dirty_for_nos[CROCUS_NOS_RASTERIZER];
2236 * Gallium CSO for sampler state.
2259 const struct pipe_sampler_state *state)
2269 bool either_nearest = state->min_img_filter == PIPE_TEX_FILTER_NEAREST ||
2270 state->mag_img_filter == PIPE_TEX_FILTER_NEAREST;
2271 cso->wrap_s = translate_wrap(state->wrap_s, either_nearest);
2272 cso->wrap_t = translate_wrap(state->wrap_t, either_nearest);
2273 cso->wrap_r = translate_wrap(state->wrap_r, either_nearest);
2275 cso->pstate = *state;
2277 memcpy(&cso->border_color, &state->border_color, sizeof(cso->border_color));
2283 cso->min_lod = state->min_lod;
2284 cso->mag_img_filter = state->mag_img_filter;
2287 if (state->min_mip_filter == PIPE_TEX_MIPFILTER_NONE &&
2288 state->min_lod > 0.0f) {
2290 cso->mag_img_filter = state->min_img_filter;
2307 struct crocus_shader_state *shs = &ice->state.shaders[stage];
2323 ice->state.dirty |= CROCUS_DIRTY_WM;
2325 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_VS;
2327 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_SAMPLER_STATES_VS << stage;
2328 ice->state.stage_dirty |= ice->state.stage_dirty_for_nos[CROCUS_NOS_TEXTURES];
2347 struct pipe_sampler_state *state = &cso->pstate;
2378 samp.NonnormalizedCoordinateEnable = !state->normalized_coords;
2380 samp.MinModeFilter = state->min_img_filter;
2382 samp.MipModeFilter = translate_mip_filter(state->min_mip_filter);
2385 if (state->max_anisotropy >= 2) {
2386 if (state->min_img_filter == PIPE_TEX_FILTER_LINEAR) {
2393 if (state->mag_img_filter == PIPE_TEX_FILTER_LINEAR)
2397 MIN2((state->max_anisotropy - 2) / 2, RATIO161);
2401 if (state->min_img_filter != PIPE_TEX_FILTER_NEAREST) {
2407 if (state->mag_img_filter != PIPE_TEX_FILTER_NEAREST) {
2413 if (state->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE)
2414 samp.ShadowFunction = translate_shadow_func(state->compare_func);
2424 samp.MaxLOD = CLAMP(state->max_lod, 0, hw_max_lod);
2425 samp.TextureLODBias = CLAMP(state->lod_bias, -16, 15);
2434 ro_bo(batch->state.bo, border_color_offset);
2481 struct GENX(SAMPLER_BORDER_COLOR_STATE) state = { 0 };
2499 macro(state.BorderColor ## _color_type ## Red, src[0]); \
2500 macro(state.BorderColor ## _color_type ## Green, src[1]); \
2501 macro(state.BorderColor ## _color_type ## Blue, src[2]); \
2502 macro(state.BorderColor ## _color_type ## Alpha, src[3]);
2543 state.BorderColor32bitRed = c[0];
2544 state.BorderColor32bitBlue = c[1];
2545 state.BorderColor32bitAlpha = 1;
2570 state.BorderColorSnorm8Red = state.BorderColorSnorm16Red >> 8;
2571 state.BorderColorSnorm8Green = state.BorderColorSnorm16Green >> 8;
2572 state.BorderColorSnorm8Blue = state.BorderColorSnorm16Blue >> 8;
2573 state.BorderColorSnorm8Alpha = state.BorderColorSnorm16Alpha >> 8;
2586 GENX(SAMPLER_BORDER_COLOR_STATE_pack)(batch, sbc, &state);
2593 * Also fill out the border color state pointers.
2599 struct crocus_shader_state *shs = &ice->state.shaders[stage];
2602 /* We assume the state tracker will call pipe->bind_sampler_states()
2611 * in the dynamic state memory zone, so we can point to it via the
2621 struct crocus_sampler_state *state = shs->samplers[i];
2624 if (!state || !tex) {
2628 if (state->needs_border_color) {
2629 crocus_upload_border_color(batch, state, tex, &border_color_offset);
2648 if (state->pstate.seamless_cube_map &&
2659 crocus_upload_sampler_state(batch, state, border_color_offset, wa, first_level, map);
2817 struct pipe_sampler_view *state)
2819 struct crocus_sampler_view *isv = (void *) state;
2820 pipe_resource_reference(&state->texture, NULL);
2976 * Return NULL to force the state tracker to take fallback paths.
3060 struct crocus_shader_state *shs = &ice->state.shaders[stage];
3061 struct crocus_genx_state *genx = ice->state.genx;
3131 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_BINDINGS_VS << stage;
3132 ice->state.dirty |=
3137 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CONSTANTS_VS << stage;
3156 struct crocus_shader_state *shs = &ice->state.shaders[stage];
3182 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_SAMPLER_STATES_VS << stage;
3184 ice->state.stage_dirty |= (CROCUS_STAGE_DIRTY_BINDINGS_VS << stage);
3185 ice->state.dirty |=
3188 ice->state.stage_dirty |= ice->state.stage_dirty_for_nos[CROCUS_NOS_TEXTURES];
3200 struct crocus_shader_state *shs = &ice->state.shaders[MESA_SHADER_TESS_CTRL];
3202 memcpy(&ice->state.default_outer_level[0], &default_outer_level[0], 4 * sizeof(float));
3203 memcpy(&ice->state.default_inner_level[0], &default_inner_level[0], 2 * sizeof(float));
3205 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CONSTANTS_TCS;
3214 ice->state.patch_vertices = patch_vertices;
3229 const struct pipe_clip_state *state)
3232 struct crocus_shader_state *shs = &ice->state.shaders[MESA_SHADER_VERTEX];
3233 struct crocus_shader_state *gshs = &ice->state.shaders[MESA_SHADER_GEOMETRY];
3234 struct crocus_shader_state *tshs = &ice->state.shaders[MESA_SHADER_TESS_EVAL];
3236 memcpy(&ice->state.clip_planes, state, sizeof(*state));
3239 ice->state.dirty |= CROCUS_DIRTY_GEN4_CURBE;
3241 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CONSTANTS_VS | CROCUS_STAGE_DIRTY_CONSTANTS_GS |
3253 const struct pipe_poly_stipple *state)
3256 memcpy(&ice->state.poly_stipple, state, sizeof(*state));
3257 ice->state.dirty |= CROCUS_DIRTY_POLYGON_STIPPLE;
3271 ice->state.sample_mask = sample_mask & 0xff;
3272 ice->state.dirty |= CROCUS_DIRTY_GEN6_SAMPLE_MASK;
3280 struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
3281 struct pipe_rasterizer_state *cso_state = &ice->state.cso_rast->cso;
3282 const struct pipe_viewport_state *vp = &ice->state.viewports[idx];
3290 struct pipe_scissor_state *s = &ice->state.scissors[idx];
3302 * This corresponds to our SCISSOR_RECT state structures. It's an
3321 ice->state.scissors[start_slot + i] = (struct pipe_scissor_state) {
3325 ice->state.scissors[start_slot + i] = (struct pipe_scissor_state) {
3333 ice->state.dirty |= CROCUS_DIRTY_RASTER; /* SF state */
3335 ice->state.dirty |= CROCUS_DIRTY_GEN6_SCISSOR_RECT;
3337 ice->state.dirty |= CROCUS_DIRTY_SF_CL_VIEWPORT;
3351 ice->state.stencil_ref = ref;
3352 ice->state.dirty |= CROCUS_DIRTY_COLOR_CALC_STATE;
3357 viewport_extent(const struct pipe_viewport_state *state, int axis, float sign)
3359 return copysignf(state->scale[axis], sign) + state->translate[axis];
3378 memcpy(&ice->state.viewports[start_slot], states, sizeof(*states) * count);
3380 ice->state.dirty |= CROCUS_DIRTY_SF_CL_VIEWPORT;
3381 ice->state.dirty |= CROCUS_DIRTY_RASTER;
3383 ice->state.dirty |= CROCUS_DIRTY_GEN6_SCISSOR_RECT;
3386 if (ice->state.cso_rast && (!ice->state.cso_rast->cso.depth_clip_near ||
3387 !ice->state.cso_rast->cso.depth_clip_far))
3388 ice->state.dirty |= CROCUS_DIRTY_CC_VIEWPORT;
3399 const struct pipe_framebuffer_state *state)
3402 struct pipe_framebuffer_state *cso = &ice->state.framebuffer;
3411 unsigned samples = util_framebuffer_get_num_samples(state);
3412 unsigned layers = util_framebuffer_get_num_layers(state);
3416 ice->state.dirty |= CROCUS_DIRTY_GEN6_MULTISAMPLE;
3417 ice->state.dirty |= CROCUS_DIRTY_GEN6_SAMPLE_MASK;
3418 ice->state.dirty |= CROCUS_DIRTY_RASTER;
3420 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_FS;
3426 ice->state.dirty |= CROCUS_DIRTY_GEN6_BLEND_STATE;
3430 ice->state.dirty |= CROCUS_DIRTY_CLIP;
3433 if (cso->width != state->width || cso->height != state->height) {
3434 ice->state.dirty |= CROCUS_DIRTY_SF_CL_VIEWPORT;
3435 ice->state.dirty |= CROCUS_DIRTY_RASTER;
3436 ice->state.dirty |= CROCUS_DIRTY_DRAWING_RECTANGLE;
3438 ice->state.dirty |= CROCUS_DIRTY_GEN6_SCISSOR_RECT;
3442 if (cso->zsbuf || state->zsbuf) {
3443 ice->state.dirty |= CROCUS_DIRTY_DEPTH_BUFFER;
3447 ice->state.dirty |= CROCUS_DIRTY_RASTER;
3451 ice->state.dirty |= CROCUS_DIRTY_WM;
3452 util_copy_framebuffer_state(cso, state);
3465 ice->state.hiz_usage = aux_usage;
3469 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_BINDINGS_FS;
3471 ice->state.dirty |= CROCUS_DIRTY_RENDER_RESOLVES_AND_FLUSHES;
3473 ice->state.stage_dirty |= ice->state.stage_dirty_for_nos[CROCUS_NOS_FRAMEBUFFER];
3490 struct crocus_shader_state *shs = &ice->state.shaders[stage];
3524 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CONSTANTS_VS << stage;
3531 UNUSED struct crocus_genx_state *genx = ice->state.genx;
3532 struct crocus_shader_state *shs = &ice->state.shaders[stage];
3568 value = fui(ice->state.clip_planes.ucp[plane][comp]);
3571 value = ice->state.vertices_per_patch;
3579 value = ice->state.vertices_per_patch;
3584 value = fui(ice->state.default_outer_level[i]);
3586 value = fui(ice->state.default_inner_level[0]);
3588 value = fui(ice->state.default_inner_level[1]);
3592 value = ice->state.last_block[i];
3619 struct crocus_shader_state *shs = &ice->state.shaders[stage];
3648 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_BINDINGS_VS << stage;
3652 crocus_delete_state(struct pipe_context *ctx, void *state)
3654 free(state);
3673 ice->state.bound_vertex_buffers &=
3676 util_set_vertex_buffers_mask(ice->state.vertex_buffers, &ice->state.bound_vertex_buffers,
3681 struct pipe_vertex_buffer *state =
3682 &ice->state.vertex_buffers[start_slot + i];
3684 if (!state->is_user_buffer && state->buffer.resource) {
3685 struct crocus_resource *res = (void *)state->buffer.resource;
3690 if (state->buffer.resource)
3691 end = state->buffer.resource->width0 + padding;
3692 ice->state.vb_end[start_slot + i] = end;
3694 ice->state.dirty |= CROCUS_DIRTY_VERTEX_BUFFERS;
3774 const struct pipe_vertex_element *state)
3810 crocus_format_for_usage(devinfo, state[i].src_format, 0);
3840 cso->step_rate[state[i].vertex_buffer_index] = state[i].instance_divisor;
3855 ve.VertexBufferIndex = state[i].vertex_buffer_index;
3857 ve.SourceElementOffset = state[i].src_offset;
3871 vi.InstancingEnable = state[i].instance_divisor > 0;
3872 vi.InstanceDataStepRate = state[i].instance_divisor;
3887 crocus_format_for_usage(devinfo, state[edgeflag_index].src_format, 0);
3892 ve.VertexBufferIndex = state[edgeflag_index].vertex_buffer_index;
3894 ve.SourceElementOffset = state[edgeflag_index].src_offset;
3906 vi.InstancingEnable = state[edgeflag_index].instance_divisor > 0;
3907 vi.InstanceDataStepRate = state[edgeflag_index].instance_divisor;
3919 crocus_bind_vertex_elements_state(struct pipe_context *ctx, void *state)
3923 struct crocus_vertex_element_state *old_cso = ice->state.cso_vertex_elements;
3924 struct crocus_vertex_element_state *new_cso = state;
3927 ice->state.dirty |= CROCUS_DIRTY_GEN8_VF_SGVS;
3929 ice->state.cso_vertex_elements = state;
3930 ice->state.dirty |= CROCUS_DIRTY_VERTEX_ELEMENTS | CROCUS_DIRTY_VERTEX_BUFFERS;
3931 ice->state.stage_dirty |= ice->state.stage_dirty_for_nos[CROCUS_NOS_VERTEX_ELEMENTS];
4050 struct pipe_stream_output_target *state)
4052 struct crocus_stream_output_target *cso = (void *) state;
4116 *svbi = counter->accum * ice->state.last_xfb_verts_per_prim;
4136 if (ice->state.streamout_active != active) {
4137 ice->state.streamout_active = active;
4139 ice->state.dirty |= CROCUS_DIRTY_STREAMOUT;
4141 ice->state.dirty |= CROCUS_DIRTY_GEN4_FF_GS_PROG;
4151 ice->state.dirty |= CROCUS_DIRTY_SO_DECL_LIST;
4157 (void *) ice->state.so_target[i];
4170 ice->state.so_targets = num_targets;
4172 pipe_so_target_reference(&old_tgt[i], ice->state.so_target[i]);
4173 pipe_so_target_reference(&ice->state.so_target[i],
4182 (void *) ice->state.so_target[i];
4192 ice->state.svbi = 0;
4195 compute_vertices_written_so_far(ice, tgt, &tgt->count, &ice->state.svbi);
4220 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_BINDINGS_GS;
4225 (void *) ice->state.so_target[i];
4253 ice->state.dirty |= CROCUS_DIRTY_GEN7_SO_BUFFERS;
4255 ice->state.dirty |= CROCUS_DIRTY_GEN6_SVBI;
4268 * no dynamic state dependencies.
4271 * state-based settings. We capture the shader-related ones here, and merge
4408 (void *) ice->state.so_target[i];
4415 svbi.StreamedVertexBufferIndex = (uint32_t)ice->state.svbi; /* fix when resuming, based on target's prim count */
4438 const struct crocus_rasterizer_state *cso_rast = ice->state.cso_rast;
4453 return ice->state.prim_mode == PIPE_PRIM_POINTS;
4564 const struct crocus_rasterizer_state *cso_rast = ice->state.cso_rast;
4637 const struct crocus_rasterizer_state *cso_rast = ice->state.cso_rast;
4681 * Populate VS program key fields based on the current state.
4689 const struct crocus_rasterizer_state *cso_rast = ice->state.cso_rast;
4713 key->gl_attrib_wa_flags[i] = ice->state.cso_vertex_elements->wa_flags[ve_idx];
4720 * Populate TCS program key fields based on the current state.
4729 * Populate TES program key fields based on the current state.
4737 const struct crocus_rasterizer_state *cso_rast = ice->state.cso_rast;
4750 * Populate GS program key fields based on the current state.
4758 const struct crocus_rasterizer_state *cso_rast = ice->state.cso_rast;
4771 * Populate FS program key fields based on the current state.
4779 const struct pipe_framebuffer_state *fb = &ice->state.framebuffer;
4780 const struct crocus_depth_stencil_alpha_state *zsa = ice->state.cso_zsa;
4781 const struct crocus_rasterizer_state *rast = ice->state.cso_rast;
4782 const struct crocus_blend_state *blend = ice->state.cso_blend;
4806 key->stats_wm = ice->state.stats_wm;
4811 int reduced_prim = ice->state.reduced_prim_mode;
4947 if (ice->state.framebuffer.width == 0 && ice->state.framebuffer.height == 0) {
4952 struct pipe_framebuffer_state *cso = &ice->state.framebuffer;
5048 /* On gen7 and prior, the upper 20 bits of surface state DWORD 6 are the
5125 struct crocus_state_ref *grid_ref = &ice->state.grid_size;
5293 if (idx >= so_info->num_outputs || !ice->state.streamout_active)
5299 struct crocus_resource *buf = (struct crocus_resource *)ice->state.so_target[buffer]->buffer;
5301 unsigned offset_dwords = ice->state.so_target[buffer]->buffer_offset / 4 + output->dst_offset;
5303 size_t size_dwords = (ice->state.so_target[buffer]->buffer_offset + ice->state.so_target[buffer]->buffer_size) / 4;
5376 struct crocus_shader_state *shs = ff_gs ? NULL : &ice->state.shaders[stage];
5389 struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
5397 &ice->state.cso_blend->cso.rt[ice->state.cso_blend->cso.independent_blend_enable ? i : 0];
5410 ice->state.draw_aux_usage[i],
5424 struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
5428 ice->state.draw_aux_usage[i]);
5535 sba.DynamicStateBaseAddress = ro_bo(batch->state.bo, 0);
5539 sba.SurfaceStateBaseAddress = ro_bo(batch->state.bo, 0);
5568 /* Dynamic state upper bound. Although the documentation says that
5614 * changing. Having a separate state flag makes the sequence more
5618 batch->ice->state.dirty |= CROCUS_DIRTY_GEN5_PIPELINED_POINTERS | CROCUS_DIRTY_GEN5_BINDING_TABLE_POINTERS;
5620 batch->ice->state.dirty |= CROCUS_DIRTY_GEN5_BINDING_TABLE_POINTERS | CROCUS_DIRTY_GEN6_SAMPLER_STATE_POINTERS;
5653 struct crocus_shader_state *shs = &ice->state.shaders[stage];
5788 struct crocus_depth_stencil_alpha_state *cso = ice->state.cso_zsa;
5854 uint32_t num_samples = ice->state.framebuffer.samples;
5860 return ice->state.sample_mask & fb_mask;
5869 uint64_t dirty = ice->state.dirty;
5870 uint64_t stage_dirty = ice->state.stage_dirty;
5904 const struct crocus_rasterizer_state *cso_rast = ice->state.cso_rast;
5910 4 * ice->state.num_viewports *
5912 for (int i = 0; i < ice->state.num_viewports; i++) {
5914 crocus_viewport_zmin_zmax(&ice->state.viewports[i], cso_rast->cso.clip_halfz,
5915 ice->state.window_space_position,
5940 ice->state.cc_vp_address = cc_vp_address;
5946 struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
5951 4 * ice->state.num_viewports *
5956 4 * ice->state.num_viewports * GENX(SF_VIEWPORT_length),
5957 32, &ice->state.sf_vp_address);
5960 4 * ice->state.num_viewports * GENX(CLIP_VIEWPORT_length),
5961 32, &ice->state.clip_vp_address);
5964 for (unsigned i = 0; i < ice->state.num_viewports; i++) {
5965 const struct pipe_viewport_state *state = &ice->state.viewports[i];
5969 float vp_xmin = viewport_extent(state, 0, -1.0f);
5970 float vp_xmax = viewport_extent(state, 0, 1.0f);
5971 float vp_ymin = viewport_extent(state, 1, -1.0f);
5972 float vp_ymax = viewport_extent(state, 1, 1.0f);
5975 state->scale[0], state->scale[1],
5976 state->translate[0], state->translate[1],
5984 vp.ViewportMatrixElementm00 = state->scale[0];
5985 vp.ViewportMatrixElementm11 = state->scale[1];
5986 vp.ViewportMatrixElementm22 = state->scale[2];
5987 vp.ViewportMatrixElementm30 = state->translate[0];
5988 vp.ViewportMatrixElementm31 = state->translate[1];
5989 vp.ViewportMatrixElementm32 = state->translate[2];
6035 vp.PointertoCLIP_VIEWPORT = ice->state.clip_vp_address;
6036 vp.PointertoSF_VIEWPORT = ice->state.sf_vp_address;
6124 struct crocus_blend_state *cso_blend = ice->state.cso_blend;
6125 struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
6126 struct crocus_depth_stencil_alpha_state *cso_zsa = ice->state.cso_zsa;
6208 struct crocus_depth_stencil_alpha_state *cso = ice->state.cso_zsa;
6209 UNUSED struct crocus_blend_state *cso_blend = ice->state.cso_blend;
6210 struct pipe_stencil_ref *p_stencil_refs = &ice->state.stencil_ref;
6237 if (cso->cso.alpha_enabled && ice->state.framebuffer.nr_cbufs <= 1) {
6241 cc.StatisticsEnable = ice->state.stats_wm ? 1 : 0;
6242 cc.CCViewportStatePointer = ro_bo(batch->state.bo, ice->state.cc_vp_address);
6247 cc.BlendConstantColorRed = ice->state.blend_color.color[0];
6248 cc.BlendConstantColorGreen = ice->state.blend_color.color[1];
6249 cc.BlendConstantColorBlue = ice->state.blend_color.color[2];
6250 cc.BlendConstantColorAlpha = ice->state.blend_color.color[3];
6268 blend_cc.BlendConstantColorRed = ice->state.blend_color.color[0];
6269 blend_cc.BlendConstantColorGreen = ice->state.blend_color.color[1];
6270 blend_cc.BlendConstantColorBlue = ice->state.blend_color.color[2];
6271 blend_cc.BlendConstantColorAlpha = ice->state.blend_color.color[3];
6279 struct crocus_shader_state *shs = &ice->state.shaders[stage];
6358 struct crocus_shader_state *shs = &ice->state.shaders[stage];
6369 struct crocus_shader_state *shs_vs = &ice->state.shaders[MESA_SHADER_VERTEX];
6370 struct crocus_shader_state *shs_gs = &ice->state.shaders[MESA_SHADER_GEOMETRY];
6371 struct crocus_shader_state *shs_fs = &ice->state.shaders[MESA_SHADER_FRAGMENT];
6399 ice->state.cso_rast->cso.half_pixel_center ? CENTER : UL_CORNER;
6400 if (ice->state.framebuffer.samples > 0)
6401 ms.NumberofMultisamples = ffs(ice->state.framebuffer.samples) - 1;
6405 switch (ice->state.framebuffer.samples) {
6481 ps.DualSourceBlendEnable = wm_prog_data->dual_src_blend && ice->state.cso_blend->dual_color_blending;
6553 !(has_writeable_rt(ice->state.cso_blend, fs_info)))
6561 if (ice->state.streamout_active) {
6565 (void *) ice->state.so_target[i];
6605 if ((dirty & CROCUS_DIRTY_SO_DECL_LIST) && ice->state.streamout) {
6607 ice->state.streamout + GENX(3DSTATE_STREAMOUT_length);
6612 const struct crocus_rasterizer_state *cso_rast = ice->state.cso_rast;
6620 !ice->state.prims_generated_query_active;
6624 assert(ice->state.streamout);
6626 crocus_emit_merge(batch, ice->state.streamout, dynamic_sol,
6636 if (ice->state.streamout_active) {
6646 struct pipe_rasterizer_state *cso_state = &ice->state.cso_rast->cso;
6684 clip.ClipperViewportStatePointer = ro_bo(batch->state.bo, ice->state.clip_vp_address);
6711 struct crocus_rasterizer_state *cso_rast = ice->state.cso_rast;
6713 struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
6718 : ice->state.prim_is_points_or_lines);
6721 cl.StatisticsEnable = ice->state.statistics_counters_enabled;
6724 else if (ice->state.window_space_position)
6729 cl.PerspectiveDivideDisable = ice->state.window_space_position;
6738 cl.MaximumVPIndex = ice->state.num_viewports - 1;
6785 vs.SamplerStatePointer = ro_bo(batch->state.bo, ice->state.shaders[MESA_SHADER_VERTEX].sampler_offset);
6840 if (batch->screen->devinfo.gt == 2 && ice->state.gs_enabled != active)
6906 gs.SVBIPayloadEnable = ice->state.streamout_active;
6985 gs.MaximumVPIndex = ice->state.num_viewports - 1;
6988 ice->state.gs_enabled = active;
7051 struct pipe_rasterizer_state *cso_state = &ice->state.cso_rast->cso;
7066 sf.SetupViewportStateOffset = ro_bo(batch->state.bo, ice->state.sf_vp_address);
7100 struct crocus_rasterizer_state *cso = ice->state.cso_rast;
7103 sf.ViewportTransformEnable = !ice->state.window_space_position;
7121 if (ice->state.framebuffer.samples > 1 && ice->state.cso_rast->cso.multisample)
7125 if (ice->state.framebuffer.zsbuf) {
7128 ice->state.framebuffer.zsbuf->texture,
7146 struct crocus_rasterizer_state *cso = ice->state.cso_rast;
7232 wm.SamplerStatePointer = ro_bo(batch->state.bo,
7233 ice->state.shaders[MESA_SHADER_FRAGMENT].sampler_offset);
7236 wm.StatisticsEnable = (GFX_VER >= 6 || ice->state.stats_wm) ?
7237 ice->state.statistics_counters_enabled : 0;
7248 ice->state.cso_blend->dual_color_blending;
7283 struct pipe_framebuffer_state *fb = &ice->state.framebuffer;
7303 ice->state.cso_zsa->cso.alpha_enabled ||
7304 ice->state.cso_blend->cso.alpha_to_coverage ||
7308 if (has_writeable_rt(ice->state.cso_blend, fs_info) ||
7337 if (!(has_writeable_rt(ice->state.cso_blend, fs_info) || writes_depth) &&
7357 if (ice->state.global_depth_offset_clamp != cso->cso.offset_clamp) {
7361 ice->state.global_depth_offset_clamp = cso->cso.offset_clamp;
7375 struct crocus_blend_state *cso_blend = ice->state.cso_blend;
7376 struct crocus_depth_stencil_alpha_state *cso_zsa = ice->state.cso_zsa;
7425 stream_state(batch, sizeof(struct pipe_scissor_state) * ice->state.num_viewports,
7427 for (int i = 0; i < ice->state.num_viewports; i++) {
7446 struct pipe_framebuffer_state *cso = &ice->state.framebuffer;
7538 poly.PatternRow[i] = ice->state.poly_stipple.stipple[i];
7544 struct crocus_rasterizer_state *cso = ice->state.cso_rast;
7552 translate_prim_type(draw->mode, ice->state.patch_vertices);
7572 struct pipe_framebuffer_state *fb = &ice->state.framebuffer;
7582 const uint32_t user_count = util_bitcount(ice->state.bound_vertex_buffers);
7584 ice->state.vs_uses_draw_params + ice->state.vs_uses_derived_draw_params;
7585 uint32_t dynamic_bound = ice->state.bound_vertex_buffers;
7601 struct pipe_vertex_buffer *buf = &ice->state.vertex_buffers[i];
7603 uint32_t step_rate = ice->state.cso_vertex_elements->step_rate[i];
7607 ice->state.vb_end[i],
7613 if (ice->state.vs_uses_draw_params) {
7621 if (ice->state.vs_uses_derived_draw_params) {
7633 struct crocus_vertex_element_state *cso = ice->state.cso_vertex_elements;
7635 if (!(ice->state.vs_needs_sgvs_element ||
7636 ice->state.vs_uses_derived_draw_params ||
7637 ice->state.vs_needs_edge_flag)) {
7643 ice->state.vs_needs_sgvs_element +
7644 ice->state.vs_uses_derived_draw_params;
7652 (cso->count - ice->state.vs_needs_edge_flag) *
7655 &dynamic_ves[1 + (cso->count - ice->state.vs_needs_edge_flag) *
7658 if (ice->state.vs_needs_sgvs_element) {
7659 uint32_t base_ctrl = ice->state.vs_uses_draw_params ?
7664 util_bitcount64(ice->state.bound_vertex_buffers);
7669 ve.Component2Control = ice->state.vs_uses_vertexid ? VFCOMP_STORE_VID : VFCOMP_STORE_0;
7670 ve.Component3Control = ice->state.vs_uses_instanceid ? VFCOMP_STORE_IID : VFCOMP_STORE_0;
7681 if (ice->state.vs_uses_derived_draw_params) {
7685 util_bitcount64(ice->state.bound_vertex_buffers) +
7686 ice->state.vs_uses_draw_params;
7693 ve.DestinationElementOffset = (cso->count + ice->state.vs_needs_sgvs_element) * 4;
7698 if (ice->state.vs_needs_edge_flag) {
7708 if (!ice->state.vs_needs_edge_flag) {
7722 ice->state.vs_needs_sgvs_element +
7723 ice->state.vs_uses_derived_draw_params;
7738 struct crocus_vertex_element_state *cso = ice->state.cso_vertex_elements;
7745 cso->count - ice->state.vs_needs_edge_flag;
7752 cso->count - ice->state.vs_needs_edge_flag;
7791 bool use_predicate = ice->state.predicate == CROCUS_PREDICATE_STATE_USE_BIT;
7812 &offset, &ice->state.index_buffer.res);
7819 if (ice->state.index_buffer.res != draw->index.resource) {
7821 pipe_resource_reference(&ice->state.index_buffer.res,
7830 (ice->state.index_buffer.size != size ||
7831 ice->state.index_buffer.index_size != draw->index_size
7833 || ice->state.index_buffer.prim_restart != draw->primitive_restart
7840 struct crocus_bo *bo = crocus_resource_bo(ice->state.index_buffer.res);
7857 ice->state.index_buffer.size = size;
7858 ice->state.index_buffer.offset = offset;
7859 ice->state.index_buffer.index_size = draw->index_size;
7861 ice->state.index_buffer.prim_restart = draw->primitive_restart;
7886 if (ice->state.predicate == CROCUS_PREDICATE_STATE_USE_BIT) {
8021 prim.PrimitiveTopologyType = translate_prim_type(ice->state.prim_mode, ice->state.patch_vertices);
8050 const uint64_t stage_dirty = ice->state.stage_dirty;
8053 struct crocus_shader_state *shs = &ice->state.shaders[MESA_SHADER_COMPUTE];
8192 struct crocus_state_ref *grid_size = &ice->state.grid_size;
8282 free(ice->state.genx);
8285 pipe_so_target_reference(&ice->state.so_target[i], NULL);
8288 for (unsigned i = 0; i < ice->state.framebuffer.nr_cbufs; i++) {
8289 pipe_surface_reference(&ice->state.framebuffer.cbufs[i], NULL);
8291 pipe_surface_reference(&ice->state.framebuffer.zsbuf, NULL);
8294 struct crocus_shader_state *shs = &ice->state.shaders[stage];
8311 pipe_resource_reference(&ice->state.vertex_buffers[i].buffer.resource, NULL);
8312 pipe_resource_reference(&ice->state.grid_size.res, NULL);
8314 pipe_resource_reference(&ice->state.index_buffer.res, NULL);
8339 uint64_t bound_vbs = ice->state.bound_vertex_buffers;
8342 struct pipe_vertex_buffer *buffer = &ice->state.vertex_buffers[i];
8345 ice->state.dirty |= CROCUS_DIRTY_VERTEX_BUFFERS;
8350 ice->state.index_buffer.res) {
8351 if (res->bo == crocus_resource_bo(ice->state.index_buffer.res))
8352 pipe_resource_reference(&ice->state.index_buffer.res, NULL);
8356 * - PIPE_BIND_QUERY_BUFFER (no persistent state references)
8362 if (ice->state.so_target[i] &&
8363 (ice->state.so_target[i]->buffer == &res->base.b)) {
8365 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_BINDINGS_GS;
8367 ice->state.dirty |= CROCUS_DIRTY_GEN7_SO_BUFFERS;
8374 struct crocus_shader_state *shs = &ice->state.shaders[s];
8388 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CONSTANTS_VS << s;
8419 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_BINDINGS_VS << s;
8432 ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_BINDINGS_VS << s;
9000 * control packet, the indirect state pointers in the hardware are
9002 * If any new indirect state commands are executed in the command stream
9003 * while the pipe control is pending, the new indirect state commands are
9045 ice->state.stage_dirty |= (CROCUS_STAGE_DIRTY_CONSTANTS_VS |
9076 pipe_resource_reference(&batch->ice->state.index_buffer.res, NULL);
9078 /* for GEN4/5 need to reemit anything that ends up in the state batch that points to anything in the state batch
9079 * as the old state batch won't still be available.
9081 batch->ice->state.dirty |= CROCUS_DIRTY_DEPTH_BUFFER |
9084 batch->ice->state.dirty |= CROCUS_DIRTY_VERTEX_ELEMENTS | CROCUS_DIRTY_VERTEX_BUFFERS;
9086 batch->ice->state.stage_dirty |= CROCUS_ALL_STAGE_DIRTY_BINDINGS;
9087 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_SAMPLER_STATES_VS;
9088 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_SAMPLER_STATES_TES;
9089 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_SAMPLER_STATES_TCS;
9090 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_SAMPLER_STATES_GS;
9091 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_SAMPLER_STATES_PS;
9092 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_SAMPLER_STATES_CS;
9094 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CONSTANTS_VS;
9095 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CONSTANTS_TES;
9096 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CONSTANTS_TCS;
9097 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CONSTANTS_GS;
9098 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CONSTANTS_FS;
9099 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CONSTANTS_CS;
9101 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_VS;
9102 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_GS;
9103 batch->ice->state.stage_dirty |= CROCUS_STAGE_DIRTY_CS;
9104 batch->ice->state.dirty |= CROCUS_DIRTY_CC_VIEWPORT | CROCUS_DIRTY_SF_CL_VIEWPORT;
9108 batch->ice->state.dirty |= CROCUS_DIRTY_GEN6_BLEND_STATE;
9109 batch->ice->state.dirty |= CROCUS_DIRTY_GEN6_SCISSOR_RECT;
9110 batch->ice->state.dirty |= CROCUS_DIRTY_GEN6_WM_DEPTH_STENCIL;
9114 /* dirty the SF state on gen4/5 */
9115 batch->ice->state.dirty |= CROCUS_DIRTY_RASTER;
9116 batch->ice->state.dirty |= CROCUS_DIRTY_GEN4_CURBE;
9117 batch->ice->state.dirty |= CROCUS_DIRTY_CLIP;
9118 batch->ice->state.dirty |= CROCUS_DIRTY_WM;
9122 batch->ice->state.dirty |= CROCUS_DIRTY_STREAMOUT;
9123 batch->ice->state.dirty |= CROCUS_DIRTY_SO_DECL_LIST;
9124 batch->ice->state.dirty |= CROCUS_DIRTY_GEN7_SO_BUFFERS;
9131 return &ice->state.cso_rast->cso;
9140 struct crocus_stream_output_target *so = (void *)ice->state.so_target[i];
9170 ice->state.dirty |= CROCUS_ALL_DIRTY_FOR_RENDER;
9171 ice->state.stage_dirty |= CROCUS_ALL_STAGE_DIRTY_FOR_RENDER;
9178 ice->state.dirty |= CROCUS_ALL_DIRTY_FOR_COMPUTE;
9179 ice->state.stage_dirty |= CROCUS_ALL_STAGE_DIRTY_FOR_COMPUTE;
9292 ice->state.dirty = ~0ull;
9293 ice->state.stage_dirty = ~0ull;
9295 ice->state.statistics_counters_enabled = true;
9297 ice->state.sample_mask = 0xff;
9298 ice->state.num_viewports = 1;
9299 ice->state.prim_mode = PIPE_PRIM_MAX;
9300 ice->state.reduced_prim_mode = PIPE_PRIM_MAX;
9301 ice->state.genx = calloc(1, sizeof(struct crocus_genx_state));
9306 ice->state.scissors[i] = (struct pipe_scissor_state) {