本文整理汇总了Java中org.lwjgl.opencl.CLProgram类的典型用法代码示例。如果您正苦于以下问题:Java CLProgram类的具体用法?Java CLProgram怎么用?Java CLProgram使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CLProgram类属于org.lwjgl.opencl包,在下文中一共展示了CLProgram类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadCLShader
import org.lwjgl.opencl.CLProgram; //导入依赖的package包/类
/**
* Loads a CL Shader.
* It will load the files from the assets folder.
* Structure should be like:
*
* clshaders/[SHADERNAME]/shader.cl
*
* This function handles include-preprocessing, so you can use #include "test.cl".
* It will replace all includes with the contents of the given filename.
* Important! When using like #include "/test.cl" it will search the file assets/test.cl in the internal storage.
* If you use it like #include "test.cl" in a shader called test it will search in assets/shaders/test/test.cl.
*
* @param shaderName
* @return Null if the shader was not found
*/
public static CLProgram loadCLShader(String shaderName, CLContext clContext)
{
String shaderPath = "clshaders/"+shaderName+"/";
// Check if shader exists
if (!Gdx.files.internal(shaderPath+"shader.cl").exists())
return null;
// Preprocessing
String shaderCode = ShaderLoader.preprocessShader(Gdx.files.internal(shaderPath+"shader.cl").readString(), shaderPath);
return JLibOpenCL.compileProgram(shaderCode, clContext);
}