Implemented stateblocks in wined3d.
This commit is contained in:
parent
d30f1fd738
commit
abb11f30cd
|
@ -383,6 +383,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, D3DSTA
|
|||
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
IWineD3DStateBlockImpl *object;
|
||||
int i,j;
|
||||
|
||||
D3DCREATEOBJECTINSTANCE(object, StateBlock)
|
||||
object->blockType = Type;
|
||||
|
@ -397,8 +398,96 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, D3DSTA
|
|||
|
||||
/* Otherwise, might as well set the whole state block to the appropriate values */
|
||||
IWineD3DDevice_AddRef(iface);
|
||||
memcpy(object, This->stateBlock, sizeof(IWineD3DStateBlockImpl));
|
||||
FIXME("unfinished - needs to set up changed and set attributes\n");
|
||||
/* Otherwise, might as well set the whole state block to the appropriate values */
|
||||
if ( This->stateBlock != NULL){
|
||||
memcpy(object, This->stateBlock, sizeof(IWineD3DStateBlockImpl));
|
||||
} else {
|
||||
memset(object->streamFreq, 1, sizeof(object->streamFreq));
|
||||
}
|
||||
|
||||
/* Reset the ref and type after kluging it */
|
||||
object->wineD3DDevice = This;
|
||||
object->ref = 1;
|
||||
object->blockType = Type;
|
||||
|
||||
TRACE("Updating changed flags appropriate for type %d\n", Type);
|
||||
|
||||
if (Type == D3DSBT_ALL) {
|
||||
TRACE("ALL => Pretend everything has changed\n");
|
||||
memset(&object->changed, TRUE, sizeof(This->stateBlock->changed));
|
||||
} else if (Type == D3DSBT_PIXELSTATE) {
|
||||
|
||||
memset(&object->changed, FALSE, sizeof(This->stateBlock->changed));
|
||||
/* TODO: Pixel Shader Constants */
|
||||
object->changed.pixelShader = TRUE;
|
||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) {
|
||||
object->changed.renderState[SavedPixelStates_R[i]] = TRUE;
|
||||
}
|
||||
for (j = 0; j < GL_LIMITS(textures); i++) {
|
||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_T; i++) {
|
||||
object->changed.textureState[j][SavedPixelStates_T[i]] = TRUE;
|
||||
}
|
||||
}
|
||||
/* Setting sampler block changes states */
|
||||
for (j = 0 ; j < GL_LIMITS(samplers); j++){
|
||||
for (i =0; i < NUM_SAVEDPIXELSTATES_S;i++){
|
||||
|
||||
object->changed.samplerState[j][SavedPixelStates_S[i]] = TRUE;
|
||||
}
|
||||
}
|
||||
} else if (Type == D3DSBT_VERTEXSTATE) {
|
||||
|
||||
memset(&object->changed, FALSE, sizeof(This->stateBlock->changed));
|
||||
|
||||
/* TODO: Vertex Shader Constants */
|
||||
object->changed.vertexShader = TRUE;
|
||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) {
|
||||
object->changed.renderState[SavedVertexStates_R[i]] = TRUE;
|
||||
}
|
||||
for (j = 0; j < GL_LIMITS(textures); i++) {
|
||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_T; i++) {
|
||||
object->changed.textureState[j][SavedVertexStates_T[i]] = TRUE;
|
||||
}
|
||||
}
|
||||
/* Setting sampler block changes states */
|
||||
for (j = 0 ; j < GL_LIMITS(samplers); j++){
|
||||
for (i =0; i < NUM_SAVEDVERTEXSTATES_S;i++){
|
||||
object->changed.samplerState[j][SavedVertexStates_S[i]] = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Duplicate light chain */
|
||||
{
|
||||
PLIGHTINFOEL *src = NULL;
|
||||
PLIGHTINFOEL *dst = NULL;
|
||||
PLIGHTINFOEL *newEl = NULL;
|
||||
src = This->stateBlock->lights;
|
||||
object->lights = NULL;
|
||||
|
||||
|
||||
while (src) {
|
||||
newEl = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PLIGHTINFOEL));
|
||||
if (newEl == NULL) return D3DERR_OUTOFVIDEOMEMORY;
|
||||
memcpy(newEl, src, sizeof(PLIGHTINFOEL));
|
||||
newEl->prev = dst;
|
||||
newEl->changed = TRUE;
|
||||
newEl->enabledChanged = TRUE;
|
||||
if (dst == NULL) {
|
||||
object->lights = newEl;
|
||||
} else {
|
||||
dst->next = newEl;
|
||||
}
|
||||
dst = newEl;
|
||||
src = src->next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
FIXME("Unrecognized state block type %d\n", Type);
|
||||
}
|
||||
|
||||
TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, object);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
|
@ -1372,14 +1461,14 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface, UINT St
|
|||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
IWineD3DVertexBuffer *oldSrc;
|
||||
|
||||
oldSrc = This->stateBlock->stream_source[StreamNumber];
|
||||
oldSrc = This->stateBlock->streamSource[StreamNumber];
|
||||
TRACE("(%p) : StreamNo: %d, OldStream (%p), NewStream (%p), NewStride %d\n", This, StreamNumber, oldSrc, pStreamData, Stride);
|
||||
|
||||
This->updateStateBlock->changed.stream_source[StreamNumber] = TRUE;
|
||||
This->updateStateBlock->set.stream_source[StreamNumber] = TRUE;
|
||||
This->updateStateBlock->stream_stride[StreamNumber] = Stride;
|
||||
This->updateStateBlock->stream_source[StreamNumber] = pStreamData;
|
||||
This->updateStateBlock->stream_offset[StreamNumber] = OffsetInBytes;
|
||||
This->updateStateBlock->changed.streamSource[StreamNumber] = TRUE;
|
||||
This->updateStateBlock->set.streamSource[StreamNumber] = TRUE;
|
||||
This->updateStateBlock->streamStride[StreamNumber] = Stride;
|
||||
This->updateStateBlock->streamSource[StreamNumber] = pStreamData;
|
||||
This->updateStateBlock->streamOffset[StreamNumber] = OffsetInBytes;
|
||||
|
||||
/* Handle recording of state blocks */
|
||||
if (This->isRecordingState) {
|
||||
|
@ -1397,10 +1486,10 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface, UINT St
|
|||
HRESULT WINAPI IWineD3DDeviceImpl_GetStreamSource(IWineD3DDevice *iface, UINT StreamNumber,IWineD3DVertexBuffer** pStream, UINT *pOffset, UINT* pStride) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
|
||||
TRACE("(%p) : StreamNo: %d, Stream (%p), Stride %d\n", This, StreamNumber, This->stateBlock->stream_source[StreamNumber], This->stateBlock->stream_stride[StreamNumber]);
|
||||
*pStream = This->stateBlock->stream_source[StreamNumber];
|
||||
*pStride = This->stateBlock->stream_stride[StreamNumber];
|
||||
*pOffset = This->stateBlock->stream_offset[StreamNumber];
|
||||
TRACE("(%p) : StreamNo: %d, Stream (%p), Stride %d\n", This, StreamNumber, This->stateBlock->streamSource[StreamNumber], This->stateBlock->streamStride[StreamNumber]);
|
||||
*pStream = This->stateBlock->streamSource[StreamNumber];
|
||||
*pStride = This->stateBlock->streamStride[StreamNumber];
|
||||
*pOffset = This->stateBlock->streamOffset[StreamNumber];
|
||||
if (*pStream != NULL) IWineD3DVertexBuffer_AddRef(*pStream); /* We have created a new reference to the VB */
|
||||
return D3D_OK;
|
||||
}
|
||||
|
@ -4480,15 +4569,15 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawPrimitiveUP(IWineD3DDevice *iface, D3DPRIM
|
|||
debug_d3dprimitivetype(PrimitiveType),
|
||||
PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride);
|
||||
|
||||
if (This->stateBlock->stream_source[0] != NULL) IWineD3DVertexBuffer_Release(This->stateBlock->stream_source[0]);
|
||||
if (This->stateBlock->streamSource[0] != NULL) IWineD3DVertexBuffer_Release(This->stateBlock->streamSource[0]);
|
||||
|
||||
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
|
||||
This->stateBlock->stream_source[0] = (IWineD3DVertexBuffer *)pVertexStreamZeroData;
|
||||
This->stateBlock->stream_stride[0] = VertexStreamZeroStride;
|
||||
This->stateBlock->streamSource[0] = (IWineD3DVertexBuffer *)pVertexStreamZeroData;
|
||||
This->stateBlock->streamStride[0] = VertexStreamZeroStride;
|
||||
This->stateBlock->streamIsUP = TRUE;
|
||||
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0, 0, 0, NULL, 0);
|
||||
This->stateBlock->stream_stride[0] = 0;
|
||||
This->stateBlock->stream_source[0] = NULL;
|
||||
This->stateBlock->streamStride[0] = 0;
|
||||
This->stateBlock->streamSource[0] = NULL;
|
||||
|
||||
/*stream zero settings set to null at end, as per the msdn */
|
||||
return D3D_OK;
|
||||
|
@ -4507,7 +4596,7 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface,
|
|||
MinVertexIndex, NumVertexIndices, PrimitiveCount, pIndexData,
|
||||
IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride);
|
||||
|
||||
if (This->stateBlock->stream_source[0] != NULL) IWineD3DVertexBuffer_Release(This->stateBlock->stream_source[0]);
|
||||
if (This->stateBlock->streamSource[0] != NULL) IWineD3DVertexBuffer_Release(This->stateBlock->streamSource[0]);
|
||||
|
||||
if (IndexDataFormat == WINED3DFMT_INDEX16) {
|
||||
idxStride = 2;
|
||||
|
@ -4516,15 +4605,15 @@ HRESULT WINAPI IWineD3DDeviceImpl_DrawIndexedPrimitiveUP(IWineD3DDevice *iface,
|
|||
}
|
||||
|
||||
/* Note in the following, it's not this type, but that's the purpose of streamIsUP */
|
||||
This->stateBlock->stream_source[0] = (IWineD3DVertexBuffer *)pVertexStreamZeroData;
|
||||
This->stateBlock->streamSource[0] = (IWineD3DVertexBuffer *)pVertexStreamZeroData;
|
||||
This->stateBlock->streamIsUP = TRUE;
|
||||
This->stateBlock->stream_stride[0] = VertexStreamZeroStride;
|
||||
This->stateBlock->streamStride[0] = VertexStreamZeroStride;
|
||||
|
||||
drawPrimitive(iface, PrimitiveType, PrimitiveCount, 0, 0, idxStride, pIndexData, MinVertexIndex);
|
||||
|
||||
/* stream zero settings set to null at end as per the msdn */
|
||||
This->stateBlock->stream_source[0] = NULL;
|
||||
This->stateBlock->stream_stride[0] = 0;
|
||||
This->stateBlock->streamSource[0] = NULL;
|
||||
This->stateBlock->streamStride[0] = 0;
|
||||
IWineD3DDevice_SetIndices(iface, NULL, 0);
|
||||
|
||||
return D3D_OK;
|
||||
|
@ -4987,3 +5076,121 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
|
|||
/*** Internal use IWineD3DDevice methods ***/
|
||||
IWineD3DDeviceImpl_SetupTextureStates
|
||||
};
|
||||
|
||||
|
||||
const DWORD SavedPixelStates_R[NUM_SAVEDPIXELSTATES_R] = {
|
||||
WINED3DRS_ALPHABLENDENABLE ,
|
||||
WINED3DRS_ALPHAFUNC ,
|
||||
WINED3DRS_ALPHAREF ,
|
||||
WINED3DRS_ALPHATESTENABLE ,
|
||||
WINED3DRS_BLENDOP ,
|
||||
WINED3DRS_COLORWRITEENABLE ,
|
||||
WINED3DRS_DESTBLEND ,
|
||||
WINED3DRS_DITHERENABLE ,
|
||||
WINED3DRS_FILLMODE ,
|
||||
WINED3DRS_FOGDENSITY ,
|
||||
WINED3DRS_FOGEND ,
|
||||
WINED3DRS_FOGSTART ,
|
||||
WINED3DRS_LASTPIXEL ,
|
||||
WINED3DRS_SHADEMODE ,
|
||||
WINED3DRS_SRCBLEND ,
|
||||
WINED3DRS_STENCILENABLE ,
|
||||
WINED3DRS_STENCILFAIL ,
|
||||
WINED3DRS_STENCILFUNC ,
|
||||
WINED3DRS_STENCILMASK ,
|
||||
WINED3DRS_STENCILPASS ,
|
||||
WINED3DRS_STENCILREF ,
|
||||
WINED3DRS_STENCILWRITEMASK ,
|
||||
WINED3DRS_STENCILZFAIL ,
|
||||
WINED3DRS_TEXTUREFACTOR ,
|
||||
WINED3DRS_WRAP0 ,
|
||||
WINED3DRS_WRAP1 ,
|
||||
WINED3DRS_WRAP2 ,
|
||||
WINED3DRS_WRAP3 ,
|
||||
WINED3DRS_WRAP4 ,
|
||||
WINED3DRS_WRAP5 ,
|
||||
WINED3DRS_WRAP6 ,
|
||||
WINED3DRS_WRAP7 ,
|
||||
WINED3DRS_ZENABLE ,
|
||||
WINED3DRS_ZFUNC ,
|
||||
WINED3DRS_ZWRITEENABLE
|
||||
};
|
||||
|
||||
const DWORD SavedPixelStates_T[NUM_SAVEDPIXELSTATES_T] = {
|
||||
WINED3DTSS_ADDRESSW ,
|
||||
WINED3DTSS_ALPHAARG0 ,
|
||||
WINED3DTSS_ALPHAARG1 ,
|
||||
WINED3DTSS_ALPHAARG2 ,
|
||||
WINED3DTSS_ALPHAOP ,
|
||||
WINED3DTSS_BUMPENVLOFFSET ,
|
||||
WINED3DTSS_BUMPENVLSCALE ,
|
||||
WINED3DTSS_BUMPENVMAT00 ,
|
||||
WINED3DTSS_BUMPENVMAT01 ,
|
||||
WINED3DTSS_BUMPENVMAT10 ,
|
||||
WINED3DTSS_BUMPENVMAT11 ,
|
||||
WINED3DTSS_COLORARG0 ,
|
||||
WINED3DTSS_COLORARG1 ,
|
||||
WINED3DTSS_COLORARG2 ,
|
||||
WINED3DTSS_COLOROP ,
|
||||
WINED3DTSS_RESULTARG ,
|
||||
WINED3DTSS_TEXCOORDINDEX ,
|
||||
WINED3DTSS_TEXTURETRANSFORMFLAGS
|
||||
};
|
||||
|
||||
const DWORD SavedPixelStates_S[NUM_SAVEDPIXELSTATES_S] = {
|
||||
WINED3DSAMP_ADDRESSU ,
|
||||
WINED3DSAMP_ADDRESSV ,
|
||||
WINED3DSAMP_ADDRESSW ,
|
||||
WINED3DSAMP_BORDERCOLOR ,
|
||||
WINED3DSAMP_MAGFILTER ,
|
||||
WINED3DSAMP_MINFILTER ,
|
||||
WINED3DSAMP_MIPFILTER ,
|
||||
WINED3DSAMP_MIPMAPLODBIAS ,
|
||||
WINED3DSAMP_MAXMIPLEVEL ,
|
||||
WINED3DSAMP_MAXANISOTROPY ,
|
||||
WINED3DSAMP_SRGBTEXTURE ,
|
||||
WINED3DSAMP_ELEMENTINDEX
|
||||
};
|
||||
|
||||
const DWORD SavedVertexStates_R[NUM_SAVEDVERTEXSTATES_R] = {
|
||||
WINED3DRS_AMBIENT ,
|
||||
WINED3DRS_AMBIENTMATERIALSOURCE ,
|
||||
WINED3DRS_CLIPPING ,
|
||||
WINED3DRS_CLIPPLANEENABLE ,
|
||||
WINED3DRS_COLORVERTEX ,
|
||||
WINED3DRS_DIFFUSEMATERIALSOURCE ,
|
||||
WINED3DRS_EMISSIVEMATERIALSOURCE ,
|
||||
WINED3DRS_FOGDENSITY ,
|
||||
WINED3DRS_FOGEND ,
|
||||
WINED3DRS_FOGSTART ,
|
||||
WINED3DRS_FOGTABLEMODE ,
|
||||
WINED3DRS_FOGVERTEXMODE ,
|
||||
WINED3DRS_INDEXEDVERTEXBLENDENABLE ,
|
||||
WINED3DRS_LIGHTING ,
|
||||
WINED3DRS_LOCALVIEWER ,
|
||||
WINED3DRS_MULTISAMPLEANTIALIAS ,
|
||||
WINED3DRS_MULTISAMPLEMASK ,
|
||||
WINED3DRS_NORMALIZENORMALS ,
|
||||
WINED3DRS_PATCHEDGESTYLE ,
|
||||
WINED3DRS_POINTSCALE_A ,
|
||||
WINED3DRS_POINTSCALE_B ,
|
||||
WINED3DRS_POINTSCALE_C ,
|
||||
WINED3DRS_POINTSCALEENABLE ,
|
||||
WINED3DRS_POINTSIZE ,
|
||||
WINED3DRS_POINTSIZE_MAX ,
|
||||
WINED3DRS_POINTSIZE_MIN ,
|
||||
WINED3DRS_POINTSPRITEENABLE ,
|
||||
WINED3DRS_RANGEFOGENABLE ,
|
||||
WINED3DRS_SPECULARMATERIALSOURCE ,
|
||||
WINED3DRS_TWEENFACTOR ,
|
||||
WINED3DRS_VERTEXBLEND
|
||||
};
|
||||
|
||||
const DWORD SavedVertexStates_T[NUM_SAVEDVERTEXSTATES_T] = {
|
||||
WINED3DTSS_TEXCOORDINDEX ,
|
||||
WINED3DTSS_TEXTURETRANSFORMFLAGS
|
||||
};
|
||||
|
||||
const DWORD SavedVertexStates_S[NUM_SAVEDVERTEXSTATES_S] = {
|
||||
WINED3DSAMP_DMAPOFFSET
|
||||
};
|
||||
|
|
|
@ -371,26 +371,26 @@ void primitiveConvertToStridedData(IWineD3DDevice *iface, Direct3DVertexStridedD
|
|||
|
||||
/* Work through stream by stream */
|
||||
for (nStream=0; nStream<LoopThroughTo; nStream++) {
|
||||
DWORD stride = This->stateBlock->stream_stride[nStream];
|
||||
DWORD stride = This->stateBlock->streamStride[nStream];
|
||||
BYTE *data = NULL;
|
||||
DWORD thisFVF = 0;
|
||||
|
||||
/* Skip empty streams */
|
||||
if (This->stateBlock->stream_source[nStream] == NULL) continue;
|
||||
if (This->stateBlock->streamSource[nStream] == NULL) continue;
|
||||
|
||||
/* Retrieve appropriate FVF */
|
||||
if (LoopThroughTo == 1) { /* Use FVF, not vertex shader */
|
||||
thisFVF = This->updateStateBlock->fvf;
|
||||
/* Handle memory passed directly as well as vertex buffers */
|
||||
if (This->stateBlock->streamIsUP) {
|
||||
data = (BYTE *)This->stateBlock->stream_source[nStream];
|
||||
data = (BYTE *)This->stateBlock->streamSource[nStream];
|
||||
} else {
|
||||
data = ((IWineD3DVertexBufferImpl *)This->stateBlock->stream_source[nStream])->resource.allocatedMemory;
|
||||
data = ((IWineD3DVertexBufferImpl *)This->stateBlock->streamSource[nStream])->resource.allocatedMemory;
|
||||
}
|
||||
} else {
|
||||
#if 0 /* TODO: Vertex shader support */
|
||||
thisFVF = This->stateBlock->vertexShaderDecl->fvf[nStream];
|
||||
data = ((IDirect3DVertexBuffer8Impl *)This->stateBlock->stream_source[nStream])->allocatedMemory;
|
||||
data = ((IDirect3DVertexBuffer8Impl *)This->stateBlock->streamSource[nStream])->allocatedMemory;
|
||||
#endif
|
||||
}
|
||||
VTRACE(("FVF for stream %d is %lx\n", nStream, thisFVF));
|
||||
|
@ -706,9 +706,9 @@ void drawStridedFast(IWineD3DDevice *iface, Direct3DVertexStridedData *sd,
|
|||
}
|
||||
} else {
|
||||
if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
|
||||
FIXME("TODO\n");
|
||||
TRACE("TODO ARB_VERTEX_BLEND\n");
|
||||
} else if (GL_SUPPORT(EXT_VERTEX_WEIGHTING)) {
|
||||
FIXME("TODO\n");
|
||||
TRACE("TODO EXT_VERTEX_WEIGHTING\n");
|
||||
/*
|
||||
glDisableClientState(GL_VERTEX_WEIGHT_ARRAY_EXT);
|
||||
checkGLcall("glDisableClientState(GL_VERTEX_WEIGHT_ARRAY_EXT)");
|
||||
|
|
|
@ -57,7 +57,6 @@ ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
|
|||
TRACE("(%p) : Releasing from %ld\n", This, refCount + 1);
|
||||
|
||||
if (!refCount) {
|
||||
IWineD3DDevice_Release((IWineD3DDevice *)This->wineD3DDevice);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
return refCount;
|
||||
|
@ -73,9 +72,377 @@ HRESULT WINAPI IWineD3DStateBlockImpl_GetParent(IWineD3DStateBlock *iface, IUnkn
|
|||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DStateBlockImpl_GetDevice(IWineD3DStateBlock *iface, IWineD3DDevice** ppDevice){
|
||||
|
||||
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
|
||||
|
||||
*ppDevice = (IWineD3DDevice*)This->wineD3DDevice;
|
||||
IWineD3DDevice_AddRef(*ppDevice);
|
||||
return D3D_OK;
|
||||
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface){
|
||||
|
||||
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
|
||||
IWineD3DStateBlockImpl *targetStateBlock = This->wineD3DDevice->stateBlock;
|
||||
|
||||
TRACE("(%p) : Updating state block %p ------------------v \n", targetStateBlock, This);
|
||||
|
||||
/* If not recorded, then update can just recapture */
|
||||
if (/*TODO: 'magic' statetype, replace with BOOL This->blockType == D3DSBT_RECORDED */ 0) {
|
||||
IWineD3DStateBlockImpl* tmpBlock;
|
||||
PLIGHTINFOEL *tmp = This->lights;
|
||||
|
||||
IWineD3DDevice_CreateStateBlock((IWineD3DDevice *)This->wineD3DDevice, This->blockType, (IWineD3DStateBlock**) &tmpBlock, NULL/*parent*/);
|
||||
|
||||
/* Note just swap the light chains over so when deleting, the old one goes */
|
||||
memcpy(This, tmpBlock, sizeof(IWineD3DStateBlockImpl));
|
||||
tmpBlock->lights = tmp;
|
||||
|
||||
/* Delete the temporary one (which points to the old light chain though */
|
||||
IWineD3DStateBlock_Release((IWineD3DStateBlock *)tmpBlock);
|
||||
/*IDirect3DDevice_DeleteStateBlock(pDevice, tmpBlock);*/
|
||||
|
||||
} else {
|
||||
unsigned int i, j;
|
||||
|
||||
PLIGHTINFOEL *src;
|
||||
|
||||
/* Recorded => Only update 'changed' values */
|
||||
if (This->set.vertexShader && This->vertexShader != targetStateBlock->vertexShader) {
|
||||
This->vertexShader = targetStateBlock->vertexShader;
|
||||
TRACE("Updating vertex shader to %p\n", targetStateBlock->vertexShader);
|
||||
}
|
||||
|
||||
/* TODO: Vertex Shader Constants */
|
||||
|
||||
/* Lights... For a recorded state block, we just had a chain of actions to perform,
|
||||
so we need to walk that chain and update any actions which differ */
|
||||
src = This->lights;
|
||||
while (src != NULL) {
|
||||
PLIGHTINFOEL *realLight = NULL;
|
||||
|
||||
/* Locate the light in the live lights */
|
||||
realLight = targetStateBlock->lights;
|
||||
while (realLight != NULL && realLight->OriginalIndex != src->OriginalIndex) realLight = realLight->next;
|
||||
|
||||
if (realLight == NULL) {
|
||||
FIXME("A captured light no longer exists...?\n");
|
||||
} else {
|
||||
|
||||
/* If 'changed' then its a SetLight command. Rather than comparing to see
|
||||
if the OriginalParms have changed and then copy them (twice through
|
||||
memory) just do the copy */
|
||||
if (src->changed) {
|
||||
TRACE("Updating lights for light %ld\n", src->OriginalIndex);
|
||||
memcpy(&src->OriginalParms, &realLight->OriginalParms, sizeof(PLIGHTINFOEL));
|
||||
}
|
||||
|
||||
/* If 'enabledchanged' then its a LightEnable command */
|
||||
if (src->enabledChanged) {
|
||||
TRACE("Updating lightEnabled for light %ld\n", src->OriginalIndex);
|
||||
src->lightEnabled = realLight->lightEnabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
src = src->next;
|
||||
}
|
||||
|
||||
|
||||
#if 0 /*TODO: Pixel shaders*/
|
||||
if (This->set.pixelShader && This->pixelShader != pDeviceImpl->stateBlock->pixelShader) {
|
||||
TRACE("Updating pixel shader to %p\n", pDeviceImpl->stateBlock->pixelShader);
|
||||
This->pixelShader = targetStateBlock->pixelShader;
|
||||
}
|
||||
#endif
|
||||
/* TODO: Pixel Shader Constants */
|
||||
|
||||
/* Others + Render & Texture */
|
||||
for (i = 1; i <= HIGHEST_TRANSFORMSTATE; i++) {
|
||||
if (This->set.transform[i] && memcmp(&targetStateBlock->transforms[i],
|
||||
&This->transforms[i],
|
||||
sizeof(D3DMATRIX)) != 0) {
|
||||
TRACE("Updating transform %d\n", i);
|
||||
memcpy(&This->transforms[i], &targetStateBlock->transforms[i], sizeof(D3DMATRIX));
|
||||
}
|
||||
}
|
||||
|
||||
if (This->set.indices && ((This->pIndexData != targetStateBlock->pIndexData)
|
||||
|| (This->baseVertexIndex != targetStateBlock->baseVertexIndex))) {
|
||||
TRACE("Updating pindexData to %p, baseVertexIndex to %d\n",
|
||||
targetStateBlock->pIndexData, targetStateBlock->baseVertexIndex);
|
||||
This->pIndexData = targetStateBlock->pIndexData;
|
||||
This->baseVertexIndex = targetStateBlock->baseVertexIndex;
|
||||
}
|
||||
|
||||
if(This->set.vertexDecl && This->vertexDecl != targetStateBlock->vertexDecl){
|
||||
This->vertexDecl = targetStateBlock->vertexDecl;
|
||||
}
|
||||
|
||||
if(This->set.fvf && This->fvf != targetStateBlock->fvf){
|
||||
This->fvf = targetStateBlock->fvf;
|
||||
}
|
||||
|
||||
if (This->set.material && memcmp(&targetStateBlock->material,
|
||||
&This->material,
|
||||
sizeof(D3DMATERIAL9)) != 0) {
|
||||
TRACE("Updating material\n");
|
||||
memcpy(&This->material, &targetStateBlock->material, sizeof(D3DMATERIAL9));
|
||||
}
|
||||
|
||||
if (This->set.viewport && memcmp(&targetStateBlock->viewport,
|
||||
&This->viewport,
|
||||
sizeof(D3DVIEWPORT9)) != 0) {
|
||||
TRACE("Updating viewport\n");
|
||||
memcpy(&This->viewport, &targetStateBlock->viewport, sizeof(D3DVIEWPORT9));
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_STREAMS; i++) {
|
||||
if (This->set.streamSource[i] &&
|
||||
((This->streamStride[i] != targetStateBlock->streamStride[i]) ||
|
||||
(This->streamSource[i] != targetStateBlock->streamSource[i]))) {
|
||||
TRACE("Updating stream source %d to %p, stride to %d\n", i, targetStateBlock->streamSource[i],
|
||||
targetStateBlock->streamStride[i]);
|
||||
This->streamStride[i] = targetStateBlock->streamStride[i];
|
||||
This->streamSource[i] = targetStateBlock->streamSource[i];
|
||||
}
|
||||
|
||||
if (This->set.streamFreq[i] &&
|
||||
(This->streamFreq[i] != targetStateBlock->streamFreq[i]
|
||||
|| This->streamFlags[i] != targetStateBlock->streamFlags[i])){
|
||||
TRACE("Updating stream frequency %d to %d flags to %d\n", i , targetStateBlock->streamFreq[i] ,
|
||||
targetStateBlock->streamFlags[i]);
|
||||
This->streamFreq[i] = targetStateBlock->streamFreq[i];
|
||||
This->streamFlags[i] = targetStateBlock->streamFlags[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < GL_LIMITS(clipplanes); i++) {
|
||||
if (This->set.clipplane[i] && memcmp(&targetStateBlock->clipplane[i],
|
||||
&This->clipplane[i],
|
||||
sizeof(This->clipplane)) != 0) {
|
||||
|
||||
TRACE("Updating clipplane %d\n", i);
|
||||
memcpy(&This->clipplane[i], &targetStateBlock->clipplane[i],
|
||||
sizeof(This->clipplane));
|
||||
}
|
||||
}
|
||||
|
||||
/* Render */
|
||||
for (i = 1; i <= WINEHIGHEST_RENDER_STATE; i++) {
|
||||
|
||||
if (This->set.renderState[i] && (This->renderState[i] != targetStateBlock->renderState[i])) {
|
||||
TRACE("Updating renderState %d to %ld\n", i, targetStateBlock->renderState[i]);
|
||||
This->renderState[i] = targetStateBlock->renderState[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: textures are upto MAX_SAMPLERS for d3d9? */
|
||||
/* Texture */
|
||||
for (j = 0; j < GL_LIMITS(textures); j++) {
|
||||
for (i = 1; i <= HIGHEST_TEXTURE_STATE ; i++) {
|
||||
|
||||
if (This->set.textureState[j][i] && (This->textureState[j][i] !=
|
||||
targetStateBlock->textureState[j][i])) {
|
||||
TRACE("Updating texturestagestate %d,%d to %ld (was %ld)\n", j,i, targetStateBlock->textureState[j][i],
|
||||
This->textureState[j][i]);
|
||||
This->textureState[j][i] = targetStateBlock->textureState[j][i];
|
||||
This->renderState[i] = targetStateBlock->renderState[i];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ((This->set.textures[j] && (This->textures[j] != targetStateBlock->textures[j]))) {
|
||||
TRACE("Updating texture %d to %p (was %p)\n", j, targetStateBlock->textures[j], This->textures[j]);
|
||||
This->textures[j] = targetStateBlock->textures[j];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Samplers */
|
||||
for (j = 0 ; j < GL_LIMITS(samplers); j++){
|
||||
for (i = 1; i <= HIGHEST_SAMPLER_STATE ; i++){ /* States are 1 based */
|
||||
if (This->set.samplerState[j][i] && (This->samplerState[j][i] !=
|
||||
targetStateBlock->samplerState[j][i])) {
|
||||
TRACE("Updating sampler state %d,%d to %ld (was %ld)\n",
|
||||
j, i, targetStateBlock->samplerState[j][i],
|
||||
This->samplerState[j][i]);
|
||||
This->samplerState[j][i] = targetStateBlock->samplerState[j][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("(%p) : Updated state block %p ------------------^\n", targetStateBlock, This);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface){
|
||||
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
|
||||
IWineD3DDevice* pDevice = (IWineD3DDevice*)This->wineD3DDevice;
|
||||
|
||||
/*Copy thing over to updateBlock is isRecording otherwise StateBlock,
|
||||
should really perform a delta so that only the changes get updated*/
|
||||
|
||||
|
||||
UINT i;
|
||||
UINT j;
|
||||
|
||||
TRACE("(%p) : Applying state block %p ------------------v\n", This, pDevice);
|
||||
|
||||
/* FIXME: Only apply applicable states not all states */
|
||||
|
||||
if (/*TODO: 'magic' statetype, replace with BOOL This->blockType == D3DSBT_RECORDED || */This->blockType == D3DSBT_ALL || This->blockType == D3DSBT_VERTEXSTATE) {
|
||||
|
||||
|
||||
PLIGHTINFOEL *toDo = This->lights;
|
||||
while (toDo != NULL) {
|
||||
if (toDo->changed)
|
||||
IWineD3DDevice_SetLight(pDevice, toDo->OriginalIndex, &toDo->OriginalParms);
|
||||
if (toDo->enabledChanged)
|
||||
IWineD3DDevice_SetLightEnable(pDevice, toDo->OriginalIndex, toDo->lightEnabled);
|
||||
toDo = toDo->next;
|
||||
}
|
||||
|
||||
#if 0 /*TODO: VertexShaders*/
|
||||
if (This->set.vertexShader && This->changed.vertexShader)
|
||||
IWineD3DDevice_SetVertexShader(pDevice, This->vertexShader);
|
||||
/* TODO: Vertex Shader Constants */
|
||||
#endif
|
||||
}
|
||||
|
||||
#if 0 /*TODO: Pixel Shaders*/
|
||||
if (/*TODO: 'magic' statetype, replace with BOOL This->blockType == D3DSBT_RECORDED || */ This->blockType == D3DSBT_ALL || This->blockType == D3DSBT_PIXELSTATE) {
|
||||
|
||||
if (This->set.pixelShader && This->changed.pixelShader)
|
||||
IWineD3DDevice_SetPixelShader(pDevice, This->pixelShader);
|
||||
|
||||
/* TODO: Pixel Shader Constants */
|
||||
}
|
||||
#endif
|
||||
|
||||
if (This->set.fvf && This->changed.fvf) {
|
||||
IWineD3DDevice_SetFVF(pDevice, This->fvf);
|
||||
}
|
||||
|
||||
if (This->set.vertexDecl && This->changed.vertexDecl) {
|
||||
IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl);
|
||||
}
|
||||
|
||||
/* Others + Render & Texture */
|
||||
if (/*TODO: 'magic' statetype, replace with BOOL This->blockType == D3DSBT_RECORDED || */ This->blockType == D3DSBT_ALL) {
|
||||
for (i = 1; i <= HIGHEST_TRANSFORMSTATE; i++) {
|
||||
if (This->set.transform[i] && This->changed.transform[i])
|
||||
IWineD3DDevice_SetTransform(pDevice, i, &This->transforms[i]);
|
||||
}
|
||||
|
||||
if (This->set.indices && This->changed.indices)
|
||||
IWineD3DDevice_SetIndices(pDevice, This->pIndexData, This->baseVertexIndex);
|
||||
|
||||
if (This->set.material && This->changed.material )
|
||||
IWineD3DDevice_SetMaterial(pDevice, &This->material);
|
||||
|
||||
if (This->set.viewport && This->changed.viewport)
|
||||
IWineD3DDevice_SetViewport(pDevice, &This->viewport);
|
||||
|
||||
/* TODO: Proper implementation using SetStreamSource offset (set to 0 for the moment)\n") */
|
||||
for (i=0; i<MAX_STREAMS; i++) {
|
||||
if (This->set.streamSource[i] && This->changed.streamSource[i])
|
||||
IWineD3DDevice_SetStreamSource(pDevice, i, This->streamSource[i], 0, This->streamStride[i]);
|
||||
|
||||
if (This->set.streamFreq[i] && This->changed.streamFreq[i])
|
||||
IWineD3DDevice_SetStreamSourceFreq(pDevice, i, This->streamFreq[i] | This->streamFlags[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < GL_LIMITS(clipplanes); i++) {
|
||||
if (This->set.clipplane[i] && This->changed.clipplane[i]) {
|
||||
float clip[4];
|
||||
|
||||
clip[0] = This->clipplane[i][0];
|
||||
clip[1] = This->clipplane[i][1];
|
||||
clip[2] = This->clipplane[i][2];
|
||||
clip[3] = This->clipplane[i][3];
|
||||
IWineD3DDevice_SetClipPlane(pDevice, i, clip);
|
||||
}
|
||||
}
|
||||
|
||||
/* Render */
|
||||
for (i = 1; i <= WINEHIGHEST_RENDER_STATE; i++) {
|
||||
if (This->set.renderState[i] && This->changed.renderState[i])
|
||||
IWineD3DDevice_SetRenderState(pDevice, i, This->renderState[i]);
|
||||
}
|
||||
|
||||
/* FIXME: Texture are set against samplers... not just TextureStages */
|
||||
/* Texture */
|
||||
for (j = 0; j < GL_LIMITS(textures); j++) { /* Set The texture first, just incase it resets the states? */
|
||||
if (This->set.textures[j] && This->changed.textures[j]) {
|
||||
IWineD3DDevice_SetTexture(pDevice, j, This->textures[j]);
|
||||
}
|
||||
for (i = 1; i <= HIGHEST_TEXTURE_STATE; i++) {
|
||||
if (This->set.textureState[j][i] && This->changed.textureState[j][i]) {
|
||||
IWineD3DDevice_SetTextureStageState(pDevice, j, i, This->textureState[j][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Samplers */
|
||||
for (j = 0 ; j < GL_LIMITS(samplers); j++){
|
||||
for (i = 1; i <= HIGHEST_SAMPLER_STATE; i++){
|
||||
if (This->set.samplerState[j][i] && This->changed.samplerState[j][i] && This->samplerState[j][i] != 0) {
|
||||
IWineD3DDevice_SetSamplerState(pDevice, j, i, This->samplerState[j][i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else if (This->blockType == D3DSBT_PIXELSTATE) {
|
||||
|
||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) {
|
||||
if (This->set.renderState[SavedPixelStates_R[i]] && This->changed.renderState[SavedPixelStates_R[i]])
|
||||
IWineD3DDevice_SetRenderState(pDevice, SavedPixelStates_R[i], This->renderState[SavedPixelStates_R[i]]);
|
||||
|
||||
}
|
||||
|
||||
for (j = 0; j < GL_LIMITS(textures); i++) {
|
||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_T; i++) {
|
||||
if (This->set.textureState[j][SavedPixelStates_T[i]] &&
|
||||
This->changed.textureState[j][SavedPixelStates_T[i]])
|
||||
IWineD3DDevice_SetTextureStageState(pDevice, j, SavedPixelStates_T[i], This->textureState[j][SavedPixelStates_T[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (This->blockType == D3DSBT_VERTEXSTATE) {
|
||||
|
||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) {
|
||||
if ( This->set.renderState[SavedVertexStates_R[i]] && This->changed.renderState[SavedVertexStates_R[i]])
|
||||
IWineD3DDevice_SetRenderState(pDevice, SavedVertexStates_R[i], This->renderState[SavedVertexStates_R[i]]);
|
||||
}
|
||||
|
||||
for (j = 0; j < GL_LIMITS(textures); i++) {
|
||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_T; i++) {
|
||||
if ( This->set.textureState[j][SavedVertexStates_T[i]] &&
|
||||
This->changed.textureState[j][SavedVertexStates_T[i]])
|
||||
IWineD3DDevice_SetTextureStageState(pDevice, j, SavedVertexStates_T[i], This->textureState[j][SavedVertexStates_T[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
FIXME("Unrecognized state block type %d\n", This->blockType);
|
||||
}
|
||||
memcpy(&((IWineD3DDeviceImpl*)pDevice)->stateBlock->changed, &This->changed, sizeof(((IWineD3DDeviceImpl*)pDevice)->stateBlock->changed));
|
||||
TRACE("(%p) : Applied state block %p ------------------^\n", This, pDevice);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock* iface) {
|
||||
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
|
||||
IWineD3DDeviceImpl *ThisDevice = (IWineD3DDeviceImpl *)(This->wineD3DDevice);
|
||||
IWineD3DDevice *device = (IWineD3DDevice *)This->wineD3DDevice;
|
||||
IWineD3DDeviceImpl *ThisDevice = (IWineD3DDeviceImpl *)device;
|
||||
union {
|
||||
D3DLINEPATTERN lp;
|
||||
DWORD d;
|
||||
|
@ -98,110 +465,149 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
|
|||
for (i = 0; i < 256; ++i) {
|
||||
memcpy(&This->transforms[D3DTS_WORLDMATRIX(i)], &identity, sizeof(identity));
|
||||
}
|
||||
|
||||
/* Render states: */
|
||||
if (ThisDevice->presentParms.EnableAutoDepthStencil) {
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_ZENABLE, D3DZB_TRUE);
|
||||
} else {
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_ZENABLE, D3DZB_FALSE);
|
||||
}
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_FILLMODE, D3DFILL_SOLID);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_SHADEMODE, D3DSHADE_GOURAUD);
|
||||
|
||||
lp.lp.wRepeatFactor = 0; lp.lp.wLinePattern = 0;
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_LINEPATTERN, lp.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_ZWRITEENABLE, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_ALPHATESTENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_LASTPIXEL, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_SRCBLEND, D3DBLEND_ONE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_DESTBLEND, D3DBLEND_ZERO);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_CULLMODE, D3DCULL_CCW);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_ZFUNC, D3DCMP_LESSEQUAL);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_ALPHAFUNC, D3DCMP_ALWAYS);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_ALPHAREF, 0xff); /*??*/
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_DITHERENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_ALPHABLENDENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_FOGENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_SPECULARENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_ZVISIBLE, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_FOGCOLOR, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_FOGTABLEMODE, D3DFOG_NONE);
|
||||
TRACE("Render states\n");
|
||||
/* Render states: */
|
||||
if (ThisDevice->depthStencilBuffer != NULL) {
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ZENABLE, D3DZB_TRUE);
|
||||
} else {
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ZENABLE, D3DZB_FALSE);
|
||||
}
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_FILLMODE, D3DFILL_SOLID);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_SHADEMODE, D3DSHADE_GOURAUD);
|
||||
lp.lp.wRepeatFactor = 0;
|
||||
lp.lp.wLinePattern = 0;
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_LINEPATTERN, lp.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ZWRITEENABLE, TRUE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ALPHATESTENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_LASTPIXEL, TRUE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_SRCBLEND, D3DBLEND_ONE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_DESTBLEND, D3DBLEND_ZERO);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_CULLMODE, D3DCULL_CCW);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ZFUNC, D3DCMP_LESSEQUAL);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ALPHAFUNC, D3DCMP_ALWAYS);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ALPHAREF, 0xff); /*??*/
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_DITHERENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ALPHABLENDENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_SPECULARENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ZVISIBLE, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGCOLOR, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGTABLEMODE, D3DFOG_NONE);
|
||||
tmpfloat.f = 0.0f;
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_FOGSTART, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGSTART, tmpfloat.d);
|
||||
tmpfloat.f = 1.0f;
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_FOGEND, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGEND, tmpfloat.d);
|
||||
tmpfloat.f = 1.0f;
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_FOGDENSITY, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_EDGEANTIALIAS, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_ZBIAS, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_RANGEFOGENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_STENCILENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_STENCILFAIL, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_STENCILPASS, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGDENSITY, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_EDGEANTIALIAS, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ZBIAS, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_RANGEFOGENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILFAIL, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_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)
|
||||
* so only a single call performed (and ensure defaults initialized before making that call)
|
||||
*
|
||||
* IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_STENCILREF, 0);
|
||||
* IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_STENCILMASK, 0xFFFFFFFF);
|
||||
* IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILREF, 0);
|
||||
* IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILMASK, 0xFFFFFFFF);
|
||||
*/
|
||||
This->renderState[WINED3DRS_STENCILREF] = 0;
|
||||
This->renderState[WINED3DRS_STENCILMASK] = 0xFFFFFFFF;
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_STENCILFUNC, D3DCMP_ALWAYS);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_STENCILWRITEMASK, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_TEXTUREFACTOR, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_WRAP0, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_WRAP1, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_WRAP2, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_WRAP3, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_WRAP4, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_WRAP5, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_WRAP6, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_WRAP7, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_CLIPPING, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_LIGHTING, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_AMBIENT, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_FOGVERTEXMODE, D3DFOG_NONE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_COLORVERTEX, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_LOCALVIEWER, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_NORMALIZENORMALS, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_COLOR1);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_SPECULARMATERIALSOURCE, D3DMCS_COLOR2);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_AMBIENTMATERIALSOURCE, D3DMCS_COLOR2);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_VERTEXBLEND, D3DVBF_DISABLE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_CLIPPLANEENABLE, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_SOFTWAREVERTEXPROCESSING, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILFUNC, D3DCMP_ALWAYS);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_STENCILWRITEMASK, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_TEXTUREFACTOR, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP0, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP1, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP2, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP3, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP4, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP5, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP6, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP7, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_CLIPPING, TRUE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_LIGHTING, TRUE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_AMBIENT, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGVERTEXMODE, D3DFOG_NONE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORVERTEX, TRUE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_LOCALVIEWER, TRUE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_NORMALIZENORMALS, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_COLOR1);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_SPECULARMATERIALSOURCE, D3DMCS_COLOR2);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_AMBIENTMATERIALSOURCE, D3DMCS_COLOR2);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_VERTEXBLEND, D3DVBF_DISABLE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_CLIPPLANEENABLE, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_SOFTWAREVERTEXPROCESSING, FALSE);
|
||||
tmpfloat.f = 1.0f;
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_POINTSIZE, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSIZE, tmpfloat.d);
|
||||
tmpfloat.f = 0.0f;
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_POINTSIZE_MIN, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_POINTSPRITEENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_POINTSCALEENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_POINTSCALE_A, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_POINTSCALE_B, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_POINTSCALE_C, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_MULTISAMPLEANTIALIAS, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_PATCHEDGESTYLE, D3DPATCHEDGE_DISCRETE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSIZE_MIN, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSPRITEENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSCALEENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSCALE_A, TRUE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSCALE_B, TRUE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSCALE_C, TRUE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_MULTISAMPLEANTIALIAS, TRUE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_PATCHEDGESTYLE, D3DPATCHEDGE_DISCRETE);
|
||||
tmpfloat.f = 1.0f;
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_PATCHSEGMENTS, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_DEBUGMONITORTOKEN, D3DDMT_DISABLE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_PATCHSEGMENTS, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_DEBUGMONITORTOKEN, D3DDMT_DISABLE);
|
||||
tmpfloat.f = 64.0f;
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_POINTSIZE_MAX, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_INDEXEDVERTEXBLENDENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_COLORWRITEENABLE, 0x0000000F);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSIZE_MAX, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_INDEXEDVERTEXBLENDENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORWRITEENABLE, 0x0000000F);
|
||||
tmpfloat.f = 0.0f;
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_TWEENFACTOR, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_BLENDOP, D3DBLENDOP_ADD);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_POSITIONORDER, WINED3DDEGREE_CUBIC);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, WINED3DRS_NORMALORDER, WINED3DDEGREE_LINEAR);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_TWEENFACTOR, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_BLENDOP, D3DBLENDOP_ADD);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_POSITIONDEGREE, WINED3DDEGREE_CUBIC);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_NORMALDEGREE, WINED3DDEGREE_LINEAR);
|
||||
/* states new in d3d9 */
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_SCISSORTESTENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_SLOPESCALEDEPTHBIAS, 0);
|
||||
tmpfloat.f = 1.0f;
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_MINTESSELLATIONLEVEL, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_MAXTESSELLATIONLEVEL, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ANTIALIASEDLINEENABLE, FALSE);
|
||||
tmpfloat.f = 0.0f;
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ADAPTIVETESS_X, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ADAPTIVETESS_Y, tmpfloat.d);
|
||||
tmpfloat.f = 1.0f;
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ADAPTIVETESS_Z, tmpfloat.d);
|
||||
tmpfloat.f = 0.0f;
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ADAPTIVETESS_W, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_ENABLEADAPTIVETESSELLATION, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_TWOSIDEDSTENCILMODE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_CCW_STENCILFAIL, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_CCW_STENCILZFAIL, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_CCW_STENCILPASS, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_CCW_STENCILFUNC, D3DCMP_ALWAYS);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORWRITEENABLE1, 0x0000000F);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORWRITEENABLE2, 0x0000000F);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORWRITEENABLE3, 0x0000000F);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_BLENDFACTOR, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_SRGBWRITEENABLE, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_DEPTHBIAS, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP8, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP9, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP10, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP11, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP12, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP13, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP14, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_WRAP15, 0);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_SEPARATEALPHABLENDENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_SRCBLENDALPHA, D3DBLEND_ONE);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_DESTBLENDALPHA, D3DBLEND_ZERO);
|
||||
IWineD3DDevice_SetRenderState(device, WINED3DRS_BLENDOPALPHA, D3DBLENDOP_ADD);
|
||||
|
||||
/** clipping status */
|
||||
/* clipping status */
|
||||
This->clip_status.ClipUnion = 0;
|
||||
This->clip_status.ClipIntersection = 0xFFFFFFFF;
|
||||
|
||||
|
||||
/* Texture Stage States - Put directly into state block, we will call function below */
|
||||
for (i = 0; i < GL_LIMITS(textures); i++) {
|
||||
TRACE("Setting up default texture states for texture Stage %d\n", i);
|
||||
|
@ -217,15 +623,6 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
|
|||
This->textureState[i][D3DTSS_BUMPENVMAT10 ] = (DWORD) 0.0;
|
||||
This->textureState[i][D3DTSS_BUMPENVMAT11 ] = (DWORD) 0.0;
|
||||
This->textureState[i][D3DTSS_TEXCOORDINDEX ] = i;
|
||||
This->textureState[i][D3DTSS_ADDRESSU ] = D3DTADDRESS_WRAP;
|
||||
This->textureState[i][D3DTSS_ADDRESSV ] = D3DTADDRESS_WRAP;
|
||||
This->textureState[i][D3DTSS_BORDERCOLOR ] = 0x00;
|
||||
This->textureState[i][D3DTSS_MAGFILTER ] = D3DTEXF_POINT;
|
||||
This->textureState[i][D3DTSS_MINFILTER ] = D3DTEXF_POINT;
|
||||
This->textureState[i][D3DTSS_MIPFILTER ] = D3DTEXF_NONE;
|
||||
This->textureState[i][D3DTSS_MIPMAPLODBIAS ] = 0;
|
||||
This->textureState[i][D3DTSS_MAXMIPLEVEL ] = 0;
|
||||
This->textureState[i][D3DTSS_MAXANISOTROPY ] = 1;
|
||||
This->textureState[i][D3DTSS_BUMPENVLSCALE ] = (DWORD) 0.0;
|
||||
This->textureState[i][D3DTSS_BUMPENVLOFFSET ] = (DWORD) 0.0;
|
||||
This->textureState[i][D3DTSS_TEXTURETRANSFORMFLAGS ] = D3DTTFF_DISABLE;
|
||||
|
@ -235,6 +632,24 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
|
|||
This->textureState[i][D3DTSS_RESULTARG ] = D3DTA_CURRENT;
|
||||
}
|
||||
|
||||
/* Sampler states*/
|
||||
for (i = 0 ; i < MAX_SAMPLERS; 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;
|
||||
This->samplerState[i][WINED3DSAMP_BORDERCOLOR ] = 0x00;
|
||||
This->samplerState[i][WINED3DSAMP_MAGFILTER ] = D3DTEXF_POINT;
|
||||
This->samplerState[i][WINED3DSAMP_MINFILTER ] = D3DTEXF_POINT;
|
||||
This->samplerState[i][WINED3DSAMP_MIPFILTER ] = D3DTEXF_NONE;
|
||||
This->samplerState[i][WINED3DSAMP_MIPMAPLODBIAS ] = 0;
|
||||
This->samplerState[i][WINED3DSAMP_MAXMIPLEVEL ] = 0;
|
||||
This->samplerState[i][WINED3DSAMP_MAXANISOTROPY ] = 1;
|
||||
This->samplerState[i][WINED3DSAMP_SRGBTEXTURE ] = 0; /* TODO: Gamma correction value*/
|
||||
This->samplerState[i][WINED3DSAMP_ELEMENTINDEX ] = 0; /* TODO: Indicates which element of a multielement texture to use */
|
||||
This->samplerState[i][WINED3DSAMP_DMAPOFFSET ] = 256; /* TODO: Vertex offset in the presampled displacement map */
|
||||
}
|
||||
|
||||
/* Under DirectX you can have texture stage operations even if no texture is
|
||||
bound, whereas opengl will only do texture operations when a valid texture is
|
||||
bound. We emulate this by creating dummy textures and binding them to each
|
||||
|
@ -247,9 +662,9 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
|
|||
GLubyte white = 255;
|
||||
|
||||
/* Note this avoids calling settexture, so pretend it has been called */
|
||||
This->set.textures[i] = TRUE;
|
||||
This->set.textures[i] = TRUE;
|
||||
This->changed.textures[i] = TRUE;
|
||||
This->textures[i] = NULL;
|
||||
This->textures[i] = NULL;
|
||||
|
||||
/* Make appropriate texture active */
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
|
@ -268,11 +683,11 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
|
|||
glBindTexture(GL_TEXTURE_1D, ThisDevice->dummyTextureName[i]);
|
||||
checkGLcall("glBindTexture");
|
||||
|
||||
glTexImage1D(GL_TEXTURE_1D, 0, GL_LUMINANCE, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &white);
|
||||
glTexImage1D(GL_TEXTURE_1D, 0, GL_LUMINANCE, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &white);
|
||||
checkGLcall("glTexImage1D");
|
||||
|
||||
/* Reapply all the texture state information to this texture */
|
||||
IWineD3DDevice_SetupTextureStates((IWineD3DDevice *)This->wineD3DDevice, i, REAPPLY_ALL);
|
||||
IWineD3DDevice_SetupTextureStates(device, i, REAPPLY_ALL);
|
||||
}
|
||||
|
||||
LEAVE_GL();
|
||||
|
@ -303,5 +718,8 @@ const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl =
|
|||
IWineD3DStateBlockImpl_AddRef,
|
||||
IWineD3DStateBlockImpl_Release,
|
||||
IWineD3DStateBlockImpl_GetParent,
|
||||
IWineD3DStateBlockImpl_GetDevice,
|
||||
IWineD3DStateBlockImpl_Capture,
|
||||
IWineD3DStateBlockImpl_Apply,
|
||||
IWineD3DStateBlockImpl_InitStartupStateBlock
|
||||
};
|
||||
|
|
|
@ -43,11 +43,33 @@
|
|||
#include "wine/wined3d_gl.h"
|
||||
|
||||
/* Device caps */
|
||||
#define MAX_PALETTES 256
|
||||
#define MAX_STREAMS 16
|
||||
#define MAX_TEXTURES 8
|
||||
#define MAX_SAMPLERS 16
|
||||
#define MAX_ACTIVE_LIGHTS 8
|
||||
#define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
|
||||
#define MAX_LEVELS 256
|
||||
|
||||
/* Swap chains */
|
||||
#define MAX_SWAPCHAINS 256
|
||||
|
||||
/* Used for CreateStateBlock */
|
||||
#define NUM_SAVEDPIXELSTATES_R 35
|
||||
#define NUM_SAVEDPIXELSTATES_T 18
|
||||
#define NUM_SAVEDPIXELSTATES_S 12
|
||||
#define NUM_SAVEDVERTEXSTATES_R 31
|
||||
#define NUM_SAVEDVERTEXSTATES_T 2
|
||||
#define NUM_SAVEDVERTEXSTATES_S 1
|
||||
|
||||
extern const DWORD SavedPixelStates_R[NUM_SAVEDPIXELSTATES_R];
|
||||
extern const DWORD SavedPixelStates_T[NUM_SAVEDPIXELSTATES_T];
|
||||
extern const DWORD SavedPixelStates_S[NUM_SAVEDPIXELSTATES_S];
|
||||
extern const DWORD SavedVertexStates_R[NUM_SAVEDVERTEXSTATES_R];
|
||||
extern const DWORD SavedVertexStates_T[NUM_SAVEDVERTEXSTATES_T];
|
||||
extern const DWORD SavedVertexStates_S[NUM_SAVEDVERTEXSTATES_S];
|
||||
|
||||
/* vertex and pixel shader modes */
|
||||
extern int vs_mode;
|
||||
#define VS_NONE 0
|
||||
#define VS_HW 1
|
||||
|
@ -284,7 +306,7 @@ typedef struct Direct3DVertexStridedData {
|
|||
Direct3DStridedData pSize;
|
||||
Direct3DStridedData diffuse;
|
||||
Direct3DStridedData specular;
|
||||
Direct3DStridedData texCoords[8];
|
||||
Direct3DStridedData texCoords[MAX_TEXTURES];
|
||||
} s;
|
||||
Direct3DStridedData input[16]; /* Indexed by constants in D3DVSDE_REGISTER */
|
||||
} u;
|
||||
|
@ -403,7 +425,7 @@ typedef struct IWineD3DDeviceImpl
|
|||
UINT yScreenSpace;
|
||||
|
||||
/* Textures for when no other textures are mapped */
|
||||
UINT dummyTextureName[8];
|
||||
UINT dummyTextureName[MAX_TEXTURES];
|
||||
|
||||
/* Debug stream management */
|
||||
BOOL debug;
|
||||
|
@ -654,17 +676,18 @@ typedef struct SAVEDSTATES {
|
|||
BOOL indices;
|
||||
BOOL material;
|
||||
BOOL fvf;
|
||||
BOOL stream_source[MAX_STREAMS];
|
||||
BOOL textures[8];
|
||||
BOOL transform[HIGHEST_TRANSFORMSTATE];
|
||||
BOOL streamSource[MAX_STREAMS];
|
||||
BOOL streamFreq[MAX_STREAMS];
|
||||
BOOL textures[MAX_TEXTURES];
|
||||
BOOL transform[HIGHEST_TRANSFORMSTATE + 1];
|
||||
BOOL viewport;
|
||||
BOOL renderState[WINEHIGHEST_RENDER_STATE];
|
||||
BOOL textureState[8][HIGHEST_TEXTURE_STATE];
|
||||
BOOL renderState[WINEHIGHEST_RENDER_STATE + 1];
|
||||
BOOL textureState[MAX_TEXTURES][HIGHEST_TEXTURE_STATE + 1];
|
||||
BOOL clipplane[MAX_CLIPPLANES];
|
||||
BOOL samplerState[MAX_SAMPLERS][HIGHEST_SAMPLER_STATE + 1];
|
||||
BOOL vertexDecl;
|
||||
BOOL pixelShader;
|
||||
BOOL vertexShader;
|
||||
BOOL vertexShader;
|
||||
} SAVEDSTATES;
|
||||
|
||||
struct IWineD3DStateBlockImpl
|
||||
|
@ -672,7 +695,7 @@ struct IWineD3DStateBlockImpl
|
|||
/* IUnknown fields */
|
||||
const IWineD3DStateBlockVtbl *lpVtbl;
|
||||
DWORD ref; /* Note: Ref counting not required */
|
||||
|
||||
|
||||
/* IWineD3DStateBlock information */
|
||||
IUnknown *parent;
|
||||
IWineD3DDeviceImpl *wineD3DDevice;
|
||||
|
@ -681,7 +704,7 @@ struct IWineD3DStateBlockImpl
|
|||
/* Array indicating whether things have been set or changed */
|
||||
SAVEDSTATES changed;
|
||||
SAVEDSTATES set;
|
||||
|
||||
|
||||
/* Drawing - Vertex Shader or FVF related */
|
||||
DWORD fvf;
|
||||
/* Vertex Shader Declaration */
|
||||
|
@ -691,20 +714,22 @@ struct IWineD3DStateBlockImpl
|
|||
|
||||
/* Stream Source */
|
||||
BOOL streamIsUP;
|
||||
UINT stream_stride[MAX_STREAMS];
|
||||
UINT stream_offset[MAX_STREAMS];
|
||||
IWineD3DVertexBuffer *stream_source[MAX_STREAMS];
|
||||
UINT streamStride[MAX_STREAMS];
|
||||
UINT streamOffset[MAX_STREAMS];
|
||||
IWineD3DVertexBuffer *streamSource[MAX_STREAMS];
|
||||
UINT streamFreq[MAX_STREAMS];
|
||||
UINT streamFlags[MAX_STREAMS]; /*0 | D3DSTREAMSOURCE_INSTANCEDATA | D3DSTREAMSOURCE_INDEXEDDATA */
|
||||
|
||||
/* Indices */
|
||||
IWineD3DIndexBuffer* pIndexData;
|
||||
UINT baseVertexIndex; /* Note: only used for d3d8 */
|
||||
|
||||
/* Transform */
|
||||
D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE];
|
||||
D3DMATRIX transforms[HIGHEST_TRANSFORMSTATE + 1];
|
||||
|
||||
/* Lights */
|
||||
PLIGHTINFOEL *lights; /* NOTE: active GL lights must be front of the chain */
|
||||
|
||||
|
||||
/* Clipping */
|
||||
double clipplane[MAX_CLIPPLANES][4];
|
||||
WINED3DCLIPSTATUS clip_status;
|
||||
|
@ -715,20 +740,22 @@ struct IWineD3DStateBlockImpl
|
|||
/* Material */
|
||||
WINED3DMATERIAL material;
|
||||
|
||||
/* Pixel Shader */
|
||||
void *pixelShader; /* TODO: Replace void * with IWineD3DPixelShader * */
|
||||
|
||||
/* Indexed Vertex Blending */
|
||||
D3DVERTEXBLENDFLAGS vertex_blend;
|
||||
FLOAT tween_factor;
|
||||
|
||||
/* RenderState */
|
||||
DWORD renderState[WINEHIGHEST_RENDER_STATE];
|
||||
DWORD renderState[WINEHIGHEST_RENDER_STATE + 1];
|
||||
|
||||
/* Texture */
|
||||
IWineD3DBaseTexture *textures[8];
|
||||
int textureDimensions[8];
|
||||
IWineD3DBaseTexture *textures[MAX_TEXTURES];
|
||||
int textureDimensions[MAX_SAMPLERS];
|
||||
|
||||
/* Texture State Stage */
|
||||
DWORD textureState[8][HIGHEST_TEXTURE_STATE];
|
||||
|
||||
DWORD textureState[MAX_TEXTURES][HIGHEST_TEXTURE_STATE + 1];
|
||||
/* Sampler States */
|
||||
DWORD samplerState[MAX_SAMPLERS][HIGHEST_SAMPLER_STATE + 1];
|
||||
|
||||
|
|
|
@ -1114,6 +1114,9 @@ DECLARE_INTERFACE_(IWineD3DStateBlock,IUnknown)
|
|||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** IWineD3DStateBlock methods ***/
|
||||
STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE;
|
||||
STDMETHOD(GetDevice)(THIS_ IWineD3DDevice **pDevice) PURE;
|
||||
STDMETHOD(Capture)(THIS) PURE;
|
||||
STDMETHOD(Apply)(THIS) PURE;
|
||||
STDMETHOD(InitStartupStateBlock)(THIS) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
@ -1125,6 +1128,9 @@ DECLARE_INTERFACE_(IWineD3DStateBlock,IUnknown)
|
|||
#define IWineD3DStateBlock_Release(p) (p)->lpVtbl->Release(p)
|
||||
/*** IWineD3DStateBlock methods ***/
|
||||
#define IWineD3DStateBlock_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
|
||||
#define IWineD3DStateBlock_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
|
||||
#define IWineD3DStateBlock_Capture(p) (p)->lpVtbl->Capture(p)
|
||||
#define IWineD3DStateBlock_Apply(p) (p)->lpVtbl->Apply(p)
|
||||
#define IWineD3DStateBlock_InitStartupStateBlock(p) (p)->lpVtbl->InitStartupStateBlock(p)
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue