Commit c1d3d39e authored by Icecream95's avatar Icecream95 Committed by Alyssa Rosenzweig

panfrost: Fake RGTC support

For most GPUs RGTC is disabled, so it needs to be emulated, using the
fake_rgtc option of u_transfer_helper.

Passes the rgtc-teximage tests in piglit.

v2: Update docs/features.txt (Alyssa)
Reviewed-by: Alyssa Rosenzweig's avatarAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <!5975>
parent fac813dc
Pipeline #179221 waiting for manual action with stages
......@@ -52,7 +52,7 @@ GL 3.0, GLSL 1.30 --- all DONE: freedreno, i965, nv50, nvc0, r600, radeonsi, llv
GL_EXT_texture_integer DONE (panfrost, v3d)
GL_EXT_texture_array DONE (panfrost, v3d)
GL_EXT_draw_buffers2 (Per-buffer blend and masks) DONE (panfrost, v3d)
GL_EXT_texture_compression_rgtc DONE (panfrost/if SoC supports)
GL_EXT_texture_compression_rgtc DONE (panfrost)
GL_ARB_texture_rg DONE (panfrost, v3d)
GL_EXT_transform_feedback (Transform feedback) DONE (panfrost, v3d)
GL_ARB_vertex_array_object (Vertex array objects) DONE (panfrost, v3d)
......
......@@ -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);
......
......@@ -934,6 +934,10 @@ static const struct u_transfer_vtbl transfer_vtbl = {
void
panfrost_resource_screen_init(struct pipe_screen *pscreen)
{
struct panfrost_device *dev = pan_device(pscreen);
bool fake_rgtc = !panfrost_supports_compressed_format(dev, MALI_BC4_UNORM);
//pscreen->base.resource_create_with_modifiers =
// panfrost_resource_create_with_modifiers;
pscreen->resource_create = u_transfer_helper_resource_create;
......@@ -942,7 +946,7 @@ panfrost_resource_screen_init(struct pipe_screen *pscreen)
pscreen->resource_get_handle = panfrost_resource_get_handle;
pscreen->transfer_helper = u_transfer_helper_create(&transfer_vtbl,
true, false,
true, true);
fake_rgtc, true);
}
void
......
......@@ -463,11 +463,6 @@ panfrost_is_format_supported( struct pipe_screen *screen,
if (scanout && renderable && !util_format_is_rgba8_variant(format_desc))
return false;
if (dev->debug & (PAN_DBG_GL3 | PAN_DBG_DEQP)) {
if (format_desc->layout == UTIL_FORMAT_LAYOUT_RGTC)
return true;
}
/* Check we support the format with the given bind */
unsigned relevant_bind = bind &
......@@ -478,9 +473,12 @@ panfrost_is_format_supported( struct pipe_screen *screen,
/* Also check that compressed texture formats are supported on this
* particular chip. They may not be depending on system integration
* differences. */
* differences. RGTC can be emulated so is always supported. */
bool is_rgtc = format_desc->layout == UTIL_FORMAT_LAYOUT_RGTC;
bool supported = panfrost_supports_compressed_format(dev, fmt.hw);
if (!panfrost_supports_compressed_format(dev, fmt.hw))
if (!is_rgtc && !supported)
return false;
return fmt.hw && ((relevant_bind & ~fmt.bind) == 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment