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

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

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

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

@ -51,7 +51,7 @@ class ValidationContext : angle::NonCopyable
bool skipValidation); bool skipValidation);
virtual ~ValidationContext() {} virtual ~ValidationContext() {}
virtual void recordError(const Error &error) = 0; virtual void handleError(const Error &error) = 0;
const ContextState &getData() const { return mData; } const ContextState &getData() const { return mData; }
int getClientVersion() const { return mData.clientVersion; } 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 BufferImpl;
class CompilerImpl; class CompilerImpl;
class ContextImpl;
class FenceNVImpl; class FenceNVImpl;
class FenceSyncImpl; class FenceSyncImpl;
class FramebufferImpl; class FramebufferImpl;
@ -37,6 +38,9 @@ class ImplFactory : angle::NonCopyable
ImplFactory() {} ImplFactory() {}
virtual ~ImplFactory() {} virtual ~ImplFactory() {}
// Context creation
virtual ContextImpl *createContext() = 0;
// Shader creation // Shader creation
virtual CompilerImpl *createCompiler() = 0; virtual CompilerImpl *createCompiler() = 0;
virtual ShaderImpl *createShader(const gl::ShaderState &data) = 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/Blit11.h"
#include "libANGLE/renderer/d3d/d3d11/Buffer11.h" #include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
#include "libANGLE/renderer/d3d/d3d11/Clear11.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/dxgi_support_table.h"
#include "libANGLE/renderer/d3d/d3d11/Fence11.h" #include "libANGLE/renderer/d3d/d3d11/Fence11.h"
#include "libANGLE/renderer/d3d/d3d11/formatutils11.h" #include "libANGLE/renderer/d3d/d3d11/formatutils11.h"
@ -1143,6 +1144,11 @@ SwapChainD3D *Renderer11::createSwapChain(NativeWindowD3D *nativeWindow,
depthBufferFormat, orientation); depthBufferFormat, orientation);
} }
ContextImpl *Renderer11::createContext()
{
return new Context11;
}
CompilerImpl *Renderer11::createCompiler() CompilerImpl *Renderer11::createCompiler()
{ {
if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3) if (mRenderer11DeviceCaps.featureLevel <= D3D_FEATURE_LEVEL_9_3)

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

@ -124,6 +124,8 @@ class Renderer11 : public RendererD3D
GLenum depthBufferFormat, GLenum depthBufferFormat,
EGLint orientation) override; EGLint orientation) override;
ContextImpl *createContext() override;
CompilerImpl *createCompiler() override; CompilerImpl *createCompiler() override;
virtual gl::Error generateSwizzle(gl::Texture *texture); 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/Renderbuffer.h"
#include "libANGLE/renderer/d3d/d3d9/Blit9.h" #include "libANGLE/renderer/d3d/d3d9/Blit9.h"
#include "libANGLE/renderer/d3d/d3d9/Buffer9.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/Fence9.h"
#include "libANGLE/renderer/d3d/d3d9/formatutils9.h" #include "libANGLE/renderer/d3d/d3d9/formatutils9.h"
#include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h" #include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h"
@ -680,6 +681,11 @@ SwapChainD3D *Renderer9::createSwapChain(NativeWindowD3D *nativeWindow,
depthBufferFormat, orientation); depthBufferFormat, orientation);
} }
ContextImpl *Renderer9::createContext()
{
return new Context9;
}
CompilerImpl *Renderer9::createCompiler() CompilerImpl *Renderer9::createCompiler()
{ {
return new CompilerD3D(SH_HLSL_3_0_OUTPUT); return new CompilerD3D(SH_HLSL_3_0_OUTPUT);

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

@ -90,6 +90,8 @@ class Renderer9 : public RendererD3D
GLenum depthBufferFormat, GLenum depthBufferFormat,
EGLint orientation) override; EGLint orientation) override;
ContextImpl *createContext() override;
CompilerImpl *createCompiler() override; CompilerImpl *createCompiler() override;
gl::Error allocateEventQuery(IDirect3DQuery9 **outQuery); 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/BlitGL.h"
#include "libANGLE/renderer/gl/BufferGL.h" #include "libANGLE/renderer/gl/BufferGL.h"
#include "libANGLE/renderer/gl/CompilerGL.h" #include "libANGLE/renderer/gl/CompilerGL.h"
#include "libANGLE/renderer/gl/ContextGL.h"
#include "libANGLE/renderer/gl/FenceNVGL.h" #include "libANGLE/renderer/gl/FenceNVGL.h"
#include "libANGLE/renderer/gl/FenceSyncGL.h" #include "libANGLE/renderer/gl/FenceSyncGL.h"
#include "libANGLE/renderer/gl/FramebufferGL.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); return gl::Error(GL_NO_ERROR);
} }
ContextImpl *RendererGL::createContext()
{
return new ContextGL;
}
CompilerImpl *RendererGL::createCompiler() CompilerImpl *RendererGL::createCompiler()
{ {
return new CompilerGL(mFunctions); return new CompilerGL(mFunctions);

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

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

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

@ -38,7 +38,7 @@ class MockValidationContext : public ValidationContext
const Limitations &limitations, const Limitations &limitations,
bool skipValidation); bool skipValidation);
MOCK_METHOD1(recordError, void(const Error &)); MOCK_METHOD1(handleError, void(const Error &));
}; };
MockValidationContext::MockValidationContext(GLint clientVersion, MockValidationContext::MockValidationContext(GLint clientVersion,
@ -110,7 +110,7 @@ TEST(ValidationESTest, DrawElementsWithMaxIndexGivesError)
// 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);
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. // Call once with maximum index, and once with an excessive index.
GLuint indexData[] = {0, 1, static_cast<GLuint>(caps.maxElementIndex - 1), GLuint indexData[] = {0, 1, static_cast<GLuint>(caps.maxElementIndex - 1),

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

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

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

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

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

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

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

@ -133,7 +133,7 @@ Context *GetValidGlobalContext()
{ {
if (context->isContextLost()) 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; return nullptr;
} }
else else

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

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