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