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