From eca8032f20d0970184843d98e2bddb688e94a3a9 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Mon, 5 Aug 2019 16:25:11 -0700 Subject: gallium: Add ARB_gl_spirv support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PIPE_CAP_GL_SPIRV capability enables ARB_gl_spirv and ARB_spirv_extensions, and will make sure the corresponding SPIR-V capabilities and extensions lists are initialized. The additional PIPE_CAP_GL_SPIRV_VARIABLE_POINTERS capability enables the support for Variable Pointers in SPIR-V shaders. This depends on the driver and is not mandatory for ARB_gl_spirv support. v2: Add a PIPE_CAP for Variable Pointers. (Marek) Reviewed-by: Alejandro PiƱeiro [v1] --- src/mesa/state_tracker/st_extensions.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/mesa') diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 4da6e559ed5..ed81134f4c5 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -31,6 +31,7 @@ #include "main/imports.h" #include "main/context.h" #include "main/macros.h" +#include "main/spirv_extensions.h" #include "main/version.h" #include "pipe/p_context.h" @@ -708,6 +709,7 @@ void st_init_extensions(struct pipe_screen *screen, { o(ARB_draw_instanced), PIPE_CAP_TGSI_INSTANCEID }, { o(ARB_framebuffer_object), PIPE_CAP_MIXED_FRAMEBUFFER_SIZES }, { o(ARB_gpu_shader_int64), PIPE_CAP_INT64 }, + { o(ARB_gl_spirv), PIPE_CAP_GL_SPIRV }, { o(ARB_indirect_parameters), PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS }, { o(ARB_instanced_arrays), PIPE_CAP_VERTEX_ELEMENT_INSTANCE_DIVISOR }, { o(ARB_occlusion_query), PIPE_CAP_OCCLUSION_QUERY }, @@ -732,6 +734,7 @@ void st_init_extensions(struct pipe_screen *screen, { o(ARB_shader_texture_image_samples), PIPE_CAP_TGSI_TXQS }, { o(ARB_shader_texture_lod), PIPE_CAP_FRAGMENT_SHADER_TEXTURE_LOD }, { o(ARB_sparse_buffer), PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE }, + { o(ARB_spirv_extensions), PIPE_CAP_GL_SPIRV }, { o(ARB_texture_buffer_object), PIPE_CAP_TEXTURE_BUFFER_OBJECTS }, { o(ARB_texture_cube_map_array), PIPE_CAP_CUBE_MAP_ARRAY }, { o(ARB_texture_gather), PIPE_CAP_MAX_TEXTURE_GATHER_COMPONENTS }, @@ -1656,4 +1659,22 @@ void st_init_extensions(struct pipe_screen *screen, pre_snap_triangles && pre_snap_points_lines; } } + + if (extensions->ARB_gl_spirv) { + struct spirv_supported_capabilities *spirv_caps = &consts->SpirVCapabilities; + + spirv_caps->atomic_storage = extensions->ARB_shader_atomic_counters; + spirv_caps->draw_parameters = extensions->ARB_shader_draw_parameters; + spirv_caps->float64 = extensions->ARB_gpu_shader_fp64; + spirv_caps->geometry_streams = extensions->ARB_gpu_shader5; + spirv_caps->image_write_without_format = extensions->ARB_shader_image_load_store; + spirv_caps->int64 = extensions->ARB_gpu_shader_int64; + spirv_caps->tessellation = extensions->ARB_tessellation_shader; + spirv_caps->transform_feedback = extensions->ARB_transform_feedback3; + spirv_caps->variable_pointers = + screen->get_param(screen, PIPE_CAP_GL_SPIRV_VARIABLE_POINTERS); + + consts->SpirVExtensions = CALLOC_STRUCT(spirv_supported_extensions); + _mesa_fill_supported_spirv_extensions(consts->SpirVExtensions, spirv_caps); + } } -- cgit v1.2.3