Hash :
53ea9cc6
Author :
Date :
2016-05-17T10:12:52
Replace rx::Renderer with rx::ContextImpl. Previously Context had no Impl class, but had a special relationship with the instanced Renderer class. Having a ContextImpl backing every Context will allow new designs to enable things like multithreading (where each ContextImpl stores a Context-specific device) or non- virtual Contexts on Android or other platforms where it is more efficient. A large refactoring patch that touches every back-end. BUG=angleproject:1363 Change-Id: Icb73a7d37447f08a664eeb499a310ba05d71a57e Reviewed-on: https://chromium-review.googlesource.com/342052 Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
//
// Copyright (c) 2015 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.
//
// DisplayGL.h: GL implementation of egl::Display
#include "libANGLE/renderer/gl/DisplayGL.h"
#include "libANGLE/AttributeMap.h"
#include "libANGLE/Display.h"
#include "libANGLE/Surface.h"
#include "libANGLE/renderer/gl/ContextGL.h"
#include "libANGLE/renderer/gl/RendererGL.h"
#include "libANGLE/renderer/gl/SurfaceGL.h"
#include <EGL/eglext.h>
namespace rx
{
DisplayGL::DisplayGL()
: mRenderer(nullptr)
{
}
DisplayGL::~DisplayGL()
{
}
egl::Error DisplayGL::initialize(egl::Display *display)
{
mRenderer = new RendererGL(getFunctionsGL(), display->getAttributeMap());
const gl::Version &maxVersion = mRenderer->getMaxSupportedESVersion();
if (maxVersion < gl::Version(2, 0))
{
return egl::Error(EGL_NOT_INITIALIZED, "OpenGL ES 2.0 is not supportable.");
}
return egl::Error(EGL_SUCCESS);
}
void DisplayGL::terminate()
{
SafeDelete(mRenderer);
}
ImageImpl *DisplayGL::createImage(EGLenum target,
egl::ImageSibling *buffer,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
ContextImpl *DisplayGL::createContext(const gl::ContextState &state)
{
ASSERT(mRenderer != nullptr);
return new ContextGL(state, mRenderer);
}
StreamProducerImpl *DisplayGL::createStreamProducerD3DTextureNV12(
egl::Stream::ConsumerType consumerType,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
egl::Error DisplayGL::makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context)
{
if (!drawSurface)
{
return egl::Error(EGL_SUCCESS);
}
SurfaceGL *glDrawSurface = GetImplAs<SurfaceGL>(drawSurface);
return glDrawSurface->makeCurrent();
}
const gl::Version &DisplayGL::getMaxSupportedESVersion() const
{
ASSERT(mRenderer != nullptr);
return mRenderer->getMaxSupportedESVersion();
}
}