/* Constant state objects. */
/* Vertex shaders. */
void *vs; /**< Vertex shader which passes {pos, generic} to the output.*/
- void *vs_pos_only[4]; /**< Vertex shader which passes pos to the output.*/
+ void *vs_nogeneric;
+ void *vs_pos_only[4]; /**< Vertex shader which passes pos to the output
+ for clear_buffer/copy_buffer.*/
void *vs_layered; /**< Vertex shader which sets LAYER = INSTANCEID. */
/* Fragment shaders. */
pipe->bind_vs_state(pipe, ctx->vs_pos_only[index]);
}
-static void bind_vs_passthrough(struct blitter_context_priv *ctx)
+static void bind_vs_passthrough_pos_generic(struct blitter_context_priv *ctx)
{
struct pipe_context *pipe = ctx->base.pipe;
pipe->bind_vs_state(pipe, ctx->vs);
}
+static void bind_vs_passthrough_pos(struct blitter_context_priv *ctx)
+{
+ struct pipe_context *pipe = ctx->base.pipe;
+
+ if (!ctx->vs_nogeneric) {
+ const uint semantic_names[] = { TGSI_SEMANTIC_POSITION };
+ const uint semantic_indices[] = { 0 };
+
+ ctx->vs_nogeneric =
+ util_make_vertex_passthrough_shader(pipe, 1,
+ semantic_names,
+ semantic_indices, false);
+ }
+
+ pipe->bind_vs_state(pipe, ctx->vs_nogeneric);
+}
+
static void bind_vs_layered(struct blitter_context_priv *ctx)
{
struct pipe_context *pipe = ctx->base.pipe;
pipe->delete_rasterizer_state(pipe, ctx->rs_discard_state);
if (ctx->vs)
pipe->delete_vs_state(pipe, ctx->vs);
+ if (ctx->vs_nogeneric)
+ pipe->delete_vs_state(pipe, ctx->vs_nogeneric);
for (i = 0; i < 4; i++)
if (ctx->vs_pos_only[i])
pipe->delete_vs_state(pipe, ctx->vs_pos_only[i]);
static void blitter_set_common_draw_rect_state(struct blitter_context_priv *ctx,
bool scissor,
- bool vs_layered)
+ bool vs_layered,
+ bool vs_pass_generic)
{
struct pipe_context *pipe = ctx->base.pipe;
: ctx->rs_state);
if (vs_layered)
bind_vs_layered(ctx);
+ else if (vs_pass_generic)
+ bind_vs_passthrough_pos_generic(ctx);
else
- bind_vs_passthrough(ctx);
+ bind_vs_passthrough_pos(ctx);
if (ctx->has_geometry_shader)
pipe->bind_gs_state(pipe, NULL);
union blitter_attrib attrib;
memcpy(attrib.color, color->ui, sizeof(color->ui));
+ bool pass_generic = (clear_buffers & PIPE_CLEAR_COLOR) != 0;
+ enum blitter_attrib_type type = pass_generic ? UTIL_BLITTER_ATTRIB_COLOR :
+ UTIL_BLITTER_ATTRIB_NONE;
+
if (num_layers > 1 && ctx->has_layered) {
- blitter_set_common_draw_rect_state(ctx, false, true);
+ blitter_set_common_draw_rect_state(ctx, false, true, pass_generic);
blitter->draw_rectangle(blitter, 0, 0, width, height, (float) depth,
- num_layers, UTIL_BLITTER_ATTRIB_COLOR, &attrib);
+ num_layers, type, &attrib);
} else {
- blitter_set_common_draw_rect_state(ctx, false, false);
+ blitter_set_common_draw_rect_state(ctx, false, false, pass_generic);
blitter->draw_rectangle(blitter, 0, 0, width, height, (float) depth,
- 1, UTIL_BLITTER_ATTRIB_COLOR, &attrib);
+ 1, type, &attrib);
}
util_blitter_restore_vertex_states(blitter);
pipe->set_scissor_states(pipe, 0, 1, scissor);
}
- blitter_set_common_draw_rect_state(ctx, scissor != NULL, false);
+ blitter_set_common_draw_rect_state(ctx, scissor != NULL, false, true);
do_blits(ctx, dst, dstbox, src, src_width0, src_height0,
srcbox, blit_depth || blit_stencil, use_txf);
0, 1, &sampler_state);
pipe->bind_vertex_elements_state(pipe, ctx->velem_state);
- blitter_set_common_draw_rect_state(ctx, false, false);
+ blitter_set_common_draw_rect_state(ctx, false, false, true);
for (src_level = base_level; src_level < last_level; src_level++) {
struct pipe_box dstbox = {0}, srcbox = {0};
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_common_draw_rect_state(ctx, false, true, true);
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_set_common_draw_rect_state(ctx, false, false, true);
blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height, 0,
1, UTIL_BLITTER_ATTRIB_COLOR, &attrib);
}
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_common_draw_rect_state(ctx, false, true, false);
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_set_common_draw_rect_state(ctx, false, false, false);
blitter->draw_rectangle(blitter, dstx, dsty, dstx+width, dsty+height,
depth, 1,
UTIL_BLITTER_ATTRIB_NONE, NULL);
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, sample_mask);
- blitter_set_common_draw_rect_state(ctx, false, false);
+ blitter_set_common_draw_rect_state(ctx, false, false, false);
blitter_set_dst_dimensions(ctx, zsurf->width, zsurf->height);
blitter->draw_rectangle(blitter, 0, 0, zsurf->width, zsurf->height, depth,
1, UTIL_BLITTER_ATTRIB_NONE, NULL);
fb_state.zsbuf = NULL;
pipe->set_framebuffer_state(pipe, &fb_state);
- blitter_set_common_draw_rect_state(ctx, false, false);
+ blitter_set_common_draw_rect_state(ctx, false, false, false);
blitter_set_dst_dimensions(ctx, src->width0, src->height0);
blitter->draw_rectangle(blitter, 0, 0, src->width0, src->height0,
0, 1, 0, NULL);
pipe->set_framebuffer_state(pipe, &fb_state);
pipe->set_sample_mask(pipe, ~0);
- blitter_set_common_draw_rect_state(ctx, false, false);
+ blitter_set_common_draw_rect_state(ctx, false, false, false);
blitter_set_dst_dimensions(ctx, dstsurf->width, dstsurf->height);
blitter->draw_rectangle(blitter, 0, 0, dstsurf->width, dstsurf->height,
0, 1, 0, NULL);