From: Alejandro Piñeiro <apinhe...@igalia.com> Needed for ARB_gl_spirv. Right now those are the same that the intel vulkan driver, but those are not shared. From the ARB_spirv_extensions spec:
"3. If a new GL extension is added that includes SPIR-V support via a new SPIR-V extension does it's SPIR-V extension also get enumerated by the SPIR_V_EXTENSIONS_ARB query?. RESOLVED. Yes. It's good to include it for consistency. Any SPIR-V functionality supported beyond the SPIR-V version that is required for the GL API version should be enumerated." Reading between lines, there is the possibility of specific GL extensions enabling specific SPIR-V extensions (so capabilities). That would mean that it is possible that OpenGL and Vulkan not having the same capabilities supported, even for the same driver. So for now we keep them separate. Perhaps in the future it is better to keep them the same and synced. v2: Fix off-tree compilation, including full path to nir/nir.h inside spirv/nir_spirv.h. (Eduardo Lima) --- src/compiler/spirv/nir_spirv.h | 2 +- src/mesa/drivers/dri/i965/brw_context.c | 23 +++++++++++++++++++++++ src/mesa/main/context.c | 2 ++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/compiler/spirv/nir_spirv.h b/src/compiler/spirv/nir_spirv.h index 0204e81d091..d975254047a 100644 --- a/src/compiler/spirv/nir_spirv.h +++ b/src/compiler/spirv/nir_spirv.h @@ -28,7 +28,7 @@ #ifndef _NIR_SPIRV_H_ #define _NIR_SPIRV_H_ -#include "nir/nir.h" +#include "compiler/nir/nir.h" #ifdef __cplusplus extern "C" { diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 19d5a2e3503..b85f36cfbbd 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -75,6 +75,7 @@ #include "util/debug.h" #include "isl/isl.h" +#include "compiler/spirv/nir_spirv.h" /*************************************** * Mesa's Driver Functions ***************************************/ @@ -331,6 +332,24 @@ brw_init_driver_functions(struct brw_context *brw, functions->GetSamplePosition = gen6_get_sample_position; } +static struct nir_spirv_supported_capabilities * +brw_initialize_spirv_supported_capabilities(struct brw_context *brw) +{ + const struct gen_device_info *devinfo = &brw->screen->devinfo; + struct nir_spirv_supported_capabilities *cap = + MALLOC_STRUCT(nir_spirv_supported_capabilities); + + cap->float64 = devinfo->gen >= 8; + cap->int64 = devinfo->gen >= 8; + cap->tessellation = true; + cap->draw_parameters = true; + cap->image_write_without_format = true; + cap->multiview = true; + cap->variable_pointers = true; + + return cap; +} + static void brw_initialize_context_constants(struct brw_context *brw) { @@ -697,6 +716,10 @@ brw_initialize_context_constants(struct brw_context *brw) if (!(ctx->Const.ContextFlags & GL_CONTEXT_FLAG_DEBUG_BIT)) ctx->Const.AllowMappedBuffersDuringExecution = true; + + /* GL_ARB_gl_spirv */ + ctx->Const.SpirVCapabilities = + brw_initialize_spirv_supported_capabilities(brw); } static void diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 61099eb39f2..837c1138998 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1378,6 +1378,8 @@ _mesa_free_context_data( struct gl_context *ctx ) if (ctx == _mesa_get_current_context()) { _mesa_make_current(NULL, NULL, NULL); } + + free(ctx->Const.SpirVCapabilities); } -- 2.11.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev