Top Fields Constructors Methods
com.sun.prism.d3d

pack-priv Class D3DContext

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

Field Summary

Modifier and TypeField and Description
private Vec3d
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
private final D3DResourceFactory
private boolean
public static final int
private final long
private GeneralTransform3D
private static final Affine3D
private static GeneralTransform3D
private BaseShaderContext.State
private int
private int
private static double[]

Constructor Summary

AccessConstructor and Description
pack-priv
D3DContext(long pContext, Screen screen, D3DResourceFactory factory)

Method Summary

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

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

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)

pack-priv long
pack-priv long
createD3DMeshView(long nativeMesh)

pack-priv long
public void
dispose()

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

Dispose of this context.

public static boolean
FAILED(int hr)

WIN32 COM bool FAILED(HRESULT hr) macro synonym

pack-priv long
pack-priv D3DFrameStats
getFrameStats(boolean reset, D3DFrameStats result)

public D3DResourceFactory
public static String
hResultToString(long hResult)

protected void
pack-priv boolean

Returns:

true if lost, false otherwise
isLost
()

Returns whether the context is lost.

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 long
nCreateD3DMesh(long pContext)

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

private static native long
nCreateD3DPhongMaterial(long pContext)

private static native int
nDrawIndexedQuads(long pContext, float[] coords, byte[] colors, int numVertices)

private static native boolean
nGetFrameStats(long pContext, D3DFrameStats returnValue, boolean bReset)

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

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

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

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

private static native int
nResetClipRect(long pContext)

private static native int
nResetTransform(long pContext)

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

private static native int
nSetBlendEnabled(long pContext, int mode)

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

private static native int
nSetClipRect(long pContext, int x1, int y1, int x2, int y2)

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

private static native int
private static native int
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 int
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 int
nSetRenderTarget(long pContext, long pDest, boolean depthBuffer, boolean msaa)

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

private static native int
nSetTexture(long pContext, long pTex, int texUnit, boolean linear, int wrapMode)

private static native int
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
pack-priv void
releaseD3DMesh(long nativeHandle)

pack-priv void
releaseD3DMeshView(long nativeMeshView)

pack-priv void
releaseD3DPhongMaterial(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)

public 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)

private void
setLost()

set device to lost state

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

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

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

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

pack-priv boolean
testLostStateAndReset()

Validates the device, sets the context lost status if necessary, and tries to restore the context if needed.

protected void
protected void
protected BaseShaderContext.State
protected void
protected void
protected void
pack-priv static void
validate(int res)

Does D3D native return value validation for DEBUG interests

pack-priv boolean
validatePresent(int res)

Validates result of present operation, sets the context lost status if necessary

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
D3D_OKback to summary
public static final int D3D_OK
D3DCOMPMODE_ADDback to summary
public static final int D3DCOMPMODE_ADD
D3DCOMPMODE_CLEARback to summary
public static final int D3DCOMPMODE_CLEAR
D3DCOMPMODE_DSTOUTback to summary
public static final int D3DCOMPMODE_DSTOUT
D3DCOMPMODE_SRCback to summary
public static final int D3DCOMPMODE_SRC
D3DCOMPMODE_SRCOVERback to summary
public static final int D3DCOMPMODE_SRCOVER
D3DERR_DEVICEHUNGback to summary
public static final int D3DERR_DEVICEHUNG
D3DERR_DEVICELOSTback to summary
public static final int D3DERR_DEVICELOST
D3DERR_DEVICENOTRESETback to summary
public static final int D3DERR_DEVICENOTRESET
D3DERR_DEVICEREMOVEDback to summary
public static final int D3DERR_DEVICEREMOVED
D3DERR_OUTOFVIDEOMEMORYback to summary
public static final int D3DERR_OUTOFVIDEOMEMORY
D3DTADDRESS_BORDERback to summary
public static final int D3DTADDRESS_BORDER
D3DTADDRESS_CLAMPback to summary
public static final int D3DTADDRESS_CLAMP
D3DTADDRESS_MIRRORback to summary
public static final int D3DTADDRESS_MIRROR
D3DTADDRESS_NOPback to summary
public static final int D3DTADDRESS_NOP
D3DTADDRESS_WRAPback to summary
public static final int D3DTADDRESS_WRAP
E_FAILback to summary
public static final int E_FAIL
factoryback to summary
private final D3DResourceFactory factory

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

isLostback to summary
private boolean isLost
NUM_QUADSback to summary
public static final int NUM_QUADS
pContextback to summary
private final long pContext
projViewTxback to summary
private GeneralTransform3D projViewTx
scratchAffine3DTxback to summary
private static final Affine3D scratchAffine3DTx
scratchTxback to summary
private static GeneralTransform3D scratchTx
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

Constructor Detail

D3DContextback to summary
pack-priv D3DContext(long pContext, Screen screen, D3DResourceFactory factory)

Method Detail

adjustClipSpaceback to summary
private GeneralTransform3D adjustClipSpace(GeneralTransform3D projViewTx)

