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