38 *ret_parameters =
NULL;
53 dst->data_type =
src->data_type;
57 dst->u.immediate_constant.u.u32 =
src->u.immediate_constant.u.u32;
61 dst->u.specialization_constant =
src->u.specialization_constant;
65 ERR(
"Invalid parameter type %#x.\n",
src->type);
95 program->free_parameters =
true;
101 program->normalisation_level = normalisation_level;
111 for (
i = 0;
i <
program->block_name_count; ++
i)
123 for (
unsigned int i = 0;
i <
program->parameter_count; ++
i)
135 for (
unsigned int i = 0;
i <
signature->element_count; ++
i)
169 reg->non_uniform =
false;
171 reg->idx[0].offset = ~0
u;
173 reg->idx[0].is_in_bounds =
false;
174 reg->idx[1].offset = ~0
u;
176 reg->idx[1].is_in_bounds =
false;
177 reg->idx[2].offset = ~0
u;
179 reg->idx[2].is_in_bounds =
false;
180 reg->idx_count = idx_count;
208 param->reg.idx[0].offset = label_id;
214 src->reg.idx[0].offset =
idx;
220 src->reg.idx[0].offset =
id;
221 src->reg.idx[1].offset =
idx;
229 src->reg.idx[0].offset =
id;
230 src->reg.idx[1].offset =
idx;
237 src->reg.idx[0].offset =
idx;
243 src->reg.idx[0].offset =
idx;
249 src->reg.idx[0].offset =
idx;
255 src->reg.idx[0].offset =
idx;
263 src->reg.idx[0].offset =
idx;
269 src->reg.idx[0].offset =
idx;
284 dst->reg.idx[0].offset =
idx;
290 dst->reg.idx[0].offset =
idx;
296 dst->reg.idx[0].offset =
idx;
302 dst->reg.idx[0].offset =
idx;
309 dst->reg.idx[0].offset =
idx;
316 dst->reg.idx[0].offset =
idx;
318 dst->write_mask = write_mask;
324 memset(ins, 0,
sizeof(*ins));
339 ERR(
"Failed to allocate %u destination parameters.\n", dst_count);
345 ERR(
"Failed to allocate %u source parameters.\n", src_count);
365 ins->
src = src_param;
411 *requires_swap =
false;
420 *requires_swap =
false;
445 *tmp_idx =
program->temp_count++;
451 "Aborting due to not yet implemented feature: opcode for rel_op %u and data type %u.",
452 ifc->
flags, ifc->
src[0].reg.data_type);
462 ins->
dst[0].reg.idx[0].offset = *tmp_idx;
476 ins->
src[0].reg.idx[0].offset = *tmp_idx;
488 const unsigned int components_read = 3 + (
program->shader_version.major >= 2);
498 *tmp_idx =
program->temp_count++;
508 ins->
dst[0].reg.idx[0].offset = *tmp_idx;
511 ins->
src[0].reg = texkill->
dst[0].reg;
515 ins->
src[1].reg.u.immconst_f32[0] = 0.0f;
516 ins->
src[1].reg.u.immconst_f32[1] = 0.0f;
517 ins->
src[1].reg.u.immconst_f32[2] = 0.0f;
518 ins->
src[1].reg.u.immconst_f32[3] = 0.0f;
524 for (
j = 1;
j < components_read; ++
j)
532 ins->
dst[0].reg.idx[0].offset = *tmp_idx;
537 ins->
src[0].reg.idx[0].offset = *tmp_idx;
541 ins->
src[1].reg.idx[0].offset = *tmp_idx;
547 ins = &instructions->
elements[
pos + 1 + components_read];
554 ins->
src[0].reg.idx[0].offset = *tmp_idx;
584 *tmp_idx =
program->temp_count++;
597 mul_dst = mul_ins->
dst;
598 *add_ins->
dst = *mul_dst;
602 mul_dst->
reg.dimension = add_ins->
dst->reg.dimension;
603 mul_dst->
reg.idx[0].offset = *tmp_idx;
605 add_ins->
src[0].reg = mul_dst->
reg;
607 add_ins->
src[0].modifiers = 0;
608 add_ins->
src[1] = mul_ins->
src[2];
621 if (
sincos->dst_count != 1)
667 unsigned int idx = tex->
src[1].reg.idx[0].offset;
676 srcs[0] = tex->
src[0];
690 unsigned int idx = texldd->
src[1].reg.idx[0].offset;
699 srcs[0] = texldd->
src[0];
702 srcs[3] = texldd->
src[2];
703 srcs[4] = texldd->
src[3];
717 unsigned int tmp_idx = ~0
u,
i;
720 for (
i = 0;
i < instructions->
count; ++
i)
784 "Aborting due to unimplemented feature: Combined sampler instruction %#x.",
797 unsigned int instance_id)
801 for (
i = 0;
i <
reg->idx_count; ++
i)
806 reg->idx[
i].offset += instance_id;
812 unsigned int instance_id)
823 reg->u.immconst_u32[0] = instance_id;
840 if (
program->instructions.count
861 program->diffuse_written_mask =
e->mask;
876 e->register_count = 1;
902 for (
i = 0;
i <
program->instructions.count; ++
i)
904 ins = &
program->instructions.elements[
i];
912 ins = &
program->instructions.elements[
i];
915 ins->
dst[0].reg.idx[0].offset = 0;
920 for (
i = 0;
i < 4; ++
i)
921 ins->
src[0].reg.u.immconst_f32[
i] = 1.0f;
932 if (varying_map->
varying_map[
i].output_signature_index == signature_idx)
944 switch (
info->target_type)
975 switch (
dst->reg.type)
996 dst->write_mask &=
e->mask;
998 if (!
dst->write_mask)
1015 unsigned int orig_element_count =
signature->element_count;
1018 unsigned int uninit_varying_count = 0;
1019 unsigned int subset_varying_count = 0;
1020 unsigned int new_register_count = 0;
1035 e->target_location =
map->input_register_index;
1039 ++subset_varying_count;
1040 if (!allows_subset_masks)
1049 "Aborting due to not yet implemented feature: "
1050 "Input mask %#x reads components not written in output mask %#x.",
1060 new_register_count =
max(new_register_count,
e->register_index + 1);
1084 ++uninit_varying_count;
1096 if (
map->output_signature_index < orig_element_count)
1099 TRACE(
"Synthesizing zero value for uninitialized output %u (mask %u).\n",
1100 map->input_register_index,
map->input_mask);
1105 e->register_count = 1;
1106 e->mask =
map->input_mask;
1107 e->used_mask =
map->input_mask;
1108 e->register_index = new_register_count++;
1109 e->target_location =
map->input_register_index;
1114 for (
i = 0;
i <
program->instructions.count; ++
i)
1126 ins = &
program->instructions.elements[
i];
1139 i += uninit_varying_count;
1147 if (!subset_varying_count || allows_subset_masks)
1150 for (
i = 0;
i <
program->instructions.count; ++
i)
1235 FIXME(
"Insufficient space for phase location.\n");
1364 reg->idx[1] =
reg->idx[0];
1366 reg->idx[0].offset = 0;
1375 param->write_mask =
e->mask;
1376 param->modifiers = 0;
1390 for (
i = 0,
count = 1;
i <
s->element_count; ++
i)
1391 count += !!
s->elements[
i].used_mask;
1405 for (
i = 0;
i <
s->element_count; ++
i)
1407 e = &
s->elements[
i];
1424 param->reg.idx[0].offset = input_control_point_count;
1425 param->reg.idx[1].offset =
e->register_index;
1426 param->write_mask =
e->mask;
1439 unsigned int input_control_point_count;
1455 ERR(
"Failed to allocate src param.\n");
1483 input_control_point_count = 1;
1485 for (
i = 0;
i < instructions->
count; ++
i)
1503 input_control_point_count,
i, &
location);
1554 unsigned int reg_idx,
unsigned int write_mask,
unsigned int *element_idx)
1562 if (
e->register_index <= reg_idx &&
e->register_count > reg_idx -
e->register_index
1563 && (
e->mask & write_mask) == write_mask)
1574 unsigned int reg_idx,
unsigned int write_mask)
1576 unsigned int element_idx;
1579 return &
signature->elements[element_idx];
1585 unsigned int register_idx,
uint32_t write_mask)
1601 if (range_map[register_idx][component_idx] >
register_count && is_dcl_indexrange)
1617 r = register_idx +
i;
1620 c = component_idx +
j;
1638 unsigned int reg_idx, write_mask;
1668 reg_idx =
reg->idx[
reg->idx_count - 1].offset;
1669 write_mask =
range->dst.write_mask;
1688 return e->sysval_semantic ==
f->sysval_semantic
1708 e = &
s->elements[
i];
1711 if (!
e->sysval_semantic)
1716 f = &
s->elements[
j];
1778 merged_write_mask |=
e[
i].
mask;
1780 if (merged_write_mask ==
e->mask)
1781 return merged_write_mask;
1792 for (
j = 0;
j < component_idx; ++
j)
1793 if (range_map[
i][
j])
1796 if (range_map[
i][
j])
1802 WARN(
"Expanding mask %#x to %#x for %s, base reg %u, count %u.\n",
e->mask, merged_write_mask,
1804 return merged_write_mask;
1807 WARN(
"Cannot expand mask %#x to %#x for %s, base reg %u, count %u.\n",
e->mask, merged_write_mask,
1813 bool is_patch_constant)
1835 if (
e->register_index == ~0
u)
1842 used =
e->used_mask;
1850 if (
f->register_index !=
e->register_index ||
f->sysval_semantic !=
e->sysval_semantic
1854 TRACE(
"Merging %s, reg %u, mask %#x, sysval %#x with %s, mask %#x, sysval %#x.\n",
e->semantic_name,
1855 e->register_index,
e->mask,
e->sysval_semantic,
f->semantic_name,
f->mask,
f->sysval_semantic);
1859 e->used_mask |=
f->used_mask;
1860 e->semantic_index =
min(
e->semantic_index,
f->semantic_index);
1864 if (
f->used_mask && !
used)
1866 if (
e->interpolation_mode &&
e->interpolation_mode !=
f->interpolation_mode)
1867 FIXME(
"Mismatching interpolation modes %u and %u.\n",
e->interpolation_mode,
f->interpolation_mode);
1869 e->interpolation_mode =
f->interpolation_mode;
1877 s->elements = elements;
1880 if (is_patch_constant)
1903 f = &elements[
i +
j];
1925 if (
reg->idx[id_idx].rel_addr)
1927 reg->idx[id_idx + 1].rel_addr =
NULL;
1928 reg->idx[id_idx + 1].offset =
reg->idx[id_idx].offset;
1934 reg->idx[id_idx] =
reg->idx[id_idx - 1];
1935 reg->idx[id_idx - 1] = tmp;
1946 reg->idx[0].offset =
reg->idx[id_idx].offset - register_index;
1955 unsigned int id_idx, reg_idx, write_mask, element_idx;
1966 reg_idx =
reg->idx[
reg->idx_count - 1].offset;
1983 reg_idx =
reg->idx[
reg->idx_count - 1].offset;
1989 reg_idx =
reg->idx[0].offset;
1997 reg_idx =
reg->idx[
reg->idx_count - 1].offset;
2020 if (
reg->idx[0].offset > 0)
2028 id_idx =
reg->idx_count - 1;
2038 if (dcl_params[element_idx])
2047 dcl_params[element_idx] = dst_param;
2072 reg->idx[id_idx].offset =
reg->idx[0].offset;
2073 reg->idx[0].offset =
e->register_count;
2083 reg->idx[id_idx].offset = element_idx;
2084 reg->idx_count = id_idx + 1;
2092 unsigned int i, id_idx, reg_idx, write_mask, element_idx, component_idx;
2115 reg_idx =
reg->idx[
reg->idx_count - 1].offset;
2126 reg_idx =
reg->idx[
reg->idx_count - 1].offset;
2134 reg_idx =
reg->idx[
reg->idx_count - 1].offset;
2142 reg_idx =
reg->idx[0].offset;
2150 id_idx =
reg->idx_count - 1;
2158 reg->idx[id_idx].offset = element_idx;
2159 reg->idx_count = id_idx + 1;
2241 for (
i = 0;
i <
program->instructions.count; ++
i)
2243 ins = &
program->instructions.elements[
i];
2318 if (
reg->type == regs[
i].type)
2320 if (
reg->idx[0].rel_addr)
2322 FIXME(
"Unhandled relative address.\n");
2327 *
index = regs[
i].offset +
reg->idx[0].offset;
2350 param->reg.idx_count = 0;
2352 for (
j = 0;
j < 4; ++
j)
2353 param->reg.u.immconst_u32[
j] = normaliser->
defs[
i].value[
j];
2362 param->reg.idx_count = 3;
2371 for (
i = 0;
i <
program->instructions.count; ++
i)
2389 for (
j = 0;
j < 4; ++
j)
2390 def->
value[
j] = ins->
src[0].reg.u.immconst_u32[
j];
2411 for (
i = 0;
i <
program->instructions.count; ++
i)
2586 ERR(
"Failed to allocate instructions.\n");
2643 unsigned int merge_block_id,
unsigned int continue_block_id,
2663 false_branch_param = &src_params[1];
2669 false_branch_param = &src_params[2];
2672 if (continue_block_id)
2687 false_branch_param =
NULL;
2692 return false_branch_param;
2698 unsigned int merge_block_id;
2715 ERR(
"Failed to allocate control flow info structure.\n");
2728 memset(cf_info, 0,
sizeof(*cf_info));
2759 unsigned int block_id,
const char *
fmt, ...)
2762 size_t block_name_count;
2767 block_name_count =
max(flattener->block_name_count, block_id + 1);
2768 if (!
vkd3d_array_reserve((
void **)&flattener->block_names, &flattener->block_name_capacity,
2769 block_name_count,
sizeof(*flattener->block_names)))
2771 memset(&flattener->block_names[flattener->block_name_count], 0,
2772 (block_name_count - flattener->block_name_count) *
sizeof(*flattener->block_names));
2773 flattener->block_name_count = block_name_count;
2780 flattener->block_names[block_id] =
buffer.buffer;
2788 bool is_hull_shader, after_declarations_section;
2792 instructions = &
program->instructions;
2794 after_declarations_section = is_hull_shader;
2799 for (
i = 0;
i < instructions->
count; ++
i)
2801 unsigned int loop_header_block_id, loop_body_block_id, continue_block_id, merge_block_id, true_block_id;
2815 &&
instruction->declaration.indexable_temp.has_function_scope;
2819 after_declarations_section =
true;
2835 after_declarations_section =
false;
2841 "Aborting due to not yet implemented feature: Label instruction.");
2852 if (!cf_info->
u.
if_.false_param)
2858 cf_info->
u.
if_.merge_block_id = merge_block_id;
2859 cf_info->
u.
if_.else_block_id = 0;
2863 cf_flattener_create_block_name(flattener, merge_block_id,
"branch%u_merge", flattener->
branch_id);
2864 cf_flattener_create_block_name(flattener, true_block_id,
"branch%u_true", flattener->
branch_id);
2873 cf_info->
u.
if_.false_param->reg.idx[0].offset = cf_info->
u.
if_.else_block_id;
2875 cf_flattener_create_block_name(flattener,
2876 cf_info->
u.
if_.else_block_id,
"branch%u_false", cf_info->
u.
if_.id);
2903 NULL, loop_body_block_id, 0, 0);
2907 cf_info->
u.
loop.header_block_id = loop_header_block_id;
2908 cf_info->
u.
loop.continue_block_id = continue_block_id;
2909 cf_info->
u.
loop.merge_block_id = merge_block_id;
2913 cf_flattener_create_block_name(flattener, loop_header_block_id,
"loop%u_header", flattener->
loop_id);
2914 cf_flattener_create_block_name(flattener, loop_body_block_id,
"loop%u_body", flattener->
loop_id);
2915 cf_flattener_create_block_name(flattener, continue_block_id,
"loop%u_continue", flattener->
loop_id);
2916 cf_flattener_create_block_name(flattener, merge_block_id,
"loop%u_merge", flattener->
loop_id);
2946 cf_info->
u.
switch_.merge_block_id = merge_block_id;
2949 cf_info->
u.
switch_.cases_count = 0;
2950 cf_info->
u.
switch_.default_block_id = 0;
2954 cf_flattener_create_block_name(flattener, merge_block_id,
"switch%u_merge", flattener->
switch_id);
2958 10,
sizeof(*cf_info->
u.
switch_.cases)))
2968 if (!cf_info->
u.
switch_.default_block_id)
2982 src_params[0] = *cf_info->
u.
switch_.condition;
2985 for (
j = 0;
j < cf_info->
u.
switch_.cases_count; ++
j)
2987 unsigned int index =
j * 2 + 3;
3000 unsigned int label_id,
value;
3004 WARN(
"Unexpected src swizzle %#x.\n",
src->swizzle);
3007 "The swizzle for a switch case value is not scalar X.");
3021 cf_info->
u.
switch_.cases[cf_info->
u.
switch_.cases_count].block_id = label_id;
3025 cf_flattener_create_block_name(flattener, label_id,
"switch%u_case%u", cf_info->
u.
switch_.id,
value);
3037 cf_flattener_create_block_name(flattener, cf_info->
u.
switch_.default_block_id,
3038 "switch%u_default", cf_info->
u.
switch_.id);
3048 FIXME(
"Unhandled break instruction.\n");
3071 ERR(
"Invalid 'breakc' instruction outside loop.\n");
3086 ERR(
"Invalid 'continue' instruction outside loop.\n");
3102 ERR(
"Invalid 'continuec' instruction outside loop.\n");
3126 return flattener->
status;
3163 return param->reg.idx[0].offset;
3170 ERR(
"Failed to allocate instructions.\n");
3188 size_t *map_capacity,
size_t *map_count,
unsigned int switch_label,
unsigned int if_label,
unsigned int target_label)
3190 if (!
vkd3d_array_reserve((
void **)block_map, map_capacity, *map_count + 1,
sizeof(**block_map)))
3192 ERR(
"Failed to allocate block mapping.\n");
3196 (*block_map)[*map_count].switch_label = switch_label;
3197 (*block_map)[*map_count].if_label = if_label;
3198 (*block_map)[*map_count].target_label = target_label;
3208 unsigned int block_count =
program->block_count, ssa_count =
program->ssa_count, current_label = 0, if_label;
3209 size_t ins_capacity = 0, ins_count = 0,
i, map_capacity = 0, map_count = 0;
3221 for (
i = 0;
i <
program->instructions.count; ++
i)
3224 unsigned int case_count,
j, default_label;
3232 instructions[ins_count++] = *ins;
3241 instructions[ins_count++] = *ins;
3250 if (case_count == 0)
3265 if_label = current_label;
3267 for (
j = 0;
j < case_count; ++
j)
3275 instructions[ins_count].
src[0] = ins->
src[0];
3276 instructions[ins_count].
src[1] = ins->
src[3 + 2 *
j];
3282 if (
j == case_count - 1)
3283 fallthrough_label = default_label;
3285 fallthrough_label = block_count + 1;
3298 current_label, if_label, case_label))
3301 if (
j == case_count - 1)
3304 current_label, if_label, default_label))
3315 if_label = block_count;
3322 program->instructions.elements = instructions;
3323 program->instructions.capacity = ins_capacity;
3325 program->block_count = block_count;
3326 program->ssa_count = ssa_count;
3345 size_t i = ssa_count *
sizeof(*
alloc->table);
3349 ERR(
"Failed to allocate SSA table.\n");
3354 alloc->next_temp_idx = temp_count;
3368 reg->idx[0].offset =
alloc->table[
reg->idx[0].offset];
3371 for (
i = 0;
i <
reg->idx_count; ++
i)
3372 if (
reg->idx[
i].rel_addr)
3401 size_t ins_capacity = 0, ins_count = 0, phi_count, incoming_count,
i;
3405 unsigned int current_label = 0;
3411 ERR(
"Failed to allocate block info array.\n");
3418 for (
i = 0, phi_count = 0, incoming_count = 0;
i <
program->instructions.count; ++
i)
3421 unsigned int j, temp_idx;
3429 temp_idx =
alloc.next_temp_idx++;
3433 struct phi_incoming_to_temp *incoming;
3442 sizeof(*
info->incomings))))
3445 incoming = &
info->incomings[
info->incoming_count++];
3446 incoming->src = &ins->
src[
j];
3447 incoming->dst = ins->
dst;
3449 alloc.table[ins->
dst->reg.idx[0].offset] = temp_idx;
3463 for (
i = 0;
i <
program->instructions.count; ++
i)
3482 info = &block_info[current_label - 1];
3484 for (
j = 0;
j <
info->incoming_count; ++
j)
3486 struct phi_incoming_to_temp *incoming = &
info->incomings[
j];
3488 mov_ins = &instructions[ins_count++];
3491 *mov_ins->
dst = *incoming->dst;
3492 mov_ins->
src = incoming->src;
3504 instructions[ins_count++] = *ins;
3508 program->instructions.elements = instructions;
3509 program->instructions.capacity = ins_capacity;
3546 ERR(
"Cannot extend block list.\n");
3559 for (
i = 0;
i <
list->count; ++
i)
3610 if (
block->label == 0)
3661 struct vsir_cfg_structure_loop
3668 struct vsir_cfg_structure_selection
3675 struct vsir_cfg_structure_jump
3677 enum vsir_cfg_jump_type
3688 bool invert_condition;
3701 for (
i = 0;
i <
list->count; ++
i)
3712 sizeof(*
list->structures)))
3726 sizeof(*
list->structures)))
3738 memset(structure, 0,
sizeof(*structure));
3744 switch (structure->
type)
3848 unsigned int end,
bool synthetic)
3850 struct cfg_loop_interval *
interval;
3893 TRACE(
"digraph cfg {\n");
3900 if (
block->label == 0)
3903 switch (
block->end->opcode)
3906 shape =
"trapezium";
3917 TRACE(
" n%u [label=\"%u\", shape=\"%s\"];\n",
block->label,
block->label, shape);
3919 for (
j = 0;
j <
block->successors.count; ++
j)
3930 switch (structure->
type)
3932 case STRUCTURE_TYPE_BLOCK:
3936 case STRUCTURE_TYPE_LOOP:
3942 structure->
u.
loop.needs_trampoline ?
", tramp" :
"");
3945 case STRUCTURE_TYPE_SELECTION:
3950 if (structure->
u.
selection.else_body.count == 0)
3964 case STRUCTURE_TYPE_JUMP:
3966 const char *type_str;
3968 switch (structure->
u.
jump.type)
3979 type_str =
"continue";
3987 structure->
u.
jump.condition ?
"c" :
"", structure->
u.
jump.target,
3988 structure->
u.
jump.needs_launcher ?
" # launch" :
"");
4003 for (
i = 0;
i <
list->count; ++
i)
4025 memset(cfg, 0,
sizeof(*cfg));
4062 current_block->
begin = &
program->instructions.elements[
i + 1];
4064 cfg->
entry = current_block;
4072 current_block =
NULL;
4097 if (
block->label == 0)
4100 switch (
block->end->opcode)
4158 for (
i = 0;
i <
current->successors.count; ++
i)
4170 if (
block->label == 0)
4233 for (
i = 0;
i <
block->predecessors.count; ++
i)
4254 if (
block->label == 0)
4257 for (
j = 0;
j <
block->successors.count; ++
j)
4300 FIXME(
"Block %u is header to more than one loop, this is not implemented.\n",
header->label);
4302 "Block %u is header to more than one loop, this is not implemented.",
header->label);
4355 unsigned int *in_degrees =
NULL;
4359 if (!(in_degrees =
vkd3d_calloc(
cfg->block_count,
sizeof(*in_degrees))))
4362 for (
i = 0;
i <
cfg->block_count; ++
i)
4366 if (
block->label == 0)
4372 in_degrees[
i] =
block->predecessors.count;
4383 WARN(
"Unexpected entry point %u.\n",
block->label);
4385 "Block %u is unreachable from the entry point.",
block->label);
4391 if (in_degrees[cfg->
entry->label - 1] != 0)
4393 WARN(
"Entry point has %u incoming forward edges.\n", in_degrees[cfg->
entry->label - 1]);
4395 "The entry point block has %u incoming forward edges.", in_degrees[cfg->
entry->label - 1]);
4407 struct vsir_cfg_node_sorter_stack_item *inner_stack_item =
NULL;
4409 size_t new_seen_count;
4418 ERR(
"Couldn't find any viable next block, is the input CFG reducible?\n");
4441 inner_stack_item->loop = loop;
4442 inner_stack_item->seen_count = 0;
4443 inner_stack_item->begin = sorter.
cfg->order.count;
4461 inner_stack_item->seen_count += new_seen_count;
4463 VKD3D_ASSERT(inner_stack_item->seen_count <= inner_stack_item->loop->count);
4464 if (inner_stack_item->seen_count != inner_stack_item->loop->count)
4468 cfg->
order.count,
false)) < 0)
4471 new_seen_count = inner_stack_item->loop->count;
4476 for (
i = 0;
i <
block->successors.count; ++
i)
4484 --in_degrees[successor->
label - 1];
4486 if (in_degrees[successor->
label - 1] == 0)
4497 WARN(
"The control flow graph is not reducible.\n");
4499 "The control flow graph is not reducible.");
4514 for (
i = 0;
i < cfg->
order.count; ++
i)
4544 const struct cfg_loop_interval *interval1 = ptr1;
4545 const struct cfg_loop_interval *interval2 = ptr2;
4547 if (interval1->begin != interval2->begin)
4562 if (
block->label == 0)
4565 for (
j = 0;
j <
block->successors.count; ++
j)
4568 struct cfg_loop_interval *extend =
NULL;
4575 }
action = ACTION_CREATE_NEW;
4601 action = ACTION_DO_NOTHING;
4613 if (
action == ACTION_DO_NOTHING)
4621 begin =
block->order_pos;
4659 if (
action == ACTION_EXTEND)
4660 extend->begin = begin;
4670 TRACE(
"%s loop interval %u - %u\n", cfg->
loop_intervals[
i].synthetic ?
"Synthetic" :
"Natural",
4689 action->successor = successor;
4709 action->jump_type = JUMP_CONTINUE;
4731 action->jump_type = JUMP_NONE;
4735 action->jump_type = JUMP_BREAK;
4742 unsigned int i, stack_depth = 1, open_interval_idx = 0;
4752 for (
i = 0;
i < cfg->
order.count; ++
i)
4760 while (open_interval_idx < cfg->loop_interval_count)
4769 structure->
u.
loop.idx = open_interval_idx++;
4772 stack[stack_depth++] = &structure->
u.
loop.body;
4781 switch (
block->end->opcode)
4786 bool invert_condition =
false;
4794 action_false = action_true;
4825 invert_condition =
true;
4827 else if (stack_depth >= 2)
4845 action_true = action_false;
4855 structure->
u.
jump.condition = &
block->end->src[0];
4856 structure->
u.
jump.invert_condition = invert_condition;
4859 if (action_false.
jump_type != JUMP_NONE)
4872 structure->
u.
jump.type = JUMP_RET;
4880 while (stack_depth > 0)
4882 if (
stack[stack_depth - 1]->
end !=
i + 1)
4927 structure = &
list->structures[
count - 1];
4930 || structure->
u.
jump.condition)
4951 unsigned int if_target, else_target, max_target;
4963 if_target = if_break->
u.
jump.target;
4965 max_target =
max(if_target, else_target);
4970 new_break->
u.
jump.target = max_target;
4978 if (if_target == max_target)
4985 if (else_target == max_target)
4987 --
selection->u.selection.else_body.count;
4993 if (
selection->u.selection.if_body.count == 0)
5011 if (
list->count == 0)
5031 for (
i = 0;
i <
list->count; ++
i)
5039 new_selection.u.selection.condition = structure->
u.
jump.condition;
5040 new_selection.u.selection.invert_condition = structure->
u.
jump.invert_condition;
5045 new_jump->u.jump.type = structure->
u.
jump.type;
5046 new_jump->u.jump.target = structure->
u.
jump.target;
5057 &
list->structures[
i + 1],
list->count -
i - 1)) < 0)
5060 *structure = new_selection;
5061 list->count =
i + 1;
5087 if (!trailing_break)
5106 loop_body->
count = 0;
5119 loop_body->
count = 0;
5136 memset(new_list, 0,
sizeof(*new_list));
5138 for (
i = 0;
i < old_list.
count; ++
i)
5143 if (loop->
type != STRUCTURE_TYPE_LOOP)
5147 memset(loop, 0,
sizeof(*loop));
5151 loop_body = &loop->
u.
loop.body;
5153 if (loop_body->
count == 0)
5157 memset(loop, 0,
sizeof(*loop));
5175 if (new_list->count == 0)
5178 selection = &new_list->structures[new_list->count - 1];
5180 if (
selection->type == STRUCTURE_TYPE_SELECTION)
5183 new_list = &
selection->u.selection.else_body;
5185 new_list = &
selection->u.selection.if_body;
5201 for (
i = 0;
i <
list->count; ++
i)
5205 switch (structure->
type)
5237 for (
i = 0;
i <
list->count; ++
i)
5241 switch (structure->
type)
5261 for (
l =
loop;
l &&
l->u.loop.idx != structure->
u.
jump.target;
l =
l->u.loop.outer_loop)
5264 l->u.loop.needs_trampoline =
true;
5282 for (
i = 0;
i <
list->count; ++
i)
5286 switch (structure->
type)
5304 if (
loop->u.loop.needs_trampoline)
5305 structure->
u.
jump.needs_launcher =
true;
5354 struct vsir_cfg_structure_loop *loop,
unsigned int loop_idx)
5375 if (loop->needs_trampoline)
5379 const unsigned int outer_continue_target = loop_idx << 1 | 1;
5383 const unsigned int inner_break_target = loop->idx << 1;
5429 struct vsir_cfg_structure_selection *
selection,
unsigned int loop_idx)
5472 struct vsir_cfg_structure_jump *jump,
unsigned int loop_idx)
5478 unsigned int jump_target = jump->target << 1;
5488 if (jump->target == loop_idx)
5512 if (jump->needs_launcher)
5525 &no_loc, opcode, 0, !!jump->condition))
5528 if (jump->invert_condition)
5531 if (jump->condition)
5532 target->instructions[
target->ins_count].src[0] = *jump->condition;
5545 for (
i = 0;
i <
list->count; ++
i)
5549 switch (structure->
type)
5637 for (
i = 0;
i <
program->instructions.count;)
5645 TRACE(
"Structurizing a non-hull shader.\n");
5656 TRACE(
"Structurizing phase %u of a hull shader.\n", ins->
opcode);
5695 i =
reg->idx[0].offset;
5700 for (
i = 0;
i <
reg->idx_count; ++
i)
5701 if (
reg->idx[
i].rel_addr)
5720 ERR(
"Failed to allocate origin block array.\n");
5734 if (
block->label == 0)
5737 for (ins =
block->begin; ins <= block->
end; ++ins)
5742 origin_blocks[ins->
dst[
j].reg.idx[0].offset] =
block;
5752 if (
block->label == 0)
5755 for (ins =
block->begin; ins <= block->
end; ++ins)
5765 TRACE(
"Emitting temps for %u values with undominated usage.\n",
alloc.next_temp_idx -
program->temp_count);
5814 for (
i = 0;
i <
program->instructions.count;)
5822 TRACE(
"Materializing undominated SSAs in a non-hull shader.\n");
5824 program, message_context, &
i)) < 0)
5833 TRACE(
"Materializing undominated SSAs in phase %u of a hull shader.\n", ins->
opcode);
5836 program, message_context, &
i)) < 0)
5863 "Unsupported flat interpolation parameter type %#x.", parameter->
type);
5869 "Invalid flat interpolation parameter data type %#x.", parameter->
data_type);
5892 for (
i = 0;
i <
program->input_signature.element_count; ++
i)
5948 switch (
ref->data_type)
5966 "Alpha test reference data type must be a single component.");
5970 FIXME(
"Unhandled parameter data type %#x.\n",
ref->data_type);
5988 ins->
dst[0].reg.idx[0].offset = colour_signature_idx;
5990 ins->
dst[0].write_mask =
program->output_signature.elements[colour_signature_idx].mask;
6004 uint32_t colour_signature_idx, colour_temp = ~0
u;
6025 "Unsupported alpha test function parameter type %#x.",
func->type);
6031 "Invalid alpha test function parameter data type %#x.",
func->data_type);
6034 compare_func =
func->u.immediate_constant.u.u32;
6043 colour_temp =
program->temp_count++;
6045 for (
size_t i = 0;
i <
program->instructions.count; ++
i)
6047 ins = &
program->instructions.elements[
i];
6055 ref, colour_signature_idx, colour_temp, &new_pos, message_context)) < 0)
6074 dst->reg.idx[0].offset = colour_temp;
6089 unsigned int output_idx = 0;
6096 for (
unsigned int i = 0;
i < 8; ++
i)
6098 if (!(
mask & (1u <<
i)))
6109 ins->
dst[0].reg.idx[0].offset = low_signature_idx;
6111 ins->
dst[0].reg.idx[0].offset = high_signature_idx;
6113 ins->
dst[0].write_mask = (1u << (output_idx % 4));
6121 ins->
dst[0].reg.idx[0].offset = position_signature_idx;
6123 ins->
dst[0].write_mask =
program->output_signature.elements[position_signature_idx].mask;
6136 unsigned int low_signature_idx = ~0
u, high_signature_idx = ~0
u;
6142 unsigned int plane_count;
6149 for (
unsigned int i = 0;
i <
program->parameter_count; ++
i)
6154 mask_parameter = parameter;
6157 if (!mask_parameter)
6163 "Unsupported clip plane mask parameter type %#x.", mask_parameter->
type);
6169 "Invalid clip plane mask parameter data type %#x.", mask_parameter->
data_type);
6177 for (
unsigned int i = 0;
i <
signature->element_count; ++
i)
6182 "Clip planes cannot be used if the shader writes clip distance.");
6190 "Shader does not write position.");
6203 low_signature_idx =
signature->element_count;
6205 memset(clip_element, 0,
sizeof(*clip_element));
6213 if (plane_count > 4)
6215 high_signature_idx =
signature->element_count;
6217 memset(clip_element, 0,
sizeof(*clip_element));
6230 position_temp =
program->temp_count++;
6232 for (
size_t i = 0;
i <
program->instructions.count; ++
i)
6234 ins = &
program->instructions.elements[
i];
6242 position_temp, low_signature_idx, high_signature_idx, &new_pos)) < 0)
6256 dst->reg.idx[0].offset = position_temp;
6305 for (
unsigned int i = 0;
i <
program->parameter_count; ++
i)
6310 size_parameter = parameter;
6313 if (!size_parameter)
6319 "Invalid point size parameter data type %#x.", size_parameter->
data_type);
6323 program->has_point_size =
true;
6326 for (
size_t i = 0;
i <
program->instructions.count; ++
i)
6356 for (
unsigned int i = 0;
i <
program->parameter_count; ++
i)
6361 min_parameter = parameter;
6363 max_parameter = parameter;
6366 if (!min_parameter && !max_parameter)
6372 "Invalid minimum point size parameter data type %#x.", min_parameter->
data_type);
6379 "Invalid maximum point size parameter data type %#x.", max_parameter->data_type);
6385 for (
size_t i = 0;
i <
program->instructions.count; ++
i)
6389 unsigned int ssa_value;
6403 ssa_value =
program->ssa_count++;
6414 loc = &
program->instructions.elements[
i].location;
6415 ins = &
program->instructions.elements[
i + 1];
6425 ssa_value =
program->ssa_count++;
6471 static const uint32_t inverse_swizzles[16] =
6474#define VKD3D_SHADER_SWIZZLE__ VKD3D_SHADER_SWIZZLE_X
6491#undef VKD3D_SHADER_SWIZZLE__
6496 e = &
program->input_signature.elements[
src->reg.idx[0].offset];
6502 src->reg.idx[0].offset = coord_temp;
6506 if (!(
e->mask & (
e->mask + 1)))
6510 for (
unsigned int i = 0;
i < 4; ++
i)
6525 bool used_texcoord =
false;
6526 unsigned int coord_temp;
6527 size_t i, insert_pos;
6532 for (
i = 0;
i <
program->parameter_count; ++
i)
6537 sprite_parameter = parameter;
6540 if (!sprite_parameter)
6546 "Unsupported point sprite parameter type %#x.", sprite_parameter->
type);
6552 "Invalid point sprite parameter data type %#x.", sprite_parameter->
data_type);
6563 coord_temp =
program->temp_count++;
6568 for (
i = 0;
i <
program->instructions.count; ++
i)
6570 ins = &
program->instructions.elements[
i];
6579 for (;
i <
program->instructions.count; ++
i)
6581 ins = &
program->instructions.elements[
i];
6590 for (
unsigned int k = 0;
k < ins->
src[
j].reg.idx_count; ++
k)
6592 if (ins->
src[
j].reg.idx[
k].rel_addr)
6594 ins->
src[
j].reg.idx[
k].rel_addr, coord_temp);
6600 for (
unsigned int k = 0;
k < ins->
dst[
j].reg.idx_count; ++
k)
6602 if (ins->
dst[
j].reg.idx[
k].rel_addr)
6604 ins->
dst[
j].reg.idx[
k].rel_addr, coord_temp);
6614 ins = &
program->instructions.elements[insert_pos];
6631 program->has_point_coord =
true;
6682 if (
ctx->invalid_instruction_idx)
6685 WARN(
"VSIR validation error: %s\n",
buf.buffer);
6691 "instruction %zu: %s",
ctx->instruction_idx + 1,
buf.buffer);
6692 WARN(
"VSIR validation error: instruction %zu: %s\n",
ctx->instruction_idx + 1,
buf.buffer);
6704 if (
reg->idx_count != 0)
6706 "Invalid index count %u for a register of type %#x.",
6707 reg->idx_count,
reg->type);
6714 bool has_control_point =
false;
6721 switch (
ctx->program->shader_version.type)
6726 has_control_point =
true;
6735 switch (
ctx->program->shader_version.type)
6758 has_control_point =
true;
6763 has_control_point =
true;
6778 unsigned int expected_idx_count = 1 + !!has_control_point;
6780 if (
reg->idx_count != expected_idx_count)
6783 "Invalid index count %u for a register of type %#x.",
6784 reg->idx_count,
reg->type);
6791 unsigned int expected_idx_count;
6792 unsigned int signature_idx;
6801 if (
reg->idx_count < 1)
6804 "Invalid index count %u for a register of type %#x.",
6805 reg->idx_count,
reg->type);
6809 if (
reg->idx[
reg->idx_count - 1].rel_addr)
6812 "Non-NULL relative address for the signature index of a register of type %#x.",
6817 signature_idx =
reg->idx[
reg->idx_count - 1].offset;
6819 if (signature_idx >=
signature->element_count)
6822 "Signature index %u exceeds the signature size %u in a register of type %#x.",
6831 expected_idx_count = 1 + !!has_control_point + !!
is_array;
6833 if (
reg->idx_count != expected_idx_count)
6836 "Invalid index count %u for a register of type %#x.",
6837 reg->idx_count,
reg->type);
6846 struct validation_context_temp_data *
data;
6848 if (
reg->idx_count != 1)
6851 "Invalid index count %u for a TEMP register.",
6856 if (
reg->idx[0].rel_addr)
6858 "Non-NULL relative address for a TEMP register.");
6860 if (
reg->idx[0].offset >=
ctx->program->temp_count)
6863 "TEMP register index %u exceeds the maximum count %u.",
6864 reg->idx[0].offset,
ctx->program->temp_count);
6873 "Invalid dimension NONE for a TEMP register.");
6882 data->dimension =
reg->dimension;
6883 data->first_seen =
ctx->instruction_idx;
6885 else if (
data->dimension !=
reg->dimension)
6888 "Invalid dimension %#x for a TEMP register: "
6889 "it has already been seen with dimension %#x at instruction %zu.",
6890 reg->dimension,
data->dimension,
data->first_seen);
6897 if (
reg->idx_count != 1)
6900 "Invalid index count %u for a RASTOUT register.",
6905 if (
reg->idx[0].rel_addr)
6907 "Non-NULL relative address for a RASTOUT register.");
6909 if (
reg->idx[0].offset >= 3)
6911 "Invalid offset for a RASTOUT register.");
6917 if (
reg->idx_count != 1)
6920 "Invalid index count %u for a MISCTYPE register.",
6925 if (
reg->idx[0].rel_addr)
6927 "Non-NULL relative address for a MISCTYPE register.");
6929 if (
reg->idx[0].offset >= 2)
6931 "Invalid offset for a MISCTYPE register.");
6939 "Invalid precision %#x for a LABEL register.",
reg->precision);
6943 "Invalid data type %#x for a LABEL register.",
reg->data_type);
6947 "Invalid dimension %#x for a LABEL register.",
reg->dimension);
6949 if (
reg->idx_count != 1)
6952 "Invalid index count %u for a LABEL register.",
reg->idx_count);
6956 if (
reg->idx[0].rel_addr)
6958 "Non-NULL relative address for a LABEL register.");
6963 if (
reg->idx[0].offset >
ctx->program->block_count)
6965 "LABEL register index %u exceeds the maximum count %u.",
6966 reg->idx[0].offset,
ctx->program->block_count);
6974 "Invalid precision %#x for a SAMPLER register.",
reg->precision);
6978 "Invalid data type %#x for a SAMPLER register.",
reg->data_type);
6983 "Invalid dimension SCALAR for a SAMPLER register.");
6985 if (
reg->idx_count != 2)
6988 "Invalid index count %u for a SAMPLER register.",
reg->idx_count);
6992 if (
reg->idx[0].rel_addr)
6994 "Non-NULL relative address for the descriptor index of a SAMPLER register.");
7002 "Invalid precision %#x for a RESOURCE register.",
reg->precision);
7006 "Invalid data type %#x for a RESOURCE register.",
reg->data_type);
7010 "Invalid dimension %#x for a RESOURCE register.",
reg->dimension);
7012 if (
reg->idx_count != 2)
7015 "Invalid index count %u for a RESOURCE register.",
reg->idx_count);
7019 if (
reg->idx[0].rel_addr)
7021 "Non-NULL relative address for the descriptor index of a RESOURCE register.");
7029 "Invalid precision %#x for a UAV register.",
7034 "Invalid data type %#x for a UAV register.",
7040 "Invalid dimension %#x for a UAV register.",
7043 if (
reg->idx_count != 2)
7046 "Invalid index count %u for a UAV register.",
7051 if (
reg->idx[0].rel_addr)
7053 "Non-NULL relative address for the descriptor index of a UAV register.");
7059 struct validation_context_ssa_data *
data;
7061 if (
reg->idx_count != 1)
7064 "Invalid index count %u for a SSA register.",
7069 if (
reg->idx[0].rel_addr)
7071 "Non-NULL relative address for a SSA register.");
7073 if (
reg->idx[0].offset >=
ctx->program->ssa_count)
7076 "SSA register index %u exceeds the maximum count %u.",
7077 reg->idx[0].offset,
ctx->program->ssa_count);
7086 "Invalid dimension NONE for a SSA register.");
7095 data->dimension =
reg->dimension;
7096 data->data_type =
reg->data_type;
7097 data->first_seen =
ctx->instruction_idx;
7101 if (
data->dimension !=
reg->dimension)
7103 "Invalid dimension %#x for a SSA register: "
7104 "it has already been seen with dimension %#x at instruction %zu.",
7105 reg->dimension,
data->dimension,
data->first_seen);
7109 "Invalid data type %#x for a SSA register: "
7110 "it has already been seen with data type %#x at instruction %zu.",
7111 reg->data_type,
data->data_type,
data->first_seen);
7146 if (
reg->idx[
i].rel_addr)
7242 switch (
dst->reg.dimension)
7251 if (
dst->write_mask == 0)
7256 if (
dst->write_mask != 0)
7258 dst->reg.dimension,
dst->write_mask);
7282 switch (
dst->reg.type)
7285 if (
dst->reg.idx[0].offset <
ctx->program->ssa_count)
7287 struct validation_context_ssa_data *
data = &
ctx->ssas[
dst->reg.idx[0].offset];
7289 if (
data->write_mask == 0)
7291 data->write_mask =
dst->write_mask;
7292 data->first_assigned =
ctx->instruction_idx;
7297 "SSA register is already assigned at instruction %zu.",
7298 data->first_assigned);
7309 "Invalid %#x register used as destination parameter.",
dst->reg.type);
7315 "PATCHCONST register used as destination parameters are only allowed in Hull Shaders.");
7328 if (
src->swizzle & ~0x03030303u)
7334 src->reg.dimension,
src->swizzle);
7340 switch (
src->reg.type)
7343 if (
src->reg.idx[0].offset <
ctx->program->ssa_count)
7345 struct validation_context_ssa_data *
data = &
ctx->ssas[
src->reg.idx[0].offset];
7355 "Invalid NULL register used as source parameter.");
7362 "Invalid OUTPUT register used as source parameter.");
7369 "PATCHCONST register used as source parameters are only allowed in Hull and Domain Shaders.");
7382 "Invalid destination count %u for an instruction of type %#x, expected %u.",
7391 "Invalid source count %u for an instruction of type %#x, expected %u.",
7401 "Invalid source count %u for an instruction of type %#x, expected at least %u.",
7415 "Invalid source count %u for an instruction of type %#x, expected at most %u.",
7437#define PS_BIT (1u << VKD3D_SHADER_TYPE_PIXEL)
7438#define VS_BIT (1u << VKD3D_SHADER_TYPE_VERTEX)
7439#define GS_BIT (1u << VKD3D_SHADER_TYPE_GEOMETRY)
7440#define HS_BIT (1u << VKD3D_SHADER_TYPE_HULL)
7441#define DS_BIT (1u << VKD3D_SHADER_TYPE_DOMAIN)
7442#define CS_BIT (1u << VKD3D_SHADER_TYPE_COMPUTE)
7474 bool integer_type =
false;
7476 if (
element->register_count == 0)
7478 "element %u of %s signature: Invalid zero register count.",
idx, signature_type_name);
7482 "element %u of %s signature: Invalid mask %#x.",
idx, signature_type_name,
element->mask);
7486 "element %u of %s signature: Non-contiguous mask %#x.",
7508 if (
element->used_mask & ~0xf)
7510 "element %u of %s signature: Invalid usage mask %#x.",
7511 idx, signature_type_name,
element->used_mask);
7513 switch (
element->sysval_semantic)
7542 "element %u of %s signature: Invalid system value semantic %#x.",
7543 idx, signature_type_name,
element->sysval_semantic);
7551 if (
data->input ||
data->output ||
data->patch_constant)
7555 switch (signature_type)
7573 if (!(
mask & (1u <<
ctx->program->shader_version.type)))
7575 "element %u of %s signature: Invalid system value semantic %#x.",
7576 idx, signature_type_name,
element->sysval_semantic);
7579 if (
data->component_count != 0)
7583 "element %u of %s signature: Invalid data type %#x for system value semantic %#x.",
7588 "element %u of %s signature: Invalid mask %#x for system value semantic %#x.",
7593 switch (
element->component_type)
7597 integer_type =
true;
7605 "element %u of %s signature: Invalid component type %#x.",
7606 idx, signature_type_name,
element->component_type);
7612 "element %u of %s signature: Invalid minimum precision %#x.",
7613 idx, signature_type_name,
element->min_precision);
7617 "element %u of %s signature: Invalid interpolation mode %#x.",
7618 idx, signature_type_name,
element->interpolation_mode);
7623 "element %u of %s signature: Invalid interpolation mode %#x for integer component type.",
7624 idx, signature_type_name,
element->interpolation_mode);
7640 & (1u <<
ctx->program->shader_version.type)))
7653 return "structured";
7655 return "block-based";
7664 if (
ctx->program->cf_type != expected_type)
7676 ctx->blocks[
ctx->depth++] = opcode;
7684 "Phase instruction %#x is only valid in a hull shader.",
7686 if (
ctx->depth != 0)
7688 "Phase instruction %#x must appear to top level.",
7691 ctx->dcl_temps_found =
false;
7714 "Invalid register of type %#x in unconditional BRANCH instruction, expected LABEL.",
7730 "Invalid register of type %#x in conditional BRANCH instruction, expected LABEL.",
7735 ctx->inside_block =
false;
7750 if (!(
instruction->declaration.max_tessellation_factor >= 1.0f
7751 &&
instruction->declaration.max_tessellation_factor <= 64.0f))
7753 "Max tessellation factor %f is invalid.",
7754 instruction->declaration.max_tessellation_factor);
7771 "Output control point count %u is invalid.",
7787 if (
ctx->dcl_temps_found)
7789 "Duplicate DCL_TEMPS instruction.");
7792 "Invalid DCL_TEMPS count %u, expected at most %u.",
7794 ctx->dcl_temps_found =
true;
7803 "Tessellator domain %#x is invalid.",
instruction->declaration.tessellator_domain);
7809 if (!
instruction->declaration.tessellator_output_primitive
7810 ||
instruction->declaration.tessellator_output_primitive
7813 "Tessellator output primitive %#x is invalid.",
7814 instruction->declaration.tessellator_output_primitive);
7820 if (!
instruction->declaration.tessellator_partitioning
7821 ||
instruction->declaration.tessellator_partitioning
7824 "Tessellator partitioning %#x is invalid.",
7825 instruction->declaration.tessellator_partitioning);
7841 "ELSE instruction doesn't terminate IF block.");
7852 "ENDIF instruction doesn't terminate IF/ELSE block.");
7862 "ENDLOOP instruction doesn't terminate LOOP block.");
7872 "ENDREP instruction doesn't terminate REP block.");
7882 "ENDSWITCH instruction doesn't terminate SWITCH block.");
7904 "Invalid register of type %#x in a LABEL instruction, expected LABEL.",
7907 if (
ctx->inside_block)
7909 "Invalid LABEL instruction inside a block.");
7910 ctx->inside_block =
true;
7926 unsigned int i, incoming_count;
7934 "Invalid source count %u for a PHI instruction, it must be an even number.",
7938 for (
i = 0;
i < incoming_count; ++
i)
7940 unsigned int value_idx = 2 *
i;
7941 unsigned int label_idx = 2 *
i + 1;
7946 "Invalid value register for incoming %u of type %#x in PHI instruction, "
7947 "expected SSA, IMMCONST or IMMCONST64.",
i,
instruction->
src[value_idx].reg.type);
7951 "Invalid value dimension %#x for incoming %u in PHI instruction, expected scalar.",
7956 "Invalid label register for case %u of type %#x in PHI instruction, "
7965 "Invalid destination of type %#x in PHI instruction, expected SSA.",
7970 "Invalid destination dimension %#x in PHI instruction, expected scalar.",
7975 "Invalid modifiers %#x for the destination of a PHI instruction, expected none.",
7980 "Invalid shift %#x for the destination of a PHI instruction, expected none.",
7992 ctx->inside_block =
false;
8004 unsigned int i, case_count;
8016 "Invalid source count %u for a monolithic SWITCH instruction, it must be an odd number.",
8021 "Invalid default label register of type %#x in monolithic SWITCH instruction, expected LABEL.",
8026 "Invalid merge label register of type %#x in monolithic SWITCH instruction, expected LABEL.",
8031 for (
i = 0;
i < case_count; ++
i)
8033 unsigned int value_idx = 3 + 2 *
i;
8034 unsigned int label_idx = 3 + 2 *
i + 1;
8038 "Invalid value register for case %u of type %#x in monolithic SWITCH instruction, "
8039 "expected IMMCONST or IMMCONST64.",
i,
instruction->
src[value_idx].reg.type);
8043 "Invalid label register for case %u of type %#x in monolithic SWITCH instruction, "
8047 ctx->inside_block =
false;
8125 "Instruction %#x appear before any phase instruction in a hull shader.",
8146 "Invalid instruction %#x outside any block.",
8160 if (
desc->dst_param_count != ~0
u)
8162 if (
desc->src_param_count != ~0
u)
8176 .null_location = {.source_name = source_name},
8179 .invalid_instruction_idx =
true,
8186 switch (
program->shader_version.type)
8193 if (
program->patch_constant_signature.element_count != 0)
8195 "Patch constant signature is only valid for hull and domain shaders.");
8198 switch (
program->shader_version.type)
8205 if (
program->input_control_point_count == 0)
8207 "Invalid zero input control point count.");
8211 if (
program->input_control_point_count != 0)
8213 "Invalid input control point count %u.",
8214 program->input_control_point_count);
8217 switch (
program->shader_version.type)
8223 if (
program->output_control_point_count != 0)
8225 "Invalid output control point count %u.",
8226 program->output_control_point_count);
8239 ctx.invalid_instruction_idx =
false;
8241 for (
ctx.instruction_idx = 0;
ctx.instruction_idx <
program->instructions.count
8245 ctx.invalid_instruction_idx =
true;
8250 if (
ctx.inside_block)
8253 for (
i = 0;
i <
ctx.program->ssa_count; ++
i)
8255 struct validation_context_ssa_data *
data = &
ctx.ssas[
i];
8257 if ((
data->write_mask |
data->read_mask) !=
data->write_mask)
8259 "SSA register %u has invalid read mask %#x, which is not a subset of the write mask %#x "
8260 "at the point of definition.",
i,
data->read_mask,
data->write_mask);
8277#define vsir_transform(ctx, step) vsir_transform_(ctx, #step, step)
8282 if (
ctx->result < 0)
8285 if ((
ctx->result = step(
ctx->program,
ctx)) < 0)
8287 WARN(
"Transformation \"%s\" failed with result %d.\n", step_name,
ctx->result);
8292 ctx->compile_info->source_name,
ctx->message_context)) < 0)
8294 WARN(
"Validation failed with result %d after transformation \"%s\".\n",
ctx->result, step_name);
8318 if (
program->shader_version.major <= 2)
8338 if (
program->shader_version.major >= 6)
8350 if (
program->shader_version.major <= 2)
static void else_break(short *before, short class)
set(const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())
unsigned int component_count
void vsir_program_trace(const struct vsir_program *program)
static BOOL reserve(struct dynamic_array *array, int count, int itemsize)
static const WCHAR version[]
_ACRTIMP void __cdecl qsort(void *, size_t, size_t, int(__cdecl *)(const void *, const void *))
void sincos(double x, double *s, double *c)
GLint GLint GLsizei GLsizei GLsizei depth
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLsizei const GLint * locations
GLboolean GLboolean GLboolean b
GLenum const GLfloat * params
GLenum GLuint GLenum GLsizei const GLchar * buf
GLuint GLdouble GLdouble GLint GLint order
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 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
@ SIGNATURE_TYPE_PATCH_CONSTANT
static void vsir_cfg_remove_trailing_continue(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *list, unsigned int target)
static bool use_flat_interpolation(const struct vsir_program *program, struct vkd3d_shader_message_context *message_context, bool *flat)
static enum vkd3d_result vsir_program_materialize_undominated_ssas_to_temps(struct vsir_program *program, struct vsir_transformation_context *ctx)
static void shader_dst_param_normalise_outpointid(struct vkd3d_shader_dst_param *dst_param, struct control_point_normaliser *normaliser)
static struct vkd3d_shader_src_param * instruction_src_params_alloc(struct vkd3d_shader_instruction *ins, unsigned int count, struct cf_flattener *flattener)
static struct vkd3d_shader_src_param * cf_flattener_emit_branch(struct cf_flattener *flattener, unsigned int merge_block_id, unsigned int continue_block_id, const struct vkd3d_shader_src_param *condition, unsigned int true_id, unsigned int false_id, unsigned int flags)
static void vsir_validate_switch_monolithic(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static struct vsir_cfg_structure * vsir_cfg_get_trailing_break(struct vsir_cfg_structure_list *list)
static void vsir_cfg_dump_structured_program(struct vsir_cfg *cfg)
static void src_param_init_temp_float(struct vkd3d_shader_src_param *src, unsigned int idx)
struct signature_element * vsir_signature_find_element_for_reg(const struct shader_signature *signature, unsigned int reg_idx, unsigned int write_mask)
static enum vkd3d_result vsir_program_lower_precise_mad(struct vsir_program *program, struct vkd3d_shader_instruction *mad, unsigned int *tmp_idx)
static enum vkd3d_result vsir_program_lower_tex(struct vsir_program *program, struct vkd3d_shader_instruction *tex)
static void vsir_validate_endrep(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void vsir_validate_dcl_temps(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void shader_register_eliminate_phase_addressing(struct vkd3d_shader_register *reg, unsigned int instance_id)
static enum vkd3d_result vsir_program_structurize_function(struct vsir_program *program, struct vkd3d_shader_message_context *message_context, struct vsir_cfg_emit_target *target, size_t *pos)
static void vsir_cfg_count_targets(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *list)
static enum vkd3d_result vsir_block_list_add(struct vsir_block_list *list, struct vsir_block *block)
static void vsir_src_param_init_sampler(struct vkd3d_shader_src_param *src, unsigned int id, unsigned int idx)
static bool is_pre_rasterization_shader(enum vkd3d_shader_type type)
static int block_compare(const void *ptr1, const void *ptr2)
static enum vkd3d_result vsir_cfg_init(struct vsir_cfg *cfg, struct vsir_program *program, struct vkd3d_shader_message_context *message_context, struct vsir_cfg_emit_target *target, size_t *pos)
static const struct vsir_validator_instruction_desc vsir_validator_instructions[]
static enum vkd3d_result control_point_normaliser_emit_hs_input(struct control_point_normaliser *normaliser, const struct shader_signature *s, unsigned int input_control_point_count, unsigned int dst, const struct vkd3d_shader_location *location)
static void range_map_set_register_range(uint8_t range_map[][VKD3D_VEC4_SIZE], unsigned int register_idx, unsigned int register_count, uint32_t write_mask, bool is_dcl_indexrange)
static enum vkd3d_result instruction_array_normalise_hull_shader_control_point_io(struct vsir_program *program, struct vsir_transformation_context *ctx)
static void vsir_validate_endswitch(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static enum vkd3d_result vsir_cfg_move_breaks_out_of_selections_recursively(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *list)
static void vsir_validate_resource_register(struct validation_context *ctx, const struct vkd3d_shader_register *reg)
static void vsir_validate_endloop(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static bool vsir_block_dominates(struct vsir_block *b1, struct vsir_block *b2)
static bool sysval_semantics_should_merge(const struct signature_element *e, const struct signature_element *f)
static bool lower_switch_to_if_ladder_add_block_mapping(struct lower_switch_to_if_ladder_block_mapping **block_map, size_t *map_capacity, size_t *map_count, unsigned int switch_label, unsigned int if_label, unsigned int target_label)
static void vsir_validate_label_register(struct validation_context *ctx, const struct vkd3d_shader_register *reg)
static void vsir_validate_switch(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
const struct vkd3d_shader_parameter1 * vsir_program_get_parameter(const struct vsir_program *program, enum vkd3d_shader_parameter_name name)
static bool flattener_is_in_fork_or_join_phase(const struct hull_flattener *flattener)
static void vsir_src_param_init_resource(struct vkd3d_shader_src_param *src, unsigned int id, unsigned int idx)
static void vsir_cfg_dump_dot(struct vsir_cfg *cfg)
static enum vkd3d_result vsir_program_materialize_undominated_ssas_to_temps_in_function(struct vsir_program *program, struct vkd3d_shader_message_context *message_context, size_t *pos)
static void vsir_block_list_remove_index(struct vsir_block_list *list, size_t idx)
static bool vsir_instruction_is_dcl(const struct vkd3d_shader_instruction *instruction)
static void vsir_validate_dcl_gs_instances(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static unsigned int shader_register_normalise_arrayed_addressing(struct vkd3d_shader_register *reg, unsigned int id_idx, unsigned int register_index)
static enum vkd3d_result vsir_cfg_structure_list_emit_selection(struct vsir_cfg *cfg, struct vsir_cfg_structure_selection *selection, unsigned int loop_idx)
static int compare_loop_intervals(const void *ptr1, const void *ptr2)
static void cf_flattener_emit_unconditional_branch(struct cf_flattener *flattener, unsigned int target_block_id)
static enum vkd3d_result vsir_program_add_diffuse_output(struct vsir_program *program, struct vsir_transformation_context *ctx)
static enum vkd3d_result flattener_flatten_phases(struct hull_flattener *normaliser, struct shader_phase_location_array *locations)
static enum vkd3d_result insert_point_size_before_ret(struct vsir_program *program, const struct vkd3d_shader_instruction *ret, size_t *ret_pos)
static enum vkd3d_result vsir_program_apply_flat_interpolation(struct vsir_program *program, struct vsir_transformation_context *ctx)
static void cf_flattener_emit_conditional_branch_and_merge(struct cf_flattener *flattener, const struct vkd3d_shader_src_param *condition, unsigned int true_id, unsigned int flags)
static void vsir_validate_cf_type(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction, enum vsir_control_flow_type expected_type)
static struct cf_flattener_info * cf_flattener_find_innermost_loop(struct cf_flattener *flattener)
static void vsir_validate_dcl_vertices_out(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void materialize_ssas_to_temps_process_reg(struct vsir_program *program, struct ssas_to_temps_alloc *alloc, struct vkd3d_shader_register *reg)
static void vsir_validate_else(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void shader_signature_map_patch_constant_index_ranges(struct shader_signature *s, uint8_t range_map[][VKD3D_VEC4_SIZE])
static bool replace_texcoord_with_point_coord(struct vsir_program *program, struct vkd3d_shader_src_param *src, unsigned int coord_temp)
static bool shader_dst_param_io_normalise(struct vkd3d_shader_dst_param *dst_param, bool is_io_dcl, struct io_normaliser *normaliser)
static void vsir_validate_signature(struct validation_context *ctx, const struct shader_signature *signature, enum vsir_signature_type signature_type)
static void vsir_validate_dcl_hs_max_tessfactor(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void vsir_cfg_compute_edge_action(struct vsir_cfg *cfg, struct vsir_block *block, struct vsir_block *successor, struct vsir_cfg_edge_action *action)
static void vsir_validate_phi(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static unsigned int cf_flattener_alloc_block_id(struct cf_flattener *flattener)
static void vsir_cfg_mark_launchers(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *list, struct vsir_cfg_structure *loop)
static void flattener_eliminate_phase_related_dcls(struct hull_flattener *normaliser, unsigned int index, struct shader_phase_location_array *locations)
static void vsir_validate_rep(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void src_param_init_temp_uint(struct vkd3d_shader_src_param *src, unsigned int idx)
static bool vsir_block_list_search(struct vsir_block_list *list, struct vsir_block *block)
static void vsir_validate_dcl_input_primitive(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void vsir_validate_ret(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void vsir_cfg_cleanup(struct vsir_cfg *cfg)
static void vsir_validator_push_block(struct validation_context *ctx, enum vkd3d_shader_opcode opcode)
static void src_param_init_temp_float4(struct vkd3d_shader_src_param *src, unsigned int idx)
static void vsir_validate_signature_element(struct validation_context *ctx, const struct shader_signature *signature, enum vsir_signature_type signature_type, unsigned int idx)
static enum vkd3d_result vsir_program_insert_point_size_clamp(struct vsir_program *program, struct vsir_transformation_context *ctx)
static bool control_point_normaliser_is_in_control_point_phase(const struct control_point_normaliser *normaliser)
static void vsir_validate_dst_count(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction, unsigned int count)
static bool cf_flattener_copy_instruction(struct cf_flattener *flattener, const struct vkd3d_shader_instruction *instruction)
static void shader_src_param_io_normalise(struct vkd3d_shader_src_param *src_param, struct io_normaliser *normaliser)
static enum vkd3d_result insert_clip_planes_before_ret(struct vsir_program *program, const struct vkd3d_shader_instruction *ret, uint32_t mask, uint32_t position_signature_idx, uint32_t position_temp, uint32_t low_signature_idx, uint32_t high_signature_idx, size_t *ret_pos)
static bool vsir_instruction_init_label(struct vkd3d_shader_instruction *ins, const struct vkd3d_shader_location *location, unsigned int label_id, struct vsir_program *program)
static struct cf_flattener_info * cf_flattener_push_control_flow_level(struct cf_flattener *flattener)
static void dst_param_init_temp_uint(struct vkd3d_shader_dst_param *dst, unsigned int idx)
static void cf_flattener_set_error(struct cf_flattener *flattener, enum vkd3d_result error)
static struct cf_flattener_info * cf_flattener_find_innermost_breakable_cf_construct(struct cf_flattener *flattener)
static enum vkd3d_result cf_flattener_iterate_instruction_array(struct cf_flattener *flattener, struct vkd3d_shader_message_context *message_context)
static bool io_normaliser_is_in_fork_or_join_phase(const struct io_normaliser *normaliser)
static struct vkd3d_shader_instruction * cf_flattener_require_space(struct cf_flattener *flattener, size_t count)
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)
static enum vkd3d_result vsir_program_materialise_phi_ssas_to_temps(struct vsir_program *program, struct vsir_transformation_context *ctx)
static void cf_flattener_emit_label(struct cf_flattener *flattener, unsigned int label_id)
static void vsir_validate_dcl_tessellator_domain(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void vsir_validate_dcl_tessellator_output_primitive(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void src_param_init_parameter(struct vkd3d_shader_src_param *src, uint32_t idx, enum vkd3d_data_type type)
static unsigned int label_from_src_param(const struct vkd3d_shader_src_param *param)
static void vsir_validate_ifc(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static enum vkd3d_result vsir_program_lower_ifc(struct vsir_program *program, struct vkd3d_shader_instruction *ifc, unsigned int *tmp_idx, struct vkd3d_shader_message_context *message_context)
static bool target_allows_subset_masks(const struct vkd3d_shader_compile_info *info)
static void vsir_validate_label(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static enum vkd3d_result vsir_program_lower_sm1_sincos(struct vsir_program *program, struct vkd3d_shader_instruction *sincos)
static enum vkd3d_result vsir_program_flatten_control_flow_constructs(struct vsir_program *program, struct vsir_transformation_context *ctx)
static void dst_param_init_ssa_bool(struct vkd3d_shader_dst_param *dst, unsigned int idx)
static enum vkd3d_result vsir_program_ensure_ret(struct vsir_program *program, struct vsir_transformation_context *ctx)
static bool get_opcode_from_rel_op(enum vkd3d_shader_rel_op rel_op, enum vkd3d_data_type data_type, enum vkd3d_shader_opcode *opcode, bool *requires_swap)
struct vkd3d_shader_src_param * vsir_program_create_outpointid_param(struct vsir_program *program)
static enum vkd3d_result vsir_cfg_sort_nodes(struct vsir_cfg *cfg)
static void vsir_validate_register_without_indices(struct validation_context *ctx, const struct vkd3d_shader_register *reg)
static void vkd3d_shader_instruction_make_nop(struct vkd3d_shader_instruction *ins)
static void vsir_block_list_sort(struct vsir_block_list *list)
static bool ssas_to_temps_alloc_init(struct ssas_to_temps_alloc *alloc, unsigned int ssa_count, unsigned int temp_count)
static enum vkd3d_result vsir_program_insert_alpha_test(struct vsir_program *program, struct vsir_transformation_context *ctx)
static void shader_register_normalise_flat_constants(struct vkd3d_shader_src_param *param, const struct flat_constants_normaliser *normaliser)
static void vsir_cfg_structure_init(struct vsir_cfg_structure *structure, enum vsir_cfg_structure_type type)
static void vsir_validate_src_count(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction, unsigned int count)
static enum vkd3d_result vsir_cfg_add_edge(struct vsir_cfg *cfg, struct vsir_block *block, struct vkd3d_shader_src_param *successor_param)
static enum vkd3d_result vsir_program_ensure_diffuse(struct vsir_program *program, struct vsir_transformation_context *ctx)
static void vsir_validate_uav_register(struct validation_context *ctx, const struct vkd3d_shader_register *reg)
static void shader_instruction_eliminate_phase_instance_id(struct vkd3d_shader_instruction *ins, unsigned int instance_id)
void vsir_src_param_init_label(struct vkd3d_shader_src_param *param, unsigned int label_id)
static enum vkd3d_result vsir_cfg_compute_loops(struct vsir_cfg *cfg)
static void vsir_validate_src_param(struct validation_context *ctx, const struct vkd3d_shader_src_param *src)
void vsir_program_cleanup(struct vsir_program *program)
static void dst_param_init_ssa_float(struct vkd3d_shader_dst_param *dst, unsigned int idx)
static unsigned int signature_element_range_expand_mask(struct signature_element *e, unsigned int register_count, uint8_t range_map[][VKD3D_VEC4_SIZE])
static void dst_param_init_temp_float4(struct vkd3d_shader_dst_param *dst, unsigned int idx)
static unsigned int range_map_get_register_count(uint8_t range_map[][VKD3D_VEC4_SIZE], unsigned int register_idx, uint32_t write_mask)
static void vsir_transform_(struct vsir_transformation_context *ctx, const char *step_name, enum vkd3d_result(*step)(struct vsir_program *program, struct vsir_transformation_context *ctx))
static void vsir_validate_dst_param(struct validation_context *ctx, const struct vkd3d_shader_dst_param *dst)
static enum vkd3d_result vsir_program_insert_point_coord(struct vsir_program *program, struct vsir_transformation_context *ctx)
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)
static bool vsir_validate_src_max_count(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction, unsigned int count)
bool vsir_instruction_init_with_params(struct vsir_program *program, struct vkd3d_shader_instruction *ins, const struct vkd3d_shader_location *location, enum vkd3d_shader_opcode opcode, unsigned int dst_count, unsigned int src_count)
static void shader_instruction_normalise_io_params(struct vkd3d_shader_instruction *ins, struct io_normaliser *normaliser)
static bool shader_signature_merge(struct shader_signature *s, uint8_t range_map[][VKD3D_VEC4_SIZE], bool is_patch_constant)
static void vsir_validate_misctype_register(struct validation_context *ctx, const struct vkd3d_shader_register *reg)
static enum vkd3d_result vsir_program_lower_instructions(struct vsir_program *program, struct vsir_transformation_context *ctx)
static void vsir_cfg_structure_cleanup(struct vsir_cfg_structure *structure)
static enum vkd3d_result vsir_cfg_emit_structured_program(struct vsir_cfg *cfg)
static enum vkd3d_result vsir_program_normalise_flat_constants(struct vsir_program *program, struct vsir_transformation_context *ctx)
static struct signature_element * vsir_signature_find_element_by_name(const struct shader_signature *signature, const char *semantic_name, unsigned int semantic_index)
static enum vkd3d_result vsir_program_remap_output_signature(struct vsir_program *program, struct vsir_transformation_context *ctx)
bool vsir_signature_find_sysval(const struct shader_signature *signature, enum vkd3d_shader_sysval_semantic sysval, unsigned int semantic_index, unsigned int *element_index)
static bool reserve_instructions(struct vkd3d_shader_instruction **instructions, size_t *capacity, size_t count)
static void vsir_validate_temp_register(struct validation_context *ctx, const struct vkd3d_shader_register *reg)
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)
static void vsir_cfg_structure_dump(struct vsir_cfg *cfg, struct vsir_cfg_structure *structure)
static void vsir_validate_hull_shader_phase(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void vsir_validate_branch(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void vsir_cfg_mark_trampolines(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *list, struct vsir_cfg_structure *loop)
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)
static void vsir_validate_nop(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static enum vkd3d_result vsir_block_list_add_checked(struct vsir_block_list *list, struct vsir_block *block)
static enum vkd3d_result vsir_cfg_synthesize_selections(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *list)
static void register_map_undominated_use(struct vkd3d_shader_register *reg, struct ssas_to_temps_alloc *alloc, struct vsir_block *block, struct vsir_block **origin_blocks)
static void vsir_cfg_structure_list_cleanup(struct vsir_cfg_structure_list *list)
static void vsir_validate_register(struct validation_context *ctx, const struct vkd3d_shader_register *reg)
static enum vkd3d_result vsir_cfg_generate_synthetic_loop_intervals(struct vsir_cfg *cfg)
static enum vkd3d_result vsir_cfg_structure_list_append_from_region(struct vsir_cfg_structure_list *list, struct vsir_cfg_structure *begin, size_t size)
static void src_param_init_temp_bool(struct vkd3d_shader_src_param *src, unsigned int idx)
enum vkd3d_result vsir_program_transform(struct vsir_program *program, uint64_t config_flags, const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context)
static void vsir_validate_dcl_output_topology(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void ssas_to_temps_block_info_cleanup(struct ssas_to_temps_block_info *block_info, size_t count)
#define vsir_transform(ctx, step)
static bool has_texcoord_signature_element(const struct shader_signature *signature)
static enum vkd3d_result vsir_block_init(struct vsir_block *block, unsigned int label, size_t block_count)
static const struct sysval_validation_data_element sysval_validation_data[]
static int signature_element_mask_compare(const void *a, const void *b)
static void vsir_validate_ssa_register(struct validation_context *ctx, const struct vkd3d_shader_register *reg)
static void vsir_validate_rastout_register(struct validation_context *ctx, const struct vkd3d_shader_register *reg)
static enum vkd3d_result vsir_program_lower_texkill(struct vsir_program *program, struct vkd3d_shader_instruction *texkill, unsigned int *tmp_idx)
static enum vkd3d_result vsir_cfg_materialize_undominated_ssas_to_temps(struct vsir_cfg *cfg)
static void vsir_validate_endif(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static enum vkd3d_result vsir_program_lower_switch_to_selection_ladder(struct vsir_program *program, struct vsir_transformation_context *ctx)
static enum vkd3d_result vsir_cfg_structure_list_emit(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *list, unsigned int loop_idx)
static const struct vkd3d_shader_varying_map * find_varying_map(const struct vkd3d_shader_varying_map_info *varying_map, unsigned int signature_idx)
static enum vkd3d_result insert_alpha_test_before_ret(struct vsir_program *program, const struct vkd3d_shader_instruction *ret, enum vkd3d_shader_comparison_func compare_func, const struct vkd3d_shader_parameter1 *ref, uint32_t colour_signature_idx, uint32_t colour_temp, size_t *ret_pos, struct vkd3d_shader_message_context *message_context)
static bool shader_register_is_phase_instance_id(const struct vkd3d_shader_register *reg)
static enum vkd3d_result vsir_program_insert_point_size(struct vsir_program *program, struct vsir_transformation_context *ctx)
static void remove_unread_output_components(const struct shader_signature *signature, struct vkd3d_shader_instruction *ins, struct vkd3d_shader_dst_param *dst)
static void vsir_validate_instruction(struct validation_context *ctx)
static enum vkd3d_result vsir_cfg_build_structured_program(struct vsir_cfg *cfg)
static void vsir_cfg_compute_dominators(struct vsir_cfg *cfg)
static int convert_parameter_info(const struct vkd3d_shader_compile_info *compile_info, unsigned int *ret_count, const struct vkd3d_shader_parameter1 **ret_parameters)
static const unsigned int allowed_signature_phases[]
static void vsir_validate_sampler_register(struct validation_context *ctx, const struct vkd3d_shader_register *reg)
static const char *const signature_type_names[]
static void vsir_cfg_structure_list_dump(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *list)
static enum vkd3d_result vsir_cfg_append_loop(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *new_list, struct vsir_cfg_structure *loop)
static enum vkd3d_result vsir_program_remove_dead_code(struct vsir_program *program, struct vsir_transformation_context *ctx)
static struct vsir_cfg_structure * vsir_cfg_structure_list_append(struct vsir_cfg_structure_list *list, enum vsir_cfg_structure_type type)
static enum vkd3d_result vsir_cfg_optimize(struct vsir_cfg *cfg)
static void vsir_validate_if(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void dst_param_init_temp_bool(struct vkd3d_shader_dst_param *dst, unsigned int idx)
static void vsir_validate_dcl_tessellator_partitioning(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
void vsir_instruction_init(struct vkd3d_shader_instruction *ins, const struct vkd3d_shader_location *location, enum vkd3d_shader_opcode opcode)
static enum vkd3d_result vsir_cfg_add_loop_interval(struct vsir_cfg *cfg, unsigned int begin, unsigned int end, bool synthetic)
static void vsir_block_list_init(struct vsir_block_list *list)
static const char * name_from_cf_type(enum vsir_control_flow_type type)
static void cf_flattener_pop_control_flow_level(struct cf_flattener *flattener)
static enum vkd3d_result vsir_program_structurize(struct vsir_program *program, struct vsir_transformation_context *ctx)
static enum vkd3d_result vsir_cfg_optimize_recurse(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *list)
static void src_param_init_ssa_float(struct vkd3d_shader_src_param *src, unsigned int idx)
static bool shader_signature_find_element_for_reg(const struct shader_signature *signature, unsigned int reg_idx, unsigned int write_mask, unsigned int *element_idx)
static void src_param_init_const_uint(struct vkd3d_shader_src_param *src, uint32_t value)
static enum vkd3d_result vsir_cfg_structure_list_emit_block(struct vsir_cfg *cfg, struct vsir_block *block)
static void vsir_block_list_cleanup(struct vsir_block_list *list)
static bool io_normaliser_is_in_control_point_phase(const struct io_normaliser *normaliser)
static void vsir_validate_io_register(struct validation_context *ctx, const struct vkd3d_shader_register *reg)
static enum vkd3d_result vsir_program_normalise_io_registers(struct vsir_program *program, struct vsir_transformation_context *ctx)
static bool vsir_validate_src_min_count(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction, unsigned int count)
static enum vkd3d_result vsir_cfg_scan_loop(struct vsir_block_list *loop, struct vsir_block *block, struct vsir_block *header)
static void dst_param_init_output(struct vkd3d_shader_dst_param *dst, enum vkd3d_data_type data_type, uint32_t idx, uint32_t write_mask)
enum vkd3d_result vsir_program_validate(struct vsir_program *program, uint64_t config_flags, const char *source_name, struct vkd3d_shader_message_context *message_context)
static enum vkd3d_result vsir_program_flatten_hull_shader_phases(struct vsir_program *program, struct vsir_transformation_context *ctx)
static void vsir_validate_loop(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static void vsir_block_cleanup(struct vsir_block *block)
static enum vkd3d_result vsir_cfg_move_breaks_out_of_selections(struct vsir_cfg *cfg, struct vsir_cfg_structure_list *list)
static void shader_dst_param_io_init(struct vkd3d_shader_dst_param *param, const struct signature_element *e, enum vkd3d_shader_register_type reg_type, unsigned int idx_count)
enum vkd3d_result vsir_program_transform_early(struct vsir_program *program, uint64_t config_flags, const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_message_context *message_context)
static bool get_flat_constant_register_type(const struct vkd3d_shader_register *reg, enum vkd3d_shader_d3dbc_constant_register *set, uint32_t *index)
static enum vkd3d_result vsir_cfg_structure_list_emit_jump(struct vsir_cfg *cfg, struct vsir_cfg_structure_jump *jump, unsigned int loop_idx)
static void vsir_cfg_compute_dominators_recurse(struct vsir_block *current, struct vsir_block *reference)
static enum vkd3d_result vsir_program_lower_texldd(struct vsir_program *program, struct vkd3d_shader_instruction *texldd)
static void src_param_init_ssa_bool(struct vkd3d_shader_src_param *src, unsigned int idx)
static void vsir_validate_dcl_output_control_point_count(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
static enum vkd3d_result vsir_program_insert_clip_planes(struct vsir_program *program, struct vsir_transformation_context *ctx)
static int signature_element_index_compare(const void *a, const void *b)
static enum vkd3d_result vsir_cfg_structure_list_emit_loop(struct vsir_cfg *cfg, struct vsir_cfg_structure_loop *loop, unsigned int loop_idx)
static int signature_element_register_compare(const void *a, const void *b)
static void io_normaliser_add_index_range(struct io_normaliser *normaliser, const struct vkd3d_shader_instruction *ins)
#define location(file, line)
#define memcpy(s1, s2, n)
#define memmove(s1, s2, n)
struct task_struct * current
static const WCHAR label[]
static CRYPT_DATA_BLOB b2[]
static CRYPT_DATA_BLOB b1[]
D3D11_SHADER_VARIABLE_DESC desc
static const LARGE_INTEGER *static const HANDLE const LARGE_INTEGER *static PSLIST_ENTRY PSLIST_ENTRY last
static ULONG ** element_count
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
enum vkd3d_shader_spirv_environment environment
enum vkd3d_shader_register_type reg_type
enum vkd3d_shader_sysval_semantic sysval
struct vkd3d_shader_src_param * false_param
unsigned int else_block_id
enum cf_flattener_info::@6005 current_block
struct cf_flattener_switch_info switch_
struct cf_flattener_loop_info loop
union cf_flattener_info::@6004 u
struct cf_flattener_if_info if_
unsigned int continue_block_id
unsigned int header_block_id
const struct vkd3d_shader_src_param * condition
unsigned int merge_block_id
struct cf_flattener_switch_case * cases
unsigned int default_block_id
size_t control_flow_info_size
struct vkd3d_shader_location location
struct vkd3d_shader_instruction * instructions
unsigned int control_flow_depth
size_t instruction_capacity
struct cf_flattener_info * control_flow_info
size_t block_name_capacity
struct vsir_program * program
const char ** block_names
struct vkd3d_shader_instruction_array instructions
struct vkd3d_shader_src_param * outpointid_param
enum vkd3d_shader_opcode phase
enum vkd3d_shader_d3dbc_constant_register set
struct flat_constant_def * defs
struct vkd3d_shader_location last_ret_location
unsigned int instance_count
enum vkd3d_shader_opcode phase
struct vkd3d_shader_instruction_array instructions
unsigned int phase_body_idx
struct shader_signature * patch_constant_signature
struct vkd3d_shader_instruction_array instructions
unsigned int phase_body_idx
struct vkd3d_shader_dst_param * pc_dcl_params[MAX_REG_OUTPUT]
uint8_t pc_range_map[MAX_REG_OUTPUT][VKD3D_VEC4_SIZE]
struct vkd3d_shader_src_param * outpointid_param
unsigned int output_control_point_count
uint8_t output_range_map[MAX_REG_OUTPUT][VKD3D_VEC4_SIZE]
struct shader_signature * output_signature
struct vkd3d_shader_dst_param * output_dcl_params[MAX_REG_OUTPUT]
enum vkd3d_shader_type shader_type
enum vkd3d_shader_opcode phase
struct shader_signature * input_signature
struct vkd3d_shader_dst_param * input_dcl_params[MAX_REG_OUTPUT]
unsigned int instance_count
uint8_t input_range_map[MAX_REG_OUTPUT][VKD3D_VEC4_SIZE]
unsigned int target_label
unsigned int switch_label
unsigned int instance_count
unsigned int instruction_count
const char * semantic_name
enum vkd3d_shader_minimum_precision min_precision
enum vkd3d_shader_component_type component_type
unsigned int register_index
enum vkd3d_shader_sysval_semantic sysval_semantic
unsigned int semantic_index
unsigned int register_count
unsigned int next_temp_idx
struct vkd3d_shader_src_param * src
struct vkd3d_shader_dst_param * dst
struct ssas_to_temps_block_info::phi_incoming_to_temp * incomings
enum vkd3d_shader_component_type data_type
unsigned int patch_constant
unsigned int component_count
enum vsir_dimension dimension
enum vkd3d_data_type data_type
enum vsir_dimension dimension
bool invalid_instruction_idx
enum vkd3d_shader_opcode * blocks
struct validation_context::validation_context_temp_data * temps
const struct vsir_program * program
struct vkd3d_shader_message_context * message_context
struct vkd3d_shader_location null_location
struct validation_context::validation_context_ssa_data * ssas
enum vkd3d_shader_opcode phase
struct vkd3d_shader_register reg
struct vkd3d_shader_src_param * outpointid_param
struct vkd3d_shader_param_allocator src_params
struct vkd3d_shader_instruction * elements
struct vkd3d_shader_src_param * src
struct vkd3d_shader_location location
struct vkd3d_shader_register_semantic register_semantic
union vkd3d_shader_instruction::@6020 declaration
enum vkd3d_shader_opcode opcode
struct vkd3d_shader_dst_param * dst
struct vkd3d_shader_index_range index_range
enum vkd3d_shader_parameter_type type
struct vkd3d_shader_parameter_immediate_constant1 immediate_constant
enum vkd3d_shader_parameter_data_type data_type
enum vkd3d_shader_parameter_name name
union vkd3d_shader_parameter1::@5986 u
unsigned int parameter_count
const struct vkd3d_shader_parameter1 * parameters
const struct vkd3d_shader_parameter * parameters
unsigned int parameter_count
enum vkd3d_shader_spirv_environment environment
struct vkd3d_shader_register reg
enum vkd3d_shader_src_modifier modifiers
unsigned int varying_count
const struct vkd3d_shader_varying_map * varying_map
struct vsir_block ** blocks
struct vkd3d_shader_instruction * end
struct vkd3d_shader_instruction * begin
struct vsir_block_list predecessors successors
unsigned int target_count
struct vsir_block * successor
enum vsir_cfg_jump_type jump_type
unsigned int jump_target_temp_idx
struct vkd3d_shader_instruction * instructions
struct vsir_block_list * loop
struct vsir_block_list available_blocks
struct vsir_cfg_node_sorter::vsir_cfg_node_sorter_stack_item * stack
struct vsir_cfg_structure * structures
struct vsir_cfg_structure::@6006::vsir_cfg_structure_selection selection
struct vsir_block * block
union vsir_cfg_structure::@6006 u
@ STRUCTURE_TYPE_SELECTION
struct vsir_cfg_structure::@6006::vsir_cfg_structure_loop loop
struct vsir_cfg_structure * outer_loop
struct vsir_cfg_structure::@6006::vsir_cfg_structure_jump jump
struct vkd3d_shader_src_param * condition
enum vsir_cfg_structure::vsir_cfg_structure_type type
struct vsir_block * blocks
struct vsir_cfg_structure_list structured_program
struct vkd3d_shader_message_context * message_context
size_t loop_interval_count
struct vkd3d_string_buffer debug_buffer
size_t loop_interval_capacity
struct vsir_block_list * loops
struct vsir_cfg_emit_target * target
struct vsir_block * entry
struct vsir_block_list order
struct vsir_program * program
struct vsir_cfg::cfg_loop_interval * loop_intervals
struct vkd3d_shader_message_context * message_context
struct vsir_program * program
const struct vkd3d_shader_compile_info * compile_info
unsigned int src_param_count
unsigned int dst_param_count
void(* validate)(struct validation_context *ctx, const struct vkd3d_shader_instruction *instruction)
struct _LARGE_INTEGER::@2736 u
static unsigned int vkd3d_popcount(unsigned int v)
#define VKD3D_PRINTF_FUNC(fmt, args)
static bool bitmap_is_set(const uint32_t *map, unsigned int idx)
#define vkd3d_unreachable()
#define VKD3D_BITMAP_SIZE(x)
static bool vkd3d_bitmask_is_contiguous(unsigned int mask)
#define VKD3D_ASSERT(cond)
static int ascii_strcasecmp(const char *a, const char *b)
static int vkd3d_u32_compare(uint32_t x, uint32_t y)
static bool bitmap_clear(uint32_t *map, unsigned int idx)
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)
vkd3d_shader_d3dbc_constant_register
@ VKD3D_SHADER_D3DBC_BOOL_CONSTANT_REGISTER
@ VKD3D_SHADER_D3DBC_FLOAT_CONSTANT_REGISTER
@ VKD3D_SHADER_D3DBC_INT_CONSTANT_REGISTER
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_comparison_func
@ VKD3D_SHADER_COMPARISON_FUNC_EQUAL
@ VKD3D_SHADER_COMPARISON_FUNC_GREATER_EQUAL
@ VKD3D_SHADER_COMPARISON_FUNC_ALWAYS
@ VKD3D_SHADER_COMPARISON_FUNC_NEVER
@ VKD3D_SHADER_COMPARISON_FUNC_GREATER
@ VKD3D_SHADER_COMPARISON_FUNC_NOT_EQUAL
@ VKD3D_SHADER_COMPARISON_FUNC_LESS
@ VKD3D_SHADER_COMPARISON_FUNC_LESS_EQUAL
@ VKD3D_SHADER_PARAMETER_TYPE_SPECIALIZATION_CONSTANT
@ VKD3D_SHADER_PARAMETER_TYPE_IMMEDIATE_CONSTANT
@ VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32_VEC4
@ VKD3D_SHADER_PARAMETER_DATA_TYPE_UINT32
@ VKD3D_SHADER_PARAMETER_DATA_TYPE_FLOAT32
vkd3d_shader_sysval_semantic
@ VKD3D_SHADER_SV_VERTEX_ID
@ VKD3D_SHADER_SV_RENDER_TARGET_ARRAY_INDEX
@ 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_VIEWPORT_ARRAY_INDEX
@ 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_STENCIL_REF
@ VKD3D_SHADER_SV_POSITION
@ VKD3D_SHADER_TESSELLATOR_OUTPUT_TRIANGLE_CCW
vkd3d_shader_component_type
@ VKD3D_SHADER_COMPONENT_INT
@ VKD3D_SHADER_COMPONENT_UINT
@ VKD3D_SHADER_COMPONENT_FLOAT
@ VKD3D_SHADER_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN
#define VKD3D_SHADER_SWIZZLE_SHIFT(idx)
@ VKD3D_SHADER_MINIMUM_PRECISION_NONE
#define VKD3D_SHADER_SWIZZLE(x, y, z, w)
#define VKD3D_SHADER_NO_SWIZZLE
@ VKD3D_SHADER_TARGET_SPIRV_BINARY
@ VKD3D_SHADER_TARGET_GLSL
@ VKD3D_SHADER_TARGET_MSL
vkd3d_shader_spirv_environment
@ VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_0
@ VKD3D_SHADER_SPIRV_ENVIRONMENT_OPENGL_4_5
@ VKD3D_SHADER_SPIRV_ENVIRONMENT_VULKAN_1_1
vkd3d_shader_parameter_name
@ VKD3D_SHADER_PARAMETER_NAME_POINT_SPRITE
@ VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_FUNC
@ VKD3D_SHADER_PARAMETER_NAME_ALPHA_TEST_REF
@ VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MAX
@ VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE_MIN
@ VKD3D_SHADER_PARAMETER_NAME_POINT_SIZE
@ VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_0
@ VKD3D_SHADER_PARAMETER_NAME_FLAT_INTERPOLATION
@ VKD3D_SHADER_PARAMETER_NAME_CLIP_PLANE_MASK
bool shader_instruction_array_init(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve)
void vkd3d_string_buffer_init(struct vkd3d_string_buffer *buffer)
int vkd3d_string_buffer_vprintf(struct vkd3d_string_buffer *buffer, const char *format, va_list args)
bool shader_instruction_array_insert_at(struct vkd3d_shader_instruction_array *instructions, unsigned int idx, unsigned int count)
void vkd3d_string_buffer_cleanup(struct vkd3d_string_buffer *buffer)
void vkd3d_string_buffer_truncate(struct vkd3d_string_buffer *buffer, size_t size)
void shader_instruction_array_destroy(struct vkd3d_shader_instruction_array *instructions)
void vkd3d_string_buffer_clear(struct vkd3d_string_buffer *buffer)
void shader_signature_cleanup(struct shader_signature *signature)
bool shader_instruction_array_clone_instruction(struct vkd3d_shader_instruction_array *instructions, unsigned int dst, unsigned int src)
bool shader_instruction_array_reserve(struct vkd3d_shader_instruction_array *instructions, unsigned int reserve)
int vkd3d_string_buffer_printf(struct vkd3d_string_buffer *buffer, const char *format,...)
#define vkd3d_find_struct(c, t)
#define VKD3DSI_PRECISE_XYZW
static bool data_type_is_64_bit(enum vkd3d_data_type data_type)
@ VKD3D_SHADER_TYPE_VERTEX
@ VKD3D_SHADER_TYPE_GEOMETRY
@ VKD3D_SHADER_TYPE_PIXEL
@ VKD3D_SHADER_TYPE_DOMAIN
static uint32_t vsir_swizzle_from_writemask(unsigned int writemask)
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_INCONTROLPOINT
@ VKD3DSPR_OUTCONTROLPOINT
@ VKD3D_SHADER_ERROR_VSIR_INVALID_DATA_TYPE
@ VKD3D_SHADER_ERROR_VSIR_INVALID_SSA_USAGE
@ VKD3D_SHADER_ERROR_VSIR_INVALID_DEST_COUNT
@ VKD3D_SHADER_ERROR_VSIR_INVALID_REGISTER_TYPE
@ VKD3D_SHADER_ERROR_VSIR_INVALID_GS
@ VKD3D_SHADER_ERROR_VSIR_INVALID_PRECISION
@ VKD3D_SHADER_ERROR_VSIR_INVALID_WRITE_MASK
@ VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX_COUNT
@ VKD3D_SHADER_ERROR_VSIR_MISSING_SEMANTIC
@ VKD3D_SHADER_ERROR_VSIR_INVALID_PARAMETER
@ VKD3D_SHADER_ERROR_VSIR_INVALID_INDEX
@ VKD3D_SHADER_ERROR_VSIR_INVALID_MODIFIERS
@ VKD3D_SHADER_ERROR_VSIR_INVALID_DCL_TEMPS
@ VKD3D_SHADER_ERROR_VSIR_INVALID_HANDLER
@ VKD3D_SHADER_ERROR_VSIR_INVALID_SHIFT
@ VKD3D_SHADER_ERROR_VSIR_INVALID_SIGNATURE
@ VKD3D_SHADER_ERROR_VSIR_NOT_IMPLEMENTED
@ VKD3D_SHADER_ERROR_VSIR_DUPLICATE_DCL_TEMPS
@ VKD3D_SHADER_ERROR_VSIR_INVALID_SWIZZLE
@ VKD3D_SHADER_ERROR_VSIR_INVALID_CONTROL_FLOW
@ VKD3D_SHADER_ERROR_VSIR_INVALID_TESSELLATION
@ VKD3D_SHADER_ERROR_VSIR_INVALID_DIMENSION
@ VKD3D_SHADER_ERROR_VSIR_INVALID_SOURCE_COUNT
static unsigned int vkd3d_write_mask_from_component_count(unsigned int component_count)
#define VKD3DSP_WRITEMASK_ALL
@ VSIR_FULLY_NORMALISED_IO
@ VSIR_NORMALISED_HULL_CONTROL_POINT_IO
static struct vkd3d_shader_src_param * vsir_program_get_src_params(struct vsir_program *program, unsigned int count)
static bool register_is_constant_or_undef(const struct vkd3d_shader_register *reg)
static unsigned int vsir_write_mask_get_component_idx(uint32_t write_mask)
@ VSIR_RASTOUT_POINT_SIZE
static unsigned int vsir_swizzle_get_component(uint32_t swizzle, unsigned int idx)
@ VKD3DSIH_DCL_HS_JOIN_PHASE_INSTANCE_COUNT
@ VKD3DSIH_DCL_TESSELLATOR_OUTPUT_PRIMITIVE
@ VKD3DSIH_DCL_INPUT_CONTROL_POINT_COUNT
@ VKD3DSIH_DCL_INPUT_PRIMITIVE
@ VKD3DSIH_DCL_GS_INSTANCES
@ VKD3DSIH_DCL_OUTPUT_SIV
@ VKD3DSIH_DCL_VERTICES_OUT
@ VKD3DSIH_DCL_OUTPUT_TOPOLOGY
@ VKD3DSIH_DCL_GLOBAL_FLAGS
@ VKD3DSIH_DCL_HS_MAX_TESSFACTOR
@ VKD3DSIH_HS_CONTROL_POINT_PHASE
@ VKD3DSIH_DCL_INPUT_PS_SIV
@ VKD3DSIH_DCL_HS_FORK_PHASE_INSTANCE_COUNT
@ VKD3DSIH_DCL_THREAD_GROUP
@ VKD3DSIH_SWITCH_MONOLITHIC
@ VKD3DSIH_DCL_TESSELLATOR_DOMAIN
@ VKD3DSIH_DCL_OUTPUT_CONTROL_POINT_COUNT
@ VKD3DSIH_DCL_INDEX_RANGE
@ VKD3DSIH_DCL_INPUT_PS_SGV
@ VKD3DSIH_DCL_CONSTANT_BUFFER
@ VKD3DSIH_DCL_INDEXABLE_TEMP
@ VKD3DSIH_DCL_TESSELLATOR_PARTITIONING
#define SM1_COLOR_REGISTER_OFFSET
@ VKD3D_SHADER_REGISTER_PRECISION_DEFAULT
@ VKD3D_SHADER_REGISTER_PRECISION_COUNT
@ VKD3D_TESSELLATOR_DOMAIN_INVALID
@ VKD3D_TESSELLATOR_DOMAIN_COUNT
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)
@ VKD3D_SHADER_CONFIG_FLAG_FORCE_VALIDATION
static bool vsir_sysval_semantic_is_tess_factor(enum vkd3d_shader_sysval_semantic sysval_semantic)
@ VKD3D_SHADER_CONDITIONAL_OP_NZ
@ VKD3D_SHADER_CONDITIONAL_OP_Z
#define VKD3D_SHADER_MINIMUM_PRECISION_COUNT
static bool vsir_register_is_label(const struct vkd3d_shader_register *reg)
#define VKD3DSP_WRITEMASK_0
#define SM1_RASTOUT_REGISTER_OFFSET
#define VKD3DSP_WRITEMASK_1
static struct vkd3d_shader_src_param * shader_src_param_allocator_get(struct vkd3d_shader_param_allocator *allocator, unsigned int count)
#define SIGNATURE_TARGET_LOCATION_UNUSED
static enum vkd3d_shader_input_sysval_semantic vkd3d_siv_from_sysval(enum vkd3d_shader_sysval_semantic sysval)
#define VKD3DSP_WRITEMASK_2
@ VKD3D_ERROR_INVALID_ARGUMENT
@ VKD3D_ERROR_NOT_IMPLEMENTED
@ VKD3D_ERROR_INVALID_SHADER
@ VKD3D_ERROR_OUT_OF_MEMORY
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
static unsigned int block