Skip to content
Snippets Groups Projects
  1. Jan 20, 2025
  2. Jan 17, 2025
    • Thomas Guillem's avatar
      opengl: interop_sw: log when fixing GL format · d43e5e02
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      d43e5e02
    • Thomas Guillem's avatar
      opengl: add planar >=10bits support on Android: · bfbffa5b
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      Via GL_HALF_FLOAT, should work starting GLES 3.0.
      
      Semiplanar is not supported as a CPU pass may be necessary to convert to
      HALF_FLOAT:
      
      Indeed, half-float data format consists of 1 sign bit, 5 exponent bits
      and 10 mantissa bits. If you try to treat P010’s integer layout as
      half-float, the GPU misinterprets those bits as exponent and mantissa,
      causing corruption.
      bfbffa5b
    • Thomas Guillem's avatar
      opengl: add R16F and HALF_FLOAT defines · 1aca33a3
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      1aca33a3
    • Thomas Guillem's avatar
      opengl: render 10bits with GL_EXT_texture_integer · 87200918
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      When available.
      87200918
    • Thomas Guillem's avatar
      opengl: interop_sw: rework fixGLFormat() · 98fd945c
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      98fd945c
    • Thomas Guillem's avatar
      opengl: interop_sw: add intermediate variables for readability · e749eb32
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      e749eb32
    • Thomas Guillem's avatar
      opengl: interop_sw: check tex alloc from fixGLFormat() · a6fc4ed1
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      a6fc4ed1
    • Thomas Guillem's avatar
      opengl: interop_sw: test fixed arguments · afa5e3ef
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      This could lead to false positives or negatives.
      afa5e3ef
    • Thomas Guillem's avatar
      opengl: interop: add missing format in GetTexFormatSize() · 5b90bacc
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      5b90bacc
    • Thomas Guillem's avatar
      opengl: interop_sw: add type in fixGLFormat() · 30425f09
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      This function does not change the type for now.
      30425f09
    • Thomas Guillem's avatar
      opengl: interop_sw: replace hardcoded value · 6eaedcc6
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      Not fixing anything since it's always GL_UNSIGNED_SHORT for 16bits (for
      now).
      6eaedcc6
    • Thomas Guillem's avatar
      opengl: interop_sw: fix >= 10bits rendering · a7c3c204
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      Fixes a regression from 67bddf90
      
      vlc_gl_interop_GetTexFormatSize() would always return an error for the
      GL_R16UI / GL_RED combination. It's either GL_R16/GL_RED or
      GL_R16UI/GL_RED_INTEGER.
      
      But the sampler is using sampler2D and not usampler2D, so let's keep
      GL_R16.
      a7c3c204
    • Thomas Guillem's avatar
      opengl: sampler: specify sampler?D precision · 32abaa35
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      Fixes the following error on GLES2 when using libplacebo shaders.
      
      [00007fe3cc815910] gl generic error: Shader source:
         1: #version 300 es
         2: precision highp float;
         3: uniform sampler2D Textures[3];
         4: uniform mat3 _2;
         5: uniform mat3 _3;
         6: uniform mat3 _4;
         7: uniform float _a;
         8: uniform float _b;
         9: uniform mat3 _19;
        10: uniform sampler2D _6;
        11: uniform sampler3D _d;
        12:
        13: const float _8 = float(0.001953125);
        14: const float _9 = float(0.99609375);
        15: #define _7(x) (_9 * (x) + _8)
        16: #define _5(pos) (textureLod(_6, vec2(\
        17:     _7(float(pos))\
        18:    ,0.5\
        19:   ), 0.0).x)
        20: const float _f = float(0.010416666977107525);
        21: const float _10 = float(0.9791666269302368);
        22: #define _e(x) (_10 * (x) + _f)
        23: const float _12 = float(0.015625);
        24: const float _13 = float(0.96875);
        25: #define _11(x) (_13 * (x) + _12)
        26: const float _15 = float(0.001953125);
        27: const float _16 = float(0.99609375);
        28: #define _14(x) (_16 * (x) + _15)
        29: #define _c(pos) (textureLod(_d, vec3(\
        30:     _e(vec3(pos).x)\
        31:    ,_11(vec3(pos).y)\
        32:    ,_14(vec3(pos).z)\
        33:   ), 0.0).xyzw)
        34: const float _17 = float(-0.16753844916820526);
        35: const float _18 = float(2.0106043815612793);
        36: const float _1a = float(0.0595848374068737);
        37: const float _1b = float(1.149015188217163);
        38: vec4 _1(vec4 color) {
        39: // pl_shader_color_map
        40: {
        41: // pl_shader_linearize
        42: color.rgb = max(color.rgb, 0.0);
        43: color.rgb = pow(color.rgb, vec3(1.0/78.84375));
        44: color.rgb = max(color.rgb - vec3(0.8359375), 0.0)
        45:              / (vec3(18.8515625) - vec3(18.6875) * color.rgb);
        46: color.rgb = pow(color.rgb, vec3(1.0/0.1593017578125));
        47: color.rgb *= vec3(49.26108374384236);
        48: vec3 lms = _4 * color.rgb;
        49: vec3 lmspq = 0.0203000009059906 * lms;
        50: lmspq = pow(max(lmspq, 0.0), vec3(0.1593017578125));
        51: lmspq = (vec3(0.8359375) + 18.8515625 * lmspq)
        52:         / (vec3(1.0) + 18.6875 * lmspq);
        53: lmspq = pow(lmspq, vec3(78.84375));
        54: vec3 ipt = _2 * lmspq;
        55: float i_orig = ipt.x;
        56: #define tone_map(x) (_5(_b * (x) + _a))
        57: ipt.x = tone_map(ipt.x);
        58: vec2 hull = vec2(i_orig, ipt.x);
        59: hull = ((hull - 6.0) * hull + 9.0) * hull;
        60: ipt.yz *= min(i_orig / ipt.x, hull.y / hull.x);
        61: vec3 idx;
        62: idx.x = _18 * ipt.x + _17;
        63: idx.y = 2.0 * length(ipt.yz);
        64: idx.z = 0.15915494309189535 * atan(ipt.z, ipt.y) + 0.5;
        65: ipt = _c(idx).xyz;
        66: ipt.yz -= vec2(32768.0/65535.0);
        67: lmspq = _3 * ipt;
        68: lms = pow(max(lmspq, 0.0), vec3(1.0/78.84375));
        69: lms = max(lms - vec3(0.8359375), 0.0)
        70:              / (vec3(18.8515625) - 18.6875 * lms);
        71: lms = pow(lms, vec3(1.0/0.1593017578125));
        72: lms *= 49.261085510253906;
        73: color.rgb = _19 * lms;
        74: #undef tone_map
        75: // pl_shader_delinearize
        76: color.rgb = max(color.rgb, 0.0);
        77: color.rgb = pow(_1b * color.rgb, vec3(1.0/2.4)) - vec3(_1a);
        78: }
        79: return color;
        80: }
        81:
        82: uniform mat4 ConvMatrix;
        83: vec4 vlc_texture(vec2 tex_coords) {
        84:  vec4 pixel = vec4(
        85:   texture(Textures[0], tex_coords).r
        86:   ,  texture(Textures[1], tex_coords).r
        87:   ,  texture(Textures[2], tex_coords).r
        88:   ,  1.0);
        89:  vec4 result = ConvMatrix * pixel;
        90:  result = _1(result);
        91:  return result;
        92: }
        93: #if __VERSION__ < 300
        94: #define FragColor gl_FragColor
        95: varying vec2 PicCoords;
        96: #else
        97: in vec2 PicCoords;
        98: out vec4 FragColor;
        99: #endif
       100: void main() {
       101:  FragColor = vlc_texture(PicCoords);
       102: }
      
      [00007fe3cc815910] gl generic error: shader: 0:11(1): error: No precision specified in this scope for type `sampler3D'
      32abaa35
    • Thomas Guillem's avatar
      opengl: interop_sw: don't try opaque chromas · 66e4a5e9
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      It is possible to get opaque chromas from vlc_fourcc_GetYUVFallback().
      This fixes a vlc_assert_unreachable() in the desc->plane_count
      switch/case.
      
      It was unlikely as opaque chromas are generally at the end of the list.
      66e4a5e9
    • Thomas Guillem's avatar
      opengl: interop_sw: warn when not rendering directly · ddb10174
      Thomas Guillem authored and Steve Lhomme's avatar Steve Lhomme committed
      ddb10174
  3. Jan 15, 2025
  4. Jan 14, 2025
Loading