1 /**************************************************************************
3 * Copyright 2011 Jose Fonseca
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 **************************************************************************/
34 #include "glimports.hpp"
48 * OpenGL ES buffers cannot be read. This class is used to track index buffer
66 bufferData(GLsizeiptr new_size, const void *new_data) {
71 data = realloc(data, new_size);
72 if (new_size && new_data) {
73 memcpy(data, new_data, size);
78 bufferSubData(GLsizeiptr offset, GLsizeiptr length, const void *new_data) {
79 if (offset >= 0 && offset < size && length > 0 && offset + length <= size && new_data) {
80 memcpy((GLubyte *)data + offset, new_data, length);
85 getSubData(GLsizeiptr offset, GLsizeiptr length, void *out_data) {
86 if (offset >= 0 && offset < size && length > 0 && offset + length <= size && out_data) {
87 memcpy(out_data, (GLubyte *)data + offset, length);
98 unsigned retain_count;
100 // TODO: This will fail for buffers shared by multiple contexts.
101 std::map <GLuint, Buffer> buffers;
104 profile(PROFILE_COMPAT),
106 user_arrays_arb(false),
107 user_arrays_nv(false),
112 needsShadowBuffers(void)
114 return profile == PROFILE_ES1 || profile == PROFILE_ES2;
119 createContext(uintptr_t context_id);
122 retainContext(uintptr_t context_id);
125 releaseContext(uintptr_t context_id);
128 setContext(uintptr_t context_id);
137 _glGetString_override(GLenum name);
140 _glGetIntegerv_override(GLenum pname, GLint *params);
143 _glGetStringi_override(GLenum name, GLuint index);
146 } /* namespace gltrace */
149 #endif /* _GLRETRACE_HPP_ */