summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/cso_cache
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/cso_cache')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c19
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;