* vector to extract.
*/
- struct vtn_ssa_value *ret = rzalloc(b, struct vtn_ssa_value);
- ret->type = glsl_scalar_type(glsl_get_base_type(cur->type));
+ const struct glsl_type *scalar_type =
+ glsl_scalar_type(glsl_get_base_type(cur->type));
+ struct vtn_ssa_value *ret = vtn_create_ssa_value(b, scalar_type);
ret->def = nir_channel(&b->nb, cur->def, indices[i]);
return ret;
} else {
struct vtn_type *type, enum gl_access_qualifier access,
struct vtn_ssa_value **inout)
{
- if (load && *inout == NULL)
- *inout = vtn_create_ssa_value(b, type->type);
-
enum glsl_base_type base_type = glsl_get_base_type(type->type);
switch (base_type) {
case GLSL_TYPE_UINT:
nir_ssa_def *offset, *index = NULL;
offset = vtn_pointer_to_offset(b, src, &index);
- struct vtn_ssa_value *value = NULL;
+ struct vtn_ssa_value *value = vtn_create_ssa_value(b, src->type->type);
_vtn_block_load_store(b, op, true, index, offset,
access_offset, access_size,
src->type, src->access, &value);
* deref.
*/
if (load) {
- *inout = vtn_create_ssa_value(b, ptr->type->type);
(*inout)->def = nir_load_deref_with_access(&b->nb, deref,
ptr->type->access | access);
} else {
case GLSL_TYPE_ARRAY:
case GLSL_TYPE_STRUCT: {
unsigned elems = glsl_get_length(ptr->type->type);
- if (load) {
- vtn_assert(*inout == NULL);
- *inout = rzalloc(b, struct vtn_ssa_value);
- (*inout)->type = ptr->type->type;
- (*inout)->elems = rzalloc_array(b, struct vtn_ssa_value *, elems);
- }
-
struct vtn_access_chain chain = {
.length = 1,
.link = {
if (vtn_pointer_uses_ssa_offset(b, src)) {
return vtn_block_load(b, src);
} else {
- struct vtn_ssa_value *val = NULL;
+ struct vtn_ssa_value *val = vtn_create_ssa_value(b, src->type->type);
_vtn_variable_load_store(b, true, src, src->access, &val);
return val;
}