5#include <QtWaylandClient/private/qwaylanddisplay_p.h>
7#include <QtOpenGL/QOpenGLTexture>
8#include <QtGui/QOpenGLContext>
9#include <QtGui/qopengl.h>
10#include <QtGui/QImage>
11#include <QtCore/QCoreApplication>
18#ifdef VULKAN_SERVER_BUFFER_EXTRA_DEBUG
24#define DECL_GL_FUNCTION(name, type) \
27#define FIND_GL_FUNCTION(name, type) \
29 name = reinterpret_cast<type>(glContext->getProcAddress(#name)); \
31 qWarning() << "ERROR in GL proc lookup. Could not find " #name; \
74 : m_integration(integration)
77 , m_memorySize(memory_size)
92 funcs->glDeleteMemoryObjectsEXT(1, &m_memoryObject);
94 qt_server_buffer_release(m_server_buffer);
95 qt_server_buffer_destroy(m_server_buffer);
98void VulkanServerBuffer::import()
112 funcs->glCreateMemoryObjectsEXT(1, &m_memoryObject);
141 display->addRegistryListener(&wlDisplayHandleGlobal,
this);
149void VulkanServerBufferIntegration::wlDisplayHandleGlobal(
void *
data, ::wl_registry *registry, uint32_t
id,
const QString &
interface, uint32_t version)
152 if (
interface ==
"zqt_vulkan_server_buffer_v1") {
154 integration->QtWayland::zqt_vulkan_server_buffer_v1::init(registry,
id, 1);
162 qt_server_buffer_set_user_data(
id, server_buffer);
168 qWarning(
"VulkanServerBufferIntegration::deleteOrphanedTextures with no current context!");
172 orphanedTextures.
clear();
static bool closingDown()
Returns true if the application objects are being destroyed; otherwise returns false.
static QOpenGLContext * currentContext()
Returns the last context which called makeCurrent in the current thread, or \nullptr,...
bool create()
Creates the underlying OpenGL texture object.
void bind()
Binds this texture to the currently active texture unit ready for rendering.
GLuint textureId() const
Returns the name of the underlying OpenGL texture object or 0 if it has not yet been created.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
\macro QT_RESTRICTED_CAST_FROM_ASCII
void deleteGLTextureWhenPossible(QOpenGLTexture *texture)
void initialize(QWaylandDisplay *display) override
void deleteOrphanedTextures()
QWaylandServerBuffer * serverBuffer(struct qt_server_buffer *buffer) override
void zqt_vulkan_server_buffer_v1_server_buffer_created(qt_server_buffer *id, int32_t fd, uint32_t width, uint32_t height, uint32_t memory_size, uint32_t format) override
VulkanServerBuffer(VulkanServerBufferIntegration *integration, struct ::qt_server_buffer *id, int32_t fd, uint32_t width, uint32_t height, uint32_t memory_size, uint32_t format)
QOpenGLTexture * toOpenGlTexture() override
~VulkanServerBuffer() override
#define FIND_GL_FUNCTION(name, type)
qDeleteAll(list.begin(), list.end())
struct wl_display * display
Combined button and popup list for selecting options.
static VulkanServerBufferGlFunctions * funcs
static constexpr bool sbiExtraDebug
QTextStream & hex(QTextStream &stream)
Calls QTextStream::setIntegerBase(16) on stream and returns stream.
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char * interface
#define GL_HANDLE_TYPE_OPAQUE_FD_EXT
GLint GLsizei GLsizei height
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
DECL_GL_FUNCTION(glTexStorageMem2DEXT, PFNGLTEXSTORAGEMEM2DEXTPROC)
bool init(QOpenGLContext *glContext)
DECL_GL_FUNCTION(glTextureStorageMem2DEXT, PFNGLTEXTURESTORAGEMEM2DEXTPROC)
DECL_GL_FUNCTION(glCreateMemoryObjectsEXT, PFNGLCREATEMEMORYOBJECTSEXTPROC)
DECL_GL_FUNCTION(glImportMemoryFdEXT, PFNGLIMPORTMEMORYFDEXTPROC)
static bool create(QOpenGLContext *glContext)
DECL_GL_FUNCTION(glDeleteMemoryObjectsEXT, PFNGLDELETEMEMORYOBJECTSEXTPROC)