mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 03:00:11 +01:00
crocus: add struct crocus_scissor_state to clamp values to 16bit
This is a port of iris driver commit193e494e6ato crocus. Fixes:bc1a6b0a41("gallium: change pipe_scissor_state to 32 bit integer") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14428 Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38862>
This commit is contained in:
parent
c56543874c
commit
c9bc373f7c
3 changed files with 18 additions and 12 deletions
|
|
@ -52,7 +52,9 @@ void crocus_blitter_begin(struct crocus_context *ice, enum crocus_blitter_op op,
|
|||
util_blitter_save_fragment_shader(ice->blitter, ice->shaders.uncompiled[MESA_SHADER_FRAGMENT]);
|
||||
util_blitter_save_sample_mask(ice->blitter, ice->state.sample_mask, 0);
|
||||
util_blitter_save_rasterizer(ice->blitter, ice->state.cso_rast);
|
||||
util_blitter_save_scissor(ice->blitter, &ice->state.scissors[0]);
|
||||
util_blitter_save_scissor(ice->blitter, &(struct pipe_scissor_state) {
|
||||
ice->state.scissors[0].minx, ice->state.scissors[0].miny,
|
||||
ice->state.scissors[0].maxx, ice->state.scissors[0].maxy });
|
||||
util_blitter_save_viewport(ice->blitter, &ice->state.viewports[0]);
|
||||
util_blitter_save_fragment_constant_buffer_slot(ice->blitter, &ice->state.shaders[MESA_SHADER_FRAGMENT].constbufs[0]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -433,6 +433,10 @@ struct crocus_shader_state {
|
|||
uint32_t sampler_offset;
|
||||
};
|
||||
|
||||
struct crocus_scissor_state {
|
||||
uint16_t minx, miny, maxx, maxy;
|
||||
};
|
||||
|
||||
/**
|
||||
* The API context (derived from pipe_context).
|
||||
*
|
||||
|
|
@ -570,7 +574,7 @@ struct crocus_context {
|
|||
struct pipe_blend_color blend_color;
|
||||
struct pipe_poly_stipple poly_stipple;
|
||||
struct pipe_viewport_state viewports[CROCUS_MAX_VIEWPORTS];
|
||||
struct pipe_scissor_state scissors[CROCUS_MAX_VIEWPORTS];
|
||||
struct crocus_scissor_state scissors[CROCUS_MAX_VIEWPORTS];
|
||||
struct pipe_stencil_ref stencil_ref;
|
||||
PIPE_FB_SURFACES; //STOP USING THIS
|
||||
struct pipe_framebuffer_state framebuffer;
|
||||
|
|
|
|||
|
|
@ -3252,19 +3252,19 @@ crocus_set_sample_mask(struct pipe_context *ctx, unsigned sample_mask)
|
|||
static void
|
||||
crocus_fill_scissor_rect(struct crocus_context *ice,
|
||||
int idx,
|
||||
struct pipe_scissor_state *ss)
|
||||
struct crocus_scissor_state *ss)
|
||||
{
|
||||
struct pipe_framebuffer_state *cso_fb = &ice->state.framebuffer;
|
||||
struct pipe_rasterizer_state *cso_state = &ice->state.cso_rast->cso;
|
||||
const struct pipe_viewport_state *vp = &ice->state.viewports[idx];
|
||||
struct pipe_scissor_state scissor = (struct pipe_scissor_state) {
|
||||
struct crocus_scissor_state scissor = (struct crocus_scissor_state) {
|
||||
.minx = MAX2(-fabsf(vp->scale[0]) + vp->translate[0], 0),
|
||||
.maxx = MIN2( fabsf(vp->scale[0]) + vp->translate[0], cso_fb->width) - 1,
|
||||
.miny = MAX2(-fabsf(vp->scale[1]) + vp->translate[1], 0),
|
||||
.maxy = MIN2( fabsf(vp->scale[1]) + vp->translate[1], cso_fb->height) - 1,
|
||||
};
|
||||
if (cso_state->scissor) {
|
||||
struct pipe_scissor_state *s = &ice->state.scissors[idx];
|
||||
struct crocus_scissor_state *s = &ice->state.scissors[idx];
|
||||
scissor.minx = MAX2(scissor.minx, s->minx);
|
||||
scissor.miny = MAX2(scissor.miny, s->miny);
|
||||
scissor.maxx = MIN2(scissor.maxx, s->maxx);
|
||||
|
|
@ -3295,11 +3295,11 @@ crocus_set_scissor_states(struct pipe_context *ctx,
|
|||
* a min > max scissor inside the bounds, which produces the expected
|
||||
* no rendering.
|
||||
*/
|
||||
ice->state.scissors[start_slot + i] = (struct pipe_scissor_state) {
|
||||
ice->state.scissors[start_slot + i] = (struct crocus_scissor_state) {
|
||||
.minx = 1, .maxx = 0, .miny = 1, .maxy = 0,
|
||||
};
|
||||
} else {
|
||||
ice->state.scissors[start_slot + i] = (struct pipe_scissor_state) {
|
||||
ice->state.scissors[start_slot + i] = (struct crocus_scissor_state) {
|
||||
.minx = rects[i].minx, .miny = rects[i].miny,
|
||||
.maxx = rects[i].maxx - 1, .maxy = rects[i].maxy - 1,
|
||||
};
|
||||
|
|
@ -6006,7 +6006,7 @@ crocus_upload_dirty_render_state(struct crocus_context *ice,
|
|||
vp.ViewportMatrixElementm31 = state->translate[1];
|
||||
vp.ViewportMatrixElementm32 = state->translate[2];
|
||||
#if GFX_VER < 6
|
||||
struct pipe_scissor_state scissor;
|
||||
struct crocus_scissor_state scissor;
|
||||
crocus_fill_scissor_rect(ice, 0, &scissor);
|
||||
vp.ScissorRectangle.ScissorRectangleXMin = scissor.minx;
|
||||
vp.ScissorRectangle.ScissorRectangleXMax = scissor.maxx;
|
||||
|
|
@ -7438,11 +7438,11 @@ crocus_upload_dirty_render_state(struct crocus_context *ice,
|
|||
if (dirty & CROCUS_DIRTY_GEN6_SCISSOR_RECT) {
|
||||
/* Align to 64-byte boundary as per anv. */
|
||||
uint32_t scissor_offset;
|
||||
struct pipe_scissor_state *scissor_map = (void *)
|
||||
stream_state(batch, sizeof(struct pipe_scissor_state) * ice->state.num_viewports,
|
||||
struct crocus_scissor_state *scissor_map = (void *)
|
||||
stream_state(batch, sizeof(struct crocus_scissor_state) * ice->state.num_viewports,
|
||||
64, &scissor_offset);
|
||||
for (int i = 0; i < ice->state.num_viewports; i++) {
|
||||
struct pipe_scissor_state scissor;
|
||||
struct crocus_scissor_state scissor;
|
||||
crocus_fill_scissor_rect(ice, i, &scissor);
|
||||
scissor_map[i] = scissor;
|
||||
}
|
||||
|
|
@ -9319,7 +9319,7 @@ genX(crocus_init_state)(struct crocus_context *ice)
|
|||
|
||||
/* Default all scissor rectangles to be empty regions. */
|
||||
for (int i = 0; i < CROCUS_MAX_VIEWPORTS; i++) {
|
||||
ice->state.scissors[i] = (struct pipe_scissor_state) {
|
||||
ice->state.scissors[i] = (struct crocus_scissor_state) {
|
||||
.minx = 1, .maxx = 0, .miny = 1, .maxy = 0,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue