42 bool init(QOpenGLContext *glContext)
52 static bool create(QOpenGLContext *glContext);
111 : QtWayland::ServerBuffer(qimage.size(),format)
112 , m_integration(integration)
113 , m_width(qimage.width())
114 , m_height(qimage.height())
119 m_glInternalFormat = GL_RGBA8;
125 qWarning(
"VulkanServerBuffer: unsupported format");
126 m_glInternalFormat = GL_RGBA8;
157 auto *bufferResource = resourceMap().value(client);
158 if (!bufferResource) {
159 auto integrationResource = m_integration->resourceMap().value(client);
160 if (!integrationResource) {
161 qWarning(
"VulkanServerBuffer::resourceForClient: Trying to get resource for ServerBuffer. But client is not bound to the vulkan interface");
164 struct ::wl_resource *shm_integration_resource = integrationResource->handle;
165 Resource *resource = add(client, 1);
166 m_integration->send_server_buffer_created(shm_integration_resource, resource->handle, m_fd, m_width, m_height, m_memorySize, m_glInternalFormat);
167 return resource->handle;
169 return bufferResource->handle;
174 if (m_texture && m_texture->isCreated())
182 funcs->glCreateMemoryObjectsEXT(1, &m_memoryObject);
183 if (vsbiExtraDebug) qDebug() <<
"glCreateMemoryObjectsEXT" << Qt::hex << glGetError();
186 int dupfd = fcntl(m_fd, F_DUPFD_CLOEXEC, 0);
188 perror(
"VulkanServerBuffer::toOpenGlTexture() Could not dup fd:");
192 funcs->glImportMemoryFdEXT(m_memoryObject, m_memorySize, GL_HANDLE_TYPE_OPAQUE_FD_EXT, dupfd);
193 if (vsbiExtraDebug) qDebug() <<
"glImportMemoryFdEXT" << Qt::hex << glGetError();
197 m_texture =
new QOpenGLTexture(QOpenGLTexture::Target2D);
200 GLuint texId = m_texture->textureId();
201 if (vsbiExtraDebug) qDebug() <<
"created texture" << texId << Qt::hex << glGetError();
204 if (vsbiExtraDebug) qDebug() <<
"bound texture" << texId << Qt::hex << glGetError();
205 funcs->glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, m_glInternalFormat, m_size.width(), m_size.height(), m_memoryObject, 0 );
206 if (vsbiExtraDebug) qDebug() <<
"glTexStorageMem2DEXT" << Qt::hex << glGetError();
207 if (vsbiExtraDebug) qDebug() <<
"format" << Qt::hex << m_glInternalFormat << GL_RGBA8;
274 uint glInternalFormat)
276 if (!m_vulkanWrapper) {
281 auto *vImage = m_vulkanWrapper->createTextureImageFromData(
282 reinterpret_cast<
const uchar *>(view.constData()), view.size(), size, glInternalFormat);
287 qCWarning(qLcWaylandCompositorHardwareIntegration) <<
"could not load compressed texture";
QOpenGLContext * context()