}
static inline uint16_t
-nine_ff_get_projected_key(struct nine_context *context)
+nine_ff_get_projected_key(struct nine_context *context, unsigned num_stages)
{
unsigned s, i;
uint16_t projected = 0;
- char input_texture_coord[8];
+ char input_texture_coord[num_stages];
memset(&input_texture_coord, 0, sizeof(input_texture_coord));
if (context->vdecl) {
uint16_t usage = context->vdecl->usage_map[i];
if (usage % NINE_DECLUSAGE_COUNT == NINE_DECLUSAGE_TEXCOORD) {
s = usage / NINE_DECLUSAGE_COUNT;
- if (s < 8)
+ if (s < num_stages)
input_texture_coord[s] = nine_decltype_get_dim(context->vdecl->decls[i].Type);
}
}
}
- for (s = 0; s < 8; ++s) {
+ for (s = 0; s < num_stages; ++s) {
unsigned gen = (context->ff.tex_stage[s][D3DTSS_TEXCOORDINDEX] >> 16) + 1;
unsigned dim = context->ff.tex_stage[s][D3DTSS_TEXTURETRANSFORMFLAGS] & 0x7;
unsigned proj = !!(context->ff.tex_stage[s][D3DTSS_TEXTURETRANSFORMFLAGS] & D3DTTFF_PROJECTED);
return projected;
}
+static inline uint16_t
+nine_ff_get_projected_key_ff(struct nine_context *context)
+{
+ /* 8 stages */
+ return nine_ff_get_projected_key(context, 8);
+}
+
+static inline uint8_t
+nine_ff_get_projected_key_programmable(struct nine_context *context)
+{
+ /* We only look at the 4 stages because this function
+ * is used only for ps 1.1-3, where only the first four
+ * slots are available */
+ return (uint8_t)nine_ff_get_projected_key(context, 4);
+}
+
#endif /* _NINE_FF_H_ */
uint8_t fog_enable;
uint8_t fog_mode;
uint8_t force_color_in_centroid;
- uint16_t projected; /* ps 1.1 to 1.3 */
+ uint8_t projected; /* ps 1.1 to 1.3 */
unsigned const_i_base; /* in vec4 (16 byte) units */
unsigned const_b_base; /* in vec4 (16 byte) units */
{
uint16_t samplers_shadow;
uint16_t samplers_ps1_types;
- uint16_t projected;
+ uint8_t projected;
uint64_t key;
BOOL res;
context->ps_const_b)) << 40;
if (unlikely(ps->byte_code.version < 0x14)) {
- projected = nine_ff_get_projected_key(context);
+ projected = nine_ff_get_projected_key_programmable(context);
key |= ((uint64_t) projected) << 48;
}