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,
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)
{
......@@ -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)
{
......@@ -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)
{
mGLState.setPathStencilFunc(func, ref, mask);
......@@ -1840,7 +1854,17 @@ void Context::insertEventMarker(GLsizei length, const char *marker)
void Context::pushGroupMarker(GLsizei length, const char *marker)
{
ASSERT(mImplementation);
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()
......@@ -3424,7 +3448,7 @@ void Context::generateMipmap(GLenum target)
handleError(texture->generateMipmap(this));
}
void Context::copyTextureCHROMIUM(GLuint sourceId,
void Context::copyTexture(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
......@@ -3445,7 +3469,7 @@ void Context::copyTextureCHROMIUM(GLuint sourceId,
ConvertToBool(unpackUnmultiplyAlpha), sourceTexture));
}
void Context::copySubTextureCHROMIUM(GLuint sourceId,
void Context::copySubTexture(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
......@@ -3478,7 +3502,7 @@ void Context::copySubTextureCHROMIUM(GLuint sourceId,
ConvertToBool(unpackUnmultiplyAlpha), sourceTexture));
}
void Context::compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId)
void Context::compressedCopyTexture(GLuint sourceId, GLuint destId)
{
syncStateForTexImage();
......@@ -5748,4 +5772,45 @@ void Context::readnPixels(GLint x,
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
......@@ -106,8 +106,10 @@ class Context final : public ValidationContext
GLsizei numCoords,
GLenum coordType,
const void *coords);
void setPathParameterf(GLuint path, GLenum pname, GLfloat value);
void getPathParameterfv(GLuint path, GLenum pname, GLfloat *value) const;
void pathParameterf(GLuint path, GLenum pname, GLfloat value);
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);
// Framebuffers are owned by the Context, so these methods do not pass through
......@@ -120,6 +122,8 @@ class Context final : public ValidationContext
void finishFenceNV(GLuint fence);
void getFenceivNV(GLuint fence, GLenum pname, GLint *params);
GLboolean isFenceNV(GLuint fence);
void setFenceNV(GLuint fence, GLenum condition);
GLboolean testFenceNV(GLuint fence);
void bindTexture(GLenum target, GLuint handle);
void bindReadFramebuffer(GLuint framebufferHandle);
......@@ -527,7 +531,7 @@ class Context final : public ValidationContext
GLenum format,
GLsizei imageSize,
const void *data);
void copyTextureCHROMIUM(GLuint sourceId,
void copyTexture(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
......@@ -537,7 +541,7 @@ class Context final : public ValidationContext
GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha);
void copySubTextureCHROMIUM(GLuint sourceId,
void copySubTexture(GLuint sourceId,
GLint sourceLevel,
GLenum destTarget,
GLuint destId,
......@@ -551,7 +555,7 @@ class Context final : public ValidationContext
GLboolean unpackFlipY,
GLboolean unpackPremultiplyAlpha,
GLboolean unpackUnmultiplyAlpha);
void compressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId);
void compressedCopyTexture(GLuint sourceId, GLuint destId);
void generateMipmap(GLenum target);
......@@ -979,6 +983,8 @@ class Context final : public ValidationContext
GLenum type,
GLsizei bufSize,
void *data);
void eGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
void eGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
// Consumes the error.
void handleError(const Error &error) override;
......
......@@ -3167,8 +3167,15 @@ bool ValidateDiscardFramebufferBase(Context *context,
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)
{
return false;
......@@ -3184,8 +3191,15 @@ bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *
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)
{
return false;
......@@ -3199,9 +3213,7 @@ bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *ma
return true;
}
bool ValidateEGLImageTargetTexture2DOES(Context *context,
GLenum target,
egl::Image *image)
bool ValidateEGLImageTargetTexture2DOES(Context *context, GLenum target, GLeglImageOES image)
{
if (!context->getExtensions().eglImage && !context->getExtensions().eglImageExternal)
{
......@@ -3232,14 +3244,16 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context,
return false;
}
egl::Image *imageObject = reinterpret_cast<egl::Image *>(image);
ASSERT(context->getCurrentDisplay());
if (!context->getCurrentDisplay()->isValidImage(image))
if (!context->getCurrentDisplay()->isValidImage(imageObject))
{
context->handleError(InvalidValue() << "EGL image is not valid.");
return false;
}
if (image->getSamples() > 0)
if (imageObject->getSamples() > 0)
{
context->handleError(InvalidOperation()
<< "cannot create a 2D texture from a multisampled EGL image.");
......@@ -3247,7 +3261,7 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context,
}
const TextureCaps &textureCaps =
context->getTextureCaps().get(image->getFormat().info->sizedInternalFormat);
context->getTextureCaps().get(imageObject->getFormat().info->sizedInternalFormat);
if (!textureCaps.texturable)
{
context->handleError(InvalidOperation()
......@@ -3260,7 +3274,7 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context,
bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
GLenum target,
egl::Image *image)
GLeglImageOES image)
{
if (!context->getExtensions().eglImage)
{
......@@ -3278,15 +3292,17 @@ bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
return false;
}
egl::Image *imageObject = reinterpret_cast<egl::Image *>(image);
ASSERT(context->getCurrentDisplay());
if (!context->getCurrentDisplay()->isValidImage(image))
if (!context->getCurrentDisplay()->isValidImage(imageObject))
{
context->handleError(InvalidValue() << "EGL image is not valid.");
return false;
}
const TextureCaps &textureCaps =
context->getTextureCaps().get(image->getFormat().info->sizedInternalFormat);
context->getTextureCaps().get(imageObject->getFormat().info->sizedInternalFormat);
if (!textureCaps.renderable)
{
context->handleError(InvalidOperation()
......
......@@ -39,7 +39,6 @@ bool ValidTexture2DDestinationTarget(const ValidationContext *context, GLenum ta
bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum target);
bool ValidTexLevelDestinationTarget(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 ValidImageSizeParameters(ValidationContext *context,
GLenum target,
......@@ -337,12 +336,10 @@ bool ValidateDiscardFramebufferBase(Context *context,
bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *marker);
bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *marker);
bool ValidateEGLImageTargetTexture2DOES(Context *context,
GLenum target,
egl::Image *image);
bool ValidateEGLImageTargetTexture2DOES(Context *context, GLenum target, GLeglImageOES image);
bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context,
GLenum target,
egl::Image *image);
GLeglImageOES image);
bool ValidateBindVertexArrayBase(Context *context, GLuint array);
......
......@@ -227,35 +227,40 @@ bool ValidateBindUniformLocationCHROMIUM(Context *context,
bool ValidateCoverageModulationCHROMIUM(Context *context, GLenum components);
// CHROMIUM_path_rendering
bool ValidateMatrix(Context *context, GLenum matrixMode, const GLfloat *matrix);
bool ValidateMatrixMode(Context *context, GLenum matrixMode);
bool ValidateGenPaths(Context *context, GLsizei range);
bool ValidateDeletePaths(Context *context, GLuint first, GLsizei range);
bool ValidatePathCommands(Context *context,
bool ValidateMatrixLoadfCHROMIUM(Context *context, GLenum matrixMode, const GLfloat *matrix);
bool ValidateMatrixLoadIdentityCHROMIUM(Context *context, GLenum matrixMode);
bool ValidateGenPathsCHROMIUM(Context *context, GLsizei range);
bool ValidateDeletePathsCHROMIUM(Context *context, GLuint first, GLsizei range);
bool ValidatePathCommandsCHROMIUM(Context *context,
GLuint path,
GLsizei numCommands,
const GLubyte *commands,
GLsizei numCoords,
GLenum coordType,
const void *coords);
bool ValidateSetPathParameter(Context *context, GLuint path, GLenum pname, GLfloat value);
bool ValidateGetPathParameter(Context *context, GLuint path, GLenum pname, GLfloat *value);
bool ValidatePathStencilFunc(Context *context, GLenum func, GLint ref, GLuint mask);
bool ValidateStencilFillPath(Context *context, GLuint path, GLenum fillMode, GLuint mask);
bool ValidateStencilStrokePath(Context *context, GLuint path, GLint reference, GLuint mask);
bool ValidateCoverPath(Context *context, GLuint path, GLenum coverMode);
bool ValidateStencilThenCoverFillPath(Context *context,
bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname, GLfloat value);
bool ValidatePathParameteriCHROMIUM(Context *context, GLuint path, GLenum pname, GLint value);
bool ValidateGetPathParameterfvCHROMIUM(Context *context,
GLuint path,
GLenum pname,
GLfloat *value);
bool ValidateGetPathParameterivCHROMIUM(Context *context, GLuint path, GLenum pname, GLint *value);
bool ValidatePathStencilFuncCHROMIUM(Context *context, GLenum func, GLint ref, GLuint mask);
bool ValidateStencilFillPathCHROMIUM(Context *context, GLuint path, GLenum fillMode, GLuint mask);
bool ValidateStencilStrokePathCHROMIUM(Context *context, GLuint path, GLint reference, GLuint mask);
bool ValidateCoverPathCHROMIUM(Context *context, GLuint path, GLenum coverMode);
bool ValidateStencilThenCoverFillPathCHROMIUM(Context *context,
GLuint path,
GLenum fillMode,
GLuint mask,
GLenum coverMode);
bool ValidateStencilThenCoverStrokePath(Context *context,
bool ValidateStencilThenCoverStrokePathCHROMIUM(Context *context,
GLuint path,
GLint reference,
GLuint mask,
GLenum coverMode);
bool ValidateIsPath(Context *context);
bool ValidateCoverFillPathInstanced(Context *context,
bool ValidateIsPathCHROMIUM(Context *context);
bool ValidateCoverFillPathInstancedCHROMIUM(Context *context,
GLsizei numPaths,
GLenum pathNameType,
const void *paths,
......@@ -263,7 +268,7 @@ bool ValidateCoverFillPathInstanced(Context *context,
GLenum coverMode,
GLenum transformType,
const GLfloat *transformValues);
bool ValidateCoverStrokePathInstanced(Context *context,
bool ValidateCoverStrokePathInstancedCHROMIUM(Context *context,
GLsizei numPaths,
GLenum pathNameType,
const void *paths,
......@@ -271,7 +276,7 @@ bool ValidateCoverStrokePathInstanced(Context *context,
GLenum coverMode,
GLenum transformType,
const GLfloat *transformValues);
bool ValidateStencilFillPathInstanced(Context *context,
bool ValidateStencilFillPathInstancedCHROMIUM(Context *context,
GLsizei numPaths,
GLenum pathNameType,
const void *paths,
......@@ -280,7 +285,7 @@ bool ValidateStencilFillPathInstanced(Context *context,
GLuint mask,
GLenum transformType,
const GLfloat *transformValues);
bool ValidateStencilStrokePathInstanced(Context *context,
bool ValidateStencilStrokePathInstancedCHROMIUM(Context *context,
GLsizei numPaths,
GLenum pathNameType,
const void *paths,
......@@ -289,7 +294,7 @@ bool ValidateStencilStrokePathInstanced(Context *context,
GLuint mask,
GLenum transformType,
const GLfloat *transformValues);
bool ValidateStencilThenCoverFillPathInstanced(Context *context,
bool ValidateStencilThenCoverFillPathInstancedCHROMIUM(Context *context,
GLsizei numPaths,
GLenum pathNameType,
const void *paths,
......@@ -299,7 +304,7 @@ bool ValidateStencilThenCoverFillPathInstanced(Context *context,
GLenum coverMode,
GLenum transformType,
const GLfloat *transformValues);
bool ValidateStencilThenCoverStrokePathInstanced(Context *context,
bool ValidateStencilThenCoverStrokePathInstancedCHROMIUM(Context *context,
GLsizei numPaths,
GLenum pathNameType,
const void *paths,
......@@ -309,11 +314,11 @@ bool ValidateStencilThenCoverStrokePathInstanced(Context *context,
GLenum coverMode,
GLenum transformType,
const GLfloat *transformValues);
bool ValidateBindFragmentInputLocation(Context *context,
bool ValidateBindFragmentInputLocationCHROMIUM(Context *context,
GLuint program,
GLint location,
const GLchar *name);
bool ValidateProgramPathFragmentInputGen(Context *context,
bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context,
GLuint program,
GLint location,
GLenum genMode,
......@@ -694,6 +699,27 @@ bool ValidateGetTranslatedShaderSourceANGLE(Context *context,
GLsizei *length,
GLchar *source);
bool ValidateIsFenceNV(Context *context, GLuint fence);
bool ValidateSetFenceNV(Context *context, GLuint fence, GLenum condition);
bool ValidateTestFenceNV(Context *context, GLuint fence);
bool ValidateTexStorage2DEXT(Context *context,
GLenum target,
GLsizei levels,
GLenum internalformat,
GLsizei width,
GLsizei height);
bool ValidateVertexAttribDivisorANGLE(Context *context, GLuint index, GLuint divisor);
bool ValidateTexImage3DOES(Context *context,
GLenum target,
GLint level,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLsizei depth,
GLint border,
GLenum format,
GLenum type,
const void *pixels);
bool ValidatePopGroupMarkerEXT(Context *context);
} // namespace gl
......
......@@ -218,8 +218,8 @@ ANGLE_EXPORT void GL_APIENTRY PathCommandsCHROMIUM(GLuint path,
const void *coords);
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 GetPathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat *value);
ANGLE_EXPORT void GL_APIENTRY GetPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint *value);
ANGLE_EXPORT void GL_APIENTRY GetPathParameterfvCHROMIUM(GLuint path, GLenum pname, GLfloat *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 StencilFillPathCHROMIUM(GLuint path, GLenum fillMode, 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
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)
{
gl::GetPathParameteriCHROMIUM(path, pname, value);
gl::GetPathParameterivCHROMIUM(path, pname, value);
}
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