diff --git a/hw/xbox/nv2a.c b/hw/xbox/nv2a.c index a1505c62b1..0f466919f5 100644 --- a/hw/xbox/nv2a.c +++ b/hw/xbox/nv2a.c @@ -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); diff --git a/hw/xbox/nv2a_psh.c b/hw/xbox/nv2a_psh.c index c90a5a66af..780760f350 100644 --- a/hw/xbox/nv2a_psh.c +++ b/hw/xbox/nv2a_psh.c @@ -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: