summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2018-12-26 02:06:13 -0800
committerKenneth Graunke <[email protected]>2019-02-21 10:26:11 -0800
commit7ed1383c0ae307dac3bae45610b770b53522c34f (patch)
tree91dc028f92a717a165b1fc1a6922899ea1df377f /src
parent477e7d575b6b1bab5a0221c18af0ff40c29bc8ee (diff)
iris: Fix surface states for Gen8 lowered-to-untype images
We have to use SURFTYPE_BUFFER and ISL_FORMAT_RAW for these.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/iris/iris_state.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 5d1aaf97c41..f8ef3f82e79 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -1512,7 +1512,7 @@ fill_buffer_surface_state(struct isl_device *isl_dev,
unsigned size)
{
const struct isl_format_layout *fmtl = isl_format_get_layout(format);
- const unsigned cpp = fmtl->bpb / 8;
+ const unsigned cpp = format == ISL_FORMAT_RAW ? 1 : fmtl->bpb / 8;
/* The ARB_texture_buffer_specification says:
*
@@ -1808,17 +1808,30 @@ iris_set_shader_images(struct pipe_context *ctx,
}
isl_surf_usage_flags_t usage = ISL_SURF_USAGE_STORAGE_BIT;
- enum isl_format isl_format =
+ enum isl_format isl_fmt =
iris_format_for_usage(devinfo, img->format, usage).fmt;
- if (img->shader_access & PIPE_IMAGE_ACCESS_READ)
- isl_format = isl_lower_storage_image_format(devinfo, isl_format);
+ bool untyped_fallback = false;
+
+ if (img->shader_access & PIPE_IMAGE_ACCESS_READ) {
+ /* On Gen8, try to use typed surfaces reads (which support a
+ * limited number of formats), and if not possible, fall back
+ * to untyped reads.
+ */
+ untyped_fallback = GEN_GEN == 8 &&
+ !isl_has_matching_typed_storage_image_format(devinfo, isl_fmt);
+
+ if (untyped_fallback)
+ isl_fmt = ISL_FORMAT_RAW;
+ else
+ isl_fmt = isl_lower_storage_image_format(devinfo, isl_fmt);
+ }
shs->image[start_slot + i].access = img->shader_access;
if (res->base.target != PIPE_BUFFER) {
struct isl_view view = {
- .format = isl_format,
+ .format = isl_fmt,
.base_level = img->u.tex.level,
.levels = 1,
.base_array_layer = img->u.tex.first_layer,
@@ -1827,13 +1840,19 @@ iris_set_shader_images(struct pipe_context *ctx,
.usage = usage,
};
- fill_surface_state(&screen->isl_dev, map, res, &view);
+ if (untyped_fallback) {
+ fill_buffer_surface_state(&screen->isl_dev, res->bo, map,
+ isl_fmt, 0, res->bo->size);
+ } else {
+ fill_surface_state(&screen->isl_dev, map, res, &view);
+ }
+
isl_surf_fill_image_param(&screen->isl_dev,
&shs->image[start_slot + i].param,
&res->surf, &view);
} else {
fill_buffer_surface_state(&screen->isl_dev, res->bo, map,
- isl_format, img->u.buf.offset,
+ isl_fmt, img->u.buf.offset,
img->u.buf.size);
fill_buffer_image_param(&shs->image[start_slot + i].param,
img->format, img->u.buf.size);