Commit 007530ea by Jamie Madill Committed by Commit Bot

Entry Points: Refactor Extensions Part 2.

This moves the validation and entry point files to use a consistent syntax. This will facilitate auto-generation. Bug: angleproject:2263 Change-Id: If5d06e97db66783d7b3d7fb1d6365f8218d956ae Reviewed-on: https://chromium-review.googlesource.com/846022 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent f095799b
...@@ -741,9 +741,9 @@ void Context::setPathCommands(GLuint path, ...@@ -741,9 +741,9 @@ void Context::setPathCommands(GLuint path,
handleError(pathObject->setCommands(numCommands, commands, numCoords, coordType, coords)); handleError(pathObject->setCommands(numCommands, commands, numCoords, coordType, coords));
} }
void Context::setPathParameterf(GLuint path, GLenum pname, GLfloat value) void Context::pathParameterf(GLuint path, GLenum pname, GLfloat value)
{ {
auto *pathObj = mState.mPaths->getPath(path); Path *pathObj = mState.mPaths->getPath(path);
switch (pname) switch (pname)
{ {
...@@ -768,9 +768,15 @@ void Context::setPathParameterf(GLuint path, GLenum pname, GLfloat value) ...@@ -768,9 +768,15 @@ void Context::setPathParameterf(GLuint path, GLenum pname, GLfloat value)
} }
} }
void Context::getPathParameterfv(GLuint path, GLenum pname, GLfloat *value) const void Context::pathParameteri(GLuint path, GLenum pname, GLint value)
{ {
const auto *pathObj = mState.mPaths->getPath(path); // TODO(jmadill): Should use proper clamping/casting.
pathParameterf(path, pname, static_cast<GLfloat>(value));
}
void Context::getPathParameterfv(GLuint path, GLenum pname, GLfloat *value)
{
const Path *pathObj = mState.mPaths->getPath(path);
switch (pname) switch (pname)
{ {
...@@ -795,6 +801,14 @@ void Context::getPathParameterfv(GLuint path, GLenum pname, GLfloat *value) cons ...@@ -795,6 +801,14 @@ void Context::getPathParameterfv(GLuint path, GLenum pname, GLfloat *value) cons
} }
} }
void Context::getPathParameteriv(GLuint path, GLenum pname, GLint *value)
{
GLfloat val = 0.0f;
getPathParameterfv(path, pname, value != nullptr ? &val : nullptr);
if (value)
*value = static_cast<GLint>(val);
}
void Context::setPathStencilFunc(GLenum func, GLint ref, GLuint mask) void Context::setPathStencilFunc(GLenum func, GLint ref, GLuint mask)
{ {
mGLState.setPathStencilFunc(func, ref, mask); mGLState.setPathStencilFunc(func, ref, mask);
...@@ -1840,7 +1854,17 @@ void Context::insertEventMarker(GLsizei length, const char *marker) ...@@ -1840,7 +1854,17 @@ void Context::insertEventMarker(GLsizei length, const char *marker)
void Context::pushGroupMarker(GLsizei length, const char *marker) void Context::pushGroupMarker(GLsizei length, const char *marker)
{ {
ASSERT(mImplementation); ASSERT(mImplementation);
mImplementation->pushGroupMarker(length, marker);
if (marker == nullptr)
{
// From the EXT_debug_marker spec,
// "If <marker> is null then an empty string is pushed on the stack."
mImplementation->pushGroupMarker(length, "");
}
else
{
mImplementation->pushGroupMarker(length, marker);
}
} }
void Context::popGroupMarker() void Context::popGroupMarker()
...@@ -3424,16 +3448,16 @@ void Context::generateMipmap(GLenum target) ...@@ -3424,16 +3448,16 @@ void Context::generateMipmap(GLenum target)
handleError(texture->generateMipmap(this)); handleError(texture->generateMipmap(this));
} }
void Context::copyTextureCHROMIUM(GLuint sourceId, void Context::copyTexture(GLuint sourceId,
GLint sourceLevel, GLint sourceLevel,
GLenum destTarget, GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel, GLint destLevel,
GLint internalFormat, GLint internalFormat,
GLenum destType, GLenum destType,
GLboolean unpackFlipY, GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha, GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha) GLboolean unpackUnmultiplyAlpha)
{ {
syncStateForTexImage(); syncStateForTexImage();
...@@ -3445,20 +3469,20 @@ void Context::copyTextureCHROMIUM(GLuint sourceId, ...@@ -3445,20 +3469,20 @@ void Context::copyTextureCHROMIUM(GLuint sourceId,
ConvertToBool(unpackUnmultiplyAlpha), sourceTexture)); ConvertToBool(unpackUnmultiplyAlpha), sourceTexture));
} }
void Context::copySubTextureCHROMIUM(GLuint sourceId, void Context::copySubTexture(GLuint sourceId,
GLint sourceLevel, GLint sourceLevel,
GLenum destTarget, GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel, GLint destLevel,
GLint xoffset, GLint xoffset,
GLint yoffset, GLint yoffset,
GLint x, GLint x,
GLint y, GLint y,
GLsizei width, GLsizei width,
GLsizei height, GLsizei height,
GLboolean unpackFlipY, GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha, GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha) GLboolean unpackUnmultiplyAlpha)
{ {
// Zero sized copies are valid but no-ops // Zero sized copies are valid but no-ops
if (width == 0 || height == 0) if (width == 0 || height == 0)
...@@ -3478,7 +3502,7 @@ void Context::copySubTextureCHROMIUM(GLuint sourceId, ...@@ -3478,7 +3502,7 @@ void Context::copySubTextureCHROMIUM(GLuint sourceId,
ConvertToBool(unpackUnmultiplyAlpha), sourceTexture)); ConvertToBool(unpackUnmultiplyAlpha), sourceTexture));
} }
void Context::compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId) void Context::compressedCopyTexture(GLuint sourceId, GLuint destId)
{ {
syncStateForTexImage(); syncStateForTexImage();
...@@ -5748,4 +5772,45 @@ void Context::readnPixels(GLint x, ...@@ -5748,4 +5772,45 @@ void Context::readnPixels(GLint x,
return readPixels(x, y, width, height, format, type, data); return readPixels(x, y, width, height, format, type, data);
} }
void Context::setFenceNV(GLuint fence, GLenum condition)
{
ASSERT(condition == GL_ALL_COMPLETED_NV);
FenceNV *fenceObject = getFenceNV(fence);
ASSERT(fenceObject != nullptr);
handleError(fenceObject->set(condition));
}
GLboolean Context::testFenceNV(GLuint fence)
{
FenceNV *fenceObject = getFenceNV(fence);
ASSERT(fenceObject != nullptr);
ASSERT(fenceObject->isSet() == GL_TRUE);
GLboolean result = GL_TRUE;
Error error = fenceObject->test(&result);
if (error.isError())
{
handleError(error);
return GL_TRUE;
}
return result;
}
void Context::eGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
{
Texture *texture = getTargetTexture(target);
egl::Image *imageObject = reinterpret_cast<egl::Image *>(image);
handleError(texture->setEGLImageTarget(this, target, imageObject));
}
void Context::eGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
{
Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer();
egl::Image *imageObject = reinterpret_cast<egl::Image *>(image);
handleError(renderbuffer->setStorageEGLImageTarget(this, imageObject));
}
} // namespace gl } // namespace gl
...@@ -106,8 +106,10 @@ class Context final : public ValidationContext ...@@ -106,8 +106,10 @@ class Context final : public ValidationContext
GLsizei numCoords, GLsizei numCoords,
GLenum coordType, GLenum coordType,
const void *coords); const void *coords);
void setPathParameterf(GLuint path, GLenum pname, GLfloat value); void pathParameterf(GLuint path, GLenum pname, GLfloat value);
void getPathParameterfv(GLuint path, GLenum pname, GLfloat *value) const; void pathParameteri(GLuint path, GLenum pname, GLint value);
void getPathParameterfv(GLuint path, GLenum pname, GLfloat *value);
void getPathParameteriv(GLuint path, GLenum pname, GLint *value);
void setPathStencilFunc(GLenum func, GLint ref, GLuint mask); void setPathStencilFunc(GLenum func, GLint ref, GLuint mask);
// Framebuffers are owned by the Context, so these methods do not pass through // Framebuffers are owned by the Context, so these methods do not pass through
...@@ -120,6 +122,8 @@ class Context final : public ValidationContext ...@@ -120,6 +122,8 @@ class Context final : public ValidationContext
void finishFenceNV(GLuint fence); void finishFenceNV(GLuint fence);
void getFenceivNV(GLuint fence, GLenum pname, GLint *params); void getFenceivNV(GLuint fence, GLenum pname, GLint *params);
GLboolean isFenceNV(GLuint fence); GLboolean isFenceNV(GLuint fence);
void setFenceNV(GLuint fence, GLenum condition);
GLboolean testFenceNV(GLuint fence);
void bindTexture(GLenum target, GLuint handle); void bindTexture(GLenum target, GLuint handle);
void bindReadFramebuffer(GLuint framebufferHandle); void bindReadFramebuffer(GLuint framebufferHandle);
...@@ -527,31 +531,31 @@ class Context final : public ValidationContext ...@@ -527,31 +531,31 @@ class Context final : public ValidationContext
GLenum format, GLenum format,
GLsizei imageSize, GLsizei imageSize,
const void *data); const void *data);
void copyTextureCHROMIUM(GLuint sourceId, void copyTexture(GLuint sourceId,
GLint sourceLevel, GLint sourceLevel,
GLenum destTarget, GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel, GLint destLevel,
GLint internalFormat, GLint internalFormat,
GLenum destType, GLenum destType,
GLboolean unpackFlipY, GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha, GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha); GLboolean unpackUnmultiplyAlpha);
void copySubTextureCHROMIUM(GLuint sourceId, void copySubTexture(GLuint sourceId,
GLint sourceLevel, GLint sourceLevel,
GLenum destTarget, GLenum destTarget,
GLuint destId, GLuint destId,
GLint destLevel, GLint destLevel,
GLint xoffset, GLint xoffset,
GLint yoffset, GLint yoffset,
GLint x, GLint x,
GLint y, GLint y,
GLsizei width, GLsizei width,
GLsizei height, GLsizei height,
GLboolean unpackFlipY, GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha, GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha); GLboolean unpackUnmultiplyAlpha);
void compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId); void compressedCopyTexture(GLuint sourceId, GLuint destId);
void generateMipmap(GLenum target); void generateMipmap(GLenum target);
...@@ -979,6 +983,8 @@ class Context final : public ValidationContext ...@@ -979,6 +983,8 @@ class Context final : public ValidationContext
GLenum type, GLenum type,
GLsizei bufSize, GLsizei bufSize,
void *data); void *data);
void eGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
void eGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
// Consumes the error. // Consumes the error.
void handleError(const Error &error) override; void handleError(const Error &error) override;
......
...@@ -3167,8 +3167,15 @@ bool ValidateDiscardFramebufferBase(Context *context, ...@@ -3167,8 +3167,15 @@ bool ValidateDiscardFramebufferBase(Context *context,
bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *marker) bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *marker)
{ {
// Note that debug marker calls must not set error state if (!context->getExtensions().debugMarker)
{
// The debug marker calls should not set error state
// However, it seems reasonable to set an error state if the extension is not enabled
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
return false;
}
// Note that debug marker calls must not set error state
if (length < 0) if (length < 0)
{ {
return false; return false;
...@@ -3184,8 +3191,15 @@ bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char * ...@@ -3184,8 +3191,15 @@ bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *
bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *marker) bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *marker)
{ {
// Note that debug marker calls must not set error state if (!context->getExtensions().debugMarker)
{
// The debug marker calls should not set error state
// However, it seems reasonable to set an error state if the extension is not enabled
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExtensionNotEnabled);
return false;
}
// Note that debug marker calls must not set error state
if (length < 0) if (length < 0)
{ {
return false; return false;
...@@ -3199,9 +3213,7 @@ bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *ma ...@@ -3199,9 +3213,7 @@ bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *ma
return true; return true;
} }
bool ValidateEGLImageTargetTexture2DOES(Context *context, bool ValidateEGLImageTargetTexture2DOES(Context *context, GLenum target, GLeglImageOES image)
GLenum target,
egl::Image *image)
{ {
if (!context->getExtensions().eglImage && !context->getExtensions().eglImageExternal) if (!context->getExtensions().eglImage && !context->getExtensions().eglImageExternal)
{ {
...@@ -3232,14 +3244,16 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context, ...@@ -3232,14 +3244,16 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context,
return false; return false;
} }
egl::Image *imageObject = reinterpret_cast<egl::Image *>(image);
ASSERT(context->getCurrentDisplay()); ASSERT(context->getCurrentDisplay());
if (!context->getCurrentDisplay()->isValidImage(image)) if (!context->getCurrentDisplay()->isValidImage(imageObject))
{ {
context->handleError(InvalidValue() << "EGL image is not valid."); context->handleError(InvalidValue() << "EGL image is not valid.");
return false; return false;
} }
if (image->getSamples() > 0) if (imageObject->getSamples() > 0)
{ {
context->handleError(InvalidOperation() context->handleError(InvalidOperation()
<< "cannot create a 2D texture from a multisampled EGL image."); << "cannot create a 2D texture from a multisampled EGL image.");
...@@ -3247,7 +3261,7 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context, ...@@ -3247,7 +3261,7 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context,
} }
const TextureCaps &textureCaps = const TextureCaps &textureCaps =
context->getTextureCaps().get(image->getFormat().info->sizedInternalFormat); context->getTextureCaps().get(imageObject->getFormat().info->sizedInternalFormat);
if (!textureCaps.texturable) if (!textureCaps.texturable)
{ {
context->handleError(InvalidOperation() context->handleError(InvalidOperation()
...@@ -3260,7 +3274,7 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context, ...@@ -3260,7 +3274,7 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context,
bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context, bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
GLenum target, GLenum target,
egl::Image *image) GLeglImageOES image)
{ {
if (!context->getExtensions().eglImage) if (!context->getExtensions().eglImage)
{ {
...@@ -3278,15 +3292,17 @@ bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context, ...@@ -3278,15 +3292,17 @@ bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
return false; return false;
} }
egl::Image *imageObject = reinterpret_cast<egl::Image *>(image);
ASSERT(context->getCurrentDisplay()); ASSERT(context->getCurrentDisplay());
if (!context->getCurrentDisplay()->isValidImage(image)) if (!context->getCurrentDisplay()->isValidImage(imageObject))
{ {
context->handleError(InvalidValue() << "EGL image is not valid."); context->handleError(InvalidValue() << "EGL image is not valid.");
return false; return false;
} }
const TextureCaps &textureCaps = const TextureCaps &textureCaps =
context->getTextureCaps().get(image->getFormat().info->sizedInternalFormat); context->getTextureCaps().get(imageObject->getFormat().info->sizedInternalFormat);
if (!textureCaps.renderable) if (!textureCaps.renderable)
{ {
context->handleError(InvalidOperation() context->handleError(InvalidOperation()
......
...@@ -39,7 +39,6 @@ bool ValidTexture2DDestinationTarget(const ValidationContext *context, GLenum ta ...@@ -39,7 +39,6 @@ bool ValidTexture2DDestinationTarget(const ValidationContext *context, GLenum ta
bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum target); bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum target);
bool ValidTexLevelDestinationTarget(const ValidationContext *context, GLenum target); bool ValidTexLevelDestinationTarget(const ValidationContext *context, GLenum target);
bool ValidFramebufferTarget(const ValidationContext *context, GLenum target); bool ValidFramebufferTarget(const ValidationContext *context, GLenum target);
bool ValidBufferParameter(const ValidationContext *context, GLenum pname, GLsizei *numParams);
bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level); bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level);
bool ValidImageSizeParameters(ValidationContext *context, bool ValidImageSizeParameters(ValidationContext *context,
GLenum target, GLenum target,
...@@ -337,12 +336,10 @@ bool ValidateDiscardFramebufferBase(Context *context, ...@@ -337,12 +336,10 @@ bool ValidateDiscardFramebufferBase(Context *context,
bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *marker); bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *marker);
bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *marker); bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *marker);
bool ValidateEGLImageTargetTexture2DOES(Context *context, bool ValidateEGLImageTargetTexture2DOES(Context *context, GLenum target, GLeglImageOES image);
GLenum target,
egl::Image *image);
bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context, bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
GLenum target, GLenum target,
egl::Image *image); GLeglImageOES image);
bool ValidateBindVertexArrayBase(Context *context, GLuint array); bool ValidateBindVertexArrayBase(Context *context, GLuint array);
......
...@@ -218,8 +218,8 @@ ANGLE_EXPORT void GL_APIENTRY PathCommandsCHROMIUM(GLuint path, ...@@ -218,8 +218,8 @@ ANGLE_EXPORT void GL_APIENTRY PathCommandsCHROMIUM(GLuint path,
const void *coords); const void *coords);
ANGLE_EXPORT void GL_APIENTRY PathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value); ANGLE_EXPORT void GL_APIENTRY PathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value);
ANGLE_EXPORT void GL_APIENTRY PathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value); ANGLE_EXPORT void GL_APIENTRY PathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value);
ANGLE_EXPORT void GL_APIENTRY GetPathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat *value); ANGLE_EXPORT void GL_APIENTRY GetPathParameterfvCHROMIUM(GLuint path, GLenum pname, GLfloat *value);
ANGLE_EXPORT void GL_APIENTRY GetPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint *value); ANGLE_EXPORT void GL_APIENTRY GetPathParameterivCHROMIUM(GLuint path, GLenum pname, GLint *value);
ANGLE_EXPORT void GL_APIENTRY PathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask); ANGLE_EXPORT void GL_APIENTRY PathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask);
ANGLE_EXPORT void GL_APIENTRY StencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask); ANGLE_EXPORT void GL_APIENTRY StencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask);
ANGLE_EXPORT void GL_APIENTRY StencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask); ANGLE_EXPORT void GL_APIENTRY StencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask);
......
...@@ -1938,12 +1938,12 @@ void GL_APIENTRY glPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value ...@@ -1938,12 +1938,12 @@ void GL_APIENTRY glPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value
void GL_APIENTRY glGetPathParameterfvCHROMIUM(GLuint path, GLenum pname, GLfloat *value) void GL_APIENTRY glGetPathParameterfvCHROMIUM(GLuint path, GLenum pname, GLfloat *value)
{ {
gl::GetPathParameterfCHROMIUM(path, pname, value); gl::GetPathParameterfvCHROMIUM(path, pname, value);
} }
void GL_APIENTRY glGetPathParameterivCHROMIUM(GLuint path, GLenum pname, GLint *value) void GL_APIENTRY glGetPathParameterivCHROMIUM(GLuint path, GLenum pname, GLint *value)
{ {
gl::GetPathParameteriCHROMIUM(path, pname, value); gl::GetPathParameterivCHROMIUM(path, pname, value);
} }
void GL_APIENTRY glPathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask) void GL_APIENTRY glPathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask)
......
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