Add Clear, Present and EndScene support and fix a bug in the drawing
code.
This commit is contained in:
parent
130197b8c2
commit
c4de952eb5
|
@ -155,8 +155,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9 iface, D3DPRESENT_
|
|||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_Present(LPDIRECT3DDEVICE9 iface, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
TRACE("(%p) : stub!\n", This);
|
||||
return D3D_OK;
|
||||
return IWineD3DDevice_Present(This->WineD3DDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetBackBuffer(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) {
|
||||
|
@ -297,14 +296,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_BeginScene(LPDIRECT3DDEVICE9 iface) {
|
|||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_EndScene(LPDIRECT3DDEVICE9 iface) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
return D3D_OK;
|
||||
return IWineD3DDevice_EndScene(This->WineD3DDevice);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_Clear(LPDIRECT3DDEVICE9 iface, DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
return D3D_OK;
|
||||
return IWineD3DDevice_Clear(This->WineD3DDevice, Count, pRects, Flags, Color, Z, Stencil);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* lpMatrix) {
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(d3d_caps);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(d3d_fps);
|
||||
#define GLINFO_LOCATION ((IWineD3DImpl *)(This->wineD3D))->gl_info
|
||||
|
||||
/**********************************************************
|
||||
|
@ -175,7 +176,7 @@ void WINAPI IWineD3DDeviceImpl_SetupTextureStates(IWineD3DDevice *iface, DWORD S
|
|||
if (changeTexture) {
|
||||
/* Make appropriate texture active */
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GL_ACTIVETEXTURE(Stage);
|
||||
GLACTIVETEXTURE(Stage);
|
||||
} else if (Stage > 0) {
|
||||
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
||||
}
|
||||
|
@ -417,11 +418,9 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, D3DTRANS
|
|||
if (d3dts >= D3DTS_TEXTURE0 && d3dts <= D3DTS_TEXTURE7) { /* handle texture matrices */
|
||||
if (d3dts < GL_LIMITS(textures)) {
|
||||
int tex = d3dts - D3DTS_TEXTURE0;
|
||||
GL_ACTIVETEXTURE(tex);
|
||||
#if 0 /* TODO: */
|
||||
GLACTIVETEXTURE(tex);
|
||||
set_texture_matrix((float *)lpmatrix,
|
||||
This->updateStateBlock->textureState[tex][D3DTSS_TEXTURETRANSFORMFLAGS]);
|
||||
#endif
|
||||
}
|
||||
|
||||
} else if (d3dts == D3DTS_VIEW) { /* handle the VIEW matrice */
|
||||
|
@ -1536,7 +1535,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, D3DRENDE
|
|||
/* Note the D3DRS value applies to all textures, but GL has one
|
||||
per texture, so apply it now ready to be used! */
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GL_ACTIVETEXTURE(i);
|
||||
GLACTIVETEXTURE(i);
|
||||
} else if (i>0) {
|
||||
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
||||
}
|
||||
|
@ -2100,7 +2099,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DW
|
|||
/* Make appropriate texture active */
|
||||
VTRACE(("Activating appropriate texture state %ld\n", Stage));
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GL_ACTIVETEXTURE(Stage);
|
||||
GLACTIVETEXTURE(Stage);
|
||||
} else if (Stage > 0) {
|
||||
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
||||
}
|
||||
|
@ -2600,6 +2599,235 @@ HRESULT WINAPI IWineD3DDeviceImpl_BeginScene(IWineD3DDevice *iface) {
|
|||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DDeviceImpl_EndScene(IWineD3DDevice *iface) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
glFlush();
|
||||
checkGLcall("glFlush");
|
||||
|
||||
#if 0 /* TODO: render targer support */
|
||||
if ((This->frontBuffer != This->renderTarget) && (This->backBuffer != This->renderTarget)) {
|
||||
|
||||
IWineD3DBaseTexture *cont = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
hr = IDirect3DSurface8_GetContainer((LPDIRECT3DSURFACE8) This->renderTarget, &IID_IDirect3DBaseTexture8, (void**) &cont);
|
||||
if (SUCCEEDED(hr) && NULL != cont) {
|
||||
/** always dirtify for now. we must find a better way to see that surface have been modified */
|
||||
This->renderTarget->inPBuffer = TRUE;
|
||||
This->renderTarget->inTexture = FALSE;
|
||||
IDirect3DBaseTexture8Impl_SetDirty(cont, TRUE);
|
||||
IDirect3DBaseTexture8_PreLoad(cont);
|
||||
This->renderTarget->inPBuffer = FALSE;
|
||||
IDirect3DBaseTexture8Impl_Release(cont);
|
||||
cont = NULL;
|
||||
}
|
||||
}
|
||||
#endif /* TODO: render targer support */
|
||||
|
||||
LEAVE_GL();
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DDeviceImpl_Present(IWineD3DDevice *iface,
|
||||
CONST RECT* pSourceRect, CONST RECT* pDestRect,
|
||||
HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
TRACE("(%p) Presenting the frame\n", This);
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
if (pSourceRect || pDestRect) FIXME("Unhandled present options %p/%p\n", pSourceRect, pDestRect);
|
||||
|
||||
glXSwapBuffers(This->display, This->drawable);
|
||||
/* Don't call checkGLcall, as glGetError is not applicable here */
|
||||
|
||||
TRACE("glXSwapBuffers called, Starting new frame\n");
|
||||
|
||||
/* FPS support */
|
||||
if (TRACE_ON(d3d_fps))
|
||||
{
|
||||
static long prev_time, frames;
|
||||
|
||||
DWORD time = GetTickCount();
|
||||
frames++;
|
||||
/* every 1.5 seconds */
|
||||
if (time - prev_time > 1500) {
|
||||
TRACE_(d3d_fps)("@ approx %.2ffps\n", 1000.0*frames/(time - prev_time));
|
||||
prev_time = time;
|
||||
frames = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(FRAME_DEBUGGING)
|
||||
{
|
||||
if (GetFileAttributesA("C:\\D3DTRACE") != INVALID_FILE_ATTRIBUTES) {
|
||||
if (!isOn) {
|
||||
isOn = TRUE;
|
||||
FIXME("Enabling D3D Trace\n");
|
||||
__WINE_SET_DEBUGGING(__WINE_DBCL_TRACE, __wine_dbch_d3d, 1);
|
||||
#if defined(SHOW_FRAME_MAKEUP)
|
||||
FIXME("Singe Frame snapshots Starting\n");
|
||||
isDumpingFrames = TRUE;
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
#endif
|
||||
|
||||
#if defined(SINGLE_FRAME_DEBUGGING)
|
||||
} else {
|
||||
#if defined(SHOW_FRAME_MAKEUP)
|
||||
FIXME("Singe Frame snapshots Finishing\n");
|
||||
isDumpingFrames = FALSE;
|
||||
#endif
|
||||
FIXME("Singe Frame trace complete\n");
|
||||
DeleteFileA("C:\\D3DTRACE");
|
||||
__WINE_SET_DEBUGGING(__WINE_DBCL_TRACE, __wine_dbch_d3d, 0);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (isOn) {
|
||||
isOn = FALSE;
|
||||
#if defined(SHOW_FRAME_MAKEUP)
|
||||
FIXME("Singe Frame snapshots Finishing\n");
|
||||
isDumpingFrames = FALSE;
|
||||
#endif
|
||||
FIXME("Disabling D3D Trace\n");
|
||||
__WINE_SET_DEBUGGING(__WINE_DBCL_TRACE, __wine_dbch_d3d, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LEAVE_GL();
|
||||
/* 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) {
|
||||
IWineD3DDevice_Clear(iface, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0);
|
||||
}
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Count, CONST D3DRECT* pRects,
|
||||
DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
|
||||
/* TODO: From MSDN This method fails if you specify the D3DCLEAR_ZBUFFER or D3DCLEAR_STENCIL flags when the
|
||||
render target does not have an attached depth buffer. Similarly, if you specify the D3DCLEAR_STENCIL flag
|
||||
when the depth-buffer format does not contain stencil buffer information, this method fails. */
|
||||
GLbitfield glMask = 0;
|
||||
GLboolean old_ztest;
|
||||
GLfloat old_z_clear_value;
|
||||
GLint old_stencil_clear_value;
|
||||
GLfloat old_color_clear_value[4];
|
||||
unsigned int i;
|
||||
CONST D3DRECT* curRect;
|
||||
|
||||
TRACE("(%p) Count (%ld), pRects (%p), Flags (%lx), Z (%f), Stencil (%ld)\n", This,
|
||||
Count, pRects, Flags, Z, Stencil);
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
checkGLcall("glEnable GL_SCISSOR_TEST");
|
||||
|
||||
if (Count > 0 && pRects) {
|
||||
curRect = pRects;
|
||||
} else {
|
||||
curRect = NULL;
|
||||
}
|
||||
|
||||
/* Only set the values up once, as they are not changing */
|
||||
if (Flags & D3DCLEAR_STENCIL) {
|
||||
glGetIntegerv(GL_STENCIL_CLEAR_VALUE, &old_stencil_clear_value);
|
||||
glClearStencil(Stencil);
|
||||
checkGLcall("glClearStencil");
|
||||
glMask = glMask | GL_STENCIL_BUFFER_BIT;
|
||||
glStencilMask(0xFFFFFFFF);
|
||||
}
|
||||
|
||||
if (Flags & D3DCLEAR_ZBUFFER) {
|
||||
glGetBooleanv(GL_DEPTH_WRITEMASK, &old_ztest);
|
||||
glDepthMask(GL_TRUE);
|
||||
glGetFloatv(GL_DEPTH_CLEAR_VALUE, &old_z_clear_value);
|
||||
glClearDepth(Z);
|
||||
checkGLcall("glClearDepth");
|
||||
glMask = glMask | GL_DEPTH_BUFFER_BIT;
|
||||
}
|
||||
|
||||
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,
|
||||
((Color >> 8) & 0xFF) / 255.0f,
|
||||
((Color >> 0) & 0xFF) / 255.0f,
|
||||
((Color >> 24) & 0xFF) / 255.0f);
|
||||
checkGLcall("glClearColor");
|
||||
|
||||
/* Clear ALL colors! */
|
||||
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||
glMask = glMask | GL_COLOR_BUFFER_BIT;
|
||||
}
|
||||
|
||||
/* Now process each rect in turn */
|
||||
for (i = 0; i < Count || i == 0; i++) {
|
||||
|
||||
#if 0 /* TODO: renderTarget support */
|
||||
if (curRect) {
|
||||
/* 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, (This->renderTarget->myDesc.Height - curRect->y2),
|
||||
curRect->x2 - curRect->x1, curRect->y2 - curRect->y1);
|
||||
glScissor(curRect->x1, (This->renderTarget->myDesc.Height - curRect->y2),
|
||||
curRect->x2 - curRect->x1, curRect->y2 - curRect->y1);
|
||||
checkGLcall("glScissor");
|
||||
} else {
|
||||
glScissor(This->stateBlock->viewport.X,
|
||||
(This->renderTarget->myDesc.Height - (This->stateBlock->viewport.Y + This->stateBlock->viewport.Height)),
|
||||
This->stateBlock->viewport.Width,
|
||||
This->stateBlock->viewport.Height);
|
||||
checkGLcall("glScissor");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Clear the selected rectangle (or full screen) */
|
||||
glClear(glMask);
|
||||
checkGLcall("glClear");
|
||||
|
||||
/* Step to the next rectangle */
|
||||
if (curRect) curRect = curRect + sizeof(D3DRECT);
|
||||
}
|
||||
|
||||
/* Restore the old values (why..?) */
|
||||
if (Flags & D3DCLEAR_STENCIL) {
|
||||
glClearStencil(old_stencil_clear_value);
|
||||
glStencilMask(This->stateBlock->renderState[D3DRS_STENCILWRITEMASK]);
|
||||
}
|
||||
if (Flags & D3DCLEAR_ZBUFFER) {
|
||||
glDepthMask(old_ztest);
|
||||
glClearDepth(old_z_clear_value);
|
||||
}
|
||||
if (Flags & D3DCLEAR_TARGET) {
|
||||
glClearColor(old_color_clear_value[0],
|
||||
old_color_clear_value[1],
|
||||
old_color_clear_value[2],
|
||||
old_color_clear_value[3]);
|
||||
glColorMask(This->stateBlock->renderState[D3DRS_COLORWRITEENABLE] & D3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
|
||||
This->stateBlock->renderState[D3DRS_COLORWRITEENABLE] & D3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
|
||||
This->stateBlock->renderState[D3DRS_COLORWRITEENABLE] & D3DCOLORWRITEENABLE_BLUE ? GL_TRUE : GL_FALSE,
|
||||
This->stateBlock->renderState[D3DRS_COLORWRITEENABLE] & D3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE);
|
||||
}
|
||||
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
checkGLcall("glDisable");
|
||||
LEAVE_GL();
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
/*****
|
||||
* Drawing functions
|
||||
*****/
|
||||
|
@ -2778,6 +3006,9 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
|
|||
IWineD3DDeviceImpl_GetTextureStageState,
|
||||
|
||||
IWineD3DDeviceImpl_BeginScene,
|
||||
IWineD3DDeviceImpl_EndScene,
|
||||
IWineD3DDeviceImpl_Present,
|
||||
IWineD3DDeviceImpl_Clear,
|
||||
|
||||
IWineD3DDeviceImpl_DrawPrimitive,
|
||||
IWineD3DDeviceImpl_DrawIndexedPrimitive,
|
||||
|
|
|
@ -1577,7 +1577,7 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
|
|||
TRACE("(%p,%d) All defaults now set up, leaving CreateDevice with %p\n", This, Adapter, object);
|
||||
|
||||
/* Clear the screen */
|
||||
/* TODO: IDirect3DDevice8Impl_Clear((LPDIRECT3DDEVICE8) object, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0); */
|
||||
IWineD3DDevice_Clear((IWineD3DDevice *) object, 0, NULL, D3DCLEAR_STENCIL|D3DCLEAR_ZBUFFER|D3DCLEAR_TARGET, 0x00, 1.0, 0);
|
||||
|
||||
} /* End of FIXME: remove when dx8 merged in */
|
||||
|
||||
|
|
|
@ -372,7 +372,7 @@ void primitiveConvertToStridedData(IWineD3DDevice *iface, Direct3DVertexStridedD
|
|||
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->updateStateBlock->vertexShader == NULL)) {
|
||||
if (!This->stateBlock->streamIsUP && !(This->updateStateBlock->vertexShader == NULL)) {
|
||||
LoopThroughTo = MAX_STREAMS;
|
||||
} else {
|
||||
LoopThroughTo = 1;
|
||||
|
@ -521,10 +521,8 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
|
|||
BOOL isPtSize, float ptSize, /* pointSize */
|
||||
D3DVECTOR_4 *texcoords, int *numcoords) /* texture info */
|
||||
{
|
||||
#if 0 /* TODO: Texture support */
|
||||
unsigned int textureNo;
|
||||
float s, t, r, q;
|
||||
#endif
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
|
||||
/* Diffuse -------------------------------- */
|
||||
|
@ -557,7 +555,6 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
|
|||
}
|
||||
|
||||
/* Texture coords --------------------------- */
|
||||
#if 0 /* TODO: Texture support */
|
||||
for (textureNo = 0; textureNo < GL_LIMITS(textures); ++textureNo) {
|
||||
|
||||
if (!GL_SUPPORT(ARB_MULTITEXTURE) && textureNo > 0) {
|
||||
|
@ -568,7 +565,7 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
|
|||
/* Query tex coords */
|
||||
if (This->stateBlock->textures[textureNo] != NULL) {
|
||||
|
||||
int coordIdx = This->updateStateBlock->texture_state[textureNo][D3DTSS_TEXCOORDINDEX];
|
||||
int coordIdx = This->updateStateBlock->textureState[textureNo][D3DTSS_TEXCOORDINDEX];
|
||||
if (coordIdx > 7) {
|
||||
VTRACE(("tex: %d - Skip tex coords, as being system generated\n", textureNo));
|
||||
continue;
|
||||
|
@ -594,11 +591,7 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
|
|||
case D3DTTFF_COUNT1:
|
||||
VTRACE(("tex:%d, s=%f\n", textureNo, s));
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
#if defined(GL_VERSION_1_3)
|
||||
glMultiTexCoord1f(GL_TEXTURE0 + textureNo, s);
|
||||
#else
|
||||
glMultiTexCoord1fARB(GL_TEXTURE0_ARB + textureNo, s);
|
||||
#endif
|
||||
GLMULTITEXCOORD1F(textureNo, s);
|
||||
} else {
|
||||
glTexCoord1f(s);
|
||||
}
|
||||
|
@ -606,11 +599,7 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
|
|||
case D3DTTFF_COUNT2:
|
||||
VTRACE(("tex:%d, s=%f, t=%f\n", textureNo, s, t));
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
#if defined(GL_VERSION_1_3)
|
||||
glMultiTexCoord2f(GL_TEXTURE0 + textureNo, s, t);
|
||||
#else
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0_ARB + textureNo, s, t);
|
||||
#endif
|
||||
GLMULTITEXCOORD2F(textureNo, s, t);
|
||||
} else {
|
||||
glTexCoord2f(s, t);
|
||||
}
|
||||
|
@ -618,11 +607,7 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
|
|||
case D3DTTFF_COUNT3:
|
||||
VTRACE(("tex:%d, s=%f, t=%f, r=%f\n", textureNo, s, t, r));
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
#if defined(GL_VERSION_1_3)
|
||||
glMultiTexCoord3f(GL_TEXTURE0 + textureNo, s, t, r);
|
||||
#else
|
||||
glMultiTexCoord3fARB(GL_TEXTURE0_ARB + textureNo, s, t, r);
|
||||
#endif
|
||||
GLMULTITEXCOORD3F(textureNo, s, t, r);
|
||||
} else {
|
||||
glTexCoord3f(s, t, r);
|
||||
}
|
||||
|
@ -630,11 +615,7 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
|
|||
case D3DTTFF_COUNT4:
|
||||
VTRACE(("tex:%d, s=%f, t=%f, r=%f, q=%f\n", textureNo, s, t, r, q));
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
#if defined(GL_VERSION_1_3)
|
||||
glMultiTexCoord4f(GL_TEXTURE0 + textureNo, s, t, r, q);
|
||||
#else
|
||||
glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, s, t, r, q);
|
||||
#endif
|
||||
GLMULTITEXCOORD4F(textureNo, s, t, r, q);
|
||||
} else {
|
||||
glTexCoord4f(s, t, r, q);
|
||||
}
|
||||
|
@ -645,7 +626,6 @@ void draw_vertex(IWineD3DDevice *iface, /* interfac
|
|||
}
|
||||
}
|
||||
} /* End of textures */
|
||||
#endif
|
||||
|
||||
/* Position -------------------------------- */
|
||||
if (isXYZ) {
|
||||
|
|
|
@ -212,7 +212,7 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
|
|||
|
||||
/* Make appropriate texture active */
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GL_ACTIVETEXTURE(i);
|
||||
GLACTIVETEXTURE(i);
|
||||
} else if (i > 0) {
|
||||
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
||||
}
|
||||
|
|
|
@ -89,13 +89,29 @@ extern int num_lock;
|
|||
|
||||
/* Note: The following is purely to keep the source code as clear from #ifdefs as possible */
|
||||
#if defined(GL_VERSION_1_3)
|
||||
#define GL_ACTIVETEXTURE(textureNo) \
|
||||
#define GLACTIVETEXTURE(textureNo) \
|
||||
glActiveTexture(GL_TEXTURE0 + textureNo); \
|
||||
checkGLcall("glActiveTexture");
|
||||
#define GLMULTITEXCOORD1F(a,b) \
|
||||
glMultiTexCoord1f(GL_TEXTURE0 + a, b);
|
||||
#define GLMULTITEXCOORD2F(a,b,c) \
|
||||
glMultiTexCoord2f(GL_TEXTURE0 + a, b, c);
|
||||
#define GLMULTITEXCOORD3F(a,b,c,d) \
|
||||
glMultiTexCoord3f(GL_TEXTURE0 + a, b, c, d);
|
||||
#define GLMULTITEXCOORD4F(a,b,c,d,e) \
|
||||
glMultiTexCoord4f(GL_TEXTURE0 + a, b, c, d, e);
|
||||
#else
|
||||
#define GL_ACTIVETEXTURE(textureNo) \
|
||||
#define GLACTIVETEXTURE(textureNo) \
|
||||
glActiveTextureARB(GL_TEXTURE0_ARB + textureNo); \
|
||||
checkGLcall("glActiveTextureARB");
|
||||
#define GLMULTITEXCOORD1F(a,b) \
|
||||
glMultiTexCoord1fARB(GL_TEXTURE0 + a, b);
|
||||
#define GLMULTITEXCOORD2F(a,b,c) \
|
||||
glMultiTexCoord2fARB(GL_TEXTURE0 + a, b, c);
|
||||
#define GLMULTITEXCOORD3F(a,b,c,d) \
|
||||
glMultiTexCoord3fARB(GL_TEXTURE0 + a, b, c, d);
|
||||
#define GLMULTITEXCOORD4F(a,b,c,d,e) \
|
||||
glMultiTexCoord4fARB(GL_TEXTURE0 + a, b, c, d, e);
|
||||
#endif
|
||||
|
||||
/* DirectX Device Limits */
|
||||
|
@ -185,6 +201,36 @@ extern const float identity[16];
|
|||
} \
|
||||
}
|
||||
|
||||
/* TODO: Confirm each of these works when wined3d move completed */
|
||||
#if 0 /* NOTE: Must be 0 in cvs */
|
||||
/* To avoid having to get gigabytes of trace, the following can be compiled in, and at the start
|
||||
of each frame, a check is made for the existence of C:\D3DTRACE, and if if exists d3d trace
|
||||
is enabled, and if it doesn't exists it is disabled. */
|
||||
# define FRAME_DEBUGGING
|
||||
/* Adding in the SINGLE_FRAME_DEBUGGING gives a trace of just what makes up a single frame, before
|
||||
the file is deleted */
|
||||
# if 1 /* NOTE: Must be 1 in cvs, as this is mostly more useful than a trace from program start */
|
||||
# define SINGLE_FRAME_DEBUGGING
|
||||
# endif
|
||||
/* The following, when enabled, lets you see the makeup of the frame, by drawprimitive calls.
|
||||
It can only be enabled when FRAME_DEBUGGING is also enabled
|
||||
The contents of the back buffer are written into /tmp/backbuffer_* after each primitive
|
||||
array is drawn. */
|
||||
# if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
|
||||
# define SHOW_FRAME_MAKEUP 1
|
||||
# endif
|
||||
/* The following, when enabled, lets you see the makeup of the all the textures used during each
|
||||
of the drawprimitive calls. It can only be enabled when SHOW_FRAME_MAKEUP is also enabled.
|
||||
The contents of the textures assigned to each stage are written into
|
||||
/tmp/texture_*_<Stage>.ppm after each primitive array is drawn. */
|
||||
# if 0 /* NOTE: Must be 0 in cvs, as this give a lot of ppm files when compiled in */
|
||||
# define SHOW_TEXTURE_MAKEUP 0
|
||||
# endif
|
||||
extern BOOL isOn;
|
||||
extern BOOL isDumpingFrames;
|
||||
extern LONG primCounter;
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* Prototypes
|
||||
*/
|
||||
|
|
|
@ -187,6 +187,9 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
|
|||
STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE;
|
||||
STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD * pValue) PURE;
|
||||
STDMETHOD(BeginScene)(THIS) PURE;
|
||||
STDMETHOD(EndScene)(THIS) PURE;
|
||||
STDMETHOD(Present)(THIS_ CONST RECT * pSourceRect,CONST RECT * pDestRect,HWND hDestWindowOverride,CONST RGNDATA * pDirtyRegion) PURE;
|
||||
STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT * pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE;
|
||||
STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE;
|
||||
STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,INT baseVIdx, UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE;
|
||||
STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void * pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE;
|
||||
|
@ -234,6 +237,9 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
|
|||
#define IWineD3DDevice_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c)
|
||||
#define IWineD3DDevice_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c)
|
||||
#define IWineD3DDevice_BeginScene(p) (p)->lpVtbl->BeginScene(p)
|
||||
#define IWineD3DDevice_EndScene(p) (p)->lpVtbl->EndScene(p)
|
||||
#define IWineD3DDevice_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d)
|
||||
#define IWineD3DDevice_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f)
|
||||
#define IWineD3DDevice_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c)
|
||||
#define IWineD3DDevice_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f)
|
||||
#define IWineD3DDevice_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d)
|
||||
|
|
Loading…
Reference in New Issue