summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.xyz>2017-08-27 13:40:59 +0200
committerNiklas Haas <git@haasn.xyz>2017-09-04 13:53:14 +0200
commit62f0677614ead1b094ac97b3ea1756541dcda03c (patch)
treed0a50dd78a7524c776f4d1a734e6f0e0251b2cdd
parent8cf5799ab1e1cb2de22636eadf3119a319161aec (diff)
downloadmpv-62f0677614ead1b094ac97b3ea1756541dcda03c.tar.bz2
mpv-62f0677614ead1b094ac97b3ea1756541dcda03c.tar.xz
vo_opengl: use rgba16 for 3DLUTs instead of rgb16
Vulkan compat. rgb16 doesn't exist on hardware anyway, might as well just generate the 3DLUT against rgba16 as well. We've decided this is the simplest way to do vulkan compatibility: just make sure we never actually need 3-component textures.
-rw-r--r--video/out/opengl/lcms.c8
-rw-r--r--video/out/opengl/video.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/video/out/opengl/lcms.c b/video/out/opengl/lcms.c
index ca4167d544..8747ae6aa6 100644
--- a/video/out/opengl/lcms.c
+++ b/video/out/opengl/lcms.c
@@ -370,7 +370,7 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d,
return false;
void *tmp = talloc_new(NULL);
- uint16_t *output = talloc_array(tmp, uint16_t, s_r * s_g * s_b * 3);
+ uint16_t *output = talloc_array(tmp, uint16_t, s_r * s_g * s_b * 4);
struct lut3d *lut = NULL;
cmsContext cms = NULL;
@@ -380,7 +380,7 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d,
// because we may change the parameter in the future or make it
// customizable, same for the primaries.
char *cache_info = talloc_asprintf(tmp,
- "ver=1.3, intent=%d, size=%dx%dx%d, prim=%d, trc=%d, "
+ "ver=1.4, intent=%d, size=%dx%dx%d, prim=%d, trc=%d, "
"contrast=%d\n",
p->opts->intent, s_r, s_g, s_b, prim, trc, p->opts->contrast);
@@ -435,7 +435,7 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d,
}
cmsHTRANSFORM trafo = cmsCreateTransformTHR(cms, vid_hprofile, TYPE_RGB_16,
- profile, TYPE_RGB_16,
+ profile, TYPE_RGBA_16,
p->opts->intent,
cmsFLAGS_HIGHRESPRECALC |
cmsFLAGS_BLACKPOINTCOMPENSATION);
@@ -454,7 +454,7 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d,
input[r * 3 + 1] = g * 65535 / (s_g - 1);
input[r * 3 + 2] = b * 65535 / (s_b - 1);
}
- size_t base = (b * s_r * s_g + g * s_r) * 3;
+ size_t base = (b * s_r * s_g + g * s_r) * 4;
cmsDoTransform(trafo, input, output + base, s_r);
}
}
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index 09b05fd688..1378872838 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -569,10 +569,10 @@ static bool gl_video_get_lut3d(struct gl_video *p, enum mp_csp_prim prim,
// GLES3 doesn't provide filtered 16 bit integer textures
// GLES2 doesn't even provide 3D textures
- const struct ra_format *fmt = ra_find_unorm_format(p->ra, 2, 3);
+ const struct ra_format *fmt = ra_find_unorm_format(p->ra, 2, 4);
if (!fmt || !(p->ra->caps & RA_CAP_TEX_3D)) {
p->use_lut_3d = false;
- MP_WARN(p, "Disabling color management (no RGB16 3D textures).\n");
+ MP_WARN(p, "Disabling color management (no RGBA16 3D textures).\n");
return false;
}