OpenGL projection transform use z-range of [-1, 1] while D3D expects it to be [0, 1], so we need to adjust the matrix, 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)
createD3DMeshback to summary
pack-priv long createD3DMesh()
createD3DMeshViewback to summary
pack-priv long createD3DMeshView(long nativeMesh)
createD3DPhongMaterialback to summary
pack-priv long createD3DPhongMaterial()
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
FAILEDback to summary
public static boolean FAILED(int hr)

WIN32 COM bool FAILED(HRESULT hr) macro synonym

getContextHandleback to summary
pack-priv long getContextHandle()
getFrameStatsback to summary
pack-priv D3DFrameStats getFrameStats(boolean reset, D3DFrameStats result)
getResourceFactoryback to summary
public D3DResourceFactory getResourceFactory()

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

Annotations
@Override
hResultToStringback to summary
public static String hResultToString(long hResult)
initStateback to summary
protected void initState()
isLostback to summary
pack-priv boolean isLost()

Returns whether the context is lost.

Returns:boolean

true if lost, false otherwise

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)
nCreateD3DMeshback to summary
private static native long nCreateD3DMesh(long pContext)
nCreateD3DMeshViewback to summary
private static native long nCreateD3DMeshView(long pContext, long nativeMesh)
nCreateD3DPhongMaterialback to summary
private static native long nCreateD3DPhongMaterial(long pContext)
nDrawIndexedQuadsback to summary
private static native int nDrawIndexedQuads(long pContext, float[] coords, byte[] colors, int numVertices)
nGetFrameStatsback to summary
private static native boolean nGetFrameStats(long pContext, D3DFrameStats returnValue, boolean bReset)
nReleaseD3DMeshback to summary
private static native void nReleaseD3DMesh(long pContext, long nativeHandle)
nReleaseD3DMeshViewback to summary
private static native void nReleaseD3DMeshView(long pContext, long nativeHandle)
nReleaseD3DPhongMaterialback to summary
private static native void nReleaseD3DPhongMaterial(long pContext, long nativeHandle)
nRenderMeshViewback to summary
private static native void nRenderMeshView(long pContext, long nativeMeshView)
nResetClipRectback to summary
private static native int nResetClipRect(long pContext)
nResetTransformback to summary
private static native int nResetTransform(long pContext)
nSetAmbientLightback to summary
private static native void nSetAmbientLight(long pContext, long nativeMeshView, float r, float g, float b)
nSetBlendEnabledback to summary
private static native int nSetBlendEnabled(long pContext, int mode)
nSetCameraPositionback to summary
private static native int nSetCameraPosition(long pContext, double x, double y, double z)
nSetClipRectback to summary
private static native int nSetClipRect(long pContext, int x1, int y1, int x2, int y2)
nSetCullingModeback to summary
private static native void nSetCullingMode(long pContext, long nativeMeshView, int cullingMode)
nSetDeviceParametersFor2Dback to summary
private static native int nSetDeviceParametersFor2D(long pContext)
nSetDeviceParametersFor3Dback to summary
private static native int nSetDeviceParametersFor3D(long pContext)
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 int 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)
nSetRenderTargetback to summary
private static native int nSetRenderTarget(long pContext, long pDest, boolean depthBuffer, boolean msaa)
nSetSpecularColorback to summary
private static native void nSetSpecularColor(long pContext, long nativePhongMaterial, boolean set, float r, float g, float b, float a)
nSetTextureback to summary
private static native int nSetTexture(long pContext, long pTex, int texUnit, boolean linear, int wrapMode)
nSetTransformback to summary
private static native int 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)
releaseD3DMeshback to summary
pack-priv void releaseD3DMesh(long nativeHandle)
releaseD3DMeshViewback to summary
pack-priv void releaseD3DMeshView(long nativeMeshView)
releaseD3DPhongMaterialback to summary
pack-priv void releaseD3DPhongMaterial(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
public 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)
setLostback to summary
private void setLost()

set device to lost state

setMapback to summary
pack-priv void setMap(long nativePhongMaterial, int mapType, long nativeTexture)
setMaterialback to summary
pack-priv void setMaterial(long nativeMeshView, long nativePhongMaterial)
setSpecularColorback to summary
pack-priv void setSpecularColor(long nativePhongMaterial, boolean set, float r, float g, float b, float a)
setWireframeback to summary
pack-priv void setWireframe(long nativeMeshView, boolean wireframe)
testLostStateAndResetback to summary
pack-priv boolean testLostStateAndReset()

Validates the device, sets the context lost status if necessary, and tries to restore the context if needed. If the device has been removed, then it reinitializes the device, which disposes the existing factories and contexts.

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
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
validateback to summary
pack-priv static void validate(int res)

Does D3D native return value validation for DEBUG interests

validatePresentback to summary
pack-priv boolean validatePresent(int res)

Validates result of present operation, sets the context lost status if necessary