Workaround to preserve case when checking availability of APPLE OpenCL extensions.

This commit is contained in:
Ioannis Tsakpinis 2014-04-02 13:36:02 +03:00
parent 3ac0b43efd
commit c17617175b
5 changed files with 14 additions and 2 deletions

View File

@ -46,4 +46,7 @@ public @interface Extension {
String className() default "";
boolean isFinal() default true;
String postfix();
/** The extension name as it appears in the extension string. The default is the API prefix followed by the interface name, converted to lower-case. */
String nativeName() default "";
}

View File

@ -33,6 +33,7 @@
package org.lwjgl.util.generator.opencl;
import org.lwjgl.PointerWrapper;
import org.lwjgl.util.generator.Extension;
import org.lwjgl.util.generator.Private;
import java.io.PrintWriter;
@ -108,7 +109,12 @@ public class CLPDCapabilitiesGenerator {
final String extName = CLGeneratorProcessorFactory.getExtensionName(t.getSimpleName());
writer.print("\t\t" + extName + " = extensions.contains(\"" + extName.toLowerCase() + "\")");
String nativeName = extName.toLowerCase();
Extension ext = t.getAnnotation(Extension.class);
if ( ext != null && !ext.nativeName().isEmpty() )
nativeName = ext.nativeName();
writer.print("\t\t" + extName + " = extensions.contains(\"" + nativeName + "\")");
if ( !t.getMethods().isEmpty() )
writer.print(" && CLCapabilities." + extName);
writer.println(";");

View File

@ -39,6 +39,7 @@ import java.nio.ByteBuffer;
@Private
@CLPlatformExtension
@CLDeviceExtension
@Extension(postfix = "APPLE", nativeName = "cl_APPLE_ContextLoggingFunctions")
public interface APPLE_ContextLoggingFunctions {
@Extern

View File

@ -33,6 +33,7 @@ package org.lwjgl.opencl;
import org.lwjgl.util.generator.Code;
import org.lwjgl.util.generator.Constant;
import org.lwjgl.util.generator.Extension;
import org.lwjgl.util.generator.PointerWrapper;
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
import org.lwjgl.util.generator.opencl.CLPlatformExtension;
@ -40,6 +41,7 @@ import org.lwjgl.util.generator.opencl.cl_int;
@CLPlatformExtension
@CLDeviceExtension
@Extension(postfix = "APPLE", nativeName = "cl_APPLE_SetMemObjectDestructor")
public interface APPLE_SetMemObjectDestructor {
@Code(

View File

@ -39,7 +39,7 @@ import java.nio.ByteBuffer;
@CLPlatformExtension
@CLDeviceExtension
@Extension(postfix = "APPLE", className = "APPLEGLSharing")
@Extension(postfix = "APPLE", className = "APPLEGLSharing", nativeName = "cl_APPLE_gl_sharing")
public interface APPLE_gl_sharing {
/**