KiCad PCB EDA Suite
vertex_container.cpp
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 (C) 2013 CERN
5 * Copyright (C) 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
36#include <gal/opengl/shader.h>
37
38#include <cstring>
39
40using namespace KIGFX;
41
42VERTEX_CONTAINER* VERTEX_CONTAINER::MakeContainer( bool aCached )
43{
44 if( aCached )
45 {
46 const char* vendor = (const char*) glGetString( GL_VENDOR );
47
48 // Open source drivers do not cope well with GPU memory mapping,
49 // so the vertex data has to be kept in RAM
50 if( strstr( vendor, "X.Org" ) || strstr( vendor, "nouveau" ) )
51 return new CACHED_CONTAINER_RAM;
52 else
53 return new CACHED_CONTAINER_GPU;
54 }
55
56 return new NONCACHED_CONTAINER;
57}
58
59
61 m_freeSpace( aSize ),
62 m_currentSize( aSize ),
63 m_initialSize( aSize ),
64 m_vertices( nullptr ),
65 m_failed( false ),
66 m_dirty( true )
67{
68}
69
70
72{
73}
Specialization of CACHED_CONTAINER that stores data in video memory via memory mapping.
Specialization of CACHED_CONTAINER that stores data in RAM.
VERTEX_CONTAINER(unsigned int aSize=DEFAULT_SIZE)
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:243
Class to store instances of VERTEX without caching.
Class to store vertices and handle transfers between system memory and GPU memory.