Module: wine
Branch: master
Commit: a7e466991009f6b49fa3a71d9b23f308af7f3a7c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a7e466991009f6b49fa3a71d9…
Author: H. Verbeet <hverbeet(a)gmail.com>
Date: Fri Jun 22 20:43:42 2007 +0200
wined3d: Split of the mapping of pixel shader samplers from IWineD3DDeviceImpl_FindTexUnitMap().
---
dlls/wined3d/device.c | 38 +++++++++++++++++---------------------
1 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ff4bfcc..db26348 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3266,8 +3266,22 @@ static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This) {
}
}
+static void device_map_psamplers(IWineD3DDeviceImpl *This) {
+ int i;
+
+ for (i = 0; i < MAX_SAMPLERS; ++i) {
+ if (This->texUnitMap[i] != i) {
+ device_map_stage(This, i, i);
+ IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(i));
+ if (i < MAX_TEXTURES) {
+ markTextureStagesDirty(This, i);
+ }
+ }
+ }
+}
+
void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) {
- DWORD i;
+ BOOL ps = use_ps(This);
/* This code can assume that GL_NV_register_combiners are supported, otherwise
* it is never called.
*
@@ -3276,27 +3290,9 @@ void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) {
* that would be really messy and require shader recompilation
* -> When the mapping of a stage is changed, sampler and ALL texture stage states have
* to be reset. Because of that try to work with a 1:1 mapping as much as possible
- * -> Whith a 1:1 mapping oneToOneTexUnitMap is set to avoid checking MAX_SAMPLERS array
- * entries to make pixel shaders cheaper. MAX_SAMPLERS will be 128 in dx10
*/
- if (This->stateBlock->pixelShader) {
- if(This->oneToOneTexUnitMap) {
- TRACE("Not touching 1:1 map\n");
- return;
- }
- TRACE("Restoring 1:1 texture unit mapping\n");
- /* Restore a 1:1 mapping */
- for(i = 0; i < MAX_SAMPLERS; i++) {
- if(This->texUnitMap[i] != i) {
- device_map_stage(This, i, i);
- IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(i));
- if (i < MAX_TEXTURES) {
- markTextureStagesDirty(This, i);
- }
- }
- }
- This->oneToOneTexUnitMap = TRUE;
- return;
+ if (ps) {
+ device_map_psamplers(This);
} else {
device_map_fixed_function_samplers(This);
}
Module: wine
Branch: master
Commit: 10ffa291e2751a1de75ebc0f389a83256f8b3d3f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=10ffa291e2751a1de75ebc0f3…
Author: H. Verbeet <hverbeet(a)gmail.com>
Date: Fri Jun 22 20:43:38 2007 +0200
wined3d: Remove the sharing of mapping code for fixed function and pixel shader samplers.
---
dlls/wined3d/device.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index dc5343b..ff4bfcc 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3214,6 +3214,19 @@ static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This) {
device_update_fixed_function_usage_map(This);
+ if (This->stateBlock->lowest_disabled_stage <= GL_LIMITS(textures)) {
+ for (i = 0; i < MAX_SAMPLERS; ++i) {
+ if (This->texUnitMap[i] != i) {
+ device_map_stage(This, i, i);
+ IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(i));
+ if (i < MAX_TEXTURES) {
+ markTextureStagesDirty(This, i);
+ }
+ }
+ }
+ return;
+ }
+
/* 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
*/
@@ -3266,7 +3279,7 @@ void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) {
* -> Whith a 1:1 mapping oneToOneTexUnitMap is set to avoid checking MAX_SAMPLERS array
* entries to make pixel shaders cheaper. MAX_SAMPLERS will be 128 in dx10
*/
- if(This->stateBlock->pixelShader || This->stateBlock->lowest_disabled_stage <= GL_LIMITS(textures)) {
+ if (This->stateBlock->pixelShader) {
if(This->oneToOneTexUnitMap) {
TRACE("Not touching 1:1 map\n");
return;
Module: wine
Branch: master
Commit: 2aa891c17572d7cda8353a81a4699f14fbbe6054
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2aa891c17572d7cda8353a81a…
Author: H. Verbeet <hverbeet(a)gmail.com>
Date: Fri Jun 22 20:43:29 2007 +0200
wined3d: Split of the mapping of fixed function samplers from IWineD3DDeviceImpl_FindTexUnitMap().
---
dlls/wined3d/device.c | 85 ++++++++++++++++++++++++++----------------------
1 files changed, 46 insertions(+), 39 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 23beae5..dc5343b 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3209,8 +3209,52 @@ static void device_update_fixed_function_usage_map(IWineD3DDeviceImpl *This) {
}
}
+static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This) {
+ int i, tex;
+
+ 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->fixed_function_usage_map[i]) ++tex;
+ }
+
+ if (GL_LIMITS(textures) + tex < This->stateBlock->lowest_disabled_stage) {
+ FIXME("Too many bound textures to support the combiner settings\n");
+ return;
+ }
+
+ /* Now work out the mapping */
+ tex = 0;
+ This->oneToOneTexUnitMap = FALSE;
+ WARN("Non 1:1 mapping UNTESTED!\n");
+ for (i = 0; i < This->stateBlock->lowest_disabled_stage; ++i) {
+ /* Skip NULL textures */
+ 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);
+ device_map_stage(This, i, -1);
+
+ continue;
+ }
+
+ TRACE("Mapping texture stage %d to unit %d\n", i, tex);
+ if (This->texUnitMap[i] != tex) {
+ device_map_stage(This, i, tex);
+ IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(i));
+ markTextureStagesDirty(This, i);
+ }
+
+ ++tex;
+ }
+}
+
void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) {
- DWORD i, tex;
+ DWORD i;
/* This code can assume that GL_NV_register_combiners are supported, otherwise
* it is never called.
*
@@ -3241,44 +3285,7 @@ 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->fixed_function_usage_map[i]) ++tex;
- }
-
- if(GL_LIMITS(textures) + tex < This->stateBlock->lowest_disabled_stage) {
- FIXME("Too many bound textures to support the combiner settings\n");
- return;
- }
-
- /* Now work out the mapping */
- tex = 0;
- This->oneToOneTexUnitMap = FALSE;
- WARN("Non 1:1 mapping UNTESTED!\n");
- for(i = 0; i < This->stateBlock->lowest_disabled_stage; i++) {
- /* Skip NULL textures */
- 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);
- device_map_stage(This, i, -1);
-
- continue;
- }
-
- TRACE("Mapping texture stage %d to unit %d\n", i, tex);
- if(This->texUnitMap[i] != tex) {
- device_map_stage(This, i, tex);
- IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(i));
- markTextureStagesDirty(This, i);
- }
-
- ++tex;
- }
+ device_map_fixed_function_samplers(This);
}
}