QSGRendererInterface Class
시나리오 그래프의 일부 그래픽 API 특정 내부에 대한 액세스를 제공하는 인터페이스입니다. 더 보기...
Header: | #include <QSGRendererInterface> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Quick) target_link_libraries(mytarget PRIVATE Qt6::Quick) |
qmake: | QT += quick |
공용 타입
enum | GraphicsApi { Unknown, Software, OpenVG, OpenGL, Direct3D11, …, Null } |
enum | RenderMode { RenderMode2D, RenderMode2DNoDepthBuffer, RenderMode3D } |
enum | Resource { DeviceResource, CommandQueueResource, CommandListResource, PainterResource, RhiResource, …, GraphicsQueueIndexResource } |
enum | ShaderCompilationType { RuntimeCompilation, OfflineCompilation } |
flags | ShaderCompilationTypes |
enum | ShaderSourceType { ShaderSourceString, ShaderSourceFile, ShaderByteCode } |
flags | ShaderSourceTypes |
enum | ShaderType { UnknownShadingLanguage, GLSL, HLSL, RhiShader } |
공용 함수
virtual void * | getResource(QQuickWindow *window, QSGRendererInterface::Resource resource) const |
virtual void * | getResource(QQuickWindow *window, const char *resource) const |
virtual QSGRendererInterface::GraphicsApi | graphicsApi() const = 0 |
virtual QSGRendererInterface::ShaderCompilationTypes | shaderCompilationType() const = 0 |
virtual QSGRendererInterface::ShaderSourceTypes | shaderSourceType() const = 0 |
virtual QSGRendererInterface::ShaderType | shaderType() const = 0 |
정적 공용 멤버
bool | isApiRhiBased(QSGRendererInterface::GraphicsApi api) |
상세 설명
렌더러 인터페이스를 통해 시나리오 그래프에서 그래픽 API 특정 기능에 액세스할 수 있습니다. 이러한 내부 기능은 일반적으로 노출되지 않습니다. 그러나 예를 들어 QSGRenderNode 을 통해 커스텀 렌더링을 통합할 때 시나리오 그래프에서 사용하는 그래픽 장치(예: Direct3D 또는 Vulkan 장치)와 같은 특정 값을 쿼리해야 할 수 있습니다.
QSGRendererInterface의 함수에는 다양한 가용성이 있습니다. graphicsApi () 또는 shaderType()와 같은 API 및 언어 쿼리는 항상 사용 가능하므로 QQuickWindow 또는 QQuickView 을 구성하는 것으로 충분하며, 사용 중인 그래픽 API 또는 셰이딩 언어는 QQuickWindow::rendererInterface()를 통해 바로 쿼리할 수 있습니다. 이렇게 하면 예를 들어 shaderType()에 따라 조건부 속성 값이 예기치 않은 값으로 평가되지 않고 GraphicsInfo QML 유형과 같은 유틸리티가 가능한 한 빨리 올바른 값을 보고할 수 있습니다.
하지만 getResource()와 같은 엔진별 접근자는 시나리오가 초기화된 후에만 사용할 수 있습니다. 또한 이러한 함수를 호출할 수 있는 시기에 대한 백엔드별 제한이 있을 수 있습니다. 성공을 보장하는 유일한 방법은 노드의 렌더링(즉, 다음 프레임을 위한 명령 목록 준비)이 활성화되어 있을 때 호출하는 것입니다. 실제로는 일반적으로 QSGRenderNode::render()를 의미합니다.
멤버 유형 문서
enum QSGRendererInterface::GraphicsApi
상수 | 값 | 설명 |
---|---|---|
QSGRendererInterface::Unknown | 0 | 알 수 없는 그래픽 API가 사용 중입니다. |
QSGRendererInterface::Software | 1 | Qt Quick 2D 렌더러가 사용 중입니다. |
QSGRendererInterface::OpenVG | 2 | EGL을 통한 OpenVG |
QSGRendererInterface::OpenGL (since Qt 5.14) | 3 | 그래픽 추상화 레이어를 통한 OpenGL ES 2.0 이상. |
QSGRendererInterface::Direct3D11 (since Qt 5.14) | 4 | 그래픽 추상화 레이어를 통한 Direct3D 11. |
QSGRendererInterface::Direct3D12 (since Qt 6.6) | 8 | 그래픽 추상화 레이어를 통한 Direct3D 12. |
QSGRendererInterface::Vulkan (since Qt 5.14) | 5 | 그래픽 추상화 레이어를 통한 Vulkan 1.0. |
QSGRendererInterface::Metal (since Qt 5.14) | 6 | 그래픽 추상화 레이어를 통한 Metal. |
QSGRendererInterface::Null (since Qt 5.14) | 7 | 그래픽 추상화 레이어를 통해 Null(출력 없음). |
enum QSGRendererInterface::RenderMode
상수 | 값 | 설명 |
---|---|---|
QSGRendererInterface::RenderMode2D | 0 | 일반 2D 렌더링 |
QSGRendererInterface::RenderMode2DNoDepthBuffer | 1 | 뎁스 버퍼가 비활성화된 일반 2D 렌더링 |
QSGRendererInterface::RenderMode3D | 2 | 씬이 3D 그래프의 일부로 렌더링됩니다. |
enum QSGRendererInterface::Resource
상수 | 값 | 설명 |
---|---|---|
QSGRendererInterface::DeviceResource | 0 | 리소스는 해당되는 경우 그래픽 디바이스에 대한 포인터입니다. 예를 들어 VkDevice * , MTLDevice * 또는 ID3D11Device * 입니다. Vulkan에서는 반환되는 값이 핸들 자체가 아니라 VkDevice에 대한 포인터라는 점에 유의하세요. 이는 Vulkan 핸들이 포인터가 아닐 수 있고 아키텍처의 포인터 크기와 다른 크기를 사용할 수 있으므로 단순히 void * 로/에서 캐스팅하는 것은 잘못이기 때문입니다. |
QSGRendererInterface::CommandQueueResource | 1 | 리소스는 해당되는 경우 시나리오에서 사용하는 그래픽 명령어 대기열에 대한 포인터입니다. 예를 들어 VkQueue * 또는 MTLCommandQueue * . Vulkan에서는 반환되는 값이 핸들 자체가 아니라 VkQueue에 대한 포인터라는 점에 유의하세요. |
QSGRendererInterface::CommandListResource | 2 | 리소스는 해당되는 경우 시나리오에서 사용하는 명령 목록 또는 버퍼에 대한 포인터입니다. 예를 들어 VkCommandBuffer * 또는 MTLCommandBuffer * . 이 객체는 유효성이 제한되어 있으며 씬 그래프가 다음 프레임을 준비하는 동안에만 유효합니다. Vulkan에서 반환되는 값은 핸들 자체가 아니라 VkCommandBuffer에 대한 포인터라는 점에 유의하세요. |
QSGRendererInterface::PainterResource | 3 | 리소스는 소프트웨어 백엔드로 실행할 때 씬 그래프에서 사용하는 활성 QPainter 에 대한 포인터입니다. |
QSGRendererInterface::RhiResource (since Qt 5.14) | 4 | 리소스는 해당되는 경우 시나리오 그래프에서 사용하는 QRhi 인스턴스에 대한 포인터입니다. |
QSGRendererInterface::RhiSwapchainResource (since Qt 6.0) | 5 | 리소스는 창과 연결된 QRhiSwapchain 인스턴스에 대한 포인터입니다. 창이 QQuickRenderControl 와 함께 사용되는 경우 이 값은 null입니다. |
QSGRendererInterface::RhiRedirectCommandBuffer (since Qt 6.0) | 6 | 리소스는 창과 연결된 QRhiCommandBuffer 인스턴스 및 해당 QQuickRenderControl 에 대한 포인터입니다. 창이 QQuickRenderControl. |
QSGRendererInterface::RhiRedirectRenderTarget (since Qt 6.0) | 7 | 리소스는 창 및 해당 창과 연결된 QRhiTextureRenderTarget 인스턴스 및 해당 QQuickRenderControl 에 대한 포인터입니다. 창이 QQuickRenderControl 에 연결되지 않은 경우 값은 null입니다. 이 값은 항상 메인 텍스처 렌더 타깃을 반영하며 Qt Quick 장면에 의존하지 않으므로 ShaderEffect 또는 QQuickItem 레이어에서 생성된 추가 텍스처 타깃팅 렌더 패스를 고려하지 않습니다. |
QSGRendererInterface::PhysicalDeviceResource (since Qt 5.14) | 8 | 리소스는 해당되는 경우 시나리오 그래프에서 사용하는 물리적 디바이스 오브젝트에 대한 포인터입니다. 예를 들어 VkPhysicalDevice * . Vulkan의 경우 반환되는 값은 핸들 자체가 아니라 VkPhysicalDevice에 대한 포인터입니다. |
QSGRendererInterface::OpenGLContextResource (since Qt 5.14) | 9 | 리소스는 해당되는 경우 시나리오 그래프(렌더 스레드에서)에서 사용하는 QOpenGLContext 에 대한 포인터입니다. |
QSGRendererInterface::DeviceContextResource (since Qt 5.14) | 10 | 리소스는 해당되는 경우 시나리오 그래프에서 사용하는 디바이스 컨텍스트에 대한 포인터입니다. 예를 들어 ID3D11DeviceContext * . |
QSGRendererInterface::CommandEncoderResource (since Qt 5.14) | 11 | 리소스는 해당되는 경우 시나리오 그래프에서 사용하는 현재 활성 렌더링 명령 인코더 객체에 대한 포인터입니다. 예: MTLRenderCommandEncoder * . 이 오브젝트는 유효성이 제한되며 씬 그래프가 다음 프레임에 대한 렌더 패스를 기록하는 동안에만 유효합니다. |
QSGRendererInterface::VulkanInstanceResource (since Qt 5.14) | 12 | 리소스는 해당되는 경우 시나리오 그래프에서 사용하는 QVulkanInstance 에 대한 포인터입니다. |
QSGRendererInterface::RenderPassResource (since Qt 5.14) | 13 | 리소스는 시나리오 그래프에서 사용하는 메인 렌더 패스에 대한 포인터로, 색상 및 깊이/스테실 어태치먼트와 그 사용 방법을 설명합니다. 예를 들어 VkRenderPass * . 이 값은 항상 메인 렌더 대상(화면 창 또는 QQuickRenderControl 리디렉션되는 텍스처)을 반영하며 Qt Quick 장면에 의존하지 않으므로 ShaderEffect 또는 QQuickItem 레이어에서 생성된 추가 텍스처 타깃팅 렌더 패스를 고려하지 않습니다. |
QSGRendererInterface::RedirectPaintDevice (since Qt 6.4) | 14 | 리소스는 창과 해당 창에 연결된 QPaintDevice 인스턴스 및 QQuickRenderControl 에 대한 포인터입니다. 창이 QQuickRenderControl 에 연결되지 않은 경우 이 값은 null입니다. |
QSGRendererInterface::GraphicsQueueFamilyIndexResource (since Qt 6.6) | 15 | 리소스는 해당되는 경우 시나리오 그래프에서 사용하는 그래픽 큐 패밀리 인덱스에 대한 포인터입니다. Vulkan에서는 uint32_t 인덱스 값에 대한 포인터입니다. |
QSGRendererInterface::GraphicsQueueIndexResource (since Qt 6.6) | 16 | 리소스는 해당되는 경우 시나리오 그래프에서 사용하는 그래픽스 큐 인덱스(uint32_t)에 대한 포인터입니다. Vulkan에서는 uint32_t 인덱스 값에 대한 포인터이며, 실제로는 CommandQueueResource 에 대해 보고된 VkQueue의 인덱스입니다. |
열거형 QSGRendererInterface::ShaderCompilationType
플래그 QSGRendererInterface::ShaderCompilationTypes
Constant | 값 | 설명 |
---|---|---|
QSGRendererInterface::RuntimeCompilation | 0x01 | 셰이더 소스 코드의 런타임 컴파일이 지원됩니다. |
QSGRendererInterface::OfflineCompilation | 0x02 | 사전 컴파일된 바이트코드 지원 |
ShaderCompilationTypes 유형은 QFlags<ShaderCompilationType>에 대한 typedef입니다. ShaderCompilationType 값의 OR 조합을 저장합니다.
열거형 QSGRendererInterface::ShaderSourceType
플래그 QSGRendererInterface::ShaderSourceTypes
Constant | 값 | 설명 |
---|---|---|
QSGRendererInterface::ShaderSourceString | 0x01 | 셰이더 소스는 다음의 해당 프로퍼티에 스트링으로 제공될 수 있습니다. ShaderEffect |
QSGRendererInterface::ShaderSourceFile | 0x02 | 셰이더 소스 코드가 포함된 로컬 또는 리소스 파일이 지원됩니다. |
QSGRendererInterface::ShaderByteCode | 0x04 | 셰이더 바이트코드가 포함된 로컬 또는 리소스 파일이 지원됩니다. |
ShaderSourceTypes 유형은 QFlags<ShaderSourceType>에 대한 typedef입니다. ShaderSourceType 값의 OR 조합을 저장합니다.
enum QSGRendererInterface::ShaderType
상수 | 값 | 설명 |
---|---|---|
QSGRendererInterface::UnknownShadingLanguage | 0 | 연결된 창 및 시나리오 그래프가 없기 때문에 아직 알 수 없습니다. |
QSGRendererInterface::GLSL | 1 | GLSL 또는 GLSL ES |
QSGRendererInterface::HLSL | 2 | HLSL |
QSGRendererInterface::RhiShader (since Qt 5.14) | 3 | 여러 대상 언어 및 중간 형식에 대한 셰이더 변형을 포함하는 QShader 인스턴스를 사용합니다. |
멤버 함수 문서
[virtual]
void *QSGRendererInterface::getResource(QQuickWindow *window, QSGRendererInterface::Resource resource) const
window 에서 그래픽 resource 을 쿼리합니다. 해당 리소스가 지원되지 않거나 사용할 수 없는 경우 null을 반환합니다.
성공하면 반환되는 포인터는 인터페이스에 대한 직접 포인터이거나 먼저 역참조해야 하는 불투명 핸들에 대한 포인터입니다(예: VkDevice dev = *static_cast<VkDevice *>(result)
). 후자는 이러한 핸들의 크기가 포인터와 다를 수 있으므로 필요합니다.
참고: 반환된 포인터의 소유권은 호출자에게 절대 이전되지 않습니다.
참고: 이 함수는 렌더링 스레드에서만 호출해야 합니다.
[virtual]
void *QSGRendererInterface::getResource(QQuickWindow *window, const char *resource) const
그래픽 리소스를 쿼리합니다. resource 은 백엔드 전용 키입니다. 이를 통해 리소스 열거형에 나열되지 않은 향후 리소스를 지원할 수 있습니다.
참고: 반환된 포인터의 소유권은 호출자에게 이전되지 않습니다.
참고: 이 함수는 렌더링 스레드에서만 호출해야 합니다.
[pure virtual]
QSGRendererInterface::GraphicsApi QSGRendererInterface::graphicsApi() const
Qt Quick 시나리오에서 사용 중인 그래픽 API를 반환합니다.
참고: 이 함수는 모든 스레드에서 호출할 수 있습니다.
[static]
bool QSGRendererInterface::isApiRhiBased(QSGRendererInterface::GraphicsApi api)
api 가 네이티브 그래픽 API를 직접 호출하는 대신 그래픽 추상화 레이어(QRhi)를 기반으로 하는 경우 true를 반환합니다.
참고: 이 함수는 모든 스레드에서 호출할 수 있습니다.
[pure virtual]
QSGRendererInterface::ShaderCompilationTypes QSGRendererInterface::shaderCompilationType() const
애플리케이션이 사용 중인 Qt Quick 백엔드에서 지원하는 셰이더 컴파일 접근 방식의 비트마스크를 반환합니다.
참고: 이 함수는 모든 스레드에서 호출할 수 있습니다.
QtQuick::GraphicsInfo 를참조하세요 .
[pure virtual]
QSGRendererInterface::ShaderSourceTypes QSGRendererInterface::shaderSourceType() const
ShaderEffect 항목에서 셰이더 소스를 제공하는 지원되는 방법의 비트마스크를 반환합니다.
참고: 이 함수는 모든 스레드에서 호출할 수 있습니다.
QtQuick::GraphicsInfo 를참조하세요 .
[pure virtual]
QSGRendererInterface::ShaderType QSGRendererInterface::shaderType() const
애플리케이션이 사용 중인 Qt Quick 백엔드에서 지원하는 셰이딩 언어를 반환합니다.
참고: 이 함수는 모든 스레드에서 호출할 수 있습니다.
QtQuick::GraphicsInfo 를참조하세요 .
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.