1 //
2 // Copyright 2016 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 // EGLImplFactory.h:
7 // Factory interface for EGL Impl objects.
8 //
9
10 #ifndef LIBANGLE_RENDERER_EGLIMPLFACTORY_H_
11 #define LIBANGLE_RENDERER_EGLIMPLFACTORY_H_
12
13 #include "libANGLE/Stream.h"
14
15 namespace egl
16 {
17 class AttributeMap;
18 struct Config;
19 class ImageSibling;
20 struct ImageState;
21 class ShareGroupState;
22 struct SurfaceState;
23 } // namespace egl
24
25 namespace gl
26 {
27 class Context;
28 class ErrorSet;
29 class State;
30 } // namespace gl
31
32 namespace rx
33 {
34 class ContextImpl;
35 class EGLSyncImpl;
36 class ImageImpl;
37 class ExternalImageSiblingImpl;
38 class SurfaceImpl;
39 class ShareGroupImpl;
40
41 class EGLImplFactory : angle::NonCopyable
42 {
43 public:
EGLImplFactory()44 EGLImplFactory() {}
~EGLImplFactory()45 virtual ~EGLImplFactory() {}
46
47 virtual SurfaceImpl *createWindowSurface(const egl::SurfaceState &state,
48 EGLNativeWindowType window,
49 const egl::AttributeMap &attribs) = 0;
50 virtual SurfaceImpl *createPbufferSurface(const egl::SurfaceState &state,
51 const egl::AttributeMap &attribs) = 0;
52 virtual SurfaceImpl *createPbufferFromClientBuffer(const egl::SurfaceState &state,
53 EGLenum buftype,
54 EGLClientBuffer clientBuffer,
55 const egl::AttributeMap &attribs) = 0;
56 virtual SurfaceImpl *createPixmapSurface(const egl::SurfaceState &state,
57 NativePixmapType nativePixmap,
58 const egl::AttributeMap &attribs) = 0;
59
60 virtual ImageImpl *createImage(const egl::ImageState &state,
61 const gl::Context *context,
62 EGLenum target,
63 const egl::AttributeMap &attribs) = 0;
64
65 virtual ContextImpl *createContext(const gl::State &state,
66 gl::ErrorSet *errorSet,
67 const egl::Config *configuration,
68 const gl::Context *shareContext,
69 const egl::AttributeMap &attribs) = 0;
70
71 virtual StreamProducerImpl *createStreamProducerD3DTexture(
72 egl::Stream::ConsumerType consumerType,
73 const egl::AttributeMap &attribs) = 0;
74
75 virtual ExternalImageSiblingImpl *createExternalImageSibling(const gl::Context *context,
76 EGLenum target,
77 EGLClientBuffer buffer,
78 const egl::AttributeMap &attribs);
79
80 virtual EGLSyncImpl *createSync();
81
82 virtual ShareGroupImpl *createShareGroup(const egl::ShareGroupState &state) = 0;
83 };
84
createExternalImageSibling(const gl::Context * context,EGLenum target,EGLClientBuffer buffer,const egl::AttributeMap & attribs)85 inline ExternalImageSiblingImpl *EGLImplFactory::createExternalImageSibling(
86 const gl::Context *context,
87 EGLenum target,
88 EGLClientBuffer buffer,
89 const egl::AttributeMap &attribs)
90 {
91 UNREACHABLE();
92 return nullptr;
93 }
94
createSync()95 inline EGLSyncImpl *EGLImplFactory::createSync()
96 {
97 UNREACHABLE();
98 return nullptr;
99 }
100
101 } // namespace rx
102
103 #endif // LIBANGLE_RENDERER_EGLIMPLFACTORY_H_
104