Changeset View
Changeset View
Standalone View
Standalone View
source/blender/gpu/opengl/gl_backend.hh
| Show All 29 Lines | |||||
| #include "gl_batch.hh" | #include "gl_batch.hh" | ||||
| #include "gl_context.hh" | #include "gl_context.hh" | ||||
| #include "gl_drawlist.hh" | #include "gl_drawlist.hh" | ||||
| #include "gl_framebuffer.hh" | #include "gl_framebuffer.hh" | ||||
| #include "gl_index_buffer.hh" | #include "gl_index_buffer.hh" | ||||
| #include "gl_shader.hh" | #include "gl_shader.hh" | ||||
| #include "gl_texture.hh" | #include "gl_texture.hh" | ||||
| #include "gl_uniform_buffer.hh" | #include "gl_uniform_buffer.hh" | ||||
| #include "gl_vertex_buffer.hh" | |||||
| namespace blender { | namespace blender { | ||||
| namespace gpu { | namespace gpu { | ||||
| class GLBackend : public GPUBackend { | class GLBackend : public GPUBackend { | ||||
| private: | private: | ||||
| GLSharedOrphanLists shared_orphan_list_; | GLSharedOrphanLists shared_orphan_list_; | ||||
| public: | public: | ||||
| GLBackend() | GLBackend() | ||||
| { | { | ||||
| /* platform_init needs to go first. */ | |||||
| GLBackend::platform_init(); | |||||
| GLBackend::capabilities_init(); | |||||
| GLTexture::samplers_init(); | GLTexture::samplers_init(); | ||||
| } | } | ||||
| ~GLBackend() | ~GLBackend() | ||||
| { | { | ||||
| GLTexture::samplers_free(); | GLTexture::samplers_free(); | ||||
| GLBackend::platform_exit(); | |||||
| } | } | ||||
| static GLBackend *get(void) | static GLBackend *get(void) | ||||
| { | { | ||||
| return static_cast<GLBackend *>(GPUBackend::get()); | return static_cast<GLBackend *>(GPUBackend::get()); | ||||
| } | } | ||||
| void samplers_update(void) override | void samplers_update(void) override | ||||
| Show All 36 Lines | Texture *texture_alloc(const char *name) override | ||||
| return new GLTexture(name); | return new GLTexture(name); | ||||
| }; | }; | ||||
| UniformBuf *uniformbuf_alloc(int size, const char *name) override | UniformBuf *uniformbuf_alloc(int size, const char *name) override | ||||
| { | { | ||||
| return new GLUniformBuf(size, name); | return new GLUniformBuf(size, name); | ||||
| }; | }; | ||||
| /* TODO remove */ | VertBuf *vertbuf_alloc(void) override | ||||
| void buf_free(GLuint buf_id); | { | ||||
| void tex_free(GLuint tex_id); | return new GLVertBuf(); | ||||
| void orphans_add(Vector<GLuint> &orphan_list, std::mutex &list_mutex, unsigned int id) | }; | ||||
| { | |||||
| list_mutex.lock(); | GLSharedOrphanLists &shared_orphan_list_get(void) | ||||
| orphan_list.append(id); | { | ||||
| list_mutex.unlock(); | return shared_orphan_list_; | ||||
| } | }; | ||||
| private: | |||||
| static void platform_init(void); | |||||
| static void platform_exit(void); | |||||
| static void capabilities_init(void); | |||||
| }; | }; | ||||
| } // namespace gpu | } // namespace gpu | ||||
| } // namespace blender | } // namespace blender | ||||