[Mesa-dev] [PATCH 02/11] i965: initialize SPIR-V capabilities

Jason Ekstrand jason at jlekstrand.net
Mon Mar 26 17:44:02 UTC 2018


On March 26, 2018 07:53:44 Alejandro Piñeiro <apinheiro at igalia.com> wrote:

Ping.

This is the only pending patch to review from this series. Although it is 
independent enough and I could submit to master the rest of the series, I 
would prefer to push all the series, and move to shape a second batch 
without pending patches around.

Thanks in advance.


On 08/03/18 09:19, Alejandro Piñeiro wrote:
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.

Note: we initialize SPIR-V capabilities at brwCreateContext instead of
the usual brw_initialize_context_constants because we want to do that
only for version >= 3.3. At brw_initialize_context_constans GL version
is still not computed.

v2:
* Rebase update (SpirVCapabilities not a pointer anymore)
* Fill spirv capabilities for OpenGL >= 3.3 (Ian Romanick)
---
src/mesa/drivers/dri/i965/brw_context.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index fca5c8e3072..abd1592c0f5 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -78,6 +78,7 @@

#include "common/gen_defines.h"

+#include "compiler/spirv/nir_spirv.h"
/***************************************
* Mesa's Driver Functions
***************************************/
@@ -343,6 +344,21 @@ brw_init_driver_functions(struct brw_context *brw,
brw_deserialize_program_binary;
}

+static void
+brw_initialize_spirv_supported_capabilities(struct brw_context *brw)
+{
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
+   struct gl_context *ctx = &brw->ctx;
+
+   ctx->Const.SpirVCapabilities.float64 = devinfo->gen >= 8;
+   ctx->Const.SpirVCapabilities.int64 = devinfo->gen >= 8;
+   ctx->Const.SpirVCapabilities.tessellation = true;
+   ctx->Const.SpirVCapabilities.draw_parameters = true;
+   ctx->Const.SpirVCapabilities.image_write_without_format = true;
+   ctx->Const.SpirVCapabilities.multiview = true;

We don't support any multiview GL extension so this should probably be dropped.


+   ctx->Const.SpirVCapabilities.variable_pointers = true;
+}
+
static void
brw_initialize_context_constants(struct brw_context *brw)
{
@@ -1063,6 +1079,10 @@ brwCreateContext(gl_api api,
_mesa_override_extensions(ctx);
_mesa_compute_version(ctx);

+   /* GL_ARB_gl_spirv */
+   if (ctx->Version >= 33)

Do we really just want to check for 3.3 here or do we also want to check 
for core profile?  Maybe we just want to check if the SPIR-V extension is 
enabled.

Also, I believe SNB supports 3.3 but it does not support basically any of 
the above capabilities.


+      brw_initialize_spirv_supported_capabilities(brw);
+
_mesa_initialize_dispatch_tables(ctx);
_mesa_initialize_vbo_vtxfmt(ctx);

_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev





More information about the mesa-dev mailing list