This class can contain impl-specific functionality for a Context.
This will eventually replace the Renderer class, and we can then
start passing around a gl::Context instead of gl::ContextState.

In D3D11, the ContextImpl could hold a DeferredContext, which would
enable multi-thread rendering. In GL, we can implement non-virtual
(native) Contexts. In Vulkan it might store the logical device.

BUG=angleproject:1363

Change-Id: I39617e6d1a605d1a9574832e4d322400b09867ec
Reviewed-on: https://chromium-review.googlesource.com/340745
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill 2016-05-03 15:13:24 -04:00 коммит произвёл Commit Bot
Родитель bd32909124
Коммит 437fa654e3
24 изменённых файлов: 1090 добавлений и 1011 удалений

Просмотреть файл

@ -31,6 +31,7 @@
#include "libANGLE/VertexArray.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/validationES.h"
#include "libANGLE/renderer/ContextImpl.h"
#include "libANGLE/renderer/Renderer.h"
namespace
@ -133,6 +134,7 @@ Context::Context(const egl::Config *config,
nullptr,
mLimitations,
GetNoError(attribs)),
mImplementation(renderer->createContext()),
mCompiler(nullptr),
mRenderer(renderer),
mClientVersion(GetClientVersion(attribs)),
@ -261,6 +263,8 @@ Context::Context(const egl::Config *config,
mBlitDirtyBits.set(State::DIRTY_BIT_SCISSOR);
mBlitDirtyObjects.set(State::DIRTY_OBJECT_READ_FRAMEBUFFER);
mBlitDirtyObjects.set(State::DIRTY_OBJECT_DRAW_FRAMEBUFFER);
handleError(mImplementation->initialize(renderer));
}
Context::~Context()
@ -1650,7 +1654,7 @@ void Context::bindUniformLocation(GLuint program, GLint location, const GLchar *
programObject->bindUniformLocation(location, name);
}
void Context::recordError(const Error &error)
void Context::handleError(const Error &error)
{
if (error.isError())
{
@ -2165,56 +2169,31 @@ void Context::blitFramebuffer(GLint srcX0,
syncStateForBlit();
Error error = drawFramebuffer->blit(mState, srcArea, dstArea, mask, filter, readFramebuffer);
if (error.isError())
{
recordError(error);
return;
}
handleError(drawFramebuffer->blit(mState, srcArea, dstArea, mask, filter, readFramebuffer));
}
void Context::clear(GLbitfield mask)
{
syncStateForClear();
Error error = mState.getDrawFramebuffer()->clear(mData, mask);
if (error.isError())
{
recordError(error);
}
handleError(mState.getDrawFramebuffer()->clear(mData, mask));
}
void Context::clearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *values)
{
syncStateForClear();
Error error = mState.getDrawFramebuffer()->clearBufferfv(mData, buffer, drawbuffer, values);
if (error.isError())
{
recordError(error);
}
handleError(mState.getDrawFramebuffer()->clearBufferfv(mData, buffer, drawbuffer, values));
}
void Context::clearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *values)
{
syncStateForClear();
Error error = mState.getDrawFramebuffer()->clearBufferuiv(mData, buffer, drawbuffer, values);
if (error.isError())
{
recordError(error);
}
handleError(mState.getDrawFramebuffer()->clearBufferuiv(mData, buffer, drawbuffer, values));
}
void Context::clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values)
{
syncStateForClear();
Error error = mState.getDrawFramebuffer()->clearBufferiv(mData, buffer, drawbuffer, values);
if (error.isError())
{
recordError(error);
}
handleError(mState.getDrawFramebuffer()->clearBufferiv(mData, buffer, drawbuffer, values));
}
void Context::clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
@ -2230,12 +2209,7 @@ void Context::clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLin
}
syncStateForClear();
Error error = framebufferObject->clearBufferfi(mData, buffer, drawbuffer, depth, stencil);
if (error.isError())
{
recordError(error);
}
handleError(framebufferObject->clearBufferfi(mData, buffer, drawbuffer, depth, stencil));
}
void Context::readPixels(GLint x,
@ -2252,11 +2226,7 @@ void Context::readPixels(GLint x,
ASSERT(framebufferObject);
Rectangle area(x, y, width, height);
Error error = framebufferObject->readPixels(mState, area, format, type, pixels);
if (error.isError())
{
recordError(error);
}
handleError(framebufferObject->readPixels(mState, area, format, type, pixels));
}
void Context::copyTexImage2D(GLenum target,
@ -2276,11 +2246,7 @@ void Context::copyTexImage2D(GLenum target,
const Framebuffer *framebuffer = mState.getReadFramebuffer();
Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
Error error = texture->copyImage(target, level, sourceArea, internalformat, framebuffer);
if (error.isError())
{
recordError(error);
}
handleError(texture->copyImage(target, level, sourceArea, internalformat, framebuffer));
}
void Context::copyTexSubImage2D(GLenum target,
@ -2301,11 +2267,7 @@ void Context::copyTexSubImage2D(GLenum target,
const Framebuffer *framebuffer = mState.getReadFramebuffer();
Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
Error error = texture->copySubImage(target, level, destOffset, sourceArea, framebuffer);
if (error.isError())
{
recordError(error);
}
handleError(texture->copySubImage(target, level, destOffset, sourceArea, framebuffer));
}
void Context::copyTexSubImage3D(GLenum target,
@ -2326,11 +2288,7 @@ void Context::copyTexSubImage3D(GLenum target,
const Framebuffer *framebuffer = mState.getReadFramebuffer();
Texture *texture = getTargetTexture(target);
Error error = texture->copySubImage(target, level, destOffset, sourceArea, framebuffer);
if (error.isError())
{
recordError(error);
}
handleError(texture->copySubImage(target, level, destOffset, sourceArea, framebuffer));
}
void Context::framebufferTexture2D(GLenum target,
@ -2450,11 +2408,7 @@ void Context::discardFramebuffer(GLenum target, GLsizei numAttachments, const GL
// The specification isn't clear what should be done when the framebuffer isn't complete.
// We leave it up to the framebuffer implementation to decide what to do.
Error error = framebuffer->discard(numAttachments, attachments);
if (error.isError())
{
recordError(error);
}
handleError(framebuffer->discard(numAttachments, attachments));
}
void Context::invalidateFramebuffer(GLenum target,
@ -2467,15 +2421,12 @@ void Context::invalidateFramebuffer(GLenum target,
Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
ASSERT(framebuffer);
if (framebuffer->checkStatus(mData) == GL_FRAMEBUFFER_COMPLETE)
if (framebuffer->checkStatus(mData) != GL_FRAMEBUFFER_COMPLETE)
{
Error error = framebuffer->invalidate(numAttachments, attachments);
if (error.isError())
{
recordError(error);
return;
}
}
handleError(framebuffer->invalidate(numAttachments, attachments));
}
void Context::invalidateSubFramebuffer(GLenum target,
@ -2492,16 +2443,13 @@ void Context::invalidateSubFramebuffer(GLenum target,
Framebuffer *framebuffer = mState.getTargetFramebuffer(target);
ASSERT(framebuffer);
if (framebuffer->checkStatus(mData) == GL_FRAMEBUFFER_COMPLETE)
if (framebuffer->checkStatus(mData) != GL_FRAMEBUFFER_COMPLETE)
{
Rectangle area(x, y, width, height);
Error error = framebuffer->invalidateSub(numAttachments, attachments, area);
if (error.isError())
{
recordError(error);
return;
}
}
Rectangle area(x, y, width, height);
handleError(framebuffer->invalidateSub(numAttachments, attachments, area));
}
void Context::texImage2D(GLenum target,
@ -2519,12 +2467,8 @@ void Context::texImage2D(GLenum target,
Extents size(width, height, 1);
Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
Error error = texture->setImage(mState.getUnpackState(), target, level, internalformat, size,
format, type, reinterpret_cast<const uint8_t *>(pixels));
if (error.isError())
{
recordError(error);
}
handleError(texture->setImage(mState.getUnpackState(), target, level, internalformat, size,
format, type, reinterpret_cast<const uint8_t *>(pixels)));
}
void Context::texImage3D(GLenum target,
@ -2542,12 +2486,8 @@ void Context::texImage3D(GLenum target,
Extents size(width, height, depth);
Texture *texture = getTargetTexture(target);
Error error = texture->setImage(mState.getUnpackState(), target, level, internalformat, size,
format, type, reinterpret_cast<const uint8_t *>(pixels));
if (error.isError())
{
recordError(error);
}
handleError(texture->setImage(mState.getUnpackState(), target, level, internalformat, size,
format, type, reinterpret_cast<const uint8_t *>(pixels)));
}
void Context::texSubImage2D(GLenum target,
@ -2571,12 +2511,8 @@ void Context::texSubImage2D(GLenum target,
Box area(xoffset, yoffset, 0, width, height, 1);
Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
Error error = texture->setSubImage(mState.getUnpackState(), target, level, area, format, type,
reinterpret_cast<const uint8_t *>(pixels));
if (error.isError())
{
recordError(error);
}
handleError(texture->setSubImage(mState.getUnpackState(), target, level, area, format, type,
reinterpret_cast<const uint8_t *>(pixels)));
}
void Context::texSubImage3D(GLenum target,
@ -2601,12 +2537,8 @@ void Context::texSubImage3D(GLenum target,
Box area(xoffset, yoffset, zoffset, width, height, depth);
Texture *texture = getTargetTexture(target);
Error error = texture->setSubImage(mState.getUnpackState(), target, level, area, format, type,
reinterpret_cast<const uint8_t *>(pixels));
if (error.isError())
{
recordError(error);
}
handleError(texture->setSubImage(mState.getUnpackState(), target, level, area, format, type,
reinterpret_cast<const uint8_t *>(pixels)));
}
void Context::compressedTexImage2D(GLenum target,
@ -2623,13 +2555,9 @@ void Context::compressedTexImage2D(GLenum target,
Extents size(width, height, 1);
Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
Error error =
texture->setCompressedImage(mState.getUnpackState(), target, level, internalformat, size,
imageSize, reinterpret_cast<const uint8_t *>(data));
if (error.isError())
{
recordError(error);
}
handleError(texture->setCompressedImage(mState.getUnpackState(), target, level, internalformat,
size, imageSize,
reinterpret_cast<const uint8_t *>(data)));
}
void Context::compressedTexImage3D(GLenum target,
@ -2646,13 +2574,9 @@ void Context::compressedTexImage3D(GLenum target,
Extents size(width, height, depth);
Texture *texture = getTargetTexture(target);
Error error =
texture->setCompressedImage(mState.getUnpackState(), target, level, internalformat, size,
imageSize, reinterpret_cast<const uint8_t *>(data));
if (error.isError())
{
recordError(error);
}
handleError(texture->setCompressedImage(mState.getUnpackState(), target, level, internalformat,
size, imageSize,
reinterpret_cast<const uint8_t *>(data)));
}
void Context::compressedTexSubImage2D(GLenum target,
@ -2670,13 +2594,8 @@ void Context::compressedTexSubImage2D(GLenum target,
Box area(xoffset, yoffset, 0, width, height, 1);
Texture *texture =
getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
Error error =
texture->setCompressedSubImage(mState.getUnpackState(), target, level, area, format,
imageSize, reinterpret_cast<const uint8_t *>(data));
if (error.isError())
{
recordError(error);
}
handleError(texture->setCompressedSubImage(mState.getUnpackState(), target, level, area, format,
imageSize, reinterpret_cast<const uint8_t *>(data)));
}
void Context::compressedTexSubImage3D(GLenum target,
@ -2701,13 +2620,8 @@ void Context::compressedTexSubImage3D(GLenum target,
Box area(xoffset, yoffset, zoffset, width, height, depth);
Texture *texture = getTargetTexture(target);
Error error =
texture->setCompressedSubImage(mState.getUnpackState(), target, level, area, format,
imageSize, reinterpret_cast<const uint8_t *>(data));
if (error.isError())
{
recordError(error);
}
handleError(texture->setCompressedSubImage(mState.getUnpackState(), target, level, area, format,
imageSize, reinterpret_cast<const uint8_t *>(data)));
}
void Context::getBufferPointerv(GLenum target, GLenum /*pname*/, void **params)
@ -2733,7 +2647,7 @@ GLvoid *Context::mapBuffer(GLenum target, GLenum access)
Error error = buffer->map(access);
if (error.isError())
{
recordError(error);
handleError(error);
return nullptr;
}
@ -2749,7 +2663,7 @@ GLboolean Context::unmapBuffer(GLenum target)
Error error = buffer->unmap(&result);
if (error.isError())
{
recordError(error);
handleError(error);
return GL_FALSE;
}
@ -2767,7 +2681,7 @@ GLvoid *Context::mapBufferRange(GLenum target,
Error error = buffer->mapRange(offset, length, access);
if (error.isError())
{
recordError(error);
handleError(error);
return nullptr;
}

Просмотреть файл

@ -26,6 +26,7 @@
namespace rx
{
class ContextImpl;
class Renderer;
}
@ -388,7 +389,7 @@ class Context final : public ValidationContext
void bindUniformLocation(GLuint program, GLint location, const GLchar *name);
void recordError(const Error &error) override;
void handleError(const Error &error) override;
GLenum getError();
GLenum getResetStatus();
@ -432,6 +433,8 @@ class Context final : public ValidationContext
void initCaps(GLuint clientVersion);
std::unique_ptr<rx::ContextImpl> mImplementation;
// Caps to use for validation
Caps mCaps;
TextureCapsMap mTextureCaps;

Просмотреть файл

@ -51,7 +51,7 @@ class ValidationContext : angle::NonCopyable
bool skipValidation);
virtual ~ValidationContext() {}
virtual void recordError(const Error &error) = 0;
virtual void handleError(const Error &error) = 0;
const ContextState &getData() const { return mData; }
int getClientVersion() const { return mData.clientVersion; }

Просмотреть файл

@ -0,0 +1,31 @@
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ContextImpl:
// Implementation-specific functionality associated with a GL Context.
//
#ifndef LIBANGLE_RENDERER_CONTEXTIMPL_H_
#define LIBANGLE_RENDERER_CONTEXTIMPL_H_
#include "common/angleutils.h"
#include "libANGLE/Error.h"
namespace rx
{
class Renderer;
class ContextImpl : angle::NonCopyable
{
public:
ContextImpl() {}
virtual ~ContextImpl() {}
virtual gl::Error initialize(Renderer *renderer) = 0;
};
} // namespace rx
#endif // LIBANGLE_RENDERER_CONTEXTIMPL_H_

Просмотреть файл

@ -19,6 +19,7 @@ namespace rx
{
class BufferImpl;
class CompilerImpl;
class ContextImpl;
class FenceNVImpl;
class FenceSyncImpl;
class FramebufferImpl;
@ -37,6 +38,9 @@ class ImplFactory : angle::NonCopyable
ImplFactory() {}
virtual ~ImplFactory() {}
// Context creation
virtual ContextImpl *createContext() = 0;
// Shader creation
virtual CompilerImpl *createCompiler() = 0;
virtual ShaderImpl *createShader(const gl::ShaderState &data) = 0;

Просмотреть файл

@ -0,0 +1,29 @@
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Context11:
// D3D11-specific functionality associated with a GL Context.
//
#ifndef LIBANGLE_RENDERER_D3D_D3D11_CONTEXT11_H_
#define LIBANGLE_RENDERER_D3D_D3D11_CONTEXT11_H_
#include "libANGLE/renderer/ContextImpl.h"
namespace rx
{
class Context11 : public ContextImpl
{
public:
Context11() {}
~Context11() override {}
gl::Error initialize(Renderer *renderer) override { return gl::NoError(); }
};
} // namespace rx
#endif // LIBANGLE_RENDERER_D3D_D3D11_CONTEXT11_H_

Просмотреть файл

@ -25,6 +25,7 @@
#include "libANGLE/renderer/d3d/d3d11/Blit11.h"
#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
#include "libANGLE/renderer/d3d/d3d11/Clear11.h"
#include "libANGLE/renderer/d3d/d3d11/Context11.h"
#include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h"
#include "libANGLE/renderer/d3d/d3d11/Fence11.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
@ -1143,6 +1144,11 @@ SwapChainD3D *Renderer11::createSwapChain(NativeWindowD3D *nativeWindow,
depthBufferFormat, orientation);
}
ContextImpl *Renderer11::createContext()
{
return new Context11;
}
CompilerImpl *Renderer11::createCompiler()
{
if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3)

Просмотреть файл

@ -124,6 +124,8 @@ class Renderer11 : public RendererD3D
GLenum depthBufferFormat,
EGLint orientation) override;
ContextImpl *createContext() override;
CompilerImpl *createCompiler() override;
virtual gl::Error generateSwizzle(gl::Texture *texture);

Просмотреть файл

@ -0,0 +1,29 @@
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Context9:
// D3D9-specific functionality associated with a GL Context.
//
#ifndef LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_
#define LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_
#include "libANGLE/renderer/ContextImpl.h"
namespace rx
{
class Context9 : public ContextImpl
{
public:
Context9() {}
~Context9() override {}
gl::Error initialize(Renderer *renderer) override { return gl::NoError(); }
};
} // namespace rx
#endif // LIBANGLE_RENDERER_D3D_D3D9_CONTEXT9_H_

Просмотреть файл

@ -23,6 +23,7 @@
#include "libANGLE/Renderbuffer.h"
#include "libANGLE/renderer/d3d/d3d9/Blit9.h"
#include "libANGLE/renderer/d3d/d3d9/Buffer9.h"
#include "libANGLE/renderer/d3d/d3d9/Context9.h"
#include "libANGLE/renderer/d3d/d3d9/Fence9.h"
#include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
#include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h"
@ -680,6 +681,11 @@ SwapChainD3D *Renderer9::createSwapChain(NativeWindowD3D *nativeWindow,
depthBufferFormat, orientation);
}
ContextImpl *Renderer9::createContext()
{
return new Context9;
}
CompilerImpl *Renderer9::createCompiler()
{
return new CompilerD3D(SH_HLSL_3_0_OUTPUT);

Просмотреть файл

@ -90,6 +90,8 @@ class Renderer9 : public RendererD3D
GLenum depthBufferFormat,
EGLint orientation) override;
ContextImpl *createContext() override;
CompilerImpl *createCompiler() override;
gl::Error allocateEventQuery(IDirect3DQuery9 **outQuery);

Просмотреть файл

@ -0,0 +1,29 @@
//
// Copyright 2016 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// ContextGL:
// OpenGL-specific functionality associated with a GL Context.
//
#ifndef LIBANGLE_RENDERER_GL_CONTEXTGL_H_
#define LIBANGLE_RENDERER_GL_CONTEXTGL_H_
#include "libANGLE/renderer/ContextImpl.h"
namespace rx
{
class ContextGL : public ContextImpl
{
public:
ContextGL() {}
~ContextGL() override {}
gl::Error initialize(Renderer *renderer) override { return gl::NoError(); }
};
} // namespace rx
#endif // LIBANGLE_RENDERER_GL_CONTEXTGL_H_

Просмотреть файл

@ -17,6 +17,7 @@
#include "libANGLE/renderer/gl/BlitGL.h"
#include "libANGLE/renderer/gl/BufferGL.h"
#include "libANGLE/renderer/gl/CompilerGL.h"
#include "libANGLE/renderer/gl/ContextGL.h"
#include "libANGLE/renderer/gl/FenceNVGL.h"
#include "libANGLE/renderer/gl/FenceSyncGL.h"
#include "libANGLE/renderer/gl/FramebufferGL.h"
@ -262,6 +263,11 @@ gl::Error RendererGL::drawRangeElements(const gl::ContextState &data,
return gl::Error(GL_NO_ERROR);
}
ContextImpl *RendererGL::createContext()
{
return new ContextGL;
}
CompilerImpl *RendererGL::createCompiler()
{
return new CompilerGL(mFunctions);

Просмотреть файл

@ -60,6 +60,8 @@ class RendererGL : public Renderer
const GLvoid *indices,
const gl::IndexRange &indexRange) override;
ContextImpl *createContext() override;
// Shader creation
CompilerImpl *createCompiler() override;
ShaderImpl *createShader(const gl::ShaderState &data) override;

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -209,7 +209,7 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, GLenum inter
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat);
if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
@ -243,7 +243,7 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, GLenum inter
if (!typeSupported || !formatSupported)
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -255,7 +255,7 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, GLenum inter
if (es3FormatSet.find(searchFormat) == es3FormatSet.end())
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -282,14 +282,14 @@ bool ValidateES3TexImageParametersBase(Context *context,
// Validate image size
if (!ValidImageSizeParameters(context, target, level, width, height, depth, isSubImage))
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
// Verify zero border
if (border != 0)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
@ -298,7 +298,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
std::numeric_limits<GLsizei>::max() - yoffset < height ||
std::numeric_limits<GLsizei>::max() - zoffset < depth)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
@ -310,7 +310,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
if (static_cast<GLuint>(width) > (caps.max2DTextureSize >> level) ||
static_cast<GLuint>(height) > (caps.max2DTextureSize >> level))
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
break;
@ -323,13 +323,13 @@ bool ValidateES3TexImageParametersBase(Context *context,
case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
if (!isSubImage && width != height)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
if (static_cast<GLuint>(width) > (caps.maxCubeMapTextureSize >> level))
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
break;
@ -339,7 +339,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
static_cast<GLuint>(height) > (caps.max3DTextureSize >> level) ||
static_cast<GLuint>(depth) > (caps.max3DTextureSize >> level))
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
break;
@ -349,26 +349,26 @@ bool ValidateES3TexImageParametersBase(Context *context,
static_cast<GLuint>(height) > (caps.max2DTextureSize >> level) ||
static_cast<GLuint>(depth) > caps.maxArrayTextureLayers)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
break;
default:
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
gl::Texture *texture = context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target);
if (!texture)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
if (texture->getImmutableFormat() && !isSubImage)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -379,26 +379,26 @@ bool ValidateES3TexImageParametersBase(Context *context,
{
if (!actualFormatInfo.compressed)
{
context->recordError(Error(
context->handleError(Error(
GL_INVALID_ENUM, "internalformat is not a supported compressed internal format."));
return false;
}
if (!ValidCompressedImageSize(context, actualInternalFormat, width, height))
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
if (!actualFormatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
if (target == GL_TEXTURE_3D)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
}
@ -411,7 +411,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
if (target == GL_TEXTURE_3D && (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL))
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
}
@ -421,7 +421,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
{
if (isCompressed != actualFormatInfo.compressed)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -432,7 +432,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
if (xoffset < 0 || yoffset < 0 || zoffset < 0)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
@ -440,7 +440,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
std::numeric_limits<GLsizei>::max() - yoffset < height ||
std::numeric_limits<GLsizei>::max() - zoffset < depth)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
@ -448,7 +448,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
static_cast<size_t>(yoffset + height) > texture->getHeight(target, level) ||
static_cast<size_t>(zoffset + depth) > texture->getDepth(target, level))
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
}
@ -471,7 +471,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
!rx::IsUnsignedMultiplicationSafe(widthSize * heightSize * depthSize, pixelBytes))
{
// Overflow past the end of the buffer
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -483,7 +483,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
((offset + copyBytes) > static_cast<size_t>(pixelUnpackBuffer->getSize())))
{
// Overflow past the end of the buffer
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -495,7 +495,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
if ((offset % dataBytesPerPixel) != 0)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
}
@ -503,7 +503,7 @@ bool ValidateES3TexImageParametersBase(Context *context,
// ...the buffer object's data store is currently mapped.
if (pixelUnpackBuffer->isMapped())
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
}
@ -530,7 +530,7 @@ bool ValidateES3TexImage2DParameters(Context *context,
{
if (!ValidTexture2DDestinationTarget(context, target))
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -558,7 +558,7 @@ bool ValidateES3TexImage3DParameters(Context *context,
{
if (!ValidTexture3DDestinationTarget(context, target))
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -879,13 +879,13 @@ bool ValidateES3CopyTexImageParametersBase(ValidationContext *context,
if (framebuffer->checkStatus(context->getData()) != GL_FRAMEBUFFER_COMPLETE)
{
context->recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false;
}
if (readFramebufferID != 0 && framebuffer->getSamples(context->getData()) != 0)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -897,7 +897,7 @@ bool ValidateES3CopyTexImageParametersBase(ValidationContext *context,
if (!IsValidES3CopyTexImageCombination(textureInternalFormat, colorbufferInternalFormat,
readFramebufferID))
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
}
@ -906,7 +906,7 @@ bool ValidateES3CopyTexImageParametersBase(ValidationContext *context,
if (!gl::IsValidES3CopyTexImageCombination(internalformat, colorbufferInternalFormat,
readFramebufferID))
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
}
@ -931,7 +931,7 @@ bool ValidateES3CopyTexImage2DParameters(ValidationContext *context,
{
if (!ValidTexture2DDestinationTarget(context, target))
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -956,7 +956,7 @@ bool ValidateES3CopyTexImage3DParameters(ValidationContext *context,
{
if (!ValidTexture3DDestinationTarget(context, target))
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -975,7 +975,7 @@ bool ValidateES3TexStorageParametersBase(Context *context,
{
if (width < 1 || height < 1 || depth < 1 || levels < 1)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
@ -987,7 +987,7 @@ bool ValidateES3TexStorageParametersBase(Context *context,
if (levels > gl::log2(maxDim) + 1)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1000,7 +1000,7 @@ bool ValidateES3TexStorageParametersBase(Context *context,
if (static_cast<GLuint>(width) > caps.max2DTextureSize ||
static_cast<GLuint>(height) > caps.max2DTextureSize)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
}
@ -1010,13 +1010,13 @@ bool ValidateES3TexStorageParametersBase(Context *context,
{
if (width != height)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
if (static_cast<GLuint>(width) > caps.maxCubeMapTextureSize)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
}
@ -1028,7 +1028,7 @@ bool ValidateES3TexStorageParametersBase(Context *context,
static_cast<GLuint>(height) > caps.max3DTextureSize ||
static_cast<GLuint>(depth) > caps.max3DTextureSize)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
}
@ -1040,7 +1040,7 @@ bool ValidateES3TexStorageParametersBase(Context *context,
static_cast<GLuint>(height) > caps.max2DTextureSize ||
static_cast<GLuint>(depth) > caps.maxArrayTextureLayers)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
}
@ -1054,26 +1054,26 @@ bool ValidateES3TexStorageParametersBase(Context *context,
gl::Texture *texture = context->getTargetTexture(target);
if (!texture || texture->id() == 0)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
if (texture->getImmutableFormat())
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat);
if (!formatInfo.textureSupport(context->getClientVersion(), context->getExtensions()))
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
if (formatInfo.pixelBytes == 0)
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -1090,7 +1090,7 @@ bool ValidateES3TexStorage2DParameters(Context *context,
{
if (!ValidTexture2DTarget(context, target))
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -1108,7 +1108,7 @@ bool ValidateES3TexStorage3DParameters(Context *context,
{
if (!ValidTexture3DTarget(context, target))
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -1120,7 +1120,7 @@ bool ValidateBeginQuery(gl::Context *context, GLenum target, GLuint id)
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "GLES version < 3.0"));
context->handleError(Error(GL_INVALID_OPERATION, "GLES version < 3.0"));
return false;
}
@ -1131,7 +1131,7 @@ bool ValidateEndQuery(gl::Context *context, GLenum target)
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "GLES version < 3.0"));
context->handleError(Error(GL_INVALID_OPERATION, "GLES version < 3.0"));
return false;
}
@ -1142,7 +1142,7 @@ bool ValidateGetQueryiv(Context *context, GLenum target, GLenum pname, GLint *pa
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "GLES version < 3.0"));
context->handleError(Error(GL_INVALID_OPERATION, "GLES version < 3.0"));
return false;
}
@ -1153,7 +1153,7 @@ bool ValidateGetQueryObjectuiv(Context *context, GLuint id, GLenum pname, GLuint
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "GLES version < 3.0"));
context->handleError(Error(GL_INVALID_OPERATION, "GLES version < 3.0"));
return false;
}
@ -1165,13 +1165,13 @@ bool ValidateFramebufferTextureLayer(Context *context, GLenum target, GLenum att
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
if (layer < 0)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
@ -1192,13 +1192,13 @@ bool ValidateFramebufferTextureLayer(Context *context, GLenum target, GLenum att
{
if (level > gl::log2(caps.max2DTextureSize))
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
if (static_cast<GLuint>(layer) >= caps.maxArrayTextureLayers)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
}
@ -1208,27 +1208,27 @@ bool ValidateFramebufferTextureLayer(Context *context, GLenum target, GLenum att
{
if (level > gl::log2(caps.max3DTextureSize))
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
if (static_cast<GLuint>(layer) >= caps.max3DTextureSize)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
}
break;
default:
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(tex->getInternalFormat(tex->getTarget(), level));
if (internalFormatInfo.compressed)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
}
@ -1325,7 +1325,7 @@ bool ValidateES3RenderbufferStorageParameters(gl::Context *context, GLenum targe
const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalformat);
if ((formatInfo.componentType == GL_UNSIGNED_INT || formatInfo.componentType == GL_INT) && samples > 0)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1333,7 +1333,7 @@ bool ValidateES3RenderbufferStorageParameters(gl::Context *context, GLenum targe
const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat);
if (static_cast<GLuint>(samples) > formatCaps.getMaxSamples())
{
context->recordError(
context->handleError(
Error(GL_INVALID_OPERATION,
"Samples must not be greater than maximum supported value for the format."));
return false;
@ -1347,7 +1347,8 @@ bool ValidateInvalidateFramebuffer(Context *context, GLenum target, GLsizei numA
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "Operation only supported on ES 3.0 and above"));
context->handleError(
Error(GL_INVALID_OPERATION, "Operation only supported on ES 3.0 and above"));
return false;
}
@ -1363,7 +1364,7 @@ bool ValidateInvalidateFramebuffer(Context *context, GLenum target, GLsizei numA
defaultFramebuffer = context->getState().getReadFramebuffer()->id() == 0;
break;
default:
context->recordError(Error(GL_INVALID_ENUM, "Invalid framebuffer target"));
context->handleError(Error(GL_INVALID_ENUM, "Invalid framebuffer target"));
return false;
}
@ -1374,14 +1375,14 @@ bool ValidateClearBuffer(ValidationContext *context)
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
const gl::Framebuffer *fbo = context->getState().getDrawFramebuffer();
if (!fbo || fbo->checkStatus(context->getData()) != GL_FRAMEBUFFER_COMPLETE)
{
context->recordError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
context->handleError(Error(GL_INVALID_FRAMEBUFFER_OPERATION));
return false;
}
@ -1399,13 +1400,13 @@ bool ValidateDrawRangeElements(Context *context,
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
return false;
}
if (end < start)
{
context->recordError(Error(GL_INVALID_VALUE, "end < start"));
context->handleError(Error(GL_INVALID_VALUE, "end < start"));
return false;
}
@ -1417,7 +1418,7 @@ bool ValidateDrawRangeElements(Context *context,
if (indexRange->end > end || indexRange->start < start)
{
// GL spec says that behavior in this case is undefined - generating an error is fine.
context->recordError(
context->handleError(
Error(GL_INVALID_OPERATION, "Indices are out of the start, end range."));
return false;
}
@ -1428,7 +1429,7 @@ bool ValidateGetUniformuiv(Context *context, GLuint program, GLint location, GLu
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1439,7 +1440,7 @@ bool ValidateReadBuffer(Context *context, GLenum src)
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1447,7 +1448,7 @@ bool ValidateReadBuffer(Context *context, GLenum src)
if (readFBO == nullptr)
{
context->recordError(gl::Error(GL_INVALID_OPERATION, "No active read framebuffer."));
context->handleError(gl::Error(GL_INVALID_OPERATION, "No active read framebuffer."));
return false;
}
@ -1458,7 +1459,7 @@ bool ValidateReadBuffer(Context *context, GLenum src)
if (src != GL_BACK && (src < GL_COLOR_ATTACHMENT0 || src > GL_COLOR_ATTACHMENT31))
{
context->recordError(gl::Error(GL_INVALID_ENUM, "Unknown enum for 'src' in ReadBuffer"));
context->handleError(gl::Error(GL_INVALID_ENUM, "Unknown enum for 'src' in ReadBuffer"));
return false;
}
@ -1467,7 +1468,7 @@ bool ValidateReadBuffer(Context *context, GLenum src)
if (src != GL_BACK)
{
const char *errorMsg = "'src' must be GL_NONE or GL_BACK when reading from the default framebuffer.";
context->recordError(gl::Error(GL_INVALID_OPERATION, errorMsg));
context->handleError(gl::Error(GL_INVALID_OPERATION, errorMsg));
return false;
}
}
@ -1478,7 +1479,7 @@ bool ValidateReadBuffer(Context *context, GLenum src)
if (drawBuffer >= context->getCaps().maxDrawBuffers)
{
const char *errorMsg = "'src' is greater than MAX_DRAW_BUFFERS.";
context->recordError(gl::Error(GL_INVALID_OPERATION, errorMsg));
context->handleError(gl::Error(GL_INVALID_OPERATION, errorMsg));
return false;
}
}
@ -1499,7 +1500,7 @@ bool ValidateCompressedTexImage3D(Context *context,
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1508,14 +1509,14 @@ bool ValidateCompressedTexImage3D(Context *context,
static_cast<GLuint>(imageSize) !=
formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height))
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
// 3D texture target validation
if (target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY)
{
context->recordError(
context->handleError(
Error(GL_INVALID_ENUM, "Must specify a valid 3D texture destination target"));
return false;
}
@ -1534,7 +1535,7 @@ bool ValidateBindVertexArray(Context *context, GLuint array)
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1545,7 +1546,7 @@ bool ValidateIsVertexArray(Context *context)
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1560,7 +1561,7 @@ bool ValidateProgramBinary(Context *context,
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1576,7 +1577,7 @@ bool ValidateGetProgramBinary(Context *context,
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1587,7 +1588,7 @@ bool ValidateProgramParameteri(Context *context, GLuint program, GLenum pname, G
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
return false;
}
@ -1601,14 +1602,14 @@ bool ValidateProgramParameteri(Context *context, GLuint program, GLenum pname, G
case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
if (value != GL_FALSE && value != GL_TRUE)
{
context->recordError(Error(
context->handleError(Error(
GL_INVALID_VALUE, "Invalid value, expected GL_FALSE or GL_TRUE: %i", value));
return false;
}
break;
default:
context->recordError(Error(GL_INVALID_ENUM, "Invalid pname: 0x%X", pname));
context->handleError(Error(GL_INVALID_ENUM, "Invalid pname: 0x%X", pname));
return false;
}
@ -1629,7 +1630,7 @@ bool ValidateBlitFramebuffer(Context *context,
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1648,7 +1649,7 @@ bool ValidateClearBufferiv(ValidationContext *context,
if (drawbuffer < 0 ||
static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
break;
@ -1656,13 +1657,13 @@ bool ValidateClearBufferiv(ValidationContext *context,
case GL_STENCIL:
if (drawbuffer != 0)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
break;
default:
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -1680,13 +1681,13 @@ bool ValidateClearBufferuiv(ValidationContext *context,
if (drawbuffer < 0 ||
static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
break;
default:
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -1704,7 +1705,7 @@ bool ValidateClearBufferfv(ValidationContext *context,
if (drawbuffer < 0 ||
static_cast<GLuint>(drawbuffer) >= context->getCaps().maxDrawBuffers)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
break;
@ -1712,13 +1713,13 @@ bool ValidateClearBufferfv(ValidationContext *context,
case GL_DEPTH:
if (drawbuffer != 0)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
break;
default:
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -1736,13 +1737,13 @@ bool ValidateClearBufferfi(ValidationContext *context,
case GL_DEPTH_STENCIL:
if (drawbuffer != 0)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
break;
default:
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return false;
}
@ -1753,7 +1754,7 @@ bool ValidateDrawBuffers(ValidationContext *context, GLsizei n, const GLenum *bu
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
return false;
}
@ -1773,7 +1774,7 @@ bool ValidateCopyTexSubImage3D(Context *context,
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1795,7 +1796,7 @@ bool ValidateTexImage3D(Context *context,
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1819,7 +1820,7 @@ bool ValidateTexSubImage3D(Context *context,
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1843,7 +1844,7 @@ bool ValidateCompressedTexSubImage3D(Context *context,
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -1852,13 +1853,13 @@ bool ValidateCompressedTexSubImage3D(Context *context,
static_cast<GLuint>(imageSize) !=
formatInfo.computeBlockSize(GL_UNSIGNED_BYTE, width, height))
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
if (!data)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return false;
}
@ -1903,7 +1904,7 @@ bool ValidateDeleteTransformFeedbacks(Context *context, GLint n, const GLuint *i
if (transformFeedback != nullptr && transformFeedback->isActive())
{
// ES 3.0.4 section 2.15.1 page 86
context->recordError(
context->handleError(
Error(GL_INVALID_OPERATION, "Attempt to delete active transform feedback."));
return false;
}
@ -1925,7 +1926,7 @@ bool ValidateGenOrDeleteES3(Context *context, GLint n)
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
return false;
}
return ValidateGenOrDelete(context, n);
@ -1935,12 +1936,12 @@ bool ValidateGenOrDeleteCountES3(Context *context, GLint count)
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
return false;
}
if (count < 0)
{
context->recordError(Error(GL_INVALID_VALUE, "count < 0"));
context->handleError(Error(GL_INVALID_VALUE, "count < 0"));
return false;
}
return true;
@ -1950,7 +1951,7 @@ bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode)
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
return false;
}
switch (primitiveMode)
@ -1961,7 +1962,7 @@ bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode)
break;
default:
context->recordError(Error(GL_INVALID_ENUM, "Invalid primitive mode."));
context->handleError(Error(GL_INVALID_ENUM, "Invalid primitive mode."));
return false;
}
@ -1970,7 +1971,7 @@ bool ValidateBeginTransformFeedback(Context *context, GLenum primitiveMode)
if (transformFeedback->isActive())
{
context->recordError(Error(GL_INVALID_OPERATION, "Transform feedback is already active."));
context->handleError(Error(GL_INVALID_OPERATION, "Transform feedback is already active."));
return false;
}
return true;
@ -1980,13 +1981,13 @@ bool ValidateSamplerParameteri(Context *context, GLuint sampler, GLenum pname, G
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
return false;
}
if (!context->isSampler(sampler))
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -2013,7 +2014,7 @@ bool ValidateGetBufferPointerv(Context *context, GLenum target, GLenum pname, GL
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
return false;
}
@ -2024,7 +2025,7 @@ bool ValidateUnmapBuffer(Context *context, GLenum target)
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return false;
}
@ -2039,7 +2040,7 @@ bool ValidateMapBufferRange(Context *context,
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
return false;
}
@ -2053,7 +2054,7 @@ bool ValidateFlushMappedBufferRange(Context *context,
{
if (context->getClientVersion() < 3)
{
context->recordError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
context->handleError(Error(GL_INVALID_OPERATION, "Context does not support GLES3."));
return false;
}

Просмотреть файл

@ -38,7 +38,7 @@ class MockValidationContext : public ValidationContext
const Limitations &limitations,
bool skipValidation);
MOCK_METHOD1(recordError, void(const Error &));
MOCK_METHOD1(handleError, void(const Error &));
};
MockValidationContext::MockValidationContext(GLint clientVersion,
@ -110,7 +110,7 @@ TEST(ValidationESTest, DrawElementsWithMaxIndexGivesError)
// Set the expectation for the validation error here.
Error expectedError(GL_INVALID_OPERATION, g_ExceedsMaxElementErrorMessage);
EXPECT_CALL(testContext, recordError(expectedError)).Times(1);
EXPECT_CALL(testContext, handleError(expectedError)).Times(1);
// Call once with maximum index, and once with an excessive index.
GLuint indexData[] = {0, 1, static_cast<GLuint>(caps.maxElementIndex - 1),

Просмотреть файл

@ -137,6 +137,7 @@
'libANGLE/queryconversions.h',
'libANGLE/renderer/BufferImpl.h',
'libANGLE/renderer/CompilerImpl.h',
'libANGLE/renderer/ContextImpl.h',
'libANGLE/renderer/DeviceImpl.cpp',
'libANGLE/renderer/DeviceImpl.h',
'libANGLE/renderer/DisplayImpl.cpp',
@ -245,6 +246,7 @@
'libANGLE/renderer/d3d/d3d9/Blit9.h',
'libANGLE/renderer/d3d/d3d9/Buffer9.cpp',
'libANGLE/renderer/d3d/d3d9/Buffer9.h',
'libANGLE/renderer/d3d/d3d9/Context9.h',
'libANGLE/renderer/d3d/d3d9/DebugAnnotator9.cpp',
'libANGLE/renderer/d3d/d3d9/DebugAnnotator9.h',
'libANGLE/renderer/d3d/d3d9/Fence9.cpp',
@ -296,6 +298,7 @@
'libANGLE/renderer/d3d/d3d11/Buffer11.h',
'libANGLE/renderer/d3d/d3d11/Clear11.cpp',
'libANGLE/renderer/d3d/d3d11/Clear11.h',
'libANGLE/renderer/d3d/d3d11/Context11.h',
'libANGLE/renderer/d3d/d3d11/copyvertex.h',
'libANGLE/renderer/d3d/d3d11/copyvertex.inl',
'libANGLE/renderer/d3d/d3d11/DebugAnnotator11.cpp',
@ -427,6 +430,7 @@
'libANGLE/renderer/gl/BufferGL.h',
'libANGLE/renderer/gl/CompilerGL.cpp',
'libANGLE/renderer/gl/CompilerGL.h',
'libANGLE/renderer/gl/ContextGL.h',
'libANGLE/renderer/gl/DisplayGL.cpp',
'libANGLE/renderer/gl/DisplayGL.h',
'libANGLE/renderer/gl/FenceNVGL.cpp',

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -93,7 +93,7 @@ void GL_APIENTRY BeginQueryEXT(GLenum target, GLuint id)
Error error = context->beginQuery(target, id);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -114,7 +114,7 @@ void GL_APIENTRY EndQueryEXT(GLenum target)
Error error = context->endQuery(target);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -135,7 +135,7 @@ void GL_APIENTRY QueryCounterEXT(GLuint id, GLenum target)
Error error = context->queryCounter(id, target);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -173,7 +173,7 @@ void GL_APIENTRY GetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params)
Error error = context->getQueryObjectiv(id, pname, params);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -194,7 +194,7 @@ void GL_APIENTRY GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params)
Error error = context->getQueryObjectuiv(id, pname, params);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -215,7 +215,7 @@ void GL_APIENTRY GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params)
Error error = context->getQueryObjecti64v(id, pname, params);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -236,7 +236,7 @@ void GL_APIENTRY GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *param
Error error = context->getQueryObjectui64v(id, pname, params);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -251,7 +251,7 @@ void GL_APIENTRY DeleteFencesNV(GLsizei n, const GLuint *fences)
{
if (n < 0)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return;
}
@ -281,7 +281,7 @@ void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode,
Error error = context->drawArraysInstanced(mode, first, count, primcount);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -312,7 +312,7 @@ void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode,
context->drawElementsInstanced(mode, count, type, indices, primcount, indexRange);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -329,13 +329,13 @@ void GL_APIENTRY FinishFenceNV(GLuint fence)
if (fenceObject == NULL)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return;
}
if (fenceObject->isSet() != GL_TRUE)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return;
}
@ -352,7 +352,7 @@ void GL_APIENTRY GenFencesNV(GLsizei n, GLuint *fences)
{
if (n < 0)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return;
}
@ -374,13 +374,13 @@ void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params)
if (fenceObject == NULL)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return;
}
if (fenceObject->isSet() != GL_TRUE)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return;
}
@ -397,7 +397,7 @@ void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params)
Error error = fenceObject->test(&status);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -413,7 +413,7 @@ void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params)
default:
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return;
}
}
@ -444,7 +444,7 @@ void GL_APIENTRY GetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize,
{
if (bufsize < 0)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return;
}
@ -452,7 +452,7 @@ void GL_APIENTRY GetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize,
if (!shaderObject)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return;
}
@ -561,7 +561,7 @@ void GL_APIENTRY RenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samp
Error error = renderbuffer->setStorageMultisample(samples, internalformat, width, height);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -576,7 +576,7 @@ void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition)
{
if (condition != GL_ALL_COMPLETED_NV)
{
context->recordError(Error(GL_INVALID_ENUM));
context->handleError(Error(GL_INVALID_ENUM));
return;
}
@ -584,14 +584,14 @@ void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition)
if (fenceObject == NULL)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return;
}
Error error = fenceObject->set(condition);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -608,13 +608,13 @@ GLboolean GL_APIENTRY TestFenceNV(GLuint fence)
if (fenceObject == NULL)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return GL_TRUE;
}
if (fenceObject->isSet() != GL_TRUE)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return GL_TRUE;
}
@ -622,7 +622,7 @@ GLboolean GL_APIENTRY TestFenceNV(GLuint fence)
Error error = fenceObject->test(&result);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return GL_TRUE;
}
@ -642,7 +642,7 @@ void GL_APIENTRY TexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalf
{
if (!context->getExtensions().textureStorage)
{
context->recordError(Error(GL_INVALID_OPERATION));
context->handleError(Error(GL_INVALID_OPERATION));
return;
}
@ -664,7 +664,7 @@ void GL_APIENTRY TexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalf
Error error = texture->setStorage(target, levels, internalformat, size);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -679,7 +679,7 @@ void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
{
if (index >= MAX_VERTEX_ATTRIBS)
{
context->recordError(Error(GL_INVALID_VALUE));
context->handleError(Error(GL_INVALID_VALUE));
return;
}
@ -689,7 +689,7 @@ void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
{
const char *errorMessage = "The current context doesn't support setting a non-zero divisor on the attribute with index zero. "
"Please reorder the attributes in your vertex shader so that attribute zero can have a zero divisor.";
context->recordError(Error(GL_INVALID_OPERATION, errorMessage));
context->handleError(Error(GL_INVALID_OPERATION, errorMessage));
// We also output an error message to the debugger window if tracing is active, so that developers can see the error message.
ERR("%s", errorMessage);
@ -772,7 +772,7 @@ void GL_APIENTRY GetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *l
Error error = programObject->saveBinary(binaryFormat, binary, bufSize, length);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -797,7 +797,7 @@ void GL_APIENTRY ProgramBinaryOES(GLuint program, GLenum binaryFormat, const voi
Error error = programObject->loadBinary(binaryFormat, binary, length);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -921,7 +921,7 @@ void GL_APIENTRY InsertEventMarkerEXT(GLsizei length, const char *marker)
{
// The debug marker calls should not set error state
// However, it seems reasonable to set an error state if the extension is not enabled
context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
return;
}
@ -946,7 +946,7 @@ void GL_APIENTRY PushGroupMarkerEXT(GLsizei length, const char *marker)
{
// The debug marker calls should not set error state
// However, it seems reasonable to set an error state if the extension is not enabled
context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
return;
}
@ -980,7 +980,7 @@ void GL_APIENTRY PopGroupMarkerEXT()
{
// The debug marker calls should not set error state
// However, it seems reasonable to set an error state if the extension is not enabled
context->recordError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled"));
return;
}
@ -1006,7 +1006,7 @@ ANGLE_EXPORT void GL_APIENTRY EGLImageTargetTexture2DOES(GLenum target, GLeglIma
Error error = texture->setEGLImageTarget(target, imageObject);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}
@ -1031,7 +1031,7 @@ ANGLE_EXPORT void GL_APIENTRY EGLImageTargetRenderbufferStorageOES(GLenum target
Error error = renderbuffer->setStorageEGLImageTarget(imageObject);
if (error.isError())
{
context->recordError(error);
context->handleError(error);
return;
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -133,7 +133,7 @@ Context *GetValidGlobalContext()
{
if (context->isContextLost())
{
context->recordError(gl::Error(GL_OUT_OF_MEMORY, "Context has been lost."));
context->handleError(gl::Error(GL_OUT_OF_MEMORY, "Context has been lost."));
return nullptr;
}
else

Просмотреть файл

@ -62,6 +62,7 @@ class NullFactory : public ImplFactory
class MockFactory : public ImplFactory
{
public:
MOCK_METHOD0(createContext, ContextImpl *());
MOCK_METHOD0(createCompiler, CompilerImpl *());
MOCK_METHOD1(createShader, ShaderImpl *(const gl::ShaderState &));
MOCK_METHOD1(createProgram, ProgramImpl *(const gl::ProgramState &));