aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/amd/common/ac_nir_to_llvm.c4
-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
-rw-r--r--src/freedreno/ir3/ir3_compiler_nir.c1
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_emit.c1
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_emit.h1
-rw-r--r--src/gallium/drivers/freedreno/a6xx/fd6_program.c1
-rw-r--r--src/gallium/drivers/freedreno/freedreno_util.h1
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_cmdline.c1
-rw-r--r--src/gallium/drivers/freedreno/ir3/ir3_gallium.c2
-rw-r--r--src/gallium/drivers/radeonsi/si_shader_nir.c4
-rw-r--r--src/mesa/main/shaderobj.h4
15 files changed, 41 insertions, 13 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index c558873bbee..ddf18c4c572 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -4097,13 +4097,13 @@ void ac_nir_translate(struct ac_llvm_context *ac, struct ac_shader_abi *abi,
setup_locals(&ctx, func);
- if (nir->info.stage == MESA_SHADER_COMPUTE)
+ if (gl_shader_stage_is_compute(nir->info.stage))
setup_shared(&ctx, nir);
visit_cf_list(&ctx, &func->impl->body);
phi_post_pass(&ctx);
- if (nir->info.stage != MESA_SHADER_COMPUTE)
+ if (!gl_shader_stage_is_compute(nir->info.stage))
ctx.abi->emit_outputs(ctx.abi, AC_LLVM_MAX_OUTPUTS,
ctx.abi->outputs);
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];
diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index 167d6ae7836..fd641735620 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -2831,6 +2831,7 @@ static const unsigned max_sysvals[] = {
[MESA_SHADER_FRAGMENT] = 24, // TODO
[MESA_SHADER_VERTEX] = 16,
[MESA_SHADER_COMPUTE] = 16, // TODO how many do we actually need?
+ [MESA_SHADER_KERNEL] = 16, // TODO how many do we actually need?
};
static void
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
index 711ff4ac66c..befb025930e 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
@@ -56,6 +56,7 @@ shader_t_to_opcode(gl_shader_stage type)
return CP_LOAD_STATE6_GEOM;
case MESA_SHADER_FRAGMENT:
case MESA_SHADER_COMPUTE:
+ case MESA_SHADER_KERNEL:
return CP_LOAD_STATE6_FRAG;
default:
unreachable("bad shader type");
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h
index 289e4877418..9e578844741 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.h
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.h
@@ -163,6 +163,7 @@ fd6_stage2shadersb(gl_shader_stage type)
case MESA_SHADER_FRAGMENT:
return SB6_FS_SHADER;
case MESA_SHADER_COMPUTE:
+ case MESA_SHADER_KERNEL:
return SB6_CS_SHADER;
default:
unreachable("bad shader type");
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c
index 53d4a1d3e5b..9fde74201dd 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_program.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.c
@@ -105,6 +105,7 @@ fd6_emit_shader(struct fd_ringbuffer *ring, const struct ir3_shader_variant *so)
break;
case MESA_SHADER_FRAGMENT:
case MESA_SHADER_COMPUTE:
+ case MESA_SHADER_KERNEL:
opcode = CP_LOAD_STATE6_FRAG;
break;
default:
diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h
index 17e64b03f38..3e7ea638a6e 100644
--- a/src/gallium/drivers/freedreno/freedreno_util.h
+++ b/src/gallium/drivers/freedreno/freedreno_util.h
@@ -480,6 +480,7 @@ fd4_stage2shadersb(gl_shader_stage type)
case MESA_SHADER_FRAGMENT:
return SB4_FS_SHADER;
case MESA_SHADER_COMPUTE:
+ case MESA_SHADER_KERNEL:
return SB4_CS_SHADER;
default:
unreachable("bad shader type");
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
index 94838416ece..364e62b308c 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c
@@ -165,6 +165,7 @@ load_glsl(unsigned num_files, char* const* files, gl_shader_stage stage)
ir3_glsl_type_size);
break;
case MESA_SHADER_COMPUTE:
+ case MESA_SHADER_KERNEL:
break;
default:
errx(1, "unhandled shader stage: %d", stage);
diff --git a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
index cc6efa1ca17..7e7b699678f 100644
--- a/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
+++ b/src/gallium/drivers/freedreno/ir3/ir3_gallium.c
@@ -588,7 +588,7 @@ void
ir3_emit_cs_consts(const struct ir3_shader_variant *v, struct fd_ringbuffer *ring,
struct fd_context *ctx, const struct pipe_grid_info *info)
{
- debug_assert(v->type == MESA_SHADER_COMPUTE);
+ debug_assert(gl_shader_stage_is_compute(v->type));
emit_common_consts(v, ring, ctx, PIPE_SHADER_COMPUTE);
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c
index 65da6384c7d..037376a22ef 100644
--- a/src/gallium/drivers/radeonsi/si_shader_nir.c
+++ b/src/gallium/drivers/radeonsi/si_shader_nir.c
@@ -362,7 +362,7 @@ void si_nir_scan_shader(const struct nir_shader *nir,
}
}
- if (nir->info.stage == MESA_SHADER_COMPUTE) {
+ if (gl_shader_stage_is_compute(nir->info.stage)) {
info->properties[TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH] = nir->info.cs.local_size[0];
info->properties[TGSI_PROPERTY_CS_FIXED_BLOCK_HEIGHT] = nir->info.cs.local_size[1];
info->properties[TGSI_PROPERTY_CS_FIXED_BLOCK_DEPTH] = nir->info.cs.local_size[2];
@@ -1051,7 +1051,7 @@ bool si_nir_build_llvm(struct si_shader_context *ctx, struct nir_shader *nir)
ctx->num_images = util_last_bit(info->images_declared);
if (ctx->shader->selector->info.properties[TGSI_PROPERTY_CS_LOCAL_SIZE]) {
- assert(nir->info.stage == MESA_SHADER_COMPUTE);
+ assert(gl_shader_stage_is_compute(nir->info.stage));
si_declare_compute_memory(ctx);
}
ac_nir_translate(&ctx->ac, &ctx->abi, nir);
diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h
index c7ccc54afe4..0d512550de4 100644
--- a/src/mesa/main/shaderobj.h
+++ b/src/mesa/main/shaderobj.h
@@ -225,6 +225,9 @@ _mesa_shader_stage_to_subroutine(gl_shader_stage stage)
return GL_TESS_EVALUATION_SUBROUTINE;
case MESA_SHADER_NONE:
break;
+ case MESA_SHADER_KERNEL:
+ unreachable("not reached");
+ break;
}
unreachable("not reached");
}
@@ -246,6 +249,7 @@ _mesa_shader_stage_to_subroutine_uniform(gl_shader_stage stage)
case MESA_SHADER_TESS_EVAL:
return GL_TESS_EVALUATION_SUBROUTINE_UNIFORM;
case MESA_SHADER_NONE:
+ case MESA_SHADER_KERNEL:
break;
}
unreachable("not reached");