nv30: Fix after sampler view changes.

Did not test build.
This commit is contained in:
Michal Krol 2010-02-25 14:40:56 +01:00
parent 06f6345790
commit e3c2a053cf
2 changed files with 35 additions and 4 deletions

View file

@ -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;

View file

@ -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;