platformsupport/scenes/opengl: don't crash when creating the texture fails
This commit is contained in:
parent
985f0edf88
commit
9e03a219cb
1 changed files with 5 additions and 3 deletions
|
@ -103,16 +103,18 @@ void BasicEGLSurfaceTextureWayland::updateShmTexture(GraphicsBuffer *buffer, con
|
||||||
|
|
||||||
bool BasicEGLSurfaceTextureWayland::loadDmabufTexture(GraphicsBuffer *buffer)
|
bool BasicEGLSurfaceTextureWayland::loadDmabufTexture(GraphicsBuffer *buffer)
|
||||||
{
|
{
|
||||||
auto createTexture = [this](EGLImageKHR image, const QSize &size, bool isExternalOnly) {
|
auto createTexture = [this](EGLImageKHR image, const QSize &size, bool isExternalOnly) -> std::shared_ptr<GLTexture> {
|
||||||
if (Q_UNLIKELY(image == EGL_NO_IMAGE_KHR)) {
|
if (Q_UNLIKELY(image == EGL_NO_IMAGE_KHR)) {
|
||||||
qCritical(KWIN_OPENGL) << "Invalid dmabuf-based wl_buffer";
|
qCritical(KWIN_OPENGL) << "Invalid dmabuf-based wl_buffer";
|
||||||
return std::shared_ptr<GLTexture>();
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLint target = isExternalOnly ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
|
GLint target = isExternalOnly ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D;
|
||||||
auto texture = std::make_shared<GLTexture>(target);
|
auto texture = std::make_shared<GLTexture>(target);
|
||||||
texture->setSize(size);
|
texture->setSize(size);
|
||||||
texture->create();
|
if (!texture->create()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
texture->setWrapMode(GL_CLAMP_TO_EDGE);
|
texture->setWrapMode(GL_CLAMP_TO_EDGE);
|
||||||
texture->setFilter(GL_LINEAR);
|
texture->setFilter(GL_LINEAR);
|
||||||
texture->bind();
|
texture->bind();
|
||||||
|
|
Loading…
Reference in a new issue