Re: [Mesa-dev] [PATCH v4] i965: initialize SPIR-V capabilities

2018-03-30 Thread Alejandro Piñeiro


On 29/03/18 16:59, Jason Ekstrand wrote:
> On March 29, 2018 02:45:36 Alejandro Piñeiro 
> wrote:
>
> Needed for ARB_gl_spirv. Those are not the same that the Intel vulkan
> driver. 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."
>
> So in addition to the core SPIR-V support, 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. For this reason it is better to keep them separated.
>
> As an example: at the time of this patch writing Intel vulkan driver
> support multiview, but there isn't any OpenGL multiview GL extension
> supported.
>
> Note: we initialize SPIR-V capabilities at brwCreateContext instead of
> the usual brw_initialize_context_constants because we want to do that
> only if the extension is enabled.
>
> v2:
> * Rebase update (SpirVCapabilities not a pointer anymore)
> * Fill spirv capabilities for OpenGL >= 3.3 (Ian Romanick)
>
> v3:
> * Drop multiview support, as i965 doesn't support any multiview GL
> extension (Jason)
> * Fill spirv capabilities only if the extension is enabled (Jason)
> ---
>
> Minor tweak after last rebase against master.
>
>
> src/mesa/drivers/dri/i965/brw_context.c | 19 +++
> 1 file changed, 19 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_context.c
> b/src/mesa/drivers/dri/i965/brw_context.c
> index fca5c8e3072..11bd68ae61e 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,20 @@ 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 = >screen->devinfo;
> +   struct gl_context *ctx = >ctx;
> +
>
> Not all of this is supported on all hardware so I assume this
> extension is gen7+ only.

Yes, the patch that will enable the extension for i965 will do that only
for gen7+

> If so, please add a comment 

Ok.

> it an assert to that effect and you'd patch will be

Ok.

>
> Reviewed-by: Jason Ekstrand 

Thanks!

>
>
> +   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.variable_pointers = true;
> +}
> +
> static void
> brw_initialize_context_constants(struct brw_context *brw)
> {
> @@ -1063,6 +1078,10 @@ brwCreateContext(gl_api api,
> _mesa_override_extensions(ctx);
> _mesa_compute_version(ctx);
>
> +   /* GL_ARB_gl_spirv */
> +   if (ctx->Extensions.ARB_gl_spirv)
> +  brw_initialize_spirv_supported_capabilities(brw);
> +
> _mesa_initialize_dispatch_tables(ctx);
> _mesa_initialize_vbo_vtxfmt(ctx);
>
> -- 
> 2.14.1
>
>
>
>


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH v4] i965: initialize SPIR-V capabilities

2018-03-29 Thread Jason Ekstrand

On March 29, 2018 02:45:36 Alejandro Piñeiro  wrote:

Needed for ARB_gl_spirv. Those are not the same that the Intel vulkan
driver. 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."

So in addition to the core SPIR-V support, 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. For this reason it is better to keep them separated.

As an example: at the time of this patch writing Intel vulkan driver
support multiview, but there isn't any OpenGL multiview GL extension
supported.

Note: we initialize SPIR-V capabilities at brwCreateContext instead of
the usual brw_initialize_context_constants because we want to do that
only if the extension is enabled.

v2:
* Rebase update (SpirVCapabilities not a pointer anymore)
* Fill spirv capabilities for OpenGL >= 3.3 (Ian Romanick)

v3:
* Drop multiview support, as i965 doesn't support any multiview GL
extension (Jason)
* Fill spirv capabilities only if the extension is enabled (Jason)
---

Minor tweak after last rebase against master.


src/mesa/drivers/dri/i965/brw_context.c | 19 +++
1 file changed, 19 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c

index fca5c8e3072..11bd68ae61e 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,20 @@ 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 = >screen->devinfo;
+   struct gl_context *ctx = >ctx;
+

Not all of this is supported on all hardware so I assume this extension is 
gen7+ only.  If so, please add a comment it an assert to that effect and 
you'd patch will be


Reviewed-by: Jason Ekstrand 


+   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.variable_pointers = true;
+}
+
static void
brw_initialize_context_constants(struct brw_context *brw)
{
@@ -1063,6 +1078,10 @@ brwCreateContext(gl_api api,
_mesa_override_extensions(ctx);
_mesa_compute_version(ctx);

+   /* GL_ARB_gl_spirv */
+   if (ctx->Extensions.ARB_gl_spirv)
+  brw_initialize_spirv_supported_capabilities(brw);
+
_mesa_initialize_dispatch_tables(ctx);
_mesa_initialize_vbo_vtxfmt(ctx);

--
2.14.1



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH v4] i965: initialize SPIR-V capabilities

2018-03-29 Thread Alejandro Piñeiro
Needed for ARB_gl_spirv. Those are not the same that the Intel vulkan
driver. 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."

So in addition to the core SPIR-V support, 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. For this reason it is better to keep them separated.

As an example: at the time of this patch writing Intel vulkan driver
support multiview, but there isn't any OpenGL multiview GL extension
supported.

Note: we initialize SPIR-V capabilities at brwCreateContext instead of
the usual brw_initialize_context_constants because we want to do that
only if the extension is enabled.

v2:
   * Rebase update (SpirVCapabilities not a pointer anymore)
   * Fill spirv capabilities for OpenGL >= 3.3 (Ian Romanick)

v3:
   * Drop multiview support, as i965 doesn't support any multiview GL
 extension (Jason)
   * Fill spirv capabilities only if the extension is enabled (Jason)
---

Minor tweak after last rebase against master.


 src/mesa/drivers/dri/i965/brw_context.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index fca5c8e3072..11bd68ae61e 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,20 @@ 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 = >screen->devinfo;
+   struct gl_context *ctx = >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.variable_pointers = true;
+}
+
 static void
 brw_initialize_context_constants(struct brw_context *brw)
 {
@@ -1063,6 +1078,10 @@ brwCreateContext(gl_api api,
_mesa_override_extensions(ctx);
_mesa_compute_version(ctx);
 
+   /* GL_ARB_gl_spirv */
+   if (ctx->Extensions.ARB_gl_spirv)
+  brw_initialize_spirv_supported_capabilities(brw);
+
_mesa_initialize_dispatch_tables(ctx);
_mesa_initialize_vbo_vtxfmt(ctx);
 
-- 
2.14.1

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev