mirror of https://github.com/mpv-player/mpv
vo_opengl: rename glUploadTex, drop unused parameter
Rename it to get out of OpenGL's namespace. The gl_ prefix is used by other mpv functions, but no OpenGL ones. The "slice" parameter was never actually used, and all callers passed 0 for it.
This commit is contained in:
parent
66079048ea
commit
e76aa7e8db
|
@ -181,8 +181,8 @@ static bool upload(struct mpgl_osd *ctx, struct mpgl_osd_part *osd,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
glUploadTex(gl, GL_TEXTURE_2D, fmt->format, fmt->type, texdata, stride,
|
gl_upload_tex(gl, GL_TEXTURE_2D, fmt->format, fmt->type, texdata, stride,
|
||||||
bb[0].x, bb[0].y, bb[1].x - bb[0].x, bb[1].y - bb[0].y, 0);
|
bb[0].x, bb[0].y, bb[1].x - bb[0].x, bb[1].y - bb[0].y);
|
||||||
|
|
||||||
if (pbo)
|
if (pbo)
|
||||||
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
|
|
|
@ -67,25 +67,22 @@ static int get_alignment(int stride)
|
||||||
// format, type: texture parameters
|
// format, type: texture parameters
|
||||||
// dataptr, stride: image data
|
// dataptr, stride: image data
|
||||||
// x, y, width, height: part of the image to upload
|
// x, y, width, height: part of the image to upload
|
||||||
// slice: height of an upload slice, 0 for all at once
|
void gl_upload_tex(GL *gl, GLenum target, GLenum format, GLenum type,
|
||||||
void glUploadTex(GL *gl, GLenum target, GLenum format, GLenum type,
|
const void *dataptr, int stride,
|
||||||
const void *dataptr, int stride,
|
int x, int y, int w, int h)
|
||||||
int x, int y, int w, int h, int slice)
|
|
||||||
{
|
{
|
||||||
int bpp = gl_bytes_per_pixel(format, type);
|
int bpp = gl_bytes_per_pixel(format, type);
|
||||||
const uint8_t *data = dataptr;
|
const uint8_t *data = dataptr;
|
||||||
int y_max = y + h;
|
int y_max = y + h;
|
||||||
if (w <= 0 || h <= 0 || !bpp)
|
if (w <= 0 || h <= 0 || !bpp)
|
||||||
return;
|
return;
|
||||||
if (slice <= 0)
|
|
||||||
slice = h;
|
|
||||||
if (stride < 0) {
|
if (stride < 0) {
|
||||||
data += (h - 1) * stride;
|
data += (h - 1) * stride;
|
||||||
stride = -stride;
|
stride = -stride;
|
||||||
}
|
}
|
||||||
gl->PixelStorei(GL_UNPACK_ALIGNMENT, get_alignment(stride));
|
gl->PixelStorei(GL_UNPACK_ALIGNMENT, get_alignment(stride));
|
||||||
bool use_rowlength = slice > 1 && (gl->mpgl_caps & MPGL_CAP_ROW_LENGTH);
|
int slice = h;
|
||||||
if (use_rowlength) {
|
if (gl->mpgl_caps & MPGL_CAP_ROW_LENGTH) {
|
||||||
// this is not always correct, but should work for MPlayer
|
// this is not always correct, but should work for MPlayer
|
||||||
gl->PixelStorei(GL_UNPACK_ROW_LENGTH, stride / bpp);
|
gl->PixelStorei(GL_UNPACK_ROW_LENGTH, stride / bpp);
|
||||||
} else {
|
} else {
|
||||||
|
@ -98,7 +95,7 @@ void glUploadTex(GL *gl, GLenum target, GLenum format, GLenum type,
|
||||||
}
|
}
|
||||||
if (y < y_max)
|
if (y < y_max)
|
||||||
gl->TexSubImage2D(target, 0, x, y, w, y_max - y, format, type, data);
|
gl->TexSubImage2D(target, 0, x, y, w, y_max - y, format, type, data);
|
||||||
if (use_rowlength)
|
if (gl->mpgl_caps & MPGL_CAP_ROW_LENGTH)
|
||||||
gl->PixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
gl->PixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||||
gl->PixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
gl->PixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ struct mp_log;
|
||||||
|
|
||||||
void glCheckError(GL *gl, struct mp_log *log, const char *info);
|
void glCheckError(GL *gl, struct mp_log *log, const char *info);
|
||||||
|
|
||||||
void glUploadTex(GL *gl, GLenum target, GLenum format, GLenum type,
|
void gl_upload_tex(GL *gl, GLenum target, GLenum format, GLenum type,
|
||||||
const void *dataptr, int stride,
|
const void *dataptr, int stride,
|
||||||
int x, int y, int w, int h, int slice);
|
int x, int y, int w, int h);
|
||||||
|
|
||||||
mp_image_t *glGetWindowScreenshot(GL *gl);
|
mp_image_t *glGetWindowScreenshot(GL *gl);
|
||||||
|
|
||||||
|
|
|
@ -2956,8 +2956,8 @@ static bool gl_video_upload_image(struct gl_video *p, struct mp_image *mpi)
|
||||||
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, plane->gl_buffer);
|
gl->BindBuffer(GL_PIXEL_UNPACK_BUFFER, plane->gl_buffer);
|
||||||
gl->ActiveTexture(GL_TEXTURE0 + n);
|
gl->ActiveTexture(GL_TEXTURE0 + n);
|
||||||
gl->BindTexture(plane->gl_target, plane->gl_texture);
|
gl->BindTexture(plane->gl_target, plane->gl_texture);
|
||||||
glUploadTex(gl, plane->gl_target, plane->gl_format, plane->gl_type,
|
gl_upload_tex(gl, plane->gl_target, plane->gl_format, plane->gl_type,
|
||||||
mpi->planes[n], mpi->stride[n], 0, 0, plane->w, plane->h, 0);
|
mpi->planes[n], mpi->stride[n], 0, 0, plane->w, plane->h);
|
||||||
}
|
}
|
||||||
gl->ActiveTexture(GL_TEXTURE0);
|
gl->ActiveTexture(GL_TEXTURE0);
|
||||||
if (pbo)
|
if (pbo)
|
||||||
|
|
Loading…
Reference in New Issue