struct si_sampler_view *rview =
(struct si_sampler_view*)views->views[i];
+ if (!rview->resource)
+ continue;
+
r600_context_bo_reloc(&sctx->b, &sctx->b.rings.gfx,
rview->resource, RADEON_USAGE_READ,
si_get_resource_ro_priority(rview->resource));
struct si_sampler_view *rview =
(struct si_sampler_view*)view;
- r600_context_bo_reloc(&sctx->b, &sctx->b.rings.gfx,
- rview->resource, RADEON_USAGE_READ,
- si_get_resource_ro_priority(rview->resource));
+ if (rview->resource)
+ r600_context_bo_reloc(&sctx->b, &sctx->b.rings.gfx,
+ rview->resource, RADEON_USAGE_READ,
+ si_get_resource_ro_priority(rview->resource));
+
pipe_sampler_view_reference(&views->views[slot], view);
views->desc_data[slot] = view_desc;
si_set_sampler_view(sctx, shader, slot, views[i], rviews[i]->state);
- if (views[i]->texture->target != PIPE_BUFFER) {
+ if (views[i]->texture && views[i]->texture->target != PIPE_BUFFER) {
struct r600_texture *rtex =
(struct r600_texture*)views[i]->texture;
/* initialize base object */
view->base = *state;
view->base.texture = NULL;
- pipe_resource_reference(&view->base.texture, texture);
view->base.reference.count = 1;
view->base.context = ctx;
+
+ /* NULL resource, obey swizzle (only ZERO and ONE make sense). */
+ if (!texture) {
+ view->state[3] = S_008F1C_DST_SEL_X(si_map_swizzle(state->swizzle_r)) |
+ S_008F1C_DST_SEL_Y(si_map_swizzle(state->swizzle_g)) |
+ S_008F1C_DST_SEL_Z(si_map_swizzle(state->swizzle_b)) |
+ S_008F1C_DST_SEL_W(si_map_swizzle(state->swizzle_a)) |
+ S_008F1C_TYPE(V_008F1C_SQ_RSRC_IMG_1D);
+ return &view->base;
+ }
+
+ pipe_resource_reference(&view->base.texture, texture);
view->resource = &tmp->resource;
/* Buffer resource. */
{
struct si_sampler_view *view = (struct si_sampler_view *)state;
- if (view->resource->b.b.target == PIPE_BUFFER)
+ if (view->resource && view->resource->b.b.target == PIPE_BUFFER)
LIST_DELINIT(&view->list);
pipe_resource_reference(&state->texture, NULL);