unreachable("Invalid decoration opcode");
}
dec->decoration = *(w++);
- dec->literals = w;
+ dec->operands = w;
/* Link into the list */
dec->next = val->decoration;
struct vtn_type *type = val->type;
if (dec->decoration == SpvDecorationArrayStride) {
- vtn_fail_if(dec->literals[0] == 0, "ArrayStride must be non-zero");
- type->stride = dec->literals[0];
+ vtn_fail_if(dec->operands[0] == 0, "ArrayStride must be non-zero");
+ type->stride = dec->operands[0];
}
}
break;
case SpvDecorationStream:
/* Vulkan only allows one GS stream */
- vtn_assert(dec->literals[0] == 0);
+ vtn_assert(dec->operands[0] == 0);
break;
case SpvDecorationLocation:
- ctx->fields[member].location = dec->literals[0];
+ ctx->fields[member].location = dec->operands[0];
break;
case SpvDecorationComponent:
break; /* FIXME: What should we do with these? */
case SpvDecorationBuiltIn:
ctx->type->members[member] = vtn_type_copy(b, ctx->type->members[member]);
ctx->type->members[member]->is_builtin = true;
- ctx->type->members[member]->builtin = dec->literals[0];
+ ctx->type->members[member]->builtin = dec->operands[0];
ctx->type->builtin_block = true;
break;
case SpvDecorationOffset:
- ctx->type->offsets[member] = dec->literals[0];
- ctx->fields[member].offset = dec->literals[0];
+ ctx->type->offsets[member] = dec->operands[0];
+ ctx->fields[member].offset = dec->operands[0];
break;
case SpvDecorationMatrixStride:
/* Handled as a second pass */
vtn_fail_if(member < 0,
"The MatrixStride decoration is only allowed on members "
"of OpTypeStruct");
- vtn_fail_if(dec->literals[0] == 0, "MatrixStride must be non-zero");
+ vtn_fail_if(dec->operands[0] == 0, "MatrixStride must be non-zero");
struct member_decoration_ctx *ctx = void_ctx;
if (mat_type->row_major) {
mat_type->array_element = vtn_type_copy(b, mat_type->array_element);
mat_type->stride = mat_type->array_element->stride;
- mat_type->array_element->stride = dec->literals[0];
+ mat_type->array_element->stride = dec->operands[0];
mat_type->type = glsl_explicit_matrix_type(mat_type->type,
- dec->literals[0], true);
+ dec->operands[0], true);
mat_type->array_element->type = glsl_get_column_type(mat_type->type);
} else {
vtn_assert(mat_type->array_element->stride > 0);
- mat_type->stride = dec->literals[0];
+ mat_type->stride = dec->operands[0];
mat_type->type = glsl_explicit_matrix_type(mat_type->type,
- dec->literals[0], false);
+ dec->operands[0], false);
}
/* Now that we've replaced the glsl_type with a properly strided matrix
struct spec_constant_value *const_value = data;
for (unsigned i = 0; i < b->num_specializations; i++) {
- if (b->specializations[i].id == dec->literals[0]) {
+ if (b->specializations[i].id == dec->operands[0]) {
if (const_value->is_double)
const_value->data64 = b->specializations[i].data64;
else
{
vtn_assert(member == -1);
if (dec->decoration != SpvDecorationBuiltIn ||
- dec->literals[0] != SpvBuiltInWorkgroupSize)
+ dec->operands[0] != SpvBuiltInWorkgroupSize)
return;
vtn_assert(val->type->type == glsl_vector_type(GLSL_TYPE_UINT, 3));
case SpvExecutionModeInvocations:
vtn_assert(b->shader->info.stage == MESA_SHADER_GEOMETRY);
- b->shader->info.gs.invocations = MAX2(1, mode->literals[0]);
+ b->shader->info.gs.invocations = MAX2(1, mode->operands[0]);
break;
case SpvExecutionModeDepthReplacing:
case SpvExecutionModeLocalSize:
vtn_assert(gl_shader_stage_is_compute(b->shader->info.stage));
- b->shader->info.cs.local_size[0] = mode->literals[0];
- b->shader->info.cs.local_size[1] = mode->literals[1];
- b->shader->info.cs.local_size[2] = mode->literals[2];
+ b->shader->info.cs.local_size[0] = mode->operands[0];
+ b->shader->info.cs.local_size[1] = mode->operands[1];
+ b->shader->info.cs.local_size[2] = mode->operands[2];
break;
case SpvExecutionModeLocalSizeId:
- b->shader->info.cs.local_size[0] = vtn_constant_uint(b, mode->literals[0]);
- b->shader->info.cs.local_size[1] = vtn_constant_uint(b, mode->literals[1]);
- b->shader->info.cs.local_size[2] = vtn_constant_uint(b, mode->literals[2]);
+ b->shader->info.cs.local_size[0] = vtn_constant_uint(b, mode->operands[0]);
+ b->shader->info.cs.local_size[1] = vtn_constant_uint(b, mode->operands[1]);
+ b->shader->info.cs.local_size[2] = vtn_constant_uint(b, mode->operands[2]);
break;
case SpvExecutionModeLocalSizeHint:
case SpvExecutionModeOutputVertices:
if (b->shader->info.stage == MESA_SHADER_TESS_CTRL ||
b->shader->info.stage == MESA_SHADER_TESS_EVAL) {
- b->shader->info.tess.tcs_vertices_out = mode->literals[0];
+ b->shader->info.tess.tcs_vertices_out = mode->operands[0];
} else {
vtn_assert(b->shader->info.stage == MESA_SHADER_GEOMETRY);
- b->shader->info.gs.vertices_out = mode->literals[0];
+ b->shader->info.gs.vertices_out = mode->operands[0];
}
break;
var_data->image.access |= ACCESS_COHERENT;
break;
case SpvDecorationComponent:
- var_data->location_frac = dec->literals[0];
+ var_data->location_frac = dec->operands[0];
break;
case SpvDecorationIndex:
- var_data->index = dec->literals[0];
+ var_data->index = dec->operands[0];
break;
case SpvDecorationBuiltIn: {
- SpvBuiltIn builtin = dec->literals[0];
+ SpvBuiltIn builtin = dec->operands[0];
nir_variable_mode mode = var_data->mode;
vtn_get_builtin_location(b, builtin, &var_data->location, &mode);
case SpvDecorationXfbBuffer:
var_data->explicit_xfb_buffer = true;
- var_data->xfb_buffer = dec->literals[0];
+ var_data->xfb_buffer = dec->operands[0];
var_data->always_active_io = true;
break;
case SpvDecorationXfbStride:
var_data->explicit_xfb_stride = true;
- var_data->xfb_stride = dec->literals[0];
+ var_data->xfb_stride = dec->operands[0];
break;
case SpvDecorationOffset:
var_data->explicit_offset = true;
- var_data->offset = dec->literals[0];
+ var_data->offset = dec->operands[0];
break;
case SpvDecorationStream:
- var_data->stream = dec->literals[0];
+ var_data->stream = dec->operands[0];
break;
case SpvDecorationCPacked:
/* Handle decorations that apply to a vtn_variable as a whole */
switch (dec->decoration) {
case SpvDecorationBinding:
- vtn_var->binding = dec->literals[0];
+ vtn_var->binding = dec->operands[0];
vtn_var->explicit_binding = true;
return;
case SpvDecorationDescriptorSet:
- vtn_var->descriptor_set = dec->literals[0];
+ vtn_var->descriptor_set = dec->operands[0];
return;
case SpvDecorationInputAttachmentIndex:
- vtn_var->input_attachment_index = dec->literals[0];
+ vtn_var->input_attachment_index = dec->operands[0];
return;
case SpvDecorationPatch:
vtn_var->patch = true;
break;
case SpvDecorationOffset:
- vtn_var->offset = dec->literals[0];
+ vtn_var->offset = dec->operands[0];
break;
case SpvDecorationNonWritable:
vtn_var->access |= ACCESS_NON_WRITEABLE;
* special case.
*/
if (dec->decoration == SpvDecorationLocation) {
- unsigned location = dec->literals[0];
+ unsigned location = dec->operands[0];
if (b->shader->info.stage == MESA_SHADER_FRAGMENT &&
vtn_var->mode == vtn_variable_mode_output) {
location += FRAG_RESULT_DATA0;