They are done with instancing.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Brian Paul <brianp@vmware.com>
}
void util_blitter_draw_rectangle(struct blitter_context *blitter,
}
void util_blitter_draw_rectangle(struct blitter_context *blitter,
- int x1, int y1, int x2, int y2, float depth,
+ int x1, int y1, int x2, int y2,
+ float depth, unsigned num_instances,
enum blitter_attrib_type type,
const union blitter_attrib *attrib)
{
enum blitter_attrib_type type,
const union blitter_attrib *attrib)
{
- blitter_draw(ctx, x1, y1, x2, y2, depth, 1);
+ blitter_draw(ctx, x1, y1, x2, y2, depth, num_instances);
}
static void *get_clear_blend_state(struct blitter_context_priv *ctx,
}
static void *get_clear_blend_state(struct blitter_context_priv *ctx,
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
bind_fs_write_all_cbufs(ctx);
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
bind_fs_write_all_cbufs(ctx);
+ union blitter_attrib attrib;
+ memcpy(attrib.color, color->ui, sizeof(color->ui));
+
if (num_layers > 1 && ctx->has_layered) {
blitter_set_common_draw_rect_state(ctx, false, true);
if (num_layers > 1 && ctx->has_layered) {
blitter_set_common_draw_rect_state(ctx, false, true);
- blitter_set_clear_color(ctx, color->f);
- blitter_draw(ctx, 0, 0, width, height, depth, num_layers);
- }
- else {
- union blitter_attrib attrib;
-
- memcpy(attrib.color, color->ui, sizeof(color->ui));
+ blitter->draw_rectangle(blitter, 0, 0, width, height, (float) depth,
+ num_layers, UTIL_BLITTER_ATTRIB_COLOR, &attrib);
+ } else {
blitter_set_common_draw_rect_state(ctx, false, false);
blitter->draw_rectangle(blitter, 0, 0, width, height, (float) depth,
blitter_set_common_draw_rect_state(ctx, false, false);
blitter->draw_rectangle(blitter, 0, 0, width, height, (float) depth,
- UTIL_BLITTER_ATTRIB_COLOR, &attrib);
+ 1, UTIL_BLITTER_ATTRIB_COLOR, &attrib);
}
util_blitter_restore_vertex_states(blitter);
}
util_blitter_restore_vertex_states(blitter);
pipe->set_sample_mask(pipe, ~0);
ctx->base.draw_rectangle(&ctx->base, dstbox->x, dstbox->y,
dstbox->x + dstbox->width,
pipe->set_sample_mask(pipe, ~0);
ctx->base.draw_rectangle(&ctx->base, dstbox->x, dstbox->y,
dstbox->x + dstbox->width,
- dstbox->y + dstbox->height, 0,
+ dstbox->y + dstbox->height, 0, 1,
UTIL_BLITTER_ATTRIB_TEXCOORD, &coord);
} else {
/* Draw the quad with the generic codepath. */
UTIL_BLITTER_ATTRIB_TEXCOORD, &coord);
} else {
/* Draw the quad with the generic codepath. */
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
+ union blitter_attrib attrib;
+ memcpy(attrib.color, color->ui, sizeof(color->ui));
+
num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1;
if (num_layers > 1 && ctx->has_layered) {
blitter_set_common_draw_rect_state(ctx, false, true);
num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1;
if (num_layers > 1 && ctx->has_layered) {
blitter_set_common_draw_rect_state(ctx, false, true);
- blitter_set_clear_color(ctx, color->f);
- blitter_draw(ctx, dstx, dsty, dstx+width, dsty+height, 0, num_layers);
- }
- else {
- union blitter_attrib attrib;
-
- memcpy(attrib.color, color->ui, sizeof(color->ui));
+ blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
+ num_layers, UTIL_BLITTER_ATTRIB_COLOR, &attrib);
+ } else {
blitter_set_common_draw_rect_state(ctx, false, false);
blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
blitter_set_common_draw_rect_state(ctx, false, false);
blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
- UTIL_BLITTER_ATTRIB_COLOR, &attrib);
+ 1, UTIL_BLITTER_ATTRIB_COLOR, &attrib);
}
util_blitter_restore_vertex_states(blitter);
}
util_blitter_restore_vertex_states(blitter);
num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1;
if (num_layers > 1 && ctx->has_layered) {
blitter_set_common_draw_rect_state(ctx, false, true);
num_layers = dstsurf->u.tex.last_layer - dstsurf->u.tex.first_layer + 1;
if (num_layers > 1 && ctx->has_layered) {
blitter_set_common_draw_rect_state(ctx, false, true);
- blitter_draw(ctx, dstx, dsty, dstx+width, dsty+height, (float) depth, num_layers);
- }
- else {
+ blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height,
+ depth, num_layers,
+ UTIL_BLITTER_ATTRIB_NONE, NULL);
+ } else {
blitter_set_common_draw_rect_state(ctx, false, false);
blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height,
blitter_set_common_draw_rect_state(ctx, false, false);
blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height,
UTIL_BLITTER_ATTRIB_NONE, NULL);
}
UTIL_BLITTER_ATTRIB_NONE, NULL);
}
blitter_set_common_draw_rect_state(ctx, false, false);
blitter_set_dst_dimensions(ctx, zsurf->width, zsurf->height);
blitter->draw_rectangle(blitter, 0, 0, zsurf->width, zsurf->height, depth,
blitter_set_common_draw_rect_state(ctx, false, false);
blitter_set_dst_dimensions(ctx, zsurf->width, zsurf->height);
blitter->draw_rectangle(blitter, 0, 0, zsurf->width, zsurf->height, depth,
- UTIL_BLITTER_ATTRIB_NONE, NULL);
+ 1, UTIL_BLITTER_ATTRIB_NONE, NULL);
util_blitter_restore_vertex_states(blitter);
util_blitter_restore_fragment_states(blitter);
util_blitter_restore_vertex_states(blitter);
util_blitter_restore_fragment_states(blitter);
blitter_set_common_draw_rect_state(ctx, false, false);
blitter_set_dst_dimensions(ctx, src->width0, src->height0);
blitter->draw_rectangle(blitter, 0, 0, src->width0, src->height0,
blitter_set_common_draw_rect_state(ctx, false, false);
blitter_set_dst_dimensions(ctx, src->width0, src->height0);
blitter->draw_rectangle(blitter, 0, 0, src->width0, src->height0,
util_blitter_restore_fb_state(blitter);
util_blitter_restore_vertex_states(blitter);
util_blitter_restore_fragment_states(blitter);
util_blitter_restore_fb_state(blitter);
util_blitter_restore_vertex_states(blitter);
util_blitter_restore_fragment_states(blitter);
blitter_set_common_draw_rect_state(ctx, false, false);
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
blitter->draw_rectangle(blitter, 0, 0, dstsurf->width, dstsurf->height,
blitter_set_common_draw_rect_state(ctx, false, false);
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
blitter->draw_rectangle(blitter, 0, 0, dstsurf->width, dstsurf->height,
util_blitter_restore_vertex_states(blitter);
util_blitter_restore_fragment_states(blitter);
util_blitter_restore_vertex_states(blitter);
util_blitter_restore_fragment_states(blitter);
*/
void (*draw_rectangle)(struct blitter_context *blitter,
int x1, int y1, int x2, int y2,
*/
void (*draw_rectangle)(struct blitter_context *blitter,
int x1, int y1, int x2, int y2,
+ float depth, unsigned num_instances,
enum blitter_attrib_type type,
const union blitter_attrib *attrib);
enum blitter_attrib_type type,
const union blitter_attrib *attrib);
/* The default function to draw a rectangle. This can only be used
* inside of the draw_rectangle callback if the driver overrides it. */
void util_blitter_draw_rectangle(struct blitter_context *blitter,
/* The default function to draw a rectangle. This can only be used
* inside of the draw_rectangle callback if the driver overrides it. */
void util_blitter_draw_rectangle(struct blitter_context *blitter,
- int x1, int y1, int x2, int y2, float depth,
+ int x1, int y1, int x2, int y2,
+ float depth, unsigned num_instances,
enum blitter_attrib_type type,
const union blitter_attrib *attrib);
enum blitter_attrib_type type,
const union blitter_attrib *attrib);
void r500_emit_index_bias(struct r300_context *r300, int index_bias);
void r300_blitter_draw_rectangle(struct blitter_context *blitter,
int x1, int y1, int x2, int y2,
void r500_emit_index_bias(struct r300_context *r300, int index_bias);
void r300_blitter_draw_rectangle(struct blitter_context *blitter,
int x1, int y1, int x2, int y2,
+ float depth, unsigned num_instances,
enum blitter_attrib_type type,
const union blitter_attrib *attrib);
enum blitter_attrib_type type,
const union blitter_attrib *attrib);
* somewhat inefficient. Instead we use a rectangular point sprite. */
void r300_blitter_draw_rectangle(struct blitter_context *blitter,
int x1, int y1, int x2, int y2,
* somewhat inefficient. Instead we use a rectangular point sprite. */
void r300_blitter_draw_rectangle(struct blitter_context *blitter,
int x1, int y1, int x2, int y2,
+ float depth, unsigned num_instances,
enum blitter_attrib_type type,
const union blitter_attrib *attrib)
{
enum blitter_attrib_type type,
const union blitter_attrib *attrib)
{
/* XXX workaround for a lockup in MSAA resolve on SWTCL chipsets, this
* function most probably doesn't handle type=NONE correctly */
/* XXX workaround for a lockup in MSAA resolve on SWTCL chipsets, this
* function most probably doesn't handle type=NONE correctly */
- if (!r300->screen->caps.has_tcl && type == UTIL_BLITTER_ATTRIB_NONE) {
- util_blitter_draw_rectangle(blitter, x1, y1, x2, y2, depth, type, attrib);
+ if ((!r300->screen->caps.has_tcl && type == UTIL_BLITTER_ATTRIB_NONE) ||
+ num_instances > 1) {
+ util_blitter_draw_rectangle(blitter, x1, y1, x2, y2, depth,
+ num_instances, type, attrib);
}
void r600_draw_rectangle(struct blitter_context *blitter,
}
void r600_draw_rectangle(struct blitter_context *blitter,
- int x1, int y1, int x2, int y2, float depth,
+ int x1, int y1, int x2, int y2,
+ float depth, unsigned num_instances,
enum blitter_attrib_type type,
const union blitter_attrib *attrib)
{
enum blitter_attrib_type type,
const union blitter_attrib *attrib)
{
- util_draw_vertex_buffer(&rctx->b, NULL, buf, blitter->vb_slot, offset,
- R600_PRIM_RECTANGLE_LIST, 3, 2);
+ struct pipe_vertex_buffer vbuffer = {};
+ vbuffer.buffer.resource = buf;
+ vbuffer.stride = 2 * 4 * sizeof(float); /* vertex size */
+ vbuffer.buffer_offset = offset;
+
+ rctx->b.set_vertex_buffers(&rctx->b, blitter->vb_slot, 1, &vbuffer);
+ util_draw_arrays_instanced(&rctx->b, R600_PRIM_RECTANGLE_LIST, 0, 3,
+ 0, num_instances);
pipe_resource_reference(&buf, NULL);
}
pipe_resource_reference(&buf, NULL);
}
void r600_gfx_wait_fence(struct r600_common_context *ctx,
uint64_t va, uint32_t ref, uint32_t mask);
void r600_draw_rectangle(struct blitter_context *blitter,
void r600_gfx_wait_fence(struct r600_common_context *ctx,
uint64_t va, uint32_t ref, uint32_t mask);
void r600_draw_rectangle(struct blitter_context *blitter,
- int x1, int y1, int x2, int y2, float depth,
+ int x1, int y1, int x2, int y2,
+ float depth, unsigned num_instances,
enum blitter_attrib_type type,
const union blitter_attrib *attrib);
bool r600_common_screen_init(struct r600_common_screen *rscreen,
enum blitter_attrib_type type,
const union blitter_attrib *attrib);
bool r600_common_screen_init(struct r600_common_screen *rscreen,