75 unsigned int field_offset =
field->reg_offset[
regset];
80 *offset_component = field_offset % 4;
116 *offset_component = 0;
134 regset, offset_component, loc)))
152 unsigned int offset_component;
222 if (
temp->default_values)
233 temp->name = new_name;
247 && !
field->semantic.reported_missing)
250 "Field '%s' is missing a semantic.",
field->name);
251 field->semantic.reported_missing =
true;
269 if (
ctx->profile->major_version < 4)
296 if (
index >=
semantic->reported_duplicated_output_next_index)
299 "Output semantic \"%s%u\" is used multiple times.",
semantic->name,
index);
307 if (
index >=
semantic->reported_duplicated_input_incompatible_next_index
311 "Input semantic \"%s%u\" is used multiple times with incompatible types.",
314 "First declaration of \"%s%u\" is here.",
semantic->name,
index);
315 semantic->reported_duplicated_input_incompatible_next_index =
index + 1;
350 field_modifiers |= modifiers;
358 field_modifiers &= ~HLSL_INTERPOLATION_MODIFIERS_MASK;
362 return field_modifiers;
368 struct hlsl_type *
type = lhs->
node.data_type, *vector_type_src, *vector_type_dst;
386 vector_type_src = vector_type_dst;
400 modifiers, semantic, semantic_index +
i,
false, force_align, loc)))
454 elem_semantic_index = semantic_index
456 element_modifiers = modifiers;
464 hlsl_fixme(
ctx, &
field->loc,
"Prepend uniform copies for resource components within structs.");
469 elem_semantic_index =
semantic->index;
472 force_align = (
i == 0);
485 semantic, elem_semantic_index, force_align);
541 modifiers, semantic, semantic_index +
i,
true, force_align, loc)))
591 elem_semantic_index = semantic_index
593 element_modifiers = modifiers;
603 elem_semantic_index =
semantic->index;
606 force_align = (
i == 0);
618 semantic, elem_semantic_index, force_align);
765 for (
i = 0;
i < call_ctx->
count; ++
i)
770 "Recursive call to \"%s\".",
decl->func->name);
817 bool has_early_return =
false;
872 if (has_early_return)
888 if (has_early_return)
918 has_early_return =
true;
925 return_instr = instr;
940 if (has_early_return)
969 if (instr == return_instr)
983 if (
tail == &cf_instr->entry)
984 return has_early_return;
1003 return has_early_return;
1020 "Function \"%s\" is not defined.", decl->
func->name);
1034 unsigned int dim_count =
index->data_type->dimx;
1063 return &coords_load->
node;
1078 unsigned int x,
y,
k,
i;
1083 matrix_type =
swizzle->val.node->data_type;
1096 y = (
swizzle->swizzle >> (8 *
i + 4)) & 0xf;
1098 k =
y * matrix_type->
dimx +
x;
1151 params.format =
val->data_type->e.resource.format;
1179 for (
i = 0;
i <
mat->data_type->dimx; ++
i)
1216 const struct hlsl_type *src_type, *dst_type;
1225 src_type = cast->
operands[0].node->data_type;
1226 dst_type = cast->
node.data_type;
1239 if (dst_type->
dimx != 1)
1370 return (key_int > entry_int) - (key_int < entry_int);
1389 for (
r =
trace->record_count - 1;
r >= 0; --
r)
1392 return &
trace->records[
r];
1455 trace->record_count + 1,
sizeof(
trace->records[0])))
1462 ++
trace->record_count;
1466 unsigned int comp,
unsigned char writemask,
unsigned int time)
1472 for (
i = 0;
i < 4; ++
i)
1474 if (writemask & (1u <<
i))
1492 struct hlsl_type *
type,
unsigned int depth,
unsigned int comp_start,
unsigned char writemask,
1495 unsigned int i, subtype_comp_count;
1512 for (
i = 0;
i <
idx; ++
i)
1516 depth + 1, comp_start, writemask,
time);
1533 depth + 1,
i * subtype_comp_count, writemask,
time);
1541 unsigned char writemask,
unsigned int time)
1544 0, 0, writemask,
time);
1548 unsigned int comp,
unsigned char writemask,
struct hlsl_ir_node *instr,
unsigned int time)
1550 unsigned int i,
j = 0;
1552 for (
i = 0;
i < 4; ++
i)
1554 if (writemask & (1u <<
i))
1558 TRACE(
"Variable %s[%u] is written by instruction %p%s.\n",
1574 unsigned int time =
load->node.index;
1581 for (
i = 0;
i < instr_component_count; ++
i)
1591 new_instr =
value->node;
1593 else if (new_instr !=
value->node)
1595 TRACE(
"No single source for propagating load from %s[%u-%u]%s\n",
1602 TRACE(
"Load from %s[%u-%u]%s propagated as instruction %p%s.\n",
1613 new_instr = swizzle_node;
1627 struct hlsl_constant_value
values = {0};
1628 unsigned int time =
load->node.index;
1635 for (
i = 0;
i < instr_component_count; ++
i)
1650 TRACE(
"Load from %s[%u-%u]%s turned into a constant %p.\n",
1662 switch (
type->class)
1763 if (!
load->src.var->is_uniform)
1765 TRACE(
"Ignoring load from non-uniform object variable %s\n",
load->src.var->name);
1781 if (
load->sampler.var)
1808 unsigned int writemask = store->
writemask;
1840 switch (instr->
type)
1967 switch (instr->
type)
2041 unsigned int idx = 0;
2053 switch (
type->class)
2059 "Vector index is out of bounds. %u/%u",
idx,
type->dimx);
2074 if (
idx >=
type->e.array.elements_count)
2077 "Array index is out of bounds. %u/%u",
idx,
type->e.array.elements_count);
2107 "Expression for %s within \"%s\" cannot be resolved statically.",
2115 switch (instr->
type)
2121 if (!
load->resource.var->is_uniform)
2124 "Loaded resource must have a single uniform source.");
2129 "Loaded resource from \"%s\" must be determinable at compile time.",
2130 load->resource.var->name);
2134 if (
load->sampler.var)
2136 if (!
load->sampler.var->is_uniform)
2139 "Resource load sampler must have a single uniform source.");
2144 "Resource load sampler from \"%s\" must be determinable at compile time.",
2145 load->sampler.var->name);
2155 if (!store->
resource.var->is_uniform)
2158 "Accessed resource must have a single uniform source.");
2163 "Accessed resource from \"%s\" must be determinable at compile time.",
2204 src_type =
expr->operands[0].node->data_type;
2262 hlsl_fixme(
ctx, &instr->
loc,
"Array store rhs is not HLSL_IR_LOAD. Broadcast may be missing.");
2266 for (
i = 0;
i <
type->e.array.elements_count; ++
i)
2298 hlsl_fixme(
ctx, &instr->
loc,
"Struct store rhs is not HLSL_IR_LOAD. Broadcast may be missing.");
2302 for (
i = 0;
i <
type->e.record.field_count; ++
i)
2355 const struct hlsl_type *src_type, *dst_type;
2364 src_type = cast->
operands[0].node->data_type;
2365 dst_type = cast->
node.data_type;
2397 next_instr =
swizzle->val.node;
2462 bool missing_terminal_break =
false;
2472 bool terminal_break =
false;
2476 terminal_break = !!
list_next(&
s->cases, &
c->entry);
2485 missing_terminal_break |= !terminal_break;
2487 if (!terminal_break)
2492 "The 'default' case block is not terminated with 'break' or 'return'.");
2497 "Switch case block '%u' is not terminated with 'break' or 'return'.",
c->value);
2502 if (missing_terminal_break)
2535 c->is_default =
true;
2592 struct hlsl_constant_value
value;
2624 if (
type->dimx == 1)
2629 operands[0] = &vector_load->
node;
2667 hlsl_fixme(
ctx, &instr->
loc,
"Non-constant vector addressing on store. Unrolling may be missing.");
2682 struct hlsl_constant_value zero_value = {0};
2711 cut_index = deref->
path[i_cut].node;
2712 cut_type = deref->
var->data_type;
2713 for (
i = 0;
i < i_cut; ++
i)
2730 TRACE(
"Lowering non-constant %s load on variable '%s'.\n", row_major ?
"row_major" :
"array", deref->
var->name);
2737 struct hlsl_ir_node *const_i, *equals, *ternary, *var_store;
2745 operands[0] = cut_index;
2746 operands[1] = const_i;
2773 operands[0] = equals;
2774 operands[1] = &specific_load->
node;
2775 operands[2] = &var_load->
node;
2804 switch (
load->load_type)
2824 if (
load->sampler.var)
2848 for (
i = 0;
i <
load->resource.path_len; ++
i)
2852 arr_type = arr_type->
e.
array.type;
2860 var->is_uniform = 1;
2861 var->is_separated_resource =
true;
2867 if (
load->sampling_dim !=
var->data_type->sampler_dim)
2870 "Cannot split combined samplers from \"%s\" if they have different usage dimensions.",
2871 load->resource.var->name);
2904 struct list separated_resources;
2911 if (
var->is_separated_resource)
3013 if (
arg1->data_type->dimx != 2)
3082 struct hlsl_constant_value half_value;
3096 half_value.u[
i].f = 0.5f;
3181 struct hlsl_ir_node *
arg, *half, *two_pi, *reciprocal_two_pi, *neg_pi;
3182 struct hlsl_constant_value half_value, two_pi_value, reciprocal_two_pi_value, neg_pi_value;
3205 for (
i = 0;
i <
type->dimx; ++
i)
3207 half_value.u[
i].f = 0.5;
3208 two_pi_value.u[
i].f = 2.0 *
M_PI;
3209 reciprocal_two_pi_value.u[
i].f = 1.0 / (2.0 *
M_PI);
3210 neg_pi_value.u[
i].f = -
M_PI;
3233 if (
type->dimx == 1)
3246 for (
i = 0;
i <
type->dimx; ++
i)
3259 for (
i = 0;
i <
type->dimx; ++
i)
3284 struct hlsl_constant_value one_value;
3308 one_value.u[0].f = 1.0;
3309 one_value.u[1].f = 1.0;
3310 one_value.u[2].f = 1.0;
3311 one_value.u[3].f = 1.0;
3344 cond =
expr->operands[0].node;
3346 second =
expr->operands[2].node;
3350 hlsl_fixme(
ctx, &instr->
loc,
"Lower ternary of type other than scalar or vector.");
3367 memset(operands, 0,
sizeof(operands));
3369 operands[1] = second;
3370 operands[2] =
first;
3421 if (
ctx->profile->major_version >= 3)
3464 struct hlsl_constant_value one_value;
3467 one_value.u[0].f = 1.0;
3468 one_value.u[1].f = 1.0;
3469 one_value.u[2].f = 1.0;
3470 one_value.u[3].f = 1.0;
3490 memset(operands, 0,
sizeof(operands));
3510 struct hlsl_constant_value zero_value, one_value;
3540 memset(&zero_value, 0,
sizeof(zero_value));
3545 one_value.u[0].f = 1.0;
3546 one_value.u[1].f = 1.0;
3547 one_value.u[2].f = 1.0;
3548 one_value.u[3].f = 1.0;
3571 struct hlsl_constant_value zero_value, one_value;
3584 for (
i = 0;
i < 3; ++
i)
3593 memset(&zero_value, 0,
sizeof(zero_value));
3598 one_value.u[0].f = 1.0;
3599 one_value.u[1].f = 1.0;
3600 one_value.u[2].f = 1.0;
3601 one_value.u[3].f = 1.0;
3636 static const struct hlsl_constant_value zero_value;
3645 arg_type =
expr->operands[0].node->data_type;
3697 struct hlsl_ir_node *
arg1, *
arg2, *
xor, *and, *abs1, *abs2, *
div, *neg, *cast1, *cast2, *cast3, *high_bit;
3699 struct hlsl_constant_value high_bit_value;
3720 for (
i = 0;
i <
type->dimx; ++
i)
3721 high_bit_value.u[
i].u = 0x80000000;
3763 struct hlsl_ir_node *
arg1, *
arg2, *and, *abs1, *abs2, *
div, *neg, *cast1, *cast2, *cast3, *high_bit;
3765 struct hlsl_constant_value high_bit_value;
3782 for (
i = 0;
i <
type->dimx; ++
i)
3783 high_bit_value.u[
i].u = 0x80000000;
3858 unsigned int i, dimx;
3874 dimx =
arg1->data_type->dimx;
3881 for (
i = 0;
i < dimx; ++
i)
3891 for (
i = 1;
i < dimx; ++
i)
3906 struct hlsl_ir_node *
arg1, *
arg2, *
mul1, *neg1, *ge, *neg2, *
div, *mul2, *frc, *cond, *
one, *mul3;
3908 struct hlsl_constant_value one_value;
3945 for (
i = 0;
i <
type->dimx; ++
i)
3946 one_value.u[
i].f = 1.0f;
4008 operands[
i] = arg_cast;
4030 static const struct hlsl_constant_value zero_value;
4045 arg_type = jump->
condition.node->data_type;
4126 switch (instr->
type)
4198 deref->
var->indexable =
true;
4211 var->indexable =
false;
4246 if (
var->regs[
r].allocation_size > 0)
4257 "Object of type '%s' must be bound to register type '%c'.",
4263 var->regs[
r].allocated =
true;
4280 deref->
rel_offset.node->last_read = last_read;
4285 deref->
path[
i].node->last_read = last_read;
4303 switch (instr->
type)
4320 if (!
var->first_write)
4321 var->first_write = loop_first ?
min(instr->
index, loop_first) : instr->
index;
4322 store->
rhs.node->last_read = last_read;
4332 expr->operands[
i].node->last_read = last_read;
4341 iff->
condition.node->last_read = last_read;
4349 var->last_read =
max(
var->last_read, last_read);
4366 var->last_read =
max(
var->last_read, last_read);
4369 if ((
var =
load->sampler.var))
4371 var->last_read =
max(
var->last_read, last_read);
4375 if (
load->coords.node)
4376 load->coords.node->last_read = last_read;
4377 if (
load->texel_offset.node)
4378 load->texel_offset.node->last_read = last_read;
4380 load->lod.node->last_read = last_read;
4382 load->ddx.node->last_read = last_read;
4384 load->ddy.node->last_read = last_read;
4385 if (
load->sample_index.node)
4386 load->sample_index.node->last_read = last_read;
4388 load->cmp.node->last_read = last_read;
4396 var->last_read =
max(
var->last_read, last_read);
4398 store->coords.
node->last_read = last_read;
4399 store->
value.node->last_read = last_read;
4406 swizzle->val.node->last_read = last_read;
4413 index->val.node->last_read = last_read;
4414 index->idx.node->last_read = last_read;
4422 jump->
condition.node->last_read = last_read;
4432 s->selector.node->last_read = last_read;
4448 if (
var->is_uniform ||
var->is_input_semantic)
4449 var->first_write = 1;
4450 else if (
var->is_output_semantic)
4464 var->first_write =
var->last_read = 0;
4486 var->is_read =
true;
4520 unsigned int first_write,
unsigned int last_read,
uint32_t reg_idx,
int mode)
4527 const struct allocation *allocation = &
allocator->allocations[
i];
4533 if (allocation->reg == reg_idx
4534 && first_write < allocation->last_read && last_read > allocation->first_write)
4536 writemask &= ~allocation->writemask;
4537 if (allocation->mode !=
mode)
4549 unsigned int writemask,
unsigned int first_write,
unsigned int last_read,
int mode)
4551 struct allocation *allocation;
4558 allocation->reg = reg_idx;
4559 allocation->writemask = writemask;
4560 allocation->first_write = first_write;
4561 allocation->last_read = last_read;
4562 allocation->mode =
mode;
4571 unsigned int first_write,
unsigned int last_read,
unsigned int reg_size,
4574 struct hlsl_reg ret = {.allocation_size = 1, .allocated =
true};
4575 unsigned int required_size = force_align ? 4 :
reg_size;
4580 pref =
allocator->prioritize_smaller_writemasks ? 4 : required_size;
4581 for (; pref >= required_size; --pref)
4586 first_write, last_read, reg_idx,
mode);
4611 unsigned int first_write,
unsigned int last_read,
uint32_t reg_writemask,
uint32_t writemask,
int mode)
4618 for (reg_idx = 0;; ++reg_idx)
4621 reg_idx,
mode) & reg_writemask) == reg_writemask)
4628 ret.allocation_size = 1;
4630 ret.allocated =
true;
4637 unsigned int last_reg_mask = (1u << (
reg_size % 4)) - 1;
4648 if ((
writemask & last_reg_mask) != last_reg_mask)
4654 unsigned int first_write,
unsigned int last_read,
unsigned int reg_size,
int mode)
4660 for (reg_idx = 0;; ++reg_idx)
4670 (1u << (
reg_size % 4)) - 1, first_write, last_read,
mode);
4674 ret.allocated =
true;
4679 unsigned int first_write,
unsigned int last_read,
const struct hlsl_type *
type)
4693 static const char writemask_offset[] = {
'w',
'x',
'y',
'z'};
4731 if (dim !=
load->sampling_dim)
4740 "Inconsistent generic sampler usage dimension.");
4784 switch (instr->
type)
4790 if (!
load->src.var->is_uniform)
4830 bool is_separated =
var->is_separated_resource;
4832 if (
var->bind_count[
k] > 0)
4841 unsigned int reg_writemask = 0, dst_writemask = 0;
4867 instr->
index, instr->
last_read, reg_writemask, dst_writemask, 0);
4872 TRACE(
"Allocated anonymous expression @%u to %s (liveness %u-%u).\n", instr->
index,
4879 if (
var->is_input_semantic ||
var->is_output_semantic ||
var->is_uniform)
4896 var->first_write,
var->last_read,
var->data_type);
4917 switch (instr->
type)
4971 struct hlsl_constant_defs *defs = &
ctx->constant_defs;
4972 struct hlsl_constant_register *
reg;
4975 for (
i = 0;
i < defs->count; ++
i)
4977 reg = &defs->regs[
i];
4978 if (
reg->index == (component_index / 4))
4980 reg->value.f[component_index % 4] =
f;
4985 if (!
hlsl_array_reserve(
ctx, (
void **)&defs->regs, &defs->size, defs->count + 1,
sizeof(*defs->regs)))
4987 reg = &defs->regs[defs->count++];
4989 reg->index = component_index / 4;
4990 reg->value.f[component_index % 4] =
f;
5001 switch (instr->
type)
5016 for (
x = 0,
i = 0;
x < 4; ++
x)
5021 if (!(
constant->reg.writemask & (1u <<
x)))
5025 switch (
type->e.numeric.type)
5045 FIXME(
"Double constant.\n");
5102 if (to_sort_size > var_size)
5119 if (
var->is_uniform)
5133 if (
ctx->profile->major_version >= 3)
5178 if (
var->reg_reservation.reg_type ==
'c')
5180 unsigned int reg_idx =
var->reg_reservation.reg_index;
5191 "Overlapping register() reservations on 'c%u'.", reg_idx +
i);
5202 TRACE(
"Allocated reserved %s to %s.\n",
var->name,
5213 if (!
var->is_uniform || alloc_size == 0)
5219 TRACE(
"Allocated %s to %s.\n",
var->name,
5246 if (!(
var->is_input_semantic ||
var->is_output_semantic ||
var->is_uniform))
5259 if (
var->is_output_semantic)
5279 unsigned int modifiers;
5297 return modes[
i].
mode;
5306 static const char *
const shader_names[] =
5337 var->semantic.name,
var->semantic.index, output, &
type, &
reg);
5341 "Invalid semantic '%s'.",
var->semantic.name);
5345 if ((!output && !
var->last_read) || (output && !
var->first_write))
5354 ctx->domain,
var->semantic.name,
var->semantic.index, output, is_patch_constant_func))
5357 "Invalid semantic '%s'.",
var->semantic.name);
5362 reg = has_idx ?
var->semantic.index : 0;
5368 var->force_align =
true;
5374 TRACE(
"%s %s semantic %s[%u] matches predefined register %#x[%u].\n", shader_names[
version.type],
5375 output ?
"output" :
"input",
var->semantic.name,
var->semantic.index,
type,
reg);
5379 int mode = (
ctx->profile->major_version < 4)
5381 unsigned int reg_size = optimize ?
var->data_type->dimx : 4;
5396 bool is_patch_constant_func = entry_func ==
ctx->patch_constant_func;
5400 output_allocator.prioritize_smaller_writemasks =
true;
5404 if (
var->is_input_semantic)
5406 if (
var->is_output_semantic)
5421 if (
buffer->reservation.reg_type ==
'b'
5424 if (allocated_only && !
buffer->reg.allocated)
5439 if (register_reservation)
5441 var->buffer_offset = 4 *
var->reg_reservation.reg_index;
5442 var->has_explicit_bind_point = 1;
5446 if (
var->reg_reservation.offset_type ==
'c')
5448 if (
var->reg_reservation.offset_index % 4)
5453 "packoffset() reservations with matrix types must be aligned with the beginning of a register.");
5458 "packoffset() reservations with array types must be aligned with the beginning of a register.");
5463 "packoffset() reservations with struct types must be aligned with the beginning of a register.");
5469 if (
var->reg_reservation.offset_index != aligned_offset)
5471 "packoffset() reservations with vector types cannot span multiple registers.");
5474 var->buffer_offset =
var->reg_reservation.offset_index;
5475 var->has_explicit_bind_point = 1;
5483 TRACE(
"Allocated buffer offset %u to %s.\n",
var->buffer_offset,
var->name);
5505 unsigned int var1_reg_size, var2_reg_size;
5523 "Invalid packoffset() reservation: Variables %s and %s overlap.",
5538 buffer->manually_packed_elements =
true;
5540 buffer->automatically_packed_elements =
true;
5542 if (
buffer->manually_packed_elements &&
buffer->automatically_packed_elements)
5545 "packoffset() must be specified for all the buffer elements, or none of them.");
5594 var->buffer =
ctx->params_buffer;
5615 if (
buffer->reservation.reg_index > max_index)
5617 "Buffer reservation cb%u exceeds target's maximum (cb%u).",
5618 buffer->reservation.reg_index, max_index);
5620 if (allocated_buffer && allocated_buffer !=
buffer)
5623 "Multiple buffers bound to space %u, index %u.",
5626 "Buffer %s is already bound to space %u, index %u.",
5636 buffer->reg.allocation_size = 1;
5637 buffer->reg.allocated =
true;
5638 TRACE(
"Allocated reserved %s to space %u, index %u, id %u.\n",
5647 if (
index > max_index)
5649 "Too many buffers reserved, target's maximum is %u.", max_index);
5657 buffer->reg.allocation_size = 1;
5658 buffer->reg.allocated =
true;
5665 "Constant buffers must be allocated to register type 'b'.");
5670 FIXME(
"Allocate registers for texture buffers.\n");
5688 start =
var->reg_reservation.reg_index;
5691 if (
var->reg_reservation.reg_space !=
space)
5694 if (!
var->regs[
regset].allocated && allocated_only)
5728 min_index =
max(min_index,
var->semantic.index + 1);
5745 if (
var->regs[
regset].index < min_index)
5749 "UAV index (%u) must be higher than the maximum render target index (%u).",
5750 var->regs[
regset].index, min_index - 1);
5763 if (reserved_object && reserved_object !=
var && reserved_object != last_reported)
5766 "Multiple variables bound to space %u, %c%u.", regset_name,
space,
index);
5768 "Variable '%s' is already bound to space %u, %c%u.",
5770 last_reported = reserved_object;
5778 TRACE(
"Allocated reserved variable %s to space %u, indices %c%u-%c%u, id %u.\n",
5784 unsigned int index = min_index;
5804 TRACE(
"Allocated variable %s to space 0, indices %c%u-%c%u, id %u.\n",
var->name,
5823 unsigned int idx = 0;
5835 switch (
type->class)
5853 if (
idx >=
type->e.array.elements_count)
5859 for (
k = 0;
k <
idx; ++
k)
5880 bool index_is_constant =
true;
5888 unsigned int idx = 0;
5899 switch (
type->class)
5902 if (
idx >=
type->e.array.elements_count)
5922 index_is_constant =
false;
5924 switch (
type->class)
5927 idx =
type->e.array.elements_count - 1;
5946 return index_is_constant;
5971 "Dereference is out of bounds. %u/%u", *
offset,
size);
6004 ret.writemask = 0xf & (0xf << (
offset % 4));
6022 "Wrong type for the argument %u of [%s]: expected string, but got %s.",
6035 ctx->found_numthreads = 1;
6037 if (
attr->args_count != 3)
6040 "Expected 3 parameters for [numthreads] attribute, but got %u.",
attr->args_count);
6044 for (
i = 0;
i <
attr->args_count; ++
i)
6057 "Wrong type for argument %u of [numthreads]: expected int or uint, but got %s.",
6065 hlsl_fixme(
ctx, &instr->
loc,
"Non-constant expression in [numthreads] initializer.");
6073 "Thread count must be a positive integer.");
6083 if (
attr->args_count != 1)
6086 "Expected 1 parameter for [domain] attribute, but got %u.",
attr->args_count);
6101 "Invalid tessellator domain \"%s\": expected \"isoline\", \"tri\", or \"quad\".",
6111 if (
attr->args_count != 1)
6114 "Expected 1 parameter for [outputcontrolpoints] attribute, but got %u.",
attr->args_count);
6118 instr =
attr->args[0].node;
6128 "Wrong type for argument 0 of [outputcontrolpoints]: expected int or uint, but got %s.",
6136 hlsl_fixme(
ctx, &instr->
loc,
"Non-constant expression in [outputcontrolpoints] initializer.");
6144 "Output control point count must be between 0 and 32.");
6153 if (
attr->args_count != 1)
6156 "Expected 1 parameter for [outputtopology] attribute, but got %u.",
attr->args_count);
6173 "Invalid tessellator output topology \"%s\": "
6174 "expected \"point\", \"line\", \"triangle_cw\", or \"triangle_ccw\".",
value);
6181 if (
attr->args_count != 1)
6184 "Expected 1 parameter for [partitioning] attribute, but got %u.",
attr->args_count);
6201 "Invalid tessellator partitioning \"%s\": "
6202 "expected \"integer\", \"pow2\", \"fractional_even\", or \"fractional_odd\".",
value);
6211 if (
attr->args_count != 1)
6214 "Expected 1 parameter for [patchconstantfunc] attribute, but got %u.",
attr->args_count);
6221 ctx->patch_constant_func =
NULL;
6229 ctx->patch_constant_func = decl;
6235 if (!
ctx->patch_constant_func)
6237 "Patch constant function \"%s\" is not defined.",
name);
6266 "Ignoring unknown attribute \"%s\".", entry_func->
attrs[
i]->name);
6275 "Entry point \"%s\" is missing a [domain] attribute.", entry_func->
func->name);
6281 "Entry point \"%s\" is missing a [outputcontrolpoints] attribute.", entry_func->
func->name);
6284 if (!
ctx->output_primitive)
6287 "Entry point \"%s\" is missing a [outputtopology] attribute.", entry_func->
func->name);
6290 if (!
ctx->partitioning)
6293 "Entry point \"%s\" is missing a [partitioning] attribute.", entry_func->
func->name);
6296 if (!
ctx->patch_constant_func)
6299 "Entry point \"%s\" is missing a [patchconstantfunc] attribute.", entry_func->
func->name);
6301 else if (
ctx->patch_constant_func == entry_func)
6304 "Patch constant function cannot be the entry point function.");
6310 switch (
ctx->domain)
6316 "Triangle output topologies are not available for isoline domains.");
6322 "Line output topologies are not available for triangle domains.");
6328 "Line output topologies are not available for quad domains.");
6439 unsigned int register_index,
mask, use_mask;
6440 const char *
name =
var->semantic.name;
6450 ctx->domain,
var->semantic.name,
var->semantic.index, output, is_patch_constant_func);
6457 register_index = has_idx ?
var->semantic.index : ~0
u;
6458 mask = (1u <<
var->data_type->dimx) - 1;
6469 switch (
var->data_type->e.numeric.type)
6488 "Invalid data type %s for semantic variable %s.",
string->buffer,
var->name);
6499 name =
"SV_Position";
6503 if ((!output && !
var->last_read) || (output && !
var->first_write))
6507 var->semantic.name,
var->semantic.index, output, &
type, ®ister_index))
6526 mask = (1 <<
var->data_type->dimx) - 1;
6531 if (
var->data_type->dimx > 1)
6533 "PSIZE output must have only 1 component in this shader model.");
6540 "FOG output must have only 1 component in this shader model.");
6561 element->semantic_index =
var->semantic.index;
6564 element->register_index = register_index;
6565 element->target_location = register_index;
6568 element->used_mask = use_mask;
6577 bool is_patch_constant_func =
func ==
ctx->patch_constant_func;
6582 if (
var->is_input_semantic)
6584 if (is_patch_constant_func)
6591 if (
var->is_output_semantic)
6593 if (is_patch_constant_func)
6612 switch (
type->e.numeric.type)
6656 for (
i = 0;
i <
ctx->constant_defs.count; ++
i)
6658 const struct hlsl_constant_register *constant_reg = &
ctx->constant_defs.regs[
i];
6672 ++instructions->
count;
6674 dst_param = &ins->
dst[0];
6677 ins->
dst[0].reg.idx[0].offset = constant_reg->index;
6680 src_param = &ins->
src[0];
6684 src_param->
reg.non_uniform =
false;
6687 for (
x = 0;
x < 4; ++
x)
6688 src_param->
reg.u.immconst_f32[
x] = constant_reg->value.f[
x];
6754 ++instructions->
count;
6757 semantic->resource_type = resource_type;
6759 dst_param = &
semantic->resource.reg;
6791 ++instructions->
count;
6804 src->reg.u.immconst_u32[0] =
value->u[0].u;
6809 for (
i = 0,
j = 0;
i < 4; ++
i)
6811 if ((map_writemask & (1u <<
i)) && (
j <
width))
6812 src->reg.u.immconst_u32[
i] =
value->u[
j++].u;
6814 src->reg.u.immconst_u32[
i] = 0;
6833 src->reg.idx[0].offset = instr->
reg.id;
6844 dst->reg.idx[0].offset = instr->
reg.id;
6846 dst->write_mask = instr->
reg.writemask;
6863 src_param = &ins->
src[0];
6868 dst_param = &ins->
dst[0];
6870 dst_param->
reg.idx[0].offset = instr->
reg.id;
6887 src_param = &ins->
src[0];
6908 if (
expr->operands[
i].node)
6916 dst_param = &ins->
dst[0];
6924 src_param = &ins->
src[
i];
6948 for (
i = 0;
i < 4; ++
i)
6950 if (instr->
reg.writemask & (1u <<
i))
6955 dst_param = &ins->
dst[0];
6957 dst_param->
reg.idx[0].offset = instr->
reg.id;
6960 src_param = &ins->
src[0];
6962 src_param->
reg.idx[0].offset = operand->
reg.id;
6985 dst_param = &ins->
dst[0];
6987 dst_param->
reg.idx[0].offset = instr->
reg.id;
6990 src_param = &ins->
src[0];
6992 src_param->
reg.idx[0].offset = operand->
reg.id;
6995 if (
ctx->profile->major_version < 3)
6997 src_param = &ins->
src[1];
6999 src_param->
reg.idx[0].offset =
ctx->d3dsincosconst1.id;
7002 src_param = &ins->
src[1];
7004 src_param->
reg.idx[0].offset =
ctx->d3dsincosconst2.id;
7012 const struct hlsl_type *src_type, *dst_type;
7016 src_type =
arg1->data_type;
7017 instr = &
expr->node;
7039 if (
ctx->double_as_float_alias)
7045 "The 'double' type is not supported for the %s profile.",
ctx->profile->name);
7086 if (
ctx->double_as_float_alias)
7092 "The 'double' type is not supported for the %s profile.",
ctx->profile->name);
7185 switch (
expr->operands[0].node->data_type->dimx)
7259 register_index =
reg.id;
7262 if (deref->
var->is_output_semantic)
7264 const char *semantic_name = deref->
var->semantic.name;
7276 deref->
var->semantic.index,
true, &
type, ®ister_index))
7280 register_index =
reg.id;
7298 dst_param->
reg.idx[0].offset = register_index;
7301 hlsl_fixme(
ctx, loc,
"Translate relative addressing on dst register for vsir.");
7311 unsigned int writemask;
7316 unsigned int sampler_offset;
7324 else if (deref->
var->is_uniform)
7329 register_index =
reg.id;
7333 else if (deref->
var->is_input_semantic)
7339 deref->
var->semantic.index,
false, &
type, ®ister_index))
7348 register_index =
reg.id;
7358 register_index =
reg.id;
7363 src_param->
reg.idx[0].offset = register_index;
7367 hlsl_fixme(
ctx, loc,
"Translate relative addressing on src register for vsir.");
7382 dst_param = &ins->
dst[0];
7384 dst_param->
reg.idx[0].offset = instr->
reg.id;
7407 switch (
load->load_type)
7437 dst_param = &ins->
dst[0];
7439 dst_param->
reg.idx[0].offset = instr->
reg.id;
7442 src_param = &ins->
src[0];
7450 src_param = &ins->
src[2];
7453 src_param = &ins->
src[3];
7472 dst_param = &ins->
dst[0];
7474 dst_param->
reg.idx[0].offset = instr->
reg.id;
7483 src_param = &ins->
src[0];
7486 src_param->
reg.idx[0].offset =
val->reg.id;
7504 src_param = &ins->
src[0];
7521 dst_param = &ins->
dst[0];
7552 src_param = &ins->
src[0];
7556 src_param = &ins->
src[1];
7586 switch (instr->
type)
7671 loc = &
program->instructions.elements[
program->instructions.count - 1].location;
7687 loc = &
program->instructions.elements[
program->instructions.count - 1].location;
7705 const bool output =
var->is_output_semantic;
7711 unsigned int idx = 0;
7716 ctx->domain,
var->semantic.name,
var->semantic.index, output, is_patch_constant_func);
7720 if (
var->is_input_semantic)
7755 idx =
var->semantic.index;
7756 write_mask = (1u <<
var->data_type->dimx) - 1;
7790 var->semantic.index);
7797 dst_param->
reg.idx[0].offset =
idx;
7867 struct hlsl_constant_value
value = {0};
7875 dst_param = &ins->
dst[0];
7895 }
one = { .f = 1.0 };
8007 if (
expr->operands[
i].node)
8014 dst_param = &ins->
dst[dst_idx];
8017 null_param = &ins->
dst[1 - dst_idx];
8031 struct hlsl_constant_value
value = {0};
8039 dst_param = &ins->
dst[0];
8042 value.u[0].f = 1.0f;
8043 value.u[1].f = 1.0f;
8044 value.u[2].f = 1.0f;
8045 value.u[3].f = 1.0f;
8059 if (
expr->operands[0].node)
8060 src_type =
expr->operands[0].node->data_type;
8277 switch (
expr->operands[0].node->data_type->dimx)
8341 hlsl_fixme(
ctx, &
expr->node.loc,
"SM4 greater-than-or-equal between \"%s\" operands.",
8470 hlsl_fixme(
ctx, &
expr->node.loc,
"SM4 %s multiplication expression.", dst_type_name);
8529 switch (instr->
type)
8576 bool is_patch_constant_func =
func ==
ctx->patch_constant_func;
8593 if ((
var->is_input_semantic &&
var->last_read)
8594 || (
var->is_output_semantic &&
var->first_write))
8605 if (
var->is_uniform ||
var->is_input_semantic ||
var->is_output_semantic)
8651 program->thread_group_size.x =
ctx->thread_count[0];
8652 program->thread_group_size.y =
ctx->thread_count[1];
8653 program->thread_group_size.z =
ctx->thread_count[2];
8668 if (
node == stop_point)
8687 *found_block =
block;
8717 unsigned int max_iterations,
i;
8721 for (
i = 0;
i < max_iterations; ++
i)
8737 if (jump_block != loop_parent)
8741 "Unable to unroll loop, unrolling loops with conditional jumps is currently not supported.");
8760 "Unable to unroll loop, maximum iterations reached (%u).", max_iterations);
8796 switch (instr->
type)
8808 *containing_block =
block;
8887 static const char template[] =
8888 "typedef uint%u uintX;\n"
8889 "float%u soft_f16tof32(uintX x)\n"
8891 " uintX mantissa = x & 0x3ff;\n"
8892 " uintX high2 = mantissa >> 8;\n"
8893 " uintX high2_check = high2 ? high2 : mantissa;\n"
8894 " uintX high6 = high2_check >> 4;\n"
8895 " uintX high6_check = high6 ? high6 : high2_check;\n"
8897 " uintX high8 = high6_check >> 2;\n"
8898 " uintX high8_check = (high8 ? high8 : high6_check) >> 1;\n"
8899 " uintX shift = high6 ? (high2 ? 12 : 4) : (high2 ? 8 : 0);\n"
8900 " shift = high8 ? shift + 2 : shift;\n"
8901 " shift = high8_check ? shift + 1 : shift;\n"
8902 " shift = -shift + 10;\n"
8903 " shift = mantissa ? shift : 11;\n"
8904 " uintX subnormal_mantissa = ((mantissa << shift) << 23) & 0x7fe000;\n"
8905 " uintX subnormal_exp = -(shift << 23) + 0x38800000;\n"
8906 " uintX subnormal_val = subnormal_exp + subnormal_mantissa;\n"
8907 " uintX subnormal_or_zero = mantissa ? subnormal_val : 0;\n"
8909 " uintX exponent = (((x >> 10) << 23) & 0xf800000) + 0x38000000;\n"
8911 " uintX low_3 = (x << 13) & 0x7fe000;\n"
8912 " uintX normalized_val = exponent + low_3;\n"
8913 " uintX inf_nan_val = low_3 + 0x7f800000;\n"
8915 " uintX exp_mask = 0x7c00;\n"
8916 " uintX is_inf_nan = (x & exp_mask) == exp_mask;\n"
8917 " uintX is_normalized = x & exp_mask;\n"
8919 " uintX check = is_inf_nan ? inf_nan_val : normalized_val;\n"
8920 " uintX exp_mantissa = (is_normalized ? check : subnormal_or_zero) & 0x7fffe000;\n"
8921 " uintX sign_bit = (x << 16) & 0x80000000;\n"
8923 " return asfloat(exp_mantissa + sign_bit);\n"
8935 rhs =
expr->operands[0].node;
8944 lhs =
func->parameters.vars[0];
8971 static const char template[] =
8972 "typedef uint%u uintX;\n"
8973 "uintX soft_f32tof16(float%u x)\n"
8975 " uintX v = asuint(x);\n"
8976 " uintX v_abs = v & 0x7fffffff;\n"
8977 " uintX sign_bit = (v >> 16) & 0x8000;\n"
8978 " uintX exp = (v >> 23) & 0xff;\n"
8979 " uintX mantissa = v & 0x7fffff;\n"
8981 " uintX nan = (v & 0x7f800000) == 0x7f800000;\n"
8984 " val = 113 - exp;\n"
8985 " val = (mantissa + 0x800000) >> val;\n"
8988 " val = (exp - 127) < -38 ? 0 : val;\n"
8990 " val = v_abs < 0x38800000 ? val : (v_abs + 0xc8000000) >> 13;\n"
8991 " val = v_abs > 0x47ffe000 ? 0x7bff : val;\n"
8993 " nan16 = (((v >> 13) | (v >> 3) | v) & 0x3ff) + 0x7c00;\n"
8994 " val = nan ? nan16 : val;\n"
8996 " return (val & 0x7fff) + sign_bit;\n"
9007 rhs =
expr->operands[0].node;
9016 lhs =
func->parameters.vars[0];
9037 struct hlsl_block static_initializers, global_uniforms;
9085 "Patch constant function parameter \"%s\" cannot be uniform.",
var->name);
9092 && !
var->semantic.name)
9095 "Parameter \"%s\" is missing a semantic.",
var->name);
9096 var->semantic.reported_missing =
true;
9109 "Entry point \"%s\" is missing a return value semantic.", entry_func->
func->name);
9114 if (
profile->major_version >= 4)
9135 if (
profile->major_version >= 4)
9145 if (
profile->major_version < 4)
9172 if (
profile->major_version < 2)
9217 "Entry point \"%s\" is missing a [numthreads] attribute.", entry_func->
func->name);
9220 "Entry point \"%s\" is missing a [domain] attribute.", entry_func->
func->name);
9243 if (
profile->major_version < 4)
#define is_range_available(RangeList, Start, End, pAvail)
struct outqueuenode * tail
static const unsigned char reg_size[]
pair cons(caddr_t car, pair cdr)
static void list_remove(struct list_entry *entry)
static int list_empty(struct list_entry *head)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_add_head(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
static void xor(unsigned char *dst, const unsigned char *a, const unsigned char *b, const int count)
unsigned int component_count
void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer)
bool sm1_register_from_semantic_name(const struct vkd3d_shader_version *version, const char *semantic_name, unsigned int semantic_index, bool output, enum vkd3d_shader_register_type *type, unsigned int *reg)
bool sm1_usage_from_semantic_name(const char *semantic_name, uint32_t semantic_index, enum vkd3d_decl_usage *usage, uint32_t *usage_idx)
int d3dbc_compile(struct vsir_program *program, uint64_t config_flags, const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_code *ctab, struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context)
static BOOL is_vertex_shader(DWORD version)
static WCHAR available[MAX_STRING_RESOURCE_LEN]
static const WCHAR version[]
_ACRTIMP double __cdecl floor(double)
_ACRTIMP div_t __cdecl div(int, int)
_ACRTIMP int __cdecl strcmp(const char *, const char *)
void sincos(double x, double *s, double *c)
static void list_move_tail(struct list_head *list, struct list_head *head)
GLint GLint GLsizei GLsizei GLsizei depth
GLint GLint GLint GLint GLint x
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLint GLint GLint GLint GLint GLint y
GLdouble GLdouble GLdouble r
GLint GLint GLsizei width
GLuint GLuint GLuint GLuint arg1
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
GLenum const GLfloat * params
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
GLboolean GLenum GLenum GLvoid * values
GLenum GLenum GLenum input
GLsizeiptr const GLvoid GLenum usage
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
unsigned int hlsl_type_get_array_element_reg_size(const struct hlsl_type *type, enum hlsl_regset regset)
struct hlsl_ir_var * hlsl_get_var(struct hlsl_scope *scope, const char *name)
bool hlsl_clone_block(struct hlsl_ctx *ctx, struct hlsl_block *dst_block, const struct hlsl_block *src_block)
struct vkd3d_string_buffer * hlsl_type_to_string(struct hlsl_ctx *ctx, const struct hlsl_type *type)
void hlsl_dump_function(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl *func)
bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2)
struct hlsl_ir_node * hlsl_new_float_constant(struct hlsl_ctx *ctx, float f, const struct vkd3d_shader_location *loc)
bool hlsl_copy_deref(struct hlsl_ctx *ctx, struct hlsl_deref *deref, const struct hlsl_deref *other)
unsigned int hlsl_type_get_sm4_offset(const struct hlsl_type *type, unsigned int offset)
bool hlsl_type_is_resource(const struct hlsl_type *type)
void hlsl_block_cleanup(struct hlsl_block *block)
const char * hlsl_jump_type_to_string(enum hlsl_ir_jump_type type)
struct hlsl_ir_var * hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *template, struct hlsl_type *type, const struct vkd3d_shader_location *loc)
struct hlsl_ir_node * hlsl_new_constant(struct hlsl_ctx *ctx, struct hlsl_type *type, const struct hlsl_constant_value *value, const struct vkd3d_shader_location *loc)
void hlsl_fixme(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc, const char *fmt,...)
unsigned int hlsl_type_component_count(const struct hlsl_type *type)
bool hlsl_type_is_row_major(const struct hlsl_type *type)
struct hlsl_ir_var * hlsl_new_synthetic_var_named(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type, const struct vkd3d_shader_location *loc, bool dummy_scope)
void hlsl_note(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc, enum vkd3d_shader_log_level level, const char *fmt,...)
void hlsl_free_ir_switch_case(struct hlsl_ir_switch_case *c)
void hlsl_init_simple_deref_from_var(struct hlsl_deref *deref, struct hlsl_ir_var *var)
bool hlsl_index_is_noncontiguous(struct hlsl_ir_index *index)
struct hlsl_ir_node * hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, struct hlsl_ir_node *idx, struct hlsl_ir_node *rhs, unsigned int writemask, const struct vkd3d_shader_location *loc)
bool hlsl_clone_semantic(struct hlsl_ctx *ctx, struct hlsl_semantic *dst, const struct hlsl_semantic *src)
struct hlsl_ir_node * hlsl_new_cast(struct hlsl_ctx *ctx, struct hlsl_ir_node *node, struct hlsl_type *type, const struct vkd3d_shader_location *loc)
bool hlsl_index_is_resource_access(struct hlsl_ir_index *index)
const char * debug_hlsl_type(struct hlsl_ctx *ctx, const struct hlsl_type *type)
bool hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, const struct hlsl_deref *lhs, unsigned int comp, struct hlsl_ir_node *rhs)
uint32_t hlsl_map_swizzle(uint32_t swizzle, unsigned int writemask)
struct hlsl_ir_node * hlsl_new_swizzle(struct hlsl_ctx *ctx, uint32_t s, unsigned int components, struct hlsl_ir_node *val, const struct vkd3d_shader_location *loc)
const char * debug_hlsl_swizzle(uint32_t swizzle, unsigned int size)
struct hlsl_ir_node * hlsl_new_unary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg, const struct vkd3d_shader_location *loc)
void hlsl_cleanup_deref(struct hlsl_deref *deref)
void hlsl_cleanup_semantic(struct hlsl_semantic *semantic)
struct hlsl_ir_load * hlsl_new_var_load(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, const struct vkd3d_shader_location *loc)
void hlsl_error(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc, enum vkd3d_shader_error error, const char *fmt,...)
void hlsl_warning(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc, enum vkd3d_shader_error error, const char *fmt,...)
unsigned int hlsl_type_element_count(const struct hlsl_type *type)
uint32_t hlsl_swizzle_from_writemask(unsigned int writemask)
struct hlsl_ir_node * hlsl_new_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS], struct hlsl_type *data_type, const struct vkd3d_shader_location *loc)
uint32_t hlsl_combine_swizzles(uint32_t first, uint32_t second, unsigned int dim)
const struct hlsl_type * hlsl_get_multiarray_element_type(const struct hlsl_type *type)
struct hlsl_ir_node * hlsl_new_ternary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg1, struct hlsl_ir_node *arg2, struct hlsl_ir_node *arg3)
struct hlsl_ir_node * hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n, const struct vkd3d_shader_location *loc)
struct hlsl_type * hlsl_get_element_type_from_path_index(struct hlsl_ctx *ctx, const struct hlsl_type *type, struct hlsl_ir_node *idx)
struct hlsl_type * hlsl_deref_get_type(struct hlsl_ctx *ctx, const struct hlsl_deref *deref)
void hlsl_replace_node(struct hlsl_ir_node *old, struct hlsl_ir_node *new)
const char * debug_hlsl_writemask(unsigned int writemask)
unsigned int hlsl_type_major_size(const struct hlsl_type *type)
struct hlsl_ir_node * hlsl_new_resource_load(struct hlsl_ctx *ctx, const struct hlsl_resource_load_params *params, const struct vkd3d_shader_location *loc)
const char * hlsl_node_type_to_string(enum hlsl_ir_node_type type)
unsigned int hlsl_combine_writemasks(unsigned int first, unsigned int second)
struct hlsl_type * hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, struct hlsl_type *format, unsigned int sample_count)
struct hlsl_type * hlsl_new_array_type(struct hlsl_ctx *ctx, struct hlsl_type *basic_type, unsigned int array_size)
struct hlsl_ir_node * hlsl_new_binary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg1, struct hlsl_ir_node *arg2)
struct hlsl_ir_switch_case * hlsl_new_switch_case(struct hlsl_ctx *ctx, unsigned int value, bool is_default, struct hlsl_block *body, const struct vkd3d_shader_location *loc)
struct hlsl_ir_load * hlsl_new_load_index(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, struct hlsl_ir_node *idx, const struct vkd3d_shader_location *loc)
char * hlsl_sprintf_alloc(struct hlsl_ctx *ctx, const char *fmt,...)
struct hlsl_ir_node * hlsl_new_call(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *decl, const struct vkd3d_shader_location *loc)
unsigned int hlsl_type_minor_size(const struct hlsl_type *type)
struct hlsl_ir_var * hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type, const struct vkd3d_shader_location *loc, const struct hlsl_semantic *semantic, uint32_t modifiers, const struct hlsl_reg_reservation *reg_reservation)
const char * debug_hlsl_expr_op(enum hlsl_ir_expr_op op)
struct hlsl_ir_node * hlsl_new_vsir_instruction_ref(struct hlsl_ctx *ctx, unsigned int vsir_instr_idx, struct hlsl_type *type, const struct hlsl_reg *reg, const struct vkd3d_shader_location *loc)
enum hlsl_regset hlsl_deref_get_regset(struct hlsl_ctx *ctx, const struct hlsl_deref *deref)
struct hlsl_ir_function * hlsl_get_function(struct hlsl_ctx *ctx, const char *name)
struct hlsl_ir_node * hlsl_new_jump(struct hlsl_ctx *ctx, enum hlsl_ir_jump_type type, struct hlsl_ir_node *condition, const struct vkd3d_shader_location *loc)
void hlsl_free_instr(struct hlsl_ir_node *node)
struct hlsl_ir_function_decl * hlsl_compile_internal_function(struct hlsl_ctx *ctx, const char *name, const char *hlsl)
struct hlsl_ir_node * hlsl_new_if(struct hlsl_ctx *ctx, struct hlsl_ir_node *condition, struct hlsl_block *then_block, struct hlsl_block *else_block, const struct vkd3d_shader_location *loc)
struct hlsl_ir_node * hlsl_new_bool_constant(struct hlsl_ctx *ctx, bool b, const struct vkd3d_shader_location *loc)
struct hlsl_ir_node * hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs)
struct hlsl_ir_load * hlsl_new_load_parent(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, const struct vkd3d_shader_location *loc)
#define HLSL_STORAGE_CENTROID
static void hlsl_src_from_node(struct hlsl_src *src, struct hlsl_ir_node *node)
static bool hlsl_array_reserve(struct hlsl_ctx *ctx, void **elements, size_t *capacity, size_t element_count, size_t element_size)
@ HLSL_CLASS_COMPUTE_SHADER
@ HLSL_CLASS_RASTERIZER_STATE
@ HLSL_CLASS_RENDER_TARGET_VIEW
@ HLSL_CLASS_VERTEX_SHADER
@ HLSL_CLASS_GEOMETRY_SHADER
@ HLSL_CLASS_DEPTH_STENCIL_VIEW
@ HLSL_CLASS_LAST_NUMERIC
@ HLSL_CLASS_CONSTANT_BUFFER
@ HLSL_CLASS_EFFECT_GROUP
@ HLSL_CLASS_PIXEL_SHADER
@ HLSL_CLASS_DOMAIN_SHADER
@ HLSL_CLASS_DEPTH_STENCIL_STATE
@ HLSL_IR_LOOP_FORCE_UNROLL
@ HLSL_IR_LOOP_FORCE_LOOP
static struct hlsl_type * hlsl_get_vector_type(const struct hlsl_ctx *ctx, enum hlsl_base_type base_type, unsigned int dimx)
#define HLSL_STORAGE_UNIFORM
@ HLSL_REGSET_LAST_OBJECT
static void hlsl_block_init(struct hlsl_block *block)
@ HLSL_IR_STATEBLOCK_CONSTANT
@ HLSL_IR_VSIR_INSTRUCTION_REF
@ HLSL_IR_STRING_CONSTANT
static unsigned int hlsl_sampler_dim_count(enum hlsl_sampler_dim dim)
static struct vkd3d_string_buffer * hlsl_get_string_buffer(struct hlsl_ctx *ctx)
#define HLSL_SWIZZLE(x, y, z, w)
static struct hlsl_type * hlsl_get_scalar_type(const struct hlsl_ctx *ctx, enum hlsl_base_type base_type)
#define HLSL_SWIZZLE_SHIFT(idx)
static struct hlsl_type * hlsl_get_numeric_type(const struct hlsl_ctx *ctx, enum hlsl_type_class type, enum hlsl_base_type base_type, unsigned int dimx, unsigned int dimy)
static void hlsl_block_add_instr(struct hlsl_block *block, struct hlsl_ir_node *instr)
bool hlsl_fold_constant_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static bool hlsl_var_has_buffer_offset_register_reservation(struct hlsl_ctx *ctx, const struct hlsl_ir_var *var)
@ HLSL_RESOURCE_GATHER_BLUE
@ HLSL_RESOURCE_SAMPLE_GRAD
@ HLSL_RESOURCE_SAMPLE_CMP
@ HLSL_RESOURCE_SAMPLE_CMP_LZ
@ HLSL_RESOURCE_SAMPLE_LOD_BIAS
@ HLSL_RESOURCE_SAMPLE_PROJ
@ HLSL_RESOURCE_SAMPLE_INFO
@ HLSL_RESOURCE_GATHER_GREEN
@ HLSL_RESOURCE_GATHER_RED
@ HLSL_RESOURCE_SAMPLE_LOD
@ HLSL_RESOURCE_GATHER_ALPHA
int tpf_compile(struct vsir_program *program, uint64_t config_flags, struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context, struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func)
static void * hlsl_alloc(struct hlsl_ctx *ctx, size_t size)
static bool hlsl_is_numeric_type(const struct hlsl_type *type)
static void hlsl_block_add_block(struct hlsl_block *block, struct hlsl_block *add)
static bool hlsl_version_ge(const struct hlsl_ctx *ctx, unsigned int major, unsigned int minor)
bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
#define HLSL_STORAGE_LINEAR
struct hlsl_ir_node * hlsl_add_load_component(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_node *var_instr, unsigned int comp, const struct vkd3d_shader_location *loc)
@ HLSL_SAMPLER_DIM_GENERIC
static bool hlsl_deref_is_lowered(const struct hlsl_deref *deref)
static void hlsl_src_remove(struct hlsl_src *src)
#define HLSL_MAX_OPERANDS
static bool hlsl_version_lt(const struct hlsl_ctx *ctx, unsigned int major, unsigned int minor)
@ HLSL_OP0_RASTERIZER_SAMPLE_COUNT
static uint32_t vsir_swizzle_from_hlsl(uint32_t swizzle)
static unsigned int hlsl_swizzle_get_component(uint32_t swizzle, unsigned int idx)
@ HLSL_IR_JUMP_DISCARD_NZ
@ HLSL_IR_JUMP_DISCARD_NEG
static void hlsl_release_string_buffer(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer)
#define HLSL_STORAGE_NOINTERPOLATION
bool hlsl_fold_constant_identities(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
#define HLSL_STORAGE_NOPERSPECTIVE
static bool remove_trivial_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static bool lower_narrowing_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static void transform_unroll_loops(struct hlsl_ctx *ctx, struct hlsl_block *block)
static enum vkd3d_data_type vsir_data_type_from_hlsl_instruction(struct hlsl_ctx *ctx, const struct hlsl_ir_node *instr)
static void generate_vsir_signature_entry(struct hlsl_ctx *ctx, struct vsir_program *program, struct shader_signature *signature, bool output, bool is_patch_constant_func, struct hlsl_ir_var *var)
static void allocate_const_registers_recurse(struct hlsl_ctx *ctx, struct hlsl_block *block, struct register_allocator *allocator)
static void allocate_objects(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, enum hlsl_regset regset)
static void parse_partitioning_attribute(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr)
static void sm1_generate_vsir_instr_if(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_if *iff)
static bool lower_int_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static void sm1_generate_vsir_instr_expr_per_component_instr_op(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_expr *expr, enum vkd3d_shader_opcode opcode)
static void sm4_generate_vsir_instr_dcl_semantic(struct hlsl_ctx *ctx, struct vsir_program *program, const struct hlsl_ir_var *var, bool is_patch_constant_func, struct hlsl_block *block, const struct vkd3d_shader_location *loc)
static void calculate_resource_register_counts(struct hlsl_ctx *ctx)
void hlsl_lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_block *body)
static bool validate_dereferences(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static bool copy_propagation_transform_load(struct hlsl_ctx *ctx, struct hlsl_ir_load *load, struct copy_propagation_state *state)
static bool dce(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static bool copy_propagation_replace_with_constant_vector(struct hlsl_ctx *ctx, const struct copy_propagation_state *state, const struct hlsl_ir_load *load, uint32_t swizzle, struct hlsl_ir_node *instr)
static void prepend_uniform_copy(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_var *temp)
static struct copy_propagation_value * copy_propagation_get_value_at_time(struct copy_propagation_component_trace *trace, unsigned int time)
static void record_allocation(struct hlsl_ctx *ctx, struct register_allocator *allocator, uint32_t reg_idx, unsigned int writemask, unsigned int first_write, unsigned int last_read, int mode)
static void vsir_src_from_hlsl_node(struct vkd3d_shader_src_param *src, struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, uint32_t map_writemask)
static void process_entry_function(struct hlsl_ctx *ctx, const struct hlsl_block *global_uniform_block, struct hlsl_ir_function_decl *entry_func)
static void dump_function(struct rb_entry *entry, void *context)
bool hlsl_component_index_range_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, unsigned int *start, unsigned int *count)
static struct hlsl_reg allocate_numeric_registers_for_type(struct hlsl_ctx *ctx, struct register_allocator *allocator, unsigned int first_write, unsigned int last_read, const struct hlsl_type *type)
static bool track_object_components_sampler_dim(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static bool find_recursive_calls(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static unsigned int get_available_writemask(const struct register_allocator *allocator, unsigned int first_write, unsigned int last_read, uint32_t reg_idx, int mode)
static void mark_vars_usage(struct hlsl_ctx *ctx)
static void note_non_static_deref_expressions(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, const char *usage)
static bool copy_propagation_process_if(struct hlsl_ctx *ctx, struct hlsl_ir_if *iff, struct copy_propagation_state *state)
static bool transform_instr_derefs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static uint32_t combine_field_storage_modifiers(uint32_t modifiers, uint32_t field_modifiers)
static const struct hlsl_buffer * get_reserved_buffer(struct hlsl_ctx *ctx, uint32_t space, uint32_t index, bool allocated_only)
static bool lower_ternary(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static void copy_propagation_invalidate_variable_from_deref(struct hlsl_ctx *ctx, struct copy_propagation_var_def *var_def, const struct hlsl_deref *deref, unsigned char writemask, unsigned int time)
static void allocate_instr_temp_register(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct register_allocator *allocator)
static struct hlsl_ir_node * add_zero_mipmap_level(struct hlsl_ctx *ctx, struct hlsl_ir_node *index, const struct vkd3d_shader_location *loc)
static void sm1_generate_vsir_instr_load(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_load *load)
static enum hlsl_base_type base_type_get_semantic_equivalent(enum hlsl_base_type base)
static const char * debug_register(char class, struct hlsl_reg reg, const struct hlsl_type *type)
static void sort_uniforms_by_numeric_bind_count(struct hlsl_ctx *ctx)
static bool copy_propagation_process_loop(struct hlsl_ctx *ctx, struct hlsl_ir_loop *loop, struct copy_propagation_state *state)
static void sm1_generate_vsir_instr_resource_load(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_resource_load *load)
static bool lower_nonfloat_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static bool lower_nonconstant_array_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static void allocate_temp_registers_recurse(struct hlsl_ctx *ctx, struct hlsl_block *block, struct register_allocator *allocator)
static void sm1_generate_vsir_constant_defs(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_block *block)
static char get_regset_name(enum hlsl_regset regset)
static struct hlsl_reg allocate_register(struct hlsl_ctx *ctx, struct register_allocator *allocator, unsigned int first_write, unsigned int last_read, unsigned int reg_size, unsigned int component_count, int mode, bool force_align)
static bool sm1_generate_vsir_instr_expr_cast(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_expr *expr)
static bool lower_calls(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static void allocate_semantic_register(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, struct register_allocator *allocator, bool output, bool optimize, bool is_patch_constant_func)
static void validate_hull_shader_attributes(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl *entry_func)
static bool transform_derefs(struct hlsl_ctx *ctx, bool(*func)(struct hlsl_ctx *ctx, struct hlsl_deref *, struct hlsl_ir_node *), struct hlsl_block *block)
static void generate_vsir_signature(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_function_decl *func)
static enum vkd3d_data_type vsir_data_type_from_hlsl_type(struct hlsl_ctx *ctx, const struct hlsl_type *type)
static void copy_propagation_state_destroy(struct copy_propagation_state *state)
static void sm1_generate_vsir_instr_constant(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_constant *constant)
static struct hlsl_ir_jump * loop_unrolling_find_jump(struct hlsl_block *block, struct hlsl_ir_node *stop_point, struct hlsl_block **found_block)
static void copy_propagation_invalidate_variable(struct hlsl_ctx *ctx, struct copy_propagation_var_def *var_def, unsigned int comp, unsigned char writemask, unsigned int time)
static void validate_field_semantic(struct hlsl_ctx *ctx, struct hlsl_struct_field *field)
static void copy_propagation_trace_record_value(struct hlsl_ctx *ctx, struct copy_propagation_component_trace *trace, struct hlsl_ir_node *node, unsigned int component, unsigned int time)
bool hlsl_regset_index_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, enum hlsl_regset regset, unsigned int *index)
static bool fold_swizzle_chains(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static void sm4_generate_vsir_add_function(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, uint64_t config_flags, struct vsir_program *program)
static bool lower_f16tof32(struct hlsl_ctx *ctx, struct hlsl_ir_node *node, struct hlsl_block *block)
static void compute_liveness(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func)
static bool copy_propagation_transform_swizzle(struct hlsl_ctx *ctx, struct hlsl_ir_swizzle *swizzle, struct copy_propagation_state *state)
static void sm4_generate_vsir_instr_dcl_temps(struct hlsl_ctx *ctx, struct vsir_program *program, uint32_t temp_count, struct hlsl_block *block, const struct vkd3d_shader_location *loc)
static bool lower_slt(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static void validate_buffer_offsets(struct hlsl_ctx *ctx)
static bool lower_abs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
bool hlsl_offset_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, unsigned int *offset)
static bool clean_constant_deref_offset_srcs(struct hlsl_ctx *ctx, struct hlsl_deref *deref, struct hlsl_ir_node *instr)
static bool loop_unrolling_unroll_loop(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_block *loop_parent, struct hlsl_ir_loop *loop)
static struct hlsl_reg allocate_register_with_masks(struct hlsl_ctx *ctx, struct register_allocator *allocator, unsigned int first_write, unsigned int last_read, uint32_t reg_writemask, uint32_t writemask, int mode)
static bool type_is_integer(const struct hlsl_type *type)
static void copy_propagation_set_value(struct hlsl_ctx *ctx, struct copy_propagation_var_def *var_def, unsigned int comp, unsigned char writemask, struct hlsl_ir_node *instr, unsigned int time)
static bool copy_propagation_process_switch(struct hlsl_ctx *ctx, struct hlsl_ir_switch *s, struct copy_propagation_state *state)
static void vsir_dst_from_hlsl_node(struct vkd3d_shader_dst_param *dst, struct hlsl_ctx *ctx, const struct hlsl_ir_node *instr)
static void copy_propagation_invalidate_from_block(struct hlsl_ctx *ctx, struct copy_propagation_state *state, struct hlsl_block *block, unsigned int time)
static bool lower_casts_to_bool(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static bool lower_cmp(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
void hlsl_calculate_buffer_offsets(struct hlsl_ctx *ctx)
static bool lower_logic_not(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
bool hlsl_copy_propagation_execute(struct hlsl_ctx *ctx, struct hlsl_block *block)
static bool lower_sqrt(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static bool split_copy(struct hlsl_ctx *ctx, struct hlsl_ir_store *store, const struct hlsl_ir_load *load, const unsigned int idx, struct hlsl_type *type)
static void parse_outputcontrolpoints_attribute(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr)
static struct copy_propagation_value * copy_propagation_get_value(const struct copy_propagation_state *state, const struct hlsl_ir_var *var, unsigned int component, unsigned int time)
static bool sm4_generate_vsir_instr_expr(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_expr *expr, const char *dst_type_name)
static void allocate_variable_temp_register(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, struct register_allocator *allocator)
static void sm1_generate_vsir(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func, uint64_t config_flags, struct vsir_program *program, struct vkd3d_shader_code *ctab)
static bool lower_casts_to_int(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static bool lower_floor(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
enum vkd3d_shader_interpolation_mode sm4_get_interpolation_mode(struct hlsl_type *type, unsigned int storage_modifiers)
static void parse_domain_attribute(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr)
static bool sm1_generate_vsir_instr_expr(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_expr *expr)
static void record_constant(struct hlsl_ctx *ctx, unsigned int component_index, float f, const struct vkd3d_shader_location *loc)
static bool lower_discard_neg(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static void allocate_semantic_registers(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func)
static void sm4_generate_vsir_rcp_using_div(struct hlsl_ctx *ctx, struct vsir_program *program, const struct hlsl_ir_expr *expr)
static void prepend_input_var_copy(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, struct hlsl_ir_var *var)
static void sm4_generate_vsir_instr_dcl_indexable_temp(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_block *block, uint32_t idx, uint32_t size, uint32_t comp_count, const struct vkd3d_shader_location *loc)
static bool lower_trig(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static void sm4_generate_vsir_rasterizer_sample_count(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_expr *expr)
static bool lower_comparison_operators(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static unsigned int loop_unrolling_get_max_iterations(struct hlsl_ctx *ctx, struct hlsl_ir_loop *loop)
static bool track_components_usage(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static void copy_propagation_state_init(struct hlsl_ctx *ctx, struct copy_propagation_state *state, struct copy_propagation_state *parent)
bool hlsl_transform_ir(struct hlsl_ctx *ctx, bool(*func)(struct hlsl_ctx *ctx, struct hlsl_ir_node *, void *), struct hlsl_block *block, void *context)
static void sm1_generate_vsir_instr_jump(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_jump *jump)
static void parse_outputtopology_attribute(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr)
static bool split_struct_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static bool lower_dot(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
struct hlsl_reg hlsl_reg_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref)
static bool copy_propagation_transform_resource_store(struct hlsl_ctx *ctx, struct hlsl_ir_resource_store *store, struct copy_propagation_state *state)
static bool copy_propagation_transform_object_load(struct hlsl_ctx *ctx, struct hlsl_deref *deref, struct copy_propagation_state *state, unsigned int time)
static bool lower_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static void allocate_const_registers(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func)
static void add_last_vsir_instr_to_block(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_block *block)
static void prepend_input_copy(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, struct hlsl_ir_load *lhs, uint32_t modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index, bool force_align)
static void prepend_input_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, struct hlsl_ir_load *lhs, uint32_t modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index, bool force_align)
static bool lower_f32tof16(struct hlsl_ctx *ctx, struct hlsl_ir_node *node, struct hlsl_block *block)
static bool is_vec1(const struct hlsl_type *type)
static bool sort_synthetic_separated_samplers_first(struct hlsl_ctx *ctx)
static bool lower_ir(struct hlsl_ctx *ctx, PFN_lower_func func, struct hlsl_block *block)
static bool split_matrix_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static void sort_uniform_by_numeric_bind_count(struct list *sorted, struct hlsl_ir_var *to_sort)
static bool copy_propagation_transform_resource_load(struct hlsl_ctx *ctx, struct hlsl_ir_resource_load *load, struct copy_propagation_state *state)
static void sm1_generate_vsir_init_src_param_from_deref(struct hlsl_ctx *ctx, struct vkd3d_shader_src_param *src_param, struct hlsl_deref *deref, unsigned int dst_writemask, const struct vkd3d_shader_location *loc)
static bool lower_int_abs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
@ DEREF_VALIDATION_OUT_OF_BOUNDS
@ DEREF_VALIDATION_NOT_CONSTANT
static bool validate_nonconstant_vector_store_derefs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static struct hlsl_reg allocate_range(struct hlsl_ctx *ctx, struct register_allocator *allocator, unsigned int first_write, unsigned int last_read, unsigned int reg_size, int mode)
static void sm4_generate_vsir(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, uint64_t config_flags, struct vsir_program *program)
static const struct hlsl_ir_var * get_allocated_object(struct hlsl_ctx *ctx, enum hlsl_regset regset, uint32_t space, uint32_t index, bool allocated_only)
static void sm4_generate_vsir_block(struct hlsl_ctx *ctx, struct hlsl_block *block, struct vsir_program *program)
static bool copy_propagation_transform_block(struct hlsl_ctx *ctx, struct hlsl_block *block, struct copy_propagation_state *state)
static uint32_t generate_vsir_get_src_swizzle(uint32_t src_writemask, uint32_t dst_writemask)
static void vsir_src_from_hlsl_constant_value(struct vkd3d_shader_src_param *src, struct hlsl_ctx *ctx, const struct hlsl_constant_value *value, enum vkd3d_data_type type, unsigned int width, unsigned int map_writemask)
static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static void append_output_var_copy(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, struct hlsl_ir_var *var)
static void deref_mark_last_read(struct hlsl_deref *deref, unsigned int last_read)
static void mark_indexable_vars(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func)
static void append_output_copy(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, struct hlsl_ir_load *rhs, uint32_t modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index, bool force_align)
static void compute_liveness_recurse(struct hlsl_block *block, unsigned int loop_first, unsigned int loop_last)
static unsigned int index_instructions(struct hlsl_block *block, unsigned int index)
static const char * get_string_argument_value(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr, unsigned int i)
int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func, enum vkd3d_shader_target_type target_type, struct vkd3d_shader_code *out)
static void replace_instr_with_last_vsir_instr(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_node *instr)
static enum validation_result validate_component_index_range_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref)
static bool lower_broadcasts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static bool lower_float_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static bool lower_nonconstant_vector_derefs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static bool type_is_float(const struct hlsl_type *type)
static void append_output_copy_recurse(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, struct hlsl_ir_load *rhs, uint32_t modifiers, struct hlsl_semantic *semantic, uint32_t semantic_index, bool force_align)
static void init_var_liveness(struct hlsl_ir_var *var)
static void sm1_generate_vsir_init_dst_param_from_deref(struct hlsl_ctx *ctx, struct vkd3d_shader_dst_param *dst_param, struct hlsl_deref *deref, const struct vkd3d_shader_location *loc, unsigned int writemask)
static void allocate_buffers(struct hlsl_ctx *ctx)
static unsigned int get_max_cbuffer_reg_index(struct hlsl_ctx *ctx)
static bool lower_matrix_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static bool lower_discard_nz(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
unsigned int hlsl_offset_from_deref_safe(struct hlsl_ctx *ctx, const struct hlsl_deref *deref)
static void parse_numthreads_attribute(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr)
static struct hlsl_ir_var * add_semantic_var(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, struct hlsl_ir_var *var, struct hlsl_type *type, uint32_t modifiers, struct hlsl_semantic *semantic, uint32_t index, bool output, bool force_align, const struct vkd3d_shader_location *loc)
static bool lower_int_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
bool(* PFN_lower_func)(struct hlsl_ctx *, struct hlsl_ir_node *, struct hlsl_block *)
static bool split_array_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static void copy_propagation_invalidate_variable_from_deref_recurse(struct hlsl_ctx *ctx, struct copy_propagation_var_def *var_def, const struct hlsl_deref *deref, struct hlsl_type *type, unsigned int depth, unsigned int comp_start, unsigned char writemask, unsigned int time)
static bool lower_combined_samples(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static bool lower_return(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, struct hlsl_block *block, bool in_loop)
static struct hlsl_ir_node * new_offset_instr_from_deref(struct hlsl_ctx *ctx, struct hlsl_block *block, const struct hlsl_deref *deref, unsigned int *offset_component, const struct vkd3d_shader_location *loc)
static bool lower_ceil(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static bool sm4_generate_vsir_instr_expr_cast(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_expr *expr)
static struct vkd3d_shader_instruction * generate_vsir_add_program_instruction(struct hlsl_ctx *ctx, struct vsir_program *program, const struct vkd3d_shader_location *loc, enum vkd3d_shader_opcode opcode, unsigned int dst_count, unsigned int src_count)
static void parse_entry_function_attributes(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func)
static bool copy_propagation_replace_with_single_instr(struct hlsl_ctx *ctx, const struct copy_propagation_state *state, const struct hlsl_ir_load *load, uint32_t swizzle, struct hlsl_ir_node *instr)
static bool mark_indexable_var(struct hlsl_ctx *ctx, struct hlsl_deref *deref, struct hlsl_ir_node *instr)
static bool lower_round(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static int copy_propagation_var_def_compare(const void *key, const struct rb_entry *entry)
struct hlsl_ir_node * hlsl_add_conditional(struct hlsl_ctx *ctx, struct hlsl_block *instrs, struct hlsl_ir_node *condition, struct hlsl_ir_node *if_true, struct hlsl_ir_node *if_false)
static void register_deref_usage(struct hlsl_ctx *ctx, struct hlsl_deref *deref)
static void sm1_generate_vsir_sampler_dcls(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_block *block)
static void insert_ensuring_decreasing_bind_count(struct list *list, struct hlsl_ir_var *to_add, enum hlsl_regset regset)
static struct hlsl_ir_node * new_offset_from_path_index(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_type *type, struct hlsl_ir_node *base_offset, struct hlsl_ir_node *idx, enum hlsl_regset regset, unsigned int *offset_component, const struct vkd3d_shader_location *loc)
static void parse_patchconstantfunc_attribute(struct hlsl_ctx *ctx, const struct hlsl_attribute *attr)
static bool remove_trivial_conditional_branches(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static struct hlsl_ir_loop * loop_unrolling_find_unrollable_loop(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_block **containing_block)
static void generate_vsir_instr_swizzle(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_swizzle *swizzle_instr)
static void copy_propagation_record_store(struct hlsl_ctx *ctx, struct hlsl_ir_store *store, struct copy_propagation_state *state)
static void sm4_generate_vsir_cast_from_bool(struct hlsl_ctx *ctx, struct vsir_program *program, const struct hlsl_ir_expr *expr, uint32_t bits)
static bool lower_int_dot(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_block *block)
static void remove_unreachable_code(struct hlsl_ctx *ctx, struct hlsl_block *body)
static void sm1_generate_vsir_instr_expr_sincos(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_expr *expr)
static void allocate_sincos_const_registers(struct hlsl_ctx *ctx, struct hlsl_block *block, struct register_allocator *allocator)
static void sm4_generate_vsir_expr_with_two_destinations(struct hlsl_ctx *ctx, struct vsir_program *program, enum vkd3d_shader_opcode opcode, const struct hlsl_ir_expr *expr, unsigned int dst_idx)
void hlsl_run_const_passes(struct hlsl_ctx *ctx, struct hlsl_block *body)
static void hlsl_calculate_buffer_offset(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, bool register_reservation)
static void generate_vsir_instr_expr_single_instr_op(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_expr *expr, enum vkd3d_shader_opcode opcode, uint32_t src_mod, uint32_t dst_mod, bool map_src_swizzles)
static void sm1_generate_vsir_block(struct hlsl_ctx *ctx, struct hlsl_block *block, struct vsir_program *program)
static void allocate_register_reservations(struct hlsl_ctx *ctx, struct list *extern_vars)
static bool types_are_semantic_equivalent(struct hlsl_ctx *ctx, const struct hlsl_type *type1, const struct hlsl_type *type2)
static struct copy_propagation_var_def * copy_propagation_create_var_def(struct hlsl_ctx *ctx, struct copy_propagation_state *state, struct hlsl_ir_var *var)
static bool call_lower_func(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static bool fold_redundant_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static uint32_t allocate_temp_registers(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func)
static void copy_propagation_var_def_destroy(struct rb_entry *entry, void *context)
static void insert_early_return_break(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *func, struct hlsl_ir_node *cf_instr)
static bool normalize_switch_cases(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
static bool replace_deref_path_with_offset(struct hlsl_ctx *ctx, struct hlsl_deref *deref, struct hlsl_ir_node *instr)
static void sm1_generate_vsir_instr_store(struct hlsl_ctx *ctx, struct vsir_program *program, struct hlsl_ir_store *store)
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)
void vsir_program_cleanup(struct vsir_program *program)
void vsir_register_init(struct vkd3d_shader_register *reg, enum vkd3d_shader_register_type reg_type, enum vkd3d_data_type data_type, unsigned int idx_count)
bool vsir_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)
void vsir_src_param_init(struct vkd3d_shader_src_param *param, enum vkd3d_shader_register_type reg_type, enum vkd3d_data_type data_type, unsigned int idx_count)
void vsir_dst_param_init(struct vkd3d_shader_dst_param *param, enum vkd3d_shader_register_type reg_type, enum vkd3d_data_type data_type, unsigned int idx_count)
static BOOL is_bool(jsval_t v)
#define eq(received, expected, label, type)
#define cmp(status, error)
static ULONG ** element_count
static const char * target_type(DWORD dwType)
MV_U8 mul1(MV_U8 aa, MV_U8 bb)
static int sum(int x_, int y_)
static unsigned __int64 next
#define offsetof(TYPE, MEMBER)
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
__WINE_SERVER_LIST_INLINE struct list * list_prev(const struct list *list, const struct list *elem)
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
__WINE_SERVER_LIST_INLINE void list_move_head(struct list *dst, struct list *src)
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
__WINE_SERVER_LIST_INLINE void list_move_before(struct list *dst, struct list *src)
#define LIST_FOR_EACH_ENTRY_REV(elem, list, type, field)
__WINE_SERVER_LIST_INLINE void list_add_before(struct list *elem, struct list *to_add)
__WINE_SERVER_LIST_INLINE void list_add_after(struct list *elem, struct list *to_add)
__WINE_SERVER_LIST_INLINE void list_move_slice_tail(struct list *dst, struct list *begin, struct list *end)
#define LIST_FOR_EACH_ENTRY_SAFE_REV(cursor, cursor2, list, type, field)
__WINE_SERVER_LIST_INLINE struct list * list_tail(const struct list *list)
#define RB_ENTRY_VALUE(element, type, field)
static void rb_destroy(struct rb_tree *tree, rb_traverse_func_t *callback, void *context)
static void rb_for_each_entry(struct rb_tree *tree, rb_traverse_func_t *callback, void *context)
static int rb_put(struct rb_tree *tree, const void *key, struct rb_entry *entry)
static struct rb_entry * rb_get(const struct rb_tree *tree, const void *key)
static void rb_init(struct rb_tree *tree, rb_compare_func_t compare)
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
enum vkd3d_shader_sysval_semantic sysval
enum vkd3d_shader_input_sysval_semantic vkd3d_siv_from_sysval_indexed(enum vkd3d_shader_sysval_semantic sysval, unsigned int index)
struct vkd3d_spirv_builtin builtin
union constant::@270 value[4]
struct copy_propagation_value * records
struct copy_propagation_state * parent
struct hlsl_ir_node * node
struct copy_propagation_component_trace traces[]
struct hlsl_reg_reservation reservation
struct vkd3d_shader_location loc
struct hlsl_type * data_type
struct hlsl_src rel_offset
unsigned int const_offset
struct hlsl_ir_function_decl * decl
struct hlsl_ir_constant::hlsl_constant_value value
struct hlsl_src operands[HLSL_MAX_OPERANDS]
const struct hlsl_attribute *const * attrs
struct hlsl_func_parameters parameters
struct hlsl_ir_function * func
struct hlsl_ir_var * return_var
struct vkd3d_shader_location loc
struct hlsl_block then_block
struct hlsl_src condition
struct hlsl_block else_block
struct hlsl_src condition
enum hlsl_ir_jump_type type
enum hlsl_ir_loop_unroll_type unroll_type
unsigned int unroll_limit
enum hlsl_ir_node_type type
struct hlsl_type * data_type
struct vkd3d_shader_location loc
struct hlsl_src coords value
struct hlsl_deref resource
struct vkd3d_shader_location loc
unsigned int buffer_offset
uint32_t is_output_semantic
struct hlsl_ir_var::hlsl_default_value * default_values
struct hlsl_scope * scope
struct hlsl_semantic semantic
struct hlsl_reg_reservation reg_reservation
unsigned int bind_count[HLSL_REGSET_LAST+1]
struct hlsl_type * data_type
uint32_t storage_modifiers
struct vkd3d_shader_location loc
enum hlsl_sampler_dim sampler_dim
struct hlsl_buffer * buffer
uint32_t is_input_semantic
struct hlsl_semantic semantic
struct vkd3d_shader_location loc
struct hlsl_type::@5997::@5998 numeric
struct hlsl_type::@5997::@6000 array
enum hlsl_type_class class
const struct hlsl_ir_function_decl ** backtrace
struct register_allocator::allocation * allocations
bool prioritize_smaller_writemasks
struct vkd3d_shader_register reg
struct vkd3d_shader_instruction * elements
struct vkd3d_shader_src_param * src
struct vkd3d_shader_location location
struct vkd3d_shader_register_semantic register_semantic
struct vkd3d_shader_indexable_temp indexable_temp
union vkd3d_shader_instruction::@6020 declaration
enum vkd3d_shader_opcode opcode
struct vkd3d_shader_semantic semantic
struct vkd3d_shader_dst_param * dst
struct vkd3d_shader_register reg
enum vkd3d_shader_src_modifier modifiers
bool shader_sm4_is_scalar_register(const struct vkd3d_shader_register *reg)
bool sm4_register_from_semantic_name(const struct vkd3d_shader_version *version, const char *semantic_name, bool output, enum vkd3d_shader_register_type *type, bool *has_idx)
bool sm4_sysval_semantic_from_semantic_name(enum vkd3d_shader_sysval_semantic *sysval_semantic, const struct vkd3d_shader_version *version, bool semantic_compat_mapping, enum vkd3d_tessellator_domain domain, const char *semantic_name, unsigned int semantic_idx, bool output, bool is_patch_constant_func)
static unsigned int vkd3d_popcount(unsigned int v)
const char * vkd3d_dbg_sprintf(const char *fmt,...) VKD3D_PRINTF_FUNC(1
#define vkd3d_unreachable()
#define VKD3D_ASSERT(cond)
static int ascii_strcasecmp(const char *a, const char *b)
static char * vkd3d_strdup(const char *string)
static void vkd3d_free(void *ptr)
bool vkd3d_array_reserve(void **elements, size_t *capacity, size_t element_count, size_t element_size)
VKD3D_SHADER_API void vkd3d_shader_free_shader_code(struct vkd3d_shader_code *code)
vkd3d_shader_sysval_semantic
@ VKD3D_SHADER_SV_VERTEX_ID
@ VKD3D_SHADER_SV_PRIMITIVE_ID
@ VKD3D_SHADER_SV_IS_FRONT_FACE
@ VKD3D_SHADER_SV_TESS_FACTOR_TRIINT
@ VKD3D_SHADER_SV_INSTANCE_ID
@ VKD3D_SHADER_SV_SAMPLE_INDEX
@ VKD3D_SHADER_SV_POSITION
@ VKD3D_SHADER_TESSELLATOR_OUTPUT_TRIANGLE_CW
@ VKD3D_SHADER_TESSELLATOR_OUTPUT_POINT
@ VKD3D_SHADER_TESSELLATOR_OUTPUT_TRIANGLE_CCW
@ VKD3D_SHADER_TESSELLATOR_OUTPUT_LINE
vkd3d_shader_component_type
@ VKD3D_SHADER_COMPONENT_INT
@ VKD3D_SHADER_COMPONENT_UINT
@ VKD3D_SHADER_COMPONENT_FLOAT
@ VKD3D_SHADER_COMPONENT_VOID
vkd3d_shader_resource_type
@ VKD3D_SHADER_RESOURCE_TEXTURE_3D
@ VKD3D_SHADER_RESOURCE_TEXTURE_CUBE
@ VKD3D_SHADER_RESOURCE_TEXTURE_2D
@ VKD3D_SHADER_TESSELLATOR_PARTITIONING_INTEGER
@ VKD3D_SHADER_TESSELLATOR_PARTITIONING_POW2
@ VKD3D_SHADER_TESSELLATOR_PARTITIONING_FRACTIONAL_ODD
@ VKD3D_SHADER_TESSELLATOR_PARTITIONING_FRACTIONAL_EVEN
#define VKD3D_SHADER_SWIZZLE(x, y, z, w)
#define VKD3D_SHADER_NO_SWIZZLE
@ VKD3D_SHADER_TARGET_DXBC_TPF
@ VKD3D_SHADER_TARGET_D3D_BYTECODE
uint64_t vkd3d_shader_init_config_flags(void)
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,...)
@ VKD3D_SHADER_TYPE_VERTEX
@ VKD3D_SHADER_TYPE_GEOMETRY
@ VKD3D_SHADER_TYPE_COMPUTE
@ VKD3D_SHADER_TYPE_PIXEL
@ VKD3D_SHADER_TYPE_DOMAIN
vkd3d_shader_interpolation_mode
@ VKD3DSIM_LINEAR_NOPERSPECTIVE_CENTROID
@ VKD3DSIM_LINEAR_CENTROID
@ VKD3DSIM_LINEAR_NOPERSPECTIVE
static uint32_t vsir_swizzle_from_writemask(unsigned int writemask)
#define VKD3DSI_TEXLD_BIAS
vkd3d_shader_register_type
@ VKD3DSPR_COMBINED_SAMPLER
@ VKD3D_SHADER_ERROR_HLSL_INVALID_SEMANTIC
@ VKD3D_SHADER_ERROR_HLSL_INVALID_PARTITIONING
@ VKD3D_SHADER_WARNING_HLSL_UNKNOWN_ATTRIBUTE
@ VKD3D_SHADER_ERROR_HLSL_MISSING_ATTRIBUTE
@ VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE
@ VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER
@ VKD3D_SHADER_ERROR_HLSL_INCONSISTENT_SAMPLER
@ VKD3D_SHADER_ERROR_HLSL_NON_STATIC_OBJECT_REF
@ VKD3D_SHADER_ERROR_HLSL_FAILED_FORCED_UNROLL
@ VKD3D_SHADER_ERROR_HLSL_INVALID_OUTPUT_PRIMITIVE
@ VKD3D_SHADER_ERROR_HLSL_MISSING_SEMANTIC
@ VKD3D_SHADER_ERROR_HLSL_INVALID_RESERVATION
@ VKD3D_SHADER_ERROR_HLSL_WRONG_PARAMETER_COUNT
@ VKD3D_SHADER_ERROR_HLSL_INVALID_THREAD_COUNT
@ VKD3D_SHADER_ERROR_HLSL_RECURSIVE_CALL
@ VKD3D_SHADER_ERROR_HLSL_NOT_DEFINED
@ VKD3D_SHADER_ERROR_HLSL_OVERLAPPING_RESERVATIONS
@ VKD3D_SHADER_ERROR_HLSL_INVALID_DOMAIN
@ VKD3D_SHADER_ERROR_HLSL_INVALID_CONTROL_POINT_COUNT
@ VKD3D_SHADER_ERROR_HLSL_OFFSET_OUT_OF_BOUNDS
@ VKD3D_SHADER_ERROR_HLSL_INVALID_SYNTAX
static unsigned int vkd3d_write_mask_from_component_count(unsigned int component_count)
#define VKD3DSP_WRITEMASK_ALL
#define VKD3DSI_TEXLD_PROJECT
static unsigned int vsir_swizzle_get_component(uint32_t swizzle, unsigned int idx)
@ VKD3DSIH_DCL_OUTPUT_SIV
@ VKD3DSIH_DCL_INPUT_PS_SIV
@ VKD3DSIH_DCL_INPUT_PS_SGV
@ VKD3DSIH_DCL_INDEXABLE_TEMP
#define VKD3DSI_SAMPLE_INFO_UINT
@ VKD3D_SHADER_REGISTER_PRECISION_DEFAULT
@ VKD3D_TESSELLATOR_DOMAIN_INVALID
@ VKD3D_TESSELLATOR_DOMAIN_TRIANGLE
@ VKD3D_TESSELLATOR_DOMAIN_LINE
@ VKD3D_TESSELLATOR_DOMAIN_QUAD
@ VKD3D_DECL_USAGE_POSITION
#define VKD3DSP_WRITEMASK_0
#define VKD3DSP_WRITEMASK_1
@ VKD3D_ERROR_INVALID_ARGUMENT
@ VKD3D_ERROR_NOT_IMPLEMENTED
@ VKD3D_ERROR_OUT_OF_MEMORY
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
static size_t align(size_t addr, size_t alignment)
static unsigned int block