microsoft/compiler: Split handle annotation into two parts
The first part gets the resource props struct, and the second actually emits the annotate instruction. Later changes will get the resource props struct from different sources. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21913>
This commit is contained in:
@@ -956,14 +956,35 @@ emit_createhandle_call_pre_6_6(struct ntd_context *ctx,
|
||||
|
||||
static const struct dxil_value *
|
||||
emit_annotate_handle(struct ntd_context *ctx,
|
||||
enum dxil_resource_class resource_class,
|
||||
unsigned resource_range_id,
|
||||
const struct dxil_value *unannotated_handle)
|
||||
const struct dxil_value *unannotated_handle,
|
||||
const struct dxil_value *res_props)
|
||||
{
|
||||
const struct dxil_value *opcode = dxil_module_get_int32_const(&ctx->mod, DXIL_INTR_ANNOTATE_HANDLE);
|
||||
if (!opcode)
|
||||
return NULL;
|
||||
|
||||
const struct dxil_value *args[] = {
|
||||
opcode,
|
||||
unannotated_handle,
|
||||
res_props
|
||||
};
|
||||
|
||||
const struct dxil_func *func =
|
||||
dxil_get_function(&ctx->mod, "dx.op.annotateHandle", DXIL_NONE);
|
||||
|
||||
if (!func)
|
||||
return NULL;
|
||||
|
||||
return dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
|
||||
}
|
||||
|
||||
static const struct dxil_value *
|
||||
emit_annotate_handle_from_metadata(struct ntd_context *ctx,
|
||||
enum dxil_resource_class resource_class,
|
||||
unsigned resource_range_id,
|
||||
const struct dxil_value *unannotated_handle)
|
||||
{
|
||||
|
||||
const struct util_dynarray *mdnodes;
|
||||
switch (resource_class) {
|
||||
case DXIL_RESOURCE_CLASS_SRV:
|
||||
@@ -987,19 +1008,7 @@ emit_annotate_handle(struct ntd_context *ctx,
|
||||
if (!res_props)
|
||||
return NULL;
|
||||
|
||||
const struct dxil_value *args[] = {
|
||||
opcode,
|
||||
unannotated_handle,
|
||||
res_props
|
||||
};
|
||||
|
||||
const struct dxil_func *func =
|
||||
dxil_get_function(&ctx->mod, "dx.op.annotateHandle", DXIL_NONE);
|
||||
|
||||
if (!func)
|
||||
return NULL;
|
||||
|
||||
return dxil_emit_call(&ctx->mod, func, args, ARRAY_SIZE(args));
|
||||
return emit_annotate_handle(ctx, unannotated_handle, res_props);
|
||||
}
|
||||
|
||||
static const struct dxil_value *
|
||||
@@ -1035,7 +1044,7 @@ emit_createhandle_and_annotate(struct ntd_context *ctx,
|
||||
if (!unannotated_handle)
|
||||
return NULL;
|
||||
|
||||
return emit_annotate_handle(ctx, resource_class, resource_range_id, unannotated_handle);
|
||||
return emit_annotate_handle_from_metadata(ctx, resource_class, resource_range_id, unannotated_handle);
|
||||
}
|
||||
|
||||
static const struct dxil_value *
|
||||
|
Reference in New Issue
Block a user