1 //
2 // Copyright 2015 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
7 // SurfaceGL.cpp: OpenGL implementation of egl::Surface
8
9 #include "libANGLE/renderer/gl/SurfaceGL.h"
10
11 #include "libANGLE/Context.h"
12 #include "libANGLE/Surface.h"
13 #include "libANGLE/renderer/gl/BlitGL.h"
14 #include "libANGLE/renderer/gl/ContextGL.h"
15 #include "libANGLE/renderer/gl/FramebufferGL.h"
16 #include "libANGLE/renderer/gl/RendererGL.h"
17
18 namespace rx
19 {
20
SurfaceGL(const egl::SurfaceState & state)21 SurfaceGL::SurfaceGL(const egl::SurfaceState &state) : SurfaceImpl(state) {}
22
~SurfaceGL()23 SurfaceGL::~SurfaceGL() {}
24
createDefaultFramebuffer(const gl::Context * context,const gl::FramebufferState & data)25 FramebufferImpl *SurfaceGL::createDefaultFramebuffer(const gl::Context *context,
26 const gl::FramebufferState &data)
27 {
28 return new FramebufferGL(data, 0, true, false);
29 }
30
getSyncValues(EGLuint64KHR * ust,EGLuint64KHR * msc,EGLuint64KHR * sbc)31 egl::Error SurfaceGL::getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc)
32 {
33 UNREACHABLE();
34 return egl::EglBadSurface();
35 }
36
getMscRate(EGLint * numerator,EGLint * denominator)37 egl::Error SurfaceGL::getMscRate(EGLint *numerator, EGLint *denominator)
38 {
39 UNIMPLEMENTED();
40 return egl::EglBadAccess();
41 }
42
initializeContents(const gl::Context * context,const gl::ImageIndex & imageIndex)43 angle::Result SurfaceGL::initializeContents(const gl::Context *context,
44 const gl::ImageIndex &imageIndex)
45 {
46 FramebufferGL *framebufferGL = GetImplAs<FramebufferGL>(context->getFramebuffer({0}));
47 ASSERT(framebufferGL->isDefault());
48
49 BlitGL *blitter = GetBlitGL(context);
50 ANGLE_TRY(blitter->clearFramebuffer(context, framebufferGL));
51
52 return angle::Result::Continue;
53 }
54
hasEmulatedAlphaChannel() const55 bool SurfaceGL::hasEmulatedAlphaChannel() const
56 {
57 return false;
58 }
59
60 } // namespace rx
61