Skip to content

Commit 8a52afb

Browse files
committed
[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-source-id: 272850534 Pull Request resolved: #9416
1 parent 0af3f95 commit 8a52afb

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

backends/vulkan/runtime/graph/ops/glsl/copy_packed_dim_offset.glsl

+3-10
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,15 @@ void no_repeat_copy(ivec3 pos) {
6969
// Keep input values from the end of current input pixel based on src_lane_offset
7070
// offset 1 means the first lane of current input texel is not a part of the output texel
7171
// offset 2 means first 2 lanes are not and so on
72-
if (src_lane_offset == 1) {
73-
in_value.xyz = in_value.yzw;
74-
} else if (src_lane_offset == 2) {
75-
in_value.xy = in_value.zw;
76-
} else {
77-
in_value.x = in_value.w;
78-
}
7972
// Copy next texel's values towards the end of input texel, based on lane offset
8073
// offset 1 means the first lane from next texel is part of the input texel
8174
// offset 2 means first 2 lanes from next texel is part of the input texel and so on
8275
if (src_lane_offset == 1) {
83-
in_value.w = next_value.x;
76+
in_value = ivec4(in_value.yzw, next_value.x);
8477
} else if (src_lane_offset == 2) {
85-
in_value.zw = next_value.xy;
78+
in_value = ivec4(in_value.zw, next_value.xy);
8679
} else {
87-
in_value.yzw = next_value.xyz;
80+
in_value = ivec4(in_value.w, next_value.xyz);
8881
}
8982
}
9083

0 commit comments

Comments
 (0)