Minor fixes for CL_ARGB channel order. (#1128)

Signed-off-by: John Kesapides <john.kesapides@arm.com>
Change-Id: I4f6bbce14535f6156365a5a46c4739d6a7257ab2
This commit is contained in:
John Kesapides
2021-01-29 14:15:16 +00:00
committed by GitHub
parent 31fafb0ff5
commit c587b45a2b

View File

@@ -1,5 +1,5 @@
//
// Copyright (c) 2017 The Khronos Group Inc.
// Copyright (c) 2017,2021 The Khronos Group Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -550,6 +550,7 @@ int has_alpha(const cl_image_format *format)
case CL_RGBA: return 1;
case CL_BGRA: return 1;
case CL_ARGB: return 1;
case CL_ABGR: return 1;
case CL_INTENSITY: return 1;
case CL_LUMINANCE: return 0;
#ifdef CL_BGR1_APPLE
@@ -1416,6 +1417,12 @@ void read_image_pixel_float(void *imageData, image_descriptor *imageInfo, int x,
outData[2] = tempData[3];
outData[3] = tempData[0];
break;
case CL_ABGR:
outData[0] = tempData[3];
outData[1] = tempData[2];
outData[2] = tempData[1];
outData[3] = tempData[0];
break;
case CL_BGRA:
case CL_sBGRA:
outData[0] = tempData[2];
@@ -2398,6 +2405,14 @@ void swizzle_vector_for_image(T *srcVector, const cl_image_format *imageFormat)
srcVector[1] = srcVector[0];
srcVector[0] = temp;
break;
case CL_ABGR:
temp = srcVector[3];
srcVector[3] = srcVector[0];
srcVector[0] = temp;
temp = srcVector[2];
srcVector[2] = srcVector[1];
srcVector[1] = temp;
break;
case CL_BGRA:
case CL_sBGRA:
temp = srcVector[0];