Avoid the use of glGet when we know the information locally.
This commit is contained in:
parent
84cd1925fe
commit
2eaf05bfd5
|
@ -322,6 +322,8 @@ struct IDirect3DDevice8Impl
|
|||
|
||||
UINT srcBlend;
|
||||
UINT dstBlend;
|
||||
UINT alphafunc;
|
||||
UINT stencilfunc;
|
||||
|
||||
/* State block related */
|
||||
BOOL isRecordingState;
|
||||
|
|
|
@ -1234,7 +1234,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_Present(LPDIRECT3DDEVICE8 iface, CONST REC
|
|||
ENTER_GL();
|
||||
|
||||
glXSwapBuffers(This->display, This->drawable);
|
||||
checkGLcall("glXSwapBuffers");
|
||||
/* Dont call checkGLcall, as glGetError is not applicable here */
|
||||
TRACE("glXSwapBuffers called, Starting new frame");
|
||||
|
||||
LEAVE_GL();
|
||||
|
||||
|
@ -2922,10 +2923,7 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
|
|||
case D3DRS_ALPHAFUNC :
|
||||
{
|
||||
int glParm = GL_LESS;
|
||||
float ref = 1.0;
|
||||
|
||||
glGetFloatv(GL_ALPHA_TEST_REF, &ref);
|
||||
checkGLcall("glGetFloatv(GL_ALPHA_TEST_REF, &ref);");
|
||||
float ref = ((float) This->StateBlock->renderstate[D3DRS_ALPHAREF]) / 255.0f;
|
||||
|
||||
switch ((D3DCMPFUNC) Value) {
|
||||
case D3DCMP_NEVER: glParm=GL_NEVER; break;
|
||||
|
@ -2941,18 +2939,16 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
|
|||
}
|
||||
TRACE("glAlphaFunc with Parm=%x, ref=%f\n", glParm, ref);
|
||||
glAlphaFunc(glParm, ref);
|
||||
This->alphafunc = glParm;
|
||||
checkGLcall("glAlphaFunc");
|
||||
}
|
||||
break;
|
||||
|
||||
case D3DRS_ALPHAREF :
|
||||
{
|
||||
int glParm = GL_LESS;
|
||||
int glParm = This->alphafunc;
|
||||
float ref = 1.0f;
|
||||
|
||||
glGetIntegerv(GL_ALPHA_TEST_FUNC, &glParm);
|
||||
checkGLcall("glGetFloatv(GL_ALPHA_TEST_FUNC, &glParm);");
|
||||
|
||||
ref = ((float) Value) / 255.0f;
|
||||
TRACE("glAlphaFunc with Parm=%x, ref=%f\n", glParm, ref);
|
||||
glAlphaFunc(glParm, ref);
|
||||
|
@ -3075,13 +3071,8 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
|
|||
case D3DRS_STENCILFUNC :
|
||||
{
|
||||
int glParm = GL_ALWAYS;
|
||||
int ref = 0;
|
||||
GLuint mask = 0xFFFFFFFF;
|
||||
|
||||
glGetIntegerv(GL_STENCIL_REF, &ref);
|
||||
checkGLcall("glGetFloatv(GL_STENCIL_REF, &ref);");
|
||||
glGetIntegerv(GL_STENCIL_VALUE_MASK, &mask);
|
||||
checkGLcall("glGetFloatv(GL_STENCIL_VALUE_MASK, &glParm);");
|
||||
int ref = This->StateBlock->renderstate[D3DRS_STENCILREF];
|
||||
GLuint mask = This->StateBlock->renderstate[D3DRS_STENCILMASK];
|
||||
|
||||
switch ((D3DCMPFUNC) Value) {
|
||||
case D3DCMP_NEVER: glParm=GL_NEVER; break;
|
||||
|
@ -3103,14 +3094,9 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
|
|||
|
||||
case D3DRS_STENCILREF :
|
||||
{
|
||||
int glParm = GL_ALWAYS;
|
||||
int glParm = This->stencilfunc;
|
||||
int ref = 0;
|
||||
GLuint mask = 0xFFFFFFFF;
|
||||
|
||||
glGetIntegerv(GL_STENCIL_FUNC, &glParm);
|
||||
checkGLcall("glGetFloatv(GL_STENCIL_FUNC, &glParm);");
|
||||
glGetIntegerv(GL_STENCIL_VALUE_MASK, &mask);
|
||||
checkGLcall("glGetFloatv(GL_STENCIL_VALUE_MASK, &glParm);");
|
||||
GLuint mask = This->StateBlock->renderstate[D3DRS_STENCILMASK];
|
||||
|
||||
ref = Value;
|
||||
TRACE("glStencilFunc with Parm=%x, ref=%d, mask=%x\n", glParm, ref, mask);
|
||||
|
@ -3121,15 +3107,10 @@ HRESULT WINAPI IDirect3DDevice8Impl_SetRenderState(LPDIRECT3DDEVICE8 iface, D3
|
|||
|
||||
case D3DRS_STENCILMASK :
|
||||
{
|
||||
int glParm = GL_ALWAYS;
|
||||
int ref = 0.0;
|
||||
int glParm = This->stencilfunc;
|
||||
int ref = This->StateBlock->renderstate[D3DRS_STENCILREF];
|
||||
GLuint mask = Value;
|
||||
|
||||
glGetIntegerv(GL_STENCIL_REF, &ref);
|
||||
checkGLcall("glGetFloatv(GL_STENCIL_REF, &ref);");
|
||||
glGetIntegerv(GL_STENCIL_FUNC, &glParm);
|
||||
checkGLcall("glGetFloatv(GL_STENCIL_FUNC, &glParm);");
|
||||
|
||||
TRACE("glStencilFunc with Parm=%x, ref=%d, mask=%x\n", glParm, ref, mask);
|
||||
glStencilFunc(glParm, ref, mask);
|
||||
checkGLcall("glStencilFunc");
|
||||
|
|
|
@ -106,9 +106,16 @@ HRESULT WINAPI IDirect3DDeviceImpl_InitStartupStateBlock(IDirect3DDevice8Impl* T
|
|||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP);
|
||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP);
|
||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILPASS, D3DSTENCILOP_KEEP);
|
||||
|
||||
/* Setting stencil func also uses values for stencil ref/mask, so manually set defaults
|
||||
* so only a single call performed (and ensure defaults initialized before making that call)
|
||||
*
|
||||
* IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILREF, 0);
|
||||
* IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILMASK, 0xFFFFFFFF);
|
||||
*/
|
||||
This->StateBlock->renderstate[D3DRS_STENCILREF] = 0;
|
||||
This->StateBlock->renderstate[D3DRS_STENCILMASK] = 0xFFFFFFFF;
|
||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILFUNC, D3DCMP_ALWAYS);
|
||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILREF, 0);
|
||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILMASK, 0xFFFFFFFF);
|
||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_STENCILWRITEMASK, 0xFFFFFFFF);
|
||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_TEXTUREFACTOR, 0xFFFFFFFF);
|
||||
IDirect3DDevice8Impl_SetRenderState(iface, D3DRS_WRAP0, 0);
|
||||
|
|
Loading…
Reference in New Issue