From 14d8dc711dfd81ee6d8da7f7a16690db75a960fe Mon Sep 17 00:00:00 2001 From: bohu Date: Mon, 17 Nov 2014 16:19:06 -0800 Subject: handles glGetFloatv with GL_STENCIL_VALUE_MASK etc For GL_STENCIL_VALUE_MASK and the like, glGetFloatv returns -1 and this is incorrect, according to GLES 2 spec. This commit does proper casts to get sensible value. Change-Id: I9c07ddf812458bd2d374189c0c4263c44de0d6da (cherry picked from commit 92ebbc674404fd90aba4df68216e1f103456c7fc) --- emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp index fe64f6f..81f867f 100644 --- a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp +++ b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp @@ -934,6 +934,20 @@ GL_APICALL void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params){ } break; + case GL_STENCIL_BACK_VALUE_MASK: + case GL_STENCIL_BACK_WRITEMASK: + case GL_STENCIL_VALUE_MASK: + case GL_STENCIL_WRITEMASK: + { + GLint myint = 0; + glGetIntegerv(pname, &myint); + // Two casts are used: since mask is unsigned integer, + // the first cast converts to unsigned integer; + // the second cast converts to float. + *params = (GLfloat)((GLuint)(myint)); + } + break; + default: ctx->dispatcher().glGetFloatv(pname,params); } -- cgit v1.1