summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/cso_cache/cso_cache.c13
-rw-r--r--src/mesa/pipe/cso_cache/cso_cache.h4
-rw-r--r--src/mesa/pipe/failover/fo_context.h4
-rw-r--r--src/mesa/pipe/failover/fo_state.c19
-rw-r--r--src/mesa/pipe/failover/fo_state_emit.c4
-rw-r--r--src/mesa/pipe/i915simple/i915_context.h2
-rw-r--r--src/mesa/pipe/i915simple/i915_fpc.h2
-rw-r--r--src/mesa/pipe/i915simple/i915_fpc_translate.c8
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c27
-rw-r--r--src/mesa/pipe/i915simple/i915_state_derived.c2
-rw-r--r--src/mesa/pipe/p_context.h16
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c14
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h4
-rwxr-xr-xsrc/mesa/pipe/softpipe/sp_quad_fs.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_state.h14
-rw-r--r--src/mesa/pipe/softpipe/sp_state_derived.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_state_fs.c24
17 files changed, 105 insertions, 56 deletions
diff --git a/src/mesa/pipe/cso_cache/cso_cache.c b/src/mesa/pipe/cso_cache/cso_cache.c
index 4aaadf00e64..be653d9494a 100644
--- a/src/mesa/pipe/cso_cache/cso_cache.c
+++ b/src/mesa/pipe/cso_cache/cso_cache.c
@@ -80,6 +80,8 @@ static struct cso_hash *_cso_hash_for_type(struct cso_cache *sc, enum cso_cache_
hash = sc->depth_stencil_hash;
case CSO_RASTERIZER:
hash = sc->rasterizer_hash;
+ case CSO_SHADER:
+ hash = sc->shader_hash;
}
return hash;
@@ -96,6 +98,8 @@ static int _cso_size_for_type(enum cso_cache_type type)
return sizeof(struct pipe_depth_stencil_state);
case CSO_RASTERIZER:
return sizeof(struct pipe_rasterizer_state);
+ case CSO_SHADER:
+ return sizeof(struct pipe_shader_state);
}
return 0;
}
@@ -144,10 +148,11 @@ struct cso_cache *cso_cache_create(void)
{
struct cso_cache *sc = malloc(sizeof(struct cso_cache));
- sc->blend_hash = cso_hash_create();
- sc->sampler_hash = cso_hash_create();
+ sc->blend_hash = cso_hash_create();
+ sc->sampler_hash = cso_hash_create();
sc->depth_stencil_hash = cso_hash_create();
- sc->rasterizer_hash = cso_hash_create();
+ sc->rasterizer_hash = cso_hash_create();
+ sc->shader_hash = cso_hash_create();
return sc;
}
@@ -159,6 +164,6 @@ void cso_cache_delete(struct cso_cache *sc)
cso_hash_delete(sc->sampler_hash);
cso_hash_delete(sc->depth_stencil_hash);
cso_hash_delete(sc->rasterizer_hash);
+ cso_hash_delete(sc->shader_hash);
free(sc);
}
-
diff --git a/src/mesa/pipe/cso_cache/cso_cache.h b/src/mesa/pipe/cso_cache/cso_cache.h
index 23be9cd7135..d9793ca8554 100644
--- a/src/mesa/pipe/cso_cache/cso_cache.h
+++ b/src/mesa/pipe/cso_cache/cso_cache.h
@@ -44,13 +44,15 @@ struct cso_cache {
struct cso_hash *sampler_hash;
struct cso_hash *depth_stencil_hash;
struct cso_hash *rasterizer_hash;
+ struct cso_hash *shader_hash;
};
enum cso_cache_type {
CSO_BLEND,
CSO_SAMPLER,
CSO_DEPTH_STENCIL,
- CSO_RASTERIZER
+ CSO_RASTERIZER,
+ CSO_SHADER
};
unsigned cso_construct_key(void *item, int item_size);
diff --git a/src/mesa/pipe/failover/fo_context.h b/src/mesa/pipe/failover/fo_context.h
index b05ceb88adf..9556a17e4db 100644
--- a/src/mesa/pipe/failover/fo_context.h
+++ b/src/mesa/pipe/failover/fo_context.h
@@ -70,14 +70,14 @@ struct failover_context {
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_state *depth_stencil;
const struct pipe_rasterizer_state *rasterizer;
+ const struct pipe_shader_state *fragment_shader;
+ const struct pipe_shader_state *vertex_shader;
struct pipe_alpha_test_state alpha_test;
struct pipe_blend_color blend_color;
struct pipe_clear_color_state clear_color;
struct pipe_clip_state clip;
struct pipe_framebuffer_state framebuffer;
- struct pipe_shader_state fragment_shader;
- struct pipe_shader_state vertex_shader;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
diff --git a/src/mesa/pipe/failover/fo_state.c b/src/mesa/pipe/failover/fo_state.c
index 8e2b649590f..04ebd33d0d4 100644
--- a/src/mesa/pipe/failover/fo_state.c
+++ b/src/mesa/pipe/failover/fo_state.c
@@ -125,28 +125,27 @@ failover_set_framebuffer_state(struct pipe_context *pipe,
}
static void
-failover_set_fs_state(struct pipe_context *pipe,
- const struct pipe_shader_state *fs)
+failover_bind_fs_state(struct pipe_context *pipe,
+ const struct pipe_shader_state *fs)
{
struct failover_context *failover = failover_context(pipe);
- failover->fragment_shader = *fs;
+ failover->fragment_shader = fs;
failover->dirty |= FO_NEW_FRAGMENT_SHADER;
- failover->hw->set_fs_state( failover->hw, fs );
+ failover->hw->bind_fs_state( failover->hw, fs );
}
static void
-failover_set_vs_state(struct pipe_context *pipe,
+failover_bind_vs_state(struct pipe_context *pipe,
const struct pipe_shader_state *vs)
{
struct failover_context *failover = failover_context(pipe);
- failover->vertex_shader = *vs;
+ failover->vertex_shader = vs;
failover->dirty |= FO_NEW_VERTEX_SHADER;
- failover->hw->set_vs_state( failover->hw, vs );
+ failover->hw->bind_vs_state( failover->hw, vs );
}
-
static void
failover_set_polygon_stipple( struct pipe_context *pipe,
const struct pipe_poly_stipple *stipple )
@@ -258,14 +257,14 @@ failover_init_state_functions( struct failover_context *failover )
failover->pipe.bind_sampler_state = failover_bind_sampler_state;
failover->pipe.bind_depth_stencil_state = failover_bind_depth_stencil_state;
failover->pipe.bind_rasterizer_state = failover_bind_rasterizer_state;
+ failover->pipe.bind_fs_state = failover_bind_fs_state;
+ failover->pipe.bind_vs_state = failover_bind_vs_state;
failover->pipe.set_alpha_test_state = failover_set_alpha_test_state;
failover->pipe.set_blend_color = failover_set_blend_color;
failover->pipe.set_clip_state = failover_set_clip_state;
failover->pipe.set_clear_color_state = failover_set_clear_color_state;
failover->pipe.set_framebuffer_state = failover_set_framebuffer_state;
- failover->pipe.set_fs_state = failover_set_fs_state;
- failover->pipe.set_vs_state = failover_set_vs_state;
failover->pipe.set_polygon_stipple = failover_set_polygon_stipple;
failover->pipe.set_scissor_state = failover_set_scissor_state;
failover->pipe.set_texture_state = failover_set_texture_state;
diff --git a/src/mesa/pipe/failover/fo_state_emit.c b/src/mesa/pipe/failover/fo_state_emit.c
index 1c9573a7b00..9d304074d0f 100644
--- a/src/mesa/pipe/failover/fo_state_emit.c
+++ b/src/mesa/pipe/failover/fo_state_emit.c
@@ -77,10 +77,10 @@ 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->set_fs_state( failover->sw, &failover->fragment_shader );
+ failover->sw->bind_fs_state( failover->sw, failover->fragment_shader );
if (failover->dirty & FO_NEW_VERTEX_SHADER)
- failover->sw->set_vs_state( failover->sw, &failover->vertex_shader );
+ failover->sw->bind_vs_state( failover->sw, failover->vertex_shader );
if (failover->dirty & FO_NEW_STIPPLE)
failover->sw->set_polygon_stipple( failover->sw, &failover->poly_stipple );
diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h
index 3fab821fde6..9052c92d72c 100644
--- a/src/mesa/pipe/i915simple/i915_context.h
+++ b/src/mesa/pipe/i915simple/i915_context.h
@@ -127,6 +127,7 @@ struct i915_context
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_state *depth_stencil;
const struct pipe_rasterizer_state *rasterizer;
+ const struct pipe_shader_state *fs;
struct pipe_alpha_test_state alpha_test;
struct pipe_blend_color blend_color;
@@ -134,7 +135,6 @@ struct i915_context
struct pipe_clip_state clip;
struct pipe_constant_buffer constants[PIPE_SHADER_TYPES];
struct pipe_framebuffer_state framebuffer;
- struct pipe_shader_state fs;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
diff --git a/src/mesa/pipe/i915simple/i915_fpc.h b/src/mesa/pipe/i915simple/i915_fpc.h
index 59fcbf40d9f..84e4c5a6f36 100644
--- a/src/mesa/pipe/i915simple/i915_fpc.h
+++ b/src/mesa/pipe/i915simple/i915_fpc.h
@@ -44,7 +44,7 @@
* Program translation state
*/
struct i915_fp_compile {
- struct pipe_shader_state *shader;
+ const struct pipe_shader_state *shader;
struct vertex_info *vertex_info;
diff --git a/src/mesa/pipe/i915simple/i915_fpc_translate.c b/src/mesa/pipe/i915simple/i915_fpc_translate.c
index c2ad80c5d03..32c5600496a 100644
--- a/src/mesa/pipe/i915simple/i915_fpc_translate.c
+++ b/src/mesa/pipe/i915simple/i915_fpc_translate.c
@@ -872,11 +872,11 @@ i915_translate_instructions(struct i915_fp_compile *p,
static struct i915_fp_compile *
i915_init_compile(struct i915_context *i915,
- struct pipe_shader_state *fs)
+ const struct pipe_shader_state *fs)
{
struct i915_fp_compile *p = CALLOC_STRUCT(i915_fp_compile);
- p->shader = &i915->fs;
+ p->shader = i915->fs;
p->vertex_info = &i915->current.vertex_info;
@@ -1032,8 +1032,8 @@ i915_fixup_depth_write(struct i915_fp_compile *p)
void
i915_translate_fragment_program( struct i915_context *i915 )
{
- struct i915_fp_compile *p = i915_init_compile(i915, &i915->fs);
- const struct tgsi_token *tokens = i915->fs.tokens;
+ struct i915_fp_compile *p = i915_init_compile(i915, i915->fs);
+ const struct tgsi_token *tokens = i915->fs->tokens;
i915_find_wpos_space(p);
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index 1dfa10ab28e..fe835643e06 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -161,19 +161,29 @@ 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 )
+{
+
+ struct pipe_shader_state *shader = malloc(sizeof(struct pipe_shader_state));
+ memcpy(shader, templ, sizeof(struct pipe_shader_state));
+
+ return shader;
+}
-static void i915_set_fs_state( struct pipe_context *pipe,
+static void i915_bind_fs_state( struct pipe_context *pipe,
const struct pipe_shader_state *fs )
{
struct i915_context *i915 = i915_context(pipe);
- memcpy(&i915->fs, fs, sizeof(*fs));
+ i915->fs = fs;
i915->dirty |= I915_NEW_FS;
}
-static void i915_set_vs_state( struct pipe_context *pipe,
+static void i915_bind_vs_state( struct pipe_context *pipe,
const struct pipe_shader_state *vs )
{
struct i915_context *i915 = i915_context(pipe);
@@ -182,6 +192,11 @@ static void i915_set_vs_state( struct pipe_context *pipe,
draw_set_vertex_shader(i915->draw, vs);
}
+static void i915_delete_shader_state( struct pipe_context *pipe,
+ const struct pipe_shader_state *shader )
+{
+ free((struct pipe_shader_state*)shader);
+}
static void i915_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
@@ -358,6 +373,10 @@ i915_init_state_functions( struct i915_context *i915 )
i915->pipe.create_rasterizer_state = i915_create_rasterizer_state;
i915->pipe.bind_rasterizer_state = i915_bind_rasterizer_state;
i915->pipe.delete_rasterizer_state = i915_delete_rasterizer_state;
+ i915->pipe.create_shader_state = i915_create_shader_state;
+ i915->pipe.bind_fs_state = i915_bind_fs_state;
+ i915->pipe.bind_vs_state = i915_bind_vs_state;
+ i915->pipe.delete_shader_state = i915_delete_shader_state;
i915->pipe.set_alpha_test_state = i915_set_alpha_test_state;
i915->pipe.set_blend_color = i915_set_blend_color;
@@ -365,8 +384,6 @@ i915_init_state_functions( struct i915_context *i915 )
i915->pipe.set_clear_color_state = i915_set_clear_color_state;
i915->pipe.set_constant_buffer = i915_set_constant_buffer;
i915->pipe.set_framebuffer_state = i915_set_framebuffer_state;
- i915->pipe.set_fs_state = i915_set_fs_state;
- i915->pipe.set_vs_state = i915_set_vs_state;
i915->pipe.set_polygon_stipple = i915_set_polygon_stipple;
i915->pipe.set_scissor_state = i915_set_scissor_state;
i915->pipe.set_texture_state = i915_set_texture_state;
diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/mesa/pipe/i915simple/i915_state_derived.c
index 504bc10a9e4..8d404c55ab2 100644
--- a/src/mesa/pipe/i915simple/i915_state_derived.c
+++ b/src/mesa/pipe/i915simple/i915_state_derived.c
@@ -42,7 +42,7 @@
*/
static void calculate_vertex_layout( struct i915_context *i915 )
{
- const uint inputsRead = i915->fs.inputs_read;
+ const uint inputsRead = i915->fs->inputs_read;
const interp_mode colorInterp
= i915->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
struct vertex_info *vinfo = &i915->current.vertex_info;
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index dda758fe6ad..c405051bce4 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -117,6 +117,16 @@ struct pipe_context {
void (*delete_depth_stencil_state)(struct pipe_context *,
const struct pipe_depth_stencil_state *);
+ const struct pipe_shader_state * (*create_shader_state)(
+ struct pipe_context *,
+ const struct pipe_shader_state *);
+ void (*bind_fs_state)(struct pipe_context *,
+ const struct pipe_shader_state *);
+ void (*bind_vs_state)(struct pipe_context *,
+ const struct pipe_shader_state *);
+ void (*delete_shader_state)(struct pipe_context *,
+ const struct pipe_shader_state *);
+
void (*set_alpha_test_state)( struct pipe_context *,
const struct pipe_alpha_test_state * );
@@ -139,12 +149,6 @@ struct pipe_context {
void (*set_framebuffer_state)( struct pipe_context *,
const struct pipe_framebuffer_state * );
- void (*set_fs_state)( struct pipe_context *,
- const struct pipe_shader_state * );
-
- void (*set_vs_state)( struct pipe_context *,
- const struct pipe_shader_state * );
-
void (*set_polygon_stipple)( struct pipe_context *,
const struct pipe_poly_stipple * );
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index cf5fc2227ed..25cb9d87450 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -251,17 +251,21 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
/* state setters */
softpipe->pipe.create_blend_state = softpipe_create_blend_state;
- softpipe->pipe.bind_blend_state = softpipe_bind_blend_state;
+ softpipe->pipe.bind_blend_state = softpipe_bind_blend_state;
softpipe->pipe.delete_blend_state = softpipe_delete_blend_state;
softpipe->pipe.create_sampler_state = softpipe_create_sampler_state;
- softpipe->pipe.bind_sampler_state = softpipe_bind_sampler_state;
+ softpipe->pipe.bind_sampler_state = softpipe_bind_sampler_state;
softpipe->pipe.delete_sampler_state = softpipe_delete_sampler_state;
softpipe->pipe.create_depth_stencil_state = softpipe_create_depth_stencil_state;
- softpipe->pipe.bind_depth_stencil_state = softpipe_bind_depth_stencil_state;
+ softpipe->pipe.bind_depth_stencil_state = softpipe_bind_depth_stencil_state;
softpipe->pipe.delete_depth_stencil_state = softpipe_delete_depth_stencil_state;
softpipe->pipe.create_rasterizer_state = softpipe_create_rasterizer_state;
- softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state;
+ softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state;
softpipe->pipe.delete_rasterizer_state = softpipe_delete_rasterizer_state;
+ softpipe->pipe.create_shader_state = softpipe_create_shader_state;
+ softpipe->pipe.bind_fs_state = softpipe_bind_fs_state;
+ softpipe->pipe.bind_vs_state = softpipe_bind_vs_state;
+ softpipe->pipe.delete_shader_state = softpipe_delete_shader_state;
softpipe->pipe.set_alpha_test_state = softpipe_set_alpha_test_state;
softpipe->pipe.set_blend_color = softpipe_set_blend_color;
@@ -270,8 +274,6 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
softpipe->pipe.set_constant_buffer = softpipe_set_constant_buffer;
softpipe->pipe.set_feedback_state = softpipe_set_feedback_state;
softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state;
- softpipe->pipe.set_fs_state = softpipe_set_fs_state;
- softpipe->pipe.set_vs_state = softpipe_set_vs_state;
softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
softpipe->pipe.set_scissor_state = softpipe_set_scissor_state;
softpipe->pipe.set_texture_state = softpipe_set_texture_state;
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index f1bb3d39a66..5c17c47b128 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -74,6 +74,8 @@ struct softpipe_context {
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_state *depth_stencil;
const struct pipe_rasterizer_state *rasterizer;
+ const struct pipe_shader_state *fs;
+ const struct pipe_shader_state *vs;
struct pipe_alpha_test_state alpha_test;
struct pipe_blend_color blend_color;
@@ -82,8 +84,6 @@ struct softpipe_context {
struct pipe_constant_buffer constants[2];
struct pipe_feedback_state feedback;
struct pipe_framebuffer_state framebuffer;
- struct pipe_shader_state fs;
- struct pipe_shader_state vs;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index 46ad08aaa14..25bc170d8c3 100755
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -108,7 +108,7 @@ shade_quad(
/* init machine state */
tgsi_exec_machine_init(
&machine,
- softpipe->fs.tokens,
+ softpipe->fs->tokens,
PIPE_MAX_SAMPLERS,
qss->samplers );
diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h
index 62bd26c4dfe..04cc743bd03 100644
--- a/src/mesa/pipe/softpipe/sp_state.h
+++ b/src/mesa/pipe/softpipe/sp_state.h
@@ -88,11 +88,15 @@ void softpipe_set_constant_buffer(struct pipe_context *,
void softpipe_set_feedback_state( struct pipe_context *,
const struct pipe_feedback_state * );
-void softpipe_set_fs_state( struct pipe_context *,
- const struct pipe_shader_state * );
-
-void softpipe_set_vs_state( struct pipe_context *,
- const struct pipe_shader_state * );
+const struct pipe_shader_state *
+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_set_polygon_stipple( struct pipe_context *,
const struct pipe_poly_stipple * );
diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c
index 8c6bacf65cf..9611a2ac990 100644
--- a/src/mesa/pipe/softpipe/sp_state_derived.c
+++ b/src/mesa/pipe/softpipe/sp_state_derived.c
@@ -43,7 +43,7 @@
*/
static void calculate_vertex_layout( struct softpipe_context *softpipe )
{
- const uint inputsRead = softpipe->fs.inputs_read;
+ const uint inputsRead = softpipe->fs->inputs_read;
const interp_mode colorInterp
= softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
struct vertex_info *vinfo = &softpipe->vertex_info;
diff --git a/src/mesa/pipe/softpipe/sp_state_fs.c b/src/mesa/pipe/softpipe/sp_state_fs.c
index 5ab246896b9..fbbde2f5201 100644
--- a/src/mesa/pipe/softpipe/sp_state_fs.c
+++ b/src/mesa/pipe/softpipe/sp_state_fs.c
@@ -33,23 +33,33 @@
#include "pipe/draw/draw_context.h"
-void softpipe_set_fs_state( struct pipe_context *pipe,
+const struct pipe_shader_state *
+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;
+}
+
+void softpipe_bind_fs_state( struct pipe_context *pipe,
const struct pipe_shader_state *fs )
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- memcpy(&softpipe->fs, fs, sizeof(*fs));
+ softpipe->fs = fs;
softpipe->dirty |= SP_NEW_FS;
}
-void softpipe_set_vs_state( struct pipe_context *pipe,
+void softpipe_bind_vs_state( struct pipe_context *pipe,
const struct pipe_shader_state *vs )
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- memcpy(&softpipe->vs, vs, sizeof(*vs));
+ softpipe->vs = vs;
softpipe->dirty |= SP_NEW_VS;
@@ -57,6 +67,12 @@ void softpipe_set_vs_state( struct pipe_context *pipe,
}
+void softpipe_delete_shader_state( struct pipe_context *pipe,
+ const struct pipe_shader_state *shader )
+{
+ free((struct pipe_shader_state*)shader);
+}
+
void softpipe_set_constant_buffer(struct pipe_context *pipe,
uint shader, uint index,
const struct pipe_constant_buffer *buf)