nv50,nvc0: add scissored clear support
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8901>
This commit is contained in:
parent
23340b959c
commit
8930ecd3ce
|
@ -238,6 +238,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||||
case PIPE_CAP_TWO_SIDED_COLOR:
|
case PIPE_CAP_TWO_SIDED_COLOR:
|
||||||
case PIPE_CAP_CLIP_PLANES:
|
case PIPE_CAP_CLIP_PLANES:
|
||||||
case PIPE_CAP_PACKED_STREAM_OUTPUT:
|
case PIPE_CAP_PACKED_STREAM_OUTPUT:
|
||||||
|
case PIPE_CAP_CLEAR_SCISSORED:
|
||||||
return 1;
|
return 1;
|
||||||
case PIPE_CAP_SEAMLESS_CUBE_MAP:
|
case PIPE_CAP_SEAMLESS_CUBE_MAP:
|
||||||
return 1; /* class_3d >= NVA0_3D_CLASS; */
|
return 1; /* class_3d >= NVA0_3D_CLASS; */
|
||||||
|
@ -368,7 +369,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||||
case PIPE_CAP_GLSL_ZERO_INIT:
|
case PIPE_CAP_GLSL_ZERO_INIT:
|
||||||
case PIPE_CAP_BLEND_EQUATION_ADVANCED:
|
case PIPE_CAP_BLEND_EQUATION_ADVANCED:
|
||||||
case PIPE_CAP_NO_CLIP_ON_COPY_TEX:
|
case PIPE_CAP_NO_CLIP_ON_COPY_TEX:
|
||||||
case PIPE_CAP_CLEAR_SCISSORED: /* TODO */
|
|
||||||
case PIPE_CAP_DEVICE_PROTECTED_CONTENT:
|
case PIPE_CAP_DEVICE_PROTECTED_CONTENT:
|
||||||
case PIPE_CAP_NIR_IMAGES_AS_DEREF:
|
case PIPE_CAP_NIR_IMAGES_AS_DEREF:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -538,6 +538,19 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, const struct pipe_scisso
|
||||||
if (!nv50_state_validate_3d(nv50, NV50_NEW_3D_FRAMEBUFFER))
|
if (!nv50_state_validate_3d(nv50, NV50_NEW_3D_FRAMEBUFFER))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (scissor_state) {
|
||||||
|
uint32_t minx = scissor_state->minx;
|
||||||
|
uint32_t maxx = MIN2(fb->width, scissor_state->maxx);
|
||||||
|
uint32_t miny = scissor_state->miny;
|
||||||
|
uint32_t maxy = MIN2(fb->height, scissor_state->maxy);
|
||||||
|
if (maxx <= minx || maxy <= miny)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BEGIN_NV04(push, NV50_3D(SCREEN_SCISSOR_HORIZ), 2);
|
||||||
|
PUSH_DATA (push, minx | (maxx - minx) << 16);
|
||||||
|
PUSH_DATA (push, miny | (maxy - miny) << 16);
|
||||||
|
}
|
||||||
|
|
||||||
/* We have to clear ALL of the layers, not up to the min number of layers
|
/* We have to clear ALL of the layers, not up to the min number of layers
|
||||||
* of any attachment. */
|
* of any attachment. */
|
||||||
BEGIN_NV04(push, NV50_3D(RT_ARRAY_MODE), 1);
|
BEGIN_NV04(push, NV50_3D(RT_ARRAY_MODE), 1);
|
||||||
|
@ -602,6 +615,13 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, const struct pipe_scisso
|
||||||
/* restore the array mode */
|
/* restore the array mode */
|
||||||
BEGIN_NV04(push, NV50_3D(RT_ARRAY_MODE), 1);
|
BEGIN_NV04(push, NV50_3D(RT_ARRAY_MODE), 1);
|
||||||
PUSH_DATA (push, nv50->rt_array_mode);
|
PUSH_DATA (push, nv50->rt_array_mode);
|
||||||
|
|
||||||
|
/* restore screen scissor */
|
||||||
|
if (scissor_state) {
|
||||||
|
BEGIN_NV04(push, NV50_3D(SCREEN_SCISSOR_HORIZ), 2);
|
||||||
|
PUSH_DATA (push, fb->width << 16);
|
||||||
|
PUSH_DATA (push, fb->height << 16);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -300,6 +300,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||||
case PIPE_CAP_CLIP_PLANES:
|
case PIPE_CAP_CLIP_PLANES:
|
||||||
case PIPE_CAP_TEXTURE_SHADOW_LOD:
|
case PIPE_CAP_TEXTURE_SHADOW_LOD:
|
||||||
case PIPE_CAP_PACKED_STREAM_OUTPUT:
|
case PIPE_CAP_PACKED_STREAM_OUTPUT:
|
||||||
|
case PIPE_CAP_CLEAR_SCISSORED:
|
||||||
return 1;
|
return 1;
|
||||||
case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
|
case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER:
|
||||||
return nouveau_screen(pscreen)->vram_domain & NOUVEAU_BO_VRAM ? 1 : 0;
|
return nouveau_screen(pscreen)->vram_domain & NOUVEAU_BO_VRAM ? 1 : 0;
|
||||||
|
@ -410,7 +411,6 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
|
||||||
case PIPE_CAP_GLSL_ZERO_INIT:
|
case PIPE_CAP_GLSL_ZERO_INIT:
|
||||||
case PIPE_CAP_BLEND_EQUATION_ADVANCED:
|
case PIPE_CAP_BLEND_EQUATION_ADVANCED:
|
||||||
case PIPE_CAP_NO_CLIP_ON_COPY_TEX:
|
case PIPE_CAP_NO_CLIP_ON_COPY_TEX:
|
||||||
case PIPE_CAP_CLEAR_SCISSORED: /* TODO */
|
|
||||||
case PIPE_CAP_DEVICE_PROTECTED_CONTENT:
|
case PIPE_CAP_DEVICE_PROTECTED_CONTENT:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -704,6 +704,19 @@ nvc0_clear(struct pipe_context *pipe, unsigned buffers,
|
||||||
if (!nvc0_state_validate_3d(nvc0, NVC0_NEW_3D_FRAMEBUFFER))
|
if (!nvc0_state_validate_3d(nvc0, NVC0_NEW_3D_FRAMEBUFFER))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (scissor_state) {
|
||||||
|
uint32_t minx = scissor_state->minx;
|
||||||
|
uint32_t maxx = MIN2(fb->width, scissor_state->maxx);
|
||||||
|
uint32_t miny = scissor_state->miny;
|
||||||
|
uint32_t maxy = MIN2(fb->height, scissor_state->maxy);
|
||||||
|
if (maxx <= minx || maxy <= miny)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BEGIN_NVC0(push, NVC0_3D(SCREEN_SCISSOR_HORIZ), 2);
|
||||||
|
PUSH_DATA (push, minx | (maxx - minx) << 16);
|
||||||
|
PUSH_DATA (push, miny | (maxy - miny) << 16);
|
||||||
|
}
|
||||||
|
|
||||||
if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) {
|
if (buffers & PIPE_CLEAR_COLOR && fb->nr_cbufs) {
|
||||||
BEGIN_NVC0(push, NVC0_3D(CLEAR_COLOR(0)), 4);
|
BEGIN_NVC0(push, NVC0_3D(CLEAR_COLOR(0)), 4);
|
||||||
PUSH_DATAf(push, color->f[0]);
|
PUSH_DATAf(push, color->f[0]);
|
||||||
|
@ -761,6 +774,13 @@ nvc0_clear(struct pipe_context *pipe, unsigned buffers,
|
||||||
(j << NVC0_3D_CLEAR_BUFFERS_LAYER__SHIFT));
|
(j << NVC0_3D_CLEAR_BUFFERS_LAYER__SHIFT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* restore screen scissor */
|
||||||
|
if (scissor_state) {
|
||||||
|
BEGIN_NVC0(push, NVC0_3D(SCREEN_SCISSOR_HORIZ), 2);
|
||||||
|
PUSH_DATA (push, fb->width << 16);
|
||||||
|
PUSH_DATA (push, fb->height << 16);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in New Issue