diff options
author | Xinghang Zhou <xinghang.zhou@arm.com> | 2017-11-14 15:14:25 +0800 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:42:33 +0000 |
commit | 53a6ec5944132000e2c6779c04d722b3b2d2501c (patch) | |
tree | 75b147d21a34c4e684864e56b71077a6256a9110 /src/core/GLES_COMPUTE/cs_shaders/fill_border.cs | |
parent | 6e993b5b8ea9c31ac4856b72d969dce704f82396 (diff) | |
download | ComputeLibrary-53a6ec5944132000e2c6779c04d722b3b2d2501c.tar.gz |
APPBROWSER-304,342: Add exclude padding support for OpenGL ES implementation and implement MaxPool operators
Change-Id: Ie6ba36ff114feec2a21739dba11bbb60b76af443
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/113697
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Stephen Li <stephen.li@arm.com>
Reviewed-by: Pablo Tello <pablo.tello@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/core/GLES_COMPUTE/cs_shaders/fill_border.cs')
-rw-r--r-- | src/core/GLES_COMPUTE/cs_shaders/fill_border.cs | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/src/core/GLES_COMPUTE/cs_shaders/fill_border.cs b/src/core/GLES_COMPUTE/cs_shaders/fill_border.cs index c64572b061..4f87b9242a 100644 --- a/src/core/GLES_COMPUTE/cs_shaders/fill_border.cs +++ b/src/core/GLES_COMPUTE/cs_shaders/fill_border.cs @@ -132,7 +132,7 @@ void main() ImageIterator buf_iter = CONVERT_TENSOR3D_TO_IMAGE_ITERATOR_NO_STEP(buf_attrs, buf_shift); // Update pointer to point to the starting point of the valid region - TENSOR_ITERATOR_ADVANCE_IN_BYTES(buf_iter, uint(start_pos_y) * buf_attrs.stride_y + uint(start_pos_x) * buf_attrs.stride_x); + TENSOR_ITERATOR_ADVANCE_IN_BYTES(buf_iter, start_pos_y * int(buf_attrs.stride_y) + start_pos_x * int(buf_attrs.stride_x)); int total_width = BORDER_SIZE_LEFT + int(width) + BORDER_SIZE_RIGHT; int gid0 = int(gl_GlobalInvocationID.x); @@ -158,12 +158,29 @@ void main() { if(pos % 2 == 0) { - STORE_PACK2_HALF(buf_ptr, offset, left_val.xx); + if(BORDER_SIZE_LEFT % 2 == 0) + { + STORE_PACK2_HALF(buf_ptr, offset, left_val.xx); + } + else + { + STORE_PACK2_HALF(buf_ptr, offset, left_val.yy); + } + i++; } } } // Handle right border - vec2 right_val = LOAD_UNPACK2_HALF(buf_ptr, IMAGE_OFFSET(buf_iter, int(width) - 1, gidH)); + vec2 right_val_origin = LOAD_UNPACK2_HALF(buf_ptr, IMAGE_OFFSET(buf_iter, int(width) - 1, gidH)); + vec2 right_val; + if((((BORDER_SIZE_LEFT + int(width)) % 2)) == 1) + { + right_val = vec2(right_val_origin.x, right_val_origin.x); + } + else + { + right_val = vec2(right_val_origin.y, right_val_origin.y); + } for(int i = 0; i < BORDER_SIZE_RIGHT; ++i) { uint offset = IMAGE_OFFSET(buf_iter, int(width) + i, gidH); @@ -173,7 +190,8 @@ void main() { if(pos % 2 == 0) { - STORE_PACK2_HALF(buf_ptr, offset, right_val.yy); + STORE_PACK2_HALF(buf_ptr, offset, right_val); + i++; } else { @@ -184,7 +202,8 @@ void main() { if(pos % 2 == 0) { - STORE_PACK2_HALF(buf_ptr, offset, right_val.yy); + STORE_PACK2_HALF(buf_ptr, offset, right_val); + i++; } } } @@ -208,7 +227,14 @@ void main() { if(gidW == (int(width) - 1)) { - STORE_PACK2_HALF(buf_ptr, offset, top_val.xx); + if(((BORDER_SIZE_LEFT + int(width)) % 2 == 1)) + { + STORE_PACK2_HALF(buf_ptr, offset, top_val.xx); + } + else + { + STORE_PACK2_HALF(buf_ptr, offset, top_val.yy); + } } else { @@ -229,6 +255,10 @@ void main() { STORE_PACK2_HALF(buf_ptr, offset, top_val.yy); } + else + { + STORE_PACK2_HALF(buf_ptr, offset, top_val.xx); + } } else { @@ -268,6 +298,10 @@ void main() { STORE_PACK2_HALF(buf_ptr, offset, bottom_val.yy); } + else + { + STORE_PACK2_HALF(buf_ptr, offset, bottom_val.xx); + } } else { |