[virglrenderer-devel] [RFC PATCH 1/5] vrend: Enable ARB_texture_storage on GLES

Erik Faye-Lund erik.faye-lund at collabora.com
Thu Aug 2 11:22:06 UTC 2018


On 02. aug. 2018 10:48, Gert Wollny wrote:
> glTexStorage*D is more restrictive in supporting texture formats, especially
> on GLES. Specifically, it doesn't support BGRA textures that are needed to get
> any useful display, but it is needed to get immutable textures that are required
> for glTextureView.
> Check which formats are supported and use glTexStorage*D for these, otherwise
> fall back to use glTexImage*D.
>
> Signed-off-by: Gert Wollny<gert.wollny at collabora.com>
> ---
>   src/vrend_formats.c  | 20 ++++++++++++++++++++
>   src/vrend_renderer.c | 17 +++++++++++------
>   src/vrend_renderer.h |  3 +++
>   3 files changed, 34 insertions(+), 6 deletions(-)
>
> diff --git a/src/vrend_formats.c b/src/vrend_formats.c
> index 4647c43..b9f85a0 100644
> --- a/src/vrend_formats.c
> +++ b/src/vrend_formats.c
> @@ -444,6 +444,26 @@ void vrend_build_format_list_gles(void)
>     add_formats(gles_z32_format);
>   }
>   
> +/* glTexStorage may not support all that is supported by glTexImage,
> + * so add a flag to indicate when it can be used.
> + */
> +void vrend_check_texture_storage(struct vrend_format_table *table)
> +{
> +   int i;
> +   GLuint tex_id;
> +   for (i = 0; i < VIRGL_FORMAT_MAX; i++) {
> +
> +      if (table[i].internalformat != 0) {
> +         glGenTextures(1, &tex_id);
> +         glBindTexture(GL_TEXTURE_2D, tex_id);
> +         glTexStorage2D(GL_TEXTURE_2D, 1, table[i].internalformat, 32, 32);
> +         if (glGetError() == GL_NO_ERROR)
> +            table[i].bindings |= VIRGL_BIND_CAN_TEXTURE_STORAGE;
> +         glDeleteTextures(1, &tex_id);
> +      }
> +   }
> +}
> +
>   unsigned vrend_renderer_query_multisample_caps(unsigned max_samples, struct virgl_caps_v2 *caps)
>   {
>      GLuint tex;
> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
> index 392c909..02d413b 100644
> --- a/src/vrend_renderer.c
> +++ b/src/vrend_renderer.c
> @@ -189,7 +189,7 @@ static const  struct {
>      [feat_texture_array] = { 30, 30, { "GL_EXT_texture_array" } },
>      [feat_texture_buffer_range] = { 43, UNAVAIL, { "GL_ARB_texture_buffer_range" } },
>      [feat_texture_multisample] = { 32, 30, { "GL_ARB_texture_multisample" } },
> -   [feat_texture_storage] = { 42, UNAVAIL, { "GL_ARB_texture_storage" } },
> +   [feat_texture_storage] = { 42, 30, { "GL_ARB_texture_storage" } },

This needs a rebase now that 403875b ("vrend, feat: Add 
feat_texture_srgb_decode and protect calls") has landed.

(not really a review, just something I noticed while applying locally)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/virglrenderer-devel/attachments/20180802/449ebc79/attachment.html>


More information about the virglrenderer-devel mailing list