Commit da88adda by Geoff Lang

Create stubs for the FramebufferImpl class.

BUG=angle:841 Change-Id: I089409981604abe9c65c3019765d8d9eeffe38f5 Reviewed-on: https://chromium-review.googlesource.com/232381Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent f626df96
......@@ -186,7 +186,8 @@ void Context::makeCurrent(egl::Surface *surface)
mHasBeenCurrent = true;
}
Framebuffer *framebufferZero = new DefaultFramebuffer(mRenderer->createDefaultAttachment(GL_BACK, surface),
Framebuffer *framebufferZero = new DefaultFramebuffer(mRenderer->createFramebuffer(),
mRenderer->createDefaultAttachment(GL_BACK, surface),
mRenderer->createDefaultAttachment(GL_DEPTH, surface),
mRenderer->createDefaultAttachment(GL_STENCIL, surface));
......@@ -522,7 +523,7 @@ void Context::bindReadFramebuffer(GLuint framebuffer)
{
if (!getFramebuffer(framebuffer))
{
mFramebufferMap[framebuffer] = new Framebuffer(framebuffer);
mFramebufferMap[framebuffer] = new Framebuffer(mRenderer->createFramebuffer(), framebuffer);
}
mState.setReadFramebufferBinding(getFramebuffer(framebuffer));
......@@ -532,7 +533,7 @@ void Context::bindDrawFramebuffer(GLuint framebuffer)
{
if (!getFramebuffer(framebuffer))
{
mFramebufferMap[framebuffer] = new Framebuffer(framebuffer);
mFramebufferMap[framebuffer] = new Framebuffer(mRenderer->createFramebuffer(), framebuffer);
}
mState.setDrawFramebufferBinding(getFramebuffer(framebuffer));
......
......@@ -100,12 +100,15 @@ unsigned int GetAttachmentSerial(const gl::FramebufferAttachment *attachment)
namespace gl
{
Framebuffer::Framebuffer(GLuint id)
: mId(id),
Framebuffer::Framebuffer(rx::FramebufferImpl *impl, GLuint id)
: mImpl(impl),
mId(id),
mReadBufferState(GL_COLOR_ATTACHMENT0_EXT),
mDepthbuffer(NULL),
mStencilbuffer(NULL)
{
ASSERT(mImpl != nullptr);
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{
mColorbuffers[colorAttachment] = NULL;
......@@ -116,6 +119,7 @@ Framebuffer::Framebuffer(GLuint id)
Framebuffer::~Framebuffer()
{
SafeDelete(mImpl);
for (unsigned int colorAttachment = 0; colorAttachment < IMPLEMENTATION_MAX_DRAW_BUFFERS; colorAttachment++)
{
SafeDelete(mColorbuffers[colorAttachment]);
......@@ -542,9 +546,9 @@ Error Framebuffer::invalidateSub(GLsizei numAttachments, const GLenum *attachmen
return Error(GL_NO_ERROR);
}
DefaultFramebuffer::DefaultFramebuffer(rx::DefaultAttachmentImpl *colorAttachment, rx::DefaultAttachmentImpl *depthAttachment,
rx::DefaultAttachmentImpl *stencilAttachment)
: Framebuffer(0)
DefaultFramebuffer::DefaultFramebuffer(rx::FramebufferImpl *impl, rx::DefaultAttachmentImpl *colorAttachment,
rx::DefaultAttachmentImpl *depthAttachment, rx::DefaultAttachmentImpl *stencilAttachment)
: Framebuffer(impl, 0)
{
ASSERT(colorAttachment);
mColorbuffers[0] = new DefaultAttachment(GL_BACK, colorAttachment);
......
......@@ -24,6 +24,7 @@ namespace rx
class RenderbufferImpl;
struct Workarounds;
class DefaultAttachmentImpl;
class FramebufferImpl;
}
namespace gl
......@@ -42,9 +43,12 @@ typedef std::vector<FramebufferAttachment *> ColorbufferInfo;
class ANGLE_EXPORT Framebuffer
{
public:
Framebuffer(GLuint id);
Framebuffer(rx::FramebufferImpl *impl, GLuint id);
virtual ~Framebuffer();
const rx::FramebufferImpl *getImplementation() const { return mImpl; }
rx::FramebufferImpl *getImplementation() { return mImpl; }
GLuint id() const { return mId; }
void setTextureAttachment(GLenum attachment, Texture *texture, const ImageIndex &imageIndex);
......@@ -86,6 +90,7 @@ class ANGLE_EXPORT Framebuffer
ColorbufferInfo getColorbuffersForRender(const rx::Workarounds &workarounds) const;
protected:
rx::FramebufferImpl *mImpl;
GLuint mId;
FramebufferAttachment *mColorbuffers[IMPLEMENTATION_MAX_DRAW_BUFFERS];
......@@ -104,8 +109,8 @@ class ANGLE_EXPORT Framebuffer
class DefaultFramebuffer : public Framebuffer
{
public:
DefaultFramebuffer(rx::DefaultAttachmentImpl *colorAttachment, rx::DefaultAttachmentImpl *depthAttachment,
rx::DefaultAttachmentImpl *stencilAttachment);
DefaultFramebuffer(rx::FramebufferImpl *impl, rx::DefaultAttachmentImpl *colorAttachment,
rx::DefaultAttachmentImpl *depthAttachment, rx::DefaultAttachmentImpl *stencilAttachment);
GLenum completeness(const gl::Data &data) const override;
virtual FramebufferAttachment *getAttachment(GLenum attachment) const;
......
......@@ -26,6 +26,12 @@ class DefaultAttachmentImpl
virtual GLsizei getSamples() const = 0;
};
class FramebufferImpl
{
public:
virtual ~FramebufferImpl() {};
};
}
#endif // LIBANGLE_RENDERER_FRAMBUFFERIMPL_H_
......@@ -54,6 +54,7 @@ class TextureImpl;
class TransformFeedbackImpl;
class RenderbufferImpl;
class DefaultAttachmentImpl;
class FramebufferImpl;
struct TranslatedIndexData;
struct Workarounds;
class SwapChain;
......@@ -115,6 +116,7 @@ class Renderer
// Framebuffer creation
virtual DefaultAttachmentImpl *createDefaultAttachment(GLenum type, egl::Surface *surface) = 0;
virtual FramebufferImpl *createFramebuffer() = 0;
// Texture creation
virtual TextureImpl *createTexture(GLenum target) = 0;
......
......@@ -4,9 +4,10 @@
// found in the LICENSE file.
//
// Framebuffer11.h: Implements the DefaultAttachment11 class.
// FramebufferD3D.cpp: Implements the DefaultAttachmentD3D and FramebufferD3D classes.
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
#include "libANGLE/renderer/d3d/RendererD3D.h"
#include "libANGLE/renderer/RenderTarget.h"
namespace rx
......@@ -59,4 +60,15 @@ RenderTarget *DefaultAttachmentD3D::getRenderTarget() const
return mRenderTarget;
}
FramebufferD3D::FramebufferD3D(RendererD3D *renderer)
: mRenderer(renderer)
{
ASSERT(mRenderer != nullptr);
}
FramebufferD3D::~FramebufferD3D()
{
}
}
......@@ -4,7 +4,7 @@
// found in the LICENSE file.
//
// FramebufferD3D.h: Defines the DefaultAttachmentD3D class.
// FramebufferD3D.h: Defines the DefaultAttachmentD3D and FramebufferD3D classes.
#ifndef LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
#define LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
......@@ -14,6 +14,7 @@
namespace rx
{
class RenderTarget;
class RendererD3D;
class DefaultAttachmentD3D : public DefaultAttachmentImpl
{
......@@ -35,6 +36,16 @@ class DefaultAttachmentD3D : public DefaultAttachmentImpl
RenderTarget *mRenderTarget;
};
class FramebufferD3D : public FramebufferImpl
{
public:
FramebufferD3D(RendererD3D *renderer);
virtual ~FramebufferD3D();
private:
RendererD3D *const mRenderer;
};
}
#endif // LIBANGLE_RENDERER_D3D_FRAMBUFFERD3D_H_
//
// Copyright 2014 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.
//
// Framebuffer11.cpp: Implements the Framebuffer11 class.
#include "libANGLE/renderer/d3d/d3d11/Framebuffer11.h"
#include "libANGLE/renderer/d3d/d3d11/Renderer11.h"
namespace rx
{
Framebuffer11::Framebuffer11(Renderer11 *renderer)
: FramebufferD3D(renderer),
mRenderer(renderer)
{
ASSERT(mRenderer != nullptr);
}
Framebuffer11::~Framebuffer11()
{
}
}
//
// Copyright 2014 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.
//
// Framebuffer11.h: Defines the Framebuffer11 class.
#ifndef LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_
#define LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
namespace rx
{
class Renderer11;
class Framebuffer11 : public FramebufferD3D
{
public:
Framebuffer11(Renderer11 *renderer);
virtual ~Framebuffer11();
private:
Renderer11 *const mRenderer;
};
}
#endif // LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_
......@@ -30,6 +30,7 @@
#include "libANGLE/renderer/d3d/d3d11/Buffer11.h"
#include "libANGLE/renderer/d3d/d3d11/Clear11.h"
#include "libANGLE/renderer/d3d/d3d11/Fence11.h"
#include "libANGLE/renderer/d3d/d3d11/Framebuffer11.h"
#include "libANGLE/renderer/d3d/d3d11/Image11.h"
#include "libANGLE/renderer/d3d/d3d11/IndexBuffer11.h"
#include "libANGLE/renderer/d3d/d3d11/PixelTransfer11.h"
......@@ -2424,6 +2425,11 @@ DefaultAttachmentImpl *Renderer11::createDefaultAttachment(GLenum type, egl::Sur
}
}
FramebufferImpl *Renderer11::createFramebuffer()
{
return new Framebuffer11(this);
}
ShaderImpl *Renderer11::createShader(const gl::Data &data, GLenum type)
{
return new ShaderD3D(data, type, this);
......
......@@ -138,6 +138,7 @@ class Renderer11 : public RendererD3D
// Framebuffer creation
virtual DefaultAttachmentImpl *createDefaultAttachment(GLenum type, egl::Surface *surface) override;
virtual FramebufferImpl *createFramebuffer() override;
// Shader creation
virtual ShaderImpl *createShader(const gl::Data &data, GLenum type);
......
//
// Copyright 2014 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.
//
// Framebuffer9.cpp: Implements the Framebuffer9 class.
#include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h"
#include "libANGLE/renderer/d3d/d3d9/Renderer9.h"
namespace rx
{
Framebuffer9::Framebuffer9(Renderer9 *renderer)
: FramebufferD3D(renderer),
mRenderer(renderer)
{
ASSERT(mRenderer != nullptr);
}
Framebuffer9::~Framebuffer9()
{
}
}
//
// Copyright 2014 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.
//
// Framebuffer9.h: Defines the Framebuffer9 class.
#ifndef LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
#define LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
#include "libANGLE/renderer/d3d/FramebufferD3D.h"
namespace rx
{
class Renderer9;
class Framebuffer9 : public FramebufferD3D
{
public:
Framebuffer9(Renderer9 *renderer);
virtual ~Framebuffer9();
private:
Renderer9 *const mRenderer;
};
}
#endif // LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_
......@@ -31,6 +31,7 @@
#include "libANGLE/renderer/d3d/d3d9/Blit9.h"
#include "libANGLE/renderer/d3d/d3d9/Buffer9.h"
#include "libANGLE/renderer/d3d/d3d9/Fence9.h"
#include "libANGLE/renderer/d3d/d3d9/Framebuffer9.h"
#include "libANGLE/renderer/d3d/d3d9/Image9.h"
#include "libANGLE/renderer/d3d/d3d9/IndexBuffer9.h"
#include "libANGLE/renderer/d3d/d3d9/Query9.h"
......@@ -2884,6 +2885,11 @@ DefaultAttachmentImpl *Renderer9::createDefaultAttachment(GLenum type, egl::Surf
}
}
FramebufferImpl *Renderer9::createFramebuffer()
{
return new Framebuffer9(this);
}
ShaderImpl *Renderer9::createShader(const gl::Data &data, GLenum type)
{
return new ShaderD3D(data, type, this);
......
......@@ -144,6 +144,7 @@ class Renderer9 : public RendererD3D
// Framebuffer creation
virtual DefaultAttachmentImpl *createDefaultAttachment(GLenum type, egl::Surface *surface) override;
virtual FramebufferImpl *createFramebuffer() override;
// Shader creation
virtual ShaderImpl *createShader(const gl::Data &data, GLenum type);
......
......@@ -208,6 +208,8 @@
'libANGLE/renderer/d3d/d3d9/Fence9.h',
'libANGLE/renderer/d3d/d3d9/formatutils9.cpp',
'libANGLE/renderer/d3d/d3d9/formatutils9.h',
'libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp',
'libANGLE/renderer/d3d/d3d9/Framebuffer9.h',
'libANGLE/renderer/d3d/d3d9/Image9.cpp',
'libANGLE/renderer/d3d/d3d9/Image9.h',
'libANGLE/renderer/d3d/d3d9/IndexBuffer9.cpp',
......@@ -250,6 +252,8 @@
'libANGLE/renderer/d3d/d3d11/Fence11.h',
'libANGLE/renderer/d3d/d3d11/formatutils11.cpp',
'libANGLE/renderer/d3d/d3d11/formatutils11.h',
'libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp',
'libANGLE/renderer/d3d/d3d11/Framebuffer11.h',
'libANGLE/renderer/d3d/d3d11/Image11.cpp',
'libANGLE/renderer/d3d/d3d11/Image11.h',
'libANGLE/renderer/d3d/d3d11/IndexBuffer11.cpp',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment