이 페이지에서

QRhiTextureUploadDescription 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부터

공개 함수

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);

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

QRhiTextureUploadDescription은 또한 일괄 업로드를 지정할 수 있게 해주며, 이는 예를 들어 아틀라스나 글리프 캐시 텍스처를 생성할 때 유용합니다: 동일한 서브리소스(즉, 동일한 레이어 및 레벨)에 대한 여러 번의 부분 업로드가 지원되며, 백엔드 및 기본 그래픽 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);

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

QRhiResourceUpdateBatch도 참조하십시오 .

멤버 함수 문서

[constexpr noexcept default] 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 이터레이터를 반환합니다.

const QRhiTextureUploadEntry *QRhiTextureUploadDescription::cendEntries() const

항목 목록의 마지막 항목 바로 다음을 가리키는 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)

first 및 last 이터레이터를 사용하여 항목 목록을 설정합니다.

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