wined3d: Split of the mapping of pixel shader samplers from IWineD3DDeviceImpl_FindTexUnitMap().
This commit is contained in:
parent
10ffa291e2
commit
a7e4669910
|
@ -3266,27 +3266,10 @@ static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This) {
|
|||
}
|
||||
}
|
||||
|
||||
void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) {
|
||||
DWORD i;
|
||||
/* This code can assume that GL_NV_register_combiners are supported, otherwise
|
||||
* it is never called.
|
||||
*
|
||||
* Rules are:
|
||||
* -> Pixel shaders need a 1:1 map. In theory the shader input could be mapped too, but
|
||||
* 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++) {
|
||||
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));
|
||||
|
@ -3295,8 +3278,21 @@ void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) {
|
|||
}
|
||||
}
|
||||
}
|
||||
This->oneToOneTexUnitMap = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
void IWineD3DDeviceImpl_FindTexUnitMap(IWineD3DDeviceImpl *This) {
|
||||
BOOL ps = use_ps(This);
|
||||
/* This code can assume that GL_NV_register_combiners are supported, otherwise
|
||||
* it is never called.
|
||||
*
|
||||
* Rules are:
|
||||
* -> Pixel shaders need a 1:1 map. In theory the shader input could be mapped too, but
|
||||
* 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
|
||||
*/
|
||||
if (ps) {
|
||||
device_map_psamplers(This);
|
||||
} else {
|
||||
device_map_fixed_function_samplers(This);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue