mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Write SM4 UAV store instructions.
This commit is contained in:
parent
03f9d16047
commit
9bdae4dfaa
Notes:
Alexandre Julliard
2022-10-31 22:39:35 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/36
@ -1608,6 +1608,24 @@ static void write_sm4_cast(struct hlsl_ctx *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
static void write_sm4_store_uav_typed(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer,
|
||||
const struct hlsl_deref *dst, const struct hlsl_ir_node *coords, const struct hlsl_ir_node *value)
|
||||
{
|
||||
struct sm4_instruction instr;
|
||||
|
||||
memset(&instr, 0, sizeof(instr));
|
||||
instr.opcode = VKD3D_SM5_OP_STORE_UAV_TYPED;
|
||||
|
||||
sm4_register_from_deref(ctx, &instr.dsts[0].reg, &instr.dsts[0].writemask, NULL, dst, dst->var->data_type);
|
||||
instr.dst_count = 1;
|
||||
|
||||
sm4_src_from_node(&instr.srcs[0], coords, VKD3DSP_WRITEMASK_ALL);
|
||||
sm4_src_from_node(&instr.srcs[1], value, VKD3DSP_WRITEMASK_ALL);
|
||||
instr.src_count = 2;
|
||||
|
||||
write_sm4_instruction(buffer, &instr);
|
||||
}
|
||||
|
||||
static void write_sm4_expr(struct hlsl_ctx *ctx,
|
||||
struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_expr *expr)
|
||||
{
|
||||
@ -2176,6 +2194,27 @@ static void write_sm4_resource_load(struct hlsl_ctx *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
static void write_sm4_resource_store(struct hlsl_ctx *ctx,
|
||||
struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_resource_store *store)
|
||||
{
|
||||
const struct hlsl_type *resource_type = store->resource.var->data_type;
|
||||
|
||||
if (resource_type->type != HLSL_CLASS_OBJECT)
|
||||
{
|
||||
assert(resource_type->type == HLSL_CLASS_ARRAY || resource_type->type == HLSL_CLASS_STRUCT);
|
||||
hlsl_fixme(ctx, &store->node.loc, "Resource being a component of another variable.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!store->resource.var->is_uniform)
|
||||
{
|
||||
hlsl_fixme(ctx, &store->node.loc, "Store to non-uniform resource variable.");
|
||||
return;
|
||||
}
|
||||
|
||||
write_sm4_store_uav_typed(ctx, buffer, &store->resource, store->coords.node, store->value.node);
|
||||
}
|
||||
|
||||
static void write_sm4_store(struct hlsl_ctx *ctx,
|
||||
struct vkd3d_bytecode_buffer *buffer, const struct hlsl_ir_store *store)
|
||||
{
|
||||
@ -2261,6 +2300,10 @@ static void write_sm4_block(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *
|
||||
write_sm4_resource_load(ctx, buffer, hlsl_ir_resource_load(instr));
|
||||
break;
|
||||
|
||||
case HLSL_IR_RESOURCE_STORE:
|
||||
write_sm4_resource_store(ctx, buffer, hlsl_ir_resource_store(instr));
|
||||
break;
|
||||
|
||||
case HLSL_IR_LOOP:
|
||||
write_sm4_loop(ctx, buffer, hlsl_ir_loop(instr));
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user