APIdia Launch Partner
Top Fields Constructors Methods
com.sun.prism.mtl

pack-priv Class MTLContext

extends BaseShaderContext
Class Inheritance
Imports
com.sun.glass.ui.Screen, com.sun.javafx.geom.Rectangle, .Vec3d, com.sun.javafx.geom.transform.Affine3D, .BaseTransform, .GeneralTransform3D, com.sun.javafx.sg.prism.NGCamera, .NGDefaultCamera, com.sun.prism.CompositeMode, .Graphics, .MeshView, .RTTexture, .RenderTarget, .Texture, com.sun.prism.impl.PrismSettings, com.sun.prism.impl.ps.BaseShaderContext, com.sun.prism.ps.Shader, java.io.BufferedInputStream, .IOException, java.nio.ByteBuffer

Field Summary

Modifier and TypeField and Description
private Vec3d
public static final int
public static final int
public static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
public static final int
private final long
private MTLPipeline
private GeneralTransform3D
private static float[]
private MTLRTTexture
private MTLResourceFactory
private static final Affine3D
private GeneralTransform3D
private static final ByteBuffer
private BaseShaderContext.State
private int
private int
private static double[]
private GeneralTransform3D

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private GeneralTransform3D
adjustClipSpace(GeneralTransform3D projViewTx)

OpenGL projection transform use z-range of [-1, 1], while Metal expects it to be [0, 1], so we need to adjust the matrix.

public void
blit(RTTexture srcRTT, RTTexture dstRTT, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1)

Implements abstract com.sun.prism.impl.ps.BaseShaderContext.blit.

pack-priv boolean
buildNativeGeometry(long nativeHandle, float[] vertexBuffer, int vertexBufferLength, short[] indexBuffer, int indexBufferLength)

pack-priv boolean
buildNativeGeometry(long nativeHandle, float[] vertexBuffer, int vertexBufferLength, int[] indexBuffer, int indexBufferLength)

public void
pack-priv long
pack-priv long
createMTLMeshView(long nativeMesh)

pack-priv long
public void
dispose()

Overrides com.sun.prism.impl.ps.BaseShaderContext.dispose.

Dispose of this context.

public void
disposeShader(long nMetalShaderRef)

pack-priv long
public long
public MTLRTTexture
public MTLResourceFactory
protected void
public boolean
isCurrentRTT(long texPtr)

private static native void
nBlit(long pContext, long nSrcRTT, long nDstRTT, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1)

private static native boolean
nBuildNativeGeometryInt(long pContext, long nativeHandle, float[] vertexBuffer, int vertexBufferLength, int[] indexBuffer, int indexBufferLength)

private static native boolean
nBuildNativeGeometryShort(long pContext, long nativeHandle, float[] vertexBuffer, int vertexBufferLength, short[] indexBuffer, int indexBufferLength)

private static native void
private static native long
nCreateMTLMesh(long pContext)

private static native long
nCreateMTLMeshView(long pContext, long nativeMesh)

private static native long
nCreateMTLPhongMaterial(long pContext)

private static native void
nDisposeShader(long nMetalShaderRef)

private static native void
nDrawIndexedQuads(long context, float[] coords, byte[] volors, int numVertices)

private static native long
nGetCommandQueue(long context)

private static native long
nInitialize(ByteBuffer shaderLibPathStr)

private static native boolean
nIsCurrentRTT(long pContext, long texPtr)

private static native void
nRelease(long pContext)

private static native void
nReleaseMTLMesh(long pContext, long nativeHandle)

private static native void
nReleaseMTLMeshView(long pContext, long nativeHandle)

private static native void
nReleaseMTLPhongMaterial(long pContext, long nativeHandle)

private static native void
nRenderMeshView(long pContext, long nativeMeshView)

private static native void
nResetClipRect(long context)

private static native void
nSetAmbientLight(long pContext, long nativeMeshView, float r, float g, float b)

private static native void
nSetCameraPosition(long pContext, double x, double y, double z)

private static native void
nSetClipRect(long context, int x, int y, int width, int height)

private static native void
nSetCompositeMode(long context, int mode)

