From 0b6fbd15d1f6427d85215945ca58e904c543066d Mon Sep 17 00:00:00 2001 From: AlexBinXie <54727243+AlexXAmd@users.noreply.github.com> Date: Thu, 14 Jan 2021 08:27:45 -0500 Subject: [PATCH] Use glFinish to replace glFlush (#1102) In OpenCL spec 1.1: "Prior to calling clEnqueueAcquireGLObjects, the application must ensure that any pending GL operations which access the objects specified in mem_objects have completed. This may be accomplished portably by issuing and waiting for completion of a glFinish command on all GL contexts with pending references to these objects." Signed-off-by: Alex Xie --- test_conformance/gl/test_buffers.cpp | 2 +- test_conformance/gl/test_image_methods.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test_conformance/gl/test_buffers.cpp b/test_conformance/gl/test_buffers.cpp index f11590fb..35f01ee6 100644 --- a/test_conformance/gl/test_buffers.cpp +++ b/test_conformance/gl/test_buffers.cpp @@ -184,7 +184,7 @@ int test_buffer_kernel(cl_context context, cl_command_queue queue, ExplicitType glBufferData( GL_ARRAY_BUFFER, bufferSize, outDataGL, GL_STATIC_DRAW ); glBindBuffer( GL_ARRAY_BUFFER, 0 ); - glFlush(); + glFinish(); /* Generate some streams. The first and last ones are GL, middle one just vanilla CL */ diff --git a/test_conformance/gl/test_image_methods.cpp b/test_conformance/gl/test_image_methods.cpp index afaa08fc..07f5b65e 100644 --- a/test_conformance/gl/test_image_methods.cpp +++ b/test_conformance/gl/test_image_methods.cpp @@ -287,10 +287,10 @@ int test_image_format_methods( cl_device_id device, cl_context context, cl_comma error = clSetKernelArg( kernel, 1, sizeof( outDataBuffer ), &outDataBuffer ); test_error( error, "Unable to set kernel argument" ); - // Flush and Acquire. - glFlush(); - error = (*clEnqueueAcquireGLObjects_ptr)( queue, 1, &image, 0, NULL, NULL); - test_error( error, "Unable to acquire GL obejcts"); + // Finish and Acquire. + glFinish(); + error = (*clEnqueueAcquireGLObjects_ptr)(queue, 1, &image, 0, NULL, NULL); + test_error(error, "Unable to acquire GL obejcts"); size_t threads[1] = { 1 }, localThreads[1] = { 1 };