panfrost: Fill out the rasterizer CSO

The RSD state is all over the place but let's try to collect what we
can.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10869>
This commit is contained in:
Alyssa Rosenzweig
2021-05-14 18:42:22 -04:00
committed by Marge Bot
parent 88b9e5e471
commit c05e04d530
3 changed files with 23 additions and 11 deletions

View File

@@ -599,20 +599,12 @@ panfrost_prepare_fs_state(struct panfrost_context *ctx,
panfrost_prepare_midgard_fs_state(ctx, blend_shaders, state);
bool msaa = rast->multisample;
state->multisample_misc.multisample_enable = msaa;
state->multisample_misc.sample_mask = msaa ? ctx->sample_mask : 0xFFFF;
state->multisample_misc.evaluate_per_sample =
msaa && (ctx->min_samples > 1);
state->multisample_misc.fixed_function_near_discard = rast->depth_clip_near;
state->multisample_misc.fixed_function_far_discard = rast->depth_clip_far;
state->multisample_misc.shader_depth_range_fixed = true;
state->stencil_mask_misc.alpha_to_coverage = alpha_to_coverage;
state->stencil_mask_misc.depth_range_1 = rast->offset_tri;
state->stencil_mask_misc.depth_range_2 = rast->offset_tri;
state->stencil_mask_misc.single_sampled_lines = !rast->multisample;
state->depth_units = rast->offset_units * 2.0f;
state->depth_factor = rast->offset_scale;
@@ -625,7 +617,6 @@ panfrost_prepare_fs_state(struct panfrost_context *ctx,
state->alpha_reference = zsa->base.alpha_ref_value;
}
static void
panfrost_emit_frag_shader(struct panfrost_context *ctx,
struct mali_renderer_state_packed *fragmeta,
@@ -633,6 +624,7 @@ panfrost_emit_frag_shader(struct panfrost_context *ctx,
{
struct panfrost_device *dev = pan_device(ctx->base.screen);
const struct panfrost_zsa_state *zsa = ctx->depth_stencil;
const struct panfrost_rasterizer *rast = ctx->rasterizer;
struct panfrost_shader_state *fs =
panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT);
@@ -659,8 +651,11 @@ panfrost_emit_frag_shader(struct panfrost_context *ctx,
pan_merge(rsd, fs->partial_rsd, RENDERER_STATE);
/* Word 8, 9 Misc state */
rsd.opaque[8] |= zsa->rsd_depth.opaque[0];
rsd.opaque[9] |= zsa->rsd_stencil.opaque[0];
rsd.opaque[8] |= zsa->rsd_depth.opaque[0]
| rast->multisample.opaque[0];
rsd.opaque[9] |= zsa->rsd_stencil.opaque[0]
| rast->stencil_misc.opaque[0];
/* Word 10, 11 Stencil Front and Back */
rsd.opaque[10] |= zsa->stencil_front.opaque[0];

View File

@@ -756,6 +756,19 @@ panfrost_create_rasterizer_state(
/* Gauranteed with the core GL call, so don't expose ARB_polygon_offset */
assert(cso->offset_clamp == 0.0);
pan_pack(&so->multisample, MULTISAMPLE_MISC, cfg) {
cfg.multisample_enable = cso->multisample;
cfg.fixed_function_near_discard = cso->depth_clip_near;
cfg.fixed_function_far_discard = cso->depth_clip_far;
cfg.shader_depth_range_fixed = true;
}
pan_pack(&so->stencil_misc, STENCIL_MASK_MISC, cfg) {
cfg.depth_range_1 = cso->offset_tri;
cfg.depth_range_2 = cso->offset_tri;
cfg.single_sampled_lines = !cso->multisample;
}
return so;
}

View File

@@ -201,6 +201,10 @@ struct panfrost_context {
struct panfrost_rasterizer {
struct pipe_rasterizer_state base;
/* Partially packed RSD words */
struct mali_multisample_misc_packed multisample;
struct mali_stencil_mask_misc_packed stencil_misc;
};
/* Variants bundle together to form the backing CSO, bundling multiple