aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2019-04-09 22:52:28 +0200
committerAxel Davy <[email protected]>2019-04-30 19:18:52 +0200
commit92117c989ca46ec01b58aec630bcca8cab1e8d15 (patch)
treeb0b59ef1bd68fc1371614f758432098da2d2481e /src/gallium
parentbade3bf6153ecf7adda445a50b0b7009f63e367e (diff)
st/nine: Use TGSI_SEMANTIC_GENERIC for fog
We used TGSI_SEMANTIC_FOG for fog, however on vs/ps 3, fog is allowed to have 4 components (even on the ff pipeline according to a wine test). Since gallium's TGSI_SEMANTIC_FOG has only one component, use TGSI_SEMANTIC_GENERIC instead. Fixes: https://github.com/iXit/Mesa-3D/issues/346 Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/nine/nine_ff.c14
-rw-r--r--src/gallium/state_trackers/nine/nine_shader.c43
2 files changed, 29 insertions, 28 deletions
diff --git a/src/gallium/state_trackers/nine/nine_ff.c b/src/gallium/state_trackers/nine/nine_ff.c
index 4ef258c876d..b38205d6100 100644
--- a/src/gallium/state_trackers/nine/nine_ff.c
+++ b/src/gallium/state_trackers/nine/nine_ff.c
@@ -420,7 +420,7 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
oCol[0] = ureg_saturate(ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 0));
oCol[1] = ureg_saturate(ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, 1));
if (key->fog || key->passthrough & (1 << NINE_DECLUSAGE_FOG)) {
- oFog = ureg_DECL_output(ureg, TGSI_SEMANTIC_FOG, 0);
+ oFog = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 16);
oFog = ureg_writemask(oFog, TGSI_WRITEMASK_X);
}
@@ -1000,35 +1000,35 @@ nine_ff_build_vs(struct NineDevice9 *device, struct vs_build_ctx *vs)
struct ureg_src input;
struct ureg_dst output;
input = vs->aWgt;
- output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 18);
+ output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 19);
ureg_MOV(ureg, output, input);
}
if (key->passthrough & (1 << NINE_DECLUSAGE_BLENDINDICES)) {
struct ureg_src input;
struct ureg_dst output;
input = vs->aInd;
- output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 19);
+ output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 20);
ureg_MOV(ureg, output, input);
}
if (key->passthrough & (1 << NINE_DECLUSAGE_NORMAL)) {
struct ureg_src input;
struct ureg_dst output;
input = vs->aNrm;
- output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 20);
+ output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 21);
ureg_MOV(ureg, output, input);
}
if (key->passthrough & (1 << NINE_DECLUSAGE_TANGENT)) {
struct ureg_src input;
struct ureg_dst output;
input = build_vs_add_input(vs, NINE_DECLUSAGE_TANGENT);
- output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 21);
+ output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 22);
ureg_MOV(ureg, output, input);
}
if (key->passthrough & (1 << NINE_DECLUSAGE_BINORMAL)) {
struct ureg_src input;
struct ureg_dst output;
input = build_vs_add_input(vs, NINE_DECLUSAGE_BINORMAL);
- output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 22);
+ output = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 23);
ureg_MOV(ureg, output, input);
}
if (key->passthrough & (1 << NINE_DECLUSAGE_FOG)) {
@@ -1546,7 +1546,7 @@ nine_ff_build_ps(struct NineDevice9 *device, struct nine_ff_ps_key *key)
ureg_MOV(ureg, ureg_writemask(oCol, TGSI_WRITEMASK_W), ps.rCurSrc);
} else
if (key->fog) {
- struct ureg_src vFog = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_FOG, 0, TGSI_INTERPOLATE_PERSPECTIVE);
+ struct ureg_src vFog = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_GENERIC, 16, TGSI_INTERPOLATE_PERSPECTIVE);
ureg_LRP(ureg, ureg_writemask(oCol, TGSI_WRITEMASK_XYZ), _XXXX(vFog), ps.rCurSrc, _CONST(21));
ureg_MOV(ureg, ureg_writemask(oCol, TGSI_WRITEMASK_W), ps.rCurSrc);
} else {
diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c
index 050a32d3327..212fd60255a 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -1299,7 +1299,7 @@ _tx_dst_param(struct shader_translator *tx, const struct sm1_dst_param *param)
case 1:
if (ureg_dst_is_undef(tx->regs.oFog))
tx->regs.oFog =
- ureg_saturate(ureg_DECL_output(tx->ureg, TGSI_SEMANTIC_FOG, 0));
+ ureg_saturate(ureg_DECL_output(tx->ureg, TGSI_SEMANTIC_GENERIC, 16));
dst = tx->regs.oFog;
break;
case 2:
@@ -2039,15 +2039,16 @@ sm1_declusage_to_tgsi(struct tgsi_declaration_semantic *sem,
* are close together or low.
*
*
- * POSITION >= 1: 10 * index + 6
- * COLOR >= 2: 10 * (index-1) + 7
+ * POSITION >= 1: 10 * index + 7
+ * COLOR >= 2: 10 * (index-1) + 8
+ * FOG: 16
* TEXCOORD[0..15]: index
- * BLENDWEIGHT: 10 * index + 18
- * BLENDINDICES: 10 * index + 19
- * NORMAL: 10 * index + 20
- * TANGENT: 10 * index + 21
- * BINORMAL: 10 * index + 22
- * TESSFACTOR: 10 * index + 23
+ * BLENDWEIGHT: 10 * index + 19
+ * BLENDINDICES: 10 * index + 20
+ * NORMAL: 10 * index + 21
+ * TANGENT: 10 * index + 22
+ * BINORMAL: 10 * index + 23
+ * TESSFACTOR: 10 * index + 24
*/
switch (dcl->usage) {
@@ -2059,7 +2060,7 @@ sm1_declusage_to_tgsi(struct tgsi_declaration_semantic *sem,
sem->Index = 0;
} else {
sem->Name = TGSI_SEMANTIC_GENERIC;
- sem->Index = 10 * index + 6;
+ sem->Index = 10 * index + 7;
}
break;
case D3DDECLUSAGE_COLOR:
@@ -2068,13 +2069,13 @@ sm1_declusage_to_tgsi(struct tgsi_declaration_semantic *sem,
sem->Index = index;
} else {
sem->Name = TGSI_SEMANTIC_GENERIC;
- sem->Index = 10 * (index-1) + 7;
+ sem->Index = 10 * (index-1) + 8;
}
break;
case D3DDECLUSAGE_FOG:
assert(index == 0);
- sem->Name = TGSI_SEMANTIC_FOG;
- sem->Index = 0;
+ sem->Name = TGSI_SEMANTIC_GENERIC;
+ sem->Index = 16;
break;
case D3DDECLUSAGE_PSIZE:
assert(index == 0);
@@ -2091,27 +2092,27 @@ sm1_declusage_to_tgsi(struct tgsi_declaration_semantic *sem,
break;
case D3DDECLUSAGE_BLENDWEIGHT:
sem->Name = TGSI_SEMANTIC_GENERIC;
- sem->Index = 10 * index + 18;
+ sem->Index = 10 * index + 19;
break;
case D3DDECLUSAGE_BLENDINDICES:
sem->Name = TGSI_SEMANTIC_GENERIC;
- sem->Index = 10 * index + 19;
+ sem->Index = 10 * index + 20;
break;
case D3DDECLUSAGE_NORMAL:
sem->Name = TGSI_SEMANTIC_GENERIC;
- sem->Index = 10 * index + 20;
+ sem->Index = 10 * index + 21;
break;
case D3DDECLUSAGE_TANGENT:
sem->Name = TGSI_SEMANTIC_GENERIC;
- sem->Index = 10 * index + 21;
+ sem->Index = 10 * index + 22;
break;
case D3DDECLUSAGE_BINORMAL:
sem->Name = TGSI_SEMANTIC_GENERIC;
- sem->Index = 10 * index + 22;
+ sem->Index = 10 * index + 23;
break;
case D3DDECLUSAGE_TESSFACTOR:
sem->Name = TGSI_SEMANTIC_GENERIC;
- sem->Index = 10 * index + 23;
+ sem->Index = 10 * index + 24;
break;
case D3DDECLUSAGE_SAMPLE:
sem->Name = TGSI_SEMANTIC_COUNT;
@@ -3735,7 +3736,7 @@ shader_add_ps_fog_stage(struct shader_translator *tx, struct ureg_src src_col)
ureg_MUL(ureg, fog_factor, tx_src_scalar(fog_factor), ureg_imm1f(ureg, -1.442695f));
ureg_EX2(ureg, fog_factor, tx_src_scalar(fog_factor));
} else {
- fog_vs = ureg_scalar(ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_FOG, 0,
+ fog_vs = ureg_scalar(ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_GENERIC, 16,
TGSI_INTERPOLATE_PERSPECTIVE),
TGSI_SWIZZLE_X);
ureg_MOV(ureg, fog_factor, fog_vs);
@@ -3768,7 +3769,7 @@ static void parse_shader(struct shader_translator *tx)
}
if (IS_VS && tx->version.major < 3 && ureg_dst_is_undef(tx->regs.oFog) && info->fog_enable) {
- tx->regs.oFog = ureg_DECL_output(tx->ureg, TGSI_SEMANTIC_FOG, 0);
+ tx->regs.oFog = ureg_DECL_output(tx->ureg, TGSI_SEMANTIC_GENERIC, 16);
ureg_MOV(tx->ureg, ureg_writemask(tx->regs.oFog, TGSI_WRITEMASK_X), ureg_imm1f(tx->ureg, 0.0f));
}