Commit 3ef140a9 by Jamie Madill Committed by Commit Bot

Finish refactoring the rest of the ES3 entry points.

BUG=angleproject:747 Change-Id: I3da02120bfff5f33f15a5a9dd45ec99fd654425f Reviewed-on: https://chromium-review.googlesource.com/636518Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
parent 7f0c5a4b
......@@ -617,11 +617,6 @@ GLuint Context::createPaths(GLsizei range)
return resultOrError.getResult();
}
GLuint Context::createSampler()
{
return mState.mSamplers->createSampler();
}
// Returns an unused framebuffer name
GLuint Context::createFramebuffer()
{
......@@ -774,16 +769,6 @@ void Context::setPathStencilFunc(GLenum func, GLint ref, GLuint mask)
mGLState.setPathStencilFunc(func, ref, mask);
}
void Context::deleteSampler(GLuint sampler)
{
if (mState.mSamplers->getSampler(sampler))
{
detachSampler(sampler);
}
mState.mSamplers->deleteObject(this, sampler);
}
void Context::deleteFramebuffer(GLuint framebuffer)
{
if (mState.mFramebuffers->getFramebuffer(framebuffer))
......@@ -2358,7 +2343,7 @@ void Context::detachSampler(GLuint sampler)
mGLState.detachSampler(this, sampler);
}
void Context::setVertexAttribDivisor(GLuint index, GLuint divisor)
void Context::vertexAttribDivisor(GLuint index, GLuint divisor)
{
mGLState.setVertexAttribDivisor(this, index, divisor);
}
......@@ -5220,4 +5205,43 @@ void Context::getInteger64v(GLenum pname, GLint64 *params)
}
}
void Context::getBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
{
Buffer *buffer = mGLState.getTargetBuffer(target);
QueryBufferParameteri64v(buffer, pname, params);
}
void Context::genSamplers(GLsizei count, GLuint *samplers)
{
for (int i = 0; i < count; i++)
{
samplers[i] = mState.mSamplers->createSampler();
}
}
void Context::deleteSamplers(GLsizei count, const GLuint *samplers)
{
for (int i = 0; i < count; i++)
{
GLuint sampler = samplers[i];
if (mState.mSamplers->getSampler(sampler))
{
detachSampler(sampler);
}
mState.mSamplers->deleteObject(this, sampler);
}
}
void Context::getInternalformativ(GLenum target,
GLenum internalformat,
GLenum pname,
GLsizei bufSize,
GLint *params)
{
const TextureCaps &formatCaps = mTextureCaps.get(internalformat);
QueryInternalFormativ(formatCaps, pname, bufSize, params);
}
} // namespace gl
......@@ -84,7 +84,6 @@ class Context final : public ValidationContext
GLuint createProgram();
GLuint createTexture();
GLuint createRenderbuffer();
GLuint createSampler();
GLuint createPaths(GLsizei range);
void deleteBuffer(GLuint buffer);
......@@ -92,7 +91,6 @@ class Context final : public ValidationContext
void deleteProgram(GLuint program);
void deleteTexture(GLuint texture);
void deleteRenderbuffer(GLuint renderbuffer);
void deleteSampler(GLuint sampler);
void deletePaths(GLuint first, GLsizei range);
// CHROMIUM_path_rendering
......@@ -171,7 +169,7 @@ class Context final : public ValidationContext
void getQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params);
void getQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
void setVertexAttribDivisor(GLuint index, GLuint divisor);
void vertexAttribDivisor(GLuint index, GLuint divisor);
void setVertexBindingDivisor(GLuint bindingIndex, GLuint divisor);
void getBufferParameteriv(GLenum target, GLenum pname, GLint *params);
......@@ -866,6 +864,15 @@ class Context final : public ValidationContext
void waitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
void getInteger64v(GLenum pname, GLint64 *params);
void getBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
void genSamplers(GLsizei count, GLuint *samplers);
void deleteSamplers(GLsizei count, const GLuint *samplers);
void getInternalformativ(GLenum target,
GLenum internalformat,
GLenum pname,
GLsizei bufSize,
GLint *params);
// Returns the error.
Error handleError(const Error &error) override;
......
......@@ -1176,6 +1176,18 @@ bool ValidateInvalidateFramebuffer(Context *context,
defaultFramebuffer);
}
bool ValidateInvalidateSubFramebuffer(Context *context,
GLenum target,
GLsizei numAttachments,
const GLenum *attachments,
GLint x,
GLint y,
GLsizei width,
GLsizei height)
{
return ValidateInvalidateFramebuffer(context, target, numAttachments, attachments);
}
bool ValidateClearBuffer(ValidationContext *context)
{
if (context->getClientMajorVersion() < 3)
......@@ -3497,4 +3509,94 @@ bool ValidateGetInteger64v(Context *context, GLenum pname, GLint64 *params)
return true;
}
bool ValidateIsSampler(Context *context, GLuint sampler)
{
if (context->getClientMajorVersion() < 3)
{
context->handleError(InvalidOperation());
return false;
}
return true;
}
bool ValidateBindSampler(Context *context, GLuint unit, GLuint sampler)
{
if (context->getClientMajorVersion() < 3)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false;
}
if (sampler != 0 && !context->isSampler(sampler))
{
context->handleError(InvalidOperation());
return false;
}
if (unit >= context->getCaps().maxCombinedTextureImageUnits)
{
context->handleError(InvalidValue());
return false;
}
return true;
}
bool ValidateVertexAttribDivisor(Context *context, GLuint index, GLuint divisor)
{
if (context->getClientMajorVersion() < 3)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false;
}
return ValidateVertexAttribIndex(context, index);
}
bool ValidateTexStorage2D(Context *context,
GLenum target,
GLsizei levels,
GLenum internalformat,
GLsizei width,
GLsizei height)
{
if (context->getClientMajorVersion() < 3)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false;
}
if (!ValidateES3TexStorage2DParameters(context, target, levels, internalformat, width, height,
1))
{
return false;
}
return true;
}
bool ValidateTexStorage3D(Context *context,
GLenum target,
GLsizei levels,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLsizei depth)
{
if (context->getClientMajorVersion() < 3)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES3Required);
return false;
}
if (!ValidateES3TexStorage3DParameters(context, target, levels, internalformat, width, height,
depth))
{
return false;
}
return true;
}
} // namespace gl
......@@ -165,6 +165,15 @@ bool ValidateInvalidateFramebuffer(Context *context,
GLsizei numAttachments,
const GLenum *attachments);
bool ValidateInvalidateSubFramebuffer(Context *context,
GLenum target,
GLsizei numAttachments,
const GLenum *attachments,
GLint x,
GLint y,
GLsizei width,
GLsizei height);
bool ValidateClearBuffer(ValidationContext *context);
bool ValidateDrawRangeElements(Context *context,
......@@ -559,6 +568,23 @@ bool ValidateClientWaitSync(Context *context, GLsync sync, GLbitfield flags, GLu
bool ValidateWaitSync(Context *context, GLsync sync, GLbitfield flags, GLuint64 timeout);
bool ValidateGetInteger64v(Context *context, GLenum pname, GLint64 *params);
bool ValidateIsSampler(Context *context, GLuint sampler);
bool ValidateBindSampler(Context *context, GLuint unit, GLuint sampler);
bool ValidateVertexAttribDivisor(Context *context, GLuint index, GLuint divisor);
bool ValidateTexStorage2D(Context *context,
GLenum target,
GLsizei levels,
GLenum internalformat,
GLsizei width,
GLsizei height);
bool ValidateTexStorage3D(Context *context,
GLenum target,
GLsizei levels,
GLenum internalformat,
GLsizei width,
GLsizei height,
GLsizei depth);
} // namespace gl
#endif // LIBANGLE_VALIDATION_ES3_H_
......@@ -690,7 +690,7 @@ void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
}
}
context->setVertexAttribDivisor(index, divisor);
context->vertexAttribDivisor(index, divisor);
}
}
......
......@@ -1604,8 +1604,7 @@ void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *pa
return;
}
Buffer *buffer = context->getGLState().getTargetBuffer(target);
QueryBufferParameteri64v(buffer, pname, params);
context->getBufferParameteri64v(target, pname, params);
}
}
......@@ -1621,10 +1620,7 @@ void GL_APIENTRY GenSamplers(GLsizei count, GLuint *samplers)
return;
}
for (int i = 0; i < count; i++)
{
samplers[i] = context->createSampler();
}
context->genSamplers(count, samplers);
}
}
......@@ -1640,10 +1636,7 @@ void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint *samplers)
return;
}
for (int i = 0; i < count; i++)
{
context->deleteSampler(samplers[i]);
}
context->deleteSamplers(count, samplers);
}
}
......@@ -1654,9 +1647,8 @@ GLboolean GL_APIENTRY IsSampler(GLuint sampler)
Context *context = GetValidGlobalContext();
if (context)
{
if (context->getClientMajorVersion() < 3)
if (!context->skipValidation() && !ValidateIsSampler(context, sampler))
{
context->handleError(InvalidOperation());
return GL_FALSE;
}
......@@ -1673,21 +1665,8 @@ void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler)
Context *context = GetValidGlobalContext();
if (context)
{
if (context->getClientMajorVersion() < 3)
{
context->handleError(InvalidOperation());
return;
}
if (sampler != 0 && !context->isSampler(sampler))
if (!context->skipValidation() && !ValidateBindSampler(context, unit, sampler))
{
context->handleError(InvalidOperation());
return;
}
if (unit >= context->getCaps().maxCombinedTextureImageUnits)
{
context->handleError(InvalidValue());
return;
}
......@@ -1808,19 +1787,12 @@ void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor)
Context *context = GetValidGlobalContext();
if (context)
{
if (context->getClientMajorVersion() < 3)
if (!context->skipValidation() && !ValidateVertexAttribDivisor(context, index, divisor))
{
context->handleError(InvalidOperation());
return;
}
if (index >= MAX_VERTEX_ATTRIBS)
{
context->handleError(InvalidValue());
return;
}
context->setVertexAttribDivisor(index, divisor);
context->vertexAttribDivisor(index, divisor);
}
}
......@@ -2025,7 +1997,8 @@ void GL_APIENTRY InvalidateSubFramebuffer(GLenum target,
if (context)
{
if (!context->skipValidation() &&
!ValidateInvalidateFramebuffer(context, target, numAttachments, attachments))
!ValidateInvalidateSubFramebuffer(context, target, numAttachments, attachments, x, y,
width, height))
{
return;
}
......@@ -2045,14 +2018,8 @@ TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width
Context *context = GetValidGlobalContext();
if (context)
{
if (context->getClientMajorVersion() < 3)
{
context->handleError(InvalidOperation());
return;
}
if (!ValidateES3TexStorage2DParameters(context, target, levels, internalformat, width,
height, 1))
if (!context->skipValidation() &&
!ValidateTexStorage2D(context, target, levels, internalformat, width, height))
{
return;
}
......@@ -2077,14 +2044,8 @@ void GL_APIENTRY TexStorage3D(GLenum target,
Context *context = GetValidGlobalContext();
if (context)
{
if (context->getClientMajorVersion() < 3)
{
context->handleError(InvalidOperation());
return;
}
if (!ValidateES3TexStorage3DParameters(context, target, levels, internalformat, width,
height, depth))
if (!context->skipValidation() &&
!ValidateTexStorage3D(context, target, levels, internalformat, width, height, depth))
{
return;
}
......@@ -2114,8 +2075,7 @@ void GL_APIENTRY GetInternalformativ(GLenum target,
return;
}
const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
QueryInternalFormativ(formatCaps, pname, bufSize, params);
context->getInternalformativ(target, internalformat, pname, bufSize, params);
}
}
}
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