41 bool init(QOpenGLContext *glContext)
51 static bool create(QOpenGLContext *glContext);
110 : QtWayland::ServerBuffer(qimage.size(),format)
111 , m_integration(integration)
112 , m_width(qimage.width())
113 , m_height(qimage.height())
118 m_glInternalFormat = GL_RGBA8;
124 qWarning(
"VulkanServerBuffer: unsupported format");
125 m_glInternalFormat = GL_RGBA8;
156 auto *bufferResource = resourceMap().value(client);
157 if (!bufferResource) {
158 auto integrationResource = m_integration->resourceMap().value(client);
159 if (!integrationResource) {
160 qWarning(
"VulkanServerBuffer::resourceForClient: Trying to get resource for ServerBuffer. But client is not bound to the vulkan interface");
163 struct ::wl_resource *shm_integration_resource = integrationResource->handle;
164 Resource *resource = add(client, 1);
165 m_integration->send_server_buffer_created(shm_integration_resource, resource->handle, m_fd, m_width, m_height, m_memorySize, m_glInternalFormat);
166 return resource->handle;
168 return bufferResource->handle;
173 if (m_texture && m_texture->isCreated())
181 funcs->glCreateMemoryObjectsEXT(1, &m_memoryObject);
182 if (vsbiExtraDebug) qDebug() <<
"glCreateMemoryObjectsEXT" << Qt::hex << glGetError();
185 int dupfd = fcntl(m_fd, F_DUPFD_CLOEXEC, 0);
187 perror(
"VulkanServerBuffer::toOpenGlTexture() Could not dup fd:");
191 funcs->glImportMemoryFdEXT(m_memoryObject, m_memorySize, GL_HANDLE_TYPE_OPAQUE_FD_EXT, dupfd);
192 if (vsbiExtraDebug) qDebug() <<
"glImportMemoryFdEXT" << Qt::hex << glGetError();
196 m_texture =
new QOpenGLTexture(QOpenGLTexture::Target2D);
199 GLuint texId = m_texture->textureId();
200 if (vsbiExtraDebug) qDebug() <<
"created texture" << texId << Qt::hex << glGetError();
203 if (vsbiExtraDebug) qDebug() <<
"bound texture" << texId << Qt::hex << glGetError();
204 funcs->glTexStorageMem2DEXT(GL_TEXTURE_2D, 1, m_glInternalFormat, m_size.width(), m_size.height(), m_memoryObject, 0 );
205 if (vsbiExtraDebug) qDebug() <<
"glTexStorageMem2DEXT" << Qt::hex << glGetError();
206 if (vsbiExtraDebug) qDebug() <<
"format" << Qt::hex << m_glInternalFormat << GL_RGBA8;
273 uint glInternalFormat)
275 if (!m_vulkanWrapper) {
280 auto *vImage = m_vulkanWrapper->createTextureImageFromData(
281 reinterpret_cast<
const uchar *>(view.constData()), view.size(), size, glInternalFormat);
286 qCWarning(qLcWaylandCompositorHardwareIntegration) <<
"could not load compressed texture";
QOpenGLContext * context()