Top Fields Constructors Methods
com.sun.prism.d3d

pack-priv Class D3DResourceFactory

extends BaseShaderFactory
Class Inheritance
Imports
java.io.BufferedInputStream, .IOException, .InputStream, java.lang.reflect.Method, java.nio.Buffer, .ByteBuffer, .FloatBuffer, .IntBuffer, java.util.LinkedList, .ListIterator, .Map, .WeakHashMap, com.sun.glass.ui.Screen, com.sun.prism.Image, .MediaFrame, .Mesh, .MeshView, .MultiTexture, .PhongMaterial, .PixelFormat, .Presentable, .PresentableState, .Texture, .Texture.Usage, .Texture.WrapMode, com.sun.prism.d3d.D3DResource.D3DRecord, com.sun.prism.impl.PrismSettings, .TextureResourcePool, com.sun.prism.impl.ps.BaseShaderFactory, com.sun.prism.ps.Shader, .ShaderFactory

Field Summary

Modifier and TypeField and Description
private static final Map<Image, Texture>
private final D3DContext
private D3DFrameStats
private final int
private static final Map<Image, Texture>
private int
private final LinkedList<D3DResource.D3DRecord>
records

List of disposer records for d3d resources created by the pipeline.

private static final Map<Image, Texture>
pack-priv static final int

Constructor Summary

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

Method Summary

Modifier and TypeMethod and Description
pack-priv void
private int
public Mesh
public MeshView
public PhongMaterial
public Presentable
public D3DRTTexture
public D3DRTTexture
createRTTexture(int width, int height, Texture.WrapMode wrapMode, boolean msaa)

Implements com.sun.prism.ResourceFactory.createRTTexture.

public Shader
createShader(String pixelShaderName, InputStream pixelShaderCode, Map<String, Integer> samplers, Map<String, Integer> params, int maxTexCoordIndex, boolean isPixcoordUsed, boolean isPerVertexColorUsed)

Implements com.sun.prism.ps.ShaderFactory.createShader.

public Shader
public D3DTexture
createTexture(PixelFormat
intended pixel format of the data to be stored in this texture
format
,
Texture.Usage
the Dynamic vs. Static nature of the texture data
usagehint
,
Texture.WrapMode
intended wrap mode to be used for the texture
wrapMode
,
int
width of the content in the texture
w
,
int
height of the content in the texture
h
)

Implements com.sun.prism.ResourceFactory.createTexture.

Returns a new Texture with the given format and edge wrapping support.

public D3DTexture
createTexture(PixelFormat
intended pixel format of the data to be stored in this texture
format
,
Texture.Usage
the Dynamic vs. Static nature of the texture data
usagehint
,
Texture.WrapMode
intended wrap mode to be used for the texture
wrapMode
,
int
width of the content in the texture
w
,
int
height of the content in the texture
h
,
boolean
the flag indicates should texture be created with mipmap
useMipmap
)

Implements com.sun.prism.ResourceFactory.createTexture.

Returns a new Texture with the given format and edge wrapping support.

public Texture
createTexture(MediaFrame
the video image that we need to create a new texture for
frame
)

Implements com.sun.prism.ResourceFactory.createTexture.

Returns a new Texture that can contain the video image as specified in the provided MediaFrame.

private void
public void
private static ByteBuffer
pack-priv D3DContext
public int
getMaximumTextureSize()

Implements com.sun.prism.ResourceFactory.getMaximumTextureSize.

Returns the maximum supported texture dimension for this device.

public int
public int
public TextureResourcePool<T>
public boolean
isCompatibleTexture(Texture
the texture to check.
tex
)

Implements com.sun.prism.ResourceFactory.isCompatibleTexture.

A Texture may have been obtained from a different resource factory.

public boolean
isDeviceReady()

Overrides com.sun.prism.impl.BaseResourceFactory.isDeviceReady.

Implements com.sun.prism.ResourceFactory.isDeviceReady.

Returns status of this graphics device, possibly reinitializing it.

public boolean
isFormatSupported(PixelFormat
the PixelFormat to test
format
)

Implements com.sun.prism.ResourceFactory.isFormatSupported.

Returns true if the given PixelFormat is supported; otherwise returns false.

pack-priv static native long
nCreateSwapChain(long pContext, long hwnd, boolean isVsyncEnabled)

