aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_cb_clear.c
diff options
context:
space:
mode:
authorIlia Mirkin <[email protected]>2014-11-15 13:29:25 -0500
committerIlia Mirkin <[email protected]>2014-11-17 22:17:49 -0500
commit68db29c434e144891e5990b032b44495de52f6eb (patch)
tree1aeda9293c643f2dc47a3194199b3d877e512866 /src/mesa/state_tracker/st_cb_clear.c
parent7b8e04b3f0b66bda84cb1ab4f89239f357d9cb64 (diff)
st/mesa: add a fallback for clear_with_quad when no vs_layer
Not all drivers can set gl_Layer from VS. Add a fallback that passes the instance id from VS to GS, and then uses the GS to set the layer. Tested by adding quad_buffers |= clear_buffers; clear_buffers = 0; to the st_Clear logic, and forcing set_vertex_shader_layered in all cases. No piglit regressions (on piglits with 'clear' in the name). Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Cc: "10.4 10.3" <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker/st_cb_clear.c')
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index 3a359f31885..45dea594ee7 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -88,6 +88,14 @@ st_destroy_clear(struct st_context *st)
cso_delete_vertex_shader(st->cso_context, st->clear.vs);
st->clear.vs = NULL;
}
+ if (st->clear.vs_layered) {
+ cso_delete_vertex_shader(st->cso_context, st->clear.vs_layered);
+ st->clear.vs_layered = NULL;
+ }
+ if (st->clear.gs_layered) {
+ cso_delete_geometry_shader(st->cso_context, st->clear.gs_layered);
+ st->clear.gs_layered = NULL;
+ }
}
@@ -128,6 +136,7 @@ set_vertex_shader(struct st_context *st)
}
cso_set_vertex_shader_handle(st->cso_context, st->clear.vs);
+ cso_set_geometry_shader_handle(st->cso_context, NULL);
}
@@ -136,18 +145,25 @@ set_vertex_shader_layered(struct st_context *st)
{
struct pipe_context *pipe = st->pipe;
- if (!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_INSTANCEID) ||
- !pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT)) {
- assert(!"Got layered clear, but the VS layer output is unsupported");
+ if (!pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_INSTANCEID)) {
+ assert(!"Got layered clear, but VS instancing is unsupported");
set_vertex_shader(st);
return;
}
if (!st->clear.vs_layered) {
- st->clear.vs_layered = util_make_layered_clear_vertex_shader(pipe);
+ bool vs_layer =
+ pipe->screen->get_param(pipe->screen, PIPE_CAP_TGSI_VS_LAYER_VIEWPORT);
+ if (vs_layer) {
+ st->clear.vs_layered = util_make_layered_clear_vertex_shader(pipe);
+ } else {
+ st->clear.vs_layered = util_make_layered_clear_helper_vertex_shader(pipe);
+ st->clear.gs_layered = util_make_layered_clear_geometry_shader(pipe);
+ }
}
cso_set_vertex_shader_handle(st->cso_context, st->clear.vs_layered);
+ cso_set_geometry_shader_handle(st->cso_context, st->clear.gs_layered);
}
@@ -331,7 +347,6 @@ clear_with_quad(struct gl_context *ctx, unsigned clear_buffers)
}
set_fragment_shader(st);
- cso_set_geometry_shader_handle(st->cso_context, NULL);
if (num_layers > 1)
set_vertex_shader_layered(st);