Commit a42036dd authored by Laszlo Agocs's avatar Laszlo Agocs

Fix mtl

parent ab819490
......@@ -82,7 +82,7 @@ void Window::customInit()
QRhiTextureUploadDescription desc;
QImage img = QImage(":/c.png").mirrored().convertToFormat(QImage::Format_RGBA8888); // just use the same image for all faces for now
QRhiTextureLayer texLayer({ { img } });
QRhiTextureLayer texLayer({ QRhiTextureMipLevel(img) });
desc.setLayers({
texLayer, // +X
texLayer, // -X
......
......@@ -199,7 +199,7 @@ void TexturedCubeRenderer::queueResourceUpdates(QRhiResourceUpdateBatch *resourc
QVector<QRhiTextureMipLevel> mipImages;
for (int i = 0, ie = m_r->mipLevelsForSize(m_image.size()); i != ie; ++i) {
QImage image = m_image.scaled(m_r->sizeForMipLevel(i, m_image.size()));
mipImages.append({ image });
mipImages.append(QRhiTextureMipLevel(image));
}
layer.setMipImages(mipImages);
} else {
......
......@@ -1099,7 +1099,7 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
for (const QRhiResourceUpdateBatchPrivate::TextureUpload &u : ud->textureUploads) {
const QVector<QRhiTextureLayer> layers = u.desc.layers();
if (layers.isEmpty() || layers[0].mipImages.isEmpty())
if (layers.isEmpty() || layers[0].mipImages().isEmpty())
continue;
QMetalTexture *utexD = QRHI_RES(QMetalTexture, u.tex);
......@@ -1112,8 +1112,8 @@ void QRhiMetal::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdate
Q_ASSERT(mipImages.count() == 1 || utexD->m_flags.testFlag(QRhiTexture::MipMapped));
for (int level = 0, levelCount = mipImages.count(); level != levelCount; ++level) {
const QRhiTextureMipLevel &mipDesc(mipImages[level]);
const qsizetype imageSizeBytes = mipDesc.image.isNull() ?
mipDesc.compressedData.size() : mipDesc.image.sizeInBytes();
const qsizetype imageSizeBytes = mipDesc.image().isNull() ?
mipDesc.compressedData().size() : mipDesc.image().sizeInBytes();
if (imageSizeBytes > 0)
stagingSize += aligned(imageSizeBytes, texbufAlign);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment