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.
This commit is contained in:
Niklas Haas 2017-08-27 13:40:59 +02:00
parent 8cf5799ab1
commit 62f0677614
2 changed files with 6 additions and 6 deletions

View File

@ -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);
}
}

View File

@ -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;
}