diff options
author | Marek Olšák <[email protected]> | 2011-11-04 18:10:16 +0100 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2011-11-04 23:01:47 +0100 |
commit | d2633af696f2e4ff98f669061e4e222e8643312c (patch) | |
tree | e7c4b33370aeba5f6133fb89e7c0716350f30635 /src/gallium/auxiliary/cso_cache/cso_context.c | |
parent | 794c5158b0a0b2978ebae6fdc2747e6febcd42c1 (diff) |
st/mesa: set geometry shader to NULL when doing internal drawing
The code expects the geometry shader to be NULL.
We don't have geometry shaders now, but it's good to be prepared.
v2: check for support in the cso context
Diffstat (limited to 'src/gallium/auxiliary/cso_cache/cso_context.c')
-rw-r--r-- | src/gallium/auxiliary/cso_cache/cso_context.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index b91fe1a8633..b2a2b79b09a 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -78,6 +78,8 @@ struct cso_context { struct pipe_context *pipe; struct cso_cache *cache; + boolean has_geometry_shader; + struct sampler_info fragment_samplers; struct sampler_info vertex_samplers; @@ -270,6 +272,11 @@ struct cso_context *cso_create_context( struct pipe_context *pipe ) /* Enable for testing: */ if (0) cso_set_maximum_cache_size( ctx->cache, 4 ); + if (pipe->screen->get_shader_param(pipe->screen, PIPE_SHADER_GEOMETRY, + PIPE_SHADER_CAP_MAX_INSTRUCTIONS) > 0) { + ctx->has_geometry_shader = TRUE; + } + return ctx; out: @@ -785,7 +792,9 @@ void cso_restore_stencil_ref(struct cso_context *ctx) enum pipe_error cso_set_geometry_shader_handle(struct cso_context *ctx, void *handle) { - if (ctx->geometry_shader != handle) { + assert(ctx->has_geometry_shader || !handle); + + if (ctx->has_geometry_shader && ctx->geometry_shader != handle) { ctx->geometry_shader = handle; ctx->pipe->bind_gs_state(ctx->pipe, handle); } @@ -804,12 +813,20 @@ void cso_delete_geometry_shader(struct cso_context *ctx, void *handle) void cso_save_geometry_shader(struct cso_context *ctx) { + if (!ctx->has_geometry_shader) { + return; + } + assert(!ctx->geometry_shader_saved); ctx->geometry_shader_saved = ctx->geometry_shader; } void cso_restore_geometry_shader(struct cso_context *ctx) { + if (!ctx->has_geometry_shader) { + return; + } + if (ctx->geometry_shader_saved != ctx->geometry_shader) { ctx->pipe->bind_gs_state(ctx->pipe, ctx->geometry_shader_saved); ctx->geometry_shader = ctx->geometry_shader_saved; |