Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
6.5.3
-
None
Description
I've been working on integrating a custom Metal-based renderer with Qt's scenegraph. I've had previous success with the OpenGL & DirectX11 backends.
I've encountered a problem that the following call:
tx.nativeInterface<QNativeInterface::QSGMetalTexture>();
always returns a null pointer. I've confirmed that Qt uses Metal as the Rhi backend:
qt.scenegraph.general: Creating QRhi with backend Metal for window 0x600001e8afa0 (wflags 0x1)
Some investigation revealed that the required m_metalTextureAccessor field is initialized to NULL, because the initializer is inside an #if defined(_OBJC_) block, while the qsgtexture.cpp file is compiled as C++. Link to offending line.
The bug was introduced in commit 28005c0c037626d5601192e2a412633656d52b39. While protecting the interface by ifdef(_OBJC_) makes good sense in headers, it fails to serve its purpose when placed in cpp files.
Attachments
Issue Links
- duplicates
-
QTBUG-108019 QSGTexture::nativeInterface() doesn't work for QSGMetalTexture
-
- Closed
-