• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
getSyncValues(EGLuint64KHR * ust,EGLuint64KHR * msc,EGLuint64KHR * sbc)25 egl::Error SurfaceGL::getSyncValues(EGLuint64KHR *ust, EGLuint64KHR *msc, EGLuint64KHR *sbc)
26 {
27     UNREACHABLE();
28     return egl::EglBadSurface();
29 }
30 
getMscRate(EGLint * numerator,EGLint * denominator)31 egl::Error SurfaceGL::getMscRate(EGLint *numerator, EGLint *denominator)
32 {
33     UNIMPLEMENTED();
34     return egl::EglBadAccess();
35 }
36 
initializeContents(const gl::Context * context,GLenum binding,const gl::ImageIndex & imageIndex)37 angle::Result SurfaceGL::initializeContents(const gl::Context *context,
38                                             GLenum binding,
39                                             const gl::ImageIndex &imageIndex)
40 {
41     FramebufferGL *framebufferGL = GetImplAs<FramebufferGL>(context->getFramebuffer({0}));
42     ASSERT(framebufferGL->isDefault());
43 
44     BlitGL *blitter = GetBlitGL(context);
45 
46     switch (binding)
47     {
48         case GL_BACK:
49             ANGLE_TRY(blitter->clearFramebuffer(context, true, false, false, framebufferGL));
50             break;
51 
52         case GL_DEPTH:
53         case GL_STENCIL:
54             ANGLE_TRY(blitter->clearFramebuffer(context, false, true, true, framebufferGL));
55             break;
56 
57         default:
58             UNREACHABLE();
59             break;
60     }
61 
62     return angle::Result::Continue;
63 }
64 
hasEmulatedAlphaChannel() const65 bool SurfaceGL::hasEmulatedAlphaChannel() const
66 {
67     return false;
68 }
69 
attachToFramebuffer(const gl::Context * context,gl::Framebuffer * framebuffer)70 egl::Error SurfaceGL::attachToFramebuffer(const gl::Context *context, gl::Framebuffer *framebuffer)
71 {
72     return egl::NoError();
73 }
74 
detachFromFramebuffer(const gl::Context * context,gl::Framebuffer * framebuffer)75 egl::Error SurfaceGL::detachFromFramebuffer(const gl::Context *context,
76                                             gl::Framebuffer *framebuffer)
77 {
78     return egl::NoError();
79 }
80 
81 }  // namespace rx
82