Skip to content

Commit

Permalink
fix freeglut reinitialization attempt in gl_sharing tests
Browse files Browse the repository at this point in the history
Fixes the following error:
freeglut (./build/test_conformance/gl/test_gl): illegal glutInit() reinitialization attempt
  • Loading branch information
karolherbst committed Jan 31, 2024
1 parent d394b0f commit f6f599b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 37 deletions.
32 changes: 11 additions & 21 deletions test_conformance/gl/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,18 @@ 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 +329,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)
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 +404,10 @@ int main(int argc, const char *argv[])
// Clean-up.
free(deviceIDs);
clReleaseContext(sCurrentContext);
delete glEnv;
}

delete glEnv;

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

// 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;
}

// 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");
error = -1;
goto cleanup;
}

// Create a context to use and then grab a device (or devices) from it
sCurrentContext = glEnv->CreateCLContext();
if( sCurrentContext == NULL )
Expand Down Expand Up @@ -279,19 +279,10 @@ 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 ) {
Expand Down

0 comments on commit f6f599b

Please sign in to comment.