Commit b75427cc authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜 Committed by Marge Bot

panfrost: Implement EXT_multisampled_render_to_texture

Significantly helps WebGL performance with Chromium's OpenGL ES backend.
Also update docs/features.txt
Signed-off-by: Alyssa Rosenzweig's avatarAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <!6161>
parent 2c47993b
Pipeline #186250 waiting for manual action with stages
......@@ -321,7 +321,7 @@ Khronos, ARB, and OES extensions that are not part of any OpenGL or OpenGL ES ve
GL_EXT_memory_object DONE (radeonsi)
GL_EXT_memory_object_fd DONE (radeonsi)
GL_EXT_memory_object_win32 not started
GL_EXT_multisampled_render_to_texture DONE (freedreno/a6xx)
GL_EXT_multisampled_render_to_texture DONE (freedreno/a6xx, panfrost)
GL_EXT_render_snorm DONE (i965, r600, radeonsi)
GL_EXT_semaphore DONE (radeonsi)
GL_EXT_semaphore_fd DONE (radeonsi)
......
......@@ -839,11 +839,6 @@ panfrost_load_surface(struct panfrost_batch *batch, struct pipe_surface *surf, u
enum mali_texture_type type =
panfrost_translate_texture_type(rsrc->base.target);
unsigned nr_samples = surf->nr_samples;
if (!nr_samples)
nr_samples = surf->texture->nr_samples;
struct pan_image img = {
.width0 = rsrc->base.width0,
.height0 = rsrc->base.height0,
......@@ -856,7 +851,7 @@ panfrost_load_surface(struct panfrost_batch *batch, struct pipe_surface *surf, u
.last_level = level,
.first_layer = surf->u.tex.first_layer,
.last_layer = surf->u.tex.last_layer,
.nr_samples = nr_samples,
.nr_samples = rsrc->base.nr_samples,
.cubemap_stride = rsrc->cubemap_stride,
.bo = rsrc->bo,
.slices = rsrc->slices
......
......@@ -211,13 +211,9 @@ panfrost_mfbd_set_cbuf(
assert(surf->u.tex.last_layer == first_layer);
int stride = rsrc->slices[level].stride;
/* Only set layer_stride for MSAA rendering */
unsigned nr_samples = surf->nr_samples;
if (!nr_samples)
nr_samples = surf->texture->nr_samples;
/* Only set layer_stride for layered MSAA rendering */
unsigned nr_samples = surf->texture->nr_samples;
unsigned layer_stride = (nr_samples > 1) ? rsrc->slices[level].size0 : 0;
mali_ptr base = panfrost_get_texture_address(rsrc, level, first_layer, 0);
......@@ -289,11 +285,7 @@ panfrost_mfbd_set_zsbuf(
bool is_bifrost = dev->quirks & IS_BIFROST;
struct panfrost_resource *rsrc = pan_resource(surf->texture);
unsigned nr_samples = surf->nr_samples;
if (!nr_samples)
nr_samples = surf->texture->nr_samples;
unsigned nr_samples = surf->texture->nr_samples;
nr_samples = MAX2(nr_samples, 1);
fbx->zs_samples = MALI_POSITIVE(nr_samples);
......@@ -566,12 +558,7 @@ panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws)
unsigned rt_offset = offset << tib_shift;
if (surf && ((batch->clear | batch->draws) & (PIPE_CLEAR_COLOR0 << cb))) {
unsigned nr_samples = surf->nr_samples;
if (!nr_samples)
nr_samples = surf->texture->nr_samples;
if (nr_samples > 1)
if (MAX2(surf->nr_samples, surf->texture->nr_samples) > 1)
batch->requirements |= PAN_REQ_MSAA;
panfrost_mfbd_set_cbuf(&rts[cb], surf);
......@@ -600,6 +587,9 @@ panfrost_mfbd_fragment(struct panfrost_batch *batch, bool has_draws)
fb.rt_count_2 = MAX2(DIV_ROUND_UP(offset, 1 << (10 - tib_shift)), 1);
if (batch->key.zsbuf && ((batch->clear | batch->draws) & PIPE_CLEAR_DEPTHSTENCIL)) {
if (MAX2(batch->key.zsbuf->nr_samples, batch->key.zsbuf->nr_samples) > 1)
batch->requirements |= PAN_REQ_MSAA;
panfrost_mfbd_set_zsbuf(&fb, &fbx, batch->key.zsbuf);
}
......
......@@ -177,6 +177,7 @@ panfrost_create_surface(struct pipe_context *pipe,
assert(surf_tmpl->u.tex.level <= pt->last_level);
ps->width = u_minify(pt->width0, surf_tmpl->u.tex.level);
ps->height = u_minify(pt->height0, surf_tmpl->u.tex.level);
ps->nr_samples = surf_tmpl->nr_samples;
ps->u.tex.level = surf_tmpl->u.tex.level;
ps->u.tex.first_layer = surf_tmpl->u.tex.first_layer;
ps->u.tex.last_layer = surf_tmpl->u.tex.last_layer;
......
......@@ -134,6 +134,7 @@ panfrost_get_param(struct pipe_screen *screen, enum pipe_cap param)
case PIPE_CAP_OCCLUSION_QUERY:
case PIPE_CAP_TGSI_INSTANCEID:
case PIPE_CAP_TEXTURE_MULTISAMPLE:
case PIPE_CAP_SURFACE_SAMPLE_COUNT:
case PIPE_CAP_PRIMITIVE_RESTART:
case PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX:
return !is_bifrost;
......
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