Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix freeglut reinitialization attempt in gl_sharing tests #1885

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 9 additions & 20 deletions test_conformance/gl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,17 @@ int main(int argc, const char *argv[])
return error;
}

// At least one device supports CL-GL interop, so init the test.
if (glEnv->Init(&argc, (char **)argv, CL_FALSE))
{
log_error("Failed to initialize the GL environment for this test.\n");
return -1;
}

// OpenGL tests for non-3.2
// ////////////////////////////////////////////////////////
if ((argc == 1) || (first_32_testname != 1))
{

// At least one device supports CL-GL interop, so init the test.
if (glEnv->Init(&argc, (char **)argv, CL_FALSE))
{
log_error(
"Failed to initialize the GL environment for this test.\n");
return -1;
}

// Create a context to use and then grab a device (or devices) from it
sCurrentContext = glEnv->CreateCLContext();
if (sCurrentContext == NULL)
Expand Down Expand Up @@ -330,22 +328,12 @@ int main(int argc, const char *argv[])
// Clean-up.
free(deviceIDs);
clReleaseContext(sCurrentContext);
// delete glEnv;
}

// OpenGL 3.2 tests.
// ////////////////////////////////////////////////////////
if ((argc == 1) || first_32_testname)
{

// At least one device supports CL-GL interop, so init the test.
if (glEnv->Init(&argc, (char **)argv, CL_TRUE))
{
log_error(
"Failed to initialize the GL environment for this test.\n");
return -1;
}

// Create a context to use and then grab a device (or devices) from it
sCurrentContext = glEnv->CreateCLContext();
if (sCurrentContext == NULL)
Expand Down Expand Up @@ -415,9 +403,10 @@ int main(int argc, const char *argv[])
// Clean-up.
free(deviceIDs);
clReleaseContext(sCurrentContext);
delete glEnv;
}

delete glEnv;

// All done.
return numErrors;
}
93 changes: 47 additions & 46 deletions test_conformance/gles/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,19 +171,22 @@ int main(int argc, const char *argv[])
goto cleanup;
}

// OpenGL tests for non-3.2 ////////////////////////////////////////////////////////
if ((argc == 1) || (first_32_testname != 1)) {

// At least one device supports CL-GL interop, so init the test.
if( glEnv->Init( &argc, (char **)argv, CL_FALSE ) ) {
// At least one device supports CL-GL interop, so init the test.
if (glEnv->Init(&argc, (char **)argv, CL_FALSE))
{
log_error("Failed to initialize the GL environment for this test.\n");
error = -1;
goto cleanup;
}
}

// Create a context to use and then grab a device (or devices) from it
sCurrentContext = glEnv->CreateCLContext();
if( sCurrentContext == NULL )
// OpenGL tests for non-3.2
// ////////////////////////////////////////////////////////
if ((argc == 1) || (first_32_testname != 1))
{

// Create a context to use and then grab a device (or devices) from it
sCurrentContext = glEnv->CreateCLContext();
if (sCurrentContext == NULL)
{
log_error( "ERROR: Unable to obtain CL context from GL\n" );
error = -1;
Expand Down Expand Up @@ -279,50 +282,48 @@ int main(int argc, const char *argv[])
// We move this to a common cleanup step to make sure that things will be released properly before the test exit
goto cleanup;
// clReleaseContext( sCurrentContext );
// delete glEnv;
}

// OpenGL 3.2 tests. ////////////////////////////////////////////////////////
if ((argc==1) || first_32_testname) {

// At least one device supports CL-GL interop, so init the test.
if( glEnv->Init( &argc, (char **)argv, CL_TRUE ) ) {
log_error("Failed to initialize the GL environment for this test.\n");
error = -1;
goto cleanup;
}

// Create a context to use and then grab a device (or devices) from it
sCurrentContext = glEnv->CreateCLContext();
if( sCurrentContext == NULL ) {
log_error( "ERROR: Unable to obtain CL context from GL\n" );
error = -1;
goto cleanup;
}
if ((argc == 1) || first_32_testname)
{
// Create a context to use and then grab a device (or devices) from it
sCurrentContext = glEnv->CreateCLContext();
if (sCurrentContext == NULL)
{
log_error("ERROR: Unable to obtain CL context from GL\n");
error = -1;
goto cleanup;
}

size_t numDevices = 0;
cl_device_id deviceIDs[ 16 ];
size_t numDevices = 0;
cl_device_id deviceIDs[16];

error = clGetContextInfo( sCurrentContext, CL_CONTEXT_DEVICES, 0, NULL, &numDevices);
if( error != CL_SUCCESS ) {
print_error( error, "Unable to get device count from context" );
error = -1;
goto cleanup;
}
numDevices /= sizeof(cl_device_id);
error = clGetContextInfo(sCurrentContext, CL_CONTEXT_DEVICES, 0, NULL,
&numDevices);
if (error != CL_SUCCESS)
{
print_error(error, "Unable to get device count from context");
error = -1;
goto cleanup;
}
numDevices /= sizeof(cl_device_id);

if (numDevices < 1) {
log_error("No devices found.\n");
error = -1;
goto cleanup;
}
if (numDevices < 1)
{
log_error("No devices found.\n");
error = -1;
goto cleanup;
}

error = clGetContextInfo( sCurrentContext, CL_CONTEXT_DEVICES, sizeof( deviceIDs ), deviceIDs, NULL);
if( error != CL_SUCCESS ) {
print_error( error, "Unable to get device list from context" );
error = -1;
goto cleanup;
}
error = clGetContextInfo(sCurrentContext, CL_CONTEXT_DEVICES,
sizeof(deviceIDs), deviceIDs, NULL);
if (error != CL_SUCCESS)
{
print_error(error, "Unable to get device list from context");
error = -1;
goto cleanup;
}

#ifdef GLES3
int argc_ = (first_32_testname) ? 1 + (argc - first_32_testname) : argc;
Expand Down
Loading