diff options
author | Chia-I Wu <[email protected]> | 2013-05-23 12:50:14 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2013-05-27 11:02:57 +0800 |
commit | fb40aca8791a8dc6b5777fd4cc0b060553e799ef (patch) | |
tree | 93c69afc64c7ab4d2667448a6189bc6d13ee30c5 /src/gallium | |
parent | 441aa9326a2c7b575f833ed18e97f3ce70844b25 (diff) |
ilo: add support for texture buffer objects
Take care of sampler views that have buffers as the underlying resources.
Update caps related to TBOs.
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/ilo/ilo_gpe_gen7.c | 34 | ||||
-rw-r--r-- | src/gallium/drivers/ilo/ilo_screen.c | 8 |
2 files changed, 32 insertions, 10 deletions
diff --git a/src/gallium/drivers/ilo/ilo_gpe_gen7.c b/src/gallium/drivers/ilo/ilo_gpe_gen7.c index 0a3474dad0a..56a1cf0556b 100644 --- a/src/gallium/drivers/ilo/ilo_gpe_gen7.c +++ b/src/gallium/drivers/ilo/ilo_gpe_gen7.c @@ -1708,19 +1708,37 @@ gen7_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[8]; ILO_GPE_VALID_GEN(dev, 7, 7); - gen7_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); + + gen7_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); + + gen7_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 gen7_emit_SURFACE_STATE(dev, tex->bo, false, dw, Elements(dw), cp); + return gen7_emit_SURFACE_STATE(dev, bo, false, dw, Elements(dw), cp); } static uint32_t diff --git a/src/gallium/drivers/ilo/ilo_screen.c b/src/gallium/drivers/ilo/ilo_screen.c index 66f2e8e6a06..40558b3c0c0 100644 --- a/src/gallium/drivers/ilo/ilo_screen.c +++ b/src/gallium/drivers/ilo/ilo_screen.c @@ -404,10 +404,11 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT: return 0; /* TODO */ case PIPE_CAP_CUBE_MAP_ARRAY: - case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: return false; /* TODO */ + case PIPE_CAP_TEXTURE_BUFFER_OBJECTS: + return true; case PIPE_CAP_TEXTURE_BUFFER_OFFSET_ALIGNMENT: - return 0; /* TODO */ + return 1; case PIPE_CAP_TGSI_TEXCOORD: return false; case PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER: @@ -416,6 +417,9 @@ ilo_get_param(struct pipe_screen *screen, enum pipe_cap param) return false; /* TODO */ case PIPE_CAP_TEXTURE_BORDER_COLOR_QUIRK: return 0; + case PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE: + /* a BRW_SURFACE_BUFFER can have up to 2^27 elements */ + return 1 << 27; default: return 0; |