| 924 | |
| 925 | |
| 926 | void reorder_verification_buffer(GLenum glFormat, GLenum glType, char* buffer, size_t num_pixels) |
| 927 | { |
| 928 | if( glType == GL_UNSIGNED_INT_8_8_8_8_REV && glFormat == GL_BGRA) |
| 929 | { |
| 930 | // Reverse and reorder to validate since in the |
| 931 | // kernel the read_imagef() call always returns RGBA |
| 932 | cl_uchar *p = (cl_uchar *)buffer; |
| 933 | for( size_t i = 0; i < num_pixels; i++ ) |
| 934 | { |
| 935 | cl_uchar uc0 = p[i * 4 + 0]; |
| 936 | cl_uchar uc1 = p[i * 4 + 1]; |
| 937 | cl_uchar uc2 = p[i * 4 + 2]; |
| 938 | cl_uchar uc3 = p[i * 4 + 3]; |
| 939 | |
| 940 | p[ i * 4 + 0 ] = uc2; |
| 941 | p[ i * 4 + 1 ] = uc1; |
| 942 | p[ i * 4 + 2 ] = uc0; |
| 943 | p[ i * 4 + 3 ] = uc3; |
| 944 | } |
| 945 | } |
| 946 | else if( glType == GL_UNSIGNED_INT_8_8_8_8 && glFormat == GL_BGRA) |
| 947 | { |
| 948 | // Reverse and reorder to validate since in the |
| 949 | // kernel the read_imagef() call always returns RGBA |
| 950 | cl_uchar *p = (cl_uchar *)buffer; |
| 951 | for( size_t i = 0; i < num_pixels; i++ ) |
| 952 | { |
| 953 | cl_uchar uc0 = p[i * 4 + 0]; |
| 954 | cl_uchar uc1 = p[i * 4 + 1]; |
| 955 | cl_uchar uc2 = p[i * 4 + 2]; |
| 956 | cl_uchar uc3 = p[i * 4 + 3]; |
| 957 | |
| 958 | p[ i * 4 + 0 ] = uc1; |
| 959 | p[ i * 4 + 1 ] = uc2; |
| 960 | p[ i * 4 + 2 ] = uc3; |
| 961 | p[ i * 4 + 3 ] = uc0; |
| 962 | } |
| 963 | } |
| 964 | } |
| 965 | |
| 966 | |
| 967 | #ifdef GL_VERSION_3_2 |
no outgoing calls
no test coverage detected