glcolorconvert: Fix syntax for GLSL shaders

Shader compilation was failing on macOS:

gstglslstage.c:519:_compile_shader:<glslstage1> fragment shader compilation failed:
ERROR: 0:10: 'input_swizzle' : syntax error: Array size must appear after variable name

Co-authored-by: Matthew Waters <matthew@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5123>
This commit is contained in:
Nirbheek Chauhan 2023-07-31 17:31:46 +05:30
parent 9160a9eb26
commit eb9be6de78

View file

@ -142,8 +142,8 @@ static const gfloat from_rgb_bt709_vcoeff[] = {0.440654f, -0.400285f, -0.040370f
"uniform float height;\n" \ "uniform float height;\n" \
"uniform float poffset_x;\n" \ "uniform float poffset_x;\n" \
"uniform float poffset_y;\n" \ "uniform float poffset_y;\n" \
"uniform int[4] input_swizzle;\n" \ "uniform int input_swizzle[4];\n" \
"uniform int[4] output_swizzle;\n" "uniform int output_swizzle[4];\n"
#define MAX_FUNCTIONS 4 #define MAX_FUNCTIONS 4
@ -178,22 +178,22 @@ static const char glsl_func_rgb_to_yuv[] = \
" return yuv;\n" \ " return yuv;\n" \
"}\n"; "}\n";
static const char glsl_func_swizzle[] = "vec4 swizzle(vec4 texel, int[4] components) {\n" \ static const char glsl_func_swizzle[] = "vec4 swizzle(vec4 texel, int components[4]) {\n" \
" return vec4(texel[components[0]], texel[components[1]], texel[components[2]], texel[components[3]]);\n" \ " return vec4(texel[components[0]], texel[components[1]], texel[components[2]], texel[components[3]]);\n" \
"}\n" \ "}\n" \
"vec3 swizzle(vec3 texel, int[3] components) {\n" \ "vec3 swizzle(vec3 texel, int components[3]) {\n" \
" return vec3(texel[components[0]], texel[components[1]], texel[components[2]]);\n" \ " return vec3(texel[components[0]], texel[components[1]], texel[components[2]]);\n" \
"}\n" \ "}\n" \
"vec2 swizzle(vec2 texel, int[2] components) {\n" \ "vec2 swizzle(vec2 texel, int components[2]) {\n" \
" return vec2(texel[components[0]], texel[components[1]]);\n" \ " return vec2(texel[components[0]], texel[components[1]]);\n" \
"}\n" \ "}\n" \
"vec2 swizzle2(vec3 texel, int[3] components) {\n" \ "vec2 swizzle2(vec3 texel, int components[3]) {\n" \
" return vec2(texel[components[0]], texel[components[1]]);\n" \ " return vec2(texel[components[0]], texel[components[1]]);\n" \
"}\n" \ "}\n" \
"vec2 swizzle2(vec4 texel, int[4] components) {\n" \ "vec2 swizzle2(vec4 texel, int components[4]) {\n" \
" return vec2(texel[components[0]], texel[components[1]]);\n" \ " return vec2(texel[components[0]], texel[components[1]]);\n" \
"}\n" \ "}\n" \
"vec3 swizzle3(vec4 texel, int[4] components) {\n" \ "vec3 swizzle3(vec4 texel, int components[4]) {\n" \
" return vec3(texel[components[0]], texel[components[1]], texel[components[2]]);\n" \ " return vec3(texel[components[0]], texel[components[1]], texel[components[2]]);\n" \
"}\n"; "}\n";