mirror of
https://github.com/mpv-player/mpv
synced 2024-12-31 19:52:16 +00:00
cocoa: gl3: support querying of colors bit depth
Add support for querying the bit depth of the colors from the OpenGL context. This allows to perform dithering correctly.
This commit is contained in:
parent
4a2bd440dd
commit
43337db0a4
@ -46,4 +46,6 @@ int vo_cocoa_swap_interval(int enabled);
|
||||
void *vo_cocoa_cgl_context(void);
|
||||
void *vo_cocoa_cgl_pixel_format(void);
|
||||
|
||||
int vo_cocoa_cgl_color_size(void);
|
||||
|
||||
#endif /* MPLAYER_COCOA_COMMON_H */
|
||||
|
@ -405,6 +405,22 @@ void *vo_cocoa_cgl_pixel_format(void)
|
||||
return [s->pixelFormat CGLPixelFormatObj];
|
||||
}
|
||||
|
||||
int vo_cocoa_cgl_color_size(void)
|
||||
{
|
||||
GLint value;
|
||||
CGLDescribePixelFormat(vo_cocoa_cgl_pixel_format(), 0,
|
||||
kCGLPFAColorSize, &value);
|
||||
switch (value) {
|
||||
case 32:
|
||||
case 24:
|
||||
return 8;
|
||||
case 16:
|
||||
return 5;
|
||||
}
|
||||
|
||||
return 8;
|
||||
}
|
||||
|
||||
void create_menu()
|
||||
{
|
||||
NSMenu *menu;
|
||||
|
@ -1727,6 +1727,9 @@ static int create_window_cocoa_gl3(struct MPGLContext *ctx, int gl_flags,
|
||||
{
|
||||
int rv = vo_cocoa_create_window(ctx->vo, d_width, d_height, flags, 1);
|
||||
getFunctions(ctx->gl, (void *)vo_cocoa_glgetaddr, NULL, true);
|
||||
ctx->depth_r = vo_cocoa_cgl_color_size();
|
||||
ctx->depth_g = vo_cocoa_cgl_color_size();
|
||||
ctx->depth_b = vo_cocoa_cgl_color_size();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user