mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 00:02:13 +00:00
vo_opengl: remove macro operator from shader
Removes '##' operator from OpenGL shader code.
This commit is contained in:
parent
a8299cec29
commit
225f2e67b7
@ -826,9 +826,9 @@ static void shader_setup_scaler(char **shader, struct scaler *scaler, int pass)
|
|||||||
{
|
{
|
||||||
const char *target = scaler->index == 0 ? "SAMPLE_L" : "SAMPLE_C";
|
const char *target = scaler->index == 0 ? "SAMPLE_L" : "SAMPLE_C";
|
||||||
if (!scaler->kernel) {
|
if (!scaler->kernel) {
|
||||||
*shader = talloc_asprintf_append(*shader, "#define %s sample_%s_%c\n",
|
*shader = talloc_asprintf_append(*shader, "#define %s(p0, p1, p2) "
|
||||||
target, scaler->name,
|
"sample_%s(p0, p1, p2, filter_param1_%c)\n",
|
||||||
"lc"[scaler->index]);
|
target, scaler->name, "lc"[scaler->index]);
|
||||||
} else {
|
} else {
|
||||||
int size = scaler->kernel->size;
|
int size = scaler->kernel->size;
|
||||||
if (pass != -1) {
|
if (pass != -1) {
|
||||||
@ -1033,13 +1033,13 @@ static void compile_shaders(struct gl_video *p)
|
|||||||
// Force using the luma scaler on chroma. If the "indirect" stage is
|
// Force using the luma scaler on chroma. If the "indirect" stage is
|
||||||
// used, the actual scaling will happen in the next stage.
|
// used, the actual scaling will happen in the next stage.
|
||||||
shader_def(&header_conv, "SAMPLE_C",
|
shader_def(&header_conv, "SAMPLE_C",
|
||||||
use_indirect ? "sample_bilinear_l" : "SAMPLE_L");
|
use_indirect ? "SAMPLE_BILINEAR" : "SAMPLE_L");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (use_indirect) {
|
if (use_indirect) {
|
||||||
// We don't use filtering for the Y-plane (luma), because it's never
|
// We don't use filtering for the Y-plane (luma), because it's never
|
||||||
// scaled in this scenario.
|
// scaled in this scenario.
|
||||||
shader_def(&header_conv, "SAMPLE_L", "sample_bilinear_l");
|
shader_def(&header_conv, "SAMPLE_L", "SAMPLE_BILINEAR");
|
||||||
shader_def_opt(&header_conv, "FIXED_SCALE", true);
|
shader_def_opt(&header_conv, "FIXED_SCALE", true);
|
||||||
header_conv = t_concat(tmp, header, header_conv);
|
header_conv = t_concat(tmp, header, header_conv);
|
||||||
p->indirect_program =
|
p->indirect_program =
|
||||||
|
@ -172,6 +172,8 @@ vec4 sample_bilinear(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord, float param
|
|||||||
return texture(tex, texcoord);
|
return texture(tex, texcoord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SAMPLE_BILINEAR(p0, p1, p2) sample_bilinear(p0, p1, p2, 0)
|
||||||
|
|
||||||
// Explanation how bicubic scaling with only 4 texel fetches is done:
|
// Explanation how bicubic scaling with only 4 texel fetches is done:
|
||||||
// http://www.mate.tue.nl/mate/pdfs/10318.pdf
|
// http://www.mate.tue.nl/mate/pdfs/10318.pdf
|
||||||
// 'Efficient GPU-Based Texture Interpolation using Uniform B-Splines'
|
// 'Efficient GPU-Based Texture Interpolation using Uniform B-Splines'
|
||||||
@ -352,22 +354,6 @@ vec4 sample_sharpen5(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord, float param
|
|||||||
return p + t * param1;
|
return p + t * param1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONCAT(a, b) a ## b
|
|
||||||
|
|
||||||
#define SAMPLE_FILTER_LC(NAME) \
|
|
||||||
vec4 CONCAT(NAME, _l)(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { \
|
|
||||||
return NAME(tex, texsize, texcoord, filter_param1_l); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
vec4 CONCAT(NAME, _c)(VIDEO_SAMPLER tex, vec2 texsize, vec2 texcoord) { \
|
|
||||||
return NAME(tex, texsize, texcoord, filter_param1_c); \
|
|
||||||
}
|
|
||||||
|
|
||||||
SAMPLE_FILTER_LC(sample_bilinear)
|
|
||||||
SAMPLE_FILTER_LC(sample_bicubic_fast)
|
|
||||||
SAMPLE_FILTER_LC(sample_sharpen3)
|
|
||||||
SAMPLE_FILTER_LC(sample_sharpen5)
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
vec2 chr_texcoord = texcoord;
|
vec2 chr_texcoord = texcoord;
|
||||||
#ifdef USE_RECTANGLE
|
#ifdef USE_RECTANGLE
|
||||||
|
Loading…
Reference in New Issue
Block a user