pack-priv static native long
nCreateTexture(long pContext, int format, int hint, boolean isRTT, int width, int height, int samples, boolean useMipmap)

pack-priv static int
nextPowerOfTwo(int val, int max)

pack-priv static native long
nGetContext(int adapterOrdinal)

pack-priv static native long
nGetDevice(long pContext)

pack-priv static native int
nGetMaximumTextureSize(long pContext)

pack-priv static native long
nGetNativeTextureObject(long pResource)

pack-priv static native int
nGetTextureHeight(long pResource)

pack-priv static native int
nGetTextureWidth(long pResource)

pack-priv static native boolean
nIsDefaultPool(long pResource)

protected void
notifyReset()

Overrides com.sun.prism.impl.BaseResourceFactory.notifyReset.

Called when the factory is reset.

pack-priv static native int
nReadPixelsB(long pContext, long pResource, long length, Buffer pixels, byte[] arr, int contentWidth, int contentHeight)

pack-priv static native int
nReadPixelsI(long pContext, long pResource, long length, Buffer pixels, int[] arr, int contentWidth, int contentHeight)

pack-priv static native int
nReleaseResource(long pContext, long resource)

pack-priv static native int
nResetDevice(long pContext)

pack-priv static native int
nTestCooperativeLevel(long pContext)

pack-priv static native int
nUpdateTextureB(long contextHandle, long pResource, ByteBuffer buf, byte[] pixels, int formatHint, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan)

pack-priv static native int
nUpdateTextureF(long contextHandle, long pResource, FloatBuffer buf, float[] pixels, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan)

pack-priv static native int
nUpdateTextureI(long contextHandle, long pResource, IntBuffer buf, int[] pixels, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan)

pack-priv void
Inherited from com.sun.prism.impl.ps.BaseShaderFactory:
createArcRepcreateEllipseRepcreatePathRepcreateRoundRectRep

Field Detail

clampTexCacheback to summary
private static final Map<Image, Texture> clampTexCache

Hides com.sun.prism.impl.BaseResourceFactory.clampTexCache.

contextback to summary
private final D3DContext context
frameStatsback to summary
private D3DFrameStats frameStats
maxTextureSizeback to summary
private final int maxTextureSize
mipmapTexCacheback to summary
private static final Map<Image, Texture> mipmapTexCache

Hides com.sun.prism.impl.BaseResourceFactory.mipmapTexCache.

nFrameback to summary
private int nFrame
recordsback to summary
private final LinkedList<D3DResource.D3DRecord> records

List of disposer records for d3d resources created by the pipeline.

See Also
D3DResource
repeatTexCacheback to summary
private static final Map<Image, Texture> repeatTexCache

Hides com.sun.prism.impl.BaseResourceFactory.repeatTexCache.

STATS_FREQUENCYback to summary
pack-priv static final int STATS_FREQUENCY

Constructor Detail

D3DResourceFactoryback to summary
pack-priv D3DResourceFactory(long pContext, Screen screen)

Method Detail

addRecordback to summary
pack-priv void addRecord(D3DResource.D3DRecord record)
computeMaxTextureSizeback to summary
private int computeMaxTextureSize()
createMeshback to summary
public Mesh createMesh()

Implements com.sun.prism.ResourceFactory.createMesh.

Annotations
@Override
createMeshViewback to summary
public MeshView createMeshView(Mesh mesh)

Implements com.sun.prism.ResourceFactory.createMeshView.

Annotations
@Override
createPhongMaterialback to summary
public PhongMaterial createPhongMaterial()

Implements com.sun.prism.ResourceFactory.createPhongMaterial.

Annotations
@Override
createPresentableback to summary
public Presentable createPresentable(PresentableState pState)

Implements com.sun.prism.ResourceFactory.createPresentable.

Annotations
@Override
createRTTextureback to summary
public D3DRTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode)

Implements com.sun.prism.ResourceFactory.createRTTexture.

Annotations
@Override
createRTTextureback to summary
public D3DRTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode, boolean msaa)

Implements com.sun.prism.ResourceFactory.createRTTexture.

Annotations
@Override
createShaderback to summary
public Shader createShader(String pixelShaderName, InputStream pixelShaderCode, Map<String, Integer> samplers, Map<String, Integer> params, int maxTexCoordIndex, boolean isPixcoordUsed, boolean isPerVertexColorUsed)

