From: Kenneth Graunke Date: Sat, 27 Oct 2018 05:18:56 +0000 (-0700) Subject: iris: hook up key stuff for clip plane lowering X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2b0a2915dcc015789ca4b81cdb2bd0578152fde3;p=mesa.git iris: hook up key stuff for clip plane lowering --- diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 87757ab0869..08f6f20510a 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -346,6 +346,7 @@ struct iris_vtable { uint32_t *(*create_so_decl_list)(const struct pipe_stream_output_info *sol, const struct brw_vue_map *vue_map); void (*populate_vs_key)(const struct iris_context *ice, + const struct shader_info *info, struct brw_vs_prog_key *key); void (*populate_tcs_key)(const struct iris_context *ice, struct brw_tcs_prog_key *key); diff --git a/src/gallium/drivers/iris/iris_program.c b/src/gallium/drivers/iris/iris_program.c index 10e0161f851..b0306cca4f8 100644 --- a/src/gallium/drivers/iris/iris_program.c +++ b/src/gallium/drivers/iris/iris_program.c @@ -183,6 +183,9 @@ iris_create_uncompiled_shader(struct pipe_context *ctx, switch (nir->info.stage) { case MESA_SHADER_VERTEX: + /* User clip planes */ + if (nir->info.clip_distance_array_size == 0) + ish->nos |= IRIS_NOS_RASTERIZER; // XXX: NOS break; case MESA_SHADER_TESS_CTRL: @@ -592,7 +595,7 @@ iris_update_compiled_vs(struct iris_context *ice) ice->shaders.uncompiled[MESA_SHADER_VERTEX]; struct brw_vs_prog_key key = { .program_string_id = ish->program_id }; - ice->vtbl.populate_vs_key(ice, &key); + ice->vtbl.populate_vs_key(ice, &ish->nir->info, &key); if (iris_bind_cached_shader(ice, IRIS_CACHE_VS, &key)) return; diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index c6e90b979c0..dc7021f2d64 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -968,6 +968,7 @@ struct iris_rasterizer_state { uint32_t wm[GENX(3DSTATE_WM_length)]; uint32_t line_stipple[GENX(3DSTATE_LINE_STIPPLE_length)]; + uint8_t num_clip_plane_consts; bool clip_halfz; /* for CC_VIEWPORT */ bool depth_clip_near; /* for CC_VIEWPORT */ bool depth_clip_far; /* for CC_VIEWPORT */ @@ -1145,6 +1146,9 @@ iris_create_rasterizer_state(struct pipe_context *ctx, line.LineStippleRepeatCount = line_stipple_factor; } + if (state->clip_plane_enable != 0) + cso->num_clip_plane_consts = util_logbase2(state->clip_plane_enable) + 1; + return cso; } @@ -2949,9 +2953,15 @@ iris_populate_sampler_key(const struct iris_context *ice, */ static void iris_populate_vs_key(const struct iris_context *ice, + const struct shader_info *info, struct brw_vs_prog_key *key) { + const struct iris_rasterizer_state *cso_rast = ice->state.cso_rast; + iris_populate_sampler_key(ice, &key->tex); + + if (info->clip_distance_array_size == 0) + key->nr_userclip_plane_consts = cso_rast->num_clip_plane_consts; } /**