Skip to content

Commit 21218ff

Browse files
Removed usage of half types in CTS test KhronosGroup#1982
1 parent 0a00a1f commit 21218ff

File tree

3 files changed

+21
-142
lines changed

3 files changed

+21
-142
lines changed

test_conformance/gl/common.h

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ static const format common_formats[] = {
5151
{ GL_RGBA16UI_EXT, GL_RGBA_INTEGER_EXT, GL_UNSIGNED_SHORT, kUShort },
5252
{ GL_RGBA32UI_EXT, GL_RGBA_INTEGER_EXT, GL_UNSIGNED_INT, kUInt },
5353
{ GL_RGBA32F_ARB, GL_RGBA, GL_FLOAT, kFloat },
54-
{ GL_RGBA16F_ARB, GL_RGBA, GL_HALF_FLOAT, kHalf }
5554
};
5655

5756
#ifdef GL_VERSION_3_2

test_conformance/gl/test_images_write_common.cpp

+15-123
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ static const char *kernelpattern_image_write_1D =
3636
" write_image%s( dest, index, %s(value));\n"
3737
"}\n";
3838

39-
static const char *kernelpattern_image_write_1D_half =
40-
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"
41-
"__kernel void sample_test( __global half4 *source, write_only image1d_t dest )\n"
42-
"{\n"
43-
" uint index = get_global_id(0);\n"
44-
" write_imagef( dest, index, vload_half4(index, (__global half *)source));\n"
45-
"}\n";
46-
4739
static const char *kernelpattern_image_write_1D_buffer =
4840
"__kernel void sample_test( __global %s4 *source, write_only image1d_buffer_t dest )\n"
4941
"{\n"
@@ -52,14 +44,6 @@ static const char *kernelpattern_image_write_1D_buffer =
5244
" write_image%s( dest, index, %s(value));\n"
5345
"}\n";
5446

55-
static const char *kernelpattern_image_write_1D_buffer_half =
56-
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"
57-
"__kernel void sample_test( __global half4 *source, write_only image1d_buffer_t dest )\n"
58-
"{\n"
59-
" uint index = get_global_id(0);\n"
60-
" write_imagef( dest, index, vload_half4(index, (__global half *)source));\n"
61-
"}\n";
62-
6347
static const char *kernelpattern_image_write_2D =
6448
"__kernel void sample_test( __global %s4 *source, write_only image2d_t dest )\n"
6549
"{\n"
@@ -70,16 +54,6 @@ static const char *kernelpattern_image_write_2D =
7054
" write_image%s( dest, (int2)( tidX, tidY ), %s(value));\n"
7155
"}\n";
7256

73-
static const char *kernelpattern_image_write_2D_half =
74-
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"
75-
"__kernel void sample_test( __global half4 *source, write_only image2d_t dest )\n"
76-
"{\n"
77-
" int tidX = get_global_id(0);\n"
78-
" int tidY = get_global_id(1);\n"
79-
" uint index = tidY * get_image_width( dest ) + tidX;\n"
80-
" write_imagef( dest, (int2)( tidX, tidY ), vload_half4(index, (__global half *)source));\n"
81-
"}\n";
82-
8357
static const char *kernelpattern_image_write_1Darray =
8458
"__kernel void sample_test( __global %s4 *source, write_only image1d_array_t dest )\n"
8559
"{\n"
@@ -90,16 +64,6 @@ static const char *kernelpattern_image_write_1Darray =
9064
" write_image%s( dest, (int2)( tidX, tidY ), %s(value));\n"
9165
"}\n";
9266

93-
static const char *kernelpattern_image_write_1Darray_half =
94-
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"
95-
"__kernel void sample_test( __global half4 *source, write_only image1d_array_t dest )\n"
96-
"{\n"
97-
" int tidX = get_global_id(0);\n"
98-
" int tidY = get_global_id(1);\n"
99-
" uint index = tidY * get_image_width( dest ) + tidX;\n"
100-
" write_imagef( dest, (int2)( tidX, tidY ), vload_half4(index, (__global half *)source));\n"
101-
"}\n";
102-
10367
static const char *kernelpattern_image_write_3D =
10468
"#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable\n"
10569
"__kernel void sample_test( __global %s4 *source, write_only image3d_t dest )\n"
@@ -114,20 +78,6 @@ static const char *kernelpattern_image_write_3D =
11478
" write_image%s( dest, (int4)( tidX, tidY, tidZ, 0 ), %s(value));\n"
11579
"}\n";
11680

