summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/pixelshader9.h
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2015-05-11 21:32:57 +0200
committerAxel Davy <[email protected]>2015-08-21 22:21:47 +0200
commit69de5d626f2e67e74e4de94ce13f7ac50fa52161 (patch)
tree40f314701d177f3a1b0705d8f7ce94dfc8b2aa65 /src/gallium/state_trackers/nine/pixelshader9.h
parent854778ea0fea474eea0c984f1c0fc32aed91f10e (diff)
st/nine: Rework shader states
Separate state setting and commit Changes how the shader key is computed Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/pixelshader9.h')
-rw-r--r--src/gallium/state_trackers/nine/pixelshader9.h41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/nine/pixelshader9.h b/src/gallium/state_trackers/nine/pixelshader9.h
index fc0a9a29687..69eb87b2e27 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.h
+++ b/src/gallium/state_trackers/nine/pixelshader9.h
@@ -25,6 +25,8 @@
#include "iunknown.h"
#include "nine_shader.h"
+#include "nine_state.h"
+#include "basetexture9.h"
struct nine_lconstf;
@@ -46,6 +48,12 @@ struct NinePixelShader9
uint8_t rt_mask;
uint64_t ff_key[6];
+ void *ff_cso;
+
+ uint32_t last_key;
+ void *last_cso;
+
+ uint32_t next_key;
};
static inline struct NinePixelShader9 *
NinePixelShader9( void *data )
@@ -53,9 +61,38 @@ NinePixelShader9( void *data )
return (struct NinePixelShader9 *)data;
}
+static inline BOOL
+NinePixelShader9_UpdateKey( struct NinePixelShader9 *ps,
+ struct nine_state *state )
+{
+ uint16_t samplers_shadow;
+ uint32_t samplers_ps1_types;
+ uint32_t key;
+ BOOL res;
+
+ if (unlikely(ps->byte_code.version < 0x20)) {
+ /* no depth textures, but variable targets */
+ uint32_t m = ps->sampler_mask;
+ samplers_ps1_types = 0;
+ while (m) {
+ int s = ffs(m) - 1;
+ m &= ~(1 << s);
+ samplers_ps1_types |= (state->texture[s] ? state->texture[s]->pstype : 1) << (s * 2);
+ }
+ key = samplers_ps1_types;
+ } else {
+ samplers_shadow = (uint16_t)((state->samplers_shadow & NINE_PS_SAMPLERS_MASK) >> NINE_SAMPLER_PS(0));
+ key = samplers_shadow & ps->sampler_mask;
+ }
+
+ res = ps->last_key != key;
+ if (res)
+ ps->next_key = key;
+ return res;
+}
+
void *
-NinePixelShader9_GetVariant( struct NinePixelShader9 *vs,
- uint32_t key );
+NinePixelShader9_GetVariant( struct NinePixelShader9 *ps );
/*** public ***/