Commit 9253e0e3 authored by Oliver Stieber's avatar Oliver Stieber Committed by Alexandre Julliard

Tidy up some comments and formatting.

parent 1ed9bac8
......@@ -278,6 +278,7 @@ UINT WINAPI IWineD3DBaseTextureImpl_GetTextureDimensions(IWineD3DBaseTexture *if
static const IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl =
{
/* IUnknown */
IWineD3DBaseTextureImpl_QueryInterface,
IWineD3DBaseTextureImpl_AddRef,
IWineD3DBaseTextureImpl_Release,
......
......@@ -78,7 +78,7 @@ ULONG WINAPI IWineD3DCubeTextureImpl_Release(IWineD3DCubeTexture *iface) {
int i,j;
TRACE("(%p) : Cleaning up\n",This);
for (i = 0; i < This->baseTexture.levels; i++) {
for (j = 0; j < 6; j++) {
for (j = 0; j < 6; j++) {
if (This->surfaces[j][i] != NULL) {
/* Because the surfaces were created using a callback we need to release there parent otehrwise we leave the parent hanging */
IUnknown* surfaceParent;
......@@ -132,13 +132,13 @@ void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface) {
unsigned int i,j;
BOOL setGlTextureDesc = FALSE;
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
TRACE("(%p) : About to load texture: dirtified(%d)\n", This, This->baseTexture.dirty);
if (This->baseTexture.textureName == 0) setGlTextureDesc = TRUE;
IWineD3DCubeTexture_BindTexture(iface);
ENTER_GL();
/* If were dirty then reload the surfaces */
if (This->baseTexture.dirty != FALSE) {
......@@ -215,7 +215,7 @@ HRESULT WINAPI IWineD3DCubeTextureImpl_UnBindTexture(IWineD3DCubeTexture *iface)
UINT WINAPI IWineD3DCubeTextureImpl_GetTextureDimensions(IWineD3DCubeTexture *iface){
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
TRACE("(%p) \n", This);
return GLTEXTURECUBEMAP;
}
......@@ -224,7 +224,7 @@ UINT WINAPI IWineD3DCubeTextureImpl_GetTextureDimensions(IWineD3DCubeTexture *if
******************************************* */
HRESULT WINAPI IWineD3DCubeTextureImpl_GetLevelDesc(IWineD3DCubeTexture *iface, UINT Level, WINED3DSURFACE_DESC* pDesc) {
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
if (Level < This->baseTexture.levels) {
TRACE("(%p) level (%d)\n", This, Level);
return IWineD3DSurface_GetDesc((IWineD3DSurface *) This->surfaces[0][Level], pDesc);
......@@ -277,7 +277,7 @@ HRESULT WINAPI IWineD3DCubeTextureImpl_UnlockRect(IWineD3DCubeTexture *iface, D3
HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture *iface, D3DCUBEMAP_FACES FaceType, CONST RECT* pDirtyRect) {
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
This->baseTexture.dirty = TRUE;
TRACE("(%p) : dirtyfication of faceType(%d) Level (0)\n", This, FaceType);
TRACE("(%p) : dirtyfication of faceType(%d) Level (0)\n", This, FaceType);
return IWineD3DSurface_AddDirtyRect((IWineD3DSurface *) This->surfaces[FaceType][0], pDirtyRect);
}
......@@ -298,7 +298,7 @@ const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
IWineD3DCubeTextureImpl_GetPriority,
IWineD3DCubeTextureImpl_PreLoad,
IWineD3DCubeTextureImpl_GetType,
/*base texture */
/* IWineD3DBaseTexture */
IWineD3DCubeTextureImpl_SetLOD,
IWineD3DCubeTextureImpl_GetLOD,
IWineD3DCubeTextureImpl_GetLevelCount,
......@@ -309,8 +309,8 @@ const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
IWineD3DCubeTextureImpl_GetDirty,
IWineD3DCubeTextureImpl_BindTexture,
IWineD3DCubeTextureImpl_UnBindTexture,
IWineD3DCubeTextureImpl_GetTextureDimensions,
/* cube texture */
IWineD3DCubeTextureImpl_GetTextureDimensions,
/* IWineD3DCubeTexture */
IWineD3DCubeTextureImpl_GetLevelDesc,
IWineD3DCubeTextureImpl_GetCubeMapSurface,
IWineD3DCubeTextureImpl_LockRect,
......
......@@ -54,9 +54,9 @@ inline static Display *get_display( HDC hdc )
static unsigned int emulated_textureram = 64*1024*1024;
/* helper macros */
#define D3DMEMCHECK(object, ppResult) if(NULL == object){ *ppResult = NULL; WARN("Out of memory\n"); return D3DERR_OUTOFVIDEOMEMORY;}
#define D3DMEMCHECK(object, ppResult) if(NULL == object) { *ppResult = NULL; WARN("Out of memory\n"); return D3DERR_OUTOFVIDEOMEMORY;}
#define D3DCREATEOBJECTINSTANCE(object, type){ \
#define D3DCREATEOBJECTINSTANCE(object, type) { \
object=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3D##type##Impl)); \
D3DMEMCHECK(object, pp##type); \
object->lpVtbl = &IWineD3D##type##_Vtbl; \
......@@ -227,13 +227,13 @@ void WINAPI IWineD3DDeviceImpl_SetupTextureStates(IWineD3DDevice *iface, DWORD S
skip = TRUE;
break;
/* Performance: If the texture states only impact settings for the texture unit
/* Performance: If the texture states only impact settings for the texture unit
(compared to the texture object) then there is no need to reapply them. The
only time they need applying is the first time, since we cheat and put the
values into the stateblock without applying.
only time they need applying is the first time, since we cheat and put the
values into the stateblock without applying.
Per-texture unit: texture function (eg. combine), ops and args
texture env color
texture generation settings
texture env color
texture generation settings
Note: Due to some special conditions there may be a need to do particular ones
of these, which is what the Flags allows */
case WINED3DTSS_COLOROP:
......@@ -278,7 +278,7 @@ void WINAPI IWineD3DDeviceImpl_SetupTextureStates(IWineD3DDevice *iface, DWORD S
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
TRACE("-----------------------> Updated the texture at stage %ld to have new texture state information\n", Stage);
TRACE("-----------------------> Updated the texture at stage %ld to have new texture state information\n", Stage);
}
/**********************************************************
......@@ -289,15 +289,15 @@ HRESULT WINAPI IWineD3DDeviceImpl_QueryInterface(IWineD3DDevice *iface,REFIID ri
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/* FIXME: This needs to extend an IWineD3DBaseObject */
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
if (IsEqualGUID(riid, &IID_IUnknown)
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IWineD3DDevice)) {
IUnknown_AddRef(iface);
*ppobj = This;
return D3D_OK;
}
return E_NOINTERFACE;
}
......@@ -317,7 +317,7 @@ ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
if (!refCount) {
/* TODO: Clean up all the surfaces and textures! */
/* FIXME: Create targets and state blocks in d3d8 */
/* FIXME: Create targets and state blocks in d3d8 */
if (((IWineD3DImpl *)This->wineD3D)->dxVersion > 8) { /*We don't create a state block in d3d8 yet*/
/* NOTE: You must release the parent if the object was created via a callback
** ***************************/
......@@ -325,7 +325,7 @@ ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
IUnknown* swapChainParent;
/* Release all of the swapchains, except the implicit swapchain (#0) */
for(i = 1; i < This->numberOfSwapChains; i++){
for(i = 1; i < This->numberOfSwapChains; i++) {
/* TODO: don't access swapchains[x] directly! */
IWineD3DSwapChain_Release(This->swapchains[i]);
}
......@@ -339,7 +339,7 @@ ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
/* TODO: don't access swapchains[x] directly!, check that there are no-more swapchains left for this device! */
IWineD3DSwapChain_GetParent(This->swapchains[0], &swapChainParent);
IUnknown_Release(swapChainParent); /* once for the get parent */
if (IUnknown_Release(swapChainParent) > 0){ /* the second time for when it was created */
if (IUnknown_Release(swapChainParent) > 0) { /* the second time for when it was created */
FIXME("(%p) Something's still holding the implicit swapchain\n",This);
}
}
......@@ -404,13 +404,13 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface, UINT
}
HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, D3DSTATEBLOCKTYPE Type, IWineD3DStateBlock** ppStateBlock, IUnknown *parent) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DStateBlockImpl *object;
int i,j;
D3DCREATEOBJECTINSTANCE(object, StateBlock)
object->blockType = Type;
object->blockType = Type;
/* Special case - Used during initialization to produce a placeholder stateblock
so other functions called can update a state block */
......@@ -423,7 +423,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, D3DSTA
/* Otherwise, might as well set the whole state block to the appropriate values */
IWineD3DDevice_AddRef(iface);
/* Otherwise, might as well set the whole state block to the appropriate values */
if ( This->stateBlock != NULL){
if ( This->stateBlock != NULL) {
memcpy(object, This->stateBlock, sizeof(IWineD3DStateBlockImpl));
} else {
memset(object->streamFreq, 1, sizeof(object->streamFreq));
......@@ -453,8 +453,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, D3DSTA
}
}
/* Setting sampler block changes states */
for (j = 0 ; j < GL_LIMITS(samplers); j++){
for (i =0; i < NUM_SAVEDPIXELSTATES_S;i++){
for (j = 0 ; j < GL_LIMITS(samplers); j++) {
for (i =0; i < NUM_SAVEDPIXELSTATES_S;i++) {
object->changed.samplerState[j][SavedPixelStates_S[i]] = TRUE;
}
......@@ -474,8 +474,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, D3DSTA
}
}
/* Setting sampler block changes states */
for (j = 0 ; j < GL_LIMITS(samplers); j++){
for (i =0; i < NUM_SAVEDVERTEXSTATES_S;i++){
for (j = 0 ; j < GL_LIMITS(samplers); j++) {
for (i =0; i < NUM_SAVEDVERTEXSTATES_S;i++) {
object->changed.samplerState[j][SavedVertexStates_S[i]] = TRUE;
}
}
......@@ -547,7 +547,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Wid
/**
* TODO: Discard MSDN
* [in] Set this flag to TRUE to enable z-buffer discarding, and FALSE otherwise.
* [in] Set this flag to TRUE to enable z-buffer discarding, and FALSE otherwise.
*
* If this flag is set, the contents of the depth stencil buffer will be
* invalid after calling either IDirect3DDevice9::Present or * IDirect3DDevice9::SetDepthStencilSurface
......@@ -555,13 +555,13 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Wid
*
*This flag has the same behavior as the constant, D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL, in D3DPRESENTFLAG.
***************************/
if(MultisampleQuality < 0) {
FIXME("Invalid multisample level %ld \n", MultisampleQuality);
if(MultisampleQuality < 0) {
FIXME("Invalid multisample level %ld \n", MultisampleQuality);
return D3DERR_INVALIDCALL; /* TODO: Check that this is the case! */
}
if(MultisampleQuality > 0){
if(MultisampleQuality > 0) {
FIXME("MultisampleQuality set to %ld, substituting 0 \n" , MultisampleQuality);
MultisampleQuality=0;
}
......@@ -654,18 +654,18 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, UINT Wid
if(Usage == D3DUSAGE_DYNAMIC) FIXME("Create surface called with a pool of MANAGED and a \
Usage of DYNAMIC which are mutually exclusive, not doing \
anything just telling you.\n");
break;
break;
case D3DPOOL_DEFAULT: /*TODO: Create offscreen plain can cause this check to fail..., find out if it should */
if(!(Usage & D3DUSAGE_DYNAMIC) && !(Usage & D3DUSAGE_RENDERTARGET)
&& !(Usage && D3DUSAGE_DEPTHSTENCIL ) && Lockable == TRUE)
FIXME("Creating a surface with a POOL of DEFAULT with Locable true, that doesn't specify DYNAMIC usage.\n");
break;
default:
default:
FIXME("(%p) Unknown pool %d\n", This, Pool);
break;
};
if (Usage & D3DUSAGE_RENDERTARGET && Pool != D3DPOOL_DEFAULT){
if (Usage & D3DUSAGE_RENDERTARGET && Pool != D3DPOOL_DEFAULT) {
FIXME("Trying to create a render target that isn't in the default pool\n");
}
......@@ -688,7 +688,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, UINT Wid
D3DCB_CREATESURFACEFN D3DCB_CreateSurface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DTextureImpl *object;
IWineD3DTextureImpl *object;
unsigned int i;
UINT tmpW;
UINT tmpH;
......@@ -714,19 +714,19 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, UINT Wid
}
TRACE("Calculated levels = %d\n", object->baseTexture.levels);
}
/* Generate all the surfaces */
tmpW = Width;
tmpH = Height;
for (i = 0; i < object->baseTexture.levels; i++)
for (i = 0; i < object->baseTexture.levels; i++)
{
/* use the callback to create the texture surface */
hr = D3DCB_CreateSurface(This->parent, tmpW, tmpH, Format, Usage, Pool, i, &object->surfaces[i],NULL);
if(hr!= D3D_OK){
if(hr!= D3D_OK) {
int j;
FIXME("Failed to create surface %p \n",object);
/* clean up */
for(j=0;j<i;j++){
for(j = 0 ; j < i ; j++) {
IWineD3DSurface_Release(object->surfaces[j]);
}
/* heap free object */
......@@ -735,22 +735,22 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateTexture(IWineD3DDevice *iface, UINT Wid
*ppTexture = NULL;
return hr;
}
IWineD3DSurface_SetContainer(object->surfaces[i], (IUnknown *)object);
TRACE("Created surface level %d @ %p\n", i, object->surfaces[i]);
/* calculate the next mipmap level */
tmpW = max(1, tmpW >> 1);
tmpH = max(1, tmpH >> 1);
}
TRACE("(%p) : Created texture %p\n", This, object);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface,
UINT Width, UINT Height, UINT Depth,
UINT Levels, DWORD Usage,
WINED3DFORMAT Format, D3DPOOL Pool,
HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface,
UINT Width, UINT Height, UINT Depth,
UINT Levels, DWORD Usage,
WINED3DFORMAT Format, D3DPOOL Pool,
IWineD3DVolumeTexture** ppVolumeTexture,
HANDLE* pSharedHandle, IUnknown *parent,
D3DCB_CREATEVOLUMEFN D3DCB_CreateVolume) {
......@@ -764,7 +764,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface,
D3DCREATERESOURCEOBJECTINSTANCE(object, VolumeTexture, D3DRTYPE_VOLUMETEXTURE, 0);
D3DINITILIZEBASETEXTURE(object->baseTexture);
TRACE("(%p) : W(%d) H(%d) D(%d), Lvl(%d) Usage(%ld), Fmt(%u,%s), Pool(%s)\n", This, Width, Height,
Depth, Levels, Usage, Format, debug_d3dformat(Format), debug_d3dpool(Pool));
......@@ -792,10 +792,10 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface,
tmpH = Height;
tmpD = Depth;
for (i = 0; i < object->baseTexture.levels; i++)
for (i = 0; i < object->baseTexture.levels; i++)
{
/* Create the volume */
D3DCB_CreateVolume(This->parent, Width, Height, Depth, Format, Pool, Usage,
D3DCB_CreateVolume(This->parent, Width, Height, Depth, Format, Pool, Usage,
(IWineD3DVolume **)&object->volumes[i], pSharedHandle);
IWineD3DVolume_SetContainer(object->volumes[i], (IUnknown *)object);
......@@ -809,10 +809,10 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *iface,
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface,
UINT Width, UINT Height, UINT Depth,
DWORD Usage,
WINED3DFORMAT Format, D3DPOOL Pool,
HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface,
UINT Width, UINT Height, UINT Depth,
DWORD Usage,
WINED3DFORMAT Format, D3DPOOL Pool,
IWineD3DVolume** ppVolume,
HANDLE* pSharedHandle, IUnknown *parent) {
......@@ -837,9 +837,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface,
return IWineD3DVolume_CleanDirtyBox((IWineD3DVolume *) object);
}
HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT EdgeLength,
UINT Levels, DWORD Usage,
WINED3DFORMAT Format, D3DPOOL Pool,
HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT EdgeLength,
UINT Levels, DWORD Usage,
WINED3DFORMAT Format, D3DPOOL Pool,
IWineD3DCubeTexture** ppCubeTexture,
HANDLE* pSharedHandle, IUnknown *parent,
D3DCB_CREATESURFACEFN D3DCB_CreateSurface) {
......@@ -854,7 +854,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT
D3DINITILIZEBASETEXTURE(object->baseTexture);
TRACE("(%p) Create Cube Texture \n", This);
object->edgeLength = EdgeLength;
/* Calculate levels for mip mapping */
......@@ -874,11 +874,11 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT
/* Create the 6 faces */
for (j = 0; j < 6; j++) {
hr=D3DCB_CreateSurface(This->parent, tmpW, tmpW, Format, Usage, Pool,
i /* Level */, &object->surfaces[j][i],pSharedHandle);
if(hr!= D3D_OK){
if(hr!= D3D_OK) {
/* clean up */
int k;
int l;
......@@ -907,15 +907,15 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface, UINT
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINED3DQUERYTYPE Type, IWineD3DQuery **ppQuery, IUnknown* parent){
HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINED3DQUERYTYPE Type, IWineD3DQuery **ppQuery, IUnknown* parent) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DQueryImpl *object; /*NOTE: impl ref allowed since this is a create function */
if(NULL == ppQuery){
if(NULL == ppQuery) {
/* Just a check to see if we support this type of query */
HRESULT hr = D3DERR_NOTAVAILABLE;
/* Lie and say everything is good (we can return ok fake data from a stub) */
switch(Type){
switch(Type) {
case WINED3DQUERYTYPE_VCACHE:
case WINED3DQUERYTYPE_RESOURCEMANAGER:
case WINED3DQUERYTYPE_VERTEXSTATS:
......@@ -933,7 +933,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINED3DQUER
hr = D3D_OK;
break;
default:
FIXME("(%p) Unhandled query type %d\n",This , Type);
FIXME("(%p) Unhandled query type %d\n",This , Type);
}
FIXME("(%p) : Stub request for query type %d returned %ld\n", This, Type, hr);
return hr;
......@@ -950,7 +950,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINED3DQUER
HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevice* iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters, IWineD3DSwapChain** ppSwapChain,
IUnknown* parent,
D3DCB_CREATERENDERTARGETFN D3DCB_CreateRenderTarget,
D3DCB_CREATEDEPTHSTENCILSURFACEFN D3DCB_CreateDepthStencil){
D3DCB_CREATEDEPTHSTENCILSURFACEFN D3DCB_CreateDepthStencil) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
HDC hDc;
......@@ -1026,7 +1026,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevice* ifac
TRACE("Using x visual ID : %ld\n", template.visualid);
TRACE(" visual info: %p\n", object->visInfo);
TRACE(" num items : %d\n", num);
for(n = 0;n < num; n++){
for(n = 0;n < num; n++) {
TRACE("=====item=====: %d\n", n + 1);
TRACE(" visualid : %ld\n", object->visInfo[n].visualid);
TRACE(" screen : %d\n", object->visInfo[n].screen);
......@@ -1244,7 +1244,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevice* ifac
object->drawable = object->win;
object->render_ctx = object->glCtx;
if(hr == D3D_OK){
if(hr == D3D_OK) {
/*********************
* Setup some defaults and clear down the buffers
*******************/
......@@ -1308,14 +1308,14 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevice* ifac
if (object->frontBuffer) {
IWineD3DSurface_GetParent(object->frontBuffer, &bufferParent);
IUnknown_Release(bufferParent); /* once for the get parent */
if(IUnknown_Release(bufferParent) > 0){
if(IUnknown_Release(bufferParent) > 0) {
FIXME("(%p) Something's still holding the front buffer\n",This);
}
}
if (object->backBuffer) {
IWineD3DSurface_GetParent(object->backBuffer, &bufferParent);
IUnknown_Release(bufferParent); /* once for the get parent */
if(IUnknown_Release(bufferParent) > 0){
if(IUnknown_Release(bufferParent) > 0) {
FIXME("(%p) Something's still holding the back buffer\n",This);
}
}
......@@ -1323,7 +1323,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevice* ifac
/* Clean up the context */
/* check that we are the current context first (we shouldn't be though!) */
if (object->glCtx != 0) {
if(glXGetCurrentContext() == object->glCtx){
if(glXGetCurrentContext() == object->glCtx) {
glXMakeCurrent(object->display, None, NULL);
}
glXDestroyContext(object->display, object->glCtx);
......@@ -1347,7 +1347,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetSwapChain(IWineD3DDevice *iface, UINT iSw
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : swapchain %d \n", This, iSwapChain);
if(iSwapChain >= IWineD3DDeviceImpl_GetNumberOfSwapChains(iface) || iSwapChain < 0){
if(iSwapChain >= IWineD3DDeviceImpl_GetNumberOfSwapChains(iface) || iSwapChain < 0) {
*pSwapChain = NULL;
return D3DERR_INVALIDCALL;
}else{
......@@ -1362,12 +1362,12 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetSwapChain(IWineD3DDevice *iface, UINT iSw
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters){
HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice* iface, WINED3DPRESENT_PARAMETERS* pPresentationParameters) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
FIXME("(%p) : Stub\n",This);
return D3D_OK;
}
/*****
......@@ -1387,31 +1387,31 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclaration(IWineD3DDevice* iface,
}
/* http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/graphics/programmingguide/programmable/vertexshaders/vscreate.asp */
HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice* iface, CONST DWORD* pFunction, IWineD3DVertexShader** ppVertexShader, IUnknown *parent){
HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice* iface, CONST DWORD* pFunction, IWineD3DVertexShader** ppVertexShader, IUnknown *parent) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DVertexShaderImpl *object; /* NOTE: impl usage is ok, this is a create */
D3DCREATEOBJECTINSTANCE(object, VertexShader)
D3DCREATEOBJECTINSTANCE(object, VertexShader)
object->function = pFunction;
FIXME("(%p) : STUB: Created Vertex shader %p\n", This, ppVertexShader);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice* iface, CONST DWORD* pFunction, IWineD3DPixelShader** ppPixelShader, IUnknown *parent){
HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice* iface, CONST DWORD* pFunction, IWineD3DPixelShader** ppPixelShader, IUnknown *parent) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
FIXME("(%p) : Stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetDirect3D(IWineD3DDevice* iface, IWineD3D** ppD3D){
HRESULT WINAPI IWineD3DDeviceImpl_GetDirect3D(IWineD3DDevice* iface, IWineD3D** ppD3D) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
*ppD3D= This->wineD3D;
TRACE("(%p) : wineD3D returning %p\n", This, *ppD3D);
IWineD3D_AddRef(*ppD3D);
return D3D_OK;
}
UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *iface) {
/** NOTE: There's a probably a hack-around for this one by putting as many pbuffers, VBO's (or whatever)
* Into the video ram as possible and seeing how many fit
......@@ -1507,23 +1507,22 @@ http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c_Summ
The divider is a bit odd though
VertexOffset = StartVertex / Divider * StreamStride +
VertexOffset = StartVertex / Divider * StreamStride +
VertexIndex / Divider * StreamStride + StreamOffset
*/
HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSourceFreq(IWineD3DDevice *iface, UINT StreamNumber, UINT Divider){
HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSourceFreq(IWineD3DDevice *iface, UINT StreamNumber, UINT Divider) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSourceFreq(IWineD3DDevice *iface, UINT StreamNumber, UINT* Divider){
HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSourceFreq(IWineD3DDevice *iface, UINT StreamNumber, UINT* Divider) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
/*****
......@@ -1564,7 +1563,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, D3DTRANS
where ViewMat = Camera space, WorldMat = world space.
In OpenGL, camera and world space is combined into GL_MODELVIEW
matrix. The Projection matrix stay projection matrix.
matrix. The Projection matrix stay projection matrix.
*/
/* Capture the times we can just ignore the change for now */
......@@ -1576,13 +1575,13 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, D3DTRANS
This->proj_valid = FALSE;
return D3D_OK;
} else if (d3dts >= D3DTS_WORLDMATRIX(1) && d3dts <= D3DTS_WORLDMATRIX(255)) {
} else if (d3dts >= D3DTS_WORLDMATRIX(1) && d3dts <= D3DTS_WORLDMATRIX(255)) {
/* Indexed Vertex Blending Matrices 256 -> 511 */
/* Use arb_vertex_blend or NV_VERTEX_WEIGHTING? */
FIXME("D3DTS_WORLDMATRIX(1..255) not handled\n");
return D3D_OK;
}
}
/* Now we really are going to have to change a matrix */
ENTER_GL();
......@@ -1590,22 +1589,22 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, D3DTRANS
if (d3dts < GL_LIMITS(textures)) {
int tex = d3dts - D3DTS_TEXTURE0;
GLACTIVETEXTURE(tex);
set_texture_matrix((float *)lpmatrix,
set_texture_matrix((float *)lpmatrix,
This->updateStateBlock->textureState[tex][WINED3DTSS_TEXTURETRANSFORMFLAGS]);
}
} else if (d3dts == D3DTS_VIEW) { /* handle the VIEW matrice */
unsigned int k;
/* If we are changing the View matrix, reset the light and clipping planes to the new view
/* If we are changing the View matrix, reset the light and clipping planes to the new view
* NOTE: We have to reset the positions even if the light/plane is not currently
* enabled, since the call to enable it will not reset the position.
* enabled, since the call to enable it will not reset the position.
* NOTE2: Apparently texture transforms do NOT need reapplying
*/
PLIGHTINFOEL *lightChain = NULL;
This->modelview_valid = FALSE;
This->view_ident = !memcmp(lpmatrix, identity, 16*sizeof(float));
This->view_ident = !memcmp(lpmatrix, identity, 16 * sizeof(float));
glMatrixMode(GL_MODELVIEW);
checkGLcall("glMatrixMode(GL_MODELVIEW)");
......@@ -1652,7 +1651,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface, D3DTR
/* Note: Using 'updateStateBlock' rather than 'stateblock' in the code
* below means it will be recorded in a state block change, but it
* works regardless where it is recorded.
* works regardless where it is recorded.
* If this is found to be wrong, change to StateBlock.
*/
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
......@@ -1700,7 +1699,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_MultiplyTransform(IWineD3DDevice *iface, D3DTR
one point in time! Therefore since the indexes can be anything, we need a linked list of them.
However, this causes stateblock problems. When capturing the state block, I duplicate the list,
but when recording, just build a chain pretty much of commands to be replayed. */
HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD Index, CONST WINED3DLIGHT* pLight) {
float rho;
PLIGHTINFOEL *object, *temp;
......@@ -1746,7 +1745,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD Index, C
object->OriginalIndex = Index;
object->glIndex = -1;
/* Add it to the front of list with the idea that lights will be changed as needed
/* Add it to the front of list with the idea that lights will be changed as needed
BUT after any lights currently assigned GL indexes */
insertAt = This->stateBlock->lights;
prevPos = NULL;
......@@ -1850,9 +1849,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetLight(IWineD3DDevice *iface, DWORD Index, C
HRESULT WINAPI IWineD3DDeviceImpl_GetLight(IWineD3DDevice *iface, DWORD Index, WINED3DLIGHT* pLight) {
PLIGHTINFOEL *lightInfo = NULL;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : Idx(%ld), pLight(%p)\n", This, Index, pLight);
/* Locate the light in the live lights */
lightInfo = This->stateBlock->lights;
while (lightInfo != NULL && lightInfo->OriginalIndex != Index) lightInfo = lightInfo->next;
......@@ -1867,7 +1866,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetLight(IWineD3DDevice *iface, DWORD Index, W
}
/*****
* Get / Set Light Enable
* Get / Set Light Enable
* (Note for consistency, renamed d3dx function by adding the 'set' prefix)
*****/
HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, DWORD Index, BOOL Enable) {
......@@ -1906,7 +1905,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, DWORD In
D3DLIGHT9 lightParms;
/* Warning - untested code :-) Prob safe to change fixme to a trace but
wait until someone confirms it seems to work! */
TRACE("Light enabled requested but light not defined, so defining one!\n");
TRACE("Light enabled requested but light not defined, so defining one!\n");
lightParms.Type = D3DLIGHT_DIRECTIONAL;
lightParms.Diffuse.r = 1.0;
lightParms.Diffuse.g = 1.0;
......@@ -2054,7 +2053,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, DWORD In
gl lights, setup a new light */
} else if (pos->glIndex == -1) {
/* We reached the end of the allocated gl lights, so already
/* We reached the end of the allocated gl lights, so already
know the index of the next one! */
glIndex = Index;
lightInfo->glIndex = glIndex;
......@@ -2090,7 +2089,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, DWORD In
glEnable(GL_LIGHT0 + glIndex);
checkGLcall("glEnable GL_LIGHT0 new setup");
LEAVE_GL();
}
}
}
......@@ -2100,9 +2099,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetLightEnable(IWineD3DDevice *iface, DWORD In
HRESULT WINAPI IWineD3DDeviceImpl_GetLightEnable(IWineD3DDevice *iface, DWORD Index,BOOL* pEnable) {
PLIGHTINFOEL *lightInfo = NULL;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : for idx(%ld)\n", This, Index);
/* Locate the light in the live lights */
lightInfo = This->stateBlock->lights;
while (lightInfo != NULL && lightInfo->OriginalIndex != Index) lightInfo = lightInfo->next;
......@@ -2150,10 +2149,10 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWORD Inde
glPushMatrix();
glLoadMatrixf((float *) &This->stateBlock->transforms[D3DTS_VIEW].u.m[0][0]);
TRACE("Clipplane [%f,%f,%f,%f]\n",
This->updateStateBlock->clipplane[Index][0],
TRACE("Clipplane [%f,%f,%f,%f]\n",
This->updateStateBlock->clipplane[Index][0],
This->updateStateBlock->clipplane[Index][1],
This->updateStateBlock->clipplane[Index][2],
This->updateStateBlock->clipplane[Index][2],
This->updateStateBlock->clipplane[Index][3]);
glClipPlane(GL_CLIP_PLANE0 + Index, This->updateStateBlock->clipplane[Index]);
checkGLcall("glClipPlane");
......@@ -2198,7 +2197,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetClipStatus(IWineD3DDevice *iface, CONST W
HRESULT WINAPI IWineD3DDeviceImpl_GetClipStatus(IWineD3DDevice *iface, WINED3DCLIPSTATUS* pClipStatus) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
FIXME("(%p) : stub\n", This);
FIXME("(%p) : stub\n", This);
if (NULL == pClipStatus) {
return D3DERR_INVALIDCALL;
}
......@@ -2268,7 +2267,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetMaterial(IWineD3DDevice *iface, WINED3DMATE
/*****
* Get / Set Indices
*****/
HRESULT WINAPI IWineD3DDeviceImpl_SetIndices(IWineD3DDevice *iface, IWineD3DIndexBuffer* pIndexData,
HRESULT WINAPI IWineD3DDeviceImpl_SetIndices(IWineD3DDevice *iface, IWineD3DIndexBuffer* pIndexData,
UINT BaseVertexIndex) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DIndexBuffer *oldIdxs;
......@@ -2296,7 +2295,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetIndices(IWineD3DDevice *iface, IWineD3DInde
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
*ppIndexData = This->stateBlock->pIndexData;
/* up ref count on ppindexdata */
if (*ppIndexData) IWineD3DIndexBuffer_AddRef(*ppIndexData);
*pBaseVertexIndex = This->stateBlock->baseVertexIndex;
......@@ -2330,8 +2329,10 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetViewport(IWineD3DDevice *iface, CONST WINED
checkGLcall("glDepthRange");
/* Note: GL requires lower left, DirectX supplies upper left */
/* TODO: replace usage of renderTarget with context management */
glViewport(pViewport->X, (((IWineD3DSurfaceImpl *)This->renderTarget)->currentDesc.Height - (pViewport->Y + pViewport->Height)),
pViewport->Width, pViewport->Height);
glViewport(pViewport->X,
(((IWineD3DSurfaceImpl *)This->renderTarget)->currentDesc.Height - (pViewport->Y + pViewport->Height)),
pViewport->Width, pViewport->Height);
checkGLcall("glViewport");
LEAVE_GL();
......@@ -2355,13 +2356,13 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
DWORD OldValue = This->stateBlock->renderState[State];
/* Simple way of referring to either a DWORD or a 4 byte float */
union {
DWORD d;
float f;
} tmpvalue;
TRACE("(%p)->state = %s(%d), value = %ld\n", This, debug_d3drenderstate(State), State, Value);
This->updateStateBlock->changed.renderState[State] = TRUE;
This->updateStateBlock->set.renderState[State] = TRUE;
......@@ -2420,7 +2421,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
case WINED3DRS_CULLMODE :
/* If we are culling "back faces with clockwise vertices" then
set front faces to be counter clockwise and enable culling
set front faces to be counter clockwise and enable culling
of back faces */
switch ((D3DCULL) Value) {
case D3DCULL_NONE:
......@@ -2443,7 +2444,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
glEnable(GL_CULL_FACE);
checkGLcall("glEnable GL_CULL_FACE");
if (This->renderUpsideDown) {
glFrontFace(GL_CCW);
glFrontFace(GL_CCW);
checkGLcall("glFrontFace GL_CCW");
} else {
glFrontFace(GL_CW);
......@@ -2629,7 +2630,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
/* Ensure we only do the changed clip planes */
DWORD enable = 0xFFFFFFFF;
DWORD disable = 0x00000000;
/* If enabling / disabling all */
if (State == WINED3DRS_CLIPPING) {
if (Value) {
......@@ -2643,14 +2644,14 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
enable = Value & ~OldValue;
disable = ~Value & OldValue;
}
if (enable & D3DCLIPPLANE0) { glEnable(GL_CLIP_PLANE0); checkGLcall("glEnable(clip plane 0)"); }
if (enable & D3DCLIPPLANE1) { glEnable(GL_CLIP_PLANE1); checkGLcall("glEnable(clip plane 1)"); }
if (enable & D3DCLIPPLANE2) { glEnable(GL_CLIP_PLANE2); checkGLcall("glEnable(clip plane 2)"); }
if (enable & D3DCLIPPLANE3) { glEnable(GL_CLIP_PLANE3); checkGLcall("glEnable(clip plane 3)"); }
if (enable & D3DCLIPPLANE4) { glEnable(GL_CLIP_PLANE4); checkGLcall("glEnable(clip plane 4)"); }
if (enable & D3DCLIPPLANE5) { glEnable(GL_CLIP_PLANE5); checkGLcall("glEnable(clip plane 5)"); }
if (disable & D3DCLIPPLANE0) { glDisable(GL_CLIP_PLANE0); checkGLcall("glDisable(clip plane 0)"); }
if (disable & D3DCLIPPLANE1) { glDisable(GL_CLIP_PLANE1); checkGLcall("glDisable(clip plane 1)"); }
if (disable & D3DCLIPPLANE2) { glDisable(GL_CLIP_PLANE2); checkGLcall("glDisable(clip plane 2)"); }
......@@ -2692,7 +2693,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
{
unsigned int i;
/* Note the texture color applies to all textures whereas
/* Note the texture color applies to all textures whereas
GL_TEXTURE_ENV_COLOR applies to active only */
float col[4];
D3DCOLORTOGLFLOAT4(Value, col);
......@@ -2818,9 +2819,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
case WINED3DRS_STENCILFAIL :
{
GLenum fail ;
GLenum zpass ;
GLenum zfail ;
GLenum fail ;
GLenum zpass ;
GLenum zfail ;
fail = StencilOp(Value);
glGetIntegerv(GL_STENCIL_PASS_DEPTH_PASS, &zpass);
......@@ -2835,9 +2836,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
break;
case WINED3DRS_STENCILZFAIL :
{
GLenum fail ;
GLenum zpass ;
GLenum zfail ;
GLenum fail ;
GLenum zpass ;
GLenum zfail ;
glGetIntegerv(GL_STENCIL_FAIL, &fail);
checkGLcall("glGetIntegerv(GL_STENCIL_FAIL, &fail);");
......@@ -2852,9 +2853,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
break;
case WINED3DRS_STENCILPASS :
{
GLenum fail ;
GLenum zpass ;
GLenum zfail ;
GLenum fail ;
GLenum zpass ;
GLenum zfail ;
glGetIntegerv(GL_STENCIL_FAIL, &fail);
checkGLcall("glGetIntegerv(GL_STENCIL_FAIL, &fail);");
......@@ -2909,13 +2910,13 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
break;
case WINED3DRS_FOGTABLEMODE :
{
{
glHint(GL_FOG_HINT, GL_NICEST);
switch (Value) {
case D3DFOG_NONE: /* I don't know what to do here */ checkGLcall("glFogi(GL_FOG_MODE, GL_EXP"); break;
case D3DFOG_EXP: glFogi(GL_FOG_MODE, GL_EXP); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP"); break;
case D3DFOG_EXP2: glFogi(GL_FOG_MODE, GL_EXP2); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2"); break;
case D3DFOG_LINEAR: glFogi(GL_FOG_MODE, GL_LINEAR); checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR"); break;
case D3DFOG_NONE: /* I don't know what to do here */ checkGLcall("glFogi(GL_FOG_MODE, GL_EXP"); break;
case D3DFOG_EXP: glFogi(GL_FOG_MODE, GL_EXP); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP"); break;
case D3DFOG_EXP2: glFogi(GL_FOG_MODE, GL_EXP2); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2"); break;
case D3DFOG_LINEAR: glFogi(GL_FOG_MODE, GL_LINEAR); checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR"); break;
default:
FIXME("Unsupported Value(%lu) for WINED3DRS_FOGTABLEMODE!\n", Value);
}
......@@ -2926,13 +2927,13 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
break;
case WINED3DRS_FOGVERTEXMODE :
{
{
glHint(GL_FOG_HINT, GL_FASTEST);
switch (Value) {
case D3DFOG_NONE: /* I don't know what to do here */ checkGLcall("glFogi(GL_FOG_MODE, GL_EXP"); break;
case D3DFOG_EXP: glFogi(GL_FOG_MODE, GL_EXP); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP"); break;
case D3DFOG_EXP2: glFogi(GL_FOG_MODE, GL_EXP2); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2"); break;
case D3DFOG_LINEAR: glFogi(GL_FOG_MODE, GL_LINEAR); checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR"); break;
case D3DFOG_NONE: /* I don't know what to do here */ checkGLcall("glFogi(GL_FOG_MODE, GL_EXP"); break;
case D3DFOG_EXP: glFogi(GL_FOG_MODE, GL_EXP); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP"); break;
case D3DFOG_EXP2: glFogi(GL_FOG_MODE, GL_EXP2); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2"); break;
case D3DFOG_LINEAR: glFogi(GL_FOG_MODE, GL_LINEAR); checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR"); break;
default:
FIXME("Unsupported Value(%lu) for WINED3DRS_FOGTABLEMODE!\n", Value);
}
......@@ -3031,7 +3032,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
if (This->tracking_color != DISABLED_TRACKING) This->tracking_color = NEEDS_DISABLE;
}
}
break;
break;
case WINED3DRS_LINEPATTERN :
{
......@@ -3148,14 +3149,14 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
case WINED3DRS_COLORWRITEENABLE :
{
TRACE("Color mask: r(%d) g(%d) b(%d) a(%d)\n",
TRACE("Color mask: r(%d) g(%d) b(%d) a(%d)\n",
Value & D3DCOLORWRITEENABLE_RED ? 1 : 0,
Value & D3DCOLORWRITEENABLE_GREEN ? 1 : 0,
Value & D3DCOLORWRITEENABLE_BLUE ? 1 : 0,
Value & D3DCOLORWRITEENABLE_ALPHA ? 1 : 0);
glColorMask(Value & D3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
Value & D3DCOLORWRITEENABLE_ALPHA ? 1 : 0);
glColorMask(Value & D3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
Value & D3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
Value & D3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
Value & D3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
Value & D3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE);
checkGLcall("glColorMask(...)");
}
......@@ -3164,7 +3165,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
case WINED3DRS_LOCALVIEWER :
{
GLint state = (Value) ? 1 : 0;
TRACE("Local Viewer Enable to %ul\n", (BOOL) Value);
TRACE("Local Viewer Enable to %ul\n", (BOOL) Value);
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, state);
}
break;
......@@ -3172,9 +3173,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
case WINED3DRS_LASTPIXEL :
{
if (Value) {
TRACE("Last Pixel Drawing Enabled\n");
TRACE("Last Pixel Drawing Enabled\n");
} else {
FIXME("Last Pixel Drawing Disabled, not handled yet\n");
FIXME("Last Pixel Drawing Disabled, not handled yet\n");
}
}
break;
......@@ -3182,9 +3183,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
case WINED3DRS_SOFTWAREVERTEXPROCESSING :
{
if (Value) {
TRACE("Software Processing Enabled\n");
TRACE("Software Processing Enabled\n");
} else {
TRACE("Software Processing Disabled\n");
TRACE("Software Processing Disabled\n");
}
}
break;
......@@ -3233,7 +3234,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetRenderState(IWineD3DDevice *iface, D3DRENDE
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetSamplerState(IWineD3DDevice *iface, DWORD Sampler, WINED3DSAMPLERSTATETYPE Type, DWORD Value){
HRESULT WINAPI IWineD3DDeviceImpl_SetSamplerState(IWineD3DDevice *iface, DWORD Sampler, WINED3DSAMPLERSTATETYPE Type, DWORD Value) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/**
* SetSampler is designed to allow for more than the standard up to 8 textures
......@@ -3256,7 +3257,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetSamplerState(IWineD3DDevice *iface, DWORD S
TRACE("(%p) Sampler(%ld), Type(%d) Value(%ld)\n",This, Sampler ,Type, Value);
if(Sampler > GL_LIMITS(samplers) || Sampler < 0 || Type > HIGHEST_SAMPLER_STATE || Type < 0){
if(Sampler > GL_LIMITS(samplers) || Sampler < 0 || Type > HIGHEST_SAMPLER_STATE || Type < 0) {
FIXME("out of range %d %d sampler %ld type %u\n", GL_LIMITS(samplers), HIGHEST_SAMPLER_STATE, Sampler, Type);
return D3DERR_INVALIDCALL;
}
......@@ -3524,7 +3525,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetSamplerState(IWineD3DDevice *iface, DWORD S
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetSamplerState(IWineD3DDevice *iface, DWORD Sampler, WINED3DSAMPLERSTATETYPE Type, DWORD* Value){
HRESULT WINAPI IWineD3DDeviceImpl_GetSamplerState(IWineD3DDevice *iface, DWORD Sampler, WINED3DSAMPLERSTATETYPE Type, DWORD* Value) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/** TODO: check that sampler is in range **/
*Value = This->updateStateBlock->samplerState[Sampler][Type];
......@@ -3533,10 +3534,10 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetSamplerState(IWineD3DDevice *iface, DWORD S
}
HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, CONST RECT* pRect){
HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, CONST RECT* pRect) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
ENTER_GL();
/** FIXME: Windows uses a top,left origin openGL uses a bottom Right? **/
TRACE("(%p)Setting new Scissor Rect to %ld:%ld-%ld:%ld\n", This, pRect->left, pRect->top, pRect->right, pRect->bottom);
glScissor(pRect->left, pRect->top, pRect->right - pRect->left, pRect->bottom - pRect->top);
......@@ -3544,7 +3545,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, CONST RE
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetScissorRect(IWineD3DDevice *iface, RECT* pRect){
HRESULT WINAPI IWineD3DDeviceImpl_GetScissorRect(IWineD3DDevice *iface, RECT* pRect) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
GLint scissorBox[4];
......@@ -3554,7 +3555,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetScissorRect(IWineD3DDevice *iface, RECT* pR
pRect->left = scissorBox[1];
pRect->top = scissorBox[2];
pRect->right = scissorBox[1] + scissorBox[3];
pRect->bottom = scissorBox[2] + scissorBox[4];
pRect->bottom = scissorBox[2] + scissorBox[4];
TRACE("(%p)Returning a Scissor Rect of %ld:%ld-%ld:%ld\n", This, pRect->left, pRect->top, pRect->right, pRect->bottom);
LEAVE_GL();
return D3D_OK;
......@@ -3582,33 +3583,33 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetVertexDeclaration(IWineD3DDevice* iface, IW
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : ppDecl=%p\n", This, ppDecl);
*ppDecl = This->updateStateBlock->vertexDecl;
if (NULL != *ppDecl) IWineD3DVertexDeclaration_AddRef(*ppDecl);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, IWineD3DVertexShader* pShader){
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, IWineD3DVertexShader* pShader) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
static BOOL showFixmes = TRUE;
This->updateStateBlock->vertexShader = pShader;
This->updateStateBlock->changed.vertexShader = TRUE;
This->updateStateBlock->set.vertexShader = TRUE;
if(pShader == NULL){
if(pShader == NULL) {
/* clear down the shader */
TRACE("Clear down the shader\n");
}else{
if(showFixmes){
if(showFixmes) {
FIXME("(%p) : stub pShader(%p)\n", This, pShader);
showFixmes = FALSE;
}
}
return D3D_OK;
/** FIXME: refernece counting? **/
if (pShader == NULL) { /* only valid with non FVF shaders */
TRACE_(d3d_shader)("(%p) : FVF Shader, pShader=%p\n", This, pShader);
......@@ -3617,10 +3618,10 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, IWineD3
TRACE_(d3d_shader)("(%p) : Created shader, pShader=%p\n", This, pShader);
This->updateStateBlock->vertexShader = pShader;
}
This->updateStateBlock->changed.vertexShader = TRUE;
This->updateStateBlock->set.vertexShader = TRUE;
/* Handle recording of state blocks */
if (This->isRecordingState) {
TRACE("Recording... not performing anything\n");
......@@ -3630,10 +3631,10 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface, IWineD3
* TODO: merge HAL shaders context switching from prototype
*/
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface, IWineD3DVertexShader** ppShader){
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface, IWineD3DVertexShader** ppShader) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
*ppShader = This->stateBlock->vertexShader;
if(*ppShader != NULL)
......@@ -3642,93 +3643,93 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShader(IWineD3DDevice *iface, IWineD3
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, CONST BOOL *pConstantData, UINT BoolCount){
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, CONST BOOL *pConstantData, UINT BoolCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, BOOL *pConstantData, UINT BoolCount){
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, BOOL *pConstantData, UINT BoolCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, CONST int *pConstantData, UINT Vector4iCount){
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, CONST int *pConstantData, UINT Vector4iCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, int *pConstantData, UINT Vector4iCount){
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, int *pConstantData, UINT Vector4iCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, CONST float *pConstantData, UINT Vector4fCount){
HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, CONST float *pConstantData, UINT Vector4fCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, float *pConstantData, UINT Vector4fCount){
HRESULT WINAPI IWineD3DDeviceImpl_GetVertexShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, float *pConstantData, UINT Vector4fCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, IWineD3DPixelShader *pShader){
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, IWineD3DPixelShader *pShader) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3DDevice *iface, IWineD3DPixelShader **ppShader){
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShader(IWineD3DDevice *iface, IWineD3DPixelShader **ppShader) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, CONST BOOL *pConstantData, UINT BoolCount){
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, CONST BOOL *pConstantData, UINT BoolCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, BOOL *pConstantData, UINT BoolCount){
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantB(IWineD3DDevice *iface, UINT StartRegister, BOOL *pConstantData, UINT BoolCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, CONST int *pConstantData, UINT Vector4iCount){
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, CONST int *pConstantData, UINT Vector4iCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, int *pConstantData, UINT Vector4iCount){
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantI(IWineD3DDevice *iface, UINT StartRegister, int *pConstantData, UINT Vector4iCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, CONST float *pConstantData, UINT Vector4fCount){
HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, CONST float *pConstantData, UINT Vector4fCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, float *pConstantData, UINT Vector4fCount){
HRESULT WINAPI IWineD3DDeviceImpl_GetPixelShaderConstantF(IWineD3DDevice *iface, UINT StartRegister, float *pConstantData, UINT Vector4fCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IWineD3DVertexBuffer* pDestBuffer, IWineD3DVertexBuffer* pVertexDecl, DWORD Flags){
HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IWineD3DVertexBuffer* pDestBuffer, IWineD3DVertexBuffer* pVertexDecl, DWORD Flags) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
......@@ -3742,7 +3743,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/* FIXME: Handle 3d textures? What if TSS value set before set texture? Need to reapply all values? */
TRACE("(%p) : Stage=%ld, Type=%s(%d), Value=%ld\n", This, Stage, debug_d3dtexturestate(Type), Type, Value);
/* Reject invalid texture units */
......@@ -3794,7 +3795,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
} else {
glDisable(GL_TEXTURE_1D);
checkGLcall("Disable GL_TEXTURE_1D");
}
}
if (This->stateBlock->textureDimensions[Stage] == GL_TEXTURE_2D) {
if (GL_SUPPORT(NV_TEXTURE_SHADER) && This->texture_shader_active) {
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
......@@ -3854,19 +3855,19 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
switch (Value) {
case D3DTADDRESS_WRAP: wrapParm = GL_REPEAT; break;
case D3DTADDRESS_CLAMP: wrapParm = GL_CLAMP_TO_EDGE; break;
case D3DTADDRESS_BORDER:
case D3DTADDRESS_CLAMP: wrapParm = GL_CLAMP_TO_EDGE; break;
case D3DTADDRESS_BORDER:
{
if (GL_SUPPORT(ARB_TEXTURE_BORDER_CLAMP)) {
wrapParm = GL_CLAMP_TO_BORDER_ARB;
wrapParm = GL_CLAMP_TO_BORDER_ARB;
} else {
/* FIXME: Not right, but better */
FIXME("Unrecognized or unsupported D3DTADDRESS_* value %ld, state %d\n", Value, Type);
wrapParm = GL_REPEAT;
wrapParm = GL_REPEAT;
}
}
break;
case D3DTADDRESS_MIRROR:
case D3DTADDRESS_MIRROR:
{
if (GL_SUPPORT(ARB_TEXTURE_MIRRORED_REPEAT)) {
wrapParm = GL_MIRRORED_REPEAT_ARB;
......@@ -3877,20 +3878,20 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
}
}
break;
case D3DTADDRESS_MIRRORONCE:
case D3DTADDRESS_MIRRORONCE:
{
if (GL_SUPPORT(ATI_TEXTURE_MIRROR_ONCE)) {
wrapParm = GL_MIRROR_CLAMP_TO_EDGE_ATI;
} else {
FIXME("Unsupported D3DTADDRESS_MIRRORONCE (needs GL_ATI_texture_mirror_once) state %d\n", Type);
wrapParm = GL_REPEAT;
wrapParm = GL_REPEAT;
}
}
break;
default:
FIXME("Unrecognized or unsupported D3DTADDRESS_* value %ld, state %d\n", Value, Type);
wrapParm = GL_REPEAT;
wrapParm = GL_REPEAT;
}
TRACE("Setting WRAP_R to %d for %x\n", wrapParm, This->stateBlock->textureDimensions[Stage]);
......@@ -3904,16 +3905,16 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
/* Values 0-7 are indexes into the FVF tex coords - See comments in DrawPrimitive */
/* FIXME: From MSDN: The WINED3DTSS_TCI_* flags are mutually exclusive. If you include
one flag, you can still specify an index value, which the system uses to
determine the texture wrapping mode.
one flag, you can still specify an index value, which the system uses to
determine the texture wrapping mode.
eg. SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION | 1 );
means use the vertex position (camera-space) as the input texture coordinates
means use the vertex position (camera-space) as the input texture coordinates
for this texture stage, and the wrap mode set in the WINED3DRS_WRAP1 render
state. We do not (yet) support the D3DRENDERSTATE_WRAPx values, nor tie them up
to the TEXCOORDINDEX value */
/**
* Be careful the value of the mask 0xF0000 come from d3d8types.h infos
/**
* Be careful the value of the mask 0xF0000 come from d3d8types.h infos
*/
switch (Value & 0xFFFF0000) {
case D3DTSS_TCI_PASSTHRU:
......@@ -3925,8 +3926,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
break;
case D3DTSS_TCI_CAMERASPACEPOSITION:
/* CameraSpacePosition means use the vertex position, transformed to camera space,
as the input texture coordinates for this stage's texture transformation. This
/* CameraSpacePosition means use the vertex position, transformed to camera space,
as the input texture coordinates for this stage's texture transformation. This
equates roughly to EYE_LINEAR */
{
float s_plane[] = { 1.0, 0.0, 0.0, 0.0 };
......@@ -3943,7 +3944,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
glPopMatrix();
TRACE("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set GL_TEXTURE_GEN_x and GL_x, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR\n");
glEnable(GL_TEXTURE_GEN_S);
checkGLcall("glEnable(GL_TEXTURE_GEN_S);");
......@@ -3977,7 +3978,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
glPopMatrix();
glEnable(GL_TEXTURE_GEN_S);
checkGLcall("glEnable(GL_TEXTURE_GEN_S);");
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP_NV);
......@@ -4002,7 +4003,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
float r_plane[] = { 0.0, 0.0, 1.0, 0.0 };
float q_plane[] = { 0.0, 0.0, 0.0, 1.0 };
TRACE("WINED3DTSS_TCI_CAMERASPACEPOSITION - Set eye plane\n");
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
......@@ -4011,7 +4012,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
glTexGenfv(GL_R, GL_EYE_PLANE, r_plane);
glTexGenfv(GL_Q, GL_EYE_PLANE, q_plane);
glPopMatrix();
glEnable(GL_TEXTURE_GEN_S);
checkGLcall("glEnable(GL_TEXTURE_GEN_S);");
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_NV);
......@@ -4031,7 +4032,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
/* Unhandled types: */
default:
/* Todo: */
/* ? disable GL_TEXTURE_GEN_n ? */
/* ? disable GL_TEXTURE_GEN_n ? */
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_R);
......@@ -4044,7 +4045,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
/* Unhandled */
case WINED3DTSS_TEXTURETRANSFORMFLAGS :
set_texture_matrix((float *)&This->stateBlock->transforms[D3DTS_TEXTURE0 + Stage].u.m[0][0], Value);
break;
break;
case WINED3DTSS_BUMPENVMAT00 :
case WINED3DTSS_BUMPENVMAT01 :
......@@ -4085,7 +4086,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetTextureStageState(IWineD3DDevice *iface, DW
}
/*****
* Get / Set Texture
* Get / Set Texture
*****/
HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD Stage, IWineD3DBaseTexture* pTexture) {
......@@ -4139,7 +4140,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD Stage,
IUnknown_Release(textureParent); /** NOTE: Twice because GetParent adds a ref **/
oldTexture = NULL;
}
if (NULL != pTexture) {
IUnknown *textureParent;
......@@ -4237,7 +4238,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD Stage,
IWineD3DDeviceImpl_SetupTextureStates(iface, Stage, reapplyFlags);
}
LEAVE_GL();
LEAVE_GL();
TRACE("Texture now fully setup\n");
return D3D_OK;
......@@ -4255,7 +4256,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetTexture(IWineD3DDevice *iface, DWORD Stage,
/*****
* Get Back Buffer
*****/
HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UINT iSwapChain, UINT BackBuffer, D3DBACKBUFFER_TYPE Type,
HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UINT iSwapChain, UINT BackBuffer, D3DBACKBUFFER_TYPE Type,
IWineD3DSurface** ppBackBuffer) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSwapChain *swapChain;
......@@ -4264,7 +4265,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetBackBuffer(IWineD3DDevice *iface, UINT iSwa
TRACE("(%p) : BackBuf %d Type %d SwapChain %d returning %p\n", This, BackBuffer, Type, iSwapChain, *ppBackBuffer);
hr = IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapChain);
if(hr == D3D_OK){
if(hr == D3D_OK) {
hr = IWineD3DSwapChain_GetBackBuffer(swapChain, BackBuffer, Type, ppBackBuffer);
IWineD3DSwapChain_Release(swapChain);
}else{
......@@ -4302,24 +4303,24 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetDisplayMode(IWineD3DDevice *iface, UINT iSw
IWineD3DStateBlockImpl *object;
TRACE("(%p)", This);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DStateBlockImpl));
if(NULL == object ){
if(NULL == object ) {
FIXME("(%p)Error allocating memory for stateblock\n", This);
return E_OUTOFMEMORY;
}
TRACE("(%p) creted object %p\n", This, object);
object->wineD3DDevice= This;
object->wineD3DDevice= This;
/** FIXME: object->parent = parent; **/
object->parent = NULL;
object->blockType = D3DSBT_ALL;
object->blockType = D3DSBT_ALL;
object->ref = 1;
object->lpVtbl = &IWineD3DStateBlock_Vtbl;
object->lpVtbl = &IWineD3DStateBlock_Vtbl;
IWineD3DStateBlock_Release((IWineD3DStateBlock*)This->updateStateBlock);
This->updateStateBlock = object;
This->isRecordingState = TRUE;
TRACE("(%p) recording stateblock %p\n",This , object);
return D3D_OK;
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IWineD3DStateBlock** ppStateBlock) {
......@@ -4333,11 +4334,11 @@ HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IWineD3DS
*ppStateBlock = (IWineD3DStateBlock*)This->updateStateBlock;
This->isRecordingState = FALSE;
This->updateStateBlock = This->stateBlock;
This->updateStateBlock = This->stateBlock;
IWineD3DStateBlock_AddRef((IWineD3DStateBlock*)This->updateStateBlock);
/* IWineD3DStateBlock_AddRef(*ppStateBlock); don't need to do this, since we should really just release UpdateStateBlock first */
TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, *ppStateBlock);
return D3D_OK;
return D3D_OK;
}
/*****
......@@ -4360,7 +4361,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_EndScene(IWineD3DDevice *iface) {
checkGLcall("glFlush");
TRACE("End Scene\n");
if(This->renderTarget != NULL){
if(This->renderTarget != NULL) {
/* If the container of the rendertarget is a texture then we need to save the data from the pbuffer */
IUnknown *targetContainer = NULL;
......@@ -4376,7 +4377,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_EndScene(IWineD3DDevice *iface) {
IWineD3DSurface_SetPBufferState(This->renderTarget, FALSE /* inPBuffer */, FALSE /* inTexture */);
IUnknown_Release(targetContainer);
} else
if (D3D_OK == IWineD3DSurface_GetContainer(This->renderTarget, &IID_IWineD3DDevice, (void **)&targetContainer)){
if (D3D_OK == IWineD3DSurface_GetContainer(This->renderTarget, &IID_IWineD3DDevice, (void **)&targetContainer)) {
/* The surface is stand-alone, so doesn't currently have a context of it's own */
TRACE("(%p) : standalone rendertarget %p\n", This, This->renderTarget);
IWineD3DSurface_SetPBufferState(This->renderTarget, TRUE /* inPBuffer */, FALSE /* inTexture */);
......@@ -4392,8 +4393,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_EndScene(IWineD3DDevice *iface) {
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_Present(IWineD3DDevice *iface,
CONST RECT* pSourceRect, CONST RECT* pDestRect,
HRESULT WINAPI IWineD3DDeviceImpl_Present(IWineD3DDevice *iface,
CONST RECT* pSourceRect, CONST RECT* pDestRect,
HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DSwapChain *swapChain = NULL;
......@@ -4402,7 +4403,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_Present(IWineD3DDevice *iface,
TRACE("(%p) Presenting the frame\n", This);
for(i = 0 ; i < swapchains ; i ++){
for(i = 0 ; i < swapchains ; i ++) {
IWineD3DDeviceImpl_GetSwapChain(iface, i , (IWineD3DSwapChain **)&swapChain);
TRACE("presentinng chain %d, %p\n", i, swapChain);
......@@ -4413,7 +4414,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_Present(IWineD3DDevice *iface,
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Count, CONST D3DRECT* pRects,
HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Count, CONST D3DRECT* pRects,
DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
......@@ -4443,7 +4444,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Count, CONS
}
/* Only set the values up once, as they are not changing */
if (Flags & D3DCLEAR_STENCIL) {
if (Flags & D3DCLEAR_STENCIL) {
glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &old_stencil_clear_value);
glClearStencil(Stencil);
checkGLcall("glClearStencil");
......@@ -4453,7 +4454,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Count, CONS
if (Flags & D3DCLEAR_ZBUFFER) {
glGetBooleanv(GL_DEPTH_WRITEMASK, &old_ztest);
glDepthMask(GL_TRUE);
glDepthMask(GL_TRUE);
glGetFloatv(GL_DEPTH_CLEAR_VALUE, &old_z_clear_value);
glClearDepth(Z);
checkGLcall("glClearDepth");
......@@ -4463,9 +4464,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Count, CONS
if (Flags & D3DCLEAR_TARGET) {
TRACE("Clearing screen with glClear to color %lx\n", Color);
glGetFloatv(GL_COLOR_CLEAR_VALUE, old_color_clear_value);
glClearColor(((Color >> 16) & 0xFF) / 255.0f,
glClearColor(((Color >> 16) & 0xFF) / 255.0f,
((Color >> 8) & 0xFF) / 255.0f,
((Color >> 0) & 0xFF) / 255.0f,
((Color >> 0) & 0xFF) / 255.0f,
((Color >> 24) & 0xFF) / 255.0f);
checkGLcall("glClearColor");
......@@ -4481,15 +4482,15 @@ HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Count, CONS
/* Note gl uses lower left, width/height */
TRACE("(%p) %p Rect=(%ld,%ld)->(%ld,%ld) glRect=(%ld,%ld), len=%ld, hei=%ld\n", This, curRect,
curRect->x1, curRect->y1, curRect->x2, curRect->y2,
curRect->x1, (((IWineD3DSurfaceImpl *)This->renderTarget)->currentDesc.Height - curRect->y2),
curRect->x1, (((IWineD3DSurfaceImpl *)This->renderTarget)->currentDesc.Height - curRect->y2),
curRect->x2 - curRect->x1, curRect->y2 - curRect->y1);
glScissor(curRect->x1, (((IWineD3DSurfaceImpl *)This->renderTarget)->currentDesc.Height - curRect->y2),
glScissor(curRect->x1, (((IWineD3DSurfaceImpl *)This->renderTarget)->currentDesc.Height - curRect->y2),
curRect->x2 - curRect->x1, curRect->y2 - curRect->y1);
checkGLcall("glScissor");
} else {
glScissor(This->stateBlock->viewport.X,
(((IWineD3DSurfaceImpl *)This->renderTarget)->currentDesc.Height - (This->stateBlock->viewport.Y + This->stateBlock->viewport.Height)),
This->stateBlock->viewport.Width,
glScissor(This->stateBlock->viewport.X,
(((IWineD3DSurfaceImpl *)This->renderTarget)->currentDesc.Height - (This->stateBlock->viewport.Y + This->stateBlock->viewport.Height)),
This->stateBlock->viewport.Width,
This->stateBlock->viewport.Height);
checkGLcall("glScissor");
}
......@@ -4506,15 +4507,15 @@ HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Count, CONS
if (Flags & D3DCLEAR_STENCIL) {
glClearStencil(old_stencil_clear_value);
glStencilMask(This->stateBlock->renderState[WINED3DRS_STENCILWRITEMASK]);
}
}
if (Flags & D3DCLEAR_ZBUFFER) {
glDepthMask(old_ztest);
glClearDepth(old_z_clear_value);
}
if (Flags & D3DCLEAR_TARGET) {
glClearColor(old_color_clear_value[0],
glClearColor(old_color_clear_value[0],
old_color_clear_value[1],
old_color_clear_value[2],
old_color_clear_value[2],
old_color_clear_value[3]);
glColorMask(This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE] & D3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE] & D3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
......@@ -4532,14 +4533,14 @@ HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Count, CONS
/*****
* Drawing functions
*****/
HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex,
HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex,
UINT PrimitiveCount) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
This->stateBlock->streamIsUP = FALSE;
TRACE("(%p) : Type=(%d,%s), Start=%d, Count=%d\n", This, PrimitiveType,
debug_d3dprimitivetype(PrimitiveType),
TRACE("(%p) : Type=(%d,%s), Start=%d, Count=%d\n", This, PrimitiveType,
debug_d3dprimitivetype(PrimitiveType),
StartVertex, PrimitiveCount);
drawPrimitive(iface, PrimitiveType, PrimitiveCount, StartVertex, -1, 0, NULL, 0);
......@@ -4547,7 +4548,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitive(IWineD3DDevice *iface, D3DPRIMIT
}
/* TODO: baseVIndex needs to be provided from This->stateBlock->baseVertexIndex when called from d3d8 */
HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface,
HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface,
D3DPRIMITIVETYPE PrimitiveType,
INT baseVIndex, UINT minIndex,
UINT NumVertices,UINT startIndex,UINT primCount) {
......@@ -4556,11 +4557,11 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface,
UINT idxStride = 2;
IWineD3DIndexBuffer *pIB;
D3DINDEXBUFFER_DESC IdxBufDsc;
pIB = This->stateBlock->pIndexData;
This->stateBlock->streamIsUP = FALSE;
TRACE("(%p) : Type=(%d,%s), min=%d, CountV=%d, startIdx=%d, baseVidx=%d, countP=%d \n", This,
TRACE("(%p) : Type=(%d,%s), min=%d, CountV=%d, startIdx=%d, baseVidx=%d, countP=%d \n", This,
PrimitiveType, debug_d3dprimitivetype(PrimitiveType),
minIndex, NumVertices, startIndex, baseVIndex, primCount);
......@@ -4571,8 +4572,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitive(IWineD3DDevice *iface,
idxStride = 4;
}
drawPrimitive(iface, PrimitiveType, primCount, baseVIndex,
startIndex, idxStride,
drawPrimitive(iface, PrimitiveType, primCount, baseVIndex,
startIndex, idxStride,
((IWineD3DIndexBufferImpl *) pIB)->resource.allocatedMemory,
minIndex);
......@@ -4584,8 +4585,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface, D3DPRIM
UINT VertexStreamZeroStride) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : Type=(%d,%s), pCount=%d, pVtxData=%p, Stride=%d\n", This, PrimitiveType,
debug_d3dprimitivetype(PrimitiveType),
TRACE("(%p) : Type=(%d,%s), pCount=%d, pVtxData=%p, Stride=%d\n", This, PrimitiveType,
debug_d3dprimitivetype(PrimitiveType),
PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
if (This->stateBlock->streamSource[0] != NULL) IWineD3DVertexBuffer_Release(This->stateBlock->streamSource[0]);
......@@ -4610,9 +4611,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface,
int idxStride;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : Type=(%d,%s), MinVtxIdx=%d, NumVIdx=%d, PCount=%d, pidxdata=%p, IdxFmt=%d, pVtxdata=%p, stride=%d\n",
TRACE("(%p) : Type=(%d,%s), MinVtxIdx=%d, NumVIdx=%d, PCount=%d, pidxdata=%p, IdxFmt=%d, pVtxdata=%p, stride=%d\n",
This, PrimitiveType, debug_d3dprimitivetype(PrimitiveType),
MinVertexIndex, NumVertexIndices, PrimitiveCount, pIndexData,
MinVertexIndex, NumVertexIndices, PrimitiveCount, pIndexData,
IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
if (This->stateBlock->streamSource[0] != NULL) IWineD3DVertexBuffer_Release(This->stateBlock->streamSource[0]);
......@@ -4691,22 +4692,22 @@ HRESULT WINAPI IWineD3DDeviceImpl_StretchRect(IWineD3DDevice *iface, IWineD3DS
CONST RECT* pSourceRect, IWineD3DSurface *pDestinationSurface,
CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTargetData(IWineD3DDevice *iface, IWineD3DSurface *pRenderTarget, IWineD3DSurface *pSurface){
HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTargetData(IWineD3DDevice *iface, IWineD3DSurface *pRenderTarget, IWineD3DSurface *pSurface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetFrontBufferData(IWineD3DDevice *iface,UINT iSwapChain, IWineD3DSurface *pDestSurface){
HRESULT WINAPI IWineD3DDeviceImpl_GetFrontBufferData(IWineD3DDevice *iface,UINT iSwapChain, IWineD3DSurface *pDestSurface) {
IWineD3DSwapChain *swapChain;
HRESULT hr;
hr = IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, (IWineD3DSwapChain **)&swapChain);
if(hr == D3D_OK){
if(hr == D3D_OK) {
hr = IWineD3DSwapChain_GetFrontBufferData(swapChain, pDestSurface);
IWineD3DSwapChain_Release(swapChain);
}
......@@ -4722,7 +4723,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_ValidateDevice(IWineD3DDevice *iface, DWORD*
}
HRESULT WINAPI IWineD3DDeviceImpl_SetPaletteEntries(IWineD3DDevice *iface, UINT PaletteNumber, CONST PALETTEENTRY* pEntries) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
......@@ -4761,7 +4762,7 @@ BOOL WINAPI IWineD3DDeviceImpl_GetSoftwareVertexProcessing(IWineD3DDevice *
HRESULT WINAPI IWineD3DDeviceImpl_GetRasterStatus(IWineD3DDevice *iface, UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
pRasterStatus->InVBlank = TRUE;
pRasterStatus->ScanLine = 0;
FIXME("(%p) : stub\n", This);
......@@ -4772,8 +4773,8 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetRasterStatus(IWineD3DDevice *iface, UINT
HRESULT WINAPI IWineD3DDeviceImpl_SetNPatchMode(IWineD3DDevice *iface, float nSegments) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
static BOOL showfixmes = TRUE;
if(nSegments != 0.0f){
if( showfixmes){
if(nSegments != 0.0f) {
if( showfixmes) {
FIXME("(%p) : stub nSegments(%f)\n", This, nSegments);
showfixmes = FALSE;
}
......@@ -4784,7 +4785,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetNPatchMode(IWineD3DDevice *iface, float n
float WINAPI IWineD3DDeviceImpl_GetNPatchMode(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
static BOOL showfixmes = TRUE;
if( showfixmes){
if( showfixmes) {
FIXME("(%p) : stub returning(%f)\n", This, 0.0f);
showfixmes = FALSE;
}
......@@ -4966,7 +4967,7 @@ OpenGL evaluators or tessellate surfaces within your application.
*/
/* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/d3d/interfaces/idirect3ddevice9/DrawRectPatch.asp */
HRESULT WINAPI IWineD3DDeviceImpl_DrawRectPatch(IWineD3DDevice *iface, UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo){
HRESULT WINAPI IWineD3DDeviceImpl_DrawRectPatch(IWineD3DDevice *iface, UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) Handle(%d) noSegs(%p) rectpatch(%p) \n", This, Handle, pNumSegs, pRectPatchInfo);
FIXME("(%p) : Stub\n", This);
......@@ -4975,21 +4976,21 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawRectPatch(IWineD3DDevice *iface, UINT Hand
}
/* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/d3d/interfaces/idirect3ddevice9/DrawTriPatch.asp */
HRESULT WINAPI IWineD3DDeviceImpl_DrawTriPatch(IWineD3DDevice *iface, UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo){
HRESULT WINAPI IWineD3DDeviceImpl_DrawTriPatch(IWineD3DDevice *iface, UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) Handle(%d) noSegs(%p) tripatch(%p) \n", This, Handle, pNumSegs, pTriPatchInfo);
FIXME("(%p) : Stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_DeletePatch(IWineD3DDevice *iface, UINT Handle){
HRESULT WINAPI IWineD3DDeviceImpl_DeletePatch(IWineD3DDevice *iface, UINT Handle) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
TRACE("(%p) Handle(%d)\n", This, Handle);
FIXME("(%p) : Stub\n", This);
return D3D_OK;
}
}
HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface, IWineD3DSurface *pSurface, CONST D3DRECT* pRect, D3DCOLOR color){
HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface, IWineD3DSurface *pSurface, CONST D3DRECT* pRect, D3DCOLOR color) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
FIXME("(%p) : stub\n", This);
......@@ -4997,13 +4998,13 @@ HRESULT WINAPI IWineD3DDeviceImpl_ColorFill(IWineD3DDevice *iface, IWineD3DSurfa
}
/* rendertarget and deptth stencil functions */
HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice* iface,DWORD RenderTargetIndex, IWineD3DSurface **ppRenderTarget){
HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice* iface,DWORD RenderTargetIndex, IWineD3DSurface **ppRenderTarget) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/* FIXME: Implelent RenderTargetIndex >0 */
if(RenderTargetIndex > 0)
FIXME("(%p) : RenderTargetIndex %ld >0 not currently supported\n", This, RenderTargetIndex);
*ppRenderTarget = (IWineD3DSurface *)This->renderTarget;
TRACE("(%p) : RenderTarget %ld Index returning %p\n", This, RenderTargetIndex, *ppRenderTarget);
/* Note inc ref on returned surface */
......@@ -5012,12 +5013,12 @@ HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice* iface,DWORD
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetDepthStencilSurface(IWineD3DDevice* iface, IWineD3DSurface **ppZStencilSurface){
HRESULT WINAPI IWineD3DDeviceImpl_GetDepthStencilSurface(IWineD3DDevice* iface, IWineD3DSurface **ppZStencilSurface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
*ppZStencilSurface = (IWineD3DSurface *)This->depthStencilBuffer;
TRACE("(%p) : zStencilSurface returning %p\n", This, *ppZStencilSurface);
if(*ppZStencilSurface != NULL){
if(*ppZStencilSurface != NULL) {
/* Note inc ref on returned surface */
IWineD3DSurface_AddRef(*ppZStencilSurface);
}
......@@ -5030,7 +5031,7 @@ HRESULT WINAPI static IWineD3DDeviceImpl_ActiveRender(IWineD3DDevice* iface,
HRESULT WINAPI static IWineD3DDeviceImpl_CleanRender(IWineD3DDevice* iface, IWineD3DSwapChainImpl *swapchain);
HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, DWORD RenderTargetIndex, IWineD3DSurface *pRenderTarget){
HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, DWORD RenderTargetIndex, IWineD3DSurface *pRenderTarget) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
HRESULT hr = D3D_OK;
WINED3DVIEWPORT viewport;
......@@ -5091,7 +5092,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, DWORD R
return hr;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *iface, IWineD3DSurface *pNewZStencil){
HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *iface, IWineD3DSurface *pNewZStencil) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
HRESULT hr = D3D_OK;
WINED3DVIEWPORT viewport;
......@@ -5099,7 +5100,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *iface,
TRACE("(%p) Swapping z-buffer\n",This);
if (pNewZStencil == This->stencilBufferTarget){
if (pNewZStencil == This->stencilBufferTarget) {
TRACE("Trying to do a NOP SetRenderTarget operation\n");
}else{
/** OpenGL doesn't support 'sharing' of the stencilBuffer so we may incure an extra memory overhead
......@@ -5226,7 +5227,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_ActiveRender(IWineD3DDevice* iface,
/** TODO: remove the reff to Impl (context manager should fix this!) **/
IWineD3DSwapChainImpl *impSwapChain;
IWineD3DDevice_GetSwapChain(iface, 0, (IWineD3DSwapChain **)&impSwapChain);
if (NULL == impSwapChain){ /* NOTE: This should NEVER fail */
if (NULL == impSwapChain) { /* NOTE: This should NEVER fail */
ERR("(%p) Failed to get a the implicit swapchain\n", iface);
}
......@@ -5245,7 +5246,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_ActiveRender(IWineD3DDevice* iface,
cfgs = glXChooseFBConfig(impSwapChain->display, DefaultScreen(impSwapChain->display),
attribs, &nCfgs);
if (!cfgs){ /* OK we didn't find the exact config, so use any reasonable match */
if (!cfgs) { /* OK we didn't find the exact config, so use any reasonable match */
/* TODO: fill in the 'requested' and 'current' depths, also make sure that's
why we failed and only show this message once! */
MESSAGE("Failed to find exact match, finding alternative but you may suffer performance issues, try changing xfree's depth to match the requested depth\n"); /**/
......@@ -5287,7 +5288,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_ActiveRender(IWineD3DDevice* iface,
#endif
}
if (IWineD3DSurface_GetContainer(This->renderTarget, &IID_IWineD3DSwapChain, (void **)&currentSwapchain) != D3D_OK){
if (IWineD3DSurface_GetContainer(This->renderTarget, &IID_IWineD3DSwapChain, (void **)&currentSwapchain) != D3D_OK) {
/* the selected render target doesn't belong to a swapchain, so use the devices implicit swapchain */
IWineD3DDevice_GetSwapChain(iface, 0, &currentSwapchain);
}
......@@ -5296,12 +5297,12 @@ HRESULT WINAPI IWineD3DDeviceImpl_ActiveRender(IWineD3DDevice* iface,
* TODO: remove the use of IWineD3DSwapChainImpl, a context manager will help since it will replace the
* renderTarget = swapchain->backBuffer bit and anything to do with *glContexts
**********************************************************************/
if (IWineD3DSurface_GetContainer(RenderSurface, &IID_IWineD3DSwapChain, (void **)&swapchain) == D3D_OK){
if (IWineD3DSurface_GetContainer(RenderSurface, &IID_IWineD3DSwapChain, (void **)&swapchain) == D3D_OK) {
/* We also need to make sure that the lights &co are also in the context of the swapchains */
/* FIXME: If the render target gets sent to the frontBuffer should be be presenting it raw? */
TRACE("making swapchain active\n");
if (RenderSurface != This->renderTarget){
if (RenderSurface == swapchain->backBuffer){
if (RenderSurface != This->renderTarget) {
if (RenderSurface == swapchain->backBuffer) {
} else {
/* This could be flagged so that some operations work directly with the front buffer */
FIXME("Attempting to set the renderTarget to the frontBuffer\n");
......@@ -5438,7 +5439,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_ActiveRender(IWineD3DDevice* iface,
}
#endif
/* clean up the current rendertargets swapchain (if it belonged to one) */
if (currentSwapchain != NULL){
if (currentSwapchain != NULL) {
IWineD3DSwapChain_Release((IWineD3DSwapChain *)currentSwapchain);
}
......@@ -5457,7 +5458,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_ActiveRender(IWineD3DDevice* iface,
/* Check that the container is not a swapchain member */
IWineD3DSwapChain *tmpSwapChain;
if (D3D_OK != IWineD3DSurface_GetContainer(This->renderTarget, &IID_IWineD3DSwapChain, (void **)&tmpSwapChain)){
if (D3D_OK != IWineD3DSurface_GetContainer(This->renderTarget, &IID_IWineD3DSwapChain, (void **)&tmpSwapChain)) {
This->renderUpsideDown = TRUE;
}else{
This->renderUpsideDown = FALSE;
......@@ -5475,7 +5476,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_ActiveRender(IWineD3DDevice* iface,
ret = D3D_OK;
if (cfgs != NULL){
if (cfgs != NULL) {
XFree(cfgs);
} else {
ERR("cannot get valides GLXFBConfig for (%u,%s)/(%u,%s)\n", BackBufferFormat,
......@@ -5508,9 +5509,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_ActiveRender(IWineD3DDevice* iface,
HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* iface, UINT XHotSpot,
UINT YHotSpot, IWineD3DSurface *pCursorBitmap) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
/* TODO: the use of Impl is deprecated. */
/* some basic validation checks */
/* some basic validation checks */
IWineD3DSurfaceImpl * pSur = (IWineD3DSurfaceImpl *) pCursorBitmap;
TRACE("(%p) : Spot Pos(%u,%u)\n", This, XHotSpot, YHotSpot);
......@@ -5524,31 +5525,31 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* iface, U
return D3DERR_INVALIDCALL;
}
/* TODO: make the cursor 'real' */
This->xHotSpot = XHotSpot;
This->yHotSpot = YHotSpot;
return D3D_OK;
return D3D_OK;
}
void WINAPI IWineD3DDeviceImpl_SetCursorPosition(IWineD3DDevice* iface, int XScreenSpace, int YScreenSpace, DWORD Flags) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
TRACE("(%p) : SetPos to (%u,%u)\n", This, XScreenSpace, YScreenSpace);
This->xScreenSpace = XScreenSpace;
This->yScreenSpace = YScreenSpace;
return;
}
BOOL WINAPI IWineD3DDeviceImpl_ShowCursor(IWineD3DDevice* iface, BOOL bShow) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
TRACE("(%p) : visible(%d)\n", This, bShow);
This->bCursorVisible = bShow;
return D3D_OK;
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_TestCooperativeLevel(IWineD3DDevice* iface) {
......@@ -5575,29 +5576,29 @@ HRESULT WINAPI IWineD3DDeviceImpl_Rest(IWineD3DDevice* iface, D3DPRESENT_PARAM
* textures out of video memory and deletes all glTextures (glDeleteTextures)
* and should clear down the context and set it up according to pPresentationParameters
***********************************************************/
FIXME("(%p) : stub\n", This);
FIXME("(%p) : stub\n", This);
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_SetDialogBoxMode(IWineD3DDevice *iface, BOOL bEnableDialogs){
HRESULT WINAPI IWineD3DDeviceImpl_SetDialogBoxMode(IWineD3DDevice *iface, BOOL bEnableDialogs) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/** FIXME: always true at the moment **/
if(bEnableDialogs == FALSE){
if(bEnableDialogs == FALSE) {
FIXME("(%p) Dialogs cannot be disabled yet\n", This);
}
return D3D_OK;
return D3D_OK;
}
HRESULT WINAPI IWineD3DDeviceImpl_GetCreationParameters(IWineD3DDevice *iface, D3DDEVICE_CREATION_PARAMETERS *pParameters) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
FIXME("(%p) : stub\n", This);
/* Setup some reasonable defaults */
pParameters->AdapterOrdinal = 0; /* always for now */
pParameters->DeviceType = D3DDEVTYPE_HAL; /* always for now */
pParameters->hFocusWindow = 0;
pParameters->BehaviorFlags =0;
pParameters->BehaviorFlags =0;
return D3D_OK;
}
......@@ -5607,7 +5608,7 @@ void WINAPI IWineD3DDeviceImpl_SetGammaRamp(IWineD3DDevice * iface, UINT iSwapCh
TRACE("Relaying to swapchain\n");
if ((hrc = IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain)) == D3D_OK){
if ((hrc = IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain)) == D3D_OK) {
IWineD3DSwapChain_SetGammaRamp(swapchain, Flags, (D3DGAMMARAMP *)pRamp);
IWineD3DSwapChain_Release(swapchain);
}
......@@ -5620,7 +5621,7 @@ void WINAPI IWineD3DDeviceImpl_GetGammaRamp(IWineD3DDevice *iface, UINT iSwapCha
TRACE("Relaying to swapchain\n");
if ((hrc = IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain)) == D3D_OK){
if ((hrc = IWineD3DDeviceImpl_GetSwapChain(iface, iSwapChain, &swapchain)) == D3D_OK) {
hrc =IWineD3DSwapChain_GetGammaRamp(swapchain, pRamp);
IWineD3DSwapChain_Release(swapchain);
}
......@@ -5653,9 +5654,9 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_CreateVertexDeclaration,
IWineD3DDeviceImpl_CreateVertexShader,
IWineD3DDeviceImpl_CreatePixelShader,
/*** Odd functions **/
IWineD3DDeviceImpl_EvictManagedResources,
IWineD3DDeviceImpl_EvictManagedResources,
IWineD3DDeviceImpl_GetAvailableTextureMem,
IWineD3DDeviceImpl_GetBackBuffer,
IWineD3DDeviceImpl_GetCreationParameters,
......@@ -5683,9 +5684,9 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_SetFVF,
IWineD3DDeviceImpl_GetFVF,
IWineD3DDeviceImpl_SetGammaRamp,
IWineD3DDeviceImpl_GetGammaRamp,
IWineD3DDeviceImpl_GetGammaRamp,
IWineD3DDeviceImpl_SetIndices,
IWineD3DDeviceImpl_GetIndices,
IWineD3DDeviceImpl_GetIndices,
IWineD3DDeviceImpl_SetLight,
IWineD3DDeviceImpl_GetLight,
IWineD3DDeviceImpl_SetLightEnable,
......@@ -5693,7 +5694,7 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
IWineD3DDeviceImpl_SetMaterial,
IWineD3DDeviceImpl_GetMaterial,
IWineD3DDeviceImpl_SetNPatchMode,
IWineD3DDeviceImpl_GetNPatchMode,
IWineD3DDeviceImpl_GetNPatchMode,
IWineD3DDeviceImpl_SetPaletteEntries,
IWineD3DDeviceImpl_GetPaletteEntries,
IWineD3DDeviceImpl_SetPixelShader,
......
......@@ -60,9 +60,9 @@ inline static Display *get_display( HDC hdc )
/**
* Note: GL seems to trap if GetDeviceCaps is called before any HWND's created
* ie there is no GL Context - Get a default rendering context to enable the
* function query some info from GL
*/
* ie there is no GL Context - Get a default rendering context to enable the
* function query some info from GL
*/
static WineD3D_Context* WineD3D_CreateFakeGLContext(void) {
static WineD3D_Context ctx = { NULL, NULL, NULL, 0, 0 };
WineD3D_Context* ret = NULL;
......@@ -76,7 +76,7 @@ static WineD3D_Context* WineD3D_CreateFakeGLContext(void) {
BOOL failed = FALSE;
int num;
XWindowAttributes win_attr;
TRACE_(d3d_caps)("Creating Fake GL Context\n");
ctx.drawable = (Drawable) GetPropA(GetDesktopWindow(), "__wine_x11_whole_window");
......@@ -85,7 +85,7 @@ static WineD3D_Context* WineD3D_CreateFakeGLContext(void) {
device_context = GetDC(0);
ctx.display = get_display(device_context);
ReleaseDC(0, device_context);
/* Get the X visual */
ENTER_GL();
if (XGetWindowAttributes(ctx.display, ctx.drawable, &win_attr)) {
......@@ -100,26 +100,26 @@ static WineD3D_Context* WineD3D_CreateFakeGLContext(void) {
WARN_(d3d_caps)("Error creating visual info for capabilities initialization\n");
failed = TRUE;
}
/* Create a GL context */
if (!failed) {
ctx.glCtx = glXCreateContext(ctx.display, ctx.visInfo, NULL, GL_TRUE);
if (ctx.glCtx == NULL) {
LEAVE_GL();
WARN_(d3d_caps)("Error creating default context for capabilities initialization\n");
failed = TRUE;
}
}
/* Make it the current GL context */
if (!failed && glXMakeCurrent(ctx.display, ctx.drawable, ctx.glCtx) == False) {
glXDestroyContext(ctx.display, ctx.glCtx);
LEAVE_GL();
WARN_(d3d_caps)("Error setting default context as current for capabilities initialization\n");
failed = TRUE;
failed = TRUE;
}
/* It worked! Wow... */
if (!failed) {
gotContext = TRUE;
......@@ -158,15 +158,15 @@ HRESULT WINAPI IWineD3DImpl_QueryInterface(IWineD3D *iface,REFIID riid,LPVOID *p
{
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/* FIXME: This needs to extend an IWineD3DBaseObject */
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
if (IsEqualGUID(riid, &IID_IUnknown)
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IWineD3DDevice)) {
IUnknown_AddRef(iface);
*ppobj = This;
return D3D_OK;
}
return E_NOINTERFACE;
}
......@@ -186,7 +186,7 @@ ULONG WINAPI IWineD3DImpl_Release(IWineD3D *iface) {
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
......@@ -256,17 +256,17 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
if (*gl_string_cursor) {
char tmp[16];
int cursor = 0;
while (*gl_string_cursor <= '9' && *gl_string_cursor >= '0') {
tmp[cursor++] = *gl_string_cursor;
++gl_string_cursor;
}
tmp[cursor] = 0;
major = atoi(tmp);
if (*gl_string_cursor != '.') WARN_(d3d_caps)("malformed GL_VERSION (%s)\n", debugstr_a(gl_string));
++gl_string_cursor;
while (*gl_string_cursor <= '9' && *gl_string_cursor >= '0') {
tmp[cursor++] = *gl_string_cursor;
++gl_string_cursor;
......@@ -275,14 +275,14 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
minor = atoi(tmp);
}
break;
case VENDOR_ATI:
major = minor = 0;
gl_string_cursor = strchr(gl_string, '-');
if (gl_string_cursor) {
int error = 0;
gl_string_cursor++;
/* Check if version number is of the form x.y.z */
if (*gl_string_cursor > '9' && *gl_string_cursor < '0')
error = 1;
......@@ -292,31 +292,31 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
error = 1;
if (!error && *(gl_string_cursor+1) != '.' && *(gl_string_cursor+3) != '.')
error = 1;
/* Mark version number as malformed */
if (error)
gl_string_cursor = 0;
}
if (!gl_string_cursor)
WARN_(d3d_caps)("malformed GL_VERSION (%s)\n", debugstr_a(gl_string));
else {
major = *gl_string_cursor - '0';
minor = (*(gl_string_cursor+2) - '0') * 256 + (*(gl_string_cursor+4) - '0');
}
}
break;
default:
major = 0;
minor = 9;
}
gl_info->gl_driver_version = MAKEDWORD_VERSION(major, minor);
TRACE_(d3d_caps)("found GL_VERSION (%s)->(0x%08lx)\n", debugstr_a(gl_string), gl_info->gl_driver_version);
/* Fill in the renderer information */
gl_string = glGetString(GL_RENDERER);
strcpy(gl_info->gl_renderer, gl_string);
switch (gl_info->gl_vendor) {
case VENDOR_NVIDIA:
if (strstr(gl_info->gl_renderer, "GeForce4 Ti")) {
......@@ -327,7 +327,7 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
gl_info->gl_card = CARD_NVIDIA_GEFORCE4_TI4600;
}
break;
case VENDOR_ATI:
if (strstr(gl_info->gl_renderer, "RADEON 9800 PRO")) {
gl_info->gl_card = CARD_ATI_RADEON_9800PRO;
......@@ -337,7 +337,7 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
gl_info->gl_card = CARD_ATI_RADEON_8500;
}
break;
default:
gl_info->gl_card = CARD_WINE;
break;
......@@ -384,10 +384,10 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
/* Parse the gl supported features, in theory enabling parts of our code appropriately */
GL_Extensions = glGetString(GL_EXTENSIONS);
TRACE_(d3d_caps)("GL_Extensions reported:\n");
TRACE_(d3d_caps)("GL_Extensions reported:\n");
if (NULL == GL_Extensions) {
ERR(" GL_Extensions returns NULL\n");
ERR(" GL_Extensions returns NULL\n");
} else {
while (*GL_Extensions != 0x00) {
const char *Start = GL_Extensions;
......@@ -401,7 +401,7 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
TRACE_(d3d_caps)("- %s\n", ThisExtn);
/**
* ARB
* ARB
*/
if (strcmp(ThisExtn, "GL_ARB_fragment_program") == 0) {
gl_info->ps_arb_version = PS_VERSION_11;
......@@ -506,7 +506,7 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
gl_info->supported[EXT_VERTEX_WEIGHTING] = TRUE;
/**
* NVIDIA
* NVIDIA
*/
} else if (strstr(ThisExtn, "GL_NV_fog_distance")) {
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Fog Distance support\n");
......@@ -568,15 +568,15 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
if (display != NULL) {
GLX_Extensions = glXQueryExtensionsString(display, DefaultScreen(display));
TRACE_(d3d_caps)("GLX_Extensions reported:\n");
TRACE_(d3d_caps)("GLX_Extensions reported:\n");
if (NULL == GLX_Extensions) {
ERR(" GLX_Extensions returns NULL\n");
ERR(" GLX_Extensions returns NULL\n");
} else {
while (*GLX_Extensions != 0x00) {
const char *Start = GLX_Extensions;
char ThisExtn[256];
memset(ThisExtn, 0x00, sizeof(ThisExtn));
while (*GLX_Extensions != ' ' && *GLX_Extensions != 0x00) {
GLX_Extensions++;
......@@ -630,7 +630,7 @@ HMONITOR WINAPI IWineD3DImpl_GetAdapterMonitor(IWineD3D *iface, UINT Adapter) {
return D3D_OK;
}
/* FIXME: GetAdapterModeCount and EnumAdapterModes currently only returns modes
/* FIXME: GetAdapterModeCount and EnumAdapterModes currently only returns modes
of the same bpp but different resolutions */
/* Note: dx9 supplies a format. Calls from d3d8 supply D3DFMT_UNKNOWN */
......@@ -657,18 +657,18 @@ UINT WINAPI IWineD3DImpl_GetAdapterModeCount(IWineD3D *iface, UINT Adapter,
j++;
switch (Format)
{
case D3DFMT_UNKNOWN:
i++;
case D3DFMT_UNKNOWN:
i++;
break;
case D3DFMT_X8R8G8B8:
case D3DFMT_A8R8G8B8:
if (min(DevModeW.dmBitsPerPel, bpp) == 32) i++;
if (min(DevModeW.dmBitsPerPel, bpp) == 24) i++;
case D3DFMT_X8R8G8B8:
case D3DFMT_A8R8G8B8:
if (min(DevModeW.dmBitsPerPel, bpp) == 32) i++;
if (min(DevModeW.dmBitsPerPel, bpp) == 24) i++;
break;
case D3DFMT_X1R5G5B5:
case D3DFMT_A1R5G5B5:
case D3DFMT_R5G6B5:
if (min(DevModeW.dmBitsPerPel, bpp) == 16) i++;
if (min(DevModeW.dmBitsPerPel, bpp) == 16) i++;
break;
default:
/* Skip other modes as they do not match requested format */
......@@ -693,7 +693,7 @@ HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapter, WINE
TRACE_(d3d_caps)("(%p}->(Adapter:%d, mode:%d, pMode:%p, format:%s)\n", This, Adapter, Mode, pMode, debug_d3dformat(Format));
/* Validate the parameters as much as possible */
if (NULL == pMode ||
if (NULL == pMode ||
Adapter >= IWineD3DImpl_GetAdapterCount(iface) ||
Mode >= IWineD3DImpl_GetAdapterModeCount(iface, Adapter, Format)) {
return D3DERR_INVALIDCALL;
......@@ -703,7 +703,7 @@ HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapter, WINE
#if !defined( DEBUG_SINGLE_MODE )
DEVMODEW DevModeW;
int ModeIdx = 0;
/* Work out the current screen bpp */
HDC hdc = CreateDCA("DISPLAY", NULL, NULL, NULL);
int bpp = GetDeviceCaps(hdc, BITSPIXEL);
......@@ -711,7 +711,7 @@ HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapter, WINE
/* If we are filtering to a specific format, then need to skip all unrelated
modes, but if mode is irrelevant, then we can use the index directly */
if (Format == D3DFMT_UNKNOWN)
if (Format == D3DFMT_UNKNOWN)
{
ModeIdx = Mode;
} else {
......@@ -724,18 +724,18 @@ HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapter, WINE
j++;
switch (Format)
{
case D3DFMT_UNKNOWN:
i++;
case D3DFMT_UNKNOWN:
i++;
break;
case D3DFMT_X8R8G8B8:
case D3DFMT_A8R8G8B8:
if (min(DevModeWtmp.dmBitsPerPel, bpp) == 32) i++;
if (min(DevModeWtmp.dmBitsPerPel, bpp) == 24) i++;
case D3DFMT_X8R8G8B8:
case D3DFMT_A8R8G8B8:
if (min(DevModeWtmp.dmBitsPerPel, bpp) == 32) i++;
if (min(DevModeWtmp.dmBitsPerPel, bpp) == 24) i++;
break;
case D3DFMT_X1R5G5B5:
case D3DFMT_A1R5G5B5:
case D3DFMT_R5G6B5:
if (min(DevModeWtmp.dmBitsPerPel, bpp) == 16) i++;
if (min(DevModeWtmp.dmBitsPerPel, bpp) == 16) i++;
break;
default:
/* Skip other modes as they do not match requested format */
......@@ -746,7 +746,7 @@ HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapter, WINE
}
/* Now get the display mode via the calculated index */
if (EnumDisplaySettingsExW(NULL, ModeIdx, &DevModeW, 0))
if (EnumDisplaySettingsExW(NULL, ModeIdx, &DevModeW, 0))
{
pMode->Width = DevModeW.dmPelsWidth;
pMode->Height = DevModeW.dmPelsHeight;
......@@ -782,10 +782,10 @@ HRESULT WINAPI IWineD3DImpl_EnumAdapterModes(IWineD3D *iface, UINT Adapter, WINE
pMode->Width = 800;
pMode->Height = 600;
pMode->RefreshRate = D3DADAPTER_DEFAULT;
pMode->Format = (Format==D3DFMT_UNKNOWN)?D3DFMT_A8R8G8B8:Format;
pMode->Format = (Format == D3DFMT_UNKNOWN) ? D3DFMT_A8R8G8B8 : Format;
bpp = 32;
#endif
TRACE_(d3d_caps)("W %d H %d rr %d fmt (%x - %s) bpp %u\n", pMode->Width, pMode->Height,
TRACE_(d3d_caps)("W %d H %d rr %d fmt (%x - %s) bpp %u\n", pMode->Width, pMode->Height,
pMode->RefreshRate, pMode->Format, debug_d3dformat(pMode->Format), bpp);
} else {
......@@ -799,7 +799,7 @@ HRESULT WINAPI IWineD3DImpl_GetAdapterDisplayMode(IWineD3D *iface, UINT Adapter,
IWineD3DImpl *This = (IWineD3DImpl *)iface;
TRACE_(d3d_caps)("(%p}->(Adapter: %d, pMode: %p)\n", This, Adapter, pMode);
if (NULL == pMode ||
if (NULL == pMode ||
Adapter >= IWineD3D_GetAdapterCount(iface)) {
return D3DERR_INVALIDCALL;
}
......@@ -849,7 +849,7 @@ static Display * WINAPI IWineD3DImpl_GetAdapterDisplay(IWineD3D *iface, UINT Ada
/* NOTE: due to structure differences between dx8 and dx9 D3DADAPTER_IDENTIFIER,
and fields being inserted in the middle, a new structure is used in place */
HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Adapter, DWORD Flags,
HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Adapter, DWORD Flags,
WINED3DADAPTER_IDENTIFIER* pIdentifier) {
IWineD3DImpl *This = (IWineD3DImpl *)iface;
......@@ -860,10 +860,10 @@ HRESULT WINAPI IWineD3DImpl_GetAdapterIdentifier(IWineD3D *iface, UINT Adapter,
}
if (Adapter == 0) { /* Display - only device supported for now */
BOOL isGLInfoValid = This->isGLInfoValid;
/* FillGLCaps updates gl_info, but we only want to store and
/* FillGLCaps updates gl_info, but we only want to store and
reuse the values once we have a context which is valid. Values from
a temporary context may differ from the final ones */
if (isGLInfoValid == FALSE) {
......@@ -927,7 +927,7 @@ static BOOL IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(WineD3D_Context* c
gl_test = glXGetFBConfigAttrib(ctx->display, cfgs, GLX_BUFFER_SIZE, &buf_sz);
switch (Format) {
case WINED3DFMT_X8R8G8B8:
case WINED3DFMT_X8R8G8B8:
case WINED3DFMT_R8G8B8:
if (8 == rb && 8 == gb && 8 == bb) return TRUE;
break;
......@@ -962,7 +962,7 @@ static BOOL IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(WineD3D_Context* c
static BOOL IWineD3DImpl_IsGLXFBConfigCompatibleWithDepthFmt(WineD3D_Context* ctx, GLXFBConfig cfgs, WINED3DFORMAT Format) {
int gl_test;
int db, sb;
gl_test = glXGetFBConfigAttrib(ctx->display, cfgs, GLX_DEPTH_SIZE, &db);
gl_test = glXGetFBConfigAttrib(ctx->display, cfgs, GLX_STENCIL_SIZE, &sb);
......@@ -996,16 +996,16 @@ static BOOL IWineD3DImpl_IsGLXFBConfigCompatibleWithDepthFmt(WineD3D_Context* ct
return FALSE;
}
HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType,
WINED3DFORMAT AdapterFormat,
WINED3DFORMAT RenderTargetFormat,
WINED3DFORMAT DepthStencilFormat) {
HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType,
WINED3DFORMAT AdapterFormat,
WINED3DFORMAT RenderTargetFormat,
WINED3DFORMAT DepthStencilFormat) {
IWineD3DImpl *This = (IWineD3DImpl *)iface;
WARN_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%x,%s), AdptFmt:(%x,%s), RendrTgtFmt:(%x,%s), DepthStencilFmt:(%x,%s))\n",
This, Adapter,
WARN_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%x,%s), AdptFmt:(%x,%s), RendrTgtFmt:(%x,%s), DepthStencilFmt:(%x,%s))\n",
This, Adapter,
DeviceType, debug_d3ddevicetype(DeviceType),
AdapterFormat, debug_d3dformat(AdapterFormat),
RenderTargetFormat, debug_d3dformat(RenderTargetFormat),
RenderTargetFormat, debug_d3dformat(RenderTargetFormat),
DepthStencilFormat, debug_d3dformat(DepthStencilFormat));
if (Adapter >= IWineD3D_GetAdapterCount(iface)) {
......@@ -1017,66 +1017,66 @@ HRESULT WINAPI IWineD3DImpl_CheckDepthStencilMatch(IWineD3D *iface, UINT Adapter
int nCfgs = 0;
int it;
HRESULT hr = D3DERR_NOTAVAILABLE;
WineD3D_Context* ctx = WineD3D_CreateFakeGLContext();
if (NULL != ctx) {
cfgs = glXGetFBConfigs(ctx->display, DefaultScreen(ctx->display), &nCfgs);
for (it = 0; it < nCfgs; ++it) {
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(ctx, cfgs[it], RenderTargetFormat)) {
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithDepthFmt(ctx, cfgs[it], DepthStencilFormat)) {
hr = D3D_OK;
break ;
}
}
}
XFree(cfgs);
WineD3D_ReleaseFakeGLContext(ctx);
return hr;
cfgs = glXGetFBConfigs(ctx->display, DefaultScreen(ctx->display), &nCfgs);
for (it = 0; it < nCfgs; ++it) {
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(ctx, cfgs[it], RenderTargetFormat)) {
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithDepthFmt(ctx, cfgs[it], DepthStencilFormat)) {
hr = D3D_OK;
break ;
}
}
}
XFree(cfgs);
WineD3D_ReleaseFakeGLContext(ctx);
return hr;
}
}
return D3DERR_NOTAVAILABLE;
}
HRESULT WINAPI IWineD3DImpl_CheckDeviceMultiSampleType(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType,
WINED3DFORMAT SurfaceFormat,
BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) {
WINED3DFORMAT SurfaceFormat,
BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) {
IWineD3DImpl *This = (IWineD3DImpl *)iface;
TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%x,%s), SurfFmt:(%x,%s), Win?%d, MultiSamp:%x, pQual:%p)\n",
This,
Adapter,
TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%x,%s), SurfFmt:(%x,%s), Win?%d, MultiSamp:%x, pQual:%p)\n",
This,
Adapter,
DeviceType, debug_d3ddevicetype(DeviceType),
SurfaceFormat, debug_d3dformat(SurfaceFormat),
Windowed,
Windowed,
MultiSampleType,
pQualityLevels);
if (Adapter >= IWineD3D_GetAdapterCount(iface)) {
return D3DERR_INVALIDCALL;
}
if (pQualityLevels != NULL) {
static int s_single_shot = 0;
if (!s_single_shot) {
FIXME("Quality levels unsupported at present\n");
s_single_shot = 1;
}
*pQualityLevels = 1; /* Guess at a value! */
static int s_single_shot = 0;
if (!s_single_shot) {
FIXME("Quality levels unsupported at present\n");
s_single_shot = 1;
}
*pQualityLevels = 1; /* Guess at a value! */
}
if (D3DMULTISAMPLE_NONE == MultiSampleType) return D3D_OK;
return D3DERR_NOTAVAILABLE;
}
HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter, D3DDEVTYPE CheckType,
WINED3DFORMAT DisplayFormat, WINED3DFORMAT BackBufferFormat, BOOL Windowed) {
HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter, D3DDEVTYPE CheckType,
WINED3DFORMAT DisplayFormat, WINED3DFORMAT BackBufferFormat, BOOL Windowed) {
IWineD3DImpl *This = (IWineD3DImpl *)iface;
TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, CheckType:(%x,%s), DispFmt:(%x,%s), BackBuf:(%x,%s), Win?%d): stub\n",
This,
Adapter,
TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, CheckType:(%x,%s), DispFmt:(%x,%s), BackBuf:(%x,%s), Win?%d): stub\n",
This,
Adapter,
CheckType, debug_d3ddevicetype(CheckType),
DisplayFormat, debug_d3dformat(DisplayFormat),
BackBufferFormat, debug_d3dformat(BackBufferFormat),
......@@ -1091,20 +1091,20 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter, D3DDE
int nCfgs = 0;
int it;
HRESULT hr = D3DERR_NOTAVAILABLE;
WineD3D_Context* ctx = WineD3D_CreateFakeGLContext();
if (NULL != ctx) {
cfgs = glXGetFBConfigs(ctx->display, DefaultScreen(ctx->display), &nCfgs);
for (it = 0; it < nCfgs; ++it) {
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(ctx, cfgs[it], DisplayFormat)) {
hr = D3D_OK;
break ;
}
}
XFree(cfgs);
WineD3D_ReleaseFakeGLContext(ctx);
return hr;
cfgs = glXGetFBConfigs(ctx->display, DefaultScreen(ctx->display), &nCfgs);
for (it = 0; it < nCfgs; ++it) {
if (IWineD3DImpl_IsGLXFBConfigCompatibleWithRenderFmt(ctx, cfgs[it], DisplayFormat)) {
hr = D3D_OK;
break ;
}
}
XFree(cfgs);
WineD3D_ReleaseFakeGLContext(ctx);
return hr;
}
}
......@@ -1112,15 +1112,15 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceType(IWineD3D *iface, UINT Adapter, D3DDE
}
HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType,
WINED3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat) {
WINED3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat) {
IWineD3DImpl *This = (IWineD3DImpl *)iface;
TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%u,%s), AdptFmt:(%u,%s), Use:(%lu,%s), ResTyp:(%x,%s), CheckFmt:(%u,%s)) ",
This,
Adapter,
DeviceType, debug_d3ddevicetype(DeviceType),
AdapterFormat, debug_d3dformat(AdapterFormat),
TRACE_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%u,%s), AdptFmt:(%u,%s), Use:(%lu,%s), ResTyp:(%x,%s), CheckFmt:(%u,%s)) ",
This,
Adapter,
DeviceType, debug_d3ddevicetype(DeviceType),
AdapterFormat, debug_d3dformat(AdapterFormat),
Usage, debug_d3dusage(Usage),
RType, debug_d3dresourcetype(RType),
RType, debug_d3dresourcetype(RType),
CheckFormat, debug_d3dformat(CheckFormat));
if (Adapter >= IWineD3D_GetAdapterCount(iface)) {
......@@ -1141,16 +1141,16 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, D3D
switch (CheckFormat) {
/*****
* check supported using GL_SUPPORT
* check supported using GL_SUPPORT
*/
case D3DFMT_DXT1:
case D3DFMT_DXT2:
case D3DFMT_DXT3:
case D3DFMT_DXT4:
case D3DFMT_DXT5:
case D3DFMT_DXT5:
/*****
* supported
* supported
*/
/*case D3DFMT_R5G6B5: */
/*case D3DFMT_X1R5G5B5:*/
......@@ -1158,7 +1158,7 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, D3D
/*case D3DFMT_A4R4G4B4:*/
/*****
* unsupported
* unsupported
*/
/* color buffer */
......@@ -1185,7 +1185,7 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, D3D
case D3DFMT_W11V11U10:
/****
* currently hard to support
* currently hard to support
*/
case D3DFMT_UYVY:
case D3DFMT_YUY2:
......@@ -1201,21 +1201,21 @@ HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, UINT Adapter, D3D
return D3D_OK;
}
HRESULT WINAPI IWineD3DImpl_CheckDeviceFormatConversion(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType,
WINED3DFORMAT SourceFormat, WINED3DFORMAT TargetFormat) {
HRESULT WINAPI IWineD3DImpl_CheckDeviceFormatConversion(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType,
WINED3DFORMAT SourceFormat, WINED3DFORMAT TargetFormat) {
IWineD3DImpl *This = (IWineD3DImpl *)iface;
FIXME_(d3d_caps)("(%p)-> (STUB) (Adptr:%d, DevType:(%u,%s), SrcFmt:(%u,%s), TgtFmt:(%u,%s))",
This,
Adapter,
DeviceType, debug_d3ddevicetype(DeviceType),
SourceFormat, debug_d3dformat(SourceFormat),
This,
Adapter,
DeviceType, debug_d3ddevicetype(DeviceType),
SourceFormat, debug_d3dformat(SourceFormat),
TargetFormat, debug_d3dformat(TargetFormat));
return D3D_OK;
}
/* Note: d3d8 passes in a pointer to a D3DCAPS8 structure, which is a true
subset of a D3DCAPS9 structure. However, it has to come via a void *
/* Note: d3d8 passes in a pointer to a D3DCAPS8 structure, which is a true
subset of a D3DCAPS9 structure. However, it has to come via a void *
as the d3d8 interface cannot import the d3d9 header */
HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, WINED3DCAPS* pCaps) {
......@@ -1416,12 +1416,12 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA |
D3DTEXOPCAPS_BLENDTEXTUREALPHAPM;
}
#if 0
*pCaps->TextureOpCaps |= D3DTEXOPCAPS_BUMPENVMAP;
/* FIXME: Add
D3DTEXOPCAPS_BUMPENVMAPLUMINANCE
D3DTEXOPCAPS_PREMODULATE */
/* FIXME: Add
D3DTEXOPCAPS_BUMPENVMAPLUMINANCE
D3DTEXOPCAPS_PREMODULATE */
#endif
*pCaps->MaxTextureBlendStages = GL_LIMITS(textures);
......@@ -1443,8 +1443,8 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
*pCaps->VertexProcessingCaps = D3DVTXPCAPS_DIRECTIONALLIGHTS |
D3DVTXPCAPS_MATERIALSOURCE7 |
D3DVTXPCAPS_POSITIONALLIGHTS |
D3DVTXPCAPS_MATERIALSOURCE7 |
D3DVTXPCAPS_POSITIONALLIGHTS |
D3DVTXPCAPS_LOCALVIEWER |
D3DVTXPCAPS_TEXGEN;
/* FIXME: Add
......@@ -1465,15 +1465,15 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
*pCaps->MaxVertexShaderConst = WINED3D_VSHADER_MAX_CONSTANTS;
}
} else {
*pCaps->VertexShaderVersion = 0;
*pCaps->VertexShaderVersion = 0;
*pCaps->MaxVertexShaderConst = 0;
}
if ((ps_mode == PS_HW) && GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && (DeviceType != D3DDEVTYPE_REF)) {
*pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
*pCaps->PixelShaderVersion = D3DPS_VERSION(1,4);
*pCaps->PixelShader1xMaxValue = 1.0;
} else {
*pCaps->PixelShaderVersion = 0;
*pCaps->PixelShaderVersion = 0;
*pCaps->PixelShader1xMaxValue = 0.0;
}
/* TODO: ARB_FRAGMENT_PROGRAM_100 */
......@@ -1482,7 +1482,7 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
The following fields apply to d3d9 only
------------------------------------------------ */
if (This->dxVersion > 8) {
GLint max_buffers=1;
GLint max_buffers = 1;
FIXME("Caps support for directx9 is nonexistent at the moment!\n");
*pCaps->DevCaps2 = 0;
/* TODO: D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES */
......@@ -1494,7 +1494,7 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
#if 0 /*FIXME: Simultaneous render targets*/
GL_MAX_DRAW_BUFFERS_ATI 0x00008824
if (GL_SUPPORT(GL_MAX_DRAW_BUFFERS_ATI)) {
ENTER_GL();
ENTER_GL();
glEnable(GL_MAX_DRAW_BUFFERS_ATI);
glGetIntegerv(GL_MAX_DRAW_BUFFERS_ATI, &max_buffers);
glDisable(GL_MAX_DRAW_BUFFERS_ATI);
......@@ -1552,10 +1552,10 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
object->wineD3D = iface;
IWineD3D_AddRef(object->wineD3D);
object->parent = parent;
TRACE("(%p)->(Adptr:%d, DevType: %x, FocusHwnd: %p, BehFlags: %lx, PresParms: %p, RetDevInt: %p)\n", This, Adapter, DeviceType,
hFocusWindow, BehaviourFlags, pPresentationParameters, ppReturnedDeviceInterface);
TRACE("(%p)->(DepthStencil:(%u,%s), BackBufferFormat:(%u,%s))\n", This,
TRACE("(%p)->(DepthStencil:(%u,%s), BackBufferFormat:(%u,%s))\n", This,
*(pPresentationParameters->AutoDepthStencilFormat), debug_d3dformat(*(pPresentationParameters->AutoDepthStencilFormat)),
*(pPresentationParameters->BackBufferFormat), debug_d3dformat(*(pPresentationParameters->BackBufferFormat)));
......@@ -1594,15 +1594,15 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
if (NULL != object->stencilBufferTarget) {
IWineD3DSurface_AddRef(object->stencilBufferTarget);
}
/* Set up some starting GL setup */
ENTER_GL();
/*
* Initialize openGL extension related variables
* with Default values
* with Default values
*/
This->isGLInfoValid = IWineD3DImpl_FillGLCaps(&This->gl_info, swapchain->display);
/* Setup all the devices defaults */
IWineD3DStateBlock_InitStartupStateBlock((IWineD3DStateBlock *)object->stateBlock);
......@@ -1610,7 +1610,7 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
IWineD3DImpl_CheckGraphicsMemory();
#endif
LEAVE_GL();
{ /* Set a default viewport */
D3DVIEWPORT9 vp;
vp.X = 0;
......@@ -1621,8 +1621,8 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
vp.MaxZ = 1.0f;
IWineD3DDevice_SetViewport((IWineD3DDevice *)object, &vp);
}
/* Initialize the current view state */
object->modelview_valid = 1;
object->proj_valid = 0;
......@@ -1630,7 +1630,7 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
object->last_was_rhw = 0;
glGetIntegerv(GL_MAX_LIGHTS, &object->maxConcurrentLights);
TRACE("(%p,%d) All defaults now set up, leaving CreateDevice with %p\n", This, Adapter, object);
/* Clear the screen */
IWineD3DDevice_Clear((IWineD3DDevice *) object, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0);
} else { /* couldn't create swapchain */
......@@ -1665,9 +1665,11 @@ HRESULT WINAPI IWineD3DImpl_GetParent(IWineD3D *iface, IUnknown **pParent) {
const IWineD3DVtbl IWineD3D_Vtbl =
{
/* IUnknown */
IWineD3DImpl_QueryInterface,
IWineD3DImpl_AddRef,
IWineD3DImpl_Release,
/* IWineD3D */
IWineD3DImpl_GetParent,
IWineD3DImpl_GetAdapterCount,
IWineD3DImpl_RegisterSoftwareDevice,
......
......@@ -3,7 +3,7 @@
*
* Copyright 2002-2004 Jason Edmeades
* Copyright 2002-2004 Raphael Junqueira
* Copyright 2004 Christian Costa
* Copyright 2004 Christian Costa
* Copyright 2005 Oliver Stieber
*
* This library is free software; you can redistribute it and/or
......@@ -36,11 +36,11 @@ extern IDirect3DPixelShaderImpl* PixelShaders[64];
#undef GL_VERSION_1_4 /* To be fixed, caused by mesa headers */
#endif
/* Returns bits for what is expected from the fixed function pipeline, and whether
/* Returns bits for what is expected from the fixed function pipeline, and whether
a vertex shader will be in use. Note the fvf bits returned may be split over
multiple streams only if the vertex shader was created, otherwise it all relates
to stream 0 */
BOOL initializeFVF(IWineD3DDevice *iface,
BOOL initializeFVF(IWineD3DDevice *iface,
DWORD *FVFbits, /* What to expect in the FVF across all streams */
BOOL *useVertexShaderFunction) /* Should we use the vertex shader */
{
......@@ -48,11 +48,11 @@ BOOL initializeFVF(IWineD3DDevice *iface,
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
#if 0 /* TODO: d3d8 call setvertexshader needs to set the FVF in the state block when implemented */
/* The first thing to work out is if we are using the fixed function pipeline
/* The first thing to work out is if we are using the fixed function pipeline
which is either SetVertexShader with < VS_HIGHESTFIXEDFXF - in which case this
is the FVF, or with a shader which was created with no function - in which
case there is an FVF per declared stream. If this occurs, we also maintain
an 'OR' of all the FVF's together so we know what to expect across all the
an 'OR' of all the FVF's together so we know what to expect across all the
streams */
#endif
......@@ -83,7 +83,7 @@ BOOL initializeFVF(IWineD3DDevice *iface,
if (vertex_shader->function == NULL) {
/* No function, so many streams supplied plus FVF definition pre stream */
*useVertexShaderFunction = FALSE;
TRACE("vertex shader (%lx) declared without program, using fixed function pipeline with FVF=%lx\n",
TRACE("vertex shader (%lx) declared without program, using fixed function pipeline with FVF=%lx\n",
This->stateBlock->VertexShader, *FVFbits);
} else {
/* Vertex shader needs calling */
......@@ -146,7 +146,7 @@ DWORD primitiveToGl(D3DPRIMITIVETYPE PrimitiveType,
FIXME("Unhandled primitive\n");
*primType = GL_POINTS;
break;
}
}
return NumVertexes;
}
......@@ -164,7 +164,7 @@ void init_materials(IWineD3DDevice *iface, BOOL isDiffuseSupplied) {
TRACE("glColorMaterial Parm=%x\n", This->tracking_parm);
glColorMaterial(GL_FRONT_AND_BACK, This->tracking_parm);
checkGLcall("glColorMaterial(GL_FRONT_AND_BACK, Parm)");
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_COLOR_MATERIAL);
checkGLcall("glEnable GL_COLOR_MATERIAL");
This->tracking_color = IS_TRACKING;
requires_material_reset = TRUE; /* Restore material settings as will be used */
......@@ -215,7 +215,7 @@ static GLfloat invymat[16]={
0.0f, 0.0f, 0.0f, 1.0f};
/* Setup views - Transformed & lit if RHW, else untransformed.
Only unlit if Normals are supplied
Only unlit if Normals are supplied
Returns: Whether to restore lighting afterwards */
BOOL primitiveInitState(IWineD3DDevice *iface, BOOL vtx_transformed, BOOL vtx_lit, BOOL useVS) {
......@@ -240,7 +240,7 @@ BOOL primitiveInitState(IWineD3DDevice *iface, BOOL vtx_transformed, BOOL vtx_li
This->last_was_rhw = TRUE;
/* Transformed already into viewport coordinates, so we do not need transform
matrices. Reset all matrices to identity and leave the default matrix in world
matrices. Reset all matrices to identity and leave the default matrix in world
mode. */
glMatrixMode(GL_MODELVIEW);
checkGLcall("glMatrixMode");
......@@ -321,8 +321,8 @@ BOOL primitiveInitState(IWineD3DDevice *iface, BOOL vtx_transformed, BOOL vtx_li
}
/* Vertex Shader output is already transformed, so set up identity matrices */
/* FIXME: Actually, only true for software emulated ones, so when h/w ones
come along this needs to take into account whether s/w ones were
/* FIXME: Actually, only true for software emulated ones, so when h/w ones
come along this needs to take into account whether s/w ones were
requested or not */
if (useVS) {
glMatrixMode(GL_MODELVIEW);
......@@ -341,7 +341,7 @@ BOOL primitiveInitState(IWineD3DDevice *iface, BOOL vtx_transformed, BOOL vtx_li
}
This->modelview_valid = FALSE;
This->proj_valid = FALSE;
}
}
This->last_was_rhw = FALSE;
}
return isLightingOn;
......@@ -546,8 +546,8 @@ void primitiveConvertToStridedData(IWineD3DDevice *iface, Direct3DVertexStridedD
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
/* OK, Now to setup the data locations
For the non-created vertex shaders, the VertexShader var holds the real
/* OK, Now to setup the data locations
For the non-created vertex shaders, the VertexShader var holds the real
FVF and only stream 0 matters
For the created vertex shaders, there is an FVF per stream */
if (!This->stateBlock->streamIsUP && !(This->stateBlock->vertexShader == NULL)) {
......@@ -589,7 +589,7 @@ void primitiveConvertToStridedData(IWineD3DDevice *iface, Direct3DVertexStridedD
data = data + (BaseVertexIndex * stride);
/* Either 3 or 4 floats depending on the FVF */
/* FIXME: Can blending data be in a different stream to the position data?
/* FIXME: Can blending data be in a different stream to the position data?
and if so using the fixed pipeline how do we handle it */
if (thisFVF & D3DFVF_POSITION_MASK) {
strided->u.s.position.lpData = data;
......@@ -604,10 +604,10 @@ void primitiveConvertToStridedData(IWineD3DDevice *iface, Direct3DVertexStridedD
/* Blending is numBlends * FLOATs followed by a DWORD for UBYTE4 */
/** do we have to Check This->stateBlock->renderState[D3DRS_INDEXEDVERTEXBLENDENABLE] ? */
numBlends = ((thisFVF & D3DFVF_POSITION_MASK) >> 1) - 2 +
numBlends = ((thisFVF & D3DFVF_POSITION_MASK) >> 1) - 2 +
((FALSE == (thisFVF & D3DFVF_LASTBETA_UBYTE4)) ? 0 : -1); /* WARNING can be < 0 because -2 */
if (numBlends > 0) {
canDoViaGLPointers = FALSE;
canDoViaGLPointers = FALSE;
strided->u.s.blendWeights.lpData = data;
strided->u.s.blendWeights.dwType = D3DDECLTYPE_FLOAT1 + (numBlends - 1);
strided->u.s.blendWeights.dwStride = stride;
......@@ -615,8 +615,8 @@ void primitiveConvertToStridedData(IWineD3DDevice *iface, Direct3DVertexStridedD
if (thisFVF & D3DFVF_LASTBETA_UBYTE4) {
strided->u.s.blendMatrixIndices.lpData = data;
strided->u.s.blendMatrixIndices.dwType = D3DDECLTYPE_UBYTE4;
strided->u.s.blendMatrixIndices.dwStride= stride;
strided->u.s.blendMatrixIndices.dwType = D3DDECLTYPE_UBYTE4;
strided->u.s.blendMatrixIndices.dwStride= stride;
data += sizeof(DWORD);
}
}
......@@ -723,7 +723,7 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
if (isNormal) {
VTRACE(("glNormal:nx,ny,nz=%f,%f,%f\n", nx,ny,nz));
glNormal3f(nx, ny, nz);
}
}
/* Point Size ----------------------------------------------*/
if (isPtSize) {
......@@ -762,7 +762,7 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
case 4: q = texcoords[coordIdx].w; /* drop through */
case 3: r = texcoords[coordIdx].z; /* drop through */
case 2: t = texcoords[coordIdx].y; /* drop through */
case 1: s = texcoords[coordIdx].x;
case 1: s = texcoords[coordIdx].x;
}
switch (numcoords[coordIdx]) { /* Supply the provided texture coords */
......@@ -819,12 +819,12 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
}
}
/*
/*
* Actually draw using the supplied information.
* Faster GL version using pointers to data, harder to debug though
* Note does not handle vertex shaders yet
* Faster GL version using pointers to data, harder to debug though
* Note does not handle vertex shaders yet
*/
void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
int PrimitiveType, ULONG NumPrimitives,
const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx) {
unsigned int textureNo = 0;
......@@ -838,17 +838,17 @@ void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
if (sd->u.s.position.lpData != NULL) {
/* Note dwType == float3 or float4 == 2 or 3 */
VTRACE(("glVertexPointer(%ld, GL_FLOAT, %ld, %p)\n",
sd->u.s.position.dwStride,
sd->u.s.position.dwType + 1,
VTRACE(("glVertexPointer(%ld, GL_FLOAT, %ld, %p)\n",
sd->u.s.position.dwStride,
sd->u.s.position.dwType + 1,
sd->u.s.position.lpData));
/* Disable RHW mode as 'w' coord handling for rhw mode should
not impact screen position whereas in GL it does. This may
not impact screen position whereas in GL it does. This may
result in very slightly distored textures in rhw mode, but
a very minimal different */
glVertexPointer(3, GL_FLOAT, /* RHW: Was 'sd->u.s.position.dwType + 1' */
sd->u.s.position.dwStride,
sd->u.s.position.dwStride,
sd->u.s.position.lpData);
checkGLcall("glVertexPointer(...)");
glEnableClientState(GL_VERTEX_ARRAY);
......@@ -861,29 +861,28 @@ void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
}
/* Blend Data ----------------------------------------------*/
if ((sd->u.s.blendWeights.lpData != NULL) ||
if ((sd->u.s.blendWeights.lpData != NULL) ||
(sd->u.s.blendMatrixIndices.lpData != NULL)) {
#if 1 /* Vertex blend support needs to be added */
if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
DWORD fvf = (sd->u.s.blendWeights.dwType - D3DDECLTYPE_FLOAT1) + 1;
int numBlends = ((fvf & D3DFVF_POSITION_MASK) >> 1) - 2 + ((FALSE == (fvf & D3DFVF_LASTBETA_UBYTE4)) ? 0 : -1);
/*FIXME("TODO\n");*/
/* Note dwType == float3 or float4 == 2 or 3 */
VTRACE(("glWeightPointerARB(%ld, GL_FLOAT, %ld, %p)\n",
numBlends,
sd->u.s.blendWeights.dwStride,
sd->u.s.blendWeights.lpData));
GL_EXTCALL(glWeightPointerARB)(numBlends, GL_FLOAT,
sd->u.s.blendWeights.dwStride,
sd->u.s.blendWeights.lpData);
checkGLcall("glWeightPointerARB(...)");
glEnableClientState(GL_WEIGHT_ARRAY_ARB);
checkGLcall("glEnableClientState(GL_VERTEX_ARRAY)");
if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
DWORD fvf = (sd->u.s.blendWeights.dwType - D3DDECLTYPE_FLOAT1) + 1;
int numBlends = ((fvf & D3DFVF_POSITION_MASK) >> 1) - 2 + ((FALSE == (fvf & D3DFVF_LASTBETA_UBYTE4)) ? 0 : -1);
/* Note dwType == float3 or float4 == 2 or 3 */
VTRACE(("glWeightPointerARB(%ld, GL_FLOAT, %ld, %p)\n",
numBlends,
sd->u.s.blendWeights.dwStride,
sd->u.s.blendWeights.lpData));
GL_EXTCALL(glWeightPointerARB)(numBlends, GL_FLOAT,
sd->u.s.blendWeights.dwStride,
sd->u.s.blendWeights.lpData);
checkGLcall("glWeightPointerARB(...)");
glEnableClientState(GL_WEIGHT_ARRAY_ARB);
checkGLcall("glEnableClientState(GL_VERTEX_ARRAY)");
} else if (GL_SUPPORT(EXT_VERTEX_WEIGHTING)) {
/*FIXME("TODO\n");*/
/*
GLExtCall(glVertexWeightPointerEXT)(numBlends, GL_FLOAT, skip, curPos);
GLExtCall(glVertexWeightPointerEXT)(numBlends, GL_FLOAT, skip, curPos);
checkGLcall("glVertexWeightPointerEXT(numBlends, ...)");
glEnableClientState(GL_VERTEX_WEIGHT_ARRAY_EXT);
checkGLcall("glEnableClientState(GL_VERTEX_WEIGHT_ARRAY_EXT)");
......@@ -911,11 +910,11 @@ void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
if (sd->u.s.normal.lpData != NULL) {
/* Note dwType == float3 or float4 == 2 or 3 */
VTRACE(("glNormalPointer(GL_FLOAT, %ld, %p)\n",
sd->u.s.normal.dwStride,
VTRACE(("glNormalPointer(GL_FLOAT, %ld, %p)\n",
sd->u.s.normal.dwStride,
sd->u.s.normal.lpData));
glNormalPointer(GL_FLOAT,
sd->u.s.normal.dwStride,
glNormalPointer(GL_FLOAT,
sd->u.s.normal.dwStride,
sd->u.s.normal.lpData);
checkGLcall("glNormalPointer(...)");
glEnableClientState(GL_NORMAL_ARRAY);
......@@ -944,11 +943,11 @@ void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
if (sd->u.s.diffuse.lpData != NULL) {
/* Note dwType == float3 or float4 == 2 or 3 */
VTRACE(("glColorPointer(4, GL_UNSIGNED_BYTE, %ld, %p)\n",
sd->u.s.diffuse.dwStride,
VTRACE(("glColorPointer(4, GL_UNSIGNED_BYTE, %ld, %p)\n",
sd->u.s.diffuse.dwStride,
sd->u.s.diffuse.lpData));
glColorPointer(4, GL_UNSIGNED_BYTE,
sd->u.s.diffuse.dwStride,
glColorPointer(4, GL_UNSIGNED_BYTE,
sd->u.s.diffuse.dwStride,
sd->u.s.diffuse.lpData);
checkGLcall("glColorPointer(4, GL_UNSIGNED_BYTE, ...)");
glEnableClientState(GL_COLOR_ARRAY);
......@@ -966,13 +965,13 @@ void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
if (sd->u.s.specular.lpData != NULL) {
/* Note dwType == float3 or float4 == 2 or 3 */
VTRACE(("glSecondaryColorPointer(4, GL_UNSIGNED_BYTE, %ld, %p)\n",
sd->u.s.specular.dwStride,
VTRACE(("glSecondaryColorPointer(4, GL_UNSIGNED_BYTE, %ld, %p)\n",
sd->u.s.specular.dwStride,
sd->u.s.specular.lpData));
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
GL_EXTCALL(glSecondaryColorPointerEXT)(4, GL_UNSIGNED_BYTE,
sd->u.s.specular.dwStride,
sd->u.s.specular.dwStride,
sd->u.s.specular.lpData);
vcheckGLcall("glSecondaryColorPointerEXT(4, GL_UNSIGNED_BYTE, ...)");
glEnableClientState(GL_SECONDARY_COLOR_ARRAY_EXT);
......@@ -1029,27 +1028,27 @@ void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
GLenum type;
switch (sd->u.s.texCoords[coordIdx].dwType) {
case D3DDECLTYPE_FLOAT1: size = 1, type = GL_FLOAT; break;
case D3DDECLTYPE_FLOAT2: size = 2, type = GL_FLOAT; break;
case D3DDECLTYPE_FLOAT3: size = 3, type = GL_FLOAT; break;
case D3DDECLTYPE_FLOAT4: size = 4, type = GL_FLOAT; break;
case D3DDECLTYPE_SHORT2: size = 2, type = GL_SHORT; break;
case D3DDECLTYPE_SHORT4: size = 4, type = GL_SHORT; break;
case D3DDECLTYPE_UBYTE4: size = 4, type = GL_UNSIGNED_BYTE; break;
default: FIXME("Unrecognized data type %ld\n", sd->u.s.texCoords[coordIdx].dwType);
case D3DDECLTYPE_FLOAT1: size = 1, type = GL_FLOAT; break;
case D3DDECLTYPE_FLOAT2: size = 2, type = GL_FLOAT; break;
case D3DDECLTYPE_FLOAT3: size = 3, type = GL_FLOAT; break;
case D3DDECLTYPE_FLOAT4: size = 4, type = GL_FLOAT; break;
case D3DDECLTYPE_SHORT2: size = 2, type = GL_SHORT; break;
case D3DDECLTYPE_SHORT4: size = 4, type = GL_SHORT; break;
case D3DDECLTYPE_UBYTE4: size = 4, type = GL_UNSIGNED_BYTE; break;
default: FIXME("Unrecognized data type %ld\n", sd->u.s.texCoords[coordIdx].dwType);
size = 4; type = GL_UNSIGNED_BYTE;
}
glTexCoordPointer(size, type, sd->u.s.texCoords[coordIdx].dwStride, sd->u.s.texCoords[coordIdx].lpData);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
} else {
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
GLMULTITEXCOORD4F(textureNo, 0, 0, 0, 1);
}
}
/* Ok, Work out which primitive is requested and how many vertexes that
}
glTexCoordPointer(size, type, sd->u.s.texCoords[coordIdx].dwStride, sd->u.s.texCoords[coordIdx].lpData);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
}
} else {
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
GLMULTITEXCOORD4F(textureNo, 0, 0, 0, 1);
}
}
/* Ok, Work out which primitive is requested and how many vertexes that
will be */
NumVertexes = primitiveToGl(PrimitiveType, NumPrimitives, &glPrimType);
......@@ -1061,8 +1060,8 @@ void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
glDrawElements(glPrimType, NumVertexes, idxSize==2?GL_UNSIGNED_SHORT:GL_UNSIGNED_INT,
(const char *)idxData+(idxSize * startIdx));
#else
glDrawRangeElements(glPrimType, minIndex, minIndex+NumVertexes-1, NumVertexes,
idxSize==2?GL_UNSIGNED_SHORT:GL_UNSIGNED_INT,
glDrawRangeElements(glPrimType, minIndex, minIndex+NumVertexes-1, NumVertexes,
idxSize==2?GL_UNSIGNED_SHORT:GL_UNSIGNED_INT,
(const char *)idxData+(idxSize * startIdx));
#endif
checkGLcall("glDrawRangeElements");
......@@ -1077,11 +1076,11 @@ void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
}
}
/*
/*
* Actually draw using the supplied information.
* Slower GL version which extracts info about each vertex in turn
*/
void drawStridedSlow(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
void drawStridedSlow(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
int PrimitiveType, ULONG NumPrimitives,
const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx) {
......@@ -1226,7 +1225,7 @@ void drawStridedSlow(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
case 4: q = ptrToCoords[3]; /* drop through */
case 3: r = ptrToCoords[2]; /* drop through */
case 2: t = ptrToCoords[1]; /* drop through */
case 1: s = ptrToCoords[0];
case 1: s = ptrToCoords[0];
}
/* Projected is more 'fun' - Move the last coord to the 'q'
......@@ -1253,7 +1252,7 @@ void drawStridedSlow(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
case 4: /* Nop here */
break;
default:
FIXME("Unexpected D3DTSS_TEXTURETRANSFORMFLAGS value of %ld\n",
FIXME("Unexpected D3DTSS_TEXTURETRANSFORMFLAGS value of %ld\n",
This->stateBlock->textureState[textureNo][D3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED);
}
}
......@@ -1311,10 +1310,10 @@ void drawStridedSlow(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
(diffuseColor >> 8) & 0xFF,
(diffuseColor >> 0) & 0xFF,
(diffuseColor >> 24) & 0xFF);
VTRACE(("glColor4f: r,g,b,a=%f,%f,%f,%f\n",
((diffuseColor >> 16) & 0xFF) / 255.0f,
VTRACE(("glColor4f: r,g,b,a=%f,%f,%f,%f\n",
((diffuseColor >> 16) & 0xFF) / 255.0f,
((diffuseColor >> 8) & 0xFF) / 255.0f,
((diffuseColor >> 0) & 0xFF) / 255.0f,
((diffuseColor >> 0) & 0xFF) / 255.0f,
((diffuseColor >> 24) & 0xFF) / 255.0f));
} else {
if (vx_index == 0) glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
......@@ -1322,8 +1321,8 @@ void drawStridedSlow(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
/* Specular ------------------------------- */
if (sd->u.s.diffuse.lpData != NULL) {
VTRACE(("glSecondaryColor4ub: r,g,b=%f,%f,%f\n",
((specularColor >> 16) & 0xFF) / 255.0f,
VTRACE(("glSecondaryColor4ub: r,g,b=%f,%f,%f\n",
((specularColor >> 16) & 0xFF) / 255.0f,
((specularColor >> 8) & 0xFF) / 255.0f,
((specularColor >> 0) & 0xFF) / 255.0f));
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
......@@ -1332,18 +1331,18 @@ void drawStridedSlow(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
(specularColor >> 8) & 0xFF,
(specularColor >> 0) & 0xFF);
} else {
/* Do not worry if specular colour missing and disable request */
VTRACE(("Specular color extensions not supplied\n"));
}
/* Do not worry if specular colour missing and disable request */
VTRACE(("Specular color extensions not supplied\n"));
}
} else {
if (vx_index == 0) {
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
} else {
/* Do not worry if specular colour missing and disable request */
VTRACE(("Specular color extensions not supplied\n"));
}
}
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
} else {
/* Do not worry if specular colour missing and disable request */
VTRACE(("Specular color extensions not supplied\n"));
}
}
}
/* Normal -------------------------------- */
......@@ -1353,7 +1352,7 @@ void drawStridedSlow(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
} else {
if (vx_index == 0) glNormal3f(0, 0, 1);
}
/* Position -------------------------------- */
if (sd->u.s.position.lpData != NULL) {
if (1.0f == rhw || ((rhw < 0.0001f) && (rhw > -0.0001f))) {
......@@ -1377,12 +1376,12 @@ void drawStridedSlow(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
}
#if 0 /* TODO: Software/Hardware vertex blending support */
/*
/*
* Draw with emulated vertex shaders
* Note: strided data is uninitialized, as we need to pass the vertex
* shader directly as ordering irs yet
* shader directly as ordering irs yet
*/
void drawStridedSoftwareVS(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
void drawStridedSoftwareVS(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
int PrimitiveType, ULONG NumPrimitives,
const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx) {
......@@ -1444,7 +1443,7 @@ void drawStridedSoftwareVS(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
vertex_shader->output.oD[0].x = 1.0;
vertex_shader->output.oD[0].y = 1.0;
vertex_shader->output.oD[0].z = 1.0;
vertex_shader->output.oD[0].w = 1.0;
vertex_shader->output.oD[0].w = 1.0;
/* Now execute the vertex shader */
IDirect3DVertexShaderImpl_ExecuteSW(vertex_shader, &vertex_shader->input, &vertex_shader->output);
......@@ -1479,30 +1478,30 @@ void drawStridedSoftwareVS(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
memset(numcoords, 0x00, sizeof(numcoords));
for (textureNo = 0; textureNo < GL_LIMITS(textures); ++textureNo) {
if (This->stateBlock->textures[textureNo] != NULL) {
texcoords[textureNo].x = vertex_shader->output.oT[textureNo].x;
texcoords[textureNo].y = vertex_shader->output.oT[textureNo].y;
texcoords[textureNo].z = vertex_shader->output.oT[textureNo].z;
texcoords[textureNo].w = vertex_shader->output.oT[textureNo].w;
texcoords[textureNo].x = vertex_shader->output.oT[textureNo].x;
texcoords[textureNo].y = vertex_shader->output.oT[textureNo].y;
texcoords[textureNo].z = vertex_shader->output.oT[textureNo].z;
texcoords[textureNo].w = vertex_shader->output.oT[textureNo].w;
if (This->stateBlock->texture_state[textureNo][D3DTSS_TEXTURETRANSFORMFLAGS] != D3DTTFF_DISABLE) {
numcoords[textureNo] = This->stateBlock->texture_state[textureNo][D3DTSS_TEXTURETRANSFORMFLAGS] & ~D3DTTFF_PROJECTED;
} else {
switch (IDirect3DBaseTexture8Impl_GetType((LPDIRECT3DBASETEXTURE8) This->stateBlock->textures[textureNo])) {
case D3DRTYPE_TEXTURE: numcoords[textureNo] = 2; break;
case D3DRTYPE_VOLUMETEXTURE: numcoords[textureNo] = 3; break;
default: numcoords[textureNo] = 4;
case D3DRTYPE_TEXTURE: numcoords[textureNo] = 2; break;
case D3DRTYPE_VOLUMETEXTURE: numcoords[textureNo] = 3; break;
default: numcoords[textureNo] = 4;
}
}
} else {
numcoords[textureNo] = 0;
numcoords[textureNo] = 0;
}
}
/* Draw using this information */
draw_vertex(iface,
TRUE, x, y, z, rhw,
TRUE, 0.0f, 0.0f, 1.0f,
TRUE, (float*) &vertex_shader->output.oD[0],
TRUE, (float*) &vertex_shader->output.oD[1],
TRUE, x, y, z, rhw,
TRUE, 0.0f, 0.0f, 1.0f,
TRUE, (float*) &vertex_shader->output.oD[0],
TRUE, (float*) &vertex_shader->output.oD[1],
FALSE, ptSize, /* FIXME: Change back when supported */
texcoords, numcoords);
......@@ -1517,7 +1516,7 @@ void drawStridedSoftwareVS(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
checkGLcall("glEnd and previous calls");
}
void drawStridedHardwareVS(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
void drawStridedHardwareVS(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
int PrimitiveType, ULONG NumPrimitives,
const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx) {
......@@ -1548,7 +1547,7 @@ void drawStridedHardwareVS(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
/* Set up the vertex.attr[n] inputs */
IDirect3DDeviceImpl_FillVertexShaderInputArbHW(This, vertex_shader, 0);
/* Ok, Work out which primitive is requested and how many vertexes that
/* Ok, Work out which primitive is requested and how many vertexes that
will be */
NumVertexes = primitiveToGl(PrimitiveType, NumPrimitives, &glPrimType);
......@@ -1560,8 +1559,8 @@ void drawStridedHardwareVS(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
glDrawElements(glPrimType, NumVertexes, idxSize==2?GL_UNSIGNED_SHORT:GL_UNSIGNED_INT,
(const char *)idxData+(idxSize * startIdx));
#else
glDrawRangeElements(glPrimType, minIndex, minIndex+NumVertexes-1, NumVertexes,
idxSize==2?GL_UNSIGNED_SHORT:GL_UNSIGNED_INT,
glDrawRangeElements(glPrimType, minIndex, minIndex+NumVertexes-1, NumVertexes,
idxSize==2?GL_UNSIGNED_SHORT:GL_UNSIGNED_INT,
(const char *)idxData+(idxSize * startIdx));
#endif
checkGLcall("glDrawRangeElements");
......@@ -1574,7 +1573,7 @@ void drawStridedHardwareVS(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
checkGLcall("glDrawArrays");
}
{
GLint errPos;
glGetIntegerv( GL_PROGRAM_ERROR_POSITION_ARB, &errPos );
......@@ -1653,17 +1652,17 @@ void drawPrimitive(IWineD3DDevice *iface,
} else {
TRACE("(%p) : using vertex declaration %p \n", iface, This->stateBlock->vertexDecl);
}
/* If we will be using a vertex shader, do some initialization for it */
if (useVertexShaderFunction) {
#if 0 /* TODO: vertex and pixel shaders */
vertex_shader = VERTEX_SHADER(This->stateBlock->VertexShader);
memset(&vertex_shader->input, 0, sizeof(VSHADERINPUTDATA8));
useHW = (((vs_mode == VS_HW) && GL_SUPPORT(ARB_VERTEX_PROGRAM)) &&
useHW = (((vs_mode == VS_HW) && GL_SUPPORT(ARB_VERTEX_PROGRAM)) &&
This->devType != D3DDEVTYPE_REF &&
!This->stateBlock->renderState[D3DRS_SOFTWAREVERTEXPROCESSING] &&
vertex_shader->usage != D3DUSAGE_SOFTWAREPROCESSING);
!This->stateBlock->renderState[D3DRS_SOFTWAREVERTEXPROCESSING] &&
vertex_shader->usage != D3DUSAGE_SOFTWAREPROCESSING);
/** init Constants */
if (This->stateBlock->Changed.vertexShaderConstant) {
......@@ -1685,7 +1684,7 @@ void drawPrimitive(IWineD3DDevice *iface,
GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, pixel_shader->prgId));
checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, pixel_shader->prgId);");
glEnable(GL_FRAGMENT_PROGRAM_ARB);
checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB);");
checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB);");
/* init Constants */
if (This->stateBlock->Changed.pixelShaderConstant) {
......@@ -1721,15 +1720,15 @@ void drawPrimitive(IWineD3DDevice *iface,
/* Setup transform matrices and sort out */
if (useHW) {
/* Lighting is not completely bypassed with ATI drivers although it should be. Mesa is ok from this respect...
So make sure lighting is disabled. */
/* Lighting is not completely bypassed with ATI drivers although it should be. Mesa is ok from this respect...
So make sure lighting is disabled. */
isLightingOn = glIsEnabled(GL_LIGHTING);
glDisable(GL_LIGHTING);
checkGLcall("glDisable(GL_LIGHTING);");
TRACE("Disabled lighting as no normals supplied, old state = %d\n", isLightingOn);
TRACE("Disabled lighting as no normals supplied, old state = %d\n", isLightingOn);
} else {
isLightingOn = primitiveInitState(iface,
fvf & D3DFVF_XYZRHW,
isLightingOn = primitiveInitState(iface,
fvf & D3DFVF_XYZRHW,
!(fvf & D3DFVF_NORMAL),
useVertexShaderFunction);
}
......@@ -1767,36 +1766,36 @@ void drawPrimitive(IWineD3DDevice *iface,
if (useHW) {
TRACE("Swap HW vertex shader\n");
#if 0 /* TODO: vertex and pixel shaders */
drawStridedHardwareVS(iface, &dataLocations, PrimitiveType, NumPrimitives,
idxData, idxSize, minIndex, StartIdx);
drawStridedHardwareVS(iface, &dataLocations, PrimitiveType, NumPrimitives,
idxData, idxSize, minIndex, StartIdx);
#endif
} else {
/* We will have to use the very, very slow emulation layer */
TRACE("Swap SW vertex shader\n");
#if 0 /* TODO: vertex and pixel shaders */
drawStridedSoftwareVS(iface, &dataLocations, PrimitiveType, NumPrimitives,
idxData, idxSize, minIndex, StartIdx);
drawStridedSoftwareVS(iface, &dataLocations, PrimitiveType, NumPrimitives,
idxData, idxSize, minIndex, StartIdx);
#endif
}
} else if ((dataLocations.u.s.pSize.lpData != NULL)
|| (dataLocations.u.s.diffuse.lpData != NULL)
} else if ((dataLocations.u.s.pSize.lpData != NULL)
|| (dataLocations.u.s.diffuse.lpData != NULL)
|| nonPower2
/*|| (dataLocations.u.s.blendWeights.lpData != NULL)*/) {
/* Fixme, Ideally, only use the per-vertex code for software HAL
but until opengl supports all the functions returned to setup
vertex arrays, we need to drop down to the slow mechanism for
/* Fixme, Ideally, only use the per-vertex code for software HAL
but until opengl supports all the functions returned to setup
vertex arrays, we need to drop down to the slow mechanism for
certain functions */
/* We will have to use the slow version of GL per vertex setup */
drawStridedSlow(iface, &dataLocations, PrimitiveType, NumPrimitives,
idxData, idxSize, minIndex, StartIdx);
drawStridedSlow(iface, &dataLocations, PrimitiveType, NumPrimitives,
idxData, idxSize, minIndex, StartIdx);
} else {
/* We can use the fast version of GL pointers */
drawStridedFast(iface, &dataLocations, PrimitiveType, NumPrimitives,
drawStridedFast(iface, &dataLocations, PrimitiveType, NumPrimitives,
idxData, idxSize, minIndex, StartIdx);
}
......@@ -1816,10 +1815,10 @@ void drawPrimitive(IWineD3DDevice *iface,
if (errPos != -1)
FIXME("HW PixelShader Error at position: %d\n%s\n", errPos, glGetString( GL_PROGRAM_ERROR_STRING_ARB) );
#endif
glDisable(GL_FRAGMENT_PROGRAM_ARB);
glDisable(GL_FRAGMENT_PROGRAM_ARB);
}
#endif
/* Finshed updating the screen, restore lock */
LEAVE_GL();
TRACE("Done all gl drawing\n");
......@@ -1851,7 +1850,7 @@ void drawPrimitive(IWineD3DDevice *iface,
}
}
#endif
primCounter = primCounter + 1;
primCounter = primCounter + 1;
}
}
#endif
......
......@@ -4,6 +4,7 @@
* Copyright 2002-2004 Jason Edmeades
* Copyright 2003-2004 Raphael Junqueira
* Copyright 2004 Christian Costa
* Copyright 2005 Oliver Stieber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -47,7 +48,7 @@ ULONG WINAPI IWineD3DIndexBufferImpl_AddRef(IWineD3DIndexBuffer *iface) {
IWineD3DIndexBufferImpl *This = (IWineD3DIndexBufferImpl *)iface;
ULONG ref = InterlockedIncrement(&This->resource.ref);
TRACE("(%p) : AddRef increasing from %ld\n", This, ref - 1);
return ref;
return ref;
}
ULONG WINAPI IWineD3DIndexBufferImpl_Release(IWineD3DIndexBuffer *iface) {
......@@ -128,9 +129,11 @@ HRESULT WINAPI IWineD3DIndexBufferImpl_GetDesc(IWineD3DIndexBuffer *ifac
const IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl =
{
/* IUnknown */
IWineD3DIndexBufferImpl_QueryInterface,
IWineD3DIndexBufferImpl_AddRef,
IWineD3DIndexBufferImpl_Release,
/* IWineD3DResource */
IWineD3DIndexBufferImpl_GetParent,
IWineD3DIndexBufferImpl_GetDevice,
IWineD3DIndexBufferImpl_SetPrivateData,
......@@ -140,6 +143,7 @@ const IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl =
IWineD3DIndexBufferImpl_GetPriority,
IWineD3DIndexBufferImpl_PreLoad,
IWineD3DIndexBufferImpl_GetType,
/* IWineD3DIndexBuffer */
IWineD3DIndexBufferImpl_Lock,
IWineD3DIndexBufferImpl_Unlock,
IWineD3DIndexBufferImpl_GetDesc
......
......@@ -4,6 +4,7 @@
* Copyright 2002-2004 Jason Edmeades
* Copyright 2003-2004 Raphael Junqueira
* Copyright 2004 Christian Costa
* Copyright 2005 Oliver Stieber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -26,7 +27,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info
/* IDirect3DResource IUnknown parts follow: */
/* IWineD3DResource IUnknown parts follow: */
HRESULT WINAPI IWineD3DResourceImpl_QueryInterface(IWineD3DResource *iface, REFIID riid, LPVOID *ppobj)
{
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
......@@ -71,7 +72,7 @@ void IWineD3DResourceImpl_CleanUp(IWineD3DResource *iface){
This->resource.allocatedMemory = 0;
}
/* IDirect3DResource Interface follow: */
/* IWineD3DResource Interface follow: */
HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice** ppDevice) {
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
TRACE("(%p) : returning %p\n", This, This->resource.wineD3DDevice);
......@@ -128,9 +129,11 @@ HRESULT WINAPI IWineD3DResourceImpl_GetParent(IWineD3DResource *iface, IUnknown
static const IWineD3DResourceVtbl IWineD3DResource_Vtbl =
{
/* IUnknown */
IWineD3DResourceImpl_QueryInterface,
IWineD3DResourceImpl_AddRef,
IWineD3DResourceImpl_Release,
/* IWineD3DResource */
IWineD3DResourceImpl_GetParent,
IWineD3DResourceImpl_GetDevice,
IWineD3DResourceImpl_SetPrivateData,
......
......@@ -454,7 +454,7 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
unsigned int i;
/* Note this may have a large overhead but it should only be executed
once, in order to initialize the complete state of the device and
once, in order to initialize the complete state of the device and
all opengl equivalents */
TRACE("-----------------------> Setting up device defaults...\n");
This->blockType = D3DSBT_ALL;
......@@ -634,7 +634,7 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
/* Sampler states*/
for (i = 0 ; i < MAX_SAMPLERS; i++) {
TRACE("Setting up default samplers states for sampler %d\n", i);
TRACE("Setting up default samplers states for sampler %d\n", i);
This->samplerState[i][WINED3DSAMP_ADDRESSU ] = D3DTADDRESS_WRAP;
This->samplerState[i][WINED3DSAMP_ADDRESSV ] = D3DTADDRESS_WRAP;
This->samplerState[i][WINED3DSAMP_ADDRESSW ] = D3DTADDRESS_WRAP;
......@@ -714,9 +714,11 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl =
{
/* IUnknown */
IWineD3DStateBlockImpl_QueryInterface,
IWineD3DStateBlockImpl_AddRef,
IWineD3DStateBlockImpl_Release,
/* IWineD3DStateBlock */
IWineD3DStateBlockImpl_GetParent,
IWineD3DStateBlockImpl_GetDevice,
IWineD3DStateBlockImpl_Capture,
......
......@@ -4,7 +4,7 @@
* Copyright 2002-2005 Jason Edmeades
* Copyright 2002-2003 Raphael Junqueira
* Copyright 2004 Christian Costa
* Copyright 2005 Oliver Stieber
* Copyright 2005 Oliver Stieber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -107,7 +107,7 @@ void WINAPI IWineD3DSurfaceImpl_PreLoad(IWineD3DSurface *iface) {
/* TODO: re-write the way textures and managed,
* use a 'opengl context manager' to manage RenderTarget surfaces
** *********************************************************/
/* TODO: check for locks */
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
IWineD3DBaseTexture *baseTexture = NULL;
......@@ -116,7 +116,7 @@ void WINAPI IWineD3DSurfaceImpl_PreLoad(IWineD3DSurface *iface) {
TRACE("Passing to conatiner\n");
IWineD3DBaseTexture_PreLoad(baseTexture);
IWineD3DBaseTexture_Release(baseTexture);
} else{
} else {
TRACE("(%p) : About to load surface\n", This);
ENTER_GL();
#if 0 /* TODO: context manager support */
......@@ -131,7 +131,7 @@ void WINAPI IWineD3DSurfaceImpl_PreLoad(IWineD3DSurface *iface) {
checkGLcall("glBindTexture");
IWineD3DSurface_LoadTexture(iface);
/* This is where we should be reducing the amount of GLMemoryUsed */
}else {
} else {
if (This->glDescription.level == 0) {
glBindTexture(This->glDescription.target, This->glDescription.textureName);
checkGLcall("glBindTexture");
......@@ -158,10 +158,12 @@ void WINAPI IWineD3DSurfaceImpl_PreLoad(IWineD3DSurface *iface) {
}
D3DRESOURCETYPE WINAPI IWineD3DSurfaceImpl_GetType(IWineD3DSurface *iface) {
TRACE("(%p) : calling resourceimpl_GetType\n", iface);
return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface);
}
HRESULT WINAPI IWineD3DSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **pParent) {
TRACE("(%p) : calling resourceimpl_GetParent\n", iface);
return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent);
}
......@@ -202,7 +204,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFAC
return D3D_OK;
}
void WINAPI IWineD3DSurfaceImpl_SetGlTextureDesc(IWineD3DSurface *iface, UINT textureName, int target){
void WINAPI IWineD3DSurfaceImpl_SetGlTextureDesc(IWineD3DSurface *iface, UINT textureName, int target) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
TRACE("(%p) : setting textureName %u, target %i\n", This, textureName, target);
if (This->glDescription.textureName == 0 && textureName != 0) {
......@@ -213,7 +215,7 @@ void WINAPI IWineD3DSurfaceImpl_SetGlTextureDesc(IWineD3DSurface *iface, UINT te
This->glDescription.target = target;
}
void WINAPI IWineD3DSurfaceImpl_GetGlDesc(IWineD3DSurface *iface, glDescriptor **glDescription){
void WINAPI IWineD3DSurfaceImpl_GetGlDesc(IWineD3DSurface *iface, glDescriptor **glDescription) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
TRACE("(%p) : returning %p\n", This, &This->glDescription);
*glDescription = &This->glDescription;
......@@ -243,36 +245,38 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
}
if (FALSE == This->lockable) {
/* Note: UpdateTextures calls CopyRects which calls this routine to populate the
/* Note: UpdateTextures calls CopyRects which calls this routine to populate the
texture regions, and since the destination is an unlockable region we need
to tolerate this */
TRACE("Warning: trying to lock unlockable surf@%p\n", This);
TRACE("Warning: trying to lock unlockable surf@%p\n", This);
/*return D3DERR_INVALIDCALL; */
}
IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain);
if (This->resource.usage & D3DUSAGE_RENDERTARGET) {
IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain);
if (swapchain != NULL || iface == myDevice->renderTarget || iface == myDevice->depthStencilBuffer) {
if (swapchain != NULL && iface == swapchain->backBuffer) {
TRACE("(%p, backBuffer) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
} else if (swapchain != NULL && iface == swapchain->frontBuffer) {
TRACE("(%p, frontBuffer) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
} else if (iface == myDevice->renderTarget) {
TRACE("(%p, renderTarget) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
} else if (iface == myDevice->depthStencilBuffer) {
TRACE("(%p, stencilBuffer) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
}
if (swapchain != NULL || iface == myDevice->renderTarget || iface == myDevice->depthStencilBuffer) {
if (swapchain != NULL && iface == swapchain->backBuffer) {
TRACE("(%p, backBuffer) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
} else if (swapchain != NULL && iface == swapchain->frontBuffer) {
TRACE("(%p, frontBuffer) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
} else if (iface == myDevice->renderTarget) {
TRACE("(%p, renderTarget) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
} else if (iface == myDevice->depthStencilBuffer) {
TRACE("(%p, stencilBuffer) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
}
if (NULL != swapchain) {
IWineD3DSwapChain_Release((IWineD3DSwapChain *)swapchain);
if (NULL != swapchain) {
IWineD3DSwapChain_Release((IWineD3DSwapChain *)swapchain);
}
swapchain = NULL;
}
swapchain = NULL;
} else {
TRACE("(%p) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->resource.allocatedMemory);
}
/* DXTn formats don't have exact pitches as they are to the new row of blocks,
where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt3/5)
where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt3/5)
ie pitch = (width/4) * bytes per block */
if (This->resource.format == WINED3DFMT_DXT1) /* DXT1 is 8 bytes per block */
pLockedRect->Pitch = (This->currentDesc.Width >> 2) << 3;
......@@ -302,7 +306,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
This->lockedRect.bottom = pRect->bottom;
}
if(This->nonpow2){
if (This->nonpow2) {
TRACE("Locking non-power 2 texture\n");
}
......@@ -407,31 +411,31 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
if (iface == myDevice->renderTarget || iface == swapchain->backBuffer) {
TRACE("locking back buffer\n");
glReadBuffer(GL_BACK);
}else if (iface == swapchain->frontBuffer) {
} else if (iface == swapchain->frontBuffer) {
TRACE("locking front\n");
glReadBuffer(GL_FRONT);
}else if (iface == myDevice->depthStencilBuffer) {
} else if (iface == myDevice->depthStencilBuffer) {
FIXME("Stencil Buffer lock unsupported for now\n");
} else{
} else {
FIXME("(%p) Shouldn't have got here!\n", This);
glReadBuffer(GL_BACK);
}
}else if (swapchain != NULL) {
} else if (swapchain != NULL) {
IWineD3DSwapChainImpl *implSwapChain;
IWineD3DDevice_GetSwapChain((IWineD3DDevice *)myDevice, 0, (IWineD3DSwapChain **)&implSwapChain);
if (swapchain->glCtx == implSwapChain->render_ctx && swapchain->drawable == implSwapChain->win) {
/* This will fail for the implicit swapchain, which is why there needs to be a context manager */
if (iface == swapchain->backBuffer) {
glReadBuffer(GL_BACK);
}else if (iface == swapchain->frontBuffer) {
} else if (iface == swapchain->frontBuffer) {
glReadBuffer(GL_FRONT);
} else if (iface == myDevice->depthStencilBuffer) {
FIXME("Stencil Buffer lock unsupported for now\n");
} else{
} else {
FIXME("Should have got here!\n");
glReadBuffer(GL_BACK);
}
}else{
} else {
/* We need to switch contexts to be able to read the buffer!!! */
FIXME("The buffer requested isn't in the current openGL context\n");
notInContext = TRUE;
......@@ -468,7 +472,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
BOOL ati_performance_hack = FALSE;
ati_performance_hack = (This->lockedRect.bottom - This->lockedRect.top > 10) || (This->lockedRect.right - This->lockedRect.left > 10)? TRUE: FALSE;
#endif
if ((This->lockedRect.left ==0 && This->lockedRect.top ==0 &&
if ((This->lockedRect.left == 0 && This->lockedRect.top == 0 &&
This->lockedRect.right == This->currentDesc.Width
&& This->lockedRect.bottom == This->currentDesc.Height)) {
glReadPixels(0, 0,
......@@ -477,7 +481,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
This->glDescription.glFormat,
This->glDescription.glType,
(char *)pLockedRect->pBits);
}else if (This->lockedRect.left ==0 && This->lockedRect.right == This->currentDesc.Width) {
} else if (This->lockedRect.left == 0 && This->lockedRect.right == This->currentDesc.Width) {
glReadPixels(0,
This->lockedRect.top,
This->currentDesc.Width,
......@@ -507,19 +511,19 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
} else if (D3DUSAGE_DEPTHSTENCIL & This->resource.usage) { /* stencil surfaces */
if(!messages & 1){
if (!messages & 1) {
FIXME("TODO stencil depth surface locking surf%p usage(%lu)\n", This, This->resource.usage);
/*
glReadPixels(This->lockedRect.left,
This->lockedRect.bottom - j - 1,
This->lockedRect.bottom - j - 1,
This->lockedRect.right - This->lockedRect.left,
1,
GL_STENCIL_INDEX or GL_DEPTH_COMPONENT
)
*/
messages |=1;
messages |= 1;
}
} else {
FIXME("unsupported locking to surface surf@%p usage(%lu)\n", This, This->resource.usage);
......@@ -540,7 +544,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RE
TRACE("Making container dirty\n");
IWineD3DBaseTexture_SetDirty(pBaseTexture, TRUE);
IWineD3DBaseTexture_Release(pBaseTexture);
}else{
} else {
TRACE("Surface is standalone, no need to dirty the container\n");
}
}
......@@ -563,16 +567,18 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
return D3DERR_INVALIDCALL;
}
IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain);
if (D3DUSAGE_RENDERTARGET & This->resource.usage) {
IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **)&swapchain);
if ((swapchain != NULL) && iface == swapchain->backBuffer) {
buffername = "backBuffer";
} else if ((swapchain != NULL) && iface == swapchain->frontBuffer) {
buffername = "frontBuffer";
} else if (iface == myDevice->depthStencilBuffer) {
buffername = "depthStencilBuffer";
} else if (iface == myDevice->renderTarget) {
buffername = "renderTarget";
if ((swapchain != NULL) && iface == swapchain->backBuffer) {
buffername = "backBuffer";
} else if ((swapchain != NULL) && iface == swapchain->frontBuffer) {
buffername = "frontBuffer";
} else if (iface == myDevice->depthStencilBuffer) {
buffername = "depthStencilBuffer";
} else if (iface == myDevice->renderTarget) {
buffername = "renderTarget";
}
}
if (swapchain != NULL) {
......@@ -621,7 +627,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
vcheckGLcall("glPixelZoom");
/* glDrawPixels transforms the raster position as though it was a vertex -
we want to draw at screen position 0,0 - Set up ortho (rhw) mode as
we want to draw at screen position 0,0 - Set up ortho (rhw) mode as
per drawprim (and leave set - it will sort itself out due to last_was_rhw */
if (!myDevice->last_was_rhw) {
......@@ -629,7 +635,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
myDevice->last_was_rhw = TRUE;
/* Transformed already into viewport coordinates, so we do not need transform
matrices. Reset all matrices to identity and leave the default matrix in world
matrices. Reset all matrices to identity and leave the default matrix in world
mode. */
glMatrixMode(GL_MODELVIEW);
checkGLcall("glMatrixMode");
......@@ -819,7 +825,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) {
if ((This->resource.format == WINED3DFMT_P8 || This->resource.format == WINED3DFMT_A8P8) &&
!GL_SUPPORT(EXT_PALETTED_TEXTURE)) {
/**
* wanted a paletted texture and not really support it in HW
* wanted a paletted texture and not really support it in HW
* so software emulation code begin
*/
UINT i;
......@@ -836,7 +842,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) {
if (This->resource.format == WINED3DFMT_A8P8)
*dst++ = pal[color].peFlags;
else
*dst++ = 0xFF;
*dst++ = 0xFF;
}
ENTER_GL();
......@@ -845,9 +851,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) {
This->glDescription.target,
This->glDescription.level,
GL_RGBA,
This->currentDesc.Width,
This->currentDesc.Height,
0,
This->currentDesc.Width,
This->currentDesc.Height,
0,
GL_RGBA,
GL_UNSIGNED_BYTE,
surface);
......@@ -865,7 +871,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) {
LEAVE_GL();
return D3D_OK;
return D3D_OK;
}
/* TODO: Compressed non-power 2 support */
......@@ -878,9 +884,9 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) {
This->glDescription.target,
This->glDescription.level,
This->glDescription.glFormatInternal,
This->currentDesc.Width,
This->currentDesc.Height,
0,
This->currentDesc.Width,
This->currentDesc.Height,
0,
This->resource.size,
This->resource.allocatedMemory);
......@@ -963,7 +969,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface) {
This->glDescription.glFormatInternal,
This->currentDesc.Width,
This->currentDesc.Height,
0,
0,
This->glDescription.glFormat,
This->glDescription.glType,
This->resource.allocatedMemory);
......@@ -1084,7 +1090,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const ch
}
}
break;
default:
default:
FIXME("Unimplemented dump mode format(%u,%s)\n", This->resource.format, debug_d3dformat(This->resource.format));
}
fclose(f);
......@@ -1098,7 +1104,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_CleanDirtyRect(IWineD3DSurface *iface) {
This->dirtyRect.top = This->currentDesc.Height;
This->dirtyRect.right = 0;
This->dirtyRect.bottom = 0;
TRACE("(%p) : Dirty?%d, Rect:(%ld,%ld,%ld,%ld)\n", This, This->Dirty, This->dirtyRect.left,
TRACE("(%p) : Dirty?%d, Rect:(%ld,%ld,%ld,%ld)\n", This, This->Dirty, This->dirtyRect.left,
This->dirtyRect.top, This->dirtyRect.right, This->dirtyRect.bottom);
return D3D_OK;
}
......@@ -1121,7 +1127,7 @@ extern HRESULT WINAPI IWineD3DSurfaceImpl_AddDirtyRect(IWineD3DSurface *iface, C
This->dirtyRect.right = This->currentDesc.Width;
This->dirtyRect.bottom = This->currentDesc.Height;
}
TRACE("(%p) : Dirty?%d, Rect:(%ld,%ld,%ld,%ld)\n", This, This->Dirty, This->dirtyRect.left,
TRACE("(%p) : Dirty?%d, Rect:(%ld,%ld,%ld,%ld)\n", This, This->Dirty, This->dirtyRect.left,
This->dirtyRect.top, This->dirtyRect.right, This->dirtyRect.bottom);
/* if the container is a basetexture then mark it dirty. */
if (IWineD3DSurface_GetContainer(iface, &IID_IWineD3DBaseTexture, (void **)&baseTexture) == D3D_OK) {
......@@ -1136,13 +1142,13 @@ HRESULT WINAPI IWineD3DSurfaceImpl_SetContainer(IWineD3DSurface *iface, IUnknown
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
TRACE("Setting container to %p from %p\n", container, This->container);
This->container = container;
return D3D_OK;
return D3D_OK;
}
/* TODO: replace this function with context management routines */
HRESULT WINAPI IWineD3DSurfaceImpl_SetPBufferState(IWineD3DSurface *iface, BOOL inPBuffer, BOOL inTexture) {
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
This->inPBuffer = inPBuffer;
This->inTexture = inTexture;
return D3D_OK;
......@@ -1164,7 +1170,7 @@ const IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
IWineD3DSurfaceImpl_GetPriority,
IWineD3DSurfaceImpl_PreLoad,
IWineD3DSurfaceImpl_GetType,
/* IWineD3DSurface */
/* IWineD3DSurface */
IWineD3DSurfaceImpl_GetContainer,
IWineD3DSurfaceImpl_GetDesc,
IWineD3DSurfaceImpl_LockRect,
......
......@@ -45,11 +45,11 @@ inline static Display *get_display( HDC hdc )
return display;
}
/*TODO: some of the additional parameters may be required to
/*TODO: some of the additional parameters may be required to
set the gamma ramp (for some weird reason microsoft have left swap gammaramp in device
but it operates on a swapchain, it may be a good idea to move it to IWineD3DSwapChain for IWineD3D)*/
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(d3d_fps);
......@@ -75,14 +75,14 @@ HRESULT WINAPI IWineD3DSwapChainImpl_QueryInterface(IWineD3DSwapChain *iface, RE
}
*ppobj = This;
return D3D_OK;
}
}
return E_NOINTERFACE;
}
ULONG WINAPI IWineD3DSwapChainImpl_Release(IWineD3DSwapChain *iface) {
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
DWORD refCount;
DWORD refCount;
refCount = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %ld\n", This, refCount);
if (refCount == 0) {
......@@ -125,20 +125,20 @@ HRESULT WINAPI IWineD3DSwapChainImpl_GetParent(IWineD3DSwapChain *iface, IUnknow
/*IWineD3DSwapChain parts follow: */
HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion, DWORD dwFlags) {
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
ENTER_GL();
if (pSourceRect || pDestRect) FIXME("Unhandled present options %p/%p\n", pSourceRect, pDestRect);
/* TODO: If only source rect or dest rect are supplied then clip the window to match */
TRACE("preseting display %p, drawable %ld\n", This->display, This->drawable);
/* Don't call checkGLcall, as glGetError is not applicable here */
if (hDestWindowOverride && This->win_handle != hDestWindowOverride) {
/* Set this swapchain up to point to the new destination.. */
#ifdef USE_CONTEXT_MANAGER
/* TODO: use a context mamager */
#endif
/* FIXME: Never access */
IWineD3DSwapChainImpl *swapChainImpl;
IWineD3DDevice_GetSwapChain((IWineD3DDevice *)This->wineD3DDevice, 0 , (IWineD3DSwapChain **)&swapChainImpl);
......@@ -152,11 +152,11 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CONST REC
int num;
Display *oldDisplay = This->display;
GLXContext oldContext = This->glCtx;
IUnknown* tmp;
IUnknown* tmp;
GLXContext currentContext;
Drawable currentDrawable;
hDc = GetDC(hDestWindowOverride);
This->win_handle = hDestWindowOverride;
This->win_handle = hDestWindowOverride;
This->win = (Window)GetPropA( hDestWindowOverride, "__wine_x11_whole_window" );
TRACE("Creating a new context for the window %p \n", hDestWindowOverride);
......@@ -174,7 +174,7 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CONST REC
template.visualid = (VisualID)GetPropA(GetDesktopWindow(), "__wine_x11_visual_id");
This->visInfo = XGetVisualInfo(This->display, VisualIDMask, &template, &num);
if (NULL == This->visInfo) {
ERR("cannot really get XVisual\n");
ERR("cannot really get XVisual\n");
LEAVE_GL();
return D3DERR_NOTAVAILABLE;
}
......@@ -185,7 +185,7 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CONST REC
This->glCtx = glXCreateContext(This->display, This->visInfo, swapChainImpl->glCtx, GL_TRUE);
if (NULL == This->glCtx) {
ERR("cannot create glxContext\n");
ERR("cannot create glxContext\n");
}
This->drawable = This->win;
This->render_ctx = This->glCtx;
......@@ -206,25 +206,25 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CONST REC
glClearIndex(0);
glClearDepth(1);
glClearStencil(0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ACCUM_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
checkGLcall("glClear");
glColor3f(1.0, 1.0, 1.0);
checkGLcall("glColor3f");
glEnable(GL_LIGHTING);
checkGLcall("glEnable");
glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);
checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);");
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);
checkGLcall("glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE_EXT);");
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);
checkGLcall("glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL, GL_SEPARATE_SPECULAR_COLOR);");
/* If this swapchain is currently the active context then make this swapchain active */
if(IWineD3DSurface_GetContainer((IWineD3DSurface *)This->wineD3DDevice->renderTarget, &IID_IWineD3DSwapChain, (void **)&tmp) == D3D_OK){
if(tmp != (IUnknown *)This){
......@@ -235,21 +235,21 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CONST REC
}else{
/* reset the context */
glXMakeCurrent(This->display, currentDrawable, currentContext);
checkGLcall("glXMakeCurrent");
checkGLcall("glXMakeCurrent");
}
/* delete the old contxt*/
glXDestroyContext(oldDisplay, oldContext); /* Should this happen on an active context? seems a bad idea */
LEAVE_GL();
}
IWineD3DSwapChain_Release((IWineD3DSwapChain *)swapChainImpl);
}
/* TODO: The slow way, save the data to memory, create a new context for the destination window, transfer the data cleanup, it may be a good idea to the move this swapchain over to the using the target winows context so that it runs faster in feature. */
glXSwapBuffers(This->display, This->drawable); /* TODO: cycle through the swapchain buffers */
TRACE("glXSwapBuffers called, Starting new frame\n");
/* FPS support */
if (TRACE_ON(d3d_fps))
......@@ -308,8 +308,8 @@ HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CONST REC
/* Although this is not strictly required, a simple demo showed this does occur
on (at least non-debug) d3d */
if (This->presentParms.SwapEffect & D3DSWAPEFFECT_DISCARD) {
TRACE("Clearing\n");
TRACE("Clearing\n");
IWineD3DDevice_Clear((IWineD3DDevice*)This->wineD3DDevice, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0);
......@@ -323,7 +323,7 @@ HRESULT WINAPI IWineD3DSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface
IWineD3DSurfaceImpl *surface = (IWineD3DSurfaceImpl *)pDestSurface;
GLenum format;
GLenum type;
TRACE("(%p) : iface(%p) pDestSurface(%p) \n", This, iface, pDestSurface);
ENTER_GL();
......@@ -331,21 +331,21 @@ HRESULT WINAPI IWineD3DSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface
format = D3DFmt2GLFmt(This->wineD3DDevice, surface->resource.format);
type = D3DFmt2GLType(This->wineD3DDevice, surface->resource.format);
glReadBuffer(GL_FRONT);
glReadPixels(0,
0,
surface->currentDesc.Width,
glReadPixels(0,
0,
surface->currentDesc.Width,
surface->currentDesc.Height,
format,
type,
surface->resource.allocatedMemory);
format,
type,
surface->resource.allocatedMemory);
LEAVE_GL();
return D3D_OK;
}
HRESULT WINAPI IWineD3DSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IWineD3DSurface **ppBackBuffer) {
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
*ppBackBuffer = (IWineD3DSurface *) This->backBuffer;
TRACE("(%p) : BackBuf %d Type %d returning %p\n", This, iBackBuffer, Type, *ppBackBuffer);
......@@ -355,13 +355,13 @@ HRESULT WINAPI IWineD3DSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface, UIN
}
/* Note inc ref on returned surface */
IWineD3DSurface_AddRef(*ppBackBuffer);
IWineD3DSurface_AddRef(*ppBackBuffer);
return D3D_OK;
}
HRESULT WINAPI IWineD3DSwapChainImpl_GetRasterStatus(IWineD3DSwapChain *iface, D3DRASTER_STATUS*pRasterStatus) {
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
pRasterStatus->InVBlank = TRUE;
pRasterStatus->ScanLine = 0;
FIXME("(%p) : stub\n", This);
......@@ -369,7 +369,7 @@ HRESULT WINAPI IWineD3DSwapChainImpl_GetRasterStatus(IWineD3DSwapChain *iface, D
}
HRESULT WINAPI IWineD3DSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface, D3DDISPLAYMODE*pMode) {
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
HDC hdc;
int bpp = 0;
......@@ -386,22 +386,22 @@ HRESULT WINAPI IWineD3DSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface, D3
case 16: pMode->Format = D3DFMT_R5G6B5; break;
case 24: /*pMode->Format = D3DFMT_R8G8B8; break; */ /* 32bpp and 24bpp can be aliased for X */
case 32: pMode->Format = D3DFMT_A8R8G8B8; break;
default:
default:
FIXME("Unrecognized display mode format\n");
pMode->Format = D3DFMT_UNKNOWN;
}
TRACE("(%p) : returning w(%d) h(%d) rr(%d) fmt(%u,%s)\n", This, pMode->Width, pMode->Height, pMode->RefreshRate,
pMode->Format, debug_d3dformat(pMode->Format));
return D3D_OK;
return D3D_OK;
}
HRESULT WINAPI IWineD3DSwapChainImpl_GetDevice(IWineD3DSwapChain *iface, IWineD3DDevice**ppDevice) {
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
*ppDevice = (IWineD3DDevice *) This->wineD3DDevice;
/* Note Calling this method will increase the internal reference count
/* Note Calling this method will increase the internal reference count
on the IDirect3DDevice9 interface. */
IWineD3DDevice_AddRef(*ppDevice);
TRACE("(%p) : returning %p\n", This, *ppDevice);
......@@ -410,7 +410,7 @@ HRESULT WINAPI IWineD3DSwapChainImpl_GetDevice(IWineD3DSwapChain *iface, IWineD3
HRESULT WINAPI IWineD3DSwapChainImpl_GetPresentParameters(IWineD3DSwapChain *iface, D3DPRESENT_PARAMETERS *pPresentationParameters) {
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
FIXME("(%p) : copy\n", This);
FIXME("(%p) : copy\n", This);
memcpy(pPresentationParameters, &This->presentParms, sizeof(D3DPRESENT_PARAMETERS));
return D3D_OK;
}
......@@ -424,7 +424,7 @@ HRESULT WINAPI IWineD3DSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *iface, DWOR
SetDeviceGammaRamp(hDC, (LPVOID)pRamp);
ReleaseDC(This->win_handle, hDC);
return D3D_OK;
}
HRESULT WINAPI IWineD3DSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface, D3DGAMMARAMP *pRamp){
......@@ -436,15 +436,17 @@ HRESULT WINAPI IWineD3DSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface, D3DG
GetDeviceGammaRamp(hDC, pRamp);
ReleaseDC(This->win_handle, hDC);
return D3D_OK;
}
IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl =
{
/* IUnknown */
IWineD3DSwapChainImpl_QueryInterface,
IWineD3DSwapChainImpl_AddRef,
IWineD3DSwapChainImpl_Release,
/* IWineD3DSwapChain */
IWineD3DSwapChainImpl_GetParent,
IWineD3DSwapChainImpl_GetDevice,
IWineD3DSwapChainImpl_Present,
......@@ -454,5 +456,5 @@ IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl =
IWineD3DSwapChainImpl_GetDisplayMode,
IWineD3DSwapChainImpl_GetPresentParameters,
IWineD3DSwapChainImpl_SetGammaRamp,
IWineD3DSwapChainImpl_GetGammaRamp
IWineD3DSwapChainImpl_GetGammaRamp
};
......@@ -231,7 +231,7 @@ HRESULT WINAPI IWineD3DTextureImpl_GetSurfaceLevel(IWineD3DTexture *iface, UINT
return hr;
}
HRESULT WINAPI IWineD3DTextureImpl_LockRect(IWineD3DTexture *iface, UINT Level, D3DLOCKED_RECT *pLockedRect,
HRESULT WINAPI IWineD3DTextureImpl_LockRect(IWineD3DTexture *iface, UINT Level, D3DLOCKED_RECT *pLockedRect,
CONST RECT *pRect, DWORD Flags) {
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
HRESULT hr = D3DERR_INVALIDCALL;
......@@ -266,7 +266,7 @@ HRESULT WINAPI IWineD3DTextureImpl_UnlockRect(IWineD3DTexture *iface, UINT Level
HRESULT WINAPI IWineD3DTextureImpl_AddDirtyRect(IWineD3DTexture *iface, CONST RECT* pDirtyRect) {
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
This->baseTexture.dirty = TRUE;
TRACE("(%p) : dirtyfication of surface Level (0)\n", This);
TRACE("(%p) : dirtyfication of surface Level (0)\n", This);
return IWineD3DSurface_AddDirtyRect((IWineD3DSurface *)This->surfaces[0], pDirtyRect);
}
......
......@@ -4,6 +4,7 @@
* Copyright 2002-2004 Jason Edmeades
* Copyright 2003-2004 Raphael Junqueira
* Copyright 2004 Christian Costa
* Copyright 2005 Oliver Stieber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -40,12 +41,12 @@ const char* debug_d3dformat(D3DFORMAT fmt) {
FMT_TO_STR(WINED3DFMT_A1R5G5B5);
FMT_TO_STR(WINED3DFMT_A4R4G4B4);
FMT_TO_STR(WINED3DFMT_R3G3B2);
FMT_TO_STR(WINED3DFMT_A8);
FMT_TO_STR(WINED3DFMT_A8);
FMT_TO_STR(WINED3DFMT_A8R3G3B2);
FMT_TO_STR(WINED3DFMT_X4R4G4B4);
FMT_TO_STR(WINED3DFMT_G16R16);
FMT_TO_STR(WINED3DFMT_A2R10G10B10);
FMT_TO_STR(WINED3DFMT_A16B16G16R16);
FMT_TO_STR(WINED3DFMT_A16B16G16R16);
FMT_TO_STR(WINED3DFMT_A8P8);
FMT_TO_STR(WINED3DFMT_P8);
FMT_TO_STR(WINED3DFMT_L8);
......@@ -57,7 +58,7 @@ const char* debug_d3dformat(D3DFORMAT fmt) {
FMT_TO_STR(WINED3DFMT_Q8W8V8U8);
FMT_TO_STR(WINED3DFMT_V16U16);
FMT_TO_STR(WINED3DFMT_W11V11U10);
FMT_TO_STR(WINED3DFMT_A2W10V10U10);
FMT_TO_STR(WINED3DFMT_A2W10V10U10);
FMT_TO_STR(WINED3DFMT_UYVY);
FMT_TO_STR(WINED3DFMT_YUY2);
FMT_TO_STR(WINED3DFMT_DXT1);
......@@ -95,7 +96,7 @@ const char* debug_d3ddevicetype(D3DDEVTYPE devtype) {
#define DEVTYPE_TO_STR(dev) case dev: return #dev
DEVTYPE_TO_STR(D3DDEVTYPE_HAL);
DEVTYPE_TO_STR(D3DDEVTYPE_REF);
DEVTYPE_TO_STR(D3DDEVTYPE_SW);
DEVTYPE_TO_STR(D3DDEVTYPE_SW);
#undef DEVTYPE_TO_STR
default:
FIXME("Unrecognized %u D3DDEVTYPE!\n", devtype);
......@@ -233,8 +234,8 @@ const char* debug_d3drenderstate(DWORD state) {
D3DSTATE_TO_STR(WINED3DRS_COLORWRITEENABLE );
D3DSTATE_TO_STR(WINED3DRS_TWEENFACTOR );
D3DSTATE_TO_STR(WINED3DRS_BLENDOP );
D3DSTATE_TO_STR(WINED3DRS_POSITIONORDER );
D3DSTATE_TO_STR(WINED3DRS_NORMALORDER );
D3DSTATE_TO_STR(WINED3DRS_POSITIONDEGREE );
D3DSTATE_TO_STR(WINED3DRS_NORMALDEGREE );
#undef D3DSTATE_TO_STR
default:
FIXME("Unrecognized %lu render state!\n", state);
......@@ -311,13 +312,13 @@ const char* debug_d3dpool(D3DPOOL Pool) {
* Useful functions mapping GL <-> D3D values
*/
GLenum StencilOp(DWORD op) {
switch(op) {
switch(op) {
case D3DSTENCILOP_KEEP : return GL_KEEP;
case D3DSTENCILOP_ZERO : return GL_ZERO;
case D3DSTENCILOP_REPLACE : return GL_REPLACE;
case D3DSTENCILOP_INCRSAT : return GL_INCR;
case D3DSTENCILOP_DECRSAT : return GL_DECR;
case D3DSTENCILOP_INVERT : return GL_INVERT;
case D3DSTENCILOP_INVERT : return GL_INVERT;
case D3DSTENCILOP_INCR : return GL_INCR_WRAP_EXT;
case D3DSTENCILOP_DECR : return GL_DECR_WRAP_EXT;
default:
......@@ -341,8 +342,8 @@ GLenum StencilOp(DWORD op) {
#endif
#if !defined(combine_ext)
void set_tex_op(LPDIRECT3DDEVICE8 iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3)
{
void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3)
{
FIXME("Requires opengl combine extensions to work\n");
return;
}
......@@ -367,15 +368,15 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
/* Note: Operations usually involve two ars, src0 and src1 and are operations of
the form (a1 <operation> a2). However, some of the more complex operations
take 3 parameters. Instead of the (sensible) addition of a3, Microsoft added
take 3 parameters. Instead of the (sensible) addition of a3, Microsoft added
in a third parameter called a0. Therefore these are operations of the form
a0 <operation> a1 <operation> a2, ie the new parameter goes to the front.
However, below we treat the new (a0) parameter as src2/opr2, so in the actual
functions below, expect their syntax to differ slightly to those listed in the
manuals, ie replace arg1 with arg3, arg2 with arg1 and arg3 with arg2
This affects D3DTOP_MULTIPLYADD and D3DTOP_LERP */
if (isAlpha) {
comb_target = useext(GL_COMBINE_ALPHA);
src0_target = useext(GL_SOURCE0_ALPHA);
......@@ -398,17 +399,17 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
}
/* From MSDN (WINED3DTSS_ALPHAARG1) :
The default argument is D3DTA_TEXTURE. If no texture is set for this stage,
The default argument is D3DTA_TEXTURE. If no texture is set for this stage,
then the default argument is D3DTA_DIFFUSE.
FIXME? If texture added/removed, may need to reset back as well? */
if (isAlpha && This->stateBlock->textures[Stage] == NULL && arg1 == D3DTA_TEXTURE) {
GetSrcAndOpFromValue(D3DTA_DIFFUSE, isAlpha, &src1, &opr1);
GetSrcAndOpFromValue(D3DTA_DIFFUSE, isAlpha, &src1, &opr1);
} else {
GetSrcAndOpFromValue(arg1, isAlpha, &src1, &opr1);
}
GetSrcAndOpFromValue(arg2, isAlpha, &src2, &opr2);
GetSrcAndOpFromValue(arg3, isAlpha, &src3, &opr3);
TRACE("ct(%x), 1:(%x,%x), 2:(%x,%x), 3:(%x,%x)\n", comb_target, src1, opr1, src2, opr2, src3, opr3);
Handled = TRUE; /* Assume will be handled */
......@@ -434,60 +435,60 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, GL_SRC_ALPHA);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_ZERO");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
break;
case D3DTOP_SELECTARG1: /* = a1 * 1 + 0 * 0 */
case D3DTOP_SELECTARG2: /* = a2 * 1 + 0 * 0 */
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD");
if (op == D3DTOP_SELECTARG1) {
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
} else {
glTexEnvi(GL_TEXTURE_ENV, src0_target, src2);
glTexEnvi(GL_TEXTURE_ENV, src0_target, src2);
checkGLcall("GL_TEXTURE_ENV, src0_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr2");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr2");
}
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, src2_target, GL_ZERO");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr");
glTexEnvi(GL_TEXTURE_ENV, src3_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, src3_target, GL_ZERO");
glTexEnvi(GL_TEXTURE_ENV, opr3_target, opr);
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
checkGLcall("GL_TEXTURE_ENV, opr3_target, opr");
break;
case D3DTOP_MODULATE:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
......@@ -501,15 +502,15 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
case D3DTOP_MODULATE2X:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
......@@ -523,15 +524,15 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
case D3DTOP_MODULATE4X:
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_ADD);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_ADD"); /* Add = a0*a1 + a2*a3 */
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
glTexEnvi(GL_TEXTURE_ENV, src0_target, src1);
checkGLcall("GL_TEXTURE_ENV, src0_target, src1");
glTexEnvi(GL_TEXTURE_ENV, opr0_target, opr1);
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1");
glTexEnvi(GL_TEXTURE_ENV, src1_target, src2);
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
glTexEnvi(GL_TEXTURE_ENV, opr1_target, opr2);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, src2_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr);
checkGLcall("GL_TEXTURE_ENV, opr2_target, opr2");
......@@ -738,8 +739,8 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
checkGLcall("GL_TEXTURE_ENV, opr0_target, opr1"); /* a1 = 1 (see docs) */
glTexEnvi(GL_TEXTURE_ENV, src1_target, GL_ZERO);
checkGLcall("GL_TEXTURE_ENV, src1_target, GL_ZERO");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, opr1_target, invopr);
checkGLcall("GL_TEXTURE_ENV, opr1_target, invopr");
glTexEnvi(GL_TEXTURE_ENV, src2_target, src2); /* a2 = arg2 */
checkGLcall("GL_TEXTURE_ENV, src2_target, src2");
glTexEnvi(GL_TEXTURE_ENV, opr2_target, opr2);
......@@ -863,7 +864,7 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break;
case D3DTOP_BUMPENVMAP:
{
if (GL_SUPPORT(NV_TEXTURE_SHADER)) {
......@@ -874,12 +875,12 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
texture unit 3: GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV
*/
float m[2][2];
union {
float f;
DWORD d;
} tmpvalue;
tmpvalue.d = This->stateBlock->textureState[Stage][WINED3DTSS_BUMPENVMAT00];
m[0][0] = tmpvalue.f;
tmpvalue.d = This->stateBlock->textureState[Stage][WINED3DTSS_BUMPENVMAT01];
......@@ -888,7 +889,7 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
m[1][0] = tmpvalue.f;
tmpvalue.d = This->stateBlock->textureState[Stage][WINED3DTSS_BUMPENVMAT11];
m[1][1] = tmpvalue.f;
/*FIXME("Stage %d matrix is (%.2f,%.2f),(%.2f,%.2f)\n", Stage, m[0][0], m[0][1], m[1][0], m[1][0]);*/
if (FALSE == This->texture_shader_active) {
......@@ -947,7 +948,7 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
*/
LEAVE_GL();
return;
break;
break;
}
}
......@@ -959,12 +960,12 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
if (Handled) {
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV);
checkGLcall("GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE4_NV");
LEAVE_GL();
return;
}
} /* GL_NV_texture_env_combine4 */
Handled = TRUE; /* Again, assume handled */
switch (op) {
case D3DTOP_DISABLE: /* Only for alpha */
......@@ -1172,7 +1173,7 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
glTexEnvi(GL_TEXTURE_ENV, scal_target, 1);
checkGLcall("GL_TEXTURE_ENV, scal_target, 1");
break;
case D3DTOP_DOTPRODUCT3:
case D3DTOP_DOTPRODUCT3:
if (GL_SUPPORT(ARB_TEXTURE_ENV_DOT3)) {
glTexEnvi(GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB);
checkGLcall("GL_TEXTURE_ENV, comb_target, GL_DOT3_RGBA_ARB");
......@@ -1402,13 +1403,13 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
BOOL combineOK = TRUE;
if (GL_SUPPORT(NV_TEXTURE_ENV_COMBINE4)) {
DWORD op2;
if (isAlpha) {
op2 = This->stateBlock->textureState[Stage][WINED3DTSS_COLOROP];
} else {
op2 = This->stateBlock->textureState[Stage][WINED3DTSS_ALPHAOP];
}
/* Note: If COMBINE4 in effect can't go back to combine! */
switch (op2) {
case D3DTOP_ADDSMOOTH:
......@@ -1432,21 +1433,21 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP op,
}
}
}
if (combineOK) {
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, useext(GL_COMBINE));
checkGLcall("GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, useext(GL_COMBINE)");
LEAVE_GL();
return;
}
}
LEAVE_GL();
/* After all the extensions, if still unhandled, report fixme */
FIXME("Unhandled texture operation %d\n", op);
#undef GLINFO_LOCATION
#undef GLINFO_LOCATION
}
#endif
......@@ -1476,7 +1477,7 @@ void set_texture_matrix(const float *smat, DWORD flags)
case D3DTTFF_COUNT2: mat[2] = mat[6] = mat[10] = mat[14] = 0;
default: mat[3] = mat[7] = mat[11] = 0, mat[15] = 1;
}
if (flags & D3DTTFF_PROJECTED) switch (flags & ~D3DTTFF_PROJECTED) {
case D3DTTFF_COUNT2:
mat[3] = mat[1], mat[7] = mat[5], mat[11] = mat[9], mat[15] = mat[13];
......@@ -1491,26 +1492,26 @@ void set_texture_matrix(const float *smat, DWORD flags)
checkGLcall("glLoadMatrixf(mat)");
}
void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand)
void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand)
{
BOOL isAlphaReplicate = FALSE;
BOOL isComplement = FALSE;
*operand = GL_SRC_COLOR;
*source = GL_TEXTURE;
/* Catch alpha replicate */
if (iValue & D3DTA_ALPHAREPLICATE) {
iValue = iValue & ~D3DTA_ALPHAREPLICATE;
isAlphaReplicate = TRUE;
}
/* Catch Complement */
if (iValue & D3DTA_COMPLEMENT) {
iValue = iValue & ~D3DTA_COMPLEMENT;
isComplement = TRUE;
}
/* Calculate the operand */
if (isAlphaReplicate && !isComplement) {
*operand = GL_SRC_ALPHA;
......@@ -1529,7 +1530,7 @@ void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum*
*operand = GL_SRC_COLOR;
}
}
/* Calculate the source */
switch (iValue & D3DTA_SELECTMASK) {
case D3DTA_CURRENT: *source = GL_PREVIOUS_EXT;
......@@ -1574,7 +1575,7 @@ GLint D3DFmt2GLIntFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt) {
if (retVal == 0) {
switch (fmt) {
/* Paletted */
/* Paletted */
case WINED3DFMT_P8: retVal = GL_COLOR_INDEX8_EXT; break;
case WINED3DFMT_A8P8: retVal = GL_COLOR_INDEX8_EXT; break;
/* Luminance */
......@@ -1586,7 +1587,7 @@ GLint D3DFmt2GLIntFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt) {
case WINED3DFMT_V16U16: retVal = GL_COLOR_INDEX; break;
case WINED3DFMT_L6V5U5: retVal = GL_COLOR_INDEX8_EXT; break;
case WINED3DFMT_X8L8V8U8: retVal = GL_COLOR_INDEX; break;
/* color buffer */
/* color buffer */
case WINED3DFMT_R3G3B2: retVal = GL_R3_G3_B2; break;
case WINED3DFMT_R5G6B5: retVal = GL_RGB5; break; /* fixme: internal format 6 for g? */
case WINED3DFMT_R8G8B8: retVal = GL_RGB8; break;
......@@ -1741,13 +1742,13 @@ SHORT D3DFmtGetBpp(IWineD3DDeviceImpl* This, D3DFORMAT fmt) {
case WINED3DFMT_L6V5U5: retVal = 2; break;
case WINED3DFMT_V16U16: retVal = 4; break;
case WINED3DFMT_X8L8V8U8: retVal = 4; break;
/* Compressed */
/* Compressed */
case WINED3DFMT_DXT1: retVal = 1; break; /* Actually 8 bytes per 16 pixels - Special cased later */
case WINED3DFMT_DXT3: retVal = 1; break; /* Actually 16 bytes per 16 pixels */
case WINED3DFMT_DXT5: retVal = 1; break; /* Actually 16 bytes per 16 pixels */
/* to see */
case WINED3DFMT_A8: retVal = 1; break;
/* unknown */
/* unknown */
case WINED3DFMT_UNKNOWN:
/* Guess at the highest value of the above */
TRACE("WINED3DFMT_UNKNOWN - Guessing at 4 bytes/pixel %u\n", fmt);
......@@ -1764,9 +1765,9 @@ SHORT D3DFmtGetBpp(IWineD3DDeviceImpl* This, D3DFORMAT fmt) {
/* Convertes a D3D format into a OpenGL configuration format */
int D3DFmtMakeGlCfg(D3DFORMAT BackBufferFormat, D3DFORMAT StencilBufferFormat, int *attribs, int* nAttribs, BOOL alternate){
#define PUSH1(att) attribs[(*nAttribs)++] = (att);
#define PUSH1(att) attribs[(*nAttribs)++] = (att);
#define PUSH2(att,value) attribs[(*nAttribs)++] = (att); attribs[(*nAttribs)++] = (value);
/*We need to do some Card specific stuff in here at some point,
/*We need to do some Card specific stuff in here at some point,
D3D now support floating point format buffers, and their are a number of different OpelGl ways on managing thease e.g.
GLX_ATI_pixel_format_float
*/
......@@ -1820,7 +1821,7 @@ int D3DFmtMakeGlCfg(D3DFORMAT BackBufferFormat, D3DFORMAT StencilBufferFormat, i
break;
}
if(!alternate){
switch (StencilBufferFormat) {
switch (StencilBufferFormat) {
case WINED3DFMT_D16_LOCKABLE:
case WINED3DFMT_D16:
PUSH2(GLX_DEPTH_SIZE, 16);
......@@ -1829,7 +1830,7 @@ int D3DFmtMakeGlCfg(D3DFORMAT BackBufferFormat, D3DFORMAT StencilBufferFormat, i
case WINED3DFMT_D15S1:
PUSH2(GLX_DEPTH_SIZE, 15);
PUSH2(GLX_STENCIL_SIZE, 1);
/*Does openGl support a 1bit stencil?, I've seen it used elsewhere
/*Does openGl support a 1bit stencil?, I've seen it used elsewhere
e.g. http://www.ks.uiuc.edu/Research/vmd/doxygen/OpenGLDisplayDevice_8C-source.html*/
break;
......@@ -1855,8 +1856,8 @@ int D3DFmtMakeGlCfg(D3DFORMAT BackBufferFormat, D3DFORMAT StencilBufferFormat, i
break;
}
}else{ /* it the device doesn't support the 'exact' format, try to find something close */
switch (StencilBufferFormat) {
} else { /* it the device doesn't support the 'exact' format, try to find something close */
switch (StencilBufferFormat) {
case WINED3DFMT_D16_LOCKABLE:
case WINED3DFMT_D16:
PUSH2(GLX_DEPTH_SIZE, 1);
......@@ -1865,7 +1866,7 @@ int D3DFmtMakeGlCfg(D3DFORMAT BackBufferFormat, D3DFORMAT StencilBufferFormat, i
case WINED3DFMT_D15S1:
PUSH2(GLX_DEPTH_SIZE, 1);
PUSH2(GLX_STENCIL_SIZE, 1);
/*Does openGl support a 1bit stencil?, I've seen it used elsewhere
/*Does openGl support a 1bit stencil?, I've seen it used elsewhere
e.g. http://www.ks.uiuc.edu/Research/vmd/doxygen/OpenGLDisplayDevice_8C-source.html*/
break;
......
......@@ -130,9 +130,11 @@ HRESULT WINAPI IWineD3DVertexBufferImpl_GetDesc(IWineD3DVertexBuffer *if
const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl =
{
/* IUnknown */
IWineD3DVertexBufferImpl_QueryInterface,
IWineD3DVertexBufferImpl_AddRef,
IWineD3DVertexBufferImpl_Release,
/* IWineD3DResource */
IWineD3DVertexBufferImpl_GetParent,
IWineD3DVertexBufferImpl_GetDevice,
IWineD3DVertexBufferImpl_SetPrivateData,
......@@ -142,6 +144,7 @@ const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl =
IWineD3DVertexBufferImpl_GetPriority,
IWineD3DVertexBufferImpl_PreLoad,
IWineD3DVertexBufferImpl_GetType,
/* IWineD3DVertexBuffer */
IWineD3DVertexBufferImpl_Lock,
IWineD3DVertexBufferImpl_Unlock,
IWineD3DVertexBufferImpl_GetDesc
......
......@@ -55,7 +55,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_decl);
* http://developer.nvidia.com/view.asp?IO=vstovp
*
* NVIDIA: Memory Management with VAR
* http://developer.nvidia.com/view.asp?IO=var_memory_management
* http://developer.nvidia.com/view.asp?IO=var_memory_management
*/
/** Vertex Shader Declaration 8 data types tokens */
......@@ -215,21 +215,21 @@ static DWORD IWineD3DVertexDeclarationImpl_ParseToken8(const DWORD* pToken) {
++pToken;
for (i = 0; i < count; ++i) {
#if 0
TRACE(" c[%lu] = (0x%08lx, 0x%08lx, 0x%08lx, 0x%08lx)\n",
constaddress,
*pToken,
*(pToken + 1),
*(pToken + 2),
*(pToken + 3));
TRACE(" c[%lu] = (0x%08lx, 0x%08lx, 0x%08lx, 0x%08lx)\n",
constaddress,
*pToken,
*(pToken + 1),
*(pToken + 2),
*(pToken + 3));
#endif
TRACE(" c[%lu] = (%8f, %8f, %8f, %8f)\n",
constaddress,
*(const float*) pToken,
*(const float*) (pToken + 1),
*(const float*) (pToken + 2),
*(const float*) (pToken + 3));
pToken += 4;
++constaddress;
TRACE(" c[%lu] = (%8f, %8f, %8f, %8f)\n",
constaddress,
*(const float*) pToken,
*(const float*) (pToken + 1),
*(const float*) (pToken + 2),
*(const float*) (pToken + 3));
pToken += 4;
++constaddress;
}
tokenlen = (4 * count) + 1;
}
......@@ -295,7 +295,7 @@ IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface;
/* Convert from a directx* declaration into a directx9 one, so we only have to deal with one type of declaration everywhere else */
while (D3DVSD_END() != *pToken) {
token = *pToken;
tokenlen = IWineD3DVertexDeclarationImpl_ParseToken8(pToken);
tokenlen = IWineD3DVertexDeclarationImpl_ParseToken8(pToken);
tokentype = ((token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT);
if (D3DVSD_TOKEN_STREAM == tokentype && 0 == (D3DVSD_STREAMTESSMASK & token)) {
......@@ -426,7 +426,7 @@ HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetParent(IWineD3DVertexDeclaration
HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDevice(IWineD3DVertexDeclaration *iface, IWineD3DDevice** ppDevice) {
IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface;
TRACE("(%p) : returning %p\n", This, This->wineD3DDevice);
*ppDevice = (IWineD3DDevice *) This->wineD3DDevice;
IWineD3DDevice_AddRef(*ppDevice);
......
......@@ -32,8 +32,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
#if 0 /* Musxt not be 1 in cvs version */
# define VSTRACE(A) TRACE A
# define TRACE_VSVECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w)
#else
# define VSTRACE(A)
#else
# define VSTRACE(A)
# define TRACE_VSVECTOR(name)
#endif
......@@ -68,7 +68,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
* http://developer.nvidia.com/view.asp?IO=vstovp
*
* NVIDIA: Memory Management with VAR
* http://developer.nvidia.com/view.asp?IO=var_memory_management
* http://developer.nvidia.com/view.asp?IO=var_memory_management
*/
typedef void (*shader_fct_t)();
......@@ -143,7 +143,7 @@ void vshader_lit(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0) {
}
void vshader_logp(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0) {
float tmp_f = fabsf(s0->w);
float tmp_f = fabsf(s0->w);
d->x = d->y = d->z = d->w = (0.0f != tmp_f) ? logf(tmp_f) / logf(2.0f) : -HUGE_VAL;
VSTRACE(("executing logp: s0=(%f, %f, %f, %f) => d=(%f, %f, %f, %f)\n",
s0->x, s0->y, s0->z, s0->w, d->x, d->y, d->z, d->w));
......@@ -249,7 +249,7 @@ void vshader_exp(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0) {
}
void vshader_log(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0) {
float tmp_f = fabsf(s0->w);
float tmp_f = fabsf(s0->w);
d->x = d->y = d->z = d->w = (0.0f != tmp_f) ? logf(tmp_f) / logf(2.0f) : -HUGE_VAL;
VSTRACE(("executing log: s0=(%f, %f, %f, %f) => d=(%f, %f, %f, %f)\n",
s0->x, s0->y, s0->z, s0->w, d->x, d->y, d->z, d->w));
......@@ -275,7 +275,7 @@ void vshader_m4x4(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0, /*D3DSHADERVECTOR* ma
* BuGGY CODE: here only if cast not work for copy/paste
D3DSHADERVECTOR* mat2 = mat1 + 1;
D3DSHADERVECTOR* mat3 = mat1 + 2;
D3DSHADERVECTOR* mat4 = mat1 + 3;
D3DSHADERVECTOR* mat4 = mat1 + 3;
d->x = mat1->x * s0->x + mat2->x * s0->y + mat3->x * s0->z + mat4->x * s0->w;
d->y = mat1->y * s0->x + mat2->y * s0->y + mat3->y * s0->z + mat4->y * s0->w;
d->z = mat1->z * s0->x + mat2->z * s0->y + mat3->z * s0->z + mat4->z * s0->w;
......@@ -336,10 +336,10 @@ void vshader_m3x2(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0, D3DMATRIX32 mat) {
* Version 2.0 specific
*/
void vshader_lrp(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0, D3DSHADERVECTOR* s1, D3DSHADERVECTOR* s2, D3DSHADERVECTOR* s3) {
d->x = s0->x * (s1->x - s2->x) + s2->x;
d->y = s0->y * (s1->y - s2->y) + s2->y;
d->z = s0->z * (s1->z - s2->z) + s2->z;
d->w = s0->w * (s1->w - s2->w) + s2->x;
d->x = s0->x * (s1->x - s2->x) + s2->x;
d->y = s0->y * (s1->y - s2->y) + s2->y;
d->z = s0->z * (s1->z - s2->z) + s2->z;
d->w = s0->w * (s1->w - s2->w) + s2->x;
}
/**
......@@ -399,7 +399,7 @@ inline static void vshader_program_dump_param(const DWORD param, int input) {
DWORD regtype = ((param & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT);
if ((param & D3DSP_SRCMOD_MASK) == D3DSPSM_NEG) TRACE("-");
switch (regtype << D3DSP_REGTYPE_SHIFT) {
case D3DSPR_TEMP:
TRACE("R[%lu]", reg);
......@@ -446,16 +446,16 @@ inline static void vshader_program_dump_param(const DWORD param, int input) {
* WWZZYYXX
*/
if ((D3DVS_NOSWIZZLE >> D3DVS_SWIZZLE_SHIFT) != swizzle) { /* ! D3DVS_NOSWIZZLE == 0xE4 << D3DVS_SWIZZLE_SHIFT */
if (swizzle_x == swizzle_y &&
swizzle_x == swizzle_z &&
swizzle_x == swizzle_w) {
TRACE(".%c", swizzle_reg_chars[swizzle_x]);
} else {
TRACE(".%c%c%c%c",
swizzle_reg_chars[swizzle_x],
swizzle_reg_chars[swizzle_y],
swizzle_reg_chars[swizzle_z],
swizzle_reg_chars[swizzle_w]);
if (swizzle_x == swizzle_y &&
swizzle_x == swizzle_z &&
swizzle_x == swizzle_w) {
TRACE(".%c", swizzle_reg_chars[swizzle_x]);
} else {
TRACE(".%c%c%c%c",
swizzle_reg_chars[swizzle_x],
swizzle_reg_chars[swizzle_y],
swizzle_reg_chars[swizzle_z],
swizzle_reg_chars[swizzle_w]);
}
}
}
......@@ -475,50 +475,50 @@ inline static BOOL vshader_is_comment_token(DWORD token) {
HRESULT WINAPI IDirect3DVertexShaderImpl_ParseProgram(IDirect3DVertexShaderImpl* vshader, CONST DWORD* pFunction) {
const DWORD* pToken = pFunction;
const SHADER_OPCODE* curOpcode = NULL;
DWORD len = 0;
DWORD len = 0;
DWORD i;
if (NULL != pToken) {
while (D3DVS_END() != *pToken) {
if (vshader_is_version_token(*pToken)) { /** version */
TRACE("vs.%lu.%lu\n", (*pToken >> 8) & 0x0F, (*pToken & 0x0F));
++pToken;
++len;
continue;
}
TRACE("vs.%lu.%lu\n", (*pToken >> 8) & 0x0F, (*pToken & 0x0F));
++pToken;
++len;
continue;
}
if (vshader_is_comment_token(*pToken)) { /** comment */
DWORD comment_len = (*pToken & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT;
++pToken;
/*TRACE("comment[%ld] ;%s\n", comment_len, (char*)pToken);*/
pToken += comment_len;
len += comment_len + 1;
continue;
DWORD comment_len = (*pToken & D3DSI_COMMENTSIZE_MASK) >> D3DSI_COMMENTSIZE_SHIFT;
++pToken;
/*TRACE("comment[%ld] ;%s\n", comment_len, (char*)pToken);*/
pToken += comment_len;
len += comment_len + 1;
continue;
}
curOpcode = vshader_program_get_opcode(*pToken);
++pToken;
++len;
if (NULL == curOpcode) {
/* unkown current opcode ... */
while (*pToken & 0x80000000) {
TRACE("unrecognized opcode: %08lx\n", *pToken);
++pToken;
++len;
}
} else {
TRACE("%s ", curOpcode->name);
if (curOpcode->num_params > 0) {
vshader_program_dump_param(*pToken, 0);
++pToken;
++len;
for (i = 1; i < curOpcode->num_params; ++i) {
TRACE(", ");
vshader_program_dump_param(*pToken, 1);
++pToken;
++len;
}
}
TRACE("\n");
}
if (NULL == curOpcode) {
/* unkown current opcode ... */
while (*pToken & 0x80000000) {
TRACE("unrecognized opcode: %08lx\n", *pToken);
++pToken;
++len;
}
} else {
TRACE("%s ", curOpcode->name);
if (curOpcode->num_params > 0) {
vshader_program_dump_param(*pToken, 0);
++pToken;
++len;
for (i = 1; i < curOpcode->num_params; ++i) {
TRACE(", ");
vshader_program_dump_param(*pToken, 1);
++pToken;
++len;
}
}
TRACE("\n");
}
}
vshader->functionLength = (len + 1) * sizeof(DWORD);
} else {
......@@ -536,9 +536,9 @@ HRESULT WINAPI IDirect3DVertexShaderImpl_ParseProgram(IDirect3DVertexShaderImpl*
}
BOOL IDirect3DVertexShaderImpl_ExecuteHAL(IDirect3DVertexShaderImpl* vshader, VSHADERINPUTDATA* input, VSHADEROUTPUTDATA* output) {
/**
* TODO: use the NV_vertex_program (or 1_1) extension
* and specifics vendors (ARB_vertex_program??) variants for it
/**
* TODO: use the NV_vertex_program (or 1_1) extension
* and specifics vendors (ARB_vertex_program??) variants for it
*/
return TRUE;
}
......@@ -590,7 +590,7 @@ HRESULT WINAPI IDirect3DVertexShaderImpl_ExecuteSW(IDirect3DVertexShaderImpl* vs
/* the first dword is the version tag */
/* TODO: parse it */
if (vshader_is_version_token(*pToken)) { /** version */
++pToken;
}
......@@ -607,149 +607,148 @@ HRESULT WINAPI IDirect3DVertexShaderImpl_ExecuteSW(IDirect3DVertexShaderImpl* vs
i = 0;
/* unkown current opcode ... */
while (*pToken & 0x80000000) {
if (i == 0) {
TRACE("unrecognized opcode: pos=%d token=%08lX\n", (pToken - 1) - vshader->function, *(pToken - 1));
}
TRACE("unrecognized opcode param: pos=%d token=%08lX what=", pToken - vshader->function, *pToken);
vshader_program_dump_param(*pToken, i);
TRACE("\n");
++i;
++pToken;
if (i == 0) {
TRACE("unrecognized opcode: pos=%d token=%08lX\n", (pToken - 1) - vshader->function, *(pToken - 1));
}
TRACE("unrecognized opcode param: pos=%d token=%08lX what=", pToken - vshader->function, *pToken);
vshader_program_dump_param(*pToken, i);
TRACE("\n");
++i;
++pToken;
}
/*return FALSE;*/
} else {
if (curOpcode->num_params > 0) {
/*TRACE(">> execting opcode: pos=%d opcode_name=%s token=%08lX\n", pToken - vshader->function, curOpcode->name, *pToken);*/
for (i = 0; i < curOpcode->num_params; ++i) {
DWORD reg = pToken[i] & 0x00001FFF;
DWORD regtype = ((pToken[i] & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT);
switch (regtype << D3DSP_REGTYPE_SHIFT) {
case D3DSPR_TEMP:
/*TRACE("p[%d]=R[%d]\n", i, reg);*/
p[i] = &R[reg];
break;
case D3DSPR_INPUT:
/*TRACE("p[%d]=V[%s]\n", i, VertexShaderDeclRegister[reg]);*/
p[i] = &input->V[reg];
break;
case D3DSPR_CONST:
if (pToken[i] & D3DVS_ADDRMODE_RELATIVE) {
p[i] = &vshader->data->C[(DWORD) A[0].x + reg];
} else {
p[i] = &vshader->data->C[reg];
}
break;
case D3DSPR_ADDR: /*case D3DSPR_TEXTURE:*/
if (0 != reg) {
ERR("cannot handle address registers != a0, forcing use of a0\n");
reg = 0;
}
/*TRACE("p[%d]=A[%d]\n", i, reg);*/
p[i] = &A[reg];
break;
case D3DSPR_RASTOUT:
switch (reg) {
case D3DSRO_POSITION:
p[i] = &output->oPos;
break;
case D3DSRO_FOG:
p[i] = &output->oFog;
break;
case D3DSRO_POINT_SIZE:
p[i] = &output->oPts;
break;
}
break;
case D3DSPR_ATTROUT:
/*TRACE("p[%d]=oD[%d]\n", i, reg);*/
p[i] = &output->oD[reg];
break;
case D3DSPR_TEXCRDOUT:
/*TRACE("p[%d]=oT[%d]\n", i, reg);*/
p[i] = &output->oT[reg];
break;
default:
break;
}
if (i > 0) { /* input reg */
DWORD swizzle = (pToken[i] & D3DVS_SWIZZLE_MASK) >> D3DVS_SWIZZLE_SHIFT;
UINT isNegative = ((pToken[i] & D3DSP_SRCMOD_MASK) == D3DSPSM_NEG);
if (!isNegative && (D3DVS_NOSWIZZLE >> D3DVS_SWIZZLE_SHIFT) == swizzle) {
/*TRACE("p[%d] not swizzled\n", i);*/
p_send[i] = p[i];
} else {
DWORD swizzle_x = swizzle & 0x03;
DWORD swizzle_y = (swizzle >> 2) & 0x03;
DWORD swizzle_z = (swizzle >> 4) & 0x03;
DWORD swizzle_w = (swizzle >> 6) & 0x03;
/*TRACE("p[%d] swizzled\n", i);*/
float* tt = (float*) p[i];
s[i].x = (isNegative) ? -tt[swizzle_x] : tt[swizzle_x];
s[i].y = (isNegative) ? -tt[swizzle_y] : tt[swizzle_y];
s[i].z = (isNegative) ? -tt[swizzle_z] : tt[swizzle_z];
s[i].w = (isNegative) ? -tt[swizzle_w] : tt[swizzle_w];
p_send[i] = &s[i];
}
} else { /* output reg */
if ((pToken[i] & D3DSP_WRITEMASK_ALL) == D3DSP_WRITEMASK_ALL) {
p_send[i] = p[i];
} else {
p_send[i] = &d; /* to be post-processed for modifiers management */
}
}
}
}
switch (curOpcode->num_params) {
case 0:
curOpcode->soft_fct();
break;
case 1:
curOpcode->soft_fct(p_send[0]);
break;
case 2:
curOpcode->soft_fct(p_send[0], p_send[1]);
break;
case 3:
curOpcode->soft_fct(p_send[0], p_send[1], p_send[2]);
break;
case 4:
curOpcode->soft_fct(p_send[0], p_send[1], p_send[2], p_send[3]);
break;
case 5:
curOpcode->soft_fct(p_send[0], p_send[1], p_send[2], p_send[3], p_send[4]);
break;
default:
ERR("%s too many params: %u\n", curOpcode->name, curOpcode->num_params);
}
/* check if output reg modifier post-process */
if (curOpcode->num_params > 0 && (pToken[0] & D3DSP_WRITEMASK_ALL) != D3DSP_WRITEMASK_ALL) {
if (pToken[0] & D3DSP_WRITEMASK_0) p[0]->x = d.x;
if (pToken[0] & D3DSP_WRITEMASK_1) p[0]->y = d.y;
if (pToken[0] & D3DSP_WRITEMASK_2) p[0]->z = d.z;
if (pToken[0] & D3DSP_WRITEMASK_3) p[0]->w = d.w;
}
} else {
if (curOpcode->num_params > 0) {
/*TRACE(">> execting opcode: pos=%d opcode_name=%s token=%08lX\n", pToken - vshader->function, curOpcode->name, *pToken);*/
for (i = 0; i < curOpcode->num_params; ++i) {
DWORD reg = pToken[i] & 0x00001FFF;
DWORD regtype = ((pToken[i] & D3DSP_REGTYPE_MASK) >> D3DSP_REGTYPE_SHIFT);
switch (regtype << D3DSP_REGTYPE_SHIFT) {
case D3DSPR_TEMP:
/*TRACE("p[%d]=R[%d]\n", i, reg);*/
p[i] = &R[reg];
break;
case D3DSPR_INPUT:
/*TRACE("p[%d]=V[%s]\n", i, VertexShaderDeclRegister[reg]);*/
p[i] = &input->V[reg];
break;
case D3DSPR_CONST:
if (pToken[i] & D3DVS_ADDRMODE_RELATIVE) {
p[i] = &vshader->data->C[(DWORD) A[0].x + reg];
} else {
p[i] = &vshader->data->C[reg];
}
break;
case D3DSPR_ADDR: /*case D3DSPR_TEXTURE:*/
if (0 != reg) {
ERR("cannot handle address registers != a0, forcing use of a0\n");
reg = 0;
}
/*TRACE("p[%d]=A[%d]\n", i, reg);*/
p[i] = &A[reg];
break;
case D3DSPR_RASTOUT:
switch (reg) {
case D3DSRO_POSITION:
p[i] = &output->oPos;
break;
case D3DSRO_FOG:
p[i] = &output->oFog;
break;
case D3DSRO_POINT_SIZE:
p[i] = &output->oPts;
break;
}
break;
case D3DSPR_ATTROUT:
/*TRACE("p[%d]=oD[%d]\n", i, reg);*/
p[i] = &output->oD[reg];
break;
case D3DSPR_TEXCRDOUT:
/*TRACE("p[%d]=oT[%d]\n", i, reg);*/
p[i] = &output->oT[reg];
break;
default:
break;
}
if (i > 0) { /* input reg */
DWORD swizzle = (pToken[i] & D3DVS_SWIZZLE_MASK) >> D3DVS_SWIZZLE_SHIFT;
UINT isNegative = ((pToken[i] & D3DSP_SRCMOD_MASK) == D3DSPSM_NEG);
if (!isNegative && (D3DVS_NOSWIZZLE >> D3DVS_SWIZZLE_SHIFT) == swizzle) {
/*TRACE("p[%d] not swizzled\n", i);*/
p_send[i] = p[i];
} else {
DWORD swizzle_x = swizzle & 0x03;
DWORD swizzle_y = (swizzle >> 2) & 0x03;
DWORD swizzle_z = (swizzle >> 4) & 0x03;
DWORD swizzle_w = (swizzle >> 6) & 0x03;
/*TRACE("p[%d] swizzled\n", i);*/
float* tt = (float*) p[i];
s[i].x = (isNegative) ? -tt[swizzle_x] : tt[swizzle_x];
s[i].y = (isNegative) ? -tt[swizzle_y] : tt[swizzle_y];
s[i].z = (isNegative) ? -tt[swizzle_z] : tt[swizzle_z];
s[i].w = (isNegative) ? -tt[swizzle_w] : tt[swizzle_w];
p_send[i] = &s[i];
}
} else { /* output reg */
if ((pToken[i] & D3DSP_WRITEMASK_ALL) == D3DSP_WRITEMASK_ALL) {
p_send[i] = p[i];
} else {
p_send[i] = &d; /* to be post-processed for modifiers management */
}
}
}
}
switch (curOpcode->num_params) {
case 0:
curOpcode->soft_fct();
break;
case 1:
curOpcode->soft_fct(p_send[0]);
break;
case 2:
curOpcode->soft_fct(p_send[0], p_send[1]);
break;
case 3:
curOpcode->soft_fct(p_send[0], p_send[1], p_send[2]);
break;
case 4:
curOpcode->soft_fct(p_send[0], p_send[1], p_send[2], p_send[3]);
break;
case 5:
curOpcode->soft_fct(p_send[0], p_send[1], p_send[2], p_send[3], p_send[4]);
break;
default:
ERR("%s too many params: %u\n", curOpcode->name, curOpcode->num_params);
}
/* check if output reg modifier post-process */
if (curOpcode->num_params > 0 && (pToken[0] & D3DSP_WRITEMASK_ALL) != D3DSP_WRITEMASK_ALL) {
if (pToken[0] & D3DSP_WRITEMASK_0) p[0]->x = d.x;
if (pToken[0] & D3DSP_WRITEMASK_1) p[0]->y = d.y;
if (pToken[0] & D3DSP_WRITEMASK_2) p[0]->z = d.z;
if (pToken[0] & D3DSP_WRITEMASK_3) p[0]->w = d.w;
}
#if 0
TRACE_VSVECTOR(output->oPos);
TRACE_VSVECTOR(output->oD[0]);
TRACE_VSVECTOR(output->oD[1]);
TRACE_VSVECTOR(output->oT[0]);
TRACE_VSVECTOR(output->oT[1]);
TRACE_VSVECTOR(R[0]);
TRACE_VSVECTOR(R[1]);
TRACE_VSVECTOR(R[2]);
TRACE_VSVECTOR(R[3]);
TRACE_VSVECTOR(R[4]);
TRACE_VSVECTOR(R[5]);
TRACE_VSVECTOR(output->oPos);
TRACE_VSVECTOR(output->oD[0]);
TRACE_VSVECTOR(output->oD[1]);
TRACE_VSVECTOR(output->oT[0]);
TRACE_VSVECTOR(output->oT[1]);
TRACE_VSVECTOR(R[0]);
TRACE_VSVECTOR(R[1]);
TRACE_VSVECTOR(R[2]);
TRACE_VSVECTOR(R[3]);
TRACE_VSVECTOR(R[4]);
TRACE_VSVECTOR(R[5]);
#endif
/* to next opcode token */
pToken += curOpcode->num_params;
/* to next opcode token */
pToken += curOpcode->num_params;
}
#if 0
TRACE("End of current instruction:\n");
......@@ -861,7 +860,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_QueryInterface(IWineD3DVertexShader *ifa
ULONG WINAPI IWineD3DVertexShaderImpl_AddRef(IWineD3DVertexShader *iface) {
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
TRACE("(%p) : AddRef increasing from %ld\n", This, This->ref);
TRACE("(%p) : AddRef increasing from %ld\n", This, This->ref);
return InterlockedIncrement(&This->ref);
}
......@@ -870,7 +869,7 @@ ULONG WINAPI IWineD3DVertexShaderImpl_Release(IWineD3DVertexShader *iface) {
ULONG ref;
TRACE("(%p) : Releasing from %ld\n", This, This->ref);
ref = InterlockedDecrement(&This->ref);
if (ref == 0) {
if (ref == 0) {
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
......@@ -882,18 +881,18 @@ ULONG WINAPI IWineD3DVertexShaderImpl_Release(IWineD3DVertexShader *iface) {
HRESULT WINAPI IWineD3DVertexShaderImpl_GetParent(IWineD3DVertexShader *iface, IUnknown** parent){
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
*parent= (IUnknown*) parent;
IUnknown_AddRef(*parent);
TRACE("(%p) : returning %p\n", This, *parent);
return D3D_OK;
}
HRESULT WINAPI IWineD3DVertexShaderImpl_GetDevice(IWineD3DVertexShader* iface, IWineD3DDevice **pDevice){
IWineD3DVertexShaderImpl *This = (IWineD3DVertexShaderImpl *)iface;
IWineD3DDevice_AddRef((IWineD3DDevice *)This->wineD3DDevice);
*pDevice = (IWineD3DDevice *)This->wineD3DDevice;
TRACE("(%p) returning %p\n", This, *pDevice);
TRACE("(%p) returning %p\n", This, *pDevice);
return D3D_OK;
}
......@@ -914,7 +913,7 @@ HRESULT WINAPI IWineD3DVertexShaderImpl_GetFunction(IWineD3DVertexShader* impl,
(*(DWORD **) pData) = NULL;
} else {
if(This->functionLength == 0){
}
TRACE("(%p) : GetFunction copying to %p\n", This, pData);
memcpy(pData, This->function, This->functionLength);
......@@ -933,5 +932,5 @@ const IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl =
/*** IWineD3DVertexShader methods ***/
IWineD3DVertexShaderImpl_GetParent,
IWineD3DVertexShaderImpl_GetDevice,
IWineD3DVertexShaderImpl_GetFunction
IWineD3DVertexShaderImpl_GetFunction
};
......@@ -3,7 +3,7 @@
*
* Copyright 2002-2005 Jason Edmeades
* Copyright 2002-2005 Raphael Junqueira
* Copyright 2005 Oliver Stieber
* Copyright 2005 Oliver Stieber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -61,7 +61,7 @@ ULONG WINAPI IWineD3DVolumeImpl_Release(IWineD3DVolume *iface) {
}
/* ****************************************************
IWineD3DSurface IWineD3DResource parts follow
IWineD3DVolume IWineD3DResource parts follow
**************************************************** */
HRESULT WINAPI IWineD3DVolumeImpl_GetParent(IWineD3DVolume *iface, IUnknown **pParent) {
return IWineD3DResourceImpl_GetParent((IWineD3DResource *)iface, pParent);
......@@ -113,7 +113,7 @@ HRESULT WINAPI IWineD3DVolumeImpl_GetContainer(IWineD3DVolume *iface, REFIID rii
HRESULT WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DVOLUME_DESC* pDesc) {
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
TRACE("(%p) : copying into %p\n", This, pDesc);
*(pDesc->Format) = This->resource.format;
*(pDesc->Type) = This->resource.resourceType;
*(pDesc->Usage) = This->resource.usage;
......@@ -127,7 +127,7 @@ HRESULT WINAPI IWineD3DVolumeImpl_GetDesc(IWineD3DVolume *iface, WINED3DVOLUME_D
HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, D3DLOCKED_BOX* pLockedVolume, CONST D3DBOX* pBox, DWORD Flags) {
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
FIXME("(%p) : pBox=%p stub\n", This, pBox);
FIXME("(%p) : pBox=%p stub\n", This, pBox);
/* fixme: should we really lock as such? */
TRACE("(%p) : box=%p, output pbox=%p, allMem=%p\n", This, pBox, pLockedVolume, This->resource.allocatedMemory);
......@@ -145,9 +145,9 @@ HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, D3DLOCKED_BOX*
This->lockedBox.Back = This->currentDesc.Depth;
} else {
TRACE("Lock Box (%p) = l %d, t %d, r %d, b %d, fr %d, ba %d\n", pBox, pBox->Left, pBox->Top, pBox->Right, pBox->Bottom, pBox->Front, pBox->Back);
pLockedVolume->pBits = This->resource.allocatedMemory +
pLockedVolume->pBits = This->resource.allocatedMemory +
(pLockedVolume->SlicePitch * pBox->Front) + /* FIXME: is front < back or vica versa? */
(pLockedVolume->RowPitch * pBox->Top) +
(pLockedVolume->RowPitch * pBox->Top) +
(pBox->Left * This->bytesPerPixel);
This->lockedBox.Left = pBox->Left;
This->lockedBox.Top = pBox->Top;
......@@ -156,7 +156,7 @@ HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, D3DLOCKED_BOX*
This->lockedBox.Bottom = pBox->Bottom;
This->lockedBox.Back = pBox->Back;
}
if (Flags & (D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_READONLY)) {
/* Don't dirtify */
} else {
......@@ -169,7 +169,7 @@ HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, D3DLOCKED_BOX*
/** Dirtify Container if needed */
if (NULL != This->container) {
IWineD3DVolumeTexture *cont = (IWineD3DVolumeTexture*) This->container;
IWineD3DVolumeTexture *cont = (IWineD3DVolumeTexture*) This->container;
D3DRESOURCETYPE containerType = IWineD3DBaseTexture_GetType((IWineD3DBaseTexture *) cont);
if (containerType == D3DRTYPE_VOLUMETEXTURE) {
......@@ -189,7 +189,7 @@ HRESULT WINAPI IWineD3DVolumeImpl_LockBox(IWineD3DVolume *iface, D3DLOCKED_BOX*
HRESULT WINAPI IWineD3DVolumeImpl_UnlockBox(IWineD3DVolume *iface) {
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
if (FALSE == This->locked) {
ERR("trying to lock unlocked volume@%p\n", This);
ERR("trying to lock unlocked volume@%p\n", This);
return D3DERR_INVALIDCALL;
}
TRACE("(%p) : unlocking volume\n", This);
......@@ -205,7 +205,7 @@ HRESULT WINAPI IWineD3DVolumeImpl_CleanDirtyBox(IWineD3DVolume *iface) {
This->dirty = FALSE;
This->lockedBox.Left = This->currentDesc.Width;
This->lockedBox.Top = This->currentDesc.Height;
This->lockedBox.Front = This->currentDesc.Depth;
This->lockedBox.Front = This->currentDesc.Depth;
This->lockedBox.Right = 0;
This->lockedBox.Bottom = 0;
This->lockedBox.Back = 0;
......@@ -235,7 +235,7 @@ HRESULT WINAPI IWineD3DVolumeImpl_AddDirtyBox(IWineD3DVolume *iface, CONST D3DBO
HRESULT WINAPI IWineD3DVolumeImpl_SetContainer(IWineD3DVolume *iface, IUnknown* container){
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
This->container = container;
return D3D_OK;
}
......@@ -267,7 +267,7 @@ HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, GLenum gl_l
This->resource.allocatedMemory);
checkGLcall("glTexImage3D");
return D3D_OK;
}
const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl =
......@@ -291,7 +291,7 @@ const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl =
IWineD3DVolumeImpl_GetDesc,
IWineD3DVolumeImpl_LockBox,
IWineD3DVolumeImpl_UnlockBox,
/* Internal interface */
/* Internal interface */
IWineD3DVolumeImpl_AddDirtyBox,
IWineD3DVolumeImpl_CleanDirtyBox,
IWineD3DVolumeImpl_LoadTexture,
......
......@@ -103,20 +103,20 @@ void WINAPI IWineD3DVolumeTextureImpl_PreLoad(IWineD3DVolumeTexture *iface) {
/* Overrider the IWineD3DResource Preload method */
UINT i;
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
TRACE("(%p) : About to load texture\n", This);
IWineD3DVolumeTexture_BindTexture(iface);
ENTER_GL();
/* If were dirty then reload the volumes */
if(This->baseTexture.dirty != FALSE) {
for (i = 0; i < This->baseTexture.levels; i++) {
IWineD3DVolume_LoadTexture(This->volumes[i], i);
}
/* No longer dirty */
This->baseTexture.dirty = FALSE;
This->baseTexture.dirty = FALSE;
}
LEAVE_GL();
......@@ -181,7 +181,7 @@ HRESULT WINAPI IWineD3DVolumeTextureImpl_UnBindTexture(IWineD3DVolumeTexture *if
UINT WINAPI IWineD3DVolumeTextureImpl_GetTextureDimensions(IWineD3DVolumeTexture *iface) {
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
TRACE("(%p) \n", This);
TRACE("(%p) \n", This);
return GL_TEXTURE_3D;
}
......@@ -244,7 +244,7 @@ HRESULT WINAPI IWineD3DVolumeTextureImpl_UnlockBox(IWineD3DVolumeTexture *iface,
HRESULT WINAPI IWineD3DVolumeTextureImpl_AddDirtyBox(IWineD3DVolumeTexture *iface, CONST D3DBOX* pDirtyBox) {
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
This->baseTexture.dirty = TRUE;
TRACE("(%p) : dirtyfication of volume Level (0)\n", This);
TRACE("(%p) : dirtyfication of volume Level (0)\n", This);
return IWineD3DVolume_AddDirtyBox((IWineD3DVolume *) This->volumes[0], pDirtyBox);
}
......
......@@ -3,7 +3,7 @@
*
* Copyright 2002-2003 The wine-d3d team
* Copyright 2002-2003 Raphael Junqueira
* Copyright 2004 Jason Edmeades
* Copyright 2004 Jason Edmeades
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -97,24 +97,24 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
if ( !RegQueryValueExA( hkey, "VertexShaderMode", 0, NULL, buffer, &size) )
{
if (!strcmp(buffer,"none"))
{
TRACE("Disable vertex shaders\n");
vs_mode = VS_NONE;
}
else if (!strcmp(buffer,"emulation"))
{
TRACE("Force SW vertex shaders\n");
vs_mode = VS_SW;
}
if (!strcmp(buffer,"none"))
{
TRACE("Disable vertex shaders\n");
vs_mode = VS_NONE;
}
else if (!strcmp(buffer,"emulation"))
{
TRACE("Force SW vertex shaders\n");
vs_mode = VS_SW;
}
}
if ( !RegQueryValueExA( hkey, "PixelShaderMode", 0, NULL, buffer, &size) )
{
if (!strcmp(buffer,"enabled"))
{
TRACE("Allow pixel shaders\n");
ps_mode = PS_HW;
}
if (!strcmp(buffer,"enabled"))
{
TRACE("Allow pixel shaders\n");
ps_mode = PS_HW;
}
}
}
if (vs_mode == VS_HW)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment