Hash :
20c97cac
Author :
Date :
2016-11-04T18:27:56
Squashed commit of the following:
commit 0146dfeefa47b520e71f0e74230abd7dac163a79
Author: Stanislav Chiknavaryan <stanisc@chromium.org>
Date: Fri Nov 4 17:43:03 2016 -0700
Revert "Implementation of eglGetSyncValuesCHROMIUM extension."
This reverts commit 5d9f5df01ac5a384d9b7cbb49d9f98a76b62c7ad.
commit 0d920fe27bd8e73d831a9002548bde00fea78709
Author: Stanislav Chiknavaryan <stanisc@chromium.org>
Date: Fri Nov 4 17:23:11 2016 -0700
Revert "Fix EGLSyncControlTest.SyncValuesTest timeout on Windowse Server 2012 R2"
This reverts commit d258ca045f31eb43ec01b5501c84e9afd8e82cd6.
commit bde8defe53741855bb71fbf27bcb0a91cfafbd01
Author: Stanislav Chiknavaryan <stanisc@chromium.org>
Date: Fri Nov 4 17:22:58 2016 -0700
Revert "Disabling EGLSyncControlTest.SyncValuesTest"
This reverts commit a74183613955bd891f56f6a979a5391c16c64138.
commit f78e4b7e97b9d1259878f6902bb6ddeb0aeded87
Author: Stanislav Chiknavaryan <stanisc@chromium.org>
Date: Fri Nov 4 17:22:36 2016 -0700
Revert "Fix and re-enable EGLSyncControlTest.SyncValuesTest"
This reverts commit 138ec92f52da7c0fc8e6df08ac4e4e572bbf6b39.
commit f3933e6a04bd23473077d2fd74616023db3c9601
Author: Stanislav Chiknavaryan <stanisc@chromium.org>
Date: Fri Nov 4 17:20:26 2016 -0700
Revert "Handle nullptr mSwapChain in SwapChain11::getSyncValues"
This reverts commit af7f301f6ba9e5f31d1511142a936a9ba84169d0.
BUG=angleproject:1402
Change-Id: I99969e906e316574e9f739141de0e360d1edebd9
Reviewed-on: https://chromium-review.googlesource.com/408752
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Stanislav Chiknavaryan <stanisc@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 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
//
// Copyright (c) 2002-2014 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.
//
// Surface.cpp: Implements the egl::Surface class, representing a drawing surface
// such as the client area of a window, including any back buffers.
// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
#include "libANGLE/Surface.h"
#include <EGL/eglext.h>
#include <iostream>
#include "libANGLE/Config.h"
#include "libANGLE/Framebuffer.h"
#include "libANGLE/Texture.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/renderer/EGLImplFactory.h"
namespace egl
{
SurfaceState::SurfaceState() : defaultFramebuffer(nullptr)
{
}
Surface::Surface(EGLint surfaceType, const egl::Config *config, const AttributeMap &attributes)
: FramebufferAttachmentObject(),
mImplementation(nullptr),
mCurrentCount(0),
mDestroyed(false),
mType(surfaceType),
mConfig(config),
mPostSubBufferRequested(false),
mFixedSize(false),
mFixedWidth(0),
mFixedHeight(0),
mTextureFormat(EGL_NO_TEXTURE),
mTextureTarget(EGL_NO_TEXTURE),
// FIXME: Determine actual pixel aspect ratio
mPixelAspectRatio(static_cast<EGLint>(1.0 * EGL_DISPLAY_SCALING)),
mRenderBuffer(EGL_BACK_BUFFER),
mSwapBehavior(EGL_NONE),
mOrientation(0),
mTexture(),
mBackFormat(config->renderTargetFormat),
mDSFormat(config->depthStencilFormat)
{
mPostSubBufferRequested = (attributes.get(EGL_POST_SUB_BUFFER_SUPPORTED_NV, EGL_FALSE) == EGL_TRUE);
mFlexibleSurfaceCompatibilityRequested =
(attributes.get(EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE, EGL_FALSE) == EGL_TRUE);
mDirectComposition = (attributes.get(EGL_DIRECT_COMPOSITION_ANGLE, EGL_FALSE) == EGL_TRUE);
mFixedSize = (attributes.get(EGL_FIXED_SIZE_ANGLE, EGL_FALSE) == EGL_TRUE);
if (mFixedSize)
{
mFixedWidth = static_cast<size_t>(attributes.get(EGL_WIDTH, 0));
mFixedHeight = static_cast<size_t>(attributes.get(EGL_HEIGHT, 0));
}
if (mType != EGL_WINDOW_BIT)
{
mTextureFormat = static_cast<EGLenum>(attributes.get(EGL_TEXTURE_FORMAT, EGL_NO_TEXTURE));
mTextureTarget = static_cast<EGLenum>(attributes.get(EGL_TEXTURE_TARGET, EGL_NO_TEXTURE));
}
mOrientation = static_cast<EGLint>(attributes.get(EGL_SURFACE_ORIENTATION_ANGLE, 0));
}
Surface::~Surface()
{
if (mTexture.get())
{
if (mImplementation)
{
mImplementation->releaseTexImage(EGL_BACK_BUFFER);
}
mTexture->releaseTexImageFromSurface();
mTexture.set(nullptr);
}
SafeDelete(mState.defaultFramebuffer);
SafeDelete(mImplementation);
}
Error Surface::initialize()
{
ANGLE_TRY(mImplementation->initialize());
// Initialized here since impl is nullptr in the constructor.
// Must happen after implementation initialize for Android.
mSwapBehavior = mImplementation->getSwapBehavior();
// Must happen after implementation initialize for OSX.
mState.defaultFramebuffer = createDefaultFramebuffer();
ASSERT(mState.defaultFramebuffer != nullptr);
return Error(EGL_SUCCESS);
}
void Surface::setIsCurrent(bool isCurrent)
{
if (isCurrent)
{
mCurrentCount++;
}
else
{
ASSERT(mCurrentCount > 0);
mCurrentCount--;
if (mCurrentCount == 0 && mDestroyed)
{
delete this;
}
}
}
void Surface::onDestroy()
{
mDestroyed = true;
if (mCurrentCount == 0)
{
delete this;
}
}
EGLint Surface::getType() const
{
return mType;
}
Error Surface::swap()
{
return mImplementation->swap();
}
Error Surface::swapWithDamage(EGLint *rects, EGLint n_rects)
{
return mImplementation->swapWithDamage(rects, n_rects);
}
Error Surface::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height)
{
return mImplementation->postSubBuffer(x, y, width, height);
}
Error Surface::querySurfacePointerANGLE(EGLint attribute, void **value)
{
return mImplementation->querySurfacePointerANGLE(attribute, value);
}
EGLint Surface::isPostSubBufferSupported() const
{
return mPostSubBufferRequested && mImplementation->isPostSubBufferSupported();
}
void Surface::setSwapInterval(EGLint interval)
{
mImplementation->setSwapInterval(interval);
}
const Config *Surface::getConfig() const
{
return mConfig;
}
EGLint Surface::getPixelAspectRatio() const
{
return mPixelAspectRatio;
}
EGLenum Surface::getRenderBuffer() const
{
return mRenderBuffer;
}
EGLenum Surface::getSwapBehavior() const
{
return mSwapBehavior;
}
EGLenum Surface::getTextureFormat() const
{
return mTextureFormat;
}
EGLenum Surface::getTextureTarget() const
{
return mTextureTarget;
}
EGLint Surface::isFixedSize() const
{
return mFixedSize;
}
EGLint Surface::getWidth() const
{
return mFixedSize ? static_cast<EGLint>(mFixedWidth) : mImplementation->getWidth();
}
EGLint Surface::getHeight() const
{
return mFixedSize ? static_cast<EGLint>(mFixedHeight) : mImplementation->getHeight();
}
Error Surface::bindTexImage(gl::Texture *texture, EGLint buffer)
{
ASSERT(!mTexture.get());
ANGLE_TRY(mImplementation->bindTexImage(texture, buffer));
texture->bindTexImageFromSurface(this);
mTexture.set(texture);
return Error(EGL_SUCCESS);
}
Error Surface::releaseTexImage(EGLint buffer)
{
ANGLE_TRY(mImplementation->releaseTexImage(buffer));
ASSERT(mTexture.get());
mTexture->releaseTexImageFromSurface();
mTexture.set(nullptr);
return Error(EGL_SUCCESS);
}
void Surface::releaseTexImageFromTexture()
{
ASSERT(mTexture.get());
mTexture.set(nullptr);
}
gl::Extents Surface::getAttachmentSize(const gl::FramebufferAttachment::Target & /*target*/) const
{
return gl::Extents(getWidth(), getHeight(), 1);
}
const gl::Format &Surface::getAttachmentFormat(
const gl::FramebufferAttachment::Target &target) const
{
return (target.binding() == GL_BACK ? mBackFormat : mDSFormat);
}
GLsizei Surface::getAttachmentSamples(const gl::FramebufferAttachment::Target &target) const
{
return getConfig()->samples;
}
GLuint Surface::getId() const
{
UNREACHABLE();
return 0;
}
gl::Framebuffer *Surface::createDefaultFramebuffer()
{
gl::Framebuffer *framebuffer = new gl::Framebuffer(mImplementation);
GLenum drawBufferState = GL_BACK;
framebuffer->setDrawBuffers(1, &drawBufferState);
framebuffer->setReadBuffer(GL_BACK);
framebuffer->setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_BACK, gl::ImageIndex::MakeInvalid(),
this);
if (mConfig->depthSize > 0)
{
framebuffer->setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_DEPTH, gl::ImageIndex::MakeInvalid(),
this);
}
if (mConfig->stencilSize > 0)
{
framebuffer->setAttachment(GL_FRAMEBUFFER_DEFAULT, GL_STENCIL,
gl::ImageIndex::MakeInvalid(), this);
}
return framebuffer;
}
WindowSurface::WindowSurface(rx::EGLImplFactory *implFactory,
const egl::Config *config,
EGLNativeWindowType window,
const AttributeMap &attribs)
: Surface(EGL_WINDOW_BIT, config, attribs)
{
mImplementation = implFactory->createWindowSurface(mState, config, window, attribs);
}
WindowSurface::~WindowSurface()
{
}
PbufferSurface::PbufferSurface(rx::EGLImplFactory *implFactory,
const Config *config,
const AttributeMap &attribs)
: Surface(EGL_PBUFFER_BIT, config, attribs)
{
mImplementation = implFactory->createPbufferSurface(mState, config, attribs);
}
PbufferSurface::PbufferSurface(rx::EGLImplFactory *implFactory,
const Config *config,
EGLenum buftype,
EGLClientBuffer clientBuffer,
const AttributeMap &attribs)
: Surface(EGL_PBUFFER_BIT, config, attribs)
{
mImplementation =
implFactory->createPbufferFromClientBuffer(mState, config, buftype, clientBuffer, attribs);
}
PbufferSurface::~PbufferSurface()
{
}
PixmapSurface::PixmapSurface(rx::EGLImplFactory *implFactory,
const Config *config,
NativePixmapType nativePixmap,
const AttributeMap &attribs)
: Surface(EGL_PIXMAP_BIT, config, attribs)
{
mImplementation = implFactory->createPixmapSurface(mState, config, nativePixmap, attribs);
}
PixmapSurface::~PixmapSurface()
{
}
} // namespace egl