spirv: Add an execution environment to the options
authorCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Fri, 22 Mar 2019 05:37:50 +0000 (22:37 -0700)
committerCaio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Sat, 23 Mar 2019 16:29:21 +0000 (09:29 -0700)
Also updates gl_spirv to pick the right one.  At the moment nothing
uses it, but upcoming functionality part of ARB_gl_spirv will use it,
and we also later can be more assertful when handling certain features
for each of the execution environments.

Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
Acked-by: Karol Herbst <kherbst@redhat.com>
src/compiler/spirv/nir_spirv.h
src/mesa/main/glspirv.c

index d8ccbb48ff8682ce3ea6bc616319897dba62093f..7a16422b291e43b86930b06e596f70a7109e0053 100644 (file)
@@ -50,7 +50,15 @@ enum nir_spirv_debug_level {
    NIR_SPIRV_DEBUG_LEVEL_ERROR,
 };
 
+enum nir_spirv_execution_environment {
+   NIR_SPIRV_VULKAN = 0,
+   NIR_SPIRV_OPENCL,
+   NIR_SPIRV_OPENGL,
+};
+
 struct spirv_to_nir_options {
+   enum nir_spirv_execution_environment environment;
+
    /* Whether or not to lower all workgroup variable access to offsets
     * up-front.  This means you will _shared intrinsics instead of _var
     * for workgroup data access.
index 227971091e12d2fd78c098247c4553a4b6823208..84550e96ff6520409afbffb8cc37d634f64cd0ca 100644 (file)
@@ -211,6 +211,7 @@ _mesa_spirv_to_nir(struct gl_context *ctx,
    }
 
    const struct spirv_to_nir_options spirv_options = {
+      .environment = NIR_SPIRV_OPENGL,
       .lower_workgroup_access_to_offsets = true,
       .lower_ubo_ssbo_access_to_offsets = true,
       .caps = ctx->Const.SpirVCapabilities