H. Verbeet : wined3d:
Keep track of what fixed function texture stages are in use.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 25 07:28:06 CDT 2007
Module: wine
Branch: master
Commit: b1579b37ea2d3a314dac87a98a3bc9c55fb22dbe
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b1579b37ea2d3a314dac87a98a3bc9c55fb22dbe
Author: H. Verbeet <hverbeet at gmail.com>
Date: Fri Jun 22 20:43:24 2007 +0200
wined3d: Keep track of what fixed function texture stages are in use.
---
dlls/wined3d/device.c | 13 +++++++++++--
dlls/wined3d/wined3d_private.h | 1 +
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0b02dd2..23beae5 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -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);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index efa8f7b..2710669 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -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 */
More information about the wine-cvs
mailing list