mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/dxil: Implement the DXIL STORE instruction.
This commit is contained in:
parent
2d5f2bf7a4
commit
3db7c2a62d
Notes:
Alexandre Julliard
2023-12-11 23:20:30 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/498
@ -2860,17 +2860,19 @@ static const struct vkd3d_shader_immediate_constant_buffer *resolve_forward_init
|
||||
|
||||
assert(index);
|
||||
--index;
|
||||
if (!(value = sm6_parser_get_value_safe(sm6, index)) || !sm6_value_is_icb(value))
|
||||
if (!(value = sm6_parser_get_value_safe(sm6, index)) || (!sm6_value_is_icb(value) && !sm6_value_is_undef(value)))
|
||||
{
|
||||
WARN("Invalid initialiser index %zu.\n", index);
|
||||
vkd3d_shader_parser_error(&sm6->p, VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND,
|
||||
"Global variable initialiser value index %zu is invalid.", index);
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
else if (sm6_value_is_icb(value))
|
||||
{
|
||||
return value->u.icb;
|
||||
}
|
||||
/* In VSIR, initialisation with undefined values of objects is implied, not explicit. */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static enum vkd3d_result sm6_parser_globals_init(struct sm6_parser *sm6)
|
||||
@ -4282,6 +4284,57 @@ static void sm6_parser_emit_ret(struct sm6_parser *sm6, const struct dxil_record
|
||||
ins->handler_idx = VKD3DSIH_NOP;
|
||||
}
|
||||
|
||||
static void sm6_parser_emit_store(struct sm6_parser *sm6, const struct dxil_record *record,
|
||||
struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
|
||||
{
|
||||
struct vkd3d_shader_src_param *src_param;
|
||||
struct vkd3d_shader_dst_param *dst_param;
|
||||
const struct sm6_type *pointee_type;
|
||||
const struct sm6_value *ptr, *src;
|
||||
unsigned int i = 0, alignment;
|
||||
uint64_t alignment_code;
|
||||
|
||||
if (!(ptr = sm6_parser_get_value_by_ref(sm6, record, NULL, &i))
|
||||
|| !sm6_value_validate_is_register(ptr, sm6)
|
||||
|| !sm6_value_validate_is_pointer(ptr, sm6))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
pointee_type = ptr->type->u.pointer.type;
|
||||
if (!(src = sm6_parser_get_value_by_ref(sm6, record, pointee_type, &i)))
|
||||
return;
|
||||
if (!sm6_value_validate_is_numeric(src, sm6))
|
||||
return;
|
||||
|
||||
if (pointee_type != src->type)
|
||||
{
|
||||
WARN("Type mismatch.\n");
|
||||
vkd3d_shader_parser_warning(&sm6->p, VKD3D_SHADER_WARNING_DXIL_TYPE_MISMATCH,
|
||||
"Type mismatch in pointer store arguments.");
|
||||
}
|
||||
|
||||
if (!dxil_record_validate_operand_count(record, i + 2, i + 2, sm6))
|
||||
return;
|
||||
|
||||
alignment_code = record->operands[i++];
|
||||
if (!bitcode_parse_alignment(alignment_code, &alignment))
|
||||
WARN("Invalid alignment %"PRIu64".\n", alignment_code);
|
||||
|
||||
if (record->operands[i])
|
||||
WARN("Ignoring volatile modifier.\n");
|
||||
|
||||
vsir_instruction_init(ins, &sm6->p.location, VKD3DSIH_MOV);
|
||||
|
||||
src_param = instruction_src_params_alloc(ins, 1, sm6);
|
||||
src_param_init_from_value(&src_param[0], src);
|
||||
|
||||
dst_param = instruction_dst_params_alloc(ins, 1, sm6);
|
||||
dst_param_init(dst_param);
|
||||
dst_param->reg = ptr->u.reg;
|
||||
dst_param->reg.alignment = alignment;
|
||||
}
|
||||
|
||||
static void sm6_parser_emit_vselect(struct sm6_parser *sm6, const struct dxil_record *record,
|
||||
struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
|
||||
{
|
||||
@ -4688,6 +4741,9 @@ static enum vkd3d_result sm6_parser_function_init(struct sm6_parser *sm6, const
|
||||
is_terminator = true;
|
||||
ret_found = true;
|
||||
break;
|
||||
case FUNC_CODE_INST_STORE:
|
||||
sm6_parser_emit_store(sm6, record, ins, dst);
|
||||
break;
|
||||
case FUNC_CODE_INST_VSELECT:
|
||||
sm6_parser_emit_vselect(sm6, record, ins, dst);
|
||||
break;
|
||||
|
@ -26,7 +26,7 @@ float4 main() : sv_target
|
||||
uniform 0 float4 1.0 2.0 3.0 4.0
|
||||
uniform 4 float4 5.0 6.0 7.0 8.0
|
||||
uniform 8 float 2
|
||||
todo(sm>=6) draw quad
|
||||
draw quad
|
||||
probe all rgba (10.0, 10.0, 10.0, 10.0)
|
||||
|
||||
|
||||
@ -56,10 +56,10 @@ float4 main() : sv_target
|
||||
[test]
|
||||
uniform 0 float4 1.0 2.0 3.0 4.0
|
||||
uniform 4 float 0
|
||||
todo(sm>=6) draw quad
|
||||
draw quad
|
||||
probe all rgba (4.0, 4.0, 4.0, 4.0)
|
||||
uniform 4 float 2
|
||||
todo(sm>=6) draw quad
|
||||
draw quad
|
||||
probe all rgba (1.0, 1.0, 1.0, 1.0)
|
||||
|
||||
|
||||
@ -99,5 +99,5 @@ float4 main() : sv_target
|
||||
[test]
|
||||
uniform 0 float4 1.0 2.0 3.0 4.0
|
||||
uniform 4 float 1
|
||||
todo(sm>=6) draw quad
|
||||
draw quad
|
||||
probe all rgba (2.0, 2.0, 2.0, 2.0)
|
||||
|
@ -155,16 +155,16 @@ float4 main() : sv_target
|
||||
[test]
|
||||
uniform 0 int 0
|
||||
uniform 1 int 0
|
||||
todo(sm>=6) draw quad
|
||||
todo(sm>=6) probe all rgba (100, 6, 7, 8)
|
||||
draw quad
|
||||
probe all rgba (100, 6, 7, 8)
|
||||
uniform 0 int 2
|
||||
uniform 1 int 2
|
||||
todo(sm>=6) draw quad
|
||||
todo(sm>=6) probe all rgba (5, 6, 100, 8)
|
||||
draw quad
|
||||
probe all rgba (5, 6, 100, 8)
|
||||
uniform 0 int 1
|
||||
uniform 1 int 3
|
||||
todo(sm>=6) draw quad
|
||||
todo(sm>=6) probe all rgba (5, 6, 7, 4)
|
||||
draw quad
|
||||
probe all rgba (5, 6, 7, 4)
|
||||
|
||||
|
||||
[pixel shader]
|
||||
@ -192,8 +192,8 @@ uniform 0 float4 1 2 3 4
|
||||
uniform 4 float4 5 6 7 8
|
||||
uniform 8 int 3
|
||||
uniform 9 int 4
|
||||
todo(sm>=6) draw quad
|
||||
todo(sm>=6) probe all rgba (1126, 3344, 5566, 3788)
|
||||
draw quad
|
||||
probe all rgba (1126, 3344, 5566, 3788)
|
||||
|
||||
|
||||
[pixel shader]
|
||||
@ -249,5 +249,5 @@ uniform 8 float 3.0
|
||||
uniform 12 float 4.0
|
||||
uniform 16 uint4 3 1 0 2
|
||||
uniform 20 uint4 0 3 1 2
|
||||
todo(sm>=6) draw quad
|
||||
todo(sm>=6) probe all rgba (4.0, 3.0, 2.0, 1.0)
|
||||
draw quad
|
||||
probe all rgba (4.0, 3.0, 2.0, 1.0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user