vkd3d-shader/hlsl: Implement the InterlockedOr() intrinsic.

This commit is contained in:
Shaun Ren 2024-12-13 16:26:24 -05:00 committed by Henri Verbeet
parent 5b9634a7b7
commit cbd504e888
Notes: Henri Verbeet 2025-01-20 16:18:51 +01:00
Approved-by: Henri Verbeet (@hverbeet)
Approved-by: Elizabeth Figura (@zfigura)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1330
5 changed files with 13 additions and 0 deletions

View File

@ -3512,6 +3512,7 @@ static void dump_ir_interlocked(struct vkd3d_string_buffer *buffer, const struct
[HLSL_INTERLOCKED_EXCH] = "exch",
[HLSL_INTERLOCKED_MAX] = "max",
[HLSL_INTERLOCKED_MIN] = "min",
[HLSL_INTERLOCKED_OR] = "or",
};
VKD3D_ASSERT(interlocked->op < ARRAY_SIZE(op_names));

View File

@ -959,6 +959,7 @@ enum hlsl_interlocked_op
HLSL_INTERLOCKED_EXCH,
HLSL_INTERLOCKED_MAX,
HLSL_INTERLOCKED_MIN,
HLSL_INTERLOCKED_OR,
};
/* Represents an interlocked operation.

View File

@ -5542,6 +5542,12 @@ static bool intrinsic_InterlockedMin(struct hlsl_ctx *ctx,
return intrinsic_interlocked(ctx, HLSL_INTERLOCKED_MIN, params, loc, "InterlockedMin");
}
static bool intrinsic_InterlockedOr(struct hlsl_ctx *ctx,
const struct parse_initializer *params, const struct vkd3d_shader_location *loc)
{
return intrinsic_interlocked(ctx, HLSL_INTERLOCKED_OR, params, loc, "InterlockedOr");
}
static const struct intrinsic_function
{
const char *name;
@ -5562,6 +5568,7 @@ intrinsic_functions[] =
{"InterlockedExchange", 3, true, intrinsic_InterlockedExchange},
{"InterlockedMax", -1, true, intrinsic_InterlockedMax},
{"InterlockedMin", -1, true, intrinsic_InterlockedMin},
{"InterlockedOr", -1, true, intrinsic_InterlockedOr},
{"abs", 1, true, intrinsic_abs},
{"acos", 1, true, intrinsic_acos},
{"all", 1, true, intrinsic_all},

View File

@ -10005,6 +10005,7 @@ static bool sm4_generate_vsir_instr_interlocked(struct hlsl_ctx *ctx,
[HLSL_INTERLOCKED_CMP_EXCH] = VKD3DSIH_ATOMIC_CMP_STORE,
[HLSL_INTERLOCKED_MAX] = VKD3DSIH_ATOMIC_UMAX,
[HLSL_INTERLOCKED_MIN] = VKD3DSIH_ATOMIC_UMIN,
[HLSL_INTERLOCKED_OR] = VKD3DSIH_ATOMIC_OR,
};
static const enum vkd3d_shader_opcode imm_opcodes[] =
@ -10015,6 +10016,7 @@ static bool sm4_generate_vsir_instr_interlocked(struct hlsl_ctx *ctx,
[HLSL_INTERLOCKED_EXCH] = VKD3DSIH_IMM_ATOMIC_EXCH,
[HLSL_INTERLOCKED_MAX] = VKD3DSIH_IMM_ATOMIC_UMAX,
[HLSL_INTERLOCKED_MIN] = VKD3DSIH_IMM_ATOMIC_UMIN,
[HLSL_INTERLOCKED_OR] = VKD3DSIH_IMM_ATOMIC_OR,
};
struct hlsl_ir_node *cmp_value = interlocked->cmp_value.node, *value = interlocked->value.node;

View File

@ -4033,6 +4033,7 @@ static void tpf_handle_instruction(struct tpf_compiler *tpf, const struct vkd3d_
case VKD3DSIH_ATOMIC_IMIN:
case VKD3DSIH_ATOMIC_UMAX:
case VKD3DSIH_ATOMIC_UMIN:
case VKD3DSIH_ATOMIC_OR:
case VKD3DSIH_AND:
case VKD3DSIH_BREAK:
case VKD3DSIH_CASE:
@ -4083,6 +4084,7 @@ static void tpf_handle_instruction(struct tpf_compiler *tpf, const struct vkd3d_
case VKD3DSIH_IMM_ATOMIC_IMIN:
case VKD3DSIH_IMM_ATOMIC_UMAX:
case VKD3DSIH_IMM_ATOMIC_UMIN:
case VKD3DSIH_IMM_ATOMIC_OR:
case VKD3DSIH_IMUL:
case VKD3DSIH_INE:
case VKD3DSIH_INEG: