OpenGL/D3D: Remove StoreStateBlock API for good

It didn't do anything with OpenGL and was too slow with D3D9. Any D3D bugs
will have to be fixed some other way, probably by setting up the needed
state anew.
stable-5.2
Günther Brammer 2009-06-03 01:38:01 +02:00
parent 3789678196
commit 8da93e68dd
7 changed files with 2 additions and 41 deletions

View File

@ -144,10 +144,8 @@ class CStdD3D : public CStdDDraw
bool RestoreDeviceObjects(); // restore device dependent objects
bool InvalidateDeviceObjects(); // free device dependent objects
bool DeleteDeviceObjects(); // free device dependent objects
bool StoreStateBlock();
void SetTexture();
void ResetTexture();
bool RestoreStateBlock();
bool DeviceReady() { return !!lpDevice; }
BOOL CreateStateBlock(IDirect3DStateBlock9 **pBlock, bool fTransparent, bool fSolid, bool fBaseTex, bool fAdditive, bool fMod2); // capture state blocks for blitting

View File

@ -350,10 +350,8 @@ class CStdDDraw
void GetZoom(ZoomData *r) { r->Zoom=Zoom; r->X=ZoomX; r->Y=ZoomY; }
void ApplyZoom(float & X, float & Y);
void RemoveZoom(float & X, float & Y);
virtual bool StoreStateBlock() = 0;
virtual void SetTexture() = 0;
virtual void ResetTexture() = 0;
virtual bool RestoreStateBlock() = 0;
// device objects
virtual bool RestoreDeviceObjects() = 0; // restore device dependant objects

View File

@ -133,10 +133,8 @@ class CStdGL : public CStdDDraw
// device objects
bool RestoreDeviceObjects(); // restore device dependent objects
bool InvalidateDeviceObjects(); // free device dependent objects
bool StoreStateBlock();
void SetTexture();
void ResetTexture();
bool RestoreStateBlock();
#ifdef _WIN32
bool DeviceReady() { return !!MainCtx.hrc; }
#elif defined(USE_X11)

View File

@ -44,10 +44,8 @@ public:
virtual void PerformPix(SURFACE, float, float, DWORD) { }
virtual bool ApplyGammaRamp(D3DGAMMARAMP &, bool ) { return true; }
virtual bool SaveDefaultGammaRamp(CStdWindow *) { return true; }
virtual bool StoreStateBlock() { return true; }
virtual void SetTexture() { }
virtual void ResetTexture() { }
virtual bool RestoreStateBlock() { return true; }
virtual bool InitDeviceObjects() { return true; }
virtual bool RestoreDeviceObjects() { return true; }
virtual bool InvalidateDeviceObjects() { return true; }

View File

@ -1176,15 +1176,6 @@ BOOL CStdD3D::CreateStateBlock(IDirect3DStateBlock9 **pBlock, bool fTransparent,
return lpDevice->EndStateBlock(pBlock) == D3D_OK;
}
bool CStdD3D::StoreStateBlock()
{
// FIXME: saving the current state is an expensive operation in D3D9
return false;
SafeRelease(pSavedState);
if (lpDevice) lpDevice->CreateStateBlock(D3DSBT_ALL, &pSavedState);
return true;
}
void CStdD3D::SetTexture()
{
}
@ -1194,15 +1185,6 @@ void CStdD3D::ResetTexture()
if (Active) lpDevice->SetTexture(0, NULL);
}
bool CStdD3D::RestoreStateBlock()
{
// FIXME: saving the current state is an expensive operation in D3D9
return false;
assert(pSavedState);
if (lpDevice) pSavedState->Apply();
return true;
}
bool CStdD3D::ApplyGammaRamp(D3DGAMMARAMP &ramp, bool fForce)
{
if (!lpDevice || (!Active && !fForce)) return false;

View File

@ -949,8 +949,6 @@ BOOL CStdDDraw::Blit(SURFACE sfcSource, float fx, float fy, float fwdt, float fh
CBltData BltData;
// pass down pTransform
BltData.pTransform=pTransform;
// store current state
StoreStateBlock();
// blit with basesfc?
bool fBaseSfc=false;
if (sfcSource->pMainSfc) if (sfcSource->pMainSfc->ppTex) fBaseSfc=true;
@ -964,8 +962,9 @@ BOOL CStdDDraw::Blit(SURFACE sfcSource, float fx, float fy, float fwdt, float fh
// calc stretch regarding texture size and indent
float scaleX2 = scaleX * iTexSize;
float scaleY2 = scaleY * iTexSize;
// blit from all these textures
// Enable textures
SetTexture();
// blit from all these textures
for (int iY=iTexY; iY<iTexY2; ++iY)
{
for (int iX=iTexX; iX<iTexX2; ++iX)
@ -1040,8 +1039,6 @@ BOOL CStdDDraw::Blit(SURFACE sfcSource, float fx, float fy, float fwdt, float fh
}
// reset texture
ResetTexture();
// restore state
RestoreStateBlock();
// success
return TRUE;
}

View File

@ -883,11 +883,6 @@ bool CStdGL::InvalidateDeviceObjects()
return fSuccess;
}
bool CStdGL::StoreStateBlock()
{
return true;
}
void CStdGL::SetTexture()
{
glBlendFunc(GL_ONE_MINUS_SRC_ALPHA, (dwBlitMode & C4GFXBLIT_ADDITIVE) ? GL_ONE : GL_SRC_ALPHA);
@ -917,11 +912,6 @@ void CStdGL::ResetTexture()
glDisable(GL_TEXTURE_2D);
}
bool CStdGL::RestoreStateBlock()
{
return true;
}
bool CStdGL::CheckGLError(const char *szAtOp)
{
GLenum err = glGetError();