summaryrefslogtreecommitdiff
path: root/src/amd/vulkan/radv_meta_blit2d.c
diff options
context:
space:
mode:
authorKarol Herbst <kherbst@redhat.com>2018-07-13 03:33:22 +0200
committerKarol Herbst <kherbst@redhat.com>2018-07-13 15:46:57 +0200
commitcb65246ed2ac826285b6d6cc6e1994ff1299e531 (patch)
tree41b6f0180b5f5f41f7c96aed00e05f8917a3bdc3 /src/amd/vulkan/radv_meta_blit2d.c
parent0288fe8d0417730bdd5b3477130dd1dc32bdbcd3 (diff)
nir: cleanup oversized arrays in nir_swizzle calls
There are no fixed sized array arguments in C, those are simply pointers to unsized arrays and as the size is passed in anyway, just rely on that. where possible calls are replaced by nir_channel and nir_channels. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Signed-off-by: Karol Herbst <kherbst@redhat.com>
Diffstat (limited to 'src/amd/vulkan/radv_meta_blit2d.c')
-rw-r--r--src/amd/vulkan/radv_meta_blit2d.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/amd/vulkan/radv_meta_blit2d.c b/src/amd/vulkan/radv_meta_blit2d.c
index 85e2d4678e9..cac0a4dd55f 100644
--- a/src/amd/vulkan/radv_meta_blit2d.c
+++ b/src/amd/vulkan/radv_meta_blit2d.c
@@ -608,8 +608,7 @@ build_nir_copy_fragment_shader(struct radv_device *device,
}
nir_ssa_def *pos_int = nir_f2i32(&b, nir_load_var(&b, tex_pos_in));
- unsigned swiz[4] = { 0, 1 };
- nir_ssa_def *tex_pos = nir_swizzle(&b, pos_int, swiz, 2, false);
+ nir_ssa_def *tex_pos = nir_channels(&b, pos_int, 0x3);
nir_ssa_def *color = txf_func(&b, device, tex_pos, is_3d, is_multisampled);
nir_store_var(&b, color_out, color, 0xf);
@@ -642,8 +641,7 @@ build_nir_copy_fragment_shader_depth(struct radv_device *device,
}
nir_ssa_def *pos_int = nir_f2i32(&b, nir_load_var(&b, tex_pos_in));
- unsigned swiz[4] = { 0, 1 };
- nir_ssa_def *tex_pos = nir_swizzle(&b, pos_int, swiz, 2, false);
+ nir_ssa_def *tex_pos = nir_channels(&b, pos_int, 0x3);
nir_ssa_def *color = txf_func(&b, device, tex_pos, is_3d, is_multisampled);
nir_store_var(&b, color_out, color, 0x1);
@@ -676,8 +674,7 @@ build_nir_copy_fragment_shader_stencil(struct radv_device *device,
}
nir_ssa_def *pos_int = nir_f2i32(&b, nir_load_var(&b, tex_pos_in));
- unsigned swiz[4] = { 0, 1 };
- nir_ssa_def *tex_pos = nir_swizzle(&b, pos_int, swiz, 2, false);
+ nir_ssa_def *tex_pos = nir_channels(&b, pos_int, 0x3);
nir_ssa_def *color = txf_func(&b, device, tex_pos, is_3d, is_multisampled);
nir_store_var(&b, color_out, color, 0x1);