blob: dceef5fbf58a8da1cadd440df05583cc2d397213 [file] [log] [blame]
Geoff Lang6a1e6b92014-11-06 10:42:45 -05001//
2// Copyright 2014 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
Jamie Madill811b6352015-02-09 10:17:09 -05007// FramebufferImpl.h: Defines the abstract rx::FramebufferImpl class.
Geoff Lang6a1e6b92014-11-06 10:42:45 -05008
Jamie Madill811b6352015-02-09 10:17:09 -05009#ifndef LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
10#define LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_
Geoff Lang6a1e6b92014-11-06 10:42:45 -050011
12#include "angle_gl.h"
Jamie Madill1d57ad42015-02-02 16:57:06 -050013#include "common/angleutils.h"
14#include "libANGLE/Error.h"
Jamie Madilld1405e52015-03-05 15:41:39 -050015#include "libANGLE/Framebuffer.h"
Geoff Lang6a1e6b92014-11-06 10:42:45 -050016
Geoff Lang9ad4bda2014-12-01 11:03:09 -050017namespace gl
18{
Geoff Langb04dc822014-12-01 12:02:02 -050019class State;
Geoff Lang54bd5a42014-12-01 12:51:04 -050020class Framebuffer;
Geoff Lang9dd95802014-12-01 11:12:59 -050021class FramebufferAttachment;
Geoff Lang9ad4bda2014-12-01 11:03:09 -050022struct Rectangle;
23}
24
Geoff Lang6a1e6b92014-11-06 10:42:45 -050025namespace rx
26{
Jamie Madill6c1f6712017-02-14 19:08:04 -050027class DisplayImpl;
Geoff Lang6a1e6b92014-11-06 10:42:45 -050028
Jamie Madillf0d10f82015-03-31 12:56:52 -040029class FramebufferImpl : angle::NonCopyable
Geoff Langda88add2014-12-01 10:22:01 -050030{
31 public:
Jamie Madill48ef11b2016-04-27 15:21:52 -040032 explicit FramebufferImpl(const gl::FramebufferState &state) : mState(state) {}
Jamie Madilld1405e52015-03-05 15:41:39 -050033 virtual ~FramebufferImpl() { }
Jamie Madill6c1f6712017-02-14 19:08:04 -050034 virtual void destroy(ContextImpl *contextImpl) {}
35 virtual void destroyDefault(DisplayImpl *displayImpl) {}
Geoff Lang9ad4bda2014-12-01 11:03:09 -050036
Austin Kinross08332632015-05-05 13:35:47 -070037 virtual gl::Error discard(size_t count, const GLenum *attachments) = 0;
Geoff Lang9ad4bda2014-12-01 11:03:09 -050038 virtual gl::Error invalidate(size_t count, const GLenum *attachments) = 0;
39 virtual gl::Error invalidateSub(size_t count, const GLenum *attachments, const gl::Rectangle &area) = 0;
Geoff Lang748f74e2014-12-01 11:25:34 -050040
Jamie Madill8415b5f2016-04-26 13:41:39 -040041 virtual gl::Error clear(ContextImpl *context, GLbitfield mask) = 0;
42 virtual gl::Error clearBufferfv(ContextImpl *context,
Dian Xiang40281592015-11-19 18:24:44 -080043 GLenum buffer,
44 GLint drawbuffer,
45 const GLfloat *values) = 0;
Jamie Madill8415b5f2016-04-26 13:41:39 -040046 virtual gl::Error clearBufferuiv(ContextImpl *context,
Dian Xiang40281592015-11-19 18:24:44 -080047 GLenum buffer,
48 GLint drawbuffer,
49 const GLuint *values) = 0;
Jamie Madill8415b5f2016-04-26 13:41:39 -040050 virtual gl::Error clearBufferiv(ContextImpl *context,
Dian Xiang40281592015-11-19 18:24:44 -080051 GLenum buffer,
52 GLint drawbuffer,
53 const GLint *values) = 0;
Jamie Madill8415b5f2016-04-26 13:41:39 -040054 virtual gl::Error clearBufferfi(ContextImpl *context,
Dian Xiang40281592015-11-19 18:24:44 -080055 GLenum buffer,
56 GLint drawbuffer,
57 GLfloat depth,
58 GLint stencil) = 0;
Geoff Langb04dc822014-12-01 12:02:02 -050059
Geoff Langbce529e2014-12-01 12:48:41 -050060 virtual GLenum getImplementationColorReadFormat() const = 0;
61 virtual GLenum getImplementationColorReadType() const = 0;
Jamie Madill8415b5f2016-04-26 13:41:39 -040062 virtual gl::Error readPixels(ContextImpl *context,
63 const gl::Rectangle &area,
64 GLenum format,
65 GLenum type,
66 GLvoid *pixels) const = 0;
Geoff Langbce529e2014-12-01 12:48:41 -050067
Jamie Madill8415b5f2016-04-26 13:41:39 -040068 virtual gl::Error blit(ContextImpl *context,
69 const gl::Rectangle &sourceArea,
70 const gl::Rectangle &destArea,
71 GLbitfield mask,
72 GLenum filter) = 0;
Geoff Lang54bd5a42014-12-01 12:51:04 -050073
Jamie Madillcc86d642015-11-24 13:00:07 -050074 virtual bool checkStatus() const = 0;
Jamie Madill1d57ad42015-02-02 16:57:06 -050075
Jamie Madill60ec6ea2016-01-22 15:27:19 -050076 virtual void syncState(const gl::Framebuffer::DirtyBits &dirtyBits) = 0;
77
JiangYizhoubddc46b2016-12-09 09:50:51 +080078 virtual gl::Error getSamplePosition(size_t index, GLfloat *xy) const = 0;
79
Jamie Madillab9f9c32017-01-17 17:47:34 -050080 const gl::FramebufferState &getState() const { return mState; }
81
Jamie Madilld1405e52015-03-05 15:41:39 -050082 protected:
Jamie Madill48ef11b2016-04-27 15:21:52 -040083 const gl::FramebufferState &mState;
Geoff Langda88add2014-12-01 10:22:01 -050084};
85
Geoff Lang6a1e6b92014-11-06 10:42:45 -050086}
87
Jamie Madill811b6352015-02-09 10:17:09 -050088#endif // LIBANGLE_RENDERER_FRAMEBUFFERIMPL_H_