📄 wined3d_private.h
字号:
const IWineD3DVtbl *lpVtbl;
LONG ref; /* Note: Ref counting not required */
/* WineD3D Information */
IUnknown *parent;
UINT dxVersion;
} IWineD3DImpl;
extern const IWineD3DVtbl IWineD3D_Vtbl;
/* TODO: setup some flags in the registry to enable, disable pbuffer support
(since it will break quite a few things until contexts are managed properly!) */
extern BOOL pbuffer_support;
/* allocate one pbuffer per surface */
extern BOOL pbuffer_per_surface;
typedef struct ResourceList {
IWineD3DResource *resource;
struct ResourceList *next;
} ResourceList;
/* A helper function that dumps a resource list */
void dumpResources(ResourceList *resources);
/*****************************************************************************
* IWineD3DDevice implementation structure
*/
struct IWineD3DDeviceImpl
{
/* IUnknown fields */
const IWineD3DDeviceVtbl *lpVtbl;
LONG ref; /* Note: Ref counting not required */
/* WineD3D Information */
IUnknown *parent;
IWineD3D *wineD3D;
struct WineD3DAdapter *adapter;
/* Window styles to restore when switching fullscreen mode */
LONG style;
LONG exStyle;
/* X and GL Information */
GLint maxConcurrentLights;
GLenum offscreenBuffer;
/* Selected capabilities */
int vs_selected_mode;
int ps_selected_mode;
const shader_backend_t *shader_backend;
hash_table_t *glsl_program_lookup;
/* To store */
BOOL view_ident; /* true iff view matrix is identity */
BOOL untransformed;
BOOL vertexBlendUsed; /* To avoid needless setting of the blend matrices */
unsigned char surface_alignment; /* Line Alignment of surfaces */
/* State block related */
BOOL isRecordingState;
IWineD3DStateBlockImpl *stateBlock;
IWineD3DStateBlockImpl *updateStateBlock;
BOOL isInDraw;
/* Internal use fields */
WINED3DDEVICE_CREATION_PARAMETERS createParms;
UINT adapterNo;
WINED3DDEVTYPE devType;
IWineD3DSwapChain **swapchains;
UINT NumberOfSwapChains;
ResourceList *resources; /* a linked list to track resources created by the device */
/* Render Target Support */
IWineD3DSurface **render_targets;
IWineD3DSurface *depthStencilBuffer;
IWineD3DSurface **fbo_color_attachments;
IWineD3DSurface *fbo_depth_attachment;
IWineD3DSurface *stencilBufferTarget;
/* Caches to avoid unneeded context changes */
IWineD3DSurface *lastActiveRenderTarget;
IWineD3DSwapChain *lastActiveSwapChain;
/* palettes texture management */
PALETTEENTRY palettes[MAX_PALETTES][256];
UINT currentPalette;
/* For rendering to a texture using glCopyTexImage */
BOOL render_offscreen;
WINED3D_DEPTHCOPYSTATE depth_copy_state;
GLuint fbo;
GLuint src_fbo;
GLuint dst_fbo;
GLenum *draw_buffers;
/* Cursor management */
BOOL bCursorVisible;
UINT xHotSpot;
UINT yHotSpot;
UINT xScreenSpace;
UINT yScreenSpace;
UINT cursorWidth, cursorHeight;
GLuint cursorTexture;
BOOL haveHardwareCursor;
HCURSOR hardwareCursor;
/* Textures for when no other textures are mapped */
UINT dummyTextureName[MAX_TEXTURES];
/* Debug stream management */
BOOL debug;
/* Device state management */
HRESULT state;
BOOL d3d_initialized;
/* A flag to check for proper BeginScene / EndScene call pairs */
BOOL inScene;
/* process vertex shaders using software or hardware */
BOOL softwareVertexProcessing;
/* DirectDraw stuff */
HWND ddraw_window;
IWineD3DSurface *ddraw_primary;
DWORD ddraw_width, ddraw_height;
WINED3DFORMAT ddraw_format;
BOOL ddraw_fullscreen;
/* Final position fixup constant */
float posFixup[4];
/* With register combiners we can skip junk texture stages */
DWORD texUnitMap[MAX_COMBINED_SAMPLERS];
DWORD rev_tex_unit_map[MAX_COMBINED_SAMPLERS];
BOOL fixed_function_usage_map[MAX_TEXTURES];
/* Stream source management */
WineDirect3DVertexStridedData strided_streams;
WineDirect3DVertexStridedData *up_strided;
BOOL useDrawStridedSlow;
BOOL instancedDraw;
/* Context management */
WineD3DContext **contexts; /* Dynamic array containing pointers to context structures */
WineD3DContext *activeContext;
DWORD lastThread;
UINT numContexts;
WineD3DContext *pbufferContext; /* The context that has a pbuffer as drawable */
DWORD pbufferWidth, pbufferHeight; /* Size of the buffer drawable */
/* High level patch management */
#define PATCHMAP_SIZE 43
#define PATCHMAP_HASHFUNC(x) ((x) % PATCHMAP_SIZE) /* Primitive and simple function */
struct list patches[PATCHMAP_SIZE];
struct WineD3DRectPatch *currentPatch;
};
extern const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl;
void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This);
void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state);
static inline BOOL isStateDirty(WineD3DContext *context, DWORD state) {
DWORD idx = state >> 5;
BYTE shift = state & 0x1f;
return context->isStateDirty[idx] & (1 << shift);
}
/* Support for IWineD3DResource ::Set/Get/FreePrivateData. */
typedef struct PrivateData
{
struct list entry;
GUID tag;
DWORD flags; /* DDSPD_* */
DWORD uniqueness_value;
union
{
LPVOID data;
LPUNKNOWN object;
} ptr;
DWORD size;
} PrivateData;
/*****************************************************************************
* IWineD3DResource implementation structure
*/
typedef struct IWineD3DResourceClass
{
/* IUnknown fields */
LONG ref; /* Note: Ref counting not required */
/* WineD3DResource Information */
IUnknown *parent;
WINED3DRESOURCETYPE resourceType;
IWineD3DDeviceImpl *wineD3DDevice;
WINED3DPOOL pool;
UINT size;
DWORD usage;
WINED3DFORMAT format;
BYTE *allocatedMemory;
struct list privateData;
} IWineD3DResourceClass;
typedef struct IWineD3DResourceImpl
{
/* IUnknown & WineD3DResource Information */
const IWineD3DResourceVtbl *lpVtbl;
IWineD3DResourceClass resource;
} IWineD3DResourceImpl;
/*****************************************************************************
* IWineD3DVertexBuffer implementation structure (extends IWineD3DResourceImpl)
*/
typedef struct IWineD3DVertexBufferImpl
{
/* IUnknown & WineD3DResource Information */
const IWineD3DVertexBufferVtbl *lpVtbl;
IWineD3DResourceClass resource;
/* WineD3DVertexBuffer specifics */
DWORD fvf;
/* Vertex buffer object support */
GLuint vbo;
BYTE Flags;
LONG bindCount;
UINT dirtystart, dirtyend;
LONG lockcount;
LONG declChanges, draws;
/* Last description of the buffer */
WineDirect3DVertexStridedData strided;
} IWineD3DVertexBufferImpl;
extern const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl;
#define VBFLAG_LOAD 0x01 /* Data is written from allocatedMemory to the VBO */
#define VBFLAG_OPTIMIZED 0x02 /* Optimize has been called for the VB */
#define VBFLAG_DIRTY 0x04 /* Buffer data has been modified */
#define VBFLAG_HASDESC 0x08 /* A vertex description has been found */
#define VBFLAG_VBOCREATEFAIL 0x10 /* An attempt to create a vbo has failed */
/*****************************************************************************
* IWineD3DIndexBuffer implementation structure (extends IWineD3DResourceImpl)
*/
typedef struct IWineD3DIndexBufferImpl
{
/* IUnknown & WineD3DResource Information */
const IWineD3DIndexBufferVtbl *lpVtbl;
IWineD3DResourceClass resource;
GLuint vbo;
UINT dirtystart, dirtyend;
LONG lockcount;
/* WineD3DVertexBuffer specifics */
} IWineD3DIndexBufferImpl;
extern const IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl;
/*****************************************************************************
* IWineD3DBaseTexture D3D- > openGL state map lookups
*/
#define WINED3DFUNC_NOTSUPPORTED -2
#define WINED3DFUNC_UNIMPLEMENTED -1
typedef enum winetexturestates {
WINED3DTEXSTA_ADDRESSU = 0,
WINED3DTEXSTA_ADDRESSV = 1,
WINED3DTEXSTA_ADDRESSW = 2,
WINED3DTEXSTA_BORDERCOLOR = 3,
WINED3DTEXSTA_MAGFILTER = 4,
WINED3DTEXSTA_MINFILTER = 5,
WINED3DTEXSTA_MIPFILTER = 6,
WINED3DTEXSTA_MAXMIPLEVEL = 7,
WINED3DTEXSTA_MAXANISOTROPY = 8,
WINED3DTEXSTA_SRGBTEXTURE = 9,
WINED3DTEXSTA_ELEMENTINDEX = 10,
WINED3DTEXSTA_DMAPOFFSET = 11,
WINED3DTEXSTA_TSSADDRESSW = 12,
MAX_WINETEXTURESTATES = 13,
} winetexturestates;
/*****************************************************************************
* IWineD3DBaseTexture implementation structure (extends IWineD3DResourceImpl)
*/
typedef struct IWineD3DBaseTextureClass
{
UINT levels;
BOOL dirty;
UINT textureName;
UINT LOD;
WINED3DTEXTUREFILTERTYPE filterType;
DWORD states[MAX_WINETEXTURESTATES];
LONG bindCount;
DWORD sampler;
BOOL is_srgb;
UINT srgb_mode_change_count;
} IWineD3DBaseTextureClass;
typedef struct IWineD3DBaseTextureImpl
{
/* IUnknown & WineD3DResource Information */
const IWineD3DBaseTextureVtbl *lpVtbl;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -