Add helper methods for FBO attachment validation.
Subsequent refactoring will eliminate duplicate code.
BUG=angle:571
Change-Id: I086320beb5c432c326d29d047931575e6f2a1d64
Reviewed-on: https://chromium-review.googlesource.com/205603
Tested-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Shannon Woods <shannonwoods@chromium.org>
diff --git a/src/libGLESv2/validationES3.cpp b/src/libGLESv2/validationES3.cpp
index e16c9a2..621d8da 100644
--- a/src/libGLESv2/validationES3.cpp
+++ b/src/libGLESv2/validationES3.cpp
@@ -449,7 +449,7 @@
return true;
}
-bool ValidateES3FramebufferTextureParameters(gl::Context *context, GLenum target, GLenum attachment,
+bool ValidateES3FramebufferTextureParameters(const gl::Context *context, GLenum target, GLenum attachment,
GLenum textarget, GLuint texture, GLint level, GLint layer,
bool layerCall)
{
@@ -599,7 +599,7 @@
}
}
- gl::Framebuffer *framebuffer = NULL;
+ const gl::Framebuffer *framebuffer = NULL;
GLuint framebufferHandle = 0;
if (target == GL_READ_FRAMEBUFFER)
{
@@ -620,6 +620,17 @@
return true;
}
+bool ValidateFramebufferTextureLayer(const gl::Context *context, GLenum target, GLenum attachment,
+ GLuint texture, GLint level, GLint layer)
+{
+ if (context->getClientVersion() < 3)
+ {
+ return gl::error(GL_INVALID_OPERATION, false);
+ }
+
+ return ValidateES3FramebufferTextureParameters(context, target, attachment, GL_NONE, texture, level, layer, true);
+}
+
bool ValidES3ReadFormatType(gl::Context *context, GLenum internalFormat, GLenum format, GLenum type)
{
switch (format)