KiCad PCB EDA Suite
cached_container_gpu.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright 2013-2017 CERN
5  * @author Maciej Suminski <maciej.suminski@cern.ch>
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef CACHED_CONTAINER_GPU_H_
26 #define CACHED_CONTAINER_GPU_H_
27 
29 
30 namespace KIGFX
31 {
32 
38 {
39 public:
40  CACHED_CONTAINER_GPU( unsigned int aSize = DEFAULT_SIZE );
42 
43  unsigned int GetBufferHandle() const override
44  {
45  return m_glBufferHandle;
46  }
47 
48  bool IsMapped() const override
49  {
50  return m_isMapped;
51  }
52 
54  void Map() override;
55 
57  void Unmap() override;
58 
59 protected:
61  bool m_isMapped;
62 
64  unsigned int m_glBufferHandle;
65 
68 
77  bool defragmentResize( unsigned int aNewSize ) override;
78  bool defragmentResizeMemcpy( unsigned int aNewSize );
79 };
80 } // namespace KIGFX
81 
82 #endif /* CACHED_CONTAINER_GPU_H_ */
bool m_useCopyBuffer
Flag saying whether it is safe to use glCopyBufferSubData
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
unsigned int GetBufferHandle() const override
Returns handle to the vertex buffer.
unsigned int m_glBufferHandle
Vertex buffer handle
CACHED_CONTAINER_GPU(unsigned int aSize=DEFAULT_SIZE)
bool m_isMapped
Flag saying if vertex buffer is currently mapped
bool IsMapped() const override
Returns true if vertex buffer is currently mapped.
Class to store VERTEX instances with caching.
static constexpr unsigned int DEFAULT_SIZE
Specialization of CACHED_CONTAINER that stores data in video memory via memory mapping.
bool defragmentResizeMemcpy(unsigned int aNewSize)
bool defragmentResize(unsigned int aNewSize) override
Function defragmentResize() removes empty spaces between chunks and optionally resizes the container...