st/nine: Commit sampler views again if srgb state changed.
authorAxel Davy <axel.davy@ens.fr>
Wed, 7 Jan 2015 15:34:12 +0000 (16:34 +0100)
committerAxel Davy <axel.davy@ens.fr>
Thu, 5 Feb 2015 23:07:18 +0000 (00:07 +0100)
This fixes a wine test and some minor visual issues on some games.

The patch is not optimal, there is probably a more efficient way to
fix this issue, but the code there already has some innefficiencies.
There is plans to rewrite that part of the code to make it more
efficient.

Reviewed-by: Tiziano Bacocco <tizbac2@gmail.com>
Signed-off-by: Axel Davy <axel.davy@ens.fr>
src/gallium/state_trackers/nine/device9.c
src/gallium/state_trackers/nine/nine_state.c
src/gallium/state_trackers/nine/nine_state.h

index 656f48860fd94e5fa29b3b3e9e5abdb47af0c9ad..b7e83a4bab9e062954d4961512c80dadbdc01d8d 100644 (file)
@@ -2327,6 +2327,9 @@ NineDevice9_SetSamplerState( struct NineDevice9 *This,
     state->changed.group |= NINE_STATE_SAMPLER;
     state->changed.sampler[Sampler] |= 1 << Type;
 
+    if (Type == D3DSAMP_SRGBTEXTURE)
+        state->changed.srgb = TRUE;
+
     return D3D_OK;
 }
 
index dad665133acc99c39865c4d0bdb78a74a1a06fb3..972ed1f40be128a2d352ecf4d3fc84d5388b9a2b 100644 (file)
@@ -678,7 +678,7 @@ update_textures_and_samplers(struct NineDevice9 *device)
             nine_convert_sampler_state(device->cso, s, state->samp[s]);
         }
     }
-    if (state->changed.texture & NINE_PS_SAMPLERS_MASK)
+    if (state->changed.texture & NINE_PS_SAMPLERS_MASK || state->changed.srgb)
         pipe->set_sampler_views(pipe, PIPE_SHADER_FRAGMENT, 0,
                                 num_textures, view);
 
@@ -708,13 +708,14 @@ update_textures_and_samplers(struct NineDevice9 *device)
             nine_convert_sampler_state(device->cso, s, state->samp[s]);
         }
     }
-    if (state->changed.texture & NINE_VS_SAMPLERS_MASK)
+    if (state->changed.texture & NINE_VS_SAMPLERS_MASK || state->changed.srgb)
         pipe->set_sampler_views(pipe, PIPE_SHADER_VERTEX, 0,
                                 num_textures, view);
 
     if (commit_samplers)
         cso_single_sampler_done(device->cso, PIPE_SHADER_VERTEX);
 
+    state->changed.srgb = FALSE;
     state->changed.texture = 0;
 }
 
index 028e57df264b4126447cbf9092093ba852c9f0f2..6e94e68ef1ed8dc69dec671d7c4ff102b1a06613 100644 (file)
@@ -123,6 +123,7 @@ struct nine_state
         uint16_t vs_const_b; /* NINE_MAX_CONST_B == 16 */
         uint16_t ps_const_b;
         uint8_t ucp;
+        boolean srgb;
     } changed;
 
     struct NineSurface9 *rt[NINE_MAX_SIMULTANEOUS_RENDERTARGETS];