Commit 01a80eeb by Jamie Madill Committed by Commit Bot

Refactor all the Bind* GLES 2.0 entry points.

This requires storing a reference the the Context's Framebuffer map in the ValidationContext. Likely we'll need to do this as well for the other non-shared object types. BUG=angleproject:747 Change-Id: I73ee8b0be3c3b9e54b7e48e49d6f738cf1d926dd Reviewed-on: https://chromium-review.googlesource.com/407843 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 62a90cf6
...@@ -245,6 +245,7 @@ Context::Context(rx::EGLImplFactory *implFactory, ...@@ -245,6 +245,7 @@ Context::Context(rx::EGLImplFactory *implFactory,
mExtensions, mExtensions,
nullptr, nullptr,
mLimitations, mLimitations,
mFramebufferMap,
GetNoError(attribs)), GetNoError(attribs)),
mImplementation(implFactory->createContext(mState)), mImplementation(implFactory->createContext(mState)),
mCompiler(nullptr), mCompiler(nullptr),
...@@ -319,7 +320,7 @@ Context::Context(rx::EGLImplFactory *implFactory, ...@@ -319,7 +320,7 @@ Context::Context(rx::EGLImplFactory *implFactory,
bindArrayBuffer(0); bindArrayBuffer(0);
bindElementArrayBuffer(0); bindElementArrayBuffer(0);
bindRenderbuffer(0); bindRenderbuffer(GL_RENDERBUFFER, 0);
bindGenericUniformBuffer(0); bindGenericUniformBuffer(0);
for (unsigned int i = 0; i < mCaps.maxCombinedUniformBlocks; i++) for (unsigned int i = 0; i < mCaps.maxCombinedUniformBlocks; i++)
...@@ -985,13 +986,6 @@ void Context::bindDrawFramebuffer(GLuint framebufferHandle) ...@@ -985,13 +986,6 @@ void Context::bindDrawFramebuffer(GLuint framebufferHandle)
mGLState.setDrawFramebufferBinding(framebuffer); mGLState.setDrawFramebufferBinding(framebuffer);
} }
void Context::bindRenderbuffer(GLuint renderbufferHandle)
{
Renderbuffer *renderbuffer =
mResourceManager->checkRenderbufferAllocation(mImplementation.get(), renderbufferHandle);
mGLState.setRenderbufferBinding(renderbuffer);
}
void Context::bindVertexArray(GLuint vertexArrayHandle) void Context::bindVertexArray(GLuint vertexArrayHandle)
{ {
VertexArray *vertexArray = checkVertexArrayAllocation(vertexArrayHandle); VertexArray *vertexArray = checkVertexArrayAllocation(vertexArrayHandle);
...@@ -2096,27 +2090,6 @@ Framebuffer *Context::checkFramebufferAllocation(GLuint framebuffer) ...@@ -2096,27 +2090,6 @@ Framebuffer *Context::checkFramebufferAllocation(GLuint framebuffer)
return framebufferIt->second; return framebufferIt->second;
} }
bool Context::isTextureGenerated(GLuint texture) const
{
return mResourceManager->isTextureGenerated(texture);
}
bool Context::isBufferGenerated(GLuint buffer) const
{
return mResourceManager->isBufferGenerated(buffer);
}
bool Context::isRenderbufferGenerated(GLuint renderbuffer) const
{
return mResourceManager->isRenderbufferGenerated(renderbuffer);
}
bool Context::isFramebufferGenerated(GLuint framebuffer) const
{
ASSERT(mFramebufferMap.find(0) != mFramebufferMap.end());
return mFramebufferMap.find(framebuffer) != mFramebufferMap.end();
}
bool Context::isVertexArrayGenerated(GLuint vertexArray) bool Context::isVertexArrayGenerated(GLuint vertexArray)
{ {
ASSERT(mVertexArrayMap.find(0) != mVertexArrayMap.end()); ASSERT(mVertexArrayMap.find(0) != mVertexArrayMap.end());
...@@ -3543,4 +3516,68 @@ void Context::copyBufferSubData(GLenum readTarget, ...@@ -3543,4 +3516,68 @@ void Context::copyBufferSubData(GLenum readTarget,
handleError(writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size)); handleError(writeBuffer->copyBufferSubData(readBuffer, readOffset, writeOffset, size));
} }
void Context::bindAttribLocation(GLuint program, GLuint index, const GLchar *name)
{
Program *programObject = getProgram(program);
// TODO(jmadill): Re-use this from the validation if possible.
ASSERT(programObject);
programObject->bindAttributeLocation(index, name);
}
void Context::bindBuffer(GLenum target, GLuint buffer)
{
switch (target)
{
case GL_ARRAY_BUFFER:
bindArrayBuffer(buffer);
break;
case GL_ELEMENT_ARRAY_BUFFER:
bindElementArrayBuffer(buffer);
break;
case GL_COPY_READ_BUFFER:
bindCopyReadBuffer(buffer);
break;
case GL_COPY_WRITE_BUFFER:
bindCopyWriteBuffer(buffer);
break;
case GL_PIXEL_PACK_BUFFER:
bindPixelPackBuffer(buffer);
break;
case GL_PIXEL_UNPACK_BUFFER:
bindPixelUnpackBuffer(buffer);
break;
case GL_UNIFORM_BUFFER:
bindGenericUniformBuffer(buffer);
break;
case GL_TRANSFORM_FEEDBACK_BUFFER:
bindGenericTransformFeedbackBuffer(buffer);
break;
default:
UNREACHABLE();
break;
}
}
void Context::bindFramebuffer(GLenum target, GLuint framebuffer)
{
if (target == GL_READ_FRAMEBUFFER || target == GL_FRAMEBUFFER)
{
bindReadFramebuffer(framebuffer);
}
if (target == GL_DRAW_FRAMEBUFFER || target == GL_FRAMEBUFFER)
{
bindDrawFramebuffer(framebuffer);
}
}
void Context::bindRenderbuffer(GLenum target, GLuint renderbuffer)
{
ASSERT(target == GL_RENDERBUFFER);
Renderbuffer *object =
mResourceManager->checkRenderbufferAllocation(mImplementation.get(), renderbuffer);
mGLState.setRenderbufferBinding(object);
}
} // namespace gl } // namespace gl
...@@ -125,7 +125,6 @@ class Context final : public ValidationContext ...@@ -125,7 +125,6 @@ class Context final : public ValidationContext
void bindTexture(GLenum target, GLuint handle); void bindTexture(GLenum target, GLuint handle);
void bindReadFramebuffer(GLuint framebufferHandle); void bindReadFramebuffer(GLuint framebufferHandle);
void bindDrawFramebuffer(GLuint framebufferHandle); void bindDrawFramebuffer(GLuint framebufferHandle);
void bindRenderbuffer(GLuint renderbufferHandle);
void bindVertexArray(GLuint vertexArrayHandle); void bindVertexArray(GLuint vertexArrayHandle);
void bindSampler(GLuint textureUnit, GLuint samplerHandle); void bindSampler(GLuint textureUnit, GLuint samplerHandle);
void bindGenericUniformBuffer(GLuint bufferHandle); void bindGenericUniformBuffer(GLuint bufferHandle);
...@@ -193,10 +192,6 @@ class Context final : public ValidationContext ...@@ -193,10 +192,6 @@ class Context final : public ValidationContext
bool isSampler(GLuint samplerName) const; bool isSampler(GLuint samplerName) const;
bool isTextureGenerated(GLuint texture) const;
bool isBufferGenerated(GLuint buffer) const;
bool isRenderbufferGenerated(GLuint renderbuffer) const;
bool isFramebufferGenerated(GLuint framebuffer) const;
bool isVertexArrayGenerated(GLuint vertexArray); bool isVertexArrayGenerated(GLuint vertexArray);
bool isTransformFeedbackGenerated(GLuint vertexArray); bool isTransformFeedbackGenerated(GLuint vertexArray);
...@@ -579,6 +574,10 @@ class Context final : public ValidationContext ...@@ -579,6 +574,10 @@ class Context final : public ValidationContext
void bufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); void bufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
void bufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); void bufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
void attachShader(GLuint program, GLuint shader); void attachShader(GLuint program, GLuint shader);
void bindAttribLocation(GLuint program, GLuint index, const GLchar *name);
void bindBuffer(GLenum target, GLuint buffer);
void bindFramebuffer(GLenum target, GLuint framebuffer);
void bindRenderbuffer(GLenum target, GLuint renderbuffer);
void copyBufferSubData(GLenum readTarget, void copyBufferSubData(GLenum readTarget,
GLenum writeTarget, GLenum writeTarget,
......
...@@ -21,7 +21,8 @@ ContextState::ContextState(uintptr_t contextIn, ...@@ -21,7 +21,8 @@ ContextState::ContextState(uintptr_t contextIn,
const TextureCapsMap &textureCapsIn, const TextureCapsMap &textureCapsIn,
const Extensions &extensionsIn, const Extensions &extensionsIn,
const ResourceManager *resourceManagerIn, const ResourceManager *resourceManagerIn,
const Limitations &limitationsIn) const Limitations &limitationsIn,
const ResourceMap<Framebuffer> &framebufferMap)
: mClientVersion(clientVersion), : mClientVersion(clientVersion),
mContext(contextIn), mContext(contextIn),
mState(stateIn), mState(stateIn),
...@@ -29,7 +30,8 @@ ContextState::ContextState(uintptr_t contextIn, ...@@ -29,7 +30,8 @@ ContextState::ContextState(uintptr_t contextIn,
mTextureCaps(textureCapsIn), mTextureCaps(textureCapsIn),
mExtensions(extensionsIn), mExtensions(extensionsIn),
mResourceManager(resourceManagerIn), mResourceManager(resourceManagerIn),
mLimitations(limitationsIn) mLimitations(limitationsIn),
mFramebufferMap(framebufferMap)
{ {
} }
...@@ -49,6 +51,7 @@ ValidationContext::ValidationContext(const Version &clientVersion, ...@@ -49,6 +51,7 @@ ValidationContext::ValidationContext(const Version &clientVersion,
const Extensions &extensions, const Extensions &extensions,
const ResourceManager *resourceManager, const ResourceManager *resourceManager,
const Limitations &limitations, const Limitations &limitations,
const ResourceMap<Framebuffer> &framebufferMap,
bool skipValidation) bool skipValidation)
: mState(reinterpret_cast<uintptr_t>(this), : mState(reinterpret_cast<uintptr_t>(this),
clientVersion, clientVersion,
...@@ -57,7 +60,8 @@ ValidationContext::ValidationContext(const Version &clientVersion, ...@@ -57,7 +60,8 @@ ValidationContext::ValidationContext(const Version &clientVersion,
textureCaps, textureCaps,
extensions, extensions,
resourceManager, resourceManager,
limitations), limitations,
framebufferMap),
mSkipValidation(skipValidation) mSkipValidation(skipValidation)
{ {
} }
...@@ -590,4 +594,25 @@ Shader *ValidationContext::getShader(GLuint handle) const ...@@ -590,4 +594,25 @@ Shader *ValidationContext::getShader(GLuint handle) const
return mState.mResourceManager->getShader(handle); return mState.mResourceManager->getShader(handle);
} }
bool ValidationContext::isTextureGenerated(GLuint texture) const
{
return mState.mResourceManager->isTextureGenerated(texture);
}
bool ValidationContext::isBufferGenerated(GLuint buffer) const
{
return mState.mResourceManager->isBufferGenerated(buffer);
}
bool ValidationContext::isRenderbufferGenerated(GLuint renderbuffer) const
{
return mState.mResourceManager->isRenderbufferGenerated(renderbuffer);
}
bool ValidationContext::isFramebufferGenerated(GLuint framebuffer) const
{
ASSERT(mState.mFramebufferMap.find(0) != mState.mFramebufferMap.end());
return mState.mFramebufferMap.find(framebuffer) != mState.mFramebufferMap.end();
}
} // namespace gl } // namespace gl
...@@ -32,7 +32,8 @@ class ContextState final : public angle::NonCopyable ...@@ -32,7 +32,8 @@ class ContextState final : public angle::NonCopyable
const TextureCapsMap &textureCaps, const TextureCapsMap &textureCaps,
const Extensions &extensions, const Extensions &extensions,
const ResourceManager *resourceManager, const ResourceManager *resourceManager,
const Limitations &limitations); const Limitations &limitations,
const ResourceMap<Framebuffer> &framebufferMap);
~ContextState(); ~ContextState();
uintptr_t getContext() const { return mContext; } uintptr_t getContext() const { return mContext; }
...@@ -60,6 +61,7 @@ class ContextState final : public angle::NonCopyable ...@@ -60,6 +61,7 @@ class ContextState final : public angle::NonCopyable
const Extensions &mExtensions; const Extensions &mExtensions;
const ResourceManager *mResourceManager; const ResourceManager *mResourceManager;
const Limitations &mLimitations; const Limitations &mLimitations;
const ResourceMap<Framebuffer> &mFramebufferMap;
}; };
class ValidationContext : angle::NonCopyable class ValidationContext : angle::NonCopyable
...@@ -72,6 +74,7 @@ class ValidationContext : angle::NonCopyable ...@@ -72,6 +74,7 @@ class ValidationContext : angle::NonCopyable
const Extensions &extensions, const Extensions &extensions,
const ResourceManager *resourceManager, const ResourceManager *resourceManager,
const Limitations &limitations, const Limitations &limitations,
const ResourceMap<Framebuffer> &framebufferMap,
bool skipValidation); bool skipValidation);
virtual ~ValidationContext() {} virtual ~ValidationContext() {}
...@@ -95,6 +98,11 @@ class ValidationContext : angle::NonCopyable ...@@ -95,6 +98,11 @@ class ValidationContext : angle::NonCopyable
Program *getProgram(GLuint handle) const; Program *getProgram(GLuint handle) const;
Shader *getShader(GLuint handle) const; Shader *getShader(GLuint handle) const;
bool isTextureGenerated(GLuint texture) const;
bool isBufferGenerated(GLuint buffer) const;
bool isRenderbufferGenerated(GLuint renderbuffer) const;
bool isFramebufferGenerated(GLuint framebuffer) const;
protected: protected:
ContextState mState; ContextState mState;
bool mSkipValidation; bool mSkipValidation;
......
...@@ -3618,4 +3618,78 @@ bool ValidateAttachShader(ValidationContext *context, GLuint program, GLuint sha ...@@ -3618,4 +3618,78 @@ bool ValidateAttachShader(ValidationContext *context, GLuint program, GLuint sha
return true; return true;
} }
bool ValidateBindAttribLocation(ValidationContext *context,
GLuint program,
GLuint index,
const GLchar *name)
{
if (index >= MAX_VERTEX_ATTRIBS)
{
context->handleError(Error(GL_INVALID_VALUE, "Index exceeds MAX_VERTEX_ATTRIBS"));
return false;
}
if (strncmp(name, "gl_", 3) == 0)
{
context->handleError(Error(GL_INVALID_OPERATION, "Cannot Bind built-in attributes"));
return false;
}
return GetValidProgram(context, program) != nullptr;
}
bool ValidateBindBuffer(ValidationContext *context, GLenum target, GLuint buffer)
{
if (!ValidBufferTarget(context, target))
{
context->handleError(Error(GL_INVALID_ENUM, "Invalid Buffer target"));
return false;
}
if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isBufferGenerated(buffer))
{
context->handleError(Error(GL_INVALID_OPERATION, "Buffer was not generated"));
return false;
}
return true;
}
bool ValidateBindFramebuffer(ValidationContext *context, GLenum target, GLuint framebuffer)
{
if (!ValidFramebufferTarget(target))
{
context->handleError(Error(GL_INVALID_ENUM, "Invalid Framebuffer target"));
return false;
}
if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isFramebufferGenerated(framebuffer))
{
context->handleError(Error(GL_INVALID_OPERATION, "Framebuffer was not generated"));
return false;
}
return true;
}
bool ValidateBindRenderbuffer(ValidationContext *context, GLenum target, GLuint renderbuffer)
{
if (target != GL_RENDERBUFFER)
{
context->handleError(Error(GL_INVALID_ENUM, "Invalid Renderbuffer target"));
return false;
}
if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isRenderbufferGenerated(renderbuffer))
{
context->handleError(Error(GL_INVALID_OPERATION, "Renderbuffer was not generated"));
return false;
}
return true;
}
} // namespace gl } // namespace gl
...@@ -354,6 +354,13 @@ bool ValidateEnableExtensionANGLE(ValidationContext *context, const GLchar *name ...@@ -354,6 +354,13 @@ bool ValidateEnableExtensionANGLE(ValidationContext *context, const GLchar *name
bool ValidateActiveTexture(ValidationContext *context, GLenum texture); bool ValidateActiveTexture(ValidationContext *context, GLenum texture);
bool ValidateAttachShader(ValidationContext *context, GLuint program, GLuint shader); bool ValidateAttachShader(ValidationContext *context, GLuint program, GLuint shader);
bool ValidateBindAttribLocation(ValidationContext *context,
GLuint program,
GLuint index,
const GLchar *name);
bool ValidateBindBuffer(ValidationContext *context, GLenum target, GLuint buffer);
bool ValidateBindFramebuffer(ValidationContext *context, GLenum target, GLuint framebuffer);
bool ValidateBindRenderbuffer(ValidationContext *context, GLenum target, GLuint renderbuffer);
} // namespace gl } // namespace gl
......
...@@ -36,6 +36,7 @@ class MockValidationContext : public ValidationContext ...@@ -36,6 +36,7 @@ class MockValidationContext : public ValidationContext
const Extensions &extensions, const Extensions &extensions,
const ResourceManager *resourceManager, const ResourceManager *resourceManager,
const Limitations &limitations, const Limitations &limitations,
const ResourceMap<Framebuffer> &framebufferMap,
bool skipValidation); bool skipValidation);
MOCK_METHOD1(handleError, void(const Error &)); MOCK_METHOD1(handleError, void(const Error &));
...@@ -48,6 +49,7 @@ MockValidationContext::MockValidationContext(const Version &version, ...@@ -48,6 +49,7 @@ MockValidationContext::MockValidationContext(const Version &version,
const Extensions &extensions, const Extensions &extensions,
const ResourceManager *resourceManager, const ResourceManager *resourceManager,
const Limitations &limitations, const Limitations &limitations,
const ResourceMap<Framebuffer> &framebufferMap,
bool skipValidation) bool skipValidation)
: ValidationContext(version, : ValidationContext(version,
state, state,
...@@ -56,6 +58,7 @@ MockValidationContext::MockValidationContext(const Version &version, ...@@ -56,6 +58,7 @@ MockValidationContext::MockValidationContext(const Version &version,
extensions, extensions,
resourceManager, resourceManager,
limitations, limitations,
framebufferMap,
skipValidation) skipValidation)
{ {
} }
...@@ -79,6 +82,7 @@ TEST(ValidationESTest, DrawElementsWithMaxIndexGivesError) ...@@ -79,6 +82,7 @@ TEST(ValidationESTest, DrawElementsWithMaxIndexGivesError)
TextureCapsMap textureCaps; TextureCapsMap textureCaps;
Extensions extensions; Extensions extensions;
Limitations limitations; Limitations limitations;
ResourceMap<Framebuffer> framebufferMap;
// Set some basic caps. // Set some basic caps.
caps.maxElementIndex = 100; caps.maxElementIndex = 100;
...@@ -106,7 +110,8 @@ TEST(ValidationESTest, DrawElementsWithMaxIndexGivesError) ...@@ -106,7 +110,8 @@ TEST(ValidationESTest, DrawElementsWithMaxIndexGivesError)
state.setProgram(program); state.setProgram(program);
NiceMock<MockValidationContext> testContext(Version(3, 0), &state, caps, textureCaps, NiceMock<MockValidationContext> testContext(Version(3, 0), &state, caps, textureCaps,
extensions, nullptr, limitations, false); extensions, nullptr, limitations, framebufferMap,
false);
// Set the expectation for the validation error here. // Set the expectation for the validation error here.
Error expectedError(GL_INVALID_OPERATION, g_ExceedsMaxElementErrorMessage); Error expectedError(GL_INVALID_OPERATION, g_ExceedsMaxElementErrorMessage);
......
...@@ -76,26 +76,13 @@ void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar* ...@@ -76,26 +76,13 @@ void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar*
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (index >= MAX_VERTEX_ATTRIBS) if (!context->skipValidation() &&
{ !ValidateBindAttribLocation(context, program, index, name))
context->handleError(Error(GL_INVALID_VALUE));
return;
}
Program *programObject = GetValidProgram(context, program);
if (!programObject)
{
return;
}
if (strncmp(name, "gl_", 3) == 0)
{ {
context->handleError(Error(GL_INVALID_OPERATION));
return; return;
} }
programObject->bindAttributeLocation(index, name); context->bindAttribLocation(program, index, name);
} }
} }
...@@ -106,50 +93,12 @@ void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer) ...@@ -106,50 +93,12 @@ void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!ValidBufferTarget(context, target)) if (!context->skipValidation() && !ValidateBindBuffer(context, target, buffer))
{
context->handleError(Error(GL_INVALID_ENUM));
return;
}
if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isBufferGenerated(buffer))
{ {
context->handleError(Error(GL_INVALID_OPERATION, "Buffer was not generated"));
return; return;
} }
switch (target) context->bindBuffer(target, buffer);
{
case GL_ARRAY_BUFFER:
context->bindArrayBuffer(buffer);
return;
case GL_ELEMENT_ARRAY_BUFFER:
context->bindElementArrayBuffer(buffer);
return;
case GL_COPY_READ_BUFFER:
context->bindCopyReadBuffer(buffer);
return;
case GL_COPY_WRITE_BUFFER:
context->bindCopyWriteBuffer(buffer);
return;
case GL_PIXEL_PACK_BUFFER:
context->bindPixelPackBuffer(buffer);
return;
case GL_PIXEL_UNPACK_BUFFER:
context->bindPixelUnpackBuffer(buffer);
return;
case GL_UNIFORM_BUFFER:
context->bindGenericUniformBuffer(buffer);
return;
case GL_TRANSFORM_FEEDBACK_BUFFER:
context->bindGenericTransformFeedbackBuffer(buffer);
return;
default:
context->handleError(Error(GL_INVALID_ENUM));
return;
}
} }
} }
...@@ -160,28 +109,12 @@ void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer) ...@@ -160,28 +109,12 @@ void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!ValidFramebufferTarget(target)) if (!context->skipValidation() && !ValidateBindFramebuffer(context, target, framebuffer))
{ {
context->handleError(Error(GL_INVALID_ENUM));
return; return;
} }
if (!context->getGLState().isBindGeneratesResourceEnabled() && context->bindFramebuffer(target, framebuffer);
!context->isFramebufferGenerated(framebuffer))
{
context->handleError(Error(GL_INVALID_OPERATION, "Framebuffer was not generated"));
return;
}
if (target == GL_READ_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
{
context->bindReadFramebuffer(framebuffer);
}
if (target == GL_DRAW_FRAMEBUFFER_ANGLE || target == GL_FRAMEBUFFER)
{
context->bindDrawFramebuffer(framebuffer);
}
} }
} }
...@@ -192,20 +125,12 @@ void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer) ...@@ -192,20 +125,12 @@ void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (target != GL_RENDERBUFFER) if (!context->skipValidation() && !ValidateBindRenderbuffer(context, target, renderbuffer))
{
context->handleError(Error(GL_INVALID_ENUM));
return;
}
if (!context->getGLState().isBindGeneratesResourceEnabled() &&
!context->isRenderbufferGenerated(renderbuffer))
{ {
context->handleError(Error(GL_INVALID_OPERATION, "Renderbuffer was not generated"));
return; return;
} }
context->bindRenderbuffer(renderbuffer); context->bindRenderbuffer(target, renderbuffer);
} }
} }
...@@ -216,7 +141,7 @@ void GL_APIENTRY BindTexture(GLenum target, GLuint texture) ...@@ -216,7 +141,7 @@ void GL_APIENTRY BindTexture(GLenum target, GLuint texture)
Context *context = GetValidGlobalContext(); Context *context = GetValidGlobalContext();
if (context) if (context)
{ {
if (!ValidateBindTexture(context, target, texture)) if (!context->skipValidation() && !ValidateBindTexture(context, target, texture))
{ {
return; 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