Commit b1579b37 authored by H. Verbeet's avatar H. Verbeet Committed by Alexandre Julliard

wined3d: Keep track of what fixed function texture stages are in use.

parent b928cadd
......@@ -3201,6 +3201,14 @@ static void device_map_stage(IWineD3DDeviceImpl *This, int stage, int unit) {
}
}
static void device_update_fixed_function_usage_map(IWineD3DDeviceImpl *This) {
int i;
for (i = 0; i < MAX_TEXTURES; ++i) {
This->fixed_function_usage_map[i] = This->stateBlock->textures[i] ? TRUE : FALSE;
}
}
void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) {
DWORD i, tex;
/* This code can assume that GL_NV_register_combiners are supported, otherwise
......@@ -3233,12 +3241,13 @@ void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) {
This->oneToOneTexUnitMap = TRUE;
return;
} else {
device_update_fixed_function_usage_map(This);
/* No pixel shader, and we do not have enough texture units available. Try to skip NULL textures
* First, see if we can succeed at all
*/
tex = 0;
for(i = 0; i < This->stateBlock->lowest_disabled_stage; i++) {
if(This->stateBlock->textures[i] == NULL) tex++;
if (!This->fixed_function_usage_map[i]) ++tex;
}
if(GL_LIMITS(textures) + tex < This->stateBlock->lowest_disabled_stage) {
......@@ -3252,7 +3261,7 @@ void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) {
WARN("Non 1:1 mapping UNTESTED!\n");
for(i = 0; i < This->stateBlock->lowest_disabled_stage; i++) {
/* Skip NULL textures */
if (!This->stateBlock->textures[i]) {
if (!This->fixed_function_usage_map[i]) {
/* Map to -1, so the check below doesn't fail if a non-NULL
* texture is set on this stage */
TRACE("Mapping texture stage %d to -1\n", i);
......
......@@ -724,6 +724,7 @@ struct IWineD3DDeviceImpl
/* With register combiners we can skip junk texture stages */
DWORD texUnitMap[MAX_SAMPLERS];
DWORD rev_tex_unit_map[MAX_SAMPLERS];
BOOL fixed_function_usage_map[MAX_TEXTURES];
BOOL oneToOneTexUnitMap;
/* Stream source management */
......
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