[Mesa-dev] [PATCH 08/43] st/nine: Commit sampler views again if srgb state changed.

Axel Davy axel.davy at ens.fr
Fri Jan 30 12:34:07 PST 2015


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.

Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/device9.c    | 3 +++
 src/gallium/state_trackers/nine/nine_state.c | 5 +++--
 src/gallium/state_trackers/nine/nine_state.h | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 656f488..b7e83a4 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -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;
 }
 
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index dad6651..972ed1f 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -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;
 }
 
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index 028e57d..6e94e68 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -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];
-- 
2.1.0



More information about the mesa-dev mailing list