summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/utils.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-07-03 16:00:51 +0200
committerwm4 <wm4@nowhere>2016-07-03 16:34:32 +0200
commit823c353faaab569264f6d6d8c3d335bb0173b9e1 (patch)
tree68f5a6a63b4a2e96f16d2834b0c9c797895b2def /video/out/opengl/utils.h
parent06219c7f880225fdcd23885f1e9363821064012e (diff)
downloadmpv-823c353faaab569264f6d6d8c3d335bb0173b9e1.tar.bz2
mpv-823c353faaab569264f6d6d8c3d335bb0173b9e1.tar.xz
vo_opengl: move PBO upload handling to shared code
This introduces a gl_pbo_upload_tex() function, which works almost like our gl_upload_tex() glTexSubImage2D() wrapper, except it takes a struct which caches the PBO handles. It also takes the full texture size (to make allocating an ideal buffer size easier), and a parameter to disable PBOs (so that the caller doesn't have to duplicate the gl_upload_tex() call if PBOs are disabled or unavailable). This also removes warnings and fallbacks on PBO failure. We just silently try using PBOs on every frame, and if that fails at some point, revert to normal texture uploads. Probably doesn't matter.
Diffstat (limited to 'video/out/opengl/utils.h')
-rw-r--r--video/out/opengl/utils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/video/out/opengl/utils.h b/video/out/opengl/utils.h
index 9b4fd8471d..35211f6485 100644
--- a/video/out/opengl/utils.h
+++ b/video/out/opengl/utils.h
@@ -182,4 +182,16 @@ uint64_t gl_timer_last_us(struct gl_timer *timer);
uint64_t gl_timer_avg_us(struct gl_timer *timer);
uint64_t gl_timer_peak_us(struct gl_timer *timer);
+struct gl_pbo_upload {
+ GL *gl;
+ GLuint buffer;
+ size_t buffer_size;
+};
+
+void gl_pbo_upload_tex(struct gl_pbo_upload *pbo, GL *gl, bool use_pbo,
+ GLenum target, GLenum format, GLenum type,
+ int tex_w, int tex_h, const void *dataptr, int stride,
+ int x, int y, int w, int h);
+void gl_pbo_upload_uninit(struct gl_pbo_upload *pbo);
+
#endif