이 페이지에서

QRhiRenderPassDescriptor Class

렌더 패스 리소스. 더 보기...

헤더: #include <rhi/qrhi.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS GuiPrivate)
target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate)
qmake: QT += gui-private
다음부터: Qt 6.6
상속: QRhiResource

공개 함수

virtual bool isCompatible(const QRhiRenderPassDescriptor *other) const = 0
virtual const QRhiNativeHandles *nativeHandles()
virtual QRhiRenderPassDescriptor *newCompatibleRenderPassDescriptor() const = 0
virtual QVector<quint32> serializedFormat() const = 0

재구현된 공용 함수

virtual QRhiResource::Type resourceType() const override

상세 설명

렌더 패스(해당 개념이 기본 그래픽 API에 존재하는 경우)는 어태치먼트(색상, 깊이, 스텐실)의 모음이며, 이러한 어태치먼트가 어떻게 사용되는지를 설명합니다.

참고: 이는 호환성 보장이 제한적인 RHI API입니다. 자세한 내용은 QRhi 를 참조하십시오.

멤버 함수 문서

[pure virtual] bool QRhiRenderPassDescriptor::isCompatible(const QRhiRenderPassDescriptor *other) const

other ( QRhiRenderPassDescriptor )가 이 렌더패스와 호환되는 경우 true를 반환합니다. 즉, this 와 other 는 QRhiGraphicsPipeline::setRenderPassDescriptor()에서 상호 교환하여 사용할 수 있습니다.

렌더패스 디스크립터의 호환성 개념은 QRhiShaderResourceBindings 인스턴스의 layout compatibility 과 유사합니다. 이를 통해 QRhiGraphicsPipeline 인스턴스를 더 효율적으로 재사용할 수 있습니다. 예를 들어, QRhiGraphicsPipeline 인스턴스 캐시는 단순히 포인터를 비교하는 대신 이러한 함수를 사용하여 일치하는 파이프라인을 찾게 되며, 따라서 호환되는 한 서로 다른 QRhiRenderPassDescriptor 와 QRhiShaderResourceBindings 를 파이프라인과 함께 사용할 수 있습니다.

호환성에 대한 정확한 세부 사항은 기본 그래픽 API에 따라 다릅니다. 동일한 QRhiTextureRenderTarget 에서 생성된 두 개의 렌더패스 디스크립터 created 는 항상 호환됩니다.

QRhiShaderResourceBindings 와 마찬가지로, 두 개의 기존 객체가 없더라도 호환성을 테스트할 수 있습니다. serializedFormat()를 호출하여 불투명한 블롭을 추출하면, 반환된 벡터를 다른 QRhiRenderPassDescriptor 의 serializedFormat()와 비교하여 호환성을 테스트할 수 있습니다. 이는 특정 상황에서 이점이 있는데, 파이프라인이 원래 구축된 QRhiRenderPassDescriptor 가 더 이상 사용할 수 없더라도(단, serializedFormat()에서 반환된 데이터는 여전히 사용 가능한 경우), QRhiRenderPassDescriptor 와 QRhiGraphicsPipeline 의 호환성을 테스트할 수 있기 때문입니다.

newCompatibleRenderPassDescriptor() 및 serializedFormat()도 참조하십시오 .

[virtual] const QRhiNativeHandles *QRhiRenderPassDescriptor::nativeHandles()

QRhiVulkanRenderPassNativeHandles 와 같이 백엔드별 QRhiNativeHandles 하위 클래스에 대한 포인터를 반환합니다. 백엔드에서 기본 네이티브 리소스의 노출을 지원하지 않는 경우, 반환 값은 nullptr 입니다.

QRhiVulkanRenderPassNativeHandles도 참조하십시오 .

[pure virtual] QRhiRenderPassDescriptor *QRhiRenderPassDescriptor::newCompatibleRenderPassDescriptor() const

이 객체와 compatible 인 새로운 QRhiRenderPassDescriptor 객체를 반환합니다.

