From c4966e0ad3faa046c293f855e48e8125d6fcd8d0 Mon Sep 17 00:00:00 2001 From: bohu Date: Tue, 28 Oct 2014 17:53:04 -0700 Subject: 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 --- emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'emulator/opengl/host') diff --git a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp index fe64f6f43..16534c179 100644 --- a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp +++ b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp @@ -323,6 +323,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); -- cgit v1.2.3