1 // 2 // Copyright (c) 2017 The Khronos Group Inc. 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 #ifndef _testBase_h 17 #define _testBase_h 18 19 #include <stdio.h> 20 #include <stdlib.h> 21 #include <math.h> 22 #include <string.h> 23 24 #if !defined(_WIN32) 25 #include <stdbool.h> 26 #endif 27 28 #include <sys/types.h> 29 #include <sys/stat.h> 30 31 #if !defined (__APPLE__) 32 #include <CL/cl.h> 33 #include "gles/gl_headers.h" 34 #include <CL/cl_gl.h> 35 #else 36 #include "gl/gl_headers.h" 37 #endif 38 39 #include "harness/errorHelpers.h" 40 #include "harness/kernelHelpers.h" 41 #include "harness/threadTesting.h" 42 #include "harness/typeWrappers.h" 43 #include "harness/conversions.h" 44 #include "harness/mt19937.h" 45 46 #ifdef GL_ES_VERSION_2_0 47 #include "gles/helpers.h" 48 #else 49 #include "gl/helpers.h" 50 #endif 51 52 extern const char *get_kernel_suffix( cl_image_format *format ); 53 extern const char *get_write_conversion( cl_image_format *format, ExplicitType type); 54 extern ExplicitType get_read_kernel_type( cl_image_format *format ); 55 extern ExplicitType get_write_kernel_type( cl_image_format *format ); 56 57 extern char * convert_to_expected( void * inputBuffer, size_t numPixels, ExplicitType inType, ExplicitType outType ); 58 extern int validate_integer_results( void *expectedResults, void *actualResults, size_t width, size_t height, size_t typeSize ); 59 extern int validate_integer_results( void *expectedResults, void *actualResults, size_t width, size_t height, size_t depth, size_t typeSize ); 60 extern int validate_float_results( void *expectedResults, void *actualResults, size_t width, size_t height ); 61 extern int validate_float_results( void *expectedResults, void *actualResults, size_t width, size_t height, size_t depth ); 62 63 extern int CheckGLObjectInfo(cl_mem mem, cl_gl_object_type expected_cl_gl_type, GLuint expected_gl_name, 64 GLenum expected_cl_gl_texture_target, GLint expected_cl_gl_mipmap_level); 65 66 extern bool CheckGLIntegerExtensionSupport(); 67 68 #endif // _testBase_h 69 70 71 72