summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/nv30
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2010-02-25 14:40:56 +0100
committerMichal Krol <[email protected]>2010-02-25 14:40:56 +0100
commite3c2a053cf4ac761d672ec64cb18c099b4ac3bc2 (patch)
tree31734545d6d3a9edf59be8baa37820a8ddd73804 /src/gallium/drivers/nv30
parent06f63457908a997828e93f3141ecdde59392b7d5 (diff)
nv30: Fix after sampler view changes.
Did not test build.
Diffstat (limited to 'src/gallium/drivers/nv30')
-rw-r--r--src/gallium/drivers/nv30/nv30_context.h1
-rw-r--r--src/gallium/drivers/nv30/nv30_state.c38
2 files changed, 35 insertions, 4 deletions
diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h
index ca3d6aca7fa..04813526f40 100644
--- a/src/gallium/drivers/nv30/nv30_context.h
+++ b/src/gallium/drivers/nv30/nv30_context.h
@@ -138,6 +138,7 @@ struct nv30_context {
unsigned idxbuf_format;
struct nv30_sampler_state *tex_sampler[PIPE_MAX_SAMPLERS];
struct nv30_miptree *tex_miptree[PIPE_MAX_SAMPLERS];
+ struct pipe_sampler_view *fragment_sampler_views[PIPE_MAX_SAMPLERS];
unsigned nr_samplers;
unsigned nr_textures;
unsigned dirty_samplers;
diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c
index d911c807074..1d484ecb77f 100644
--- a/src/gallium/drivers/nv30/nv30_state.c
+++ b/src/gallium/drivers/nv30/nv30_state.c
@@ -272,19 +272,22 @@ nv30_sampler_state_delete(struct pipe_context *pipe, void *hwcso)
}
static void
-nv30_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
- struct pipe_texture **miptree)
+nv30_set_fragment_sampler_views(struct pipe_context *pipe,
+ unsigned nr,
+ struct pipe_sampler_view **views)
{
struct nv30_context *nv30 = nv30_context(pipe);
unsigned unit;
for (unit = 0; unit < nr; unit++) {
+ pipe_sampler_view_reference(&nv30->fragment_sampler_views[unit], views[unit]);
pipe_texture_reference((struct pipe_texture **)
- &nv30->tex_miptree[unit], miptree[unit]);
+ &nv30->tex_miptree[unit], views[unit]->texture);
nv30->dirty_samplers |= (1 << unit);
}
for (unit = nr; unit < nv30->nr_textures; unit++) {
+ pipe_sampler_view_reference(&nv30->fragment_sampler_views[unit], NULL);
pipe_texture_reference((struct pipe_texture **)
&nv30->tex_miptree[unit], NULL);
nv30->dirty_samplers |= (1 << unit);
@@ -294,6 +297,31 @@ nv30_set_sampler_texture(struct pipe_context *pipe, unsigned nr,
nv30->dirty |= NV30_NEW_SAMPLER;
}
+static struct pipe_sampler_view *
+nv30_create_sampler_view(struct pipe_context *pipe,
+ struct pipe_texture *texture,
+ const struct pipe_sampler_view *templ)
+{
+ struct pipe_sampler_view *view = CALLOC_STRUCT(pipe_sampler_view);
+
+ *view = *templ;
+ view->reference.count = 1;
+ view->texture = NULL;
+ pipe_texture_reference(&view->texture, texture);
+ view->context = pipe;
+
+ return view;
+}
+
+
+static void
+nv30_sampler_view_destroy(struct pipe_context *pipe,
+ struct pipe_sampler_view *view)
+{
+ pipe_texture_reference(&view->texture, NULL);
+ FREE(view);
+}
+
static void *
nv30_rasterizer_state_create(struct pipe_context *pipe,
const struct pipe_rasterizer_state *cso)
@@ -692,7 +720,9 @@ nv30_init_state_functions(struct nv30_context *nv30)
nv30->pipe.create_sampler_state = nv30_sampler_state_create;
nv30->pipe.bind_fragment_sampler_states = nv30_sampler_state_bind;
nv30->pipe.delete_sampler_state = nv30_sampler_state_delete;
- nv30->pipe.set_fragment_sampler_textures = nv30_set_sampler_texture;
+ nv30->pipe.set_fragment_sampler_views = nv30_set_fragment_sampler_view;
+ nv30->pipe.create_sampler_view = nv30_create_sampler_view;
+ nv30->pipe.sampler_view_destroy = nv30_sampler_view_destroy;
nv30->pipe.create_rasterizer_state = nv30_rasterizer_state_create;
nv30->pipe.bind_rasterizer_state = nv30_rasterizer_state_bind;