From 7a9d76fcfc8f0266b6f94abbe452ae1bb36e359c Mon Sep 17 00:00:00 2001
From: Vivek Trivedi <5340687+trivedivivek@users.noreply.github.com>
Date: Wed, 19 Mar 2025 15:48:23 -0700
Subject: [PATCH] [ET-VK] Simplify lane offset copy logic in
 copy_packed_dim_offset shader.

This diff simplifies the logic for handling different lane offsets in `copy_packed_dim_offset` shader.

Differential Revision: [D71507929](https://our.internmc.facebook.com/intern/diff/D71507929/)

[ghstack-poisoned]
---
 .../graph/ops/glsl/copy_packed_dim_offset.glsl      | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/backends/vulkan/runtime/graph/ops/glsl/copy_packed_dim_offset.glsl b/backends/vulkan/runtime/graph/ops/glsl/copy_packed_dim_offset.glsl
index c80cc9aa6dc..386be380072 100644
--- a/backends/vulkan/runtime/graph/ops/glsl/copy_packed_dim_offset.glsl
+++ b/backends/vulkan/runtime/graph/ops/glsl/copy_packed_dim_offset.glsl
@@ -69,22 +69,15 @@ void no_repeat_copy(ivec3 pos) {
     // Keep input values from the end of current input pixel based on src_lane_offset
     // offset 1 means the first lane of current input texel is not a part of the output texel
     // offset 2 means first 2 lanes are not and so on
-    if (src_lane_offset == 1) {
-      in_value.xyz = in_value.yzw;
-    } else if (src_lane_offset == 2) {
-      in_value.xy = in_value.zw;
-    } else {
-      in_value.x = in_value.w;
-    }
     // Copy next texel's values towards the end of input texel, based on lane offset
     // offset 1 means the first lane from next texel is part of the input texel
     // offset 2 means first 2 lanes from next texel is part of the input texel and so on
     if (src_lane_offset == 1) {
-      in_value.w = next_value.x;
+      in_value = ivec4(in_value.yzw, next_value.x);
     } else if (src_lane_offset == 2) {
-      in_value.zw = next_value.xy;
+      in_value = ivec4(in_value.zw, next_value.xy);
     } else {
-      in_value.yzw = next_value.xyz;
+      in_value = ivec4(in_value.w, next_value.xyz);
     }
   }