• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright 2015 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 // GLImplFactory.h:
7 //   Factory interface for OpenGL ES Impl objects.
8 //
9 
10 #ifndef LIBANGLE_RENDERER_GLIMPLFACTORY_H_
11 #define LIBANGLE_RENDERER_GLIMPLFACTORY_H_
12 
13 #include <vector>
14 
15 #include "angle_gl.h"
16 #include "libANGLE/Framebuffer.h"
17 #include "libANGLE/Overlay.h"
18 #include "libANGLE/Program.h"
19 #include "libANGLE/ProgramPipeline.h"
20 #include "libANGLE/Renderbuffer.h"
21 #include "libANGLE/Shader.h"
22 #include "libANGLE/Texture.h"
23 #include "libANGLE/TransformFeedback.h"
24 #include "libANGLE/VertexArray.h"
25 #include "libANGLE/renderer/serial_utils.h"
26 
27 namespace gl
28 {
29 class State;
30 }  // namespace gl
31 
32 namespace rx
33 {
34 class BufferImpl;
35 class CompilerImpl;
36 class ContextImpl;
37 class FenceNVImpl;
38 class SyncImpl;
39 class FramebufferImpl;
40 class MemoryObjectImpl;
41 class OverlayImpl;
42 class PathImpl;
43 class ProgramImpl;
44 class ProgramPipelineImpl;
45 class QueryImpl;
46 class RenderbufferImpl;
47 class SamplerImpl;
48 class SemaphoreImpl;
49 class ShaderImpl;
50 class TextureImpl;
51 class TransformFeedbackImpl;
52 class VertexArrayImpl;
53 
54 class GLImplFactory : angle::NonCopyable
55 {
56   public:
57     GLImplFactory();
58     virtual ~GLImplFactory();
59 
60     // Shader creation
61     virtual CompilerImpl *createCompiler()                           = 0;
62     virtual ShaderImpl *createShader(const gl::ShaderState &data)    = 0;
63     virtual ProgramImpl *createProgram(const gl::ProgramState &data) = 0;
64 
65     // Framebuffer creation
66     virtual FramebufferImpl *createFramebuffer(const gl::FramebufferState &data) = 0;
67 
68     // Texture creation
69     virtual TextureImpl *createTexture(const gl::TextureState &state) = 0;
70 
71     // Renderbuffer creation
72     virtual RenderbufferImpl *createRenderbuffer(const gl::RenderbufferState &state) = 0;
73 
74     // Buffer creation
75     virtual BufferImpl *createBuffer(const gl::BufferState &state) = 0;
76 
77     // Vertex Array creation
78     virtual VertexArrayImpl *createVertexArray(const gl::VertexArrayState &data) = 0;
79 
80     // Query and Fence creation
81     virtual QueryImpl *createQuery(gl::QueryType type) = 0;
82     virtual FenceNVImpl *createFenceNV()               = 0;
83     virtual SyncImpl *createSync()                     = 0;
84 
85     // Transform Feedback creation
86     virtual TransformFeedbackImpl *createTransformFeedback(
87         const gl::TransformFeedbackState &state) = 0;
88 
89     // Sampler object creation
90     virtual SamplerImpl *createSampler(const gl::SamplerState &state) = 0;
91 
92     // Program Pipeline object creation
93     virtual ProgramPipelineImpl *createProgramPipeline(const gl::ProgramPipelineState &data) = 0;
94 
95     // Memory object creation
96     virtual MemoryObjectImpl *createMemoryObject() = 0;
97 
98     // Semaphore creation
99     virtual SemaphoreImpl *createSemaphore() = 0;
100 
101     // Overlay creation
102     virtual OverlayImpl *createOverlay(const gl::OverlayState &state) = 0;
103 
generateSerial()104     rx::Serial generateSerial() { return mSerialFactory.generate(); }
105 
106   private:
107     rx::SerialFactory mSerialFactory;
108 };
109 
110 inline GLImplFactory::GLImplFactory() = default;
111 
112 inline GLImplFactory::~GLImplFactory() = default;
113 
114 }  // namespace rx
115 
116 #endif  // LIBANGLE_RENDERER_GLIMPLFACTORY_H_
117