gallium: add pipe cap for scissored clears and pass scissor state to clear() hook
this adds a new pipe cap that drivers can support which enables passing buffer clears with scissor test enabled through to be handled by the driver instead of having mesa draw a quad also adjust all existing clear() hooks to have the new parameter Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4310>
This commit is contained in:

committed by
Marge Bot

parent
882928dcaa
commit
1c8bcad81a
@@ -515,6 +515,9 @@ dd_dump_clear(struct dd_draw_state *dstate, struct call_clear *info, FILE *f)
|
||||
{
|
||||
fprintf(f, "%s:\n", __func__+8);
|
||||
DUMP_M(uint, info, buffers);
|
||||
fprintf(f, " scissor_state: %d,%d %d,%d\n",
|
||||
info->scissor_state.minx, info->scissor_state.miny,
|
||||
info->scissor_state.maxx, info->scissor_state.maxy);
|
||||
DUMP_M_ADDR(color_union, info, color);
|
||||
DUMP_M(double, info, depth);
|
||||
DUMP_M(hex, info, stencil);
|
||||
@@ -1478,7 +1481,7 @@ dd_context_flush_resource(struct pipe_context *_pipe,
|
||||
}
|
||||
|
||||
static void
|
||||
dd_context_clear(struct pipe_context *_pipe, unsigned buffers,
|
||||
dd_context_clear(struct pipe_context *_pipe, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth,
|
||||
unsigned stencil)
|
||||
{
|
||||
@@ -1488,12 +1491,14 @@ dd_context_clear(struct pipe_context *_pipe, unsigned buffers,
|
||||
|
||||
record->call.type = CALL_CLEAR;
|
||||
record->call.info.clear.buffers = buffers;
|
||||
if (scissor_state)
|
||||
record->call.info.clear.scissor_state = *scissor_state;
|
||||
record->call.info.clear.color = *color;
|
||||
record->call.info.clear.depth = depth;
|
||||
record->call.info.clear.stencil = stencil;
|
||||
|
||||
dd_before_draw(dctx, record);
|
||||
pipe->clear(pipe, buffers, color, depth, stencil);
|
||||
pipe->clear(pipe, buffers, scissor_state, color, depth, stencil);
|
||||
dd_after_draw(dctx, record);
|
||||
}
|
||||
|
||||
|
@@ -93,6 +93,7 @@ struct call_resource_copy_region
|
||||
struct call_clear
|
||||
{
|
||||
unsigned buffers;
|
||||
struct pipe_scissor_state scissor_state;
|
||||
union pipe_color_union color;
|
||||
double depth;
|
||||
unsigned stencil;
|
||||
|
@@ -253,7 +253,7 @@ static void noop_texture_subdata(struct pipe_context *pipe,
|
||||
/*
|
||||
* clear/copy
|
||||
*/
|
||||
static void noop_clear(struct pipe_context *ctx, unsigned buffers,
|
||||
static void noop_clear(struct pipe_context *ctx, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth, unsigned stencil)
|
||||
{
|
||||
}
|
||||
|
@@ -921,6 +921,7 @@ rbug_flush_resource(struct pipe_context *_pipe,
|
||||
static void
|
||||
rbug_clear(struct pipe_context *_pipe,
|
||||
unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth,
|
||||
unsigned stencil)
|
||||
@@ -931,6 +932,7 @@ rbug_clear(struct pipe_context *_pipe,
|
||||
mtx_lock(&rb_pipe->call_mutex);
|
||||
pipe->clear(pipe,
|
||||
buffers,
|
||||
scissor_state,
|
||||
color,
|
||||
depth,
|
||||
stencil);
|
||||
|
@@ -1175,6 +1175,7 @@ trace_context_flush_resource(struct pipe_context *_pipe,
|
||||
static void
|
||||
trace_context_clear(struct pipe_context *_pipe,
|
||||
unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth,
|
||||
unsigned stencil)
|
||||
@@ -1186,6 +1187,9 @@ trace_context_clear(struct pipe_context *_pipe,
|
||||
|
||||
trace_dump_arg(ptr, pipe);
|
||||
trace_dump_arg(uint, buffers);
|
||||
trace_dump_arg_begin("scissor_state");
|
||||
trace_dump_scissor_state(scissor_state);
|
||||
trace_dump_arg_end();
|
||||
trace_dump_arg_begin("color");
|
||||
if (color)
|
||||
trace_dump_array(float, color->f, 4);
|
||||
@@ -1195,7 +1199,7 @@ trace_context_clear(struct pipe_context *_pipe,
|
||||
trace_dump_arg(float, depth);
|
||||
trace_dump_arg(uint, stencil);
|
||||
|
||||
pipe->clear(pipe, buffers, color, depth, stencil);
|
||||
pipe->clear(pipe, buffers, scissor_state, color, depth, stencil);
|
||||
|
||||
trace_dump_call_end();
|
||||
}
|
||||
|
@@ -122,7 +122,7 @@ pp_jimenezmlaa_run(struct pp_queue_t *ppq, struct pipe_resource *in,
|
||||
pp_filter_set_fb(p);
|
||||
pp_filter_misc_state(p);
|
||||
cso_set_depth_stencil_alpha(p->cso, &mstencil);
|
||||
p->pipe->clear(p->pipe, PIPE_CLEAR_STENCIL | PIPE_CLEAR_COLOR0,
|
||||
p->pipe->clear(p->pipe, PIPE_CLEAR_STENCIL | PIPE_CLEAR_COLOR0, NULL,
|
||||
&p->clear_color, 0, 0);
|
||||
|
||||
{
|
||||
|
@@ -300,5 +300,5 @@ void
|
||||
pp_filter_set_clear_fb(struct pp_program *p)
|
||||
{
|
||||
cso_set_framebuffer(p->cso, &p->framebuffer);
|
||||
p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR0, &p->clear_color, 0, 0);
|
||||
p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR0, NULL, &p->clear_color, 0, 0);
|
||||
}
|
||||
|
@@ -223,6 +223,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
|
||||
case PIPE_CAP_SHAREABLE_SHADERS:
|
||||
case PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS:
|
||||
case PIPE_CAP_CLEAR_TEXTURE:
|
||||
case PIPE_CAP_CLEAR_SCISSORED:
|
||||
case PIPE_CAP_DRAW_PARAMETERS:
|
||||
case PIPE_CAP_TGSI_PACK_HALF_FLOAT:
|
||||
case PIPE_CAP_MULTI_DRAW_INDIRECT:
|
||||
|
@@ -177,7 +177,7 @@ util_set_common_states_and_clear(struct cso_context *cso, struct pipe_context *c
|
||||
util_set_rasterizer_normal(cso);
|
||||
util_set_max_viewport(cso, cb);
|
||||
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR0, (void*)clear_color, 0, 0);
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR0, NULL, (void*)clear_color, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -2343,20 +2343,22 @@ tc_invalidate_resource(struct pipe_context *_pipe,
|
||||
|
||||
struct tc_clear {
|
||||
unsigned buffers;
|
||||
struct pipe_scissor_state scissor_state;
|
||||
union pipe_color_union color;
|
||||
double depth;
|
||||
unsigned stencil;
|
||||
bool scissor_state_set;
|
||||
};
|
||||
|
||||
static void
|
||||
tc_call_clear(struct pipe_context *pipe, union tc_payload *payload)
|
||||
{
|
||||
struct tc_clear *p = (struct tc_clear *)payload;
|
||||
pipe->clear(pipe, p->buffers, &p->color, p->depth, p->stencil);
|
||||
pipe->clear(pipe, p->buffers, p->scissor_state_set ? &p->scissor_state : NULL, &p->color, p->depth, p->stencil);
|
||||
}
|
||||
|
||||
static void
|
||||
tc_clear(struct pipe_context *_pipe, unsigned buffers,
|
||||
tc_clear(struct pipe_context *_pipe, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth,
|
||||
unsigned stencil)
|
||||
{
|
||||
@@ -2364,6 +2366,9 @@ tc_clear(struct pipe_context *_pipe, unsigned buffers,
|
||||
struct tc_clear *p = tc_add_struct_typed_call(tc, TC_CALL_clear, tc_clear);
|
||||
|
||||
p->buffers = buffers;
|
||||
if (scissor_state)
|
||||
p->scissor_state = *scissor_state;
|
||||
p->scissor_state_set = !!scissor_state;
|
||||
p->color = *color;
|
||||
p->depth = depth;
|
||||
p->stencil = stencil;
|
||||
|
@@ -303,6 +303,8 @@ The integer capabilities:
|
||||
a compressed block is copied to/from a plain pixel of the same size.
|
||||
* ``PIPE_CAP_CLEAR_TEXTURE``: Whether `clear_texture` will be
|
||||
available in contexts.
|
||||
* ``PIPE_CAP_CLEAR_SCISSORED``: Whether `clear` can accept a scissored
|
||||
bounding box.
|
||||
* ``PIPE_CAP_DRAW_PARAMETERS``: Whether ``TGSI_SEMANTIC_BASEVERTEX``,
|
||||
``TGSI_SEMANTIC_BASEINSTANCE``, and ``TGSI_SEMANTIC_DRAWID`` are
|
||||
supported in vertex shaders.
|
||||
|
@@ -339,7 +339,7 @@ etna_blit_clear_zs_blt(struct pipe_context *pctx, struct pipe_surface *dst,
|
||||
}
|
||||
|
||||
static void
|
||||
etna_clear_blt(struct pipe_context *pctx, unsigned buffers,
|
||||
etna_clear_blt(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth, unsigned stencil)
|
||||
{
|
||||
struct etna_context *ctx = etna_context(pctx);
|
||||
|
@@ -407,7 +407,7 @@ etna_blit_clear_zs_rs(struct pipe_context *pctx, struct pipe_surface *dst,
|
||||
}
|
||||
|
||||
static void
|
||||
etna_clear_rs(struct pipe_context *pctx, unsigned buffers,
|
||||
etna_clear_rs(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth, unsigned stencil)
|
||||
{
|
||||
struct etna_context *ctx = etna_context(pctx);
|
||||
|
@@ -308,7 +308,7 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
|
||||
}
|
||||
|
||||
static void
|
||||
fd_clear(struct pipe_context *pctx, unsigned buffers,
|
||||
fd_clear(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth, unsigned stencil)
|
||||
{
|
||||
struct fd_context *ctx = fd_context(pctx);
|
||||
|
@@ -217,6 +217,7 @@ i915_clear_emit(struct pipe_context *pipe, unsigned buffers,
|
||||
*/
|
||||
void
|
||||
i915_clear_blitter(struct pipe_context *pipe, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
@@ -245,6 +246,7 @@ i915_clear_blitter(struct pipe_context *pipe, unsigned buffers,
|
||||
|
||||
void
|
||||
i915_clear_render(struct pipe_context *pipe, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
|
@@ -376,9 +376,11 @@ void i915_emit_hardware_state(struct i915_context *i915 );
|
||||
* i915_clear.c:
|
||||
*/
|
||||
void i915_clear_blitter(struct pipe_context *pipe, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil);
|
||||
void i915_clear_render(struct pipe_context *pipe, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil);
|
||||
void i915_clear_emit(struct pipe_context *pipe, unsigned buffers,
|
||||
|
@@ -636,6 +636,7 @@ clear_depth_stencil(struct iris_context *ice,
|
||||
static void
|
||||
iris_clear(struct pipe_context *ctx,
|
||||
unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *p_color,
|
||||
double depth,
|
||||
unsigned stencil)
|
||||
|
@@ -131,7 +131,7 @@ lima_damage_rect_union(struct pipe_scissor_state *rect,
|
||||
}
|
||||
|
||||
static void
|
||||
lima_clear(struct pipe_context *pctx, unsigned buffers,
|
||||
lima_clear(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth, unsigned stencil)
|
||||
{
|
||||
struct lima_context *ctx = lima_context(pctx);
|
||||
|
@@ -47,6 +47,7 @@
|
||||
void
|
||||
llvmpipe_clear(struct pipe_context *pipe,
|
||||
unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth,
|
||||
unsigned stencil)
|
||||
|
@@ -37,6 +37,7 @@ struct pipe_context;
|
||||
|
||||
extern void
|
||||
llvmpipe_clear(struct pipe_context *pipe, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil);
|
||||
|
||||
|
@@ -50,7 +50,7 @@ pack_zeta(enum pipe_format format, double depth, unsigned stencil)
|
||||
}
|
||||
|
||||
static void
|
||||
nv30_clear(struct pipe_context *pipe, unsigned buffers,
|
||||
nv30_clear(struct pipe_context *pipe, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth, unsigned stencil)
|
||||
{
|
||||
struct nv30_context *nv30 = nv30_context(pipe);
|
||||
|
@@ -248,6 +248,7 @@ bool nv50_state_validate_3d(struct nv50_context *, uint32_t);
|
||||
|
||||
/* nv50_surface.c */
|
||||
extern void nv50_clear(struct pipe_context *, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil);
|
||||
extern void nv50_init_surface_functions(struct nv50_context *);
|
||||
|
@@ -524,7 +524,7 @@ nv50_clear_texture(struct pipe_context *pipe,
|
||||
}
|
||||
|
||||
void
|
||||
nv50_clear(struct pipe_context *pipe, unsigned buffers,
|
||||
nv50_clear(struct pipe_context *pipe, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
|
@@ -356,6 +356,7 @@ bool nvc0_state_validate_3d(struct nvc0_context *, uint32_t);
|
||||
|
||||
/* nvc0_surface.c */
|
||||
extern void nvc0_clear(struct pipe_context *, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil);
|
||||
extern void nvc0_init_surface_functions(struct nvc0_context *);
|
||||
|
@@ -682,6 +682,7 @@ nvc0_clear_depth_stencil(struct pipe_context *pipe,
|
||||
|
||||
void
|
||||
nvc0_clear(struct pipe_context *pipe, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
|
@@ -125,6 +125,7 @@ static void
|
||||
panfrost_clear(
|
||||
struct pipe_context *pipe,
|
||||
unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
|
@@ -202,6 +202,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(hyperz, "RADEON_HYPERZ", FALSE)
|
||||
/* Clear currently bound buffers. */
|
||||
static void r300_clear(struct pipe_context* pipe,
|
||||
unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth,
|
||||
unsigned stencil)
|
||||
|
@@ -463,6 +463,7 @@ static bool r600_decompress_subresource(struct pipe_context *ctx,
|
||||
}
|
||||
|
||||
static void r600_clear(struct pipe_context *ctx, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
|
@@ -540,6 +540,7 @@ static void si_do_fast_color_clear(struct si_context *sctx, unsigned *buffers,
|
||||
}
|
||||
|
||||
static void si_clear(struct pipe_context *ctx, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth, unsigned stencil)
|
||||
{
|
||||
struct si_context *sctx = (struct si_context *)ctx;
|
||||
|
@@ -47,6 +47,7 @@
|
||||
*/
|
||||
void
|
||||
softpipe_clear(struct pipe_context *pipe, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
|
@@ -36,6 +36,7 @@ struct pipe_context;
|
||||
|
||||
extern void
|
||||
softpipe_clear(struct pipe_context *pipe, unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil);
|
||||
|
||||
|
@@ -230,7 +230,7 @@ try_clear(struct svga_context *svga,
|
||||
* No masking, no scissor (clear entire buffer).
|
||||
*/
|
||||
static void
|
||||
svga_clear(struct pipe_context *pipe, unsigned buffers,
|
||||
svga_clear(struct pipe_context *pipe, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
|
@@ -27,6 +27,7 @@
|
||||
static void
|
||||
swr_clear(struct pipe_context *pipe,
|
||||
unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth,
|
||||
unsigned stencil)
|
||||
|
@@ -700,13 +700,13 @@ tegra_blit(struct pipe_context *pcontext, const struct pipe_blit_info *pinfo)
|
||||
}
|
||||
|
||||
static void
|
||||
tegra_clear(struct pipe_context *pcontext, unsigned buffers,
|
||||
tegra_clear(struct pipe_context *pcontext, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth,
|
||||
unsigned stencil)
|
||||
{
|
||||
struct tegra_context *context = to_tegra_context(pcontext);
|
||||
|
||||
context->gpu->clear(context->gpu, buffers, color, depth, stencil);
|
||||
context->gpu->clear(context->gpu, buffers, NULL, color, depth, stencil);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -1744,7 +1744,7 @@ v3d_tlb_clear(struct v3d_job *job, unsigned buffers,
|
||||
}
|
||||
|
||||
static void
|
||||
v3d_clear(struct pipe_context *pctx, unsigned buffers,
|
||||
v3d_clear(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth, unsigned stencil)
|
||||
{
|
||||
struct v3d_context *v3d = v3d_context(pctx);
|
||||
|
@@ -517,7 +517,7 @@ pack_rgba(enum pipe_format format, const float *rgba)
|
||||
}
|
||||
|
||||
static void
|
||||
vc4_clear(struct pipe_context *pctx, unsigned buffers,
|
||||
vc4_clear(struct pipe_context *pctx, unsigned buffers, const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color, double depth, unsigned stencil)
|
||||
{
|
||||
struct vc4_context *vc4 = vc4_context(pctx);
|
||||
|
@@ -816,6 +816,7 @@ static void virgl_bind_fs_state(struct pipe_context *ctx,
|
||||
|
||||
static void virgl_clear(struct pipe_context *ctx,
|
||||
unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
|
@@ -812,6 +812,7 @@ zink_resource_barrier(VkCommandBuffer cmdbuf, struct zink_resource *res,
|
||||
static void
|
||||
zink_clear(struct pipe_context *pctx,
|
||||
unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *pcolor,
|
||||
double depth, unsigned stencil)
|
||||
{
|
||||
|
@@ -512,12 +512,14 @@ struct pipe_context {
|
||||
* The entire buffers are cleared (no scissor, no colormask, etc).
|
||||
*
|
||||
* \param buffers bitfield of PIPE_CLEAR_* values.
|
||||
* \param scissor_state the scissored region to clear
|
||||
* \param color pointer to a union of fiu array for each of r, g, b, a.
|
||||
* \param depth depth clear value in [0,1].
|
||||
* \param stencil stencil clear value
|
||||
*/
|
||||
void (*clear)(struct pipe_context *pipe,
|
||||
unsigned buffers,
|
||||
const struct pipe_scissor_state *scissor_state,
|
||||
const union pipe_color_union *color,
|
||||
double depth,
|
||||
unsigned stencil);
|
||||
|
@@ -817,6 +817,7 @@ enum pipe_cap
|
||||
PIPE_CAP_SHAREABLE_SHADERS,
|
||||
PIPE_CAP_COPY_BETWEEN_COMPRESSED_AND_PLAIN_FORMATS,
|
||||
PIPE_CAP_CLEAR_TEXTURE,
|
||||
PIPE_CAP_CLEAR_SCISSORED,
|
||||
PIPE_CAP_DRAW_PARAMETERS,
|
||||
PIPE_CAP_TGSI_PACK_HALF_FLOAT,
|
||||
PIPE_CAP_MULTI_DRAW_INDIRECT,
|
||||
|
@@ -2238,7 +2238,7 @@ CSMT_ITEM_NO_WAIT(nine_context_clear_fb,
|
||||
rect.x2 >= zsbuf_surf->desc.Width &&
|
||||
rect.y2 >= zsbuf_surf->desc.Height))) {
|
||||
DBG("Clear fast path\n");
|
||||
pipe->clear(pipe, bufs, &rgba, Z, Stencil);
|
||||
pipe->clear(pipe, bufs, NULL, &rgba, Z, Stencil);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -28,7 +28,7 @@ static void draw( void )
|
||||
{
|
||||
union pipe_color_union clear_color = { {1, 0, 1, 1} };
|
||||
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
ctx->flush(ctx, NULL, 0);
|
||||
|
||||
graw_save_surface_to_file(ctx, surf, NULL);
|
||||
|
@@ -185,6 +185,7 @@ draw(void)
|
||||
|
||||
info.ctx->clear(info.ctx,
|
||||
PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL,
|
||||
NULL,
|
||||
&clear_color, 1.0, 0);
|
||||
util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, NUM_VERTS);
|
||||
info.ctx->flush(info.ctx, NULL, 0);
|
||||
|
@@ -159,6 +159,7 @@ draw(void)
|
||||
|
||||
info.ctx->clear(info.ctx,
|
||||
PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL,
|
||||
NULL,
|
||||
&clear_color, 1.0, 0);
|
||||
util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, NUM_VERTS);
|
||||
info.ctx->flush(info.ctx, NULL, 0);
|
||||
|
@@ -232,7 +232,7 @@ static void draw( void )
|
||||
{
|
||||
union pipe_color_union clear_color = { {.1,.3,.5,0} };
|
||||
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
|
||||
ctx->flush(ctx, NULL, 0);
|
||||
|
||||
|
@@ -164,6 +164,7 @@ draw(void)
|
||||
|
||||
info.ctx->clear(info.ctx,
|
||||
PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL,
|
||||
NULL,
|
||||
&clear_color, 1.0, 0);
|
||||
util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, NUM_VERTS);
|
||||
info.ctx->flush(info.ctx, NULL, 0);
|
||||
|
@@ -318,7 +318,7 @@ static void draw( void )
|
||||
{
|
||||
union pipe_color_union clear_color = { {.1,.3,.5,0} };
|
||||
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
if (draw_strip)
|
||||
util_draw_arrays(ctx, PIPE_PRIM_TRIANGLE_STRIP, 0, 4);
|
||||
else
|
||||
|
@@ -168,6 +168,7 @@ draw(void)
|
||||
|
||||
info.ctx->clear(info.ctx,
|
||||
PIPE_CLEAR_COLOR | PIPE_CLEAR_DEPTHSTENCIL,
|
||||
NULL,
|
||||
&clear_color, 1.0, 0);
|
||||
|
||||
q1 = info.ctx->create_query(info.ctx, PIPE_QUERY_OCCLUSION_COUNTER, 0);
|
||||
|
@@ -148,7 +148,7 @@ static void draw( void )
|
||||
{
|
||||
union pipe_color_union clear_color = { {.5,.5,.5,1} };
|
||||
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
util_draw_arrays(ctx, PIPE_PRIM_QUADS, 0, 4);
|
||||
ctx->flush(ctx, NULL, 0);
|
||||
|
||||
|
@@ -106,7 +106,7 @@ static void draw( void )
|
||||
{
|
||||
union pipe_color_union clear_color = { {.5,.5,.5,1} };
|
||||
|
||||
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4);
|
||||
info.ctx->flush(info.ctx, NULL, 0);
|
||||
|
||||
|
@@ -148,7 +148,7 @@ static void draw( void )
|
||||
|
||||
ctx->bind_fs_state(ctx, fs);
|
||||
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, 1);
|
||||
ctx->flush(ctx, NULL, 0);
|
||||
|
||||
|
@@ -127,7 +127,7 @@ static void draw( void )
|
||||
clear_color.f[2] = 0.5;
|
||||
clear_color.f[3] = 1.0;
|
||||
|
||||
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
|
||||
info.ctx->set_sampler_views(info.ctx, PIPE_SHADER_FRAGMENT, 0, 1, &linear_sv);
|
||||
set_vertices(vertices1, 4);
|
||||
|
@@ -107,7 +107,7 @@ static void draw(void)
|
||||
clear_color.f[2] = 0.5;
|
||||
clear_color.f[3] = 1.0;
|
||||
|
||||
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
util_draw_arrays(info.ctx, PIPE_PRIM_QUADS, 0, 4);
|
||||
info.ctx->flush(info.ctx, NULL, 0);
|
||||
|
||||
|
@@ -162,7 +162,7 @@ static void draw( void )
|
||||
{
|
||||
union pipe_color_union clear_color = { {1,0,1,1} };
|
||||
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
util_draw_arrays(ctx, PIPE_PRIM_TRIANGLES, 0, 3);
|
||||
ctx->flush(ctx, NULL, 0);
|
||||
|
||||
|
@@ -188,7 +188,7 @@ static void draw( void )
|
||||
union pipe_color_union clear_color = { {1,0,1,1} };
|
||||
struct pipe_draw_info info;
|
||||
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
|
||||
|
||||
util_draw_init_info(&info);
|
||||
|
@@ -106,7 +106,7 @@ static void draw( void )
|
||||
{
|
||||
union pipe_color_union clear_color = { {1,0,1,1} };
|
||||
|
||||
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
util_draw_arrays(info.ctx, PIPE_PRIM_TRIANGLES, 0, 3);
|
||||
info.ctx->flush(info.ctx, NULL, 0);
|
||||
|
||||
|
@@ -103,7 +103,7 @@ static void draw( void )
|
||||
{
|
||||
union pipe_color_union clear_color = { {1,0,1,1} };
|
||||
|
||||
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
info.ctx->clear(info.ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
util_draw_arrays(info.ctx, PIPE_PRIM_TRIANGLES, 0, 3);
|
||||
info.ctx->flush(info.ctx, NULL, 0);
|
||||
|
||||
|
@@ -220,7 +220,7 @@ static void draw( void )
|
||||
{
|
||||
union pipe_color_union clear_color = { {.1,.3,.5,0} };
|
||||
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, &clear_color, 0, 0);
|
||||
ctx->clear(ctx, PIPE_CLEAR_COLOR, NULL, &clear_color, 0, 0);
|
||||
util_draw_arrays(ctx, PIPE_PRIM_POINTS, 0, ARRAY_SIZE(vertices));
|
||||
ctx->flush(ctx, NULL, 0);
|
||||
|
||||
|
@@ -309,7 +309,7 @@ static void draw(struct program *p)
|
||||
cso_set_framebuffer(p->cso, &p->framebuffer);
|
||||
|
||||
/* clear the render target */
|
||||
p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR, &p->clear_color, 0, 0);
|
||||
p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR, NULL, &p->clear_color, 0, 0);
|
||||
|
||||
/* set misc state we care about */
|
||||
cso_set_blend(p->cso, &p->blend);
|
||||
|
@@ -246,7 +246,7 @@ static void draw(struct program *p)
|
||||
cso_set_framebuffer(p->cso, &p->framebuffer);
|
||||
|
||||
/* clear the render target */
|
||||
p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR, &p->clear_color, 0, 0);
|
||||
p->pipe->clear(p->pipe, PIPE_CLEAR_COLOR, NULL, &p->clear_color, 0, 0);
|
||||
|
||||
/* set misc state we care about */
|
||||
cso_set_blend(p->cso, &p->blend);
|
||||
|
@@ -432,6 +432,7 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
|
||||
= ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
|
||||
GLbitfield quad_buffers = 0x0;
|
||||
GLbitfield clear_buffers = 0x0;
|
||||
bool have_scissor_buffers = false;
|
||||
GLuint i;
|
||||
|
||||
st_flush_bitmap_cache(st);
|
||||
@@ -462,12 +463,14 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
|
||||
unsigned surf_colormask =
|
||||
util_format_colormask(util_format_description(strb->surface->format));
|
||||
|
||||
if (is_scissor_enabled(ctx, rb) ||
|
||||
bool scissor = is_scissor_enabled(ctx, rb);
|
||||
if ((scissor && !st->can_scissor_clear) ||
|
||||
is_window_rectangle_enabled(ctx) ||
|
||||
((colormask & surf_colormask) != surf_colormask))
|
||||
quad_buffers |= PIPE_CLEAR_COLOR0 << i;
|
||||
else
|
||||
clear_buffers |= PIPE_CLEAR_COLOR0 << i;
|
||||
have_scissor_buffers |= scissor && st->can_scissor_clear;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,10 +513,31 @@ st_Clear(struct gl_context *ctx, GLbitfield mask)
|
||||
* renderbuffers, because it's likely to be faster.
|
||||
*/
|
||||
if (clear_buffers) {
|
||||
const struct gl_scissor_rect *scissor = &ctx->Scissor.ScissorArray[0];
|
||||
struct pipe_scissor_state scissor_state = {
|
||||
.minx = MAX2(scissor->X, 0),
|
||||
.miny = MAX2(scissor->Y, 0),
|
||||
.maxx = MAX2(scissor->X + scissor->Width, 0),
|
||||
.maxy = MAX2(scissor->Y + scissor->Height, 0),
|
||||
|
||||
};
|
||||
|
||||
/* Now invert Y if needed.
|
||||
* Gallium drivers use the convention Y=0=top for surfaces.
|
||||
*/
|
||||
if (st->state.fb_orientation == Y_0_TOP) {
|
||||
const struct gl_framebuffer *fb = ctx->DrawBuffer;
|
||||
/* use intermediate variables to avoid uint underflow */
|
||||
GLint miny, maxy;
|
||||
miny = fb->Height - scissor_state.maxy;
|
||||
maxy = fb->Height - scissor_state.miny;
|
||||
scissor_state.miny = MAX2(miny, 0);
|
||||
scissor_state.maxy = MAX2(maxy, 0);
|
||||
}
|
||||
/* We can't translate the clear color to the colorbuffer format,
|
||||
* because different colorbuffers may have different formats.
|
||||
*/
|
||||
st->pipe->clear(st->pipe, clear_buffers,
|
||||
st->pipe->clear(st->pipe, clear_buffers, have_scissor_buffers ? &scissor_state : NULL,
|
||||
(union pipe_color_union*)&ctx->Color.ClearColor,
|
||||
ctx->Depth.Clear, ctx->Stencil.Clear);
|
||||
}
|
||||
|
@@ -182,6 +182,10 @@ struct st_context
|
||||
boolean draw_needs_minmax_index;
|
||||
boolean has_hw_atomics;
|
||||
|
||||
|
||||
/* driver supports scissored clears */
|
||||
boolean can_scissor_clear;
|
||||
|
||||
/* Some state is contained in constant objects.
|
||||
* Other state is just parameter values.
|
||||
*/
|
||||
|
@@ -984,6 +984,8 @@ st_api_create_context(struct st_api *stapi, struct st_manager *smapi,
|
||||
}
|
||||
}
|
||||
|
||||
st->can_scissor_clear = !!st->pipe->screen->get_param(st->pipe->screen, PIPE_CAP_CLEAR_SCISSORED);
|
||||
|
||||
st->invalidate_on_gl_viewport =
|
||||
smapi->get_param(smapi, ST_MANAGER_BROKEN_INVALIDATE);
|
||||
|
||||
|
Reference in New Issue
Block a user