diff options
author | Chia-I Wu <[email protected]> | 2013-05-27 12:29:51 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2013-05-27 12:30:42 +0800 |
commit | 8e7987cc4940909fde3fdde44c31c0ddfa276bb0 (patch) | |
tree | 8d4d722abe8300e588dadfee55df2bdf035de5e5 /src/gallium | |
parent | 11c9aaf30ab63ef856d0fe6f794a74db136afea0 (diff) |
ilo: add support for TBOs on GEN6
This hunk was missing in the last commit.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_gpe_gen6.c | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen6.c b/src/gallium/drivers/ilo/ilo_gpe_gen6.c index 08161aaa227..b0e6c2152d8 100644 --- a/src/gallium/drivers/ilo/ilo_gpe_gen6.c +++ b/src/gallium/drivers/ilo/ilo_gpe_gen6.c @@ -4010,19 +4010,37 @@ gen6_emit_view_SURFACE_STATE(const struct ilo_dev_info *dev, const struct pipe_sampler_view *view, struct ilo_cp *cp) { - struct ilo_texture *tex = ilo_texture(view->texture); + struct intel_bo *bo; uint32_t dw[6]; ILO_GPE_VALID_GEN(dev, 6, 6); - gen6_fill_normal_SURFACE_STATE(dev, tex, view->format, - view->u.tex.first_level, - view->u.tex.last_level - view->u.tex.first_level + 1, - view->u.tex.first_layer, - view->u.tex.last_layer - view->u.tex.first_layer + 1, - false, false, dw, Elements(dw)); + if (view->texture->target == PIPE_BUFFER) { + const unsigned elem_size = util_format_get_blocksize(view->format); + const unsigned first_elem = view->u.buf.first_element; + const unsigned num_elems = view->u.buf.last_element - first_elem + 1; + struct ilo_buffer *buf = ilo_buffer(view->texture); + + gen6_fill_buffer_SURFACE_STATE(dev, buf, + first_elem * elem_size, num_elems * elem_size, + elem_size, view->format, false, false, dw, Elements(dw)); + + bo = buf->bo; + } + else { + struct ilo_texture *tex = ilo_texture(view->texture); + + gen6_fill_normal_SURFACE_STATE(dev, tex, view->format, + view->u.tex.first_level, + view->u.tex.last_level - view->u.tex.first_level + 1, + view->u.tex.first_layer, + view->u.tex.last_layer - view->u.tex.first_layer + 1, + false, false, dw, Elements(dw)); + + bo = tex->bo; + } - return gen6_emit_SURFACE_STATE(dev, tex->bo, false, dw, Elements(dw), cp); + return gen6_emit_SURFACE_STATE(dev, bo, false, dw, Elements(dw), cp); } static uint32_t |