Add tests for clears, render passes, framebuffers (#107)

* Add tests for clears, render passes, framebuffers

* Test load with a draw in it
This commit is contained in:
Kai Ninomiya
2017-08-14 16:32:26 -07:00
committed by GitHub
parent 37d11539a4
commit afa45a9176
9 changed files with 437 additions and 13 deletions

View File

@@ -103,19 +103,10 @@ namespace backend {
return nullptr;
}
// TODO(kainino@chromium.org): Remove this flag when the
// null=backbuffer hack is removed. Then, using null texture views can
// be completely disallowed.
bool usingBackbufferHack = false;
for (auto& textureView : textureViews) {
if (!textureView) {
if (usingBackbufferHack) {
// TODO(kainino@chromium.org) update this too
HandleError("Framebuffer has more than one null attachment");
return nullptr;
}
usingBackbufferHack = true;
continue;
HandleError("Framebuffer attachment not set");
return nullptr;
}
// TODO(cwallez@chromium.org): Adjust for the mip-level once that is supported.

View File

@@ -94,6 +94,23 @@ namespace backend {
}
}
for (const auto& subpass : subpasses) {
for (unsigned int location : IterateBitSet(subpass.colorAttachmentsSet)) {
uint32_t slot = subpass.colorAttachments[location];
if (TextureFormatHasDepthOrStencil(attachments[slot].format)) {
HandleError("Render pass color attachment is not of a color format");
return nullptr;
}
}
if (subpass.depthStencilAttachmentSet) {
uint32_t slot = subpass.depthStencilAttachment;
if (!TextureFormatHasDepthOrStencil(attachments[slot].format)) {
HandleError("Render pass depth/stencil attachment is not of a depth/stencil format");
return nullptr;
}
}
}
return device->CreateRenderPass(this);
}

View File

@@ -97,6 +97,11 @@ namespace opengl {
{
commands.NextCommand<BeginRenderSubpassCmd>();
// TODO(kainino@chromium.org): This is added to possibly
// work around an issue seen on Windows/Intel. It should
// break any feedback loop before the clears, even if
// there shouldn't be any negative effects from this.
// Investigate whether it's actually needed.
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
// TODO(kainino@chromium.org): possible future
// optimization: create these framebuffers at