microsoft/compiler: Handle base vertex/instance sysvals as DXIL intrinsics

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28383>
This commit is contained in:
Jesse Natalie
2024-03-25 07:36:00 -07:00
committed by Marge Bot
parent 349c4d84c0
commit 607720151f
2 changed files with 14 additions and 0 deletions
+2
View File
@@ -113,6 +113,8 @@ static struct predefined_func_descr predefined_funcs[] = {
{"dx.op.quadReadLaneAt", "O", "iOi", DXIL_ATTR_KIND_NO_UNWIND},
{"dx.op.quadOp", "O", "iOc", DXIL_ATTR_KIND_NO_UNWIND},
{"dx.op.dot4AddPacked", "i", "iiii", DXIL_ATTR_KIND_READ_NONE},
{"dx.op.startVertexLocation", "i", "i", DXIL_ATTR_KIND_READ_NONE},
{"dx.op.startInstanceLocation", "i", "i", DXIL_ATTR_KIND_READ_NONE},
};
struct func_descr {
+12
View File
@@ -390,6 +390,9 @@ enum dxil_intr {
DXIL_INTR_SAMPLE_CMP_LEVEL = 224,
DXIL_INTR_SAMPLE_CMP_GRAD = 254,
DXIL_INTR_SAMPLE_CMP_BIAS = 255,
DXIL_INTR_START_VERTEX_LOCATION = 256,
DXIL_INTR_START_INSTANCE_LOCATION = 257,
};
enum dxil_atomic_op {
@@ -4939,6 +4942,15 @@ emit_intrinsic(struct ntd_context *ctx, nir_intrinsic_instr *intr)
case nir_intrinsic_exclusive_scan:
return emit_reduce(ctx, intr);
case nir_intrinsic_load_first_vertex:
ctx->mod.feats.extended_command_info = true;
return emit_load_unary_external_function(ctx, intr, "dx.op.startVertexLocation",
DXIL_INTR_START_VERTEX_LOCATION, nir_type_int);
case nir_intrinsic_load_base_instance:
ctx->mod.feats.extended_command_info = true;
return emit_load_unary_external_function(ctx, intr, "dx.op.startInstanceLocation",
DXIL_INTR_START_INSTANCE_LOCATION, nir_type_int);
case nir_intrinsic_load_num_workgroups:
case nir_intrinsic_load_workgroup_size:
default: