diff --git a/CMakeLists.txt b/CMakeLists.txt index 083ea96d..5b1f48fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -152,10 +152,6 @@ if(LINK_PTHREAD) list(APPEND CLConform_LIBRARIES pthread) endif() -if(DEFINED USE_GLES3) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLES3") -endif() - if(APPLE) find_library(corefoundation CoreFoundation) find_library(iokit IOKit) diff --git a/test_common/CMakeLists.txt b/test_common/CMakeLists.txt index 2d4bc190..61580300 100644 --- a/test_common/CMakeLists.txt +++ b/test_common/CMakeLists.txt @@ -1,6 +1,5 @@ set(HARNESS_SOURCES - harness/threadTesting.cpp harness/typeWrappers.cpp harness/mt19937.cpp harness/conversions.cpp @@ -23,3 +22,7 @@ set(HARNESS_SOURCES add_library(harness STATIC ${HARNESS_SOURCES}) +if(MSVC) + # Don't warn about using the portable "strdup" function. + target_compile_definitions(harness PRIVATE _CRT_NONSTDC_NO_DEPRECATE) +endif() \ No newline at end of file diff --git a/test_common/gles/helpers.cpp b/test_common/gles/helpers.cpp index 34f40b4c..57a4ddc1 100644 --- a/test_common/gles/helpers.cpp +++ b/test_common/gles/helpers.cpp @@ -22,7 +22,7 @@ {GLint __error = glGetError(); if(__error) {log_error( "GL ERROR: %s!\n", gluErrorString( err ));}} #if defined(__linux__) || defined(GL_ES_VERSION_2_0) -// On linux we dont link to GLU library to avoid comaptibility issues with +// On linux we don't link to GLU library to avoid compatibility issues with // libstdc++ // FIXME: Implement this const GLubyte* gluErrorString (GLenum error) @@ -271,8 +271,6 @@ void * ReadGLTexture( GLenum glTarget, GLuint glTexture, // Read results from the GL texture glBindTexture(get_base_gl_target(glTarget), glTexture); - GLint realWidth, realHeight; - GLint realInternalFormat; GLenum readBackFormat = GL_RGBA; GLenum readBackType = glType; glFramebufferWrapper glFramebuffer; @@ -301,7 +299,7 @@ void * ReadGLTexture( GLenum glTarget, GLuint glTexture, GetGLFormatName(readBackFormat), GetGLTypeName(readBackType)); - DumpGLBuffer(readBackType, realWidth, realHeight, (void*)outBuffer); + DumpGLBuffer(readBackType, outWidth, outHeight, (void *)outBuffer); #endif diff --git a/test_common/gles/helpers.h b/test_common/gles/helpers.h index 5bd0fdf1..20768787 100644 --- a/test_common/gles/helpers.h +++ b/test_common/gles/helpers.h @@ -30,11 +30,10 @@ #if !defined (__APPLE__) #include -#include "gl_headers.h" #include -#else -#include "gl_headers.h" +#include #endif +#include "gl_headers.h" #include "harness/errorHelpers.h" #include "harness/kernelHelpers.h" diff --git a/test_common/harness/ThreadPool.cpp b/test_common/harness/ThreadPool.cpp index 31985aa0..5dae1b4a 100644 --- a/test_common/harness/ThreadPool.cpp +++ b/test_common/harness/ThreadPool.cpp @@ -523,7 +523,7 @@ void ThreadPool_Init(void) { // Count the number of bits in ProcessorMask (number of // logical cores) - ULONG mask = ptr->ProcessorMask; + ULONG_PTR mask = ptr->ProcessorMask; while (mask) { ++gThreadCount; @@ -688,7 +688,10 @@ static BOOL CALLBACK _ThreadPool_Init(_PINIT_ONCE InitOnce, PVOID Parameter, void ThreadPool_Exit(void) { - int err, count; +#ifndef _WIN32 + int err; +#endif + int count; gRunCount = CL_INT_MAX; #if defined(__GNUC__) @@ -738,7 +741,9 @@ void ThreadPool_Exit(void) // all available then it would make more sense to use those features. cl_int ThreadPool_Do(TPFuncPtr func_ptr, cl_uint count, void *userInfo) { +#ifndef _WIN32 cl_int newErr; +#endif cl_int err = 0; // Lazily set up our threads #if defined(_MSC_VER) && (_WIN32_WINNT >= 0x600) @@ -913,7 +918,9 @@ cl_int ThreadPool_Do(TPFuncPtr func_ptr, cl_uint count, void *userInfo) err = jobError; +#ifndef _WIN32 exit: +#endif // exit critical region #if defined(_WIN32) LeaveCriticalSection(gThreadPoolLock); diff --git a/test_common/harness/compat.h b/test_common/harness/compat.h index 7aad15a0..3b557852 100644 --- a/test_common/harness/compat.h +++ b/test_common/harness/compat.h @@ -18,13 +18,13 @@ #if defined(_WIN32) && defined(_MSC_VER) #include -#endif - +#else #ifdef __cplusplus #define EXTERN_C extern "C" #else #define EXTERN_C #endif +#endif // diff --git a/test_common/harness/conversions.cpp b/test_common/harness/conversions.cpp index fc3317c7..c7731269 100644 --- a/test_common/harness/conversions.cpp +++ b/test_common/harness/conversions.cpp @@ -181,8 +181,8 @@ static ULong sUpperLimits[kNumExplicitTypes] = { 0xffffffffLL, 0xffffffffLL, 0x7fffffffffffffffLL, - 0xffffffffffffffffLL, - 0xffffffffffffffffLL, + 0xffffffffffffffffULL, + 0xffffffffffffffffULL, 0, 0 }; // Last two values aren't stored here diff --git a/test_common/harness/errorHelpers.cpp b/test_common/harness/errorHelpers.cpp index 22a2677d..3ddbc37b 100644 --- a/test_common/harness/errorHelpers.cpp +++ b/test_common/harness/errorHelpers.cpp @@ -564,7 +564,7 @@ cl_int OutputBuildLogs(cl_program program, cl_uint num_devices, error = clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &size_ret); test_error(error, "Unable to query context's device size"); - num_devices = size_ret / sizeof(cl_device_id); + num_devices = static_cast(size_ret / sizeof(cl_device_id)); device_list = (cl_device_id *)malloc(size_ret); if (device_list == NULL) { @@ -695,7 +695,7 @@ int check_functions_for_offline_compiler(const char *subtestname, { if (gCompilationMode != kOnline) { - int nNotRequiredWithOfflineCompiler = + size_t nNotRequiredWithOfflineCompiler = sizeof(subtests_to_skip_with_offline_compiler) / sizeof(char *); size_t i; for (i = 0; i < nNotRequiredWithOfflineCompiler; ++i) @@ -707,4 +707,4 @@ int check_functions_for_offline_compiler(const char *subtestname, } } return 0; -} +} \ No newline at end of file diff --git a/test_common/harness/errorHelpers.h b/test_common/harness/errorHelpers.h index 19446014..c7f49e3d 100644 --- a/test_common/harness/errorHelpers.h +++ b/test_common/harness/errorHelpers.h @@ -56,11 +56,6 @@ static int vlog_win32(const char *format, ...); #define vlog printf #endif -#define ct_assert(b) ct_assert_i(b, __LINE__) -#define ct_assert_i(b, line) ct_assert_ii(b, line) -#define ct_assert_ii(b, line) \ - int _compile_time_assertion_on_line_##line[b ? 1 : -1]; - #define test_fail(msg, ...) \ { \ log_error(msg, ##__VA_ARGS__); \ diff --git a/test_common/harness/fpcontrol.h b/test_common/harness/fpcontrol.h index 9f065044..2add9baf 100644 --- a/test_common/harness/fpcontrol.h +++ b/test_common/harness/fpcontrol.h @@ -30,7 +30,11 @@ // that rounding mode. #if defined(__APPLE__) || defined(_MSC_VER) || defined(__linux__) \ || defined(__MINGW32__) +#ifdef _MSC_VER typedef int FPU_mode_type; +#else +typedef int64_t FPU_mode_type; +#endif #if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) \ || defined(__MINGW32__) #include @@ -55,7 +59,7 @@ inline void ForceFTZ(FPU_mode_type *mode) __asm__ volatile("fmxr fpscr, %0" ::"r"(fpscr | (1U << 24))); // Add 64 bit support #elif defined(__aarch64__) - unsigned fpscr; + uint64_t fpscr; __asm__ volatile("mrs %0, fpcr" : "=r"(fpscr)); *mode = fpscr; __asm__ volatile("msr fpcr, %0" ::"r"(fpscr | (1U << 24))); @@ -81,7 +85,7 @@ inline void DisableFTZ(FPU_mode_type *mode) __asm__ volatile("fmxr fpscr, %0" ::"r"(fpscr & ~(1U << 24))); // Add 64 bit support #elif defined(__aarch64__) - unsigned fpscr; + uint64_t fpscr; __asm__ volatile("mrs %0, fpcr" : "=r"(fpscr)); *mode = fpscr; __asm__ volatile("msr fpcr, %0" ::"r"(fpscr & ~(1U << 24))); diff --git a/test_common/harness/imageHelpers.cpp b/test_common/harness/imageHelpers.cpp index 72a2f0c0..d1754653 100644 --- a/test_common/harness/imageHelpers.cpp +++ b/test_common/harness/imageHelpers.cpp @@ -554,8 +554,8 @@ struct AddressingTable { AddressingTable() { - ct_assert((CL_ADDRESS_MIRRORED_REPEAT - CL_ADDRESS_NONE < 6)); - ct_assert(CL_FILTER_NEAREST - CL_FILTER_LINEAR < 2); + static_assert(CL_ADDRESS_MIRRORED_REPEAT - CL_ADDRESS_NONE < 6, ""); + static_assert(CL_FILTER_NEAREST - CL_FILTER_LINEAR < 2, ""); mTable[CL_ADDRESS_NONE - CL_ADDRESS_NONE] [CL_FILTER_NEAREST - CL_FILTER_NEAREST] = NoAddressFn; @@ -719,7 +719,7 @@ void get_max_sizes( if (usingMaxPixelSizeBuffer || raw_pixel_size == 12) raw_pixel_size = 16; size_t max_pixels = (size_t)maxAllocSize / raw_pixel_size; - log_info("Maximums: [%ld x %ld x %ld], raw pixel size %lu bytes, " + log_info("Maximums: [%zu x %zu x %zu], raw pixel size %zu bytes, " "per-allocation limit %gMB.\n", maxWidth, maxHeight, isArray ? maxArraySize : maxDepth, raw_pixel_size, (maxAllocSize / (1024.0 * 1024.0))); @@ -760,10 +760,10 @@ void get_max_sizes( if (image_type == CL_MEM_OBJECT_IMAGE1D) { - double M = maximum_sizes[0]; + size_t M = maximum_sizes[0]; // Store the size - sizes[(*numberOfSizes)][0] = (size_t)M; + sizes[(*numberOfSizes)][0] = M; sizes[(*numberOfSizes)][1] = 1; sizes[(*numberOfSizes)][2] = 1; ++(*numberOfSizes); @@ -777,17 +777,17 @@ void get_max_sizes( { // Determine the size of the fixed dimension - double M = maximum_sizes[fixed_dim]; - double A = max_pixels; + size_t M = maximum_sizes[fixed_dim]; + size_t A = max_pixels; int x0_dim = !fixed_dim; - double x0 = + size_t x0 = static_cast( fmin(fmin(other_sizes[(other_size++) % num_other_sizes], A / M), - maximum_sizes[x0_dim]); + maximum_sizes[x0_dim])); // Store the size - sizes[(*numberOfSizes)][fixed_dim] = (size_t)M; - sizes[(*numberOfSizes)][x0_dim] = (size_t)x0; + sizes[(*numberOfSizes)][fixed_dim] = M; + sizes[(*numberOfSizes)][x0_dim] = x0; sizes[(*numberOfSizes)][2] = 1; ++(*numberOfSizes); } @@ -802,16 +802,17 @@ void get_max_sizes( { // Determine the size of the fixed dimension - double M = maximum_sizes[fixed_dim]; - double A = max_pixels; + size_t M = maximum_sizes[fixed_dim]; + size_t A = max_pixels; // Find two other dimensions, x0 and x1 int x0_dim = (fixed_dim == 0) ? 1 : 0; int x1_dim = (fixed_dim == 2) ? 1 : 2; // Choose two other sizes for these dimensions - double x0 = fmin(fmin(A / M, maximum_sizes[x0_dim]), - other_sizes[(other_size++) % num_other_sizes]); + size_t x0 = static_cast( + fmin(fmin(A / M, maximum_sizes[x0_dim]), + other_sizes[(other_size++) % num_other_sizes])); // GPUs have certain restrictions on minimum width (row alignment) // of images which has given us issues testing small widths in this // test (say we set width to 3 for testing, and compute size based @@ -820,8 +821,9 @@ void get_max_sizes( // width of 16 which doesnt fit in vram). For this purpose we are // not testing width < 16 for this test. if (x0_dim == 0 && x0 < 16) x0 = 16; - double x1 = fmin(fmin(A / M / x0, maximum_sizes[x1_dim]), - other_sizes[(other_size++) % num_other_sizes]); + size_t x1 = static_cast( + fmin(fmin(A / M / x0, maximum_sizes[x1_dim]), + other_sizes[(other_size++) % num_other_sizes])); // Valid image sizes cannot be below 1. Due to the workaround for // the xo_dim where x0 is overidden to 16 there might not be enough @@ -834,9 +836,9 @@ void get_max_sizes( assert(x0 > 0 && M > 0); // Store the size - sizes[(*numberOfSizes)][fixed_dim] = (size_t)M; - sizes[(*numberOfSizes)][x0_dim] = (size_t)x0; - sizes[(*numberOfSizes)][x1_dim] = (size_t)x1; + sizes[(*numberOfSizes)][fixed_dim] = M; + sizes[(*numberOfSizes)][x0_dim] = x0; + sizes[(*numberOfSizes)][x1_dim] = x1; ++(*numberOfSizes); } } @@ -847,20 +849,20 @@ void get_max_sizes( switch (image_type) { case CL_MEM_OBJECT_IMAGE1D: - log_info(" size[%d] = [%ld] (%g MB image)\n", j, sizes[j][0], + log_info(" size[%d] = [%zu] (%g MB image)\n", j, sizes[j][0], raw_pixel_size * sizes[j][0] * sizes[j][1] * sizes[j][2] / (1024.0 * 1024.0)); break; case CL_MEM_OBJECT_IMAGE1D_ARRAY: case CL_MEM_OBJECT_IMAGE2D: - log_info(" size[%d] = [%ld %ld] (%g MB image)\n", j, + log_info(" size[%d] = [%zu %zu] (%g MB image)\n", j, sizes[j][0], sizes[j][1], raw_pixel_size * sizes[j][0] * sizes[j][1] * sizes[j][2] / (1024.0 * 1024.0)); break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: case CL_MEM_OBJECT_IMAGE3D: - log_info(" size[%d] = [%ld %ld %ld] (%g MB image)\n", j, + log_info(" size[%d] = [%zu %zu %zu] (%g MB image)\n", j, sizes[j][0], sizes[j][1], sizes[j][2], raw_pixel_size * sizes[j][0] * sizes[j][1] * sizes[j][2] / (1024.0 * 1024.0)); @@ -1124,12 +1126,13 @@ void escape_inf_nan_values(char *data, size_t allocSize) char *generate_random_image_data(image_descriptor *imageInfo, BufferOwningPtr &P, MTdata d) { - size_t allocSize = get_image_size(imageInfo); + size_t allocSize = static_cast(get_image_size(imageInfo)); size_t pixelRowBytes = imageInfo->width * get_pixel_size(imageInfo->format); size_t i; if (imageInfo->num_mip_levels > 1) - allocSize = compute_mipmapped_image_size(*imageInfo); + allocSize = + static_cast(compute_mipmapped_image_size(*imageInfo)); #if defined(__APPLE__) char *data = NULL; @@ -1161,7 +1164,7 @@ char *generate_random_image_data(image_descriptor *imageInfo, if (data == NULL) { - log_error("ERROR: Unable to malloc %lu bytes for " + log_error("ERROR: Unable to malloc %zu bytes for " "generate_random_image_data\n", allocSize); return 0; @@ -1678,24 +1681,26 @@ bool get_integer_coords_offset(float x, float y, float z, float xAddressOffset, // At this point, we're dealing with non-normalized coordinates. - outX = adFn(floorf(x), width); + outX = adFn(static_cast(floorf(x)), width); // 1D and 2D arrays require special care for the index coordinate: switch (imageInfo->type) { case CL_MEM_OBJECT_IMAGE1D_ARRAY: - outY = calculate_array_index(y, (float)imageInfo->arraySize - 1.0f); - outZ = 0.0f; /* don't care! */ + outY = static_cast( + calculate_array_index(y, (float)imageInfo->arraySize - 1.0f)); + outZ = 0; /* don't care! */ break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: - outY = adFn(floorf(y), height); - outZ = calculate_array_index(z, (float)imageInfo->arraySize - 1.0f); + outY = adFn(static_cast(floorf(y)), height); + outZ = static_cast( + calculate_array_index(z, (float)imageInfo->arraySize - 1.0f)); break; default: // legacy path: - if (height != 0) outY = adFn(floorf(y), height); - if (depth != 0) outZ = adFn(floorf(z), depth); + if (height != 0) outY = adFn(static_cast(floorf(y)), height); + if (depth != 0) outZ = adFn(static_cast(floorf(z)), depth); } return !((int)refX == outX && (int)refY == outY && (int)refZ == outZ); @@ -1766,7 +1771,7 @@ static float unnormalize_coordinate(const char *name, float coord, float offset, switch (addressing_mode) { case CL_ADDRESS_REPEAT: - ret = RepeatNormalizedAddressFn(coord, extent); + ret = RepeatNormalizedAddressFn(coord, static_cast(extent)); if (verbose) { @@ -1790,7 +1795,8 @@ static float unnormalize_coordinate(const char *name, float coord, float offset, break; case CL_ADDRESS_MIRRORED_REPEAT: - ret = MirroredRepeatNormalizedAddressFn(coord, extent); + ret = MirroredRepeatNormalizedAddressFn( + coord, static_cast(extent)); if (verbose) { @@ -1968,13 +1974,13 @@ FloatPixel sample_image_pixel_float_offset( // coordinates. Note that the array cases again require special // care, per section 8.4 in the OpenCL 1.2 Specification. - ix = adFn(floorf(x), width_lod); + ix = adFn(static_cast(floorf(x)), width_lod); switch (imageInfo->type) { case CL_MEM_OBJECT_IMAGE1D_ARRAY: - iy = - calculate_array_index(y, (float)(imageInfo->arraySize - 1)); + iy = static_cast(calculate_array_index( + y, (float)(imageInfo->arraySize - 1))); iz = 0; if (verbose) { @@ -1982,18 +1988,18 @@ FloatPixel sample_image_pixel_float_offset( } break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: - iy = adFn(floorf(y), height_lod); - iz = - calculate_array_index(z, (float)(imageInfo->arraySize - 1)); + iy = adFn(static_cast(floorf(y)), height_lod); + iz = static_cast(calculate_array_index( + z, (float)(imageInfo->arraySize - 1))); if (verbose) { log_info("\tArray index %f evaluates to %d\n", z, iz); } break; default: - iy = adFn(floorf(y), height_lod); + iy = adFn(static_cast(floorf(y)), height_lod); if (depth_lod != 0) - iz = adFn(floorf(z), depth_lod); + iz = adFn(static_cast(floorf(z)), depth_lod); else iz = 0; } @@ -2047,16 +2053,16 @@ FloatPixel sample_image_pixel_float_offset( height = 1; } - int x1 = adFn(floorf(x - 0.5f), width); + int x1 = adFn(static_cast(floorf(x - 0.5f)), width); int y1 = 0; - int x2 = adFn(floorf(x - 0.5f) + 1, width); + int x2 = adFn(static_cast(floorf(x - 0.5f) + 1), width); int y2 = 0; if ((imageInfo->type != CL_MEM_OBJECT_IMAGE1D) && (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY) && (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_BUFFER)) { - y1 = adFn(floorf(y - 0.5f), height); - y2 = adFn(floorf(y - 0.5f) + 1, height); + y1 = adFn(static_cast(floorf(y - 0.5f)), height); + y2 = adFn(static_cast(floorf(y - 0.5f) + 1), height); } else { @@ -2147,12 +2153,12 @@ FloatPixel sample_image_pixel_float_offset( else { // 3D linear filtering - int x1 = adFn(floorf(x - 0.5f), width_lod); - int y1 = adFn(floorf(y - 0.5f), height_lod); - int z1 = adFn(floorf(z - 0.5f), depth_lod); - int x2 = adFn(floorf(x - 0.5f) + 1, width_lod); - int y2 = adFn(floorf(y - 0.5f) + 1, height_lod); - int z2 = adFn(floorf(z - 0.5f) + 1, depth_lod); + int x1 = adFn(static_cast(floorf(x - 0.5f)), width_lod); + int y1 = adFn(static_cast(floorf(y - 0.5f)), height_lod); + int z1 = adFn(static_cast(floorf(z - 0.5f)), depth_lod); + int x2 = adFn(static_cast(floorf(x - 0.5f) + 1), width_lod); + int y2 = adFn(static_cast(floorf(y - 0.5f) + 1), height_lod); + int z2 = adFn(static_cast(floorf(z - 0.5f) + 1), depth_lod); if (verbose) log_info("\tActual integer coords used (i = floor(x-.5)): " @@ -2899,15 +2905,18 @@ void pack_image_pixel_error(const float *srcVector, case CL_UNSIGNED_INT8: { const cl_uchar *ptr = (const cl_uchar *)results; for (unsigned int i = 0; i < channelCount; i++) - errors[i] = (cl_int)ptr[i] - - (cl_int)CONVERT_UINT(srcVector[i], 255.f, CL_UCHAR_MAX); + errors[i] = static_cast( + (cl_int)ptr[i] + - (cl_int)CONVERT_UINT(srcVector[i], 255.f, CL_UCHAR_MAX)); break; } case CL_UNSIGNED_INT16: { const cl_ushort *ptr = (const cl_ushort *)results; for (unsigned int i = 0; i < channelCount; i++) - errors[i] = (cl_int)ptr[i] - - (cl_int)CONVERT_UINT(srcVector[i], 32767.f, CL_USHRT_MAX); + errors[i] = static_cast( + (cl_int)ptr[i] + - (cl_int)CONVERT_UINT(srcVector[i], 32767.f, + CL_USHRT_MAX)); break; } case CL_UNSIGNED_INT32: { @@ -3228,7 +3237,7 @@ char *create_random_image_data(ExplicitType dataType, if (data == NULL) { log_error( - "ERROR: Unable to malloc %lu bytes for create_random_image_data\n", + "ERROR: Unable to malloc %zu bytes for create_random_image_data\n", allocSize); return NULL; } @@ -3988,7 +3997,8 @@ bool is_image_format_required(cl_image_format format, cl_mem_flags flags, cl_uint compute_max_mip_levels(size_t width, size_t height, size_t depth) { - cl_uint retMaxMipLevels = 0, max_dim = 0; + cl_uint retMaxMipLevels = 0; + size_t max_dim = 0; max_dim = width; max_dim = height > max_dim ? height : max_dim; diff --git a/test_common/harness/kernelHelpers.cpp b/test_common/harness/kernelHelpers.cpp index 95b9555e..aaf0d689 100644 --- a/test_common/harness/kernelHelpers.cpp +++ b/test_common/harness/kernelHelpers.cpp @@ -579,7 +579,7 @@ static int create_single_kernel_helper_create_program_offline( if (error != CL_SUCCESS) return error; ifs.seekg(0, ifs.end); - int length = ifs.tellg(); + size_t length = static_cast(ifs.tellg()); ifs.seekg(0, ifs.beg); // treat modifiedProgram as input for clCreateProgramWithBinary @@ -1226,7 +1226,7 @@ int is_image_format_supported(cl_context context, cl_mem_flags flags, list = (cl_image_format *)malloc(count * sizeof(cl_image_format)); if (NULL == list) { - log_error("Error: unable to allocate %ld byte buffer for image format " + log_error("Error: unable to allocate %zu byte buffer for image format " "list at %s:%d (err = %d)\n", count * sizeof(cl_image_format), __FILE__, __LINE__, err); return 0; diff --git a/test_common/harness/os_helpers.cpp b/test_common/harness/os_helpers.cpp index cd350cf8..daf21958 100644 --- a/test_common/harness/os_helpers.cpp +++ b/test_common/harness/os_helpers.cpp @@ -404,7 +404,8 @@ std::string exe_path() for (;;) { - DWORD len = GetModuleFileNameA(NULL, &path.front(), path.size()); + DWORD len = GetModuleFileNameA(NULL, &path.front(), + static_cast(path.size())); if (len == 0) { diff --git a/test_common/harness/propertyHelpers.cpp b/test_common/harness/propertyHelpers.cpp index 3157ca80..e368f9b6 100644 --- a/test_common/harness/propertyHelpers.cpp +++ b/test_common/harness/propertyHelpers.cpp @@ -97,15 +97,16 @@ int compareProperties(const std::vector& queried, if (!found) { - log_error("ERROR: expected property 0x%x not found!\n", + log_error("ERROR: expected property 0x%llx not found!\n", check_prop); return TEST_FAIL; } else if (check_value != queried_value) { - log_error("ERROR: mis-matched value for property 0x%x: wanted " - "0x%x, got 0x%x\n", - check_prop, check_value, queried_value); + log_error( + "ERROR: mis-matched value for property 0x%llx: wanted " + "0x%llx, got 0x%llx\n", + check_prop, check_value, queried_value); return TEST_FAIL; } } @@ -113,7 +114,7 @@ int compareProperties(const std::vector& queried, if (queried.size() > check.size()) { log_error("ERROR: all properties found but there are extra " - "properties: expected %d, got %d.\n", + "properties: expected %zu, got %zu.\n", check.size(), queried.size()); return TEST_FAIL; } diff --git a/test_common/harness/rounding_mode.cpp b/test_common/harness/rounding_mode.cpp index 681ccdd8..1f531478 100644 --- a/test_common/harness/rounding_mode.cpp +++ b/test_common/harness/rounding_mode.cpp @@ -48,7 +48,7 @@ RoundingMode set_round(RoundingMode r, Type outType) const int *p = int_rounds; if (outType == kfloat || outType == kdouble) p = flt_rounds; - int fpscr = 0; + int64_t fpscr = 0; RoundingMode oldRound = get_round(); _FPU_GETCW(fpscr); @@ -59,7 +59,7 @@ RoundingMode set_round(RoundingMode r, Type outType) RoundingMode get_round(void) { - int fpscr; + int64_t fpscr; int oldRound; _FPU_GETCW(fpscr); @@ -203,13 +203,13 @@ void *FlushToZero(void) #if defined(__APPLE__) || defined(__linux__) || defined(_WIN32) #if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) union { - int i; + unsigned int i; void *p; } u = { _mm_getcsr() }; _mm_setcsr(u.i | 0x8040); return u.p; #elif defined(__arm__) || defined(__aarch64__) - int fpscr; + int64_t fpscr; _FPU_GETCW(fpscr); _FPU_SETCW(fpscr | FPSCR_FZ); return NULL; @@ -239,7 +239,7 @@ void UnFlushToZero(void *p) } u = { p }; _mm_setcsr(u.i); #elif defined(__arm__) || defined(__aarch64__) - int fpscr; + int64_t fpscr; _FPU_GETCW(fpscr); _FPU_SETCW(fpscr & ~FPSCR_FZ); #elif defined(__PPC__) diff --git a/test_common/harness/rounding_mode.h b/test_common/harness/rounding_mode.h index 064a3a63..6f52f0a0 100644 --- a/test_common/harness/rounding_mode.h +++ b/test_common/harness/rounding_mode.h @@ -16,8 +16,6 @@ #ifndef __ROUNDING_MODE_H__ #define __ROUNDING_MODE_H__ -#pragma STDC FENV_ACCESS ON - #include "compat.h" #if (defined(_WIN32) && defined(_MSC_VER)) diff --git a/test_common/harness/threadTesting.cpp b/test_common/harness/threadTesting.cpp index 875ee59b..e69de29b 100644 --- a/test_common/harness/threadTesting.cpp +++ b/test_common/harness/threadTesting.cpp @@ -1,98 +0,0 @@ -// -// Copyright (c) 2017 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. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#include "compat.h" -#include "threadTesting.h" -#include "errorHelpers.h" -#include -#include - -#if !defined(_WIN32) -#include -#endif - -#if 0 // Disabed for now - -typedef struct -{ - basefn mFunction; - cl_device_id mDevice; - cl_context mContext; - int mNumElements; -} TestFnArgs; - -//////////////////////////////////////////////////////////////////////////////// -// Thread-based testing. Spawns a new thread to run the given test function, -// then waits for it to complete. The entire idea is that, if the thread crashes, -// we can catch it and report it as a failure instead of crashing the entire suite -//////////////////////////////////////////////////////////////////////////////// - -void *test_thread_wrapper( void *data ) -{ - TestFnArgs *args; - int retVal; - cl_context context; - - args = (TestFnArgs *)data; - - /* Create a new context to use (contexts can't cross threads) */ - context = clCreateContext(NULL, args->mDeviceGroup); - if( context == NULL ) - { - log_error("clCreateContext failed for new thread\n"); - return (void *)(-1); - } - - /* Call function */ - retVal = args->mFunction( args->mDeviceGroup, args->mDevice, context, args->mNumElements ); - - clReleaseContext( context ); - - return (void *)retVal; -} - -int test_threaded_function( basefn fnToTest, cl_device_id device, cl_context context, cl_command_queue queue, int numElements ) -{ - int error; - pthread_t threadHdl; - void *retVal; - TestFnArgs args; - - - args.mFunction = fnToTest; - args.mDeviceGroup = deviceGroup; - args.mDevice = device; - args.mContext = context; - args.mNumElements = numElements; - - - error = pthread_create( &threadHdl, NULL, test_thread_wrapper, (void *)&args ); - if( error != 0 ) - { - log_error( "ERROR: Unable to create thread for testing!\n" ); - return -1; - } - - /* Thread has been started, now just wait for it to complete (or crash) */ - error = pthread_join( threadHdl, &retVal ); - if( error != 0 ) - { - log_error( "ERROR: Unable to join testing thread!\n" ); - return -1; - } - - return (int)((intptr_t)retVal); -} -#endif diff --git a/test_common/harness/threadTesting.h b/test_common/harness/threadTesting.h index 765eabcc..2f3c1873 100644 --- a/test_common/harness/threadTesting.h +++ b/test_common/harness/threadTesting.h @@ -24,8 +24,5 @@ typedef int (*basefn)(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); -extern int test_threaded_function(basefn fnToTest, cl_device_id device, - cl_context context, cl_command_queue queue, - int numElements); -#endif // _threadTesting_h +#endif // _threadTesting_h \ No newline at end of file diff --git a/test_conformance/gles/CMakeLists.txt b/test_conformance/gles/CMakeLists.txt index c76fe512..4f4ba532 100644 --- a/test_conformance/gles/CMakeLists.txt +++ b/test_conformance/gles/CMakeLists.txt @@ -18,3 +18,11 @@ set (${MODULE_NAME}_SOURCES list(APPEND CLConform_LIBRARIES EGL GLESv2) include(../CMakeCommon.txt) + +if(DEFINED USE_GLES3) + target_compile_definitions(${${MODULE_NAME}_OUT} PRIVATE GLES3) +endif() +if(MSVC) + # Don't warn about using the portable "strdup" function. + target_compile_definitions(${${MODULE_NAME}_OUT} PRIVATE _CRT_NONSTDC_NO_DEPRECATE) +endif() \ No newline at end of file diff --git a/test_conformance/gles/setup_egl.cpp b/test_conformance/gles/setup_egl.cpp index fe0f8ca3..95a12a66 100644 --- a/test_conformance/gles/setup_egl.cpp +++ b/test_conformance/gles/setup_egl.cpp @@ -117,7 +117,8 @@ public: _platform, "clGetGLContextInfoKHR"); if (GetGLContextInfo == NULL) { - print_error(status, "clGetGLContextInfoKHR failed"); + log_error("ERROR: clGetGLContextInfoKHR failed! (%s:%d)\n", + __FILE__, __LINE__); return NULL; } @@ -128,7 +129,7 @@ public: return NULL; } dev_size /= sizeof(cl_device_id); - log_info("GL _context supports %d compute devices\n", dev_size); + log_info("GL _context supports %zu compute devices\n", dev_size); status = GetGLContextInfo(properties, CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR, diff --git a/test_conformance/gles/test_fence_sync.cpp b/test_conformance/gles/test_fence_sync.cpp index 0af91a46..968d9695 100644 --- a/test_conformance/gles/test_fence_sync.cpp +++ b/test_conformance/gles/test_fence_sync.cpp @@ -570,10 +570,12 @@ int test_fence_sync_single( cl_device_id device, cl_context context, cl_command_ { if( p[ t ] == 0 ) { - log_error( "RUN: %ld to %ld (%d,%d to %d,%d) 0x%08x\n", a, t - 1, - (int)( a % framebufferSize ), (int)( a / framebufferSize ), - (int)( ( t - 1 ) % framebufferSize ), (int)( ( t - 1 ) / framebufferSize ), - p[ a ] ); + log_error( + "RUN: %zu to %zu (%d,%d to %d,%d) 0x%08x\n", + a, t - 1, (int)(a % framebufferSize), + (int)(a / framebufferSize), + (int)((t - 1) % framebufferSize), + (int)((t - 1) / framebufferSize), p[a]); a = t; } } diff --git a/test_conformance/gles/test_images_2D.cpp b/test_conformance/gles/test_images_2D.cpp index c1a17fc8..f6554023 100644 --- a/test_conformance/gles/test_images_2D.cpp +++ b/test_conformance/gles/test_images_2D.cpp @@ -369,7 +369,9 @@ int test_images_read_cube( cl_device_id device, cl_context context, cl_command_q } +#ifdef __APPLE__ #pragma mark -------------------- Write tests ------------------------- +#endif int test_cl_image_write( cl_context context, cl_command_queue queue, cl_mem clImage, diff --git a/test_conformance/gles/test_renderbuffer.cpp b/test_conformance/gles/test_renderbuffer.cpp index 20127aca..0f6d289b 100644 --- a/test_conformance/gles/test_renderbuffer.cpp +++ b/test_conformance/gles/test_renderbuffer.cpp @@ -197,7 +197,9 @@ int test_renderbuffer_read( cl_device_id device, cl_context context, cl_command_ } +#ifdef __APPLE__ #pragma mark -------------------- Write tests ------------------------- +#endif int test_attach_renderbuffer_write_to_image( cl_context context, cl_command_queue queue, GLenum glTarget, GLuint glRenderbuffer, size_t imageWidth, size_t imageHeight, cl_image_format *outFormat, ExplicitType *outType, MTdata d, void **outSourceBuffer )