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 */
......
......@@ -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];
}
}
if ((This->set.textures[j] && (This->textures[j] != targetStateBlock->textures[j]))) {
......@@ -304,10 +299,9 @@ 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]);
......@@ -315,7 +309,6 @@ HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface){
}
}
}
}
TRACE("(%p) : Updated state block %p ------------------^\n", targetStateBlock, This);
......@@ -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