gfx/gl/SharedSurfaceANGLE.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef SHARED_SURFACE_ANGLE_H_
michael@0 7 #define SHARED_SURFACE_ANGLE_H_
michael@0 8
michael@0 9 #include "SharedSurfaceGL.h"
michael@0 10 #include "SurfaceFactory.h"
michael@0 11 #include "GLLibraryEGL.h"
michael@0 12 #include "SurfaceTypes.h"
michael@0 13
michael@0 14 #include <windows.h>
michael@0 15 #include <d3d10_1.h>
michael@0 16
michael@0 17 namespace mozilla {
michael@0 18 namespace gl {
michael@0 19
michael@0 20 class GLContext;
michael@0 21
michael@0 22 class SharedSurface_ANGLEShareHandle
michael@0 23 : public SharedSurface_GL
michael@0 24 {
michael@0 25 public:
michael@0 26 static SharedSurface_ANGLEShareHandle* Create(GLContext* gl, ID3D10Device1* d3d,
michael@0 27 EGLContext context, EGLConfig config,
michael@0 28 const gfx::IntSize& size,
michael@0 29 bool hasAlpha);
michael@0 30
michael@0 31 static SharedSurface_ANGLEShareHandle* Cast(SharedSurface* surf) {
michael@0 32 MOZ_ASSERT(surf->Type() == SharedSurfaceType::EGLSurfaceANGLE);
michael@0 33
michael@0 34 return (SharedSurface_ANGLEShareHandle*)surf;
michael@0 35 }
michael@0 36
michael@0 37 protected:
michael@0 38 GLLibraryEGL* const mEGL;
michael@0 39 const EGLContext mContext;
michael@0 40 const EGLSurface mPBuffer;
michael@0 41 nsRefPtr<ID3D10Texture2D> mTexture;
michael@0 42 nsRefPtr<ID3D10ShaderResourceView> mSRV;
michael@0 43
michael@0 44 SharedSurface_ANGLEShareHandle(GLContext* gl,
michael@0 45 GLLibraryEGL* egl,
michael@0 46 const gfx::IntSize& size,
michael@0 47 bool hasAlpha,
michael@0 48 EGLContext context,
michael@0 49 EGLSurface pbuffer,
michael@0 50 ID3D10Texture2D* texture,
michael@0 51 ID3D10ShaderResourceView* srv)
michael@0 52 : SharedSurface_GL(SharedSurfaceType::EGLSurfaceANGLE,
michael@0 53 AttachmentType::Screen,
michael@0 54 gl,
michael@0 55 size,
michael@0 56 hasAlpha)
michael@0 57 , mEGL(egl)
michael@0 58 , mContext(context)
michael@0 59 , mPBuffer(pbuffer)
michael@0 60 , mTexture(texture)
michael@0 61 , mSRV(srv)
michael@0 62 {}
michael@0 63
michael@0 64 EGLDisplay Display();
michael@0 65
michael@0 66 public:
michael@0 67 virtual ~SharedSurface_ANGLEShareHandle();
michael@0 68
michael@0 69 virtual void LockProdImpl() MOZ_OVERRIDE;
michael@0 70 virtual void UnlockProdImpl() MOZ_OVERRIDE;
michael@0 71
michael@0 72 virtual void Fence() MOZ_OVERRIDE;
michael@0 73 virtual bool WaitSync() MOZ_OVERRIDE;
michael@0 74
michael@0 75 // Implementation-specific functions below:
michael@0 76 ID3D10ShaderResourceView* GetSRV() {
michael@0 77 return mSRV;
michael@0 78 }
michael@0 79 };
michael@0 80
michael@0 81
michael@0 82
michael@0 83 class SurfaceFactory_ANGLEShareHandle
michael@0 84 : public SurfaceFactory_GL
michael@0 85 {
michael@0 86 protected:
michael@0 87 GLContext* const mProdGL;
michael@0 88 GLLibraryEGL* const mEGL;
michael@0 89 nsRefPtr<ID3D10Device1> mConsD3D;
michael@0 90 EGLContext mContext;
michael@0 91 EGLConfig mConfig;
michael@0 92
michael@0 93 public:
michael@0 94 static SurfaceFactory_ANGLEShareHandle* Create(GLContext* gl,
michael@0 95 ID3D10Device1* d3d,
michael@0 96 const SurfaceCaps& caps);
michael@0 97
michael@0 98 protected:
michael@0 99 SurfaceFactory_ANGLEShareHandle(GLContext* gl,
michael@0 100 GLLibraryEGL* egl,
michael@0 101 ID3D10Device1* d3d,
michael@0 102 const SurfaceCaps& caps);
michael@0 103
michael@0 104 virtual SharedSurface* CreateShared(const gfx::IntSize& size) MOZ_OVERRIDE {
michael@0 105 bool hasAlpha = mReadCaps.alpha;
michael@0 106 return SharedSurface_ANGLEShareHandle::Create(mProdGL, mConsD3D,
michael@0 107 mContext, mConfig,
michael@0 108 size, hasAlpha);
michael@0 109 }
michael@0 110 };
michael@0 111
michael@0 112 } /* namespace gfx */
michael@0 113 } /* namespace mozilla */
michael@0 114
michael@0 115 #endif /* SHARED_SURFACE_ANGLE_H_ */

mercurial