mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-25 16:29:03 +00:00
gles: Fix compile warnings. (#1070)
* gles: Fix compile warnings. For 32 and 64-bit Visual Studio and the Android Q NDK. * Fix formatting violations Co-authored-by: spauls <spauls@qti.qualcomm.com>
This commit is contained in:
committed by
GitHub
parent
17a0d09567
commit
6c8045911a
@@ -152,10 +152,6 @@ if(LINK_PTHREAD)
|
|||||||
list(APPEND CLConform_LIBRARIES pthread)
|
list(APPEND CLConform_LIBRARIES pthread)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(DEFINED USE_GLES3)
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLES3")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
find_library(corefoundation CoreFoundation)
|
find_library(corefoundation CoreFoundation)
|
||||||
find_library(iokit IOKit)
|
find_library(iokit IOKit)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
set(HARNESS_SOURCES
|
set(HARNESS_SOURCES
|
||||||
harness/threadTesting.cpp
|
|
||||||
harness/typeWrappers.cpp
|
harness/typeWrappers.cpp
|
||||||
harness/mt19937.cpp
|
harness/mt19937.cpp
|
||||||
harness/conversions.cpp
|
harness/conversions.cpp
|
||||||
@@ -23,3 +22,7 @@ set(HARNESS_SOURCES
|
|||||||
|
|
||||||
add_library(harness STATIC ${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()
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
{GLint __error = glGetError(); if(__error) {log_error( "GL ERROR: %s!\n", gluErrorString( err ));}}
|
{GLint __error = glGetError(); if(__error) {log_error( "GL ERROR: %s!\n", gluErrorString( err ));}}
|
||||||
|
|
||||||
#if defined(__linux__) || defined(GL_ES_VERSION_2_0)
|
#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++
|
// libstdc++
|
||||||
// FIXME: Implement this
|
// FIXME: Implement this
|
||||||
const GLubyte* gluErrorString (GLenum error)
|
const GLubyte* gluErrorString (GLenum error)
|
||||||
@@ -271,8 +271,6 @@ void * ReadGLTexture( GLenum glTarget, GLuint glTexture,
|
|||||||
// Read results from the GL texture
|
// Read results from the GL texture
|
||||||
glBindTexture(get_base_gl_target(glTarget), glTexture);
|
glBindTexture(get_base_gl_target(glTarget), glTexture);
|
||||||
|
|
||||||
GLint realWidth, realHeight;
|
|
||||||
GLint realInternalFormat;
|
|
||||||
GLenum readBackFormat = GL_RGBA;
|
GLenum readBackFormat = GL_RGBA;
|
||||||
GLenum readBackType = glType;
|
GLenum readBackType = glType;
|
||||||
glFramebufferWrapper glFramebuffer;
|
glFramebufferWrapper glFramebuffer;
|
||||||
@@ -301,7 +299,7 @@ void * ReadGLTexture( GLenum glTarget, GLuint glTexture,
|
|||||||
GetGLFormatName(readBackFormat),
|
GetGLFormatName(readBackFormat),
|
||||||
GetGLTypeName(readBackType));
|
GetGLTypeName(readBackType));
|
||||||
|
|
||||||
DumpGLBuffer(readBackType, realWidth, realHeight, (void*)outBuffer);
|
DumpGLBuffer(readBackType, outWidth, outHeight, (void *)outBuffer);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -30,11 +30,10 @@
|
|||||||
|
|
||||||
#if !defined (__APPLE__)
|
#if !defined (__APPLE__)
|
||||||
#include <CL/cl.h>
|
#include <CL/cl.h>
|
||||||
#include "gl_headers.h"
|
|
||||||
#include <CL/cl_gl.h>
|
#include <CL/cl_gl.h>
|
||||||
#else
|
#include <CL/cl_half.h>
|
||||||
#include "gl_headers.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
#include "gl_headers.h"
|
||||||
|
|
||||||
#include "harness/errorHelpers.h"
|
#include "harness/errorHelpers.h"
|
||||||
#include "harness/kernelHelpers.h"
|
#include "harness/kernelHelpers.h"
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ void ThreadPool_Init(void)
|
|||||||
{
|
{
|
||||||
// Count the number of bits in ProcessorMask (number of
|
// Count the number of bits in ProcessorMask (number of
|
||||||
// logical cores)
|
// logical cores)
|
||||||
ULONG mask = ptr->ProcessorMask;
|
ULONG_PTR mask = ptr->ProcessorMask;
|
||||||
while (mask)
|
while (mask)
|
||||||
{
|
{
|
||||||
++gThreadCount;
|
++gThreadCount;
|
||||||
@@ -688,7 +688,10 @@ static BOOL CALLBACK _ThreadPool_Init(_PINIT_ONCE InitOnce, PVOID Parameter,
|
|||||||
|
|
||||||
void ThreadPool_Exit(void)
|
void ThreadPool_Exit(void)
|
||||||
{
|
{
|
||||||
int err, count;
|
#ifndef _WIN32
|
||||||
|
int err;
|
||||||
|
#endif
|
||||||
|
int count;
|
||||||
gRunCount = CL_INT_MAX;
|
gRunCount = CL_INT_MAX;
|
||||||
|
|
||||||
#if defined(__GNUC__)
|
#if defined(__GNUC__)
|
||||||
@@ -738,7 +741,9 @@ void ThreadPool_Exit(void)
|
|||||||
// all available then it would make more sense to use those features.
|
// all available then it would make more sense to use those features.
|
||||||
cl_int ThreadPool_Do(TPFuncPtr func_ptr, cl_uint count, void *userInfo)
|
cl_int ThreadPool_Do(TPFuncPtr func_ptr, cl_uint count, void *userInfo)
|
||||||
{
|
{
|
||||||
|
#ifndef _WIN32
|
||||||
cl_int newErr;
|
cl_int newErr;
|
||||||
|
#endif
|
||||||
cl_int err = 0;
|
cl_int err = 0;
|
||||||
// Lazily set up our threads
|
// Lazily set up our threads
|
||||||
#if defined(_MSC_VER) && (_WIN32_WINNT >= 0x600)
|
#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;
|
err = jobError;
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
exit:
|
exit:
|
||||||
|
#endif
|
||||||
// exit critical region
|
// exit critical region
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
LeaveCriticalSection(gThreadPoolLock);
|
LeaveCriticalSection(gThreadPoolLock);
|
||||||
|
|||||||
@@ -18,13 +18,13 @@
|
|||||||
|
|
||||||
#if defined(_WIN32) && defined(_MSC_VER)
|
#if defined(_WIN32) && defined(_MSC_VER)
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#endif
|
#else
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#define EXTERN_C extern "C"
|
#define EXTERN_C extern "C"
|
||||||
#else
|
#else
|
||||||
#define EXTERN_C
|
#define EXTERN_C
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -181,8 +181,8 @@ static ULong sUpperLimits[kNumExplicitTypes] = {
|
|||||||
0xffffffffLL,
|
0xffffffffLL,
|
||||||
0xffffffffLL,
|
0xffffffffLL,
|
||||||
0x7fffffffffffffffLL,
|
0x7fffffffffffffffLL,
|
||||||
0xffffffffffffffffLL,
|
0xffffffffffffffffULL,
|
||||||
0xffffffffffffffffLL,
|
0xffffffffffffffffULL,
|
||||||
0,
|
0,
|
||||||
0
|
0
|
||||||
}; // Last two values aren't stored here
|
}; // Last two values aren't stored here
|
||||||
|
|||||||
@@ -564,7 +564,7 @@ cl_int OutputBuildLogs(cl_program program, cl_uint num_devices,
|
|||||||
error = clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL,
|
error = clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL,
|
||||||
&size_ret);
|
&size_ret);
|
||||||
test_error(error, "Unable to query context's device size");
|
test_error(error, "Unable to query context's device size");
|
||||||
num_devices = size_ret / sizeof(cl_device_id);
|
num_devices = static_cast<cl_uint>(size_ret / sizeof(cl_device_id));
|
||||||
device_list = (cl_device_id *)malloc(size_ret);
|
device_list = (cl_device_id *)malloc(size_ret);
|
||||||
if (device_list == NULL)
|
if (device_list == NULL)
|
||||||
{
|
{
|
||||||
@@ -695,7 +695,7 @@ int check_functions_for_offline_compiler(const char *subtestname,
|
|||||||
{
|
{
|
||||||
if (gCompilationMode != kOnline)
|
if (gCompilationMode != kOnline)
|
||||||
{
|
{
|
||||||
int nNotRequiredWithOfflineCompiler =
|
size_t nNotRequiredWithOfflineCompiler =
|
||||||
sizeof(subtests_to_skip_with_offline_compiler) / sizeof(char *);
|
sizeof(subtests_to_skip_with_offline_compiler) / sizeof(char *);
|
||||||
size_t i;
|
size_t i;
|
||||||
for (i = 0; i < nNotRequiredWithOfflineCompiler; ++i)
|
for (i = 0; i < nNotRequiredWithOfflineCompiler; ++i)
|
||||||
@@ -707,4 +707,4 @@ int check_functions_for_offline_compiler(const char *subtestname,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -56,11 +56,6 @@ static int vlog_win32(const char *format, ...);
|
|||||||
#define vlog printf
|
#define vlog printf
|
||||||
#endif
|
#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, ...) \
|
#define test_fail(msg, ...) \
|
||||||
{ \
|
{ \
|
||||||
log_error(msg, ##__VA_ARGS__); \
|
log_error(msg, ##__VA_ARGS__); \
|
||||||
|
|||||||
@@ -30,7 +30,11 @@
|
|||||||
// that rounding mode.
|
// that rounding mode.
|
||||||
#if defined(__APPLE__) || defined(_MSC_VER) || defined(__linux__) \
|
#if defined(__APPLE__) || defined(_MSC_VER) || defined(__linux__) \
|
||||||
|| defined(__MINGW32__)
|
|| defined(__MINGW32__)
|
||||||
|
#ifdef _MSC_VER
|
||||||
typedef int FPU_mode_type;
|
typedef int FPU_mode_type;
|
||||||
|
#else
|
||||||
|
typedef int64_t FPU_mode_type;
|
||||||
|
#endif
|
||||||
#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) \
|
#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) \
|
||||||
|| defined(__MINGW32__)
|
|| defined(__MINGW32__)
|
||||||
#include <xmmintrin.h>
|
#include <xmmintrin.h>
|
||||||
@@ -55,7 +59,7 @@ inline void ForceFTZ(FPU_mode_type *mode)
|
|||||||
__asm__ volatile("fmxr fpscr, %0" ::"r"(fpscr | (1U << 24)));
|
__asm__ volatile("fmxr fpscr, %0" ::"r"(fpscr | (1U << 24)));
|
||||||
// Add 64 bit support
|
// Add 64 bit support
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
unsigned fpscr;
|
uint64_t fpscr;
|
||||||
__asm__ volatile("mrs %0, fpcr" : "=r"(fpscr));
|
__asm__ volatile("mrs %0, fpcr" : "=r"(fpscr));
|
||||||
*mode = fpscr;
|
*mode = fpscr;
|
||||||
__asm__ volatile("msr fpcr, %0" ::"r"(fpscr | (1U << 24)));
|
__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)));
|
__asm__ volatile("fmxr fpscr, %0" ::"r"(fpscr & ~(1U << 24)));
|
||||||
// Add 64 bit support
|
// Add 64 bit support
|
||||||
#elif defined(__aarch64__)
|
#elif defined(__aarch64__)
|
||||||
unsigned fpscr;
|
uint64_t fpscr;
|
||||||
__asm__ volatile("mrs %0, fpcr" : "=r"(fpscr));
|
__asm__ volatile("mrs %0, fpcr" : "=r"(fpscr));
|
||||||
*mode = fpscr;
|
*mode = fpscr;
|
||||||
__asm__ volatile("msr fpcr, %0" ::"r"(fpscr & ~(1U << 24)));
|
__asm__ volatile("msr fpcr, %0" ::"r"(fpscr & ~(1U << 24)));
|
||||||
|
|||||||
@@ -554,8 +554,8 @@ struct AddressingTable
|
|||||||
{
|
{
|
||||||
AddressingTable()
|
AddressingTable()
|
||||||
{
|
{
|
||||||
ct_assert((CL_ADDRESS_MIRRORED_REPEAT - CL_ADDRESS_NONE < 6));
|
static_assert(CL_ADDRESS_MIRRORED_REPEAT - CL_ADDRESS_NONE < 6, "");
|
||||||
ct_assert(CL_FILTER_NEAREST - CL_FILTER_LINEAR < 2);
|
static_assert(CL_FILTER_NEAREST - CL_FILTER_LINEAR < 2, "");
|
||||||
|
|
||||||
mTable[CL_ADDRESS_NONE - CL_ADDRESS_NONE]
|
mTable[CL_ADDRESS_NONE - CL_ADDRESS_NONE]
|
||||||
[CL_FILTER_NEAREST - CL_FILTER_NEAREST] = NoAddressFn;
|
[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;
|
if (usingMaxPixelSizeBuffer || raw_pixel_size == 12) raw_pixel_size = 16;
|
||||||
size_t max_pixels = (size_t)maxAllocSize / raw_pixel_size;
|
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",
|
"per-allocation limit %gMB.\n",
|
||||||
maxWidth, maxHeight, isArray ? maxArraySize : maxDepth,
|
maxWidth, maxHeight, isArray ? maxArraySize : maxDepth,
|
||||||
raw_pixel_size, (maxAllocSize / (1024.0 * 1024.0)));
|
raw_pixel_size, (maxAllocSize / (1024.0 * 1024.0)));
|
||||||
@@ -760,10 +760,10 @@ void get_max_sizes(
|
|||||||
if (image_type == CL_MEM_OBJECT_IMAGE1D)
|
if (image_type == CL_MEM_OBJECT_IMAGE1D)
|
||||||
{
|
{
|
||||||
|
|
||||||
double M = maximum_sizes[0];
|
size_t M = maximum_sizes[0];
|
||||||
|
|
||||||
// Store the size
|
// Store the size
|
||||||
sizes[(*numberOfSizes)][0] = (size_t)M;
|
sizes[(*numberOfSizes)][0] = M;
|
||||||
sizes[(*numberOfSizes)][1] = 1;
|
sizes[(*numberOfSizes)][1] = 1;
|
||||||
sizes[(*numberOfSizes)][2] = 1;
|
sizes[(*numberOfSizes)][2] = 1;
|
||||||
++(*numberOfSizes);
|
++(*numberOfSizes);
|
||||||
@@ -777,17 +777,17 @@ void get_max_sizes(
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Determine the size of the fixed dimension
|
// Determine the size of the fixed dimension
|
||||||
double M = maximum_sizes[fixed_dim];
|
size_t M = maximum_sizes[fixed_dim];
|
||||||
double A = max_pixels;
|
size_t A = max_pixels;
|
||||||
|
|
||||||
int x0_dim = !fixed_dim;
|
int x0_dim = !fixed_dim;
|
||||||
double x0 =
|
size_t x0 = static_cast<size_t>(
|
||||||
fmin(fmin(other_sizes[(other_size++) % num_other_sizes], A / M),
|
fmin(fmin(other_sizes[(other_size++) % num_other_sizes], A / M),
|
||||||
maximum_sizes[x0_dim]);
|
maximum_sizes[x0_dim]));
|
||||||
|
|
||||||
// Store the size
|
// Store the size
|
||||||
sizes[(*numberOfSizes)][fixed_dim] = (size_t)M;
|
sizes[(*numberOfSizes)][fixed_dim] = M;
|
||||||
sizes[(*numberOfSizes)][x0_dim] = (size_t)x0;
|
sizes[(*numberOfSizes)][x0_dim] = x0;
|
||||||
sizes[(*numberOfSizes)][2] = 1;
|
sizes[(*numberOfSizes)][2] = 1;
|
||||||
++(*numberOfSizes);
|
++(*numberOfSizes);
|
||||||
}
|
}
|
||||||
@@ -802,16 +802,17 @@ void get_max_sizes(
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Determine the size of the fixed dimension
|
// Determine the size of the fixed dimension
|
||||||
double M = maximum_sizes[fixed_dim];
|
size_t M = maximum_sizes[fixed_dim];
|
||||||
double A = max_pixels;
|
size_t A = max_pixels;
|
||||||
|
|
||||||
// Find two other dimensions, x0 and x1
|
// Find two other dimensions, x0 and x1
|
||||||
int x0_dim = (fixed_dim == 0) ? 1 : 0;
|
int x0_dim = (fixed_dim == 0) ? 1 : 0;
|
||||||
int x1_dim = (fixed_dim == 2) ? 1 : 2;
|
int x1_dim = (fixed_dim == 2) ? 1 : 2;
|
||||||
|
|
||||||
// Choose two other sizes for these dimensions
|
// Choose two other sizes for these dimensions
|
||||||
double x0 = fmin(fmin(A / M, maximum_sizes[x0_dim]),
|
size_t x0 = static_cast<size_t>(
|
||||||
other_sizes[(other_size++) % num_other_sizes]);
|
fmin(fmin(A / M, maximum_sizes[x0_dim]),
|
||||||
|
other_sizes[(other_size++) % num_other_sizes]));
|
||||||
// GPUs have certain restrictions on minimum width (row alignment)
|
// GPUs have certain restrictions on minimum width (row alignment)
|
||||||
// of images which has given us issues testing small widths in this
|
// 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
|
// 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
|
// width of 16 which doesnt fit in vram). For this purpose we are
|
||||||
// not testing width < 16 for this test.
|
// not testing width < 16 for this test.
|
||||||
if (x0_dim == 0 && x0 < 16) x0 = 16;
|
if (x0_dim == 0 && x0 < 16) x0 = 16;
|
||||||
double x1 = fmin(fmin(A / M / x0, maximum_sizes[x1_dim]),
|
size_t x1 = static_cast<size_t>(
|
||||||
other_sizes[(other_size++) % num_other_sizes]);
|
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
|
// 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
|
// 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);
|
assert(x0 > 0 && M > 0);
|
||||||
|
|
||||||
// Store the size
|
// Store the size
|
||||||
sizes[(*numberOfSizes)][fixed_dim] = (size_t)M;
|
sizes[(*numberOfSizes)][fixed_dim] = M;
|
||||||
sizes[(*numberOfSizes)][x0_dim] = (size_t)x0;
|
sizes[(*numberOfSizes)][x0_dim] = x0;
|
||||||
sizes[(*numberOfSizes)][x1_dim] = (size_t)x1;
|
sizes[(*numberOfSizes)][x1_dim] = x1;
|
||||||
++(*numberOfSizes);
|
++(*numberOfSizes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -847,20 +849,20 @@ void get_max_sizes(
|
|||||||
switch (image_type)
|
switch (image_type)
|
||||||
{
|
{
|
||||||
case CL_MEM_OBJECT_IMAGE1D:
|
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]
|
raw_pixel_size * sizes[j][0] * sizes[j][1]
|
||||||
* sizes[j][2] / (1024.0 * 1024.0));
|
* sizes[j][2] / (1024.0 * 1024.0));
|
||||||
break;
|
break;
|
||||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||||
case CL_MEM_OBJECT_IMAGE2D:
|
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],
|
sizes[j][0], sizes[j][1],
|
||||||
raw_pixel_size * sizes[j][0] * sizes[j][1]
|
raw_pixel_size * sizes[j][0] * sizes[j][1]
|
||||||
* sizes[j][2] / (1024.0 * 1024.0));
|
* sizes[j][2] / (1024.0 * 1024.0));
|
||||||
break;
|
break;
|
||||||
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||||
case CL_MEM_OBJECT_IMAGE3D:
|
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],
|
sizes[j][0], sizes[j][1], sizes[j][2],
|
||||||
raw_pixel_size * sizes[j][0] * sizes[j][1]
|
raw_pixel_size * sizes[j][0] * sizes[j][1]
|
||||||
* sizes[j][2] / (1024.0 * 1024.0));
|
* 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,
|
char *generate_random_image_data(image_descriptor *imageInfo,
|
||||||
BufferOwningPtr<char> &P, MTdata d)
|
BufferOwningPtr<char> &P, MTdata d)
|
||||||
{
|
{
|
||||||
size_t allocSize = get_image_size(imageInfo);
|
size_t allocSize = static_cast<size_t>(get_image_size(imageInfo));
|
||||||
size_t pixelRowBytes = imageInfo->width * get_pixel_size(imageInfo->format);
|
size_t pixelRowBytes = imageInfo->width * get_pixel_size(imageInfo->format);
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (imageInfo->num_mip_levels > 1)
|
if (imageInfo->num_mip_levels > 1)
|
||||||
allocSize = compute_mipmapped_image_size(*imageInfo);
|
allocSize =
|
||||||
|
static_cast<size_t>(compute_mipmapped_image_size(*imageInfo));
|
||||||
|
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
char *data = NULL;
|
char *data = NULL;
|
||||||
@@ -1161,7 +1164,7 @@ char *generate_random_image_data(image_descriptor *imageInfo,
|
|||||||
|
|
||||||
if (data == NULL)
|
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",
|
"generate_random_image_data\n",
|
||||||
allocSize);
|
allocSize);
|
||||||
return 0;
|
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.
|
// At this point, we're dealing with non-normalized coordinates.
|
||||||
|
|
||||||
outX = adFn(floorf(x), width);
|
outX = adFn(static_cast<int>(floorf(x)), width);
|
||||||
|
|
||||||
// 1D and 2D arrays require special care for the index coordinate:
|
// 1D and 2D arrays require special care for the index coordinate:
|
||||||
|
|
||||||
switch (imageInfo->type)
|
switch (imageInfo->type)
|
||||||
{
|
{
|
||||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||||
outY = calculate_array_index(y, (float)imageInfo->arraySize - 1.0f);
|
outY = static_cast<int>(
|
||||||
outZ = 0.0f; /* don't care! */
|
calculate_array_index(y, (float)imageInfo->arraySize - 1.0f));
|
||||||
|
outZ = 0; /* don't care! */
|
||||||
break;
|
break;
|
||||||
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||||
outY = adFn(floorf(y), height);
|
outY = adFn(static_cast<int>(floorf(y)), height);
|
||||||
outZ = calculate_array_index(z, (float)imageInfo->arraySize - 1.0f);
|
outZ = static_cast<int>(
|
||||||
|
calculate_array_index(z, (float)imageInfo->arraySize - 1.0f));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// legacy path:
|
// legacy path:
|
||||||
if (height != 0) outY = adFn(floorf(y), height);
|
if (height != 0) outY = adFn(static_cast<int>(floorf(y)), height);
|
||||||
if (depth != 0) outZ = adFn(floorf(z), depth);
|
if (depth != 0) outZ = adFn(static_cast<int>(floorf(z)), depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !((int)refX == outX && (int)refY == outY && (int)refZ == outZ);
|
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)
|
switch (addressing_mode)
|
||||||
{
|
{
|
||||||
case CL_ADDRESS_REPEAT:
|
case CL_ADDRESS_REPEAT:
|
||||||
ret = RepeatNormalizedAddressFn(coord, extent);
|
ret = RepeatNormalizedAddressFn(coord, static_cast<size_t>(extent));
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@@ -1790,7 +1795,8 @@ static float unnormalize_coordinate(const char *name, float coord, float offset,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CL_ADDRESS_MIRRORED_REPEAT:
|
case CL_ADDRESS_MIRRORED_REPEAT:
|
||||||
ret = MirroredRepeatNormalizedAddressFn(coord, extent);
|
ret = MirroredRepeatNormalizedAddressFn(
|
||||||
|
coord, static_cast<size_t>(extent));
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@@ -1968,13 +1974,13 @@ FloatPixel sample_image_pixel_float_offset(
|
|||||||
// coordinates. Note that the array cases again require special
|
// coordinates. Note that the array cases again require special
|
||||||
// care, per section 8.4 in the OpenCL 1.2 Specification.
|
// care, per section 8.4 in the OpenCL 1.2 Specification.
|
||||||
|
|
||||||
ix = adFn(floorf(x), width_lod);
|
ix = adFn(static_cast<int>(floorf(x)), width_lod);
|
||||||
|
|
||||||
switch (imageInfo->type)
|
switch (imageInfo->type)
|
||||||
{
|
{
|
||||||
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
case CL_MEM_OBJECT_IMAGE1D_ARRAY:
|
||||||
iy =
|
iy = static_cast<int>(calculate_array_index(
|
||||||
calculate_array_index(y, (float)(imageInfo->arraySize - 1));
|
y, (float)(imageInfo->arraySize - 1)));
|
||||||
iz = 0;
|
iz = 0;
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
@@ -1982,18 +1988,18 @@ FloatPixel sample_image_pixel_float_offset(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
case CL_MEM_OBJECT_IMAGE2D_ARRAY:
|
||||||
iy = adFn(floorf(y), height_lod);
|
iy = adFn(static_cast<int>(floorf(y)), height_lod);
|
||||||
iz =
|
iz = static_cast<int>(calculate_array_index(
|
||||||
calculate_array_index(z, (float)(imageInfo->arraySize - 1));
|
z, (float)(imageInfo->arraySize - 1)));
|
||||||
if (verbose)
|
if (verbose)
|
||||||
{
|
{
|
||||||
log_info("\tArray index %f evaluates to %d\n", z, iz);
|
log_info("\tArray index %f evaluates to %d\n", z, iz);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
iy = adFn(floorf(y), height_lod);
|
iy = adFn(static_cast<int>(floorf(y)), height_lod);
|
||||||
if (depth_lod != 0)
|
if (depth_lod != 0)
|
||||||
iz = adFn(floorf(z), depth_lod);
|
iz = adFn(static_cast<int>(floorf(z)), depth_lod);
|
||||||
else
|
else
|
||||||
iz = 0;
|
iz = 0;
|
||||||
}
|
}
|
||||||
@@ -2047,16 +2053,16 @@ FloatPixel sample_image_pixel_float_offset(
|
|||||||
height = 1;
|
height = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int x1 = adFn(floorf(x - 0.5f), width);
|
int x1 = adFn(static_cast<int>(floorf(x - 0.5f)), width);
|
||||||
int y1 = 0;
|
int y1 = 0;
|
||||||
int x2 = adFn(floorf(x - 0.5f) + 1, width);
|
int x2 = adFn(static_cast<int>(floorf(x - 0.5f) + 1), width);
|
||||||
int y2 = 0;
|
int y2 = 0;
|
||||||
if ((imageInfo->type != CL_MEM_OBJECT_IMAGE1D)
|
if ((imageInfo->type != CL_MEM_OBJECT_IMAGE1D)
|
||||||
&& (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY)
|
&& (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY)
|
||||||
&& (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_BUFFER))
|
&& (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_BUFFER))
|
||||||
{
|
{
|
||||||
y1 = adFn(floorf(y - 0.5f), height);
|
y1 = adFn(static_cast<int>(floorf(y - 0.5f)), height);
|
||||||
y2 = adFn(floorf(y - 0.5f) + 1, height);
|
y2 = adFn(static_cast<int>(floorf(y - 0.5f) + 1), height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2147,12 +2153,12 @@ FloatPixel sample_image_pixel_float_offset(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 3D linear filtering
|
// 3D linear filtering
|
||||||
int x1 = adFn(floorf(x - 0.5f), width_lod);
|
int x1 = adFn(static_cast<int>(floorf(x - 0.5f)), width_lod);
|
||||||
int y1 = adFn(floorf(y - 0.5f), height_lod);
|
int y1 = adFn(static_cast<int>(floorf(y - 0.5f)), height_lod);
|
||||||
int z1 = adFn(floorf(z - 0.5f), depth_lod);
|
int z1 = adFn(static_cast<int>(floorf(z - 0.5f)), depth_lod);
|
||||||
int x2 = adFn(floorf(x - 0.5f) + 1, width_lod);
|
int x2 = adFn(static_cast<int>(floorf(x - 0.5f) + 1), width_lod);
|
||||||
int y2 = adFn(floorf(y - 0.5f) + 1, height_lod);
|
int y2 = adFn(static_cast<int>(floorf(y - 0.5f) + 1), height_lod);
|
||||||
int z2 = adFn(floorf(z - 0.5f) + 1, depth_lod);
|
int z2 = adFn(static_cast<int>(floorf(z - 0.5f) + 1), depth_lod);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
log_info("\tActual integer coords used (i = floor(x-.5)): "
|
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: {
|
case CL_UNSIGNED_INT8: {
|
||||||
const cl_uchar *ptr = (const cl_uchar *)results;
|
const cl_uchar *ptr = (const cl_uchar *)results;
|
||||||
for (unsigned int i = 0; i < channelCount; i++)
|
for (unsigned int i = 0; i < channelCount; i++)
|
||||||
errors[i] = (cl_int)ptr[i]
|
errors[i] = static_cast<float>(
|
||||||
- (cl_int)CONVERT_UINT(srcVector[i], 255.f, CL_UCHAR_MAX);
|
(cl_int)ptr[i]
|
||||||
|
- (cl_int)CONVERT_UINT(srcVector[i], 255.f, CL_UCHAR_MAX));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CL_UNSIGNED_INT16: {
|
case CL_UNSIGNED_INT16: {
|
||||||
const cl_ushort *ptr = (const cl_ushort *)results;
|
const cl_ushort *ptr = (const cl_ushort *)results;
|
||||||
for (unsigned int i = 0; i < channelCount; i++)
|
for (unsigned int i = 0; i < channelCount; i++)
|
||||||
errors[i] = (cl_int)ptr[i]
|
errors[i] = static_cast<float>(
|
||||||
- (cl_int)CONVERT_UINT(srcVector[i], 32767.f, CL_USHRT_MAX);
|
(cl_int)ptr[i]
|
||||||
|
- (cl_int)CONVERT_UINT(srcVector[i], 32767.f,
|
||||||
|
CL_USHRT_MAX));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CL_UNSIGNED_INT32: {
|
case CL_UNSIGNED_INT32: {
|
||||||
@@ -3228,7 +3237,7 @@ char *create_random_image_data(ExplicitType dataType,
|
|||||||
if (data == NULL)
|
if (data == NULL)
|
||||||
{
|
{
|
||||||
log_error(
|
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);
|
allocSize);
|
||||||
return NULL;
|
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 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 = width;
|
||||||
max_dim = height > max_dim ? height : max_dim;
|
max_dim = height > max_dim ? height : max_dim;
|
||||||
|
|||||||
@@ -579,7 +579,7 @@ static int create_single_kernel_helper_create_program_offline(
|
|||||||
if (error != CL_SUCCESS) return error;
|
if (error != CL_SUCCESS) return error;
|
||||||
|
|
||||||
ifs.seekg(0, ifs.end);
|
ifs.seekg(0, ifs.end);
|
||||||
int length = ifs.tellg();
|
size_t length = static_cast<size_t>(ifs.tellg());
|
||||||
ifs.seekg(0, ifs.beg);
|
ifs.seekg(0, ifs.beg);
|
||||||
|
|
||||||
// treat modifiedProgram as input for clCreateProgramWithBinary
|
// 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));
|
list = (cl_image_format *)malloc(count * sizeof(cl_image_format));
|
||||||
if (NULL == list)
|
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",
|
"list at %s:%d (err = %d)\n",
|
||||||
count * sizeof(cl_image_format), __FILE__, __LINE__, err);
|
count * sizeof(cl_image_format), __FILE__, __LINE__, err);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -404,7 +404,8 @@ std::string exe_path()
|
|||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|
||||||
DWORD len = GetModuleFileNameA(NULL, &path.front(), path.size());
|
DWORD len = GetModuleFileNameA(NULL, &path.front(),
|
||||||
|
static_cast<DWORD>(path.size()));
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -97,15 +97,16 @@ int compareProperties(const std::vector<cl_properties>& queried,
|
|||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
log_error("ERROR: expected property 0x%x not found!\n",
|
log_error("ERROR: expected property 0x%llx not found!\n",
|
||||||
check_prop);
|
check_prop);
|
||||||
return TEST_FAIL;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
else if (check_value != queried_value)
|
else if (check_value != queried_value)
|
||||||
{
|
{
|
||||||
log_error("ERROR: mis-matched value for property 0x%x: wanted "
|
log_error(
|
||||||
"0x%x, got 0x%x\n",
|
"ERROR: mis-matched value for property 0x%llx: wanted "
|
||||||
check_prop, check_value, queried_value);
|
"0x%llx, got 0x%llx\n",
|
||||||
|
check_prop, check_value, queried_value);
|
||||||
return TEST_FAIL;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,7 +114,7 @@ int compareProperties(const std::vector<cl_properties>& queried,
|
|||||||
if (queried.size() > check.size())
|
if (queried.size() > check.size())
|
||||||
{
|
{
|
||||||
log_error("ERROR: all properties found but there are extra "
|
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());
|
check.size(), queried.size());
|
||||||
return TEST_FAIL;
|
return TEST_FAIL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ RoundingMode set_round(RoundingMode r, Type outType)
|
|||||||
const int *p = int_rounds;
|
const int *p = int_rounds;
|
||||||
if (outType == kfloat || outType == kdouble) p = flt_rounds;
|
if (outType == kfloat || outType == kdouble) p = flt_rounds;
|
||||||
|
|
||||||
int fpscr = 0;
|
int64_t fpscr = 0;
|
||||||
RoundingMode oldRound = get_round();
|
RoundingMode oldRound = get_round();
|
||||||
|
|
||||||
_FPU_GETCW(fpscr);
|
_FPU_GETCW(fpscr);
|
||||||
@@ -59,7 +59,7 @@ RoundingMode set_round(RoundingMode r, Type outType)
|
|||||||
|
|
||||||
RoundingMode get_round(void)
|
RoundingMode get_round(void)
|
||||||
{
|
{
|
||||||
int fpscr;
|
int64_t fpscr;
|
||||||
int oldRound;
|
int oldRound;
|
||||||
|
|
||||||
_FPU_GETCW(fpscr);
|
_FPU_GETCW(fpscr);
|
||||||
@@ -203,13 +203,13 @@ void *FlushToZero(void)
|
|||||||
#if defined(__APPLE__) || defined(__linux__) || defined(_WIN32)
|
#if defined(__APPLE__) || defined(__linux__) || defined(_WIN32)
|
||||||
#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER)
|
#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER)
|
||||||
union {
|
union {
|
||||||
int i;
|
unsigned int i;
|
||||||
void *p;
|
void *p;
|
||||||
} u = { _mm_getcsr() };
|
} u = { _mm_getcsr() };
|
||||||
_mm_setcsr(u.i | 0x8040);
|
_mm_setcsr(u.i | 0x8040);
|
||||||
return u.p;
|
return u.p;
|
||||||
#elif defined(__arm__) || defined(__aarch64__)
|
#elif defined(__arm__) || defined(__aarch64__)
|
||||||
int fpscr;
|
int64_t fpscr;
|
||||||
_FPU_GETCW(fpscr);
|
_FPU_GETCW(fpscr);
|
||||||
_FPU_SETCW(fpscr | FPSCR_FZ);
|
_FPU_SETCW(fpscr | FPSCR_FZ);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -239,7 +239,7 @@ void UnFlushToZero(void *p)
|
|||||||
} u = { p };
|
} u = { p };
|
||||||
_mm_setcsr(u.i);
|
_mm_setcsr(u.i);
|
||||||
#elif defined(__arm__) || defined(__aarch64__)
|
#elif defined(__arm__) || defined(__aarch64__)
|
||||||
int fpscr;
|
int64_t fpscr;
|
||||||
_FPU_GETCW(fpscr);
|
_FPU_GETCW(fpscr);
|
||||||
_FPU_SETCW(fpscr & ~FPSCR_FZ);
|
_FPU_SETCW(fpscr & ~FPSCR_FZ);
|
||||||
#elif defined(__PPC__)
|
#elif defined(__PPC__)
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
#ifndef __ROUNDING_MODE_H__
|
#ifndef __ROUNDING_MODE_H__
|
||||||
#define __ROUNDING_MODE_H__
|
#define __ROUNDING_MODE_H__
|
||||||
|
|
||||||
#pragma STDC FENV_ACCESS ON
|
|
||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
#if (defined(_WIN32) && defined(_MSC_VER))
|
#if (defined(_WIN32) && defined(_MSC_VER))
|
||||||
|
|||||||
@@ -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 <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#if !defined(_WIN32)
|
|
||||||
#include <pthread.h>
|
|
||||||
#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
|
|
||||||
|
|||||||
@@ -24,8 +24,5 @@
|
|||||||
|
|
||||||
typedef int (*basefn)(cl_device_id deviceID, cl_context context,
|
typedef int (*basefn)(cl_device_id deviceID, cl_context context,
|
||||||
cl_command_queue queue, int num_elements);
|
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
|
||||||
@@ -18,3 +18,11 @@ set (${MODULE_NAME}_SOURCES
|
|||||||
list(APPEND CLConform_LIBRARIES EGL GLESv2)
|
list(APPEND CLConform_LIBRARIES EGL GLESv2)
|
||||||
|
|
||||||
include(../CMakeCommon.txt)
|
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()
|
||||||
@@ -117,7 +117,8 @@ public:
|
|||||||
_platform, "clGetGLContextInfoKHR");
|
_platform, "clGetGLContextInfoKHR");
|
||||||
if (GetGLContextInfo == NULL)
|
if (GetGLContextInfo == NULL)
|
||||||
{
|
{
|
||||||
print_error(status, "clGetGLContextInfoKHR failed");
|
log_error("ERROR: clGetGLContextInfoKHR failed! (%s:%d)\n",
|
||||||
|
__FILE__, __LINE__);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +129,7 @@ public:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
dev_size /= sizeof(cl_device_id);
|
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 =
|
status =
|
||||||
GetGLContextInfo(properties, CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR,
|
GetGLContextInfo(properties, CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR,
|
||||||
|
|||||||
@@ -570,10 +570,12 @@ int test_fence_sync_single( cl_device_id device, cl_context context, cl_command_
|
|||||||
{
|
{
|
||||||
if( p[ t ] == 0 )
|
if( p[ t ] == 0 )
|
||||||
{
|
{
|
||||||
log_error( "RUN: %ld to %ld (%d,%d to %d,%d) 0x%08x\n", a, t - 1,
|
log_error(
|
||||||
(int)( a % framebufferSize ), (int)( a / framebufferSize ),
|
"RUN: %zu to %zu (%d,%d to %d,%d) 0x%08x\n",
|
||||||
(int)( ( t - 1 ) % framebufferSize ), (int)( ( t - 1 ) / framebufferSize ),
|
a, t - 1, (int)(a % framebufferSize),
|
||||||
p[ a ] );
|
(int)(a / framebufferSize),
|
||||||
|
(int)((t - 1) % framebufferSize),
|
||||||
|
(int)((t - 1) / framebufferSize), p[a]);
|
||||||
a = t;
|
a = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 -------------------------
|
#pragma mark -------------------- Write tests -------------------------
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int test_cl_image_write( cl_context context, cl_command_queue queue, cl_mem clImage,
|
int test_cl_image_write( cl_context context, cl_command_queue queue, cl_mem clImage,
|
||||||
|
|||||||
@@ -197,7 +197,9 @@ int test_renderbuffer_read( cl_device_id device, cl_context context, cl_command_
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __APPLE__
|
||||||
#pragma mark -------------------- Write tests -------------------------
|
#pragma mark -------------------- Write tests -------------------------
|
||||||
|
#endif
|
||||||
|
|
||||||
int test_attach_renderbuffer_write_to_image( cl_context context, cl_command_queue queue, GLenum glTarget, GLuint glRenderbuffer,
|
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 )
|
size_t imageWidth, size_t imageHeight, cl_image_format *outFormat, ExplicitType *outType, MTdata d, void **outSourceBuffer )
|
||||||
|
|||||||
Reference in New Issue
Block a user