class D3DResourceFactory extends BaseShaderFactory
Modifier and Type | Field and Description |
---|---|
private static java.util.Map<Image,Texture> |
clampTexCache |
private D3DContext |
context |
private D3DFrameStats |
frameStats |
private int |
maxTextureSize |
private static java.util.Map<Image,Texture> |
mipmapTexCache |
private int |
nFrame |
private java.util.LinkedList<D3DResource.D3DRecord> |
records
List of disposer records for d3d resources created by the pipeline.
|
private static java.util.Map<Image,Texture> |
repeatTexCache |
(package private) static int |
STATS_FREQUENCY |
Constructor and Description |
---|
D3DResourceFactory(long pContext,
Screen screen) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addRecord(D3DResource.D3DRecord record) |
private int |
computeMaxTextureSize() |
Mesh |
createMesh() |
MeshView |
createMeshView(Mesh mesh) |
PhongMaterial |
createPhongMaterial() |
Presentable |
createPresentable(PresentableState pState) |
D3DRTTexture |
createRTTexture(int width,
int height,
Texture.WrapMode wrapMode) |
D3DRTTexture |
createRTTexture(int width,
int height,
Texture.WrapMode wrapMode,
boolean msaa) |
Shader |
createShader(java.io.InputStream pixelShaderCode,
java.util.Map<java.lang.String,java.lang.Integer> samplers,
java.util.Map<java.lang.String,java.lang.Integer> params,
int maxTexCoordIndex,
boolean isPixcoordUsed,
boolean isPerVertexColorUsed) |
Shader |
createStockShader(java.lang.String name) |
Texture |
createTexture(MediaFrame frame)
Returns a new
Texture that can contain the video image as specified
in the provided MediaFrame . |
D3DTexture |
createTexture(PixelFormat format,
Texture.Usage usagehint,
Texture.WrapMode wrapMode,
int w,
int h)
Returns a new
Texture with the given format and edge wrapping
support. |
D3DTexture |
createTexture(PixelFormat format,
Texture.Usage usagehint,
Texture.WrapMode wrapMode,
int w,
int h,
boolean useMipmap)
Returns a new
Texture with the given format and edge wrapping
support. |
private void |
displayPrismStatistics() |
void |
dispose() |
private static java.nio.ByteBuffer |
getBuffer(java.io.InputStream is) |
(package private) D3DContext |
getContext() |
int |
getMaximumTextureSize()
Returns the maximum supported texture dimension for this device.
|
int |
getRTTHeight(int h,
Texture.WrapMode wrapMode) |
int |
getRTTWidth(int w,
Texture.WrapMode wrapMode) |
TextureResourcePool |
getTextureResourcePool() |
boolean |
isCompatibleTexture(Texture tex)
A Texture may have been obtained from a different resource factory.
|
boolean |
isDeviceReady()
Returns status of this graphics device.
|
boolean |
isFormatSupported(PixelFormat format)
Returns true if the given
PixelFormat is supported; otherwise
returns false. |
(package private) static long |
nCreateSwapChain(long pContext,
long hwnd,
boolean isVsyncEnabled) |
(package private) static long |
nCreateTexture(long pContext,
int format,
int hint,
boolean isRTT,
int width,
int height,
int samples,
boolean useMipmap) |
(package private) static int |
nextPowerOfTwo(int val,
int max) |
(package private) static long |
nGetContext(int adapterOrdinal) |
(package private) static long |
nGetDevice(long pContext) |
(package private) static int |
nGetMaximumTextureSize(long pContext) |
(package private) static long |
nGetNativeTextureObject(long pResource) |
(package private) static int |
nGetTextureHeight(long pResource) |
(package private) static int |
nGetTextureWidth(long pResource) |
(package private) static boolean |
nIsDefaultPool(long pResource) |
protected void |
notifyReleased()
Called when the factory's data is released
|
protected void |
notifyReset()
Called when the factory is reset.
|
(package private) static int |
nReadPixelsB(long pContext,
long pResource,
long length,
java.nio.Buffer pixels,
byte[] arr,
int contentWidth,
int contentHeight) |
(package private) static int |
nReadPixelsI(long pContext,
long pResource,
long length,
java.nio.Buffer pixels,
int[] arr,
int contentWidth,
int contentHeight) |
(package private) static int |
nReleaseResource(long pContext,
long resource) |
(package private) static int |
nResetDevice(long pContext) |
(package private) static int |
nTestCooperativeLevel(long pContext) |
(package private) static int |
nUpdateTextureB(long contextHandle,
long pResource,
java.nio.ByteBuffer buf,
byte[] pixels,
int formatHint,
int dstx,
int dsty,
int srcx,
int srcy,
int srcw,
int srch,
int srcscan) |
(package private) static int |
nUpdateTextureF(long contextHandle,
long pResource,
java.nio.FloatBuffer buf,
float[] pixels,
int dstx,
int dsty,
int srcx,
int srcy,
int srcw,
int srch,
int srcscan) |
(package private) static int |
nUpdateTextureI(long contextHandle,
long pResource,
java.nio.IntBuffer buf,
int[] pixels,
int dstx,
int dsty,
int srcx,
int srcy,
int srcw,
int srch,
int srcscan) |
(package private) void |
removeRecord(D3DResource.D3DRecord record) |
createArcRep, createEllipseRep, createPathRep, createRoundRectRep
addFactoryListener, canClampToEdge, canClampToZero, canRepeat, clearTextureCache, clearTextureCache, createFloatTexture, createMaskTexture, createTexture, createTexture, getCachedTexture, getCachedTexture, getFactoryListeners, getGlyphTexture, getRegionTexture, isSuperShaderAllowed, isWrapModeSupported, removeFactoryListener, setGlyphTexture, setRegionTexture
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addFactoryListener, createFloatTexture, createMaskTexture, createTexture, createTexture, getCachedTexture, getCachedTexture, getGlyphTexture, getRegionTexture, isSuperShaderAllowed, isWrapModeSupported, removeFactoryListener, setGlyphTexture, setRegionTexture
private final D3DContext context
private final int maxTextureSize
private final java.util.LinkedList<D3DResource.D3DRecord> records
D3DResource
static final int STATS_FREQUENCY
private int nFrame
private D3DFrameStats frameStats
D3DResourceFactory(long pContext, Screen screen)
D3DContext getContext()
public TextureResourcePool getTextureResourcePool()
private void displayPrismStatistics()
public boolean isDeviceReady()
ResourceFactory
isDeviceReady
in interface ResourceFactory
isDeviceReady
in class BaseResourceFactory
static int nextPowerOfTwo(int val, int max)
public boolean isCompatibleTexture(Texture tex)
ResourceFactory
tex
- the texture to check.public D3DTexture createTexture(PixelFormat format, Texture.Usage usagehint, Texture.WrapMode wrapMode, int w, int h)
ResourceFactory
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.format
- intended pixel format of the data to be stored
in this textureusagehint
- the Dynamic vs. Static nature of the texture datawrapMode
- intended wrap mode to be used for the texturew
- width of the content in the textureh
- height of the content in the texturepublic D3DTexture createTexture(PixelFormat format, Texture.Usage usagehint, Texture.WrapMode wrapMode, int w, int h, boolean useMipmap)
ResourceFactory
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.format
- intended pixel format of the data to be stored
in this textureusagehint
- the Dynamic vs. Static nature of the texture datawrapMode
- intended wrap mode to be used for the texturew
- width of the content in the textureh
- height of the content in the textureuseMipmap
- the flag indicates should texture be created with mipmappublic Texture createTexture(MediaFrame frame)
ResourceFactory
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.frame
- the video image that we need to create a new texture forpublic int getRTTWidth(int w, Texture.WrapMode wrapMode)
public int getRTTHeight(int h, Texture.WrapMode wrapMode)
public D3DRTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode)
public D3DRTTexture createRTTexture(int width, int height, Texture.WrapMode wrapMode, boolean msaa)
public Presentable createPresentable(PresentableState pState)
private static java.nio.ByteBuffer getBuffer(java.io.InputStream is)
public Shader createShader(java.io.InputStream pixelShaderCode, java.util.Map<java.lang.String,java.lang.Integer> samplers, java.util.Map<java.lang.String,java.lang.Integer> params, int maxTexCoordIndex, boolean isPixcoordUsed, boolean isPerVertexColorUsed)
public Shader createStockShader(java.lang.String name)
public void dispose()
public boolean isFormatSupported(PixelFormat format)
ResourceFactory
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.
format
- the PixelFormat
to testprivate int computeMaxTextureSize()
public int getMaximumTextureSize()
ResourceFactory
protected void notifyReset()
BaseResourceFactory
notifyReset
in class BaseResourceFactory
protected void notifyReleased()
BaseResourceFactory
notifyReleased
in class BaseResourceFactory
void addRecord(D3DResource.D3DRecord record)
void removeRecord(D3DResource.D3DRecord record)
public PhongMaterial createPhongMaterial()
public Mesh createMesh()
static long nGetContext(int adapterOrdinal)
static boolean nIsDefaultPool(long pResource)
static int nTestCooperativeLevel(long pContext)
static int nResetDevice(long pContext)
static long nCreateTexture(long pContext, int format, int hint, boolean isRTT, int width, int height, int samples, boolean useMipmap)
static long nCreateSwapChain(long pContext, long hwnd, boolean isVsyncEnabled)
static int nReleaseResource(long pContext, long resource)
static int nGetMaximumTextureSize(long pContext)
static int nGetTextureWidth(long pResource)
static int nGetTextureHeight(long pResource)
static int nReadPixelsI(long pContext, long pResource, long length, java.nio.Buffer pixels, int[] arr, int contentWidth, int contentHeight)
static int nReadPixelsB(long pContext, long pResource, long length, java.nio.Buffer pixels, byte[] arr, int contentWidth, int contentHeight)
static int nUpdateTextureI(long contextHandle, long pResource, java.nio.IntBuffer buf, int[] pixels, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan)
static int nUpdateTextureF(long contextHandle, long pResource, java.nio.FloatBuffer buf, float[] pixels, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan)
static int nUpdateTextureB(long contextHandle, long pResource, java.nio.ByteBuffer buf, byte[] pixels, int formatHint, int dstx, int dsty, int srcx, int srcy, int srcw, int srch, int srcscan)
static long nGetDevice(long pContext)
static long nGetNativeTextureObject(long pResource)