QRhiTextureUploadDescription Class

텍스처 업로드 작업에 대해 설명합니다. 더 보기...

헤더: #include <rhi/qrhi.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate)
qmake: QT += gui-private
이후: Qt 6.6

공용 함수

QRhiTextureUploadDescription()
QRhiTextureUploadDescription(const QRhiTextureUploadEntry &entry)
QRhiTextureUploadDescription(std::initializer_list<QRhiTextureUploadEntry> list)
const QRhiTextureUploadEntry *cbeginEntries() const
const QRhiTextureUploadEntry *cendEntries() const
const QRhiTextureUploadEntry *entryAt(qsizetype index) const
qsizetype entryCount() const
void setEntries(std::initializer_list<QRhiTextureUploadEntry> list)
void setEntries(InputIterator first, InputIterator last)

자세한 설명

QRhiResourceUpdateBatch::uploadTexture()와 함께 사용됩니다. 이 함수에는 QImage 와 QRhiTextureUploadDescription을 취하는 두 가지 변형이 있습니다. 전자는 내부적으로 레이어 0에 대해 레벨 0을 타겟팅하는 단일 이미지로 QRhiTextureUploadDescription을 생성하는 편의 버전입니다.

QImage 의 콘텐츠를 일치하는 픽셀 크기로 QRhiTexture 에 업로드하려는 일반적이고 간단한 경우를 예로 들어 보겠습니다:

QImage image(256, 256, QImage::Format_RGBA8888);
image.fill(Qt::green); // or could use a QPainter targeting image
QRhiTexture *texture = rhi->newTexture(QRhiTexture::RGBA8, QSize(256, 256));
texture->create();
QRhiResourceUpdateBatch *u = rhi->nextResourceUpdateBatch();
u->uploadTexture(texture, image);

큐브맵, 미리 생성된 밉 이미지, 압축 텍스처 또는 부분 업로드가 포함된 경우 애플리케이션은 이 클래스를 대신 사용해야 합니다.

또한 일괄 업로드를 지정할 수 있어 아틀라스 또는 글리프 캐시 텍스처를 생성할 때 유용합니다. 동일한 하위 리소스(동일한 레이어와 레벨을 의미)에 대한 여러 부분 업로드가 지원되며 백엔드 및 기본 그래픽 API에 따라 각각의 개별 uploadTexture() 명령을 실행하는 대신 동일한 QRhiTextureUploadDescription으로 일괄 처리하는 것이 더 효율적일 수 있습니다.

참고: 큐브맵에는 +X, -X, +Y, -Y, +Z, -Z 순서로 6개의 면마다 하나의 레이어가 있습니다.

예를 들어 큐브맵의 면을 지정하면 다음과 같이 보일 수 있습니다:

QImage faces[6];
// ...
QVarLengthArray<QRhiTextureUploadEntry, 6> entries;
for (int i = 0; i < 6; ++i)
  entries.append(QRhiTextureUploadEntry(i, 0, faces[i]));
QRhiTextureUploadDescription desc;
desc.setEntries(entries.cbegin(), entries.cend());
resourceUpdates->uploadTexture(texture, desc);

압축 텍스처의 밉 이미지를 지정하는 또 다른 예시입니다:

QList<QRhiTextureUploadEntry> entries;
const int mipCount = rhi->mipLevelsForSize(compressedTexture->pixelSize());
for (int level = 0; level < mipCount; ++level) {
    const QByteArray compressedDataForLevel = ..
    entries.append(QRhiTextureUploadEntry(0, level, compressedDataForLevel));
}
QRhiTextureUploadDescription desc;
desc.setEntries(entries.cbegin(), entries.cend());
resourceUpdates->uploadTexture(compressedTexture, desc);

동일한 하위 리소스를 대상으로 하는 부분 업로드의 경우, 가능하면 하나의 업로드 요청으로 일괄 처리하는 것이 좋습니다:

QRhiTextureSubresourceUploadDescription subresDesc(image);
subresDesc.setSourceSize(QSize(10, 10));
subResDesc.setDestinationTopLeft(QPoint(50, 40));
QRhiTextureUploadEntry entry(0, 0, subresDesc); // layer 0, level 0

QRhiTextureSubresourceUploadDescription subresDesc2(image);
subresDesc2.setSourceSize(QSize(30, 40));
subResDesc2.setDestinationTopLeft(QPoint(100, 200));
QRhiTextureUploadEntry entry2(0, 0, subresDesc2); // layer 0, level 0, i.e. same subresource

QRhiTextureUploadDescription desc({ entry, entry2});
resourceUpdates->uploadTexture(texture, desc);

참고: 이 API는 호환성이 제한적으로 보장되는 RHI API이며, 자세한 내용은 QRhi 을 참조하세요.

QRhiResourceUpdateBatch도 참조하세요 .

멤버 함수 문서

[constexpr noexcept] QRhiTextureUploadDescription::QRhiTextureUploadDescription()

빈 텍스처 업로드 설명을 생성합니다.

QRhiTextureUploadDescription::QRhiTextureUploadDescription(const QRhiTextureUploadEntry &entry)

entry 에 설명된 단일 서브 리소스 업로드로 텍스처 업로드 설명을 구성합니다.

QRhiTextureUploadDescription::QRhiTextureUploadDescription(std::initializer_list<QRhiTextureUploadEntry> list)

지정된 list 항목으로 텍스처 업로드 설명을 구성합니다.

참고: list 에는 동일한 레이어와 레벨을 가진 QRhiTextureUploadEntry 요소가 여러 개 포함될 수도 있습니다. 이는 업로드가 부분적인 경우, 즉 하위 리소스 설명의 소스 크기나 이미지가 하위 리소스 크기보다 작은 경우에 적합하며 별도의 uploadTexture()를 호출하는 것보다 더 효율적일 수 있습니다.

const QRhiTextureUploadEntry *QRhiTextureUploadDescription::cbeginEntries() const

항목 목록의 첫 번째 항목을 가리키는 상수 이터레이터를 반환합니다.

const QRhiTextureUploadEntry *QRhiTextureUploadDescription::cendEntries() const

항목 목록의 마지막 항목 바로 뒤를 가리키는 상수 이터레이터를 반환합니다.

const QRhiTextureUploadEntry *QRhiTextureUploadDescription::entryAt(qsizetype index) const

index 에서 항목을 반환합니다.

qsizetype QRhiTextureUploadDescription::entryCount() const

항목 수를 반환합니다.

void QRhiTextureUploadDescription::setEntries(std::initializer_list<QRhiTextureUploadEntry> list)

항목의 list 을 설정합니다.

template <typename InputIterator> void QRhiTextureUploadDescription::setEntries(InputIterator first, InputIterator last)

반복자 firstlast 를 사용하여 항목 목록을 설정합니다.

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