summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/cso_cache/cso_context.c
diff options
context:
space:
mode:
authorMichal Krol <michal@vmware.com>2010-01-05 11:04:50 +0100
committerMichal Krol <michal@vmware.com>2010-01-05 11:04:50 +0100
commit9b21b3c52a8a7d58d08151d1a6bf25c472dec213 (patch)
treed9083b6af4e2e9b70a7fa6cd31bac45a36e0f6b6 /src/gallium/auxiliary/cso_cache/cso_context.c
parent543b9566bdaa48fea2df1866fa1310c1cdbcde27 (diff)
parent1f9aa38f4e2be47229d92be2c1189c2b8d9c7133 (diff)
Merge branch 'master' into instanced-arrays
Conflicts: src/gallium/auxiliary/tgsi/tgsi_dump.c src/gallium/include/pipe/p_shader_tokens.h
Diffstat (limited to 'src/gallium/auxiliary/cso_cache/cso_context.c')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 80bd0c91db..2b16332e14 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -42,6 +42,7 @@
#include "cso_cache/cso_context.h"
#include "cso_cache/cso_cache.h"
#include "cso_cache/cso_hash.h"
+#include "cso_context.h"
struct cso_context {
struct pipe_context *pipe;
@@ -85,8 +86,8 @@ struct cso_context {
void *blend, *blend_saved;
void *depth_stencil, *depth_stencil_saved;
void *rasterizer, *rasterizer_saved;
- void *fragment_shader, *fragment_shader_saved;
- void *vertex_shader, *vertex_shader_saved;
+ void *fragment_shader, *fragment_shader_saved, *geometry_shader;
+ void *vertex_shader, *vertex_shader_saved, *geometry_shader_saved;
struct pipe_framebuffer_state fb, fb_saved;
struct pipe_viewport_state vp, vp_saved;
@@ -1027,3 +1028,38 @@ enum pipe_error cso_set_blend_color(struct cso_context *ctx,
}
return PIPE_OK;
}
+
+enum pipe_error cso_set_geometry_shader_handle(struct cso_context *ctx,
+ void *handle)
+{
+ if (ctx->geometry_shader != handle) {
+ ctx->geometry_shader = handle;
+ ctx->pipe->bind_gs_state(ctx->pipe, handle);
+ }
+ return PIPE_OK;
+}
+
+void cso_delete_geometry_shader(struct cso_context *ctx, void *handle)
+{
+ if (handle == ctx->geometry_shader) {
+ /* unbind before deleting */
+ ctx->pipe->bind_gs_state(ctx->pipe, NULL);
+ ctx->geometry_shader = NULL;
+ }
+ ctx->pipe->delete_gs_state(ctx->pipe, handle);
+}
+
+void cso_save_geometry_shader(struct cso_context *ctx)
+{
+ assert(!ctx->geometry_shader_saved);
+ ctx->geometry_shader_saved = ctx->geometry_shader;
+}
+
+void cso_restore_geometry_shader(struct cso_context *ctx)
+{
+ 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;
+ }
+ ctx->geometry_shader_saved = NULL;
+}