mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 12:30:09 +01:00
microsoft/compiler: Add support for local_invocation_index
Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12228>
This commit is contained in:
parent
f9f3713c84
commit
cc8a122907
2 changed files with 39 additions and 0 deletions
|
|
@ -43,6 +43,7 @@ static struct predefined_func_descr predefined_funcs[] = {
|
|||
{"dx.op.tertiary", "O", "iOOO", DXIL_ATTR_KIND_READ_NONE},
|
||||
{"dx.op.threadId", "i", "ii", DXIL_ATTR_KIND_READ_NONE},
|
||||
{"dx.op.threadIdInGroup", "i", "ii", DXIL_ATTR_KIND_READ_NONE},
|
||||
{"dx.op.flattenedThreadIdInGroup", "i", "i", DXIL_ATTR_KIND_READ_NONE},
|
||||
{"dx.op.groupId", "i", "ii", DXIL_ATTR_KIND_READ_NONE},
|
||||
{"dx.op.unary", "O", "iO", DXIL_ATTR_KIND_READ_NONE},
|
||||
{"dx.op.unaryBits", "i", "iO", DXIL_ATTR_KIND_READ_NONE},
|
||||
|
|
|
|||
|
|
@ -249,6 +249,7 @@ enum dxil_intr {
|
|||
DXIL_INTR_THREAD_ID = 93,
|
||||
DXIL_INTR_GROUP_ID = 94,
|
||||
DXIL_INTR_THREAD_ID_IN_GROUP = 95,
|
||||
DXIL_INTR_FLATTENED_THREAD_ID_IN_GROUP = 96,
|
||||
|
||||
DXIL_INTR_EMIT_STREAM = 97,
|
||||
DXIL_INTR_CUT_STREAM = 98,
|
||||
|
|
@ -557,6 +558,26 @@ emit_threadidingroup_call(struct ntd_context *ctx,
|
|||
return dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
|
||||
}
|
||||
|
||||
static const struct dxil_value *
|
||||
emit_flattenedthreadidingroup_call(struct ntd_context *ctx)
|
||||
{
|
||||
const struct dxil_func *func = dxil_get_function(&ctx->mod, "dx.op.flattenedThreadIdInGroup", DXIL_I32);
|
||||
|
||||
if (!func)
|
||||
return NULL;
|
||||
|
||||
const struct dxil_value *opcode = dxil_module_get_int32_const(&ctx->mod,
|
||||
DXIL_INTR_FLATTENED_THREAD_ID_IN_GROUP);
|
||||
if (!opcode)
|
||||
return NULL;
|
||||
|
||||
const struct dxil_value *args[] = {
|
||||
opcode
|
||||
};
|
||||
|
||||
return dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
|
||||
}
|
||||
|
||||
static const struct dxil_value *
|
||||
emit_groupid_call(struct ntd_context *ctx, const struct dxil_value *comp)
|
||||
{
|
||||
|
|
@ -2287,6 +2308,21 @@ emit_load_local_invocation_id(struct ntd_context *ctx,
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
emit_load_local_invocation_index(struct ntd_context *ctx,
|
||||
nir_intrinsic_instr *intr)
|
||||
{
|
||||
assert(intr->dest.is_ssa);
|
||||
|
||||
const struct dxil_value
|
||||
*flattenedthreadidingroup = emit_flattenedthreadidingroup_call(ctx);
|
||||
if (!flattenedthreadidingroup)
|
||||
return false;
|
||||
store_dest_value(ctx, &intr->dest, 0, flattenedthreadidingroup);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
emit_load_local_workgroup_id(struct ntd_context *ctx,
|
||||
nir_intrinsic_instr *intr)
|
||||
|
|
@ -3480,6 +3516,8 @@ emit_intrinsic(struct ntd_context *ctx, nir_intrinsic_instr *intr)
|
|||
return emit_load_global_invocation_id(ctx, intr);
|
||||
case nir_intrinsic_load_local_invocation_id:
|
||||
return emit_load_local_invocation_id(ctx, intr);
|
||||
case nir_intrinsic_load_local_invocation_index:
|
||||
return emit_load_local_invocation_index(ctx, intr);
|
||||
case nir_intrinsic_load_workgroup_id:
|
||||
case nir_intrinsic_load_workgroup_id_zero_base:
|
||||
return emit_load_local_workgroup_id(ctx, intr);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue