iris: hook up key stuff for clip plane lowering

This commit is contained in:
Kenneth Graunke 2018-10-26 22:18:56 -07:00
parent 2876dd1a37
commit 2b0a2915dc
3 changed files with 15 additions and 1 deletions

View File

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

View File

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

View File

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