diff options
author | Dave Airlie <[email protected]> | 2011-10-09 16:35:28 +0100 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2011-10-09 16:36:41 +0100 |
commit | dd20256a1c1566f11e1fa970028f3bb4f05445b7 (patch) | |
tree | b070d32d594aea04f2234727699625092d4ccc53 /src/gallium | |
parent | ee1487953bdbe8694fc76b9fe398d0384cd9e3b4 (diff) |
u_blitter: don't create integer vertex elements unless shader supports them
Should fix https://bugs.freedesktop.org/show_bug.cgi?id=41613
We don't want to create these vertex elements unless the pipe driver
vertex stage can handle integers.
Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/util/u_blitter.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index 1f8b6790398..73d1af05800 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -109,6 +109,7 @@ struct blitter_context_priv unsigned dst_height; boolean has_geometry_shader; + boolean vertex_has_integers; }; static void blitter_draw_rectangle(struct blitter_context *blitter, @@ -152,6 +153,9 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) ctx->has_geometry_shader = pipe->screen->get_shader_param(pipe->screen, PIPE_SHADER_GEOMETRY, PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0; + ctx->vertex_has_integers = + pipe->screen->get_shader_param(pipe->screen, PIPE_SHADER_GEOMETRY, + PIPE_SHADER_CAP_INTEGERS); /* blend state objects */ memset(&blend, 0, sizeof(blend)); @@ -211,27 +215,30 @@ struct blitter_context *util_blitter_create(struct pipe_context *pipe) } ctx->velem_state = pipe->create_vertex_elements_state(pipe, 2, &velem[0]); - memset(&velem[0], 0, sizeof(velem[0]) * 2); - for (i = 0; i < 2; i++) { - velem[i].src_offset = i * 4 * sizeof(float); - if (i == 0) { - velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; - } else { - velem[i].src_format = PIPE_FORMAT_R32G32B32A32_SINT; + if (ctx->vertex_has_integers) { + memset(&velem[0], 0, sizeof(velem[0]) * 2); + for (i = 0; i < 2; i++) { + velem[i].src_offset = i * 4 * sizeof(float); + if (i == 0) { + velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + } else { + velem[i].src_format = PIPE_FORMAT_R32G32B32A32_SINT; + } } - } - ctx->velem_sint_state = pipe->create_vertex_elements_state(pipe, 2, &velem[0]); - - memset(&velem[0], 0, sizeof(velem[0]) * 2); - for (i = 0; i < 2; i++) { - velem[i].src_offset = i * 4 * sizeof(float); - if (i == 0) { - velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; - } else { - velem[i].src_format = PIPE_FORMAT_R32G32B32A32_UINT; + ctx->velem_sint_state = pipe->create_vertex_elements_state(pipe, 2, &velem[0]); + + memset(&velem[0], 0, sizeof(velem[0]) * 2); + for (i = 0; i < 2; i++) { + velem[i].src_offset = i * 4 * sizeof(float); + if (i == 0) { + velem[i].src_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + } else { + velem[i].src_format = PIPE_FORMAT_R32G32B32A32_UINT; + } } + ctx->velem_uint_state = pipe->create_vertex_elements_state(pipe, 2, &velem[0]); } - ctx->velem_uint_state = pipe->create_vertex_elements_state(pipe, 2, &velem[0]); + /* fragment shaders are created on-demand */ /* vertex shader */ @@ -274,8 +281,10 @@ void util_blitter_destroy(struct blitter_context *blitter) pipe->delete_rasterizer_state(pipe, ctx->rs_state); pipe->delete_vs_state(pipe, ctx->vs); pipe->delete_vertex_elements_state(pipe, ctx->velem_state); - pipe->delete_vertex_elements_state(pipe, ctx->velem_sint_state); - pipe->delete_vertex_elements_state(pipe, ctx->velem_uint_state); + if (ctx->vertex_has_integers) { + pipe->delete_vertex_elements_state(pipe, ctx->velem_sint_state); + pipe->delete_vertex_elements_state(pipe, ctx->velem_uint_state); + } for (i = 0; i < PIPE_MAX_TEXTURE_TYPES; i++) { if (ctx->fs_texfetch_col[i]) |