st/nine: Enforce centroid for color input when multisampling is on

The color inputs must automatically use centroid whether
multisampling is used or not.

Signed-off-by: Axel Davy <axel.davy@ens.fr>
Reviewed-by: Patrick Rudolph <siro@das-labor.org>
This commit is contained in:
Axel Davy 2016-01-09 14:16:15 +01:00
parent d5389bb92d
commit 24ddadbba9
4 changed files with 15 additions and 4 deletions

View file

@ -875,9 +875,12 @@ tx_src_param(struct shader_translator *tx, const struct sm1_src_param *param)
} else {
if (tx->version.major < 3) {
assert(!param->rel);
src = ureg_DECL_fs_input(tx->ureg, TGSI_SEMANTIC_COLOR,
param->idx,
TGSI_INTERPOLATE_COLOR);
src = ureg_DECL_fs_input_cyl_centroid(
ureg, TGSI_SEMANTIC_COLOR, param->idx,
TGSI_INTERPOLATE_COLOR, 0,
tx->info->force_color_in_centroid ?
TGSI_INTERPOLATE_LOC_CENTROID : 0,
0, 1);
} else {
assert(!param->rel); /* TODO */
assert(param->idx < Elements(tx->regs.v));
@ -2045,7 +2048,8 @@ DECL_SPECIAL(DCL)
unsigned interp_location = 0;
/* SM3 only, SM2 input semantic determined by file */
assert(sem.reg.idx < Elements(tx->regs.v));
if (sem.reg.mod & NINED3DSPDM_CENTROID)
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,

View file

@ -61,6 +61,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 */
unsigned const_i_base; /* in vec4 (16 byte) units */

View file

@ -160,6 +160,7 @@ NinePixelShader9_GetVariant( struct NinePixelShader9 *This )
info.sampler_ps1xtypes = key;
info.fog_enable = device->state.rs[D3DRS_FOGENABLE];
info.fog_mode = device->state.rs[D3DRS_FOGTABLEMODE];
info.force_color_in_centroid = key >> 34 & 1;
info.projected = (key >> 48) & 0xffff;
hr = nine_translate_shader(This->base.device, &info);

View file

@ -28,6 +28,7 @@
#include "nine_state.h"
#include "basetexture9.h"
#include "nine_ff.h"
#include "surface9.h"
struct nine_lconstf;
@ -92,6 +93,10 @@ NinePixelShader9_UpdateKey( struct NinePixelShader9 *ps,
key |= ((uint64_t)state->rs[D3DRS_FOGTABLEMODE]) << 33;
}
/* centroid interpolation automatically used for color ps inputs */
if (state->rt[0]->desc.MultiSampleType > 1)
key |= ((uint64_t)1) << 34;
if (unlikely(ps->byte_code.version < 0x14)) {
projected = nine_ff_get_projected_key(state);
key |= ((uint64_t) projected) << 48;