Cleanup PSH and alphakill

This commit is contained in:
Jannik Vogel 2015-07-16 11:28:41 +02:00
parent 939ad0121a
commit 71ad6234fa
2 changed files with 10 additions and 10 deletions

View File

@ -2975,14 +2975,12 @@ static void pgraph_bind_shaders(PGRAPHState *pg)
state.rect_tex[i] = true;
}
int j;
for(j = 0; j < 4; j++) {
/* compare_mode[i][j] = stage i, component j { s,t,r,q } */
for (j = 0; j < 4; j++) {
state.compare_mode[i][j] =
(pg->regs[NV_PGRAPH_SHADERCLIPMODE] >> (4 * i + j)) & 1;
}
state.alphakill[i] = GET_MASK(pg->regs[NV_PGRAPH_TEXCTL0_0 + i*4],
NV_PGRAPH_TEXCTL0_0_ALPHAKILLEN);
state.alphakill[i] = pg->regs[NV_PGRAPH_TEXCTL0_0 + i*4]
& NV_PGRAPH_TEXCTL0_0_ALPHAKILLEN;
}
ShaderBinding* cached_shader = g_hash_table_lookup(pg->shader_cache, &state);

View File

@ -597,16 +597,19 @@ static QString* psh_convert(struct PixelShader *ps)
case PS_TEXTUREMODES_PASSTHRU:
qstring_append_fmt(vars, "vec4 t%d = pT%d;\n", i, i);
break;
case PS_TEXTUREMODES_DOT_RFLCT_SPEC:
assert(false);
break;
case PS_TEXTUREMODES_DPNDNT_AR:
assert(!ps->rect_tex[i]);
sampler_type = "sampler2D";
qstring_append_fmt(vars, " vec4 t%d = texture(texSamp%d, t%d.ar);\n",
qstring_append_fmt(vars, "vec4 t%d = texture(texSamp%d, t%d.ar);\n",
i, i, ps->input_tex[i]);
break;
case PS_TEXTUREMODES_DPNDNT_GB:
assert(!ps->rect_tex[i]);
sampler_type = "sampler2D";
qstring_append_fmt(vars, " vec4 t%d = texture(texSamp%d, t%d.gb);\n",
qstring_append_fmt(vars, "vec4 t%d = texture(texSamp%d, t%d.gb);\n",
i, i, ps->input_tex[i]);
break;
case PS_TEXTUREMODES_BUMPENVMAP_LUM:
@ -626,8 +629,7 @@ static QString* psh_convert(struct PixelShader *ps)
break;
case PS_TEXTUREMODES_CLIPPLANE: {
int j;
assert(false); /* FIXME: Untested */
qstring_append_fmt(vars, " vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_CLIPPLANE */\n",
qstring_append_fmt(vars, "vec4 t%d = vec4(0.0); /* PS_TEXTUREMODES_CLIPPLANE */\n",
i);
for (j = 0; j < 4; j++) {
qstring_append_fmt(vars, " if(pT%d.%c %s 0.0) { discard; };\n",
@ -637,7 +639,7 @@ static QString* psh_convert(struct PixelShader *ps)
break;
}
case PS_TEXTUREMODES_DOTPRODUCT:
qstring_append_fmt(vars, " vec4 t%d = vec4(dot(pT%d.xyz, t%d.rgb));\n",
qstring_append_fmt(vars, "vec4 t%d = vec4(dot(pT%d.xyz, t%d.rgb));\n",
i, i, ps->input_tex[i]);
break;
default: