summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/pipe/cso_cache/cso_cache.h10
-rw-r--r--src/mesa/pipe/failover/fo_context.h4
-rw-r--r--src/mesa/pipe/failover/fo_state.c75
-rw-r--r--src/mesa/pipe/failover/fo_state_emit.c6
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c28
-rw-r--r--src/mesa/pipe/p_context.h23
-rw-r--r--src/mesa/pipe/softpipe/sp_state.h11
-rw-r--r--src/mesa/pipe/softpipe/sp_state_fs.c27
-rw-r--r--src/mesa/state_tracker/st_atom_fs.c12
-rw-r--r--src/mesa/state_tracker/st_atom_vs.c18
-rw-r--r--src/mesa/state_tracker/st_cache.c36
-rw-r--r--src/mesa/state_tracker/st_cache.h12
-rw-r--r--src/mesa/state_tracker/st_cb_clear.c8
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c8
-rw-r--r--src/mesa/state_tracker/st_cb_rasterpos.c3
-rw-r--r--src/mesa/state_tracker/st_context.h4
-rw-r--r--src/mesa/state_tracker/st_draw.c6
-rw-r--r--src/mesa/state_tracker/st_program.h10
18 files changed, 181 insertions, 120 deletions
diff --git a/src/mesa/pipe/cso_cache/cso_cache.h b/src/mesa/pipe/cso_cache/cso_cache.h
index cd4b64eec4..57d162b2ac 100644
--- a/src/mesa/pipe/cso_cache/cso_cache.h
+++ b/src/mesa/pipe/cso_cache/cso_cache.h
@@ -58,6 +58,16 @@ struct cso_rasterizer {
void *data;
};
+struct cso_fragment_shader {
+ struct pipe_shader_state state;
+ void *data;
+};
+
+struct cso_vertex_shader {
+ struct pipe_shader_state state;
+ void *data;
+};
+
enum cso_cache_type {
CSO_BLEND,
CSO_SAMPLER,
diff --git a/src/mesa/pipe/failover/fo_context.h b/src/mesa/pipe/failover/fo_context.h
index a649899010..a81bfe82dd 100644
--- a/src/mesa/pipe/failover/fo_context.h
+++ b/src/mesa/pipe/failover/fo_context.h
@@ -74,8 +74,8 @@ struct failover_context {
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_state *depth_stencil;
const struct fo_state *rasterizer;
- const struct pipe_shader_state *fragment_shader;
- const struct pipe_shader_state *vertex_shader;
+ const struct fo_state *fragment_shader;
+ const struct fo_state *vertex_shader;
struct pipe_alpha_test_state alpha_test;
struct pipe_blend_color blend_color;
diff --git a/src/mesa/pipe/failover/fo_state.c b/src/mesa/pipe/failover/fo_state.c
index 25725625e0..db3aea7756 100644
--- a/src/mesa/pipe/failover/fo_state.c
+++ b/src/mesa/pipe/failover/fo_state.c
@@ -150,26 +150,81 @@ failover_set_framebuffer_state(struct pipe_context *pipe,
failover->hw->set_framebuffer_state( failover->hw, framebuffer );
}
+
+static void *
+failover_create_fs_state(struct pipe_context *pipe,
+ const struct pipe_shader_state *templ)
+{
+ struct fo_state *state = malloc(sizeof(struct fo_state));
+ struct failover_context *failover = failover_context(pipe);
+
+ state->sw_state = failover->sw->create_fs_state(pipe, templ);
+ state->hw_state = failover->hw->create_fs_state(pipe, templ);
+
+ return state;
+}
+
static void
failover_bind_fs_state(struct pipe_context *pipe,
- const struct pipe_shader_state *fs)
+ void *fs)
{
struct failover_context *failover = failover_context(pipe);
- failover->fragment_shader = fs;
+ failover->fragment_shader = (struct fo_state *)fs;
failover->dirty |= FO_NEW_FRAGMENT_SHADER;
- failover->hw->bind_fs_state( failover->hw, fs );
+ failover->hw->bind_fs_state(failover->hw, (struct pipe_shader_state *)fs);
+}
+
+static void
+failover_delete_fs_state(struct pipe_context *pipe,
+ void *fs)
+{
+ struct fo_state *state = (struct fo_state*)fs;
+ struct failover_context *failover = failover_context(pipe);
+
+ failover->sw->delete_fs_state(pipe, state->sw_state);
+ failover->hw->delete_fs_state(pipe, state->hw_state);
+ state->sw_state = 0;
+ state->hw_state = 0;
+ free(state);
+}
+
+static void *
+failover_create_vs_state(struct pipe_context *pipe,
+ const struct pipe_shader_state *templ)
+{
+ struct fo_state *state = malloc(sizeof(struct fo_state));
+ struct failover_context *failover = failover_context(pipe);
+
+ state->sw_state = failover->sw->create_vs_state(pipe, templ);
+ state->hw_state = failover->hw->create_vs_state(pipe, templ);
+
+ return state;
}
static void
failover_bind_vs_state(struct pipe_context *pipe,
- const struct pipe_shader_state *vs)
+ void *vs)
{
struct failover_context *failover = failover_context(pipe);
- failover->vertex_shader = vs;
+ failover->vertex_shader = (struct fo_state*)vs;
failover->dirty |= FO_NEW_VERTEX_SHADER;
- failover->hw->bind_vs_state( failover->hw, vs );
+ failover->hw->bind_vs_state(failover->hw, vs);
+}
+
+static void
+failover_delete_vs_state(struct pipe_context *pipe,
+ void *vs)
+{
+ struct fo_state *state = (struct fo_state*)vs;
+ struct failover_context *failover = failover_context(pipe);
+
+ failover->sw->delete_vs_state(pipe, state->sw_state);
+ failover->hw->delete_vs_state(pipe, state->hw_state);
+ state->sw_state = 0;
+ state->hw_state = 0;
+ free(state);
}
static void
@@ -312,8 +367,12 @@ failover_init_state_functions( struct failover_context *failover )
failover->pipe.create_rasterizer_state = failover_create_rasterizer_state;
failover->pipe.bind_rasterizer_state = failover_bind_rasterizer_state;
failover->pipe.delete_rasterizer_state = failover_delete_rasterizer_state;
- failover->pipe.bind_fs_state = failover_bind_fs_state;
- failover->pipe.bind_vs_state = failover_bind_vs_state;
+ failover->pipe.create_fs_state = failover_create_fs_state;
+ failover->pipe.bind_fs_state = failover_bind_fs_state;
+ failover->pipe.delete_fs_state = failover_delete_fs_state;
+ failover->pipe.create_vs_state = failover_create_vs_state;
+ failover->pipe.bind_vs_state = failover_bind_vs_state;
+ failover->pipe.delete_vs_state = failover_delete_vs_state;
failover->pipe.set_alpha_test_state = failover_set_alpha_test_state;
failover->pipe.set_blend_color = failover_set_blend_color;
diff --git a/src/mesa/pipe/failover/fo_state_emit.c b/src/mesa/pipe/failover/fo_state_emit.c
index f2b0b1edc0..ec896fd020 100644
--- a/src/mesa/pipe/failover/fo_state_emit.c
+++ b/src/mesa/pipe/failover/fo_state_emit.c
@@ -78,10 +78,12 @@ failover_state_emit( struct failover_context *failover )
failover->sw->set_framebuffer_state( failover->sw, &failover->framebuffer );
if (failover->dirty & FO_NEW_FRAGMENT_SHADER)
- failover->sw->bind_fs_state( failover->sw, failover->fragment_shader );
+ failover->sw->bind_fs_state( failover->sw,
+ failover->fragment_shader->sw_state );
if (failover->dirty & FO_NEW_VERTEX_SHADER)
- failover->sw->bind_vs_state( failover->sw, failover->vertex_shader );
+ failover->sw->bind_vs_state( failover->sw,
+ failover->vertex_shader->sw_state );
if (failover->dirty & FO_NEW_STIPPLE)
failover->sw->set_polygon_stipple( failover->sw, &failover->poly_stipple );
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index 66aa9a0274..1104c9519d 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -228,41 +228,37 @@ static void i915_set_polygon_stipple( struct pipe_context *pipe,
}
-static const struct pipe_shader_state *
-i915_create_shader_state( struct pipe_context *pipe,
- const struct pipe_shader_state *templ )
+static void *
+i915_create_shader_state(struct pipe_context *pipe,
+ const struct pipe_shader_state *templ)
{
-
- struct pipe_shader_state *shader = malloc(sizeof(struct pipe_shader_state));
- memcpy(shader, templ, sizeof(struct pipe_shader_state));
-
- return shader;
+ return 0;
}
static void i915_bind_fs_state( struct pipe_context *pipe,
- const struct pipe_shader_state *fs )
+ void *fs )
{
struct i915_context *i915 = i915_context(pipe);
- i915->fs = fs;
+ i915->fs = (struct pipe_shader_state *)fs;
i915->dirty |= I915_NEW_FS;
}
-static void i915_bind_vs_state( struct pipe_context *pipe,
- const struct pipe_shader_state *vs )
+static void i915_bind_vs_state(struct pipe_context *pipe,
+ void *vs)
{
struct i915_context *i915 = i915_context(pipe);
/* just pass-through to draw module */
- draw_set_vertex_shader(i915->draw, vs);
+ draw_set_vertex_shader(i915->draw, (const struct pipe_shader_state *)vs);
}
-static void i915_delete_shader_state( struct pipe_context *pipe,
- const struct pipe_shader_state *shader )
+static void i915_delete_shader_state(struct pipe_context *pipe,
+ void *shader)
{
- free((struct pipe_shader_state*)shader);
+ /*do nothing*/
}
static void i915_set_constant_buffer(struct pipe_context *pipe,
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index 65001dfdf9..e17faad2c7 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -113,20 +113,15 @@ struct pipe_context {
void (*delete_depth_stencil_state)(struct pipe_context *,
const struct pipe_depth_stencil_state *);
- const struct pipe_shader_state * (*create_fs_state)(
- struct pipe_context *,
- const struct pipe_shader_state *);
- void (*bind_fs_state)(struct pipe_context *,
- const struct pipe_shader_state *);
- void (*delete_fs_state)(struct pipe_context *,
- const struct pipe_shader_state *);
- const struct pipe_shader_state * (*create_vs_state)(
- struct pipe_context *,
- const struct pipe_shader_state *);
- void (*bind_vs_state)(struct pipe_context *,
- const struct pipe_shader_state *);
- void (*delete_vs_state)(struct pipe_context *,
- const struct pipe_shader_state *);
+ void * (*create_fs_state)(struct pipe_context *,
+ const struct pipe_shader_state *);
+ void (*bind_fs_state)(struct pipe_context *, void *);
+ void (*delete_fs_state)(struct pipe_context *, void *);
+
+ void * (*create_vs_state)(struct pipe_context *,
+ const struct pipe_shader_state *);
+ void (*bind_vs_state)(struct pipe_context *, void *);
+ void (*delete_vs_state)(struct pipe_context *, void *);
void (*set_alpha_test_state)( struct pipe_context *,
const struct pipe_alpha_test_state * );
diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h
index a20ae1d4a2..5ed963c21d 100644
--- a/src/mesa/pipe/softpipe/sp_state.h
+++ b/src/mesa/pipe/softpipe/sp_state.h
@@ -88,15 +88,12 @@ void softpipe_set_constant_buffer(struct pipe_context *,
void softpipe_set_feedback_state( struct pipe_context *,
const struct pipe_feedback_state * );
-const struct pipe_shader_state *
+void *
softpipe_create_shader_state( struct pipe_context *,
const struct pipe_shader_state * );
-void softpipe_bind_fs_state( struct pipe_context *,
- const struct pipe_shader_state * );
-void softpipe_bind_vs_state( struct pipe_context *,
- const struct pipe_shader_state * );
-void softpipe_delete_shader_state( struct pipe_context *,
- const struct pipe_shader_state * );
+void softpipe_bind_fs_state( struct pipe_context *, void * );
+void softpipe_bind_vs_state( struct pipe_context *, void * );
+void softpipe_delete_shader_state( struct pipe_context *, void * );
void softpipe_set_polygon_stipple( struct pipe_context *,
const struct pipe_poly_stipple * );
diff --git a/src/mesa/pipe/softpipe/sp_state_fs.c b/src/mesa/pipe/softpipe/sp_state_fs.c
index fbbde2f520..8306a95f44 100644
--- a/src/mesa/pipe/softpipe/sp_state_fs.c
+++ b/src/mesa/pipe/softpipe/sp_state_fs.c
@@ -33,44 +33,39 @@
#include "pipe/draw/draw_context.h"
-const struct pipe_shader_state *
-softpipe_create_shader_state( struct pipe_context *pipe,
- const struct pipe_shader_state *templ )
+void * softpipe_create_shader_state(struct pipe_context *pipe,
+ const struct pipe_shader_state *templ)
{
- struct pipe_shader_state *shader = malloc(sizeof(struct pipe_shader_state));
- memcpy(shader, templ, sizeof(struct pipe_shader_state));
-
- return shader;
+ /* we just want the pipe_shader_state template in the bind calls */
+ return 0;
}
-void softpipe_bind_fs_state( struct pipe_context *pipe,
- const struct pipe_shader_state *fs )
+void softpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- softpipe->fs = fs;
+ softpipe->fs = (struct pipe_shader_state *)fs;
softpipe->dirty |= SP_NEW_FS;
}
-void softpipe_bind_vs_state( struct pipe_context *pipe,
- const struct pipe_shader_state *vs )
+void softpipe_bind_vs_state(struct pipe_context *pipe, void *vs)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- softpipe->vs = vs;
+ softpipe->vs = (struct pipe_shader_state *)vs;
softpipe->dirty |= SP_NEW_VS;
- draw_set_vertex_shader(softpipe->draw, vs);
+ draw_set_vertex_shader(softpipe->draw, (struct pipe_shader_state *)vs);
}
void softpipe_delete_shader_state( struct pipe_context *pipe,
- const struct pipe_shader_state *shader )
+ void *shader )
{
- free((struct pipe_shader_state*)shader);
+ /* do nothing */
}
void softpipe_set_constant_buffer(struct pipe_context *pipe,
diff --git a/src/mesa/state_tracker/st_atom_fs.c b/src/mesa/state_tracker/st_atom_fs.c
index 94b69c8df7..91e58f5831 100644
--- a/src/mesa/state_tracker/st_atom_fs.c
+++ b/src/mesa/state_tracker/st_atom_fs.c
@@ -51,14 +51,14 @@
* Translate a Mesa fragment shader into a TGSI shader.
* \return pointer to cached pipe_shader object.
*/
-struct pipe_shader_state *
+const struct cso_fragment_shader *
st_translate_fragment_shader(struct st_context *st,
struct st_fragment_program *stfp)
{
GLuint outputMapping[FRAG_RESULT_MAX];
GLuint inputMapping[PIPE_MAX_SHADER_INPUTS];
struct pipe_shader_state fs;
- struct pipe_shader_state *cached;
+ const struct cso_fragment_shader *cso;
GLuint interpMode[16]; /* XXX size? */
GLuint i;
GLbitfield inputsRead = stfp->Base.Base.InputsRead;
@@ -142,15 +142,15 @@ st_translate_fragment_shader(struct st_context *st,
fs.tokens = &stfp->tokens[0];
- cached = st_cached_fs_state(st, &fs);
- stfp->fs = cached;
+ cso = st_cached_fs_state(st, &fs);
+ stfp->fs = cso;
if (TGSI_DEBUG)
tgsi_dump( stfp->tokens, 0/*TGSI_DUMP_VERBOSE*/ );
stfp->dirty = 0;
- return cached;
+ return cso;
}
@@ -183,7 +183,7 @@ static void update_fs( struct st_context *st )
if (stfp->dirty)
st->state.fs = st_translate_fragment_shader( st, st->fp );
- st->pipe->bind_fs_state(st->pipe, st->state.fs);
+ st->pipe->bind_fs_state(st->pipe, st->state.fs->data);
}
}
diff --git a/src/mesa/state_tracker/st_atom_vs.c b/src/mesa/state_tracker/st_atom_vs.c
index cf9dd810e9..078c052ae2 100644
--- a/src/mesa/state_tracker/st_atom_vs.c
+++ b/src/mesa/state_tracker/st_atom_vs.c
@@ -53,13 +53,13 @@
* Translate a Mesa vertex shader into a TGSI shader.
* \return pointer to cached pipe_shader object.
*/
-struct pipe_shader_state *
+const struct cso_vertex_shader *
st_translate_vertex_shader(struct st_context *st,
struct st_vertex_program *stvp)
{
GLuint outputMapping[PIPE_MAX_SHADER_INPUTS];
struct pipe_shader_state vs;
- struct pipe_shader_state *cached;
+ const struct cso_vertex_shader *cso;
GLuint i;
memset(&vs, 0, sizeof(vs));
@@ -147,8 +147,8 @@ st_translate_vertex_shader(struct st_context *st,
vs.tokens = &stvp->tokens[0];
- cached = st_cached_vs_state(st, &vs);
- stvp->vs = cached;
+ cso = st_cached_vs_state(st, &vs);
+ stvp->vs = cso;
if (TGSI_DEBUG)
tgsi_dump( stvp->tokens, 0 );
@@ -157,13 +157,13 @@ st_translate_vertex_shader(struct st_context *st,
if (stvp->sse2_program.csr == stvp->sse2_program.store)
tgsi_emit_sse2( stvp->tokens, &stvp->sse2_program );
- if (!cached->executable)
- cached->executable = (void *) x86_get_func( &stvp->sse2_program );
+ if (!cso->state.executable)
+ cso->state.executable = (void *) x86_get_func( &stvp->sse2_program );
#endif
stvp->dirty = 0;
- return cached;
+ return cso;
}
@@ -191,10 +191,10 @@ static void update_vs( struct st_context *st )
/* Bind the vertex program */
st->vp = stvp;
- if (stvp->dirty)
+ if (stvp->dirty)
st->state.vs = st_translate_vertex_shader( st, st->vp );
- st->pipe->bind_vs_state(st->pipe, st->state.vs);
+ st->pipe->bind_vs_state(st->pipe, st->state.vs->data);
}
}
diff --git a/src/mesa/state_tracker/st_cache.c b/src/mesa/state_tracker/st_cache.c
index 0f233cea58..e5ba0592cf 100644
--- a/src/mesa/state_tracker/st_cache.c
+++ b/src/mesa/state_tracker/st_cache.c
@@ -115,9 +115,9 @@ const struct cso_rasterizer* st_cached_rasterizer_state(
return (struct cso_rasterizer*)(cso_hash_iter_data(iter));
}
-struct pipe_shader_state * st_cached_fs_state(
- struct st_context *st,
- const struct pipe_shader_state *templ)
+const struct cso_fragment_shader *
+st_cached_fs_state(struct st_context *st,
+ const struct pipe_shader_state *templ)
{
unsigned hash_key = cso_construct_key((void*)templ,
sizeof(struct pipe_shader_state));
@@ -125,17 +125,19 @@ struct pipe_shader_state * st_cached_fs_state(
hash_key, CSO_FRAGMENT_SHADER,
(void*)templ);
if (cso_hash_iter_is_null(iter)) {
- const struct pipe_shader_state *created_state =
- st->pipe->create_fs_state(st->pipe, templ);
- iter = cso_insert_state(st->cache, hash_key, CSO_FRAGMENT_SHADER,
- (void*)created_state);
+ struct cso_fragment_shader *cso = malloc(sizeof(struct cso_fragment_shader));
+ memcpy(&cso->state, templ, sizeof(struct pipe_shader_state));
+ cso->data = st->pipe->create_fs_state(st->pipe, templ);
+ if (!cso->data)
+ cso->data = &cso->state;
+ iter = cso_insert_state(st->cache, hash_key, CSO_FRAGMENT_SHADER, cso);
}
- return (struct pipe_shader_state*)(cso_hash_iter_data(iter));
+ return (struct cso_fragment_shader*)(cso_hash_iter_data(iter));
}
-struct pipe_shader_state * st_cached_vs_state(
- struct st_context *st,
- const struct pipe_shader_state *templ)
+const struct cso_vertex_shader *
+st_cached_vs_state(struct st_context *st,
+ const struct pipe_shader_state *templ)
{
unsigned hash_key = cso_construct_key((void*)templ,
sizeof(struct pipe_shader_state));
@@ -143,10 +145,12 @@ struct pipe_shader_state * st_cached_vs_state(
hash_key, CSO_VERTEX_SHADER,
(void*)templ);
if (cso_hash_iter_is_null(iter)) {
- const struct pipe_shader_state *created_state =
- st->pipe->create_vs_state(st->pipe, templ);
- iter = cso_insert_state(st->cache, hash_key, CSO_VERTEX_SHADER,
- (void*)created_state);
+ struct cso_vertex_shader *cso = malloc(sizeof(struct cso_vertex_shader));
+ memcpy(&cso->state, templ, sizeof(struct pipe_shader_state));
+ cso->data = st->pipe->create_vs_state(st->pipe, templ);
+ if (!cso->data)
+ cso->data = &cso->state;
+ iter = cso_insert_state(st->cache, hash_key, CSO_VERTEX_SHADER, cso);
}
- return (struct pipe_shader_state*)(cso_hash_iter_data(iter));
+ return (struct cso_vertex_shader*)(cso_hash_iter_data(iter));
}
diff --git a/src/mesa/state_tracker/st_cache.h b/src/mesa/state_tracker/st_cache.h
index 5b8c6168a8..356dd98183 100644
--- a/src/mesa/state_tracker/st_cache.h
+++ b/src/mesa/state_tracker/st_cache.h
@@ -55,13 +55,13 @@ const struct cso_rasterizer *
st_cached_rasterizer_state(struct st_context *st,
const struct pipe_rasterizer_state *raster);
-struct pipe_shader_state *st_cached_fs_state(
- struct st_context *st,
- const struct pipe_shader_state *templ);
+const struct cso_fragment_shader *
+st_cached_fs_state(struct st_context *st,
+ const struct pipe_shader_state *templ);
-struct pipe_shader_state *st_cached_vs_state(
- struct st_context *st,
- const struct pipe_shader_state *templ);
+const struct cso_vertex_shader *
+st_cached_vs_state(struct st_context *st,
+ const struct pipe_shader_state *templ);
#endif
diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c
index ee70ce3320..03a81652cb 100644
--- a/src/mesa/state_tracker/st_cb_clear.c
+++ b/src/mesa/state_tracker/st_cb_clear.c
@@ -348,7 +348,7 @@ clear_with_quad(GLcontext *ctx,
if (!stfp) {
stfp = make_frag_shader(st);
}
- pipe->bind_fs_state(pipe, stfp->fs);
+ pipe->bind_fs_state(pipe, stfp->fs->data);
}
/* vertex shader state: color/position pass-through */
@@ -357,7 +357,7 @@ clear_with_quad(GLcontext *ctx,
if (!stvp) {
stvp = make_vertex_shader(st);
}
- pipe->bind_vs_state(pipe, stvp->vs);
+ pipe->bind_vs_state(pipe, stvp->vs->data);
}
/* viewport state: viewport matching window dims */
@@ -383,8 +383,8 @@ clear_with_quad(GLcontext *ctx,
pipe->set_alpha_test_state(pipe, &st->state.alpha_test);
pipe->bind_blend_state(pipe, st->state.blend->data);
pipe->bind_depth_stencil_state(pipe, st->state.depth_stencil);
- pipe->bind_fs_state(pipe, st->state.fs);
- pipe->bind_vs_state(pipe, st->state.vs);
+ pipe->bind_fs_state(pipe, st->state.fs->data);
+ pipe->bind_vs_state(pipe, st->state.vs->data);
pipe->bind_rasterizer_state(pipe, st->state.rasterizer->data);
pipe->set_viewport_state(pipe, &ctx->st->state.viewport);
/* OR:
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index d4f260ee54..4e3c24353e 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -330,7 +330,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
if (!stfp) {
stfp = make_fragment_shader(ctx->st);
}
- pipe->bind_fs_state(pipe, stfp->fs);
+ pipe->bind_fs_state(pipe, stfp->fs->data);
}
/* vertex shader state: position + texcoord pass-through */
@@ -339,7 +339,7 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
if (!stvp) {
stvp = make_vertex_shader(ctx->st);
}
- pipe->bind_vs_state(pipe, stvp->vs);
+ pipe->bind_vs_state(pipe, stvp->vs->data);
}
/* texture sampling state: */
@@ -393,8 +393,8 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z,
/* restore GL state */
pipe->bind_rasterizer_state(pipe, ctx->st->state.rasterizer->data);
- pipe->bind_fs_state(pipe, ctx->st->state.fs);
- pipe->bind_vs_state(pipe, ctx->st->state.vs);
+ pipe->bind_fs_state(pipe, ctx->st->state.fs->data);
+ pipe->bind_vs_state(pipe, ctx->st->state.vs->data);
pipe->set_texture_state(pipe, unit, ctx->st->state.texture[unit]);
pipe->bind_sampler_state(pipe, unit, ctx->st->state.sampler[unit]);
pipe->set_viewport_state(pipe, &ctx->st->state.viewport);
diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c
index 5245535a65..04b2016ffc 100644
--- a/src/mesa/state_tracker/st_cb_rasterpos.c
+++ b/src/mesa/state_tracker/st_cb_rasterpos.c
@@ -35,6 +35,7 @@
#include "st_context.h"
#include "st_atom.h"
+#include "st_cache.h"
#include "st_draw.h"
#include "st_program.h"
#include "st_cb_rasterpos.h"
@@ -88,7 +89,7 @@ static void
setup_feedback(GLcontext *ctx)
{
struct pipe_context *pipe = ctx->st->pipe;
- const struct pipe_shader_state *vs = ctx->st->state.vs;
+ const struct pipe_shader_state *vs = &ctx->st->state.vs->state;
struct pipe_feedback_state feedback;
uint i;
diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h
index 93b6425480..df976260f8 100644
--- a/src/mesa/state_tracker/st_context.h
+++ b/src/mesa/state_tracker/st_context.h
@@ -79,8 +79,8 @@ struct st_context
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_state *depth_stencil;
const struct cso_rasterizer *rasterizer;
- const struct pipe_shader_state *fs;
- const struct pipe_shader_state *vs;
+ const struct cso_fragment_shader *fs;
+ const struct cso_vertex_shader *vs;
struct pipe_alpha_test_state alpha_test;
struct pipe_blend_color blend_color;
diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index 238ade00ac..633e4d9470 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -198,7 +198,7 @@ st_draw_vbo(GLcontext *ctx,
/* must get these after state validation! */
vp = ctx->st->vp;
- vs = ctx->st->state.vs;
+ vs = &ctx->st->state.vs->state;
/* loop over TGSI shader inputs */
for (attr = 0; attr < vs->num_inputs; attr++) {
@@ -405,8 +405,8 @@ st_feedback_draw_vbo(GLcontext *ctx,
assert(draw);
draw_set_viewport_state(draw, &st->state.viewport);
draw_set_clip_state(draw, &st->state.clip);
- draw_set_rasterizer_state(draw, st->state.rasterizer->data);
- draw_set_vertex_shader(draw, st->state.vs);
+ draw_set_rasterizer_state(draw, &st->state.rasterizer->state);
+ draw_set_vertex_shader(draw, &st->state.vs->state);
/* XXX need to set vertex info too */
diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h
index 4945141d15..4f9ace3e6a 100644
--- a/src/mesa/state_tracker/st_program.h
+++ b/src/mesa/state_tracker/st_program.h
@@ -40,6 +40,8 @@
#define ST_FP_MAX_TOKENS 1024
+struct cso_fragment_shader;
+struct cso_vertex_shader;
struct st_fragment_program
{
@@ -52,7 +54,7 @@ struct st_fragment_program
GLboolean dirty;
/** Pointer to the corresponding cached shader */
- const struct pipe_shader_state *fs;
+ const struct cso_fragment_shader *fs;
GLuint param_state;
};
@@ -83,7 +85,7 @@ struct st_vertex_program
#endif
/** Pointer to the corresponding cached shader */
- const struct pipe_shader_state *vs;
+ const struct cso_vertex_shader *vs;
GLuint param_state;
};
@@ -105,12 +107,12 @@ st_vertex_program( struct gl_vertex_program *vp )
}
-extern struct pipe_shader_state *
+extern const struct cso_fragment_shader *
st_translate_fragment_shader(struct st_context *st,
struct st_fragment_program *fp);
-extern struct pipe_shader_state *
+extern const struct cso_vertex_shader *
st_translate_vertex_shader(struct st_context *st,
struct st_vertex_program *vp);