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