diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-21 13:30:55 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-21 15:16:42 +0300 |
commit | c4f122ac8f167c5296be9ee23344765f181e6314 (patch) | |
tree | d6a627aa2f3f4d43bd334556a0a37bd3c89ac66a /source/blender/gpu/opengl/gl_uniform_buffer.hh | |
parent | 7edd8a7738481b3d4f0720a173dca2a1853996d6 (diff) |
GPUUniformBuf: GL backend isolation
This is in preparation of vulkan backend. We move all opengl
functionnalities behind an abstract class.
This also cleansup the "dynamic" ubo create and rename it to
`GPU_uniformbuf_from_list()`
Contains, no functional change.
Part of T68990 Vulkan support.
Diffstat (limited to 'source/blender/gpu/opengl/gl_uniform_buffer.hh')
-rw-r--r-- | source/blender/gpu/opengl/gl_uniform_buffer.hh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/source/blender/gpu/opengl/gl_uniform_buffer.hh b/source/blender/gpu/opengl/gl_uniform_buffer.hh new file mode 100644 index 00000000000..9b904cb34ee --- /dev/null +++ b/source/blender/gpu/opengl/gl_uniform_buffer.hh @@ -0,0 +1,55 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2020 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup gpu + */ + +#pragma once + +#include "MEM_guardedalloc.h" + +#include "gpu_uniform_buffer_private.hh" + +#include "glew-mx.h" + +namespace blender { +namespace gpu { + +class GLUniformBuf : public UniformBuf { + private: + int slot_ = -1; + GLuint ubo_id_ = 0; + + public: + GLUniformBuf(size_t size, const char *name); + ~GLUniformBuf(); + + void update(const void *data) override; + void bind(int slot) override; + void unbind(void) override; + + private: + void init(void); + + MEM_CXX_CLASS_ALLOC_FUNCS("GLUniformBuf"); +}; + +} // namespace gpu +} // namespace blender |