[virglrenderer-devel] [PATCH] check before calling multisample

Po-Hsien Wang pwang at chromium.org
Mon Aug 6 18:13:39 UTC 2018


Based on the website, glTexStorage2DMultisample requires at least
opengles >= 31 and opengl >= 43 or the extension.
Adding the check here.

v2: rebased using the features.
---
 src/vrend_renderer.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
index ddf7f3a..8ce8d18 100644
--- a/src/vrend_renderer.c
+++ b/src/vrend_renderer.c
@@ -125,6 +125,7 @@ enum features_id
    feat_ssbo,
    feat_ssbo_barrier,
    feat_stencil_texturing,
+   feat_storage_multisample,
    feat_tessellation,
    feat_texture_array,
    feat_texture_buffer_range,
@@ -186,6 +187,7 @@ static const  struct {
    [feat_ssbo] = { 43, 31, { "GL_ARB_shader_storage_buffer_object" } },
    [feat_ssbo_barrier] = { 43, 31, {} },
    [feat_stencil_texturing] = { 43, UNAVAIL, { "GL_ARB_stencil_texturing" } },
+   [feat_storage_multisample] = { 43, 31, { "GL_ARB_texture_storage_multisample" } },
    [feat_tessellation] = { 40, UNAVAIL, { "GL_ARB_tessellation_shader" } },
    [feat_texture_array] = { 30, 30, { "GL_EXT_texture_array" } },
    [feat_texture_buffer_range] = { 43, UNAVAIL, { "GL_ARB_texture_buffer_range" } },
@@ -8100,7 +8102,9 @@ static void vrend_renderer_fill_caps_v2(int gl_ver, int gles_ver,  union virgl_c
       glGetIntegerv(GL_MAX_IMAGE_SAMPLES, (GLint*)&caps->v2.max_image_samples);
    }
 
-   caps->v1.max_samples = vrend_renderer_query_multisample_caps(max, &caps->v2);
+   if (has_feature(feat_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 | VIRGL_CAP_TGSI_PRECISE;
 
-- 
2.18.0.597.ga71716f1ad-goog



More information about the virglrenderer-devel mailing list