aboutsummaryrefslogtreecommitdiffstats
path: root/emulator
diff options
context:
space:
mode:
authorbohu <bohu@google.com>2014-10-28 17:53:04 -0700
committerbohu <bohu@google.com>2014-11-25 12:31:49 -0800
commitd3a31ab8b369cad6dc40a66fc3bb9c6b0bef0c11 (patch)
tree5815630fb6196977f82e04cd8911de3fac6b31c8 /emulator
parent6f568b0d164d90cd7efd9c1d225e5990dead1ba7 (diff)
downloadsdk-d3a31ab8b369cad6dc40a66fc3bb9c6b0bef0c11.zip
sdk-d3a31ab8b369cad6dc40a66fc3bb9c6b0bef0c11.tar.gz
sdk-d3a31ab8b369cad6dc40a66fc3bb9c6b0bef0c11.tar.bz2
Validate glClear mask
The mask should only be a combination of GL_DEPTH_BUFFER_BIT, GL_COLOR_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT Change-Id: Ic448bd33a9bf0dc50db4298a53e96dd128fd110c
Diffstat (limited to 'emulator')
-rw-r--r--emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
index 8ab75c7..780555e 100644
--- a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
+++ b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp
@@ -346,6 +346,9 @@ GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target){
GL_APICALL void GL_APIENTRY glClear(GLbitfield mask){
GET_CTX();
+ GLbitfield allowed_bits = GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
+ GLbitfield has_disallowed_bits = (mask & ~allowed_bits);
+ SET_ERROR_IF(has_disallowed_bits, GL_INVALID_VALUE);
ctx->drawValidate();
ctx->dispatcher().glClear(mask);