Fix texture format handling for Nvidia driver

This commit is contained in:
Severin von Wnuck 2021-09-17 13:28:13 +02:00
parent b219b9175c
commit bd9b42912b

View file

@ -36,12 +36,16 @@ DrmClientBuffer::DrmClientBuffer(wl_resource *resource, DrmClientBufferIntegrati
Q_D(DrmClientBuffer);
EGLDisplay eglDisplay = integration->display()->eglDisplay();
eglQueryWaylandBufferWL(eglDisplay, resource, EGL_TEXTURE_FORMAT, &d->textureFormat);
if (!eglQueryWaylandBufferWL(eglDisplay, resource, EGL_TEXTURE_FORMAT, &d->textureFormat)) {
// The proprietary Nvidia driver doesn't support querying the EGL_TEXTURE_FORMAT.
// We must assume that the buffer has an alpha channel for transparency to work.
d->textureFormat = EGL_TEXTURE_RGBA;
}
eglQueryWaylandBufferWL(eglDisplay, resource, EGL_WIDTH, &d->width);
eglQueryWaylandBufferWL(eglDisplay, resource, EGL_HEIGHT, &d->height);
bool ok = eglQueryWaylandBufferWL(eglDisplay, resource, EGL_WAYLAND_Y_INVERTED_WL, &d->yInverted);
if (!ok) {
if (!eglQueryWaylandBufferWL(eglDisplay, resource, EGL_WAYLAND_Y_INVERTED_WL, &d->yInverted)) {
// If EGL_WAYLAND_Y_INVERTED_WL is unsupported, we must assume that the buffer is inverted.
d->yInverted = true;
}