POSITION0 input is forbidden for PS3.0 apparently. Besides for depth input we weren't using the system value version if needed
Signed-off-by: Axel Davy <axel.d...@ens.fr> --- Could be better having it separated into two patches perhaps. It should get into Mesa 11.2, to prevent regression caused by the introduction of position as system value. src/gallium/state_trackers/nine/nine_shader.c | 44 +++++++++++++++++---------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c index a7a7da2..40f06a8 100644 --- a/src/gallium/state_trackers/nine/nine_shader.c +++ b/src/gallium/state_trackers/nine/nine_shader.c @@ -830,6 +830,18 @@ nine_ureg_dst_register(unsigned file, int index) return ureg_dst(ureg_src_register(file, index)); } +static inline struct ureg_src +nine_get_position_input(struct shader_translator *tx) +{ + struct ureg_program *ureg = tx->ureg; + + if (tx->wpos_is_sysval) + return ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); + else + return ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, + 0, TGSI_INTERPOLATE_LINEAR); +} + static struct ureg_src tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) { @@ -955,16 +967,8 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param) case D3DSPR_MISCTYPE: switch (param->idx) { case D3DSMO_POSITION: - if (ureg_src_is_undef(tx->regs.vPos)) { - if (tx->wpos_is_sysval) { - tx->regs.vPos = - ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); - } else { - tx->regs.vPos = - ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0, - TGSI_INTERPOLATE_LINEAR); - } - } + if (ureg_src_is_undef(tx->regs.vPos)) + tx->regs.vPos = nine_get_position_input(tx); if (tx->shift_wpos) { /* TODO: do this only once */ struct ureg_dst wpos = tx_scratch(tx); @@ -2048,9 +2052,22 @@ DECL_SPECIAL(DCL) unsigned interp_location = 0; /* SM3 only, SM2 input semantic determined by file */ assert(sem.reg.idx < Elements(tx->regs.v)); + + if (tgsi.Name == TGSI_SEMANTIC_POSITION) { + /* Position0/PositionT0 are forbidden (likely because vPos already does that) + * is forbidden. */ + if (sem.usage == D3DDECLUSAGE_POSITION && sem.usage_idx == 0 || + sem.usage == D3DDECLUSAGE_POSITIONT) + return D3DERR_INVALIDCALL; + /* Following code is for depth (PositionT is not possible) */ + tx->regs.v[sem.reg.idx] = nine_get_position_input(tx); + return D3D_OK; + } + if (sem.reg.mod & NINED3DSPDM_CENTROID || (tgsi.Name == TGSI_SEMANTIC_COLOR && tx->info->force_color_in_centroid)) interp_location = TGSI_INTERPOLATE_LOC_CENTROID; + tx->regs.v[sem.reg.idx] = ureg_DECL_fs_input_cyl_centroid( ureg, tgsi.Name, tgsi.Index, nine_tgsi_to_interp_mode(&tgsi), @@ -3269,12 +3286,7 @@ shader_add_ps_fog_stage(struct shader_translator *tx, struct ureg_src src_col) } if (tx->info->fog_mode != D3DFOG_NONE) { - if (tx->wpos_is_sysval) { - depth = ureg_DECL_system_value(ureg, TGSI_SEMANTIC_POSITION, 0); - } else { - depth = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_POSITION, 0, - TGSI_INTERPOLATE_LINEAR); - } + depth = nine_get_position_input(tx); depth = ureg_scalar(depth, TGSI_SWIZZLE_Z); } -- 2.7.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev