mirror of https://github.com/xemu-project/xemu.git
nv2a: Use rounded values for alpha testing
This commit is contained in:
parent
203b33ecf0
commit
f701573d44
|
@ -712,9 +712,9 @@ static void shader_update_constants(PGRAPHState *pg, ShaderBinding *binding,
|
|||
}
|
||||
}
|
||||
if (binding->alpha_ref_loc != -1) {
|
||||
float alpha_ref = GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_CONTROL_0),
|
||||
NV_PGRAPH_CONTROL_0_ALPHAREF) / 255.0;
|
||||
glUniform1f(binding->alpha_ref_loc, alpha_ref);
|
||||
int alpha_ref = GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_CONTROL_0),
|
||||
NV_PGRAPH_CONTROL_0_ALPHAREF);
|
||||
glUniform1i(binding->alpha_ref_loc, alpha_ref);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -743,7 +743,7 @@ static MString* psh_convert(struct PixelShader *ps)
|
|||
"layout(location = 0) out vec4 fragColor;\n");
|
||||
}
|
||||
|
||||
mstring_append_fmt(preflight, "%sfloat alphaRef;\n"
|
||||
mstring_append_fmt(preflight, "%sint alphaRef;\n"
|
||||
"%svec4 fogColor;\n"
|
||||
"%sivec4 clipRegion[8];\n",
|
||||
u, u, u);
|
||||
|
@ -1190,7 +1190,9 @@ static MString* psh_convert(struct PixelShader *ps)
|
|||
assert(false);
|
||||
break;
|
||||
}
|
||||
mstring_append_fmt(ps->code, "if (!(fragColor.a %s alphaRef)) discard;\n",
|
||||
mstring_append_fmt(ps->code,
|
||||
"int fragAlpha = int(round(fragColor.a * 255.0));\n"
|
||||
"if (!(fragAlpha %s alphaRef)) discard;\n",
|
||||
alpha_op);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -477,10 +477,9 @@ static void shader_update_constants(PGRAPHState *pg, ShaderBinding *binding,
|
|||
}
|
||||
}
|
||||
if (binding->alpha_ref_loc != -1) {
|
||||
float alpha_ref = GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_CONTROL_0),
|
||||
NV_PGRAPH_CONTROL_0_ALPHAREF) /
|
||||
255.0;
|
||||
uniform1f(&binding->fragment->uniforms, binding->alpha_ref_loc,
|
||||
int alpha_ref = GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_CONTROL_0),
|
||||
NV_PGRAPH_CONTROL_0_ALPHAREF);
|
||||
uniform1i(&binding->fragment->uniforms, binding->alpha_ref_loc,
|
||||
alpha_ref);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue