wined3d: Optimize transform state in stateblocks.
This commit is contained in:
parent
b56afd0cff
commit
92ce028a0b
|
@ -469,7 +469,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface,
|
||||||
for(j = 1; j <= WINEHIGHEST_RENDER_STATE; j++) {
|
for(j = 1; j <= WINEHIGHEST_RENDER_STATE; j++) {
|
||||||
object->contained_render_states[j - 1] = j;
|
object->contained_render_states[j - 1] = j;
|
||||||
}
|
}
|
||||||
object->num_contained_render_states = WINEHIGHEST_RENDER_STATE;
|
/* TODO: Filter unused transforms between TEXTURE8 and WORLD0? */
|
||||||
|
for(j = 1; j <= HIGHEST_TRANSFORMSTATE; j++) {
|
||||||
|
object->contained_transform_states[j - 1] = j;
|
||||||
|
}
|
||||||
|
object->num_contained_transform_states = HIGHEST_TRANSFORMSTATE;
|
||||||
|
|
||||||
} else if (Type == WINED3DSBT_PIXELSTATE) {
|
} else if (Type == WINED3DSBT_PIXELSTATE) {
|
||||||
|
|
||||||
|
@ -4324,6 +4328,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IW
|
||||||
object->num_contained_render_states++;
|
object->num_contained_render_states++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(i = 1; i <= HIGHEST_TRANSFORMSTATE; i++) {
|
||||||
|
if(object->changed.transform[i]) {
|
||||||
|
object->contained_transform_states[object->num_contained_transform_states] = i;
|
||||||
|
object->num_contained_transform_states++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*ppStateBlock = (IWineD3DStateBlock*) object;
|
*ppStateBlock = (IWineD3DStateBlock*) object;
|
||||||
This->isRecordingState = FALSE;
|
This->isRecordingState = FALSE;
|
||||||
|
|
|
@ -485,13 +485,11 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Others + Render & Texture */
|
/* Others + Render & Texture */
|
||||||
for (i = 1; i <= HIGHEST_TRANSFORMSTATE; i++) {
|
for (i = 0; i < This->num_contained_transform_states; i++) {
|
||||||
if (This->changed.transform[i] && memcmp(&targetStateBlock->transforms[i],
|
TRACE("Updating transform %d\n", i);
|
||||||
&This->transforms[i],
|
memcpy(&This->transforms[This->contained_transform_states[i]],
|
||||||
sizeof(WINED3DMATRIX)) != 0) {
|
&targetStateBlock->transforms[This->contained_transform_states[i]],
|
||||||
TRACE("Updating transform %d\n", i);
|
sizeof(WINED3DMATRIX));
|
||||||
memcpy(&This->transforms[i], &targetStateBlock->transforms[i], sizeof(WINED3DMATRIX));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This->changed.indices && ((This->pIndexData != targetStateBlock->pIndexData)
|
if (This->changed.indices && ((This->pIndexData != targetStateBlock->pIndexData)
|
||||||
|
@ -695,9 +693,9 @@ should really perform a delta so that only the changes get updated*/
|
||||||
|
|
||||||
/* Others + Render & Texture */
|
/* Others + Render & Texture */
|
||||||
if (/*TODO: 'magic' statetype, replace with BOOL This->blockType == D3DSBT_RECORDED || */ This->blockType == WINED3DSBT_ALL || This->blockType == WINED3DSBT_INIT) {
|
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++) {
|
for (i = 0; i < This->num_contained_transform_states; i++) {
|
||||||
if (This->changed.transform[i])
|
IWineD3DDevice_SetTransform(pDevice, This->contained_transform_states[i],
|
||||||
IWineD3DDevice_SetTransform(pDevice, i, &This->transforms[i]);
|
&This->transforms[This->contained_transform_states[i]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (This->changed.indices) {
|
if (This->changed.indices) {
|
||||||
|
|
|
@ -1369,6 +1369,8 @@ struct IWineD3DStateBlockImpl
|
||||||
/* Contained state management */
|
/* Contained state management */
|
||||||
DWORD contained_render_states[WINEHIGHEST_RENDER_STATE + 1];
|
DWORD contained_render_states[WINEHIGHEST_RENDER_STATE + 1];
|
||||||
unsigned int num_contained_render_states;
|
unsigned int num_contained_render_states;
|
||||||
|
DWORD contained_transform_states[WINEHIGHEST_RENDER_STATE + 1];
|
||||||
|
unsigned int num_contained_transform_states;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern void stateblock_savedstates_set(
|
extern void stateblock_savedstates_set(
|
||||||
|
|
Loading…
Reference in New Issue