📄 wined3d_private.h
字号:
/* IUnknown Information */
const IWineD3DVertexDeclarationVtbl *lpVtbl;
LONG ref;
IUnknown *parent;
IWineD3DDeviceImpl *wineD3DDevice;
WINED3DVERTEXELEMENT *pDeclarationWine;
UINT declarationWNumElements;
DWORD streams[MAX_STREAMS];
UINT num_streams;
BOOL position_transformed;
} IWineD3DVertexDeclarationImpl;
extern const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl;
/*****************************************************************************
* IWineD3DStateBlock implementation structure
*/
/* Internal state Block for Begin/End/Capture/Create/Apply info */
/* Note: Very long winded but gl Lists are not flexible enough */
/* to resolve everything we need, so doing it manually for now */
typedef struct SAVEDSTATES {
BOOL indices;
BOOL material;
BOOL fvf;
BOOL streamSource[MAX_STREAMS];
BOOL streamFreq[MAX_STREAMS];
BOOL textures[MAX_COMBINED_SAMPLERS];
BOOL transform[HIGHEST_TRANSFORMSTATE + 1];
BOOL viewport;
BOOL renderState[WINEHIGHEST_RENDER_STATE + 1];
BOOL textureState[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
BOOL samplerState[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
BOOL clipplane[MAX_CLIPPLANES];
BOOL vertexDecl;
BOOL pixelShader;
BOOL pixelShaderConstantsB[MAX_CONST_B];
BOOL pixelShaderConstantsI[MAX_CONST_I];
BOOL *pixelShaderConstantsF;
BOOL vertexShader;
BOOL vertexShaderConstantsB[MAX_CONST_B];
BOOL vertexShaderConstantsI[MAX_CONST_I];
BOOL *vertexShaderConstantsF;
BOOL scissorRect;
} SAVEDSTATES;
typedef struct {
struct list entry;
DWORD count;
DWORD idx[13];
} constants_entry;
struct StageState {
DWORD stage;
DWORD state;
};
struct IWineD3DStateBlockImpl
{
/* IUnknown fields */
const IWineD3DStateBlockVtbl *lpVtbl;
LONG ref; /* Note: Ref counting not required */
/* IWineD3DStateBlock information */
IUnknown *parent;
IWineD3DDeviceImpl *wineD3DDevice;
WINED3DSTATEBLOCKTYPE blockType;
/* Array indicating whether things have been set or changed */
SAVEDSTATES changed;
struct list set_vconstantsF;
struct list set_pconstantsF;
/* Drawing - Vertex Shader or FVF related */
DWORD fvf;
/* Vertex Shader Declaration */
IWineD3DVertexDeclaration *vertexDecl;
IWineD3DVertexShader *vertexShader;
/* Vertex Shader Constants */
BOOL vertexShaderConstantB[MAX_CONST_B];
INT vertexShaderConstantI[MAX_CONST_I * 4];
float *vertexShaderConstantF;
/* Stream Source */
BOOL streamIsUP;
UINT streamStride[MAX_STREAMS];
UINT streamOffset[MAX_STREAMS + 1 /* tesselated pseudo-stream */ ];
IWineD3DVertexBuffer *streamSource[MAX_STREAMS];
UINT streamFreq[MAX_STREAMS + 1];
UINT streamFlags[MAX_STREAMS + 1]; /*0 | WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA */
/* Indices */
IWineD3DIndexBuffer* pIndexData;
UINT baseVertexIndex;
UINT loadBaseVertexIndex; /* non-indexed drawing needs 0 here, indexed baseVertexIndex */
/* Transform */
WINED3DMATRIX transforms[HIGHEST_TRANSFORMSTATE + 1];
/* Light hashmap . Collisions are handled using standard wine double linked lists */
#define LIGHTMAP_SIZE 43 /* Use of a prime number recommended. Set to 1 for a linked list! */
#define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE) /* Primitive and simple function */
struct list lightMap[LIGHTMAP_SIZE]; /* Mashmap containing the lights */
PLIGHTINFOEL *activeLights[MAX_ACTIVE_LIGHTS]; /* Map of opengl lights to d3d lights */
/* Clipping */
double clipplane[MAX_CLIPPLANES][4];
WINED3DCLIPSTATUS clip_status;
/* ViewPort */
WINED3DVIEWPORT viewport;
/* Material */
WINED3DMATERIAL material;
/* Pixel Shader */
IWineD3DPixelShader *pixelShader;
/* Pixel Shader Constants */
BOOL pixelShaderConstantB[MAX_CONST_B];
INT pixelShaderConstantI[MAX_CONST_I * 4];
float *pixelShaderConstantF;
/* RenderState */
DWORD renderState[WINEHIGHEST_RENDER_STATE + 1];
/* Texture */
IWineD3DBaseTexture *textures[MAX_COMBINED_SAMPLERS];
int textureDimensions[MAX_COMBINED_SAMPLERS];
/* Texture State Stage */
DWORD textureState[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
DWORD lowest_disabled_stage;
/* Sampler States */
DWORD samplerState[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
/* Current GLSL Shader Program */
struct glsl_shader_prog_link *glsl_program;
/* Scissor test rectangle */
RECT scissorRect;
/* Contained state management */
DWORD contained_render_states[WINEHIGHEST_RENDER_STATE + 1];
unsigned int num_contained_render_states;
DWORD contained_transform_states[HIGHEST_TRANSFORMSTATE + 1];
unsigned int num_contained_transform_states;
DWORD contained_vs_consts_i[MAX_CONST_I];
unsigned int num_contained_vs_consts_i;
DWORD contained_vs_consts_b[MAX_CONST_B];
unsigned int num_contained_vs_consts_b;
DWORD *contained_vs_consts_f;
unsigned int num_contained_vs_consts_f;
DWORD contained_ps_consts_i[MAX_CONST_I];
unsigned int num_contained_ps_consts_i;
DWORD contained_ps_consts_b[MAX_CONST_B];
unsigned int num_contained_ps_consts_b;
DWORD *contained_ps_consts_f;
unsigned int num_contained_ps_consts_f;
struct StageState contained_tss_states[MAX_TEXTURES * (WINED3D_HIGHEST_TEXTURE_STATE)];
unsigned int num_contained_tss_states;
struct StageState contained_sampler_states[MAX_COMBINED_SAMPLERS * WINED3D_HIGHEST_SAMPLER_STATE];
unsigned int num_contained_sampler_states;
};
extern void stateblock_savedstates_set(
IWineD3DStateBlock* iface,
SAVEDSTATES* states,
BOOL value);
extern void stateblock_savedstates_copy(
IWineD3DStateBlock* iface,
SAVEDSTATES* dest,
SAVEDSTATES* source);
extern void stateblock_copy(
IWineD3DStateBlock* destination,
IWineD3DStateBlock* source);
extern const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl;
/*****************************************************************************
* IWineD3DQueryImpl implementation structure (extends IUnknown)
*/
typedef struct IWineD3DQueryImpl
{
const IWineD3DQueryVtbl *lpVtbl;
LONG ref; /* Note: Ref counting not required */
IUnknown *parent;
/*TODO: replace with iface usage */
#if 0
IWineD3DDevice *wineD3DDevice;
#else
IWineD3DDeviceImpl *wineD3DDevice;
#endif
/* IWineD3DQuery fields */
WINED3DQUERYTYPE type;
/* TODO: Think about using a IUnknown instead of a void* */
void *extendedData;
} IWineD3DQueryImpl;
extern const IWineD3DQueryVtbl IWineD3DQuery_Vtbl;
/* Datastructures for IWineD3DQueryImpl.extendedData */
typedef struct WineQueryOcclusionData {
GLuint queryId;
} WineQueryOcclusionData;
typedef struct WineQueryEventData {
GLuint fenceId;
} WineQueryEventData;
/*****************************************************************************
* IWineD3DSwapChainImpl implementation structure (extends IUnknown)
*/
typedef struct IWineD3DSwapChainImpl
{
/*IUnknown part*/
const IWineD3DSwapChainVtbl *lpVtbl;
LONG ref; /* Note: Ref counting not required */
IUnknown *parent;
IWineD3DDeviceImpl *wineD3DDevice;
/* IWineD3DSwapChain fields */
IWineD3DSurface **backBuffer;
IWineD3DSurface *frontBuffer;
BOOL wantsDepthStencilBuffer;
WINED3DPRESENT_PARAMETERS presentParms;
DWORD orig_width, orig_height;
WINED3DFORMAT orig_fmt;
long prev_time, frames; /* Performance tracking */
unsigned int vSyncCounter;
WineD3DContext **context; /* Later a array for multithreading */
unsigned int num_contexts;
HWND win_handle;
} IWineD3DSwapChainImpl;
extern const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl;
WineD3DContext *IWineD3DSwapChainImpl_CreateContextForThread(IWineD3DSwapChain *iface);
/*****************************************************************************
* Utility function prototypes
*/
/* Trace routines */
const char* debug_d3dformat(WINED3DFORMAT fmt);
const char* debug_d3ddevicetype(WINED3DDEVTYPE devtype);
const char* debug_d3dresourcetype(WINED3DRESOURCETYPE res);
const char* debug_d3dusage(DWORD usage);
const char* debug_d3dusagequery(DWORD usagequery);
const char* debug_d3ddeclmethod(WINED3DDECLMETHOD method);
const char* debug_d3ddecltype(WINED3DDECLTYPE type);
const char* debug_d3ddeclusage(BYTE usage);
const char* debug_d3dprimitivetype(WINED3DPRIMITIVETYPE PrimitiveType);
const char* debug_d3drenderstate(DWORD state);
const char* debug_d3dsamplerstate(DWORD state);
const char* debug_d3dtexturefiltertype(WINED3DTEXTUREFILTERTYPE filter_type);
const char* debug_d3dtexturestate(DWORD state);
const char* debug_d3dtstype(WINED3DTRANSFORMSTATETYPE tstype);
const char* debug_d3dpool(WINED3DPOOL pool);
const char *debug_fbostatus(GLenum status);
const char *debug_glerror(GLenum error);
const char *debug_d3dbasis(WINED3DBASISTYPE basis);
const char *debug_d3ddegree(WINED3DDEGREETYPE order);
/* Routines for GL <-> D3D values */
GLenum StencilOp(DWORD op);
GLenum CompareFunc(DWORD func);
void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3);
void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx);
void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords);
void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int width, unsigned int height);
GLenum surface_get_gl_buffer(IWineD3DSurface *iface, IWineD3DSwapChain *swapchain);
BOOL getColorBits(WINED3DFORMAT fmt, short *redSize, short *greenSize, short *blueSize, short *alphaSize, short *totalSize);
BOOL getDepthStencilBits(WINED3DFORMAT fmt, short *depthSize, short *stencilSize);
/* Math utils */
void multiply_matrix(WINED3DMATRIX *dest, const WINED3DMATRIX *src1, const WINED3DMATRIX *src2);
/*****************************************************************************
* To enable calling of inherited functions, requires prototypes
*
* Note: Only require classes which are subclassed, ie resource, basetexture,
*/
/*** IUnknown methods ***/
extern HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFIID riid, void** ppvObject);
extern ULONG WINAPI IWineD3DResourceImpl_AddRef(IWineD3DResource *iface);
extern ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface);
/*** IWineD3DResource methods ***/
extern HRESULT WINAPI IWineD3DResourceImpl_GetParent(IWineD3DResource *iface, IUnknown **pParent);
extern HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice ** ppDevice);
extern HRESULT WINAPI IWineD3DResourceImpl_SetPrivateData(IWineD3DResource *iface, REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags);
extern HRESULT WINAPI IWineD3DResourceImpl_GetPrivateData(IWineD3DResource *iface, REFGUID refguid, void * pData
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -