Commit 5451d532 by Jiajia Qin Committed by Commit Bot

Refactor ES31 entry points

BUG=angleproject:2254 Change-Id: I4e837a831e0950330b243bd8aa01831af0a70cc4 Reviewed-on: https://chromium-review.googlesource.com/775604 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 85072e8f
......@@ -634,6 +634,12 @@ GLuint Context::createProgramPipeline()
return mState.mPipelines->createProgramPipeline();
}
GLuint Context::createShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
{
UNIMPLEMENTED();
return 0u;
}
void Context::deleteBuffer(GLuint buffer)
{
if (mState.mBuffers->getBuffer(buffer))
......@@ -1001,6 +1007,11 @@ void Context::useProgram(GLuint program)
mGLState.setProgram(this, getProgram(program));
}
void Context::useProgramStages(GLuint pipeline, GLbitfield stages, GLuint program)
{
UNIMPLEMENTED();
}
void Context::bindTransformFeedback(GLenum target, GLuint transformFeedbackHandle)
{
ASSERT(target == GL_TRANSFORM_FEEDBACK);
......@@ -1648,6 +1659,21 @@ void Context::getTexParameteriv(GLenum target, GLenum pname, GLint *params)
Texture *texture = getTargetTexture(target);
QueryTexParameteriv(texture, pname, params);
}
void Context::getTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
{
Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
QueryTexLevelParameteriv(texture, target, level, pname, params);
}
void Context::getTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params)
{
Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
QueryTexLevelParameterfv(texture, target, level, pname, params);
}
void Context::texParameterf(GLenum target, GLenum pname, GLfloat param)
{
Texture *texture = getTargetTexture(target);
......@@ -3455,6 +3481,11 @@ void Context::syncStateForBlit()
syncRendererState(mBlitDirtyBits, mBlitDirtyObjects);
}
void Context::activeShaderProgram(GLuint pipeline, GLuint program)
{
UNIMPLEMENTED();
}
void Context::activeTexture(GLenum texture)
{
mGLState.setActiveSampler(texture - GL_TEXTURE0);
......@@ -3776,7 +3807,7 @@ void Context::vertexAttribBinding(GLuint attribIndex, GLuint bindingIndex)
mGLState.setVertexAttribBinding(this, attribIndex, bindingIndex);
}
void Context::setVertexBindingDivisor(GLuint bindingIndex, GLuint divisor)
void Context::vertexBindingDivisor(GLuint bindingIndex, GLuint divisor)
{
mGLState.setVertexBindingDivisor(bindingIndex, divisor);
}
......@@ -4084,7 +4115,7 @@ void Context::getFramebufferParameteriv(GLenum target, GLenum pname, GLint *para
QueryFramebufferParameteriv(framebuffer, pname, params);
}
void Context::setFramebufferParameteri(GLenum target, GLenum pname, GLint param)
void Context::framebufferParameteri(GLenum target, GLenum pname, GLint param)
{
Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
SetFramebufferParameteri(framebuffer, pname, param);
......@@ -4126,6 +4157,11 @@ void Context::dispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGr
handleError(mImplementation->dispatchCompute(this, numGroupsX, numGroupsY, numGroupsZ));
}
void Context::dispatchComputeIndirect(GLintptr indirect)
{
UNIMPLEMENTED();
}
void Context::texStorage2D(GLenum target,
GLsizei levels,
GLenum internalFormat,
......@@ -4149,6 +4185,16 @@ void Context::texStorage3D(GLenum target,
handleError(texture->setStorage(this, target, levels, internalFormat, size));
}
void Context::memoryBarrier(GLbitfield barriers)
{
UNIMPLEMENTED();
}
void Context::memoryBarrierByRegion(GLbitfield barriers)
{
UNIMPLEMENTED();
}
GLenum Context::checkFramebufferStatus(GLenum target)
{
Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target);
......@@ -4343,6 +4389,11 @@ void Context::getProgramiv(GLuint program, GLenum pname, GLint *params)
QueryProgramiv(this, programObject, pname, params);
}
void Context::getProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
{
UNIMPLEMENTED();
}
void Context::getProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog)
{
Program *programObject = getProgram(program);
......@@ -4350,6 +4401,14 @@ void Context::getProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length
programObject->getInfoLog(bufsize, length, infolog);
}
void Context::getProgramPipelineInfoLog(GLuint pipeline,
GLsizei bufSize,
GLsizei *length,
GLchar *infoLog)
{
UNIMPLEMENTED();
}
void Context::getShaderiv(GLuint shader, GLenum pname, GLint *params)
{
Shader *shaderObject = getShader(shader);
......@@ -4720,6 +4779,11 @@ void Context::validateProgram(GLuint program)
programObject->validate(mCaps);
}
void Context::validateProgramPipeline(GLuint pipeline)
{
UNIMPLEMENTED();
}
void Context::getProgramBinary(GLuint program,
GLsizei bufSize,
GLsizei *length,
......@@ -5182,6 +5246,90 @@ void Context::getInternalformativ(GLenum target,
QueryInternalFormativ(formatCaps, pname, bufSize, params);
}
void Context::programUniform1i(GLuint program, GLint location, GLint v0)
{
programUniform1iv(program, location, 1, &v0);
}
void Context::programUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
{
GLint xy[2] = {v0, v1};
programUniform2iv(program, location, 1, xy);
}
void Context::programUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
{
GLint xyz[3] = {v0, v1, v2};
programUniform3iv(program, location, 1, xyz);
}
void Context::programUniform4i(GLuint program,
GLint location,
GLint v0,
GLint v1,
GLint v2,
GLint v3)
{
GLint xyzw[4] = {v0, v1, v2, v3};
programUniform4iv(program, location, 1, xyzw);
}
void Context::programUniform1ui(GLuint program, GLint location, GLuint v0)
{
programUniform1uiv(program, location, 1, &v0);
}
void Context::programUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
{
GLuint xy[2] = {v0, v1};
programUniform2uiv(program, location, 1, xy);
}
void Context::programUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
{
GLuint xyz[3] = {v0, v1, v2};
programUniform3uiv(program, location, 1, xyz);
}
void Context::programUniform4ui(GLuint program,
GLint location,
GLuint v0,
GLuint v1,
GLuint v2,
GLuint v3)
{
GLuint xyzw[4] = {v0, v1, v2, v3};
programUniform4uiv(program, location, 1, xyzw);
}
void Context::programUniform1f(GLuint program, GLint location, GLfloat v0)
{
programUniform1fv(program, location, 1, &v0);
}
void Context::programUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
{
GLfloat xy[2] = {v0, v1};
programUniform2fv(program, location, 1, xy);
}
void Context::programUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
{
GLfloat xyz[3] = {v0, v1, v2};
programUniform3fv(program, location, 1, xyz);
}
void Context::programUniform4f(GLuint program,
GLint location,
GLfloat v0,
GLfloat v1,
GLfloat v2,
GLfloat v3)
{
GLfloat xyzw[4] = {v0, v1, v2, v3};
programUniform4fv(program, location, 1, xyzw);
}
void Context::programUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value)
{
Program *programObject = getProgram(program);
......@@ -5193,6 +5341,182 @@ void Context::programUniform1iv(GLuint program, GLint location, GLsizei count, c
}
}
void Context::programUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniform2iv(location, count, value);
}
void Context::programUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniform3iv(location, count, value);
}
void Context::programUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniform4iv(location, count, value);
}
void Context::programUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniform1uiv(location, count, value);
}
void Context::programUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniform2uiv(location, count, value);
}
void Context::programUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniform3uiv(location, count, value);
}
void Context::programUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniform4uiv(location, count, value);
}
void Context::programUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniform1fv(location, count, value);
}
void Context::programUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniform2fv(location, count, value);
}
void Context::programUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniform3fv(location, count, value);
}
void Context::programUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniform4fv(location, count, value);
}
void Context::programUniformMatrix2fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix2fv(location, count, transpose, value);
}
void Context::programUniformMatrix3fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix3fv(location, count, transpose, value);
}
void Context::programUniformMatrix4fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix4fv(location, count, transpose, value);
}
void Context::programUniformMatrix2x3fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix2x3fv(location, count, transpose, value);
}
void Context::programUniformMatrix3x2fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix3x2fv(location, count, transpose, value);
}
void Context::programUniformMatrix2x4fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix2x4fv(location, count, transpose, value);
}
void Context::programUniformMatrix4x2fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix4x2fv(location, count, transpose, value);
}
void Context::programUniformMatrix3x4fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix3x4fv(location, count, transpose, value);
}
void Context::programUniformMatrix4x3fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
Program *programObject = getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix4x3fv(location, count, transpose, value);
}
void Context::onTextureChange(const Texture *texture)
{
// Conservatively assume all textures are dirty.
......
......@@ -87,6 +87,7 @@ class Context final : public ValidationContext
GLuint createRenderbuffer();
GLuint createPaths(GLsizei range);
GLuint createProgramPipeline();
GLuint createShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings);
void deleteBuffer(GLuint buffer);
void deleteShader(GLuint shader);
......@@ -134,6 +135,7 @@ class Context final : public ValidationContext
GLenum access,
GLenum format);
void useProgram(GLuint program);
void useProgramStages(GLuint pipeline, GLbitfield stages, GLuint program);
void bindTransformFeedback(GLenum target, GLuint transformFeedbackHandle);
void bindProgramPipeline(GLuint pipelineHandle);
......@@ -147,7 +149,7 @@ class Context final : public ValidationContext
void getQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params);
void vertexAttribDivisor(GLuint index, GLuint divisor);
void setVertexBindingDivisor(GLuint bindingIndex, GLuint divisor);
void vertexBindingDivisor(GLuint bindingIndex, GLuint divisor);
void getBufferParameteriv(BufferBinding target, GLenum pname, GLint *params);
void getFramebufferAttachmentParameteriv(GLenum target,
......@@ -158,6 +160,8 @@ class Context final : public ValidationContext
void getTexParameterfv(GLenum target, GLenum pname, GLfloat *params);
void getTexParameteriv(GLenum target, GLenum pname, GLint *params);
void getTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params);
void getTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params);
void texParameterf(GLenum target, GLenum pname, GLfloat param);
void texParameterfv(GLenum target, GLenum pname, const GLfloat *params);
void texParameteri(GLenum target, GLenum pname, GLint param);
......@@ -239,6 +243,7 @@ class Context final : public ValidationContext
void getIntegeri_v(GLenum target, GLuint index, GLint *data);
void getInteger64i_v(GLenum target, GLuint index, GLint64 *data);
void activeShaderProgram(GLuint pipeline, GLuint program);
void activeTexture(GLenum texture);
void blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
void blendEquation(GLenum mode);
......@@ -701,7 +706,12 @@ class Context final : public ValidationContext
void getAttachedShaders(GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders);
GLint getAttribLocation(GLuint program, const GLchar *name);
void getProgramiv(GLuint program, GLenum pname, GLint *params);
void getProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params);
void getProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog);
void getProgramPipelineInfoLog(GLuint pipeline,
GLsizei bufSize,
GLsizei *length,
GLchar *infoLog);
void getShaderiv(GLuint shader, GLenum pname, GLint *params);
void getShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog);
void getShaderPrecisionFormat(GLenum shadertype,
......@@ -753,6 +763,7 @@ class Context final : public ValidationContext
void uniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void uniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void validateProgram(GLuint program);
void validateProgramPipeline(GLuint pipeline);
void genQueries(GLsizei n, GLuint *ids);
void deleteQueries(GLsizei n, const GLuint *ids);
......@@ -861,7 +872,94 @@ class Context final : public ValidationContext
GLsizei bufSize,
GLint *params);
void programUniform1i(GLuint program, GLint location, GLint v0);
void programUniform2i(GLuint program, GLint location, GLint v0, GLint v1);
void programUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
void programUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
void programUniform1ui(GLuint program, GLint location, GLuint v0);
void programUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1);
void programUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
void programUniform4ui(GLuint program,
GLint location,
GLuint v0,
GLuint v1,
GLuint v2,
GLuint v3);
void programUniform1f(GLuint program, GLint location, GLfloat v0);
void programUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1);
void programUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
void programUniform4f(GLuint program,
GLint location,
GLfloat v0,
GLfloat v1,
GLfloat v2,
GLfloat v3);
void programUniform1iv(GLuint program, GLint location, GLsizei count, const GLint *value);
void programUniform2iv(GLuint program, GLint location, GLsizei count, const GLint *value);
void programUniform3iv(GLuint program, GLint location, GLsizei count, const GLint *value);
void programUniform4iv(GLuint program, GLint location, GLsizei count, const GLint *value);
void programUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
void programUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
void programUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
void programUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint *value);
void programUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
void programUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
void programUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
void programUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat *value);
void programUniformMatrix2fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
void programUniformMatrix3fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
void programUniformMatrix4fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
void programUniformMatrix2x3fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
void programUniformMatrix3x2fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
void programUniformMatrix2x4fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
void programUniformMatrix4x2fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
void programUniformMatrix3x4fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
void programUniformMatrix4x3fv(GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
void deleteProgramPipelines(GLsizei n, const GLuint *pipelines);
void genProgramPipelines(GLsizei n, GLuint *pipelines);
......@@ -893,12 +991,13 @@ class Context final : public ValidationContext
const Workarounds &getWorkarounds() const;
void getFramebufferParameteriv(GLenum target, GLenum pname, GLint *params);
void setFramebufferParameteri(GLenum target, GLenum pname, GLint param);
void framebufferParameteri(GLenum target, GLenum pname, GLint param);
Error getScratchBuffer(size_t requestedSizeBytes, angle::MemoryBuffer **scratchBufferOut) const;
Error getZeroFilledBuffer(size_t requstedSizeBytes, angle::MemoryBuffer **zeroBufferOut) const;
void dispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ);
void dispatchComputeIndirect(GLintptr indirect);
MemoryProgramCache *getMemoryProgramCache() const { return mMemoryProgramCache; }
......@@ -917,6 +1016,9 @@ class Context final : public ValidationContext
GLsizei height,
GLsizei depth);
void memoryBarrier(GLbitfield barriers);
void memoryBarrierByRegion(GLbitfield barriers);
// Notification for a state change in a Texture.
void onTextureChange(const Texture *texture);
......
......@@ -18,7 +18,6 @@
#include "libANGLE/Query.h"
#include "libANGLE/Texture.h"
#include "libANGLE/TransformFeedback.h"
#include "libANGLE/Uniform.h"
#include "libANGLE/VertexArray.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/queryconversions.h"
......@@ -393,128 +392,6 @@ bool ValidateTextureSRGBDecodeValue(Context *context, ParamType *params)
return true;
}
bool ValidateUniformCommonBase(ValidationContext *context,
gl::Program *program,
GLint location,
GLsizei count,
const LinkedUniform **uniformOut)
{
// TODO(Jiajia): Add image uniform check in future.
if (count < 0)
{
ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeCount);
return false;
}
if (!program)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidProgramName);
return false;
}
if (!program->isLinked())
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
return false;
}
if (location == -1)
{
// Silently ignore the uniform command
return false;
}
const auto &uniformLocations = program->getUniformLocations();
size_t castedLocation = static_cast<size_t>(location);
if (castedLocation >= uniformLocations.size())
{
context->handleError(InvalidOperation() << "Invalid uniform location");
return false;
}
const auto &uniformLocation = uniformLocations[castedLocation];
if (uniformLocation.ignored)
{
// Silently ignore the uniform command
return false;
}
if (!uniformLocation.used())
{
context->handleError(InvalidOperation());
return false;
}
const auto &uniform = program->getUniformByIndex(uniformLocation.index);
// attempting to write an array to a non-array uniform is an INVALID_OPERATION
if (!uniform.isArray() && count > 1)
{
context->handleError(InvalidOperation());
return false;
}
*uniformOut = &uniform;
return true;
}
bool ValidateUniform1ivValue(ValidationContext *context,
GLenum uniformType,
GLsizei count,
const GLint *value)
{
// Value type is GL_INT, because we only get here from glUniform1i{v}.
// It is compatible with INT or BOOL.
// Do these cheap tests first, for a little extra speed.
if (GL_INT == uniformType || GL_BOOL == uniformType)
{
return true;
}
if (IsSamplerType(uniformType))
{
// Check that the values are in range.
const GLint max = context->getCaps().maxCombinedTextureImageUnits;
for (GLsizei i = 0; i < count; ++i)
{
if (value[i] < 0 || value[i] >= max)
{
context->handleError(InvalidValue() << "sampler uniform value out of range");
return false;
}
}
return true;
}
context->handleError(InvalidOperation() << "wrong type of value for uniform");
return false;
}
bool ValidateUniformValue(ValidationContext *context, GLenum valueType, GLenum uniformType)
{
// Check that the value type is compatible with uniform type.
// Do the cheaper test first, for a little extra speed.
if (valueType == uniformType || VariableBoolVectorType(valueType) == uniformType)
{
return true;
}
ANGLE_VALIDATION_ERR(context, InvalidOperation(), UniformSizeMismatch);
return false;
}
bool ValidateUniformMatrixValue(ValidationContext *context, GLenum valueType, GLenum uniformType)
{
// Check that the value type is compatible with uniform type.
if (valueType == uniformType)
{
return true;
}
context->handleError(InvalidOperation() << "wrong type of value for uniform");
return false;
}
bool ValidateFragmentShaderColorBufferTypeMatch(ValidationContext *context)
{
const Program *program = context->getGLState().getProgram();
......@@ -2103,62 +1980,126 @@ bool ValidateGetQueryObjectui64vRobustANGLE(Context *context,
return true;
}
bool ValidateProgramUniform(gl::Context *context,
GLenum valueType,
GLuint program,
GLint location,
GLsizei count)
bool ValidateUniformCommonBase(ValidationContext *context,
gl::Program *program,
GLint location,
GLsizei count,
const LinkedUniform **uniformOut)
{
// Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1))
// TODO(Jiajia): Add image uniform check in future.
if (count < 0)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeCount);
return false;
}
const LinkedUniform *uniform = nullptr;
gl::Program *programObject = GetValidProgram(context, program);
return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
ValidateUniformValue(context, valueType, uniform->type);
if (!program)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidProgramName);
return false;
}
if (!program->isLinked())
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked);
return false;
}
if (location == -1)
{
// Silently ignore the uniform command
return false;
}
const auto &uniformLocations = program->getUniformLocations();
size_t castedLocation = static_cast<size_t>(location);
if (castedLocation >= uniformLocations.size())
{
context->handleError(InvalidOperation() << "Invalid uniform location");
return false;
}
const auto &uniformLocation = uniformLocations[castedLocation];
if (uniformLocation.ignored)
{
// Silently ignore the uniform command
return false;
}
if (!uniformLocation.used())
{
context->handleError(InvalidOperation());
return false;
}
const auto &uniform = program->getUniformByIndex(uniformLocation.index);
// attempting to write an array to a non-array uniform is an INVALID_OPERATION
if (!uniform.isArray() && count > 1)
{
context->handleError(InvalidOperation());
return false;
}
*uniformOut = &uniform;
return true;
}
bool ValidateProgramUniform1iv(gl::Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLint *value)
bool ValidateUniform1ivValue(ValidationContext *context,
GLenum uniformType,
GLsizei count,
const GLint *value)
{
// Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1))
// Value type is GL_INT, because we only get here from glUniform1i{v}.
// It is compatible with INT or BOOL.
// Do these cheap tests first, for a little extra speed.
if (GL_INT == uniformType || GL_BOOL == uniformType)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
return true;
}
const LinkedUniform *uniform = nullptr;
gl::Program *programObject = GetValidProgram(context, program);
return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
ValidateUniform1ivValue(context, uniform->type, count, value);
if (IsSamplerType(uniformType))
{
// Check that the values are in range.
const GLint max = context->getCaps().maxCombinedTextureImageUnits;
for (GLsizei i = 0; i < count; ++i)
{
if (value[i] < 0 || value[i] >= max)
{
context->handleError(InvalidValue() << "sampler uniform value out of range");
return false;
}
}
return true;
}
context->handleError(InvalidOperation() << "wrong type of value for uniform");
return false;
}
bool ValidateProgramUniformMatrix(gl::Context *context,
GLenum valueType,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose)
bool ValidateUniformValue(ValidationContext *context, GLenum valueType, GLenum uniformType)
{
// Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1))
// Check that the value type is compatible with uniform type.
// Do the cheaper test first, for a little extra speed.
if (valueType == uniformType || VariableBoolVectorType(valueType) == uniformType)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
return true;
}
const LinkedUniform *uniform = nullptr;
gl::Program *programObject = GetValidProgram(context, program);
return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
ValidateUniformMatrixValue(context, valueType, uniform->type);
ANGLE_VALIDATION_ERR(context, InvalidOperation(), UniformSizeMismatch);
return false;
}
bool ValidateUniformMatrixValue(ValidationContext *context, GLenum valueType, GLenum uniformType)
{
// Check that the value type is compatible with uniform type.
if (valueType == uniformType)
{
return true;
}
context->handleError(InvalidOperation() << "wrong type of value for uniform");
return false;
}
bool ValidateUniform(ValidationContext *context, GLenum valueType, GLint location, GLsizei count)
......
......@@ -26,6 +26,7 @@ namespace gl
{
class Context;
struct Format;
struct LinkedUniform;
class Program;
class Shader;
class ValidationContext;
......@@ -210,23 +211,17 @@ bool ValidateGetQueryObjectui64vRobustANGLE(Context *context,
GLsizei *length,
GLuint64 *params);
bool ValidateProgramUniform(Context *context,
GLenum uniformType,
GLuint program,
GLint location,
GLsizei count);
bool ValidateProgramUniform1iv(Context *context,
GLuint program,
bool ValidateUniformCommonBase(ValidationContext *context,
gl::Program *program,
GLint location,
GLsizei count,
const GLint *value);
bool ValidateProgramUniformMatrix(Context *context,
GLenum matrixType,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose);
const LinkedUniform **uniformOut);
bool ValidateUniform1ivValue(ValidationContext *context,
GLenum uniformType,
GLsizei count,
const GLint *value);
bool ValidateUniformValue(ValidationContext *context, GLenum valueType, GLenum uniformType);
bool ValidateUniformMatrixValue(ValidationContext *context, GLenum valueType, GLenum uniformType);
bool ValidateUniform(ValidationContext *context, GLenum uniformType, GLint location, GLsizei count);
bool ValidateUniformMatrix(ValidationContext *context,
GLenum matrixType,
......
......@@ -283,6 +283,78 @@ bool ValidateProgramResourceIndex(const Program *programObject,
}
}
bool ValidateProgramUniform(gl::Context *context,
GLenum valueType,
GLuint program,
GLint location,
GLsizei count)
{
// Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1))
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
const LinkedUniform *uniform = nullptr;
gl::Program *programObject = GetValidProgram(context, program);
return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
ValidateUniformValue(context, valueType, uniform->type);
}
bool ValidateProgramUniformMatrix(gl::Context *context,
GLenum valueType,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose)
{
// Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1))
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
const LinkedUniform *uniform = nullptr;
gl::Program *programObject = GetValidProgram(context, program);
return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
ValidateUniformMatrixValue(context, valueType, uniform->type);
}
bool ValidateVertexAttribFormatCommon(ValidationContext *context,
GLuint attribIndex,
GLint size,
GLenum type,
GLuint relativeOffset,
GLboolean pureInteger)
{
if (context->getClientVersion() < ES_3_1)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
const Caps &caps = context->getCaps();
if (relativeOffset > static_cast<GLuint>(caps.maxVertexAttribRelativeOffset))
{
context->handleError(
InvalidValue()
<< "relativeOffset cannot be greater than MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.");
return false;
}
// [OpenGL ES 3.1] Section 10.3.1 page 243:
// An INVALID_OPERATION error is generated if the default vertex array object is bound.
if (context->getGLState().getVertexArrayId() == 0)
{
context->handleError(InvalidOperation() << "Default vertex array object is bound.");
return false;
}
return ValidateVertexFormatBase(context, attribIndex, size, type, pureInteger);
}
} // anonymous namespace
bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data)
......@@ -456,6 +528,333 @@ bool ValidateDrawElementsIndirect(Context *context, GLenum mode, GLenum type, co
return true;
}
bool ValidateProgramUniform1i(Context *context, GLuint program, GLint location, GLint v0)
{
return ValidateProgramUniform1iv(context, program, location, 1, &v0);
}
bool ValidateProgramUniform2i(Context *context, GLuint program, GLint location, GLint v0, GLint v1)
{
GLint xy[2] = {v0, v1};
return ValidateProgramUniform2iv(context, program, location, 1, xy);
}
bool ValidateProgramUniform3i(Context *context,
GLuint program,
GLint location,
GLint v0,
GLint v1,
GLint v2)
{
GLint xyz[3] = {v0, v1, v2};
return ValidateProgramUniform3iv(context, program, location, 1, xyz);
}
bool ValidateProgramUniform4i(Context *context,
GLuint program,
GLint location,
GLint v0,
GLint v1,
GLint v2,
GLint v3)
{
GLint xyzw[4] = {v0, v1, v2, v3};
return ValidateProgramUniform4iv(context, program, location, 1, xyzw);
}
bool ValidateProgramUniform1ui(Context *context, GLuint program, GLint location, GLuint v0)
{
return ValidateProgramUniform1uiv(context, program, location, 1, &v0);
}
bool ValidateProgramUniform2ui(Context *context,
GLuint program,
GLint location,
GLuint v0,
GLuint v1)
{
GLuint xy[2] = {v0, v1};
return ValidateProgramUniform2uiv(context, program, location, 1, xy);
}
bool ValidateProgramUniform3ui(Context *context,
GLuint program,
GLint location,
GLuint v0,
GLuint v1,
GLuint v2)
{
GLuint xyz[3] = {v0, v1, v2};
return ValidateProgramUniform3uiv(context, program, location, 1, xyz);
}
bool ValidateProgramUniform4ui(Context *context,
GLuint program,
GLint location,
GLuint v0,
GLuint v1,
GLuint v2,
GLuint v3)
{
GLuint xyzw[4] = {v0, v1, v2, v3};
return ValidateProgramUniform4uiv(context, program, location, 1, xyzw);
}
bool ValidateProgramUniform1f(Context *context, GLuint program, GLint location, GLfloat v0)
{
return ValidateProgramUniform1fv(context, program, location, 1, &v0);
}
bool ValidateProgramUniform2f(Context *context,
GLuint program,
GLint location,
GLfloat v0,
GLfloat v1)
{
GLfloat xy[2] = {v0, v1};
return ValidateProgramUniform2fv(context, program, location, 1, xy);
}
bool ValidateProgramUniform3f(Context *context,
GLuint program,
GLint location,
GLfloat v0,
GLfloat v1,
GLfloat v2)
{
GLfloat xyz[3] = {v0, v1, v2};
return ValidateProgramUniform3fv(context, program, location, 1, xyz);
}
bool ValidateProgramUniform4f(Context *context,
GLuint program,
GLint location,
GLfloat v0,
GLfloat v1,
GLfloat v2,
GLfloat v3)
{
GLfloat xyzw[4] = {v0, v1, v2, v3};
return ValidateProgramUniform4fv(context, program, location, 1, xyzw);
}
bool ValidateProgramUniform1iv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLint *value)
{
// Check for ES31 program uniform entry points
if (context->getClientVersion() < Version(3, 1))
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
const LinkedUniform *uniform = nullptr;
gl::Program *programObject = GetValidProgram(context, program);
return ValidateUniformCommonBase(context, programObject, location, count, &uniform) &&
ValidateUniform1ivValue(context, uniform->type, count, value);
}
bool ValidateProgramUniform2iv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLint *value)
{
return ValidateProgramUniform(context, GL_INT_VEC2, program, location, count);
}
bool ValidateProgramUniform3iv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLint *value)
{
return ValidateProgramUniform(context, GL_INT_VEC3, program, location, count);
}
bool ValidateProgramUniform4iv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLint *value)
{
return ValidateProgramUniform(context, GL_INT_VEC4, program, location, count);
}
bool ValidateProgramUniform1uiv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLuint *value)
{
return ValidateProgramUniform(context, GL_UNSIGNED_INT, program, location, count);
}
bool ValidateProgramUniform2uiv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLuint *value)
{
return ValidateProgramUniform(context, GL_UNSIGNED_INT_VEC2, program, location, count);
}
bool ValidateProgramUniform3uiv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLuint *value)
{
return ValidateProgramUniform(context, GL_UNSIGNED_INT_VEC3, program, location, count);
}
bool ValidateProgramUniform4uiv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLuint *value)
{
return ValidateProgramUniform(context, GL_UNSIGNED_INT_VEC4, program, location, count);
}
bool ValidateProgramUniform1fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLfloat *value)
{
return ValidateProgramUniform(context, GL_FLOAT, program, location, count);
}
bool ValidateProgramUniform2fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLfloat *value)
{
return ValidateProgramUniform(context, GL_FLOAT_VEC2, program, location, count);
}
bool ValidateProgramUniform3fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLfloat *value)
{
return ValidateProgramUniform(context, GL_FLOAT_VEC3, program, location, count);
}
bool ValidateProgramUniform4fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLfloat *value)
{
return ValidateProgramUniform(context, GL_FLOAT_VEC4, program, location, count);
}
bool ValidateProgramUniformMatrix2fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT2, program, location, count,
transpose);
}
bool ValidateProgramUniformMatrix3fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT3, program, location, count,
transpose);
}
bool ValidateProgramUniformMatrix4fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT4, program, location, count,
transpose);
}
bool ValidateProgramUniformMatrix2x3fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT2x3, program, location, count,
transpose);
}
bool ValidateProgramUniformMatrix3x2fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT3x2, program, location, count,
transpose);
}
bool ValidateProgramUniformMatrix2x4fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT2x4, program, location, count,
transpose);
}
bool ValidateProgramUniformMatrix4x2fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT4x2, program, location, count,
transpose);
}
bool ValidateProgramUniformMatrix3x4fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT3x4, program, location, count,
transpose);
}
bool ValidateProgramUniformMatrix4x3fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value)
{
return ValidateProgramUniformMatrix(context, GL_FLOAT_MAT4x3, program, location, count,
transpose);
}
bool ValidateGetTexLevelParameterBase(Context *context,
GLenum target,
GLint level,
......@@ -548,7 +947,7 @@ bool ValidateGetTexLevelParameteriv(Context *context,
return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr);
}
bool ValidateTexStorage2DMultiSample(Context *context,
bool ValidateTexStorage2DMultisample(Context *context,
GLenum target,
GLsizei samples,
GLint internalFormat,
......@@ -660,7 +1059,7 @@ bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfl
return true;
}
bool ValidationFramebufferParameteri(Context *context, GLenum target, GLenum pname, GLint param)
bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname, GLint param)
{
if (context->getClientVersion() < ES_3_1)
{
......@@ -733,10 +1132,7 @@ bool ValidationFramebufferParameteri(Context *context, GLenum target, GLenum pna
return true;
}
bool ValidationGetFramebufferParameteri(Context *context,
GLenum target,
GLenum pname,
GLint *params)
bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params)
{
if (context->getClientVersion() < ES_3_1)
{
......@@ -878,36 +1274,23 @@ bool ValidateVertexBindingDivisor(ValidationContext *context, GLuint bindingInde
}
bool ValidateVertexAttribFormat(ValidationContext *context,
GLuint attribIndex,
GLuint attribindex,
GLint size,
GLenum type,
GLuint relativeOffset,
GLboolean pureInteger)
GLboolean normalized,
GLuint relativeoffset)
{
if (context->getClientVersion() < ES_3_1)
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(), ES31Required);
return false;
}
const Caps &caps = context->getCaps();
if (relativeOffset > static_cast<GLuint>(caps.maxVertexAttribRelativeOffset))
{
context->handleError(
InvalidValue()
<< "relativeOffset cannot be greater than MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.");
return false;
}
// [OpenGL ES 3.1] Section 10.3.1 page 243:
// An INVALID_OPERATION error is generated if the default vertex array object is bound.
if (context->getGLState().getVertexArrayId() == 0)
{
context->handleError(InvalidOperation() << "Default vertex array object is bound.");
return false;
}
return ValidateVertexAttribFormatCommon(context, attribindex, size, type, relativeoffset,
false);
}
return ValidateVertexFormatBase(context, attribIndex, size, type, pureInteger);
bool ValidateVertexAttribIFormat(ValidationContext *context,
GLuint attribindex,
GLint size,
GLenum type,
GLuint relativeoffset)
{
return ValidateVertexAttribFormatCommon(context, attribindex, size, type, relativeoffset, true);
}
bool ValidateVertexAttribBinding(ValidationContext *context,
......@@ -1042,6 +1425,12 @@ bool ValidateDispatchCompute(Context *context,
return true;
}
bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect)
{
UNIMPLEMENTED();
return false;
}
bool ValidateBindImageTexture(Context *context,
GLuint unit,
GLuint texture,
......@@ -1322,7 +1711,62 @@ bool ValidateIsProgramPipeline(Context *context, GLuint pipeline)
return true;
}
bool ValidateSampleMaski(Context *context, GLuint maskNumber)
bool ValidateUseProgramStages(Context *context, GLuint pipeline, GLbitfield stages, GLuint program)
{
UNIMPLEMENTED();
return false;
}
bool ValidateActiveShaderProgram(Context *context, GLuint pipeline, GLuint program)
{
UNIMPLEMENTED();
return false;
}
bool ValidateCreateShaderProgramv(Context *context,
GLenum type,
GLsizei count,
const GLchar *const *strings)
{
UNIMPLEMENTED();
return false;
}
bool ValidateGetProgramPipelineiv(Context *context, GLuint pipeline, GLenum pname, GLint *params)
{
UNIMPLEMENTED();
return false;
}
bool ValidateValidateProgramPipeline(Context *context, GLuint pipeline)
{
UNIMPLEMENTED();
return false;
}
bool ValidateGetProgramPipelineInfoLog(Context *context,
GLuint pipeline,
GLsizei bufSize,
GLsizei *length,
GLchar *infoLog)
{
UNIMPLEMENTED();
return false;
}
bool ValidateMemoryBarrier(Context *context, GLbitfield barriers)
{
UNIMPLEMENTED();
return false;
}
bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers)
{
UNIMPLEMENTED();
return false;
}
bool ValidateSampleMaski(Context *context, GLuint maskNumber, GLbitfield mask)
{
if (context->getClientVersion() < ES_3_1)
{
......
......@@ -35,7 +35,7 @@ bool ValidateGetTexLevelParameteriv(Context *context,
GLenum pname,
GLint *param);
bool ValidateTexStorage2DMultiSample(Context *context,
bool ValidateTexStorage2DMultisample(Context *context,
GLenum target,
GLsizei samples,
GLint internalFormat,
......@@ -48,11 +48,186 @@ bool ValidateDrawIndirectBase(Context *context, GLenum mode, const void *indirec
bool ValidateDrawArraysIndirect(Context *context, GLenum mode, const void *indirect);
bool ValidateDrawElementsIndirect(Context *context, GLenum mode, GLenum type, const void *indirect);
bool ValidationFramebufferParameteri(Context *context, GLenum target, GLenum pname, GLint param);
bool ValidationGetFramebufferParameteri(Context *context,
GLenum target,
GLenum pname,
GLint *params);
bool ValidateProgramUniform1i(Context *context, GLuint program, GLint location, GLint v0);
bool ValidateProgramUniform2i(Context *context, GLuint program, GLint location, GLint v0, GLint v1);
bool ValidateProgramUniform3i(Context *context,
GLuint program,
GLint location,
GLint v0,
GLint v1,
GLint v2);
bool ValidateProgramUniform4i(Context *context,
GLuint program,
GLint location,
GLint v0,
GLint v1,
GLint v2,
GLint v3);
bool ValidateProgramUniform1ui(Context *context, GLuint program, GLint location, GLuint v0);
bool ValidateProgramUniform2ui(Context *context,
GLuint program,
GLint location,
GLuint v0,
GLuint v1);
bool ValidateProgramUniform3ui(Context *context,
GLuint program,
GLint location,
GLuint v0,
GLuint v1,
GLuint v2);
bool ValidateProgramUniform4ui(Context *context,
GLuint program,
GLint location,
GLuint v0,
GLuint v1,
GLuint v2,
GLuint v3);
bool ValidateProgramUniform1f(Context *context, GLuint program, GLint location, GLfloat v0);
bool ValidateProgramUniform2f(Context *context,
GLuint program,
GLint location,
GLfloat v0,
GLfloat v1);
bool ValidateProgramUniform3f(Context *context,
GLuint program,
GLint location,
GLfloat v0,
GLfloat v1,
GLfloat v2);
bool ValidateProgramUniform4f(Context *context,
GLuint program,
GLint location,
GLfloat v0,
GLfloat v1,
GLfloat v2,
GLfloat v3);
bool ValidateProgramUniform1iv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLint *value);
bool ValidateProgramUniform2iv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLint *value);
bool ValidateProgramUniform3iv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLint *value);
bool ValidateProgramUniform4iv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLint *value);
bool ValidateProgramUniform1uiv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLuint *value);
bool ValidateProgramUniform2uiv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLuint *value);
bool ValidateProgramUniform3uiv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLuint *value);
bool ValidateProgramUniform4uiv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLuint *value);
bool ValidateProgramUniform1fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLfloat *value);
bool ValidateProgramUniform2fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLfloat *value);
bool ValidateProgramUniform3fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLfloat *value);
bool ValidateProgramUniform4fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
const GLfloat *value);
bool ValidateProgramUniformMatrix2fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
bool ValidateProgramUniformMatrix2fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
bool ValidateProgramUniformMatrix3fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
bool ValidateProgramUniformMatrix4fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
bool ValidateProgramUniformMatrix2x3fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
bool ValidateProgramUniformMatrix3x2fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
bool ValidateProgramUniformMatrix2x4fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
bool ValidateProgramUniformMatrix4x2fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
bool ValidateProgramUniformMatrix3x4fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
bool ValidateProgramUniformMatrix4x3fv(Context *context,
GLuint program,
GLint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value);
bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname, GLint param);
bool ValidateGetFramebufferParameteriv(Context *context,
GLenum target,
GLenum pname,
GLint *params);
bool ValidateGetProgramResourceIndex(Context *context,
GLuint program,
......@@ -92,11 +267,16 @@ bool ValidateBindVertexBuffer(ValidationContext *context,
GLintptr offset,
GLsizei stride);
bool ValidateVertexAttribFormat(ValidationContext *context,
GLuint attribIndex,
GLuint attribindex,
GLint size,
GLenum type,
GLuint relativeOffset,
GLboolean pureInteger);
GLboolean normalized,
GLuint relativeoffset);
bool ValidateVertexAttribIFormat(ValidationContext *context,
GLuint attribindex,
GLint size,
GLenum type,
GLuint relativeoffset);
bool ValidateVertexAttribBinding(ValidationContext *context,
GLuint attribIndex,
GLuint bindingIndex);
......@@ -106,6 +286,7 @@ bool ValidateDispatchCompute(Context *context,
GLuint numGroupsX,
GLuint numGroupsY,
GLuint numGroupsZ);
bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect);
bool ValidateBindImageTexture(Context *context,
GLuint unit,
......@@ -120,8 +301,24 @@ bool ValidateGenProgramPipelines(Context *context, GLint n, GLuint *pipelines);
bool ValidateDeleteProgramPipelines(Context *context, GLint n, const GLuint *pipelines);
bool ValidateBindProgramPipeline(Context *context, GLuint pipeline);
bool ValidateIsProgramPipeline(Context *context, GLuint pipeline);
bool ValidateUseProgramStages(Context *context, GLuint pipeline, GLbitfield stages, GLuint program);
bool ValidateActiveShaderProgram(Context *context, GLuint pipeline, GLuint program);
bool ValidateCreateShaderProgramv(Context *context,
GLenum type,
GLsizei count,
const GLchar *const *strings);
bool ValidateGetProgramPipelineiv(Context *context, GLuint pipeline, GLenum pname, GLint *params);
bool ValidateValidateProgramPipeline(Context *context, GLuint pipeline);
bool ValidateGetProgramPipelineInfoLog(Context *context,
GLuint pipeline,
GLsizei bufSize,
GLsizei *length,
GLchar *infoLog);
bool ValidateMemoryBarrier(Context *context, GLbitfield barriers);
bool ValidateMemoryBarrierByRegion(Context *context, GLbitfield barriers);
bool ValidateSampleMaski(Context *context, GLuint maskNumber);
bool ValidateSampleMaski(Context *context, GLuint maskNumber, GLbitfield mask);
} // namespace gl
......
......@@ -10,15 +10,8 @@
#include "libGLESv2/global_state.h"
#include "libANGLE/Context.h"
#include "libANGLE/Error.h"
#include "libANGLE/validationES.h"
#include "libANGLE/validationES31.h"
#include "libANGLE/queryconversions.h"
#include "libANGLE/queryutils.h"
#include "common/debug.h"
#include "common/utilities.h"
namespace gl
{
......@@ -43,14 +36,16 @@ void GL_APIENTRY DispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint nu
void GL_APIENTRY DispatchComputeIndirect(GLintptr indirect)
{
EVENT("(GLintptr indirect = %d)", indirect);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation())
if (!context->skipValidation() && !ValidateDispatchComputeIndirect(context, indirect))
{
context->handleError(InvalidOperation() << "Entry point not implemented");
return;
}
UNIMPLEMENTED();
context->dispatchComputeIndirect(indirect);
}
}
......@@ -92,12 +87,12 @@ void GL_APIENTRY FramebufferParameteri(GLenum target, GLenum pname, GLint param)
if (context)
{
if (!context->skipValidation() &&
!ValidationFramebufferParameteri(context, target, pname, param))
!ValidateFramebufferParameteri(context, target, pname, param))
{
return;
}
context->setFramebufferParameteri(target, pname, param);
context->framebufferParameteri(target, pname, param);
}
}
......@@ -109,7 +104,7 @@ void GL_APIENTRY GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *p
if (context)
{
if (!context->skipValidation() &&
!ValidationGetFramebufferParameteri(context, target, pname, params))
!ValidateGetFramebufferParameteriv(context, target, pname, params))
{
return;
}
......@@ -233,43 +228,51 @@ void GL_APIENTRY UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint pro
{
EVENT("(GLuint pipeline = %u, GLbitfield stages = 0x%X, GLuint program = %u)", pipeline, stages,
program);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation())
if (!context->skipValidation() &&
!ValidateUseProgramStages(context, pipeline, stages, program))
{
context->handleError(InvalidOperation() << "Entry point not implemented");
return;
}
UNIMPLEMENTED();
context->useProgramStages(pipeline, stages, program);
}
}
void GL_APIENTRY ActiveShaderProgram(GLuint pipeline, GLuint program)
{
EVENT("(GLuint pipeline = %u, GLuint program = %u)", pipeline, program);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation())
if (!context->skipValidation() && !ValidateActiveShaderProgram(context, pipeline, program))
{
context->handleError(InvalidOperation() << "Entry point not implemented");
return;
}
UNIMPLEMENTED();
context->activeShaderProgram(pipeline, program);
}
}
GLuint GL_APIENTRY CreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings)
{
EVENT("(GLenum type = %0x%X, GLsizei count = %d, const GLchar *const* = 0x%0.8p)", type, count,
strings);
EVENT("(GLenum type = 0x%X, GLsizei count = %d, const GLchar *const*strings = 0x%0.8p)", type,
count, strings);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation())
if (!context->skipValidation() &&
!ValidateCreateShaderProgramv(context, type, count, strings))
{
context->handleError(InvalidOperation() << "Entry point not implemented");
return 0u;
}
UNIMPLEMENTED();
return context->createShaderProgramv(type, count, strings);
}
return 0u;
}
......@@ -338,90 +341,245 @@ GLboolean GL_APIENTRY IsProgramPipeline(GLuint pipeline)
void GL_APIENTRY GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params)
{
EVENT("(GLuint pipeline = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", pipeline, pname,
EVENT("(GLuint pipeline = %u, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", pipeline, pname,
params);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation())
if (!context->skipValidation() &&
!ValidateGetProgramPipelineiv(context, pipeline, pname, params))
{
context->handleError(InvalidOperation() << "Entry point not implemented");
return;
}
UNIMPLEMENTED();
context->getProgramPipelineiv(pipeline, pname, params);
}
}
void GL_APIENTRY ProgramUniform1i(GLuint program, GLint location, GLint v0)
{
ProgramUniform1iv(program, location, 1, &v0);
EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d)", program, location, v0);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() && !ValidateProgramUniform1i(context, program, location, v0))
{
return;
}
context->programUniform1i(program, location, v0);
}
}
void GL_APIENTRY ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1)
{
GLint xy[2] = {v0, v1};
ProgramUniform2iv(program, location, 1, xy);
EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d)", program,
location, v0, v1);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateProgramUniform2i(context, program, location, v0, v1))
{
return;
}
context->programUniform2i(program, location, v0, v1);
}
}
void GL_APIENTRY ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2)
{
GLint xyz[3] = {v0, v1, v2};
ProgramUniform3iv(program, location, 1, xyz);
EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d)",
program, location, v0, v1, v2);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateProgramUniform3i(context, program, location, v0, v1, v2))
{
return;
}
context->programUniform3i(program, location, v0, v1, v2);
}
}
void GL_APIENTRY
ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
{
GLint xyzw[4] = {v0, v1, v2, v3};
ProgramUniform4iv(program, location, 1, xyzw);
EVENT(
"(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d, "
"GLint v3 = %d)",
program, location, v0, v1, v2, v3);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateProgramUniform4i(context, program, location, v0, v1, v2, v3))
{
return;
}
context->programUniform4i(program, location, v0, v1, v2, v3);
}
}
void GL_APIENTRY ProgramUniform1ui(GLuint program, GLint location, GLuint v0)
{
ProgramUniform1uiv(program, location, 1, &v0);
EVENT("(GLuint program = %u, GLint location = %d, GLuint v0 = %u)", program, location, v0);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateProgramUniform1ui(context, program, location, v0))
{
return;
}
context->programUniform1ui(program, location, v0);
}
}
void GL_APIENTRY ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1)
{
GLuint xy[2] = {v0, v1};
ProgramUniform2uiv(program, location, 1, xy);
EVENT("(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u)", program,
location, v0, v1);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateProgramUniform2ui(context, program, location, v0, v1))
{
return;
}
context->programUniform2ui(program, location, v0, v1);
}
}
void GL_APIENTRY ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2)
{
GLuint xyz[3] = {v0, v1, v2};
ProgramUniform3uiv(program, location, 1, xyz);
EVENT(
"(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = "
"%u)",
program, location, v0, v1, v2);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateProgramUniform3ui(context, program, location, v0, v1, v2))
{
return;
}
context->programUniform3ui(program, location, v0, v1, v2);
}
}
void GL_APIENTRY
ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
{
GLuint xyzw[4] = {v0, v1, v2, v3};
ProgramUniform4uiv(program, location, 1, xyzw);
EVENT(
"(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = "
"%u, GLuint v3 = %u)",
program, location, v0, v1, v2, v3);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateProgramUniform4ui(context, program, location, v0, v1, v2, v3))
{
return;
}
context->programUniform4ui(program, location, v0, v1, v2, v3);
}
}
void GL_APIENTRY ProgramUniform1f(GLuint program, GLint location, GLfloat v0)
{
ProgramUniform1fv(program, location, 1, &v0);
EVENT("(GLuint program = %u, GLint location = %d, GLfloat v0 = %f)", program, location, v0);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() && !ValidateProgramUniform1f(context, program, location, v0))
{
return;
}
context->programUniform1f(program, location, v0);
}
}
void GL_APIENTRY ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1)
{
GLfloat xy[2] = {v0, v1};
ProgramUniform2fv(program, location, 1, xy);
EVENT("(GLuint program = %u, GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f)", program,
location, v0, v1);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateProgramUniform2f(context, program, location, v0, v1))
{
return;
}
context->programUniform2f(program, location, v0, v1);
}
}
void GL_APIENTRY
ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
{
GLfloat xyz[3] = {v0, v1, v2};
ProgramUniform3fv(program, location, 1, xyz);
EVENT(
"(GLuint program = %u, GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f, GLfloat v2 = "
"%f)",
program, location, v0, v1, v2);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateProgramUniform3f(context, program, location, v0, v1, v2))
{
return;
}
context->programUniform3f(program, location, v0, v1, v2);
}
}
void GL_APIENTRY
ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
{
GLfloat xyzw[4] = {v0, v1, v2, v3};
ProgramUniform4fv(program, location, 1, xyzw);
EVENT(
"(GLuint program = %u, GLint location = %d, GLfloat v0 = %f, GLfloat v1 = %f, GLfloat v2 = "
"%f, GLfloat v3 = %f)",
program, location, v0, v1, v2, v3);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() &&
!ValidateProgramUniform4f(context, program, location, v0, v1, v2, v3))
{
return;
}
context->programUniform4f(program, location, v0, v1, v2, v3);
}
}
void GL_APIENTRY ProgramUniform1iv(GLuint program,
......@@ -457,14 +615,12 @@ void GL_APIENTRY ProgramUniform2iv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniform(context, GL_INT_VEC2, program, location, count))
if (!ValidateProgramUniform2iv(context, program, location, count, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniform2iv(location, count, value);
context->programUniform2iv(program, location, count, value);
}
}
......@@ -480,14 +636,12 @@ void GL_APIENTRY ProgramUniform3iv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniform(context, GL_INT_VEC3, program, location, count))
if (!ValidateProgramUniform3iv(context, program, location, count, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniform3iv(location, count, value);
context->programUniform3iv(program, location, count, value);
}
}
......@@ -503,14 +657,12 @@ void GL_APIENTRY ProgramUniform4iv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniform(context, GL_INT_VEC4, program, location, count))
if (!ValidateProgramUniform4iv(context, program, location, count, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniform4iv(location, count, value);
context->programUniform4iv(program, location, count, value);
}
}
......@@ -526,14 +678,12 @@ void GL_APIENTRY ProgramUniform1uiv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniform(context, GL_UNSIGNED_INT, program, location, count))
if (!ValidateProgramUniform1uiv(context, program, location, count, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniform1uiv(location, count, value);
context->programUniform1uiv(program, location, count, value);
}
}
......@@ -549,14 +699,12 @@ void GL_APIENTRY ProgramUniform2uiv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniform(context, GL_UNSIGNED_INT_VEC2, program, location, count))
if (!ValidateProgramUniform2uiv(context, program, location, count, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniform2uiv(location, count, value);
context->programUniform2uiv(program, location, count, value);
}
}
......@@ -572,14 +720,12 @@ void GL_APIENTRY ProgramUniform3uiv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniform(context, GL_UNSIGNED_INT_VEC3, program, location, count))
if (!ValidateProgramUniform3uiv(context, program, location, count, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniform3uiv(location, count, value);
context->programUniform3uiv(program, location, count, value);
}
}
......@@ -595,14 +741,12 @@ void GL_APIENTRY ProgramUniform4uiv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniform(context, GL_UNSIGNED_INT_VEC4, program, location, count))
if (!ValidateProgramUniform4uiv(context, program, location, count, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniform4uiv(location, count, value);
context->programUniform4uiv(program, location, count, value);
}
}
......@@ -618,14 +762,12 @@ void GL_APIENTRY ProgramUniform1fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniform(context, GL_FLOAT, program, location, count))
if (!ValidateProgramUniform1fv(context, program, location, count, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniform1fv(location, count, value);
context->programUniform1fv(program, location, count, value);
}
}
......@@ -641,14 +783,12 @@ void GL_APIENTRY ProgramUniform2fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniform(context, GL_FLOAT_VEC2, program, location, count))
if (!ValidateProgramUniform2fv(context, program, location, count, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniform2fv(location, count, value);
context->programUniform2fv(program, location, count, value);
}
}
......@@ -664,14 +804,12 @@ void GL_APIENTRY ProgramUniform3fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniform(context, GL_FLOAT_VEC3, program, location, count))
if (!ValidateProgramUniform3fv(context, program, location, count, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniform3fv(location, count, value);
context->programUniform3fv(program, location, count, value);
}
}
......@@ -687,14 +825,12 @@ void GL_APIENTRY ProgramUniform4fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniform(context, GL_FLOAT_VEC4, program, location, count))
if (!ValidateProgramUniform4fv(context, program, location, count, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniform4fv(location, count, value);
context->programUniform4fv(program, location, count, value);
}
}
......@@ -711,15 +847,12 @@ void GL_APIENTRY ProgramUniformMatrix2fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniformMatrix(context, GL_FLOAT_MAT2, program, location, count,
transpose))
if (!ValidateProgramUniformMatrix2fv(context, program, location, count, transpose, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix2fv(location, count, transpose, value);
context->programUniformMatrix2fv(program, location, count, transpose, value);
}
}
......@@ -736,15 +869,12 @@ void GL_APIENTRY ProgramUniformMatrix3fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniformMatrix(context, GL_FLOAT_MAT3, program, location, count,
transpose))
if (!ValidateProgramUniformMatrix3fv(context, program, location, count, transpose, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix3fv(location, count, transpose, value);
context->programUniformMatrix3fv(program, location, count, transpose, value);
}
}
......@@ -761,15 +891,12 @@ void GL_APIENTRY ProgramUniformMatrix4fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniformMatrix(context, GL_FLOAT_MAT4, program, location, count,
transpose))
if (!ValidateProgramUniformMatrix4fv(context, program, location, count, transpose, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix4fv(location, count, transpose, value);
context->programUniformMatrix4fv(program, location, count, transpose, value);
}
}
......@@ -786,15 +913,12 @@ void GL_APIENTRY ProgramUniformMatrix2x3fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniformMatrix(context, GL_FLOAT_MAT2x3, program, location, count,
transpose))
if (!ValidateProgramUniformMatrix2x3fv(context, program, location, count, transpose, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix2x3fv(location, count, transpose, value);
context->programUniformMatrix2x3fv(program, location, count, transpose, value);
}
}
......@@ -811,15 +935,12 @@ void GL_APIENTRY ProgramUniformMatrix3x2fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniformMatrix(context, GL_FLOAT_MAT3x2, program, location, count,
transpose))
if (!ValidateProgramUniformMatrix3x2fv(context, program, location, count, transpose, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix3x2fv(location, count, transpose, value);
context->programUniformMatrix3x2fv(program, location, count, transpose, value);
}
}
......@@ -836,15 +957,12 @@ void GL_APIENTRY ProgramUniformMatrix2x4fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniformMatrix(context, GL_FLOAT_MAT2x4, program, location, count,
transpose))
if (!ValidateProgramUniformMatrix2x4fv(context, program, location, count, transpose, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix2x4fv(location, count, transpose, value);
context->programUniformMatrix2x4fv(program, location, count, transpose, value);
}
}
......@@ -861,15 +979,12 @@ void GL_APIENTRY ProgramUniformMatrix4x2fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniformMatrix(context, GL_FLOAT_MAT4x2, program, location, count,
transpose))
if (!ValidateProgramUniformMatrix4x2fv(context, program, location, count, transpose, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix4x2fv(location, count, transpose, value);
context->programUniformMatrix4x2fv(program, location, count, transpose, value);
}
}
......@@ -886,15 +1001,12 @@ void GL_APIENTRY ProgramUniformMatrix3x4fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniformMatrix(context, GL_FLOAT_MAT3x4, program, location, count,
transpose))
if (!ValidateProgramUniformMatrix3x4fv(context, program, location, count, transpose, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix3x4fv(location, count, transpose, value);
context->programUniformMatrix3x4fv(program, location, count, transpose, value);
}
}
......@@ -911,29 +1023,28 @@ void GL_APIENTRY ProgramUniformMatrix4x3fv(GLuint program,
Context *context = GetValidGlobalContext();
if (context)
{
if (!ValidateProgramUniformMatrix(context, GL_FLOAT_MAT4x3, program, location, count,
transpose))
if (!ValidateProgramUniformMatrix4x3fv(context, program, location, count, transpose, value))
{
return;
}
Program *programObject = context->getProgram(program);
ASSERT(programObject);
programObject->setUniformMatrix4x3fv(location, count, transpose, value);
context->programUniformMatrix4x3fv(program, location, count, transpose, value);
}
}
void GL_APIENTRY ValidateProgramPipeline(GLuint pipeline)
{
EVENT("(GLuint pipeline = %u)", pipeline);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation())
if (!context->skipValidation() && !ValidateValidateProgramPipeline(context, pipeline))
{
context->handleError(InvalidOperation() << "Entry point not implemented");
return;
}
UNIMPLEMENTED();
context->validateProgramPipeline(pipeline);
}
}
......@@ -943,17 +1054,20 @@ void GL_APIENTRY GetProgramPipelineInfoLog(GLuint pipeline,
GLchar *infoLog)
{
EVENT(
"(GLuint pipeline = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* infoLog = "
"(GLuint pipeline = %u, GLsizei bufSize = %d, GLsizei *length = 0x%0.8p, GLchar *infoLog = "
"0x%0.8p)",
pipeline, bufSize, length, infoLog);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation())
if (!context->skipValidation() &&
!ValidateGetProgramPipelineInfoLog(context, pipeline, bufSize, length, infoLog))
{
context->handleError(InvalidOperation() << "Entry point not implemented");
return;
}
UNIMPLEMENTED();
context->getProgramPipelineInfoLog(pipeline, bufSize, length, infoLog);
}
}
......@@ -1001,28 +1115,32 @@ void GL_APIENTRY GetBooleani_v(GLenum target, GLuint index, GLboolean *data)
void GL_APIENTRY MemoryBarrier(GLbitfield barriers)
{
EVENT("(GLbitfield barriers = 0x%X)", barriers);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation())
if (!context->skipValidation() && !ValidateMemoryBarrier(context, barriers))
{
context->handleError(InvalidOperation() << "Entry point not implemented");
return;
}
UNIMPLEMENTED();
context->memoryBarrier(barriers);
}
}
void GL_APIENTRY MemoryBarrierByRegion(GLbitfield barriers)
{
EVENT("(GLbitfield barriers = 0x%X)", barriers);
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation())
if (!context->skipValidation() && !ValidateMemoryBarrierByRegion(context, barriers))
{
context->handleError(InvalidOperation() << "Entry point not implemented");
return;
}
UNIMPLEMENTED();
context->memoryBarrierByRegion(barriers);
}
}
......@@ -1041,7 +1159,7 @@ void GL_APIENTRY TexStorage2DMultisample(GLenum target,
if (context)
{
if (!context->skipValidation() &&
!ValidateTexStorage2DMultiSample(context, target, samples, internalformat, width,
!ValidateTexStorage2DMultisample(context, target, samples, internalformat, width,
height, fixedsamplelocations))
{
return;
......@@ -1073,7 +1191,7 @@ void GL_APIENTRY SampleMaski(GLuint maskNumber, GLbitfield mask)
Context *context = GetValidGlobalContext();
if (context)
{
if (!context->skipValidation() && !ValidateSampleMaski(context, maskNumber))
if (!context->skipValidation() && !ValidateSampleMaski(context, maskNumber, mask))
{
return;
}
......@@ -1095,9 +1213,7 @@ void GL_APIENTRY GetTexLevelParameteriv(GLenum target, GLint level, GLenum pname
return;
}
Texture *texture = context->getTargetTexture(
IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
QueryTexLevelParameteriv(texture, target, level, pname, params);
context->getTexLevelParameteriv(target, level, pname, params);
}
}
......@@ -1116,9 +1232,7 @@ void GL_APIENTRY GetTexLevelParameterfv(GLenum target, GLint level, GLenum pname
return;
}
Texture *texture = context->getTargetTexture(
IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
QueryTexLevelParameterfv(texture, target, level, pname, params);
context->getTexLevelParameterfv(target, level, pname, params);
}
}
......@@ -1157,7 +1271,8 @@ void GL_APIENTRY VertexAttribFormat(GLuint attribindex,
if (context)
{
if (!context->skipValidation() &&
!ValidateVertexAttribFormat(context, attribindex, size, type, relativeoffset, false))
!ValidateVertexAttribFormat(context, attribindex, size, type, normalized,
relativeoffset))
{
return;
}
......@@ -1179,7 +1294,7 @@ void GL_APIENTRY VertexAttribIFormat(GLuint attribindex,
if (context)
{
if (!context->skipValidation() &&
!ValidateVertexAttribFormat(context, attribindex, size, type, relativeoffset, true))
!ValidateVertexAttribIFormat(context, attribindex, size, type, relativeoffset))
{
return;
}
......@@ -1216,7 +1331,7 @@ void GL_APIENTRY VertexBindingDivisor(GLuint bindingindex, GLuint divisor)
return;
}
context->setVertexBindingDivisor(bindingindex, divisor);
context->vertexBindingDivisor(bindingindex, divisor);
}
}
} // namespace gl
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