Implements com.sun.prism.ps.ShaderFactory.createShader.

Annotations
@Override
createStockShaderback to summary
public Shader createStockShader(final String name)

Implements com.sun.prism.ps.ShaderFactory.createStockShader.

Annotations
@Override
createTextureback to summary
public D3DTexture createTexture(PixelFormat format, Texture.Usage usagehint, Texture.WrapMode wrapMode, int w, int h)

Implements com.sun.prism.ResourceFactory.createTexture.

Doc from com.sun.prism.ResourceFactory.createTexture.

Returns a new Texture with the given format and edge wrapping support. Note that the dimensions of the returned texture may be larger than those requested and the wrap mode may be a simulated version of the type requested.

Parameters
format:PixelFormat

intended pixel format of the data to be stored in this texture

usagehint:Texture.Usage

the Dynamic vs. Static nature of the texture data

wrapMode:Texture.WrapMode

intended wrap mode to be used for the texture

w:int

width of the content in the texture

h:int

height of the content in the texture

Returns:D3DTexture

texture most appropriate for the given intended format, wrap mode and dimensions

Annotations
@Override
createTextureback to summary
public D3DTexture createTexture(PixelFormat format, Texture.Usage usagehint, Texture.WrapMode wrapMode, int w, int h, boolean useMipmap)

Implements com.sun.prism.ResourceFactory.createTexture.

Doc from com.sun.prism.ResourceFactory.createTexture.

Returns a new Texture with the given format and edge wrapping support. Note that the dimensions of the returned texture may be larger than those requested and the wrap mode may be a simulated version of the type requested.

Parameters
format:PixelFormat

intended pixel format of the data to be stored in this texture

usagehint:Texture.Usage

the Dynamic vs. Static nature of the texture data

wrapMode:Texture.WrapMode

intended wrap mode to be used for the texture

w:int

width of the content in the texture

h:int

height of the content in the texture

useMipmap:boolean

the flag indicates should texture be created with mipmap

Returns:D3DTexture

texture most appropriate for the given intended format, wrap mode and dimensions

Annotations
@Override
createTextureback to summary
public Texture createTexture(MediaFrame frame)

Implements com.sun.prism.ResourceFactory.createTexture.

Doc from com.sun.prism.ResourceFactory.createTexture.

Returns a new Texture that can contain the video image as specified in the provided MediaFrame. Note that padding is almost implicit since this method has to accommodate the line strides of each plane. Also due to renderer limitations, some format conversion may be necessary so the texture format may end up being different from the video image format.

Parameters
frame:MediaFrame

the video image that we need to create a new texture for

Returns:Texture

texture most appropriate for the given video image.

Annotations
@Override
displayPrismStatisticsback to summary
private void displayPrismStatistics()
disposeback to summary
public void dispose()

Overrides com.sun.prism.impl.BaseResourceFactory.dispose.

Implements com.sun.prism.GraphicsResource.dispose.

Annotations
@Override
getBufferback to summary
private static ByteBuffer getBuffer(InputStream is)
getContextback to summary
pack-priv D3DContext getContext()
getMaximumTextureSizeback to summary
public int getMaximumTextureSize()

Implements com.sun.prism.ResourceFactory.getMaximumTextureSize.

Doc from com.sun.prism.ResourceFactory.getMaximumTextureSize.

Returns the maximum supported texture dimension for this device. For example, if this method returns 2048, it means that textures larger than 2048x2048 cannot be created.

Returns:int

the maximum supported texture dimension

Annotations
@Override
getRTTHeightback to summary
public int getRTTHeight(int h, Texture.WrapMode wrapMode)

Implements com.sun.prism.ResourceFactory.getRTTHeight.

Annotations
@Override
getRTTWidthback to summary
public int getRTTWidth(int w, Texture.WrapMode wrapMode)

Implements com.sun.prism.ResourceFactory.getRTTWidth.

Annotations
@Override
getTextureResourcePoolback to summary
public TextureResourcePool<T> getTextureResourcePool()

Implements com.sun.prism.ResourceFactory.getTextureResourcePool.

Annotations
@Override
isCompatibleTextureback to summary
public boolean isCompatibleTexture(Texture tex)

Implements com.sun.prism.ResourceFactory.isCompatibleTexture.

Doc from com.sun.prism.ResourceFactory.isCompatibleTexture.

