Commit 9696d073 by Jamie Madill Committed by Commit Bot

Clean up the ES3 entry points for auto-generation.

Removes some unnecessary includes, and moves some validatoinfunctions to the ES3-only file. BUG=angleproject:1309 Change-Id: I3b274014c48f6f39b5e67223987c91fbc5b4d390 Reviewed-on: https://chromium-review.googlesource.com/636519Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 70b5bb00
......@@ -54,9 +54,6 @@ template_entry_point_source = """// GENERATED FILE - DO NOT EDIT.
// entry_points_gles_{major_version}_{minor_version}_autogen.cpp:
// Defines the GLES {major_version}.{minor_version} entry points.
#include "libGLESv2/entry_points_gles_{major_version}_{minor_version}_autogen.h"
#include "common/debug.h"
#include "libANGLE/Context.h"
#include "libANGLE/validationES2.h"
#include "libGLESv2/global_state.h"
......
......@@ -390,221 +390,6 @@ bool ValidateTextureSRGBDecodeValue(Context *context, ParamType *params)
return true;
}
template <typename ParamType>
bool ValidateSamplerParameterBase(Context *context,
GLuint sampler,
GLenum pname,
GLsizei bufSize,
ParamType *params)
{
if (context->getClientMajorVersion() < 3)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false;
}
if (!context->isSampler(sampler))
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidSampler);
return false;
}
const GLsizei minBufSize = 1;
if (bufSize >= 0 && bufSize < minBufSize)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InsufficientBufferSize);
return false;
}
switch (pname)
{
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
case GL_TEXTURE_WRAP_R:
if (!ValidateTextureWrapModeValue(context, params, false))
{
return false;
}
break;
case GL_TEXTURE_MIN_FILTER:
if (!ValidateTextureMinFilterValue(context, params, false))
{
return false;
}
break;
case GL_TEXTURE_MAG_FILTER:
if (!ValidateTextureMagFilterValue(context, params))
{
return false;
}
break;
case GL_TEXTURE_MIN_LOD:
case GL_TEXTURE_MAX_LOD:
// any value is permissible
break;
case GL_TEXTURE_COMPARE_MODE:
if (!ValidateTextureCompareModeValue(context, params))
{
return false;
}
break;
case GL_TEXTURE_COMPARE_FUNC:
if (!ValidateTextureCompareFuncValue(context, params))
{
return false;
}
break;
case GL_TEXTURE_SRGB_DECODE_EXT:
if (!ValidateTextureSRGBDecodeValue(context, params))
{
return false;
}
break;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
return false;
}
return true;
}
bool ValidateGetSamplerParameterBase(Context *context,
GLuint sampler,
GLenum pname,
GLsizei *length)
{
if (length)
{
*length = 0;
}
if (context->getClientMajorVersion() < 3)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false;
}
if (!context->isSampler(sampler))
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidSampler);
return false;
}
switch (pname)
{
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
case GL_TEXTURE_WRAP_R:
case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_MAG_FILTER:
case GL_TEXTURE_MIN_LOD:
case GL_TEXTURE_MAX_LOD:
case GL_TEXTURE_COMPARE_MODE:
case GL_TEXTURE_COMPARE_FUNC:
break;
case GL_TEXTURE_SRGB_DECODE_EXT:
if (!context->getExtensions().textureSRGBDecode)
{
context->handleError(InvalidEnum() << "GL_EXT_texture_sRGB_decode is not enabled.");
return false;
}
break;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
return false;
}
if (length)
{
*length = 1;
}
return true;
}
bool ValidateGetInternalFormativBase(Context *context,
GLenum target,
GLenum internalformat,
GLenum pname,
GLsizei bufSize,
GLsizei *numParams)
{
if (numParams)
{
*numParams = 0;
}
if (context->getClientMajorVersion() < 3)
{
context->handleError(InvalidOperation() << "Context does not support OpenGL ES 3.0.");
return false;
}
const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
if (!formatCaps.renderable)
{
context->handleError(InvalidEnum() << "Internal format is not renderable.");
return false;
}
switch (target)
{
case GL_RENDERBUFFER:
break;
case GL_TEXTURE_2D_MULTISAMPLE:
if (context->getClientVersion() < ES_3_1)
{
context->handleError(InvalidOperation()
<< "Texture target requires at least OpenGL ES 3.1.");
return false;
}
break;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTarget);
return false;
}
if (bufSize < 0)
{
ANGLE_VALIDATION_ERR(context, InvalidValue(), InsufficientBufferSize);
return false;
}
GLsizei maxWriteParams = 0;
switch (pname)
{
case GL_NUM_SAMPLE_COUNTS:
maxWriteParams = 1;
break;
case GL_SAMPLES:
maxWriteParams = static_cast<GLsizei>(formatCaps.sampleCounts.size());
break;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
return false;
}
if (numParams)
{
// glGetInternalFormativ will not overflow bufSize
*numParams = std::min(bufSize, maxWriteParams);
}
return true;
}
bool ValidateUniformCommonBase(ValidationContext *context,
gl::Program *program,
GLint location,
......@@ -4252,14 +4037,6 @@ bool ValidateGetBufferParameterivRobustANGLE(ValidationContext *context,
return true;
}
bool ValidateGetBufferParameteri64v(ValidationContext *context,
GLenum target,
GLenum pname,
GLint64 *params)
{
return ValidateGetBufferParameterBase(context, target, pname, false, nullptr);
}
bool ValidateGetBufferParameteri64vRobustANGLE(ValidationContext *context,
GLenum target,
GLenum pname,
......@@ -4506,11 +4283,6 @@ bool ValidateTexParameterivRobustANGLE(Context *context,
return ValidateTexParameterBase(context, target, pname, bufSize, params);
}
bool ValidateGetSamplerParameterfv(Context *context, GLuint sampler, GLenum pname, GLfloat *params)
{
return ValidateGetSamplerParameterBase(context, sampler, pname, nullptr);
}
bool ValidateGetSamplerParameterfvRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
......@@ -4536,11 +4308,6 @@ bool ValidateGetSamplerParameterfvRobustANGLE(Context *context,
return true;
}
bool ValidateGetSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, GLint *params)
{
return ValidateGetSamplerParameterBase(context, sampler, pname, nullptr);
}
bool ValidateGetSamplerParameterivRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
......@@ -4566,19 +4333,6 @@ bool ValidateGetSamplerParameterivRobustANGLE(Context *context,
return true;
}
bool ValidateSamplerParameterf(Context *context, GLuint sampler, GLenum pname, GLfloat param)
{
return ValidateSamplerParameterBase(context, sampler, pname, -1, &param);
}
bool ValidateSamplerParameterfv(Context *context,
GLuint sampler,
GLenum pname,
const GLfloat *params)
{
return ValidateSamplerParameterBase(context, sampler, pname, -1, params);
}
bool ValidateSamplerParameterfvRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
......@@ -4593,16 +4347,6 @@ bool ValidateSamplerParameterfvRobustANGLE(Context *context,
return ValidateSamplerParameterBase(context, sampler, pname, bufSize, params);
}
bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, GLint param)
{
return ValidateSamplerParameterBase(context, sampler, pname, -1, &param);
}
bool ValidateSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, const GLint *params)
{
return ValidateSamplerParameterBase(context, sampler, pname, -1, params);
}
bool ValidateSamplerParameterivRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
......@@ -4692,11 +4436,6 @@ bool ValidateGetVertexAttribPointervRobustANGLE(Context *context,
return true;
}
bool ValidateGetVertexAttribIiv(Context *context, GLuint index, GLenum pname, GLint *params)
{
return ValidateGetVertexAttribBase(context, index, pname, nullptr, false, true);
}
bool ValidateGetVertexAttribIivRobustANGLE(Context *context,
GLuint index,
GLenum pname,
......@@ -4722,11 +4461,6 @@ bool ValidateGetVertexAttribIivRobustANGLE(Context *context,
return true;
}
bool ValidateGetVertexAttribIuiv(Context *context, GLuint index, GLenum pname, GLuint *params)
{
return ValidateGetVertexAttribBase(context, index, pname, nullptr, false, true);
}
bool ValidateGetVertexAttribIuivRobustANGLE(Context *context,
GLuint index,
GLenum pname,
......@@ -4778,17 +4512,6 @@ bool ValidateGetActiveUniformBlockivRobustANGLE(Context *context,
return true;
}
bool ValidateGetInternalFormativ(Context *context,
GLenum target,
GLenum internalformat,
GLenum pname,
GLsizei bufSize,
GLint *params)
{
return ValidateGetInternalFormativBase(context, target, internalformat, pname, bufSize,
nullptr);
}
bool ValidateGetInternalFormativRobustANGLE(Context *context,
GLenum target,
GLenum internalformat,
......@@ -5854,4 +5577,222 @@ bool ValidateGetActiveUniformBlockivBase(Context *context,
return true;
}
template <typename ParamType>
bool ValidateSamplerParameterBase(Context *context,
GLuint sampler,
GLenum pname,
GLsizei bufSize,
ParamType *params)
{
if (context->getClientMajorVersion() < 3)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false;
}
if (!context->isSampler(sampler))
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidSampler);
return false;
}
const GLsizei minBufSize = 1;
if (bufSize >= 0 && bufSize < minBufSize)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InsufficientBufferSize);
return false;
}
switch (pname)
{
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
case GL_TEXTURE_WRAP_R:
if (!ValidateTextureWrapModeValue(context, params, false))
{
return false;
}
break;
case GL_TEXTURE_MIN_FILTER:
if (!ValidateTextureMinFilterValue(context, params, false))
{
return false;
}
break;
case GL_TEXTURE_MAG_FILTER:
if (!ValidateTextureMagFilterValue(context, params))
{
return false;
}
break;
case GL_TEXTURE_MIN_LOD:
case GL_TEXTURE_MAX_LOD:
// any value is permissible
break;
case GL_TEXTURE_COMPARE_MODE:
if (!ValidateTextureCompareModeValue(context, params))
{
return false;
}
break;
case GL_TEXTURE_COMPARE_FUNC:
if (!ValidateTextureCompareFuncValue(context, params))
{
return false;
}
break;
case GL_TEXTURE_SRGB_DECODE_EXT:
if (!ValidateTextureSRGBDecodeValue(context, params))
{
return false;
}
break;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
return false;
}
return true;
}
template bool ValidateSamplerParameterBase(Context *, GLuint, GLenum, GLsizei, GLfloat *);
template bool ValidateSamplerParameterBase(Context *, GLuint, GLenum, GLsizei, GLint *);
bool ValidateGetSamplerParameterBase(Context *context,
GLuint sampler,
GLenum pname,
GLsizei *length)
{
if (length)
{
*length = 0;
}
if (context->getClientMajorVersion() < 3)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false;
}
if (!context->isSampler(sampler))
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidSampler);
return false;
}
switch (pname)
{
case GL_TEXTURE_WRAP_S:
case GL_TEXTURE_WRAP_T:
case GL_TEXTURE_WRAP_R:
case GL_TEXTURE_MIN_FILTER:
case GL_TEXTURE_MAG_FILTER:
case GL_TEXTURE_MIN_LOD:
case GL_TEXTURE_MAX_LOD:
case GL_TEXTURE_COMPARE_MODE:
case GL_TEXTURE_COMPARE_FUNC:
break;
case GL_TEXTURE_SRGB_DECODE_EXT:
if (!context->getExtensions().textureSRGBDecode)
{
context->handleError(InvalidEnum() << "GL_EXT_texture_sRGB_decode is not enabled.");
return false;
}
break;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
return false;
}
if (length)
{
*length = 1;
}
return true;
}
bool ValidateGetInternalFormativBase(Context *context,
GLenum target,
GLenum internalformat,
GLenum pname,
GLsizei bufSize,
GLsizei *numParams)
{
if (numParams)
{
*numParams = 0;
}
if (context->getClientMajorVersion() < 3)
{
context->handleError(InvalidOperation() << "Context does not support OpenGL ES 3.0.");
return false;
}
const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
if (!formatCaps.renderable)
{
context->handleError(InvalidEnum() << "Internal format is not renderable.");
return false;
}
switch (target)
{
case GL_RENDERBUFFER:
break;
case GL_TEXTURE_2D_MULTISAMPLE:
if (context->getClientVersion() < ES_3_1)
{
context->handleError(InvalidOperation()
<< "Texture target requires at least OpenGL ES 3.1.");
return false;
}
break;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTarget);
return false;
}
if (bufSize < 0)
{
ANGLE_VALIDATION_ERR(context, InvalidValue(), InsufficientBufferSize);
return false;
}
GLsizei maxWriteParams = 0;
switch (pname)
{
case GL_NUM_SAMPLE_COUNTS:
maxWriteParams = 1;
break;
case GL_SAMPLES:
maxWriteParams = static_cast<GLsizei>(formatCaps.sampleCounts.size());
break;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported);
return false;
}
if (numParams)
{
// glGetInternalFormativ will not overflow bufSize
*numParams = std::min(bufSize, maxWriteParams);
}
return true;
}
} // namespace gl
......@@ -410,10 +410,6 @@ bool ValidateGetBufferParameterivRobustANGLE(ValidationContext *context,
GLsizei *length,
GLint *params);
bool ValidateGetBufferParameteri64v(ValidationContext *context,
GLenum target,
GLenum pname,
GLint64 *params);
bool ValidateGetBufferParameteri64vRobustANGLE(ValidationContext *context,
GLenum target,
GLenum pname,
......@@ -481,14 +477,12 @@ bool ValidateTexParameterivRobustANGLE(Context *context,
GLsizei bufSize,
const GLint *params);
bool ValidateGetSamplerParameterfv(Context *context, GLuint sampler, GLenum pname, GLfloat *params);
bool ValidateGetSamplerParameterfvRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
GLuint bufSize,
GLsizei *length,
GLfloat *params);
bool ValidateGetSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, GLint *params);
bool ValidateGetSamplerParameterivRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
......@@ -496,21 +490,11 @@ bool ValidateGetSamplerParameterivRobustANGLE(Context *context,
GLsizei *length,
GLint *params);
bool ValidateSamplerParameterf(Context *context, GLuint sampler, GLenum pname, GLfloat param);
bool ValidateSamplerParameterfv(Context *context,
GLuint sampler,
GLenum pname,
const GLfloat *params);
bool ValidateSamplerParameterfvRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
GLsizei bufSize,
const GLfloat *params);
bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, GLint param);
bool ValidateSamplerParameteriv(Context *context,
GLuint sampler,
GLenum pname,
const GLint *params);
bool ValidateSamplerParameterivRobustANGLE(Context *context,
GLuint sampler,
GLenum pname,
......@@ -544,7 +528,6 @@ bool ValidateGetVertexAttribPointervRobustANGLE(Context *context,
GLsizei *length,
void **pointer);
bool ValidateGetVertexAttribIiv(Context *context, GLuint index, GLenum pname, GLint *params);
bool ValidateGetVertexAttribIivRobustANGLE(Context *context,
GLuint index,
GLenum pname,
......@@ -552,7 +535,6 @@ bool ValidateGetVertexAttribIivRobustANGLE(Context *context,
GLsizei *length,
GLint *params);
bool ValidateGetVertexAttribIuiv(Context *context, GLuint index, GLenum pname, GLuint *params);
bool ValidateGetVertexAttribIuivRobustANGLE(Context *context,
GLuint index,
GLenum pname,
......@@ -568,13 +550,6 @@ bool ValidateGetActiveUniformBlockivRobustANGLE(Context *context,
GLsizei *length,
GLint *params);
bool ValidateGetInternalFormativ(Context *context,
GLenum target,
GLenum internalformat,
GLenum pname,
GLsizei bufSize,
GLint *params);
bool ValidateGetInternalFormativRobustANGLE(Context *context,
GLenum target,
GLenum internalformat,
......@@ -606,6 +581,25 @@ bool ValidateGetActiveUniformBlockivBase(Context *context,
GLenum pname,
GLsizei *length);
bool ValidateGetSamplerParameterBase(Context *context,
GLuint sampler,
GLenum pname,
GLsizei *length);
template <typename ParamType>
bool ValidateSamplerParameterBase(Context *context,
GLuint sampler,
GLenum pname,
GLsizei bufSize,
ParamType *params);
bool ValidateGetInternalFormativBase(Context *context,
GLenum target,
GLenum internalformat,
GLenum pname,
GLsizei bufSize,
GLsizei *numParams);
} // namespace gl
#endif // LIBANGLE_VALIDATION_ES_H_
......@@ -3598,4 +3598,66 @@ bool ValidateTexStorage3D(Context *context,
return true;
}
bool ValidateGetBufferParameteri64v(ValidationContext *context,
GLenum target,
GLenum pname,
GLint64 *params)
{
return ValidateGetBufferParameterBase(context, target, pname, false, nullptr);
}
bool ValidateGetSamplerParameterfv(Context *context, GLuint sampler, GLenum pname, GLfloat *params)
{
return ValidateGetSamplerParameterBase(context, sampler, pname, nullptr);
}
bool ValidateGetSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, GLint *params)
{
return ValidateGetSamplerParameterBase(context, sampler, pname, nullptr);
}
bool ValidateSamplerParameterf(Context *context, GLuint sampler, GLenum pname, GLfloat param)
{
return ValidateSamplerParameterBase(context, sampler, pname, -1, &param);
}
bool ValidateSamplerParameterfv(Context *context,
GLuint sampler,
GLenum pname,
const GLfloat *params)
{
return ValidateSamplerParameterBase(context, sampler, pname, -1, params);
}
bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, GLint param)
{
return ValidateSamplerParameterBase(context, sampler, pname, -1, &param);
}
bool ValidateSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, const GLint *params)
{
return ValidateSamplerParameterBase(context, sampler, pname, -1, params);
}
bool ValidateGetVertexAttribIiv(Context *context, GLuint index, GLenum pname, GLint *params)
{
return ValidateGetVertexAttribBase(context, index, pname, nullptr, false, true);
}
bool ValidateGetVertexAttribIuiv(Context *context, GLuint index, GLenum pname, GLuint *params)
{
return ValidateGetVertexAttribBase(context, index, pname, nullptr, false, true);
}
bool ValidateGetInternalformativ(Context *context,
GLenum target,
GLenum internalformat,
GLenum pname,
GLsizei bufSize,
GLint *params)
{
return ValidateGetInternalFormativBase(context, target, internalformat, pname, bufSize,
nullptr);
}
} // namespace gl
......@@ -585,6 +585,31 @@ bool ValidateTexStorage3D(Context *context,
GLsizei height,
GLsizei depth);
bool ValidateGetVertexAttribIiv(Context *context, GLuint index, GLenum pname, GLint *params);
bool ValidateGetVertexAttribIuiv(Context *context, GLuint index, GLenum pname, GLuint *params);
bool ValidateGetBufferParameteri64v(ValidationContext *context,
GLenum target,
GLenum pname,
GLint64 *params);
bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, GLint param);
bool ValidateSamplerParameteriv(Context *context,
GLuint sampler,
GLenum pname,
const GLint *params);
bool ValidateSamplerParameterf(Context *context, GLuint sampler, GLenum pname, GLfloat param);
bool ValidateSamplerParameterfv(Context *context,
GLuint sampler,
GLenum pname,
const GLfloat *params);
bool ValidateGetSamplerParameteriv(Context *context, GLuint sampler, GLenum pname, GLint *params);
bool ValidateGetSamplerParameterfv(Context *context, GLuint sampler, GLenum pname, GLfloat *params);
bool ValidateGetInternalformativ(Context *context,
GLenum target,
GLenum internalformat,
GLenum pname,
GLsizei bufSize,
GLint *params);
} // namespace gl
#endif // LIBANGLE_VALIDATION_ES3_H_
......@@ -8,9 +8,6 @@
// entry_points_gles_2_0_autogen.cpp:
// Defines the GLES 2.0 entry points.
#include "libGLESv2/entry_points_gles_2_0_autogen.h"
#include "common/debug.h"
#include "libANGLE/Context.h"
#include "libANGLE/validationES2.h"
#include "libGLESv2/global_state.h"
......
......@@ -7,24 +7,10 @@
// entry_points_gles_3_0.cpp : Implements the GLES 3.0 entry points.
#include "libGLESv2/entry_points_gles_3_0.h"
#include "libGLESv2/entry_points_gles_2_0_ext.h"
#include "libGLESv2/global_state.h"
#include "libANGLE/Buffer.h"
#include "libANGLE/Context.h"
#include "libANGLE/Error.h"
#include "libANGLE/Fence.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/Query.h"
#include "libANGLE/VertexArray.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/queryconversions.h"
#include "libANGLE/queryutils.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES3.h"
#include "common/debug.h"
#include "libGLESv2/global_state.h"
namespace gl
{
......@@ -2070,7 +2056,7 @@ void GL_APIENTRY GetInternalformativ(GLenum target,
if (context)
{
if (!context->skipValidation() &&
!ValidateGetInternalFormativ(context, target, internalformat, pname, bufSize, params))
!ValidateGetInternalformativ(context, target, internalformat, pname, bufSize, params))
{
return;
}
......
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