st/mesa: expose 0 shader binary formats for compat profiles for Qt
authorMarek Olšák <marek.olsak@amd.com>
Fri, 23 Feb 2018 19:42:41 +0000 (20:42 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 7 Mar 2018 20:36:31 +0000 (15:36 -0500)
Bugzilla: https://bugreports.qt.io/browse/QTBUG-66420
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105065
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
src/mesa/state_tracker/st_context.c
src/mesa/state_tracker/st_extensions.c
src/mesa/state_tracker/st_extensions.h
src/mesa/state_tracker/st_manager.c

index e23f9fd70b0611e725e4996417617c4dee83240c..dfdd92f31b0bfcc1711646d1f76b7f9309b2df5d 100644 (file)
@@ -468,7 +468,7 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
       ? true : false;
 
    /* GL limits and extensions */
-   st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions);
+   st_init_limits(pipe->screen, &ctx->Const, &ctx->Extensions, ctx->API);
    st_init_extensions(pipe->screen, &ctx->Const,
                       &ctx->Extensions, &st->options, ctx->API);
 
index 42d53cbf82d7cc340c0c8d73af19ee448c7720bf..3b8e226e673e5f93af959b818e38bc3dd4f41c51 100644 (file)
@@ -75,7 +75,8 @@ static int _clamp(int a, int min, int max)
  * Note that we have to limit/clamp against Mesa's internal limits too.
  */
 void st_init_limits(struct pipe_screen *screen,
-                    struct gl_constants *c, struct gl_extensions *extensions)
+                    struct gl_constants *c, struct gl_extensions *extensions,
+                    gl_api api)
 {
    int supported_irs;
    unsigned sh;
@@ -437,8 +438,14 @@ void st_init_limits(struct pipe_screen *screen,
    c->GLSLFrontFacingIsSysVal =
       screen->get_param(screen, PIPE_CAP_TGSI_FS_FACE_IS_INTEGER_SYSVAL);
 
-   /* GL_ARB_get_program_binary */
-   if (screen->get_disk_shader_cache && screen->get_disk_shader_cache(screen))
+   /* GL_ARB_get_program_binary
+    *
+    * The QT framework has a bug in their shader program cache, which is built
+    * on GL_ARB_get_program_binary. In an effort to allow them to fix the bug
+    * we don't enable more than 1 binary format for compatibility profiles.
+    */
+   if (api != API_OPENGL_COMPAT &&
+       screen->get_disk_shader_cache && screen->get_disk_shader_cache(screen))
       c->NumProgramBinaryFormats = 1;
 
    c->MaxAtomicBufferBindings =
index 7bf1aa8c8cbee1f60feb947c00c777a93dc8cf2a..fdfac7ece704d6bac446783870a79a5705763ef5 100644 (file)
@@ -35,7 +35,8 @@ struct pipe_screen;
 
 extern void st_init_limits(struct pipe_screen *screen,
                            struct gl_constants *c,
-                           struct gl_extensions *extensions);
+                           struct gl_extensions *extensions,
+                           gl_api api);
 
 extern void st_init_extensions(struct pipe_screen *screen,
                                struct gl_constants *consts,
index d6aa3e7962c269f74b2aa609c86ce41373d3f068..d6901c96eb096331194883257fa527ceaadcda15 100644 (file)
@@ -1207,7 +1207,7 @@ get_version(struct pipe_screen *screen,
    _mesa_init_constants(&consts, api);
    _mesa_init_extensions(&extensions);
 
-   st_init_limits(screen, &consts, &extensions);
+   st_init_limits(screen, &consts, &extensions, api);
    st_init_extensions(screen, &consts, &extensions, options, api);
 
    return _mesa_get_version(&extensions, &consts, api);