[2/5] wined3d: Keep track of what fixed function texture stages are
in use
H. Verbeet
hverbeet at gmail.com
Fri Jun 22 13:43:24 CDT 2007
Required for assigning vertex texture stages to units, as explained in
the previous patch. The current code simply checks if a texture is set
on a stage and assumes it's used. This patch doesn't change that, but
a later one (not in this set) will use a somewhat more thorough check.
Changelog:
- Keep track of what fixed function texture stages are in use
-------------- next part --------------
---
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 5a9c936..7c99d88 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3231,6 +3231,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
@@ -3263,12 +3271,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) {
@@ -3282,7 +3291,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 9a23783..c1e8a5a 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -722,6 +722,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-patches
mailing list