117-
static const char *kernelpattern_image_write_3D_half =
118-
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"
119-
"#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable\n"
120-
"__kernel void sample_test( __global half4 *source, write_only image3d_t dest )\n"
121-
"{\n"
122-
" int tidX = get_global_id(0);\n"
123-
" int tidY = get_global_id(1);\n"
124-
" int tidZ = get_global_id(2);\n"
125-
" int width = get_image_width( dest );\n"
126-
" int height = get_image_height( dest );\n"
127-
" int index = tidZ * width * height + tidY * width + tidX;\n"
128-
" write_imagef( dest, (int4)( tidX, tidY, tidZ, 0 ), vload_half4(index, (__global half *)source));\n"
129-
"}\n";
130-
13181
static const char *kernelpattern_image_write_2Darray =
13282
"__kernel void sample_test( __global %s4 *source, write_only image2d_array_t dest )\n"
13383
"{\n"
@@ -141,19 +91,6 @@ static const char *kernelpattern_image_write_2Darray =
14191
" write_image%s( dest, (int4)( tidX, tidY, tidZ, 0 ), %s(value));\n"
14292
"}\n";
14393

144-
static const char *kernelpattern_image_write_2Darray_half =
145-
"#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n"
146-
"__kernel void sample_test( __global half4 *source, write_only image2d_array_t dest )\n"
147-
"{\n"
148-
" int tidX = get_global_id(0);\n"
149-
" int tidY = get_global_id(1);\n"
150-
" int tidZ = get_global_id(2);\n"
151-
" int width = get_image_width( dest );\n"
152-
" int height = get_image_height( dest );\n"
153-
" int index = tidZ * width * height + tidY * width + tidX;\n"
154-
" write_imagef( dest, (int4)( tidX, tidY, tidZ, 0 ), vload_half4(index, (__global half *)source));\n"
155-
"}\n";
156-
15794
#ifdef GL_VERSION_3_2
15895

