diff options
author | Jason Ekstrand <[email protected]> | 2016-12-24 09:42:34 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-12-30 12:38:04 -0800 |
commit | 134a5ad31c8d39219f241f7a7cad246a6864c74b (patch) | |
tree | f31ba3874da61a7d6a75fd13c9dc89f42339a873 /src/compiler/nir/nir_lower_tex.c | |
parent | 832dddcf91f168ab057cb5c7f6914b24ae6b864c (diff) |
nir: Make nir_copy_deref follow the "clone" pattern
We rename it to nir_deref_clone, re-order the sources to match the other
clone functions, and expose nir_deref_var_clone. This past part, in
particular, lets us get rid of quite a few lines since we no longer have
to call nir_copy_deref and wrap it in deref_as_var.
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_lower_tex.c')
-rw-r--r-- | src/compiler/nir/nir_lower_tex.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/compiler/nir/nir_lower_tex.c b/src/compiler/nir/nir_lower_tex.c index 3e3ac8c2558..66e231762f8 100644 --- a/src/compiler/nir/nir_lower_tex.c +++ b/src/compiler/nir/nir_lower_tex.c @@ -163,11 +163,9 @@ get_texture_size(nir_builder *b, nir_tex_instr *tex) txs->is_shadow = tex->is_shadow; txs->is_new_style_shadow = tex->is_new_style_shadow; txs->texture_index = tex->texture_index; - txs->texture = (nir_deref_var *) - nir_copy_deref(txs, &tex->texture->deref); + txs->texture = nir_deref_var_clone(tex->texture, txs); txs->sampler_index = tex->sampler_index; - txs->sampler = (nir_deref_var *) - nir_copy_deref(txs, &tex->sampler->deref); + txs->sampler = nir_deref_var_clone(tex->sampler, txs); txs->dest_type = nir_type_int; /* only single src, the lod: */ @@ -221,11 +219,9 @@ sample_plane(nir_builder *b, nir_tex_instr *tex, int plane) plane_tex->coord_components = 2; plane_tex->texture_index = tex->texture_index; - plane_tex->texture = (nir_deref_var *) - nir_copy_deref(plane_tex, &tex->texture->deref); + plane_tex->texture = nir_deref_var_clone(tex->texture, plane_tex); plane_tex->sampler_index = tex->sampler_index; - plane_tex->sampler = (nir_deref_var *) - nir_copy_deref(plane_tex, &tex->sampler->deref); + plane_tex->sampler = nir_deref_var_clone(tex->sampler, plane_tex); nir_ssa_dest_init(&plane_tex->instr, &plane_tex->dest, 4, 32, NULL); @@ -325,10 +321,8 @@ replace_gradient_with_lod(nir_builder *b, nir_ssa_def *lod, nir_tex_instr *tex) txl->is_shadow = tex->is_shadow; txl->is_new_style_shadow = tex->is_new_style_shadow; txl->sampler_index = tex->sampler_index; - txl->texture = (nir_deref_var *) - nir_copy_deref(txl, &tex->texture->deref); - txl->sampler = (nir_deref_var *) - nir_copy_deref(txl, &tex->sampler->deref); + txl->texture = nir_deref_var_clone(tex->texture, txl); + txl->sampler = nir_deref_var_clone(tex->sampler, txl); txl->coord_components = tex->coord_components; nir_ssa_dest_init(&txl->instr, &txl->dest, 4, 32, NULL); |