mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-28 23:13:18 +08:00
vo_gl: fix cscale=4 and cscale=5 doing nothing
The ARB shader code generated at the end of the shaders for scaling mode 4
and 5 was something like:
MAD yuv.g, b.r, {0.5}, a.r;
This appears to be semantically equivalent with:
MAD yuv.g, b.rrrr, {0.5, 0, 0, 0}, a.rrrr;
This has the consequence that the result register, yuv.g, will not contain
the value computed by the scale filter, but a.r. a.r is the unchanged
value sampled from the normal texture coordinates, so the filter did
effectively nothing and behaved as if cscale=0 was specified. The basic
mistake here is that yuv.g does not specify a single register, but it
specifies the full vector register yuv, with writing enabled on the g
channel. This means yuv.g will assigned the g channel of the the result
vector computed by the MAD instruction.
This commit is contained in:
+4
-2
@@ -952,7 +952,8 @@ static const char *unsharp_filt_template =
|
||||
SAMPLE("b.g","coord2.zwzw","texture[$in_tex]")
|
||||
"DP3 b, b, {0.25, 0.25, 0.25};\n"
|
||||
"SUB b.r, a.r, b.r;\n"
|
||||
"MAD yuv.$out_comp, b.r, {$strength}, a.r;\n";
|
||||
"MAD textemp.r, b.r, {$strength}, a.r;\n"
|
||||
"MOV yuv.$out_comp, textemp.r;\n";
|
||||
|
||||
static const char *unsharp_filt_template2 =
|
||||
"PARAM dcoord$out_comp = {$ptw_12, $pth_12, $ptw_12, -$pth_12};\n"
|
||||
@@ -976,7 +977,8 @@ static const char *unsharp_filt_template2 =
|
||||
SAMPLE("b.g","coord2.zwzw","texture[$in_tex]")
|
||||
"DP4 b.r, b, {-0.1171875, -0.1171875, -0.1171875, -0.09765625};\n"
|
||||
"MAD b.r, a.r, {0.859375}, b.r;\n"
|
||||
"MAD yuv.$out_comp, b.r, {$strength}, a.r;\n";
|
||||
"MAD textemp.r, b.r, {$strength}, a.r;\n"
|
||||
"MOV yuv.$out_comp, textemp.r;\n";
|
||||
|
||||
static const char *yuv_prog_template =
|
||||
"PARAM ycoef = {$cm11, $cm21, $cm31};\n"
|
||||
|
||||
Reference in New Issue
Block a user