Commit d344162f authored by Oliver Stieber's avatar Oliver Stieber Committed by Alexandre Julliard

Separate the setting of the DirectX texture and sampler states from

the setting of OpenGL states (now in applyTextureStateState and applySamplerState).
parent 71a03671
......@@ -1578,6 +1578,10 @@ void inline drawPrimitiveTraceDataLocations(Direct3DVertexStridedData *dataLocat
}
/* loads any dirty textures and returns true if any of the textures are nonpower2 */
BOOL inline drawPrimitiveUploadDirtyTextures(IWineD3DDeviceImpl* This) {
BOOL nonPower2 = FALSE;
unsigned int i;
/**
* OK, here we clear down any old junk iect in the context
* enable the new texture and apply any state changes:
......@@ -1589,9 +1593,6 @@ void inline drawPrimitiveTraceDataLocations(Direct3DVertexStridedData *dataLocat
* enable and bind the texture that is bound to that unit.
* otherwise dissable all texture types on that unit.
**/
BOOL inline drawPrimitiveUploadDirtyTextures(IWineD3DDeviceImpl* This) {
BOOL nonPower2 = FALSE;
unsigned int i;
/* upload the textures */
for (i = 0; i< GL_LIMITS(textures); ++i) {
/* Bind the texture to the stage here */
......@@ -1653,7 +1654,7 @@ BOOL inline drawPrimitiveUploadDirtyTextures(IWineD3DDeviceImpl* This) {
glEnable(GL_TEXTURE_1D);
This->stateBlock->textureDimensions[i] = GL_TEXTURE_1D;
glBindTexture(GL_TEXTURE_1D, This->dummyTextureName[i]);
}
}
/** these ops apply to the texture unit, so they are preseved between texture changes, but for now brute force and reapply all
dx9_1pass_emboss_bump_mapping and dx9_2pass_emboss_bump_mapping are good texts to make sure the states are being applied when needed **/
set_tex_op((IWineD3DDevice *)This, FALSE, i, This->stateBlock->textureState[i][WINED3DTSS_COLOROP],
......
......@@ -284,16 +284,11 @@ HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface){
/* FIXME: textures are upto MAX_SAMPLERS for d3d9? */
/* Texture */
for (j = 0; j < GL_LIMITS(textures); j++) {
/* TODO: move over to using memcpy */
for (i = 1; i <= WINED3D_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];
}
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];
}
if ((This->set.textures[j] && (This->textures[j] != targetStateBlock->textures[j]))) {
......@@ -304,15 +299,13 @@ HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface){
}
/* Samplers */
/* TODO: move over to using memcpy */
for (j = 0 ; j < GL_LIMITS(samplers); j++){
for (i = 1; i <= WINED3D_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("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];
}
}
}
......@@ -423,19 +416,17 @@ should really perform a delta so that only the changes get updated*/
if (This->set.textures[j] && This->changed.textures[j]) {
IWineD3DDevice_SetTexture(pDevice, j, This->textures[j]);
}
/* 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]) {
IWineD3DDevice_SetTextureStageState(pDevice, j, i, This->textureState[j][i]);
}
((IWineD3DDeviceImpl *)pDevice)->stateBlock->textureState[j][i] = This->textureState[j][i];
}
}
/* Samplers */
/* TODO: move over to memcpy */
for (j = 0 ; j < GL_LIMITS(samplers); j++){
for (i = 1; i <= WINED3D_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]);
}
((IWineD3DDeviceImpl *)pDevice)->stateBlock->samplerState[j][i] = This->samplerState[j][i];
}
}
......@@ -450,9 +441,13 @@ should really perform a delta so that only the changes get updated*/
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]]);
((IWineD3DDeviceImpl *)pDevice)->stateBlock->textureState[j][SavedPixelStates_T[i]] = This->textureState[j][SavedPixelStates_T[i]];
}
}
for (j = 0; j < GL_LIMITS(samplers); i++) {
for (i = 0; i < NUM_SAVEDPIXELSTATES_S; i++) {
((IWineD3DDeviceImpl *)pDevice)->stateBlock->samplerState[j][SavedPixelStates_S[i]] = This->samplerState[j][SavedPixelStates_S[i]];
}
}
......@@ -465,9 +460,13 @@ should really perform a delta so that only the changes get updated*/
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]]);
((IWineD3DDeviceImpl *)pDevice)->stateBlock->samplerState[j][SavedVertexStates_T[i]] = This->textureState[j][SavedVertexStates_T[i]];
}
}
for (j = 0; j < GL_LIMITS(textures); i++) {
for (i = 0; i < NUM_SAVEDVERTEXSTATES_S; i++) {
((IWineD3DDeviceImpl *)pDevice)->stateBlock->samplerState[j][SavedVertexStates_S[i]] = This->textureState[j][SavedVertexStates_S[i]];
}
}
......
......@@ -1499,8 +1499,6 @@ void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords)
} else if(!calculatedCoords) { /* under directx the R/Z coord can be used for translation, under opengl we use the Q coord instead */
mat[12] = mat[8];
mat[13] = mat[9];
mat[8] = 0;
mat[9] = 0;
}
glLoadMatrixf(mat);
......
......@@ -784,9 +784,11 @@ typedef struct SAVEDSTATES {
BOOL transform[HIGHEST_TRANSFORMSTATE + 1];
BOOL viewport;
BOOL renderState[WINEHIGHEST_RENDER_STATE + 1];
#if 0
BOOL textureState[MAX_TEXTURES][WINED3D_HIGHEST_TEXTURE_STATE + 1];
BOOL clipplane[MAX_CLIPPLANES];
BOOL samplerState[MAX_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
#endif
BOOL clipplane[MAX_CLIPPLANES];
BOOL vertexDecl;
BOOL pixelShader;
BOOL vertexShader;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment