spirv: Add an execution environment to the options

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>
This commit is contained in:
Caio Marcelo de Oliveira Filho 2019-03-21 22:37:50 -07:00
parent dacb11a585
commit 15012077bc
2 changed files with 9 additions and 0 deletions

View 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.

View 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