[Mesa-dev] [PATCH v2 19/20] st/mesa: expose ARB_compute_shader when compute is supported

Samuel Pitoiset samuel.pitoiset at gmail.com
Sat Feb 6 22:04:52 UTC 2016


ARB_compute_shader is only enabled if the underlying driver exposes
TGSI through the PIPE_CAP_SHADER_SUPPORTED_IRS cap.

Changes from v2:
 - make use of the new PIPE_CAP_SHADER_SUPPORTED_IRS cap instead of
   enabling the extension when PIPE_CAP_COMPUTE is enabled.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/mesa/state_tracker/st_extensions.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 660c05e..072e9fd 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -479,6 +479,7 @@ void st_init_extensions(struct pipe_screen *screen,
 {
    unsigned i;
    int glsl_feature_level;
+   int shader_supported_irs;
    GLboolean *extension_table = (GLboolean *) extensions;
 
    static const struct st_extension_cap_mapping cap_mapping[] = {
@@ -1020,7 +1021,10 @@ void st_init_extensions(struct pipe_screen *screen,
        screen->get_param(screen, PIPE_CAP_STRING_MARKER))
       extensions->GREMEDY_string_marker = GL_TRUE;
 
-   if (extensions->ARB_compute_shader) {
+   shader_supported_irs =
+      screen->get_shader_param(screen, PIPE_SHADER_COMPUTE,
+                               PIPE_SHADER_CAP_SUPPORTED_IRS);
+   if (shader_supported_irs & (1 << PIPE_SHADER_IR_TGSI)) {
       uint64_t grid_size[3], block_size[3];
 
       screen->get_compute_param(screen, PIPE_COMPUTE_CAP_MAX_GRID_SIZE,
@@ -1036,5 +1040,6 @@ void st_init_extensions(struct pipe_screen *screen,
          consts->MaxComputeWorkGroupCount[i] = grid_size[i];
          consts->MaxComputeWorkGroupSize[i] = block_size[i];
       }
+      extensions->ARB_compute_shader = true;
    }
 }
-- 
2.6.4



More information about the mesa-dev mailing list