Right, well after some more investigation, I've found that if sharing CL and GL contexts, creating a texture and then attaching it to a framebuffer causes all operations on both the GPU and the CPU to slow down until that texture is deleted.
Using this CL setup code:
// find platform
List<CLPlatform> platforms = CLPlatform.getPlatforms();
if ( platforms == null || platforms.size() == 0 ) {
throw new RuntimeException( "No OpenCL platforms found." );
}
CLPlatform platform = platforms.get( 0 );
// find devices
Filter<CLDevice> sharingFilter = new Filter<CLDevice>()
{
@Override
public boolean accept( CLDevice device )
{
CLDeviceCapabilities capabilities = CLCapabilities.getDeviceCapabilities( device );
return capabilities.CL_KHR_gl_sharing;
}
};
this.devices = platform.getDevices( CL10.CL_DEVICE_TYPE_GPU, sharingFilter );
if ( devices == null || devices.size() == 0 ) {
throw new RuntimeException( "No OpenCL devices found with OpenGL sharing support." );
}
// create context
this.context = CLContext.create( platform, devices, new CLContextCallback()
{
@Override
protected void handleMessage( String error, ByteBuffer privateInfo )
{
logger.error( error );
}
}, drawable, null );
Placing this code on initialisation causes a significant framerate drop (but only when a shared CL context has been created):
int fbo = glGenFramebuffers();
glBindFramebuffer( GL_FRAMEBUFFER, fbo );
for ( int i = 0; i < 10000; i++ ) {
int id = glGenTextures();
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_2D, id );
glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA8, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, (ByteBuffer)null );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, id, 0 );
//glDeleteTextures( id );
}
glDeleteFramebuffers( fbo );
Uncommenting the glDeleteTextures call restores the framerate to normal.
This may well be a driver bug (running a 6870). I don't suppose anyone else can reproduce this?
Edit: I updated my drivers to the latest beta version (Catalyst 12.6 Beta), and it seems to be fixed.