KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#ifndef CACHED_CONTAINER_GPU_H_
28#define CACHED_CONTAINER_GPU_H_
29
31
32namespace KIGFX
33{
34
39{
40public:
41 CACHED_CONTAINER_GPU( unsigned int aSize = DEFAULT_SIZE );
43
44 unsigned int GetBufferHandle() const override
45 {
46 return m_glBufferHandle;
47 }
48
49 bool IsMapped() const override
50 {
51 return m_isMapped;
52 }
53
55 void Map() override;
56
58 void Unmap() override;
59
60 virtual unsigned int AllItemsSize() const override;
61
62
63protected:
73 bool defragmentResize( unsigned int aNewSize ) override;
74 bool defragmentResizeMemcpy( unsigned int aNewSize );
75
78
80 unsigned int m_glBufferHandle;
81
84};
85} // namespace KIGFX
86
87#endif /* CACHED_CONTAINER_GPU_H_ */
Specialization of CACHED_CONTAINER that stores data in video memory via memory mapping.
void Map() override
Finish the vertices updates stage.
bool m_isMapped
Vertex buffer handle.
unsigned int GetBufferHandle() const override
Return handle to the vertex buffer.
virtual unsigned int AllItemsSize() const override
bool IsMapped() const override
Prepare the container for vertices updates.
bool defragmentResizeMemcpy(unsigned int aNewSize)
Flag saying if vertex buffer is currently mapped.
void Unmap() override
Finish the vertices updates stage.
bool defragmentResize(unsigned int aNewSize) override
Remove empty spaces between chunks and optionally resizes the container.
unsigned int m_glBufferHandle
Flag saying whether it is safe to use glCopyBufferSubData.
Class to store VERTEX instances with caching.
static constexpr unsigned int DEFAULT_SIZE
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247