check before calling multisample

Submitted by Po-Hsien Wang on July 18, 2018, 10:18 p.m.

Details

Message ID 20180718221827.124108-1-pwang@chromium.org
State New
Series "check before calling multisample"
Headers show

Commit Message

Po-Hsien Wang July 18, 2018, 10:18 p.m.
Based on the website, glTexStorage2DMultisample requires at least
opengles >= 31 and opengl >= 43 or the extension.
Adding the check here.
---
 src/vrend_renderer.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index 69f1da3..0938169 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -7355,7 +7355,8 @@  static void vrend_renderer_fill_caps_gles(uint32_t set, UNUSED uint32_t version,
    /* Not available on GLES */
    caps->v2.texture_buffer_offset_alignment = 0;
 
-   caps->v1.max_samples = vrend_renderer_query_multisample_caps(max, &caps->v2);
+   if (gles_ver >= 31)
+      caps->v1.max_samples = vrend_renderer_query_multisample_caps(max, &caps->v2);
 }
 
 void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
@@ -7582,7 +7583,9 @@  void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
       glGetIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT, (GLint*)&caps->v2.shader_buffer_offset_alignment);
    }
 
-   caps->v1.max_samples = vrend_renderer_query_multisample_caps(max, &caps->v2);
+   if (gl_ver >= 43 || epoxy_has_gl_extension("GL_ARB_texture_storage_multisample")){
+      caps->v1.max_samples = vrend_renderer_query_multisample_caps(max, &caps->v2);
+   }
 
    caps->v2.capability_bits |= VIRGL_CAP_TGSI_INVARIANT | VIRGL_CAP_SET_MIN_SAMPLES;
 

Comments

Gert Wollny Aug. 6, 2018, 8:57 a.m.
Good catch, but now this patch needs a rebase to use the new feature
code and the caps rework (which has the advantage that there is now
only one place to protect the call).

Best, 
Gert 

Am Mittwoch, den 18.07.2018, 15:18 -0700 schrieb Po-Hsien Wang:
> Based on the website, glTexStorage2DMultisample requires at least
> opengles >= 31 and opengl >= 43 or the extension.
> Adding the check here.
> ---
>  src/vrend_renderer.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
> index 69f1da3..0938169 100644
> --- a/src/vrend_renderer.c
> +++ b/src/vrend_renderer.c
> @@ -7355,7 +7355,8 @@ static void
> vrend_renderer_fill_caps_gles(uint32_t set, UNUSED uint32_t version,
>     /* Not available on GLES */
>     caps->v2.texture_buffer_offset_alignment = 0;
>  
> -   caps->v1.max_samples = vrend_renderer_query_multisample_caps(max,
> &caps->v2);
> +   if (gles_ver >= 31)
> +      caps->v1.max_samples =
> vrend_renderer_query_multisample_caps(max, &caps->v2);
>  }
>  
>  void vrend_renderer_fill_caps(uint32_t set, uint32_t version,
> @@ -7582,7 +7583,9 @@ void vrend_renderer_fill_caps(uint32_t set,
> uint32_t version,
>        glGetIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT,
> (GLint*)&caps->v2.shader_buffer_offset_alignment);
>     }
>  
> -   caps->v1.max_samples = vrend_renderer_query_multisample_caps(max,
> &caps->v2);
> +   if (gl_ver >= 43 ||
> epoxy_has_gl_extension("GL_ARB_texture_storage_multisample")){
> +      caps->v1.max_samples =
> vrend_renderer_query_multisample_caps(max, &caps->v2);
> +   }
>  
>     caps->v2.capability_bits |= VIRGL_CAP_TGSI_INVARIANT |
> VIRGL_CAP_SET_MIN_SAMPLES;
>