- add a new settings for vbo support

- use a struct to handle wined3d settings
- prepare VBO using some abstraction APIs
This commit is contained in:
Raphael Junqueira 2005-07-24 17:11:33 +00:00 committed by Alexandre Julliard
parent 100923508c
commit cc8762a91e
5 changed files with 69 additions and 18 deletions

View File

@ -1455,7 +1455,7 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
*pCaps->MaxStreams = MAX_STREAMS;
*pCaps->MaxStreamStride = 1024;
if (((vs_mode == VS_HW) && GL_SUPPORT(ARB_VERTEX_PROGRAM)) || (vs_mode == VS_SW) || (DeviceType == D3DDEVTYPE_REF)) {
if (((wined3d_settings.vs_mode == VS_HW) && GL_SUPPORT(ARB_VERTEX_PROGRAM)) || (wined3d_settings.vs_mode == VS_SW) || (DeviceType == D3DDEVTYPE_REF)) {
*pCaps->VertexShaderVersion = D3DVS_VERSION(1,1);
if (This->gl_info.gl_vendor == VENDOR_MESA ||
@ -1469,7 +1469,7 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
*pCaps->MaxVertexShaderConst = 0;
}
if ((ps_mode == PS_HW) && GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && (DeviceType != D3DDEVTYPE_REF)) {
if ((wined3d_settings.ps_mode == PS_HW) && GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && (DeviceType != D3DDEVTYPE_REF)) {
*pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
*pCaps->PixelShader1xMaxValue = 1.0;
} else {

View File

@ -365,8 +365,8 @@ void primitiveDeclarationConvertToStridedData(IWineD3DDevice *iface, Direct3DVer
TRACE("Stream is up %d, %p\n", element->Stream, This->stateBlock->streamSource[element->Stream]);
data = (BYTE *)This->stateBlock->streamSource[element->Stream];
} else {
TRACE("Stream isn't up %d, %p\n", element->Stream, This->stateBlock->streamSource[element->Stream]);
data = ((IWineD3DVertexBufferImpl *)This->stateBlock->streamSource[element->Stream])->resource.allocatedMemory;
TRACE("Stream isn't up %d, %p\n", element->Stream, This->stateBlock->streamSource[element->Stream]);
data = IWineD3DVertexBufferImpl_GetMemory(This->stateBlock->streamSource[element->Stream], 0);
}
stride = This->stateBlock->streamStride[element->Stream];
data += (BaseVertexIndex * stride);
@ -571,12 +571,12 @@ static void primitiveConvertToStridedData(IWineD3DDevice *iface, Direct3DVertexS
if (This->stateBlock->streamIsUP) {
data = (BYTE *)This->stateBlock->streamSource[nStream];
} else {
data = ((IWineD3DVertexBufferImpl *)This->stateBlock->streamSource[nStream])->resource.allocatedMemory;
data = IWineD3DVertexBufferImpl_GetMemory(This->stateBlock->streamSource[nStream], 0);
}
} else {
#if 0 /* TODO: Vertex shader support */
thisFVF = This->stateBlock->vertexShaderDecl->fvf[nStream];
data = ((IDirect3DVertexBuffer8Impl *)This->stateBlock->streamSource[nStream])->allocatedMemory;
data = IWineD3DVertexBufferImpl_GetMemory(This->stateBlock->streamSource[nStream], 0);
#endif
}
VTRACE(("FVF for stream %d is %lx\n", nStream, thisFVF));

View File

@ -1,8 +1,8 @@
/*
* IWineD3DVertexBuffer Implementation
*
* Copyright 2002-2004 Jason Edmeades
* Copyright 2003-2004 Raphael Junqueira
* Copyright 2002-2005 Jason Edmeades
* Raphael Junqueira
* Copyright 2004 Christian Costa
*
* This library is free software; you can redistribute it and/or
@ -149,3 +149,13 @@ const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl =
IWineD3DVertexBufferImpl_Unlock,
IWineD3DVertexBufferImpl_GetDesc
};
BYTE* WINAPI IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWORD iOffset) {
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *)iface;
return This->resource.allocatedMemory + iOffset;
}
HRESULT WINAPI IWineD3DVertexBufferImpl_ReleaseMemory(IWineD3DVertexBuffer* iface) {
return D3D_OK;
}

View File

@ -30,8 +30,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(wine_d3d);
int num_lock = 0;
void (*wine_tsx11_lock_ptr)(void) = NULL;
void (*wine_tsx11_unlock_ptr)(void) = NULL;
int vs_mode = VS_HW; /* Hardware by default */
int ps_mode = PS_NONE; /* Disabled by default */
wined3d_settings_t wined3d_settings =
{
VS_HW, /* Hardware by default */
PS_NONE, /* Disabled by default */
VBO_HW /* Hardware by default */
};
WineD3DGlobalStatistics *wineD3DGlobalStatistics = NULL;
CRITICAL_SECTION resourceStoreCriticalSection;
@ -128,12 +134,12 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
if (!strcmp(buffer,"none"))
{
TRACE("Disable vertex shaders\n");
vs_mode = VS_NONE;
wined3d_settings.vs_mode = VS_NONE;
}
else if (!strcmp(buffer,"emulation"))
{
TRACE("Force SW vertex shaders\n");
vs_mode = VS_SW;
wined3d_settings.vs_mode = VS_SW;
}
}
if ( !get_config_key( hkey, appkey, "PixelShaderMode", buffer, size) )
@ -141,14 +147,34 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
if (!strcmp(buffer,"enabled"))
{
TRACE("Allow pixel shaders\n");
ps_mode = PS_HW;
wined3d_settings.ps_mode = PS_HW;
}
if (!strcmp(buffer,"disabled"))
{
TRACE("Disable pixel shaders\n");
wined3d_settings.ps_mode = PS_NONE;
}
}
if ( !get_config_key( hkey, appkey, "VertexBufferMode", buffer, size) )
{
if (!strcmp(buffer,"none"))
{
TRACE("Disable Vertex Buffer Hardware support\n");
wined3d_settings.vbo_mode = VS_NONE;
}
else if (!strcmp(buffer,"hardware"))
{
TRACE("Allow Vertex Buffer Hardware support\n");
wined3d_settings.vbo_mode = VS_HW;
}
}
}
if (vs_mode == VS_HW)
if (wined3d_settings.vs_mode == VS_HW)
TRACE("Allow HW vertex shaders\n");
if (ps_mode == PS_NONE)
if (wined3d_settings.ps_mode == PS_NONE)
TRACE("Disable pixel shaders\n");
if (wined3d_settings.vbo_mode == VBO_NONE)
TRACE("Disable Vertex Buffer Hardware support\n");
if (appkey) RegCloseKey( appkey );
if (hkey) RegCloseKey( hkey );

View File

@ -69,16 +69,28 @@ extern const DWORD SavedVertexStates_R[NUM_SAVEDVERTEXSTATES_R];
extern const DWORD SavedVertexStates_T[NUM_SAVEDVERTEXSTATES_T];
extern const DWORD SavedVertexStates_S[NUM_SAVEDVERTEXSTATES_S];
/* vertex and pixel shader modes */
extern int vs_mode;
/**
* Settings
*/
#define VS_NONE 0
#define VS_HW 1
#define VS_SW 2
extern int ps_mode;
#define PS_NONE 0
#define PS_HW 1
#define VBO_NONE 0
#define VBO_HW 1
typedef struct wined3d_settings_s {
/* vertex and pixel shader modes */
int vs_mode;
int ps_mode;
int vbo_mode;
} wined3d_settings_t;
extern wined3d_settings_t wined3d_settings;
/* X11 locking */
extern void (*wine_tsx11_lock_ptr)(void);
@ -979,6 +991,9 @@ int D3DFmtMakeGlCfg(D3DFORMAT BackBufferFormat, D3DFORMAT StencilBufferFormat, i
extern void WINAPI IWineD3DBaseTextureImpl_GenerateMipSubLevels(IWineD3DBaseTexture *iface);
extern BOOL WINAPI IWineD3DBaseTextureImpl_SetDirty(IWineD3DBaseTexture *iface, BOOL);
extern BOOL WINAPI IWineD3DBaseTextureImpl_GetDirty(IWineD3DBaseTexture *iface);
extern BYTE* WINAPI IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWORD iOffset);
extern HRESULT WINAPI IWineD3DVertexBufferImpl_ReleaseMemory(IWineD3DVertexBuffer* iface);
extern HRESULT WINAPI IWineD3DBaseTextureImpl_BindTexture(IWineD3DBaseTexture *iface);
extern HRESULT WINAPI IWineD3DBaseTextureImpl_UnBindTexture(IWineD3DBaseTexture *iface);
/*** class static members ***/