etnaviv: do the left shift by 16 at emit time
Also round up the max bounds. Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com> Reviewed-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4278>
This commit is contained in:
committed by
Marge Bot
parent
5ba2d398d8
commit
9491c1b04d
@@ -392,10 +392,10 @@ etna_emit_state(struct etna_context *ctx)
|
||||
/*00A3C*/ EMIT_STATE(PA_WIDE_LINE_WIDTH1, rasterizer->PA_LINE_WIDTH);
|
||||
}
|
||||
if (unlikely(dirty & (ETNA_DIRTY_SCISSOR_CLIP))) {
|
||||
/*00C00*/ EMIT_STATE_FIXP(SE_SCISSOR_LEFT, ctx->clipping.SE_SCISSOR_LEFT);
|
||||
/*00C04*/ EMIT_STATE_FIXP(SE_SCISSOR_TOP, ctx->clipping.SE_SCISSOR_TOP);
|
||||
/*00C08*/ EMIT_STATE_FIXP(SE_SCISSOR_RIGHT, ctx->clipping.SE_SCISSOR_RIGHT + ETNA_SE_SCISSOR_MARGIN_RIGHT);
|
||||
/*00C0C*/ EMIT_STATE_FIXP(SE_SCISSOR_BOTTOM, ctx->clipping.SE_SCISSOR_BOTTOM + ETNA_SE_SCISSOR_MARGIN_BOTTOM);
|
||||
/*00C00*/ EMIT_STATE_FIXP(SE_SCISSOR_LEFT, ctx->clipping.SE_SCISSOR_LEFT << 16);
|
||||
/*00C04*/ EMIT_STATE_FIXP(SE_SCISSOR_TOP, ctx->clipping.SE_SCISSOR_TOP << 16);
|
||||
/*00C08*/ EMIT_STATE_FIXP(SE_SCISSOR_RIGHT, (ctx->clipping.SE_SCISSOR_RIGHT << 16) + ETNA_SE_SCISSOR_MARGIN_RIGHT);
|
||||
/*00C0C*/ EMIT_STATE_FIXP(SE_SCISSOR_BOTTOM, (ctx->clipping.SE_SCISSOR_BOTTOM << 16) + ETNA_SE_SCISSOR_MARGIN_BOTTOM);
|
||||
}
|
||||
if (unlikely(dirty & (ETNA_DIRTY_RASTERIZER))) {
|
||||
struct etna_rasterizer_state *rasterizer = etna_rasterizer_state(ctx->rasterizer);
|
||||
@@ -405,8 +405,8 @@ etna_emit_state(struct etna_context *ctx)
|
||||
/*00C18*/ EMIT_STATE(SE_CONFIG, rasterizer->SE_CONFIG);
|
||||
}
|
||||
if (unlikely(dirty & (ETNA_DIRTY_SCISSOR_CLIP))) {
|
||||
/*00C20*/ EMIT_STATE_FIXP(SE_CLIP_RIGHT, ctx->clipping.SE_SCISSOR_RIGHT + ETNA_SE_CLIP_MARGIN_RIGHT);
|
||||
/*00C24*/ EMIT_STATE_FIXP(SE_CLIP_BOTTOM, ctx->clipping.SE_SCISSOR_BOTTOM + ETNA_SE_CLIP_MARGIN_BOTTOM);
|
||||
/*00C20*/ EMIT_STATE_FIXP(SE_CLIP_RIGHT, (ctx->clipping.SE_SCISSOR_RIGHT << 16) + ETNA_SE_CLIP_MARGIN_RIGHT);
|
||||
/*00C24*/ EMIT_STATE_FIXP(SE_CLIP_BOTTOM, (ctx->clipping.SE_SCISSOR_BOTTOM << 16) + ETNA_SE_CLIP_MARGIN_BOTTOM);
|
||||
}
|
||||
if (unlikely(dirty & (ETNA_DIRTY_SHADER))) {
|
||||
/*00E00*/ EMIT_STATE(RA_CONTROL, ctx->shader_state.RA_CONTROL);
|
||||
|
||||
@@ -352,8 +352,8 @@ etna_set_framebuffer_state(struct pipe_context *pctx,
|
||||
/* Scissor setup */
|
||||
cs->SE_SCISSOR_LEFT = 0; /* affected by rasterizer and scissor state as well */
|
||||
cs->SE_SCISSOR_TOP = 0;
|
||||
cs->SE_SCISSOR_RIGHT = (fb->width << 16);
|
||||
cs->SE_SCISSOR_BOTTOM = (fb->height << 16);
|
||||
cs->SE_SCISSOR_RIGHT = fb->width;
|
||||
cs->SE_SCISSOR_BOTTOM = fb->height;
|
||||
|
||||
cs->TS_MEM_CONFIG = ts_mem_config;
|
||||
cs->PE_MEM_CONFIG = pe_mem_config;
|
||||
@@ -389,10 +389,10 @@ etna_set_scissor_states(struct pipe_context *pctx, unsigned start_slot,
|
||||
|
||||
/* note that this state is only used when rasterizer_state->scissor is on */
|
||||
ctx->scissor_s = *ss;
|
||||
cs->SE_SCISSOR_LEFT = (ss->minx << 16);
|
||||
cs->SE_SCISSOR_TOP = (ss->miny << 16);
|
||||
cs->SE_SCISSOR_RIGHT = (ss->maxx << 16);
|
||||
cs->SE_SCISSOR_BOTTOM = (ss->maxy << 16);
|
||||
cs->SE_SCISSOR_LEFT = ss->minx;
|
||||
cs->SE_SCISSOR_TOP = ss->miny;
|
||||
cs->SE_SCISSOR_RIGHT = ss->maxx;
|
||||
cs->SE_SCISSOR_BOTTOM = ss->maxy;
|
||||
|
||||
ctx->dirty |= ETNA_DIRTY_SCISSOR;
|
||||
}
|
||||
@@ -428,10 +428,10 @@ etna_set_viewport_states(struct pipe_context *pctx, unsigned start_slot,
|
||||
/* Compute scissor rectangle (fixp) from viewport.
|
||||
* Make sure left is always < right and top always < bottom.
|
||||
*/
|
||||
cs->SE_SCISSOR_LEFT = etna_f32_to_fixp16(MAX2(vs->translate[0] - fabsf(vs->scale[0]), 0.0f));
|
||||
cs->SE_SCISSOR_TOP = etna_f32_to_fixp16(MAX2(vs->translate[1] - fabsf(vs->scale[1]), 0.0f));
|
||||
cs->SE_SCISSOR_RIGHT = etna_f32_to_fixp16(MAX2(vs->translate[0] + fabsf(vs->scale[0]), 0.0f));
|
||||
cs->SE_SCISSOR_BOTTOM = etna_f32_to_fixp16(MAX2(vs->translate[1] + fabsf(vs->scale[1]), 0.0f));
|
||||
cs->SE_SCISSOR_LEFT = MAX2(vs->translate[0] - fabsf(vs->scale[0]), 0.0f);
|
||||
cs->SE_SCISSOR_TOP = MAX2(vs->translate[1] - fabsf(vs->scale[1]), 0.0f);
|
||||
cs->SE_SCISSOR_RIGHT = ceilf(MAX2(vs->translate[0] + fabsf(vs->scale[0]), 0.0f));
|
||||
cs->SE_SCISSOR_BOTTOM = ceilf(MAX2(vs->translate[1] + fabsf(vs->scale[1]), 0.0f));
|
||||
|
||||
cs->PE_DEPTH_NEAR = fui(0.0); /* not affected if depth mode is Z (as in GL) */
|
||||
cs->PE_DEPTH_FAR = fui(1.0);
|
||||
|
||||
Reference in New Issue
Block a user