Hash :
3dddccff
Author :
Date :
2017-11-14T16:44:36
Support RGB gl-tex-external stream consumers for StreamProducerNV12. This makes it relatively simple to sample from a D3D11Texture of arbitrary format. From: https://bugzilla.mozilla.org/show_bug.cgi?id=1322746 BUG=angleproject:2233 TEST=angle_end2end_tests Change-Id: I10cd3043b5cb0c5d36dd613467ba6c0ceadf41af Reviewed-on: https://chromium-review.googlesource.com/758042 Commit-Queue: Geoff Lang <geofflang@chromium.org> Reviewed-by: 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 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
//
// 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/Context.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/StateManagerGL.h"
#include "libANGLE/renderer/gl/SurfaceGL.h"
#include <EGL/eglext.h>
namespace rx
{
DisplayGL::DisplayGL(const egl::DisplayState &state)
: DisplayImpl(state), mRenderer(nullptr), mCurrentDrawSurface(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::EglNotInitialized() << "OpenGL ES 2.0 is not supportable.";
}
return egl::NoError();
}
void DisplayGL::terminate()
{
SafeDelete(mRenderer);
}
ImageImpl *DisplayGL::createImage(const egl::ImageState &state,
EGLenum target,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
ContextImpl *DisplayGL::createContext(const gl::ContextState &state)
{
ASSERT(mRenderer != nullptr);
return new ContextGL(state, mRenderer);
}
StreamProducerImpl *DisplayGL::createStreamProducerD3DTexture(
egl::Stream::ConsumerType consumerType,
const egl::AttributeMap &attribs)
{
UNIMPLEMENTED();
return nullptr;
}
egl::Error DisplayGL::makeCurrent(egl::Surface *drawSurface, egl::Surface *readSurface, gl::Context *context)
{
// Notify the previous surface (if it still exists) that it is no longer current
if (mCurrentDrawSurface &&
mState.surfaceSet.find(mCurrentDrawSurface) != mState.surfaceSet.end())
{
ANGLE_TRY(GetImplAs<SurfaceGL>(mCurrentDrawSurface)->unMakeCurrent());
}
mCurrentDrawSurface = nullptr;
if (!context)
{
return egl::NoError();
}
// Pause transform feedback before making a new surface current, to workaround anglebug.com/1426
ContextGL *glContext = GetImplAs<ContextGL>(context);
glContext->getStateManager()->pauseTransformFeedback();
if (drawSurface != nullptr)
{
SurfaceGL *glDrawSurface = GetImplAs<SurfaceGL>(drawSurface);
ANGLE_TRY(glDrawSurface->makeCurrent());
mCurrentDrawSurface = drawSurface;
return egl::NoError();
}
else
{
return makeCurrentSurfaceless(context);
}
}
gl::Version DisplayGL::getMaxSupportedESVersion() const
{
ASSERT(mRenderer != nullptr);
return mRenderer->getMaxSupportedESVersion();
}
void DisplayGL::generateExtensions(egl::DisplayExtensions *outExtensions) const
{
// Advertise robust resource initialization on all OpenGL backends for testing even though it is
// not fully implemented.
outExtensions->robustResourceInitialization = true;
}
egl::Error DisplayGL::makeCurrentSurfaceless(gl::Context *context)
{
UNIMPLEMENTED();
return egl::NoError();
}
}