Commit 2e43dbb7 by Geoff Lang Committed by Commit Bot

Implement remaining robust Get entry points.

BUG=angleproject:1354 Change-Id: I204962a7178d47a43034d0213c81b82d8f6a25be Reviewed-on: https://chromium-review.googlesource.com/399043Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent c0281d46
...@@ -167,19 +167,6 @@ bool ValidCap(const Context *context, GLenum cap, bool queryOnly) ...@@ -167,19 +167,6 @@ bool ValidCap(const Context *context, GLenum cap, bool queryOnly)
} }
} }
bool ValidateRobustBufferSize(ValidationContext *context, GLsizei bufSize, GLsizei numParams)
{
if (bufSize < numParams)
{
context->handleError(Error(GL_INVALID_OPERATION,
"%u parameters are required but %i were provided.", numParams,
bufSize));
return false;
}
return true;
}
bool ValidateReadPixelsBase(ValidationContext *context, bool ValidateReadPixelsBase(ValidationContext *context,
GLint x, GLint x,
GLint y, GLint y,
...@@ -3946,6 +3933,19 @@ bool ValidateRobustEntryPoint(ValidationContext *context, GLsizei bufSize) ...@@ -3946,6 +3933,19 @@ bool ValidateRobustEntryPoint(ValidationContext *context, GLsizei bufSize)
return true; return true;
} }
bool ValidateRobustBufferSize(ValidationContext *context, GLsizei bufSize, GLsizei numParams)
{
if (bufSize < numParams)
{
context->handleError(Error(GL_INVALID_OPERATION,
"%u parameters are required but %i were provided.", numParams,
bufSize));
return false;
}
return true;
}
bool ValidateGetFramebufferAttachmentParameteriv(ValidationContext *context, bool ValidateGetFramebufferAttachmentParameteriv(ValidationContext *context,
GLenum target, GLenum target,
GLenum attachment, GLenum attachment,
......
...@@ -322,6 +322,7 @@ bool ValidateDisable(Context *context, GLenum cap); ...@@ -322,6 +322,7 @@ bool ValidateDisable(Context *context, GLenum cap);
bool ValidateIsEnabled(Context *context, GLenum cap); bool ValidateIsEnabled(Context *context, GLenum cap);
bool ValidateRobustEntryPoint(ValidationContext *context, GLsizei bufSize); bool ValidateRobustEntryPoint(ValidationContext *context, GLsizei bufSize);
bool ValidateRobustBufferSize(ValidationContext *context, GLsizei bufSize, GLsizei numParams);
bool ValidateGetFramebufferAttachmentParameteriv(ValidationContext *context, bool ValidateGetFramebufferAttachmentParameteriv(ValidationContext *context,
GLenum target, GLenum target,
......
...@@ -1779,8 +1779,16 @@ bool ValidateFlushMappedBufferRange(Context *context, ...@@ -1779,8 +1779,16 @@ bool ValidateFlushMappedBufferRange(Context *context,
return ValidateFlushMappedBufferRangeBase(context, target, offset, length); return ValidateFlushMappedBufferRangeBase(context, target, offset, length);
} }
bool ValidateIndexedStateQuery(ValidationContext *context, GLenum pname, GLuint index) bool ValidateIndexedStateQuery(ValidationContext *context,
GLenum pname,
GLuint index,
GLsizei *length)
{ {
if (length)
{
*length = 0;
}
GLenum nativeType; GLenum nativeType;
unsigned int numParams; unsigned int numParams;
if (!context->getIndexedQueryParameterInfo(pname, &nativeType, &numParams)) if (!context->getIndexedQueryParameterInfo(pname, &nativeType, &numParams))
...@@ -1824,10 +1832,9 @@ bool ValidateIndexedStateQuery(ValidationContext *context, GLenum pname, GLuint ...@@ -1824,10 +1832,9 @@ bool ValidateIndexedStateQuery(ValidationContext *context, GLenum pname, GLuint
return false; return false;
} }
// pname is valid, but there are no parameters to return if (length)
if (numParams == 0)
{ {
return false; *length = 1;
} }
return true; return true;
...@@ -1840,7 +1847,7 @@ bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint ind ...@@ -1840,7 +1847,7 @@ bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint ind
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.0")); context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.0"));
return false; return false;
} }
return ValidateIndexedStateQuery(context, target, index); return ValidateIndexedStateQuery(context, target, index, nullptr);
} }
bool ValidateGetInteger64i_v(ValidationContext *context, GLenum target, GLuint index, GLint64 *data) bool ValidateGetInteger64i_v(ValidationContext *context, GLenum target, GLuint index, GLint64 *data)
...@@ -1850,7 +1857,38 @@ bool ValidateGetInteger64i_v(ValidationContext *context, GLenum target, GLuint i ...@@ -1850,7 +1857,38 @@ bool ValidateGetInteger64i_v(ValidationContext *context, GLenum target, GLuint i
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.0")); context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.0"));
return false; return false;
} }
return ValidateIndexedStateQuery(context, target, index); return ValidateIndexedStateQuery(context, target, index, nullptr);
}
bool ValidateGetInteger64i_vRobustANGLE(ValidationContext *context,
GLenum target,
GLuint index,
GLsizei bufSize,
GLsizei *length,
GLint64 *data)
{
if (!context->getGLVersion().isES3OrGreater())
{
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.0"));
return false;
}
if (!ValidateRobustEntryPoint(context, bufSize))
{
return false;
}
if (!ValidateIndexedStateQuery(context, target, index, length))
{
return false;
}
if (!ValidateRobustBufferSize(context, bufSize, *length))
{
return false;
}
return true;
} }
} // namespace gl } // namespace gl
...@@ -303,12 +303,21 @@ bool ValidateFlushMappedBufferRange(Context *context, ...@@ -303,12 +303,21 @@ bool ValidateFlushMappedBufferRange(Context *context,
GLintptr offset, GLintptr offset,
GLsizeiptr length); GLsizeiptr length);
bool ValidateIndexedStateQuery(ValidationContext *context, GLenum pname, GLuint index); bool ValidateIndexedStateQuery(ValidationContext *context,
GLenum pname,
GLuint index,
GLsizei *length);
bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint index, GLint *data); bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint index, GLint *data);
bool ValidateGetInteger64i_v(ValidationContext *context, bool ValidateGetInteger64i_v(ValidationContext *context,
GLenum target, GLenum target,
GLuint index, GLuint index,
GLint64 *data); GLint64 *data);
bool ValidateGetInteger64i_vRobustANGLE(ValidationContext *context,
GLenum target,
GLuint index,
GLsizei bufSize,
GLsizei *length,
GLint64 *data);
} // namespace gl } // namespace gl
#endif // LIBANGLE_VALIDATION_ES3_H_ #endif // LIBANGLE_VALIDATION_ES3_H_
...@@ -6,10 +6,11 @@ ...@@ -6,10 +6,11 @@
// validationES31.cpp: Validation functions for OpenGL ES 3.1 entry point parameters // validationES31.cpp: Validation functions for OpenGL ES 3.1 entry point parameters
#include "libANGLE/validationES3.h"
#include "libANGLE/validationES31.h" #include "libANGLE/validationES31.h"
#include "libANGLE/Context.h" #include "libANGLE/Context.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES3.h"
using namespace angle; using namespace angle;
...@@ -24,7 +25,38 @@ bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLbool ...@@ -24,7 +25,38 @@ bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLbool
return false; return false;
} }
if (!ValidateIndexedStateQuery(context, target, index)) if (!ValidateIndexedStateQuery(context, target, index, nullptr))
{
return false;
}
return true;
}
bool ValidateGetBooleani_vRobustANGLE(Context *context,
GLenum target,
GLuint index,
GLsizei bufSize,
GLsizei *length,
GLboolean *data)
{
if (!context->getGLVersion().isES31())
{
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3.1"));
return false;
}
if (!ValidateRobustEntryPoint(context, bufSize))
{
return false;
}
if (!ValidateIndexedStateQuery(context, target, index, length))
{
return false;
}
if (!ValidateRobustBufferSize(context, bufSize, *length))
{ {
return false; return false;
} }
......
...@@ -16,6 +16,12 @@ namespace gl ...@@ -16,6 +16,12 @@ namespace gl
class Context; class Context;
bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data); bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data);
bool ValidateGetBooleani_vRobustANGLE(Context *context,
GLenum target,
GLuint index,
GLsizei bufSize,
GLsizei *length,
GLboolean *data);
} // namespace gl } // namespace gl
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "libANGLE/validationES.h" #include "libANGLE/validationES.h"
#include "libANGLE/validationES2.h" #include "libANGLE/validationES2.h"
#include "libANGLE/validationES3.h" #include "libANGLE/validationES3.h"
#include "libANGLE/validationES31.h"
#include "common/debug.h" #include "common/debug.h"
#include "common/utilities.h" #include "common/utilities.h"
...@@ -2733,7 +2734,27 @@ ANGLE_EXPORT void GL_APIENTRY GetInteger64vRobustANGLE(GLenum pname, ...@@ -2733,7 +2734,27 @@ ANGLE_EXPORT void GL_APIENTRY GetInteger64vRobustANGLE(GLenum pname,
"(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLint64* params = " "(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLint64* params = "
"0x%0.8p)", "0x%0.8p)",
pname, bufSize, length, data); pname, bufSize, length, data);
UNIMPLEMENTED();
Context *context = GetValidGlobalContext();
if (context)
{
GLenum nativeType;
unsigned int numParams = 0;
if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams))
{
return;
}
if (nativeType == GL_INT_64_ANGLEX)
{
context->getInteger64v(pname, data);
}
else
{
CastStateValues(context, nativeType, pname, numParams, data);
}
SetRobustLengthParam(length, numParams);
}
} }
ANGLE_EXPORT void GL_APIENTRY GetInteger64i_vRobustANGLE(GLenum target, ANGLE_EXPORT void GL_APIENTRY GetInteger64i_vRobustANGLE(GLenum target,
...@@ -2746,7 +2767,19 @@ ANGLE_EXPORT void GL_APIENTRY GetInteger64i_vRobustANGLE(GLenum target, ...@@ -2746,7 +2767,19 @@ ANGLE_EXPORT void GL_APIENTRY GetInteger64i_vRobustANGLE(GLenum target,
"(GLenum target = 0x%X, GLuint index = %u, GLsizei bufsize = %d, GLsizei* length = " "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufsize = %d, GLsizei* length = "
"0x%0.8p, GLint64* data = 0x%0.8p)", "0x%0.8p, GLint64* data = 0x%0.8p)",
target, index, bufSize, length, data); target, index, bufSize, length, data);
UNIMPLEMENTED();
Context *context = GetValidGlobalContext();
if (context)
{
GLsizei numParams = 0;
if (!ValidateGetInteger64i_vRobustANGLE(context, target, index, bufSize, &numParams, data))
{
return;
}
context->getInteger64i_v(target, index, data);
SetRobustLengthParam(length, numParams);
}
} }
ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64vRobustANGLE(GLenum target, ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64vRobustANGLE(GLenum target,
...@@ -2893,7 +2926,18 @@ ANGLE_EXPORT void GL_APIENTRY GetBooleani_vRobustANGLE(GLenum target, ...@@ -2893,7 +2926,18 @@ ANGLE_EXPORT void GL_APIENTRY GetBooleani_vRobustANGLE(GLenum target,
"(GLenum target = 0x%X, GLuint index = %u, GLsizei bufsize = %d, GLsizei* length = " "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufsize = %d, GLsizei* length = "
"0x%0.8p, GLboolean* data = 0x%0.8p)", "0x%0.8p, GLboolean* data = 0x%0.8p)",
target, index, bufSize, length, data); target, index, bufSize, length, data);
UNIMPLEMENTED(); Context *context = GetValidGlobalContext();
if (context)
{
GLsizei numParams = 0;
if (!ValidateGetBooleani_vRobustANGLE(context, target, index, bufSize, &numParams, data))
{
return;
}
context->getBooleani_v(target, index, data);
SetRobustLengthParam(length, numParams);
}
} }
ANGLE_EXPORT void GL_APIENTRY GetMultisamplefvRobustANGLE(GLenum pname, ANGLE_EXPORT void GL_APIENTRY GetMultisamplefvRobustANGLE(GLenum pname,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment