Implement EXT_discard_framebuffer in D3D11 renderer
Change-Id: I52bcf0cfb1aa123e085a35730fdefb006b617c3c
Reviewed-on: https://chromium-review.googlesource.com/269232
Tested-by: Austin Kinross <aukinros@microsoft.com>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/validationES3.cpp b/src/libANGLE/validationES3.cpp
index 9d07af3..c3d7c4e 100644
--- a/src/libANGLE/validationES3.cpp
+++ b/src/libANGLE/validationES3.cpp
@@ -1132,9 +1132,15 @@
return true;
}
-bool ValidateInvalidateFramebufferParameters(Context *context, GLenum target, GLsizei numAttachments,
- const GLenum* attachments)
+bool ValidateInvalidateFramebuffer(Context *context, GLenum target, GLsizei numAttachments,
+ const GLenum *attachments)
{
+ if (context->getClientVersion() < 3)
+ {
+ context->recordError(Error(GL_INVALID_OPERATION, "Operation only supported on ES 3.0 and above"));
+ return false;
+ }
+
bool defaultFramebuffer = false;
switch (target)
@@ -1147,56 +1153,11 @@
defaultFramebuffer = context->getState().getReadFramebuffer()->id() == 0;
break;
default:
- context->recordError(Error(GL_INVALID_ENUM));
- return false;
+ context->recordError(Error(GL_INVALID_ENUM, "Invalid framebuffer target"));
+ return false;
}
- for (int i = 0; i < numAttachments; ++i)
- {
- if (attachments[i] >= GL_COLOR_ATTACHMENT0 && attachments[i] <= GL_COLOR_ATTACHMENT15)
- {
- if (defaultFramebuffer)
- {
- context->recordError(Error(GL_INVALID_ENUM));
- return false;
- }
-
- if (attachments[i] >= GL_COLOR_ATTACHMENT0 + context->getCaps().maxColorAttachments)
- {
- context->recordError(Error(GL_INVALID_OPERATION));
- return false;
- }
- }
- else
- {
- switch (attachments[i])
- {
- case GL_DEPTH_ATTACHMENT:
- case GL_STENCIL_ATTACHMENT:
- case GL_DEPTH_STENCIL_ATTACHMENT:
- if (defaultFramebuffer)
- {
- context->recordError(Error(GL_INVALID_ENUM));
- return false;
- }
- break;
- case GL_COLOR:
- case GL_DEPTH:
- case GL_STENCIL:
- if (!defaultFramebuffer)
- {
- context->recordError(Error(GL_INVALID_ENUM));
- return false;
- }
- break;
- default:
- context->recordError(Error(GL_INVALID_ENUM));
- return false;
- }
- }
- }
-
- return true;
+ return ValidateDiscardFramebufferBase(context, target, numAttachments, attachments, defaultFramebuffer);
}
bool ValidateClearBuffer(Context *context)