Commit f1fb7bc9 authored by Laszlo Agocs's avatar Laszlo Agocs

Simplify the resolve and copy api a bit

parent 7689f46a
......@@ -238,7 +238,7 @@ void Window::customRender()
// add the resolve (msaa renderbuffer -> non-msaa texture)
u = m_r->nextResourceUpdateBatch();
u->resolveRenderBuffer(d.tex, d.rb);
u->resolveTexture(d.tex, { d.rb });
cb->endPass(u);
// onscreen (quad)
......
......@@ -459,26 +459,11 @@ void QRhiResourceUpdateBatch::copyTexture(QRhiTexture *dst, QRhiTexture *src, co
d->textureCopies.append({ dst, src, desc });
}
void QRhiResourceUpdateBatch::copyTexture(QRhiTexture *dst, QRhiTexture *src)
{
d->textureCopies.append({ dst, src, QRhiTextureCopyDescription() });
}
void QRhiResourceUpdateBatch::resolveTexture(QRhiTexture *dst, const QRhiTextureResolveDescription &desc)
{
d->textureResolves.append({ dst, desc });
}
void QRhiResourceUpdateBatch::resolveTexture(QRhiTexture *dst, QRhiTexture *src)
{
d->textureResolves.append({ dst, src });
}
void QRhiResourceUpdateBatch::resolveRenderBuffer(QRhiTexture *dst, QRhiRenderBuffer *src)
{
d->textureResolves.append({ dst, src });
}
void QRhiResourceUpdateBatch::readBackTexture(const QRhiReadbackDescription &rb, QRhiReadbackResult *result)
{
d->textureReadbacks.append({ rb, result });
......
......@@ -1023,11 +1023,8 @@ public:
void uploadStaticBuffer(QRhiBuffer *buf, const void *data);
void uploadTexture(QRhiTexture *tex, const QRhiTextureUploadDescription &desc);
void uploadTexture(QRhiTexture *tex, const QImage &image); // shortcut
void copyTexture(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc);
void copyTexture(QRhiTexture *dst, QRhiTexture *src); // shortcut
void copyTexture(QRhiTexture *dst, QRhiTexture *src, const QRhiTextureCopyDescription &desc = QRhiTextureCopyDescription());
void resolveTexture(QRhiTexture *dst, const QRhiTextureResolveDescription &desc);
void resolveTexture(QRhiTexture *dst, QRhiTexture *src); // shortcut
void resolveRenderBuffer(QRhiTexture *dst, QRhiRenderBuffer *src); // shortcut
void readBackTexture(const QRhiReadbackDescription &rb, QRhiReadbackResult *result);
// This is not normally needed, textures that have an upload or are used
......
......@@ -1107,7 +1107,6 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
break;
case QGles2CommandBuffer::Command::CopyTex:
{
// ugh...
GLuint fbo;
f->glGenFramebuffers(1, &fbo);
f->glBindFramebuffer(GL_FRAMEBUFFER, fbo);
......@@ -1131,7 +1130,6 @@ void QRhiGles2::executeCommandBuffer(QRhiCommandBuffer *cb)
if (texD) {
result->pixelSize = texD->m_pixelSize;
result->format = texD->m_format;
// this is going to be suboptimal but will do for now
f->glGenFramebuffers(1, &fbo);
f->glBindFramebuffer(GL_FRAMEBUFFER, fbo);
const GLenum targetBase = texD->m_flags.testFlag(QRhiTexture::CubeMap) ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : texD->target;
......
......@@ -2228,7 +2228,7 @@ void QRhiVulkan::enqueueResourceUpdates(QRhiCommandBuffer *cb, QRhiResourceUpdat
VkBufferImageCopy copyDesc;
memset(&copyDesc, 0, sizeof(copyDesc));
copyDesc.bufferOffset = 0;
copyDesc.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; // ### no depth for now
copyDesc.imageSubresource.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT;
copyDesc.imageSubresource.mipLevel = aRb.desc.level;
copyDesc.imageSubresource.baseArrayLayer = aRb.desc.layer;
copyDesc.imageSubresource.layerCount = 1;
......
......@@ -14,7 +14,6 @@ mtl: color renderbuffer
gl: tex formats (texture, readback)
gl: srgb
gl: readback and resolve could be made more optimal by taking a rt as source
test cubemap
test cubemap face as target
......
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