private static native void
nSetCullingMode(long pContext, long nativeMeshView, int cullingMode)

private static native void
nSetDiffuseColor(long pContext, long nativePhongMaterial, float r, float g, float b, float a)

private static native void
nSetLight(long pContext, long nativeMeshView, int index, float x, float y, float z, float r, float g, float b, float w, float ca, float la, float qa, float isAttenuated, float maxRange, float dirX, float dirY, float dirZ, float innerAngle, float outerAngle, float falloff)

private static native void
nSetMap(long pContext, long nativePhongMaterial, int mapType, long texID)

private static native void
nSetMaterial(long pContext, long nativeMeshView, long nativePhongMaterialInfo)

private static native void
nSetProjViewMatrix(long pContext, boolean isOrtho, double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)

private static native void
nSetSpecularColor(long pContext, long nativePhongMaterial, boolean set, float r, float g, float b, float a)

private static native void
nSetTransform(long pContext, double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)

private static native void
nSetWireframe(long pContext, long nativeMeshView, boolean wireframe)

private static native void
nSetWorldTransform(long pContext, double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)

private static native void
private static native int
nUpdateRenderTarget(long context, long texPtr, boolean depthTest)

private void
pack-priv void
releaseMTLMesh(long nativeHandle)

pack-priv void
releaseMTLMeshView(long nativeMeshView)

pack-priv void
releaseMTLPhongMaterial(long nativeHandle)

pack-priv void
renderMeshView(long nativeMeshView, Graphics g)

protected void
renderQuads(float[] coordArray, byte[] colorArray, int numVertices)

Implements abstract com.sun.prism.impl.BaseContext.renderQuads.

pack-priv void
setAmbientLight(long nativeMeshView, float r, float g, float b)

pack-priv void
setCullingMode(long nativeMeshView, int cullMode)

protected void
protected void
pack-priv void
setDiffuseColor(long nativePhongMaterial, float r, float g, float b, float a)

pack-priv void
setLight(long nativeMeshView, int index, float x, float y, float z, float r, float g, float b, float w, float ca, float la, float qa, float isAttenuated, float maxRange, float dirX, float dirY, float dirZ, float innerAngle, float outerAngle, float falloff)

pack-priv void
setMap(long nativePhongMaterial, int mapType, long nativeTexture)

pack-priv void
setMaterial(long nativeMeshView, long nativePhongMaterial)

public void
pack-priv void
setSpecularColor(long nativePhongMaterial, boolean set, float r, float g, float b, float a)

protected void
pack-priv void
setWireframe(long nativeMeshView, boolean wireframe)

protected void
protected void
private void
protected BaseShaderContext.State
protected void
protected void
protected void
Inherited from com.sun.prism.impl.ps.BaseShaderContext:
disposeLCDBuffergetLCDBufferinitinitLCDBufferisSuperShaderEnabledreleaseRenderTargetresetLastClipsetPerspectiveTransformsetRenderTargetvalidateClearOpvalidateLCDBuffervalidateLCDOpvalidatePaintOpvalidateTextureOp

Field Detail

cameraPosback to summary
private Vec3d cameraPos
CULL_BACKback to summary
public static final int CULL_BACK
CULL_FRONTback to summary
public static final int CULL_FRONT
CULL_NONEback to summary
public static final int CULL_NONE
MTL_COMPMODE_ADDback to summary
private static final int MTL_COMPMODE_ADD
MTL_COMPMODE_CLEARback to summary
private static final int MTL_COMPMODE_CLEAR
MTL_COMPMODE_DSTOUTback to summary
private static final int MTL_COMPMODE_DSTOUT
MTL_COMPMODE_SRCback to summary
private static final int MTL_COMPMODE_SRC
MTL_COMPMODE_SRCOVERback to summary
private static final int MTL_COMPMODE_SRCOVER
MTL_SAMPLER_ADDR_MODE_CLAMP_TO_BORDER_COLORback to summary
private static final int MTL_SAMPLER_ADDR_MODE_CLAMP_TO_BORDER_COLOR
MTL_SAMPLER_ADDR_MODE_CLAMP_TO_EDGEback to summary
private static final int MTL_SAMPLER_ADDR_MODE_CLAMP_TO_EDGE
MTL_SAMPLER_ADDR_MODE_CLAMP_TO_ZEROback to summary
private static final int MTL_SAMPLER_ADDR_MODE_CLAMP_TO_ZERO
MTL_SAMPLER_ADDR_MODE_MIRR_CLAMP_TO_EDGEback to summary
private static final int MTL_SAMPLER_ADDR_MODE_MIRR_CLAMP_TO_EDGE
MTL_SAMPLER_ADDR_MODE_MIRR_REPEATback to summary
private static final int MTL_SAMPLER_ADDR_MODE_MIRR_REPEAT
MTL_SAMPLER_ADDR_MODE_NOPback to summary
private static final int MTL_SAMPLER_ADDR_MODE_NOP
MTL_SAMPLER_ADDR_MODE_REPEATback to summary
private static final int MTL_SAMPLER_ADDR_MODE_REPEAT
NUM_QUADSback to summary
public static final int NUM_QUADS
pContextback to summary
private final long pContext
pipelineback to summary
private MTLPipeline pipeline
projViewTxback to summary
private GeneralTransform3D projViewTx
rawMatrixback to summary
private static float[] rawMatrix
renderTargetback to summary
private MTLRTTexture renderTarget
resourceFactoryback to summary
private MTLResourceFactory resourceFactory
scratchAffine3DTxback to summary
private static final Affine3D scratchAffine3DTx
scratchTxback to summary
private GeneralTransform3D scratchTx
shaderLibBufferback to summary
private static final ByteBuffer shaderLibBuffer
stateback to summary
private BaseShaderContext.State state

Hides com.sun.prism.impl.ps.BaseShaderContext.state.

targetHeightback to summary
private int targetHeight
targetWidthback to summary
private int targetWidth
tempAdjustClipSpaceMatback to summary
private static double[] tempAdjustClipSpaceMat
worldTxback to summary
private GeneralTransform3D worldTx

Constructor Detail

MTLContextback to summary
pack-priv MTLContext(Screen screen, MTLResourceFactory factory)

Method Detail

adjustClipSpaceback to summary
private GeneralTransform3D adjustClipSpace(GeneralTransform3D projViewTx)

OpenGL projection transform use z-range of [-1, 1], while Metal expects it to be [0, 1], so we need to adjust the matrix. (comment from D3DContext, see JDK-8123305)

blitback to summary
public void blit(RTTexture srcRTT, RTTexture dstRTT, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1)

Implements abstract com.sun.prism.impl.ps.BaseShaderContext.blit.

Annotations
@Override
buildNativeGeometryback to summary
pack-priv boolean buildNativeGeometry(long nativeHandle, float[] vertexBuffer, int vertexBufferLength, short[] indexBuffer, int indexBufferLength)
buildNativeGeometryback to summary
pack-priv boolean buildNativeGeometry(long nativeHandle, float[] vertexBuffer, int vertexBufferLength, int[] indexBuffer, int indexBufferLength)
commitCurrentCommandBufferback to summary
public void commitCurrentCommandBuffer()
createMTLMeshback to summary
pack-priv long createMTLMesh()
createMTLMeshViewback to summary
pack-priv long createMTLMeshView(long nativeMesh)
createMTLPhongMaterialback to summary
pack-priv long createMTLPhongMaterial()
disposeback to summary
public void dispose()

Overrides com.sun.prism.impl.ps.BaseShaderContext.dispose.

Doc from com.sun.prism.impl.BaseContext.dispose.

Dispose of this context. Subclass implementations can override this if needed. They must call super.dispose().

Annotations
@Override
disposeShaderback to summary
public void disposeShader(long nMetalShaderRef)
getContextHandleback to summary
pack-priv long getContextHandle()
getMetalCommandQueueback to summary
public long getMetalCommandQueue()
getRenderTargetTextureback to summary
public MTLRTTexture getRenderTargetTexture()
getResourceFactoryback to summary
public MTLResourceFactory getResourceFactory()

Overrides com.sun.prism.impl.BaseContext.getResourceFactory.

