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