aboutsummaryrefslogtreecommitdiff
path: root/src/windows/native/sun/java2d/d3d/D3DContext.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/windows/native/sun/java2d/d3d/D3DContext.h')
-rw-r--r--src/windows/native/sun/java2d/d3d/D3DContext.h580
1 files changed, 278 insertions, 302 deletions
diff --git a/src/windows/native/sun/java2d/d3d/D3DContext.h b/src/windows/native/sun/java2d/d3d/D3DContext.h
index c4313c101..2dba0918e 100644
--- a/src/windows/native/sun/java2d/d3d/D3DContext.h
+++ b/src/windows/native/sun/java2d/d3d/D3DContext.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,14 +27,33 @@
#define D3DCONTEXT_H
#include "java_awt_Transparency.h"
+#include "sun_java2d_pipe_BufferedContext.h"
#include "sun_java2d_d3d_D3DContext.h"
-#include "ddrawObject.h"
-extern "C" {
-#include "glyphblitting.h"
-#include "AccelGlyphCache.h"
-}
+#include "sun_java2d_d3d_D3DContext_D3DContextCaps.h"
+#include "sun_java2d_d3d_D3DSurfaceData.h"
+#include "sun_java2d_pipe_hw_AccelDeviceEventNotifier.h"
+
+#include "ShaderList.h"
+#include "D3DPipeline.h"
+#include "D3DMaskCache.h"
+#include "D3DVertexCacher.h"
+#include "D3DResourceManager.h"
+
#include "j2d_md.h"
+typedef enum {
+ TILEFMT_UNKNOWN,
+ TILEFMT_1BYTE_ALPHA,
+ TILEFMT_3BYTE_RGB,
+ TILEFMT_3BYTE_BGR,
+ TILEFMT_4BYTE_ARGB_PRE,
+} TileFormat;
+
+typedef enum {
+ CLIP_NONE,
+ CLIP_RECT,
+ CLIP_SHAPE,
+} ClipType;
// - State switching optimizations -----------------------------------
@@ -52,58 +71,28 @@ extern "C" {
* See D3DContext::UpdateState() and D3DContext::BeginScene() for
* more information.
*/
-
-// The state is undefined, assume that complete initialization is
-// needed.
-#define STATE_UNDEFINED (0 << 0)
-// Current state uses texture mapping
-#define STATE_TEXTURE (1 << 0)
-// Texture stage state which is used when mask is involved
-// (text rendering, maskfill)
-#define STATE_TEXTURE_STAGE_MASK (1 << 1)
-// Texture stage state which is used when doing texture
-// mapping in blits
-#define STATE_TEXTURE_STAGE_BLIT (1 << 2)
-// Texture stage state which is used when not doing
-// texture mapping, only use diffuse color
-#define STATE_TEXTURE_STAGE_POLY (1 << 3)
-// Texture mapping operation which involves mask texture
-#define STATE_MASKOP (STATE_TEXTURE|STATE_TEXTURE_STAGE_MASK)
-// Texture mapping operation which involves image texture
-#define STATE_BLITOP (STATE_TEXTURE|STATE_TEXTURE_STAGE_BLIT)
-// Rendering operation which doesn't use texture mapping
-#define STATE_RENDEROP (STATE_TEXTURE_STAGE_POLY)
+#define STATE_CHANGE (0 << 0)
+#define STATE_RENDEROP (1 << 0)
+#define STATE_MASKOP (1 << 1)
+#define STATE_GLYPHOP (1 << 2)
+#define STATE_TEXTUREOP (1 << 3)
+#define STATE_AAPGRAMOP (1 << 4)
+#define STATE_OTHEROP (1 << 5)
// The max. stage number we currently use (could not be
// larger than 7)
-#define MAX_USED_TEXTURE_STAGE 0
+#define MAX_USED_TEXTURE_SAMPLER 1
// - Texture pixel format table -------------------------------------
#define TR_OPAQUE java_awt_Transparency_OPAQUE
#define TR_BITMASK java_awt_Transparency_BITMASK
#define TR_TRANSLUCENT java_awt_Transparency_TRANSLUCENT
-// depth indices for the D3DTextureTable type
-#define DEPTH16_IDX 0
-#define DEPTH24_IDX 1
-#define DEPTH32_IDX 2
-#define DEPTH_MAX_IDX 3
-
-// corresponding transparency indices for the D3DTextureTable type
-#define TR_OPAQUE_IDX 0
-#define TR_BITMASK_IDX 1
-#define TR_TRANSLUCENT_IDX 2
-#define TR_MAX_IDX 3
-
-typedef struct
-{
- DDPIXELFORMAT pddpf;
- jint pfType;
-} D3DTextureTableCell;
-
-// texture table:
-// [transparency={OPAQUE,BITMASK,TRANCLUCENT},depth={16,24,32}]
-typedef D3DTextureTableCell D3DTextureTable[TR_MAX_IDX][DEPTH_MAX_IDX];
+class D3DResource;
+class D3DResourceManager;
+class D3DMaskCache;
+class D3DVertexCacher;
+class D3DGlyphCache;
// - D3DContext class -----------------------------------------------
@@ -111,7 +100,7 @@ typedef D3DTextureTableCell D3DTextureTable[TR_MAX_IDX][DEPTH_MAX_IDX];
* This class provides the following functionality:
* - holds the state of D3DContext java class (current pixel color,
* alpha compositing mode, extra alpha)
- * - provides access to IDirect3DDevice7 interface (creation,
+ * - provides access to IDirect3DDevice9 interface (creation,
* disposal, exclusive access)
* - handles state changes of the direct3d device (transform,
* compositing mode, current texture)
@@ -119,15 +108,9 @@ typedef D3DTextureTableCell D3DTextureTable[TR_MAX_IDX][DEPTH_MAX_IDX];
* - holds a glyph cache texture for the associated device
* - implements primitives batching mechanism
*/
-class D3DContext {
+class D3DPIPELINE_API D3DContext {
public:
/**
- * Creates and returns D3DContext instance. If created context was
- * unable to initialize d3d device or if the device tests failed,
- * returns NULL.
- */
- static D3DContext* CreateD3DContext(DDraw *ddObject, DXObject* dxObject);
- /**
* Releases the old device (if there was one) and all associated
* resources, re-creates, initializes and tests the new device.
*
@@ -141,140 +124,153 @@ public:
* to initialize and test the device last time, it doesn't attempt
* to create/init/test the device.
*/
- void CreateD3DDevice();
- void Release3DDevice();
+ static
+ HRESULT CreateInstance(IDirect3D9 *pd3d9, UINT adapter, D3DContext **ppCtx);
+ // creates a new D3D windowed device with swap copy effect and default
+ // present interval
+ HRESULT InitContext();
+ // creates or resets a D3D device given the parameters
+ HRESULT ConfigureContext(D3DPRESENT_PARAMETERS *pNewParams);
+ // resets existing D3D device with the current presentation parameters
+ HRESULT ResetContext();
+ HRESULT CheckAndResetDevice();
+
+ // saves the state of the D3D device in a state block, resets
+ // context's state to STATE_CHANGE
+ HRESULT SaveState();
+ // restores the state of the D3D device from existing state block,
+ // resets context's state to STATE_CHANGE
+ HRESULT RestoreState();
+
+ void ReleaseContextResources();
+ void ReleaseDefPoolResources();
virtual ~D3DContext();
+ // methods replicating java-level D3DContext objext
+ HRESULT SetAlphaComposite(jint rule, jfloat extraAlpha, jint flags);
+ HRESULT ResetComposite();
+
/**
- * Stores a weak reference of passed D3DContext object.
- * This method is called from _getNativeDeviceCaps method, and does the
- * association of the native D3DContext with the corresponding java object.
- * We need a reference to the java object so it can be notified when
- * the native context is released or recreated.
- *
- * See jobject jD3DContext field
+ * Glyph cache-related methods
*/
- void SetJavaContext(JNIEnv *env, jobject jd3dc);
+ HRESULT InitGrayscaleGlyphCache();
+ HRESULT InitLCDGlyphCache();
+ D3DGlyphCache* GetGrayscaleGlyphCache() { return pGrayscaleGlyphCache; }
+ D3DGlyphCache* GetLCDGlyphCache() { return pLCDGlyphCache; }
+
+ D3DResourceManager *GetResourceManager() { return pResourceMgr; }
+ D3DMaskCache *GetMaskCache() { return pMaskCache; }
+
+ HRESULT UploadTileToTexture(D3DResource *pTextureRes, void *pixels,
+ jint dstx, jint dsty,
+ jint srcx, jint srcy,
+ jint srcWidth, jint srcHeight,
+ jint srcStride,
+ TileFormat srcFormat,
+ // out: num of pixels in first and last
+ // columns, only counted for LCD glyph uploads
+ jint *pPixelsTouchedL = NULL,
+ jint *pPixelsTouchedR = NULL);
+
+ // returns capabilities of the Direct3D device
+ D3DCAPS9 *GetDeviceCaps() { return &devCaps; }
+ // returns caps in terms of the D3DContext
+ int GetContextCaps() { return contextCaps; }
+ D3DPRESENT_PARAMETERS *GetPresentationParams() { return &curParams; }
+
+ IDirect3DDevice9 *Get3DDevice() { return pd3dDevice; }
+ IDirect3D9 *Get3DObject() { return pd3dObject; }
/**
- * Methods to get/release exclusive access to the direct3d device
- * interface. Note that some methods of this class assume that the
- * lock is already taken. They're marked with 'NOLOCK' comment.
- * Those methods not dealing with the d3d device interface are not
- * required to obtain the lock (and not marked with NOLOCK)
+ * This method only sets the texture if it's not already set.
*/
- void GetExclusiveAccess() { CRITICAL_SECTION_ENTER(deviceLock);}
- void ReleaseExclusiveAccess() { CRITICAL_SECTION_LEAVE(deviceLock);}
-
- // methods replicating java-level D3DContext objext
- void SetColor(jint eargb, jint flags);
- void SetAlphaComposite(jint rule, jfloat extraAlpha, jint flags);
- void ResetComposite();
-
- // Glyph cache-related methods
- HRESULT /*NOLOCK*/ InitGlyphCache();
- HRESULT /*NOLOCK*/ GlyphCacheAdd(JNIEnv *env, GlyphInfo *glyph);
- HRESULT /*NOLOCK*/ UploadImageToTexture(DXSurface *texture, jubyte *pixels,
- jint dstx, jint dsty,
- jint srcx, jint srcy,
- jint srcWidth, jint srcHeight,
- jint srcStride);
- DXSurface /*NOLOCK*/ *GetGlyphCacheTexture() { return lpGlyphCacheTexture; }
- DXSurface /*NOLOCK*/ *GetMaskTexture();
- GlyphCacheInfo *GetGlyphCache() { return glyphCache; }
-
- HRESULT CreateSurface(JNIEnv *env,
- jint width, jint height, jint depth,
- jint transparency, jint d3dSurfaceType,
- DXSurface** dxSurface, jint* pType);
+ HRESULT SetTexture(IDirect3DTexture9 *pTexture, DWORD dwSampler = 0);
/**
- * Attaches a depth buffer to the specified dxSurface.
- * If depthBufferFormat is not initialized (depthBufferFormat.dwSize == 0),
- * it will be initialized at the time of the call.
- *
- * If the buffer for this surface already exists, a "lost" status of the
- * depth buffer is returned.
+ * This method only updates the texture color state if it hasn't changed.
*/
- HRESULT AttachDepthBuffer(DXSurface *dxSurface);
-
- // methods for dealing with device capabilities as determined by
- // methods in D3DRuntimeTest
- int GetDeviceCaps() { return deviceCaps; }
- void SetDeviceCaps(int caps) { deviceCaps = caps; }
+ HRESULT UpdateTextureColorState(DWORD dwState, DWORD dwSampler = 0);
- // Returns the texture pixel format table
- D3DTextureTable &GetTextureTable() { return textureTable; }
-
- DDrawSurface *GetTargetSurface() { return ddTargetSurface; }
- IDirect3DDevice7 *Get3DDevice() { return d3dDevice; }
+ HRESULT SetRenderTarget(IDirect3DSurface9 *pSurface);
+ HRESULT SetTransform(jdouble m00, jdouble m10,
+ jdouble m01, jdouble m11,
+ jdouble m02, jdouble m12);
+ HRESULT ResetTransform();
- // IDirect3DDevice7-delegation methods
+ // clipping-related methods
+ HRESULT SetRectClip(int x1, int y1, int x2, int y2);
+ HRESULT BeginShapeClip();
+ HRESULT EndShapeClip();
+ HRESULT ResetClip();
+ ClipType GetClipType();
/**
- * This method only sets the texture if it's not already set.
+ * Shader-related methods
*/
- HRESULT /*NOLOCK*/ SetTexture(DXSurface *dxSurface, DWORD dwStage = 0);
- HRESULT SetRenderTarget(DDrawSurface *lpSurface);
- HRESULT SetTransform(jobject xform,
- jdouble m00, jdouble m10,
- jdouble m01, jdouble m11,
- jdouble m02, jdouble m12);
- HRESULT SetClip(JNIEnv *env, jobject clip,
- jboolean isRect,
- int x1, int y1, int x2, int y2);
-
- DWORD GetMinTextureWidth() { return d3dDevDesc.dwMinTextureWidth; }
- DWORD GetMinTextureHeight() { return d3dDevDesc.dwMinTextureHeight; }
- DWORD GetMaxTextureWidth() { return d3dDevDesc.dwMaxTextureWidth; }
- DWORD GetMaxTextureHeight() { return d3dDevDesc.dwMaxTextureHeight; }
- DWORD GetMaxTextureAspectRatio()
- { return d3dDevDesc.dwMaxTextureAspectRatio; };
+ HRESULT EnableBasicGradientProgram(jint flags);
+ HRESULT EnableLinearGradientProgram(jint flags);
+ HRESULT EnableRadialGradientProgram(jint flags);
+ HRESULT EnableConvolveProgram(jint flags);
+ HRESULT EnableRescaleProgram(jint flags);
+ HRESULT EnableLookupProgram(jint flags);
+ HRESULT EnableLCDTextProgram();
+ HRESULT EnableAAParallelogramProgram();
+ HRESULT DisableAAParallelogramProgram();
+
+ BOOL IsTextureFilteringSupported(D3DTEXTUREFILTERTYPE fType);
+ BOOL IsStretchRectFilteringSupported(D3DTEXTUREFILTERTYPE fType);
BOOL IsPow2TexturesOnly()
- { return d3dDevDesc.dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2; };
+ { return devCaps.TextureCaps & D3DPTEXTURECAPS_POW2; };
BOOL IsSquareTexturesOnly()
- { return d3dDevDesc.dpcTriCaps.dwTextureCaps &
- D3DPTEXTURECAPS_SQUAREONLY; }
-
- /**
- * This method invalidates the java-level D3DContext object if
- * the passed DDrawSurface is the current render target.
- * The invalidation needs to be done so that the D3DContext object
- * resets itself in case the native d3d device has been recreated, or
- * the target surface has been lost (in which case this method is called
- * from D3DSD_RestoreSurface function, see D3DSD_RestoreSurface for
- * more info).
- */
- void InvalidateIfTarget(JNIEnv *env, DDrawSurface *lpSurface);
+ { return devCaps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY; }
+ BOOL IsHWRasterizer() { return bIsHWRasterizer; }
+ BOOL IsTextureFormatSupported(D3DFORMAT format, DWORD usage = 0);
+ BOOL IsDynamicTextureSupported()
+ { return devCaps.Caps2 & D3DCAPS2_DYNAMICTEXTURES; }
+// REMIND: for now for performance testing
+// { return (getenv("J2D_D3D_USE_DYNAMIC_TEX") != NULL); }
+ BOOL IsImmediateIntervalSupported()
+ { return devCaps.PresentationIntervals & D3DPRESENT_INTERVAL_IMMEDIATE;}
+ BOOL IsPixelShader20Supported()
+ { return (devCaps.PixelShaderVersion >= D3DPS_VERSION(2,0)); }
+ BOOL IsGradientInstructionExtensionSupported()
+ { return devCaps.PS20Caps.Caps & D3DPS20CAPS_GRADIENTINSTRUCTIONS; }
+ BOOL IsPixelShader30Supported()
+ { return (devCaps.PixelShaderVersion >= D3DPS_VERSION(3,0)); }
+ BOOL IsMultiTexturingSupported()
+ { return (devCaps.MaxSimultaneousTextures > 1); }
+ BOOL IsAlphaRTSurfaceSupported();
+ BOOL IsAlphaRTTSupported();
+ BOOL IsOpaqueRTTSupported();
+
+ jint GetPaintState() { return paintState; }
+ void SetPaintState(jint state) { this->paintState = state; }
+ BOOL IsIdentityTx() { return bIsIdentityTx; }
+
+ HRESULT FlushVertexQueue();
+ D3DVertexCacher *pVCacher;
+ HRESULT UpdateState(jbyte newState);
+
+ HRESULT Sync();
// primitives batching-related methods
/**
* Calls devices's BeginScene if there weren't one already pending,
* sets the pending flag.
*/
- HRESULT /*NOLOCK*/ BeginScene(jbyte newState);
+ HRESULT BeginScene(jbyte newState);
/**
- * Only calls device's EndScene if ddResult is an error.
+ * Flushes the vertex queue and does end scene if
+ * a BeginScene is pending
*/
- HRESULT /*NOLOCK*/ EndScene(HRESULT ddResult);
- /**
- * forces the end of batching by calling EndScene if
- * there was BeginScene pending.
- */
- HRESULT /*NOLOCK*/ ForceEndScene();
+ HRESULT EndScene();
+
/**
- * flushes the queue if the argument is this device's render target
+ * Fields that track native-specific state.
*/
- void FlushD3DQueueForTarget(DDrawSurface *ddSurface);
-
- // fields replicating D3DContext class' fields
- jint compState;
+ jint paintState;
+ jboolean useMask;
jfloat extraAlpha;
- jint colorPixel;
-
- // pixel for vertices used in blits via texture mapping,
- // set in SetAlphaComposite()
- jint blitPolygonPixel;
/**
* Current operation state.
@@ -283,164 +279,144 @@ public:
jbyte opState;
private:
- D3DContext(DDraw *ddObject, DXObject* dxObject);
- HRESULT InitD3DDevice(IDirect3DDevice7 *d3dDevice);
+
/**
- * This method releases an old device, creates a new one,
- * runs d3d caps tests on it and sets the device caps according
- * to the results.
+ * Glyph cache-related methods/fields...
*/
- HRESULT /*NOLOCK*/ CreateAndTestD3DDevice(DxCapabilities *dxCaps);
- HRESULT /*NOLOCK*/ InitMaskTileTexture();
- void /*NOLOCK*/ UpdateState(jbyte newState);
-
- IDirect3DDevice7 *d3dDevice;
- IDirect3D7 *d3dObject;
- DDraw *ddObject;
- DXObject *dxObject;
- const GUID *pDeviceGUID;
- DDrawSurface *ddTargetSurface;
- DXSurface *lpMaskTexture;
- DXSurface *lpGlyphCacheTexture;
- D3DTextureTable textureTable;
- DDPIXELFORMAT depthBufferFormat;
- DDPIXELFORMAT maskTileTexFormat;
- GlyphCacheInfo *glyphCache;
- BOOL glyphCacheAvailable;
- // array of the textures currently set to the device
- IDirectDrawSurface7 *lastTexture[MAX_USED_TEXTURE_STAGE+1];
+ D3DGlyphCache *pGrayscaleGlyphCache;
+ D3DGlyphCache *pLCDGlyphCache;
/**
- * A weak reference to the java-level D3DContext object.
- * Used to invalidate the java D3DContext object if the device has been
- * recreated.
- * See SetJavaContext() method.
+ * The handle to the LCD text pixel shader program.
*/
- jobject jD3DContext;
-
- D3DDEVICEDESC7 d3dDevDesc;
- int deviceCaps;
- BOOL bIsHWRasterizer;
+ IDirect3DPixelShader9 *lcdTextProgram;
/**
- * Used to implement simple primitive batching.
- * See BeginScene/EndScene/ForceEndScene.
+ * The handle to the AA pixel and vertex shader programs.
*/
- BOOL bBeginScenePending;
-#ifdef DEBUG
- int endSceneQueueDepth;
-#endif /* DEBUG */
-
- CriticalSection deviceLock;
-};
-
-// - Various vertex formats -------------------------------------------
-
-#define D3DFVF_J2DLVERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1)
-typedef struct _J2DLVERTEX {
- float x, y, z;
- DWORD color;
- float tu, tv;
-} J2DLVERTEX;
-
-/**
- * We're still debating whether to use a single vertex format
- * for all primitives or specific per-primitive formats.
- * Using different vertex formats reduces the amount of
- * data being sent to the video board, and this shows
- * benetits when running Java2D benchmarks.
- *
- * However, in a typical Swing application the number
- * of primitives of the same type rendered in a row is
- * relatively small, which means that the driver has
- * to spend more time state switching to account for different
- * vertex formats (and according to MSDN, switching vertex format
- * is a very expensive operation). So for this kind of application
- * it's better to stick with a single vertex format.
- */
-#define USE_SINGLE_VERTEX_FORMAT
-
-#ifndef USE_SINGLE_VERTEX_FORMAT
+ IDirect3DPixelShader9 *aaPgramProgram;
+
+ IDirect3DPixelShader9 *CreateFragmentProgram(DWORD **shaders,
+ ShaderList *programs,
+ jint flags);
+ HRESULT EnableFragmentProgram(DWORD **shaders,
+ ShaderList *programList,
+ jint flags);
+
+ // finds appropriate to the target surface depth format,
+ // creates the depth buffer and installs it onto the device
+ HRESULT InitDepthStencilBuffer(D3DSURFACE_DESC *pTargetDesc);
+ // returns true if the current depth buffer is compatible
+ // with the new target, and the dimensions fit, false otherwise
+ BOOL IsDepthStencilBufferOk(D3DSURFACE_DESC *pTargetDesc);
+
+ D3DContext(IDirect3D9 *pd3dObject, UINT adapter);
+ HRESULT InitDevice(IDirect3DDevice9 *d3dDevice);
+ HRESULT InitContextCaps();
+ // updates the texture transform(s) used for better texel to pixel mapping
+ // for the passed in sampler;
+ // if -1 is passed as the sampler, texture transforms for
+ // samplers [0..MAX_USED_TEXTURE_SAMPLER] are updated
+ // REMIND: see the comment in the method implementation before enabling.
+#undef UPDATE_TX
+#ifdef UPDATE_TX
+ HRESULT UpdateTextureTransforms(DWORD dwSamplerToUpdate);
+#endif // UPDATE_TX
+ IDirect3DDevice9 *pd3dDevice;
+ IDirect3D9 *pd3dObject;
+
+ D3DResourceManager *pResourceMgr;
+ D3DMaskCache *pMaskCache;
+
+ ShaderList convolvePrograms;
+ ShaderList rescalePrograms;
+ ShaderList lookupPrograms;
+ ShaderList basicGradPrograms;
+ ShaderList linearGradPrograms;
+ ShaderList radialGradPrograms;
-#define D3DFVF_J2D_XY_C (D3DFVF_XYZ | D3DFVF_DIFFUSE)
-#define D3DFVF_XY_VERTEX D3DFVF_XYZ
+ // array of the textures currently set to the device
+ IDirect3DTexture9 *lastTexture[MAX_USED_TEXTURE_SAMPLER+1];
-typedef struct _J2D_XY_C_VERTEX {
- float x, y, z;
- DWORD color;
-} J2D_XY_C_VERTEX;
-typedef struct _J2D_XY_VERTEX {
- float x, y, z;
-} J2D_XY_VERTEX;
+ DWORD lastTextureColorState[MAX_USED_TEXTURE_SAMPLER+1];
-#else // USE_SINGLE_VERTEX_FORMAT
+ UINT adapterOrdinal;
+ D3DPRESENT_PARAMETERS curParams;
+ D3DCAPS9 devCaps;
+ int contextCaps;
+ BOOL bIsHWRasterizer;
-// When using a single vertex format, define
-// every format as J2DLVERTEX
+ BOOL bIsIdentityTx;
-#define D3DFVF_J2D_XY_C D3DFVF_J2DLVERTEX
-#define D3DFVF_XY_VERTEX D3DFVF_J2DLVERTEX
-typedef J2DLVERTEX J2D_XY_C_VERTEX;
-typedef J2DLVERTEX J2D_XY_VERTEX;
+ IDirect3DQuery9* pSyncQuery;
+ D3DResource* pSyncRTRes;
-#endif // USE_SINGLE_VERTEX_FORMAT
+ IDirect3DStateBlock9* pStateBlock;
-typedef J2DLVERTEX J2DLV_QUAD[4];
-typedef J2DLVERTEX J2DLV_HEXA[6];
-typedef J2D_XY_C_VERTEX J2DXYC_HEXA[6];
-typedef J2D_XY_VERTEX J2DXY_HEXA[6];
-#define MAX_CACHED_SPAN_VX_NUM 100
+ /**
+ * Used to implement simple primitive batching.
+ * See BeginScene/EndScene/ForceEndScene.
+ */
+ BOOL bBeginScenePending;
+};
// - Helper Macros ---------------------------------------------------
-#define D3D_DEPTH_IDX(DEPTH) \
- (((DEPTH) <= 16) ? DEPTH16_IDX : \
- (((DEPTH) <= 24) ? DEPTH24_IDX : DEPTH32_IDX))
+#define D3DC_INIT_SHADER_LIST(list, max) \
+ do { \
+ (list).head = NULL; \
+ (list).maxItems = (max); \
+ (list).dispose = D3DContext_DisposeShader; \
+ } while (0)
-#define D3D_TR_IDX(TRAN) ((TRAN) - 1)
-
-#define D3DSD_MASK_TILE_SIZE 32
-#define D3D_GCACHE_WIDTH 512
-#define D3D_GCACHE_HEIGHT 512
-#define D3D_GCACHE_CELL_WIDTH 16
-#define D3D_GCACHE_CELL_HEIGHT 16
+/**
+ * This constant determines the size of the shared tile texture used
+ * by a number of image rendering methods. For example, the blit tile texture
+ * will have dimensions with width D3DC_BLIT_TILE_SIZE and height
+ * D3DC_BLIT_TILE_SIZE (the tile will always be square).
+ */
+#define D3DC_BLIT_TILE_SIZE 256
+/**
+ * See BufferedContext.java for more on these flags...
+ */
#define D3DC_NO_CONTEXT_FLAGS \
- sun_java2d_d3d_D3DContext_NO_CONTEXT_FLAGS
+ sun_java2d_pipe_BufferedContext_NO_CONTEXT_FLAGS
#define D3DC_SRC_IS_OPAQUE \
- sun_java2d_d3d_D3DContext_SRC_IS_OPAQUE
-
-#define J2D_D3D_FAILURE \
- sun_java2d_d3d_D3DContext_J2D_D3D_FAILURE
-#define J2D_D3D_PLAIN_SURFACE_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_PLAIN_SURFACE_OK
-#define J2D_D3D_OP_TEXTURE_SURFACE_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_OP_TEXTURE_SURFACE_OK
-#define J2D_D3D_BM_TEXTURE_SURFACE_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_BM_TEXTURE_SURFACE_OK
-#define J2D_D3D_TR_TEXTURE_SURFACE_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_TR_TEXTURE_SURFACE_OK
-#define J2D_D3D_DEPTH_SURFACE_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_DEPTH_SURFACE_OK
-#define J2D_D3D_OP_RTT_SURFACE_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_OP_RTT_SURFACE_OK
-#define J2D_D3D_LINES_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_LINES_OK
-#define J2D_D3D_TEXTURE_BLIT_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_TEXTURE_BLIT_OK
-#define J2D_D3D_TEXTURE_TRANSFORM_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_TEXTURE_TRANSFORM_OK
-#define J2D_D3D_LINE_CLIPPING_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_LINE_CLIPPING_OK
-#define J2D_D3D_DEVICE_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_DEVICE_OK
-#define J2D_D3D_PIXEL_FORMATS_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_PIXEL_FORMATS_OK
-#define J2D_D3D_SET_TRANSFORM_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_SET_TRANSFORM_OK
-#define J2D_D3D_HW_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_HW_OK
-#define J2D_D3D_ENABLED_OK \
- sun_java2d_d3d_D3DContext_J2D_D3D_ENABLED_OK
-
-#endif D3DCONTEXT_H
+ sun_java2d_pipe_BufferedContext_SRC_IS_OPAQUE
+#define D3DC_USE_MASK \
+ sun_java2d_pipe_BufferedContext_USE_MASK
+
+#define CAPS_EMPTY \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_EMPTY
+#define CAPS_RT_PLAIN_ALPHA \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_RT_PLAIN_ALPHA
+#define CAPS_RT_TEXTURE_ALPHA \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_RT_TEXTURE_ALPHA
+#define CAPS_RT_TEXTURE_OPAQUE \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_RT_TEXTURE_OPAQUE
+#define CAPS_MULTITEXTURE \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_MULTITEXTURE
+#define CAPS_TEXNONPOW2 \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_TEXNONPOW2
+#define CAPS_TEXNONSQUARE \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_TEXNONSQUARE
+#define CAPS_LCD_SHADER \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_LCD_SHADER
+#define CAPS_BIOP_SHADER \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_BIOP_SHADER
+#define CAPS_AA_SHADER \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_AA_SHADER
+#define CAPS_DEVICE_OK \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_DEVICE_OK
+#define CAPS_PS20 \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_PS20
+#define CAPS_PS30 \
+ sun_java2d_d3d_D3DContext_D3DContextCaps_CAPS_PS30
+
+#define DEVICE_RESET \
+ sun_java2d_pipe_hw_AccelDeviceEventNotifier_DEVICE_RESET
+#define DEVICE_DISPOSED \
+ sun_java2d_pipe_hw_AccelDeviceEventNotifier_DEVICE_DISPOSED
+
+#endif // D3DCONTEXT_H