이 함수를 사용하면 ` QRhiRenderPassDescriptor` 객체를 복제할 수 있습니다. 반환된 객체는 바로 사용할 수 있으며, 소유권은 호출자에게 이전됩니다. QRhiRenderPassDescriptor 객체를 복제하는 것은 객체가 그래픽 파이프라인과 관련된 데이터 구조에 저장되어 있는 경우(렌더패스 디스크립터 객체가 필요한 새로운 파이프라인을 생성할 수 있도록 하기 위해)나, 렌더 타깃에서 생성된 렌더패스 디스크립터의 수명이 파이프라인보다 짧을 수 있는 상황에서 유용할 수 있습니다. (예를 들어, 엔진이 렌더패스를 이를 생성한 텍스처 및 렌더 타깃과 함께 관리하고 소멸시키기 때문입니다.) 이러한 상황에서는 복제된 버전을 데이터 구조에 저장하고, 소유권도 함께 이전하는 것이 유리할 수 있습니다.

isCompatible()도 참조하십시오 .

[override virtual] QRhiResource::Type QRhiRenderPassDescriptor::resourceType() const

QRhiResource::resourceType() const를 재구현합니다.

리소스 유형을 반환합니다.

[pure virtual] QVector<quint32> QRhiRenderPassDescriptor::serializedFormat() const

compatibility 와 관련된 데이터를 설명하는 불투명한 블롭을 포함하는 정수 벡터를 반환합니다.

두 개의 QRhiRenderPassDescriptor 객체 rp1 와 rp2 가 주어졌을 때, 이 함수에서 반환된 데이터가 동일하다면 rp1->isCompatible(rp2) 가 성립하며, 그 반대의 경우도 마찬가지로 성립합니다.

참고: 반환된데이터는 해당 객체가 속한 QRhi 의 수명 기간 동안 메모리에 저장하거나 비교하는 용도로 사용되어야 합니다. 디스크에 저장하거나, 프로세스 간에 재사용하거나, 백엔드가 서로 다를 수 있는 여러 QRhi 인스턴스와 함께 사용하는 용도로는 의도되지 않았습니다.

참고: 백엔드는 이 함수 내에서 데이터를 계산하는 것이 아니라 이미 계산된 일련의 데이터를 반환하도록 설계되었으므로, 이 함수호출은 비용이 적게 드는 작업으로 간주됩니다.

라이브러리의 일부로 재사용 가능한 컴포넌트를 생성할 때, 라이브러리 클라이언트가 관리하는 렌더 타겟( QRhiRenderTarget, 스왑체인(swapchain)이든 텍스처(texture)이든)을 대상으로 그래픽 파이프라인이 생성 및 유지되는 경우, 해당 컴포넌트는 변화하는 렌더 타겟( QRhiRenderPassDescriptor)을 처리할 수 있어야 합니다. 예를 들어, 렌더 타겟이 변경되면 색상 형식이나 첨부 파일(attachments)이 달라질 가능성이 있어, 이전에 QRhiRenderPassDescriptor (적어도 새로운 렌더 타겟에 대해서는)가 무효화될 수 있습니다. 또는 variable rate shading 가 동적으로 사용되기 시작할 수도 있습니다. 이를 처리하는 데 도움이 되는 간단한 패턴은 매 프레임마다 다음 검사를 수행하여, 이전 프레임과 비교했을 때 렌더 타겟에 변화가 있어 파이프라인을 새로운 QRhiRenderPassDescriptor 에 연결해야 하는 경우를 식별하는 것입니다:

QRhiRenderPassDescriptor *rp = m_renderTarget->renderPassDescriptor();
if (m_pipeline && rp->serializedFormat() != m_renderPassFormat) {
    m_pipeline->setRenderPassDescriptor(rp);
    m_renderPassFormat = rp->serializedFormat();
    m_pipeline->create();
}
// remember to store m_renderPassFormat also when creating m_pipeline the first time

isCompatible()도 참조하십시오 .

© 2026 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.