Package com.jme3.renderer.opengl
Class ComputeShader
java.lang.Object
com.jme3.util.NativeObject
com.jme3.renderer.opengl.ComputeShader
- All Implemented Interfaces:
Cloneable
A compute shader for general-purpose GPU computing (GPGPU).
Compute shaders require OpenGL 4.3 or higher.
-
Field Summary
Fields inherited from class com.jme3.util.NativeObject
handleRef, id, INVALID_ID, objectManager, OBJTYPE_AUDIOBUFFER, OBJTYPE_AUDIOSTREAM, OBJTYPE_BO, OBJTYPE_FENCE, OBJTYPE_FILTER, OBJTYPE_FRAMEBUFFER, OBJTYPE_SHADER, OBJTYPE_SHADERSOURCE, OBJTYPE_TEXTURE, OBJTYPE_VERTEXBUFFER, updateNeeded -
Constructor Summary
ConstructorsConstructorDescriptionComputeShader(GL4 gl, String source) Creates a new compute shader from GLSL source code. -
Method Summary
Modifier and TypeMethodDescriptionvoidbindShaderStorageBuffer(int location, ShaderStorageBufferObject ssbo) Creates a shallow clone of this GL Object.voiddeleteObject(Object rendererObject) Deletes the GL object from the GPU when it is no longer used.voiddispatch(int numGroupsX, int numGroupsY, int numGroupsZ) Dispatches the compute shader with the specified number of work groups.intgetUniformLocation(String name) longReturns a unique ID for this NativeObject.voidActivates this compute shader for use.voidCalled when the GL context is restarted to reset all IDs.voidsetUniform(int location, float value) voidsetUniform(int location, int value) voidsetUniform(int location, Matrix4f value) voidsetUniform(int location, Vector2f value) voidsetUniform(int location, Vector3f value) voidsetUniform(int location, Vector4f value) Methods inherited from class com.jme3.util.NativeObject
clearUpdateNeeded, clone, deleteNativeBuffers, dispose, getId, getWeakRef, isUpdateNeeded, setId, setUpdateNeeded, toString
-
Constructor Details
-
ComputeShader
Creates a new compute shader from GLSL source code.
-
-
Method Details
-
makeActive
public void makeActive()Activates this compute shader for use. Must be called before setting uniforms or dispatching. -
dispatch
public void dispatch(int numGroupsX, int numGroupsY, int numGroupsZ) Dispatches the compute shader with the specified number of work groups. -
setUniform
public void setUniform(int location, int value) -
setUniform
public void setUniform(int location, float value) -
setUniform
-
setUniform
-
setUniform
-
setUniform
-
getUniformLocation
-
bindShaderStorageBuffer
-
resetObject
public void resetObject()Description copied from class:NativeObjectCalled when the GL context is restarted to reset all IDs. Prevents "white textures" on display restart.- Specified by:
resetObjectin classNativeObject
-
deleteObject
Description copied from class:NativeObjectDeletes the GL object from the GPU when it is no longer used. Called automatically by the GL object manager.- Specified by:
deleteObjectin classNativeObject- Parameters:
rendererObject- The renderer to be used to delete the object
-
createDestructableClone
Description copied from class:NativeObjectCreates a shallow clone of this GL Object. The deleteObject method should be functional for this object.- Specified by:
createDestructableClonein classNativeObject- Returns:
- a new instance
-
getUniqueId
public long getUniqueId()Description copied from class:NativeObjectReturns a unique ID for this NativeObject. No other NativeObject shall have the same ID.- Specified by:
getUniqueIdin classNativeObject- Returns:
- unique ID for this NativeObject.
-