wined3d: Remove stateblock::set.*.
This commit is contained in:
parent
f41ab3be9b
commit
e7cbb340dc
|
@ -2099,7 +2099,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetFVF(IWineD3DDevice *iface, DWORD fvf
|
|||
|
||||
/* Update the current state block */
|
||||
This->updateStateBlock->changed.fvf = TRUE;
|
||||
This->updateStateBlock->set.fvf = TRUE;
|
||||
|
||||
if(This->updateStateBlock->fvf == fvf) {
|
||||
TRACE("Application is setting the old fvf over, nothing to do\n");
|
||||
|
@ -2136,7 +2135,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSource(IWineD3DDevice *iface,
|
|||
TRACE("(%p) : StreamNo: %u, OldStream (%p), NewStream (%p), OffsetInBytes %u, NewStride %u\n", This, StreamNumber, oldSrc, pStreamData, OffsetInBytes, Stride);
|
||||
|
||||
This->updateStateBlock->changed.streamSource[StreamNumber] = TRUE;
|
||||
This->updateStateBlock->set.streamSource[StreamNumber] = TRUE;
|
||||
|
||||
if(oldSrc == pStreamData &&
|
||||
This->updateStateBlock->streamStride[StreamNumber] == Stride &&
|
||||
|
@ -2207,7 +2205,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetStreamSourceFreq(IWineD3DDevice *ifa
|
|||
This->updateStateBlock->streamFlags[StreamNumber] = Divider & (WINED3DSTREAMSOURCE_INSTANCEDATA | WINED3DSTREAMSOURCE_INDEXEDDATA );
|
||||
|
||||
This->updateStateBlock->changed.streamFreq[StreamNumber] = TRUE;
|
||||
This->updateStateBlock->set.streamFreq[StreamNumber] = TRUE;
|
||||
This->updateStateBlock->streamFreq[StreamNumber] = Divider & 0x7FFFFF;
|
||||
|
||||
if(This->updateStateBlock->streamFreq[StreamNumber] != oldFreq ||
|
||||
|
@ -2242,7 +2239,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTransform(IWineD3DDevice *iface, W
|
|||
if (This->isRecordingState) {
|
||||
TRACE("Recording... not performing anything\n");
|
||||
This->updateStateBlock->changed.transform[d3dts] = TRUE;
|
||||
This->updateStateBlock->set.transform[d3dts] = TRUE;
|
||||
memcpy(&This->updateStateBlock->transforms[d3dts], lpmatrix, sizeof(WINED3DMATRIX));
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -2598,7 +2594,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWO
|
|||
}
|
||||
|
||||
This->updateStateBlock->changed.clipplane[Index] = TRUE;
|
||||
This->updateStateBlock->set.clipplane[Index] = TRUE;
|
||||
|
||||
if(This->updateStateBlock->clipplane[Index][0] == pPlane[0] &&
|
||||
This->updateStateBlock->clipplane[Index][1] == pPlane[1] &&
|
||||
|
@ -2674,7 +2669,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetMaterial(IWineD3DDevice *iface, CONS
|
|||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
|
||||
This->updateStateBlock->changed.material = TRUE;
|
||||
This->updateStateBlock->set.material = TRUE;
|
||||
memcpy(&This->updateStateBlock->material, pMaterial, sizeof(WINED3DMATERIAL));
|
||||
|
||||
/* Handle recording of state blocks */
|
||||
|
@ -2714,7 +2708,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetIndices(IWineD3DDevice *iface, IWine
|
|||
oldIdxs = This->updateStateBlock->pIndexData;
|
||||
|
||||
This->updateStateBlock->changed.indices = TRUE;
|
||||
This->updateStateBlock->set.indices = TRUE;
|
||||
This->updateStateBlock->pIndexData = pIndexData;
|
||||
|
||||
/* Handle recording of state blocks */
|
||||
|
@ -2786,7 +2779,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetViewport(IWineD3DDevice *iface, CONS
|
|||
|
||||
TRACE("(%p)\n", This);
|
||||
This->updateStateBlock->changed.viewport = TRUE;
|
||||
This->updateStateBlock->set.viewport = TRUE;
|
||||
memcpy(&This->updateStateBlock->viewport, pViewport, sizeof(WINED3DVIEWPORT));
|
||||
|
||||
/* Handle recording of state blocks */
|
||||
|
@ -2822,7 +2814,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, W
|
|||
TRACE("(%p)->state = %s(%d), value = %d\n", This, debug_d3drenderstate(State), State, Value);
|
||||
|
||||
This->updateStateBlock->changed.renderState[State] = TRUE;
|
||||
This->updateStateBlock->set.renderState[State] = TRUE;
|
||||
This->updateStateBlock->renderState[State] = Value;
|
||||
|
||||
/* Handle recording of state blocks */
|
||||
|
@ -2881,7 +2872,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetSamplerState(IWineD3DDevice *iface,
|
|||
|
||||
oldValue = This->stateBlock->samplerState[Sampler][Type];
|
||||
This->updateStateBlock->samplerState[Sampler][Type] = Value;
|
||||
This->updateStateBlock->set.samplerState[Sampler][Type] = Value;
|
||||
This->updateStateBlock->changed.samplerState[Sampler][Type] = Value;
|
||||
|
||||
/* Handle recording of state blocks */
|
||||
|
@ -2919,7 +2909,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetSamplerState(IWineD3DDevice *iface,
|
|||
static HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, CONST RECT* pRect) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
|
||||
This->updateStateBlock->set.scissorRect = TRUE;
|
||||
This->updateStateBlock->changed.scissorRect = TRUE;
|
||||
if(EqualRect(&This->updateStateBlock->scissorRect, pRect)) {
|
||||
TRACE("App is setting the old scissor rectangle over, nothing to do\n");
|
||||
|
@ -2953,7 +2942,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexDeclaration(IWineD3DDevice* if
|
|||
|
||||
This->updateStateBlock->vertexDecl = pDecl;
|
||||
This->updateStateBlock->changed.vertexDecl = TRUE;
|
||||
This->updateStateBlock->set.vertexDecl = TRUE;
|
||||
|
||||
if (This->isRecordingState) {
|
||||
TRACE("Recording... not performing anything\n");
|
||||
|
@ -2984,7 +2972,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShader(IWineD3DDevice *iface,
|
|||
|
||||
This->updateStateBlock->vertexShader = pShader;
|
||||
This->updateStateBlock->changed.vertexShader = TRUE;
|
||||
This->updateStateBlock->set.vertexShader = TRUE;
|
||||
|
||||
if (This->isRecordingState) {
|
||||
TRACE("Recording... not performing anything\n");
|
||||
|
@ -3037,7 +3024,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantB(
|
|||
|
||||
for (i = start; i < cnt + start; ++i) {
|
||||
This->updateStateBlock->changed.vertexShaderConstantsB[i] = TRUE;
|
||||
This->updateStateBlock->set.vertexShaderConstantsB[i] = TRUE;
|
||||
}
|
||||
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
|
||||
|
@ -3086,7 +3072,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantI(
|
|||
|
||||
for (i = start; i < cnt + start; ++i) {
|
||||
This->updateStateBlock->changed.vertexShaderConstantsI[i] = TRUE;
|
||||
This->updateStateBlock->set.vertexShaderConstantsI[i] = TRUE;
|
||||
}
|
||||
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
|
||||
|
@ -3137,16 +3122,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF(
|
|||
}
|
||||
|
||||
for (i = start; i < count + start; ++i) {
|
||||
if (!This->updateStateBlock->set.vertexShaderConstantsF[i]) {
|
||||
if (!This->updateStateBlock->changed.vertexShaderConstantsF[i]) {
|
||||
constants_entry *ptr = LIST_ENTRY(list_head(&This->updateStateBlock->set_vconstantsF), constants_entry, entry);
|
||||
if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx)) {
|
||||
ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry));
|
||||
list_add_head(&This->updateStateBlock->set_vconstantsF, &ptr->entry);
|
||||
}
|
||||
ptr->idx[ptr->count++] = i;
|
||||
This->updateStateBlock->set.vertexShaderConstantsF[i] = TRUE;
|
||||
This->updateStateBlock->changed.vertexShaderConstantsF[i] = TRUE;
|
||||
}
|
||||
This->updateStateBlock->changed.vertexShaderConstantsF[i] = TRUE;
|
||||
}
|
||||
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
|
||||
|
@ -3369,7 +3353,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShader(IWineD3DDevice *iface, I
|
|||
IWineD3DPixelShader *oldShader = This->updateStateBlock->pixelShader;
|
||||
This->updateStateBlock->pixelShader = pShader;
|
||||
This->updateStateBlock->changed.pixelShader = TRUE;
|
||||
This->updateStateBlock->set.pixelShader = TRUE;
|
||||
|
||||
/* Handle recording of state blocks */
|
||||
if (This->isRecordingState) {
|
||||
|
@ -3429,7 +3412,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB(
|
|||
|
||||
for (i = start; i < cnt + start; ++i) {
|
||||
This->updateStateBlock->changed.pixelShaderConstantsB[i] = TRUE;
|
||||
This->updateStateBlock->set.pixelShaderConstantsB[i] = TRUE;
|
||||
}
|
||||
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
|
||||
|
@ -3478,7 +3460,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantI(
|
|||
|
||||
for (i = start; i < cnt + start; ++i) {
|
||||
This->updateStateBlock->changed.pixelShaderConstantsI[i] = TRUE;
|
||||
This->updateStateBlock->set.pixelShaderConstantsI[i] = TRUE;
|
||||
}
|
||||
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
|
||||
|
@ -3529,16 +3510,15 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF(
|
|||
}
|
||||
|
||||
for (i = start; i < count + start; ++i) {
|
||||
if (!This->updateStateBlock->set.pixelShaderConstantsF[i]) {
|
||||
if (!This->updateStateBlock->changed.pixelShaderConstantsF[i]) {
|
||||
constants_entry *ptr = LIST_ENTRY(list_head(&This->updateStateBlock->set_pconstantsF), constants_entry, entry);
|
||||
if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx)) {
|
||||
ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry));
|
||||
list_add_head(&This->updateStateBlock->set_pconstantsF, &ptr->entry);
|
||||
}
|
||||
ptr->idx[ptr->count++] = i;
|
||||
This->updateStateBlock->set.pixelShaderConstantsF[i] = TRUE;
|
||||
This->updateStateBlock->changed.pixelShaderConstantsF[i] = TRUE;
|
||||
}
|
||||
This->updateStateBlock->changed.pixelShaderConstantsF[i] = TRUE;
|
||||
}
|
||||
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT);
|
||||
|
@ -4006,7 +3986,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *if
|
|||
}
|
||||
|
||||
This->updateStateBlock->changed.textureState[Stage][Type] = TRUE;
|
||||
This->updateStateBlock->set.textureState[Stage][Type] = TRUE;
|
||||
This->updateStateBlock->textureState[Stage][Type] = Value;
|
||||
|
||||
if (This->isRecordingState) {
|
||||
|
@ -4106,7 +4085,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD
|
|||
TRACE("GL_LIMITS %d\n",GL_LIMITS(sampler_stages));
|
||||
TRACE("(%p) : oldtexture(%p)\n", This,oldTexture);
|
||||
|
||||
This->updateStateBlock->set.textures[Stage] = TRUE;
|
||||
This->updateStateBlock->changed.textures[Stage] = TRUE;
|
||||
TRACE("(%p) : setting new texture to %p\n", This, pTexture);
|
||||
This->updateStateBlock->textures[Stage] = pTexture;
|
||||
|
|
|
@ -343,12 +343,12 @@ void shader_glsl_load_constants(
|
|||
/* Load DirectX 9 integer constants/uniforms for vertex shader */
|
||||
shader_glsl_load_constantsI(vshader, gl_info, programId, MAX_CONST_I,
|
||||
stateBlock->vertexShaderConstantI,
|
||||
stateBlock->set.vertexShaderConstantsI);
|
||||
stateBlock->changed.vertexShaderConstantsI);
|
||||
|
||||
/* Load DirectX 9 boolean constants/uniforms for vertex shader */
|
||||
shader_glsl_load_constantsB(vshader, gl_info, programId, MAX_CONST_B,
|
||||
stateBlock->vertexShaderConstantB,
|
||||
stateBlock->set.vertexShaderConstantsB);
|
||||
stateBlock->changed.vertexShaderConstantsB);
|
||||
|
||||
/* Upload the position fixup params */
|
||||
pos = GL_EXTCALL(glGetUniformLocationARB(programId, "posFixup"));
|
||||
|
@ -374,12 +374,12 @@ void shader_glsl_load_constants(
|
|||
/* Load DirectX 9 integer constants/uniforms for pixel shader */
|
||||
shader_glsl_load_constantsI(pshader, gl_info, programId, MAX_CONST_I,
|
||||
stateBlock->pixelShaderConstantI,
|
||||
stateBlock->set.pixelShaderConstantsI);
|
||||
stateBlock->changed.pixelShaderConstantsI);
|
||||
|
||||
/* Load DirectX 9 boolean constants/uniforms for pixel shader */
|
||||
shader_glsl_load_constantsB(pshader, gl_info, programId, MAX_CONST_B,
|
||||
stateBlock->pixelShaderConstantB,
|
||||
stateBlock->set.pixelShaderConstantsB);
|
||||
stateBlock->changed.pixelShaderConstantsB);
|
||||
|
||||
/* Upload the environment bump map matrix if needed. The needsbumpmat member specifies the texture stage to load the matrix from.
|
||||
* It can't be 0 for a valid texbem instruction.
|
||||
|
|
|
@ -652,32 +652,20 @@ state_stencil(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *c
|
|||
return;
|
||||
}
|
||||
|
||||
if( stateblock->set.renderState[WINED3DRS_STENCILENABLE] )
|
||||
onesided_enable = stateblock->renderState[WINED3DRS_STENCILENABLE];
|
||||
if( stateblock->set.renderState[WINED3DRS_TWOSIDEDSTENCILMODE] )
|
||||
twosided_enable = stateblock->renderState[WINED3DRS_TWOSIDEDSTENCILMODE];
|
||||
if( stateblock->set.renderState[WINED3DRS_STENCILFUNC] )
|
||||
if( !( func = CompareFunc(stateblock->renderState[WINED3DRS_STENCILFUNC]) ) )
|
||||
func = GL_ALWAYS;
|
||||
if( stateblock->set.renderState[WINED3DRS_CCW_STENCILFUNC] )
|
||||
if( !( func_ccw = CompareFunc(stateblock->renderState[WINED3DRS_CCW_STENCILFUNC]) ) )
|
||||
func = GL_ALWAYS;
|
||||
if( stateblock->set.renderState[WINED3DRS_STENCILREF] )
|
||||
ref = stateblock->renderState[WINED3DRS_STENCILREF];
|
||||
if( stateblock->set.renderState[WINED3DRS_STENCILMASK] )
|
||||
mask = stateblock->renderState[WINED3DRS_STENCILMASK];
|
||||
if( stateblock->set.renderState[WINED3DRS_STENCILFAIL] )
|
||||
stencilFail = StencilOp(stateblock->renderState[WINED3DRS_STENCILFAIL]);
|
||||
if( stateblock->set.renderState[WINED3DRS_STENCILZFAIL] )
|
||||
depthFail = StencilOp(stateblock->renderState[WINED3DRS_STENCILZFAIL]);
|
||||
if( stateblock->set.renderState[WINED3DRS_STENCILPASS] )
|
||||
stencilPass = StencilOp(stateblock->renderState[WINED3DRS_STENCILPASS]);
|
||||
if( stateblock->set.renderState[WINED3DRS_CCW_STENCILFAIL] )
|
||||
stencilFail_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILFAIL]);
|
||||
if( stateblock->set.renderState[WINED3DRS_CCW_STENCILZFAIL] )
|
||||
depthFail_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILZFAIL]);
|
||||
if( stateblock->set.renderState[WINED3DRS_CCW_STENCILPASS] )
|
||||
stencilPass_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILPASS]);
|
||||
onesided_enable = stateblock->renderState[WINED3DRS_STENCILENABLE];
|
||||
twosided_enable = stateblock->renderState[WINED3DRS_TWOSIDEDSTENCILMODE];
|
||||
if( !( func = CompareFunc(stateblock->renderState[WINED3DRS_STENCILFUNC]) ) )
|
||||
func = GL_ALWAYS;
|
||||
if( !( func_ccw = CompareFunc(stateblock->renderState[WINED3DRS_CCW_STENCILFUNC]) ) )
|
||||
func = GL_ALWAYS;
|
||||
ref = stateblock->renderState[WINED3DRS_STENCILREF];
|
||||
mask = stateblock->renderState[WINED3DRS_STENCILMASK];
|
||||
stencilFail = StencilOp(stateblock->renderState[WINED3DRS_STENCILFAIL]);
|
||||
depthFail = StencilOp(stateblock->renderState[WINED3DRS_STENCILZFAIL]);
|
||||
stencilPass = StencilOp(stateblock->renderState[WINED3DRS_STENCILPASS]);
|
||||
stencilFail_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILFAIL]);
|
||||
depthFail_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILZFAIL]);
|
||||
stencilPass_ccw = StencilOp(stateblock->renderState[WINED3DRS_CCW_STENCILPASS]);
|
||||
|
||||
TRACE("(onesided %d, twosided %d, ref %x, mask %x, "
|
||||
"GL_FRONT: func: %x, fail %x, zfail %x, zpass %x "
|
||||
|
|
|
@ -42,14 +42,10 @@ HRESULT allocate_shader_constants(IWineD3DStateBlockImpl* object) {
|
|||
/* Allocate space for floating point constants */
|
||||
object->pixelShaderConstantF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(float) * GL_LIMITS(pshader_constantsF) * 4);
|
||||
WINED3D_MEMCHECK(object->pixelShaderConstantF);
|
||||
object->set.pixelShaderConstantsF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BOOL) * GL_LIMITS(pshader_constantsF) );
|
||||
WINED3D_MEMCHECK(object->set.pixelShaderConstantsF);
|
||||
object->changed.pixelShaderConstantsF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BOOL) * GL_LIMITS(pshader_constantsF));
|
||||
WINED3D_MEMCHECK(object->changed.pixelShaderConstantsF);
|
||||
object->vertexShaderConstantF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(float) * GL_LIMITS(vshader_constantsF) * 4);
|
||||
WINED3D_MEMCHECK(object->vertexShaderConstantF);
|
||||
object->set.vertexShaderConstantsF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BOOL) * GL_LIMITS(vshader_constantsF));
|
||||
WINED3D_MEMCHECK(object->set.vertexShaderConstantsF);
|
||||
object->changed.vertexShaderConstantsF = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BOOL) * GL_LIMITS(vshader_constantsF));
|
||||
WINED3D_MEMCHECK(object->changed.vertexShaderConstantsF);
|
||||
|
||||
|
@ -155,7 +151,6 @@ void stateblock_copy(
|
|||
Dest->blockType = This->blockType;
|
||||
|
||||
/* Saved states */
|
||||
stateblock_savedstates_copy(source, &Dest->set, &This->set);
|
||||
stateblock_savedstates_copy(source, &Dest->changed, &This->changed);
|
||||
|
||||
/* Single items */
|
||||
|
@ -278,10 +273,8 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
|
|||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->vertexShaderConstantF);
|
||||
HeapFree(GetProcessHeap(), 0, This->set.vertexShaderConstantsF);
|
||||
HeapFree(GetProcessHeap(), 0, This->changed.vertexShaderConstantsF);
|
||||
HeapFree(GetProcessHeap(), 0, This->pixelShaderConstantF);
|
||||
HeapFree(GetProcessHeap(), 0, This->set.pixelShaderConstantsF);
|
||||
HeapFree(GetProcessHeap(), 0, This->changed.pixelShaderConstantsF);
|
||||
|
||||
LIST_FOR_EACH_ENTRY_SAFE(constant, constant2, &This->set_vconstantsF, constants_entry, entry) {
|
||||
|
@ -357,7 +350,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
|
||||
/* Vertex Shader Float Constants */
|
||||
for (i = 0; i < GL_LIMITS(vshader_constantsF); ++i) {
|
||||
if (This->set.vertexShaderConstantsF[i]) {
|
||||
if (This->changed.vertexShaderConstantsF[i]) {
|
||||
TRACE("Setting %p from %p %d to { %f, %f, %f, %f }\n", This, targetStateBlock, i,
|
||||
targetStateBlock->vertexShaderConstantF[i * 4],
|
||||
targetStateBlock->vertexShaderConstantF[i * 4 + 1],
|
||||
|
@ -373,7 +366,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
|
||||
/* Vertex Shader Integer Constants */
|
||||
for (i = 0; i < MAX_CONST_I; ++i) {
|
||||
if (This->set.vertexShaderConstantsI[i]) {
|
||||
if (This->changed.vertexShaderConstantsI[i]) {
|
||||
TRACE("Setting %p from %p %d to { %d, %d, %d, %d }\n", This, targetStateBlock, i,
|
||||
targetStateBlock->vertexShaderConstantI[i * 4],
|
||||
targetStateBlock->vertexShaderConstantI[i * 4 + 1],
|
||||
|
@ -389,7 +382,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
|
||||
/* Vertex Shader Boolean Constants */
|
||||
for (i = 0; i < MAX_CONST_B; ++i) {
|
||||
if (This->set.vertexShaderConstantsB[i]) {
|
||||
if (This->changed.vertexShaderConstantsB[i]) {
|
||||
TRACE("Setting %p from %p %d to %s\n", This, targetStateBlock, i,
|
||||
targetStateBlock->vertexShaderConstantB[i]? "TRUE":"FALSE");
|
||||
|
||||
|
@ -453,7 +446,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
|
||||
/* Pixel Shader Float Constants */
|
||||
for (i = 0; i < GL_LIMITS(pshader_constantsF); ++i) {
|
||||
if (This->set.pixelShaderConstantsF[i]) {
|
||||
if (This->changed.pixelShaderConstantsF[i]) {
|
||||
TRACE("Setting %p from %p %d to { %f, %f, %f, %f }\n", This, targetStateBlock, i,
|
||||
targetStateBlock->pixelShaderConstantF[i * 4],
|
||||
targetStateBlock->pixelShaderConstantF[i * 4 + 1],
|
||||
|
@ -469,7 +462,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
|
||||
/* Pixel Shader Integer Constants */
|
||||
for (i = 0; i < MAX_CONST_I; ++i) {
|
||||
if (This->set.pixelShaderConstantsI[i]) {
|
||||
if (This->changed.pixelShaderConstantsI[i]) {
|
||||
TRACE("Setting %p from %p %d to { %d, %d, %d, %d }\n", This, targetStateBlock, i,
|
||||
targetStateBlock->pixelShaderConstantI[i * 4],
|
||||
targetStateBlock->pixelShaderConstantI[i * 4 + 1],
|
||||
|
@ -485,7 +478,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
|
||||
/* Pixel Shader Boolean Constants */
|
||||
for (i = 0; i < MAX_CONST_B; ++i) {
|
||||
if (This->set.pixelShaderConstantsB[i]) {
|
||||
if (This->changed.pixelShaderConstantsB[i]) {
|
||||
TRACE("Setting %p from %p %d to %s\n", This, targetStateBlock, i,
|
||||
targetStateBlock->pixelShaderConstantB[i]? "TRUE":"FALSE");
|
||||
|
||||
|
@ -495,7 +488,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
|
||||
/* Others + Render & Texture */
|
||||
for (i = 1; i <= HIGHEST_TRANSFORMSTATE; i++) {
|
||||
if (This->set.transform[i] && memcmp(&targetStateBlock->transforms[i],
|
||||
if (This->changed.transform[i] && memcmp(&targetStateBlock->transforms[i],
|
||||
&This->transforms[i],
|
||||
sizeof(WINED3DMATRIX)) != 0) {
|
||||
TRACE("Updating transform %d\n", i);
|
||||
|
@ -503,7 +496,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
}
|
||||
}
|
||||
|
||||
if (This->set.indices && ((This->pIndexData != targetStateBlock->pIndexData)
|
||||
if (This->changed.indices && ((This->pIndexData != targetStateBlock->pIndexData)
|
||||
|| (This->baseVertexIndex != targetStateBlock->baseVertexIndex))) {
|
||||
TRACE("Updating pindexData to %p, baseVertexIndex to %d\n",
|
||||
targetStateBlock->pIndexData, targetStateBlock->baseVertexIndex);
|
||||
|
@ -511,31 +504,31 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
This->baseVertexIndex = targetStateBlock->baseVertexIndex;
|
||||
}
|
||||
|
||||
if(This->set.vertexDecl && This->vertexDecl != targetStateBlock->vertexDecl){
|
||||
if(This->changed.vertexDecl && This->vertexDecl != targetStateBlock->vertexDecl){
|
||||
TRACE("Updating vertex declaration from %p to %p\n", This->vertexDecl, targetStateBlock->vertexDecl);
|
||||
|
||||
This->vertexDecl = targetStateBlock->vertexDecl;
|
||||
}
|
||||
|
||||
if(This->set.fvf && This->fvf != targetStateBlock->fvf){
|
||||
if(This->changed.fvf && This->fvf != targetStateBlock->fvf){
|
||||
This->fvf = targetStateBlock->fvf;
|
||||
}
|
||||
|
||||
if (This->set.material && memcmp(&targetStateBlock->material,
|
||||
if (This->changed.material && memcmp(&targetStateBlock->material,
|
||||
&This->material,
|
||||
sizeof(WINED3DMATERIAL)) != 0) {
|
||||
TRACE("Updating material\n");
|
||||
memcpy(&This->material, &targetStateBlock->material, sizeof(WINED3DMATERIAL));
|
||||
}
|
||||
|
||||
if (This->set.viewport && memcmp(&targetStateBlock->viewport,
|
||||
if (This->changed.viewport && memcmp(&targetStateBlock->viewport,
|
||||
&This->viewport,
|
||||
sizeof(WINED3DVIEWPORT)) != 0) {
|
||||
TRACE("Updating viewport\n");
|
||||
memcpy(&This->viewport, &targetStateBlock->viewport, sizeof(WINED3DVIEWPORT));
|
||||
}
|
||||
|
||||
if(This->set.scissorRect && memcmp(&targetStateBlock->scissorRect,
|
||||
if(This->changed.scissorRect && memcmp(&targetStateBlock->scissorRect,
|
||||
&This->scissorRect,
|
||||
sizeof(targetStateBlock->scissorRect)))
|
||||
{
|
||||
|
@ -544,7 +537,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
}
|
||||
|
||||
for (i = 0; i < MAX_STREAMS; i++) {
|
||||
if (This->set.streamSource[i] &&
|
||||
if (This->changed.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],
|
||||
|
@ -553,7 +546,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
This->streamSource[i] = targetStateBlock->streamSource[i];
|
||||
}
|
||||
|
||||
if (This->set.streamFreq[i] &&
|
||||
if (This->changed.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] ,
|
||||
|
@ -564,7 +557,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
}
|
||||
|
||||
for (i = 0; i < GL_LIMITS(clipplanes); i++) {
|
||||
if (This->set.clipplane[i] && memcmp(&targetStateBlock->clipplane[i],
|
||||
if (This->changed.clipplane[i] && memcmp(&targetStateBlock->clipplane[i],
|
||||
&This->clipplane[i],
|
||||
sizeof(This->clipplane)) != 0) {
|
||||
|
||||
|
@ -577,7 +570,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
/* Render */
|
||||
for (i = 1; i <= WINEHIGHEST_RENDER_STATE; i++) {
|
||||
|
||||
if (This->set.renderState[i] && (This->renderState[i] != targetStateBlock->renderState[i])) {
|
||||
if (This->changed.renderState[i] && (This->renderState[i] != targetStateBlock->renderState[i])) {
|
||||
TRACE("Updating renderState %d to %d\n", i, targetStateBlock->renderState[i]);
|
||||
This->renderState[i] = targetStateBlock->renderState[i];
|
||||
}
|
||||
|
@ -587,7 +580,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
for (j = 0; j < MAX_TEXTURES; j++) {
|
||||
/* TODO: move over to using memcpy */
|
||||
for (i = 1; i <= WINED3D_HIGHEST_TEXTURE_STATE ; i++) {
|
||||
if (This->set.textureState[j][i]) {
|
||||
if (This->changed.textureState[j][i]) {
|
||||
TRACE("Updating texturestagestate %d,%d to %d (was %d)\n", j,i, targetStateBlock->textureState[j][i],
|
||||
This->textureState[j][i]);
|
||||
This->textureState[j][i] = targetStateBlock->textureState[j][i];
|
||||
|
@ -598,12 +591,12 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
|||
/* Samplers */
|
||||
/* TODO: move over to using memcpy */
|
||||
for (j = 0; j < MAX_COMBINED_SAMPLERS; j++) {
|
||||
if (This->set.textures[j]) {
|
||||
if (This->changed.textures[j]) {
|
||||
TRACE("Updating texture %d to %p (was %p)\n", j, targetStateBlock->textures[j], This->textures[j]);
|
||||
This->textures[j] = targetStateBlock->textures[j];
|
||||
}
|
||||
for (i = 1; i <= WINED3D_HIGHEST_SAMPLER_STATE ; i++){ /* States are 1 based */
|
||||
if (This->set.samplerState[j][i]) {
|
||||
if (This->changed.samplerState[j][i]) {
|
||||
TRACE("Updating sampler state %d,%d to %d (was %d)\n",
|
||||
j, i, targetStateBlock->samplerState[j][i],
|
||||
This->samplerState[j][i]);
|
||||
|
@ -651,23 +644,23 @@ should really perform a delta so that only the changes get updated*/
|
|||
}
|
||||
|
||||
/* Vertex Shader */
|
||||
if (This->set.vertexShader && This->changed.vertexShader) {
|
||||
if (This->changed.vertexShader) {
|
||||
IWineD3DDevice_SetVertexShader(pDevice, This->vertexShader);
|
||||
}
|
||||
|
||||
/* Vertex Shader Constants */
|
||||
for (i = 0; i < GL_LIMITS(vshader_constantsF); ++i) {
|
||||
if (This->set.vertexShaderConstantsF[i] && This->changed.vertexShaderConstantsF[i])
|
||||
if (This->changed.vertexShaderConstantsF[i])
|
||||
IWineD3DDevice_SetVertexShaderConstantF(pDevice, i, This->vertexShaderConstantF + i * 4, 1);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_CONST_I; i++) {
|
||||
if (This->set.vertexShaderConstantsI[i] && This->changed.vertexShaderConstantsI[i])
|
||||
if (This->changed.vertexShaderConstantsI[i])
|
||||
IWineD3DDevice_SetVertexShaderConstantI(pDevice, i, This->vertexShaderConstantI + i * 4, 1);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_CONST_B; i++) {
|
||||
if (This->set.vertexShaderConstantsB[i] && This->changed.vertexShaderConstantsB[i])
|
||||
if (This->changed.vertexShaderConstantsB[i])
|
||||
IWineD3DDevice_SetVertexShaderConstantB(pDevice, i, This->vertexShaderConstantB + i, 1);
|
||||
}
|
||||
}
|
||||
|
@ -675,67 +668,67 @@ should really perform a delta so that only the changes get updated*/
|
|||
if (/*TODO: 'magic' statetype, replace with BOOL This->blockType == D3DSBT_RECORDED || */ This->blockType == WINED3DSBT_ALL || This->blockType == WINED3DSBT_PIXELSTATE) {
|
||||
|
||||
/* Pixel Shader */
|
||||
if (This->set.pixelShader && This->changed.pixelShader) {
|
||||
if (This->changed.pixelShader) {
|
||||
IWineD3DDevice_SetPixelShader(pDevice, This->pixelShader);
|
||||
}
|
||||
|
||||
/* Pixel Shader Constants */
|
||||
for (i = 0; i < GL_LIMITS(pshader_constantsF); ++i) {
|
||||
if (This->set.pixelShaderConstantsF[i] && This->changed.pixelShaderConstantsF[i])
|
||||
if (This->changed.pixelShaderConstantsF[i])
|
||||
IWineD3DDevice_SetPixelShaderConstantF(pDevice, i, This->pixelShaderConstantF + i * 4, 1);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_CONST_I; ++i) {
|
||||
if (This->set.pixelShaderConstantsI[i] && This->changed.pixelShaderConstantsI[i])
|
||||
if (This->changed.pixelShaderConstantsI[i])
|
||||
IWineD3DDevice_SetPixelShaderConstantI(pDevice, i, This->pixelShaderConstantI + i * 4, 1);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_CONST_B; ++i) {
|
||||
if (This->set.pixelShaderConstantsB[i] && This->changed.pixelShaderConstantsB[i])
|
||||
if (This->changed.pixelShaderConstantsB[i])
|
||||
IWineD3DDevice_SetPixelShaderConstantB(pDevice, i, This->pixelShaderConstantB + i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (This->set.fvf && This->changed.fvf) {
|
||||
if (This->changed.fvf) {
|
||||
IWineD3DDevice_SetFVF(pDevice, This->fvf);
|
||||
}
|
||||
|
||||
if (This->set.vertexDecl && This->changed.vertexDecl) {
|
||||
if (This->changed.vertexDecl) {
|
||||
IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl);
|
||||
}
|
||||
|
||||
/* Others + Render & Texture */
|
||||
if (/*TODO: 'magic' statetype, replace with BOOL This->blockType == D3DSBT_RECORDED || */ This->blockType == WINED3DSBT_ALL || This->blockType == WINED3DSBT_INIT) {
|
||||
for (i = 1; i <= HIGHEST_TRANSFORMSTATE; i++) {
|
||||
if (This->set.transform[i] && This->changed.transform[i])
|
||||
if (This->changed.transform[i])
|
||||
IWineD3DDevice_SetTransform(pDevice, i, &This->transforms[i]);
|
||||
}
|
||||
|
||||
if (This->set.indices && This->changed.indices) {
|
||||
if (This->changed.indices) {
|
||||
IWineD3DDevice_SetIndices(pDevice, This->pIndexData);
|
||||
IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex);
|
||||
}
|
||||
|
||||
if (This->set.material && This->changed.material )
|
||||
if (This->changed.material )
|
||||
IWineD3DDevice_SetMaterial(pDevice, &This->material);
|
||||
|
||||
if (This->set.viewport && This->changed.viewport)
|
||||
if (This->changed.viewport)
|
||||
IWineD3DDevice_SetViewport(pDevice, &This->viewport);
|
||||
|
||||
if (This->set.scissorRect && This->changed.scissorRect)
|
||||
if (This->changed.scissorRect)
|
||||
IWineD3DDevice_SetScissorRect(pDevice, &This->scissorRect);
|
||||
|
||||
/* 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])
|
||||
if (This->changed.streamSource[i])
|
||||
IWineD3DDevice_SetStreamSource(pDevice, i, This->streamSource[i], 0, This->streamStride[i]);
|
||||
|
||||
if (This->set.streamFreq[i] && This->changed.streamFreq[i])
|
||||
if (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]) {
|
||||
if (This->changed.clipplane[i]) {
|
||||
float clip[4];
|
||||
|
||||
clip[0] = This->clipplane[i][0];
|
||||
|
@ -748,7 +741,7 @@ should really perform a delta so that only the changes get updated*/
|
|||
|
||||
/* Render */
|
||||
for (i = 1; i <= WINEHIGHEST_RENDER_STATE; i++) {
|
||||
if (This->set.renderState[i] && This->changed.renderState[i])
|
||||
if (This->changed.renderState[i])
|
||||
IWineD3DDevice_SetRenderState(pDevice, i, This->renderState[i]);
|
||||
}
|
||||
|
||||
|
@ -756,9 +749,8 @@ should really perform a delta so that only the changes get updated*/
|
|||
for (j = 0; j < MAX_TEXTURES; j++) { /* Set The texture first, just in case it resets the states? */
|
||||
/* TODO: move over to memcpy */
|
||||
for (i = 1; i <= WINED3D_HIGHEST_TEXTURE_STATE; i++) {
|
||||
if (This->set.textureState[j][i] && This->changed.textureState[j][i]) { /* tb_dx9_10 failes without this test */
|
||||
if (This->changed.textureState[j][i]) { /* tb_dx9_10 failes without this test */
|
||||
((IWineD3DDeviceImpl *)pDevice)->stateBlock->textureState[j][i] = This->textureState[j][i];
|
||||
((IWineD3DDeviceImpl *)pDevice)->stateBlock->set.textureState[j][i] = TRUE;
|
||||
((IWineD3DDeviceImpl *)pDevice)->stateBlock->changed.textureState[j][i] = TRUE;
|
||||
/* TODO: Record a display list to apply all gl states. For now apply by brute force */
|
||||
IWineD3DDeviceImpl_MarkStateDirty((IWineD3DDeviceImpl *)pDevice, STATE_TEXTURESTAGE(j, i));
|
||||
|
@ -769,7 +761,7 @@ should really perform a delta so that only the changes get updated*/
|
|||
/* Samplers */
|
||||
/* TODO: move over to memcpy */
|
||||
for (j = 0 ; j < MAX_COMBINED_SAMPLERS; j++){
|
||||
if (This->set.textures[j] && This->changed.textures[j]) {
|
||||
if (This->changed.textures[j]) {
|
||||
if (j < MAX_FRAGMENT_SAMPLERS) {
|
||||
IWineD3DDevice_SetTexture(pDevice, j, This->textures[j]);
|
||||
} else {
|
||||
|
@ -777,9 +769,8 @@ should really perform a delta so that only the changes get updated*/
|
|||
}
|
||||
}
|
||||
for (i = 1; i <= WINED3D_HIGHEST_SAMPLER_STATE; i++){
|
||||
if (This->set.samplerState[j][i] && This->changed.samplerState[j][i]) {
|
||||
if (This->changed.samplerState[j][i]) {
|
||||
((IWineD3DDeviceImpl *)pDevice)->stateBlock->samplerState[j][i] = This->samplerState[j][i];
|
||||
((IWineD3DDeviceImpl *)pDevice)->stateBlock->set.samplerState[j][i] = TRUE;
|
||||
((IWineD3DDeviceImpl *)pDevice)->stateBlock->changed.samplerState[j][i] = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -790,7 +781,7 @@ should really perform a delta so that only the changes get updated*/
|
|||
} else if (This->blockType == WINED3DSBT_PIXELSTATE) {
|
||||
|
||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) {
|
||||
if (This->set.renderState[SavedPixelStates_R[i]] && This->changed.renderState[SavedPixelStates_R[i]])
|
||||
if (This->changed.renderState[SavedPixelStates_R[i]])
|
||||
IWineD3DDevice_SetRenderState(pDevice, SavedPixelStates_R[i], This->renderState[SavedPixelStates_R[i]]);
|
||||
|
||||
}
|
||||
|
@ -811,7 +802,7 @@ should really perform a delta so that only the changes get updated*/
|
|||
} else if (This->blockType == WINED3DSBT_VERTEXSTATE) {
|
||||
|
||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) {
|
||||
if ( This->set.renderState[SavedVertexStates_R[i]] && This->changed.renderState[SavedVertexStates_R[i]])
|
||||
if (This->changed.renderState[SavedVertexStates_R[i]])
|
||||
IWineD3DDevice_SetRenderState(pDevice, SavedVertexStates_R[i], This->renderState[SavedVertexStates_R[i]]);
|
||||
}
|
||||
|
||||
|
@ -1070,7 +1061,6 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
|
|||
GLubyte white = 255;
|
||||
|
||||
/* Note this avoids calling settexture, so pretend it has been called */
|
||||
This->set.textures[i] = TRUE;
|
||||
This->changed.textures[i] = TRUE;
|
||||
This->textures[i] = NULL;
|
||||
|
||||
|
|
|
@ -1283,7 +1283,6 @@ struct IWineD3DStateBlockImpl
|
|||
|
||||
/* Array indicating whether things have been set or changed */
|
||||
SAVEDSTATES changed;
|
||||
SAVEDSTATES set;
|
||||
struct list set_vconstantsF;
|
||||
struct list set_pconstantsF;
|
||||
|
||||
|
|
Loading…
Reference in New Issue