From: Jakob Bornecrantz Date: Wed, 12 May 2010 14:33:40 +0000 (+0100) Subject: rbug: Fix sampler views and surfaces in context info X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=73684216ba49d069cd5b4ee5168c1e21538e237f;p=mesa.git rbug: Fix sampler views and surfaces in context info --- diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index 158904d2344..323d6d6dd6c 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -535,13 +535,19 @@ rbug_set_framebuffer_state(struct pipe_context *_pipe, struct pipe_framebuffer_state *state = NULL; unsigned i; + rb_pipe->curr.nr_cbufs = 0; + memset(rb_pipe->curr.cbufs, 0, sizeof(rb_pipe->curr.cbufs)); + /* unwrap the input state */ if (_state) { memcpy(&unwrapped_state, _state, sizeof(unwrapped_state)); - for(i = 0; i < _state->nr_cbufs; i++) + + rb_pipe->curr.nr_cbufs = _state->nr_cbufs; + for(i = 0; i < _state->nr_cbufs; i++) { unwrapped_state.cbufs[i] = rbug_surface_unwrap(_state->cbufs[i]); - for (; i < PIPE_MAX_COLOR_BUFS; i++) - unwrapped_state.cbufs[i] = NULL; + if (_state->cbufs[i]) + rb_pipe->curr.cbufs[i] = rbug_resource(_state->cbufs[i]->texture); + } unwrapped_state.zsbuf = rbug_surface_unwrap(_state->zsbuf); state = &unwrapped_state; } @@ -594,12 +600,18 @@ rbug_set_fragment_sampler_views(struct pipe_context *_pipe, struct pipe_sampler_view **views = NULL; unsigned i; + rb_pipe->curr.num_fs_views = 0; + memset(rb_pipe->curr.fs_views, 0, sizeof(rb_pipe->curr.fs_views)); + memset(rb_pipe->curr.fs_texs, 0, sizeof(rb_pipe->curr.fs_texs)); + memset(unwrapped_views, 0, sizeof(unwrapped_views)); + if (_views) { - for (i = 0; i < num; i++) + rb_pipe->curr.num_fs_views = num; + for (i = 0; i < num; i++) { + rb_pipe->curr.fs_views[i] = rbug_sampler_view(_views[i]); + rb_pipe->curr.fs_texs[i] = rbug_resource(_views[i] ? _views[i]->texture : NULL); unwrapped_views[i] = rbug_sampler_view_unwrap(_views[i]); - for (; i < PIPE_MAX_SAMPLERS; i++) - unwrapped_views[i] = NULL; - + } views = unwrapped_views; } @@ -617,12 +629,18 @@ rbug_set_vertex_sampler_views(struct pipe_context *_pipe, struct pipe_sampler_view **views = NULL; unsigned i; + rb_pipe->curr.num_vs_views = 0; + memset(rb_pipe->curr.vs_views, 0, sizeof(rb_pipe->curr.vs_views)); + memset(rb_pipe->curr.vs_texs, 0, sizeof(rb_pipe->curr.vs_texs)); + memset(unwrapped_views, 0, sizeof(unwrapped_views)); + if (_views) { - for (i = 0; i < num; i++) + rb_pipe->curr.num_vs_views = num; + for (i = 0; i < num; i++) { + rb_pipe->curr.vs_views[i] = rbug_sampler_view(_views[i]); + rb_pipe->curr.vs_texs[i] = rbug_resource(_views[i]->texture); unwrapped_views[i] = rbug_sampler_view_unwrap(_views[i]); - for (; i < PIPE_MAX_VERTEX_SAMPLERS; i++) - unwrapped_views[i] = NULL; - + } views = unwrapped_views; } diff --git a/src/gallium/drivers/rbug/rbug_context.h b/src/gallium/drivers/rbug/rbug_context.h index ccba3c19254..0c99d60f2db 100644 --- a/src/gallium/drivers/rbug/rbug_context.h +++ b/src/gallium/drivers/rbug/rbug_context.h @@ -50,11 +50,13 @@ struct rbug_context { struct rbug_shader *vs; struct rbug_shader *gs; - struct rbug_sampler_view *sampler_views[PIPE_MAX_SAMPLERS]; - unsigned num_sampler_views; + struct rbug_sampler_view *fs_views[PIPE_MAX_SAMPLERS]; + struct rbug_resource *fs_texs[PIPE_MAX_SAMPLERS]; + unsigned num_fs_views; - struct rbug_sampler_view *vert_sampler_views[PIPE_MAX_VERTEX_SAMPLERS]; - unsigned num_vert_sampler_views; + struct rbug_sampler_view *vs_views[PIPE_MAX_VERTEX_SAMPLERS]; + struct rbug_resource *vs_texs[PIPE_MAX_VERTEX_SAMPLERS]; + unsigned num_vs_views; unsigned nr_cbufs; struct rbug_resource *cbufs[PIPE_MAX_COLOR_BUFS]; diff --git a/src/gallium/drivers/rbug/rbug_core.c b/src/gallium/drivers/rbug/rbug_core.c index 13aa95a59b7..503183518c9 100644 --- a/src/gallium/drivers/rbug/rbug_core.c +++ b/src/gallium/drivers/rbug/rbug_core.c @@ -337,12 +337,12 @@ rbug_context_info(struct rbug_rbug *tr_rbug, struct rbug_header *header, uint32_ for (i = 0; i < rb_context->curr.nr_cbufs; i++) cbufs[i] = VOID2U64(rb_context->curr.cbufs[i]); - for (i = 0; i < rb_context->curr.num_sampler_views; i++) - texs[i] = VOID2U64(rb_context->curr.sampler_views[i]); + for (i = 0; i < rb_context->curr.num_fs_views; i++) + texs[i] = VOID2U64(rb_context->curr.fs_texs[i]); rbug_send_context_info_reply(tr_rbug->con, serial, VOID2U64(rb_context->curr.vs), VOID2U64(rb_context->curr.fs), - texs, rb_context->curr.num_sampler_views, + texs, rb_context->curr.num_fs_views, cbufs, rb_context->curr.nr_cbufs, VOID2U64(rb_context->curr.zsbuf), rb_context->draw_blocker, rb_context->draw_blocked, NULL); diff --git a/src/gallium/drivers/rbug/rbug_objects.c b/src/gallium/drivers/rbug/rbug_objects.c index d963baab417..0979fcff957 100644 --- a/src/gallium/drivers/rbug/rbug_objects.c +++ b/src/gallium/drivers/rbug/rbug_objects.c @@ -133,7 +133,7 @@ rbug_sampler_view_create(struct rbug_context *rb_context, rb_view->base = *view; rb_view->base.reference.count = 1; rb_view->base.texture = NULL; - pipe_resource_reference(&rb_view->base.texture, rb_resource->resource); + pipe_resource_reference(&rb_view->base.texture, &rb_resource->base); rb_view->base.context = rb_context->pipe; rb_view->sampler_view = view;