summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2019-01-13 22:25:46 +0100
committerAxel Davy <[email protected]>2019-04-30 19:18:51 +0200
commit3717ec415779746b66b47a0dda28c2c5ea9fcef8 (patch)
tree2e145ed7c47a1bb40e5f565b725f5bbabe6ff88a /src
parent2acbd977d793fe8f2886b1f6f9b9c7f793a675b5 (diff)
st/nine: Compact pixel shader key
Compact the shader key to make room for new elements. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/state_trackers/nine/pixelshader9.c19
-rw-r--r--src/gallium/state_trackers/nine/pixelshader9.h27
2 files changed, 31 insertions, 15 deletions
diff --git a/src/gallium/state_trackers/nine/pixelshader9.c b/src/gallium/state_trackers/nine/pixelshader9.c
index 8db4b6e5c37..127d56161bf 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.c
+++ b/src/gallium/state_trackers/nine/pixelshader9.c
@@ -178,13 +178,24 @@ NinePixelShader9_GetVariant( struct NinePixelShader9 *This )
info.const_b_base = NINE_CONST_B_BASE(device->max_ps_const_f) / 16;
info.byte_code = This->byte_code.tokens;
info.sampler_mask_shadow = key & 0xffff;
- info.sampler_ps1xtypes = (key >> 16) & 0xffff;
+ /* intended overlap with sampler_mask_shadow */
+ if (unlikely(This->byte_code.version < 0x20)) {
+ if (This->byte_code.version < 0x14) {
+ info.sampler_ps1xtypes = (key >> 4) & 0xff;
+ info.projected = (key >> 12) & 0xff;
+ } else {
+ info.sampler_ps1xtypes = (key >> 6) & 0xfff;
+ info.projected = 0;
+ }
+ } else {
+ info.sampler_ps1xtypes = 0;
+ info.projected = 0;
+ }
info.fog_enable = device->context.rs[D3DRS_FOGENABLE];
info.fog_mode = device->context.rs[D3DRS_FOGTABLEMODE];
- info.force_color_in_centroid = key >> 34 & 1;
- info.projected = (key >> 48) & 0xffff;
+ info.force_color_in_centroid = (key >> 22) & 1;
info.add_constants_defs.c_combination =
- nine_shader_constant_combination_get(This->c_combinations, (key >> 40) & 0xff);
+ nine_shader_constant_combination_get(This->c_combinations, (key >> 24) & 0xff);
info.add_constants_defs.int_const_added = &This->int_slots_used;
info.add_constants_defs.bool_const_added = &This->bool_slots_used;
info.process_vertices = false;
diff --git a/src/gallium/state_trackers/nine/pixelshader9.h b/src/gallium/state_trackers/nine/pixelshader9.h
index b4c990bab89..d864eca15a4 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.h
+++ b/src/gallium/state_trackers/nine/pixelshader9.h
@@ -94,30 +94,35 @@ NinePixelShader9_UpdateKey( struct NinePixelShader9 *ps,
samplers_ps1_types |= (context->texture[s].enabled ? context->texture[s].pstype : 1) << (s * 2);
}
/* Note: For ps 1.X, only samplers 0 1 2 and 3 are available (except 1.4 where 4 and 5 are available).
- * Thus there is no overflow of samplers_ps1_types. */
- key |= samplers_ps1_types << 16;
+ * ps < 1.4: samplers_shadow 4b, samplers_ps1_types 8b, projected 8b
+ * ps 1.4: samplers_shadow 6b, samplers_ps1_types 12b
+ * Tot ps X.X samplers_shadow + extra: 20b */
+ assert((ps->byte_code.version < 0x14 && !(ps->sampler_mask & 0xFFF0)) || !(ps->sampler_mask & 0xFFC0));
+
+ if (unlikely(ps->byte_code.version < 0x14)) {
+ key |= samplers_ps1_types << 4;
+ projected = nine_ff_get_projected_key_programmable(context);
+ key |= ((uint64_t) projected) << 12;
+ } else {
+ key |= samplers_ps1_types << 6;
+ }
}
if (ps->byte_code.version < 0x30) {
- key |= ((uint64_t)context->rs[D3DRS_FOGENABLE]) << 32;
- key |= ((uint64_t)context->rs[D3DRS_FOGTABLEMODE]) << 33;
+ key |= ((uint64_t)context->rs[D3DRS_FOGENABLE]) << 20;
+ key |= ((uint64_t)context->rs[D3DRS_FOGTABLEMODE]) << 21;
}
/* centroid interpolation automatically used for color ps inputs */
if (context->rt[0]->base.info.nr_samples)
- key |= ((uint64_t)1) << 34;
+ key |= ((uint64_t)1) << 22;
if ((ps->const_int_slots > 0 || ps->const_bool_slots > 0) && context->inline_constants)
key |= ((uint64_t)nine_shader_constant_combination_key(&ps->c_combinations,
ps->int_slots_used,
ps->bool_slots_used,
(void *)context->ps_const_i,
- context->ps_const_b)) << 40;
-
- if (unlikely(ps->byte_code.version < 0x14)) {
- projected = nine_ff_get_projected_key_programmable(context);
- key |= ((uint64_t) projected) << 48;
- }
+ context->ps_const_b)) << 24;
res = ps->last_key != key;
if (res)