summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-09-21 15:51:55 -0700
committerJason Ekstrand <[email protected]>2018-03-07 12:13:47 -0800
commitff9db1a4cc0eefece2d0485a169b2a289b2ff6ef (patch)
treeabae254b6379ef442df9569d1c52b69ab7f4f32c /src/compiler
parentddc4069122168feb34d4a272a6ef90ba1b4a07db (diff)
nir/spirv: Add support for device groups
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir.h2
-rw-r--r--src/compiler/nir/nir_lower_system_values.c5
-rw-r--r--src/compiler/shader_enums.c1
-rw-r--r--src/compiler/shader_enums.h3
-rw-r--r--src/compiler/shader_info.h1
-rw-r--r--src/compiler/spirv/spirv_to_nir.c4
-rw-r--r--src/compiler/spirv/vtn_variables.c4
7 files changed, 20 insertions, 0 deletions
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index c676331000f..804a6561bff 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -1888,6 +1888,8 @@ typedef struct nir_shader_compiler_options {
bool lower_cs_local_index_from_id;
+ bool lower_device_index_to_zero;
+
/**
* Should nir_lower_io() create load_interpolated_input intrinsics?
*
diff --git a/src/compiler/nir/nir_lower_system_values.c b/src/compiler/nir/nir_lower_system_values.c
index 3594f4ae5ce..fb560ee21bb 100644
--- a/src/compiler/nir/nir_lower_system_values.c
+++ b/src/compiler/nir/nir_lower_system_values.c
@@ -133,6 +133,11 @@ convert_block(nir_block *block, nir_builder *b)
break;
}
+ case SYSTEM_VALUE_DEVICE_INDEX:
+ if (b->shader->options->lower_device_index_to_zero)
+ sysval = nir_imm_int(b, 0);
+ break;
+
default:
break;
}
diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c
index 2179c475abd..62c1ac1f073 100644
--- a/src/compiler/shader_enums.c
+++ b/src/compiler/shader_enums.c
@@ -232,6 +232,7 @@ gl_system_value_name(gl_system_value sysval)
ENUM(SYSTEM_VALUE_GLOBAL_INVOCATION_ID),
ENUM(SYSTEM_VALUE_WORK_GROUP_ID),
ENUM(SYSTEM_VALUE_NUM_WORK_GROUPS),
+ ENUM(SYSTEM_VALUE_DEVICE_INDEX),
ENUM(SYSTEM_VALUE_VIEW_INDEX),
ENUM(SYSTEM_VALUE_VERTEX_CNT),
};
diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h
index ac83c65b30c..64fb68828ed 100644
--- a/src/compiler/shader_enums.h
+++ b/src/compiler/shader_enums.h
@@ -558,6 +558,9 @@ typedef enum
SYSTEM_VALUE_LOCAL_GROUP_SIZE,
/*@}*/
+ /** Required for VK_KHR_device_group */
+ SYSTEM_VALUE_DEVICE_INDEX,
+
/** Required for VK_KHX_multiview */
SYSTEM_VALUE_VIEW_INDEX,
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 2fcbde74bee..00aee77c002 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -36,6 +36,7 @@ struct spirv_supported_capabilities {
bool float64;
bool image_ms_array;
bool tessellation;
+ bool device_group;
bool draw_parameters;
bool image_read_without_format;
bool image_write_without_format;
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 1c52f7ff615..f0122a43424 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3283,6 +3283,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
spv_check_supported(image_write_without_format, cap);
break;
+ case SpvCapabilityDeviceGroup:
+ spv_check_supported(device_group, cap);
+ break;
+
case SpvCapabilityMultiView:
spv_check_supported(multiview, cap);
break;
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 11d2aabac8c..da511a44b08 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1293,6 +1293,10 @@ vtn_get_builtin_location(struct vtn_builder *b,
*location = SYSTEM_VALUE_DRAW_ID;
set_mode_system_value(b, mode);
break;
+ case SpvBuiltInDeviceIndex:
+ *location = SYSTEM_VALUE_DEVICE_INDEX;
+ set_mode_system_value(b, mode);
+ break;
case SpvBuiltInViewIndex:
*location = SYSTEM_VALUE_VIEW_INDEX;
set_mode_system_value(b, mode);