15996
static const char * kernelpattern_image_write_2D_depth =
@@ -192,24 +129,12 @@ static const char *get_appropriate_write_kernel(GLenum target,
192129
{
193130
switch (get_base_gl_target(target))
194131
{
195-
case GL_TEXTURE_1D:
196-
197-
if (type == kHalf)
198-
return kernelpattern_image_write_1D_half;
199-
else
200-
return kernelpattern_image_write_1D;
201-
break;
132+
case GL_TEXTURE_1D: return kernelpattern_image_write_1D; break;
202133
case GL_TEXTURE_BUFFER:
203-
if (type == kHalf)
204-
return kernelpattern_image_write_1D_buffer_half;
205-
else
206-
return kernelpattern_image_write_1D_buffer;
134+
return kernelpattern_image_write_1D_buffer;
207135
break;
208136
case GL_TEXTURE_1D_ARRAY:
209-
if (type == kHalf)
210-
return kernelpattern_image_write_1Darray_half;
211-
else
212-
return kernelpattern_image_write_1Darray;
137+
return kernelpattern_image_write_1Darray;
213138
break;
214139
case GL_COLOR_ATTACHMENT0:
215140
case GL_RENDERBUFFER:
@@ -220,29 +145,18 @@ static const char *get_appropriate_write_kernel(GLenum target,
220145
if (channel_order == CL_DEPTH || channel_order == CL_DEPTH_STENCIL)
221146
return kernelpattern_image_write_2D_depth;
222147
#endif
223-
if (type == kHalf)
224-
return kernelpattern_image_write_2D_half;
225-
else
226-
return kernelpattern_image_write_2D;
148+
return kernelpattern_image_write_2D;
227149
break;
228150

229151
case GL_TEXTURE_2D_ARRAY:
230152
#ifdef GL_VERSION_3_2
231153
if (channel_order == CL_DEPTH || channel_order == CL_DEPTH_STENCIL)
232154
return kernelpattern_image_write_2D_array_depth;
233155
#endif
234-
if (type == kHalf)
235-
return kernelpattern_image_write_2Darray_half;
236-
else
237-
return kernelpattern_image_write_2Darray;
156+
return kernelpattern_image_write_2Darray;
238157
break;
239158

240-
case GL_TEXTURE_3D:
241-
if (type == kHalf)
242-
return kernelpattern_image_write_3D_half;
243-
else
244-
return kernelpattern_image_write_3D;
245-
break;
159+
case GL_TEXTURE_3D: return kernelpattern_image_write_3D; break;
246160

247161
default:
248162
log_error("Unsupported GL tex target (%s) passed to write test: "
@@ -310,8 +224,7 @@ void set_dimensions_by_target(GLenum target, size_t *dims, size_t sizes[3],
310224
int test_cl_image_write(cl_context context, cl_command_queue queue,
311225
GLenum target, cl_mem clImage, size_t width,
312226
size_t height, size_t depth, cl_image_format *outFormat,
313-
ExplicitType *outType, void **outSourceBuffer, MTdata d,
314-
bool supports_half)
227+
ExplicitType *outType, void **outSourceBuffer, MTdata d)
315228
{
316229
size_t global_dims, global_sizes[3];
317230
clProgramWrapper program;
@@ -335,11 +248,6 @@ int test_cl_image_write(cl_context context, cl_command_queue queue,
335248

336249
const char *appropriateKernel = get_appropriate_write_kernel(
337250
target, *outType, outFormat->image_channel_order);
338-
if (*outType == kHalf && !supports_half)
339-
{
340-
log_info("cl_khr_fp16 isn't supported. Skip this test.\n");
341-
return 0;
342-
}
343251

344252
const char *suffix = get_kernel_suffix(outFormat);
345253
const char *convert = get_write_conversion(outFormat, *outType);
@@ -429,8 +337,7 @@ static int test_image_write(cl_context context, cl_command_queue queue,
429337
GLenum glTarget, GLuint glTexture, size_t width,
430338
size_t height, size_t depth,
431339
cl_image_format *outFormat, ExplicitType *outType,
432-
void **outSourceBuffer, MTdata d,
433-
bool supports_half)
340+
void **outSourceBuffer, MTdata d)
434341
{
435342
int error;
436343

@@ -450,8 +357,7 @@ static int test_image_write(cl_context context, cl_command_queue queue,
450357
}
451358

452359
return test_cl_image_write(context, queue, glTarget, image, width, height,
453-
depth, outFormat, outType, outSourceBuffer, d,
454-
supports_half);
360+
depth, outFormat, outType, outSourceBuffer, d);
455361
}
456362

457363
int supportsHalf(cl_context context, bool *supports_half)
@@ -523,11 +429,6 @@ static int test_image_format_write(cl_context context, cl_command_queue queue,
523429
ExplicitType type, MTdata d)
524430
{
525431
int error;
526-
// If we're testing a half float format, then we need to determine the
527-
// rounding mode of this machine. Punt if we fail to do so.
528-
529-
if (type == kHalf)
530-
if (DetectFloatToHalfRoundingMode(queue)) return 1;
531432

532433
// Create an appropriate GL texture or renderbuffer, given the target.
533434

@@ -616,28 +517,19 @@ static int test_image_format_write(cl_context context, cl_command_queue queue,
616517
globj = glRenderbuffer;
617518
}
618519

619-
bool supports_half = false;
620-
error = supportsHalf(context, &supports_half);
621-
if (error != 0) return error;
622-
623-
error = test_image_write(context, queue, target, globj, width, height,
624-
depth, &clFormat, &sourceType,
625-
(void **)&outSourceBuffer, d, supports_half);
520+
error =
521+
test_image_write(context, queue, target, globj, width, height, depth,
522+
&clFormat, &sourceType, (void **)&outSourceBuffer, d);
626523

627-
if (error != 0 || ((sourceType == kHalf) && !supports_half))
524+
if (error != 0)
628525
{
629526
if (outSourceBuffer) free(outSourceBuffer);
630527
return error;
631528
}
632529

633530
if (!outSourceBuffer) return 0;
634531

635-
// If actual source type was half, convert to float for validation.
636-
637-
if (sourceType == kHalf)
638-
validationType = kFloat;
639-
else
640-
validationType = sourceType;
532+
validationType = sourceType;
641533

642534
BufferOwningPtr<char> validationSource;
643535

@@ -685,7 +577,7 @@ static int test_image_format_write(cl_context context, cl_command_queue queue,
685577
int valid = 0;
686578
if (convertedGLResults)
687579
{
688-
if (sourceType == kFloat || sourceType == kHalf)
580+
if (sourceType == kFloat)
689581
{
690582
if (clFormat.image_channel_data_type == CL_UNORM_INT_101010)
691583
{

test_conformance/gl/test_renderbuffer.cpp

+6-18
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ extern int test_cl_image_write(cl_context context, cl_command_queue queue,
5555
size_t height, size_t depth,
5656
cl_image_format *outFormat,
5757
ExplicitType *outType, void **outSourceBuffer,
58-
MTdata d, bool supports_half);
58+
MTdata d);
5959

6060
extern int test_cl_image_read(cl_context context, cl_command_queue queue,
6161
GLenum gl_target, cl_mem image, size_t width,
@@ -299,7 +299,7 @@ int test_attach_renderbuffer_write_to_image(
299299
cl_context context, cl_command_queue queue, GLenum glTarget,
300300
GLuint glRenderbuffer, size_t imageWidth, size_t imageHeight,
301301
cl_image_format *outFormat, ExplicitType *outType, MTdata d,
302-
void **outSourceBuffer, bool supports_half)
302+
void **outSourceBuffer)
303303
{
304304
int error;
305305

@@ -314,7 +314,7 @@ int test_attach_renderbuffer_write_to_image(
314314

315315
return test_cl_image_write(context, queue, glTarget, image, imageWidth,
316316
imageHeight, 1, outFormat, outType,
317-
outSourceBuffer, d, supports_half);
317+
outSourceBuffer, d);
318318
}
319319

320320
int test_renderbuffer_image_write(cl_context context, cl_command_queue queue,
@@ -325,9 +325,6 @@ int test_renderbuffer_image_write(cl_context context, cl_command_queue queue,
325325
{
326326
int error;
327327

328-
if (type == kHalf)
329-
if (DetectFloatToHalfRoundingMode(queue)) return 1;
330-
331328
// Create the GL renderbuffer
332329
glFramebufferWrapper glFramebuffer;
333330
glRenderbufferWrapper glRenderbuffer;
@@ -355,20 +352,12 @@ int test_renderbuffer_image_write(cl_context context, cl_command_queue queue,
355352
ExplicitType validationType;
356353
void *outSourceBuffer;
357354

358-
bool supports_half = false;
359-
error = supportsHalf(context, &supports_half);
360-
if (error != 0) return error;
361-
362355
error = test_attach_renderbuffer_write_to_image(
363356
context, queue, attachment, glRenderbuffer, width, height, &clFormat,
364-
&sourceType, d, (void **)&outSourceBuffer, supports_half);
365-
if (error != 0 || ((sourceType == kHalf) && !supports_half)) return error;
357+
&sourceType, d, (void **)&outSourceBuffer);
358+
if (error != 0) return error;
366359

367-
// If actual source type was half, convert to float for validation.
368-
if (sourceType == kHalf)
369-
validationType = kFloat;
370-
else
371-
validationType = sourceType;
360+
validationType = sourceType;
372361

373362
BufferOwningPtr<char> validationSource(convert_to_expected(
374363
outSourceBuffer, width * height, sourceType, validationType,
@@ -461,7 +450,6 @@ int test_renderbuffer_write(cl_device_id device, cl_context context,
461450
{ GL_RGBA32UI_EXT, GL_RGBA_INTEGER_EXT, GL_UNSIGNED_INT, kUInt },
462451
#endif
463452
{ GL_RGBA32F_ARB, GL_RGBA, GL_FLOAT, kFloat },
464-
{ GL_RGBA16F_ARB, GL_RGBA, GL_HALF_FLOAT, kHalf }
465453
};
466454

467455
size_t fmtIdx, attIdx;

0 commit comments

Comments
 (0)