Annotations
@Override
initStateback to summary
protected void initState()
isCurrentRTTback to summary
public boolean isCurrentRTT(long texPtr)
nBlitback to summary
private static native void nBlit(long pContext, long nSrcRTT, long nDstRTT, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1)
nBuildNativeGeometryIntback to summary
private static native boolean nBuildNativeGeometryInt(long pContext, long nativeHandle, float[] vertexBuffer, int vertexBufferLength, int[] indexBuffer, int indexBufferLength)
nBuildNativeGeometryShortback to summary
private static native boolean nBuildNativeGeometryShort(long pContext, long nativeHandle, float[] vertexBuffer, int vertexBufferLength, short[] indexBuffer, int indexBufferLength)
nCommitCurrentCommandBufferback to summary
private static native void nCommitCurrentCommandBuffer(long context)
nCreateMTLMeshback to summary
private static native long nCreateMTLMesh(long pContext)
nCreateMTLMeshViewback to summary
private static native long nCreateMTLMeshView(long pContext, long nativeMesh)
nCreateMTLPhongMaterialback to summary
private static native long nCreateMTLPhongMaterial(long pContext)
nDisposeShaderback to summary
private static native void nDisposeShader(long nMetalShaderRef)
nDrawIndexedQuadsback to summary
private static native void nDrawIndexedQuads(long context, float[] coords, byte[] volors, int numVertices)
nGetCommandQueueback to summary
private static native long nGetCommandQueue(long context)
nInitializeback to summary
private static native long nInitialize(ByteBuffer shaderLibPathStr)
nIsCurrentRTTback to summary
private static native boolean nIsCurrentRTT(long pContext, long texPtr)
nReleaseback to summary
private static native void nRelease(long pContext)
nReleaseMTLMeshback to summary
private static native void nReleaseMTLMesh(long pContext, long nativeHandle)
nReleaseMTLMeshViewback to summary
private static native void nReleaseMTLMeshView(long pContext, long nativeHandle)
nReleaseMTLPhongMaterialback to summary
private static native void nReleaseMTLPhongMaterial(long pContext, long nativeHandle)
nRenderMeshViewback to summary
private static native void nRenderMeshView(long pContext, long nativeMeshView)
nResetClipRectback to summary
private static native void nResetClipRect(long context)
nSetAmbientLightback to summary
private static native void nSetAmbientLight(long pContext, long nativeMeshView, float r, float g, float b)
nSetCameraPositionback to summary
private static native void nSetCameraPosition(long pContext, double x, double y, double z)
nSetClipRectback to summary
private static native void nSetClipRect(long context, int x, int y, int width, int height)
nSetCompositeModeback to summary
private static native void nSetCompositeMode(long context, int mode)
nSetCullingModeback to summary
private static native void nSetCullingMode(long pContext, long nativeMeshView, int cullingMode)
nSetDiffuseColorback to summary
private static native void nSetDiffuseColor(long pContext, long nativePhongMaterial, float r, float g, float b, float a)
nSetLightback to summary
private static native void nSetLight(long pContext, long nativeMeshView, int index, float x, float y, float z, float r, float g, float b, float w, float ca, float la, float qa, float isAttenuated, float maxRange, float dirX, float dirY, float dirZ, float innerAngle, float outerAngle, float falloff)
nSetMapback to summary
private static native void nSetMap(long pContext, long nativePhongMaterial, int mapType, long texID)
nSetMaterialback to summary
private static native void nSetMaterial(long pContext, long nativeMeshView, long nativePhongMaterialInfo)
nSetProjViewMatrixback to summary
private static native void nSetProjViewMatrix(long pContext, boolean isOrtho, double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
nSetSpecularColorback to summary
private static native void nSetSpecularColor(long pContext, long nativePhongMaterial, boolean set, float r, float g, float b, float a)
nSetTransformback to summary
private static native void nSetTransform(long pContext, double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
nSetWireframeback to summary
private static native void nSetWireframe(long pContext, long nativeMeshView, boolean wireframe)
nSetWorldTransformback to summary
private static native void nSetWorldTransform(long pContext, double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33)
nSetWorldTransformToIdentityback to summary
private static native void nSetWorldTransformToIdentity(long pContext)
nUpdateRenderTargetback to summary
private static native int nUpdateRenderTarget(long context, long texPtr, boolean depthTest)
printRawMatrixback to summary
private void printRawMatrix(String mesg)
releaseMTLMeshback to summary
pack-priv void releaseMTLMesh(long nativeHandle)
releaseMTLMeshViewback to summary
pack-priv void releaseMTLMeshView(long nativeMeshView)
releaseMTLPhongMaterialback to summary
pack-priv void releaseMTLPhongMaterial(long nativeHandle)
renderMeshViewback to summary
pack-priv void renderMeshView(long nativeMeshView, Graphics g)
renderQuadsback to summary
protected void renderQuads(float[] coordArray, byte[] colorArray, int numVertices)

Implements abstract com.sun.prism.impl.BaseContext.renderQuads.

Annotations
@Override
setAmbientLightback to summary
pack-priv void setAmbientLight(long nativeMeshView, float r, float g, float b)
setCullingModeback to summary
pack-priv void setCullingMode(long nativeMeshView, int cullMode)
setDeviceParametersFor2Dback to summary
protected void setDeviceParametersFor2D()

Overrides com.sun.prism.impl.BaseContext.setDeviceParametersFor2D.

Annotations
@Override
setDeviceParametersFor3Dback to summary
protected void setDeviceParametersFor3D()

Overrides com.sun.prism.impl.BaseContext.setDeviceParametersFor3D.

Annotations
@Override
setDiffuseColorback to summary
pack-priv void setDiffuseColor(long nativePhongMaterial, float r, float g, float b, float a)
setLightback to summary
pack-priv void setLight(long nativeMeshView, int index, float x, float y, float z, float r, float g, float b, float w, float ca, float la, float qa, float isAttenuated, float maxRange, float dirX, float dirY, float dirZ, float innerAngle, float outerAngle, float falloff)
setMapback to summary
pack-priv void setMap(long nativePhongMaterial, int mapType, long nativeTexture)
setMaterialback to summary
pack-priv void setMaterial(long nativeMeshView, long nativePhongMaterial)
setRenderTargetTextureback to summary
public void setRenderTargetTexture(MTLRTTexture rtt)
setSpecularColorback to summary
pack-priv void setSpecularColor(long nativePhongMaterial, boolean set, float r, float g, float b, float a)
setTextureback to summary
protected void setTexture(int texUnit, Texture tex)

Overrides com.sun.prism.impl.ps.BaseShaderContext.setTexture.

Annotations
@Override
setWireframeback to summary
pack-priv void setWireframe(long nativeMeshView, boolean wireframe)
updateClipRectback to summary
protected void updateClipRect(Rectangle clipRect)

Implements abstract com.sun.prism.impl.ps.BaseShaderContext.updateClipRect.

Annotations
@Override
updateCompositeModeback to summary
protected void updateCompositeMode(CompositeMode mode)

Implements abstract com.sun.prism.impl.ps.BaseShaderContext.updateCompositeMode.

Annotations
@Override
updateRawMatrixback to summary
private void updateRawMatrix(GeneralTransform3D src)
updateRenderTargetback to summary
protected BaseShaderContext.State updateRenderTarget(RenderTarget target, NGCamera camera, boolean depthTest)

Implements abstract com.sun.prism.impl.ps.BaseShaderContext.updateRenderTarget.

Annotations
@Override
updateShaderTransformback to summary
protected void updateShaderTransform(Shader shader, BaseTransform xform)

Implements abstract com.sun.prism.impl.ps.BaseShaderContext.updateShaderTransform.

Annotations
@Override
updateTextureback to summary
protected void updateTexture(int texUnit, Texture tex)

Implements abstract com.sun.prism.impl.ps.BaseShaderContext.updateTexture.

Annotations
@Override
updateWorldTransformback to summary
protected void updateWorldTransform(BaseTransform xform)

Implements abstract com.sun.prism.impl.ps.BaseShaderContext.updateWorldTransform.

Annotations
@Override