mirror of
https://github.com/wang-bin/QtAV.git
synced 2026-10-29 11:36:51 +08:00
gl: support use legacy format for testing
export QTAV_GL_DEPRECATED=1 always use GL_LUMINANCE etc.
This commit is contained in:
@@ -269,15 +269,15 @@ VideoFrame VideoDecoderVDA::frame()
|
||||
if (pixfmt == NV12) {
|
||||
dtype = GL_UNSIGNED_BYTE;
|
||||
if (plane == 0) {
|
||||
iformat = format = GL_RED;
|
||||
iformat = format = OpenGLHelper::useDeprecatedFormats() ? GL_LUMINANCE : GL_RED;
|
||||
} else {
|
||||
iformat = format = GL_RG;
|
||||
iformat = format = OpenGLHelper::useDeprecatedFormats() ? GL_LUMINANCE_ALPHA : GL_RG;
|
||||
}
|
||||
} else if (pixfmt == UYVY || pixfmt == YUYV) {
|
||||
w /= 2; //rgba texture
|
||||
} else if (pixfmt == YUV420P) {
|
||||
dtype = GL_UNSIGNED_BYTE;
|
||||
iformat = format = GL_RED;
|
||||
iformat = format = OpenGLHelper::useDeprecatedFormats() ? GL_LUMINANCE : GL_RED;
|
||||
}
|
||||
DYGL(glBindTexture(target, *((GLuint*)handle)));
|
||||
CGLError err = CGLTexImageIOSurface2D(CGLGetCurrentContext(), target, iformat, w, h, format, dtype, surface, plane);
|
||||
|
||||
@@ -255,15 +255,15 @@ VideoFrame VideoDecoderVideoToolbox::frame()
|
||||
if (pixfmt == NV12) {
|
||||
dtype = GL_UNSIGNED_BYTE;
|
||||
if (plane == 0) {
|
||||
iformat = format = GL_RED;
|
||||
iformat = format = OpenGLHelper::useDeprecatedFormats() ? GL_LUMINANCE : GL_RED;
|
||||
} else {
|
||||
iformat = format = GL_RG;
|
||||
iformat = format = OpenGLHelper::useDeprecatedFormats() ? GL_LUMINANCE_ALPHA : GL_RG;
|
||||
}
|
||||
} else if (pixfmt == UYVY || pixfmt == YUYV) {
|
||||
w /= 2; //rgba texture
|
||||
} else if (pixfmt == YUV420P) {
|
||||
dtype = GL_UNSIGNED_BYTE;
|
||||
iformat = format = GL_RED;
|
||||
iformat = format = OpenGLHelper::useDeprecatedFormats() ? GL_LUMINANCE : GL_RED;
|
||||
}
|
||||
DYGL(glBindTexture(target, *((GLuint*)handle)));
|
||||
CGLError err = CGLTexImageIOSurface2D(CGLGetCurrentContext(), target, iformat, w, h, format, dtype, surface, plane);
|
||||
|
||||
@@ -39,6 +39,12 @@ int depth16BitTexture()
|
||||
return depth;
|
||||
}
|
||||
|
||||
bool useDeprecatedFormats()
|
||||
{
|
||||
static int v = qgetenv("QTAV_GL_DEPRECATED").toInt() == 1;
|
||||
return v;
|
||||
}
|
||||
|
||||
int GLSLVersion()
|
||||
{
|
||||
static int v = -1;
|
||||
@@ -295,15 +301,19 @@ static const gl_param_t* get_gl_param()
|
||||
else
|
||||
gp = (gl_param_t*)gl_param_desktop_fallback;
|
||||
has_16_tex = has_16;
|
||||
qDebug("using gl_param_desktop%s", gp == gl_param_desktop? "" : "_fallback");
|
||||
return gp;
|
||||
if (!useDeprecatedFormats()) {
|
||||
qDebug("using gl_param_desktop%s", gp == gl_param_desktop? "" : "_fallback");
|
||||
return gp;
|
||||
}
|
||||
} else if (test_gl_param(gl_param_es3[4], &has_16)) {
|
||||
qDebug("using gl_param_es3");
|
||||
gp = (gl_param_t*)gl_param_es3;
|
||||
has_16_tex = has_16;
|
||||
return gp;
|
||||
if (!useDeprecatedFormats()) {
|
||||
qDebug("using gl_param_es3");
|
||||
return gp;
|
||||
}
|
||||
}
|
||||
qDebug("using gl_param_compat");
|
||||
qDebug("fallback to gl_param_compat");
|
||||
gp = (gl_param_t*)gl_param_compat;
|
||||
has_16_tex = false;
|
||||
return gp;
|
||||
|
||||
@@ -159,6 +159,8 @@ bool hasRG();
|
||||
bool has16BitTexture();
|
||||
// set by user (environment var "QTAV_TEXTURE16_DEPTH=8")
|
||||
int depth16BitTexture();
|
||||
// set by user (environment var "QTAV_GL_DEPRECATED=1")
|
||||
bool useDeprecatedFormats();
|
||||
/*!
|
||||
* \brief hasExtension
|
||||
* Current OpenGL context must be valid.
|
||||
|
||||
Reference in New Issue
Block a user