зеркало из https://github.com/AvaloniaUI/angle.git
Add EGLImplFactory.
Also rename ImplFactory to GLImplFactory. This will allow us to use the same factory design pattern for EGL objects, and to use State helper classes to share data with Impls. BUG=angleproject:1363 BUG=angleproject:1369 Change-Id: I07a8fe40838d5d4ca32b04910c306edeab4d25a7 Reviewed-on: https://chromium-review.googlesource.com/342051 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Geoff Lang <geofflang@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Родитель
43d0e60968
Коммит
7aea7e056d
|
@ -11,7 +11,7 @@
|
|||
#include "common/debug.h"
|
||||
#include "libANGLE/ContextState.h"
|
||||
#include "libANGLE/renderer/CompilerImpl.h"
|
||||
#include "libANGLE/renderer/ImplFactory.h"
|
||||
#include "libANGLE/renderer/GLImplFactory.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ size_t activeCompilerHandles = 0;
|
|||
|
||||
} // anonymous namespace
|
||||
|
||||
Compiler::Compiler(rx::ImplFactory *implFactory, const ContextState &data)
|
||||
Compiler::Compiler(rx::GLImplFactory *implFactory, const ContextState &data)
|
||||
: mImplementation(implFactory->createCompiler()),
|
||||
mSpec(data.clientVersion > 2 ? SH_GLES3_SPEC : SH_GLES2_SPEC),
|
||||
mOutputType(mImplementation->getTranslatorOutputType()),
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
namespace rx
|
||||
{
|
||||
class CompilerImpl;
|
||||
class ImplFactory;
|
||||
class GLImplFactory;
|
||||
}
|
||||
|
||||
namespace gl
|
||||
|
@ -26,7 +26,7 @@ struct ContextState;
|
|||
class Compiler final : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
Compiler(rx::ImplFactory *implFactory, const ContextState &data);
|
||||
Compiler(rx::GLImplFactory *implFactory, const ContextState &data);
|
||||
~Compiler();
|
||||
|
||||
Error release();
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "libANGLE/formatutils.h"
|
||||
#include "libANGLE/renderer/ContextImpl.h"
|
||||
#include "libANGLE/renderer/FramebufferImpl.h"
|
||||
#include "libANGLE/renderer/ImplFactory.h"
|
||||
#include "libANGLE/renderer/GLImplFactory.h"
|
||||
#include "libANGLE/renderer/RenderbufferImpl.h"
|
||||
#include "libANGLE/renderer/SurfaceImpl.h"
|
||||
|
||||
|
@ -170,7 +170,7 @@ bool FramebufferState::attachmentsHaveSameDimensions() const
|
|||
return !hasMismatchedSize(mStencilAttachment);
|
||||
}
|
||||
|
||||
Framebuffer::Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id)
|
||||
Framebuffer::Framebuffer(const Caps &caps, rx::GLImplFactory *factory, GLuint id)
|
||||
: mState(caps), mImpl(factory->createFramebuffer(mState)), mId(id)
|
||||
{
|
||||
ASSERT(mId != 0);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
namespace rx
|
||||
{
|
||||
class ContextImpl;
|
||||
class ImplFactory;
|
||||
class GLImplFactory;
|
||||
class FramebufferImpl;
|
||||
class RenderbufferImpl;
|
||||
class SurfaceImpl;
|
||||
|
@ -89,7 +89,7 @@ class FramebufferState final : angle::NonCopyable
|
|||
class Framebuffer final : public LabeledObject
|
||||
{
|
||||
public:
|
||||
Framebuffer(const Caps &caps, rx::ImplFactory *factory, GLuint id);
|
||||
Framebuffer(const Caps &caps, rx::GLImplFactory *factory, GLuint id);
|
||||
Framebuffer(rx::SurfaceImpl *surface);
|
||||
virtual ~Framebuffer();
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace angle
|
|||
// Verify ref counts are maintained between images and their siblings when objects are deleted
|
||||
TEST(ImageTest, RefCounting)
|
||||
{
|
||||
NiceMock<rx::MockFactory> mockFactory;
|
||||
NiceMock<rx::MockGLFactory> mockFactory;
|
||||
// Create a texture and an EGL image that uses the texture as its source
|
||||
rx::MockTextureImpl *textureImpl = new rx::MockTextureImpl();
|
||||
EXPECT_CALL(mockFactory, createTexture(_)).WillOnce(Return(textureImpl));
|
||||
|
@ -86,7 +86,7 @@ TEST(ImageTest, RefCounting)
|
|||
// Verify that respecifiying textures releases references to the Image.
|
||||
TEST(ImageTest, RespecificationReleasesReferences)
|
||||
{
|
||||
NiceMock<rx::MockFactory> mockFactory;
|
||||
NiceMock<rx::MockGLFactory> mockFactory;
|
||||
// Create a texture and an EGL image that uses the texture as its source
|
||||
rx::MockTextureImpl *textureImpl = new rx::MockTextureImpl();
|
||||
EXPECT_CALL(mockFactory, createTexture(_)).WillOnce(Return(textureImpl));
|
||||
|
|
|
@ -336,7 +336,7 @@ GLuint ProgramState::getUniformIndex(const std::string &name) const
|
|||
return GL_INVALID_INDEX;
|
||||
}
|
||||
|
||||
Program::Program(rx::ImplFactory *factory, ResourceManager *manager, GLuint handle)
|
||||
Program::Program(rx::GLImplFactory *factory, ResourceManager *manager, GLuint handle)
|
||||
: mProgram(factory->createProgram(mState)),
|
||||
mValidated(false),
|
||||
mLinked(false),
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
namespace rx
|
||||
{
|
||||
class ImplFactory;
|
||||
class GLImplFactory;
|
||||
class ProgramImpl;
|
||||
struct TranslatedAttribute;
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ class ProgramState final : angle::NonCopyable
|
|||
class Program final : angle::NonCopyable, public LabeledObject
|
||||
{
|
||||
public:
|
||||
Program(rx::ImplFactory *factory, ResourceManager *manager, GLuint handle);
|
||||
Program(rx::GLImplFactory *factory, ResourceManager *manager, GLuint handle);
|
||||
~Program();
|
||||
|
||||
GLuint id() const { return mHandle; }
|
||||
|
|
|
@ -20,9 +20,7 @@
|
|||
|
||||
namespace gl
|
||||
{
|
||||
ResourceManager::ResourceManager(rx::ImplFactory *factory)
|
||||
: mFactory(factory),
|
||||
mRefCount(1)
|
||||
ResourceManager::ResourceManager(rx::GLImplFactory *factory) : mFactory(factory), mRefCount(1)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace rx
|
||||
{
|
||||
class ImplFactory;
|
||||
class GLImplFactory;
|
||||
}
|
||||
|
||||
namespace gl
|
||||
|
@ -34,7 +34,7 @@ class Texture;
|
|||
class ResourceManager : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
explicit ResourceManager(rx::ImplFactory *factory);
|
||||
explicit ResourceManager(rx::GLImplFactory *factory);
|
||||
~ResourceManager();
|
||||
|
||||
void addRef();
|
||||
|
@ -76,7 +76,7 @@ class ResourceManager : angle::NonCopyable
|
|||
private:
|
||||
void createTextureInternal(GLuint handle);
|
||||
|
||||
rx::ImplFactory *mFactory;
|
||||
rx::GLImplFactory *mFactory;
|
||||
std::size_t mRefCount;
|
||||
|
||||
ResourceMap<Buffer> mBufferMap;
|
||||
|
|
|
@ -31,7 +31,7 @@ class ResourceManagerTest : public testing::Test
|
|||
SafeDelete(mResourceManager);
|
||||
}
|
||||
|
||||
MockFactory mMockFactory;
|
||||
MockGLFactory mMockFactory;
|
||||
ResourceManager *mResourceManager;
|
||||
};
|
||||
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
|
||||
#include "libANGLE/Sampler.h"
|
||||
#include "libANGLE/angletypes.h"
|
||||
#include "libANGLE/renderer/ImplFactory.h"
|
||||
#include "libANGLE/renderer/GLImplFactory.h"
|
||||
#include "libANGLE/renderer/SamplerImpl.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
||||
Sampler::Sampler(rx::ImplFactory *factory, GLuint id)
|
||||
Sampler::Sampler(rx::GLImplFactory *factory, GLuint id)
|
||||
: RefCountObject(id), mImpl(factory->createSampler()), mLabel(), mSamplerState()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace rx
|
||||
{
|
||||
class ImplFactory;
|
||||
class GLImplFactory;
|
||||
class SamplerImpl;
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace gl
|
|||
class Sampler final : public RefCountObject, public LabeledObject
|
||||
{
|
||||
public:
|
||||
Sampler(rx::ImplFactory *factory, GLuint id);
|
||||
Sampler(rx::GLImplFactory *factory, GLuint id);
|
||||
~Sampler() override;
|
||||
|
||||
void setLabel(const std::string &label) override;
|
||||
|
|
|
@ -81,7 +81,7 @@ ShaderState::~ShaderState()
|
|||
}
|
||||
|
||||
Shader::Shader(ResourceManager *manager,
|
||||
rx::ImplFactory *implFactory,
|
||||
rx::GLImplFactory *implFactory,
|
||||
const gl::Limitations &rendererLimitations,
|
||||
GLenum type,
|
||||
GLuint handle)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
namespace rx
|
||||
{
|
||||
class ImplFactory;
|
||||
class GLImplFactory;
|
||||
class ShaderImpl;
|
||||
class ShaderSh;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ class Shader final : angle::NonCopyable, public LabeledObject
|
|||
{
|
||||
public:
|
||||
Shader(ResourceManager *manager,
|
||||
rx::ImplFactory *implFactory,
|
||||
rx::GLImplFactory *implFactory,
|
||||
const gl::Limitations &rendererLimitations,
|
||||
GLenum type,
|
||||
GLuint handle);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include "libANGLE/Image.h"
|
||||
#include "libANGLE/Surface.h"
|
||||
#include "libANGLE/formatutils.h"
|
||||
#include "libANGLE/renderer/ImplFactory.h"
|
||||
#include "libANGLE/renderer/GLImplFactory.h"
|
||||
#include "libANGLE/renderer/TextureImpl.h"
|
||||
|
||||
namespace gl
|
||||
|
@ -49,7 +49,7 @@ static size_t GetImageDescIndex(GLenum target, size_t level)
|
|||
return IsCubeMapTextureTarget(target) ? ((level * 6) + CubeMapTextureTargetToLayerIndex(target)) : level;
|
||||
}
|
||||
|
||||
Texture::Texture(rx::ImplFactory *factory, GLuint id, GLenum target)
|
||||
Texture::Texture(rx::GLImplFactory *factory, GLuint id, GLenum target)
|
||||
: egl::ImageSibling(id),
|
||||
mTexture(factory->createTexture(target)),
|
||||
mLabel(),
|
||||
|
|
|
@ -31,7 +31,7 @@ class Stream;
|
|||
|
||||
namespace rx
|
||||
{
|
||||
class ImplFactory;
|
||||
class GLImplFactory;
|
||||
class TextureImpl;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ class Texture final : public egl::ImageSibling,
|
|||
public LabeledObject
|
||||
{
|
||||
public:
|
||||
Texture(rx::ImplFactory *factory, GLuint id, GLenum target);
|
||||
Texture(rx::GLImplFactory *factory, GLuint id, GLenum target);
|
||||
~Texture() override;
|
||||
|
||||
void setLabel(const std::string &label) override;
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
#include "libANGLE/Caps.h"
|
||||
#include "libANGLE/ContextState.h"
|
||||
#include "libANGLE/Program.h"
|
||||
#include "libANGLE/renderer/ImplFactory.h"
|
||||
#include "libANGLE/renderer/GLImplFactory.h"
|
||||
#include "libANGLE/renderer/TransformFeedbackImpl.h"
|
||||
|
||||
namespace gl
|
||||
{
|
||||
|
||||
TransformFeedback::TransformFeedback(rx::ImplFactory *implFactory, GLuint id, const Caps &caps)
|
||||
TransformFeedback::TransformFeedback(rx::GLImplFactory *implFactory, GLuint id, const Caps &caps)
|
||||
: RefCountObject(id),
|
||||
mImplementation(implFactory->createTransformFeedback()),
|
||||
mLabel(),
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace rx
|
||||
{
|
||||
class ImplFactory;
|
||||
class GLImplFactory;
|
||||
class TransformFeedbackImpl;
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ class Program;
|
|||
class TransformFeedback final : public RefCountObject, public LabeledObject
|
||||
{
|
||||
public:
|
||||
TransformFeedback(rx::ImplFactory *implFactory, GLuint id, const Caps &caps);
|
||||
TransformFeedback(rx::GLImplFactory *implFactory, GLuint id, const Caps &caps);
|
||||
virtual ~TransformFeedback();
|
||||
|
||||
void setLabel(const std::string &label) override;
|
||||
|
|
|
@ -53,7 +53,7 @@ class TransformFeedbackTest : public testing::Test
|
|||
testing::Mock::VerifyAndClear(mImpl);
|
||||
}
|
||||
|
||||
rx::MockFactory mMockFactory;
|
||||
rx::MockGLFactory mMockFactory;
|
||||
rx::MockTransformFeedbackImpl* mImpl;
|
||||
gl::TransformFeedback* mFeedback;
|
||||
gl::Caps mCaps;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#include "libANGLE/VertexArray.h"
|
||||
#include "libANGLE/Buffer.h"
|
||||
#include "libANGLE/renderer/ImplFactory.h"
|
||||
#include "libANGLE/renderer/GLImplFactory.h"
|
||||
#include "libANGLE/renderer/VertexArrayImpl.h"
|
||||
|
||||
namespace gl
|
||||
|
@ -28,7 +28,7 @@ VertexArrayState::~VertexArrayState()
|
|||
mElementArrayBuffer.set(nullptr);
|
||||
}
|
||||
|
||||
VertexArray::VertexArray(rx::ImplFactory *factory, GLuint id, size_t maxAttribs)
|
||||
VertexArray::VertexArray(rx::GLImplFactory *factory, GLuint id, size_t maxAttribs)
|
||||
: mId(id), mState(maxAttribs), mVertexArray(factory->createVertexArray(mState))
|
||||
{
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
namespace rx
|
||||
{
|
||||
class ImplFactory;
|
||||
class GLImplFactory;
|
||||
class VertexArrayImpl;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ class VertexArrayState final : public angle::NonCopyable
|
|||
class VertexArray final : public LabeledObject
|
||||
{
|
||||
public:
|
||||
VertexArray(rx::ImplFactory *factory, GLuint id, size_t maxAttribs);
|
||||
VertexArray(rx::GLImplFactory *factory, GLuint id, size_t maxAttribs);
|
||||
~VertexArray();
|
||||
|
||||
GLuint id() const;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "libANGLE/Caps.h"
|
||||
#include "libANGLE/Config.h"
|
||||
#include "libANGLE/Error.h"
|
||||
#include "libANGLE/renderer/EGLImplFactory.h"
|
||||
#include "libANGLE/renderer/Renderer.h"
|
||||
#include "libANGLE/Stream.h"
|
||||
|
||||
|
@ -41,7 +42,7 @@ struct ConfigDesc;
|
|||
class DeviceImpl;
|
||||
class StreamProducerImpl;
|
||||
|
||||
class DisplayImpl : angle::NonCopyable
|
||||
class DisplayImpl : public EGLImplFactory
|
||||
{
|
||||
public:
|
||||
DisplayImpl();
|
||||
|
@ -50,30 +51,6 @@ class DisplayImpl : angle::NonCopyable
|
|||
virtual egl::Error initialize(egl::Display *display) = 0;
|
||||
virtual void terminate() = 0;
|
||||
|
||||
virtual SurfaceImpl *createWindowSurface(const egl::Config *configuration,
|
||||
EGLNativeWindowType window,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
virtual SurfaceImpl *createPbufferSurface(const egl::Config *configuration,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
virtual SurfaceImpl *createPbufferFromClientBuffer(const egl::Config *configuration,
|
||||
EGLClientBuffer shareHandle,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
virtual SurfaceImpl *createPixmapSurface(const egl::Config *configuration,
|
||||
NativePixmapType nativePixmap,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
|
||||
virtual ImageImpl *createImage(EGLenum target,
|
||||
egl::ImageSibling *buffer,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
|
||||
virtual gl::Context *createContext(const egl::Config *config,
|
||||
const gl::Context *shareContext,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
|
||||
virtual StreamProducerImpl *createStreamProducerD3DTextureNV12(
|
||||
egl::Stream::ConsumerType consumerType,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
|
||||
virtual egl::Error makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context) = 0;
|
||||
|
||||
virtual egl::ConfigSet generateConfigs() const = 0;
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
//
|
||||
// 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.
|
||||
//
|
||||
// EGLImplFactory.h:
|
||||
// Factory interface for EGL Impl objects.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_EGLIMPLFACTORY_H_
|
||||
#define LIBANGLE_RENDERER_EGLIMPLFACTORY_H_
|
||||
|
||||
#include "libANGLE/Stream.h"
|
||||
|
||||
namespace egl
|
||||
{
|
||||
class AttributeMap;
|
||||
struct Config;
|
||||
class ImageSibling;
|
||||
}
|
||||
|
||||
namespace gl
|
||||
{
|
||||
class Context;
|
||||
}
|
||||
|
||||
namespace rx
|
||||
{
|
||||
class ImageImpl;
|
||||
class SurfaceImpl;
|
||||
|
||||
class EGLImplFactory : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
EGLImplFactory() {}
|
||||
virtual ~EGLImplFactory() {}
|
||||
|
||||
virtual SurfaceImpl *createWindowSurface(const egl::Config *configuration,
|
||||
EGLNativeWindowType window,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
virtual SurfaceImpl *createPbufferSurface(const egl::Config *configuration,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
virtual SurfaceImpl *createPbufferFromClientBuffer(const egl::Config *configuration,
|
||||
EGLClientBuffer shareHandle,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
virtual SurfaceImpl *createPixmapSurface(const egl::Config *configuration,
|
||||
NativePixmapType nativePixmap,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
|
||||
virtual ImageImpl *createImage(EGLenum target,
|
||||
egl::ImageSibling *buffer,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
|
||||
virtual gl::Context *createContext(const egl::Config *config,
|
||||
const gl::Context *shareContext,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
|
||||
virtual StreamProducerImpl *createStreamProducerD3DTextureNV12(
|
||||
egl::Stream::ConsumerType consumerType,
|
||||
const egl::AttributeMap &attribs) = 0;
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif // LIBANGLE_RENDERER_EGLIMPLFACTORY_H_
|
|
@ -3,12 +3,12 @@
|
|||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
// ImplFactory.h:
|
||||
// Factory interface for Impl objects.
|
||||
// GLImplFactory.h:
|
||||
// Factory interface for OpenGL ES Impl objects.
|
||||
//
|
||||
|
||||
#ifndef LIBANGLE_RENDERER_IMPLFACTORY_H_
|
||||
#define LIBANGLE_RENDERER_IMPLFACTORY_H_
|
||||
#ifndef LIBANGLE_RENDERER_GLIMPLFACTORY_H_
|
||||
#define LIBANGLE_RENDERER_GLIMPLFACTORY_H_
|
||||
|
||||
#include "libANGLE/Framebuffer.h"
|
||||
#include "libANGLE/Program.h"
|
||||
|
@ -37,11 +37,11 @@ class TextureImpl;
|
|||
class TransformFeedbackImpl;
|
||||
class VertexArrayImpl;
|
||||
|
||||
class ImplFactory : angle::NonCopyable
|
||||
class GLImplFactory : angle::NonCopyable
|
||||
{
|
||||
public:
|
||||
ImplFactory() {}
|
||||
virtual ~ImplFactory() {}
|
||||
GLImplFactory() {}
|
||||
virtual ~GLImplFactory() {}
|
||||
|
||||
// Context creation
|
||||
virtual ContextImpl *createContext(const gl::ContextState &state) = 0;
|
||||
|
@ -78,6 +78,6 @@ class ImplFactory : angle::NonCopyable
|
|||
virtual SamplerImpl *createSampler() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace rx
|
||||
|
||||
#endif // LIBANGLE_RENDERER_IMPLFACTORY_H_
|
||||
#endif // LIBANGLE_RENDERER_GLIMPLFACTORY_H_
|
|
@ -16,7 +16,7 @@
|
|||
#include "libANGLE/State.h"
|
||||
#include "libANGLE/Uniform.h"
|
||||
#include "libANGLE/angletypes.h"
|
||||
#include "libANGLE/renderer/ImplFactory.h"
|
||||
#include "libANGLE/renderer/GLImplFactory.h"
|
||||
#include "common/mathutil.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
@ -37,7 +37,7 @@ struct SourceIndexData;
|
|||
struct WorkaroundsD3D;
|
||||
class DisplayImpl;
|
||||
|
||||
class Renderer : public ImplFactory
|
||||
class Renderer : public GLImplFactory
|
||||
{
|
||||
public:
|
||||
Renderer();
|
||||
|
|
|
@ -69,7 +69,7 @@ TEST(ValidationESTest, DrawElementsWithMaxIndexGivesError)
|
|||
auto programImpl = MakeProgramMock();
|
||||
|
||||
// TODO(jmadill): Generalize some of this code so we can re-use it for other tests.
|
||||
NiceMock<MockFactory> mockFactory;
|
||||
NiceMock<MockGLFactory> mockFactory;
|
||||
EXPECT_CALL(mockFactory, createFramebuffer(_)).WillOnce(Return(framebufferImpl));
|
||||
EXPECT_CALL(mockFactory, createProgram(_)).WillOnce(Return(programImpl));
|
||||
EXPECT_CALL(mockFactory, createVertexArray(_)).WillOnce(Return(nullptr));
|
||||
|
|
|
@ -142,11 +142,12 @@
|
|||
'libANGLE/renderer/DeviceImpl.h',
|
||||
'libANGLE/renderer/DisplayImpl.cpp',
|
||||
'libANGLE/renderer/DisplayImpl.h',
|
||||
'libANGLE/renderer/EGLImplFactory.h',
|
||||
'libANGLE/renderer/FenceNVImpl.h',
|
||||
'libANGLE/renderer/FenceSyncImpl.h',
|
||||
'libANGLE/renderer/FramebufferImpl.h',
|
||||
'libANGLE/renderer/GLImplFactory.h',
|
||||
'libANGLE/renderer/ImageImpl.h',
|
||||
'libANGLE/renderer/ImplFactory.h',
|
||||
'libANGLE/renderer/ProgramImpl.h',
|
||||
'libANGLE/renderer/QueryImpl.h',
|
||||
'libANGLE/renderer/RenderbufferImpl.h',
|
||||
|
|
|
@ -10,13 +10,14 @@
|
|||
#define TESTS_ANGLE_UNITTESTS_UTILS_H_
|
||||
|
||||
#include "libANGLE/renderer/ContextImpl.h"
|
||||
#include "libANGLE/renderer/ImplFactory.h"
|
||||
#include "libANGLE/renderer/EGLImplFactory.h"
|
||||
#include "libANGLE/renderer/GLImplFactory.h"
|
||||
|
||||
namespace rx
|
||||
{
|
||||
|
||||
// Useful when mocking a part of the ImplFactory class
|
||||
class NullFactory : public ImplFactory
|
||||
// Useful when mocking a part of the GLImplFactory class
|
||||
class NullFactory : public GLImplFactory
|
||||
{
|
||||
public:
|
||||
NullFactory() {}
|
||||
|
@ -60,7 +61,7 @@ class NullFactory : public ImplFactory
|
|||
};
|
||||
|
||||
// A class with all the factory methods mocked.
|
||||
class MockFactory : public ImplFactory
|
||||
class MockGLFactory : public GLImplFactory
|
||||
{
|
||||
public:
|
||||
MOCK_METHOD1(createContext, ContextImpl *(const gl::ContextState &));
|
||||
|
@ -78,6 +79,29 @@ class MockFactory : public ImplFactory
|
|||
MOCK_METHOD0(createTransformFeedback, TransformFeedbackImpl *());
|
||||
MOCK_METHOD0(createSampler, SamplerImpl *());
|
||||
};
|
||||
}
|
||||
|
||||
class MockEGLFactory : public EGLImplFactory
|
||||
{
|
||||
public:
|
||||
MOCK_METHOD3(createWindowSurface,
|
||||
SurfaceImpl *(const egl::Config *,
|
||||
EGLNativeWindowType,
|
||||
const egl::AttributeMap &));
|
||||
MOCK_METHOD2(createPbufferSurface,
|
||||
SurfaceImpl *(const egl::Config *, const egl::AttributeMap &));
|
||||
MOCK_METHOD3(createPbufferFromClientBuffer,
|
||||
SurfaceImpl *(const egl::Config *, EGLClientBuffer, const egl::AttributeMap &));
|
||||
MOCK_METHOD3(createPixmapSurface,
|
||||
SurfaceImpl *(const egl::Config *, NativePixmapType, const egl::AttributeMap &));
|
||||
MOCK_METHOD3(createImage, ImageImpl *(EGLenum, egl::ImageSibling *, const egl::AttributeMap &));
|
||||
MOCK_METHOD3(createContext,
|
||||
gl::Context *(const egl::Config *,
|
||||
const gl::Context *,
|
||||
const egl::AttributeMap &));
|
||||
MOCK_METHOD2(createStreamProducerD3DTextureNV12,
|
||||
StreamProducerImpl *(egl::Stream::ConsumerType, const egl::AttributeMap &));
|
||||
};
|
||||
|
||||
} // namespace rx
|
||||
|
||||
#endif // TESTS_ANGLE_UNITTESTS_UTILS_H_
|
||||
|
|
Загрузка…
Ссылка в новой задаче