mirror of
https://github.com/mpv-player/mpv
synced 2025-03-30 15:29:56 +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:
parent
9fd4ae9529
commit
b216c09ade
@ -88,6 +88,11 @@ struct GL {
|
|||||||
int mpgl_caps; // Bitfield of MPGL_CAP_* constants
|
int mpgl_caps; // Bitfield of MPGL_CAP_* constants
|
||||||
bool debug_context; // use of e.g. GLX_CONTEXT_DEBUG_BIT_ARB
|
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.
|
// Copy of function pointer used to load GL.
|
||||||
// Caution: Not necessarily valid to use after VO init has completed!
|
// Caution: Not necessarily valid to use after VO init has completed!
|
||||||
void *(*get_fn)(void *ctx, const char *n);
|
void *(*get_fn)(void *ctx, const char *n);
|
||||||
|
@ -238,7 +238,7 @@ bool ra_gl_ctx_start_frame(struct ra_swapchain *sw, struct ra_fbo *out_fbo)
|
|||||||
return true;
|
return true;
|
||||||
*out_fbo = (struct ra_fbo) {
|
*out_fbo = (struct ra_fbo) {
|
||||||
.tex = p->wrapped_fb,
|
.tex = p->wrapped_fb,
|
||||||
.flip = !p->params.flipped, // OpenGL FBs are normally flipped
|
.flip = !p->gl->flipped, // OpenGL FBs are normally flipped
|
||||||
};
|
};
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -34,11 +34,6 @@ struct ra_gl_ctx_params {
|
|||||||
// See ra_swapchain_fns.get_vsync.
|
// See ra_swapchain_fns.get_vsync.
|
||||||
void (*get_vsync)(struct ra_ctx *ctx, struct vo_vsync_info *info);
|
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
|
// 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
|
// implementation to be using an external swapchain, which disables the
|
||||||
// software simulation of --swapchain-depth. Any functions defined by this
|
// software simulation of --swapchain-depth. Any functions defined by this
|
||||||
|
@ -605,10 +605,10 @@ static bool angle_init(struct ra_ctx *ctx)
|
|||||||
};
|
};
|
||||||
struct ra_gl_ctx_params params = {
|
struct ra_gl_ctx_params params = {
|
||||||
.swap_buffers = angle_swap_buffers,
|
.swap_buffers = angle_swap_buffers,
|
||||||
.flipped = p->flipped,
|
|
||||||
.external_swapchain = p->dxgi_swapchain ? &dxgi_swapchain_fns : NULL,
|
.external_swapchain = p->dxgi_swapchain ? &dxgi_swapchain_fns : NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gl->flipped = p->flipped;
|
||||||
if (!ra_gl_ctx_init(ctx, gl, params))
|
if (!ra_gl_ctx_init(ctx, gl, params))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -555,10 +555,10 @@ static bool dxgl_init(struct ra_ctx *ctx)
|
|||||||
static const struct ra_swapchain_fns empty_swapchain_fns = {0};
|
static const struct ra_swapchain_fns empty_swapchain_fns = {0};
|
||||||
struct ra_gl_ctx_params params = {
|
struct ra_gl_ctx_params params = {
|
||||||
.swap_buffers = dxgl_swap_buffers,
|
.swap_buffers = dxgl_swap_buffers,
|
||||||
.flipped = true,
|
|
||||||
.external_swapchain = &empty_swapchain_fns,
|
.external_swapchain = &empty_swapchain_fns,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
gl->flipped = true;
|
||||||
if (!ra_gl_ctx_init(ctx, gl, params))
|
if (!ra_gl_ctx_init(ctx, gl, params))
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user