A Texture may have been obtained from a different resource factory.

Parameters
tex:Texture

the texture to check.

Returns:boolean

whether this texture is compatible.

Annotations
@Override
isDeviceReadyback to summary
public boolean isDeviceReady()

Overrides com.sun.prism.impl.BaseResourceFactory.isDeviceReady.

Implements com.sun.prism.ResourceFactory.isDeviceReady.

Doc from com.sun.prism.ResourceFactory.isDeviceReady.

Returns status of this graphics device, possibly reinitializing it. If the device is not ready the createRTTexture and present operations will fail. As long as the device has not been disposed, creation of shaders and regular textures will succeed and return valid resources. All hardware resources (RenderTargets and SwapChains) have to be recreated after a device-lost event notification.

Note

since this method can reinitialize the graphics device if it has been released, it should only be called at the start of a rendering pass.

Returns:boolean

true if this graphics device is ready for use.

Annotations
@Override
isFormatSupportedback to summary
public boolean isFormatSupported(PixelFormat format)

Implements com.sun.prism.ResourceFactory.isFormatSupported.

Doc from com.sun.prism.ResourceFactory.isFormatSupported.

Returns true if the given PixelFormat is supported; otherwise returns false.

Note that the following formats are guaranteed to be supported across all devices:


    BYTE_RGB
    BYTE_RGBA_PRE
    BYTE_GRAY
    BYTE_ALPHA

Support for the other formats depends on the capabilities of the device. Be sure to call this method before attempting to create a Texture with a non-standard format and plan to have an alternate codepath if the given format is not supported.

Parameters
format:PixelFormat

the PixelFormat to test

Returns:boolean

true if the given format is supported; false otherwise

Annotations
@Override
nCreateSwapChainback to summary
pack-priv static native long nCreateSwapChain(long pContext, long hwnd, boolean isVsyncEnabled)
nCreateTextureback to summary
pack-priv static native long nCreateTexture(long pContext, int format, int hint, boolean isRTT, int width, int height, int samples, boolean useMipmap)
nextPowerOfTwoback to summary
pack-priv static int nextPowerOfTwo(int val, int max)
nGetContextback to summary
pack-priv static native long nGetContext(int adapterOrdinal)
nGetDeviceback to summary
pack-priv static native long nGetDevice(long pContext)
nGetMaximumTextureSizeback to summary
pack-priv static native int nGetMaximumTextureSize(long pContext)
nGetNativeTextureObjectback to summary
pack-priv static native long nGetNativeTextureObject(long pResource)
nGetTextureHeightback to summary
pack-priv static native int nGetTextureHeight(long pResource)
nGetTextureWidthback to summary
pack-priv static native int nGetTextureWidth(long pResource)
nIsDefaultPoolback to summary
pack-priv static native boolean nIsDefaultPool(long pResource)
notifyResetback to summary
protected void notifyReset()

Overrides com.sun.prism.impl.BaseResourceFactory.notifyReset.

Doc from com.sun.prism.impl.BaseResourceFactory.notifyReset.

Called when the factory is reset. Some resources (based in vram) could be lost.

Annotations
@Override
nReadPixelsBback to summary
pack-priv static native int nReadPixelsB(long pContext, long pResource, long length, Buffer pixels, byte[] arr, int contentWidth, int contentHeight)
nReadPixelsIback to summary
pack-priv static native int nReadPixelsI(long pContext, long pResource, long length, Buffer pixels, int[] arr, int contentWidth, int contentHeight)
nReleaseResourceback to summary
pack-priv static native int nReleaseResource(long pContext, long resource)
nResetDeviceback to summary
pack-priv static native int nResetDevice(long pContext)
nTestCooperativeLevelback to summary
pack-priv static native int nTestCooperativeLevel(long pContext)
nUpdateTextureBback to summary
pack-priv static native int nUpdateTextureB(long contextHandle, long pResource, ByteBuffer buf, byte[] pixels, int formatHint, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan)
nUpdateTextureFback to summary
pack-priv static native int nUpdateTextureF(long contextHandle, long pResource, FloatBuffer buf, float[] pixels, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan)
nUpdateTextureIback to summary
pack-priv static native int nUpdateTextureI(long contextHandle, long pResource, IntBuffer buf, int[] pixels, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan)
removeRecordback to summary
pack-priv void removeRecord(D3DResource.D3DRecord record)