21#define VKD3D_SM6_VERSION_MAJOR(version) (((version) >> 4) & 0xf)
22#define VKD3D_SM6_VERSION_MINOR(version) (((version) >> 0) & 0xf)
24#define VKD3D_SM6_MAX_METADATA_TABLES 4
26#define BITCODE_MAGIC VKD3D_MAKE_TAG('B', 'C', 0xc0, 0xde)
27#define DXIL_OP_MAX_OPERANDS 17
44#define VKD3D_SHADER_SWIZZLE_64_MASK \
45 (VKD3D_SHADER_SWIZZLE_MASK << VKD3D_SHADER_SWIZZLE_SHIFT(0) \
46 | VKD3D_SHADER_SWIZZLE_MASK << VKD3D_SHADER_SWIZZLE_SHIFT(1))
924 return sm6->
ptr == sm6->
end;
931 sm6->
p.failed =
true;
939 unsigned int l, prev_len = 0;
949 sm6->
p.failed =
true;
961 sm6->
p.failed =
true;
983 sm6->
p.failed =
true;
1008 sm6->
p.failed =
true;
1019 if (
block->level > 1)
1021 WARN(
"Invalid blockinfo block level %u.\n",
block->level);
1028 if (!
record->operand_count)
1030 WARN(
"Missing id operand.\n");
1036 block->has_bid =
true;
1042 FIXME(
"Unhandled BLOCKINFO record type %u.\n",
record->code);
1065 ERR(
"Failed to allocate %u records.\n",
reserve);
1089 ERR(
"Failed to allocate record with %u operands.\n",
count);
1111 return !sm6->
p.failed;
1117 return !sm6->
p.failed;
1123 return !sm6->
p.failed;
1129 return !sm6->
p.failed;
1138 FIXME(
"Unhandled blob operand.\n");
1149 for (
i = 0, prev_type = 0;
i <
count && !sm6->
p.failed; ++
i)
1155 WARN(
"Unexpected literal abbreviation after array.\n");
1175 WARN(
"Unexpected array abbreviation.\n");
1190 WARN(
"Unexpected blob abbreviation.\n");
1215 || !(global_abbrev =
vkd3d_malloc(
sizeof(*global_abbrev) +
count *
sizeof(global_abbrev->
abbrev.operands[0]))))
1217 ERR(
"Failed to allocate global abbreviation.\n");
1227 if (!
block->has_bid)
1229 WARN(
"Missing blockinfo block id.\n");
1234 FIXME(
"Unhandled global abbreviation for module block.\n");
1258 ERR(
"Failed to allocate block abbreviation.\n");
1268 block->abbrevs[
block->abbrev_count++] = abbrev;
1278 unsigned int i,
count, array_len;
1282 if (abbrev_id >=
block->abbrev_count)
1284 WARN(
"Invalid abbreviation id %u.\n", abbrev_id);
1288 abbrev =
block->abbrevs[abbrev_id];
1298 ERR(
"Failed to allocate record with %u operands.\n",
count);
1320 ERR(
"Failed to allocate record with %u operands.\n",
count + array_len);
1326 for (
i = 0;
i < array_len; ++
i)
1334 record->operand_count += array_len;
1371 WARN(
"Invalid subblock parent id %u.\n",
parent->id);
1379 ERR(
"Failed to allocate block.\n");
1401 WARN(
"Failed to read unabbreviated record.\n");
1409 WARN(
"Failed to read abbreviated record.\n");
1414 }
while (!sm6->
p.failed);
1420 unsigned int block_id)
1434 for (
i = 0;
i <
block->record_count; ++
i)
1438 for (
i = 0;
i <
block->child_block_count; ++
i)
1446 block->record_count = 0;
1448 block->child_block_count = 0;
1471 block->abbrev_count,
sizeof(*
block->abbrevs)))
1473 ERR(
"Failed to allocate block abbreviations.\n");
1491 block->abbrev_count = 0;
1500 for (
i = 0,
count = 0;
i <
root->child_block_count; ++
i)
1539 for (
i = 0, *is_unique =
true;
i < sm6->
root_block.child_block_count; ++
i)
1542 if (
block->id !=
id)
1563 "Out of memory allocating a string of length %u.",
record->operand_count -
offset);
1576 if (
record->operand_count >= min_count)
1579 WARN(
"Invalid operand count %u for code %u.\n",
record->operand_count,
record->code);
1581 "Invalid operand count %u for record code %u.",
record->operand_count,
record->code);
1606 size_t i, type_count, type_index;
1608 char *struct_name =
NULL;
1614 sm6->
p.location.line = 0;
1615 sm6->
p.location.column = 0;
1619 WARN(
"No type definitions found.\n");
1623 WARN(
"Ignoring invalid extra type table(s).\n");
1625 sm6->
p.location.line =
block->id;
1628 for (
i = 0;
i <
block->record_count; ++
i)
1634 ERR(
"Failed to allocate type array.\n");
1638 for (
i = 0;
i <
block->record_count; ++
i)
1640 sm6->
p.location.column =
i;
1655 if (!(
type->u.array.count =
record->operands[0]))
1657 TRACE(
"Setting unbounded for type %zu.\n", type_index);
1663 WARN(
"Invalid contained type id %"PRIu64" for type %zu.\n",
type_id, type_index);
1685 FIXME(
"Unhandled vararg function type %zu.\n", type_index);
1699 ERR(
"Failed to allocate function parameter types.\n");
1709 WARN(
"Invalid parameter type id %"PRIu64" for type %zu.\n",
type_id, type_index);
1743 WARN(
"Invalid integer width %"PRIu64" for type %zu.\n",
width, type_index);
1783 WARN(
"Missing struct name before struct type %zu.\n", type_index);
1793 ERR(
"Failed to allocate struct element types.\n");
1798 FIXME(
"Ignoring struct packed attribute.\n");
1805 WARN(
"Invalid contained type id %"PRIu64" for type %zu.\n",
type_id, type_index);
1818 if (!
strcmp(struct_name,
"dx.types.Handle"))
1821 type->u.struc->name = struct_name;
1828 ERR(
"Failed to allocate struct name.\n");
1831 if (!struct_name[0])
1832 WARN(
"Struct name is empty for type %zu.\n", type_index);
1841 FIXME(
"Unhandled type %u at index %zu.\n",
record->code, type_index);
1851 WARN(
"Unused struct name %s.\n", struct_name);
1937 switch (
type->class)
1945 for (
i = 0;
i <
type->u.struc->elem_count; ++
i)
1989 const struct sm6_type *pointer_type;
1994 pointer_type = &sm6->
types[
i];
1996 && pointer_type->
u.
pointer.addr_space == addr_space)
1997 return pointer_type;
2025 switch (
type->class)
2029 if (elem_idx >=
type->u.array.count)
2031 return type->u.array.elem_type;
2034 if (elem_idx >=
type->u.struc->elem_count)
2036 return type->u.struc->elem_types[elem_idx];
2046 switch (
type->class)
2050 if (elem_idx >=
type->u.array.count)
2058 if (elem_idx >=
type->u.struc->elem_count)
2107 sm6->
p.location.line = 0;
2108 sm6->
p.location.column = 0;
2113 WARN(
"No value symtab block found.\n");
2117 FIXME(
"Ignoring extra value symtab block(s).\n");
2119 sm6->
p.location.line =
block->id;
2126 ERR(
"Failed to allocate global symbols.\n");
2130 for (
i = 0;
i <
block->record_count; ++
i)
2132 sm6->
p.location.column =
i;
2137 FIXME(
"Unhandled symtab code %u.\n",
record->code);
2147 ERR(
"Failed to allocate symbol name.\n");
2153 sm6->
p.location.column =
block->record_count;
2190 WARN(
"Returning vec4.x.\n");
2195 FIXME(
"Truncating 64-bit value.\n");
2196 return reg->u.immconst_u64[0];
2199 return reg->u.immconst_u32[0];
2208 WARN(
"Returning vec4.x.\n");
2221 return fn->u.function.is_prototype && !
strncmp(
fn->u.function.name,
"dx.op.", 6);
2315 ERR(
"Failed to allocate src params.\n");
2317 "Out of memory allocating instruction src parameters.");
2332 ERR(
"Failed to allocate dst params.\n");
2334 "Out of memory allocating instruction dst parameters.");
2346 reg->idx[0].offset =
id;
2353 switch (
type->u.width)
2366 FIXME(
"Unhandled width %u.\n",
type->u.width);
2372 switch (
type->u.width)
2381 FIXME(
"Unhandled width %u.\n",
type->u.width);
2386 FIXME(
"Unhandled type %u.\n",
type->class);
2398 id =
value->u.reg.idx[0].offset;
2399 TRACE(
"Using forward-allocated id %u.\n",
id);
2425 param->modifiers = 0;
2432 param->modifiers = 0;
2438 param->write_mask = 1u << component_idx;
2439 param->modifiers = 0;
2446 param->modifiers = 0;
2516 idx->rel_addr = rel_addr;
2555 param->reg.idx[0].offset = 0;
2568 size_t i, old_value_count = value_count;
2573 for (
i = 0;
i <
block->child_block_count; ++
i)
2590 value_count = old_value_count;
2605 WARN(
"Ignoring upper 32 bits of relative index.\n");
2613 "Invalid value relative index %u.", (
unsigned int)
idx);
2630 WARN(
"Operand of type %u is not a register.\n",
value->value_type);
2632 "A register operand passed to a DXIL instruction is not a register.");
2642 WARN(
"Handle parameter of type %u is not a handle.\n",
value->value_type);
2644 "A handle parameter passed to a DX intrinsic function is not a handle.");
2658 kind =
value->u.handle.d->kind;
2661 WARN(
"Resource kind %u for op %u is not a texture.\n", kind,
op);
2663 "Resource kind %u for texture operation %u is not a texture.", kind,
op);
2678 kind =
value->u.handle.d->kind;
2681 WARN(
"Resource kind %u for op %u is not a 2DMS texture.\n", kind,
op);
2683 "Resource kind %u for texture operation %u is not a 2DMS texture.", kind,
op);
2698 kind =
value->u.handle.d->kind;
2701 WARN(
"Resource kind %u for op %u is not a sampler.\n", kind,
op);
2703 "Resource kind %u for sample operation %u is not a sampler.", kind,
op);
2714 WARN(
"Operand result type class %u is not a pointer.\n",
value->type->class);
2716 "A pointer operand passed to a DXIL instruction is not a pointer.");
2724 if (!
value->is_back_ref)
2726 FIXME(
"Forward-referenced pointers are not supported.\n");
2728 "Forward-referenced pointer declarations are not supported.");
2738 WARN(
"Operand result type class %u is not numeric.\n",
value->type->class);
2740 "A numeric operand passed to a DXIL instruction is not numeric.");
2751 WARN(
"Operand of type class %u is not bool.\n",
type->class);
2753 "A bool operand of type class %u passed to a DXIL instruction is not a bool.",
type->class);
2763 WARN(
"Operand result type %u is not a pointer to i32.\n",
value->type->class);
2765 "An int32 pointer operand passed to a DXIL instruction is not an int32 pointer.");
2775 WARN(
"Operand result type %u is not i32.\n",
value->type->class);
2777 "An int32 operand passed to a DXIL instruction is not an int32.");
2785 if (idx < sm6->value_count)
2788 WARN(
"Invalid value index %u.\n",
idx);
2790 "Invalid value index %u.",
idx);
2795 const struct sm6_type *fwd_type,
unsigned int *rec_idx)
2827 if (
value->type != fwd_type)
2829 WARN(
"Value already has a mismatching type.\n");
2831 "The type of a source value does not match the predefined type.");
2836 value->type = fwd_type;
2870 fn->u.function.name =
"";
2877 WARN(
"Type is not a function.\n");
2884 WARN(
"Failed to get pointer type for type %u.\n",
type->class);
2891 fn->u.function.is_prototype = !!
record->operands[2];
2899 if ((
fn->u.function.attribs_id =
record->operands[4]))
2900 TRACE(
"Ignoring function attributes.\n");
2906 WARN(
"Ignoring %u operands.\n",
j);
2911 WARN(
"Unexpected return type for dx intrinsic function '%s'.\n",
fn->u.function.name);
2923 bool neg =
value & 1;
2939 return u.float_value;
2947 double double_value;
2951 return u.double_value;
2960 WARN(
"Returning vec4.x.\n");
2964 WARN(
"Truncating double to float.\n");
2982 FIXME(
"Unhandled element type %u for data array.\n", elem_type->
class);
2984 "The element data type for an immediate constant buffer is not scalar integer or floating point.");
2991 WARN(
"Invalid data type width %u.\n", elem_type->
u.
width);
2993 "An immediate constant buffer is declared with boolean elements.");
3001 ERR(
"Failed to allocate buffer, count %u.\n",
count);
3003 "Out of memory allocating an immediate constant buffer of count %u.",
count);
3008 ERR(
"Failed to store icb object.\n");
3011 "Out of memory storing an immediate constant buffer object.");
3037 icb->
data[
i] = operands[
i];
3046 const struct sm6_type *elem_type, *pointee_type, *gep_type, *ptr_type;
3057 for (
j = 0;
i <
record->operand_count;
i += 2, ++
j)
3073 "Invalid value self-reference for a constexpr GEP.");
3080 operands[
j]->
type = elem_type;
3082 else if (operands[
j]->
type != elem_type)
3084 WARN(
"Type mismatch.\n");
3086 "Type mismatch in constexpr GEP elements.");
3090 if (operands[0]->
u.reg.idx_count > 1)
3092 WARN(
"Unsupported stacked GEP.\n");
3094 "A GEP instruction on the result of a previous GEP is unsupported.");
3100 WARN(
"Expected constant zero.\n");
3102 "The pointer dereference index for a constexpr GEP instruction is not constant zero.");
3107 WARN(
"Element index is not constant int.\n");
3109 "A constexpr GEP element index is not a constant integer.");
3115 ptr_type = operands[0]->
type;
3118 WARN(
"Constexpr GEP base value is not a pointer.\n");
3120 "A constexpr GEP base value is not a pointer.");
3126 pointee_type = ptr_type->
u.
pointer.type;
3128 else if (pointee_type != ptr_type->
u.
pointer.type)
3130 WARN(
"Explicit pointee type mismatch.\n");
3132 "Explicit pointee type for constexpr GEP does not match the element type.");
3138 WARN(
"Failed to get element type.\n");
3140 "Failed to get the element type of a constexpr GEP.");
3146 WARN(
"Failed to get pointer type for type %u.\n", gep_type->
class);
3148 "Module does not define a pointer type for a constexpr GEP result.");
3151 dst->u.reg = operands[0]->
u.
reg;
3154 dst->u.reg.idx_count = 2;
3163 size_t i, base_value_idx, value_idx;
3173 sm6->
p.location.column =
i;
3197 if (
i ==
block->record_count - 1)
3198 WARN(
"Unused SETTYPE record.\n");
3205 WARN(
"Constant record %zu has no type.\n", value_idx);
3212 dst->is_back_ref =
true;
3232 WARN(
"Invalid integer of non-integer type %u at constant idx %zu.\n",
type->class, value_idx);
3237 if (
type->u.width <= 32)
3238 dst->u.reg.u.immconst_u32[0] =
value & ((1ull <<
type->u.width) - 1);
3240 dst->u.reg.u.immconst_u64[0] =
value;
3250 WARN(
"Invalid float of non-fp type %u at constant idx %zu.\n",
type->class, value_idx);
3254 if (
type->u.width == 16)
3255 dst->u.reg.u.immconst_u32[0] =
record->operands[0];
3256 else if (
type->u.width == 32)
3258 else if (
type->u.width == 64)
3268 WARN(
"Invalid type %u for data constant idx %zu.\n",
type->class, value_idx);
3270 "The type of a constant array is not an array type.");
3295 "Constexpr cast op %"PRIu64" is unhandled.",
value);
3302 WARN(
"Constexpr cast at constant idx %zu is not a pointer.\n", value_idx);
3304 "Constexpr cast source operand is not a pointer.");
3315 else if (
value == value_idx)
3319 "Invalid value self-reference for a constexpr cast.");
3333 dst->is_undefined =
true;
3337 FIXME(
"Unhandled constant code %u.\n",
record->code);
3339 "Constant code %u is unhandled.",
record->code);
3346 WARN(
"Ignoring metadata attachment.\n");
3348 "Ignoring a metadata attachment for a constant.");
3366 WARN(
"Value is not an array.\n");
3368 "Constexpr cast source value is not a global array element.");
3387 *
alignment = (1u << encoded_alignment) >> 1;
3397 ERR(
"Failed to allocate instruction.\n");
3410 ++sm6->
p.program->instructions.count;
3427 unsigned int count,
unsigned int alignment,
bool has_function_scope,
unsigned int init,
3453 unsigned int byte_count;
3459 dst->structure_stride = 0;
3461 byte_count = elem_type->
u.
width / 8u;
3462 if (byte_count != 4)
3464 FIXME(
"Unsupported byte count %u.\n", byte_count);
3466 "Raw TGSM byte count %u is not supported.", byte_count);
3478 unsigned int structure_stride;
3485 structure_stride = elem_type->
u.
width / 8u;
3486 if (structure_stride != 4)
3488 FIXME(
"Unsupported structure stride %u.\n", structure_stride);
3490 "Structured TGSM byte stride %u is not supported.", structure_stride);
3492 dst->structure_stride = structure_stride;
3517 FIXME(
"Unsupported nested type class %u.\n",
type->u.array.elem_type->class);
3519 "Global array variables with nested type class %u are not supported.",
3520 type->u.array.elem_type->class);
3533 FIXME(
"Unsupported type class %u.\n",
type->class);
3535 "Global variables of type class %u are not supported.",
type->class);
3547 WARN(
"Failed to get pointer type for type class %u, address space %"PRIu64".\n",
3550 "Module does not define a pointer type for a global variable.");
3558 WARN(
"Type is not a pointer.\n");
3560 "The type of a global variable is not a pointer.");
3570 WARN(
"Invalid value index %"PRIu64" for initialiser.",
init - 1);
3572 "Global variable initialiser value index %"PRIu64" is invalid.",
init - 1);
3588 WARN(
"Missing symbol name for global variable at index %zu.\n", sm6->
value_count);
3599 if (
record->operand_count > 10 &&
record->operands[10])
3601 if (
record->operand_count > 11 &&
record->operands[11])
3607 dst->is_back_ref =
true;
3609 if (is_constant && !
init)
3611 WARN(
"Constant array has no initialiser.\n");
3613 "A constant global variable has no initialiser.");
3628 WARN(
"Unsupported type class %u.\n", scalar_type->
class);
3630 "TGSM variables of type class %u are not supported.", scalar_type->
class);
3659 WARN(
"Invalid initialiser index %zu.\n",
index);
3661 "Global variable initialiser value index %zu is invalid.",
index);
3666 return value->u.icb;
3683 WARN(
"Invalid initialiser index %zu.\n",
index);
3685 "TGSM initialiser value index %zu is invalid.",
index);
3698 FIXME(
"Non-zero initialisers are not supported.\n");
3700 "Non-zero TGSM initialisers are not supported.");
3713 sm6->
p.location.line =
block->id;
3714 sm6->
p.location.column = 0;
3720 for (
i = 0;
i <
block->record_count; ++
i)
3722 sm6->
p.location.column =
i;
3730 "A DXIL function declaration is invalid.");
3747 "Bitcode format version %#"PRIx64" is unsupported.",
version);
3757 for (
i = 0;
i <
block->child_block_count; ++
i)
3765 for (
i = 0;
i < sm6->
p.program->instructions.count; ++
i)
3767 ins = &sm6->
p.program->instructions.elements[
i];
3797 value->u.reg.idx[0].offset =
icb->register_idx;
3808 param->write_mask =
e->mask;
3809 param->modifiers = 0;
3829 switch (sysval_semantic)
3854 bool is_patch_constant, is_control_point;
3861 is_control_point =
false;
3862 if (!is_patch_constant)
3868 is_control_point = is_input;
3872 is_control_point =
true;
3880 for (
i = 0;
i <
s->element_count; ++
i)
3882 e = &
s->elements[
i];
3896 if (is_control_point)
3959 ERR(
"Failed to allocate phi array.\n");
3961 "Out of memory allocating a phi instruction.");
3994 for (
i = 0;
i < 2; ++
i)
4000 packed_operands =
record->operands[3];
4002 WARN(
"Ignoring in_alloca flag.\n");
4005 FIXME(
"Unhandled implicit type.\n");
4007 "Implicit result type for ALLOCA instructions is not supported.");
4014 WARN(
"Type is not a numeric array.\n");
4016 "Result type of an ALLOCA instruction is not a numeric array.");
4023 WARN(
"Size operand type is not scalar integer.\n");
4025 "The type of the allocation size operand of an ALLOCA instruction is not scalar integer.");
4031 WARN(
"Failed to get pointer type for type class %u.\n",
type[0]->
class);
4033 "Module does not define a pointer type for an ALLOCA instruction.");
4042 FIXME(
"Allocation size is not 1.\n");
4044 "ALLOCA instruction allocation sizes other than 1 are not supported.");
4049 WARN(
"Invalid alignment %"PRIu64".\n", packed_operands);
4050 packed_operands &= ~ALLOCA_ALIGNMENT_MASK;
4052 if (packed_operands)
4053 WARN(
"Ignoring flags %#"PRIx64".\n", packed_operands);
4107 WARN(
"Register is not groupshared.\n");
4109 "The destination register for an atomicrmw instruction is not groupshared memory.");
4113 dst->type =
ptr->type->u.pointer.type;
4125 "Operation %"PRIu64" for an atomicrmw instruction is unhandled.",
code);
4129 is_volatile =
record->operands[
i++];
4138 if (
ptr->structure_stride)
4140 if (
ptr->u.reg.idx[1].rel_addr)
4142 regs[0] = &
ptr->u.reg.idx[1].rel_addr->reg;
4147 regs[0] = &const_offset;
4150 regs[1] = &const_zero;
4161 if (
ptr->structure_stride)
4171 dst_params[1].
reg =
ptr->u.reg;
4173 dst_params[1].
reg.idx[1].rel_addr =
NULL;
4174 dst_params[1].
reg.idx[1].offset = ~0
u;
4175 dst_params[1].
reg.idx_count = 1;
4178 dst->u.reg = dst_params[0].
reg;
4192 WARN(
"Argument type %u is not bool, int16/32/64 or floating point.\n", type_a->
class);
4194 "An argument to a binary operation is not bool, int16/32/64 or floating point.");
4197 if (type_a != type_b)
4199 WARN(
"Type mismatch, type %u width %u vs type %u width %u.\n", type_a->
class,
4202 "Type mismatch in binary operation arguments.");
4257 "Binary operation %#"PRIx64" is unhandled.",
code);
4263 WARN(
"Invalid operation %u for type %u, width %u.\n",
op, type_a->
class, type_a->
u.
width);
4265 "Binary operation %u is invalid on type class %u, width %u.",
op, type_a->
class, type_a->
u.
width);
4278 bool silence_warning;
4298 silence_warning =
false;
4321 silence_warning = !(
flags & ~PEB_EXACT);
4327 if (
flags && silence_warning)
4335 "Ignoring flags %#"PRIx64" for a binary operation.",
flags);
4345 dst->type =
a->type;
4377 "Invalid code block index %#"PRIx64" for a control flow instruction.",
index);
4389 if (
record->operand_count != 1 &&
record->operand_count < 3)
4391 WARN(
"Invalid operand count %u.\n",
record->operand_count);
4393 "Invalid operand count %u for a branch instruction.",
record->operand_count);
4397 if (
record->operand_count == 1)
4406 WARN(
"Bool type not found.\n");
4408 "Module does not define a boolean type for conditions.");
4431 bool all_constant =
true;
4436 *
reg = *operand_regs[0];
4450 reg->u.immconst_u32[
i] = 0;
4465 src_params[0].
reg = *operand_regs[
i];
4487 operand_regs[
i] = &operands[
i]->
u.reg;
4695 "Operation %"PRIu64" for an atomic binop instruction is unhandled.",
code);
4706 unsigned int i, coord_idx, coord_count = 1;
4723 coord_idx = 2 - is_cmp_xchg;
4724 resource_type =
resource->u.handle.d->resource_type;
4733 reg = operands[coord_idx]->
u.
reg;
4736 for (
i = coord_idx + coord_count;
i < coord_idx + 3; ++
i)
4740 WARN(
"Ignoring unexpected operand.\n");
4742 "Ignoring an unexpected defined operand value for atomic instruction %u.", handler_idx);
4763 dst->u.reg = dst_params[0].
reg;
4783 "Barrier flags %#x are unhandled.",
flags);
4802 FIXME(
"Unsupported dynamic update operand.\n");
4804 "A dynamic update value for a UAV counter operation is not supported.");
4808 if (
i != 1 &&
i != 255)
4810 WARN(
"Unexpected update value %#x.\n",
i);
4812 "Update value %#x for a UAV counter operation is not supported.",
i);
4878 src_param->
reg.idx_count = 3;
4932 unsigned int register_index;
4939 if (
d->type !=
type ||
d->id !=
id)
4946 if (register_index >=
d->range.first && register_index <= d->
range.last)
4967 WARN(
"Failed to find resource type %#x, id %#x.\n",
type,
id);
4969 "Descriptor for resource type %#x, id %#x was not found.",
type,
id);
4975 dst->u.handle.d =
d;
4977 reg = &
dst->u.handle.reg;
4980 reg->idx[0].offset =
id;
5003 WARN(
"Invalid stream index %u.\n",
i);
5005 "Output stream index %u is invalid.",
i);
5015 ++
state->code_block->instruction_count;
5037 unsigned int component_idx;
5043 WARN(
"Invalid component index %u.\n", component_idx);
5045 "Invalid domain location component index %u.", component_idx);
5184 for (
i = 0;
i < 3; ++
i)
5204 resource_kind =
resource->u.handle.d->kind;
5221 state->temp_idx = 1;
5247 state->code_block->instruction_count += 2;
5254 WARN(
"Ignoring unexpected operand.\n");
5256 "Ignoring an unexpected defined LOD value for buffer GetDimensions.");
5287 for (
i = 0;
i < 3; ++
i)
5300 unsigned int count, row_index, column_index;
5312 WARN(
"Control point id is undefined.\n");
5314 "The index for a control point load is undefined.");
5319 if (is_patch_constant)
5324 else if (is_control_point)
5334 if (row_index >=
signature->element_count)
5336 WARN(
"Invalid row index %u.\n", row_index);
5338 "Invalid input row index %u.", row_index);
5349 if (
e->register_count > 1)
5419 FIXME(
"Unhandled quad op kind %u.\n", quad_op);
5421 "Quad op kind %u is unhandled.", quad_op);
5453 WARN(
"Invalid write mask %#x.\n", write_mask);
5455 "Write mask %#x for a raw/structured buffer load operation is invalid.", write_mask);
5458 else if (write_mask & (write_mask + 1))
5460 FIXME(
"Unhandled write mask %#x.\n", write_mask);
5462 "Write mask %#x for a raw/structured buffer load operation is unhandled.", write_mask);
5468 operand_count = 2 + !raw;
5496 WARN(
"Invalid write mask %#x.\n", write_mask);
5498 "Write mask %#x for a raw/structured buffer store operation is invalid.", write_mask);
5501 else if (write_mask & (write_mask + 1))
5504 FIXME(
"Unhandled write mask %#x.\n", write_mask);
5506 "Write mask %#x for a raw/structured buffer store operation is unhandled.", write_mask);
5514 WARN(
"Resource is not a raw or structured buffer.\n");
5516 "Resource for a raw buffer store is not a raw or structured buffer.");
5524 "Alignment %#x for a raw/structured buffer store operation is invalid.",
alignment);
5533 operand_count = 2 + !raw;
5566 WARN(
"Resource is not a typed buffer.\n");
5568 "Resource for a typed buffer load is not a typed buffer.");
5580 WARN(
"Ignoring structure offset.\n");
5582 "Ignoring structure offset for a typed buffer load.");
5611 WARN(
"Resource is not a typed buffer.\n");
5613 "Resource for a typed buffer store is not a typed buffer.");
5619 WARN(
"Invalid write mask %#x.\n", write_mask);
5621 "Write mask %#x for a typed buffer store operation is invalid.", write_mask);
5624 else if (write_mask & (write_mask + 1))
5627 FIXME(
"Unhandled write mask %#x.\n", write_mask);
5629 "Write mask %#x for a typed buffer store operation is unhandled.", write_mask);
5645 WARN(
"Ignoring structure offset.\n");
5647 "Ignoring structure offset for a typed buffer store.");
5793 FIXME(
"Ignoring LOD clamp value.\n");
5795 "Ignoring LOD clamp value for a sample operation.");
5812 unsigned int element_idx;
5820 WARN(
"Sample index is not in the signature.\n");
5822 "Sample index signature element for a sample index operation is missing.");
5895 unsigned int row_index, column_index;
5903 if (row_index >=
signature->element_count)
5905 WARN(
"Invalid row index %u.\n", row_index);
5907 "Invalid output row index %u.", row_index);
5911 if (!
e->sysval_semantic)
5916 WARN(
"Invalid column index %u.\n", column_index);
5918 "Invalid output column index %u.", column_index);
5922 value = operands[3];
5925 WARN(
"Source value is not a register.\n");
5927 "Expected store operation source to be a register.");
5937 if (
e->register_count > 1)
5958 bool extended_offset;
5993 if (extended_offset)
6005 "Swizzle %#x for a texture gather operation is invalid.",
swizzle);
6020 bool is_multisample, is_uav;
6027 resource_type =
resource->u.handle.d->resource_type;
6034 is_multisample ?
NULL : mip_level_or_sample_count,
state, &
coord))
6077 WARN(
"Invalid write mask %#x.\n", write_mask);
6079 "Write mask %#x for a texture store operation is invalid.", write_mask);
6082 else if (write_mask & (write_mask + 1))
6085 FIXME(
"Unhandled write mask %#x.\n", write_mask);
6087 "Write mask %#x for a texture store operation is unhandled.", write_mask);
6133 FIXME(
"Unhandled wave bit op %u.\n",
op);
6135 "Wave bit operation %u is unhandled.\n",
op);
6179 FIXME(
"Unhandled wave op %u.\n",
op);
6181 "Wave operation %u is unhandled.\n",
op);
6386 FIXME(
"Invalid operand count.\n");
6396 &&
type->u.width <= 32;
6428 return type == ret_type;
6430 FIXME(
"Unhandled operand code '%c'.\n", info_type);
6446 WARN(
"Failed to validate return type for dx intrinsic id %u, '%s'.\n",
op,
name);
6451 for (
i = 0;
i < operand_count; ++
i)
6456 WARN(
"Failed to validate operand %u for dx intrinsic id %u, '%s'.\n",
i + 1,
op,
name);
6458 "Operand %u for call to dx intrinsic function '%s' is invalid.",
i + 1,
name);
6462 if (
info->operand_info[operand_count])
6464 WARN(
"Missing operands for dx intrinsic id %u, '%s'.\n",
op,
name);
6466 "Call to dx intrinsic function '%s' has missing operands.",
name);
6489 const char *
name,
const struct sm6_value **operands,
unsigned int operand_count,
6494 FIXME(
"Unhandled dx intrinsic function id %u, '%s'.\n",
op,
name);
6496 "Call to intrinsic function %s is unhandled.",
name);
6511 const struct sm6_value *fn_value, *op_value;
6512 unsigned int i = 1,
j, operand_count;
6524 WARN(
"Ignoring calling convention %#"PRIx64".\n", call_conv);
6530 WARN(
"Function target value is not a function declaration.\n");
6532 "Function call target value is not a function declaration.");
6537 WARN(
"Explicit call type does not match function type.\n");
6538 type = fn_value->
type->u.pointer.type;
6541 dst->type =
type->u.function->ret_type;
6543 operand_count =
type->u.function->param_count;
6546 WARN(
"Ignoring %zu operands.\n", operand_count -
ARRAY_SIZE(operands));
6548 "Ignoring %zu operands for function call.", operand_count -
ARRAY_SIZE(operands));
6552 for (
j = 0;
j < operand_count; ++
j)
6557 if ((
j =
record->operand_count -
i))
6559 WARN(
"Ignoring %u operands beyond the function parameter list.\n",
j);
6561 "Ignoring %u function call operands beyond the parameter list.",
j);
6566 FIXME(
"Unhandled call to local function.\n");
6568 "Call to a local function is unsupported.");
6572 WARN(
"External function is not a dx intrinsic.\n");
6576 WARN(
"Missing dx intrinsic function id.\n");
6578 "The id for a dx intrinsic function is missing.");
6582 op_value = operands[0];
6585 WARN(
"dx intrinsic function id is not a constant int.\n");
6587 "Expected a constant integer dx intrinsic function id.");
6598 bool from_int,
to_int, from_fp, to_fp;
6607 if ((!from_int && !from_fp) || (!
to_int && !to_fp))
6609 FIXME(
"Unhandled cast of type class %u to type class %u.\n",
from->class, to->
class);
6611 "Cast of type class %u to type class %u is not implemented.",
from->class, to->
class);
6616 FIXME(
"Unhandled 8-bit value.\n");
6618 "Cast to/from an 8-bit type is not implemented.");
6685 "Cast operation %"PRIu64" is unhandled.\n",
code);
6693 "Cast operation %"PRIu64" from type class %u, width %u to type class %u, width %u is invalid.\n",
6738 if (
type->u.width != 16)
6751 src_param->
reg.data_type =
dst->u.reg.data_type;
6800 const struct sm6_type *type_a, *type_b;
6801 bool is_int, is_fp, silence_warning;
6809 WARN(
"Bool type not found.\n");
6811 "Module does not define a boolean type for comparison results.");
6845 "Comparison operation %"PRIu64" on type class %u is invalid.",
code, type_a->
class);
6849 if (type_a != type_b)
6851 WARN(
"Type mismatch, type %u width %u vs type %u width %u.\n", type_a->
class,
6854 "Type mismatch in comparison operation arguments.");
6861 "Comparison operation %"PRIu64" is unhandled.",
code);
6868 silence_warning =
false;
6878 if (
flags && silence_warning)
6886 "Ignoring flags %#"PRIx64" for a comparison operation.",
flags);
6900 uint64_t success_ordering, failure_ordering;
6915 WARN(
"Register is not groupshared.\n");
6917 "The destination register for a cmpxchg instruction is not groupshared memory.");
6923 WARN(
"Failed to find result struct.\n");
6925 "Module does not define a result struct type for a cmpxchg instruction.");
6943 is_volatile =
record->operands[
i++];
6944 success_ordering =
record->operands[
i++];
6949 failure_ordering = (
record->operand_count >
i) ?
record->operands[
i++] : success_ordering;
6953 FIXME(
"Unhandled success ordering %"PRIu64".\n", success_ordering);
6954 if (success_ordering != failure_ordering)
6955 FIXME(
"Unhandled failure ordering %"PRIu64".\n", failure_ordering);
6958 FIXME(
"Ignoring weak cmpxchg.\n");
6973 dst_params[1].
reg =
ptr->u.reg;
6976 dst->u.reg = dst_params[0].
reg;
6994 if (
record->operand_count >
i + 1)
6996 FIXME(
"Unhandled multiple indices.\n");
6998 "Multiple extractval indices are not supported.");
7005 WARN(
"Invalid extraction from non-aggregate.\n");
7007 "Source type of an extractval instruction is not an aggregate.");
7011 elem_idx =
record->operands[
i];
7014 WARN(
"Invalid element index %"PRIu64".\n", elem_idx);
7016 "Element index %"PRIu64" for an extractval instruction is out of bounds.", elem_idx);
7021 FIXME(
"Nested extraction is not supported.\n");
7023 "Extraction from nested aggregates is not supported.");
7032 src_param->
reg =
src->u.reg;
7042 unsigned int elem_idx, operand_idx = 2;
7059 if (
src->u.reg.idx_count > 1)
7061 WARN(
"Unsupported stacked GEP.\n");
7063 "A GEP instruction on the result of a previous GEP is unsupported.");
7067 is_in_bounds =
record->operands[0];
7071 WARN(
"Type mismatch, type %u width %u vs type %u width %u.\n",
type->class,
7074 "Type mismatch in GEP operation arguments.");
7076 addr_space =
src->type->u.pointer.addr_space;
7084 WARN(
"Expected constant zero.\n");
7086 "The pointer dereference index for a GEP instruction is not constant zero.");
7092 WARN(
"Invalid GEP on type class %u.\n", pointee_type->
class);
7094 "Source type for index 1 of a GEP instruction is not an array.");
7106 WARN(
"Invalid element index %u.\n", elem_idx);
7108 "Element index %u for a GEP instruction is out of bounds.", elem_idx);
7112 if (operand_idx < record->operand_count)
7114 FIXME(
"Multiple element indices are not implemented.\n");
7116 "Multi-dimensional addressing in GEP instructions is not supported.");
7122 WARN(
"Failed to get pointer type for type %u.\n",
type->class);
7124 "Module does not define a pointer type for a GEP instruction.");
7130 reg->idx[1].offset = 0;
7132 reg->idx[1].is_in_bounds = is_in_bounds;
7134 dst->structure_stride =
src->structure_stride;
7142 const struct sm6_type *elem_type =
NULL, *pointee_type;
7143 unsigned int alignment, operand_count,
i = 0;
7161 elem_type =
ptr->type->u.pointer.type;
7163 else if (elem_type != (pointee_type =
ptr->type->u.pointer.type))
7165 WARN(
"Type mismatch.\n");
7167 "Type mismatch in pointer load arguments.");
7170 dst->type = elem_type;
7175 alignment_code =
record->operands[
i++];
7177 WARN(
"Invalid alignment %"PRIu64".\n", alignment_code);
7180 WARN(
"Ignoring volatile modifier.\n");
7182 if (
ptr->structure_stride)
7189 if (
ptr->u.reg.idx[1].rel_addr)
7190 src_params[0] = *
ptr->u.reg.idx[1].rel_addr;
7205 if (operand_count > 1)
7208 src_params[operand_count - 1].
reg.alignment =
alignment;
7218 return (incoming_a->
block > incoming_b->block) - (incoming_a->
block < incoming_b->block);
7231 if (!(
record->operand_count & 1))
7233 WARN(
"Invalid operand count %u.\n",
record->operand_count);
7235 "Invalid operand count %u for phi instruction.",
record->operand_count);
7244 FIXME(
"Only scalar numeric types are supported.\n");
7246 "Result type class %u of a phi instruction is not scalar numeric.",
type->class);
7261 ERR(
"Failed to allocate phi incoming array.\n");
7263 "Out of memory allocating a phi incoming array.");
7268 for (
i = 1;
i <
record->operand_count;
i += 2)
7274 WARN(
"Invalid value index %"PRIu64".\n", src_idx);
7276 "Invalid value index %"PRIu64" for a phi incoming value.", src_idx);
7282 incoming[
j].reg.idx[0].offset = src_idx;
7300 WARN(
"PHI conflict.\n");
7302 "Two phi incomings have the same block but different values.");
7316 if (
record->operand_count)
7317 FIXME(
"Non-void return is not implemented.\n");
7327 unsigned int i = 0,
alignment, operand_count;
7348 if (
ptr->type->u.pointer.type !=
src->type)
7350 WARN(
"Type mismatch.\n");
7352 "Type mismatch in pointer store arguments.");
7358 alignment_code =
record->operands[
i++];
7360 WARN(
"Invalid alignment %"PRIu64".\n", alignment_code);
7363 WARN(
"Ignoring volatile modifier.\n");
7365 if (
ptr->structure_stride)
7372 if (
ptr->u.reg.idx[1].rel_addr)
7373 src_params[0] = *
ptr->u.reg.idx[1].rel_addr;
7387 if (operand_count > 1)
7394 dst_param->
reg =
ptr->u.reg;
7398 dst_param->
reg.idx_count = 1;
7407 unsigned int i = 1,
j;
7409 if (
record->operand_count < 3 || !(
record->operand_count & 1))
7411 WARN(
"Invalid operand count %u.\n",
record->operand_count);
7413 "Invalid operand count %u for a switch instruction.",
record->operand_count);
7427 WARN(
"Type mismatch.\n");
7429 "The type of a switch selector value does not match the selector type.");
7433 WARN(
"Selector is not scalar integer.\n");
7435 "Selector type class %u of a switch instruction is not scalar integer.",
type->class);
7445 ERR(
"Failed to allocate case array.\n");
7447 "Out of memory allocating a switch case array.");
7452 for (;
i <
record->operand_count;
i += 2)
7457 terminator->
cases[
j].is_default = !
j;
7460 for (
i = 3;
i <
record->operand_count;
i += 2)
7467 WARN(
"Type mismatch.\n");
7469 "The type of a switch case value does not match the selector type.");
7473 WARN(
"Case value is not a constant.\n");
7475 "A switch case value is not a constant.");
7499 for (
i = 0;
i < 3; ++
i)
7505 dst->type =
src[1]->type;
7514 for (
i = 0;
i < 3; ++
i)
7606 for (
i = 0;
i <
block->record_count; ++
i)
7611 WARN(
"Ignoring record with code %u.\n",
record->code);
7613 "Ignoring a metadata attachment record with code %u.",
record->code);
7616 if (!(
record->operand_count & 1))
7618 WARN(
"Ignoring function attachment.\n");
7620 "Ignoring a metadata function attachment.");
7629 "Invalid record index %"PRIu64" for a metadata attachment.",
index);
7636 WARN(
"Overwriting record attachment.\n");
7638 "The target record for a metadata attachment already has an attachment.");
7648 for (
i = 0;
i <
block->child_block_count; ++
i)
7689 if (
node->operand_count != 1)
7691 FIXME(
"Ignoring node with %u operands.\n",
node->operand_count);
7693 "Ignoring metadata attachment node with %u operands; expected unary.",
node->operand_count);
7699 WARN(
"Failed to get operand value.\n");
7701 "Failed to get a metadata attachment operand value; ignoring the attachment.");
7711 static const char *ignored_names[] =
7714 "dx.controlflow.hints",
7722 unsigned int i,
j, operand;
7728 WARN(
"Ignoring nested metadata attachment.\n");
7730 "Ignoring a nested metadata attachment.");
7734 for (
i = 1;
i <
record->operand_count;
i += 2)
7740 "Failed to find metadata kind %"PRIx64" for an attachment.",
record->operands[
i]);
7748 WARN(
"Failed to retrieve metadata attachment node.\n");
7750 "Failed to retrieve a metadata attachment node.");
7759 WARN(
"Precise value is not a register.\n");
7761 "A value marked as precise is not a register.");
7772 WARN(
"Non-uniform value is not a register.\n");
7774 "A value marked as non-uniform is not a register.");
7778 dst->u.reg.non_uniform = !!operand;
7788 WARN(
"Ignoring metadata attachment '%s'.\n",
name);
7790 "Ignoring a metadata attachment named '%s'.",
name);
7796 WARN(
"Metadata attachment target is not a function call.\n");
7805 ERR(
"Failed to allocate code block array.\n");
7829 size_t i,
j, block_idx;
7831 for (block_idx = 0; block_idx < function->
block_count; ++block_idx)
7835 for (
i = 0;
i <
block->phi_count; ++
i)
7845 FIXME(
"PHI incoming value is not a constant or SSA register.\n");
7847 "A PHI incoming value is not a constant or SSA register.");
7850 if (
src->u.reg.data_type != phi->
reg.data_type)
7852 WARN(
"Type mismatch.\n");
7854 "The type of a phi incoming value does not match the result type.");
7869 size_t i, block_idx, block_count;
7872 bool ret_found, is_terminator;
7878 WARN(
"Failed to find definition to match function body.\n");
7882 if (
block->record_count < 2)
7885 WARN(
"Invalid function block record count %zu.\n",
block->record_count);
7891 WARN(
"Block count declaration not found or invalid.\n");
7895 if (!(block_count =
block->records[0]->operands[0]))
7897 WARN(
"Function contains no blocks.\n");
7905 for (
i = 0;
i < block_count; ++
i)
7909 ERR(
"Failed to allocate code block.\n");
7913 function->block_count = block_count;
7918 for (
i = 1, block_idx = 0, ret_found =
false;
i <
block->record_count; ++
i)
7920 sm6->
p.location.column =
i;
7924 WARN(
"Invalid block count %zu.\n",
function->block_count);
7926 "Invalid block count %zu.",
function->block_count);
7935 ERR(
"Failed to allocate instructions.\n");
7943 fwd_type =
dst->type;
7946 dst->is_back_ref =
true;
7947 is_terminator =
false;
7967 is_terminator =
true;
7999 is_terminator =
true;
8007 is_terminator =
true;
8013 FIXME(
"Unhandled dxil instruction %u.\n",
record->code);
8031 if (
dst->type && fwd_type &&
dst->type != fwd_type)
8033 WARN(
"Type mismatch.\n");
8035 "The type of a result value does not match the type defined by a forward reference.");
8043 WARN(
"Function contains no RET instruction.\n");
8056 switch (
block->terminator.type)
8059 if (!
block->terminator.true_block)
8068 if (!
block->terminator.true_block || !
block->terminator.false_block)
8074 src_params[0].
reg =
block->terminator.conditional_reg;
8084 src_params[0].
reg =
block->terminator.conditional_reg;
8088 for (
i = 0,
count = 3;
i <
block->terminator.case_count; ++
i)
8093 switch_case = &
block->terminator.cases[
i];
8094 if (!(case_block = switch_case->
block))
8108 src_params[
count++].
reg.u.immconst_u64[0] = switch_case->
value;
8116 "Truncating 64-bit switch case value %"PRIx64" to 32 bits.", switch_case->
value);
8119 src_params[
count++].
reg.u.immconst_u32[0] = switch_case->
value;
8138 unsigned int i,
j, incoming_count;
8139 const struct sm6_phi *src_phi;
8141 for (
i = 0;
i <
block->phi_count; ++
i)
8146 src_phi = &
block->phi[
i];
8155 for (
j = 0;
j < incoming_count; ++
j)
8158 unsigned int index =
j * 2;
8169 dst_param->
reg = src_phi->
reg;
8180 for (
i = 0;
i <
block->child_block_count; ++
i)
8186 sm6->
p.location.line =
block->id;
8187 sm6->
p.location.column = 0;
8223 FIXME(
"Unhandled block id %u.\n",
block->id);
8257 "Out of memory emitting shader instructions.");
8264 block->instruction_count *
sizeof(*
block->instructions));
8265 program->instructions.count +=
block->instruction_count;
8283 for (
j = 0;
j <
block->record_count; ++
j)
8302 WARN(
"Metadata type not found.\n");
8304 "The type for metadata values was not found.");
8309 ERR(
"Failed to allocate metadata node with %u operands.\n",
record->operand_count);
8311 "Out of memory allocating a metadata node with %u operands.",
record->operand_count);
8320 for (
i = 0;
i <
record->operand_count; ++
i)
8329 "Metadata index %"PRIu64" is invalid.",
ref);
8334 if (!
node->is_distinct &&
ref == dst_idx)
8336 WARN(
"Metadata self-reference at index %u.\n", dst_idx);
8338 "Metadata index %u is self-referencing.", dst_idx);
8346 WARN(
"Named node operand is not a node.\n");
8348 "The operand of a metadata named node is not a node.");
8362 unsigned int i,
count, table_idx, value_idx;
8374 ERR(
"Failed to allocate metadata tables.\n");
8376 "Out of memory allocating metadata tables.");
8385 table_idx =
table->count;
8393 WARN(
"Named node has no name.\n");
8395 "A metadata named node has no name.");
8422 m->u.kind.id =
record->operands[0];
8425 ERR(
"Failed to allocate name of a kind.\n");
8434 WARN(
"Name is not followed by a named node.\n");
8436 "A metadata node name is not followed by a named node.");
8442 ERR(
"Failed to allocate name.\n");
8452 ERR(
"Failed to allocate string.\n");
8467 value_idx =
record->operands[1];
8474 WARN(
"Value at index %u is not a constant or a function declaration.\n", value_idx);
8476 "Metadata value at index %u is not a constant or a function declaration.", value_idx);
8481 if (
value->type !=
m->value_type)
8483 WARN(
"Type mismatch.\n");
8485 "The type of a metadata value does not match its referenced value at index %u.", value_idx);
8491 FIXME(
"Unhandled metadata type %u.\n",
record->code);
8493 "Metadata type %u is unhandled.",
record->code);
8524 FIXME(
"Unhandled component type %u.\n",
type);
8616 if (!
node->operand_count)
8618 if (
node->operand_count > 1)
8620 FIXME(
"Ignoring %u extra operands for %s.\n",
node->operand_count - 1,
name);
8622 "Ignoring %u extra operands for metadata node %s.",
node->operand_count - 1,
name);
8624 return node->operands[0];
8637 WARN(
"Resource data type is not a value.\n");
8642 WARN(
"Resource type is not a pointer.\n");
8644 "Resource metadata value type is not a pointer.");
8649 WARN(
"Failed to load register space.\n");
8654 WARN(
"Failed to load register first.\n");
8659 WARN(
"Failed to load register range size.\n");
8664 WARN(
"Invalid register range, first %u, size %u.\n",
range->first,
size);
8718 FIXME(
"Unhandled component type %u.\n",
type);
8720 "Resource descriptor component type %u is unhandled.",
type);
8736 unsigned int i, operand_count,
tag,
value;
8739 info->byte_stride = 0;
8741 if (
node->operand_count & 1)
8743 WARN(
"Operand count is not even.\n");
8745 "Operand count for resource descriptor tag/value pairs is not even.");
8747 operand_count =
node->operand_count & ~1u;
8749 for (
i = 0;
i < operand_count;
i += 2)
8754 WARN(
"Failed to load tag/value pair at index %u.\n",
i);
8756 "Resource descriptor tag/value pair at index %u is not an integer pair.",
i);
8765 WARN(
"Invalid type %u for an untyped resource.\n",
value);
8767 "An untyped resource has type %u.",
value);
8776 WARN(
"Invalid stride %u for an unstructured resource.\n",
value);
8778 "An unstructured resource has a byte stride.");
8786 FIXME(
"Unhandled sampler feedback kind %u.\n",
value);
8788 "Sampler feedback kind %u is unhandled.",
value);
8794 FIXME(
"Unsupported 64-bit atomic ops.\n");
8796 "64-bit atomic ops on resources are not supported.");
8803 "Tag %u for resource descriptor additional value %u is unhandled.",
tag,
value);
8821 FIXME(
"Unhandled resource kind %u.\n", kind);
8823 "Resource kind %u is unhandled.", kind);
8837 WARN(
"Resource metadata list is not a node.\n");
8839 "Resource descriptor metadata list is not a node.");
8850 WARN(
"No data type defined.\n");
8852 "A typed resource has no data type.");
8881 "Structured resource byte stride %u is not a multiple of 4.",
8889 FIXME(
"Unhandled resource kind %u.\n", kind);
8891 "Resource kind %u is unhandled.", kind);
8903 param->modifiers = 0;
8906 param->reg.idx[0].offset =
id;
8919 if (
node->operand_count < 9)
8921 WARN(
"Invalid operand count %u.\n",
node->operand_count);
8923 "Invalid operand count %u for an SRV descriptor.",
node->operand_count);
8926 if (
node->operand_count > 9)
8928 WARN(
"Ignoring %u extra operands.\n",
node->operand_count - 9);
8930 "Ignoring %u extra operands for an SRV descriptor.",
node->operand_count - 9);
8935 WARN(
"Failed to load resource type.\n");
8937 "SRV resource type metadata value is not an integer.");
8944 node->operands[8], ins)))
8962 WARN(
"Failed to load sample count.\n");
8964 "SRV sample count metadata value is not an integer.");
8970 WARN(
"Ignoring sample count value.\n");
8972 "Ignoring an SRV descriptor sample count metadata value which is not constant zero or undefined.");
8984 if (
node->operand_count < 11)
8986 WARN(
"Invalid operand count %u.\n",
node->operand_count);
8988 "Invalid operand count %u for a UAV descriptor.",
node->operand_count);
8991 if (
node->operand_count > 11)
8993 WARN(
"Ignoring %u extra operands.\n",
node->operand_count - 11);
8995 "Ignoring %u extra operands for a UAV descriptor.",
node->operand_count - 11);
8998 for (
i = 6;
i < 10; ++
i)
9002 WARN(
"Failed to load uint value at index %u.\n",
i);
9004 "A UAV descriptor operand metadata value is not an integer.");
9018 node->operands[10], ins)))
9041 if (
node->operand_count < 7)
9043 WARN(
"Invalid operand count %u.\n",
node->operand_count);
9045 "Invalid operand count %u for a CBV descriptor.",
node->operand_count);
9048 if (
node->operand_count > 7 &&
node->operands[7])
9050 WARN(
"Ignoring %u extra operands.\n",
node->operand_count - 7);
9052 "Ignoring %u extra operands for a CBV descriptor.",
node->operand_count - 7);
9057 WARN(
"Failed to load buffer size.\n");
9059 "Constant buffer size metadata value is not an integer.");
9071 reg->idx[0].offset =
d->id;
9072 reg->idx[1].offset =
d->range.first;
9073 reg->idx[2].offset =
d->range.last;
9090 if (
node->operand_count < 7)
9092 WARN(
"Invalid operand count %u.\n",
node->operand_count);
9094 "Invalid operand count %u for a sampler descriptor.",
node->operand_count);
9097 if (
node->operand_count > 7 &&
node->operands[7])
9099 WARN(
"Ignoring %u extra operands.\n",
node->operand_count - 7);
9101 "Ignoring %u extra operands for a sampler descriptor.",
node->operand_count - 7);
9109 WARN(
"Failed to load sampler mode.\n");
9111 "Sampler mode metadata value is not an integer.");
9122 FIXME(
"Ignoring sampler kind %u.\n", kind);
9124 "Ignoring sampler kind %u.", kind);
9133 reg->idx[0].offset =
d->id;
9134 reg->idx[1].offset =
d->range.first;
9135 reg->idx[2].offset =
d->range.last;
9163 WARN(
"Resource descriptor is not a node.\n");
9165 "Resource descriptor is not a metadata node.");
9170 if (
node->operand_count < 6)
9172 WARN(
"Invalid operand count %u.\n",
node->operand_count);
9174 "Invalid operand count %u for a descriptor.",
node->operand_count);
9181 ERR(
"Failed to allocate descriptor array.\n");
9183 "Out of memory allocating the descriptor array.");
9191 WARN(
"Failed to load resource id.\n");
9193 "Resource id metadata value is not an integer.");
9200 "Resource register range is invalid.");
9206 ERR(
"Failed to allocate instruction.\n");
9229 FIXME(
"Unsupported descriptor type %u.\n",
type);
9231 "Resource descriptor type %u is unsupported.",
type);
9236 ++sm6->
p.program->instructions.count;
9255 WARN(
"Unexpected descriptor type count %u.\n",
node->operand_count);
9257 "Descriptor type count %u is invalid.",
node->operand_count);
9268 WARN(
"Resource list is not a node.\n");
9270 "Resource list is not a metadata node.");
9286 if (
node->operand_count < 11 || !
node->operands[10])
9291 WARN(
"Additional values list is not a node.\n");
9293 "Signature element additional values list is not a metadata node.");
9298 if (
node->operand_count & 1)
9300 WARN(
"Operand count is not even.\n");
9302 "Operand count for signature element additional tag/value pairs is not even.");
9311 WARN(
"Failed to extract tag/value pair.\n");
9313 "Signature element tag/value pair at index %u is not an integer pair.",
i);
9326 WARN(
"Invalid relative addressed mask %#x.\n",
value);
9328 "Mask %#x of relative-addressed components is invalid.",
value);
9334 WARN(
"Invalid used mask %#x.\n",
value);
9336 "Mask %#x of used components is invalid.",
value);
9344 "Tag %#x for signature element additional value %#x is unhandled.",
tag,
value);
9364 WARN(
"Signature element list is not a node.\n");
9366 "Signature element list is not a metadata node.");
9371 operand_count =
node->operand_count;
9373 if (!(elements =
vkd3d_calloc(operand_count,
sizeof(*elements))))
9375 ERR(
"Failed to allocate %u signature elements.\n", operand_count);
9377 "Out of memory allocating %u signature elements.", operand_count);
9381 for (
i = 0;
i < operand_count; ++
i)
9387 WARN(
"Signature element is not a node.\n");
9389 "Signature element is not a metadata node.");
9393 element_node =
m->u.node;
9398 "Invalid signature element operand count %u.", element_node->
operand_count);
9405 "Ignoring %u extra operands for a signature element.", element_node->
operand_count - 11);
9408 for (
j = 0;
j < 10; ++
j)
9411 if (
j == 1 ||
j == 4)
9415 WARN(
"Failed to load uint value at index %u.\n",
j);
9417 "Signature element value at index %u is not an integer.",
j);
9426 FIXME(
"Unsupported element id %u not equal to its index %u.\n",
values[0],
i);
9428 "A non-sequential and non-zero-based element id is not supported.");
9434 WARN(
"Element name is not a string.\n");
9436 "Signature element name is not a metadata string.");
9439 e->semantic_name = element_node->
operands[1]->u.string_value;
9448 WARN(
"Unhandled semantic kind %u.\n",
j);
9450 "DXIL semantic kind %u is unhandled.",
j);
9456 WARN(
"Unhandled interpolation mode %u.\n",
e->interpolation_mode);
9458 "Interpolation mode %u is unhandled.",
e->interpolation_mode);
9462 e->register_count =
values[6];
9463 column_count =
values[7];
9464 e->register_index =
values[8];
9465 e->target_location =
e->register_index;
9467 if ((is_register =
e->register_index ==
UINT_MAX))
9471 WARN(
"Unhandled I/O register semantic kind %u.\n",
j);
9473 "DXIL semantic kind %u is unhandled for an I/O register.",
j);
9479 WARN(
"Invalid row start %u with row count %u.\n",
e->register_index,
e->register_count);
9481 "A signature element starting row of %u with count %u is invalid.",
9482 e->register_index,
e->register_count);
9489 WARN(
"Invalid column start %u with count %u.\n",
index, column_count);
9491 "A signature element starting column %u with count %u is invalid.",
index, column_count);
9496 e->used_mask =
e->mask;
9512 WARN(
"Semantic index list is not a node.\n");
9514 "Signature element semantic index list is not a metadata node.");
9518 element_node =
m->u.node;
9523 WARN(
"Failed to get semantic index for row %u.\n",
j);
9525 "Signature element semantic index for row %u is not an integer.",
j);
9529 e->semantic_index =
index;
9531 else if (
index !=
e->semantic_index +
j)
9533 WARN(
"Semantic index %u for row %u is not of an incrementing sequence.\n",
index,
j);
9535 "Signature element semantic index %u for row %u is not of an incrementing sequence.",
index,
j);
9540 for (
i = 0;
i < operand_count; ++
i)
9546 "Failed to allocate signature element semantic name.");
9547 for (
j = 0;
j <
i; ++
j)
9556 s->elements = elements;
9557 s->element_count = operand_count;
9574 WARN(
"Signature table is not a node.\n");
9576 "Signature table is not a metadata node.");
9581 &
program->input_signature, tessellator_domain)) < 0)
9586 &
program->output_signature, tessellator_domain)) < 0)
9591 &
program->patch_constant_signature, tessellator_domain)) < 0)
9610 WARN(
"Failed to load global flags.\n");
9612 "Global flags metadata value is not an integer.");
9618 rotated_flags = (rotated_flags >> 1) | ((rotated_flags & 1) << 4);
9631 unsigned int group_sizes[3];
9636 WARN(
"Shader of type %#x has thread group dimensions.\n",
version->type);
9638 "Shader has thread group dimensions but is not a compute shader.");
9644 WARN(
"Thread group dimension value is not a node.\n");
9646 "Thread group dimension metadata value is not a node.");
9651 if (
node->operand_count != 3)
9653 WARN(
"Invalid operand count %u.\n",
node->operand_count);
9655 "Thread group dimension operand count %u is invalid.",
node->operand_count);
9659 for (
i = 0;
i < 3; ++
i)
9663 WARN(
"Thread group dimension is not an integer value.\n");
9665 "Thread group dimension metadata value is not an integer.");
9670 char dim =
"XYZ"[
i];
9671 WARN(
"Invalid thread group %c dimension %u.\n", dim, group_sizes[
i]);
9673 "Thread group %c dimension %u is invalid.", dim, group_sizes[
i]);
9697 unsigned int patch_vertex_count)
9729 "%s control point count %u is invalid.",
type,
count);
9756 WARN(
"Unhandled output primitive %u.\n", primitive);
9758 "Hull shader tessellator output primitive %u is unhandled.", primitive);
9772 WARN(
"Max tess factor property is not a float value.\n");
9774 "Hull shader max tessellation factor property operand is not a float.");
9793 unsigned int i, input_control_point_count = 1, patch_vertex_count = 0;
9799 WARN(
"Missing or invalid GS properties.\n");
9801 "Geometry shader properties node is missing or invalid.");
9808 WARN(
"Invalid operand count %u.\n",
node->operand_count);
9810 "Geometry shader properties operand count %u is invalid.",
node->operand_count);
9817 "Ignoring %zu extra operands for geometry shader properties.",
9821 for (
i = 0;
i <
node->operand_count; ++
i)
9825 WARN(
"GS property at index %u is not a uint value.\n",
i);
9827 "Geometry shader properties operand at index %u is not an integer.",
i);
9835 input_control_point_count = 1;
9840 input_control_point_count = 2;
9845 input_control_point_count = 3;
9850 input_control_point_count = 4;
9855 input_control_point_count = 6;
9866 WARN(
"Unhandled input primitive %u.\n",
i);
9868 "Geometry shader input primitive %u is unhandled.",
i);
9873 sm6->
p.program->input_control_point_count = input_control_point_count;
9879 WARN(
"GS output vertex count %u invalid.\n",
i);
9881 "Geometry shader output vertex count %u is invalid.",
i);
9889 "Geometry shader stream mask %#x is unhandled.",
operands[2]);
9895 WARN(
"Unhandled output primitive %u.\n", output_primitive);
9897 "Geometry shader output primitive %u is unhandled.", output_primitive);
9905 WARN(
"GS instance count %u invalid.\n",
i);
9907 "Geometry shader instance count %u is invalid.",
i);
9921 WARN(
"Missing or invalid DS properties.\n");
9923 "Domain shader properties node is missing or invalid.");
9930 WARN(
"Invalid operand count %u.\n",
node->operand_count);
9932 "Domain shader properties operand count %u is invalid.",
node->operand_count);
9939 "Ignoring %zu extra operands for domain shader properties.",
9943 for (
i = 0;
i <
node->operand_count; ++
i)
9947 WARN(
"DS property at index %u is not a uint value.\n",
i);
9949 "Domain shader properties operand at index %u is not an integer.",
i);
9955 sm6->
p.program->input_control_point_count =
operands[1];
9970 WARN(
"Missing or invalid HS properties.\n");
9972 "Hull shader properties node is missing or invalid.");
9977 if (
node->operand_count < 7)
9979 WARN(
"Invalid operand count %u.\n",
node->operand_count);
9981 "Hull shader properties operand count %u is invalid.",
node->operand_count);
9984 if (
node->operand_count > 7)
9986 WARN(
"Ignoring %u extra operands.\n",
node->operand_count - 7);
9988 "Ignoring %u extra operands for hull shader properties.",
node->operand_count - 7);
9991 m =
node->operands[0];
9994 WARN(
"Patch constant function node is not a function value.\n");
9996 "Hull shader patch constant function node is not a function value.");
10007 WARN(
"HS property at index %u is not a uint value.\n",
i);
10009 "Hull shader properties operand at index %u is not an integer.",
i);
10037 WARN(
"No entry point definition found.\n");
10039 "No entry point definition found in the metadata.");
10045 WARN(
"Entry point definition is not a value.\n");
10047 "Entry point definition is not a metadata value.");
10054 WARN(
"Entry point value is not a function definition.\n");
10056 "Entry point metadata value does not contain a function definition.");
10066 "Entry point function name %s does not match the name in metadata.", sm6->
entry_point);
10073 WARN(
"Shader properties list is not a node.\n");
10075 "Shader properties tag/value list is not a metadata node.");
10080 if (
node->operand_count & 1)
10082 WARN(
"Operand count is not even.\n");
10084 "Operand count for shader properties tag/value pairs is not even.");
10086 operand_count =
node->operand_count & ~1u;
10088 for (
i = 0;
i < operand_count;
i += 2)
10092 WARN(
"Tag is not an integer value.\n");
10094 "Shader properties tag at index %u is not an integer.",
i);
10117 FIXME(
"Unhandled tag %#x.\n",
tag);
10119 "Shader properties tag %#x is unhandled.",
tag);
10215 for (
i = 0;
i <
block->phi_count; ++
i)
10262 struct shader_signature *patch_constant_signature, *output_signature, *input_signature;
10263 uint32_t version_token, dxil_version, token_count, magic;
10265 unsigned int chunk_offset, chunk_size;
10273 count = byte_code_size /
sizeof(*byte_code);
10276 WARN(
"Invalid data size %zu.\n", byte_code_size);
10278 "DXIL chunk size %zu is smaller than the DXIL header size.", byte_code_size);
10282 version_token = byte_code[0];
10283 TRACE(
"Compiler version: 0x%08x.\n", version_token);
10284 token_count = byte_code[1];
10285 TRACE(
"Token count: %u.\n", token_count);
10287 if (token_count < 6 ||
count < token_count)
10289 WARN(
"Invalid token count %u (word count %zu).\n", token_count,
count);
10291 "DXIL chunk token count %#x is invalid (word count %zu).", token_count,
count);
10296 WARN(
"Unknown magic number 0x%08x.\n", byte_code[2]);
10298 dxil_version = byte_code[3];
10299 if (dxil_version > 0x102)
10300 WARN(
"Unknown DXIL version: 0x%08x.\n", dxil_version);
10302 TRACE(
"DXIL version: 0x%08x.\n", dxil_version);
10304 chunk_offset = byte_code[4];
10305 if (chunk_offset < 16 || chunk_offset >= byte_code_size)
10307 WARN(
"Invalid bitcode chunk offset %#x (data size %zu).\n", chunk_offset, byte_code_size);
10309 "DXIL bitcode chunk has invalid offset %#x (data size %#zx).", chunk_offset, byte_code_size);
10312 chunk_size = byte_code[5];
10313 if (chunk_size > byte_code_size - chunk_offset)
10315 WARN(
"Invalid bitcode chunk size %#x (data size %zu, chunk offset %#x).\n",
10316 chunk_size, byte_code_size, chunk_offset);
10318 "DXIL bitcode chunk has invalid size %#x (data size %#zx, chunk offset %#x).",
10319 chunk_size, byte_code_size, chunk_offset);
10323 sm6->
start = (
const uint32_t *)((
const char*)&byte_code[2] + chunk_offset);
10326 WARN(
"Unknown magic number 0x%08x.\n", magic);
10328 "DXIL bitcode chunk magic number 0x%08x is not the expected 0x%08x.", magic,
BITCODE_MAGIC);
10331 sm6->
end = &sm6->
start[(chunk_size +
sizeof(*sm6->
start) - 1) /
sizeof(*sm6->
start)];
10337 "Unknown shader type %#x.",
version.type);
10345 WARN(
"Initial block abbreviation %u is not ENTER_SUBBLOCK.\n", abbr);
10347 "DXIL bitcode chunk has invalid initial block abbreviation %u.", abbr);
10352 count =
max(token_count, 400) - 400;
10360 switch (
program->shader_version.type)
10367 if (
program->patch_constant_signature.element_count != 0)
10369 WARN(
"The patch constant signature only makes sense for Hull and Domain Shaders, ignoring it.\n");
10375 input_signature = &
program->input_signature;
10376 output_signature = &
program->output_signature;
10377 patch_constant_signature = &
program->patch_constant_signature;
10381 memset(dxbc_desc, 0,
sizeof(*dxbc_desc));
10388 "Out of memory parsing DXIL bitcode chunk.");
10391 "DXIL bitcode chunk has invalid bitcode.");
10404 WARN(
"Invalid block length %zu; expected %u.\n",
length,
block->length);
10406 "Root block ends with length %zu but indicated length is %u.",
length,
block->length);
10408 if (sm6->
ptr != sm6->
end)
10410 size_t expected_length = sm6->
end - sm6->
start;
10412 WARN(
"Invalid module length %zu; expected %zu.\n",
length, expected_length);
10414 "Module ends with length %zu but indicated length is %zu.",
length, expected_length);
10421 "Out of memory parsing DXIL type table.");
10424 "DXIL type table is invalid.");
10434 "Out of memory parsing DXIL value symbol table.");
10437 "DXIL value symbol table is invalid.");
10448 ERR(
"Failed to allocate input/output parameters.\n");
10450 "Out of memory allocating input/output parameters.");
10458 ERR(
"Failed to allocate function array.\n");
10460 "Out of memory allocating DXIL function array.");
10467 WARN(
"Value array count overflowed.\n");
10469 "Overflow occurred in the DXIL module value count.");
10475 ERR(
"Failed to allocate value array.\n");
10477 "Out of memory allocating DXIL value array.");
10486 WARN(
"Failed to load global declarations.\n");
10492 ERR(
"Failed to allocate named metadata array.\n");
10505 FIXME(
"Too many metadata tables.\n");
10526 "Out of memory parsing DXIL module.");
10529 "DXIL module is invalid.");
10537 "Out of memory emitting shader signature declarations.");
10548 "The definition of the entry point function '%s' was not found.", sm6->
entry_point);
10564 "Failed to find the patch constant function '%s' for a hull shader.",
10574 expected_function_count = 2;
10580 expected_function_count = 1;
10587 "%zu functions were not emitted.", sm6->
function_count - expected_function_count);
10614 MESSAGE(
"Creating a DXIL parser. This is unsupported; you get to keep all the pieces if it breaks.\n");
10620 WARN(
"Failed to extract shader, vkd3d result %d.\n",
ret);
10630 ERR(
"Failed to allocate aligned chunk.\n");
_Check_return_ _Ret_maybenull_ _In_ size_t alignment
static __inline void bitmap_set(IN bitmap4 *mask, IN uint32_t word, IN uint32_t flag)
unsigned int component_count
static BOOL reserve(struct dynamic_array *array, int count, int itemsize)
static BOOL is_valid(HIMAGELIST himl)
static const WCHAR version[]
_ACRTIMP void __cdecl qsort(void *, size_t, size_t, int(__cdecl *)(const void *, const void *))
_ACRTIMP int __cdecl strcmp(const char *, const char *)
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
static BOOL is_int(CIMTYPE type)
uacpi_u16 uacpi_gpe_triggering uacpi_gpe_handler uacpi_handle ctx uacpi_u16 uacpi_namespace_node *wake_device uacpi_u16 idx uacpi_u16 idx uacpi_u16 idx uacpi_u16 idx uacpi_u16 idx uacpi_u64 uacpi_address_space address_space
int shader_extract_from_dxbc(const struct vkd3d_shader_code *dxbc, struct vkd3d_shader_message_context *message_context, const char *source_name, struct dxbc_shader_desc *desc)
void free_dxbc_shader_desc(struct dxbc_shader_desc *desc)
@ SEMANTIC_KIND_INNERCOVERAGE
@ SEMANTIC_KIND_INSIDETESSFACTOR
@ SEMANTIC_KIND_INSTANCEID
@ SEMANTIC_KIND_BARYCENTRICS
@ SEMANTIC_KIND_TESSFACTOR
@ SEMANTIC_KIND_SAMPLEINDEX
@ SEMANTIC_KIND_VIEWPORTARRAYINDEX
@ SEMANTIC_KIND_ISFRONTFACE
@ SEMANTIC_KIND_GSINSTANCEID
@ SEMANTIC_KIND_DISPATCHTHREADID
@ SEMANTIC_KIND_OUTPUTCONTROLPOINTID
@ SEMANTIC_KIND_DEPTHLESSEQUAL
@ SEMANTIC_KIND_SHADINGRATE
@ SEMANTIC_KIND_GROUPTHREADID
@ SEMANTIC_KIND_RTARRAYINDEX
@ SEMANTIC_KIND_STENCILREF
@ SEMANTIC_KIND_ARBITRARY
@ SEMANTIC_KIND_DOMAINLOCATION
@ SEMANTIC_KIND_CULLPRIMITIVE
@ SEMANTIC_KIND_CULLDISTANCE
@ SEMANTIC_KIND_GROUPINDEX
@ SEMANTIC_KIND_PRIMITIVEID
@ SEMANTIC_KIND_DEPTHGREATEREQUAL
@ SEMANTIC_KIND_CLIPDISTANCE
static const struct sm6_metadata_value * sm6_parser_metadata_get_value(const struct sm6_parser *sm6, uint64_t index)
static bool sm6_type_is_bool_i16_i32_i64(const struct sm6_type *type)
static void sm6_parser_emit_dx_create_handle(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static bool sm6_value_is_constant_zero(const struct sm6_value *value)
static bool sm6_parser_resources_load_register_range(struct sm6_parser *sm6, const struct sm6_metadata_node *node, struct vkd3d_shader_register_range *range)
static size_t size_add_with_overflow_check(size_t a, size_t b)
static bool sm6_value_is_constant(const struct sm6_value *value)
static void src_param_init_scalar(struct vkd3d_shader_src_param *param, unsigned int component_idx)
static enum vkd3d_shader_opcode sm6_dx_map_wave_bit_op(enum dxil_wave_bit_op_kind op, struct sm6_parser *sm6)
static bool sm6_metadata_get_uint_value(const struct sm6_parser *sm6, const struct sm6_metadata_value *m, unsigned int *u)
static void sm6_parser_emit_ret(struct sm6_parser *sm6, const struct dxil_record *record, struct sm6_block *code_block, struct vkd3d_shader_instruction *ins)
static bool sm6_metadata_value_is_value(const struct sm6_metadata_value *m)
static void sm6_parser_validate_control_point_count(struct sm6_parser *sm6, unsigned int count, const char *type)
static void register_init_ssa_vector(struct vkd3d_shader_register *reg, const struct sm6_type *type, unsigned int component_count, struct sm6_value *value, struct sm6_parser *sm6)
static void sm6_parser_emit_call(struct sm6_parser *sm6, const struct dxil_record *record, struct function_emission_state *state, struct sm6_value *dst)
static bool sm6_type_is_integer(const struct sm6_type *type)
static void sm6_parser_dcl_register_builtin(struct sm6_parser *sm6, enum vkd3d_shader_opcode handler_idx, enum vkd3d_shader_register_type reg_type, enum vkd3d_data_type data_type, unsigned int component_count)
static enum vkd3d_result sm6_parser_function_init(struct sm6_parser *sm6, const struct dxil_block *block, struct sm6_function *function)
static const struct sm6_type * sm6_type_get_scalar_type(const struct sm6_type *type, unsigned int elem_idx)
static bool resolve_forward_zero_initialiser(size_t index, struct sm6_parser *sm6)
static bool sm6_type_is_floating_point(const struct sm6_type *type)
static void sm6_parser_emit_dcl_tessellator_output_primitive(struct sm6_parser *sm6, enum vkd3d_shader_tessellator_output_primitive primitive)
static void sm6_parser_emit_phi(struct sm6_parser *sm6, const struct dxil_record *record, struct sm6_function *function, struct sm6_block *code_block, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
static const struct sm6_value * sm6_parser_get_value_safe(struct sm6_parser *sm6, unsigned int idx)
@ RESOURCE_TAG_SAMPLER_FEEDBACK_KIND
@ RESOURCE_TAG_ENABLE_ATOMIC_64
@ RESOURCE_TAG_ELEMENT_STRIDE
@ RESOURCE_TAG_ELEMENT_TYPE
static bool sm6_type_is_float(const struct sm6_type *type)
static bool sm6_type_is_numeric(const struct sm6_type *type)
static void sm6_parser_emit_dx_wave_active_bit(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static void sm6_parser_emit_dcl_tessellator_partitioning(struct sm6_parser *sm6, enum vkd3d_shader_tessellator_partitioning tessellator_partitioning)
static bool sm6_value_validate_is_i32(const struct sm6_value *value, struct sm6_parser *sm6)
static enum vkd3d_result dxil_block_read(struct dxil_block *parent, struct sm6_parser *sm6)
static void dst_param_init_with_mask(struct vkd3d_shader_dst_param *param, unsigned int mask)
static struct vkd3d_shader_resource * sm6_parser_resources_load_common_info(struct sm6_parser *sm6, const struct sm6_metadata_value *type_value, bool is_uav, enum dxil_resource_kind kind, const struct sm6_metadata_value *m, struct vkd3d_shader_instruction *ins)
static void sm6_parser_emit_dx_domain_location(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static bool sm6_parser_read_vbr_operand(struct sm6_parser *sm6, uint64_t context, uint64_t *op)
static void sm6_parser_gs_properties_init(struct sm6_parser *sm6, const struct sm6_metadata_value *m)
static enum vkd3d_result dxil_abbrev_init(struct dxil_abbrev *abbrev, unsigned int count, struct sm6_parser *sm6)
static bool bitcode_parse_alignment(uint64_t encoded_alignment, unsigned int *alignment)
static void sm6_parser_emit_dx_wave_op(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static bool sm6_type_is_f16_f32(const struct sm6_type *type)
static void sm6_parser_decode_dx_op(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const char *name, const struct sm6_value **operands, unsigned int operand_count, struct function_emission_state *state, struct sm6_value *dst)
static void src_param_make_constant_uint(struct vkd3d_shader_src_param *param, unsigned int value)
static void src_param_init_from_value(struct vkd3d_shader_src_param *param, const struct sm6_value *src)
static struct vkd3d_shader_src_param * instruction_src_params_alloc(struct vkd3d_shader_instruction *ins, unsigned int count, struct sm6_parser *sm6)
static void sm6_phi_destroy(struct sm6_phi *phi)
static void sm6_block_emit_phi(const struct sm6_block *block, struct sm6_parser *sm6)
static const unsigned int MAX_GS_OUTPUT_STREAMS
static bool sm6_parser_emit_coordinate_construct(struct sm6_parser *sm6, const struct sm6_value **operands, unsigned int max_operands, const struct sm6_value *z_operand, struct function_emission_state *state, struct vkd3d_shader_register *reg)
static bool sm6_type_is_numeric_aggregate(const struct sm6_type *type)
static struct sm6_value * sm6_parser_get_current_value(const struct sm6_parser *sm6)
int dxil_parse(const struct vkd3d_shader_compile_info *compile_info, uint64_t config_flags, struct vkd3d_shader_message_context *message_context, struct vsir_program *program)
static const struct sm6_type * sm6_type_get_cmpxchg_result_struct(struct sm6_parser *sm6)
static void sm6_parser_declare_indexable_temp(struct sm6_parser *sm6, const struct sm6_type *elem_type, unsigned int count, unsigned int alignment, bool has_function_scope, unsigned int init, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
static const struct sm6_type * sm6_type_get_pointer_to_type(const struct sm6_type *type, enum bitcode_address_space addr_space, struct sm6_parser *sm6)
static const uint64_t ALLOCA_FLAG_EXPLICIT_TYPE
#define VKD3D_SM6_MAX_METADATA_TABLES
static enum vkd3d_result sm6_parser_resources_load_sampler(struct sm6_parser *sm6, const struct sm6_metadata_node *node, struct sm6_descriptor_info *d, struct vkd3d_shader_instruction *ins)
static void sm6_parser_declare_icb(struct sm6_parser *sm6, const struct sm6_type *elem_type, unsigned int count, unsigned int alignment, unsigned int init, struct sm6_value *dst)
static bool sm6_parser_validate_dx_op(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const char *name, const struct sm6_value **operands, unsigned int operand_count, struct sm6_value *dst)
static const struct dxil_block * sm6_parser_get_level_one_block(const struct sm6_parser *sm6, enum bitcode_block_id id, bool *is_unique)
static char * dxil_record_to_string(const struct dxil_record *record, unsigned int offset, struct sm6_parser *sm6)
static void sm6_parser_emit_dx_get_sample_count(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_shader_resource_type shader_resource_type_from_dxil_resource_kind(enum dxil_resource_kind kind)
static const struct sm6_type * sm6_type_get_element_type(const struct sm6_type *type)
static bool dxil_record_validate_operand_min_count(const struct dxil_record *record, unsigned int min_count, struct sm6_parser *sm6)
static const struct sm6_value * sm6_parser_next_function_definition(struct sm6_parser *sm6)
static const uint64_t MAX_ALIGNMENT_EXPONENT
static enum vkd3d_result sm6_parser_resources_load_uav(struct sm6_parser *sm6, const struct sm6_metadata_node *node, struct sm6_descriptor_info *d, struct vkd3d_shader_instruction *ins)
static void sm6_parser_emit_dx_void(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static void sm6_parser_emit_dx_output_control_point_id(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static void sm6_parser_emit_binop(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
static void sm6_parser_init_output_signature(struct sm6_parser *sm6, const struct shader_signature *output_signature)
static void src_param_init_vector_from_reg(struct vkd3d_shader_src_param *param, const struct vkd3d_shader_register *reg)
static enum vkd3d_result dxil_block_init(struct dxil_block *block, const struct dxil_block *parent, struct sm6_parser *sm6)
static bool sm6_type_is_aggregate(const struct sm6_type *type)
static size_t sm6_parser_get_value_index(struct sm6_parser *sm6, uint64_t idx)
@ SAMPLER_KIND_COMPARISON
static bool sm6_value_validate_is_handle(const struct sm6_value *value, struct sm6_parser *sm6)
static enum vkd3d_result sm6_parser_add_global_abbrev(struct sm6_parser *sm6)
static unsigned int sm6_type_max_vector_size(const struct sm6_type *type)
dxil_shader_properties_tag
@ SHADER_PROPERTIES_DOMAIN
@ SHADER_PROPERTIES_ENTRY_ROOT_SIG
@ SHADER_PROPERTIES_COMPUTE
@ SHADER_PROPERTIES_AUTO_BINDING_SPACE
@ SHADER_PROPERTIES_RAY_PAYLOAD_SIZE
@ SHADER_PROPERTIES_RAY_ATTRIB_SIZE
@ SHADER_PROPERTIES_SHADER_KIND
@ SHADER_PROPERTIES_FLAGS
@ SHADER_PROPERTIES_GEOMETRY
@ SHADER_PROPERTIES_WAVE_SIZE
@ SHADER_PROPERTIES_AMPLIFICATION
static void sm6_parser_emit_atomicrmw(struct sm6_parser *sm6, const struct dxil_record *record, struct function_emission_state *state, struct sm6_value *dst)
static void sm6_parser_emit_dx_texture_gather(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static const unsigned int GLOBALVAR_ADDRESS_SPACE_SHIFT
static enum vkd3d_result sm6_parser_type_table_init(struct sm6_parser *sm6)
static void sm6_parser_emit_gep(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
static size_t sm6_parser_compute_global_abbrev_count_for_block_id(struct sm6_parser *sm6, unsigned int block_id)
static void register_init_ssa_scalar(struct vkd3d_shader_register *reg, const struct sm6_type *type, struct sm6_value *value, struct sm6_parser *sm6)
static bool sm6_parser_read_fixed_operand(struct sm6_parser *sm6, uint64_t context, uint64_t *op)
static uint32_t sm6_parser_read_bits(struct sm6_parser *sm6, unsigned int length)
static bool sm6_value_is_function_dcl(const struct sm6_value *value)
static unsigned int register_get_uint_value(const struct vkd3d_shader_register *reg)
static void sm6_parser_emit_dx_raw_buffer_load(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static const struct sm6_dx_opcode_info sm6_dx_op_table[]
static void sm6_parser_emit_dx_binary(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static bool sm6_parser_read_blob_operand(struct sm6_parser *sm6, uint64_t context, uint64_t *op)
static enum vkd3d_result dxil_block_add_record(struct dxil_block *block, struct dxil_record *record)
@ METADATA_ATTACHMENT_BLOCK
static void sm6_parser_emit_global_flags(struct sm6_parser *sm6, const struct sm6_metadata_value *m)
static size_t sm6_parser_compute_max_value_count(struct sm6_parser *sm6, const struct dxil_block *block, size_t value_count)
static struct sm6_block * sm6_block_create()
static void instruction_dst_param_init_ssa_vector(struct vkd3d_shader_instruction *ins, unsigned int component_count, struct sm6_parser *sm6)
static void sm6_parser_emit_dx_get_dimensions(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_result sm6_function_resolve_phi_incomings(const struct sm6_function *function, struct sm6_parser *sm6)
static enum vkd3d_result sm6_parser_read_signature(struct sm6_parser *sm6, const struct sm6_metadata_value *m, struct shader_signature *s, enum vkd3d_tessellator_domain tessellator_domain)
static bool sm6_parser_allocate_named_metadata(struct sm6_parser *sm6)
static bool sm6_parser_is_end(struct sm6_parser *sm6)
static const struct sm6_metadata_value * sm6_parser_find_named_metadata(struct sm6_parser *sm6, const char *name)
static bool sm6_type_is_bool(const struct sm6_type *type)
static const unsigned int dx_max_thread_group_size[3]
static float bitcast_uint_to_float(unsigned int value)
static enum vkd3d_shader_sysval_semantic sysval_semantic_from_dxil_semantic_kind(enum dxil_semantic_kind kind, enum vkd3d_tessellator_domain domain)
static size_t dxil_block_compute_constants_count(const struct dxil_block *block)
static void instruction_set_texel_offset(struct vkd3d_shader_instruction *ins, const struct sm6_value **operands, struct sm6_parser *sm6)
@ RESOURCE_KIND_TEXTURECUBE
@ RESOURCE_KIND_RAWBUFFER
@ RESOURCE_KIND_TEXTURE1DARRAY
@ RESOURCE_KIND_TEXTURE1D
@ RESOURCE_KIND_TEXTURECUBEARRAY
@ RESOURCE_KIND_FEEDBACKTEXTURE2D
@ RESOURCE_KIND_TEXTURE2DARRAY
@ RESOURCE_KIND_TYPEDBUFFER
@ RESOURCE_KIND_RTACCELERATIONSTRUCTURE
@ RESOURCE_KIND_TEXTURE3D
@ RESOURCE_KIND_TEXTURE2DMSARRAY
@ RESOURCE_KIND_FEEDBACKTEXTURE2DARRAY
@ RESOURCE_KIND_TEXTURE2DMS
@ RESOURCE_KIND_TEXTURE2D
@ RESOURCE_KIND_STRUCTUREDBUFFER
static enum vkd3d_shader_sysval_semantic sysval_semantic_table[]
static bool sm6_type_is_i8(const struct sm6_type *type)
static void sm6_parser_emit_dcl_max_tessellation_factor(struct sm6_parser *sm6, struct sm6_metadata_value *m)
static bool sm6_parser_declare_function(struct sm6_parser *sm6, const struct dxil_record *record)
static void sm6_parser_emit_dx_input_register_mov(struct sm6_parser *sm6, struct vkd3d_shader_instruction *ins, enum vkd3d_shader_register_type reg_type, enum vkd3d_data_type data_type)
static bool resource_kind_is_multisampled(enum dxil_resource_kind kind)
static void sm6_parser_declare_tgsm_structured(struct sm6_parser *sm6, const struct sm6_type *elem_type, unsigned int count, unsigned int alignment, unsigned int init, struct sm6_value *dst)
static bool dxil_block_handle_blockinfo_record(struct dxil_block *block, struct dxil_record *record)
static enum vkd3d_result sm6_parser_entry_point_init(struct sm6_parser *sm6)
static void sm6_parser_emit_dx_wave_active_ballot(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_result sm6_parser_metadata_init(struct sm6_parser *sm6, const struct dxil_block *block, struct sm6_metadata_table *table)
static enum vkd3d_result sm6_parser_globals_init(struct sm6_parser *sm6)
static enum vkd3d_result sm6_parser_symtab_init(struct sm6_parser *sm6)
static void sm6_parser_emit_dx_coverage(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static void dst_param_init(struct vkd3d_shader_dst_param *param)
static enum vkd3d_tessellator_domain sm6_parser_ds_properties_init(struct sm6_parser *sm6, const struct sm6_metadata_value *m)
static struct vkd3d_shader_instruction * sm6_parser_require_space(struct sm6_parser *sm6, size_t extra)
static void sm6_parser_emit_dx_fabs(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_shader_opcode sm6_dx_map_tertiary_op(enum dx_intrinsic_opcode op)
static void sm6_parser_emit_dx_buffer_store(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static const struct sm6_block * sm6_function_get_block(const struct sm6_function *function, uint64_t index, struct sm6_parser *sm6)
static void sm6_parser_emit_load(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
static bool sm6_value_validate_is_backward_ref(const struct sm6_value *value, struct sm6_parser *sm6)
static void sm6_parser_emit_dx_barrier(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static bool sm6_metadata_value_is_string(const struct sm6_metadata_value *m)
static bool sm6_parser_emit_composite_construct(struct sm6_parser *sm6, const struct sm6_value **operands, unsigned int component_count, struct function_emission_state *state, struct vkd3d_shader_register *reg)
static enum vkd3d_result sm6_parser_read_abbrev_record(struct sm6_parser *sm6, unsigned int abbrev_id)
static void sm6_parser_emit_dcl_primitive_topology(struct sm6_parser *sm6, enum vkd3d_shader_opcode handler_idx, enum vkd3d_primitive_type primitive_type, unsigned int patch_vertex_count)
static bool sm6_value_validate_is_texture_2dms_handle(const struct sm6_value *value, enum dx_intrinsic_opcode op, struct sm6_parser *sm6)
static void sm6_parser_emit_dx_dot(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static float register_get_float_value(const struct vkd3d_shader_register *reg)
@ CST_CODE_CE_INBOUNDS_GEP
static void sm6_parser_emit_dx_cbuffer_load(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static bool sm6_metadata_get_float_value(const struct sm6_parser *sm6, const struct sm6_metadata_value *m, float *f)
static enum vkd3d_shader_opcode map_dx_unary_op(enum dx_intrinsic_opcode op)
static void sm6_parser_emit_dx_get_sample_pos(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_shader_opcode map_binary_op(uint64_t code, const struct sm6_type *type_a, const struct sm6_type *type_b, struct sm6_parser *sm6)
static bool sm6_metadata_value_is_node(const struct sm6_metadata_value *m)
static void dxil_global_abbrevs_cleanup(struct dxil_global_abbrev **abbrevs, size_t count)
static const unsigned int MAX_GS_INSTANCE_COUNT
static const uint64_t CALL_CONV_FLAG_EXPLICIT_TYPE
static void sm6_parser_emit_store(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
static void sm6_parser_metadata_attachments_init(struct sm6_parser *sm6, const struct dxil_block *block)
static bool sm6_parser_emit_reg_composite_construct(struct sm6_parser *sm6, const struct vkd3d_shader_register **operand_regs, unsigned int component_count, struct function_emission_state *state, struct vkd3d_shader_register *reg)
static bool resource_kind_is_texture(enum dxil_resource_kind kind)
static const char * sm6_parser_get_global_symbol_name(const struct sm6_parser *sm6, size_t id)
static bool sm6_value_is_ssa(const struct sm6_value *value)
static void sm6_parser_emit_dx_stream(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static bool sm6_type_is_double(const struct sm6_type *type)
bitcode_block_abbreviation
@ FP_ALLOW_UNSAFE_ALGEBRA
static enum vkd3d_result sm6_parser_init(struct sm6_parser *sm6, struct vsir_program *program, const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context, struct dxbc_shader_desc *dxbc_desc)
static const uint64_t ALLOCA_ALIGNMENT_MASK
static int global_symbol_compare(const void *a, const void *b)
static bool sm6_value_is_dx_intrinsic_dcl(const struct sm6_value *fn)
static enum vkd3d_result sm6_parser_emit_thread_group(struct sm6_parser *sm6, const struct sm6_metadata_value *m)
static bool sm6_value_validate_is_numeric(const struct sm6_value *value, struct sm6_parser *sm6)
static uint32_t sm6_parser_read_uint32(struct sm6_parser *sm6)
static void register_init_with_id(struct vkd3d_shader_register *reg, enum vkd3d_shader_register_type reg_type, enum vkd3d_data_type data_type, unsigned int id)
static void register_make_constant_uint(struct vkd3d_shader_register *reg, unsigned int value)
@ FUNC_CODE_DECLAREBLOCKS
@ FUNC_CODE_INST_STOREATOMIC
@ FUNC_CODE_INST_ATOMICRMW
@ FUNC_CODE_INST_LOADATOMIC
@ FUNC_CODE_INST_EXTRACTVAL
static enum vkd3d_result sm6_parser_signatures_init(struct sm6_parser *sm6, const struct sm6_metadata_value *m, enum vkd3d_tessellator_domain tessellator_domain)
static bool sm6_parser_validate_operand_type(struct sm6_parser *sm6, const struct sm6_value *value, char info_type, const struct sm6_type *ret_type, bool is_return)
static enum vkd3d_shader_opcode sm6_map_cast_op(uint64_t code, const struct sm6_type *from, const struct sm6_type *to, struct sm6_parser *sm6)
static size_t dxil_block_compute_module_decl_count(const struct dxil_block *block)
static double bitcast_uint64_to_double(uint64_t value)
static void sm6_parser_emit_unhandled(struct sm6_parser *sm6, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
static void sm6_symtab_cleanup(struct sm6_symbol *symbols, size_t count)
static enum vkd3d_result sm6_parser_init_constexpr_gep(struct sm6_parser *sm6, const struct dxil_record *record, struct sm6_value *dst)
static bool sm6_type_is_function_pointer(const struct sm6_type *type)
static bool resources_load_additional_values(struct resource_additional_values *info, const struct sm6_metadata_node *node, enum dxil_resource_kind kind, struct sm6_parser *sm6)
static bool sm6_parser_read_char6_operand(struct sm6_parser *sm6, uint64_t context, uint64_t *op)
static void sm6_parser_emit_dx_buffer_load(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static unsigned int sm6_value_get_constant_uint(const struct sm6_value *value)
static const uint64_t ALLOCA_FLAG_IN_ALLOCA
static uint64_t sm6_parser_read_vbr(struct sm6_parser *sm6, unsigned int length)
static void sm6_parser_emit_dx_sincos(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static void sm6_parser_emit_dx_unary(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static bool sm6_type_is_scalar(const struct sm6_type *type)
static struct sm6_block * sm6_function_create_block(struct sm6_function *function)
static enum vkd3d_data_type data_type_table[]
static void sm6_functions_cleanup(struct sm6_function *functions, size_t count)
static void sm6_parser_emit_dx_make_double(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static void metadata_attachment_record_apply(const struct dxil_record *record, enum bitcode_function_code func_code, struct vkd3d_shader_instruction *ins, struct sm6_value *dst, struct sm6_parser *sm6)
static enum vkd3d_result sm6_parser_module_init(struct sm6_parser *sm6, const struct dxil_block *block, unsigned int level)
static void sm6_parser_emit_dx_primitive_id(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static void sm6_metadata_value_destroy(struct sm6_metadata_value *m)
@ ADDRESS_SPACE_GROUPSHARED
@ ADDRESS_SPACE_DEVICEMEM
static enum vkd3d_shader_opcode map_dx_atomic_binop(const struct sm6_value *operand, struct sm6_parser *sm6)
static void sm6_parser_cleanup(struct sm6_parser *sm6)
static enum vkd3d_shader_register_type register_type_from_dxil_semantic_kind(enum vkd3d_shader_sysval_semantic sysval_semantic)
static void sm6_parser_metadata_cleanup(struct sm6_parser *sm6)
static enum vkd3d_shader_minimum_precision minimum_precision_from_dxil_component_type(enum dxil_component_type type)
static void register_index_address_init(struct vkd3d_shader_register_index *idx, const struct sm6_value *address, struct sm6_parser *sm6)
static bool sm6_type_is_struct(const struct sm6_type *type)
static const unsigned int SHADER_DESCRIPTOR_TYPE_COUNT
static void sm6_parser_emit_switch(struct sm6_parser *sm6, const struct dxil_record *record, struct sm6_function *function, struct sm6_block *code_block, struct vkd3d_shader_instruction *ins)
static void sm6_parser_emit_dx_store_output(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
dxil_overflowing_binop_flags
static void sm6_parser_emit_dx_sample_index(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static void sm6_parser_emit_dx_calculate_lod(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static void dst_param_init_vector(struct vkd3d_shader_dst_param *param, unsigned int component_count)
static void sm6_parser_emit_cast(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
static void sm6_type_table_cleanup(struct sm6_type *types, size_t count)
static bool metadata_node_get_unary_uint(const struct sm6_metadata_node *node, unsigned int *operand, struct sm6_parser *sm6)
static bool dxil_record_validate_operand_count(const struct dxil_record *record, unsigned int min_count, unsigned int max_count, struct sm6_parser *sm6)
static void sm6_parser_align_32(struct sm6_parser *sm6)
static uint64_t sm6_value_get_constant_uint64(const struct sm6_value *value)
@ DX_WAVE_PREFIX_BIT_COUNT
@ DX_WAVE_READ_LANE_FIRST
@ DX_TEX2DMS_GET_SAMPLE_POS
@ DX_STORE_PATCH_CONSTANT
@ DX_BUFFER_UPDATE_COUNTER
@ DX_WAVE_ACTIVE_ALL_EQUAL
@ DX_LOAD_OUTPUT_CONTROL_POINT
@ DX_EMIT_THEN_CUT_STREAM
@ DX_FLATTENED_THREAD_ID_IN_GROUP
@ DX_OUTPUT_CONTROL_POINT_ID
static void sm6_parser_init_input_signature(struct sm6_parser *sm6, const struct shader_signature *input_signature)
static enum vkd3d_result metadata_value_create_node(struct sm6_metadata_value *m, struct sm6_metadata_table *table, unsigned int dst_idx, unsigned int end_count, const struct dxil_record *record, struct sm6_parser *sm6)
static void sm6_parser_emit_dx_tertiary(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static const struct vkd3d_shader_immediate_constant_buffer * resolve_forward_initialiser(size_t index, struct sm6_parser *sm6)
static bool sm6_type_is_function(const struct sm6_type *type)
#define VKD3D_SM6_VERSION_MAJOR(version)
static void sm6_parser_emit_dx_split_double(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static bool sm6_type_is_pointer(const struct sm6_type *type)
static void dxil_record_validate_operand_max_count(const struct dxil_record *record, unsigned int max_count, struct sm6_parser *sm6)
static const uint64_t GLOBALVAR_FLAG_EXPLICIT_TYPE
static bool sm6_type_is_handle(const struct sm6_type *type)
static bool sm6_value_is_register(const struct sm6_value *value)
static bool sm6_value_validate_is_pointer(const struct sm6_value *value, struct sm6_parser *sm6)
static void sm6_parser_metadata_attachment_block_init(struct sm6_parser *sm6, const struct dxil_block *target_block, const struct dxil_block *block)
static const uint64_t GLOBALVAR_FLAG_IS_CONSTANT
static bool sm6_metadata_get_uint64_value(const struct sm6_parser *sm6, const struct sm6_metadata_value *m, uint64_t *u)
static void signature_element_read_additional_element_values(struct signature_element *e, const struct sm6_metadata_node *node, struct sm6_parser *sm6)
static size_t dxil_block_compute_function_count(const struct dxil_block *root)
static uint64_t decode_rotated_signed_value(uint64_t value)
static void dst_param_init_ssa_scalar(struct vkd3d_shader_dst_param *param, const struct sm6_type *type, struct sm6_value *value, struct sm6_parser *sm6)
static const struct sm6_type * sm6_type_get_element_type_at_index(const struct sm6_type *type, uint64_t elem_idx)
static enum vkd3d_result sm6_parser_add_block_abbrev(struct sm6_parser *sm6)
static bool sm6_metadata_value_is_zero_or_undef(const struct sm6_metadata_value *m)
static const struct sm6_value * sm6_parser_get_value_by_ref(struct sm6_parser *sm6, const struct dxil_record *record, const struct sm6_type *type, unsigned int *rec_idx)
dxil_element_additional_tag
@ ADDITIONAL_TAG_USED_MASK
@ ADDITIONAL_TAG_RELADDR_MASK
@ ADDITIONAL_TAG_GLOBAL_SYMBOL
@ ADDITIONAL_TAG_STREAM_INDEX
static enum vkd3d_shader_opcode dx_map_quad_op(enum dxil_quad_op_kind op)
static void sm6_parser_emit_br(struct sm6_parser *sm6, const struct dxil_record *record, struct sm6_function *function, struct sm6_block *code_block, struct vkd3d_shader_instruction *ins)
static void sm6_parser_emit_alloca(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
static void sm6_parser_emit_dx_discard(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_shader_component_type vkd3d_component_type_from_dxil_component_type(enum dxil_component_type type)
static bool sm6_value_vector_is_constant_or_undef(const struct sm6_value **values, unsigned int count)
static void sm6_block_destroy(struct sm6_block *block)
static unsigned int sm6_value_get_texel_offset(const struct sm6_value *value)
static void sm6_block_emit_terminator(const struct sm6_block *block, struct sm6_parser *sm6)
static void init_resource_declaration(struct vkd3d_shader_resource *resource, enum vkd3d_shader_register_type reg_type, enum vkd3d_data_type data_type, unsigned int id, const struct vkd3d_shader_register_range *range)
static bool sm6_type_is_void(const struct sm6_type *type)
static void sm6_parser_emit_dx_texture_store(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_shader_opcode map_dx_binary_op(enum dx_intrinsic_opcode op, const struct sm6_type *type)
static void sm6_parser_emit_dx_compute_builtin(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_result sm6_function_emit_blocks(const struct sm6_function *function, struct sm6_parser *sm6)
#define VKD3D_SM6_VERSION_MINOR(version)
static enum vkd3d_result sm6_parser_resources_load_cbv(struct sm6_parser *sm6, const struct sm6_metadata_node *node, struct sm6_descriptor_info *d, struct vkd3d_shader_instruction *ins)
static enum vkd3d_result value_allocate_constant_array(struct sm6_value *dst, const struct sm6_type *type, const uint64_t *operands, struct sm6_parser *sm6)
static const size_t MAX_IR_INSTRUCTIONS_PER_DXIL_INSTRUCTION
@ INPUT_PRIMITIVE_TRIANGLEWITHADJACENY
@ INPUT_PRIMITIVE_LINEWITHADJACENCY
@ INPUT_PRIMITIVE_TRIANGLE
@ INPUT_PRIMITIVE_UNDEFINED
@ INPUT_PRIMITIVE_PATCH32
static void sm6_parser_emit_dx_load_input(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_shader_opcode sm6_dx_map_wave_op(enum dxil_wave_op_kind op, bool is_signed, bool is_float, struct sm6_parser *sm6)
static void sm6_parser_emit_dx_quad_op(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_result sm6_parser_resources_load_srv(struct sm6_parser *sm6, const struct sm6_metadata_node *node, struct sm6_descriptor_info *d, struct vkd3d_shader_instruction *ins)
static const struct sm6_type * sm6_parser_get_type(struct sm6_parser *sm6, uint64_t type_id)
static void sm6_parser_declare_tgsm_raw(struct sm6_parser *sm6, const struct sm6_type *elem_type, unsigned int alignment, unsigned int init, struct sm6_value *dst)
static void sm6_parser_emit_dx_wave_builtin(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_data_type vkd3d_data_type_from_dxil_component_type(enum dxil_component_type type, struct sm6_parser *sm6)
static bool sm6_value_is_undef(const struct sm6_value *value)
static const struct sm6_descriptor_info * sm6_parser_get_descriptor(struct sm6_parser *sm6, enum vkd3d_shader_descriptor_type type, unsigned int id, const struct sm6_value *address)
static void dxil_block_destroy(struct dxil_block *block)
static void dst_param_io_init(struct vkd3d_shader_dst_param *param, const struct signature_element *e, enum vkd3d_shader_register_type reg_type)
static uint64_t register_get_uint64_value(const struct vkd3d_shader_register *reg)
static void sm6_parser_emit_vselect(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
static void sm6_parser_emit_cmp2(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
static enum vkd3d_shader_opcode sm6_dx_map_ma_op(enum dx_intrinsic_opcode op, const struct sm6_type *type)
static enum vkd3d_data_type vkd3d_data_type_from_sm6_type(const struct sm6_type *type)
static bool sm6_value_is_numeric_array(const struct sm6_value *value)
static void sm6_parser_emit_dcl_count(struct sm6_parser *sm6, enum vkd3d_shader_opcode handler_idx, unsigned int count)
static bool instruction_dst_param_init_ssa_scalar(struct vkd3d_shader_instruction *ins, struct sm6_parser *sm6)
static bool sm6_parser_declare_global(struct sm6_parser *sm6, const struct dxil_record *record)
static bool instruction_dst_param_init_temp_vector(struct vkd3d_shader_instruction *ins, struct sm6_parser *sm6)
static bool sm6_value_validate_is_pointer_to_i32(const struct sm6_value *value, struct sm6_parser *sm6)
static struct vkd3d_shader_instruction * sm6_parser_add_instruction(struct sm6_parser *sm6, enum vkd3d_shader_opcode handler_idx)
static void sm6_parser_init_patch_constant_signature(struct sm6_parser *sm6, const struct shader_signature *patch_constant_signature)
static void sm6_parser_emit_dx_saturate(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_result sm6_parser_constants_init(struct sm6_parser *sm6, const struct dxil_block *block)
static const struct sm6_metadata_value * sm6_parser_find_metadata_kind(const struct sm6_parser *sm6, uint64_t id)
static void sm6_parser_emit_dx_ma(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static size_t sm6_parser_get_value_idx_by_ref(struct sm6_parser *sm6, const struct dxil_record *record, const struct sm6_type *fwd_type, unsigned int *rec_idx)
static void sm6_parser_emit_dx_texture_load(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static void sm6_parser_emit_cmpxchg(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
sm6_block_terminator_type
static struct sm6_function * sm6_parser_get_function(const struct sm6_parser *sm6, const char *name)
static bool sm6_value_validate_is_bool(const struct sm6_value *value, struct sm6_parser *sm6)
static void instruction_init_with_resource(struct vkd3d_shader_instruction *ins, enum vkd3d_shader_opcode handler_idx, const struct sm6_value *resource, struct sm6_parser *sm6)
static enum vkd3d_shader_opcode sm6_dx_map_void_op(enum dx_intrinsic_opcode op)
static enum vkd3d_result sm6_parser_descriptor_type_init(struct sm6_parser *sm6, enum vkd3d_shader_descriptor_type type, const struct sm6_metadata_node *descriptor_node)
static enum vkd3d_tessellator_domain sm6_parser_hs_properties_init(struct sm6_parser *sm6, const struct sm6_metadata_value *m)
static void sm6_parser_emit_extractval(struct sm6_parser *sm6, const struct dxil_record *record, struct vkd3d_shader_instruction *ins, struct sm6_value *dst)
bitcode_value_symtab_code
static bool sm6_value_is_icb(const struct sm6_value *value)
static void src_param_init(struct vkd3d_shader_src_param *param)
static void sm6_parser_emit_dx_sample(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static bool sm6_value_validate_is_texture_handle(const struct sm6_value *value, enum dx_intrinsic_opcode op, struct sm6_parser *sm6)
#define DXIL_OP_MAX_OPERANDS
static bool sm6_value_validate_is_register(const struct sm6_value *value, struct sm6_parser *sm6)
static bool sm6_parser_read_literal_operand(struct sm6_parser *sm6, uint64_t context, uint64_t *op)
@ SYNC_GROUP_SHARED_MEMORY
@ COMPONENT_TYPE_PACKEDS8X32
@ COMPONENT_TYPE_UNORMF16
@ COMPONENT_TYPE_PACKEDU8X32
@ COMPONENT_TYPE_SNORMF16
@ COMPONENT_TYPE_UNORMF64
@ COMPONENT_TYPE_UNORMF32
@ COMPONENT_TYPE_SNORMF64
@ COMPONENT_TYPE_SNORMF32
static void sm6_parser_init_signature(struct sm6_parser *sm6, const struct shader_signature *s, bool is_input, enum vkd3d_shader_register_type reg_type, struct vkd3d_shader_dst_param *params)
static struct vkd3d_shader_dst_param * instruction_dst_params_alloc(struct vkd3d_shader_instruction *ins, unsigned int count, struct sm6_parser *sm6)
static const unsigned int MAX_GS_OUTPUT_TOTAL_SCALARS
static void src_param_init_vector(struct vkd3d_shader_src_param *param, unsigned int component_count)
dxil_possibly_exact_binop_flags
static void sm6_parser_emit_dx_raw_buffer_store(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static const struct sm6_cmp_info * sm6_map_cmp2_op(uint64_t code)
#define VKD3D_SHADER_SWIZZLE_64_MASK
static void sm6_parser_emit_dx_atomic_binop(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
static enum vkd3d_shader_opcode map_dx_atomicrmw_op(uint64_t code)
static enum vkd3d_result sm6_parser_read_unabbrev_record(struct sm6_parser *sm6)
static void sm6_parser_emit_label(struct sm6_parser *sm6, unsigned int label_id)
static bool sm6_value_validate_is_sampler_handle(const struct sm6_value *value, enum dx_intrinsic_opcode op, struct sm6_parser *sm6)
static void sm6_parser_emit_dcl_tessellator_domain(struct sm6_parser *sm6, enum vkd3d_tessellator_domain tessellator_domain)
static bool sm6_type_is_array(const struct sm6_type *type)
static int phi_incoming_compare(const void *a, const void *b)
static void src_params_init_from_operands(struct vkd3d_shader_src_param *src_params, const struct sm6_value **operands, unsigned int count)
static bool sm6_value_is_handle(const struct sm6_value *value)
static bool sm6_type_is_i32(const struct sm6_type *type)
static void dst_param_init_scalar(struct vkd3d_shader_dst_param *param, unsigned int component_idx)
static unsigned int sm6_parser_alloc_ssa_id(struct sm6_parser *sm6)
static struct sm6_phi * sm6_block_phi_require_space(struct sm6_block *block, struct sm6_parser *sm6)
static enum vkd3d_result sm6_parser_resources_init(struct sm6_parser *sm6)
static bool sm6_function_blocks_reserve(struct sm6_function *function, unsigned int reserve)
static bool sm6_type_is_i16_i32_i64(const struct sm6_type *type)
static void sm6_parser_emit_dx_buffer_update_counter(struct sm6_parser *sm6, enum dx_intrinsic_opcode op, const struct sm6_value **operands, struct function_emission_state *state)
Character const *const size_t const max_count
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei width
GLsizei const GLvoid * pointer
GLboolean GLboolean GLboolean b
GLenum const GLfloat * params
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
GLboolean GLenum GLenum GLvoid * values
GLuint GLsizei GLsizei * length
GLboolean GLboolean GLboolean GLboolean a
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
enum wined3d_data_type data_type
bool vsir_program_init(struct vsir_program *program, const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_version *version, unsigned int reserve, enum vsir_control_flow_type cf_type, enum vsir_normalisation_level normalisation_level)
struct vkd3d_shader_src_param * vsir_program_create_outpointid_param(struct vsir_program *program)
void vsir_src_param_init_label(struct vkd3d_shader_src_param *param, unsigned int label_id)
void vsir_program_cleanup(struct vsir_program *program)
void vsir_register_init(struct vkd3d_shader_register *reg, enum vkd3d_shader_register_type reg_type, enum vkd3d_data_type data_type, unsigned int idx_count)
bool vsir_signature_find_sysval(const struct shader_signature *signature, enum vkd3d_shader_sysval_semantic sysval, unsigned int semantic_index, unsigned int *element_index)
void vsir_src_param_init(struct vkd3d_shader_src_param *param, enum vkd3d_shader_register_type reg_type, enum vkd3d_data_type data_type, unsigned int idx_count)
void vsir_dst_param_init(struct vkd3d_shader_dst_param *param, enum vkd3d_shader_register_type reg_type, enum vkd3d_data_type data_type, unsigned int idx_count)
void vsir_instruction_init(struct vkd3d_shader_instruction *ins, const struct vkd3d_shader_location *location, enum vkd3d_shader_opcode opcode)
static BOOL is_undefined(jsval_t v)
static BOOL is_bool(jsval_t v)
#define memcpy(s1, s2, n)
#define cmp(status, error)
static BOOL is_float(parse_buffer *buf)
for(i=0;i< sizeof(testsuite)/sizeof(testsuite[0]);++i) ok(call_test(testsuite[i].func)
#define offsetof(TYPE, MEMBER)
enum vkd3d_shader_register_type reg_type
wchar_t const *const size_t const buffer_size
enum code_block_type type
const uint32_t * byte_code
struct shader_signature input_signature
struct shader_signature patch_constant_signature
struct shader_signature output_signature
bool(* read_operand)(struct sm6_parser *sm6, uint64_t context, uint64_t *operand)
struct dxil_abbrev_operand operands[]
struct dxil_block ** child_blocks
struct dxil_abbrev ** abbrevs
size_t child_block_capacity
struct dxil_record ** records
unsigned int blockinfo_bid
const struct dxil_block * parent
struct dxil_abbrev abbrev
const struct dxil_record * attachment
unsigned int operand_count
struct sm6_block * code_block
struct vkd3d_shader_instruction * ins
struct vkd3d_shader_register reg
const struct sm6_block * block
enum vkd3d_data_type data_type
unsigned int element_count
const char * semantic_name
const struct sm6_type * elem_type
const struct sm6_block * true_block
enum sm6_block_terminator_type type
struct vkd3d_shader_register conditional_reg
struct terminator_case * cases
const struct sm6_block * false_block
size_t instruction_capacity
struct vkd3d_shader_instruction * instructions
struct sm6_block_terminator terminator
enum vkd3d_shader_opcode handler_idx
enum vkd3d_shader_register_type reg_type
enum vkd3d_data_type reg_data_type
enum dxil_resource_kind kind
enum vkd3d_data_type resource_data_type
enum vkd3d_shader_resource_type resource_type
enum vkd3d_shader_descriptor_type type
void(* handler)(struct sm6_parser *, enum dx_intrinsic_opcode, const struct sm6_value **, struct function_emission_state *)
const char * operand_info
const struct sm6_type * param_types[]
const struct sm6_type * ret_type
const struct sm6_value * declaration
struct sm6_block ** blocks
struct vkd3d_shader_register reg
const struct sm6_descriptor_info * d
struct dxil_block * current_block
struct sm6_type * metadata_type
const char * patch_constant_function
struct dxil_block root_block
struct sm6_function * functions
size_t global_symbol_count
unsigned int indexable_temp_count
struct sm6_descriptor_info * descriptors
struct sm6_named_metadata * named_metadata
struct sm6_value * values
struct vkd3d_shader_parser p
struct vkd3d_shader_dst_param * patch_constant_params
struct vkd3d_shader_dst_param * input_params
struct sm6_symbol * global_symbols
struct sm6_metadata_table metadata_tables[VKD3D_SM6_MAX_METADATA_TABLES]
uint32_t io_regs_declared[VKD3D_BITMAP_SIZE(VKD3DSPR_COUNT)]
struct vkd3d_shader_dst_param * output_params
size_t descriptor_capacity
struct sm6_type * handle_type
struct dxil_global_abbrev ** abbrevs
unsigned int named_metadata_count
struct sm6_type * bool_type
struct vkd3d_shader_register reg
struct incoming_value * incoming
enum bitcode_address_space addr_space
const struct sm6_type * type
const struct sm6_type * elem_types[]
struct sm6_struct_info * struc
struct sm6_function_info * function
enum sm6_type_class class
struct sm6_array_info array
struct sm6_pointer_info pointer
struct sm6_function_data function
struct vkd3d_shader_register reg
const struct sm6_type * type
enum sm6_value_type value_type
const struct vkd3d_shader_immediate_constant_buffer * icb
unsigned int structure_stride
const struct sm6_block * block
struct vkd3d_shader_code source
struct vkd3d_shader_register reg
struct vkd3d_shader_instruction * elements
struct vkd3d_shader_src_param * src
struct vkd3d_shader_sampler sampler
enum vsir_global_flags global_flags
struct vkd3d_shader_constant_buffer cb
struct vsir_thread_group_size thread_group_size
const struct vkd3d_shader_immediate_constant_buffer * icb
enum vkd3d_shader_tessellator_partitioning tessellator_partitioning
struct vkd3d_shader_texel_offset texel_offset
struct vkd3d_shader_tgsm_raw tgsm_raw
struct vkd3d_shader_raw_resource raw_resource
enum vkd3d_shader_tessellator_output_primitive tessellator_output_primitive
enum vkd3d_tessellator_domain tessellator_domain
struct vkd3d_shader_indexable_temp indexable_temp
enum vkd3d_shader_resource_type resource_type
float max_tessellation_factor
union vkd3d_shader_instruction::@6020 declaration
struct vkd3d_shader_tgsm_structured tgsm_structured
enum vkd3d_shader_opcode opcode
enum vkd3d_data_type resource_data_type[VKD3D_VEC4_SIZE]
struct vkd3d_shader_semantic semantic
struct vkd3d_shader_structured_resource structured_resource
struct vkd3d_shader_dst_param * dst
struct vkd3d_shader_primitive_type primitive_type
uint32_t immconst_u32[VKD3D_VEC4_SIZE]
union vkd3d_shader_register::@6019 u
struct vkd3d_shader_register reg
enum vkd3d_shader_src_modifier modifiers
enum vsir_global_flags global_flags
HRESULT to_int(VARIANT *v, int *ret)
static bool vkd3d_bound_range(size_t start, size_t count, size_t limit)
static bool bitmap_is_set(const uint32_t *map, unsigned int idx)
#define vkd3d_unreachable()
#define VKD3D_BITMAP_SIZE(x)
#define VKD3D_ASSERT(cond)
static int vkd3d_u32_compare(uint32_t x, uint32_t y)
static bool vkd3d_object_range_overflow(size_t start, size_t count, size_t size)
static void * vkd3d_calloc(size_t count, size_t size)
static char * vkd3d_strdup(const char *string)
static void * vkd3d_realloc(void *ptr, size_t size)
static void vkd3d_free(void *ptr)
static void * vkd3d_malloc(size_t size)
bool vkd3d_array_reserve(void **elements, size_t *capacity, size_t element_count, size_t element_size)
static uint32_t vkd3d_shader_create_swizzle(enum vkd3d_shader_swizzle_component x, enum vkd3d_shader_swizzle_component y, enum vkd3d_shader_swizzle_component z, enum vkd3d_shader_swizzle_component w)
vkd3d_shader_sysval_semantic
@ VKD3D_SHADER_SV_VERTEX_ID
@ VKD3D_SHADER_SV_DEPTH_LESS_EQUAL
@ VKD3D_SHADER_SV_PRIMITIVE_ID
@ VKD3D_SHADER_SV_COVERAGE
@ VKD3D_SHADER_SV_CULL_DISTANCE
@ VKD3D_SHADER_SV_TESS_FACTOR_TRIEDGE
@ VKD3D_SHADER_SV_TESS_FACTOR_LINEDET
@ VKD3D_SHADER_SV_TESS_FACTOR_QUADEDGE
@ VKD3D_SHADER_SV_IS_FRONT_FACE
@ VKD3D_SHADER_SV_TESS_FACTOR_QUADINT
@ VKD3D_SHADER_SV_TESS_FACTOR_TRIINT
@ VKD3D_SHADER_SV_TESS_FACTOR_LINEDEN
@ VKD3D_SHADER_SV_DEPTH_GREATER_EQUAL
@ VKD3D_SHADER_SV_INSTANCE_ID
@ VKD3D_SHADER_SV_CLIP_DISTANCE
@ VKD3D_SHADER_SV_SAMPLE_INDEX
@ VKD3D_SHADER_SV_POSITION
vkd3d_shader_tessellator_output_primitive
@ VKD3D_SHADER_TESSELLATOR_OUTPUT_TRIANGLE_CCW
vkd3d_shader_component_type
@ VKD3D_SHADER_COMPONENT_INT
@ VKD3D_SHADER_COMPONENT_UINT
@ VKD3D_SHADER_COMPONENT_DOUBLE
@ VKD3D_SHADER_COMPONENT_FLOAT
@ VKD3D_SHADER_COMPONENT_BOOL
vkd3d_shader_descriptor_type
@ VKD3D_SHADER_DESCRIPTOR_TYPE_UAV
@ VKD3D_SHADER_DESCRIPTOR_TYPE_CBV
@ VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER
@ VKD3D_SHADER_DESCRIPTOR_TYPE_SRV
vkd3d_shader_resource_type
@ VKD3D_SHADER_RESOURCE_NONE
@ VKD3D_SHADER_RESOURCE_TEXTURE_2DMS
@ VKD3D_SHADER_RESOURCE_BUFFER
@ VKD3D_SHADER_RESOURCE_TEXTURE_2DMSARRAY
vkd3d_shader_tessellator_partitioning
@ VKD3D_SHADER_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN
#define VKD3D_SHADER_SWIZZLE_SHIFT(idx)
vkd3d_shader_minimum_precision
@ VKD3D_SHADER_MINIMUM_PRECISION_UINT_16
@ VKD3D_SHADER_MINIMUM_PRECISION_NONE
@ VKD3D_SHADER_MINIMUM_PRECISION_FLOAT_16
@ VKD3D_SHADER_MINIMUM_PRECISION_INT_16
#define VKD3D_SHADER_SWIZZLE(x, y, z, w)
#define VKD3D_SHADER_NO_SWIZZLE
bool shader_instruction_array_add_icb(struct vkd3d_shader_instruction_array *instructions, struct vkd3d_shader_immediate_constant_buffer *icb)
void vkd3d_shader_warning(struct vkd3d_shader_message_context *context, const struct vkd3d_shader_location *location, enum vkd3d_shader_error error, const char *format,...)
void shader_signature_cleanup(struct shader_signature *signature)
void vkd3d_shader_parser_init(struct vkd3d_shader_parser *parser, struct vsir_program *program, struct vkd3d_shader_message_context *message_context, const char *source_name)
bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve)
#define VKD3DSI_PRECISE_XYZW
static uint32_t vsir_swizzle_64_from_32(uint32_t swizzle32)
@ VKD3DSGF_SKIP_OPTIMIZATION
static bool data_type_is_64_bit(enum vkd3d_data_type data_type)
#define VKD3D_DXBC_CHUNK_ALIGNMENT
#define VKD3DSI_PRECISE_X
@ VKD3D_SHADER_TYPE_GEOMETRY
@ VKD3D_SHADER_TYPE_COMPUTE
@ VKD3D_SHADER_TYPE_COUNT
@ VKD3D_SHADER_TYPE_DOMAIN
static struct vkd3d_shader_dst_param * vsir_program_get_dst_params(struct vsir_program *program, unsigned int count)
#define VKD3DSP_WRITEMASK_3
static unsigned int vsir_write_mask_component_count(uint32_t write_mask)
vkd3d_shader_register_type
@ VKD3DSPR_GROUPSHAREDMEM
@ VKD3DSPR_LOCALTHREADINDEX
@ VKD3DSPR_IMMCONSTBUFFER
@ VKD3DSUF_GLOBALLY_COHERENT
@ VKD3DSUF_RASTERISER_ORDERED_VIEW
@ VKD3DSUF_ORDER_PRESERVING_COUNTER
#define VKD3DSI_SAMPLER_COMPARISON_MODE
static bool data_type_is_floating_point(enum vkd3d_data_type data_type)
#define VKD3DSI_WAVE_PREFIX
@ VKD3D_SHADER_ERROR_DXIL_INVALID_VALUE_SYMTAB
@ VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND
@ VKD3D_SHADER_WARNING_DXIL_IGNORING_ATTACHMENT
@ VKD3D_SHADER_ERROR_DXIL_INVALID_ENTRY_POINT
@ VKD3D_SHADER_ERROR_DXIL_INVALID_BITCODE
@ VKD3D_SHADER_WARNING_DXIL_INVALID_OPERATION
@ VKD3D_SHADER_WARNING_DXIL_TYPE_MISMATCH
@ VKD3D_SHADER_WARNING_DXIL_INVALID_MASK
@ VKD3D_SHADER_WARNING_DXIL_UNDEFINED_OPERAND
@ VKD3D_SHADER_ERROR_DXIL_INVALID_CHUNK_SIZE
@ VKD3D_SHADER_ERROR_DXIL_INVALID_RESOURCE_HANDLE
@ VKD3D_SHADER_ERROR_DXIL_INVALID_CHUNK_OFFSET
@ VKD3D_SHADER_ERROR_DXIL_UNHANDLED_INTRINSIC
@ VKD3D_SHADER_WARNING_DXIL_ENTRY_POINT_MISMATCH
@ VKD3D_SHADER_ERROR_DXIL_INVALID_FUNCTION_DCL
@ VKD3D_SHADER_WARNING_DXIL_UNKNOWN_SHADER_TYPE
@ VKD3D_SHADER_ERROR_DXIL_INVALID_RESOURCES
@ VKD3D_SHADER_ERROR_DXIL_INVALID_MODULE
@ VKD3D_SHADER_WARNING_DXIL_INVALID_MODULE_LENGTH
@ VKD3D_SHADER_WARNING_DXIL_INVALID_BLOCK_LENGTH
@ VKD3D_SHADER_ERROR_DXIL_INVALID_PROPERTIES
@ VKD3D_SHADER_ERROR_DXIL_INVALID_OPERAND_COUNT
@ VKD3D_SHADER_ERROR_DXIL_INVALID_TYPE_TABLE
@ VKD3D_SHADER_WARNING_DXIL_IGNORING_OPERANDS
@ VKD3D_SHADER_ERROR_DXIL_INVALID_TYPE_ID
@ VKD3D_SHADER_ERROR_DXIL_INVALID_SIZE
@ VKD3D_SHADER_ERROR_DXIL_INVALID_METADATA
@ VKD3D_SHADER_ERROR_DXIL_OUT_OF_MEMORY
@ VKD3D_SHADER_ERROR_DXIL_UNSUPPORTED_BITCODE_FORMAT
@ VKD3D_SHADER_ERROR_DXIL_INVALID_SIGNATURE
@ VKD3D_SHADER_WARNING_DXIL_UNKNOWN_MAGIC_NUMBER
static unsigned int vkd3d_write_mask_from_component_count(unsigned int component_count)
#define VKD3DSP_WRITEMASK_ALL
@ VSIR_FULLY_NORMALISED_IO
static struct vkd3d_shader_src_param * vsir_program_get_src_params(struct vsir_program *program, unsigned int count)
static bool data_type_is_integer(enum vkd3d_data_type data_type)
static unsigned int vsir_write_mask_get_component_idx(uint32_t write_mask)
@ VKD3DSIH_DCL_IMMEDIATE_CONSTANT_BUFFER
@ VKD3DSIH_QUAD_READ_LANE_AT
@ VKD3DSIH_IMM_ATOMIC_UMAX
@ VKD3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE
@ VKD3DSIH_WAVE_READ_LANE_AT
@ VKD3DSIH_WAVE_PREFIX_BIT_COUNT
@ VKD3DSIH_WAVE_ACTIVE_ALL_EQUAL
@ VKD3DSIH_IMM_ATOMIC_XOR
@ VKD3DSIH_DCL_INPUT_PRIMITIVE
@ VKD3DSIH_STORE_UAV_TYPED
@ VKD3DSIH_WAVE_IS_FIRST_LANE
@ VKD3DSIH_WAVE_ACTIVE_BIT_OR
@ VKD3DSIH_DCL_GS_INSTANCES
@ VKD3DSIH_QUAD_READ_ACROSS_X
@ VKD3DSIH_QUAD_READ_ACROSS_D
@ VKD3DSIH_DCL_RESOURCE_RAW
@ VKD3DSIH_DCL_VERTICES_OUT
@ VKD3DSIH_DCL_OUTPUT_TOPOLOGY
@ VKD3DSIH_IMM_ATOMIC_CONSUME
@ VKD3DSIH_DCL_GLOBAL_FLAGS
@ VKD3DSIH_DCL_HS_MAX_TESSFACTOR
@ VKD3DSIH_DCL_UAV_STRUCTURED
@ VKD3DSIH_HS_CONTROL_POINT_PHASE
@ VKD3DSIH_IMM_ATOMIC_IADD
@ VKD3DSIH_IMM_ATOMIC_EXCH
@ VKD3DSIH_DCL_THREAD_GROUP
@ VKD3DSIH_WAVE_ACTIVE_BIT_XOR
@ VKD3DSIH_IMM_ATOMIC_IMIN
@ VKD3DSIH_QUAD_READ_ACROSS_Y
@ VKD3DSIH_WAVE_ACTIVE_BIT_AND
@ VKD3DSIH_IMM_ATOMIC_IMAX
@ VKD3DSIH_IMM_ATOMIC_ALLOC
@ VKD3DSIH_IMM_ATOMIC_AND
@ VKD3DSIH_WAVE_ACTIVE_BALLOT
@ VKD3DSIH_DCL_TGSM_STRUCTURED
@ VKD3DSIH_DCL_RESOURCE_STRUCTURED
@ VKD3DSIH_WAVE_READ_LANE_FIRST
@ VKD3DSIH_SWITCH_MONOLITHIC
@ VKD3DSIH_DCL_TESSELLATOR_DOMAIN
@ VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT
@ VKD3DSIH_STORE_STRUCTURED
@ VKD3DSIH_IMM_ATOMIC_UMIN
@ VKD3DSIH_DCL_CONSTANT_BUFFER
@ VKD3DSIH_DCL_INDEXABLE_TEMP
@ VKD3DSIH_IMM_ATOMIC_CMP_EXCH
@ VKD3DSIH_WAVE_ALL_BIT_COUNT
@ VKD3DSIH_DCL_TESSELLATOR_PARTITIONING
#define VKD3DSI_RESINFO_UINT
@ VKD3DSSF_GROUP_SHARED_MEMORY
static bool data_type_is_bool(enum vkd3d_data_type data_type)
#define VKD3DSI_SAMPLE_INFO_UINT
static bool register_is_scalar_constant_zero(const struct vkd3d_shader_register *reg)
@ VKD3D_TESSELLATOR_DOMAIN_INVALID
@ VKD3D_TESSELLATOR_DOMAIN_COUNT
@ VKD3D_TESSELLATOR_DOMAIN_TRIANGLE
@ VKD3D_TESSELLATOR_DOMAIN_LINE
@ VKD3D_TESSELLATOR_DOMAIN_QUAD
static bool register_is_ssa(const struct vkd3d_shader_register *reg)
static enum vkd3d_data_type vkd3d_data_type_from_component_type(enum vkd3d_shader_component_type component_type)
static bool register_is_constant(const struct vkd3d_shader_register *reg)
static bool vsir_sysval_semantic_is_tess_factor(enum vkd3d_shader_sysval_semantic sysval_semantic)
@ VKD3D_PT_TRIANGLELIST_ADJ
void vkd3d_shader_parser_error(struct vkd3d_shader_parser *parser, enum vkd3d_shader_error error, const char *format,...) VKD3D_PRINTF_FUNC(3
void vkd3d_shader_parser_warning(struct vkd3d_shader_parser *parser, enum vkd3d_shader_error error, const char *format,...) VKD3D_PRINTF_FUNC(3
#define VKD3DSP_WRITEMASK_0
static bool register_is_numeric_array(const struct vkd3d_shader_register *reg)
#define VKD3DSI_SHIFT_UNMASKED
@ VKD3D_ERROR_INVALID_SHADER
@ VKD3D_ERROR_OUT_OF_MEMORY
static GLenum _GLUfuncptr fn
static size_t align(size_t addr, size_t alignment)
static unsigned int block