wined3d: Fix various incorrect uses of GL_LIMITS(texture_stages) and GL_LIMITS(sampler_stages).
This commit is contained in:
parent
4a0ad1d0c5
commit
440ca84680
|
@ -526,7 +526,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
|
||||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) {
|
for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) {
|
||||||
object->changed.renderState[SavedPixelStates_R[i]] = TRUE;
|
object->changed.renderState[SavedPixelStates_R[i]] = TRUE;
|
||||||
}
|
}
|
||||||
for (j = 0; j < GL_LIMITS(texture_stages); j++) {
|
for (j = 0; j < MAX_TEXTURES; j++) {
|
||||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_T; i++) {
|
for (i = 0; i < NUM_SAVEDPIXELSTATES_T; i++) {
|
||||||
object->changed.textureState[j][SavedPixelStates_T[i]] = TRUE;
|
object->changed.textureState[j][SavedPixelStates_T[i]] = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -556,7 +556,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
|
||||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) {
|
for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) {
|
||||||
object->changed.renderState[SavedVertexStates_R[i]] = TRUE;
|
object->changed.renderState[SavedVertexStates_R[i]] = TRUE;
|
||||||
}
|
}
|
||||||
for (j = 0; j < GL_LIMITS(texture_stages); j++) {
|
for (j = 0; j < MAX_TEXTURES; j++) {
|
||||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_T; i++) {
|
for (i = 0; i < NUM_SAVEDVERTEXSTATES_T; i++) {
|
||||||
object->changed.textureState[j][SavedVertexStates_T[i]] = TRUE;
|
object->changed.textureState[j][SavedVertexStates_T[i]] = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1935,7 +1935,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D
|
||||||
This->cursorTexture = 0;
|
This->cursorTexture = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(sampler = 0; sampler < GL_LIMITS(sampler_stages); ++sampler) {
|
for (sampler = 0; sampler < MAX_SAMPLERS; ++sampler) {
|
||||||
IWineD3DDevice_SetTexture(iface, sampler, NULL);
|
IWineD3DDevice_SetTexture(iface, sampler, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6245,7 +6245,7 @@ static void WINAPI IWineD3DDeviceImpl_ResourceReleased(IWineD3DDevice *iface, IW
|
||||||
case WINED3DRTYPE_TEXTURE:
|
case WINED3DRTYPE_TEXTURE:
|
||||||
case WINED3DRTYPE_CUBETEXTURE:
|
case WINED3DRTYPE_CUBETEXTURE:
|
||||||
case WINED3DRTYPE_VOLUMETEXTURE:
|
case WINED3DRTYPE_VOLUMETEXTURE:
|
||||||
for (counter = 0; counter < GL_LIMITS(sampler_stages); counter++) {
|
for (counter = 0; counter < MAX_SAMPLERS; counter++) {
|
||||||
if (This->stateBlock != NULL && This->stateBlock->textures[counter] == (IWineD3DBaseTexture *)resource) {
|
if (This->stateBlock != NULL && This->stateBlock->textures[counter] == (IWineD3DBaseTexture *)resource) {
|
||||||
WARN("Texture being released is still by a stateblock, Stage = %u Texture = %p\n", counter, resource);
|
WARN("Texture being released is still by a stateblock, Stage = %u Texture = %p\n", counter, resource);
|
||||||
This->stateBlock->textures[counter] = NULL;
|
This->stateBlock->textures[counter] = NULL;
|
||||||
|
|
|
@ -1124,7 +1124,7 @@ if(stridedlcl.u.s.type.VBO) { \
|
||||||
{
|
{
|
||||||
IWineD3DSurface *pSur;
|
IWineD3DSurface *pSur;
|
||||||
int textureNo;
|
int textureNo;
|
||||||
for (textureNo = 0; textureNo < GL_LIMITS(textures); ++textureNo) {
|
for (textureNo = 0; textureNo < MAX_SAMPLERS; ++textureNo) {
|
||||||
if (This->stateBlock->textures[textureNo] != NULL) {
|
if (This->stateBlock->textures[textureNo] != NULL) {
|
||||||
sprintf(buffer, "/tmp/texture_%p_%d_%d.tga", This->stateBlock->textures[textureNo], primCounter, textureNo);
|
sprintf(buffer, "/tmp/texture_%p_%d_%d.tga", This->stateBlock->textures[textureNo], primCounter, textureNo);
|
||||||
TRACE("Saving texture %s\n", buffer);
|
TRACE("Saving texture %s\n", buffer);
|
||||||
|
|
|
@ -257,7 +257,7 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
|
||||||
FIXME("Releasing primary stateblock\n");
|
FIXME("Releasing primary stateblock\n");
|
||||||
|
|
||||||
/* NOTE: according to MSDN: The application is responsible for making sure the texture references are cleared down */
|
/* NOTE: according to MSDN: The application is responsible for making sure the texture references are cleared down */
|
||||||
for (counter = 0; counter < GL_LIMITS(sampler_stages); counter++) {
|
for (counter = 0; counter < MAX_SAMPLERS; counter++) {
|
||||||
if (This->textures[counter]) {
|
if (This->textures[counter]) {
|
||||||
/* release our 'internal' hold on the texture */
|
/* release our 'internal' hold on the texture */
|
||||||
if(0 != IWineD3DBaseTexture_Release(This->textures[counter])) {
|
if(0 != IWineD3DBaseTexture_Release(This->textures[counter])) {
|
||||||
|
@ -584,7 +584,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Texture states */
|
/* Texture states */
|
||||||
for (j = 0; j < GL_LIMITS(texture_stages); j++) {
|
for (j = 0; j < MAX_TEXTURES; j++) {
|
||||||
/* TODO: move over to using memcpy */
|
/* TODO: move over to using memcpy */
|
||||||
for (i = 1; i <= WINED3D_HIGHEST_TEXTURE_STATE ; i++) {
|
for (i = 1; i <= WINED3D_HIGHEST_TEXTURE_STATE ; i++) {
|
||||||
if (This->set.textureState[j][i]) {
|
if (This->set.textureState[j][i]) {
|
||||||
|
@ -597,7 +597,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||||
|
|
||||||
/* Samplers */
|
/* Samplers */
|
||||||
/* TODO: move over to using memcpy */
|
/* TODO: move over to using memcpy */
|
||||||
for (j = 0; j < GL_LIMITS(sampler_stages); j++) {
|
for (j = 0; j < MAX_SAMPLERS; j++) {
|
||||||
if (This->set.textures[j]) {
|
if (This->set.textures[j]) {
|
||||||
TRACE("Updating texture %d to %p (was %p)\n", j, targetStateBlock->textures[j], This->textures[j]);
|
TRACE("Updating texture %d to %p (was %p)\n", j, targetStateBlock->textures[j], This->textures[j]);
|
||||||
This->textures[j] = targetStateBlock->textures[j];
|
This->textures[j] = targetStateBlock->textures[j];
|
||||||
|
@ -753,7 +753,7 @@ should really perform a delta so that only the changes get updated*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Texture states */
|
/* Texture states */
|
||||||
for (j = 0; j < GL_LIMITS(texture_stages); j++) { /* Set The texture first, just in case it resets the states? */
|
for (j = 0; j < MAX_TEXTURES; j++) { /* Set The texture first, just in case it resets the states? */
|
||||||
/* TODO: move over to memcpy */
|
/* TODO: move over to memcpy */
|
||||||
for (i = 1; i <= WINED3D_HIGHEST_TEXTURE_STATE; i++) {
|
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->set.textureState[j][i] && This->changed.textureState[j][i]) { /* tb_dx9_10 failes without this test */
|
||||||
|
@ -768,7 +768,7 @@ should really perform a delta so that only the changes get updated*/
|
||||||
|
|
||||||
/* Samplers */
|
/* Samplers */
|
||||||
/* TODO: move over to memcpy */
|
/* TODO: move over to memcpy */
|
||||||
for (j = 0 ; j < GL_LIMITS(sampler_stages); j++){
|
for (j = 0 ; j < MAX_SAMPLERS; j++){
|
||||||
if (This->set.textures[j] && This->changed.textures[j]) {
|
if (This->set.textures[j] && This->changed.textures[j]) {
|
||||||
IWineD3DDevice_SetTexture(pDevice, j, This->textures[j]);
|
IWineD3DDevice_SetTexture(pDevice, j, This->textures[j]);
|
||||||
}
|
}
|
||||||
|
@ -791,14 +791,14 @@ should really perform a delta so that only the changes get updated*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < GL_LIMITS(texture_stages); j++) {
|
for (j = 0; j < MAX_TEXTURES; j++) {
|
||||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_T; i++) {
|
for (i = 0; i < NUM_SAVEDPIXELSTATES_T; i++) {
|
||||||
((IWineD3DDeviceImpl *)pDevice)->stateBlock->textureState[j][SavedPixelStates_T[i]] = This->textureState[j][SavedPixelStates_T[i]];
|
((IWineD3DDeviceImpl *)pDevice)->stateBlock->textureState[j][SavedPixelStates_T[i]] = This->textureState[j][SavedPixelStates_T[i]];
|
||||||
IWineD3DDeviceImpl_MarkStateDirty((IWineD3DDeviceImpl *)pDevice, STATE_TEXTURESTAGE(j, SavedPixelStates_T[i]));
|
IWineD3DDeviceImpl_MarkStateDirty((IWineD3DDeviceImpl *)pDevice, STATE_TEXTURESTAGE(j, SavedPixelStates_T[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < GL_LIMITS(sampler_stages); j++) {
|
for (j = 0; j < MAX_SAMPLERS; j++) {
|
||||||
for (i = 0; i < NUM_SAVEDPIXELSTATES_S; i++) {
|
for (i = 0; i < NUM_SAVEDPIXELSTATES_S; i++) {
|
||||||
((IWineD3DDeviceImpl *)pDevice)->stateBlock->samplerState[j][SavedPixelStates_S[i]] = This->samplerState[j][SavedPixelStates_S[i]];
|
((IWineD3DDeviceImpl *)pDevice)->stateBlock->samplerState[j][SavedPixelStates_S[i]] = This->samplerState[j][SavedPixelStates_S[i]];
|
||||||
}
|
}
|
||||||
|
@ -811,14 +811,14 @@ should really perform a delta so that only the changes get updated*/
|
||||||
IWineD3DDevice_SetRenderState(pDevice, SavedVertexStates_R[i], This->renderState[SavedVertexStates_R[i]]);
|
IWineD3DDevice_SetRenderState(pDevice, SavedVertexStates_R[i], This->renderState[SavedVertexStates_R[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < GL_LIMITS(texture_stages); j++) {
|
for (j = 0; j < MAX_TEXTURES; j++) {
|
||||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_T; i++) {
|
for (i = 0; i < NUM_SAVEDVERTEXSTATES_T; i++) {
|
||||||
((IWineD3DDeviceImpl *)pDevice)->stateBlock->textureState[j][SavedVertexStates_T[i]] = This->textureState[j][SavedVertexStates_T[i]];
|
((IWineD3DDeviceImpl *)pDevice)->stateBlock->textureState[j][SavedVertexStates_T[i]] = This->textureState[j][SavedVertexStates_T[i]];
|
||||||
IWineD3DDeviceImpl_MarkStateDirty((IWineD3DDeviceImpl *)pDevice, STATE_TEXTURESTAGE(j, SavedVertexStates_T[i]));
|
IWineD3DDeviceImpl_MarkStateDirty((IWineD3DDeviceImpl *)pDevice, STATE_TEXTURESTAGE(j, SavedVertexStates_T[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < GL_LIMITS(sampler_stages); j++) {
|
for (j = 0; j < MAX_SAMPLERS; j++) {
|
||||||
for (i = 0; i < NUM_SAVEDVERTEXSTATES_S; i++) {
|
for (i = 0; i < NUM_SAVEDVERTEXSTATES_S; i++) {
|
||||||
((IWineD3DDeviceImpl *)pDevice)->stateBlock->samplerState[j][SavedVertexStates_S[i]] = This->samplerState[j][SavedVertexStates_S[i]];
|
((IWineD3DDeviceImpl *)pDevice)->stateBlock->samplerState[j][SavedVertexStates_S[i]] = This->samplerState[j][SavedVertexStates_S[i]];
|
||||||
}
|
}
|
||||||
|
@ -1015,7 +1015,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
|
||||||
This->clip_status.ClipIntersection = 0xFFFFFFFF;
|
This->clip_status.ClipIntersection = 0xFFFFFFFF;
|
||||||
|
|
||||||
/* Texture Stage States - Put directly into state block, we will call function below */
|
/* Texture Stage States - Put directly into state block, we will call function below */
|
||||||
for (i = 0; i < GL_LIMITS(texture_stages); i++) {
|
for (i = 0; i < MAX_TEXTURES; i++) {
|
||||||
TRACE("Setting up default texture states for texture Stage %d\n", i);
|
TRACE("Setting up default texture states for texture Stage %d\n", i);
|
||||||
memcpy(&This->transforms[WINED3DTS_TEXTURE0 + i], &identity, sizeof(identity));
|
memcpy(&This->transforms[WINED3DTS_TEXTURE0 + i], &identity, sizeof(identity));
|
||||||
This->textureState[i][WINED3DTSS_COLOROP ] = (i==0)? WINED3DTOP_MODULATE : WINED3DTOP_DISABLE;
|
This->textureState[i][WINED3DTSS_COLOROP ] = (i==0)? WINED3DTOP_MODULATE : WINED3DTOP_DISABLE;
|
||||||
|
@ -1040,7 +1040,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
|
||||||
This->lowest_disabled_stage = 1;
|
This->lowest_disabled_stage = 1;
|
||||||
|
|
||||||
/* Sampler states*/
|
/* Sampler states*/
|
||||||
for (i = 0 ; i < GL_LIMITS(sampler_stages); i++) {
|
for (i = 0 ; i < MAX_SAMPLERS; i++) {
|
||||||
TRACE("Setting up default samplers states for sampler %d\n", i);
|
TRACE("Setting up default samplers states for sampler %d\n", i);
|
||||||
This->samplerState[i][WINED3DSAMP_ADDRESSU ] = WINED3DTADDRESS_WRAP;
|
This->samplerState[i][WINED3DSAMP_ADDRESSU ] = WINED3DTADDRESS_WRAP;
|
||||||
This->samplerState[i][WINED3DSAMP_ADDRESSV ] = WINED3DTADDRESS_WRAP;
|
This->samplerState[i][WINED3DSAMP_ADDRESSV ] = WINED3DTADDRESS_WRAP;
|
||||||
|
|
Loading…
Reference in New Issue