1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-18 08:39:01 +00:00

opengl: move ra_gl_ctx_params.flipped to struct GL

This is motivated by a need to access it from vo_gpu_next's opengl
wrapping code, and justified by it being an inherent property of the GL
context itself,
This commit is contained in:
Niklas Haas 2023-01-16 20:48:19 +01:00 committed by Niklas Haas
parent 9fd4ae9529
commit b216c09ade
5 changed files with 8 additions and 8 deletions

View File

@ -88,6 +88,11 @@ struct GL {
int mpgl_caps; // Bitfield of MPGL_CAP_* constants
bool debug_context; // use of e.g. GLX_CONTEXT_DEBUG_BIT_ARB
// Set to false if the implementation follows normal GL semantics, which is
// upside down. Set to true if it does *not*, i.e. if rendering is right
// side up
bool flipped;
// Copy of function pointer used to load GL.
// Caution: Not necessarily valid to use after VO init has completed!
void *(*get_fn)(void *ctx, const char *n);

View File

@ -238,7 +238,7 @@ bool ra_gl_ctx_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo)
return true;
*out_fbo = (struct ra_fbo) {
.tex = p->wrapped_fb,
.flip = !p->params.flipped, // OpenGL FBs are normally flipped
.flip = !p->gl->flipped, // OpenGL FBs are normally flipped
};
return true;
}

View File

@ -34,11 +34,6 @@ struct ra_gl_ctx_params {
// See ra_swapchain_fns.get_vsync.
void (*get_vsync)(struct ra_ctx *ctx, struct vo_vsync_info *info);
// Set to false if the implementation follows normal GL semantics, which is
// upside down. Set to true if it does *not*, i.e. if rendering is right
// side up
bool flipped;
// If this is set to non-NULL, then the ra_gl_ctx will consider the GL
// implementation to be using an external swapchain, which disables the
// software simulation of --swapchain-depth. Any functions defined by this

View File

@ -605,10 +605,10 @@ static bool angle_init(struct ra_ctx *ctx)
};
struct ra_gl_ctx_params params = {
.swap_buffers = angle_swap_buffers,
.flipped = p->flipped,
.external_swapchain = p->dxgi_swapchain ? &dxgi_swapchain_fns : NULL,
};
gl->flipped = p->flipped;
if (!ra_gl_ctx_init(ctx, gl, params))
goto fail;

View File

@ -555,10 +555,10 @@ static bool dxgl_init(struct ra_ctx *ctx)
static const struct ra_swapchain_fns empty_swapchain_fns = {0};
struct ra_gl_ctx_params params = {
.swap_buffers = dxgl_swap_buffers,
.flipped = true,
.external_swapchain = &empty_swapchain_fns,
};
gl->flipped = true;
if (!ra_gl_ctx_init(ctx, gl, params))
goto fail;