[Mesa-dev] [PATCH v2 2/5] gallium: Add new PIPE_CAP_MULTISAMPLED_RENDER_TO_TEXTURE
Marek Olšák
maraeo at gmail.com
Sat Nov 17 03:48:20 UTC 2018
I think the name PIPE_CAP_MULTISAMPLED_RENDER_TO_TEXTURE is slightly
misleading, because it doesn't imply anything about the OpenGL ES behavior,
which is that a texture is multisampled in the cache, but single-sampled in
memory. This should be mentioned somewhere.
Marek
On Tue, Nov 6, 2018 at 5:19 PM Kristian H. Kristensen <hoegsberg at gmail.com>
wrote:
> This new pipe cap and the new nr_samples field in pipe_surface lets a
> state tracker bind a render target with a different sample count than
> the resource. This allows for implementing
> EXT_multisampled_render_to_texture and
> EXT_multisampled_render_to_texture2.
>
> Signed-off-by: Kristian H. Kristensen <hoegsberg at chromium.org>
> ---
> src/gallium/auxiliary/util/u_framebuffer.c | 10 ++++++++--
> src/gallium/docs/source/screen.rst | 3 +++
> src/gallium/include/pipe/p_defines.h | 1 +
> src/gallium/include/pipe/p_state.h | 6 ++++++
> 4 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/auxiliary/util/u_framebuffer.c
> b/src/gallium/auxiliary/util/u_framebuffer.c
> index 5bafddc726f..127623a7677 100644
> --- a/src/gallium/auxiliary/util/u_framebuffer.c
> +++ b/src/gallium/auxiliary/util/u_framebuffer.c
> @@ -229,13 +229,19 @@ util_framebuffer_get_num_samples(const struct
> pipe_framebuffer_state *fb)
> if (!(fb->nr_cbufs || fb->zsbuf))
> return MAX2(fb->samples, 1);
>
> + /**
> + * If a driver doesn't advertise
> PIPE_CAP_MULTISAMPLED_RENDER_TO_TEXTURE,
> + * pipe_surface::nr_samples will always be 0.
> + */
> for (i = 0; i < fb->nr_cbufs; i++) {
> if (fb->cbufs[i]) {
> - return MAX2(1, fb->cbufs[i]->texture->nr_samples);
> + return MAX3(1, fb->cbufs[i]->texture->nr_samples,
> + fb->cbufs[i]->nr_samples);
> }
> }
> if (fb->zsbuf) {
> - return MAX2(1, fb->zsbuf->texture->nr_samples);
> + return MAX3(1, fb->zsbuf->texture->nr_samples,
> + fb->zsbuf->nr_samples);
> }
>
> return 1;
> diff --git a/src/gallium/docs/source/screen.rst
> b/src/gallium/docs/source/screen.rst
> index 0abd164494c..2a062a7027c 100644
> --- a/src/gallium/docs/source/screen.rst
> +++ b/src/gallium/docs/source/screen.rst
> @@ -477,6 +477,9 @@ subpixel precision bias in bits during conservative
> rasterization.
> 0 means no limit.
> * ``PIPE_CAP_MAX_VERTEX_ELEMENT_SRC_OFFSET``: The maximum supported value
> for
> of pipe_vertex_element::src_offset.
> +* ``PIPE_CAP_MULTISAMPLED_RENDER_TO_TEXTURE``: Whether the driver
> + supports pipe_surface overrides of resource nr_samples. If set, will
> + enable EXT_multisampled_render_to_texture.
>
> .. _pipe_capf:
>
> diff --git a/src/gallium/include/pipe/p_defines.h
> b/src/gallium/include/pipe/p_defines.h
> index dacedf5b936..0ecfaf3ba5e 100644
> --- a/src/gallium/include/pipe/p_defines.h
> +++ b/src/gallium/include/pipe/p_defines.h
> @@ -823,6 +823,7 @@ enum pipe_cap
> PIPE_CAP_MAX_COMBINED_HW_ATOMIC_COUNTER_BUFFERS,
> PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET,
> PIPE_CAP_MAX_VERTEX_ELEMENT_SRC_OFFSET,
> + PIPE_CAP_MULTISAMPLED_RENDER_TO_TEXTURE,
> };
>
> /**
> diff --git a/src/gallium/include/pipe/p_state.h
> b/src/gallium/include/pipe/p_state.h
> index fd670345aad..89cffb15bd8 100644
> --- a/src/gallium/include/pipe/p_state.h
> +++ b/src/gallium/include/pipe/p_state.h
> @@ -443,6 +443,12 @@ struct pipe_surface
> uint16_t width; /**< logical width in pixels */
> uint16_t height; /**< logical height in pixels */
>
> + /** Number of samples for the surface. This can be different from the
> + * resource nr_samples when the resource is bound using
> + * FramebufferTexture2DMultisampleEXT.
> + */
> + unsigned nr_samples:8;
> +
> union pipe_surface_desc u;
> };
>
> --
> 2.19.1.930.g4563a0d9d0-goog
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181116/6a93c5a7/attachment.html>
More information about the mesa-dev
mailing list