mirror of
https://github.com/mpv-player/mpv
synced 2024-11-14 22:48:35 +01:00
vo_opengl: add another ra_format field to exclude insane formats
Generic description of pixel formats is hard. In this case, the Apple special format for packed YUV could have been interpreted as a RGB format with funny packing.
This commit is contained in:
parent
47ea771b7a
commit
d45fbecbb5
@ -82,10 +82,11 @@ struct ra_renderpass_params *ra_render_pass_params_copy(void *ta_parent,
|
||||
|
||||
|
||||
// Return whether this is a tightly packed format with no external padding and
|
||||
// with the same bit size/depth in all components.
|
||||
// with the same bit size/depth in all components, and the shader returns
|
||||
// components in the same order as in memory.
|
||||
static bool ra_format_is_regular(const struct ra_format *fmt)
|
||||
{
|
||||
if (!fmt->pixel_size || !fmt->num_components)
|
||||
if (!fmt->pixel_size || !fmt->num_components || !fmt->ordered)
|
||||
return false;
|
||||
for (int n = 1; n < fmt->num_components; n++) {
|
||||
if (fmt->component_size[n] != fmt->component_size[0] ||
|
||||
|
@ -60,6 +60,8 @@ struct ra_format {
|
||||
const char *name; // symbolic name for user interaction/debugging
|
||||
void *priv;
|
||||
enum ra_ctype ctype; // data type of each component
|
||||
bool ordered; // components are sequential in memory, and returned
|
||||
// by the shader in memory order
|
||||
int num_components; // component count, 0 if not applicable, max. 4
|
||||
int component_size[4]; // in bits, all entries 0 if not applicable
|
||||
int component_depth[4]; // bits in use for each component, 0 if not applicable
|
||||
|
@ -55,6 +55,7 @@ static int ra_init_gl(struct ra *ra, GL *gl)
|
||||
.priv = (void *)gl_fmt,
|
||||
.ctype = gl_format_type(gl_fmt),
|
||||
.num_components = gl_format_components(gl_fmt->format),
|
||||
.ordered = gl_fmt->format != GL_RGB_422_APPLE,
|
||||
.pixel_size = gl_bytes_per_pixel(gl_fmt->format, gl_fmt->type),
|
||||
.luminance_alpha = gl_fmt->format == GL_LUMINANCE_ALPHA,
|
||||
.linear_filter = gl_fmt->flags & F_TF,
|
||||
|
Loading…
Reference in New Issue
Block a user