summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/panfrost/pan_context.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_context.c')
-rw-r--r--src/gallium/drivers/panfrost/pan_context.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index d2b44f907de..5d84322109d 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -941,13 +941,25 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
assert(prsrc->bo);
/* Format to access the stencil portion of a Z32_S8 texture */
- if (so->base.format == PIPE_FORMAT_X32_S8X24_UINT) {
+ if (format == PIPE_FORMAT_X32_S8X24_UINT) {
assert(prsrc->separate_stencil);
texture = &prsrc->separate_stencil->base;
prsrc = (struct panfrost_resource *)texture;
format = texture->format;
}
+ const struct util_format_description *desc = util_format_description(format);
+
+ bool fake_rgtc = !panfrost_supports_compressed_format(device, MALI_BC4_UNORM);
+
+ if (desc->layout == UTIL_FORMAT_LAYOUT_RGTC && fake_rgtc) {
+ if (desc->is_snorm)
+ format = PIPE_FORMAT_R8G8B8A8_SNORM;
+ else
+ format = PIPE_FORMAT_R8G8B8A8_UNORM;
+ desc = util_format_description(format);
+ }
+
so->texture_bo = prsrc->bo->gpu;
so->layout = prsrc->layout;
@@ -985,8 +997,6 @@ panfrost_create_sampler_view_bo(struct panfrost_sampler_view *so,
panfrost_translate_texture_type(so->base.target);
if (device->quirks & IS_BIFROST) {
- const struct util_format_description *desc =
- util_format_description(format);
unsigned char composed_swizzle[4];
util_format_compose_swizzles(desc->swizzle, user_swizzle, composed_swizzle);