panfrost: Drop rasterizer null checks in draw calls

rasterizer must be non-null when draw_vbo is called (indeed, we assert
this there), so anything in the per-draw graphics path can safely assume
we have a rasterizer object bound.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6327>
This commit is contained in:
Alyssa Rosenzweig 2020-08-14 17:50:44 -04:00 committed by Marge Bot
parent e46d4fe8bc
commit ec35159fba
3 changed files with 10 additions and 29 deletions

View file

@ -82,13 +82,13 @@ panfrost_vt_update_rasterizer(struct panfrost_rasterizer *rasterizer,
{
postfix->gl_enables |= 0x7;
SET_BIT(postfix->gl_enables, MALI_FRONT_CCW_TOP,
rasterizer && rasterizer->base.front_ccw);
rasterizer->base.front_ccw);
SET_BIT(postfix->gl_enables, MALI_CULL_FACE_FRONT,
rasterizer && (rasterizer->base.cull_face & PIPE_FACE_FRONT));
(rasterizer->base.cull_face & PIPE_FACE_FRONT));
SET_BIT(postfix->gl_enables, MALI_CULL_FACE_BACK,
rasterizer && (rasterizer->base.cull_face & PIPE_FACE_BACK));
(rasterizer->base.cull_face & PIPE_FACE_BACK));
SET_BIT(prefix->unknown_draw, MALI_DRAW_FLATSHADE_FIRST,
rasterizer && rasterizer->base.flatshade_first);
rasterizer->base.flatshade_first);
}
void
@ -99,11 +99,7 @@ panfrost_vt_update_primitive_size(struct panfrost_context *ctx,
struct panfrost_rasterizer *rasterizer = ctx->rasterizer;
if (!panfrost_writes_point_size(ctx)) {
bool points = prefix->draw_mode == MALI_DRAW_MODE_POINTS;
float val = 0.0f;
if (rasterizer)
val = points ?
float val = (prefix->draw_mode == MALI_DRAW_MODE_POINTS) ?
rasterizer->base.point_size :
rasterizer->base.line_width;
@ -450,18 +446,6 @@ static void
panfrost_frag_meta_rasterizer_update(struct panfrost_context *ctx,
struct mali_shader_meta *fragmeta)
{
if (!ctx->rasterizer) {
SET_BIT(fragmeta->unknown2_4, MALI_NO_MSAA, true);
SET_BIT(fragmeta->unknown2_3, MALI_HAS_MSAA, false);
fragmeta->depth_units = 0.0f;
fragmeta->depth_factor = 0.0f;
SET_BIT(fragmeta->unknown2_4, MALI_DEPTH_RANGE_A, false);
SET_BIT(fragmeta->unknown2_4, MALI_DEPTH_RANGE_B, false);
SET_BIT(fragmeta->unknown2_3, MALI_DEPTH_CLIP_NEAR, true);
SET_BIT(fragmeta->unknown2_3, MALI_DEPTH_CLIP_FAR, true);
return;
}
struct pipe_rasterizer_state *rast = &ctx->rasterizer->base;
bool msaa = rast->multisample;
@ -735,7 +719,7 @@ panfrost_frag_shader_meta_init(struct panfrost_context *ctx,
fs = panfrost_get_shader_state(ctx, PIPE_SHADER_FRAGMENT);
bool msaa = ctx->rasterizer && ctx->rasterizer->base.multisample;
bool msaa = ctx->rasterizer->base.multisample;
fragmeta->coverage_mask = msaa ? ctx->sample_mask : ~0;
fragmeta->unknown2_3 = MALI_DEPTH_FUNC(MALI_FUNC_ALWAYS) | 0x10;
@ -884,7 +868,7 @@ panfrost_emit_viewport(struct panfrost_batch *batch,
unsigned miny = MIN2(fb->height, vp_miny);
unsigned maxy = MIN2(fb->height, vp_maxy);
if (ss && rast && rast->scissor) {
if (ss && rast->scissor) {
minx = MAX2(ss->minx, minx);
miny = MAX2(ss->miny, miny);
maxx = MIN2(ss->maxx, maxx);
@ -2101,13 +2085,10 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
/* If rasterizer discard is enable, only submit the vertex */
bool rasterizer_discard = ctx->rasterizer &&
ctx->rasterizer->base.rasterizer_discard;
unsigned vertex = panfrost_new_job(&batch->pool, &batch->scoreboard, MALI_JOB_TYPE_VERTEX, false, 0,
vp, vp_size, false);
if (rasterizer_discard)
if (ctx->rasterizer->base.rasterizer_discard)
return;
panfrost_new_job(&batch->pool, &batch->scoreboard, MALI_JOB_TYPE_TILER, false, vertex, tp, tp_size,

View file

@ -241,7 +241,7 @@ panfrost_scissor_culls_everything(struct panfrost_context *ctx)
/* Check if we're scissoring at all */
if (!(ctx->rasterizer && ctx->rasterizer->base.scissor))
if (!ctx->rasterizer->base.scissor)
return false;
return (ss->minx == ss->maxx) || (ss->miny == ss->maxy);

View file

@ -1208,7 +1208,7 @@ panfrost_batch_set_requirements(struct panfrost_batch *batch)
{
struct panfrost_context *ctx = batch->ctx;
if (ctx->rasterizer && ctx->rasterizer->base.multisample)
if (ctx->rasterizer->base.multisample)
batch->requirements |= PAN_REQ_MSAA;
if (ctx->depth_stencil && ctx->depth_stencil->base.depth.writemask) {