nir/spirv: Rename some things from access_chain to pointer

We're about to add a vtn_pointer data structure and this will prevent
some rename churn in the next commit.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
This commit is contained in:
Jason Ekstrand
2017-06-29 10:33:27 -07:00
committed by Jason Ekstrand
parent 4e0280d37d
commit 06b5eeda17
4 changed files with 73 additions and 82 deletions

View File

@@ -185,9 +185,9 @@ vtn_ssa_value(struct vtn_builder *b, uint32_t value_id)
case vtn_value_type_ssa: case vtn_value_type_ssa:
return val->ssa; return val->ssa;
case vtn_value_type_access_chain: case vtn_value_type_pointer:
/* This is needed for function parameters */ /* This is needed for function parameters */
return vtn_variable_load(b, val->access_chain); return vtn_variable_load(b, val->pointer);
default: default:
unreachable("Invalid type for an SSA value"); unreachable("Invalid type for an SSA value");
@@ -1345,8 +1345,8 @@ vtn_handle_function_call(struct vtn_builder *b, SpvOp opcode,
for (unsigned i = 0; i < call->num_params; i++) { for (unsigned i = 0; i < call->num_params; i++) {
unsigned arg_id = w[4 + i]; unsigned arg_id = w[4 + i];
struct vtn_value *arg = vtn_untyped_value(b, arg_id); struct vtn_value *arg = vtn_untyped_value(b, arg_id);
if (arg->value_type == vtn_value_type_access_chain) { if (arg->value_type == vtn_value_type_pointer) {
nir_deref_var *d = vtn_access_chain_to_deref(b, arg->access_chain); nir_deref_var *d = vtn_pointer_to_deref(b, arg->pointer);
call->params[i] = nir_deref_var_clone(d, call); call->params[i] = nir_deref_var_clone(d, call);
} else { } else {
struct vtn_ssa_value *arg_ssa = vtn_ssa_value(b, arg_id); struct vtn_ssa_value *arg_ssa = vtn_ssa_value(b, arg_id);
@@ -1434,19 +1434,18 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
vtn_push_value(b, w[2], vtn_value_type_sampled_image); vtn_push_value(b, w[2], vtn_value_type_sampled_image);
val->sampled_image = ralloc(b, struct vtn_sampled_image); val->sampled_image = ralloc(b, struct vtn_sampled_image);
val->sampled_image->image = val->sampled_image->image =
vtn_value(b, w[3], vtn_value_type_access_chain)->access_chain; vtn_value(b, w[3], vtn_value_type_pointer)->pointer;
val->sampled_image->sampler = val->sampled_image->sampler =
vtn_value(b, w[4], vtn_value_type_access_chain)->access_chain; vtn_value(b, w[4], vtn_value_type_pointer)->pointer;
return; return;
} else if (opcode == SpvOpImage) { } else if (opcode == SpvOpImage) {
struct vtn_value *val = struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_pointer);
vtn_push_value(b, w[2], vtn_value_type_access_chain);
struct vtn_value *src_val = vtn_untyped_value(b, w[3]); struct vtn_value *src_val = vtn_untyped_value(b, w[3]);
if (src_val->value_type == vtn_value_type_sampled_image) { if (src_val->value_type == vtn_value_type_sampled_image) {
val->access_chain = src_val->sampled_image->image; val->pointer = src_val->sampled_image->image;
} else { } else {
assert(src_val->value_type == vtn_value_type_access_chain); assert(src_val->value_type == vtn_value_type_pointer);
val->access_chain = src_val->access_chain; val->pointer = src_val->pointer;
} }
return; return;
} }
@@ -1459,9 +1458,9 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
if (sampled_val->value_type == vtn_value_type_sampled_image) { if (sampled_val->value_type == vtn_value_type_sampled_image) {
sampled = *sampled_val->sampled_image; sampled = *sampled_val->sampled_image;
} else { } else {
assert(sampled_val->value_type == vtn_value_type_access_chain); assert(sampled_val->value_type == vtn_value_type_pointer);
sampled.image = NULL; sampled.image = NULL;
sampled.sampler = sampled_val->access_chain; sampled.sampler = sampled_val->pointer;
} }
const struct glsl_type *image_type; const struct glsl_type *image_type;
@@ -1685,10 +1684,10 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
unreachable("Invalid base type for sampler result"); unreachable("Invalid base type for sampler result");
} }
nir_deref_var *sampler = vtn_access_chain_to_deref(b, sampled.sampler); nir_deref_var *sampler = vtn_pointer_to_deref(b, sampled.sampler);
nir_deref_var *texture; nir_deref_var *texture;
if (sampled.image) { if (sampled.image) {
nir_deref_var *image = vtn_access_chain_to_deref(b, sampled.image); nir_deref_var *image = vtn_pointer_to_deref(b, sampled.image);
texture = image; texture = image;
} else { } else {
texture = sampler; texture = sampler;
@@ -1850,8 +1849,7 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
vtn_push_value(b, w[2], vtn_value_type_image_pointer); vtn_push_value(b, w[2], vtn_value_type_image_pointer);
val->image = ralloc(b, struct vtn_image_pointer); val->image = ralloc(b, struct vtn_image_pointer);
val->image->image = val->image->image = vtn_value(b, w[3], vtn_value_type_pointer)->pointer;
vtn_value(b, w[3], vtn_value_type_access_chain)->access_chain;
val->image->coord = get_image_coord(b, w[4]); val->image->coord = get_image_coord(b, w[4]);
val->image->sample = vtn_ssa_value(b, w[5])->def; val->image->sample = vtn_ssa_value(b, w[5])->def;
return; return;
@@ -1883,15 +1881,13 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
break; break;
case SpvOpImageQuerySize: case SpvOpImageQuerySize:
image.image = image.image = vtn_value(b, w[3], vtn_value_type_pointer)->pointer;
vtn_value(b, w[3], vtn_value_type_access_chain)->access_chain;
image.coord = NULL; image.coord = NULL;
image.sample = NULL; image.sample = NULL;
break; break;
case SpvOpImageRead: case SpvOpImageRead:
image.image = image.image = vtn_value(b, w[3], vtn_value_type_pointer)->pointer;
vtn_value(b, w[3], vtn_value_type_access_chain)->access_chain;
image.coord = get_image_coord(b, w[4]); image.coord = get_image_coord(b, w[4]);
if (count > 5 && (w[5] & SpvImageOperandsSampleMask)) { if (count > 5 && (w[5] & SpvImageOperandsSampleMask)) {
@@ -1903,8 +1899,7 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
break; break;
case SpvOpImageWrite: case SpvOpImageWrite:
image.image = image.image = vtn_value(b, w[1], vtn_value_type_pointer)->pointer;
vtn_value(b, w[1], vtn_value_type_access_chain)->access_chain;
image.coord = get_image_coord(b, w[2]); image.coord = get_image_coord(b, w[2]);
/* texel = w[3] */ /* texel = w[3] */
@@ -1949,7 +1944,7 @@ vtn_handle_image(struct vtn_builder *b, SpvOp opcode,
nir_intrinsic_instr *intrin = nir_intrinsic_instr_create(b->shader, op); nir_intrinsic_instr *intrin = nir_intrinsic_instr_create(b->shader, op);
nir_deref_var *image_deref = vtn_access_chain_to_deref(b, image.image); nir_deref_var *image_deref = vtn_pointer_to_deref(b, image.image);
intrin->variables[0] = nir_deref_var_clone(image_deref, intrin); intrin->variables[0] = nir_deref_var_clone(image_deref, intrin);
/* ImageQuerySize doesn't take any extra parameters */ /* ImageQuerySize doesn't take any extra parameters */
@@ -2074,7 +2069,7 @@ static void
vtn_handle_ssbo_or_shared_atomic(struct vtn_builder *b, SpvOp opcode, vtn_handle_ssbo_or_shared_atomic(struct vtn_builder *b, SpvOp opcode,
const uint32_t *w, unsigned count) const uint32_t *w, unsigned count)
{ {
struct vtn_access_chain *chain; struct vtn_access_chain *ptr;
nir_intrinsic_instr *atomic; nir_intrinsic_instr *atomic;
switch (opcode) { switch (opcode) {
@@ -2093,13 +2088,11 @@ vtn_handle_ssbo_or_shared_atomic(struct vtn_builder *b, SpvOp opcode,
case SpvOpAtomicAnd: case SpvOpAtomicAnd:
case SpvOpAtomicOr: case SpvOpAtomicOr:
case SpvOpAtomicXor: case SpvOpAtomicXor:
chain = ptr = vtn_value(b, w[3], vtn_value_type_pointer)->pointer;
vtn_value(b, w[3], vtn_value_type_access_chain)->access_chain;
break; break;
case SpvOpAtomicStore: case SpvOpAtomicStore:
chain = ptr = vtn_value(b, w[1], vtn_value_type_pointer)->pointer;
vtn_value(b, w[1], vtn_value_type_access_chain)->access_chain;
break; break;
default: default:
@@ -2111,8 +2104,8 @@ vtn_handle_ssbo_or_shared_atomic(struct vtn_builder *b, SpvOp opcode,
SpvMemorySemanticsMask semantics = w[5]; SpvMemorySemanticsMask semantics = w[5];
*/ */
if (chain->var->mode == vtn_variable_mode_workgroup) { if (ptr->var->mode == vtn_variable_mode_workgroup) {
nir_deref_var *deref = vtn_access_chain_to_deref(b, chain); nir_deref_var *deref = vtn_pointer_to_deref(b, ptr);
const struct glsl_type *deref_type = nir_deref_tail(&deref->deref)->type; const struct glsl_type *deref_type = nir_deref_tail(&deref->deref)->type;
nir_intrinsic_op op = get_shared_nir_atomic_op(opcode); nir_intrinsic_op op = get_shared_nir_atomic_op(opcode);
atomic = nir_intrinsic_instr_create(b->nb.shader, op); atomic = nir_intrinsic_instr_create(b->nb.shader, op);
@@ -2151,10 +2144,10 @@ vtn_handle_ssbo_or_shared_atomic(struct vtn_builder *b, SpvOp opcode,
} }
} else { } else {
assert(chain->var->mode == vtn_variable_mode_ssbo); assert(ptr->var->mode == vtn_variable_mode_ssbo);
struct vtn_type *type; struct vtn_type *type;
nir_ssa_def *offset, *index; nir_ssa_def *offset, *index;
offset = vtn_access_chain_to_offset(b, chain, &index, &type, NULL, false); offset = vtn_pointer_to_offset(b, ptr, &index, &type, NULL, false);
nir_intrinsic_op op = get_ssbo_nir_atomic_op(opcode); nir_intrinsic_op op = get_ssbo_nir_atomic_op(opcode);
@@ -3071,7 +3064,7 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpImageQuerySize: { case SpvOpImageQuerySize: {
struct vtn_access_chain *image = struct vtn_access_chain *image =
vtn_value(b, w[3], vtn_value_type_access_chain)->access_chain; vtn_value(b, w[3], vtn_value_type_pointer)->pointer;
if (glsl_type_is_image(image->var->var->interface_type)) { if (glsl_type_is_image(image->var->var->interface_type)) {
vtn_handle_image(b, opcode, w, count); vtn_handle_image(b, opcode, w, count);
} else { } else {
@@ -3099,7 +3092,7 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
if (pointer->value_type == vtn_value_type_image_pointer) { if (pointer->value_type == vtn_value_type_image_pointer) {
vtn_handle_image(b, opcode, w, count); vtn_handle_image(b, opcode, w, count);
} else { } else {
assert(pointer->value_type == vtn_value_type_access_chain); assert(pointer->value_type == vtn_value_type_pointer);
vtn_handle_ssbo_or_shared_atomic(b, opcode, w, count); vtn_handle_ssbo_or_shared_atomic(b, opcode, w, count);
} }
break; break;
@@ -3110,7 +3103,7 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
if (pointer->value_type == vtn_value_type_image_pointer) { if (pointer->value_type == vtn_value_type_image_pointer) {
vtn_handle_image(b, opcode, w, count); vtn_handle_image(b, opcode, w, count);
} else { } else {
assert(pointer->value_type == vtn_value_type_access_chain); assert(pointer->value_type == vtn_value_type_pointer);
vtn_handle_ssbo_or_shared_atomic(b, opcode, w, count); vtn_handle_ssbo_or_shared_atomic(b, opcode, w, count);
} }
break; break;

View File

@@ -84,8 +84,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
break; break;
case SpvOpFunctionParameter: { case SpvOpFunctionParameter: {
struct vtn_value *val = struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_pointer);
vtn_push_value(b, w[2], vtn_value_type_access_chain);
struct vtn_type *type = vtn_value(b, w[1], vtn_value_type_type)->type; struct vtn_type *type = vtn_value(b, w[1], vtn_value_type_type)->type;
@@ -100,8 +99,8 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
struct vtn_variable *vtn_var = rzalloc(b, struct vtn_variable); struct vtn_variable *vtn_var = rzalloc(b, struct vtn_variable);
vtn_var->type = type; vtn_var->type = type;
vtn_var->var = param; vtn_var->var = param;
vtn_var->chain.var = vtn_var; vtn_var->ptr.var = vtn_var;
vtn_var->chain.length = 0; vtn_var->ptr.length = 0;
struct vtn_type *without_array = type; struct vtn_type *without_array = type;
while(glsl_type_is_array(without_array->type)) while(glsl_type_is_array(without_array->type))
@@ -117,7 +116,7 @@ vtn_cfg_handle_prepass_instruction(struct vtn_builder *b, SpvOp opcode,
vtn_var->mode = vtn_variable_mode_param; vtn_var->mode = vtn_variable_mode_param;
} }
val->access_chain = &vtn_var->chain; val->pointer = &vtn_var->ptr;
break; break;
} }

View File

@@ -44,7 +44,7 @@ enum vtn_value_type {
vtn_value_type_decoration_group, vtn_value_type_decoration_group,
vtn_value_type_type, vtn_value_type_type,
vtn_value_type_constant, vtn_value_type_constant,
vtn_value_type_access_chain, vtn_value_type_pointer,
vtn_value_type_function, vtn_value_type_function,
vtn_value_type_block, vtn_value_type_block,
vtn_value_type_ssa, vtn_value_type_ssa,
@@ -302,7 +302,7 @@ struct vtn_variable {
*/ */
struct vtn_access_chain *copy_prop_sampler; struct vtn_access_chain *copy_prop_sampler;
struct vtn_access_chain chain; struct vtn_access_chain ptr;
}; };
struct vtn_image_pointer { struct vtn_image_pointer {
@@ -328,7 +328,7 @@ struct vtn_value {
nir_constant *constant; nir_constant *constant;
const struct glsl_type *const_type; const struct glsl_type *const_type;
}; };
struct vtn_access_chain *access_chain; struct vtn_access_chain *pointer;
struct vtn_image_pointer *image; struct vtn_image_pointer *image;
struct vtn_sampled_image *sampled_image; struct vtn_sampled_image *sampled_image;
struct vtn_function *func; struct vtn_function *func;
@@ -459,13 +459,13 @@ nir_ssa_def *vtn_vector_insert_dynamic(struct vtn_builder *b, nir_ssa_def *src,
nir_deref_var *vtn_nir_deref(struct vtn_builder *b, uint32_t id); nir_deref_var *vtn_nir_deref(struct vtn_builder *b, uint32_t id);
nir_deref_var *vtn_access_chain_to_deref(struct vtn_builder *b, nir_deref_var *vtn_pointer_to_deref(struct vtn_builder *b,
struct vtn_access_chain *chain); struct vtn_access_chain *ptr);
nir_ssa_def * nir_ssa_def *
vtn_access_chain_to_offset(struct vtn_builder *b, vtn_pointer_to_offset(struct vtn_builder *b,
struct vtn_access_chain *chain, struct vtn_access_chain *ptr,
nir_ssa_def **index_out, struct vtn_type **type_out, nir_ssa_def **index_out, struct vtn_type **type_out,
unsigned *end_idx_out, bool stop_at_matrix); unsigned *end_idx_out, bool stop_at_matrix);
struct vtn_ssa_value *vtn_local_load(struct vtn_builder *b, nir_deref_var *src); struct vtn_ssa_value *vtn_local_load(struct vtn_builder *b, nir_deref_var *src);

View File

@@ -94,11 +94,11 @@ rewrite_deref_types(nir_deref *deref, const struct glsl_type *type)
} }
nir_deref_var * nir_deref_var *
vtn_access_chain_to_deref(struct vtn_builder *b, struct vtn_access_chain *chain) vtn_pointer_to_deref(struct vtn_builder *b, struct vtn_access_chain *chain)
{ {
/* Do on-the-fly copy propagation for samplers. */ /* Do on-the-fly copy propagation for samplers. */
if (chain->var->copy_prop_sampler) if (chain->var->copy_prop_sampler)
return vtn_access_chain_to_deref(b, chain->var->copy_prop_sampler); return vtn_pointer_to_deref(b, chain->var->copy_prop_sampler);
nir_deref_var *deref_var; nir_deref_var *deref_var;
if (chain->var->var) { if (chain->var->var) {
@@ -237,9 +237,9 @@ nir_deref_var *
vtn_nir_deref(struct vtn_builder *b, uint32_t id) vtn_nir_deref(struct vtn_builder *b, uint32_t id)
{ {
struct vtn_access_chain *chain = struct vtn_access_chain *chain =
vtn_value(b, id, vtn_value_type_access_chain)->access_chain; vtn_value(b, id, vtn_value_type_pointer)->pointer;
return vtn_access_chain_to_deref(b, chain); return vtn_pointer_to_deref(b, chain);
} }
/* /*
@@ -338,10 +338,10 @@ get_vulkan_resource_index(struct vtn_builder *b, struct vtn_access_chain *chain,
} }
nir_ssa_def * nir_ssa_def *
vtn_access_chain_to_offset(struct vtn_builder *b, vtn_pointer_to_offset(struct vtn_builder *b,
struct vtn_access_chain *chain, struct vtn_access_chain *chain,
nir_ssa_def **index_out, struct vtn_type **type_out, nir_ssa_def **index_out, struct vtn_type **type_out,
unsigned *end_idx_out, bool stop_at_matrix) unsigned *end_idx_out, bool stop_at_matrix)
{ {
unsigned idx = 0; unsigned idx = 0;
struct vtn_type *type; struct vtn_type *type;
@@ -712,7 +712,7 @@ vtn_block_load(struct vtn_builder *b, struct vtn_access_chain *src)
nir_ssa_def *offset, *index = NULL; nir_ssa_def *offset, *index = NULL;
struct vtn_type *type; struct vtn_type *type;
unsigned chain_idx; unsigned chain_idx;
offset = vtn_access_chain_to_offset(b, src, &index, &type, &chain_idx, true); offset = vtn_pointer_to_offset(b, src, &index, &type, &chain_idx, true);
struct vtn_ssa_value *value = NULL; struct vtn_ssa_value *value = NULL;
_vtn_block_load_store(b, op, true, index, offset, _vtn_block_load_store(b, op, true, index, offset,
@@ -728,7 +728,7 @@ vtn_block_store(struct vtn_builder *b, struct vtn_ssa_value *src,
nir_ssa_def *offset, *index = NULL; nir_ssa_def *offset, *index = NULL;
struct vtn_type *type; struct vtn_type *type;
unsigned chain_idx; unsigned chain_idx;
offset = vtn_access_chain_to_offset(b, dst, &index, &type, &chain_idx, true); offset = vtn_pointer_to_offset(b, dst, &index, &type, &chain_idx, true);
_vtn_block_load_store(b, nir_intrinsic_store_ssbo, false, index, offset, _vtn_block_load_store(b, nir_intrinsic_store_ssbo, false, index, offset,
0, 0, dst, chain_idx, type, &src); 0, 0, dst, chain_idx, type, &src);
@@ -764,9 +764,9 @@ _vtn_variable_load_store(struct vtn_builder *b, bool load,
* are storred row-major in a UBO. * are storred row-major in a UBO.
*/ */
if (load) { if (load) {
*inout = vtn_local_load(b, vtn_access_chain_to_deref(b, chain)); *inout = vtn_local_load(b, vtn_pointer_to_deref(b, chain));
} else { } else {
vtn_local_store(b, *inout, vtn_access_chain_to_deref(b, chain)); vtn_local_store(b, *inout, vtn_pointer_to_deref(b, chain));
} }
return; return;
@@ -1215,9 +1215,9 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
break; break;
} }
if (val->value_type == vtn_value_type_access_chain) { if (val->value_type == vtn_value_type_pointer) {
assert(val->access_chain->length == 0); assert(val->pointer->length == 0);
assert(val->access_chain->var == void_var); assert(val->pointer->var == void_var);
assert(member == -1); assert(member == -1);
} else { } else {
assert(val->value_type == vtn_value_type_type); assert(val->value_type == vtn_value_type_type);
@@ -1389,12 +1389,11 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
struct vtn_variable *var = rzalloc(b, struct vtn_variable); struct vtn_variable *var = rzalloc(b, struct vtn_variable);
var->type = vtn_value(b, w[1], vtn_value_type_type)->type; var->type = vtn_value(b, w[1], vtn_value_type_type)->type;
var->chain.var = var; var->ptr.var = var;
var->chain.length = 0; var->ptr.length = 0;
struct vtn_value *val = struct vtn_value *val = vtn_push_value(b, w[2], vtn_value_type_pointer);
vtn_push_value(b, w[2], vtn_value_type_access_chain); val->pointer = &var->ptr;
val->access_chain = &var->chain;
struct vtn_type *without_array = var->type; struct vtn_type *without_array = var->type;
while(glsl_type_is_array(without_array->type)) while(glsl_type_is_array(without_array->type))
@@ -1595,8 +1594,8 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
*/ */
base = base_val->sampled_image->image; base = base_val->sampled_image->image;
} else { } else {
assert(base_val->value_type == vtn_value_type_access_chain); assert(base_val->value_type == vtn_value_type_pointer);
base = base_val->access_chain; base = base_val->pointer;
} }
chain = vtn_access_chain_extend(b, base, count - 4); chain = vtn_access_chain_extend(b, base, count - 4);
@@ -1622,27 +1621,27 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
val->sampled_image->sampler = base_val->sampled_image->sampler; val->sampled_image->sampler = base_val->sampled_image->sampler;
} else { } else {
struct vtn_value *val = struct vtn_value *val =
vtn_push_value(b, w[2], vtn_value_type_access_chain); vtn_push_value(b, w[2], vtn_value_type_pointer);
val->access_chain = chain; val->pointer = chain;
} }
break; break;
} }
case SpvOpCopyMemory: { case SpvOpCopyMemory: {
struct vtn_value *dest = vtn_value(b, w[1], vtn_value_type_access_chain); struct vtn_value *dest = vtn_value(b, w[1], vtn_value_type_pointer);
struct vtn_value *src = vtn_value(b, w[2], vtn_value_type_access_chain); struct vtn_value *src = vtn_value(b, w[2], vtn_value_type_pointer);
vtn_variable_copy(b, dest->access_chain, src->access_chain); vtn_variable_copy(b, dest->pointer, src->pointer);
break; break;
} }
case SpvOpLoad: { case SpvOpLoad: {
struct vtn_access_chain *src = struct vtn_access_chain *src =
vtn_value(b, w[3], vtn_value_type_access_chain)->access_chain; vtn_value(b, w[3], vtn_value_type_pointer)->pointer;
if (src->var->mode == vtn_variable_mode_image || if (src->var->mode == vtn_variable_mode_image ||
src->var->mode == vtn_variable_mode_sampler) { src->var->mode == vtn_variable_mode_sampler) {
vtn_push_value(b, w[2], vtn_value_type_access_chain)->access_chain = src; vtn_push_value(b, w[2], vtn_value_type_pointer)->pointer = src;
return; return;
} }
@@ -1653,14 +1652,14 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
case SpvOpStore: { case SpvOpStore: {
struct vtn_access_chain *dest = struct vtn_access_chain *dest =
vtn_value(b, w[1], vtn_value_type_access_chain)->access_chain; vtn_value(b, w[1], vtn_value_type_pointer)->pointer;
if (glsl_type_is_sampler(dest->var->type->type)) { if (glsl_type_is_sampler(dest->var->type->type)) {
vtn_warn("OpStore of a sampler detected. Doing on-the-fly copy " vtn_warn("OpStore of a sampler detected. Doing on-the-fly copy "
"propagation to workaround the problem."); "propagation to workaround the problem.");
assert(dest->var->copy_prop_sampler == NULL); assert(dest->var->copy_prop_sampler == NULL);
dest->var->copy_prop_sampler = dest->var->copy_prop_sampler =
vtn_value(b, w[2], vtn_value_type_access_chain)->access_chain; vtn_value(b, w[2], vtn_value_type_pointer)->pointer;
break; break;
} }
@@ -1671,7 +1670,7 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
case SpvOpArrayLength: { case SpvOpArrayLength: {
struct vtn_access_chain *chain = struct vtn_access_chain *chain =
vtn_value(b, w[3], vtn_value_type_access_chain)->access_chain; vtn_value(b, w[3], vtn_value_type_pointer)->pointer;
const uint32_t offset = chain->var->type->offsets[w[4]]; const uint32_t offset = chain->var->type->offsets[w[4]];
const uint32_t stride = chain->var->type->members[w[4]]->stride; const uint32_t stride = chain->var->type->members[w[4]]->stride;