diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/state_trackers/nine/nine_ff.c | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_ff.h | 24 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/nine_shader.h | 2 | ||||
-rw-r--r-- | src/gallium/state_trackers/nine/pixelshader9.h | 4 |
4 files changed, 24 insertions, 8 deletions
diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c index 85d75d6b2ec..4ef258c876d 100644 --- a/src/gallium/state_trackers/nine/nine_ff.c +++ b/src/gallium/state_trackers/nine/nine_ff.c @@ -1819,7 +1819,7 @@ nine_ff_get_ps(struct NineDevice9 *device) if (s >= 1) key.ts[s-1].resultarg = 0; - key.projected = nine_ff_get_projected_key(context); + key.projected = nine_ff_get_projected_key_ff(context); key.specular = !!context->rs[D3DRS_SPECULARENABLE]; for (; s < 8; ++s) diff --git a/src/gallium/state_trackers/nine/nine_ff.h b/src/gallium/state_trackers/nine/nine_ff.h index 4d51c3d6ecb..5345b99dbb5 100644 --- a/src/gallium/state_trackers/nine/nine_ff.h +++ b/src/gallium/state_trackers/nine/nine_ff.h @@ -62,11 +62,11 @@ nine_decltype_get_dim(BYTE type) } 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) { @@ -74,13 +74,13 @@ nine_ff_get_projected_key(struct nine_context *context) 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); @@ -107,4 +107,20 @@ nine_ff_get_projected_key(struct nine_context *context) 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_ */ diff --git a/src/gallium/state_trackers/nine/nine_shader.h b/src/gallium/state_trackers/nine/nine_shader.h index 8b5be52de09..7921e455f88 100644 --- a/src/gallium/state_trackers/nine/nine_shader.h +++ b/src/gallium/state_trackers/nine/nine_shader.h @@ -69,7 +69,7 @@ struct nine_shader_info 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 */ diff --git a/src/gallium/state_trackers/nine/pixelshader9.h b/src/gallium/state_trackers/nine/pixelshader9.h index b616d9d7dee..b4c990bab89 100644 --- a/src/gallium/state_trackers/nine/pixelshader9.h +++ b/src/gallium/state_trackers/nine/pixelshader9.h @@ -77,7 +77,7 @@ NinePixelShader9_UpdateKey( struct NinePixelShader9 *ps, { uint16_t samplers_shadow; uint16_t samplers_ps1_types; - uint16_t projected; + uint8_t projected; uint64_t key; BOOL res; @@ -115,7 +115,7 @@ NinePixelShader9_UpdateKey( struct NinePixelShader9 *ps, 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; } |