summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir.c2
-rw-r--r--src/compiler/nir/nir_print.c7
-rw-r--r--src/compiler/shader_enums.c5
-rw-r--r--src/compiler/shader_enums.h18
-rw-r--r--src/compiler/spirv/spirv_to_nir.c2
5 files changed, 26 insertions, 8 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 8ca81093515..60e30ae1008 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -148,7 +148,7 @@ nir_shader_add_variable(nir_shader *shader, nir_variable *var)
break;
case nir_var_mem_shared:
- assert(shader->info.stage == MESA_SHADER_COMPUTE);
+ assert(gl_shader_stage_is_compute(shader->info.stage));
exec_list_push_tail(&shader->shared, &var->node);
break;
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 1bec3876143..80bc25fde9a 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -534,6 +534,7 @@ print_var_decl(nir_variable *var, print_state *state)
case MESA_SHADER_TESS_CTRL:
case MESA_SHADER_TESS_EVAL:
case MESA_SHADER_COMPUTE:
+ case MESA_SHADER_KERNEL:
default:
/* TODO */
break;
@@ -1350,17 +1351,13 @@ nir_print_shader_annotated(nir_shader *shader, FILE *fp,
if (shader->info.label)
fprintf(fp, "label: %s\n", shader->info.label);
- switch (shader->info.stage) {
- case MESA_SHADER_COMPUTE:
+ if (gl_shader_stage_is_compute(shader->info.stage)) {
fprintf(fp, "local-size: %u, %u, %u%s\n",
shader->info.cs.local_size[0],
shader->info.cs.local_size[1],
shader->info.cs.local_size[2],
shader->info.cs.local_size_variable ? " (variable)" : "");
fprintf(fp, "shared-size: %u\n", shader->info.cs.shared_size);
- break;
- default:
- break;
}
fprintf(fp, "inputs: %u\n", shader->num_inputs);
diff --git a/src/compiler/shader_enums.c b/src/compiler/shader_enums.c
index 0210b503d3f..15ab6d81dae 100644
--- a/src/compiler/shader_enums.c
+++ b/src/compiler/shader_enums.c
@@ -43,8 +43,9 @@ gl_shader_stage_name(gl_shader_stage stage)
ENUM(MESA_SHADER_GEOMETRY),
ENUM(MESA_SHADER_FRAGMENT),
ENUM(MESA_SHADER_COMPUTE),
+ ENUM(MESA_SHADER_KERNEL),
};
- STATIC_ASSERT(ARRAY_SIZE(names) == MESA_SHADER_STAGES);
+ STATIC_ASSERT(ARRAY_SIZE(names) == MESA_ALL_SHADER_STAGES);
return NAME(stage);
}
@@ -60,6 +61,7 @@ _mesa_shader_stage_to_string(unsigned stage)
case MESA_SHADER_FRAGMENT: return "fragment";
case MESA_SHADER_GEOMETRY: return "geometry";
case MESA_SHADER_COMPUTE: return "compute";
+ case MESA_SHADER_KERNEL: return "kernel";
case MESA_SHADER_TESS_CTRL: return "tessellation control";
case MESA_SHADER_TESS_EVAL: return "tessellation evaluation";
}
@@ -79,6 +81,7 @@ _mesa_shader_stage_to_abbrev(unsigned stage)
case MESA_SHADER_FRAGMENT: return "FS";
case MESA_SHADER_GEOMETRY: return "GS";
case MESA_SHADER_COMPUTE: return "CS";
+ case MESA_SHADER_KERNEL: return "CL";
case MESA_SHADER_TESS_CTRL: return "TCS";
case MESA_SHADER_TESS_EVAL: return "TES";
}
diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h
index f023b48cbb3..1dff01484b5 100644
--- a/src/compiler/shader_enums.h
+++ b/src/compiler/shader_enums.h
@@ -26,6 +26,8 @@
#ifndef SHADER_ENUMS_H
#define SHADER_ENUMS_H
+#include <stdbool.h>
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -46,8 +48,16 @@ typedef enum
MESA_SHADER_GEOMETRY = 3,
MESA_SHADER_FRAGMENT = 4,
MESA_SHADER_COMPUTE = 5,
+ /* must be last so it doesn't affect the GL pipeline */
+ MESA_SHADER_KERNEL = 6,
} gl_shader_stage;
+static inline bool
+gl_shader_stage_is_compute(gl_shader_stage stage)
+{
+ return stage == MESA_SHADER_COMPUTE || stage == MESA_SHADER_KERNEL;
+}
+
/**
* Number of STATE_* values we need to address any GL state.
* Used to dimension arrays.
@@ -70,8 +80,16 @@ const char *_mesa_shader_stage_to_string(unsigned stage);
*/
const char *_mesa_shader_stage_to_abbrev(unsigned stage);
+/**
+ * GL related stages (not including CL)
+ */
#define MESA_SHADER_STAGES (MESA_SHADER_COMPUTE + 1)
+/**
+ * All stages
+ */
+#define MESA_ALL_SHADER_STAGES (MESA_SHADER_KERNEL + 1)
+
/**
* Indexes for vertex program attributes.
diff --git a/src/compiler/spirv/spirv_to_nir.c b/src/compiler/spirv/spirv_to_nir.c
index 0ca1ee48b5e..1a86312539e 100644
--- a/src/compiler/spirv/spirv_to_nir.c
+++ b/src/compiler/spirv/spirv_to_nir.c
@@ -3767,7 +3767,7 @@ vtn_handle_execution_mode(struct vtn_builder *b, struct vtn_value *entry_point,
break;
case SpvExecutionModeLocalSize:
- vtn_assert(b->shader->info.stage == MESA_SHADER_COMPUTE);
+ vtn_assert(gl_shader_stage_is_compute(b->shader->info.stage));
b->shader->info.cs.local_size[0] = mode->literals[0];
b->shader->info.cs.local_size[1] = mode->literals[1];
b->shader->info.cs.local_size[2] = mode->literals[2];