Previous 199869 Revisions Next

r31734 Friday 22nd August, 2014 at 11:45:58 UTC by Miodrag Milanović
(OSD BRANCH) Added BGFX library and needed H files for future (nw)
[/branches/osd]makefile
[/branches/osd/src/lib]lib.mak
[/branches/osd/src/lib/bgfx]bgfx.cpp* bgfx_compute.sh* bgfx_p.h* bgfx_shader.sh* charset.h* config.h* fs_clear0.bin.h* fs_clear0.sc* fs_clear1.bin.h* fs_clear1.sc* fs_clear2.bin.h* fs_clear2.sc* fs_clear3.bin.h* fs_clear3.sc* fs_debugfont.bin.h* fs_debugfont.sc* glcontext_eagl.h* glcontext_eagl.mm* glcontext_egl.cpp* glcontext_egl.h* glcontext_glx.cpp* glcontext_glx.h* glcontext_ios.h* glcontext_nsgl.h* glcontext_nsgl.mm* glcontext_ppapi.cpp* glcontext_ppapi.h* glcontext_wgl.cpp* glcontext_wgl.h* glimports.h* image.cpp* image.h* makefile* renderer_d3d.h* renderer_d3d11.cpp* renderer_d3d11.h* renderer_d3d9.cpp* renderer_d3d9.h* renderer_gl.cpp* renderer_gl.h* renderer_null.cpp* varying.def.sc* vertexdecl.cpp* vertexdecl.h* vs_clear.bin.h* vs_clear.sc* vs_debugfont.bin.h* vs_debugfont.sc*
[/branches/osd/src/lib/bgfx/include]bgfx.c99.h* bgfx.h* bgfxdefines.h* bgfxplatform.c99.h* bgfxplatform.h*
[/branches/osd/src/lib/bx]allocator.h* blockalloc.h* bx.h* cl.h* commandline.h* cpu.h* debug.h* endian.h* float4_langext.h* float4_neon.h* float4_ni.h* float4_ref.h* float4_sse.h* float4_swizzle.inl* float4_t.h* float4x4_t.h* foreach.h* fpumath.h* handlealloc.h* hash.h* macros.h* maputil.h* mutex.h* os.h* platform.h* radixsort.h* readerwriter.h* ringbuffer.h* rng.h* sem.h* spscqueue.h* string.h* thread.h* timer.h* tokenizecmd.h* uint32_t.h*
[/branches/osd/src/lib/compat/freebsd]alloca.h* malloc.h*
[/branches/osd/src/lib/compat/ios]malloc.h*
[/branches/osd/src/lib/compat/mingw]alloca.h* dxsdk.patch* sal.h* specstrings_strict.h* specstrings_undef.h*
[/branches/osd/src/lib/compat/msvc]alloca.h* inttypes.h* stdbool.h*
[/branches/osd/src/lib/compat/msvc/pre1600]stdint.h*
[/branches/osd/src/lib/compat/nacl]memory.h*
[/branches/osd/src/lib/compat/osx]malloc.h*
[/branches/osd/src/lib/khronos/EGL]egl.h* eglext.h* eglplatform.h*
[/branches/osd/src/lib/khronos/GLES2]gl2.h* gl2ext.h* gl2platform.h*
[/branches/osd/src/lib/khronos/GLES3]gl3.h* gl31.h* gl3ext.h* gl3platform.h*
[/branches/osd/src/lib/khronos/KHR]khrplatform.h*
[/branches/osd/src/lib/khronos/gl]GRemedyGLExtensions.h* glcorearb.h* glext.h*
[/branches/osd/src/lib/khronos/glx]glxext.h*
[/branches/osd/src/lib/khronos/wgl]wglext.h*
[/branches/osd/src/lib/tinystl]LICENSE* allocator.h* buffer.h* hash.h* hash_base.h* new.h* stddef.h* string.h* traits.h* unordered_map.h* unordered_set.h* vector.h*

branches/osd/src/lib/tinystl/unordered_set.h
r0r31734
1/*-
2 * Copyright 2012 Matthew Endsley
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef TINYSTL_UNORDERED_SET_H
28#define TINYSTL_UNORDERED_SET_H
29
30#include "buffer.h"
31#include "hash.h"
32#include "hash_base.h"
33
34namespace tinystl {
35
36   template<typename Key, typename Alloc = TINYSTL_ALLOCATOR>
37   class unordered_set {
38   public:
39      unordered_set();
40      unordered_set(const unordered_set& other);
41      ~unordered_set();
42
43      unordered_set& operator=(const unordered_set& other);
44
45      typedef unordered_hash_iterator<const unordered_hash_node<Key, void> > const_iterator;
46      typedef const_iterator iterator;
47
48      iterator begin() const;
49      iterator end() const;
50
51      void clear();
52      bool empty() const;
53      size_t size() const;
54
55      iterator find(const Key& key) const;
56      pair<iterator, bool> insert(const Key& key);
57      void erase(iterator where);
58      size_t erase(const Key& key);
59
60      void swap(unordered_set& other);
61
62   private:
63
64      typedef unordered_hash_node<Key, void>* pointer;
65
66      size_t m_size;
67      buffer<pointer, Alloc> m_buckets;
68   };
69
70   template<typename Key, typename Alloc>
71   unordered_set<Key, Alloc>::unordered_set()
72      : m_size(0)
73   {
74      buffer_init<pointer, Alloc>(&m_buckets);
75      buffer_resize<pointer, Alloc>(&m_buckets, 9, 0);
76   }
77
78   template<typename Key, typename Alloc>
79   unordered_set<Key, Alloc>::unordered_set(const unordered_set& other)
80      : m_size(other.m_size)
81   {
82      const size_t nbuckets = (size_t)(other.m_buckets.last - other.m_buckets.first);
83      buffer_init<pointer, Alloc>(&m_buckets);
84      buffer_resize<pointer, Alloc>(&m_buckets, 9, 0);
85
86      for (pointer* it = *other.m_buckets.first; it; it = it->next) {
87         unordered_hash_node<Key, void>* newnode = new(placeholder(), Alloc::static_allocate(sizeof(unordered_hash_node<Key, void>))) unordered_hash_node<Key, void>(*it);
88         newnode->next = newnode->prev = 0;
89         unordered_hash_node_insert(newnode, hash(*it), m_buckets.first, nbuckets - 1);
90      }
91   }
92
93   template<typename Key, typename Alloc>
94   unordered_set<Key, Alloc>::~unordered_set() {
95      clear();
96      buffer_destroy<pointer, Alloc>(&m_buckets);
97   }
98
99   template<typename Key, typename Alloc>
100   unordered_set<Key, Alloc>& unordered_set<Key, Alloc>::operator=(const unordered_set<Key, Alloc>& other) {
101      unordered_set<Key, Alloc>(other).swap(*this);
102      return *this;
103   }
104
105   template<typename Key, typename Alloc>
106   inline typename unordered_set<Key, Alloc>::iterator unordered_set<Key, Alloc>::begin() const {
107      iterator cit;
108      cit.node = *m_buckets.first;
109      return cit;
110   }
111
112   template<typename Key, typename Alloc>
113   inline typename unordered_set<Key, Alloc>::iterator unordered_set<Key, Alloc>::end() const {
114      iterator cit;
115      cit.node = 0;
116      return cit;
117   }
118
119   template<typename Key, typename Alloc>
120   inline bool unordered_set<Key, Alloc>::empty() const {
121      return m_size == 0;
122   }
123
124   template<typename Key, typename Alloc>
125   inline size_t unordered_set<Key, Alloc>::size() const {
126      return m_size;
127   }
128
129   template<typename Key, typename Alloc>
130   inline void unordered_set<Key, Alloc>::clear() {
131      pointer it = *m_buckets.first;
132      while (it) {
133         const pointer next = it->next;
134         it->~unordered_hash_node<Key, void>();
135         Alloc::static_deallocate(it, sizeof(unordered_hash_node<Key, void>));
136
137         it = next;
138      }
139
140      m_buckets.last = m_buckets.first;
141      buffer_resize<pointer, Alloc>(&m_buckets, 9, 0);
142      m_size = 0;
143   }
144
145   template<typename Key, typename Alloc>
146   inline typename unordered_set<Key, Alloc>::iterator unordered_set<Key, Alloc>::find(const Key& key) const {
147      iterator result;
148      result.node = unordered_hash_find(key, m_buckets.first, (size_t)(m_buckets.last - m_buckets.first));
149      return result;
150   }
151
152   template<typename Key, typename Alloc>
153   inline pair<typename unordered_set<Key, Alloc>::iterator, bool> unordered_set<Key, Alloc>::insert(const Key& key) {
154      pair<iterator, bool> result;
155      result.second = false;
156
157      result.first = find(key);
158      if (result.first.node != 0)
159         return result;
160
161      unordered_hash_node<Key, void>* newnode = new(placeholder(), Alloc::static_allocate(sizeof(unordered_hash_node<Key, void>))) unordered_hash_node<Key, void>(key);
162      newnode->next = newnode->prev = 0;
163
164      const size_t nbuckets = (size_t)(m_buckets.last - m_buckets.first);
165      unordered_hash_node_insert(newnode, hash(key), m_buckets.first, nbuckets - 1);
166
167      ++m_size;
168      if (m_size + 1 > 4 * nbuckets) {
169         pointer root = *m_buckets.first;
170
171         const size_t newnbuckets = ((size_t)(m_buckets.last - m_buckets.first) - 1) * 8;
172         m_buckets.last = m_buckets.first;
173         buffer_resize<pointer, Alloc>(&m_buckets, newnbuckets + 1, 0);
174         unordered_hash_node<Key, void>** buckets = m_buckets.first;
175
176         while (root) {
177            const pointer next = root->next;
178            root->next = root->prev = 0;
179            unordered_hash_node_insert(root, hash(root->first), buckets, newnbuckets);
180            root = next;
181         }
182      }
183
184      result.first.node = newnode;
185      result.second = true;
186      return result;
187   }
188
189   template<typename Key, typename Alloc>
190   inline void unordered_set<Key, Alloc>::erase(iterator where) {
191      unordered_hash_node_erase(where.node, hash(where.node->first), m_buckets.first, (size_t)(m_buckets.last - m_buckets.first) - 1);
192
193      where.node->~unordered_hash_node<Key, void>();
194      Alloc::static_deallocate((void*)where.node, sizeof(unordered_hash_node<Key, void>));
195      --m_size;
196   }
197
198   template<typename Key, typename Alloc>
199   inline size_t unordered_set<Key, Alloc>::erase(const Key& key) {
200      const iterator it = find(key);
201      if (it.node == 0)
202         return 0;
203
204      erase(it);
205      return 1;
206   }
207
208   template <typename Key, typename Alloc>
209   void unordered_set<Key, Alloc>::swap(unordered_set& other) {
210      size_t tsize = other.m_size;
211      other.m_size = m_size, m_size = tsize;
212      buffer_swap(&m_buckets, &other.m_buckets);
213   }
214}
215#endif
Property changes on: branches/osd/src/lib/tinystl/unordered_set.h
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
branches/osd/src/lib/tinystl/vector.h
r0r31734
1/*-
2 * Copyright 2012 Matthew Endsley
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef TINYSTL_VECTOR_H
28#define TINYSTL_VECTOR_H
29
30#include "buffer.h"
31#include "new.h"
32#include "stddef.h"
33
34namespace tinystl {
35
36   template<typename T, typename Alloc = TINYSTL_ALLOCATOR>
37   class vector {
38   public:
39      vector();
40      vector(const vector& other);
41      vector(size_t size);
42      vector(size_t size, const T& value);
43      vector(const T* first, const T* last);
44      ~vector();
45
46      vector& operator=(const vector& other);
47
48      void assign(const T* first, const T* last);
49
50      const T* data() const;
51      T* data();
52      size_t size() const;
53      bool empty() const;
54
55      T& operator[](size_t idx);
56      const T& operator[](size_t idx) const;
57
58      const T& back() const;
59      T& back();
60
61      void resize(size_t size);
62      void resize(size_t size, const T& value);
63      void clear();
64      void reserve(size_t capacity);
65
66      void push_back(const T& t);
67      void pop_back();
68
69      void swap(vector& other);
70
71      typedef T value_type;
72
73      typedef T* iterator;
74      iterator begin();
75      iterator end();
76
77      typedef const T* const_iterator;
78      const_iterator begin() const;
79      const_iterator end() const;
80
81      void insert(iterator where, const T& value);
82      void insert(iterator where, const T* first, const T* last);
83
84      iterator erase(iterator where);
85      iterator erase(iterator first, iterator last);
86
87      iterator erase_unordered(iterator where);
88      iterator erase_unordered(iterator first, iterator last);
89
90   private:
91      buffer<T, Alloc> m_buffer;
92   };
93
94   template<typename T, typename Alloc>
95   inline vector<T, Alloc>::vector() {
96      buffer_init(&m_buffer);
97   }
98
99   template<typename T, typename Alloc>
100   inline vector<T, Alloc>::vector(const vector& other) {
101      buffer_init(&m_buffer);
102      buffer_reserve(&m_buffer, other.size());
103      buffer_insert(&m_buffer, m_buffer.last, other.m_buffer.first, other.m_buffer.last);
104   }
105
106   template<typename T, typename Alloc>
107   inline vector<T, Alloc>::vector(size_t size) {
108      buffer_init(&m_buffer);
109      buffer_resize(&m_buffer, size, T());
110   }
111
112   template<typename T, typename Alloc>
113   inline vector<T, Alloc>::vector(size_t size, const T& value) {
114      buffer_init(&m_buffer);
115      buffer_resize(&m_buffer, size, value);
116   }
117
118   template<typename T, typename Alloc>
119   inline vector<T, Alloc>::vector(const T* first, const T* last) {
120      buffer_init(&m_buffer);
121      buffer_insert(&m_buffer, m_buffer.last, first, last);
122   }
123
124   template<typename T, typename Alloc>
125   inline vector<T, Alloc>::~vector() {
126      buffer_destroy(&m_buffer);
127   }
128
129   template<typename T, typename Alloc>
130   inline vector<T, Alloc>& vector<T, Alloc>::operator=(const vector& other) {
131      vector(other).swap(*this);
132      return *this;
133   }
134
135   template<typename T, typename Alloc>
136   inline void vector<T, Alloc>::assign(const T* first, const T* last) {
137      buffer_clear(&m_buffer);
138      buffer_insert(&m_buffer, m_buffer.last, first, last);
139   }
140
141   template<typename T, typename Alloc>
142   inline const T* vector<T, Alloc>::data() const {
143      return m_buffer.first;
144   }
145
146   template<typename T, typename Alloc>
147   inline T* vector<T, Alloc>::data() {
148      return m_buffer.first;
149   }
150
151   template<typename T, typename Alloc>
152   inline size_t vector<T, Alloc>::size() const {
153      return (size_t)(m_buffer.last - m_buffer.first);
154   }
155
156   template<typename T, typename Alloc>
157   inline bool vector<T, Alloc>::empty() const {
158      return m_buffer.last == m_buffer.first;
159   }
160
161   template<typename T, typename Alloc>
162   inline T& vector<T, Alloc>::operator[](size_t idx) {
163      return m_buffer.first[idx];
164   }
165
166   template<typename T, typename Alloc>
167   inline const T& vector<T, Alloc>::operator[](size_t idx) const {
168      return m_buffer.first[idx];
169   }
170
171   template<typename T, typename Alloc>
172   inline const T& vector<T, Alloc>::back() const {
173      return m_buffer.last[-1];
174   }
175
176   template<typename T, typename Alloc>
177   inline T& vector<T, Alloc>::back() {
178      return m_buffer.last[-1];
179   }
180
181   template<typename T, typename Alloc>
182   inline void vector<T, Alloc>::resize(size_t size) {
183      buffer_resize(&m_buffer, size, T());
184   }
185
186   template<typename T, typename Alloc>
187   inline void vector<T, Alloc>::resize(size_t size, const T& value) {
188      buffer_resize(&m_buffer, size, value);
189   }
190
191   template<typename T, typename Alloc>
192   inline void vector<T, Alloc>::clear() {
193      buffer_clear(&m_buffer);
194   }
195
196   template<typename T, typename Alloc>
197   inline void vector<T, Alloc>::reserve(size_t capacity) {
198      buffer_reserve(&m_buffer, capacity);
199   }
200
201   template<typename T, typename Alloc>
202   inline void vector<T, Alloc>::push_back(const T& t) {
203      buffer_insert(&m_buffer, m_buffer.last, &t, &t + 1);
204   }
205
206   template<typename T, typename Alloc>
207   inline void vector<T, Alloc>::pop_back() {
208      buffer_erase(&m_buffer, m_buffer.last - 1, m_buffer.last);
209   }
210
211   template<typename T, typename Alloc>
212   inline void vector<T, Alloc>::swap(vector& other) {
213      buffer_swap(&m_buffer, &other.m_buffer);
214   }
215
216   template<typename T, typename Alloc>
217   inline typename vector<T, Alloc>::iterator vector<T,Alloc>::begin() {
218      return m_buffer.first;
219   }
220
221   template<typename T, typename Alloc>
222   inline typename vector<T, Alloc>::iterator vector<T,Alloc>::end() {
223      return m_buffer.last;
224   }
225
226   template<typename T, typename Alloc>
227   inline typename vector<T, Alloc>::const_iterator vector<T,Alloc>::begin() const {
228      return m_buffer.first;
229   }
230
231   template<typename T, typename Alloc>
232   inline typename vector<T, Alloc>::const_iterator vector<T,Alloc>::end() const {
233      return m_buffer.last;
234   }
235
236   template<typename T, typename Alloc>
237   inline void vector<T, Alloc>::insert(iterator where, const T& value) {
238      buffer_insert(&m_buffer, where, &value, &value + 1);
239   }
240
241   template<typename T, typename Alloc>
242   inline void vector<T, Alloc>::insert(iterator where, const T* first, const T* last) {
243      buffer_insert(&m_buffer, where, first, last);
244   }
245
246   template<typename T, typename Alloc>
247   inline typename vector<T, Alloc>::iterator vector<T, Alloc>::erase(iterator where) {
248      return buffer_erase(&m_buffer, where, where + 1);
249   }
250
251   template<typename T, typename Alloc>
252   inline typename vector<T, Alloc>::iterator vector<T, Alloc>::erase(iterator first, iterator last) {
253      return buffer_erase(&m_buffer, first, last);
254   }
255
256   template<typename T, typename Alloc>
257   inline typename vector<T, Alloc>::iterator vector<T, Alloc>::erase_unordered(iterator where) {
258      return buffer_erase_unordered(&m_buffer, where, where + 1);
259   }
260
261   template<typename T, typename Alloc>
262   inline typename vector<T, Alloc>::iterator vector<T, Alloc>::erase_unordered(iterator first, iterator last) {
263      return buffer_erase_unordered(&m_buffer, first, last);
264   }
265}
266
267#endif
Property changes on: branches/osd/src/lib/tinystl/vector.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/tinystl/hash.h
r0r31734
1/*-
2 * Copyright 2012 Matthew Endsley
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef TINYSTL_STRINGHASH_H
28#define TINYSTL_STRINGHASH_H
29
30#include "stddef.h"
31
32namespace tinystl {
33
34   static inline size_t hash_string(const char* str, size_t len) {
35      // Implementation of sdbm a public domain string hash from Ozan Yigit
36      // see: http://www.eecs.harvard.edu/margo/papers/usenix91/paper.ps
37
38      size_t hash = 0;
39      typedef const char* pointer;
40      for (pointer it = str, end = str + len; it != end; ++it)
41         hash = *it + (hash << 6) + (hash << 16) - hash;
42
43      return hash;
44   }
45
46   template<typename T>
47   inline size_t hash(const T& value) {
48      const size_t asint = (size_t)value;
49      return hash_string((const char*)&asint, sizeof(asint));
50   }
51}
52
53#endif
Property changes on: branches/osd/src/lib/tinystl/hash.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/tinystl/unordered_map.h
r0r31734
1/*-
2 * Copyright 2012 Matthew Endsley
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef TINYSTL_UNORDERED_MAP_H
28#define TINYSTL_UNORDERED_MAP_H
29
30#include "buffer.h"
31#include "hash.h"
32#include "hash_base.h"
33
34namespace tinystl {
35
36   template<typename Key, typename Value, typename Alloc = TINYSTL_ALLOCATOR>
37   class unordered_map {
38   public:
39      unordered_map();
40      unordered_map(const unordered_map& other);
41      ~unordered_map();
42
43      unordered_map& operator=(const unordered_map& other);
44
45
46      typedef pair<Key, Value> value_type;
47     
48      typedef unordered_hash_iterator<const unordered_hash_node<Key, Value> > const_iterator;
49      typedef unordered_hash_iterator<unordered_hash_node<Key, Value> > iterator;
50
51      iterator begin();
52      iterator end();
53
54      const_iterator begin() const;
55      const_iterator end() const;
56
57      void clear();
58      bool empty() const;
59      size_t size() const;
60
61      const_iterator find(const Key& key) const;
62      iterator find(const Key& key);
63      pair<iterator, bool> insert(const pair<Key, Value>& p);
64      void erase(const_iterator where);
65
66      Value& operator[](const Key& key);
67
68      void swap(unordered_map& other);
69
70   private:
71
72      typedef unordered_hash_node<Key, Value>* pointer;
73
74      size_t m_size;
75      buffer<pointer, Alloc> m_buckets;
76   };
77
78   template<typename Key, typename Value, typename Alloc>
79   unordered_map<Key, Value, Alloc>::unordered_map()
80      : m_size(0)
81   {
82      buffer_init<pointer, Alloc>(&m_buckets);
83      buffer_resize<pointer, Alloc>(&m_buckets, 9, 0);
84   }
85
86   template<typename Key, typename Value, typename Alloc>
87   unordered_map<Key, Value, Alloc>::unordered_map(const unordered_map& other)
88      : m_size(other.m_size)
89   {
90      const size_t nbuckets = (size_t)(other.m_buckets.last - other.m_buckets.first);
91      buffer_init<pointer, Alloc>(&m_buckets);
92      buffer_resize<pointer, Alloc>(&m_buckets, nbuckets, 0);
93
94      for (pointer it = *other.m_buckets.first; it; it = it->next) {
95         unordered_hash_node<Key, Value>* newnode = new(placeholder(), Alloc::static_allocate(sizeof(unordered_hash_node<Key, Value>))) unordered_hash_node<Key, Value>(it->first, it->second);
96         newnode->next = newnode->prev = 0;
97
98         unordered_hash_node_insert(newnode, hash(it->first), m_buckets.first, nbuckets - 1);
99      }
100   }
101
102   template<typename Key, typename Value, typename Alloc>
103   unordered_map<Key, Value, Alloc>::~unordered_map() {
104      clear();
105      buffer_destroy<pointer, Alloc>(&m_buckets);
106   }
107
108   template<typename Key, typename Value, typename Alloc>
109   unordered_map<Key, Value, Alloc>& unordered_map<Key, Value, Alloc>::operator=(const unordered_map<Key, Value, Alloc>& other) {
110      unordered_map<Key, Value, Alloc>(other).swap(*this);
111      return *this;
112   }
113
114   template<typename Key, typename Value, typename Alloc>
115   inline typename unordered_map<Key, Value, Alloc>::iterator unordered_map<Key, Value, Alloc>::begin() {
116      iterator it;
117      it.node = *m_buckets.first;
118      return it;
119   }
120
121   template<typename Key, typename Value, typename Alloc>
122   inline typename unordered_map<Key, Value, Alloc>::iterator unordered_map<Key, Value, Alloc>::end() {
123      iterator it;
124      it.node = 0;
125      return it;
126   }
127
128   template<typename Key, typename Value, typename Alloc>
129   inline typename unordered_map<Key, Value, Alloc>::const_iterator unordered_map<Key, Value, Alloc>::begin() const {
130      const_iterator cit;
131      cit.node = *m_buckets.first;
132      return cit;
133   }
134
135   template<typename Key, typename Value, typename Alloc>
136   inline typename unordered_map<Key, Value, Alloc>::const_iterator unordered_map<Key, Value, Alloc>::end() const {
137      const_iterator cit;
138      cit.node = 0;
139      return cit;
140   }
141
142   template<typename Key, typename Value, typename Alloc>
143   inline bool unordered_map<Key, Value, Alloc>::empty() const {
144      return m_size == 0;
145   }
146
147   template<typename Key, typename Value, typename Alloc>
148   inline size_t unordered_map<Key, Value, Alloc>::size() const {
149      return m_size;
150   }
151
152   template<typename Key, typename Value, typename Alloc>
153   inline void unordered_map<Key, Value, Alloc>::clear() {
154      pointer it = *m_buckets.first;
155      while (it) {
156         const pointer next = it->next;
157         it->~unordered_hash_node<Key, Value>();
158         Alloc::static_deallocate(it, sizeof(unordered_hash_node<Key, Value>));
159
160         it = next;
161      }
162
163      m_buckets.last = m_buckets.first;
164      buffer_resize<pointer, Alloc>(&m_buckets, 9, 0);
165      m_size = 0;
166   }
167
168   template<typename Key, typename Value, typename Alloc>
169   inline typename unordered_map<Key, Value, Alloc>::iterator unordered_map<Key, Value, Alloc>::find(const Key& key) {
170      iterator result;
171      result.node = unordered_hash_find(key, m_buckets.first, (size_t)(m_buckets.last - m_buckets.first));
172      return result;
173   }
174
175   template<typename Key, typename Value, typename Alloc>
176   inline typename unordered_map<Key, Value, Alloc>::const_iterator unordered_map<Key, Value, Alloc>::find(const Key& key) const {
177      iterator result;
178      result.node = unordered_hash_find(key, m_buckets.first, (size_t)(m_buckets.last - m_buckets.first));
179      return result;
180   }
181
182   template<typename Key, typename Value, typename Alloc>
183   inline pair<typename unordered_map<Key, Value, Alloc>::iterator, bool> unordered_map<Key, Value, Alloc>::insert(const pair<Key, Value>& p) {
184      pair<iterator, bool> result;
185      result.second = false;
186
187      result.first = find(p.first);
188      if (result.first.node != 0)
189         return result;
190     
191      unordered_hash_node<Key, Value>* newnode = new(placeholder(), Alloc::static_allocate(sizeof(unordered_hash_node<Key, Value>))) unordered_hash_node<Key, Value>(p.first, p.second);
192      newnode->next = newnode->prev = 0;
193
194      const size_t nbuckets = (size_t)(m_buckets.last - m_buckets.first);
195      unordered_hash_node_insert(newnode, hash(p.first), m_buckets.first, nbuckets - 1);
196
197      ++m_size;
198      if (m_size + 1 > 4 * nbuckets) {
199         pointer root = *m_buckets.first;
200         
201         const size_t newnbuckets = ((size_t)(m_buckets.last - m_buckets.first) - 1) * 8;
202         m_buckets.last = m_buckets.first;
203         buffer_resize<pointer, Alloc>(&m_buckets, newnbuckets + 1, 0);
204         unordered_hash_node<Key, Value>** buckets = m_buckets.first;
205
206         while (root) {
207            const pointer next = root->next;
208            root->next = root->prev = 0;
209            unordered_hash_node_insert(root, hash(root->first), buckets, newnbuckets);
210            root = next;
211         }
212      }
213
214      result.first.node = newnode;
215      result.second = true;
216      return result;
217   }
218
219   template<typename Key, typename Value, typename Alloc>
220   void unordered_map<Key, Value, Alloc>::erase(const_iterator where) {
221      unordered_hash_node_erase(where.node, hash(where->first), m_buckets.first, (size_t)(m_buckets.last - m_buckets.first) - 1);
222
223      where->~unordered_hash_node<Key, Value>();
224      Alloc::static_deallocate((void*)where.node, sizeof(unordered_hash_node<Key, Value>));
225      --m_size;
226   }
227
228   template<typename Key, typename Value, typename Alloc>
229   Value& unordered_map<Key, Value, Alloc>::operator[](const Key& key) {
230      return insert(pair<Key, Value>(key, Value())).first->second;
231   }
232
233   template<typename Key, typename Value, typename Alloc>
234   void unordered_map<Key, Value, Alloc>::swap(unordered_map& other) {
235      size_t tsize = other.m_size;
236      other.m_size = m_size, m_size = tsize;
237      buffer_swap(&m_buckets, &other.m_buckets);
238   }
239}
240#endif
Property changes on: branches/osd/src/lib/tinystl/unordered_map.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/tinystl/string.h
r0r31734
1/*-
2 * Copyright 2012 Matthew Endsley
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef TINYSTL_STRING_H
28#define TINYSTL_STRING_H
29
30#include "stddef.h"
31#include "hash.h"
32
33namespace tinystl {
34
35   template<typename Alloc>
36   class stringT {
37   public:
38      stringT();
39      stringT(const stringT<Alloc>& other);
40      stringT(const char* sz);
41      stringT(const char* sz, size_t len);
42      ~stringT();
43
44      stringT<Alloc>& operator=(const stringT<Alloc>& other);
45
46      const char* c_str() const;
47      size_t size() const;
48      bool empty() const;
49
50      void reserve(size_t size);
51      void resize(size_t size);
52
53      void append(const char* first, const char* last);
54      void append(const char* str);
55
56      void swap(stringT<Alloc>& other);
57
58   private:
59      typedef char* pointer;
60      pointer m_first;
61      pointer m_last;
62      pointer m_capacity;
63
64      static const size_t c_nbuffer = 12;
65      char m_buffer[12];
66   };
67
68   typedef stringT<TINYSTL_ALLOCATOR> string;
69
70   template<typename Alloc>
71   inline stringT<Alloc>::stringT()
72      : m_first(m_buffer)
73      , m_last(m_buffer)
74      , m_capacity(m_buffer + c_nbuffer)
75   {
76      resize(0);
77   }
78
79   template<typename Alloc>
80   inline stringT<Alloc>::stringT(const stringT<Alloc>& other)
81      : m_first(m_buffer)
82      , m_last(m_buffer)
83      , m_capacity(m_buffer + c_nbuffer)
84   {
85      reserve(other.size());
86      append(other.m_first, other.m_last);
87   }
88
89   template<typename Alloc>
90   inline stringT<Alloc>::stringT(const char* sz)
91      : m_first(m_buffer)
92      , m_last(m_buffer)
93      , m_capacity(m_buffer + c_nbuffer)
94   {
95      size_t len = 0;
96      for (const char* it = sz; *it; ++it)
97         ++len;
98
99      reserve(len);
100      append(sz, sz + len);
101   }
102
103   template<typename Alloc>
104   inline stringT<Alloc>::stringT(const char* sz, size_t len)
105      : m_first(m_buffer)
106      , m_last(m_buffer)
107      , m_capacity(m_buffer + c_nbuffer)
108   {
109      reserve(len);
110      append(sz, sz + len);
111   }
112
113   template<typename Alloc>
114   inline stringT<Alloc>::~stringT() {
115      if (m_first != m_buffer)
116         Alloc::static_deallocate(m_first, m_capacity - m_first);
117   }
118
119   template<typename Alloc>
120   inline stringT<Alloc>& stringT<Alloc>::operator=(const stringT<Alloc>& other) {
121      stringT<Alloc>(other).swap(*this);
122      return *this;
123   }
124
125   template<typename Alloc>
126   inline const char* stringT<Alloc>::c_str() const {
127      return m_first;
128   }
129
130   template<typename Alloc>
131   inline size_t stringT<Alloc>::size() const
132   {
133      return (size_t)(m_last - m_first);
134   }
135
136   template<typename Alloc>
137   inline bool stringT<Alloc>::empty() const
138   {
139      return 0 == size();
140   }
141
142   template<typename Alloc>
143   inline void stringT<Alloc>::reserve(size_t capacity) {
144      if (m_first + capacity + 1 <= m_capacity) {
145         return;
146      }
147
148      const size_t size = (size_t)(m_last - m_first);
149
150      pointer newfirst = (pointer)Alloc::static_allocate(capacity + 1);
151      for (pointer it = m_first, newit = newfirst, end = m_last; it != end; ++it, ++newit) {
152         *newit = *it;
153      }
154
155      if (m_first != m_buffer) {
156         Alloc::static_deallocate(m_first, m_capacity - m_first);
157      }
158
159      m_first = newfirst;
160      m_last = newfirst + size;
161      m_capacity = m_first + capacity;
162   }
163
164   template<typename Alloc>
165   inline void stringT<Alloc>::resize(size_t size) {
166      reserve(size);
167      for (pointer it = m_last, end = m_first + size + 1; it < end; ++it)
168         *it = 0;
169
170      m_last += size;
171   }
172
173   template<typename Alloc>
174   inline void stringT<Alloc>::append(const char* first, const char* last) {
175      const size_t newsize = (size_t)((m_last - m_first) + (last - first) + 1);
176      if (m_first + newsize > m_capacity)
177         reserve((newsize * 3) / 2);
178
179      for (; first != last; ++m_last, ++first)
180         *m_last = *first;
181      *m_last = 0;
182   }
183
184   template<typename Alloc>
185   inline void stringT<Alloc>::append(const char* str) {
186      append(str, str + strlen(str) );
187   }
188
189   template<typename Alloc>
190   inline void stringT<Alloc>::swap(stringT<Alloc>& other) {
191      const pointer tfirst = m_first, tlast = m_last, tcapacity = m_capacity;
192      m_first = other.m_first, m_last = other.m_last, m_capacity = other.m_capacity;
193      other.m_first = tfirst, other.m_last = tlast, other.m_capacity = tcapacity;
194
195      char tbuffer[c_nbuffer];
196
197      if (m_first == other.m_buffer)
198         for  (pointer it = other.m_buffer, end = m_last, out = tbuffer; it != end; ++it, ++out)
199            *out = *it;
200
201      if (other.m_first == m_buffer) {
202         other.m_last = other.m_last - other.m_first + other.m_buffer;
203         other.m_first = other.m_buffer;
204         other.m_capacity = other.m_buffer + c_nbuffer;
205
206         for (pointer it = other.m_first, end = other.m_last, in = m_buffer; it != end; ++it, ++in)
207            *it = *in;
208         *other.m_last = 0;
209      }
210
211      if (m_first == other.m_buffer) {
212         m_last = m_last - m_first + m_buffer;
213         m_first = m_buffer;
214         m_capacity = m_buffer + c_nbuffer;
215
216         for (pointer it = m_first, end = m_last, in = tbuffer; it != end; ++it, ++in)
217            *it = *in;
218         *m_last = 0;
219      }
220   }
221
222   template<typename Alloc>
223   inline bool operator==(const stringT<Alloc>& lhs, const stringT<Alloc>& rhs) {
224      typedef const char* pointer;
225
226      const size_t lsize = lhs.size(), rsize = rhs.size();
227      if (lsize != rsize)
228         return false;
229
230      pointer lit = lhs.c_str(), rit = rhs.c_str();
231      pointer lend = lit + lsize;
232      while (lit != lend)
233         if (*lit++ != *rit++)
234            return false;
235
236      return true;
237   }
238
239   template<typename Alloc>
240   static inline size_t hash(const stringT<Alloc>& value) {
241      return hash_string(value.c_str(), value.size());
242   }
243}
244
245#endif
Property changes on: branches/osd/src/lib/tinystl/string.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/tinystl/traits.h
r0r31734
1/*-
2 * Copyright 2012 Matthew Endsley
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef TINYSTL_TRAITS_H
28#define TINYSTL_TRAITS_H
29
30#include "new.h"
31
32#if defined(__GNUC__) && defined(__is_pod)
33#   define TINYSTL_TRY_POD_OPTIMIZATION(t) __is_pod(t)
34#elif defined(_MSC_VER)
35#   define TINYSTL_TRY_POD_OPTIMIZATION(t) (!__is_class(t) || __is_pod(t))
36#else
37#   define TINYSTL_TRY_POD_OPTIMIZATION(t) false
38#endif
39
40namespace tinystl {
41   template<typename T, bool pod = TINYSTL_TRY_POD_OPTIMIZATION(T)> struct pod_traits {};
42
43   template<typename T, T t> struct swap_holder;
44
45   template<typename T>
46   static inline void move_impl(T& a, T& b, ...) {
47      a = b;
48   }
49
50   template<typename T>
51   static inline void move_impl(T& a, T& b, T*, swap_holder<void (T::*)(T&), &T::swap>* = 0) {
52      a.swap(b);
53   }
54
55   template<typename T>
56   static inline void move(T& a, T&b) {
57      move_impl(a, b, (T*)0);
58   }
59
60   template<typename T>
61   static inline void move_construct_impl(T* a, T& b, ...) {
62      new(placeholder(), a) T(b);
63   }
64
65   template<typename T>
66   static inline void move_construct_impl(T* a, T& b, void*, swap_holder<void (T::*)(T&), &T::swap>* = 0) {
67      // If your type T does not have a default constructor, simply insert:
68      // struct tinystl_nomove_construct;
69      // in the class definition
70      new(placeholder(), a) T;
71      a->swap(b);
72   }
73
74   template<typename T>
75   static inline void move_construct_impl(T* a, T& b, T*, typename T::tinystl_nomove_construct* = 0) {
76      new(placeholder(), a) T(b);
77   }
78
79   template<typename T>
80   static inline void move_construct(T* a, T& b) {
81      move_construct_impl(a, b, (T*)0);
82   }
83}
84
85#endif
Property changes on: branches/osd/src/lib/tinystl/traits.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/tinystl/buffer.h
r0r31734
1/*-
2 * Copyright 2012 Matthew Endsley
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef TINYSTL_BUFFER_H
28#define TINYSTL_BUFFER_H
29
30#include "new.h"
31#include "traits.h"
32
33namespace tinystl {
34
35   template<typename T, typename Alloc = TINYSTL_ALLOCATOR>
36   struct buffer {
37      T* first;
38      T* last;
39      T* capacity;
40   };
41
42   template<typename T>
43   static inline void buffer_destroy_range_traits(T* first, T* last, pod_traits<T, false>) {
44      for (; first < last; ++first)
45         first->~T();
46   }
47
48   template<typename T>
49   static inline void buffer_destroy_range_traits(T*, T*, pod_traits<T, true>) {
50   }
51
52   template<typename T>
53   static inline void buffer_destroy_range(T* first, T* last) {
54      buffer_destroy_range_traits(first, last, pod_traits<T>());
55   }
56
57   template<typename T>
58   static inline void buffer_fill_urange_traits(T* first, T* last, const T& value, pod_traits<T, false>) {
59      for (; first < last; ++first)
60         new(placeholder(), first) T(value);
61   }
62
63   template<typename T>
64   static inline void buffer_fill_urange_traits(T* first, T* last, const T& value, pod_traits<T, true>) {
65      for (; first < last; ++first)
66         *first = value;
67   }
68
69   template<typename T>
70   static inline void buffer_move_urange_traits(T* dest, T* first, T* last, pod_traits<T, false>) {
71      for (T* it = first; it != last; ++it, ++dest)
72         move_construct(dest, *it);
73      buffer_destroy_range(first, last);
74   }
75
76   template<typename T>
77   static inline void buffer_move_urange_traits(T* dest, T* first, T* last, pod_traits<T, true>) {
78      for (; first != last; ++first, ++dest)
79         *dest = *first;
80   }
81
82   template<typename T>
83   static inline void buffer_bmove_urange_traits(T* dest, T* first, T* last, pod_traits<T, false>) {
84      dest += (last - first);
85      for (T* it = last; it != first; --it, --dest) {
86         move_construct(dest - 1, *(it - 1));
87         buffer_destroy_range(it - 1, it);
88      }
89   }
90
91   template<typename T>
92   static inline void buffer_bmove_urange_traits(T* dest, T* first, T* last, pod_traits<T, true>) {
93      dest += (last - first);
94      for (T* it = last; it != first; --it, --dest)
95         *(dest - 1) = *(it - 1);
96   }
97
98   template<typename T>
99   static inline void buffer_move_urange(T* dest, T* first, T* last) {
100      buffer_move_urange_traits(dest, first, last, pod_traits<T>());
101   }
102
103   template<typename T>
104   static inline void buffer_bmove_urange(T* dest, T* first, T* last) {
105      buffer_bmove_urange_traits(dest, first, last, pod_traits<T>());
106   }
107
108   template<typename T>
109   static inline void buffer_fill_urange(T* first, T* last, const T& value) {
110      buffer_fill_urange_traits(first, last, value, pod_traits<T>());
111   }
112
113   template<typename T, typename Alloc>
114   static inline void buffer_init(buffer<T, Alloc>* b) {
115      b->first = b->last = b->capacity = 0;
116   }
117
118   template<typename T, typename Alloc>
119   static inline void buffer_destroy(buffer<T, Alloc>* b) {
120      buffer_destroy_range(b->first, b->last);
121      Alloc::static_deallocate(b->first, (size_t)((char*)b->first - (char*)b->last));
122   }
123
124   template<typename T, typename Alloc>
125   static inline void buffer_reserve(buffer<T, Alloc>* b, size_t capacity) {
126      if (b->first + capacity <= b->capacity)
127         return;
128
129      typedef T* pointer;
130      const size_t size = (size_t)(b->last - b->first);
131      pointer newfirst = (pointer)Alloc::static_allocate(sizeof(T) * capacity);
132      buffer_move_urange(newfirst, b->first, b->last);
133      Alloc::static_deallocate(b->first, sizeof(T) * capacity);
134
135      b->first = newfirst;
136      b->last = newfirst + size;
137      b->capacity = newfirst + capacity;
138   }
139
140   template<typename T, typename Alloc>
141   static inline void buffer_resize(buffer<T, Alloc>* b, size_t size, const T& value) {
142      buffer_reserve(b, size);
143
144      buffer_fill_urange(b->last, b->first + size, value);
145      buffer_destroy_range(b->first + size, b->last);
146      b->last = b->first + size;
147   }
148
149   template<typename T, typename Alloc>
150   static inline void buffer_clear(buffer<T, Alloc>* b) {
151      buffer_destroy_range(b->first, b->last);
152      b->last = b->first;
153   }
154
155   template<typename T, typename Alloc>
156   static inline void buffer_insert(buffer<T, Alloc>* b, T* where, const T* first, const T* last) {
157      const size_t offset = (size_t)(where - b->first);
158      const size_t newsize = (size_t)((b->last - b->first) + (last - first));
159      if (b->first + newsize > b->capacity)
160         buffer_reserve(b, (newsize * 3) / 2);
161
162      where = b->first + offset;
163      const size_t count = (size_t)(last - first);
164
165      if (where != b->last)
166         buffer_bmove_urange(where + count, where, b->last);
167
168      for (; first != last; ++first, ++where)
169         new(placeholder(), where) T(*first);
170
171      b->last = b->first + newsize;
172   }
173
174   template<typename T, typename Alloc>
175   static inline T* buffer_erase(buffer<T, Alloc>* b, T* first, T* last) {
176      typedef T* pointer;
177      const size_t range = (last - first);
178      for (pointer it = last, end = b->last, dest = first; it != end; ++it, ++dest)
179         move(*dest, *it);
180
181      buffer_destroy_range(b->last - range, b->last);
182
183      b->last -= range;
184      return first;
185   }
186
187   template<typename T, typename Alloc>
188   static inline T* buffer_erase_unordered(buffer<T, Alloc>* b, T* first, T* last) {
189      typedef T* pointer;
190      const size_t range = (last - first);
191      const size_t tail = (b->last - last);
192      pointer it = b->last - ((range < tail) ? range : tail);
193      for (pointer end = b->last, dest = first; it != end; ++it, ++dest)
194         move(*dest, *it);
195
196      buffer_destroy_range(b->last - range, b->last);
197
198      b->last -= range;
199      return first;
200   }
201
202   template<typename T, typename Alloc>
203   static inline void buffer_swap(buffer<T, Alloc>* b, buffer<T, Alloc>* other) {
204      typedef T* pointer;
205      const pointer tfirst = b->first, tlast = b->last, tcapacity = b->capacity;
206      b->first = other->first, b->last = other->last, b->capacity = other->capacity;
207      other->first = tfirst, other->last = tlast, other->capacity = tcapacity;
208   }
209}
210
211#endif
Property changes on: branches/osd/src/lib/tinystl/buffer.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/tinystl/new.h
r0r31734
1/*-
2 * Copyright 2012 Matthew Endsley
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef TINYSTL_NEW_H
28#define TINYSTL_NEW_H
29
30#include "stddef.h"
31
32namespace tinystl {
33
34   struct placeholder {};
35}
36
37inline void* operator new(size_t, tinystl::placeholder, void* ptr) {
38   return ptr;
39}
40
41inline void operator delete(void*, tinystl::placeholder, void*) throw() {}
42
43#endif
Property changes on: branches/osd/src/lib/tinystl/new.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/tinystl/stddef.h
r0r31734
1/*-
2 * Copyright 2012 Matthew Endsley
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef TINYSTL_STDDEF_H
28#define TINYSTL_STDDEF_H
29
30#if defined(_WIN64)
31   typedef long long unsigned int size_t;
32#elif defined(_WIN32)
33   typedef unsigned int size_t;
34#elif defined (__linux__) && defined(__SIZE_TYPE__)
35   typedef __SIZE_TYPE__ size_t;
36#else
37#   include <stddef.h>
38#endif
39
40#endif
Property changes on: branches/osd/src/lib/tinystl/stddef.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/tinystl/LICENSE
r0r31734
1 Copyright 2012 Matthew Endsley
2 All rights reserved
3
4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted providing that the following conditions
6 are met:
7 1. Redistributions of source code must retain the above copyright
8    notice, this list of conditions and the following disclaimer.
9 2. Redistributions in binary form must reproduce the above copyright
10    notice, this list of conditions and the following disclaimer in the
11    documentation and/or other materials provided with the distribution.
12
13 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
17 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21 STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
22 IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 POSSIBILITY OF SUCH DAMAGE.
Property changes on: branches/osd/src/lib/tinystl/LICENSE
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/tinystl/hash_base.h
r0r31734
1/*-
2 * Copyright 2012 Matthew Endsley
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef TINYSTL_HASH_BASE_H
28#define TINYSTL_HASH_BASE_H
29
30#include "stddef.h"
31
32namespace tinystl {
33
34   template<typename Key, typename Value>
35   struct pair {
36      pair();
37      pair(const Key& key, const Value& value);
38
39      Key first;
40      Value second;
41   };
42
43   template<typename Key, typename Value>
44   pair<Key, Value>::pair() {
45   }
46
47   template<typename Key, typename Value>
48   pair<Key, Value>::pair(const Key& key, const Value& value)
49      : first(key)
50      , second(value)
51   {
52   }
53
54   template<typename Key, typename Value>
55   static inline pair<Key, Value> make_pair(const Key& key, const Value& value) {
56      return pair<Key, Value>(key, value);
57   }
58
59
60   template<typename Key, typename Value>
61   struct unordered_hash_node {
62      unordered_hash_node(const Key& key, const Value& value);
63
64      const Key first;
65      Value second;
66      unordered_hash_node* next;
67      unordered_hash_node* prev;
68   };
69
70   template<typename Key, typename Value>
71   unordered_hash_node<Key, Value>::unordered_hash_node(const Key& key, const Value& value)
72      : first(key)
73      , second(value)
74   {
75   }
76
77   template <typename Key>
78   struct unordered_hash_node<Key, void> {
79      unordered_hash_node(const Key& key);
80
81      const Key first;
82      unordered_hash_node* next;
83      unordered_hash_node* prev;
84   };
85
86   template<typename Key>
87   unordered_hash_node<Key, void>::unordered_hash_node(const Key& key)
88      : first(key)
89   {
90   }
91
92   template<typename Key, typename Value>
93   static void unordered_hash_node_insert(unordered_hash_node<Key, Value>* node, size_t hash, unordered_hash_node<Key, Value>** buckets, size_t nbuckets) {
94      size_t bucket = hash & (nbuckets - 1);
95
96      unordered_hash_node<Key, Value>* it = buckets[bucket + 1];
97      node->next = it;
98      if (it) {
99         node->prev = it->prev;
100         it->prev = node;
101         if (node->prev)
102            node->prev->next = node;
103      } else {
104         size_t newbucket = bucket;
105         while (newbucket && !buckets[newbucket])
106            --newbucket;
107
108         unordered_hash_node<Key, Value>* prev = buckets[newbucket];
109         while (prev && prev->next)
110            prev = prev->next;
111
112         node->prev = prev;
113         if (prev)
114            prev->next = node;
115      }
116
117      // propagate node through buckets
118      for (; it == buckets[bucket]; --bucket) {
119         buckets[bucket] = node;
120         if (!bucket)
121            break;
122      }
123   }
124
125   template<typename Key, typename Value>
126   static inline void unordered_hash_node_erase(const unordered_hash_node<Key, Value>* where, size_t hash, unordered_hash_node<Key, Value>** buckets, size_t nbuckets) {
127      size_t bucket = hash & (nbuckets - 1);
128
129      unordered_hash_node<Key, Value>* next = where->next;
130      for (; buckets[bucket] == where; --bucket) {
131         buckets[bucket] = next;
132         if (!bucket)
133            break;
134      }
135
136      if (where->prev)
137         where->prev->next = where->next;
138      if (next)
139         next->prev = where->prev;
140   }
141
142   template<typename Node>
143   struct unordered_hash_iterator {
144      Node* operator->() const;
145      Node& operator*() const;
146      Node* node;
147   };
148
149   template<typename Node>
150   struct unordered_hash_iterator<const Node> {
151
152      unordered_hash_iterator() {}
153      unordered_hash_iterator(unordered_hash_iterator<Node> other)
154         : node(other.node)
155      {
156      }
157
158      const Node* operator->() const;
159      const Node& operator*() const;
160      const Node* node;
161   };
162
163   template<typename Key>
164   struct unordered_hash_iterator<const unordered_hash_node<Key, void> > {
165      const Key* operator->() const;
166      const Key& operator*() const;
167      unordered_hash_node<Key, void>* node;
168   };
169
170   template<typename LNode, typename RNode>
171   static inline bool operator==(const unordered_hash_iterator<LNode>& lhs, const unordered_hash_iterator<RNode>& rhs) {
172      return lhs.node == rhs.node;
173   }
174
175   template<typename LNode, typename RNode>
176   static inline bool operator!=(const unordered_hash_iterator<LNode>& lhs, const unordered_hash_iterator<RNode>& rhs) {
177      return lhs.node != rhs.node;
178   }
179
180   template<typename Node>
181   static inline void operator++(unordered_hash_iterator<Node>& lhs) {
182      lhs.node = lhs.node->next;
183   }
184
185   template<typename Node>
186   inline Node* unordered_hash_iterator<Node>::operator->() const {
187      return node;
188   }
189
190   template<typename Node>
191   inline Node& unordered_hash_iterator<Node>::operator*() const {
192      return *node;
193   }
194
195   template<typename Node>
196   inline const Node* unordered_hash_iterator<const Node>::operator->() const {
197      return node;
198   }
199
200   template<typename Node>
201   inline const Node& unordered_hash_iterator<const Node>::operator*() const {
202      return *node;
203   }
204
205   template<typename Key>
206   inline const Key* unordered_hash_iterator<const unordered_hash_node<Key, void> >::operator->() const {
207      return &node->first;
208   }
209
210   template<typename Key>
211   inline const Key& unordered_hash_iterator<const unordered_hash_node<Key, void> >::operator*() const {
212      return node->first;
213   }
214
215   template<typename Node, typename Key>
216   static inline Node unordered_hash_find(const Key& key, Node* buckets, size_t nbuckets) {
217      const size_t bucket = hash(key) & (nbuckets - 2);
218      for (Node it = buckets[bucket], end = buckets[bucket+1]; it != end; it = it->next)
219         if (it->first == key)
220            return it;
221
222      return 0;
223   }
224}
225#endif
Property changes on: branches/osd/src/lib/tinystl/hash_base.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/tinystl/allocator.h
r0r31734
1/*-
2 * Copyright 2012 Matthew Endsley
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted providing that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
22 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
23 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#ifndef TINYSTL_ALLOCATOR_H
28#define TINYSTL_ALLOCATOR_H
29
30#include "stddef.h"
31
32#ifndef TINYSTL_ALLOCATOR
33
34namespace tinystl {
35
36   struct allocator {
37      static void* static_allocate(size_t bytes) {
38         return operator new(bytes);
39      }
40
41      static void static_deallocate(void* ptr, size_t /*bytes*/) {
42         operator delete(ptr);
43      }
44   };
45}
46
47#   define TINYSTL_ALLOCATOR ::tinystl::allocator
48#endif // TINYSTL_ALLOCATOR
49
50#endif
Property changes on: branches/osd/src/lib/tinystl/allocator.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/endian.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_ENDIAN_H_HEADER_GUARD
7#define BX_ENDIAN_H_HEADER_GUARD
8
9#include "bx.h"
10
11namespace bx
12{
13   inline uint16_t endianSwap(uint16_t _in)
14   {
15      return (_in>>8) | (_in<<8);
16   }
17   
18   inline uint32_t endianSwap(uint32_t _in)
19   {
20      return (_in>>24) | (_in<<24)
21          | ( (_in&0x00ff0000)>>8) | ( (_in&0x0000ff00)<<8)
22          ;
23   }
24
25   inline uint64_t endianSwap(uint64_t _in)
26   {
27      return (_in>>56) | (_in<<56)
28          | ( (_in&UINT64_C(0x00ff000000000000) )>>40) | ( (_in&UINT64_C(0x000000000000ff00) )<<40)
29          | ( (_in&UINT64_C(0x0000ff0000000000) )>>24) | ( (_in&UINT64_C(0x0000000000ff0000) )<<24)
30          | ( (_in&UINT64_C(0x000000ff00000000) )>>8)  | ( (_in&UINT64_C(0x00000000ff000000) )<<8)
31          ;
32   }
33
34   inline int16_t endianSwap(int16_t _in)
35   {
36      return (int16_t)endianSwap( (uint16_t)_in);
37   }
38
39   inline int32_t endianSwap(int32_t _in)
40   {
41      return (int32_t)endianSwap( (uint32_t)_in);
42   }
43
44   inline int64_t endianSwap(int64_t _in)
45   {
46      return (int64_t)endianSwap( (uint64_t)_in);
47   }
48
49   /// Input argument is encoded as little endian, convert it if neccessary
50   /// depending on host CPU endianess.
51   template <typename Ty>
52   inline Ty toLittleEndian(const Ty _in)
53   {
54#if BX_CPU_ENDIAN_BIG
55      return endianSwap(_in);
56#else
57      return _in;
58#endif // BX_CPU_ENDIAN_BIG
59   }
60
61   /// Input argument is encoded as big endian, convert it if neccessary
62   /// depending on host CPU endianess.
63   template <typename Ty>
64   inline Ty toBigEndian(const Ty _in)
65   {
66#if BX_CPU_ENDIAN_LITTLE
67      return endianSwap(_in);
68#else
69      return _in;
70#endif // BX_CPU_ENDIAN_LITTLE
71   }
72
73   /// If _littleEndian is true, converts input argument to from little endian
74   /// to host CPU endiness.
75   template <typename Ty>
76   inline Ty toHostEndian(const Ty _in, bool _fromLittleEndian)
77   {
78#if BX_CPU_ENDIAN_LITTLE
79      return _fromLittleEndian ? _in : endianSwap(_in);
80#else
81      return _fromLittleEndian ? endianSwap(_in) : _in;
82#endif // BX_CPU_ENDIAN_LITTLE
83   }
84
85} // namespace bx
86
87#endif // BX_ENDIAN_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/endian.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/cl.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_CL_H_HEADER_GUARD
7#define BX_CL_H_HEADER_GUARD
8
9/// To implement OpenCL dynamic loading, define BX_CL_IMPLEMENTATION and
10/// #include <bx/cl.h> into .cpp file.
11///
12/// To use it, just #include <bx/cl.h> without defining BX_CL_IMPLEMENTATION.
13/// To load dynamic library call bx::clLoad(), to unload it call bx::clUnload.
14
15namespace bx
16{
17   /// Load OpenCL dynamic library.
18   ///
19   /// Returns internal reference count. If library is not available
20   /// returns 0.
21   ///
22   int32_t clLoad();
23
24   /// Unload OpenCL dynamic library.
25   ///
26   /// Returns internal reference count. When reference count reaches 0
27   /// library is fully unloaded.
28   ///
29   int32_t clUnload();
30
31} // namespace bx
32
33#if defined(BX_CL_IMPLEMENTATION) && defined(__OPENCL_CL_H)
34#   error message("CL/cl.h is already included, it cannot be included before bx/cl.h header when BX_CL_IMPLEMENTATION is defined!")
35#endif // defined(BX_CL_IMPLEMENTATION) && defined(__OPENCL_CL_H)
36
37#ifndef __OPENCL_CL_H
38#define __OPENCL_CL_H
39
40// BK - CL/cl.h header begin ------------------------------------------------->8
41
42/*******************************************************************************
43 * Copyright (c) 2008 - 2012 The Khronos Group Inc.
44 *
45 * Permission is hereby granted, free of charge, to any person obtaining a
46 * copy of this software and/or associated documentation files (the
47 * "Materials"), to deal in the Materials without restriction, including
48 * without limitation the rights to use, copy, modify, merge, publish,
49 * distribute, sublicense, and/or sell copies of the Materials, and to
50 * permit persons to whom the Materials are furnished to do so, subject to
51 * the following conditions:
52 *
53 * The above copyright notice and this permission notice shall be included
54 * in all copies or substantial portions of the Materials.
55 *
56 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
57 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
58 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
59 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
60 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
61 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
62 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
63 ******************************************************************************/
64
65#ifdef __APPLE__
66#include <OpenCL/cl_platform.h>
67#else
68#include <CL/cl_platform.h>
69#endif   
70
71#ifdef __cplusplus
72extern "C" {
73#endif
74
75/******************************************************************************/
76
77typedef struct _cl_platform_id *    cl_platform_id;
78typedef struct _cl_device_id *      cl_device_id;
79typedef struct _cl_context *        cl_context;
80typedef struct _cl_command_queue *  cl_command_queue;
81typedef struct _cl_mem *            cl_mem;
82typedef struct _cl_program *        cl_program;
83typedef struct _cl_kernel *         cl_kernel;
84typedef struct _cl_event *          cl_event;
85typedef struct _cl_sampler *        cl_sampler;
86
87typedef cl_uint             cl_bool;                     /* WARNING!  Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */
88typedef cl_ulong            cl_bitfield;
89typedef cl_bitfield         cl_device_type;
90typedef cl_uint             cl_platform_info;
91typedef cl_uint             cl_device_info;
92typedef cl_bitfield         cl_device_fp_config;
93typedef cl_uint             cl_device_mem_cache_type;
94typedef cl_uint             cl_device_local_mem_type;
95typedef cl_bitfield         cl_device_exec_capabilities;
96typedef cl_bitfield         cl_command_queue_properties;
97typedef intptr_t            cl_device_partition_property;
98typedef cl_bitfield         cl_device_affinity_domain;
99
100typedef intptr_t            cl_context_properties;
101typedef cl_uint             cl_context_info;
102typedef cl_uint             cl_command_queue_info;
103typedef cl_uint             cl_channel_order;
104typedef cl_uint             cl_channel_type;
105typedef cl_bitfield         cl_mem_flags;
106typedef cl_uint             cl_mem_object_type;
107typedef cl_uint             cl_mem_info;
108typedef cl_bitfield         cl_mem_migration_flags;
109typedef cl_uint             cl_image_info;
110typedef cl_uint             cl_buffer_create_type;
111typedef cl_uint             cl_addressing_mode;
112typedef cl_uint             cl_filter_mode;
113typedef cl_uint             cl_sampler_info;
114typedef cl_bitfield         cl_map_flags;
115typedef cl_uint             cl_program_info;
116typedef cl_uint             cl_program_build_info;
117typedef cl_uint             cl_program_binary_type;
118typedef cl_int              cl_build_status;
119typedef cl_uint             cl_kernel_info;
120typedef cl_uint             cl_kernel_arg_info;
121typedef cl_uint             cl_kernel_arg_address_qualifier;
122typedef cl_uint             cl_kernel_arg_access_qualifier;
123typedef cl_bitfield         cl_kernel_arg_type_qualifier;
124typedef cl_uint             cl_kernel_work_group_info;
125typedef cl_uint             cl_event_info;
126typedef cl_uint             cl_command_type;
127typedef cl_uint             cl_profiling_info;
128
129
130typedef struct _cl_image_format {
131    cl_channel_order        image_channel_order;
132    cl_channel_type         image_channel_data_type;
133} cl_image_format;
134
135typedef struct _cl_image_desc {
136    cl_mem_object_type      image_type;
137    size_t                  image_width;
138    size_t                  image_height;
139    size_t                  image_depth;
140    size_t                  image_array_size;
141    size_t                  image_row_pitch;
142    size_t                  image_slice_pitch;
143    cl_uint                 num_mip_levels;
144    cl_uint                 num_samples;
145    cl_mem                  buffer;
146} cl_image_desc;
147
148typedef struct _cl_buffer_region {
149    size_t                  origin;
150    size_t                  size;
151} cl_buffer_region;
152
153
154/******************************************************************************/
155
156/* Error Codes */
157#define CL_SUCCESS                                  0
158#define CL_DEVICE_NOT_FOUND                         -1
159#define CL_DEVICE_NOT_AVAILABLE                     -2
160#define CL_COMPILER_NOT_AVAILABLE                   -3
161#define CL_MEM_OBJECT_ALLOCATION_FAILURE            -4
162#define CL_OUT_OF_RESOURCES                         -5
163#define CL_OUT_OF_HOST_MEMORY                       -6
164#define CL_PROFILING_INFO_NOT_AVAILABLE             -7
165#define CL_MEM_COPY_OVERLAP                         -8
166#define CL_IMAGE_FORMAT_MISMATCH                    -9
167#define CL_IMAGE_FORMAT_NOT_SUPPORTED               -10
168#define CL_BUILD_PROGRAM_FAILURE                    -11
169#define CL_MAP_FAILURE                              -12
170#define CL_MISALIGNED_SUB_BUFFER_OFFSET             -13
171#define CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST -14
172#define CL_COMPILE_PROGRAM_FAILURE                  -15
173#define CL_LINKER_NOT_AVAILABLE                     -16
174#define CL_LINK_PROGRAM_FAILURE                     -17
175#define CL_DEVICE_PARTITION_FAILED                  -18
176#define CL_KERNEL_ARG_INFO_NOT_AVAILABLE            -19
177
178#define CL_INVALID_VALUE                            -30
179#define CL_INVALID_DEVICE_TYPE                      -31
180#define CL_INVALID_PLATFORM                         -32
181#define CL_INVALID_DEVICE                           -33
182#define CL_INVALID_CONTEXT                          -34
183#define CL_INVALID_QUEUE_PROPERTIES                 -35
184#define CL_INVALID_COMMAND_QUEUE                    -36
185#define CL_INVALID_HOST_PTR                         -37
186#define CL_INVALID_MEM_OBJECT                       -38
187#define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR          -39
188#define CL_INVALID_IMAGE_SIZE                       -40
189#define CL_INVALID_SAMPLER                          -41
190#define CL_INVALID_BINARY                           -42
191#define CL_INVALID_BUILD_OPTIONS                    -43
192#define CL_INVALID_PROGRAM                          -44
193#define CL_INVALID_PROGRAM_EXECUTABLE               -45
194#define CL_INVALID_KERNEL_NAME                      -46
195#define CL_INVALID_KERNEL_DEFINITION                -47
196#define CL_INVALID_KERNEL                           -48
197#define CL_INVALID_ARG_INDEX                        -49
198#define CL_INVALID_ARG_VALUE                        -50
199#define CL_INVALID_ARG_SIZE                         -51
200#define CL_INVALID_KERNEL_ARGS                      -52
201#define CL_INVALID_WORK_DIMENSION                   -53
202#define CL_INVALID_WORK_GROUP_SIZE                  -54
203#define CL_INVALID_WORK_ITEM_SIZE                   -55
204#define CL_INVALID_GLOBAL_OFFSET                    -56
205#define CL_INVALID_EVENT_WAIT_LIST                  -57
206#define CL_INVALID_EVENT                            -58
207#define CL_INVALID_OPERATION                        -59
208#define CL_INVALID_GL_OBJECT                        -60
209#define CL_INVALID_BUFFER_SIZE                      -61
210#define CL_INVALID_MIP_LEVEL                        -62
211#define CL_INVALID_GLOBAL_WORK_SIZE                 -63
212#define CL_INVALID_PROPERTY                         -64
213#define CL_INVALID_IMAGE_DESCRIPTOR                 -65
214#define CL_INVALID_COMPILER_OPTIONS                 -66
215#define CL_INVALID_LINKER_OPTIONS                   -67
216#define CL_INVALID_DEVICE_PARTITION_COUNT           -68
217
218/* OpenCL Version */
219#define CL_VERSION_1_0                              1
220#define CL_VERSION_1_1                              1
221#define CL_VERSION_1_2                              1
222
223/* cl_bool */
224#define CL_FALSE                                    0
225#define CL_TRUE                                     1
226#define CL_BLOCKING                                 CL_TRUE
227#define CL_NON_BLOCKING                             CL_FALSE
228
229/* cl_platform_info */
230#define CL_PLATFORM_PROFILE                         0x0900
231#define CL_PLATFORM_VERSION                         0x0901
232#define CL_PLATFORM_NAME                            0x0902
233#define CL_PLATFORM_VENDOR                          0x0903
234#define CL_PLATFORM_EXTENSIONS                      0x0904
235
236/* cl_device_type - bitfield */
237#define CL_DEVICE_TYPE_DEFAULT                      (1 << 0)
238#define CL_DEVICE_TYPE_CPU                          (1 << 1)
239#define CL_DEVICE_TYPE_GPU                          (1 << 2)
240#define CL_DEVICE_TYPE_ACCELERATOR                  (1 << 3)
241#define CL_DEVICE_TYPE_CUSTOM                       (1 << 4)
242#define CL_DEVICE_TYPE_ALL                          0xFFFFFFFF
243
244/* cl_device_info */
245#define CL_DEVICE_TYPE                              0x1000
246#define CL_DEVICE_VENDOR_ID                         0x1001
247#define CL_DEVICE_MAX_COMPUTE_UNITS                 0x1002
248#define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS          0x1003
249#define CL_DEVICE_MAX_WORK_GROUP_SIZE               0x1004
250#define CL_DEVICE_MAX_WORK_ITEM_SIZES               0x1005
251#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR       0x1006
252#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT      0x1007
253#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT        0x1008
254#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG       0x1009
255#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT      0x100A
256#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE     0x100B
257#define CL_DEVICE_MAX_CLOCK_FREQUENCY               0x100C
258#define CL_DEVICE_ADDRESS_BITS                      0x100D
259#define CL_DEVICE_MAX_READ_IMAGE_ARGS               0x100E
260#define CL_DEVICE_MAX_WRITE_IMAGE_ARGS              0x100F
261#define CL_DEVICE_MAX_MEM_ALLOC_SIZE                0x1010
262#define CL_DEVICE_IMAGE2D_MAX_WIDTH                 0x1011
263#define CL_DEVICE_IMAGE2D_MAX_HEIGHT                0x1012
264#define CL_DEVICE_IMAGE3D_MAX_WIDTH                 0x1013
265#define CL_DEVICE_IMAGE3D_MAX_HEIGHT                0x1014
266#define CL_DEVICE_IMAGE3D_MAX_DEPTH                 0x1015
267#define CL_DEVICE_IMAGE_SUPPORT                     0x1016
268#define CL_DEVICE_MAX_PARAMETER_SIZE                0x1017
269#define CL_DEVICE_MAX_SAMPLERS                      0x1018
270#define CL_DEVICE_MEM_BASE_ADDR_ALIGN               0x1019
271#define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE          0x101A
272#define CL_DEVICE_SINGLE_FP_CONFIG                  0x101B
273#define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE             0x101C
274#define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE         0x101D
275#define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE             0x101E
276#define CL_DEVICE_GLOBAL_MEM_SIZE                   0x101F
277#define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE          0x1020
278#define CL_DEVICE_MAX_CONSTANT_ARGS                 0x1021
279#define CL_DEVICE_LOCAL_MEM_TYPE                    0x1022
280#define CL_DEVICE_LOCAL_MEM_SIZE                    0x1023
281#define CL_DEVICE_ERROR_CORRECTION_SUPPORT          0x1024
282#define CL_DEVICE_PROFILING_TIMER_RESOLUTION        0x1025
283#define CL_DEVICE_ENDIAN_LITTLE                     0x1026
284#define CL_DEVICE_AVAILABLE                         0x1027
285#define CL_DEVICE_COMPILER_AVAILABLE                0x1028
286#define CL_DEVICE_EXECUTION_CAPABILITIES            0x1029
287#define CL_DEVICE_QUEUE_PROPERTIES                  0x102A
288#define CL_DEVICE_NAME                              0x102B
289#define CL_DEVICE_VENDOR                            0x102C
290#define CL_DRIVER_VERSION                           0x102D
291#define CL_DEVICE_PROFILE                           0x102E
292#define CL_DEVICE_VERSION                           0x102F
293#define CL_DEVICE_EXTENSIONS                        0x1030
294#define CL_DEVICE_PLATFORM                          0x1031
295#define CL_DEVICE_DOUBLE_FP_CONFIG                  0x1032
296/* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG */
297#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF       0x1034
298#define CL_DEVICE_HOST_UNIFIED_MEMORY               0x1035
299#define CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR          0x1036
300#define CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT         0x1037
301#define CL_DEVICE_NATIVE_VECTOR_WIDTH_INT           0x1038
302#define CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG          0x1039
303#define CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT         0x103A
304#define CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE        0x103B
305#define CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF          0x103C
306#define CL_DEVICE_OPENCL_C_VERSION                  0x103D
307#define CL_DEVICE_LINKER_AVAILABLE                  0x103E
308#define CL_DEVICE_BUILT_IN_KERNELS                  0x103F
309#define CL_DEVICE_IMAGE_MAX_BUFFER_SIZE             0x1040
310#define CL_DEVICE_IMAGE_MAX_ARRAY_SIZE              0x1041
311#define CL_DEVICE_PARENT_DEVICE                     0x1042
312#define CL_DEVICE_PARTITION_MAX_SUB_DEVICES         0x1043
313#define CL_DEVICE_PARTITION_PROPERTIES              0x1044
314#define CL_DEVICE_PARTITION_AFFINITY_DOMAIN         0x1045
315#define CL_DEVICE_PARTITION_TYPE                    0x1046
316#define CL_DEVICE_REFERENCE_COUNT                   0x1047
317#define CL_DEVICE_PREFERRED_INTEROP_USER_SYNC       0x1048
318#define CL_DEVICE_PRINTF_BUFFER_SIZE                0x1049
319#define CL_DEVICE_IMAGE_PITCH_ALIGNMENT             0x104A
320#define CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT      0x104B
321
322/* cl_device_fp_config - bitfield */
323#define CL_FP_DENORM                                (1 << 0)
324#define CL_FP_INF_NAN                               (1 << 1)
325#define CL_FP_ROUND_TO_NEAREST                      (1 << 2)
326#define CL_FP_ROUND_TO_ZERO                         (1 << 3)
327#define CL_FP_ROUND_TO_INF                          (1 << 4)
328#define CL_FP_FMA                                   (1 << 5)
329#define CL_FP_SOFT_FLOAT                            (1 << 6)
330#define CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT         (1 << 7)
331
332/* cl_device_mem_cache_type */
333#define CL_NONE                                     0x0
334#define CL_READ_ONLY_CACHE                          0x1
335#define CL_READ_WRITE_CACHE                         0x2
336
337/* cl_device_local_mem_type */
338#define CL_LOCAL                                    0x1
339#define CL_GLOBAL                                   0x2
340
341/* cl_device_exec_capabilities - bitfield */
342#define CL_EXEC_KERNEL                              (1 << 0)
343#define CL_EXEC_NATIVE_KERNEL                       (1 << 1)
344
345/* cl_command_queue_properties - bitfield */
346#define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE      (1 << 0)
347#define CL_QUEUE_PROFILING_ENABLE                   (1 << 1)
348
349/* cl_context_info  */
350#define CL_CONTEXT_REFERENCE_COUNT                  0x1080
351#define CL_CONTEXT_DEVICES                          0x1081
352#define CL_CONTEXT_PROPERTIES                       0x1082
353#define CL_CONTEXT_NUM_DEVICES                      0x1083
354
355/* cl_context_properties */
356#define CL_CONTEXT_PLATFORM                         0x1084
357#define CL_CONTEXT_INTEROP_USER_SYNC                0x1085
358   
359/* cl_device_partition_property */
360#define CL_DEVICE_PARTITION_EQUALLY                 0x1086
361#define CL_DEVICE_PARTITION_BY_COUNTS               0x1087
362#define CL_DEVICE_PARTITION_BY_COUNTS_LIST_END      0x0
363#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN      0x1088
364   
365/* cl_device_affinity_domain */
366#define CL_DEVICE_AFFINITY_DOMAIN_NUMA                     (1 << 0)
367#define CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE                 (1 << 1)
368#define CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE                 (1 << 2)
369#define CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE                 (1 << 3)
370#define CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE                 (1 << 4)
371#define CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE       (1 << 5)
372
373/* cl_command_queue_info */
374#define CL_QUEUE_CONTEXT                            0x1090
375#define CL_QUEUE_DEVICE                             0x1091
376#define CL_QUEUE_REFERENCE_COUNT                    0x1092
377#define CL_QUEUE_PROPERTIES                         0x1093
378
379/* cl_mem_flags - bitfield */
380#define CL_MEM_READ_WRITE                           (1 << 0)
381#define CL_MEM_WRITE_ONLY                           (1 << 1)
382#define CL_MEM_READ_ONLY                            (1 << 2)
383#define CL_MEM_USE_HOST_PTR                         (1 << 3)
384#define CL_MEM_ALLOC_HOST_PTR                       (1 << 4)
385#define CL_MEM_COPY_HOST_PTR                        (1 << 5)
386// reserved                                         (1 << 6)   
387#define CL_MEM_HOST_WRITE_ONLY                      (1 << 7)
388#define CL_MEM_HOST_READ_ONLY                       (1 << 8)
389#define CL_MEM_HOST_NO_ACCESS                       (1 << 9)
390
391/* cl_mem_migration_flags - bitfield */
392#define CL_MIGRATE_MEM_OBJECT_HOST                  (1 << 0)
393#define CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED     (1 << 1)
394
395/* cl_channel_order */
396#define CL_R                                        0x10B0
397#define CL_A                                        0x10B1
398#define CL_RG                                       0x10B2
399#define CL_RA                                       0x10B3
400#define CL_RGB                                      0x10B4
401#define CL_RGBA                                     0x10B5
402#define CL_BGRA                                     0x10B6
403#define CL_ARGB                                     0x10B7
404#define CL_INTENSITY                                0x10B8
405#define CL_LUMINANCE                                0x10B9
406#define CL_Rx                                       0x10BA
407#define CL_RGx                                      0x10BB
408#define CL_RGBx                                     0x10BC
409#define CL_DEPTH                                    0x10BD
410#define CL_DEPTH_STENCIL                            0x10BE
411
412/* cl_channel_type */
413#define CL_SNORM_INT8                               0x10D0
414#define CL_SNORM_INT16                              0x10D1
415#define CL_UNORM_INT8                               0x10D2
416#define CL_UNORM_INT16                              0x10D3
417#define CL_UNORM_SHORT_565                          0x10D4
418#define CL_UNORM_SHORT_555                          0x10D5
419#define CL_UNORM_INT_101010                         0x10D6
420#define CL_SIGNED_INT8                              0x10D7
421#define CL_SIGNED_INT16                             0x10D8
422#define CL_SIGNED_INT32                             0x10D9
423#define CL_UNSIGNED_INT8                            0x10DA
424#define CL_UNSIGNED_INT16                           0x10DB
425#define CL_UNSIGNED_INT32                           0x10DC
426#define CL_HALF_FLOAT                               0x10DD
427#define CL_FLOAT                                    0x10DE
428#define CL_UNORM_INT24                              0x10DF
429
430/* cl_mem_object_type */
431#define CL_MEM_OBJECT_BUFFER                        0x10F0
432#define CL_MEM_OBJECT_IMAGE2D                       0x10F1
433#define CL_MEM_OBJECT_IMAGE3D                       0x10F2
434#define CL_MEM_OBJECT_IMAGE2D_ARRAY                 0x10F3
435#define CL_MEM_OBJECT_IMAGE1D                       0x10F4
436#define CL_MEM_OBJECT_IMAGE1D_ARRAY                 0x10F5
437#define CL_MEM_OBJECT_IMAGE1D_BUFFER                0x10F6
438
439/* cl_mem_info */
440#define CL_MEM_TYPE                                 0x1100
441#define CL_MEM_FLAGS                                0x1101
442#define CL_MEM_SIZE                                 0x1102
443#define CL_MEM_HOST_PTR                             0x1103
444#define CL_MEM_MAP_COUNT                            0x1104
445#define CL_MEM_REFERENCE_COUNT                      0x1105
446#define CL_MEM_CONTEXT                              0x1106
447#define CL_MEM_ASSOCIATED_MEMOBJECT                 0x1107
448#define CL_MEM_OFFSET                               0x1108
449
450/* cl_image_info */
451#define CL_IMAGE_FORMAT                             0x1110
452#define CL_IMAGE_ELEMENT_SIZE                       0x1111
453#define CL_IMAGE_ROW_PITCH                          0x1112
454#define CL_IMAGE_SLICE_PITCH                        0x1113
455#define CL_IMAGE_WIDTH                              0x1114
456#define CL_IMAGE_HEIGHT                             0x1115
457#define CL_IMAGE_DEPTH                              0x1116
458#define CL_IMAGE_ARRAY_SIZE                         0x1117
459#define CL_IMAGE_BUFFER                             0x1118
460#define CL_IMAGE_NUM_MIP_LEVELS                     0x1119
461#define CL_IMAGE_NUM_SAMPLES                        0x111A
462
463/* cl_addressing_mode */
464#define CL_ADDRESS_NONE                             0x1130
465#define CL_ADDRESS_CLAMP_TO_EDGE                    0x1131
466#define CL_ADDRESS_CLAMP                            0x1132
467#define CL_ADDRESS_REPEAT                           0x1133
468#define CL_ADDRESS_MIRRORED_REPEAT                  0x1134
469
470/* cl_filter_mode */
471#define CL_FILTER_NEAREST                           0x1140
472#define CL_FILTER_LINEAR                            0x1141
473
474/* cl_sampler_info */
475#define CL_SAMPLER_REFERENCE_COUNT                  0x1150
476#define CL_SAMPLER_CONTEXT                          0x1151
477#define CL_SAMPLER_NORMALIZED_COORDS                0x1152
478#define CL_SAMPLER_ADDRESSING_MODE                  0x1153
479#define CL_SAMPLER_FILTER_MODE                      0x1154
480
481/* cl_map_flags - bitfield */
482#define CL_MAP_READ                                 (1 << 0)
483#define CL_MAP_WRITE                                (1 << 1)
484#define CL_MAP_WRITE_INVALIDATE_REGION              (1 << 2)
485
486/* cl_program_info */
487#define CL_PROGRAM_REFERENCE_COUNT                  0x1160
488#define CL_PROGRAM_CONTEXT                          0x1161
489#define CL_PROGRAM_NUM_DEVICES                      0x1162
490#define CL_PROGRAM_DEVICES                          0x1163
491#define CL_PROGRAM_SOURCE                           0x1164
492#define CL_PROGRAM_BINARY_SIZES                     0x1165
493#define CL_PROGRAM_BINARIES                         0x1166
494#define CL_PROGRAM_NUM_KERNELS                      0x1167
495#define CL_PROGRAM_KERNEL_NAMES                     0x1168
496
497/* cl_program_build_info */
498#define CL_PROGRAM_BUILD_STATUS                     0x1181
499#define CL_PROGRAM_BUILD_OPTIONS                    0x1182
500#define CL_PROGRAM_BUILD_LOG                        0x1183
501#define CL_PROGRAM_BINARY_TYPE                      0x1184
502   
503/* cl_program_binary_type */
504#define CL_PROGRAM_BINARY_TYPE_NONE                 0x0
505#define CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT      0x1
506#define CL_PROGRAM_BINARY_TYPE_LIBRARY              0x2
507#define CL_PROGRAM_BINARY_TYPE_EXECUTABLE           0x4
508
509/* cl_build_status */
510#define CL_BUILD_SUCCESS                            0
511#define CL_BUILD_NONE                               -1
512#define CL_BUILD_ERROR                              -2
513#define CL_BUILD_IN_PROGRESS                        -3
514
515/* cl_kernel_info */
516#define CL_KERNEL_FUNCTION_NAME                     0x1190
517#define CL_KERNEL_NUM_ARGS                          0x1191
518#define CL_KERNEL_REFERENCE_COUNT                   0x1192
519#define CL_KERNEL_CONTEXT                           0x1193
520#define CL_KERNEL_PROGRAM                           0x1194
521#define CL_KERNEL_ATTRIBUTES                        0x1195
522
523/* cl_kernel_arg_info */
524#define CL_KERNEL_ARG_ADDRESS_QUALIFIER             0x1196
525#define CL_KERNEL_ARG_ACCESS_QUALIFIER              0x1197
526#define CL_KERNEL_ARG_TYPE_NAME                     0x1198
527#define CL_KERNEL_ARG_TYPE_QUALIFIER                0x1199
528#define CL_KERNEL_ARG_NAME                          0x119A
529
530/* cl_kernel_arg_address_qualifier */
531#define CL_KERNEL_ARG_ADDRESS_GLOBAL                0x119B
532#define CL_KERNEL_ARG_ADDRESS_LOCAL                 0x119C
533#define CL_KERNEL_ARG_ADDRESS_CONSTANT              0x119D
534#define CL_KERNEL_ARG_ADDRESS_PRIVATE               0x119E
535
536/* cl_kernel_arg_access_qualifier */
537#define CL_KERNEL_ARG_ACCESS_READ_ONLY              0x11A0
538#define CL_KERNEL_ARG_ACCESS_WRITE_ONLY             0x11A1
539#define CL_KERNEL_ARG_ACCESS_READ_WRITE             0x11A2
540#define CL_KERNEL_ARG_ACCESS_NONE                   0x11A3
541   
542/* cl_kernel_arg_type_qualifer */
543#define CL_KERNEL_ARG_TYPE_NONE                     0
544#define CL_KERNEL_ARG_TYPE_CONST                    (1 << 0)
545#define CL_KERNEL_ARG_TYPE_RESTRICT                 (1 << 1)
546#define CL_KERNEL_ARG_TYPE_VOLATILE                 (1 << 2)
547
548/* cl_kernel_work_group_info */
549#define CL_KERNEL_WORK_GROUP_SIZE                   0x11B0
550#define CL_KERNEL_COMPILE_WORK_GROUP_SIZE           0x11B1
551#define CL_KERNEL_LOCAL_MEM_SIZE                    0x11B2
552#define CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x11B3
553#define CL_KERNEL_PRIVATE_MEM_SIZE                  0x11B4
554#define CL_KERNEL_GLOBAL_WORK_SIZE                  0x11B5
555
556/* cl_event_info  */
557#define CL_EVENT_COMMAND_QUEUE                      0x11D0
558#define CL_EVENT_COMMAND_TYPE                       0x11D1
559#define CL_EVENT_REFERENCE_COUNT                    0x11D2
560#define CL_EVENT_COMMAND_EXECUTION_STATUS           0x11D3
561#define CL_EVENT_CONTEXT                            0x11D4
562
563/* cl_command_type */
564#define CL_COMMAND_NDRANGE_KERNEL                   0x11F0
565#define CL_COMMAND_TASK                             0x11F1
566#define CL_COMMAND_NATIVE_KERNEL                    0x11F2
567#define CL_COMMAND_READ_BUFFER                      0x11F3
568#define CL_COMMAND_WRITE_BUFFER                     0x11F4
569#define CL_COMMAND_COPY_BUFFER                      0x11F5
570#define CL_COMMAND_READ_IMAGE                       0x11F6
571#define CL_COMMAND_WRITE_IMAGE                      0x11F7
572#define CL_COMMAND_COPY_IMAGE                       0x11F8
573#define CL_COMMAND_COPY_IMAGE_TO_BUFFER             0x11F9
574#define CL_COMMAND_COPY_BUFFER_TO_IMAGE             0x11FA
575#define CL_COMMAND_MAP_BUFFER                       0x11FB
576#define CL_COMMAND_MAP_IMAGE                        0x11FC
577#define CL_COMMAND_UNMAP_MEM_OBJECT                 0x11FD
578#define CL_COMMAND_MARKER                           0x11FE
579#define CL_COMMAND_ACQUIRE_GL_OBJECTS               0x11FF
580#define CL_COMMAND_RELEASE_GL_OBJECTS               0x1200
581#define CL_COMMAND_READ_BUFFER_RECT                 0x1201
582#define CL_COMMAND_WRITE_BUFFER_RECT                0x1202
583#define CL_COMMAND_COPY_BUFFER_RECT                 0x1203
584#define CL_COMMAND_USER                             0x1204
585#define CL_COMMAND_BARRIER                          0x1205
586#define CL_COMMAND_MIGRATE_MEM_OBJECTS              0x1206
587#define CL_COMMAND_FILL_BUFFER                      0x1207
588#define CL_COMMAND_FILL_IMAGE                       0x1208
589
590/* command execution status */
591#define CL_COMPLETE                                 0x0
592#define CL_RUNNING                                  0x1
593#define CL_SUBMITTED                                0x2
594#define CL_QUEUED                                   0x3
595
596/* cl_buffer_create_type  */
597#define CL_BUFFER_CREATE_TYPE_REGION                0x1220
598
599/* cl_profiling_info  */
600#define CL_PROFILING_COMMAND_QUEUED                 0x1280
601#define CL_PROFILING_COMMAND_SUBMIT                 0x1281
602#define CL_PROFILING_COMMAND_START                  0x1282
603#define CL_PROFILING_COMMAND_END                    0x1283
604
605#ifdef __cplusplus
606} //extern "C"
607#endif
608
609// BK - CL/cl.h header end --------------------------------------------------->8
610
611// 1.1
612typedef cl_int           (CL_API_CALL* PFNCLGETPLATFORMIDSPROC)(cl_uint, cl_platform_id*, cl_uint*);
613typedef cl_int           (CL_API_CALL* PFNCLGETPLATFORMINFOPROC)(cl_platform_id, cl_platform_info, size_t, void*, size_t*);
614typedef cl_int           (CL_API_CALL* PFNCLGETDEVICEINFOPROC)(cl_device_id, cl_device_info, size_t, void*, size_t*);
615typedef cl_int           (CL_API_CALL* PFNCLGETDEVICEIDSPROC)(cl_platform_id, cl_device_type, cl_uint, cl_device_id*, cl_uint*);
616typedef cl_context       (CL_API_CALL* PFNCLCREATECONTEXTPROC)(const cl_context_properties*, cl_uint, const cl_device_id*, void (CL_CALLBACK*)(const char*, const void*, size_t, void*), void*, cl_int*);
617typedef cl_context       (CL_API_CALL* PFNCLCREATECONTEXTFROMTYPEPROC)(const cl_context_properties *, cl_device_type, void (CL_CALLBACK*)(const char*, const void*, size_t, void*), void*, cl_int*);
618typedef cl_int           (CL_API_CALL* PFNCLRETAINCONTEXTPROC)(cl_context);
619typedef cl_int           (CL_API_CALL* PFNCLRELEASECONTEXTPROC)(cl_context);
620typedef cl_int           (CL_API_CALL* PFNCLGETCONTEXTINFOPROC)(cl_context, cl_context_info, size_t, void*, size_t*);
621typedef cl_command_queue (CL_API_CALL* PFNCLCREATECOMMANDQUEUEPROC)(cl_context, cl_device_id, cl_command_queue_properties, cl_int*);
622typedef cl_int           (CL_API_CALL* PFNCLRETAINCOMMANDQUEUEPROC)(cl_command_queue);
623typedef cl_int           (CL_API_CALL* PFNCLRELEASECOMMANDQUEUEPROC)(cl_command_queue);
624typedef cl_int           (CL_API_CALL* PFNCLGETCOMMANDQUEUEINFOPROC)(cl_command_queue, cl_command_queue_info, size_t, void*, size_t*);
625typedef cl_mem           (CL_API_CALL* PFNCLCREATEBUFFERPROC)(cl_context, cl_mem_flags, size_t, void*, cl_int*);
626typedef cl_int           (CL_API_CALL* PFNCLRETAINMEMOBJECTPROC)(cl_mem);
627typedef cl_int           (CL_API_CALL* PFNCLRELEASEMEMOBJECTPROC)(cl_mem);
628typedef cl_int           (CL_API_CALL* PFNCLGETSUPPORTEDIMAGEFORMATSPROC)(cl_context, cl_mem_flags, cl_mem_object_type, cl_uint, cl_image_format*, cl_uint*);
629typedef cl_int           (CL_API_CALL* PFNCLGETMEMOBJECTINFOPROC)(cl_mem, cl_mem_info, size_t, void*, size_t*);
630typedef cl_int           (CL_API_CALL* PFNCLGETIMAGEINFOPROC)(cl_mem, cl_image_info, size_t, void*, size_t*);
631typedef cl_sampler       (CL_API_CALL* PFNCLCREATESAMPLERPROC)(cl_context, cl_bool, cl_addressing_mode, cl_filter_mode, cl_int*);
632typedef cl_int           (CL_API_CALL* PFNCLRETAINSAMPLERPROC)(cl_sampler);
633typedef cl_int           (CL_API_CALL* PFNCLRELEASESAMPLERPROC)(cl_sampler);
634typedef cl_int           (CL_API_CALL* PFNCLGETSAMPLERINFOPROC)(cl_sampler, cl_sampler_info, size_t, void*, size_t*);
635typedef cl_program       (CL_API_CALL* PFNCLCREATEPROGRAMWITHSOURCEPROC)(cl_context, cl_uint, const char**, const size_t*, cl_int*);
636typedef cl_program       (CL_API_CALL* PFNCLCREATEPROGRAMWITHBINARYPROC)(cl_context, cl_uint, const cl_device_id*, const size_t*, const unsigned char**, cl_int*, cl_int*);
637typedef cl_int           (CL_API_CALL* PFNCLRETAINPROGRAMPROC)(cl_program);
638typedef cl_int           (CL_API_CALL* PFNCLRELEASEPROGRAMPROC)(cl_program);
639typedef cl_int           (CL_API_CALL* PFNCLBUILDPROGRAMPROC)(cl_program, cl_uint, const cl_device_id *, const char *, void (CL_CALLBACK*)(cl_program, void*), void*);
640typedef cl_int           (CL_API_CALL* PFNCLGETPROGRAMINFOPROC)(cl_program, cl_program_info, size_t, void*, size_t*);
641typedef cl_int           (CL_API_CALL* PFNCLGETPROGRAMBUILDINFOPROC)(cl_program, cl_device_id, cl_program_build_info, size_t, void*, size_t*);
642typedef cl_kernel        (CL_API_CALL* PFNCLCREATEKERNELPROC)(cl_program, const char*, cl_int*);
643typedef cl_int           (CL_API_CALL* PFNCLCREATEKERNELSINPROGRAMPROC)(cl_program, cl_uint, cl_kernel*, cl_uint*);
644typedef cl_int           (CL_API_CALL* PFNCLRETAINKERNELPROC)(cl_kernel);
645typedef cl_int           (CL_API_CALL* PFNCLRELEASEKERNELPROC)(cl_kernel);
646typedef cl_int           (CL_API_CALL* PFNCLSETKERNELARGPROC)(cl_kernel, cl_uint, size_t, const void*);
647typedef cl_int           (CL_API_CALL* PFNCLGETKERNELINFOPROC)(cl_kernel, cl_kernel_info, size_t, void*, size_t*);
648typedef cl_int           (CL_API_CALL* PFNCLGETKERNELWORKGROUPINFOPROC)(cl_kernel, cl_device_id, cl_kernel_work_group_info, size_t, void*, size_t*);
649typedef cl_int           (CL_API_CALL* PFNCLWAITFOREVENTSPROC)(cl_uint, const cl_event*);
650typedef cl_int           (CL_API_CALL* PFNCLGETEVENTINFOPROC)(cl_event, cl_event_info, size_t, void*, size_t*);
651typedef cl_int           (CL_API_CALL* PFNCLRETAINEVENTPROC)(cl_event);
652typedef cl_int           (CL_API_CALL* PFNCLRELEASEEVENTPROC)(cl_event);
653typedef cl_int           (CL_API_CALL* PFNCLGETEVENTPROFILINGINFOPROC)(cl_event, cl_profiling_info, size_t, void*, size_t*);
654typedef cl_int           (CL_API_CALL* PFNCLFLUSHPROC)(cl_command_queue);
655typedef cl_int           (CL_API_CALL* PFNCLFINISHPROC)(cl_command_queue);
656typedef cl_int           (CL_API_CALL* PFNCLENQUEUEREADBUFFERPROC)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*);
657typedef cl_int           (CL_API_CALL* PFNCLENQUEUEWRITEBUFFERPROC)(cl_command_queue, cl_mem, cl_bool, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*);
658typedef cl_int           (CL_API_CALL* PFNCLENQUEUECOPYBUFFERPROC)(cl_command_queue, cl_mem, cl_mem, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event*);
659typedef cl_int           (CL_API_CALL* PFNCLENQUEUEREADIMAGEPROC)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*);
660typedef cl_int           (CL_API_CALL* PFNCLENQUEUEWRITEIMAGEPROC)(cl_command_queue, cl_mem, cl_bool, const size_t*, const size_t*, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*);
661typedef cl_int           (CL_API_CALL* PFNCLENQUEUECOPYIMAGEPROC)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*);
662typedef cl_int           (CL_API_CALL* PFNCLENQUEUECOPYIMAGETOBUFFERPROC)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, size_t, cl_uint, const cl_event*, cl_event*);
663typedef cl_int           (CL_API_CALL* PFNCLENQUEUECOPYBUFFERTOIMAGEPROC)(cl_command_queue, cl_mem, cl_mem, size_t, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*);
664typedef void             (CL_API_CALL* PFNCLENQUEUEMAPBUFFERPROC)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, size_t, size_t, cl_uint, const cl_event*, cl_event*, cl_int*);
665typedef void             (CL_API_CALL* PFNCLENQUEUEMAPIMAGEPROC)(cl_command_queue, cl_mem, cl_bool, cl_map_flags, const size_t *, const size_t *, size_t *, size_t *, cl_uint, const cl_event *, cl_event *, cl_int*);
666typedef cl_int           (CL_API_CALL* PFNCLENQUEUEUNMAPMEMOBJECTPROC)(cl_command_queue, cl_mem, void*, cl_uint, const cl_event*, cl_event*);
667typedef cl_int           (CL_API_CALL* PFNCLENQUEUENDRANGEKERNELPROC)(cl_command_queue, cl_kernel, cl_uint, const size_t*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*);
668typedef cl_int           (CL_API_CALL* PFNCLENQUEUETASKPROC)(cl_command_queue, cl_kernel, cl_uint, const cl_event*, cl_event*);
669typedef cl_int           (CL_API_CALL* PFNCLENQUEUENATIVEKERNELPROC)(cl_command_queue, void (CL_CALLBACK*)(void*), void*, size_t, cl_uint, const cl_mem*, const void**, cl_uint, const cl_event*, cl_event*);
670
671// 1.1
672typedef cl_mem           (CL_API_CALL* PFNCLCREATEIMAGE2DPROC)(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, void*, cl_int*);
673typedef cl_mem           (CL_API_CALL* PFNCLCREATEIMAGE3DPROC)(cl_context, cl_mem_flags, const cl_image_format*, size_t, size_t, size_t, size_t, size_t, void*, cl_int*);
674typedef cl_mem           (CL_API_CALL* PFNCLCREATESUBBUFFERPROC)(cl_mem, cl_mem_flags, cl_buffer_create_type, const void*, cl_int*);
675typedef cl_int           (CL_API_CALL* PFNCLSETMEMOBJECTDESTRUCTORCALLBACKPROC)(cl_mem, void (CL_CALLBACK*)(cl_mem, void*), void*);
676typedef cl_event         (CL_API_CALL* PFNCLCREATEUSEREVENTPROC)(cl_context, cl_int*);
677typedef cl_int           (CL_API_CALL* PFNCLSETUSEREVENTSTATUSPROC)(cl_event, cl_int);
678typedef cl_int           (CL_API_CALL* PFNCLSETEVENTCALLBACKPROC)(cl_event, cl_int, void (CL_CALLBACK*)(cl_event, cl_int, void*), void*);
679typedef cl_int           (CL_API_CALL* PFNCLENQUEUEREADBUFFERRECTPROC)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, void*, cl_uint, const cl_event*, cl_event*);
680typedef cl_int           (CL_API_CALL* PFNCLENQUEUEWRITEBUFFERRECTPROC)(cl_command_queue, cl_mem, cl_bool, const size_t *, const size_t *, const size_t *, size_t, size_t, size_t, size_t, const void*, cl_uint, const cl_event*, cl_event*);
681typedef cl_int           (CL_API_CALL* PFNCLENQUEUECOPYBUFFERRECTPROC)(cl_command_queue, cl_mem, cl_mem, const size_t*, const size_t*, const size_t*, size_t, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event*);
682
683// 1.2
684typedef cl_int           (CL_API_CALL* PFNCLCREATESUBDEVICESPROC)(cl_device_id, const cl_device_partition_property*, cl_uint, cl_device_id*, cl_uint*);
685typedef cl_int           (CL_API_CALL* PFNCLRETAINDEVICEPROC)(cl_device_id);
686typedef cl_int           (CL_API_CALL* PFNCLRELEASEDEVICEPROC)(cl_device_id);
687typedef cl_mem           (CL_API_CALL* PFNCLCREATEIMAGEPROC)(cl_context, cl_mem_flags, const cl_image_format*, const cl_image_desc*, void*, cl_int*);
688typedef cl_program       (CL_API_CALL* PFNCLCREATEPROGRAMWITHBUILTINKERNELSPROC)(cl_context, cl_uint, const cl_device_id*, const char*, cl_int*);
689typedef cl_int           (CL_API_CALL* PFNCLCOMPILEPROGRAMPROC)(cl_program, cl_uint, const cl_device_id*, const char*, cl_uint, const cl_program*, const char**, void (CL_CALLBACK*)(cl_program, void*), void*);
690typedef cl_program       (CL_API_CALL* PFNCLLINKPROGRAMPROC)(cl_context, cl_uint, const cl_device_id*, const char*, cl_uint, const cl_program*, void (CL_CALLBACK*)(cl_program, void*), void*, cl_int*);
691typedef cl_int           (CL_API_CALL* PFNCLUNLOADPLATFORMCOMPILERPROC)(cl_platform_id);
692typedef cl_int           (CL_API_CALL* PFNCLGETKERNELARGINFOPROC)(cl_kernel, cl_uint, cl_kernel_arg_info, size_t, void*, size_t*);
693typedef cl_int           (CL_API_CALL* PFNCLENQUEUEFILLBUFFERPROC)(cl_command_queue, cl_mem, const void*, size_t, size_t, size_t, cl_uint, const cl_event*, cl_event *);
694typedef cl_int           (CL_API_CALL* PFNCLENQUEUEFILLIMAGEPROC)(cl_command_queue, cl_mem, const void*, const size_t*, const size_t*, cl_uint, const cl_event*, cl_event*);
695typedef cl_int           (CL_API_CALL* PFNCLENQUEUEMIGRATEMEMOBJECTSPROC)(cl_command_queue, cl_uint, const cl_mem*, cl_mem_migration_flags, cl_uint, const cl_event *, cl_event*);
696typedef cl_int           (CL_API_CALL* PFNCLENQUEUEMARKERWITHWAITLISTPROC)(cl_command_queue, cl_uint, const cl_event*, cl_event*);
697typedef cl_int           (CL_API_CALL* PFNCLENQUEUEBARRIERWITHWAITLISTPROC)(cl_command_queue, cl_uint, const cl_event *, cl_event*);
698
699#define BX_CL_IMPORT_ALL_10 \
700         /* Platform API */ \
701         BX_CL_IMPORT_10(false, PFNCLGETPLATFORMIDSPROC,                  clGetPlatformIDs); \
702         BX_CL_IMPORT_10(false, PFNCLGETPLATFORMINFOPROC,                 clGetPlatformInfo); \
703         /* Device APIs */ \
704         BX_CL_IMPORT_10(false, PFNCLGETDEVICEIDSPROC,                    clGetDeviceIDs); \
705         BX_CL_IMPORT_10(false, PFNCLGETDEVICEINFOPROC,                   clGetDeviceInfo); \
706         /* Context APIs  */ \
707         BX_CL_IMPORT_10(false, PFNCLCREATECONTEXTPROC,                   clCreateContext); \
708         BX_CL_IMPORT_10(false, PFNCLCREATECONTEXTFROMTYPEPROC,           clCreateContextFromType); \
709         BX_CL_IMPORT_10(false, PFNCLRETAINCONTEXTPROC,                   clRetainContext); \
710         BX_CL_IMPORT_10(false, PFNCLRELEASECONTEXTPROC,                  clReleaseContext); \
711         BX_CL_IMPORT_10(false, PFNCLGETCONTEXTINFOPROC,                  clGetContextInfo); \
712         /* Command Queue APIs */ \
713         BX_CL_IMPORT_10(false, PFNCLCREATECOMMANDQUEUEPROC,              clCreateCommandQueue); \
714         BX_CL_IMPORT_10(false, PFNCLRETAINCOMMANDQUEUEPROC,              clRetainCommandQueue); \
715         BX_CL_IMPORT_10(false, PFNCLRELEASECOMMANDQUEUEPROC,             clReleaseCommandQueue); \
716         BX_CL_IMPORT_10(false, PFNCLGETCOMMANDQUEUEINFOPROC,             clGetCommandQueueInfo); \
717         /* Memory Object APIs */ \
718         BX_CL_IMPORT_10(false, PFNCLCREATEBUFFERPROC,                    clCreateBuffer); \
719         BX_CL_IMPORT_10(false, PFNCLRETAINMEMOBJECTPROC,                 clRetainMemObject); \
720         BX_CL_IMPORT_10(false, PFNCLRELEASEMEMOBJECTPROC,                clReleaseMemObject); \
721         BX_CL_IMPORT_10(false, PFNCLGETSUPPORTEDIMAGEFORMATSPROC,        clGetSupportedImageFormats); \
722         BX_CL_IMPORT_10(false, PFNCLGETMEMOBJECTINFOPROC,                clGetMemObjectInfo); \
723         BX_CL_IMPORT_10(false, PFNCLGETIMAGEINFOPROC,                    clGetImageInfo); \
724         /* Sampler APIs */ \
725         BX_CL_IMPORT_10(false, PFNCLCREATESAMPLERPROC,                   clCreateSampler); \
726         BX_CL_IMPORT_10(false, PFNCLRETAINSAMPLERPROC,                   clRetainSampler); \
727         BX_CL_IMPORT_10(false, PFNCLRELEASESAMPLERPROC,                  clReleaseSampler); \
728         BX_CL_IMPORT_10(false, PFNCLGETSAMPLERINFOPROC,                  clGetSamplerInfo); \
729         /* Program Object APIs  */ \
730         BX_CL_IMPORT_10(false, PFNCLCREATEPROGRAMWITHSOURCEPROC,         clCreateProgramWithSource); \
731         BX_CL_IMPORT_10(false, PFNCLCREATEPROGRAMWITHBINARYPROC,         clCreateProgramWithBinary); \
732         BX_CL_IMPORT_10(false, PFNCLRETAINPROGRAMPROC,                   clRetainProgram); \
733         BX_CL_IMPORT_10(false, PFNCLRELEASEPROGRAMPROC,                  clReleaseProgram); \
734         BX_CL_IMPORT_10(false, PFNCLBUILDPROGRAMPROC,                    clBuildProgram); \
735         BX_CL_IMPORT_10(false, PFNCLGETPROGRAMINFOPROC,                  clGetProgramInfo); \
736         BX_CL_IMPORT_10(false, PFNCLGETPROGRAMBUILDINFOPROC,             clGetProgramBuildInfo); \
737         /* Kernel Object APIs */ \
738         BX_CL_IMPORT_10(false, PFNCLCREATEKERNELPROC,                    clCreateKernel); \
739         BX_CL_IMPORT_10(false, PFNCLCREATEKERNELSINPROGRAMPROC,          clCreateKernelsInProgram); \
740         BX_CL_IMPORT_10(false, PFNCLRETAINKERNELPROC,                    clRetainKernel); \
741         BX_CL_IMPORT_10(false, PFNCLRELEASEKERNELPROC,                   clReleaseKernel); \
742         BX_CL_IMPORT_10(false, PFNCLSETKERNELARGPROC,                    clSetKernelArg); \
743         BX_CL_IMPORT_10(false, PFNCLGETKERNELINFOPROC,                   clGetKernelInfo); \
744         BX_CL_IMPORT_10(false, PFNCLGETKERNELWORKGROUPINFOPROC,          clGetKernelWorkGroupInfo); \
745         /* Event Object APIs */ \
746         BX_CL_IMPORT_10(false, PFNCLWAITFOREVENTSPROC,                   clWaitForEvents); \
747         BX_CL_IMPORT_10(false, PFNCLGETEVENTINFOPROC,                    clGetEventInfo); \
748         BX_CL_IMPORT_10(false, PFNCLRETAINEVENTPROC,                     clRetainEvent); \
749         BX_CL_IMPORT_10(false, PFNCLRELEASEEVENTPROC,                    clReleaseEvent); \
750         /* Profiling APIs */ \
751         BX_CL_IMPORT_10(false, PFNCLGETEVENTPROFILINGINFOPROC,           clGetEventProfilingInfo); \
752         /* Flush and Finish APIs */ \
753         BX_CL_IMPORT_10(false, PFNCLFLUSHPROC,                           clFlush); \
754         BX_CL_IMPORT_10(false, PFNCLFINISHPROC,                          clFinish); \
755         /* Enqueued Commands APIs */ \
756         BX_CL_IMPORT_10(false, PFNCLENQUEUEREADBUFFERPROC,               clEnqueueReadBuffer); \
757         BX_CL_IMPORT_10(false, PFNCLENQUEUEWRITEBUFFERPROC,              clEnqueueWriteBuffer); \
758         BX_CL_IMPORT_10(false, PFNCLENQUEUECOPYBUFFERPROC,               clEnqueueCopyBuffer); \
759         BX_CL_IMPORT_10(false, PFNCLENQUEUEREADIMAGEPROC,                clEnqueueReadImage); \
760         BX_CL_IMPORT_10(false, PFNCLENQUEUEWRITEIMAGEPROC,               clEnqueueWriteImage); \
761         BX_CL_IMPORT_10(false, PFNCLENQUEUECOPYIMAGEPROC,                clEnqueueCopyImage); \
762         BX_CL_IMPORT_10(false, PFNCLENQUEUECOPYIMAGETOBUFFERPROC,        clEnqueueCopyImageToBuffer); \
763         BX_CL_IMPORT_10(false, PFNCLENQUEUEMAPBUFFERPROC,                clEnqueueMapBuffer); \
764         BX_CL_IMPORT_10(false, PFNCLENQUEUEMAPIMAGEPROC,                 clEnqueueMapImage); \
765         BX_CL_IMPORT_10(false, PFNCLENQUEUEUNMAPMEMOBJECTPROC,           clEnqueueUnmapMemObject); \
766         BX_CL_IMPORT_10(false, PFNCLENQUEUENDRANGEKERNELPROC,            clEnqueueNDRangeKernel); \
767         BX_CL_IMPORT_10(false, PFNCLENQUEUETASKPROC,                     clEnqueueTask); \
768         BX_CL_IMPORT_10(false, PFNCLENQUEUENATIVEKERNELPROC,             clEnqueueNativeKernel); \
769         \
770         BX_CL_IMPORT_END
771
772#define BX_CL_IMPORT_ALL_11 \
773         /* Memory Object APIs */ \
774         BX_CL_IMPORT_11(false, PFNCLCREATEIMAGE2DPROC,                   clCreateImage2D); \
775         BX_CL_IMPORT_11(false, PFNCLCREATEIMAGE3DPROC,                   clCreateImage3D); \
776         BX_CL_IMPORT_11(false, PFNCLCREATESUBBUFFERPROC,                 clCreateSubBuffer); \
777         BX_CL_IMPORT_11(false, PFNCLSETMEMOBJECTDESTRUCTORCALLBACKPROC,  clSetMemObjectDestructorCallback); \
778         /* Event Object APIs */  \
779         BX_CL_IMPORT_11(false, PFNCLCREATEUSEREVENTPROC,                 clCreateUserEvent); \
780         BX_CL_IMPORT_11(false, PFNCLSETUSEREVENTSTATUSPROC,              clSetUserEventStatus); \
781         BX_CL_IMPORT_11(false, PFNCLSETEVENTCALLBACKPROC,                clSetEventCallback); \
782         /* Enqueued Commands APIs */ \
783         BX_CL_IMPORT_11(false, PFNCLENQUEUEREADBUFFERRECTPROC,           clEnqueueReadBufferRect); \
784         BX_CL_IMPORT_11(false, PFNCLENQUEUEWRITEBUFFERRECTPROC,          clEnqueueWriteBufferRect); \
785         BX_CL_IMPORT_11(false, PFNCLENQUEUECOPYBUFFERRECTPROC,           clEnqueueCopyBufferRect); \
786         \
787         BX_CL_IMPORT_END
788
789#define BX_CL_IMPORT_ALL_12 \
790         /* Device APIs */ \
791         BX_CL_IMPORT_12(false, PFNCLCREATESUBDEVICESPROC,                clCreateSubDevices); \
792         BX_CL_IMPORT_12(false, PFNCLRETAINDEVICEPROC,                    clRetainDevice); \
793         BX_CL_IMPORT_12(false, PFNCLRELEASEDEVICEPROC,                   clReleaseDevice); \
794         BX_CL_IMPORT_12(false, PFNCLCREATEIMAGEPROC,                     clCreateImage); \
795         /* Program Object APIs  */ \
796         BX_CL_IMPORT_12(false, PFNCLCREATEPROGRAMWITHBUILTINKERNELSPROC, clCreateProgramWithBuiltInKernels); \
797         BX_CL_IMPORT_12(false, PFNCLCOMPILEPROGRAMPROC,                  clCompileProgram); \
798         BX_CL_IMPORT_12(false, PFNCLLINKPROGRAMPROC,                     clLinkProgram); \
799         BX_CL_IMPORT_12(false, PFNCLUNLOADPLATFORMCOMPILERPROC,          clUnloadPlatformCompiler); \
800         /* Kernel Object APIs */ \
801         BX_CL_IMPORT_12(false, PFNCLGETKERNELARGINFOPROC,                clGetKernelArgInfo); \
802         /* Enqueued Commands APIs */ \
803         BX_CL_IMPORT_12(false, PFNCLENQUEUEFILLBUFFERPROC,               clEnqueueFillBuffer); \
804         BX_CL_IMPORT_12(false, PFNCLENQUEUEFILLIMAGEPROC,                clEnqueueFillImage); \
805         BX_CL_IMPORT_12(false, PFNCLENQUEUEMIGRATEMEMOBJECTSPROC,        clEnqueueMigrateMemObjects); \
806         BX_CL_IMPORT_12(false, PFNCLENQUEUEMARKERWITHWAITLISTPROC,       clEnqueueMarkerWithWaitList); \
807         BX_CL_IMPORT_12(false, PFNCLENQUEUEBARRIERWITHWAITLISTPROC,      clEnqueueBarrierWithWaitList); \
808         \
809         BX_CL_IMPORT_END
810
811#define BX_CL_IMPORT_ALL \
812         BX_CL_IMPORT_ALL_10 \
813         BX_CL_IMPORT_ALL_11 \
814         BX_CL_IMPORT_ALL_12 \
815         \
816         BX_CL_IMPORT_END
817
818#define BX_CL_IMPORT_10(_optional, _proto, _func) BX_CL_IMPORT(10, _optional, _proto, _func)
819#define BX_CL_IMPORT_11(_optional, _proto, _func) BX_CL_IMPORT(11, _optional, _proto, _func)
820#define BX_CL_IMPORT_12(_optional, _proto, _func) BX_CL_IMPORT(12, _optional, _proto, _func)
821#define BX_CL_IMPORT_END
822
823#define BX_CL_IMPORT(_version, _optional, _proto, _func) extern "C" _proto _func
824BX_CL_IMPORT_ALL
825#undef BX_CL_IMPORT
826
827#if defined(BX_CL_IMPLEMENTATION)
828extern "C"
829{
830#define BX_CL_IMPORT(_version, _optional, _proto, _func) _proto _func
831BX_CL_IMPORT_ALL
832#undef BX_CL_IMPORT
833};
834
835#include "os.h"
836
837namespace bx
838{
839   struct OpenCLContext
840   {
841      OpenCLContext()
842         : m_handle(NULL)
843         , m_refCount(0)
844      {
845      }
846
847      int32_t load()
848      {
849         if (NULL != m_handle)
850         {
851            int32_t ref = ++m_refCount;
852            return ref;
853         }
854
855         const char* filePath =
856#if BX_PLATFORM_LINUX
857            "libOpenCL.so"
858#elif BX_PLATFORM_OSX
859            "/Library/Frameworks/OpenCL.framework/OpenCL"
860#elif BX_PLATFORM_WINDOWS
861            "opencl.dll"
862#else
863            "??? unknown OpenCL platform ???"
864#endif // BX_PLATFORM_
865            ;
866
867         m_handle = bx::dlopen(filePath);
868         if (NULL == m_handle)
869         {
870            BX_TRACE("Unable to find OpenCL '%s' dynamic library.", filePath);
871            return 0;
872         }
873
874         m_refCount = 1;
875
876#define BX_CL_IMPORT(_version, _optional, _proto, _func) _func = (_proto)bx::dlsym(m_handle, #_func)
877         BX_CL_IMPORT_ALL
878#undef BX_CL_IMPORT
879
880         return 1;
881      }
882
883      int32_t unload()
884      {
885         BX_CHECK(m_refCount > 0 && NULL != m_handle, "OpenCL is not loaded.");
886
887         int32_t ref = --m_refCount;
888         if (0 == ref)
889         {
890            dlclose(m_handle);
891            m_handle = NULL;
892         }
893
894         return ref;
895      }
896
897      void* m_handle;
898      int32_t m_refCount;
899   };
900
901   static OpenCLContext s_ctx;
902
903   int32_t clLoad()
904   {
905      return s_ctx.load();
906   }
907
908   int32_t clUnload()
909   {
910      return s_ctx.unload();
911   }
912
913} // namespace bx
914
915#undef BX_CL_IMPORT_ALL
916#undef BX_CL_IMPORT_ALL_10
917#undef BX_CL_IMPORT_ALL_11
918#undef BX_CL_IMPORT_ALL_12
919#undef BX_CL_IMPORT_END
920
921#endif // defined(BX_CL_IMPLEMENTATION)
922
923#endif // __OPENCL_CL_H
924
925#endif // BX_CL_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/cl.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/readerwriter.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5 
6#ifndef BX_READERWRITER_H_HEADER_GUARD
7#define BX_READERWRITER_H_HEADER_GUARD
8
9#include <stdio.h>
10#include <string.h>
11
12#include "bx.h"
13#include "uint32_t.h"
14
15#if BX_COMPILER_MSVC
16#   define fseeko64 _fseeki64
17#   define ftello64 _ftelli64
18#elif BX_PLATFORM_ANDROID || BX_PLATFORM_FREEBSD || BX_PLATFORM_IOS || BX_PLATFORM_OSX || BX_PLATFORM_QNX
19#   define fseeko64 fseeko
20#   define ftello64 ftello
21#endif // BX_
22
23namespace bx
24{
25   struct Whence
26   {
27      enum Enum
28      {
29         Begin,
30         Current,
31         End,
32      };
33   };
34
35   struct BX_NO_VTABLE ReaderI
36   {
37      virtual ~ReaderI() = 0;
38      virtual int32_t read(void* _data, int32_t _size) = 0;
39   };
40
41   inline ReaderI::~ReaderI()
42   {
43   }
44
45   struct BX_NO_VTABLE WriterI
46   {
47      virtual ~WriterI() = 0;
48      virtual int32_t write(const void* _data, int32_t _size) = 0;
49   };
50
51   inline WriterI::~WriterI()
52   {
53   }
54
55   struct BX_NO_VTABLE SeekerI
56   {
57      virtual ~SeekerI() = 0;
58      virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) = 0;
59   };
60
61   inline SeekerI::~SeekerI()
62   {
63   }
64
65   /// Read data.
66   inline int32_t read(ReaderI* _reader, void* _data, int32_t _size)
67   {
68      return _reader->read(_data, _size);
69   }
70
71   /// Write value.
72   template<typename Ty>
73   inline int32_t read(ReaderI* _reader, Ty& _value)
74   {
75      BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) );
76      return _reader->read(&_value, sizeof(Ty) );
77   }
78
79   /// Read value and converts it to host endianess. _fromLittleEndian specifies
80   /// underlying stream endianess.
81   template<typename Ty>
82   inline int32_t readHE(ReaderI* _reader, Ty& _value, bool _fromLittleEndian)
83   {
84      BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) );
85      Ty value;
86      int32_t result = _reader->read(&value, sizeof(Ty) );
87      _value = toHostEndian(value, _fromLittleEndian);
88      return result;
89   }
90
91   /// Write data.
92   inline int32_t write(WriterI* _writer, const void* _data, int32_t _size)
93   {
94      return _writer->write(_data, _size);
95   }
96
97   /// Write value.
98   template<typename Ty>
99   inline int32_t write(WriterI* _writer, const Ty& _value)
100   {
101      BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) );
102      return _writer->write(&_value, sizeof(Ty) );
103   }
104
105   /// Write value as little endian.
106   template<typename Ty>
107   inline int32_t writeLE(WriterI* _writer, const Ty& _value)
108   {
109      BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) );
110      Ty value = toLittleEndian(_value);
111      int32_t result = _writer->write(&value, sizeof(Ty) );
112      return result;
113   }
114
115   /// Write value as big endian.
116   template<typename Ty>
117   inline int32_t writeBE(WriterI* _writer, const Ty& _value)
118   {
119      BX_STATIC_ASSERT(BX_TYPE_IS_POD(Ty) );
120      Ty value = toBigEndian(_value);
121      int32_t result = _writer->write(&value, sizeof(Ty) );
122      return result;
123   }
124
125   /// Skip _offset bytes forward.
126   inline int64_t skip(SeekerI* _seeker, int64_t _offset)
127   {
128      return _seeker->seek(_offset, Whence::Current);
129   }
130
131   /// Seek to any position in file.
132   inline int64_t seek(SeekerI* _seeker, int64_t _offset = 0, Whence::Enum _whence = Whence::Current)
133   {
134      return _seeker->seek(_offset, _whence);
135   }
136
137   /// Returns size of file.
138   inline int64_t getSize(SeekerI* _seeker)
139   {
140      int64_t offset = _seeker->seek();
141      int64_t size = _seeker->seek(0, Whence::End);
142      _seeker->seek(offset, Whence::Begin);
143      return size;
144   }
145
146   struct BX_NO_VTABLE ReaderSeekerI : public ReaderI, public SeekerI
147   {
148   };
149
150   struct BX_NO_VTABLE WriterSeekerI : public WriterI, public SeekerI
151   {
152   };
153
154   struct BX_NO_VTABLE FileReaderI : public ReaderSeekerI
155   {
156      virtual int32_t open(const char* _filePath) = 0;
157      virtual int32_t close() = 0;
158   };
159
160   struct BX_NO_VTABLE FileWriterI : public WriterSeekerI
161   {
162      virtual int32_t open(const char* _filePath, bool _append = false) = 0;
163      virtual int32_t close() = 0;
164   };
165
166   inline int32_t open(FileReaderI* _reader, const char* _filePath)
167   {
168      return _reader->open(_filePath);
169   }
170
171   inline int32_t close(FileReaderI* _reader)
172   {
173      return _reader->close();
174   }
175
176   inline int32_t open(FileWriterI* _writer, const char* _filePath, bool _append = false)
177   {
178      return _writer->open(_filePath, _append);
179   }
180
181   inline int32_t close(FileWriterI* _writer)
182   {
183      return _writer->close();
184   }
185
186   struct BX_NO_VTABLE MemoryBlockI
187   {
188      virtual void* more(uint32_t _size = 0) = 0;
189      virtual uint32_t getSize() = 0;
190   };
191
192   class StaticMemoryBlock : public MemoryBlockI
193   {
194   public:
195      StaticMemoryBlock(void* _data, uint32_t _size)
196         : m_data(_data)
197         , m_size(_size)
198      {
199      }
200
201      virtual ~StaticMemoryBlock()
202      {
203      }
204
205      virtual void* more(uint32_t /*_size*/ = 0) BX_OVERRIDE
206      {
207         return m_data;
208      }
209
210      virtual uint32_t getSize() BX_OVERRIDE
211      {
212         return m_size;
213      }
214
215   private:
216      void* m_data;
217      uint32_t m_size;
218   };
219
220   class SizerWriter : public WriterSeekerI
221   {
222   public:
223      SizerWriter()
224         : m_pos(0)
225         , m_top(0)
226      {
227      }
228
229      virtual ~SizerWriter()
230      {
231      }
232
233      virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE
234      {
235         switch (_whence)
236         {
237         case Whence::Begin:
238            m_pos = _offset;
239            break;
240
241         case Whence::Current:
242            m_pos = int64_clamp(m_pos + _offset, 0, m_top);
243            break;
244
245         case Whence::End:
246            m_pos = int64_clamp(m_top - _offset, 0, m_top);
247            break;
248         }
249
250         return m_pos;
251      }
252
253      virtual int32_t write(const void* /*_data*/, int32_t _size) BX_OVERRIDE
254      {
255         int32_t morecore = int32_t(m_pos - m_top) + _size;
256
257         if (0 < morecore)
258         {
259            m_top += morecore;
260         }
261
262         int64_t reminder = m_top-m_pos;
263         int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) );
264         m_pos += size;
265         return size;
266      }
267
268   private:
269      int64_t m_pos;
270      int64_t m_top;
271   };
272
273   class MemoryReader : public ReaderSeekerI
274   {
275   public:
276      MemoryReader(const void* _data, uint32_t _size)
277         : m_data( (const uint8_t*)_data)
278         , m_pos(0)
279         , m_top(_size)
280      {
281      }
282
283      virtual ~MemoryReader()
284      {
285      }
286
287      virtual int64_t seek(int64_t _offset, Whence::Enum _whence) BX_OVERRIDE
288      {
289         switch (_whence)
290         {
291            case Whence::Begin:
292               m_pos = _offset;
293               break;
294
295            case Whence::Current:
296               m_pos = int64_clamp(m_pos + _offset, 0, m_top);
297               break;
298
299            case Whence::End:
300               m_pos = int64_clamp(m_top - _offset, 0, m_top);
301               break;
302         }
303
304         return m_pos;
305      }
306
307      virtual int32_t read(void* _data, int32_t _size) BX_OVERRIDE
308      {
309         int64_t reminder = m_top-m_pos;
310         int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) );
311         memcpy(_data, &m_data[m_pos], size);
312         m_pos += size;
313         return size;
314      }
315
316      const uint8_t* getDataPtr() const
317      {
318         return &m_data[m_pos];
319      }
320
321      int64_t getPos() const
322      {
323         return m_pos;
324      }
325
326      int64_t remaining() const
327      {
328         return m_top-m_pos;
329      }
330
331   private:
332      const uint8_t* m_data;
333      int64_t m_pos;
334      int64_t m_top;
335   };
336
337   class MemoryWriter : public WriterSeekerI
338   {
339   public:
340      MemoryWriter(MemoryBlockI* _memBlock)
341         : m_memBlock(_memBlock)
342         , m_data(NULL)
343         , m_pos(0)
344         , m_top(0)
345         , m_size(0)
346      {
347      }
348
349      virtual ~MemoryWriter()
350      {
351      }
352
353      virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE
354      {
355         switch (_whence)
356         {
357            case Whence::Begin:
358               m_pos = _offset;
359               break;
360
361            case Whence::Current:
362               m_pos = int64_clamp(m_pos + _offset, 0, m_top);
363               break;
364
365            case Whence::End:
366               m_pos = int64_clamp(m_top - _offset, 0, m_top);
367               break;
368         }
369
370         return m_pos;
371      }
372
373      virtual int32_t write(const void* _data, int32_t _size) BX_OVERRIDE
374      {
375         int32_t morecore = int32_t(m_pos - m_size) + _size;
376
377         if (0 < morecore)
378         {
379            morecore = BX_ALIGN_MASK(morecore, 0xfff);
380            m_data = (uint8_t*)m_memBlock->more(morecore);
381            m_size = m_memBlock->getSize();
382         }
383
384         int64_t reminder = m_size-m_pos;
385         int32_t size = uint32_min(_size, int32_t(reminder > INT32_MAX ? INT32_MAX : reminder) );
386         memcpy(&m_data[m_pos], _data, size);
387         m_pos += size;
388         m_top = int64_max(m_top, m_pos);
389         return size;
390      }
391
392   private:
393      MemoryBlockI* m_memBlock;
394      uint8_t* m_data;
395      int64_t m_pos;
396      int64_t m_top;
397      int64_t m_size;
398   };
399
400   class StaticMemoryBlockWriter : public MemoryWriter
401   {
402   public:
403      StaticMemoryBlockWriter(void* _data, uint32_t _size)
404         : MemoryWriter(&m_smb)
405         , m_smb(_data, _size)
406      {
407      }
408
409      ~StaticMemoryBlockWriter()
410      {
411      }
412
413   private:
414      StaticMemoryBlock m_smb;
415   };
416
417#if BX_CONFIG_CRT_FILE_READER_WRITER
418   class CrtFileReader : public FileReaderI
419   {
420   public:
421      CrtFileReader()
422         : m_file(NULL)
423      {
424      }
425
426      virtual ~CrtFileReader()
427      {
428      }
429
430      virtual int32_t open(const char* _filePath) BX_OVERRIDE
431      {
432         m_file = fopen(_filePath, "rb");
433         return NULL == m_file;
434      }
435
436      virtual int32_t close() BX_OVERRIDE
437      {
438         fclose(m_file);
439         return 0;
440      }
441
442      virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE
443      {
444         fseeko64(m_file, _offset, _whence);
445         return ftello64(m_file);
446      }
447
448      virtual int32_t read(void* _data, int32_t _size) BX_OVERRIDE
449      {
450         return (int32_t)fread(_data, 1, _size, m_file);
451      }
452
453   private:
454      FILE* m_file;
455   };
456
457   class CrtFileWriter : public FileWriterI
458   {
459   public:
460      CrtFileWriter()
461         : m_file(NULL)
462      {
463      }
464
465      virtual ~CrtFileWriter()
466      {
467      }
468
469      virtual int32_t open(const char* _filePath, bool _append = false) BX_OVERRIDE
470      {
471         if (_append)
472         {
473            m_file = fopen(_filePath, "ab");
474         }
475         else
476         {
477            m_file = fopen(_filePath, "wb");
478         }
479
480         return NULL == m_file;
481      }
482
483      virtual int32_t close() BX_OVERRIDE
484      {
485         fclose(m_file);
486         return 0;
487      }
488
489      virtual int64_t seek(int64_t _offset = 0, Whence::Enum _whence = Whence::Current) BX_OVERRIDE
490      {
491         fseeko64(m_file, _offset, _whence);
492         return ftello64(m_file);
493      }
494
495      virtual int32_t write(const void* _data, int32_t _size) BX_OVERRIDE
496      {
497         return (int32_t)fwrite(_data, 1, _size, m_file);
498      }
499
500   private:
501      FILE* m_file;
502   };
503#endif // BX_CONFIG_CRT_FILE_READER_WRITER
504
505} // namespace bx
506
507#endif // BX_READERWRITER_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/readerwriter.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/fpumath.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6// FPU math lib
7
8#ifndef BX_FPU_MATH_H_HEADER_GUARD
9#define BX_FPU_MATH_H_HEADER_GUARD
10
11#define _USE_MATH_DEFINES
12#include <math.h>
13#include <string.h>
14
15namespace bx
16{
17   inline float toRad(float _deg)
18   {
19      return _deg * float(M_PI / 180.0);
20   }
21
22   inline float toDeg(float _rad)
23   {
24      return _rad * float(180.0 / M_PI);
25   }
26
27   inline float fmin(float _a, float _b)
28   {
29      return _a < _b ? _a : _b;
30   }
31
32   inline float fmax(float _a, float _b)
33   {
34      return _a > _b ? _a : _b;
35   }
36
37   inline float fmin3(float _a, float _b, float _c)
38   {
39      return fmin(_a, fmin(_b, _c) );
40   }
41
42   inline float fmax3(float _a, float _b, float _c)
43   {
44      return fmax(_a, fmax(_b, _c) );
45   }
46
47   inline float fclamp(float _a, float _min, float _max)
48   {
49      return fmin(fmax(_a, _min), _max);
50   }
51
52   inline float fsaturate(float _a)
53   {
54      return fclamp(_a, 0.0f, 1.0f);
55   }
56
57   inline float flerp(float _a, float _b, float _t)
58   {
59      return _a + (_b - _a) * _t;
60   }
61
62   inline float fsign(float _a)
63   {
64      return _a < 0.0f ? -1.0f : 1.0f;
65   }
66
67   inline float fstep(float _edge, float _a)
68   {
69      return _a < _edge ? 0.0f : 1.0f;
70   }
71
72   inline float fpulse(float _a, float _start, float _end)
73   {
74      return fstep(_a, _start) - fstep(_a, _end);
75   }
76
77   inline float fabsolute(float _a)
78   {
79      return fabsf(_a);
80   }
81
82   inline float fsqrt(float _a)
83   {
84      return sqrtf(_a);
85   }
86
87   inline float ffract(float _a)
88   {
89      return _a - floorf(_a);
90   }
91
92   inline void vec3Move(float* __restrict _result, const float* __restrict _a)
93   {
94      _result[0] = _a[0];
95      _result[1] = _a[1];
96      _result[2] = _a[2];
97   }
98
99   inline void vec3Abs(float* __restrict _result, const float* __restrict _a)
100   {
101      _result[0] = fabsolute(_a[0]);
102      _result[1] = fabsolute(_a[1]);
103      _result[2] = fabsolute(_a[2]);
104   }
105
106   inline void vec3Neg(float* __restrict _result, const float* __restrict _a)
107   {
108      _result[0] = -_a[0];
109      _result[1] = -_a[1];
110      _result[2] = -_a[2];
111   }
112
113   inline void vec3Add(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
114   {
115      _result[0] = _a[0] + _b[0];
116      _result[1] = _a[1] + _b[1];
117      _result[2] = _a[2] + _b[2];
118   }
119
120   inline void vec3Sub(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
121   {
122      _result[0] = _a[0] - _b[0];
123      _result[1] = _a[1] - _b[1];
124      _result[2] = _a[2] - _b[2];
125   }
126
127   inline void vec3Mul(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
128   {
129      _result[0] = _a[0] * _b[0];
130      _result[1] = _a[1] * _b[1];
131      _result[2] = _a[2] * _b[2];
132   }
133
134   inline void vec3Mul(float* __restrict _result, const float* __restrict _a, float _b)
135   {
136      _result[0] = _a[0] * _b;
137      _result[1] = _a[1] * _b;
138      _result[2] = _a[2] * _b;
139   }
140
141   inline float vec3Dot(const float* __restrict _a, const float* __restrict _b)
142   {
143      return _a[0]*_b[0] + _a[1]*_b[1] + _a[2]*_b[2];
144   }
145
146   inline void vec3Cross(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
147   {
148      _result[0] = _a[1]*_b[2] - _a[2]*_b[1];
149      _result[1] = _a[2]*_b[0] - _a[0]*_b[2];
150      _result[2] = _a[0]*_b[1] - _a[1]*_b[0];
151   }
152
153   inline float vec3Length(const float* _a)
154   {
155      return fsqrt(vec3Dot(_a, _a) );
156   }
157
158   inline float vec3Norm(float* __restrict _result, const float* __restrict _a)
159   {
160      const float len = vec3Length(_a);
161      const float invLen = 1.0f/len;
162      _result[0] = _a[0] * invLen;
163      _result[1] = _a[1] * invLen;
164      _result[2] = _a[2] * invLen;
165      return len;
166   }
167
168   inline void mtxIdentity(float* _result)
169   {
170      memset(_result, 0, sizeof(float)*16);
171      _result[0] = _result[5] = _result[10] = _result[15] = 1.0f;
172   }
173
174   inline void mtxTranslate(float* _result, float _tx, float _ty, float _tz)
175   {
176      mtxIdentity(_result);
177      _result[12] = _tx;
178      _result[13] = _ty;
179      _result[14] = _tz;
180   }
181
182   inline void mtxScale(float* _result, float _sx, float _sy, float _sz)
183   {
184      memset(_result, 0, sizeof(float) * 16);
185      _result[0]  = _sx;
186      _result[5]  = _sy;
187      _result[10] = _sz;
188      _result[15] = 1.0f;
189   }
190
191   inline void mtxLookAt(float* __restrict _result, const float* __restrict _eye, const float* __restrict _at, const float* __restrict _up = NULL)
192   {
193      float tmp[4];
194      vec3Sub(tmp, _at, _eye);
195
196      float view[4];
197      vec3Norm(view, tmp);
198
199      float up[3] = { 0.0f, 1.0f, 0.0f };
200      if (NULL != _up)
201      {
202         up[0] = _up[0];
203         up[1] = _up[1];
204         up[2] = _up[2];
205      }
206      vec3Cross(tmp, up, view);
207
208      float right[4];
209      vec3Norm(right, tmp);
210
211      vec3Cross(up, view, right);
212
213      memset(_result, 0, sizeof(float)*16);
214      _result[ 0] = right[0];
215      _result[ 1] = up[0];
216      _result[ 2] = view[0];
217
218      _result[ 4] = right[1];
219      _result[ 5] = up[1];
220      _result[ 6] = view[1];
221
222      _result[ 8] = right[2];
223      _result[ 9] = up[2];
224      _result[10] = view[2];
225
226      _result[12] = -vec3Dot(right, _eye);
227      _result[13] = -vec3Dot(up, _eye);
228      _result[14] = -vec3Dot(view, _eye);
229      _result[15] = 1.0f;
230   }
231
232   inline void mtxProj(float* _result, float _fovy, float _aspect, float _near, float _far)
233   {
234      const float height = 1.0f/tanf(_fovy*( (float)M_PI/180.0f)*0.5f);
235      const float width = height * 1.0f/_aspect;
236      const float aa = _far/(_far-_near);
237      const float bb = -_near * aa;
238
239      memset(_result, 0, sizeof(float)*16);
240      _result[0] = width;
241      _result[5] = height;
242      _result[10] = aa;
243      _result[11] = 1.0f;
244      _result[14] = bb;
245   }
246
247   inline void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far)
248   {
249      const float aa = 2.0f/(_right - _left);
250      const float bb = 2.0f/(_top - _bottom);
251      const float cc = 1.0f/(_far - _near);
252      const float dd = (_left + _right)/(_left - _right);
253      const float ee = (_top + _bottom)/(_bottom - _top);
254      const float ff = _near / (_near - _far);
255
256      memset(_result, 0, sizeof(float)*16);
257      _result[0] = aa;
258      _result[5] = bb;
259      _result[10] = cc;
260      _result[12] = dd;
261      _result[13] = ee;
262      _result[14] = ff;
263      _result[15] = 1.0f;
264   }
265
266   inline void mtxRotateX(float* _result, float _ax)
267   {
268      const float sx = sinf(_ax);
269      const float cx = cosf(_ax);
270
271      memset(_result, 0, sizeof(float)*16);
272      _result[ 0] = 1.0f;
273      _result[ 5] = cx;
274      _result[ 6] = -sx;
275      _result[ 9] = sx;
276      _result[10] = cx;
277      _result[15] = 1.0f;
278   }
279
280   inline void mtxRotateY(float* _result, float _ay)
281   {
282      const float sy = sinf(_ay);
283      const float cy = cosf(_ay);
284
285      memset(_result, 0, sizeof(float)*16);
286      _result[ 0] = cy;
287      _result[ 2] = sy;
288      _result[ 5] = 1.0f;
289      _result[ 8] = -sy;
290      _result[10] = cy;
291      _result[15] = 1.0f;
292   }
293
294   inline void mtxRotateZ(float* _result, float _az)
295   {
296      const float sz = sinf(_az);
297      const float cz = cosf(_az);
298
299      memset(_result, 0, sizeof(float)*16);
300      _result[ 0] = cz;
301      _result[ 1] = -sz;
302      _result[ 4] = sz;
303      _result[ 5] = cz;
304      _result[10] = 1.0f;
305      _result[15] = 1.0f;
306   }
307
308   inline void mtxRotateXY(float* _result, float _ax, float _ay)
309   {
310      const float sx = sinf(_ax);
311      const float cx = cosf(_ax);
312      const float sy = sinf(_ay);
313      const float cy = cosf(_ay);
314
315      memset(_result, 0, sizeof(float)*16);
316      _result[ 0] = cy;
317      _result[ 2] = sy;
318      _result[ 4] = sx*sy;
319      _result[ 5] = cx;
320      _result[ 6] = -sx*cy;
321      _result[ 8] = -cx*sy;
322      _result[ 9] = sx;
323      _result[10] = cx*cy;
324      _result[15] = 1.0f;
325   }
326
327   inline void mtxRotateXYZ(float* _result, float _ax, float _ay, float _az)
328   {
329      const float sx = sinf(_ax);
330      const float cx = cosf(_ax);
331      const float sy = sinf(_ay);
332      const float cy = cosf(_ay);
333      const float sz = sinf(_az);
334      const float cz = cosf(_az);
335
336      memset(_result, 0, sizeof(float)*16);
337      _result[ 0] = cy*cz;
338      _result[ 1] = -cy*sz;
339      _result[ 2] = sy;
340      _result[ 4] = cz*sx*sy + cx*sz;
341      _result[ 5] = cx*cz - sx*sy*sz;
342      _result[ 6] = -cy*sx;
343      _result[ 8] = -cx*cz*sy + sx*sz;
344      _result[ 9] = cz*sx + cx*sy*sz;
345      _result[10] = cx*cy;
346      _result[15] = 1.0f;
347   }
348
349   inline void mtxRotateZYX(float* _result, float _ax, float _ay, float _az)
350   {
351      const float sx = sinf(_ax);
352      const float cx = cosf(_ax);
353      const float sy = sinf(_ay);
354      const float cy = cosf(_ay);
355      const float sz = sinf(_az);
356      const float cz = cosf(_az);
357
358      memset(_result, 0, sizeof(float)*16);
359      _result[ 0] = cy*cz;
360      _result[ 1] = cz*sx*sy-cx*sz;
361      _result[ 2] = cx*cz*sy+sx*sz;
362      _result[ 4] = cy*sz;
363      _result[ 5] = cx*cz + sx*sy*sz;
364      _result[ 6] = -cz*sx + cx*sy*sz;
365      _result[ 8] = -sy;
366      _result[ 9] = cy*sx;
367      _result[10] = cx*cy;
368      _result[15] = 1.0f;
369   };
370
371   inline void mtxSRT(float* _result, float _sx, float _sy, float _sz, float _ax, float _ay, float _az, float _tx, float _ty, float _tz)
372   {
373      const float sx = sinf(_ax);
374      const float cx = cosf(_ax);
375      const float sy = sinf(_ay);
376      const float cy = cosf(_ay);
377      const float sz = sinf(_az);
378      const float cz = cosf(_az);
379
380      const float sxsz = sx*sz;
381      const float cycz = cy*cz;
382
383      _result[ 0] = _sx * (cycz - sxsz*sy);
384      _result[ 1] = _sx * -cx*sz;
385      _result[ 2] = _sx * (cz*sy + cy*sxsz);
386      _result[ 3] = 0.0f;
387
388      _result[ 4] = _sy * (cz*sx*sy + cy*sz);
389      _result[ 5] = _sy * cx*cz;
390      _result[ 6] = _sy * (sy*sz -cycz*sx);
391      _result[ 7] = 0.0f;
392
393      _result[ 8] = _sz * -cx*sy;
394      _result[ 9] = _sz * sx;
395      _result[10] = _sz * cx*cy;
396      _result[11] = 0.0f;
397
398      _result[12] = _tx;
399      _result[13] = _ty;
400      _result[14] = _tz;
401      _result[15] = 1.0f;
402   }
403
404   inline void vec3MulMtx(float* __restrict _result, const float* __restrict _vec, const float* __restrict _mat)
405   {
406      _result[0] = _vec[0] * _mat[ 0] + _vec[1] * _mat[4] + _vec[2] * _mat[ 8] + _mat[12];
407      _result[1] = _vec[0] * _mat[ 1] + _vec[1] * _mat[5] + _vec[2] * _mat[ 9] + _mat[13];
408      _result[2] = _vec[0] * _mat[ 2] + _vec[1] * _mat[6] + _vec[2] * _mat[10] + _mat[14];
409   }
410
411   inline void vec3MulMtxH(float* __restrict _result, const float* __restrict _vec, const float* __restrict _mat)
412   {
413      float xx = _vec[0] * _mat[ 0] + _vec[1] * _mat[4] + _vec[2] * _mat[ 8] + _mat[12];
414      float yy = _vec[0] * _mat[ 1] + _vec[1] * _mat[5] + _vec[2] * _mat[ 9] + _mat[13];
415      float zz = _vec[0] * _mat[ 2] + _vec[1] * _mat[6] + _vec[2] * _mat[10] + _mat[14];
416      float ww = _vec[0] * _mat[ 3] + _vec[1] * _mat[7] + _vec[2] * _mat[11] + _mat[15];
417      float invW = fsign(ww)/ww;
418      _result[0] = xx*invW;
419      _result[1] = yy*invW;
420      _result[2] = zz*invW;
421   }
422
423   inline void vec4MulMtx(float* __restrict _result, const float* __restrict _vec, const float* __restrict _mat)
424   {
425      _result[0] = _vec[0] * _mat[ 0] + _vec[1] * _mat[4] + _vec[2] * _mat[ 8] + _vec[3] * _mat[12];
426      _result[1] = _vec[0] * _mat[ 1] + _vec[1] * _mat[5] + _vec[2] * _mat[ 9] + _vec[3] * _mat[13];
427      _result[2] = _vec[0] * _mat[ 2] + _vec[1] * _mat[6] + _vec[2] * _mat[10] + _vec[3] * _mat[14];
428      _result[3] = _vec[0] * _mat[ 3] + _vec[1] * _mat[7] + _vec[2] * _mat[11] + _vec[3] * _mat[15];
429   }
430
431   inline void mtxMul(float* __restrict _result, const float* __restrict _a, const float* __restrict _b)
432   {
433      vec4MulMtx(&_result[ 0], &_a[ 0], _b);
434      vec4MulMtx(&_result[ 4], &_a[ 4], _b);
435      vec4MulMtx(&_result[ 8], &_a[ 8], _b);
436      vec4MulMtx(&_result[12], &_a[12], _b);
437   }
438
439   inline void mtxTranspose(float* __restrict _result, const float* __restrict _a)
440   {
441      _result[ 0] = _a[ 0];
442      _result[ 4] = _a[ 1];
443      _result[ 8] = _a[ 2];
444      _result[12] = _a[ 3];
445      _result[ 1] = _a[ 4];
446      _result[ 5] = _a[ 5];
447      _result[ 9] = _a[ 6];
448      _result[13] = _a[ 7];
449      _result[ 2] = _a[ 8];
450      _result[ 6] = _a[ 9];
451      _result[10] = _a[10];
452      _result[14] = _a[11];
453      _result[ 3] = _a[12];
454      _result[ 7] = _a[13];
455      _result[11] = _a[14];
456      _result[15] = _a[15];
457   }
458
459   inline void mtx3Inverse(float* __restrict _result, const float* __restrict _a)
460   {
461      float xx = _a[0];
462      float xy = _a[1];
463      float xz = _a[2];
464      float yx = _a[3];
465      float yy = _a[4];
466      float yz = _a[5];
467      float zx = _a[6];
468      float zy = _a[7];
469      float zz = _a[8];
470
471      float det = 0.0f;
472      det += xx * (yy*zz - yz*zy);
473      det -= xy * (yx*zz - yz*zx);
474      det += xz * (yx*zy - yy*zx);
475
476      float invDet = 1.0f/det;
477
478      _result[0] = +(yy*zz - yz*zy) * invDet;
479      _result[1] = -(xy*zz - xz*zy) * invDet;
480      _result[2] = +(xy*yz - xz*yy) * invDet;
481
482      _result[3] = -(yx*zz - yz*zx) * invDet;
483      _result[4] = +(xx*zz - xz*zx) * invDet;
484      _result[5] = -(xx*yz - xz*yx) * invDet;
485
486      _result[6] = +(yx*zy - yy*zx) * invDet;
487      _result[7] = -(xx*zy - xy*zx) * invDet;
488      _result[8] = +(xx*yy - xy*yx) * invDet;
489   }
490
491   inline void mtxInverse(float* __restrict _result, const float* __restrict _a)
492   {
493      float xx = _a[ 0];
494      float xy = _a[ 1];
495      float xz = _a[ 2];
496      float xw = _a[ 3];
497      float yx = _a[ 4];
498      float yy = _a[ 5];
499      float yz = _a[ 6];
500      float yw = _a[ 7];
501      float zx = _a[ 8];
502      float zy = _a[ 9];
503      float zz = _a[10];
504      float zw = _a[11];
505      float wx = _a[12];
506      float wy = _a[13];
507      float wz = _a[14];
508      float ww = _a[15];
509
510      float det = 0.0f;
511      det += xx * (yy*(zz*ww - zw*wz) - yz*(zy*ww - zw*wy) + yw*(zy*wz - zz*wy) );
512      det -= xy * (yx*(zz*ww - zw*wz) - yz*(zx*ww - zw*wx) + yw*(zx*wz - zz*wx) );
513      det += xz * (yx*(zy*ww - zw*wy) - yy*(zx*ww - zw*wx) + yw*(zx*wy - zy*wx) );
514      det -= xw * (yx*(zy*wz - zz*wy) - yy*(zx*wz - zz*wx) + yz*(zx*wy - zy*wx) );
515
516      float invDet = 1.0f/det;
517
518      _result[ 0] = +(yy*(zz*ww - wz*zw) - yz*(zy*ww - wy*zw) + yw*(zy*wz - wy*zz) ) * invDet;
519      _result[ 1] = -(xy*(zz*ww - wz*zw) - xz*(zy*ww - wy*zw) + xw*(zy*wz - wy*zz) ) * invDet;
520      _result[ 2] = +(xy*(yz*ww - wz*yw) - xz*(yy*ww - wy*yw) + xw*(yy*wz - wy*yz) ) * invDet;
521      _result[ 3] = -(xy*(yz*zw - zz*yw) - xz*(yy*zw - zy*yw) + xw*(yy*zz - zy*yz) ) * invDet;
522
523      _result[ 4] = -(yx*(zz*ww - wz*zw) - yz*(zx*ww - wx*zw) + yw*(zx*wz - wx*zz) ) * invDet;
524      _result[ 5] = +(xx*(zz*ww - wz*zw) - xz*(zx*ww - wx*zw) + xw*(zx*wz - wx*zz) ) * invDet;
525      _result[ 6] = -(xx*(yz*ww - wz*yw) - xz*(yx*ww - wx*yw) + xw*(yx*wz - wx*yz) ) * invDet;
526      _result[ 7] = +(xx*(yz*zw - zz*yw) - xz*(yx*zw - zx*yw) + xw*(yx*zz - zx*yz) ) * invDet;
527
528      _result[ 8] = +(yx*(zy*ww - wy*zw) - yy*(zx*ww - wx*zw) + yw*(zx*wy - wx*zy) ) * invDet;
529      _result[ 9] = -(xx*(zy*ww - wy*zw) - xy*(zx*ww - wx*zw) + xw*(zx*wy - wx*zy) ) * invDet;
530      _result[10] = +(xx*(yy*ww - wy*yw) - xy*(yx*ww - wx*yw) + xw*(yx*wy - wx*yy) ) * invDet;
531      _result[11] = -(xx*(yy*zw - zy*yw) - xy*(yx*zw - zx*yw) + xw*(yx*zy - zx*yy) ) * invDet;
532
533      _result[12] = -(yx*(zy*wz - wy*zz) - yy*(zx*wz - wx*zz) + yz*(zx*wy - wx*zy) ) * invDet;
534      _result[13] = +(xx*(zy*wz - wy*zz) - xy*(zx*wz - wx*zz) + xz*(zx*wy - wx*zy) ) * invDet;
535      _result[14] = -(xx*(yy*wz - wy*yz) - xy*(yx*wz - wx*yz) + xz*(yx*wy - wx*yy) ) * invDet;
536      _result[15] = +(xx*(yy*zz - zy*yz) - xy*(yx*zz - zx*yz) + xz*(yx*zy - zx*yy) ) * invDet;
537   }
538
539   /// Convert LH to RH projection matrix and vice versa.
540   inline void mtxProjFlipHandedness(float* __restrict _dst, const float* __restrict _src)
541   {
542      _dst[ 0] = -_src[ 0];
543      _dst[ 1] = -_src[ 1];
544      _dst[ 2] = -_src[ 2];
545      _dst[ 3] = -_src[ 3];
546      _dst[ 4] =  _src[ 4];
547      _dst[ 5] =  _src[ 5];
548      _dst[ 6] =  _src[ 6];
549      _dst[ 7] =  _src[ 7];
550      _dst[ 8] = -_src[ 8];
551      _dst[ 9] = -_src[ 9];
552      _dst[10] = -_src[10];
553      _dst[11] = -_src[11];
554      _dst[12] =  _src[12];
555      _dst[13] =  _src[13];
556      _dst[14] =  _src[14];
557      _dst[15] =  _src[15];
558   }
559
560   /// Convert LH to RH view matrix and vice versa.
561   inline void mtxViewFlipHandedness(float* __restrict _dst, const float* __restrict _src)
562   {
563      _dst[ 0] = -_src[ 0];
564      _dst[ 1] =  _src[ 1];
565      _dst[ 2] = -_src[ 2];
566      _dst[ 3] =  _src[ 3];
567      _dst[ 4] = -_src[ 4];
568      _dst[ 5] =  _src[ 5];
569      _dst[ 6] = -_src[ 6];
570      _dst[ 7] =  _src[ 7];
571      _dst[ 8] = -_src[ 8];
572      _dst[ 9] =  _src[ 9];
573      _dst[10] = -_src[10];
574      _dst[11] =  _src[11];
575      _dst[12] = -_src[12];
576      _dst[13] =  _src[13];
577      _dst[14] = -_src[14];
578      _dst[15] =  _src[15];
579   }
580
581   inline void calcNormal(float _result[3], float _va[3], float _vb[3], float _vc[3])
582   {
583      float ba[3];
584      vec3Sub(ba, _vb, _va);
585
586      float ca[3];
587      vec3Sub(ca, _vc, _va);
588
589      float baxca[3];
590      vec3Cross(baxca, ba, ca);
591
592      vec3Norm(_result, baxca);
593   }
594
595   inline void calcPlane(float _result[4], float _va[3], float _vb[3], float _vc[3])
596   {
597      float normal[3];
598      calcNormal(normal, _va, _vb, _vc);
599
600      _result[0] = normal[0];
601      _result[1] = normal[1];
602      _result[2] = normal[2];
603      _result[3] = -vec3Dot(normal, _va);
604   }
605
606   inline void rgbToHsv(float _hsv[3], const float _rgb[3])
607   {
608      const float rr = _rgb[0];
609      const float gg = _rgb[1];
610      const float bb = _rgb[2];
611
612      const float s0 = fstep(bb, gg);
613
614      const float px = flerp(bb,        gg,         s0);
615      const float py = flerp(gg,        bb,         s0);
616      const float pz = flerp(-1.0f,     0.0f,       s0);
617      const float pw = flerp(2.0f/3.0f, -1.0f/3.0f, s0);
618
619      const float s1 = fstep(px, rr);
620
621      const float qx = flerp(px, rr, s1);
622      const float qy = py;
623      const float qz = flerp(pw, pz, s1);
624      const float qw = flerp(rr, px, s1);
625
626      const float dd = qx - fmin(qw, qy);
627      const float ee = 1.0e-10f;
628
629      _hsv[0] = fabsolute(qz + (qw - qy) / (6.0f * dd + ee) );
630      _hsv[1] = dd / (qx + ee);
631      _hsv[2] = qx;
632   }
633
634   inline void hsvToRgb(float _rgb[3], const float _hsv[3])
635   {
636      const float hh = _hsv[0];
637      const float ss = _hsv[1];
638      const float vv = _hsv[2];
639
640      const float px = fabsolute(ffract(hh + 1.0f     ) * 6.0f - 3.0f);
641      const float py = fabsolute(ffract(hh + 2.0f/3.0f) * 6.0f - 3.0f);
642      const float pz = fabsolute(ffract(hh + 1.0f/3.0f) * 6.0f - 3.0f);
643
644      _rgb[0] = vv * flerp(1.0f, fsaturate(px - 1.0f), ss);
645      _rgb[1] = vv * flerp(1.0f, fsaturate(py - 1.0f), ss);
646      _rgb[2] = vv * flerp(1.0f, fsaturate(pz - 1.0f), ss);
647   }
648
649} // namespace bx
650
651#endif // BX_FPU_MATH_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/fpumath.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/blockalloc.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_BLOCKALLOC_H_HEADER_GUARD
7#define BX_BLOCKALLOC_H_HEADER_GUARD
8
9#include "bx.h"
10
11namespace bx
12{
13   class BlockAlloc
14   {
15   public:
16      static const uint16_t invalidIndex = 0xffff;
17      static const uint32_t minElementSize = 2;
18
19      BlockAlloc()
20         : m_data(NULL)
21         , m_num(0)
22         , m_size(0)
23         , m_numFree(0)
24         , m_freeIndex(invalidIndex)
25      {
26      }
27
28      BlockAlloc(void* _data, uint16_t _num, uint16_t _size)
29         : m_data(_data)
30         , m_num(_num)
31         , m_size(_size)
32         , m_numFree(_num)
33         , m_freeIndex(0)
34      {
35         char* data = (char*)_data;
36         uint16_t* index = (uint16_t*)_data;
37         for (uint16_t ii = 0; ii < m_num-1; ++ii)
38         {
39            *index = ii+1;
40            data += m_size;
41            index = (uint16_t*)data;
42         }
43         *index = invalidIndex;
44      }
45
46      ~BlockAlloc()
47      {
48      }
49
50      void* alloc()
51      {
52         if (invalidIndex == m_freeIndex)
53         {
54            return NULL;
55         }
56
57         void* obj = ( (char*)m_data) + m_freeIndex*m_size;
58         m_freeIndex = *( (uint16_t*)obj);
59         --m_numFree;
60
61         return obj;
62      }
63
64      void free(void* _obj)
65      {
66         uint16_t index = getIndex(_obj);
67         BX_CHECK(index < m_num, "index %d, m_num %d", index, m_num);
68
69         *( (uint16_t*)_obj) = m_freeIndex;
70         m_freeIndex = index;
71         ++m_numFree;
72      }
73
74      uint16_t getIndex(void* _obj) const
75      {
76         return (uint16_t)( ( (char*)_obj - (char*)m_data ) / m_size);
77      }
78
79      uint16_t getNumFree() const
80      {
81         return m_numFree;
82      }
83
84      void* getFromIndex(uint16_t _index)
85      {
86         return (char*)m_data + _index*m_size;
87      }
88
89   private:
90      void* m_data;
91      uint16_t m_num;
92      uint16_t m_size;
93      uint16_t m_numFree;
94      uint16_t m_freeIndex;
95   };
96
97} // namespace bx
98
99#endif // BX_BLOCKALLOC_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/blockalloc.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/handlealloc.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_HANDLE_ALLOC_H_HEADER_GUARD
7#define BX_HANDLE_ALLOC_H_HEADER_GUARD
8
9#include "bx.h"
10#include "allocator.h"
11
12namespace bx
13{
14   template <uint16_t MaxHandlesT>
15   class HandleAllocT
16   {
17   public:
18      static const uint16_t invalid = 0xffff;
19
20      HandleAllocT()
21         : m_numHandles(0)
22      {
23         for (uint16_t ii = 0; ii < MaxHandlesT; ++ii)
24         {
25            m_handles[ii] = ii;
26         }
27      }
28
29      ~HandleAllocT()
30      {
31      }
32
33      const uint16_t* getHandles() const
34      {
35         return m_handles;
36      }
37
38      uint16_t getHandleAt(uint16_t _at) const
39      {
40         return m_handles[_at];
41      }
42
43      uint16_t getNumHandles() const
44      {
45         return m_numHandles;
46      }
47
48      uint16_t getMaxHandles() const
49      {
50         return MaxHandlesT;
51      }
52
53      uint16_t alloc()
54      {
55         if (m_numHandles < MaxHandlesT)
56         {
57            uint16_t index = m_numHandles;
58            ++m_numHandles;
59
60            uint16_t handle = m_handles[index];
61            uint16_t* sparse = &m_handles[MaxHandlesT];
62            sparse[handle] = index;
63            return handle;
64         }
65
66         return invalid;
67      }
68
69      void free(uint16_t _handle)
70      {
71         uint16_t* sparse = &m_handles[MaxHandlesT];
72         uint16_t index = sparse[_handle];
73         --m_numHandles;
74         uint16_t temp = m_handles[m_numHandles];
75         m_handles[m_numHandles] = _handle;
76         sparse[temp] = index;
77         m_handles[index] = temp;
78      }
79
80   private:
81      uint16_t m_handles[MaxHandlesT*2];
82      uint16_t m_numHandles;
83   };
84
85   class HandleAlloc
86   {
87   public:
88      static const uint16_t invalid = 0xffff;
89
90      HandleAlloc(uint16_t _maxHandles, void* _handles)
91         : m_handles( (uint16_t*)_handles)
92         , m_numHandles(0)
93         , m_maxHandles(_maxHandles)
94      {
95         for (uint16_t ii = 0; ii < _maxHandles; ++ii)
96         {
97            m_handles[ii] = ii;
98         }
99      }
100
101      ~HandleAlloc()
102      {
103      }
104
105      const uint16_t* getHandles() const
106      {
107         return m_handles;
108      }
109
110      uint16_t getHandleAt(uint16_t _at) const
111      {
112         return m_handles[_at];
113      }
114
115      uint16_t getNumHandles() const
116      {
117         return m_numHandles;
118      }
119
120      uint16_t getMaxHandles() const
121      {
122         return m_maxHandles;
123      }
124
125      uint16_t alloc()
126      {
127         if (m_numHandles < m_maxHandles)
128         {
129            uint16_t index = m_numHandles;
130            ++m_numHandles;
131
132            uint16_t handle = m_handles[index];
133            uint16_t* sparse = &m_handles[m_maxHandles];
134            sparse[handle] = index;
135            return handle;
136         }
137
138         return invalid;
139      }
140
141      void free(uint16_t _handle)
142      {
143         uint16_t* sparse = &m_handles[m_maxHandles];
144         uint16_t index = sparse[_handle];
145         --m_numHandles;
146         uint16_t temp = m_handles[m_numHandles];
147         m_handles[m_numHandles] = _handle;
148         sparse[temp] = index;
149         m_handles[index] = temp;
150      }
151
152   private:
153      uint16_t* m_handles;
154      uint16_t m_numHandles;
155      uint16_t m_maxHandles;
156   };
157
158   inline HandleAlloc* createHandleAlloc(AllocatorI* _allocator, uint16_t _maxHandles)
159   {
160      uint8_t* ptr = (uint8_t*)BX_ALLOC(_allocator, sizeof(HandleAlloc) + 2*_maxHandles*sizeof(uint16_t) );
161      return ::new (ptr) HandleAlloc(_maxHandles, &ptr[sizeof(HandleAlloc)]);
162   }
163
164   inline void destroyHandleAlloc(AllocatorI* _allocator, HandleAlloc* _handleAlloc)
165   {
166      _handleAlloc->~HandleAlloc();
167      BX_FREE(_allocator, _handleAlloc);
168   }
169
170} // namespace bx
171
172#endif // BX_HANDLE_ALLOC_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/handlealloc.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/string.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_PRINTF_H_HEADER_GUARD
7#define BX_PRINTF_H_HEADER_GUARD
8
9#include "bx.h"
10#include <alloca.h>
11#include <ctype.h>  // tolower
12#include <stdarg.h> // va_list
13#include <stdio.h>  // vsnprintf, vsnwprintf
14#include <string.h>
15#include <wchar.h>  // wchar_t
16
17namespace bx
18{
19   ///
20   inline bool toBool(const char* _str)
21   {
22      char ch = (char)tolower(_str[0]);
23      return ch == 't' ||  ch == '1';
24   }
25
26   /// Case insensitive string compare.
27   inline int32_t stricmp(const char* _a, const char* _b)
28   {
29#if BX_COMPILER_MSVC
30      return _stricmp(_a, _b);
31#else
32      return strcasecmp(_a, _b);
33#endif // BX_COMPILER_
34   }
35
36   ///
37   inline size_t strnlen(const char* _str, size_t _max)
38   {
39      const char* end = _str + _max;
40      const char* ptr;
41      for (ptr = _str; ptr < end && *ptr != '\0'; ++ptr) {};
42      return ptr - _str;
43   }
44
45   /// Find substring in string. Limit search to _size.
46   inline const char* strnstr(const char* _str, const char* _find, size_t _size)
47   {
48      char first = *_find;
49      if ('\0' == first)
50      {
51         return _str;
52      }
53
54      const char* cmp = _find + 1;
55      size_t len = strlen(cmp);
56      do
57      {
58         for (char match = *_str++; match != first && 0 < _size; match = *_str++, --_size)
59         {
60            if ('\0' == match)
61            {
62               return NULL;
63            }
64         }
65
66         if (0 == _size)
67         {
68            return NULL;
69         }
70
71      } while (0 != strncmp(_str, cmp, len) );
72
73      return --_str;
74   }
75
76   /// Find new line. Returns pointer after new line terminator.
77   inline const char* strnl(const char* _str)
78   {
79      for (; '\0' != *_str; _str += strnlen(_str, 1024) )
80      {
81         const char* eol = strnstr(_str, "\r\n", 1024);
82         if (NULL != eol)
83         {
84            return eol + 2;
85         }
86
87         eol = strnstr(_str, "\n", 1024);
88         if (NULL != eol)
89         {
90            return eol + 1;
91         }
92      }
93
94      return _str;
95   }
96
97   /// Find end of line. Retuns pointer to new line terminator.
98   inline const char* streol(const char* _str)
99   {
100      for (; '\0' != *_str; _str += strnlen(_str, 1024) )
101      {
102         const char* eol = strnstr(_str, "\r\n", 1024);
103         if (NULL != eol)
104         {
105            return eol;
106         }
107
108         eol = strnstr(_str, "\n", 1024);
109         if (NULL != eol)
110         {
111            return eol;
112         }
113      }
114
115      return _str;
116   }
117
118   /// Skip whitespace.
119   inline const char* strws(const char* _str)
120   {
121      for (; isspace(*_str); ++_str) {};
122      return _str;
123   }
124
125   /// Skip non-whitespace.
126   inline const char* strnws(const char* _str)
127   {
128      for (; !isspace(*_str); ++_str) {};
129      return _str;
130   }
131
132   /// Skip word.
133   inline const char* strword(const char* _str)
134   {
135      for (char ch = *_str++; isalnum(ch) || '_' == ch; ch = *_str++) {};
136      return _str-1;
137   }
138
139   /// Find matching block.
140   inline const char* strmb(const char* _str, char _open, char _close)
141   {
142      int count = 0;
143      for (char ch = *_str++; ch != '\0' && count >= 0; ch = *_str++)
144      {
145         if (ch == _open)
146         {
147            count++;
148         }
149         else if (ch == _close)
150         {
151            count--;
152            if (0 == count)
153            {
154               return _str-1;
155            }
156         }
157      }
158
159      return NULL;
160   }
161
162   // Normalize string to sane line endings.
163   inline void eolLF(char* _out, size_t _size, const char* _str)
164   {
165      if (0 < _size)
166      {
167         char* end = _out + _size - 1;
168         for (char ch = *_str++; ch != '\0' && _out < end; ch = *_str++)
169         {
170            if ('\r' != ch)
171            {
172               *_out++ = ch;
173            }
174         }
175
176         *_out = '\0';
177      }
178   }
179
180   // Finds identifier.
181   inline const char* findIdentifierMatch(const char* _str, const char* _word)
182   {
183      size_t len = strlen(_word);
184      const char* ptr = strstr(_str, _word);
185      for (; NULL != ptr; ptr = strstr(ptr + len, _word) )
186      {
187         if (ptr != _str)
188         {
189            char ch = *(ptr - 1);
190            if (isalnum(ch) || '_' == ch)
191            {
192               continue;
193            }
194         }
195
196         char ch = ptr[len];
197         if (isalnum(ch) || '_' == ch)
198         {
199            continue;
200         }
201
202         return ptr;
203      }
204
205      return ptr;
206   }
207
208   // Finds any identifier from NULL terminated array of identifiers.
209   inline const char* findIdentifierMatch(const char* _str, const char* _words[])
210   {
211      for (const char* word = *_words; NULL != word; ++_words, word = *_words)
212      {
213         const char* match = findIdentifierMatch(_str, word);
214         if (NULL != match)
215         {
216            return match;
217         }
218      }
219
220      return NULL;
221   }
222
223   /// Cross platform implementation of vsnprintf that returns number of
224   /// characters which would have been written to the final string if
225   /// enough space had been available.
226   inline int32_t vsnprintf(char* _str, size_t _count, const char* _format, va_list _argList)
227   {
228#if BX_COMPILER_MSVC
229      int32_t len = ::vsnprintf_s(_str, _count, size_t(-1), _format, _argList);
230      return -1 == len ? ::_vscprintf(_format, _argList) : len;
231#else
232      return ::vsnprintf(_str, _count, _format, _argList);
233#endif // BX_COMPILER_MSVC
234   }
235
236   /// Cross platform implementation of vsnwprintf that returns number of
237   /// characters which would have been written to the final string if
238   /// enough space had been available.
239   inline int32_t vsnwprintf(wchar_t* _str, size_t _count, const wchar_t* _format, va_list _argList)
240   {
241#if BX_COMPILER_MSVC
242      int32_t len = ::_vsnwprintf_s(_str, _count, size_t(-1), _format, _argList);
243      return -1 == len ? ::_vscwprintf(_format, _argList) : len;
244#elif defined(__MINGW32__)
245      return ::vsnwprintf(_str, _count, _format, _argList);
246#else
247      return ::vswprintf(_str, _count, _format, _argList);
248#endif // BX_COMPILER_MSVC
249   }
250
251   ///
252   inline int32_t snprintf(char* _str, size_t _count, const char* _format, ...) // BX_PRINTF_ARGS(3, 4)
253   {
254      va_list argList;
255      va_start(argList, _format);
256      int32_t len = vsnprintf(_str, _count, _format, argList);
257      va_end(argList);
258      return len;
259   }
260
261   ///
262   inline int32_t swnprintf(wchar_t* _out, size_t _count, const wchar_t* _format, ...)
263   {
264      va_list argList;
265      va_start(argList, _format);
266      int32_t len = vsnwprintf(_out, _count, _format, argList);
267      va_end(argList);
268      return len;
269   }
270
271   ///
272   template <typename Ty>
273   inline void stringPrintfVargs(Ty& _out, const char* _format, va_list _argList)
274   {
275      char temp[2048];
276
277      char* out = temp;
278      int32_t len = bx::vsnprintf(out, sizeof(temp), _format, _argList);
279      if ( (int32_t)sizeof(temp) < len)
280      {
281         out = (char*)alloca(len+1);
282         len = bx::vsnprintf(out, len, _format, _argList);
283      }
284      out[len] = '\0';
285      _out.append(out);
286   }
287
288   ///
289   template <typename Ty>
290   inline void stringPrintf(Ty& _out, const char* _format, ...)
291   {
292      va_list argList;
293      va_start(argList, _format);
294      stringPrintfVargs(_out, _format, argList);
295      va_end(argList);
296   }
297
298   /// Extract base file name from file path.
299   inline const char* baseName(const char* _filePath)
300   {
301      const char* bs       = strrchr(_filePath, '\\');
302      const char* fs       = strrchr(_filePath, '/');
303      const char* slash    = (bs > fs ? bs : fs);
304      const char* colon    = strrchr(_filePath, ':');
305      const char* basename = slash > colon ? slash : colon;
306      if (NULL != basename)
307      {
308         return basename+1;
309      }
310
311      return _filePath;
312   }
313
314   /*
315    * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
316    *
317    * Permission to use, copy, modify, and distribute this software for any
318    * purpose with or without fee is hereby granted, provided that the above
319    * copyright notice and this permission notice appear in all copies.
320    *
321    * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
322    * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
323    * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
324    * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
325    * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
326    * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
327    * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
328    */
329
330   /// Copy src to string dst of size siz.  At most siz-1 characters
331   /// will be copied.  Always NUL terminates (unless siz == 0).
332   /// Returns strlen(src); if retval >= siz, truncation occurred.
333   inline size_t strlcpy(char* _dst, const char* _src, size_t _siz)
334   {
335      char* dd = _dst;
336      const char* ss = _src;
337      size_t nn = _siz;
338
339      /* Copy as many bytes as will fit */
340      if (nn != 0)
341      {
342         while (--nn != 0)
343         {
344            if ( (*dd++ = *ss++) == '\0')
345            {
346               break;
347            }
348         }
349      }
350
351      /* Not enough room in dst, add NUL and traverse rest of src */
352      if (nn == 0)
353      {
354         if (_siz != 0)
355         {
356            *dd = '\0';  /* NUL-terminate dst */
357         }
358
359         while (*ss++)
360         {
361         }
362      }
363
364      return(ss - _src - 1); /* count does not include NUL */
365   }
366
367   /// Appends src to string dst of size siz (unlike strncat, siz is the
368   /// full size of dst, not space left).  At most siz-1 characters
369   /// will be copied.  Always NUL terminates (unless siz <= strlen(dst)).
370   /// Returns strlen(src) + MIN(siz, strlen(initial dst)).
371   /// If retval >= siz, truncation occurred.
372   inline size_t strlcat(char* _dst, const char* _src, size_t _siz)
373   {
374      char* dd = _dst;
375      const char *s = _src;
376      size_t nn = _siz;
377      size_t dlen;
378
379      /* Find the end of dst and adjust bytes left but don't go past end */
380      while (nn-- != 0 && *dd != '\0')
381      {
382         dd++;
383      }
384
385      dlen = dd - _dst;
386      nn = _siz - dlen;
387
388      if (nn == 0)
389      {
390         return(dlen + strlen(s));
391      }
392
393      while (*s != '\0')
394      {
395         if (nn != 1)
396         {
397            *dd++ = *s;
398            nn--;
399         }
400         s++;
401      }
402      *dd = '\0';
403
404      return(dlen + (s - _src)); /* count does not include NUL */
405   }
406
407} // namespace bx
408
409#endif // BX_PRINTF_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/string.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/float4_neon.h
r0r31734
1/*
2 * Copyright 2010-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_FLOAT4_NEON_H_HEADER_GUARD
7#define BX_FLOAT4_NEON_H_HEADER_GUARD
8
9namespace bx
10{
11   typedef __builtin_neon_sf  float4_t __attribute__( (__vector_size__(16) ) );
12
13   typedef __builtin_neon_sf  _f32x2_t __attribute__( (__vector_size__( 8) ) );
14   typedef __builtin_neon_si  _i32x4_t __attribute__( (__vector_size__(16) ) );
15   typedef __builtin_neon_usi _u32x4_t __attribute__( (__vector_size__(16) ) );
16
17#define ELEMx 0
18#define ELEMy 1
19#define ELEMz 2
20#define ELEMw 3
21#define IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
22         BX_FLOAT4_FORCE_INLINE float4_t float4_swiz_##_x##_y##_z##_w(float4_t _a) \
23         { \
24            return __builtin_shuffle(_a, (_u32x4_t){ ELEM##_x, ELEM##_y, ELEM##_z, ELEM##_w }); \
25         }
26
27#include "float4_swizzle.inl"
28
29#undef IMPLEMENT_SWIZZLE
30#undef ELEMw
31#undef ELEMz
32#undef ELEMy
33#undef ELEMx
34
35#define IMPLEMENT_TEST(_xyzw, _swizzle) \
36         BX_FLOAT4_FORCE_INLINE bool float4_test_any_##_xyzw(float4_t _test); \
37         BX_FLOAT4_FORCE_INLINE bool float4_test_all_##_xyzw(float4_t _test);
38
39IMPLEMENT_TEST(x    , xxxx);
40IMPLEMENT_TEST(y    , yyyy);
41IMPLEMENT_TEST(xy   , xyyy);
42IMPLEMENT_TEST(z    , zzzz);
43IMPLEMENT_TEST(xz   , xzzz);
44IMPLEMENT_TEST(yz   , yzzz);
45IMPLEMENT_TEST(xyz  , xyzz);
46IMPLEMENT_TEST(w    , wwww);
47IMPLEMENT_TEST(xw   , xwww);
48IMPLEMENT_TEST(yw   , ywww);
49IMPLEMENT_TEST(xyw  , xyww);
50IMPLEMENT_TEST(zw   , zwww);
51IMPLEMENT_TEST(xzw  , xzww);
52IMPLEMENT_TEST(yzw  , yzww);
53IMPLEMENT_TEST(xyzw , xyzw);
54
55#undef IMPLEMENT_TEST
56
57   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_xyAB(float4_t _a, float4_t _b)
58   {
59      return __builtin_shuffle(_a, _b, (_u32x4_t){ 0, 1, 4, 5 });
60   }
61
62   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_ABxy(float4_t _a, float4_t _b)
63   {
64      return __builtin_shuffle(_a, _b, (_u32x4_t){ 4, 5, 0, 1 });
65   }
66
67   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_CDzw(float4_t _a, float4_t _b)
68   {
69      return __builtin_shuffle(_a, _b, (_u32x4_t){ 6, 7, 2, 3 });
70   }
71
72   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_zwCD(float4_t _a, float4_t _b)
73   {
74      return __builtin_shuffle(_a, _b, (_u32x4_t){ 2, 3, 6, 7 });
75   }
76
77   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_xAyB(float4_t _a, float4_t _b)
78   {
79      return __builtin_shuffle(_a, _b, (_u32x4_t){ 0, 4, 1, 5 });
80   }
81
82   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_yBxA(float4_t _a, float4_t _b)
83   {
84      return __builtin_shuffle(_a, _b, (_u32x4_t){ 1, 5, 0, 4 });
85   }
86
87   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_zCwD(float4_t _a, float4_t _b)
88   {
89      return __builtin_shuffle(_a, _b, (_u32x4_t){ 2, 6, 3, 7 });
90   }
91
92   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_CzDw(float4_t _a, float4_t _b)
93   {
94      return __builtin_shuffle(_a, _b, (_u32x4_t){ 6, 2, 7, 3 });
95   }
96
97   BX_FLOAT4_FORCE_INLINE float float4_x(float4_t _a)
98   {
99      return __builtin_neon_vget_lanev4sf(_a, 0, 3);
100   }
101
102   BX_FLOAT4_FORCE_INLINE float float4_y(float4_t _a)
103   {
104      return __builtin_neon_vget_lanev4sf(_a, 1, 3);
105   }
106
107   BX_FLOAT4_FORCE_INLINE float float4_z(float4_t _a)
108   {
109      return __builtin_neon_vget_lanev4sf(_a, 2, 3);
110   }
111
112   BX_FLOAT4_FORCE_INLINE float float4_w(float4_t _a)
113   {
114      return __builtin_neon_vget_lanev4sf(_a, 3, 3);
115   }
116
117   BX_FLOAT4_FORCE_INLINE float4_t float4_ld(const void* _ptr)
118   {
119      return __builtin_neon_vld1v4sf( (const __builtin_neon_sf*)_ptr);
120   }
121
122   BX_FLOAT4_FORCE_INLINE void float4_st(void* _ptr, float4_t _a)
123   {
124      __builtin_neon_vst1v4sf( (__builtin_neon_sf*)_ptr, _a);
125   }
126
127   BX_FLOAT4_FORCE_INLINE void float4_stx(void* _ptr, float4_t _a)
128   {
129      __builtin_neon_vst1_lanev4sf( (__builtin_neon_sf*)_ptr, _a, 0);
130   }
131
132   BX_FLOAT4_FORCE_INLINE void float4_stream(void* _ptr, float4_t _a)
133   {
134      __builtin_neon_vst1v4sf( (__builtin_neon_sf*)_ptr, _a);
135   }
136
137   BX_FLOAT4_FORCE_INLINE float4_t float4_ld(float _x, float _y, float _z, float _w)
138   {
139      const float4_t val[4] = {_x, _y, _z, _w};
140      return float4_ld(val);
141   }
142
143   BX_FLOAT4_FORCE_INLINE float4_t float4_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w)
144   {
145      const uint32_t val[4] = {_x, _y, _z, _w};
146      const _i32x4_t tmp    = __builtin_neon_vld1v4si( (const __builtin_neon_si*)val);
147      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp);
148
149      return result;
150   }
151
152   BX_FLOAT4_FORCE_INLINE float4_t float4_splat(const void* _ptr)
153   {
154      const float4_t tmp0   = __builtin_neon_vld1v4sf( (const __builtin_neon_sf *)_ptr);
155      const _f32x2_t tmp1   = __builtin_neon_vget_lowv4sf(tmp0);
156      const float4_t result = __builtin_neon_vdup_lanev4sf(tmp1, 0);
157
158      return result;
159   }
160
161   BX_FLOAT4_FORCE_INLINE float4_t float4_splat(float _a)
162   {
163      return __builtin_neon_vdup_nv4sf(_a);
164   }
165
166   BX_FLOAT4_FORCE_INLINE float4_t float4_isplat(uint32_t _a)
167   {
168      const _i32x4_t tmp    = __builtin_neon_vdup_nv4si( (__builtin_neon_si)_a);
169      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp);
170
171      return result;
172   }
173
174   BX_FLOAT4_FORCE_INLINE float4_t float4_zero()
175   {
176      return float4_isplat(0);
177   }
178
179   BX_FLOAT4_FORCE_INLINE float4_t float4_itof(float4_t _a)
180   {
181      const _i32x4_t itof   = __builtin_neon_vreinterpretv4siv4sf(_a);
182      const float4_t result = __builtin_neon_vcvtv4si(itof, 1);
183
184      return result;
185   }
186
187   BX_FLOAT4_FORCE_INLINE float4_t float4_ftoi(float4_t _a)
188   {
189      const _i32x4_t ftoi   = __builtin_neon_vcvtv4sf(_a, 1);
190      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(ftoi);
191
192      return result;
193   }
194
195   BX_FLOAT4_FORCE_INLINE float4_t float4_add(float4_t _a, float4_t _b)
196   {
197      return __builtin_neon_vaddv4sf(_a, _b, 3);
198   }
199
200   BX_FLOAT4_FORCE_INLINE float4_t float4_sub(float4_t _a, float4_t _b)
201   {
202      return __builtin_neon_vsubv4sf(_a, _b, 3);
203   }
204
205   BX_FLOAT4_FORCE_INLINE float4_t float4_mul(float4_t _a, float4_t _b)
206   {
207      return __builtin_neon_vmulv4sf(_a, _b, 3);
208   }
209
210   BX_FLOAT4_FORCE_INLINE float4_t float4_rcp_est(float4_t _a)
211   {
212      return __builtin_neon_vrecpev4sf(_a, 3);
213   }
214
215   BX_FLOAT4_FORCE_INLINE float4_t float4_rsqrt_est(float4_t _a)
216   {
217      return __builtin_neon_vrsqrtev4sf(_a, 3);
218   }
219
220   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpeq(float4_t _a, float4_t _b)
221   {
222      const _i32x4_t tmp    = __builtin_neon_vceqv4sf(_a, _b, 3);
223      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp);
224
225      return result;
226   }
227
228   BX_FLOAT4_FORCE_INLINE float4_t float4_cmplt(float4_t _a, float4_t _b)
229   {
230      const _i32x4_t tmp    = __builtin_neon_vcgtv4sf(_b, _a, 3);
231      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp);
232
233      return result;
234   }
235
236   BX_FLOAT4_FORCE_INLINE float4_t float4_cmple(float4_t _a, float4_t _b)
237   {
238      const _i32x4_t tmp    = __builtin_neon_vcgev4sf(_b, _a, 3);
239      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp);
240
241      return result;
242   }
243
244   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpgt(float4_t _a, float4_t _b)
245   {
246      const _i32x4_t tmp    = __builtin_neon_vcgtv4sf(_a, _b, 3);
247      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp);
248
249      return result;
250   }
251
252   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpge(float4_t _a, float4_t _b)
253   {
254      const _i32x4_t tmp    = __builtin_neon_vcgev4sf(_a, _b, 3);
255      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp);
256
257      return result;
258   }
259
260   BX_FLOAT4_FORCE_INLINE float4_t float4_min(float4_t _a, float4_t _b)
261   {
262      return __builtin_neon_vminv4sf(_a, _b, 3);
263   }
264
265   BX_FLOAT4_FORCE_INLINE float4_t float4_max(float4_t _a, float4_t _b)
266   {
267      return __builtin_neon_vmaxv4sf(_a, _b, 3);
268   }
269
270   BX_FLOAT4_FORCE_INLINE float4_t float4_and(float4_t _a, float4_t _b)
271   {
272      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
273      const _i32x4_t tmp1   = __builtin_neon_vreinterpretv4siv4sf(_b);
274      const _i32x4_t tmp2   = __builtin_neon_vandv4si(tmp0, tmp1, 0);
275      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp2);
276
277      return result;
278   }
279
280   BX_FLOAT4_FORCE_INLINE float4_t float4_andc(float4_t _a, float4_t _b)
281   {
282      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
283      const _i32x4_t tmp1   = __builtin_neon_vreinterpretv4siv4sf(_b);
284      const _i32x4_t tmp2   = __builtin_neon_vbicv4si(tmp0, tmp1, 0);
285      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp2);
286
287      return result;
288   }
289
290   BX_FLOAT4_FORCE_INLINE float4_t float4_or(float4_t _a, float4_t _b)
291   {
292      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
293      const _i32x4_t tmp1   = __builtin_neon_vreinterpretv4siv4sf(_b);
294      const _i32x4_t tmp2   = __builtin_neon_vorrv4si(tmp0, tmp1, 0);
295      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp2);
296
297      return result;
298   }
299
300   BX_FLOAT4_FORCE_INLINE float4_t float4_xor(float4_t _a, float4_t _b)
301   {
302      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
303      const _i32x4_t tmp1   = __builtin_neon_vreinterpretv4siv4sf(_b);
304      const _i32x4_t tmp2   = __builtin_neon_veorv4si(tmp0, tmp1, 0);
305      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp2);
306
307      return result;
308   }
309
310   BX_FLOAT4_FORCE_INLINE float4_t float4_sll(float4_t _a, int _count)
311   {
312      if (__builtin_constant_p(_count) )
313      {
314         const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
315         const _i32x4_t tmp1   = __builtin_neon_vshl_nv4si(tmp0, _count, 0);
316         const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp1);
317
318         return result;
319      }
320
321      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
322      const _i32x4_t shift  = __builtin_neon_vdup_nv4si( (__builtin_neon_si)_count);
323      const _i32x4_t tmp1   = __builtin_neon_vshlv4si(tmp0, shift, 1);
324      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp1);
325
326      return result;
327   }
328
329   BX_FLOAT4_FORCE_INLINE float4_t float4_srl(float4_t _a, int _count)
330   {
331      if (__builtin_constant_p(_count) )
332      {
333         const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
334         const _i32x4_t tmp1   = __builtin_neon_vshr_nv4si(tmp0, _count, 0);
335         const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp1);
336
337         return result;
338      }
339
340      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
341      const _i32x4_t shift  = __builtin_neon_vdup_nv4si( (__builtin_neon_si)-_count);
342      const _i32x4_t tmp1   = __builtin_neon_vshlv4si(tmp0, shift, 1);
343      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp1);
344
345      return result;
346   }
347
348   BX_FLOAT4_FORCE_INLINE float4_t float4_sra(float4_t _a, int _count)
349   {
350      if (__builtin_constant_p(_count) )
351      {
352         const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
353         const _i32x4_t tmp1   = __builtin_neon_vshr_nv4si(tmp0, _count, 1);
354         const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp1);
355
356         return result;
357      }
358
359      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
360      const _i32x4_t shift  = __builtin_neon_vdup_nv4si( (__builtin_neon_si)-_count);
361      const _i32x4_t tmp1   = __builtin_neon_vshlv4si(tmp0, shift, 1);
362      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp1);
363
364      return result;
365   }
366
367   BX_FLOAT4_FORCE_INLINE float4_t float4_madd(float4_t _a, float4_t _b, float4_t _c)
368   {
369      return __builtin_neon_vmlav4sf(_c, _a, _b, 3);
370   }
371
372   BX_FLOAT4_FORCE_INLINE float4_t float4_nmsub(float4_t _a, float4_t _b, float4_t _c)
373   {
374      return __builtin_neon_vmlsv4sf(_c, _a, _b, 3);
375   }
376
377   BX_FLOAT4_FORCE_INLINE float4_t float4_icmpeq(float4_t _a, float4_t _b)
378   {
379      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
380      const _i32x4_t tmp1   = __builtin_neon_vreinterpretv4siv4sf(_b);
381      const _i32x4_t tmp2   = __builtin_neon_vceqv4si(tmp0, tmp1, 1);
382      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp2);
383
384      return result;
385   }
386
387   BX_FLOAT4_FORCE_INLINE float4_t float4_icmplt(float4_t _a, float4_t _b)
388   {
389      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
390      const _i32x4_t tmp1   = __builtin_neon_vreinterpretv4siv4sf(_b);
391      const _i32x4_t tmp2   = __builtin_neon_vcgtv4si(tmp1, tmp0, 1);
392      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp2);
393
394      return result;
395   }
396
397   BX_FLOAT4_FORCE_INLINE float4_t float4_icmpgt(float4_t _a, float4_t _b)
398   {
399      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
400      const _i32x4_t tmp1   = __builtin_neon_vreinterpretv4siv4sf(_b);
401      const _i32x4_t tmp2   = __builtin_neon_vcgtv4si(tmp0, tmp1, 1);
402      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp2);
403
404      return result;
405   }
406
407   BX_FLOAT4_FORCE_INLINE float4_t float4_imin(float4_t _a, float4_t _b)
408   {
409      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
410      const _i32x4_t tmp1   = __builtin_neon_vreinterpretv4siv4sf(_b);
411      const _i32x4_t tmp2   = __builtin_neon_vminv4si(tmp0, tmp1, 1);
412      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp2);
413
414      return result;
415   }
416
417   BX_FLOAT4_FORCE_INLINE float4_t float4_imax(float4_t _a, float4_t _b)
418   {
419      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
420      const _i32x4_t tmp1   = __builtin_neon_vreinterpretv4siv4sf(_b);
421      const _i32x4_t tmp2   = __builtin_neon_vmaxv4si(tmp0, tmp1, 1);
422      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp2);
423
424      return result;
425   }
426
427   BX_FLOAT4_FORCE_INLINE float4_t float4_iadd(float4_t _a, float4_t _b)
428   {
429      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
430      const _i32x4_t tmp1   = __builtin_neon_vreinterpretv4siv4sf(_b);
431      const _i32x4_t tmp2   = __builtin_neon_vaddv4si(tmp0, tmp1, 1);
432      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp2);
433
434      return result;
435   }
436
437   BX_FLOAT4_FORCE_INLINE float4_t float4_isub(float4_t _a, float4_t _b)
438   {
439      const _i32x4_t tmp0   = __builtin_neon_vreinterpretv4siv4sf(_a);
440      const _i32x4_t tmp1   = __builtin_neon_vreinterpretv4siv4sf(_b);
441      const _i32x4_t tmp2   = __builtin_neon_vsubv4si(tmp0, tmp1, 1);
442      const float4_t result = __builtin_neon_vreinterpretv4sfv4si(tmp2);
443
444      return result;
445   }
446
447} // namespace bx
448
449#define float4_shuf_xAzC     float4_shuf_xAzC_ni
450#define float4_shuf_yBwD     float4_shuf_yBwD_ni
451#define float4_rcp           float4_rcp_ni
452#define float4_orx           float4_orx_ni
453#define float4_orc           float4_orc_ni
454#define float4_neg           float4_neg_ni
455#define float4_madd          float4_madd_ni
456#define float4_nmsub         float4_nmsub_ni
457#define float4_div_nr        float4_div_nr_ni
458#define float4_div           float4_div_nr_ni
459#define float4_selb          float4_selb_ni
460#define float4_sels          float4_sels_ni
461#define float4_not           float4_not_ni
462#define float4_abs           float4_abs_ni
463#define float4_clamp         float4_clamp_ni
464#define float4_lerp          float4_lerp_ni
465#define float4_rsqrt         float4_rsqrt_ni
466#define float4_rsqrt_nr      float4_rsqrt_nr_ni
467#define float4_rsqrt_carmack float4_rsqrt_carmack_ni
468#define float4_sqrt_nr       float4_sqrt_nr_ni
469#define float4_sqrt          float4_sqrt_nr_ni
470#define float4_log2          float4_log2_ni
471#define float4_exp2          float4_exp2_ni
472#define float4_pow           float4_pow_ni
473#define float4_cross3        float4_cross3_ni
474#define float4_normalize3    float4_normalize3_ni
475#define float4_dot3          float4_dot3_ni
476#define float4_dot           float4_dot_ni
477#define float4_ceil          float4_ceil_ni
478#define float4_floor         float4_floor_ni
479
480#include "float4_ni.h"
481
482namespace bx
483{
484#define IMPLEMENT_TEST(_xyzw, _swizzle) \
485         BX_FLOAT4_FORCE_INLINE bool float4_test_any_##_xyzw(float4_t _test) \
486         { \
487            const float4_t tmp0 = float4_swiz_##_swizzle(_test); \
488            return float4_test_any_ni(tmp0); \
489         } \
490         \
491         BX_FLOAT4_FORCE_INLINE bool float4_test_all_##_xyzw(float4_t _test) \
492         { \
493            const float4_t tmp0 = float4_swiz_##_swizzle(_test); \
494            return float4_test_all_ni(tmp0); \
495         }
496
497IMPLEMENT_TEST(x    , xxxx);
498IMPLEMENT_TEST(y    , yyyy);
499IMPLEMENT_TEST(xy   , xyyy);
500IMPLEMENT_TEST(z    , zzzz);
501IMPLEMENT_TEST(xz   , xzzz);
502IMPLEMENT_TEST(yz   , yzzz);
503IMPLEMENT_TEST(xyz  , xyzz);
504IMPLEMENT_TEST(w    , wwww);
505IMPLEMENT_TEST(xw   , xwww);
506IMPLEMENT_TEST(yw   , ywww);
507IMPLEMENT_TEST(xyw  , xyww);
508IMPLEMENT_TEST(zw   , zwww);
509IMPLEMENT_TEST(xzw  , xzww);
510IMPLEMENT_TEST(yzw  , yzww);
511
512   BX_FLOAT4_FORCE_INLINE bool float4_test_any_xyzw(float4_t _test)
513   {
514      return float4_test_any_ni(_test);
515   }
516
517   BX_FLOAT4_FORCE_INLINE bool float4_test_all_xyzw(float4_t _test)
518   {
519      return float4_test_all_ni(_test);
520   }
521
522#undef IMPLEMENT_TEST
523} // namespace bx
524
525#endif // BX_FLOAT4_NEON_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/float4_neon.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/maputil.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_MAPUTIL_H_HEADER_GUARD
7#define BX_MAPUTIL_H_HEADER_GUARD
8
9#include "bx.h"
10
11namespace bx
12{
13   template<typename MapType>
14   typename MapType::iterator mapInsertOrUpdate(MapType& _map, const typename MapType::key_type& _key, const typename MapType::mapped_type& _value)
15   {
16      typename MapType::iterator it = _map.lower_bound(_key);
17      if (it != _map.end()
18      &&  !_map.key_comp()(_key, it->first) )
19      {
20         it->second = _value;
21         return it;
22      }
23
24      typename MapType::value_type pair(_key, _value);
25      return _map.insert(it, pair);
26   }
27} // namespace bx
28
29#endif // BX_MAPUTIL_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/maputil.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/float4_swizzle.inl
r0r31734
1/*
2 * Copyright 2010-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_FLOAT4_T_H_HEADER_GUARD
7#   error "xmacro file, must be included from float4_*.h"
8#endif // BX_FLOAT4_T_H_HEADER_GUARD
9
10// included from float4_t.h
11IMPLEMENT_SWIZZLE(x, x, x, x)
12IMPLEMENT_SWIZZLE(x, x, x, y)
13IMPLEMENT_SWIZZLE(x, x, x, z)
14IMPLEMENT_SWIZZLE(x, x, x, w)
15IMPLEMENT_SWIZZLE(x, x, y, x)
16IMPLEMENT_SWIZZLE(x, x, y, y)
17IMPLEMENT_SWIZZLE(x, x, y, z)
18IMPLEMENT_SWIZZLE(x, x, y, w)
19IMPLEMENT_SWIZZLE(x, x, z, x)
20IMPLEMENT_SWIZZLE(x, x, z, y)
21IMPLEMENT_SWIZZLE(x, x, z, z)
22IMPLEMENT_SWIZZLE(x, x, z, w)
23IMPLEMENT_SWIZZLE(x, x, w, x)
24IMPLEMENT_SWIZZLE(x, x, w, y)
25IMPLEMENT_SWIZZLE(x, x, w, z)
26IMPLEMENT_SWIZZLE(x, x, w, w)
27IMPLEMENT_SWIZZLE(x, y, x, x)
28IMPLEMENT_SWIZZLE(x, y, x, y)
29IMPLEMENT_SWIZZLE(x, y, x, z)
30IMPLEMENT_SWIZZLE(x, y, x, w)
31IMPLEMENT_SWIZZLE(x, y, y, x)
32IMPLEMENT_SWIZZLE(x, y, y, y)
33IMPLEMENT_SWIZZLE(x, y, y, z)
34IMPLEMENT_SWIZZLE(x, y, y, w)
35IMPLEMENT_SWIZZLE(x, y, z, x)
36IMPLEMENT_SWIZZLE(x, y, z, y)
37IMPLEMENT_SWIZZLE(x, y, z, z)
38// IMPLEMENT_SWIZZLE(x, y, z, w)
39IMPLEMENT_SWIZZLE(x, y, w, x)
40IMPLEMENT_SWIZZLE(x, y, w, y)
41IMPLEMENT_SWIZZLE(x, y, w, z)
42IMPLEMENT_SWIZZLE(x, y, w, w)
43IMPLEMENT_SWIZZLE(x, z, x, x)
44IMPLEMENT_SWIZZLE(x, z, x, y)
45IMPLEMENT_SWIZZLE(x, z, x, z)
46IMPLEMENT_SWIZZLE(x, z, x, w)
47IMPLEMENT_SWIZZLE(x, z, y, x)
48IMPLEMENT_SWIZZLE(x, z, y, y)
49IMPLEMENT_SWIZZLE(x, z, y, z)
50IMPLEMENT_SWIZZLE(x, z, y, w)
51IMPLEMENT_SWIZZLE(x, z, z, x)
52IMPLEMENT_SWIZZLE(x, z, z, y)
53IMPLEMENT_SWIZZLE(x, z, z, z)
54IMPLEMENT_SWIZZLE(x, z, z, w)
55IMPLEMENT_SWIZZLE(x, z, w, x)
56IMPLEMENT_SWIZZLE(x, z, w, y)
57IMPLEMENT_SWIZZLE(x, z, w, z)
58IMPLEMENT_SWIZZLE(x, z, w, w)
59IMPLEMENT_SWIZZLE(x, w, x, x)
60IMPLEMENT_SWIZZLE(x, w, x, y)
61IMPLEMENT_SWIZZLE(x, w, x, z)
62IMPLEMENT_SWIZZLE(x, w, x, w)
63IMPLEMENT_SWIZZLE(x, w, y, x)
64IMPLEMENT_SWIZZLE(x, w, y, y)
65IMPLEMENT_SWIZZLE(x, w, y, z)
66IMPLEMENT_SWIZZLE(x, w, y, w)
67IMPLEMENT_SWIZZLE(x, w, z, x)
68IMPLEMENT_SWIZZLE(x, w, z, y)
69IMPLEMENT_SWIZZLE(x, w, z, z)
70IMPLEMENT_SWIZZLE(x, w, z, w)
71IMPLEMENT_SWIZZLE(x, w, w, x)
72IMPLEMENT_SWIZZLE(x, w, w, y)
73IMPLEMENT_SWIZZLE(x, w, w, z)
74IMPLEMENT_SWIZZLE(x, w, w, w)
75IMPLEMENT_SWIZZLE(y, x, x, x)
76IMPLEMENT_SWIZZLE(y, x, x, y)
77IMPLEMENT_SWIZZLE(y, x, x, z)
78IMPLEMENT_SWIZZLE(y, x, x, w)
79IMPLEMENT_SWIZZLE(y, x, y, x)
80IMPLEMENT_SWIZZLE(y, x, y, y)
81IMPLEMENT_SWIZZLE(y, x, y, z)
82IMPLEMENT_SWIZZLE(y, x, y, w)
83IMPLEMENT_SWIZZLE(y, x, z, x)
84IMPLEMENT_SWIZZLE(y, x, z, y)
85IMPLEMENT_SWIZZLE(y, x, z, z)
86IMPLEMENT_SWIZZLE(y, x, z, w)
87IMPLEMENT_SWIZZLE(y, x, w, x)
88IMPLEMENT_SWIZZLE(y, x, w, y)
89IMPLEMENT_SWIZZLE(y, x, w, z)
90IMPLEMENT_SWIZZLE(y, x, w, w)
91IMPLEMENT_SWIZZLE(y, y, x, x)
92IMPLEMENT_SWIZZLE(y, y, x, y)
93IMPLEMENT_SWIZZLE(y, y, x, z)
94IMPLEMENT_SWIZZLE(y, y, x, w)
95IMPLEMENT_SWIZZLE(y, y, y, x)
96IMPLEMENT_SWIZZLE(y, y, y, y)
97IMPLEMENT_SWIZZLE(y, y, y, z)
98IMPLEMENT_SWIZZLE(y, y, y, w)
99IMPLEMENT_SWIZZLE(y, y, z, x)
100IMPLEMENT_SWIZZLE(y, y, z, y)
101IMPLEMENT_SWIZZLE(y, y, z, z)
102IMPLEMENT_SWIZZLE(y, y, z, w)
103IMPLEMENT_SWIZZLE(y, y, w, x)
104IMPLEMENT_SWIZZLE(y, y, w, y)
105IMPLEMENT_SWIZZLE(y, y, w, z)
106IMPLEMENT_SWIZZLE(y, y, w, w)
107IMPLEMENT_SWIZZLE(y, z, x, x)
108IMPLEMENT_SWIZZLE(y, z, x, y)
109IMPLEMENT_SWIZZLE(y, z, x, z)
110IMPLEMENT_SWIZZLE(y, z, x, w)
111IMPLEMENT_SWIZZLE(y, z, y, x)
112IMPLEMENT_SWIZZLE(y, z, y, y)
113IMPLEMENT_SWIZZLE(y, z, y, z)
114IMPLEMENT_SWIZZLE(y, z, y, w)
115IMPLEMENT_SWIZZLE(y, z, z, x)
116IMPLEMENT_SWIZZLE(y, z, z, y)
117IMPLEMENT_SWIZZLE(y, z, z, z)
118IMPLEMENT_SWIZZLE(y, z, z, w)
119IMPLEMENT_SWIZZLE(y, z, w, x)
120IMPLEMENT_SWIZZLE(y, z, w, y)
121IMPLEMENT_SWIZZLE(y, z, w, z)
122IMPLEMENT_SWIZZLE(y, z, w, w)
123IMPLEMENT_SWIZZLE(y, w, x, x)
124IMPLEMENT_SWIZZLE(y, w, x, y)
125IMPLEMENT_SWIZZLE(y, w, x, z)
126IMPLEMENT_SWIZZLE(y, w, x, w)
127IMPLEMENT_SWIZZLE(y, w, y, x)
128IMPLEMENT_SWIZZLE(y, w, y, y)
129IMPLEMENT_SWIZZLE(y, w, y, z)
130IMPLEMENT_SWIZZLE(y, w, y, w)
131IMPLEMENT_SWIZZLE(y, w, z, x)
132IMPLEMENT_SWIZZLE(y, w, z, y)
133IMPLEMENT_SWIZZLE(y, w, z, z)
134IMPLEMENT_SWIZZLE(y, w, z, w)
135IMPLEMENT_SWIZZLE(y, w, w, x)
136IMPLEMENT_SWIZZLE(y, w, w, y)
137IMPLEMENT_SWIZZLE(y, w, w, z)
138IMPLEMENT_SWIZZLE(y, w, w, w)
139IMPLEMENT_SWIZZLE(z, x, x, x)
140IMPLEMENT_SWIZZLE(z, x, x, y)
141IMPLEMENT_SWIZZLE(z, x, x, z)
142IMPLEMENT_SWIZZLE(z, x, x, w)
143IMPLEMENT_SWIZZLE(z, x, y, x)
144IMPLEMENT_SWIZZLE(z, x, y, y)
145IMPLEMENT_SWIZZLE(z, x, y, z)
146IMPLEMENT_SWIZZLE(z, x, y, w)
147IMPLEMENT_SWIZZLE(z, x, z, x)
148IMPLEMENT_SWIZZLE(z, x, z, y)
149IMPLEMENT_SWIZZLE(z, x, z, z)
150IMPLEMENT_SWIZZLE(z, x, z, w)
151IMPLEMENT_SWIZZLE(z, x, w, x)
152IMPLEMENT_SWIZZLE(z, x, w, y)
153IMPLEMENT_SWIZZLE(z, x, w, z)
154IMPLEMENT_SWIZZLE(z, x, w, w)
155IMPLEMENT_SWIZZLE(z, y, x, x)
156IMPLEMENT_SWIZZLE(z, y, x, y)
157IMPLEMENT_SWIZZLE(z, y, x, z)
158IMPLEMENT_SWIZZLE(z, y, x, w)
159IMPLEMENT_SWIZZLE(z, y, y, x)
160IMPLEMENT_SWIZZLE(z, y, y, y)
161IMPLEMENT_SWIZZLE(z, y, y, z)
162IMPLEMENT_SWIZZLE(z, y, y, w)
163IMPLEMENT_SWIZZLE(z, y, z, x)
164IMPLEMENT_SWIZZLE(z, y, z, y)
165IMPLEMENT_SWIZZLE(z, y, z, z)
166IMPLEMENT_SWIZZLE(z, y, z, w)
167IMPLEMENT_SWIZZLE(z, y, w, x)
168IMPLEMENT_SWIZZLE(z, y, w, y)
169IMPLEMENT_SWIZZLE(z, y, w, z)
170IMPLEMENT_SWIZZLE(z, y, w, w)
171IMPLEMENT_SWIZZLE(z, z, x, x)
172IMPLEMENT_SWIZZLE(z, z, x, y)
173IMPLEMENT_SWIZZLE(z, z, x, z)
174IMPLEMENT_SWIZZLE(z, z, x, w)
175IMPLEMENT_SWIZZLE(z, z, y, x)
176IMPLEMENT_SWIZZLE(z, z, y, y)
177IMPLEMENT_SWIZZLE(z, z, y, z)
178IMPLEMENT_SWIZZLE(z, z, y, w)
179IMPLEMENT_SWIZZLE(z, z, z, x)
180IMPLEMENT_SWIZZLE(z, z, z, y)
181IMPLEMENT_SWIZZLE(z, z, z, z)
182IMPLEMENT_SWIZZLE(z, z, z, w)
183IMPLEMENT_SWIZZLE(z, z, w, x)
184IMPLEMENT_SWIZZLE(z, z, w, y)
185IMPLEMENT_SWIZZLE(z, z, w, z)
186IMPLEMENT_SWIZZLE(z, z, w, w)
187IMPLEMENT_SWIZZLE(z, w, x, x)
188IMPLEMENT_SWIZZLE(z, w, x, y)
189IMPLEMENT_SWIZZLE(z, w, x, z)
190IMPLEMENT_SWIZZLE(z, w, x, w)
191IMPLEMENT_SWIZZLE(z, w, y, x)
192IMPLEMENT_SWIZZLE(z, w, y, y)
193IMPLEMENT_SWIZZLE(z, w, y, z)
194IMPLEMENT_SWIZZLE(z, w, y, w)
195IMPLEMENT_SWIZZLE(z, w, z, x)
196IMPLEMENT_SWIZZLE(z, w, z, y)
197IMPLEMENT_SWIZZLE(z, w, z, z)
198IMPLEMENT_SWIZZLE(z, w, z, w)
199IMPLEMENT_SWIZZLE(z, w, w, x)
200IMPLEMENT_SWIZZLE(z, w, w, y)
201IMPLEMENT_SWIZZLE(z, w, w, z)
202IMPLEMENT_SWIZZLE(z, w, w, w)
203IMPLEMENT_SWIZZLE(w, x, x, x)
204IMPLEMENT_SWIZZLE(w, x, x, y)
205IMPLEMENT_SWIZZLE(w, x, x, z)
206IMPLEMENT_SWIZZLE(w, x, x, w)
207IMPLEMENT_SWIZZLE(w, x, y, x)
208IMPLEMENT_SWIZZLE(w, x, y, y)
209IMPLEMENT_SWIZZLE(w, x, y, z)
210IMPLEMENT_SWIZZLE(w, x, y, w)
211IMPLEMENT_SWIZZLE(w, x, z, x)
212IMPLEMENT_SWIZZLE(w, x, z, y)
213IMPLEMENT_SWIZZLE(w, x, z, z)
214IMPLEMENT_SWIZZLE(w, x, z, w)
215IMPLEMENT_SWIZZLE(w, x, w, x)
216IMPLEMENT_SWIZZLE(w, x, w, y)
217IMPLEMENT_SWIZZLE(w, x, w, z)
218IMPLEMENT_SWIZZLE(w, x, w, w)
219IMPLEMENT_SWIZZLE(w, y, x, x)
220IMPLEMENT_SWIZZLE(w, y, x, y)
221IMPLEMENT_SWIZZLE(w, y, x, z)
222IMPLEMENT_SWIZZLE(w, y, x, w)
223IMPLEMENT_SWIZZLE(w, y, y, x)
224IMPLEMENT_SWIZZLE(w, y, y, y)
225IMPLEMENT_SWIZZLE(w, y, y, z)
226IMPLEMENT_SWIZZLE(w, y, y, w)
227IMPLEMENT_SWIZZLE(w, y, z, x)
228IMPLEMENT_SWIZZLE(w, y, z, y)
229IMPLEMENT_SWIZZLE(w, y, z, z)
230IMPLEMENT_SWIZZLE(w, y, z, w)
231IMPLEMENT_SWIZZLE(w, y, w, x)
232IMPLEMENT_SWIZZLE(w, y, w, y)
233IMPLEMENT_SWIZZLE(w, y, w, z)
234IMPLEMENT_SWIZZLE(w, y, w, w)
235IMPLEMENT_SWIZZLE(w, z, x, x)
236IMPLEMENT_SWIZZLE(w, z, x, y)
237IMPLEMENT_SWIZZLE(w, z, x, z)
238IMPLEMENT_SWIZZLE(w, z, x, w)
239IMPLEMENT_SWIZZLE(w, z, y, x)
240IMPLEMENT_SWIZZLE(w, z, y, y)
241IMPLEMENT_SWIZZLE(w, z, y, z)
242IMPLEMENT_SWIZZLE(w, z, y, w)
243IMPLEMENT_SWIZZLE(w, z, z, x)
244IMPLEMENT_SWIZZLE(w, z, z, y)
245IMPLEMENT_SWIZZLE(w, z, z, z)
246IMPLEMENT_SWIZZLE(w, z, z, w)
247IMPLEMENT_SWIZZLE(w, z, w, x)
248IMPLEMENT_SWIZZLE(w, z, w, y)
249IMPLEMENT_SWIZZLE(w, z, w, z)
250IMPLEMENT_SWIZZLE(w, z, w, w)
251IMPLEMENT_SWIZZLE(w, w, x, x)
252IMPLEMENT_SWIZZLE(w, w, x, y)
253IMPLEMENT_SWIZZLE(w, w, x, z)
254IMPLEMENT_SWIZZLE(w, w, x, w)
255IMPLEMENT_SWIZZLE(w, w, y, x)
256IMPLEMENT_SWIZZLE(w, w, y, y)
257IMPLEMENT_SWIZZLE(w, w, y, z)
258IMPLEMENT_SWIZZLE(w, w, y, w)
259IMPLEMENT_SWIZZLE(w, w, z, x)
260IMPLEMENT_SWIZZLE(w, w, z, y)
261IMPLEMENT_SWIZZLE(w, w, z, z)
262IMPLEMENT_SWIZZLE(w, w, z, w)
263IMPLEMENT_SWIZZLE(w, w, w, x)
264IMPLEMENT_SWIZZLE(w, w, w, y)
265IMPLEMENT_SWIZZLE(w, w, w, z)
266IMPLEMENT_SWIZZLE(w, w, w, w)
Property changes on: branches/osd/src/lib/bx/float4_swizzle.inl
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/float4_ni.h
r0r31734
1/*
2 * Copyright 2010-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_FLOAT4_NI_H_HEADER_GUARD
7#define BX_FLOAT4_NI_H_HEADER_GUARD
8
9namespace bx
10{
11   BX_FLOAT4_INLINE float4_t float4_shuf_xAzC_ni(float4_t _a, float4_t _b)
12   {
13      const float4_t xAyB   = float4_shuf_xAyB(_a, _b);
14      const float4_t zCwD   = float4_shuf_zCwD(_a, _b);
15      const float4_t result = float4_shuf_xyAB(xAyB, zCwD);
16     
17      return result;
18   }
19
20   BX_FLOAT4_INLINE float4_t float4_shuf_yBwD_ni(float4_t _a, float4_t _b)
21   {
22      const float4_t xAyB   = float4_shuf_xAyB(_a, _b);
23      const float4_t zCwD   = float4_shuf_zCwD(_a, _b);
24      const float4_t result = float4_shuf_zwCD(xAyB, zCwD);
25     
26      return result;
27   }
28
29   BX_FLOAT4_INLINE float4_t float4_madd_ni(float4_t _a, float4_t _b, float4_t _c)
30   {
31      const float4_t mul    = float4_mul(_a, _b);
32      const float4_t result = float4_add(mul, _c);
33
34      return result;
35   }
36
37   BX_FLOAT4_INLINE float4_t float4_nmsub_ni(float4_t _a, float4_t _b, float4_t _c)
38   {
39      const float4_t mul    = float4_mul(_a, _b);
40      const float4_t result = float4_sub(_c, mul);
41
42      return result;
43   }
44
45   BX_FLOAT4_INLINE float4_t float4_div_nr_ni(float4_t _a, float4_t _b)
46   {
47      const float4_t oneish  = float4_isplat(0x3f800001);
48      const float4_t est     = float4_rcp_est(_b);
49      const float4_t iter0   = float4_mul(_a, est);
50      const float4_t tmp1    = float4_nmsub(_b, est, oneish);
51      const float4_t result  = float4_madd(tmp1, iter0, iter0);
52
53      return result;
54   }
55
56   BX_FLOAT4_INLINE float4_t float4_rcp_ni(float4_t _a)
57   {
58      const float4_t one    = float4_splat(1.0f);
59      const float4_t result = float4_div(one, _a);
60
61      return result;
62   }
63
64   BX_FLOAT4_INLINE float4_t float4_orx_ni(float4_t _a)
65   {
66      const float4_t zwxy   = float4_swiz_zwxy(_a);
67      const float4_t tmp0   = float4_or(_a, zwxy);
68      const float4_t tmp1   = float4_swiz_yyyy(_a);
69      const float4_t tmp2   = float4_or(tmp0, tmp1);
70      const float4_t mf000  = float4_ild(UINT32_MAX, 0, 0, 0);
71      const float4_t result = float4_and(tmp2, mf000);
72
73      return result;
74   }
75
76   BX_FLOAT4_INLINE float4_t float4_orc_ni(float4_t _a, float4_t _b)
77   {
78      const float4_t aorb   = float4_or(_a, _b);
79      const float4_t mffff  = float4_isplat(UINT32_MAX);
80      const float4_t result = float4_xor(aorb, mffff);
81
82      return result;
83   }
84
85   BX_FLOAT4_INLINE float4_t float4_neg_ni(float4_t _a)
86   {
87      const float4_t zero   = float4_zero();
88      const float4_t result = float4_sub(zero, _a);
89
90      return result;
91   }
92
93   BX_FLOAT4_INLINE float4_t float4_selb_ni(float4_t _mask, float4_t _a, float4_t _b)
94   {
95      const float4_t sel_a  = float4_and(_a, _mask);
96      const float4_t sel_b  = float4_andc(_b, _mask);
97      const float4_t result = float4_or(sel_a, sel_b);
98
99      return result;
100   }
101
102   BX_FLOAT4_INLINE float4_t float4_sels_ni(float4_t _test, float4_t _a, float4_t _b)
103   {
104      const float4_t mask   = float4_sra(_test, 31);
105      const float4_t result = float4_selb(mask, _a, _b);
106
107      return result;
108   }
109
110   BX_FLOAT4_INLINE float4_t float4_not_ni(float4_t _a)
111   {
112      const float4_t mffff  = float4_isplat(UINT32_MAX);
113      const float4_t result = float4_xor(_a, mffff);
114
115      return result;
116   }
117
118   BX_FLOAT4_INLINE float4_t float4_min_ni(float4_t _a, float4_t _b)
119   {
120      const float4_t mask   = float4_cmplt(_a, _b);
121      const float4_t result = float4_selb(mask, _a, _b);
122
123      return result;
124   }
125
126   BX_FLOAT4_INLINE float4_t float4_max_ni(float4_t _a, float4_t _b)
127   {
128      const float4_t mask   = float4_cmpgt(_a, _b);
129      const float4_t result = float4_selb(mask, _a, _b);
130
131      return result;
132   }
133
134   BX_FLOAT4_INLINE float4_t float4_abs_ni(float4_t _a)
135   {
136      const float4_t a_neg  = float4_neg(_a);
137      const float4_t result = float4_max(a_neg, _a);
138
139      return result;
140   }
141
142   BX_FLOAT4_INLINE float4_t float4_imin_ni(float4_t _a, float4_t _b)
143   {
144      const float4_t mask   = float4_icmplt(_a, _b);
145      const float4_t result = float4_selb(mask, _a, _b);
146
147      return result;
148   }
149
150   BX_FLOAT4_INLINE float4_t float4_imax_ni(float4_t _a, float4_t _b)
151   {
152      const float4_t mask   = float4_icmpgt(_a, _b);
153      const float4_t result = float4_selb(mask, _a, _b);
154
155      return result;
156   }
157
158   BX_FLOAT4_INLINE float4_t float4_clamp_ni(float4_t _a, float4_t _min, float4_t _max)
159   {
160      const float4_t tmp    = float4_min(_a, _max);
161      const float4_t result = float4_max(tmp, _min);
162
163      return result;
164   }
165
166   BX_FLOAT4_INLINE float4_t float4_lerp_ni(float4_t _a, float4_t _b, float4_t _s)
167   {
168      const float4_t ba     = float4_sub(_b, _a);
169      const float4_t result = float4_madd(_s, ba, _a);
170
171      return result;
172   }
173
174   BX_FLOAT4_INLINE float4_t float4_sqrt_nr_ni(float4_t _a)
175   {
176      const float4_t half   = float4_splat(0.5f);
177      const float4_t one    = float4_splat(1.0f);
178      const float4_t zero   = float4_zero();
179      const float4_t tmp0   = float4_rsqrt_est(_a);
180      const float4_t tmp1   = float4_madd(tmp0, _a, zero);
181      const float4_t tmp2   = float4_madd(tmp1, half, zero);
182      const float4_t tmp3   = float4_nmsub(tmp0, tmp1, one);
183      const float4_t result = float4_madd(tmp3, tmp2, tmp1);
184
185      return result;
186   }
187
188   BX_FLOAT4_INLINE float4_t float4_rsqrt_ni(float4_t _a)
189   {
190      const float4_t one    = float4_splat(1.0f);
191      const float4_t sqrt   = float4_sqrt(_a);
192      const float4_t result = float4_div(one, sqrt);
193     
194      return result;
195   }
196
197   BX_FLOAT4_INLINE float4_t float4_rsqrt_nr_ni(float4_t _a)
198   {
199      const float4_t rsqrt           = float4_rsqrt_est(_a);
200      const float4_t iter0           = float4_mul(_a, rsqrt);
201      const float4_t iter1           = float4_mul(iter0, rsqrt);
202      const float4_t half            = float4_splat(0.5f);
203      const float4_t half_rsqrt      = float4_mul(half, rsqrt);
204      const float4_t three           = float4_splat(3.0f);
205      const float4_t three_sub_iter1 = float4_sub(three, iter1);
206      const float4_t result          = float4_mul(half_rsqrt, three_sub_iter1);
207     
208      return result;
209   }
210
211   BX_FLOAT4_INLINE float4_t float4_rsqrt_carmack_ni(float4_t _a)
212   {
213      const float4_t half    = float4_splat(0.5f);
214      const float4_t ah      = float4_mul(half, _a);
215      const float4_t ashift  = float4_sra(_a, 1);
216      const float4_t magic   = float4_isplat(0x5f3759df);
217      const float4_t msuba   = float4_isub(magic, ashift);
218      const float4_t msubasq = float4_mul(msuba, msuba);
219      const float4_t tmp0    = float4_splat(1.5f);
220      const float4_t tmp1    = float4_mul(ah, msubasq);
221      const float4_t tmp2    = float4_sub(tmp0, tmp1);
222      const float4_t result  = float4_mul(msuba, tmp2);
223
224      return result;
225   }
226
227   namespace float4_logexp_detail
228   {
229      BX_FLOAT4_INLINE float4_t float4_poly1(float4_t _a, float _b, float _c)
230      {
231         const float4_t bbbb   = float4_splat(_b);
232         const float4_t cccc   = float4_splat(_c);
233         const float4_t result = float4_madd(cccc, _a, bbbb);
234
235         return result;
236      }
237
238      BX_FLOAT4_INLINE float4_t float4_poly2(float4_t _a, float _b, float _c, float _d)
239      {
240         const float4_t bbbb   = float4_splat(_b);
241         const float4_t poly   = float4_poly1(_a, _c, _d);
242         const float4_t result = float4_madd(poly, _a, bbbb);
243
244         return result;
245      }
246
247      BX_FLOAT4_INLINE float4_t float4_poly3(float4_t _a, float _b, float _c, float _d, float _e)
248      {
249         const float4_t bbbb   = float4_splat(_b);
250         const float4_t poly   = float4_poly2(_a, _c, _d, _e);
251         const float4_t result = float4_madd(poly, _a, bbbb);
252
253         return result;
254      }
255
256      BX_FLOAT4_INLINE float4_t float4_poly4(float4_t _a, float _b, float _c, float _d, float _e, float _f)
257      {
258         const float4_t bbbb   = float4_splat(_b);
259         const float4_t poly   = float4_poly3(_a, _c, _d, _e, _f);
260         const float4_t result = float4_madd(poly, _a, bbbb);
261
262         return result;
263      }
264
265      BX_FLOAT4_INLINE float4_t float4_poly5(float4_t _a, float _b, float _c, float _d, float _e, float _f, float _g)
266      {
267         const float4_t bbbb   = float4_splat(_b);
268         const float4_t poly   = float4_poly4(_a, _c, _d, _e, _f, _g);
269         const float4_t result = float4_madd(poly, _a, bbbb);
270
271         return result;
272      }
273
274      BX_FLOAT4_INLINE float4_t float4_logpoly(float4_t _a)
275      {
276#if 1
277         const float4_t result = float4_poly5(_a
278            , 3.11578814719469302614f, -3.32419399085241980044f
279            , 2.59883907202499966007f, -1.23152682416275988241f
280            , 0.318212422185251071475f, -0.0344359067839062357313f
281            );
282#elif 0
283         const float4_t result = float4_poly4(_a
284            , 2.8882704548164776201f, -2.52074962577807006663f
285            , 1.48116647521213171641f, -0.465725644288844778798f
286            , 0.0596515482674574969533f
287            );
288#elif 0
289         const float4_t result = float4_poly3(_a
290            , 2.61761038894603480148f, -1.75647175389045657003f
291            , 0.688243882994381274313f, -0.107254423828329604454f
292            );
293#else
294         const float4_t result = float4_poly2(_a
295            , 2.28330284476918490682f, -1.04913055217340124191f
296            , 0.204446009836232697516f
297            );
298#endif
299
300         return result;
301      }
302
303      BX_FLOAT4_INLINE float4_t float4_exppoly(float4_t _a)
304      {
305#if 1
306         const float4_t result = float4_poly5(_a
307            , 9.9999994e-1f, 6.9315308e-1f
308            , 2.4015361e-1f, 5.5826318e-2f
309            , 8.9893397e-3f, 1.8775767e-3f
310            );
311#elif 0
312         const float4_t result = float4_poly4(_a
313            , 1.0000026f, 6.9300383e-1f
314            , 2.4144275e-1f, 5.2011464e-2f
315            , 1.3534167e-2f
316            );
317#elif 0
318         const float4_t result = float4_poly3(_a
319            , 9.9992520e-1f, 6.9583356e-1f
320            , 2.2606716e-1f, 7.8024521e-2f
321            );
322#else
323         const float4_t result = float4_poly2(_a
324            , 1.0017247f, 6.5763628e-1f
325            , 3.3718944e-1f
326            );
327#endif // 0
328
329         return result;
330      }
331   } // namespace float4_internal
332
333   BX_FLOAT4_INLINE float4_t float4_log2_ni(float4_t _a)
334   {
335      const float4_t expmask  = float4_isplat(0x7f800000);
336      const float4_t mantmask = float4_isplat(0x007fffff);
337      const float4_t one      = float4_splat(1.0f);
338
339      const float4_t c127     = float4_isplat(127);
340      const float4_t aexp     = float4_and(_a, expmask);
341      const float4_t aexpsr   = float4_srl(aexp, 23);
342      const float4_t tmp0     = float4_isub(aexpsr, c127);
343      const float4_t exp      = float4_itof(tmp0);
344
345      const float4_t amask    = float4_and(_a, mantmask);
346      const float4_t mant     = float4_or(amask, one);
347
348      const float4_t poly     = float4_logexp_detail::float4_logpoly(mant);
349
350      const float4_t mandiff  = float4_sub(mant, one);
351      const float4_t result   = float4_madd(poly, mandiff, exp);
352
353      return result;
354   }
355
356   BX_FLOAT4_INLINE float4_t float4_exp2_ni(float4_t _a)
357   {
358      const float4_t min      = float4_splat( 129.0f);
359      const float4_t max      = float4_splat(-126.99999f);
360      const float4_t tmp0     = float4_min(_a, min);
361      const float4_t aaaa     = float4_max(tmp0, max);
362
363      const float4_t half     = float4_splat(0.5f);
364      const float4_t tmp2     = float4_sub(aaaa, half);
365      const float4_t ipart    = float4_ftoi(tmp2);
366      const float4_t iround   = float4_itof(ipart);
367      const float4_t fpart    = float4_sub(aaaa, iround);
368
369      const float4_t c127     = float4_isplat(127);
370      const float4_t tmp5     = float4_iadd(ipart, c127);
371      const float4_t expipart = float4_sll(tmp5, 23);
372
373      const float4_t expfpart = float4_logexp_detail::float4_exppoly(fpart);
374
375      const float4_t result   = float4_mul(expipart, expfpart);
376     
377      return result;
378   }
379
380   BX_FLOAT4_INLINE float4_t float4_pow_ni(float4_t _a, float4_t _b)
381   {
382      const float4_t alog2  = float4_log2(_a);
383      const float4_t alog2b = float4_mul(alog2, _b);
384      const float4_t result = float4_exp2(alog2b);
385
386      return result;
387   }
388
389   BX_FLOAT4_INLINE float4_t float4_dot3_ni(float4_t _a, float4_t _b)
390   {
391      const float4_t xyzw   = float4_mul(_a, _b);
392      const float4_t xxxx   = float4_swiz_xxxx(xyzw);
393      const float4_t yyyy   = float4_swiz_yyyy(xyzw);
394      const float4_t zzzz   = float4_swiz_zzzz(xyzw);
395      const float4_t tmp1   = float4_add(xxxx, yyyy);
396      const float4_t result = float4_add(zzzz, tmp1);
397      return result;
398   }
399
400   BX_FLOAT4_INLINE float4_t float4_cross3_ni(float4_t _a, float4_t _b)
401   {
402      const float4_t a_yzxw = float4_swiz_yzxw(_a);
403      const float4_t a_zxyw = float4_swiz_zxyw(_a);
404      const float4_t b_zxyw = float4_swiz_zxyw(_b);
405      const float4_t b_yzxw = float4_swiz_yzxw(_b);
406      const float4_t tmp    = float4_mul(a_yzxw, b_zxyw);
407      const float4_t result = float4_nmsub(a_zxyw, b_yzxw, tmp);
408
409      return result;
410   }
411
412   BX_FLOAT4_INLINE float4_t float4_normalize3_ni(float4_t _a)
413   {
414      const float4_t dot3    = float4_dot3(_a, _a);
415      const float4_t invSqrt = float4_rsqrt(dot3);
416      const float4_t result  = float4_mul(_a, invSqrt);
417     
418      return result;
419   }
420
421   BX_FLOAT4_INLINE float4_t float4_dot_ni(float4_t _a, float4_t _b)
422   {
423      const float4_t xyzw   = float4_mul(_a, _b);
424      const float4_t yzwx   = float4_swiz_yzwx(xyzw);
425      const float4_t tmp0   = float4_add(xyzw, yzwx);
426      const float4_t zwxy   = float4_swiz_zwxy(tmp0);
427      const float4_t result = float4_add(tmp0, zwxy);
428
429      return result;
430   }
431
432   BX_FLOAT4_INLINE float4_t float4_ceil_ni(float4_t _a)
433   {
434      const float4_t tmp0   = float4_ftoi(_a);
435      const float4_t tmp1   = float4_itof(tmp0);
436      const float4_t mask   = float4_cmplt(tmp1, _a);
437      const float4_t one    = float4_splat(1.0f);
438      const float4_t tmp2   = float4_and(one, mask);
439      const float4_t result = float4_add(tmp1, tmp2);
440
441      return result;
442   }
443
444   BX_FLOAT4_INLINE float4_t float4_floor_ni(float4_t _a)
445   {
446      const float4_t tmp0   = float4_ftoi(_a);
447      const float4_t tmp1   = float4_itof(tmp0);
448      const float4_t mask   = float4_cmpgt(tmp1, _a);
449      const float4_t one    = float4_splat(1.0f);
450      const float4_t tmp2   = float4_and(one, mask);
451      const float4_t result = float4_sub(tmp1, tmp2);
452
453      return result;
454   }
455
456   BX_FLOAT4_INLINE bool float4_test_any_ni(float4_t _a)
457   {
458      const float4_t mask   = float4_sra(_a, 31);
459      const float4_t zwxy   = float4_swiz_zwxy(mask);
460      const float4_t tmp0   = float4_or(mask, zwxy);
461      const float4_t tmp1   = float4_swiz_yyyy(tmp0);
462      const float4_t tmp2   = float4_or(tmp0, tmp1);
463      int res;
464      float4_stx(&res, tmp2);
465      return 0 != res;
466   }
467
468   BX_FLOAT4_INLINE bool float4_test_all_ni(float4_t _a)
469   {
470      const float4_t bits   = float4_sra(_a, 31);
471      const float4_t m1248  = float4_ild(1, 2, 4, 8);
472      const float4_t mask   = float4_and(bits, m1248);
473      const float4_t zwxy   = float4_swiz_zwxy(mask);
474      const float4_t tmp0   = float4_or(mask, zwxy);
475      const float4_t tmp1   = float4_swiz_yyyy(tmp0);
476      const float4_t tmp2   = float4_or(tmp0, tmp1);
477      int res;
478      float4_stx(&res, tmp2);
479      return 0xf == res;
480   }
481
482} // namespace bx
483
484#endif // BX_FLOAT4_NI_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/float4_ni.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/timer.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_TIMER_H_HEADER_GUARD
7#define BX_TIMER_H_HEADER_GUARD
8
9#include "bx.h"
10
11#if BX_PLATFORM_ANDROID
12#   include <time.h> // clock, clock_gettime
13#elif BX_PLATFORM_EMSCRIPTEN
14#   include <emscripten.h>
15#elif  BX_PLATFORM_FREEBSD || BX_PLATFORM_LINUX || BX_PLATFORM_NACL || BX_PLATFORM_OSX || BX_PLATFORM_IOS || BX_PLATFORM_QNX
16#   include <sys/time.h> // gettimeofday
17#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
18#   include <windows.h>
19#endif // BX_PLATFORM_
20
21namespace bx
22{
23   inline int64_t getHPCounter()
24   {
25#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT
26      LARGE_INTEGER li;
27      // Performance counter value may unexpectedly leap forward
28      // http://support.microsoft.com/kb/274323
29      QueryPerformanceCounter(&li);
30      int64_t i64 = li.QuadPart;
31#elif BX_PLATFORM_ANDROID
32      struct timespec now;
33      clock_gettime(CLOCK_MONOTONIC, &now);
34      int64_t i64 = now.tv_sec*INT64_C(1000000000) + now.tv_nsec;
35#elif BX_PLATFORM_EMSCRIPTEN
36      int64_t i64 = int64_t(1000.0f * emscripten_get_now() );
37#else
38      struct timeval now;
39      gettimeofday(&now, 0);
40      int64_t i64 = now.tv_sec*INT64_C(1000000) + now.tv_usec;
41#endif // BX_PLATFORM_
42      return i64;
43   }
44
45   inline int64_t getHPFrequency()
46   {
47#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT
48      LARGE_INTEGER li;
49      QueryPerformanceFrequency(&li);
50      return li.QuadPart;
51#elif BX_PLATFORM_ANDROID
52      return INT64_C(1000000000);
53#elif BX_PLATFORM_EMSCRIPTEN
54      return INT64_C(1000000);
55#else
56      return INT64_C(1000000);
57#endif // BX_PLATFORM_
58   }
59
60} // namespace bx
61
62#endif // BX_TIMER_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/timer.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/allocator.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5 
6#ifndef BX_ALLOCATOR_H_HEADER_GUARD
7#define BX_ALLOCATOR_H_HEADER_GUARD
8
9#include "bx.h"
10
11#include <memory.h>
12#include <new>
13
14#if BX_CONFIG_ALLOCATOR_CRT
15#   include <malloc.h>
16#endif // BX_CONFIG_ALLOCATOR_CRT
17
18#if BX_CONFIG_ALLOCATOR_DEBUG
19#   define BX_ALLOC(_allocator, _size)                         bx::alloc(_allocator, _size, 0, __FILE__, __LINE__)
20#   define BX_REALLOC(_allocator, _ptr, _size)                 bx::realloc(_allocator, _ptr, _size, 0, __FILE__, __LINE__)
21#   define BX_FREE(_allocator, _ptr)                           bx::free(_allocator, _ptr, 0, __FILE__, __LINE__)
22#   define BX_ALIGNED_ALLOC(_allocator, _size, _align)         bx::alloc(_allocator, _size, _align, __FILE__, __LINE__)
23#   define BX_ALIGNED_REALLOC(_allocator, _ptr, _size, _align) bx::realloc(_allocator, _ptr, _size, _align, __FILE__, __LINE__)
24#   define BX_ALIGNED_FREE(_allocator, _ptr, _align)           bx::free(_allocator, _ptr, _align, __FILE__, __LINE__)
25#   define BX_NEW(_allocator, _type)                           ::new(BX_ALLOC(_allocator, sizeof(_type) ) ) _type
26#   define BX_DELETE(_allocator, _ptr)                         bx::deleteObject(_allocator, _ptr, __FILE__, __LINE__)
27#   define BX_ALIGNED_NEW(_allocator, _type, _align)           ::new(BX_ALIGNED_ALLOC(_allocator, sizeof(_type), _align) ) _type
28#   define BX_ALIGNED_DELETE(_allocator, _ptr, _align)         bx::alignedDeleteObject(_allocator, _ptr, _align, __FILE__, __LINE__)
29#else
30#   define BX_ALLOC(_allocator, _size)                         bx::alloc(_allocator, _size, 0)
31#   define BX_REALLOC(_allocator, _ptr, _size)                 bx::realloc(_allocator, _ptr, _size, 0)
32#   define BX_FREE(_allocator, _ptr)                           bx::free(_allocator, _ptr, 0)
33#   define BX_ALIGNED_ALLOC(_allocator, _size, _align)         bx::alloc(_allocator, _size, _align)
34#   define BX_ALIGNED_REALLOC(_allocator, _ptr, _size, _align) bx::realloc(_allocator, _ptr, _size, _align)
35#   define BX_ALIGNED_FREE(_allocator, _ptr, _align)           bx::free(_allocator, _ptr, _align)
36#   define BX_NEW(_allocator, _type)                           ::new(BX_ALLOC(_allocator, sizeof(_type) ) ) _type
37#   define BX_DELETE(_allocator, _ptr)                         bx::deleteObject(_allocator, _ptr)
38#   define BX_ALIGNED_NEW(_allocator, _type, _align)           ::new(BX_ALIGNED_ALLOC(_allocator, sizeof(_type), _align) ) _type
39#   define BX_ALIGNED_DELETE(_allocator, _ptr, _align)         bx::alignedDeleteObject(_allocator, _ptr, _align)
40#endif // BX_CONFIG_DEBUG_ALLOC
41
42#ifndef BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT
43#   define BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT 8
44#endif // BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT
45
46namespace bx
47{
48   /// Aligns pointer to nearest next aligned address. _align must be power of two.
49   inline void* alignPtr(void* _ptr, size_t _extra, size_t _align = BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT)
50   {
51      union { void* ptr; size_t addr; } un;
52      un.ptr = _ptr;
53      size_t unaligned = un.addr + _extra; // space for header
54      size_t mask = _align-1;
55      size_t aligned = BX_ALIGN_MASK(unaligned, mask);
56      un.addr = aligned;
57      return un.ptr;
58   }
59
60   /// Check if pointer is aligned. _align must be power of two.
61   inline bool isPtrAligned(const void* _ptr, size_t _align = BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT)
62   {
63      union { const void* ptr; size_t addr; } un;
64      un.ptr = _ptr;
65      return 0 == (un.addr & (_align-1) );
66   }
67
68   struct BX_NO_VTABLE AllocatorI
69   {
70      virtual ~AllocatorI() = 0;
71      virtual void* alloc(size_t _size, size_t _align, const char* _file, uint32_t _line) = 0;
72      virtual void free(void* _ptr, size_t _align, const char* _file, uint32_t _line) = 0;
73   };
74
75   inline AllocatorI::~AllocatorI()
76   {
77   }
78
79   struct BX_NO_VTABLE ReallocatorI : public AllocatorI
80   {
81      virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line) = 0;
82   };
83
84   inline void* alloc(AllocatorI* _allocator, size_t _size, size_t _align = 0, const char* _file = NULL, uint32_t _line = 0)
85   {
86      return _allocator->alloc(_size, _align, _file, _line);
87   }
88
89   inline void free(AllocatorI* _allocator, void* _ptr, size_t _align = 0, const char* _file = NULL, uint32_t _line = 0)
90   {
91      _allocator->free(_ptr, _align, _file, _line);
92   }
93
94   inline void* realloc(ReallocatorI* _allocator, void* _ptr, size_t _size, size_t _align = 0, const char* _file = NULL, uint32_t _line = 0)
95   {
96      return _allocator->realloc(_ptr, _size, _align, _file, _line);
97   }
98
99   static inline void* alignedAlloc(AllocatorI* _allocator, size_t _size, size_t _align, const char* _file = NULL, uint32_t _line = 0)
100   {
101      size_t total = _size + _align;
102      uint8_t* ptr = (uint8_t*)alloc(_allocator, total, 0, _file, _line);
103      uint8_t* aligned = (uint8_t*)alignPtr(ptr, sizeof(uint32_t), _align);
104      uint32_t* header = (uint32_t*)aligned - 1;
105      *header = uint32_t(aligned - ptr);
106      return aligned;
107   }
108
109   static inline void alignedFree(AllocatorI* _allocator, void* _ptr, size_t /*_align*/, const char* _file = NULL, uint32_t _line = 0)
110   {
111      uint8_t* aligned = (uint8_t*)_ptr;
112      uint32_t* header = (uint32_t*)aligned - 1;
113      uint8_t* ptr = aligned - *header;
114      free(_allocator, ptr, 0, _file, _line);
115   }
116
117   static inline void* alignedRealloc(ReallocatorI* _allocator, void* _ptr, size_t _size, size_t _align, const char* _file = NULL, uint32_t _line = 0)
118   {
119      if (NULL == _ptr)
120      {
121         return alignedAlloc(_allocator, _size, _align, _file, _line);
122      }
123
124      uint8_t* aligned = (uint8_t*)_ptr;
125      uint32_t offset = *( (uint32_t*)aligned - 1);
126      uint8_t* ptr = aligned - offset;
127      size_t total = _size + _align;
128      ptr = (uint8_t*)realloc(_allocator, ptr, total, 0, _file, _line);
129      uint8_t* newAligned = (uint8_t*)alignPtr(ptr, sizeof(uint32_t), _align);
130
131      if (newAligned == aligned)
132      {
133         return aligned;
134      }
135
136      aligned = ptr + offset;
137      ::memmove(newAligned, aligned, _size);
138      uint32_t* header = (uint32_t*)newAligned - 1;
139      *header = uint32_t(newAligned - ptr);
140      return newAligned;
141   }
142
143   template <typename ObjectT>
144   inline void deleteObject(AllocatorI* _allocator, ObjectT* _object, const char* _file = NULL, uint32_t _line = 0)
145   {
146      if (NULL != _object)
147      {
148         _object->~ObjectT();
149         free(_allocator, _object, 0, _file, _line);
150      }
151   }
152
153   template <typename ObjectT>
154   inline void alignedDeleteObject(AllocatorI* _allocator, ObjectT* _object, size_t _align, const char* _file = NULL, uint32_t _line = 0)
155   {
156      if (NULL != _object)
157      {
158         _object->~ObjectT();
159         alignedFree(_allocator, _object, _align, _file, _line);
160      }
161   }
162
163#if BX_CONFIG_ALLOCATOR_CRT
164   class CrtAllocator : public ReallocatorI
165   {
166   public:
167      CrtAllocator()
168      {
169      }
170
171      virtual ~CrtAllocator()
172      {
173      }
174
175      virtual void* alloc(size_t _size, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE
176      {
177         if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
178         {
179            return ::malloc(_size);
180         }
181
182#   if BX_COMPILER_MSVC
183         BX_UNUSED(_file, _line);
184         return _aligned_malloc(_size, _align);
185#   else
186         return bx::alignedAlloc(this, _size, _align, _file, _line);
187#   endif // BX_
188      }
189
190      virtual void free(void* _ptr, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE
191      {
192         if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
193         {
194            ::free(_ptr);
195            return;
196         }
197
198#   if BX_COMPILER_MSVC
199         BX_UNUSED(_file, _line);
200         _aligned_free(_ptr);
201#   else
202         bx::alignedFree(this, _ptr, _align, _file, _line);
203#   endif // BX_
204      }
205
206      virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE
207      {
208         if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
209         {
210            return ::realloc(_ptr, _size);
211         }
212
213#   if BX_COMPILER_MSVC
214         BX_UNUSED(_file, _line);
215         return _aligned_realloc(_ptr, _size, _align);
216#   else
217         return bx::alignedRealloc(this, _ptr, _size, _align, _file, _line);
218#   endif // BX_
219      }
220   };
221#endif // BX_CONFIG_ALLOCATOR_CRT
222
223} // namespace bx
224
225#endif // BX_ALLOCATOR_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/allocator.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/os.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_OS_H_HEADER_GUARD
7#define BX_OS_H_HEADER_GUARD
8
9#include "bx.h"
10
11#if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
12#   include <windows.h>
13#elif BX_PLATFORM_ANDROID \
14   || BX_PLATFORM_EMSCRIPTEN \
15   || BX_PLATFORM_FREEBSD \
16   || BX_PLATFORM_IOS \
17   || BX_PLATFORM_LINUX \
18   || BX_PLATFORM_NACL \
19   || BX_PLATFORM_OSX
20
21#   include <sched.h> // sched_yield
22#   if BX_PLATFORM_FREEBSD || BX_PLATFORM_IOS || BX_PLATFORM_NACL || BX_PLATFORM_OSX
23#      include <pthread.h> // mach_port_t
24#   endif // BX_PLATFORM_IOS || BX_PLATFORM_OSX || BX_PLATFORM_NACL
25
26#   if BX_PLATFORM_NACL
27#      include <sys/nacl_syscalls.h> // nanosleep
28#   else
29#      include <time.h> // nanosleep
30#      include <dlfcn.h> // dlopen, dlclose, dlsym
31#   endif // BX_PLATFORM_NACL
32
33#   if BX_PLATFORM_LINUX
34#      include <unistd.h> // syscall
35#      include <sys/syscall.h>
36#   endif // BX_PLATFORM_LINUX
37
38#   if BX_PLATFORM_ANDROID
39#      include "debug.h" // getTid is not implemented...
40#   endif // BX_PLATFORM_ANDROID
41#endif // BX_PLATFORM_
42
43#if BX_COMPILER_MSVC
44#   include <direct.h> // _getcwd
45#else
46#   include <unistd.h> // getcwd
47#endif // BX_COMPILER_MSVC
48
49namespace bx
50{
51   inline void sleep(uint32_t _ms)
52   {
53#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360
54      ::Sleep(_ms);
55#elif BX_PLATFORM_WINRT
56        BX_UNUSED(_ms);
57        debugOutput("sleep is not implemented"); debugBreak();
58#else
59      timespec req = {(time_t)_ms/1000, (long)((_ms%1000)*1000000)};
60      timespec rem = {0, 0};
61      ::nanosleep(&req, &rem);
62#endif // BX_PLATFORM_
63   }
64
65   inline void yield()
66   {
67#if BX_PLATFORM_WINDOWS
68      ::SwitchToThread();
69#elif BX_PLATFORM_XBOX360
70      ::Sleep(0);
71#elif BX_PLATFORM_WINRT
72        debugOutput("yield is not implemented"); debugBreak();
73#else
74      ::sched_yield();
75#endif // BX_PLATFORM_
76   }
77
78   inline uint32_t getTid()
79   {
80#if BX_PLATFORM_WINDOWS
81      return ::GetCurrentThreadId();
82#elif BX_PLATFORM_LINUX
83      return (pid_t)::syscall(SYS_gettid);
84#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX
85      return (mach_port_t)::pthread_mach_thread_np(pthread_self() );
86#elif BX_PLATFORM_FREEBSD || BX_PLATFORM_NACL
87      // Casting __nc_basic_thread_data*... need better way to do this.
88      return *(uint32_t*)::pthread_self();
89#else
90//#   pragma message "not implemented."
91      debugOutput("getTid is not implemented"); debugBreak();
92      return 0;
93#endif //
94   }
95
96   inline void* dlopen(const char* _filePath)
97   {
98#if BX_PLATFORM_WINDOWS
99      return (void*)::LoadLibraryA(_filePath);
100#elif BX_PLATFORM_NACL || BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_WINRT
101      BX_UNUSED(_filePath);
102      return NULL;
103#else
104      return ::dlopen(_filePath, RTLD_LOCAL|RTLD_LAZY);
105#endif // BX_PLATFORM_
106   }
107
108   inline void dlclose(void* _handle)
109   {
110#if BX_PLATFORM_WINDOWS
111      ::FreeLibrary( (HMODULE)_handle);
112#elif BX_PLATFORM_NACL || BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_WINRT
113      BX_UNUSED(_handle);
114#else
115      ::dlclose(_handle);
116#endif // BX_PLATFORM_
117   }
118
119   inline void* dlsym(void* _handle, const char* _symbol)
120   {
121#if BX_PLATFORM_WINDOWS
122      return (void*)::GetProcAddress( (HMODULE)_handle, _symbol);
123#elif BX_PLATFORM_NACL || BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_WINRT
124      BX_UNUSED(_handle, _symbol);
125      return NULL;
126#else
127      return ::dlsym(_handle, _symbol);
128#endif // BX_PLATFORM_
129   }
130
131   inline void setenv(const char* _name, const char* _value)
132   {
133#if BX_PLATFORM_WINDOWS
134      ::SetEnvironmentVariableA(_name, _value);
135#elif BX_PLATFORM_WINRT
136        BX_UNUSED(_name, _value);
137#else
138      ::setenv(_name, _value, 1);
139#endif // BX_PLATFORM_
140   }
141
142   inline void unsetenv(const char* _name)
143   {
144#if BX_PLATFORM_WINDOWS
145      ::SetEnvironmentVariableA(_name, NULL);
146#elif BX_PLATFORM_WINRT
147        BX_UNUSED(_name);
148#else
149      ::unsetenv(_name);
150#endif // BX_PLATFORM_
151   }
152
153   inline int chdir(const char* _path)
154   {
155#if BX_PLATFORM_WINRT
156        BX_UNUSED(_path);
157#elif BX_COMPILER_MSVC
158      return ::_chdir(_path);
159#else
160      return ::chdir(_path);
161#endif // BX_COMPILER_
162   }
163
164   inline char* pwd(char* _buffer, uint32_t _size)
165   {
166#if BX_PLATFORM_WINRT
167        BX_UNUSED(_buffer, _size);
168#elif BX_COMPILER_MSVC
169      return ::_getcwd(_buffer, (int)_size);
170#else
171      return ::getcwd(_buffer, _size);
172#endif // BX_COMPILER_
173   }
174
175} // namespace bx
176
177#endif // BX_OS_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/os.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/hash.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_HASH_H_HEADER_GUARD
7#define BX_HASH_H_HEADER_GUARD
8
9#include "bx.h"
10
11namespace bx
12{
13// MurmurHash2 was written by Austin Appleby, and is placed in the public
14// domain. The author hereby disclaims copyright to this source code.
15
16#define MURMUR_M 0x5bd1e995
17#define MURMUR_R 24
18#define mmix(_h, _k) { _k *= MURMUR_M; _k ^= _k >> MURMUR_R; _k *= MURMUR_M; _h *= MURMUR_M; _h ^= _k; }
19
20   class HashMurmur2A
21   {
22   public:
23      void begin(uint32_t _seed = 0)
24      {
25         m_hash = _seed;
26         m_tail = 0;
27         m_count = 0;
28         m_size = 0;
29      }
30
31      void add(const void* _data, int _len)
32      {
33         const uint8_t* data = (uint8_t*)_data;
34         m_size += _len;
35
36         mixTail(data, _len);
37
38         while(_len >= 4)
39         {
40            uint32_t kk = *(uint32_t*)data;
41
42            mmix(m_hash, kk);
43
44            data += 4;
45            _len -= 4;
46         }
47
48         mixTail(data, _len);
49      }
50
51      template<typename Ty>
52      void add(Ty _value)
53      {
54         add(&_value, sizeof(Ty) );
55      }
56
57      uint32_t end()
58      {
59         mmix(m_hash, m_tail);
60         mmix(m_hash, m_size);
61
62         m_hash ^= m_hash >> 13;
63         m_hash *= MURMUR_M;
64         m_hash ^= m_hash >> 15;
65
66         return m_hash;
67      }
68
69   private:
70      void mixTail(const uint8_t*& _data, int& _len)
71      {
72         while( _len && ((_len<4) || m_count) )
73         {
74            m_tail |= (*_data++) << (m_count * 8);
75
76            m_count++;
77            _len--;
78
79            if(m_count == 4)
80            {
81               mmix(m_hash, m_tail);
82               m_tail = 0;
83               m_count = 0;
84            }
85         }
86      }
87
88      uint32_t m_hash;
89      uint32_t m_tail;
90      uint32_t m_count;
91      uint32_t m_size;
92   };
93
94#undef MURMUR_M
95#undef MURMUR_R
96#undef mmix
97
98   inline uint32_t hashMurmur2A(const void* _data, uint32_t _size)
99   {
100      HashMurmur2A murmur;
101      murmur.begin();
102      murmur.add(_data, (int)_size);
103      return murmur.end();
104   }
105
106   template <typename Ty>
107   inline uint32_t hashMurmur2A(const Ty& _data)
108   {
109      return hashMurmur2A(&_data, sizeof(Ty) );
110   }
111
112} // namespace bx
113
114#endif // BX_HASH_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/hash.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/sem.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_SEM_H_HEADER_GUARD
7#define BX_SEM_H_HEADER_GUARD
8
9#include "bx.h"
10#include "mutex.h"
11
12#if BX_CONFIG_SUPPORTS_THREADING
13
14#if BX_PLATFORM_POSIX
15#   include <errno.h>
16#   include <semaphore.h>
17#   include <time.h>
18#   include <pthread.h>
19#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT
20#   include <windows.h>
21#   include <limits.h>
22#endif // BX_PLATFORM_
23
24namespace bx
25{
26#if BX_PLATFORM_POSIX
27
28#   if BX_CONFIG_SEMAPHORE_PTHREAD
29   class Semaphore
30   {
31      BX_CLASS(Semaphore
32         , NO_COPY
33         , NO_ASSIGNMENT
34         );
35
36   public:
37      Semaphore()
38         : m_count(0)
39      {
40         int result;
41         result = pthread_mutex_init(&m_mutex, NULL);
42         BX_CHECK(0 == result, "pthread_mutex_init %d", result);
43
44         result = pthread_cond_init(&m_cond, NULL);
45         BX_CHECK(0 == result, "pthread_cond_init %d", result);
46
47         BX_UNUSED(result);
48      }
49
50      ~Semaphore()
51      {
52         int result;
53         result = pthread_cond_destroy(&m_cond);
54         BX_CHECK(0 == result, "pthread_cond_destroy %d", result);
55
56         result = pthread_mutex_destroy(&m_mutex);
57         BX_CHECK(0 == result, "pthread_mutex_destroy %d", result);
58
59         BX_UNUSED(result);
60      }
61
62      void post(uint32_t _count = 1)
63      {
64         int result = pthread_mutex_lock(&m_mutex);
65         BX_CHECK(0 == result, "pthread_mutex_lock %d", result);
66
67         for (uint32_t ii = 0; ii < _count; ++ii)
68         {
69            result = pthread_cond_signal(&m_cond);
70            BX_CHECK(0 == result, "pthread_cond_signal %d", result);
71         }
72
73         m_count += _count;
74
75         result = pthread_mutex_unlock(&m_mutex);
76         BX_CHECK(0 == result, "pthread_mutex_unlock %d", result);
77
78         BX_UNUSED(result);
79      }
80
81      bool wait(int32_t _msecs = -1)
82      {
83         int result = pthread_mutex_lock(&m_mutex);
84         BX_CHECK(0 == result, "pthread_mutex_lock %d", result);
85
86#      if BX_PLATFORM_NACL || BX_PLATFORM_OSX || BX_PLATFORM_IOS
87         BX_UNUSED(_msecs);
88         BX_CHECK(-1 == _msecs, "NaCl, iOS and OSX don't support pthread_cond_timedwait at this moment.");
89         while (0 == result
90         &&     0 >= m_count)
91         {
92            result = pthread_cond_wait(&m_cond, &m_mutex);
93         }
94#      else
95         timespec ts;
96         clock_gettime(CLOCK_REALTIME, &ts);
97         ts.tv_sec += _msecs/1000;
98         ts.tv_nsec += (_msecs%1000)*1000;
99
100         while (0 == result
101         &&     0 >= m_count)
102         {
103            result = pthread_cond_timedwait(&m_cond, &m_mutex, &ts);
104         }
105#      endif // BX_PLATFORM_NACL || BX_PLATFORM_OSX
106         bool ok = 0 == result;
107
108         if (ok)
109         {
110            --m_count;
111         }
112
113         result = pthread_mutex_unlock(&m_mutex);
114         BX_CHECK(0 == result, "pthread_mutex_unlock %d", result);
115
116         BX_UNUSED(result);
117
118         return ok;
119      }
120
121   private:
122      pthread_mutex_t m_mutex;
123      pthread_cond_t m_cond;
124      int32_t m_count;
125   };
126
127#   else
128
129   class Semaphore
130   {
131      BX_CLASS(Semaphore
132         , NO_COPY
133         , NO_ASSIGNMENT
134         );
135
136   public:
137      Semaphore()
138      {
139         int32_t result = sem_init(&m_handle, 0, 0);
140         BX_CHECK(0 == result, "sem_init failed. errno %d", errno);
141         BX_UNUSED(result);
142      }
143
144      ~Semaphore()
145      {
146         int32_t result = sem_destroy(&m_handle);
147         BX_CHECK(0 == result, "sem_destroy failed. errno %d", errno);
148         BX_UNUSED(result);
149      }
150
151      void post(uint32_t _count = 1)
152      {
153         int32_t result;
154         for (uint32_t ii = 0; ii < _count; ++ii)
155         {
156            result = sem_post(&m_handle);
157            BX_CHECK(0 == result, "sem_post failed. errno %d", errno);
158         }
159         BX_UNUSED(result);
160      }
161
162      bool wait(int32_t _msecs = -1)
163      {
164#      if BX_PLATFORM_NACL || BX_PLATFORM_OSX
165         BX_CHECK(-1 == _msecs, "NaCl and OSX don't support sem_timedwait at this moment."); BX_UNUSED(_msecs);
166         return 0 == sem_wait(&m_handle);
167#      else
168         if (0 > _msecs)
169         {
170            int32_t result;
171            do
172            {
173               result = sem_wait(&m_handle);
174            } // keep waiting when interrupted by a signal handler...
175            while (-1 == result && EINTR == errno);
176            BX_CHECK(0 == result, "sem_wait failed. errno %d", errno);
177            return 0 == result;
178         }
179
180         timespec ts;
181         clock_gettime(CLOCK_REALTIME, &ts);
182         ts.tv_sec += _msecs/1000;
183         ts.tv_nsec += (_msecs%1000)*1000;
184         return 0 == sem_timedwait(&m_handle, &ts);
185#      endif // BX_PLATFORM_
186      }
187
188   private:
189      sem_t m_handle;
190   };
191#   endif // BX_CONFIG_SEMAPHORE_PTHREAD
192
193#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT
194
195   class Semaphore
196   {
197      BX_CLASS(Semaphore
198         , NO_COPY
199         , NO_ASSIGNMENT
200         );
201
202   public:
203      Semaphore()
204      {
205         m_handle = CreateSemaphore(NULL, 0, LONG_MAX, NULL);
206         BX_CHECK(NULL != m_handle, "Failed to create Semaphore!");
207      }
208
209      ~Semaphore()
210      {
211         CloseHandle(m_handle);
212      }
213
214      void post(uint32_t _count = 1) const
215      {
216         ReleaseSemaphore(m_handle, _count, NULL);
217      }
218
219      bool wait(int32_t _msecs = -1) const
220      {
221         DWORD milliseconds = (0 > _msecs) ? INFINITE : _msecs;
222         return WAIT_OBJECT_0 == WaitForSingleObject(m_handle, milliseconds);
223      }
224
225   private:
226      HANDLE m_handle;
227   };
228
229#endif // BX_PLATFORM_
230
231} // namespace bx
232
233#endif // BX_CONFIG_SUPPORTS_THREADING
234
235#endif // BX_SEM_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/sem.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/platform.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_PLATFORM_H_HEADER_GUARD
7#define BX_PLATFORM_H_HEADER_GUARD
8
9#define BX_COMPILER_CLANG 0
10#define BX_COMPILER_GCC   0
11#define BX_COMPILER_MSVC  0
12
13#define BX_PLATFORM_ANDROID    0
14#define BX_PLATFORM_EMSCRIPTEN 0
15#define BX_PLATFORM_FREEBSD    0
16#define BX_PLATFORM_IOS        0
17#define BX_PLATFORM_LINUX      0
18#define BX_PLATFORM_NACL       0
19#define BX_PLATFORM_OSX        0
20#define BX_PLATFORM_QNX        0
21#define BX_PLATFORM_WINDOWS    0
22#define BX_PLATFORM_WINRT      0
23#define BX_PLATFORM_XBOX360    0
24
25#define BX_CPU_ARM  0
26#define BX_CPU_JIT  0
27#define BX_CPU_MIPS 0
28#define BX_CPU_PPC  0
29#define BX_CPU_X86  0
30
31#define BX_ARCH_32BIT 0
32#define BX_ARCH_64BIT 0
33
34#define BX_CPU_ENDIAN_BIG    0
35#define BX_CPU_ENDIAN_LITTLE 0
36
37// http://sourceforge.net/apps/mediawiki/predef/index.php?title=Compilers
38#if defined(_MSC_VER)
39#   undef BX_COMPILER_MSVC
40#   define BX_COMPILER_MSVC 1
41#elif defined(__clang__)
42// clang defines __GNUC__
43#   undef BX_COMPILER_CLANG
44#   define BX_COMPILER_CLANG 1
45#elif defined(__GNUC__)
46#   undef BX_COMPILER_GCC
47#   define BX_COMPILER_GCC 1
48#else
49#   error "BX_COMPILER_* is not defined!"
50#endif //
51
52// http://sourceforge.net/apps/mediawiki/predef/index.php?title=Operating_Systems
53#if defined(_XBOX_VER)
54#   undef BX_PLATFORM_XBOX360
55#   define BX_PLATFORM_XBOX360 1
56#elif defined(_WIN32) || defined(_WIN64)
57// http://msdn.microsoft.com/en-us/library/6sehtctf.aspx
58#   if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
59#      undef BX_PLATFORM_WINDOWS
60#      if !defined(WINVER) && !defined(_WIN32_WINNT)
61      // Windows Server 2003 with SP1, Windows XP with SP2 and above
62#         define WINVER 0x0502
63#         define _WIN32_WINNT 0x0502
64#      endif // !defined(WINVER) && !defined(_WIN32_WINNT)
65#      define BX_PLATFORM_WINDOWS _WIN32_WINNT
66#   else
67#      undef BX_PLATFORM_WINRT
68#      define BX_PLATFORM_WINRT 1
69#   endif
70#elif defined(__native_client__)
71// NaCl compiler defines __linux__
72#   undef BX_PLATFORM_NACL
73#   define BX_PLATFORM_NACL 1
74#elif defined(__ANDROID__)
75// Android compiler defines __linux__
76#   undef BX_PLATFORM_ANDROID
77#   define BX_PLATFORM_ANDROID 1
78#elif defined(__linux__)
79#   undef BX_PLATFORM_LINUX
80#   define BX_PLATFORM_LINUX 1
81#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
82#   undef BX_PLATFORM_IOS
83#   define BX_PLATFORM_IOS 1
84#elif defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
85#   undef BX_PLATFORM_OSX
86#   define BX_PLATFORM_OSX 1
87#elif defined(EMSCRIPTEN)
88#   undef BX_PLATFORM_EMSCRIPTEN
89#   define BX_PLATFORM_EMSCRIPTEN 1
90#elif defined(__QNX__)
91#   undef BX_PLATFORM_QNX
92#   define BX_PLATFORM_QNX 1
93#elif defined(__FreeBSD__)
94#   undef BX_PLATFORM_FREEBSD
95#   define BX_PLATFORM_FREEBSD 1
96#else
97#   error "BX_PLATFORM_* is not defined!"
98#endif //
99
100#define BX_PLATFORM_POSIX (0 \
101                  || BX_PLATFORM_ANDROID \
102                  || BX_PLATFORM_EMSCRIPTEN \
103                  || BX_PLATFORM_FREEBSD \
104                  || BX_PLATFORM_IOS \
105                  || BX_PLATFORM_LINUX \
106                  || BX_PLATFORM_NACL \
107                  || BX_PLATFORM_OSX \
108                  || BX_PLATFORM_QNX \
109                  )
110
111// http://sourceforge.net/apps/mediawiki/predef/index.php?title=Architectures
112#if defined(__arm__) || (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP))
113#   undef BX_CPU_ARM
114#   define BX_CPU_ARM 1
115#   define BX_CACHE_LINE_SIZE 64
116#elif defined(__MIPSEL__) || defined(__mips_isa_rev) // defined(mips)
117#   undef BX_CPU_MIPS
118#   define BX_CPU_MIPS 1
119#   define BX_CACHE_LINE_SIZE 64
120#elif defined(_M_PPC) || defined(__powerpc__) || defined(__powerpc64__)
121#   undef BX_CPU_PPC
122#   define BX_CPU_PPC 1
123#   define BX_CACHE_LINE_SIZE 128
124#elif defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || defined(__x86_64__)
125#   undef BX_CPU_X86
126#   define BX_CPU_X86 1
127#   define BX_CACHE_LINE_SIZE 64
128#else // PNaCl doesn't have CPU defined.
129#   undef BX_CPU_JIT
130#   define BX_CPU_JIT 1
131#   define BX_CACHE_LINE_SIZE 64
132#endif //
133
134#if defined(__x86_64__) || defined(_M_X64) || defined(__64BIT__) || defined(__powerpc64__) || defined(__ppc64__)
135#   undef BX_ARCH_64BIT
136#   define BX_ARCH_64BIT 64
137#else
138#   undef BX_ARCH_32BIT
139#   define BX_ARCH_32BIT 32
140#endif //
141
142#if BX_CPU_PPC
143#   undef BX_CPU_ENDIAN_BIG
144#   define BX_CPU_ENDIAN_BIG 1
145#else
146#   undef BX_CPU_ENDIAN_LITTLE
147#   define BX_CPU_ENDIAN_LITTLE 1
148#endif // BX_PLATFORM_
149
150#ifndef  BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS
151#   define BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS 0
152#endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS
153
154#if BX_COMPILER_GCC
155#   define BX_COMPILER_NAME "GCC"
156#elif BX_COMPILER_CLANG
157#   define BX_COMPILER_NAME "Clang"
158#elif BX_COMPILER_MSVC
159#   define BX_COMPILER_NAME "MSVC"
160#endif // BX_COMPILER_
161
162#if BX_PLATFORM_ANDROID
163#   define BX_PLATFORM_NAME "Android"
164#elif BX_PLATFORM_EMSCRIPTEN
165#   define BX_PLATFORM_NAME "asm.js"
166#elif BX_PLATFORM_FREEBSD
167#   define BX_PLATFORM_NAME "FreeBSD"
168#elif BX_PLATFORM_IOS
169#   define BX_PLATFORM_NAME "iOS"
170#elif BX_PLATFORM_LINUX
171#   define BX_PLATFORM_NAME "Linux"
172#elif BX_PLATFORM_NACL
173#   define BX_PLATFORM_NAME "NaCl"
174#elif BX_PLATFORM_OSX
175#   define BX_PLATFORM_NAME "OSX"
176#elif BX_PLATFORM_QNX
177#   define BX_PLATFORM_NAME "QNX"
178#elif BX_PLATFORM_WINDOWS
179#   define BX_PLATFORM_NAME "Windows"
180#elif BX_PLATFORM_WINRT
181#   define BX_PLATFORM_NAME "WinRT"
182#endif // BX_PLATFORM_
183
184#if BX_CPU_ARM
185#   define BX_CPU_NAME "ARM"
186#elif BX_CPU_MIPS
187#   define BX_CPU_NAME "MIPS"
188#elif BX_CPU_PPC
189#   define BX_CPU_NAME "PowerPC"
190#elif BX_CPU_JIT
191#   define BX_CPU_NAME "JIT-VM"
192#elif BX_CPU_X86
193#   define BX_CPU_NAME "x86"
194#endif // BX_CPU_
195
196#if BX_ARCH_32BIT
197#   define BX_ARCH_NAME "32-bit"
198#elif BX_ARCH_64BIT
199#   define BX_ARCH_NAME "64-bit"
200#endif // BX_ARCH_
201
202#if BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS && BX_COMPILER_MSVC
203#   pragma warning(error:4062) // ENABLE warning C4062: enumerator'...' in switch of enum '...' is not handled
204#   pragma warning(error:4121) // ENABLE warning C4121: 'symbol' : alignment of a member was sensitive to packing
205//#   pragma warning(error:4127) // ENABLE warning C4127: conditional expression is constant
206#   pragma warning(error:4130) // ENABLE warning C4130: 'operator' : logical operation on address of string constant
207#   pragma warning(error:4239) // ENABLE warning C4239: nonstandard extension used : 'argument' : conversion from '*' to '* &' A non-const reference may only be bound to an lvalue
208//#   pragma warning(error:4244) // ENABLE warning C4244: 'argument' : conversion from 'type1' to 'type2', possible loss of data
209#   pragma warning(error:4245) // ENABLE warning C4245: 'conversion' : conversion from 'type1' to 'type2', signed/unsigned mismatch
210#   pragma warning(error:4263) // ENABLE warning C4263: 'function' : member function does not override any base class virtual member function
211#   pragma warning(error:4265) // ENABLE warning C4265: class has virtual functions, but destructor is not virtual
212#   pragma warning(error:4431) // ENABLE warning C4431: missing type specifier - int assumed. Note: C no longer supports default-int
213#   pragma warning(error:4545) // ENABLE warning C4545: expression before comma evaluates to a function which is missing an argument list
214#   pragma warning(error:4549) // ENABLE warning C4549: 'operator' : operator before comma has no effect; did you intend 'operator'?
215#   pragma warning(error:4701) // ENABLE warning C4701: potentially uninitialized local variable 'name' used
216#   pragma warning(error:4706) // ENABLE warning C4706: assignment within conditional expression
217#   pragma warning(error:4100) // ENABLE warning C4100: '' : unreferenced formal parameter
218#   pragma warning(error:4189) // ENABLE warning C4189: '' : local variable is initialized but not referenced
219#   pragma warning(error:4505) // ENABLE warning C4505: '' : unreferenced local function has been removed
220#endif // BX_CONFIG_ENABLE_MSVC_LEVEL4_WARNINGS && BX_COMPILER_MSVC
221
222#if BX_COMPILER_CLANG && BX_PLATFORM_LINUX
223// Clang on Linux complains about missing __float128 type...
224typedef struct { long double x, y; } __float128;
225#endif // BX_COMPILER_CLANG && BX_PLATFORM_LINUX
226
227#endif // BX_PLATFORM_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/platform.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/float4_ref.h
r0r31734
1/*
2 * Copyright 2010-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_FLOAT4_REF_H_HEADER_GUARD
7#define BX_FLOAT4_REF_H_HEADER_GUARD
8
9#include <math.h> // sqrtf
10
11namespace bx
12{
13   typedef union float4_t
14   {
15      float    fxyzw[4];
16      int32_t  ixyzw[4];
17      uint32_t uxyzw[4];
18
19   } float4_t;
20
21#define ELEMx 0
22#define ELEMy 1
23#define ELEMz 2
24#define ELEMw 3
25#define IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
26         BX_FLOAT4_FORCE_INLINE float4_t float4_swiz_##_x##_y##_z##_w(float4_t _a) \
27         { \
28            float4_t result; \
29            result.ixyzw[0] = _a.ixyzw[ELEM##_x]; \
30            result.ixyzw[1] = _a.ixyzw[ELEM##_y]; \
31            result.ixyzw[2] = _a.ixyzw[ELEM##_z]; \
32            result.ixyzw[3] = _a.ixyzw[ELEM##_w]; \
33            return result; \
34         }
35
36#include "float4_swizzle.inl"
37
38#undef IMPLEMENT_SWIZZLE
39#undef ELEMw
40#undef ELEMz
41#undef ELEMy
42#undef ELEMx
43
44#define IMPLEMENT_TEST(_xyzw, _mask) \
45         BX_FLOAT4_FORCE_INLINE bool float4_test_any_##_xyzw(float4_t _test) \
46         { \
47            uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
48                         | ( (_test.uxyzw[2]>>31)<<2) \
49                         | ( (_test.uxyzw[1]>>31)<<1) \
50                         | (  _test.uxyzw[0]>>31)     \
51                         ; \
52            return 0 != (tmp&(_mask) ); \
53         } \
54         \
55         BX_FLOAT4_FORCE_INLINE bool float4_test_all_##_xyzw(float4_t _test) \
56         { \
57            uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
58                         | ( (_test.uxyzw[2]>>31)<<2) \
59                         | ( (_test.uxyzw[1]>>31)<<1) \
60                         | (  _test.uxyzw[0]>>31)     \
61                         ; \
62            return (_mask) == (tmp&(_mask) ); \
63         }
64
65IMPLEMENT_TEST(x    , 0x1);
66IMPLEMENT_TEST(y    , 0x2);
67IMPLEMENT_TEST(xy   , 0x3);
68IMPLEMENT_TEST(z    , 0x4);
69IMPLEMENT_TEST(xz   , 0x5);
70IMPLEMENT_TEST(yz   , 0x6);
71IMPLEMENT_TEST(xyz  , 0x7);
72IMPLEMENT_TEST(w    , 0x8);
73IMPLEMENT_TEST(xw   , 0x9);
74IMPLEMENT_TEST(yw   , 0xa);
75IMPLEMENT_TEST(xyw  , 0xb);
76IMPLEMENT_TEST(zw   , 0xc);
77IMPLEMENT_TEST(xzw  , 0xd);
78IMPLEMENT_TEST(yzw  , 0xe);
79IMPLEMENT_TEST(xyzw , 0xf);
80
81#undef IMPLEMENT_TEST
82
83   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_xyAB(float4_t _a, float4_t _b)
84   {
85      float4_t result;
86      result.uxyzw[0] = _a.uxyzw[0];
87      result.uxyzw[1] = _a.uxyzw[1];
88      result.uxyzw[2] = _b.uxyzw[0];
89      result.uxyzw[3] = _b.uxyzw[1];
90      return result;
91   }
92
93   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_ABxy(float4_t _a, float4_t _b)
94   {
95      float4_t result;
96      result.uxyzw[0] = _b.uxyzw[0];
97      result.uxyzw[1] = _b.uxyzw[1];
98      result.uxyzw[2] = _a.uxyzw[0];
99      result.uxyzw[3] = _a.uxyzw[1];
100      return result;
101   }
102
103   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_CDzw(float4_t _a, float4_t _b)
104   {
105      float4_t result;
106      result.uxyzw[0] = _b.uxyzw[2];
107      result.uxyzw[1] = _b.uxyzw[3];
108      result.uxyzw[2] = _a.uxyzw[2];
109      result.uxyzw[3] = _a.uxyzw[3];
110      return result;
111   }
112
113   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_zwCD(float4_t _a, float4_t _b)
114   {
115      float4_t result;
116      result.uxyzw[0] = _a.uxyzw[2];
117      result.uxyzw[1] = _a.uxyzw[3];
118      result.uxyzw[2] = _b.uxyzw[2];
119      result.uxyzw[3] = _b.uxyzw[3];
120      return result;
121   }
122
123   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_xAyB(float4_t _a, float4_t _b)
124   {
125      float4_t result;
126      result.uxyzw[0] = _a.uxyzw[0];
127      result.uxyzw[1] = _b.uxyzw[0];
128      result.uxyzw[2] = _a.uxyzw[1];
129      result.uxyzw[3] = _b.uxyzw[1];
130      return result;
131   }
132
133   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_yBxA(float4_t _a, float4_t _b)
134   {
135      float4_t result;
136      result.uxyzw[0] = _a.uxyzw[1];
137      result.uxyzw[1] = _b.uxyzw[1];
138      result.uxyzw[2] = _a.uxyzw[0];
139      result.uxyzw[3] = _b.uxyzw[0];
140      return result;
141   }
142
143   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_zCwD(float4_t _a, float4_t _b)
144   {
145      float4_t result;
146      result.uxyzw[0] = _a.uxyzw[2];
147      result.uxyzw[1] = _b.uxyzw[2];
148      result.uxyzw[2] = _a.uxyzw[3];
149      result.uxyzw[3] = _b.uxyzw[3];
150      return result;
151   }
152
153   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_CzDw(float4_t _a, float4_t _b)
154   {
155      float4_t result;
156      result.uxyzw[0] = _b.uxyzw[2];
157      result.uxyzw[1] = _a.uxyzw[2];
158      result.uxyzw[2] = _b.uxyzw[3];
159      result.uxyzw[3] = _a.uxyzw[3];
160      return result;
161   }
162
163   BX_FLOAT4_FORCE_INLINE float float4_x(float4_t _a)
164   {
165      return _a.fxyzw[0];
166   }
167
168   BX_FLOAT4_FORCE_INLINE float float4_y(float4_t _a)
169   {
170      return _a.fxyzw[1];
171   }
172
173   BX_FLOAT4_FORCE_INLINE float float4_z(float4_t _a)
174   {
175      return _a.fxyzw[2];
176   }
177
178   BX_FLOAT4_FORCE_INLINE float float4_w(float4_t _a)
179   {
180      return _a.fxyzw[3];
181   }
182
183   BX_FLOAT4_FORCE_INLINE float4_t float4_ld(const void* _ptr)
184   {
185      const uint32_t* input = reinterpret_cast<const uint32_t*>(_ptr);
186      float4_t result;
187      result.uxyzw[0] = input[0];
188      result.uxyzw[1] = input[1];
189      result.uxyzw[2] = input[2];
190      result.uxyzw[3] = input[3];
191      return result;
192   }
193
194   BX_FLOAT4_FORCE_INLINE void float4_st(void* _ptr, float4_t _a)
195   {
196      uint32_t* result = reinterpret_cast<uint32_t*>(_ptr);
197      result[0] = _a.uxyzw[0];
198      result[1] = _a.uxyzw[1];
199      result[2] = _a.uxyzw[2];
200      result[3] = _a.uxyzw[3];
201   }
202
203   BX_FLOAT4_FORCE_INLINE void float4_stx(void* _ptr, float4_t _a)
204   {
205      uint32_t* result = reinterpret_cast<uint32_t*>(_ptr);
206      result[0] = _a.uxyzw[0];
207   }
208
209   BX_FLOAT4_FORCE_INLINE void float4_stream(void* _ptr, float4_t _a)
210   {
211      uint32_t* result = reinterpret_cast<uint32_t*>(_ptr);
212      result[0] = _a.uxyzw[0];
213      result[1] = _a.uxyzw[1];
214      result[2] = _a.uxyzw[2];
215      result[3] = _a.uxyzw[3];
216   }
217
218   BX_FLOAT4_FORCE_INLINE float4_t float4_ld(float _x, float _y, float _z, float _w)
219   {
220      float4_t result;
221      result.fxyzw[0] = _x;
222      result.fxyzw[1] = _y;
223      result.fxyzw[2] = _z;
224      result.fxyzw[3] = _w;
225      return result;
226   }
227
228   BX_FLOAT4_FORCE_INLINE float4_t float4_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w)
229   {
230      float4_t result;
231      result.uxyzw[0] = _x;
232      result.uxyzw[1] = _y;
233      result.uxyzw[2] = _z;
234      result.uxyzw[3] = _w;
235      return result;
236   }
237
238   BX_FLOAT4_FORCE_INLINE float4_t float4_splat(const void* _ptr)
239   {
240      const uint32_t val = *reinterpret_cast<const uint32_t*>(_ptr);
241      float4_t result;
242      result.uxyzw[0] = val;
243      result.uxyzw[1] = val;
244      result.uxyzw[2] = val;
245      result.uxyzw[3] = val;
246      return result;
247   }
248
249   BX_FLOAT4_FORCE_INLINE float4_t float4_splat(float _a)
250   {
251      return float4_ld(_a, _a, _a, _a);
252   }
253
254   BX_FLOAT4_FORCE_INLINE float4_t float4_isplat(uint32_t _a)
255   {
256      return float4_ild(_a, _a, _a, _a);
257   }
258
259   BX_FLOAT4_FORCE_INLINE float4_t float4_zero()
260   {
261      return float4_ild(0, 0, 0, 0);
262   }
263
264   BX_FLOAT4_FORCE_INLINE float4_t float4_itof(float4_t _a)
265   {
266      float4_t result;
267      result.fxyzw[0] = (float)_a.ixyzw[0];
268      result.fxyzw[1] = (float)_a.ixyzw[1];
269      result.fxyzw[2] = (float)_a.ixyzw[2];
270      result.fxyzw[3] = (float)_a.ixyzw[3];
271      return result;
272   }
273
274   BX_FLOAT4_FORCE_INLINE float4_t float4_ftoi(float4_t _a)
275   {
276      float4_t result;
277      result.ixyzw[0] = (int)_a.fxyzw[0];
278      result.ixyzw[1] = (int)_a.fxyzw[1];
279      result.ixyzw[2] = (int)_a.fxyzw[2];
280      result.ixyzw[3] = (int)_a.fxyzw[3];
281      return result;
282   }
283
284   BX_FLOAT4_FORCE_INLINE float4_t float4_round(float4_t _a)
285   {
286      const float4_t tmp    = float4_ftoi(_a);
287      const float4_t result = float4_itof(tmp);
288
289      return result;
290   }
291
292   BX_FLOAT4_FORCE_INLINE float4_t float4_add(float4_t _a, float4_t _b)
293   {
294      float4_t result;
295      result.fxyzw[0] = _a.fxyzw[0] + _b.fxyzw[0];
296      result.fxyzw[1] = _a.fxyzw[1] + _b.fxyzw[1];
297      result.fxyzw[2] = _a.fxyzw[2] + _b.fxyzw[2];
298      result.fxyzw[3] = _a.fxyzw[3] + _b.fxyzw[3];
299      return result;
300   }
301
302   BX_FLOAT4_FORCE_INLINE float4_t float4_sub(float4_t _a, float4_t _b)
303   {
304      float4_t result;
305      result.fxyzw[0] = _a.fxyzw[0] - _b.fxyzw[0];
306      result.fxyzw[1] = _a.fxyzw[1] - _b.fxyzw[1];
307      result.fxyzw[2] = _a.fxyzw[2] - _b.fxyzw[2];
308      result.fxyzw[3] = _a.fxyzw[3] - _b.fxyzw[3];
309      return result;
310   }
311
312   BX_FLOAT4_FORCE_INLINE float4_t float4_mul(float4_t _a, float4_t _b)
313   {
314      float4_t result;
315      result.fxyzw[0] = _a.fxyzw[0] * _b.fxyzw[0];
316      result.fxyzw[1] = _a.fxyzw[1] * _b.fxyzw[1];
317      result.fxyzw[2] = _a.fxyzw[2] * _b.fxyzw[2];
318      result.fxyzw[3] = _a.fxyzw[3] * _b.fxyzw[3];
319      return result;
320   }
321
322   BX_FLOAT4_FORCE_INLINE float4_t float4_div(float4_t _a, float4_t _b)
323   {
324      float4_t result;
325      result.fxyzw[0] = _a.fxyzw[0] / _b.fxyzw[0];
326      result.fxyzw[1] = _a.fxyzw[1] / _b.fxyzw[1];
327      result.fxyzw[2] = _a.fxyzw[2] / _b.fxyzw[2];
328      result.fxyzw[3] = _a.fxyzw[3] / _b.fxyzw[3];
329      return result;
330   }
331
332   BX_FLOAT4_FORCE_INLINE float4_t float4_rcp_est(float4_t _a)
333   {
334      float4_t result;
335      result.fxyzw[0] = 1.0f / _a.fxyzw[0];
336      result.fxyzw[1] = 1.0f / _a.fxyzw[1];
337      result.fxyzw[2] = 1.0f / _a.fxyzw[2];
338      result.fxyzw[3] = 1.0f / _a.fxyzw[3];
339      return result;
340   }
341
342   BX_FLOAT4_FORCE_INLINE float4_t float4_sqrt(float4_t _a)
343   {
344      float4_t result;
345      result.fxyzw[0] = sqrtf(_a.fxyzw[0]);
346      result.fxyzw[1] = sqrtf(_a.fxyzw[1]);
347      result.fxyzw[2] = sqrtf(_a.fxyzw[2]);
348      result.fxyzw[3] = sqrtf(_a.fxyzw[3]);
349      return result;
350   }
351
352   BX_FLOAT4_FORCE_INLINE float4_t float4_rsqrt_est(float4_t _a)
353   {
354      float4_t result;
355      result.fxyzw[0] = 1.0f / sqrtf(_a.fxyzw[0]);
356      result.fxyzw[1] = 1.0f / sqrtf(_a.fxyzw[1]);
357      result.fxyzw[2] = 1.0f / sqrtf(_a.fxyzw[2]);
358      result.fxyzw[3] = 1.0f / sqrtf(_a.fxyzw[3]);
359      return result;
360   }
361
362   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpeq(float4_t _a, float4_t _b)
363   {
364      float4_t result;
365      result.ixyzw[0] = _a.fxyzw[0] == _b.fxyzw[0] ? 0xffffffff : 0x0;
366      result.ixyzw[1] = _a.fxyzw[1] == _b.fxyzw[1] ? 0xffffffff : 0x0;
367      result.ixyzw[2] = _a.fxyzw[2] == _b.fxyzw[2] ? 0xffffffff : 0x0;
368      result.ixyzw[3] = _a.fxyzw[3] == _b.fxyzw[3] ? 0xffffffff : 0x0;
369      return result;
370   }
371
372   BX_FLOAT4_FORCE_INLINE float4_t float4_cmplt(float4_t _a, float4_t _b)
373   {
374      float4_t result;
375      result.ixyzw[0] = _a.fxyzw[0] < _b.fxyzw[0] ? 0xffffffff : 0x0;
376      result.ixyzw[1] = _a.fxyzw[1] < _b.fxyzw[1] ? 0xffffffff : 0x0;
377      result.ixyzw[2] = _a.fxyzw[2] < _b.fxyzw[2] ? 0xffffffff : 0x0;
378      result.ixyzw[3] = _a.fxyzw[3] < _b.fxyzw[3] ? 0xffffffff : 0x0;
379      return result;
380   }
381
382   BX_FLOAT4_FORCE_INLINE float4_t float4_cmple(float4_t _a, float4_t _b)
383   {
384      float4_t result;
385      result.ixyzw[0] = _a.fxyzw[0] <= _b.fxyzw[0] ? 0xffffffff : 0x0;
386      result.ixyzw[1] = _a.fxyzw[1] <= _b.fxyzw[1] ? 0xffffffff : 0x0;
387      result.ixyzw[2] = _a.fxyzw[2] <= _b.fxyzw[2] ? 0xffffffff : 0x0;
388      result.ixyzw[3] = _a.fxyzw[3] <= _b.fxyzw[3] ? 0xffffffff : 0x0;
389      return result;
390   }
391
392   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpgt(float4_t _a, float4_t _b)
393   {
394      float4_t result;
395      result.ixyzw[0] = _a.fxyzw[0] > _b.fxyzw[0] ? 0xffffffff : 0x0;
396      result.ixyzw[1] = _a.fxyzw[1] > _b.fxyzw[1] ? 0xffffffff : 0x0;
397      result.ixyzw[2] = _a.fxyzw[2] > _b.fxyzw[2] ? 0xffffffff : 0x0;
398      result.ixyzw[3] = _a.fxyzw[3] > _b.fxyzw[3] ? 0xffffffff : 0x0;
399      return result;
400   }
401
402   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpge(float4_t _a, float4_t _b)
403   {
404      float4_t result;
405      result.ixyzw[0] = _a.fxyzw[0] >= _b.fxyzw[0] ? 0xffffffff : 0x0;
406      result.ixyzw[1] = _a.fxyzw[1] >= _b.fxyzw[1] ? 0xffffffff : 0x0;
407      result.ixyzw[2] = _a.fxyzw[2] >= _b.fxyzw[2] ? 0xffffffff : 0x0;
408      result.ixyzw[3] = _a.fxyzw[3] >= _b.fxyzw[3] ? 0xffffffff : 0x0;
409      return result;
410   }
411
412   BX_FLOAT4_FORCE_INLINE float4_t float4_min(float4_t _a, float4_t _b)
413   {
414      float4_t result;
415      result.fxyzw[0] = _a.fxyzw[0] < _b.fxyzw[0] ? _a.fxyzw[0] : _b.fxyzw[0];
416      result.fxyzw[1] = _a.fxyzw[1] < _b.fxyzw[1] ? _a.fxyzw[1] : _b.fxyzw[1];
417      result.fxyzw[2] = _a.fxyzw[2] < _b.fxyzw[2] ? _a.fxyzw[2] : _b.fxyzw[2];
418      result.fxyzw[3] = _a.fxyzw[3] < _b.fxyzw[3] ? _a.fxyzw[3] : _b.fxyzw[3];
419      return result;
420   }
421
422   BX_FLOAT4_FORCE_INLINE float4_t float4_max(float4_t _a, float4_t _b)
423   {
424      float4_t result;
425      result.fxyzw[0] = _a.fxyzw[0] > _b.fxyzw[0] ? _a.fxyzw[0] : _b.fxyzw[0];
426      result.fxyzw[1] = _a.fxyzw[1] > _b.fxyzw[1] ? _a.fxyzw[1] : _b.fxyzw[1];
427      result.fxyzw[2] = _a.fxyzw[2] > _b.fxyzw[2] ? _a.fxyzw[2] : _b.fxyzw[2];
428      result.fxyzw[3] = _a.fxyzw[3] > _b.fxyzw[3] ? _a.fxyzw[3] : _b.fxyzw[3];
429      return result;
430   }
431
432   BX_FLOAT4_FORCE_INLINE float4_t float4_and(float4_t _a, float4_t _b)
433   {
434      float4_t result;
435      result.uxyzw[0] = _a.uxyzw[0] & _b.uxyzw[0];
436      result.uxyzw[1] = _a.uxyzw[1] & _b.uxyzw[1];
437      result.uxyzw[2] = _a.uxyzw[2] & _b.uxyzw[2];
438      result.uxyzw[3] = _a.uxyzw[3] & _b.uxyzw[3];
439      return result;
440   }
441
442   BX_FLOAT4_FORCE_INLINE float4_t float4_andc(float4_t _a, float4_t _b)
443   {
444      float4_t result;
445      result.uxyzw[0] = _a.uxyzw[0] & ~_b.uxyzw[0];
446      result.uxyzw[1] = _a.uxyzw[1] & ~_b.uxyzw[1];
447      result.uxyzw[2] = _a.uxyzw[2] & ~_b.uxyzw[2];
448      result.uxyzw[3] = _a.uxyzw[3] & ~_b.uxyzw[3];
449      return result;
450   }
451
452   BX_FLOAT4_FORCE_INLINE float4_t float4_or(float4_t _a, float4_t _b)
453   {
454      float4_t result;
455      result.uxyzw[0] = _a.uxyzw[0] | _b.uxyzw[0];
456      result.uxyzw[1] = _a.uxyzw[1] | _b.uxyzw[1];
457      result.uxyzw[2] = _a.uxyzw[2] | _b.uxyzw[2];
458      result.uxyzw[3] = _a.uxyzw[3] | _b.uxyzw[3];
459      return result;
460   }
461
462   BX_FLOAT4_FORCE_INLINE float4_t float4_xor(float4_t _a, float4_t _b)
463   {
464      float4_t result;
465      result.uxyzw[0] = _a.uxyzw[0] ^ _b.uxyzw[0];
466      result.uxyzw[1] = _a.uxyzw[1] ^ _b.uxyzw[1];
467      result.uxyzw[2] = _a.uxyzw[2] ^ _b.uxyzw[2];
468      result.uxyzw[3] = _a.uxyzw[3] ^ _b.uxyzw[3];
469      return result;
470   }
471
472   BX_FLOAT4_FORCE_INLINE float4_t float4_sll(float4_t _a, int _count)
473   {
474      float4_t result;
475      result.uxyzw[0] = _a.uxyzw[0] << _count;
476      result.uxyzw[1] = _a.uxyzw[1] << _count;
477      result.uxyzw[2] = _a.uxyzw[2] << _count;
478      result.uxyzw[3] = _a.uxyzw[3] << _count;
479      return result;
480   }
481
482   BX_FLOAT4_FORCE_INLINE float4_t float4_srl(float4_t _a, int _count)
483   {
484      float4_t result;
485      result.uxyzw[0] = _a.uxyzw[0] >> _count;
486      result.uxyzw[1] = _a.uxyzw[1] >> _count;
487      result.uxyzw[2] = _a.uxyzw[2] >> _count;
488      result.uxyzw[3] = _a.uxyzw[3] >> _count;
489      return result;
490   }
491
492   BX_FLOAT4_FORCE_INLINE float4_t float4_sra(float4_t _a, int _count)
493   {
494      float4_t result;
495      result.ixyzw[0] = _a.ixyzw[0] >> _count;
496      result.ixyzw[1] = _a.ixyzw[1] >> _count;
497      result.ixyzw[2] = _a.ixyzw[2] >> _count;
498      result.ixyzw[3] = _a.ixyzw[3] >> _count;
499      return result;
500   }
501
502   BX_FLOAT4_FORCE_INLINE float4_t float4_icmpeq(float4_t _a, float4_t _b)
503   {
504      float4_t result;
505      result.ixyzw[0] = _a.ixyzw[0] == _b.ixyzw[0] ? 0xffffffff : 0x0;
506      result.ixyzw[1] = _a.ixyzw[1] == _b.ixyzw[1] ? 0xffffffff : 0x0;
507      result.ixyzw[2] = _a.ixyzw[2] == _b.ixyzw[2] ? 0xffffffff : 0x0;
508      result.ixyzw[3] = _a.ixyzw[3] == _b.ixyzw[3] ? 0xffffffff : 0x0;
509      return result;
510   }
511
512   BX_FLOAT4_FORCE_INLINE float4_t float4_icmplt(float4_t _a, float4_t _b)
513   {
514      float4_t result;
515      result.ixyzw[0] = _a.ixyzw[0] < _b.ixyzw[0] ? 0xffffffff : 0x0;
516      result.ixyzw[1] = _a.ixyzw[1] < _b.ixyzw[1] ? 0xffffffff : 0x0;
517      result.ixyzw[2] = _a.ixyzw[2] < _b.ixyzw[2] ? 0xffffffff : 0x0;
518      result.ixyzw[3] = _a.ixyzw[3] < _b.ixyzw[3] ? 0xffffffff : 0x0;
519      return result;
520   }
521
522   BX_FLOAT4_FORCE_INLINE float4_t float4_icmpgt(float4_t _a, float4_t _b)
523   {
524      float4_t result;
525      result.ixyzw[0] = _a.ixyzw[0] > _b.ixyzw[0] ? 0xffffffff : 0x0;
526      result.ixyzw[1] = _a.ixyzw[1] > _b.ixyzw[1] ? 0xffffffff : 0x0;
527      result.ixyzw[2] = _a.ixyzw[2] > _b.ixyzw[2] ? 0xffffffff : 0x0;
528      result.ixyzw[3] = _a.ixyzw[3] > _b.ixyzw[3] ? 0xffffffff : 0x0;
529      return result;
530   }
531
532   BX_FLOAT4_FORCE_INLINE float4_t float4_imin(float4_t _a, float4_t _b)
533   {
534      float4_t result;
535      result.ixyzw[0] = _a.ixyzw[0] < _b.ixyzw[0] ? _a.ixyzw[0] : _b.ixyzw[0];
536      result.ixyzw[1] = _a.ixyzw[1] < _b.ixyzw[1] ? _a.ixyzw[1] : _b.ixyzw[1];
537      result.ixyzw[2] = _a.ixyzw[2] < _b.ixyzw[2] ? _a.ixyzw[2] : _b.ixyzw[2];
538      result.ixyzw[3] = _a.ixyzw[3] < _b.ixyzw[3] ? _a.ixyzw[3] : _b.ixyzw[3];
539      return result;
540   }
541
542   BX_FLOAT4_FORCE_INLINE float4_t float4_imax(float4_t _a, float4_t _b)
543   {
544      float4_t result;
545      result.ixyzw[0] = _a.ixyzw[0] > _b.ixyzw[0] ? _a.ixyzw[0] : _b.ixyzw[0];
546      result.ixyzw[1] = _a.ixyzw[1] > _b.ixyzw[1] ? _a.ixyzw[1] : _b.ixyzw[1];
547      result.ixyzw[2] = _a.ixyzw[2] > _b.ixyzw[2] ? _a.ixyzw[2] : _b.ixyzw[2];
548      result.ixyzw[3] = _a.ixyzw[3] > _b.ixyzw[3] ? _a.ixyzw[3] : _b.ixyzw[3];
549      return result;
550   }
551
552   BX_FLOAT4_FORCE_INLINE float4_t float4_iadd(float4_t _a, float4_t _b)
553   {
554      float4_t result;
555      result.ixyzw[0] = _a.ixyzw[0] + _b.ixyzw[0];
556      result.ixyzw[1] = _a.ixyzw[1] + _b.ixyzw[1];
557      result.ixyzw[2] = _a.ixyzw[2] + _b.ixyzw[2];
558      result.ixyzw[3] = _a.ixyzw[3] + _b.ixyzw[3];
559      return result;
560   }
561
562   BX_FLOAT4_FORCE_INLINE float4_t float4_isub(float4_t _a, float4_t _b)
563   {
564      float4_t result;
565      result.ixyzw[0] = _a.ixyzw[0] - _b.ixyzw[0];
566      result.ixyzw[1] = _a.ixyzw[1] - _b.ixyzw[1];
567      result.ixyzw[2] = _a.ixyzw[2] - _b.ixyzw[2];
568      result.ixyzw[3] = _a.ixyzw[3] - _b.ixyzw[3];
569      return result;
570   }
571
572} // namespace bx
573
574#define float4_shuf_xAzC float4_shuf_xAzC_ni
575#define float4_shuf_yBwD float4_shuf_yBwD_ni
576#define float4_rcp float4_rcp_ni
577#define float4_orx float4_orx_ni
578#define float4_orc float4_orc_ni
579#define float4_neg float4_neg_ni
580#define float4_madd float4_madd_ni
581#define float4_nmsub float4_nmsub_ni
582#define float4_div_nr float4_div_nr_ni
583#define float4_selb float4_selb_ni
584#define float4_sels float4_sels_ni
585#define float4_not float4_not_ni
586#define float4_abs float4_abs_ni
587#define float4_clamp float4_clamp_ni
588#define float4_lerp float4_lerp_ni
589#define float4_rsqrt float4_rsqrt_ni
590#define float4_rsqrt_nr float4_rsqrt_nr_ni
591#define float4_rsqrt_carmack float4_rsqrt_carmack_ni
592#define float4_sqrt_nr float4_sqrt_nr_ni
593#define float4_log2 float4_log2_ni
594#define float4_exp2 float4_exp2_ni
595#define float4_pow float4_pow_ni
596#define float4_cross3 float4_cross3_ni
597#define float4_normalize3 float4_normalize3_ni
598#define float4_dot3 float4_dot3_ni
599#define float4_dot float4_dot_ni
600#define float4_ceil float4_ceil_ni
601#define float4_floor float4_floor_ni
602#include "float4_ni.h"
603
604#endif // BX_FLOAT4_REF_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/float4_ref.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/float4x4_t.h
r0r31734
1/*
2 * Copyright 2010-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_FLOAT4X4_H_HEADER_GUARD
7#define BX_FLOAT4X4_H_HEADER_GUARD
8
9#include "float4_t.h"
10
11namespace bx
12{
13   BX_ALIGN_STRUCT_16(struct) float4x4_t
14   {
15      float4_t col[4];
16   };
17
18   BX_FLOAT4_FORCE_INLINE float4_t float4_mul_xyz1(float4_t _a, const float4x4_t* _b)
19   {
20      const float4_t xxxx   = float4_swiz_xxxx(_a);
21      const float4_t yyyy   = float4_swiz_yyyy(_a);
22      const float4_t zzzz   = float4_swiz_zzzz(_a);
23      const float4_t col0   = float4_mul(_b->col[0], xxxx);
24      const float4_t col1   = float4_mul(_b->col[1], yyyy);
25      const float4_t col2   = float4_madd(_b->col[2], zzzz, col0);
26      const float4_t col3   = float4_add(_b->col[3], col1);
27      const float4_t result = float4_add(col2, col3);
28
29      return result;
30   }
31
32   BX_FLOAT4_FORCE_INLINE float4_t float4_mul(float4_t _a, const float4x4_t* _b)
33   {
34      const float4_t xxxx   = float4_swiz_xxxx(_a);
35      const float4_t yyyy   = float4_swiz_yyyy(_a);
36      const float4_t zzzz   = float4_swiz_zzzz(_a);
37      const float4_t wwww   = float4_swiz_wwww(_a);
38      const float4_t col0   = float4_mul(_b->col[0], xxxx);
39      const float4_t col1   = float4_mul(_b->col[1], yyyy);
40      const float4_t col2   = float4_madd(_b->col[2], zzzz, col0);
41      const float4_t col3   = float4_madd(_b->col[3], wwww, col1);
42      const float4_t result = float4_add(col2, col3);
43
44      return result;
45   }
46
47   BX_FLOAT4_INLINE void float4x4_mul(float4x4_t* __restrict _result, const float4x4_t* __restrict _a, const float4x4_t* __restrict _b)
48   {
49      _result->col[0] = float4_mul(_a->col[0], _b);
50      _result->col[1] = float4_mul(_a->col[1], _b);
51      _result->col[2] = float4_mul(_a->col[2], _b);
52      _result->col[3] = float4_mul(_a->col[3], _b);
53   }
54
55   BX_FLOAT4_FORCE_INLINE void float4x4_transpose(float4x4_t* __restrict _result, const float4x4_t* __restrict _mtx)
56   {
57      const float4_t aibj = float4_shuf_xAyB(_mtx->col[0], _mtx->col[2]); // aibj
58      const float4_t emfn = float4_shuf_xAyB(_mtx->col[1], _mtx->col[3]); // emfn
59      const float4_t ckdl = float4_shuf_zCwD(_mtx->col[0], _mtx->col[2]); // ckdl
60      const float4_t gohp = float4_shuf_zCwD(_mtx->col[1], _mtx->col[3]); // gohp
61      _result->col[0] = float4_shuf_xAyB(aibj, emfn); // aeim
62      _result->col[1] = float4_shuf_zCwD(aibj, emfn); // bfjn
63      _result->col[2] = float4_shuf_xAyB(ckdl, gohp); // cgko
64      _result->col[3] = float4_shuf_zCwD(ckdl, gohp); // dhlp
65   }
66
67   BX_FLOAT4_INLINE void float4x4_inverse(float4x4_t* __restrict _result, const float4x4_t* __restrict _a)
68   {
69      const float4_t tmp0 = float4_shuf_xAzC(_a->col[0], _a->col[1]);
70      const float4_t tmp1 = float4_shuf_xAzC(_a->col[2], _a->col[3]);
71      const float4_t tmp2 = float4_shuf_yBwD(_a->col[0], _a->col[1]);
72      const float4_t tmp3 = float4_shuf_yBwD(_a->col[2], _a->col[3]);
73      const float4_t t0   = float4_shuf_xyAB(tmp0, tmp1);
74      const float4_t t1   = float4_shuf_xyAB(tmp3, tmp2);
75      const float4_t t2   = float4_shuf_zwCD(tmp0, tmp1);
76      const float4_t t3   = float4_shuf_zwCD(tmp3, tmp2);
77
78      const float4_t t23 = float4_mul(t2, t3);
79      const float4_t t23_yxwz = float4_swiz_yxwz(t23);
80      const float4_t t23_wzyx = float4_swiz_wzyx(t23);
81
82      float4_t cof0, cof1, cof2, cof3;
83
84      const float4_t zero = float4_zero();
85      cof0 = float4_nmsub(t1, t23_yxwz, zero);
86      cof0 = float4_madd(t1, t23_wzyx, cof0);
87
88      cof1 = float4_nmsub(t0, t23_yxwz, zero);
89      cof1 = float4_madd(t0, t23_wzyx, cof1);
90      cof1 = float4_swiz_zwxy(cof1);
91     
92      const float4_t t12 = float4_mul(t1, t2);
93      const float4_t t12_yxwz = float4_swiz_yxwz(t12);
94      const float4_t t12_wzyx = float4_swiz_wzyx(t12);
95     
96      cof0 = float4_madd(t3, t12_yxwz, cof0);
97      cof0 = float4_nmsub(t3, t12_wzyx, cof0);
98
99      cof3 = float4_mul(t0, t12_yxwz);
100      cof3 = float4_nmsub(t0, t12_wzyx, cof3);
101      cof3 = float4_swiz_zwxy(cof3);
102
103      const float4_t t1_zwxy = float4_swiz_zwxy(t1);
104      const float4_t t2_zwxy = float4_swiz_zwxy(t2);
105
106      const float4_t t13 = float4_mul(t1_zwxy, t3);
107      const float4_t t13_yxwz = float4_swiz_yxwz(t13);
108      const float4_t t13_wzyx = float4_swiz_wzyx(t13);
109
110      cof0 = float4_madd(t2_zwxy, t13_yxwz, cof0);
111      cof0 = float4_nmsub(t2_zwxy, t13_wzyx, cof0);
112
113      cof2 = float4_mul(t0, t13_yxwz);
114      cof2 = float4_nmsub(t0, t13_wzyx, cof2);
115      cof2 = float4_swiz_zwxy(cof2);
116
117      const float4_t t01 = float4_mul(t0, t1);
118      const float4_t t01_yxwz = float4_swiz_yxwz(t01);
119      const float4_t t01_wzyx = float4_swiz_wzyx(t01);
120
121      cof2 = float4_nmsub(t3, t01_yxwz, cof2);
122      cof2 = float4_madd(t3, t01_wzyx, cof2);
123
124      cof3 = float4_madd(t2_zwxy, t01_yxwz, cof3);
125      cof3 = float4_nmsub(t2_zwxy, t01_wzyx, cof3);
126
127      const float4_t t03 = float4_mul(t0, t3);
128      const float4_t t03_yxwz = float4_swiz_yxwz(t03);
129      const float4_t t03_wzyx = float4_swiz_wzyx(t03);
130
131      cof1 = float4_nmsub(t2_zwxy, t03_yxwz, cof1);
132      cof1 = float4_madd(t2_zwxy, t03_wzyx, cof1);
133
134      cof2 = float4_madd(t1, t03_yxwz, cof2);
135      cof2 = float4_nmsub(t1, t03_wzyx, cof2);
136
137      const float4_t t02 = float4_mul(t0, t2_zwxy);
138      const float4_t t02_yxwz = float4_swiz_yxwz(t02);
139      const float4_t t02_wzyx = float4_swiz_wzyx(t02);
140
141      cof1 = float4_madd(t3, t02_yxwz, cof1);
142      cof1 = float4_nmsub(t3, t02_wzyx, cof1);
143
144      cof3 = float4_nmsub(t1, t02_yxwz, cof3);
145      cof3 = float4_madd(t1, t02_wzyx, cof3);
146
147      const float4_t det    = float4_dot(t0, cof0);
148      const float4_t invdet = float4_rcp(det);
149
150      _result->col[0] = float4_mul(cof0, invdet);
151      _result->col[1] = float4_mul(cof1, invdet);
152      _result->col[2] = float4_mul(cof2, invdet);
153      _result->col[3] = float4_mul(cof3, invdet);
154   }
155
156} // namespace bx
157
158#endif // BX_FLOAT4X4_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/float4x4_t.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/ringbuffer.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_RINGBUFFER_H_HEADER_GUARD
7#define BX_RINGBUFFER_H_HEADER_GUARD
8
9#include "bx.h"
10#include "cpu.h"
11#include "uint32_t.h"
12
13namespace bx
14{
15   class RingBufferControl
16   {
17      BX_CLASS(RingBufferControl
18         , NO_COPY
19         , NO_ASSIGNMENT
20         );
21
22   public:
23      RingBufferControl(uint32_t _size)
24         : m_size(_size)
25         , m_current(0)
26         , m_write(0)
27         , m_read(0)
28      {
29      }
30
31      ~RingBufferControl()
32      {
33      }
34
35      uint32_t available() const
36      {
37         return distance(m_read, m_current);
38      }
39
40      uint32_t consume(uint32_t _size) // consumer only
41      {
42         const uint32_t maxSize    = distance(m_read, m_current);
43         const uint32_t sizeNoSign = uint32_and(_size, 0x7FFFFFFF);
44         const uint32_t test       = uint32_sub(sizeNoSign, maxSize);
45         const uint32_t size       = uint32_sels(test, _size, maxSize);
46         const uint32_t advance    = uint32_add(m_read, size);
47         const uint32_t read       = uint32_mod(advance, m_size);
48         m_read = read;
49         return size;
50      }
51
52      uint32_t reserve(uint32_t _size) // producer only
53      {
54         const uint32_t dist       = distance(m_write, m_read)-1;
55         const uint32_t maxSize    = uint32_sels(dist, m_size-1, dist);
56         const uint32_t sizeNoSign = uint32_and(_size, 0x7FFFFFFF);
57         const uint32_t test       = uint32_sub(sizeNoSign, maxSize);
58         const uint32_t size       = uint32_sels(test, _size, maxSize);
59         const uint32_t advance    = uint32_add(m_write, size);
60         const uint32_t write      = uint32_mod(advance, m_size);
61         m_write = write;
62         return size;
63      }
64
65      uint32_t commit(uint32_t _size) // producer only
66      {
67         const uint32_t maxSize    = distance(m_current, m_write);
68         const uint32_t sizeNoSign = uint32_and(_size, 0x7FFFFFFF);
69         const uint32_t test       = uint32_sub(sizeNoSign, maxSize);
70         const uint32_t size       = uint32_sels(test, _size, maxSize);
71         const uint32_t advance    = uint32_add(m_current, size);
72         const uint32_t current    = uint32_mod(advance, m_size);
73         m_current = current;
74         return size;
75      }
76
77      uint32_t distance(uint32_t _from, uint32_t _to) const // both
78      {
79         const uint32_t diff   = uint32_sub(_to, _from);
80         const uint32_t le     = uint32_add(m_size, diff);
81         const uint32_t result = uint32_sels(diff, le, diff);
82
83         return result;
84      }
85
86      const uint32_t m_size;
87      uint32_t m_current;
88      uint32_t m_write;
89      uint32_t m_read;
90   };
91
92   class SpScRingBufferControl
93   {
94      BX_CLASS(SpScRingBufferControl
95         , NO_COPY
96         , NO_ASSIGNMENT
97         );
98
99   public:
100      SpScRingBufferControl(uint32_t _size)
101         : m_size(_size)
102         , m_current(0)
103         , m_write(0)
104         , m_read(0)
105      {
106      }
107
108      ~SpScRingBufferControl()
109      {
110      }
111
112      uint32_t available() const
113      {
114         return distance(m_read, m_current);
115      }
116
117      uint32_t consume(uint32_t _size) // consumer only
118      {
119         const uint32_t maxSize    = distance(m_read, m_current);
120         const uint32_t sizeNoSign = uint32_and(_size, 0x7FFFFFFF);
121         const uint32_t test       = uint32_sub(sizeNoSign, maxSize);
122         const uint32_t size       = uint32_sels(test, _size, maxSize);
123         const uint32_t advance    = uint32_add(m_read, size);
124         const uint32_t read       = uint32_mod(advance, m_size);
125         m_read = read;
126         return size;
127      }
128
129      uint32_t reserve(uint32_t _size) // producer only
130      {
131         const uint32_t dist       = distance(m_write, m_read)-1;
132         const uint32_t maxSize    = uint32_sels(dist, m_size-1, dist);
133         const uint32_t sizeNoSign = uint32_and(_size, 0x7FFFFFFF);
134         const uint32_t test       = uint32_sub(sizeNoSign, maxSize);
135         const uint32_t size       = uint32_sels(test, _size, maxSize);
136         const uint32_t advance    = uint32_add(m_write, size);
137         const uint32_t write      = uint32_mod(advance, m_size);
138         m_write = write;
139         return size;
140      }
141
142      uint32_t commit(uint32_t _size) // producer only
143      {
144         const uint32_t maxSize    = distance(m_current, m_write);
145         const uint32_t sizeNoSign = uint32_and(_size, 0x7FFFFFFF);
146         const uint32_t test       = uint32_sub(sizeNoSign, maxSize);
147         const uint32_t size       = uint32_sels(test, _size, maxSize);
148         const uint32_t advance    = uint32_add(m_current, size);
149         const uint32_t current    = uint32_mod(advance, m_size);
150
151         // must commit all memory writes before moving m_current pointer
152         // once m_current pointer moves data is used by consumer thread
153         memoryBarrier();
154         m_current = current;
155         return size;
156      }
157
158      uint32_t distance(uint32_t _from, uint32_t _to) const // both
159      {
160         const uint32_t diff   = uint32_sub(_to, _from);
161         const uint32_t le     = uint32_add(m_size, diff);
162         const uint32_t result = uint32_sels(diff, le, diff);
163
164         return result;
165      }
166
167      const uint32_t m_size;
168      uint32_t m_current;
169      uint32_t m_write;
170      uint32_t m_read;
171   };
172
173   template <typename Control>
174   class ReadRingBufferT
175   {
176      BX_CLASS(ReadRingBufferT
177         , NO_DEFAULT_CTOR
178         , NO_COPY
179         , NO_ASSIGNMENT
180         );
181
182   public:
183      ReadRingBufferT(Control& _control, const char* _buffer, uint32_t _size)
184         : m_control(_control)
185         , m_read(_control.m_read)
186         , m_end(m_read+_size)
187         , m_size(_size)
188         , m_buffer(_buffer)
189      {
190         BX_CHECK(_control.available() >= _size, "%d >= %d", _control.available(), _size);
191      }
192
193      ~ReadRingBufferT()
194      {
195      }
196
197      void end()
198      {
199         m_control.consume(m_size);
200      }
201
202      void read(char* _data, uint32_t _len)
203      {
204         const uint32_t end = (m_read + _len) % m_control.m_size;
205         uint32_t wrap = 0;
206         const char* from = &m_buffer[m_read];
207
208         if (end < m_read)
209         {
210            wrap = m_control.m_size - m_read;
211            memcpy(_data, from, wrap);
212            _data += wrap;
213            from = (const char*)&m_buffer[0];
214         }
215
216         memcpy(_data, from, _len-wrap);
217
218         m_read = end;
219      }
220
221      void skip(uint32_t _len)
222      {
223         m_read += _len;
224         m_read %= m_control.m_size;
225      }
226
227   private:
228      template <typename Ty>
229      friend class WriteRingBufferT;
230
231      Control& m_control;
232      uint32_t m_read;
233      uint32_t m_end;
234      const uint32_t m_size;
235      const char* m_buffer;
236   };
237
238   typedef ReadRingBufferT<RingBufferControl> ReadRingBuffer;
239   typedef ReadRingBufferT<SpScRingBufferControl> SpScReadRingBuffer;
240
241   template <typename Control>
242   class WriteRingBufferT
243   {
244      BX_CLASS(WriteRingBufferT
245         , NO_DEFAULT_CTOR
246         , NO_COPY
247         , NO_ASSIGNMENT
248         );
249
250   public:
251      WriteRingBufferT(Control& _control, char* _buffer, uint32_t _size)
252         : m_control(_control)
253         , m_size(_size)
254         , m_buffer(_buffer)
255      {
256         uint32_t size = m_control.reserve(_size);
257         BX_UNUSED(size);
258         BX_CHECK(size == _size, "%d == %d", size, _size);
259         m_write = m_control.m_current;
260         m_end = m_write+_size;
261      }
262
263      ~WriteRingBufferT()
264      {
265      }
266
267      void end()
268      {
269         m_control.commit(m_size);
270      }
271
272      void write(const char* _data, uint32_t _len)
273      {
274         const uint32_t end = (m_write + _len) % m_control.m_size;
275         uint32_t wrap = 0;
276         char* to = &m_buffer[m_write];
277
278         if (end < m_write)
279         {
280            wrap = m_control.m_size - m_write;
281            memcpy(to, _data, wrap);
282            _data += wrap;
283            to = (char*)&m_buffer[0];
284         }
285
286         memcpy(to, _data, _len-wrap);
287
288         m_write = end;
289      }
290
291      void write(ReadRingBufferT<Control>& _read, uint32_t _len)
292      {
293         const uint32_t end = (_read.m_read + _len) % _read.m_control.m_size;
294         uint32_t wrap = 0;
295         const char* from = &_read.m_buffer[_read.m_read];
296
297         if (end < _read.m_read)
298         {
299            wrap = _read.m_control.m_size - _read.m_read;
300            write(from, wrap);
301            from = (const char*)&_read.m_buffer[0];
302         }
303
304         write(from, _len-wrap);
305
306         _read.m_read = end;
307      }
308
309      void skip(uint32_t _len)
310      {
311         m_write += _len;
312         m_write %= m_control.m_size;
313      }
314
315   private:
316      Control& m_control;
317      uint32_t m_write;
318      uint32_t m_end;
319      const uint32_t m_size;
320      char* m_buffer;
321   };
322
323   typedef WriteRingBufferT<RingBufferControl> WriteRingBuffer;
324   typedef WriteRingBufferT<SpScRingBufferControl> SpScWriteRingBuffer;
325
326} // namespace bx
327
328#endif // BX_RINGBUFFER_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/ringbuffer.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/mutex.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_MUTEX_H_HEADER_GUARD
7#define BX_MUTEX_H_HEADER_GUARD
8
9#include "bx.h"
10#include "cpu.h"
11#include "sem.h"
12
13#if BX_CONFIG_SUPPORTS_THREADING
14
15#if BX_PLATFORM_NACL || BX_PLATFORM_LINUX || BX_PLATFORM_ANDROID || BX_PLATFORM_OSX
16#   include <pthread.h>
17#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT
18#   include <errno.h>
19#endif // BX_PLATFORM_
20
21namespace bx
22{
23#if BX_PLATFORM_WINDOWS || BX_PLATFORM_XBOX360 || BX_PLATFORM_WINRT
24   typedef CRITICAL_SECTION pthread_mutex_t;
25   typedef unsigned pthread_mutexattr_t;
26
27   inline int pthread_mutex_lock(pthread_mutex_t* _mutex)
28   {
29      EnterCriticalSection(_mutex);
30      return 0;
31   }
32
33   inline int pthread_mutex_unlock(pthread_mutex_t* _mutex)
34   {
35      LeaveCriticalSection(_mutex);
36      return 0;
37   }
38
39   inline int pthread_mutex_trylock(pthread_mutex_t* _mutex)
40   {
41      return TryEnterCriticalSection(_mutex) ? 0 : EBUSY;
42   }
43
44   inline int pthread_mutex_init(pthread_mutex_t* _mutex, pthread_mutexattr_t* /*_attr*/)
45   {
46#if BX_PLATFORM_WINRT
47        InitializeCriticalSectionEx(_mutex, 4000, 0);   // docs recommend 4000 spincount as sane default
48#else
49      InitializeCriticalSection(_mutex);
50#endif
51      return 0;
52   }
53
54   inline int pthread_mutex_destroy(pthread_mutex_t* _mutex)
55   {
56      DeleteCriticalSection(_mutex);
57      return 0;
58   }
59#endif // BX_PLATFORM_
60
61   class Mutex
62   {
63      BX_CLASS(Mutex
64         , NO_COPY
65         , NO_ASSIGNMENT
66         );
67
68   public:
69      Mutex()
70      {
71         pthread_mutex_init(&m_handle, NULL);
72      }
73
74      ~Mutex()
75      {
76         pthread_mutex_destroy(&m_handle);
77      }
78
79      void lock()
80      {
81         pthread_mutex_lock(&m_handle);
82      }
83
84      void unlock()
85      {
86         pthread_mutex_unlock(&m_handle);
87      }
88
89   private:
90      pthread_mutex_t m_handle;
91   };
92
93   class MutexScope
94   {
95      BX_CLASS(MutexScope
96         , NO_DEFAULT_CTOR
97         , NO_COPY
98         , NO_ASSIGNMENT
99         );
100
101   public:
102      MutexScope(Mutex& _mutex)
103         : m_mutex(_mutex)
104      {
105         m_mutex.lock();
106      }
107
108      ~MutexScope()
109      {
110         m_mutex.unlock();
111      }
112
113   private:
114      Mutex& m_mutex;
115   };
116
117   typedef Mutex LwMutex;
118
119   class LwMutexScope
120   {
121      BX_CLASS(LwMutexScope
122         , NO_DEFAULT_CTOR
123         , NO_COPY
124         , NO_ASSIGNMENT
125         );
126
127   public:
128      LwMutexScope(LwMutex& _mutex)
129         : m_mutex(_mutex)
130      {
131         m_mutex.lock();
132      }
133
134      ~LwMutexScope()
135      {
136         m_mutex.unlock();
137      }
138
139   private:
140      LwMutex& m_mutex;
141   };
142
143} // namespace bx
144
145#endif // BX_CONFIG_SUPPORTS_THREADING
146
147#endif // BX_MUTEX_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/mutex.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/float4_sse.h
r0r31734
1/*
2 * Copyright 2010-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_FLOAT4_SSE_H_HEADER_GUARD
7#define BX_FLOAT4_SSE_H_HEADER_GUARD
8
9#include <emmintrin.h> // __m128i
10#if defined(__SSE4_1__)
11#   include <smmintrin.h>
12#endif // defined(__SSE4_1__)
13#include <xmmintrin.h> // __m128
14
15namespace bx
16{
17   typedef __m128 float4_t;
18
19#define ELEMx 0
20#define ELEMy 1
21#define ELEMz 2
22#define ELEMw 3
23#define IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
24         BX_FLOAT4_FORCE_INLINE float4_t float4_swiz_##_x##_y##_z##_w(float4_t _a) \
25         { \
26            return _mm_shuffle_ps( _a, _a, _MM_SHUFFLE(ELEM##_w, ELEM##_z, ELEM##_y, ELEM##_x ) ); \
27         }
28
29#include "float4_swizzle.inl"
30
31#undef IMPLEMENT_SWIZZLE
32#undef ELEMw
33#undef ELEMz
34#undef ELEMy
35#undef ELEMx
36
37#define IMPLEMENT_TEST(_xyzw, _mask) \
38         BX_FLOAT4_FORCE_INLINE bool float4_test_any_##_xyzw(float4_t _test) \
39         { \
40            return 0x0 != (_mm_movemask_ps(_test)&(_mask) ); \
41         } \
42         \
43         BX_FLOAT4_FORCE_INLINE bool float4_test_all_##_xyzw(float4_t _test) \
44         { \
45            return (_mask) == (_mm_movemask_ps(_test)&(_mask) ); \
46         }
47
48IMPLEMENT_TEST(x    , 0x1);
49IMPLEMENT_TEST(y    , 0x2);
50IMPLEMENT_TEST(xy   , 0x3);
51IMPLEMENT_TEST(z    , 0x4);
52IMPLEMENT_TEST(xz   , 0x5);
53IMPLEMENT_TEST(yz   , 0x6);
54IMPLEMENT_TEST(xyz  , 0x7);
55IMPLEMENT_TEST(w    , 0x8);
56IMPLEMENT_TEST(xw   , 0x9);
57IMPLEMENT_TEST(yw   , 0xa);
58IMPLEMENT_TEST(xyw  , 0xb);
59IMPLEMENT_TEST(zw   , 0xc);
60IMPLEMENT_TEST(xzw  , 0xd);
61IMPLEMENT_TEST(yzw  , 0xe);
62IMPLEMENT_TEST(xyzw , 0xf);
63
64#undef IMPLEMENT_TEST
65
66   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_xyAB(float4_t _a, float4_t _b)
67   {
68      return _mm_movelh_ps(_a, _b);
69   }
70
71   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_ABxy(float4_t _a, float4_t _b)
72   {
73      return _mm_movelh_ps(_b, _a);
74   }
75
76   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_CDzw(float4_t _a, float4_t _b)
77   {
78      return _mm_movehl_ps(_a, _b);
79   }
80
81   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_zwCD(float4_t _a, float4_t _b)
82   {
83      return _mm_movehl_ps(_b, _a);
84   }
85
86   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_xAyB(float4_t _a, float4_t _b)
87   {
88      return _mm_unpacklo_ps(_a, _b);
89   }
90
91   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_yBxA(float4_t _a, float4_t _b)
92   {
93      return _mm_unpacklo_ps(_b, _a);
94   }
95
96   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_zCwD(float4_t _a, float4_t _b)
97   {
98      return _mm_unpackhi_ps(_a, _b);
99   }
100
101   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_CzDw(float4_t _a, float4_t _b)
102   {
103      return _mm_unpackhi_ps(_b, _a);
104   }
105
106   BX_FLOAT4_FORCE_INLINE float float4_x(float4_t _a)
107   {
108      return _mm_cvtss_f32(_a);
109   }
110
111   BX_FLOAT4_FORCE_INLINE float float4_y(float4_t _a)
112   {
113      const float4_t yyyy = float4_swiz_yyyy(_a);
114      const float result  = _mm_cvtss_f32(yyyy);
115
116      return result;
117   }
118
119   BX_FLOAT4_FORCE_INLINE float float4_z(float4_t _a)
120   {
121      const float4_t zzzz = float4_swiz_zzzz(_a);
122      const float result  = _mm_cvtss_f32(zzzz);
123
124      return result;
125   }
126
127   BX_FLOAT4_FORCE_INLINE float float4_w(float4_t _a)
128   {
129      const float4_t wwww = float4_swiz_wwww(_a);
130      const float result  = _mm_cvtss_f32(wwww);
131
132      return result;
133   }
134
135   BX_FLOAT4_FORCE_INLINE float4_t float4_ld(const void* _ptr)
136   {
137      return _mm_load_ps(reinterpret_cast<const float*>(_ptr) );
138   }
139
140   BX_FLOAT4_FORCE_INLINE void float4_st(void* _ptr, float4_t _a)
141   {
142      _mm_store_ps(reinterpret_cast<float*>(_ptr), _a);
143   }
144
145   BX_FLOAT4_FORCE_INLINE void float4_stx(void* _ptr, float4_t _a)
146   {
147      _mm_store_ss(reinterpret_cast<float*>(_ptr), _a);
148   }
149
150   BX_FLOAT4_FORCE_INLINE void float4_stream(void* _ptr, float4_t _a)
151   {
152      _mm_stream_ps(reinterpret_cast<float*>(_ptr), _a);
153   }
154
155   BX_FLOAT4_FORCE_INLINE float4_t float4_ld(float _x, float _y, float _z, float _w)
156   {
157      return _mm_set_ps(_w, _z, _y, _x);
158   }
159
160   BX_FLOAT4_FORCE_INLINE float4_t float4_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w)
161   {
162      const __m128i set     = _mm_set_epi32(_w, _z, _y, _x);
163      const float4_t result = _mm_castsi128_ps(set);
164     
165      return result;
166   }
167
168   BX_FLOAT4_FORCE_INLINE float4_t float4_splat(const void* _ptr)
169   {
170      const float4_t x___   = _mm_load_ss(reinterpret_cast<const float*>(_ptr) );
171      const float4_t result = float4_swiz_xxxx(x___);
172
173      return result;
174   }
175
176   BX_FLOAT4_FORCE_INLINE float4_t float4_splat(float _a)
177   {
178      return _mm_set1_ps(_a);
179   }
180
181   BX_FLOAT4_FORCE_INLINE float4_t float4_isplat(uint32_t _a)
182   {
183      const __m128i splat   = _mm_set1_epi32(_a);
184      const float4_t result = _mm_castsi128_ps(splat);
185
186      return result;
187   }
188
189   BX_FLOAT4_FORCE_INLINE float4_t float4_zero()
190   {
191      return _mm_setzero_ps();
192   }
193
194   BX_FLOAT4_FORCE_INLINE float4_t float4_itof(float4_t _a)
195   {
196      const __m128i  itof   = _mm_castps_si128(_a);
197      const float4_t result = _mm_cvtepi32_ps(itof);
198
199      return result;
200   }
201
202   BX_FLOAT4_FORCE_INLINE float4_t float4_ftoi(float4_t _a)
203   {
204      const __m128i ftoi    = _mm_cvtps_epi32(_a);
205      const float4_t result = _mm_castsi128_ps(ftoi);
206
207      return result;
208   }
209
210   BX_FLOAT4_FORCE_INLINE float4_t float4_round(float4_t _a)
211   {
212#if defined(__SSE4_1__)
213      return _mm_round_ps(_a, _MM_FROUND_NINT);
214#else
215      const __m128i round   = _mm_cvtps_epi32(_a);
216      const float4_t result = _mm_cvtepi32_ps(round);
217
218      return result;
219#endif // defined(__SSE4_1__)
220   }
221
222   BX_FLOAT4_FORCE_INLINE float4_t float4_add(float4_t _a, float4_t _b)
223   {
224      return _mm_add_ps(_a, _b);
225   }
226
227   BX_FLOAT4_FORCE_INLINE float4_t float4_sub(float4_t _a, float4_t _b)
228   {
229      return _mm_sub_ps(_a, _b);
230   }
231
232   BX_FLOAT4_FORCE_INLINE float4_t float4_mul(float4_t _a, float4_t _b)
233   {
234      return _mm_mul_ps(_a, _b);
235   }
236
237   BX_FLOAT4_FORCE_INLINE float4_t float4_div(float4_t _a, float4_t _b)
238   {
239      return _mm_div_ps(_a, _b);
240   }
241
242   BX_FLOAT4_FORCE_INLINE float4_t float4_rcp_est(float4_t _a)
243   {
244      return _mm_rcp_ps(_a);
245   }
246
247   BX_FLOAT4_FORCE_INLINE float4_t float4_sqrt(float4_t _a)
248   {
249      return _mm_sqrt_ps(_a);
250   }
251
252   BX_FLOAT4_FORCE_INLINE float4_t float4_rsqrt_est(float4_t _a)
253   {
254      return _mm_rsqrt_ps(_a);
255   }
256
257#if defined(__SSE4_1__)
258   BX_FLOAT4_FORCE_INLINE float4_t float4_dot3(float4_t _a, float4_t _b)
259   {
260      return _mm_dp_ps(_a, _b, 0x77);
261   }
262
263   BX_FLOAT4_FORCE_INLINE float4_t float4_dot(float4_t _a, float4_t _b)
264   {
265      return _mm_dp_ps(_a, _b, 0xFF);
266   }
267#endif // defined(__SSE4__)
268
269   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpeq(float4_t _a, float4_t _b)
270   {
271      return _mm_cmpeq_ps(_a, _b);
272   }
273
274   BX_FLOAT4_FORCE_INLINE float4_t float4_cmplt(float4_t _a, float4_t _b)
275   {
276      return _mm_cmplt_ps(_a, _b);
277   }
278
279   BX_FLOAT4_FORCE_INLINE float4_t float4_cmple(float4_t _a, float4_t _b)
280   {
281      return _mm_cmple_ps(_a, _b);
282   }
283
284   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpgt(float4_t _a, float4_t _b)
285   {
286      return _mm_cmpgt_ps(_a, _b);
287   }
288
289   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpge(float4_t _a, float4_t _b)
290   {
291      return _mm_cmpge_ps(_a, _b);
292   }
293
294   BX_FLOAT4_FORCE_INLINE float4_t float4_min(float4_t _a, float4_t _b)
295   {
296      return _mm_min_ps(_a, _b);
297   }
298
299   BX_FLOAT4_FORCE_INLINE float4_t float4_max(float4_t _a, float4_t _b)
300   {
301      return _mm_max_ps(_a, _b);
302   }
303
304   BX_FLOAT4_FORCE_INLINE float4_t float4_and(float4_t _a, float4_t _b)
305   {
306      return _mm_and_ps(_a, _b);
307   }
308
309   BX_FLOAT4_FORCE_INLINE float4_t float4_andc(float4_t _a, float4_t _b)
310   {
311      return _mm_andnot_ps(_b, _a);
312   }
313
314   BX_FLOAT4_FORCE_INLINE float4_t float4_or(float4_t _a, float4_t _b)
315   {
316      return _mm_or_ps(_a, _b);
317   }
318
319   BX_FLOAT4_FORCE_INLINE float4_t float4_xor(float4_t _a, float4_t _b)
320   {
321      return _mm_xor_ps(_a, _b);
322   }
323
324   BX_FLOAT4_FORCE_INLINE float4_t float4_sll(float4_t _a, int _count)
325   {
326      const __m128i a       = _mm_castps_si128(_a);
327      const __m128i shift   = _mm_slli_epi32(a, _count);
328      const float4_t result = _mm_castsi128_ps(shift);
329
330      return result;
331   }
332
333   BX_FLOAT4_FORCE_INLINE float4_t float4_srl(float4_t _a, int _count)
334   {
335      const __m128i a       = _mm_castps_si128(_a);
336      const __m128i shift   = _mm_srli_epi32(a, _count);
337      const float4_t result = _mm_castsi128_ps(shift);
338
339      return result;
340   }
341
342   BX_FLOAT4_FORCE_INLINE float4_t float4_sra(float4_t _a, int _count)
343   {
344      const __m128i a       = _mm_castps_si128(_a);
345      const __m128i shift   = _mm_srai_epi32(a, _count);
346      const float4_t result = _mm_castsi128_ps(shift);
347
348      return result;
349   }
350
351   BX_FLOAT4_FORCE_INLINE float4_t float4_icmpeq(float4_t _a, float4_t _b)
352   {
353      const __m128i tmp0    = _mm_castps_si128(_a);
354      const __m128i tmp1    = _mm_castps_si128(_b);
355      const __m128i tmp2    = _mm_cmpeq_epi32(tmp0, tmp1);
356      const float4_t result = _mm_castsi128_ps(tmp2);
357
358      return result;
359   }
360
361   BX_FLOAT4_FORCE_INLINE float4_t float4_icmplt(float4_t _a, float4_t _b)
362   {
363      const __m128i tmp0    = _mm_castps_si128(_a);
364      const __m128i tmp1    = _mm_castps_si128(_b);
365      const __m128i tmp2    = _mm_cmplt_epi32(tmp0, tmp1);
366      const float4_t result = _mm_castsi128_ps(tmp2);
367
368      return result;
369   }
370
371   BX_FLOAT4_FORCE_INLINE float4_t float4_icmpgt(float4_t _a, float4_t _b)
372   {
373      const __m128i tmp0    = _mm_castps_si128(_a);
374      const __m128i tmp1    = _mm_castps_si128(_b);
375      const __m128i tmp2    = _mm_cmpgt_epi32(tmp0, tmp1);
376      const float4_t result = _mm_castsi128_ps(tmp2);
377
378      return result;
379   }
380
381#if defined(__SSE4_1__)
382   BX_FLOAT4_FORCE_INLINE float4_t float4_imin(float4_t _a, float4_t _b)
383   {
384      const __m128i tmp0    = _mm_castps_si128(_a);
385      const __m128i tmp1    = _mm_castps_si128(_b);
386      const __m128i tmp2    = _mm_min_epi32(tmp0, tmp1);
387      const float4_t result = _mm_castsi128_ps(tmp2);
388
389      return result;
390   }
391
392   BX_FLOAT4_FORCE_INLINE float4_t float4_imax(float4_t _a, float4_t _b)
393   {
394      const __m128i tmp0    = _mm_castps_si128(_a);
395      const __m128i tmp1    = _mm_castps_si128(_b);
396      const __m128i tmp2    = _mm_max_epi32(tmp0, tmp1);
397      const float4_t result = _mm_castsi128_ps(tmp2);
398
399      return result;
400   }
401#endif // defined(__SSE4_1__)
402
403   BX_FLOAT4_FORCE_INLINE float4_t float4_iadd(float4_t _a, float4_t _b)
404   {
405      const __m128i a       = _mm_castps_si128(_a);
406      const __m128i b       = _mm_castps_si128(_b);
407      const __m128i add     = _mm_add_epi32(a, b);
408      const float4_t result = _mm_castsi128_ps(add);
409
410      return result;
411   }
412
413   BX_FLOAT4_FORCE_INLINE float4_t float4_isub(float4_t _a, float4_t _b)
414   {
415      const __m128i a       = _mm_castps_si128(_a);
416      const __m128i b       = _mm_castps_si128(_b);
417      const __m128i sub     = _mm_sub_epi32(a, b);
418      const float4_t result = _mm_castsi128_ps(sub);
419
420      return result;
421   }
422
423} // namespace bx
424
425#define float4_shuf_xAzC     float4_shuf_xAzC_ni
426#define float4_shuf_yBwD     float4_shuf_yBwD_ni
427#define float4_rcp           float4_rcp_ni
428#define float4_orx           float4_orx_ni
429#define float4_orc           float4_orc_ni
430#define float4_neg           float4_neg_ni
431#define float4_madd          float4_madd_ni
432#define float4_nmsub         float4_nmsub_ni
433#define float4_div_nr        float4_div_nr_ni
434#define float4_selb          float4_selb_ni
435#define float4_sels          float4_sels_ni
436#define float4_not           float4_not_ni
437#define float4_abs           float4_abs_ni
438#define float4_clamp         float4_clamp_ni
439#define float4_lerp          float4_lerp_ni
440#define float4_rsqrt         float4_rsqrt_ni
441#define float4_rsqrt_nr      float4_rsqrt_nr_ni
442#define float4_rsqrt_carmack float4_rsqrt_carmack_ni
443#define float4_sqrt_nr       float4_sqrt_nr_ni
444#define float4_log2          float4_log2_ni
445#define float4_exp2          float4_exp2_ni
446#define float4_pow           float4_pow_ni
447#define float4_cross3        float4_cross3_ni
448#define float4_normalize3    float4_normalize3_ni
449#define float4_ceil          float4_ceil_ni
450#define float4_floor         float4_floor_ni
451
452#if !defined(__SSE4_1__)
453#   define float4_dot3       float4_dot3_ni
454#   define float4_dot        float4_dot_ni
455#   define float4_imin       float4_imin_ni
456#   define float4_imax       float4_imax_ni
457#endif // defined(__SSE4_1__)
458
459#include "float4_ni.h"
460
461#endif // BX_FLOAT4_SSE_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/float4_sse.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/uint32_t.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6// Copyright 2006 Mike Acton <macton@gmail.com>
7//
8// Permission is hereby granted, free of charge, to any person obtaining a
9// copy of this software and associated documentation files (the "Software"),
10// to deal in the Software without restriction, including without limitation
11// the rights to use, copy, modify, merge, publish, distribute, sublicense,
12// and/or sell copies of the Software, and to permit persons to whom the
13// Software is furnished to do so, subject to the following conditions:
14//
15// The above copyright notice and this permission notice shall be included
16// in all copies or substantial portions of the Software.
17//
18// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24// THE SOFTWARE
25
26#ifndef BX_UINT32_T_H_HEADER_GUARD
27#define BX_UINT32_T_H_HEADER_GUARD
28
29#include "bx.h"
30
31#if BX_COMPILER_MSVC
32#   if BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT
33#      include <math.h> // math.h is included because VS bitches:
34                   // warning C4985: 'ceil': attributes not present on previous declaration.
35                   // must be included before intrin.h.
36#      include <intrin.h>
37#      pragma intrinsic(_BitScanForward)
38#      pragma intrinsic(_BitScanReverse)
39#      if BX_ARCH_64BIT
40#         pragma intrinsic(_BitScanForward64)
41#         pragma intrinsic(_BitScanReverse64)
42#      endif // BX_ARCH_64BIT
43#   endif // BX_PLATFORM_WINDOWS
44#endif // BX_COMPILER_MSVC
45
46#define BX_HALF_FLOAT_ZERO UINT16_C(0)
47#define BX_HALF_FLOAT_HALF UINT16_C(0x3800)
48#define BX_HALF_FLOAT_ONE  UINT16_C(0x3c00)
49#define BX_HALF_FLOAT_TWO  UINT16_C(0x4000)
50
51namespace bx
52{
53   inline uint32_t uint32_li(uint32_t _a)
54   {
55      return _a;
56   }
57
58   inline uint32_t uint32_dec(uint32_t _a)
59   {
60      return _a - 1;
61   }
62
63   inline uint32_t uint32_inc(uint32_t _a)
64   {
65      return _a + 1;
66   }
67
68   inline uint32_t uint32_not(uint32_t _a)
69   {
70      return ~_a;
71   }
72
73   inline uint32_t uint32_neg(uint32_t _a)
74   {
75      return -(int32_t)_a;
76   }
77
78   inline uint32_t uint32_ext(uint32_t _a)
79   {
80      return ( (int32_t)_a)>>31;
81   }
82
83   inline uint32_t uint32_and(uint32_t _a, uint32_t _b)
84   {
85      return _a & _b;
86   }
87
88   inline uint32_t uint32_xor(uint32_t _a, uint32_t _b)
89   {
90      return _a ^ _b;
91   }
92
93   inline uint32_t uint32_xorl(uint32_t _a, uint32_t _b)
94   {
95      return !_a != !_b;
96   }
97
98   inline uint32_t uint32_andc(uint32_t _a, uint32_t _b)
99   {
100      return _a & ~_b;
101   }
102
103   inline uint32_t uint32_or(uint32_t _a, uint32_t _b)
104   {
105      return _a | _b;
106   }
107
108   inline uint32_t uint32_sll(uint32_t _a, int _sa)
109   {
110      return _a << _sa;
111   }
112
113   inline uint32_t uint32_srl(uint32_t _a, int _sa)
114   {
115      return _a >> _sa;
116   }
117
118   inline uint32_t uint32_sra(uint32_t _a, int _sa)
119   {
120      return ( (int32_t)_a) >> _sa;
121   }
122
123   inline uint32_t uint32_rol(uint32_t _a, int _sa)
124   {
125      return ( _a << _sa) | (_a >> (32-_sa) );
126   }
127
128   inline uint32_t uint32_ror(uint32_t _a, int _sa)
129   {
130      return ( _a >> _sa) | (_a << (32-_sa) );
131   }
132
133   inline uint32_t uint32_add(uint32_t _a, uint32_t _b)
134   {
135      return _a + _b;
136   }
137
138   inline uint32_t uint32_sub(uint32_t _a, uint32_t _b)
139   {
140      return _a - _b;
141   }
142
143   inline uint32_t uint32_mul(uint32_t _a, uint32_t _b)
144   {
145      return _a * _b;
146   }
147
148   inline uint32_t uint32_div(uint32_t _a, uint32_t _b)
149   {
150      return (_a / _b);
151   }
152
153   inline uint32_t uint32_mod(uint32_t _a, uint32_t _b)
154   {
155      return (_a % _b);
156   }
157
158   inline uint32_t uint32_cmpeq(uint32_t _a, uint32_t _b)
159   {
160      return -(_a == _b);
161   }
162
163   inline uint32_t uint32_cmpneq(uint32_t _a, uint32_t _b)
164   {
165      return -(_a != _b);
166   }
167
168   inline uint32_t uint32_cmplt(uint32_t _a, uint32_t _b)
169   {
170      return -(_a < _b);
171   }
172
173   inline uint32_t uint32_cmple(uint32_t _a, uint32_t _b)
174   {
175      return -(_a <= _b);
176   }
177
178   inline uint32_t uint32_cmpgt(uint32_t _a, uint32_t _b)
179   {
180      return -(_a > _b);
181   }
182
183   inline uint32_t uint32_cmpge(uint32_t _a, uint32_t _b)
184   {
185      return -(_a >= _b);
186   }
187
188   inline uint32_t uint32_setnz(uint32_t _a)
189   {
190      return -!!_a;
191   }
192
193   inline uint32_t uint32_satadd(uint32_t _a, uint32_t _b)
194   {
195      const uint32_t add    = uint32_add(_a, _b);
196      const uint32_t lt     = uint32_cmplt(add, _a);
197      const uint32_t result = uint32_or(add, lt);
198
199      return result;
200   }
201
202   inline uint32_t uint32_satsub(uint32_t _a, uint32_t _b)
203   {
204      const uint32_t sub    = uint32_sub(_a, _b);
205      const uint32_t le     = uint32_cmple(sub, _a);
206      const uint32_t result = uint32_and(sub, le);
207
208      return result;
209   }
210
211   inline uint32_t uint32_satmul(uint32_t _a, uint32_t _b)
212   {
213      const uint64_t mul    = (uint64_t)_a * (uint64_t)_b;
214      const uint32_t hi     = mul >> 32;
215      const uint32_t nz     = uint32_setnz(hi);
216      const uint32_t result = uint32_or(uint32_t(mul), nz);
217
218      return result;
219   }
220
221   inline uint32_t uint32_sels(uint32_t test, uint32_t _a, uint32_t _b)
222   {
223      const uint32_t mask   = uint32_ext(test);
224      const uint32_t sel_a  = uint32_and(_a, mask);
225      const uint32_t sel_b  = uint32_andc(_b, mask);
226      const uint32_t result = uint32_or(sel_a, sel_b);
227
228      return (result);
229   }
230
231   inline uint32_t uint32_selb(uint32_t _mask, uint32_t _a, uint32_t _b)
232   {
233      const uint32_t sel_a  = uint32_and(_a, _mask);
234      const uint32_t sel_b  = uint32_andc(_b, _mask);
235      const uint32_t result = uint32_or(sel_a, sel_b);
236
237      return (result);
238   }
239
240   inline uint32_t uint32_imin(uint32_t _a, uint32_t _b)
241   {
242      const uint32_t a_sub_b = uint32_sub(_a, _b);
243      const uint32_t result  = uint32_sels(a_sub_b, _a, _b);
244
245      return result;
246   }
247
248   inline uint32_t uint32_imax(uint32_t _a, uint32_t _b)
249   {
250      const uint32_t b_sub_a = uint32_sub(_b, _a);
251      const uint32_t result  = uint32_sels(b_sub_a, _a, _b);
252
253      return result;
254   }
255
256   inline uint32_t uint32_min(uint32_t _a, uint32_t _b)
257   {
258      return _a > _b ? _b : _a;
259   }
260
261   inline uint32_t uint32_max(uint32_t _a, uint32_t _b)
262   {
263      return _a > _b ? _a : _b;
264   }
265
266   inline uint32_t uint32_clamp(uint32_t _a, uint32_t _min, uint32_t _max)
267   {
268      const uint32_t tmp    = uint32_max(_a, _min);
269      const uint32_t result = uint32_min(tmp, _max);
270
271      return result;
272   }
273
274   inline uint32_t uint32_incwrap(uint32_t _val, uint32_t _min, uint32_t _max)
275   {
276      const uint32_t inc          = uint32_inc(_val);
277      const uint32_t max_diff     = uint32_sub(_max, _val);
278      const uint32_t neg_max_diff = uint32_neg(max_diff);
279      const uint32_t max_or       = uint32_or(max_diff, neg_max_diff);
280      const uint32_t max_diff_nz  = uint32_ext(max_or);
281      const uint32_t result       = uint32_selb(max_diff_nz, inc, _min);
282
283      return result;
284   }
285
286   inline uint32_t uint32_decwrap(uint32_t _val, uint32_t _min, uint32_t _max)
287   {
288      const uint32_t dec          = uint32_dec(_val);
289      const uint32_t min_diff     = uint32_sub(_min, _val);
290      const uint32_t neg_min_diff = uint32_neg(min_diff);
291      const uint32_t min_or       = uint32_or(min_diff, neg_min_diff);
292      const uint32_t min_diff_nz  = uint32_ext(min_or);
293      const uint32_t result       = uint32_selb(min_diff_nz, dec, _max);
294
295      return result;
296   }
297
298   inline uint32_t uint32_cntbits_ref(uint32_t _val)
299   {
300      const uint32_t tmp0   = uint32_srl(_val, 1);
301      const uint32_t tmp1   = uint32_and(tmp0, 0x55555555);
302      const uint32_t tmp2   = uint32_sub(_val, tmp1);
303      const uint32_t tmp3   = uint32_and(tmp2, 0xc30c30c3);
304      const uint32_t tmp4   = uint32_srl(tmp2, 2);
305      const uint32_t tmp5   = uint32_and(tmp4, 0xc30c30c3);
306      const uint32_t tmp6   = uint32_srl(tmp2, 4);
307      const uint32_t tmp7   = uint32_and(tmp6, 0xc30c30c3);
308      const uint32_t tmp8   = uint32_add(tmp3, tmp5);
309      const uint32_t tmp9   = uint32_add(tmp7, tmp8);
310      const uint32_t tmpA   = uint32_srl(tmp9, 6);
311      const uint32_t tmpB   = uint32_add(tmp9, tmpA);
312      const uint32_t tmpC   = uint32_srl(tmpB, 12);
313      const uint32_t tmpD   = uint32_srl(tmpB, 24);
314      const uint32_t tmpE   = uint32_add(tmpB, tmpC);
315      const uint32_t tmpF   = uint32_add(tmpD, tmpE);
316      const uint32_t result = uint32_and(tmpF, 0x3f);
317
318      return result;
319   }
320
321   /// Count number of bits set.
322   inline uint32_t uint32_cntbits(uint32_t _val)
323   {
324#if BX_COMPILER_GCC
325      return __builtin_popcount(_val);
326#elif BX_COMPILER_MSVC && BX_PLATFORM_WINDOWS
327      return __popcnt(_val);
328#else
329      return uint32_cntbits_ref(_val);
330#endif // BX_COMPILER_GCC
331   }
332
333   inline uint32_t uint32_cntlz_ref(uint32_t _val)
334   {
335      const uint32_t tmp0   = uint32_srl(_val, 1);
336      const uint32_t tmp1   = uint32_or(tmp0, _val);
337      const uint32_t tmp2   = uint32_srl(tmp1, 2);
338      const uint32_t tmp3   = uint32_or(tmp2, tmp1);
339      const uint32_t tmp4   = uint32_srl(tmp3, 4);
340      const uint32_t tmp5   = uint32_or(tmp4, tmp3);
341      const uint32_t tmp6   = uint32_srl(tmp5, 8);
342      const uint32_t tmp7   = uint32_or(tmp6, tmp5);
343      const uint32_t tmp8   = uint32_srl(tmp7, 16);
344      const uint32_t tmp9   = uint32_or(tmp8, tmp7);
345      const uint32_t tmpA   = uint32_not(tmp9);
346      const uint32_t result = uint32_cntbits(tmpA);
347
348      return result;
349   }
350
351   /// Count number of leading zeros.
352   inline uint32_t uint32_cntlz(uint32_t _val)
353   {
354#if BX_COMPILER_GCC
355      return __builtin_clz(_val);
356#elif BX_COMPILER_MSVC && BX_PLATFORM_WINDOWS
357      unsigned long index;
358      _BitScanReverse(&index, _val);
359      return 31 - index;
360#else
361      return uint32_cntlz_ref(_val);
362#endif // BX_COMPILER_
363   }
364
365   inline uint32_t uint32_cnttz_ref(uint32_t _val)
366   {
367      const uint32_t tmp0   = uint32_not(_val);
368      const uint32_t tmp1   = uint32_dec(_val);
369      const uint32_t tmp2   = uint32_and(tmp0, tmp1);
370      const uint32_t result = uint32_cntbits(tmp2);
371
372      return result;
373   }
374
375   inline uint32_t uint32_cnttz(uint32_t _val)
376   {
377#if BX_COMPILER_GCC
378      return __builtin_ctz(_val);
379#elif BX_COMPILER_MSVC && BX_PLATFORM_WINDOWS
380      unsigned long index;
381      _BitScanForward(&index, _val);
382      return index;
383#else
384      return uint32_cnttz_ref(_val);
385#endif // BX_COMPILER_
386   }
387
388   // shuffle:
389   // ---- ---- ---- ---- fedc ba98 7654 3210
390   // to:
391   // -f-e -d-c -b-a -9-8 -7-6 -5-4 -3-2 -1-0
392   inline uint32_t uint32_part1by1(uint32_t _a)
393   {
394      const uint32_t val    = uint32_and(_a, 0xffff);
395
396      const uint32_t tmp0   = uint32_sll(val, 8);
397      const uint32_t tmp1   = uint32_xor(val, tmp0);
398      const uint32_t tmp2   = uint32_and(tmp1, 0x00ff00ff);
399
400      const uint32_t tmp3   = uint32_sll(tmp2, 4);
401      const uint32_t tmp4   = uint32_xor(tmp2, tmp3);
402      const uint32_t tmp5   = uint32_and(tmp4, 0x0f0f0f0f);
403
404      const uint32_t tmp6   = uint32_sll(tmp5, 2);
405      const uint32_t tmp7   = uint32_xor(tmp5, tmp6);
406      const uint32_t tmp8   = uint32_and(tmp7, 0x33333333);
407
408      const uint32_t tmp9   = uint32_sll(tmp8, 1);
409      const uint32_t tmpA   = uint32_xor(tmp8, tmp9);
410      const uint32_t result = uint32_and(tmpA, 0x55555555);
411
412      return result;
413   }
414
415   // shuffle:
416   // ---- ---- ---- ---- ---- --98 7654 3210
417   // to:
418   // ---- 9--8 --7- -6-- 5--4 --3- -2-- 1--0
419   inline uint32_t uint32_part1by2(uint32_t _a)
420   {
421      const uint32_t val    = uint32_and(_a, 0x3ff);
422
423      const uint32_t tmp0   = uint32_sll(val, 16);
424      const uint32_t tmp1   = uint32_xor(val, tmp0);
425      const uint32_t tmp2   = uint32_and(tmp1, 0xff0000ff);
426
427      const uint32_t tmp3   = uint32_sll(tmp2, 8);
428      const uint32_t tmp4   = uint32_xor(tmp2, tmp3);
429      const uint32_t tmp5   = uint32_and(tmp4, 0x0300f00f);
430
431      const uint32_t tmp6   = uint32_sll(tmp5, 4);
432      const uint32_t tmp7   = uint32_xor(tmp5, tmp6);
433      const uint32_t tmp8   = uint32_and(tmp7, 0x030c30c3);
434
435      const uint32_t tmp9   = uint32_sll(tmp8, 2);
436      const uint32_t tmpA   = uint32_xor(tmp8, tmp9);
437      const uint32_t result = uint32_and(tmpA, 0x09249249);
438
439      return result;
440   }
441
442   inline uint32_t uint32_testpow2(uint32_t _a)
443   {
444      const uint32_t tmp0   = uint32_not(_a);
445      const uint32_t tmp1   = uint32_inc(tmp0);
446      const uint32_t tmp2   = uint32_and(_a, tmp1);
447      const uint32_t tmp3   = uint32_cmpeq(tmp2, _a);
448      const uint32_t tmp4   = uint32_cmpneq(_a, 0);
449      const uint32_t result = uint32_and(tmp3, tmp4);
450
451      return result;
452   }
453
454   inline uint32_t uint32_nextpow2(uint32_t _a)
455   {
456      const uint32_t tmp0   = uint32_dec(_a);
457      const uint32_t tmp1   = uint32_srl(tmp0, 1);
458      const uint32_t tmp2   = uint32_or(tmp0, tmp1);
459      const uint32_t tmp3   = uint32_srl(tmp2, 2);
460      const uint32_t tmp4   = uint32_or(tmp2, tmp3);
461      const uint32_t tmp5   = uint32_srl(tmp4, 4);
462      const uint32_t tmp6   = uint32_or(tmp4, tmp5);
463      const uint32_t tmp7   = uint32_srl(tmp6, 8);
464      const uint32_t tmp8   = uint32_or(tmp6, tmp7);
465      const uint32_t tmp9   = uint32_srl(tmp8, 16);
466      const uint32_t tmpA   = uint32_or(tmp8, tmp9);
467      const uint32_t result = uint32_inc(tmpA);
468
469      return result;
470   }
471
472   inline uint16_t halfFromFloat(float _a)
473   {
474      union { uint32_t ui; float flt;   } ftou;
475      ftou.flt = _a;
476
477      const uint32_t one                        = uint32_li(0x00000001);
478      const uint32_t f_s_mask                   = uint32_li(0x80000000);
479      const uint32_t f_e_mask                   = uint32_li(0x7f800000);
480      const uint32_t f_m_mask                   = uint32_li(0x007fffff);
481      const uint32_t f_m_hidden_bit             = uint32_li(0x00800000);
482      const uint32_t f_m_round_bit              = uint32_li(0x00001000);
483      const uint32_t f_snan_mask                = uint32_li(0x7fc00000);
484      const uint32_t f_e_pos                    = uint32_li(0x00000017);
485      const uint32_t h_e_pos                    = uint32_li(0x0000000a);
486      const uint32_t h_e_mask                   = uint32_li(0x00007c00);
487      const uint32_t h_snan_mask                = uint32_li(0x00007e00);
488      const uint32_t h_e_mask_value             = uint32_li(0x0000001f);
489      const uint32_t f_h_s_pos_offset           = uint32_li(0x00000010);
490      const uint32_t f_h_bias_offset            = uint32_li(0x00000070);
491      const uint32_t f_h_m_pos_offset           = uint32_li(0x0000000d);
492      const uint32_t h_nan_min                  = uint32_li(0x00007c01);
493      const uint32_t f_h_e_biased_flag          = uint32_li(0x0000008f);
494      const uint32_t f_s                        = uint32_and(ftou.ui, f_s_mask);
495      const uint32_t f_e                        = uint32_and(ftou.ui, f_e_mask);
496      const uint16_t h_s              = (uint16_t)uint32_srl(f_s, f_h_s_pos_offset);
497      const uint32_t f_m                        = uint32_and(ftou.ui, f_m_mask);
498      const uint16_t f_e_amount       = (uint16_t)uint32_srl(f_e, f_e_pos);
499      const uint32_t f_e_half_bias              = uint32_sub(f_e_amount, f_h_bias_offset);
500      const uint32_t f_snan                     = uint32_and(ftou.ui, f_snan_mask);
501      const uint32_t f_m_round_mask             = uint32_and(f_m, f_m_round_bit);
502      const uint32_t f_m_round_offset           = uint32_sll(f_m_round_mask, one);
503      const uint32_t f_m_rounded                = uint32_add(f_m, f_m_round_offset);
504      const uint32_t f_m_denorm_sa              = uint32_sub(one, f_e_half_bias);
505      const uint32_t f_m_with_hidden            = uint32_or(f_m_rounded, f_m_hidden_bit);
506      const uint32_t f_m_denorm                 = uint32_srl(f_m_with_hidden, f_m_denorm_sa);
507      const uint32_t h_m_denorm                 = uint32_srl(f_m_denorm, f_h_m_pos_offset);
508      const uint32_t f_m_rounded_overflow       = uint32_and(f_m_rounded, f_m_hidden_bit);
509      const uint32_t m_nan                      = uint32_srl(f_m, f_h_m_pos_offset);
510      const uint32_t h_em_nan                   = uint32_or(h_e_mask, m_nan);
511      const uint32_t h_e_norm_overflow_offset   = uint32_inc(f_e_half_bias);
512      const uint32_t h_e_norm_overflow          = uint32_sll(h_e_norm_overflow_offset, h_e_pos);
513      const uint32_t h_e_norm                   = uint32_sll(f_e_half_bias, h_e_pos);
514      const uint32_t h_m_norm                   = uint32_srl(f_m_rounded, f_h_m_pos_offset);
515      const uint32_t h_em_norm                  = uint32_or(h_e_norm, h_m_norm);
516      const uint32_t is_h_ndenorm_msb           = uint32_sub(f_h_bias_offset, f_e_amount);
517      const uint32_t is_f_e_flagged_msb         = uint32_sub(f_h_e_biased_flag, f_e_half_bias);
518      const uint32_t is_h_denorm_msb            = uint32_not(is_h_ndenorm_msb);
519      const uint32_t is_f_m_eqz_msb             = uint32_dec(f_m);
520      const uint32_t is_h_nan_eqz_msb           = uint32_dec(m_nan);
521      const uint32_t is_f_inf_msb               = uint32_and(is_f_e_flagged_msb, is_f_m_eqz_msb);
522      const uint32_t is_f_nan_underflow_msb     = uint32_and(is_f_e_flagged_msb, is_h_nan_eqz_msb);
523      const uint32_t is_e_overflow_msb          = uint32_sub(h_e_mask_value, f_e_half_bias);
524      const uint32_t is_h_inf_msb               = uint32_or(is_e_overflow_msb, is_f_inf_msb);
525      const uint32_t is_f_nsnan_msb             = uint32_sub(f_snan, f_snan_mask);
526      const uint32_t is_m_norm_overflow_msb     = uint32_neg(f_m_rounded_overflow);
527      const uint32_t is_f_snan_msb              = uint32_not(is_f_nsnan_msb);
528      const uint32_t h_em_overflow_result       = uint32_sels(is_m_norm_overflow_msb, h_e_norm_overflow, h_em_norm);
529      const uint32_t h_em_nan_result            = uint32_sels(is_f_e_flagged_msb, h_em_nan, h_em_overflow_result);
530      const uint32_t h_em_nan_underflow_result  = uint32_sels(is_f_nan_underflow_msb, h_nan_min, h_em_nan_result);
531      const uint32_t h_em_inf_result            = uint32_sels(is_h_inf_msb, h_e_mask, h_em_nan_underflow_result);
532      const uint32_t h_em_denorm_result         = uint32_sels(is_h_denorm_msb, h_m_denorm, h_em_inf_result);
533      const uint32_t h_em_snan_result           = uint32_sels(is_f_snan_msb, h_snan_mask, h_em_denorm_result);
534      const uint32_t h_result                   = uint32_or(h_s, h_em_snan_result);
535
536      return (uint16_t)(h_result);
537   }
538
539   inline float halfToFloat(uint16_t _a)
540   {
541      const uint32_t h_e_mask              = uint32_li(0x00007c00);
542      const uint32_t h_m_mask              = uint32_li(0x000003ff);
543      const uint32_t h_s_mask              = uint32_li(0x00008000);
544      const uint32_t h_f_s_pos_offset      = uint32_li(0x00000010);
545      const uint32_t h_f_e_pos_offset      = uint32_li(0x0000000d);
546      const uint32_t h_f_bias_offset       = uint32_li(0x0001c000);
547      const uint32_t f_e_mask              = uint32_li(0x7f800000);
548      const uint32_t f_m_mask              = uint32_li(0x007fffff);
549      const uint32_t h_f_e_denorm_bias     = uint32_li(0x0000007e);
550      const uint32_t h_f_m_denorm_sa_bias  = uint32_li(0x00000008);
551      const uint32_t f_e_pos               = uint32_li(0x00000017);
552      const uint32_t h_e_mask_minus_one    = uint32_li(0x00007bff);
553      const uint32_t h_e                   = uint32_and(_a, h_e_mask);
554      const uint32_t h_m                   = uint32_and(_a, h_m_mask);
555      const uint32_t h_s                   = uint32_and(_a, h_s_mask);
556      const uint32_t h_e_f_bias            = uint32_add(h_e, h_f_bias_offset);
557      const uint32_t h_m_nlz               = uint32_cntlz(h_m);
558      const uint32_t f_s                   = uint32_sll(h_s, h_f_s_pos_offset);
559      const uint32_t f_e                   = uint32_sll(h_e_f_bias, h_f_e_pos_offset);
560      const uint32_t f_m                   = uint32_sll(h_m, h_f_e_pos_offset);
561      const uint32_t f_em                  = uint32_or(f_e, f_m);
562      const uint32_t h_f_m_sa              = uint32_sub(h_m_nlz, h_f_m_denorm_sa_bias);
563      const uint32_t f_e_denorm_unpacked   = uint32_sub(h_f_e_denorm_bias, h_f_m_sa);
564      const uint32_t h_f_m                 = uint32_sll(h_m, h_f_m_sa);
565      const uint32_t f_m_denorm            = uint32_and(h_f_m, f_m_mask);
566      const uint32_t f_e_denorm            = uint32_sll(f_e_denorm_unpacked, f_e_pos);
567      const uint32_t f_em_denorm           = uint32_or(f_e_denorm, f_m_denorm);
568      const uint32_t f_em_nan              = uint32_or(f_e_mask, f_m);
569      const uint32_t is_e_eqz_msb          = uint32_dec(h_e);
570      const uint32_t is_m_nez_msb          = uint32_neg(h_m);
571      const uint32_t is_e_flagged_msb      = uint32_sub(h_e_mask_minus_one, h_e);
572      const uint32_t is_zero_msb           = uint32_andc(is_e_eqz_msb, is_m_nez_msb);
573      const uint32_t is_inf_msb            = uint32_andc(is_e_flagged_msb, is_m_nez_msb);
574      const uint32_t is_denorm_msb         = uint32_and(is_m_nez_msb, is_e_eqz_msb);
575      const uint32_t is_nan_msb            = uint32_and(is_e_flagged_msb, is_m_nez_msb);
576      const uint32_t is_zero               = uint32_ext(is_zero_msb);
577      const uint32_t f_zero_result         = uint32_andc(f_em, is_zero);
578      const uint32_t f_denorm_result       = uint32_sels(is_denorm_msb, f_em_denorm, f_zero_result);
579      const uint32_t f_inf_result          = uint32_sels(is_inf_msb, f_e_mask, f_denorm_result);
580      const uint32_t f_nan_result          = uint32_sels(is_nan_msb, f_em_nan, f_inf_result);
581      const uint32_t f_result              = uint32_or(f_s, f_nan_result);
582
583      union { uint32_t ui; float flt;   } utof;
584      utof.ui = f_result;
585      return utof.flt;
586   }
587
588   inline uint16_t uint16_min(uint16_t _a, uint16_t _b)
589   {
590      return _a > _b ? _b : _a;
591   }
592
593   inline uint16_t uint16_max(uint16_t _a, uint16_t _b)
594   {
595      return _a < _b ? _b : _a;
596   }
597
598   inline int64_t int64_min(int64_t _a, int64_t _b)
599   {
600      return _a < _b ? _a : _b;
601   }
602
603   inline int64_t int64_max(int64_t _a, int64_t _b)
604   {
605      return _a > _b ? _a : _b;
606   }
607
608   inline int64_t int64_clamp(int64_t _a, int64_t _min, int64_t _max)
609   {
610      const int64_t min    = int64_min(_a, _max);
611      const int64_t result = int64_max(_min, min);
612
613      return result;
614   }
615
616   inline uint64_t uint64_cntlz_ref(uint64_t _val)
617   {
618      return _val & UINT64_C(0xffffffff00000000)
619          ? uint32_cntlz(uint32_t(_val>>32) ) + 32
620          : uint32_cntlz(uint32_t(_val) )
621          ;
622   }
623
624   /// Count number of leading zeros.
625   inline uint64_t uint64_cntlz(uint64_t _val)
626   {
627#if BX_COMPILER_GCC
628      return __builtin_clz(_val);
629#elif BX_COMPILER_MSVC && BX_PLATFORM_WINDOWS && BX_ARCH_64BIT
630      unsigned long index;
631      _BitScanReverse64(&index, _val);
632      return 63 - index;
633#else
634      return uint64_cntlz_ref(_val);
635#endif // BX_COMPILER_
636   }
637
638   inline uint64_t uint64_cnttz_ref(uint64_t _val)
639   {
640      return _val & UINT64_C(0xffffffff)
641         ? uint32_cnttz(uint32_t(_val) )
642         : uint32_cnttz(uint32_t(_val>>32) ) + 32
643         ;
644   }
645
646   inline uint64_t uint64_cnttz(uint64_t _val)
647   {
648#if BX_COMPILER_GCC
649      return __builtin_ctz(_val);
650#elif BX_COMPILER_MSVC && BX_PLATFORM_WINDOWS && BX_ARCH_64BIT
651      unsigned long index;
652      _BitScanForward64(&index, _val);
653      return index;
654#else
655      return uint64_cnttz_ref(_val);
656#endif // BX_COMPILER_
657   }
658
659} // namespace bx
660
661#endif // BX_UINT32_T_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/uint32_t.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/thread.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_THREAD_H_HEADER_GUARD
7#define BX_THREAD_H_HEADER_GUARD
8
9#if BX_PLATFORM_POSIX
10#   include <pthread.h>
11#endif // BX_PLATFORM_POSIX
12
13#include "sem.h"
14
15#if BX_CONFIG_SUPPORTS_THREADING
16
17namespace bx
18{
19   typedef int32_t (*ThreadFn)(void* _userData);
20
21   class Thread
22   {
23      BX_CLASS(Thread
24         , NO_COPY
25         , NO_ASSIGNMENT
26         );
27
28   public:
29      Thread()
30#if BX_PLATFORM_WINDOWS|BX_PLATFORM_XBOX360
31         : m_handle(INVALID_HANDLE_VALUE)
32#elif BX_PLATFORM_POSIX
33         : m_handle(0)
34#endif // BX_PLATFORM_
35         , m_fn(NULL)
36         , m_userData(NULL)
37         , m_stackSize(0)
38         , m_exitCode(0 /*EXIT_SUCCESS*/)
39         , m_running(false)
40      {
41      }
42
43      virtual ~Thread()
44      {
45         if (m_running)
46         {
47            shutdown();
48         }
49      }
50
51      void init(ThreadFn _fn, void* _userData = NULL, uint32_t _stackSize = 0)
52      {
53         BX_CHECK(!m_running, "Already running!");
54
55         m_fn = _fn;
56         m_userData = _userData;
57         m_stackSize = _stackSize;
58         m_running = true;
59
60#if BX_PLATFORM_WINDOWS|BX_PLATFORM_XBOX360
61         m_handle = CreateThread(NULL
62            , m_stackSize
63            , threadFunc
64            , this
65            , 0
66            , NULL
67            );
68#elif BX_PLATFORM_POSIX
69         int result;
70         BX_UNUSED(result);
71
72         pthread_attr_t attr;
73         result = pthread_attr_init(&attr);
74         BX_CHECK(0 == result, "pthread_attr_init failed! %d", result);
75
76         if (0 != m_stackSize)
77         {
78            result = pthread_attr_setstacksize(&attr, m_stackSize);
79            BX_CHECK(0 == result, "pthread_attr_setstacksize failed! %d", result);
80         }
81
82//          sched_param sched;
83//          sched.sched_priority = 0;
84//          result = pthread_attr_setschedparam(&attr, &sched);
85//          BX_CHECK(0 == result, "pthread_attr_setschedparam failed! %d", result);
86
87         result = pthread_create(&m_handle, &attr, &threadFunc, this);
88         BX_CHECK(0 == result, "pthread_attr_setschedparam failed! %d", result);
89#endif // BX_PLATFORM_
90
91         m_sem.wait();
92      }
93
94      void shutdown()
95      {
96         BX_CHECK(m_running, "Not running!");
97#if BX_PLATFORM_WINDOWS|BX_PLATFORM_XBOX360
98         WaitForSingleObject(m_handle, INFINITE);
99         GetExitCodeThread(m_handle, (DWORD*)&m_exitCode);
100         CloseHandle(m_handle);
101         m_handle = INVALID_HANDLE_VALUE;
102#elif BX_PLATFORM_POSIX
103         union
104         {
105            void* ptr;
106            int32_t i;
107         } cast;
108         pthread_join(m_handle, &cast.ptr);
109         m_exitCode = cast.i;
110         m_handle = 0;
111#endif // BX_PLATFORM_
112         m_running = false;
113      }
114
115      bool isRunning() const
116      {
117         return m_running;
118      }
119
120      int32_t getExitCode() const
121      {
122         return m_exitCode;
123      }
124
125   private:
126      int32_t entry()
127      {
128         m_sem.post();
129         return m_fn(m_userData);
130      }
131
132#if BX_PLATFORM_WINDOWS|BX_PLATFORM_XBOX360
133      static DWORD WINAPI threadFunc(LPVOID _arg)
134      {
135         Thread* thread = (Thread*)_arg;
136         int32_t result = thread->entry();
137         return result;
138      }
139#else
140      static void* threadFunc(void* _arg)
141      {
142         Thread* thread = (Thread*)_arg;
143         union
144         {
145            void* ptr;
146            int32_t i;
147         } cast;
148         cast.i = thread->entry();
149         return cast.ptr;
150      }
151#endif // BX_PLATFORM_
152
153#if BX_PLATFORM_WINDOWS|BX_PLATFORM_XBOX360
154      HANDLE m_handle;
155#elif BX_PLATFORM_POSIX
156      pthread_t m_handle;
157#endif // BX_PLATFORM_
158
159      ThreadFn m_fn;
160      void* m_userData;
161      Semaphore m_sem;
162      uint32_t m_stackSize;
163      int32_t m_exitCode;
164      bool m_running;
165   };
166
167#if BX_PLATFORM_WINDOWS
168   class TlsData
169   {
170   public:
171      TlsData()
172      {
173         m_id = TlsAlloc();
174         BX_CHECK(TLS_OUT_OF_INDEXES != m_id, "Failed to allocated TLS index (err: 0x%08x).", GetLastError() );
175      }
176
177      ~TlsData()
178      {
179         BOOL result = TlsFree(m_id);
180         BX_CHECK(0 != result, "Failed to free TLS index (err: 0x%08x).", GetLastError() ); BX_UNUSED(result);
181      }
182
183      void* get() const
184      {
185         return TlsGetValue(m_id);
186      }
187
188      void set(void* _ptr)
189      {
190         TlsSetValue(m_id, _ptr);
191      }
192
193   private:
194      uint32_t m_id;
195   };
196
197#else
198
199   class TlsData
200   {
201   public:
202      TlsData()
203      {
204         int result = pthread_key_create(&m_id, NULL);
205         BX_CHECK(0 == result, "pthread_key_create failed %d.", result); BX_UNUSED(result);
206      }
207
208      ~TlsData()
209      {
210         int result = pthread_key_delete(m_id);
211         BX_CHECK(0 == result, "pthread_key_delete failed %d.", result); BX_UNUSED(result);
212      }
213
214      void* get() const
215      {
216         return pthread_getspecific(m_id);
217      }
218
219      void set(void* _ptr)
220      {
221         int result = pthread_setspecific(m_id, _ptr);
222         BX_CHECK(0 == result, "pthread_setspecific failed %d.", result); BX_UNUSED(result);
223      }
224
225   private:
226      pthread_key_t m_id;
227   };
228#endif // BX_PLATFORM_WINDOWS
229
230} // namespace bx
231
232#endif // BX_CONFIG_SUPPORTS_THREADING
233
234#endif // BX_THREAD_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/thread.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/foreach.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_FOREACH_H_HEADER_GUARD
7#define BX_FOREACH_H_HEADER_GUARD
8
9#include "bx.h"
10
11namespace bx
12{
13   namespace foreach_ns
14   {
15      struct ContainerBase
16      {
17      };
18
19      template <typename Ty>
20      class Container : public ContainerBase
21      {
22      public:
23         inline Container(const Ty& _container)
24            : m_container(_container)
25            , m_break(0)
26            , m_it( _container.begin() )
27            , m_itEnd( _container.end() )
28         {
29         }
30
31         inline bool condition() const
32         {
33            return (!m_break++ && m_it != m_itEnd);
34         }
35
36         const Ty& m_container;
37         mutable int m_break;
38         mutable typename Ty::const_iterator m_it;
39         mutable typename Ty::const_iterator m_itEnd;
40      };
41
42      template <typename Ty>
43      inline Ty* pointer(const Ty&)
44      {
45         return 0;
46      }
47
48      template <typename Ty>
49      inline Container<Ty> containerNew(const Ty& _container)
50      {
51         return Container<Ty>(_container);
52      }
53
54      template <typename Ty>
55      inline const Container<Ty>* container(const ContainerBase* _base, const Ty*)
56      {
57         return static_cast<const Container<Ty>*>(_base);
58      }
59   } // namespace foreach_ns
60
61#define foreach(_variable, _container) \
62   for (const bx::foreach_ns::ContainerBase &__temp_container__ = bx::foreach_ns::containerNew(_container); \
63         bx::foreach_ns::container(&__temp_container__, true ? 0 : bx::foreach_ns::pointer(_container) )->condition(); \
64         ++bx::foreach_ns::container(&__temp_container__, true ? 0 : bx::foreach_ns::pointer(_container) )->m_it) \
65   for (_variable = *container(&__temp_container__, true ? 0 : bx::foreach_ns::pointer(_container) )->m_it; \
66         bx::foreach_ns::container(&__temp_container__, true ? 0 : bx::foreach_ns::pointer(_container) )->m_break; \
67         --bx::foreach_ns::container(&__temp_container__, true ? 0 : bx::foreach_ns::pointer(_container) )->m_break)
68
69} // namespace bx
70
71#endif // BX_FOREACH_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/foreach.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/bx.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_H_HEADER_GUARD
7#define BX_H_HEADER_GUARD
8
9#include <stdint.h> // uint32_t
10#include <stdlib.h> // size_t
11
12#include "platform.h"
13#include "macros.h"
14
15namespace bx
16{
17   // http://cnicholson.net/2011/01/stupid-c-tricks-a-better-sizeof_array/
18   template<typename T, size_t N> char (&COUNTOF_REQUIRES_ARRAY_ARGUMENT(const T(&)[N]) )[N];
19#define BX_COUNTOF(_x) sizeof(bx::COUNTOF_REQUIRES_ARRAY_ARGUMENT(_x) )
20
21   // Template for avoiding MSVC: C4127: conditional expression is constant
22   template<bool>
23   inline bool isEnabled()
24   {
25      return true;
26   }
27
28   template<>
29   inline bool isEnabled<false>()
30   {
31      return false;
32   }
33#define BX_ENABLED(_x) bx::isEnabled<!!(_x)>()
34
35   inline bool ignoreC4127(bool _x)
36   {
37      return _x;
38   }
39#define BX_IGNORE_C4127(_x) bx::ignoreC4127(!!(_x) )
40
41} // namespace bx
42
43// Annoying C++0x stuff..
44namespace std { namespace tr1 {}; using namespace tr1; }
45
46#endif // BX_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/bx.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/float4_langext.h
r0r31734
1/*
2 * Copyright 2010-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_FLOAT4_LANGEXT_H_HEADER_GUARD
7#define BX_FLOAT4_LANGEXT_H_HEADER_GUARD
8
9#include <math.h>
10
11namespace bx
12{
13   typedef union float4_t
14   {
15      float    __attribute__((vector_size(16))) vf;
16      int32_t  __attribute__((vector_size(16))) vi;
17      uint32_t __attribute__((vector_size(16))) vu;
18      float    fxyzw[4];
19      int32_t  ixyzw[4];
20      uint32_t uxyzw[4];
21
22   } float4_t;
23
24#define ELEMx 0
25#define ELEMy 1
26#define ELEMz 2
27#define ELEMw 3
28#define IMPLEMENT_SWIZZLE(_x, _y, _z, _w) \
29         BX_FLOAT4_FORCE_INLINE float4_t float4_swiz_##_x##_y##_z##_w(float4_t _a) \
30         { \
31            float4_t result; \
32            result.vf = __builtin_shufflevector(_a.vf, _a.vf, ELEM##_x, ELEM##_y, ELEM##_z, ELEM##_w); \
33            return result; \
34         }
35
36#include "float4_swizzle.inl"
37
38#undef IMPLEMENT_SWIZZLE
39#undef ELEMw
40#undef ELEMz
41#undef ELEMy
42#undef ELEMx
43
44#define IMPLEMENT_TEST(_xyzw, _mask) \
45         BX_FLOAT4_FORCE_INLINE bool float4_test_any_##_xyzw(float4_t _test) \
46         { \
47            uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
48                         | ( (_test.uxyzw[2]>>31)<<2) \
49                         | ( (_test.uxyzw[1]>>31)<<1) \
50                         | (  _test.uxyzw[0]>>31)     \
51                         ; \
52            return 0 != (tmp&(_mask) ); \
53         } \
54         \
55         BX_FLOAT4_FORCE_INLINE bool float4_test_all_##_xyzw(float4_t _test) \
56         { \
57            uint32_t tmp = ( (_test.uxyzw[3]>>31)<<3) \
58                         | ( (_test.uxyzw[2]>>31)<<2) \
59                         | ( (_test.uxyzw[1]>>31)<<1) \
60                         | (  _test.uxyzw[0]>>31)     \
61                         ; \
62            return (_mask) == (tmp&(_mask) ); \
63         }
64
65IMPLEMENT_TEST(x    , 0x1);
66IMPLEMENT_TEST(y    , 0x2);
67IMPLEMENT_TEST(xy   , 0x3);
68IMPLEMENT_TEST(z    , 0x4);
69IMPLEMENT_TEST(xz   , 0x5);
70IMPLEMENT_TEST(yz   , 0x6);
71IMPLEMENT_TEST(xyz  , 0x7);
72IMPLEMENT_TEST(w    , 0x8);
73IMPLEMENT_TEST(xw   , 0x9);
74IMPLEMENT_TEST(yw   , 0xa);
75IMPLEMENT_TEST(xyw  , 0xb);
76IMPLEMENT_TEST(zw   , 0xc);
77IMPLEMENT_TEST(xzw  , 0xd);
78IMPLEMENT_TEST(yzw  , 0xe);
79IMPLEMENT_TEST(xyzw , 0xf);
80
81#undef IMPLEMENT_TEST
82
83   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_xyAB(float4_t _a, float4_t _b)
84   {
85      float4_t result;
86      result.vf = __builtin_shufflevector(_a.vf, _b.vf, 0, 1, 4, 5);
87      return result;
88   }
89
90   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_ABxy(float4_t _a, float4_t _b)
91   {
92      float4_t result;
93      result.vf = __builtin_shufflevector(_a.vf, _b.vf, 4, 5, 0, 1);
94      return result;
95   }
96
97   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_CDzw(float4_t _a, float4_t _b)
98   {
99      float4_t result;
100      result.vf = __builtin_shufflevector(_a.vf, _b.vf, 5, 7, 2, 3);
101      return result;
102   }
103
104   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_zwCD(float4_t _a, float4_t _b)
105   {
106      float4_t result;
107      result.vf = __builtin_shufflevector(_a.vf, _b.vf, 2, 3, 5, 7);
108      return result;
109   }
110
111   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_xAyB(float4_t _a, float4_t _b)
112   {
113      float4_t result;
114      result.vf = __builtin_shufflevector(_a.vf, _b.vf, 0, 4, 1, 5);
115      return result;
116   }
117
118   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_yBxA(float4_t _a, float4_t _b)
119   {
120      float4_t result;
121      result.vf = __builtin_shufflevector(_a.vf, _b.vf, 1, 5, 0, 4);
122      return result;
123   }
124
125   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_zCwD(float4_t _a, float4_t _b)
126   {
127      float4_t result;
128      result.vf = __builtin_shufflevector(_a.vf, _b.vf, 2, 6, 3, 7);
129      return result;
130   }
131
132   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_CzDw(float4_t _a, float4_t _b)
133   {
134      float4_t result;
135      result.vf = __builtin_shufflevector(_a.vf, _b.vf, 6, 2, 7, 3);
136      return result;
137   }
138
139   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_xAzC(float4_t _a, float4_t _b)
140   {
141      float4_t result;
142      result.vf = __builtin_shufflevector(_a.vf, _b.vf, 0, 4, 2, 6);
143      return result;
144   }
145
146   BX_FLOAT4_FORCE_INLINE float4_t float4_shuf_yBwD(float4_t _a, float4_t _b)
147   {
148      float4_t result;
149      result.vf = __builtin_shufflevector(_a.vf, _b.vf, 1, 5, 3, 7);
150      return result;
151   }
152
153   BX_FLOAT4_FORCE_INLINE float float4_x(float4_t _a)
154   {
155      return _a.fxyzw[0];
156   }
157
158   BX_FLOAT4_FORCE_INLINE float float4_y(float4_t _a)
159   {
160      return _a.fxyzw[1];
161   }
162
163   BX_FLOAT4_FORCE_INLINE float float4_z(float4_t _a)
164   {
165      return _a.fxyzw[2];
166   }
167
168   BX_FLOAT4_FORCE_INLINE float float4_w(float4_t _a)
169   {
170      return _a.fxyzw[3];
171   }
172
173   BX_FLOAT4_FORCE_INLINE float4_t float4_ld(const void* _ptr)
174   {
175      const uint32_t* input = reinterpret_cast<const uint32_t*>(_ptr);
176      float4_t result;
177      result.uxyzw[0] = input[0];
178      result.uxyzw[1] = input[1];
179      result.uxyzw[2] = input[2];
180      result.uxyzw[3] = input[3];
181      return result;
182   }
183
184   BX_FLOAT4_FORCE_INLINE void float4_st(void* _ptr, float4_t _a)
185   {
186      uint32_t* result = reinterpret_cast<uint32_t*>(_ptr);
187      result[0] = _a.uxyzw[0];
188      result[1] = _a.uxyzw[1];
189      result[2] = _a.uxyzw[2];
190      result[3] = _a.uxyzw[3];
191   }
192
193   BX_FLOAT4_FORCE_INLINE void float4_stx(void* _ptr, float4_t _a)
194   {
195      uint32_t* result = reinterpret_cast<uint32_t*>(_ptr);
196      result[0] = _a.uxyzw[0];
197   }
198
199   BX_FLOAT4_FORCE_INLINE void float4_stream(void* _ptr, float4_t _a)
200   {
201      uint32_t* result = reinterpret_cast<uint32_t*>(_ptr);
202      result[0] = _a.uxyzw[0];
203      result[1] = _a.uxyzw[1];
204      result[2] = _a.uxyzw[2];
205      result[3] = _a.uxyzw[3];
206   }
207
208   BX_FLOAT4_FORCE_INLINE float4_t float4_ld(float _x, float _y, float _z, float _w)
209   {
210      float4_t result;
211      result.vf = { _x, _y, _z, _w };
212      return result;
213   }
214
215   BX_FLOAT4_FORCE_INLINE float4_t float4_ild(uint32_t _x, uint32_t _y, uint32_t _z, uint32_t _w)
216   {
217      float4_t result;
218      result.vu = { _x, _y, _z, _w };
219      return result;
220   }
221
222   BX_FLOAT4_FORCE_INLINE float4_t float4_splat(const void* _ptr)
223   {
224      const uint32_t val = *reinterpret_cast<const uint32_t*>(_ptr);
225      float4_t result;
226      result.vu = { val, val, val, val };
227      return result;
228   }
229
230   BX_FLOAT4_FORCE_INLINE float4_t float4_splat(float _a)
231   {
232      return float4_ld(_a, _a, _a, _a);
233   }
234
235   BX_FLOAT4_FORCE_INLINE float4_t float4_isplat(uint32_t _a)
236   {
237      return float4_ild(_a, _a, _a, _a);
238   }
239
240   BX_FLOAT4_FORCE_INLINE float4_t float4_zero()
241   {
242      return float4_ild(0, 0, 0, 0);
243   }
244
245   BX_FLOAT4_FORCE_INLINE float4_t float4_itof(float4_t _a)
246   {
247      float4_t result;
248      result.vf = __builtin_convertvector(_a.vi, float __attribute__((vector_size(16))) );
249      return result;
250   }
251
252   BX_FLOAT4_FORCE_INLINE float4_t float4_ftoi(float4_t _a)
253   {
254      float4_t result;
255      result.vi = __builtin_convertvector(_a.vf, int32_t __attribute__((vector_size(16))) );
256      return result;
257   }
258
259   BX_FLOAT4_FORCE_INLINE float4_t float4_round(float4_t _a)
260   {
261      const float4_t tmp    = float4_ftoi(_a);
262      const float4_t result = float4_itof(tmp);
263
264      return result;
265   }
266
267   BX_FLOAT4_FORCE_INLINE float4_t float4_add(float4_t _a, float4_t _b)
268   {
269      float4_t result;
270      result.vf = _a.vf + _b.vf;
271      return result;
272   }
273
274   BX_FLOAT4_FORCE_INLINE float4_t float4_sub(float4_t _a, float4_t _b)
275   {
276      float4_t result;
277      result.vf = _a.vf - _b.vf;
278      return result;
279   }
280
281   BX_FLOAT4_FORCE_INLINE float4_t float4_mul(float4_t _a, float4_t _b)
282   {
283      float4_t result;
284      result.vf = _a.vf * _b.vf;
285      return result;
286   }
287
288   BX_FLOAT4_FORCE_INLINE float4_t float4_div(float4_t _a, float4_t _b)
289   {
290      float4_t result;
291      result.vf = _a.vf / _b.vf;
292      return result;
293   }
294
295#if 0
296   BX_FLOAT4_FORCE_INLINE float4_t float4_rcp_est(float4_t _a)
297   {
298      float4_t result;
299      const float4_t one = float4_splat(1.0f);
300      result.vf = one / _a.vf;
301      return result;
302   }
303#endif // 0
304
305   BX_FLOAT4_FORCE_INLINE float4_t float4_sqrt(float4_t _a)
306   {
307      float4_t result;
308      result.vf[0] = sqrtf(_a.vf[0]);
309      result.vf[1] = sqrtf(_a.vf[1]);
310      result.vf[2] = sqrtf(_a.vf[2]);
311      result.vf[3] = sqrtf(_a.vf[3]);
312      return result;
313   }
314
315   BX_FLOAT4_FORCE_INLINE float4_t float4_rsqrt_est(float4_t _a)
316   {
317      float4_t result;
318      result.vf[0] = 1.0f / sqrtf(_a.vf[0]);
319      result.vf[1] = 1.0f / sqrtf(_a.vf[1]);
320      result.vf[2] = 1.0f / sqrtf(_a.vf[2]);
321      result.vf[3] = 1.0f / sqrtf(_a.vf[3]);
322      return result;
323   }
324
325   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpeq(float4_t _a, float4_t _b)
326   {
327      float4_t result;
328      result.vi = _a.vf == _b.vf;
329      return result;
330   }
331
332   BX_FLOAT4_FORCE_INLINE float4_t float4_cmplt(float4_t _a, float4_t _b)
333   {
334      float4_t result;
335      result.vi = _a.vf < _b.vf;
336      return result;
337   }
338
339   BX_FLOAT4_FORCE_INLINE float4_t float4_cmple(float4_t _a, float4_t _b)
340   {
341      float4_t result;
342      result.vi = _a.vf <= _b.vf;
343      return result;
344   }
345
346   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpgt(float4_t _a, float4_t _b)
347   {
348      float4_t result;
349      result.vi = _a.vf > _b.vf;
350      return result;
351   }
352
353   BX_FLOAT4_FORCE_INLINE float4_t float4_cmpge(float4_t _a, float4_t _b)
354   {
355      float4_t result;
356      result.vi = _a.vf >= _b.vf;
357      return result;
358   }
359
360   BX_FLOAT4_FORCE_INLINE float4_t float4_and(float4_t _a, float4_t _b)
361   {
362      float4_t result;
363      result.vu = _a.vu & _b.vu;
364      return result;
365   }
366
367   BX_FLOAT4_FORCE_INLINE float4_t float4_andc(float4_t _a, float4_t _b)
368   {
369      float4_t result;
370      result.vu = _a.vu & ~_b.vu;
371      return result;
372   }
373
374   BX_FLOAT4_FORCE_INLINE float4_t float4_or(float4_t _a, float4_t _b)
375   {
376      float4_t result;
377      result.vu = _a.vu | _b.vu;
378      return result;
379   }
380
381   BX_FLOAT4_FORCE_INLINE float4_t float4_xor(float4_t _a, float4_t _b)
382   {
383      float4_t result;
384      result.vu = _a.vu ^ _b.vu;
385      return result;
386   }
387
388   BX_FLOAT4_FORCE_INLINE float4_t float4_sll(float4_t _a, int _count)
389   {
390      float4_t result;
391      const float4_t count = float4_isplat(_count);
392      result.vu = _a.vu << count.vi;
393      return result;
394   }
395
396   BX_FLOAT4_FORCE_INLINE float4_t float4_srl(float4_t _a, int _count)
397   {
398      float4_t result;
399      const float4_t count = float4_isplat(_count);
400      result.vu = _a.vu >> count.vi;
401      return result;
402   }
403
404   BX_FLOAT4_FORCE_INLINE float4_t float4_sra(float4_t _a, int _count)
405   {
406      float4_t result;
407      const float4_t count = float4_isplat(_count);
408      result.vi = _a.vi >> count.vi;
409      return result;
410   }
411
412   BX_FLOAT4_FORCE_INLINE float4_t float4_icmpeq(float4_t _a, float4_t _b)
413   {
414      float4_t result;
415      result.vi = _a.vi == _b.vi;
416      return result;
417   }
418
419   BX_FLOAT4_FORCE_INLINE float4_t float4_icmplt(float4_t _a, float4_t _b)
420   {
421      float4_t result;
422      result.vi = _a.vi < _b.vi;
423      return result;
424   }
425
426   BX_FLOAT4_FORCE_INLINE float4_t float4_icmpgt(float4_t _a, float4_t _b)
427   {
428      float4_t result;
429      result.vi = _a.vi > _b.vi;
430      return result;
431   }
432
433   BX_FLOAT4_FORCE_INLINE float4_t float4_iadd(float4_t _a, float4_t _b)
434   {
435      float4_t result;
436      result.vi = _a.vi + _b.vi;
437      return result;
438   }
439
440   BX_FLOAT4_FORCE_INLINE float4_t float4_isub(float4_t _a, float4_t _b)
441   {
442      float4_t result;
443      result.vi = _a.vi - _b.vi;
444      return result;
445   }
446
447} // namespace bx
448
449#define float4_rcp           float4_rcp_ni
450#define float4_orx           float4_orx_ni
451#define float4_orc           float4_orc_ni
452#define float4_neg           float4_neg_ni
453#define float4_madd          float4_madd_ni
454#define float4_nmsub         float4_nmsub_ni
455#define float4_div_nr        float4_div_nr_ni
456#define float4_selb          float4_selb_ni
457#define float4_sels          float4_sels_ni
458#define float4_not           float4_not_ni
459#define float4_abs           float4_abs_ni
460#define float4_clamp         float4_clamp_ni
461#define float4_lerp          float4_lerp_ni
462#define float4_rcp_est       float4_rcp_ni
463#define float4_rsqrt         float4_rsqrt_ni
464#define float4_rsqrt_nr      float4_rsqrt_nr_ni
465#define float4_rsqrt_carmack float4_rsqrt_carmack_ni
466#define float4_sqrt_nr       float4_sqrt_nr_ni
467#define float4_log2          float4_log2_ni
468#define float4_exp2          float4_exp2_ni
469#define float4_pow           float4_pow_ni
470#define float4_cross3        float4_cross3_ni
471#define float4_normalize3    float4_normalize3_ni
472#define float4_dot3          float4_dot3_ni
473#define float4_dot           float4_dot_ni
474#define float4_ceil          float4_ceil_ni
475#define float4_floor         float4_floor_ni
476#define float4_min           float4_min_ni
477#define float4_max           float4_max_ni
478#define float4_imin          float4_imin_ni
479#define float4_imax          float4_imax_ni
480#include "float4_ni.h"
481
482#endif // BX_FLOAT4_LANGEXT_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/float4_langext.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/float4_t.h
r0r31734
1/*
2 * Copyright 2010-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_FLOAT4_T_H_HEADER_GUARD
7#define BX_FLOAT4_T_H_HEADER_GUARD
8
9#include "bx.h"
10
11#define BX_FLOAT4_FORCE_INLINE BX_FORCE_INLINE
12#define BX_FLOAT4_INLINE static inline
13
14#if defined(__SSE2__) || (BX_COMPILER_MSVC && (BX_ARCH_64BIT || _M_IX86_FP >= 2) )
15#   include "float4_sse.h"
16#elif defined(__ARM_NEON__) && !BX_COMPILER_CLANG
17#   include "float4_neon.h"
18#elif 0 // BX_COMPILER_CLANG
19#   include "float4_langext.h"
20#else
21#   pragma message("************************************\nUsing SIMD reference implementation!\n************************************")
22#   include "float4_ref.h"
23#endif //
24
25#endif // BX_FLOAT4_T_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/float4_t.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/tokenizecmd.h
r0r31734
1/*
2 * Copyright 2012-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_TOKENIZE_CMD_H_HEADER_GUARD
7#define BX_TOKENIZE_CMD_H_HEADER_GUARD
8
9#include <stdint.h>
10#include <stdio.h>
11#include <ctype.h>
12
13namespace bx
14{
15   // Reference:
16   // http://msdn.microsoft.com/en-us/library/a1y7w461.aspx
17   static inline const char* tokenizeCommandLine(const char* _commandLine, char* _buffer, uint32_t& _bufferSize, int& _argc, char* _argv[], int _maxArgvs, char _term = '\0')
18   {
19      int argc = 0;
20      const char* curr = _commandLine;
21      char* currOut = _buffer;
22      char term = ' ';
23      bool sub = false;
24     
25      enum ParserState
26      {
27         SkipWhitespace,
28         SetTerm,
29         Copy,
30         Escape,
31         End,
32      };
33
34      ParserState state = SkipWhitespace;
35     
36      while ('\0' != *curr
37      &&     _term != *curr
38      &&     argc < _maxArgvs)
39      {
40         switch (state)
41         {
42            case SkipWhitespace:
43               for (; isspace(*curr); ++curr) {}; // skip whitespace
44               state = SetTerm;
45               break;
46               
47            case SetTerm:
48               if ('"' == *curr)
49               {
50                  term = '"';
51                  ++curr; // skip begining quote
52               }
53               else
54               {
55                  term = ' ';
56               }
57               
58               _argv[argc] = currOut;
59               ++argc;
60               
61               state = Copy;
62               break;
63               
64            case Copy:
65               if ('\\' == *curr)
66               {
67                  state = Escape;
68               }
69               else if ('"' == *curr
70                  &&  '"' != term)
71               {
72                  sub = !sub;
73               }
74               else if (isspace(*curr) && !sub)
75               {
76                  state = End;
77               }
78               else if (term != *curr || sub)
79               {
80                  *currOut = *curr;
81                  ++currOut;
82               }
83               else
84               {
85                  state = End;
86               }
87               ++curr;
88               break;
89               
90            case Escape:
91               {
92                  const char* start = --curr;
93                  for (; '\\' == *curr; ++curr) {};
94
95                  if ('"' != *curr)
96                  {
97                     int count = (int)(curr-start);
98
99                     curr = start;
100                     for (int ii = 0; ii < count; ++ii)
101                     {
102                        *currOut = *curr;
103                        ++currOut;
104                        ++curr;
105                     }
106                  }
107                  else
108                  {
109                     curr = start+1;
110                     *currOut = *curr;
111                     ++currOut;
112                     ++curr;
113                  }
114               }
115               state = Copy;
116               break;
117               
118            case End:
119               *currOut = '\0';
120               ++currOut;
121               state = SkipWhitespace;
122               break;
123         }
124      }
125     
126      *currOut = '\0';
127      if (0 < argc
128      &&  '\0' == _argv[argc-1][0])
129      {
130         --argc;
131      }
132
133      _bufferSize = (uint32_t)(currOut - _buffer);
134      _argc = argc;
135
136      if ('\0' != *curr)
137      {
138         ++curr;
139      }
140
141      return curr;
142   }
143
144} // namespace bx
145
146#endif // TOKENIZE_CMD_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/tokenizecmd.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/spscqueue.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_SPSCQUEUE_H_HEADER_GUARD
7#define BX_SPSCQUEUE_H_HEADER_GUARD
8
9#include "bx.h"
10#include "cpu.h"
11#include "mutex.h"
12#include "uint32_t.h"
13
14#include <list>
15
16namespace bx
17{
18   // http://drdobbs.com/article/print?articleId=210604448&siteSectionName=
19   template <typename Ty>
20   class SpScUnboundedQueueLf
21   {
22      BX_CLASS(SpScUnboundedQueueLf
23         , NO_COPY
24         , NO_ASSIGNMENT
25         );
26
27   public:
28      SpScUnboundedQueueLf()
29         : m_first(new Node(NULL) )
30         , m_divider(m_first)
31         , m_last(m_first)
32      {
33      }
34
35      ~SpScUnboundedQueueLf()
36      {
37         while (NULL != m_first)
38         {
39            Node* node = m_first;
40            m_first = node->m_next;
41            delete node;
42         }
43      }
44
45      void push(Ty* _ptr) // producer only
46      {
47         m_last->m_next = new Node( (void*)_ptr);
48         atomicExchangePtr( (void**)&m_last, m_last->m_next);
49         while (m_first != m_divider)
50         {
51            Node* node = m_first;
52            m_first = m_first->m_next;
53            delete node;
54         }
55      }
56
57      Ty* peek() // consumer only
58      {
59         if (m_divider != m_last)
60         {
61            Ty* ptr = (Ty*)m_divider->m_next->m_ptr;
62            return ptr;
63         }
64
65         return NULL;
66      }
67
68      Ty* pop() // consumer only
69      {
70         if (m_divider != m_last)
71         {
72            Ty* ptr = (Ty*)m_divider->m_next->m_ptr;
73            atomicExchangePtr( (void**)&m_divider, m_divider->m_next);
74            return ptr;
75         }
76
77         return NULL;
78      }
79
80   private:
81      struct Node
82      {
83         Node(void* _ptr)
84            : m_ptr(_ptr)
85            , m_next(NULL)
86         {
87         }
88
89         void* m_ptr;
90         Node* m_next;
91      };
92
93      Node* m_first;
94      Node* m_divider;
95      Node* m_last;
96   };
97
98#if BX_CONFIG_SUPPORTS_THREADING
99   template<typename Ty>
100   class SpScUnboundedQueueMutex
101   {
102      BX_CLASS(SpScUnboundedQueueMutex
103         , NO_COPY
104         , NO_ASSIGNMENT
105         );
106
107   public:
108      SpScUnboundedQueueMutex()
109      {
110      }
111
112      ~SpScUnboundedQueueMutex()
113      {
114         BX_CHECK(m_queue.empty(), "Queue is not empty!");
115      }
116
117      void push(Ty* _item)
118      {
119         bx::LwMutexScope lock(m_mutex);
120         m_queue.push_back(_item);
121      }
122
123      Ty* peek()
124      {
125         bx::LwMutexScope lock(m_mutex);
126         if (!m_queue.empty() )
127         {
128            return m_queue.front();
129         }
130
131         return NULL;
132      }
133
134      Ty* pop()
135      {
136         bx::LwMutexScope lock(m_mutex);
137         if (!m_queue.empty() )
138         {
139            Ty* item = m_queue.front();
140            m_queue.pop_front();
141            return item;
142         }
143
144         return NULL;
145      }
146
147   private:
148      bx::LwMutex m_mutex;
149      std::list<Ty*> m_queue;
150   };
151#endif // BX_CONFIG_SUPPORTS_THREADING
152
153#if BX_CONFIG_SPSCQUEUE_USE_MUTEX && BX_CONFIG_SUPPORTS_THREADING
154#   define SpScUnboundedQueue SpScUnboundedQueueMutex
155#else
156#   define SpScUnboundedQueue SpScUnboundedQueueLf
157#endif // BX_CONFIG_SPSCQUEUE_USE_MUTEX
158
159#if BX_CONFIG_SUPPORTS_THREADING
160   template <typename Ty>
161   class SpScBlockingUnboundedQueue
162   {
163      BX_CLASS(SpScBlockingUnboundedQueue
164         , NO_COPY
165         , NO_ASSIGNMENT
166         );
167
168   public:
169      SpScBlockingUnboundedQueue()
170      {
171      }
172
173      ~SpScBlockingUnboundedQueue()
174      {
175      }
176
177      void push(Ty* _ptr) // producer only
178      {
179         m_queue.push( (void*)_ptr);
180         m_count.post();
181      }
182
183      Ty* peek() // consumer only
184      {
185         return (Ty*)m_queue.peek();
186      }
187
188      Ty* pop(int32_t _msecs = -1) // consumer only
189      {
190         if (m_count.wait(_msecs) )
191         {
192            return (Ty*)m_queue.pop();
193         }
194
195         return NULL;
196      }
197
198   private:
199      Semaphore m_count;
200      SpScUnboundedQueue<void> m_queue;
201   };
202#endif // BX_CONFIG_SUPPORTS_THREADING
203
204} // namespace bx
205
206#endif // BX_RINGBUFFER_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/spscqueue.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/radixsort.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_RADIXSORT_H_HEADER_GUARD
7#define BX_RADIXSORT_H_HEADER_GUARD
8
9#include "bx.h"
10
11namespace bx
12{
13#define BX_RADIXSORT_BITS 11
14#define BX_RADIXSORT_HISTOGRAM_SIZE (1<<BX_RADIXSORT_BITS)
15#define BX_RADIXSORT_BIT_MASK (BX_RADIXSORT_HISTOGRAM_SIZE-1)
16
17   template <typename Ty>
18   void radixSort32(uint32_t* __restrict _keys, uint32_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size)
19   {
20      uint32_t* __restrict keys = _keys;
21      uint32_t* __restrict tempKeys = _tempKeys;
22      Ty* __restrict values = _values;
23      Ty* __restrict tempValues = _tempValues;
24
25      uint16_t histogram[BX_RADIXSORT_HISTOGRAM_SIZE];
26      uint16_t shift = 0;
27      uint32_t pass = 0;
28      for (; pass < 3; ++pass)
29      {
30         memset(histogram, 0, sizeof(uint16_t)*BX_RADIXSORT_HISTOGRAM_SIZE);
31
32         bool sorted = true;
33         uint32_t key = keys[0];
34         uint32_t prevKey = key;
35         for (uint32_t ii = 0; ii < _size; ++ii, prevKey = key)
36         {
37            key = keys[ii];
38            uint16_t index = (key>>shift)&BX_RADIXSORT_BIT_MASK;
39            ++histogram[index];
40            sorted &= prevKey <= key;
41         }
42
43         if (sorted)
44         {
45            goto done;
46         }
47
48         uint16_t offset = 0;
49         for (uint32_t ii = 0; ii < BX_RADIXSORT_HISTOGRAM_SIZE; ++ii)
50         {
51            uint16_t count = histogram[ii];
52            histogram[ii] = offset;
53            offset += count;
54         }
55
56         for (uint32_t ii = 0; ii < _size; ++ii)
57         {
58            uint32_t key = keys[ii];
59            uint16_t index = (key>>shift)&BX_RADIXSORT_BIT_MASK;
60            uint16_t dest = histogram[index]++;
61            tempKeys[dest] = key;
62            tempValues[dest] = values[ii];
63         }
64
65         uint32_t* swapKeys = tempKeys;
66         tempKeys = keys;
67         keys = swapKeys;
68
69         Ty* swapValues = tempValues;
70         tempValues = values;
71         values = swapValues;
72
73         shift += BX_RADIXSORT_BITS;
74      }
75
76done:
77      if (0 != (pass&1) )
78      {
79         // Odd number of passes needs to do copy to the destination.
80         memcpy(_keys, _tempKeys, _size*sizeof(uint32_t) );
81         for (uint32_t ii = 0; ii < _size; ++ii)
82         {
83            _values[ii] = _tempValues[ii];
84         }
85      }
86   }
87
88   template <typename Ty>
89   void radixSort64(uint64_t* __restrict _keys, uint64_t* __restrict _tempKeys, Ty* __restrict _values, Ty* __restrict _tempValues, uint32_t _size)
90   {
91      uint64_t* __restrict keys = _keys;
92      uint64_t* __restrict tempKeys = _tempKeys;
93      Ty* __restrict values = _values;
94      Ty* __restrict tempValues = _tempValues;
95
96      uint16_t histogram[BX_RADIXSORT_HISTOGRAM_SIZE];
97      uint16_t shift = 0;
98      uint32_t pass = 0;
99      for (; pass < 6; ++pass)
100      {
101         memset(histogram, 0, sizeof(uint16_t)*BX_RADIXSORT_HISTOGRAM_SIZE);
102
103         bool sorted = true;
104         uint64_t key = keys[0];
105         uint64_t prevKey = key;
106         for (uint32_t ii = 0; ii < _size; ++ii, prevKey = key)
107         {
108            key = keys[ii];
109            uint16_t index = (key>>shift)&BX_RADIXSORT_BIT_MASK;
110            ++histogram[index];
111            sorted &= prevKey <= key;
112         }
113
114         if (sorted)
115         {
116            goto done;
117         }
118
119         uint16_t offset = 0;
120         for (uint32_t ii = 0; ii < BX_RADIXSORT_HISTOGRAM_SIZE; ++ii)
121         {
122            uint16_t count = histogram[ii];
123            histogram[ii] = offset;
124            offset += count;
125         }
126
127         for (uint32_t ii = 0; ii < _size; ++ii)
128         {
129            uint64_t key = keys[ii];
130            uint16_t index = (key>>shift)&BX_RADIXSORT_BIT_MASK;
131            uint16_t dest = histogram[index]++;
132            tempKeys[dest] = key;
133            tempValues[dest] = values[ii];
134         }
135
136         uint64_t* swapKeys = tempKeys;
137         tempKeys = keys;
138         keys = swapKeys;
139
140         Ty* swapValues = tempValues;
141         tempValues = values;
142         values = swapValues;
143
144         shift += BX_RADIXSORT_BITS;
145      }
146
147done:
148      if (0 != (pass&1) )
149      {
150         // Odd number of passes needs to do copy to the destination.
151         memcpy(_keys, _tempKeys, _size*sizeof(uint64_t) );
152         for (uint32_t ii = 0; ii < _size; ++ii)
153         {
154            _values[ii] = _tempValues[ii];
155         }
156      }
157   }
158
159#undef BX_RADIXSORT_BITS
160#undef BX_RADIXSORT_HISTOGRAM_SIZE
161#undef BX_RADIXSORT_BIT_MASK
162
163} // namespace bx
164
165#endif // BX_RADIXSORT_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/radixsort.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/macros.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_MACROS_H_HEADER_GUARD
7#define BX_MACROS_H_HEADER_GUARD
8
9#include "bx.h"
10
11#if BX_COMPILER_MSVC
12// Workaround MSVS bug...
13#   define BX_VA_ARGS_PASS(...) BX_VA_ARGS_PASS_1_ __VA_ARGS__ BX_VA_ARGS_PASS_2_
14#   define BX_VA_ARGS_PASS_1_ (
15#   define BX_VA_ARGS_PASS_2_ )
16#else
17#   define BX_VA_ARGS_PASS(...) (__VA_ARGS__)
18#endif // BX_COMPILER_MSVC
19
20#define BX_VA_ARGS_COUNT(...) BX_VA_ARGS_COUNT_ BX_VA_ARGS_PASS(__VA_ARGS__, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
21#define BX_VA_ARGS_COUNT_(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10, _a11, _a12, _a13, _a14, _a15, _a16, _last, ...) _last
22
23#define BX_MACRO_DISPATCHER(_func, ...) BX_MACRO_DISPATCHER_1_(_func, BX_VA_ARGS_COUNT(__VA_ARGS__) )
24#define BX_MACRO_DISPATCHER_1_(_func, _argCount) BX_MACRO_DISPATCHER_2_(_func, _argCount)
25#define BX_MACRO_DISPATCHER_2_(_func, _argCount) BX_CONCATENATE(_func, _argCount)
26
27#define BX_MAKEFOURCC(_a, _b, _c, _d) ( ( (uint32_t)(_a) | ( (uint32_t)(_b) << 8) | ( (uint32_t)(_c) << 16) | ( (uint32_t)(_d) << 24) ) )
28
29#define BX_STRINGIZE(_x) BX_STRINGIZE_(_x)
30#define BX_STRINGIZE_(_x) #_x
31
32#define BX_CONCATENATE(_x, _y) BX_CONCATENATE_(_x, _y)
33#define BX_CONCATENATE_(_x, _y) _x ## _y
34
35#define BX_FILE_LINE_LITERAL "" __FILE__ "(" BX_STRINGIZE(__LINE__) "): "
36
37#define BX_ALIGN_MASK(_value, _mask) ( ( (_value)+(_mask) ) & ( (~0)&(~(_mask) ) ) )
38#define BX_ALIGN_16(_value) BX_ALIGN_MASK(_value, 0xf)
39#define BX_ALIGN_256(_value) BX_ALIGN_MASK(_value, 0xff)
40#define BX_ALIGN_4096(_value) BX_ALIGN_MASK(_value, 0xfff)
41
42#define BX_ALIGNOF(_type) __alignof(_type)
43
44#if BX_COMPILER_GCC || BX_COMPILER_CLANG
45#   define BX_ALIGN_STRUCT(_align, _struct) _struct __attribute__( (aligned(_align) ) )
46#   define BX_ALLOW_UNUSED __attribute__( (unused) )
47#   define BX_FORCE_INLINE __extension__ static __inline __attribute__( (__always_inline__) )
48#   define BX_FUNCTION __PRETTY_FUNCTION__
49#   define BX_NO_INLINE __attribute__( (noinline) )
50#   define BX_NO_RETURN __attribute__( (noreturn) )
51#   define BX_NO_VTABLE
52#   define BX_OVERRIDE
53#   define BX_PRINTF_ARGS(_format, _args) __attribute__ ( (format(__printf__, _format, _args) ) )
54#   if BX_COMPILER_CLANG || BX_PLATFORM_OSX || BX_PLATFORM_IOS
55#      define BX_THREAD /* not supported right now */
56#   else
57#      define BX_THREAD __thread
58#   endif // BX_COMPILER_CLANG
59#   define BX_ATTRIBUTE(_x) __attribute__( (_x) )
60#elif BX_COMPILER_MSVC
61#   define BX_ALIGN_STRUCT(_align, _struct) __declspec(align(_align) ) _struct
62#   define BX_ALLOW_UNUSED
63#   define BX_FORCE_INLINE __forceinline
64#   define BX_FUNCTION __FUNCTION__
65#   define BX_NO_INLINE __declspec(noinline)
66#   define BX_NO_RETURN
67#   define BX_NO_VTABLE __declspec(novtable)
68#   define BX_OVERRIDE override
69#   define BX_PRINTF_ARGS(_format, _args)
70#   define BX_THREAD __declspec(thread)
71#   define BX_ATTRIBUTE(_x)
72#else
73#   error "Unknown BX_COMPILER_?"
74#endif
75
76// #define BX_STATIC_ASSERT(_condition, ...) static_assert(_condition, "" __VA_ARGS__)
77#define BX_STATIC_ASSERT(_condition, ...) typedef char BX_CONCATENATE(BX_STATIC_ASSERT_, __LINE__)[1][(_condition)] BX_ATTRIBUTE(unused)
78
79#define BX_CACHE_LINE_ALIGN_MARKER() BX_ALIGN_STRUCT(BX_CACHE_LINE_SIZE, struct) BX_CONCATENATE(bx_cache_line_marker_compiler_stfu, __COUNTER__) {}
80#define BX_CACHE_LINE_ALIGN(_def) BX_CACHE_LINE_ALIGN_MARKER(); _def; BX_CACHE_LINE_ALIGN_MARKER()
81
82#define BX_ALIGN_STRUCT_16(_struct) BX_ALIGN_STRUCT(16, _struct)
83#define BX_ALIGN_STRUCT_256(_struct) BX_ALIGN_STRUCT(256, _struct)
84
85#define BX_MACRO_BLOCK_BEGIN for(;;) {
86#define BX_MACRO_BLOCK_END break; }
87#define BX_NOOP(...) BX_MACRO_BLOCK_BEGIN BX_MACRO_BLOCK_END
88
89#define BX_UNUSED_1(_a1) BX_MACRO_BLOCK_BEGIN (void)(true ? (void)0 : ( (void)(_a1) ) ); BX_MACRO_BLOCK_END
90#define BX_UNUSED_2(_a1, _a2) BX_UNUSED_1(_a1); BX_UNUSED_1(_a2)
91#define BX_UNUSED_3(_a1, _a2, _a3) BX_UNUSED_2(_a1, _a2); BX_UNUSED_1(_a3)
92#define BX_UNUSED_4(_a1, _a2, _a3, _a4) BX_UNUSED_3(_a1, _a2, _a3); BX_UNUSED_1(_a4)
93#define BX_UNUSED_5(_a1, _a2, _a3, _a4, _a5) BX_UNUSED_4(_a1, _a2, _a3, _a4); BX_UNUSED_1(_a5)
94#define BX_UNUSED_6(_a1, _a2, _a3, _a4, _a5, _a6) BX_UNUSED_5(_a1, _a2, _a3, _a4, _a5); BX_UNUSED_1(_a6)
95#define BX_UNUSED_7(_a1, _a2, _a3, _a4, _a5, _a6, _a7) BX_UNUSED_6(_a1, _a2, _a3, _a4, _a5, _a6); BX_UNUSED_1(_a7)
96#define BX_UNUSED_8(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8) BX_UNUSED_7(_a1, _a2, _a3, _a4, _a5, _a6, _a7); BX_UNUSED_1(_a8)
97#define BX_UNUSED_9(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9) BX_UNUSED_8(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8); BX_UNUSED_1(_a9)
98#define BX_UNUSED_10(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10) BX_UNUSED_9(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9); BX_UNUSED_1(_a10)
99#define BX_UNUSED_11(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10, _a11) BX_UNUSED_10(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10); BX_UNUSED_1(_a11)
100#define BX_UNUSED_12(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10, _a11, _a12) BX_UNUSED_11(_a1, _a2, _a3, _a4, _a5, _a6, _a7, _a8, _a9, _a10, _a11); BX_UNUSED_1(_a12)
101
102#if BX_COMPILER_MSVC
103// Workaround MSVS bug...
104#   define BX_UNUSED(...) BX_MACRO_DISPATCHER(BX_UNUSED_, __VA_ARGS__) BX_VA_ARGS_PASS(__VA_ARGS__)
105#else
106#   define BX_UNUSED(...) BX_MACRO_DISPATCHER(BX_UNUSED_, __VA_ARGS__)(__VA_ARGS__)
107#endif // BX_COMPILER_MSVC
108
109#define BX_TYPE_IS_POD(_type) (!__is_class(_type) || __is_pod(_type) )
110
111#define BX_CLASS_NO_DEFAULT_CTOR(_class) \
112         private: _class()
113
114#define BX_CLASS_NO_COPY(_class) \
115         private: _class(const _class& _rhs)
116
117#define BX_CLASS_NO_ASSIGNMENT(_class) \
118         private: _class& operator=(const _class& _rhs)
119
120#define BX_CLASS_ALLOCATOR(_class) \
121         public: void* operator new(size_t _size); \
122         public: void  operator delete(void* _ptr); \
123         public: void* operator new[](size_t _size); \
124         public: void  operator delete[](void* _ptr)
125
126#define BX_CLASS_1(_class, _a1) BX_CONCATENATE(BX_CLASS_, _a1)(_class)
127#define BX_CLASS_2(_class, _a1, _a2) BX_CLASS_1(_class, _a1); BX_CLASS_1(_class, _a2)
128#define BX_CLASS_3(_class, _a1, _a2, _a3) BX_CLASS_2(_class, _a1, _a2); BX_CLASS_1(_class, _a3)
129#define BX_CLASS_4(_class, _a1, _a2, _a3, _a4) BX_CLASS_3(_class, _a1, _a2, _a3); BX_CLASS_1(_class, _a4)
130
131#if BX_COMPILER_MSVC
132#   define BX_CLASS(_class, ...) BX_MACRO_DISPATCHER(BX_CLASS_, __VA_ARGS__) BX_VA_ARGS_PASS(_class, __VA_ARGS__)
133#else
134#   define BX_CLASS(_class, ...) BX_MACRO_DISPATCHER(BX_CLASS_, __VA_ARGS__)(_class, __VA_ARGS__)
135#endif // BX_COMPILER_MSVC
136
137#ifndef BX_CHECK
138#   define BX_CHECK(_condition, ...) BX_NOOP()
139#endif // BX_CHECK
140
141#ifndef BX_TRACE
142#   define BX_TRACE(...) BX_NOOP()
143#endif // BX_TRACE
144
145#ifndef BX_WARN
146#   define BX_WARN(_condition, ...) BX_NOOP()
147#endif // BX_CHECK
148
149#ifndef BX_CONFIG_ALLOCATOR_DEBUG
150#   define BX_CONFIG_ALLOCATOR_DEBUG 0
151#endif // BX_CONFIG_DEBUG_ALLOC
152
153#ifndef BX_CONFIG_ALLOCATOR_CRT
154#   define BX_CONFIG_ALLOCATOR_CRT 1
155#endif // BX_CONFIG_ALLOCATOR_CRT
156
157#ifndef  BX_CONFIG_SPSCQUEUE_USE_MUTEX
158#   define BX_CONFIG_SPSCQUEUE_USE_MUTEX 0
159#endif // BX_CONFIG_SPSCQUEUE_USE_MUTEX
160
161#ifndef BX_CONFIG_CRT_FILE_READER_WRITER
162#   define BX_CONFIG_CRT_FILE_READER_WRITER (0 \
163            || BX_PLATFORM_ANDROID \
164            || BX_PLATFORM_FREEBSD \
165            || BX_PLATFORM_IOS \
166            || BX_PLATFORM_LINUX \
167            || BX_PLATFORM_OSX \
168            || BX_PLATFORM_QNX \
169            || BX_PLATFORM_WINDOWS \
170            ? 1 : 0)
171#endif // BX_CONFIG_CRT_FILE_READER_WRITER
172
173#ifndef BX_CONFIG_SEMAPHORE_PTHREAD
174#   define BX_CONFIG_SEMAPHORE_PTHREAD (BX_PLATFORM_OSX || BX_PLATFORM_IOS)
175#endif // BX_CONFIG_SEMAPHORE_PTHREAD
176
177#ifndef BX_CONFIG_SUPPORTS_THREADING
178#   define BX_CONFIG_SUPPORTS_THREADING !(BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_WINRT)
179#endif // BX_CONFIG_SUPPORTS_THREADING
180
181#endif // BX_MACROS_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/macros.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/rng.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_RNG_H_HEADER_GUARD
7#define BX_RNG_H_HEADER_GUARD
8
9#include "bx.h"
10
11#define _USE_MATH_DEFINES
12#include <math.h>
13
14namespace bx
15{
16   // George Marsaglia's MWC
17   class RngMwc
18   {
19   public:
20      RngMwc(uint32_t _z = 12345, uint32_t _w = 65435)
21         : m_z(_z)
22         , m_w(_w)
23      {
24      }
25
26      void reset(uint32_t _z = 12345, uint32_t _w = 65435)
27      {
28         m_z = _z;
29         m_w = _w;
30      }
31
32      uint32_t gen()
33      {
34         m_z = 36969*(m_z&65535)+(m_z>>16);
35         m_w = 18000*(m_w&65535)+(m_w>>16);
36         return (m_z<<16)+m_w;
37      }
38
39   private:
40      uint32_t m_z;
41      uint32_t m_w;
42   };
43
44   // George Marsaglia's FIB
45   class RngFib
46   {
47   public:
48      RngFib()
49         : m_a(9983651)
50         , m_b(95746118)
51      {
52      }
53
54      void reset()
55      {
56         m_a = 9983651;
57         m_b = 95746118;
58      }
59
60      uint32_t gen()
61      {
62         m_b = m_a+m_b;
63         m_a = m_b-m_a;
64         return m_a;
65      }
66
67   private:
68      uint32_t m_a;
69      uint32_t m_b;
70   };
71
72   // George Marsaglia's SHR3
73   class RngShr3
74   {
75   public:
76      RngShr3(uint32_t _jsr = 34221)
77         : m_jsr(_jsr)
78      {
79      }
80
81      void reset(uint32_t _jsr = 34221)
82      {
83         m_jsr = _jsr;
84      }
85
86      uint32_t gen()
87      {
88         m_jsr ^= m_jsr<<17;
89         m_jsr ^= m_jsr>>13;
90         m_jsr ^= m_jsr<<5;
91         return m_jsr;
92      }
93
94   private:
95      uint32_t m_jsr;
96   };
97
98   /// Returns random number between 0.0f and 1.0f.
99   template <typename Ty>
100   inline float frnd(Ty* _rng)
101   {
102      uint32_t rnd = _rng->gen() & UINT16_MAX;
103      return float(rnd) * 1.0f/float(UINT16_MAX);
104   }
105
106   /// Returns random number between -1.0f and 1.0f.
107   template <typename Ty>
108   inline float frndh(Ty* _rng)
109   {
110      return 2.0f * bx::frnd(_rng) - 1.0f;
111   }
112
113   /// Generate random point on unit sphere.
114   template <typename Ty>
115   static inline void randUnitSphere(float _result[3], Ty* _rng)
116   {
117      float rand0 = frnd(_rng) * 2.0f - 1.0f;
118      float rand1 = frnd(_rng) * float(M_PI) * 2.0f;
119
120      float sqrtf1 = sqrtf(1.0f - rand0*rand0);
121      _result[0] = sqrtf1 * cosf(rand1);
122      _result[1] = sqrtf1 * sinf(rand1);
123      _result[2] = rand0;
124   }
125
126   /// Generate random point on unit hemisphere.
127   template <typename Ty>
128   static inline void randUnitHemisphere(float _result[3], Ty* _rng, const float _normal[3])
129   {
130      float dir[3];
131      randUnitSphere(dir, _rng);
132
133      float DdotN = dir[0]*_normal[0]
134               + dir[1]*_normal[1]
135               + dir[2]*_normal[2]
136               ;
137
138      if (0.0f > DdotN)
139      {
140         dir[0] = -dir[0];
141         dir[1] = -dir[1];
142         dir[2] = -dir[2];
143      }
144
145      _result[0] = dir[0];
146      _result[1] = dir[1];
147      _result[2] = dir[2];
148   }
149
150   /// Sampling with Hammersley and Halton Points
151   /// http://www.cse.cuhk.edu.hk/~ttwong/papers/udpoint/udpoints.html
152   ///
153   static inline void generateSphereHammersley(void* _data, uint32_t _stride, uint32_t _num, float _scale = 1.0f)
154   {
155      uint8_t* data = (uint8_t*)_data;
156
157      for (uint32_t ii = 0; ii < _num; ii++)
158      {
159         float tt = 0.0f;
160         float pp = 0.5;
161         for (uint32_t jj = ii; jj; jj >>= 1)
162         {
163            tt += (jj & 1) ? pp : 0.0f;
164            pp *= 0.5f;
165         }
166
167         tt = 2.0f * tt - 1.0f;
168
169         const float phi = (ii + 0.5f) / _num;
170         const float phirad =  phi * 2.0f * float(M_PI);
171         const float st = sqrtf(1.0f-tt*tt) * _scale;
172
173         float* xyz = (float*)data;
174         data += _stride;
175
176         xyz[0] = st * cosf(phirad);
177         xyz[1] = st * sinf(phirad);
178         xyz[2] = tt * _scale;
179      }
180   }
181
182} // namespace bx
183
184#endif // BX_RNG_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/rng.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/commandline.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_COMMANDLINE_H_HEADER_GUARD
7#define BX_COMMANDLINE_H_HEADER_GUARD
8
9#include "bx.h"
10#include "string.h"
11
12namespace bx
13{
14   class CommandLine
15   {
16   public:
17      CommandLine(int _argc, char const* const* _argv)
18         : m_argc(_argc)
19         , m_argv(_argv)
20      {
21      }
22
23      const char* findOption(const char* _long, const char* _default) const
24      {
25         const char* result = find('\0', _long, 1);
26         return result == NULL ? _default : result;
27      }
28
29      const char* findOption(const char _short, const char* _long, const char* _default) const
30      {
31         const char* result = find(_short, _long, 1);
32         return result == NULL ? _default : result;
33      }
34
35      const char* findOption(const char* _long, int _numParams = 1) const
36      {
37         const char* result = find('\0', _long, _numParams);
38         return result;
39      }
40
41      const char* findOption(const char _short, const char* _long = NULL, int _numParams = 1) const
42      {
43         const char* result = find(_short, _long, _numParams);
44         return result;
45      }
46
47      bool hasArg(const char _short, const char* _long = NULL) const
48      {
49         const char* arg = findOption(_short, _long, 0);
50         return NULL != arg;
51      }
52
53      bool hasArg(const char* _long) const
54      {
55         const char* arg = findOption('\0', _long, 0);
56         return NULL != arg;
57      }
58
59      bool hasArg(const char*& _value, const char _short, const char* _long = NULL) const
60      {
61         const char* arg = findOption(_short, _long, 1);
62         _value = arg;
63         return NULL != arg;
64      }
65
66      bool hasArg(int& _value, const char _short, const char* _long = NULL) const
67      {
68         const char* arg = findOption(_short, _long, 1);
69         if (NULL != arg)
70         {
71            _value = atoi(arg);
72            return true;
73         }
74
75         return false;
76      }
77
78      bool hasArg(unsigned int& _value, const char _short, const char* _long = NULL) const
79      {
80         const char* arg = findOption(_short, _long, 1);
81         if (NULL != arg)
82         {
83            _value = atoi(arg);
84            return true;
85         }
86
87         return false;
88      }
89
90      bool hasArg(float& _value, const char _short, const char* _long = NULL) const
91      {
92         const char* arg = findOption(_short, _long, 1);
93         if (NULL != arg)
94         {
95            _value = float(atof(arg));
96            return true;
97         }
98
99         return false;
100      }
101
102      bool hasArg(double& _value, const char _short, const char* _long = NULL) const
103      {
104         const char* arg = findOption(_short, _long, 1);
105         if (NULL != arg)
106         {
107            _value = atof(arg);
108            return true;
109         }
110
111         return false;
112      }
113
114      bool hasArg(bool& _value, const char _short, const char* _long = NULL) const
115      {
116         const char* arg = findOption(_short, _long, 1);
117         if (NULL != arg)
118         {
119            if ('0' == *arg || (0 == stricmp(arg, "false") ) )
120            {
121               _value = false;
122            }
123            else if ('0' != *arg || (0 == stricmp(arg, "true") ) )
124            {
125               _value = true;
126            }
127
128            return true;
129         }
130
131         return false;
132      }
133
134   private:
135      const char* find(const char _short, const char* _long, int _numParams) const
136      {
137         for (int ii = 0; ii < m_argc; ++ii)
138         {
139            const char* arg = m_argv[ii];
140            if ('-' == *arg)
141            {
142               ++arg;
143               if (_short == *arg)
144               {
145                  if (1 == strlen(arg) )
146                  {
147                     if (0 == _numParams)
148                     {
149                        return "";
150                     }
151                     else if (ii+_numParams < m_argc
152                         && '-' != *m_argv[ii+1] )
153                     {
154                        return m_argv[ii+1];
155                     }
156
157                     return NULL;
158                  }
159               }
160               else if (NULL != _long
161                   &&  '-' == *arg
162                   &&  0 == stricmp(arg+1, _long) )
163               {
164                  if (0 == _numParams)
165                  {
166                     return "";
167                  }
168                  else if (ii+_numParams < m_argc
169                        &&  '-' != *m_argv[ii+1] )
170                  {
171                     return m_argv[ii+1];
172                  }
173
174                  return NULL;
175               }
176            }
177         }
178
179         return NULL;
180      }
181
182      int m_argc;
183      char const* const* m_argv;
184   };
185
186} // namespace bx
187
188#endif /// BX_COMMANDLINE_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/commandline.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/debug.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_DEBUG_H_HEADER_GUARD
7#define BX_DEBUG_H_HEADER_GUARD
8
9#include "bx.h"
10
11#if BX_PLATFORM_ANDROID
12#   include <android/log.h>
13#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT || BX_PLATFORM_XBOX360
14extern "C" __declspec(dllimport) void __stdcall OutputDebugStringA(const char* _str);
15#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX
16#   if defined(__OBJC__)
17#      import <Foundation/NSObjCRuntime.h>
18#   else
19#      include <CoreFoundation/CFString.h>
20extern "C" void NSLog(CFStringRef _format, ...);
21#   endif // defined(__OBJC__)
22#elif 0 // BX_PLATFORM_EMSCRIPTEN
23#   include <emscripten.h>
24#else
25#   include <stdio.h>
26#endif // BX_PLATFORM_WINDOWS
27
28namespace bx
29{
30   inline void debugBreak()
31   {
32#if BX_COMPILER_MSVC
33      __debugbreak();
34#elif BX_CPU_ARM
35      asm("bkpt 0");
36#elif !BX_PLATFORM_NACL && BX_CPU_X86 && (BX_COMPILER_GCC || BX_COMPILER_CLANG)
37      // NaCl doesn't like int 3:
38      // NativeClient: NaCl module load failed: Validation failure. File violates Native Client safety rules.
39      __asm__ ("int $3");
40#else // cross platform implementation
41      int* int3 = (int*)3L;
42      *int3 = 3;
43#endif // BX
44   }
45
46   inline void debugOutput(const char* _out)
47   {
48#if BX_PLATFORM_ANDROID
49      __android_log_write(ANDROID_LOG_DEBUG, "", _out);
50#elif BX_PLATFORM_WINDOWS || BX_PLATFORM_WINRT || BX_PLATFORM_XBOX360
51      OutputDebugStringA(_out);
52#elif BX_PLATFORM_IOS || BX_PLATFORM_OSX
53#   if defined(__OBJC__)
54      NSLog(@"%s", _out);
55#   else
56      NSLog(__CFStringMakeConstantString("%s"), _out);
57#   endif // defined(__OBJC__)
58#elif 0 // BX_PLATFORM_EMSCRIPTEN
59      emscripten_log(EM_LOG_CONSOLE, "%s", _out);
60#else
61      fputs(_out, stdout);
62      fflush(stdout);
63#endif // BX_PLATFORM_
64   }
65
66} // namespace bx
67
68#endif // BX_DEBUG_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/debug.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bx/cpu.h
r0r31734
1/*
2 * Copyright 2010-2013 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BX_CPU_H_HEADER_GUARD
7#define BX_CPU_H_HEADER_GUARD
8
9#include "bx.h"
10
11#if BX_COMPILER_MSVC
12#   if BX_PLATFORM_XBOX360
13#      include <ppcintrinsics.h>
14#      include <xtl.h>
15#   else
16#      include <math.h> // math.h is included because VS bitches:
17                   // warning C4985: 'ceil': attributes not present on previous declaration.
18                   // must be included before intrin.h.
19#      include <intrin.h>
20#      include <windows.h>
21#   endif // !BX_PLATFORM_XBOX360
22extern "C" void _ReadBarrier();
23extern "C" void _WriteBarrier();
24extern "C" void _ReadWriteBarrier();
25#   pragma intrinsic(_ReadBarrier)
26#   pragma intrinsic(_WriteBarrier)
27#   pragma intrinsic(_ReadWriteBarrier)
28#   pragma intrinsic(_InterlockedIncrement)
29#   pragma intrinsic(_InterlockedDecrement)
30#   pragma intrinsic(_InterlockedCompareExchange)
31#endif // BX_COMPILER_MSVC
32
33namespace bx
34{
35   ///
36   inline void readBarrier()
37   {
38#if BX_COMPILER_MSVC
39      _ReadBarrier();
40#else
41      asm volatile("":::"memory");
42#endif // BX_COMPILER
43   }
44
45   ///
46   inline void writeBarrier()
47   {
48#if BX_COMPILER_MSVC
49      _WriteBarrier();
50#else
51      asm volatile("":::"memory");
52#endif // BX_COMPILER
53   }
54
55   ///
56   inline void readWriteBarrier()
57   {
58#if BX_COMPILER_MSVC
59      _ReadWriteBarrier();
60#else
61      asm volatile("":::"memory");
62#endif // BX_COMPILER
63   }
64
65   ///
66   inline void memoryBarrier()
67   {
68#if BX_PLATFORM_XBOX360
69      __lwsync();
70#elif BX_PLATFORM_WINRT
71        MemoryBarrier();
72#elif BX_COMPILER_MSVC
73      _mm_mfence();
74#else
75      __sync_synchronize();
76//      asm volatile("mfence":::"memory");
77#endif // BX_COMPILER
78   }
79
80   ///
81   inline int32_t atomicInc(volatile void* _ptr)
82   {
83#if BX_COMPILER_MSVC
84      return _InterlockedIncrement( (volatile LONG*)(_ptr) );
85#else
86      return __sync_fetch_and_add( (volatile int32_t*)_ptr, 1);
87#endif // BX_COMPILER
88   }
89
90   ///
91   inline int32_t atomicDec(volatile void* _ptr)
92   {
93#if BX_COMPILER_MSVC
94      return _InterlockedDecrement( (volatile LONG*)(_ptr) );
95#else
96      return __sync_fetch_and_sub( (volatile int32_t*)_ptr, 1);
97#endif // BX_COMPILER
98   }
99
100   ///
101   inline int32_t atomicCompareAndSwap(volatile void* _ptr, int32_t _old, int32_t _new)
102   {
103#if BX_COMPILER_MSVC
104      return _InterlockedCompareExchange( (volatile LONG*)(_ptr), _new, _old);
105#else
106      return __sync_val_compare_and_swap( (volatile int32_t*)_ptr, _old, _new);
107#endif // BX_COMPILER
108   }
109
110   ///
111   inline void* atomicExchangePtr(void** _ptr, void* _new)
112   {
113#if BX_COMPILER_MSVC
114      return InterlockedExchangePointer(_ptr, _new); /* VS2012 no intrinsics */
115#else
116      return __sync_lock_test_and_set(_ptr, _new);
117#endif // BX_COMPILER
118   }
119
120   ///
121   inline int32_t atomicTestAndInc(volatile void* _ptr, int32_t _test)
122   {
123      int32_t oldVal;
124      int32_t newVal = *(int32_t volatile*)_ptr;
125      do
126      {
127         oldVal = newVal;
128         newVal = atomicCompareAndSwap(_ptr, oldVal, newVal >= _test ? _test : newVal+1);
129
130      } while (oldVal != newVal);
131
132      return oldVal;
133   }
134
135   ///
136   inline int32_t atomicTestAndDec(volatile void* _ptr, int32_t _test)
137   {
138      int32_t oldVal;
139      int32_t newVal = *(int32_t volatile*)_ptr;
140      do
141      {
142         oldVal = newVal;
143         newVal = atomicCompareAndSwap(_ptr, oldVal, newVal <= _test ? _test : newVal-1);
144
145      } while (oldVal != newVal);
146
147      return oldVal;
148   }
149
150} // namespace bx
151
152#endif // BX_CPU_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bx/cpu.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/lib.mak
r31733r31734
2828   $(LIBOBJ)/web \
2929   $(LIBOBJ)/web/json \
3030   $(LIBOBJ)/sqlite3 \
31   $(LIBOBJ)/bgfx \
3132
3233#-------------------------------------------------
3334# utility library objects
r31733r31734
557558$(LIBOBJ)/sqlite3/sqlite3.o: $(LIBSRC)/sqlite3/sqlite3.c | $(OSPREBUILD)
558559   @echo Compiling $<...
559560   $(CC) $(CDEFS) $(CONLYFLAGS) -Wno-bad-function-cast -I$(LIBSRC)/sqlite3 -c $< -o $@
561
562#-------------------------------------------------
563# BGFX library objects
564#-------------------------------------------------
565
566BGFXOBJS = \
567   $(LIBOBJ)/bgfx/bgfx.o \
568   $(LIBOBJ)/bgfx/glcontext_egl.o \
569   $(LIBOBJ)/bgfx/glcontext_glx.o \
570   $(LIBOBJ)/bgfx/glcontext_ppapi.o \
571   $(LIBOBJ)/bgfx/glcontext_wgl.o \
572   $(LIBOBJ)/bgfx/image.o \
573   $(LIBOBJ)/bgfx/renderer_d3d11.o \
574   $(LIBOBJ)/bgfx/renderer_d3d9.o \
575   $(LIBOBJ)/bgfx/renderer_gl.o \
576   $(LIBOBJ)/bgfx/renderer_null.o \
577   $(LIBOBJ)/bgfx/vertexdecl.o \
578
579$(OBJ)/libbgfx.a: $(BGFXOBJS)
580
581$(LIBOBJ)/bgfx/%.o: $(LIBSRC)/bgfx/%.cpp | $(OSPREBUILD)
582   @echo Compiling $<...
583   $(CC) $(CDEFS) $(CCOMFLAGS) -I$(LIBSRC) -I$(LIBSRC)/bgfx/include -I$(LIBSRC)/compat/mingw -I$(LIBSRC)/khronos -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -c $< -o $@
584
branches/osd/src/lib/compat/msvc/alloca.h
r0r31734
1#include <malloc.h>
Property changes on: branches/osd/src/lib/compat/msvc/alloca.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/msvc/inttypes.h
r0r31734
1// ISO C9x  compliant inttypes.h for Microsoft Visual Studio
2// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
3//
4//  Copyright (c) 2006-2013 Alexander Chemeris
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are met:
8//
9//   1. Redistributions of source code must retain the above copyright notice,
10//      this list of conditions and the following disclaimer.
11//
12//   2. Redistributions in binary form must reproduce the above copyright
13//      notice, this list of conditions and the following disclaimer in the
14//      documentation and/or other materials provided with the distribution.
15//
16//   3. Neither the name of the product nor the names of its contributors may
17//      be used to endorse or promote products derived from this software
18//      without specific prior written permission.
19//
20// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
21// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
23// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30//
31///////////////////////////////////////////////////////////////////////////////
32
33#ifndef _MSC_VER // [
34#error "Use this header only with Microsoft Visual C++ compilers!"
35#endif // _MSC_VER ]
36
37#ifndef _MSC_INTTYPES_H_ // [
38#define _MSC_INTTYPES_H_
39
40#if _MSC_VER > 1000
41#pragma once
42#endif
43
44#include "stdint.h"
45
46// 7.8 Format conversion of integer types
47
48typedef struct {
49   intmax_t quot;
50   intmax_t rem;
51} imaxdiv_t;
52
53// 7.8.1 Macros for format specifiers
54
55#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [   See footnote 185 at page 198
56
57// The fprintf macros for signed integers are:
58#define PRId8       "d"
59#define PRIi8       "i"
60#define PRIdLEAST8  "d"
61#define PRIiLEAST8  "i"
62#define PRIdFAST8   "d"
63#define PRIiFAST8   "i"
64
65#define PRId16       "hd"
66#define PRIi16       "hi"
67#define PRIdLEAST16  "hd"
68#define PRIiLEAST16  "hi"
69#define PRIdFAST16   "hd"
70#define PRIiFAST16   "hi"
71
72#define PRId32       "I32d"
73#define PRIi32       "I32i"
74#define PRIdLEAST32  "I32d"
75#define PRIiLEAST32  "I32i"
76#define PRIdFAST32   "I32d"
77#define PRIiFAST32   "I32i"
78
79#define PRId64       "I64d"
80#define PRIi64       "I64i"
81#define PRIdLEAST64  "I64d"
82#define PRIiLEAST64  "I64i"
83#define PRIdFAST64   "I64d"
84#define PRIiFAST64   "I64i"
85
86#define PRIdMAX     "I64d"
87#define PRIiMAX     "I64i"
88
89#define PRIdPTR     "Id"
90#define PRIiPTR     "Ii"
91
92// The fprintf macros for unsigned integers are:
93#define PRIo8       "o"
94#define PRIu8       "u"
95#define PRIx8       "x"
96#define PRIX8       "X"
97#define PRIoLEAST8  "o"
98#define PRIuLEAST8  "u"
99#define PRIxLEAST8  "x"
100#define PRIXLEAST8  "X"
101#define PRIoFAST8   "o"
102#define PRIuFAST8   "u"
103#define PRIxFAST8   "x"
104#define PRIXFAST8   "X"
105
106#define PRIo16       "ho"
107#define PRIu16       "hu"
108#define PRIx16       "hx"
109#define PRIX16       "hX"
110#define PRIoLEAST16  "ho"
111#define PRIuLEAST16  "hu"
112#define PRIxLEAST16  "hx"
113#define PRIXLEAST16  "hX"
114#define PRIoFAST16   "ho"
115#define PRIuFAST16   "hu"
116#define PRIxFAST16   "hx"
117#define PRIXFAST16   "hX"
118
119#define PRIo32       "I32o"
120#define PRIu32       "I32u"
121#define PRIx32       "I32x"
122#define PRIX32       "I32X"
123#define PRIoLEAST32  "I32o"
124#define PRIuLEAST32  "I32u"
125#define PRIxLEAST32  "I32x"
126#define PRIXLEAST32  "I32X"
127#define PRIoFAST32   "I32o"
128#define PRIuFAST32   "I32u"
129#define PRIxFAST32   "I32x"
130#define PRIXFAST32   "I32X"
131
132#define PRIo64       "I64o"
133#define PRIu64       "I64u"
134#define PRIx64       "I64x"
135#define PRIX64       "I64X"
136#define PRIoLEAST64  "I64o"
137#define PRIuLEAST64  "I64u"
138#define PRIxLEAST64  "I64x"
139#define PRIXLEAST64  "I64X"
140#define PRIoFAST64   "I64o"
141#define PRIuFAST64   "I64u"
142#define PRIxFAST64   "I64x"
143#define PRIXFAST64   "I64X"
144
145#define PRIoMAX     "I64o"
146#define PRIuMAX     "I64u"
147#define PRIxMAX     "I64x"
148#define PRIXMAX     "I64X"
149
150#define PRIoPTR     "Io"
151#define PRIuPTR     "Iu"
152#define PRIxPTR     "Ix"
153#define PRIXPTR     "IX"
154
155// The fscanf macros for signed integers are:
156#define SCNd8       "d"
157#define SCNi8       "i"
158#define SCNdLEAST8  "d"
159#define SCNiLEAST8  "i"
160#define SCNdFAST8   "d"
161#define SCNiFAST8   "i"
162
163#define SCNd16       "hd"
164#define SCNi16       "hi"
165#define SCNdLEAST16  "hd"
166#define SCNiLEAST16  "hi"
167#define SCNdFAST16   "hd"
168#define SCNiFAST16   "hi"
169
170#define SCNd32       "ld"
171#define SCNi32       "li"
172#define SCNdLEAST32  "ld"
173#define SCNiLEAST32  "li"
174#define SCNdFAST32   "ld"
175#define SCNiFAST32   "li"
176
177#define SCNd64       "I64d"
178#define SCNi64       "I64i"
179#define SCNdLEAST64  "I64d"
180#define SCNiLEAST64  "I64i"
181#define SCNdFAST64   "I64d"
182#define SCNiFAST64   "I64i"
183
184#define SCNdMAX     "I64d"
185#define SCNiMAX     "I64i"
186
187#ifdef _WIN64 // [
188#  define SCNdPTR     "I64d"
189#  define SCNiPTR     "I64i"
190#else  // _WIN64 ][
191#  define SCNdPTR     "ld"
192#  define SCNiPTR     "li"
193#endif  // _WIN64 ]
194
195// The fscanf macros for unsigned integers are:
196#define SCNo8       "o"
197#define SCNu8       "u"
198#define SCNx8       "x"
199#define SCNX8       "X"
200#define SCNoLEAST8  "o"
201#define SCNuLEAST8  "u"
202#define SCNxLEAST8  "x"
203#define SCNXLEAST8  "X"
204#define SCNoFAST8   "o"
205#define SCNuFAST8   "u"
206#define SCNxFAST8   "x"
207#define SCNXFAST8   "X"
208
209#define SCNo16       "ho"
210#define SCNu16       "hu"
211#define SCNx16       "hx"
212#define SCNX16       "hX"
213#define SCNoLEAST16  "ho"
214#define SCNuLEAST16  "hu"
215#define SCNxLEAST16  "hx"
216#define SCNXLEAST16  "hX"
217#define SCNoFAST16   "ho"
218#define SCNuFAST16   "hu"
219#define SCNxFAST16   "hx"
220#define SCNXFAST16   "hX"
221
222#define SCNo32       "lo"
223#define SCNu32       "lu"
224#define SCNx32       "lx"
225#define SCNX32       "lX"
226#define SCNoLEAST32  "lo"
227#define SCNuLEAST32  "lu"
228#define SCNxLEAST32  "lx"
229#define SCNXLEAST32  "lX"
230#define SCNoFAST32   "lo"
231#define SCNuFAST32   "lu"
232#define SCNxFAST32   "lx"
233#define SCNXFAST32   "lX"
234
235#define SCNo64       "I64o"
236#define SCNu64       "I64u"
237#define SCNx64       "I64x"
238#define SCNX64       "I64X"
239#define SCNoLEAST64  "I64o"
240#define SCNuLEAST64  "I64u"
241#define SCNxLEAST64  "I64x"
242#define SCNXLEAST64  "I64X"
243#define SCNoFAST64   "I64o"
244#define SCNuFAST64   "I64u"
245#define SCNxFAST64   "I64x"
246#define SCNXFAST64   "I64X"
247
248#define SCNoMAX     "I64o"
249#define SCNuMAX     "I64u"
250#define SCNxMAX     "I64x"
251#define SCNXMAX     "I64X"
252
253#ifdef _WIN64 // [
254#  define SCNoPTR     "I64o"
255#  define SCNuPTR     "I64u"
256#  define SCNxPTR     "I64x"
257#  define SCNXPTR     "I64X"
258#else  // _WIN64 ][
259#  define SCNoPTR     "lo"
260#  define SCNuPTR     "lu"
261#  define SCNxPTR     "lx"
262#  define SCNXPTR     "lX"
263#endif  // _WIN64 ]
264
265#endif // __STDC_FORMAT_MACROS ]
266
267// 7.8.2 Functions for greatest-width integer types
268
269// 7.8.2.1 The imaxabs function
270#define imaxabs _abs64
271
272// 7.8.2.2 The imaxdiv function
273
274// This is modified version of div() function from Microsoft's div.c found
275// in %MSVC.NET%\crt\src\div.c
276#ifdef STATIC_IMAXDIV // [
277static
278#else // STATIC_IMAXDIV ][
279_inline
280#endif // STATIC_IMAXDIV ]
281imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
282{
283   imaxdiv_t result;
284
285   result.quot = numer / denom;
286   result.rem = numer % denom;
287
288   if (numer < 0 && result.rem > 0) {
289      // did division wrong; must fix up
290      ++result.quot;
291      result.rem -= denom;
292   }
293
294   return result;
295}
296
297// 7.8.2.3 The strtoimax and strtoumax functions
298#define strtoimax _strtoi64
299#define strtoumax _strtoui64
300
301// 7.8.2.4 The wcstoimax and wcstoumax functions
302#define wcstoimax _wcstoi64
303#define wcstoumax _wcstoui64
304
305
306#endif // _MSC_INTTYPES_H_ ]
Property changes on: branches/osd/src/lib/compat/msvc/inttypes.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/msvc/stdbool.h
r0r31734
1/**************************************************************************
2 *
3 * Copyright 2007-2010 VMware, Inc.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20 * USE OR OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * The above copyright notice and this permission notice (including the
23 * next paragraph) shall be included in all copies or substantial portions
24 * of the Software.
25 *
26 **************************************************************************/
27
28#ifndef _STDBOOL_H_
29#define _STDBOOL_H_
30
31#ifndef __cplusplus
32
33#define false   0
34#define true    1
35#define bool    _Bool
36
37/* For compilers that don't have the builtin _Bool type. */
38#if ((defined(_MSC_VER) && _MSC_VER < 1800) || \
39    (defined __GNUC__&& __STDC_VERSION__ < 199901L && __GNUC__ < 3)) && !defined(_lint)
40typedef unsigned char _Bool;
41#endif
42
43#endif /* !__cplusplus */
44
45#define __bool_true_false_are_defined   1
46
47#endif /* !_STDBOOL_H_ */
Property changes on: branches/osd/src/lib/compat/msvc/stdbool.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/msvc/pre1600/stdint.h
r0r31734
1// ISO C9x  compliant stdint.h for Microsoft Visual Studio
2// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
3//
4//  Copyright (c) 2006-2013 Alexander Chemeris
5//
6// Redistribution and use in source and binary forms, with or without
7// modification, are permitted provided that the following conditions are met:
8//
9//   1. Redistributions of source code must retain the above copyright notice,
10//      this list of conditions and the following disclaimer.
11//
12//   2. Redistributions in binary form must reproduce the above copyright
13//      notice, this list of conditions and the following disclaimer in the
14//      documentation and/or other materials provided with the distribution.
15//
16//   3. Neither the name of the product nor the names of its contributors may
17//      be used to endorse or promote products derived from this software
18//      without specific prior written permission.
19//
20// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
21// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
23// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30//
31///////////////////////////////////////////////////////////////////////////////
32
33#ifndef _MSC_VER // [
34#error "Use this header only with Microsoft Visual C++ compilers!"
35#endif // _MSC_VER ]
36
37#ifndef _MSC_STDINT_H_ // [
38#define _MSC_STDINT_H_
39
40#if _MSC_VER > 1000
41#pragma once
42#endif
43
44#if _MSC_VER >= 1600 // [
45#include <stdint.h>
46#else // ] _MSC_VER >= 1600 [
47
48#include <limits.h>
49
50// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
51// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
52// or compiler give many errors like this:
53//   error C2733: second C linkage of overloaded function 'wmemchr' not allowed
54#ifdef __cplusplus
55extern "C" {
56#endif
57#  include <wchar.h>
58#ifdef __cplusplus
59}
60#endif
61
62// Define _W64 macros to mark types changing their size, like intptr_t.
63#ifndef _W64
64#  if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
65#     define _W64 __w64
66#  else
67#     define _W64
68#  endif
69#endif
70
71
72// 7.18.1 Integer types
73
74// 7.18.1.1 Exact-width integer types
75
76// Visual Studio 6 and Embedded Visual C++ 4 doesn't
77// realize that, e.g. char has the same size as __int8
78// so we give up on __intX for them.
79#if (_MSC_VER < 1300)
80   typedef signed char       int8_t;
81   typedef signed short      int16_t;
82   typedef signed int        int32_t;
83   typedef unsigned char     uint8_t;
84   typedef unsigned short    uint16_t;
85   typedef unsigned int      uint32_t;
86#else
87   typedef signed __int8     int8_t;
88   typedef signed __int16    int16_t;
89   typedef signed __int32    int32_t;
90   typedef unsigned __int8   uint8_t;
91   typedef unsigned __int16  uint16_t;
92   typedef unsigned __int32  uint32_t;
93#endif
94typedef signed __int64       int64_t;
95typedef unsigned __int64     uint64_t;
96
97
98// 7.18.1.2 Minimum-width integer types
99typedef int8_t    int_least8_t;
100typedef int16_t   int_least16_t;
101typedef int32_t   int_least32_t;
102typedef int64_t   int_least64_t;
103typedef uint8_t   uint_least8_t;
104typedef uint16_t  uint_least16_t;
105typedef uint32_t  uint_least32_t;
106typedef uint64_t  uint_least64_t;
107
108// 7.18.1.3 Fastest minimum-width integer types
109typedef int8_t    int_fast8_t;
110typedef int16_t   int_fast16_t;
111typedef int32_t   int_fast32_t;
112typedef int64_t   int_fast64_t;
113typedef uint8_t   uint_fast8_t;
114typedef uint16_t  uint_fast16_t;
115typedef uint32_t  uint_fast32_t;
116typedef uint64_t  uint_fast64_t;
117
118// 7.18.1.4 Integer types capable of holding object pointers
119#ifdef _WIN64 // [
120   typedef signed __int64    intptr_t;
121   typedef unsigned __int64  uintptr_t;
122#else // _WIN64 ][
123   typedef _W64 signed int   intptr_t;
124   typedef _W64 unsigned int uintptr_t;
125#endif // _WIN64 ]
126
127// 7.18.1.5 Greatest-width integer types
128typedef int64_t   intmax_t;
129typedef uint64_t  uintmax_t;
130
131
132// 7.18.2 Limits of specified-width integer types
133
134#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [   See footnote 220 at page 257 and footnote 221 at page 259
135
136// 7.18.2.1 Limits of exact-width integer types
137#define INT8_MIN     ((int8_t)_I8_MIN)
138#define INT8_MAX     _I8_MAX
139#define INT16_MIN    ((int16_t)_I16_MIN)
140#define INT16_MAX    _I16_MAX
141#define INT32_MIN    ((int32_t)_I32_MIN)
142#define INT32_MAX    _I32_MAX
143#define INT64_MIN    ((int64_t)_I64_MIN)
144#define INT64_MAX    _I64_MAX
145#define UINT8_MAX    _UI8_MAX
146#define UINT16_MAX   _UI16_MAX
147#define UINT32_MAX   _UI32_MAX
148#define UINT64_MAX   _UI64_MAX
149
150// 7.18.2.2 Limits of minimum-width integer types
151#define INT_LEAST8_MIN    INT8_MIN
152#define INT_LEAST8_MAX    INT8_MAX
153#define INT_LEAST16_MIN   INT16_MIN
154#define INT_LEAST16_MAX   INT16_MAX
155#define INT_LEAST32_MIN   INT32_MIN
156#define INT_LEAST32_MAX   INT32_MAX
157#define INT_LEAST64_MIN   INT64_MIN
158#define INT_LEAST64_MAX   INT64_MAX
159#define UINT_LEAST8_MAX   UINT8_MAX
160#define UINT_LEAST16_MAX  UINT16_MAX
161#define UINT_LEAST32_MAX  UINT32_MAX
162#define UINT_LEAST64_MAX  UINT64_MAX
163
164// 7.18.2.3 Limits of fastest minimum-width integer types
165#define INT_FAST8_MIN    INT8_MIN
166#define INT_FAST8_MAX    INT8_MAX
167#define INT_FAST16_MIN   INT16_MIN
168#define INT_FAST16_MAX   INT16_MAX
169#define INT_FAST32_MIN   INT32_MIN
170#define INT_FAST32_MAX   INT32_MAX
171#define INT_FAST64_MIN   INT64_MIN
172#define INT_FAST64_MAX   INT64_MAX
173#define UINT_FAST8_MAX   UINT8_MAX
174#define UINT_FAST16_MAX  UINT16_MAX
175#define UINT_FAST32_MAX  UINT32_MAX
176#define UINT_FAST64_MAX  UINT64_MAX
177
178// 7.18.2.4 Limits of integer types capable of holding object pointers
179#ifdef _WIN64 // [
180#  define INTPTR_MIN   INT64_MIN
181#  define INTPTR_MAX   INT64_MAX
182#  define UINTPTR_MAX  UINT64_MAX
183#else // _WIN64 ][
184#  define INTPTR_MIN   INT32_MIN
185#  define INTPTR_MAX   INT32_MAX
186#  define UINTPTR_MAX  UINT32_MAX
187#endif // _WIN64 ]
188
189// 7.18.2.5 Limits of greatest-width integer types
190#define INTMAX_MIN   INT64_MIN
191#define INTMAX_MAX   INT64_MAX
192#define UINTMAX_MAX  UINT64_MAX
193
194// 7.18.3 Limits of other integer types
195
196#ifdef _WIN64 // [
197#  define PTRDIFF_MIN  _I64_MIN
198#  define PTRDIFF_MAX  _I64_MAX
199#else  // _WIN64 ][
200#  define PTRDIFF_MIN  _I32_MIN
201#  define PTRDIFF_MAX  _I32_MAX
202#endif  // _WIN64 ]
203
204#define SIG_ATOMIC_MIN  INT_MIN
205#define SIG_ATOMIC_MAX  INT_MAX
206
207#ifndef SIZE_MAX // [
208#  ifdef _WIN64 // [
209#     define SIZE_MAX  _UI64_MAX
210#  else // _WIN64 ][
211#     define SIZE_MAX  _UI32_MAX
212#  endif // _WIN64 ]
213#endif // SIZE_MAX ]
214
215// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
216#ifndef WCHAR_MIN // [
217#  define WCHAR_MIN  0
218#endif  // WCHAR_MIN ]
219#ifndef WCHAR_MAX // [
220#  define WCHAR_MAX  _UI16_MAX
221#endif  // WCHAR_MAX ]
222
223#define WINT_MIN  0
224#define WINT_MAX  _UI16_MAX
225
226#endif // __STDC_LIMIT_MACROS ]
227
228
229// 7.18.4 Limits of other integer types
230
231#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260
232
233// 7.18.4.1 Macros for minimum-width integer constants
234
235#define INT8_C(val)  val##i8
236#define INT16_C(val) val##i16
237#define INT32_C(val) val##i32
238#define INT64_C(val) val##i64
239
240#define UINT8_C(val)  val##ui8
241#define UINT16_C(val) val##ui16
242#define UINT32_C(val) val##ui32
243#define UINT64_C(val) val##ui64
244
245// 7.18.4.2 Macros for greatest-width integer constants
246// These #ifndef's are needed to prevent collisions with <boost/cstdint.hpp>.
247// Check out Issue 9 for the details.
248#ifndef INTMAX_C //   [
249#  define INTMAX_C   INT64_C
250#endif // INTMAX_C    ]
251#ifndef UINTMAX_C //  [
252#  define UINTMAX_C  UINT64_C
253#endif // UINTMAX_C   ]
254
255#endif // __STDC_CONSTANT_MACROS ]
256
257#endif // _MSC_VER >= 1600 ]
258
259#endif // _MSC_STDINT_H_ ]
Property changes on: branches/osd/src/lib/compat/msvc/pre1600/stdint.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/osx/malloc.h
r0r31734
1#include <malloc/malloc.h>
2#include <alloca.h>
Property changes on: branches/osd/src/lib/compat/osx/malloc.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/freebsd/malloc.h
r0r31734
1#include <stdlib.h>
Property changes on: branches/osd/src/lib/compat/freebsd/malloc.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/freebsd/alloca.h
r0r31734
1#include <stdlib.h>
Property changes on: branches/osd/src/lib/compat/freebsd/alloca.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/ios/malloc.h
r0r31734
1#include <malloc/malloc.h>
Property changes on: branches/osd/src/lib/compat/ios/malloc.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/nacl/memory.h
r0r31734
1#include <string.h>
Property changes on: branches/osd/src/lib/compat/nacl/memory.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/mingw/alloca.h
r0r31734
1#ifndef MINGW32_ALLOCA_H_HEADER_GUARD
2#define MINGW32_ALLOCA_H_HEADER_GUARD
3
4#include <malloc.h>
5
6#endif // MINGW32_ALLOCA_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/compat/mingw/alloca.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/mingw/specstrings_strict.h
r0r31734
1#define __reserved
Property changes on: branches/osd/src/lib/compat/mingw/specstrings_strict.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/mingw/sal.h
r0r31734
1#pragma once
2
3#if __GNUC__ >=3
4#pragma GCC system_header
5#endif
6
7//#define __null // << Conflicts with GCC internal type __null
8#define __notnull
9#define __maybenull
10#define __readonly
11#define __notreadonly
12#define __maybereadonly
13#define __valid
14#define __notvalid
15#define __maybevalid
16#define __readableTo(extent)
17#define __elem_readableTo(size)
18#define __byte_readableTo(size)
19#define __writableTo(size)
20#define __elem_writableTo(size)
21#define __byte_writableTo(size)
22#define __deref
23#define __pre
24#define __post
25#define __precond(expr)
26#define __postcond(expr)
27#define __exceptthat
28#define __execeptthat
29#define __inner_success(expr)
30#define __inner_checkReturn
31#define __inner_typefix(ctype)
32#define __inner_override
33#define __inner_callback
34#define __inner_blocksOn(resource)
35#define __inner_fallthrough_dec
36#define __inner_fallthrough
37#define __refparam
38#define __inner_control_entrypoint(category)
39#define __inner_data_entrypoint(category)
40
41#define __ecount(size)
42#define __bcount(size)
43#define __in
44#define __in_ecount(size)
45#define __in_bcount(size)
46#define __in_z
47#define __in_ecount_z(size)
48#define __in_bcount_z(size)
49#define __in_nz
50#define __in_ecount_nz(size)
51#define __in_bcount_nz(size)
52#define __in_xcount_opt(size)
53#define __out
54#define __out_ecount(size)
55#define __out_bcount(size)
56#define __out_ecount_part(size,length)
57#define __out_bcount_part(size,length)
58#define __out_ecount_full(size)
59#define __out_bcount_full(size)
60#define __out_z
61#define __out_z_opt
62#define __out_ecount_z(size)
63#define __out_bcount_z(size)
64#define __out_ecount_part_z(size,length)
65#define __out_bcount_part_z(size,length)
66#define __out_ecount_full_z(size)
67#define __out_bcount_full_z(size)
68#define __out_nz
69#define __out_nz_opt
70#define __out_ecount_nz(size)
71#define __out_bcount_nz(size)
72#define __inout
73#define __inout_ecount(size)
74#define __inout_bcount(size)
75#define __inout_ecount_part(size,length)
76#define __inout_bcount_part(size,length)
77#define __inout_ecount_full(size)
78#define __inout_bcount_full(size)
79#define __inout_z
80#define __inout_ecount_z(size)
81#define __inout_bcount_z(size)
82#define __inout_nz
83#define __inout_ecount_nz(size)
84#define __inout_bcount_nz(size)
85#define __ecount_opt(size)
86#define __bcount_opt(size)
87#define __in_opt
88#define __in_ecount_opt(size)
89#define __in_bcount_opt(size)
90#define __in_z_opt
91#define __in_ecount_z_opt(size)
92#define __in_bcount_z_opt(size)
93#define __in_nz_opt
94#define __in_ecount_nz_opt(size)
95#define __in_bcount_nz_opt(size)
96#define __out_opt
97#define __out_ecount_opt(size)
98#define __out_bcount_opt(size)
99#define __out_ecount_part_opt(size,length)
100#define __out_bcount_part_opt(size,length)
101#define __out_ecount_full_opt(size)
102#define __out_bcount_full_opt(size)
103#define __out_ecount_z_opt(size)
104#define __out_bcount_z_opt(size)
105#define __out_ecount_part_z_opt(size,length)
106#define __out_bcount_part_z_opt(size,length)
107#define __out_ecount_full_z_opt(size)
108#define __out_bcount_full_z_opt(size)
109#define __out_ecount_nz_opt(size)
110#define __out_bcount_nz_opt(size)
111#define __inout_opt
112#define __inout_ecount_opt(size)
113#define __inout_bcount_opt(size)
114#define __inout_ecount_part_opt(size,length)
115#define __inout_bcount_part_opt(size,length)
116#define __inout_ecount_full_opt(size)
117#define __inout_bcount_full_opt(size)
118#define __inout_z_opt
119#define __inout_ecount_z_opt(size)
120#define __inout_ecount_z_opt(size)
121#define __inout_bcount_z_opt(size)
122#define __inout_nz_opt
123#define __inout_ecount_nz_opt(size)
124#define __inout_bcount_nz_opt(size)
125#define __deref_ecount(size)
126#define __deref_bcount(size)
127#define __deref_out
128#define __deref_out_ecount(size)
129#define __deref_out_bcount(size)
130#define __deref_out_ecount_part(size,length)
131#define __deref_out_bcount_part(size,length)
132#define __deref_out_ecount_full(size)
133#define __deref_out_bcount_full(size)
134#define __deref_out_z
135#define __deref_out_ecount_z(size)
136#define __deref_out_bcount_z(size)
137#define __deref_out_nz
138#define __deref_out_ecount_nz(size)
139#define __deref_out_bcount_nz(size)
140#define __deref_inout
141#define __deref_inout_z
142#define __deref_inout_ecount(size)
143#define __deref_inout_bcount(size)
144#define __deref_inout_ecount_part(size,length)
145#define __deref_inout_bcount_part(size,length)
146#define __deref_inout_ecount_full(size)
147#define __deref_inout_bcount_full(size)
148#define __deref_inout_z
149#define __deref_inout_ecount_z(size)
150#define __deref_inout_bcount_z(size)
151#define __deref_inout_nz
152#define __deref_inout_ecount_nz(size)
153#define __deref_inout_bcount_nz(size)
154#define __deref_ecount_opt(size)
155#define __deref_bcount_opt(size)
156#define __deref_out_opt
157#define __deref_out_ecount_opt(size)
158#define __deref_out_bcount_opt(size)
159#define __deref_out_ecount_part_opt(size,length)
160#define __deref_out_bcount_part_opt(size,length)
161#define __deref_out_ecount_full_opt(size)
162#define __deref_out_bcount_full_opt(size)
163#define __deref_out_z_opt
164#define __deref_out_ecount_z_opt(size)
165#define __deref_out_bcount_z_opt(size)
166#define __deref_out_nz_opt
167#define __deref_out_ecount_nz_opt(size)
168#define __deref_out_bcount_nz_opt(size)
169#define __deref_inout_opt
170#define __deref_inout_ecount_opt(size)
171#define __deref_inout_bcount_opt(size)
172#define __deref_inout_ecount_part_opt(size,length)
173#define __deref_inout_bcount_part_opt(size,length)
174#define __deref_inout_ecount_full_opt(size)
175#define __deref_inout_bcount_full_opt(size)
176#define __deref_inout_z_opt
177#define __deref_inout_ecount_z_opt(size)
178#define __deref_inout_bcount_z_opt(size)
179#define __deref_inout_nz_opt
180#define __deref_inout_ecount_nz_opt(size)
181#define __deref_inout_bcount_nz_opt(size)
182#define __deref_opt_ecount(size)
183#define __deref_opt_bcount(size)
184#define __deref_opt_out
185#define __deref_opt_out_z
186#define __deref_opt_out_ecount(size)
187#define __deref_opt_out_bcount(size)
188#define __deref_opt_out_ecount_part(size,length)
189#define __deref_opt_out_bcount_part(size,length)
190#define __deref_opt_out_ecount_full(size)
191#define __deref_opt_out_bcount_full(size)
192#define __deref_opt_inout
193#define __deref_opt_inout_ecount(size)
194#define __deref_opt_inout_bcount(size)
195#define __deref_opt_inout_ecount_part(size,length)
196#define __deref_opt_inout_bcount_part(size,length)
197#define __deref_opt_inout_ecount_full(size)
198#define __deref_opt_inout_bcount_full(size)
199#define __deref_opt_inout_z
200#define __deref_opt_inout_ecount_z(size)
201#define __deref_opt_inout_bcount_z(size)
202#define __deref_opt_inout_nz
203#define __deref_opt_inout_ecount_nz(size)
204#define __deref_opt_inout_bcount_nz(size)
205#define __deref_opt_ecount_opt(size)
206#define __deref_opt_bcount_opt(size)
207#define __deref_opt_out_opt
208#define __deref_opt_out_ecount_opt(size)
209#define __deref_opt_out_bcount_opt(size)
210#define __deref_opt_out_ecount_part_opt(size,length)
211#define __deref_opt_out_bcount_part_opt(size,length)
212#define __deref_opt_out_ecount_full_opt(size)
213#define __deref_opt_out_bcount_full_opt(size)
214#define __deref_opt_out_z_opt
215#define __deref_opt_out_ecount_z_opt(size)
216#define __deref_opt_out_bcount_z_opt(size)
217#define __deref_opt_out_nz_opt
218#define __deref_opt_out_ecount_nz_opt(size)
219#define __deref_opt_out_bcount_nz_opt(size)
220#define __deref_opt_inout_opt
221#define __deref_opt_inout_ecount_opt(size)
222#define __deref_opt_inout_bcount_opt(size)
223#define __deref_opt_inout_ecount_part_opt(size,length)
224#define __deref_opt_inout_bcount_part_opt(size,length)
225#define __deref_opt_inout_ecount_full_opt(size)
226#define __deref_opt_inout_bcount_full_opt(size)
227#define __deref_opt_inout_z_opt
228#define __deref_opt_inout_ecount_z_opt(size)
229#define __deref_opt_inout_bcount_z_opt(size)
230#define __deref_opt_inout_nz_opt
231#define __deref_opt_inout_ecount_nz_opt(size)
232#define __deref_opt_inout_bcount_nz_opt(size)
233
234#define __success(expr)
235#define __nullterminated
236#define __nullnullterminated
237#define __reserved
238#define __checkReturn
239#define __typefix(ctype)
240#define __override
241#define __callback
242#define __format_string
243#define __blocksOn(resource)
244#define __control_entrypoint(category)
245#define __data_entrypoint(category)
246
247#ifndef __fallthrough
248    #define __fallthrough __inner_fallthrough
249#endif
250
251#ifndef __analysis_assume
252    #define __analysis_assume(expr)
253#endif
Property changes on: branches/osd/src/lib/compat/mingw/sal.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/mingw/dxsdk.patch
r0r31734
1diff -p Include.orig/d3d9.h Include/d3d9.h
2*** Include.orig/d3d9.h   2010-05-19 15:36:57.570669600 -0700
3--- Include/d3d9.h   2013-04-07 13:52:57.504138700 -0700
4*************** typedef struct IDirect3DQuery9 *LPDIRECT
5*** 2022,2029 ****
6 
7 
8  /*********************
9! /* D3D9Ex interfaces
10! /*********************/
11 
12  HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex**);
13 
14--- 2022,2029 ----
15 
16 
17  /*********************
18!  * D3D9Ex interfaces
19!  *********************/
20 
21  HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex**);
22 
23diff -p Include.orig/d3d9types.h Include/d3d9types.h
24*** Include.orig/d3d9types.h   2010-05-19 15:36:57.601870200 -0700
25--- Include/d3d9types.h   2013-04-07 13:52:17.746590200 -0700
26***************
27*** 19,24 ****
28--- 19,25 ----
29 
30  #include <float.h>
31 
32+ #ifdef _MSC_VER
33  #if _MSC_VER >= 1200
34  #pragma warning(push)
35  #endif
36***************
37*** 26,31 ****
38--- 27,33 ----
39  #if defined(_X86_) || defined(_IA64_)
40  #pragma pack(4)
41  #endif
42+ #endif // _MSC_VER
43 
44  // D3DCOLOR is equivalent to D3DFMT_A8R8G8B8
45  #ifndef D3DCOLOR_DEFINED
46*************** typedef struct _D3DAES_CTR_IV
47*** 2404,2415 ****
48--- 2406,2419 ----
49  #endif // !D3D_DISABLE_9EX
50  /* -- D3D9Ex only */
51 
52+ #ifdef _MSC_VER
53  #pragma pack()
54  #if _MSC_VER >= 1200
55  #pragma warning(pop)
56  #else
57  #pragma warning(default:4201)
58  #endif
59+ #endif // _MSC_VER
60 
61  #endif /* (DIRECT3D_VERSION >= 0x0900) */
62  #endif /* _d3d9TYPES(P)_H_ */
63diff -p Include.orig/D3Dcommon.h Include/D3Dcommon.h
64*** Include.orig/D3Dcommon.h   2010-05-19 15:36:57.664271400 -0700
65--- Include/D3Dcommon.h   2013-04-07 23:35:07.133638400 -0700
66***************
67*** 6,12 ****
68--- 6,14 ----
69   /* File created by MIDL compiler version 7.00.0555 */
70  /* @@MIDL_FILE_HEADING(  ) */
71 
72+ #ifdef _MSC_VER
73  #pragma warning( disable: 4049 )  /* more than 64k source lines */
74+ #endif // _MSC_VER
75 
76 
77  /* verify that the <rpcndr.h> version is high enough to compile this file*/
78diff -p Include.orig/d3dx9core.h Include/d3dx9core.h
79*** Include.orig/d3dx9core.h   2010-05-19 15:36:57.820274400 -0700
80--- Include/d3dx9core.h   2013-04-07 23:34:00.976237500 -0700
81*************** HRESULT WINAPI
82*** 665,681 ****
83  //     TRUE  = OpenGL line emulation on.
84  //     FALSE = OpenGL line emulation off.
85  //
86- // OpenGL line:     Regular line: 
87- //   *\                *\
88- //   | \              /  \
89- //   |  \            *\   \
90- //   *\  \             \   \
91- //     \  \             \   \
92- //      \  *             \   *
93- //       \ |              \ /
94- //        \|               *
95- //         *
96- //
97  // OnLostDevice, OnResetDevice -
98  //    Call OnLostDevice() on this object before calling Reset() on the
99  //    device, so that this object can release any stateblocks and video
100--- 665,670 ----
101diff -p Include.orig/d3dx9math.h Include/d3dx9math.h
102*** Include.orig/d3dx9math.h   2010-05-19 15:36:57.835874700 -0700
103--- Include/d3dx9math.h   2013-04-07 23:31:38.685168800 -0700
104***************
105*** 12,22 ****
106--- 12,24 ----
107  #ifndef __D3DX9MATH_H__
108  #define __D3DX9MATH_H__
109 
110+ #ifdef _MSC_VER
111  #include <math.h>
112  #if _MSC_VER >= 1200
113  #pragma warning(push)
114  #endif
115  #pragma warning(disable:4201) // anonymous unions warning
116+ #endif // _MSC_VER
117 
118 
119 
120*************** HRESULT WINAPI D3DXSHProjectCubeMap
121*** 1786,1796 ****
122--- 1788,1800 ----
123 
124  #include "d3dx9math.inl"
125 
126+ #ifdef _MSC_VER
127  #if _MSC_VER >= 1200
128  #pragma warning(pop)
129  #else
130  #pragma warning(default:4201)
131  #endif
132+ #endif // _MSC_VER
133 
134  #endif // __D3DX9MATH_H__
135 
Property changes on: branches/osd/src/lib/compat/mingw/dxsdk.patch
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/compat/mingw/specstrings_undef.h
r0r31734
1#undef __reserved
2
Property changes on: branches/osd/src/lib/compat/mingw/specstrings_undef.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/glx/glxext.h
r0r31734
1#ifndef __glxext_h_
2#define __glxext_h_ 1
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/*
9** Copyright (c) 2013 The Khronos Group Inc.
10**
11** Permission is hereby granted, free of charge, to any person obtaining a
12** copy of this software and/or associated documentation files (the
13** "Materials"), to deal in the Materials without restriction, including
14** without limitation the rights to use, copy, modify, merge, publish,
15** distribute, sublicense, and/or sell copies of the Materials, and to
16** permit persons to whom the Materials are furnished to do so, subject to
17** the following conditions:
18**
19** The above copyright notice and this permission notice shall be included
20** in all copies or substantial portions of the Materials.
21**
22** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
29*/
30/*
31** This header is generated from the Khronos OpenGL / OpenGL ES XML
32** API Registry. The current version of the Registry, generator scripts
33** used to make the header, and the header can be found at
34**   http://www.opengl.org/registry/
35**
36** Khronos $Revision: 23730 $ on $Date: 2013-10-28 15:16:34 -0700 (Mon, 28 Oct 2013) $
37*/
38
39#define GLX_GLXEXT_VERSION 20131028
40
41/* Generated C header for:
42 * API: glx
43 * Versions considered: .*
44 * Versions emitted: 1\.[3-9]
45 * Default extensions included: glx
46 * Additional extensions included: _nomatch_^
47 * Extensions removed: _nomatch_^
48 */
49
50#ifndef GLX_VERSION_1_3
51#define GLX_VERSION_1_3 1
52typedef struct __GLXFBConfigRec *GLXFBConfig;
53typedef XID GLXWindow;
54typedef XID GLXPbuffer;
55#define GLX_WINDOW_BIT                    0x00000001
56#define GLX_PIXMAP_BIT                    0x00000002
57#define GLX_PBUFFER_BIT                   0x00000004
58#define GLX_RGBA_BIT                      0x00000001
59#define GLX_COLOR_INDEX_BIT               0x00000002
60#define GLX_PBUFFER_CLOBBER_MASK          0x08000000
61#define GLX_FRONT_LEFT_BUFFER_BIT         0x00000001
62#define GLX_FRONT_RIGHT_BUFFER_BIT        0x00000002
63#define GLX_BACK_LEFT_BUFFER_BIT          0x00000004
64#define GLX_BACK_RIGHT_BUFFER_BIT         0x00000008
65#define GLX_AUX_BUFFERS_BIT               0x00000010
66#define GLX_DEPTH_BUFFER_BIT              0x00000020
67#define GLX_STENCIL_BUFFER_BIT            0x00000040
68#define GLX_ACCUM_BUFFER_BIT              0x00000080
69#define GLX_CONFIG_CAVEAT                 0x20
70#define GLX_X_VISUAL_TYPE                 0x22
71#define GLX_TRANSPARENT_TYPE              0x23
72#define GLX_TRANSPARENT_INDEX_VALUE       0x24
73#define GLX_TRANSPARENT_RED_VALUE         0x25
74#define GLX_TRANSPARENT_GREEN_VALUE       0x26
75#define GLX_TRANSPARENT_BLUE_VALUE        0x27
76#define GLX_TRANSPARENT_ALPHA_VALUE       0x28
77#define GLX_DONT_CARE                     0xFFFFFFFF
78#define GLX_NONE                          0x8000
79#define GLX_SLOW_CONFIG                   0x8001
80#define GLX_TRUE_COLOR                    0x8002
81#define GLX_DIRECT_COLOR                  0x8003
82#define GLX_PSEUDO_COLOR                  0x8004
83#define GLX_STATIC_COLOR                  0x8005
84#define GLX_GRAY_SCALE                    0x8006
85#define GLX_STATIC_GRAY                   0x8007
86#define GLX_TRANSPARENT_RGB               0x8008
87#define GLX_TRANSPARENT_INDEX             0x8009
88#define GLX_VISUAL_ID                     0x800B
89#define GLX_SCREEN                        0x800C
90#define GLX_NON_CONFORMANT_CONFIG         0x800D
91#define GLX_DRAWABLE_TYPE                 0x8010
92#define GLX_RENDER_TYPE                   0x8011
93#define GLX_X_RENDERABLE                  0x8012
94#define GLX_FBCONFIG_ID                   0x8013
95#define GLX_RGBA_TYPE                     0x8014
96#define GLX_COLOR_INDEX_TYPE              0x8015
97#define GLX_MAX_PBUFFER_WIDTH             0x8016
98#define GLX_MAX_PBUFFER_HEIGHT            0x8017
99#define GLX_MAX_PBUFFER_PIXELS            0x8018
100#define GLX_PRESERVED_CONTENTS            0x801B
101#define GLX_LARGEST_PBUFFER               0x801C
102#define GLX_WIDTH                         0x801D
103#define GLX_HEIGHT                        0x801E
104#define GLX_EVENT_MASK                    0x801F
105#define GLX_DAMAGED                       0x8020
106#define GLX_SAVED                         0x8021
107#define GLX_WINDOW                        0x8022
108#define GLX_PBUFFER                       0x8023
109#define GLX_PBUFFER_HEIGHT                0x8040
110#define GLX_PBUFFER_WIDTH                 0x8041
111typedef GLXFBConfig *( *PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
112typedef GLXFBConfig *( *PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
113typedef int ( *PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
114typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
115typedef GLXWindow ( *PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
116typedef void ( *PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
117typedef GLXPixmap ( *PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
118typedef void ( *PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
119typedef GLXPbuffer ( *PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
120typedef void ( *PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
121typedef void ( *PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
122typedef GLXContext ( *PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
123typedef Bool ( *PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
124typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
125typedef int ( *PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
126typedef void ( *PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
127typedef void ( *PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
128#ifdef GLX_GLXEXT_PROTOTYPES
129GLXFBConfig *glXGetFBConfigs (Display *dpy, int screen, int *nelements);
130GLXFBConfig *glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements);
131int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value);
132XVisualInfo *glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config);
133GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
134void glXDestroyWindow (Display *dpy, GLXWindow win);
135GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
136void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap);
137GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list);
138void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf);
139void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
140GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
141Bool glXMakeContextCurrent (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
142GLXDrawable glXGetCurrentReadDrawable (void);
143int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value);
144void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask);
145void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
146#endif
147#endif /* GLX_VERSION_1_3 */
148
149#ifndef GLX_VERSION_1_4
150#define GLX_VERSION_1_4 1
151typedef void ( *__GLXextFuncPtr)(void);
152#define GLX_SAMPLE_BUFFERS                100000
153#define GLX_SAMPLES                       100001
154typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
155#ifdef GLX_GLXEXT_PROTOTYPES
156__GLXextFuncPtr glXGetProcAddress (const GLubyte *procName);
157#endif
158#endif /* GLX_VERSION_1_4 */
159
160#ifndef GLX_ARB_create_context
161#define GLX_ARB_create_context 1
162#define GLX_CONTEXT_DEBUG_BIT_ARB         0x00000001
163#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
164#define GLX_CONTEXT_MAJOR_VERSION_ARB     0x2091
165#define GLX_CONTEXT_MINOR_VERSION_ARB     0x2092
166#define GLX_CONTEXT_FLAGS_ARB             0x2094
167typedef GLXContext ( *PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
168#ifdef GLX_GLXEXT_PROTOTYPES
169GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
170#endif
171#endif /* GLX_ARB_create_context */
172
173#ifndef GLX_ARB_create_context_profile
174#define GLX_ARB_create_context_profile 1
175#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB  0x00000001
176#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
177#define GLX_CONTEXT_PROFILE_MASK_ARB      0x9126
178#endif /* GLX_ARB_create_context_profile */
179
180#ifndef GLX_ARB_create_context_robustness
181#define GLX_ARB_create_context_robustness 1
182#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
183#define GLX_LOSE_CONTEXT_ON_RESET_ARB     0x8252
184#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
185#define GLX_NO_RESET_NOTIFICATION_ARB     0x8261
186#endif /* GLX_ARB_create_context_robustness */
187
188#ifndef GLX_ARB_fbconfig_float
189#define GLX_ARB_fbconfig_float 1
190#define GLX_RGBA_FLOAT_TYPE_ARB           0x20B9
191#define GLX_RGBA_FLOAT_BIT_ARB            0x00000004
192#endif /* GLX_ARB_fbconfig_float */
193
194#ifndef GLX_ARB_framebuffer_sRGB
195#define GLX_ARB_framebuffer_sRGB 1
196#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB  0x20B2
197#endif /* GLX_ARB_framebuffer_sRGB */
198
199#ifndef GLX_ARB_get_proc_address
200#define GLX_ARB_get_proc_address 1
201typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
202#ifdef GLX_GLXEXT_PROTOTYPES
203__GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
204#endif
205#endif /* GLX_ARB_get_proc_address */
206
207#ifndef GLX_ARB_multisample
208#define GLX_ARB_multisample 1
209#define GLX_SAMPLE_BUFFERS_ARB            100000
210#define GLX_SAMPLES_ARB                   100001
211#endif /* GLX_ARB_multisample */
212
213#ifndef GLX_ARB_robustness_application_isolation
214#define GLX_ARB_robustness_application_isolation 1
215#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
216#endif /* GLX_ARB_robustness_application_isolation */
217
218#ifndef GLX_ARB_robustness_share_group_isolation
219#define GLX_ARB_robustness_share_group_isolation 1
220#endif /* GLX_ARB_robustness_share_group_isolation */
221
222#ifndef GLX_ARB_vertex_buffer_object
223#define GLX_ARB_vertex_buffer_object 1
224#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095
225#endif /* GLX_ARB_vertex_buffer_object */
226
227#ifndef GLX_3DFX_multisample
228#define GLX_3DFX_multisample 1
229#define GLX_SAMPLE_BUFFERS_3DFX           0x8050
230#define GLX_SAMPLES_3DFX                  0x8051
231#endif /* GLX_3DFX_multisample */
232
233#ifndef GLX_AMD_gpu_association
234#define GLX_AMD_gpu_association 1
235#define GLX_GPU_VENDOR_AMD                0x1F00
236#define GLX_GPU_RENDERER_STRING_AMD       0x1F01
237#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
238#define GLX_GPU_FASTEST_TARGET_GPUS_AMD   0x21A2
239#define GLX_GPU_RAM_AMD                   0x21A3
240#define GLX_GPU_CLOCK_AMD                 0x21A4
241#define GLX_GPU_NUM_PIPES_AMD             0x21A5
242#define GLX_GPU_NUM_SIMD_AMD              0x21A6
243#define GLX_GPU_NUM_RB_AMD                0x21A7
244#define GLX_GPU_NUM_SPI_AMD               0x21A8
245#endif /* GLX_AMD_gpu_association */
246
247#ifndef GLX_EXT_buffer_age
248#define GLX_EXT_buffer_age 1
249#define GLX_BACK_BUFFER_AGE_EXT           0x20F4
250#endif /* GLX_EXT_buffer_age */
251
252#ifndef GLX_EXT_create_context_es2_profile
253#define GLX_EXT_create_context_es2_profile 1
254#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT   0x00000004
255#endif /* GLX_EXT_create_context_es2_profile */
256
257#ifndef GLX_EXT_create_context_es_profile
258#define GLX_EXT_create_context_es_profile 1
259#define GLX_CONTEXT_ES_PROFILE_BIT_EXT    0x00000004
260#endif /* GLX_EXT_create_context_es_profile */
261
262#ifndef GLX_EXT_fbconfig_packed_float
263#define GLX_EXT_fbconfig_packed_float 1
264#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT  0x20B1
265#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT   0x00000008
266#endif /* GLX_EXT_fbconfig_packed_float */
267
268#ifndef GLX_EXT_framebuffer_sRGB
269#define GLX_EXT_framebuffer_sRGB 1
270#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT  0x20B2
271#endif /* GLX_EXT_framebuffer_sRGB */
272
273#ifndef GLX_EXT_import_context
274#define GLX_EXT_import_context 1
275typedef XID GLXContextID;
276#define GLX_SHARE_CONTEXT_EXT             0x800A
277#define GLX_VISUAL_ID_EXT                 0x800B
278#define GLX_SCREEN_EXT                    0x800C
279typedef Display *( *PFNGLXGETCURRENTDISPLAYEXTPROC) (void);
280typedef int ( *PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value);
281typedef GLXContextID ( *PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);
282typedef GLXContext ( *PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID);
283typedef void ( *PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context);
284#ifdef GLX_GLXEXT_PROTOTYPES
285Display *glXGetCurrentDisplayEXT (void);
286int glXQueryContextInfoEXT (Display *dpy, GLXContext context, int attribute, int *value);
287GLXContextID glXGetContextIDEXT (const GLXContext context);
288GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID);
289void glXFreeContextEXT (Display *dpy, GLXContext context);
290#endif
291#endif /* GLX_EXT_import_context */
292
293#ifndef GLX_EXT_swap_control
294#define GLX_EXT_swap_control 1
295#define GLX_SWAP_INTERVAL_EXT             0x20F1
296#define GLX_MAX_SWAP_INTERVAL_EXT         0x20F2
297typedef void ( *PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval);
298#ifdef GLX_GLXEXT_PROTOTYPES
299void glXSwapIntervalEXT (Display *dpy, GLXDrawable drawable, int interval);
300#endif
301#endif /* GLX_EXT_swap_control */
302
303#ifndef GLX_EXT_swap_control_tear
304#define GLX_EXT_swap_control_tear 1
305#define GLX_LATE_SWAPS_TEAR_EXT           0x20F3
306#endif /* GLX_EXT_swap_control_tear */
307
308#ifndef GLX_EXT_texture_from_pixmap
309#define GLX_EXT_texture_from_pixmap 1
310#define GLX_TEXTURE_1D_BIT_EXT            0x00000001
311#define GLX_TEXTURE_2D_BIT_EXT            0x00000002
312#define GLX_TEXTURE_RECTANGLE_BIT_EXT     0x00000004
313#define GLX_BIND_TO_TEXTURE_RGB_EXT       0x20D0
314#define GLX_BIND_TO_TEXTURE_RGBA_EXT      0x20D1
315#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT    0x20D2
316#define GLX_BIND_TO_TEXTURE_TARGETS_EXT   0x20D3
317#define GLX_Y_INVERTED_EXT                0x20D4
318#define GLX_TEXTURE_FORMAT_EXT            0x20D5
319#define GLX_TEXTURE_TARGET_EXT            0x20D6
320#define GLX_MIPMAP_TEXTURE_EXT            0x20D7
321#define GLX_TEXTURE_FORMAT_NONE_EXT       0x20D8
322#define GLX_TEXTURE_FORMAT_RGB_EXT        0x20D9
323#define GLX_TEXTURE_FORMAT_RGBA_EXT       0x20DA
324#define GLX_TEXTURE_1D_EXT                0x20DB
325#define GLX_TEXTURE_2D_EXT                0x20DC
326#define GLX_TEXTURE_RECTANGLE_EXT         0x20DD
327#define GLX_FRONT_LEFT_EXT                0x20DE
328#define GLX_FRONT_RIGHT_EXT               0x20DF
329#define GLX_BACK_LEFT_EXT                 0x20E0
330#define GLX_BACK_RIGHT_EXT                0x20E1
331#define GLX_FRONT_EXT                     0x20DE
332#define GLX_BACK_EXT                      0x20E0
333#define GLX_AUX0_EXT                      0x20E2
334#define GLX_AUX1_EXT                      0x20E3
335#define GLX_AUX2_EXT                      0x20E4
336#define GLX_AUX3_EXT                      0x20E5
337#define GLX_AUX4_EXT                      0x20E6
338#define GLX_AUX5_EXT                      0x20E7
339#define GLX_AUX6_EXT                      0x20E8
340#define GLX_AUX7_EXT                      0x20E9
341#define GLX_AUX8_EXT                      0x20EA
342#define GLX_AUX9_EXT                      0x20EB
343typedef void ( *PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
344typedef void ( *PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer);
345#ifdef GLX_GLXEXT_PROTOTYPES
346void glXBindTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
347void glXReleaseTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer);
348#endif
349#endif /* GLX_EXT_texture_from_pixmap */
350
351#ifndef GLX_EXT_visual_info
352#define GLX_EXT_visual_info 1
353#define GLX_X_VISUAL_TYPE_EXT             0x22
354#define GLX_TRANSPARENT_TYPE_EXT          0x23
355#define GLX_TRANSPARENT_INDEX_VALUE_EXT   0x24
356#define GLX_TRANSPARENT_RED_VALUE_EXT     0x25
357#define GLX_TRANSPARENT_GREEN_VALUE_EXT   0x26
358#define GLX_TRANSPARENT_BLUE_VALUE_EXT    0x27
359#define GLX_TRANSPARENT_ALPHA_VALUE_EXT   0x28
360#define GLX_NONE_EXT                      0x8000
361#define GLX_TRUE_COLOR_EXT                0x8002
362#define GLX_DIRECT_COLOR_EXT              0x8003
363#define GLX_PSEUDO_COLOR_EXT              0x8004
364#define GLX_STATIC_COLOR_EXT              0x8005
365#define GLX_GRAY_SCALE_EXT                0x8006
366#define GLX_STATIC_GRAY_EXT               0x8007
367#define GLX_TRANSPARENT_RGB_EXT           0x8008
368#define GLX_TRANSPARENT_INDEX_EXT         0x8009
369#endif /* GLX_EXT_visual_info */
370
371#ifndef GLX_EXT_visual_rating
372#define GLX_EXT_visual_rating 1
373#define GLX_VISUAL_CAVEAT_EXT             0x20
374#define GLX_SLOW_VISUAL_EXT               0x8001
375#define GLX_NON_CONFORMANT_VISUAL_EXT     0x800D
376#endif /* GLX_EXT_visual_rating */
377
378#ifndef GLX_INTEL_swap_event
379#define GLX_INTEL_swap_event 1
380#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000
381#define GLX_EXCHANGE_COMPLETE_INTEL       0x8180
382#define GLX_COPY_COMPLETE_INTEL           0x8181
383#define GLX_FLIP_COMPLETE_INTEL           0x8182
384#endif /* GLX_INTEL_swap_event */
385
386#ifndef GLX_MESA_agp_offset
387#define GLX_MESA_agp_offset 1
388typedef unsigned int ( *PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer);
389#ifdef GLX_GLXEXT_PROTOTYPES
390unsigned int glXGetAGPOffsetMESA (const void *pointer);
391#endif
392#endif /* GLX_MESA_agp_offset */
393
394#ifndef GLX_MESA_copy_sub_buffer
395#define GLX_MESA_copy_sub_buffer 1
396typedef void ( *PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
397#ifdef GLX_GLXEXT_PROTOTYPES
398void glXCopySubBufferMESA (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
399#endif
400#endif /* GLX_MESA_copy_sub_buffer */
401
402#ifndef GLX_MESA_pixmap_colormap
403#define GLX_MESA_pixmap_colormap 1
404typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
405#ifdef GLX_GLXEXT_PROTOTYPES
406GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
407#endif
408#endif /* GLX_MESA_pixmap_colormap */
409
410#ifndef GLX_MESA_release_buffers
411#define GLX_MESA_release_buffers 1
412typedef Bool ( *PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable);
413#ifdef GLX_GLXEXT_PROTOTYPES
414Bool glXReleaseBuffersMESA (Display *dpy, GLXDrawable drawable);
415#endif
416#endif /* GLX_MESA_release_buffers */
417
418#ifndef GLX_MESA_set_3dfx_mode
419#define GLX_MESA_set_3dfx_mode 1
420#define GLX_3DFX_WINDOW_MODE_MESA         0x1
421#define GLX_3DFX_FULLSCREEN_MODE_MESA     0x2
422typedef Bool ( *PFNGLXSET3DFXMODEMESAPROC) (int mode);
423#ifdef GLX_GLXEXT_PROTOTYPES
424Bool glXSet3DfxModeMESA (int mode);
425#endif
426#endif /* GLX_MESA_set_3dfx_mode */
427
428#ifndef GLX_NV_copy_image
429#define GLX_NV_copy_image 1
430typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
431#ifdef GLX_GLXEXT_PROTOTYPES
432void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
433#endif
434#endif /* GLX_NV_copy_image */
435
436#ifndef GLX_NV_float_buffer
437#define GLX_NV_float_buffer 1
438#define GLX_FLOAT_COMPONENTS_NV           0x20B0
439#endif /* GLX_NV_float_buffer */
440
441#ifndef GLX_NV_multisample_coverage
442#define GLX_NV_multisample_coverage 1
443#define GLX_COVERAGE_SAMPLES_NV           100001
444#define GLX_COLOR_SAMPLES_NV              0x20B3
445#endif /* GLX_NV_multisample_coverage */
446
447#ifndef GLX_NV_present_video
448#define GLX_NV_present_video 1
449#define GLX_NUM_VIDEO_SLOTS_NV            0x20F0
450typedef unsigned int *( *PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);
451typedef int ( *PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
452#ifdef GLX_GLXEXT_PROTOTYPES
453unsigned int *glXEnumerateVideoDevicesNV (Display *dpy, int screen, int *nelements);
454int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
455#endif
456#endif /* GLX_NV_present_video */
457
458#ifndef GLX_NV_swap_group
459#define GLX_NV_swap_group 1
460typedef Bool ( *PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);
461typedef Bool ( *PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier);
462typedef Bool ( *PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
463typedef Bool ( *PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
464typedef Bool ( *PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen, GLuint *count);
465typedef Bool ( *PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen);
466#ifdef GLX_GLXEXT_PROTOTYPES
467Bool glXJoinSwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint group);
468Bool glXBindSwapBarrierNV (Display *dpy, GLuint group, GLuint barrier);
469Bool glXQuerySwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
470Bool glXQueryMaxSwapGroupsNV (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
471Bool glXQueryFrameCountNV (Display *dpy, int screen, GLuint *count);
472Bool glXResetFrameCountNV (Display *dpy, int screen);
473#endif
474#endif /* GLX_NV_swap_group */
475
476#ifndef GLX_NV_video_capture
477#define GLX_NV_video_capture 1
478typedef XID GLXVideoCaptureDeviceNV;
479#define GLX_DEVICE_ID_NV                  0x20CD
480#define GLX_UNIQUE_ID_NV                  0x20CE
481#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV    0x20CF
482typedef int ( *PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
483typedef GLXVideoCaptureDeviceNV *( *PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements);
484typedef void ( *PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
485typedef int ( *PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
486typedef void ( *PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
487#ifdef GLX_GLXEXT_PROTOTYPES
488int glXBindVideoCaptureDeviceNV (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
489GLXVideoCaptureDeviceNV *glXEnumerateVideoCaptureDevicesNV (Display *dpy, int screen, int *nelements);
490void glXLockVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
491int glXQueryVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
492void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
493#endif
494#endif /* GLX_NV_video_capture */
495
496#ifndef GLX_NV_video_output
497#define GLX_NV_video_output 1
498typedef unsigned int GLXVideoDeviceNV;
499#define GLX_VIDEO_OUT_COLOR_NV            0x20C3
500#define GLX_VIDEO_OUT_ALPHA_NV            0x20C4
501#define GLX_VIDEO_OUT_DEPTH_NV            0x20C5
502#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV  0x20C6
503#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV  0x20C7
504#define GLX_VIDEO_OUT_FRAME_NV            0x20C8
505#define GLX_VIDEO_OUT_FIELD_1_NV          0x20C9
506#define GLX_VIDEO_OUT_FIELD_2_NV          0x20CA
507#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB
508#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC
509typedef int ( *PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
510typedef int ( *PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
511typedef int ( *PFNGLXBINDVIDEOIMAGENVPROC) (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
512typedef int ( *PFNGLXRELEASEVIDEOIMAGENVPROC) (Display *dpy, GLXPbuffer pbuf);
513typedef int ( *PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
514typedef int ( *PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
515#ifdef GLX_GLXEXT_PROTOTYPES
516int glXGetVideoDeviceNV (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
517int glXReleaseVideoDeviceNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
518int glXBindVideoImageNV (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
519int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf);
520int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
521int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
522#endif
523#endif /* GLX_NV_video_output */
524
525#ifndef GLX_OML_swap_method
526#define GLX_OML_swap_method 1
527#define GLX_SWAP_METHOD_OML               0x8060
528#define GLX_SWAP_EXCHANGE_OML             0x8061
529#define GLX_SWAP_COPY_OML                 0x8062
530#define GLX_SWAP_UNDEFINED_OML            0x8063
531#endif /* GLX_OML_swap_method */
532
533#ifndef GLX_OML_sync_control
534#define GLX_OML_sync_control 1
535#ifndef GLEXT_64_TYPES_DEFINED
536/* This code block is duplicated in glext.h, so must be protected */
537#define GLEXT_64_TYPES_DEFINED
538/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
539/* (as used in the GLX_OML_sync_control extension). */
540#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
541#include <inttypes.h>
542#elif defined(__sun__) || defined(__digital__)
543#include <inttypes.h>
544#if defined(__STDC__)
545#if defined(__arch64__) || defined(_LP64)
546typedef long int int64_t;
547typedef unsigned long int uint64_t;
548#else
549typedef long long int int64_t;
550typedef unsigned long long int uint64_t;
551#endif /* __arch64__ */
552#endif /* __STDC__ */
553#elif defined( __VMS ) || defined(__sgi)
554#include <inttypes.h>
555#elif defined(__SCO__) || defined(__USLC__)
556#include <stdint.h>
557#elif defined(__UNIXOS2__) || defined(__SOL64__)
558typedef long int int32_t;
559typedef long long int int64_t;
560typedef unsigned long long int uint64_t;
561#elif defined(_WIN32) && defined(__GNUC__)
562#include <stdint.h>
563#elif defined(_WIN32)
564typedef __int32 int32_t;
565typedef __int64 int64_t;
566typedef unsigned __int64 uint64_t;
567#else
568/* Fallback if nothing above works */
569#include <inttypes.h>
570#endif
571#endif
572typedef Bool ( *PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
573typedef Bool ( *PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
574typedef int64_t ( *PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
575typedef Bool ( *PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
576typedef Bool ( *PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
577#ifdef GLX_GLXEXT_PROTOTYPES
578Bool glXGetSyncValuesOML (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
579Bool glXGetMscRateOML (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
580int64_t glXSwapBuffersMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
581Bool glXWaitForMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
582Bool glXWaitForSbcOML (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
583#endif
584#endif /* GLX_OML_sync_control */
585
586#ifndef GLX_SGIS_blended_overlay
587#define GLX_SGIS_blended_overlay 1
588#define GLX_BLENDED_RGBA_SGIS             0x8025
589#endif /* GLX_SGIS_blended_overlay */
590
591#ifndef GLX_SGIS_multisample
592#define GLX_SGIS_multisample 1
593#define GLX_SAMPLE_BUFFERS_SGIS           100000
594#define GLX_SAMPLES_SGIS                  100001
595#endif /* GLX_SGIS_multisample */
596
597#ifndef GLX_SGIS_shared_multisample
598#define GLX_SGIS_shared_multisample 1
599#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026
600#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027
601#endif /* GLX_SGIS_shared_multisample */
602
603#ifndef GLX_SGIX_dmbuffer
604#define GLX_SGIX_dmbuffer 1
605typedef XID GLXPbufferSGIX;
606#ifdef _DM_BUFFER_H_
607#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX    0x8024
608typedef Bool ( *PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
609#ifdef GLX_GLXEXT_PROTOTYPES
610Bool glXAssociateDMPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
611#endif
612#endif /* _DM_BUFFER_H_ */
613#endif /* GLX_SGIX_dmbuffer */
614
615#ifndef GLX_SGIX_fbconfig
616#define GLX_SGIX_fbconfig 1
617typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
618#define GLX_WINDOW_BIT_SGIX               0x00000001
619#define GLX_PIXMAP_BIT_SGIX               0x00000002
620#define GLX_RGBA_BIT_SGIX                 0x00000001
621#define GLX_COLOR_INDEX_BIT_SGIX          0x00000002
622#define GLX_DRAWABLE_TYPE_SGIX            0x8010
623#define GLX_RENDER_TYPE_SGIX              0x8011
624#define GLX_X_RENDERABLE_SGIX             0x8012
625#define GLX_FBCONFIG_ID_SGIX              0x8013
626#define GLX_RGBA_TYPE_SGIX                0x8014
627#define GLX_COLOR_INDEX_TYPE_SGIX         0x8015
628typedef int ( *PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
629typedef GLXFBConfigSGIX *( *PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements);
630typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
631typedef GLXContext ( *PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
632typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config);
633typedef GLXFBConfigSGIX ( *PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis);
634#ifdef GLX_GLXEXT_PROTOTYPES
635int glXGetFBConfigAttribSGIX (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
636GLXFBConfigSGIX *glXChooseFBConfigSGIX (Display *dpy, int screen, int *attrib_list, int *nelements);
637GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
638GLXContext glXCreateContextWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
639XVisualInfo *glXGetVisualFromFBConfigSGIX (Display *dpy, GLXFBConfigSGIX config);
640GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *dpy, XVisualInfo *vis);
641#endif
642#endif /* GLX_SGIX_fbconfig */
643
644#ifndef GLX_SGIX_hyperpipe
645#define GLX_SGIX_hyperpipe 1
646typedef struct {
647    char    pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
648    int     networkId;
649} GLXHyperpipeNetworkSGIX;
650typedef struct {
651    char    pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
652    int     channel;
653    unsigned int participationType;
654    int     timeSlice;
655} GLXHyperpipeConfigSGIX;
656typedef struct {
657    char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
658    int srcXOrigin, srcYOrigin, srcWidth, srcHeight;
659    int destXOrigin, destYOrigin, destWidth, destHeight;
660} GLXPipeRect;
661typedef struct {
662    char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
663    int XOrigin, YOrigin, maxHeight, maxWidth;
664} GLXPipeRectLimits;
665#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80
666#define GLX_BAD_HYPERPIPE_CONFIG_SGIX     91
667#define GLX_BAD_HYPERPIPE_SGIX            92
668#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX   0x00000001
669#define GLX_HYPERPIPE_RENDER_PIPE_SGIX    0x00000002
670#define GLX_PIPE_RECT_SGIX                0x00000001
671#define GLX_PIPE_RECT_LIMITS_SGIX         0x00000002
672#define GLX_HYPERPIPE_STEREO_SGIX         0x00000003
673#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX  0x00000004
674#define GLX_HYPERPIPE_ID_SGIX             0x8030
675typedef GLXHyperpipeNetworkSGIX *( *PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);
676typedef int ( *PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
677typedef GLXHyperpipeConfigSGIX *( *PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes);
678typedef int ( *PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId);
679typedef int ( *PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId);
680typedef int ( *PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
681typedef int ( *PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
682typedef int ( *PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
683#ifdef GLX_GLXEXT_PROTOTYPES
684GLXHyperpipeNetworkSGIX *glXQueryHyperpipeNetworkSGIX (Display *dpy, int *npipes);
685int glXHyperpipeConfigSGIX (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
686GLXHyperpipeConfigSGIX *glXQueryHyperpipeConfigSGIX (Display *dpy, int hpId, int *npipes);
687int glXDestroyHyperpipeConfigSGIX (Display *dpy, int hpId);
688int glXBindHyperpipeSGIX (Display *dpy, int hpId);
689int glXQueryHyperpipeBestAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
690int glXHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
691int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
692#endif
693#endif /* GLX_SGIX_hyperpipe */
694
695#ifndef GLX_SGIX_pbuffer
696#define GLX_SGIX_pbuffer 1
697#define GLX_PBUFFER_BIT_SGIX              0x00000004
698#define GLX_BUFFER_CLOBBER_MASK_SGIX      0x08000000
699#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX    0x00000001
700#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX   0x00000002
701#define GLX_BACK_LEFT_BUFFER_BIT_SGIX     0x00000004
702#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX    0x00000008
703#define GLX_AUX_BUFFERS_BIT_SGIX          0x00000010
704#define GLX_DEPTH_BUFFER_BIT_SGIX         0x00000020
705#define GLX_STENCIL_BUFFER_BIT_SGIX       0x00000040
706#define GLX_ACCUM_BUFFER_BIT_SGIX         0x00000080
707#define GLX_SAMPLE_BUFFERS_BIT_SGIX       0x00000100
708#define GLX_MAX_PBUFFER_WIDTH_SGIX        0x8016
709#define GLX_MAX_PBUFFER_HEIGHT_SGIX       0x8017
710#define GLX_MAX_PBUFFER_PIXELS_SGIX       0x8018
711#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX    0x8019
712#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX   0x801A
713#define GLX_PRESERVED_CONTENTS_SGIX       0x801B
714#define GLX_LARGEST_PBUFFER_SGIX          0x801C
715#define GLX_WIDTH_SGIX                    0x801D
716#define GLX_HEIGHT_SGIX                   0x801E
717#define GLX_EVENT_MASK_SGIX               0x801F
718#define GLX_DAMAGED_SGIX                  0x8020
719#define GLX_SAVED_SGIX                    0x8021
720#define GLX_WINDOW_SGIX                   0x8022
721#define GLX_PBUFFER_SGIX                  0x8023
722typedef GLXPbufferSGIX ( *PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
723typedef void ( *PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf);
724typedef int ( *PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
725typedef void ( *PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask);
726typedef void ( *PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask);
727#ifdef GLX_GLXEXT_PROTOTYPES
728GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
729void glXDestroyGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf);
730int glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
731void glXSelectEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long mask);
732void glXGetSelectedEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long *mask);
733#endif
734#endif /* GLX_SGIX_pbuffer */
735
736#ifndef GLX_SGIX_swap_barrier
737#define GLX_SGIX_swap_barrier 1
738typedef void ( *PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);
739typedef Bool ( *PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);
740#ifdef GLX_GLXEXT_PROTOTYPES
741void glXBindSwapBarrierSGIX (Display *dpy, GLXDrawable drawable, int barrier);
742Bool glXQueryMaxSwapBarriersSGIX (Display *dpy, int screen, int *max);
743#endif
744#endif /* GLX_SGIX_swap_barrier */
745
746#ifndef GLX_SGIX_swap_group
747#define GLX_SGIX_swap_group 1
748typedef void ( *PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);
749#ifdef GLX_GLXEXT_PROTOTYPES
750void glXJoinSwapGroupSGIX (Display *dpy, GLXDrawable drawable, GLXDrawable member);
751#endif
752#endif /* GLX_SGIX_swap_group */
753
754#ifndef GLX_SGIX_video_resize
755#define GLX_SGIX_video_resize 1
756#define GLX_SYNC_FRAME_SGIX               0x00000000
757#define GLX_SYNC_SWAP_SGIX                0x00000001
758typedef int ( *PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window);
759typedef int ( *PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h);
760typedef int ( *PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
761typedef int ( *PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
762typedef int ( *PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype);
763#ifdef GLX_GLXEXT_PROTOTYPES
764int glXBindChannelToWindowSGIX (Display *display, int screen, int channel, Window window);
765int glXChannelRectSGIX (Display *display, int screen, int channel, int x, int y, int w, int h);
766int glXQueryChannelRectSGIX (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
767int glXQueryChannelDeltasSGIX (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
768int glXChannelRectSyncSGIX (Display *display, int screen, int channel, GLenum synctype);
769#endif
770#endif /* GLX_SGIX_video_resize */
771
772#ifndef GLX_SGIX_video_source
773#define GLX_SGIX_video_source 1
774typedef XID GLXVideoSourceSGIX;
775#ifdef _VL_H
776typedef GLXVideoSourceSGIX ( *PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
777typedef void ( *PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource);
778#ifdef GLX_GLXEXT_PROTOTYPES
779GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
780void glXDestroyGLXVideoSourceSGIX (Display *dpy, GLXVideoSourceSGIX glxvideosource);
781#endif
782#endif /* _VL_H */
783#endif /* GLX_SGIX_video_source */
784
785#ifndef GLX_SGIX_visual_select_group
786#define GLX_SGIX_visual_select_group 1
787#define GLX_VISUAL_SELECT_GROUP_SGIX      0x8028
788#endif /* GLX_SGIX_visual_select_group */
789
790#ifndef GLX_SGI_cushion
791#define GLX_SGI_cushion 1
792typedef void ( *PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion);
793#ifdef GLX_GLXEXT_PROTOTYPES
794void glXCushionSGI (Display *dpy, Window window, float cushion);
795#endif
796#endif /* GLX_SGI_cushion */
797
798#ifndef GLX_SGI_make_current_read
799#define GLX_SGI_make_current_read 1
800typedef Bool ( *PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
801typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);
802#ifdef GLX_GLXEXT_PROTOTYPES
803Bool glXMakeCurrentReadSGI (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
804GLXDrawable glXGetCurrentReadDrawableSGI (void);
805#endif
806#endif /* GLX_SGI_make_current_read */
807
808#ifndef GLX_SGI_swap_control
809#define GLX_SGI_swap_control 1
810typedef int ( *PFNGLXSWAPINTERVALSGIPROC) (int interval);
811#ifdef GLX_GLXEXT_PROTOTYPES
812int glXSwapIntervalSGI (int interval);
813#endif
814#endif /* GLX_SGI_swap_control */
815
816#ifndef GLX_SGI_video_sync
817#define GLX_SGI_video_sync 1
818typedef int ( *PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count);
819typedef int ( *PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count);
820#ifdef GLX_GLXEXT_PROTOTYPES
821int glXGetVideoSyncSGI (unsigned int *count);
822int glXWaitVideoSyncSGI (int divisor, int remainder, unsigned int *count);
823#endif
824#endif /* GLX_SGI_video_sync */
825
826#ifndef GLX_SUN_get_transparent_index
827#define GLX_SUN_get_transparent_index 1
828typedef Status ( *PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
829#ifdef GLX_GLXEXT_PROTOTYPES
830Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
831#endif
832#endif /* GLX_SUN_get_transparent_index */
833
834#ifdef __cplusplus
835}
836#endif
837
838#endif
Property changes on: branches/osd/src/lib/khronos/glx/glxext.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/GLES2/gl2.h
r0r31734
1#ifndef __gl2_h_
2#define __gl2_h_ 1
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/*
9** Copyright (c) 2013-2014 The Khronos Group Inc.
10**
11** Permission is hereby granted, free of charge, to any person obtaining a
12** copy of this software and/or associated documentation files (the
13** "Materials"), to deal in the Materials without restriction, including
14** without limitation the rights to use, copy, modify, merge, publish,
15** distribute, sublicense, and/or sell copies of the Materials, and to
16** permit persons to whom the Materials are furnished to do so, subject to
17** the following conditions:
18**
19** The above copyright notice and this permission notice shall be included
20** in all copies or substantial portions of the Materials.
21**
22** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
29*/
30/*
31** This header is generated from the Khronos OpenGL / OpenGL ES XML
32** API Registry. The current version of the Registry, generator scripts
33** used to make the header, and the header can be found at
34**   http://www.opengl.org/registry/
35**
36** Khronos $Revision: 26006 $ on $Date: 2014-03-19 01:26:15 -0700 (Wed, 19 Mar 2014) $
37*/
38
39#include <GLES2/gl2platform.h>
40
41/* Generated on date 20140319 */
42
43/* Generated C header for:
44 * API: gles2
45 * Profile: common
46 * Versions considered: 2\.[0-9]
47 * Versions emitted: .*
48 * Default extensions included: None
49 * Additional extensions included: _nomatch_^
50 * Extensions removed: _nomatch_^
51 */
52
53#ifndef GL_ES_VERSION_2_0
54#define GL_ES_VERSION_2_0 1
55#include <KHR/khrplatform.h>
56typedef khronos_int8_t GLbyte;
57typedef khronos_float_t GLclampf;
58typedef khronos_int32_t GLfixed;
59typedef short GLshort;
60typedef unsigned short GLushort;
61typedef void GLvoid;
62typedef struct __GLsync *GLsync;
63typedef khronos_int64_t GLint64;
64typedef khronos_uint64_t GLuint64;
65typedef unsigned int GLenum;
66typedef unsigned int GLuint;
67typedef char GLchar;
68typedef khronos_float_t GLfloat;
69typedef khronos_ssize_t GLsizeiptr;
70typedef khronos_intptr_t GLintptr;
71typedef unsigned int GLbitfield;
72typedef int GLint;
73typedef unsigned char GLboolean;
74typedef int GLsizei;
75typedef khronos_uint8_t GLubyte;
76#define GL_DEPTH_BUFFER_BIT               0x00000100
77#define GL_STENCIL_BUFFER_BIT             0x00000400
78#define GL_COLOR_BUFFER_BIT               0x00004000
79#define GL_FALSE                          0
80#define GL_TRUE                           1
81#define GL_POINTS                         0x0000
82#define GL_LINES                          0x0001
83#define GL_LINE_LOOP                      0x0002
84#define GL_LINE_STRIP                     0x0003
85#define GL_TRIANGLES                      0x0004
86#define GL_TRIANGLE_STRIP                 0x0005
87#define GL_TRIANGLE_FAN                   0x0006
88#define GL_ZERO                           0
89#define GL_ONE                            1
90#define GL_SRC_COLOR                      0x0300
91#define GL_ONE_MINUS_SRC_COLOR            0x0301
92#define GL_SRC_ALPHA                      0x0302
93#define GL_ONE_MINUS_SRC_ALPHA            0x0303
94#define GL_DST_ALPHA                      0x0304
95#define GL_ONE_MINUS_DST_ALPHA            0x0305
96#define GL_DST_COLOR                      0x0306
97#define GL_ONE_MINUS_DST_COLOR            0x0307
98#define GL_SRC_ALPHA_SATURATE             0x0308
99#define GL_FUNC_ADD                       0x8006
100#define GL_BLEND_EQUATION                 0x8009
101#define GL_BLEND_EQUATION_RGB             0x8009
102#define GL_BLEND_EQUATION_ALPHA           0x883D
103#define GL_FUNC_SUBTRACT                  0x800A
104#define GL_FUNC_REVERSE_SUBTRACT          0x800B
105#define GL_BLEND_DST_RGB                  0x80C8
106#define GL_BLEND_SRC_RGB                  0x80C9
107#define GL_BLEND_DST_ALPHA                0x80CA
108#define GL_BLEND_SRC_ALPHA                0x80CB
109#define GL_CONSTANT_COLOR                 0x8001
110#define GL_ONE_MINUS_CONSTANT_COLOR       0x8002
111#define GL_CONSTANT_ALPHA                 0x8003
112#define GL_ONE_MINUS_CONSTANT_ALPHA       0x8004
113#define GL_BLEND_COLOR                    0x8005
114#define GL_ARRAY_BUFFER                   0x8892
115#define GL_ELEMENT_ARRAY_BUFFER           0x8893
116#define GL_ARRAY_BUFFER_BINDING           0x8894
117#define GL_ELEMENT_ARRAY_BUFFER_BINDING   0x8895
118#define GL_STREAM_DRAW                    0x88E0
119#define GL_STATIC_DRAW                    0x88E4
120#define GL_DYNAMIC_DRAW                   0x88E8
121#define GL_BUFFER_SIZE                    0x8764
122#define GL_BUFFER_USAGE                   0x8765
123#define GL_CURRENT_VERTEX_ATTRIB          0x8626
124#define GL_FRONT                          0x0404
125#define GL_BACK                           0x0405
126#define GL_FRONT_AND_BACK                 0x0408
127#define GL_TEXTURE_2D                     0x0DE1
128#define GL_CULL_FACE                      0x0B44
129#define GL_BLEND                          0x0BE2
130#define GL_DITHER                         0x0BD0
131#define GL_STENCIL_TEST                   0x0B90
132#define GL_DEPTH_TEST                     0x0B71
133#define GL_SCISSOR_TEST                   0x0C11
134#define GL_POLYGON_OFFSET_FILL            0x8037
135#define GL_SAMPLE_ALPHA_TO_COVERAGE       0x809E
136#define GL_SAMPLE_COVERAGE                0x80A0
137#define GL_NO_ERROR                       0
138#define GL_INVALID_ENUM                   0x0500
139#define GL_INVALID_VALUE                  0x0501
140#define GL_INVALID_OPERATION              0x0502
141#define GL_OUT_OF_MEMORY                  0x0505
142#define GL_CW                             0x0900
143#define GL_CCW                            0x0901
144#define GL_LINE_WIDTH                     0x0B21
145#define GL_ALIASED_POINT_SIZE_RANGE       0x846D
146#define GL_ALIASED_LINE_WIDTH_RANGE       0x846E
147#define GL_CULL_FACE_MODE                 0x0B45
148#define GL_FRONT_FACE                     0x0B46
149#define GL_DEPTH_RANGE                    0x0B70
150#define GL_DEPTH_WRITEMASK                0x0B72
151#define GL_DEPTH_CLEAR_VALUE              0x0B73
152#define GL_DEPTH_FUNC                     0x0B74
153#define GL_STENCIL_CLEAR_VALUE            0x0B91
154#define GL_STENCIL_FUNC                   0x0B92
155#define GL_STENCIL_FAIL                   0x0B94
156#define GL_STENCIL_PASS_DEPTH_FAIL        0x0B95
157#define GL_STENCIL_PASS_DEPTH_PASS        0x0B96
158#define GL_STENCIL_REF                    0x0B97
159#define GL_STENCIL_VALUE_MASK             0x0B93
160#define GL_STENCIL_WRITEMASK              0x0B98
161#define GL_STENCIL_BACK_FUNC              0x8800
162#define GL_STENCIL_BACK_FAIL              0x8801
163#define GL_STENCIL_BACK_PASS_DEPTH_FAIL   0x8802
164#define GL_STENCIL_BACK_PASS_DEPTH_PASS   0x8803
165#define GL_STENCIL_BACK_REF               0x8CA3
166#define GL_STENCIL_BACK_VALUE_MASK        0x8CA4
167#define GL_STENCIL_BACK_WRITEMASK         0x8CA5
168#define GL_VIEWPORT                       0x0BA2
169#define GL_SCISSOR_BOX                    0x0C10
170#define GL_COLOR_CLEAR_VALUE              0x0C22
171#define GL_COLOR_WRITEMASK                0x0C23
172#define GL_UNPACK_ALIGNMENT               0x0CF5
173#define GL_PACK_ALIGNMENT                 0x0D05
174#define GL_MAX_TEXTURE_SIZE               0x0D33
175#define GL_MAX_VIEWPORT_DIMS              0x0D3A
176#define GL_SUBPIXEL_BITS                  0x0D50
177#define GL_RED_BITS                       0x0D52
178#define GL_GREEN_BITS                     0x0D53
179#define GL_BLUE_BITS                      0x0D54
180#define GL_ALPHA_BITS                     0x0D55
181#define GL_DEPTH_BITS                     0x0D56
182#define GL_STENCIL_BITS                   0x0D57
183#define GL_POLYGON_OFFSET_UNITS           0x2A00
184#define GL_POLYGON_OFFSET_FACTOR          0x8038
185#define GL_TEXTURE_BINDING_2D             0x8069
186#define GL_SAMPLE_BUFFERS                 0x80A8
187#define GL_SAMPLES                        0x80A9
188#define GL_SAMPLE_COVERAGE_VALUE          0x80AA
189#define GL_SAMPLE_COVERAGE_INVERT         0x80AB
190#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
191#define GL_COMPRESSED_TEXTURE_FORMATS     0x86A3
192#define GL_DONT_CARE                      0x1100
193#define GL_FASTEST                        0x1101
194#define GL_NICEST                         0x1102
195#define GL_GENERATE_MIPMAP_HINT           0x8192
196#define GL_BYTE                           0x1400
197#define GL_UNSIGNED_BYTE                  0x1401
198#define GL_SHORT                          0x1402
199#define GL_UNSIGNED_SHORT                 0x1403
200#define GL_INT                            0x1404
201#define GL_UNSIGNED_INT                   0x1405
202#define GL_FLOAT                          0x1406
203#define GL_FIXED                          0x140C
204#define GL_DEPTH_COMPONENT                0x1902
205#define GL_ALPHA                          0x1906
206#define GL_RGB                            0x1907
207#define GL_RGBA                           0x1908
208#define GL_LUMINANCE                      0x1909
209#define GL_LUMINANCE_ALPHA                0x190A
210#define GL_UNSIGNED_SHORT_4_4_4_4         0x8033
211#define GL_UNSIGNED_SHORT_5_5_5_1         0x8034
212#define GL_UNSIGNED_SHORT_5_6_5           0x8363
213#define GL_FRAGMENT_SHADER                0x8B30
214#define GL_VERTEX_SHADER                  0x8B31
215#define GL_MAX_VERTEX_ATTRIBS             0x8869
216#define GL_MAX_VERTEX_UNIFORM_VECTORS     0x8DFB
217#define GL_MAX_VARYING_VECTORS            0x8DFC
218#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
219#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
220#define GL_MAX_TEXTURE_IMAGE_UNITS        0x8872
221#define GL_MAX_FRAGMENT_UNIFORM_VECTORS   0x8DFD
222#define GL_SHADER_TYPE                    0x8B4F
223#define GL_DELETE_STATUS                  0x8B80
224#define GL_LINK_STATUS                    0x8B82
225#define GL_VALIDATE_STATUS                0x8B83
226#define GL_ATTACHED_SHADERS               0x8B85
227#define GL_ACTIVE_UNIFORMS                0x8B86
228#define GL_ACTIVE_UNIFORM_MAX_LENGTH      0x8B87
229#define GL_ACTIVE_ATTRIBUTES              0x8B89
230#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH    0x8B8A
231#define GL_SHADING_LANGUAGE_VERSION       0x8B8C
232#define GL_CURRENT_PROGRAM                0x8B8D
233#define GL_NEVER                          0x0200
234#define GL_LESS                           0x0201
235#define GL_EQUAL                          0x0202
236#define GL_LEQUAL                         0x0203
237#define GL_GREATER                        0x0204
238#define GL_NOTEQUAL                       0x0205
239#define GL_GEQUAL                         0x0206
240#define GL_ALWAYS                         0x0207
241#define GL_KEEP                           0x1E00
242#define GL_REPLACE                        0x1E01
243#define GL_INCR                           0x1E02
244#define GL_DECR                           0x1E03
245#define GL_INVERT                         0x150A
246#define GL_INCR_WRAP                      0x8507
247#define GL_DECR_WRAP                      0x8508
248#define GL_VENDOR                         0x1F00
249#define GL_RENDERER                       0x1F01
250#define GL_VERSION                        0x1F02
251#define GL_EXTENSIONS                     0x1F03
252#define GL_NEAREST                        0x2600
253#define GL_LINEAR                         0x2601
254#define GL_NEAREST_MIPMAP_NEAREST         0x2700
255#define GL_LINEAR_MIPMAP_NEAREST          0x2701
256#define GL_NEAREST_MIPMAP_LINEAR          0x2702
257#define GL_LINEAR_MIPMAP_LINEAR           0x2703
258#define GL_TEXTURE_MAG_FILTER             0x2800
259#define GL_TEXTURE_MIN_FILTER             0x2801
260#define GL_TEXTURE_WRAP_S                 0x2802
261#define GL_TEXTURE_WRAP_T                 0x2803
262#define GL_TEXTURE                        0x1702
263#define GL_TEXTURE_CUBE_MAP               0x8513
264#define GL_TEXTURE_BINDING_CUBE_MAP       0x8514
265#define GL_TEXTURE_CUBE_MAP_POSITIVE_X    0x8515
266#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X    0x8516
267#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y    0x8517
268#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y    0x8518
269#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z    0x8519
270#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z    0x851A
271#define GL_MAX_CUBE_MAP_TEXTURE_SIZE      0x851C
272#define GL_TEXTURE0                       0x84C0
273#define GL_TEXTURE1                       0x84C1
274#define GL_TEXTURE2                       0x84C2
275#define GL_TEXTURE3                       0x84C3
276#define GL_TEXTURE4                       0x84C4
277#define GL_TEXTURE5                       0x84C5
278#define GL_TEXTURE6                       0x84C6
279#define GL_TEXTURE7                       0x84C7
280#define GL_TEXTURE8                       0x84C8
281#define GL_TEXTURE9                       0x84C9
282#define GL_TEXTURE10                      0x84CA
283#define GL_TEXTURE11                      0x84CB
284#define GL_TEXTURE12                      0x84CC
285#define GL_TEXTURE13                      0x84CD
286#define GL_TEXTURE14                      0x84CE
287#define GL_TEXTURE15                      0x84CF
288#define GL_TEXTURE16                      0x84D0
289#define GL_TEXTURE17                      0x84D1
290#define GL_TEXTURE18                      0x84D2
291#define GL_TEXTURE19                      0x84D3
292#define GL_TEXTURE20                      0x84D4
293#define GL_TEXTURE21                      0x84D5
294#define GL_TEXTURE22                      0x84D6
295#define GL_TEXTURE23                      0x84D7
296#define GL_TEXTURE24                      0x84D8
297#define GL_TEXTURE25                      0x84D9
298#define GL_TEXTURE26                      0x84DA
299#define GL_TEXTURE27                      0x84DB
300#define GL_TEXTURE28                      0x84DC
301#define GL_TEXTURE29                      0x84DD
302#define GL_TEXTURE30                      0x84DE
303#define GL_TEXTURE31                      0x84DF
304#define GL_ACTIVE_TEXTURE                 0x84E0
305#define GL_REPEAT                         0x2901
306#define GL_CLAMP_TO_EDGE                  0x812F
307#define GL_MIRRORED_REPEAT                0x8370
308#define GL_FLOAT_VEC2                     0x8B50
309#define GL_FLOAT_VEC3                     0x8B51
310#define GL_FLOAT_VEC4                     0x8B52
311#define GL_INT_VEC2                       0x8B53
312#define GL_INT_VEC3                       0x8B54
313#define GL_INT_VEC4                       0x8B55
314#define GL_BOOL                           0x8B56
315#define GL_BOOL_VEC2                      0x8B57
316#define GL_BOOL_VEC3                      0x8B58
317#define GL_BOOL_VEC4                      0x8B59
318#define GL_FLOAT_MAT2                     0x8B5A
319#define GL_FLOAT_MAT3                     0x8B5B
320#define GL_FLOAT_MAT4                     0x8B5C
321#define GL_SAMPLER_2D                     0x8B5E
322#define GL_SAMPLER_CUBE                   0x8B60
323#define GL_VERTEX_ATTRIB_ARRAY_ENABLED    0x8622
324#define GL_VERTEX_ATTRIB_ARRAY_SIZE       0x8623
325#define GL_VERTEX_ATTRIB_ARRAY_STRIDE     0x8624
326#define GL_VERTEX_ATTRIB_ARRAY_TYPE       0x8625
327#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
328#define GL_VERTEX_ATTRIB_ARRAY_POINTER    0x8645
329#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
330#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
331#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
332#define GL_COMPILE_STATUS                 0x8B81
333#define GL_INFO_LOG_LENGTH                0x8B84
334#define GL_SHADER_SOURCE_LENGTH           0x8B88
335#define GL_SHADER_COMPILER                0x8DFA
336#define GL_SHADER_BINARY_FORMATS          0x8DF8
337#define GL_NUM_SHADER_BINARY_FORMATS      0x8DF9
338#define GL_LOW_FLOAT                      0x8DF0
339#define GL_MEDIUM_FLOAT                   0x8DF1
340#define GL_HIGH_FLOAT                     0x8DF2
341#define GL_LOW_INT                        0x8DF3
342#define GL_MEDIUM_INT                     0x8DF4
343#define GL_HIGH_INT                       0x8DF5
344#define GL_FRAMEBUFFER                    0x8D40
345#define GL_RENDERBUFFER                   0x8D41
346#define GL_RGBA4                          0x8056
347#define GL_RGB5_A1                        0x8057
348#define GL_RGB565                         0x8D62
349#define GL_DEPTH_COMPONENT16              0x81A5
350#define GL_STENCIL_INDEX8                 0x8D48
351#define GL_RENDERBUFFER_WIDTH             0x8D42
352#define GL_RENDERBUFFER_HEIGHT            0x8D43
353#define GL_RENDERBUFFER_INTERNAL_FORMAT   0x8D44
354#define GL_RENDERBUFFER_RED_SIZE          0x8D50
355#define GL_RENDERBUFFER_GREEN_SIZE        0x8D51
356#define GL_RENDERBUFFER_BLUE_SIZE         0x8D52
357#define GL_RENDERBUFFER_ALPHA_SIZE        0x8D53
358#define GL_RENDERBUFFER_DEPTH_SIZE        0x8D54
359#define GL_RENDERBUFFER_STENCIL_SIZE      0x8D55
360#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
361#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
362#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
363#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
364#define GL_COLOR_ATTACHMENT0              0x8CE0
365#define GL_DEPTH_ATTACHMENT               0x8D00
366#define GL_STENCIL_ATTACHMENT             0x8D20
367#define GL_NONE                           0
368#define GL_FRAMEBUFFER_COMPLETE           0x8CD5
369#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
370#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
371#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
372#define GL_FRAMEBUFFER_UNSUPPORTED        0x8CDD
373#define GL_FRAMEBUFFER_BINDING            0x8CA6
374#define GL_RENDERBUFFER_BINDING           0x8CA7
375#define GL_MAX_RENDERBUFFER_SIZE          0x84E8
376#define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506
377GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
378GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
379GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
380GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
381GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
382GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
383GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
384GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
385GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
386GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
387GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
388GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
389GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
390GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
391GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
392GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
393GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
394GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
395GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
396GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
397GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
398GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
399GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
400GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
401GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
402GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
403GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
404GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
405GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
406GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
407GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
408GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
409GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
410GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
411GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
412GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
413GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
414GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
415GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
416GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
417GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
418GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
419GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
420GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
421GL_APICALL void GL_APIENTRY glFinish (void);
422GL_APICALL void GL_APIENTRY glFlush (void);
423GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
424GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
425GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
426GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
427GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
428GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
429GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
430GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
431GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
432GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
433GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
434GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
435GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
436GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
437GL_APICALL GLenum GL_APIENTRY glGetError (void);
438GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
439GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
440GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
441GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
442GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
443GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
444GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
445GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
446GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
447GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
448GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
449GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
450GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
451GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
452GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
453GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
454GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
455GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
456GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
457GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
458GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
459GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
460GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
461GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
462GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
463GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
464GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
465GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
466GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
467GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
468GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
469GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
470GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
471GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
472GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
473GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
474GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
475GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
476GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
477GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
478GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
479GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
480GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
481GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
482GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
483GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
484GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
485GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
486GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
487GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
488GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
489GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
490GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
491GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
492GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
493GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
494GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
495GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
496GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
497GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
498GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
499GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
500GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
501GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
502GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
503GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
504GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
505GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
506GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
507GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
508GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
509GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
510GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
511GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
512GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
513GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
514GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
515GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
516GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
517GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
518GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
519#endif /* GL_ES_VERSION_2_0 */
520
521#ifdef __cplusplus
522}
523#endif
524
525#endif
Property changes on: branches/osd/src/lib/khronos/GLES2/gl2.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/GLES2/gl2ext.h
r0r31734
1#ifndef __gl2ext_h_
2#define __gl2ext_h_ 1
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/*
9** Copyright (c) 2013-2014 The Khronos Group Inc.
10**
11** Permission is hereby granted, free of charge, to any person obtaining a
12** copy of this software and/or associated documentation files (the
13** "Materials"), to deal in the Materials without restriction, including
14** without limitation the rights to use, copy, modify, merge, publish,
15** distribute, sublicense, and/or sell copies of the Materials, and to
16** permit persons to whom the Materials are furnished to do so, subject to
17** the following conditions:
18**
19** The above copyright notice and this permission notice shall be included
20** in all copies or substantial portions of the Materials.
21**
22** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
29*/
30/*
31** This header is generated from the Khronos OpenGL / OpenGL ES XML
32** API Registry. The current version of the Registry, generator scripts
33** used to make the header, and the header can be found at
34**   http://www.opengl.org/registry/
35**
36** Khronos $Revision: 26006 $ on $Date: 2014-03-19 01:26:15 -0700 (Wed, 19 Mar 2014) $
37*/
38
39#ifndef GL_APIENTRYP
40#define GL_APIENTRYP GL_APIENTRY*
41#endif
42
43/* Generated on date 20140319 */
44
45/* Generated C header for:
46 * API: gles2
47 * Profile: common
48 * Versions considered: 2\.[0-9]
49 * Versions emitted: _nomatch_^
50 * Default extensions included: gles2
51 * Additional extensions included: _nomatch_^
52 * Extensions removed: _nomatch_^
53 */
54
55#ifndef GL_KHR_blend_equation_advanced
56#define GL_KHR_blend_equation_advanced 1
57#define GL_BLEND_ADVANCED_COHERENT_KHR    0x9285
58#define GL_MULTIPLY_KHR                   0x9294
59#define GL_SCREEN_KHR                     0x9295
60#define GL_OVERLAY_KHR                    0x9296
61#define GL_DARKEN_KHR                     0x9297
62#define GL_LIGHTEN_KHR                    0x9298
63#define GL_COLORDODGE_KHR                 0x9299
64#define GL_COLORBURN_KHR                  0x929A
65#define GL_HARDLIGHT_KHR                  0x929B
66#define GL_SOFTLIGHT_KHR                  0x929C
67#define GL_DIFFERENCE_KHR                 0x929E
68#define GL_EXCLUSION_KHR                  0x92A0
69#define GL_HSL_HUE_KHR                    0x92AD
70#define GL_HSL_SATURATION_KHR             0x92AE
71#define GL_HSL_COLOR_KHR                  0x92AF
72#define GL_HSL_LUMINOSITY_KHR             0x92B0
73typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void);
74#ifdef GL_GLEXT_PROTOTYPES
75GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void);
76#endif
77#endif /* GL_KHR_blend_equation_advanced */
78
79#ifndef GL_KHR_debug
80#define GL_KHR_debug 1
81typedef void (GL_APIENTRY  *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
82#define GL_SAMPLER                        0x82E6
83#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR   0x8242
84#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243
85#define GL_DEBUG_CALLBACK_FUNCTION_KHR    0x8244
86#define GL_DEBUG_CALLBACK_USER_PARAM_KHR  0x8245
87#define GL_DEBUG_SOURCE_API_KHR           0x8246
88#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247
89#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248
90#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR   0x8249
91#define GL_DEBUG_SOURCE_APPLICATION_KHR   0x824A
92#define GL_DEBUG_SOURCE_OTHER_KHR         0x824B
93#define GL_DEBUG_TYPE_ERROR_KHR           0x824C
94#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D
95#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E
96#define GL_DEBUG_TYPE_PORTABILITY_KHR     0x824F
97#define GL_DEBUG_TYPE_PERFORMANCE_KHR     0x8250
98#define GL_DEBUG_TYPE_OTHER_KHR           0x8251
99#define GL_DEBUG_TYPE_MARKER_KHR          0x8268
100#define GL_DEBUG_TYPE_PUSH_GROUP_KHR      0x8269
101#define GL_DEBUG_TYPE_POP_GROUP_KHR       0x826A
102#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B
103#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C
104#define GL_DEBUG_GROUP_STACK_DEPTH_KHR    0x826D
105#define GL_BUFFER_KHR                     0x82E0
106#define GL_SHADER_KHR                     0x82E1
107#define GL_PROGRAM_KHR                    0x82E2
108#define GL_VERTEX_ARRAY_KHR               0x8074
109#define GL_QUERY_KHR                      0x82E3
110#define GL_SAMPLER_KHR                    0x82E6
111#define GL_MAX_LABEL_LENGTH_KHR           0x82E8
112#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR   0x9143
113#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR  0x9144
114#define GL_DEBUG_LOGGED_MESSAGES_KHR      0x9145
115#define GL_DEBUG_SEVERITY_HIGH_KHR        0x9146
116#define GL_DEBUG_SEVERITY_MEDIUM_KHR      0x9147
117#define GL_DEBUG_SEVERITY_LOW_KHR         0x9148
118#define GL_DEBUG_OUTPUT_KHR               0x92E0
119#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR     0x00000002
120#define GL_STACK_OVERFLOW_KHR             0x0503
121#define GL_STACK_UNDERFLOW_KHR            0x0504
122typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
123typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
124typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam);
125typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
126typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
127typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void);
128typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
129typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
130typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label);
131typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
132typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params);
133#ifdef GL_GLEXT_PROTOTYPES
134GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
135GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
136GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam);
137GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
138GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message);
139GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void);
140GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
141GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
142GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label);
143GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
144GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params);
145#endif
146#endif /* GL_KHR_debug */
147
148#ifndef GL_KHR_texture_compression_astc_hdr
149#define GL_KHR_texture_compression_astc_hdr 1
150#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR   0x93B0
151#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR   0x93B1
152#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR   0x93B2
153#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR   0x93B3
154#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR   0x93B4
155#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR   0x93B5
156#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR   0x93B6
157#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR   0x93B7
158#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR  0x93B8
159#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR  0x93B9
160#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR  0x93BA
161#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
162#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
163#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
164#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
165#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
166#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
167#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
168#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
169#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
170#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
171#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
172#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
173#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
174#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
175#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
176#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
177#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
178#endif /* GL_KHR_texture_compression_astc_hdr */
179
180#ifndef GL_KHR_texture_compression_astc_ldr
181#define GL_KHR_texture_compression_astc_ldr 1
182#endif /* GL_KHR_texture_compression_astc_ldr */
183
184#ifndef GL_OES_EGL_image
185#define GL_OES_EGL_image 1
186typedef void *GLeglImageOES;
187typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
188typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
189#ifdef GL_GLEXT_PROTOTYPES
190GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
191GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
192#endif
193#endif /* GL_OES_EGL_image */
194
195#ifndef GL_OES_EGL_image_external
196#define GL_OES_EGL_image_external 1
197#define GL_TEXTURE_EXTERNAL_OES           0x8D65
198#define GL_TEXTURE_BINDING_EXTERNAL_OES   0x8D67
199#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
200#define GL_SAMPLER_EXTERNAL_OES           0x8D66
201#endif /* GL_OES_EGL_image_external */
202
203#ifndef GL_OES_compressed_ETC1_RGB8_texture
204#define GL_OES_compressed_ETC1_RGB8_texture 1
205#define GL_ETC1_RGB8_OES                  0x8D64
206#endif /* GL_OES_compressed_ETC1_RGB8_texture */
207
208#ifndef GL_OES_compressed_paletted_texture
209#define GL_OES_compressed_paletted_texture 1
210#define GL_PALETTE4_RGB8_OES              0x8B90
211#define GL_PALETTE4_RGBA8_OES             0x8B91
212#define GL_PALETTE4_R5_G6_B5_OES          0x8B92
213#define GL_PALETTE4_RGBA4_OES             0x8B93
214#define GL_PALETTE4_RGB5_A1_OES           0x8B94
215#define GL_PALETTE8_RGB8_OES              0x8B95
216#define GL_PALETTE8_RGBA8_OES             0x8B96
217#define GL_PALETTE8_R5_G6_B5_OES          0x8B97
218#define GL_PALETTE8_RGBA4_OES             0x8B98
219#define GL_PALETTE8_RGB5_A1_OES           0x8B99
220#endif /* GL_OES_compressed_paletted_texture */
221
222#ifndef GL_OES_depth24
223#define GL_OES_depth24 1
224#define GL_DEPTH_COMPONENT24_OES          0x81A6
225#endif /* GL_OES_depth24 */
226
227#ifndef GL_OES_depth32
228#define GL_OES_depth32 1
229#define GL_DEPTH_COMPONENT32_OES          0x81A7
230#endif /* GL_OES_depth32 */
231
232#ifndef GL_OES_depth_texture
233#define GL_OES_depth_texture 1
234#endif /* GL_OES_depth_texture */
235
236#ifndef GL_OES_element_index_uint
237#define GL_OES_element_index_uint 1
238#endif /* GL_OES_element_index_uint */
239
240#ifndef GL_OES_fbo_render_mipmap
241#define GL_OES_fbo_render_mipmap 1
242#endif /* GL_OES_fbo_render_mipmap */
243
244#ifndef GL_OES_fragment_precision_high
245#define GL_OES_fragment_precision_high 1
246#endif /* GL_OES_fragment_precision_high */
247
248#ifndef GL_OES_get_program_binary
249#define GL_OES_get_program_binary 1
250#define GL_PROGRAM_BINARY_LENGTH_OES      0x8741
251#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
252#define GL_PROGRAM_BINARY_FORMATS_OES     0x87FF
253typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
254typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
255#ifdef GL_GLEXT_PROTOTYPES
256GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
257GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
258#endif
259#endif /* GL_OES_get_program_binary */
260
261#ifndef GL_OES_mapbuffer
262#define GL_OES_mapbuffer 1
263#define GL_WRITE_ONLY_OES                 0x88B9
264#define GL_BUFFER_ACCESS_OES              0x88BB
265#define GL_BUFFER_MAPPED_OES              0x88BC
266#define GL_BUFFER_MAP_POINTER_OES         0x88BD
267typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
268typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
269typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params);
270#ifdef GL_GLEXT_PROTOTYPES
271GL_APICALL void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
272GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
273GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params);
274#endif
275#endif /* GL_OES_mapbuffer */
276
277#ifndef GL_OES_packed_depth_stencil
278#define GL_OES_packed_depth_stencil 1
279#define GL_DEPTH_STENCIL_OES              0x84F9
280#define GL_UNSIGNED_INT_24_8_OES          0x84FA
281#define GL_DEPTH24_STENCIL8_OES           0x88F0
282#endif /* GL_OES_packed_depth_stencil */
283
284#ifndef GL_OES_required_internalformat
285#define GL_OES_required_internalformat 1
286#define GL_ALPHA8_OES                     0x803C
287#define GL_DEPTH_COMPONENT16_OES          0x81A5
288#define GL_LUMINANCE4_ALPHA4_OES          0x8043
289#define GL_LUMINANCE8_ALPHA8_OES          0x8045
290#define GL_LUMINANCE8_OES                 0x8040
291#define GL_RGBA4_OES                      0x8056
292#define GL_RGB5_A1_OES                    0x8057
293#define GL_RGB565_OES                     0x8D62
294#define GL_RGB8_OES                       0x8051
295#define GL_RGBA8_OES                      0x8058
296#define GL_RGB10_EXT                      0x8052
297#define GL_RGB10_A2_EXT                   0x8059
298#endif /* GL_OES_required_internalformat */
299
300#ifndef GL_OES_rgb8_rgba8
301#define GL_OES_rgb8_rgba8 1
302#endif /* GL_OES_rgb8_rgba8 */
303
304#ifndef GL_OES_sample_shading
305#define GL_OES_sample_shading 1
306#define GL_SAMPLE_SHADING_OES             0x8C36
307#define GL_MIN_SAMPLE_SHADING_VALUE_OES   0x8C37
308typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value);
309#ifdef GL_GLEXT_PROTOTYPES
310GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value);
311#endif
312#endif /* GL_OES_sample_shading */
313
314#ifndef GL_OES_sample_variables
315#define GL_OES_sample_variables 1
316#endif /* GL_OES_sample_variables */
317
318#ifndef GL_OES_shader_image_atomic
319#define GL_OES_shader_image_atomic 1
320#endif /* GL_OES_shader_image_atomic */
321
322#ifndef GL_OES_shader_multisample_interpolation
323#define GL_OES_shader_multisample_interpolation 1
324#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B
325#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C
326#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D
327#endif /* GL_OES_shader_multisample_interpolation */
328
329#ifndef GL_OES_standard_derivatives
330#define GL_OES_standard_derivatives 1
331#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
332#endif /* GL_OES_standard_derivatives */
333
334#ifndef GL_OES_stencil1
335#define GL_OES_stencil1 1
336#define GL_STENCIL_INDEX1_OES             0x8D46
337#endif /* GL_OES_stencil1 */
338
339#ifndef GL_OES_stencil4
340#define GL_OES_stencil4 1
341#define GL_STENCIL_INDEX4_OES             0x8D47
342#endif /* GL_OES_stencil4 */
343
344#ifndef GL_OES_surfaceless_context
345#define GL_OES_surfaceless_context 1
346#define GL_FRAMEBUFFER_UNDEFINED_OES      0x8219
347#endif /* GL_OES_surfaceless_context */
348
349#ifndef GL_OES_texture_3D
350#define GL_OES_texture_3D 1
351#define GL_TEXTURE_WRAP_R_OES             0x8072
352#define GL_TEXTURE_3D_OES                 0x806F
353#define GL_TEXTURE_BINDING_3D_OES         0x806A
354#define GL_MAX_3D_TEXTURE_SIZE_OES        0x8073
355#define GL_SAMPLER_3D_OES                 0x8B5F
356#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
357typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
358typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
359typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
360typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
361typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
362typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
363#ifdef GL_GLEXT_PROTOTYPES
364GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
365GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
366GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
367GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
368GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
369GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
370#endif
371#endif /* GL_OES_texture_3D */
372
373#ifndef GL_OES_texture_compression_astc
374#define GL_OES_texture_compression_astc 1
375#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0
376#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1
377#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2
378#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3
379#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4
380#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5
381#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6
382#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7
383#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8
384#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9
385#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0
386#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1
387#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2
388#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3
389#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4
390#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5
391#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6
392#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7
393#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8
394#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9
395#endif /* GL_OES_texture_compression_astc */
396
397#ifndef GL_OES_texture_float
398#define GL_OES_texture_float 1
399#endif /* GL_OES_texture_float */
400
401#ifndef GL_OES_texture_float_linear
402#define GL_OES_texture_float_linear 1
403#endif /* GL_OES_texture_float_linear */
404
405#ifndef GL_OES_texture_half_float
406#define GL_OES_texture_half_float 1
407#define GL_HALF_FLOAT_OES                 0x8D61
408#endif /* GL_OES_texture_half_float */
409
410#ifndef GL_OES_texture_half_float_linear
411#define GL_OES_texture_half_float_linear 1
412#endif /* GL_OES_texture_half_float_linear */
413
414#ifndef GL_OES_texture_npot
415#define GL_OES_texture_npot 1
416#endif /* GL_OES_texture_npot */
417
418#ifndef GL_OES_texture_stencil8
419#define GL_OES_texture_stencil8 1
420#define GL_STENCIL_INDEX_OES              0x1901
421#define GL_STENCIL_INDEX8_OES             0x8D48
422#endif /* GL_OES_texture_stencil8 */
423
424#ifndef GL_OES_texture_storage_multisample_2d_array
425#define GL_OES_texture_storage_multisample_2d_array 1
426#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102
427#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105
428#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B
429#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C
430#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D
431typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
432#ifdef GL_GLEXT_PROTOTYPES
433GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
434#endif
435#endif /* GL_OES_texture_storage_multisample_2d_array */
436
437#ifndef GL_OES_vertex_array_object
438#define GL_OES_vertex_array_object 1
439#define GL_VERTEX_ARRAY_BINDING_OES       0x85B5
440typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
441typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
442typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
443typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
444#ifdef GL_GLEXT_PROTOTYPES
445GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
446GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
447GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
448GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
449#endif
450#endif /* GL_OES_vertex_array_object */
451
452#ifndef GL_OES_vertex_half_float
453#define GL_OES_vertex_half_float 1
454#endif /* GL_OES_vertex_half_float */
455
456#ifndef GL_OES_vertex_type_10_10_10_2
457#define GL_OES_vertex_type_10_10_10_2 1
458#define GL_UNSIGNED_INT_10_10_10_2_OES    0x8DF6
459#define GL_INT_10_10_10_2_OES             0x8DF7
460#endif /* GL_OES_vertex_type_10_10_10_2 */
461
462#ifndef GL_AMD_compressed_3DC_texture
463#define GL_AMD_compressed_3DC_texture 1
464#define GL_3DC_X_AMD                      0x87F9
465#define GL_3DC_XY_AMD                     0x87FA
466#endif /* GL_AMD_compressed_3DC_texture */
467
468#ifndef GL_AMD_compressed_ATC_texture
469#define GL_AMD_compressed_ATC_texture 1
470#define GL_ATC_RGB_AMD                    0x8C92
471#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD    0x8C93
472#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
473#endif /* GL_AMD_compressed_ATC_texture */
474
475#ifndef GL_AMD_performance_monitor
476#define GL_AMD_performance_monitor 1
477#define GL_COUNTER_TYPE_AMD               0x8BC0
478#define GL_COUNTER_RANGE_AMD              0x8BC1
479#define GL_UNSIGNED_INT64_AMD             0x8BC2
480#define GL_PERCENTAGE_AMD                 0x8BC3
481#define GL_PERFMON_RESULT_AVAILABLE_AMD   0x8BC4
482#define GL_PERFMON_RESULT_SIZE_AMD        0x8BC5
483#define GL_PERFMON_RESULT_AMD             0x8BC6
484typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
485typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
486typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
487typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
488typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
489typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
490typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
491typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
492typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
493typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
494typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
495#ifdef GL_GLEXT_PROTOTYPES
496GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
497GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
498GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
499GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
500GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data);
501GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
502GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
503GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
504GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
505GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
506GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
507#endif
508#endif /* GL_AMD_performance_monitor */
509
510#ifndef GL_AMD_program_binary_Z400
511#define GL_AMD_program_binary_Z400 1
512#define GL_Z400_BINARY_AMD                0x8740
513#endif /* GL_AMD_program_binary_Z400 */
514
515#ifndef GL_ANGLE_depth_texture
516#define GL_ANGLE_depth_texture 1
517#endif /* GL_ANGLE_depth_texture */
518
519#ifndef GL_ANGLE_framebuffer_blit
520#define GL_ANGLE_framebuffer_blit 1
521#define GL_READ_FRAMEBUFFER_ANGLE         0x8CA8
522#define GL_DRAW_FRAMEBUFFER_ANGLE         0x8CA9
523#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
524#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
525typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
526#ifdef GL_GLEXT_PROTOTYPES
527GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
528#endif
529#endif /* GL_ANGLE_framebuffer_blit */
530
531#ifndef GL_ANGLE_framebuffer_multisample
532#define GL_ANGLE_framebuffer_multisample 1
533#define GL_RENDERBUFFER_SAMPLES_ANGLE     0x8CAB
534#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
535#define GL_MAX_SAMPLES_ANGLE              0x8D57
536typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
537#ifdef GL_GLEXT_PROTOTYPES
538GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
539#endif
540#endif /* GL_ANGLE_framebuffer_multisample */
541
542#ifndef GL_ANGLE_instanced_arrays
543#define GL_ANGLE_instanced_arrays 1
544#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
545typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
546typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
547typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
548#ifdef GL_GLEXT_PROTOTYPES
549GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
550GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
551GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
552#endif
553#endif /* GL_ANGLE_instanced_arrays */
554
555#ifndef GL_ANGLE_pack_reverse_row_order
556#define GL_ANGLE_pack_reverse_row_order 1
557#define GL_PACK_REVERSE_ROW_ORDER_ANGLE   0x93A4
558#endif /* GL_ANGLE_pack_reverse_row_order */
559
560#ifndef GL_ANGLE_program_binary
561#define GL_ANGLE_program_binary 1
562#define GL_PROGRAM_BINARY_ANGLE           0x93A6
563#endif /* GL_ANGLE_program_binary */
564
565#ifndef GL_ANGLE_texture_compression_dxt3
566#define GL_ANGLE_texture_compression_dxt3 1
567#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
568#endif /* GL_ANGLE_texture_compression_dxt3 */
569
570#ifndef GL_ANGLE_texture_compression_dxt5
571#define GL_ANGLE_texture_compression_dxt5 1
572#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
573#endif /* GL_ANGLE_texture_compression_dxt5 */
574
575#ifndef GL_ANGLE_texture_usage
576#define GL_ANGLE_texture_usage 1
577#define GL_TEXTURE_USAGE_ANGLE            0x93A2
578#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE   0x93A3
579#endif /* GL_ANGLE_texture_usage */
580
581#ifndef GL_ANGLE_translated_shader_source
582#define GL_ANGLE_translated_shader_source 1
583#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
584typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
585#ifdef GL_GLEXT_PROTOTYPES
586GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
587#endif
588#endif /* GL_ANGLE_translated_shader_source */
589
590#ifndef GL_APPLE_copy_texture_levels
591#define GL_APPLE_copy_texture_levels 1
592typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
593#ifdef GL_GLEXT_PROTOTYPES
594GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
595#endif
596#endif /* GL_APPLE_copy_texture_levels */
597
598#ifndef GL_APPLE_framebuffer_multisample
599#define GL_APPLE_framebuffer_multisample 1
600#define GL_RENDERBUFFER_SAMPLES_APPLE     0x8CAB
601#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
602#define GL_MAX_SAMPLES_APPLE              0x8D57
603#define GL_READ_FRAMEBUFFER_APPLE         0x8CA8
604#define GL_DRAW_FRAMEBUFFER_APPLE         0x8CA9
605#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
606#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
607typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
608typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
609#ifdef GL_GLEXT_PROTOTYPES
610GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
611GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
612#endif
613#endif /* GL_APPLE_framebuffer_multisample */
614
615#ifndef GL_APPLE_rgb_422
616#define GL_APPLE_rgb_422 1
617#define GL_RGB_422_APPLE                  0x8A1F
618#define GL_UNSIGNED_SHORT_8_8_APPLE       0x85BA
619#define GL_UNSIGNED_SHORT_8_8_REV_APPLE   0x85BB
620#define GL_RGB_RAW_422_APPLE              0x8A51
621#endif /* GL_APPLE_rgb_422 */
622
623#ifndef GL_APPLE_sync
624#define GL_APPLE_sync 1
625#define GL_SYNC_OBJECT_APPLE              0x8A53
626#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE  0x9111
627#define GL_OBJECT_TYPE_APPLE              0x9112
628#define GL_SYNC_CONDITION_APPLE           0x9113
629#define GL_SYNC_STATUS_APPLE              0x9114
630#define GL_SYNC_FLAGS_APPLE               0x9115
631#define GL_SYNC_FENCE_APPLE               0x9116
632#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
633#define GL_UNSIGNALED_APPLE               0x9118
634#define GL_SIGNALED_APPLE                 0x9119
635#define GL_ALREADY_SIGNALED_APPLE         0x911A
636#define GL_TIMEOUT_EXPIRED_APPLE          0x911B
637#define GL_CONDITION_SATISFIED_APPLE      0x911C
638#define GL_WAIT_FAILED_APPLE              0x911D
639#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE  0x00000001
640#define GL_TIMEOUT_IGNORED_APPLE          0xFFFFFFFFFFFFFFFFull
641typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
642typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
643typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
644typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
645typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
646typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
647typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
648#ifdef GL_GLEXT_PROTOTYPES
649GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
650GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
651GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
652GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
653GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
654GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
655GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
656#endif
657#endif /* GL_APPLE_sync */
658
659#ifndef GL_APPLE_texture_format_BGRA8888
660#define GL_APPLE_texture_format_BGRA8888 1
661#define GL_BGRA_EXT                       0x80E1
662#define GL_BGRA8_EXT                      0x93A1
663#endif /* GL_APPLE_texture_format_BGRA8888 */
664
665#ifndef GL_APPLE_texture_max_level
666#define GL_APPLE_texture_max_level 1
667#define GL_TEXTURE_MAX_LEVEL_APPLE        0x813D
668#endif /* GL_APPLE_texture_max_level */
669
670#ifndef GL_ARM_mali_program_binary
671#define GL_ARM_mali_program_binary 1
672#define GL_MALI_PROGRAM_BINARY_ARM        0x8F61
673#endif /* GL_ARM_mali_program_binary */
674
675#ifndef GL_ARM_mali_shader_binary
676#define GL_ARM_mali_shader_binary 1
677#define GL_MALI_SHADER_BINARY_ARM         0x8F60
678#endif /* GL_ARM_mali_shader_binary */
679
680#ifndef GL_ARM_rgba8
681#define GL_ARM_rgba8 1
682#endif /* GL_ARM_rgba8 */
683
684#ifndef GL_ARM_shader_framebuffer_fetch
685#define GL_ARM_shader_framebuffer_fetch 1
686#define GL_FETCH_PER_SAMPLE_ARM           0x8F65
687#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66
688#endif /* GL_ARM_shader_framebuffer_fetch */
689
690#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil
691#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1
692#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */
693
694#ifndef GL_DMP_shader_binary
695#define GL_DMP_shader_binary 1
696#define GL_SHADER_BINARY_DMP              0x9250
697#endif /* GL_DMP_shader_binary */
698
699#ifndef GL_EXT_blend_minmax
700#define GL_EXT_blend_minmax 1
701#define GL_MIN_EXT                        0x8007
702#define GL_MAX_EXT                        0x8008
703#endif /* GL_EXT_blend_minmax */
704
705#ifndef GL_EXT_color_buffer_half_float
706#define GL_EXT_color_buffer_half_float 1
707#define GL_RGBA16F_EXT                    0x881A
708#define GL_RGB16F_EXT                     0x881B
709#define GL_RG16F_EXT                      0x822F
710#define GL_R16F_EXT                       0x822D
711#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211
712#define GL_UNSIGNED_NORMALIZED_EXT        0x8C17
713#endif /* GL_EXT_color_buffer_half_float */
714
715#ifndef GL_EXT_debug_label
716#define GL_EXT_debug_label 1
717#define GL_PROGRAM_PIPELINE_OBJECT_EXT    0x8A4F
718#define GL_PROGRAM_OBJECT_EXT             0x8B40
719#define GL_SHADER_OBJECT_EXT              0x8B48
720#define GL_BUFFER_OBJECT_EXT              0x9151
721#define GL_QUERY_OBJECT_EXT               0x9153
722#define GL_VERTEX_ARRAY_OBJECT_EXT        0x9154
723#define GL_TRANSFORM_FEEDBACK             0x8E22
724typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
725typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
726#ifdef GL_GLEXT_PROTOTYPES
727GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
728GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
729#endif
730#endif /* GL_EXT_debug_label */
731
732#ifndef GL_EXT_debug_marker
733#define GL_EXT_debug_marker 1
734typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
735typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
736typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
737#ifdef GL_GLEXT_PROTOTYPES
738GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
739GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
740GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
741#endif
742#endif /* GL_EXT_debug_marker */
743
744#ifndef GL_EXT_discard_framebuffer
745#define GL_EXT_discard_framebuffer 1
746#define GL_COLOR_EXT                      0x1800
747#define GL_DEPTH_EXT                      0x1801
748#define GL_STENCIL_EXT                    0x1802
749typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
750#ifdef GL_GLEXT_PROTOTYPES
751GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
752#endif
753#endif /* GL_EXT_discard_framebuffer */
754
755#ifndef GL_EXT_disjoint_timer_query
756#define GL_EXT_disjoint_timer_query 1
757#define GL_QUERY_COUNTER_BITS_EXT         0x8864
758#define GL_CURRENT_QUERY_EXT              0x8865
759#define GL_QUERY_RESULT_EXT               0x8866
760#define GL_QUERY_RESULT_AVAILABLE_EXT     0x8867
761#define GL_TIME_ELAPSED_EXT               0x88BF
762#define GL_TIMESTAMP_EXT                  0x8E28
763#define GL_GPU_DISJOINT_EXT               0x8FBB
764typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
765typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
766typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
767typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
768typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
769typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
770typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
771typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params);
772typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
773typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params);
774typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
775#ifdef GL_GLEXT_PROTOTYPES
776GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
777GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
778GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
779GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
780GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
781GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target);
782GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
783GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params);
784GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
785GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params);
786GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params);
787#endif
788#endif /* GL_EXT_disjoint_timer_query */
789
790#ifndef GL_EXT_draw_buffers
791#define GL_EXT_draw_buffers 1
792#define GL_MAX_COLOR_ATTACHMENTS_EXT      0x8CDF
793#define GL_MAX_DRAW_BUFFERS_EXT           0x8824
794#define GL_DRAW_BUFFER0_EXT               0x8825
795#define GL_DRAW_BUFFER1_EXT               0x8826
796#define GL_DRAW_BUFFER2_EXT               0x8827
797#define GL_DRAW_BUFFER3_EXT               0x8828
798#define GL_DRAW_BUFFER4_EXT               0x8829
799#define GL_DRAW_BUFFER5_EXT               0x882A
800#define GL_DRAW_BUFFER6_EXT               0x882B
801#define GL_DRAW_BUFFER7_EXT               0x882C
802#define GL_DRAW_BUFFER8_EXT               0x882D
803#define GL_DRAW_BUFFER9_EXT               0x882E
804#define GL_DRAW_BUFFER10_EXT              0x882F
805#define GL_DRAW_BUFFER11_EXT              0x8830
806#define GL_DRAW_BUFFER12_EXT              0x8831
807#define GL_DRAW_BUFFER13_EXT              0x8832
808#define GL_DRAW_BUFFER14_EXT              0x8833
809#define GL_DRAW_BUFFER15_EXT              0x8834
810#define GL_COLOR_ATTACHMENT0_EXT          0x8CE0
811#define GL_COLOR_ATTACHMENT1_EXT          0x8CE1
812#define GL_COLOR_ATTACHMENT2_EXT          0x8CE2
813#define GL_COLOR_ATTACHMENT3_EXT          0x8CE3
814#define GL_COLOR_ATTACHMENT4_EXT          0x8CE4
815#define GL_COLOR_ATTACHMENT5_EXT          0x8CE5
816#define GL_COLOR_ATTACHMENT6_EXT          0x8CE6
817#define GL_COLOR_ATTACHMENT7_EXT          0x8CE7
818#define GL_COLOR_ATTACHMENT8_EXT          0x8CE8
819#define GL_COLOR_ATTACHMENT9_EXT          0x8CE9
820#define GL_COLOR_ATTACHMENT10_EXT         0x8CEA
821#define GL_COLOR_ATTACHMENT11_EXT         0x8CEB
822#define GL_COLOR_ATTACHMENT12_EXT         0x8CEC
823#define GL_COLOR_ATTACHMENT13_EXT         0x8CED
824#define GL_COLOR_ATTACHMENT14_EXT         0x8CEE
825#define GL_COLOR_ATTACHMENT15_EXT         0x8CEF
826typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
827#ifdef GL_GLEXT_PROTOTYPES
828GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
829#endif
830#endif /* GL_EXT_draw_buffers */
831
832#ifndef GL_EXT_draw_instanced
833#define GL_EXT_draw_instanced 1
834typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
835typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
836#ifdef GL_GLEXT_PROTOTYPES
837GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
838GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
839#endif
840#endif /* GL_EXT_draw_instanced */
841
842#ifndef GL_EXT_instanced_arrays
843#define GL_EXT_instanced_arrays 1
844#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE
845typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor);
846#ifdef GL_GLEXT_PROTOTYPES
847GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor);
848#endif
849#endif /* GL_EXT_instanced_arrays */
850
851#ifndef GL_EXT_map_buffer_range
852#define GL_EXT_map_buffer_range 1
853#define GL_MAP_READ_BIT_EXT               0x0001
854#define GL_MAP_WRITE_BIT_EXT              0x0002
855#define GL_MAP_INVALIDATE_RANGE_BIT_EXT   0x0004
856#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT  0x0008
857#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT     0x0010
858#define GL_MAP_UNSYNCHRONIZED_BIT_EXT     0x0020
859typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
860typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
861#ifdef GL_GLEXT_PROTOTYPES
862GL_APICALL void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
863GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
864#endif
865#endif /* GL_EXT_map_buffer_range */
866
867#ifndef GL_EXT_multi_draw_arrays
868#define GL_EXT_multi_draw_arrays 1
869typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
870typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
871#ifdef GL_GLEXT_PROTOTYPES
872GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
873GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
874#endif
875#endif /* GL_EXT_multi_draw_arrays */
876
877#ifndef GL_EXT_multisampled_render_to_texture
878#define GL_EXT_multisampled_render_to_texture 1
879#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
880#define GL_RENDERBUFFER_SAMPLES_EXT       0x8CAB
881#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
882#define GL_MAX_SAMPLES_EXT                0x8D57
883typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
884typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
885#ifdef GL_GLEXT_PROTOTYPES
886GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
887GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
888#endif
889#endif /* GL_EXT_multisampled_render_to_texture */
890
891#ifndef GL_EXT_multiview_draw_buffers
892#define GL_EXT_multiview_draw_buffers 1
893#define GL_COLOR_ATTACHMENT_EXT           0x90F0
894#define GL_MULTIVIEW_EXT                  0x90F1
895#define GL_DRAW_BUFFER_EXT                0x0C01
896#define GL_READ_BUFFER_EXT                0x0C02
897#define GL_MAX_MULTIVIEW_BUFFERS_EXT      0x90F2
898typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index);
899typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices);
900typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data);
901#ifdef GL_GLEXT_PROTOTYPES
902GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index);
903GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices);
904GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data);
905#endif
906#endif /* GL_EXT_multiview_draw_buffers */
907
908#ifndef GL_EXT_occlusion_query_boolean
909#define GL_EXT_occlusion_query_boolean 1
910#define GL_ANY_SAMPLES_PASSED_EXT         0x8C2F
911#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
912#endif /* GL_EXT_occlusion_query_boolean */
913
914#ifndef GL_EXT_pvrtc_sRGB
915#define GL_EXT_pvrtc_sRGB 1
916#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54
917#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55
918#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56
919#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57
920#endif /* GL_EXT_pvrtc_sRGB */
921
922#ifndef GL_EXT_read_format_bgra
923#define GL_EXT_read_format_bgra 1
924#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
925#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
926#endif /* GL_EXT_read_format_bgra */
927
928#ifndef GL_EXT_robustness
929#define GL_EXT_robustness 1
930#define GL_GUILTY_CONTEXT_RESET_EXT       0x8253
931#define GL_INNOCENT_CONTEXT_RESET_EXT     0x8254
932#define GL_UNKNOWN_CONTEXT_RESET_EXT      0x8255
933#define GL_CONTEXT_ROBUST_ACCESS_EXT      0x90F3
934#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
935#define GL_LOSE_CONTEXT_ON_RESET_EXT      0x8252
936#define GL_NO_RESET_NOTIFICATION_EXT      0x8261
937typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
938typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
939typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
940typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
941#ifdef GL_GLEXT_PROTOTYPES
942GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
943GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
944GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
945GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
946#endif
947#endif /* GL_EXT_robustness */
948
949#ifndef GL_EXT_sRGB
950#define GL_EXT_sRGB 1
951#define GL_SRGB_EXT                       0x8C40
952#define GL_SRGB_ALPHA_EXT                 0x8C42
953#define GL_SRGB8_ALPHA8_EXT               0x8C43
954#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
955#endif /* GL_EXT_sRGB */
956
957#ifndef GL_EXT_sRGB_write_control
958#define GL_EXT_sRGB_write_control 1
959#define GL_FRAMEBUFFER_SRGB_EXT           0x8DB9
960#endif /* GL_EXT_sRGB_write_control */
961
962#ifndef GL_EXT_separate_shader_objects
963#define GL_EXT_separate_shader_objects 1
964#define GL_ACTIVE_PROGRAM_EXT             0x8259
965#define GL_VERTEX_SHADER_BIT_EXT          0x00000001
966#define GL_FRAGMENT_SHADER_BIT_EXT        0x00000002
967#define GL_ALL_SHADER_BITS_EXT            0xFFFFFFFF
968#define GL_PROGRAM_SEPARABLE_EXT          0x8258
969#define GL_PROGRAM_PIPELINE_BINDING_EXT   0x825A
970typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
971typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
972typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
973typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
974typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
975typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
976typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
977typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
978typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
979typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
980typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
981typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
982typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
983typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
984typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
985typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
986typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
987typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
988typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
989typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
990typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
991typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
992typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
993typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
994typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
995typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
996typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
997typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
998typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
999typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
1000typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
1001typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
1002typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
1003typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
1004typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1005typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1006typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1007typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1008typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1009typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1010typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1011typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1012typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1013typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1014#ifdef GL_GLEXT_PROTOTYPES
1015GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
1016GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
1017GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
1018GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
1019GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
1020GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
1021GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
1022GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
1023GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
1024GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
1025GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1026GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
1027GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
1028GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
1029GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1030GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
1031GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
1032GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
1033GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1034GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
1035GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
1036GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
1037GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1038GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
1039GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
1040GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1041GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1042GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1043GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
1044GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
1045GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
1046GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
1047GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
1048GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
1049GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
1050GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
1051GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
1052GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
1053GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1054GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1055GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1056GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1057GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1058GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1059#endif
1060#endif /* GL_EXT_separate_shader_objects */
1061
1062#ifndef GL_EXT_shader_framebuffer_fetch
1063#define GL_EXT_shader_framebuffer_fetch 1
1064#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
1065#endif /* GL_EXT_shader_framebuffer_fetch */
1066
1067#ifndef GL_EXT_shader_integer_mix
1068#define GL_EXT_shader_integer_mix 1
1069#endif /* GL_EXT_shader_integer_mix */
1070
1071#ifndef GL_EXT_shader_pixel_local_storage
1072#define GL_EXT_shader_pixel_local_storage 1
1073#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63
1074#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67
1075#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64
1076#endif /* GL_EXT_shader_pixel_local_storage */
1077
1078#ifndef GL_EXT_shader_texture_lod
1079#define GL_EXT_shader_texture_lod 1
1080#endif /* GL_EXT_shader_texture_lod */
1081
1082#ifndef GL_EXT_shadow_samplers
1083#define GL_EXT_shadow_samplers 1
1084#define GL_TEXTURE_COMPARE_MODE_EXT       0x884C
1085#define GL_TEXTURE_COMPARE_FUNC_EXT       0x884D
1086#define GL_COMPARE_REF_TO_TEXTURE_EXT     0x884E
1087#define GL_SAMPLER_2D_SHADOW_EXT          0x8B62
1088#endif /* GL_EXT_shadow_samplers */
1089
1090#ifndef GL_EXT_texture_compression_dxt1
1091#define GL_EXT_texture_compression_dxt1 1
1092#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT   0x83F0
1093#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT  0x83F1
1094#endif /* GL_EXT_texture_compression_dxt1 */
1095
1096#ifndef GL_EXT_texture_compression_s3tc
1097#define GL_EXT_texture_compression_s3tc 1
1098#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT  0x83F2
1099#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT  0x83F3
1100#endif /* GL_EXT_texture_compression_s3tc */
1101
1102#ifndef GL_EXT_texture_filter_anisotropic
1103#define GL_EXT_texture_filter_anisotropic 1
1104#define GL_TEXTURE_MAX_ANISOTROPY_EXT     0x84FE
1105#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
1106#endif /* GL_EXT_texture_filter_anisotropic */
1107
1108#ifndef GL_EXT_texture_format_BGRA8888
1109#define GL_EXT_texture_format_BGRA8888 1
1110#endif /* GL_EXT_texture_format_BGRA8888 */
1111
1112#ifndef GL_EXT_texture_rg
1113#define GL_EXT_texture_rg 1
1114#define GL_RED_EXT                        0x1903
1115#define GL_RG_EXT                         0x8227
1116#define GL_R8_EXT                         0x8229
1117#define GL_RG8_EXT                        0x822B
1118#endif /* GL_EXT_texture_rg */
1119
1120#ifndef GL_EXT_texture_sRGB_decode
1121#define GL_EXT_texture_sRGB_decode 1
1122#define GL_TEXTURE_SRGB_DECODE_EXT        0x8A48
1123#define GL_DECODE_EXT                     0x8A49
1124#define GL_SKIP_DECODE_EXT                0x8A4A
1125#endif /* GL_EXT_texture_sRGB_decode */
1126
1127#ifndef GL_EXT_texture_storage
1128#define GL_EXT_texture_storage 1
1129#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT   0x912F
1130#define GL_ALPHA8_EXT                     0x803C
1131#define GL_LUMINANCE8_EXT                 0x8040
1132#define GL_LUMINANCE8_ALPHA8_EXT          0x8045
1133#define GL_RGBA32F_EXT                    0x8814
1134#define GL_RGB32F_EXT                     0x8815
1135#define GL_ALPHA32F_EXT                   0x8816
1136#define GL_LUMINANCE32F_EXT               0x8818
1137#define GL_LUMINANCE_ALPHA32F_EXT         0x8819
1138#define GL_ALPHA16F_EXT                   0x881C
1139#define GL_LUMINANCE16F_EXT               0x881E
1140#define GL_LUMINANCE_ALPHA16F_EXT         0x881F
1141#define GL_R32F_EXT                       0x822E
1142#define GL_RG32F_EXT                      0x8230
1143typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
1144typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
1145typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
1146typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
1147typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
1148typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
1149#ifdef GL_GLEXT_PROTOTYPES
1150GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
1151GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
1152GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
1153GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
1154GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
1155GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
1156#endif
1157#endif /* GL_EXT_texture_storage */
1158
1159#ifndef GL_EXT_texture_type_2_10_10_10_REV
1160#define GL_EXT_texture_type_2_10_10_10_REV 1
1161#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
1162#endif /* GL_EXT_texture_type_2_10_10_10_REV */
1163
1164#ifndef GL_EXT_unpack_subimage
1165#define GL_EXT_unpack_subimage 1
1166#define GL_UNPACK_ROW_LENGTH_EXT          0x0CF2
1167#define GL_UNPACK_SKIP_ROWS_EXT           0x0CF3
1168#define GL_UNPACK_SKIP_PIXELS_EXT         0x0CF4
1169#endif /* GL_EXT_unpack_subimage */
1170
1171#ifndef GL_FJ_shader_binary_GCCSO
1172#define GL_FJ_shader_binary_GCCSO 1
1173#define GL_GCCSO_SHADER_BINARY_FJ         0x9260
1174#endif /* GL_FJ_shader_binary_GCCSO */
1175
1176#ifndef GL_IMG_multisampled_render_to_texture
1177#define GL_IMG_multisampled_render_to_texture 1
1178#define GL_RENDERBUFFER_SAMPLES_IMG       0x9133
1179#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
1180#define GL_MAX_SAMPLES_IMG                0x9135
1181#define GL_TEXTURE_SAMPLES_IMG            0x9136
1182typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
1183typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
1184#ifdef GL_GLEXT_PROTOTYPES
1185GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
1186GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
1187#endif
1188#endif /* GL_IMG_multisampled_render_to_texture */
1189
1190#ifndef GL_IMG_program_binary
1191#define GL_IMG_program_binary 1
1192#define GL_SGX_PROGRAM_BINARY_IMG         0x9130
1193#endif /* GL_IMG_program_binary */
1194
1195#ifndef GL_IMG_read_format
1196#define GL_IMG_read_format 1
1197#define GL_BGRA_IMG                       0x80E1
1198#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
1199#endif /* GL_IMG_read_format */
1200
1201#ifndef GL_IMG_shader_binary
1202#define GL_IMG_shader_binary 1
1203#define GL_SGX_BINARY_IMG                 0x8C0A
1204#endif /* GL_IMG_shader_binary */
1205
1206#ifndef GL_IMG_texture_compression_pvrtc
1207#define GL_IMG_texture_compression_pvrtc 1
1208#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
1209#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
1210#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
1211#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
1212#endif /* GL_IMG_texture_compression_pvrtc */
1213
1214#ifndef GL_IMG_texture_compression_pvrtc2
1215#define GL_IMG_texture_compression_pvrtc2 1
1216#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
1217#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
1218#endif /* GL_IMG_texture_compression_pvrtc2 */
1219
1220#ifndef GL_INTEL_performance_query
1221#define GL_INTEL_performance_query 1
1222#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000
1223#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001
1224#define GL_PERFQUERY_WAIT_INTEL           0x83FB
1225#define GL_PERFQUERY_FLUSH_INTEL          0x83FA
1226#define GL_PERFQUERY_DONOT_FLUSH_INTEL    0x83F9
1227#define GL_PERFQUERY_COUNTER_EVENT_INTEL  0x94F0
1228#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1
1229#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2
1230#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3
1231#define GL_PERFQUERY_COUNTER_RAW_INTEL    0x94F4
1232#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5
1233#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8
1234#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9
1235#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA
1236#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB
1237#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC
1238#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD
1239#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE
1240#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF
1241#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500
1242typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle);
1243typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle);
1244typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle);
1245typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle);
1246typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId);
1247typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId);
1248typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
1249typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
1250typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId);
1251typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
1252#ifdef GL_GLEXT_PROTOTYPES
1253GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle);
1254GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle);
1255GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle);
1256GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle);
1257GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId);
1258GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId);
1259GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
1260GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten);
1261GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId);
1262GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
1263#endif
1264#endif /* GL_INTEL_performance_query */
1265
1266#ifndef GL_NV_blend_equation_advanced
1267#define GL_NV_blend_equation_advanced 1
1268#define GL_BLEND_OVERLAP_NV               0x9281
1269#define GL_BLEND_PREMULTIPLIED_SRC_NV     0x9280
1270#define GL_BLUE_NV                        0x1905
1271#define GL_COLORBURN_NV                   0x929A
1272#define GL_COLORDODGE_NV                  0x9299
1273#define GL_CONJOINT_NV                    0x9284
1274#define GL_CONTRAST_NV                    0x92A1
1275#define GL_DARKEN_NV                      0x9297
1276#define GL_DIFFERENCE_NV                  0x929E
1277#define GL_DISJOINT_NV                    0x9283
1278#define GL_DST_ATOP_NV                    0x928F
1279#define GL_DST_IN_NV                      0x928B
1280#define GL_DST_NV                         0x9287
1281#define GL_DST_OUT_NV                     0x928D
1282#define GL_DST_OVER_NV                    0x9289
1283#define GL_EXCLUSION_NV                   0x92A0
1284#define GL_GREEN_NV                       0x1904
1285#define GL_HARDLIGHT_NV                   0x929B
1286#define GL_HARDMIX_NV                     0x92A9
1287#define GL_HSL_COLOR_NV                   0x92AF
1288#define GL_HSL_HUE_NV                     0x92AD
1289#define GL_HSL_LUMINOSITY_NV              0x92B0
1290#define GL_HSL_SATURATION_NV              0x92AE
1291#define GL_INVERT_OVG_NV                  0x92B4
1292#define GL_INVERT_RGB_NV                  0x92A3
1293#define GL_LIGHTEN_NV                     0x9298
1294#define GL_LINEARBURN_NV                  0x92A5
1295#define GL_LINEARDODGE_NV                 0x92A4
1296#define GL_LINEARLIGHT_NV                 0x92A7
1297#define GL_MINUS_CLAMPED_NV               0x92B3
1298#define GL_MINUS_NV                       0x929F
1299#define GL_MULTIPLY_NV                    0x9294
1300#define GL_OVERLAY_NV                     0x9296
1301#define GL_PINLIGHT_NV                    0x92A8
1302#define GL_PLUS_CLAMPED_ALPHA_NV          0x92B2
1303#define GL_PLUS_CLAMPED_NV                0x92B1
1304#define GL_PLUS_DARKER_NV                 0x9292
1305#define GL_PLUS_NV                        0x9291
1306#define GL_RED_NV                         0x1903
1307#define GL_SCREEN_NV                      0x9295
1308#define GL_SOFTLIGHT_NV                   0x929C
1309#define GL_SRC_ATOP_NV                    0x928E
1310#define GL_SRC_IN_NV                      0x928A
1311#define GL_SRC_NV                         0x9286
1312#define GL_SRC_OUT_NV                     0x928C
1313#define GL_SRC_OVER_NV                    0x9288
1314#define GL_UNCORRELATED_NV                0x9282
1315#define GL_VIVIDLIGHT_NV                  0x92A6
1316#define GL_XOR_NV                         0x1506
1317typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
1318typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void);
1319#ifdef GL_GLEXT_PROTOTYPES
1320GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value);
1321GL_APICALL void GL_APIENTRY glBlendBarrierNV (void);
1322#endif
1323#endif /* GL_NV_blend_equation_advanced */
1324
1325#ifndef GL_NV_blend_equation_advanced_coherent
1326#define GL_NV_blend_equation_advanced_coherent 1
1327#define GL_BLEND_ADVANCED_COHERENT_NV     0x9285
1328#endif /* GL_NV_blend_equation_advanced_coherent */
1329
1330#ifndef GL_NV_copy_buffer
1331#define GL_NV_copy_buffer 1
1332#define GL_COPY_READ_BUFFER_NV            0x8F36
1333#define GL_COPY_WRITE_BUFFER_NV           0x8F37
1334typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
1335#ifdef GL_GLEXT_PROTOTYPES
1336GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
1337#endif
1338#endif /* GL_NV_copy_buffer */
1339
1340#ifndef GL_NV_coverage_sample
1341#define GL_NV_coverage_sample 1
1342#define GL_COVERAGE_COMPONENT_NV          0x8ED0
1343#define GL_COVERAGE_COMPONENT4_NV         0x8ED1
1344#define GL_COVERAGE_ATTACHMENT_NV         0x8ED2
1345#define GL_COVERAGE_BUFFERS_NV            0x8ED3
1346#define GL_COVERAGE_SAMPLES_NV            0x8ED4
1347#define GL_COVERAGE_ALL_FRAGMENTS_NV      0x8ED5
1348#define GL_COVERAGE_EDGE_FRAGMENTS_NV     0x8ED6
1349#define GL_COVERAGE_AUTOMATIC_NV          0x8ED7
1350#define GL_COVERAGE_BUFFER_BIT_NV         0x00008000
1351typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
1352typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
1353#ifdef GL_GLEXT_PROTOTYPES
1354GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
1355GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
1356#endif
1357#endif /* GL_NV_coverage_sample */
1358
1359#ifndef GL_NV_depth_nonlinear
1360#define GL_NV_depth_nonlinear 1
1361#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
1362#endif /* GL_NV_depth_nonlinear */
1363
1364#ifndef GL_NV_draw_buffers
1365#define GL_NV_draw_buffers 1
1366#define GL_MAX_DRAW_BUFFERS_NV            0x8824
1367#define GL_DRAW_BUFFER0_NV                0x8825
1368#define GL_DRAW_BUFFER1_NV                0x8826
1369#define GL_DRAW_BUFFER2_NV                0x8827
1370#define GL_DRAW_BUFFER3_NV                0x8828
1371#define GL_DRAW_BUFFER4_NV                0x8829
1372#define GL_DRAW_BUFFER5_NV                0x882A
1373#define GL_DRAW_BUFFER6_NV                0x882B
1374#define GL_DRAW_BUFFER7_NV                0x882C
1375#define GL_DRAW_BUFFER8_NV                0x882D
1376#define GL_DRAW_BUFFER9_NV                0x882E
1377#define GL_DRAW_BUFFER10_NV               0x882F
1378#define GL_DRAW_BUFFER11_NV               0x8830
1379#define GL_DRAW_BUFFER12_NV               0x8831
1380#define GL_DRAW_BUFFER13_NV               0x8832
1381#define GL_DRAW_BUFFER14_NV               0x8833
1382#define GL_DRAW_BUFFER15_NV               0x8834
1383#define GL_COLOR_ATTACHMENT0_NV           0x8CE0
1384#define GL_COLOR_ATTACHMENT1_NV           0x8CE1
1385#define GL_COLOR_ATTACHMENT2_NV           0x8CE2
1386#define GL_COLOR_ATTACHMENT3_NV           0x8CE3
1387#define GL_COLOR_ATTACHMENT4_NV           0x8CE4
1388#define GL_COLOR_ATTACHMENT5_NV           0x8CE5
1389#define GL_COLOR_ATTACHMENT6_NV           0x8CE6
1390#define GL_COLOR_ATTACHMENT7_NV           0x8CE7
1391#define GL_COLOR_ATTACHMENT8_NV           0x8CE8
1392#define GL_COLOR_ATTACHMENT9_NV           0x8CE9
1393#define GL_COLOR_ATTACHMENT10_NV          0x8CEA
1394#define GL_COLOR_ATTACHMENT11_NV          0x8CEB
1395#define GL_COLOR_ATTACHMENT12_NV          0x8CEC
1396#define GL_COLOR_ATTACHMENT13_NV          0x8CED
1397#define GL_COLOR_ATTACHMENT14_NV          0x8CEE
1398#define GL_COLOR_ATTACHMENT15_NV          0x8CEF
1399typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
1400#ifdef GL_GLEXT_PROTOTYPES
1401GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
1402#endif
1403#endif /* GL_NV_draw_buffers */
1404
1405#ifndef GL_NV_draw_instanced
1406#define GL_NV_draw_instanced 1
1407typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
1408typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
1409#ifdef GL_GLEXT_PROTOTYPES
1410GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
1411GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
1412#endif
1413#endif /* GL_NV_draw_instanced */
1414
1415#ifndef GL_NV_explicit_attrib_location
1416#define GL_NV_explicit_attrib_location 1
1417#endif /* GL_NV_explicit_attrib_location */
1418
1419#ifndef GL_NV_fbo_color_attachments
1420#define GL_NV_fbo_color_attachments 1
1421#define GL_MAX_COLOR_ATTACHMENTS_NV       0x8CDF
1422#endif /* GL_NV_fbo_color_attachments */
1423
1424#ifndef GL_NV_fence
1425#define GL_NV_fence 1
1426#define GL_ALL_COMPLETED_NV               0x84F2
1427#define GL_FENCE_STATUS_NV                0x84F3
1428#define GL_FENCE_CONDITION_NV             0x84F4
1429typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
1430typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
1431typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
1432typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
1433typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
1434typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
1435typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
1436#ifdef GL_GLEXT_PROTOTYPES
1437GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
1438GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
1439GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
1440GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
1441GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
1442GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence);
1443GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
1444#endif
1445#endif /* GL_NV_fence */
1446
1447#ifndef GL_NV_framebuffer_blit
1448#define GL_NV_framebuffer_blit 1
1449#define GL_READ_FRAMEBUFFER_NV            0x8CA8
1450#define GL_DRAW_FRAMEBUFFER_NV            0x8CA9
1451#define GL_DRAW_FRAMEBUFFER_BINDING_NV    0x8CA6
1452#define GL_READ_FRAMEBUFFER_BINDING_NV    0x8CAA
1453typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
1454#ifdef GL_GLEXT_PROTOTYPES
1455GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
1456#endif
1457#endif /* GL_NV_framebuffer_blit */
1458
1459#ifndef GL_NV_framebuffer_multisample
1460#define GL_NV_framebuffer_multisample 1
1461#define GL_RENDERBUFFER_SAMPLES_NV        0x8CAB
1462#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56
1463#define GL_MAX_SAMPLES_NV                 0x8D57
1464typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
1465#ifdef GL_GLEXT_PROTOTYPES
1466GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
1467#endif
1468#endif /* GL_NV_framebuffer_multisample */
1469
1470#ifndef GL_NV_generate_mipmap_sRGB
1471#define GL_NV_generate_mipmap_sRGB 1
1472#endif /* GL_NV_generate_mipmap_sRGB */
1473
1474#ifndef GL_NV_instanced_arrays
1475#define GL_NV_instanced_arrays 1
1476#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE
1477typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor);
1478#ifdef GL_GLEXT_PROTOTYPES
1479GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor);
1480#endif
1481#endif /* GL_NV_instanced_arrays */
1482
1483#ifndef GL_NV_non_square_matrices
1484#define GL_NV_non_square_matrices 1
1485#define GL_FLOAT_MAT2x3_NV                0x8B65
1486#define GL_FLOAT_MAT2x4_NV                0x8B66
1487#define GL_FLOAT_MAT3x2_NV                0x8B67
1488#define GL_FLOAT_MAT3x4_NV                0x8B68
1489#define GL_FLOAT_MAT4x2_NV                0x8B69
1490#define GL_FLOAT_MAT4x3_NV                0x8B6A
1491typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1492typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1493typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1494typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1495typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1496typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1497#ifdef GL_GLEXT_PROTOTYPES
1498GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1499GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1500GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1501GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1502GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1503GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1504#endif
1505#endif /* GL_NV_non_square_matrices */
1506
1507#ifndef GL_NV_read_buffer
1508#define GL_NV_read_buffer 1
1509#define GL_READ_BUFFER_NV                 0x0C02
1510typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
1511#ifdef GL_GLEXT_PROTOTYPES
1512GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
1513#endif
1514#endif /* GL_NV_read_buffer */
1515
1516#ifndef GL_NV_read_buffer_front
1517#define GL_NV_read_buffer_front 1
1518#endif /* GL_NV_read_buffer_front */
1519
1520#ifndef GL_NV_read_depth
1521#define GL_NV_read_depth 1
1522#endif /* GL_NV_read_depth */
1523
1524#ifndef GL_NV_read_depth_stencil
1525#define GL_NV_read_depth_stencil 1
1526#endif /* GL_NV_read_depth_stencil */
1527
1528#ifndef GL_NV_read_stencil
1529#define GL_NV_read_stencil 1
1530#endif /* GL_NV_read_stencil */
1531
1532#ifndef GL_NV_sRGB_formats
1533#define GL_NV_sRGB_formats 1
1534#define GL_SLUMINANCE_NV                  0x8C46
1535#define GL_SLUMINANCE_ALPHA_NV            0x8C44
1536#define GL_SRGB8_NV                       0x8C41
1537#define GL_SLUMINANCE8_NV                 0x8C47
1538#define GL_SLUMINANCE8_ALPHA8_NV          0x8C45
1539#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV   0x8C4C
1540#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D
1541#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E
1542#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F
1543#define GL_ETC1_SRGB8_NV                  0x88EE
1544#endif /* GL_NV_sRGB_formats */
1545
1546#ifndef GL_NV_shadow_samplers_array
1547#define GL_NV_shadow_samplers_array 1
1548#define GL_SAMPLER_2D_ARRAY_SHADOW_NV     0x8DC4
1549#endif /* GL_NV_shadow_samplers_array */
1550
1551#ifndef GL_NV_shadow_samplers_cube
1552#define GL_NV_shadow_samplers_cube 1
1553#define GL_SAMPLER_CUBE_SHADOW_NV         0x8DC5
1554#endif /* GL_NV_shadow_samplers_cube */
1555
1556#ifndef GL_NV_texture_border_clamp
1557#define GL_NV_texture_border_clamp 1
1558#define GL_TEXTURE_BORDER_COLOR_NV        0x1004
1559#define GL_CLAMP_TO_BORDER_NV             0x812D
1560#endif /* GL_NV_texture_border_clamp */
1561
1562#ifndef GL_NV_texture_compression_s3tc_update
1563#define GL_NV_texture_compression_s3tc_update 1
1564#endif /* GL_NV_texture_compression_s3tc_update */
1565
1566#ifndef GL_NV_texture_npot_2D_mipmap
1567#define GL_NV_texture_npot_2D_mipmap 1
1568#endif /* GL_NV_texture_npot_2D_mipmap */
1569
1570#ifndef GL_QCOM_alpha_test
1571#define GL_QCOM_alpha_test 1
1572#define GL_ALPHA_TEST_QCOM                0x0BC0
1573#define GL_ALPHA_TEST_FUNC_QCOM           0x0BC1
1574#define GL_ALPHA_TEST_REF_QCOM            0x0BC2
1575typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
1576#ifdef GL_GLEXT_PROTOTYPES
1577GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
1578#endif
1579#endif /* GL_QCOM_alpha_test */
1580
1581#ifndef GL_QCOM_binning_control
1582#define GL_QCOM_binning_control 1
1583#define GL_BINNING_CONTROL_HINT_QCOM      0x8FB0
1584#define GL_CPU_OPTIMIZED_QCOM             0x8FB1
1585#define GL_GPU_OPTIMIZED_QCOM             0x8FB2
1586#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3
1587#endif /* GL_QCOM_binning_control */
1588
1589#ifndef GL_QCOM_driver_control
1590#define GL_QCOM_driver_control 1
1591typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
1592typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
1593typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
1594typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
1595#ifdef GL_GLEXT_PROTOTYPES
1596GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
1597GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
1598GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
1599GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
1600#endif
1601#endif /* GL_QCOM_driver_control */
1602
1603#ifndef GL_QCOM_extended_get
1604#define GL_QCOM_extended_get 1
1605#define GL_TEXTURE_WIDTH_QCOM             0x8BD2
1606#define GL_TEXTURE_HEIGHT_QCOM            0x8BD3
1607#define GL_TEXTURE_DEPTH_QCOM             0x8BD4
1608#define GL_TEXTURE_INTERNAL_FORMAT_QCOM   0x8BD5
1609#define GL_TEXTURE_FORMAT_QCOM            0x8BD6
1610#define GL_TEXTURE_TYPE_QCOM              0x8BD7
1611#define GL_TEXTURE_IMAGE_VALID_QCOM       0x8BD8
1612#define GL_TEXTURE_NUM_LEVELS_QCOM        0x8BD9
1613#define GL_TEXTURE_TARGET_QCOM            0x8BDA
1614#define GL_TEXTURE_OBJECT_VALID_QCOM      0x8BDB
1615#define GL_STATE_RESTORE                  0x8BDC
1616typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
1617typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
1618typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
1619typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
1620typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
1621typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
1622typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
1623typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params);
1624#ifdef GL_GLEXT_PROTOTYPES
1625GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
1626GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
1627GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
1628GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
1629GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
1630GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
1631GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
1632GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params);
1633#endif
1634#endif /* GL_QCOM_extended_get */
1635
1636#ifndef GL_QCOM_extended_get2
1637#define GL_QCOM_extended_get2 1
1638typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
1639typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
1640typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
1641typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
1642#ifdef GL_GLEXT_PROTOTYPES
1643GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
1644GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
1645GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
1646GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
1647#endif
1648#endif /* GL_QCOM_extended_get2 */
1649
1650#ifndef GL_QCOM_perfmon_global_mode
1651#define GL_QCOM_perfmon_global_mode 1
1652#define GL_PERFMON_GLOBAL_MODE_QCOM       0x8FA0
1653#endif /* GL_QCOM_perfmon_global_mode */
1654
1655#ifndef GL_QCOM_tiled_rendering
1656#define GL_QCOM_tiled_rendering 1
1657#define GL_COLOR_BUFFER_BIT0_QCOM         0x00000001
1658#define GL_COLOR_BUFFER_BIT1_QCOM         0x00000002
1659#define GL_COLOR_BUFFER_BIT2_QCOM         0x00000004
1660#define GL_COLOR_BUFFER_BIT3_QCOM         0x00000008
1661#define GL_COLOR_BUFFER_BIT4_QCOM         0x00000010
1662#define GL_COLOR_BUFFER_BIT5_QCOM         0x00000020
1663#define GL_COLOR_BUFFER_BIT6_QCOM         0x00000040
1664#define GL_COLOR_BUFFER_BIT7_QCOM         0x00000080
1665#define GL_DEPTH_BUFFER_BIT0_QCOM         0x00000100
1666#define GL_DEPTH_BUFFER_BIT1_QCOM         0x00000200
1667#define GL_DEPTH_BUFFER_BIT2_QCOM         0x00000400
1668#define GL_DEPTH_BUFFER_BIT3_QCOM         0x00000800
1669#define GL_DEPTH_BUFFER_BIT4_QCOM         0x00001000
1670#define GL_DEPTH_BUFFER_BIT5_QCOM         0x00002000
1671#define GL_DEPTH_BUFFER_BIT6_QCOM         0x00004000
1672#define GL_DEPTH_BUFFER_BIT7_QCOM         0x00008000
1673#define GL_STENCIL_BUFFER_BIT0_QCOM       0x00010000
1674#define GL_STENCIL_BUFFER_BIT1_QCOM       0x00020000
1675#define GL_STENCIL_BUFFER_BIT2_QCOM       0x00040000
1676#define GL_STENCIL_BUFFER_BIT3_QCOM       0x00080000
1677#define GL_STENCIL_BUFFER_BIT4_QCOM       0x00100000
1678#define GL_STENCIL_BUFFER_BIT5_QCOM       0x00200000
1679#define GL_STENCIL_BUFFER_BIT6_QCOM       0x00400000
1680#define GL_STENCIL_BUFFER_BIT7_QCOM       0x00800000
1681#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM   0x01000000
1682#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM   0x02000000
1683#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM   0x04000000
1684#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM   0x08000000
1685#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM   0x10000000
1686#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM   0x20000000
1687#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM   0x40000000
1688#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM   0x80000000
1689typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
1690typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
1691#ifdef GL_GLEXT_PROTOTYPES
1692GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
1693GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
1694#endif
1695#endif /* GL_QCOM_tiled_rendering */
1696
1697#ifndef GL_QCOM_writeonly_rendering
1698#define GL_QCOM_writeonly_rendering 1
1699#define GL_WRITEONLY_RENDERING_QCOM       0x8823
1700#endif /* GL_QCOM_writeonly_rendering */
1701
1702#ifndef GL_VIV_shader_binary
1703#define GL_VIV_shader_binary 1
1704#define GL_SHADER_BINARY_VIV              0x8FC4
1705#endif /* GL_VIV_shader_binary */
1706
1707#ifdef __cplusplus
1708}
1709#endif
1710
1711#endif
Property changes on: branches/osd/src/lib/khronos/GLES2/gl2ext.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/GLES2/gl2platform.h
r0r31734
1#ifndef __gl2platform_h_
2#define __gl2platform_h_
3
4/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
5
6/*
7 * This document is licensed under the SGI Free Software B License Version
8 * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
9 */
10
11/* Platform-specific types and definitions for OpenGL ES 2.X  gl2.h
12 *
13 * Adopters may modify khrplatform.h and this file to suit their platform.
14 * You are encouraged to submit all modifications to the Khronos group so that
15 * they can be included in future versions of this file.  Please submit changes
16 * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
17 * by filing a bug against product "OpenGL-ES" component "Registry".
18 */
19
20#include <KHR/khrplatform.h>
21
22#ifndef GL_APICALL
23#define GL_APICALL  KHRONOS_APICALL
24#endif
25
26#ifndef GL_APIENTRY
27#define GL_APIENTRY KHRONOS_APIENTRY
28#endif
29
30#endif /* __gl2platform_h_ */
Property changes on: branches/osd/src/lib/khronos/GLES2/gl2platform.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/GLES3/gl3platform.h
r0r31734
1#ifndef __gl3platform_h_
2#define __gl3platform_h_
3
4/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */
5
6/*
7 * This document is licensed under the SGI Free Software B License Version
8 * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
9 */
10
11/* Platform-specific types and definitions for OpenGL ES 3.X  gl3.h
12 *
13 * Adopters may modify khrplatform.h and this file to suit their platform.
14 * You are encouraged to submit all modifications to the Khronos group so that
15 * they can be included in future versions of this file.  Please submit changes
16 * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
17 * by filing a bug against product "OpenGL-ES" component "Registry".
18 */
19
20#include <KHR/khrplatform.h>
21
22#ifndef GL_APICALL
23#define GL_APICALL  KHRONOS_APICALL
24#endif
25
26#ifndef GL_APIENTRY
27#define GL_APIENTRY KHRONOS_APIENTRY
28#endif
29
30#endif /* __gl3platform_h_ */
Property changes on: branches/osd/src/lib/khronos/GLES3/gl3platform.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/GLES3/gl3.h
r0r31734
1#ifndef __gl3_h_
2#define __gl3_h_ 1
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/*
9** Copyright (c) 2013-2014 The Khronos Group Inc.
10**
11** Permission is hereby granted, free of charge, to any person obtaining a
12** copy of this software and/or associated documentation files (the
13** "Materials"), to deal in the Materials without restriction, including
14** without limitation the rights to use, copy, modify, merge, publish,
15** distribute, sublicense, and/or sell copies of the Materials, and to
16** permit persons to whom the Materials are furnished to do so, subject to
17** the following conditions:
18**
19** The above copyright notice and this permission notice shall be included
20** in all copies or substantial portions of the Materials.
21**
22** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
29*/
30/*
31** This header is generated from the Khronos OpenGL / OpenGL ES XML
32** API Registry. The current version of the Registry, generator scripts
33** used to make the header, and the header can be found at
34**   http://www.opengl.org/registry/
35**
36** Khronos $Revision: 26006 $ on $Date: 2014-03-19 01:26:15 -0700 (Wed, 19 Mar 2014) $
37*/
38
39#include <GLES3/gl3platform.h>
40
41/* Generated on date 20140319 */
42
43/* Generated C header for:
44 * API: gles2
45 * Profile: common
46 * Versions considered: 2\.[0-9]|3.0
47 * Versions emitted: .*
48 * Default extensions included: None
49 * Additional extensions included: _nomatch_^
50 * Extensions removed: _nomatch_^
51 */
52
53#ifndef GL_ES_VERSION_2_0
54#define GL_ES_VERSION_2_0 1
55#include <KHR/khrplatform.h>
56typedef khronos_int8_t GLbyte;
57typedef khronos_float_t GLclampf;
58typedef khronos_int32_t GLfixed;
59typedef short GLshort;
60typedef unsigned short GLushort;
61typedef void GLvoid;
62typedef struct __GLsync *GLsync;
63typedef khronos_int64_t GLint64;
64typedef khronos_uint64_t GLuint64;
65typedef unsigned int GLenum;
66typedef unsigned int GLuint;
67typedef char GLchar;
68typedef khronos_float_t GLfloat;
69typedef khronos_ssize_t GLsizeiptr;
70typedef khronos_intptr_t GLintptr;
71typedef unsigned int GLbitfield;
72typedef int GLint;
73typedef unsigned char GLboolean;
74typedef int GLsizei;
75typedef khronos_uint8_t GLubyte;
76#define GL_DEPTH_BUFFER_BIT               0x00000100
77#define GL_STENCIL_BUFFER_BIT             0x00000400
78#define GL_COLOR_BUFFER_BIT               0x00004000
79#define GL_FALSE                          0
80#define GL_TRUE                           1
81#define GL_POINTS                         0x0000
82#define GL_LINES                          0x0001
83#define GL_LINE_LOOP                      0x0002
84#define GL_LINE_STRIP                     0x0003
85#define GL_TRIANGLES                      0x0004
86#define GL_TRIANGLE_STRIP                 0x0005
87#define GL_TRIANGLE_FAN                   0x0006
88#define GL_ZERO                           0
89#define GL_ONE                            1
90#define GL_SRC_COLOR                      0x0300
91#define GL_ONE_MINUS_SRC_COLOR            0x0301
92#define GL_SRC_ALPHA                      0x0302
93#define GL_ONE_MINUS_SRC_ALPHA            0x0303
94#define GL_DST_ALPHA                      0x0304
95#define GL_ONE_MINUS_DST_ALPHA            0x0305
96#define GL_DST_COLOR                      0x0306
97#define GL_ONE_MINUS_DST_COLOR            0x0307
98#define GL_SRC_ALPHA_SATURATE             0x0308
99#define GL_FUNC_ADD                       0x8006
100#define GL_BLEND_EQUATION                 0x8009
101#define GL_BLEND_EQUATION_RGB             0x8009
102#define GL_BLEND_EQUATION_ALPHA           0x883D
103#define GL_FUNC_SUBTRACT                  0x800A
104#define GL_FUNC_REVERSE_SUBTRACT          0x800B
105#define GL_BLEND_DST_RGB                  0x80C8
106#define GL_BLEND_SRC_RGB                  0x80C9
107#define GL_BLEND_DST_ALPHA                0x80CA
108#define GL_BLEND_SRC_ALPHA                0x80CB
109#define GL_CONSTANT_COLOR                 0x8001
110#define GL_ONE_MINUS_CONSTANT_COLOR       0x8002
111#define GL_CONSTANT_ALPHA                 0x8003
112#define GL_ONE_MINUS_CONSTANT_ALPHA       0x8004
113#define GL_BLEND_COLOR                    0x8005
114#define GL_ARRAY_BUFFER                   0x8892
115#define GL_ELEMENT_ARRAY_BUFFER           0x8893
116#define GL_ARRAY_BUFFER_BINDING           0x8894
117#define GL_ELEMENT_ARRAY_BUFFER_BINDING   0x8895
118#define GL_STREAM_DRAW                    0x88E0
119#define GL_STATIC_DRAW                    0x88E4
120#define GL_DYNAMIC_DRAW                   0x88E8
121#define GL_BUFFER_SIZE                    0x8764
122#define GL_BUFFER_USAGE                   0x8765
123#define GL_CURRENT_VERTEX_ATTRIB          0x8626
124#define GL_FRONT                          0x0404
125#define GL_BACK                           0x0405
126#define GL_FRONT_AND_BACK                 0x0408
127#define GL_TEXTURE_2D                     0x0DE1
128#define GL_CULL_FACE                      0x0B44
129#define GL_BLEND                          0x0BE2
130#define GL_DITHER                         0x0BD0
131#define GL_STENCIL_TEST                   0x0B90
132#define GL_DEPTH_TEST                     0x0B71
133#define GL_SCISSOR_TEST                   0x0C11
134#define GL_POLYGON_OFFSET_FILL            0x8037
135#define GL_SAMPLE_ALPHA_TO_COVERAGE       0x809E
136#define GL_SAMPLE_COVERAGE                0x80A0
137#define GL_NO_ERROR                       0
138#define GL_INVALID_ENUM                   0x0500
139#define GL_INVALID_VALUE                  0x0501
140#define GL_INVALID_OPERATION              0x0502
141#define GL_OUT_OF_MEMORY                  0x0505
142#define GL_CW                             0x0900
143#define GL_CCW                            0x0901
144#define GL_LINE_WIDTH                     0x0B21
145#define GL_ALIASED_POINT_SIZE_RANGE       0x846D
146#define GL_ALIASED_LINE_WIDTH_RANGE       0x846E
147#define GL_CULL_FACE_MODE                 0x0B45
148#define GL_FRONT_FACE                     0x0B46
149#define GL_DEPTH_RANGE                    0x0B70
150#define GL_DEPTH_WRITEMASK                0x0B72
151#define GL_DEPTH_CLEAR_VALUE              0x0B73
152#define GL_DEPTH_FUNC                     0x0B74
153#define GL_STENCIL_CLEAR_VALUE            0x0B91
154#define GL_STENCIL_FUNC                   0x0B92
155#define GL_STENCIL_FAIL                   0x0B94
156#define GL_STENCIL_PASS_DEPTH_FAIL        0x0B95
157#define GL_STENCIL_PASS_DEPTH_PASS        0x0B96
158#define GL_STENCIL_REF                    0x0B97
159#define GL_STENCIL_VALUE_MASK             0x0B93
160#define GL_STENCIL_WRITEMASK              0x0B98
161#define GL_STENCIL_BACK_FUNC              0x8800
162#define GL_STENCIL_BACK_FAIL              0x8801
163#define GL_STENCIL_BACK_PASS_DEPTH_FAIL   0x8802
164#define GL_STENCIL_BACK_PASS_DEPTH_PASS   0x8803
165#define GL_STENCIL_BACK_REF               0x8CA3
166#define GL_STENCIL_BACK_VALUE_MASK        0x8CA4
167#define GL_STENCIL_BACK_WRITEMASK         0x8CA5
168#define GL_VIEWPORT                       0x0BA2
169#define GL_SCISSOR_BOX                    0x0C10
170#define GL_COLOR_CLEAR_VALUE              0x0C22
171#define GL_COLOR_WRITEMASK                0x0C23
172#define GL_UNPACK_ALIGNMENT               0x0CF5
173#define GL_PACK_ALIGNMENT                 0x0D05
174#define GL_MAX_TEXTURE_SIZE               0x0D33
175#define GL_MAX_VIEWPORT_DIMS              0x0D3A
176#define GL_SUBPIXEL_BITS                  0x0D50
177#define GL_RED_BITS                       0x0D52
178#define GL_GREEN_BITS                     0x0D53
179#define GL_BLUE_BITS                      0x0D54
180#define GL_ALPHA_BITS                     0x0D55
181#define GL_DEPTH_BITS                     0x0D56
182#define GL_STENCIL_BITS                   0x0D57
183#define GL_POLYGON_OFFSET_UNITS           0x2A00
184#define GL_POLYGON_OFFSET_FACTOR          0x8038
185#define GL_TEXTURE_BINDING_2D             0x8069
186#define GL_SAMPLE_BUFFERS                 0x80A8
187#define GL_SAMPLES                        0x80A9
188#define GL_SAMPLE_COVERAGE_VALUE          0x80AA
189#define GL_SAMPLE_COVERAGE_INVERT         0x80AB
190#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
191#define GL_COMPRESSED_TEXTURE_FORMATS     0x86A3
192#define GL_DONT_CARE                      0x1100
193#define GL_FASTEST                        0x1101
194#define GL_NICEST                         0x1102
195#define GL_GENERATE_MIPMAP_HINT           0x8192
196#define GL_BYTE                           0x1400
197#define GL_UNSIGNED_BYTE                  0x1401
198#define GL_SHORT                          0x1402
199#define GL_UNSIGNED_SHORT                 0x1403
200#define GL_INT                            0x1404
201#define GL_UNSIGNED_INT                   0x1405
202#define GL_FLOAT                          0x1406
203#define GL_FIXED                          0x140C
204#define GL_DEPTH_COMPONENT                0x1902
205#define GL_ALPHA                          0x1906
206#define GL_RGB                            0x1907
207#define GL_RGBA                           0x1908
208#define GL_LUMINANCE                      0x1909
209#define GL_LUMINANCE_ALPHA                0x190A
210#define GL_UNSIGNED_SHORT_4_4_4_4         0x8033
211#define GL_UNSIGNED_SHORT_5_5_5_1         0x8034
212#define GL_UNSIGNED_SHORT_5_6_5           0x8363
213#define GL_FRAGMENT_SHADER                0x8B30
214#define GL_VERTEX_SHADER                  0x8B31
215#define GL_MAX_VERTEX_ATTRIBS             0x8869
216#define GL_MAX_VERTEX_UNIFORM_VECTORS     0x8DFB
217#define GL_MAX_VARYING_VECTORS            0x8DFC
218#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
219#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
220#define GL_MAX_TEXTURE_IMAGE_UNITS        0x8872
221#define GL_MAX_FRAGMENT_UNIFORM_VECTORS   0x8DFD
222#define GL_SHADER_TYPE                    0x8B4F
223#define GL_DELETE_STATUS                  0x8B80
224#define GL_LINK_STATUS                    0x8B82
225#define GL_VALIDATE_STATUS                0x8B83
226#define GL_ATTACHED_SHADERS               0x8B85
227#define GL_ACTIVE_UNIFORMS                0x8B86
228#define GL_ACTIVE_UNIFORM_MAX_LENGTH      0x8B87
229#define GL_ACTIVE_ATTRIBUTES              0x8B89
230#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH    0x8B8A
231#define GL_SHADING_LANGUAGE_VERSION       0x8B8C
232#define GL_CURRENT_PROGRAM                0x8B8D
233#define GL_NEVER                          0x0200
234#define GL_LESS                           0x0201
235#define GL_EQUAL                          0x0202
236#define GL_LEQUAL                         0x0203
237#define GL_GREATER                        0x0204
238#define GL_NOTEQUAL                       0x0205
239#define GL_GEQUAL                         0x0206
240#define GL_ALWAYS                         0x0207
241#define GL_KEEP                           0x1E00
242#define GL_REPLACE                        0x1E01
243#define GL_INCR                           0x1E02
244#define GL_DECR                           0x1E03
245#define GL_INVERT                         0x150A
246#define GL_INCR_WRAP                      0x8507
247#define GL_DECR_WRAP                      0x8508
248#define GL_VENDOR                         0x1F00
249#define GL_RENDERER                       0x1F01
250#define GL_VERSION                        0x1F02
251#define GL_EXTENSIONS                     0x1F03
252#define GL_NEAREST                        0x2600
253#define GL_LINEAR                         0x2601
254#define GL_NEAREST_MIPMAP_NEAREST         0x2700
255#define GL_LINEAR_MIPMAP_NEAREST          0x2701
256#define GL_NEAREST_MIPMAP_LINEAR          0x2702
257#define GL_LINEAR_MIPMAP_LINEAR           0x2703
258#define GL_TEXTURE_MAG_FILTER             0x2800
259#define GL_TEXTURE_MIN_FILTER             0x2801
260#define GL_TEXTURE_WRAP_S                 0x2802
261#define GL_TEXTURE_WRAP_T                 0x2803
262#define GL_TEXTURE                        0x1702
263#define GL_TEXTURE_CUBE_MAP               0x8513
264#define GL_TEXTURE_BINDING_CUBE_MAP       0x8514
265#define GL_TEXTURE_CUBE_MAP_POSITIVE_X    0x8515
266#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X    0x8516
267#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y    0x8517
268#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y    0x8518
269#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z    0x8519
270#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z    0x851A
271#define GL_MAX_CUBE_MAP_TEXTURE_SIZE      0x851C
272#define GL_TEXTURE0                       0x84C0
273#define GL_TEXTURE1                       0x84C1
274#define GL_TEXTURE2                       0x84C2
275#define GL_TEXTURE3                       0x84C3
276#define GL_TEXTURE4                       0x84C4
277#define GL_TEXTURE5                       0x84C5
278#define GL_TEXTURE6                       0x84C6
279#define GL_TEXTURE7                       0x84C7
280#define GL_TEXTURE8                       0x84C8
281#define GL_TEXTURE9                       0x84C9
282#define GL_TEXTURE10                      0x84CA
283#define GL_TEXTURE11                      0x84CB
284#define GL_TEXTURE12                      0x84CC
285#define GL_TEXTURE13                      0x84CD
286#define GL_TEXTURE14                      0x84CE
287#define GL_TEXTURE15                      0x84CF
288#define GL_TEXTURE16                      0x84D0
289#define GL_TEXTURE17                      0x84D1
290#define GL_TEXTURE18                      0x84D2
291#define GL_TEXTURE19                      0x84D3
292#define GL_TEXTURE20                      0x84D4
293#define GL_TEXTURE21                      0x84D5
294#define GL_TEXTURE22                      0x84D6
295#define GL_TEXTURE23                      0x84D7
296#define GL_TEXTURE24                      0x84D8
297#define GL_TEXTURE25                      0x84D9
298#define GL_TEXTURE26                      0x84DA
299#define GL_TEXTURE27                      0x84DB
300#define GL_TEXTURE28                      0x84DC
301#define GL_TEXTURE29                      0x84DD
302#define GL_TEXTURE30                      0x84DE
303#define GL_TEXTURE31                      0x84DF
304#define GL_ACTIVE_TEXTURE                 0x84E0
305#define GL_REPEAT                         0x2901
306#define GL_CLAMP_TO_EDGE                  0x812F
307#define GL_MIRRORED_REPEAT                0x8370
308#define GL_FLOAT_VEC2                     0x8B50
309#define GL_FLOAT_VEC3                     0x8B51
310#define GL_FLOAT_VEC4                     0x8B52
311#define GL_INT_VEC2                       0x8B53
312#define GL_INT_VEC3                       0x8B54
313#define GL_INT_VEC4                       0x8B55
314#define GL_BOOL                           0x8B56
315#define GL_BOOL_VEC2                      0x8B57
316#define GL_BOOL_VEC3                      0x8B58
317#define GL_BOOL_VEC4                      0x8B59
318#define GL_FLOAT_MAT2                     0x8B5A
319#define GL_FLOAT_MAT3                     0x8B5B
320#define GL_FLOAT_MAT4                     0x8B5C
321#define GL_SAMPLER_2D                     0x8B5E
322#define GL_SAMPLER_CUBE                   0x8B60
323#define GL_VERTEX_ATTRIB_ARRAY_ENABLED    0x8622
324#define GL_VERTEX_ATTRIB_ARRAY_SIZE       0x8623
325#define GL_VERTEX_ATTRIB_ARRAY_STRIDE     0x8624
326#define GL_VERTEX_ATTRIB_ARRAY_TYPE       0x8625
327#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
328#define GL_VERTEX_ATTRIB_ARRAY_POINTER    0x8645
329#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
330#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
331#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
332#define GL_COMPILE_STATUS                 0x8B81
333#define GL_INFO_LOG_LENGTH                0x8B84
334#define GL_SHADER_SOURCE_LENGTH           0x8B88
335#define GL_SHADER_COMPILER                0x8DFA
336#define GL_SHADER_BINARY_FORMATS          0x8DF8
337#define GL_NUM_SHADER_BINARY_FORMATS      0x8DF9
338#define GL_LOW_FLOAT                      0x8DF0
339#define GL_MEDIUM_FLOAT                   0x8DF1
340#define GL_HIGH_FLOAT                     0x8DF2
341#define GL_LOW_INT                        0x8DF3
342#define GL_MEDIUM_INT                     0x8DF4
343#define GL_HIGH_INT                       0x8DF5
344#define GL_FRAMEBUFFER                    0x8D40
345#define GL_RENDERBUFFER                   0x8D41
346#define GL_RGBA4                          0x8056
347#define GL_RGB5_A1                        0x8057
348#define GL_RGB565                         0x8D62
349#define GL_DEPTH_COMPONENT16              0x81A5
350#define GL_STENCIL_INDEX8                 0x8D48
351#define GL_RENDERBUFFER_WIDTH             0x8D42
352#define GL_RENDERBUFFER_HEIGHT            0x8D43
353#define GL_RENDERBUFFER_INTERNAL_FORMAT   0x8D44
354#define GL_RENDERBUFFER_RED_SIZE          0x8D50
355#define GL_RENDERBUFFER_GREEN_SIZE        0x8D51
356#define GL_RENDERBUFFER_BLUE_SIZE         0x8D52
357#define GL_RENDERBUFFER_ALPHA_SIZE        0x8D53
358#define GL_RENDERBUFFER_DEPTH_SIZE        0x8D54
359#define GL_RENDERBUFFER_STENCIL_SIZE      0x8D55
360#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
361#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
362#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
363#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
364#define GL_COLOR_ATTACHMENT0              0x8CE0
365#define GL_DEPTH_ATTACHMENT               0x8D00
366#define GL_STENCIL_ATTACHMENT             0x8D20
367#define GL_NONE                           0
368#define GL_FRAMEBUFFER_COMPLETE           0x8CD5
369#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
370#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
371#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
372#define GL_FRAMEBUFFER_UNSUPPORTED        0x8CDD
373#define GL_FRAMEBUFFER_BINDING            0x8CA6
374#define GL_RENDERBUFFER_BINDING           0x8CA7
375#define GL_MAX_RENDERBUFFER_SIZE          0x84E8
376#define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506
377GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
378GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
379GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
380GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
381GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
382GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
383GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
384GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
385GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
386GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
387GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
388GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
389GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
390GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
391GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
392GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
393GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
394GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
395GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
396GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
397GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
398GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
399GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
400GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
401GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
402GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
403GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
404GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
405GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
406GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
407GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
408GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
409GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
410GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
411GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
412GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
413GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
414GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
415GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
416GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
417GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
418GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
419GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
420GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
421GL_APICALL void GL_APIENTRY glFinish (void);
422GL_APICALL void GL_APIENTRY glFlush (void);
423GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
424GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
425GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
426GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
427GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
428GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
429GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
430GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
431GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
432GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
433GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
434GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
435GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
436GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
437GL_APICALL GLenum GL_APIENTRY glGetError (void);
438GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
439GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
440GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
441GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
442GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
443GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
444GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
445GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
446GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
447GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
448GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
449GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
450GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
451GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
452GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
453GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
454GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
455GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
456GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
457GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
458GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
459GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
460GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
461GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
462GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
463GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
464GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
465GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
466GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
467GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
468GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
469GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
470GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
471GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
472GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
473GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
474GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
475GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
476GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
477GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
478GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
479GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
480GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
481GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
482GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
483GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
484GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
485GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
486GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
487GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
488GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
489GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
490GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
491GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
492GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
493GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
494GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
495GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
496GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
497GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
498GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
499GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
500GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
501GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
502GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
503GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
504GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
505GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
506GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
507GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
508GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
509GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
510GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
511GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
512GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
513GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
514GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
515GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
516GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
517GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
518GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
519#endif /* GL_ES_VERSION_2_0 */
520
521#ifndef GL_ES_VERSION_3_0
522#define GL_ES_VERSION_3_0 1
523typedef unsigned short GLhalf;
524#define GL_READ_BUFFER                    0x0C02
525#define GL_UNPACK_ROW_LENGTH              0x0CF2
526#define GL_UNPACK_SKIP_ROWS               0x0CF3
527#define GL_UNPACK_SKIP_PIXELS             0x0CF4
528#define GL_PACK_ROW_LENGTH                0x0D02
529#define GL_PACK_SKIP_ROWS                 0x0D03
530#define GL_PACK_SKIP_PIXELS               0x0D04
531#define GL_COLOR                          0x1800
532#define GL_DEPTH                          0x1801
533#define GL_STENCIL                        0x1802
534#define GL_RED                            0x1903
535#define GL_RGB8                           0x8051
536#define GL_RGBA8                          0x8058
537#define GL_RGB10_A2                       0x8059
538#define GL_TEXTURE_BINDING_3D             0x806A
539#define GL_UNPACK_SKIP_IMAGES             0x806D
540#define GL_UNPACK_IMAGE_HEIGHT            0x806E
541#define GL_TEXTURE_3D                     0x806F
542#define GL_TEXTURE_WRAP_R                 0x8072
543#define GL_MAX_3D_TEXTURE_SIZE            0x8073
544#define GL_UNSIGNED_INT_2_10_10_10_REV    0x8368
545#define GL_MAX_ELEMENTS_VERTICES          0x80E8
546#define GL_MAX_ELEMENTS_INDICES           0x80E9
547#define GL_TEXTURE_MIN_LOD                0x813A
548#define GL_TEXTURE_MAX_LOD                0x813B
549#define GL_TEXTURE_BASE_LEVEL             0x813C
550#define GL_TEXTURE_MAX_LEVEL              0x813D
551#define GL_MIN                            0x8007
552#define GL_MAX                            0x8008
553#define GL_DEPTH_COMPONENT24              0x81A6
554#define GL_MAX_TEXTURE_LOD_BIAS           0x84FD
555#define GL_TEXTURE_COMPARE_MODE           0x884C
556#define GL_TEXTURE_COMPARE_FUNC           0x884D
557#define GL_CURRENT_QUERY                  0x8865
558#define GL_QUERY_RESULT                   0x8866
559#define GL_QUERY_RESULT_AVAILABLE         0x8867
560#define GL_BUFFER_MAPPED                  0x88BC
561#define GL_BUFFER_MAP_POINTER             0x88BD
562#define GL_STREAM_READ                    0x88E1
563#define GL_STREAM_COPY                    0x88E2
564#define GL_STATIC_READ                    0x88E5
565#define GL_STATIC_COPY                    0x88E6
566#define GL_DYNAMIC_READ                   0x88E9
567#define GL_DYNAMIC_COPY                   0x88EA
568#define GL_MAX_DRAW_BUFFERS               0x8824
569#define GL_DRAW_BUFFER0                   0x8825
570#define GL_DRAW_BUFFER1                   0x8826
571#define GL_DRAW_BUFFER2                   0x8827
572#define GL_DRAW_BUFFER3                   0x8828
573#define GL_DRAW_BUFFER4                   0x8829
574#define GL_DRAW_BUFFER5                   0x882A
575#define GL_DRAW_BUFFER6                   0x882B
576#define GL_DRAW_BUFFER7                   0x882C
577#define GL_DRAW_BUFFER8                   0x882D
578#define GL_DRAW_BUFFER9                   0x882E
579#define GL_DRAW_BUFFER10                  0x882F
580#define GL_DRAW_BUFFER11                  0x8830
581#define GL_DRAW_BUFFER12                  0x8831
582#define GL_DRAW_BUFFER13                  0x8832
583#define GL_DRAW_BUFFER14                  0x8833
584#define GL_DRAW_BUFFER15                  0x8834
585#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
586#define GL_MAX_VERTEX_UNIFORM_COMPONENTS  0x8B4A
587#define GL_SAMPLER_3D                     0x8B5F
588#define GL_SAMPLER_2D_SHADOW              0x8B62
589#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
590#define GL_PIXEL_PACK_BUFFER              0x88EB
591#define GL_PIXEL_UNPACK_BUFFER            0x88EC
592#define GL_PIXEL_PACK_BUFFER_BINDING      0x88ED
593#define GL_PIXEL_UNPACK_BUFFER_BINDING    0x88EF
594#define GL_FLOAT_MAT2x3                   0x8B65
595#define GL_FLOAT_MAT2x4                   0x8B66
596#define GL_FLOAT_MAT3x2                   0x8B67
597#define GL_FLOAT_MAT3x4                   0x8B68
598#define GL_FLOAT_MAT4x2                   0x8B69
599#define GL_FLOAT_MAT4x3                   0x8B6A
600#define GL_SRGB                           0x8C40
601#define GL_SRGB8                          0x8C41
602#define GL_SRGB8_ALPHA8                   0x8C43
603#define GL_COMPARE_REF_TO_TEXTURE         0x884E
604#define GL_MAJOR_VERSION                  0x821B
605#define GL_MINOR_VERSION                  0x821C
606#define GL_NUM_EXTENSIONS                 0x821D
607#define GL_RGBA32F                        0x8814
608#define GL_RGB32F                         0x8815
609#define GL_RGBA16F                        0x881A
610#define GL_RGB16F                         0x881B
611#define GL_VERTEX_ATTRIB_ARRAY_INTEGER    0x88FD
612#define GL_MAX_ARRAY_TEXTURE_LAYERS       0x88FF
613#define GL_MIN_PROGRAM_TEXEL_OFFSET       0x8904
614#define GL_MAX_PROGRAM_TEXEL_OFFSET       0x8905
615#define GL_MAX_VARYING_COMPONENTS         0x8B4B
616#define GL_TEXTURE_2D_ARRAY               0x8C1A
617#define GL_TEXTURE_BINDING_2D_ARRAY       0x8C1D
618#define GL_R11F_G11F_B10F                 0x8C3A
619#define GL_UNSIGNED_INT_10F_11F_11F_REV   0x8C3B
620#define GL_RGB9_E5                        0x8C3D
621#define GL_UNSIGNED_INT_5_9_9_9_REV       0x8C3E
622#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
623#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
624#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
625#define GL_TRANSFORM_FEEDBACK_VARYINGS    0x8C83
626#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
627#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
628#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
629#define GL_RASTERIZER_DISCARD             0x8C89
630#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
631#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
632#define GL_INTERLEAVED_ATTRIBS            0x8C8C
633#define GL_SEPARATE_ATTRIBS               0x8C8D
634#define GL_TRANSFORM_FEEDBACK_BUFFER      0x8C8E
635#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
636#define GL_RGBA32UI                       0x8D70
637#define GL_RGB32UI                        0x8D71
638#define GL_RGBA16UI                       0x8D76
639#define GL_RGB16UI                        0x8D77
640#define GL_RGBA8UI                        0x8D7C
641#define GL_RGB8UI                         0x8D7D
642#define GL_RGBA32I                        0x8D82
643#define GL_RGB32I                         0x8D83
644#define GL_RGBA16I                        0x8D88
645#define GL_RGB16I                         0x8D89
646#define GL_RGBA8I                         0x8D8E
647#define GL_RGB8I                          0x8D8F
648#define GL_RED_INTEGER                    0x8D94
649#define GL_RGB_INTEGER                    0x8D98
650#define GL_RGBA_INTEGER                   0x8D99
651#define GL_SAMPLER_2D_ARRAY               0x8DC1
652#define GL_SAMPLER_2D_ARRAY_SHADOW        0x8DC4
653#define GL_SAMPLER_CUBE_SHADOW            0x8DC5
654#define GL_UNSIGNED_INT_VEC2              0x8DC6
655#define GL_UNSIGNED_INT_VEC3              0x8DC7
656#define GL_UNSIGNED_INT_VEC4              0x8DC8
657#define GL_INT_SAMPLER_2D                 0x8DCA
658#define GL_INT_SAMPLER_3D                 0x8DCB
659#define GL_INT_SAMPLER_CUBE               0x8DCC
660#define GL_INT_SAMPLER_2D_ARRAY           0x8DCF
661#define GL_UNSIGNED_INT_SAMPLER_2D        0x8DD2
662#define GL_UNSIGNED_INT_SAMPLER_3D        0x8DD3
663#define GL_UNSIGNED_INT_SAMPLER_CUBE      0x8DD4
664#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY  0x8DD7
665#define GL_BUFFER_ACCESS_FLAGS            0x911F
666#define GL_BUFFER_MAP_LENGTH              0x9120
667#define GL_BUFFER_MAP_OFFSET              0x9121
668#define GL_DEPTH_COMPONENT32F             0x8CAC
669#define GL_DEPTH32F_STENCIL8              0x8CAD
670#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
671#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
672#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
673#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
674#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
675#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
676#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
677#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
678#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
679#define GL_FRAMEBUFFER_DEFAULT            0x8218
680#define GL_FRAMEBUFFER_UNDEFINED          0x8219
681#define GL_DEPTH_STENCIL_ATTACHMENT       0x821A
682#define GL_DEPTH_STENCIL                  0x84F9
683#define GL_UNSIGNED_INT_24_8              0x84FA
684#define GL_DEPTH24_STENCIL8               0x88F0
685#define GL_UNSIGNED_NORMALIZED            0x8C17
686#define GL_DRAW_FRAMEBUFFER_BINDING       0x8CA6
687#define GL_READ_FRAMEBUFFER               0x8CA8
688#define GL_DRAW_FRAMEBUFFER               0x8CA9
689#define GL_READ_FRAMEBUFFER_BINDING       0x8CAA
690#define GL_RENDERBUFFER_SAMPLES           0x8CAB
691#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
692#define GL_MAX_COLOR_ATTACHMENTS          0x8CDF
693#define GL_COLOR_ATTACHMENT1              0x8CE1
694#define GL_COLOR_ATTACHMENT2              0x8CE2
695#define GL_COLOR_ATTACHMENT3              0x8CE3
696#define GL_COLOR_ATTACHMENT4              0x8CE4
697#define GL_COLOR_ATTACHMENT5              0x8CE5
698#define GL_COLOR_ATTACHMENT6              0x8CE6
699#define GL_COLOR_ATTACHMENT7              0x8CE7
700#define GL_COLOR_ATTACHMENT8              0x8CE8
701#define GL_COLOR_ATTACHMENT9              0x8CE9
702#define GL_COLOR_ATTACHMENT10             0x8CEA
703#define GL_COLOR_ATTACHMENT11             0x8CEB
704#define GL_COLOR_ATTACHMENT12             0x8CEC
705#define GL_COLOR_ATTACHMENT13             0x8CED
706#define GL_COLOR_ATTACHMENT14             0x8CEE
707#define GL_COLOR_ATTACHMENT15             0x8CEF
708#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
709#define GL_MAX_SAMPLES                    0x8D57
710#define GL_HALF_FLOAT                     0x140B
711#define GL_MAP_READ_BIT                   0x0001
712#define GL_MAP_WRITE_BIT                  0x0002
713#define GL_MAP_INVALIDATE_RANGE_BIT       0x0004
714#define GL_MAP_INVALIDATE_BUFFER_BIT      0x0008
715#define GL_MAP_FLUSH_EXPLICIT_BIT         0x0010
716#define GL_MAP_UNSYNCHRONIZED_BIT         0x0020
717#define GL_RG                             0x8227
718#define GL_RG_INTEGER                     0x8228
719#define GL_R8                             0x8229
720#define GL_RG8                            0x822B
721#define GL_R16F                           0x822D
722#define GL_R32F                           0x822E
723#define GL_RG16F                          0x822F
724#define GL_RG32F                          0x8230
725#define GL_R8I                            0x8231
726#define GL_R8UI                           0x8232
727#define GL_R16I                           0x8233
728#define GL_R16UI                          0x8234
729#define GL_R32I                           0x8235
730#define GL_R32UI                          0x8236
731#define GL_RG8I                           0x8237
732#define GL_RG8UI                          0x8238
733#define GL_RG16I                          0x8239
734#define GL_RG16UI                         0x823A
735#define GL_RG32I                          0x823B
736#define GL_RG32UI                         0x823C
737#define GL_VERTEX_ARRAY_BINDING           0x85B5
738#define GL_R8_SNORM                       0x8F94
739#define GL_RG8_SNORM                      0x8F95
740#define GL_RGB8_SNORM                     0x8F96
741#define GL_RGBA8_SNORM                    0x8F97
742#define GL_SIGNED_NORMALIZED              0x8F9C
743#define GL_PRIMITIVE_RESTART_FIXED_INDEX  0x8D69
744#define GL_COPY_READ_BUFFER               0x8F36
745#define GL_COPY_WRITE_BUFFER              0x8F37
746#define GL_COPY_READ_BUFFER_BINDING       0x8F36
747#define GL_COPY_WRITE_BUFFER_BINDING      0x8F37
748#define GL_UNIFORM_BUFFER                 0x8A11
749#define GL_UNIFORM_BUFFER_BINDING         0x8A28
750#define GL_UNIFORM_BUFFER_START           0x8A29
751#define GL_UNIFORM_BUFFER_SIZE            0x8A2A
752#define GL_MAX_VERTEX_UNIFORM_BLOCKS      0x8A2B
753#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS    0x8A2D
754#define GL_MAX_COMBINED_UNIFORM_BLOCKS    0x8A2E
755#define GL_MAX_UNIFORM_BUFFER_BINDINGS    0x8A2F
756#define GL_MAX_UNIFORM_BLOCK_SIZE         0x8A30
757#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
758#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
759#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
760#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
761#define GL_ACTIVE_UNIFORM_BLOCKS          0x8A36
762#define GL_UNIFORM_TYPE                   0x8A37
763#define GL_UNIFORM_SIZE                   0x8A38
764#define GL_UNIFORM_NAME_LENGTH            0x8A39
765#define GL_UNIFORM_BLOCK_INDEX            0x8A3A
766#define GL_UNIFORM_OFFSET                 0x8A3B
767#define GL_UNIFORM_ARRAY_STRIDE           0x8A3C
768#define GL_UNIFORM_MATRIX_STRIDE          0x8A3D
769#define GL_UNIFORM_IS_ROW_MAJOR           0x8A3E
770#define GL_UNIFORM_BLOCK_BINDING          0x8A3F
771#define GL_UNIFORM_BLOCK_DATA_SIZE        0x8A40
772#define GL_UNIFORM_BLOCK_NAME_LENGTH      0x8A41
773#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS  0x8A42
774#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
775#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
776#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
777#define GL_INVALID_INDEX                  0xFFFFFFFFu
778#define GL_MAX_VERTEX_OUTPUT_COMPONENTS   0x9122
779#define GL_MAX_FRAGMENT_INPUT_COMPONENTS  0x9125
780#define GL_MAX_SERVER_WAIT_TIMEOUT        0x9111
781#define GL_OBJECT_TYPE                    0x9112
782#define GL_SYNC_CONDITION                 0x9113
783#define GL_SYNC_STATUS                    0x9114
784#define GL_SYNC_FLAGS                     0x9115
785#define GL_SYNC_FENCE                     0x9116
786#define GL_SYNC_GPU_COMMANDS_COMPLETE     0x9117
787#define GL_UNSIGNALED                     0x9118
788#define GL_SIGNALED                       0x9119
789#define GL_ALREADY_SIGNALED               0x911A
790#define GL_TIMEOUT_EXPIRED                0x911B
791#define GL_CONDITION_SATISFIED            0x911C
792#define GL_WAIT_FAILED                    0x911D
793#define GL_SYNC_FLUSH_COMMANDS_BIT        0x00000001
794#define GL_TIMEOUT_IGNORED                0xFFFFFFFFFFFFFFFFull
795#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR    0x88FE
796#define GL_ANY_SAMPLES_PASSED             0x8C2F
797#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
798#define GL_SAMPLER_BINDING                0x8919
799#define GL_RGB10_A2UI                     0x906F
800#define GL_TEXTURE_SWIZZLE_R              0x8E42
801#define GL_TEXTURE_SWIZZLE_G              0x8E43
802#define GL_TEXTURE_SWIZZLE_B              0x8E44
803#define GL_TEXTURE_SWIZZLE_A              0x8E45
804#define GL_GREEN                          0x1904
805#define GL_BLUE                           0x1905
806#define GL_INT_2_10_10_10_REV             0x8D9F
807#define GL_TRANSFORM_FEEDBACK             0x8E22
808#define GL_TRANSFORM_FEEDBACK_PAUSED      0x8E23
809#define GL_TRANSFORM_FEEDBACK_ACTIVE      0x8E24
810#define GL_TRANSFORM_FEEDBACK_BINDING     0x8E25
811#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
812#define GL_PROGRAM_BINARY_LENGTH          0x8741
813#define GL_NUM_PROGRAM_BINARY_FORMATS     0x87FE
814#define GL_PROGRAM_BINARY_FORMATS         0x87FF
815#define GL_COMPRESSED_R11_EAC             0x9270
816#define GL_COMPRESSED_SIGNED_R11_EAC      0x9271
817#define GL_COMPRESSED_RG11_EAC            0x9272
818#define GL_COMPRESSED_SIGNED_RG11_EAC     0x9273
819#define GL_COMPRESSED_RGB8_ETC2           0x9274
820#define GL_COMPRESSED_SRGB8_ETC2          0x9275
821#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
822#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
823#define GL_COMPRESSED_RGBA8_ETC2_EAC      0x9278
824#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
825#define GL_TEXTURE_IMMUTABLE_FORMAT       0x912F
826#define GL_MAX_ELEMENT_INDEX              0x8D6B
827#define GL_NUM_SAMPLE_COUNTS              0x9380
828#define GL_TEXTURE_IMMUTABLE_LEVELS       0x82DF
829GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode);
830GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
831GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
832GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
833GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
834GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
835GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
836GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint *ids);
837GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
838GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id);
839GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id);
840GL_APICALL void GL_APIENTRY glEndQuery (GLenum target);
841GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
842GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
843GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target);
844GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
845GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
846GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
847GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
848GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
849GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
850GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
851GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
852GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
853GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
854GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
855GL_APICALL void *GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
856GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
857GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array);
858GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
859GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
860GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array);
861GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
862GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
863GL_APICALL void GL_APIENTRY glEndTransformFeedback (void);
864GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
865GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
866GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
867GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
868GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
869GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
870GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
871GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
872GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
873GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
874GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
875GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
876GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
877GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0);
878GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
879GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
880GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
881GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
882GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
883GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
884GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
885GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
886GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
887GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
888GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
889GL_APICALL const GLubyte *GL_APIENTRY glGetStringi (GLenum name, GLuint index);
890GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
891GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
892GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
893GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
894GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
895GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
896GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
897GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
898GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
899GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
900GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync);
901GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync);
902GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
903GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
904GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
905GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
906GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
907GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
908GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
909GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
910GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler);
911GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler);
912GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
913GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
914GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
915GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
916GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
917GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
918GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
919GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
920GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
921GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
922GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id);
923GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void);
924GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void);
925GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
926GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
927GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
928GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
929GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
930GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
931GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
932GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
933#endif /* GL_ES_VERSION_3_0 */
934
935#ifdef __cplusplus
936}
937#endif
938
939#endif
Property changes on: branches/osd/src/lib/khronos/GLES3/gl3.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/GLES3/gl31.h
r0r31734
1#ifndef __gl31_h_
2#define __gl31_h_ 1
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/*
9** Copyright (c) 2013-2014 The Khronos Group Inc.
10**
11** Permission is hereby granted, free of charge, to any person obtaining a
12** copy of this software and/or associated documentation files (the
13** "Materials"), to deal in the Materials without restriction, including
14** without limitation the rights to use, copy, modify, merge, publish,
15** distribute, sublicense, and/or sell copies of the Materials, and to
16** permit persons to whom the Materials are furnished to do so, subject to
17** the following conditions:
18**
19** The above copyright notice and this permission notice shall be included
20** in all copies or substantial portions of the Materials.
21**
22** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
29*/
30/*
31** This header is generated from the Khronos OpenGL / OpenGL ES XML
32** API Registry. The current version of the Registry, generator scripts
33** used to make the header, and the header can be found at
34**   http://www.opengl.org/registry/
35**
36** Khronos $Revision$ on $Date$
37*/
38
39#include <GLES3/gl3platform.h>
40
41/* Generated on date 20140319 */
42
43/* Generated C header for:
44 * API: gles2
45 * Profile: common
46 * Versions considered: 2.[0-9]|3.[01]
47 * Versions emitted: .*
48 * Default extensions included: None
49 * Additional extensions included: _nomatch_^
50 * Extensions removed: _nomatch_^
51 */
52
53#ifndef GL_ES_VERSION_2_0
54#define GL_ES_VERSION_2_0 1
55#include <KHR/khrplatform.h>
56typedef khronos_int8_t GLbyte;
57typedef khronos_float_t GLclampf;
58typedef khronos_int32_t GLfixed;
59typedef short GLshort;
60typedef unsigned short GLushort;
61typedef void GLvoid;
62typedef struct __GLsync *GLsync;
63typedef khronos_int64_t GLint64;
64typedef khronos_uint64_t GLuint64;
65typedef unsigned int GLenum;
66typedef unsigned int GLuint;
67typedef char GLchar;
68typedef khronos_float_t GLfloat;
69typedef khronos_ssize_t GLsizeiptr;
70typedef khronos_intptr_t GLintptr;
71typedef unsigned int GLbitfield;
72typedef int GLint;
73typedef unsigned char GLboolean;
74typedef int GLsizei;
75typedef khronos_uint8_t GLubyte;
76#define GL_DEPTH_BUFFER_BIT               0x00000100
77#define GL_STENCIL_BUFFER_BIT             0x00000400
78#define GL_COLOR_BUFFER_BIT               0x00004000
79#define GL_FALSE                          0
80#define GL_TRUE                           1
81#define GL_POINTS                         0x0000
82#define GL_LINES                          0x0001
83#define GL_LINE_LOOP                      0x0002
84#define GL_LINE_STRIP                     0x0003
85#define GL_TRIANGLES                      0x0004
86#define GL_TRIANGLE_STRIP                 0x0005
87#define GL_TRIANGLE_FAN                   0x0006
88#define GL_ZERO                           0
89#define GL_ONE                            1
90#define GL_SRC_COLOR                      0x0300
91#define GL_ONE_MINUS_SRC_COLOR            0x0301
92#define GL_SRC_ALPHA                      0x0302
93#define GL_ONE_MINUS_SRC_ALPHA            0x0303
94#define GL_DST_ALPHA                      0x0304
95#define GL_ONE_MINUS_DST_ALPHA            0x0305
96#define GL_DST_COLOR                      0x0306
97#define GL_ONE_MINUS_DST_COLOR            0x0307
98#define GL_SRC_ALPHA_SATURATE             0x0308
99#define GL_FUNC_ADD                       0x8006
100#define GL_BLEND_EQUATION                 0x8009
101#define GL_BLEND_EQUATION_RGB             0x8009
102#define GL_BLEND_EQUATION_ALPHA           0x883D
103#define GL_FUNC_SUBTRACT                  0x800A
104#define GL_FUNC_REVERSE_SUBTRACT          0x800B
105#define GL_BLEND_DST_RGB                  0x80C8
106#define GL_BLEND_SRC_RGB                  0x80C9
107#define GL_BLEND_DST_ALPHA                0x80CA
108#define GL_BLEND_SRC_ALPHA                0x80CB
109#define GL_CONSTANT_COLOR                 0x8001
110#define GL_ONE_MINUS_CONSTANT_COLOR       0x8002
111#define GL_CONSTANT_ALPHA                 0x8003
112#define GL_ONE_MINUS_CONSTANT_ALPHA       0x8004
113#define GL_BLEND_COLOR                    0x8005
114#define GL_ARRAY_BUFFER                   0x8892
115#define GL_ELEMENT_ARRAY_BUFFER           0x8893
116#define GL_ARRAY_BUFFER_BINDING           0x8894
117#define GL_ELEMENT_ARRAY_BUFFER_BINDING   0x8895
118#define GL_STREAM_DRAW                    0x88E0
119#define GL_STATIC_DRAW                    0x88E4
120#define GL_DYNAMIC_DRAW                   0x88E8
121#define GL_BUFFER_SIZE                    0x8764
122#define GL_BUFFER_USAGE                   0x8765
123#define GL_CURRENT_VERTEX_ATTRIB          0x8626
124#define GL_FRONT                          0x0404
125#define GL_BACK                           0x0405
126#define GL_FRONT_AND_BACK                 0x0408
127#define GL_TEXTURE_2D                     0x0DE1
128#define GL_CULL_FACE                      0x0B44
129#define GL_BLEND                          0x0BE2
130#define GL_DITHER                         0x0BD0
131#define GL_STENCIL_TEST                   0x0B90
132#define GL_DEPTH_TEST                     0x0B71
133#define GL_SCISSOR_TEST                   0x0C11
134#define GL_POLYGON_OFFSET_FILL            0x8037
135#define GL_SAMPLE_ALPHA_TO_COVERAGE       0x809E
136#define GL_SAMPLE_COVERAGE                0x80A0
137#define GL_NO_ERROR                       0
138#define GL_INVALID_ENUM                   0x0500
139#define GL_INVALID_VALUE                  0x0501
140#define GL_INVALID_OPERATION              0x0502
141#define GL_OUT_OF_MEMORY                  0x0505
142#define GL_CW                             0x0900
143#define GL_CCW                            0x0901
144#define GL_LINE_WIDTH                     0x0B21
145#define GL_ALIASED_POINT_SIZE_RANGE       0x846D
146#define GL_ALIASED_LINE_WIDTH_RANGE       0x846E
147#define GL_CULL_FACE_MODE                 0x0B45
148#define GL_FRONT_FACE                     0x0B46
149#define GL_DEPTH_RANGE                    0x0B70
150#define GL_DEPTH_WRITEMASK                0x0B72
151#define GL_DEPTH_CLEAR_VALUE              0x0B73
152#define GL_DEPTH_FUNC                     0x0B74
153#define GL_STENCIL_CLEAR_VALUE            0x0B91
154#define GL_STENCIL_FUNC                   0x0B92
155#define GL_STENCIL_FAIL                   0x0B94
156#define GL_STENCIL_PASS_DEPTH_FAIL        0x0B95
157#define GL_STENCIL_PASS_DEPTH_PASS        0x0B96
158#define GL_STENCIL_REF                    0x0B97
159#define GL_STENCIL_VALUE_MASK             0x0B93
160#define GL_STENCIL_WRITEMASK              0x0B98
161#define GL_STENCIL_BACK_FUNC              0x8800
162#define GL_STENCIL_BACK_FAIL              0x8801
163#define GL_STENCIL_BACK_PASS_DEPTH_FAIL   0x8802
164#define GL_STENCIL_BACK_PASS_DEPTH_PASS   0x8803
165#define GL_STENCIL_BACK_REF               0x8CA3
166#define GL_STENCIL_BACK_VALUE_MASK        0x8CA4
167#define GL_STENCIL_BACK_WRITEMASK         0x8CA5
168#define GL_VIEWPORT                       0x0BA2
169#define GL_SCISSOR_BOX                    0x0C10
170#define GL_COLOR_CLEAR_VALUE              0x0C22
171#define GL_COLOR_WRITEMASK                0x0C23
172#define GL_UNPACK_ALIGNMENT               0x0CF5
173#define GL_PACK_ALIGNMENT                 0x0D05
174#define GL_MAX_TEXTURE_SIZE               0x0D33
175#define GL_MAX_VIEWPORT_DIMS              0x0D3A
176#define GL_SUBPIXEL_BITS                  0x0D50
177#define GL_RED_BITS                       0x0D52
178#define GL_GREEN_BITS                     0x0D53
179#define GL_BLUE_BITS                      0x0D54
180#define GL_ALPHA_BITS                     0x0D55
181#define GL_DEPTH_BITS                     0x0D56
182#define GL_STENCIL_BITS                   0x0D57
183#define GL_POLYGON_OFFSET_UNITS           0x2A00
184#define GL_POLYGON_OFFSET_FACTOR          0x8038
185#define GL_TEXTURE_BINDING_2D             0x8069
186#define GL_SAMPLE_BUFFERS                 0x80A8
187#define GL_SAMPLES                        0x80A9
188#define GL_SAMPLE_COVERAGE_VALUE          0x80AA
189#define GL_SAMPLE_COVERAGE_INVERT         0x80AB
190#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
191#define GL_COMPRESSED_TEXTURE_FORMATS     0x86A3
192#define GL_DONT_CARE                      0x1100
193#define GL_FASTEST                        0x1101
194#define GL_NICEST                         0x1102
195#define GL_GENERATE_MIPMAP_HINT           0x8192
196#define GL_BYTE                           0x1400
197#define GL_UNSIGNED_BYTE                  0x1401
198#define GL_SHORT                          0x1402
199#define GL_UNSIGNED_SHORT                 0x1403
200#define GL_INT                            0x1404
201#define GL_UNSIGNED_INT                   0x1405
202#define GL_FLOAT                          0x1406
203#define GL_FIXED                          0x140C
204#define GL_DEPTH_COMPONENT                0x1902
205#define GL_ALPHA                          0x1906
206#define GL_RGB                            0x1907
207#define GL_RGBA                           0x1908
208#define GL_LUMINANCE                      0x1909
209#define GL_LUMINANCE_ALPHA                0x190A
210#define GL_UNSIGNED_SHORT_4_4_4_4         0x8033
211#define GL_UNSIGNED_SHORT_5_5_5_1         0x8034
212#define GL_UNSIGNED_SHORT_5_6_5           0x8363
213#define GL_FRAGMENT_SHADER                0x8B30
214#define GL_VERTEX_SHADER                  0x8B31
215#define GL_MAX_VERTEX_ATTRIBS             0x8869
216#define GL_MAX_VERTEX_UNIFORM_VECTORS     0x8DFB
217#define GL_MAX_VARYING_VECTORS            0x8DFC
218#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
219#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
220#define GL_MAX_TEXTURE_IMAGE_UNITS        0x8872
221#define GL_MAX_FRAGMENT_UNIFORM_VECTORS   0x8DFD
222#define GL_SHADER_TYPE                    0x8B4F
223#define GL_DELETE_STATUS                  0x8B80
224#define GL_LINK_STATUS                    0x8B82
225#define GL_VALIDATE_STATUS                0x8B83
226#define GL_ATTACHED_SHADERS               0x8B85
227#define GL_ACTIVE_UNIFORMS                0x8B86
228#define GL_ACTIVE_UNIFORM_MAX_LENGTH      0x8B87
229#define GL_ACTIVE_ATTRIBUTES              0x8B89
230#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH    0x8B8A
231#define GL_SHADING_LANGUAGE_VERSION       0x8B8C
232#define GL_CURRENT_PROGRAM                0x8B8D
233#define GL_NEVER                          0x0200
234#define GL_LESS                           0x0201
235#define GL_EQUAL                          0x0202
236#define GL_LEQUAL                         0x0203
237#define GL_GREATER                        0x0204
238#define GL_NOTEQUAL                       0x0205
239#define GL_GEQUAL                         0x0206
240#define GL_ALWAYS                         0x0207
241#define GL_KEEP                           0x1E00
242#define GL_REPLACE                        0x1E01
243#define GL_INCR                           0x1E02
244#define GL_DECR                           0x1E03
245#define GL_INVERT                         0x150A
246#define GL_INCR_WRAP                      0x8507
247#define GL_DECR_WRAP                      0x8508
248#define GL_VENDOR                         0x1F00
249#define GL_RENDERER                       0x1F01
250#define GL_VERSION                        0x1F02
251#define GL_EXTENSIONS                     0x1F03
252#define GL_NEAREST                        0x2600
253#define GL_LINEAR                         0x2601
254#define GL_NEAREST_MIPMAP_NEAREST         0x2700
255#define GL_LINEAR_MIPMAP_NEAREST          0x2701
256#define GL_NEAREST_MIPMAP_LINEAR          0x2702
257#define GL_LINEAR_MIPMAP_LINEAR           0x2703
258#define GL_TEXTURE_MAG_FILTER             0x2800
259#define GL_TEXTURE_MIN_FILTER             0x2801
260#define GL_TEXTURE_WRAP_S                 0x2802
261#define GL_TEXTURE_WRAP_T                 0x2803
262#define GL_TEXTURE                        0x1702
263#define GL_TEXTURE_CUBE_MAP               0x8513
264#define GL_TEXTURE_BINDING_CUBE_MAP       0x8514
265#define GL_TEXTURE_CUBE_MAP_POSITIVE_X    0x8515
266#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X    0x8516
267#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y    0x8517
268#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y    0x8518
269#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z    0x8519
270#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z    0x851A
271#define GL_MAX_CUBE_MAP_TEXTURE_SIZE      0x851C
272#define GL_TEXTURE0                       0x84C0
273#define GL_TEXTURE1                       0x84C1
274#define GL_TEXTURE2                       0x84C2
275#define GL_TEXTURE3                       0x84C3
276#define GL_TEXTURE4                       0x84C4
277#define GL_TEXTURE5                       0x84C5
278#define GL_TEXTURE6                       0x84C6
279#define GL_TEXTURE7                       0x84C7
280#define GL_TEXTURE8                       0x84C8
281#define GL_TEXTURE9                       0x84C9
282#define GL_TEXTURE10                      0x84CA
283#define GL_TEXTURE11                      0x84CB
284#define GL_TEXTURE12                      0x84CC
285#define GL_TEXTURE13                      0x84CD
286#define GL_TEXTURE14                      0x84CE
287#define GL_TEXTURE15                      0x84CF
288#define GL_TEXTURE16                      0x84D0
289#define GL_TEXTURE17                      0x84D1
290#define GL_TEXTURE18                      0x84D2
291#define GL_TEXTURE19                      0x84D3
292#define GL_TEXTURE20                      0x84D4
293#define GL_TEXTURE21                      0x84D5
294#define GL_TEXTURE22                      0x84D6
295#define GL_TEXTURE23                      0x84D7
296#define GL_TEXTURE24                      0x84D8
297#define GL_TEXTURE25                      0x84D9
298#define GL_TEXTURE26                      0x84DA
299#define GL_TEXTURE27                      0x84DB
300#define GL_TEXTURE28                      0x84DC
301#define GL_TEXTURE29                      0x84DD
302#define GL_TEXTURE30                      0x84DE
303#define GL_TEXTURE31                      0x84DF
304#define GL_ACTIVE_TEXTURE                 0x84E0
305#define GL_REPEAT                         0x2901
306#define GL_CLAMP_TO_EDGE                  0x812F
307#define GL_MIRRORED_REPEAT                0x8370
308#define GL_FLOAT_VEC2                     0x8B50
309#define GL_FLOAT_VEC3                     0x8B51
310#define GL_FLOAT_VEC4                     0x8B52
311#define GL_INT_VEC2                       0x8B53
312#define GL_INT_VEC3                       0x8B54
313#define GL_INT_VEC4                       0x8B55
314#define GL_BOOL                           0x8B56
315#define GL_BOOL_VEC2                      0x8B57
316#define GL_BOOL_VEC3                      0x8B58
317#define GL_BOOL_VEC4                      0x8B59
318#define GL_FLOAT_MAT2                     0x8B5A
319#define GL_FLOAT_MAT3                     0x8B5B
320#define GL_FLOAT_MAT4                     0x8B5C
321#define GL_SAMPLER_2D                     0x8B5E
322#define GL_SAMPLER_CUBE                   0x8B60
323#define GL_VERTEX_ATTRIB_ARRAY_ENABLED    0x8622
324#define GL_VERTEX_ATTRIB_ARRAY_SIZE       0x8623
325#define GL_VERTEX_ATTRIB_ARRAY_STRIDE     0x8624
326#define GL_VERTEX_ATTRIB_ARRAY_TYPE       0x8625
327#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
328#define GL_VERTEX_ATTRIB_ARRAY_POINTER    0x8645
329#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
330#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
331#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
332#define GL_COMPILE_STATUS                 0x8B81
333#define GL_INFO_LOG_LENGTH                0x8B84
334#define GL_SHADER_SOURCE_LENGTH           0x8B88
335#define GL_SHADER_COMPILER                0x8DFA
336#define GL_SHADER_BINARY_FORMATS          0x8DF8
337#define GL_NUM_SHADER_BINARY_FORMATS      0x8DF9
338#define GL_LOW_FLOAT                      0x8DF0
339#define GL_MEDIUM_FLOAT                   0x8DF1
340#define GL_HIGH_FLOAT                     0x8DF2
341#define GL_LOW_INT                        0x8DF3
342#define GL_MEDIUM_INT                     0x8DF4
343#define GL_HIGH_INT                       0x8DF5
344#define GL_FRAMEBUFFER                    0x8D40
345#define GL_RENDERBUFFER                   0x8D41
346#define GL_RGBA4                          0x8056
347#define GL_RGB5_A1                        0x8057
348#define GL_RGB565                         0x8D62
349#define GL_DEPTH_COMPONENT16              0x81A5
350#define GL_STENCIL_INDEX8                 0x8D48
351#define GL_RENDERBUFFER_WIDTH             0x8D42
352#define GL_RENDERBUFFER_HEIGHT            0x8D43
353#define GL_RENDERBUFFER_INTERNAL_FORMAT   0x8D44
354#define GL_RENDERBUFFER_RED_SIZE          0x8D50
355#define GL_RENDERBUFFER_GREEN_SIZE        0x8D51
356#define GL_RENDERBUFFER_BLUE_SIZE         0x8D52
357#define GL_RENDERBUFFER_ALPHA_SIZE        0x8D53
358#define GL_RENDERBUFFER_DEPTH_SIZE        0x8D54
359#define GL_RENDERBUFFER_STENCIL_SIZE      0x8D55
360#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
361#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
362#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
363#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
364#define GL_COLOR_ATTACHMENT0              0x8CE0
365#define GL_DEPTH_ATTACHMENT               0x8D00
366#define GL_STENCIL_ATTACHMENT             0x8D20
367#define GL_NONE                           0
368#define GL_FRAMEBUFFER_COMPLETE           0x8CD5
369#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
370#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
371#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
372#define GL_FRAMEBUFFER_UNSUPPORTED        0x8CDD
373#define GL_FRAMEBUFFER_BINDING            0x8CA6
374#define GL_RENDERBUFFER_BINDING           0x8CA7
375#define GL_MAX_RENDERBUFFER_SIZE          0x84E8
376#define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506
377GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
378GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
379GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
380GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
381GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
382GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
383GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
384GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
385GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
386GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
387GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
388GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
389GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
390GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
391GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
392GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
393GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
394GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
395GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
396GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
397GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
398GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
399GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
400GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
401GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
402GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
403GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
404GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
405GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
406GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
407GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
408GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
409GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
410GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
411GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
412GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
413GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
414GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
415GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
416GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
417GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
418GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
419GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
420GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
421GL_APICALL void GL_APIENTRY glFinish (void);
422GL_APICALL void GL_APIENTRY glFlush (void);
423GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
424GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
425GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
426GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
427GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
428GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
429GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
430GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
431GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
432GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
433GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
434GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
435GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
436GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
437GL_APICALL GLenum GL_APIENTRY glGetError (void);
438GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
439GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
440GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
441GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
442GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
443GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
444GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
445GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
446GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
447GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
448GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
449GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
450GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
451GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
452GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
453GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
454GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
455GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
456GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
457GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
458GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
459GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
460GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
461GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
462GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
463GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
464GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
465GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
466GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
467GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
468GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
469GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
470GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
471GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
472GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
473GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
474GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
475GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
476GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
477GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
478GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
479GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
480GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
481GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
482GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
483GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
484GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
485GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
486GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
487GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
488GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
489GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
490GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
491GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
492GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
493GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
494GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
495GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
496GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
497GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
498GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
499GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
500GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
501GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
502GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
503GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
504GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
505GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
506GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
507GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
508GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
509GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
510GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
511GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
512GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
513GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
514GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
515GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
516GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
517GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
518GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
519#endif /* GL_ES_VERSION_2_0 */
520
521#ifndef GL_ES_VERSION_3_0
522#define GL_ES_VERSION_3_0 1
523typedef unsigned short GLhalf;
524#define GL_READ_BUFFER                    0x0C02
525#define GL_UNPACK_ROW_LENGTH              0x0CF2
526#define GL_UNPACK_SKIP_ROWS               0x0CF3
527#define GL_UNPACK_SKIP_PIXELS             0x0CF4
528#define GL_PACK_ROW_LENGTH                0x0D02
529#define GL_PACK_SKIP_ROWS                 0x0D03
530#define GL_PACK_SKIP_PIXELS               0x0D04
531#define GL_COLOR                          0x1800
532#define GL_DEPTH                          0x1801
533#define GL_STENCIL                        0x1802
534#define GL_RED                            0x1903
535#define GL_RGB8                           0x8051
536#define GL_RGBA8                          0x8058
537#define GL_RGB10_A2                       0x8059
538#define GL_TEXTURE_BINDING_3D             0x806A
539#define GL_UNPACK_SKIP_IMAGES             0x806D
540#define GL_UNPACK_IMAGE_HEIGHT            0x806E
541#define GL_TEXTURE_3D                     0x806F
542#define GL_TEXTURE_WRAP_R                 0x8072
543#define GL_MAX_3D_TEXTURE_SIZE            0x8073
544#define GL_UNSIGNED_INT_2_10_10_10_REV    0x8368
545#define GL_MAX_ELEMENTS_VERTICES          0x80E8
546#define GL_MAX_ELEMENTS_INDICES           0x80E9
547#define GL_TEXTURE_MIN_LOD                0x813A
548#define GL_TEXTURE_MAX_LOD                0x813B
549#define GL_TEXTURE_BASE_LEVEL             0x813C
550#define GL_TEXTURE_MAX_LEVEL              0x813D
551#define GL_MIN                            0x8007
552#define GL_MAX                            0x8008
553#define GL_DEPTH_COMPONENT24              0x81A6
554#define GL_MAX_TEXTURE_LOD_BIAS           0x84FD
555#define GL_TEXTURE_COMPARE_MODE           0x884C
556#define GL_TEXTURE_COMPARE_FUNC           0x884D
557#define GL_CURRENT_QUERY                  0x8865
558#define GL_QUERY_RESULT                   0x8866
559#define GL_QUERY_RESULT_AVAILABLE         0x8867
560#define GL_BUFFER_MAPPED                  0x88BC
561#define GL_BUFFER_MAP_POINTER             0x88BD
562#define GL_STREAM_READ                    0x88E1
563#define GL_STREAM_COPY                    0x88E2
564#define GL_STATIC_READ                    0x88E5
565#define GL_STATIC_COPY                    0x88E6
566#define GL_DYNAMIC_READ                   0x88E9
567#define GL_DYNAMIC_COPY                   0x88EA
568#define GL_MAX_DRAW_BUFFERS               0x8824
569#define GL_DRAW_BUFFER0                   0x8825
570#define GL_DRAW_BUFFER1                   0x8826
571#define GL_DRAW_BUFFER2                   0x8827
572#define GL_DRAW_BUFFER3                   0x8828
573#define GL_DRAW_BUFFER4                   0x8829
574#define GL_DRAW_BUFFER5                   0x882A
575#define GL_DRAW_BUFFER6                   0x882B
576#define GL_DRAW_BUFFER7                   0x882C
577#define GL_DRAW_BUFFER8                   0x882D
578#define GL_DRAW_BUFFER9                   0x882E
579#define GL_DRAW_BUFFER10                  0x882F
580#define GL_DRAW_BUFFER11                  0x8830
581#define GL_DRAW_BUFFER12                  0x8831
582#define GL_DRAW_BUFFER13                  0x8832
583#define GL_DRAW_BUFFER14                  0x8833
584#define GL_DRAW_BUFFER15                  0x8834
585#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
586#define GL_MAX_VERTEX_UNIFORM_COMPONENTS  0x8B4A
587#define GL_SAMPLER_3D                     0x8B5F
588#define GL_SAMPLER_2D_SHADOW              0x8B62
589#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
590#define GL_PIXEL_PACK_BUFFER              0x88EB
591#define GL_PIXEL_UNPACK_BUFFER            0x88EC
592#define GL_PIXEL_PACK_BUFFER_BINDING      0x88ED
593#define GL_PIXEL_UNPACK_BUFFER_BINDING    0x88EF
594#define GL_FLOAT_MAT2x3                   0x8B65
595#define GL_FLOAT_MAT2x4                   0x8B66
596#define GL_FLOAT_MAT3x2                   0x8B67
597#define GL_FLOAT_MAT3x4                   0x8B68
598#define GL_FLOAT_MAT4x2                   0x8B69
599#define GL_FLOAT_MAT4x3                   0x8B6A
600#define GL_SRGB                           0x8C40
601#define GL_SRGB8                          0x8C41
602#define GL_SRGB8_ALPHA8                   0x8C43
603#define GL_COMPARE_REF_TO_TEXTURE         0x884E
604#define GL_MAJOR_VERSION                  0x821B
605#define GL_MINOR_VERSION                  0x821C
606#define GL_NUM_EXTENSIONS                 0x821D
607#define GL_RGBA32F                        0x8814
608#define GL_RGB32F                         0x8815
609#define GL_RGBA16F                        0x881A
610#define GL_RGB16F                         0x881B
611#define GL_VERTEX_ATTRIB_ARRAY_INTEGER    0x88FD
612#define GL_MAX_ARRAY_TEXTURE_LAYERS       0x88FF
613#define GL_MIN_PROGRAM_TEXEL_OFFSET       0x8904
614#define GL_MAX_PROGRAM_TEXEL_OFFSET       0x8905
615#define GL_MAX_VARYING_COMPONENTS         0x8B4B
616#define GL_TEXTURE_2D_ARRAY               0x8C1A
617#define GL_TEXTURE_BINDING_2D_ARRAY       0x8C1D
618#define GL_R11F_G11F_B10F                 0x8C3A
619#define GL_UNSIGNED_INT_10F_11F_11F_REV   0x8C3B
620#define GL_RGB9_E5                        0x8C3D
621#define GL_UNSIGNED_INT_5_9_9_9_REV       0x8C3E
622#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
623#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
624#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
625#define GL_TRANSFORM_FEEDBACK_VARYINGS    0x8C83
626#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
627#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
628#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
629#define GL_RASTERIZER_DISCARD             0x8C89
630#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
631#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
632#define GL_INTERLEAVED_ATTRIBS            0x8C8C
633#define GL_SEPARATE_ATTRIBS               0x8C8D
634#define GL_TRANSFORM_FEEDBACK_BUFFER      0x8C8E
635#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
636#define GL_RGBA32UI                       0x8D70
637#define GL_RGB32UI                        0x8D71
638#define GL_RGBA16UI                       0x8D76
639#define GL_RGB16UI                        0x8D77
640#define GL_RGBA8UI                        0x8D7C
641#define GL_RGB8UI                         0x8D7D
642#define GL_RGBA32I                        0x8D82
643#define GL_RGB32I                         0x8D83
644#define GL_RGBA16I                        0x8D88
645#define GL_RGB16I                         0x8D89
646#define GL_RGBA8I                         0x8D8E
647#define GL_RGB8I                          0x8D8F
648#define GL_RED_INTEGER                    0x8D94
649#define GL_RGB_INTEGER                    0x8D98
650#define GL_RGBA_INTEGER                   0x8D99
651#define GL_SAMPLER_2D_ARRAY               0x8DC1
652#define GL_SAMPLER_2D_ARRAY_SHADOW        0x8DC4
653#define GL_SAMPLER_CUBE_SHADOW            0x8DC5
654#define GL_UNSIGNED_INT_VEC2              0x8DC6
655#define GL_UNSIGNED_INT_VEC3              0x8DC7
656#define GL_UNSIGNED_INT_VEC4              0x8DC8
657#define GL_INT_SAMPLER_2D                 0x8DCA
658#define GL_INT_SAMPLER_3D                 0x8DCB
659#define GL_INT_SAMPLER_CUBE               0x8DCC
660#define GL_INT_SAMPLER_2D_ARRAY           0x8DCF
661#define GL_UNSIGNED_INT_SAMPLER_2D        0x8DD2
662#define GL_UNSIGNED_INT_SAMPLER_3D        0x8DD3
663#define GL_UNSIGNED_INT_SAMPLER_CUBE      0x8DD4
664#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY  0x8DD7
665#define GL_BUFFER_ACCESS_FLAGS            0x911F
666#define GL_BUFFER_MAP_LENGTH              0x9120
667#define GL_BUFFER_MAP_OFFSET              0x9121
668#define GL_DEPTH_COMPONENT32F             0x8CAC
669#define GL_DEPTH32F_STENCIL8              0x8CAD
670#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
671#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
672#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
673#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
674#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
675#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
676#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
677#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
678#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
679#define GL_FRAMEBUFFER_DEFAULT            0x8218
680#define GL_FRAMEBUFFER_UNDEFINED          0x8219
681#define GL_DEPTH_STENCIL_ATTACHMENT       0x821A
682#define GL_DEPTH_STENCIL                  0x84F9
683#define GL_UNSIGNED_INT_24_8              0x84FA
684#define GL_DEPTH24_STENCIL8               0x88F0
685#define GL_UNSIGNED_NORMALIZED            0x8C17
686#define GL_DRAW_FRAMEBUFFER_BINDING       0x8CA6
687#define GL_READ_FRAMEBUFFER               0x8CA8
688#define GL_DRAW_FRAMEBUFFER               0x8CA9
689#define GL_READ_FRAMEBUFFER_BINDING       0x8CAA
690#define GL_RENDERBUFFER_SAMPLES           0x8CAB
691#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
692#define GL_MAX_COLOR_ATTACHMENTS          0x8CDF
693#define GL_COLOR_ATTACHMENT1              0x8CE1
694#define GL_COLOR_ATTACHMENT2              0x8CE2
695#define GL_COLOR_ATTACHMENT3              0x8CE3
696#define GL_COLOR_ATTACHMENT4              0x8CE4
697#define GL_COLOR_ATTACHMENT5              0x8CE5
698#define GL_COLOR_ATTACHMENT6              0x8CE6
699#define GL_COLOR_ATTACHMENT7              0x8CE7
700#define GL_COLOR_ATTACHMENT8              0x8CE8
701#define GL_COLOR_ATTACHMENT9              0x8CE9
702#define GL_COLOR_ATTACHMENT10             0x8CEA
703#define GL_COLOR_ATTACHMENT11             0x8CEB
704#define GL_COLOR_ATTACHMENT12             0x8CEC
705#define GL_COLOR_ATTACHMENT13             0x8CED
706#define GL_COLOR_ATTACHMENT14             0x8CEE
707#define GL_COLOR_ATTACHMENT15             0x8CEF
708#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
709#define GL_MAX_SAMPLES                    0x8D57
710#define GL_HALF_FLOAT                     0x140B
711#define GL_MAP_READ_BIT                   0x0001
712#define GL_MAP_WRITE_BIT                  0x0002
713#define GL_MAP_INVALIDATE_RANGE_BIT       0x0004
714#define GL_MAP_INVALIDATE_BUFFER_BIT      0x0008
715#define GL_MAP_FLUSH_EXPLICIT_BIT         0x0010
716#define GL_MAP_UNSYNCHRONIZED_BIT         0x0020
717#define GL_RG                             0x8227
718#define GL_RG_INTEGER                     0x8228
719#define GL_R8                             0x8229
720#define GL_RG8                            0x822B
721#define GL_R16F                           0x822D
722#define GL_R32F                           0x822E
723#define GL_RG16F                          0x822F
724#define GL_RG32F                          0x8230
725#define GL_R8I                            0x8231
726#define GL_R8UI                           0x8232
727#define GL_R16I                           0x8233
728#define GL_R16UI                          0x8234
729#define GL_R32I                           0x8235
730#define GL_R32UI                          0x8236
731#define GL_RG8I                           0x8237
732#define GL_RG8UI                          0x8238
733#define GL_RG16I                          0x8239
734#define GL_RG16UI                         0x823A
735#define GL_RG32I                          0x823B
736#define GL_RG32UI                         0x823C
737#define GL_VERTEX_ARRAY_BINDING           0x85B5
738#define GL_R8_SNORM                       0x8F94
739#define GL_RG8_SNORM                      0x8F95
740#define GL_RGB8_SNORM                     0x8F96
741#define GL_RGBA8_SNORM                    0x8F97
742#define GL_SIGNED_NORMALIZED              0x8F9C
743#define GL_PRIMITIVE_RESTART_FIXED_INDEX  0x8D69
744#define GL_COPY_READ_BUFFER               0x8F36
745#define GL_COPY_WRITE_BUFFER              0x8F37
746#define GL_COPY_READ_BUFFER_BINDING       0x8F36
747#define GL_COPY_WRITE_BUFFER_BINDING      0x8F37
748#define GL_UNIFORM_BUFFER                 0x8A11
749#define GL_UNIFORM_BUFFER_BINDING         0x8A28
750#define GL_UNIFORM_BUFFER_START           0x8A29
751#define GL_UNIFORM_BUFFER_SIZE            0x8A2A
752#define GL_MAX_VERTEX_UNIFORM_BLOCKS      0x8A2B
753#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS    0x8A2D
754#define GL_MAX_COMBINED_UNIFORM_BLOCKS    0x8A2E
755#define GL_MAX_UNIFORM_BUFFER_BINDINGS    0x8A2F
756#define GL_MAX_UNIFORM_BLOCK_SIZE         0x8A30
757#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
758#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
759#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
760#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
761#define GL_ACTIVE_UNIFORM_BLOCKS          0x8A36
762#define GL_UNIFORM_TYPE                   0x8A37
763#define GL_UNIFORM_SIZE                   0x8A38
764#define GL_UNIFORM_NAME_LENGTH            0x8A39
765#define GL_UNIFORM_BLOCK_INDEX            0x8A3A
766#define GL_UNIFORM_OFFSET                 0x8A3B
767#define GL_UNIFORM_ARRAY_STRIDE           0x8A3C
768#define GL_UNIFORM_MATRIX_STRIDE          0x8A3D
769#define GL_UNIFORM_IS_ROW_MAJOR           0x8A3E
770#define GL_UNIFORM_BLOCK_BINDING          0x8A3F
771#define GL_UNIFORM_BLOCK_DATA_SIZE        0x8A40
772#define GL_UNIFORM_BLOCK_NAME_LENGTH      0x8A41
773#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS  0x8A42
774#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
775#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
776#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
777#define GL_INVALID_INDEX                  0xFFFFFFFFu
778#define GL_MAX_VERTEX_OUTPUT_COMPONENTS   0x9122
779#define GL_MAX_FRAGMENT_INPUT_COMPONENTS  0x9125
780#define GL_MAX_SERVER_WAIT_TIMEOUT        0x9111
781#define GL_OBJECT_TYPE                    0x9112
782#define GL_SYNC_CONDITION                 0x9113
783#define GL_SYNC_STATUS                    0x9114
784#define GL_SYNC_FLAGS                     0x9115
785#define GL_SYNC_FENCE                     0x9116
786#define GL_SYNC_GPU_COMMANDS_COMPLETE     0x9117
787#define GL_UNSIGNALED                     0x9118
788#define GL_SIGNALED                       0x9119
789#define GL_ALREADY_SIGNALED               0x911A
790#define GL_TIMEOUT_EXPIRED                0x911B
791#define GL_CONDITION_SATISFIED            0x911C
792#define GL_WAIT_FAILED                    0x911D
793#define GL_SYNC_FLUSH_COMMANDS_BIT        0x00000001
794#define GL_TIMEOUT_IGNORED                0xFFFFFFFFFFFFFFFFull
795#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR    0x88FE
796#define GL_ANY_SAMPLES_PASSED             0x8C2F
797#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
798#define GL_SAMPLER_BINDING                0x8919
799#define GL_RGB10_A2UI                     0x906F
800#define GL_TEXTURE_SWIZZLE_R              0x8E42
801#define GL_TEXTURE_SWIZZLE_G              0x8E43
802#define GL_TEXTURE_SWIZZLE_B              0x8E44
803#define GL_TEXTURE_SWIZZLE_A              0x8E45
804#define GL_GREEN                          0x1904
805#define GL_BLUE                           0x1905
806#define GL_INT_2_10_10_10_REV             0x8D9F
807#define GL_TRANSFORM_FEEDBACK             0x8E22
808#define GL_TRANSFORM_FEEDBACK_PAUSED      0x8E23
809#define GL_TRANSFORM_FEEDBACK_ACTIVE      0x8E24
810#define GL_TRANSFORM_FEEDBACK_BINDING     0x8E25
811#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
812#define GL_PROGRAM_BINARY_LENGTH          0x8741
813#define GL_NUM_PROGRAM_BINARY_FORMATS     0x87FE
814#define GL_PROGRAM_BINARY_FORMATS         0x87FF
815#define GL_COMPRESSED_R11_EAC             0x9270
816#define GL_COMPRESSED_SIGNED_R11_EAC      0x9271
817#define GL_COMPRESSED_RG11_EAC            0x9272
818#define GL_COMPRESSED_SIGNED_RG11_EAC     0x9273
819#define GL_COMPRESSED_RGB8_ETC2           0x9274
820#define GL_COMPRESSED_SRGB8_ETC2          0x9275
821#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
822#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
823#define GL_COMPRESSED_RGBA8_ETC2_EAC      0x9278
824#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
825#define GL_TEXTURE_IMMUTABLE_FORMAT       0x912F
826#define GL_MAX_ELEMENT_INDEX              0x8D6B
827#define GL_NUM_SAMPLE_COUNTS              0x9380
828#define GL_TEXTURE_IMMUTABLE_LEVELS       0x82DF
829GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode);
830GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
831GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
832GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
833GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
834GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
835GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
836GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint *ids);
837GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
838GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id);
839GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id);
840GL_APICALL void GL_APIENTRY glEndQuery (GLenum target);
841GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
842GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
843GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target);
844GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
845GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
846GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
847GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
848GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
849GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
850GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
851GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
852GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
853GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
854GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
855GL_APICALL void *GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
856GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
857GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array);
858GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
859GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
860GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array);
861GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
862GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
863GL_APICALL void GL_APIENTRY glEndTransformFeedback (void);
864GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
865GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
866GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
867GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
868GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
869GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
870GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
871GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
872GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
873GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
874GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
875GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
876GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
877GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0);
878GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
879GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
880GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
881GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
882GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
883GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
884GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
885GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
886GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
887GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
888GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
889GL_APICALL const GLubyte *GL_APIENTRY glGetStringi (GLenum name, GLuint index);
890GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
891GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
892GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
893GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
894GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
895GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
896GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
897GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
898GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
899GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
900GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync);
901GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync);
902GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
903GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
904GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
905GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
906GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
907GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
908GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
909GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
910GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler);
911GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler);
912GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
913GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
914GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
915GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
916GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
917GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
918GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
919GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
920GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
921GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
922GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id);
923GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void);
924GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void);
925GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
926GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
927GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
928GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
929GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
930GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
931GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
932GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
933#endif /* GL_ES_VERSION_3_0 */
934
935#ifndef GL_ES_VERSION_3_1
936#define GL_ES_VERSION_3_1 1
937#define GL_COMPUTE_SHADER                 0x91B9
938#define GL_MAX_COMPUTE_UNIFORM_BLOCKS     0x91BB
939#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
940#define GL_MAX_COMPUTE_IMAGE_UNIFORMS     0x91BD
941#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
942#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
943#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
944#define GL_MAX_COMPUTE_ATOMIC_COUNTERS    0x8265
945#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
946#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
947#define GL_MAX_COMPUTE_WORK_GROUP_COUNT   0x91BE
948#define GL_MAX_COMPUTE_WORK_GROUP_SIZE    0x91BF
949#define GL_COMPUTE_WORK_GROUP_SIZE        0x8267
950#define GL_DISPATCH_INDIRECT_BUFFER       0x90EE
951#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
952#define GL_COMPUTE_SHADER_BIT             0x00000020
953#define GL_DRAW_INDIRECT_BUFFER           0x8F3F
954#define GL_DRAW_INDIRECT_BUFFER_BINDING   0x8F43
955#define GL_MAX_UNIFORM_LOCATIONS          0x826E
956#define GL_FRAMEBUFFER_DEFAULT_WIDTH      0x9310
957#define GL_FRAMEBUFFER_DEFAULT_HEIGHT     0x9311
958#define GL_FRAMEBUFFER_DEFAULT_SAMPLES    0x9313
959#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
960#define GL_MAX_FRAMEBUFFER_WIDTH          0x9315
961#define GL_MAX_FRAMEBUFFER_HEIGHT         0x9316
962#define GL_MAX_FRAMEBUFFER_SAMPLES        0x9318
963#define GL_UNIFORM                        0x92E1
964#define GL_UNIFORM_BLOCK                  0x92E2
965#define GL_PROGRAM_INPUT                  0x92E3
966#define GL_PROGRAM_OUTPUT                 0x92E4
967#define GL_BUFFER_VARIABLE                0x92E5
968#define GL_SHADER_STORAGE_BLOCK           0x92E6
969#define GL_ATOMIC_COUNTER_BUFFER          0x92C0
970#define GL_TRANSFORM_FEEDBACK_VARYING     0x92F4
971#define GL_ACTIVE_RESOURCES               0x92F5
972#define GL_MAX_NAME_LENGTH                0x92F6
973#define GL_MAX_NUM_ACTIVE_VARIABLES       0x92F7
974#define GL_NAME_LENGTH                    0x92F9
975#define GL_TYPE                           0x92FA
976#define GL_ARRAY_SIZE                     0x92FB
977#define GL_OFFSET                         0x92FC
978#define GL_BLOCK_INDEX                    0x92FD
979#define GL_ARRAY_STRIDE                   0x92FE
980#define GL_MATRIX_STRIDE                  0x92FF
981#define GL_IS_ROW_MAJOR                   0x9300
982#define GL_ATOMIC_COUNTER_BUFFER_INDEX    0x9301
983#define GL_BUFFER_BINDING                 0x9302
984#define GL_BUFFER_DATA_SIZE               0x9303
985#define GL_NUM_ACTIVE_VARIABLES           0x9304
986#define GL_ACTIVE_VARIABLES               0x9305
987#define GL_REFERENCED_BY_VERTEX_SHADER    0x9306
988#define GL_REFERENCED_BY_FRAGMENT_SHADER  0x930A
989#define GL_REFERENCED_BY_COMPUTE_SHADER   0x930B
990#define GL_TOP_LEVEL_ARRAY_SIZE           0x930C
991#define GL_TOP_LEVEL_ARRAY_STRIDE         0x930D
992#define GL_LOCATION                       0x930E
993#define GL_VERTEX_SHADER_BIT              0x00000001
994#define GL_FRAGMENT_SHADER_BIT            0x00000002
995#define GL_ALL_SHADER_BITS                0xFFFFFFFF
996#define GL_PROGRAM_SEPARABLE              0x8258
997#define GL_ACTIVE_PROGRAM                 0x8259
998#define GL_PROGRAM_PIPELINE_BINDING       0x825A
999#define GL_ATOMIC_COUNTER_BUFFER_BINDING  0x92C1
1000#define GL_ATOMIC_COUNTER_BUFFER_START    0x92C2
1001#define GL_ATOMIC_COUNTER_BUFFER_SIZE     0x92C3
1002#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
1003#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
1004#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
1005#define GL_MAX_VERTEX_ATOMIC_COUNTERS     0x92D2
1006#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS   0x92D6
1007#define GL_MAX_COMBINED_ATOMIC_COUNTERS   0x92D7
1008#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
1009#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
1010#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS  0x92D9
1011#define GL_UNSIGNED_INT_ATOMIC_COUNTER    0x92DB
1012#define GL_MAX_IMAGE_UNITS                0x8F38
1013#define GL_MAX_VERTEX_IMAGE_UNIFORMS      0x90CA
1014#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS    0x90CE
1015#define GL_MAX_COMBINED_IMAGE_UNIFORMS    0x90CF
1016#define GL_IMAGE_BINDING_NAME             0x8F3A
1017#define GL_IMAGE_BINDING_LEVEL            0x8F3B
1018#define GL_IMAGE_BINDING_LAYERED          0x8F3C
1019#define GL_IMAGE_BINDING_LAYER            0x8F3D
1020#define GL_IMAGE_BINDING_ACCESS           0x8F3E
1021#define GL_IMAGE_BINDING_FORMAT           0x906E
1022#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
1023#define GL_ELEMENT_ARRAY_BARRIER_BIT      0x00000002
1024#define GL_UNIFORM_BARRIER_BIT            0x00000004
1025#define GL_TEXTURE_FETCH_BARRIER_BIT      0x00000008
1026#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
1027#define GL_COMMAND_BARRIER_BIT            0x00000040
1028#define GL_PIXEL_BUFFER_BARRIER_BIT       0x00000080
1029#define GL_TEXTURE_UPDATE_BARRIER_BIT     0x00000100
1030#define GL_BUFFER_UPDATE_BARRIER_BIT      0x00000200
1031#define GL_FRAMEBUFFER_BARRIER_BIT        0x00000400
1032#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
1033#define GL_ATOMIC_COUNTER_BARRIER_BIT     0x00001000
1034#define GL_ALL_BARRIER_BITS               0xFFFFFFFF
1035#define GL_IMAGE_2D                       0x904D
1036#define GL_IMAGE_3D                       0x904E
1037#define GL_IMAGE_CUBE                     0x9050
1038#define GL_IMAGE_2D_ARRAY                 0x9053
1039#define GL_INT_IMAGE_2D                   0x9058
1040#define GL_INT_IMAGE_3D                   0x9059
1041#define GL_INT_IMAGE_CUBE                 0x905B
1042#define GL_INT_IMAGE_2D_ARRAY             0x905E
1043#define GL_UNSIGNED_INT_IMAGE_2D          0x9063
1044#define GL_UNSIGNED_INT_IMAGE_3D          0x9064
1045#define GL_UNSIGNED_INT_IMAGE_CUBE        0x9066
1046#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY    0x9069
1047#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
1048#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
1049#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
1050#define GL_READ_ONLY                      0x88B8
1051#define GL_WRITE_ONLY                     0x88B9
1052#define GL_READ_WRITE                     0x88BA
1053#define GL_SHADER_STORAGE_BUFFER          0x90D2
1054#define GL_SHADER_STORAGE_BUFFER_BINDING  0x90D3
1055#define GL_SHADER_STORAGE_BUFFER_START    0x90D4
1056#define GL_SHADER_STORAGE_BUFFER_SIZE     0x90D5
1057#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
1058#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
1059#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
1060#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
1061#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
1062#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE  0x90DE
1063#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
1064#define GL_SHADER_STORAGE_BARRIER_BIT     0x00002000
1065#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
1066#define GL_DEPTH_STENCIL_TEXTURE_MODE     0x90EA
1067#define GL_STENCIL_INDEX                  0x1901
1068#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
1069#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
1070#define GL_SAMPLE_POSITION                0x8E50
1071#define GL_SAMPLE_MASK                    0x8E51
1072#define GL_SAMPLE_MASK_VALUE              0x8E52
1073#define GL_TEXTURE_2D_MULTISAMPLE         0x9100
1074#define GL_MAX_SAMPLE_MASK_WORDS          0x8E59
1075#define GL_MAX_COLOR_TEXTURE_SAMPLES      0x910E
1076#define GL_MAX_DEPTH_TEXTURE_SAMPLES      0x910F
1077#define GL_MAX_INTEGER_SAMPLES            0x9110
1078#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
1079#define GL_TEXTURE_SAMPLES                0x9106
1080#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
1081#define GL_TEXTURE_WIDTH                  0x1000
1082#define GL_TEXTURE_HEIGHT                 0x1001
1083#define GL_TEXTURE_DEPTH                  0x8071
1084#define GL_TEXTURE_INTERNAL_FORMAT        0x1003
1085#define GL_TEXTURE_RED_SIZE               0x805C
1086#define GL_TEXTURE_GREEN_SIZE             0x805D
1087#define GL_TEXTURE_BLUE_SIZE              0x805E
1088#define GL_TEXTURE_ALPHA_SIZE             0x805F
1089#define GL_TEXTURE_DEPTH_SIZE             0x884A
1090#define GL_TEXTURE_STENCIL_SIZE           0x88F1
1091#define GL_TEXTURE_SHARED_SIZE            0x8C3F
1092#define GL_TEXTURE_RED_TYPE               0x8C10
1093#define GL_TEXTURE_GREEN_TYPE             0x8C11
1094#define GL_TEXTURE_BLUE_TYPE              0x8C12
1095#define GL_TEXTURE_ALPHA_TYPE             0x8C13
1096#define GL_TEXTURE_DEPTH_TYPE             0x8C16
1097#define GL_TEXTURE_COMPRESSED             0x86A1
1098#define GL_SAMPLER_2D_MULTISAMPLE         0x9108
1099#define GL_INT_SAMPLER_2D_MULTISAMPLE     0x9109
1100#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
1101#define GL_VERTEX_ATTRIB_BINDING          0x82D4
1102#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET  0x82D5
1103#define GL_VERTEX_BINDING_DIVISOR         0x82D6
1104#define GL_VERTEX_BINDING_OFFSET          0x82D7
1105#define GL_VERTEX_BINDING_STRIDE          0x82D8
1106#define GL_VERTEX_BINDING_BUFFER          0x8F4F
1107#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
1108#define GL_MAX_VERTEX_ATTRIB_BINDINGS     0x82DA
1109#define GL_MAX_VERTEX_ATTRIB_STRIDE       0x82E5
1110GL_APICALL void GL_APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
1111GL_APICALL void GL_APIENTRY glDispatchComputeIndirect (GLintptr indirect);
1112GL_APICALL void GL_APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect);
1113GL_APICALL void GL_APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect);
1114GL_APICALL void GL_APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);
1115GL_APICALL void GL_APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);
1116GL_APICALL void GL_APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
1117GL_APICALL GLuint GL_APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);
1118GL_APICALL void GL_APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
1119GL_APICALL void GL_APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
1120GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);
1121GL_APICALL void GL_APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
1122GL_APICALL void GL_APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
1123GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings);
1124GL_APICALL void GL_APIENTRY glBindProgramPipeline (GLuint pipeline);
1125GL_APICALL void GL_APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
1126GL_APICALL void GL_APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
1127GL_APICALL GLboolean GL_APIENTRY glIsProgramPipeline (GLuint pipeline);
1128GL_APICALL void GL_APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
1129GL_APICALL void GL_APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
1130GL_APICALL void GL_APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
1131GL_APICALL void GL_APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
1132GL_APICALL void GL_APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
1133GL_APICALL void GL_APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
1134GL_APICALL void GL_APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
1135GL_APICALL void GL_APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
1136GL_APICALL void GL_APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
1137GL_APICALL void GL_APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
1138GL_APICALL void GL_APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
1139GL_APICALL void GL_APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
1140GL_APICALL void GL_APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
1141GL_APICALL void GL_APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
1142GL_APICALL void GL_APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
1143GL_APICALL void GL_APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
1144GL_APICALL void GL_APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
1145GL_APICALL void GL_APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
1146GL_APICALL void GL_APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
1147GL_APICALL void GL_APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
1148GL_APICALL void GL_APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
1149GL_APICALL void GL_APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1150GL_APICALL void GL_APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1151GL_APICALL void GL_APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1152GL_APICALL void GL_APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1153GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1154GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1155GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1156GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1157GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1158GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1159GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1160GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1161GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1162GL_APICALL void GL_APIENTRY glValidateProgramPipeline (GLuint pipeline);
1163GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
1164GL_APICALL void GL_APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
1165GL_APICALL void GL_APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
1166GL_APICALL void GL_APIENTRY glMemoryBarrier (GLbitfield barriers);
1167GL_APICALL void GL_APIENTRY glMemoryBarrierByRegion (GLbitfield barriers);
1168GL_APICALL void GL_APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
1169GL_APICALL void GL_APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
1170GL_APICALL void GL_APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask);
1171GL_APICALL void GL_APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);
1172GL_APICALL void GL_APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);
1173GL_APICALL void GL_APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
1174GL_APICALL void GL_APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
1175GL_APICALL void GL_APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
1176GL_APICALL void GL_APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
1177GL_APICALL void GL_APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
1178#endif /* GL_ES_VERSION_3_1 */
1179
1180#ifdef __cplusplus
1181}
1182#endif
1183
1184#endif
Property changes on: branches/osd/src/lib/khronos/GLES3/gl31.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/GLES3/gl3ext.h
r0r31734
1#ifndef __gl3ext_h_
2#define __gl3ext_h_
3
4/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */
5
6/*
7 * This document is licensed under the SGI Free Software B License Version
8 * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
9 */
10
11/* OpenGL ES 3 Extensions
12 *
13 * After an OES extension's interactions with OpenGl ES 3.0 have been documented,
14 * its tokens and function definitions should be added to this file in a manner
15 * that does not conflict with gl2ext.h or gl3.h.
16 *
17 * Tokens and function definitions for extensions that have become standard
18 * features in OpenGL ES 3.0 will not be added to this file.
19 *
20 * Applications using OpenGL-ES-2-only extensions should include gl2ext.h
21 */
22
23#endif /* __gl3ext_h_ */
24
Property changes on: branches/osd/src/lib/khronos/GLES3/gl3ext.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/gl/glcorearb.h
r0r31734
1#ifndef __glcorearb_h_
2#define __glcorearb_h_ 1
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/*
9** Copyright (c) 2013 The Khronos Group Inc.
10**
11** Permission is hereby granted, free of charge, to any person obtaining a
12** copy of this software and/or associated documentation files (the
13** "Materials"), to deal in the Materials without restriction, including
14** without limitation the rights to use, copy, modify, merge, publish,
15** distribute, sublicense, and/or sell copies of the Materials, and to
16** permit persons to whom the Materials are furnished to do so, subject to
17** the following conditions:
18**
19** The above copyright notice and this permission notice shall be included
20** in all copies or substantial portions of the Materials.
21**
22** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
29*/
30/*
31** This header is generated from the Khronos OpenGL / OpenGL ES XML
32** API Registry. The current version of the Registry, generator scripts
33** used to make the header, and the header can be found at
34**   http://www.opengl.org/registry/
35**
36** Khronos $Revision: 23728 $ on $Date: 2013-10-28 14:53:57 -0700 (Mon, 28 Oct 2013) $
37*/
38
39#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
40#ifndef WIN32_LEAN_AND_MEAN
41#define WIN32_LEAN_AND_MEAN 1
42#endif
43#include <windows.h>
44#endif
45
46#ifndef APIENTRY
47#define APIENTRY
48#endif
49#ifndef APIENTRYP
50#define APIENTRYP APIENTRY *
51#endif
52#ifndef GLAPI
53#define GLAPI extern
54#endif
55
56/* glcorearb.h is for use with OpenGL core profile implementations.
57** It should should be placed in the same directory as gl.h and
58** included as <GL/glcorearb.h>.
59**
60** glcorearb.h includes only APIs in the latest OpenGL core profile
61** implementation together with APIs in newer ARB extensions which
62** can be supported by the core profile. It does not, and never will
63** include functionality removed from the core profile, such as
64** fixed-function vertex and fragment processing.
65**
66** Do not #include both <GL/glcorearb.h> and either of <GL/gl.h> or
67** <GL/glext.h> in the same source file.
68*/
69
70/* Generated C header for:
71 * API: gl
72 * Profile: core
73 * Versions considered: .*
74 * Versions emitted: .*
75 * Default extensions included: glcore
76 * Additional extensions included: _nomatch_^
77 * Extensions removed: _nomatch_^
78 */
79
80#ifndef GL_VERSION_1_0
81#define GL_VERSION_1_0 1
82typedef void GLvoid;
83typedef unsigned int GLenum;
84typedef float GLfloat;
85typedef int GLint;
86typedef int GLsizei;
87typedef unsigned int GLbitfield;
88typedef double GLdouble;
89typedef unsigned int GLuint;
90typedef unsigned char GLboolean;
91typedef unsigned char GLubyte;
92typedef void (APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
93typedef void (APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
94typedef void (APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
95typedef void (APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
96typedef void (APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size);
97typedef void (APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode);
98typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
99typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
100typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
101typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
102typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
103typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
104typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
105typedef void (APIENTRYP PFNGLDRAWBUFFERPROC) (GLenum mode);
106typedef void (APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
107typedef void (APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
108typedef void (APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
109typedef void (APIENTRYP PFNGLCLEARDEPTHPROC) (GLdouble depth);
110typedef void (APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
111typedef void (APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
112typedef void (APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
113typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
114typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap);
115typedef void (APIENTRYP PFNGLFINISHPROC) (void);
116typedef void (APIENTRYP PFNGLFLUSHPROC) (void);
117typedef void (APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
118typedef void (APIENTRYP PFNGLLOGICOPPROC) (GLenum opcode);
119typedef void (APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
120typedef void (APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
121typedef void (APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
122typedef void (APIENTRYP PFNGLPIXELSTOREFPROC) (GLenum pname, GLfloat param);
123typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
124typedef void (APIENTRYP PFNGLREADBUFFERPROC) (GLenum mode);
125typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
126typedef void (APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
127typedef void (APIENTRYP PFNGLGETDOUBLEVPROC) (GLenum pname, GLdouble *data);
128typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
129typedef void (APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
130typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
131typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
132typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
133typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
134typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
135typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC) (GLenum target, GLint level, GLenum pname, GLfloat *params);
136typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params);
137typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
138typedef void (APIENTRYP PFNGLDEPTHRANGEPROC) (GLdouble near, GLdouble far);
139typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
140#ifdef GL_GLEXT_PROTOTYPES
141GLAPI void APIENTRY glCullFace (GLenum mode);
142GLAPI void APIENTRY glFrontFace (GLenum mode);
143GLAPI void APIENTRY glHint (GLenum target, GLenum mode);
144GLAPI void APIENTRY glLineWidth (GLfloat width);
145GLAPI void APIENTRY glPointSize (GLfloat size);
146GLAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode);
147GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
148GLAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
149GLAPI void APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
150GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
151GLAPI void APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
152GLAPI void APIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
153GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
154GLAPI void APIENTRY glDrawBuffer (GLenum mode);
155GLAPI void APIENTRY glClear (GLbitfield mask);
156GLAPI void APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
157GLAPI void APIENTRY glClearStencil (GLint s);
158GLAPI void APIENTRY glClearDepth (GLdouble depth);
159GLAPI void APIENTRY glStencilMask (GLuint mask);
160GLAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
161GLAPI void APIENTRY glDepthMask (GLboolean flag);
162GLAPI void APIENTRY glDisable (GLenum cap);
163GLAPI void APIENTRY glEnable (GLenum cap);
164GLAPI void APIENTRY glFinish (void);
165GLAPI void APIENTRY glFlush (void);
166GLAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
167GLAPI void APIENTRY glLogicOp (GLenum opcode);
168GLAPI void APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
169GLAPI void APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
170GLAPI void APIENTRY glDepthFunc (GLenum func);
171GLAPI void APIENTRY glPixelStoref (GLenum pname, GLfloat param);
172GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param);
173GLAPI void APIENTRY glReadBuffer (GLenum mode);
174GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
175GLAPI void APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
176GLAPI void APIENTRY glGetDoublev (GLenum pname, GLdouble *data);
177GLAPI GLenum APIENTRY glGetError (void);
178GLAPI void APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
179GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data);
180GLAPI const GLubyte *APIENTRY glGetString (GLenum name);
181GLAPI void APIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
182GLAPI void APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
183GLAPI void APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
184GLAPI void APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);
185GLAPI void APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);
186GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap);
187GLAPI void APIENTRY glDepthRange (GLdouble near, GLdouble far);
188GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
189#endif
190#endif /* GL_VERSION_1_0 */
191
192#ifndef GL_VERSION_1_1
193#define GL_VERSION_1_1 1
194typedef float GLclampf;
195typedef double GLclampd;
196#define GL_DEPTH_BUFFER_BIT               0x00000100
197#define GL_STENCIL_BUFFER_BIT             0x00000400
198#define GL_COLOR_BUFFER_BIT               0x00004000
199#define GL_FALSE                          0
200#define GL_TRUE                           1
201#define GL_POINTS                         0x0000
202#define GL_LINES                          0x0001
203#define GL_LINE_LOOP                      0x0002
204#define GL_LINE_STRIP                     0x0003
205#define GL_TRIANGLES                      0x0004
206#define GL_TRIANGLE_STRIP                 0x0005
207#define GL_TRIANGLE_FAN                   0x0006
208#define GL_QUADS                          0x0007
209#define GL_NEVER                          0x0200
210#define GL_LESS                           0x0201
211#define GL_EQUAL                          0x0202
212#define GL_LEQUAL                         0x0203
213#define GL_GREATER                        0x0204
214#define GL_NOTEQUAL                       0x0205
215#define GL_GEQUAL                         0x0206
216#define GL_ALWAYS                         0x0207
217#define GL_ZERO                           0
218#define GL_ONE                            1
219#define GL_SRC_COLOR                      0x0300
220#define GL_ONE_MINUS_SRC_COLOR            0x0301
221#define GL_SRC_ALPHA                      0x0302
222#define GL_ONE_MINUS_SRC_ALPHA            0x0303
223#define GL_DST_ALPHA                      0x0304
224#define GL_ONE_MINUS_DST_ALPHA            0x0305
225#define GL_DST_COLOR                      0x0306
226#define GL_ONE_MINUS_DST_COLOR            0x0307
227#define GL_SRC_ALPHA_SATURATE             0x0308
228#define GL_NONE                           0
229#define GL_FRONT_LEFT                     0x0400
230#define GL_FRONT_RIGHT                    0x0401
231#define GL_BACK_LEFT                      0x0402
232#define GL_BACK_RIGHT                     0x0403
233#define GL_FRONT                          0x0404
234#define GL_BACK                           0x0405
235#define GL_LEFT                           0x0406
236#define GL_RIGHT                          0x0407
237#define GL_FRONT_AND_BACK                 0x0408
238#define GL_NO_ERROR                       0
239#define GL_INVALID_ENUM                   0x0500
240#define GL_INVALID_VALUE                  0x0501
241#define GL_INVALID_OPERATION              0x0502
242#define GL_OUT_OF_MEMORY                  0x0505
243#define GL_CW                             0x0900
244#define GL_CCW                            0x0901
245#define GL_POINT_SIZE                     0x0B11
246#define GL_POINT_SIZE_RANGE               0x0B12
247#define GL_POINT_SIZE_GRANULARITY         0x0B13
248#define GL_LINE_SMOOTH                    0x0B20
249#define GL_LINE_WIDTH                     0x0B21
250#define GL_LINE_WIDTH_RANGE               0x0B22
251#define GL_LINE_WIDTH_GRANULARITY         0x0B23
252#define GL_POLYGON_MODE                   0x0B40
253#define GL_POLYGON_SMOOTH                 0x0B41
254#define GL_CULL_FACE                      0x0B44
255#define GL_CULL_FACE_MODE                 0x0B45
256#define GL_FRONT_FACE                     0x0B46
257#define GL_DEPTH_RANGE                    0x0B70
258#define GL_DEPTH_TEST                     0x0B71
259#define GL_DEPTH_WRITEMASK                0x0B72
260#define GL_DEPTH_CLEAR_VALUE              0x0B73
261#define GL_DEPTH_FUNC                     0x0B74
262#define GL_STENCIL_TEST                   0x0B90
263#define GL_STENCIL_CLEAR_VALUE            0x0B91
264#define GL_STENCIL_FUNC                   0x0B92
265#define GL_STENCIL_VALUE_MASK             0x0B93
266#define GL_STENCIL_FAIL                   0x0B94
267#define GL_STENCIL_PASS_DEPTH_FAIL        0x0B95
268#define GL_STENCIL_PASS_DEPTH_PASS        0x0B96
269#define GL_STENCIL_REF                    0x0B97
270#define GL_STENCIL_WRITEMASK              0x0B98
271#define GL_VIEWPORT                       0x0BA2
272#define GL_DITHER                         0x0BD0
273#define GL_BLEND_DST                      0x0BE0
274#define GL_BLEND_SRC                      0x0BE1
275#define GL_BLEND                          0x0BE2
276#define GL_LOGIC_OP_MODE                  0x0BF0
277#define GL_COLOR_LOGIC_OP                 0x0BF2
278#define GL_DRAW_BUFFER                    0x0C01
279#define GL_READ_BUFFER                    0x0C02
280#define GL_SCISSOR_BOX                    0x0C10
281#define GL_SCISSOR_TEST                   0x0C11
282#define GL_COLOR_CLEAR_VALUE              0x0C22
283#define GL_COLOR_WRITEMASK                0x0C23
284#define GL_DOUBLEBUFFER                   0x0C32
285#define GL_STEREO                         0x0C33
286#define GL_LINE_SMOOTH_HINT               0x0C52
287#define GL_POLYGON_SMOOTH_HINT            0x0C53
288#define GL_UNPACK_SWAP_BYTES              0x0CF0
289#define GL_UNPACK_LSB_FIRST               0x0CF1
290#define GL_UNPACK_ROW_LENGTH              0x0CF2
291#define GL_UNPACK_SKIP_ROWS               0x0CF3
292#define GL_UNPACK_SKIP_PIXELS             0x0CF4
293#define GL_UNPACK_ALIGNMENT               0x0CF5
294#define GL_PACK_SWAP_BYTES                0x0D00
295#define GL_PACK_LSB_FIRST                 0x0D01
296#define GL_PACK_ROW_LENGTH                0x0D02
297#define GL_PACK_SKIP_ROWS                 0x0D03
298#define GL_PACK_SKIP_PIXELS               0x0D04
299#define GL_PACK_ALIGNMENT                 0x0D05
300#define GL_MAX_TEXTURE_SIZE               0x0D33
301#define GL_MAX_VIEWPORT_DIMS              0x0D3A
302#define GL_SUBPIXEL_BITS                  0x0D50
303#define GL_TEXTURE_1D                     0x0DE0
304#define GL_TEXTURE_2D                     0x0DE1
305#define GL_POLYGON_OFFSET_UNITS           0x2A00
306#define GL_POLYGON_OFFSET_POINT           0x2A01
307#define GL_POLYGON_OFFSET_LINE            0x2A02
308#define GL_POLYGON_OFFSET_FILL            0x8037
309#define GL_POLYGON_OFFSET_FACTOR          0x8038
310#define GL_TEXTURE_BINDING_1D             0x8068
311#define GL_TEXTURE_BINDING_2D             0x8069
312#define GL_TEXTURE_WIDTH                  0x1000
313#define GL_TEXTURE_HEIGHT                 0x1001
314#define GL_TEXTURE_INTERNAL_FORMAT        0x1003
315#define GL_TEXTURE_BORDER_COLOR           0x1004
316#define GL_TEXTURE_RED_SIZE               0x805C
317#define GL_TEXTURE_GREEN_SIZE             0x805D
318#define GL_TEXTURE_BLUE_SIZE              0x805E
319#define GL_TEXTURE_ALPHA_SIZE             0x805F
320#define GL_DONT_CARE                      0x1100
321#define GL_FASTEST                        0x1101
322#define GL_NICEST                         0x1102
323#define GL_BYTE                           0x1400
324#define GL_UNSIGNED_BYTE                  0x1401
325#define GL_SHORT                          0x1402
326#define GL_UNSIGNED_SHORT                 0x1403
327#define GL_INT                            0x1404
328#define GL_UNSIGNED_INT                   0x1405
329#define GL_FLOAT                          0x1406
330#define GL_DOUBLE                         0x140A
331#define GL_STACK_OVERFLOW                 0x0503
332#define GL_STACK_UNDERFLOW                0x0504
333#define GL_CLEAR                          0x1500
334#define GL_AND                            0x1501
335#define GL_AND_REVERSE                    0x1502
336#define GL_COPY                           0x1503
337#define GL_AND_INVERTED                   0x1504
338#define GL_NOOP                           0x1505
339#define GL_XOR                            0x1506
340#define GL_OR                             0x1507
341#define GL_NOR                            0x1508
342#define GL_EQUIV                          0x1509
343#define GL_INVERT                         0x150A
344#define GL_OR_REVERSE                     0x150B
345#define GL_COPY_INVERTED                  0x150C
346#define GL_OR_INVERTED                    0x150D
347#define GL_NAND                           0x150E
348#define GL_SET                            0x150F
349#define GL_TEXTURE                        0x1702
350#define GL_COLOR                          0x1800
351#define GL_DEPTH                          0x1801
352#define GL_STENCIL                        0x1802
353#define GL_STENCIL_INDEX                  0x1901
354#define GL_DEPTH_COMPONENT                0x1902
355#define GL_RED                            0x1903
356#define GL_GREEN                          0x1904
357#define GL_BLUE                           0x1905
358#define GL_ALPHA                          0x1906
359#define GL_RGB                            0x1907
360#define GL_RGBA                           0x1908
361#define GL_POINT                          0x1B00
362#define GL_LINE                           0x1B01
363#define GL_FILL                           0x1B02
364#define GL_KEEP                           0x1E00
365#define GL_REPLACE                        0x1E01
366#define GL_INCR                           0x1E02
367#define GL_DECR                           0x1E03
368#define GL_VENDOR                         0x1F00
369#define GL_RENDERER                       0x1F01
370#define GL_VERSION                        0x1F02
371#define GL_EXTENSIONS                     0x1F03
372#define GL_NEAREST                        0x2600
373#define GL_LINEAR                         0x2601
374#define GL_NEAREST_MIPMAP_NEAREST         0x2700
375#define GL_LINEAR_MIPMAP_NEAREST          0x2701
376#define GL_NEAREST_MIPMAP_LINEAR          0x2702
377#define GL_LINEAR_MIPMAP_LINEAR           0x2703
378#define GL_TEXTURE_MAG_FILTER             0x2800
379#define GL_TEXTURE_MIN_FILTER             0x2801
380#define GL_TEXTURE_WRAP_S                 0x2802
381#define GL_TEXTURE_WRAP_T                 0x2803
382#define GL_PROXY_TEXTURE_1D               0x8063
383#define GL_PROXY_TEXTURE_2D               0x8064
384#define GL_REPEAT                         0x2901
385#define GL_R3_G3_B2                       0x2A10
386#define GL_RGB4                           0x804F
387#define GL_RGB5                           0x8050
388#define GL_RGB8                           0x8051
389#define GL_RGB10                          0x8052
390#define GL_RGB12                          0x8053
391#define GL_RGB16                          0x8054
392#define GL_RGBA2                          0x8055
393#define GL_RGBA4                          0x8056
394#define GL_RGB5_A1                        0x8057
395#define GL_RGBA8                          0x8058
396#define GL_RGB10_A2                       0x8059
397#define GL_RGBA12                         0x805A
398#define GL_RGBA16                         0x805B
399#define GL_VERTEX_ARRAY                   0x8074
400typedef void (APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
401typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
402typedef void (APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, void **params);
403typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
404typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
405typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
406typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
407typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
408typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
409typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
410typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
411typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
412typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
413typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
414#ifdef GL_GLEXT_PROTOTYPES
415GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
416GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
417GLAPI void APIENTRY glGetPointerv (GLenum pname, void **params);
418GLAPI void APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
419GLAPI void APIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
420GLAPI void APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
421GLAPI void APIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
422GLAPI void APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
423GLAPI void APIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
424GLAPI void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
425GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture);
426GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
427GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures);
428GLAPI GLboolean APIENTRY glIsTexture (GLuint texture);
429#endif
430#endif /* GL_VERSION_1_1 */
431
432#ifndef GL_VERSION_1_2
433#define GL_VERSION_1_2 1
434#define GL_UNSIGNED_BYTE_3_3_2            0x8032
435#define GL_UNSIGNED_SHORT_4_4_4_4         0x8033
436#define GL_UNSIGNED_SHORT_5_5_5_1         0x8034
437#define GL_UNSIGNED_INT_8_8_8_8           0x8035
438#define GL_UNSIGNED_INT_10_10_10_2        0x8036
439#define GL_TEXTURE_BINDING_3D             0x806A
440#define GL_PACK_SKIP_IMAGES               0x806B
441#define GL_PACK_IMAGE_HEIGHT              0x806C
442#define GL_UNPACK_SKIP_IMAGES             0x806D
443#define GL_UNPACK_IMAGE_HEIGHT            0x806E
444#define GL_TEXTURE_3D                     0x806F
445#define GL_PROXY_TEXTURE_3D               0x8070
446#define GL_TEXTURE_DEPTH                  0x8071
447#define GL_TEXTURE_WRAP_R                 0x8072
448#define GL_MAX_3D_TEXTURE_SIZE            0x8073
449#define GL_UNSIGNED_BYTE_2_3_3_REV        0x8362
450#define GL_UNSIGNED_SHORT_5_6_5           0x8363
451#define GL_UNSIGNED_SHORT_5_6_5_REV       0x8364
452#define GL_UNSIGNED_SHORT_4_4_4_4_REV     0x8365
453#define GL_UNSIGNED_SHORT_1_5_5_5_REV     0x8366
454#define GL_UNSIGNED_INT_8_8_8_8_REV       0x8367
455#define GL_UNSIGNED_INT_2_10_10_10_REV    0x8368
456#define GL_BGR                            0x80E0
457#define GL_BGRA                           0x80E1
458#define GL_MAX_ELEMENTS_VERTICES          0x80E8
459#define GL_MAX_ELEMENTS_INDICES           0x80E9
460#define GL_CLAMP_TO_EDGE                  0x812F
461#define GL_TEXTURE_MIN_LOD                0x813A
462#define GL_TEXTURE_MAX_LOD                0x813B
463#define GL_TEXTURE_BASE_LEVEL             0x813C
464#define GL_TEXTURE_MAX_LEVEL              0x813D
465#define GL_SMOOTH_POINT_SIZE_RANGE        0x0B12
466#define GL_SMOOTH_POINT_SIZE_GRANULARITY  0x0B13
467#define GL_SMOOTH_LINE_WIDTH_RANGE        0x0B22
468#define GL_SMOOTH_LINE_WIDTH_GRANULARITY  0x0B23
469#define GL_ALIASED_LINE_WIDTH_RANGE       0x846E
470typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
471typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
472typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
473typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
474#ifdef GL_GLEXT_PROTOTYPES
475GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
476GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
477GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
478GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
479#endif
480#endif /* GL_VERSION_1_2 */
481
482#ifndef GL_VERSION_1_3
483#define GL_VERSION_1_3 1
484#define GL_TEXTURE0                       0x84C0
485#define GL_TEXTURE1                       0x84C1
486#define GL_TEXTURE2                       0x84C2
487#define GL_TEXTURE3                       0x84C3
488#define GL_TEXTURE4                       0x84C4
489#define GL_TEXTURE5                       0x84C5
490#define GL_TEXTURE6                       0x84C6
491#define GL_TEXTURE7                       0x84C7
492#define GL_TEXTURE8                       0x84C8
493#define GL_TEXTURE9                       0x84C9
494#define GL_TEXTURE10                      0x84CA
495#define GL_TEXTURE11                      0x84CB
496#define GL_TEXTURE12                      0x84CC
497#define GL_TEXTURE13                      0x84CD
498#define GL_TEXTURE14                      0x84CE
499#define GL_TEXTURE15                      0x84CF
500#define GL_TEXTURE16                      0x84D0
501#define GL_TEXTURE17                      0x84D1
502#define GL_TEXTURE18                      0x84D2
503#define GL_TEXTURE19                      0x84D3
504#define GL_TEXTURE20                      0x84D4
505#define GL_TEXTURE21                      0x84D5
506#define GL_TEXTURE22                      0x84D6
507#define GL_TEXTURE23                      0x84D7
508#define GL_TEXTURE24                      0x84D8
509#define GL_TEXTURE25                      0x84D9
510#define GL_TEXTURE26                      0x84DA
511#define GL_TEXTURE27                      0x84DB
512#define GL_TEXTURE28                      0x84DC
513#define GL_TEXTURE29                      0x84DD
514#define GL_TEXTURE30                      0x84DE
515#define GL_TEXTURE31                      0x84DF
516#define GL_ACTIVE_TEXTURE                 0x84E0
517#define GL_MULTISAMPLE                    0x809D
518#define GL_SAMPLE_ALPHA_TO_COVERAGE       0x809E
519#define GL_SAMPLE_ALPHA_TO_ONE            0x809F
520#define GL_SAMPLE_COVERAGE                0x80A0
521#define GL_SAMPLE_BUFFERS                 0x80A8
522#define GL_SAMPLES                        0x80A9
523#define GL_SAMPLE_COVERAGE_VALUE          0x80AA
524#define GL_SAMPLE_COVERAGE_INVERT         0x80AB
525#define GL_TEXTURE_CUBE_MAP               0x8513
526#define GL_TEXTURE_BINDING_CUBE_MAP       0x8514
527#define GL_TEXTURE_CUBE_MAP_POSITIVE_X    0x8515
528#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X    0x8516
529#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y    0x8517
530#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y    0x8518
531#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z    0x8519
532#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z    0x851A
533#define GL_PROXY_TEXTURE_CUBE_MAP         0x851B
534#define GL_MAX_CUBE_MAP_TEXTURE_SIZE      0x851C
535#define GL_COMPRESSED_RGB                 0x84ED
536#define GL_COMPRESSED_RGBA                0x84EE
537#define GL_TEXTURE_COMPRESSION_HINT       0x84EF
538#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE  0x86A0
539#define GL_TEXTURE_COMPRESSED             0x86A1
540#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
541#define GL_COMPRESSED_TEXTURE_FORMATS     0x86A3
542#define GL_CLAMP_TO_BORDER                0x812D
543typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
544typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
545typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
546typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
547typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
548typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
549typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
550typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
551typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img);
552#ifdef GL_GLEXT_PROTOTYPES
553GLAPI void APIENTRY glActiveTexture (GLenum texture);
554GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
555GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
556GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
557GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
558GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
559GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
560GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
561GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, void *img);
562#endif
563#endif /* GL_VERSION_1_3 */
564
565#ifndef GL_VERSION_1_4
566#define GL_VERSION_1_4 1
567#define GL_BLEND_DST_RGB                  0x80C8
568#define GL_BLEND_SRC_RGB                  0x80C9
569#define GL_BLEND_DST_ALPHA                0x80CA
570#define GL_BLEND_SRC_ALPHA                0x80CB
571#define GL_POINT_FADE_THRESHOLD_SIZE      0x8128
572#define GL_DEPTH_COMPONENT16              0x81A5
573#define GL_DEPTH_COMPONENT24              0x81A6
574#define GL_DEPTH_COMPONENT32              0x81A7
575#define GL_MIRRORED_REPEAT                0x8370
576#define GL_MAX_TEXTURE_LOD_BIAS           0x84FD
577#define GL_TEXTURE_LOD_BIAS               0x8501
578#define GL_INCR_WRAP                      0x8507
579#define GL_DECR_WRAP                      0x8508
580#define GL_TEXTURE_DEPTH_SIZE             0x884A
581#define GL_TEXTURE_COMPARE_MODE           0x884C
582#define GL_TEXTURE_COMPARE_FUNC           0x884D
583#define GL_FUNC_ADD                       0x8006
584#define GL_FUNC_SUBTRACT                  0x800A
585#define GL_FUNC_REVERSE_SUBTRACT          0x800B
586#define GL_MIN                            0x8007
587#define GL_MAX                            0x8008
588#define GL_CONSTANT_COLOR                 0x8001
589#define GL_ONE_MINUS_CONSTANT_COLOR       0x8002
590#define GL_CONSTANT_ALPHA                 0x8003
591#define GL_ONE_MINUS_CONSTANT_ALPHA       0x8004
592typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
593typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
594typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);
595typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
596typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
597typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
598typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
599typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
600typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
601#ifdef GL_GLEXT_PROTOTYPES
602GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
603GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
604GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);
605GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param);
606GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
607GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param);
608GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params);
609GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
610GLAPI void APIENTRY glBlendEquation (GLenum mode);
611#endif
612#endif /* GL_VERSION_1_4 */
613
614#ifndef GL_VERSION_1_5
615#define GL_VERSION_1_5 1
616#include <stddef.h>
617typedef ptrdiff_t GLsizeiptr;
618typedef ptrdiff_t GLintptr;
619#define GL_BUFFER_SIZE                    0x8764
620#define GL_BUFFER_USAGE                   0x8765
621#define GL_QUERY_COUNTER_BITS             0x8864
622#define GL_CURRENT_QUERY                  0x8865
623#define GL_QUERY_RESULT                   0x8866
624#define GL_QUERY_RESULT_AVAILABLE         0x8867
625#define GL_ARRAY_BUFFER                   0x8892
626#define GL_ELEMENT_ARRAY_BUFFER           0x8893
627#define GL_ARRAY_BUFFER_BINDING           0x8894
628#define GL_ELEMENT_ARRAY_BUFFER_BINDING   0x8895
629#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
630#define GL_READ_ONLY                      0x88B8
631#define GL_WRITE_ONLY                     0x88B9
632#define GL_READ_WRITE                     0x88BA
633#define GL_BUFFER_ACCESS                  0x88BB
634#define GL_BUFFER_MAPPED                  0x88BC
635#define GL_BUFFER_MAP_POINTER             0x88BD
636#define GL_STREAM_DRAW                    0x88E0
637#define GL_STREAM_READ                    0x88E1
638#define GL_STREAM_COPY                    0x88E2
639#define GL_STATIC_DRAW                    0x88E4
640#define GL_STATIC_READ                    0x88E5
641#define GL_STATIC_COPY                    0x88E6
642#define GL_DYNAMIC_DRAW                   0x88E8
643#define GL_DYNAMIC_READ                   0x88E9
644#define GL_DYNAMIC_COPY                   0x88EA
645#define GL_SAMPLES_PASSED                 0x8914
646#define GL_SRC1_ALPHA                     0x8589
647typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
648typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
649typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id);
650typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
651typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
652typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
653typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params);
654typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
655typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
656typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
657typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
658typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
659typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
660typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
661typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data);
662typedef void *(APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);
663typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
664typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
665typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params);
666#ifdef GL_GLEXT_PROTOTYPES
667GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids);
668GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
669GLAPI GLboolean APIENTRY glIsQuery (GLuint id);
670GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id);
671GLAPI void APIENTRY glEndQuery (GLenum target);
672GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
673GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params);
674GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
675GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
676GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
677GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
678GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer);
679GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
680GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
681GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, void *data);
682GLAPI void *APIENTRY glMapBuffer (GLenum target, GLenum access);
683GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target);
684GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
685GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
686#endif
687#endif /* GL_VERSION_1_5 */
688
689#ifndef GL_VERSION_2_0
690#define GL_VERSION_2_0 1
691typedef char GLchar;
692typedef short GLshort;
693typedef signed char GLbyte;
694typedef unsigned short GLushort;
695#define GL_BLEND_EQUATION_RGB             0x8009
696#define GL_VERTEX_ATTRIB_ARRAY_ENABLED    0x8622
697#define GL_VERTEX_ATTRIB_ARRAY_SIZE       0x8623
698#define GL_VERTEX_ATTRIB_ARRAY_STRIDE     0x8624
699#define GL_VERTEX_ATTRIB_ARRAY_TYPE       0x8625
700#define GL_CURRENT_VERTEX_ATTRIB          0x8626
701#define GL_VERTEX_PROGRAM_POINT_SIZE      0x8642
702#define GL_VERTEX_ATTRIB_ARRAY_POINTER    0x8645
703#define GL_STENCIL_BACK_FUNC              0x8800
704#define GL_STENCIL_BACK_FAIL              0x8801
705#define GL_STENCIL_BACK_PASS_DEPTH_FAIL   0x8802
706#define GL_STENCIL_BACK_PASS_DEPTH_PASS   0x8803
707#define GL_MAX_DRAW_BUFFERS               0x8824
708#define GL_DRAW_BUFFER0                   0x8825
709#define GL_DRAW_BUFFER1                   0x8826
710#define GL_DRAW_BUFFER2                   0x8827
711#define GL_DRAW_BUFFER3                   0x8828
712#define GL_DRAW_BUFFER4                   0x8829
713#define GL_DRAW_BUFFER5                   0x882A
714#define GL_DRAW_BUFFER6                   0x882B
715#define GL_DRAW_BUFFER7                   0x882C
716#define GL_DRAW_BUFFER8                   0x882D
717#define GL_DRAW_BUFFER9                   0x882E
718#define GL_DRAW_BUFFER10                  0x882F
719#define GL_DRAW_BUFFER11                  0x8830
720#define GL_DRAW_BUFFER12                  0x8831
721#define GL_DRAW_BUFFER13                  0x8832
722#define GL_DRAW_BUFFER14                  0x8833
723#define GL_DRAW_BUFFER15                  0x8834
724#define GL_BLEND_EQUATION_ALPHA           0x883D
725#define GL_MAX_VERTEX_ATTRIBS             0x8869
726#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
727#define GL_MAX_TEXTURE_IMAGE_UNITS        0x8872
728#define GL_FRAGMENT_SHADER                0x8B30
729#define GL_VERTEX_SHADER                  0x8B31
730#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
731#define GL_MAX_VERTEX_UNIFORM_COMPONENTS  0x8B4A
732#define GL_MAX_VARYING_FLOATS             0x8B4B
733#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
734#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
735#define GL_SHADER_TYPE                    0x8B4F
736#define GL_FLOAT_VEC2                     0x8B50
737#define GL_FLOAT_VEC3                     0x8B51
738#define GL_FLOAT_VEC4                     0x8B52
739#define GL_INT_VEC2                       0x8B53
740#define GL_INT_VEC3                       0x8B54
741#define GL_INT_VEC4                       0x8B55
742#define GL_BOOL                           0x8B56
743#define GL_BOOL_VEC2                      0x8B57
744#define GL_BOOL_VEC3                      0x8B58
745#define GL_BOOL_VEC4                      0x8B59
746#define GL_FLOAT_MAT2                     0x8B5A
747#define GL_FLOAT_MAT3                     0x8B5B
748#define GL_FLOAT_MAT4                     0x8B5C
749#define GL_SAMPLER_1D                     0x8B5D
750#define GL_SAMPLER_2D                     0x8B5E
751#define GL_SAMPLER_3D                     0x8B5F
752#define GL_SAMPLER_CUBE                   0x8B60
753#define GL_SAMPLER_1D_SHADOW              0x8B61
754#define GL_SAMPLER_2D_SHADOW              0x8B62
755#define GL_DELETE_STATUS                  0x8B80
756#define GL_COMPILE_STATUS                 0x8B81
757#define GL_LINK_STATUS                    0x8B82
758#define GL_VALIDATE_STATUS                0x8B83
759#define GL_INFO_LOG_LENGTH                0x8B84
760#define GL_ATTACHED_SHADERS               0x8B85
761#define GL_ACTIVE_UNIFORMS                0x8B86
762#define GL_ACTIVE_UNIFORM_MAX_LENGTH      0x8B87
763#define GL_SHADER_SOURCE_LENGTH           0x8B88
764#define GL_ACTIVE_ATTRIBUTES              0x8B89
765#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH    0x8B8A
766#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
767#define GL_SHADING_LANGUAGE_VERSION       0x8B8C
768#define GL_CURRENT_PROGRAM                0x8B8D
769#define GL_POINT_SPRITE_COORD_ORIGIN      0x8CA0
770#define GL_LOWER_LEFT                     0x8CA1
771#define GL_UPPER_LEFT                     0x8CA2
772#define GL_STENCIL_BACK_REF               0x8CA3
773#define GL_STENCIL_BACK_VALUE_MASK        0x8CA4
774#define GL_STENCIL_BACK_WRITEMASK         0x8CA5
775typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
776typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
777typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
778typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
779typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
780typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
781typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
782typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
783typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
784typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
785typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
786typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
787typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
788typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
789typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
790typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
791typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
792typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
793typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
794typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
795typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
796typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
797typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
798typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
799typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
800typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
801typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
802typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params);
803typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
804typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
805typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
806typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
807typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
808typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
809typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
810typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
811typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
812typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
813typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
814typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
815typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
816typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
817typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
818typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
819typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
820typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
821typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
822typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
823typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
824typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
825typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
826typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
827typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
828typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
829typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
830typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
831typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);
832typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v);
833typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
834typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
835typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);
836typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v);
837typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);
838typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v);
839typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
840typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
841typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);
842typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v);
843typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
844typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v);
845typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
846typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
847typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
848typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v);
849typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v);
850typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v);
851typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v);
852typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
853typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v);
854typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v);
855typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v);
856typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v);
857typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
858typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v);
859typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
860typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
861typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v);
862typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
863typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v);
864typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v);
865typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v);
866typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v);
867typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
868#ifdef GL_GLEXT_PROTOTYPES
869GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
870GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
871GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
872GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
873GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
874GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader);
875GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
876GLAPI void APIENTRY glCompileShader (GLuint shader);
877GLAPI GLuint APIENTRY glCreateProgram (void);
878GLAPI GLuint APIENTRY glCreateShader (GLenum type);
879GLAPI void APIENTRY glDeleteProgram (GLuint program);
880GLAPI void APIENTRY glDeleteShader (GLuint shader);
881GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader);
882GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index);
883GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index);
884GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
885GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
886GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
887GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
888GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
889GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
890GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
891GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
892GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
893GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
894GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
895GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
896GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params);
897GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
898GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
899GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
900GLAPI GLboolean APIENTRY glIsProgram (GLuint program);
901GLAPI GLboolean APIENTRY glIsShader (GLuint shader);
902GLAPI void APIENTRY glLinkProgram (GLuint program);
903GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
904GLAPI void APIENTRY glUseProgram (GLuint program);
905GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0);
906GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
907GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
908GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
909GLAPI void APIENTRY glUniform1i (GLint location, GLint v0);
910GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
911GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
912GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
913GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
914GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
915GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
916GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
917GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
918GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
919GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
920GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
921GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
922GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
923GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
924GLAPI void APIENTRY glValidateProgram (GLuint program);
925GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x);
926GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v);
927GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
928GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
929GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x);
930GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v);
931GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y);
932GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v);
933GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
934GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
935GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y);
936GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v);
937GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
938GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v);
939GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
940GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
941GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z);
942GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v);
943GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v);
944GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v);
945GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v);
946GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
947GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v);
948GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v);
949GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v);
950GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v);
951GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
952GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v);
953GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
954GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
955GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v);
956GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
957GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v);
958GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v);
959GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v);
960GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v);
961GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
962#endif
963#endif /* GL_VERSION_2_0 */
964
965#ifndef GL_VERSION_2_1
966#define GL_VERSION_2_1 1
967#define GL_PIXEL_PACK_BUFFER              0x88EB
968#define GL_PIXEL_UNPACK_BUFFER            0x88EC
969#define GL_PIXEL_PACK_BUFFER_BINDING      0x88ED
970#define GL_PIXEL_UNPACK_BUFFER_BINDING    0x88EF
971#define GL_FLOAT_MAT2x3                   0x8B65
972#define GL_FLOAT_MAT2x4                   0x8B66
973#define GL_FLOAT_MAT3x2                   0x8B67
974#define GL_FLOAT_MAT3x4                   0x8B68
975#define GL_FLOAT_MAT4x2                   0x8B69
976#define GL_FLOAT_MAT4x3                   0x8B6A
977#define GL_SRGB                           0x8C40
978#define GL_SRGB8                          0x8C41
979#define GL_SRGB_ALPHA                     0x8C42
980#define GL_SRGB8_ALPHA8                   0x8C43
981#define GL_COMPRESSED_SRGB                0x8C48
982#define GL_COMPRESSED_SRGB_ALPHA          0x8C49
983typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
984typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
985typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
986typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
987typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
988typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
989#ifdef GL_GLEXT_PROTOTYPES
990GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
991GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
992GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
993GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
994GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
995GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
996#endif
997#endif /* GL_VERSION_2_1 */
998
999#ifndef GL_VERSION_3_0
1000#define GL_VERSION_3_0 1
1001typedef unsigned short GLhalf;
1002#define GL_COMPARE_REF_TO_TEXTURE         0x884E
1003#define GL_CLIP_DISTANCE0                 0x3000
1004#define GL_CLIP_DISTANCE1                 0x3001
1005#define GL_CLIP_DISTANCE2                 0x3002
1006#define GL_CLIP_DISTANCE3                 0x3003
1007#define GL_CLIP_DISTANCE4                 0x3004
1008#define GL_CLIP_DISTANCE5                 0x3005
1009#define GL_CLIP_DISTANCE6                 0x3006
1010#define GL_CLIP_DISTANCE7                 0x3007
1011#define GL_MAX_CLIP_DISTANCES             0x0D32
1012#define GL_MAJOR_VERSION                  0x821B
1013#define GL_MINOR_VERSION                  0x821C
1014#define GL_NUM_EXTENSIONS                 0x821D
1015#define GL_CONTEXT_FLAGS                  0x821E
1016#define GL_COMPRESSED_RED                 0x8225
1017#define GL_COMPRESSED_RG                  0x8226
1018#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
1019#define GL_RGBA32F                        0x8814
1020#define GL_RGB32F                         0x8815
1021#define GL_RGBA16F                        0x881A
1022#define GL_RGB16F                         0x881B
1023#define GL_VERTEX_ATTRIB_ARRAY_INTEGER    0x88FD
1024#define GL_MAX_ARRAY_TEXTURE_LAYERS       0x88FF
1025#define GL_MIN_PROGRAM_TEXEL_OFFSET       0x8904
1026#define GL_MAX_PROGRAM_TEXEL_OFFSET       0x8905
1027#define GL_CLAMP_READ_COLOR               0x891C
1028#define GL_FIXED_ONLY                     0x891D
1029#define GL_MAX_VARYING_COMPONENTS         0x8B4B
1030#define GL_TEXTURE_1D_ARRAY               0x8C18
1031#define GL_PROXY_TEXTURE_1D_ARRAY         0x8C19
1032#define GL_TEXTURE_2D_ARRAY               0x8C1A
1033#define GL_PROXY_TEXTURE_2D_ARRAY         0x8C1B
1034#define GL_TEXTURE_BINDING_1D_ARRAY       0x8C1C
1035#define GL_TEXTURE_BINDING_2D_ARRAY       0x8C1D
1036#define GL_R11F_G11F_B10F                 0x8C3A
1037#define GL_UNSIGNED_INT_10F_11F_11F_REV   0x8C3B
1038#define GL_RGB9_E5                        0x8C3D
1039#define GL_UNSIGNED_INT_5_9_9_9_REV       0x8C3E
1040#define GL_TEXTURE_SHARED_SIZE            0x8C3F
1041#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
1042#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
1043#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
1044#define GL_TRANSFORM_FEEDBACK_VARYINGS    0x8C83
1045#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
1046#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
1047#define GL_PRIMITIVES_GENERATED           0x8C87
1048#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
1049#define GL_RASTERIZER_DISCARD             0x8C89
1050#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
1051#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
1052#define GL_INTERLEAVED_ATTRIBS            0x8C8C
1053#define GL_SEPARATE_ATTRIBS               0x8C8D
1054#define GL_TRANSFORM_FEEDBACK_BUFFER      0x8C8E
1055#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
1056#define GL_RGBA32UI                       0x8D70
1057#define GL_RGB32UI                        0x8D71
1058#define GL_RGBA16UI                       0x8D76
1059#define GL_RGB16UI                        0x8D77
1060#define GL_RGBA8UI                        0x8D7C
1061#define GL_RGB8UI                         0x8D7D
1062#define GL_RGBA32I                        0x8D82
1063#define GL_RGB32I                         0x8D83
1064#define GL_RGBA16I                        0x8D88
1065#define GL_RGB16I                         0x8D89
1066#define GL_RGBA8I                         0x8D8E
1067#define GL_RGB8I                          0x8D8F
1068#define GL_RED_INTEGER                    0x8D94
1069#define GL_GREEN_INTEGER                  0x8D95
1070#define GL_BLUE_INTEGER                   0x8D96
1071#define GL_RGB_INTEGER                    0x8D98
1072#define GL_RGBA_INTEGER                   0x8D99
1073#define GL_BGR_INTEGER                    0x8D9A
1074#define GL_BGRA_INTEGER                   0x8D9B
1075#define GL_SAMPLER_1D_ARRAY               0x8DC0
1076#define GL_SAMPLER_2D_ARRAY               0x8DC1
1077#define GL_SAMPLER_1D_ARRAY_SHADOW        0x8DC3
1078#define GL_SAMPLER_2D_ARRAY_SHADOW        0x8DC4
1079#define GL_SAMPLER_CUBE_SHADOW            0x8DC5
1080#define GL_UNSIGNED_INT_VEC2              0x8DC6
1081#define GL_UNSIGNED_INT_VEC3              0x8DC7
1082#define GL_UNSIGNED_INT_VEC4              0x8DC8
1083#define GL_INT_SAMPLER_1D                 0x8DC9
1084#define GL_INT_SAMPLER_2D                 0x8DCA
1085#define GL_INT_SAMPLER_3D                 0x8DCB
1086#define GL_INT_SAMPLER_CUBE               0x8DCC
1087#define GL_INT_SAMPLER_1D_ARRAY           0x8DCE
1088#define GL_INT_SAMPLER_2D_ARRAY           0x8DCF
1089#define GL_UNSIGNED_INT_SAMPLER_1D        0x8DD1
1090#define GL_UNSIGNED_INT_SAMPLER_2D        0x8DD2
1091#define GL_UNSIGNED_INT_SAMPLER_3D        0x8DD3
1092#define GL_UNSIGNED_INT_SAMPLER_CUBE      0x8DD4
1093#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY  0x8DD6
1094#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY  0x8DD7
1095#define GL_QUERY_WAIT                     0x8E13
1096#define GL_QUERY_NO_WAIT                  0x8E14
1097#define GL_QUERY_BY_REGION_WAIT           0x8E15
1098#define GL_QUERY_BY_REGION_NO_WAIT        0x8E16
1099#define GL_BUFFER_ACCESS_FLAGS            0x911F
1100#define GL_BUFFER_MAP_LENGTH              0x9120
1101#define GL_BUFFER_MAP_OFFSET              0x9121
1102#define GL_DEPTH_COMPONENT32F             0x8CAC
1103#define GL_DEPTH32F_STENCIL8              0x8CAD
1104#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
1105#define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506
1106#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
1107#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
1108#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
1109#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
1110#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
1111#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
1112#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
1113#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
1114#define GL_FRAMEBUFFER_DEFAULT            0x8218
1115#define GL_FRAMEBUFFER_UNDEFINED          0x8219
1116#define GL_DEPTH_STENCIL_ATTACHMENT       0x821A
1117#define GL_MAX_RENDERBUFFER_SIZE          0x84E8
1118#define GL_DEPTH_STENCIL                  0x84F9
1119#define GL_UNSIGNED_INT_24_8              0x84FA
1120#define GL_DEPTH24_STENCIL8               0x88F0
1121#define GL_TEXTURE_STENCIL_SIZE           0x88F1
1122#define GL_TEXTURE_RED_TYPE               0x8C10
1123#define GL_TEXTURE_GREEN_TYPE             0x8C11
1124#define GL_TEXTURE_BLUE_TYPE              0x8C12
1125#define GL_TEXTURE_ALPHA_TYPE             0x8C13
1126#define GL_TEXTURE_DEPTH_TYPE             0x8C16
1127#define GL_UNSIGNED_NORMALIZED            0x8C17
1128#define GL_FRAMEBUFFER_BINDING            0x8CA6
1129#define GL_DRAW_FRAMEBUFFER_BINDING       0x8CA6
1130#define GL_RENDERBUFFER_BINDING           0x8CA7
1131#define GL_READ_FRAMEBUFFER               0x8CA8
1132#define GL_DRAW_FRAMEBUFFER               0x8CA9
1133#define GL_READ_FRAMEBUFFER_BINDING       0x8CAA
1134#define GL_RENDERBUFFER_SAMPLES           0x8CAB
1135#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
1136#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
1137#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
1138#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
1139#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
1140#define GL_FRAMEBUFFER_COMPLETE           0x8CD5
1141#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
1142#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
1143#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
1144#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
1145#define GL_FRAMEBUFFER_UNSUPPORTED        0x8CDD
1146#define GL_MAX_COLOR_ATTACHMENTS          0x8CDF
1147#define GL_COLOR_ATTACHMENT0              0x8CE0
1148#define GL_COLOR_ATTACHMENT1              0x8CE1
1149#define GL_COLOR_ATTACHMENT2              0x8CE2
1150#define GL_COLOR_ATTACHMENT3              0x8CE3
1151#define GL_COLOR_ATTACHMENT4              0x8CE4
1152#define GL_COLOR_ATTACHMENT5              0x8CE5
1153#define GL_COLOR_ATTACHMENT6              0x8CE6
1154#define GL_COLOR_ATTACHMENT7              0x8CE7
1155#define GL_COLOR_ATTACHMENT8              0x8CE8
1156#define GL_COLOR_ATTACHMENT9              0x8CE9
1157#define GL_COLOR_ATTACHMENT10             0x8CEA
1158#define GL_COLOR_ATTACHMENT11             0x8CEB
1159#define GL_COLOR_ATTACHMENT12             0x8CEC
1160#define GL_COLOR_ATTACHMENT13             0x8CED
1161#define GL_COLOR_ATTACHMENT14             0x8CEE
1162#define GL_COLOR_ATTACHMENT15             0x8CEF
1163#define GL_DEPTH_ATTACHMENT               0x8D00
1164#define GL_STENCIL_ATTACHMENT             0x8D20
1165#define GL_FRAMEBUFFER                    0x8D40
1166#define GL_RENDERBUFFER                   0x8D41
1167#define GL_RENDERBUFFER_WIDTH             0x8D42
1168#define GL_RENDERBUFFER_HEIGHT            0x8D43
1169#define GL_RENDERBUFFER_INTERNAL_FORMAT   0x8D44
1170#define GL_STENCIL_INDEX1                 0x8D46
1171#define GL_STENCIL_INDEX4                 0x8D47
1172#define GL_STENCIL_INDEX8                 0x8D48
1173#define GL_STENCIL_INDEX16                0x8D49
1174#define GL_RENDERBUFFER_RED_SIZE          0x8D50
1175#define GL_RENDERBUFFER_GREEN_SIZE        0x8D51
1176#define GL_RENDERBUFFER_BLUE_SIZE         0x8D52
1177#define GL_RENDERBUFFER_ALPHA_SIZE        0x8D53
1178#define GL_RENDERBUFFER_DEPTH_SIZE        0x8D54
1179#define GL_RENDERBUFFER_STENCIL_SIZE      0x8D55
1180#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
1181#define GL_MAX_SAMPLES                    0x8D57
1182#define GL_FRAMEBUFFER_SRGB               0x8DB9
1183#define GL_HALF_FLOAT                     0x140B
1184#define GL_MAP_READ_BIT                   0x0001
1185#define GL_MAP_WRITE_BIT                  0x0002
1186#define GL_MAP_INVALIDATE_RANGE_BIT       0x0004
1187#define GL_MAP_INVALIDATE_BUFFER_BIT      0x0008
1188#define GL_MAP_FLUSH_EXPLICIT_BIT         0x0010
1189#define GL_MAP_UNSYNCHRONIZED_BIT         0x0020
1190#define GL_COMPRESSED_RED_RGTC1           0x8DBB
1191#define GL_COMPRESSED_SIGNED_RED_RGTC1    0x8DBC
1192#define GL_COMPRESSED_RG_RGTC2            0x8DBD
1193#define GL_COMPRESSED_SIGNED_RG_RGTC2     0x8DBE
1194#define GL_RG                             0x8227
1195#define GL_RG_INTEGER                     0x8228
1196#define GL_R8                             0x8229
1197#define GL_R16                            0x822A
1198#define GL_RG8                            0x822B
1199#define GL_RG16                           0x822C
1200#define GL_R16F                           0x822D
1201#define GL_R32F                           0x822E
1202#define GL_RG16F                          0x822F
1203#define GL_RG32F                          0x8230
1204#define GL_R8I                            0x8231
1205#define GL_R8UI                           0x8232
1206#define GL_R16I                           0x8233
1207#define GL_R16UI                          0x8234
1208#define GL_R32I                           0x8235
1209#define GL_R32UI                          0x8236
1210#define GL_RG8I                           0x8237
1211#define GL_RG8UI                          0x8238
1212#define GL_RG16I                          0x8239
1213#define GL_RG16UI                         0x823A
1214#define GL_RG32I                          0x823B
1215#define GL_RG32UI                         0x823C
1216#define GL_VERTEX_ARRAY_BINDING           0x85B5
1217typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
1218typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
1219typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
1220typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index);
1221typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index);
1222typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index);
1223typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
1224typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
1225typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
1226typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
1227typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
1228typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
1229typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);
1230typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);
1231typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void);
1232typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
1233typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
1234typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
1235typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x);
1236typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y);
1237typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z);
1238typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
1239typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x);
1240typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y);
1241typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
1242typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
1243typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v);
1244typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v);
1245typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v);
1246typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
1247typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v);
1248typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v);
1249typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v);
1250typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
1251typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v);
1252typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v);
1253typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v);
1254typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v);
1255typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
1256typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name);
1257typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
1258typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
1259typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
1260typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
1261typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
1262typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);
1263typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);
1264typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);
1265typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);
1266typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params);
1267typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params);
1268typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params);
1269typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params);
1270typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);
1271typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);
1272typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
1273typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
1274typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
1275typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
1276typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
1277typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
1278typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
1279typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
1280typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
1281typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
1282typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
1283typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
1284typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
1285typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
1286typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
1287typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
1288typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
1289typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
1290typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
1291typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
1292typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
1293typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
1294typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
1295typedef void *(APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
1296typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
1297typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
1298typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
1299typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
1300typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
1301#ifdef GL_GLEXT_PROTOTYPES
1302GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
1303GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
1304GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
1305GLAPI void APIENTRY glEnablei (GLenum target, GLuint index);
1306GLAPI void APIENTRY glDisablei (GLenum target, GLuint index);
1307GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index);
1308GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
1309GLAPI void APIENTRY glEndTransformFeedback (void);
1310GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
1311GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
1312GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
1313GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
1314GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp);
1315GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode);
1316GLAPI void APIENTRY glEndConditionalRender (void);
1317GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
1318GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
1319GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
1320GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x);
1321GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y);
1322GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z);
1323GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
1324GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x);
1325GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y);
1326GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z);
1327GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
1328GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v);
1329GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v);
1330GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v);
1331GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
1332GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v);
1333GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v);
1334GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v);
1335GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
1336GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v);
1337GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v);
1338GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v);
1339GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v);
1340GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
1341GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name);
1342GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
1343GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0);
1344GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
1345GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
1346GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
1347GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
1348GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
1349GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
1350GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
1351GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params);
1352GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params);
1353GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params);
1354GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params);
1355GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
1356GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
1357GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
1358GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
1359GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index);
1360GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer);
1361GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
1362GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
1363GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
1364GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
1365GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
1366GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer);
1367GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
1368GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
1369GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
1370GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target);
1371GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
1372GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
1373GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
1374GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
1375GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
1376GLAPI void APIENTRY glGenerateMipmap (GLenum target);
1377GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
1378GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
1379GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
1380GLAPI void *APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
1381GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
1382GLAPI void APIENTRY glBindVertexArray (GLuint array);
1383GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
1384GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
1385GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array);
1386#endif
1387#endif /* GL_VERSION_3_0 */
1388
1389#ifndef GL_VERSION_3_1
1390#define GL_VERSION_3_1 1
1391#define GL_SAMPLER_2D_RECT                0x8B63
1392#define GL_SAMPLER_2D_RECT_SHADOW         0x8B64
1393#define GL_SAMPLER_BUFFER                 0x8DC2
1394#define GL_INT_SAMPLER_2D_RECT            0x8DCD
1395#define GL_INT_SAMPLER_BUFFER             0x8DD0
1396#define GL_UNSIGNED_INT_SAMPLER_2D_RECT   0x8DD5
1397#define GL_UNSIGNED_INT_SAMPLER_BUFFER    0x8DD8
1398#define GL_TEXTURE_BUFFER                 0x8C2A
1399#define GL_MAX_TEXTURE_BUFFER_SIZE        0x8C2B
1400#define GL_TEXTURE_BINDING_BUFFER         0x8C2C
1401#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
1402#define GL_TEXTURE_RECTANGLE              0x84F5
1403#define GL_TEXTURE_BINDING_RECTANGLE      0x84F6
1404#define GL_PROXY_TEXTURE_RECTANGLE        0x84F7
1405#define GL_MAX_RECTANGLE_TEXTURE_SIZE     0x84F8
1406#define GL_R8_SNORM                       0x8F94
1407#define GL_RG8_SNORM                      0x8F95
1408#define GL_RGB8_SNORM                     0x8F96
1409#define GL_RGBA8_SNORM                    0x8F97
1410#define GL_R16_SNORM                      0x8F98
1411#define GL_RG16_SNORM                     0x8F99
1412#define GL_RGB16_SNORM                    0x8F9A
1413#define GL_RGBA16_SNORM                   0x8F9B
1414#define GL_SIGNED_NORMALIZED              0x8F9C
1415#define GL_PRIMITIVE_RESTART              0x8F9D
1416#define GL_PRIMITIVE_RESTART_INDEX        0x8F9E
1417#define GL_COPY_READ_BUFFER               0x8F36
1418#define GL_COPY_WRITE_BUFFER              0x8F37
1419#define GL_UNIFORM_BUFFER                 0x8A11
1420#define GL_UNIFORM_BUFFER_BINDING         0x8A28
1421#define GL_UNIFORM_BUFFER_START           0x8A29
1422#define GL_UNIFORM_BUFFER_SIZE            0x8A2A
1423#define GL_MAX_VERTEX_UNIFORM_BLOCKS      0x8A2B
1424#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS    0x8A2D
1425#define GL_MAX_COMBINED_UNIFORM_BLOCKS    0x8A2E
1426#define GL_MAX_UNIFORM_BUFFER_BINDINGS    0x8A2F
1427#define GL_MAX_UNIFORM_BLOCK_SIZE         0x8A30
1428#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
1429#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
1430#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
1431#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
1432#define GL_ACTIVE_UNIFORM_BLOCKS          0x8A36
1433#define GL_UNIFORM_TYPE                   0x8A37
1434#define GL_UNIFORM_SIZE                   0x8A38
1435#define GL_UNIFORM_NAME_LENGTH            0x8A39
1436#define GL_UNIFORM_BLOCK_INDEX            0x8A3A
1437#define GL_UNIFORM_OFFSET                 0x8A3B
1438#define GL_UNIFORM_ARRAY_STRIDE           0x8A3C
1439#define GL_UNIFORM_MATRIX_STRIDE          0x8A3D
1440#define GL_UNIFORM_IS_ROW_MAJOR           0x8A3E
1441#define GL_UNIFORM_BLOCK_BINDING          0x8A3F
1442#define GL_UNIFORM_BLOCK_DATA_SIZE        0x8A40
1443#define GL_UNIFORM_BLOCK_NAME_LENGTH      0x8A41
1444#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS  0x8A42
1445#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
1446#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
1447#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
1448#define GL_INVALID_INDEX                  0xFFFFFFFFu
1449typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
1450typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
1451typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer);
1452typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index);
1453typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
1454typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
1455typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
1456typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
1457typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
1458typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
1459typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
1460typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
1461#ifdef GL_GLEXT_PROTOTYPES
1462GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
1463GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
1464GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer);
1465GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index);
1466GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
1467GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
1468GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
1469GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
1470GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
1471GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
1472GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
1473GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
1474#endif
1475#endif /* GL_VERSION_3_1 */
1476
1477#ifndef GL_VERSION_3_2
1478#define GL_VERSION_3_2 1
1479typedef struct __GLsync *GLsync;
1480#ifndef GLEXT_64_TYPES_DEFINED
1481/* This code block is duplicated in glxext.h, so must be protected */
1482#define GLEXT_64_TYPES_DEFINED
1483/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
1484/* (as used in the GL_EXT_timer_query extension). */
1485#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
1486#include <inttypes.h>
1487#elif defined(__sun__) || defined(__digital__)
1488#include <inttypes.h>
1489#if defined(__STDC__)
1490#if defined(__arch64__) || defined(_LP64)
1491typedef long int int64_t;
1492typedef unsigned long int uint64_t;
1493#else
1494typedef long long int int64_t;
1495typedef unsigned long long int uint64_t;
1496#endif /* __arch64__ */
1497#endif /* __STDC__ */
1498#elif defined( __VMS ) || defined(__sgi)
1499#include <inttypes.h>
1500#elif defined(__SCO__) || defined(__USLC__)
1501#include <stdint.h>
1502#elif defined(__UNIXOS2__) || defined(__SOL64__)
1503typedef long int int32_t;
1504typedef long long int int64_t;
1505typedef unsigned long long int uint64_t;
1506#elif defined(_WIN32) && defined(__GNUC__)
1507#include <stdint.h>
1508#elif defined(_WIN32)
1509typedef __int32 int32_t;
1510typedef __int64 int64_t;
1511typedef unsigned __int64 uint64_t;
1512#else
1513/* Fallback if nothing above works */
1514#include <inttypes.h>
1515#endif
1516#endif
1517typedef uint64_t GLuint64;
1518typedef int64_t GLint64;
1519#define GL_CONTEXT_CORE_PROFILE_BIT       0x00000001
1520#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
1521#define GL_LINES_ADJACENCY                0x000A
1522#define GL_LINE_STRIP_ADJACENCY           0x000B
1523#define GL_TRIANGLES_ADJACENCY            0x000C
1524#define GL_TRIANGLE_STRIP_ADJACENCY       0x000D
1525#define GL_PROGRAM_POINT_SIZE             0x8642
1526#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29
1527#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7
1528#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
1529#define GL_GEOMETRY_SHADER                0x8DD9
1530#define GL_GEOMETRY_VERTICES_OUT          0x8916
1531#define GL_GEOMETRY_INPUT_TYPE            0x8917
1532#define GL_GEOMETRY_OUTPUT_TYPE           0x8918
1533#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF
1534#define GL_MAX_GEOMETRY_OUTPUT_VERTICES   0x8DE0
1535#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
1536#define GL_MAX_VERTEX_OUTPUT_COMPONENTS   0x9122
1537#define GL_MAX_GEOMETRY_INPUT_COMPONENTS  0x9123
1538#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124
1539#define GL_MAX_FRAGMENT_INPUT_COMPONENTS  0x9125
1540#define GL_CONTEXT_PROFILE_MASK           0x9126
1541#define GL_DEPTH_CLAMP                    0x864F
1542#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C
1543#define GL_FIRST_VERTEX_CONVENTION        0x8E4D
1544#define GL_LAST_VERTEX_CONVENTION         0x8E4E
1545#define GL_PROVOKING_VERTEX               0x8E4F
1546#define GL_TEXTURE_CUBE_MAP_SEAMLESS      0x884F
1547#define GL_MAX_SERVER_WAIT_TIMEOUT        0x9111
1548#define GL_OBJECT_TYPE                    0x9112
1549#define GL_SYNC_CONDITION                 0x9113
1550#define GL_SYNC_STATUS                    0x9114
1551#define GL_SYNC_FLAGS                     0x9115
1552#define GL_SYNC_FENCE                     0x9116
1553#define GL_SYNC_GPU_COMMANDS_COMPLETE     0x9117
1554#define GL_UNSIGNALED                     0x9118
1555#define GL_SIGNALED                       0x9119
1556#define GL_ALREADY_SIGNALED               0x911A
1557#define GL_TIMEOUT_EXPIRED                0x911B
1558#define GL_CONDITION_SATISFIED            0x911C
1559#define GL_WAIT_FAILED                    0x911D
1560#define GL_TIMEOUT_IGNORED                0xFFFFFFFFFFFFFFFFull
1561#define GL_SYNC_FLUSH_COMMANDS_BIT        0x00000001
1562#define GL_SAMPLE_POSITION                0x8E50
1563#define GL_SAMPLE_MASK                    0x8E51
1564#define GL_SAMPLE_MASK_VALUE              0x8E52
1565#define GL_MAX_SAMPLE_MASK_WORDS          0x8E59
1566#define GL_TEXTURE_2D_MULTISAMPLE         0x9100
1567#define GL_PROXY_TEXTURE_2D_MULTISAMPLE   0x9101
1568#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY   0x9102
1569#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103
1570#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
1571#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
1572#define GL_TEXTURE_SAMPLES                0x9106
1573#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
1574#define GL_SAMPLER_2D_MULTISAMPLE         0x9108
1575#define GL_INT_SAMPLER_2D_MULTISAMPLE     0x9109
1576#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
1577#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY   0x910B
1578#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
1579#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
1580#define GL_MAX_COLOR_TEXTURE_SAMPLES      0x910E
1581#define GL_MAX_DEPTH_TEXTURE_SAMPLES      0x910F
1582#define GL_MAX_INTEGER_SAMPLES            0x9110
1583typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
1584typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
1585typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
1586typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);
1587typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode);
1588typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
1589typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
1590typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
1591typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
1592typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
1593typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data);
1594typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
1595typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
1596typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
1597typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
1598typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
1599typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
1600typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);
1601typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask);
1602#ifdef GL_GLEXT_PROTOTYPES
1603GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
1604GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
1605GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
1606GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);
1607GLAPI void APIENTRY glProvokingVertex (GLenum mode);
1608GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
1609GLAPI GLboolean APIENTRY glIsSync (GLsync sync);
1610GLAPI void APIENTRY glDeleteSync (GLsync sync);
1611GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
1612GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
1613GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
1614GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
1615GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
1616GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
1617GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level);
1618GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
1619GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
1620GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
1621GLAPI void APIENTRY glSampleMaski (GLuint index, GLbitfield mask);
1622#endif
1623#endif /* GL_VERSION_3_2 */
1624
1625#ifndef GL_VERSION_3_3
1626#define GL_VERSION_3_3 1
1627#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR    0x88FE
1628#define GL_SRC1_COLOR                     0x88F9
1629#define GL_ONE_MINUS_SRC1_COLOR           0x88FA
1630#define GL_ONE_MINUS_SRC1_ALPHA           0x88FB
1631#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS   0x88FC
1632#define GL_ANY_SAMPLES_PASSED             0x8C2F
1633#define GL_SAMPLER_BINDING                0x8919
1634#define GL_RGB10_A2UI                     0x906F
1635#define GL_TEXTURE_SWIZZLE_R              0x8E42
1636#define GL_TEXTURE_SWIZZLE_G              0x8E43
1637#define GL_TEXTURE_SWIZZLE_B              0x8E44
1638#define GL_TEXTURE_SWIZZLE_A              0x8E45
1639#define GL_TEXTURE_SWIZZLE_RGBA           0x8E46
1640#define GL_TIME_ELAPSED                   0x88BF
1641#define GL_TIMESTAMP                      0x8E28
1642#define GL_INT_2_10_10_10_REV             0x8D9F
1643typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
1644typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name);
1645typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
1646typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
1647typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);
1648typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
1649typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
1650typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
1651typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
1652typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
1653typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
1654typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param);
1655typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);
1656typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params);
1657typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
1658typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params);
1659typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);
1660typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params);
1661typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params);
1662typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
1663typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1664typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1665typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1666typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1667typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1668typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1669typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1670typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1671#ifdef GL_GLEXT_PROTOTYPES
1672GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
1673GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name);
1674GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
1675GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
1676GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler);
1677GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler);
1678GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
1679GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
1680GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
1681GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
1682GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param);
1683GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param);
1684GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
1685GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params);
1686GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
1687GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params);
1688GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target);
1689GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params);
1690GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params);
1691GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
1692GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1693GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1694GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1695GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1696GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1697GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1698GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1699GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1700#endif
1701#endif /* GL_VERSION_3_3 */
1702
1703#ifndef GL_VERSION_4_0
1704#define GL_VERSION_4_0 1
1705#define GL_SAMPLE_SHADING                 0x8C36
1706#define GL_MIN_SAMPLE_SHADING_VALUE       0x8C37
1707#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
1708#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
1709#define GL_TEXTURE_CUBE_MAP_ARRAY         0x9009
1710#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A
1711#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY   0x900B
1712#define GL_SAMPLER_CUBE_MAP_ARRAY         0x900C
1713#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW  0x900D
1714#define GL_INT_SAMPLER_CUBE_MAP_ARRAY     0x900E
1715#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F
1716#define GL_DRAW_INDIRECT_BUFFER           0x8F3F
1717#define GL_DRAW_INDIRECT_BUFFER_BINDING   0x8F43
1718#define GL_GEOMETRY_SHADER_INVOCATIONS    0x887F
1719#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A
1720#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B
1721#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C
1722#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D
1723#define GL_MAX_VERTEX_STREAMS             0x8E71
1724#define GL_DOUBLE_VEC2                    0x8FFC
1725#define GL_DOUBLE_VEC3                    0x8FFD
1726#define GL_DOUBLE_VEC4                    0x8FFE
1727#define GL_DOUBLE_MAT2                    0x8F46
1728#define GL_DOUBLE_MAT3                    0x8F47
1729#define GL_DOUBLE_MAT4                    0x8F48
1730#define GL_DOUBLE_MAT2x3                  0x8F49
1731#define GL_DOUBLE_MAT2x4                  0x8F4A
1732#define GL_DOUBLE_MAT3x2                  0x8F4B
1733#define GL_DOUBLE_MAT3x4                  0x8F4C
1734#define GL_DOUBLE_MAT4x2                  0x8F4D
1735#define GL_DOUBLE_MAT4x3                  0x8F4E
1736#define GL_ACTIVE_SUBROUTINES             0x8DE5
1737#define GL_ACTIVE_SUBROUTINE_UNIFORMS     0x8DE6
1738#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47
1739#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH   0x8E48
1740#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49
1741#define GL_MAX_SUBROUTINES                0x8DE7
1742#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8
1743#define GL_NUM_COMPATIBLE_SUBROUTINES     0x8E4A
1744#define GL_COMPATIBLE_SUBROUTINES         0x8E4B
1745#define GL_PATCHES                        0x000E
1746#define GL_PATCH_VERTICES                 0x8E72
1747#define GL_PATCH_DEFAULT_INNER_LEVEL      0x8E73
1748#define GL_PATCH_DEFAULT_OUTER_LEVEL      0x8E74
1749#define GL_TESS_CONTROL_OUTPUT_VERTICES   0x8E75
1750#define GL_TESS_GEN_MODE                  0x8E76
1751#define GL_TESS_GEN_SPACING               0x8E77
1752#define GL_TESS_GEN_VERTEX_ORDER          0x8E78
1753#define GL_TESS_GEN_POINT_MODE            0x8E79
1754#define GL_ISOLINES                       0x8E7A
1755#define GL_FRACTIONAL_ODD                 0x8E7B
1756#define GL_FRACTIONAL_EVEN                0x8E7C
1757#define GL_MAX_PATCH_VERTICES             0x8E7D
1758#define GL_MAX_TESS_GEN_LEVEL             0x8E7E
1759#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F
1760#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80
1761#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81
1762#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82
1763#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83
1764#define GL_MAX_TESS_PATCH_COMPONENTS      0x8E84
1765#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85
1766#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86
1767#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89
1768#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A
1769#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C
1770#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D
1771#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E
1772#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F
1773#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0
1774#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1
1775#define GL_TESS_EVALUATION_SHADER         0x8E87
1776#define GL_TESS_CONTROL_SHADER            0x8E88
1777#define GL_TRANSFORM_FEEDBACK             0x8E22
1778#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23
1779#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24
1780#define GL_TRANSFORM_FEEDBACK_BINDING     0x8E25
1781#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70
1782typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value);
1783typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);
1784typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
1785typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);
1786typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
1787typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect);
1788typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect);
1789typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x);
1790typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y);
1791typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z);
1792typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
1793typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value);
1794typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value);
1795typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value);
1796typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value);
1797typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1798typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1799typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1800typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1801typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1802typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1803typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1804typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1805typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1806typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params);
1807typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name);
1808typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name);
1809typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
1810typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
1811typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
1812typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices);
1813typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params);
1814typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
1815typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);
1816typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values);
1817typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
1818typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);
1819typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
1820typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
1821typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
1822typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
1823typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id);
1824typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream);
1825typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id);
1826typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index);
1827typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
1828#ifdef GL_GLEXT_PROTOTYPES
1829GLAPI void APIENTRY glMinSampleShading (GLfloat value);
1830GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode);
1831GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
1832GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst);
1833GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
1834GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect);
1835GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect);
1836GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x);
1837GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y);
1838GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z);
1839GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
1840GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value);
1841GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value);
1842GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value);
1843GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value);
1844GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1845GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1846GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1847GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1848GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1849GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1850GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1851GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1852GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1853GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params);
1854GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name);
1855GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name);
1856GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
1857GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
1858GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
1859GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices);
1860GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params);
1861GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
1862GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value);
1863GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values);
1864GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
1865GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
1866GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
1867GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id);
1868GLAPI void APIENTRY glPauseTransformFeedback (void);
1869GLAPI void APIENTRY glResumeTransformFeedback (void);
1870GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id);
1871GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream);
1872GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id);
1873GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index);
1874GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params);
1875#endif
1876#endif /* GL_VERSION_4_0 */
1877
1878#ifndef GL_VERSION_4_1
1879#define GL_VERSION_4_1 1
1880#define GL_FIXED                          0x140C
1881#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
1882#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
1883#define GL_LOW_FLOAT                      0x8DF0
1884#define GL_MEDIUM_FLOAT                   0x8DF1
1885#define GL_HIGH_FLOAT                     0x8DF2
1886#define GL_LOW_INT                        0x8DF3
1887#define GL_MEDIUM_INT                     0x8DF4
1888#define GL_HIGH_INT                       0x8DF5
1889#define GL_SHADER_COMPILER                0x8DFA
1890#define GL_SHADER_BINARY_FORMATS          0x8DF8
1891#define GL_NUM_SHADER_BINARY_FORMATS      0x8DF9
1892#define GL_MAX_VERTEX_UNIFORM_VECTORS     0x8DFB
1893#define GL_MAX_VARYING_VECTORS            0x8DFC
1894#define GL_MAX_FRAGMENT_UNIFORM_VECTORS   0x8DFD
1895#define GL_RGB565                         0x8D62
1896#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
1897#define GL_PROGRAM_BINARY_LENGTH          0x8741
1898#define GL_NUM_PROGRAM_BINARY_FORMATS     0x87FE
1899#define GL_PROGRAM_BINARY_FORMATS         0x87FF
1900#define GL_VERTEX_SHADER_BIT              0x00000001
1901#define GL_FRAGMENT_SHADER_BIT            0x00000002
1902#define GL_GEOMETRY_SHADER_BIT            0x00000004
1903#define GL_TESS_CONTROL_SHADER_BIT        0x00000008
1904#define GL_TESS_EVALUATION_SHADER_BIT     0x00000010
1905#define GL_ALL_SHADER_BITS                0xFFFFFFFF
1906#define GL_PROGRAM_SEPARABLE              0x8258
1907#define GL_ACTIVE_PROGRAM                 0x8259
1908#define GL_PROGRAM_PIPELINE_BINDING       0x825A
1909#define GL_MAX_VIEWPORTS                  0x825B
1910#define GL_VIEWPORT_SUBPIXEL_BITS         0x825C
1911#define GL_VIEWPORT_BOUNDS_RANGE          0x825D
1912#define GL_LAYER_PROVOKING_VERTEX         0x825E
1913#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F
1914#define GL_UNDEFINED_VERTEX               0x8260
1915typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
1916typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
1917typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
1918typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
1919typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
1920typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
1921typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
1922typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
1923typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
1924typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);
1925typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings);
1926typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);
1927typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines);
1928typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);
1929typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);
1930typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params);
1931typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0);
1932typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
1933typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0);
1934typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1935typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0);
1936typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1937typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0);
1938typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1939typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1);
1940typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
1941typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
1942typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1943typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1);
1944typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1945typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
1946typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1947typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
1948typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
1949typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
1950typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1951typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
1952typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1953typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
1954typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1955typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
1956typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
1957typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
1958typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1959typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
1960typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1961typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
1962typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1963typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1964typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1965typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1966typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1967typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1968typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1969typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1970typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1971typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1972typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1973typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1974typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1975typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1976typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1977typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1978typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1979typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1980typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1981typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);
1982typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
1983typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x);
1984typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y);
1985typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
1986typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
1987typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v);
1988typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v);
1989typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v);
1990typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v);
1991typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
1992typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params);
1993typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v);
1994typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
1995typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v);
1996typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v);
1997typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
1998typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v);
1999typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v);
2000typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f);
2001typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data);
2002typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data);
2003#ifdef GL_GLEXT_PROTOTYPES
2004GLAPI void APIENTRY glReleaseShaderCompiler (void);
2005GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
2006GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
2007GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f);
2008GLAPI void APIENTRY glClearDepthf (GLfloat d);
2009GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
2010GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
2011GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
2012GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
2013GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
2014GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings);
2015GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline);
2016GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
2017GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
2018GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline);
2019GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
2020GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
2021GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
2022GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
2023GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
2024GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0);
2025GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
2026GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
2027GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
2028GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
2029GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
2030GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
2031GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
2032GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1);
2033GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
2034GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
2035GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
2036GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
2037GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
2038GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
2039GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
2040GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
2041GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
2042GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
2043GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
2044GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
2045GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
2046GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
2047GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
2048GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
2049GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
2050GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
2051GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
2052GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2053GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2054GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2055GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2056GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2057GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2058GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2059GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2060GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2061GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2062GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2063GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2064GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2065GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2066GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2067GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2068GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2069GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2070GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline);
2071GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
2072GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x);
2073GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y);
2074GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
2075GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
2076GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v);
2077GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v);
2078GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v);
2079GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v);
2080GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
2081GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params);
2082GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v);
2083GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
2084GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v);
2085GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v);
2086GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
2087GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v);
2088GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v);
2089GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f);
2090GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data);
2091GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data);
2092#endif
2093#endif /* GL_VERSION_4_1 */
2094
2095#ifndef GL_VERSION_4_2
2096#define GL_VERSION_4_2 1
2097#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH  0x9127
2098#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128
2099#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH  0x9129
2100#define GL_UNPACK_COMPRESSED_BLOCK_SIZE   0x912A
2101#define GL_PACK_COMPRESSED_BLOCK_WIDTH    0x912B
2102#define GL_PACK_COMPRESSED_BLOCK_HEIGHT   0x912C
2103#define GL_PACK_COMPRESSED_BLOCK_DEPTH    0x912D
2104#define GL_PACK_COMPRESSED_BLOCK_SIZE     0x912E
2105#define GL_NUM_SAMPLE_COUNTS              0x9380
2106#define GL_MIN_MAP_BUFFER_ALIGNMENT       0x90BC
2107#define GL_ATOMIC_COUNTER_BUFFER          0x92C0
2108#define GL_ATOMIC_COUNTER_BUFFER_BINDING  0x92C1
2109#define GL_ATOMIC_COUNTER_BUFFER_START    0x92C2
2110#define GL_ATOMIC_COUNTER_BUFFER_SIZE     0x92C3
2111#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4
2112#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5
2113#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6
2114#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7
2115#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8
2116#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9
2117#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA
2118#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB
2119#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
2120#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD
2121#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE
2122#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF
2123#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
2124#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
2125#define GL_MAX_VERTEX_ATOMIC_COUNTERS     0x92D2
2126#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3
2127#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4
2128#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS   0x92D5
2129#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS   0x92D6
2130#define GL_MAX_COMBINED_ATOMIC_COUNTERS   0x92D7
2131#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
2132#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
2133#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS  0x92D9
2134#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA
2135#define GL_UNSIGNED_INT_ATOMIC_COUNTER    0x92DB
2136#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
2137#define GL_ELEMENT_ARRAY_BARRIER_BIT      0x00000002
2138#define GL_UNIFORM_BARRIER_BIT            0x00000004
2139#define GL_TEXTURE_FETCH_BARRIER_BIT      0x00000008
2140#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
2141#define GL_COMMAND_BARRIER_BIT            0x00000040
2142#define GL_PIXEL_BUFFER_BARRIER_BIT       0x00000080
2143#define GL_TEXTURE_UPDATE_BARRIER_BIT     0x00000100
2144#define GL_BUFFER_UPDATE_BARRIER_BIT      0x00000200
2145#define GL_FRAMEBUFFER_BARRIER_BIT        0x00000400
2146#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
2147#define GL_ATOMIC_COUNTER_BARRIER_BIT     0x00001000
2148#define GL_ALL_BARRIER_BITS               0xFFFFFFFF
2149#define GL_MAX_IMAGE_UNITS                0x8F38
2150#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39
2151#define GL_IMAGE_BINDING_NAME             0x8F3A
2152#define GL_IMAGE_BINDING_LEVEL            0x8F3B
2153#define GL_IMAGE_BINDING_LAYERED          0x8F3C
2154#define GL_IMAGE_BINDING_LAYER            0x8F3D
2155#define GL_IMAGE_BINDING_ACCESS           0x8F3E
2156#define GL_IMAGE_1D                       0x904C
2157#define GL_IMAGE_2D                       0x904D
2158#define GL_IMAGE_3D                       0x904E
2159#define GL_IMAGE_2D_RECT                  0x904F
2160#define GL_IMAGE_CUBE                     0x9050
2161#define GL_IMAGE_BUFFER                   0x9051
2162#define GL_IMAGE_1D_ARRAY                 0x9052
2163#define GL_IMAGE_2D_ARRAY                 0x9053
2164#define GL_IMAGE_CUBE_MAP_ARRAY           0x9054
2165#define GL_IMAGE_2D_MULTISAMPLE           0x9055
2166#define GL_IMAGE_2D_MULTISAMPLE_ARRAY     0x9056
2167#define GL_INT_IMAGE_1D                   0x9057
2168#define GL_INT_IMAGE_2D                   0x9058
2169#define GL_INT_IMAGE_3D                   0x9059
2170#define GL_INT_IMAGE_2D_RECT              0x905A
2171#define GL_INT_IMAGE_CUBE                 0x905B
2172#define GL_INT_IMAGE_BUFFER               0x905C
2173#define GL_INT_IMAGE_1D_ARRAY             0x905D
2174#define GL_INT_IMAGE_2D_ARRAY             0x905E
2175#define GL_INT_IMAGE_CUBE_MAP_ARRAY       0x905F
2176#define GL_INT_IMAGE_2D_MULTISAMPLE       0x9060
2177#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061
2178#define GL_UNSIGNED_INT_IMAGE_1D          0x9062
2179#define GL_UNSIGNED_INT_IMAGE_2D          0x9063
2180#define GL_UNSIGNED_INT_IMAGE_3D          0x9064
2181#define GL_UNSIGNED_INT_IMAGE_2D_RECT     0x9065
2182#define GL_UNSIGNED_INT_IMAGE_CUBE        0x9066
2183#define GL_UNSIGNED_INT_IMAGE_BUFFER      0x9067
2184#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY    0x9068
2185#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY    0x9069
2186#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
2187#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B
2188#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C
2189#define GL_MAX_IMAGE_SAMPLES              0x906D
2190#define GL_IMAGE_BINDING_FORMAT           0x906E
2191#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
2192#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
2193#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
2194#define GL_MAX_VERTEX_IMAGE_UNIFORMS      0x90CA
2195#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB
2196#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC
2197#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS    0x90CD
2198#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS    0x90CE
2199#define GL_MAX_COMBINED_IMAGE_UNIFORMS    0x90CF
2200#define GL_TEXTURE_IMMUTABLE_FORMAT       0x912F
2201typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
2202typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
2203typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
2204typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
2205typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
2206typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
2207typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
2208typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
2209typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
2210typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
2211typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount);
2212typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
2213#ifdef GL_GLEXT_PROTOTYPES
2214GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
2215GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
2216GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
2217GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
2218GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
2219GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
2220GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers);
2221GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
2222GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
2223GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
2224GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount);
2225GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
2226#endif
2227#endif /* GL_VERSION_4_2 */
2228
2229#ifndef GL_VERSION_4_3
2230#define GL_VERSION_4_3 1
2231typedef void (APIENTRY  *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
2232#define GL_NUM_SHADING_LANGUAGE_VERSIONS  0x82E9
2233#define GL_VERTEX_ATTRIB_ARRAY_LONG       0x874E
2234#define GL_COMPRESSED_RGB8_ETC2           0x9274
2235#define GL_COMPRESSED_SRGB8_ETC2          0x9275
2236#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
2237#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
2238#define GL_COMPRESSED_RGBA8_ETC2_EAC      0x9278
2239#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
2240#define GL_COMPRESSED_R11_EAC             0x9270
2241#define GL_COMPRESSED_SIGNED_R11_EAC      0x9271
2242#define GL_COMPRESSED_RG11_EAC            0x9272
2243#define GL_COMPRESSED_SIGNED_RG11_EAC     0x9273
2244#define GL_PRIMITIVE_RESTART_FIXED_INDEX  0x8D69
2245#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
2246#define GL_MAX_ELEMENT_INDEX              0x8D6B
2247#define GL_COMPUTE_SHADER                 0x91B9
2248#define GL_MAX_COMPUTE_UNIFORM_BLOCKS     0x91BB
2249#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
2250#define GL_MAX_COMPUTE_IMAGE_UNIFORMS     0x91BD
2251#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
2252#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
2253#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
2254#define GL_MAX_COMPUTE_ATOMIC_COUNTERS    0x8265
2255#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
2256#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
2257#define GL_MAX_COMPUTE_WORK_GROUP_COUNT   0x91BE
2258#define GL_MAX_COMPUTE_WORK_GROUP_SIZE    0x91BF
2259#define GL_COMPUTE_WORK_GROUP_SIZE        0x8267
2260#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC
2261#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED
2262#define GL_DISPATCH_INDIRECT_BUFFER       0x90EE
2263#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
2264#define GL_DEBUG_OUTPUT_SYNCHRONOUS       0x8242
2265#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
2266#define GL_DEBUG_CALLBACK_FUNCTION        0x8244
2267#define GL_DEBUG_CALLBACK_USER_PARAM      0x8245
2268#define GL_DEBUG_SOURCE_API               0x8246
2269#define GL_DEBUG_SOURCE_WINDOW_SYSTEM     0x8247
2270#define GL_DEBUG_SOURCE_SHADER_COMPILER   0x8248
2271#define GL_DEBUG_SOURCE_THIRD_PARTY       0x8249
2272#define GL_DEBUG_SOURCE_APPLICATION       0x824A
2273#define GL_DEBUG_SOURCE_OTHER             0x824B
2274#define GL_DEBUG_TYPE_ERROR               0x824C
2275#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
2276#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR  0x824E
2277#define GL_DEBUG_TYPE_PORTABILITY         0x824F
2278#define GL_DEBUG_TYPE_PERFORMANCE         0x8250
2279#define GL_DEBUG_TYPE_OTHER               0x8251
2280#define GL_MAX_DEBUG_MESSAGE_LENGTH       0x9143
2281#define GL_MAX_DEBUG_LOGGED_MESSAGES      0x9144
2282#define GL_DEBUG_LOGGED_MESSAGES          0x9145
2283#define GL_DEBUG_SEVERITY_HIGH            0x9146
2284#define GL_DEBUG_SEVERITY_MEDIUM          0x9147
2285#define GL_DEBUG_SEVERITY_LOW             0x9148
2286#define GL_DEBUG_TYPE_MARKER              0x8268
2287#define GL_DEBUG_TYPE_PUSH_GROUP          0x8269
2288#define GL_DEBUG_TYPE_POP_GROUP           0x826A
2289#define GL_DEBUG_SEVERITY_NOTIFICATION    0x826B
2290#define GL_MAX_DEBUG_GROUP_STACK_DEPTH    0x826C
2291#define GL_DEBUG_GROUP_STACK_DEPTH        0x826D
2292#define GL_BUFFER                         0x82E0
2293#define GL_SHADER                         0x82E1
2294#define GL_PROGRAM                        0x82E2
2295#define GL_QUERY                          0x82E3
2296#define GL_PROGRAM_PIPELINE               0x82E4
2297#define GL_SAMPLER                        0x82E6
2298#define GL_MAX_LABEL_LENGTH               0x82E8
2299#define GL_DEBUG_OUTPUT                   0x92E0
2300#define GL_CONTEXT_FLAG_DEBUG_BIT         0x00000002
2301#define GL_MAX_UNIFORM_LOCATIONS          0x826E
2302#define GL_FRAMEBUFFER_DEFAULT_WIDTH      0x9310
2303#define GL_FRAMEBUFFER_DEFAULT_HEIGHT     0x9311
2304#define GL_FRAMEBUFFER_DEFAULT_LAYERS     0x9312
2305#define GL_FRAMEBUFFER_DEFAULT_SAMPLES    0x9313
2306#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
2307#define GL_MAX_FRAMEBUFFER_WIDTH          0x9315
2308#define GL_MAX_FRAMEBUFFER_HEIGHT         0x9316
2309#define GL_MAX_FRAMEBUFFER_LAYERS         0x9317
2310#define GL_MAX_FRAMEBUFFER_SAMPLES        0x9318
2311#define GL_INTERNALFORMAT_SUPPORTED       0x826F
2312#define GL_INTERNALFORMAT_PREFERRED       0x8270
2313#define GL_INTERNALFORMAT_RED_SIZE        0x8271
2314#define GL_INTERNALFORMAT_GREEN_SIZE      0x8272
2315#define GL_INTERNALFORMAT_BLUE_SIZE       0x8273
2316#define GL_INTERNALFORMAT_ALPHA_SIZE      0x8274
2317#define GL_INTERNALFORMAT_DEPTH_SIZE      0x8275
2318#define GL_INTERNALFORMAT_STENCIL_SIZE    0x8276
2319#define GL_INTERNALFORMAT_SHARED_SIZE     0x8277
2320#define GL_INTERNALFORMAT_RED_TYPE        0x8278
2321#define GL_INTERNALFORMAT_GREEN_TYPE      0x8279
2322#define GL_INTERNALFORMAT_BLUE_TYPE       0x827A
2323#define GL_INTERNALFORMAT_ALPHA_TYPE      0x827B
2324#define GL_INTERNALFORMAT_DEPTH_TYPE      0x827C
2325#define GL_INTERNALFORMAT_STENCIL_TYPE    0x827D
2326#define GL_MAX_WIDTH                      0x827E
2327#define GL_MAX_HEIGHT                     0x827F
2328#define GL_MAX_DEPTH                      0x8280
2329#define GL_MAX_LAYERS                     0x8281
2330#define GL_MAX_COMBINED_DIMENSIONS        0x8282
2331#define GL_COLOR_COMPONENTS               0x8283
2332#define GL_DEPTH_COMPONENTS               0x8284
2333#define GL_STENCIL_COMPONENTS             0x8285
2334#define GL_COLOR_RENDERABLE               0x8286
2335#define GL_DEPTH_RENDERABLE               0x8287
2336#define GL_STENCIL_RENDERABLE             0x8288
2337#define GL_FRAMEBUFFER_RENDERABLE         0x8289
2338#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A
2339#define GL_FRAMEBUFFER_BLEND              0x828B
2340#define GL_READ_PIXELS                    0x828C
2341#define GL_READ_PIXELS_FORMAT             0x828D
2342#define GL_READ_PIXELS_TYPE               0x828E
2343#define GL_TEXTURE_IMAGE_FORMAT           0x828F
2344#define GL_TEXTURE_IMAGE_TYPE             0x8290
2345#define GL_GET_TEXTURE_IMAGE_FORMAT       0x8291
2346#define GL_GET_TEXTURE_IMAGE_TYPE         0x8292
2347#define GL_MIPMAP                         0x8293
2348#define GL_MANUAL_GENERATE_MIPMAP         0x8294
2349#define GL_AUTO_GENERATE_MIPMAP           0x8295
2350#define GL_COLOR_ENCODING                 0x8296
2351#define GL_SRGB_READ                      0x8297
2352#define GL_SRGB_WRITE                     0x8298
2353#define GL_FILTER                         0x829A
2354#define GL_VERTEX_TEXTURE                 0x829B
2355#define GL_TESS_CONTROL_TEXTURE           0x829C
2356#define GL_TESS_EVALUATION_TEXTURE        0x829D
2357#define GL_GEOMETRY_TEXTURE               0x829E
2358#define GL_FRAGMENT_TEXTURE               0x829F
2359#define GL_COMPUTE_TEXTURE                0x82A0
2360#define GL_TEXTURE_SHADOW                 0x82A1
2361#define GL_TEXTURE_GATHER                 0x82A2
2362#define GL_TEXTURE_GATHER_SHADOW          0x82A3
2363#define GL_SHADER_IMAGE_LOAD              0x82A4
2364#define GL_SHADER_IMAGE_STORE             0x82A5
2365#define GL_SHADER_IMAGE_ATOMIC            0x82A6
2366#define GL_IMAGE_TEXEL_SIZE               0x82A7
2367#define GL_IMAGE_COMPATIBILITY_CLASS      0x82A8
2368#define GL_IMAGE_PIXEL_FORMAT             0x82A9
2369#define GL_IMAGE_PIXEL_TYPE               0x82AA
2370#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC
2371#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD
2372#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE
2373#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF
2374#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1
2375#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2
2376#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE  0x82B3
2377#define GL_CLEAR_BUFFER                   0x82B4
2378#define GL_TEXTURE_VIEW                   0x82B5
2379#define GL_VIEW_COMPATIBILITY_CLASS       0x82B6
2380#define GL_FULL_SUPPORT                   0x82B7
2381#define GL_CAVEAT_SUPPORT                 0x82B8
2382#define GL_IMAGE_CLASS_4_X_32             0x82B9
2383#define GL_IMAGE_CLASS_2_X_32             0x82BA
2384#define GL_IMAGE_CLASS_1_X_32             0x82BB
2385#define GL_IMAGE_CLASS_4_X_16             0x82BC
2386#define GL_IMAGE_CLASS_2_X_16             0x82BD
2387#define GL_IMAGE_CLASS_1_X_16             0x82BE
2388#define GL_IMAGE_CLASS_4_X_8              0x82BF
2389#define GL_IMAGE_CLASS_2_X_8              0x82C0
2390#define GL_IMAGE_CLASS_1_X_8              0x82C1
2391#define GL_IMAGE_CLASS_11_11_10           0x82C2
2392#define GL_IMAGE_CLASS_10_10_10_2         0x82C3
2393#define GL_VIEW_CLASS_128_BITS            0x82C4
2394#define GL_VIEW_CLASS_96_BITS             0x82C5
2395#define GL_VIEW_CLASS_64_BITS             0x82C6
2396#define GL_VIEW_CLASS_48_BITS             0x82C7
2397#define GL_VIEW_CLASS_32_BITS             0x82C8
2398#define GL_VIEW_CLASS_24_BITS             0x82C9
2399#define GL_VIEW_CLASS_16_BITS             0x82CA
2400#define GL_VIEW_CLASS_8_BITS              0x82CB
2401#define GL_VIEW_CLASS_S3TC_DXT1_RGB       0x82CC
2402#define GL_VIEW_CLASS_S3TC_DXT1_RGBA      0x82CD
2403#define GL_VIEW_CLASS_S3TC_DXT3_RGBA      0x82CE
2404#define GL_VIEW_CLASS_S3TC_DXT5_RGBA      0x82CF
2405#define GL_VIEW_CLASS_RGTC1_RED           0x82D0
2406#define GL_VIEW_CLASS_RGTC2_RG            0x82D1
2407#define GL_VIEW_CLASS_BPTC_UNORM          0x82D2
2408#define GL_VIEW_CLASS_BPTC_FLOAT          0x82D3
2409#define GL_UNIFORM                        0x92E1
2410#define GL_UNIFORM_BLOCK                  0x92E2
2411#define GL_PROGRAM_INPUT                  0x92E3
2412#define GL_PROGRAM_OUTPUT                 0x92E4
2413#define GL_BUFFER_VARIABLE                0x92E5
2414#define GL_SHADER_STORAGE_BLOCK           0x92E6
2415#define GL_VERTEX_SUBROUTINE              0x92E8
2416#define GL_TESS_CONTROL_SUBROUTINE        0x92E9
2417#define GL_TESS_EVALUATION_SUBROUTINE     0x92EA
2418#define GL_GEOMETRY_SUBROUTINE            0x92EB
2419#define GL_FRAGMENT_SUBROUTINE            0x92EC
2420#define GL_COMPUTE_SUBROUTINE             0x92ED
2421#define GL_VERTEX_SUBROUTINE_UNIFORM      0x92EE
2422#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF
2423#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0
2424#define GL_GEOMETRY_SUBROUTINE_UNIFORM    0x92F1
2425#define GL_FRAGMENT_SUBROUTINE_UNIFORM    0x92F2
2426#define GL_COMPUTE_SUBROUTINE_UNIFORM     0x92F3
2427#define GL_TRANSFORM_FEEDBACK_VARYING     0x92F4
2428#define GL_ACTIVE_RESOURCES               0x92F5
2429#define GL_MAX_NAME_LENGTH                0x92F6
2430#define GL_MAX_NUM_ACTIVE_VARIABLES       0x92F7
2431#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8
2432#define GL_NAME_LENGTH                    0x92F9
2433#define GL_TYPE                           0x92FA
2434#define GL_ARRAY_SIZE                     0x92FB
2435#define GL_OFFSET                         0x92FC
2436#define GL_BLOCK_INDEX                    0x92FD
2437#define GL_ARRAY_STRIDE                   0x92FE
2438#define GL_MATRIX_STRIDE                  0x92FF
2439#define GL_IS_ROW_MAJOR                   0x9300
2440#define GL_ATOMIC_COUNTER_BUFFER_INDEX    0x9301
2441#define GL_BUFFER_BINDING                 0x9302
2442#define GL_BUFFER_DATA_SIZE               0x9303
2443#define GL_NUM_ACTIVE_VARIABLES           0x9304
2444#define GL_ACTIVE_VARIABLES               0x9305
2445#define GL_REFERENCED_BY_VERTEX_SHADER    0x9306
2446#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307
2447#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308
2448#define GL_REFERENCED_BY_GEOMETRY_SHADER  0x9309
2449#define GL_REFERENCED_BY_FRAGMENT_SHADER  0x930A
2450#define GL_REFERENCED_BY_COMPUTE_SHADER   0x930B
2451#define GL_TOP_LEVEL_ARRAY_SIZE           0x930C
2452#define GL_TOP_LEVEL_ARRAY_STRIDE         0x930D
2453#define GL_LOCATION                       0x930E
2454#define GL_LOCATION_INDEX                 0x930F
2455#define GL_IS_PER_PATCH                   0x92E7
2456#define GL_SHADER_STORAGE_BUFFER          0x90D2
2457#define GL_SHADER_STORAGE_BUFFER_BINDING  0x90D3
2458#define GL_SHADER_STORAGE_BUFFER_START    0x90D4
2459#define GL_SHADER_STORAGE_BUFFER_SIZE     0x90D5
2460#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
2461#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7
2462#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8
2463#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9
2464#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
2465#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
2466#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
2467#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
2468#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE  0x90DE
2469#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
2470#define GL_SHADER_STORAGE_BARRIER_BIT     0x00002000
2471#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
2472#define GL_DEPTH_STENCIL_TEXTURE_MODE     0x90EA
2473#define GL_TEXTURE_BUFFER_OFFSET          0x919D
2474#define GL_TEXTURE_BUFFER_SIZE            0x919E
2475#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F
2476#define GL_TEXTURE_VIEW_MIN_LEVEL         0x82DB
2477#define GL_TEXTURE_VIEW_NUM_LEVELS        0x82DC
2478#define GL_TEXTURE_VIEW_MIN_LAYER         0x82DD
2479#define GL_TEXTURE_VIEW_NUM_LAYERS        0x82DE
2480#define GL_TEXTURE_IMMUTABLE_LEVELS       0x82DF
2481#define GL_VERTEX_ATTRIB_BINDING          0x82D4
2482#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET  0x82D5
2483#define GL_VERTEX_BINDING_DIVISOR         0x82D6
2484#define GL_VERTEX_BINDING_OFFSET          0x82D7
2485#define GL_VERTEX_BINDING_STRIDE          0x82D8
2486#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
2487#define GL_MAX_VERTEX_ATTRIB_BINDINGS     0x82DA
2488typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
2489typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
2490typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
2491typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
2492typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
2493typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
2494typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
2495typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
2496typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
2497typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level);
2498typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
2499typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);
2500typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
2501typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
2502typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
2503typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
2504typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
2505typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
2506typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
2507typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
2508typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name);
2509typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
2510typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
2511typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
2512typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
2513typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
2514typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
2515typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
2516typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
2517typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
2518typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
2519typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);
2520typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);
2521typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
2522typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
2523typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
2524typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
2525typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
2526typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);
2527typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
2528typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
2529typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
2530typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
2531#ifdef GL_GLEXT_PROTOTYPES
2532GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
2533GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
2534GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
2535GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect);
2536GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
2537GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);
2538GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);
2539GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
2540GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
2541GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level);
2542GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length);
2543GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer);
2544GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
2545GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
2546GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
2547GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
2548GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
2549GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);
2550GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
2551GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
2552GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);
2553GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name);
2554GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
2555GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
2556GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
2557GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
2558GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
2559GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
2560GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
2561GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
2562GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
2563GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
2564GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
2565GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
2566GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
2567GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam);
2568GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
2569GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message);
2570GLAPI void APIENTRY glPopDebugGroup (void);
2571GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
2572GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
2573GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label);
2574GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
2575#endif
2576#endif /* GL_VERSION_4_3 */
2577
2578#ifndef GL_VERSION_4_4
2579#define GL_VERSION_4_4 1
2580#define GL_MAX_VERTEX_ATTRIB_STRIDE       0x82E5
2581#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
2582#define GL_TEXTURE_BUFFER_BINDING         0x8C2A
2583#define GL_MAP_PERSISTENT_BIT             0x0040
2584#define GL_MAP_COHERENT_BIT               0x0080
2585#define GL_DYNAMIC_STORAGE_BIT            0x0100
2586#define GL_CLIENT_STORAGE_BIT             0x0200
2587#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000
2588#define GL_BUFFER_IMMUTABLE_STORAGE       0x821F
2589#define GL_BUFFER_STORAGE_FLAGS           0x8220
2590#define GL_CLEAR_TEXTURE                  0x9365
2591#define GL_LOCATION_COMPONENT             0x934A
2592#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B
2593#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C
2594#define GL_QUERY_BUFFER                   0x9192
2595#define GL_QUERY_BUFFER_BARRIER_BIT       0x00008000
2596#define GL_QUERY_BUFFER_BINDING           0x9193
2597#define GL_QUERY_RESULT_NO_WAIT           0x9194
2598#define GL_MIRROR_CLAMP_TO_EDGE           0x8743
2599typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
2600typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
2601typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
2602typedef void (APIENTRYP PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
2603typedef void (APIENTRYP PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
2604typedef void (APIENTRYP PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures);
2605typedef void (APIENTRYP PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint *samplers);
2606typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures);
2607typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
2608#ifdef GL_GLEXT_PROTOTYPES
2609GLAPI void APIENTRY glBufferStorage (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
2610GLAPI void APIENTRY glClearTexImage (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
2611GLAPI void APIENTRY glClearTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
2612GLAPI void APIENTRY glBindBuffersBase (GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
2613GLAPI void APIENTRY glBindBuffersRange (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
2614GLAPI void APIENTRY glBindTextures (GLuint first, GLsizei count, const GLuint *textures);
2615GLAPI void APIENTRY glBindSamplers (GLuint first, GLsizei count, const GLuint *samplers);
2616GLAPI void APIENTRY glBindImageTextures (GLuint first, GLsizei count, const GLuint *textures);
2617GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
2618#endif
2619#endif /* GL_VERSION_4_4 */
2620
2621#ifndef GL_ARB_ES2_compatibility
2622#define GL_ARB_ES2_compatibility 1
2623#endif /* GL_ARB_ES2_compatibility */
2624
2625#ifndef GL_ARB_ES3_compatibility
2626#define GL_ARB_ES3_compatibility 1
2627#endif /* GL_ARB_ES3_compatibility */
2628
2629#ifndef GL_ARB_arrays_of_arrays
2630#define GL_ARB_arrays_of_arrays 1
2631#endif /* GL_ARB_arrays_of_arrays */
2632
2633#ifndef GL_ARB_base_instance
2634#define GL_ARB_base_instance 1
2635#endif /* GL_ARB_base_instance */
2636
2637#ifndef GL_ARB_bindless_texture
2638#define GL_ARB_bindless_texture 1
2639typedef uint64_t GLuint64EXT;
2640#define GL_UNSIGNED_INT64_ARB             0x140F
2641typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture);
2642typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler);
2643typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
2644typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle);
2645typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
2646typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access);
2647typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle);
2648typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value);
2649typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
2650typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value);
2651typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
2652typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
2653typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle);
2654typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x);
2655typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v);
2656typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params);
2657#ifdef GL_GLEXT_PROTOTYPES
2658GLAPI GLuint64 APIENTRY glGetTextureHandleARB (GLuint texture);
2659GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleARB (GLuint texture, GLuint sampler);
2660GLAPI void APIENTRY glMakeTextureHandleResidentARB (GLuint64 handle);
2661GLAPI void APIENTRY glMakeTextureHandleNonResidentARB (GLuint64 handle);
2662GLAPI GLuint64 APIENTRY glGetImageHandleARB (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
2663GLAPI void APIENTRY glMakeImageHandleResidentARB (GLuint64 handle, GLenum access);
2664GLAPI void APIENTRY glMakeImageHandleNonResidentARB (GLuint64 handle);
2665GLAPI void APIENTRY glUniformHandleui64ARB (GLint location, GLuint64 value);
2666GLAPI void APIENTRY glUniformHandleui64vARB (GLint location, GLsizei count, const GLuint64 *value);
2667GLAPI void APIENTRY glProgramUniformHandleui64ARB (GLuint program, GLint location, GLuint64 value);
2668GLAPI void APIENTRY glProgramUniformHandleui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
2669GLAPI GLboolean APIENTRY glIsTextureHandleResidentARB (GLuint64 handle);
2670GLAPI GLboolean APIENTRY glIsImageHandleResidentARB (GLuint64 handle);
2671GLAPI void APIENTRY glVertexAttribL1ui64ARB (GLuint index, GLuint64EXT x);
2672GLAPI void APIENTRY glVertexAttribL1ui64vARB (GLuint index, const GLuint64EXT *v);
2673GLAPI void APIENTRY glGetVertexAttribLui64vARB (GLuint index, GLenum pname, GLuint64EXT *params);
2674#endif
2675#endif /* GL_ARB_bindless_texture */
2676
2677#ifndef GL_ARB_blend_func_extended
2678#define GL_ARB_blend_func_extended 1
2679#endif /* GL_ARB_blend_func_extended */
2680
2681#ifndef GL_ARB_buffer_storage
2682#define GL_ARB_buffer_storage 1
2683#endif /* GL_ARB_buffer_storage */
2684
2685#ifndef GL_ARB_cl_event
2686#define GL_ARB_cl_event 1
2687struct _cl_context;
2688struct _cl_event;
2689#define GL_SYNC_CL_EVENT_ARB              0x8240
2690#define GL_SYNC_CL_EVENT_COMPLETE_ARB     0x8241
2691typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context *context, struct _cl_event *event, GLbitfield flags);
2692#ifdef GL_GLEXT_PROTOTYPES
2693GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, struct _cl_event *event, GLbitfield flags);
2694#endif
2695#endif /* GL_ARB_cl_event */
2696
2697#ifndef GL_ARB_clear_buffer_object
2698#define GL_ARB_clear_buffer_object 1
2699#endif /* GL_ARB_clear_buffer_object */
2700
2701#ifndef GL_ARB_clear_texture
2702#define GL_ARB_clear_texture 1
2703#endif /* GL_ARB_clear_texture */
2704
2705#ifndef GL_ARB_compressed_texture_pixel_storage
2706#define GL_ARB_compressed_texture_pixel_storage 1
2707#endif /* GL_ARB_compressed_texture_pixel_storage */
2708
2709#ifndef GL_ARB_compute_shader
2710#define GL_ARB_compute_shader 1
2711#define GL_COMPUTE_SHADER_BIT             0x00000020
2712#endif /* GL_ARB_compute_shader */
2713
2714#ifndef GL_ARB_compute_variable_group_size
2715#define GL_ARB_compute_variable_group_size 1
2716#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344
2717#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB
2718#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345
2719#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF
2720typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z);
2721#ifdef GL_GLEXT_PROTOTYPES
2722GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z);
2723#endif
2724#endif /* GL_ARB_compute_variable_group_size */
2725
2726#ifndef GL_ARB_conservative_depth
2727#define GL_ARB_conservative_depth 1
2728#endif /* GL_ARB_conservative_depth */
2729
2730#ifndef GL_ARB_copy_buffer
2731#define GL_ARB_copy_buffer 1
2732#define GL_COPY_READ_BUFFER_BINDING       0x8F36
2733#define GL_COPY_WRITE_BUFFER_BINDING      0x8F37
2734#endif /* GL_ARB_copy_buffer */
2735
2736#ifndef GL_ARB_copy_image
2737#define GL_ARB_copy_image 1
2738#endif /* GL_ARB_copy_image */
2739
2740#ifndef GL_ARB_debug_output
2741#define GL_ARB_debug_output 1
2742typedef void (APIENTRY  *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
2743#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB   0x8242
2744#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
2745#define GL_DEBUG_CALLBACK_FUNCTION_ARB    0x8244
2746#define GL_DEBUG_CALLBACK_USER_PARAM_ARB  0x8245
2747#define GL_DEBUG_SOURCE_API_ARB           0x8246
2748#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
2749#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
2750#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB   0x8249
2751#define GL_DEBUG_SOURCE_APPLICATION_ARB   0x824A
2752#define GL_DEBUG_SOURCE_OTHER_ARB         0x824B
2753#define GL_DEBUG_TYPE_ERROR_ARB           0x824C
2754#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
2755#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
2756#define GL_DEBUG_TYPE_PORTABILITY_ARB     0x824F
2757#define GL_DEBUG_TYPE_PERFORMANCE_ARB     0x8250
2758#define GL_DEBUG_TYPE_OTHER_ARB           0x8251
2759#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB   0x9143
2760#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB  0x9144
2761#define GL_DEBUG_LOGGED_MESSAGES_ARB      0x9145
2762#define GL_DEBUG_SEVERITY_HIGH_ARB        0x9146
2763#define GL_DEBUG_SEVERITY_MEDIUM_ARB      0x9147
2764#define GL_DEBUG_SEVERITY_LOW_ARB         0x9148
2765typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
2766typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
2767typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam);
2768typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
2769#ifdef GL_GLEXT_PROTOTYPES
2770GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
2771GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
2772GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const void *userParam);
2773GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
2774#endif
2775#endif /* GL_ARB_debug_output */
2776
2777#ifndef GL_ARB_depth_buffer_float
2778#define GL_ARB_depth_buffer_float 1
2779#endif /* GL_ARB_depth_buffer_float */
2780
2781#ifndef GL_ARB_depth_clamp
2782#define GL_ARB_depth_clamp 1
2783#endif /* GL_ARB_depth_clamp */
2784
2785#ifndef GL_ARB_draw_buffers_blend
2786#define GL_ARB_draw_buffers_blend 1
2787typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode);
2788typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
2789typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst);
2790typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
2791#ifdef GL_GLEXT_PROTOTYPES
2792GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode);
2793GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
2794GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst);
2795GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
2796#endif
2797#endif /* GL_ARB_draw_buffers_blend */
2798
2799#ifndef GL_ARB_draw_elements_base_vertex
2800#define GL_ARB_draw_elements_base_vertex 1
2801#endif /* GL_ARB_draw_elements_base_vertex */
2802
2803#ifndef GL_ARB_draw_indirect
2804#define GL_ARB_draw_indirect 1
2805#endif /* GL_ARB_draw_indirect */
2806
2807#ifndef GL_ARB_enhanced_layouts
2808#define GL_ARB_enhanced_layouts 1
2809#endif /* GL_ARB_enhanced_layouts */
2810
2811#ifndef GL_ARB_explicit_attrib_location
2812#define GL_ARB_explicit_attrib_location 1
2813#endif /* GL_ARB_explicit_attrib_location */
2814
2815#ifndef GL_ARB_explicit_uniform_location
2816#define GL_ARB_explicit_uniform_location 1
2817#endif /* GL_ARB_explicit_uniform_location */
2818
2819#ifndef GL_ARB_fragment_coord_conventions
2820#define GL_ARB_fragment_coord_conventions 1
2821#endif /* GL_ARB_fragment_coord_conventions */
2822
2823#ifndef GL_ARB_fragment_layer_viewport
2824#define GL_ARB_fragment_layer_viewport 1
2825#endif /* GL_ARB_fragment_layer_viewport */
2826
2827#ifndef GL_ARB_framebuffer_no_attachments
2828#define GL_ARB_framebuffer_no_attachments 1
2829#endif /* GL_ARB_framebuffer_no_attachments */
2830
2831#ifndef GL_ARB_framebuffer_object
2832#define GL_ARB_framebuffer_object 1
2833#endif /* GL_ARB_framebuffer_object */
2834
2835#ifndef GL_ARB_framebuffer_sRGB
2836#define GL_ARB_framebuffer_sRGB 1
2837#endif /* GL_ARB_framebuffer_sRGB */
2838
2839#ifndef GL_ARB_get_program_binary
2840#define GL_ARB_get_program_binary 1
2841#endif /* GL_ARB_get_program_binary */
2842
2843#ifndef GL_ARB_gpu_shader5
2844#define GL_ARB_gpu_shader5 1
2845#endif /* GL_ARB_gpu_shader5 */
2846
2847#ifndef GL_ARB_gpu_shader_fp64
2848#define GL_ARB_gpu_shader_fp64 1
2849#endif /* GL_ARB_gpu_shader_fp64 */
2850
2851#ifndef GL_ARB_half_float_vertex
2852#define GL_ARB_half_float_vertex 1
2853#endif /* GL_ARB_half_float_vertex */
2854
2855#ifndef GL_ARB_imaging
2856#define GL_ARB_imaging 1
2857#define GL_BLEND_COLOR                    0x8005
2858#define GL_BLEND_EQUATION                 0x8009
2859#endif /* GL_ARB_imaging */
2860
2861#ifndef GL_ARB_indirect_parameters
2862#define GL_ARB_indirect_parameters 1
2863#define GL_PARAMETER_BUFFER_ARB           0x80EE
2864#define GL_PARAMETER_BUFFER_BINDING_ARB   0x80EF
2865typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
2866typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
2867#ifdef GL_GLEXT_PROTOTYPES
2868GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
2869GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
2870#endif
2871#endif /* GL_ARB_indirect_parameters */
2872
2873#ifndef GL_ARB_internalformat_query
2874#define GL_ARB_internalformat_query 1
2875#endif /* GL_ARB_internalformat_query */
2876
2877#ifndef GL_ARB_internalformat_query2
2878#define GL_ARB_internalformat_query2 1
2879#define GL_SRGB_DECODE_ARB                0x8299
2880#endif /* GL_ARB_internalformat_query2 */
2881
2882#ifndef GL_ARB_invalidate_subdata
2883#define GL_ARB_invalidate_subdata 1
2884#endif /* GL_ARB_invalidate_subdata */
2885
2886#ifndef GL_ARB_map_buffer_alignment
2887#define GL_ARB_map_buffer_alignment 1
2888#endif /* GL_ARB_map_buffer_alignment */
2889
2890#ifndef GL_ARB_map_buffer_range
2891#define GL_ARB_map_buffer_range 1
2892#endif /* GL_ARB_map_buffer_range */
2893
2894#ifndef GL_ARB_multi_bind
2895#define GL_ARB_multi_bind 1
2896#endif /* GL_ARB_multi_bind */
2897
2898#ifndef GL_ARB_multi_draw_indirect
2899#define GL_ARB_multi_draw_indirect 1
2900#endif /* GL_ARB_multi_draw_indirect */
2901
2902#ifndef GL_ARB_occlusion_query2
2903#define GL_ARB_occlusion_query2 1
2904#endif /* GL_ARB_occlusion_query2 */
2905
2906#ifndef GL_ARB_program_interface_query
2907#define GL_ARB_program_interface_query 1
2908#endif /* GL_ARB_program_interface_query */
2909
2910#ifndef GL_ARB_provoking_vertex
2911#define GL_ARB_provoking_vertex 1
2912#endif /* GL_ARB_provoking_vertex */
2913
2914#ifndef GL_ARB_query_buffer_object
2915#define GL_ARB_query_buffer_object 1
2916#endif /* GL_ARB_query_buffer_object */
2917
2918#ifndef GL_ARB_robust_buffer_access_behavior
2919#define GL_ARB_robust_buffer_access_behavior 1
2920#endif /* GL_ARB_robust_buffer_access_behavior */
2921
2922#ifndef GL_ARB_robustness
2923#define GL_ARB_robustness 1
2924#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004
2925#define GL_LOSE_CONTEXT_ON_RESET_ARB      0x8252
2926#define GL_GUILTY_CONTEXT_RESET_ARB       0x8253
2927#define GL_INNOCENT_CONTEXT_RESET_ARB     0x8254
2928#define GL_UNKNOWN_CONTEXT_RESET_ARB      0x8255
2929#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
2930#define GL_NO_RESET_NOTIFICATION_ARB      0x8261
2931typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void);
2932typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img);
2933typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
2934typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void *img);
2935typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
2936typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
2937typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
2938typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
2939#ifdef GL_GLEXT_PROTOTYPES
2940GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void);
2941GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img);
2942GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
2943GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, void *img);
2944GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
2945GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params);
2946GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
2947GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
2948#endif
2949#endif /* GL_ARB_robustness */
2950
2951#ifndef GL_ARB_robustness_isolation
2952#define GL_ARB_robustness_isolation 1
2953#endif /* GL_ARB_robustness_isolation */
2954
2955#ifndef GL_ARB_sample_shading
2956#define GL_ARB_sample_shading 1
2957#define GL_SAMPLE_SHADING_ARB             0x8C36
2958#define GL_MIN_SAMPLE_SHADING_VALUE_ARB   0x8C37
2959typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value);
2960#ifdef GL_GLEXT_PROTOTYPES
2961GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value);
2962#endif
2963#endif /* GL_ARB_sample_shading */
2964
2965#ifndef GL_ARB_sampler_objects
2966#define GL_ARB_sampler_objects 1
2967#endif /* GL_ARB_sampler_objects */
2968
2969#ifndef GL_ARB_seamless_cube_map
2970#define GL_ARB_seamless_cube_map 1
2971#endif /* GL_ARB_seamless_cube_map */
2972
2973#ifndef GL_ARB_seamless_cubemap_per_texture
2974#define GL_ARB_seamless_cubemap_per_texture 1
2975#endif /* GL_ARB_seamless_cubemap_per_texture */
2976
2977#ifndef GL_ARB_separate_shader_objects
2978#define GL_ARB_separate_shader_objects 1
2979#endif /* GL_ARB_separate_shader_objects */
2980
2981#ifndef GL_ARB_shader_atomic_counters
2982#define GL_ARB_shader_atomic_counters 1
2983#endif /* GL_ARB_shader_atomic_counters */
2984
2985#ifndef GL_ARB_shader_bit_encoding
2986#define GL_ARB_shader_bit_encoding 1
2987#endif /* GL_ARB_shader_bit_encoding */
2988
2989#ifndef GL_ARB_shader_draw_parameters
2990#define GL_ARB_shader_draw_parameters 1
2991#endif /* GL_ARB_shader_draw_parameters */
2992
2993#ifndef GL_ARB_shader_group_vote
2994#define GL_ARB_shader_group_vote 1
2995#endif /* GL_ARB_shader_group_vote */
2996
2997#ifndef GL_ARB_shader_image_load_store
2998#define GL_ARB_shader_image_load_store 1
2999#endif /* GL_ARB_shader_image_load_store */
3000
3001#ifndef GL_ARB_shader_image_size
3002#define GL_ARB_shader_image_size 1
3003#endif /* GL_ARB_shader_image_size */
3004
3005#ifndef GL_ARB_shader_precision
3006#define GL_ARB_shader_precision 1
3007#endif /* GL_ARB_shader_precision */
3008
3009#ifndef GL_ARB_shader_stencil_export
3010#define GL_ARB_shader_stencil_export 1
3011#endif /* GL_ARB_shader_stencil_export */
3012
3013#ifndef GL_ARB_shader_storage_buffer_object
3014#define GL_ARB_shader_storage_buffer_object 1
3015#endif /* GL_ARB_shader_storage_buffer_object */
3016
3017#ifndef GL_ARB_shader_subroutine
3018#define GL_ARB_shader_subroutine 1
3019#endif /* GL_ARB_shader_subroutine */
3020
3021#ifndef GL_ARB_shading_language_420pack
3022#define GL_ARB_shading_language_420pack 1
3023#endif /* GL_ARB_shading_language_420pack */
3024
3025#ifndef GL_ARB_shading_language_include
3026#define GL_ARB_shading_language_include 1
3027#define GL_SHADER_INCLUDE_ARB             0x8DAE
3028#define GL_NAMED_STRING_LENGTH_ARB        0x8DE9
3029#define GL_NAMED_STRING_TYPE_ARB          0x8DEA
3030typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
3031typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
3032typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length);
3033typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
3034typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
3035typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
3036#ifdef GL_GLEXT_PROTOTYPES
3037GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
3038GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name);
3039GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length);
3040GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name);
3041GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
3042GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
3043#endif
3044#endif /* GL_ARB_shading_language_include */
3045
3046#ifndef GL_ARB_shading_language_packing
3047#define GL_ARB_shading_language_packing 1
3048#endif /* GL_ARB_shading_language_packing */
3049
3050#ifndef GL_ARB_sparse_texture
3051#define GL_ARB_sparse_texture 1
3052#define GL_TEXTURE_SPARSE_ARB             0x91A6
3053#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB    0x91A7
3054#define GL_MIN_SPARSE_LEVEL_ARB           0x919B
3055#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB     0x91A8
3056#define GL_VIRTUAL_PAGE_SIZE_X_ARB        0x9195
3057#define GL_VIRTUAL_PAGE_SIZE_Y_ARB        0x9196
3058#define GL_VIRTUAL_PAGE_SIZE_Z_ARB        0x9197
3059#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB    0x9198
3060#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199
3061#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A
3062#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9
3063typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident);
3064#ifdef GL_GLEXT_PROTOTYPES
3065GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident);
3066#endif
3067#endif /* GL_ARB_sparse_texture */
3068
3069#ifndef GL_ARB_stencil_texturing
3070#define GL_ARB_stencil_texturing 1
3071#endif /* GL_ARB_stencil_texturing */
3072
3073#ifndef GL_ARB_sync
3074#define GL_ARB_sync 1
3075#endif /* GL_ARB_sync */
3076
3077#ifndef GL_ARB_tessellation_shader
3078#define GL_ARB_tessellation_shader 1
3079#endif /* GL_ARB_tessellation_shader */
3080
3081#ifndef GL_ARB_texture_buffer_object_rgb32
3082#define GL_ARB_texture_buffer_object_rgb32 1
3083#endif /* GL_ARB_texture_buffer_object_rgb32 */
3084
3085#ifndef GL_ARB_texture_buffer_range
3086#define GL_ARB_texture_buffer_range 1
3087#endif /* GL_ARB_texture_buffer_range */
3088
3089#ifndef GL_ARB_texture_compression_bptc
3090#define GL_ARB_texture_compression_bptc 1
3091#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
3092#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
3093#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
3094#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
3095#endif /* GL_ARB_texture_compression_bptc */
3096
3097#ifndef GL_ARB_texture_compression_rgtc
3098#define GL_ARB_texture_compression_rgtc 1
3099#endif /* GL_ARB_texture_compression_rgtc */
3100
3101#ifndef GL_ARB_texture_cube_map_array
3102#define GL_ARB_texture_cube_map_array 1
3103#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB     0x9009
3104#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A
3105#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B
3106#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB     0x900C
3107#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
3108#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E
3109#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F
3110#endif /* GL_ARB_texture_cube_map_array */
3111
3112#ifndef GL_ARB_texture_gather
3113#define GL_ARB_texture_gather 1
3114#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E
3115#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F
3116#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F
3117#endif /* GL_ARB_texture_gather */
3118
3119#ifndef GL_ARB_texture_mirror_clamp_to_edge
3120#define GL_ARB_texture_mirror_clamp_to_edge 1
3121#endif /* GL_ARB_texture_mirror_clamp_to_edge */
3122
3123#ifndef GL_ARB_texture_multisample
3124#define GL_ARB_texture_multisample 1
3125#endif /* GL_ARB_texture_multisample */
3126
3127#ifndef GL_ARB_texture_query_levels
3128#define GL_ARB_texture_query_levels 1
3129#endif /* GL_ARB_texture_query_levels */
3130
3131#ifndef GL_ARB_texture_query_lod
3132#define GL_ARB_texture_query_lod 1
3133#endif /* GL_ARB_texture_query_lod */
3134
3135#ifndef GL_ARB_texture_rg
3136#define GL_ARB_texture_rg 1
3137#endif /* GL_ARB_texture_rg */
3138
3139#ifndef GL_ARB_texture_rgb10_a2ui
3140#define GL_ARB_texture_rgb10_a2ui 1
3141#endif /* GL_ARB_texture_rgb10_a2ui */
3142
3143#ifndef GL_ARB_texture_stencil8
3144#define GL_ARB_texture_stencil8 1
3145#endif /* GL_ARB_texture_stencil8 */
3146
3147#ifndef GL_ARB_texture_storage
3148#define GL_ARB_texture_storage 1
3149#endif /* GL_ARB_texture_storage */
3150
3151#ifndef GL_ARB_texture_storage_multisample
3152#define GL_ARB_texture_storage_multisample 1
3153#endif /* GL_ARB_texture_storage_multisample */
3154
3155#ifndef GL_ARB_texture_swizzle
3156#define GL_ARB_texture_swizzle 1
3157#endif /* GL_ARB_texture_swizzle */
3158
3159#ifndef GL_ARB_texture_view
3160#define GL_ARB_texture_view 1
3161#endif /* GL_ARB_texture_view */
3162
3163#ifndef GL_ARB_timer_query
3164#define GL_ARB_timer_query 1
3165#endif /* GL_ARB_timer_query */
3166
3167#ifndef GL_ARB_transform_feedback2
3168#define GL_ARB_transform_feedback2 1
3169#define GL_TRANSFORM_FEEDBACK_PAUSED      0x8E23
3170#define GL_TRANSFORM_FEEDBACK_ACTIVE      0x8E24
3171#endif /* GL_ARB_transform_feedback2 */
3172
3173#ifndef GL_ARB_transform_feedback3
3174#define GL_ARB_transform_feedback3 1
3175#endif /* GL_ARB_transform_feedback3 */
3176
3177#ifndef GL_ARB_transform_feedback_instanced
3178#define GL_ARB_transform_feedback_instanced 1
3179#endif /* GL_ARB_transform_feedback_instanced */
3180
3181#ifndef GL_ARB_uniform_buffer_object
3182#define GL_ARB_uniform_buffer_object 1
3183#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS    0x8A2C
3184#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
3185#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
3186#endif /* GL_ARB_uniform_buffer_object */
3187
3188#ifndef GL_ARB_vertex_array_bgra
3189#define GL_ARB_vertex_array_bgra 1
3190#endif /* GL_ARB_vertex_array_bgra */
3191
3192#ifndef GL_ARB_vertex_array_object
3193#define GL_ARB_vertex_array_object 1
3194#endif /* GL_ARB_vertex_array_object */
3195
3196#ifndef GL_ARB_vertex_attrib_64bit
3197#define GL_ARB_vertex_attrib_64bit 1
3198#endif /* GL_ARB_vertex_attrib_64bit */
3199
3200#ifndef GL_ARB_vertex_attrib_binding
3201#define GL_ARB_vertex_attrib_binding 1
3202#endif /* GL_ARB_vertex_attrib_binding */
3203
3204#ifndef GL_ARB_vertex_type_10f_11f_11f_rev
3205#define GL_ARB_vertex_type_10f_11f_11f_rev 1
3206#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */
3207
3208#ifndef GL_ARB_vertex_type_2_10_10_10_rev
3209#define GL_ARB_vertex_type_2_10_10_10_rev 1
3210#endif /* GL_ARB_vertex_type_2_10_10_10_rev */
3211
3212#ifndef GL_ARB_viewport_array
3213#define GL_ARB_viewport_array 1
3214#endif /* GL_ARB_viewport_array */
3215
3216#ifndef GL_KHR_debug
3217#define GL_KHR_debug 1
3218#endif /* GL_KHR_debug */
3219
3220#ifndef GL_KHR_texture_compression_astc_hdr
3221#define GL_KHR_texture_compression_astc_hdr 1
3222#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR   0x93B0
3223#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR   0x93B1
3224#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR   0x93B2
3225#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR   0x93B3
3226#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR   0x93B4
3227#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR   0x93B5
3228#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR   0x93B6
3229#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR   0x93B7
3230#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR  0x93B8
3231#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR  0x93B9
3232#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR  0x93BA
3233#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
3234#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
3235#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
3236#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
3237#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
3238#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
3239#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
3240#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
3241#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
3242#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
3243#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
3244#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
3245#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
3246#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
3247#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
3248#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
3249#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
3250#endif /* GL_KHR_texture_compression_astc_hdr */
3251
3252#ifndef GL_KHR_texture_compression_astc_ldr
3253#define GL_KHR_texture_compression_astc_ldr 1
3254#endif /* GL_KHR_texture_compression_astc_ldr */
3255
3256#ifdef __cplusplus
3257}
3258#endif
3259
3260#endif
Property changes on: branches/osd/src/lib/khronos/gl/glcorearb.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/gl/glext.h
r0r31734
1#ifndef __glext_h_
2#define __glext_h_ 1
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/*
9** Copyright (c) 2013 The Khronos Group Inc.
10**
11** Permission is hereby granted, free of charge, to any person obtaining a
12** copy of this software and/or associated documentation files (the
13** "Materials"), to deal in the Materials without restriction, including
14** without limitation the rights to use, copy, modify, merge, publish,
15** distribute, sublicense, and/or sell copies of the Materials, and to
16** permit persons to whom the Materials are furnished to do so, subject to
17** the following conditions:
18**
19** The above copyright notice and this permission notice shall be included
20** in all copies or substantial portions of the Materials.
21**
22** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
29*/
30/*
31** This header is generated from the Khronos OpenGL / OpenGL ES XML
32** API Registry. The current version of the Registry, generator scripts
33** used to make the header, and the header can be found at
34**   http://www.opengl.org/registry/
35**
36** Khronos $Revision: 23855 $ on $Date: 2013-11-02 22:54:48 -0700 (Sat, 02 Nov 2013) $
37*/
38
39#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
40#ifndef WIN32_LEAN_AND_MEAN
41#define WIN32_LEAN_AND_MEAN 1
42#endif
43#include <windows.h>
44#endif
45
46#ifndef APIENTRY
47#define APIENTRY
48#endif
49#ifndef APIENTRYP
50#define APIENTRYP APIENTRY *
51#endif
52#ifndef GLAPI
53#define GLAPI extern
54#endif
55
56#define GL_GLEXT_VERSION 20131102
57
58/* Generated C header for:
59 * API: gl
60 * Profile: compatibility
61 * Versions considered: .*
62 * Versions emitted: 1\.[2-9]|[234]\.[0-9]
63 * Default extensions included: gl
64 * Additional extensions included: _nomatch_^
65 * Extensions removed: _nomatch_^
66 */
67
68#ifndef GL_VERSION_1_2
69#define GL_VERSION_1_2 1
70#define GL_UNSIGNED_BYTE_3_3_2            0x8032
71#define GL_UNSIGNED_SHORT_4_4_4_4         0x8033
72#define GL_UNSIGNED_SHORT_5_5_5_1         0x8034
73#define GL_UNSIGNED_INT_8_8_8_8           0x8035
74#define GL_UNSIGNED_INT_10_10_10_2        0x8036
75#define GL_TEXTURE_BINDING_3D             0x806A
76#define GL_PACK_SKIP_IMAGES               0x806B
77#define GL_PACK_IMAGE_HEIGHT              0x806C
78#define GL_UNPACK_SKIP_IMAGES             0x806D
79#define GL_UNPACK_IMAGE_HEIGHT            0x806E
80#define GL_TEXTURE_3D                     0x806F
81#define GL_PROXY_TEXTURE_3D               0x8070
82#define GL_TEXTURE_DEPTH                  0x8071
83#define GL_TEXTURE_WRAP_R                 0x8072
84#define GL_MAX_3D_TEXTURE_SIZE            0x8073
85#define GL_UNSIGNED_BYTE_2_3_3_REV        0x8362
86#define GL_UNSIGNED_SHORT_5_6_5           0x8363
87#define GL_UNSIGNED_SHORT_5_6_5_REV       0x8364
88#define GL_UNSIGNED_SHORT_4_4_4_4_REV     0x8365
89#define GL_UNSIGNED_SHORT_1_5_5_5_REV     0x8366
90#define GL_UNSIGNED_INT_8_8_8_8_REV       0x8367
91#define GL_UNSIGNED_INT_2_10_10_10_REV    0x8368
92#define GL_BGR                            0x80E0
93#define GL_BGRA                           0x80E1
94#define GL_MAX_ELEMENTS_VERTICES          0x80E8
95#define GL_MAX_ELEMENTS_INDICES           0x80E9
96#define GL_CLAMP_TO_EDGE                  0x812F
97#define GL_TEXTURE_MIN_LOD                0x813A
98#define GL_TEXTURE_MAX_LOD                0x813B
99#define GL_TEXTURE_BASE_LEVEL             0x813C
100#define GL_TEXTURE_MAX_LEVEL              0x813D
101#define GL_SMOOTH_POINT_SIZE_RANGE        0x0B12
102#define GL_SMOOTH_POINT_SIZE_GRANULARITY  0x0B13
103#define GL_SMOOTH_LINE_WIDTH_RANGE        0x0B22
104#define GL_SMOOTH_LINE_WIDTH_GRANULARITY  0x0B23
105#define GL_ALIASED_LINE_WIDTH_RANGE       0x846E
106#define GL_RESCALE_NORMAL                 0x803A
107#define GL_LIGHT_MODEL_COLOR_CONTROL      0x81F8
108#define GL_SINGLE_COLOR                   0x81F9
109#define GL_SEPARATE_SPECULAR_COLOR        0x81FA
110#define GL_ALIASED_POINT_SIZE_RANGE       0x846D
111typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
112typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
113typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
114typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
115#ifdef GL_GLEXT_PROTOTYPES
116GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
117GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
118GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
119GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
120#endif
121#endif /* GL_VERSION_1_2 */
122
123#ifndef GL_VERSION_1_3
124#define GL_VERSION_1_3 1
125#define GL_TEXTURE0                       0x84C0
126#define GL_TEXTURE1                       0x84C1
127#define GL_TEXTURE2                       0x84C2
128#define GL_TEXTURE3                       0x84C3
129#define GL_TEXTURE4                       0x84C4
130#define GL_TEXTURE5                       0x84C5
131#define GL_TEXTURE6                       0x84C6
132#define GL_TEXTURE7                       0x84C7
133#define GL_TEXTURE8                       0x84C8
134#define GL_TEXTURE9                       0x84C9
135#define GL_TEXTURE10                      0x84CA
136#define GL_TEXTURE11                      0x84CB
137#define GL_TEXTURE12                      0x84CC
138#define GL_TEXTURE13                      0x84CD
139#define GL_TEXTURE14                      0x84CE
140#define GL_TEXTURE15                      0x84CF
141#define GL_TEXTURE16                      0x84D0
142#define GL_TEXTURE17                      0x84D1
143#define GL_TEXTURE18                      0x84D2
144#define GL_TEXTURE19                      0x84D3
145#define GL_TEXTURE20                      0x84D4
146#define GL_TEXTURE21                      0x84D5
147#define GL_TEXTURE22                      0x84D6
148#define GL_TEXTURE23                      0x84D7
149#define GL_TEXTURE24                      0x84D8
150#define GL_TEXTURE25                      0x84D9
151#define GL_TEXTURE26                      0x84DA
152#define GL_TEXTURE27                      0x84DB
153#define GL_TEXTURE28                      0x84DC
154#define GL_TEXTURE29                      0x84DD
155#define GL_TEXTURE30                      0x84DE
156#define GL_TEXTURE31                      0x84DF
157#define GL_ACTIVE_TEXTURE                 0x84E0
158#define GL_MULTISAMPLE                    0x809D
159#define GL_SAMPLE_ALPHA_TO_COVERAGE       0x809E
160#define GL_SAMPLE_ALPHA_TO_ONE            0x809F
161#define GL_SAMPLE_COVERAGE                0x80A0
162#define GL_SAMPLE_BUFFERS                 0x80A8
163#define GL_SAMPLES                        0x80A9
164#define GL_SAMPLE_COVERAGE_VALUE          0x80AA
165#define GL_SAMPLE_COVERAGE_INVERT         0x80AB
166#define GL_TEXTURE_CUBE_MAP               0x8513
167#define GL_TEXTURE_BINDING_CUBE_MAP       0x8514
168#define GL_TEXTURE_CUBE_MAP_POSITIVE_X    0x8515
169#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X    0x8516
170#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y    0x8517
171#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y    0x8518
172#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z    0x8519
173#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z    0x851A
174#define GL_PROXY_TEXTURE_CUBE_MAP         0x851B
175#define GL_MAX_CUBE_MAP_TEXTURE_SIZE      0x851C
176#define GL_COMPRESSED_RGB                 0x84ED
177#define GL_COMPRESSED_RGBA                0x84EE
178#define GL_TEXTURE_COMPRESSION_HINT       0x84EF
179#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE  0x86A0
180#define GL_TEXTURE_COMPRESSED             0x86A1
181#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
182#define GL_COMPRESSED_TEXTURE_FORMATS     0x86A3
183#define GL_CLAMP_TO_BORDER                0x812D
184#define GL_CLIENT_ACTIVE_TEXTURE          0x84E1
185#define GL_MAX_TEXTURE_UNITS              0x84E2
186#define GL_TRANSPOSE_MODELVIEW_MATRIX     0x84E3
187#define GL_TRANSPOSE_PROJECTION_MATRIX    0x84E4
188#define GL_TRANSPOSE_TEXTURE_MATRIX       0x84E5
189#define GL_TRANSPOSE_COLOR_MATRIX         0x84E6
190#define GL_MULTISAMPLE_BIT                0x20000000
191#define GL_NORMAL_MAP                     0x8511
192#define GL_REFLECTION_MAP                 0x8512
193#define GL_COMPRESSED_ALPHA               0x84E9
194#define GL_COMPRESSED_LUMINANCE           0x84EA
195#define GL_COMPRESSED_LUMINANCE_ALPHA     0x84EB
196#define GL_COMPRESSED_INTENSITY           0x84EC
197#define GL_COMBINE                        0x8570
198#define GL_COMBINE_RGB                    0x8571
199#define GL_COMBINE_ALPHA                  0x8572
200#define GL_SOURCE0_RGB                    0x8580
201#define GL_SOURCE1_RGB                    0x8581
202#define GL_SOURCE2_RGB                    0x8582
203#define GL_SOURCE0_ALPHA                  0x8588
204#define GL_SOURCE1_ALPHA                  0x8589
205#define GL_SOURCE2_ALPHA                  0x858A
206#define GL_OPERAND0_RGB                   0x8590
207#define GL_OPERAND1_RGB                   0x8591
208#define GL_OPERAND2_RGB                   0x8592
209#define GL_OPERAND0_ALPHA                 0x8598
210#define GL_OPERAND1_ALPHA                 0x8599
211#define GL_OPERAND2_ALPHA                 0x859A
212#define GL_RGB_SCALE                      0x8573
213#define GL_ADD_SIGNED                     0x8574
214#define GL_INTERPOLATE                    0x8575
215#define GL_SUBTRACT                       0x84E7
216#define GL_CONSTANT                       0x8576
217#define GL_PRIMARY_COLOR                  0x8577
218#define GL_PREVIOUS                       0x8578
219#define GL_DOT3_RGB                       0x86AE
220#define GL_DOT3_RGBA                      0x86AF
221typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
222typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
223typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
224typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
225typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
226typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
227typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
228typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
229typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img);
230typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
231typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);
232typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);
233typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);
234typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);
235typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);
236typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);
237typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);
238typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);
239typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);
240typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);
241typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
242typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);
243typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);
244typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);
245typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);
246typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);
247typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
248typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);
249typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
250typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);
251typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);
252typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);
253typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
254typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);
255typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
256typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);
257typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
258typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);
259typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
260typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);
261typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
262typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);
263typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m);
264typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m);
265typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m);
266typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m);
267#ifdef GL_GLEXT_PROTOTYPES
268GLAPI void APIENTRY glActiveTexture (GLenum texture);
269GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
270GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
271GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
272GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
273GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
274GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
275GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
276GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, void *img);
277GLAPI void APIENTRY glClientActiveTexture (GLenum texture);
278GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s);
279GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v);
280GLAPI void APIENTRY glMultiTexCoord1f (GLenum target, GLfloat s);
281GLAPI void APIENTRY glMultiTexCoord1fv (GLenum target, const GLfloat *v);
282GLAPI void APIENTRY glMultiTexCoord1i (GLenum target, GLint s);
283GLAPI void APIENTRY glMultiTexCoord1iv (GLenum target, const GLint *v);
284GLAPI void APIENTRY glMultiTexCoord1s (GLenum target, GLshort s);
285GLAPI void APIENTRY glMultiTexCoord1sv (GLenum target, const GLshort *v);
286GLAPI void APIENTRY glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t);
287GLAPI void APIENTRY glMultiTexCoord2dv (GLenum target, const GLdouble *v);
288GLAPI void APIENTRY glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t);
289GLAPI void APIENTRY glMultiTexCoord2fv (GLenum target, const GLfloat *v);
290GLAPI void APIENTRY glMultiTexCoord2i (GLenum target, GLint s, GLint t);
291GLAPI void APIENTRY glMultiTexCoord2iv (GLenum target, const GLint *v);
292GLAPI void APIENTRY glMultiTexCoord2s (GLenum target, GLshort s, GLshort t);
293GLAPI void APIENTRY glMultiTexCoord2sv (GLenum target, const GLshort *v);
294GLAPI void APIENTRY glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r);
295GLAPI void APIENTRY glMultiTexCoord3dv (GLenum target, const GLdouble *v);
296GLAPI void APIENTRY glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r);
297GLAPI void APIENTRY glMultiTexCoord3fv (GLenum target, const GLfloat *v);
298GLAPI void APIENTRY glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r);
299GLAPI void APIENTRY glMultiTexCoord3iv (GLenum target, const GLint *v);
300GLAPI void APIENTRY glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r);
301GLAPI void APIENTRY glMultiTexCoord3sv (GLenum target, const GLshort *v);
302GLAPI void APIENTRY glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
303GLAPI void APIENTRY glMultiTexCoord4dv (GLenum target, const GLdouble *v);
304GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
305GLAPI void APIENTRY glMultiTexCoord4fv (GLenum target, const GLfloat *v);
306GLAPI void APIENTRY glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q);
307GLAPI void APIENTRY glMultiTexCoord4iv (GLenum target, const GLint *v);
308GLAPI void APIENTRY glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
309GLAPI void APIENTRY glMultiTexCoord4sv (GLenum target, const GLshort *v);
310GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *m);
311GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m);
312GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m);
313GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m);
314#endif
315#endif /* GL_VERSION_1_3 */
316
317#ifndef GL_VERSION_1_4
318#define GL_VERSION_1_4 1
319#define GL_BLEND_DST_RGB                  0x80C8
320#define GL_BLEND_SRC_RGB                  0x80C9
321#define GL_BLEND_DST_ALPHA                0x80CA
322#define GL_BLEND_SRC_ALPHA                0x80CB
323#define GL_POINT_FADE_THRESHOLD_SIZE      0x8128
324#define GL_DEPTH_COMPONENT16              0x81A5
325#define GL_DEPTH_COMPONENT24              0x81A6
326#define GL_DEPTH_COMPONENT32              0x81A7
327#define GL_MIRRORED_REPEAT                0x8370
328#define GL_MAX_TEXTURE_LOD_BIAS           0x84FD
329#define GL_TEXTURE_LOD_BIAS               0x8501
330#define GL_INCR_WRAP                      0x8507
331#define GL_DECR_WRAP                      0x8508
332#define GL_TEXTURE_DEPTH_SIZE             0x884A
333#define GL_TEXTURE_COMPARE_MODE           0x884C
334#define GL_TEXTURE_COMPARE_FUNC           0x884D
335#define GL_POINT_SIZE_MIN                 0x8126
336#define GL_POINT_SIZE_MAX                 0x8127
337#define GL_POINT_DISTANCE_ATTENUATION     0x8129
338#define GL_GENERATE_MIPMAP                0x8191
339#define GL_GENERATE_MIPMAP_HINT           0x8192
340#define GL_FOG_COORDINATE_SOURCE          0x8450
341#define GL_FOG_COORDINATE                 0x8451
342#define GL_FRAGMENT_DEPTH                 0x8452
343#define GL_CURRENT_FOG_COORDINATE         0x8453
344#define GL_FOG_COORDINATE_ARRAY_TYPE      0x8454
345#define GL_FOG_COORDINATE_ARRAY_STRIDE    0x8455
346#define GL_FOG_COORDINATE_ARRAY_POINTER   0x8456
347#define GL_FOG_COORDINATE_ARRAY           0x8457
348#define GL_COLOR_SUM                      0x8458
349#define GL_CURRENT_SECONDARY_COLOR        0x8459
350#define GL_SECONDARY_COLOR_ARRAY_SIZE     0x845A
351#define GL_SECONDARY_COLOR_ARRAY_TYPE     0x845B
352#define GL_SECONDARY_COLOR_ARRAY_STRIDE   0x845C
353#define GL_SECONDARY_COLOR_ARRAY_POINTER  0x845D
354#define GL_SECONDARY_COLOR_ARRAY          0x845E
355#define GL_TEXTURE_FILTER_CONTROL         0x8500
356#define GL_DEPTH_TEXTURE_MODE             0x884B
357#define GL_COMPARE_R_TO_TEXTURE           0x884E
358#define GL_FUNC_ADD                       0x8006
359#define GL_FUNC_SUBTRACT                  0x800A
360#define GL_FUNC_REVERSE_SUBTRACT          0x800B
361#define GL_MIN                            0x8007
362#define GL_MAX                            0x8008
363#define GL_CONSTANT_COLOR                 0x8001
364#define GL_ONE_MINUS_CONSTANT_COLOR       0x8002
365#define GL_CONSTANT_ALPHA                 0x8003
366#define GL_ONE_MINUS_CONSTANT_ALPHA       0x8004
367typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
368typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
369typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);
370typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
371typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
372typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
373typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
374typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord);
375typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord);
376typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord);
377typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord);
378typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const void *pointer);
379typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);
380typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);
381typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);
382typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v);
383typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue);
384typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);
385typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue);
386typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v);
387typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue);
388typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v);
389typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue);
390typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v);
391typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue);
392typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v);
393typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue);
394typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v);
395typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
396typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y);
397typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v);
398typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y);
399typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v);
400typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y);
401typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v);
402typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y);
403typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v);
404typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z);
405typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v);
406typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z);
407typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v);
408typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z);
409typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v);
410typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z);
411typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v);
412typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
413typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
414#ifdef GL_GLEXT_PROTOTYPES
415GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
416GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
417GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);
418GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param);
419GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
420GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param);
421GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params);
422GLAPI void APIENTRY glFogCoordf (GLfloat coord);
423GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord);
424GLAPI void APIENTRY glFogCoordd (GLdouble coord);
425GLAPI void APIENTRY glFogCoorddv (const GLdouble *coord);
426GLAPI void APIENTRY glFogCoordPointer (GLenum type, GLsizei stride, const void *pointer);
427GLAPI void APIENTRY glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue);
428GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *v);
429GLAPI void APIENTRY glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue);
430GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *v);
431GLAPI void APIENTRY glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue);
432GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *v);
433GLAPI void APIENTRY glSecondaryColor3i (GLint red, GLint green, GLint blue);
434GLAPI void APIENTRY glSecondaryColor3iv (const GLint *v);
435GLAPI void APIENTRY glSecondaryColor3s (GLshort red, GLshort green, GLshort blue);
436GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *v);
437GLAPI void APIENTRY glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue);
438GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *v);
439GLAPI void APIENTRY glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue);
440GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *v);
441GLAPI void APIENTRY glSecondaryColor3us (GLushort red, GLushort green, GLushort blue);
442GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *v);
443GLAPI void APIENTRY glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
444GLAPI void APIENTRY glWindowPos2d (GLdouble x, GLdouble y);
445GLAPI void APIENTRY glWindowPos2dv (const GLdouble *v);
446GLAPI void APIENTRY glWindowPos2f (GLfloat x, GLfloat y);
447GLAPI void APIENTRY glWindowPos2fv (const GLfloat *v);
448GLAPI void APIENTRY glWindowPos2i (GLint x, GLint y);
449GLAPI void APIENTRY glWindowPos2iv (const GLint *v);
450GLAPI void APIENTRY glWindowPos2s (GLshort x, GLshort y);
451GLAPI void APIENTRY glWindowPos2sv (const GLshort *v);
452GLAPI void APIENTRY glWindowPos3d (GLdouble x, GLdouble y, GLdouble z);
453GLAPI void APIENTRY glWindowPos3dv (const GLdouble *v);
454GLAPI void APIENTRY glWindowPos3f (GLfloat x, GLfloat y, GLfloat z);
455GLAPI void APIENTRY glWindowPos3fv (const GLfloat *v);
456GLAPI void APIENTRY glWindowPos3i (GLint x, GLint y, GLint z);
457GLAPI void APIENTRY glWindowPos3iv (const GLint *v);
458GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z);
459GLAPI void APIENTRY glWindowPos3sv (const GLshort *v);
460GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
461GLAPI void APIENTRY glBlendEquation (GLenum mode);
462#endif
463#endif /* GL_VERSION_1_4 */
464
465#ifndef GL_VERSION_1_5
466#define GL_VERSION_1_5 1
467#include <stddef.h>
468typedef ptrdiff_t GLsizeiptr;
469typedef ptrdiff_t GLintptr;
470#define GL_BUFFER_SIZE                    0x8764
471#define GL_BUFFER_USAGE                   0x8765
472#define GL_QUERY_COUNTER_BITS             0x8864
473#define GL_CURRENT_QUERY                  0x8865
474#define GL_QUERY_RESULT                   0x8866
475#define GL_QUERY_RESULT_AVAILABLE         0x8867
476#define GL_ARRAY_BUFFER                   0x8892
477#define GL_ELEMENT_ARRAY_BUFFER           0x8893
478#define GL_ARRAY_BUFFER_BINDING           0x8894
479#define GL_ELEMENT_ARRAY_BUFFER_BINDING   0x8895
480#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
481#define GL_READ_ONLY                      0x88B8
482#define GL_WRITE_ONLY                     0x88B9
483#define GL_READ_WRITE                     0x88BA
484#define GL_BUFFER_ACCESS                  0x88BB
485#define GL_BUFFER_MAPPED                  0x88BC
486#define GL_BUFFER_MAP_POINTER             0x88BD
487#define GL_STREAM_DRAW                    0x88E0
488#define GL_STREAM_READ                    0x88E1
489#define GL_STREAM_COPY                    0x88E2
490#define GL_STATIC_DRAW                    0x88E4
491#define GL_STATIC_READ                    0x88E5
492#define GL_STATIC_COPY                    0x88E6
493#define GL_DYNAMIC_DRAW                   0x88E8
494#define GL_DYNAMIC_READ                   0x88E9
495#define GL_DYNAMIC_COPY                   0x88EA
496#define GL_SAMPLES_PASSED                 0x8914
497#define GL_SRC1_ALPHA                     0x8589
498#define GL_VERTEX_ARRAY_BUFFER_BINDING    0x8896
499#define GL_NORMAL_ARRAY_BUFFER_BINDING    0x8897
500#define GL_COLOR_ARRAY_BUFFER_BINDING     0x8898
501#define GL_INDEX_ARRAY_BUFFER_BINDING     0x8899
502#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
503#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
504#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
505#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
506#define GL_WEIGHT_ARRAY_BUFFER_BINDING    0x889E
507#define GL_FOG_COORD_SRC                  0x8450
508#define GL_FOG_COORD                      0x8451
509#define GL_CURRENT_FOG_COORD              0x8453
510#define GL_FOG_COORD_ARRAY_TYPE           0x8454
511#define GL_FOG_COORD_ARRAY_STRIDE         0x8455
512#define GL_FOG_COORD_ARRAY_POINTER        0x8456
513#define GL_FOG_COORD_ARRAY                0x8457
514#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D
515#define GL_SRC0_RGB                       0x8580
516#define GL_SRC1_RGB                       0x8581
517#define GL_SRC2_RGB                       0x8582
518#define GL_SRC0_ALPHA                     0x8588
519#define GL_SRC2_ALPHA                     0x858A
520typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
521typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
522typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id);
523typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
524typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
525typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
526typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params);
527typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
528typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
529typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
530typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
531typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
532typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
533typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
534typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data);
535typedef void *(APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);
536typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
537typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
538typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params);
539#ifdef GL_GLEXT_PROTOTYPES
540GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids);
541GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
542GLAPI GLboolean APIENTRY glIsQuery (GLuint id);
543GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id);
544GLAPI void APIENTRY glEndQuery (GLenum target);
545GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
546GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params);
547GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
548GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
549GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
550GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
551GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer);
552GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
553GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
554GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, void *data);
555GLAPI void *APIENTRY glMapBuffer (GLenum target, GLenum access);
556GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target);
557GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
558GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
559#endif
560#endif /* GL_VERSION_1_5 */
561
562#ifndef GL_VERSION_2_0
563#define GL_VERSION_2_0 1
564typedef char GLchar;
565#define GL_BLEND_EQUATION_RGB             0x8009
566#define GL_VERTEX_ATTRIB_ARRAY_ENABLED    0x8622
567#define GL_VERTEX_ATTRIB_ARRAY_SIZE       0x8623
568#define GL_VERTEX_ATTRIB_ARRAY_STRIDE     0x8624
569#define GL_VERTEX_ATTRIB_ARRAY_TYPE       0x8625
570#define GL_CURRENT_VERTEX_ATTRIB          0x8626
571#define GL_VERTEX_PROGRAM_POINT_SIZE      0x8642
572#define GL_VERTEX_ATTRIB_ARRAY_POINTER    0x8645
573#define GL_STENCIL_BACK_FUNC              0x8800
574#define GL_STENCIL_BACK_FAIL              0x8801
575#define GL_STENCIL_BACK_PASS_DEPTH_FAIL   0x8802
576#define GL_STENCIL_BACK_PASS_DEPTH_PASS   0x8803
577#define GL_MAX_DRAW_BUFFERS               0x8824
578#define GL_DRAW_BUFFER0                   0x8825
579#define GL_DRAW_BUFFER1                   0x8826
580#define GL_DRAW_BUFFER2                   0x8827
581#define GL_DRAW_BUFFER3                   0x8828
582#define GL_DRAW_BUFFER4                   0x8829
583#define GL_DRAW_BUFFER5                   0x882A
584#define GL_DRAW_BUFFER6                   0x882B
585#define GL_DRAW_BUFFER7                   0x882C
586#define GL_DRAW_BUFFER8                   0x882D
587#define GL_DRAW_BUFFER9                   0x882E
588#define GL_DRAW_BUFFER10                  0x882F
589#define GL_DRAW_BUFFER11                  0x8830
590#define GL_DRAW_BUFFER12                  0x8831
591#define GL_DRAW_BUFFER13                  0x8832
592#define GL_DRAW_BUFFER14                  0x8833
593#define GL_DRAW_BUFFER15                  0x8834
594#define GL_BLEND_EQUATION_ALPHA           0x883D
595#define GL_MAX_VERTEX_ATTRIBS             0x8869
596#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
597#define GL_MAX_TEXTURE_IMAGE_UNITS        0x8872
598#define GL_FRAGMENT_SHADER                0x8B30
599#define GL_VERTEX_SHADER                  0x8B31
600#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
601#define GL_MAX_VERTEX_UNIFORM_COMPONENTS  0x8B4A
602#define GL_MAX_VARYING_FLOATS             0x8B4B
603#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
604#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
605#define GL_SHADER_TYPE                    0x8B4F
606#define GL_FLOAT_VEC2                     0x8B50
607#define GL_FLOAT_VEC3                     0x8B51
608#define GL_FLOAT_VEC4                     0x8B52
609#define GL_INT_VEC2                       0x8B53
610#define GL_INT_VEC3                       0x8B54
611#define GL_INT_VEC4                       0x8B55
612#define GL_BOOL                           0x8B56
613#define GL_BOOL_VEC2                      0x8B57
614#define GL_BOOL_VEC3                      0x8B58
615#define GL_BOOL_VEC4                      0x8B59
616#define GL_FLOAT_MAT2                     0x8B5A
617#define GL_FLOAT_MAT3                     0x8B5B
618#define GL_FLOAT_MAT4                     0x8B5C
619#define GL_SAMPLER_1D                     0x8B5D
620#define GL_SAMPLER_2D                     0x8B5E
621#define GL_SAMPLER_3D                     0x8B5F
622#define GL_SAMPLER_CUBE                   0x8B60
623#define GL_SAMPLER_1D_SHADOW              0x8B61
624#define GL_SAMPLER_2D_SHADOW              0x8B62
625#define GL_DELETE_STATUS                  0x8B80
626#define GL_COMPILE_STATUS                 0x8B81
627#define GL_LINK_STATUS                    0x8B82
628#define GL_VALIDATE_STATUS                0x8B83
629#define GL_INFO_LOG_LENGTH                0x8B84
630#define GL_ATTACHED_SHADERS               0x8B85
631#define GL_ACTIVE_UNIFORMS                0x8B86
632#define GL_ACTIVE_UNIFORM_MAX_LENGTH      0x8B87
633#define GL_SHADER_SOURCE_LENGTH           0x8B88
634#define GL_ACTIVE_ATTRIBUTES              0x8B89
635#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH    0x8B8A
636#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
637#define GL_SHADING_LANGUAGE_VERSION       0x8B8C
638#define GL_CURRENT_PROGRAM                0x8B8D
639#define GL_POINT_SPRITE_COORD_ORIGIN      0x8CA0
640#define GL_LOWER_LEFT                     0x8CA1
641#define GL_UPPER_LEFT                     0x8CA2
642#define GL_STENCIL_BACK_REF               0x8CA3
643#define GL_STENCIL_BACK_VALUE_MASK        0x8CA4
644#define GL_STENCIL_BACK_WRITEMASK         0x8CA5
645#define GL_VERTEX_PROGRAM_TWO_SIDE        0x8643
646#define GL_POINT_SPRITE                   0x8861
647#define GL_COORD_REPLACE                  0x8862
648#define GL_MAX_TEXTURE_COORDS             0x8871
649typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
650typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
651typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
652typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
653typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
654typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
655typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
656typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
657typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
658typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
659typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
660typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
661typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
662typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
663typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
664typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
665typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
666typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
667typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
668typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
669typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
670typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
671typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
672typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
673typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
674typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
675typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
676typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params);
677typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
678typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
679typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
680typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
681typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
682typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
683typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
684typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
685typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
686typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
687typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
688typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
689typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
690typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
691typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
692typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
693typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
694typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
695typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
696typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
697typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
698typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
699typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
700typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
701typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
702typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
703typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
704typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
705typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);
706typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v);
707typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
708typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
709typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);
710typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v);
711typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);
712typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v);
713typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
714typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
715typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);
716typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v);
717typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
718typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v);
719typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
720typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
721typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
722typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v);
723typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v);
724typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v);
725typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v);
726typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
727typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v);
728typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v);
729typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v);
730typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v);
731typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
732typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v);
733typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
734typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
735typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v);
736typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
737typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v);
738typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v);
739typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v);
740typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v);
741typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
742#ifdef GL_GLEXT_PROTOTYPES
743GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
744GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
745GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
746GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
747GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
748GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader);
749GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
750GLAPI void APIENTRY glCompileShader (GLuint shader);
751GLAPI GLuint APIENTRY glCreateProgram (void);
752GLAPI GLuint APIENTRY glCreateShader (GLenum type);
753GLAPI void APIENTRY glDeleteProgram (GLuint program);
754GLAPI void APIENTRY glDeleteShader (GLuint shader);
755GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader);
756GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index);
757GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index);
758GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
759GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
760GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
761GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
762GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
763GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
764GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
765GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
766GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
767GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
768GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
769GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
770GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params);
771GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
772GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
773GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
774GLAPI GLboolean APIENTRY glIsProgram (GLuint program);
775GLAPI GLboolean APIENTRY glIsShader (GLuint shader);
776GLAPI void APIENTRY glLinkProgram (GLuint program);
777GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
778GLAPI void APIENTRY glUseProgram (GLuint program);
779GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0);
780GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
781GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
782GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
783GLAPI void APIENTRY glUniform1i (GLint location, GLint v0);
784GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
785GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
786GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
787GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
788GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
789GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
790GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
791GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
792GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
793GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
794GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
795GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
796GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
797GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
798GLAPI void APIENTRY glValidateProgram (GLuint program);
799GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x);
800GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v);
801GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
802GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
803GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x);
804GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v);
805GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y);
806GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v);
807GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
808GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
809GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y);
810GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v);
811GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
812GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v);
813GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
814GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
815GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z);
816GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v);
817GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v);
818GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v);
819GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v);
820GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
821GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v);
822GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v);
823GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v);
824GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v);
825GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
826GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v);
827GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
828GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
829GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v);
830GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
831GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v);
832GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v);
833GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v);
834GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v);
835GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
836#endif
837#endif /* GL_VERSION_2_0 */
838
839#ifndef GL_VERSION_2_1
840#define GL_VERSION_2_1 1
841#define GL_PIXEL_PACK_BUFFER              0x88EB
842#define GL_PIXEL_UNPACK_BUFFER            0x88EC
843#define GL_PIXEL_PACK_BUFFER_BINDING      0x88ED
844#define GL_PIXEL_UNPACK_BUFFER_BINDING    0x88EF
845#define GL_FLOAT_MAT2x3                   0x8B65
846#define GL_FLOAT_MAT2x4                   0x8B66
847#define GL_FLOAT_MAT3x2                   0x8B67
848#define GL_FLOAT_MAT3x4                   0x8B68
849#define GL_FLOAT_MAT4x2                   0x8B69
850#define GL_FLOAT_MAT4x3                   0x8B6A
851#define GL_SRGB                           0x8C40
852#define GL_SRGB8                          0x8C41
853#define GL_SRGB_ALPHA                     0x8C42
854#define GL_SRGB8_ALPHA8                   0x8C43
855#define GL_COMPRESSED_SRGB                0x8C48
856#define GL_COMPRESSED_SRGB_ALPHA          0x8C49
857#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F
858#define GL_SLUMINANCE_ALPHA               0x8C44
859#define GL_SLUMINANCE8_ALPHA8             0x8C45
860#define GL_SLUMINANCE                     0x8C46
861#define GL_SLUMINANCE8                    0x8C47
862#define GL_COMPRESSED_SLUMINANCE          0x8C4A
863#define GL_COMPRESSED_SLUMINANCE_ALPHA    0x8C4B
864typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
865typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
866typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
867typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
868typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
869typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
870#ifdef GL_GLEXT_PROTOTYPES
871GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
872GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
873GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
874GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
875GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
876GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
877#endif
878#endif /* GL_VERSION_2_1 */
879
880#ifndef GL_VERSION_3_0
881#define GL_VERSION_3_0 1
882typedef unsigned short GLhalf;
883#define GL_COMPARE_REF_TO_TEXTURE         0x884E
884#define GL_CLIP_DISTANCE0                 0x3000
885#define GL_CLIP_DISTANCE1                 0x3001
886#define GL_CLIP_DISTANCE2                 0x3002
887#define GL_CLIP_DISTANCE3                 0x3003
888#define GL_CLIP_DISTANCE4                 0x3004
889#define GL_CLIP_DISTANCE5                 0x3005
890#define GL_CLIP_DISTANCE6                 0x3006
891#define GL_CLIP_DISTANCE7                 0x3007
892#define GL_MAX_CLIP_DISTANCES             0x0D32
893#define GL_MAJOR_VERSION                  0x821B
894#define GL_MINOR_VERSION                  0x821C
895#define GL_NUM_EXTENSIONS                 0x821D
896#define GL_CONTEXT_FLAGS                  0x821E
897#define GL_COMPRESSED_RED                 0x8225
898#define GL_COMPRESSED_RG                  0x8226
899#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
900#define GL_RGBA32F                        0x8814
901#define GL_RGB32F                         0x8815
902#define GL_RGBA16F                        0x881A
903#define GL_RGB16F                         0x881B
904#define GL_VERTEX_ATTRIB_ARRAY_INTEGER    0x88FD
905#define GL_MAX_ARRAY_TEXTURE_LAYERS       0x88FF
906#define GL_MIN_PROGRAM_TEXEL_OFFSET       0x8904
907#define GL_MAX_PROGRAM_TEXEL_OFFSET       0x8905
908#define GL_CLAMP_READ_COLOR               0x891C
909#define GL_FIXED_ONLY                     0x891D
910#define GL_MAX_VARYING_COMPONENTS         0x8B4B
911#define GL_TEXTURE_1D_ARRAY               0x8C18
912#define GL_PROXY_TEXTURE_1D_ARRAY         0x8C19
913#define GL_TEXTURE_2D_ARRAY               0x8C1A
914#define GL_PROXY_TEXTURE_2D_ARRAY         0x8C1B
915#define GL_TEXTURE_BINDING_1D_ARRAY       0x8C1C
916#define GL_TEXTURE_BINDING_2D_ARRAY       0x8C1D
917#define GL_R11F_G11F_B10F                 0x8C3A
918#define GL_UNSIGNED_INT_10F_11F_11F_REV   0x8C3B
919#define GL_RGB9_E5                        0x8C3D
920#define GL_UNSIGNED_INT_5_9_9_9_REV       0x8C3E
921#define GL_TEXTURE_SHARED_SIZE            0x8C3F
922#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
923#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
924#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
925#define GL_TRANSFORM_FEEDBACK_VARYINGS    0x8C83
926#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
927#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
928#define GL_PRIMITIVES_GENERATED           0x8C87
929#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
930#define GL_RASTERIZER_DISCARD             0x8C89
931#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
932#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
933#define GL_INTERLEAVED_ATTRIBS            0x8C8C
934#define GL_SEPARATE_ATTRIBS               0x8C8D
935#define GL_TRANSFORM_FEEDBACK_BUFFER      0x8C8E
936#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
937#define GL_RGBA32UI                       0x8D70
938#define GL_RGB32UI                        0x8D71
939#define GL_RGBA16UI                       0x8D76
940#define GL_RGB16UI                        0x8D77
941#define GL_RGBA8UI                        0x8D7C
942#define GL_RGB8UI                         0x8D7D
943#define GL_RGBA32I                        0x8D82
944#define GL_RGB32I                         0x8D83
945#define GL_RGBA16I                        0x8D88
946#define GL_RGB16I                         0x8D89
947#define GL_RGBA8I                         0x8D8E
948#define GL_RGB8I                          0x8D8F
949#define GL_RED_INTEGER                    0x8D94
950#define GL_GREEN_INTEGER                  0x8D95
951#define GL_BLUE_INTEGER                   0x8D96
952#define GL_RGB_INTEGER                    0x8D98
953#define GL_RGBA_INTEGER                   0x8D99
954#define GL_BGR_INTEGER                    0x8D9A
955#define GL_BGRA_INTEGER                   0x8D9B
956#define GL_SAMPLER_1D_ARRAY               0x8DC0
957#define GL_SAMPLER_2D_ARRAY               0x8DC1
958#define GL_SAMPLER_1D_ARRAY_SHADOW        0x8DC3
959#define GL_SAMPLER_2D_ARRAY_SHADOW        0x8DC4
960#define GL_SAMPLER_CUBE_SHADOW            0x8DC5
961#define GL_UNSIGNED_INT_VEC2              0x8DC6
962#define GL_UNSIGNED_INT_VEC3              0x8DC7
963#define GL_UNSIGNED_INT_VEC4              0x8DC8
964#define GL_INT_SAMPLER_1D                 0x8DC9
965#define GL_INT_SAMPLER_2D                 0x8DCA
966#define GL_INT_SAMPLER_3D                 0x8DCB
967#define GL_INT_SAMPLER_CUBE               0x8DCC
968#define GL_INT_SAMPLER_1D_ARRAY           0x8DCE
969#define GL_INT_SAMPLER_2D_ARRAY           0x8DCF
970#define GL_UNSIGNED_INT_SAMPLER_1D        0x8DD1
971#define GL_UNSIGNED_INT_SAMPLER_2D        0x8DD2
972#define GL_UNSIGNED_INT_SAMPLER_3D        0x8DD3
973#define GL_UNSIGNED_INT_SAMPLER_CUBE      0x8DD4
974#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY  0x8DD6
975#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY  0x8DD7
976#define GL_QUERY_WAIT                     0x8E13
977#define GL_QUERY_NO_WAIT                  0x8E14
978#define GL_QUERY_BY_REGION_WAIT           0x8E15
979#define GL_QUERY_BY_REGION_NO_WAIT        0x8E16
980#define GL_BUFFER_ACCESS_FLAGS            0x911F
981#define GL_BUFFER_MAP_LENGTH              0x9120
982#define GL_BUFFER_MAP_OFFSET              0x9121
983#define GL_DEPTH_COMPONENT32F             0x8CAC
984#define GL_DEPTH32F_STENCIL8              0x8CAD
985#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
986#define GL_INVALID_FRAMEBUFFER_OPERATION  0x0506
987#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
988#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
989#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
990#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
991#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
992#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
993#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
994#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
995#define GL_FRAMEBUFFER_DEFAULT            0x8218
996#define GL_FRAMEBUFFER_UNDEFINED          0x8219
997#define GL_DEPTH_STENCIL_ATTACHMENT       0x821A
998#define GL_MAX_RENDERBUFFER_SIZE          0x84E8
999#define GL_DEPTH_STENCIL                  0x84F9
1000#define GL_UNSIGNED_INT_24_8              0x84FA
1001#define GL_DEPTH24_STENCIL8               0x88F0
1002#define GL_TEXTURE_STENCIL_SIZE           0x88F1
1003#define GL_TEXTURE_RED_TYPE               0x8C10
1004#define GL_TEXTURE_GREEN_TYPE             0x8C11
1005#define GL_TEXTURE_BLUE_TYPE              0x8C12
1006#define GL_TEXTURE_ALPHA_TYPE             0x8C13
1007#define GL_TEXTURE_DEPTH_TYPE             0x8C16
1008#define GL_UNSIGNED_NORMALIZED            0x8C17
1009#define GL_FRAMEBUFFER_BINDING            0x8CA6
1010#define GL_DRAW_FRAMEBUFFER_BINDING       0x8CA6
1011#define GL_RENDERBUFFER_BINDING           0x8CA7
1012#define GL_READ_FRAMEBUFFER               0x8CA8
1013#define GL_DRAW_FRAMEBUFFER               0x8CA9
1014#define GL_READ_FRAMEBUFFER_BINDING       0x8CAA
1015#define GL_RENDERBUFFER_SAMPLES           0x8CAB
1016#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
1017#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
1018#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
1019#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
1020#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
1021#define GL_FRAMEBUFFER_COMPLETE           0x8CD5
1022#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
1023#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
1024#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
1025#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
1026#define GL_FRAMEBUFFER_UNSUPPORTED        0x8CDD
1027#define GL_MAX_COLOR_ATTACHMENTS          0x8CDF
1028#define GL_COLOR_ATTACHMENT0              0x8CE0
1029#define GL_COLOR_ATTACHMENT1              0x8CE1
1030#define GL_COLOR_ATTACHMENT2              0x8CE2
1031#define GL_COLOR_ATTACHMENT3              0x8CE3
1032#define GL_COLOR_ATTACHMENT4              0x8CE4
1033#define GL_COLOR_ATTACHMENT5              0x8CE5
1034#define GL_COLOR_ATTACHMENT6              0x8CE6
1035#define GL_COLOR_ATTACHMENT7              0x8CE7
1036#define GL_COLOR_ATTACHMENT8              0x8CE8
1037#define GL_COLOR_ATTACHMENT9              0x8CE9
1038#define GL_COLOR_ATTACHMENT10             0x8CEA
1039#define GL_COLOR_ATTACHMENT11             0x8CEB
1040#define GL_COLOR_ATTACHMENT12             0x8CEC
1041#define GL_COLOR_ATTACHMENT13             0x8CED
1042#define GL_COLOR_ATTACHMENT14             0x8CEE
1043#define GL_COLOR_ATTACHMENT15             0x8CEF
1044#define GL_DEPTH_ATTACHMENT               0x8D00
1045#define GL_STENCIL_ATTACHMENT             0x8D20
1046#define GL_FRAMEBUFFER                    0x8D40
1047#define GL_RENDERBUFFER                   0x8D41
1048#define GL_RENDERBUFFER_WIDTH             0x8D42
1049#define GL_RENDERBUFFER_HEIGHT            0x8D43
1050#define GL_RENDERBUFFER_INTERNAL_FORMAT   0x8D44
1051#define GL_STENCIL_INDEX1                 0x8D46
1052#define GL_STENCIL_INDEX4                 0x8D47
1053#define GL_STENCIL_INDEX8                 0x8D48
1054#define GL_STENCIL_INDEX16                0x8D49
1055#define GL_RENDERBUFFER_RED_SIZE          0x8D50
1056#define GL_RENDERBUFFER_GREEN_SIZE        0x8D51
1057#define GL_RENDERBUFFER_BLUE_SIZE         0x8D52
1058#define GL_RENDERBUFFER_ALPHA_SIZE        0x8D53
1059#define GL_RENDERBUFFER_DEPTH_SIZE        0x8D54
1060#define GL_RENDERBUFFER_STENCIL_SIZE      0x8D55
1061#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
1062#define GL_MAX_SAMPLES                    0x8D57
1063#define GL_INDEX                          0x8222
1064#define GL_TEXTURE_LUMINANCE_TYPE         0x8C14
1065#define GL_TEXTURE_INTENSITY_TYPE         0x8C15
1066#define GL_FRAMEBUFFER_SRGB               0x8DB9
1067#define GL_HALF_FLOAT                     0x140B
1068#define GL_MAP_READ_BIT                   0x0001
1069#define GL_MAP_WRITE_BIT                  0x0002
1070#define GL_MAP_INVALIDATE_RANGE_BIT       0x0004
1071#define GL_MAP_INVALIDATE_BUFFER_BIT      0x0008
1072#define GL_MAP_FLUSH_EXPLICIT_BIT         0x0010
1073#define GL_MAP_UNSYNCHRONIZED_BIT         0x0020
1074#define GL_COMPRESSED_RED_RGTC1           0x8DBB
1075#define GL_COMPRESSED_SIGNED_RED_RGTC1    0x8DBC
1076#define GL_COMPRESSED_RG_RGTC2            0x8DBD
1077#define GL_COMPRESSED_SIGNED_RG_RGTC2     0x8DBE
1078#define GL_RG                             0x8227
1079#define GL_RG_INTEGER                     0x8228
1080#define GL_R8                             0x8229
1081#define GL_R16                            0x822A
1082#define GL_RG8                            0x822B
1083#define GL_RG16                           0x822C
1084#define GL_R16F                           0x822D
1085#define GL_R32F                           0x822E
1086#define GL_RG16F                          0x822F
1087#define GL_RG32F                          0x8230
1088#define GL_R8I                            0x8231
1089#define GL_R8UI                           0x8232
1090#define GL_R16I                           0x8233
1091#define GL_R16UI                          0x8234
1092#define GL_R32I                           0x8235
1093#define GL_R32UI                          0x8236
1094#define GL_RG8I                           0x8237
1095#define GL_RG8UI                          0x8238
1096#define GL_RG16I                          0x8239
1097#define GL_RG16UI                         0x823A
1098#define GL_RG32I                          0x823B
1099#define GL_RG32UI                         0x823C
1100#define GL_VERTEX_ARRAY_BINDING           0x85B5
1101#define GL_CLAMP_VERTEX_COLOR             0x891A
1102#define GL_CLAMP_FRAGMENT_COLOR           0x891B
1103#define GL_ALPHA_INTEGER                  0x8D97
1104typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
1105typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
1106typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
1107typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index);
1108typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index);
1109typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index);
1110typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
1111typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
1112typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
1113typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
1114typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
1115typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
1116typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);
1117typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);
1118typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void);
1119typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
1120typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
1121typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
1122typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x);
1123typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y);
1124typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z);
1125typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
1126typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x);
1127typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y);
1128typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
1129typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
1130typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v);
1131typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v);
1132typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v);
1133typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
1134typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v);
1135typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v);
1136typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v);
1137typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
1138typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v);
1139typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v);
1140typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v);
1141typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v);
1142typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
1143typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name);
1144typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
1145typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
1146typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
1147typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
1148typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
1149typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);
1150typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);
1151typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);
1152typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);
1153typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params);
1154typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params);
1155typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params);
1156typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params);
1157typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);
1158typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);
1159typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
1160typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
1161typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
1162typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
1163typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
1164typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
1165typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
1166typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
1167typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
1168typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
1169typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
1170typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
1171typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
1172typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
1173typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
1174typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
1175typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
1176typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
1177typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
1178typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
1179typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
1180typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
1181typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
1182typedef void *(APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
1183typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
1184typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
1185typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
1186typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
1187typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
1188#ifdef GL_GLEXT_PROTOTYPES
1189GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
1190GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
1191GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
1192GLAPI void APIENTRY glEnablei (GLenum target, GLuint index);
1193GLAPI void APIENTRY glDisablei (GLenum target, GLuint index);
1194GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index);
1195GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
1196GLAPI void APIENTRY glEndTransformFeedback (void);
1197GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
1198GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
1199GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
1200GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
1201GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp);
1202GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode);
1203GLAPI void APIENTRY glEndConditionalRender (void);
1204GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
1205GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
1206GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
1207GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x);
1208GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y);
1209GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z);
1210GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
1211GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x);
1212GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y);
1213GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z);
1214GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
1215GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v);
1216GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v);
1217GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v);
1218GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
1219GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v);
1220GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v);
1221GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v);
1222GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
1223GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v);
1224GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v);
1225GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v);
1226GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v);
1227GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
1228GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name);
1229GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
1230GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0);
1231GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
1232GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
1233GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
1234GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
1235GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
1236GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
1237GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
1238GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params);
1239GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params);
1240GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params);
1241GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params);
1242GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
1243GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
1244GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
1245GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
1246GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index);
1247GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer);
1248GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
1249GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
1250GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
1251GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
1252GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
1253GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer);
1254GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
1255GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
1256GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
1257GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target);
1258GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
1259GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
1260GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
1261GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
1262GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
1263GLAPI void APIENTRY glGenerateMipmap (GLenum target);
1264GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
1265GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
1266GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
1267GLAPI void *APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
1268GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
1269GLAPI void APIENTRY glBindVertexArray (GLuint array);
1270GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
1271GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
1272GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array);
1273#endif
1274#endif /* GL_VERSION_3_0 */
1275
1276#ifndef GL_VERSION_3_1
1277#define GL_VERSION_3_1 1
1278#define GL_SAMPLER_2D_RECT                0x8B63
1279#define GL_SAMPLER_2D_RECT_SHADOW         0x8B64
1280#define GL_SAMPLER_BUFFER                 0x8DC2
1281#define GL_INT_SAMPLER_2D_RECT            0x8DCD
1282#define GL_INT_SAMPLER_BUFFER             0x8DD0
1283#define GL_UNSIGNED_INT_SAMPLER_2D_RECT   0x8DD5
1284#define GL_UNSIGNED_INT_SAMPLER_BUFFER    0x8DD8
1285#define GL_TEXTURE_BUFFER                 0x8C2A
1286#define GL_MAX_TEXTURE_BUFFER_SIZE        0x8C2B
1287#define GL_TEXTURE_BINDING_BUFFER         0x8C2C
1288#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
1289#define GL_TEXTURE_RECTANGLE              0x84F5
1290#define GL_TEXTURE_BINDING_RECTANGLE      0x84F6
1291#define GL_PROXY_TEXTURE_RECTANGLE        0x84F7
1292#define GL_MAX_RECTANGLE_TEXTURE_SIZE     0x84F8
1293#define GL_R8_SNORM                       0x8F94
1294#define GL_RG8_SNORM                      0x8F95
1295#define GL_RGB8_SNORM                     0x8F96
1296#define GL_RGBA8_SNORM                    0x8F97
1297#define GL_R16_SNORM                      0x8F98
1298#define GL_RG16_SNORM                     0x8F99
1299#define GL_RGB16_SNORM                    0x8F9A
1300#define GL_RGBA16_SNORM                   0x8F9B
1301#define GL_SIGNED_NORMALIZED              0x8F9C
1302#define GL_PRIMITIVE_RESTART              0x8F9D
1303#define GL_PRIMITIVE_RESTART_INDEX        0x8F9E
1304#define GL_COPY_READ_BUFFER               0x8F36
1305#define GL_COPY_WRITE_BUFFER              0x8F37
1306#define GL_UNIFORM_BUFFER                 0x8A11
1307#define GL_UNIFORM_BUFFER_BINDING         0x8A28
1308#define GL_UNIFORM_BUFFER_START           0x8A29
1309#define GL_UNIFORM_BUFFER_SIZE            0x8A2A
1310#define GL_MAX_VERTEX_UNIFORM_BLOCKS      0x8A2B
1311#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS    0x8A2D
1312#define GL_MAX_COMBINED_UNIFORM_BLOCKS    0x8A2E
1313#define GL_MAX_UNIFORM_BUFFER_BINDINGS    0x8A2F
1314#define GL_MAX_UNIFORM_BLOCK_SIZE         0x8A30
1315#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
1316#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
1317#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
1318#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
1319#define GL_ACTIVE_UNIFORM_BLOCKS          0x8A36
1320#define GL_UNIFORM_TYPE                   0x8A37
1321#define GL_UNIFORM_SIZE                   0x8A38
1322#define GL_UNIFORM_NAME_LENGTH            0x8A39
1323#define GL_UNIFORM_BLOCK_INDEX            0x8A3A
1324#define GL_UNIFORM_OFFSET                 0x8A3B
1325#define GL_UNIFORM_ARRAY_STRIDE           0x8A3C
1326#define GL_UNIFORM_MATRIX_STRIDE          0x8A3D
1327#define GL_UNIFORM_IS_ROW_MAJOR           0x8A3E
1328#define GL_UNIFORM_BLOCK_BINDING          0x8A3F
1329#define GL_UNIFORM_BLOCK_DATA_SIZE        0x8A40
1330#define GL_UNIFORM_BLOCK_NAME_LENGTH      0x8A41
1331#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS  0x8A42
1332#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
1333#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
1334#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
1335#define GL_INVALID_INDEX                  0xFFFFFFFFu
1336typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
1337typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
1338typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer);
1339typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index);
1340typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
1341typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
1342typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
1343typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
1344typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
1345typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
1346typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
1347typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
1348#ifdef GL_GLEXT_PROTOTYPES
1349GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
1350GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
1351GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer);
1352GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index);
1353GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
1354GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
1355GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
1356GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
1357GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
1358GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
1359GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
1360GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
1361#endif
1362#endif /* GL_VERSION_3_1 */
1363
1364#ifndef GL_VERSION_3_2
1365#define GL_VERSION_3_2 1
1366typedef struct __GLsync *GLsync;
1367#ifndef GLEXT_64_TYPES_DEFINED
1368/* This code block is duplicated in glxext.h, so must be protected */
1369#define GLEXT_64_TYPES_DEFINED
1370/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
1371/* (as used in the GL_EXT_timer_query extension). */
1372#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
1373#include <inttypes.h>
1374#elif defined(__sun__) || defined(__digital__)
1375#include <inttypes.h>
1376#if defined(__STDC__)
1377#if defined(__arch64__) || defined(_LP64)
1378typedef long int int64_t;
1379typedef unsigned long int uint64_t;
1380#else
1381typedef long long int int64_t;
1382typedef unsigned long long int uint64_t;
1383#endif /* __arch64__ */
1384#endif /* __STDC__ */
1385#elif defined( __VMS ) || defined(__sgi)
1386#include <inttypes.h>
1387#elif defined(__SCO__) || defined(__USLC__)
1388#include <stdint.h>
1389#elif defined(__UNIXOS2__) || defined(__SOL64__)
1390typedef long int int32_t;
1391typedef long long int int64_t;
1392typedef unsigned long long int uint64_t;
1393#elif defined(_WIN32) && defined(__GNUC__)
1394#include <stdint.h>
1395#elif defined(_WIN32)
1396typedef __int32 int32_t;
1397typedef __int64 int64_t;
1398typedef unsigned __int64 uint64_t;
1399#else
1400/* Fallback if nothing above works */
1401#include <inttypes.h>
1402#endif
1403#endif
1404typedef uint64_t GLuint64;
1405typedef int64_t GLint64;
1406#define GL_CONTEXT_CORE_PROFILE_BIT       0x00000001
1407#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
1408#define GL_LINES_ADJACENCY                0x000A
1409#define GL_LINE_STRIP_ADJACENCY           0x000B
1410#define GL_TRIANGLES_ADJACENCY            0x000C
1411#define GL_TRIANGLE_STRIP_ADJACENCY       0x000D
1412#define GL_PROGRAM_POINT_SIZE             0x8642
1413#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29
1414#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7
1415#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
1416#define GL_GEOMETRY_SHADER                0x8DD9
1417#define GL_GEOMETRY_VERTICES_OUT          0x8916
1418#define GL_GEOMETRY_INPUT_TYPE            0x8917
1419#define GL_GEOMETRY_OUTPUT_TYPE           0x8918
1420#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF
1421#define GL_MAX_GEOMETRY_OUTPUT_VERTICES   0x8DE0
1422#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
1423#define GL_MAX_VERTEX_OUTPUT_COMPONENTS   0x9122
1424#define GL_MAX_GEOMETRY_INPUT_COMPONENTS  0x9123
1425#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124
1426#define GL_MAX_FRAGMENT_INPUT_COMPONENTS  0x9125
1427#define GL_CONTEXT_PROFILE_MASK           0x9126
1428#define GL_DEPTH_CLAMP                    0x864F
1429#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C
1430#define GL_FIRST_VERTEX_CONVENTION        0x8E4D
1431#define GL_LAST_VERTEX_CONVENTION         0x8E4E
1432#define GL_PROVOKING_VERTEX               0x8E4F
1433#define GL_TEXTURE_CUBE_MAP_SEAMLESS      0x884F
1434#define GL_MAX_SERVER_WAIT_TIMEOUT        0x9111
1435#define GL_OBJECT_TYPE                    0x9112
1436#define GL_SYNC_CONDITION                 0x9113
1437#define GL_SYNC_STATUS                    0x9114
1438#define GL_SYNC_FLAGS                     0x9115
1439#define GL_SYNC_FENCE                     0x9116
1440#define GL_SYNC_GPU_COMMANDS_COMPLETE     0x9117
1441#define GL_UNSIGNALED                     0x9118
1442#define GL_SIGNALED                       0x9119
1443#define GL_ALREADY_SIGNALED               0x911A
1444#define GL_TIMEOUT_EXPIRED                0x911B
1445#define GL_CONDITION_SATISFIED            0x911C
1446#define GL_WAIT_FAILED                    0x911D
1447#define GL_TIMEOUT_IGNORED                0xFFFFFFFFFFFFFFFFull
1448#define GL_SYNC_FLUSH_COMMANDS_BIT        0x00000001
1449#define GL_SAMPLE_POSITION                0x8E50
1450#define GL_SAMPLE_MASK                    0x8E51
1451#define GL_SAMPLE_MASK_VALUE              0x8E52
1452#define GL_MAX_SAMPLE_MASK_WORDS          0x8E59
1453#define GL_TEXTURE_2D_MULTISAMPLE         0x9100
1454#define GL_PROXY_TEXTURE_2D_MULTISAMPLE   0x9101
1455#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY   0x9102
1456#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103
1457#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
1458#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
1459#define GL_TEXTURE_SAMPLES                0x9106
1460#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
1461#define GL_SAMPLER_2D_MULTISAMPLE         0x9108
1462#define GL_INT_SAMPLER_2D_MULTISAMPLE     0x9109
1463#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
1464#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY   0x910B
1465#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
1466#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
1467#define GL_MAX_COLOR_TEXTURE_SAMPLES      0x910E
1468#define GL_MAX_DEPTH_TEXTURE_SAMPLES      0x910F
1469#define GL_MAX_INTEGER_SAMPLES            0x9110
1470typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
1471typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
1472typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
1473typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);
1474typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode);
1475typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
1476typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
1477typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
1478typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
1479typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
1480typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data);
1481typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
1482typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
1483typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
1484typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
1485typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
1486typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
1487typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);
1488typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint index, GLbitfield mask);
1489#ifdef GL_GLEXT_PROTOTYPES
1490GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
1491GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
1492GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
1493GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);
1494GLAPI void APIENTRY glProvokingVertex (GLenum mode);
1495GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
1496GLAPI GLboolean APIENTRY glIsSync (GLsync sync);
1497GLAPI void APIENTRY glDeleteSync (GLsync sync);
1498GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
1499GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
1500GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
1501GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
1502GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
1503GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
1504GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level);
1505GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
1506GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
1507GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
1508GLAPI void APIENTRY glSampleMaski (GLuint index, GLbitfield mask);
1509#endif
1510#endif /* GL_VERSION_3_2 */
1511
1512#ifndef GL_VERSION_3_3
1513#define GL_VERSION_3_3 1
1514#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR    0x88FE
1515#define GL_SRC1_COLOR                     0x88F9
1516#define GL_ONE_MINUS_SRC1_COLOR           0x88FA
1517#define GL_ONE_MINUS_SRC1_ALPHA           0x88FB
1518#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS   0x88FC
1519#define GL_ANY_SAMPLES_PASSED             0x8C2F
1520#define GL_SAMPLER_BINDING                0x8919
1521#define GL_RGB10_A2UI                     0x906F
1522#define GL_TEXTURE_SWIZZLE_R              0x8E42
1523#define GL_TEXTURE_SWIZZLE_G              0x8E43
1524#define GL_TEXTURE_SWIZZLE_B              0x8E44
1525#define GL_TEXTURE_SWIZZLE_A              0x8E45
1526#define GL_TEXTURE_SWIZZLE_RGBA           0x8E46
1527#define GL_TIME_ELAPSED                   0x88BF
1528#define GL_TIMESTAMP                      0x8E28
1529#define GL_INT_2_10_10_10_REV             0x8D9F
1530typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
1531typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name);
1532typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
1533typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
1534typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);
1535typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
1536typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
1537typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
1538typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
1539typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
1540typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
1541typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param);
1542typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);
1543typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params);
1544typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
1545typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params);
1546typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);
1547typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params);
1548typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params);
1549typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
1550typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1551typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1552typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1553typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1554typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1555typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1556typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1557typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1558typedef void (APIENTRYP PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value);
1559typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value);
1560typedef void (APIENTRYP PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value);
1561typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value);
1562typedef void (APIENTRYP PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value);
1563typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value);
1564typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords);
1565typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords);
1566typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords);
1567typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords);
1568typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords);
1569typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords);
1570typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords);
1571typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords);
1572typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords);
1573typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
1574typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords);
1575typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
1576typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords);
1577typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
1578typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords);
1579typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
1580typedef void (APIENTRYP PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords);
1581typedef void (APIENTRYP PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords);
1582typedef void (APIENTRYP PFNGLCOLORP3UIPROC) (GLenum type, GLuint color);
1583typedef void (APIENTRYP PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint *color);
1584typedef void (APIENTRYP PFNGLCOLORP4UIPROC) (GLenum type, GLuint color);
1585typedef void (APIENTRYP PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint *color);
1586typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color);
1587typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color);
1588#ifdef GL_GLEXT_PROTOTYPES
1589GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
1590GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name);
1591GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
1592GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
1593GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler);
1594GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler);
1595GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
1596GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
1597GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
1598GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
1599GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param);
1600GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param);
1601GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
1602GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params);
1603GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
1604GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params);
1605GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target);
1606GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params);
1607GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params);
1608GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
1609GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1610GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1611GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1612GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1613GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1614GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1615GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
1616GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
1617GLAPI void APIENTRY glVertexP2ui (GLenum type, GLuint value);
1618GLAPI void APIENTRY glVertexP2uiv (GLenum type, const GLuint *value);
1619GLAPI void APIENTRY glVertexP3ui (GLenum type, GLuint value);
1620GLAPI void APIENTRY glVertexP3uiv (GLenum type, const GLuint *value);
1621GLAPI void APIENTRY glVertexP4ui (GLenum type, GLuint value);
1622GLAPI void APIENTRY glVertexP4uiv (GLenum type, const GLuint *value);
1623GLAPI void APIENTRY glTexCoordP1ui (GLenum type, GLuint coords);
1624GLAPI void APIENTRY glTexCoordP1uiv (GLenum type, const GLuint *coords);
1625GLAPI void APIENTRY glTexCoordP2ui (GLenum type, GLuint coords);
1626GLAPI void APIENTRY glTexCoordP2uiv (GLenum type, const GLuint *coords);
1627GLAPI void APIENTRY glTexCoordP3ui (GLenum type, GLuint coords);
1628GLAPI void APIENTRY glTexCoordP3uiv (GLenum type, const GLuint *coords);
1629GLAPI void APIENTRY glTexCoordP4ui (GLenum type, GLuint coords);
1630GLAPI void APIENTRY glTexCoordP4uiv (GLenum type, const GLuint *coords);
1631GLAPI void APIENTRY glMultiTexCoordP1ui (GLenum texture, GLenum type, GLuint coords);
1632GLAPI void APIENTRY glMultiTexCoordP1uiv (GLenum texture, GLenum type, const GLuint *coords);
1633GLAPI void APIENTRY glMultiTexCoordP2ui (GLenum texture, GLenum type, GLuint coords);
1634GLAPI void APIENTRY glMultiTexCoordP2uiv (GLenum texture, GLenum type, const GLuint *coords);
1635GLAPI void APIENTRY glMultiTexCoordP3ui (GLenum texture, GLenum type, GLuint coords);
1636GLAPI void APIENTRY glMultiTexCoordP3uiv (GLenum texture, GLenum type, const GLuint *coords);
1637GLAPI void APIENTRY glMultiTexCoordP4ui (GLenum texture, GLenum type, GLuint coords);
1638GLAPI void APIENTRY glMultiTexCoordP4uiv (GLenum texture, GLenum type, const GLuint *coords);
1639GLAPI void APIENTRY glNormalP3ui (GLenum type, GLuint coords);
1640GLAPI void APIENTRY glNormalP3uiv (GLenum type, const GLuint *coords);
1641GLAPI void APIENTRY glColorP3ui (GLenum type, GLuint color);
1642GLAPI void APIENTRY glColorP3uiv (GLenum type, const GLuint *color);
1643GLAPI void APIENTRY glColorP4ui (GLenum type, GLuint color);
1644GLAPI void APIENTRY glColorP4uiv (GLenum type, const GLuint *color);
1645GLAPI void APIENTRY glSecondaryColorP3ui (GLenum type, GLuint color);
1646GLAPI void APIENTRY glSecondaryColorP3uiv (GLenum type, const GLuint *color);
1647#endif
1648#endif /* GL_VERSION_3_3 */
1649
1650#ifndef GL_VERSION_4_0
1651#define GL_VERSION_4_0 1
1652#define GL_SAMPLE_SHADING                 0x8C36
1653#define GL_MIN_SAMPLE_SHADING_VALUE       0x8C37
1654#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
1655#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
1656#define GL_TEXTURE_CUBE_MAP_ARRAY         0x9009
1657#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A
1658#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY   0x900B
1659#define GL_SAMPLER_CUBE_MAP_ARRAY         0x900C
1660#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW  0x900D
1661#define GL_INT_SAMPLER_CUBE_MAP_ARRAY     0x900E
1662#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F
1663#define GL_DRAW_INDIRECT_BUFFER           0x8F3F
1664#define GL_DRAW_INDIRECT_BUFFER_BINDING   0x8F43
1665#define GL_GEOMETRY_SHADER_INVOCATIONS    0x887F
1666#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A
1667#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B
1668#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C
1669#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D
1670#define GL_MAX_VERTEX_STREAMS             0x8E71
1671#define GL_DOUBLE_VEC2                    0x8FFC
1672#define GL_DOUBLE_VEC3                    0x8FFD
1673#define GL_DOUBLE_VEC4                    0x8FFE
1674#define GL_DOUBLE_MAT2                    0x8F46
1675#define GL_DOUBLE_MAT3                    0x8F47
1676#define GL_DOUBLE_MAT4                    0x8F48
1677#define GL_DOUBLE_MAT2x3                  0x8F49
1678#define GL_DOUBLE_MAT2x4                  0x8F4A
1679#define GL_DOUBLE_MAT3x2                  0x8F4B
1680#define GL_DOUBLE_MAT3x4                  0x8F4C
1681#define GL_DOUBLE_MAT4x2                  0x8F4D
1682#define GL_DOUBLE_MAT4x3                  0x8F4E
1683#define GL_ACTIVE_SUBROUTINES             0x8DE5
1684#define GL_ACTIVE_SUBROUTINE_UNIFORMS     0x8DE6
1685#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47
1686#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH   0x8E48
1687#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49
1688#define GL_MAX_SUBROUTINES                0x8DE7
1689#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8
1690#define GL_NUM_COMPATIBLE_SUBROUTINES     0x8E4A
1691#define GL_COMPATIBLE_SUBROUTINES         0x8E4B
1692#define GL_PATCHES                        0x000E
1693#define GL_PATCH_VERTICES                 0x8E72
1694#define GL_PATCH_DEFAULT_INNER_LEVEL      0x8E73
1695#define GL_PATCH_DEFAULT_OUTER_LEVEL      0x8E74
1696#define GL_TESS_CONTROL_OUTPUT_VERTICES   0x8E75
1697#define GL_TESS_GEN_MODE                  0x8E76
1698#define GL_TESS_GEN_SPACING               0x8E77
1699#define GL_TESS_GEN_VERTEX_ORDER          0x8E78
1700#define GL_TESS_GEN_POINT_MODE            0x8E79
1701#define GL_ISOLINES                       0x8E7A
1702#define GL_FRACTIONAL_ODD                 0x8E7B
1703#define GL_FRACTIONAL_EVEN                0x8E7C
1704#define GL_MAX_PATCH_VERTICES             0x8E7D
1705#define GL_MAX_TESS_GEN_LEVEL             0x8E7E
1706#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F
1707#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80
1708#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81
1709#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82
1710#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83
1711#define GL_MAX_TESS_PATCH_COMPONENTS      0x8E84
1712#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85
1713#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86
1714#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89
1715#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A
1716#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C
1717#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D
1718#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E
1719#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F
1720#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0
1721#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1
1722#define GL_TESS_EVALUATION_SHADER         0x8E87
1723#define GL_TESS_CONTROL_SHADER            0x8E88
1724#define GL_TRANSFORM_FEEDBACK             0x8E22
1725#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23
1726#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24
1727#define GL_TRANSFORM_FEEDBACK_BINDING     0x8E25
1728#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70
1729typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value);
1730typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);
1731typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
1732typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);
1733typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
1734typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect);
1735typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect);
1736typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x);
1737typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y);
1738typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z);
1739typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
1740typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value);
1741typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value);
1742typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value);
1743typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value);
1744typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1745typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1746typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1747typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1748typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1749typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1750typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1751typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1752typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1753typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params);
1754typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name);
1755typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name);
1756typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
1757typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
1758typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
1759typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices);
1760typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params);
1761typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
1762typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);
1763typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values);
1764typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
1765typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);
1766typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
1767typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
1768typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
1769typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
1770typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id);
1771typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream);
1772typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id);
1773typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index);
1774typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
1775#ifdef GL_GLEXT_PROTOTYPES
1776GLAPI void APIENTRY glMinSampleShading (GLfloat value);
1777GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode);
1778GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
1779GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst);
1780GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
1781GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect);
1782GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect);
1783GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x);
1784GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y);
1785GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z);
1786GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
1787GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value);
1788GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value);
1789GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value);
1790GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value);
1791GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1792GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1793GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1794GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1795GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1796GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1797GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1798GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1799GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1800GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params);
1801GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name);
1802GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name);
1803GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
1804GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
1805GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
1806GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices);
1807GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params);
1808GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
1809GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value);
1810GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values);
1811GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
1812GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
1813GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
1814GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id);
1815GLAPI void APIENTRY glPauseTransformFeedback (void);
1816GLAPI void APIENTRY glResumeTransformFeedback (void);
1817GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id);
1818GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream);
1819GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id);
1820GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index);
1821GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params);
1822#endif
1823#endif /* GL_VERSION_4_0 */
1824
1825#ifndef GL_VERSION_4_1
1826#define GL_VERSION_4_1 1
1827#define GL_FIXED                          0x140C
1828#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
1829#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
1830#define GL_LOW_FLOAT                      0x8DF0
1831#define GL_MEDIUM_FLOAT                   0x8DF1
1832#define GL_HIGH_FLOAT                     0x8DF2
1833#define GL_LOW_INT                        0x8DF3
1834#define GL_MEDIUM_INT                     0x8DF4
1835#define GL_HIGH_INT                       0x8DF5
1836#define GL_SHADER_COMPILER                0x8DFA
1837#define GL_SHADER_BINARY_FORMATS          0x8DF8
1838#define GL_NUM_SHADER_BINARY_FORMATS      0x8DF9
1839#define GL_MAX_VERTEX_UNIFORM_VECTORS     0x8DFB
1840#define GL_MAX_VARYING_VECTORS            0x8DFC
1841#define GL_MAX_FRAGMENT_UNIFORM_VECTORS   0x8DFD
1842#define GL_RGB565                         0x8D62
1843#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
1844#define GL_PROGRAM_BINARY_LENGTH          0x8741
1845#define GL_NUM_PROGRAM_BINARY_FORMATS     0x87FE
1846#define GL_PROGRAM_BINARY_FORMATS         0x87FF
1847#define GL_VERTEX_SHADER_BIT              0x00000001
1848#define GL_FRAGMENT_SHADER_BIT            0x00000002
1849#define GL_GEOMETRY_SHADER_BIT            0x00000004
1850#define GL_TESS_CONTROL_SHADER_BIT        0x00000008
1851#define GL_TESS_EVALUATION_SHADER_BIT     0x00000010
1852#define GL_ALL_SHADER_BITS                0xFFFFFFFF
1853#define GL_PROGRAM_SEPARABLE              0x8258
1854#define GL_ACTIVE_PROGRAM                 0x8259
1855#define GL_PROGRAM_PIPELINE_BINDING       0x825A
1856#define GL_MAX_VIEWPORTS                  0x825B
1857#define GL_VIEWPORT_SUBPIXEL_BITS         0x825C
1858#define GL_VIEWPORT_BOUNDS_RANGE          0x825D
1859#define GL_LAYER_PROVOKING_VERTEX         0x825E
1860#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F
1861#define GL_UNDEFINED_VERTEX               0x8260
1862typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
1863typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
1864typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
1865typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
1866typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
1867typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
1868typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
1869typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
1870typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
1871typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);
1872typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings);
1873typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);
1874typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines);
1875typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);
1876typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);
1877typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params);
1878typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0);
1879typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
1880typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0);
1881typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1882typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0);
1883typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1884typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0);
1885typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1886typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1);
1887typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
1888typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
1889typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1890typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1);
1891typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1892typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
1893typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1894typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
1895typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
1896typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
1897typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1898typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
1899typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1900typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
1901typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1902typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
1903typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
1904typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
1905typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1906typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
1907typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1908typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
1909typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
1910typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1911typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1912typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1913typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1914typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1915typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1916typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1917typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1918typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1919typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1920typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1921typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
1922typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1923typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1924typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1925typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1926typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1927typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
1928typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);
1929typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
1930typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x);
1931typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y);
1932typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
1933typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
1934typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v);
1935typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v);
1936typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v);
1937typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v);
1938typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
1939typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params);
1940typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v);
1941typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
1942typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v);
1943typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v);
1944typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
1945typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v);
1946typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v);
1947typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f);
1948typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data);
1949typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data);
1950#ifdef GL_GLEXT_PROTOTYPES
1951GLAPI void APIENTRY glReleaseShaderCompiler (void);
1952GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
1953GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
1954GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f);
1955GLAPI void APIENTRY glClearDepthf (GLfloat d);
1956GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
1957GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
1958GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
1959GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
1960GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
1961GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings);
1962GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline);
1963GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
1964GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
1965GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline);
1966GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
1967GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
1968GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
1969GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
1970GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1971GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0);
1972GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1973GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
1974GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
1975GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
1976GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
1977GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
1978GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1979GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1);
1980GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1981GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
1982GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
1983GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
1984GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
1985GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
1986GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1987GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
1988GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1989GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
1990GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
1991GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
1992GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
1993GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
1994GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
1995GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
1996GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
1997GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
1998GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
1999GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2000GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2001GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2002GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2003GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2004GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2005GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2006GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2007GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2008GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2009GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2010GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
2011GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2012GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2013GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2014GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2015GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2016GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
2017GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline);
2018GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
2019GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x);
2020GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y);
2021GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
2022GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
2023GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v);
2024GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v);
2025GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v);
2026GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v);
2027GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
2028GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params);
2029GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v);
2030GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
2031GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v);
2032GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v);
2033GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
2034GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v);
2035GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v);
2036GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f);
2037GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data);
2038GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data);
2039#endif
2040#endif /* GL_VERSION_4_1 */
2041
2042#ifndef GL_VERSION_4_2
2043#define GL_VERSION_4_2 1
2044#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH  0x9127
2045#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128
2046#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH  0x9129
2047#define GL_UNPACK_COMPRESSED_BLOCK_SIZE   0x912A
2048#define GL_PACK_COMPRESSED_BLOCK_WIDTH    0x912B
2049#define GL_PACK_COMPRESSED_BLOCK_HEIGHT   0x912C
2050#define GL_PACK_COMPRESSED_BLOCK_DEPTH    0x912D
2051#define GL_PACK_COMPRESSED_BLOCK_SIZE     0x912E
2052#define GL_NUM_SAMPLE_COUNTS              0x9380
2053#define GL_MIN_MAP_BUFFER_ALIGNMENT       0x90BC
2054#define GL_ATOMIC_COUNTER_BUFFER          0x92C0
2055#define GL_ATOMIC_COUNTER_BUFFER_BINDING  0x92C1
2056#define GL_ATOMIC_COUNTER_BUFFER_START    0x92C2
2057#define GL_ATOMIC_COUNTER_BUFFER_SIZE     0x92C3
2058#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4
2059#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5
2060#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6
2061#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7
2062#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8
2063#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9
2064#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA
2065#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB
2066#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
2067#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD
2068#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE
2069#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF
2070#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
2071#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
2072#define GL_MAX_VERTEX_ATOMIC_COUNTERS     0x92D2
2073#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3
2074#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4
2075#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS   0x92D5
2076#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS   0x92D6
2077#define GL_MAX_COMBINED_ATOMIC_COUNTERS   0x92D7
2078#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
2079#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
2080#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS  0x92D9
2081#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA
2082#define GL_UNSIGNED_INT_ATOMIC_COUNTER    0x92DB
2083#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
2084#define GL_ELEMENT_ARRAY_BARRIER_BIT      0x00000002
2085#define GL_UNIFORM_BARRIER_BIT            0x00000004
2086#define GL_TEXTURE_FETCH_BARRIER_BIT      0x00000008
2087#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
2088#define GL_COMMAND_BARRIER_BIT            0x00000040
2089#define GL_PIXEL_BUFFER_BARRIER_BIT       0x00000080
2090#define GL_TEXTURE_UPDATE_BARRIER_BIT     0x00000100
2091#define GL_BUFFER_UPDATE_BARRIER_BIT      0x00000200
2092#define GL_FRAMEBUFFER_BARRIER_BIT        0x00000400
2093#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
2094#define GL_ATOMIC_COUNTER_BARRIER_BIT     0x00001000
2095#define GL_ALL_BARRIER_BITS               0xFFFFFFFF
2096#define GL_MAX_IMAGE_UNITS                0x8F38
2097#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39
2098#define GL_IMAGE_BINDING_NAME             0x8F3A
2099#define GL_IMAGE_BINDING_LEVEL            0x8F3B
2100#define GL_IMAGE_BINDING_LAYERED          0x8F3C
2101#define GL_IMAGE_BINDING_LAYER            0x8F3D
2102#define GL_IMAGE_BINDING_ACCESS           0x8F3E
2103#define GL_IMAGE_1D                       0x904C
2104#define GL_IMAGE_2D                       0x904D
2105#define GL_IMAGE_3D                       0x904E
2106#define GL_IMAGE_2D_RECT                  0x904F
2107#define GL_IMAGE_CUBE                     0x9050
2108#define GL_IMAGE_BUFFER                   0x9051
2109#define GL_IMAGE_1D_ARRAY                 0x9052
2110#define GL_IMAGE_2D_ARRAY                 0x9053
2111#define GL_IMAGE_CUBE_MAP_ARRAY           0x9054
2112#define GL_IMAGE_2D_MULTISAMPLE           0x9055
2113#define GL_IMAGE_2D_MULTISAMPLE_ARRAY     0x9056
2114#define GL_INT_IMAGE_1D                   0x9057
2115#define GL_INT_IMAGE_2D                   0x9058
2116#define GL_INT_IMAGE_3D                   0x9059
2117#define GL_INT_IMAGE_2D_RECT              0x905A
2118#define GL_INT_IMAGE_CUBE                 0x905B
2119#define GL_INT_IMAGE_BUFFER               0x905C
2120#define GL_INT_IMAGE_1D_ARRAY             0x905D
2121#define GL_INT_IMAGE_2D_ARRAY             0x905E
2122#define GL_INT_IMAGE_CUBE_MAP_ARRAY       0x905F
2123#define GL_INT_IMAGE_2D_MULTISAMPLE       0x9060
2124#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061
2125#define GL_UNSIGNED_INT_IMAGE_1D          0x9062
2126#define GL_UNSIGNED_INT_IMAGE_2D          0x9063
2127#define GL_UNSIGNED_INT_IMAGE_3D          0x9064
2128#define GL_UNSIGNED_INT_IMAGE_2D_RECT     0x9065
2129#define GL_UNSIGNED_INT_IMAGE_CUBE        0x9066
2130#define GL_UNSIGNED_INT_IMAGE_BUFFER      0x9067
2131#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY    0x9068
2132#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY    0x9069
2133#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
2134#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B
2135#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C
2136#define GL_MAX_IMAGE_SAMPLES              0x906D
2137#define GL_IMAGE_BINDING_FORMAT           0x906E
2138#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
2139#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
2140#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
2141#define GL_MAX_VERTEX_IMAGE_UNIFORMS      0x90CA
2142#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB
2143#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC
2144#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS    0x90CD
2145#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS    0x90CE
2146#define GL_MAX_COMBINED_IMAGE_UNIFORMS    0x90CF
2147#define GL_TEXTURE_IMMUTABLE_FORMAT       0x912F
2148typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
2149typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
2150typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
2151typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
2152typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
2153typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
2154typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
2155typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
2156typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
2157typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
2158typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount);
2159typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
2160#ifdef GL_GLEXT_PROTOTYPES
2161GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
2162GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
2163GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
2164GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
2165GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
2166GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
2167GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers);
2168GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
2169GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
2170GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
2171GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount);
2172GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
2173#endif
2174#endif /* GL_VERSION_4_2 */
2175
2176#ifndef GL_VERSION_4_3
2177#define GL_VERSION_4_3 1
2178typedef void (APIENTRY  *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
2179#define GL_NUM_SHADING_LANGUAGE_VERSIONS  0x82E9
2180#define GL_VERTEX_ATTRIB_ARRAY_LONG       0x874E
2181#define GL_COMPRESSED_RGB8_ETC2           0x9274
2182#define GL_COMPRESSED_SRGB8_ETC2          0x9275
2183#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
2184#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
2185#define GL_COMPRESSED_RGBA8_ETC2_EAC      0x9278
2186#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
2187#define GL_COMPRESSED_R11_EAC             0x9270
2188#define GL_COMPRESSED_SIGNED_R11_EAC      0x9271
2189#define GL_COMPRESSED_RG11_EAC            0x9272
2190#define GL_COMPRESSED_SIGNED_RG11_EAC     0x9273
2191#define GL_PRIMITIVE_RESTART_FIXED_INDEX  0x8D69
2192#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
2193#define GL_MAX_ELEMENT_INDEX              0x8D6B
2194#define GL_COMPUTE_SHADER                 0x91B9
2195#define GL_MAX_COMPUTE_UNIFORM_BLOCKS     0x91BB
2196#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
2197#define GL_MAX_COMPUTE_IMAGE_UNIFORMS     0x91BD
2198#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
2199#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
2200#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
2201#define GL_MAX_COMPUTE_ATOMIC_COUNTERS    0x8265
2202#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
2203#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
2204#define GL_MAX_COMPUTE_WORK_GROUP_COUNT   0x91BE
2205#define GL_MAX_COMPUTE_WORK_GROUP_SIZE    0x91BF
2206#define GL_COMPUTE_WORK_GROUP_SIZE        0x8267
2207#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC
2208#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED
2209#define GL_DISPATCH_INDIRECT_BUFFER       0x90EE
2210#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
2211#define GL_DEBUG_OUTPUT_SYNCHRONOUS       0x8242
2212#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
2213#define GL_DEBUG_CALLBACK_FUNCTION        0x8244
2214#define GL_DEBUG_CALLBACK_USER_PARAM      0x8245
2215#define GL_DEBUG_SOURCE_API               0x8246
2216#define GL_DEBUG_SOURCE_WINDOW_SYSTEM     0x8247
2217#define GL_DEBUG_SOURCE_SHADER_COMPILER   0x8248
2218#define GL_DEBUG_SOURCE_THIRD_PARTY       0x8249
2219#define GL_DEBUG_SOURCE_APPLICATION       0x824A
2220#define GL_DEBUG_SOURCE_OTHER             0x824B
2221#define GL_DEBUG_TYPE_ERROR               0x824C
2222#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
2223#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR  0x824E
2224#define GL_DEBUG_TYPE_PORTABILITY         0x824F
2225#define GL_DEBUG_TYPE_PERFORMANCE         0x8250
2226#define GL_DEBUG_TYPE_OTHER               0x8251
2227#define GL_MAX_DEBUG_MESSAGE_LENGTH       0x9143
2228#define GL_MAX_DEBUG_LOGGED_MESSAGES      0x9144
2229#define GL_DEBUG_LOGGED_MESSAGES          0x9145
2230#define GL_DEBUG_SEVERITY_HIGH            0x9146
2231#define GL_DEBUG_SEVERITY_MEDIUM          0x9147
2232#define GL_DEBUG_SEVERITY_LOW             0x9148
2233#define GL_DEBUG_TYPE_MARKER              0x8268
2234#define GL_DEBUG_TYPE_PUSH_GROUP          0x8269
2235#define GL_DEBUG_TYPE_POP_GROUP           0x826A
2236#define GL_DEBUG_SEVERITY_NOTIFICATION    0x826B
2237#define GL_MAX_DEBUG_GROUP_STACK_DEPTH    0x826C
2238#define GL_DEBUG_GROUP_STACK_DEPTH        0x826D
2239#define GL_BUFFER                         0x82E0
2240#define GL_SHADER                         0x82E1
2241#define GL_PROGRAM                        0x82E2
2242#define GL_QUERY                          0x82E3
2243#define GL_PROGRAM_PIPELINE               0x82E4
2244#define GL_SAMPLER                        0x82E6
2245#define GL_MAX_LABEL_LENGTH               0x82E8
2246#define GL_DEBUG_OUTPUT                   0x92E0
2247#define GL_CONTEXT_FLAG_DEBUG_BIT         0x00000002
2248#define GL_MAX_UNIFORM_LOCATIONS          0x826E
2249#define GL_FRAMEBUFFER_DEFAULT_WIDTH      0x9310
2250#define GL_FRAMEBUFFER_DEFAULT_HEIGHT     0x9311
2251#define GL_FRAMEBUFFER_DEFAULT_LAYERS     0x9312
2252#define GL_FRAMEBUFFER_DEFAULT_SAMPLES    0x9313
2253#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
2254#define GL_MAX_FRAMEBUFFER_WIDTH          0x9315
2255#define GL_MAX_FRAMEBUFFER_HEIGHT         0x9316
2256#define GL_MAX_FRAMEBUFFER_LAYERS         0x9317
2257#define GL_MAX_FRAMEBUFFER_SAMPLES        0x9318
2258#define GL_INTERNALFORMAT_SUPPORTED       0x826F
2259#define GL_INTERNALFORMAT_PREFERRED       0x8270
2260#define GL_INTERNALFORMAT_RED_SIZE        0x8271
2261#define GL_INTERNALFORMAT_GREEN_SIZE      0x8272
2262#define GL_INTERNALFORMAT_BLUE_SIZE       0x8273
2263#define GL_INTERNALFORMAT_ALPHA_SIZE      0x8274
2264#define GL_INTERNALFORMAT_DEPTH_SIZE      0x8275
2265#define GL_INTERNALFORMAT_STENCIL_SIZE    0x8276
2266#define GL_INTERNALFORMAT_SHARED_SIZE     0x8277
2267#define GL_INTERNALFORMAT_RED_TYPE        0x8278
2268#define GL_INTERNALFORMAT_GREEN_TYPE      0x8279
2269#define GL_INTERNALFORMAT_BLUE_TYPE       0x827A
2270#define GL_INTERNALFORMAT_ALPHA_TYPE      0x827B
2271#define GL_INTERNALFORMAT_DEPTH_TYPE      0x827C
2272#define GL_INTERNALFORMAT_STENCIL_TYPE    0x827D
2273#define GL_MAX_WIDTH                      0x827E
2274#define GL_MAX_HEIGHT                     0x827F
2275#define GL_MAX_DEPTH                      0x8280
2276#define GL_MAX_LAYERS                     0x8281
2277#define GL_MAX_COMBINED_DIMENSIONS        0x8282
2278#define GL_COLOR_COMPONENTS               0x8283
2279#define GL_DEPTH_COMPONENTS               0x8284
2280#define GL_STENCIL_COMPONENTS             0x8285
2281#define GL_COLOR_RENDERABLE               0x8286
2282#define GL_DEPTH_RENDERABLE               0x8287
2283#define GL_STENCIL_RENDERABLE             0x8288
2284#define GL_FRAMEBUFFER_RENDERABLE         0x8289
2285#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A
2286#define GL_FRAMEBUFFER_BLEND              0x828B
2287#define GL_READ_PIXELS                    0x828C
2288#define GL_READ_PIXELS_FORMAT             0x828D
2289#define GL_READ_PIXELS_TYPE               0x828E
2290#define GL_TEXTURE_IMAGE_FORMAT           0x828F
2291#define GL_TEXTURE_IMAGE_TYPE             0x8290
2292#define GL_GET_TEXTURE_IMAGE_FORMAT       0x8291
2293#define GL_GET_TEXTURE_IMAGE_TYPE         0x8292
2294#define GL_MIPMAP                         0x8293
2295#define GL_MANUAL_GENERATE_MIPMAP         0x8294
2296#define GL_AUTO_GENERATE_MIPMAP           0x8295
2297#define GL_COLOR_ENCODING                 0x8296
2298#define GL_SRGB_READ                      0x8297
2299#define GL_SRGB_WRITE                     0x8298
2300#define GL_FILTER                         0x829A
2301#define GL_VERTEX_TEXTURE                 0x829B
2302#define GL_TESS_CONTROL_TEXTURE           0x829C
2303#define GL_TESS_EVALUATION_TEXTURE        0x829D
2304#define GL_GEOMETRY_TEXTURE               0x829E
2305#define GL_FRAGMENT_TEXTURE               0x829F
2306#define GL_COMPUTE_TEXTURE                0x82A0
2307#define GL_TEXTURE_SHADOW                 0x82A1
2308#define GL_TEXTURE_GATHER                 0x82A2
2309#define GL_TEXTURE_GATHER_SHADOW          0x82A3
2310#define GL_SHADER_IMAGE_LOAD              0x82A4
2311#define GL_SHADER_IMAGE_STORE             0x82A5
2312#define GL_SHADER_IMAGE_ATOMIC            0x82A6
2313#define GL_IMAGE_TEXEL_SIZE               0x82A7
2314#define GL_IMAGE_COMPATIBILITY_CLASS      0x82A8
2315#define GL_IMAGE_PIXEL_FORMAT             0x82A9
2316#define GL_IMAGE_PIXEL_TYPE               0x82AA
2317#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC
2318#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD
2319#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE
2320#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF
2321#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1
2322#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2
2323#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE  0x82B3
2324#define GL_CLEAR_BUFFER                   0x82B4
2325#define GL_TEXTURE_VIEW                   0x82B5
2326#define GL_VIEW_COMPATIBILITY_CLASS       0x82B6
2327#define GL_FULL_SUPPORT                   0x82B7
2328#define GL_CAVEAT_SUPPORT                 0x82B8
2329#define GL_IMAGE_CLASS_4_X_32             0x82B9
2330#define GL_IMAGE_CLASS_2_X_32             0x82BA
2331#define GL_IMAGE_CLASS_1_X_32             0x82BB
2332#define GL_IMAGE_CLASS_4_X_16             0x82BC
2333#define GL_IMAGE_CLASS_2_X_16             0x82BD
2334#define GL_IMAGE_CLASS_1_X_16             0x82BE
2335#define GL_IMAGE_CLASS_4_X_8              0x82BF
2336#define GL_IMAGE_CLASS_2_X_8              0x82C0
2337#define GL_IMAGE_CLASS_1_X_8              0x82C1
2338#define GL_IMAGE_CLASS_11_11_10           0x82C2
2339#define GL_IMAGE_CLASS_10_10_10_2         0x82C3
2340#define GL_VIEW_CLASS_128_BITS            0x82C4
2341#define GL_VIEW_CLASS_96_BITS             0x82C5
2342#define GL_VIEW_CLASS_64_BITS             0x82C6
2343#define GL_VIEW_CLASS_48_BITS             0x82C7
2344#define GL_VIEW_CLASS_32_BITS             0x82C8
2345#define GL_VIEW_CLASS_24_BITS             0x82C9
2346#define GL_VIEW_CLASS_16_BITS             0x82CA
2347#define GL_VIEW_CLASS_8_BITS              0x82CB
2348#define GL_VIEW_CLASS_S3TC_DXT1_RGB       0x82CC
2349#define GL_VIEW_CLASS_S3TC_DXT1_RGBA      0x82CD
2350#define GL_VIEW_CLASS_S3TC_DXT3_RGBA      0x82CE
2351#define GL_VIEW_CLASS_S3TC_DXT5_RGBA      0x82CF
2352#define GL_VIEW_CLASS_RGTC1_RED           0x82D0
2353#define GL_VIEW_CLASS_RGTC2_RG            0x82D1
2354#define GL_VIEW_CLASS_BPTC_UNORM          0x82D2
2355#define GL_VIEW_CLASS_BPTC_FLOAT          0x82D3
2356#define GL_UNIFORM                        0x92E1
2357#define GL_UNIFORM_BLOCK                  0x92E2
2358#define GL_PROGRAM_INPUT                  0x92E3
2359#define GL_PROGRAM_OUTPUT                 0x92E4
2360#define GL_BUFFER_VARIABLE                0x92E5
2361#define GL_SHADER_STORAGE_BLOCK           0x92E6
2362#define GL_VERTEX_SUBROUTINE              0x92E8
2363#define GL_TESS_CONTROL_SUBROUTINE        0x92E9
2364#define GL_TESS_EVALUATION_SUBROUTINE     0x92EA
2365#define GL_GEOMETRY_SUBROUTINE            0x92EB
2366#define GL_FRAGMENT_SUBROUTINE            0x92EC
2367#define GL_COMPUTE_SUBROUTINE             0x92ED
2368#define GL_VERTEX_SUBROUTINE_UNIFORM      0x92EE
2369#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF
2370#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0
2371#define GL_GEOMETRY_SUBROUTINE_UNIFORM    0x92F1
2372#define GL_FRAGMENT_SUBROUTINE_UNIFORM    0x92F2
2373#define GL_COMPUTE_SUBROUTINE_UNIFORM     0x92F3
2374#define GL_TRANSFORM_FEEDBACK_VARYING     0x92F4
2375#define GL_ACTIVE_RESOURCES               0x92F5
2376#define GL_MAX_NAME_LENGTH                0x92F6
2377#define GL_MAX_NUM_ACTIVE_VARIABLES       0x92F7
2378#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8
2379#define GL_NAME_LENGTH                    0x92F9
2380#define GL_TYPE                           0x92FA
2381#define GL_ARRAY_SIZE                     0x92FB
2382#define GL_OFFSET                         0x92FC
2383#define GL_BLOCK_INDEX                    0x92FD
2384#define GL_ARRAY_STRIDE                   0x92FE
2385#define GL_MATRIX_STRIDE                  0x92FF
2386#define GL_IS_ROW_MAJOR                   0x9300
2387#define GL_ATOMIC_COUNTER_BUFFER_INDEX    0x9301
2388#define GL_BUFFER_BINDING                 0x9302
2389#define GL_BUFFER_DATA_SIZE               0x9303
2390#define GL_NUM_ACTIVE_VARIABLES           0x9304
2391#define GL_ACTIVE_VARIABLES               0x9305
2392#define GL_REFERENCED_BY_VERTEX_SHADER    0x9306
2393#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307
2394#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308
2395#define GL_REFERENCED_BY_GEOMETRY_SHADER  0x9309
2396#define GL_REFERENCED_BY_FRAGMENT_SHADER  0x930A
2397#define GL_REFERENCED_BY_COMPUTE_SHADER   0x930B
2398#define GL_TOP_LEVEL_ARRAY_SIZE           0x930C
2399#define GL_TOP_LEVEL_ARRAY_STRIDE         0x930D
2400#define GL_LOCATION                       0x930E
2401#define GL_LOCATION_INDEX                 0x930F
2402#define GL_IS_PER_PATCH                   0x92E7
2403#define GL_SHADER_STORAGE_BUFFER          0x90D2
2404#define GL_SHADER_STORAGE_BUFFER_BINDING  0x90D3
2405#define GL_SHADER_STORAGE_BUFFER_START    0x90D4
2406#define GL_SHADER_STORAGE_BUFFER_SIZE     0x90D5
2407#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
2408#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7
2409#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8
2410#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9
2411#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
2412#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
2413#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
2414#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
2415#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE  0x90DE
2416#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
2417#define GL_SHADER_STORAGE_BARRIER_BIT     0x00002000
2418#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
2419#define GL_DEPTH_STENCIL_TEXTURE_MODE     0x90EA
2420#define GL_TEXTURE_BUFFER_OFFSET          0x919D
2421#define GL_TEXTURE_BUFFER_SIZE            0x919E
2422#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F
2423#define GL_TEXTURE_VIEW_MIN_LEVEL         0x82DB
2424#define GL_TEXTURE_VIEW_NUM_LEVELS        0x82DC
2425#define GL_TEXTURE_VIEW_MIN_LAYER         0x82DD
2426#define GL_TEXTURE_VIEW_NUM_LAYERS        0x82DE
2427#define GL_TEXTURE_IMMUTABLE_LEVELS       0x82DF
2428#define GL_VERTEX_ATTRIB_BINDING          0x82D4
2429#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET  0x82D5
2430#define GL_VERTEX_BINDING_DIVISOR         0x82D6
2431#define GL_VERTEX_BINDING_OFFSET          0x82D7
2432#define GL_VERTEX_BINDING_STRIDE          0x82D8
2433#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
2434#define GL_MAX_VERTEX_ATTRIB_BINDINGS     0x82DA
2435#define GL_DISPLAY_LIST                   0x82E7
2436typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
2437typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
2438typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
2439typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
2440typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
2441typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
2442typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
2443typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
2444typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
2445typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level);
2446typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
2447typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);
2448typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
2449typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
2450typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
2451typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
2452typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
2453typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
2454typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
2455typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
2456typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name);
2457typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
2458typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
2459typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
2460typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
2461typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
2462typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
2463typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
2464typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
2465typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
2466typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
2467typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);
2468typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);
2469typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
2470typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
2471typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
2472typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
2473typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
2474typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);
2475typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
2476typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
2477typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
2478typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
2479#ifdef GL_GLEXT_PROTOTYPES
2480GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
2481GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
2482GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
2483GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect);
2484GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
2485GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);
2486GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);
2487GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
2488GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
2489GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level);
2490GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length);
2491GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer);
2492GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
2493GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
2494GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
2495GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
2496GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
2497GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);
2498GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
2499GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
2500GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);
2501GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name);
2502GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
2503GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
2504GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
2505GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
2506GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
2507GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
2508GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
2509GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
2510GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
2511GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
2512GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
2513GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
2514GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
2515GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam);
2516GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
2517GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message);
2518GLAPI void APIENTRY glPopDebugGroup (void);
2519GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
2520GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
2521GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label);
2522GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
2523#endif
2524#endif /* GL_VERSION_4_3 */
2525
2526#ifndef GL_VERSION_4_4
2527#define GL_VERSION_4_4 1
2528#define GL_MAX_VERTEX_ATTRIB_STRIDE       0x82E5
2529#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
2530#define GL_TEXTURE_BUFFER_BINDING         0x8C2A
2531#define GL_MAP_PERSISTENT_BIT             0x0040
2532#define GL_MAP_COHERENT_BIT               0x0080
2533#define GL_DYNAMIC_STORAGE_BIT            0x0100
2534#define GL_CLIENT_STORAGE_BIT             0x0200
2535#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000
2536#define GL_BUFFER_IMMUTABLE_STORAGE       0x821F
2537#define GL_BUFFER_STORAGE_FLAGS           0x8220
2538#define GL_CLEAR_TEXTURE                  0x9365
2539#define GL_LOCATION_COMPONENT             0x934A
2540#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B
2541#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C
2542#define GL_QUERY_BUFFER                   0x9192
2543#define GL_QUERY_BUFFER_BARRIER_BIT       0x00008000
2544#define GL_QUERY_BUFFER_BINDING           0x9193
2545#define GL_QUERY_RESULT_NO_WAIT           0x9194
2546#define GL_MIRROR_CLAMP_TO_EDGE           0x8743
2547typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
2548typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
2549typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
2550typedef void (APIENTRYP PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
2551typedef void (APIENTRYP PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
2552typedef void (APIENTRYP PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures);
2553typedef void (APIENTRYP PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint *samplers);
2554typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures);
2555typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
2556#ifdef GL_GLEXT_PROTOTYPES
2557GLAPI void APIENTRY glBufferStorage (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
2558GLAPI void APIENTRY glClearTexImage (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
2559GLAPI void APIENTRY glClearTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
2560GLAPI void APIENTRY glBindBuffersBase (GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
2561GLAPI void APIENTRY glBindBuffersRange (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
2562GLAPI void APIENTRY glBindTextures (GLuint first, GLsizei count, const GLuint *textures);
2563GLAPI void APIENTRY glBindSamplers (GLuint first, GLsizei count, const GLuint *samplers);
2564GLAPI void APIENTRY glBindImageTextures (GLuint first, GLsizei count, const GLuint *textures);
2565GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
2566#endif
2567#endif /* GL_VERSION_4_4 */
2568
2569#ifndef GL_ARB_ES2_compatibility
2570#define GL_ARB_ES2_compatibility 1
2571#endif /* GL_ARB_ES2_compatibility */
2572
2573#ifndef GL_ARB_ES3_compatibility
2574#define GL_ARB_ES3_compatibility 1
2575#endif /* GL_ARB_ES3_compatibility */
2576
2577#ifndef GL_ARB_arrays_of_arrays
2578#define GL_ARB_arrays_of_arrays 1
2579#endif /* GL_ARB_arrays_of_arrays */
2580
2581#ifndef GL_ARB_base_instance
2582#define GL_ARB_base_instance 1
2583#endif /* GL_ARB_base_instance */
2584
2585#ifndef GL_ARB_bindless_texture
2586#define GL_ARB_bindless_texture 1
2587typedef uint64_t GLuint64EXT;
2588#define GL_UNSIGNED_INT64_ARB             0x140F
2589typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture);
2590typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler);
2591typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
2592typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle);
2593typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
2594typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access);
2595typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle);
2596typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value);
2597typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
2598typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value);
2599typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
2600typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
2601typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle);
2602typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x);
2603typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v);
2604typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params);
2605#ifdef GL_GLEXT_PROTOTYPES
2606GLAPI GLuint64 APIENTRY glGetTextureHandleARB (GLuint texture);
2607GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleARB (GLuint texture, GLuint sampler);
2608GLAPI void APIENTRY glMakeTextureHandleResidentARB (GLuint64 handle);
2609GLAPI void APIENTRY glMakeTextureHandleNonResidentARB (GLuint64 handle);
2610GLAPI GLuint64 APIENTRY glGetImageHandleARB (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
2611GLAPI void APIENTRY glMakeImageHandleResidentARB (GLuint64 handle, GLenum access);
2612GLAPI void APIENTRY glMakeImageHandleNonResidentARB (GLuint64 handle);
2613GLAPI void APIENTRY glUniformHandleui64ARB (GLint location, GLuint64 value);
2614GLAPI void APIENTRY glUniformHandleui64vARB (GLint location, GLsizei count, const GLuint64 *value);
2615GLAPI void APIENTRY glProgramUniformHandleui64ARB (GLuint program, GLint location, GLuint64 value);
2616GLAPI void APIENTRY glProgramUniformHandleui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
2617GLAPI GLboolean APIENTRY glIsTextureHandleResidentARB (GLuint64 handle);
2618GLAPI GLboolean APIENTRY glIsImageHandleResidentARB (GLuint64 handle);
2619GLAPI void APIENTRY glVertexAttribL1ui64ARB (GLuint index, GLuint64EXT x);
2620GLAPI void APIENTRY glVertexAttribL1ui64vARB (GLuint index, const GLuint64EXT *v);
2621GLAPI void APIENTRY glGetVertexAttribLui64vARB (GLuint index, GLenum pname, GLuint64EXT *params);
2622#endif
2623#endif /* GL_ARB_bindless_texture */
2624
2625#ifndef GL_ARB_blend_func_extended
2626#define GL_ARB_blend_func_extended 1
2627#endif /* GL_ARB_blend_func_extended */
2628
2629#ifndef GL_ARB_buffer_storage
2630#define GL_ARB_buffer_storage 1
2631#endif /* GL_ARB_buffer_storage */
2632
2633#ifndef GL_ARB_cl_event
2634#define GL_ARB_cl_event 1
2635struct _cl_context;
2636struct _cl_event;
2637#define GL_SYNC_CL_EVENT_ARB              0x8240
2638#define GL_SYNC_CL_EVENT_COMPLETE_ARB     0x8241
2639typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context *context, struct _cl_event *event, GLbitfield flags);
2640#ifdef GL_GLEXT_PROTOTYPES
2641GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, struct _cl_event *event, GLbitfield flags);
2642#endif
2643#endif /* GL_ARB_cl_event */
2644
2645#ifndef GL_ARB_clear_buffer_object
2646#define GL_ARB_clear_buffer_object 1
2647#endif /* GL_ARB_clear_buffer_object */
2648
2649#ifndef GL_ARB_clear_texture
2650#define GL_ARB_clear_texture 1
2651#endif /* GL_ARB_clear_texture */
2652
2653#ifndef GL_ARB_color_buffer_float
2654#define GL_ARB_color_buffer_float 1
2655#define GL_RGBA_FLOAT_MODE_ARB            0x8820
2656#define GL_CLAMP_VERTEX_COLOR_ARB         0x891A
2657#define GL_CLAMP_FRAGMENT_COLOR_ARB       0x891B
2658#define GL_CLAMP_READ_COLOR_ARB           0x891C
2659#define GL_FIXED_ONLY_ARB                 0x891D
2660typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp);
2661#ifdef GL_GLEXT_PROTOTYPES
2662GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp);
2663#endif
2664#endif /* GL_ARB_color_buffer_float */
2665
2666#ifndef GL_ARB_compatibility
2667#define GL_ARB_compatibility 1
2668#endif /* GL_ARB_compatibility */
2669
2670#ifndef GL_ARB_compressed_texture_pixel_storage
2671#define GL_ARB_compressed_texture_pixel_storage 1
2672#endif /* GL_ARB_compressed_texture_pixel_storage */
2673
2674#ifndef GL_ARB_compute_shader
2675#define GL_ARB_compute_shader 1
2676#define GL_COMPUTE_SHADER_BIT             0x00000020
2677#endif /* GL_ARB_compute_shader */
2678
2679#ifndef GL_ARB_compute_variable_group_size
2680#define GL_ARB_compute_variable_group_size 1
2681#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344
2682#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB
2683#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345
2684#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF
2685typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z);
2686#ifdef GL_GLEXT_PROTOTYPES
2687GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z);
2688#endif
2689#endif /* GL_ARB_compute_variable_group_size */
2690
2691#ifndef GL_ARB_conservative_depth
2692#define GL_ARB_conservative_depth 1
2693#endif /* GL_ARB_conservative_depth */
2694
2695#ifndef GL_ARB_copy_buffer
2696#define GL_ARB_copy_buffer 1
2697#define GL_COPY_READ_BUFFER_BINDING       0x8F36
2698#define GL_COPY_WRITE_BUFFER_BINDING      0x8F37
2699#endif /* GL_ARB_copy_buffer */
2700
2701#ifndef GL_ARB_copy_image
2702#define GL_ARB_copy_image 1
2703#endif /* GL_ARB_copy_image */
2704
2705#ifndef GL_ARB_debug_output
2706#define GL_ARB_debug_output 1
2707typedef void (APIENTRY  *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
2708#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB   0x8242
2709#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
2710#define GL_DEBUG_CALLBACK_FUNCTION_ARB    0x8244
2711#define GL_DEBUG_CALLBACK_USER_PARAM_ARB  0x8245
2712#define GL_DEBUG_SOURCE_API_ARB           0x8246
2713#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
2714#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
2715#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB   0x8249
2716#define GL_DEBUG_SOURCE_APPLICATION_ARB   0x824A
2717#define GL_DEBUG_SOURCE_OTHER_ARB         0x824B
2718#define GL_DEBUG_TYPE_ERROR_ARB           0x824C
2719#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
2720#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
2721#define GL_DEBUG_TYPE_PORTABILITY_ARB     0x824F
2722#define GL_DEBUG_TYPE_PERFORMANCE_ARB     0x8250
2723#define GL_DEBUG_TYPE_OTHER_ARB           0x8251
2724#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB   0x9143
2725#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB  0x9144
2726#define GL_DEBUG_LOGGED_MESSAGES_ARB      0x9145
2727#define GL_DEBUG_SEVERITY_HIGH_ARB        0x9146
2728#define GL_DEBUG_SEVERITY_MEDIUM_ARB      0x9147
2729#define GL_DEBUG_SEVERITY_LOW_ARB         0x9148
2730typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
2731typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
2732typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam);
2733typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
2734#ifdef GL_GLEXT_PROTOTYPES
2735GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
2736GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
2737GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const void *userParam);
2738GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
2739#endif
2740#endif /* GL_ARB_debug_output */
2741
2742#ifndef GL_ARB_depth_buffer_float
2743#define GL_ARB_depth_buffer_float 1
2744#endif /* GL_ARB_depth_buffer_float */
2745
2746#ifndef GL_ARB_depth_clamp
2747#define GL_ARB_depth_clamp 1
2748#endif /* GL_ARB_depth_clamp */
2749
2750#ifndef GL_ARB_depth_texture
2751#define GL_ARB_depth_texture 1
2752#define GL_DEPTH_COMPONENT16_ARB          0x81A5
2753#define GL_DEPTH_COMPONENT24_ARB          0x81A6
2754#define GL_DEPTH_COMPONENT32_ARB          0x81A7
2755#define GL_TEXTURE_DEPTH_SIZE_ARB         0x884A
2756#define GL_DEPTH_TEXTURE_MODE_ARB         0x884B
2757#endif /* GL_ARB_depth_texture */
2758
2759#ifndef GL_ARB_draw_buffers
2760#define GL_ARB_draw_buffers 1
2761#define GL_MAX_DRAW_BUFFERS_ARB           0x8824
2762#define GL_DRAW_BUFFER0_ARB               0x8825
2763#define GL_DRAW_BUFFER1_ARB               0x8826
2764#define GL_DRAW_BUFFER2_ARB               0x8827
2765#define GL_DRAW_BUFFER3_ARB               0x8828
2766#define GL_DRAW_BUFFER4_ARB               0x8829
2767#define GL_DRAW_BUFFER5_ARB               0x882A
2768#define GL_DRAW_BUFFER6_ARB               0x882B
2769#define GL_DRAW_BUFFER7_ARB               0x882C
2770#define GL_DRAW_BUFFER8_ARB               0x882D
2771#define GL_DRAW_BUFFER9_ARB               0x882E
2772#define GL_DRAW_BUFFER10_ARB              0x882F
2773#define GL_DRAW_BUFFER11_ARB              0x8830
2774#define GL_DRAW_BUFFER12_ARB              0x8831
2775#define GL_DRAW_BUFFER13_ARB              0x8832
2776#define GL_DRAW_BUFFER14_ARB              0x8833
2777#define GL_DRAW_BUFFER15_ARB              0x8834
2778typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs);
2779#ifdef GL_GLEXT_PROTOTYPES
2780GLAPI void APIENTRY glDrawBuffersARB (GLsizei n, const GLenum *bufs);
2781#endif
2782#endif /* GL_ARB_draw_buffers */
2783
2784#ifndef GL_ARB_draw_buffers_blend
2785#define GL_ARB_draw_buffers_blend 1
2786typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode);
2787typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
2788typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst);
2789typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
2790#ifdef GL_GLEXT_PROTOTYPES
2791GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode);
2792GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
2793GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst);
2794GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
2795#endif
2796#endif /* GL_ARB_draw_buffers_blend */
2797
2798#ifndef GL_ARB_draw_elements_base_vertex
2799#define GL_ARB_draw_elements_base_vertex 1
2800#endif /* GL_ARB_draw_elements_base_vertex */
2801
2802#ifndef GL_ARB_draw_indirect
2803#define GL_ARB_draw_indirect 1
2804#endif /* GL_ARB_draw_indirect */
2805
2806#ifndef GL_ARB_draw_instanced
2807#define GL_ARB_draw_instanced 1
2808typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
2809typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
2810#ifdef GL_GLEXT_PROTOTYPES
2811GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
2812GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
2813#endif
2814#endif /* GL_ARB_draw_instanced */
2815
2816#ifndef GL_ARB_enhanced_layouts
2817#define GL_ARB_enhanced_layouts 1
2818#endif /* GL_ARB_enhanced_layouts */
2819
2820#ifndef GL_ARB_explicit_attrib_location
2821#define GL_ARB_explicit_attrib_location 1
2822#endif /* GL_ARB_explicit_attrib_location */
2823
2824#ifndef GL_ARB_explicit_uniform_location
2825#define GL_ARB_explicit_uniform_location 1
2826#endif /* GL_ARB_explicit_uniform_location */
2827
2828#ifndef GL_ARB_fragment_coord_conventions
2829#define GL_ARB_fragment_coord_conventions 1
2830#endif /* GL_ARB_fragment_coord_conventions */
2831
2832#ifndef GL_ARB_fragment_layer_viewport
2833#define GL_ARB_fragment_layer_viewport 1
2834#endif /* GL_ARB_fragment_layer_viewport */
2835
2836#ifndef GL_ARB_fragment_program
2837#define GL_ARB_fragment_program 1
2838#define GL_FRAGMENT_PROGRAM_ARB           0x8804
2839#define GL_PROGRAM_FORMAT_ASCII_ARB       0x8875
2840#define GL_PROGRAM_LENGTH_ARB             0x8627
2841#define GL_PROGRAM_FORMAT_ARB             0x8876
2842#define GL_PROGRAM_BINDING_ARB            0x8677
2843#define GL_PROGRAM_INSTRUCTIONS_ARB       0x88A0
2844#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB   0x88A1
2845#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2
2846#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3
2847#define GL_PROGRAM_TEMPORARIES_ARB        0x88A4
2848#define GL_MAX_PROGRAM_TEMPORARIES_ARB    0x88A5
2849#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6
2850#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7
2851#define GL_PROGRAM_PARAMETERS_ARB         0x88A8
2852#define GL_MAX_PROGRAM_PARAMETERS_ARB     0x88A9
2853#define GL_PROGRAM_NATIVE_PARAMETERS_ARB  0x88AA
2854#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB
2855#define GL_PROGRAM_ATTRIBS_ARB            0x88AC
2856#define GL_MAX_PROGRAM_ATTRIBS_ARB        0x88AD
2857#define GL_PROGRAM_NATIVE_ATTRIBS_ARB     0x88AE
2858#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF
2859#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4
2860#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5
2861#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6
2862#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB   0x8805
2863#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB   0x8806
2864#define GL_PROGRAM_TEX_INDIRECTIONS_ARB   0x8807
2865#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808
2866#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809
2867#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A
2868#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B
2869#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C
2870#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D
2871#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E
2872#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F
2873#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810
2874#define GL_PROGRAM_STRING_ARB             0x8628
2875#define GL_PROGRAM_ERROR_POSITION_ARB     0x864B
2876#define GL_CURRENT_MATRIX_ARB             0x8641
2877#define GL_TRANSPOSE_CURRENT_MATRIX_ARB   0x88B7
2878#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640
2879#define GL_MAX_PROGRAM_MATRICES_ARB       0x862F
2880#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E
2881#define GL_MAX_TEXTURE_COORDS_ARB         0x8871
2882#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB    0x8872
2883#define GL_PROGRAM_ERROR_STRING_ARB       0x8874
2884#define GL_MATRIX0_ARB                    0x88C0
2885#define GL_MATRIX1_ARB                    0x88C1
2886#define GL_MATRIX2_ARB                    0x88C2
2887#define GL_MATRIX3_ARB                    0x88C3
2888#define GL_MATRIX4_ARB                    0x88C4
2889#define GL_MATRIX5_ARB                    0x88C5
2890#define GL_MATRIX6_ARB                    0x88C6
2891#define GL_MATRIX7_ARB                    0x88C7
2892#define GL_MATRIX8_ARB                    0x88C8
2893#define GL_MATRIX9_ARB                    0x88C9
2894#define GL_MATRIX10_ARB                   0x88CA
2895#define GL_MATRIX11_ARB                   0x88CB
2896#define GL_MATRIX12_ARB                   0x88CC
2897#define GL_MATRIX13_ARB                   0x88CD
2898#define GL_MATRIX14_ARB                   0x88CE
2899#define GL_MATRIX15_ARB                   0x88CF
2900#define GL_MATRIX16_ARB                   0x88D0
2901#define GL_MATRIX17_ARB                   0x88D1
2902#define GL_MATRIX18_ARB                   0x88D2
2903#define GL_MATRIX19_ARB                   0x88D3
2904#define GL_MATRIX20_ARB                   0x88D4
2905#define GL_MATRIX21_ARB                   0x88D5
2906#define GL_MATRIX22_ARB                   0x88D6
2907#define GL_MATRIX23_ARB                   0x88D7
2908#define GL_MATRIX24_ARB                   0x88D8
2909#define GL_MATRIX25_ARB                   0x88D9
2910#define GL_MATRIX26_ARB                   0x88DA
2911#define GL_MATRIX27_ARB                   0x88DB
2912#define GL_MATRIX28_ARB                   0x88DC
2913#define GL_MATRIX29_ARB                   0x88DD
2914#define GL_MATRIX30_ARB                   0x88DE
2915#define GL_MATRIX31_ARB                   0x88DF
2916typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void *string);
2917typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
2918typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs);
2919typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs);
2920typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
2921typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
2922typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
2923typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
2924typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
2925typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
2926typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
2927typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
2928typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
2929typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
2930typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
2931typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
2932typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
2933typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void *string);
2934typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program);
2935#ifdef GL_GLEXT_PROTOTYPES
2936GLAPI void APIENTRY glProgramStringARB (GLenum target, GLenum format, GLsizei len, const void *string);
2937GLAPI void APIENTRY glBindProgramARB (GLenum target, GLuint program);
2938GLAPI void APIENTRY glDeleteProgramsARB (GLsizei n, const GLuint *programs);
2939GLAPI void APIENTRY glGenProgramsARB (GLsizei n, GLuint *programs);
2940GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
2941GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params);
2942GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
2943GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params);
2944GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
2945GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params);
2946GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
2947GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params);
2948GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params);
2949GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params);
2950GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params);
2951GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params);
2952GLAPI void APIENTRY glGetProgramivARB (GLenum target, GLenum pname, GLint *params);
2953GLAPI void APIENTRY glGetProgramStringARB (GLenum target, GLenum pname, void *string);
2954GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program);
2955#endif
2956#endif /* GL_ARB_fragment_program */
2957
2958#ifndef GL_ARB_fragment_program_shadow
2959#define GL_ARB_fragment_program_shadow 1
2960#endif /* GL_ARB_fragment_program_shadow */
2961
2962#ifndef GL_ARB_fragment_shader
2963#define GL_ARB_fragment_shader 1
2964#define GL_FRAGMENT_SHADER_ARB            0x8B30
2965#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
2966#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
2967#endif /* GL_ARB_fragment_shader */
2968
2969#ifndef GL_ARB_framebuffer_no_attachments
2970#define GL_ARB_framebuffer_no_attachments 1
2971#endif /* GL_ARB_framebuffer_no_attachments */
2972
2973#ifndef GL_ARB_framebuffer_object
2974#define GL_ARB_framebuffer_object 1
2975#endif /* GL_ARB_framebuffer_object */
2976
2977#ifndef GL_ARB_framebuffer_sRGB
2978#define GL_ARB_framebuffer_sRGB 1
2979#endif /* GL_ARB_framebuffer_sRGB */
2980
2981#ifndef GL_ARB_geometry_shader4
2982#define GL_ARB_geometry_shader4 1
2983#define GL_LINES_ADJACENCY_ARB            0x000A
2984#define GL_LINE_STRIP_ADJACENCY_ARB       0x000B
2985#define GL_TRIANGLES_ADJACENCY_ARB        0x000C
2986#define GL_TRIANGLE_STRIP_ADJACENCY_ARB   0x000D
2987#define GL_PROGRAM_POINT_SIZE_ARB         0x8642
2988#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29
2989#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7
2990#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8
2991#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9
2992#define GL_GEOMETRY_SHADER_ARB            0x8DD9
2993#define GL_GEOMETRY_VERTICES_OUT_ARB      0x8DDA
2994#define GL_GEOMETRY_INPUT_TYPE_ARB        0x8DDB
2995#define GL_GEOMETRY_OUTPUT_TYPE_ARB       0x8DDC
2996#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD
2997#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE
2998#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF
2999#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0
3000#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1
3001typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value);
3002typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
3003typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
3004typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
3005#ifdef GL_GLEXT_PROTOTYPES
3006GLAPI void APIENTRY glProgramParameteriARB (GLuint program, GLenum pname, GLint value);
3007GLAPI void APIENTRY glFramebufferTextureARB (GLenum target, GLenum attachment, GLuint texture, GLint level);
3008GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
3009GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
3010#endif
3011#endif /* GL_ARB_geometry_shader4 */
3012
3013#ifndef GL_ARB_get_program_binary
3014#define GL_ARB_get_program_binary 1
3015#endif /* GL_ARB_get_program_binary */
3016
3017#ifndef GL_ARB_gpu_shader5
3018#define GL_ARB_gpu_shader5 1
3019#endif /* GL_ARB_gpu_shader5 */
3020
3021#ifndef GL_ARB_gpu_shader_fp64
3022#define GL_ARB_gpu_shader_fp64 1
3023#endif /* GL_ARB_gpu_shader_fp64 */
3024
3025#ifndef GL_ARB_half_float_pixel
3026#define GL_ARB_half_float_pixel 1
3027typedef unsigned short GLhalfARB;
3028#define GL_HALF_FLOAT_ARB                 0x140B
3029#endif /* GL_ARB_half_float_pixel */
3030
3031#ifndef GL_ARB_half_float_vertex
3032#define GL_ARB_half_float_vertex 1
3033#endif /* GL_ARB_half_float_vertex */
3034
3035#ifndef GL_ARB_imaging
3036#define GL_ARB_imaging 1
3037#define GL_BLEND_COLOR                    0x8005
3038#define GL_BLEND_EQUATION                 0x8009
3039#define GL_CONVOLUTION_1D                 0x8010
3040#define GL_CONVOLUTION_2D                 0x8011
3041#define GL_SEPARABLE_2D                   0x8012
3042#define GL_CONVOLUTION_BORDER_MODE        0x8013
3043#define GL_CONVOLUTION_FILTER_SCALE       0x8014
3044#define GL_CONVOLUTION_FILTER_BIAS        0x8015
3045#define GL_REDUCE                         0x8016
3046#define GL_CONVOLUTION_FORMAT             0x8017
3047#define GL_CONVOLUTION_WIDTH              0x8018
3048#define GL_CONVOLUTION_HEIGHT             0x8019
3049#define GL_MAX_CONVOLUTION_WIDTH          0x801A
3050#define GL_MAX_CONVOLUTION_HEIGHT         0x801B
3051#define GL_POST_CONVOLUTION_RED_SCALE     0x801C
3052#define GL_POST_CONVOLUTION_GREEN_SCALE   0x801D
3053#define GL_POST_CONVOLUTION_BLUE_SCALE    0x801E
3054#define GL_POST_CONVOLUTION_ALPHA_SCALE   0x801F
3055#define GL_POST_CONVOLUTION_RED_BIAS      0x8020
3056#define GL_POST_CONVOLUTION_GREEN_BIAS    0x8021
3057#define GL_POST_CONVOLUTION_BLUE_BIAS     0x8022
3058#define GL_POST_CONVOLUTION_ALPHA_BIAS    0x8023
3059#define GL_HISTOGRAM                      0x8024
3060#define GL_PROXY_HISTOGRAM                0x8025
3061#define GL_HISTOGRAM_WIDTH                0x8026
3062#define GL_HISTOGRAM_FORMAT               0x8027
3063#define GL_HISTOGRAM_RED_SIZE             0x8028
3064#define GL_HISTOGRAM_GREEN_SIZE           0x8029
3065#define GL_HISTOGRAM_BLUE_SIZE            0x802A
3066#define GL_HISTOGRAM_ALPHA_SIZE           0x802B
3067#define GL_HISTOGRAM_LUMINANCE_SIZE       0x802C
3068#define GL_HISTOGRAM_SINK                 0x802D
3069#define GL_MINMAX                         0x802E
3070#define GL_MINMAX_FORMAT                  0x802F
3071#define GL_MINMAX_SINK                    0x8030
3072#define GL_TABLE_TOO_LARGE                0x8031
3073#define GL_COLOR_MATRIX                   0x80B1
3074#define GL_COLOR_MATRIX_STACK_DEPTH       0x80B2
3075#define GL_MAX_COLOR_MATRIX_STACK_DEPTH   0x80B3
3076#define GL_POST_COLOR_MATRIX_RED_SCALE    0x80B4
3077#define GL_POST_COLOR_MATRIX_GREEN_SCALE  0x80B5
3078#define GL_POST_COLOR_MATRIX_BLUE_SCALE   0x80B6
3079#define GL_POST_COLOR_MATRIX_ALPHA_SCALE  0x80B7
3080#define GL_POST_COLOR_MATRIX_RED_BIAS     0x80B8
3081#define GL_POST_COLOR_MATRIX_GREEN_BIAS   0x80B9
3082#define GL_POST_COLOR_MATRIX_BLUE_BIAS    0x80BA
3083#define GL_POST_COLOR_MATRIX_ALPHA_BIAS   0x80BB
3084#define GL_COLOR_TABLE                    0x80D0
3085#define GL_POST_CONVOLUTION_COLOR_TABLE   0x80D1
3086#define GL_POST_COLOR_MATRIX_COLOR_TABLE  0x80D2
3087#define GL_PROXY_COLOR_TABLE              0x80D3
3088#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
3089#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
3090#define GL_COLOR_TABLE_SCALE              0x80D6
3091#define GL_COLOR_TABLE_BIAS               0x80D7
3092#define GL_COLOR_TABLE_FORMAT             0x80D8
3093#define GL_COLOR_TABLE_WIDTH              0x80D9
3094#define GL_COLOR_TABLE_RED_SIZE           0x80DA
3095#define GL_COLOR_TABLE_GREEN_SIZE         0x80DB
3096#define GL_COLOR_TABLE_BLUE_SIZE          0x80DC
3097#define GL_COLOR_TABLE_ALPHA_SIZE         0x80DD
3098#define GL_COLOR_TABLE_LUMINANCE_SIZE     0x80DE
3099#define GL_COLOR_TABLE_INTENSITY_SIZE     0x80DF
3100#define GL_CONSTANT_BORDER                0x8151
3101#define GL_REPLICATE_BORDER               0x8153
3102#define GL_CONVOLUTION_BORDER_COLOR       0x8154
3103typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
3104typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
3105typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
3106typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
3107typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, void *table);
3108typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
3109typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
3110typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
3111typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
3112typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
3113typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
3114typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params);
3115typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
3116typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params);
3117typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
3118typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
3119typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
3120typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, void *image);
3121typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
3122typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
3123typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
3124typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
3125typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
3126typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
3127typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
3128typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
3129typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
3130typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
3131typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
3132typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);
3133typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target);
3134typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target);
3135#ifdef GL_GLEXT_PROTOTYPES
3136GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
3137GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params);
3138GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params);
3139GLAPI void APIENTRY glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
3140GLAPI void APIENTRY glGetColorTable (GLenum target, GLenum format, GLenum type, void *table);
3141GLAPI void APIENTRY glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params);
3142GLAPI void APIENTRY glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params);
3143GLAPI void APIENTRY glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
3144GLAPI void APIENTRY glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
3145GLAPI void APIENTRY glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
3146GLAPI void APIENTRY glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
3147GLAPI void APIENTRY glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params);
3148GLAPI void APIENTRY glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params);
3149GLAPI void APIENTRY glConvolutionParameteri (GLenum target, GLenum pname, GLint params);
3150GLAPI void APIENTRY glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params);
3151GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
3152GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
3153GLAPI void APIENTRY glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, void *image);
3154GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params);
3155GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params);
3156GLAPI void APIENTRY glGetSeparableFilter (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
3157GLAPI void APIENTRY glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
3158GLAPI void APIENTRY glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
3159GLAPI void APIENTRY glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params);
3160GLAPI void APIENTRY glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params);
3161GLAPI void APIENTRY glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
3162GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params);
3163GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params);
3164GLAPI void APIENTRY glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
3165GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean sink);
3166GLAPI void APIENTRY glResetHistogram (GLenum target);
3167GLAPI void APIENTRY glResetMinmax (GLenum target);
3168#endif
3169#endif /* GL_ARB_imaging */
3170
3171#ifndef GL_ARB_indirect_parameters
3172#define GL_ARB_indirect_parameters 1
3173#define GL_PARAMETER_BUFFER_ARB           0x80EE
3174#define GL_PARAMETER_BUFFER_BINDING_ARB   0x80EF
3175typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
3176typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
3177#ifdef GL_GLEXT_PROTOTYPES
3178GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
3179GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, GLintptr indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
3180#endif
3181#endif /* GL_ARB_indirect_parameters */
3182
3183#ifndef GL_ARB_instanced_arrays
3184#define GL_ARB_instanced_arrays 1
3185#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE
3186typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
3187#ifdef GL_GLEXT_PROTOTYPES
3188GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor);
3189#endif
3190#endif /* GL_ARB_instanced_arrays */
3191
3192#ifndef GL_ARB_internalformat_query
3193#define GL_ARB_internalformat_query 1
3194#endif /* GL_ARB_internalformat_query */
3195
3196#ifndef GL_ARB_internalformat_query2
3197#define GL_ARB_internalformat_query2 1
3198#define GL_SRGB_DECODE_ARB                0x8299
3199#endif /* GL_ARB_internalformat_query2 */
3200
3201#ifndef GL_ARB_invalidate_subdata
3202#define GL_ARB_invalidate_subdata 1
3203#endif /* GL_ARB_invalidate_subdata */
3204
3205#ifndef GL_ARB_map_buffer_alignment
3206#define GL_ARB_map_buffer_alignment 1
3207#endif /* GL_ARB_map_buffer_alignment */
3208
3209#ifndef GL_ARB_map_buffer_range
3210#define GL_ARB_map_buffer_range 1
3211#endif /* GL_ARB_map_buffer_range */
3212
3213#ifndef GL_ARB_matrix_palette
3214#define GL_ARB_matrix_palette 1
3215#define GL_MATRIX_PALETTE_ARB             0x8840
3216#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841
3217#define GL_MAX_PALETTE_MATRICES_ARB       0x8842
3218#define GL_CURRENT_PALETTE_MATRIX_ARB     0x8843
3219#define GL_MATRIX_INDEX_ARRAY_ARB         0x8844
3220#define GL_CURRENT_MATRIX_INDEX_ARB       0x8845
3221#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB    0x8846
3222#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB    0x8847
3223#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB  0x8848
3224#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849
3225typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index);
3226typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices);
3227typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices);
3228typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices);
3229typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
3230#ifdef GL_GLEXT_PROTOTYPES
3231GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint index);
3232GLAPI void APIENTRY glMatrixIndexubvARB (GLint size, const GLubyte *indices);
3233GLAPI void APIENTRY glMatrixIndexusvARB (GLint size, const GLushort *indices);
3234GLAPI void APIENTRY glMatrixIndexuivARB (GLint size, const GLuint *indices);
3235GLAPI void APIENTRY glMatrixIndexPointerARB (GLint size, GLenum type, GLsizei stride, const void *pointer);
3236#endif
3237#endif /* GL_ARB_matrix_palette */
3238
3239#ifndef GL_ARB_multi_bind
3240#define GL_ARB_multi_bind 1
3241#endif /* GL_ARB_multi_bind */
3242
3243#ifndef GL_ARB_multi_draw_indirect
3244#define GL_ARB_multi_draw_indirect 1
3245#endif /* GL_ARB_multi_draw_indirect */
3246
3247#ifndef GL_ARB_multisample
3248#define GL_ARB_multisample 1
3249#define GL_MULTISAMPLE_ARB                0x809D
3250#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB   0x809E
3251#define GL_SAMPLE_ALPHA_TO_ONE_ARB        0x809F
3252#define GL_SAMPLE_COVERAGE_ARB            0x80A0
3253#define GL_SAMPLE_BUFFERS_ARB             0x80A8
3254#define GL_SAMPLES_ARB                    0x80A9
3255#define GL_SAMPLE_COVERAGE_VALUE_ARB      0x80AA
3256#define GL_SAMPLE_COVERAGE_INVERT_ARB     0x80AB
3257#define GL_MULTISAMPLE_BIT_ARB            0x20000000
3258typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLfloat value, GLboolean invert);
3259#ifdef GL_GLEXT_PROTOTYPES
3260GLAPI void APIENTRY glSampleCoverageARB (GLfloat value, GLboolean invert);
3261#endif
3262#endif /* GL_ARB_multisample */
3263
3264#ifndef GL_ARB_multitexture
3265#define GL_ARB_multitexture 1
3266#define GL_TEXTURE0_ARB                   0x84C0
3267#define GL_TEXTURE1_ARB                   0x84C1
3268#define GL_TEXTURE2_ARB                   0x84C2
3269#define GL_TEXTURE3_ARB                   0x84C3
3270#define GL_TEXTURE4_ARB                   0x84C4
3271#define GL_TEXTURE5_ARB                   0x84C5
3272#define GL_TEXTURE6_ARB                   0x84C6
3273#define GL_TEXTURE7_ARB                   0x84C7
3274#define GL_TEXTURE8_ARB                   0x84C8
3275#define GL_TEXTURE9_ARB                   0x84C9
3276#define GL_TEXTURE10_ARB                  0x84CA
3277#define GL_TEXTURE11_ARB                  0x84CB
3278#define GL_TEXTURE12_ARB                  0x84CC
3279#define GL_TEXTURE13_ARB                  0x84CD
3280#define GL_TEXTURE14_ARB                  0x84CE
3281#define GL_TEXTURE15_ARB                  0x84CF
3282#define GL_TEXTURE16_ARB                  0x84D0
3283#define GL_TEXTURE17_ARB                  0x84D1
3284#define GL_TEXTURE18_ARB                  0x84D2
3285#define GL_TEXTURE19_ARB                  0x84D3
3286#define GL_TEXTURE20_ARB                  0x84D4
3287#define GL_TEXTURE21_ARB                  0x84D5
3288#define GL_TEXTURE22_ARB                  0x84D6
3289#define GL_TEXTURE23_ARB                  0x84D7
3290#define GL_TEXTURE24_ARB                  0x84D8
3291#define GL_TEXTURE25_ARB                  0x84D9
3292#define GL_TEXTURE26_ARB                  0x84DA
3293#define GL_TEXTURE27_ARB                  0x84DB
3294#define GL_TEXTURE28_ARB                  0x84DC
3295#define GL_TEXTURE29_ARB                  0x84DD
3296#define GL_TEXTURE30_ARB                  0x84DE
3297#define GL_TEXTURE31_ARB                  0x84DF
3298#define GL_ACTIVE_TEXTURE_ARB             0x84E0
3299#define GL_CLIENT_ACTIVE_TEXTURE_ARB      0x84E1
3300#define GL_MAX_TEXTURE_UNITS_ARB          0x84E2
3301typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
3302typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
3303typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
3304typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
3305typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
3306typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
3307typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
3308typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
3309typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
3310typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
3311typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
3312typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
3313typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
3314typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
3315typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
3316typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
3317typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
3318typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
3319typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
3320typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
3321typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
3322typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
3323typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
3324typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
3325typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
3326typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
3327typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
3328typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
3329typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
3330typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
3331typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
3332typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
3333typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
3334typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
3335#ifdef GL_GLEXT_PROTOTYPES
3336GLAPI void APIENTRY glActiveTextureARB (GLenum texture);
3337GLAPI void APIENTRY glClientActiveTextureARB (GLenum texture);
3338GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum target, GLdouble s);
3339GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum target, const GLdouble *v);
3340GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum target, GLfloat s);
3341GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum target, const GLfloat *v);
3342GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum target, GLint s);
3343GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum target, const GLint *v);
3344GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum target, GLshort s);
3345GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum target, const GLshort *v);
3346GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t);
3347GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum target, const GLdouble *v);
3348GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t);
3349GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum target, const GLfloat *v);
3350GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum target, GLint s, GLint t);
3351GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum target, const GLint *v);
3352GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t);
3353GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum target, const GLshort *v);
3354GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r);
3355GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum target, const GLdouble *v);
3356GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r);
3357GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum target, const GLfloat *v);
3358GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r);
3359GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum target, const GLint *v);
3360GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r);
3361GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum target, const GLshort *v);
3362GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
3363GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum target, const GLdouble *v);
3364GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
3365GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum target, const GLfloat *v);
3366GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q);
3367GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum target, const GLint *v);
3368GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
3369GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum target, const GLshort *v);
3370#endif
3371#endif /* GL_ARB_multitexture */
3372
3373#ifndef GL_ARB_occlusion_query
3374#define GL_ARB_occlusion_query 1
3375#define GL_QUERY_COUNTER_BITS_ARB         0x8864
3376#define GL_CURRENT_QUERY_ARB              0x8865
3377#define GL_QUERY_RESULT_ARB               0x8866
3378#define GL_QUERY_RESULT_AVAILABLE_ARB     0x8867
3379#define GL_SAMPLES_PASSED_ARB             0x8914
3380typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids);
3381typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids);
3382typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id);
3383typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id);
3384typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target);
3385typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params);
3386typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params);
3387typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params);
3388#ifdef GL_GLEXT_PROTOTYPES
3389GLAPI void APIENTRY glGenQueriesARB (GLsizei n, GLuint *ids);
3390GLAPI void APIENTRY glDeleteQueriesARB (GLsizei n, const GLuint *ids);
3391GLAPI GLboolean APIENTRY glIsQueryARB (GLuint id);
3392GLAPI void APIENTRY glBeginQueryARB (GLenum target, GLuint id);
3393GLAPI void APIENTRY glEndQueryARB (GLenum target);
3394GLAPI void APIENTRY glGetQueryivARB (GLenum target, GLenum pname, GLint *params);
3395GLAPI void APIENTRY glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params);
3396GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params);
3397#endif
3398#endif /* GL_ARB_occlusion_query */
3399
3400#ifndef GL_ARB_occlusion_query2
3401#define GL_ARB_occlusion_query2 1
3402#endif /* GL_ARB_occlusion_query2 */
3403
3404#ifndef GL_ARB_pixel_buffer_object
3405#define GL_ARB_pixel_buffer_object 1
3406#define GL_PIXEL_PACK_BUFFER_ARB          0x88EB
3407#define GL_PIXEL_UNPACK_BUFFER_ARB        0x88EC
3408#define GL_PIXEL_PACK_BUFFER_BINDING_ARB  0x88ED
3409#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF
3410#endif /* GL_ARB_pixel_buffer_object */
3411
3412#ifndef GL_ARB_point_parameters
3413#define GL_ARB_point_parameters 1
3414#define GL_POINT_SIZE_MIN_ARB             0x8126
3415#define GL_POINT_SIZE_MAX_ARB             0x8127
3416#define GL_POINT_FADE_THRESHOLD_SIZE_ARB  0x8128
3417#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129
3418typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param);
3419typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params);
3420#ifdef GL_GLEXT_PROTOTYPES
3421GLAPI void APIENTRY glPointParameterfARB (GLenum pname, GLfloat param);
3422GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params);
3423#endif
3424#endif /* GL_ARB_point_parameters */
3425
3426#ifndef GL_ARB_point_sprite
3427#define GL_ARB_point_sprite 1
3428#define GL_POINT_SPRITE_ARB               0x8861
3429#define GL_COORD_REPLACE_ARB              0x8862
3430#endif /* GL_ARB_point_sprite */
3431
3432#ifndef GL_ARB_program_interface_query
3433#define GL_ARB_program_interface_query 1
3434#endif /* GL_ARB_program_interface_query */
3435
3436#ifndef GL_ARB_provoking_vertex
3437#define GL_ARB_provoking_vertex 1
3438#endif /* GL_ARB_provoking_vertex */
3439
3440#ifndef GL_ARB_query_buffer_object
3441#define GL_ARB_query_buffer_object 1
3442#endif /* GL_ARB_query_buffer_object */
3443
3444#ifndef GL_ARB_robust_buffer_access_behavior
3445#define GL_ARB_robust_buffer_access_behavior 1
3446#endif /* GL_ARB_robust_buffer_access_behavior */
3447
3448#ifndef GL_ARB_robustness
3449#define GL_ARB_robustness 1
3450#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004
3451#define GL_LOSE_CONTEXT_ON_RESET_ARB      0x8252
3452#define GL_GUILTY_CONTEXT_RESET_ARB       0x8253
3453#define GL_INNOCENT_CONTEXT_RESET_ARB     0x8254
3454#define GL_UNKNOWN_CONTEXT_RESET_ARB      0x8255
3455#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
3456#define GL_NO_RESET_NOTIFICATION_ARB      0x8261
3457typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void);
3458typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img);
3459typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
3460typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void *img);
3461typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
3462typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
3463typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
3464typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
3465typedef void (APIENTRYP PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
3466typedef void (APIENTRYP PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
3467typedef void (APIENTRYP PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v);
3468typedef void (APIENTRYP PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values);
3469typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values);
3470typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values);
3471typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern);
3472typedef void (APIENTRYP PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table);
3473typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image);
3474typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span);
3475typedef void (APIENTRYP PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
3476typedef void (APIENTRYP PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
3477#ifdef GL_GLEXT_PROTOTYPES
3478GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void);
3479GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img);
3480GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
3481GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, void *img);
3482GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
3483GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params);
3484GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
3485GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
3486GLAPI void APIENTRY glGetnMapdvARB (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
3487GLAPI void APIENTRY glGetnMapfvARB (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
3488GLAPI void APIENTRY glGetnMapivARB (GLenum target, GLenum query, GLsizei bufSize, GLint *v);
3489GLAPI void APIENTRY glGetnPixelMapfvARB (GLenum map, GLsizei bufSize, GLfloat *values);
3490GLAPI void APIENTRY glGetnPixelMapuivARB (GLenum map, GLsizei bufSize, GLuint *values);
3491GLAPI void APIENTRY glGetnPixelMapusvARB (GLenum map, GLsizei bufSize, GLushort *values);
3492GLAPI void APIENTRY glGetnPolygonStippleARB (GLsizei bufSize, GLubyte *pattern);
3493GLAPI void APIENTRY glGetnColorTableARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table);
3494GLAPI void APIENTRY glGetnConvolutionFilterARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image);
3495GLAPI void APIENTRY glGetnSeparableFilterARB (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span);
3496GLAPI void APIENTRY glGetnHistogramARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
3497GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
3498#endif
3499#endif /* GL_ARB_robustness */
3500
3501#ifndef GL_ARB_robustness_isolation
3502#define GL_ARB_robustness_isolation 1
3503#endif /* GL_ARB_robustness_isolation */
3504
3505#ifndef GL_ARB_sample_shading
3506#define GL_ARB_sample_shading 1
3507#define GL_SAMPLE_SHADING_ARB             0x8C36
3508#define GL_MIN_SAMPLE_SHADING_VALUE_ARB   0x8C37
3509typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value);
3510#ifdef GL_GLEXT_PROTOTYPES
3511GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value);
3512#endif
3513#endif /* GL_ARB_sample_shading */
3514
3515#ifndef GL_ARB_sampler_objects
3516#define GL_ARB_sampler_objects 1
3517#endif /* GL_ARB_sampler_objects */
3518
3519#ifndef GL_ARB_seamless_cube_map
3520#define GL_ARB_seamless_cube_map 1
3521#endif /* GL_ARB_seamless_cube_map */
3522
3523#ifndef GL_ARB_seamless_cubemap_per_texture
3524#define GL_ARB_seamless_cubemap_per_texture 1
3525#endif /* GL_ARB_seamless_cubemap_per_texture */
3526
3527#ifndef GL_ARB_separate_shader_objects
3528#define GL_ARB_separate_shader_objects 1
3529#endif /* GL_ARB_separate_shader_objects */
3530
3531#ifndef GL_ARB_shader_atomic_counters
3532#define GL_ARB_shader_atomic_counters 1
3533#endif /* GL_ARB_shader_atomic_counters */
3534
3535#ifndef GL_ARB_shader_bit_encoding
3536#define GL_ARB_shader_bit_encoding 1
3537#endif /* GL_ARB_shader_bit_encoding */
3538
3539#ifndef GL_ARB_shader_draw_parameters
3540#define GL_ARB_shader_draw_parameters 1
3541#endif /* GL_ARB_shader_draw_parameters */
3542
3543#ifndef GL_ARB_shader_group_vote
3544#define GL_ARB_shader_group_vote 1
3545#endif /* GL_ARB_shader_group_vote */
3546
3547#ifndef GL_ARB_shader_image_load_store
3548#define GL_ARB_shader_image_load_store 1
3549#endif /* GL_ARB_shader_image_load_store */
3550
3551#ifndef GL_ARB_shader_image_size
3552#define GL_ARB_shader_image_size 1
3553#endif /* GL_ARB_shader_image_size */
3554
3555#ifndef GL_ARB_shader_objects
3556#define GL_ARB_shader_objects 1
3557#ifdef __APPLE__
3558typedef void *GLhandleARB;
3559#else
3560typedef unsigned int GLhandleARB;
3561#endif
3562typedef char GLcharARB;
3563#define GL_PROGRAM_OBJECT_ARB             0x8B40
3564#define GL_SHADER_OBJECT_ARB              0x8B48
3565#define GL_OBJECT_TYPE_ARB                0x8B4E
3566#define GL_OBJECT_SUBTYPE_ARB             0x8B4F
3567#define GL_FLOAT_VEC2_ARB                 0x8B50
3568#define GL_FLOAT_VEC3_ARB                 0x8B51
3569#define GL_FLOAT_VEC4_ARB                 0x8B52
3570#define GL_INT_VEC2_ARB                   0x8B53
3571#define GL_INT_VEC3_ARB                   0x8B54
3572#define GL_INT_VEC4_ARB                   0x8B55
3573#define GL_BOOL_ARB                       0x8B56
3574#define GL_BOOL_VEC2_ARB                  0x8B57
3575#define GL_BOOL_VEC3_ARB                  0x8B58
3576#define GL_BOOL_VEC4_ARB                  0x8B59
3577#define GL_FLOAT_MAT2_ARB                 0x8B5A
3578#define GL_FLOAT_MAT3_ARB                 0x8B5B
3579#define GL_FLOAT_MAT4_ARB                 0x8B5C
3580#define GL_SAMPLER_1D_ARB                 0x8B5D
3581#define GL_SAMPLER_2D_ARB                 0x8B5E
3582#define GL_SAMPLER_3D_ARB                 0x8B5F
3583#define GL_SAMPLER_CUBE_ARB               0x8B60
3584#define GL_SAMPLER_1D_SHADOW_ARB          0x8B61
3585#define GL_SAMPLER_2D_SHADOW_ARB          0x8B62
3586#define GL_SAMPLER_2D_RECT_ARB            0x8B63
3587#define GL_SAMPLER_2D_RECT_SHADOW_ARB     0x8B64
3588#define GL_OBJECT_DELETE_STATUS_ARB       0x8B80
3589#define GL_OBJECT_COMPILE_STATUS_ARB      0x8B81
3590#define GL_OBJECT_LINK_STATUS_ARB         0x8B82
3591#define GL_OBJECT_VALIDATE_STATUS_ARB     0x8B83
3592#define GL_OBJECT_INFO_LOG_LENGTH_ARB     0x8B84
3593#define GL_OBJECT_ATTACHED_OBJECTS_ARB    0x8B85
3594#define GL_OBJECT_ACTIVE_UNIFORMS_ARB     0x8B86
3595#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
3596#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88
3597typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);
3598typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname);
3599typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj);
3600typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType);
3601typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length);
3602typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj);
3603typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void);
3604typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj);
3605typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj);
3606typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj);
3607typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj);
3608typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0);
3609typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1);
3610typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
3611typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
3612typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);
3613typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1);
3614typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);
3615typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
3616typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
3617typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
3618typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
3619typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
3620typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value);
3621typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value);
3622typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value);
3623typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value);
3624typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
3625typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
3626typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
3627typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params);
3628typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params);
3629typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
3630typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
3631typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
3632typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
3633typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params);
3634typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params);
3635typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
3636#ifdef GL_GLEXT_PROTOTYPES
3637GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB obj);
3638GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum pname);
3639GLAPI void APIENTRY glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj);
3640GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum shaderType);
3641GLAPI void APIENTRY glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length);
3642GLAPI void APIENTRY glCompileShaderARB (GLhandleARB shaderObj);
3643GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void);
3644GLAPI void APIENTRY glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj);
3645GLAPI void APIENTRY glLinkProgramARB (GLhandleARB programObj);
3646GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB programObj);
3647GLAPI void APIENTRY glValidateProgramARB (GLhandleARB programObj);
3648GLAPI void APIENTRY glUniform1fARB (GLint location, GLfloat v0);
3649GLAPI void APIENTRY glUniform2fARB (GLint location, GLfloat v0, GLfloat v1);
3650GLAPI void APIENTRY glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
3651GLAPI void APIENTRY glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
3652GLAPI void APIENTRY glUniform1iARB (GLint location, GLint v0);
3653GLAPI void APIENTRY glUniform2iARB (GLint location, GLint v0, GLint v1);
3654GLAPI void APIENTRY glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2);
3655GLAPI void APIENTRY glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
3656GLAPI void APIENTRY glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value);
3657GLAPI void APIENTRY glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value);
3658GLAPI void APIENTRY glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value);
3659GLAPI void APIENTRY glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value);
3660GLAPI void APIENTRY glUniform1ivARB (GLint location, GLsizei count, const GLint *value);
3661GLAPI void APIENTRY glUniform2ivARB (GLint location, GLsizei count, const GLint *value);
3662GLAPI void APIENTRY glUniform3ivARB (GLint location, GLsizei count, const GLint *value);
3663GLAPI void APIENTRY glUniform4ivARB (GLint location, GLsizei count, const GLint *value);
3664GLAPI void APIENTRY glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
3665GLAPI void APIENTRY glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
3666GLAPI void APIENTRY glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
3667GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params);
3668GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params);
3669GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
3670GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
3671GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name);
3672GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
3673GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params);
3674GLAPI void APIENTRY glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params);
3675GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
3676#endif
3677#endif /* GL_ARB_shader_objects */
3678
3679#ifndef GL_ARB_shader_precision
3680#define GL_ARB_shader_precision 1
3681#endif /* GL_ARB_shader_precision */
3682
3683#ifndef GL_ARB_shader_stencil_export
3684#define GL_ARB_shader_stencil_export 1
3685#endif /* GL_ARB_shader_stencil_export */
3686
3687#ifndef GL_ARB_shader_storage_buffer_object
3688#define GL_ARB_shader_storage_buffer_object 1
3689#endif /* GL_ARB_shader_storage_buffer_object */
3690
3691#ifndef GL_ARB_shader_subroutine
3692#define GL_ARB_shader_subroutine 1
3693#endif /* GL_ARB_shader_subroutine */
3694
3695#ifndef GL_ARB_shader_texture_lod
3696#define GL_ARB_shader_texture_lod 1
3697#endif /* GL_ARB_shader_texture_lod */
3698
3699#ifndef GL_ARB_shading_language_100
3700#define GL_ARB_shading_language_100 1
3701#define GL_SHADING_LANGUAGE_VERSION_ARB   0x8B8C
3702#endif /* GL_ARB_shading_language_100 */
3703
3704#ifndef GL_ARB_shading_language_420pack
3705#define GL_ARB_shading_language_420pack 1
3706#endif /* GL_ARB_shading_language_420pack */
3707
3708#ifndef GL_ARB_shading_language_include
3709#define GL_ARB_shading_language_include 1
3710#define GL_SHADER_INCLUDE_ARB             0x8DAE
3711#define GL_NAMED_STRING_LENGTH_ARB        0x8DE9
3712#define GL_NAMED_STRING_TYPE_ARB          0x8DEA
3713typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
3714typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
3715typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length);
3716typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
3717typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
3718typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
3719#ifdef GL_GLEXT_PROTOTYPES
3720GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
3721GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name);
3722GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length);
3723GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name);
3724GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
3725GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
3726#endif
3727#endif /* GL_ARB_shading_language_include */
3728
3729#ifndef GL_ARB_shading_language_packing
3730#define GL_ARB_shading_language_packing 1
3731#endif /* GL_ARB_shading_language_packing */
3732
3733#ifndef GL_ARB_shadow
3734#define GL_ARB_shadow 1
3735#define GL_TEXTURE_COMPARE_MODE_ARB       0x884C
3736#define GL_TEXTURE_COMPARE_FUNC_ARB       0x884D
3737#define GL_COMPARE_R_TO_TEXTURE_ARB       0x884E
3738#endif /* GL_ARB_shadow */
3739
3740#ifndef GL_ARB_shadow_ambient
3741#define GL_ARB_shadow_ambient 1
3742#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF
3743#endif /* GL_ARB_shadow_ambient */
3744
3745#ifndef GL_ARB_sparse_texture
3746#define GL_ARB_sparse_texture 1
3747#define GL_TEXTURE_SPARSE_ARB             0x91A6
3748#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB    0x91A7
3749#define GL_MIN_SPARSE_LEVEL_ARB           0x919B
3750#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB     0x91A8
3751#define GL_VIRTUAL_PAGE_SIZE_X_ARB        0x9195
3752#define GL_VIRTUAL_PAGE_SIZE_Y_ARB        0x9196
3753#define GL_VIRTUAL_PAGE_SIZE_Z_ARB        0x9197
3754#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB    0x9198
3755#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199
3756#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A
3757#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9
3758typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident);
3759#ifdef GL_GLEXT_PROTOTYPES
3760GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident);
3761#endif
3762#endif /* GL_ARB_sparse_texture */
3763
3764#ifndef GL_ARB_stencil_texturing
3765#define GL_ARB_stencil_texturing 1
3766#endif /* GL_ARB_stencil_texturing */
3767
3768#ifndef GL_ARB_sync
3769#define GL_ARB_sync 1
3770#endif /* GL_ARB_sync */
3771
3772#ifndef GL_ARB_tessellation_shader
3773#define GL_ARB_tessellation_shader 1
3774#endif /* GL_ARB_tessellation_shader */
3775
3776#ifndef GL_ARB_texture_border_clamp
3777#define GL_ARB_texture_border_clamp 1
3778#define GL_CLAMP_TO_BORDER_ARB            0x812D
3779#endif /* GL_ARB_texture_border_clamp */
3780
3781#ifndef GL_ARB_texture_buffer_object
3782#define GL_ARB_texture_buffer_object 1
3783#define GL_TEXTURE_BUFFER_ARB             0x8C2A
3784#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB    0x8C2B
3785#define GL_TEXTURE_BINDING_BUFFER_ARB     0x8C2C
3786#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D
3787#define GL_TEXTURE_BUFFER_FORMAT_ARB      0x8C2E
3788typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer);
3789#ifdef GL_GLEXT_PROTOTYPES
3790GLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint buffer);
3791#endif
3792#endif /* GL_ARB_texture_buffer_object */
3793
3794#ifndef GL_ARB_texture_buffer_object_rgb32
3795#define GL_ARB_texture_buffer_object_rgb32 1
3796#endif /* GL_ARB_texture_buffer_object_rgb32 */
3797
3798#ifndef GL_ARB_texture_buffer_range
3799#define GL_ARB_texture_buffer_range 1
3800#endif /* GL_ARB_texture_buffer_range */
3801
3802#ifndef GL_ARB_texture_compression
3803#define GL_ARB_texture_compression 1
3804#define GL_COMPRESSED_ALPHA_ARB           0x84E9
3805#define GL_COMPRESSED_LUMINANCE_ARB       0x84EA
3806#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB
3807#define GL_COMPRESSED_INTENSITY_ARB       0x84EC
3808#define GL_COMPRESSED_RGB_ARB             0x84ED
3809#define GL_COMPRESSED_RGBA_ARB            0x84EE
3810#define GL_TEXTURE_COMPRESSION_HINT_ARB   0x84EF
3811#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0
3812#define GL_TEXTURE_COMPRESSED_ARB         0x86A1
3813#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
3814#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
3815typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
3816typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
3817typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
3818typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
3819typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
3820typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
3821typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img);
3822#ifdef GL_GLEXT_PROTOTYPES
3823GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
3824GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
3825GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
3826GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
3827GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
3828GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
3829GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void *img);
3830#endif
3831#endif /* GL_ARB_texture_compression */
3832
3833#ifndef GL_ARB_texture_compression_bptc
3834#define GL_ARB_texture_compression_bptc 1
3835#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
3836#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
3837#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
3838#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
3839#endif /* GL_ARB_texture_compression_bptc */
3840
3841#ifndef GL_ARB_texture_compression_rgtc
3842#define GL_ARB_texture_compression_rgtc 1
3843#endif /* GL_ARB_texture_compression_rgtc */
3844
3845#ifndef GL_ARB_texture_cube_map
3846#define GL_ARB_texture_cube_map 1
3847#define GL_NORMAL_MAP_ARB                 0x8511
3848#define GL_REFLECTION_MAP_ARB             0x8512
3849#define GL_TEXTURE_CUBE_MAP_ARB           0x8513
3850#define GL_TEXTURE_BINDING_CUBE_MAP_ARB   0x8514
3851#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515
3852#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516
3853#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517
3854#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518
3855#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519
3856#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
3857#define GL_PROXY_TEXTURE_CUBE_MAP_ARB     0x851B
3858#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB  0x851C
3859#endif /* GL_ARB_texture_cube_map */
3860
3861#ifndef GL_ARB_texture_cube_map_array
3862#define GL_ARB_texture_cube_map_array 1
3863#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB     0x9009
3864#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A
3865#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B
3866#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB     0x900C
3867#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
3868#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E
3869#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F
3870#endif /* GL_ARB_texture_cube_map_array */
3871
3872#ifndef GL_ARB_texture_env_add
3873#define GL_ARB_texture_env_add 1
3874#endif /* GL_ARB_texture_env_add */
3875
3876#ifndef GL_ARB_texture_env_combine
3877#define GL_ARB_texture_env_combine 1
3878#define GL_COMBINE_ARB                    0x8570
3879#define GL_COMBINE_RGB_ARB                0x8571
3880#define GL_COMBINE_ALPHA_ARB              0x8572
3881#define GL_SOURCE0_RGB_ARB                0x8580
3882#define GL_SOURCE1_RGB_ARB                0x8581
3883#define GL_SOURCE2_RGB_ARB                0x8582
3884#define GL_SOURCE0_ALPHA_ARB              0x8588
3885#define GL_SOURCE1_ALPHA_ARB              0x8589
3886#define GL_SOURCE2_ALPHA_ARB              0x858A
3887#define GL_OPERAND0_RGB_ARB               0x8590
3888#define GL_OPERAND1_RGB_ARB               0x8591
3889#define GL_OPERAND2_RGB_ARB               0x8592
3890#define GL_OPERAND0_ALPHA_ARB             0x8598
3891#define GL_OPERAND1_ALPHA_ARB             0x8599
3892#define GL_OPERAND2_ALPHA_ARB             0x859A
3893#define GL_RGB_SCALE_ARB                  0x8573
3894#define GL_ADD_SIGNED_ARB                 0x8574
3895#define GL_INTERPOLATE_ARB                0x8575
3896#define GL_SUBTRACT_ARB                   0x84E7
3897#define GL_CONSTANT_ARB                   0x8576
3898#define GL_PRIMARY_COLOR_ARB              0x8577
3899#define GL_PREVIOUS_ARB                   0x8578
3900#endif /* GL_ARB_texture_env_combine */
3901
3902#ifndef GL_ARB_texture_env_crossbar
3903#define GL_ARB_texture_env_crossbar 1
3904#endif /* GL_ARB_texture_env_crossbar */
3905
3906#ifndef GL_ARB_texture_env_dot3
3907#define GL_ARB_texture_env_dot3 1
3908#define GL_DOT3_RGB_ARB                   0x86AE
3909#define GL_DOT3_RGBA_ARB                  0x86AF
3910#endif /* GL_ARB_texture_env_dot3 */
3911
3912#ifndef GL_ARB_texture_float
3913#define GL_ARB_texture_float 1
3914#define GL_TEXTURE_RED_TYPE_ARB           0x8C10
3915#define GL_TEXTURE_GREEN_TYPE_ARB         0x8C11
3916#define GL_TEXTURE_BLUE_TYPE_ARB          0x8C12
3917#define GL_TEXTURE_ALPHA_TYPE_ARB         0x8C13
3918#define GL_TEXTURE_LUMINANCE_TYPE_ARB     0x8C14
3919#define GL_TEXTURE_INTENSITY_TYPE_ARB     0x8C15
3920#define GL_TEXTURE_DEPTH_TYPE_ARB         0x8C16
3921#define GL_UNSIGNED_NORMALIZED_ARB        0x8C17
3922#define GL_RGBA32F_ARB                    0x8814
3923#define GL_RGB32F_ARB                     0x8815
3924#define GL_ALPHA32F_ARB                   0x8816
3925#define GL_INTENSITY32F_ARB               0x8817
3926#define GL_LUMINANCE32F_ARB               0x8818
3927#define GL_LUMINANCE_ALPHA32F_ARB         0x8819
3928#define GL_RGBA16F_ARB                    0x881A
3929#define GL_RGB16F_ARB                     0x881B
3930#define GL_ALPHA16F_ARB                   0x881C
3931#define GL_INTENSITY16F_ARB               0x881D
3932#define GL_LUMINANCE16F_ARB               0x881E
3933#define GL_LUMINANCE_ALPHA16F_ARB         0x881F
3934#endif /* GL_ARB_texture_float */
3935
3936#ifndef GL_ARB_texture_gather
3937#define GL_ARB_texture_gather 1
3938#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E
3939#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F
3940#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F
3941#endif /* GL_ARB_texture_gather */
3942
3943#ifndef GL_ARB_texture_mirror_clamp_to_edge
3944#define GL_ARB_texture_mirror_clamp_to_edge 1
3945#endif /* GL_ARB_texture_mirror_clamp_to_edge */
3946
3947#ifndef GL_ARB_texture_mirrored_repeat
3948#define GL_ARB_texture_mirrored_repeat 1
3949#define GL_MIRRORED_REPEAT_ARB            0x8370
3950#endif /* GL_ARB_texture_mirrored_repeat */
3951
3952#ifndef GL_ARB_texture_multisample
3953#define GL_ARB_texture_multisample 1
3954#endif /* GL_ARB_texture_multisample */
3955
3956#ifndef GL_ARB_texture_non_power_of_two
3957#define GL_ARB_texture_non_power_of_two 1
3958#endif /* GL_ARB_texture_non_power_of_two */
3959
3960#ifndef GL_ARB_texture_query_levels
3961#define GL_ARB_texture_query_levels 1
3962#endif /* GL_ARB_texture_query_levels */
3963
3964#ifndef GL_ARB_texture_query_lod
3965#define GL_ARB_texture_query_lod 1
3966#endif /* GL_ARB_texture_query_lod */
3967
3968#ifndef GL_ARB_texture_rectangle
3969#define GL_ARB_texture_rectangle 1
3970#define GL_TEXTURE_RECTANGLE_ARB          0x84F5
3971#define GL_TEXTURE_BINDING_RECTANGLE_ARB  0x84F6
3972#define GL_PROXY_TEXTURE_RECTANGLE_ARB    0x84F7
3973#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8
3974#endif /* GL_ARB_texture_rectangle */
3975
3976#ifndef GL_ARB_texture_rg
3977#define GL_ARB_texture_rg 1
3978#endif /* GL_ARB_texture_rg */
3979
3980#ifndef GL_ARB_texture_rgb10_a2ui
3981#define GL_ARB_texture_rgb10_a2ui 1
3982#endif /* GL_ARB_texture_rgb10_a2ui */
3983
3984#ifndef GL_ARB_texture_stencil8
3985#define GL_ARB_texture_stencil8 1
3986#endif /* GL_ARB_texture_stencil8 */
3987
3988#ifndef GL_ARB_texture_storage
3989#define GL_ARB_texture_storage 1
3990#endif /* GL_ARB_texture_storage */
3991
3992#ifndef GL_ARB_texture_storage_multisample
3993#define GL_ARB_texture_storage_multisample 1
3994#endif /* GL_ARB_texture_storage_multisample */
3995
3996#ifndef GL_ARB_texture_swizzle
3997#define GL_ARB_texture_swizzle 1
3998#endif /* GL_ARB_texture_swizzle */
3999
4000#ifndef GL_ARB_texture_view
4001#define GL_ARB_texture_view 1
4002#endif /* GL_ARB_texture_view */
4003
4004#ifndef GL_ARB_timer_query
4005#define GL_ARB_timer_query 1
4006#endif /* GL_ARB_timer_query */
4007
4008#ifndef GL_ARB_transform_feedback2
4009#define GL_ARB_transform_feedback2 1
4010#define GL_TRANSFORM_FEEDBACK_PAUSED      0x8E23
4011#define GL_TRANSFORM_FEEDBACK_ACTIVE      0x8E24
4012#endif /* GL_ARB_transform_feedback2 */
4013
4014#ifndef GL_ARB_transform_feedback3
4015#define GL_ARB_transform_feedback3 1
4016#endif /* GL_ARB_transform_feedback3 */
4017
4018#ifndef GL_ARB_transform_feedback_instanced
4019#define GL_ARB_transform_feedback_instanced 1
4020#endif /* GL_ARB_transform_feedback_instanced */
4021
4022#ifndef GL_ARB_transpose_matrix
4023#define GL_ARB_transpose_matrix 1
4024#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3
4025#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4
4026#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB   0x84E5
4027#define GL_TRANSPOSE_COLOR_MATRIX_ARB     0x84E6
4028typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);
4029typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
4030typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);
4031typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
4032#ifdef GL_GLEXT_PROTOTYPES
4033GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *m);
4034GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *m);
4035GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *m);
4036GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m);
4037#endif
4038#endif /* GL_ARB_transpose_matrix */
4039
4040#ifndef GL_ARB_uniform_buffer_object
4041#define GL_ARB_uniform_buffer_object 1
4042#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS    0x8A2C
4043#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
4044#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
4045#endif /* GL_ARB_uniform_buffer_object */
4046
4047#ifndef GL_ARB_vertex_array_bgra
4048#define GL_ARB_vertex_array_bgra 1
4049#endif /* GL_ARB_vertex_array_bgra */
4050
4051#ifndef GL_ARB_vertex_array_object
4052#define GL_ARB_vertex_array_object 1
4053#endif /* GL_ARB_vertex_array_object */
4054
4055#ifndef GL_ARB_vertex_attrib_64bit
4056#define GL_ARB_vertex_attrib_64bit 1
4057#endif /* GL_ARB_vertex_attrib_64bit */
4058
4059#ifndef GL_ARB_vertex_attrib_binding
4060#define GL_ARB_vertex_attrib_binding 1
4061#endif /* GL_ARB_vertex_attrib_binding */
4062
4063#ifndef GL_ARB_vertex_blend
4064#define GL_ARB_vertex_blend 1
4065#define GL_MAX_VERTEX_UNITS_ARB           0x86A4
4066#define GL_ACTIVE_VERTEX_UNITS_ARB        0x86A5
4067#define GL_WEIGHT_SUM_UNITY_ARB           0x86A6
4068#define GL_VERTEX_BLEND_ARB               0x86A7
4069#define GL_CURRENT_WEIGHT_ARB             0x86A8
4070#define GL_WEIGHT_ARRAY_TYPE_ARB          0x86A9
4071#define GL_WEIGHT_ARRAY_STRIDE_ARB        0x86AA
4072#define GL_WEIGHT_ARRAY_SIZE_ARB          0x86AB
4073#define GL_WEIGHT_ARRAY_POINTER_ARB       0x86AC
4074#define GL_WEIGHT_ARRAY_ARB               0x86AD
4075#define GL_MODELVIEW0_ARB                 0x1700
4076#define GL_MODELVIEW1_ARB                 0x850A
4077#define GL_MODELVIEW2_ARB                 0x8722
4078#define GL_MODELVIEW3_ARB                 0x8723
4079#define GL_MODELVIEW4_ARB                 0x8724
4080#define GL_MODELVIEW5_ARB                 0x8725
4081#define GL_MODELVIEW6_ARB                 0x8726
4082#define GL_MODELVIEW7_ARB                 0x8727
4083#define GL_MODELVIEW8_ARB                 0x8728
4084#define GL_MODELVIEW9_ARB                 0x8729
4085#define GL_MODELVIEW10_ARB                0x872A
4086#define GL_MODELVIEW11_ARB                0x872B
4087#define GL_MODELVIEW12_ARB                0x872C
4088#define GL_MODELVIEW13_ARB                0x872D
4089#define GL_MODELVIEW14_ARB                0x872E
4090#define GL_MODELVIEW15_ARB                0x872F
4091#define GL_MODELVIEW16_ARB                0x8730
4092#define GL_MODELVIEW17_ARB                0x8731
4093#define GL_MODELVIEW18_ARB                0x8732
4094#define GL_MODELVIEW19_ARB                0x8733
4095#define GL_MODELVIEW20_ARB                0x8734
4096#define GL_MODELVIEW21_ARB                0x8735
4097#define GL_MODELVIEW22_ARB                0x8736
4098#define GL_MODELVIEW23_ARB                0x8737
4099#define GL_MODELVIEW24_ARB                0x8738
4100#define GL_MODELVIEW25_ARB                0x8739
4101#define GL_MODELVIEW26_ARB                0x873A
4102#define GL_MODELVIEW27_ARB                0x873B
4103#define GL_MODELVIEW28_ARB                0x873C
4104#define GL_MODELVIEW29_ARB                0x873D
4105#define GL_MODELVIEW30_ARB                0x873E
4106#define GL_MODELVIEW31_ARB                0x873F
4107typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights);
4108typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights);
4109typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights);
4110typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights);
4111typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights);
4112typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights);
4113typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights);
4114typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights);
4115typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
4116typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count);
4117#ifdef GL_GLEXT_PROTOTYPES
4118GLAPI void APIENTRY glWeightbvARB (GLint size, const GLbyte *weights);
4119GLAPI void APIENTRY glWeightsvARB (GLint size, const GLshort *weights);
4120GLAPI void APIENTRY glWeightivARB (GLint size, const GLint *weights);
4121GLAPI void APIENTRY glWeightfvARB (GLint size, const GLfloat *weights);
4122GLAPI void APIENTRY glWeightdvARB (GLint size, const GLdouble *weights);
4123GLAPI void APIENTRY glWeightubvARB (GLint size, const GLubyte *weights);
4124GLAPI void APIENTRY glWeightusvARB (GLint size, const GLushort *weights);
4125GLAPI void APIENTRY glWeightuivARB (GLint size, const GLuint *weights);
4126GLAPI void APIENTRY glWeightPointerARB (GLint size, GLenum type, GLsizei stride, const void *pointer);
4127GLAPI void APIENTRY glVertexBlendARB (GLint count);
4128#endif
4129#endif /* GL_ARB_vertex_blend */
4130
4131#ifndef GL_ARB_vertex_buffer_object
4132#define GL_ARB_vertex_buffer_object 1
4133typedef ptrdiff_t GLsizeiptrARB;
4134typedef ptrdiff_t GLintptrARB;
4135#define GL_BUFFER_SIZE_ARB                0x8764
4136#define GL_BUFFER_USAGE_ARB               0x8765
4137#define GL_ARRAY_BUFFER_ARB               0x8892
4138#define GL_ELEMENT_ARRAY_BUFFER_ARB       0x8893
4139#define GL_ARRAY_BUFFER_BINDING_ARB       0x8894
4140#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895
4141#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896
4142#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897
4143#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898
4144#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899
4145#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A
4146#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B
4147#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C
4148#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D
4149#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E
4150#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F
4151#define GL_READ_ONLY_ARB                  0x88B8
4152#define GL_WRITE_ONLY_ARB                 0x88B9
4153#define GL_READ_WRITE_ARB                 0x88BA
4154#define GL_BUFFER_ACCESS_ARB              0x88BB
4155#define GL_BUFFER_MAPPED_ARB              0x88BC
4156#define GL_BUFFER_MAP_POINTER_ARB         0x88BD
4157#define GL_STREAM_DRAW_ARB                0x88E0
4158#define GL_STREAM_READ_ARB                0x88E1
4159#define GL_STREAM_COPY_ARB                0x88E2
4160#define GL_STATIC_DRAW_ARB                0x88E4
4161#define GL_STATIC_READ_ARB                0x88E5
4162#define GL_STATIC_COPY_ARB                0x88E6
4163#define GL_DYNAMIC_DRAW_ARB               0x88E8
4164#define GL_DYNAMIC_READ_ARB               0x88E9
4165#define GL_DYNAMIC_COPY_ARB               0x88EA
4166typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
4167typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
4168typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
4169typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer);
4170typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage);
4171typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data);
4172typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data);
4173typedef void *(APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);
4174typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target);
4175typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params);
4176typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, void **params);
4177#ifdef GL_GLEXT_PROTOTYPES
4178GLAPI void APIENTRY glBindBufferARB (GLenum target, GLuint buffer);
4179GLAPI void APIENTRY glDeleteBuffersARB (GLsizei n, const GLuint *buffers);
4180GLAPI void APIENTRY glGenBuffersARB (GLsizei n, GLuint *buffers);
4181GLAPI GLboolean APIENTRY glIsBufferARB (GLuint buffer);
4182GLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage);
4183GLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data);
4184GLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data);
4185GLAPI void *APIENTRY glMapBufferARB (GLenum target, GLenum access);
4186GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum target);
4187GLAPI void APIENTRY glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params);
4188GLAPI void APIENTRY glGetBufferPointervARB (GLenum target, GLenum pname, void **params);
4189#endif
4190#endif /* GL_ARB_vertex_buffer_object */
4191
4192#ifndef GL_ARB_vertex_program
4193#define GL_ARB_vertex_program 1
4194#define GL_COLOR_SUM_ARB                  0x8458
4195#define GL_VERTEX_PROGRAM_ARB             0x8620
4196#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
4197#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB   0x8623
4198#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
4199#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB   0x8625
4200#define GL_CURRENT_VERTEX_ATTRIB_ARB      0x8626
4201#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB  0x8642
4202#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB    0x8643
4203#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
4204#define GL_MAX_VERTEX_ATTRIBS_ARB         0x8869
4205#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
4206#define GL_PROGRAM_ADDRESS_REGISTERS_ARB  0x88B0
4207#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1
4208#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2
4209#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3
4210typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);
4211typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v);
4212typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);
4213typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v);
4214typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);
4215typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v);
4216typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);
4217typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v);
4218typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);
4219typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v);
4220typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);
4221typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v);
4222typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
4223typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v);
4224typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
4225typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v);
4226typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
4227typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v);
4228typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v);
4229typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v);
4230typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v);
4231typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
4232typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v);
4233typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v);
4234typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v);
4235typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v);
4236typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
4237typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v);
4238typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
4239typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v);
4240typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v);
4241typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
4242typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v);
4243typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v);
4244typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v);
4245typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v);
4246typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
4247typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
4248typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
4249typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params);
4250typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params);
4251typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params);
4252typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, void **pointer);
4253#ifdef GL_GLEXT_PROTOTYPES
4254GLAPI void APIENTRY glVertexAttrib1dARB (GLuint index, GLdouble x);
4255GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint index, const GLdouble *v);
4256GLAPI void APIENTRY glVertexAttrib1fARB (GLuint index, GLfloat x);
4257GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint index, const GLfloat *v);
4258GLAPI void APIENTRY glVertexAttrib1sARB (GLuint index, GLshort x);
4259GLAPI void APIENTRY glVertexAttrib1svARB (GLuint index, const GLshort *v);
4260GLAPI void APIENTRY glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y);
4261GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint index, const GLdouble *v);
4262GLAPI void APIENTRY glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y);
4263GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint index, const GLfloat *v);
4264GLAPI void APIENTRY glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y);
4265GLAPI void APIENTRY glVertexAttrib2svARB (GLuint index, const GLshort *v);
4266GLAPI void APIENTRY glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z);
4267GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint index, const GLdouble *v);
4268GLAPI void APIENTRY glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z);
4269GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint index, const GLfloat *v);
4270GLAPI void APIENTRY glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z);
4271GLAPI void APIENTRY glVertexAttrib3svARB (GLuint index, const GLshort *v);
4272GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint index, const GLbyte *v);
4273GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint index, const GLint *v);
4274GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint index, const GLshort *v);
4275GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
4276GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint index, const GLubyte *v);
4277GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint index, const GLuint *v);
4278GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint index, const GLushort *v);
4279GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint index, const GLbyte *v);
4280GLAPI void APIENTRY glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
4281GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint index, const GLdouble *v);
4282GLAPI void APIENTRY glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
4283GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint index, const GLfloat *v);
4284GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint index, const GLint *v);
4285GLAPI void APIENTRY glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
4286GLAPI void APIENTRY glVertexAttrib4svARB (GLuint index, const GLshort *v);
4287GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint index, const GLubyte *v);
4288GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint index, const GLuint *v);
4289GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint index, const GLushort *v);
4290GLAPI void APIENTRY glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
4291GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint index);
4292GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint index);
4293GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params);
4294GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params);
4295GLAPI void APIENTRY glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params);
4296GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint index, GLenum pname, void **pointer);
4297#endif
4298#endif /* GL_ARB_vertex_program */
4299
4300#ifndef GL_ARB_vertex_shader
4301#define GL_ARB_vertex_shader 1
4302#define GL_VERTEX_SHADER_ARB              0x8B31
4303#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
4304#define GL_MAX_VARYING_FLOATS_ARB         0x8B4B
4305#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
4306#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D
4307#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB   0x8B89
4308#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A
4309typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name);
4310typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
4311typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
4312#ifdef GL_GLEXT_PROTOTYPES
4313GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name);
4314GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
4315GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name);
4316#endif
4317#endif /* GL_ARB_vertex_shader */
4318
4319#ifndef GL_ARB_vertex_type_10f_11f_11f_rev
4320#define GL_ARB_vertex_type_10f_11f_11f_rev 1
4321#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */
4322
4323#ifndef GL_ARB_vertex_type_2_10_10_10_rev
4324#define GL_ARB_vertex_type_2_10_10_10_rev 1
4325#endif /* GL_ARB_vertex_type_2_10_10_10_rev */
4326
4327#ifndef GL_ARB_viewport_array
4328#define GL_ARB_viewport_array 1
4329#endif /* GL_ARB_viewport_array */
4330
4331#ifndef GL_ARB_window_pos
4332#define GL_ARB_window_pos 1
4333typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y);
4334typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v);
4335typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y);
4336typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v);
4337typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y);
4338typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v);
4339typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y);
4340typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v);
4341typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z);
4342typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v);
4343typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z);
4344typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v);
4345typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z);
4346typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v);
4347typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z);
4348typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v);
4349#ifdef GL_GLEXT_PROTOTYPES
4350GLAPI void APIENTRY glWindowPos2dARB (GLdouble x, GLdouble y);
4351GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *v);
4352GLAPI void APIENTRY glWindowPos2fARB (GLfloat x, GLfloat y);
4353GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *v);
4354GLAPI void APIENTRY glWindowPos2iARB (GLint x, GLint y);
4355GLAPI void APIENTRY glWindowPos2ivARB (const GLint *v);
4356GLAPI void APIENTRY glWindowPos2sARB (GLshort x, GLshort y);
4357GLAPI void APIENTRY glWindowPos2svARB (const GLshort *v);
4358GLAPI void APIENTRY glWindowPos3dARB (GLdouble x, GLdouble y, GLdouble z);
4359GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *v);
4360GLAPI void APIENTRY glWindowPos3fARB (GLfloat x, GLfloat y, GLfloat z);
4361GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *v);
4362GLAPI void APIENTRY glWindowPos3iARB (GLint x, GLint y, GLint z);
4363GLAPI void APIENTRY glWindowPos3ivARB (const GLint *v);
4364GLAPI void APIENTRY glWindowPos3sARB (GLshort x, GLshort y, GLshort z);
4365GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v);
4366#endif
4367#endif /* GL_ARB_window_pos */
4368
4369#ifndef GL_KHR_debug
4370#define GL_KHR_debug 1
4371#endif /* GL_KHR_debug */
4372
4373#ifndef GL_KHR_texture_compression_astc_hdr
4374#define GL_KHR_texture_compression_astc_hdr 1
4375#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR   0x93B0
4376#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR   0x93B1
4377#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR   0x93B2
4378#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR   0x93B3
4379#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR   0x93B4
4380#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR   0x93B5
4381#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR   0x93B6
4382#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR   0x93B7
4383#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR  0x93B8
4384#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR  0x93B9
4385#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR  0x93BA
4386#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
4387#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
4388#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
4389#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
4390#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
4391#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
4392#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
4393#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
4394#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
4395#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
4396#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
4397#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
4398#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
4399#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
4400#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
4401#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
4402#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
4403#endif /* GL_KHR_texture_compression_astc_hdr */
4404
4405#ifndef GL_KHR_texture_compression_astc_ldr
4406#define GL_KHR_texture_compression_astc_ldr 1
4407#endif /* GL_KHR_texture_compression_astc_ldr */
4408
4409#ifndef GL_OES_byte_coordinates
4410#define GL_OES_byte_coordinates 1
4411typedef void (APIENTRYP PFNGLMULTITEXCOORD1BOESPROC) (GLenum texture, GLbyte s);
4412typedef void (APIENTRYP PFNGLMULTITEXCOORD1BVOESPROC) (GLenum texture, const GLbyte *coords);
4413typedef void (APIENTRYP PFNGLMULTITEXCOORD2BOESPROC) (GLenum texture, GLbyte s, GLbyte t);
4414typedef void (APIENTRYP PFNGLMULTITEXCOORD2BVOESPROC) (GLenum texture, const GLbyte *coords);
4415typedef void (APIENTRYP PFNGLMULTITEXCOORD3BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r);
4416typedef void (APIENTRYP PFNGLMULTITEXCOORD3BVOESPROC) (GLenum texture, const GLbyte *coords);
4417typedef void (APIENTRYP PFNGLMULTITEXCOORD4BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q);
4418typedef void (APIENTRYP PFNGLMULTITEXCOORD4BVOESPROC) (GLenum texture, const GLbyte *coords);
4419typedef void (APIENTRYP PFNGLTEXCOORD1BOESPROC) (GLbyte s);
4420typedef void (APIENTRYP PFNGLTEXCOORD1BVOESPROC) (const GLbyte *coords);
4421typedef void (APIENTRYP PFNGLTEXCOORD2BOESPROC) (GLbyte s, GLbyte t);
4422typedef void (APIENTRYP PFNGLTEXCOORD2BVOESPROC) (const GLbyte *coords);
4423typedef void (APIENTRYP PFNGLTEXCOORD3BOESPROC) (GLbyte s, GLbyte t, GLbyte r);
4424typedef void (APIENTRYP PFNGLTEXCOORD3BVOESPROC) (const GLbyte *coords);
4425typedef void (APIENTRYP PFNGLTEXCOORD4BOESPROC) (GLbyte s, GLbyte t, GLbyte r, GLbyte q);
4426typedef void (APIENTRYP PFNGLTEXCOORD4BVOESPROC) (const GLbyte *coords);
4427typedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x);
4428typedef void (APIENTRYP PFNGLVERTEX2BVOESPROC) (const GLbyte *coords);
4429typedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y);
4430typedef void (APIENTRYP PFNGLVERTEX3BVOESPROC) (const GLbyte *coords);
4431typedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z);
4432typedef void (APIENTRYP PFNGLVERTEX4BVOESPROC) (const GLbyte *coords);
4433#ifdef GL_GLEXT_PROTOTYPES
4434GLAPI void APIENTRY glMultiTexCoord1bOES (GLenum texture, GLbyte s);
4435GLAPI void APIENTRY glMultiTexCoord1bvOES (GLenum texture, const GLbyte *coords);
4436GLAPI void APIENTRY glMultiTexCoord2bOES (GLenum texture, GLbyte s, GLbyte t);
4437GLAPI void APIENTRY glMultiTexCoord2bvOES (GLenum texture, const GLbyte *coords);
4438GLAPI void APIENTRY glMultiTexCoord3bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r);
4439GLAPI void APIENTRY glMultiTexCoord3bvOES (GLenum texture, const GLbyte *coords);
4440GLAPI void APIENTRY glMultiTexCoord4bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q);
4441GLAPI void APIENTRY glMultiTexCoord4bvOES (GLenum texture, const GLbyte *coords);
4442GLAPI void APIENTRY glTexCoord1bOES (GLbyte s);
4443GLAPI void APIENTRY glTexCoord1bvOES (const GLbyte *coords);
4444GLAPI void APIENTRY glTexCoord2bOES (GLbyte s, GLbyte t);
4445GLAPI void APIENTRY glTexCoord2bvOES (const GLbyte *coords);
4446GLAPI void APIENTRY glTexCoord3bOES (GLbyte s, GLbyte t, GLbyte r);
4447GLAPI void APIENTRY glTexCoord3bvOES (const GLbyte *coords);
4448GLAPI void APIENTRY glTexCoord4bOES (GLbyte s, GLbyte t, GLbyte r, GLbyte q);
4449GLAPI void APIENTRY glTexCoord4bvOES (const GLbyte *coords);
4450GLAPI void APIENTRY glVertex2bOES (GLbyte x);
4451GLAPI void APIENTRY glVertex2bvOES (const GLbyte *coords);
4452GLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y);
4453GLAPI void APIENTRY glVertex3bvOES (const GLbyte *coords);
4454GLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z);
4455GLAPI void APIENTRY glVertex4bvOES (const GLbyte *coords);
4456#endif
4457#endif /* GL_OES_byte_coordinates */
4458
4459#ifndef GL_OES_compressed_paletted_texture
4460#define GL_OES_compressed_paletted_texture 1
4461#define GL_PALETTE4_RGB8_OES              0x8B90
4462#define GL_PALETTE4_RGBA8_OES             0x8B91
4463#define GL_PALETTE4_R5_G6_B5_OES          0x8B92
4464#define GL_PALETTE4_RGBA4_OES             0x8B93
4465#define GL_PALETTE4_RGB5_A1_OES           0x8B94
4466#define GL_PALETTE8_RGB8_OES              0x8B95
4467#define GL_PALETTE8_RGBA8_OES             0x8B96
4468#define GL_PALETTE8_R5_G6_B5_OES          0x8B97
4469#define GL_PALETTE8_RGBA4_OES             0x8B98
4470#define GL_PALETTE8_RGB5_A1_OES           0x8B99
4471#endif /* GL_OES_compressed_paletted_texture */
4472
4473#ifndef GL_OES_fixed_point
4474#define GL_OES_fixed_point 1
4475typedef GLint GLfixed;
4476#define GL_FIXED_OES                      0x140C
4477typedef void (APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLfixed ref);
4478typedef void (APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
4479typedef void (APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLfixed depth);
4480typedef void (APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation);
4481typedef void (APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
4482typedef void (APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLfixed n, GLfixed f);
4483typedef void (APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param);
4484typedef void (APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *param);
4485typedef void (APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
4486typedef void (APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum plane, GLfixed *equation);
4487typedef void (APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params);
4488typedef void (APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
4489typedef void (APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
4490typedef void (APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param);
4491typedef void (APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *param);
4492typedef void (APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param);
4493typedef void (APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params);
4494typedef void (APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width);
4495typedef void (APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m);
4496typedef void (APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);
4497typedef void (APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *param);
4498typedef void (APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m);
4499typedef void (APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
4500typedef void (APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz);
4501typedef void (APIENTRYP PFNGLORTHOXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
4502typedef void (APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params);
4503typedef void (APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size);
4504typedef void (APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units);
4505typedef void (APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
4506typedef void (APIENTRYP PFNGLSAMPLECOVERAGEOESPROC) (GLfixed value, GLboolean invert);
4507typedef void (APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
4508typedef void (APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param);
4509typedef void (APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
4510typedef void (APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);
4511typedef void (APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
4512typedef void (APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
4513typedef void (APIENTRYP PFNGLACCUMXOESPROC) (GLenum op, GLfixed value);
4514typedef void (APIENTRYP PFNGLBITMAPXOESPROC) (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap);
4515typedef void (APIENTRYP PFNGLBLENDCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
4516typedef void (APIENTRYP PFNGLCLEARACCUMXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
4517typedef void (APIENTRYP PFNGLCOLOR3XOESPROC) (GLfixed red, GLfixed green, GLfixed blue);
4518typedef void (APIENTRYP PFNGLCOLOR3XVOESPROC) (const GLfixed *components);
4519typedef void (APIENTRYP PFNGLCOLOR4XVOESPROC) (const GLfixed *components);
4520typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);
4521typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
4522typedef void (APIENTRYP PFNGLEVALCOORD1XOESPROC) (GLfixed u);
4523typedef void (APIENTRYP PFNGLEVALCOORD1XVOESPROC) (const GLfixed *coords);
4524typedef void (APIENTRYP PFNGLEVALCOORD2XOESPROC) (GLfixed u, GLfixed v);
4525typedef void (APIENTRYP PFNGLEVALCOORD2XVOESPROC) (const GLfixed *coords);
4526typedef void (APIENTRYP PFNGLFEEDBACKBUFFERXOESPROC) (GLsizei n, GLenum type, const GLfixed *buffer);
4527typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
4528typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
4529typedef void (APIENTRYP PFNGLGETLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed *params);
4530typedef void (APIENTRYP PFNGLGETMAPXVOESPROC) (GLenum target, GLenum query, GLfixed *v);
4531typedef void (APIENTRYP PFNGLGETMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);
4532typedef void (APIENTRYP PFNGLGETPIXELMAPXVPROC) (GLenum map, GLint size, GLfixed *values);
4533typedef void (APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
4534typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERXVOESPROC) (GLenum target, GLint level, GLenum pname, GLfixed *params);
4535typedef void (APIENTRYP PFNGLINDEXXOESPROC) (GLfixed component);
4536typedef void (APIENTRYP PFNGLINDEXXVOESPROC) (const GLfixed *component);
4537typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXXOESPROC) (const GLfixed *m);
4538typedef void (APIENTRYP PFNGLMAP1XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points);
4539typedef void (APIENTRYP PFNGLMAP2XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points);
4540typedef void (APIENTRYP PFNGLMAPGRID1XOESPROC) (GLint n, GLfixed u1, GLfixed u2);
4541typedef void (APIENTRYP PFNGLMAPGRID2XOESPROC) (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2);
4542typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXXOESPROC) (const GLfixed *m);
4543typedef void (APIENTRYP PFNGLMULTITEXCOORD1XOESPROC) (GLenum texture, GLfixed s);
4544typedef void (APIENTRYP PFNGLMULTITEXCOORD1XVOESPROC) (GLenum texture, const GLfixed *coords);
4545typedef void (APIENTRYP PFNGLMULTITEXCOORD2XOESPROC) (GLenum texture, GLfixed s, GLfixed t);
4546typedef void (APIENTRYP PFNGLMULTITEXCOORD2XVOESPROC) (GLenum texture, const GLfixed *coords);
4547typedef void (APIENTRYP PFNGLMULTITEXCOORD3XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r);
4548typedef void (APIENTRYP PFNGLMULTITEXCOORD3XVOESPROC) (GLenum texture, const GLfixed *coords);
4549typedef void (APIENTRYP PFNGLMULTITEXCOORD4XVOESPROC) (GLenum texture, const GLfixed *coords);
4550typedef void (APIENTRYP PFNGLNORMAL3XVOESPROC) (const GLfixed *coords);
4551typedef void (APIENTRYP PFNGLPASSTHROUGHXOESPROC) (GLfixed token);
4552typedef void (APIENTRYP PFNGLPIXELMAPXPROC) (GLenum map, GLint size, const GLfixed *values);
4553typedef void (APIENTRYP PFNGLPIXELSTOREXPROC) (GLenum pname, GLfixed param);
4554typedef void (APIENTRYP PFNGLPIXELTRANSFERXOESPROC) (GLenum pname, GLfixed param);
4555typedef void (APIENTRYP PFNGLPIXELZOOMXOESPROC) (GLfixed xfactor, GLfixed yfactor);
4556typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESXOESPROC) (GLsizei n, const GLuint *textures, const GLfixed *priorities);
4557typedef void (APIENTRYP PFNGLRASTERPOS2XOESPROC) (GLfixed x, GLfixed y);
4558typedef void (APIENTRYP PFNGLRASTERPOS2XVOESPROC) (const GLfixed *coords);
4559typedef void (APIENTRYP PFNGLRASTERPOS3XOESPROC) (GLfixed x, GLfixed y, GLfixed z);
4560typedef void (APIENTRYP PFNGLRASTERPOS3XVOESPROC) (const GLfixed *coords);
4561typedef void (APIENTRYP PFNGLRASTERPOS4XOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed w);
4562typedef void (APIENTRYP PFNGLRASTERPOS4XVOESPROC) (const GLfixed *coords);
4563typedef void (APIENTRYP PFNGLRECTXOESPROC) (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2);
4564typedef void (APIENTRYP PFNGLRECTXVOESPROC) (const GLfixed *v1, const GLfixed *v2);
4565typedef void (APIENTRYP PFNGLTEXCOORD1XOESPROC) (GLfixed s);
4566typedef void (APIENTRYP PFNGLTEXCOORD1XVOESPROC) (const GLfixed *coords);
4567typedef void (APIENTRYP PFNGLTEXCOORD2XOESPROC) (GLfixed s, GLfixed t);
4568typedef void (APIENTRYP PFNGLTEXCOORD2XVOESPROC) (const GLfixed *coords);
4569typedef void (APIENTRYP PFNGLTEXCOORD3XOESPROC) (GLfixed s, GLfixed t, GLfixed r);
4570typedef void (APIENTRYP PFNGLTEXCOORD3XVOESPROC) (const GLfixed *coords);
4571typedef void (APIENTRYP PFNGLTEXCOORD4XOESPROC) (GLfixed s, GLfixed t, GLfixed r, GLfixed q);
4572typedef void (APIENTRYP PFNGLTEXCOORD4XVOESPROC) (const GLfixed *coords);
4573typedef void (APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
4574typedef void (APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
4575typedef void (APIENTRYP PFNGLVERTEX2XOESPROC) (GLfixed x);
4576typedef void (APIENTRYP PFNGLVERTEX2XVOESPROC) (const GLfixed *coords);
4577typedef void (APIENTRYP PFNGLVERTEX3XOESPROC) (GLfixed x, GLfixed y);
4578typedef void (APIENTRYP PFNGLVERTEX3XVOESPROC) (const GLfixed *coords);
4579typedef void (APIENTRYP PFNGLVERTEX4XOESPROC) (GLfixed x, GLfixed y, GLfixed z);
4580typedef void (APIENTRYP PFNGLVERTEX4XVOESPROC) (const GLfixed *coords);
4581#ifdef GL_GLEXT_PROTOTYPES
4582GLAPI void APIENTRY glAlphaFuncxOES (GLenum func, GLfixed ref);
4583GLAPI void APIENTRY glClearColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
4584GLAPI void APIENTRY glClearDepthxOES (GLfixed depth);
4585GLAPI void APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation);
4586GLAPI void APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
4587GLAPI void APIENTRY glDepthRangexOES (GLfixed n, GLfixed f);
4588GLAPI void APIENTRY glFogxOES (GLenum pname, GLfixed param);
4589GLAPI void APIENTRY glFogxvOES (GLenum pname, const GLfixed *param);
4590GLAPI void APIENTRY glFrustumxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
4591GLAPI void APIENTRY glGetClipPlanexOES (GLenum plane, GLfixed *equation);
4592GLAPI void APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params);
4593GLAPI void APIENTRY glGetTexEnvxvOES (GLenum target, GLenum pname, GLfixed *params);
4594GLAPI void APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
4595GLAPI void APIENTRY glLightModelxOES (GLenum pname, GLfixed param);
4596GLAPI void APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *param);
4597GLAPI void APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param);
4598GLAPI void APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params);
4599GLAPI void APIENTRY glLineWidthxOES (GLfixed width);
4600GLAPI void APIENTRY glLoadMatrixxOES (const GLfixed *m);
4601GLAPI void APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param);
4602GLAPI void APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *param);
4603GLAPI void APIENTRY glMultMatrixxOES (const GLfixed *m);
4604GLAPI void APIENTRY glMultiTexCoord4xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
4605GLAPI void APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz);
4606GLAPI void APIENTRY glOrthoxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
4607GLAPI void APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params);
4608GLAPI void APIENTRY glPointSizexOES (GLfixed size);
4609GLAPI void APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units);
4610GLAPI void APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
4611GLAPI void APIENTRY glSampleCoverageOES (GLfixed value, GLboolean invert);
4612GLAPI void APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z);
4613GLAPI void APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param);
4614GLAPI void APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params);
4615GLAPI void APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param);
4616GLAPI void APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);
4617GLAPI void APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z);
4618GLAPI void APIENTRY glAccumxOES (GLenum op, GLfixed value);
4619GLAPI void APIENTRY glBitmapxOES (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap);
4620GLAPI void APIENTRY glBlendColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
4621GLAPI void APIENTRY glClearAccumxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
4622GLAPI void APIENTRY glColor3xOES (GLfixed red, GLfixed green, GLfixed blue);
4623GLAPI void APIENTRY glColor3xvOES (const GLfixed *components);
4624GLAPI void APIENTRY glColor4xvOES (const GLfixed *components);
4625GLAPI void APIENTRY glConvolutionParameterxOES (GLenum target, GLenum pname, GLfixed param);
4626GLAPI void APIENTRY glConvolutionParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);
4627GLAPI void APIENTRY glEvalCoord1xOES (GLfixed u);
4628GLAPI void APIENTRY glEvalCoord1xvOES (const GLfixed *coords);
4629GLAPI void APIENTRY glEvalCoord2xOES (GLfixed u, GLfixed v);
4630GLAPI void APIENTRY glEvalCoord2xvOES (const GLfixed *coords);
4631GLAPI void APIENTRY glFeedbackBufferxOES (GLsizei n, GLenum type, const GLfixed *buffer);
4632GLAPI void APIENTRY glGetConvolutionParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
4633GLAPI void APIENTRY glGetHistogramParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
4634GLAPI void APIENTRY glGetLightxOES (GLenum light, GLenum pname, GLfixed *params);
4635GLAPI void APIENTRY glGetMapxvOES (GLenum target, GLenum query, GLfixed *v);
4636GLAPI void APIENTRY glGetMaterialxOES (GLenum face, GLenum pname, GLfixed param);
4637GLAPI void APIENTRY glGetPixelMapxv (GLenum map, GLint size, GLfixed *values);
4638GLAPI void APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params);
4639GLAPI void APIENTRY glGetTexLevelParameterxvOES (GLenum target, GLint level, GLenum pname, GLfixed *params);
4640GLAPI void APIENTRY glIndexxOES (GLfixed component);
4641GLAPI void APIENTRY glIndexxvOES (const GLfixed *component);
4642GLAPI void APIENTRY glLoadTransposeMatrixxOES (const GLfixed *m);
4643GLAPI void APIENTRY glMap1xOES (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points);
4644GLAPI void APIENTRY glMap2xOES (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points);
4645GLAPI void APIENTRY glMapGrid1xOES (GLint n, GLfixed u1, GLfixed u2);
4646GLAPI void APIENTRY glMapGrid2xOES (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2);
4647GLAPI void APIENTRY glMultTransposeMatrixxOES (const GLfixed *m);
4648GLAPI void APIENTRY glMultiTexCoord1xOES (GLenum texture, GLfixed s);
4649GLAPI void APIENTRY glMultiTexCoord1xvOES (GLenum texture, const GLfixed *coords);
4650GLAPI void APIENTRY glMultiTexCoord2xOES (GLenum texture, GLfixed s, GLfixed t);
4651GLAPI void APIENTRY glMultiTexCoord2xvOES (GLenum texture, const GLfixed *coords);
4652GLAPI void APIENTRY glMultiTexCoord3xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r);
4653GLAPI void APIENTRY glMultiTexCoord3xvOES (GLenum texture, const GLfixed *coords);
4654GLAPI void APIENTRY glMultiTexCoord4xvOES (GLenum texture, const GLfixed *coords);
4655GLAPI void APIENTRY glNormal3xvOES (const GLfixed *coords);
4656GLAPI void APIENTRY glPassThroughxOES (GLfixed token);
4657GLAPI void APIENTRY glPixelMapx (GLenum map, GLint size, const GLfixed *values);
4658GLAPI void APIENTRY glPixelStorex (GLenum pname, GLfixed param);
4659GLAPI void APIENTRY glPixelTransferxOES (GLenum pname, GLfixed param);
4660GLAPI void APIENTRY glPixelZoomxOES (GLfixed xfactor, GLfixed yfactor);
4661GLAPI void APIENTRY glPrioritizeTexturesxOES (GLsizei n, const GLuint *textures, const GLfixed *priorities);
4662GLAPI void APIENTRY glRasterPos2xOES (GLfixed x, GLfixed y);
4663GLAPI void APIENTRY glRasterPos2xvOES (const GLfixed *coords);
4664GLAPI void APIENTRY glRasterPos3xOES (GLfixed x, GLfixed y, GLfixed z);
4665GLAPI void APIENTRY glRasterPos3xvOES (const GLfixed *coords);
4666GLAPI void APIENTRY glRasterPos4xOES (GLfixed x, GLfixed y, GLfixed z, GLfixed w);
4667GLAPI void APIENTRY glRasterPos4xvOES (const GLfixed *coords);
4668GLAPI void APIENTRY glRectxOES (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2);
4669GLAPI void APIENTRY glRectxvOES (const GLfixed *v1, const GLfixed *v2);
4670GLAPI void APIENTRY glTexCoord1xOES (GLfixed s);
4671GLAPI void APIENTRY glTexCoord1xvOES (const GLfixed *coords);
4672GLAPI void APIENTRY glTexCoord2xOES (GLfixed s, GLfixed t);
4673GLAPI void APIENTRY glTexCoord2xvOES (const GLfixed *coords);
4674GLAPI void APIENTRY glTexCoord3xOES (GLfixed s, GLfixed t, GLfixed r);
4675GLAPI void APIENTRY glTexCoord3xvOES (const GLfixed *coords);
4676GLAPI void APIENTRY glTexCoord4xOES (GLfixed s, GLfixed t, GLfixed r, GLfixed q);
4677GLAPI void APIENTRY glTexCoord4xvOES (const GLfixed *coords);
4678GLAPI void APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param);
4679GLAPI void APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params);
4680GLAPI void APIENTRY glVertex2xOES (GLfixed x);
4681GLAPI void APIENTRY glVertex2xvOES (const GLfixed *coords);
4682GLAPI void APIENTRY glVertex3xOES (GLfixed x, GLfixed y);
4683GLAPI void APIENTRY glVertex3xvOES (const GLfixed *coords);
4684GLAPI void APIENTRY glVertex4xOES (GLfixed x, GLfixed y, GLfixed z);
4685GLAPI void APIENTRY glVertex4xvOES (const GLfixed *coords);
4686#endif
4687#endif /* GL_OES_fixed_point */
4688
4689#ifndef GL_OES_query_matrix
4690#define GL_OES_query_matrix 1
4691typedef GLbitfield (APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed *mantissa, GLint *exponent);
4692#ifdef GL_GLEXT_PROTOTYPES
4693GLAPI GLbitfield APIENTRY glQueryMatrixxOES (GLfixed *mantissa, GLint *exponent);
4694#endif
4695#endif /* GL_OES_query_matrix */
4696
4697#ifndef GL_OES_read_format
4698#define GL_OES_read_format 1
4699#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
4700#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
4701#endif /* GL_OES_read_format */
4702
4703#ifndef GL_OES_single_precision
4704#define GL_OES_single_precision 1
4705typedef void (APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth);
4706typedef void (APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation);
4707typedef void (APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f);
4708typedef void (APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
4709typedef void (APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat *equation);
4710typedef void (APIENTRYP PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
4711#ifdef GL_GLEXT_PROTOTYPES
4712GLAPI void APIENTRY glClearDepthfOES (GLclampf depth);
4713GLAPI void APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);
4714GLAPI void APIENTRY glDepthRangefOES (GLclampf n, GLclampf f);
4715GLAPI void APIENTRY glFrustumfOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
4716GLAPI void APIENTRY glGetClipPlanefOES (GLenum plane, GLfloat *equation);
4717GLAPI void APIENTRY glOrthofOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
4718#endif
4719#endif /* GL_OES_single_precision */
4720
4721#ifndef GL_3DFX_multisample
4722#define GL_3DFX_multisample 1
4723#define GL_MULTISAMPLE_3DFX               0x86B2
4724#define GL_SAMPLE_BUFFERS_3DFX            0x86B3
4725#define GL_SAMPLES_3DFX                   0x86B4
4726#define GL_MULTISAMPLE_BIT_3DFX           0x20000000
4727#endif /* GL_3DFX_multisample */
4728
4729#ifndef GL_3DFX_tbuffer
4730#define GL_3DFX_tbuffer 1
4731typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);
4732#ifdef GL_GLEXT_PROTOTYPES
4733GLAPI void APIENTRY glTbufferMask3DFX (GLuint mask);
4734#endif
4735#endif /* GL_3DFX_tbuffer */
4736
4737#ifndef GL_3DFX_texture_compression_FXT1
4738#define GL_3DFX_texture_compression_FXT1 1
4739#define GL_COMPRESSED_RGB_FXT1_3DFX       0x86B0
4740#define GL_COMPRESSED_RGBA_FXT1_3DFX      0x86B1
4741#endif /* GL_3DFX_texture_compression_FXT1 */
4742
4743#ifndef GL_AMD_blend_minmax_factor
4744#define GL_AMD_blend_minmax_factor 1
4745#define GL_FACTOR_MIN_AMD                 0x901C
4746#define GL_FACTOR_MAX_AMD                 0x901D
4747#endif /* GL_AMD_blend_minmax_factor */
4748
4749#ifndef GL_AMD_conservative_depth
4750#define GL_AMD_conservative_depth 1
4751#endif /* GL_AMD_conservative_depth */
4752
4753#ifndef GL_AMD_debug_output
4754#define GL_AMD_debug_output 1
4755typedef void (APIENTRY  *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);
4756#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD   0x9143
4757#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD  0x9144
4758#define GL_DEBUG_LOGGED_MESSAGES_AMD      0x9145
4759#define GL_DEBUG_SEVERITY_HIGH_AMD        0x9146
4760#define GL_DEBUG_SEVERITY_MEDIUM_AMD      0x9147
4761#define GL_DEBUG_SEVERITY_LOW_AMD         0x9148
4762#define GL_DEBUG_CATEGORY_API_ERROR_AMD   0x9149
4763#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A
4764#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B
4765#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C
4766#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D
4767#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E
4768#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F
4769#define GL_DEBUG_CATEGORY_OTHER_AMD       0x9150
4770typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
4771typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);
4772typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void *userParam);
4773typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
4774#ifdef GL_GLEXT_PROTOTYPES
4775GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
4776GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);
4777GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, void *userParam);
4778GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
4779#endif
4780#endif /* GL_AMD_debug_output */
4781
4782#ifndef GL_AMD_depth_clamp_separate
4783#define GL_AMD_depth_clamp_separate 1
4784#define GL_DEPTH_CLAMP_NEAR_AMD           0x901E
4785#define GL_DEPTH_CLAMP_FAR_AMD            0x901F
4786#endif /* GL_AMD_depth_clamp_separate */
4787
4788#ifndef GL_AMD_draw_buffers_blend
4789#define GL_AMD_draw_buffers_blend 1
4790typedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst);
4791typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
4792typedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode);
4793typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
4794#ifdef GL_GLEXT_PROTOTYPES
4795GLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint buf, GLenum src, GLenum dst);
4796GLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
4797GLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint buf, GLenum mode);
4798GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
4799#endif
4800#endif /* GL_AMD_draw_buffers_blend */
4801
4802#ifndef GL_AMD_interleaved_elements
4803#define GL_AMD_interleaved_elements 1
4804#define GL_VERTEX_ELEMENT_SWIZZLE_AMD     0x91A4
4805#define GL_VERTEX_ID_SWIZZLE_AMD          0x91A5
4806typedef void (APIENTRYP PFNGLVERTEXATTRIBPARAMETERIAMDPROC) (GLuint index, GLenum pname, GLint param);
4807#ifdef GL_GLEXT_PROTOTYPES
4808GLAPI void APIENTRY glVertexAttribParameteriAMD (GLuint index, GLenum pname, GLint param);
4809#endif
4810#endif /* GL_AMD_interleaved_elements */
4811
4812#ifndef GL_AMD_multi_draw_indirect
4813#define GL_AMD_multi_draw_indirect 1
4814typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride);
4815typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride);
4816#ifdef GL_GLEXT_PROTOTYPES
4817GLAPI void APIENTRY glMultiDrawArraysIndirectAMD (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride);
4818GLAPI void APIENTRY glMultiDrawElementsIndirectAMD (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride);
4819#endif
4820#endif /* GL_AMD_multi_draw_indirect */
4821
4822#ifndef GL_AMD_name_gen_delete
4823#define GL_AMD_name_gen_delete 1
4824#define GL_DATA_BUFFER_AMD                0x9151
4825#define GL_PERFORMANCE_MONITOR_AMD        0x9152
4826#define GL_QUERY_OBJECT_AMD               0x9153
4827#define GL_VERTEX_ARRAY_OBJECT_AMD        0x9154
4828#define GL_SAMPLER_OBJECT_AMD             0x9155
4829typedef void (APIENTRYP PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint *names);
4830typedef void (APIENTRYP PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint *names);
4831typedef GLboolean (APIENTRYP PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name);
4832#ifdef GL_GLEXT_PROTOTYPES
4833GLAPI void APIENTRY glGenNamesAMD (GLenum identifier, GLuint num, GLuint *names);
4834GLAPI void APIENTRY glDeleteNamesAMD (GLenum identifier, GLuint num, const GLuint *names);
4835GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name);
4836#endif
4837#endif /* GL_AMD_name_gen_delete */
4838
4839#ifndef GL_AMD_performance_monitor
4840#define GL_AMD_performance_monitor 1
4841#define GL_COUNTER_TYPE_AMD               0x8BC0
4842#define GL_COUNTER_RANGE_AMD              0x8BC1
4843#define GL_UNSIGNED_INT64_AMD             0x8BC2
4844#define GL_PERCENTAGE_AMD                 0x8BC3
4845#define GL_PERFMON_RESULT_AVAILABLE_AMD   0x8BC4
4846#define GL_PERFMON_RESULT_SIZE_AMD        0x8BC5
4847#define GL_PERFMON_RESULT_AMD             0x8BC6
4848typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
4849typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
4850typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
4851typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
4852typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
4853typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
4854typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
4855typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
4856typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
4857typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
4858typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
4859#ifdef GL_GLEXT_PROTOTYPES
4860GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
4861GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
4862GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
4863GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
4864GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data);
4865GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
4866GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
4867GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
4868GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
4869GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint monitor);
4870GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
4871#endif
4872#endif /* GL_AMD_performance_monitor */
4873
4874#ifndef GL_AMD_pinned_memory
4875#define GL_AMD_pinned_memory 1
4876#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160
4877#endif /* GL_AMD_pinned_memory */
4878
4879#ifndef GL_AMD_query_buffer_object
4880#define GL_AMD_query_buffer_object 1
4881#define GL_QUERY_BUFFER_AMD               0x9192
4882#define GL_QUERY_BUFFER_BINDING_AMD       0x9193
4883#define GL_QUERY_RESULT_NO_WAIT_AMD       0x9194
4884#endif /* GL_AMD_query_buffer_object */
4885
4886#ifndef GL_AMD_sample_positions
4887#define GL_AMD_sample_positions 1
4888#define GL_SUBSAMPLE_DISTANCE_AMD         0x883F
4889typedef void (APIENTRYP PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat *val);
4890#ifdef GL_GLEXT_PROTOTYPES
4891GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLfloat *val);
4892#endif
4893#endif /* GL_AMD_sample_positions */
4894
4895#ifndef GL_AMD_seamless_cubemap_per_texture
4896#define GL_AMD_seamless_cubemap_per_texture 1
4897#endif /* GL_AMD_seamless_cubemap_per_texture */
4898
4899#ifndef GL_AMD_shader_atomic_counter_ops
4900#define GL_AMD_shader_atomic_counter_ops 1
4901#endif /* GL_AMD_shader_atomic_counter_ops */
4902
4903#ifndef GL_AMD_shader_stencil_export
4904#define GL_AMD_shader_stencil_export 1
4905#endif /* GL_AMD_shader_stencil_export */
4906
4907#ifndef GL_AMD_shader_trinary_minmax
4908#define GL_AMD_shader_trinary_minmax 1
4909#endif /* GL_AMD_shader_trinary_minmax */
4910
4911#ifndef GL_AMD_sparse_texture
4912#define GL_AMD_sparse_texture 1
4913#define GL_VIRTUAL_PAGE_SIZE_X_AMD        0x9195
4914#define GL_VIRTUAL_PAGE_SIZE_Y_AMD        0x9196
4915#define GL_VIRTUAL_PAGE_SIZE_Z_AMD        0x9197
4916#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD    0x9198
4917#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199
4918#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A
4919#define GL_MIN_SPARSE_LEVEL_AMD           0x919B
4920#define GL_MIN_LOD_WARNING_AMD            0x919C
4921#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001
4922typedef void (APIENTRYP PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
4923typedef void (APIENTRYP PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
4924#ifdef GL_GLEXT_PROTOTYPES
4925GLAPI void APIENTRY glTexStorageSparseAMD (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
4926GLAPI void APIENTRY glTextureStorageSparseAMD (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
4927#endif
4928#endif /* GL_AMD_sparse_texture */
4929
4930#ifndef GL_AMD_stencil_operation_extended
4931#define GL_AMD_stencil_operation_extended 1
4932#define GL_SET_AMD                        0x874A
4933#define GL_REPLACE_VALUE_AMD              0x874B
4934#define GL_STENCIL_OP_VALUE_AMD           0x874C
4935#define GL_STENCIL_BACK_OP_VALUE_AMD      0x874D
4936typedef void (APIENTRYP PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value);
4937#ifdef GL_GLEXT_PROTOTYPES
4938GLAPI void APIENTRY glStencilOpValueAMD (GLenum face, GLuint value);
4939#endif
4940#endif /* GL_AMD_stencil_operation_extended */
4941
4942#ifndef GL_AMD_texture_texture4
4943#define GL_AMD_texture_texture4 1
4944#endif /* GL_AMD_texture_texture4 */
4945
4946#ifndef GL_AMD_transform_feedback3_lines_triangles
4947#define GL_AMD_transform_feedback3_lines_triangles 1
4948#endif /* GL_AMD_transform_feedback3_lines_triangles */
4949
4950#ifndef GL_AMD_vertex_shader_layer
4951#define GL_AMD_vertex_shader_layer 1
4952#endif /* GL_AMD_vertex_shader_layer */
4953
4954#ifndef GL_AMD_vertex_shader_tessellator
4955#define GL_AMD_vertex_shader_tessellator 1
4956#define GL_SAMPLER_BUFFER_AMD             0x9001
4957#define GL_INT_SAMPLER_BUFFER_AMD         0x9002
4958#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003
4959#define GL_TESSELLATION_MODE_AMD          0x9004
4960#define GL_TESSELLATION_FACTOR_AMD        0x9005
4961#define GL_DISCRETE_AMD                   0x9006
4962#define GL_CONTINUOUS_AMD                 0x9007
4963typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor);
4964typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);
4965#ifdef GL_GLEXT_PROTOTYPES
4966GLAPI void APIENTRY glTessellationFactorAMD (GLfloat factor);
4967GLAPI void APIENTRY glTessellationModeAMD (GLenum mode);
4968#endif
4969#endif /* GL_AMD_vertex_shader_tessellator */
4970
4971#ifndef GL_AMD_vertex_shader_viewport_index
4972#define GL_AMD_vertex_shader_viewport_index 1
4973#endif /* GL_AMD_vertex_shader_viewport_index */
4974
4975#ifndef GL_APPLE_aux_depth_stencil
4976#define GL_APPLE_aux_depth_stencil 1
4977#define GL_AUX_DEPTH_STENCIL_APPLE        0x8A14
4978#endif /* GL_APPLE_aux_depth_stencil */
4979
4980#ifndef GL_APPLE_client_storage
4981#define GL_APPLE_client_storage 1
4982#define GL_UNPACK_CLIENT_STORAGE_APPLE    0x85B2
4983#endif /* GL_APPLE_client_storage */
4984
4985#ifndef GL_APPLE_element_array
4986#define GL_APPLE_element_array 1
4987#define GL_ELEMENT_ARRAY_APPLE            0x8A0C
4988#define GL_ELEMENT_ARRAY_TYPE_APPLE       0x8A0D
4989#define GL_ELEMENT_ARRAY_POINTER_APPLE    0x8A0E
4990typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const void *pointer);
4991typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count);
4992typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);
4993typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
4994typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);
4995#ifdef GL_GLEXT_PROTOTYPES
4996GLAPI void APIENTRY glElementPointerAPPLE (GLenum type, const void *pointer);
4997GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum mode, GLint first, GLsizei count);
4998GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);
4999GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
5000GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);
5001#endif
5002#endif /* GL_APPLE_element_array */
5003
5004#ifndef GL_APPLE_fence
5005#define GL_APPLE_fence 1
5006#define GL_DRAW_PIXELS_APPLE              0x8A0A
5007#define GL_FENCE_APPLE                    0x8A0B
5008typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences);
5009typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences);
5010typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence);
5011typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence);
5012typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence);
5013typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence);
5014typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name);
5015typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name);
5016#ifdef GL_GLEXT_PROTOTYPES
5017GLAPI void APIENTRY glGenFencesAPPLE (GLsizei n, GLuint *fences);
5018GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei n, const GLuint *fences);
5019GLAPI void APIENTRY glSetFenceAPPLE (GLuint fence);
5020GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint fence);
5021GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint fence);
5022GLAPI void APIENTRY glFinishFenceAPPLE (GLuint fence);
5023GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum object, GLuint name);
5024GLAPI void APIENTRY glFinishObjectAPPLE (GLenum object, GLint name);
5025#endif
5026#endif /* GL_APPLE_fence */
5027
5028#ifndef GL_APPLE_float_pixels
5029#define GL_APPLE_float_pixels 1
5030#define GL_HALF_APPLE                     0x140B
5031#define GL_RGBA_FLOAT32_APPLE             0x8814
5032#define GL_RGB_FLOAT32_APPLE              0x8815
5033#define GL_ALPHA_FLOAT32_APPLE            0x8816
5034#define GL_INTENSITY_FLOAT32_APPLE        0x8817
5035#define GL_LUMINANCE_FLOAT32_APPLE        0x8818
5036#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE  0x8819
5037#define GL_RGBA_FLOAT16_APPLE             0x881A
5038#define GL_RGB_FLOAT16_APPLE              0x881B
5039#define GL_ALPHA_FLOAT16_APPLE            0x881C
5040#define GL_INTENSITY_FLOAT16_APPLE        0x881D
5041#define GL_LUMINANCE_FLOAT16_APPLE        0x881E
5042#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE  0x881F
5043#define GL_COLOR_FLOAT_APPLE              0x8A0F
5044#endif /* GL_APPLE_float_pixels */
5045
5046#ifndef GL_APPLE_flush_buffer_range
5047#define GL_APPLE_flush_buffer_range 1
5048#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12
5049#define GL_BUFFER_FLUSHING_UNMAP_APPLE    0x8A13
5050typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param);
5051typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size);
5052#ifdef GL_GLEXT_PROTOTYPES
5053GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum target, GLenum pname, GLint param);
5054GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum target, GLintptr offset, GLsizeiptr size);
5055#endif
5056#endif /* GL_APPLE_flush_buffer_range */
5057
5058#ifndef GL_APPLE_object_purgeable
5059#define GL_APPLE_object_purgeable 1
5060#define GL_BUFFER_OBJECT_APPLE            0x85B3
5061#define GL_RELEASED_APPLE                 0x8A19
5062#define GL_VOLATILE_APPLE                 0x8A1A
5063#define GL_RETAINED_APPLE                 0x8A1B
5064#define GL_UNDEFINED_APPLE                0x8A1C
5065#define GL_PURGEABLE_APPLE                0x8A1D
5066typedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
5067typedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
5068typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params);
5069#ifdef GL_GLEXT_PROTOTYPES
5070GLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum objectType, GLuint name, GLenum option);
5071GLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum objectType, GLuint name, GLenum option);
5072GLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum objectType, GLuint name, GLenum pname, GLint *params);
5073#endif
5074#endif /* GL_APPLE_object_purgeable */
5075
5076#ifndef GL_APPLE_rgb_422
5077#define GL_APPLE_rgb_422 1
5078#define GL_RGB_422_APPLE                  0x8A1F
5079#define GL_UNSIGNED_SHORT_8_8_APPLE       0x85BA
5080#define GL_UNSIGNED_SHORT_8_8_REV_APPLE   0x85BB
5081#define GL_RGB_RAW_422_APPLE              0x8A51
5082#endif /* GL_APPLE_rgb_422 */
5083
5084#ifndef GL_APPLE_row_bytes
5085#define GL_APPLE_row_bytes 1
5086#define GL_PACK_ROW_BYTES_APPLE           0x8A15
5087#define GL_UNPACK_ROW_BYTES_APPLE         0x8A16
5088#endif /* GL_APPLE_row_bytes */
5089
5090#ifndef GL_APPLE_specular_vector
5091#define GL_APPLE_specular_vector 1
5092#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0
5093#endif /* GL_APPLE_specular_vector */
5094
5095#ifndef GL_APPLE_texture_range
5096#define GL_APPLE_texture_range 1
5097#define GL_TEXTURE_RANGE_LENGTH_APPLE     0x85B7
5098#define GL_TEXTURE_RANGE_POINTER_APPLE    0x85B8
5099#define GL_TEXTURE_STORAGE_HINT_APPLE     0x85BC
5100#define GL_STORAGE_PRIVATE_APPLE          0x85BD
5101#define GL_STORAGE_CACHED_APPLE           0x85BE
5102#define GL_STORAGE_SHARED_APPLE           0x85BF
5103typedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const void *pointer);
5104typedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, void **params);
5105#ifdef GL_GLEXT_PROTOTYPES
5106GLAPI void APIENTRY glTextureRangeAPPLE (GLenum target, GLsizei length, const void *pointer);
5107GLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum target, GLenum pname, void **params);
5108#endif
5109#endif /* GL_APPLE_texture_range */
5110
5111#ifndef GL_APPLE_transform_hint
5112#define GL_APPLE_transform_hint 1
5113#define GL_TRANSFORM_HINT_APPLE           0x85B1
5114#endif /* GL_APPLE_transform_hint */
5115
5116#ifndef GL_APPLE_vertex_array_object
5117#define GL_APPLE_vertex_array_object 1
5118#define GL_VERTEX_ARRAY_BINDING_APPLE     0x85B5
5119typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array);
5120typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays);
5121typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays);
5122typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);
5123#ifdef GL_GLEXT_PROTOTYPES
5124GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint array);
5125GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei n, const GLuint *arrays);
5126GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei n, GLuint *arrays);
5127GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint array);
5128#endif
5129#endif /* GL_APPLE_vertex_array_object */
5130
5131#ifndef GL_APPLE_vertex_array_range
5132#define GL_APPLE_vertex_array_range 1
5133#define GL_VERTEX_ARRAY_RANGE_APPLE       0x851D
5134#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E
5135#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F
5136#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521
5137#define GL_STORAGE_CLIENT_APPLE           0x85B4
5138typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer);
5139typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer);
5140typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param);
5141#ifdef GL_GLEXT_PROTOTYPES
5142GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei length, void *pointer);
5143GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei length, void *pointer);
5144GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum pname, GLint param);
5145#endif
5146#endif /* GL_APPLE_vertex_array_range */
5147
5148#ifndef GL_APPLE_vertex_program_evaluators
5149#define GL_APPLE_vertex_program_evaluators 1
5150#define GL_VERTEX_ATTRIB_MAP1_APPLE       0x8A00
5151#define GL_VERTEX_ATTRIB_MAP2_APPLE       0x8A01
5152#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE  0x8A02
5153#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03
5154#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04
5155#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05
5156#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE  0x8A06
5157#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07
5158#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08
5159#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09
5160typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
5161typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
5162typedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname);
5163typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
5164typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
5165typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
5166typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
5167#ifdef GL_GLEXT_PROTOTYPES
5168GLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint index, GLenum pname);
5169GLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint index, GLenum pname);
5170GLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint index, GLenum pname);
5171GLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
5172GLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
5173GLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
5174GLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
5175#endif
5176#endif /* GL_APPLE_vertex_program_evaluators */
5177
5178#ifndef GL_APPLE_ycbcr_422
5179#define GL_APPLE_ycbcr_422 1
5180#define GL_YCBCR_422_APPLE                0x85B9
5181#endif /* GL_APPLE_ycbcr_422 */
5182
5183#ifndef GL_ATI_draw_buffers
5184#define GL_ATI_draw_buffers 1
5185#define GL_MAX_DRAW_BUFFERS_ATI           0x8824
5186#define GL_DRAW_BUFFER0_ATI               0x8825
5187#define GL_DRAW_BUFFER1_ATI               0x8826
5188#define GL_DRAW_BUFFER2_ATI               0x8827
5189#define GL_DRAW_BUFFER3_ATI               0x8828
5190#define GL_DRAW_BUFFER4_ATI               0x8829
5191#define GL_DRAW_BUFFER5_ATI               0x882A
5192#define GL_DRAW_BUFFER6_ATI               0x882B
5193#define GL_DRAW_BUFFER7_ATI               0x882C
5194#define GL_DRAW_BUFFER8_ATI               0x882D
5195#define GL_DRAW_BUFFER9_ATI               0x882E
5196#define GL_DRAW_BUFFER10_ATI              0x882F
5197#define GL_DRAW_BUFFER11_ATI              0x8830
5198#define GL_DRAW_BUFFER12_ATI              0x8831
5199#define GL_DRAW_BUFFER13_ATI              0x8832
5200#define GL_DRAW_BUFFER14_ATI              0x8833
5201#define GL_DRAW_BUFFER15_ATI              0x8834
5202typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs);
5203#ifdef GL_GLEXT_PROTOTYPES
5204GLAPI void APIENTRY glDrawBuffersATI (GLsizei n, const GLenum *bufs);
5205#endif
5206#endif /* GL_ATI_draw_buffers */
5207
5208#ifndef GL_ATI_element_array
5209#define GL_ATI_element_array 1
5210#define GL_ELEMENT_ARRAY_ATI              0x8768
5211#define GL_ELEMENT_ARRAY_TYPE_ATI         0x8769
5212#define GL_ELEMENT_ARRAY_POINTER_ATI      0x876A
5213typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const void *pointer);
5214typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count);
5215typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count);
5216#ifdef GL_GLEXT_PROTOTYPES
5217GLAPI void APIENTRY glElementPointerATI (GLenum type, const void *pointer);
5218GLAPI void APIENTRY glDrawElementArrayATI (GLenum mode, GLsizei count);
5219GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum mode, GLuint start, GLuint end, GLsizei count);
5220#endif
5221#endif /* GL_ATI_element_array */
5222
5223#ifndef GL_ATI_envmap_bumpmap
5224#define GL_ATI_envmap_bumpmap 1
5225#define GL_BUMP_ROT_MATRIX_ATI            0x8775
5226#define GL_BUMP_ROT_MATRIX_SIZE_ATI       0x8776
5227#define GL_BUMP_NUM_TEX_UNITS_ATI         0x8777
5228#define GL_BUMP_TEX_UNITS_ATI             0x8778
5229#define GL_DUDV_ATI                       0x8779
5230#define GL_DU8DV8_ATI                     0x877A
5231#define GL_BUMP_ENVMAP_ATI                0x877B
5232#define GL_BUMP_TARGET_ATI                0x877C
5233typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param);
5234typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param);
5235typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param);
5236typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param);
5237#ifdef GL_GLEXT_PROTOTYPES
5238GLAPI void APIENTRY glTexBumpParameterivATI (GLenum pname, const GLint *param);
5239GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum pname, const GLfloat *param);
5240GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum pname, GLint *param);
5241GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum pname, GLfloat *param);
5242#endif
5243#endif /* GL_ATI_envmap_bumpmap */
5244
5245#ifndef GL_ATI_fragment_shader
5246#define GL_ATI_fragment_shader 1
5247#define GL_FRAGMENT_SHADER_ATI            0x8920
5248#define GL_REG_0_ATI                      0x8921
5249#define GL_REG_1_ATI                      0x8922
5250#define GL_REG_2_ATI                      0x8923
5251#define GL_REG_3_ATI                      0x8924
5252#define GL_REG_4_ATI                      0x8925
5253#define GL_REG_5_ATI                      0x8926
5254#define GL_REG_6_ATI                      0x8927
5255#define GL_REG_7_ATI                      0x8928
5256#define GL_REG_8_ATI                      0x8929
5257#define GL_REG_9_ATI                      0x892A
5258#define GL_REG_10_ATI                     0x892B
5259#define GL_REG_11_ATI                     0x892C
5260#define GL_REG_12_ATI                     0x892D
5261#define GL_REG_13_ATI                     0x892E
5262#define GL_REG_14_ATI                     0x892F
5263#define GL_REG_15_ATI                     0x8930
5264#define GL_REG_16_ATI                     0x8931
5265#define GL_REG_17_ATI                     0x8932
5266#define GL_REG_18_ATI                     0x8933
5267#define GL_REG_19_ATI                     0x8934
5268#define GL_REG_20_ATI                     0x8935
5269#define GL_REG_21_ATI                     0x8936
5270#define GL_REG_22_ATI                     0x8937
5271#define GL_REG_23_ATI                     0x8938
5272#define GL_REG_24_ATI                     0x8939
5273#define GL_REG_25_ATI                     0x893A
5274#define GL_REG_26_ATI                     0x893B
5275#define GL_REG_27_ATI                     0x893C
5276#define GL_REG_28_ATI                     0x893D
5277#define GL_REG_29_ATI                     0x893E
5278#define GL_REG_30_ATI                     0x893F
5279#define GL_REG_31_ATI                     0x8940
5280#define GL_CON_0_ATI                      0x8941
5281#define GL_CON_1_ATI                      0x8942
5282#define GL_CON_2_ATI                      0x8943
5283#define GL_CON_3_ATI                      0x8944
5284#define GL_CON_4_ATI                      0x8945
5285#define GL_CON_5_ATI                      0x8946
5286#define GL_CON_6_ATI                      0x8947
5287#define GL_CON_7_ATI                      0x8948
5288#define GL_CON_8_ATI                      0x8949
5289#define GL_CON_9_ATI                      0x894A
5290#define GL_CON_10_ATI                     0x894B
5291#define GL_CON_11_ATI                     0x894C
5292#define GL_CON_12_ATI                     0x894D
5293#define GL_CON_13_ATI                     0x894E
5294#define GL_CON_14_ATI                     0x894F
5295#define GL_CON_15_ATI                     0x8950
5296#define GL_CON_16_ATI                     0x8951
5297#define GL_CON_17_ATI                     0x8952
5298#define GL_CON_18_ATI                     0x8953
5299#define GL_CON_19_ATI                     0x8954
5300#define GL_CON_20_ATI                     0x8955
5301#define GL_CON_21_ATI                     0x8956
5302#define GL_CON_22_ATI                     0x8957
5303#define GL_CON_23_ATI                     0x8958
5304#define GL_CON_24_ATI                     0x8959
5305#define GL_CON_25_ATI                     0x895A
5306#define GL_CON_26_ATI                     0x895B
5307#define GL_CON_27_ATI                     0x895C
5308#define GL_CON_28_ATI                     0x895D
5309#define GL_CON_29_ATI                     0x895E
5310#define GL_CON_30_ATI                     0x895F
5311#define GL_CON_31_ATI                     0x8960
5312#define GL_MOV_ATI                        0x8961
5313#define GL_ADD_ATI                        0x8963
5314#define GL_MUL_ATI                        0x8964
5315#define GL_SUB_ATI                        0x8965
5316#define GL_DOT3_ATI                       0x8966
5317#define GL_DOT4_ATI                       0x8967
5318#define GL_MAD_ATI                        0x8968
5319#define GL_LERP_ATI                       0x8969
5320#define GL_CND_ATI                        0x896A
5321#define GL_CND0_ATI                       0x896B
5322#define GL_DOT2_ADD_ATI                   0x896C
5323#define GL_SECONDARY_INTERPOLATOR_ATI     0x896D
5324#define GL_NUM_FRAGMENT_REGISTERS_ATI     0x896E
5325#define GL_NUM_FRAGMENT_CONSTANTS_ATI     0x896F
5326#define GL_NUM_PASSES_ATI                 0x8970
5327#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI  0x8971
5328#define GL_NUM_INSTRUCTIONS_TOTAL_ATI     0x8972
5329#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973
5330#define GL_NUM_LOOPBACK_COMPONENTS_ATI    0x8974
5331#define GL_COLOR_ALPHA_PAIRING_ATI        0x8975
5332#define GL_SWIZZLE_STR_ATI                0x8976
5333#define GL_SWIZZLE_STQ_ATI                0x8977
5334#define GL_SWIZZLE_STR_DR_ATI             0x8978
5335#define GL_SWIZZLE_STQ_DQ_ATI             0x8979
5336#define GL_SWIZZLE_STRQ_ATI               0x897A
5337#define GL_SWIZZLE_STRQ_DQ_ATI            0x897B
5338#define GL_RED_BIT_ATI                    0x00000001
5339#define GL_GREEN_BIT_ATI                  0x00000002
5340#define GL_BLUE_BIT_ATI                   0x00000004
5341#define GL_2X_BIT_ATI                     0x00000001
5342#define GL_4X_BIT_ATI                     0x00000002
5343#define GL_8X_BIT_ATI                     0x00000004
5344#define GL_HALF_BIT_ATI                   0x00000008
5345#define GL_QUARTER_BIT_ATI                0x00000010
5346#define GL_EIGHTH_BIT_ATI                 0x00000020
5347#define GL_SATURATE_BIT_ATI               0x00000040
5348#define GL_COMP_BIT_ATI                   0x00000002
5349#define GL_NEGATE_BIT_ATI                 0x00000004
5350#define GL_BIAS_BIT_ATI                   0x00000008
5351typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range);
5352typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id);
5353typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id);
5354typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void);
5355typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void);
5356typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle);
5357typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle);
5358typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
5359typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
5360typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
5361typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
5362typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
5363typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
5364typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value);
5365#ifdef GL_GLEXT_PROTOTYPES
5366GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint range);
5367GLAPI void APIENTRY glBindFragmentShaderATI (GLuint id);
5368GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint id);
5369GLAPI void APIENTRY glBeginFragmentShaderATI (void);
5370GLAPI void APIENTRY glEndFragmentShaderATI (void);
5371GLAPI void APIENTRY glPassTexCoordATI (GLuint dst, GLuint coord, GLenum swizzle);
5372GLAPI void APIENTRY glSampleMapATI (GLuint dst, GLuint interp, GLenum swizzle);
5373GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
5374GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
5375GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
5376GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
5377GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
5378GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
5379GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint dst, const GLfloat *value);
5380#endif
5381#endif /* GL_ATI_fragment_shader */
5382
5383#ifndef GL_ATI_map_object_buffer
5384#define GL_ATI_map_object_buffer 1
5385typedef void *(APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer);
5386typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer);
5387#ifdef GL_GLEXT_PROTOTYPES
5388GLAPI void *APIENTRY glMapObjectBufferATI (GLuint buffer);
5389GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint buffer);
5390#endif
5391#endif /* GL_ATI_map_object_buffer */
5392
5393#ifndef GL_ATI_meminfo
5394#define GL_ATI_meminfo 1
5395#define GL_VBO_FREE_MEMORY_ATI            0x87FB
5396#define GL_TEXTURE_FREE_MEMORY_ATI        0x87FC
5397#define GL_RENDERBUFFER_FREE_MEMORY_ATI   0x87FD
5398#endif /* GL_ATI_meminfo */
5399
5400#ifndef GL_ATI_pixel_format_float
5401#define GL_ATI_pixel_format_float 1
5402#define GL_RGBA_FLOAT_MODE_ATI            0x8820
5403#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835
5404#endif /* GL_ATI_pixel_format_float */
5405
5406#ifndef GL_ATI_pn_triangles
5407#define GL_ATI_pn_triangles 1
5408#define GL_PN_TRIANGLES_ATI               0x87F0
5409#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1
5410#define GL_PN_TRIANGLES_POINT_MODE_ATI    0x87F2
5411#define GL_PN_TRIANGLES_NORMAL_MODE_ATI   0x87F3
5412#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4
5413#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5
5414#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6
5415#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7
5416#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8
5417typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param);
5418typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param);
5419#ifdef GL_GLEXT_PROTOTYPES
5420GLAPI void APIENTRY glPNTrianglesiATI (GLenum pname, GLint param);
5421GLAPI void APIENTRY glPNTrianglesfATI (GLenum pname, GLfloat param);
5422#endif
5423#endif /* GL_ATI_pn_triangles */
5424
5425#ifndef GL_ATI_separate_stencil
5426#define GL_ATI_separate_stencil 1
5427#define GL_STENCIL_BACK_FUNC_ATI          0x8800
5428#define GL_STENCIL_BACK_FAIL_ATI          0x8801
5429#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802
5430#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803
5431typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
5432typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
5433#ifdef GL_GLEXT_PROTOTYPES
5434GLAPI void APIENTRY glStencilOpSeparateATI (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
5435GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
5436#endif
5437#endif /* GL_ATI_separate_stencil */
5438
5439#ifndef GL_ATI_text_fragment_shader
5440#define GL_ATI_text_fragment_shader 1
5441#define GL_TEXT_FRAGMENT_SHADER_ATI       0x8200
5442#endif /* GL_ATI_text_fragment_shader */
5443
5444#ifndef GL_ATI_texture_env_combine3
5445#define GL_ATI_texture_env_combine3 1
5446#define GL_MODULATE_ADD_ATI               0x8744
5447#define GL_MODULATE_SIGNED_ADD_ATI        0x8745
5448#define GL_MODULATE_SUBTRACT_ATI          0x8746
5449#endif /* GL_ATI_texture_env_combine3 */
5450
5451#ifndef GL_ATI_texture_float
5452#define GL_ATI_texture_float 1
5453#define GL_RGBA_FLOAT32_ATI               0x8814
5454#define GL_RGB_FLOAT32_ATI                0x8815
5455#define GL_ALPHA_FLOAT32_ATI              0x8816
5456#define GL_INTENSITY_FLOAT32_ATI          0x8817
5457#define GL_LUMINANCE_FLOAT32_ATI          0x8818
5458#define GL_LUMINANCE_ALPHA_FLOAT32_ATI    0x8819
5459#define GL_RGBA_FLOAT16_ATI               0x881A
5460#define GL_RGB_FLOAT16_ATI                0x881B
5461#define GL_ALPHA_FLOAT16_ATI              0x881C
5462#define GL_INTENSITY_FLOAT16_ATI          0x881D
5463#define GL_LUMINANCE_FLOAT16_ATI          0x881E
5464#define GL_LUMINANCE_ALPHA_FLOAT16_ATI    0x881F
5465#endif /* GL_ATI_texture_float */
5466
5467#ifndef GL_ATI_texture_mirror_once
5468#define GL_ATI_texture_mirror_once 1
5469#define GL_MIRROR_CLAMP_ATI               0x8742
5470#define GL_MIRROR_CLAMP_TO_EDGE_ATI       0x8743
5471#endif /* GL_ATI_texture_mirror_once */
5472
5473#ifndef GL_ATI_vertex_array_object
5474#define GL_ATI_vertex_array_object 1
5475#define GL_STATIC_ATI                     0x8760
5476#define GL_DYNAMIC_ATI                    0x8761
5477#define GL_PRESERVE_ATI                   0x8762
5478#define GL_DISCARD_ATI                    0x8763
5479#define GL_OBJECT_BUFFER_SIZE_ATI         0x8764
5480#define GL_OBJECT_BUFFER_USAGE_ATI        0x8765
5481#define GL_ARRAY_OBJECT_BUFFER_ATI        0x8766
5482#define GL_ARRAY_OBJECT_OFFSET_ATI        0x8767
5483typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const void *pointer, GLenum usage);
5484typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer);
5485typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve);
5486typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params);
5487typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params);
5488typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer);
5489typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
5490typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params);
5491typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params);
5492typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
5493typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params);
5494typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params);
5495#ifdef GL_GLEXT_PROTOTYPES
5496GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei size, const void *pointer, GLenum usage);
5497GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint buffer);
5498GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve);
5499GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint buffer, GLenum pname, GLfloat *params);
5500GLAPI void APIENTRY glGetObjectBufferivATI (GLuint buffer, GLenum pname, GLint *params);
5501GLAPI void APIENTRY glFreeObjectBufferATI (GLuint buffer);
5502GLAPI void APIENTRY glArrayObjectATI (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
5503GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum array, GLenum pname, GLfloat *params);
5504GLAPI void APIENTRY glGetArrayObjectivATI (GLenum array, GLenum pname, GLint *params);
5505GLAPI void APIENTRY glVariantArrayObjectATI (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
5506GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint id, GLenum pname, GLfloat *params);
5507GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint id, GLenum pname, GLint *params);
5508#endif
5509#endif /* GL_ATI_vertex_array_object */
5510
5511#ifndef GL_ATI_vertex_attrib_array_object
5512#define GL_ATI_vertex_attrib_array_object 1
5513typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
5514typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params);
5515typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params);
5516#ifdef GL_GLEXT_PROTOTYPES
5517GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
5518GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint index, GLenum pname, GLfloat *params);
5519GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint index, GLenum pname, GLint *params);
5520#endif
5521#endif /* GL_ATI_vertex_attrib_array_object */
5522
5523#ifndef GL_ATI_vertex_streams
5524#define GL_ATI_vertex_streams 1
5525#define GL_MAX_VERTEX_STREAMS_ATI         0x876B
5526#define GL_VERTEX_STREAM0_ATI             0x876C
5527#define GL_VERTEX_STREAM1_ATI             0x876D
5528#define GL_VERTEX_STREAM2_ATI             0x876E
5529#define GL_VERTEX_STREAM3_ATI             0x876F
5530#define GL_VERTEX_STREAM4_ATI             0x8770
5531#define GL_VERTEX_STREAM5_ATI             0x8771
5532#define GL_VERTEX_STREAM6_ATI             0x8772
5533#define GL_VERTEX_STREAM7_ATI             0x8773
5534#define GL_VERTEX_SOURCE_ATI              0x8774
5535typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x);
5536typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords);
5537typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x);
5538typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords);
5539typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x);
5540typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords);
5541typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x);
5542typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords);
5543typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y);
5544typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords);
5545typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y);
5546typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords);
5547typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y);
5548typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords);
5549typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y);
5550typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords);
5551typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);
5552typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);
5553typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z);
5554typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);
5555typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
5556typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);
5557typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
5558typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);
5559typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);
5560typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords);
5561typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w);
5562typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords);
5563typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
5564typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords);
5565typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
5566typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords);
5567typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz);
5568typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords);
5569typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz);
5570typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);
5571typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz);
5572typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);
5573typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz);
5574typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);
5575typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz);
5576typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);
5577typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream);
5578typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param);
5579typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param);
5580#ifdef GL_GLEXT_PROTOTYPES
5581GLAPI void APIENTRY glVertexStream1sATI (GLenum stream, GLshort x);
5582GLAPI void APIENTRY glVertexStream1svATI (GLenum stream, const GLshort *coords);
5583GLAPI void APIENTRY glVertexStream1iATI (GLenum stream, GLint x);
5584GLAPI void APIENTRY glVertexStream1ivATI (GLenum stream, const GLint *coords);
5585GLAPI void APIENTRY glVertexStream1fATI (GLenum stream, GLfloat x);
5586GLAPI void APIENTRY glVertexStream1fvATI (GLenum stream, const GLfloat *coords);
5587GLAPI void APIENTRY glVertexStream1dATI (GLenum stream, GLdouble x);
5588GLAPI void APIENTRY glVertexStream1dvATI (GLenum stream, const GLdouble *coords);
5589GLAPI void APIENTRY glVertexStream2sATI (GLenum stream, GLshort x, GLshort y);
5590GLAPI void APIENTRY glVertexStream2svATI (GLenum stream, const GLshort *coords);
5591GLAPI void APIENTRY glVertexStream2iATI (GLenum stream, GLint x, GLint y);
5592GLAPI void APIENTRY glVertexStream2ivATI (GLenum stream, const GLint *coords);
5593GLAPI void APIENTRY glVertexStream2fATI (GLenum stream, GLfloat x, GLfloat y);
5594GLAPI void APIENTRY glVertexStream2fvATI (GLenum stream, const GLfloat *coords);
5595GLAPI void APIENTRY glVertexStream2dATI (GLenum stream, GLdouble x, GLdouble y);
5596GLAPI void APIENTRY glVertexStream2dvATI (GLenum stream, const GLdouble *coords);
5597GLAPI void APIENTRY glVertexStream3sATI (GLenum stream, GLshort x, GLshort y, GLshort z);
5598GLAPI void APIENTRY glVertexStream3svATI (GLenum stream, const GLshort *coords);
5599GLAPI void APIENTRY glVertexStream3iATI (GLenum stream, GLint x, GLint y, GLint z);
5600GLAPI void APIENTRY glVertexStream3ivATI (GLenum stream, const GLint *coords);
5601GLAPI void APIENTRY glVertexStream3fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
5602GLAPI void APIENTRY glVertexStream3fvATI (GLenum stream, const GLfloat *coords);
5603GLAPI void APIENTRY glVertexStream3dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
5604GLAPI void APIENTRY glVertexStream3dvATI (GLenum stream, const GLdouble *coords);
5605GLAPI void APIENTRY glVertexStream4sATI (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);
5606GLAPI void APIENTRY glVertexStream4svATI (GLenum stream, const GLshort *coords);
5607GLAPI void APIENTRY glVertexStream4iATI (GLenum stream, GLint x, GLint y, GLint z, GLint w);
5608GLAPI void APIENTRY glVertexStream4ivATI (GLenum stream, const GLint *coords);
5609GLAPI void APIENTRY glVertexStream4fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
5610GLAPI void APIENTRY glVertexStream4fvATI (GLenum stream, const GLfloat *coords);
5611GLAPI void APIENTRY glVertexStream4dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
5612GLAPI void APIENTRY glVertexStream4dvATI (GLenum stream, const GLdouble *coords);
5613GLAPI void APIENTRY glNormalStream3bATI (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz);
5614GLAPI void APIENTRY glNormalStream3bvATI (GLenum stream, const GLbyte *coords);
5615GLAPI void APIENTRY glNormalStream3sATI (GLenum stream, GLshort nx, GLshort ny, GLshort nz);
5616GLAPI void APIENTRY glNormalStream3svATI (GLenum stream, const GLshort *coords);
5617GLAPI void APIENTRY glNormalStream3iATI (GLenum stream, GLint nx, GLint ny, GLint nz);
5618GLAPI void APIENTRY glNormalStream3ivATI (GLenum stream, const GLint *coords);
5619GLAPI void APIENTRY glNormalStream3fATI (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz);
5620GLAPI void APIENTRY glNormalStream3fvATI (GLenum stream, const GLfloat *coords);
5621GLAPI void APIENTRY glNormalStream3dATI (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz);
5622GLAPI void APIENTRY glNormalStream3dvATI (GLenum stream, const GLdouble *coords);
5623GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum stream);
5624GLAPI void APIENTRY glVertexBlendEnviATI (GLenum pname, GLint param);
5625GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum pname, GLfloat param);
5626#endif
5627#endif /* GL_ATI_vertex_streams */
5628
5629#ifndef GL_EXT_422_pixels
5630#define GL_EXT_422_pixels 1
5631#define GL_422_EXT                        0x80CC
5632#define GL_422_REV_EXT                    0x80CD
5633#define GL_422_AVERAGE_EXT                0x80CE
5634#define GL_422_REV_AVERAGE_EXT            0x80CF
5635#endif /* GL_EXT_422_pixels */
5636
5637#ifndef GL_EXT_abgr
5638#define GL_EXT_abgr 1
5639#define GL_ABGR_EXT                       0x8000
5640#endif /* GL_EXT_abgr */
5641
5642#ifndef GL_EXT_bgra
5643#define GL_EXT_bgra 1
5644#define GL_BGR_EXT                        0x80E0
5645#define GL_BGRA_EXT                       0x80E1
5646#endif /* GL_EXT_bgra */
5647
5648#ifndef GL_EXT_bindable_uniform
5649#define GL_EXT_bindable_uniform 1
5650#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2
5651#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3
5652#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4
5653#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT  0x8DED
5654#define GL_UNIFORM_BUFFER_EXT             0x8DEE
5655#define GL_UNIFORM_BUFFER_BINDING_EXT     0x8DEF
5656typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer);
5657typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location);
5658typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location);
5659#ifdef GL_GLEXT_PROTOTYPES
5660GLAPI void APIENTRY glUniformBufferEXT (GLuint program, GLint location, GLuint buffer);
5661GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint program, GLint location);
5662GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint program, GLint location);
5663#endif
5664#endif /* GL_EXT_bindable_uniform */
5665
5666#ifndef GL_EXT_blend_color
5667#define GL_EXT_blend_color 1
5668#define GL_CONSTANT_COLOR_EXT             0x8001
5669#define GL_ONE_MINUS_CONSTANT_COLOR_EXT   0x8002
5670#define GL_CONSTANT_ALPHA_EXT             0x8003
5671#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT   0x8004
5672#define GL_BLEND_COLOR_EXT                0x8005
5673typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
5674#ifdef GL_GLEXT_PROTOTYPES
5675GLAPI void APIENTRY glBlendColorEXT (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
5676#endif
5677#endif /* GL_EXT_blend_color */
5678
5679#ifndef GL_EXT_blend_equation_separate
5680#define GL_EXT_blend_equation_separate 1
5681#define GL_BLEND_EQUATION_RGB_EXT         0x8009
5682#define GL_BLEND_EQUATION_ALPHA_EXT       0x883D
5683typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha);
5684#ifdef GL_GLEXT_PROTOTYPES
5685GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha);
5686#endif
5687#endif /* GL_EXT_blend_equation_separate */
5688
5689#ifndef GL_EXT_blend_func_separate
5690#define GL_EXT_blend_func_separate 1
5691#define GL_BLEND_DST_RGB_EXT              0x80C8
5692#define GL_BLEND_SRC_RGB_EXT              0x80C9
5693#define GL_BLEND_DST_ALPHA_EXT            0x80CA
5694#define GL_BLEND_SRC_ALPHA_EXT            0x80CB
5695typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
5696#ifdef GL_GLEXT_PROTOTYPES
5697GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
5698#endif
5699#endif /* GL_EXT_blend_func_separate */
5700
5701#ifndef GL_EXT_blend_logic_op
5702#define GL_EXT_blend_logic_op 1
5703#endif /* GL_EXT_blend_logic_op */
5704
5705#ifndef GL_EXT_blend_minmax
5706#define GL_EXT_blend_minmax 1
5707#define GL_MIN_EXT                        0x8007
5708#define GL_MAX_EXT                        0x8008
5709#define GL_FUNC_ADD_EXT                   0x8006
5710#define GL_BLEND_EQUATION_EXT             0x8009
5711typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);
5712#ifdef GL_GLEXT_PROTOTYPES
5713GLAPI void APIENTRY glBlendEquationEXT (GLenum mode);
5714#endif
5715#endif /* GL_EXT_blend_minmax */
5716
5717#ifndef GL_EXT_blend_subtract
5718#define GL_EXT_blend_subtract 1
5719#define GL_FUNC_SUBTRACT_EXT              0x800A
5720#define GL_FUNC_REVERSE_SUBTRACT_EXT      0x800B
5721#endif /* GL_EXT_blend_subtract */
5722
5723#ifndef GL_EXT_clip_volume_hint
5724#define GL_EXT_clip_volume_hint 1
5725#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT  0x80F0
5726#endif /* GL_EXT_clip_volume_hint */
5727
5728#ifndef GL_EXT_cmyka
5729#define GL_EXT_cmyka 1
5730#define GL_CMYK_EXT                       0x800C
5731#define GL_CMYKA_EXT                      0x800D
5732#define GL_PACK_CMYK_HINT_EXT             0x800E
5733#define GL_UNPACK_CMYK_HINT_EXT           0x800F
5734#endif /* GL_EXT_cmyka */
5735
5736#ifndef GL_EXT_color_subtable
5737#define GL_EXT_color_subtable 1
5738typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
5739typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
5740#ifdef GL_GLEXT_PROTOTYPES
5741GLAPI void APIENTRY glColorSubTableEXT (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
5742GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
5743#endif
5744#endif /* GL_EXT_color_subtable */
5745
5746#ifndef GL_EXT_compiled_vertex_array
5747#define GL_EXT_compiled_vertex_array 1
5748#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT   0x81A8
5749#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT   0x81A9
5750typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
5751typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void);
5752#ifdef GL_GLEXT_PROTOTYPES
5753GLAPI void APIENTRY glLockArraysEXT (GLint first, GLsizei count);
5754GLAPI void APIENTRY glUnlockArraysEXT (void);
5755#endif
5756#endif /* GL_EXT_compiled_vertex_array */
5757
5758#ifndef GL_EXT_convolution
5759#define GL_EXT_convolution 1
5760#define GL_CONVOLUTION_1D_EXT             0x8010
5761#define GL_CONVOLUTION_2D_EXT             0x8011
5762#define GL_SEPARABLE_2D_EXT               0x8012
5763#define GL_CONVOLUTION_BORDER_MODE_EXT    0x8013
5764#define GL_CONVOLUTION_FILTER_SCALE_EXT   0x8014
5765#define GL_CONVOLUTION_FILTER_BIAS_EXT    0x8015
5766#define GL_REDUCE_EXT                     0x8016
5767#define GL_CONVOLUTION_FORMAT_EXT         0x8017
5768#define GL_CONVOLUTION_WIDTH_EXT          0x8018
5769#define GL_CONVOLUTION_HEIGHT_EXT         0x8019
5770#define GL_MAX_CONVOLUTION_WIDTH_EXT      0x801A
5771#define GL_MAX_CONVOLUTION_HEIGHT_EXT     0x801B
5772#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C
5773#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D
5774#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E
5775#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F
5776#define GL_POST_CONVOLUTION_RED_BIAS_EXT  0x8020
5777#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021
5778#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022
5779#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023
5780typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
5781typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
5782typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params);
5783typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);
5784typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params);
5785typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
5786typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
5787typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
5788typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *image);
5789typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
5790typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
5791typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
5792typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
5793#ifdef GL_GLEXT_PROTOTYPES
5794GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
5795GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
5796GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum target, GLenum pname, GLfloat params);
5797GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params);
5798GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum target, GLenum pname, GLint params);
5799GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum target, GLenum pname, const GLint *params);
5800GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
5801GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
5802GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum target, GLenum format, GLenum type, void *image);
5803GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
5804GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum target, GLenum pname, GLint *params);
5805GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
5806GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
5807#endif
5808#endif /* GL_EXT_convolution */
5809
5810#ifndef GL_EXT_coordinate_frame
5811#define GL_EXT_coordinate_frame 1
5812#define GL_TANGENT_ARRAY_EXT              0x8439
5813#define GL_BINORMAL_ARRAY_EXT             0x843A
5814#define GL_CURRENT_TANGENT_EXT            0x843B
5815#define GL_CURRENT_BINORMAL_EXT           0x843C
5816#define GL_TANGENT_ARRAY_TYPE_EXT         0x843E
5817#define GL_TANGENT_ARRAY_STRIDE_EXT       0x843F
5818#define GL_BINORMAL_ARRAY_TYPE_EXT        0x8440
5819#define GL_BINORMAL_ARRAY_STRIDE_EXT      0x8441
5820#define GL_TANGENT_ARRAY_POINTER_EXT      0x8442
5821#define GL_BINORMAL_ARRAY_POINTER_EXT     0x8443
5822#define GL_MAP1_TANGENT_EXT               0x8444
5823#define GL_MAP2_TANGENT_EXT               0x8445
5824#define GL_MAP1_BINORMAL_EXT              0x8446
5825#define GL_MAP2_BINORMAL_EXT              0x8447
5826typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz);
5827typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v);
5828typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz);
5829typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v);
5830typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz);
5831typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v);
5832typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz);
5833typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v);
5834typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz);
5835typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v);
5836typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz);
5837typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v);
5838typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz);
5839typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v);
5840typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz);
5841typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v);
5842typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz);
5843typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v);
5844typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz);
5845typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v);
5846typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer);
5847typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer);
5848#ifdef GL_GLEXT_PROTOTYPES
5849GLAPI void APIENTRY glTangent3bEXT (GLbyte tx, GLbyte ty, GLbyte tz);
5850GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *v);
5851GLAPI void APIENTRY glTangent3dEXT (GLdouble tx, GLdouble ty, GLdouble tz);
5852GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *v);
5853GLAPI void APIENTRY glTangent3fEXT (GLfloat tx, GLfloat ty, GLfloat tz);
5854GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *v);
5855GLAPI void APIENTRY glTangent3iEXT (GLint tx, GLint ty, GLint tz);
5856GLAPI void APIENTRY glTangent3ivEXT (const GLint *v);
5857GLAPI void APIENTRY glTangent3sEXT (GLshort tx, GLshort ty, GLshort tz);
5858GLAPI void APIENTRY glTangent3svEXT (const GLshort *v);
5859GLAPI void APIENTRY glBinormal3bEXT (GLbyte bx, GLbyte by, GLbyte bz);
5860GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *v);
5861GLAPI void APIENTRY glBinormal3dEXT (GLdouble bx, GLdouble by, GLdouble bz);
5862GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *v);
5863GLAPI void APIENTRY glBinormal3fEXT (GLfloat bx, GLfloat by, GLfloat bz);
5864GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *v);
5865GLAPI void APIENTRY glBinormal3iEXT (GLint bx, GLint by, GLint bz);
5866GLAPI void APIENTRY glBinormal3ivEXT (const GLint *v);
5867GLAPI void APIENTRY glBinormal3sEXT (GLshort bx, GLshort by, GLshort bz);
5868GLAPI void APIENTRY glBinormal3svEXT (const GLshort *v);
5869GLAPI void APIENTRY glTangentPointerEXT (GLenum type, GLsizei stride, const void *pointer);
5870GLAPI void APIENTRY glBinormalPointerEXT (GLenum type, GLsizei stride, const void *pointer);
5871#endif
5872#endif /* GL_EXT_coordinate_frame */
5873
5874#ifndef GL_EXT_copy_texture
5875#define GL_EXT_copy_texture 1
5876typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
5877typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
5878typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
5879typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
5880typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
5881#ifdef GL_GLEXT_PROTOTYPES
5882GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
5883GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
5884GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
5885GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
5886GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
5887#endif
5888#endif /* GL_EXT_copy_texture */
5889
5890#ifndef GL_EXT_cull_vertex
5891#define GL_EXT_cull_vertex 1
5892#define GL_CULL_VERTEX_EXT                0x81AA
5893#define GL_CULL_VERTEX_EYE_POSITION_EXT   0x81AB
5894#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC
5895typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params);
5896typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params);
5897#ifdef GL_GLEXT_PROTOTYPES
5898GLAPI void APIENTRY glCullParameterdvEXT (GLenum pname, GLdouble *params);
5899GLAPI void APIENTRY glCullParameterfvEXT (GLenum pname, GLfloat *params);
5900#endif
5901#endif /* GL_EXT_cull_vertex */
5902
5903#ifndef GL_EXT_debug_label
5904#define GL_EXT_debug_label 1
5905#define GL_PROGRAM_PIPELINE_OBJECT_EXT    0x8A4F
5906#define GL_PROGRAM_OBJECT_EXT             0x8B40
5907#define GL_SHADER_OBJECT_EXT              0x8B48
5908#define GL_BUFFER_OBJECT_EXT              0x9151
5909#define GL_QUERY_OBJECT_EXT               0x9153
5910#define GL_VERTEX_ARRAY_OBJECT_EXT        0x9154
5911typedef void (APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
5912typedef void (APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
5913#ifdef GL_GLEXT_PROTOTYPES
5914GLAPI void APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
5915GLAPI void APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
5916#endif
5917#endif /* GL_EXT_debug_label */
5918
5919#ifndef GL_EXT_debug_marker
5920#define GL_EXT_debug_marker 1
5921typedef void (APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
5922typedef void (APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
5923typedef void (APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
5924#ifdef GL_GLEXT_PROTOTYPES
5925GLAPI void APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
5926GLAPI void APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
5927GLAPI void APIENTRY glPopGroupMarkerEXT (void);
5928#endif
5929#endif /* GL_EXT_debug_marker */
5930
5931#ifndef GL_EXT_depth_bounds_test
5932#define GL_EXT_depth_bounds_test 1
5933#define GL_DEPTH_BOUNDS_TEST_EXT          0x8890
5934#define GL_DEPTH_BOUNDS_EXT               0x8891
5935typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax);
5936#ifdef GL_GLEXT_PROTOTYPES
5937GLAPI void APIENTRY glDepthBoundsEXT (GLclampd zmin, GLclampd zmax);
5938#endif
5939#endif /* GL_EXT_depth_bounds_test */
5940
5941#ifndef GL_EXT_direct_state_access
5942#define GL_EXT_direct_state_access 1
5943#define GL_PROGRAM_MATRIX_EXT             0x8E2D
5944#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT   0x8E2E
5945#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F
5946typedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m);
5947typedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m);
5948typedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m);
5949typedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m);
5950typedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode);
5951typedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
5952typedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
5953typedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
5954typedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
5955typedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
5956typedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
5957typedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
5958typedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
5959typedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode);
5960typedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode);
5961typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
5962typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
5963typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param);
5964typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
5965typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param);
5966typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);
5967typedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
5968typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
5969typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
5970typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
5971typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
5972typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
5973typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
5974typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
5975typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
5976typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params);
5977typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);
5978typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);
5979typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);
5980typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
5981typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
5982typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
5983typedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture);
5984typedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer);
5985typedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
5986typedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
5987typedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
5988typedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
5989typedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);
5990typedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);
5991typedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);
5992typedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);
5993typedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param);
5994typedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);
5995typedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
5996typedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
5997typedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);
5998typedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);
5999typedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params);
6000typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
6001typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
6002typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
6003typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
6004typedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
6005typedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
6006typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
6007typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
6008typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
6009typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
6010typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
6011typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
6012typedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
6013typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
6014typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
6015typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);
6016typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);
6017typedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
6018typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
6019typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
6020typedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
6021typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
6022typedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data);
6023typedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data);
6024typedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, void **data);
6025typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
6026typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
6027typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index);
6028typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data);
6029typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data);
6030typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
6031typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
6032typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
6033typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
6034typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
6035typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
6036typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, void *img);
6037typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
6038typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
6039typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
6040typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
6041typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
6042typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
6043typedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, void *img);
6044typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
6045typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
6046typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
6047typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
6048typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
6049typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
6050typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access);
6051typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer);
6052typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params);
6053typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, void **params);
6054typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
6055typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
6056typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
6057typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
6058typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
6059typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
6060typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
6061typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
6062typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
6063typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
6064typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
6065typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
6066typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
6067typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
6068typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
6069typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
6070typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
6071typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6072typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6073typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6074typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6075typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6076typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6077typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6078typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6079typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6080typedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);
6081typedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);
6082typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);
6083typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params);
6084typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);
6085typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params);
6086typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
6087typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);
6088typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
6089typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params);
6090typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
6091typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
6092typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
6093typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
6094typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
6095typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
6096typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
6097typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
6098typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);
6099typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
6100typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params);
6101typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);
6102typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
6103typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params);
6104typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);
6105typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params);
6106typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params);
6107typedef void (APIENTRYP PFNGLENABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);
6108typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);
6109typedef void (APIENTRYP PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat *params);
6110typedef void (APIENTRYP PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble *params);
6111typedef void (APIENTRYP PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void **params);
6112typedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string);
6113typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
6114typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params);
6115typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
6116typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params);
6117typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params);
6118typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params);
6119typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params);
6120typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, void *string);
6121typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
6122typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params);
6123typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
6124typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
6125typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target);
6126typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
6127typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
6128typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
6129typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
6130typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
6131typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target);
6132typedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target);
6133typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
6134typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs);
6135typedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
6136typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);
6137typedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
6138typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
6139typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
6140typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
6141typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer);
6142typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer);
6143typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6144typedef void (APIENTRYP PFNGLVERTEXARRAYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6145typedef void (APIENTRYP PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset);
6146typedef void (APIENTRYP PFNGLVERTEXARRAYINDEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
6147typedef void (APIENTRYP PFNGLVERTEXARRAYNORMALOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
6148typedef void (APIENTRYP PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6149typedef void (APIENTRYP PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6150typedef void (APIENTRYP PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
6151typedef void (APIENTRYP PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6152typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);
6153typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6154typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);
6155typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);
6156typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);
6157typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);
6158typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERVEXTPROC) (GLuint vaobj, GLenum pname, GLint *param);
6159typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERVEXTPROC) (GLuint vaobj, GLenum pname, void **param);
6160typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
6161typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void **param);
6162typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
6163typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
6164typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
6165typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
6166typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data);
6167typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param);
6168typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);
6169typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x);
6170typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y);
6171typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);
6172typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
6173typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
6174typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
6175typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
6176typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
6177typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6178typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6179typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6180typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6181typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6182typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6183typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6184typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6185typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6186typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
6187typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
6188typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
6189typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
6190typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
6191typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
6192typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
6193typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
6194typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
6195typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
6196typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
6197typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor);
6198typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6199typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident);
6200typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC) (GLuint vaobj, GLuint index, GLuint divisor);
6201#ifdef GL_GLEXT_PROTOTYPES
6202GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m);
6203GLAPI void APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m);
6204GLAPI void APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m);
6205GLAPI void APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m);
6206GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum mode);
6207GLAPI void APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
6208GLAPI void APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
6209GLAPI void APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
6210GLAPI void APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
6211GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
6212GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
6213GLAPI void APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
6214GLAPI void APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
6215GLAPI void APIENTRY glMatrixPopEXT (GLenum mode);
6216GLAPI void APIENTRY glMatrixPushEXT (GLenum mode);
6217GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield mask);
6218GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield mask);
6219GLAPI void APIENTRY glTextureParameterfEXT (GLuint texture, GLenum target, GLenum pname, GLfloat param);
6220GLAPI void APIENTRY glTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
6221GLAPI void APIENTRY glTextureParameteriEXT (GLuint texture, GLenum target, GLenum pname, GLint param);
6222GLAPI void APIENTRY glTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);
6223GLAPI void APIENTRY glTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
6224GLAPI void APIENTRY glTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
6225GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
6226GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
6227GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
6228GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
6229GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
6230GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
6231GLAPI void APIENTRY glGetTextureImageEXT (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
6232GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, GLfloat *params);
6233GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);
6234GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);
6235GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);
6236GLAPI void APIENTRY glTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
6237GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
6238GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
6239GLAPI void APIENTRY glBindMultiTextureEXT (GLenum texunit, GLenum target, GLuint texture);
6240GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer);
6241GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
6242GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
6243GLAPI void APIENTRY glMultiTexEnviEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);
6244GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
6245GLAPI void APIENTRY glMultiTexGendEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);
6246GLAPI void APIENTRY glMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);
6247GLAPI void APIENTRY glMultiTexGenfEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);
6248GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);
6249GLAPI void APIENTRY glMultiTexGeniEXT (GLenum texunit, GLenum coord, GLenum pname, GLint param);
6250GLAPI void APIENTRY glMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);
6251GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
6252GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
6253GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);
6254GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);
6255GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, GLint *params);
6256GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);
6257GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
6258GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
6259GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
6260GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
6261GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
6262GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
6263GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
6264GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
6265GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
6266GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
6267GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
6268GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
6269GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
6270GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
6271GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);
6272GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);
6273GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
6274GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
6275GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
6276GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum array, GLuint index);
6277GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum array, GLuint index);
6278GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum target, GLuint index, GLfloat *data);
6279GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum target, GLuint index, GLdouble *data);
6280GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum target, GLuint index, void **data);
6281GLAPI void APIENTRY glEnableIndexedEXT (GLenum target, GLuint index);
6282GLAPI void APIENTRY glDisableIndexedEXT (GLenum target, GLuint index);
6283GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum target, GLuint index);
6284GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum target, GLuint index, GLint *data);
6285GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum target, GLuint index, GLboolean *data);
6286GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
6287GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
6288GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
6289GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
6290GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
6291GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
6292GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint texture, GLenum target, GLint lod, void *img);
6293GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
6294GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
6295GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
6296GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
6297GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
6298GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
6299GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target, GLint lod, void *img);
6300GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m);
6301GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m);
6302GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m);
6303GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m);
6304GLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
6305GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
6306GLAPI void *APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access);
6307GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer);
6308GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params);
6309GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, void **params);
6310GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
6311GLAPI void APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
6312GLAPI void APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
6313GLAPI void APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
6314GLAPI void APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
6315GLAPI void APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
6316GLAPI void APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
6317GLAPI void APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
6318GLAPI void APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
6319GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
6320GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
6321GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
6322GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
6323GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
6324GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
6325GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
6326GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
6327GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6328GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6329GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6330GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6331GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6332GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6333GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6334GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6335GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
6336GLAPI void APIENTRY glTextureBufferEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);
6337GLAPI void APIENTRY glMultiTexBufferEXT (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);
6338GLAPI void APIENTRY glTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);
6339GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, const GLuint *params);
6340GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);
6341GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, GLuint *params);
6342GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
6343GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);
6344GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
6345GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, GLuint *params);
6346GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
6347GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
6348GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
6349GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
6350GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
6351GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
6352GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
6353GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
6354GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);
6355GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
6356GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint program, GLenum target, GLuint index, const GLint *params);
6357GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);
6358GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
6359GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint program, GLenum target, GLuint index, const GLuint *params);
6360GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);
6361GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint program, GLenum target, GLuint index, GLint *params);
6362GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint program, GLenum target, GLuint index, GLuint *params);
6363GLAPI void APIENTRY glEnableClientStateiEXT (GLenum array, GLuint index);
6364GLAPI void APIENTRY glDisableClientStateiEXT (GLenum array, GLuint index);
6365GLAPI void APIENTRY glGetFloati_vEXT (GLenum pname, GLuint index, GLfloat *params);
6366GLAPI void APIENTRY glGetDoublei_vEXT (GLenum pname, GLuint index, GLdouble *params);
6367GLAPI void APIENTRY glGetPointeri_vEXT (GLenum pname, GLuint index, void **params);
6368GLAPI void APIENTRY glNamedProgramStringEXT (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string);
6369GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
6370GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint program, GLenum target, GLuint index, const GLdouble *params);
6371GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
6372GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint program, GLenum target, GLuint index, const GLfloat *params);
6373GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint program, GLenum target, GLuint index, GLdouble *params);
6374GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint program, GLenum target, GLuint index, GLfloat *params);
6375GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint program, GLenum target, GLenum pname, GLint *params);
6376GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint program, GLenum target, GLenum pname, void *string);
6377GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
6378GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint renderbuffer, GLenum pname, GLint *params);
6379GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
6380GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
6381GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint framebuffer, GLenum target);
6382GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
6383GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
6384GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
6385GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
6386GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
6387GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint texture, GLenum target);
6388GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum texunit, GLenum target);
6389GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint framebuffer, GLenum mode);
6390GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint framebuffer, GLsizei n, const GLenum *bufs);
6391GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint framebuffer, GLenum mode);
6392GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);
6393GLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
6394GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
6395GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
6396GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
6397GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer);
6398GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer);
6399GLAPI void APIENTRY glVertexArrayVertexOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6400GLAPI void APIENTRY glVertexArrayColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6401GLAPI void APIENTRY glVertexArrayEdgeFlagOffsetEXT (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset);
6402GLAPI void APIENTRY glVertexArrayIndexOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
6403GLAPI void APIENTRY glVertexArrayNormalOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
6404GLAPI void APIENTRY glVertexArrayTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6405GLAPI void APIENTRY glVertexArrayMultiTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6406GLAPI void APIENTRY glVertexArrayFogCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
6407GLAPI void APIENTRY glVertexArraySecondaryColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6408GLAPI void APIENTRY glVertexArrayVertexAttribOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);
6409GLAPI void APIENTRY glVertexArrayVertexAttribIOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6410GLAPI void APIENTRY glEnableVertexArrayEXT (GLuint vaobj, GLenum array);
6411GLAPI void APIENTRY glDisableVertexArrayEXT (GLuint vaobj, GLenum array);
6412GLAPI void APIENTRY glEnableVertexArrayAttribEXT (GLuint vaobj, GLuint index);
6413GLAPI void APIENTRY glDisableVertexArrayAttribEXT (GLuint vaobj, GLuint index);
6414GLAPI void APIENTRY glGetVertexArrayIntegervEXT (GLuint vaobj, GLenum pname, GLint *param);
6415GLAPI void APIENTRY glGetVertexArrayPointervEXT (GLuint vaobj, GLenum pname, void **param);
6416GLAPI void APIENTRY glGetVertexArrayIntegeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
6417GLAPI void APIENTRY glGetVertexArrayPointeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, void **param);
6418GLAPI void *APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
6419GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length);
6420GLAPI void APIENTRY glNamedBufferStorageEXT (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
6421GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
6422GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, GLsizeiptr offset, GLsizeiptr size, const void *data);
6423GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param);
6424GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);
6425GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x);
6426GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y);
6427GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);
6428GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
6429GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
6430GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
6431GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
6432GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
6433GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6434GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6435GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6436GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6437GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6438GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6439GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6440GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6441GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
6442GLAPI void APIENTRY glTextureBufferRangeEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
6443GLAPI void APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
6444GLAPI void APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
6445GLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
6446GLAPI void APIENTRY glTextureStorage2DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
6447GLAPI void APIENTRY glTextureStorage3DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
6448GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
6449GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
6450GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
6451GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
6452GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
6453GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor);
6454GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
6455GLAPI void APIENTRY glTexturePageCommitmentEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean resident);
6456GLAPI void APIENTRY glVertexArrayVertexAttribDivisorEXT (GLuint vaobj, GLuint index, GLuint divisor);
6457#endif
6458#endif /* GL_EXT_direct_state_access */
6459
6460#ifndef GL_EXT_draw_buffers2
6461#define GL_EXT_draw_buffers2 1
6462typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
6463#ifdef GL_GLEXT_PROTOTYPES
6464GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
6465#endif
6466#endif /* GL_EXT_draw_buffers2 */
6467
6468#ifndef GL_EXT_draw_instanced
6469#define GL_EXT_draw_instanced 1
6470typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
6471typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
6472#ifdef GL_GLEXT_PROTOTYPES
6473GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
6474GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
6475#endif
6476#endif /* GL_EXT_draw_instanced */
6477
6478#ifndef GL_EXT_draw_range_elements
6479#define GL_EXT_draw_range_elements 1
6480#define GL_MAX_ELEMENTS_VERTICES_EXT      0x80E8
6481#define GL_MAX_ELEMENTS_INDICES_EXT       0x80E9
6482typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
6483#ifdef GL_GLEXT_PROTOTYPES
6484GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
6485#endif
6486#endif /* GL_EXT_draw_range_elements */
6487
6488#ifndef GL_EXT_fog_coord
6489#define GL_EXT_fog_coord 1
6490#define GL_FOG_COORDINATE_SOURCE_EXT      0x8450
6491#define GL_FOG_COORDINATE_EXT             0x8451
6492#define GL_FRAGMENT_DEPTH_EXT             0x8452
6493#define GL_CURRENT_FOG_COORDINATE_EXT     0x8453
6494#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT  0x8454
6495#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455
6496#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456
6497#define GL_FOG_COORDINATE_ARRAY_EXT       0x8457
6498typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord);
6499typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);
6500typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord);
6501typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);
6502typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer);
6503#ifdef GL_GLEXT_PROTOTYPES
6504GLAPI void APIENTRY glFogCoordfEXT (GLfloat coord);
6505GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *coord);
6506GLAPI void APIENTRY glFogCoorddEXT (GLdouble coord);
6507GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *coord);
6508GLAPI void APIENTRY glFogCoordPointerEXT (GLenum type, GLsizei stride, const void *pointer);
6509#endif
6510#endif /* GL_EXT_fog_coord */
6511
6512#ifndef GL_EXT_framebuffer_blit
6513#define GL_EXT_framebuffer_blit 1
6514#define GL_READ_FRAMEBUFFER_EXT           0x8CA8
6515#define GL_DRAW_FRAMEBUFFER_EXT           0x8CA9
6516#define GL_DRAW_FRAMEBUFFER_BINDING_EXT   0x8CA6
6517#define GL_READ_FRAMEBUFFER_BINDING_EXT   0x8CAA
6518typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
6519#ifdef GL_GLEXT_PROTOTYPES
6520GLAPI void APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
6521#endif
6522#endif /* GL_EXT_framebuffer_blit */
6523
6524#ifndef GL_EXT_framebuffer_multisample
6525#define GL_EXT_framebuffer_multisample 1
6526#define GL_RENDERBUFFER_SAMPLES_EXT       0x8CAB
6527#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
6528#define GL_MAX_SAMPLES_EXT                0x8D57
6529typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
6530#ifdef GL_GLEXT_PROTOTYPES
6531GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
6532#endif
6533#endif /* GL_EXT_framebuffer_multisample */
6534
6535#ifndef GL_EXT_framebuffer_multisample_blit_scaled
6536#define GL_EXT_framebuffer_multisample_blit_scaled 1
6537#define GL_SCALED_RESOLVE_FASTEST_EXT     0x90BA
6538#define GL_SCALED_RESOLVE_NICEST_EXT      0x90BB
6539#endif /* GL_EXT_framebuffer_multisample_blit_scaled */
6540
6541#ifndef GL_EXT_framebuffer_object
6542#define GL_EXT_framebuffer_object 1
6543#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
6544#define GL_MAX_RENDERBUFFER_SIZE_EXT      0x84E8
6545#define GL_FRAMEBUFFER_BINDING_EXT        0x8CA6
6546#define GL_RENDERBUFFER_BINDING_EXT       0x8CA7
6547#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
6548#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
6549#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
6550#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
6551#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
6552#define GL_FRAMEBUFFER_COMPLETE_EXT       0x8CD5
6553#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
6554#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
6555#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
6556#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
6557#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
6558#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
6559#define GL_FRAMEBUFFER_UNSUPPORTED_EXT    0x8CDD
6560#define GL_MAX_COLOR_ATTACHMENTS_EXT      0x8CDF
6561#define GL_COLOR_ATTACHMENT0_EXT          0x8CE0
6562#define GL_COLOR_ATTACHMENT1_EXT          0x8CE1
6563#define GL_COLOR_ATTACHMENT2_EXT          0x8CE2
6564#define GL_COLOR_ATTACHMENT3_EXT          0x8CE3
6565#define GL_COLOR_ATTACHMENT4_EXT          0x8CE4
6566#define GL_COLOR_ATTACHMENT5_EXT          0x8CE5
6567#define GL_COLOR_ATTACHMENT6_EXT          0x8CE6
6568#define GL_COLOR_ATTACHMENT7_EXT          0x8CE7
6569#define GL_COLOR_ATTACHMENT8_EXT          0x8CE8
6570#define GL_COLOR_ATTACHMENT9_EXT          0x8CE9
6571#define GL_COLOR_ATTACHMENT10_EXT         0x8CEA
6572#define GL_COLOR_ATTACHMENT11_EXT         0x8CEB
6573#define GL_COLOR_ATTACHMENT12_EXT         0x8CEC
6574#define GL_COLOR_ATTACHMENT13_EXT         0x8CED
6575#define GL_COLOR_ATTACHMENT14_EXT         0x8CEE
6576#define GL_COLOR_ATTACHMENT15_EXT         0x8CEF
6577#define GL_DEPTH_ATTACHMENT_EXT           0x8D00
6578#define GL_STENCIL_ATTACHMENT_EXT         0x8D20
6579#define GL_FRAMEBUFFER_EXT                0x8D40
6580#define GL_RENDERBUFFER_EXT               0x8D41
6581#define GL_RENDERBUFFER_WIDTH_EXT         0x8D42
6582#define GL_RENDERBUFFER_HEIGHT_EXT        0x8D43
6583#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
6584#define GL_STENCIL_INDEX1_EXT             0x8D46
6585#define GL_STENCIL_INDEX4_EXT             0x8D47
6586#define GL_STENCIL_INDEX8_EXT             0x8D48
6587#define GL_STENCIL_INDEX16_EXT            0x8D49
6588#define GL_RENDERBUFFER_RED_SIZE_EXT      0x8D50
6589#define GL_RENDERBUFFER_GREEN_SIZE_EXT    0x8D51
6590#define GL_RENDERBUFFER_BLUE_SIZE_EXT     0x8D52
6591#define GL_RENDERBUFFER_ALPHA_SIZE_EXT    0x8D53
6592#define GL_RENDERBUFFER_DEPTH_SIZE_EXT    0x8D54
6593#define GL_RENDERBUFFER_STENCIL_SIZE_EXT  0x8D55
6594typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
6595typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
6596typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
6597typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);
6598typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
6599typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
6600typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);
6601typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);
6602typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers);
6603typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers);
6604typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);
6605typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
6606typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
6607typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
6608typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
6609typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
6610typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);
6611#ifdef GL_GLEXT_PROTOTYPES
6612GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint renderbuffer);
6613GLAPI void APIENTRY glBindRenderbufferEXT (GLenum target, GLuint renderbuffer);
6614GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers);
6615GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers);
6616GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
6617GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum target, GLenum pname, GLint *params);
6618GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint framebuffer);
6619GLAPI void APIENTRY glBindFramebufferEXT (GLenum target, GLuint framebuffer);
6620GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers);
6621GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei n, GLuint *framebuffers);
6622GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum target);
6623GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
6624GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
6625GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
6626GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
6627GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum target, GLenum attachment, GLenum pname, GLint *params);
6628GLAPI void APIENTRY glGenerateMipmapEXT (GLenum target);
6629#endif
6630#endif /* GL_EXT_framebuffer_object */
6631
6632#ifndef GL_EXT_framebuffer_sRGB
6633#define GL_EXT_framebuffer_sRGB 1
6634#define GL_FRAMEBUFFER_SRGB_EXT           0x8DB9
6635#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT   0x8DBA
6636#endif /* GL_EXT_framebuffer_sRGB */
6637
6638#ifndef GL_EXT_geometry_shader4
6639#define GL_EXT_geometry_shader4 1
6640#define GL_GEOMETRY_SHADER_EXT            0x8DD9
6641#define GL_GEOMETRY_VERTICES_OUT_EXT      0x8DDA
6642#define GL_GEOMETRY_INPUT_TYPE_EXT        0x8DDB
6643#define GL_GEOMETRY_OUTPUT_TYPE_EXT       0x8DDC
6644#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
6645#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD
6646#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE
6647#define GL_MAX_VARYING_COMPONENTS_EXT     0x8B4B
6648#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
6649#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
6650#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
6651#define GL_LINES_ADJACENCY_EXT            0x000A
6652#define GL_LINE_STRIP_ADJACENCY_EXT       0x000B
6653#define GL_TRIANGLES_ADJACENCY_EXT        0x000C
6654#define GL_TRIANGLE_STRIP_ADJACENCY_EXT   0x000D
6655#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
6656#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9
6657#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
6658#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
6659#define GL_PROGRAM_POINT_SIZE_EXT         0x8642
6660typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
6661#ifdef GL_GLEXT_PROTOTYPES
6662GLAPI void APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
6663#endif
6664#endif /* GL_EXT_geometry_shader4 */
6665
6666#ifndef GL_EXT_gpu_program_parameters
6667#define GL_EXT_gpu_program_parameters 1
6668typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
6669typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
6670#ifdef GL_GLEXT_PROTOTYPES
6671GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
6672GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
6673#endif
6674#endif /* GL_EXT_gpu_program_parameters */
6675
6676#ifndef GL_EXT_gpu_shader4
6677#define GL_EXT_gpu_shader4 1
6678#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD
6679#define GL_SAMPLER_1D_ARRAY_EXT           0x8DC0
6680#define GL_SAMPLER_2D_ARRAY_EXT           0x8DC1
6681#define GL_SAMPLER_BUFFER_EXT             0x8DC2
6682#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT    0x8DC3
6683#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT    0x8DC4
6684#define GL_SAMPLER_CUBE_SHADOW_EXT        0x8DC5
6685#define GL_UNSIGNED_INT_VEC2_EXT          0x8DC6
6686#define GL_UNSIGNED_INT_VEC3_EXT          0x8DC7
6687#define GL_UNSIGNED_INT_VEC4_EXT          0x8DC8
6688#define GL_INT_SAMPLER_1D_EXT             0x8DC9
6689#define GL_INT_SAMPLER_2D_EXT             0x8DCA
6690#define GL_INT_SAMPLER_3D_EXT             0x8DCB
6691#define GL_INT_SAMPLER_CUBE_EXT           0x8DCC
6692#define GL_INT_SAMPLER_2D_RECT_EXT        0x8DCD
6693#define GL_INT_SAMPLER_1D_ARRAY_EXT       0x8DCE
6694#define GL_INT_SAMPLER_2D_ARRAY_EXT       0x8DCF
6695#define GL_INT_SAMPLER_BUFFER_EXT         0x8DD0
6696#define GL_UNSIGNED_INT_SAMPLER_1D_EXT    0x8DD1
6697#define GL_UNSIGNED_INT_SAMPLER_2D_EXT    0x8DD2
6698#define GL_UNSIGNED_INT_SAMPLER_3D_EXT    0x8DD3
6699#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT  0x8DD4
6700#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5
6701#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6
6702#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7
6703#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
6704#define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT   0x8904
6705#define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT   0x8905
6706typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params);
6707typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
6708typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name);
6709typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0);
6710typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1);
6711typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
6712typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
6713typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
6714typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
6715typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
6716typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
6717#ifdef GL_GLEXT_PROTOTYPES
6718GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params);
6719GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name);
6720GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint program, const GLchar *name);
6721GLAPI void APIENTRY glUniform1uiEXT (GLint location, GLuint v0);
6722GLAPI void APIENTRY glUniform2uiEXT (GLint location, GLuint v0, GLuint v1);
6723GLAPI void APIENTRY glUniform3uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2);
6724GLAPI void APIENTRY glUniform4uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
6725GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuint *value);
6726GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value);
6727GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value);
6728GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value);
6729#endif
6730#endif /* GL_EXT_gpu_shader4 */
6731
6732#ifndef GL_EXT_histogram
6733#define GL_EXT_histogram 1
6734#define GL_HISTOGRAM_EXT                  0x8024
6735#define GL_PROXY_HISTOGRAM_EXT            0x8025
6736#define GL_HISTOGRAM_WIDTH_EXT            0x8026
6737#define GL_HISTOGRAM_FORMAT_EXT           0x8027
6738#define GL_HISTOGRAM_RED_SIZE_EXT         0x8028
6739#define GL_HISTOGRAM_GREEN_SIZE_EXT       0x8029
6740#define GL_HISTOGRAM_BLUE_SIZE_EXT        0x802A
6741#define GL_HISTOGRAM_ALPHA_SIZE_EXT       0x802B
6742#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT   0x802C
6743#define GL_HISTOGRAM_SINK_EXT             0x802D
6744#define GL_MINMAX_EXT                     0x802E
6745#define GL_MINMAX_FORMAT_EXT              0x802F
6746#define GL_MINMAX_SINK_EXT                0x8030
6747#define GL_TABLE_TOO_LARGE_EXT            0x8031
6748typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
6749typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
6750typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
6751typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
6752typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
6753typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
6754typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
6755typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink);
6756typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target);
6757typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target);
6758#ifdef GL_GLEXT_PROTOTYPES
6759GLAPI void APIENTRY glGetHistogramEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
6760GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
6761GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum target, GLenum pname, GLint *params);
6762GLAPI void APIENTRY glGetMinmaxEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
6763GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
6764GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum target, GLenum pname, GLint *params);
6765GLAPI void APIENTRY glHistogramEXT (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
6766GLAPI void APIENTRY glMinmaxEXT (GLenum target, GLenum internalformat, GLboolean sink);
6767GLAPI void APIENTRY glResetHistogramEXT (GLenum target);
6768GLAPI void APIENTRY glResetMinmaxEXT (GLenum target);
6769#endif
6770#endif /* GL_EXT_histogram */
6771
6772#ifndef GL_EXT_index_array_formats
6773#define GL_EXT_index_array_formats 1
6774#define GL_IUI_V2F_EXT                    0x81AD
6775#define GL_IUI_V3F_EXT                    0x81AE
6776#define GL_IUI_N3F_V2F_EXT                0x81AF
6777#define GL_IUI_N3F_V3F_EXT                0x81B0
6778#define GL_T2F_IUI_V2F_EXT                0x81B1
6779#define GL_T2F_IUI_V3F_EXT                0x81B2
6780#define GL_T2F_IUI_N3F_V2F_EXT            0x81B3
6781#define GL_T2F_IUI_N3F_V3F_EXT            0x81B4
6782#endif /* GL_EXT_index_array_formats */
6783
6784#ifndef GL_EXT_index_func
6785#define GL_EXT_index_func 1
6786#define GL_INDEX_TEST_EXT                 0x81B5
6787#define GL_INDEX_TEST_FUNC_EXT            0x81B6
6788#define GL_INDEX_TEST_REF_EXT             0x81B7
6789typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref);
6790#ifdef GL_GLEXT_PROTOTYPES
6791GLAPI void APIENTRY glIndexFuncEXT (GLenum func, GLclampf ref);
6792#endif
6793#endif /* GL_EXT_index_func */
6794
6795#ifndef GL_EXT_index_material
6796#define GL_EXT_index_material 1
6797#define GL_INDEX_MATERIAL_EXT             0x81B8
6798#define GL_INDEX_MATERIAL_PARAMETER_EXT   0x81B9
6799#define GL_INDEX_MATERIAL_FACE_EXT        0x81BA
6800typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode);
6801#ifdef GL_GLEXT_PROTOTYPES
6802GLAPI void APIENTRY glIndexMaterialEXT (GLenum face, GLenum mode);
6803#endif
6804#endif /* GL_EXT_index_material */
6805
6806#ifndef GL_EXT_index_texture
6807#define GL_EXT_index_texture 1
6808#endif /* GL_EXT_index_texture */
6809
6810#ifndef GL_EXT_light_texture
6811#define GL_EXT_light_texture 1
6812#define GL_FRAGMENT_MATERIAL_EXT          0x8349
6813#define GL_FRAGMENT_NORMAL_EXT            0x834A
6814#define GL_FRAGMENT_COLOR_EXT             0x834C
6815#define GL_ATTENUATION_EXT                0x834D
6816#define GL_SHADOW_ATTENUATION_EXT         0x834E
6817#define GL_TEXTURE_APPLICATION_MODE_EXT   0x834F
6818#define GL_TEXTURE_LIGHT_EXT              0x8350
6819#define GL_TEXTURE_MATERIAL_FACE_EXT      0x8351
6820#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352
6821typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode);
6822typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname);
6823typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode);
6824#ifdef GL_GLEXT_PROTOTYPES
6825GLAPI void APIENTRY glApplyTextureEXT (GLenum mode);
6826GLAPI void APIENTRY glTextureLightEXT (GLenum pname);
6827GLAPI void APIENTRY glTextureMaterialEXT (GLenum face, GLenum mode);
6828#endif
6829#endif /* GL_EXT_light_texture */
6830
6831#ifndef GL_EXT_misc_attribute
6832#define GL_EXT_misc_attribute 1
6833#endif /* GL_EXT_misc_attribute */
6834
6835#ifndef GL_EXT_multi_draw_arrays
6836#define GL_EXT_multi_draw_arrays 1
6837typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
6838typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
6839#ifdef GL_GLEXT_PROTOTYPES
6840GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
6841GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
6842#endif
6843#endif /* GL_EXT_multi_draw_arrays */
6844
6845#ifndef GL_EXT_multisample
6846#define GL_EXT_multisample 1
6847#define GL_MULTISAMPLE_EXT                0x809D
6848#define GL_SAMPLE_ALPHA_TO_MASK_EXT       0x809E
6849#define GL_SAMPLE_ALPHA_TO_ONE_EXT        0x809F
6850#define GL_SAMPLE_MASK_EXT                0x80A0
6851#define GL_1PASS_EXT                      0x80A1
6852#define GL_2PASS_0_EXT                    0x80A2
6853#define GL_2PASS_1_EXT                    0x80A3
6854#define GL_4PASS_0_EXT                    0x80A4
6855#define GL_4PASS_1_EXT                    0x80A5
6856#define GL_4PASS_2_EXT                    0x80A6
6857#define GL_4PASS_3_EXT                    0x80A7
6858#define GL_SAMPLE_BUFFERS_EXT             0x80A8
6859#define GL_SAMPLES_EXT                    0x80A9
6860#define GL_SAMPLE_MASK_VALUE_EXT          0x80AA
6861#define GL_SAMPLE_MASK_INVERT_EXT         0x80AB
6862#define GL_SAMPLE_PATTERN_EXT             0x80AC
6863#define GL_MULTISAMPLE_BIT_EXT            0x20000000
6864typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert);
6865typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern);
6866#ifdef GL_GLEXT_PROTOTYPES
6867GLAPI void APIENTRY glSampleMaskEXT (GLclampf value, GLboolean invert);
6868GLAPI void APIENTRY glSamplePatternEXT (GLenum pattern);
6869#endif
6870#endif /* GL_EXT_multisample */
6871
6872#ifndef GL_EXT_packed_depth_stencil
6873#define GL_EXT_packed_depth_stencil 1
6874#define GL_DEPTH_STENCIL_EXT              0x84F9
6875#define GL_UNSIGNED_INT_24_8_EXT          0x84FA
6876#define GL_DEPTH24_STENCIL8_EXT           0x88F0
6877#define GL_TEXTURE_STENCIL_SIZE_EXT       0x88F1
6878#endif /* GL_EXT_packed_depth_stencil */
6879
6880#ifndef GL_EXT_packed_float
6881#define GL_EXT_packed_float 1
6882#define GL_R11F_G11F_B10F_EXT             0x8C3A
6883#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B
6884#define GL_RGBA_SIGNED_COMPONENTS_EXT     0x8C3C
6885#endif /* GL_EXT_packed_float */
6886
6887#ifndef GL_EXT_packed_pixels
6888#define GL_EXT_packed_pixels 1
6889#define GL_UNSIGNED_BYTE_3_3_2_EXT        0x8032
6890#define GL_UNSIGNED_SHORT_4_4_4_4_EXT     0x8033
6891#define GL_UNSIGNED_SHORT_5_5_5_1_EXT     0x8034
6892#define GL_UNSIGNED_INT_8_8_8_8_EXT       0x8035
6893#define GL_UNSIGNED_INT_10_10_10_2_EXT    0x8036
6894#endif /* GL_EXT_packed_pixels */
6895
6896#ifndef GL_EXT_paletted_texture
6897#define GL_EXT_paletted_texture 1
6898#define GL_COLOR_INDEX1_EXT               0x80E2
6899#define GL_COLOR_INDEX2_EXT               0x80E3
6900#define GL_COLOR_INDEX4_EXT               0x80E4
6901#define GL_COLOR_INDEX8_EXT               0x80E5
6902#define GL_COLOR_INDEX12_EXT              0x80E6
6903#define GL_COLOR_INDEX16_EXT              0x80E7
6904#define GL_TEXTURE_INDEX_SIZE_EXT         0x80ED
6905typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *table);
6906typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, void *data);
6907typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
6908typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
6909#ifdef GL_GLEXT_PROTOTYPES
6910GLAPI void APIENTRY glColorTableEXT (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *table);
6911GLAPI void APIENTRY glGetColorTableEXT (GLenum target, GLenum format, GLenum type, void *data);
6912GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum target, GLenum pname, GLint *params);
6913GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
6914#endif
6915#endif /* GL_EXT_paletted_texture */
6916
6917#ifndef GL_EXT_pixel_buffer_object
6918#define GL_EXT_pixel_buffer_object 1
6919#define GL_PIXEL_PACK_BUFFER_EXT          0x88EB
6920#define GL_PIXEL_UNPACK_BUFFER_EXT        0x88EC
6921#define GL_PIXEL_PACK_BUFFER_BINDING_EXT  0x88ED
6922#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF
6923#endif /* GL_EXT_pixel_buffer_object */
6924
6925#ifndef GL_EXT_pixel_transform
6926#define GL_EXT_pixel_transform 1
6927#define GL_PIXEL_TRANSFORM_2D_EXT         0x8330
6928#define GL_PIXEL_MAG_FILTER_EXT           0x8331
6929#define GL_PIXEL_MIN_FILTER_EXT           0x8332
6930#define GL_PIXEL_CUBIC_WEIGHT_EXT         0x8333
6931#define GL_CUBIC_EXT                      0x8334
6932#define GL_AVERAGE_EXT                    0x8335
6933#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336
6934#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337
6935#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT  0x8338
6936typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param);
6937typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param);
6938typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
6939typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);
6940typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
6941typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
6942#ifdef GL_GLEXT_PROTOTYPES
6943GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLint param);
6944GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param);
6945GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params);
6946GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params);
6947GLAPI void APIENTRY glGetPixelTransformParameterivEXT (GLenum target, GLenum pname, GLint *params);
6948GLAPI void APIENTRY glGetPixelTransformParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
6949#endif
6950#endif /* GL_EXT_pixel_transform */
6951
6952#ifndef GL_EXT_pixel_transform_color_table
6953#define GL_EXT_pixel_transform_color_table 1
6954#endif /* GL_EXT_pixel_transform_color_table */
6955
6956#ifndef GL_EXT_point_parameters
6957#define GL_EXT_point_parameters 1
6958#define GL_POINT_SIZE_MIN_EXT             0x8126
6959#define GL_POINT_SIZE_MAX_EXT             0x8127
6960#define GL_POINT_FADE_THRESHOLD_SIZE_EXT  0x8128
6961#define GL_DISTANCE_ATTENUATION_EXT       0x8129
6962typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);
6963typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params);
6964#ifdef GL_GLEXT_PROTOTYPES
6965GLAPI void APIENTRY glPointParameterfEXT (GLenum pname, GLfloat param);
6966GLAPI void APIENTRY glPointParameterfvEXT (GLenum pname, const GLfloat *params);
6967#endif
6968#endif /* GL_EXT_point_parameters */
6969
6970#ifndef GL_EXT_polygon_offset
6971#define GL_EXT_polygon_offset 1
6972#define GL_POLYGON_OFFSET_EXT             0x8037
6973#define GL_POLYGON_OFFSET_FACTOR_EXT      0x8038
6974#define GL_POLYGON_OFFSET_BIAS_EXT        0x8039
6975typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias);
6976#ifdef GL_GLEXT_PROTOTYPES
6977GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias);
6978#endif
6979#endif /* GL_EXT_polygon_offset */
6980
6981#ifndef GL_EXT_provoking_vertex
6982#define GL_EXT_provoking_vertex 1
6983#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C
6984#define GL_FIRST_VERTEX_CONVENTION_EXT    0x8E4D
6985#define GL_LAST_VERTEX_CONVENTION_EXT     0x8E4E
6986#define GL_PROVOKING_VERTEX_EXT           0x8E4F
6987typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);
6988#ifdef GL_GLEXT_PROTOTYPES
6989GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode);
6990#endif
6991#endif /* GL_EXT_provoking_vertex */
6992
6993#ifndef GL_EXT_rescale_normal
6994#define GL_EXT_rescale_normal 1
6995#define GL_RESCALE_NORMAL_EXT             0x803A
6996#endif /* GL_EXT_rescale_normal */
6997
6998#ifndef GL_EXT_secondary_color
6999#define GL_EXT_secondary_color 1
7000#define GL_COLOR_SUM_EXT                  0x8458
7001#define GL_CURRENT_SECONDARY_COLOR_EXT    0x8459
7002#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A
7003#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B
7004#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C
7005#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D
7006#define GL_SECONDARY_COLOR_ARRAY_EXT      0x845E
7007typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);
7008typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);
7009typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);
7010typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);
7011typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
7012typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);
7013typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);
7014typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);
7015typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);
7016typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);
7017typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
7018typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);
7019typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);
7020typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);
7021typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);
7022typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);
7023typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
7024#ifdef GL_GLEXT_PROTOTYPES
7025GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte red, GLbyte green, GLbyte blue);
7026GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *v);
7027GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble red, GLdouble green, GLdouble blue);
7028GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *v);
7029GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat red, GLfloat green, GLfloat blue);
7030GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *v);
7031GLAPI void APIENTRY glSecondaryColor3iEXT (GLint red, GLint green, GLint blue);
7032GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *v);
7033GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort red, GLshort green, GLshort blue);
7034GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *v);
7035GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte red, GLubyte green, GLubyte blue);
7036GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *v);
7037GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint red, GLuint green, GLuint blue);
7038GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *v);
7039GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort red, GLushort green, GLushort blue);
7040GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *v);
7041GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, const void *pointer);
7042#endif
7043#endif /* GL_EXT_secondary_color */
7044
7045#ifndef GL_EXT_separate_shader_objects
7046#define GL_EXT_separate_shader_objects 1
7047#define GL_ACTIVE_PROGRAM_EXT             0x8B8D
7048typedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program);
7049typedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program);
7050typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string);
7051#ifdef GL_GLEXT_PROTOTYPES
7052GLAPI void APIENTRY glUseShaderProgramEXT (GLenum type, GLuint program);
7053GLAPI void APIENTRY glActiveProgramEXT (GLuint program);
7054GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *string);
7055#endif
7056#endif /* GL_EXT_separate_shader_objects */
7057
7058#ifndef GL_EXT_separate_specular_color
7059#define GL_EXT_separate_specular_color 1
7060#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT  0x81F8
7061#define GL_SINGLE_COLOR_EXT               0x81F9
7062#define GL_SEPARATE_SPECULAR_COLOR_EXT    0x81FA
7063#endif /* GL_EXT_separate_specular_color */
7064
7065#ifndef GL_EXT_shader_image_load_store
7066#define GL_EXT_shader_image_load_store 1
7067#define GL_MAX_IMAGE_UNITS_EXT            0x8F38
7068#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39
7069#define GL_IMAGE_BINDING_NAME_EXT         0x8F3A
7070#define GL_IMAGE_BINDING_LEVEL_EXT        0x8F3B
7071#define GL_IMAGE_BINDING_LAYERED_EXT      0x8F3C
7072#define GL_IMAGE_BINDING_LAYER_EXT        0x8F3D
7073#define GL_IMAGE_BINDING_ACCESS_EXT       0x8F3E
7074#define GL_IMAGE_1D_EXT                   0x904C
7075#define GL_IMAGE_2D_EXT                   0x904D
7076#define GL_IMAGE_3D_EXT                   0x904E
7077#define GL_IMAGE_2D_RECT_EXT              0x904F
7078#define GL_IMAGE_CUBE_EXT                 0x9050
7079#define GL_IMAGE_BUFFER_EXT               0x9051
7080#define GL_IMAGE_1D_ARRAY_EXT             0x9052
7081#define GL_IMAGE_2D_ARRAY_EXT             0x9053
7082#define GL_IMAGE_CUBE_MAP_ARRAY_EXT       0x9054
7083#define GL_IMAGE_2D_MULTISAMPLE_EXT       0x9055
7084#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056
7085#define GL_INT_IMAGE_1D_EXT               0x9057
7086#define GL_INT_IMAGE_2D_EXT               0x9058
7087#define GL_INT_IMAGE_3D_EXT               0x9059
7088#define GL_INT_IMAGE_2D_RECT_EXT          0x905A
7089#define GL_INT_IMAGE_CUBE_EXT             0x905B
7090#define GL_INT_IMAGE_BUFFER_EXT           0x905C
7091#define GL_INT_IMAGE_1D_ARRAY_EXT         0x905D
7092#define GL_INT_IMAGE_2D_ARRAY_EXT         0x905E
7093#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT   0x905F
7094#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT   0x9060
7095#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061
7096#define GL_UNSIGNED_INT_IMAGE_1D_EXT      0x9062
7097#define GL_UNSIGNED_INT_IMAGE_2D_EXT      0x9063
7098#define GL_UNSIGNED_INT_IMAGE_3D_EXT      0x9064
7099#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065
7100#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT    0x9066
7101#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT  0x9067
7102#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068
7103#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069
7104#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A
7105#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B
7106#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C
7107#define GL_MAX_IMAGE_SAMPLES_EXT          0x906D
7108#define GL_IMAGE_BINDING_FORMAT_EXT       0x906E
7109#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001
7110#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT  0x00000002
7111#define GL_UNIFORM_BARRIER_BIT_EXT        0x00000004
7112#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT  0x00000008
7113#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020
7114#define GL_COMMAND_BARRIER_BIT_EXT        0x00000040
7115#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT   0x00000080
7116#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100
7117#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT  0x00000200
7118#define GL_FRAMEBUFFER_BARRIER_BIT_EXT    0x00000400
7119#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800
7120#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000
7121#define GL_ALL_BARRIER_BITS_EXT           0xFFFFFFFF
7122typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);
7123typedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers);
7124#ifdef GL_GLEXT_PROTOTYPES
7125GLAPI void APIENTRY glBindImageTextureEXT (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);
7126GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers);
7127#endif
7128#endif /* GL_EXT_shader_image_load_store */
7129
7130#ifndef GL_EXT_shader_integer_mix
7131#define GL_EXT_shader_integer_mix 1
7132#endif /* GL_EXT_shader_integer_mix */
7133
7134#ifndef GL_EXT_shadow_funcs
7135#define GL_EXT_shadow_funcs 1
7136#endif /* GL_EXT_shadow_funcs */
7137
7138#ifndef GL_EXT_shared_texture_palette
7139#define GL_EXT_shared_texture_palette 1
7140#define GL_SHARED_TEXTURE_PALETTE_EXT     0x81FB
7141#endif /* GL_EXT_shared_texture_palette */
7142
7143#ifndef GL_EXT_stencil_clear_tag
7144#define GL_EXT_stencil_clear_tag 1
7145#define GL_STENCIL_TAG_BITS_EXT           0x88F2
7146#define GL_STENCIL_CLEAR_TAG_VALUE_EXT    0x88F3
7147typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag);
7148#ifdef GL_GLEXT_PROTOTYPES
7149GLAPI void APIENTRY glStencilClearTagEXT (GLsizei stencilTagBits, GLuint stencilClearTag);
7150#endif
7151#endif /* GL_EXT_stencil_clear_tag */
7152
7153#ifndef GL_EXT_stencil_two_side
7154#define GL_EXT_stencil_two_side 1
7155#define GL_STENCIL_TEST_TWO_SIDE_EXT      0x8910
7156#define GL_ACTIVE_STENCIL_FACE_EXT        0x8911
7157typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);
7158#ifdef GL_GLEXT_PROTOTYPES
7159GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum face);
7160#endif
7161#endif /* GL_EXT_stencil_two_side */
7162
7163#ifndef GL_EXT_stencil_wrap
7164#define GL_EXT_stencil_wrap 1
7165#define GL_INCR_WRAP_EXT                  0x8507
7166#define GL_DECR_WRAP_EXT                  0x8508
7167#endif /* GL_EXT_stencil_wrap */
7168
7169#ifndef GL_EXT_subtexture
7170#define GL_EXT_subtexture 1
7171typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
7172typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
7173#ifdef GL_GLEXT_PROTOTYPES
7174GLAPI void APIENTRY glTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
7175GLAPI void APIENTRY glTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
7176#endif
7177#endif /* GL_EXT_subtexture */
7178
7179#ifndef GL_EXT_texture
7180#define GL_EXT_texture 1
7181#define GL_ALPHA4_EXT                     0x803B
7182#define GL_ALPHA8_EXT                     0x803C
7183#define GL_ALPHA12_EXT                    0x803D
7184#define GL_ALPHA16_EXT                    0x803E
7185#define GL_LUMINANCE4_EXT                 0x803F
7186#define GL_LUMINANCE8_EXT                 0x8040
7187#define GL_LUMINANCE12_EXT                0x8041
7188#define GL_LUMINANCE16_EXT                0x8042
7189#define GL_LUMINANCE4_ALPHA4_EXT          0x8043
7190#define GL_LUMINANCE6_ALPHA2_EXT          0x8044
7191#define GL_LUMINANCE8_ALPHA8_EXT          0x8045
7192#define GL_LUMINANCE12_ALPHA4_EXT         0x8046
7193#define GL_LUMINANCE12_ALPHA12_EXT        0x8047
7194#define GL_LUMINANCE16_ALPHA16_EXT        0x8048
7195#define GL_INTENSITY_EXT                  0x8049
7196#define GL_INTENSITY4_EXT                 0x804A
7197#define GL_INTENSITY8_EXT                 0x804B
7198#define GL_INTENSITY12_EXT                0x804C
7199#define GL_INTENSITY16_EXT                0x804D
7200#define GL_RGB2_EXT                       0x804E
7201#define GL_RGB4_EXT                       0x804F
7202#define GL_RGB5_EXT                       0x8050
7203#define GL_RGB8_EXT                       0x8051
7204#define GL_RGB10_EXT                      0x8052
7205#define GL_RGB12_EXT                      0x8053
7206#define GL_RGB16_EXT                      0x8054
7207#define GL_RGBA2_EXT                      0x8055
7208#define GL_RGBA4_EXT                      0x8056
7209#define GL_RGB5_A1_EXT                    0x8057
7210#define GL_RGBA8_EXT                      0x8058
7211#define GL_RGB10_A2_EXT                   0x8059
7212#define GL_RGBA12_EXT                     0x805A
7213#define GL_RGBA16_EXT                     0x805B
7214#define GL_TEXTURE_RED_SIZE_EXT           0x805C
7215#define GL_TEXTURE_GREEN_SIZE_EXT         0x805D
7216#define GL_TEXTURE_BLUE_SIZE_EXT          0x805E
7217#define GL_TEXTURE_ALPHA_SIZE_EXT         0x805F
7218#define GL_TEXTURE_LUMINANCE_SIZE_EXT     0x8060
7219#define GL_TEXTURE_INTENSITY_SIZE_EXT     0x8061
7220#define GL_REPLACE_EXT                    0x8062
7221#define GL_PROXY_TEXTURE_1D_EXT           0x8063
7222#define GL_PROXY_TEXTURE_2D_EXT           0x8064
7223#define GL_TEXTURE_TOO_LARGE_EXT          0x8065
7224#endif /* GL_EXT_texture */
7225
7226#ifndef GL_EXT_texture3D
7227#define GL_EXT_texture3D 1
7228#define GL_PACK_SKIP_IMAGES_EXT           0x806B
7229#define GL_PACK_IMAGE_HEIGHT_EXT          0x806C
7230#define GL_UNPACK_SKIP_IMAGES_EXT         0x806D
7231#define GL_UNPACK_IMAGE_HEIGHT_EXT        0x806E
7232#define GL_TEXTURE_3D_EXT                 0x806F
7233#define GL_PROXY_TEXTURE_3D_EXT           0x8070
7234#define GL_TEXTURE_DEPTH_EXT              0x8071
7235#define GL_TEXTURE_WRAP_R_EXT             0x8072
7236#define GL_MAX_3D_TEXTURE_SIZE_EXT        0x8073
7237typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
7238typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
7239#ifdef GL_GLEXT_PROTOTYPES
7240GLAPI void APIENTRY glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
7241GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
7242#endif
7243#endif /* GL_EXT_texture3D */
7244
7245#ifndef GL_EXT_texture_array
7246#define GL_EXT_texture_array 1
7247#define GL_TEXTURE_1D_ARRAY_EXT           0x8C18
7248#define GL_PROXY_TEXTURE_1D_ARRAY_EXT     0x8C19
7249#define GL_TEXTURE_2D_ARRAY_EXT           0x8C1A
7250#define GL_PROXY_TEXTURE_2D_ARRAY_EXT     0x8C1B
7251#define GL_TEXTURE_BINDING_1D_ARRAY_EXT   0x8C1C
7252#define GL_TEXTURE_BINDING_2D_ARRAY_EXT   0x8C1D
7253#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT   0x88FF
7254#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E
7255#endif /* GL_EXT_texture_array */
7256
7257#ifndef GL_EXT_texture_buffer_object
7258#define GL_EXT_texture_buffer_object 1
7259#define GL_TEXTURE_BUFFER_EXT             0x8C2A
7260#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT    0x8C2B
7261#define GL_TEXTURE_BINDING_BUFFER_EXT     0x8C2C
7262#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D
7263#define GL_TEXTURE_BUFFER_FORMAT_EXT      0x8C2E
7264typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
7265#ifdef GL_GLEXT_PROTOTYPES
7266GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer);
7267#endif
7268#endif /* GL_EXT_texture_buffer_object */
7269
7270#ifndef GL_EXT_texture_compression_latc
7271#define GL_EXT_texture_compression_latc 1
7272#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
7273#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
7274#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
7275#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
7276#endif /* GL_EXT_texture_compression_latc */
7277
7278#ifndef GL_EXT_texture_compression_rgtc
7279#define GL_EXT_texture_compression_rgtc 1
7280#define GL_COMPRESSED_RED_RGTC1_EXT       0x8DBB
7281#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC
7282#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD
7283#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE
7284#endif /* GL_EXT_texture_compression_rgtc */
7285
7286#ifndef GL_EXT_texture_compression_s3tc
7287#define GL_EXT_texture_compression_s3tc 1
7288#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT   0x83F0
7289#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT  0x83F1
7290#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT  0x83F2
7291#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT  0x83F3
7292#endif /* GL_EXT_texture_compression_s3tc */
7293
7294#ifndef GL_EXT_texture_cube_map
7295#define GL_EXT_texture_cube_map 1
7296#define GL_NORMAL_MAP_EXT                 0x8511
7297#define GL_REFLECTION_MAP_EXT             0x8512
7298#define GL_TEXTURE_CUBE_MAP_EXT           0x8513
7299#define GL_TEXTURE_BINDING_CUBE_MAP_EXT   0x8514
7300#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515
7301#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516
7302#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517
7303#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518
7304#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519
7305#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A
7306#define GL_PROXY_TEXTURE_CUBE_MAP_EXT     0x851B
7307#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT  0x851C
7308#endif /* GL_EXT_texture_cube_map */
7309
7310#ifndef GL_EXT_texture_env_add
7311#define GL_EXT_texture_env_add 1
7312#endif /* GL_EXT_texture_env_add */
7313
7314#ifndef GL_EXT_texture_env_combine
7315#define GL_EXT_texture_env_combine 1
7316#define GL_COMBINE_EXT                    0x8570
7317#define GL_COMBINE_RGB_EXT                0x8571
7318#define GL_COMBINE_ALPHA_EXT              0x8572
7319#define GL_RGB_SCALE_EXT                  0x8573
7320#define GL_ADD_SIGNED_EXT                 0x8574
7321#define GL_INTERPOLATE_EXT                0x8575
7322#define GL_CONSTANT_EXT                   0x8576
7323#define GL_PRIMARY_COLOR_EXT              0x8577
7324#define GL_PREVIOUS_EXT                   0x8578
7325#define GL_SOURCE0_RGB_EXT                0x8580
7326#define GL_SOURCE1_RGB_EXT                0x8581
7327#define GL_SOURCE2_RGB_EXT                0x8582
7328#define GL_SOURCE0_ALPHA_EXT              0x8588
7329#define GL_SOURCE1_ALPHA_EXT              0x8589
7330#define GL_SOURCE2_ALPHA_EXT              0x858A
7331#define GL_OPERAND0_RGB_EXT               0x8590
7332#define GL_OPERAND1_RGB_EXT               0x8591
7333#define GL_OPERAND2_RGB_EXT               0x8592
7334#define GL_OPERAND0_ALPHA_EXT             0x8598
7335#define GL_OPERAND1_ALPHA_EXT             0x8599
7336#define GL_OPERAND2_ALPHA_EXT             0x859A
7337#endif /* GL_EXT_texture_env_combine */
7338
7339#ifndef GL_EXT_texture_env_dot3
7340#define GL_EXT_texture_env_dot3 1
7341#define GL_DOT3_RGB_EXT                   0x8740
7342#define GL_DOT3_RGBA_EXT                  0x8741
7343#endif /* GL_EXT_texture_env_dot3 */
7344
7345#ifndef GL_EXT_texture_filter_anisotropic
7346#define GL_EXT_texture_filter_anisotropic 1
7347#define GL_TEXTURE_MAX_ANISOTROPY_EXT     0x84FE
7348#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
7349#endif /* GL_EXT_texture_filter_anisotropic */
7350
7351#ifndef GL_EXT_texture_integer
7352#define GL_EXT_texture_integer 1
7353#define GL_RGBA32UI_EXT                   0x8D70
7354#define GL_RGB32UI_EXT                    0x8D71
7355#define GL_ALPHA32UI_EXT                  0x8D72
7356#define GL_INTENSITY32UI_EXT              0x8D73
7357#define GL_LUMINANCE32UI_EXT              0x8D74
7358#define GL_LUMINANCE_ALPHA32UI_EXT        0x8D75
7359#define GL_RGBA16UI_EXT                   0x8D76
7360#define GL_RGB16UI_EXT                    0x8D77
7361#define GL_ALPHA16UI_EXT                  0x8D78
7362#define GL_INTENSITY16UI_EXT              0x8D79
7363#define GL_LUMINANCE16UI_EXT              0x8D7A
7364#define GL_LUMINANCE_ALPHA16UI_EXT        0x8D7B
7365#define GL_RGBA8UI_EXT                    0x8D7C
7366#define GL_RGB8UI_EXT                     0x8D7D
7367#define GL_ALPHA8UI_EXT                   0x8D7E
7368#define GL_INTENSITY8UI_EXT               0x8D7F
7369#define GL_LUMINANCE8UI_EXT               0x8D80
7370#define GL_LUMINANCE_ALPHA8UI_EXT         0x8D81
7371#define GL_RGBA32I_EXT                    0x8D82
7372#define GL_RGB32I_EXT                     0x8D83
7373#define GL_ALPHA32I_EXT                   0x8D84
7374#define GL_INTENSITY32I_EXT               0x8D85
7375#define GL_LUMINANCE32I_EXT               0x8D86
7376#define GL_LUMINANCE_ALPHA32I_EXT         0x8D87
7377#define GL_RGBA16I_EXT                    0x8D88
7378#define GL_RGB16I_EXT                     0x8D89
7379#define GL_ALPHA16I_EXT                   0x8D8A
7380#define GL_INTENSITY16I_EXT               0x8D8B
7381#define GL_LUMINANCE16I_EXT               0x8D8C
7382#define GL_LUMINANCE_ALPHA16I_EXT         0x8D8D
7383#define GL_RGBA8I_EXT                     0x8D8E
7384#define GL_RGB8I_EXT                      0x8D8F
7385#define GL_ALPHA8I_EXT                    0x8D90
7386#define GL_INTENSITY8I_EXT                0x8D91
7387#define GL_LUMINANCE8I_EXT                0x8D92
7388#define GL_LUMINANCE_ALPHA8I_EXT          0x8D93
7389#define GL_RED_INTEGER_EXT                0x8D94
7390#define GL_GREEN_INTEGER_EXT              0x8D95
7391#define GL_BLUE_INTEGER_EXT               0x8D96
7392#define GL_ALPHA_INTEGER_EXT              0x8D97
7393#define GL_RGB_INTEGER_EXT                0x8D98
7394#define GL_RGBA_INTEGER_EXT               0x8D99
7395#define GL_BGR_INTEGER_EXT                0x8D9A
7396#define GL_BGRA_INTEGER_EXT               0x8D9B
7397#define GL_LUMINANCE_INTEGER_EXT          0x8D9C
7398#define GL_LUMINANCE_ALPHA_INTEGER_EXT    0x8D9D
7399#define GL_RGBA_INTEGER_MODE_EXT          0x8D9E
7400typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
7401typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
7402typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
7403typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
7404typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha);
7405typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha);
7406#ifdef GL_GLEXT_PROTOTYPES
7407GLAPI void APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params);
7408GLAPI void APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params);
7409GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params);
7410GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params);
7411GLAPI void APIENTRY glClearColorIiEXT (GLint red, GLint green, GLint blue, GLint alpha);
7412GLAPI void APIENTRY glClearColorIuiEXT (GLuint red, GLuint green, GLuint blue, GLuint alpha);
7413#endif
7414#endif /* GL_EXT_texture_integer */
7415
7416#ifndef GL_EXT_texture_lod_bias
7417#define GL_EXT_texture_lod_bias 1
7418#define GL_MAX_TEXTURE_LOD_BIAS_EXT       0x84FD
7419#define GL_TEXTURE_FILTER_CONTROL_EXT     0x8500
7420#define GL_TEXTURE_LOD_BIAS_EXT           0x8501
7421#endif /* GL_EXT_texture_lod_bias */
7422
7423#ifndef GL_EXT_texture_mirror_clamp
7424#define GL_EXT_texture_mirror_clamp 1
7425#define GL_MIRROR_CLAMP_EXT               0x8742
7426#define GL_MIRROR_CLAMP_TO_EDGE_EXT       0x8743
7427#define GL_MIRROR_CLAMP_TO_BORDER_EXT     0x8912
7428#endif /* GL_EXT_texture_mirror_clamp */
7429
7430#ifndef GL_EXT_texture_object
7431#define GL_EXT_texture_object 1
7432#define GL_TEXTURE_PRIORITY_EXT           0x8066
7433#define GL_TEXTURE_RESIDENT_EXT           0x8067
7434#define GL_TEXTURE_1D_BINDING_EXT         0x8068
7435#define GL_TEXTURE_2D_BINDING_EXT         0x8069
7436#define GL_TEXTURE_3D_BINDING_EXT         0x806A
7437typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences);
7438typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture);
7439typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures);
7440typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures);
7441typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture);
7442typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities);
7443#ifdef GL_GLEXT_PROTOTYPES
7444GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei n, const GLuint *textures, GLboolean *residences);
7445GLAPI void APIENTRY glBindTextureEXT (GLenum target, GLuint texture);
7446GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei n, const GLuint *textures);
7447GLAPI void APIENTRY glGenTexturesEXT (GLsizei n, GLuint *textures);
7448GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint texture);
7449GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei n, const GLuint *textures, const GLclampf *priorities);
7450#endif
7451#endif /* GL_EXT_texture_object */
7452
7453#ifndef GL_EXT_texture_perturb_normal
7454#define GL_EXT_texture_perturb_normal 1
7455#define GL_PERTURB_EXT                    0x85AE
7456#define GL_TEXTURE_NORMAL_EXT             0x85AF
7457typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode);
7458#ifdef GL_GLEXT_PROTOTYPES
7459GLAPI void APIENTRY glTextureNormalEXT (GLenum mode);
7460#endif
7461#endif /* GL_EXT_texture_perturb_normal */
7462
7463#ifndef GL_EXT_texture_sRGB
7464#define GL_EXT_texture_sRGB 1
7465#define GL_SRGB_EXT                       0x8C40
7466#define GL_SRGB8_EXT                      0x8C41
7467#define GL_SRGB_ALPHA_EXT                 0x8C42
7468#define GL_SRGB8_ALPHA8_EXT               0x8C43
7469#define GL_SLUMINANCE_ALPHA_EXT           0x8C44
7470#define GL_SLUMINANCE8_ALPHA8_EXT         0x8C45
7471#define GL_SLUMINANCE_EXT                 0x8C46
7472#define GL_SLUMINANCE8_EXT                0x8C47
7473#define GL_COMPRESSED_SRGB_EXT            0x8C48
7474#define GL_COMPRESSED_SRGB_ALPHA_EXT      0x8C49
7475#define GL_COMPRESSED_SLUMINANCE_EXT      0x8C4A
7476#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
7477#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT  0x8C4C
7478#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
7479#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
7480#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
7481#endif /* GL_EXT_texture_sRGB */
7482
7483#ifndef GL_EXT_texture_sRGB_decode
7484#define GL_EXT_texture_sRGB_decode 1
7485#define GL_TEXTURE_SRGB_DECODE_EXT        0x8A48
7486#define GL_DECODE_EXT                     0x8A49
7487#define GL_SKIP_DECODE_EXT                0x8A4A
7488#endif /* GL_EXT_texture_sRGB_decode */
7489
7490#ifndef GL_EXT_texture_shared_exponent
7491#define GL_EXT_texture_shared_exponent 1
7492#define GL_RGB9_E5_EXT                    0x8C3D
7493#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT   0x8C3E
7494#define GL_TEXTURE_SHARED_SIZE_EXT        0x8C3F
7495#endif /* GL_EXT_texture_shared_exponent */
7496
7497#ifndef GL_EXT_texture_snorm
7498#define GL_EXT_texture_snorm 1
7499#define GL_ALPHA_SNORM                    0x9010
7500#define GL_LUMINANCE_SNORM                0x9011
7501#define GL_LUMINANCE_ALPHA_SNORM          0x9012
7502#define GL_INTENSITY_SNORM                0x9013
7503#define GL_ALPHA8_SNORM                   0x9014
7504#define GL_LUMINANCE8_SNORM               0x9015
7505#define GL_LUMINANCE8_ALPHA8_SNORM        0x9016
7506#define GL_INTENSITY8_SNORM               0x9017
7507#define GL_ALPHA16_SNORM                  0x9018
7508#define GL_LUMINANCE16_SNORM              0x9019
7509#define GL_LUMINANCE16_ALPHA16_SNORM      0x901A
7510#define GL_INTENSITY16_SNORM              0x901B
7511#define GL_RED_SNORM                      0x8F90
7512#define GL_RG_SNORM                       0x8F91
7513#define GL_RGB_SNORM                      0x8F92
7514#define GL_RGBA_SNORM                     0x8F93
7515#endif /* GL_EXT_texture_snorm */
7516
7517#ifndef GL_EXT_texture_swizzle
7518#define GL_EXT_texture_swizzle 1
7519#define GL_TEXTURE_SWIZZLE_R_EXT          0x8E42
7520#define GL_TEXTURE_SWIZZLE_G_EXT          0x8E43
7521#define GL_TEXTURE_SWIZZLE_B_EXT          0x8E44
7522#define GL_TEXTURE_SWIZZLE_A_EXT          0x8E45
7523#define GL_TEXTURE_SWIZZLE_RGBA_EXT       0x8E46
7524#endif /* GL_EXT_texture_swizzle */
7525
7526#ifndef GL_EXT_timer_query
7527#define GL_EXT_timer_query 1
7528#define GL_TIME_ELAPSED_EXT               0x88BF
7529typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params);
7530typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
7531#ifdef GL_GLEXT_PROTOTYPES
7532GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params);
7533GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params);
7534#endif
7535#endif /* GL_EXT_timer_query */
7536
7537#ifndef GL_EXT_transform_feedback
7538#define GL_EXT_transform_feedback 1
7539#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT  0x8C8E
7540#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84
7541#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85
7542#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F
7543#define GL_INTERLEAVED_ATTRIBS_EXT        0x8C8C
7544#define GL_SEPARATE_ATTRIBS_EXT           0x8C8D
7545#define GL_PRIMITIVES_GENERATED_EXT       0x8C87
7546#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88
7547#define GL_RASTERIZER_DISCARD_EXT         0x8C89
7548#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A
7549#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B
7550#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80
7551#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83
7552#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F
7553#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76
7554typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode);
7555typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void);
7556typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
7557typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
7558typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer);
7559typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
7560typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
7561#ifdef GL_GLEXT_PROTOTYPES
7562GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum primitiveMode);
7563GLAPI void APIENTRY glEndTransformFeedbackEXT (void);
7564GLAPI void APIENTRY glBindBufferRangeEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
7565GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
7566GLAPI void APIENTRY glBindBufferBaseEXT (GLenum target, GLuint index, GLuint buffer);
7567GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
7568GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
7569#endif
7570#endif /* GL_EXT_transform_feedback */
7571
7572#ifndef GL_EXT_vertex_array
7573#define GL_EXT_vertex_array 1
7574#define GL_VERTEX_ARRAY_EXT               0x8074
7575#define GL_NORMAL_ARRAY_EXT               0x8075
7576#define GL_COLOR_ARRAY_EXT                0x8076
7577#define GL_INDEX_ARRAY_EXT                0x8077
7578#define GL_TEXTURE_COORD_ARRAY_EXT        0x8078
7579#define GL_EDGE_FLAG_ARRAY_EXT            0x8079
7580#define GL_VERTEX_ARRAY_SIZE_EXT          0x807A
7581#define GL_VERTEX_ARRAY_TYPE_EXT          0x807B
7582#define GL_VERTEX_ARRAY_STRIDE_EXT        0x807C
7583#define GL_VERTEX_ARRAY_COUNT_EXT         0x807D
7584#define GL_NORMAL_ARRAY_TYPE_EXT          0x807E
7585#define GL_NORMAL_ARRAY_STRIDE_EXT        0x807F
7586#define GL_NORMAL_ARRAY_COUNT_EXT         0x8080
7587#define GL_COLOR_ARRAY_SIZE_EXT           0x8081
7588#define GL_COLOR_ARRAY_TYPE_EXT           0x8082
7589#define GL_COLOR_ARRAY_STRIDE_EXT         0x8083
7590#define GL_COLOR_ARRAY_COUNT_EXT          0x8084
7591#define GL_INDEX_ARRAY_TYPE_EXT           0x8085
7592#define GL_INDEX_ARRAY_STRIDE_EXT         0x8086
7593#define GL_INDEX_ARRAY_COUNT_EXT          0x8087
7594#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT   0x8088
7595#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT   0x8089
7596#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A
7597#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT  0x808B
7598#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT     0x808C
7599#define GL_EDGE_FLAG_ARRAY_COUNT_EXT      0x808D
7600#define GL_VERTEX_ARRAY_POINTER_EXT       0x808E
7601#define GL_NORMAL_ARRAY_POINTER_EXT       0x808F
7602#define GL_COLOR_ARRAY_POINTER_EXT        0x8090
7603#define GL_INDEX_ARRAY_POINTER_EXT        0x8091
7604#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092
7605#define GL_EDGE_FLAG_ARRAY_POINTER_EXT    0x8093
7606typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i);
7607typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
7608typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count);
7609typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer);
7610typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, void **params);
7611typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer);
7612typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer);
7613typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
7614typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
7615#ifdef GL_GLEXT_PROTOTYPES
7616GLAPI void APIENTRY glArrayElementEXT (GLint i);
7617GLAPI void APIENTRY glColorPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
7618GLAPI void APIENTRY glDrawArraysEXT (GLenum mode, GLint first, GLsizei count);
7619GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei stride, GLsizei count, const GLboolean *pointer);
7620GLAPI void APIENTRY glGetPointervEXT (GLenum pname, void **params);
7621GLAPI void APIENTRY glIndexPointerEXT (GLenum type, GLsizei stride, GLsizei count, const void *pointer);
7622GLAPI void APIENTRY glNormalPointerEXT (GLenum type, GLsizei stride, GLsizei count, const void *pointer);
7623GLAPI void APIENTRY glTexCoordPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
7624GLAPI void APIENTRY glVertexPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
7625#endif
7626#endif /* GL_EXT_vertex_array */
7627
7628#ifndef GL_EXT_vertex_array_bgra
7629#define GL_EXT_vertex_array_bgra 1
7630#endif /* GL_EXT_vertex_array_bgra */
7631
7632#ifndef GL_EXT_vertex_attrib_64bit
7633#define GL_EXT_vertex_attrib_64bit 1
7634#define GL_DOUBLE_VEC2_EXT                0x8FFC
7635#define GL_DOUBLE_VEC3_EXT                0x8FFD
7636#define GL_DOUBLE_VEC4_EXT                0x8FFE
7637#define GL_DOUBLE_MAT2_EXT                0x8F46
7638#define GL_DOUBLE_MAT3_EXT                0x8F47
7639#define GL_DOUBLE_MAT4_EXT                0x8F48
7640#define GL_DOUBLE_MAT2x3_EXT              0x8F49
7641#define GL_DOUBLE_MAT2x4_EXT              0x8F4A
7642#define GL_DOUBLE_MAT3x2_EXT              0x8F4B
7643#define GL_DOUBLE_MAT3x4_EXT              0x8F4C
7644#define GL_DOUBLE_MAT4x2_EXT              0x8F4D
7645#define GL_DOUBLE_MAT4x3_EXT              0x8F4E
7646typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x);
7647typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y);
7648typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
7649typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
7650typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble *v);
7651typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble *v);
7652typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble *v);
7653typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble *v);
7654typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
7655typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble *params);
7656#ifdef GL_GLEXT_PROTOTYPES
7657GLAPI void APIENTRY glVertexAttribL1dEXT (GLuint index, GLdouble x);
7658GLAPI void APIENTRY glVertexAttribL2dEXT (GLuint index, GLdouble x, GLdouble y);
7659GLAPI void APIENTRY glVertexAttribL3dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z);
7660GLAPI void APIENTRY glVertexAttribL4dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
7661GLAPI void APIENTRY glVertexAttribL1dvEXT (GLuint index, const GLdouble *v);
7662GLAPI void APIENTRY glVertexAttribL2dvEXT (GLuint index, const GLdouble *v);
7663GLAPI void APIENTRY glVertexAttribL3dvEXT (GLuint index, const GLdouble *v);
7664GLAPI void APIENTRY glVertexAttribL4dvEXT (GLuint index, const GLdouble *v);
7665GLAPI void APIENTRY glVertexAttribLPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
7666GLAPI void APIENTRY glGetVertexAttribLdvEXT (GLuint index, GLenum pname, GLdouble *params);
7667#endif
7668#endif /* GL_EXT_vertex_attrib_64bit */
7669
7670#ifndef GL_EXT_vertex_shader
7671#define GL_EXT_vertex_shader 1
7672#define GL_VERTEX_SHADER_EXT              0x8780
7673#define GL_VERTEX_SHADER_BINDING_EXT      0x8781
7674#define GL_OP_INDEX_EXT                   0x8782
7675#define GL_OP_NEGATE_EXT                  0x8783
7676#define GL_OP_DOT3_EXT                    0x8784
7677#define GL_OP_DOT4_EXT                    0x8785
7678#define GL_OP_MUL_EXT                     0x8786
7679#define GL_OP_ADD_EXT                     0x8787
7680#define GL_OP_MADD_EXT                    0x8788
7681#define GL_OP_FRAC_EXT                    0x8789
7682#define GL_OP_MAX_EXT                     0x878A
7683#define GL_OP_MIN_EXT                     0x878B
7684#define GL_OP_SET_GE_EXT                  0x878C
7685#define GL_OP_SET_LT_EXT                  0x878D
7686#define GL_OP_CLAMP_EXT                   0x878E
7687#define GL_OP_FLOOR_EXT                   0x878F
7688#define GL_OP_ROUND_EXT                   0x8790
7689#define GL_OP_EXP_BASE_2_EXT              0x8791
7690#define GL_OP_LOG_BASE_2_EXT              0x8792
7691#define GL_OP_POWER_EXT                   0x8793
7692#define GL_OP_RECIP_EXT                   0x8794
7693#define GL_OP_RECIP_SQRT_EXT              0x8795
7694#define GL_OP_SUB_EXT                     0x8796
7695#define GL_OP_CROSS_PRODUCT_EXT           0x8797
7696#define GL_OP_MULTIPLY_MATRIX_EXT         0x8798
7697#define GL_OP_MOV_EXT                     0x8799
7698#define GL_OUTPUT_VERTEX_EXT              0x879A
7699#define GL_OUTPUT_COLOR0_EXT              0x879B
7700#define GL_OUTPUT_COLOR1_EXT              0x879C
7701#define GL_OUTPUT_TEXTURE_COORD0_EXT      0x879D
7702#define GL_OUTPUT_TEXTURE_COORD1_EXT      0x879E
7703#define GL_OUTPUT_TEXTURE_COORD2_EXT      0x879F
7704#define GL_OUTPUT_TEXTURE_COORD3_EXT      0x87A0
7705#define GL_OUTPUT_TEXTURE_COORD4_EXT      0x87A1
7706#define GL_OUTPUT_TEXTURE_COORD5_EXT      0x87A2
7707#define GL_OUTPUT_TEXTURE_COORD6_EXT      0x87A3
7708#define GL_OUTPUT_TEXTURE_COORD7_EXT      0x87A4
7709#define GL_OUTPUT_TEXTURE_COORD8_EXT      0x87A5
7710#define GL_OUTPUT_TEXTURE_COORD9_EXT      0x87A6
7711#define GL_OUTPUT_TEXTURE_COORD10_EXT     0x87A7
7712#define GL_OUTPUT_TEXTURE_COORD11_EXT     0x87A8
7713#define GL_OUTPUT_TEXTURE_COORD12_EXT     0x87A9
7714#define GL_OUTPUT_TEXTURE_COORD13_EXT     0x87AA
7715#define GL_OUTPUT_TEXTURE_COORD14_EXT     0x87AB
7716#define GL_OUTPUT_TEXTURE_COORD15_EXT     0x87AC
7717#define GL_OUTPUT_TEXTURE_COORD16_EXT     0x87AD
7718#define GL_OUTPUT_TEXTURE_COORD17_EXT     0x87AE
7719#define GL_OUTPUT_TEXTURE_COORD18_EXT     0x87AF
7720#define GL_OUTPUT_TEXTURE_COORD19_EXT     0x87B0
7721#define GL_OUTPUT_TEXTURE_COORD20_EXT     0x87B1
7722#define GL_OUTPUT_TEXTURE_COORD21_EXT     0x87B2
7723#define GL_OUTPUT_TEXTURE_COORD22_EXT     0x87B3
7724#define GL_OUTPUT_TEXTURE_COORD23_EXT     0x87B4
7725#define GL_OUTPUT_TEXTURE_COORD24_EXT     0x87B5
7726#define GL_OUTPUT_TEXTURE_COORD25_EXT     0x87B6
7727#define GL_OUTPUT_TEXTURE_COORD26_EXT     0x87B7
7728#define GL_OUTPUT_TEXTURE_COORD27_EXT     0x87B8
7729#define GL_OUTPUT_TEXTURE_COORD28_EXT     0x87B9
7730#define GL_OUTPUT_TEXTURE_COORD29_EXT     0x87BA
7731#define GL_OUTPUT_TEXTURE_COORD30_EXT     0x87BB
7732#define GL_OUTPUT_TEXTURE_COORD31_EXT     0x87BC
7733#define GL_OUTPUT_FOG_EXT                 0x87BD
7734#define GL_SCALAR_EXT                     0x87BE
7735#define GL_VECTOR_EXT                     0x87BF
7736#define GL_MATRIX_EXT                     0x87C0
7737#define GL_VARIANT_EXT                    0x87C1
7738#define GL_INVARIANT_EXT                  0x87C2
7739#define GL_LOCAL_CONSTANT_EXT             0x87C3
7740#define GL_LOCAL_EXT                      0x87C4
7741#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5
7742#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6
7743#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7
7744#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8
7745#define GL_MAX_VERTEX_SHADER_LOCALS_EXT   0x87C9
7746#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA
7747#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB
7748#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC
7749#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD
7750#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE
7751#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF
7752#define GL_VERTEX_SHADER_VARIANTS_EXT     0x87D0
7753#define GL_VERTEX_SHADER_INVARIANTS_EXT   0x87D1
7754#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2
7755#define GL_VERTEX_SHADER_LOCALS_EXT       0x87D3
7756#define GL_VERTEX_SHADER_OPTIMIZED_EXT    0x87D4
7757#define GL_X_EXT                          0x87D5
7758#define GL_Y_EXT                          0x87D6
7759#define GL_Z_EXT                          0x87D7
7760#define GL_W_EXT                          0x87D8
7761#define GL_NEGATIVE_X_EXT                 0x87D9
7762#define GL_NEGATIVE_Y_EXT                 0x87DA
7763#define GL_NEGATIVE_Z_EXT                 0x87DB
7764#define GL_NEGATIVE_W_EXT                 0x87DC
7765#define GL_ZERO_EXT                       0x87DD
7766#define GL_ONE_EXT                        0x87DE
7767#define GL_NEGATIVE_ONE_EXT               0x87DF
7768#define GL_NORMALIZED_RANGE_EXT           0x87E0
7769#define GL_FULL_RANGE_EXT                 0x87E1
7770#define GL_CURRENT_VERTEX_EXT             0x87E2
7771#define GL_MVP_MATRIX_EXT                 0x87E3
7772#define GL_VARIANT_VALUE_EXT              0x87E4
7773#define GL_VARIANT_DATATYPE_EXT           0x87E5
7774#define GL_VARIANT_ARRAY_STRIDE_EXT       0x87E6
7775#define GL_VARIANT_ARRAY_TYPE_EXT         0x87E7
7776#define GL_VARIANT_ARRAY_EXT              0x87E8
7777#define GL_VARIANT_ARRAY_POINTER_EXT      0x87E9
7778#define GL_INVARIANT_VALUE_EXT            0x87EA
7779#define GL_INVARIANT_DATATYPE_EXT         0x87EB
7780#define GL_LOCAL_CONSTANT_VALUE_EXT       0x87EC
7781#define GL_LOCAL_CONSTANT_DATATYPE_EXT    0x87ED
7782typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void);
7783typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void);
7784typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id);
7785typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range);
7786typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id);
7787typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1);
7788typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2);
7789typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);
7790typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
7791typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
7792typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);
7793typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);
7794typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components);
7795typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const void *addr);
7796typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const void *addr);
7797typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr);
7798typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr);
7799typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr);
7800typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr);
7801typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr);
7802typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr);
7803typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr);
7804typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr);
7805typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const void *addr);
7806typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);
7807typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);
7808typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value);
7809typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value);
7810typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value);
7811typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value);
7812typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value);
7813typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap);
7814typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
7815typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
7816typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
7817typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, void **data);
7818typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
7819typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
7820typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
7821typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
7822typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
7823typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
7824#ifdef GL_GLEXT_PROTOTYPES
7825GLAPI void APIENTRY glBeginVertexShaderEXT (void);
7826GLAPI void APIENTRY glEndVertexShaderEXT (void);
7827GLAPI void APIENTRY glBindVertexShaderEXT (GLuint id);
7828GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint range);
7829GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint id);
7830GLAPI void APIENTRY glShaderOp1EXT (GLenum op, GLuint res, GLuint arg1);
7831GLAPI void APIENTRY glShaderOp2EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2);
7832GLAPI void APIENTRY glShaderOp3EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);
7833GLAPI void APIENTRY glSwizzleEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
7834GLAPI void APIENTRY glWriteMaskEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
7835GLAPI void APIENTRY glInsertComponentEXT (GLuint res, GLuint src, GLuint num);
7836GLAPI void APIENTRY glExtractComponentEXT (GLuint res, GLuint src, GLuint num);
7837GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum datatype, GLenum storagetype, GLenum range, GLuint components);
7838GLAPI void APIENTRY glSetInvariantEXT (GLuint id, GLenum type, const void *addr);
7839GLAPI void APIENTRY glSetLocalConstantEXT (GLuint id, GLenum type, const void *addr);
7840GLAPI void APIENTRY glVariantbvEXT (GLuint id, const GLbyte *addr);
7841GLAPI void APIENTRY glVariantsvEXT (GLuint id, const GLshort *addr);
7842GLAPI void APIENTRY glVariantivEXT (GLuint id, const GLint *addr);
7843GLAPI void APIENTRY glVariantfvEXT (GLuint id, const GLfloat *addr);
7844GLAPI void APIENTRY glVariantdvEXT (GLuint id, const GLdouble *addr);
7845GLAPI void APIENTRY glVariantubvEXT (GLuint id, const GLubyte *addr);
7846GLAPI void APIENTRY glVariantusvEXT (GLuint id, const GLushort *addr);
7847GLAPI void APIENTRY glVariantuivEXT (GLuint id, const GLuint *addr);
7848GLAPI void APIENTRY glVariantPointerEXT (GLuint id, GLenum type, GLuint stride, const void *addr);
7849GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint id);
7850GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint id);
7851GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum light, GLenum value);
7852GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum face, GLenum value);
7853GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum unit, GLenum coord, GLenum value);
7854GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum unit, GLenum value);
7855GLAPI GLuint APIENTRY glBindParameterEXT (GLenum value);
7856GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint id, GLenum cap);
7857GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
7858GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint id, GLenum value, GLint *data);
7859GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
7860GLAPI void APIENTRY glGetVariantPointervEXT (GLuint id, GLenum value, void **data);
7861GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
7862GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint id, GLenum value, GLint *data);
7863GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
7864GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
7865GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint id, GLenum value, GLint *data);
7866GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
7867#endif
7868#endif /* GL_EXT_vertex_shader */
7869
7870#ifndef GL_EXT_vertex_weighting
7871#define GL_EXT_vertex_weighting 1
7872#define GL_MODELVIEW0_STACK_DEPTH_EXT     0x0BA3
7873#define GL_MODELVIEW1_STACK_DEPTH_EXT     0x8502
7874#define GL_MODELVIEW0_MATRIX_EXT          0x0BA6
7875#define GL_MODELVIEW1_MATRIX_EXT          0x8506
7876#define GL_VERTEX_WEIGHTING_EXT           0x8509
7877#define GL_MODELVIEW0_EXT                 0x1700
7878#define GL_MODELVIEW1_EXT                 0x850A
7879#define GL_CURRENT_VERTEX_WEIGHT_EXT      0x850B
7880#define GL_VERTEX_WEIGHT_ARRAY_EXT        0x850C
7881#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT   0x850D
7882#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT   0x850E
7883#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F
7884#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510
7885typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);
7886typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight);
7887typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
7888#ifdef GL_GLEXT_PROTOTYPES
7889GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight);
7890GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight);
7891GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei stride, const void *pointer);
7892#endif
7893#endif /* GL_EXT_vertex_weighting */
7894
7895#ifndef GL_EXT_x11_sync_object
7896#define GL_EXT_x11_sync_object 1
7897#define GL_SYNC_X11_FENCE_EXT             0x90E1
7898typedef GLsync (APIENTRYP PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);
7899#ifdef GL_GLEXT_PROTOTYPES
7900GLAPI GLsync APIENTRY glImportSyncEXT (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);
7901#endif
7902#endif /* GL_EXT_x11_sync_object */
7903
7904#ifndef GL_GREMEDY_frame_terminator
7905#define GL_GREMEDY_frame_terminator 1
7906typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void);
7907#ifdef GL_GLEXT_PROTOTYPES
7908GLAPI void APIENTRY glFrameTerminatorGREMEDY (void);
7909#endif
7910#endif /* GL_GREMEDY_frame_terminator */
7911
7912#ifndef GL_GREMEDY_string_marker
7913#define GL_GREMEDY_string_marker 1
7914typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void *string);
7915#ifdef GL_GLEXT_PROTOTYPES
7916GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei len, const void *string);
7917#endif
7918#endif /* GL_GREMEDY_string_marker */
7919
7920#ifndef GL_HP_convolution_border_modes
7921#define GL_HP_convolution_border_modes 1
7922#define GL_IGNORE_BORDER_HP               0x8150
7923#define GL_CONSTANT_BORDER_HP             0x8151
7924#define GL_REPLICATE_BORDER_HP            0x8153
7925#define GL_CONVOLUTION_BORDER_COLOR_HP    0x8154
7926#endif /* GL_HP_convolution_border_modes */
7927
7928#ifndef GL_HP_image_transform
7929#define GL_HP_image_transform 1
7930#define GL_IMAGE_SCALE_X_HP               0x8155
7931#define GL_IMAGE_SCALE_Y_HP               0x8156
7932#define GL_IMAGE_TRANSLATE_X_HP           0x8157
7933#define GL_IMAGE_TRANSLATE_Y_HP           0x8158
7934#define GL_IMAGE_ROTATE_ANGLE_HP          0x8159
7935#define GL_IMAGE_ROTATE_ORIGIN_X_HP       0x815A
7936#define GL_IMAGE_ROTATE_ORIGIN_Y_HP       0x815B
7937#define GL_IMAGE_MAG_FILTER_HP            0x815C
7938#define GL_IMAGE_MIN_FILTER_HP            0x815D
7939#define GL_IMAGE_CUBIC_WEIGHT_HP          0x815E
7940#define GL_CUBIC_HP                       0x815F
7941#define GL_AVERAGE_HP                     0x8160
7942#define GL_IMAGE_TRANSFORM_2D_HP          0x8161
7943#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162
7944#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163
7945typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param);
7946typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param);
7947typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params);
7948typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params);
7949typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params);
7950typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params);
7951#ifdef GL_GLEXT_PROTOTYPES
7952GLAPI void APIENTRY glImageTransformParameteriHP (GLenum target, GLenum pname, GLint param);
7953GLAPI void APIENTRY glImageTransformParameterfHP (GLenum target, GLenum pname, GLfloat param);
7954GLAPI void APIENTRY glImageTransformParameterivHP (GLenum target, GLenum pname, const GLint *params);
7955GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum target, GLenum pname, const GLfloat *params);
7956GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum target, GLenum pname, GLint *params);
7957GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum target, GLenum pname, GLfloat *params);
7958#endif
7959#endif /* GL_HP_image_transform */
7960
7961#ifndef GL_HP_occlusion_test
7962#define GL_HP_occlusion_test 1
7963#define GL_OCCLUSION_TEST_HP              0x8165
7964#define GL_OCCLUSION_TEST_RESULT_HP       0x8166
7965#endif /* GL_HP_occlusion_test */
7966
7967#ifndef GL_HP_texture_lighting
7968#define GL_HP_texture_lighting 1
7969#define GL_TEXTURE_LIGHTING_MODE_HP       0x8167
7970#define GL_TEXTURE_POST_SPECULAR_HP       0x8168
7971#define GL_TEXTURE_PRE_SPECULAR_HP        0x8169
7972#endif /* GL_HP_texture_lighting */
7973
7974#ifndef GL_IBM_cull_vertex
7975#define GL_IBM_cull_vertex 1
7976#define GL_CULL_VERTEX_IBM                103050
7977#endif /* GL_IBM_cull_vertex */
7978
7979#ifndef GL_IBM_multimode_draw_arrays
7980#define GL_IBM_multimode_draw_arrays 1
7981typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
7982typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, GLint modestride);
7983#ifdef GL_GLEXT_PROTOTYPES
7984GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
7985GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, GLint modestride);
7986#endif
7987#endif /* GL_IBM_multimode_draw_arrays */
7988
7989#ifndef GL_IBM_rasterpos_clip
7990#define GL_IBM_rasterpos_clip 1
7991#define GL_RASTER_POSITION_UNCLIPPED_IBM  0x19262
7992#endif /* GL_IBM_rasterpos_clip */
7993
7994#ifndef GL_IBM_static_data
7995#define GL_IBM_static_data 1
7996#define GL_ALL_STATIC_DATA_IBM            103060
7997#define GL_STATIC_VERTEX_ARRAY_IBM        103061
7998typedef void (APIENTRYP PFNGLFLUSHSTATICDATAIBMPROC) (GLenum target);
7999#ifdef GL_GLEXT_PROTOTYPES
8000GLAPI void APIENTRY glFlushStaticDataIBM (GLenum target);
8001#endif
8002#endif /* GL_IBM_static_data */
8003
8004#ifndef GL_IBM_texture_mirrored_repeat
8005#define GL_IBM_texture_mirrored_repeat 1
8006#define GL_MIRRORED_REPEAT_IBM            0x8370
8007#endif /* GL_IBM_texture_mirrored_repeat */
8008
8009#ifndef GL_IBM_vertex_array_lists
8010#define GL_IBM_vertex_array_lists 1
8011#define GL_VERTEX_ARRAY_LIST_IBM          103070
8012#define GL_NORMAL_ARRAY_LIST_IBM          103071
8013#define GL_COLOR_ARRAY_LIST_IBM           103072
8014#define GL_INDEX_ARRAY_LIST_IBM           103073
8015#define GL_TEXTURE_COORD_ARRAY_LIST_IBM   103074
8016#define GL_EDGE_FLAG_ARRAY_LIST_IBM       103075
8017#define GL_FOG_COORDINATE_ARRAY_LIST_IBM  103076
8018#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077
8019#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM   103080
8020#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM   103081
8021#define GL_COLOR_ARRAY_LIST_STRIDE_IBM    103082
8022#define GL_INDEX_ARRAY_LIST_STRIDE_IBM    103083
8023#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084
8024#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085
8025#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086
8026#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087
8027typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8028typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8029typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean **pointer, GLint ptrstride);
8030typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8031typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8032typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8033typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8034typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8035#ifdef GL_GLEXT_PROTOTYPES
8036GLAPI void APIENTRY glColorPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8037GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8038GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint stride, const GLboolean **pointer, GLint ptrstride);
8039GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8040GLAPI void APIENTRY glIndexPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8041GLAPI void APIENTRY glNormalPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8042GLAPI void APIENTRY glTexCoordPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8043GLAPI void APIENTRY glVertexPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
8044#endif
8045#endif /* GL_IBM_vertex_array_lists */
8046
8047#ifndef GL_INGR_blend_func_separate
8048#define GL_INGR_blend_func_separate 1
8049typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
8050#ifdef GL_GLEXT_PROTOTYPES
8051GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
8052#endif
8053#endif /* GL_INGR_blend_func_separate */
8054
8055#ifndef GL_INGR_color_clamp
8056#define GL_INGR_color_clamp 1
8057#define GL_RED_MIN_CLAMP_INGR             0x8560
8058#define GL_GREEN_MIN_CLAMP_INGR           0x8561
8059#define GL_BLUE_MIN_CLAMP_INGR            0x8562
8060#define GL_ALPHA_MIN_CLAMP_INGR           0x8563
8061#define GL_RED_MAX_CLAMP_INGR             0x8564
8062#define GL_GREEN_MAX_CLAMP_INGR           0x8565
8063#define GL_BLUE_MAX_CLAMP_INGR            0x8566
8064#define GL_ALPHA_MAX_CLAMP_INGR           0x8567
8065#endif /* GL_INGR_color_clamp */
8066
8067#ifndef GL_INGR_interlace_read
8068#define GL_INGR_interlace_read 1
8069#define GL_INTERLACE_READ_INGR            0x8568
8070#endif /* GL_INGR_interlace_read */
8071
8072#ifndef GL_INTEL_fragment_shader_ordering
8073#define GL_INTEL_fragment_shader_ordering 1
8074#endif /* GL_INTEL_fragment_shader_ordering */
8075
8076#ifndef GL_INTEL_map_texture
8077#define GL_INTEL_map_texture 1
8078#define GL_TEXTURE_MEMORY_LAYOUT_INTEL    0x83FF
8079#define GL_LAYOUT_DEFAULT_INTEL           0
8080#define GL_LAYOUT_LINEAR_INTEL            1
8081#define GL_LAYOUT_LINEAR_CPU_CACHED_INTEL 2
8082typedef void (APIENTRYP PFNGLSYNCTEXTUREINTELPROC) (GLuint texture);
8083typedef void (APIENTRYP PFNGLUNMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level);
8084typedef void *(APIENTRYP PFNGLMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level, GLbitfield access, GLint *stride, GLenum *layout);
8085#ifdef GL_GLEXT_PROTOTYPES
8086GLAPI void APIENTRY glSyncTextureINTEL (GLuint texture);
8087GLAPI void APIENTRY glUnmapTexture2DINTEL (GLuint texture, GLint level);
8088GLAPI void *APIENTRY glMapTexture2DINTEL (GLuint texture, GLint level, GLbitfield access, GLint *stride, GLenum *layout);
8089#endif
8090#endif /* GL_INTEL_map_texture */
8091
8092#ifndef GL_INTEL_parallel_arrays
8093#define GL_INTEL_parallel_arrays 1
8094#define GL_PARALLEL_ARRAYS_INTEL          0x83F4
8095#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5
8096#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6
8097#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7
8098#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8
8099typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer);
8100typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void **pointer);
8101typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer);
8102typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer);
8103#ifdef GL_GLEXT_PROTOTYPES
8104GLAPI void APIENTRY glVertexPointervINTEL (GLint size, GLenum type, const void **pointer);
8105GLAPI void APIENTRY glNormalPointervINTEL (GLenum type, const void **pointer);
8106GLAPI void APIENTRY glColorPointervINTEL (GLint size, GLenum type, const void **pointer);
8107GLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const void **pointer);
8108#endif
8109#endif /* GL_INTEL_parallel_arrays */
8110
8111#ifndef GL_MESAX_texture_stack
8112#define GL_MESAX_texture_stack 1
8113#define GL_TEXTURE_1D_STACK_MESAX         0x8759
8114#define GL_TEXTURE_2D_STACK_MESAX         0x875A
8115#define GL_PROXY_TEXTURE_1D_STACK_MESAX   0x875B
8116#define GL_PROXY_TEXTURE_2D_STACK_MESAX   0x875C
8117#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D
8118#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E
8119#endif /* GL_MESAX_texture_stack */
8120
8121#ifndef GL_MESA_pack_invert
8122#define GL_MESA_pack_invert 1
8123#define GL_PACK_INVERT_MESA               0x8758
8124#endif /* GL_MESA_pack_invert */
8125
8126#ifndef GL_MESA_resize_buffers
8127#define GL_MESA_resize_buffers 1
8128typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void);
8129#ifdef GL_GLEXT_PROTOTYPES
8130GLAPI void APIENTRY glResizeBuffersMESA (void);
8131#endif
8132#endif /* GL_MESA_resize_buffers */
8133
8134#ifndef GL_MESA_window_pos
8135#define GL_MESA_window_pos 1
8136typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y);
8137typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v);
8138typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y);
8139typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v);
8140typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y);
8141typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v);
8142typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y);
8143typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v);
8144typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z);
8145typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v);
8146typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z);
8147typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v);
8148typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z);
8149typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v);
8150typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z);
8151typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v);
8152typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
8153typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v);
8154typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
8155typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v);
8156typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w);
8157typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v);
8158typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w);
8159typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v);
8160#ifdef GL_GLEXT_PROTOTYPES
8161GLAPI void APIENTRY glWindowPos2dMESA (GLdouble x, GLdouble y);
8162GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *v);
8163GLAPI void APIENTRY glWindowPos2fMESA (GLfloat x, GLfloat y);
8164GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *v);
8165GLAPI void APIENTRY glWindowPos2iMESA (GLint x, GLint y);
8166GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *v);
8167GLAPI void APIENTRY glWindowPos2sMESA (GLshort x, GLshort y);
8168GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *v);
8169GLAPI void APIENTRY glWindowPos3dMESA (GLdouble x, GLdouble y, GLdouble z);
8170GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *v);
8171GLAPI void APIENTRY glWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z);
8172GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *v);
8173GLAPI void APIENTRY glWindowPos3iMESA (GLint x, GLint y, GLint z);
8174GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *v);
8175GLAPI void APIENTRY glWindowPos3sMESA (GLshort x, GLshort y, GLshort z);
8176GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *v);
8177GLAPI void APIENTRY glWindowPos4dMESA (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
8178GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *v);
8179GLAPI void APIENTRY glWindowPos4fMESA (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
8180GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *v);
8181GLAPI void APIENTRY glWindowPos4iMESA (GLint x, GLint y, GLint z, GLint w);
8182GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *v);
8183GLAPI void APIENTRY glWindowPos4sMESA (GLshort x, GLshort y, GLshort z, GLshort w);
8184GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v);
8185#endif
8186#endif /* GL_MESA_window_pos */
8187
8188#ifndef GL_MESA_ycbcr_texture
8189#define GL_MESA_ycbcr_texture 1
8190#define GL_UNSIGNED_SHORT_8_8_MESA        0x85BA
8191#define GL_UNSIGNED_SHORT_8_8_REV_MESA    0x85BB
8192#define GL_YCBCR_MESA                     0x8757
8193#endif /* GL_MESA_ycbcr_texture */
8194
8195#ifndef GL_NVX_conditional_render
8196#define GL_NVX_conditional_render 1
8197typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVXPROC) (GLuint id);
8198typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVXPROC) (void);
8199#ifdef GL_GLEXT_PROTOTYPES
8200GLAPI void APIENTRY glBeginConditionalRenderNVX (GLuint id);
8201GLAPI void APIENTRY glEndConditionalRenderNVX (void);
8202#endif
8203#endif /* GL_NVX_conditional_render */
8204
8205#ifndef GL_NV_bindless_multi_draw_indirect
8206#define GL_NV_bindless_multi_draw_indirect 1
8207typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
8208typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
8209#ifdef GL_GLEXT_PROTOTYPES
8210GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
8211GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
8212#endif
8213#endif /* GL_NV_bindless_multi_draw_indirect */
8214
8215#ifndef GL_NV_bindless_texture
8216#define GL_NV_bindless_texture 1
8217typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);
8218typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler);
8219typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
8220typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle);
8221typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
8222typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access);
8223typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle);
8224typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value);
8225typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value);
8226typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value);
8227typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
8228typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
8229typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle);
8230#ifdef GL_GLEXT_PROTOTYPES
8231GLAPI GLuint64 APIENTRY glGetTextureHandleNV (GLuint texture);
8232GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler);
8233GLAPI void APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle);
8234GLAPI void APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle);
8235GLAPI GLuint64 APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
8236GLAPI void APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access);
8237GLAPI void APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle);
8238GLAPI void APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value);
8239GLAPI void APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value);
8240GLAPI void APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value);
8241GLAPI void APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
8242GLAPI GLboolean APIENTRY glIsTextureHandleResidentNV (GLuint64 handle);
8243GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle);
8244#endif
8245#endif /* GL_NV_bindless_texture */
8246
8247#ifndef GL_NV_blend_equation_advanced
8248#define GL_NV_blend_equation_advanced 1
8249#define GL_BLEND_OVERLAP_NV               0x9281
8250#define GL_BLEND_PREMULTIPLIED_SRC_NV     0x9280
8251#define GL_COLORBURN_NV                   0x929A
8252#define GL_COLORDODGE_NV                  0x9299
8253#define GL_CONJOINT_NV                    0x9284
8254#define GL_CONTRAST_NV                    0x92A1
8255#define GL_DARKEN_NV                      0x9297
8256#define GL_DIFFERENCE_NV                  0x929E
8257#define GL_DISJOINT_NV                    0x9283
8258#define GL_DST_ATOP_NV                    0x928F
8259#define GL_DST_IN_NV                      0x928B
8260#define GL_DST_NV                         0x9287
8261#define GL_DST_OUT_NV                     0x928D
8262#define GL_DST_OVER_NV                    0x9289
8263#define GL_EXCLUSION_NV                   0x92A0
8264#define GL_HARDLIGHT_NV                   0x929B
8265#define GL_HARDMIX_NV                     0x92A9
8266#define GL_HSL_COLOR_NV                   0x92AF
8267#define GL_HSL_HUE_NV                     0x92AD
8268#define GL_HSL_LUMINOSITY_NV              0x92B0
8269#define GL_HSL_SATURATION_NV              0x92AE
8270#define GL_INVERT_OVG_NV                  0x92B4
8271#define GL_INVERT_RGB_NV                  0x92A3
8272#define GL_LIGHTEN_NV                     0x9298
8273#define GL_LINEARBURN_NV                  0x92A5
8274#define GL_LINEARDODGE_NV                 0x92A4
8275#define GL_LINEARLIGHT_NV                 0x92A7
8276#define GL_MINUS_CLAMPED_NV               0x92B3
8277#define GL_MINUS_NV                       0x929F
8278#define GL_MULTIPLY_NV                    0x9294
8279#define GL_OVERLAY_NV                     0x9296
8280#define GL_PINLIGHT_NV                    0x92A8
8281#define GL_PLUS_CLAMPED_ALPHA_NV          0x92B2
8282#define GL_PLUS_CLAMPED_NV                0x92B1
8283#define GL_PLUS_DARKER_NV                 0x9292
8284#define GL_PLUS_NV                        0x9291
8285#define GL_SCREEN_NV                      0x9295
8286#define GL_SOFTLIGHT_NV                   0x929C
8287#define GL_SRC_ATOP_NV                    0x928E
8288#define GL_SRC_IN_NV                      0x928A
8289#define GL_SRC_NV                         0x9286
8290#define GL_SRC_OUT_NV                     0x928C
8291#define GL_SRC_OVER_NV                    0x9288
8292#define GL_UNCORRELATED_NV                0x9282
8293#define GL_VIVIDLIGHT_NV                  0x92A6
8294typedef void (APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
8295typedef void (APIENTRYP PFNGLBLENDBARRIERNVPROC) (void);
8296#ifdef GL_GLEXT_PROTOTYPES
8297GLAPI void APIENTRY glBlendParameteriNV (GLenum pname, GLint value);
8298GLAPI void APIENTRY glBlendBarrierNV (void);
8299#endif
8300#endif /* GL_NV_blend_equation_advanced */
8301
8302#ifndef GL_NV_blend_equation_advanced_coherent
8303#define GL_NV_blend_equation_advanced_coherent 1
8304#define GL_BLEND_ADVANCED_COHERENT_NV     0x9285
8305#endif /* GL_NV_blend_equation_advanced_coherent */
8306
8307#ifndef GL_NV_blend_square
8308#define GL_NV_blend_square 1
8309#endif /* GL_NV_blend_square */
8310
8311#ifndef GL_NV_compute_program5
8312#define GL_NV_compute_program5 1
8313#define GL_COMPUTE_PROGRAM_NV             0x90FB
8314#define GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV 0x90FC
8315#endif /* GL_NV_compute_program5 */
8316
8317#ifndef GL_NV_conditional_render
8318#define GL_NV_conditional_render 1
8319#define GL_QUERY_WAIT_NV                  0x8E13
8320#define GL_QUERY_NO_WAIT_NV               0x8E14
8321#define GL_QUERY_BY_REGION_WAIT_NV        0x8E15
8322#define GL_QUERY_BY_REGION_NO_WAIT_NV     0x8E16
8323typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);
8324typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void);
8325#ifdef GL_GLEXT_PROTOTYPES
8326GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode);
8327GLAPI void APIENTRY glEndConditionalRenderNV (void);
8328#endif
8329#endif /* GL_NV_conditional_render */
8330
8331#ifndef GL_NV_copy_depth_to_color
8332#define GL_NV_copy_depth_to_color 1
8333#define GL_DEPTH_STENCIL_TO_RGBA_NV       0x886E
8334#define GL_DEPTH_STENCIL_TO_BGRA_NV       0x886F
8335#endif /* GL_NV_copy_depth_to_color */
8336
8337#ifndef GL_NV_copy_image
8338#define GL_NV_copy_image 1
8339typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
8340#ifdef GL_GLEXT_PROTOTYPES
8341GLAPI void APIENTRY glCopyImageSubDataNV (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
8342#endif
8343#endif /* GL_NV_copy_image */
8344
8345#ifndef GL_NV_deep_texture3D
8346#define GL_NV_deep_texture3D 1
8347#define GL_MAX_DEEP_3D_TEXTURE_WIDTH_HEIGHT_NV 0x90D0
8348#define GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV   0x90D1
8349#endif /* GL_NV_deep_texture3D */
8350
8351#ifndef GL_NV_depth_buffer_float
8352#define GL_NV_depth_buffer_float 1
8353#define GL_DEPTH_COMPONENT32F_NV          0x8DAB
8354#define GL_DEPTH32F_STENCIL8_NV           0x8DAC
8355#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD
8356#define GL_DEPTH_BUFFER_FLOAT_MODE_NV     0x8DAF
8357typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar);
8358typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth);
8359typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax);
8360#ifdef GL_GLEXT_PROTOTYPES
8361GLAPI void APIENTRY glDepthRangedNV (GLdouble zNear, GLdouble zFar);
8362GLAPI void APIENTRY glClearDepthdNV (GLdouble depth);
8363GLAPI void APIENTRY glDepthBoundsdNV (GLdouble zmin, GLdouble zmax);
8364#endif
8365#endif /* GL_NV_depth_buffer_float */
8366
8367#ifndef GL_NV_depth_clamp
8368#define GL_NV_depth_clamp 1
8369#define GL_DEPTH_CLAMP_NV                 0x864F
8370#endif /* GL_NV_depth_clamp */
8371
8372#ifndef GL_NV_draw_texture
8373#define GL_NV_draw_texture 1
8374typedef void (APIENTRYP PFNGLDRAWTEXTURENVPROC) (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
8375#ifdef GL_GLEXT_PROTOTYPES
8376GLAPI void APIENTRY glDrawTextureNV (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
8377#endif
8378#endif /* GL_NV_draw_texture */
8379
8380#ifndef GL_NV_evaluators
8381#define GL_NV_evaluators 1
8382#define GL_EVAL_2D_NV                     0x86C0
8383#define GL_EVAL_TRIANGULAR_2D_NV          0x86C1
8384#define GL_MAP_TESSELLATION_NV            0x86C2
8385#define GL_MAP_ATTRIB_U_ORDER_NV          0x86C3
8386#define GL_MAP_ATTRIB_V_ORDER_NV          0x86C4
8387#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5
8388#define GL_EVAL_VERTEX_ATTRIB0_NV         0x86C6
8389#define GL_EVAL_VERTEX_ATTRIB1_NV         0x86C7
8390#define GL_EVAL_VERTEX_ATTRIB2_NV         0x86C8
8391#define GL_EVAL_VERTEX_ATTRIB3_NV         0x86C9
8392#define GL_EVAL_VERTEX_ATTRIB4_NV         0x86CA
8393#define GL_EVAL_VERTEX_ATTRIB5_NV         0x86CB
8394#define GL_EVAL_VERTEX_ATTRIB6_NV         0x86CC
8395#define GL_EVAL_VERTEX_ATTRIB7_NV         0x86CD
8396#define GL_EVAL_VERTEX_ATTRIB8_NV         0x86CE
8397#define GL_EVAL_VERTEX_ATTRIB9_NV         0x86CF
8398#define GL_EVAL_VERTEX_ATTRIB10_NV        0x86D0
8399#define GL_EVAL_VERTEX_ATTRIB11_NV        0x86D1
8400#define GL_EVAL_VERTEX_ATTRIB12_NV        0x86D2
8401#define GL_EVAL_VERTEX_ATTRIB13_NV        0x86D3
8402#define GL_EVAL_VERTEX_ATTRIB14_NV        0x86D4
8403#define GL_EVAL_VERTEX_ATTRIB15_NV        0x86D5
8404#define GL_MAX_MAP_TESSELLATION_NV        0x86D6
8405#define GL_MAX_RATIONAL_EVAL_ORDER_NV     0x86D7
8406typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points);
8407typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params);
8408typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params);
8409typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points);
8410typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params);
8411typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params);
8412typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
8413typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
8414typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode);
8415#ifdef GL_GLEXT_PROTOTYPES
8416GLAPI void APIENTRY glMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points);
8417GLAPI void APIENTRY glMapParameterivNV (GLenum target, GLenum pname, const GLint *params);
8418GLAPI void APIENTRY glMapParameterfvNV (GLenum target, GLenum pname, const GLfloat *params);
8419GLAPI void APIENTRY glGetMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points);
8420GLAPI void APIENTRY glGetMapParameterivNV (GLenum target, GLenum pname, GLint *params);
8421GLAPI void APIENTRY glGetMapParameterfvNV (GLenum target, GLenum pname, GLfloat *params);
8422GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum target, GLuint index, GLenum pname, GLint *params);
8423GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params);
8424GLAPI void APIENTRY glEvalMapsNV (GLenum target, GLenum mode);
8425#endif
8426#endif /* GL_NV_evaluators */
8427
8428#ifndef GL_NV_explicit_multisample
8429#define GL_NV_explicit_multisample 1
8430#define GL_SAMPLE_POSITION_NV             0x8E50
8431#define GL_SAMPLE_MASK_NV                 0x8E51
8432#define GL_SAMPLE_MASK_VALUE_NV           0x8E52
8433#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53
8434#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54
8435#define GL_TEXTURE_RENDERBUFFER_NV        0x8E55
8436#define GL_SAMPLER_RENDERBUFFER_NV        0x8E56
8437#define GL_INT_SAMPLER_RENDERBUFFER_NV    0x8E57
8438#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58
8439#define GL_MAX_SAMPLE_MASK_WORDS_NV       0x8E59
8440typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val);
8441typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask);
8442typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer);
8443#ifdef GL_GLEXT_PROTOTYPES
8444GLAPI void APIENTRY glGetMultisamplefvNV (GLenum pname, GLuint index, GLfloat *val);
8445GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint index, GLbitfield mask);
8446GLAPI void APIENTRY glTexRenderbufferNV (GLenum target, GLuint renderbuffer);
8447#endif
8448#endif /* GL_NV_explicit_multisample */
8449
8450#ifndef GL_NV_fence
8451#define GL_NV_fence 1
8452#define GL_ALL_COMPLETED_NV               0x84F2
8453#define GL_FENCE_STATUS_NV                0x84F3
8454#define GL_FENCE_CONDITION_NV             0x84F4
8455typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
8456typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
8457typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
8458typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
8459typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
8460typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
8461typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
8462#ifdef GL_GLEXT_PROTOTYPES
8463GLAPI void APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
8464GLAPI void APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
8465GLAPI GLboolean APIENTRY glIsFenceNV (GLuint fence);
8466GLAPI GLboolean APIENTRY glTestFenceNV (GLuint fence);
8467GLAPI void APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
8468GLAPI void APIENTRY glFinishFenceNV (GLuint fence);
8469GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
8470#endif
8471#endif /* GL_NV_fence */
8472
8473#ifndef GL_NV_float_buffer
8474#define GL_NV_float_buffer 1
8475#define GL_FLOAT_R_NV                     0x8880
8476#define GL_FLOAT_RG_NV                    0x8881
8477#define GL_FLOAT_RGB_NV                   0x8882
8478#define GL_FLOAT_RGBA_NV                  0x8883
8479#define GL_FLOAT_R16_NV                   0x8884
8480#define GL_FLOAT_R32_NV                   0x8885
8481#define GL_FLOAT_RG16_NV                  0x8886
8482#define GL_FLOAT_RG32_NV                  0x8887
8483#define GL_FLOAT_RGB16_NV                 0x8888
8484#define GL_FLOAT_RGB32_NV                 0x8889
8485#define GL_FLOAT_RGBA16_NV                0x888A
8486#define GL_FLOAT_RGBA32_NV                0x888B
8487#define GL_TEXTURE_FLOAT_COMPONENTS_NV    0x888C
8488#define GL_FLOAT_CLEAR_COLOR_VALUE_NV     0x888D
8489#define GL_FLOAT_RGBA_MODE_NV             0x888E
8490#endif /* GL_NV_float_buffer */
8491
8492#ifndef GL_NV_fog_distance
8493#define GL_NV_fog_distance 1
8494#define GL_FOG_DISTANCE_MODE_NV           0x855A
8495#define GL_EYE_RADIAL_NV                  0x855B
8496#define GL_EYE_PLANE_ABSOLUTE_NV          0x855C
8497#endif /* GL_NV_fog_distance */
8498
8499#ifndef GL_NV_fragment_program
8500#define GL_NV_fragment_program 1
8501#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868
8502#define GL_FRAGMENT_PROGRAM_NV            0x8870
8503#define GL_MAX_TEXTURE_COORDS_NV          0x8871
8504#define GL_MAX_TEXTURE_IMAGE_UNITS_NV     0x8872
8505#define GL_FRAGMENT_PROGRAM_BINDING_NV    0x8873
8506#define GL_PROGRAM_ERROR_STRING_NV        0x8874
8507typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
8508typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v);
8509typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
8510typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v);
8511typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
8512typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
8513#ifdef GL_GLEXT_PROTOTYPES
8514GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
8515GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v);
8516GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
8517GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v);
8518GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
8519GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
8520#endif
8521#endif /* GL_NV_fragment_program */
8522
8523#ifndef GL_NV_fragment_program2
8524#define GL_NV_fragment_program2 1
8525#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4
8526#define GL_MAX_PROGRAM_CALL_DEPTH_NV      0x88F5
8527#define GL_MAX_PROGRAM_IF_DEPTH_NV        0x88F6
8528#define GL_MAX_PROGRAM_LOOP_DEPTH_NV      0x88F7
8529#define GL_MAX_PROGRAM_LOOP_COUNT_NV      0x88F8
8530#endif /* GL_NV_fragment_program2 */
8531
8532#ifndef GL_NV_fragment_program4
8533#define GL_NV_fragment_program4 1
8534#endif /* GL_NV_fragment_program4 */
8535
8536#ifndef GL_NV_fragment_program_option
8537#define GL_NV_fragment_program_option 1
8538#endif /* GL_NV_fragment_program_option */
8539
8540#ifndef GL_NV_framebuffer_multisample_coverage
8541#define GL_NV_framebuffer_multisample_coverage 1
8542#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB
8543#define GL_RENDERBUFFER_COLOR_SAMPLES_NV  0x8E10
8544#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11
8545#define GL_MULTISAMPLE_COVERAGE_MODES_NV  0x8E12
8546typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
8547#ifdef GL_GLEXT_PROTOTYPES
8548GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
8549#endif
8550#endif /* GL_NV_framebuffer_multisample_coverage */
8551
8552#ifndef GL_NV_geometry_program4
8553#define GL_NV_geometry_program4 1
8554#define GL_GEOMETRY_PROGRAM_NV            0x8C26
8555#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27
8556#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28
8557typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit);
8558typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
8559typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
8560typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
8561#ifdef GL_GLEXT_PROTOTYPES
8562GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit);
8563GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level);
8564GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
8565GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
8566#endif
8567#endif /* GL_NV_geometry_program4 */
8568
8569#ifndef GL_NV_geometry_shader4
8570#define GL_NV_geometry_shader4 1
8571#endif /* GL_NV_geometry_shader4 */
8572
8573#ifndef GL_NV_gpu_program4
8574#define GL_NV_gpu_program4 1
8575#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV    0x8904
8576#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV    0x8905
8577#define GL_PROGRAM_ATTRIB_COMPONENTS_NV   0x8906
8578#define GL_PROGRAM_RESULT_COMPONENTS_NV   0x8907
8579#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908
8580#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909
8581#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5
8582#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6
8583typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
8584typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
8585typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
8586typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
8587typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
8588typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
8589typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
8590typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
8591typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
8592typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
8593typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
8594typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
8595typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);
8596typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);
8597typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);
8598typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);
8599#ifdef GL_GLEXT_PROTOTYPES
8600GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
8601GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum target, GLuint index, const GLint *params);
8602GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params);
8603GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
8604GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum target, GLuint index, const GLuint *params);
8605GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params);
8606GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
8607GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum target, GLuint index, const GLint *params);
8608GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params);
8609GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
8610GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum target, GLuint index, const GLuint *params);
8611GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params);
8612GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum target, GLuint index, GLint *params);
8613GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum target, GLuint index, GLuint *params);
8614GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum target, GLuint index, GLint *params);
8615GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum target, GLuint index, GLuint *params);
8616#endif
8617#endif /* GL_NV_gpu_program4 */
8618
8619#ifndef GL_NV_gpu_program5
8620#define GL_NV_gpu_program5 1
8621#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A
8622#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B
8623#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C
8624#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D
8625#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E
8626#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F
8627#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44
8628#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV  0x8F45
8629typedef void (APIENTRYP PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC) (GLenum target, GLsizei count, const GLuint *params);
8630typedef void (APIENTRYP PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC) (GLenum target, GLuint index, GLuint *param);
8631#ifdef GL_GLEXT_PROTOTYPES
8632GLAPI void APIENTRY glProgramSubroutineParametersuivNV (GLenum target, GLsizei count, const GLuint *params);
8633GLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint index, GLuint *param);
8634#endif
8635#endif /* GL_NV_gpu_program5 */
8636
8637#ifndef GL_NV_gpu_program5_mem_extended
8638#define GL_NV_gpu_program5_mem_extended 1
8639#endif /* GL_NV_gpu_program5_mem_extended */
8640
8641#ifndef GL_NV_gpu_shader5
8642#define GL_NV_gpu_shader5 1
8643typedef int64_t GLint64EXT;
8644#define GL_INT64_NV                       0x140E
8645#define GL_UNSIGNED_INT64_NV              0x140F
8646#define GL_INT8_NV                        0x8FE0
8647#define GL_INT8_VEC2_NV                   0x8FE1
8648#define GL_INT8_VEC3_NV                   0x8FE2
8649#define GL_INT8_VEC4_NV                   0x8FE3
8650#define GL_INT16_NV                       0x8FE4
8651#define GL_INT16_VEC2_NV                  0x8FE5
8652#define GL_INT16_VEC3_NV                  0x8FE6
8653#define GL_INT16_VEC4_NV                  0x8FE7
8654#define GL_INT64_VEC2_NV                  0x8FE9
8655#define GL_INT64_VEC3_NV                  0x8FEA
8656#define GL_INT64_VEC4_NV                  0x8FEB
8657#define GL_UNSIGNED_INT8_NV               0x8FEC
8658#define GL_UNSIGNED_INT8_VEC2_NV          0x8FED
8659#define GL_UNSIGNED_INT8_VEC3_NV          0x8FEE
8660#define GL_UNSIGNED_INT8_VEC4_NV          0x8FEF
8661#define GL_UNSIGNED_INT16_NV              0x8FF0
8662#define GL_UNSIGNED_INT16_VEC2_NV         0x8FF1
8663#define GL_UNSIGNED_INT16_VEC3_NV         0x8FF2
8664#define GL_UNSIGNED_INT16_VEC4_NV         0x8FF3
8665#define GL_UNSIGNED_INT64_VEC2_NV         0x8FF5
8666#define GL_UNSIGNED_INT64_VEC3_NV         0x8FF6
8667#define GL_UNSIGNED_INT64_VEC4_NV         0x8FF7
8668#define GL_FLOAT16_NV                     0x8FF8
8669#define GL_FLOAT16_VEC2_NV                0x8FF9
8670#define GL_FLOAT16_VEC3_NV                0x8FFA
8671#define GL_FLOAT16_VEC4_NV                0x8FFB
8672typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);
8673typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);
8674typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
8675typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
8676typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
8677typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
8678typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
8679typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
8680typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);
8681typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);
8682typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
8683typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
8684typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
8685typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
8686typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
8687typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
8688typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params);
8689typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);
8690typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
8691typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
8692typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
8693typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
8694typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
8695typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
8696typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
8697typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);
8698typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
8699typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
8700typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
8701typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
8702typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
8703typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
8704typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
8705#ifdef GL_GLEXT_PROTOTYPES
8706GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x);
8707GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y);
8708GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
8709GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
8710GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
8711GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
8712GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
8713GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
8714GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x);
8715GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y);
8716GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
8717GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
8718GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
8719GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
8720GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
8721GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
8722GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params);
8723GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x);
8724GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
8725GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
8726GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
8727GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
8728GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
8729GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
8730GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
8731GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x);
8732GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
8733GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
8734GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
8735GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
8736GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
8737GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
8738GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
8739#endif
8740#endif /* GL_NV_gpu_shader5 */
8741
8742#ifndef GL_NV_half_float
8743#define GL_NV_half_float 1
8744typedef unsigned short GLhalfNV;
8745#define GL_HALF_FLOAT_NV                  0x140B
8746typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y);
8747typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v);
8748typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z);
8749typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v);
8750typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
8751typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v);
8752typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz);
8753typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v);
8754typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
8755typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v);
8756typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha);
8757typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v);
8758typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s);
8759typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v);
8760typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t);
8761typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v);
8762typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r);
8763typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v);
8764typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
8765typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v);
8766typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s);
8767typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v);
8768typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t);
8769typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v);
8770typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r);
8771typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v);
8772typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
8773typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v);
8774typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog);
8775typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog);
8776typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
8777typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v);
8778typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight);
8779typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight);
8780typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x);
8781typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v);
8782typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y);
8783typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v);
8784typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z);
8785typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v);
8786typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
8787typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v);
8788typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
8789typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
8790typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
8791typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
8792#ifdef GL_GLEXT_PROTOTYPES
8793GLAPI void APIENTRY glVertex2hNV (GLhalfNV x, GLhalfNV y);
8794GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *v);
8795GLAPI void APIENTRY glVertex3hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z);
8796GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *v);
8797GLAPI void APIENTRY glVertex4hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
8798GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *v);
8799GLAPI void APIENTRY glNormal3hNV (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz);
8800GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *v);
8801GLAPI void APIENTRY glColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
8802GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *v);
8803GLAPI void APIENTRY glColor4hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha);
8804GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *v);
8805GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV s);
8806GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *v);
8807GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV s, GLhalfNV t);
8808GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *v);
8809GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r);
8810GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *v);
8811GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
8812GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *v);
8813GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum target, GLhalfNV s);
8814GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum target, const GLhalfNV *v);
8815GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum target, GLhalfNV s, GLhalfNV t);
8816GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum target, const GLhalfNV *v);
8817GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r);
8818GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum target, const GLhalfNV *v);
8819GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
8820GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum target, const GLhalfNV *v);
8821GLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog);
8822GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog);
8823GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
8824GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v);
8825GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight);
8826GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight);
8827GLAPI void APIENTRY glVertexAttrib1hNV (GLuint index, GLhalfNV x);
8828GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint index, const GLhalfNV *v);
8829GLAPI void APIENTRY glVertexAttrib2hNV (GLuint index, GLhalfNV x, GLhalfNV y);
8830GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint index, const GLhalfNV *v);
8831GLAPI void APIENTRY glVertexAttrib3hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z);
8832GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint index, const GLhalfNV *v);
8833GLAPI void APIENTRY glVertexAttrib4hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
8834GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint index, const GLhalfNV *v);
8835GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
8836GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
8837GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
8838GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
8839#endif
8840#endif /* GL_NV_half_float */
8841
8842#ifndef GL_NV_light_max_exponent
8843#define GL_NV_light_max_exponent 1
8844#define GL_MAX_SHININESS_NV               0x8504
8845#define GL_MAX_SPOT_EXPONENT_NV           0x8505
8846#endif /* GL_NV_light_max_exponent */
8847
8848#ifndef GL_NV_multisample_coverage
8849#define GL_NV_multisample_coverage 1
8850#define GL_COLOR_SAMPLES_NV               0x8E20
8851#endif /* GL_NV_multisample_coverage */
8852
8853#ifndef GL_NV_multisample_filter_hint
8854#define GL_NV_multisample_filter_hint 1
8855#define GL_MULTISAMPLE_FILTER_HINT_NV     0x8534
8856#endif /* GL_NV_multisample_filter_hint */
8857
8858#ifndef GL_NV_occlusion_query
8859#define GL_NV_occlusion_query 1
8860#define GL_PIXEL_COUNTER_BITS_NV          0x8864
8861#define GL_CURRENT_OCCLUSION_QUERY_ID_NV  0x8865
8862#define GL_PIXEL_COUNT_NV                 0x8866
8863#define GL_PIXEL_COUNT_AVAILABLE_NV       0x8867
8864typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids);
8865typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids);
8866typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id);
8867typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id);
8868typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void);
8869typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params);
8870typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params);
8871#ifdef GL_GLEXT_PROTOTYPES
8872GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei n, GLuint *ids);
8873GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei n, const GLuint *ids);
8874GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint id);
8875GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint id);
8876GLAPI void APIENTRY glEndOcclusionQueryNV (void);
8877GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint id, GLenum pname, GLint *params);
8878GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint id, GLenum pname, GLuint *params);
8879#endif
8880#endif /* GL_NV_occlusion_query */
8881
8882#ifndef GL_NV_packed_depth_stencil
8883#define GL_NV_packed_depth_stencil 1
8884#define GL_DEPTH_STENCIL_NV               0x84F9
8885#define GL_UNSIGNED_INT_24_8_NV           0x84FA
8886#endif /* GL_NV_packed_depth_stencil */
8887
8888#ifndef GL_NV_parameter_buffer_object
8889#define GL_NV_parameter_buffer_object 1
8890#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0
8891#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1
8892#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2
8893#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3
8894#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4
8895typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params);
8896typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params);
8897typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params);
8898#ifdef GL_GLEXT_PROTOTYPES
8899GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params);
8900GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params);
8901GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params);
8902#endif
8903#endif /* GL_NV_parameter_buffer_object */
8904
8905#ifndef GL_NV_parameter_buffer_object2
8906#define GL_NV_parameter_buffer_object2 1
8907#endif /* GL_NV_parameter_buffer_object2 */
8908
8909#ifndef GL_NV_path_rendering
8910#define GL_NV_path_rendering 1
8911#define GL_PATH_FORMAT_SVG_NV             0x9070
8912#define GL_PATH_FORMAT_PS_NV              0x9071
8913#define GL_STANDARD_FONT_NAME_NV          0x9072
8914#define GL_SYSTEM_FONT_NAME_NV            0x9073
8915#define GL_FILE_NAME_NV                   0x9074
8916#define GL_PATH_STROKE_WIDTH_NV           0x9075
8917#define GL_PATH_END_CAPS_NV               0x9076
8918#define GL_PATH_INITIAL_END_CAP_NV        0x9077
8919#define GL_PATH_TERMINAL_END_CAP_NV       0x9078
8920#define GL_PATH_JOIN_STYLE_NV             0x9079
8921#define GL_PATH_MITER_LIMIT_NV            0x907A
8922#define GL_PATH_DASH_CAPS_NV              0x907B
8923#define GL_PATH_INITIAL_DASH_CAP_NV       0x907C
8924#define GL_PATH_TERMINAL_DASH_CAP_NV      0x907D
8925#define GL_PATH_DASH_OFFSET_NV            0x907E
8926#define GL_PATH_CLIENT_LENGTH_NV          0x907F
8927#define GL_PATH_FILL_MODE_NV              0x9080
8928#define GL_PATH_FILL_MASK_NV              0x9081
8929#define GL_PATH_FILL_COVER_MODE_NV        0x9082
8930#define GL_PATH_STROKE_COVER_MODE_NV      0x9083
8931#define GL_PATH_STROKE_MASK_NV            0x9084
8932#define GL_COUNT_UP_NV                    0x9088
8933#define GL_COUNT_DOWN_NV                  0x9089
8934#define GL_PATH_OBJECT_BOUNDING_BOX_NV    0x908A
8935#define GL_CONVEX_HULL_NV                 0x908B
8936#define GL_BOUNDING_BOX_NV                0x908D
8937#define GL_TRANSLATE_X_NV                 0x908E
8938#define GL_TRANSLATE_Y_NV                 0x908F
8939#define GL_TRANSLATE_2D_NV                0x9090
8940#define GL_TRANSLATE_3D_NV                0x9091
8941#define GL_AFFINE_2D_NV                   0x9092
8942#define GL_AFFINE_3D_NV                   0x9094
8943#define GL_TRANSPOSE_AFFINE_2D_NV         0x9096
8944#define GL_TRANSPOSE_AFFINE_3D_NV         0x9098
8945#define GL_UTF8_NV                        0x909A
8946#define GL_UTF16_NV                       0x909B
8947#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C
8948#define GL_PATH_COMMAND_COUNT_NV          0x909D
8949#define GL_PATH_COORD_COUNT_NV            0x909E
8950#define GL_PATH_DASH_ARRAY_COUNT_NV       0x909F
8951#define GL_PATH_COMPUTED_LENGTH_NV        0x90A0
8952#define GL_PATH_FILL_BOUNDING_BOX_NV      0x90A1
8953#define GL_PATH_STROKE_BOUNDING_BOX_NV    0x90A2
8954#define GL_SQUARE_NV                      0x90A3
8955#define GL_ROUND_NV                       0x90A4
8956#define GL_TRIANGULAR_NV                  0x90A5
8957#define GL_BEVEL_NV                       0x90A6
8958#define GL_MITER_REVERT_NV                0x90A7
8959#define GL_MITER_TRUNCATE_NV              0x90A8
8960#define GL_SKIP_MISSING_GLYPH_NV          0x90A9
8961#define GL_USE_MISSING_GLYPH_NV           0x90AA
8962#define GL_PATH_ERROR_POSITION_NV         0x90AB
8963#define GL_PATH_FOG_GEN_MODE_NV           0x90AC
8964#define GL_ACCUM_ADJACENT_PAIRS_NV        0x90AD
8965#define GL_ADJACENT_PAIRS_NV              0x90AE
8966#define GL_FIRST_TO_REST_NV               0x90AF
8967#define GL_PATH_GEN_MODE_NV               0x90B0
8968#define GL_PATH_GEN_COEFF_NV              0x90B1
8969#define GL_PATH_GEN_COLOR_FORMAT_NV       0x90B2
8970#define GL_PATH_GEN_COMPONENTS_NV         0x90B3
8971#define GL_PATH_STENCIL_FUNC_NV           0x90B7
8972#define GL_PATH_STENCIL_REF_NV            0x90B8
8973#define GL_PATH_STENCIL_VALUE_MASK_NV     0x90B9
8974#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD
8975#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE
8976#define GL_PATH_COVER_DEPTH_FUNC_NV       0x90BF
8977#define GL_PATH_DASH_OFFSET_RESET_NV      0x90B4
8978#define GL_MOVE_TO_RESETS_NV              0x90B5
8979#define GL_MOVE_TO_CONTINUES_NV           0x90B6
8980#define GL_CLOSE_PATH_NV                  0x00
8981#define GL_MOVE_TO_NV                     0x02
8982#define GL_RELATIVE_MOVE_TO_NV            0x03
8983#define GL_LINE_TO_NV                     0x04
8984#define GL_RELATIVE_LINE_TO_NV            0x05
8985#define GL_HORIZONTAL_LINE_TO_NV          0x06
8986#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07
8987#define GL_VERTICAL_LINE_TO_NV            0x08
8988#define GL_RELATIVE_VERTICAL_LINE_TO_NV   0x09
8989#define GL_QUADRATIC_CURVE_TO_NV          0x0A
8990#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B
8991#define GL_CUBIC_CURVE_TO_NV              0x0C
8992#define GL_RELATIVE_CUBIC_CURVE_TO_NV     0x0D
8993#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV   0x0E
8994#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F
8995#define GL_SMOOTH_CUBIC_CURVE_TO_NV       0x10
8996#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11
8997#define GL_SMALL_CCW_ARC_TO_NV            0x12
8998#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV   0x13
8999#define GL_SMALL_CW_ARC_TO_NV             0x14
9000#define GL_RELATIVE_SMALL_CW_ARC_TO_NV    0x15
9001#define GL_LARGE_CCW_ARC_TO_NV            0x16
9002#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV   0x17
9003#define GL_LARGE_CW_ARC_TO_NV             0x18
9004#define GL_RELATIVE_LARGE_CW_ARC_TO_NV    0x19
9005#define GL_RESTART_PATH_NV                0xF0
9006#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV    0xF2
9007#define GL_DUP_LAST_CUBIC_CURVE_TO_NV     0xF4
9008#define GL_RECT_NV                        0xF6
9009#define GL_CIRCULAR_CCW_ARC_TO_NV         0xF8
9010#define GL_CIRCULAR_CW_ARC_TO_NV          0xFA
9011#define GL_CIRCULAR_TANGENT_ARC_TO_NV     0xFC
9012#define GL_ARC_TO_NV                      0xFE
9013#define GL_RELATIVE_ARC_TO_NV             0xFF
9014#define GL_BOLD_BIT_NV                    0x01
9015#define GL_ITALIC_BIT_NV                  0x02
9016#define GL_GLYPH_WIDTH_BIT_NV             0x01
9017#define GL_GLYPH_HEIGHT_BIT_NV            0x02
9018#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04
9019#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08
9020#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10
9021#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20
9022#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40
9023#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80
9024#define GL_GLYPH_HAS_KERNING_BIT_NV       0x100
9025#define GL_FONT_X_MIN_BOUNDS_BIT_NV       0x00010000
9026#define GL_FONT_Y_MIN_BOUNDS_BIT_NV       0x00020000
9027#define GL_FONT_X_MAX_BOUNDS_BIT_NV       0x00040000
9028#define GL_FONT_Y_MAX_BOUNDS_BIT_NV       0x00080000
9029#define GL_FONT_UNITS_PER_EM_BIT_NV       0x00100000
9030#define GL_FONT_ASCENDER_BIT_NV           0x00200000
9031#define GL_FONT_DESCENDER_BIT_NV          0x00400000
9032#define GL_FONT_HEIGHT_BIT_NV             0x00800000
9033#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV  0x01000000
9034#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000
9035#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000
9036#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000
9037#define GL_FONT_HAS_KERNING_BIT_NV        0x10000000
9038#define GL_PRIMARY_COLOR_NV               0x852C
9039#define GL_SECONDARY_COLOR_NV             0x852D
9040typedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range);
9041typedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);
9042typedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path);
9043typedef void (APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
9044typedef void (APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
9045typedef void (APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
9046typedef void (APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
9047typedef void (APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString);
9048typedef void (APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
9049typedef void (APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
9050typedef void (APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
9051typedef void (APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);
9052typedef void (APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
9053typedef void (APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
9054typedef void (APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value);
9055typedef void (APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);
9056typedef void (APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value);
9057typedef void (APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);
9058typedef void (APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
9059typedef void (APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);
9060typedef void (APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);
9061typedef void (APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);
9062typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);
9063typedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
9064typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
9065typedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func);
9066typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs);
9067typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs);
9068typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode);
9069typedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);
9070typedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode);
9071typedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
9072typedef void (APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
9073typedef void (APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value);
9074typedef void (APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value);
9075typedef void (APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands);
9076typedef void (APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords);
9077typedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray);
9078typedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
9079typedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
9080typedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
9081typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value);
9082typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value);
9083typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value);
9084typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value);
9085typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);
9086typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);
9087typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);
9088typedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
9089#ifdef GL_GLEXT_PROTOTYPES
9090GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range);
9091GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range);
9092GLAPI GLboolean APIENTRY glIsPathNV (GLuint path);
9093GLAPI void APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
9094GLAPI void APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
9095GLAPI void APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
9096GLAPI void APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
9097GLAPI void APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString);
9098GLAPI void APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
9099GLAPI void APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
9100GLAPI void APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
9101GLAPI void APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath);
9102GLAPI void APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
9103GLAPI void APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
9104GLAPI void APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value);
9105GLAPI void APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value);
9106GLAPI void APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value);
9107GLAPI void APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value);
9108GLAPI void APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
9109GLAPI void APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask);
9110GLAPI void APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units);
9111GLAPI void APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask);
9112GLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask);
9113GLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
9114GLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
9115GLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func);
9116GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs);
9117GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs);
9118GLAPI void APIENTRY glPathFogGenNV (GLenum genMode);
9119GLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode);
9120GLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode);
9121GLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
9122GLAPI void APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
9123GLAPI void APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value);
9124GLAPI void APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value);
9125GLAPI void APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands);
9126GLAPI void APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords);
9127GLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray);
9128GLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
9129GLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
9130GLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
9131GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value);
9132GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value);
9133GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value);
9134GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value);
9135GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y);
9136GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y);
9137GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments);
9138GLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
9139#endif
9140#endif /* GL_NV_path_rendering */
9141
9142#ifndef GL_NV_pixel_data_range
9143#define GL_NV_pixel_data_range 1
9144#define GL_WRITE_PIXEL_DATA_RANGE_NV      0x8878
9145#define GL_READ_PIXEL_DATA_RANGE_NV       0x8879
9146#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A
9147#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B
9148#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C
9149#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D
9150typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, const void *pointer);
9151typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target);
9152#ifdef GL_GLEXT_PROTOTYPES
9153GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, const void *pointer);
9154GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target);
9155#endif
9156#endif /* GL_NV_pixel_data_range */
9157
9158#ifndef GL_NV_point_sprite
9159#define GL_NV_point_sprite 1
9160#define GL_POINT_SPRITE_NV                0x8861
9161#define GL_COORD_REPLACE_NV               0x8862
9162#define GL_POINT_SPRITE_R_MODE_NV         0x8863
9163typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param);
9164typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params);
9165#ifdef GL_GLEXT_PROTOTYPES
9166GLAPI void APIENTRY glPointParameteriNV (GLenum pname, GLint param);
9167GLAPI void APIENTRY glPointParameterivNV (GLenum pname, const GLint *params);
9168#endif
9169#endif /* GL_NV_point_sprite */
9170
9171#ifndef GL_NV_present_video
9172#define GL_NV_present_video 1
9173#define GL_FRAME_NV                       0x8E26
9174#define GL_FIELDS_NV                      0x8E27
9175#define GL_CURRENT_TIME_NV                0x8E28
9176#define GL_NUM_FILL_STREAMS_NV            0x8E29
9177#define GL_PRESENT_TIME_NV                0x8E2A
9178#define GL_PRESENT_DURATION_NV            0x8E2B
9179typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
9180typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
9181typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params);
9182typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params);
9183typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params);
9184typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params);
9185#ifdef GL_GLEXT_PROTOTYPES
9186GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
9187GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
9188GLAPI void APIENTRY glGetVideoivNV (GLuint video_slot, GLenum pname, GLint *params);
9189GLAPI void APIENTRY glGetVideouivNV (GLuint video_slot, GLenum pname, GLuint *params);
9190GLAPI void APIENTRY glGetVideoi64vNV (GLuint video_slot, GLenum pname, GLint64EXT *params);
9191GLAPI void APIENTRY glGetVideoui64vNV (GLuint video_slot, GLenum pname, GLuint64EXT *params);
9192#endif
9193#endif /* GL_NV_present_video */
9194
9195#ifndef GL_NV_primitive_restart
9196#define GL_NV_primitive_restart 1
9197#define GL_PRIMITIVE_RESTART_NV           0x8558
9198#define GL_PRIMITIVE_RESTART_INDEX_NV     0x8559
9199typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void);
9200typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index);
9201#ifdef GL_GLEXT_PROTOTYPES
9202GLAPI void APIENTRY glPrimitiveRestartNV (void);
9203GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index);
9204#endif
9205#endif /* GL_NV_primitive_restart */
9206
9207#ifndef GL_NV_register_combiners
9208#define GL_NV_register_combiners 1
9209#define GL_REGISTER_COMBINERS_NV          0x8522
9210#define GL_VARIABLE_A_NV                  0x8523
9211#define GL_VARIABLE_B_NV                  0x8524
9212#define GL_VARIABLE_C_NV                  0x8525
9213#define GL_VARIABLE_D_NV                  0x8526
9214#define GL_VARIABLE_E_NV                  0x8527
9215#define GL_VARIABLE_F_NV                  0x8528
9216#define GL_VARIABLE_G_NV                  0x8529
9217#define GL_CONSTANT_COLOR0_NV             0x852A
9218#define GL_CONSTANT_COLOR1_NV             0x852B
9219#define GL_SPARE0_NV                      0x852E
9220#define GL_SPARE1_NV                      0x852F
9221#define GL_DISCARD_NV                     0x8530
9222#define GL_E_TIMES_F_NV                   0x8531
9223#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532
9224#define GL_UNSIGNED_IDENTITY_NV           0x8536
9225#define GL_UNSIGNED_INVERT_NV             0x8537
9226#define GL_EXPAND_NORMAL_NV               0x8538
9227#define GL_EXPAND_NEGATE_NV               0x8539
9228#define GL_HALF_BIAS_NORMAL_NV            0x853A
9229#define GL_HALF_BIAS_NEGATE_NV            0x853B
9230#define GL_SIGNED_IDENTITY_NV             0x853C
9231#define GL_SIGNED_NEGATE_NV               0x853D
9232#define GL_SCALE_BY_TWO_NV                0x853E
9233#define GL_SCALE_BY_FOUR_NV               0x853F
9234#define GL_SCALE_BY_ONE_HALF_NV           0x8540
9235#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV   0x8541
9236#define GL_COMBINER_INPUT_NV              0x8542
9237#define GL_COMBINER_MAPPING_NV            0x8543
9238#define GL_COMBINER_COMPONENT_USAGE_NV    0x8544
9239#define GL_COMBINER_AB_DOT_PRODUCT_NV     0x8545
9240#define GL_COMBINER_CD_DOT_PRODUCT_NV     0x8546
9241#define GL_COMBINER_MUX_SUM_NV            0x8547
9242#define GL_COMBINER_SCALE_NV              0x8548
9243#define GL_COMBINER_BIAS_NV               0x8549
9244#define GL_COMBINER_AB_OUTPUT_NV          0x854A
9245#define GL_COMBINER_CD_OUTPUT_NV          0x854B
9246#define GL_COMBINER_SUM_OUTPUT_NV         0x854C
9247#define GL_MAX_GENERAL_COMBINERS_NV       0x854D
9248#define GL_NUM_GENERAL_COMBINERS_NV       0x854E
9249#define GL_COLOR_SUM_CLAMP_NV             0x854F
9250#define GL_COMBINER0_NV                   0x8550
9251#define GL_COMBINER1_NV                   0x8551
9252#define GL_COMBINER2_NV                   0x8552
9253#define GL_COMBINER3_NV                   0x8553
9254#define GL_COMBINER4_NV                   0x8554
9255#define GL_COMBINER5_NV                   0x8555
9256#define GL_COMBINER6_NV                   0x8556
9257#define GL_COMBINER7_NV                   0x8557
9258typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params);
9259typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param);
9260typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params);
9261typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param);
9262typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
9263typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
9264typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
9265typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);
9266typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);
9267typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);
9268typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params);
9269typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params);
9270typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params);
9271#ifdef GL_GLEXT_PROTOTYPES
9272GLAPI void APIENTRY glCombinerParameterfvNV (GLenum pname, const GLfloat *params);
9273GLAPI void APIENTRY glCombinerParameterfNV (GLenum pname, GLfloat param);
9274GLAPI void APIENTRY glCombinerParameterivNV (GLenum pname, const GLint *params);
9275GLAPI void APIENTRY glCombinerParameteriNV (GLenum pname, GLint param);
9276GLAPI void APIENTRY glCombinerInputNV (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
9277GLAPI void APIENTRY glCombinerOutputNV (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
9278GLAPI void APIENTRY glFinalCombinerInputNV (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
9279GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);
9280GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);
9281GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);
9282GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum stage, GLenum portion, GLenum pname, GLint *params);
9283GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum variable, GLenum pname, GLfloat *params);
9284GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum variable, GLenum pname, GLint *params);
9285#endif
9286#endif /* GL_NV_register_combiners */
9287
9288#ifndef GL_NV_register_combiners2
9289#define GL_NV_register_combiners2 1
9290#define GL_PER_STAGE_CONSTANTS_NV         0x8535
9291typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params);
9292typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params);
9293#ifdef GL_GLEXT_PROTOTYPES
9294GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params);
9295GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, GLfloat *params);
9296#endif
9297#endif /* GL_NV_register_combiners2 */
9298
9299#ifndef GL_NV_shader_atomic_counters
9300#define GL_NV_shader_atomic_counters 1
9301#endif /* GL_NV_shader_atomic_counters */
9302
9303#ifndef GL_NV_shader_atomic_float
9304#define GL_NV_shader_atomic_float 1
9305#endif /* GL_NV_shader_atomic_float */
9306
9307#ifndef GL_NV_shader_buffer_load
9308#define GL_NV_shader_buffer_load 1
9309#define GL_BUFFER_GPU_ADDRESS_NV          0x8F1D
9310#define GL_GPU_ADDRESS_NV                 0x8F34
9311#define GL_MAX_SHADER_BUFFER_ADDRESS_NV   0x8F35
9312typedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access);
9313typedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target);
9314typedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target);
9315typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access);
9316typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer);
9317typedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer);
9318typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params);
9319typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params);
9320typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result);
9321typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value);
9322typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
9323typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params);
9324typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value);
9325typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
9326#ifdef GL_GLEXT_PROTOTYPES
9327GLAPI void APIENTRY glMakeBufferResidentNV (GLenum target, GLenum access);
9328GLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum target);
9329GLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum target);
9330GLAPI void APIENTRY glMakeNamedBufferResidentNV (GLuint buffer, GLenum access);
9331GLAPI void APIENTRY glMakeNamedBufferNonResidentNV (GLuint buffer);
9332GLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint buffer);
9333GLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum target, GLenum pname, GLuint64EXT *params);
9334GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pname, GLuint64EXT *params);
9335GLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result);
9336GLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value);
9337GLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
9338GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params);
9339GLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value);
9340GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
9341#endif
9342#endif /* GL_NV_shader_buffer_load */
9343
9344#ifndef GL_NV_shader_buffer_store
9345#define GL_NV_shader_buffer_store 1
9346#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010
9347#endif /* GL_NV_shader_buffer_store */
9348
9349#ifndef GL_NV_shader_storage_buffer_object
9350#define GL_NV_shader_storage_buffer_object 1
9351#endif /* GL_NV_shader_storage_buffer_object */
9352
9353#ifndef GL_NV_tessellation_program5
9354#define GL_NV_tessellation_program5 1
9355#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV   0x86D8
9356#define GL_TESS_CONTROL_PROGRAM_NV        0x891E
9357#define GL_TESS_EVALUATION_PROGRAM_NV     0x891F
9358#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74
9359#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75
9360#endif /* GL_NV_tessellation_program5 */
9361
9362#ifndef GL_NV_texgen_emboss
9363#define GL_NV_texgen_emboss 1
9364#define GL_EMBOSS_LIGHT_NV                0x855D
9365#define GL_EMBOSS_CONSTANT_NV             0x855E
9366#define GL_EMBOSS_MAP_NV                  0x855F
9367#endif /* GL_NV_texgen_emboss */
9368
9369#ifndef GL_NV_texgen_reflection
9370#define GL_NV_texgen_reflection 1
9371#define GL_NORMAL_MAP_NV                  0x8511
9372#define GL_REFLECTION_MAP_NV              0x8512
9373#endif /* GL_NV_texgen_reflection */
9374
9375#ifndef GL_NV_texture_barrier
9376#define GL_NV_texture_barrier 1
9377typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void);
9378#ifdef GL_GLEXT_PROTOTYPES
9379GLAPI void APIENTRY glTextureBarrierNV (void);
9380#endif
9381#endif /* GL_NV_texture_barrier */
9382
9383#ifndef GL_NV_texture_compression_vtc
9384#define GL_NV_texture_compression_vtc 1
9385#endif /* GL_NV_texture_compression_vtc */
9386
9387#ifndef GL_NV_texture_env_combine4
9388#define GL_NV_texture_env_combine4 1
9389#define GL_COMBINE4_NV                    0x8503
9390#define GL_SOURCE3_RGB_NV                 0x8583
9391#define GL_SOURCE3_ALPHA_NV               0x858B
9392#define GL_OPERAND3_RGB_NV                0x8593
9393#define GL_OPERAND3_ALPHA_NV              0x859B
9394#endif /* GL_NV_texture_env_combine4 */
9395
9396#ifndef GL_NV_texture_expand_normal
9397#define GL_NV_texture_expand_normal 1
9398#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F
9399#endif /* GL_NV_texture_expand_normal */
9400
9401#ifndef GL_NV_texture_multisample
9402#define GL_NV_texture_multisample 1
9403#define GL_TEXTURE_COVERAGE_SAMPLES_NV    0x9045
9404#define GL_TEXTURE_COLOR_SAMPLES_NV       0x9046
9405typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
9406typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
9407typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
9408typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
9409typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
9410typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
9411#ifdef GL_GLEXT_PROTOTYPES
9412GLAPI void APIENTRY glTexImage2DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
9413GLAPI void APIENTRY glTexImage3DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
9414GLAPI void APIENTRY glTextureImage2DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
9415GLAPI void APIENTRY glTextureImage3DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
9416GLAPI void APIENTRY glTextureImage2DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
9417GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
9418#endif
9419#endif /* GL_NV_texture_multisample */
9420
9421#ifndef GL_NV_texture_rectangle
9422#define GL_NV_texture_rectangle 1
9423#define GL_TEXTURE_RECTANGLE_NV           0x84F5
9424#define GL_TEXTURE_BINDING_RECTANGLE_NV   0x84F6
9425#define GL_PROXY_TEXTURE_RECTANGLE_NV     0x84F7
9426#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV  0x84F8
9427#endif /* GL_NV_texture_rectangle */
9428
9429#ifndef GL_NV_texture_shader
9430#define GL_NV_texture_shader 1
9431#define GL_OFFSET_TEXTURE_RECTANGLE_NV    0x864C
9432#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D
9433#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E
9434#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9
9435#define GL_UNSIGNED_INT_S8_S8_8_8_NV      0x86DA
9436#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV  0x86DB
9437#define GL_DSDT_MAG_INTENSITY_NV          0x86DC
9438#define GL_SHADER_CONSISTENT_NV           0x86DD
9439#define GL_TEXTURE_SHADER_NV              0x86DE
9440#define GL_SHADER_OPERATION_NV            0x86DF
9441#define GL_CULL_MODES_NV                  0x86E0
9442#define GL_OFFSET_TEXTURE_MATRIX_NV       0x86E1
9443#define GL_OFFSET_TEXTURE_SCALE_NV        0x86E2
9444#define GL_OFFSET_TEXTURE_BIAS_NV         0x86E3
9445#define GL_OFFSET_TEXTURE_2D_MATRIX_NV    0x86E1
9446#define GL_OFFSET_TEXTURE_2D_SCALE_NV     0x86E2
9447#define GL_OFFSET_TEXTURE_2D_BIAS_NV      0x86E3
9448#define GL_PREVIOUS_TEXTURE_INPUT_NV      0x86E4
9449#define GL_CONST_EYE_NV                   0x86E5
9450#define GL_PASS_THROUGH_NV                0x86E6
9451#define GL_CULL_FRAGMENT_NV               0x86E7
9452#define GL_OFFSET_TEXTURE_2D_NV           0x86E8
9453#define GL_DEPENDENT_AR_TEXTURE_2D_NV     0x86E9
9454#define GL_DEPENDENT_GB_TEXTURE_2D_NV     0x86EA
9455#define GL_DOT_PRODUCT_NV                 0x86EC
9456#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV   0x86ED
9457#define GL_DOT_PRODUCT_TEXTURE_2D_NV      0x86EE
9458#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0
9459#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1
9460#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2
9461#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3
9462#define GL_HILO_NV                        0x86F4
9463#define GL_DSDT_NV                        0x86F5
9464#define GL_DSDT_MAG_NV                    0x86F6
9465#define GL_DSDT_MAG_VIB_NV                0x86F7
9466#define GL_HILO16_NV                      0x86F8
9467#define GL_SIGNED_HILO_NV                 0x86F9
9468#define GL_SIGNED_HILO16_NV               0x86FA
9469#define GL_SIGNED_RGBA_NV                 0x86FB
9470#define GL_SIGNED_RGBA8_NV                0x86FC
9471#define GL_SIGNED_RGB_NV                  0x86FE
9472#define GL_SIGNED_RGB8_NV                 0x86FF
9473#define GL_SIGNED_LUMINANCE_NV            0x8701
9474#define GL_SIGNED_LUMINANCE8_NV           0x8702
9475#define GL_SIGNED_LUMINANCE_ALPHA_NV      0x8703
9476#define GL_SIGNED_LUMINANCE8_ALPHA8_NV    0x8704
9477#define GL_SIGNED_ALPHA_NV                0x8705
9478#define GL_SIGNED_ALPHA8_NV               0x8706
9479#define GL_SIGNED_INTENSITY_NV            0x8707
9480#define GL_SIGNED_INTENSITY8_NV           0x8708
9481#define GL_DSDT8_NV                       0x8709
9482#define GL_DSDT8_MAG8_NV                  0x870A
9483#define GL_DSDT8_MAG8_INTENSITY8_NV       0x870B
9484#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV   0x870C
9485#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D
9486#define GL_HI_SCALE_NV                    0x870E
9487#define GL_LO_SCALE_NV                    0x870F
9488#define GL_DS_SCALE_NV                    0x8710
9489#define GL_DT_SCALE_NV                    0x8711
9490#define GL_MAGNITUDE_SCALE_NV             0x8712
9491#define GL_VIBRANCE_SCALE_NV              0x8713
9492#define GL_HI_BIAS_NV                     0x8714
9493#define GL_LO_BIAS_NV                     0x8715
9494#define GL_DS_BIAS_NV                     0x8716
9495#define GL_DT_BIAS_NV                     0x8717
9496#define GL_MAGNITUDE_BIAS_NV              0x8718
9497#define GL_VIBRANCE_BIAS_NV               0x8719
9498#define GL_TEXTURE_BORDER_VALUES_NV       0x871A
9499#define GL_TEXTURE_HI_SIZE_NV             0x871B
9500#define GL_TEXTURE_LO_SIZE_NV             0x871C
9501#define GL_TEXTURE_DS_SIZE_NV             0x871D
9502#define GL_TEXTURE_DT_SIZE_NV             0x871E
9503#define GL_TEXTURE_MAG_SIZE_NV            0x871F
9504#endif /* GL_NV_texture_shader */
9505
9506#ifndef GL_NV_texture_shader2
9507#define GL_NV_texture_shader2 1
9508#define GL_DOT_PRODUCT_TEXTURE_3D_NV      0x86EF
9509#endif /* GL_NV_texture_shader2 */
9510
9511#ifndef GL_NV_texture_shader3
9512#define GL_NV_texture_shader3 1
9513#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850
9514#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851
9515#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852
9516#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853
9517#define GL_OFFSET_HILO_TEXTURE_2D_NV      0x8854
9518#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855
9519#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856
9520#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857
9521#define GL_DEPENDENT_HILO_TEXTURE_2D_NV   0x8858
9522#define GL_DEPENDENT_RGB_TEXTURE_3D_NV    0x8859
9523#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A
9524#define GL_DOT_PRODUCT_PASS_THROUGH_NV    0x885B
9525#define GL_DOT_PRODUCT_TEXTURE_1D_NV      0x885C
9526#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D
9527#define GL_HILO8_NV                       0x885E
9528#define GL_SIGNED_HILO8_NV                0x885F
9529#define GL_FORCE_BLUE_TO_ONE_NV           0x8860
9530#endif /* GL_NV_texture_shader3 */
9531
9532#ifndef GL_NV_transform_feedback
9533#define GL_NV_transform_feedback 1
9534#define GL_BACK_PRIMARY_COLOR_NV          0x8C77
9535#define GL_BACK_SECONDARY_COLOR_NV        0x8C78
9536#define GL_TEXTURE_COORD_NV               0x8C79
9537#define GL_CLIP_DISTANCE_NV               0x8C7A
9538#define GL_VERTEX_ID_NV                   0x8C7B
9539#define GL_PRIMITIVE_ID_NV                0x8C7C
9540#define GL_GENERIC_ATTRIB_NV              0x8C7D
9541#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV  0x8C7E
9542#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F
9543#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80
9544#define GL_ACTIVE_VARYINGS_NV             0x8C81
9545#define GL_ACTIVE_VARYING_MAX_LENGTH_NV   0x8C82
9546#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83
9547#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84
9548#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85
9549#define GL_TRANSFORM_FEEDBACK_RECORD_NV   0x8C86
9550#define GL_PRIMITIVES_GENERATED_NV        0x8C87
9551#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88
9552#define GL_RASTERIZER_DISCARD_NV          0x8C89
9553#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A
9554#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B
9555#define GL_INTERLEAVED_ATTRIBS_NV         0x8C8C
9556#define GL_SEPARATE_ATTRIBS_NV            0x8C8D
9557#define GL_TRANSFORM_FEEDBACK_BUFFER_NV   0x8C8E
9558#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F
9559#define GL_LAYER_NV                       0x8DAA
9560#define GL_NEXT_BUFFER_NV                 -2
9561#define GL_SKIP_COMPONENTS4_NV            -3
9562#define GL_SKIP_COMPONENTS3_NV            -4
9563#define GL_SKIP_COMPONENTS2_NV            -5
9564#define GL_SKIP_COMPONENTS1_NV            -6
9565typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode);
9566typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void);
9567typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLuint count, const GLint *attribs, GLenum bufferMode);
9568typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
9569typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
9570typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer);
9571typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
9572typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name);
9573typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name);
9574typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
9575typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location);
9576typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode);
9577#ifdef GL_GLEXT_PROTOTYPES
9578GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode);
9579GLAPI void APIENTRY glEndTransformFeedbackNV (void);
9580GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLuint count, const GLint *attribs, GLenum bufferMode);
9581GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
9582GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
9583GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer);
9584GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
9585GLAPI void APIENTRY glActiveVaryingNV (GLuint program, const GLchar *name);
9586GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint program, const GLchar *name);
9587GLAPI void APIENTRY glGetActiveVaryingNV (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
9588GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint program, GLuint index, GLint *location);
9589GLAPI void APIENTRY glTransformFeedbackStreamAttribsNV (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode);
9590#endif
9591#endif /* GL_NV_transform_feedback */
9592
9593#ifndef GL_NV_transform_feedback2
9594#define GL_NV_transform_feedback2 1
9595#define GL_TRANSFORM_FEEDBACK_NV          0x8E22
9596#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23
9597#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24
9598#define GL_TRANSFORM_FEEDBACK_BINDING_NV  0x8E25
9599typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id);
9600typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids);
9601typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids);
9602typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id);
9603typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void);
9604typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void);
9605typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id);
9606#ifdef GL_GLEXT_PROTOTYPES
9607GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum target, GLuint id);
9608GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei n, const GLuint *ids);
9609GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei n, GLuint *ids);
9610GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint id);
9611GLAPI void APIENTRY glPauseTransformFeedbackNV (void);
9612GLAPI void APIENTRY glResumeTransformFeedbackNV (void);
9613GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id);
9614#endif
9615#endif /* GL_NV_transform_feedback2 */
9616
9617#ifndef GL_NV_vdpau_interop
9618#define GL_NV_vdpau_interop 1
9619typedef GLintptr GLvdpauSurfaceNV;
9620#define GL_SURFACE_STATE_NV               0x86EB
9621#define GL_SURFACE_REGISTERED_NV          0x86FD
9622#define GL_SURFACE_MAPPED_NV              0x8700
9623#define GL_WRITE_DISCARD_NV               0x88BE
9624typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const void *vdpDevice, const void *getProcAddress);
9625typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void);
9626typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
9627typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
9628typedef void (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface);
9629typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface);
9630typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
9631typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access);
9632typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces);
9633typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);
9634#ifdef GL_GLEXT_PROTOTYPES
9635GLAPI void APIENTRY glVDPAUInitNV (const void *vdpDevice, const void *getProcAddress);
9636GLAPI void APIENTRY glVDPAUFiniNV (void);
9637GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
9638GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
9639GLAPI void APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface);
9640GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface);
9641GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
9642GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access);
9643GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces);
9644GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);
9645#endif
9646#endif /* GL_NV_vdpau_interop */
9647
9648#ifndef GL_NV_vertex_array_range
9649#define GL_NV_vertex_array_range 1
9650#define GL_VERTEX_ARRAY_RANGE_NV          0x851D
9651#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV   0x851E
9652#define GL_VERTEX_ARRAY_RANGE_VALID_NV    0x851F
9653#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520
9654#define GL_VERTEX_ARRAY_RANGE_POINTER_NV  0x8521
9655typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);
9656typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const void *pointer);
9657#ifdef GL_GLEXT_PROTOTYPES
9658GLAPI void APIENTRY glFlushVertexArrayRangeNV (void);
9659GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei length, const void *pointer);
9660#endif
9661#endif /* GL_NV_vertex_array_range */
9662
9663#ifndef GL_NV_vertex_array_range2
9664#define GL_NV_vertex_array_range2 1
9665#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533
9666#endif /* GL_NV_vertex_array_range2 */
9667
9668#ifndef GL_NV_vertex_attrib_integer_64bit
9669#define GL_NV_vertex_attrib_integer_64bit 1
9670typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x);
9671typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y);
9672typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);
9673typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
9674typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v);
9675typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v);
9676typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v);
9677typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v);
9678typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x);
9679typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y);
9680typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
9681typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
9682typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
9683typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
9684typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
9685typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
9686typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params);
9687typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params);
9688typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
9689#ifdef GL_GLEXT_PROTOTYPES
9690GLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x);
9691GLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y);
9692GLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);
9693GLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
9694GLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v);
9695GLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v);
9696GLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v);
9697GLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v);
9698GLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x);
9699GLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y);
9700GLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
9701GLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
9702GLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v);
9703GLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v);
9704GLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v);
9705GLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v);
9706GLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params);
9707GLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params);
9708GLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);
9709#endif
9710#endif /* GL_NV_vertex_attrib_integer_64bit */
9711
9712#ifndef GL_NV_vertex_buffer_unified_memory
9713#define GL_NV_vertex_buffer_unified_memory 1
9714#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E
9715#define GL_ELEMENT_ARRAY_UNIFIED_NV       0x8F1F
9716#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20
9717#define GL_VERTEX_ARRAY_ADDRESS_NV        0x8F21
9718#define GL_NORMAL_ARRAY_ADDRESS_NV        0x8F22
9719#define GL_COLOR_ARRAY_ADDRESS_NV         0x8F23
9720#define GL_INDEX_ARRAY_ADDRESS_NV         0x8F24
9721#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25
9722#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV     0x8F26
9723#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27
9724#define GL_FOG_COORD_ARRAY_ADDRESS_NV     0x8F28
9725#define GL_ELEMENT_ARRAY_ADDRESS_NV       0x8F29
9726#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV  0x8F2A
9727#define GL_VERTEX_ARRAY_LENGTH_NV         0x8F2B
9728#define GL_NORMAL_ARRAY_LENGTH_NV         0x8F2C
9729#define GL_COLOR_ARRAY_LENGTH_NV          0x8F2D
9730#define GL_INDEX_ARRAY_LENGTH_NV          0x8F2E
9731#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV  0x8F2F
9732#define GL_EDGE_FLAG_ARRAY_LENGTH_NV      0x8F30
9733#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31
9734#define GL_FOG_COORD_ARRAY_LENGTH_NV      0x8F32
9735#define GL_ELEMENT_ARRAY_LENGTH_NV        0x8F33
9736#define GL_DRAW_INDIRECT_UNIFIED_NV       0x8F40
9737#define GL_DRAW_INDIRECT_ADDRESS_NV       0x8F41
9738#define GL_DRAW_INDIRECT_LENGTH_NV        0x8F42
9739typedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
9740typedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
9741typedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride);
9742typedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
9743typedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride);
9744typedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
9745typedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride);
9746typedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
9747typedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride);
9748typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
9749typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
9750typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result);
9751#ifdef GL_GLEXT_PROTOTYPES
9752GLAPI void APIENTRY glBufferAddressRangeNV (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
9753GLAPI void APIENTRY glVertexFormatNV (GLint size, GLenum type, GLsizei stride);
9754GLAPI void APIENTRY glNormalFormatNV (GLenum type, GLsizei stride);
9755GLAPI void APIENTRY glColorFormatNV (GLint size, GLenum type, GLsizei stride);
9756GLAPI void APIENTRY glIndexFormatNV (GLenum type, GLsizei stride);
9757GLAPI void APIENTRY glTexCoordFormatNV (GLint size, GLenum type, GLsizei stride);
9758GLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei stride);
9759GLAPI void APIENTRY glSecondaryColorFormatNV (GLint size, GLenum type, GLsizei stride);
9760GLAPI void APIENTRY glFogCoordFormatNV (GLenum type, GLsizei stride);
9761GLAPI void APIENTRY glVertexAttribFormatNV (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
9762GLAPI void APIENTRY glVertexAttribIFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);
9763GLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum value, GLuint index, GLuint64EXT *result);
9764#endif
9765#endif /* GL_NV_vertex_buffer_unified_memory */
9766
9767#ifndef GL_NV_vertex_program
9768#define GL_NV_vertex_program 1
9769#define GL_VERTEX_PROGRAM_NV              0x8620
9770#define GL_VERTEX_STATE_PROGRAM_NV        0x8621
9771#define GL_ATTRIB_ARRAY_SIZE_NV           0x8623
9772#define GL_ATTRIB_ARRAY_STRIDE_NV         0x8624
9773#define GL_ATTRIB_ARRAY_TYPE_NV           0x8625
9774#define GL_CURRENT_ATTRIB_NV              0x8626
9775#define GL_PROGRAM_LENGTH_NV              0x8627
9776#define GL_PROGRAM_STRING_NV              0x8628
9777#define GL_MODELVIEW_PROJECTION_NV        0x8629
9778#define GL_IDENTITY_NV                    0x862A
9779#define GL_INVERSE_NV                     0x862B
9780#define GL_TRANSPOSE_NV                   0x862C
9781#define GL_INVERSE_TRANSPOSE_NV           0x862D
9782#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E
9783#define GL_MAX_TRACK_MATRICES_NV          0x862F
9784#define GL_MATRIX0_NV                     0x8630
9785#define GL_MATRIX1_NV                     0x8631
9786#define GL_MATRIX2_NV                     0x8632
9787#define GL_MATRIX3_NV                     0x8633
9788#define GL_MATRIX4_NV                     0x8634
9789#define GL_MATRIX5_NV                     0x8635
9790#define GL_MATRIX6_NV                     0x8636
9791#define GL_MATRIX7_NV                     0x8637
9792#define GL_CURRENT_MATRIX_STACK_DEPTH_NV  0x8640
9793#define GL_CURRENT_MATRIX_NV              0x8641
9794#define GL_VERTEX_PROGRAM_POINT_SIZE_NV   0x8642
9795#define GL_VERTEX_PROGRAM_TWO_SIDE_NV     0x8643
9796#define GL_PROGRAM_PARAMETER_NV           0x8644
9797#define GL_ATTRIB_ARRAY_POINTER_NV        0x8645
9798#define GL_PROGRAM_TARGET_NV              0x8646
9799#define GL_PROGRAM_RESIDENT_NV            0x8647
9800#define GL_TRACK_MATRIX_NV                0x8648
9801#define GL_TRACK_MATRIX_TRANSFORM_NV      0x8649
9802#define GL_VERTEX_PROGRAM_BINDING_NV      0x864A
9803#define GL_PROGRAM_ERROR_POSITION_NV      0x864B
9804#define GL_VERTEX_ATTRIB_ARRAY0_NV        0x8650
9805#define GL_VERTEX_ATTRIB_ARRAY1_NV        0x8651
9806#define GL_VERTEX_ATTRIB_ARRAY2_NV        0x8652
9807#define GL_VERTEX_ATTRIB_ARRAY3_NV        0x8653
9808#define GL_VERTEX_ATTRIB_ARRAY4_NV        0x8654
9809#define GL_VERTEX_ATTRIB_ARRAY5_NV        0x8655
9810#define GL_VERTEX_ATTRIB_ARRAY6_NV        0x8656
9811#define GL_VERTEX_ATTRIB_ARRAY7_NV        0x8657
9812#define GL_VERTEX_ATTRIB_ARRAY8_NV        0x8658
9813#define GL_VERTEX_ATTRIB_ARRAY9_NV        0x8659
9814#define GL_VERTEX_ATTRIB_ARRAY10_NV       0x865A
9815#define GL_VERTEX_ATTRIB_ARRAY11_NV       0x865B
9816#define GL_VERTEX_ATTRIB_ARRAY12_NV       0x865C
9817#define GL_VERTEX_ATTRIB_ARRAY13_NV       0x865D
9818#define GL_VERTEX_ATTRIB_ARRAY14_NV       0x865E
9819#define GL_VERTEX_ATTRIB_ARRAY15_NV       0x865F
9820#define GL_MAP1_VERTEX_ATTRIB0_4_NV       0x8660
9821#define GL_MAP1_VERTEX_ATTRIB1_4_NV       0x8661
9822#define GL_MAP1_VERTEX_ATTRIB2_4_NV       0x8662
9823#define GL_MAP1_VERTEX_ATTRIB3_4_NV       0x8663
9824#define GL_MAP1_VERTEX_ATTRIB4_4_NV       0x8664
9825#define GL_MAP1_VERTEX_ATTRIB5_4_NV       0x8665
9826#define GL_MAP1_VERTEX_ATTRIB6_4_NV       0x8666
9827#define GL_MAP1_VERTEX_ATTRIB7_4_NV       0x8667
9828#define GL_MAP1_VERTEX_ATTRIB8_4_NV       0x8668
9829#define GL_MAP1_VERTEX_ATTRIB9_4_NV       0x8669
9830#define GL_MAP1_VERTEX_ATTRIB10_4_NV      0x866A
9831#define GL_MAP1_VERTEX_ATTRIB11_4_NV      0x866B
9832#define GL_MAP1_VERTEX_ATTRIB12_4_NV      0x866C
9833#define GL_MAP1_VERTEX_ATTRIB13_4_NV      0x866D
9834#define GL_MAP1_VERTEX_ATTRIB14_4_NV      0x866E
9835#define GL_MAP1_VERTEX_ATTRIB15_4_NV      0x866F
9836#define GL_MAP2_VERTEX_ATTRIB0_4_NV       0x8670
9837#define GL_MAP2_VERTEX_ATTRIB1_4_NV       0x8671
9838#define GL_MAP2_VERTEX_ATTRIB2_4_NV       0x8672
9839#define GL_MAP2_VERTEX_ATTRIB3_4_NV       0x8673
9840#define GL_MAP2_VERTEX_ATTRIB4_4_NV       0x8674
9841#define GL_MAP2_VERTEX_ATTRIB5_4_NV       0x8675
9842#define GL_MAP2_VERTEX_ATTRIB6_4_NV       0x8676
9843#define GL_MAP2_VERTEX_ATTRIB7_4_NV       0x8677
9844#define GL_MAP2_VERTEX_ATTRIB8_4_NV       0x8678
9845#define GL_MAP2_VERTEX_ATTRIB9_4_NV       0x8679
9846#define GL_MAP2_VERTEX_ATTRIB10_4_NV      0x867A
9847#define GL_MAP2_VERTEX_ATTRIB11_4_NV      0x867B
9848#define GL_MAP2_VERTEX_ATTRIB12_4_NV      0x867C
9849#define GL_MAP2_VERTEX_ATTRIB13_4_NV      0x867D
9850#define GL_MAP2_VERTEX_ATTRIB14_4_NV      0x867E
9851#define GL_MAP2_VERTEX_ATTRIB15_4_NV      0x867F
9852typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences);
9853typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);
9854typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
9855typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params);
9856typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs);
9857typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params);
9858typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
9859typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params);
9860typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program);
9861typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params);
9862typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params);
9863typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params);
9864typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params);
9865typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, void **pointer);
9866typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id);
9867typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
9868typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
9869typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v);
9870typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
9871typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v);
9872typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
9873typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
9874typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
9875typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);
9876typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const void *pointer);
9877typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x);
9878typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v);
9879typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x);
9880typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v);
9881typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x);
9882typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v);
9883typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y);
9884typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v);
9885typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y);
9886typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v);
9887typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y);
9888typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v);
9889typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
9890typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v);
9891typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
9892typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v);
9893typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
9894typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v);
9895typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
9896typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v);
9897typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
9898typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v);
9899typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
9900typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v);
9901typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
9902typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v);
9903typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
9904typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
9905typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
9906typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
9907typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
9908typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
9909typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
9910typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
9911typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
9912typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
9913typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
9914typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
9915typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v);
9916#ifdef GL_GLEXT_PROTOTYPES
9917GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei n, const GLuint *programs, GLboolean *residences);
9918GLAPI void APIENTRY glBindProgramNV (GLenum target, GLuint id);
9919GLAPI void APIENTRY glDeleteProgramsNV (GLsizei n, const GLuint *programs);
9920GLAPI void APIENTRY glExecuteProgramNV (GLenum target, GLuint id, const GLfloat *params);
9921GLAPI void APIENTRY glGenProgramsNV (GLsizei n, GLuint *programs);
9922GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum target, GLuint index, GLenum pname, GLdouble *params);
9923GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params);
9924GLAPI void APIENTRY glGetProgramivNV (GLuint id, GLenum pname, GLint *params);
9925GLAPI void APIENTRY glGetProgramStringNV (GLuint id, GLenum pname, GLubyte *program);
9926GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum target, GLuint address, GLenum pname, GLint *params);
9927GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint index, GLenum pname, GLdouble *params);
9928GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint index, GLenum pname, GLfloat *params);
9929GLAPI void APIENTRY glGetVertexAttribivNV (GLuint index, GLenum pname, GLint *params);
9930GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint index, GLenum pname, void **pointer);
9931GLAPI GLboolean APIENTRY glIsProgramNV (GLuint id);
9932GLAPI void APIENTRY glLoadProgramNV (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
9933GLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
9934GLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v);
9935GLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
9936GLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v);
9937GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
9938GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
9939GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs);
9940GLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform);
9941GLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const void *pointer);
9942GLAPI void APIENTRY glVertexAttrib1dNV (GLuint index, GLdouble x);
9943GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint index, const GLdouble *v);
9944GLAPI void APIENTRY glVertexAttrib1fNV (GLuint index, GLfloat x);
9945GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint index, const GLfloat *v);
9946GLAPI void APIENTRY glVertexAttrib1sNV (GLuint index, GLshort x);
9947GLAPI void APIENTRY glVertexAttrib1svNV (GLuint index, const GLshort *v);
9948GLAPI void APIENTRY glVertexAttrib2dNV (GLuint index, GLdouble x, GLdouble y);
9949GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint index, const GLdouble *v);
9950GLAPI void APIENTRY glVertexAttrib2fNV (GLuint index, GLfloat x, GLfloat y);
9951GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint index, const GLfloat *v);
9952GLAPI void APIENTRY glVertexAttrib2sNV (GLuint index, GLshort x, GLshort y);
9953GLAPI void APIENTRY glVertexAttrib2svNV (GLuint index, const GLshort *v);
9954GLAPI void APIENTRY glVertexAttrib3dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z);
9955GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint index, const GLdouble *v);
9956GLAPI void APIENTRY glVertexAttrib3fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z);
9957GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint index, const GLfloat *v);
9958GLAPI void APIENTRY glVertexAttrib3sNV (GLuint index, GLshort x, GLshort y, GLshort z);
9959GLAPI void APIENTRY glVertexAttrib3svNV (GLuint index, const GLshort *v);
9960GLAPI void APIENTRY glVertexAttrib4dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
9961GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint index, const GLdouble *v);
9962GLAPI void APIENTRY glVertexAttrib4fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
9963GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint index, const GLfloat *v);
9964GLAPI void APIENTRY glVertexAttrib4sNV (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
9965GLAPI void APIENTRY glVertexAttrib4svNV (GLuint index, const GLshort *v);
9966GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
9967GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint index, const GLubyte *v);
9968GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint index, GLsizei count, const GLdouble *v);
9969GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint index, GLsizei count, const GLfloat *v);
9970GLAPI void APIENTRY glVertexAttribs1svNV (GLuint index, GLsizei count, const GLshort *v);
9971GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint index, GLsizei count, const GLdouble *v);
9972GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint index, GLsizei count, const GLfloat *v);
9973GLAPI void APIENTRY glVertexAttribs2svNV (GLuint index, GLsizei count, const GLshort *v);
9974GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint index, GLsizei count, const GLdouble *v);
9975GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint index, GLsizei count, const GLfloat *v);
9976GLAPI void APIENTRY glVertexAttribs3svNV (GLuint index, GLsizei count, const GLshort *v);
9977GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint index, GLsizei count, const GLdouble *v);
9978GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint index, GLsizei count, const GLfloat *v);
9979GLAPI void APIENTRY glVertexAttribs4svNV (GLuint index, GLsizei count, const GLshort *v);
9980GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GLubyte *v);
9981#endif
9982#endif /* GL_NV_vertex_program */
9983
9984#ifndef GL_NV_vertex_program1_1
9985#define GL_NV_vertex_program1_1 1
9986#endif /* GL_NV_vertex_program1_1 */
9987
9988#ifndef GL_NV_vertex_program2
9989#define GL_NV_vertex_program2 1
9990#endif /* GL_NV_vertex_program2 */
9991
9992#ifndef GL_NV_vertex_program2_option
9993#define GL_NV_vertex_program2_option 1
9994#endif /* GL_NV_vertex_program2_option */
9995
9996#ifndef GL_NV_vertex_program3
9997#define GL_NV_vertex_program3 1
9998#endif /* GL_NV_vertex_program3 */
9999
10000#ifndef GL_NV_vertex_program4
10001#define GL_NV_vertex_program4 1
10002#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD
10003typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);
10004typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);
10005typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z);
10006typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
10007typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x);
10008typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y);
10009typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
10010typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
10011typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v);
10012typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v);
10013typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v);
10014typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v);
10015typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v);
10016typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v);
10017typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v);
10018typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v);
10019typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v);
10020typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v);
10021typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v);
10022typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v);
10023typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
10024typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params);
10025typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params);
10026#ifdef GL_GLEXT_PROTOTYPES
10027GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x);
10028GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y);
10029GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z);
10030GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w);
10031GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x);
10032GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y);
10033GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z);
10034GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
10035GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v);
10036GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v);
10037GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v);
10038GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v);
10039GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v);
10040GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v);
10041GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v);
10042GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v);
10043GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v);
10044GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v);
10045GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v);
10046GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v);
10047GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
10048GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params);
10049GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params);
10050#endif
10051#endif /* GL_NV_vertex_program4 */
10052
10053#ifndef GL_NV_video_capture
10054#define GL_NV_video_capture 1
10055#define GL_VIDEO_BUFFER_NV                0x9020
10056#define GL_VIDEO_BUFFER_BINDING_NV        0x9021
10057#define GL_FIELD_UPPER_NV                 0x9022
10058#define GL_FIELD_LOWER_NV                 0x9023
10059#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV   0x9024
10060#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025
10061#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026
10062#define GL_LAST_VIDEO_CAPTURE_STATUS_NV   0x9027
10063#define GL_VIDEO_BUFFER_PITCH_NV          0x9028
10064#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029
10065#define GL_VIDEO_COLOR_CONVERSION_MAX_NV  0x902A
10066#define GL_VIDEO_COLOR_CONVERSION_MIN_NV  0x902B
10067#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C
10068#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D
10069#define GL_PARTIAL_SUCCESS_NV             0x902E
10070#define GL_SUCCESS_NV                     0x902F
10071#define GL_FAILURE_NV                     0x9030
10072#define GL_YCBYCR8_422_NV                 0x9031
10073#define GL_YCBAYCR8A_4224_NV              0x9032
10074#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV  0x9033
10075#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034
10076#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV  0x9035
10077#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036
10078#define GL_Z4Y12Z4CB12Z4CR12_444_NV       0x9037
10079#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV   0x9038
10080#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV  0x9039
10081#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A
10082#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B
10083#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C
10084typedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
10085typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);
10086typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);
10087typedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
10088typedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params);
10089typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params);
10090typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params);
10091typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params);
10092typedef GLenum (APIENTRYP PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time);
10093typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params);
10094typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);
10095typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);
10096#ifdef GL_GLEXT_PROTOTYPES
10097GLAPI void APIENTRY glBeginVideoCaptureNV (GLuint video_capture_slot);
10098GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);
10099GLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);
10100GLAPI void APIENTRY glEndVideoCaptureNV (GLuint video_capture_slot);
10101GLAPI void APIENTRY glGetVideoCaptureivNV (GLuint video_capture_slot, GLenum pname, GLint *params);
10102GLAPI void APIENTRY glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params);
10103GLAPI void APIENTRY glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params);
10104GLAPI void APIENTRY glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params);
10105GLAPI GLenum APIENTRY glVideoCaptureNV (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time);
10106GLAPI void APIENTRY glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params);
10107GLAPI void APIENTRY glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);
10108GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);
10109#endif
10110#endif /* GL_NV_video_capture */
10111
10112#ifndef GL_OML_interlace
10113#define GL_OML_interlace 1
10114#define GL_INTERLACE_OML                  0x8980
10115#define GL_INTERLACE_READ_OML             0x8981
10116#endif /* GL_OML_interlace */
10117
10118#ifndef GL_OML_resample
10119#define GL_OML_resample 1
10120#define GL_PACK_RESAMPLE_OML              0x8984
10121#define GL_UNPACK_RESAMPLE_OML            0x8985
10122#define GL_RESAMPLE_REPLICATE_OML         0x8986
10123#define GL_RESAMPLE_ZERO_FILL_OML         0x8987
10124#define GL_RESAMPLE_AVERAGE_OML           0x8988
10125#define GL_RESAMPLE_DECIMATE_OML          0x8989
10126#endif /* GL_OML_resample */
10127
10128#ifndef GL_OML_subsample
10129#define GL_OML_subsample 1
10130#define GL_FORMAT_SUBSAMPLE_24_24_OML     0x8982
10131#define GL_FORMAT_SUBSAMPLE_244_244_OML   0x8983
10132#endif /* GL_OML_subsample */
10133
10134#ifndef GL_PGI_misc_hints
10135#define GL_PGI_misc_hints 1
10136#define GL_PREFER_DOUBLEBUFFER_HINT_PGI   0x1A1F8
10137#define GL_CONSERVE_MEMORY_HINT_PGI       0x1A1FD
10138#define GL_RECLAIM_MEMORY_HINT_PGI        0x1A1FE
10139#define GL_NATIVE_GRAPHICS_HANDLE_PGI     0x1A202
10140#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203
10141#define GL_NATIVE_GRAPHICS_END_HINT_PGI   0x1A204
10142#define GL_ALWAYS_FAST_HINT_PGI           0x1A20C
10143#define GL_ALWAYS_SOFT_HINT_PGI           0x1A20D
10144#define GL_ALLOW_DRAW_OBJ_HINT_PGI        0x1A20E
10145#define GL_ALLOW_DRAW_WIN_HINT_PGI        0x1A20F
10146#define GL_ALLOW_DRAW_FRG_HINT_PGI        0x1A210
10147#define GL_ALLOW_DRAW_MEM_HINT_PGI        0x1A211
10148#define GL_STRICT_DEPTHFUNC_HINT_PGI      0x1A216
10149#define GL_STRICT_LIGHTING_HINT_PGI       0x1A217
10150#define GL_STRICT_SCISSOR_HINT_PGI        0x1A218
10151#define GL_FULL_STIPPLE_HINT_PGI          0x1A219
10152#define GL_CLIP_NEAR_HINT_PGI             0x1A220
10153#define GL_CLIP_FAR_HINT_PGI              0x1A221
10154#define GL_WIDE_LINE_HINT_PGI             0x1A222
10155#define GL_BACK_NORMALS_HINT_PGI          0x1A223
10156typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode);
10157#ifdef GL_GLEXT_PROTOTYPES
10158GLAPI void APIENTRY glHintPGI (GLenum target, GLint mode);
10159#endif
10160#endif /* GL_PGI_misc_hints */
10161
10162#ifndef GL_PGI_vertex_hints
10163#define GL_PGI_vertex_hints 1
10164#define GL_VERTEX_DATA_HINT_PGI           0x1A22A
10165#define GL_VERTEX_CONSISTENT_HINT_PGI     0x1A22B
10166#define GL_MATERIAL_SIDE_HINT_PGI         0x1A22C
10167#define GL_MAX_VERTEX_HINT_PGI            0x1A22D
10168#define GL_COLOR3_BIT_PGI                 0x00010000
10169#define GL_COLOR4_BIT_PGI                 0x00020000
10170#define GL_EDGEFLAG_BIT_PGI               0x00040000
10171#define GL_INDEX_BIT_PGI                  0x00080000
10172#define GL_MAT_AMBIENT_BIT_PGI            0x00100000
10173#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000
10174#define GL_MAT_DIFFUSE_BIT_PGI            0x00400000
10175#define GL_MAT_EMISSION_BIT_PGI           0x00800000
10176#define GL_MAT_COLOR_INDEXES_BIT_PGI      0x01000000
10177#define GL_MAT_SHININESS_BIT_PGI          0x02000000
10178#define GL_MAT_SPECULAR_BIT_PGI           0x04000000
10179#define GL_NORMAL_BIT_PGI                 0x08000000
10180#define GL_TEXCOORD1_BIT_PGI              0x10000000
10181#define GL_TEXCOORD2_BIT_PGI              0x20000000
10182#define GL_TEXCOORD3_BIT_PGI              0x40000000
10183#define GL_TEXCOORD4_BIT_PGI              0x80000000
10184#define GL_VERTEX23_BIT_PGI               0x00000004
10185#define GL_VERTEX4_BIT_PGI                0x00000008
10186#endif /* GL_PGI_vertex_hints */
10187
10188#ifndef GL_REND_screen_coordinates
10189#define GL_REND_screen_coordinates 1
10190#define GL_SCREEN_COORDINATES_REND        0x8490
10191#define GL_INVERTED_SCREEN_W_REND         0x8491
10192#endif /* GL_REND_screen_coordinates */
10193
10194#ifndef GL_S3_s3tc
10195#define GL_S3_s3tc 1
10196#define GL_RGB_S3TC                       0x83A0
10197#define GL_RGB4_S3TC                      0x83A1
10198#define GL_RGBA_S3TC                      0x83A2
10199#define GL_RGBA4_S3TC                     0x83A3
10200#define GL_RGBA_DXT5_S3TC                 0x83A4
10201#define GL_RGBA4_DXT5_S3TC                0x83A5
10202#endif /* GL_S3_s3tc */
10203
10204#ifndef GL_SGIS_detail_texture
10205#define GL_SGIS_detail_texture 1
10206#define GL_DETAIL_TEXTURE_2D_SGIS         0x8095
10207#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096
10208#define GL_LINEAR_DETAIL_SGIS             0x8097
10209#define GL_LINEAR_DETAIL_ALPHA_SGIS       0x8098
10210#define GL_LINEAR_DETAIL_COLOR_SGIS       0x8099
10211#define GL_DETAIL_TEXTURE_LEVEL_SGIS      0x809A
10212#define GL_DETAIL_TEXTURE_MODE_SGIS       0x809B
10213#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C
10214typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
10215typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
10216#ifdef GL_GLEXT_PROTOTYPES
10217GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points);
10218GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum target, GLfloat *points);
10219#endif
10220#endif /* GL_SGIS_detail_texture */
10221
10222#ifndef GL_SGIS_fog_function
10223#define GL_SGIS_fog_function 1
10224#define GL_FOG_FUNC_SGIS                  0x812A
10225#define GL_FOG_FUNC_POINTS_SGIS           0x812B
10226#define GL_MAX_FOG_FUNC_POINTS_SGIS       0x812C
10227typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points);
10228typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points);
10229#ifdef GL_GLEXT_PROTOTYPES
10230GLAPI void APIENTRY glFogFuncSGIS (GLsizei n, const GLfloat *points);
10231GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *points);
10232#endif
10233#endif /* GL_SGIS_fog_function */
10234
10235#ifndef GL_SGIS_generate_mipmap
10236#define GL_SGIS_generate_mipmap 1
10237#define GL_GENERATE_MIPMAP_SGIS           0x8191
10238#define GL_GENERATE_MIPMAP_HINT_SGIS      0x8192
10239#endif /* GL_SGIS_generate_mipmap */
10240
10241#ifndef GL_SGIS_multisample
10242#define GL_SGIS_multisample 1
10243#define GL_MULTISAMPLE_SGIS               0x809D
10244#define GL_SAMPLE_ALPHA_TO_MASK_SGIS      0x809E
10245#define GL_SAMPLE_ALPHA_TO_ONE_SGIS       0x809F
10246#define GL_SAMPLE_MASK_SGIS               0x80A0
10247#define GL_1PASS_SGIS                     0x80A1
10248#define GL_2PASS_0_SGIS                   0x80A2
10249#define GL_2PASS_1_SGIS                   0x80A3
10250#define GL_4PASS_0_SGIS                   0x80A4
10251#define GL_4PASS_1_SGIS                   0x80A5
10252#define GL_4PASS_2_SGIS                   0x80A6
10253#define GL_4PASS_3_SGIS                   0x80A7
10254#define GL_SAMPLE_BUFFERS_SGIS            0x80A8
10255#define GL_SAMPLES_SGIS                   0x80A9
10256#define GL_SAMPLE_MASK_VALUE_SGIS         0x80AA
10257#define GL_SAMPLE_MASK_INVERT_SGIS        0x80AB
10258#define GL_SAMPLE_PATTERN_SGIS            0x80AC
10259typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert);
10260typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern);
10261#ifdef GL_GLEXT_PROTOTYPES
10262GLAPI void APIENTRY glSampleMaskSGIS (GLclampf value, GLboolean invert);
10263GLAPI void APIENTRY glSamplePatternSGIS (GLenum pattern);
10264#endif
10265#endif /* GL_SGIS_multisample */
10266
10267#ifndef GL_SGIS_pixel_texture
10268#define GL_SGIS_pixel_texture 1
10269#define GL_PIXEL_TEXTURE_SGIS             0x8353
10270#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354
10271#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355
10272#define GL_PIXEL_GROUP_COLOR_SGIS         0x8356
10273typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param);
10274typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params);
10275typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param);
10276typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);
10277typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params);
10278typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params);
10279#ifdef GL_GLEXT_PROTOTYPES
10280GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum pname, GLint param);
10281GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum pname, const GLint *params);
10282GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum pname, GLfloat param);
10283GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum pname, const GLfloat *params);
10284GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum pname, GLint *params);
10285GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum pname, GLfloat *params);
10286#endif
10287#endif /* GL_SGIS_pixel_texture */
10288
10289#ifndef GL_SGIS_point_line_texgen
10290#define GL_SGIS_point_line_texgen 1
10291#define GL_EYE_DISTANCE_TO_POINT_SGIS     0x81F0
10292#define GL_OBJECT_DISTANCE_TO_POINT_SGIS  0x81F1
10293#define GL_EYE_DISTANCE_TO_LINE_SGIS      0x81F2
10294#define GL_OBJECT_DISTANCE_TO_LINE_SGIS   0x81F3
10295#define GL_EYE_POINT_SGIS                 0x81F4
10296#define GL_OBJECT_POINT_SGIS              0x81F5
10297#define GL_EYE_LINE_SGIS                  0x81F6
10298#define GL_OBJECT_LINE_SGIS               0x81F7
10299#endif /* GL_SGIS_point_line_texgen */
10300
10301#ifndef GL_SGIS_point_parameters
10302#define GL_SGIS_point_parameters 1
10303#define GL_POINT_SIZE_MIN_SGIS            0x8126
10304#define GL_POINT_SIZE_MAX_SGIS            0x8127
10305#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128
10306#define GL_DISTANCE_ATTENUATION_SGIS      0x8129
10307typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param);
10308typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);
10309#ifdef GL_GLEXT_PROTOTYPES
10310GLAPI void APIENTRY glPointParameterfSGIS (GLenum pname, GLfloat param);
10311GLAPI void APIENTRY glPointParameterfvSGIS (GLenum pname, const GLfloat *params);
10312#endif
10313#endif /* GL_SGIS_point_parameters */
10314
10315#ifndef GL_SGIS_sharpen_texture
10316#define GL_SGIS_sharpen_texture 1
10317#define GL_LINEAR_SHARPEN_SGIS            0x80AD
10318#define GL_LINEAR_SHARPEN_ALPHA_SGIS      0x80AE
10319#define GL_LINEAR_SHARPEN_COLOR_SGIS      0x80AF
10320#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0
10321typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
10322typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
10323#ifdef GL_GLEXT_PROTOTYPES
10324GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points);
10325GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum target, GLfloat *points);
10326#endif
10327#endif /* GL_SGIS_sharpen_texture */
10328
10329#ifndef GL_SGIS_texture4D
10330#define GL_SGIS_texture4D 1
10331#define GL_PACK_SKIP_VOLUMES_SGIS         0x8130
10332#define GL_PACK_IMAGE_DEPTH_SGIS          0x8131
10333#define GL_UNPACK_SKIP_VOLUMES_SGIS       0x8132
10334#define GL_UNPACK_IMAGE_DEPTH_SGIS        0x8133
10335#define GL_TEXTURE_4D_SGIS                0x8134
10336#define GL_PROXY_TEXTURE_4D_SGIS          0x8135
10337#define GL_TEXTURE_4DSIZE_SGIS            0x8136
10338#define GL_TEXTURE_WRAP_Q_SGIS            0x8137
10339#define GL_MAX_4D_TEXTURE_SIZE_SGIS       0x8138
10340#define GL_TEXTURE_4D_BINDING_SGIS        0x814F
10341typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const void *pixels);
10342typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const void *pixels);
10343#ifdef GL_GLEXT_PROTOTYPES
10344GLAPI void APIENTRY glTexImage4DSGIS (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const void *pixels);
10345GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const void *pixels);
10346#endif
10347#endif /* GL_SGIS_texture4D */
10348
10349#ifndef GL_SGIS_texture_border_clamp
10350#define GL_SGIS_texture_border_clamp 1
10351#define GL_CLAMP_TO_BORDER_SGIS           0x812D
10352#endif /* GL_SGIS_texture_border_clamp */
10353
10354#ifndef GL_SGIS_texture_color_mask
10355#define GL_SGIS_texture_color_mask 1
10356#define GL_TEXTURE_COLOR_WRITEMASK_SGIS   0x81EF
10357typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
10358#ifdef GL_GLEXT_PROTOTYPES
10359GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
10360#endif
10361#endif /* GL_SGIS_texture_color_mask */
10362
10363#ifndef GL_SGIS_texture_edge_clamp
10364#define GL_SGIS_texture_edge_clamp 1
10365#define GL_CLAMP_TO_EDGE_SGIS             0x812F
10366#endif /* GL_SGIS_texture_edge_clamp */
10367
10368#ifndef GL_SGIS_texture_filter4
10369#define GL_SGIS_texture_filter4 1
10370#define GL_FILTER4_SGIS                   0x8146
10371#define GL_TEXTURE_FILTER4_SIZE_SGIS      0x8147
10372typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights);
10373typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);
10374#ifdef GL_GLEXT_PROTOTYPES
10375GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum target, GLenum filter, GLfloat *weights);
10376GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);
10377#endif
10378#endif /* GL_SGIS_texture_filter4 */
10379
10380#ifndef GL_SGIS_texture_lod
10381#define GL_SGIS_texture_lod 1
10382#define GL_TEXTURE_MIN_LOD_SGIS           0x813A
10383#define GL_TEXTURE_MAX_LOD_SGIS           0x813B
10384#define GL_TEXTURE_BASE_LEVEL_SGIS        0x813C
10385#define GL_TEXTURE_MAX_LEVEL_SGIS         0x813D
10386#endif /* GL_SGIS_texture_lod */
10387
10388#ifndef GL_SGIS_texture_select
10389#define GL_SGIS_texture_select 1
10390#define GL_DUAL_ALPHA4_SGIS               0x8110
10391#define GL_DUAL_ALPHA8_SGIS               0x8111
10392#define GL_DUAL_ALPHA12_SGIS              0x8112
10393#define GL_DUAL_ALPHA16_SGIS              0x8113
10394#define GL_DUAL_LUMINANCE4_SGIS           0x8114
10395#define GL_DUAL_LUMINANCE8_SGIS           0x8115
10396#define GL_DUAL_LUMINANCE12_SGIS          0x8116
10397#define GL_DUAL_LUMINANCE16_SGIS          0x8117
10398#define GL_DUAL_INTENSITY4_SGIS           0x8118
10399#define GL_DUAL_INTENSITY8_SGIS           0x8119
10400#define GL_DUAL_INTENSITY12_SGIS          0x811A
10401#define GL_DUAL_INTENSITY16_SGIS          0x811B
10402#define GL_DUAL_LUMINANCE_ALPHA4_SGIS     0x811C
10403#define GL_DUAL_LUMINANCE_ALPHA8_SGIS     0x811D
10404#define GL_QUAD_ALPHA4_SGIS               0x811E
10405#define GL_QUAD_ALPHA8_SGIS               0x811F
10406#define GL_QUAD_LUMINANCE4_SGIS           0x8120
10407#define GL_QUAD_LUMINANCE8_SGIS           0x8121
10408#define GL_QUAD_INTENSITY4_SGIS           0x8122
10409#define GL_QUAD_INTENSITY8_SGIS           0x8123
10410#define GL_DUAL_TEXTURE_SELECT_SGIS       0x8124
10411#define GL_QUAD_TEXTURE_SELECT_SGIS       0x8125
10412#endif /* GL_SGIS_texture_select */
10413
10414#ifndef GL_SGIX_async
10415#define GL_SGIX_async 1
10416#define GL_ASYNC_MARKER_SGIX              0x8329
10417typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker);
10418typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp);
10419typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp);
10420typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range);
10421typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range);
10422typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker);
10423#ifdef GL_GLEXT_PROTOTYPES
10424GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint marker);
10425GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *markerp);
10426GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *markerp);
10427GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei range);
10428GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint marker, GLsizei range);
10429GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint marker);
10430#endif
10431#endif /* GL_SGIX_async */
10432
10433#ifndef GL_SGIX_async_histogram
10434#define GL_SGIX_async_histogram 1
10435#define GL_ASYNC_HISTOGRAM_SGIX           0x832C
10436#define GL_MAX_ASYNC_HISTOGRAM_SGIX       0x832D
10437#endif /* GL_SGIX_async_histogram */
10438
10439#ifndef GL_SGIX_async_pixel
10440#define GL_SGIX_async_pixel 1
10441#define GL_ASYNC_TEX_IMAGE_SGIX           0x835C
10442#define GL_ASYNC_DRAW_PIXELS_SGIX         0x835D
10443#define GL_ASYNC_READ_PIXELS_SGIX         0x835E
10444#define GL_MAX_ASYNC_TEX_IMAGE_SGIX       0x835F
10445#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX     0x8360
10446#define GL_MAX_ASYNC_READ_PIXELS_SGIX     0x8361
10447#endif /* GL_SGIX_async_pixel */
10448
10449#ifndef GL_SGIX_blend_alpha_minmax
10450#define GL_SGIX_blend_alpha_minmax 1
10451#define GL_ALPHA_MIN_SGIX                 0x8320
10452#define GL_ALPHA_MAX_SGIX                 0x8321
10453#endif /* GL_SGIX_blend_alpha_minmax */
10454
10455#ifndef GL_SGIX_calligraphic_fragment
10456#define GL_SGIX_calligraphic_fragment 1
10457#define GL_CALLIGRAPHIC_FRAGMENT_SGIX     0x8183
10458#endif /* GL_SGIX_calligraphic_fragment */
10459
10460#ifndef GL_SGIX_clipmap
10461#define GL_SGIX_clipmap 1
10462#define GL_LINEAR_CLIPMAP_LINEAR_SGIX     0x8170
10463#define GL_TEXTURE_CLIPMAP_CENTER_SGIX    0x8171
10464#define GL_TEXTURE_CLIPMAP_FRAME_SGIX     0x8172
10465#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX    0x8173
10466#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174
10467#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175
10468#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX     0x8176
10469#define GL_MAX_CLIPMAP_DEPTH_SGIX         0x8177
10470#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178
10471#define GL_NEAREST_CLIPMAP_NEAREST_SGIX   0x844D
10472#define GL_NEAREST_CLIPMAP_LINEAR_SGIX    0x844E
10473#define GL_LINEAR_CLIPMAP_NEAREST_SGIX    0x844F
10474#endif /* GL_SGIX_clipmap */
10475
10476#ifndef GL_SGIX_convolution_accuracy
10477#define GL_SGIX_convolution_accuracy 1
10478#define GL_CONVOLUTION_HINT_SGIX          0x8316
10479#endif /* GL_SGIX_convolution_accuracy */
10480
10481#ifndef GL_SGIX_depth_pass_instrument
10482#define GL_SGIX_depth_pass_instrument 1
10483#endif /* GL_SGIX_depth_pass_instrument */
10484
10485#ifndef GL_SGIX_depth_texture
10486#define GL_SGIX_depth_texture 1
10487#define GL_DEPTH_COMPONENT16_SGIX         0x81A5
10488#define GL_DEPTH_COMPONENT24_SGIX         0x81A6
10489#define GL_DEPTH_COMPONENT32_SGIX         0x81A7
10490#endif /* GL_SGIX_depth_texture */
10491
10492#ifndef GL_SGIX_flush_raster
10493#define GL_SGIX_flush_raster 1
10494typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void);
10495#ifdef GL_GLEXT_PROTOTYPES
10496GLAPI void APIENTRY glFlushRasterSGIX (void);
10497#endif
10498#endif /* GL_SGIX_flush_raster */
10499
10500#ifndef GL_SGIX_fog_offset
10501#define GL_SGIX_fog_offset 1
10502#define GL_FOG_OFFSET_SGIX                0x8198
10503#define GL_FOG_OFFSET_VALUE_SGIX          0x8199
10504#endif /* GL_SGIX_fog_offset */
10505
10506#ifndef GL_SGIX_fragment_lighting
10507#define GL_SGIX_fragment_lighting 1
10508#define GL_FRAGMENT_LIGHTING_SGIX         0x8400
10509#define GL_FRAGMENT_COLOR_MATERIAL_SGIX   0x8401
10510#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402
10511#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403
10512#define GL_MAX_FRAGMENT_LIGHTS_SGIX       0x8404
10513#define GL_MAX_ACTIVE_LIGHTS_SGIX         0x8405
10514#define GL_CURRENT_RASTER_NORMAL_SGIX     0x8406
10515#define GL_LIGHT_ENV_MODE_SGIX            0x8407
10516#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408
10517#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409
10518#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A
10519#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B
10520#define GL_FRAGMENT_LIGHT0_SGIX           0x840C
10521#define GL_FRAGMENT_LIGHT1_SGIX           0x840D
10522#define GL_FRAGMENT_LIGHT2_SGIX           0x840E
10523#define GL_FRAGMENT_LIGHT3_SGIX           0x840F
10524#define GL_FRAGMENT_LIGHT4_SGIX           0x8410
10525#define GL_FRAGMENT_LIGHT5_SGIX           0x8411
10526#define GL_FRAGMENT_LIGHT6_SGIX           0x8412
10527#define GL_FRAGMENT_LIGHT7_SGIX           0x8413
10528typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode);
10529typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param);
10530typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params);
10531typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param);
10532typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params);
10533typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param);
10534typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params);
10535typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param);
10536typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params);
10537typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param);
10538typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params);
10539typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param);
10540typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params);
10541typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params);
10542typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params);
10543typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params);
10544typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params);
10545typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param);
10546#ifdef GL_GLEXT_PROTOTYPES
10547GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum face, GLenum mode);
10548GLAPI void APIENTRY glFragmentLightfSGIX (GLenum light, GLenum pname, GLfloat param);
10549GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum light, GLenum pname, const GLfloat *params);
10550GLAPI void APIENTRY glFragmentLightiSGIX (GLenum light, GLenum pname, GLint param);
10551GLAPI void APIENTRY glFragmentLightivSGIX (GLenum light, GLenum pname, const GLint *params);
10552GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum pname, GLfloat param);
10553GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum pname, const GLfloat *params);
10554GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum pname, GLint param);
10555GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum pname, const GLint *params);
10556GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum face, GLenum pname, GLfloat param);
10557GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum face, GLenum pname, const GLfloat *params);
10558GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum face, GLenum pname, GLint param);
10559GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum face, GLenum pname, const GLint *params);
10560GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum light, GLenum pname, GLfloat *params);
10561GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum light, GLenum pname, GLint *params);
10562GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum face, GLenum pname, GLfloat *params);
10563GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum face, GLenum pname, GLint *params);
10564GLAPI void APIENTRY glLightEnviSGIX (GLenum pname, GLint param);
10565#endif
10566#endif /* GL_SGIX_fragment_lighting */
10567
10568#ifndef GL_SGIX_framezoom
10569#define GL_SGIX_framezoom 1
10570#define GL_FRAMEZOOM_SGIX                 0x818B
10571#define GL_FRAMEZOOM_FACTOR_SGIX          0x818C
10572#define GL_MAX_FRAMEZOOM_FACTOR_SGIX      0x818D
10573typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor);
10574#ifdef GL_GLEXT_PROTOTYPES
10575GLAPI void APIENTRY glFrameZoomSGIX (GLint factor);
10576#endif
10577#endif /* GL_SGIX_framezoom */
10578
10579#ifndef GL_SGIX_igloo_interface
10580#define GL_SGIX_igloo_interface 1
10581typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const void *params);
10582#ifdef GL_GLEXT_PROTOTYPES
10583GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum pname, const void *params);
10584#endif
10585#endif /* GL_SGIX_igloo_interface */
10586
10587#ifndef GL_SGIX_instruments
10588#define GL_SGIX_instruments 1
10589#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180
10590#define GL_INSTRUMENT_MEASUREMENTS_SGIX   0x8181
10591typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void);
10592typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer);
10593typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p);
10594typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker);
10595typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void);
10596typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker);
10597#ifdef GL_GLEXT_PROTOTYPES
10598GLAPI GLint APIENTRY glGetInstrumentsSGIX (void);
10599GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei size, GLint *buffer);
10600GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *marker_p);
10601GLAPI void APIENTRY glReadInstrumentsSGIX (GLint marker);
10602GLAPI void APIENTRY glStartInstrumentsSGIX (void);
10603GLAPI void APIENTRY glStopInstrumentsSGIX (GLint marker);
10604#endif
10605#endif /* GL_SGIX_instruments */
10606
10607#ifndef GL_SGIX_interlace
10608#define GL_SGIX_interlace 1
10609#define GL_INTERLACE_SGIX                 0x8094
10610#endif /* GL_SGIX_interlace */
10611
10612#ifndef GL_SGIX_ir_instrument1
10613#define GL_SGIX_ir_instrument1 1
10614#define GL_IR_INSTRUMENT1_SGIX            0x817F
10615#endif /* GL_SGIX_ir_instrument1 */
10616
10617#ifndef GL_SGIX_list_priority
10618#define GL_SGIX_list_priority 1
10619#define GL_LIST_PRIORITY_SGIX             0x8182
10620typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params);
10621typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params);
10622typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param);
10623typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params);
10624typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param);
10625typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params);
10626#ifdef GL_GLEXT_PROTOTYPES
10627GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint list, GLenum pname, GLfloat *params);
10628GLAPI void APIENTRY glGetListParameterivSGIX (GLuint list, GLenum pname, GLint *params);
10629GLAPI void APIENTRY glListParameterfSGIX (GLuint list, GLenum pname, GLfloat param);
10630GLAPI void APIENTRY glListParameterfvSGIX (GLuint list, GLenum pname, const GLfloat *params);
10631GLAPI void APIENTRY glListParameteriSGIX (GLuint list, GLenum pname, GLint param);
10632GLAPI void APIENTRY glListParameterivSGIX (GLuint list, GLenum pname, const GLint *params);
10633#endif
10634#endif /* GL_SGIX_list_priority */
10635
10636#ifndef GL_SGIX_pixel_texture
10637#define GL_SGIX_pixel_texture 1
10638#define GL_PIXEL_TEX_GEN_SGIX             0x8139
10639#define GL_PIXEL_TEX_GEN_MODE_SGIX        0x832B
10640typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode);
10641#ifdef GL_GLEXT_PROTOTYPES
10642GLAPI void APIENTRY glPixelTexGenSGIX (GLenum mode);
10643#endif
10644#endif /* GL_SGIX_pixel_texture */
10645
10646#ifndef GL_SGIX_pixel_tiles
10647#define GL_SGIX_pixel_tiles 1
10648#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E
10649#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F
10650#define GL_PIXEL_TILE_WIDTH_SGIX          0x8140
10651#define GL_PIXEL_TILE_HEIGHT_SGIX         0x8141
10652#define GL_PIXEL_TILE_GRID_WIDTH_SGIX     0x8142
10653#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX    0x8143
10654#define GL_PIXEL_TILE_GRID_DEPTH_SGIX     0x8144
10655#define GL_PIXEL_TILE_CACHE_SIZE_SGIX     0x8145
10656#endif /* GL_SGIX_pixel_tiles */
10657
10658#ifndef GL_SGIX_polynomial_ffd
10659#define GL_SGIX_polynomial_ffd 1
10660#define GL_TEXTURE_DEFORMATION_BIT_SGIX   0x00000001
10661#define GL_GEOMETRY_DEFORMATION_BIT_SGIX  0x00000002
10662#define GL_GEOMETRY_DEFORMATION_SGIX      0x8194
10663#define GL_TEXTURE_DEFORMATION_SGIX       0x8195
10664#define GL_DEFORMATIONS_MASK_SGIX         0x8196
10665#define GL_MAX_DEFORMATION_ORDER_SGIX     0x8197
10666typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points);
10667typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points);
10668typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask);
10669typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask);
10670#ifdef GL_GLEXT_PROTOTYPES
10671GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points);
10672GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points);
10673GLAPI void APIENTRY glDeformSGIX (GLbitfield mask);
10674GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield mask);
10675#endif
10676#endif /* GL_SGIX_polynomial_ffd */
10677
10678#ifndef GL_SGIX_reference_plane
10679#define GL_SGIX_reference_plane 1
10680#define GL_REFERENCE_PLANE_SGIX           0x817D
10681#define GL_REFERENCE_PLANE_EQUATION_SGIX  0x817E
10682typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation);
10683#ifdef GL_GLEXT_PROTOTYPES
10684GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation);
10685#endif
10686#endif /* GL_SGIX_reference_plane */
10687
10688#ifndef GL_SGIX_resample
10689#define GL_SGIX_resample 1
10690#define GL_PACK_RESAMPLE_SGIX             0x842C
10691#define GL_UNPACK_RESAMPLE_SGIX           0x842D
10692#define GL_RESAMPLE_REPLICATE_SGIX        0x842E
10693#define GL_RESAMPLE_ZERO_FILL_SGIX        0x842F
10694#define GL_RESAMPLE_DECIMATE_SGIX         0x8430
10695#endif /* GL_SGIX_resample */
10696
10697#ifndef GL_SGIX_scalebias_hint
10698#define GL_SGIX_scalebias_hint 1
10699#define GL_SCALEBIAS_HINT_SGIX            0x8322
10700#endif /* GL_SGIX_scalebias_hint */
10701
10702#ifndef GL_SGIX_shadow
10703#define GL_SGIX_shadow 1
10704#define GL_TEXTURE_COMPARE_SGIX           0x819A
10705#define GL_TEXTURE_COMPARE_OPERATOR_SGIX  0x819B
10706#define GL_TEXTURE_LEQUAL_R_SGIX          0x819C
10707#define GL_TEXTURE_GEQUAL_R_SGIX          0x819D
10708#endif /* GL_SGIX_shadow */
10709
10710#ifndef GL_SGIX_shadow_ambient
10711#define GL_SGIX_shadow_ambient 1
10712#define GL_SHADOW_AMBIENT_SGIX            0x80BF
10713#endif /* GL_SGIX_shadow_ambient */
10714
10715#ifndef GL_SGIX_sprite
10716#define GL_SGIX_sprite 1
10717#define GL_SPRITE_SGIX                    0x8148
10718#define GL_SPRITE_MODE_SGIX               0x8149
10719#define GL_SPRITE_AXIS_SGIX               0x814A
10720#define GL_SPRITE_TRANSLATION_SGIX        0x814B
10721#define GL_SPRITE_AXIAL_SGIX              0x814C
10722#define GL_SPRITE_OBJECT_ALIGNED_SGIX     0x814D
10723#define GL_SPRITE_EYE_ALIGNED_SGIX        0x814E
10724typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param);
10725typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params);
10726typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param);
10727typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params);
10728#ifdef GL_GLEXT_PROTOTYPES
10729GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum pname, GLfloat param);
10730GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum pname, const GLfloat *params);
10731GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum pname, GLint param);
10732GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum pname, const GLint *params);
10733#endif
10734#endif /* GL_SGIX_sprite */
10735
10736#ifndef GL_SGIX_subsample
10737#define GL_SGIX_subsample 1
10738#define GL_PACK_SUBSAMPLE_RATE_SGIX       0x85A0
10739#define GL_UNPACK_SUBSAMPLE_RATE_SGIX     0x85A1
10740#define GL_PIXEL_SUBSAMPLE_4444_SGIX      0x85A2
10741#define GL_PIXEL_SUBSAMPLE_2424_SGIX      0x85A3
10742#define GL_PIXEL_SUBSAMPLE_4242_SGIX      0x85A4
10743#endif /* GL_SGIX_subsample */
10744
10745#ifndef GL_SGIX_tag_sample_buffer
10746#define GL_SGIX_tag_sample_buffer 1
10747typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void);
10748#ifdef GL_GLEXT_PROTOTYPES
10749GLAPI void APIENTRY glTagSampleBufferSGIX (void);
10750#endif
10751#endif /* GL_SGIX_tag_sample_buffer */
10752
10753#ifndef GL_SGIX_texture_add_env
10754#define GL_SGIX_texture_add_env 1
10755#define GL_TEXTURE_ENV_BIAS_SGIX          0x80BE
10756#endif /* GL_SGIX_texture_add_env */
10757
10758#ifndef GL_SGIX_texture_coordinate_clamp
10759#define GL_SGIX_texture_coordinate_clamp 1
10760#define GL_TEXTURE_MAX_CLAMP_S_SGIX       0x8369
10761#define GL_TEXTURE_MAX_CLAMP_T_SGIX       0x836A
10762#define GL_TEXTURE_MAX_CLAMP_R_SGIX       0x836B
10763#endif /* GL_SGIX_texture_coordinate_clamp */
10764
10765#ifndef GL_SGIX_texture_lod_bias
10766#define GL_SGIX_texture_lod_bias 1
10767#define GL_TEXTURE_LOD_BIAS_S_SGIX        0x818E
10768#define GL_TEXTURE_LOD_BIAS_T_SGIX        0x818F
10769#define GL_TEXTURE_LOD_BIAS_R_SGIX        0x8190
10770#endif /* GL_SGIX_texture_lod_bias */
10771
10772#ifndef GL_SGIX_texture_multi_buffer
10773#define GL_SGIX_texture_multi_buffer 1
10774#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E
10775#endif /* GL_SGIX_texture_multi_buffer */
10776
10777#ifndef GL_SGIX_texture_scale_bias
10778#define GL_SGIX_texture_scale_bias 1
10779#define GL_POST_TEXTURE_FILTER_BIAS_SGIX  0x8179
10780#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A
10781#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B
10782#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C
10783#endif /* GL_SGIX_texture_scale_bias */
10784
10785#ifndef GL_SGIX_vertex_preclip
10786#define GL_SGIX_vertex_preclip 1
10787#define GL_VERTEX_PRECLIP_SGIX            0x83EE
10788#define GL_VERTEX_PRECLIP_HINT_SGIX       0x83EF
10789#endif /* GL_SGIX_vertex_preclip */
10790
10791#ifndef GL_SGIX_ycrcb
10792#define GL_SGIX_ycrcb 1
10793#define GL_YCRCB_422_SGIX                 0x81BB
10794#define GL_YCRCB_444_SGIX                 0x81BC
10795#endif /* GL_SGIX_ycrcb */
10796
10797#ifndef GL_SGIX_ycrcb_subsample
10798#define GL_SGIX_ycrcb_subsample 1
10799#endif /* GL_SGIX_ycrcb_subsample */
10800
10801#ifndef GL_SGIX_ycrcba
10802#define GL_SGIX_ycrcba 1
10803#define GL_YCRCB_SGIX                     0x8318
10804#define GL_YCRCBA_SGIX                    0x8319
10805#endif /* GL_SGIX_ycrcba */
10806
10807#ifndef GL_SGI_color_matrix
10808#define GL_SGI_color_matrix 1
10809#define GL_COLOR_MATRIX_SGI               0x80B1
10810#define GL_COLOR_MATRIX_STACK_DEPTH_SGI   0x80B2
10811#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3
10812#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4
10813#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5
10814#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6
10815#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7
10816#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8
10817#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9
10818#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA
10819#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB
10820#endif /* GL_SGI_color_matrix */
10821
10822#ifndef GL_SGI_color_table
10823#define GL_SGI_color_table 1
10824#define GL_COLOR_TABLE_SGI                0x80D0
10825#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1
10826#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2
10827#define GL_PROXY_COLOR_TABLE_SGI          0x80D3
10828#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4
10829#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5
10830#define GL_COLOR_TABLE_SCALE_SGI          0x80D6
10831#define GL_COLOR_TABLE_BIAS_SGI           0x80D7
10832#define GL_COLOR_TABLE_FORMAT_SGI         0x80D8
10833#define GL_COLOR_TABLE_WIDTH_SGI          0x80D9
10834#define GL_COLOR_TABLE_RED_SIZE_SGI       0x80DA
10835#define GL_COLOR_TABLE_GREEN_SIZE_SGI     0x80DB
10836#define GL_COLOR_TABLE_BLUE_SIZE_SGI      0x80DC
10837#define GL_COLOR_TABLE_ALPHA_SIZE_SGI     0x80DD
10838#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE
10839#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF
10840typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
10841typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params);
10842typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params);
10843typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
10844typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, void *table);
10845typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params);
10846typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params);
10847#ifdef GL_GLEXT_PROTOTYPES
10848GLAPI void APIENTRY glColorTableSGI (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
10849GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum target, GLenum pname, const GLfloat *params);
10850GLAPI void APIENTRY glColorTableParameterivSGI (GLenum target, GLenum pname, const GLint *params);
10851GLAPI void APIENTRY glCopyColorTableSGI (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
10852GLAPI void APIENTRY glGetColorTableSGI (GLenum target, GLenum format, GLenum type, void *table);
10853GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum target, GLenum pname, GLfloat *params);
10854GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum target, GLenum pname, GLint *params);
10855#endif
10856#endif /* GL_SGI_color_table */
10857
10858#ifndef GL_SGI_texture_color_table
10859#define GL_SGI_texture_color_table 1
10860#define GL_TEXTURE_COLOR_TABLE_SGI        0x80BC
10861#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI  0x80BD
10862#endif /* GL_SGI_texture_color_table */
10863
10864#ifndef GL_SUNX_constant_data
10865#define GL_SUNX_constant_data 1
10866#define GL_UNPACK_CONSTANT_DATA_SUNX      0x81D5
10867#define GL_TEXTURE_CONSTANT_DATA_SUNX     0x81D6
10868typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void);
10869#ifdef GL_GLEXT_PROTOTYPES
10870GLAPI void APIENTRY glFinishTextureSUNX (void);
10871#endif
10872#endif /* GL_SUNX_constant_data */
10873
10874#ifndef GL_SUN_convolution_border_modes
10875#define GL_SUN_convolution_border_modes 1
10876#define GL_WRAP_BORDER_SUN                0x81D4
10877#endif /* GL_SUN_convolution_border_modes */
10878
10879#ifndef GL_SUN_global_alpha
10880#define GL_SUN_global_alpha 1
10881#define GL_GLOBAL_ALPHA_SUN               0x81D9
10882#define GL_GLOBAL_ALPHA_FACTOR_SUN        0x81DA
10883typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor);
10884typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor);
10885typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor);
10886typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor);
10887typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor);
10888typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor);
10889typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor);
10890typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor);
10891#ifdef GL_GLEXT_PROTOTYPES
10892GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte factor);
10893GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort factor);
10894GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint factor);
10895GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat factor);
10896GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble factor);
10897GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte factor);
10898GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort factor);
10899GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint factor);
10900#endif
10901#endif /* GL_SUN_global_alpha */
10902
10903#ifndef GL_SUN_mesh_array
10904#define GL_SUN_mesh_array 1
10905#define GL_QUAD_MESH_SUN                  0x8614
10906#define GL_TRIANGLE_MESH_SUN              0x8615
10907typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width);
10908#ifdef GL_GLEXT_PROTOTYPES
10909GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum mode, GLint first, GLsizei count, GLsizei width);
10910#endif
10911#endif /* GL_SUN_mesh_array */
10912
10913#ifndef GL_SUN_slice_accum
10914#define GL_SUN_slice_accum 1
10915#define GL_SLICE_ACCUM_SUN                0x85CC
10916#endif /* GL_SUN_slice_accum */
10917
10918#ifndef GL_SUN_triangle_list
10919#define GL_SUN_triangle_list 1
10920#define GL_RESTART_SUN                    0x0001
10921#define GL_REPLACE_MIDDLE_SUN             0x0002
10922#define GL_REPLACE_OLDEST_SUN             0x0003
10923#define GL_TRIANGLE_LIST_SUN              0x81D7
10924#define GL_REPLACEMENT_CODE_SUN           0x81D8
10925#define GL_REPLACEMENT_CODE_ARRAY_SUN     0x85C0
10926#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1
10927#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2
10928#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3
10929#define GL_R1UI_V3F_SUN                   0x85C4
10930#define GL_R1UI_C4UB_V3F_SUN              0x85C5
10931#define GL_R1UI_C3F_V3F_SUN               0x85C6
10932#define GL_R1UI_N3F_V3F_SUN               0x85C7
10933#define GL_R1UI_C4F_N3F_V3F_SUN           0x85C8
10934#define GL_R1UI_T2F_V3F_SUN               0x85C9
10935#define GL_R1UI_T2F_N3F_V3F_SUN           0x85CA
10936#define GL_R1UI_T2F_C4F_N3F_V3F_SUN       0x85CB
10937typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code);
10938typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code);
10939typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code);
10940typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code);
10941typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code);
10942typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code);
10943typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const void **pointer);
10944#ifdef GL_GLEXT_PROTOTYPES
10945GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint code);
10946GLAPI void APIENTRY glReplacementCodeusSUN (GLushort code);
10947GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte code);
10948GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *code);
10949GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *code);
10950GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *code);
10951GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum type, GLsizei stride, const void **pointer);
10952#endif
10953#endif /* GL_SUN_triangle_list */
10954
10955#ifndef GL_SUN_vertex
10956#define GL_SUN_vertex 1
10957typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);
10958typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v);
10959typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
10960typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v);
10961typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
10962typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v);
10963typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
10964typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v);
10965typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
10966typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v);
10967typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
10968typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v);
10969typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
10970typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v);
10971typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
10972typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v);
10973typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
10974typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v);
10975typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
10976typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v);
10977typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
10978typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
10979typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
10980typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
10981typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z);
10982typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v);
10983typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
10984typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v);
10985typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
10986typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v);
10987typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
10988typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v);
10989typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
10990typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
10991typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
10992typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v);
10993typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
10994typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);
10995typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
10996typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
10997#ifdef GL_GLEXT_PROTOTYPES
10998GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);
10999GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *c, const GLfloat *v);
11000GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
11001GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *c, const GLfloat *v);
11002GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
11003GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *c, const GLfloat *v);
11004GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
11005GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *n, const GLfloat *v);
11006GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
11007GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *c, const GLfloat *n, const GLfloat *v);
11008GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
11009GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *tc, const GLfloat *v);
11010GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
11011GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *tc, const GLfloat *v);
11012GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
11013GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *tc, const GLubyte *c, const GLfloat *v);
11014GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
11015GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *v);
11016GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
11017GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *n, const GLfloat *v);
11018GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
11019GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
11020GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
11021GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
11022GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint rc, GLfloat x, GLfloat y, GLfloat z);
11023GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *rc, const GLfloat *v);
11024GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
11025GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *rc, const GLubyte *c, const GLfloat *v);
11026GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
11027GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *v);
11028GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
11029GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *n, const GLfloat *v);
11030GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
11031GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
11032GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
11033GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *v);
11034GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
11035GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);
11036GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
11037GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
11038#endif
11039#endif /* GL_SUN_vertex */
11040
11041#ifndef GL_WIN_phong_shading
11042#define GL_WIN_phong_shading 1
11043#define GL_PHONG_WIN                      0x80EA
11044#define GL_PHONG_HINT_WIN                 0x80EB
11045#endif /* GL_WIN_phong_shading */
11046
11047#ifndef GL_WIN_specular_fog
11048#define GL_WIN_specular_fog 1
11049#define GL_FOG_SPECULAR_TEXTURE_WIN       0x80EC
11050#endif /* GL_WIN_specular_fog */
11051
11052#ifdef __cplusplus
11053}
11054#endif
11055
11056#endif
Property changes on: branches/osd/src/lib/khronos/gl/glext.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/gl/GRemedyGLExtensions.h
r0r31734
1// ------------------------------ GRemdeyGLExtensions.h ------------------------------
2
3// -----------------------------------------------------------------
4//   Â© 2004 - 2012 Advanced Micro Devices, Inc. All rights reserved.
5// -----------------------------------------------------------------
6
7#ifndef __GREMDEYGLEXTENSIONS
8#define __GREMDEYGLEXTENSIONS
9
10
11#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
12#define WIN32_LEAN_AND_MEAN 1
13#include <windows.h>
14#endif
15
16#ifndef APIENTRY
17#define APIENTRY
18#endif
19
20#ifndef APIENTRYP
21#define APIENTRYP APIENTRY *
22#endif
23
24#ifndef GLAPI
25#define GLAPI extern
26#endif
27
28#ifdef __cplusplus
29extern "C"
30{
31#endif
32
33        /* ----------------------- GL_GREMEDY_string_marker ----------------------- */
34       
35#ifndef GL_GREMEDY_string_marker
36#define GL_GREMEDY_string_marker 1
37       
38#ifdef GL_GLEXT_PROTOTYPES
39        GLAPI void APIENTRY glStringMarkerGREMEDY(GLsizei len, const GLvoid *string);
40#endif /* GL_GLEXT_PROTOTYPES */
41       
42        typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC)(GLsizei len, const GLvoid *string);
43       
44#endif /* GL_GREMEDY_string_marker */
45       
46       
47       
48        /* ----------------------- GL_GREMEDY_frame_terminator ----------------------- */
49       
50#ifndef GL_GREMEDY_frame_terminator
51#define GL_GREMEDY_frame_terminator 1
52       
53#ifdef GL_GLEXT_PROTOTYPES
54        GLAPI void APIENTRY glFrameTerminatorGREMEDY(void);
55#endif /* GL_GLEXT_PROTOTYPES */
56       
57        typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC)(void);
58       
59#endif /* GL_GREMEDY_frame_terminator */
60       
61       
62#ifdef __cplusplus
63}
64#endif
65
66
67#endif  /* __GREMDEYGLEXTENSIONS */
Property changes on: branches/osd/src/lib/khronos/gl/GRemedyGLExtensions.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/KHR/khrplatform.h
r0r31734
1#ifndef __khrplatform_h_
2#define __khrplatform_h_
3
4/*
5** Copyright (c) 2008-2009 The Khronos Group Inc.
6**
7** Permission is hereby granted, free of charge, to any person obtaining a
8** copy of this software and/or associated documentation files (the
9** "Materials"), to deal in the Materials without restriction, including
10** without limitation the rights to use, copy, modify, merge, publish,
11** distribute, sublicense, and/or sell copies of the Materials, and to
12** permit persons to whom the Materials are furnished to do so, subject to
13** the following conditions:
14**
15** The above copyright notice and this permission notice shall be included
16** in all copies or substantial portions of the Materials.
17**
18** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
25*/
26
27/* Khronos platform-specific types and definitions.
28 *
29 * $Revision: 7820 $ on $Date: 2009-04-03 13:46:26 -0700 (Fri, 03 Apr 2009) $
30 *
31 * Adopters may modify this file to suit their platform. Adopters are
32 * encouraged to submit platform specific modifications to the Khronos
33 * group so that they can be included in future versions of this file.
34 * Please submit changes by sending them to the public Khronos Bugzilla
35 * (http://khronos.org/bugzilla) by filing a bug against product
36 * "Khronos (general)" component "Registry".
37 *
38 * A predefined template which fills in some of the bug fields can be
39 * reached using http://tinyurl.com/khrplatform-h-bugreport, but you
40 * must create a Bugzilla login first.
41 *
42 *
43 * See the Implementer's Guidelines for information about where this file
44 * should be located on your system and for more details of its use:
45 *    http://www.khronos.org/registry/implementers_guide.pdf
46 *
47 * This file should be included as
48 *        #include <KHR/khrplatform.h>
49 * by Khronos client API header files that use its types and defines.
50 *
51 * The types in khrplatform.h should only be used to define API-specific types.
52 *
53 * Types defined in khrplatform.h:
54 *    khronos_int8_t              signed   8  bit
55 *    khronos_uint8_t             unsigned 8  bit
56 *    khronos_int16_t             signed   16 bit
57 *    khronos_uint16_t            unsigned 16 bit
58 *    khronos_int32_t             signed   32 bit
59 *    khronos_uint32_t            unsigned 32 bit
60 *    khronos_int64_t             signed   64 bit
61 *    khronos_uint64_t            unsigned 64 bit
62 *    khronos_intptr_t            signed   same number of bits as a pointer
63 *    khronos_uintptr_t           unsigned same number of bits as a pointer
64 *    khronos_ssize_t             signed   size
65 *    khronos_usize_t             unsigned size
66 *    khronos_float_t             signed   32 bit floating point
67 *    khronos_time_ns_t           unsigned 64 bit time in nanoseconds
68 *    khronos_utime_nanoseconds_t unsigned time interval or absolute time in
69 *                                         nanoseconds
70 *    khronos_stime_nanoseconds_t signed time interval in nanoseconds
71 *    khronos_boolean_enum_t      enumerated boolean type. This should
72 *      only be used as a base type when a client API's boolean type is
73 *      an enum. Client APIs which use an integer or other type for
74 *      booleans cannot use this as the base type for their boolean.
75 *
76 * Tokens defined in khrplatform.h:
77 *
78 *    KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
79 *
80 *    KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
81 *    KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
82 *
83 * Calling convention macros defined in this file:
84 *    KHRONOS_APICALL
85 *    KHRONOS_APIENTRY
86 *    KHRONOS_APIATTRIBUTES
87 *
88 * These may be used in function prototypes as:
89 *
90 *      KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
91 *                                  int arg1,
92 *                                  int arg2) KHRONOS_APIATTRIBUTES;
93 */
94
95/*-------------------------------------------------------------------------
96 * Definition of KHRONOS_APICALL
97 *-------------------------------------------------------------------------
98 * This precedes the return type of the function in the function prototype.
99 */
100#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
101#   define KHRONOS_APICALL __declspec(dllimport)
102#elif defined (__SYMBIAN32__)
103#   define KHRONOS_APICALL IMPORT_C
104#else
105#   define KHRONOS_APICALL
106#endif
107
108/*-------------------------------------------------------------------------
109 * Definition of KHRONOS_APIENTRY
110 *-------------------------------------------------------------------------
111 * This follows the return type of the function  and precedes the function
112 * name in the function prototype.
113 */
114#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
115    /* Win32 but not WinCE */
116#   define KHRONOS_APIENTRY __stdcall
117#else
118#   define KHRONOS_APIENTRY
119#endif
120
121/*-------------------------------------------------------------------------
122 * Definition of KHRONOS_APIATTRIBUTES
123 *-------------------------------------------------------------------------
124 * This follows the closing parenthesis of the function prototype arguments.
125 */
126#if defined (__ARMCC_2__)
127#define KHRONOS_APIATTRIBUTES __softfp
128#else
129#define KHRONOS_APIATTRIBUTES
130#endif
131
132/*-------------------------------------------------------------------------
133 * basic type definitions
134 *-----------------------------------------------------------------------*/
135#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
136
137
138/*
139 * Using <stdint.h>
140 */
141#include <stdint.h>
142typedef int32_t                 khronos_int32_t;
143typedef uint32_t                khronos_uint32_t;
144typedef int64_t                 khronos_int64_t;
145typedef uint64_t                khronos_uint64_t;
146#define KHRONOS_SUPPORT_INT64   1
147#define KHRONOS_SUPPORT_FLOAT   1
148
149#elif defined(__VMS ) || defined(__sgi)
150
151/*
152 * Using <inttypes.h>
153 */
154#include <inttypes.h>
155typedef int32_t                 khronos_int32_t;
156typedef uint32_t                khronos_uint32_t;
157typedef int64_t                 khronos_int64_t;
158typedef uint64_t                khronos_uint64_t;
159#define KHRONOS_SUPPORT_INT64   1
160#define KHRONOS_SUPPORT_FLOAT   1
161
162#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
163
164/*
165 * Win32
166 */
167typedef __int32                 khronos_int32_t;
168typedef unsigned __int32        khronos_uint32_t;
169typedef __int64                 khronos_int64_t;
170typedef unsigned __int64        khronos_uint64_t;
171#define KHRONOS_SUPPORT_INT64   1
172#define KHRONOS_SUPPORT_FLOAT   1
173
174#elif defined(__sun__) || defined(__digital__)
175
176/*
177 * Sun or Digital
178 */
179typedef int                     khronos_int32_t;
180typedef unsigned int            khronos_uint32_t;
181#if defined(__arch64__) || defined(_LP64)
182typedef long int                khronos_int64_t;
183typedef unsigned long int       khronos_uint64_t;
184#else
185typedef long long int           khronos_int64_t;
186typedef unsigned long long int  khronos_uint64_t;
187#endif /* __arch64__ */
188#define KHRONOS_SUPPORT_INT64   1
189#define KHRONOS_SUPPORT_FLOAT   1
190
191#elif 0
192
193/*
194 * Hypothetical platform with no float or int64 support
195 */
196typedef int                     khronos_int32_t;
197typedef unsigned int            khronos_uint32_t;
198#define KHRONOS_SUPPORT_INT64   0
199#define KHRONOS_SUPPORT_FLOAT   0
200
201#else
202
203/*
204 * Generic fallback
205 */
206#include <stdint.h>
207typedef int32_t                 khronos_int32_t;
208typedef uint32_t                khronos_uint32_t;
209typedef int64_t                 khronos_int64_t;
210typedef uint64_t                khronos_uint64_t;
211#define KHRONOS_SUPPORT_INT64   1
212#define KHRONOS_SUPPORT_FLOAT   1
213
214#endif
215
216
217/*
218 * Types that are (so far) the same on all platforms
219 */
220typedef signed   char          khronos_int8_t;
221typedef unsigned char          khronos_uint8_t;
222typedef signed   short int     khronos_int16_t;
223typedef unsigned short int     khronos_uint16_t;
224typedef signed   long  int     khronos_intptr_t;
225typedef unsigned long  int     khronos_uintptr_t;
226typedef signed   long  int     khronos_ssize_t;
227typedef unsigned long  int     khronos_usize_t;
228
229#if KHRONOS_SUPPORT_FLOAT
230/*
231 * Float type
232 */
233typedef          float         khronos_float_t;
234#endif
235
236#if KHRONOS_SUPPORT_INT64
237/* Time types
238 *
239 * These types can be used to represent a time interval in nanoseconds or
240 * an absolute Unadjusted System Time.  Unadjusted System Time is the number
241 * of nanoseconds since some arbitrary system event (e.g. since the last
242 * time the system booted).  The Unadjusted System Time is an unsigned
243 * 64 bit value that wraps back to 0 every 584 years.  Time intervals
244 * may be either signed or unsigned.
245 */
246typedef khronos_uint64_t       khronos_utime_nanoseconds_t;
247typedef khronos_int64_t        khronos_stime_nanoseconds_t;
248#endif
249
250/*
251 * Dummy value used to pad enum types to 32 bits.
252 */
253#ifndef KHRONOS_MAX_ENUM
254#define KHRONOS_MAX_ENUM 0x7FFFFFFF
255#endif
256
257/*
258 * Enumerated boolean type
259 *
260 * Values other than zero should be considered to be true.  Therefore
261 * comparisons should not be made against KHRONOS_TRUE.
262 */
263typedef enum {
264    KHRONOS_FALSE = 0,
265    KHRONOS_TRUE  = 1,
266    KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
267} khronos_boolean_enum_t;
268
269#endif /* __khrplatform_h_ */
Property changes on: branches/osd/src/lib/khronos/KHR/khrplatform.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/EGL/egl.h
r0r31734
1/* -*- mode: c; tab-width: 8; -*- */
2/* vi: set sw=4 ts=8: */
3/* Reference version of egl.h for EGL 1.4.
4 * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $
5 */
6
7/*
8** Copyright (c) 2007-2009 The Khronos Group Inc.
9**
10** Permission is hereby granted, free of charge, to any person obtaining a
11** copy of this software and/or associated documentation files (the
12** "Materials"), to deal in the Materials without restriction, including
13** without limitation the rights to use, copy, modify, merge, publish,
14** distribute, sublicense, and/or sell copies of the Materials, and to
15** permit persons to whom the Materials are furnished to do so, subject to
16** the following conditions:
17**
18** The above copyright notice and this permission notice shall be included
19** in all copies or substantial portions of the Materials.
20**
21** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
28*/
29
30#ifndef __egl_h_
31#define __egl_h_
32
33/* All platform-dependent types and macro boilerplate (such as EGLAPI
34 * and EGLAPIENTRY) should go in eglplatform.h.
35 */
36#include <EGL/eglplatform.h>
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42/* EGL Types */
43/* EGLint is defined in eglplatform.h */
44typedef unsigned int EGLBoolean;
45typedef unsigned int EGLenum;
46typedef void *EGLConfig;
47typedef void *EGLContext;
48typedef void *EGLDisplay;
49typedef void *EGLSurface;
50typedef void *EGLClientBuffer;
51
52/* EGL Versioning */
53#define EGL_VERSION_1_0         1
54#define EGL_VERSION_1_1         1
55#define EGL_VERSION_1_2         1
56#define EGL_VERSION_1_3         1
57#define EGL_VERSION_1_4         1
58
59/* EGL Enumerants. Bitmasks and other exceptional cases aside, most
60 * enums are assigned unique values starting at 0x3000.
61 */
62
63/* EGL aliases */
64#define EGL_FALSE         0
65#define EGL_TRUE         1
66
67/* Out-of-band handle values */
68#define EGL_DEFAULT_DISPLAY      ((EGLNativeDisplayType)0)
69#define EGL_NO_CONTEXT         ((EGLContext)0)
70#define EGL_NO_DISPLAY         ((EGLDisplay)0)
71#define EGL_NO_SURFACE         ((EGLSurface)0)
72
73/* Out-of-band attribute value */
74#define EGL_DONT_CARE         ((EGLint)-1)
75
76/* Errors / GetError return values */
77#define EGL_SUCCESS         0x3000
78#define EGL_NOT_INITIALIZED      0x3001
79#define EGL_BAD_ACCESS         0x3002
80#define EGL_BAD_ALLOC         0x3003
81#define EGL_BAD_ATTRIBUTE      0x3004
82#define EGL_BAD_CONFIG         0x3005
83#define EGL_BAD_CONTEXT         0x3006
84#define EGL_BAD_CURRENT_SURFACE      0x3007
85#define EGL_BAD_DISPLAY         0x3008
86#define EGL_BAD_MATCH         0x3009
87#define EGL_BAD_NATIVE_PIXMAP      0x300A
88#define EGL_BAD_NATIVE_WINDOW      0x300B
89#define EGL_BAD_PARAMETER      0x300C
90#define EGL_BAD_SURFACE         0x300D
91#define EGL_CONTEXT_LOST      0x300E   /* EGL 1.1 - IMG_power_management */
92
93/* Reserved 0x300F-0x301F for additional errors */
94
95/* Config attributes */
96#define EGL_BUFFER_SIZE         0x3020
97#define EGL_ALPHA_SIZE         0x3021
98#define EGL_BLUE_SIZE         0x3022
99#define EGL_GREEN_SIZE         0x3023
100#define EGL_RED_SIZE         0x3024
101#define EGL_DEPTH_SIZE         0x3025
102#define EGL_STENCIL_SIZE      0x3026
103#define EGL_CONFIG_CAVEAT      0x3027
104#define EGL_CONFIG_ID         0x3028
105#define EGL_LEVEL         0x3029
106#define EGL_MAX_PBUFFER_HEIGHT      0x302A
107#define EGL_MAX_PBUFFER_PIXELS      0x302B
108#define EGL_MAX_PBUFFER_WIDTH      0x302C
109#define EGL_NATIVE_RENDERABLE      0x302D
110#define EGL_NATIVE_VISUAL_ID      0x302E
111#define EGL_NATIVE_VISUAL_TYPE      0x302F
112#define EGL_SAMPLES         0x3031
113#define EGL_SAMPLE_BUFFERS      0x3032
114#define EGL_SURFACE_TYPE      0x3033
115#define EGL_TRANSPARENT_TYPE      0x3034
116#define EGL_TRANSPARENT_BLUE_VALUE   0x3035
117#define EGL_TRANSPARENT_GREEN_VALUE   0x3036
118#define EGL_TRANSPARENT_RED_VALUE   0x3037
119#define EGL_NONE         0x3038   /* Attrib list terminator */
120#define EGL_BIND_TO_TEXTURE_RGB      0x3039
121#define EGL_BIND_TO_TEXTURE_RGBA   0x303A
122#define EGL_MIN_SWAP_INTERVAL      0x303B
123#define EGL_MAX_SWAP_INTERVAL      0x303C
124#define EGL_LUMINANCE_SIZE      0x303D
125#define EGL_ALPHA_MASK_SIZE      0x303E
126#define EGL_COLOR_BUFFER_TYPE      0x303F
127#define EGL_RENDERABLE_TYPE      0x3040
128#define EGL_MATCH_NATIVE_PIXMAP      0x3041   /* Pseudo-attribute (not queryable) */
129#define EGL_CONFORMANT         0x3042
130
131/* Reserved 0x3041-0x304F for additional config attributes */
132
133/* Config attribute values */
134#define EGL_SLOW_CONFIG         0x3050   /* EGL_CONFIG_CAVEAT value */
135#define EGL_NON_CONFORMANT_CONFIG   0x3051   /* EGL_CONFIG_CAVEAT value */
136#define EGL_TRANSPARENT_RGB      0x3052   /* EGL_TRANSPARENT_TYPE value */
137#define EGL_RGB_BUFFER         0x308E   /* EGL_COLOR_BUFFER_TYPE value */
138#define EGL_LUMINANCE_BUFFER      0x308F   /* EGL_COLOR_BUFFER_TYPE value */
139
140/* More config attribute values, for EGL_TEXTURE_FORMAT */
141#define EGL_NO_TEXTURE         0x305C
142#define EGL_TEXTURE_RGB         0x305D
143#define EGL_TEXTURE_RGBA      0x305E
144#define EGL_TEXTURE_2D         0x305F
145
146/* Config attribute mask bits */
147#define EGL_PBUFFER_BIT         0x0001   /* EGL_SURFACE_TYPE mask bits */
148#define EGL_PIXMAP_BIT         0x0002   /* EGL_SURFACE_TYPE mask bits */
149#define EGL_WINDOW_BIT         0x0004   /* EGL_SURFACE_TYPE mask bits */
150#define EGL_VG_COLORSPACE_LINEAR_BIT   0x0020   /* EGL_SURFACE_TYPE mask bits */
151#define EGL_VG_ALPHA_FORMAT_PRE_BIT   0x0040   /* EGL_SURFACE_TYPE mask bits */
152#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200   /* EGL_SURFACE_TYPE mask bits */
153#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400   /* EGL_SURFACE_TYPE mask bits */
154
155#define EGL_OPENGL_ES_BIT      0x0001   /* EGL_RENDERABLE_TYPE mask bits */
156#define EGL_OPENVG_BIT         0x0002   /* EGL_RENDERABLE_TYPE mask bits */
157#define EGL_OPENGL_ES2_BIT      0x0004   /* EGL_RENDERABLE_TYPE mask bits */
158#define EGL_OPENGL_BIT         0x0008   /* EGL_RENDERABLE_TYPE mask bits */
159
160/* QueryString targets */
161#define EGL_VENDOR         0x3053
162#define EGL_VERSION         0x3054
163#define EGL_EXTENSIONS         0x3055
164#define EGL_CLIENT_APIS         0x308D
165
166/* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */
167#define EGL_HEIGHT         0x3056
168#define EGL_WIDTH         0x3057
169#define EGL_LARGEST_PBUFFER      0x3058
170#define EGL_TEXTURE_FORMAT      0x3080
171#define EGL_TEXTURE_TARGET      0x3081
172#define EGL_MIPMAP_TEXTURE      0x3082
173#define EGL_MIPMAP_LEVEL      0x3083
174#define EGL_RENDER_BUFFER      0x3086
175#define EGL_VG_COLORSPACE      0x3087
176#define EGL_VG_ALPHA_FORMAT      0x3088
177#define EGL_HORIZONTAL_RESOLUTION   0x3090
178#define EGL_VERTICAL_RESOLUTION      0x3091
179#define EGL_PIXEL_ASPECT_RATIO      0x3092
180#define EGL_SWAP_BEHAVIOR      0x3093
181#define EGL_MULTISAMPLE_RESOLVE      0x3099
182
183/* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */
184#define EGL_BACK_BUFFER         0x3084
185#define EGL_SINGLE_BUFFER      0x3085
186
187/* OpenVG color spaces */
188#define EGL_VG_COLORSPACE_sRGB      0x3089   /* EGL_VG_COLORSPACE value */
189#define EGL_VG_COLORSPACE_LINEAR   0x308A   /* EGL_VG_COLORSPACE value */
190
191/* OpenVG alpha formats */
192#define EGL_VG_ALPHA_FORMAT_NONPRE   0x308B   /* EGL_ALPHA_FORMAT value */
193#define EGL_VG_ALPHA_FORMAT_PRE      0x308C   /* EGL_ALPHA_FORMAT value */
194
195/* Constant scale factor by which fractional display resolutions &
196 * aspect ratio are scaled when queried as integer values.
197 */
198#define EGL_DISPLAY_SCALING      10000
199
200/* Unknown display resolution/aspect ratio */
201#define EGL_UNKNOWN         ((EGLint)-1)
202
203/* Back buffer swap behaviors */
204#define EGL_BUFFER_PRESERVED      0x3094   /* EGL_SWAP_BEHAVIOR value */
205#define EGL_BUFFER_DESTROYED      0x3095   /* EGL_SWAP_BEHAVIOR value */
206
207/* CreatePbufferFromClientBuffer buffer types */
208#define EGL_OPENVG_IMAGE      0x3096
209
210/* QueryContext targets */
211#define EGL_CONTEXT_CLIENT_TYPE      0x3097
212
213/* CreateContext attributes */
214#define EGL_CONTEXT_CLIENT_VERSION   0x3098
215
216/* Multisample resolution behaviors */
217#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A   /* EGL_MULTISAMPLE_RESOLVE value */
218#define EGL_MULTISAMPLE_RESOLVE_BOX   0x309B   /* EGL_MULTISAMPLE_RESOLVE value */
219
220/* BindAPI/QueryAPI targets */
221#define EGL_OPENGL_ES_API      0x30A0
222#define EGL_OPENVG_API         0x30A1
223#define EGL_OPENGL_API         0x30A2
224
225/* GetCurrentSurface targets */
226#define EGL_DRAW         0x3059
227#define EGL_READ         0x305A
228
229/* WaitNative engines */
230#define EGL_CORE_NATIVE_ENGINE      0x305B
231
232/* EGL 1.2 tokens renamed for consistency in EGL 1.3 */
233#define EGL_COLORSPACE         EGL_VG_COLORSPACE
234#define EGL_ALPHA_FORMAT      EGL_VG_ALPHA_FORMAT
235#define EGL_COLORSPACE_sRGB      EGL_VG_COLORSPACE_sRGB
236#define EGL_COLORSPACE_LINEAR      EGL_VG_COLORSPACE_LINEAR
237#define EGL_ALPHA_FORMAT_NONPRE      EGL_VG_ALPHA_FORMAT_NONPRE
238#define EGL_ALPHA_FORMAT_PRE      EGL_VG_ALPHA_FORMAT_PRE
239
240/* EGL extensions must request enum blocks from the Khronos
241 * API Registrar, who maintains the enumerant registry. Submit
242 * a bug in Khronos Bugzilla against task "Registry".
243 */
244
245
246
247/* EGL Functions */
248
249EGLAPI EGLint EGLAPIENTRY eglGetError(void);
250
251EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id);
252EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
253EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy);
254
255EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name);
256
257EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs,
258          EGLint config_size, EGLint *num_config);
259EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list,
260            EGLConfig *configs, EGLint config_size,
261            EGLint *num_config);
262EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config,
263               EGLint attribute, EGLint *value);
264
265EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config,
266              EGLNativeWindowType win,
267              const EGLint *attrib_list);
268EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config,
269               const EGLint *attrib_list);
270EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config,
271              EGLNativePixmapType pixmap,
272              const EGLint *attrib_list);
273EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
274EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface,
275            EGLint attribute, EGLint *value);
276
277EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api);
278EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void);
279
280EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void);
281
282EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void);
283
284EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(
285         EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
286         EGLConfig config, const EGLint *attrib_list);
287
288EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface,
289             EGLint attribute, EGLint value);
290EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
291EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
292
293
294EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
295
296
297EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config,
298             EGLContext share_context,
299             const EGLint *attrib_list);
300EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
301EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw,
302           EGLSurface read, EGLContext ctx);
303
304EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void);
305EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw);
306EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void);
307EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx,
308            EGLint attribute, EGLint *value);
309
310EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void);
311EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine);
312EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface);
313EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface,
314           EGLNativePixmapType target);
315
316/* This is a generic function pointer type, whose name indicates it must
317 * be cast to the proper type *and calling convention* before use.
318 */
319typedef void (*__eglMustCastToProperFunctionPointerType)(void);
320
321/* Now, define eglGetProcAddress using the generic function ptr. type */
322EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY
323       eglGetProcAddress(const char *procname);
324
325#ifdef __cplusplus
326}
327#endif
328
329#endif /* __egl_h_ */
Property changes on: branches/osd/src/lib/khronos/EGL/egl.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/EGL/eglext.h
r0r31734
1#ifndef __eglext_h_
2#define __eglext_h_ 1
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/*
9** Copyright (c) 2013 The Khronos Group Inc.
10**
11** Permission is hereby granted, free of charge, to any person obtaining a
12** copy of this software and/or associated documentation files (the
13** "Materials"), to deal in the Materials without restriction, including
14** without limitation the rights to use, copy, modify, merge, publish,
15** distribute, sublicense, and/or sell copies of the Materials, and to
16** permit persons to whom the Materials are furnished to do so, subject to
17** the following conditions:
18**
19** The above copyright notice and this permission notice shall be included
20** in all copies or substantial portions of the Materials.
21**
22** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
29*/
30/*
31** This header is generated from the Khronos OpenGL / OpenGL ES XML
32** API Registry. The current version of the Registry, generator scripts
33** used to make the header, and the header can be found at
34**   http://www.opengl.org/registry/
35**
36** Khronos $Revision: 23730 $ on $Date: 2013-10-28 15:16:34 -0700 (Mon, 28 Oct 2013) $
37*/
38
39#include <EGL/eglplatform.h>
40
41#define EGL_EGLEXT_VERSION 20131028
42
43/* Generated C header for:
44 * API: egl
45 * Versions considered: .*
46 * Versions emitted: _nomatch_^
47 * Default extensions included: egl
48 * Additional extensions included: _nomatch_^
49 * Extensions removed: _nomatch_^
50 */
51
52#ifndef EGL_KHR_cl_event
53#define EGL_KHR_cl_event 1
54#define EGL_CL_EVENT_HANDLE_KHR           0x309C
55#define EGL_SYNC_CL_EVENT_KHR             0x30FE
56#define EGL_SYNC_CL_EVENT_COMPLETE_KHR    0x30FF
57#endif /* EGL_KHR_cl_event */
58
59#ifndef EGL_KHR_client_get_all_proc_addresses
60#define EGL_KHR_client_get_all_proc_addresses 1
61#endif /* EGL_KHR_client_get_all_proc_addresses */
62
63#ifndef EGL_KHR_config_attribs
64#define EGL_KHR_config_attribs 1
65#define EGL_CONFORMANT_KHR                0x3042
66#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR  0x0020
67#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR   0x0040
68#endif /* EGL_KHR_config_attribs */
69
70#ifndef EGL_KHR_create_context
71#define EGL_KHR_create_context 1
72#define EGL_CONTEXT_MAJOR_VERSION_KHR     0x3098
73#define EGL_CONTEXT_MINOR_VERSION_KHR     0x30FB
74#define EGL_CONTEXT_FLAGS_KHR             0x30FC
75#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
76#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
77#define EGL_NO_RESET_NOTIFICATION_KHR     0x31BE
78#define EGL_LOSE_CONTEXT_ON_RESET_KHR     0x31BF
79#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR  0x00000001
80#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
81#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
82#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
83#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
84#define EGL_OPENGL_ES3_BIT_KHR            0x00000040
85#endif /* EGL_KHR_create_context */
86
87#ifndef EGL_KHR_fence_sync
88#define EGL_KHR_fence_sync 1
89#ifdef KHRONOS_SUPPORT_INT64
90#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
91#define EGL_SYNC_CONDITION_KHR            0x30F8
92#define EGL_SYNC_FENCE_KHR                0x30F9
93#endif /* KHRONOS_SUPPORT_INT64 */
94#endif /* EGL_KHR_fence_sync */
95
96#ifndef EGL_KHR_get_all_proc_addresses
97#define EGL_KHR_get_all_proc_addresses 1
98#endif /* EGL_KHR_get_all_proc_addresses */
99
100#ifndef EGL_KHR_gl_renderbuffer_image
101#define EGL_KHR_gl_renderbuffer_image 1
102#define EGL_GL_RENDERBUFFER_KHR           0x30B9
103#endif /* EGL_KHR_gl_renderbuffer_image */
104
105#ifndef EGL_KHR_gl_texture_2D_image
106#define EGL_KHR_gl_texture_2D_image 1
107#define EGL_GL_TEXTURE_2D_KHR             0x30B1
108#define EGL_GL_TEXTURE_LEVEL_KHR          0x30BC
109#endif /* EGL_KHR_gl_texture_2D_image */
110
111#ifndef EGL_KHR_gl_texture_3D_image
112#define EGL_KHR_gl_texture_3D_image 1
113#define EGL_GL_TEXTURE_3D_KHR             0x30B2
114#define EGL_GL_TEXTURE_ZOFFSET_KHR        0x30BD
115#endif /* EGL_KHR_gl_texture_3D_image */
116
117#ifndef EGL_KHR_gl_texture_cubemap_image
118#define EGL_KHR_gl_texture_cubemap_image 1
119#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
120#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
121#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
122#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
123#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
124#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
125#endif /* EGL_KHR_gl_texture_cubemap_image */
126
127#ifndef EGL_KHR_image
128#define EGL_KHR_image 1
129typedef void *EGLImageKHR;
130#define EGL_NATIVE_PIXMAP_KHR             0x30B0
131#define EGL_NO_IMAGE_KHR                  ((EGLImageKHR)0)
132typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
133typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
134#ifdef EGL_EGLEXT_PROTOTYPES
135EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
136EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
137#endif
138#endif /* EGL_KHR_image */
139
140#ifndef EGL_KHR_image_base
141#define EGL_KHR_image_base 1
142#define EGL_IMAGE_PRESERVED_KHR           0x30D2
143#endif /* EGL_KHR_image_base */
144
145#ifndef EGL_KHR_image_pixmap
146#define EGL_KHR_image_pixmap 1
147#endif /* EGL_KHR_image_pixmap */
148
149#ifndef EGL_KHR_lock_surface
150#define EGL_KHR_lock_surface 1
151#define EGL_READ_SURFACE_BIT_KHR          0x0001
152#define EGL_WRITE_SURFACE_BIT_KHR         0x0002
153#define EGL_LOCK_SURFACE_BIT_KHR          0x0080
154#define EGL_OPTIMAL_FORMAT_BIT_KHR        0x0100
155#define EGL_MATCH_FORMAT_KHR              0x3043
156#define EGL_FORMAT_RGB_565_EXACT_KHR      0x30C0
157#define EGL_FORMAT_RGB_565_KHR            0x30C1
158#define EGL_FORMAT_RGBA_8888_EXACT_KHR    0x30C2
159#define EGL_FORMAT_RGBA_8888_KHR          0x30C3
160#define EGL_MAP_PRESERVE_PIXELS_KHR       0x30C4
161#define EGL_LOCK_USAGE_HINT_KHR           0x30C5
162#define EGL_BITMAP_POINTER_KHR            0x30C6
163#define EGL_BITMAP_PITCH_KHR              0x30C7
164#define EGL_BITMAP_ORIGIN_KHR             0x30C8
165#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR   0x30C9
166#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
167#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR  0x30CB
168#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
169#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
170#define EGL_LOWER_LEFT_KHR                0x30CE
171#define EGL_UPPER_LEFT_KHR                0x30CF
172typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
173typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
174#ifdef EGL_EGLEXT_PROTOTYPES
175EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
176EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
177#endif
178#endif /* EGL_KHR_lock_surface */
179
180#ifndef EGL_KHR_lock_surface2
181#define EGL_KHR_lock_surface2 1
182#define EGL_BITMAP_PIXEL_SIZE_KHR         0x3110
183#endif /* EGL_KHR_lock_surface2 */
184
185#ifndef EGL_KHR_reusable_sync
186#define EGL_KHR_reusable_sync 1
187typedef void *EGLSyncKHR;
188typedef khronos_utime_nanoseconds_t EGLTimeKHR;
189#ifdef KHRONOS_SUPPORT_INT64
190#define EGL_SYNC_STATUS_KHR               0x30F1
191#define EGL_SIGNALED_KHR                  0x30F2
192#define EGL_UNSIGNALED_KHR                0x30F3
193#define EGL_TIMEOUT_EXPIRED_KHR           0x30F5
194#define EGL_CONDITION_SATISFIED_KHR       0x30F6
195#define EGL_SYNC_TYPE_KHR                 0x30F7
196#define EGL_SYNC_REUSABLE_KHR             0x30FA
197#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR   0x0001
198#define EGL_FOREVER_KHR                   0xFFFFFFFFFFFFFFFFull
199#define EGL_NO_SYNC_KHR                   ((EGLSyncKHR)0)
200typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
201typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
202typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
203typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
204typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
205#ifdef EGL_EGLEXT_PROTOTYPES
206EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
207EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
208EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
209EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
210EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
211#endif
212#endif /* KHRONOS_SUPPORT_INT64 */
213#endif /* EGL_KHR_reusable_sync */
214
215#ifndef EGL_KHR_stream
216#define EGL_KHR_stream 1
217typedef void *EGLStreamKHR;
218typedef khronos_uint64_t EGLuint64KHR;
219#ifdef KHRONOS_SUPPORT_INT64
220#define EGL_NO_STREAM_KHR                 ((EGLStreamKHR)0)
221#define EGL_CONSUMER_LATENCY_USEC_KHR     0x3210
222#define EGL_PRODUCER_FRAME_KHR            0x3212
223#define EGL_CONSUMER_FRAME_KHR            0x3213
224#define EGL_STREAM_STATE_KHR              0x3214
225#define EGL_STREAM_STATE_CREATED_KHR      0x3215
226#define EGL_STREAM_STATE_CONNECTING_KHR   0x3216
227#define EGL_STREAM_STATE_EMPTY_KHR        0x3217
228#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
229#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
230#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
231#define EGL_BAD_STREAM_KHR                0x321B
232#define EGL_BAD_STATE_KHR                 0x321C
233typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
234typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
235typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
236typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
237typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
238#ifdef EGL_EGLEXT_PROTOTYPES
239EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
240EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
241EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
242EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
243EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
244#endif
245#endif /* KHRONOS_SUPPORT_INT64 */
246#endif /* EGL_KHR_stream */
247
248#ifndef EGL_KHR_stream_consumer_gltexture
249#define EGL_KHR_stream_consumer_gltexture 1
250#ifdef EGL_KHR_stream
251#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
252typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
253typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
254typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
255#ifdef EGL_EGLEXT_PROTOTYPES
256EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
257EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
258EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
259#endif
260#endif /* EGL_KHR_stream */
261#endif /* EGL_KHR_stream_consumer_gltexture */
262
263#ifndef EGL_KHR_stream_cross_process_fd
264#define EGL_KHR_stream_cross_process_fd 1
265typedef int EGLNativeFileDescriptorKHR;
266#ifdef EGL_KHR_stream
267#define EGL_NO_FILE_DESCRIPTOR_KHR        ((EGLNativeFileDescriptorKHR)(-1))
268typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
269typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
270#ifdef EGL_EGLEXT_PROTOTYPES
271EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
272EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
273#endif
274#endif /* EGL_KHR_stream */
275#endif /* EGL_KHR_stream_cross_process_fd */
276
277#ifndef EGL_KHR_stream_fifo
278#define EGL_KHR_stream_fifo 1
279#ifdef EGL_KHR_stream
280#define EGL_STREAM_FIFO_LENGTH_KHR        0x31FC
281#define EGL_STREAM_TIME_NOW_KHR           0x31FD
282#define EGL_STREAM_TIME_CONSUMER_KHR      0x31FE
283#define EGL_STREAM_TIME_PRODUCER_KHR      0x31FF
284typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
285#ifdef EGL_EGLEXT_PROTOTYPES
286EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
287#endif
288#endif /* EGL_KHR_stream */
289#endif /* EGL_KHR_stream_fifo */
290
291#ifndef EGL_KHR_stream_producer_aldatalocator
292#define EGL_KHR_stream_producer_aldatalocator 1
293#ifdef EGL_KHR_stream
294#endif /* EGL_KHR_stream */
295#endif /* EGL_KHR_stream_producer_aldatalocator */
296
297#ifndef EGL_KHR_stream_producer_eglsurface
298#define EGL_KHR_stream_producer_eglsurface 1
299#ifdef EGL_KHR_stream
300#define EGL_STREAM_BIT_KHR                0x0800
301typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
302#ifdef EGL_EGLEXT_PROTOTYPES
303EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
304#endif
305#endif /* EGL_KHR_stream */
306#endif /* EGL_KHR_stream_producer_eglsurface */
307
308#ifndef EGL_KHR_surfaceless_context
309#define EGL_KHR_surfaceless_context 1
310#endif /* EGL_KHR_surfaceless_context */
311
312#ifndef EGL_KHR_vg_parent_image
313#define EGL_KHR_vg_parent_image 1
314#define EGL_VG_PARENT_IMAGE_KHR           0x30BA
315#endif /* EGL_KHR_vg_parent_image */
316
317#ifndef EGL_KHR_wait_sync
318#define EGL_KHR_wait_sync 1
319typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
320#ifdef EGL_EGLEXT_PROTOTYPES
321EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
322#endif
323#endif /* EGL_KHR_wait_sync */
324
325#ifndef EGL_ANDROID_blob_cache
326#define EGL_ANDROID_blob_cache 1
327typedef khronos_ssize_t EGLsizeiANDROID;
328typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
329typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
330typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
331#ifdef EGL_EGLEXT_PROTOTYPES
332EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
333#endif
334#endif /* EGL_ANDROID_blob_cache */
335
336#ifndef EGL_ANDROID_framebuffer_target
337#define EGL_ANDROID_framebuffer_target 1
338#define EGL_FRAMEBUFFER_TARGET_ANDROID    0x3147
339#endif /* EGL_ANDROID_framebuffer_target */
340
341#ifndef EGL_ANDROID_image_native_buffer
342#define EGL_ANDROID_image_native_buffer 1
343#define EGL_NATIVE_BUFFER_ANDROID         0x3140
344#endif /* EGL_ANDROID_image_native_buffer */
345
346#ifndef EGL_ANDROID_native_fence_sync
347#define EGL_ANDROID_native_fence_sync 1
348#define EGL_SYNC_NATIVE_FENCE_ANDROID     0x3144
349#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID  0x3145
350#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
351#define EGL_NO_NATIVE_FENCE_FD_ANDROID    -1
352typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
353#ifdef EGL_EGLEXT_PROTOTYPES
354EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
355#endif
356#endif /* EGL_ANDROID_native_fence_sync */
357
358#ifndef EGL_ANDROID_recordable
359#define EGL_ANDROID_recordable 1
360#define EGL_RECORDABLE_ANDROID            0x3142
361#endif /* EGL_ANDROID_recordable */
362
363#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
364#define EGL_ANGLE_d3d_share_handle_client_buffer 1
365#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
366#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
367
368#ifndef EGL_ANGLE_query_surface_pointer
369#define EGL_ANGLE_query_surface_pointer 1
370typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
371#ifdef EGL_EGLEXT_PROTOTYPES
372EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
373#endif
374#endif /* EGL_ANGLE_query_surface_pointer */
375
376#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
377#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
378#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
379
380#ifndef EGL_ARM_pixmap_multisample_discard
381#define EGL_ARM_pixmap_multisample_discard 1
382#define EGL_DISCARD_SAMPLES_ARM           0x3286
383#endif /* EGL_ARM_pixmap_multisample_discard */
384
385#ifndef EGL_EXT_buffer_age
386#define EGL_EXT_buffer_age 1
387#define EGL_BUFFER_AGE_EXT                0x313D
388#endif /* EGL_EXT_buffer_age */
389
390#ifndef EGL_EXT_client_extensions
391#define EGL_EXT_client_extensions 1
392#endif /* EGL_EXT_client_extensions */
393
394#ifndef EGL_EXT_create_context_robustness
395#define EGL_EXT_create_context_robustness 1
396#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
397#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
398#define EGL_NO_RESET_NOTIFICATION_EXT     0x31BE
399#define EGL_LOSE_CONTEXT_ON_RESET_EXT     0x31BF
400#endif /* EGL_EXT_create_context_robustness */
401
402#ifndef EGL_EXT_image_dma_buf_import
403#define EGL_EXT_image_dma_buf_import 1
404#define EGL_LINUX_DMA_BUF_EXT             0x3270
405#define EGL_LINUX_DRM_FOURCC_EXT          0x3271
406#define EGL_DMA_BUF_PLANE0_FD_EXT         0x3272
407#define EGL_DMA_BUF_PLANE0_OFFSET_EXT     0x3273
408#define EGL_DMA_BUF_PLANE0_PITCH_EXT      0x3274
409#define EGL_DMA_BUF_PLANE1_FD_EXT         0x3275
410#define EGL_DMA_BUF_PLANE1_OFFSET_EXT     0x3276
411#define EGL_DMA_BUF_PLANE1_PITCH_EXT      0x3277
412#define EGL_DMA_BUF_PLANE2_FD_EXT         0x3278
413#define EGL_DMA_BUF_PLANE2_OFFSET_EXT     0x3279
414#define EGL_DMA_BUF_PLANE2_PITCH_EXT      0x327A
415#define EGL_YUV_COLOR_SPACE_HINT_EXT      0x327B
416#define EGL_SAMPLE_RANGE_HINT_EXT         0x327C
417#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
418#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
419#define EGL_ITU_REC601_EXT                0x327F
420#define EGL_ITU_REC709_EXT                0x3280
421#define EGL_ITU_REC2020_EXT               0x3281
422#define EGL_YUV_FULL_RANGE_EXT            0x3282
423#define EGL_YUV_NARROW_RANGE_EXT          0x3283
424#define EGL_YUV_CHROMA_SITING_0_EXT       0x3284
425#define EGL_YUV_CHROMA_SITING_0_5_EXT     0x3285
426#endif /* EGL_EXT_image_dma_buf_import */
427
428#ifndef EGL_EXT_multiview_window
429#define EGL_EXT_multiview_window 1
430#define EGL_MULTIVIEW_VIEW_COUNT_EXT      0x3134
431#endif /* EGL_EXT_multiview_window */
432
433#ifndef EGL_EXT_platform_base
434#define EGL_EXT_platform_base 1
435typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
436typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
437typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
438#ifdef EGL_EGLEXT_PROTOTYPES
439EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
440EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
441EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
442#endif
443#endif /* EGL_EXT_platform_base */
444
445#ifndef EGL_EXT_platform_wayland
446#define EGL_EXT_platform_wayland 1
447#define EGL_PLATFORM_WAYLAND_EXT          0x31D8
448#endif /* EGL_EXT_platform_wayland */
449
450#ifndef EGL_EXT_platform_x11
451#define EGL_EXT_platform_x11 1
452#define EGL_PLATFORM_X11_EXT              0x31D5
453#define EGL_PLATFORM_X11_SCREEN_EXT       0x31D6
454#endif /* EGL_EXT_platform_x11 */
455
456#ifndef EGL_EXT_swap_buffers_with_damage
457#define EGL_EXT_swap_buffers_with_damage 1
458typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
459#ifdef EGL_EGLEXT_PROTOTYPES
460EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
461#endif
462#endif /* EGL_EXT_swap_buffers_with_damage */
463
464#ifndef EGL_HI_clientpixmap
465#define EGL_HI_clientpixmap 1
466struct EGLClientPixmapHI {
467    void  *pData;
468    EGLint iWidth;
469    EGLint iHeight;
470    EGLint iStride;
471};
472#define EGL_CLIENT_PIXMAP_POINTER_HI      0x8F74
473typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
474#ifdef EGL_EGLEXT_PROTOTYPES
475EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
476#endif
477#endif /* EGL_HI_clientpixmap */
478
479#ifndef EGL_HI_colorformats
480#define EGL_HI_colorformats 1
481#define EGL_COLOR_FORMAT_HI               0x8F70
482#define EGL_COLOR_RGB_HI                  0x8F71
483#define EGL_COLOR_RGBA_HI                 0x8F72
484#define EGL_COLOR_ARGB_HI                 0x8F73
485#endif /* EGL_HI_colorformats */
486
487#ifndef EGL_IMG_context_priority
488#define EGL_IMG_context_priority 1
489#define EGL_CONTEXT_PRIORITY_LEVEL_IMG    0x3100
490#define EGL_CONTEXT_PRIORITY_HIGH_IMG     0x3101
491#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG   0x3102
492#define EGL_CONTEXT_PRIORITY_LOW_IMG      0x3103
493#endif /* EGL_IMG_context_priority */
494
495#ifndef EGL_MESA_drm_image
496#define EGL_MESA_drm_image 1
497#define EGL_DRM_BUFFER_FORMAT_MESA        0x31D0
498#define EGL_DRM_BUFFER_USE_MESA           0x31D1
499#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
500#define EGL_DRM_BUFFER_MESA               0x31D3
501#define EGL_DRM_BUFFER_STRIDE_MESA        0x31D4
502#define EGL_DRM_BUFFER_USE_SCANOUT_MESA   0x00000001
503#define EGL_DRM_BUFFER_USE_SHARE_MESA     0x00000002
504typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
505typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
506#ifdef EGL_EGLEXT_PROTOTYPES
507EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
508EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
509#endif
510#endif /* EGL_MESA_drm_image */
511
512#ifndef EGL_MESA_platform_gbm
513#define EGL_MESA_platform_gbm 1
514#define EGL_PLATFORM_GBM_MESA             0x31D7
515#endif /* EGL_MESA_platform_gbm */
516
517#ifndef EGL_NV_3dvision_surface
518#define EGL_NV_3dvision_surface 1
519#define EGL_AUTO_STEREO_NV                0x3136
520#endif /* EGL_NV_3dvision_surface */
521
522#ifndef EGL_NV_coverage_sample
523#define EGL_NV_coverage_sample 1
524#define EGL_COVERAGE_BUFFERS_NV           0x30E0
525#define EGL_COVERAGE_SAMPLES_NV           0x30E1
526#endif /* EGL_NV_coverage_sample */
527
528#ifndef EGL_NV_coverage_sample_resolve
529#define EGL_NV_coverage_sample_resolve 1
530#define EGL_COVERAGE_SAMPLE_RESOLVE_NV    0x3131
531#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
532#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
533#endif /* EGL_NV_coverage_sample_resolve */
534
535#ifndef EGL_NV_depth_nonlinear
536#define EGL_NV_depth_nonlinear 1
537#define EGL_DEPTH_ENCODING_NV             0x30E2
538#define EGL_DEPTH_ENCODING_NONE_NV        0
539#define EGL_DEPTH_ENCODING_NONLINEAR_NV   0x30E3
540#endif /* EGL_NV_depth_nonlinear */
541
542#ifndef EGL_NV_native_query
543#define EGL_NV_native_query 1
544typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
545typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
546typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
547#ifdef EGL_EGLEXT_PROTOTYPES
548EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
549EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
550EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
551#endif
552#endif /* EGL_NV_native_query */
553
554#ifndef EGL_NV_post_convert_rounding
555#define EGL_NV_post_convert_rounding 1
556#endif /* EGL_NV_post_convert_rounding */
557
558#ifndef EGL_NV_post_sub_buffer
559#define EGL_NV_post_sub_buffer 1
560#define EGL_POST_SUB_BUFFER_SUPPORTED_NV  0x30BE
561typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
562#ifdef EGL_EGLEXT_PROTOTYPES
563EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
564#endif
565#endif /* EGL_NV_post_sub_buffer */
566
567#ifndef EGL_NV_stream_sync
568#define EGL_NV_stream_sync 1
569#define EGL_SYNC_NEW_FRAME_NV             0x321F
570typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
571#ifdef EGL_EGLEXT_PROTOTYPES
572EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
573#endif
574#endif /* EGL_NV_stream_sync */
575
576#ifndef EGL_NV_sync
577#define EGL_NV_sync 1
578typedef void *EGLSyncNV;
579typedef khronos_utime_nanoseconds_t EGLTimeNV;
580#ifdef KHRONOS_SUPPORT_INT64
581#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
582#define EGL_SYNC_STATUS_NV                0x30E7
583#define EGL_SIGNALED_NV                   0x30E8
584#define EGL_UNSIGNALED_NV                 0x30E9
585#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV    0x0001
586#define EGL_FOREVER_NV                    0xFFFFFFFFFFFFFFFFull
587#define EGL_ALREADY_SIGNALED_NV           0x30EA
588#define EGL_TIMEOUT_EXPIRED_NV            0x30EB
589#define EGL_CONDITION_SATISFIED_NV        0x30EC
590#define EGL_SYNC_TYPE_NV                  0x30ED
591#define EGL_SYNC_CONDITION_NV             0x30EE
592#define EGL_SYNC_FENCE_NV                 0x30EF
593#define EGL_NO_SYNC_NV                    ((EGLSyncNV)0)
594typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
595typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
596typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
597typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
598typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
599typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
600#ifdef EGL_EGLEXT_PROTOTYPES
601EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
602EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
603EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
604EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
605EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
606EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
607#endif
608#endif /* KHRONOS_SUPPORT_INT64 */
609#endif /* EGL_NV_sync */
610
611#ifndef EGL_NV_system_time
612#define EGL_NV_system_time 1
613typedef khronos_utime_nanoseconds_t EGLuint64NV;
614#ifdef KHRONOS_SUPPORT_INT64
615typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
616typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
617#ifdef EGL_EGLEXT_PROTOTYPES
618EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
619EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
620#endif
621#endif /* KHRONOS_SUPPORT_INT64 */
622#endif /* EGL_NV_system_time */
623
624#ifdef __cplusplus
625}
626#endif
627
628#endif
Property changes on: branches/osd/src/lib/khronos/EGL/eglext.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/EGL/eglplatform.h
r0r31734
1#ifndef __eglplatform_h_
2#define __eglplatform_h_
3
4/*
5** Copyright (c) 2007-2013 The Khronos Group Inc.
6**
7** Permission is hereby granted, free of charge, to any person obtaining a
8** copy of this software and/or associated documentation files (the
9** "Materials"), to deal in the Materials without restriction, including
10** without limitation the rights to use, copy, modify, merge, publish,
11** distribute, sublicense, and/or sell copies of the Materials, and to
12** permit persons to whom the Materials are furnished to do so, subject to
13** the following conditions:
14**
15** The above copyright notice and this permission notice shall be included
16** in all copies or substantial portions of the Materials.
17**
18** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
25*/
26
27/* Platform-specific types and definitions for egl.h
28 * $Revision: 23432 $ on $Date: 2013-10-09 00:57:24 -0700 (Wed, 09 Oct 2013) $
29 *
30 * Adopters may modify khrplatform.h and this file to suit their platform.
31 * You are encouraged to submit all modifications to the Khronos group so that
32 * they can be included in future versions of this file.  Please submit changes
33 * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
34 * by filing a bug against product "EGL" component "Registry".
35 */
36
37#include <KHR/khrplatform.h>
38
39/* Macros used in EGL function prototype declarations.
40 *
41 * EGL functions should be prototyped as:
42 *
43 * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
44 * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
45 *
46 * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
47 */
48
49#ifndef EGLAPI
50#define EGLAPI KHRONOS_APICALL
51#endif
52
53#ifndef EGLAPIENTRY
54#define EGLAPIENTRY  KHRONOS_APIENTRY
55#endif
56#define EGLAPIENTRYP EGLAPIENTRY*
57
58/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
59 * are aliases of window-system-dependent types, such as X Display * or
60 * Windows Device Context. They must be defined in platform-specific
61 * code below. The EGL-prefixed versions of Native*Type are the same
62 * types, renamed in EGL 1.3 so all types in the API start with "EGL".
63 *
64 * Khronos STRONGLY RECOMMENDS that you use the default definitions
65 * provided below, since these changes affect both binary and source
66 * portability of applications using EGL running on different EGL
67 * implementations.
68 */
69
70#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
71#ifndef WIN32_LEAN_AND_MEAN
72#define WIN32_LEAN_AND_MEAN 1
73#endif
74#include <windows.h>
75
76typedef HDC     EGLNativeDisplayType;
77typedef HBITMAP EGLNativePixmapType;
78typedef HWND    EGLNativeWindowType;
79
80#elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
81
82typedef int   EGLNativeDisplayType;
83typedef void *EGLNativeWindowType;
84typedef void *EGLNativePixmapType;
85
86#elif defined(__ANDROID__) || defined(ANDROID)
87
88#include <android/native_window.h>
89
90struct egl_native_pixmap_t;
91
92typedef struct ANativeWindow*           EGLNativeWindowType;
93typedef struct egl_native_pixmap_t*     EGLNativePixmapType;
94typedef void*                           EGLNativeDisplayType;
95
96#elif defined(__unix__)
97
98/* X11 (tentative)  */
99#include <X11/Xlib.h>
100#include <X11/Xutil.h>
101
102typedef Display *EGLNativeDisplayType;
103typedef Pixmap   EGLNativePixmapType;
104typedef Window   EGLNativeWindowType;
105
106#else
107#error "Platform not recognized"
108#endif
109
110/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
111typedef EGLNativeDisplayType NativeDisplayType;
112typedef EGLNativePixmapType  NativePixmapType;
113typedef EGLNativeWindowType  NativeWindowType;
114
115
116/* Define EGLint. This must be a signed integral type large enough to contain
117 * all legal attribute names and values passed into and out of EGL, whether
118 * their type is boolean, bitmask, enumerant (symbolic constant), integer,
119 * handle, or other.  While in general a 32-bit integer will suffice, if
120 * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
121 * integer type.
122 */
123typedef khronos_int32_t EGLint;
124
125#endif /* __eglplatform_h */
Property changes on: branches/osd/src/lib/khronos/EGL/eglplatform.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/khronos/wgl/wglext.h
r0r31734
1#ifndef __wglext_h_
2#define __wglext_h_ 1
3
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/*
9** Copyright (c) 2013 The Khronos Group Inc.
10**
11** Permission is hereby granted, free of charge, to any person obtaining a
12** copy of this software and/or associated documentation files (the
13** "Materials"), to deal in the Materials without restriction, including
14** without limitation the rights to use, copy, modify, merge, publish,
15** distribute, sublicense, and/or sell copies of the Materials, and to
16** permit persons to whom the Materials are furnished to do so, subject to
17** the following conditions:
18**
19** The above copyright notice and this permission notice shall be included
20** in all copies or substantial portions of the Materials.
21**
22** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
29*/
30/*
31** This header is generated from the Khronos OpenGL / OpenGL ES XML
32** API Registry. The current version of the Registry, generator scripts
33** used to make the header, and the header can be found at
34**   http://www.opengl.org/registry/
35**
36** Khronos $Revision: 23730 $ on $Date: 2013-10-28 15:16:34 -0700 (Mon, 28 Oct 2013) $
37*/
38
39#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
40#define WIN32_LEAN_AND_MEAN 1
41#include <windows.h>
42#endif
43
44#define WGL_WGLEXT_VERSION 20131028
45
46/* Generated C header for:
47 * API: wgl
48 * Versions considered: .*
49 * Versions emitted: _nomatch_^
50 * Default extensions included: wgl
51 * Additional extensions included: _nomatch_^
52 * Extensions removed: _nomatch_^
53 */
54
55#ifndef WGL_ARB_buffer_region
56#define WGL_ARB_buffer_region 1
57#define WGL_FRONT_COLOR_BUFFER_BIT_ARB    0x00000001
58#define WGL_BACK_COLOR_BUFFER_BIT_ARB     0x00000002
59#define WGL_DEPTH_BUFFER_BIT_ARB          0x00000004
60#define WGL_STENCIL_BUFFER_BIT_ARB        0x00000008
61typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
62typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
63typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
64typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
65#ifdef WGL_WGLEXT_PROTOTYPES
66HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
67VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
68BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
69BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
70#endif
71#endif /* WGL_ARB_buffer_region */
72
73#ifndef WGL_ARB_create_context
74#define WGL_ARB_create_context 1
75#define WGL_CONTEXT_DEBUG_BIT_ARB         0x00000001
76#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
77#define WGL_CONTEXT_MAJOR_VERSION_ARB     0x2091
78#define WGL_CONTEXT_MINOR_VERSION_ARB     0x2092
79#define WGL_CONTEXT_LAYER_PLANE_ARB       0x2093
80#define WGL_CONTEXT_FLAGS_ARB             0x2094
81#define ERROR_INVALID_VERSION_ARB         0x2095
82typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
83#ifdef WGL_WGLEXT_PROTOTYPES
84HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
85#endif
86#endif /* WGL_ARB_create_context */
87
88#ifndef WGL_ARB_create_context_profile
89#define WGL_ARB_create_context_profile 1
90#define WGL_CONTEXT_PROFILE_MASK_ARB      0x9126
91#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB  0x00000001
92#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
93#define ERROR_INVALID_PROFILE_ARB         0x2096
94#endif /* WGL_ARB_create_context_profile */
95
96#ifndef WGL_ARB_create_context_robustness
97#define WGL_ARB_create_context_robustness 1
98#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
99#define WGL_LOSE_CONTEXT_ON_RESET_ARB     0x8252
100#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
101#define WGL_NO_RESET_NOTIFICATION_ARB     0x8261
102#endif /* WGL_ARB_create_context_robustness */
103
104#ifndef WGL_ARB_extensions_string
105#define WGL_ARB_extensions_string 1
106typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
107#ifdef WGL_WGLEXT_PROTOTYPES
108const char *WINAPI wglGetExtensionsStringARB (HDC hdc);
109#endif
110#endif /* WGL_ARB_extensions_string */
111
112#ifndef WGL_ARB_framebuffer_sRGB
113#define WGL_ARB_framebuffer_sRGB 1
114#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB  0x20A9
115#endif /* WGL_ARB_framebuffer_sRGB */
116
117#ifndef WGL_ARB_make_current_read
118#define WGL_ARB_make_current_read 1
119#define ERROR_INVALID_PIXEL_TYPE_ARB      0x2043
120#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
121typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
122typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
123#ifdef WGL_WGLEXT_PROTOTYPES
124BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
125HDC WINAPI wglGetCurrentReadDCARB (void);
126#endif
127#endif /* WGL_ARB_make_current_read */
128
129#ifndef WGL_ARB_multisample
130#define WGL_ARB_multisample 1
131#define WGL_SAMPLE_BUFFERS_ARB            0x2041
132#define WGL_SAMPLES_ARB                   0x2042
133#endif /* WGL_ARB_multisample */
134
135#ifndef WGL_ARB_pbuffer
136#define WGL_ARB_pbuffer 1
137DECLARE_HANDLE(HPBUFFERARB);
138#define WGL_DRAW_TO_PBUFFER_ARB           0x202D
139#define WGL_MAX_PBUFFER_PIXELS_ARB        0x202E
140#define WGL_MAX_PBUFFER_WIDTH_ARB         0x202F
141#define WGL_MAX_PBUFFER_HEIGHT_ARB        0x2030
142#define WGL_PBUFFER_LARGEST_ARB           0x2033
143#define WGL_PBUFFER_WIDTH_ARB             0x2034
144#define WGL_PBUFFER_HEIGHT_ARB            0x2035
145#define WGL_PBUFFER_LOST_ARB              0x2036
146typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
147typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
148typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
149typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
150typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
151#ifdef WGL_WGLEXT_PROTOTYPES
152HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
153HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
154int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
155BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
156BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
157#endif
158#endif /* WGL_ARB_pbuffer */
159
160#ifndef WGL_ARB_pixel_format
161#define WGL_ARB_pixel_format 1
162#define WGL_NUMBER_PIXEL_FORMATS_ARB      0x2000
163#define WGL_DRAW_TO_WINDOW_ARB            0x2001
164#define WGL_DRAW_TO_BITMAP_ARB            0x2002
165#define WGL_ACCELERATION_ARB              0x2003
166#define WGL_NEED_PALETTE_ARB              0x2004
167#define WGL_NEED_SYSTEM_PALETTE_ARB       0x2005
168#define WGL_SWAP_LAYER_BUFFERS_ARB        0x2006
169#define WGL_SWAP_METHOD_ARB               0x2007
170#define WGL_NUMBER_OVERLAYS_ARB           0x2008
171#define WGL_NUMBER_UNDERLAYS_ARB          0x2009
172#define WGL_TRANSPARENT_ARB               0x200A
173#define WGL_TRANSPARENT_RED_VALUE_ARB     0x2037
174#define WGL_TRANSPARENT_GREEN_VALUE_ARB   0x2038
175#define WGL_TRANSPARENT_BLUE_VALUE_ARB    0x2039
176#define WGL_TRANSPARENT_ALPHA_VALUE_ARB   0x203A
177#define WGL_TRANSPARENT_INDEX_VALUE_ARB   0x203B
178#define WGL_SHARE_DEPTH_ARB               0x200C
179#define WGL_SHARE_STENCIL_ARB             0x200D
180#define WGL_SHARE_ACCUM_ARB               0x200E
181#define WGL_SUPPORT_GDI_ARB               0x200F
182#define WGL_SUPPORT_OPENGL_ARB            0x2010
183#define WGL_DOUBLE_BUFFER_ARB             0x2011
184#define WGL_STEREO_ARB                    0x2012
185#define WGL_PIXEL_TYPE_ARB                0x2013
186#define WGL_COLOR_BITS_ARB                0x2014
187#define WGL_RED_BITS_ARB                  0x2015
188#define WGL_RED_SHIFT_ARB                 0x2016
189#define WGL_GREEN_BITS_ARB                0x2017
190#define WGL_GREEN_SHIFT_ARB               0x2018
191#define WGL_BLUE_BITS_ARB                 0x2019
192#define WGL_BLUE_SHIFT_ARB                0x201A
193#define WGL_ALPHA_BITS_ARB                0x201B
194#define WGL_ALPHA_SHIFT_ARB               0x201C
195#define WGL_ACCUM_BITS_ARB                0x201D
196#define WGL_ACCUM_RED_BITS_ARB            0x201E
197#define WGL_ACCUM_GREEN_BITS_ARB          0x201F
198#define WGL_ACCUM_BLUE_BITS_ARB           0x2020
199#define WGL_ACCUM_ALPHA_BITS_ARB          0x2021
200#define WGL_DEPTH_BITS_ARB                0x2022
201#define WGL_STENCIL_BITS_ARB              0x2023
202#define WGL_AUX_BUFFERS_ARB               0x2024
203#define WGL_NO_ACCELERATION_ARB           0x2025
204#define WGL_GENERIC_ACCELERATION_ARB      0x2026
205#define WGL_FULL_ACCELERATION_ARB         0x2027
206#define WGL_SWAP_EXCHANGE_ARB             0x2028
207#define WGL_SWAP_COPY_ARB                 0x2029
208#define WGL_SWAP_UNDEFINED_ARB            0x202A
209#define WGL_TYPE_RGBA_ARB                 0x202B
210#define WGL_TYPE_COLORINDEX_ARB           0x202C
211typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
212typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
213typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
214#ifdef WGL_WGLEXT_PROTOTYPES
215BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
216BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
217BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
218#endif
219#endif /* WGL_ARB_pixel_format */
220
221#ifndef WGL_ARB_pixel_format_float
222#define WGL_ARB_pixel_format_float 1
223#define WGL_TYPE_RGBA_FLOAT_ARB           0x21A0
224#endif /* WGL_ARB_pixel_format_float */
225
226#ifndef WGL_ARB_render_texture
227#define WGL_ARB_render_texture 1
228#define WGL_BIND_TO_TEXTURE_RGB_ARB       0x2070
229#define WGL_BIND_TO_TEXTURE_RGBA_ARB      0x2071
230#define WGL_TEXTURE_FORMAT_ARB            0x2072
231#define WGL_TEXTURE_TARGET_ARB            0x2073
232#define WGL_MIPMAP_TEXTURE_ARB            0x2074
233#define WGL_TEXTURE_RGB_ARB               0x2075
234#define WGL_TEXTURE_RGBA_ARB              0x2076
235#define WGL_NO_TEXTURE_ARB                0x2077
236#define WGL_TEXTURE_CUBE_MAP_ARB          0x2078
237#define WGL_TEXTURE_1D_ARB                0x2079
238#define WGL_TEXTURE_2D_ARB                0x207A
239#define WGL_MIPMAP_LEVEL_ARB              0x207B
240#define WGL_CUBE_MAP_FACE_ARB             0x207C
241#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
242#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
243#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
244#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
245#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
246#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
247#define WGL_FRONT_LEFT_ARB                0x2083
248#define WGL_FRONT_RIGHT_ARB               0x2084
249#define WGL_BACK_LEFT_ARB                 0x2085
250#define WGL_BACK_RIGHT_ARB                0x2086
251#define WGL_AUX0_ARB                      0x2087
252#define WGL_AUX1_ARB                      0x2088
253#define WGL_AUX2_ARB                      0x2089
254#define WGL_AUX3_ARB                      0x208A
255#define WGL_AUX4_ARB                      0x208B
256#define WGL_AUX5_ARB                      0x208C
257#define WGL_AUX6_ARB                      0x208D
258#define WGL_AUX7_ARB                      0x208E
259#define WGL_AUX8_ARB                      0x208F
260#define WGL_AUX9_ARB                      0x2090
261typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
262typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
263typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
264#ifdef WGL_WGLEXT_PROTOTYPES
265BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
266BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
267BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
268#endif
269#endif /* WGL_ARB_render_texture */
270
271#ifndef WGL_ARB_robustness_application_isolation
272#define WGL_ARB_robustness_application_isolation 1
273#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
274#endif /* WGL_ARB_robustness_application_isolation */
275
276#ifndef WGL_ARB_robustness_share_group_isolation
277#define WGL_ARB_robustness_share_group_isolation 1
278#endif /* WGL_ARB_robustness_share_group_isolation */
279
280#ifndef WGL_3DFX_multisample
281#define WGL_3DFX_multisample 1
282#define WGL_SAMPLE_BUFFERS_3DFX           0x2060
283#define WGL_SAMPLES_3DFX                  0x2061
284#endif /* WGL_3DFX_multisample */
285
286#ifndef WGL_3DL_stereo_control
287#define WGL_3DL_stereo_control 1
288#define WGL_STEREO_EMITTER_ENABLE_3DL     0x2055
289#define WGL_STEREO_EMITTER_DISABLE_3DL    0x2056
290#define WGL_STEREO_POLARITY_NORMAL_3DL    0x2057
291#define WGL_STEREO_POLARITY_INVERT_3DL    0x2058
292typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
293#ifdef WGL_WGLEXT_PROTOTYPES
294BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
295#endif
296#endif /* WGL_3DL_stereo_control */
297
298#ifndef WGL_AMD_gpu_association
299#define WGL_AMD_gpu_association 1
300#define WGL_GPU_VENDOR_AMD                0x1F00
301#define WGL_GPU_RENDERER_STRING_AMD       0x1F01
302#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
303#define WGL_GPU_FASTEST_TARGET_GPUS_AMD   0x21A2
304#define WGL_GPU_RAM_AMD                   0x21A3
305#define WGL_GPU_CLOCK_AMD                 0x21A4
306#define WGL_GPU_NUM_PIPES_AMD             0x21A5
307#define WGL_GPU_NUM_SIMD_AMD              0x21A6
308#define WGL_GPU_NUM_RB_AMD                0x21A7
309#define WGL_GPU_NUM_SPI_AMD               0x21A8
310typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
311typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
312typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
313typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
314typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
315typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
316typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
317typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
318typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
319#ifdef WGL_WGLEXT_PROTOTYPES
320UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
321INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
322UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
323HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
324HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
325BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
326BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
327HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
328VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
329#endif
330#endif /* WGL_AMD_gpu_association */
331
332#ifndef WGL_ATI_pixel_format_float
333#define WGL_ATI_pixel_format_float 1
334#define WGL_TYPE_RGBA_FLOAT_ATI           0x21A0
335#endif /* WGL_ATI_pixel_format_float */
336
337#ifndef WGL_EXT_create_context_es2_profile
338#define WGL_EXT_create_context_es2_profile 1
339#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT   0x00000004
340#endif /* WGL_EXT_create_context_es2_profile */
341
342#ifndef WGL_EXT_create_context_es_profile
343#define WGL_EXT_create_context_es_profile 1
344#define WGL_CONTEXT_ES_PROFILE_BIT_EXT    0x00000004
345#endif /* WGL_EXT_create_context_es_profile */
346
347#ifndef WGL_EXT_depth_float
348#define WGL_EXT_depth_float 1
349#define WGL_DEPTH_FLOAT_EXT               0x2040
350#endif /* WGL_EXT_depth_float */
351
352#ifndef WGL_EXT_display_color_table
353#define WGL_EXT_display_color_table 1
354typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
355typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
356typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
357typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
358#ifdef WGL_WGLEXT_PROTOTYPES
359GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
360GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
361GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
362VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
363#endif
364#endif /* WGL_EXT_display_color_table */
365
366#ifndef WGL_EXT_extensions_string
367#define WGL_EXT_extensions_string 1
368typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
369#ifdef WGL_WGLEXT_PROTOTYPES
370const char *WINAPI wglGetExtensionsStringEXT (void);
371#endif
372#endif /* WGL_EXT_extensions_string */
373
374#ifndef WGL_EXT_framebuffer_sRGB
375#define WGL_EXT_framebuffer_sRGB 1
376#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT  0x20A9
377#endif /* WGL_EXT_framebuffer_sRGB */
378
379#ifndef WGL_EXT_make_current_read
380#define WGL_EXT_make_current_read 1
381#define ERROR_INVALID_PIXEL_TYPE_EXT      0x2043
382typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
383typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
384#ifdef WGL_WGLEXT_PROTOTYPES
385BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
386HDC WINAPI wglGetCurrentReadDCEXT (void);
387#endif
388#endif /* WGL_EXT_make_current_read */
389
390#ifndef WGL_EXT_multisample
391#define WGL_EXT_multisample 1
392#define WGL_SAMPLE_BUFFERS_EXT            0x2041
393#define WGL_SAMPLES_EXT                   0x2042
394#endif /* WGL_EXT_multisample */
395
396#ifndef WGL_EXT_pbuffer
397#define WGL_EXT_pbuffer 1
398DECLARE_HANDLE(HPBUFFEREXT);
399#define WGL_DRAW_TO_PBUFFER_EXT           0x202D
400#define WGL_MAX_PBUFFER_PIXELS_EXT        0x202E
401#define WGL_MAX_PBUFFER_WIDTH_EXT         0x202F
402#define WGL_MAX_PBUFFER_HEIGHT_EXT        0x2030
403#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT     0x2031
404#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT    0x2032
405#define WGL_PBUFFER_LARGEST_EXT           0x2033
406#define WGL_PBUFFER_WIDTH_EXT             0x2034
407#define WGL_PBUFFER_HEIGHT_EXT            0x2035
408typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
409typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
410typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
411typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
412typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
413#ifdef WGL_WGLEXT_PROTOTYPES
414HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
415HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
416int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
417BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
418BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
419#endif
420#endif /* WGL_EXT_pbuffer */
421
422#ifndef WGL_EXT_pixel_format
423#define WGL_EXT_pixel_format 1
424#define WGL_NUMBER_PIXEL_FORMATS_EXT      0x2000
425#define WGL_DRAW_TO_WINDOW_EXT            0x2001
426#define WGL_DRAW_TO_BITMAP_EXT            0x2002
427#define WGL_ACCELERATION_EXT              0x2003
428#define WGL_NEED_PALETTE_EXT              0x2004
429#define WGL_NEED_SYSTEM_PALETTE_EXT       0x2005
430#define WGL_SWAP_LAYER_BUFFERS_EXT        0x2006
431#define WGL_SWAP_METHOD_EXT               0x2007
432#define WGL_NUMBER_OVERLAYS_EXT           0x2008
433#define WGL_NUMBER_UNDERLAYS_EXT          0x2009
434#define WGL_TRANSPARENT_EXT               0x200A
435#define WGL_TRANSPARENT_VALUE_EXT         0x200B
436#define WGL_SHARE_DEPTH_EXT               0x200C
437#define WGL_SHARE_STENCIL_EXT             0x200D
438#define WGL_SHARE_ACCUM_EXT               0x200E
439#define WGL_SUPPORT_GDI_EXT               0x200F
440#define WGL_SUPPORT_OPENGL_EXT            0x2010
441#define WGL_DOUBLE_BUFFER_EXT             0x2011
442#define WGL_STEREO_EXT                    0x2012
443#define WGL_PIXEL_TYPE_EXT                0x2013
444#define WGL_COLOR_BITS_EXT                0x2014
445#define WGL_RED_BITS_EXT                  0x2015
446#define WGL_RED_SHIFT_EXT                 0x2016
447#define WGL_GREEN_BITS_EXT                0x2017
448#define WGL_GREEN_SHIFT_EXT               0x2018
449#define WGL_BLUE_BITS_EXT                 0x2019
450#define WGL_BLUE_SHIFT_EXT                0x201A
451#define WGL_ALPHA_BITS_EXT                0x201B
452#define WGL_ALPHA_SHIFT_EXT               0x201C
453#define WGL_ACCUM_BITS_EXT                0x201D
454#define WGL_ACCUM_RED_BITS_EXT            0x201E
455#define WGL_ACCUM_GREEN_BITS_EXT          0x201F
456#define WGL_ACCUM_BLUE_BITS_EXT           0x2020
457#define WGL_ACCUM_ALPHA_BITS_EXT          0x2021
458#define WGL_DEPTH_BITS_EXT                0x2022
459#define WGL_STENCIL_BITS_EXT              0x2023
460#define WGL_AUX_BUFFERS_EXT               0x2024
461#define WGL_NO_ACCELERATION_EXT           0x2025
462#define WGL_GENERIC_ACCELERATION_EXT      0x2026
463#define WGL_FULL_ACCELERATION_EXT         0x2027
464#define WGL_SWAP_EXCHANGE_EXT             0x2028
465#define WGL_SWAP_COPY_EXT                 0x2029
466#define WGL_SWAP_UNDEFINED_EXT            0x202A
467#define WGL_TYPE_RGBA_EXT                 0x202B
468#define WGL_TYPE_COLORINDEX_EXT           0x202C
469typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
470typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
471typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
472#ifdef WGL_WGLEXT_PROTOTYPES
473BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
474BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
475BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
476#endif
477#endif /* WGL_EXT_pixel_format */
478
479#ifndef WGL_EXT_pixel_format_packed_float
480#define WGL_EXT_pixel_format_packed_float 1
481#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT  0x20A8
482#endif /* WGL_EXT_pixel_format_packed_float */
483
484#ifndef WGL_EXT_swap_control
485#define WGL_EXT_swap_control 1
486typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
487typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
488#ifdef WGL_WGLEXT_PROTOTYPES
489BOOL WINAPI wglSwapIntervalEXT (int interval);
490int WINAPI wglGetSwapIntervalEXT (void);
491#endif
492#endif /* WGL_EXT_swap_control */
493
494#ifndef WGL_EXT_swap_control_tear
495#define WGL_EXT_swap_control_tear 1
496#endif /* WGL_EXT_swap_control_tear */
497
498#ifndef WGL_I3D_digital_video_control
499#define WGL_I3D_digital_video_control 1
500#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
501#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
502#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
503#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
504typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
505typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
506#ifdef WGL_WGLEXT_PROTOTYPES
507BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
508BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
509#endif
510#endif /* WGL_I3D_digital_video_control */
511
512#ifndef WGL_I3D_gamma
513#define WGL_I3D_gamma 1
514#define WGL_GAMMA_TABLE_SIZE_I3D          0x204E
515#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D     0x204F
516typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
517typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
518typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
519typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
520#ifdef WGL_WGLEXT_PROTOTYPES
521BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
522BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
523BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
524BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
525#endif
526#endif /* WGL_I3D_gamma */
527
528#ifndef WGL_I3D_genlock
529#define WGL_I3D_genlock 1
530#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D  0x2044
531#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
532#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
533#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
534#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
535#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
536#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
537#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
538#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D  0x204C
539typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
540typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
541typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
542typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
543typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
544typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
545typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
546typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
547typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
548typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
549typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
550typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
551#ifdef WGL_WGLEXT_PROTOTYPES
552BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
553BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
554BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
555BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
556BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
557BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
558BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
559BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
560BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
561BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
562BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
563BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
564#endif
565#endif /* WGL_I3D_genlock */
566
567#ifndef WGL_I3D_image_buffer
568#define WGL_I3D_image_buffer 1
569#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D   0x00000001
570#define WGL_IMAGE_BUFFER_LOCK_I3D         0x00000002
571typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
572typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
573typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
574typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
575#ifdef WGL_WGLEXT_PROTOTYPES
576LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
577BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
578BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
579BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
580#endif
581#endif /* WGL_I3D_image_buffer */
582
583#ifndef WGL_I3D_swap_frame_lock
584#define WGL_I3D_swap_frame_lock 1
585typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
586typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
587typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
588typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
589#ifdef WGL_WGLEXT_PROTOTYPES
590BOOL WINAPI wglEnableFrameLockI3D (void);
591BOOL WINAPI wglDisableFrameLockI3D (void);
592BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
593BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
594#endif
595#endif /* WGL_I3D_swap_frame_lock */
596
597#ifndef WGL_I3D_swap_frame_usage
598#define WGL_I3D_swap_frame_usage 1
599typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
600typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
601typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
602typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
603#ifdef WGL_WGLEXT_PROTOTYPES
604BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
605BOOL WINAPI wglBeginFrameTrackingI3D (void);
606BOOL WINAPI wglEndFrameTrackingI3D (void);
607BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
608#endif
609#endif /* WGL_I3D_swap_frame_usage */
610
611#ifndef WGL_NV_DX_interop
612#define WGL_NV_DX_interop 1
613#define WGL_ACCESS_READ_ONLY_NV           0x00000000
614#define WGL_ACCESS_READ_WRITE_NV          0x00000001
615#define WGL_ACCESS_WRITE_DISCARD_NV       0x00000002
616typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
617typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
618typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
619typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
620typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
621typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
622typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
623typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
624#ifdef WGL_WGLEXT_PROTOTYPES
625BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
626HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
627BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
628HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
629BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
630BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
631BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
632BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
633#endif
634#endif /* WGL_NV_DX_interop */
635
636#ifndef WGL_NV_DX_interop2
637#define WGL_NV_DX_interop2 1
638#endif /* WGL_NV_DX_interop2 */
639
640#ifndef WGL_NV_copy_image
641#define WGL_NV_copy_image 1
642typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
643#ifdef WGL_WGLEXT_PROTOTYPES
644BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
645#endif
646#endif /* WGL_NV_copy_image */
647
648#ifndef WGL_NV_delay_before_swap
649#define WGL_NV_delay_before_swap 1
650typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
651#ifdef WGL_WGLEXT_PROTOTYPES
652BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds);
653#endif
654#endif /* WGL_NV_delay_before_swap */
655
656#ifndef WGL_NV_float_buffer
657#define WGL_NV_float_buffer 1
658#define WGL_FLOAT_COMPONENTS_NV           0x20B0
659#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
660#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
661#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
662#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
663#define WGL_TEXTURE_FLOAT_R_NV            0x20B5
664#define WGL_TEXTURE_FLOAT_RG_NV           0x20B6
665#define WGL_TEXTURE_FLOAT_RGB_NV          0x20B7
666#define WGL_TEXTURE_FLOAT_RGBA_NV         0x20B8
667#endif /* WGL_NV_float_buffer */
668
669#ifndef WGL_NV_gpu_affinity
670#define WGL_NV_gpu_affinity 1
671DECLARE_HANDLE(HGPUNV);
672struct _GPU_DEVICE {
673    DWORD  cb;
674    CHAR   DeviceName[32];
675    CHAR   DeviceString[128];
676    DWORD  Flags;
677    RECT   rcVirtualScreen;
678};
679typedef struct _GPU_DEVICE *PGPU_DEVICE;
680#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
681#define ERROR_MISSING_AFFINITY_MASK_NV    0x20D1
682typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
683typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
684typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
685typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
686typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
687#ifdef WGL_WGLEXT_PROTOTYPES
688BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
689BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
690HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
691BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
692BOOL WINAPI wglDeleteDCNV (HDC hdc);
693#endif
694#endif /* WGL_NV_gpu_affinity */
695
696#ifndef WGL_NV_multisample_coverage
697#define WGL_NV_multisample_coverage 1
698#define WGL_COVERAGE_SAMPLES_NV           0x2042
699#define WGL_COLOR_SAMPLES_NV              0x20B9
700#endif /* WGL_NV_multisample_coverage */
701
702#ifndef WGL_NV_present_video
703#define WGL_NV_present_video 1
704DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
705#define WGL_NUM_VIDEO_SLOTS_NV            0x20F0
706typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
707typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
708typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
709#ifdef WGL_WGLEXT_PROTOTYPES
710int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
711BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
712BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
713#endif
714#endif /* WGL_NV_present_video */
715
716#ifndef WGL_NV_render_depth_texture
717#define WGL_NV_render_depth_texture 1
718#define WGL_BIND_TO_TEXTURE_DEPTH_NV      0x20A3
719#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
720#define WGL_DEPTH_TEXTURE_FORMAT_NV       0x20A5
721#define WGL_TEXTURE_DEPTH_COMPONENT_NV    0x20A6
722#define WGL_DEPTH_COMPONENT_NV            0x20A7
723#endif /* WGL_NV_render_depth_texture */
724
725#ifndef WGL_NV_render_texture_rectangle
726#define WGL_NV_render_texture_rectangle 1
727#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
728#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
729#define WGL_TEXTURE_RECTANGLE_NV          0x20A2
730#endif /* WGL_NV_render_texture_rectangle */
731
732#ifndef WGL_NV_swap_group
733#define WGL_NV_swap_group 1
734typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
735typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
736typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
737typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
738typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
739typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
740#ifdef WGL_WGLEXT_PROTOTYPES
741BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
742BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
743BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
744BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
745BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
746BOOL WINAPI wglResetFrameCountNV (HDC hDC);
747#endif
748#endif /* WGL_NV_swap_group */
749
750#ifndef WGL_NV_vertex_array_range
751#define WGL_NV_vertex_array_range 1
752typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
753typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
754#ifdef WGL_WGLEXT_PROTOTYPES
755void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
756void WINAPI wglFreeMemoryNV (void *pointer);
757#endif
758#endif /* WGL_NV_vertex_array_range */
759
760#ifndef WGL_NV_video_capture
761#define WGL_NV_video_capture 1
762DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
763#define WGL_UNIQUE_ID_NV                  0x20CE
764#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV    0x20CF
765typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
766typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
767typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
768typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
769typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
770#ifdef WGL_WGLEXT_PROTOTYPES
771BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
772UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
773BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
774BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
775BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
776#endif
777#endif /* WGL_NV_video_capture */
778
779#ifndef WGL_NV_video_output
780#define WGL_NV_video_output 1
781DECLARE_HANDLE(HPVIDEODEV);
782#define WGL_BIND_TO_VIDEO_RGB_NV          0x20C0
783#define WGL_BIND_TO_VIDEO_RGBA_NV         0x20C1
784#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
785#define WGL_VIDEO_OUT_COLOR_NV            0x20C3
786#define WGL_VIDEO_OUT_ALPHA_NV            0x20C4
787#define WGL_VIDEO_OUT_DEPTH_NV            0x20C5
788#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV  0x20C6
789#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV  0x20C7
790#define WGL_VIDEO_OUT_FRAME               0x20C8
791#define WGL_VIDEO_OUT_FIELD_1             0x20C9
792#define WGL_VIDEO_OUT_FIELD_2             0x20CA
793#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2  0x20CB
794#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1  0x20CC
795typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
796typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
797typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
798typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
799typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
800typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
801#ifdef WGL_WGLEXT_PROTOTYPES
802BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
803BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
804BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
805BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
806BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
807BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
808#endif
809#endif /* WGL_NV_video_output */
810
811#ifndef WGL_OML_sync_control
812#define WGL_OML_sync_control 1
813typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
814typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
815typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
816typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
817typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
818typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
819#ifdef WGL_WGLEXT_PROTOTYPES
820BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
821BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
822INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
823INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
824BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
825BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
826#endif
827#endif /* WGL_OML_sync_control */
828
829#ifdef __cplusplus
830}
831#endif
832
833#endif
Property changes on: branches/osd/src/lib/khronos/wgl/wglext.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/fs_clear3.sc
r0r31734
1$input v_color0
2
3/*
4 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
5 * License: http://www.opensource.org/licenses/BSD-2-Clause
6 */
7
8#include "bgfx_shader.sh"
9
10void main()
11{
12   gl_FragData[0] = v_color0;
13   gl_FragData[1] = v_color0;
14   gl_FragData[2] = v_color0;
15   gl_FragData[3] = v_color0;
16}
Property changes on: branches/osd/src/lib/bgfx/fs_clear3.sc
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_wgl.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_GLCONTEXT_WGL_H_HEADER_GUARD
7#define BGFX_GLCONTEXT_WGL_H_HEADER_GUARD
8
9#if BGFX_USE_WGL
10
11#include <wgl/wglext.h>
12
13namespace bgfx
14{
15typedef PROC (APIENTRYP PFNWGLGETPROCADDRESSPROC) (LPCSTR lpszProc);
16typedef BOOL (APIENTRYP PFNWGLMAKECURRENTPROC) (HDC hdc, HGLRC hglrc);
17typedef HGLRC (APIENTRYP PFNWGLCREATECONTEXTPROC) (HDC hdc);
18typedef BOOL (APIENTRYP PFNWGLDELETECONTEXTPROC) (HGLRC hglrc);
19//
20typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
21typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
22typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
23typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
24typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
25typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
26typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
27typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
28typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
29typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
30typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
31typedef void (APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
32typedef void (APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
33typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
34typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
35typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
36typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *params);
37typedef void (APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *params);
38typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
39typedef void (APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
40typedef void (APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
41typedef void (APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size);
42typedef void (APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
43typedef void (APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
44typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
45typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap);
46typedef void (APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
47typedef void (APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
48typedef void (APIENTRYP PFNGLCLEARDEPTHPROC) (GLdouble depth);
49typedef void (APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
50typedef void (APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
51typedef void (APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
52typedef void (APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
53
54   extern PFNWGLGETPROCADDRESSPROC wglGetProcAddress;
55   extern PFNWGLMAKECURRENTPROC wglMakeCurrent;
56   extern PFNWGLCREATECONTEXTPROC wglCreateContext;
57   extern PFNWGLDELETECONTEXTPROC wglDeleteContext;
58
59   struct GlContext
60   {
61      GlContext()
62         : m_opengl32dll(NULL)
63         , m_context(NULL)
64         , m_hdc(NULL)
65      {
66      }
67
68      void create(uint32_t _width, uint32_t _height);
69      void destroy();
70      void resize(uint32_t _width, uint32_t _height, bool _vsync);
71      void swap();
72      void import();
73
74      bool isValid() const
75      {
76         return NULL != m_context;
77      }
78
79      void* m_opengl32dll;
80      HGLRC m_context;
81      HDC m_hdc;
82   };
83} // namespace bgfx
84
85#endif // BGFX_USE_WGL
86
87#endif // BGFX_GLCONTEXT_WGL_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/glcontext_wgl.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glimports.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#if !defined(GL_IMPORT) && !defined(GL_EXTENSION)
7#   error GL_IMPORT or GL_EXTENSION must be defined!
8#endif // !defined(GL_IMPORT) && !defined(GL_DEFINE)
9
10#ifdef GL_EXTENSION
11#   undef GL_IMPORT
12#   define GL_IMPORT GL_EXTENSION
13#else
14#   if !BGFX_USE_GL_DYNAMIC_LIB
15#      define GL_EXTENSION GL_IMPORT
16#   else
17#      define GL_EXTENSION(_optional, _proto, _func, _import)
18#   endif // !BGFX_USE_GL_DYNAMIC_LIB
19#endif // GL_EXTENSION
20
21#ifndef GL_IMPORT_TYPEDEFS
22#   define GL_IMPORT_TYPEDEFS 0
23#endif // GL_IMPORT_TYPEDEFS
24
25#define GL_IMPORT______(_optional, _proto, _func) GL_IMPORT(_optional, _proto, _func, _func)
26#define GL_IMPORT_ANGLE(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## ANGLE)
27#define GL_IMPORT_ARB__(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## ARB)
28#define GL_IMPORT_EXT__(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## EXT)
29#define GL_IMPORT_NV___(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## NV)
30#define GL_IMPORT_OES__(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## OES)
31#define GL_IMPORT_____x(_optional, _proto, _func) GL_EXTENSION(_optional, _proto, _func, _func ## XXXXX)
32
33#if GL_IMPORT_TYPEDEFS
34typedef void (GL_APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
35typedef void           (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
36typedef void           (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
37typedef void           (GL_APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
38typedef void           (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
39typedef void           (GL_APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
40typedef void           (GL_APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
41typedef void           (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name);
42typedef void           (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
43typedef void           (GL_APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
44typedef void           (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
45typedef void           (GL_APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
46typedef void           (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
47typedef void           (GL_APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
48typedef void           (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
49typedef void           (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
50typedef void           (GL_APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);
51typedef void           (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
52typedef void           (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
53typedef void           (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
54typedef void           (GL_APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);
55typedef void           (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
56typedef void           (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
57typedef void           (GL_APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
58typedef void           (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
59typedef void           (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
60typedef GLenum         (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
61typedef void           (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
62typedef void           (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
63typedef void           (GL_APIENTRYP PFNGLCLEARDEPTHPROC) (GLdouble d);
64typedef void           (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
65typedef void           (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
66typedef void           (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
67typedef void           (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
68typedef void           (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
69typedef void           (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
70typedef void           (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
71typedef void           (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
72typedef GLuint         (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
73typedef GLuint         (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
74typedef void           (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
75typedef void           (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
76typedef void           (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
77typedef void           (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
78typedef void           (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
79typedef void           (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
80typedef void           (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
81typedef void           (GL_APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
82typedef void           (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
83typedef void           (GL_APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
84typedef void           (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
85typedef void           (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
86typedef void           (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
87typedef void           (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
88typedef void           (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
89typedef void           (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
90typedef void           (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
91typedef void           (GL_APIENTRYP PFNGLDISABLEIPROC) (GLenum cap, GLuint index);
92typedef void           (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
93typedef void           (GL_APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
94typedef void           (GL_APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
95typedef void           (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
96typedef void           (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
97typedef void           (GL_APIENTRYP PFNGLDRAWBUFFERPROC) (GLenum mode);
98typedef void           (GL_APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
99typedef void           (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
100typedef void           (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
101typedef void           (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
102typedef void           (GL_APIENTRYP PFNGLENABLEIPROC) (GLenum cap, GLuint index);
103typedef void           (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
104typedef void           (GL_APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
105typedef void           (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
106typedef void           (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
107typedef void           (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
108typedef void           (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
109typedef void           (GL_APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
110typedef void           (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
111typedef void           (GL_APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
112typedef void           (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
113typedef void           (GL_APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
114typedef void           (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
115typedef void           (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
116typedef GLint          (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
117typedef GLuint         (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
118typedef GLenum         (GL_APIENTRYP PFNGLGETERRORPROC) (void);
119typedef void           (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
120typedef void           (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
121typedef void           (GL_APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
122typedef void           (GL_APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
123typedef void           (GL_APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, void **params);
124typedef void           (GL_APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
125typedef void           (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
126typedef void           (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
127typedef void           (GL_APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
128typedef GLuint         (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
129typedef void           (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
130typedef void           (GL_APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
131typedef GLint          (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name);
132typedef GLint          (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
133typedef void           (GL_APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
134typedef void           (GL_APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params);
135typedef void           (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params);
136typedef void           (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
137typedef void           (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params);
138typedef void           (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
139typedef void           (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
140typedef const GLubyte* (GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
141typedef GLint          (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
142typedef void           (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
143typedef void           (GL_APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
144typedef void           (GL_APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
145typedef void           (GL_APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
146typedef void           (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
147typedef void           (GL_APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size);
148typedef void           (GL_APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);
149typedef void           (GL_APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
150typedef void           (GL_APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
151typedef void           (GL_APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
152typedef void           (GL_APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);
153typedef void           (GL_APIENTRYP PFNGLREADBUFFERPROC) (GLenum mode);
154typedef void           (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
155typedef void           (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
156typedef void           (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
157typedef void           (GL_APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
158typedef void           (GL_APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
159typedef void           (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
160typedef void           (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
161typedef void           (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
162typedef void           (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
163typedef void           (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
164typedef void           (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
165typedef void           (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
166typedef void           (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
167typedef void           (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
168typedef void           (GL_APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
169typedef void           (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
170typedef void           (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
171typedef void           (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
172typedef void           (GL_APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
173typedef void           (GL_APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
174typedef void           (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
175typedef void           (GL_APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
176typedef void           (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
177typedef void           (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
178typedef void           (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
179typedef void           (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
180typedef void           (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
181typedef void           (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
182typedef void           (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
183typedef void           (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
184typedef void           (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
185typedef void           (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
186typedef void           (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
187typedef void           (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
188typedef void           (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
189typedef void           (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
190typedef void           (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
191typedef void           (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
192typedef void           (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
193
194typedef void           (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
195typedef void           (GL_APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void *string);
196typedef void           (GL_APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void);
197
198typedef void           (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
199typedef void           (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
200typedef void           (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
201#endif // GL_IMPORT_TYPEDEFS
202
203#if BGFX_USE_GL_DYNAMIC_LIB
204GL_IMPORT______(false, PFNGLACTIVETEXTUREPROC,                     glActiveTexture);
205GL_IMPORT______(false, PFNGLATTACHSHADERPROC,                      glAttachShader);
206GL_IMPORT______(true,  PFNGLBEGINQUERYPROC,                        glBeginQuery);
207GL_IMPORT______(false, PFNGLBINDBUFFERPROC,                        glBindBuffer);
208GL_IMPORT______(true,  PFNGLBINDBUFFERBASEPROC,                    glBindBufferBase);
209GL_IMPORT______(true,  PFNGLBINDBUFFERRANGEPROC,                   glBindBufferRange);
210GL_IMPORT______(true,  PFNGLBINDFRAGDATALOCATIONPROC,              glBindFragDataLocation);
211GL_IMPORT______(true,  PFNGLBINDFRAMEBUFFERPROC,                   glBindFramebuffer);
212GL_IMPORT______(true,  PFNGLBINDIMAGETEXTUREPROC,                  glBindImageTexture);
213GL_IMPORT______(true,  PFNGLBINDRENDERBUFFERPROC,                  glBindRenderbuffer);
214GL_IMPORT______(true,  PFNGLBINDSAMPLERPROC,                       glBindSampler);
215GL_IMPORT______(false, PFNGLBINDTEXTUREPROC,                       glBindTexture);
216GL_IMPORT______(true,  PFNGLBINDVERTEXARRAYPROC,                   glBindVertexArray);
217GL_IMPORT______(true,  PFNGLBLENDCOLORPROC,                        glBlendColor);
218GL_IMPORT______(false, PFNGLBLENDEQUATIONPROC,                     glBlendEquation);
219GL_IMPORT______(true,  PFNGLBLENDEQUATIONIPROC,                    glBlendEquationi);
220GL_IMPORT______(true,  PFNGLBLENDEQUATIONSEPARATEPROC,             glBlendEquationSeparate);
221GL_IMPORT______(true,  PFNGLBLENDEQUATIONSEPARATEIPROC,            glBlendEquationSeparatei);
222GL_IMPORT______(false, PFNGLBLENDFUNCPROC,                         glBlendFunc);
223GL_IMPORT______(true,  PFNGLBLENDFUNCIPROC,                        glBlendFunci);
224GL_IMPORT______(true,  PFNGLBLENDFUNCSEPARATEPROC,                 glBlendFuncSeparate);
225GL_IMPORT______(true,  PFNGLBLENDFUNCSEPARATEIPROC,                glBlendFuncSeparatei);
226GL_IMPORT______(true,  PFNGLBLITFRAMEBUFFERPROC,                   glBlitFramebuffer);
227GL_IMPORT______(false, PFNGLBUFFERDATAPROC,                        glBufferData);
228GL_IMPORT______(false, PFNGLBUFFERSUBDATAPROC,                     glBufferSubData);
229GL_IMPORT______(true,  PFNGLCHECKFRAMEBUFFERSTATUSPROC,            glCheckFramebufferStatus);
230GL_IMPORT______(false, PFNGLCLEARPROC,                             glClear);
231GL_IMPORT______(false, PFNGLCLEARCOLORPROC,                        glClearColor);
232GL_IMPORT______(false, PFNGLCLEARSTENCILPROC,                      glClearStencil);
233GL_IMPORT______(false, PFNGLCOLORMASKPROC,                         glColorMask);
234GL_IMPORT______(false, PFNGLCOMPILESHADERPROC,                     glCompileShader);
235GL_IMPORT______(false, PFNGLCOMPRESSEDTEXIMAGE2DPROC,              glCompressedTexImage2D);
236GL_IMPORT______(false, PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC,           glCompressedTexSubImage2D);
237GL_IMPORT______(true , PFNGLCOMPRESSEDTEXIMAGE3DPROC,              glCompressedTexImage3D);
238GL_IMPORT______(true , PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC,           glCompressedTexSubImage3D);
239GL_IMPORT______(false, PFNGLCREATEPROGRAMPROC,                     glCreateProgram);
240GL_IMPORT______(false, PFNGLCREATESHADERPROC,                      glCreateShader);
241GL_IMPORT______(false, PFNGLCULLFACEPROC,                          glCullFace);
242GL_IMPORT______(true,  PFNGLDEBUGMESSAGECONTROLPROC,               glDebugMessageControl);
243GL_IMPORT______(true,  PFNGLDEBUGMESSAGEINSERTPROC,                glDebugMessageInsert);
244GL_IMPORT______(true,  PFNGLDEBUGMESSAGECALLBACKPROC,              glDebugMessageCallback);
245GL_IMPORT______(false, PFNGLDELETEBUFFERSPROC,                     glDeleteBuffers);
246GL_IMPORT______(true,  PFNGLDELETEFRAMEBUFFERSPROC,                glDeleteFramebuffers);
247GL_IMPORT______(false, PFNGLDELETEPROGRAMPROC,                     glDeleteProgram);
248GL_IMPORT______(true,  PFNGLDELETEQUERIESPROC,                     glDeleteQueries);
249GL_IMPORT______(true,  PFNGLDELETERENDERBUFFERSPROC,               glDeleteRenderbuffers);
250GL_IMPORT______(true,  PFNGLDELETESAMPLERSPROC,                    glDeleteSamplers);
251GL_IMPORT______(false, PFNGLDELETESHADERPROC,                      glDeleteShader);
252GL_IMPORT______(false, PFNGLDELETETEXTURESPROC,                    glDeleteTextures);
253GL_IMPORT______(true,  PFNGLDELETEVERTEXARRAYSPROC,                glDeleteVertexArrays);
254GL_IMPORT______(false, PFNGLDEPTHFUNCPROC,                         glDepthFunc);
255GL_IMPORT______(false, PFNGLDEPTHMASKPROC,                         glDepthMask);
256GL_IMPORT______(false, PFNGLDETACHSHADERPROC,                      glDetachShader);
257GL_IMPORT______(false, PFNGLDISABLEPROC,                           glDisable);
258GL_IMPORT______(true,  PFNGLDISABLEIPROC,                          glDisablei);
259GL_IMPORT______(false, PFNGLDISABLEVERTEXATTRIBARRAYPROC,          glDisableVertexAttribArray);
260GL_IMPORT______(true,  PFNGLDISPATCHCOMPUTEPROC,                   glDispatchCompute);
261GL_IMPORT______(true,  PFNGLDISPATCHCOMPUTEINDIRECTPROC,           glDispatchComputeIndirect);
262GL_IMPORT______(false, PFNGLDRAWARRAYSPROC,                        glDrawArrays);
263GL_IMPORT______(true,  PFNGLDRAWARRAYSINSTANCEDPROC,               glDrawArraysInstanced);
264GL_IMPORT______(true,  PFNGLDRAWBUFFERPROC,                        glDrawBuffer);
265GL_IMPORT______(true,  PFNGLDRAWBUFFERSPROC,                       glDrawBuffers);
266GL_IMPORT______(false, PFNGLDRAWELEMENTSPROC,                      glDrawElements);
267GL_IMPORT______(true,  PFNGLDRAWELEMENTSINSTANCEDPROC,             glDrawElementsInstanced);
268GL_IMPORT______(false, PFNGLENABLEPROC,                            glEnable);
269GL_IMPORT______(true,  PFNGLENABLEIPROC,                           glEnablei);
270GL_IMPORT______(false, PFNGLENABLEVERTEXATTRIBARRAYPROC,           glEnableVertexAttribArray);
271GL_IMPORT______(true,  PFNGLENDQUERYPROC,                          glEndQuery);
272GL_IMPORT______(true,  PFNGLFRAMEBUFFERRENDERBUFFERPROC,           glFramebufferRenderbuffer);
273GL_IMPORT______(true,  PFNGLFRAMEBUFFERTEXTURE2DPROC,              glFramebufferTexture2D);
274GL_IMPORT______(false, PFNGLGENBUFFERSPROC,                        glGenBuffers);
275GL_IMPORT______(true,  PFNGLGENFRAMEBUFFERSPROC,                   glGenFramebuffers);
276GL_IMPORT______(true,  PFNGLGENRENDERBUFFERSPROC,                  glGenRenderbuffers);
277GL_IMPORT______(true,  PFNGLGENQUERIESPROC,                        glGenQueries);
278GL_IMPORT______(true,  PFNGLGENSAMPLERSPROC,                       glGenSamplers);
279GL_IMPORT______(false, PFNGLGENTEXTURESPROC,                       glGenTextures);
280GL_IMPORT______(true,  PFNGLGENVERTEXARRAYSPROC,                   glGenVertexArrays);
281GL_IMPORT______(false, PFNGLGETACTIVEATTRIBPROC,                   glGetActiveAttrib);
282GL_IMPORT______(false, PFNGLGETATTRIBLOCATIONPROC,                 glGetAttribLocation);
283GL_IMPORT______(false, PFNGLGETACTIVEUNIFORMPROC,                  glGetActiveUniform);
284GL_IMPORT______(true,  PFNGLGETDEBUGMESSAGELOGPROC,                glGetDebugMessageLog);
285GL_IMPORT______(false, PFNGLGETERRORPROC,                          glGetError);
286GL_IMPORT______(false, PFNGLGETFLOATVPROC,                         glGetFloatv);
287GL_IMPORT______(false, PFNGLGETINTEGERVPROC,                       glGetIntegerv);
288GL_IMPORT______(true,  PFNGLGETOBJECTLABELPROC,                    glGetObjectLabel);
289GL_IMPORT______(true,  PFNGLGETOBJECTPTRLABELPROC,                 glGetObjectPtrLabel);
290GL_IMPORT______(true,  PFNGLGETPOINTERVPROC,                       glGetPointerv);
291GL_IMPORT______(true,  PFNGLGETPROGRAMBINARYPROC,                  glGetProgramBinary);
292GL_IMPORT______(false, PFNGLGETPROGRAMIVPROC,                      glGetProgramiv);
293GL_IMPORT______(false, PFNGLGETPROGRAMINFOLOGPROC,                 glGetProgramInfoLog);
294GL_IMPORT______(true,  PFNGLGETPROGRAMINTERFACEIVPROC,             glGetProgramInterfaceiv);
295GL_IMPORT______(true,  PFNGLGETPROGRAMRESOURCEINDEXPROC,           glGetProgramResourceIndex);
296GL_IMPORT______(true,  PFNGLGETPROGRAMRESOURCEIVPROC,              glGetProgramResourceiv);
297GL_IMPORT______(true,  PFNGLGETPROGRAMRESOURCENAMEPROC,            glGetProgramResourceName);
298GL_IMPORT______(true,  PFNGLGETPROGRAMRESOURCELOCATIONPROC,        glGetProgramResourceLocation);
299GL_IMPORT______(true,  PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC,   glGetProgramResourceLocationIndex);
300GL_IMPORT______(true,  PFNGLGETQUERYIVPROC,                        glGetQueryiv);
301GL_IMPORT______(true,  PFNGLGETQUERYOBJECTIVPROC,                  glGetQueryObjectiv);
302GL_IMPORT______(true,  PFNGLGETQUERYOBJECTI64VPROC,                glGetQueryObjecti64v);
303GL_IMPORT______(true,  PFNGLGETQUERYOBJECTUIVPROC,                 glGetQueryObjectuiv);
304GL_IMPORT______(true,  PFNGLGETQUERYOBJECTUI64VPROC,               glGetQueryObjectui64v);
305GL_IMPORT______(false, PFNGLGETSHADERIVPROC,                       glGetShaderiv);
306GL_IMPORT______(false, PFNGLGETSHADERINFOLOGPROC,                  glGetShaderInfoLog);
307GL_IMPORT______(false, PFNGLGETSTRINGPROC,                         glGetString);
308GL_IMPORT______(false, PFNGLGETUNIFORMLOCATIONPROC,                glGetUniformLocation);
309GL_IMPORT______(false, PFNGLLINKPROGRAMPROC,                       glLinkProgram);
310GL_IMPORT______(true,  PFNGLMEMORYBARRIERPROC,                     glMemoryBarrier);
311GL_IMPORT______(true,  PFNGLOBJECTLABELPROC,                       glObjectLabel);
312GL_IMPORT______(true,  PFNGLOBJECTPTRLABELPROC,                    glObjectPtrLabel);
313GL_IMPORT______(false, PFNGLPIXELSTOREIPROC,                       glPixelStorei);
314GL_IMPORT______(true,  PFNGLPOPDEBUGGROUPPROC,                     glPopDebugGroup);
315GL_IMPORT______(true,  PFNGLPROGRAMBINARYPROC,                     glProgramBinary);
316GL_IMPORT______(true,  PFNGLPROGRAMPARAMETERIPROC,                 glProgramParameteri);
317GL_IMPORT______(true,  PFNGLPUSHDEBUGGROUPPROC,                    glPushDebugGroup);
318GL_IMPORT______(true,  PFNGLQUERYCOUNTERPROC,                      glQueryCounter);
319GL_IMPORT______(true,  PFNGLREADBUFFERPROC,                        glReadBuffer);
320GL_IMPORT______(false, PFNGLREADPIXELSPROC,                        glReadPixels);
321GL_IMPORT______(true,  PFNGLRENDERBUFFERSTORAGEPROC,               glRenderbufferStorage);
322GL_IMPORT______(true,  PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC,    glRenderbufferStorageMultisample);
323GL_IMPORT______(true,  PFNGLSAMPLERPARAMETERIPROC,                 glSamplerParameteri);
324GL_IMPORT______(true,  PFNGLSAMPLERPARAMETERFPROC,                 glSamplerParameterf);
325GL_IMPORT______(false, PFNGLSCISSORPROC,                           glScissor);
326GL_IMPORT______(false, PFNGLSHADERSOURCEPROC,                      glShaderSource);
327GL_IMPORT______(false, PFNGLSTENCILFUNCPROC,                       glStencilFunc);
328GL_IMPORT______(true,  PFNGLSTENCILFUNCSEPARATEPROC,               glStencilFuncSeparate);
329GL_IMPORT______(false, PFNGLSTENCILMASKPROC,                       glStencilMask);
330GL_IMPORT______(true,  PFNGLSTENCILMASKSEPARATEPROC,               glStencilMaskSeparate);
331GL_IMPORT______(false, PFNGLSTENCILOPPROC,                         glStencilOp);
332GL_IMPORT______(true,  PFNGLSTENCILOPSEPARATEPROC,                 glStencilOpSeparate);
333GL_IMPORT______(false, PFNGLTEXIMAGE2DPROC,                        glTexImage2D);
334GL_IMPORT______(true,  PFNGLTEXIMAGE3DPROC,                        glTexImage3D);
335GL_IMPORT______(false, PFNGLTEXPARAMETERIPROC,                     glTexParameteri);
336GL_IMPORT______(false, PFNGLTEXPARAMETERIVPROC,                    glTexParameteriv);
337GL_IMPORT______(false, PFNGLTEXPARAMETERFPROC,                     glTexParameterf);
338GL_IMPORT______(true,  PFNGLTEXSTORAGE2DPROC,                      glTexStorage2D);
339GL_IMPORT______(true,  PFNGLTEXSTORAGE3DPROC,                      glTexStorage3D);
340GL_IMPORT______(false, PFNGLTEXSUBIMAGE2DPROC,                     glTexSubImage2D);
341GL_IMPORT______(true,  PFNGLTEXSUBIMAGE3DPROC,                     glTexSubImage3D);
342GL_IMPORT______(false, PFNGLUNIFORM1IPROC,                         glUniform1i);
343GL_IMPORT______(false, PFNGLUNIFORM1IVPROC,                        glUniform1iv);
344GL_IMPORT______(false, PFNGLUNIFORM1FPROC,                         glUniform1f);
345GL_IMPORT______(false, PFNGLUNIFORM1FVPROC,                        glUniform1fv);
346GL_IMPORT______(false, PFNGLUNIFORM2FVPROC,                        glUniform2fv);
347GL_IMPORT______(false, PFNGLUNIFORM3FVPROC,                        glUniform3fv);
348GL_IMPORT______(false, PFNGLUNIFORM4FVPROC,                        glUniform4fv);
349GL_IMPORT______(false, PFNGLUNIFORMMATRIX3FVPROC,                  glUniformMatrix3fv);
350GL_IMPORT______(false, PFNGLUNIFORMMATRIX4FVPROC,                  glUniformMatrix4fv);
351GL_IMPORT______(false, PFNGLUSEPROGRAMPROC,                        glUseProgram);
352GL_IMPORT______(true,  PFNGLVERTEXATTRIBDIVISORPROC,               glVertexAttribDivisor);
353GL_IMPORT______(false, PFNGLVERTEXATTRIBPOINTERPROC,               glVertexAttribPointer);
354GL_IMPORT______(false, PFNGLVERTEXATTRIB1FPROC,                    glVertexAttrib1f);
355GL_IMPORT______(false, PFNGLVERTEXATTRIB2FPROC,                    glVertexAttrib2f);
356GL_IMPORT______(false, PFNGLVERTEXATTRIB3FPROC,                    glVertexAttrib3f);
357GL_IMPORT______(false, PFNGLVERTEXATTRIB4FPROC,                    glVertexAttrib4f);
358GL_IMPORT______(false, PFNGLVIEWPORTPROC,                          glViewport);
359
360#   if BGFX_CONFIG_RENDERER_OPENGL
361GL_IMPORT______(false, PFNGLCLEARDEPTHPROC,                        glClearDepth);
362GL_IMPORT______(false, PFNGLPOINTSIZEPROC,                         glPointSize);
363
364GL_IMPORT_ARB__(true,  PFNGLDEBUGMESSAGECONTROLPROC,               glDebugMessageControl);
365GL_IMPORT_ARB__(true,  PFNGLDEBUGMESSAGEINSERTPROC,                glDebugMessageInsert);
366GL_IMPORT_ARB__(true,  PFNGLDEBUGMESSAGECALLBACKPROC,              glDebugMessageCallback);
367GL_IMPORT_ARB__(true,  PFNGLGETDEBUGMESSAGELOGPROC,                glGetDebugMessageLog);
368GL_IMPORT_ARB__(true,  PFNGLPUSHDEBUGGROUPPROC,                    glPushDebugGroup);
369GL_IMPORT_ARB__(true,  PFNGLPOPDEBUGGROUPPROC,                     glPopDebugGroup);
370GL_IMPORT_ARB__(true,  PFNGLOBJECTLABELPROC,                       glObjectLabel);
371GL_IMPORT_ARB__(true,  PFNGLGETOBJECTLABELPROC,                    glGetObjectLabel);
372GL_IMPORT_ARB__(true,  PFNGLOBJECTPTRLABELPROC,                    glObjectPtrLabel);
373GL_IMPORT_ARB__(true,  PFNGLGETOBJECTPTRLABELPROC,                 glGetObjectPtrLabel);
374GL_IMPORT_ARB__(true,  PFNGLGETPOINTERVPROC,                       glGetPointerv);
375
376GL_IMPORT_ARB__(true,  PFNGLBLENDEQUATIONIPROC,                    glBlendEquationi);
377GL_IMPORT_ARB__(true,  PFNGLBLENDEQUATIONSEPARATEIPROC,            glBlendEquationSeparatei);
378GL_IMPORT_ARB__(true,  PFNGLBLENDFUNCIPROC,                        glBlendFunci);
379GL_IMPORT_ARB__(true,  PFNGLBLENDFUNCSEPARATEIPROC,                glBlendFuncSeparatei);
380
381GL_IMPORT_ARB__(true,  PFNGLVERTEXATTRIBDIVISORPROC,               glVertexAttribDivisor);
382GL_IMPORT_ARB__(true,  PFNGLDRAWARRAYSINSTANCEDPROC,               glDrawArraysInstanced);
383GL_IMPORT_ARB__(true,  PFNGLDRAWELEMENTSINSTANCEDPROC,             glDrawElementsInstanced);
384
385GL_IMPORT_ARB__(true,  PFNGLDRAWBUFFERSPROC,                       glDrawBuffers);
386
387GL_IMPORT_EXT__(true,  PFNGLBINDFRAMEBUFFERPROC,                   glBindFramebuffer);
388GL_IMPORT_EXT__(true,  PFNGLGENFRAMEBUFFERSPROC,                   glGenFramebuffers);
389GL_IMPORT_EXT__(true,  PFNGLDELETEFRAMEBUFFERSPROC,                glDeleteFramebuffers);
390GL_IMPORT_EXT__(true,  PFNGLCHECKFRAMEBUFFERSTATUSPROC,            glCheckFramebufferStatus);
391GL_IMPORT_EXT__(true,  PFNGLFRAMEBUFFERRENDERBUFFERPROC,           glFramebufferRenderbuffer);
392GL_IMPORT_EXT__(true,  PFNGLFRAMEBUFFERTEXTURE2DPROC,              glFramebufferTexture2D);
393GL_IMPORT_EXT__(true,  PFNGLBINDRENDERBUFFERPROC,                  glBindRenderbuffer);
394GL_IMPORT_EXT__(true,  PFNGLGENRENDERBUFFERSPROC,                  glGenRenderbuffers);
395GL_IMPORT_EXT__(true,  PFNGLDELETERENDERBUFFERSPROC,               glDeleteRenderbuffers);
396GL_IMPORT_EXT__(true,  PFNGLRENDERBUFFERSTORAGEPROC,               glRenderbufferStorage);
397GL_IMPORT_EXT__(true,  PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC,    glRenderbufferStorageMultisample);
398
399#   else // GLES
400GL_IMPORT______(false, PFNGLCLEARDEPTHFPROC,                       glClearDepthf);
401#   endif // BGFX_CONFIG_RENDERER_OPENGL
402
403GL_IMPORT______(true,  PFNGLINSERTEVENTMARKEREXTPROC,              glInsertEventMarker);
404GL_IMPORT______(true,  PFNGLPUSHGROUPMARKEREXTPROC,                glPushGroupMarker);
405GL_IMPORT______(true,  PFNGLPOPGROUPMARKEREXTPROC,                 glPopGroupMarker);
406#endif // BGFX_USE_GL_DYNAMIC_LIB
407
408GL_IMPORT______(true,  PFNGLSTRINGMARKERGREMEDYPROC,               glStringMarkerGREMEDY);
409GL_IMPORT______(true,  PFNGLFRAMETERMINATORGREMEDYPROC,            glFrameTerminatorGREMEDY);
410GL_IMPORT______(true,  PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC,    glGetTranslatedShaderSourceANGLE);
411
412#if !BGFX_CONFIG_RENDERER_OPENGL
413GL_IMPORT_ANGLE(true,  PFNGLBLITFRAMEBUFFERPROC,                   glBlitFramebuffer);
414GL_IMPORT_ANGLE(true,  PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC,    glRenderbufferStorageMultisample);
415
416#   if BGFX_CONFIG_RENDERER_OPENGLES < 30
417GL_IMPORT_OES__(true,  PFNGLTEXIMAGE3DPROC,                        glTexImage3D);
418GL_IMPORT_OES__(true,  PFNGLTEXSUBIMAGE3DPROC,                     glTexSubImage3D);
419GL_IMPORT_OES__(true,  PFNGLCOMPRESSEDTEXIMAGE3DPROC,              glCompressedTexImage3D);
420GL_IMPORT_OES__(true,  PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC,           glCompressedTexSubImage3D);
421
422GL_IMPORT_EXT__(true,  PFNGLTEXSTORAGE2DPROC,                      glTexStorage2D);
423GL_IMPORT_EXT__(true,  PFNGLTEXSTORAGE3DPROC,                      glTexStorage3D);
424
425GL_IMPORT_EXT__(true,  PFNGLINSERTEVENTMARKEREXTPROC,              glInsertEventMarker);
426GL_IMPORT_EXT__(true,  PFNGLPUSHGROUPMARKEREXTPROC,                glPushGroupMarker);
427GL_IMPORT_EXT__(true,  PFNGLPOPGROUPMARKEREXTPROC,                 glPopGroupMarker);
428GL_IMPORT_EXT__(true,  PFNGLOBJECTLABELPROC,                       glObjectLabel);
429
430GL_IMPORT_OES__(true,  PFNGLGETPROGRAMBINARYPROC,                  glGetProgramBinary);
431GL_IMPORT_OES__(true,  PFNGLPROGRAMBINARYPROC,                     glProgramBinary);
432
433GL_IMPORT_OES__(true,  PFNGLVERTEXATTRIBDIVISORPROC,               glVertexAttribDivisor);
434GL_IMPORT_OES__(true,  PFNGLDRAWARRAYSINSTANCEDPROC,               glDrawArraysInstanced);
435GL_IMPORT_OES__(true,  PFNGLDRAWELEMENTSINSTANCEDPROC,             glDrawElementsInstanced);
436
437GL_IMPORT_OES__(true,  PFNGLBINDVERTEXARRAYPROC,                   glBindVertexArray);
438GL_IMPORT_OES__(true,  PFNGLDELETEVERTEXARRAYSPROC,                glDeleteVertexArrays);
439GL_IMPORT_OES__(true,  PFNGLGENVERTEXARRAYSPROC,                   glGenVertexArrays);
440
441GL_IMPORT_____x(true,  PFNGLENABLEIPROC,                           glEnablei);
442GL_IMPORT_____x(true,  PFNGLDISABLEIPROC,                          glDisablei);
443GL_IMPORT_____x(true,  PFNGLBLENDEQUATIONIPROC,                    glBlendEquationi);
444GL_IMPORT_____x(true,  PFNGLBLENDEQUATIONSEPARATEIPROC,            glBlendEquationSeparatei);
445GL_IMPORT_____x(true,  PFNGLBLENDFUNCIPROC,                        glBlendFunci);
446GL_IMPORT_____x(true,  PFNGLBLENDFUNCSEPARATEIPROC,                glBlendFuncSeparatei);
447
448GL_IMPORT_____x(true,  PFNGLDRAWBUFFERPROC,                        glDrawBuffer);
449GL_IMPORT_____x(true,  PFNGLREADBUFFERPROC,                        glReadBuffer);
450GL_IMPORT_____x(true,  PFNGLGENSAMPLERSPROC,                       glGenSamplers);
451GL_IMPORT_____x(true,  PFNGLDELETESAMPLERSPROC,                    glDeleteSamplers);
452GL_IMPORT_____x(true,  PFNGLBINDSAMPLERPROC,                       glBindSampler);
453GL_IMPORT_____x(true,  PFNGLSAMPLERPARAMETERFPROC,                 glSamplerParameterf);
454GL_IMPORT_____x(true,  PFNGLSAMPLERPARAMETERIPROC,                 glSamplerParameteri);
455
456GL_IMPORT_____x(true,  PFNGLBINDBUFFERBASEPROC,                    glBindBufferBase);
457GL_IMPORT_____x(true,  PFNGLBINDBUFFERRANGEPROC,                   glBindBufferRange);
458GL_IMPORT_____x(true,  PFNGLBINDIMAGETEXTUREPROC,                  glBindImageTexture);
459GL_IMPORT_____x(true,  PFNGLGETPROGRAMINTERFACEIVPROC,             glGetProgramInterfaceiv);
460GL_IMPORT_____x(true,  PFNGLGETPROGRAMRESOURCEINDEXPROC,           glGetProgramResourceIndex);
461GL_IMPORT_____x(true,  PFNGLGETPROGRAMRESOURCEIVPROC,              glGetProgramResourceiv);
462GL_IMPORT_____x(true,  PFNGLGETPROGRAMRESOURCENAMEPROC,            glGetProgramResourceName);
463GL_IMPORT_____x(true,  PFNGLGETPROGRAMRESOURCELOCATIONPROC,        glGetProgramResourceLocation);
464GL_IMPORT_____x(true,  PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC,   glGetProgramResourceLocationIndex);
465GL_IMPORT_____x(true,  PFNGLMEMORYBARRIERPROC,                     glMemoryBarrier);
466GL_IMPORT_____x(true,  PFNGLDISPATCHCOMPUTEPROC,                   glDispatchCompute);
467GL_IMPORT_____x(true,  PFNGLDISPATCHCOMPUTEINDIRECTPROC,           glDispatchComputeIndirect);
468
469GL_IMPORT_NV___(true,  PFNGLDRAWBUFFERSPROC,                       glDrawBuffers);
470GL_IMPORT_NV___(true,  PFNGLGENQUERIESPROC,                        glGenQueries);
471GL_IMPORT_NV___(true,  PFNGLDELETEQUERIESPROC,                     glDeleteQueries);
472GL_IMPORT_NV___(true,  PFNGLBEGINQUERYPROC,                        glBeginQuery);
473GL_IMPORT_NV___(true,  PFNGLENDQUERYPROC,                          glEndQuery);
474GL_IMPORT_NV___(true,  PFNGLGETQUERYOBJECTUI64VPROC,               glGetQueryObjectui64v);
475
476#   endif // BGFX_CONFIG_RENDERER_OPENGLES < 30
477#endif // !BGFX_CONFIG_RENDERER_OPENGL
478
479#undef GL_IMPORT_TYPEDEFS
480#undef GL_IMPORT
481#undef GL_EXTENSION
482#undef GL_IMPORT______
483#undef GL_IMPORT_ARB__
484#undef GL_IMPORT_EXT__
485#undef GL_IMPORT_NV___
486#undef GL_IMPORT_OES__
487#undef GL_IMPORT_____x
Property changes on: branches/osd/src/lib/bgfx/glimports.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_ios.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
7#define BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
8
9#if BX_PLATFORM_IOS
10
11namespace bgfx
12{
13   struct GlContext
14   {
15      GlContext()
16         : m_context(0)
17      {
18      }
19       
20      void create(uint32_t _width, uint32_t _height);
21      void destroy();
22      void resize(uint32_t _width, uint32_t _height, bool _vsync);
23      void swap();
24      void import();
25       
26      bool isValid() const
27      {
28         return 0 != m_context;
29      }
30       
31      void* m_view;
32      void* m_context;
33   };
34} // namespace bgfx
35
36#endif // BX_PLATFORM_IOS
37
38#endif // BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/glcontext_ios.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/renderer_gl.cpp
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7
8#if (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
9#   include "renderer_gl.h"
10#   include <bx/timer.h>
11#   include <bx/uint32_t.h>
12
13namespace bgfx
14{
15   static char s_viewName[BGFX_CONFIG_MAX_VIEWS][256];
16
17   struct PrimInfo
18   {
19      GLenum m_type;
20      uint32_t m_min;
21      uint32_t m_div;
22      uint32_t m_sub;
23   };
24
25   static const PrimInfo s_primInfo[] =
26   {
27      { GL_TRIANGLES,      3, 3, 0 },
28      { GL_TRIANGLE_STRIP, 3, 1, 2 },
29      { GL_LINES,          2, 2, 0 },
30      { GL_POINTS,         1, 1, 0 },
31   };
32
33   static const char* s_primName[] =
34   {
35      "TriList",
36      "TriStrip",
37      "Line",
38      "Point",
39   };
40
41   static const char* s_attribName[] =
42   {
43      "a_position",
44      "a_normal",
45      "a_tangent",
46      "a_bitangent",
47      "a_color0",
48      "a_color1",
49      "a_indices",
50      "a_weight",
51      "a_texcoord0",
52      "a_texcoord1",
53      "a_texcoord2",
54      "a_texcoord3",
55      "a_texcoord4",
56      "a_texcoord5",
57      "a_texcoord6",
58      "a_texcoord7",
59   };
60   BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attribName) );
61
62   static const char* s_instanceDataName[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT] =
63   {
64      "i_data0",
65      "i_data1",
66      "i_data2",
67      "i_data3",
68      "i_data4",
69   };
70
71   static const GLenum s_access[Access::Count] =
72   {
73      GL_READ_ONLY,
74      GL_WRITE_ONLY,
75      GL_READ_WRITE,
76   };
77
78   static const GLenum s_attribType[AttribType::Count] =
79   {
80      GL_UNSIGNED_BYTE,
81      GL_SHORT,
82      GL_HALF_FLOAT,
83      GL_FLOAT,
84   };
85
86   struct Blend
87   {
88      GLenum m_src;
89      GLenum m_dst;
90      bool m_factor;
91   };
92
93   static const Blend s_blendFactor[] =
94   {
95      { 0,                           0,                           false }, // ignored
96      { GL_ZERO,                     GL_ZERO,                     false }, // ZERO
97      { GL_ONE,                      GL_ONE,                      false }, // ONE
98      { GL_SRC_COLOR,                GL_SRC_COLOR,                false }, // SRC_COLOR
99      { GL_ONE_MINUS_SRC_COLOR,      GL_ONE_MINUS_SRC_COLOR,      false }, // INV_SRC_COLOR
100      { GL_SRC_ALPHA,                GL_SRC_ALPHA,                false }, // SRC_ALPHA
101      { GL_ONE_MINUS_SRC_ALPHA,      GL_ONE_MINUS_SRC_ALPHA,      false }, // INV_SRC_ALPHA
102      { GL_DST_ALPHA,                GL_DST_ALPHA,                false }, // DST_ALPHA
103      { GL_ONE_MINUS_DST_ALPHA,      GL_ONE_MINUS_DST_ALPHA,      false }, // INV_DST_ALPHA
104      { GL_DST_COLOR,                GL_DST_COLOR,                false }, // DST_COLOR
105      { GL_ONE_MINUS_DST_COLOR,      GL_ONE_MINUS_DST_COLOR,      false }, // INV_DST_COLOR
106      { GL_SRC_ALPHA_SATURATE,       GL_ONE,                      false }, // SRC_ALPHA_SAT
107      { GL_CONSTANT_COLOR,           GL_CONSTANT_COLOR,           true  }, // FACTOR
108      { GL_ONE_MINUS_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_COLOR, true  }, // INV_FACTOR
109   };
110
111   static const GLenum s_blendEquation[] =
112   {
113      GL_FUNC_ADD,
114      GL_FUNC_SUBTRACT,
115      GL_FUNC_REVERSE_SUBTRACT,
116      GL_MIN,
117      GL_MAX,
118   };
119
120   static const GLenum s_cmpFunc[] =
121   {
122      0, // ignored
123      GL_LESS,
124      GL_LEQUAL,
125      GL_EQUAL,
126      GL_GEQUAL,
127      GL_GREATER,
128      GL_NOTEQUAL,
129      GL_NEVER,
130      GL_ALWAYS,
131   };
132
133   static const GLenum s_stencilOp[] =
134   {
135      GL_ZERO,
136      GL_KEEP,
137      GL_REPLACE,
138      GL_INCR_WRAP,
139      GL_INCR,
140      GL_DECR_WRAP,
141      GL_DECR,
142      GL_INVERT,
143   };
144
145   static const GLenum s_stencilFace[] =
146   {
147      GL_FRONT_AND_BACK,
148      GL_FRONT,
149      GL_BACK,
150   };
151
152   static const GLenum s_textureAddress[] =
153   {
154      GL_REPEAT,
155      GL_MIRRORED_REPEAT,
156      GL_CLAMP_TO_EDGE,
157   };
158
159   static const GLenum s_textureFilterMag[] =
160   {
161      GL_LINEAR,
162      GL_NEAREST,
163      GL_LINEAR,
164   };
165
166   static const GLenum s_textureFilterMin[][3] =
167   {
168      { GL_LINEAR,  GL_LINEAR_MIPMAP_LINEAR,  GL_NEAREST_MIPMAP_LINEAR  },
169      { GL_NEAREST, GL_LINEAR_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_NEAREST },
170      { GL_LINEAR,  GL_LINEAR_MIPMAP_LINEAR,  GL_NEAREST_MIPMAP_LINEAR  },
171   };
172
173   struct TextureFormatInfo
174   {
175      GLenum m_internalFmt;
176      GLenum m_fmt;
177      GLenum m_type;
178      bool m_supported;
179   };
180
181   static TextureFormatInfo s_textureFormat[] =
182   {
183      { GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,            GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,            GL_ZERO,                        false }, // BC1
184      { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,            GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,            GL_ZERO,                        false }, // BC2
185      { GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,            GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,            GL_ZERO,                        false }, // BC3
186      { GL_COMPRESSED_LUMINANCE_LATC1_EXT,           GL_COMPRESSED_LUMINANCE_LATC1_EXT,           GL_ZERO,                        false }, // BC4
187      { GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT,     GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT,     GL_ZERO,                        false }, // BC5
188      { GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB,     GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB,     GL_ZERO,                        false }, // BC6H
189      { GL_COMPRESSED_RGBA_BPTC_UNORM_ARB,           GL_COMPRESSED_RGBA_BPTC_UNORM_ARB,           GL_ZERO,                        false }, // BC7
190      { GL_ETC1_RGB8_OES,                            GL_ETC1_RGB8_OES,                            GL_ZERO,                        false }, // ETC1
191      { GL_COMPRESSED_RGB8_ETC2,                     GL_COMPRESSED_RGB8_ETC2,                     GL_ZERO,                        false }, // ETC2
192      { GL_COMPRESSED_RGBA8_ETC2_EAC,                GL_COMPRESSED_RGBA8_ETC2_EAC,                GL_ZERO,                        false }, // ETC2A
193      { GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_ZERO,                        false }, // ETC2A1
194      { GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,          GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,          GL_ZERO,                        false }, // PTC12
195      { GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,          GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,          GL_ZERO,                        false }, // PTC14
196      { GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,         GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,         GL_ZERO,                        false }, // PTC12A
197      { GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,         GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,         GL_ZERO,                        false }, // PTC14A
198      { GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG,         GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG,         GL_ZERO,                        false }, // PTC22
199      { GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG,         GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG,         GL_ZERO,                        false }, // PTC24
200      { GL_ZERO,                                     GL_ZERO,                                     GL_ZERO,                        true  }, // Unknown
201      { GL_ZERO,                                     GL_ZERO,                                     GL_ZERO,                        true  }, // R1
202      { GL_LUMINANCE,                                GL_LUMINANCE,                                GL_UNSIGNED_BYTE,               true  }, // R8
203      { GL_R16,                                      GL_RED,                                      GL_UNSIGNED_SHORT,              true  }, // R16
204      { GL_R16F,                                     GL_RED,                                      GL_HALF_FLOAT,                  true  }, // R16F
205      { GL_R32UI,                                    GL_RED,                                      GL_UNSIGNED_INT,                true  }, // R32
206      { GL_R32F,                                     GL_RED,                                      GL_FLOAT,                       true  }, // R32F
207      { GL_RG8,                                      GL_RG,                                       GL_UNSIGNED_BYTE,               true  }, // RG8
208      { GL_RG16,                                     GL_RG,                                       GL_UNSIGNED_SHORT,              true  }, // RG16
209      { GL_RG16F,                                    GL_RG,                                       GL_FLOAT,                       true  }, // RG16F
210      { GL_RG32UI,                                   GL_RG,                                       GL_UNSIGNED_INT,                true  }, // RG32
211      { GL_RG32F,                                    GL_RG,                                       GL_FLOAT,                       true  }, // RG32F
212      { GL_RGBA,                                     GL_RGBA,                                     GL_UNSIGNED_BYTE,               true  }, // BGRA8
213      { GL_RGBA16,                                   GL_RGBA,                                     GL_UNSIGNED_BYTE,               true  }, // RGBA16
214      { GL_RGBA16F,                                  GL_RGBA,                                     GL_HALF_FLOAT,                  true  }, // RGBA16F
215      { GL_RGBA32UI,                                 GL_RGBA,                                     GL_UNSIGNED_INT,                true  }, // RGBA32
216      { GL_RGBA32F,                                  GL_RGBA,                                     GL_FLOAT,                       true  }, // RGBA32F
217      { GL_RGB565,                                   GL_RGB,                                      GL_UNSIGNED_SHORT_5_6_5,        true  }, // R5G6B5
218      { GL_RGBA4,                                    GL_RGBA,                                     GL_UNSIGNED_SHORT_4_4_4_4,      true  }, // RGBA4
219      { GL_RGB5_A1,                                  GL_RGBA,                                     GL_UNSIGNED_SHORT_5_5_5_1,      true  }, // RGB5A1
220      { GL_RGB10_A2,                                 GL_RGBA,                                     GL_UNSIGNED_INT_2_10_10_10_REV, true  }, // RGB10A2
221      { GL_ZERO,                                     GL_ZERO,                                     GL_ZERO,                        true  }, // UnknownDepth
222      { GL_DEPTH_COMPONENT16,                        GL_DEPTH_COMPONENT,                          GL_UNSIGNED_SHORT,              false }, // D16
223      { GL_DEPTH_COMPONENT24,                        GL_DEPTH_COMPONENT,                          GL_UNSIGNED_INT,                false }, // D24
224      { GL_DEPTH24_STENCIL8,                         GL_DEPTH_STENCIL,                            GL_UNSIGNED_INT_24_8,           false }, // D24S8
225      { GL_DEPTH_COMPONENT32,                        GL_DEPTH_COMPONENT,                          GL_UNSIGNED_INT,                false }, // D32
226      { GL_DEPTH_COMPONENT32F,                       GL_DEPTH_COMPONENT,                          GL_FLOAT,                       false }, // D16F
227      { GL_DEPTH_COMPONENT32F,                       GL_DEPTH_COMPONENT,                          GL_FLOAT,                       false }, // D24F
228      { GL_DEPTH_COMPONENT32F,                       GL_DEPTH_COMPONENT,                          GL_FLOAT,                       false }, // D32F
229      { GL_STENCIL_INDEX8,                           GL_DEPTH_STENCIL,                            GL_UNSIGNED_BYTE,               false }, // D0S8
230   };
231   BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) );
232
233   static GLenum s_imageFormat[] =
234   {
235      GL_ZERO,     // BC1
236      GL_ZERO,     // BC2
237      GL_ZERO,     // BC3
238      GL_ZERO,     // BC4
239      GL_ZERO,     // BC5
240      GL_ZERO,     // BC6H
241      GL_ZERO,     // BC7
242      GL_ZERO,     // ETC1
243      GL_ZERO,     // ETC2
244      GL_ZERO,     // ETC2A
245      GL_ZERO,     // ETC2A1
246      GL_ZERO,     // PTC12
247      GL_ZERO,     // PTC14
248      GL_ZERO,     // PTC12A
249      GL_ZERO,     // PTC14A
250      GL_ZERO,     // PTC22
251      GL_ZERO,     // PTC24
252      GL_ZERO,     // Unknown
253      GL_ZERO,     // R1
254      GL_R8,       // R8
255      GL_R16,      // R16
256      GL_R16F,     // R16F
257      GL_R32UI,    // R32
258      GL_R32F,     // R32F
259      GL_RG8,      // RG8
260      GL_RG16,     // RG16
261      GL_RG16F,    // RG16F
262      GL_RG32UI,   // RG32
263      GL_RG32F,    // RG32F
264      GL_RGBA8,    // BGRA8
265      GL_RGBA16,   // RGBA16
266      GL_RGBA16F,  // RGBA16F
267      GL_RGBA32UI, // RGBA32
268      GL_RGBA32F,  // RGBA32F
269      GL_RGB565,   // R5G6B5
270      GL_RGBA4,    // RGBA4
271      GL_RGB5_A1,  // RGB5A1
272      GL_RGB10_A2, // RGB10A2
273      GL_ZERO,     // UnknownDepth
274      GL_ZERO,     // D16
275      GL_ZERO,     // D24
276      GL_ZERO,     // D24S8
277      GL_ZERO,     // D32
278      GL_ZERO,     // D16F
279      GL_ZERO,     // D24F
280      GL_ZERO,     // D32F
281      GL_ZERO,     // D0S8
282   };
283   BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_imageFormat) );
284
285   struct Extension
286   {
287      enum Enum
288      {
289         ANGLE_depth_texture,
290         ANGLE_framebuffer_blit,
291         ANGLE_framebuffer_multisample,
292         ANGLE_instanced_arrays,
293         ANGLE_texture_compression_dxt1,
294         ANGLE_texture_compression_dxt3,
295         ANGLE_texture_compression_dxt5,
296         ANGLE_translated_shader_source,
297
298         APPLE_texture_format_BGRA8888,
299         APPLE_texture_max_level,
300
301         ARB_compute_shader,
302         ARB_debug_label,
303         ARB_debug_output,
304         ARB_depth_clamp,
305         ARB_draw_buffers_blend,
306         ARB_ES3_compatibility,
307         ARB_framebuffer_object,
308         ARB_framebuffer_sRGB,
309         ARB_get_program_binary,
310         ARB_half_float_pixel,
311         ARB_half_float_vertex,
312         ARB_instanced_arrays,
313         ARB_map_buffer_range,
314         ARB_multisample,
315         ARB_program_interface_query,
316         ARB_sampler_objects,
317         ARB_seamless_cube_map,
318         ARB_shader_image_load_store,
319         ARB_shader_storage_buffer_object,
320         ARB_shader_texture_lod,
321         ARB_texture_compression_bptc,
322         ARB_texture_compression_rgtc,
323         ARB_texture_float,
324         ARB_texture_multisample,
325         ARB_texture_rg,
326         ARB_texture_rgb10_a2ui,
327         ARB_texture_stencil8,
328         ARB_texture_storage,
329         ARB_texture_swizzle,
330         ARB_timer_query,
331         ARB_uniform_buffer_object,
332         ARB_vertex_array_object,
333         ARB_vertex_type_2_10_10_10_rev,
334
335         ATI_meminfo,
336
337         CHROMIUM_depth_texture,
338         CHROMIUM_framebuffer_multisample,
339         CHROMIUM_texture_compression_dxt3,
340         CHROMIUM_texture_compression_dxt5,
341
342         EXT_bgra,
343         EXT_blend_color,
344         EXT_blend_minmax,
345         EXT_blend_subtract,
346         EXT_compressed_ETC1_RGB8_sub_texture,
347         EXT_debug_label,
348         EXT_debug_marker,
349         EXT_frag_depth,
350         EXT_framebuffer_blit,
351         EXT_framebuffer_object,
352         EXT_framebuffer_sRGB,
353         EXT_occlusion_query_boolean,
354         EXT_read_format_bgra,
355         EXT_shader_image_load_store,
356         EXT_shader_texture_lod,
357         EXT_shadow_samplers,
358         EXT_texture_array,
359         EXT_texture_compression_dxt1,
360         EXT_texture_compression_latc,
361         EXT_texture_compression_rgtc,
362         EXT_texture_compression_s3tc,
363         EXT_texture_filter_anisotropic,
364         EXT_texture_format_BGRA8888,
365         EXT_texture_rg,
366         EXT_texture_sRGB,
367         EXT_texture_storage,
368         EXT_texture_swizzle,
369         EXT_texture_type_2_10_10_10_REV,
370         EXT_timer_query,
371         EXT_unpack_subimage,
372
373         GOOGLE_depth_texture,
374
375         GREMEDY_string_marker,
376         GREMEDY_frame_terminator,
377
378         IMG_multisampled_render_to_texture,
379         IMG_read_format,
380         IMG_shader_binary,
381         IMG_texture_compression_pvrtc,
382         IMG_texture_compression_pvrtc2,
383         IMG_texture_format_BGRA8888,
384
385         INTEL_fragment_shader_ordering,
386
387         KHR_debug,
388
389         MOZ_WEBGL_compressed_texture_s3tc,
390         MOZ_WEBGL_depth_texture,
391
392         NV_draw_buffers,
393         NVX_gpu_memory_info,
394
395         OES_compressed_ETC1_RGB8_texture,
396         OES_depth24,
397         OES_depth32,
398         OES_depth_texture,
399         OES_fragment_precision_high,
400         OES_get_program_binary,
401         OES_required_internalformat,
402         OES_packed_depth_stencil,
403         OES_read_format,
404         OES_rgb8_rgba8,
405         OES_standard_derivatives,
406         OES_texture_3D,
407         OES_texture_float,
408         OES_texture_float_linear,
409         OES_texture_npot,
410         OES_texture_half_float,
411         OES_texture_half_float_linear,
412         OES_vertex_array_object,
413         OES_vertex_half_float,
414         OES_vertex_type_10_10_10_2,
415
416         WEBGL_compressed_texture_etc1,
417         WEBGL_compressed_texture_s3tc,
418         WEBGL_compressed_texture_pvrtc,
419         WEBGL_depth_texture,
420
421         WEBKIT_EXT_texture_filter_anisotropic,
422         WEBKIT_WEBGL_compressed_texture_s3tc,
423         WEBKIT_WEBGL_depth_texture,
424
425         Count
426      };
427
428      const char* m_name;
429      bool m_supported;
430      bool m_initialize;
431   };
432
433   static Extension s_extension[Extension::Count] =
434   {
435      { "ANGLE_depth_texture",                   false,                             true  },
436      { "ANGLE_framebuffer_blit",                false,                             true  },
437      { "ANGLE_framebuffer_multisample",         false,                             false },
438      { "ANGLE_instanced_arrays",                false,                             true  },
439      { "ANGLE_texture_compression_dxt1",        false,                             true  },
440      { "ANGLE_texture_compression_dxt3",        false,                             true  },
441      { "ANGLE_texture_compression_dxt5",        false,                             true  },
442      { "ANGLE_translated_shader_source",        false,                             true  },
443
444      { "APPLE_texture_format_BGRA8888",         false,                             true  },
445      { "APPLE_texture_max_level",               false,                             true  },
446
447      { "ARB_compute_shader",                    BGFX_CONFIG_RENDERER_OPENGL >= 43, true  },
448      { "ARB_debug_label",                       false,                             true  },
449      { "ARB_debug_output",                      BGFX_CONFIG_RENDERER_OPENGL >= 43, true  },
450      { "ARB_depth_clamp",                       BGFX_CONFIG_RENDERER_OPENGL >= 32, true  },
451      { "ARB_draw_buffers_blend",                BGFX_CONFIG_RENDERER_OPENGL >= 40, true  },
452      { "ARB_ES3_compatibility",                 BGFX_CONFIG_RENDERER_OPENGL >= 43, true  },
453      { "ARB_framebuffer_object",                BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
454      { "ARB_framebuffer_sRGB",                  BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
455      { "ARB_get_program_binary",                BGFX_CONFIG_RENDERER_OPENGL >= 41, true  },
456      { "ARB_half_float_pixel",                  BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
457      { "ARB_half_float_vertex",                 BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
458      { "ARB_instanced_arrays",                  BGFX_CONFIG_RENDERER_OPENGL >= 33, true  },
459      { "ARB_map_buffer_range",                  BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
460      { "ARB_multisample",                       false,                             true  },
461      { "ARB_program_interface_query",           BGFX_CONFIG_RENDERER_OPENGL >= 43, true  },
462      { "ARB_sampler_objects",                   BGFX_CONFIG_RENDERER_OPENGL >= 33, true  },
463      { "ARB_seamless_cube_map",                 BGFX_CONFIG_RENDERER_OPENGL >= 32, true  },
464      { "ARB_shader_image_load_store",           BGFX_CONFIG_RENDERER_OPENGL >= 42, true  },
465      { "ARB_shader_storage_buffer_object",      BGFX_CONFIG_RENDERER_OPENGL >= 43, true  },
466      { "ARB_shader_texture_lod",                BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
467      { "ARB_texture_compression_bptc",          BGFX_CONFIG_RENDERER_OPENGL >= 44, true  },
468      { "ARB_texture_compression_rgtc",          BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
469      { "ARB_texture_float",                     BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
470      { "ARB_texture_multisample",               BGFX_CONFIG_RENDERER_OPENGL >= 32, true  },
471      { "ARB_texture_rg",                        BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
472      { "ARB_texture_rgb10_a2ui",                BGFX_CONFIG_RENDERER_OPENGL >= 33, true  },
473      { "ARB_texture_stencil8",                  false,                             true  },
474      { "ARB_texture_storage",                   BGFX_CONFIG_RENDERER_OPENGL >= 42, true  },
475      { "ARB_texture_swizzle",                   BGFX_CONFIG_RENDERER_OPENGL >= 33, true  },
476      { "ARB_timer_query",                       BGFX_CONFIG_RENDERER_OPENGL >= 33, true  },
477      { "ARB_uniform_buffer_object",             BGFX_CONFIG_RENDERER_OPENGL >= 31, true  },
478      { "ARB_vertex_array_object",               BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
479      { "ARB_vertex_type_2_10_10_10_rev",        false,                             true  },
480
481      { "ATI_meminfo",                           false,                             true  },
482
483      { "CHROMIUM_depth_texture",                false,                             true  },
484      { "CHROMIUM_framebuffer_multisample",      false,                             true  },
485      { "CHROMIUM_texture_compression_dxt3",     false,                             true  },
486      { "CHROMIUM_texture_compression_dxt5",     false,                             true  },
487
488      { "EXT_bgra",                              false,                             true  },
489      { "EXT_blend_color",                       BGFX_CONFIG_RENDERER_OPENGL >= 31, true  },
490      { "EXT_blend_minmax",                      BGFX_CONFIG_RENDERER_OPENGL >= 14, true  },
491      { "EXT_blend_subtract",                    BGFX_CONFIG_RENDERER_OPENGL >= 14, true  },
492      { "EXT_compressed_ETC1_RGB8_sub_texture",  false,                             true  }, // GLES2 extension.
493      { "EXT_debug_label",                       false,                             true  },
494      { "EXT_debug_marker",                      false,                             true  },
495      { "EXT_frag_depth",                        false,                             true  }, // GLES2 extension.
496      { "EXT_framebuffer_blit",                  BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
497      { "EXT_framebuffer_object",                BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
498      { "EXT_framebuffer_sRGB",                  BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
499      { "EXT_occlusion_query_boolean",           false,                             true  },
500      { "EXT_read_format_bgra",                  false,                             true  },
501      { "EXT_shader_image_load_store",           false,                             true  },
502      { "EXT_shader_texture_lod",                false,                             true  }, // GLES2 extension.
503      { "EXT_shadow_samplers",                   false,                             true  },
504      { "EXT_texture_array",                     BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
505      { "EXT_texture_compression_dxt1",          false,                             true  },
506      { "EXT_texture_compression_latc",          false,                             true  },
507      { "EXT_texture_compression_rgtc",          BGFX_CONFIG_RENDERER_OPENGL >= 30, true  },
508      { "EXT_texture_compression_s3tc",          false,                             true  },
509      { "EXT_texture_filter_anisotropic",        false,                             true  },
510      { "EXT_texture_format_BGRA8888",           false,                             true  },
511      { "EXT_texture_rg",                        false,                             true  }, // GLES2 extension.
512      { "EXT_texture_sRGB",                      false,                             true  },
513      { "EXT_texture_storage",                   false,                             true  },
514      { "EXT_texture_swizzle",                   false,                             true  },
515      { "EXT_texture_type_2_10_10_10_REV",       false,                             true  },
516      { "EXT_timer_query",                       false,                             true  },
517      { "EXT_unpack_subimage",                   false,                             true  },
518
519      { "GOOGLE_depth_texture",                  false,                             true  },
520
521      { "GREMEDY_string_marker",                 false,                             true  },
522      { "GREMEDY_frame_terminator",              false,                             true  },
523
524      { "IMG_multisampled_render_to_texture",    false,                             true  },
525      { "IMG_read_format",                       false,                             true  },
526      { "IMG_shader_binary",                     false,                             true  },
527      { "IMG_texture_compression_pvrtc",         false,                             true  },
528      { "IMG_texture_compression_pvrtc2",        false,                             true  },
529      { "IMG_texture_format_BGRA8888",           false,                             true  },
530
531      { "INTEL_fragment_shader_ordering",        false,                             true  },
532
533      { "KHR_debug",                             BGFX_CONFIG_RENDERER_OPENGL >= 43, true  },
534
535      { "MOZ_WEBGL_compressed_texture_s3tc",     false,                             true  },
536      { "MOZ_WEBGL_depth_texture",               false,                             true  },
537
538      { "NV_draw_buffers",                       false,                             true  }, // GLES2 extension.
539      { "NVX_gpu_memory_info",                   false,                             true  },
540
541      { "OES_compressed_ETC1_RGB8_texture",      false,                             true  },
542      { "OES_depth24",                           false,                             true  },
543      { "OES_depth32",                           false,                             true  },
544      { "OES_depth_texture",                     false,                             true  },
545      { "OES_fragment_precision_high",           false,                             true  },
546      { "OES_get_program_binary",                false,                             true  },
547      { "OES_required_internalformat",           false,                             true  },
548      { "OES_packed_depth_stencil",              false,                             true  },
549      { "OES_read_format",                       false,                             true  },
550      { "OES_rgb8_rgba8",                        false,                             true  },
551      { "OES_standard_derivatives",              false,                             true  },
552      { "OES_texture_3D",                        false,                             true  },
553      { "OES_texture_float",                     false,                             true  },
554      { "OES_texture_float_linear",              false,                             true  },
555      { "OES_texture_npot",                      false,                             true  },
556      { "OES_texture_half_float",                false,                             true  },
557      { "OES_texture_half_float_linear",         false,                             true  },
558      { "OES_vertex_array_object",               false,                             !BX_PLATFORM_IOS },
559      { "OES_vertex_half_float",                 false,                             true  },
560      { "OES_vertex_type_10_10_10_2",            false,                             true  },
561
562      { "WEBGL_compressed_texture_etc1",         false,                             true  },
563      { "WEBGL_compressed_texture_s3tc",         false,                             true  },
564      { "WEBGL_compressed_texture_pvrtc",        false,                             true  },
565      { "WEBGL_depth_texture",                   false,                             true  },
566
567      { "WEBKIT_EXT_texture_filter_anisotropic", false,                             true  },
568      { "WEBKIT_WEBGL_compressed_texture_s3tc",  false,                             true  },
569      { "WEBKIT_WEBGL_depth_texture",            false,                             true  },
570   };
571
572   static const char* s_ARB_shader_texture_lod[] =
573   {
574      "texture2DLod",
575      "texture2DProjLod",
576      "texture3DLod",
577      "texture3DProjLod",
578      "textureCubeLod",
579      "shadow2DLod",
580      "shadow2DProjLod",
581      NULL
582      // "texture1DLod",
583      // "texture1DProjLod",
584      // "shadow1DLod",
585      // "shadow1DProjLod",
586   };
587
588   static const char* s_EXT_shader_texture_lod[] =
589   {
590      "texture2DLod",
591      "texture2DProjLod",
592      "textureCubeLod",
593      NULL
594      // "texture2DGrad",
595      // "texture2DProjGrad",
596      // "textureCubeGrad",
597   };
598
599   static const char* s_EXT_shadow_samplers[] =
600   {
601      "shadow2D",
602      "shadow2DProj",
603      NULL
604   };
605
606   static const char* s_OES_standard_derivatives[] =
607   {
608      "dFdx",
609      "dFdy",
610      "fwidth",
611      NULL
612   };
613
614   static const char* s_OES_texture_3D[] =
615   {
616      "texture3D",
617      "texture3DProj",
618      "texture3DLod",
619      "texture3DProjLod",
620      NULL
621   };
622
623   static void GL_APIENTRY stubVertexAttribDivisor(GLuint /*_index*/, GLuint /*_divisor*/)
624   {
625   }
626
627   static void GL_APIENTRY stubDrawArraysInstanced(GLenum _mode, GLint _first, GLsizei _count, GLsizei /*_primcount*/)
628   {
629      GL_CHECK(glDrawArrays(_mode, _first, _count) );
630   }
631
632   static void GL_APIENTRY stubDrawElementsInstanced(GLenum _mode, GLsizei _count, GLenum _type, const GLvoid* _indices, GLsizei /*_primcount*/)
633   {
634      GL_CHECK(glDrawElements(_mode, _count, _type, _indices) );
635   }
636
637   static void GL_APIENTRY stubFrameTerminatorGREMEDY()
638   {
639   }
640
641   static void GL_APIENTRY stubInsertEventMarker(GLsizei /*_length*/, const char* /*_marker*/)
642   {
643   }
644
645   static void GL_APIENTRY stubInsertEventMarkerGREMEDY(GLsizei _length, const char* _marker)
646   {
647      // If <marker> is a null-terminated string then <length> should not
648      // include the terminator.
649      //
650      // If <length> is 0 then <marker> is assumed to be null-terminated.
651
652      uint32_t size = (0 == _length ? (uint32_t)strlen(_marker) : _length) + 1;
653      size *= sizeof(wchar_t);
654      wchar_t* name = (wchar_t*)alloca(size);
655      mbstowcs(name, _marker, size-2);
656      GL_CHECK(glStringMarkerGREMEDY(_length, _marker) );
657   }
658
659   static void GL_APIENTRY stubObjectLabel(GLenum /*_identifier*/, GLuint /*_name*/, GLsizei /*_length*/, const char* /*_label*/)
660   {
661   }
662
663   typedef void (*PostSwapBuffersFn)(uint32_t _width, uint32_t _height);
664
665   static const char* getGLString(GLenum _name)
666   {
667      const char* str = (const char*)glGetString(_name);
668      glGetError(); // ignore error if glGetString returns NULL.
669      if (NULL != str)
670      {
671         return str;
672      }
673
674      return "<unknown>";
675   }
676
677   static uint32_t getGLStringHash(GLenum _name)
678   {
679      const char* str = (const char*)glGetString(_name);
680      glGetError(); // ignore error if glGetString returns NULL.
681      if (NULL != str)
682      {
683         return bx::hashMurmur2A(str, (uint32_t)strlen(str) );
684      }
685
686      return 0;
687   }
688
689   void dumpExtensions(const char* _extensions)
690   {
691      if (NULL != _extensions)
692      {
693         char name[1024];
694         const char* pos = _extensions;
695         const char* end = _extensions + strlen(_extensions);
696         while (pos < end)
697         {
698            uint32_t len;
699            const char* space = strchr(pos, ' ');
700            if (NULL != space)
701            {
702               len = bx::uint32_min(sizeof(name), (uint32_t)(space - pos) );
703            }
704            else
705            {
706               len = bx::uint32_min(sizeof(name), (uint32_t)strlen(pos) );
707            }
708
709            strncpy(name, pos, len);
710            name[len] = '\0';
711
712            BX_TRACE("\t%s", name);
713
714            pos += len+1;
715         }
716      }
717   }
718
719   const char* toString(GLenum _enum)
720   {
721#if defined(GL_DEBUG_SOURCE_API_ARB)
722      switch (_enum)
723      {
724      case GL_DEBUG_SOURCE_API_ARB:               return "API";
725      case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB:     return "WinSys";
726      case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB:   return "Shader";
727      case GL_DEBUG_SOURCE_THIRD_PARTY_ARB:       return "3rdparty";
728      case GL_DEBUG_SOURCE_APPLICATION_ARB:       return "Application";
729      case GL_DEBUG_SOURCE_OTHER_ARB:             return "Other";
730      case GL_DEBUG_TYPE_ERROR_ARB:               return "Error";
731      case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: return "Deprecated behavior";
732      case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB:  return "Undefined behavior";
733      case GL_DEBUG_TYPE_PORTABILITY_ARB:         return "Portability";
734      case GL_DEBUG_TYPE_PERFORMANCE_ARB:         return "Performance";
735      case GL_DEBUG_TYPE_OTHER_ARB:               return "Other";
736      case GL_DEBUG_SEVERITY_HIGH_ARB:            return "High";
737      case GL_DEBUG_SEVERITY_MEDIUM_ARB:          return "Medium";
738      case GL_DEBUG_SEVERITY_LOW_ARB:             return "Low";
739      default:
740         break;
741      }
742#else
743      BX_UNUSED(_enum);
744#endif // defined(GL_DEBUG_SOURCE_API_ARB)
745
746      return "<unknown>";
747   }
748
749   void GL_APIENTRY debugProcCb(GLenum _source, GLenum _type, GLuint _id, GLenum _severity, GLsizei /*_length*/, const GLchar* _message, const void* /*_userParam*/)
750   {
751      BX_TRACE("src %s, type %s, id %d, severity %s, '%s'"
752            , toString(_source)
753            , toString(_type)
754            , _id
755            , toString(_severity)
756            , _message
757            );
758      BX_UNUSED(_source, _type, _id, _severity, _message);
759   }
760
761   GLint glGet(GLenum _pname)
762   {
763      GLint result = 0;
764      glGetIntegerv(_pname, &result);
765      GLenum err = glGetError();
766      BX_WARN(0 == err, "glGetIntegerv(0x%04x, ...) failed with GL error: 0x%04x.", _pname, err);
767      return 0 == err ? result : 0;
768   }
769
770   void setTextureFormat(TextureFormat::Enum _format, GLenum _internalFmt, GLenum _fmt, GLenum _type = GL_ZERO)
771   {
772      TextureFormatInfo& tfi = s_textureFormat[_format];
773      tfi.m_internalFmt = _internalFmt;
774      tfi.m_fmt         = _fmt;
775      tfi.m_type        = _type;
776   }
777
778   bool isTextureFormatValid(TextureFormat::Enum _format)
779   {
780      GLuint id;
781      GL_CHECK(glGenTextures(1, &id) );
782      GL_CHECK(glBindTexture(GL_TEXTURE_2D, id) );
783
784      const TextureFormatInfo& tfi = s_textureFormat[_format];
785
786      GLsizei size = (16*16*getBitsPerPixel(_format) )/8;
787      void* data = alloca(size);
788
789      if (isCompressed(_format) )
790      {
791         glCompressedTexImage2D(GL_TEXTURE_2D, 0, tfi.m_internalFmt, 16, 16, 0, size, data);
792      }
793      else
794      {
795         glTexImage2D(GL_TEXTURE_2D, 0, tfi.m_internalFmt, 16, 16, 0, tfi.m_fmt, tfi.m_type, data);
796      }
797
798      GLenum err = glGetError();
799      BX_WARN(0 == err, "TextureFormat::%s is not supported (%x: %s).", getName(_format), err, glEnumName(err) );
800
801      GL_CHECK(glDeleteTextures(1, &id) );
802
803      return 0 == err;
804   }
805
806   struct RendererContextGL : public RendererContextI
807   {
808      RendererContextGL()
809         : m_rtMsaa(false)
810         , m_capture(NULL)
811         , m_captureSize(0)
812         , m_maxAnisotropy(0.0f)
813         , m_maxMsaa(0)
814         , m_vao(0)
815         , m_vaoSupport(false)
816         , m_samplerObjectSupport(false)
817         , m_shadowSamplersSupport(false)
818         , m_programBinarySupport(false)
819         , m_textureSwizzleSupport(false)
820         , m_depthTextureSupport(false)
821         , m_useClearQuad(!!BGFX_CONFIG_RENDERER_OPENGL)
822         , m_flip(false)
823         , m_hash( (BX_PLATFORM_WINDOWS<<1) | BX_ARCH_64BIT)
824         , m_backBufferFbo(0)
825         , m_msaaBackBufferFbo(0)
826      {
827         m_fbh.idx = invalidHandle;
828         memset(m_uniforms, 0, sizeof(m_uniforms) );
829         memset(&m_resolution, 0, sizeof(m_resolution) );
830
831         setRenderContextSize(BGFX_DEFAULT_WIDTH, BGFX_DEFAULT_HEIGHT);
832
833         m_vendor = getGLString(GL_VENDOR);
834         m_renderer = getGLString(GL_RENDERER);
835         m_version = getGLString(GL_VERSION);
836         m_glslVersion = getGLString(GL_SHADING_LANGUAGE_VERSION);
837
838         GLint numCmpFormats = 0;
839         GL_CHECK(glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCmpFormats) );
840         BX_TRACE("GL_NUM_COMPRESSED_TEXTURE_FORMATS %d", numCmpFormats);
841
842         GLint* cmpFormat = NULL;
843
844         if (0 < numCmpFormats)
845         {
846            numCmpFormats = numCmpFormats > 256 ? 256 : numCmpFormats;
847            cmpFormat = (GLint*)alloca(sizeof(GLint)*numCmpFormats);
848            GL_CHECK(glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, cmpFormat) );
849
850            for (GLint ii = 0; ii < numCmpFormats; ++ii)
851            {
852               GLint internalFmt = cmpFormat[ii];
853               uint32_t fmt = uint32_t(TextureFormat::Unknown);
854               for (uint32_t jj = 0; jj < fmt; ++jj)
855               {
856                  if (s_textureFormat[jj].m_internalFmt == (GLenum)internalFmt)
857                  {
858                     s_textureFormat[jj].m_supported = true;
859                     fmt = jj;
860                  }
861               }
862
863               BX_TRACE("  %3d: %8x %s", ii, internalFmt, getName( (TextureFormat::Enum)fmt) );
864            }
865         }
866
867         if (BX_ENABLED(BGFX_CONFIG_DEBUG) )
868         {
869#define GL_GET(_pname, _min) BX_TRACE("  " #_pname " %d (min: %d)", glGet(_pname), _min)
870            BX_TRACE("Defaults:");
871#if BGFX_CONFIG_RENDERER_OPENGL >= 41 || BGFX_CONFIG_RENDERER_OPENGLES
872            GL_GET(GL_MAX_FRAGMENT_UNIFORM_VECTORS, 16);
873            GL_GET(GL_MAX_VERTEX_UNIFORM_VECTORS, 128);
874            GL_GET(GL_MAX_VARYING_VECTORS, 8);
875#else
876            GL_GET(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS, 16 * 4);
877            GL_GET(GL_MAX_VERTEX_UNIFORM_COMPONENTS, 128 * 4);
878            GL_GET(GL_MAX_VARYING_FLOATS, 8 * 4);
879#endif // BGFX_CONFIG_RENDERER_OPENGL >= 41 || BGFX_CONFIG_RENDERER_OPENGLES
880            GL_GET(GL_MAX_VERTEX_ATTRIBS, 8);
881            GL_GET(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, 8);
882            GL_GET(GL_MAX_CUBE_MAP_TEXTURE_SIZE, 16);
883            GL_GET(GL_MAX_TEXTURE_IMAGE_UNITS, 8);
884            GL_GET(GL_MAX_TEXTURE_SIZE, 64);
885            GL_GET(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 0);
886            GL_GET(GL_MAX_RENDERBUFFER_SIZE, 1);
887#undef GL_GET
888
889            BX_TRACE("      Vendor: %s", m_vendor);
890            BX_TRACE("    Renderer: %s", m_renderer);
891            BX_TRACE("     Version: %s", m_version);
892            BX_TRACE("GLSL version: %s", m_glslVersion);
893         }
894
895         // Initial binary shader hash depends on driver version.
896         m_hash = ( (BX_PLATFORM_WINDOWS<<1) | BX_ARCH_64BIT)
897            ^ (uint64_t(getGLStringHash(GL_VENDOR  ) )<<32)
898            ^ (uint64_t(getGLStringHash(GL_RENDERER) )<<0 )
899            ^ (uint64_t(getGLStringHash(GL_VERSION ) )<<16)
900            ;
901
902         if (BX_ENABLED(BGFX_CONFIG_RENDERER_USE_EXTENSIONS) )
903         {
904            const char* extensions = (const char*)glGetString(GL_EXTENSIONS);
905            glGetError(); // ignore error if glGetString returns NULL.
906            if (NULL != extensions)
907            {
908               char name[1024];
909               const char* pos = extensions;
910               const char* end = extensions + strlen(extensions);
911               uint32_t index = 0;
912               while (pos < end)
913               {
914                  uint32_t len;
915                  const char* space = strchr(pos, ' ');
916                  if (NULL != space)
917                  {
918                     len = bx::uint32_min(sizeof(name), (uint32_t)(space - pos) );
919                  }
920                  else
921                  {
922                     len = bx::uint32_min(sizeof(name), (uint32_t)strlen(pos) );
923                  }
924
925                  strncpy(name, pos, len);
926                  name[len] = '\0';
927
928                  bool supported = false;
929                  for (uint32_t ii = 0; ii < Extension::Count; ++ii)
930                  {
931                     Extension& extension = s_extension[ii];
932                     if (!extension.m_supported
933                     &&  extension.m_initialize)
934                     {
935                        const char* ext = name;
936                        if (0 == strncmp(ext, "GL_", 3) ) // skip GL_
937                        {
938                           ext += 3;
939                        }
940
941                        if (0 == strcmp(ext, extension.m_name) )
942                        {
943                           extension.m_supported = true;
944                           supported = true;
945                           break;
946                        }
947                     }
948                  }
949
950                  BX_TRACE("GL_EXTENSION %3d%s: %s", index, supported ? " (supported)" : "", name);
951                  BX_UNUSED(supported);
952
953                  pos += len+1;
954                  ++index;
955               }
956
957               BX_TRACE("Supported extensions:");
958               for (uint32_t ii = 0; ii < Extension::Count; ++ii)
959               {
960                  if (s_extension[ii].m_supported)
961                  {
962                     BX_TRACE("\t%2d: %s", ii, s_extension[ii].m_name);
963                  }
964               }
965            }
966         }
967
968         bool bc123Supported = 0
969            || s_extension[Extension::EXT_texture_compression_s3tc        ].m_supported
970            || s_extension[Extension::MOZ_WEBGL_compressed_texture_s3tc   ].m_supported
971            || s_extension[Extension::WEBGL_compressed_texture_s3tc       ].m_supported
972            || s_extension[Extension::WEBKIT_WEBGL_compressed_texture_s3tc].m_supported
973            ;
974         s_textureFormat[TextureFormat::BC1].m_supported |= bc123Supported
975            || s_extension[Extension::ANGLE_texture_compression_dxt1].m_supported
976            || s_extension[Extension::EXT_texture_compression_dxt1  ].m_supported
977            ;
978
979         if (!s_textureFormat[TextureFormat::BC1].m_supported
980         && ( s_textureFormat[TextureFormat::BC2].m_supported || s_textureFormat[TextureFormat::BC3].m_supported) )
981         {
982            // If RGBA_S3TC_DXT1 is not supported, maybe RGB_S3TC_DXT1 is?
983            for (GLint ii = 0; ii < numCmpFormats; ++ii)
984            {
985               if (GL_COMPRESSED_RGB_S3TC_DXT1_EXT == cmpFormat[ii])
986               {
987                  setTextureFormat(TextureFormat::BC1, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGB_S3TC_DXT1_EXT);
988                  s_textureFormat[TextureFormat::BC1].m_supported   = true;
989                  break;
990               }
991            }
992         }
993
994         s_textureFormat[TextureFormat::BC2].m_supported |= bc123Supported
995            || s_extension[Extension::ANGLE_texture_compression_dxt3   ].m_supported
996            || s_extension[Extension::CHROMIUM_texture_compression_dxt3].m_supported
997            ;
998
999         s_textureFormat[TextureFormat::BC3].m_supported |= bc123Supported
1000            || s_extension[Extension::ANGLE_texture_compression_dxt5   ].m_supported
1001            || s_extension[Extension::CHROMIUM_texture_compression_dxt5].m_supported
1002            ;
1003
1004         if (s_extension[Extension::EXT_texture_compression_latc].m_supported)
1005         {
1006            setTextureFormat(TextureFormat::BC4, GL_COMPRESSED_LUMINANCE_LATC1_EXT,       GL_COMPRESSED_LUMINANCE_LATC1_EXT);
1007            setTextureFormat(TextureFormat::BC5, GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT, GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT);
1008         }
1009
1010         if (s_extension[Extension::ARB_texture_compression_rgtc].m_supported
1011         ||  s_extension[Extension::EXT_texture_compression_rgtc].m_supported)
1012         {
1013            setTextureFormat(TextureFormat::BC4, GL_COMPRESSED_RED_RGTC1, GL_COMPRESSED_RED_RGTC1);
1014            setTextureFormat(TextureFormat::BC5, GL_COMPRESSED_RG_RGTC2,  GL_COMPRESSED_RG_RGTC2);
1015         }
1016
1017         bool etc1Supported = 0
1018            || s_extension[Extension::OES_compressed_ETC1_RGB8_texture].m_supported
1019            || s_extension[Extension::WEBGL_compressed_texture_etc1   ].m_supported
1020            ;
1021         s_textureFormat[TextureFormat::ETC1].m_supported |= etc1Supported;
1022
1023         bool etc2Supported = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
1024            || s_extension[Extension::ARB_ES3_compatibility].m_supported
1025            ;
1026         s_textureFormat[TextureFormat::ETC2  ].m_supported |= etc2Supported;
1027         s_textureFormat[TextureFormat::ETC2A ].m_supported |= etc2Supported;
1028         s_textureFormat[TextureFormat::ETC2A1].m_supported |= etc2Supported;
1029
1030         if (!s_textureFormat[TextureFormat::ETC1].m_supported
1031         &&   s_textureFormat[TextureFormat::ETC2].m_supported)
1032         {
1033            // When ETC2 is supported override ETC1 texture format settings.
1034            s_textureFormat[TextureFormat::ETC1].m_internalFmt = GL_COMPRESSED_RGB8_ETC2;
1035            s_textureFormat[TextureFormat::ETC1].m_fmt         = GL_COMPRESSED_RGB8_ETC2;
1036            s_textureFormat[TextureFormat::ETC1].m_supported   = true;
1037         }
1038
1039         bool ptc1Supported = 0
1040            || s_extension[Extension::IMG_texture_compression_pvrtc ].m_supported
1041            || s_extension[Extension::WEBGL_compressed_texture_pvrtc].m_supported
1042            ;
1043         s_textureFormat[TextureFormat::PTC12 ].m_supported |= ptc1Supported;
1044         s_textureFormat[TextureFormat::PTC14 ].m_supported |= ptc1Supported;
1045         s_textureFormat[TextureFormat::PTC12A].m_supported |= ptc1Supported;
1046         s_textureFormat[TextureFormat::PTC14A].m_supported |= ptc1Supported;
1047
1048         bool ptc2Supported = s_extension[Extension::IMG_texture_compression_pvrtc2].m_supported;
1049         s_textureFormat[TextureFormat::PTC22].m_supported |= ptc2Supported;
1050         s_textureFormat[TextureFormat::PTC24].m_supported |= ptc2Supported;
1051
1052         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) )
1053         {
1054            setTextureFormat(TextureFormat::D32, GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT);
1055
1056            if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
1057            {
1058               setTextureFormat(TextureFormat::R16,    GL_R16UI,    GL_RED_INTEGER,  GL_UNSIGNED_SHORT);
1059               setTextureFormat(TextureFormat::RGBA16, GL_RGBA16UI, GL_RGBA_INTEGER, GL_UNSIGNED_SHORT);
1060            }
1061            else
1062            {
1063               setTextureFormat(TextureFormat::RGBA16F, GL_RGBA, GL_RGBA, GL_HALF_FLOAT);
1064
1065               if (BX_ENABLED(BX_PLATFORM_IOS) )
1066               {
1067                  setTextureFormat(TextureFormat::D16,   GL_DEPTH_COMPONENT, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT);
1068                  setTextureFormat(TextureFormat::D24S8, GL_DEPTH_STENCIL,   GL_DEPTH_STENCIL,   GL_UNSIGNED_INT_24_8);
1069               }
1070            }
1071         }
1072
1073         if (s_extension[Extension::EXT_texture_format_BGRA8888  ].m_supported
1074         ||  s_extension[Extension::EXT_bgra                     ].m_supported
1075         ||  s_extension[Extension::IMG_texture_format_BGRA8888  ].m_supported
1076         ||  s_extension[Extension::APPLE_texture_format_BGRA8888].m_supported)
1077         {
1078            if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
1079            {
1080               m_readPixelsFmt = GL_BGRA;
1081            }
1082
1083            s_textureFormat[TextureFormat::BGRA8].m_fmt = GL_BGRA;
1084
1085            // Mixing GLES and GL extensions here. OpenGL EXT_bgra and
1086            // APPLE_texture_format_BGRA8888 wants
1087            // format to be BGRA but internal format to stay RGBA, but
1088            // EXT_texture_format_BGRA8888 wants both format and internal
1089            // format to be BGRA.
1090            //
1091            // Reference:
1092            // https://www.khronos.org/registry/gles/extensions/EXT/EXT_texture_format_BGRA8888.txt
1093            // https://www.opengl.org/registry/specs/EXT/bgra.txt
1094            // https://www.khronos.org/registry/gles/extensions/APPLE/APPLE_texture_format_BGRA8888.txt
1095            if (!s_extension[Extension::EXT_bgra                     ].m_supported
1096            &&  !s_extension[Extension::APPLE_texture_format_BGRA8888].m_supported)
1097            {
1098               s_textureFormat[TextureFormat::BGRA8].m_internalFmt = GL_BGRA;
1099            }
1100
1101            if (!isTextureFormatValid(TextureFormat::BGRA8) )
1102            {
1103               // Revert back to RGBA if texture can't be created.
1104               setTextureFormat(TextureFormat::BGRA8, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE);
1105            }
1106         }
1107
1108         if (!BX_ENABLED(BX_PLATFORM_EMSCRIPTEN) )
1109         {
1110            for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
1111            {
1112               if (TextureFormat::Unknown != ii
1113               &&  TextureFormat::UnknownDepth != ii)
1114               {
1115                  s_textureFormat[ii].m_supported = isTextureFormatValid( (TextureFormat::Enum)ii);
1116               }
1117            }
1118         }
1119
1120         for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
1121         {
1122            g_caps.formats[ii] = s_textureFormat[ii].m_supported ? 1 : 0;
1123         }
1124
1125         g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) || s_extension[Extension::OES_texture_3D].m_supported
1126            ? BGFX_CAPS_TEXTURE_3D
1127            : 0
1128            ;
1129         g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) || s_extension[Extension::EXT_shadow_samplers].m_supported
1130            ? BGFX_CAPS_TEXTURE_COMPARE_ALL
1131            : 0
1132            ;
1133         g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) || s_extension[Extension::OES_vertex_half_float].m_supported
1134            ? BGFX_CAPS_VERTEX_ATTRIB_HALF
1135            : 0
1136            ;
1137         g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) || s_extension[Extension::EXT_frag_depth].m_supported
1138            ? BGFX_CAPS_FRAGMENT_DEPTH
1139            : 0
1140            ;
1141         g_caps.supported |= s_extension[Extension::ARB_draw_buffers_blend].m_supported
1142            ? BGFX_CAPS_BLEND_INDEPENDENT
1143            : 0
1144            ;
1145         g_caps.supported |= s_extension[Extension::INTEL_fragment_shader_ordering].m_supported
1146            ? BGFX_CAPS_FRAGMENT_ORDERING
1147            : 0
1148            ;
1149
1150         g_caps.maxTextureSize = glGet(GL_MAX_TEXTURE_SIZE);
1151
1152         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
1153         ||  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
1154         {
1155            g_caps.maxFBAttachments = bx::uint32_min(glGet(GL_MAX_COLOR_ATTACHMENTS), BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS);
1156         }
1157
1158         m_vaoSupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
1159            || s_extension[Extension::ARB_vertex_array_object].m_supported
1160            || s_extension[Extension::OES_vertex_array_object].m_supported
1161            ;
1162
1163         if (BX_ENABLED(BX_PLATFORM_NACL) )
1164         {
1165            m_vaoSupport &= NULL != glGenVertexArrays
1166               && NULL != glDeleteVertexArrays
1167               && NULL != glBindVertexArray
1168               ;
1169         }
1170
1171         if (m_vaoSupport)
1172         {
1173            GL_CHECK(glGenVertexArrays(1, &m_vao) );
1174         }
1175
1176         m_samplerObjectSupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
1177            || s_extension[Extension::ARB_sampler_objects].m_supported
1178            ;
1179
1180         m_shadowSamplersSupport = !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30)
1181            || s_extension[Extension::EXT_shadow_samplers].m_supported
1182            ;
1183
1184         m_programBinarySupport = !!(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
1185            || s_extension[Extension::ARB_get_program_binary].m_supported
1186            || s_extension[Extension::OES_get_program_binary].m_supported
1187            || s_extension[Extension::IMG_shader_binary     ].m_supported
1188            ;
1189
1190         m_textureSwizzleSupport = false
1191            || s_extension[Extension::ARB_texture_swizzle].m_supported
1192            || s_extension[Extension::EXT_texture_swizzle].m_supported
1193            ;
1194
1195         m_depthTextureSupport = !!(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30)
1196            || s_extension[Extension::ANGLE_depth_texture       ].m_supported
1197            || s_extension[Extension::CHROMIUM_depth_texture    ].m_supported
1198            || s_extension[Extension::GOOGLE_depth_texture      ].m_supported
1199            || s_extension[Extension::OES_depth_texture         ].m_supported
1200            || s_extension[Extension::MOZ_WEBGL_depth_texture   ].m_supported
1201            || s_extension[Extension::WEBGL_depth_texture       ].m_supported
1202            || s_extension[Extension::WEBKIT_WEBGL_depth_texture].m_supported
1203            ;
1204
1205         g_caps.supported |= m_depthTextureSupport
1206            ? BGFX_CAPS_TEXTURE_COMPARE_LEQUAL
1207            : 0
1208            ;
1209
1210         g_caps.supported |= !!(BGFX_CONFIG_RENDERER_OPENGLES >= 31)
1211            || s_extension[Extension::ARB_compute_shader].m_supported
1212            ? BGFX_CAPS_COMPUTE
1213            : 0
1214            ;
1215
1216         if (s_extension[Extension::EXT_texture_filter_anisotropic].m_supported)
1217         {
1218            GL_CHECK(glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &m_maxAnisotropy) );
1219         }
1220
1221         if (s_extension[Extension::ARB_texture_multisample].m_supported
1222         ||  s_extension[Extension::ANGLE_framebuffer_multisample].m_supported)
1223         {
1224            GL_CHECK(glGetIntegerv(GL_MAX_SAMPLES, &m_maxMsaa) );
1225         }
1226
1227         if (s_extension[Extension::OES_read_format].m_supported
1228         && (s_extension[Extension::IMG_read_format].m_supported   || s_extension[Extension::EXT_read_format_bgra].m_supported) )
1229         {
1230            m_readPixelsFmt = GL_BGRA;
1231         }
1232         else
1233         {
1234            m_readPixelsFmt = GL_RGBA;
1235         }
1236
1237         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
1238         {
1239            g_caps.supported |= BGFX_CAPS_INSTANCING;
1240         }
1241         else
1242         {
1243            if (!BX_ENABLED(BX_PLATFORM_IOS) )
1244            {
1245               if (s_extension[Extension::ARB_instanced_arrays].m_supported
1246               ||  s_extension[Extension::ANGLE_instanced_arrays].m_supported)
1247               {
1248                  if (NULL != glVertexAttribDivisor
1249                  &&  NULL != glDrawArraysInstanced
1250                  &&  NULL != glDrawElementsInstanced)
1251                  {
1252                     g_caps.supported |= BGFX_CAPS_INSTANCING;
1253                  }
1254               }
1255            }
1256
1257            if (0 == (g_caps.supported & BGFX_CAPS_INSTANCING) )
1258            {
1259               glVertexAttribDivisor   = stubVertexAttribDivisor;
1260               glDrawArraysInstanced   = stubDrawArraysInstanced;
1261               glDrawElementsInstanced = stubDrawElementsInstanced;
1262            }
1263         }
1264
1265         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL >= 31)
1266         ||  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
1267         {
1268            s_textureFormat[TextureFormat::R8].m_internalFmt = GL_R8;
1269            s_textureFormat[TextureFormat::R8].m_fmt         = GL_RED;
1270         }
1271
1272#if BGFX_CONFIG_RENDERER_OPENGL
1273         if (s_extension[Extension::ARB_debug_output].m_supported
1274         ||  s_extension[Extension::KHR_debug].m_supported)
1275         {
1276            GL_CHECK(glDebugMessageCallback(debugProcCb, NULL) );
1277            GL_CHECK(glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_MEDIUM_ARB, 0, NULL, GL_TRUE) );
1278         }
1279
1280         if (s_extension[Extension::ARB_seamless_cube_map].m_supported)
1281         {
1282            GL_CHECK(glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS) );
1283         }
1284
1285         if (s_extension[Extension::ARB_depth_clamp].m_supported)
1286         {
1287            GL_CHECK(glEnable(GL_DEPTH_CLAMP) );
1288         }
1289#endif // BGFX_CONFIG_RENDERER_OPENGL
1290
1291         if (NULL == glFrameTerminatorGREMEDY
1292         ||  !s_extension[Extension::GREMEDY_frame_terminator].m_supported)
1293         {
1294            glFrameTerminatorGREMEDY = stubFrameTerminatorGREMEDY;
1295         }
1296
1297         if (NULL == glInsertEventMarker
1298         ||  !s_extension[Extension::EXT_debug_marker].m_supported)
1299         {
1300            glInsertEventMarker = (NULL != glStringMarkerGREMEDY && s_extension[Extension::GREMEDY_string_marker].m_supported)
1301               ? stubInsertEventMarkerGREMEDY
1302               : stubInsertEventMarker
1303               ;
1304         }
1305
1306         if (NULL == glObjectLabel)
1307         {
1308            glObjectLabel = stubObjectLabel;
1309         }
1310
1311         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
1312         {
1313            m_queries.create();
1314         }
1315      }
1316
1317      ~RendererContextGL()
1318      {
1319         if (m_vaoSupport)
1320         {
1321            GL_CHECK(glBindVertexArray(0) );
1322            GL_CHECK(glDeleteVertexArrays(1, &m_vao) );
1323            m_vao = 0;
1324         }
1325
1326         captureFinish();
1327
1328         invalidateCache();
1329
1330         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
1331         {
1332            m_queries.destroy();
1333         }
1334
1335         destroyMsaaFbo();
1336         m_glctx.destroy();
1337
1338         m_flip = false;
1339      }
1340
1341      RendererType::Enum getRendererType() const BX_OVERRIDE
1342      {
1343         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
1344         {
1345            return RendererType::OpenGL;
1346         }
1347
1348         return RendererType::OpenGLES;
1349      }
1350
1351      const char* getRendererName() const BX_OVERRIDE
1352      {
1353         return BGFX_RENDERER_OPENGL_NAME;
1354      }
1355
1356      void flip()
1357      {
1358         if (m_flip)
1359         {
1360            m_glctx.swap();
1361         }
1362      }
1363
1364      void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem) BX_OVERRIDE
1365      {
1366         m_indexBuffers[_handle.idx].create(_mem->size, _mem->data);
1367      }
1368
1369      void destroyIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE
1370      {
1371         m_indexBuffers[_handle.idx].destroy();
1372      }
1373
1374      void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE
1375      {
1376         VertexDecl& decl = m_vertexDecls[_handle.idx];
1377         memcpy(&decl, &_decl, sizeof(VertexDecl) );
1378         dump(decl);
1379      }
1380
1381      void destroyVertexDecl(VertexDeclHandle /*_handle*/) BX_OVERRIDE
1382      {
1383      }
1384
1385      void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle) BX_OVERRIDE
1386      {
1387         m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle);
1388      }
1389
1390      void destroyVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE
1391      {
1392         m_vertexBuffers[_handle.idx].destroy();
1393      }
1394
1395      void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size) BX_OVERRIDE
1396      {
1397         m_indexBuffers[_handle.idx].create(_size, NULL);
1398      }
1399
1400      void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE
1401      {
1402         m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
1403      }
1404
1405      void destroyDynamicIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE
1406      {
1407         m_indexBuffers[_handle.idx].destroy();
1408      }
1409
1410      void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size) BX_OVERRIDE
1411      {
1412         VertexDeclHandle decl = BGFX_INVALID_HANDLE;
1413         m_vertexBuffers[_handle.idx].create(_size, NULL, decl);
1414      }
1415
1416      void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE
1417      {
1418         m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
1419      }
1420
1421      void destroyDynamicVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE
1422      {
1423         m_vertexBuffers[_handle.idx].destroy();
1424      }
1425
1426      void createShader(ShaderHandle _handle, Memory* _mem) BX_OVERRIDE
1427      {
1428         m_shaders[_handle.idx].create(_mem);
1429      }
1430
1431      void destroyShader(ShaderHandle _handle) BX_OVERRIDE
1432      {
1433         m_shaders[_handle.idx].destroy();
1434      }
1435
1436      void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) BX_OVERRIDE
1437      {
1438         ShaderGL dummyFragmentShader;
1439         m_program[_handle.idx].create(m_shaders[_vsh.idx], isValid(_fsh) ? m_shaders[_fsh.idx] : dummyFragmentShader);
1440      }
1441
1442      void destroyProgram(ProgramHandle _handle) BX_OVERRIDE
1443      {
1444         m_program[_handle.idx].destroy();
1445      }
1446
1447      void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) BX_OVERRIDE
1448      {
1449         m_textures[_handle.idx].create(_mem, _flags, _skip);
1450      }
1451
1452      void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) BX_OVERRIDE
1453      {
1454      }
1455
1456      void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) BX_OVERRIDE
1457      {
1458         m_textures[_handle.idx].update(_side, _mip, _rect, _z, _depth, _pitch, _mem);
1459      }
1460
1461      void updateTextureEnd() BX_OVERRIDE
1462      {
1463      }
1464
1465      void destroyTexture(TextureHandle _handle) BX_OVERRIDE
1466      {
1467         m_textures[_handle.idx].destroy();
1468      }
1469
1470      void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE
1471      {
1472         m_frameBuffers[_handle.idx].create(_num, _textureHandles);
1473      }
1474
1475      void destroyFrameBuffer(FrameBufferHandle _handle) BX_OVERRIDE
1476      {
1477         m_frameBuffers[_handle.idx].destroy();
1478      }
1479
1480      void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) BX_OVERRIDE
1481      {
1482         if (NULL != m_uniforms[_handle.idx])
1483         {
1484            BX_FREE(g_allocator, m_uniforms[_handle.idx]);
1485         }
1486
1487         uint32_t size = g_uniformTypeSize[_type]*_num;
1488         void* data = BX_ALLOC(g_allocator, size);
1489         memset(data, 0, size);
1490         m_uniforms[_handle.idx] = data;
1491         m_uniformReg.add(_handle, _name, m_uniforms[_handle.idx]);
1492      }
1493
1494      void destroyUniform(UniformHandle _handle) BX_OVERRIDE
1495      {
1496         BX_FREE(g_allocator, m_uniforms[_handle.idx]);
1497         m_uniforms[_handle.idx] = NULL;
1498      }
1499
1500      void saveScreenShot(const char* _filePath) BX_OVERRIDE
1501      {
1502         uint32_t length = m_resolution.m_width*m_resolution.m_height*4;
1503         uint8_t* data = (uint8_t*)BX_ALLOC(g_allocator, length);
1504
1505         uint32_t width = m_resolution.m_width;
1506         uint32_t height = m_resolution.m_height;
1507
1508         GL_CHECK(glReadPixels(0
1509            , 0
1510            , width
1511            , height
1512            , m_readPixelsFmt
1513            , GL_UNSIGNED_BYTE
1514            , data
1515            ) );
1516
1517         if (GL_RGBA == m_readPixelsFmt)
1518         {
1519            imageSwizzleBgra8(width, height, width*4, data, data);
1520         }
1521
1522         g_callback->screenShot(_filePath
1523            , width
1524            , height
1525            , width*4
1526            , data
1527            , length
1528            , true
1529            );
1530         BX_FREE(g_allocator, data);
1531      }
1532
1533      void updateViewName(uint8_t _id, const char* _name) BX_OVERRIDE
1534      {
1535         bx::strlcpy(&s_viewName[_id][0], _name, BX_COUNTOF(s_viewName[0]) );
1536      }
1537
1538      void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE
1539      {
1540         memcpy(m_uniforms[_loc], _data, _size);
1541      }
1542
1543      void setMarker(const char* _marker, uint32_t _size) BX_OVERRIDE
1544      {
1545         GL_CHECK(glInsertEventMarker(_size, _marker) );
1546      }
1547
1548      void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) BX_OVERRIDE;
1549
1550      void blitSetup(TextVideoMemBlitter& _blitter) BX_OVERRIDE
1551      {
1552         if (0 != m_vao)
1553         {
1554            GL_CHECK(glBindVertexArray(m_vao) );
1555         }
1556
1557         uint32_t width = m_resolution.m_width;
1558         uint32_t height = m_resolution.m_height;
1559
1560         GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_backBufferFbo) );
1561         GL_CHECK(glViewport(0, 0, width, height) );
1562
1563         GL_CHECK(glDisable(GL_SCISSOR_TEST) );
1564         GL_CHECK(glDisable(GL_STENCIL_TEST) );
1565         GL_CHECK(glDisable(GL_DEPTH_TEST) );
1566         GL_CHECK(glDepthFunc(GL_ALWAYS) );
1567         GL_CHECK(glDisable(GL_CULL_FACE) );
1568         GL_CHECK(glDisable(GL_BLEND) );
1569         GL_CHECK(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) );
1570
1571         ProgramGL& program = m_program[_blitter.m_program.idx];
1572         GL_CHECK(glUseProgram(program.m_id) );
1573         GL_CHECK(glUniform1i(program.m_sampler[0], 0) );
1574
1575         float proj[16];
1576         mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f);
1577
1578         GL_CHECK(glUniformMatrix4fv(program.m_predefined[0].m_loc
1579            , 1
1580            , GL_FALSE
1581            , proj
1582            ) );
1583
1584         GL_CHECK(glActiveTexture(GL_TEXTURE0) );
1585         GL_CHECK(glBindTexture(GL_TEXTURE_2D, m_textures[_blitter.m_texture.idx].m_id) );
1586      }
1587
1588      void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) BX_OVERRIDE
1589      {
1590         uint32_t numVertices = _numIndices*4/6;
1591         m_indexBuffers[_blitter.m_ib->handle.idx].update(0, _numIndices*2, _blitter.m_ib->data);
1592         m_vertexBuffers[_blitter.m_vb->handle.idx].update(0, numVertices*_blitter.m_decl.m_stride, _blitter.m_vb->data);
1593
1594         VertexBufferGL& vb = m_vertexBuffers[_blitter.m_vb->handle.idx];
1595         GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) );
1596
1597         IndexBufferGL& ib = m_indexBuffers[_blitter.m_ib->handle.idx];
1598         GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ib.m_id) );
1599
1600         ProgramGL& program = m_program[_blitter.m_program.idx];
1601         program.bindAttributes(_blitter.m_decl, 0);
1602
1603         GL_CHECK(glDrawElements(GL_TRIANGLES
1604            , _numIndices
1605            , GL_UNSIGNED_SHORT
1606            , (void*)0
1607            ) );
1608      }
1609
1610      void updateResolution(const Resolution& _resolution)
1611      {
1612         if (m_resolution.m_width != _resolution.m_width
1613         ||  m_resolution.m_height != _resolution.m_height
1614         ||  m_resolution.m_flags != _resolution.m_flags)
1615         {
1616            m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
1617            m_textVideoMem.clear();
1618
1619            m_resolution = _resolution;
1620
1621            uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT;
1622            msaa = bx::uint32_min(m_maxMsaa, msaa == 0 ? 0 : 1<<msaa);
1623            bool vsync = !!(m_resolution.m_flags&BGFX_RESET_VSYNC);
1624            setRenderContextSize(_resolution.m_width, _resolution.m_height, msaa, vsync);
1625            updateCapture();
1626         }
1627      }
1628
1629      uint32_t setFrameBuffer(FrameBufferHandle _fbh, uint32_t _height, bool _msaa = true)
1630      {
1631         if (isValid(m_fbh)
1632         &&  m_fbh.idx != _fbh.idx
1633         &&  m_rtMsaa)
1634         {
1635            FrameBufferGL& frameBuffer = m_frameBuffers[m_fbh.idx];
1636            frameBuffer.resolve();
1637         }
1638
1639         if (!isValid(_fbh) )
1640         {
1641            GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_msaaBackBufferFbo) );
1642         }
1643         else
1644         {
1645            FrameBufferGL& frameBuffer = m_frameBuffers[_fbh.idx];
1646            GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, frameBuffer.m_fbo[0]) );
1647            _height = frameBuffer.m_height;
1648         }
1649
1650         m_fbh = _fbh;
1651         m_rtMsaa = _msaa;
1652
1653         return _height;
1654      }
1655
1656      uint32_t getNumRt() const
1657      {
1658         if (isValid(m_fbh) )
1659         {
1660            const FrameBufferGL& frameBuffer = m_frameBuffers[m_fbh.idx];
1661            return frameBuffer.m_num;
1662         }
1663
1664         return 1;
1665      }
1666
1667      void createMsaaFbo(uint32_t _width, uint32_t _height, uint32_t _msaa)
1668      {
1669         if (0 == m_msaaBackBufferFbo // iOS
1670         &&  1 < _msaa)
1671         {
1672            GL_CHECK(glGenFramebuffers(1, &m_msaaBackBufferFbo) );
1673            GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_msaaBackBufferFbo) );
1674            GL_CHECK(glGenRenderbuffers(BX_COUNTOF(m_msaaBackBufferRbos), m_msaaBackBufferRbos) );
1675            GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_msaaBackBufferRbos[0]) );
1676            GL_CHECK(glRenderbufferStorageMultisample(GL_RENDERBUFFER, _msaa, GL_RGBA8, _width, _height) );
1677            GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_msaaBackBufferRbos[1]) );
1678            GL_CHECK(glRenderbufferStorageMultisample(GL_RENDERBUFFER, _msaa, GL_DEPTH24_STENCIL8, _width, _height) );
1679            GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_msaaBackBufferRbos[0]) );
1680
1681            GLenum attachment = BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
1682               ? GL_DEPTH_STENCIL_ATTACHMENT
1683               : GL_DEPTH_ATTACHMENT
1684               ;
1685            GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_RENDERBUFFER, m_msaaBackBufferRbos[1]) );
1686
1687            BX_CHECK(GL_FRAMEBUFFER_COMPLETE ==  glCheckFramebufferStatus(GL_FRAMEBUFFER)
1688               , "glCheckFramebufferStatus failed 0x%08x"
1689               , glCheckFramebufferStatus(GL_FRAMEBUFFER)
1690               );
1691
1692            GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_msaaBackBufferFbo) );
1693         }
1694      }
1695
1696      void destroyMsaaFbo()
1697      {
1698         if (m_backBufferFbo != m_msaaBackBufferFbo // iOS
1699         &&  0 != m_msaaBackBufferFbo)
1700         {
1701            GL_CHECK(glDeleteFramebuffers(1, &m_msaaBackBufferFbo) );
1702            GL_CHECK(glDeleteRenderbuffers(BX_COUNTOF(m_msaaBackBufferRbos), m_msaaBackBufferRbos) );
1703            m_msaaBackBufferFbo = 0;
1704         }
1705      }
1706
1707      void blitMsaaFbo()
1708      {
1709         if (m_backBufferFbo != m_msaaBackBufferFbo // iOS
1710         &&  0 != m_msaaBackBufferFbo)
1711         {
1712            GL_CHECK(glDisable(GL_SCISSOR_TEST) );
1713            GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_backBufferFbo) );
1714            GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_msaaBackBufferFbo) );
1715            GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0) );
1716            uint32_t width = m_resolution.m_width;
1717            uint32_t height = m_resolution.m_height;
1718            GLenum filter = BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES < 30)
1719               ? GL_NEAREST
1720               : GL_LINEAR
1721               ;
1722            GL_CHECK(glBlitFramebuffer(0
1723               , 0
1724               , width
1725               , height
1726               , 0
1727               , 0
1728               , width
1729               , height
1730               , GL_COLOR_BUFFER_BIT
1731               , filter
1732               ) );
1733            GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_backBufferFbo) );
1734         }
1735      }
1736
1737      void setRenderContextSize(uint32_t _width, uint32_t _height, uint32_t _msaa = 0, bool _vsync = false)
1738      {
1739         if (_width != 0
1740         ||  _height != 0)
1741         {
1742            if (!m_glctx.isValid() )
1743            {
1744               m_glctx.create(_width, _height);
1745
1746#if BX_PLATFORM_IOS
1747               // iOS: need to figure out how to deal with FBO created by context.
1748               m_backBufferFbo = m_glctx.m_fbo;
1749               m_msaaBackBufferFbo = m_glctx.m_fbo;
1750#endif // BX_PLATFORM_IOS
1751            }
1752            else
1753            {
1754               destroyMsaaFbo();
1755
1756               m_glctx.resize(_width, _height, _vsync);
1757
1758               createMsaaFbo(_width, _height, _msaa);
1759            }
1760         }
1761
1762         m_flip = true;
1763      }
1764
1765      void invalidateCache()
1766      {
1767         if (m_vaoSupport)
1768         {
1769            m_vaoStateCache.invalidate();
1770         }
1771
1772         if ( (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) ||  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
1773         &&  m_samplerObjectSupport)
1774         {
1775            m_samplerStateCache.invalidate();
1776         }
1777      }
1778
1779      void setSamplerState(uint32_t _stage, uint32_t _numMips, uint32_t _flags)
1780      {
1781         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
1782         ||  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
1783         {
1784            if (0 == (BGFX_SAMPLER_DEFAULT_FLAGS & _flags) )
1785            {
1786               _flags &= ~BGFX_TEXTURE_RESERVED_MASK;
1787               _flags &= BGFX_TEXTURE_SAMPLER_BITS_MASK;
1788               _flags |= _numMips<<BGFX_TEXTURE_RESERVED_SHIFT;
1789               GLuint sampler = m_samplerStateCache.find(_flags);
1790
1791               if (UINT32_MAX == sampler)
1792               {
1793                  sampler = m_samplerStateCache.add(_flags);
1794
1795                  GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_WRAP_S, s_textureAddress[(_flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]) );
1796                  GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_WRAP_T, s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]) );
1797                  GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_WRAP_R, s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]) );
1798
1799                  const uint32_t mag = (_flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT;
1800                  const uint32_t min = (_flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT;
1801                  const uint32_t mip = (_flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT;
1802                  GLenum minFilter = s_textureFilterMin[min][1 < _numMips ? mip+1 : 0];
1803                  GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_MAG_FILTER, s_textureFilterMag[mag]) );
1804                  GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_MIN_FILTER, minFilter) );
1805                  if (0 != (_flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) )
1806                  &&  0.0f < m_maxAnisotropy)
1807                  {
1808                     GL_CHECK(glSamplerParameterf(sampler, GL_TEXTURE_MAX_ANISOTROPY_EXT, m_maxAnisotropy) );
1809                  }
1810
1811                  if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
1812                  ||  m_shadowSamplersSupport)
1813                  {
1814                     const uint32_t cmpFunc = (_flags&BGFX_TEXTURE_COMPARE_MASK)>>BGFX_TEXTURE_COMPARE_SHIFT;
1815                     if (0 == cmpFunc)
1816                     {
1817                        GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_COMPARE_MODE, GL_NONE) );
1818                     }
1819                     else
1820                     {
1821                        GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE) );
1822                        GL_CHECK(glSamplerParameteri(sampler, GL_TEXTURE_COMPARE_FUNC, s_cmpFunc[cmpFunc]) );
1823                     }
1824                  }
1825               }
1826
1827               GL_CHECK(glBindSampler(_stage, sampler) );
1828            }
1829            else
1830            {
1831               GL_CHECK(glBindSampler(_stage, 0) );
1832            }
1833         }
1834      }
1835
1836      void updateCapture()
1837      {
1838         if (m_resolution.m_flags&BGFX_RESET_CAPTURE)
1839         {
1840            m_captureSize = m_resolution.m_width*m_resolution.m_height*4;
1841            m_capture = BX_REALLOC(g_allocator, m_capture, m_captureSize);
1842            g_callback->captureBegin(m_resolution.m_width, m_resolution.m_height, m_resolution.m_width*4, TextureFormat::BGRA8, true);
1843         }
1844         else
1845         {
1846            captureFinish();
1847         }
1848      }
1849
1850      void capture()
1851      {
1852         if (NULL != m_capture)
1853         {
1854            GL_CHECK(glReadPixels(0
1855               , 0
1856               , m_resolution.m_width
1857               , m_resolution.m_height
1858               , m_readPixelsFmt
1859               , GL_UNSIGNED_BYTE
1860               , m_capture
1861               ) );
1862
1863            g_callback->captureFrame(m_capture, m_captureSize);
1864         }
1865      }
1866
1867      void captureFinish()
1868      {
1869         if (NULL != m_capture)
1870         {
1871            g_callback->captureEnd();
1872            BX_FREE(g_allocator, m_capture);
1873            m_capture = NULL;
1874            m_captureSize = 0;
1875         }
1876      }
1877
1878      bool programFetchFromCache(GLuint programId, uint64_t _id)
1879      {
1880         _id ^= m_hash;
1881
1882         bool cached = false;
1883
1884         if (m_programBinarySupport)
1885         {
1886            uint32_t length = g_callback->cacheReadSize(_id);
1887            cached = length > 0;
1888
1889            if (cached)
1890            {
1891               void* data = BX_ALLOC(g_allocator, length);
1892               if (g_callback->cacheRead(_id, data, length) )
1893               {
1894                  bx::MemoryReader reader(data, length);
1895
1896                  GLenum format;
1897                  bx::read(&reader, format);
1898
1899                  GL_CHECK(glProgramBinary(programId, format, reader.getDataPtr(), (GLsizei)reader.remaining() ) );
1900               }
1901
1902               BX_FREE(g_allocator, data);
1903            }
1904
1905#if BGFX_CONFIG_RENDERER_OPENGL
1906            GL_CHECK(glProgramParameteri(programId, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE) );
1907#endif // BGFX_CONFIG_RENDERER_OPENGL
1908         }
1909
1910         return cached;
1911      }
1912
1913      void programCache(GLuint programId, uint64_t _id)
1914      {
1915         _id ^= m_hash;
1916
1917         if (m_programBinarySupport)
1918         {
1919            GLint programLength;
1920            GLenum format;
1921            GL_CHECK(glGetProgramiv(programId, GL_PROGRAM_BINARY_LENGTH, &programLength) );
1922
1923            if (0 < programLength)
1924            {
1925               uint32_t length = programLength + 4;
1926               uint8_t* data = (uint8_t*)BX_ALLOC(g_allocator, length);
1927               GL_CHECK(glGetProgramBinary(programId, programLength, NULL, &format, &data[4]) );
1928               *(uint32_t*)data = format;
1929
1930               g_callback->cacheWrite(_id, data, length);
1931
1932               BX_FREE(g_allocator, data);
1933            }
1934         }
1935      }
1936
1937      void commit(ConstantBuffer& _constantBuffer)
1938      {
1939         _constantBuffer.reset();
1940
1941         for (;;)
1942         {
1943            uint32_t opcode = _constantBuffer.read();
1944
1945            if (UniformType::End == opcode)
1946            {
1947               break;
1948            }
1949
1950            UniformType::Enum type;
1951            uint16_t ignore;
1952            uint16_t num;
1953            uint16_t copy;
1954            ConstantBuffer::decodeOpcode(opcode, type, ignore, num, copy);
1955
1956            const char* data;
1957            if (copy)
1958            {
1959               data = _constantBuffer.read(g_uniformTypeSize[type]*num);
1960            }
1961            else
1962            {
1963               UniformHandle handle;
1964               memcpy(&handle, _constantBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
1965               data = (const char*)m_uniforms[handle.idx];
1966            }
1967
1968            uint32_t loc = _constantBuffer.read();
1969
1970#define CASE_IMPLEMENT_UNIFORM(_uniform, _glsuffix, _dxsuffix, _type) \
1971      case UniformType::_uniform: \
1972            { \
1973               _type* value = (_type*)data; \
1974               GL_CHECK(glUniform##_glsuffix(loc, num, value) ); \
1975            } \
1976            break;
1977
1978#define CASE_IMPLEMENT_UNIFORM_T(_uniform, _glsuffix, _dxsuffix, _type) \
1979      case UniformType::_uniform: \
1980            { \
1981               _type* value = (_type*)data; \
1982               GL_CHECK(glUniform##_glsuffix(loc, num, GL_FALSE, value) ); \
1983            } \
1984            break;
1985
1986            switch (type)
1987            {
1988//            case ConstantType::Uniform1iv:
1989//               {
1990//                  int* value = (int*)data;
1991//                  BX_TRACE("Uniform1iv sampler %d, loc %d (num %d, copy %d)", *value, loc, num, copy);
1992//                  GL_CHECK(glUniform1iv(loc, num, value) );
1993//               }
1994//               break;
1995
1996               CASE_IMPLEMENT_UNIFORM(Uniform1i, 1iv, I, int);
1997               CASE_IMPLEMENT_UNIFORM(Uniform1f, 1fv, F, float);
1998               CASE_IMPLEMENT_UNIFORM(Uniform1iv, 1iv, I, int);
1999               CASE_IMPLEMENT_UNIFORM(Uniform1fv, 1fv, F, float);
2000               CASE_IMPLEMENT_UNIFORM(Uniform2fv, 2fv, F, float);
2001               CASE_IMPLEMENT_UNIFORM(Uniform3fv, 3fv, F, float);
2002               CASE_IMPLEMENT_UNIFORM(Uniform4fv, 4fv, F, float);
2003               CASE_IMPLEMENT_UNIFORM_T(Uniform3x3fv, Matrix3fv, F, float);
2004               CASE_IMPLEMENT_UNIFORM_T(Uniform4x4fv, Matrix4fv, F, float);
2005
2006            case UniformType::End:
2007               break;
2008
2009            default:
2010               BX_TRACE("%4d: INVALID 0x%08x, t %d, l %d, n %d, c %d", _constantBuffer.getPos(), opcode, type, loc, num, copy);
2011               break;
2012            }
2013
2014#undef CASE_IMPLEMENT_UNIFORM
2015#undef CASE_IMPLEMENT_UNIFORM_T
2016
2017         }
2018      }
2019
2020      void clearQuad(ClearQuad& _clearQuad, const Rect& _rect, const Clear& _clear, uint32_t _height)
2021      {
2022         if (BX_ENABLED(BGFX_CONFIG_CLEAR_QUAD)
2023         &&  m_useClearQuad)
2024         {
2025            const GLuint defaultVao = m_vao;
2026            if (0 != defaultVao)
2027            {
2028               GL_CHECK(glBindVertexArray(defaultVao) );
2029            }
2030
2031            GL_CHECK(glDisable(GL_SCISSOR_TEST) );
2032            GL_CHECK(glDisable(GL_CULL_FACE) );
2033            GL_CHECK(glDisable(GL_BLEND) );
2034
2035            GLboolean colorMask = !!(BGFX_CLEAR_COLOR_BIT & _clear.m_flags);
2036            GL_CHECK(glColorMask(colorMask, colorMask, colorMask, colorMask) );
2037
2038            if (BGFX_CLEAR_DEPTH_BIT & _clear.m_flags)
2039            {
2040               GL_CHECK(glEnable(GL_DEPTH_TEST) );
2041               GL_CHECK(glDepthFunc(GL_ALWAYS) );
2042               GL_CHECK(glDepthMask(GL_TRUE) );
2043            }
2044            else
2045            {
2046               GL_CHECK(glDisable(GL_DEPTH_TEST) );
2047            }
2048
2049            if (BGFX_CLEAR_STENCIL_BIT & _clear.m_flags)
2050            {
2051               GL_CHECK(glEnable(GL_STENCIL_TEST) );
2052               GL_CHECK(glStencilFuncSeparate(GL_FRONT_AND_BACK, GL_ALWAYS, _clear.m_stencil,  0xff) );
2053               GL_CHECK(glStencilOpSeparate(GL_FRONT_AND_BACK, GL_REPLACE, GL_REPLACE, GL_REPLACE) );
2054            }
2055            else
2056            {
2057               GL_CHECK(glDisable(GL_STENCIL_TEST) );
2058            }
2059
2060            VertexBufferGL& vb = m_vertexBuffers[_clearQuad.m_vb->handle.idx];
2061            VertexDecl& vertexDecl = m_vertexDecls[_clearQuad.m_vb->decl.idx];
2062
2063            {
2064               struct Vertex
2065               {
2066                  float m_x;
2067                  float m_y;
2068                  float m_z;
2069                  uint32_t m_abgr;
2070               } * vertex = (Vertex*)_clearQuad.m_vb->data;
2071               BX_CHECK(vertexDecl.m_stride == sizeof(Vertex), "Stride/Vertex mismatch (stride %d, sizeof(Vertex) %d)", vertexDecl.m_stride, sizeof(Vertex) );
2072
2073               const uint32_t abgr = bx::endianSwap(_clear.m_rgba);
2074               const float depth = _clear.m_depth;
2075
2076               vertex->m_x = -1.0f;
2077               vertex->m_y = -1.0f;
2078               vertex->m_z = depth;
2079               vertex->m_abgr = abgr;
2080               vertex++;
2081               vertex->m_x =  1.0f;
2082               vertex->m_y = -1.0f;
2083               vertex->m_z = depth;
2084               vertex->m_abgr = abgr;
2085               vertex++;
2086               vertex->m_x =  1.0f;
2087               vertex->m_y =  1.0f;
2088               vertex->m_z = depth;
2089               vertex->m_abgr = abgr;
2090               vertex++;
2091               vertex->m_x = -1.0f;
2092               vertex->m_y =  1.0f;
2093               vertex->m_z = depth;
2094               vertex->m_abgr = abgr;
2095            }
2096
2097            m_vertexBuffers[_clearQuad.m_vb->handle.idx].update(0, 4*_clearQuad.m_decl.m_stride, _clearQuad.m_vb->data);
2098
2099            GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) );
2100
2101            IndexBufferGL& ib = m_indexBuffers[_clearQuad.m_ib.idx];
2102            GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ib.m_id) );
2103
2104            uint32_t numMrt = 0;
2105            FrameBufferHandle fbh = m_fbh;
2106            if (isValid(fbh) )
2107            {
2108               const FrameBufferGL& fb = m_frameBuffers[fbh.idx];
2109               numMrt = bx::uint32_max(1, fb.m_num)-1;
2110            }
2111
2112            ProgramGL& program = m_program[_clearQuad.m_program[numMrt].idx];
2113            GL_CHECK(glUseProgram(program.m_id) );
2114            program.bindAttributes(vertexDecl, 0);
2115
2116            GL_CHECK(glDrawElements(GL_TRIANGLES
2117               , 6
2118               , GL_UNSIGNED_SHORT
2119               , (void*)0
2120               ) );
2121         }
2122         else
2123         {
2124            GLuint flags = 0;
2125            if (BGFX_CLEAR_COLOR_BIT & _clear.m_flags)
2126            {
2127               flags |= GL_COLOR_BUFFER_BIT;
2128               uint32_t rgba = _clear.m_rgba;
2129               float rr = (rgba>>24)/255.0f;
2130               float gg = ( (rgba>>16)&0xff)/255.0f;
2131               float bb = ( (rgba>>8)&0xff)/255.0f;
2132               float aa = (rgba&0xff)/255.0f;
2133               GL_CHECK(glClearColor(rr, gg, bb, aa) );
2134               GL_CHECK(glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE) );
2135            }
2136
2137            if (BGFX_CLEAR_DEPTH_BIT & _clear.m_flags)
2138            {
2139               flags |= GL_DEPTH_BUFFER_BIT;
2140               GL_CHECK(glClearDepth(_clear.m_depth) );
2141               GL_CHECK(glDepthMask(GL_TRUE) );
2142            }
2143
2144            if (BGFX_CLEAR_STENCIL_BIT & _clear.m_flags)
2145            {
2146               flags |= GL_STENCIL_BUFFER_BIT;
2147               GL_CHECK(glClearStencil(_clear.m_stencil) );
2148            }
2149
2150            if (0 != flags)
2151            {
2152               GL_CHECK(glEnable(GL_SCISSOR_TEST) );
2153               GL_CHECK(glScissor(_rect.m_x, _height-_rect.m_height-_rect.m_y, _rect.m_width, _rect.m_height) );
2154               GL_CHECK(glClear(flags) );
2155               GL_CHECK(glDisable(GL_SCISSOR_TEST) );
2156            }
2157         }
2158      }
2159
2160      IndexBufferGL m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS];
2161      VertexBufferGL m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS];
2162      ShaderGL m_shaders[BGFX_CONFIG_MAX_SHADERS];
2163      ProgramGL m_program[BGFX_CONFIG_MAX_PROGRAMS];
2164      TextureGL m_textures[BGFX_CONFIG_MAX_TEXTURES];
2165      VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS];
2166      FrameBufferGL m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS];
2167      UniformRegistry m_uniformReg;
2168      void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS];
2169      QueriesGL m_queries;
2170
2171      VaoStateCache m_vaoStateCache;
2172      SamplerStateCache m_samplerStateCache;
2173
2174      TextVideoMem m_textVideoMem;
2175      bool m_rtMsaa;
2176
2177      FrameBufferHandle m_fbh;
2178
2179      Resolution m_resolution;
2180      void* m_capture;
2181      uint32_t m_captureSize;
2182      float m_maxAnisotropy;
2183      int32_t m_maxMsaa;
2184      GLuint m_vao;
2185      bool m_vaoSupport;
2186      bool m_samplerObjectSupport;
2187      bool m_shadowSamplersSupport;
2188      bool m_programBinarySupport;
2189      bool m_textureSwizzleSupport;
2190      bool m_depthTextureSupport;
2191      bool m_useClearQuad;
2192      bool m_flip;
2193
2194      uint64_t m_hash;
2195
2196      GLenum m_readPixelsFmt;
2197      GLuint m_backBufferFbo;
2198      GLuint m_msaaBackBufferFbo;
2199      GLuint m_msaaBackBufferRbos[2];
2200      GlContext m_glctx;
2201
2202      const char* m_vendor;
2203      const char* m_renderer;
2204      const char* m_version;
2205      const char* m_glslVersion;
2206   };
2207
2208   RendererContextGL* s_renderGL;
2209
2210   RendererContextI* rendererCreateGL()
2211   {
2212      s_renderGL = BX_NEW(g_allocator, RendererContextGL);
2213      return s_renderGL;
2214   }
2215
2216   void rendererDestroyGL()
2217   {
2218      BX_DELETE(g_allocator, s_renderGL);
2219      s_renderGL = NULL;
2220   }
2221
2222   const char* glslTypeName(GLuint _type)
2223   {
2224#define GLSL_TYPE(_ty) case _ty: return #_ty
2225
2226      switch (_type)
2227      {
2228         GLSL_TYPE(GL_INT);
2229         GLSL_TYPE(GL_INT_VEC2);
2230         GLSL_TYPE(GL_INT_VEC3);
2231         GLSL_TYPE(GL_INT_VEC4);     
2232         GLSL_TYPE(GL_UNSIGNED_INT);
2233         GLSL_TYPE(GL_UNSIGNED_INT_VEC2);
2234         GLSL_TYPE(GL_UNSIGNED_INT_VEC3);
2235         GLSL_TYPE(GL_UNSIGNED_INT_VEC4);
2236         GLSL_TYPE(GL_FLOAT);
2237         GLSL_TYPE(GL_FLOAT_VEC2);
2238         GLSL_TYPE(GL_FLOAT_VEC3);
2239         GLSL_TYPE(GL_FLOAT_VEC4);
2240         GLSL_TYPE(GL_FLOAT_MAT2);
2241         GLSL_TYPE(GL_FLOAT_MAT3);
2242         GLSL_TYPE(GL_FLOAT_MAT4);
2243//          GLSL_TYPE(GL_FLOAT_MAT2x3);
2244//          GLSL_TYPE(GL_FLOAT_MAT2x4);
2245//          GLSL_TYPE(GL_FLOAT_MAT3x2);
2246//          GLSL_TYPE(GL_FLOAT_MAT3x4);
2247//          GLSL_TYPE(GL_FLOAT_MAT4x2);
2248//          GLSL_TYPE(GL_FLOAT_MAT4x3);
2249//          GLSL_TYPE(GL_SAMPLER_1D);
2250          GLSL_TYPE(GL_SAMPLER_2D);
2251         GLSL_TYPE(GL_SAMPLER_3D);
2252         GLSL_TYPE(GL_SAMPLER_CUBE);
2253//          GLSL_TYPE(GL_SAMPLER_1D_SHADOW);
2254         GLSL_TYPE(GL_SAMPLER_2D_SHADOW);
2255         GLSL_TYPE(GL_IMAGE_1D);
2256         GLSL_TYPE(GL_IMAGE_2D);
2257         GLSL_TYPE(GL_IMAGE_3D);
2258         GLSL_TYPE(GL_IMAGE_CUBE);
2259      }
2260
2261#undef GLSL_TYPE
2262
2263      BX_CHECK(false, "Unknown GLSL type? %x", _type);
2264      return "UNKNOWN GLSL TYPE!";
2265   }
2266
2267   const char* glEnumName(GLenum _enum)
2268   {
2269#define GLENUM(_ty) case _ty: return #_ty
2270
2271      switch (_enum)
2272      {
2273         GLENUM(GL_TEXTURE);
2274         GLENUM(GL_RENDERBUFFER);
2275
2276         GLENUM(GL_INVALID_ENUM);
2277         GLENUM(GL_INVALID_VALUE);
2278         GLENUM(GL_INVALID_OPERATION);
2279         GLENUM(GL_OUT_OF_MEMORY);
2280
2281         GLENUM(GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT);
2282         GLENUM(GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);
2283//         GLENUM(GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER);
2284//         GLENUM(GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER);
2285         GLENUM(GL_FRAMEBUFFER_UNSUPPORTED);
2286      }
2287
2288#undef GLENUM
2289
2290      BX_WARN(false, "Unknown enum? %x", _enum);
2291      return "<GLenum?>";
2292   }
2293
2294   UniformType::Enum convertGlType(GLenum _type)
2295   {
2296      switch (_type)
2297      {
2298      case GL_INT:
2299      case GL_UNSIGNED_INT:
2300         return UniformType::Uniform1iv;
2301
2302      case GL_FLOAT:
2303         return UniformType::Uniform1fv;
2304
2305      case GL_FLOAT_VEC2:
2306         return UniformType::Uniform2fv;
2307
2308      case GL_FLOAT_VEC3:
2309         return UniformType::Uniform3fv;
2310
2311      case GL_FLOAT_VEC4:
2312         return UniformType::Uniform4fv;
2313
2314      case GL_FLOAT_MAT2:
2315         break;
2316
2317      case GL_FLOAT_MAT3:
2318         return UniformType::Uniform3x3fv;
2319
2320      case GL_FLOAT_MAT4:
2321         return UniformType::Uniform4x4fv;
2322
2323//       case GL_FLOAT_MAT2x3:
2324//       case GL_FLOAT_MAT2x4:
2325//       case GL_FLOAT_MAT3x2:
2326//       case GL_FLOAT_MAT3x4:
2327//       case GL_FLOAT_MAT4x2:
2328//       case GL_FLOAT_MAT4x3:
2329//          break;
2330
2331//       case GL_SAMPLER_1D:
2332      case GL_SAMPLER_2D:
2333      case GL_SAMPLER_3D:
2334      case GL_SAMPLER_CUBE:
2335//       case GL_SAMPLER_1D_SHADOW:
2336       case GL_SAMPLER_2D_SHADOW:
2337      case GL_IMAGE_1D:
2338      case GL_IMAGE_2D:
2339      case GL_IMAGE_3D:
2340      case GL_IMAGE_CUBE:
2341         return UniformType::Uniform1iv;
2342      };
2343
2344      BX_CHECK(false, "Unrecognized GL type 0x%04x.", _type);
2345      return UniformType::End;
2346   }
2347
2348   void ProgramGL::create(const ShaderGL& _vsh, const ShaderGL& _fsh)
2349   {
2350      m_id = glCreateProgram();
2351      BX_TRACE("program create: %d: %d, %d", m_id, _vsh.m_id, _fsh.m_id);
2352
2353      const uint64_t id = (uint64_t(_vsh.m_hash)<<32) | _fsh.m_hash;
2354      const bool cached = s_renderGL->programFetchFromCache(m_id, id);
2355
2356      if (!cached)
2357      {
2358         GL_CHECK(glAttachShader(m_id, _vsh.m_id) );
2359
2360         if (0 != _fsh.m_id)
2361         {
2362            GL_CHECK(glAttachShader(m_id, _fsh.m_id) );
2363         }
2364
2365         GL_CHECK(glLinkProgram(m_id) );
2366
2367         GLint linked = 0;
2368         GL_CHECK(glGetProgramiv(m_id, GL_LINK_STATUS, &linked) );
2369
2370         if (0 == linked)
2371         {
2372            char log[1024];
2373            GL_CHECK(glGetProgramInfoLog(m_id, sizeof(log), NULL, log) );
2374            BX_TRACE("%d: %s", linked, log);
2375
2376            GL_CHECK(glDeleteProgram(m_id) );
2377            return;
2378         }
2379
2380         s_renderGL->programCache(m_id, id);
2381      }
2382
2383      init();
2384
2385      if (!cached)
2386      {
2387         // Must be after init, otherwise init might fail to lookup shader
2388         // info (NVIDIA Tegra 3 OpenGL ES 2.0 14.01003).
2389         GL_CHECK(glDetachShader(m_id, _vsh.m_id) );
2390
2391         if (0 != _fsh.m_id)
2392         {
2393            GL_CHECK(glDetachShader(m_id, _fsh.m_id) );
2394         }
2395      }
2396   }
2397
2398   void ProgramGL::destroy()
2399   {
2400      if (NULL != m_constantBuffer)
2401      {
2402         ConstantBuffer::destroy(m_constantBuffer);
2403         m_constantBuffer = NULL;
2404      }
2405      m_numPredefined = 0;
2406
2407      if (0 != m_id)
2408      {
2409         GL_CHECK(glUseProgram(0) );
2410         GL_CHECK(glDeleteProgram(m_id) );
2411         m_id = 0;
2412      }
2413
2414      m_vcref.invalidate(s_renderGL->m_vaoStateCache);
2415   }
2416
2417   void ProgramGL::init()
2418   {
2419      GLint activeAttribs  = 0;
2420      GLint activeUniforms = 0;
2421      GLint activeBuffers  = 0;
2422
2423#if BGFX_CONFIG_RENDERER_OPENGL >= 31
2424      GL_CHECK(glBindFragDataLocation(m_id, 0, "bgfx_FragColor") );
2425#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
2426
2427      if (s_extension[Extension::ARB_program_interface_query].m_supported
2428      ||  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) )
2429      {
2430         GL_CHECK(glGetProgramInterfaceiv(m_id, GL_PROGRAM_INPUT,   GL_ACTIVE_RESOURCES, &activeAttribs ) );
2431         GL_CHECK(glGetProgramInterfaceiv(m_id, GL_UNIFORM,         GL_ACTIVE_RESOURCES, &activeUniforms) );
2432         GL_CHECK(glGetProgramInterfaceiv(m_id, GL_BUFFER_VARIABLE, GL_ACTIVE_RESOURCES, &activeBuffers ) );
2433      }
2434      else
2435      {
2436         GL_CHECK(glGetProgramiv(m_id, GL_ACTIVE_ATTRIBUTES, &activeAttribs ) );
2437         GL_CHECK(glGetProgramiv(m_id, GL_ACTIVE_UNIFORMS,   &activeUniforms) );
2438      }
2439
2440      GLint max0, max1;
2441      GL_CHECK(glGetProgramiv(m_id, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max0) );
2442      GL_CHECK(glGetProgramiv(m_id, GL_ACTIVE_UNIFORM_MAX_LENGTH,   &max1) );
2443      uint32_t maxLength = bx::uint32_max(max0, max1);
2444      char* name = (char*)alloca(maxLength + 1);
2445
2446      BX_TRACE("Program %d", m_id);
2447      BX_TRACE("Attributes (%d):", activeAttribs);
2448      for (int32_t ii = 0; ii < activeAttribs; ++ii)
2449      {
2450         GLint size;
2451         GLenum type;
2452
2453         GL_CHECK(glGetActiveAttrib(m_id, ii, maxLength + 1, NULL, &size, &type, name) );
2454
2455         BX_TRACE("\t%s %s is at location %d"
2456            , glslTypeName(type)
2457            , name
2458            , glGetAttribLocation(m_id, name)
2459            );
2460      }
2461
2462      m_numPredefined = 0;
2463      m_constantBuffer = ConstantBuffer::create(1024);
2464       m_numSamplers = 0;
2465
2466      struct VariableInfo
2467      {
2468         GLenum type;
2469         GLint  loc;
2470         GLint  num;
2471      };
2472      VariableInfo vi;
2473      GLenum props[] = { GL_TYPE, GL_LOCATION, GL_ARRAY_SIZE };
2474
2475      const bool piqSupported = s_extension[Extension::ARB_program_interface_query].m_supported;
2476
2477      BX_TRACE("Uniforms (%d):", activeUniforms);
2478      for (int32_t ii = 0; ii < activeUniforms; ++ii)
2479      {
2480         GLenum gltype;
2481         GLint num;
2482         GLint loc;
2483
2484         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31)
2485         ||  piqSupported)
2486         {
2487            GL_CHECK(glGetProgramResourceiv(m_id
2488               , GL_UNIFORM
2489               , ii
2490               , BX_COUNTOF(props)
2491               , props
2492               , BX_COUNTOF(props)
2493               , NULL
2494               , (GLint*)&vi
2495               ) );
2496
2497            GL_CHECK(glGetProgramResourceName(m_id
2498               , GL_UNIFORM
2499               , ii
2500               , maxLength + 1
2501               , NULL
2502               , name
2503               ) );
2504
2505            gltype = vi.type;
2506            loc    = vi.loc;
2507            num    = vi.num;
2508         }
2509         else
2510         {
2511            GL_CHECK(glGetActiveUniform(m_id, ii, maxLength + 1, NULL, &num, &gltype, name) );
2512            loc = glGetUniformLocation(m_id, name);
2513         }
2514
2515         num = bx::uint32_max(num, 1);
2516
2517         int offset = 0;
2518         char* array = strchr(name, '[');
2519         if (NULL != array)
2520         {
2521            BX_TRACE("--- %s", name);
2522            *array = '\0';
2523            array++;
2524            char* end = strchr(array, ']');
2525            *end = '\0';
2526            offset = atoi(array);
2527         }
2528
2529         switch (gltype)
2530         {
2531         case GL_SAMPLER_2D:
2532         case GL_SAMPLER_3D:
2533         case GL_SAMPLER_CUBE:
2534         case GL_SAMPLER_2D_SHADOW:
2535         case GL_IMAGE_1D:
2536         case GL_IMAGE_2D:
2537         case GL_IMAGE_3D:
2538         case GL_IMAGE_CUBE:
2539            BX_TRACE("Sampler #%d at location %d.", m_numSamplers, loc);
2540            m_sampler[m_numSamplers] = loc;
2541            m_numSamplers++;
2542            break;
2543
2544         default:
2545            break;
2546         }
2547
2548         PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name);
2549         if (PredefinedUniform::Count != predefined)
2550         {
2551            m_predefined[m_numPredefined].m_loc = loc;
2552            m_predefined[m_numPredefined].m_type = predefined;
2553            m_predefined[m_numPredefined].m_count = num;
2554            m_numPredefined++;
2555         }
2556         else
2557         {
2558            const UniformInfo* info = s_renderGL->m_uniformReg.find(name);
2559            if (NULL != info)
2560            {
2561               UniformType::Enum type = convertGlType(gltype);
2562               m_constantBuffer->writeUniformHandle(type, 0, info->m_handle, num);
2563               m_constantBuffer->write(loc);
2564               BX_TRACE("store %s %d", name, info->m_handle);
2565            }
2566         }
2567
2568         BX_TRACE("\tuniform %s %s%s is at location %d, size %d, offset %d"
2569            , glslTypeName(gltype)
2570            , name
2571            , PredefinedUniform::Count != predefined ? "*" : ""
2572            , loc
2573            , num
2574            , offset
2575            );
2576         BX_UNUSED(offset);
2577      }
2578
2579      if (s_extension[Extension::ARB_program_interface_query].m_supported
2580      ||  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31) )
2581      {
2582         struct VariableInfo
2583         {
2584            GLenum type;
2585         };
2586         VariableInfo vi;
2587         GLenum props[] = { GL_TYPE };
2588
2589         BX_TRACE("Buffers (%d):", activeBuffers);
2590         for (int32_t ii = 0; ii < activeBuffers; ++ii)
2591         {
2592            GL_CHECK(glGetProgramResourceiv(m_id
2593               , GL_BUFFER_VARIABLE
2594               , ii
2595               , BX_COUNTOF(props)
2596               , props
2597               , BX_COUNTOF(props)
2598               , NULL
2599               , (GLint*)&vi
2600               ) );
2601
2602            GL_CHECK(glGetProgramResourceName(m_id
2603               , GL_BUFFER_VARIABLE
2604               , ii
2605               , maxLength + 1
2606               , NULL
2607               , name
2608               ) );
2609
2610            BX_TRACE("\t%s %s at %d"
2611               , glslTypeName(vi.type)
2612               , name
2613               , 0 //vi.loc
2614               );
2615         }
2616      }
2617
2618      m_constantBuffer->finish();
2619
2620      memset(m_attributes, 0xff, sizeof(m_attributes) );
2621      uint32_t used = 0;
2622      for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
2623      {
2624         GLint loc = glGetAttribLocation(m_id, s_attribName[ii]);
2625         if (-1 != loc)
2626         {
2627            BX_TRACE("attr %s: %d", s_attribName[ii], loc);
2628            m_attributes[ii] = loc;
2629            m_used[used++] = ii;
2630         }
2631      }
2632      m_used[used] = Attrib::Count;
2633
2634      used = 0;
2635      for (uint32_t ii = 0; ii < BX_COUNTOF(s_instanceDataName); ++ii)
2636      {
2637         GLuint loc = glGetAttribLocation(m_id, s_instanceDataName[ii]);
2638         if (GLuint(-1) != loc )
2639         {
2640            BX_TRACE("instance data %s: %d", s_instanceDataName[ii], loc);
2641            m_instanceData[used++] = loc;
2642         }
2643      }
2644      m_instanceData[used] = 0xffff;
2645   }
2646
2647   void ProgramGL::bindAttributes(const VertexDecl& _vertexDecl, uint32_t _baseVertex) const
2648   {
2649      for (uint32_t ii = 0; Attrib::Count != m_used[ii]; ++ii)
2650      {
2651         Attrib::Enum attr = Attrib::Enum(m_used[ii]);
2652         GLint loc = m_attributes[attr];
2653
2654         uint8_t num;
2655         AttribType::Enum type;
2656         bool normalized;
2657         bool asInt;
2658         _vertexDecl.decode(attr, num, type, normalized, asInt);
2659
2660         if (-1 != loc)
2661         {
2662            if (0xff != _vertexDecl.m_attributes[attr])
2663            {
2664               GL_CHECK(glEnableVertexAttribArray(loc) );
2665               GL_CHECK(glVertexAttribDivisor(loc, 0) );
2666
2667               uint32_t baseVertex = _baseVertex*_vertexDecl.m_stride + _vertexDecl.m_offset[attr];
2668               GL_CHECK(glVertexAttribPointer(loc, num, s_attribType[type], normalized, _vertexDecl.m_stride, (void*)(uintptr_t)baseVertex) );
2669            }
2670            else
2671            {
2672               GL_CHECK(glDisableVertexAttribArray(loc) );
2673            }
2674         }
2675      }
2676   }
2677
2678   void ProgramGL::bindInstanceData(uint32_t _stride, uint32_t _baseVertex) const
2679   {
2680      uint32_t baseVertex = _baseVertex;
2681      for (uint32_t ii = 0; 0xffff != m_instanceData[ii]; ++ii)
2682      {
2683         GLint loc = m_instanceData[ii];
2684         GL_CHECK(glEnableVertexAttribArray(loc) );
2685         GL_CHECK(glVertexAttribPointer(loc, 4, GL_FLOAT, GL_FALSE, _stride, (void*)(uintptr_t)baseVertex) );
2686         GL_CHECK(glVertexAttribDivisor(loc, 1) );
2687         baseVertex += 16;
2688      }
2689   }
2690
2691   void IndexBufferGL::destroy()
2692   {
2693      GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) );
2694      GL_CHECK(glDeleteBuffers(1, &m_id) );
2695
2696      m_vcref.invalidate(s_renderGL->m_vaoStateCache);
2697   }
2698
2699   void VertexBufferGL::destroy()
2700   {
2701      GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0) );
2702      GL_CHECK(glDeleteBuffers(1, &m_id) );
2703
2704      m_vcref.invalidate(s_renderGL->m_vaoStateCache);
2705   }
2706
2707   static void texImage(GLenum _target, GLint _level, GLint _internalFormat, GLsizei _width, GLsizei _height, GLsizei _depth, GLint _border, GLenum _format, GLenum _type, const GLvoid* _data)
2708   {
2709      if (_target == GL_TEXTURE_3D)
2710      {
2711         GL_CHECK(glTexImage3D(_target, _level, _internalFormat, _width, _height, _depth, _border, _format, _type, _data) );
2712      }
2713      else
2714      {
2715         BX_UNUSED(_depth);
2716         GL_CHECK(glTexImage2D(_target, _level, _internalFormat, _width, _height, _border, _format, _type, _data) );
2717      }
2718   }
2719
2720   static void texSubImage(GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, GLint _zoffset, GLsizei _width, GLsizei _height, GLsizei _depth, GLenum _format, GLenum _type, const GLvoid* _data)
2721   {
2722      if (_target == GL_TEXTURE_3D)
2723      {
2724         GL_CHECK(glTexSubImage3D(_target, _level, _xoffset, _yoffset, _zoffset, _width, _height, _depth, _format, _type, _data) );
2725      }
2726      else
2727      {
2728         BX_UNUSED(_zoffset, _depth);
2729         GL_CHECK(glTexSubImage2D(_target, _level, _xoffset, _yoffset, _width, _height, _format, _type, _data) );
2730      }
2731   }
2732
2733   static void compressedTexImage(GLenum _target, GLint _level, GLenum _internalformat, GLsizei _width, GLsizei _height, GLsizei _depth, GLint _border, GLsizei _imageSize, const GLvoid* _data)
2734   {
2735      if (_target == GL_TEXTURE_3D)
2736      {
2737         GL_CHECK(glCompressedTexImage3D(_target, _level, _internalformat, _width, _height, _depth, _border, _imageSize, _data) );
2738      }
2739      else
2740      {
2741         BX_UNUSED(_depth);
2742         GL_CHECK(glCompressedTexImage2D(_target, _level, _internalformat, _width, _height, _border, _imageSize, _data) );
2743      }
2744   }
2745
2746   static void compressedTexSubImage(GLenum _target, GLint _level, GLint _xoffset, GLint _yoffset, GLint _zoffset, GLsizei _width, GLsizei _height, GLsizei _depth, GLenum _format, GLsizei _imageSize, const GLvoid* _data)
2747   {
2748      if (_target == GL_TEXTURE_3D)
2749      {
2750         GL_CHECK(glCompressedTexSubImage3D(_target, _level, _xoffset, _yoffset, _zoffset, _width, _height, _depth, _format, _imageSize, _data) );
2751      }
2752      else
2753      {
2754         BX_UNUSED(_zoffset, _depth);
2755         GL_CHECK(glCompressedTexSubImage2D(_target, _level, _xoffset, _yoffset, _width, _height, _format, _imageSize, _data) );
2756      }
2757   }
2758
2759   bool TextureGL::init(GLenum _target, uint32_t _width, uint32_t _height, uint8_t _format, uint8_t _numMips, uint32_t _flags)
2760   {
2761      m_target = _target;
2762      m_numMips = _numMips;
2763      m_flags = _flags;
2764      m_currentFlags = UINT32_MAX;
2765      m_width = _width;
2766      m_height = _height;
2767      m_requestedFormat = _format;
2768      m_textureFormat   = _format;
2769
2770      const bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
2771
2772      if (!bufferOnly)
2773      {
2774         GL_CHECK(glGenTextures(1, &m_id) );
2775         BX_CHECK(0 != m_id, "Failed to generate texture id.");
2776         GL_CHECK(glBindTexture(_target, m_id) );
2777
2778         setSamplerState(_flags);
2779
2780         const TextureFormatInfo& tfi = s_textureFormat[_format];
2781         m_fmt = tfi.m_fmt;
2782         m_type = tfi.m_type;
2783
2784         const bool compressed = isCompressed(TextureFormat::Enum(_format) );
2785         const bool decompress = !tfi.m_supported && compressed;
2786
2787         if (decompress)
2788         {
2789            m_textureFormat = (uint8_t)TextureFormat::BGRA8;
2790            const TextureFormatInfo& tfi = s_textureFormat[TextureFormat::BGRA8];
2791            m_fmt = tfi.m_fmt;
2792            m_type = tfi.m_type;
2793         }
2794
2795         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
2796         &&  TextureFormat::BGRA8 == m_textureFormat
2797         &&  GL_RGBA == m_fmt
2798         &&  s_renderGL->m_textureSwizzleSupport)
2799         {
2800            GLint swizzleMask[] = { GL_BLUE, GL_GREEN, GL_RED, GL_ALPHA };
2801            GL_CHECK(glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_RGBA, swizzleMask) );
2802         }
2803      }
2804
2805      const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK);
2806
2807      if (renderTarget)
2808      {
2809         uint32_t msaaQuality = ( (m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT);
2810         msaaQuality = bx::uint32_satsub(msaaQuality, 1);
2811         msaaQuality = bx::uint32_min(s_renderGL->m_maxMsaa, msaaQuality == 0 ? 0 : 1<<msaaQuality);
2812
2813         if (0 != msaaQuality
2814         ||  bufferOnly)
2815         {
2816            GL_CHECK(glGenRenderbuffers(1, &m_rbo) );
2817            BX_CHECK(0 != m_rbo, "Failed to generate renderbuffer id.");
2818            GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_rbo) );
2819
2820            if (0 == msaaQuality)
2821            {
2822               GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER
2823                  , s_textureFormat[m_textureFormat].m_internalFmt
2824                  , _width
2825                  , _height
2826                  ) );
2827            }
2828            else if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
2829            {
2830               GL_CHECK(glRenderbufferStorageMultisample(GL_RENDERBUFFER
2831                  , msaaQuality
2832                  , s_textureFormat[m_textureFormat].m_internalFmt
2833                  , _width
2834                  , _height
2835                  ) );
2836            }
2837
2838            GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, 0) );
2839
2840            if (bufferOnly)
2841            {
2842               // This is render buffer, there is no sampling, no need
2843               // to create texture.
2844               return false;
2845            }
2846         }
2847      }
2848
2849      return true;
2850   }
2851
2852   void TextureGL::create(const Memory* _mem, uint32_t _flags, uint8_t _skip)
2853   {
2854      ImageContainer imageContainer;
2855
2856      if (imageParse(imageContainer, _mem->data, _mem->size) )
2857      {
2858         uint8_t numMips = imageContainer.m_numMips;
2859         const uint32_t startLod = bx::uint32_min(_skip, numMips-1);
2860         numMips -= uint8_t(startLod);
2861         const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
2862         const uint32_t textureWidth  = bx::uint32_max(blockInfo.blockWidth,  imageContainer.m_width >>startLod);
2863         const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
2864
2865         GLenum target = GL_TEXTURE_2D;
2866         if (imageContainer.m_cubeMap)
2867         {
2868            target = GL_TEXTURE_CUBE_MAP;
2869         }
2870         else if (imageContainer.m_depth > 1)
2871         {
2872            target = GL_TEXTURE_3D;
2873         }
2874
2875         if (!init(target
2876               , textureWidth
2877               , textureHeight
2878               , imageContainer.m_format
2879               , numMips
2880               , _flags
2881               ) )
2882         {
2883            return;
2884         }
2885
2886         target = GL_TEXTURE_CUBE_MAP == m_target ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : m_target;
2887
2888         const GLenum internalFmt = s_textureFormat[m_textureFormat].m_internalFmt;
2889
2890         const bool swizzle = true
2891            && TextureFormat::BGRA8 == m_textureFormat
2892            && GL_RGBA == m_fmt
2893            && !s_renderGL->m_textureSwizzleSupport
2894            ;
2895         const bool convert    = m_textureFormat != m_requestedFormat;
2896         const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) );
2897         uint32_t blockWidth  = 1;
2898         uint32_t blockHeight = 1;
2899         
2900         if (convert && compressed)
2901         {
2902            blockWidth  = blockInfo.blockWidth;
2903            blockHeight = blockInfo.blockHeight;
2904         }
2905
2906         BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s%s."
2907            , this - s_renderGL->m_textures
2908            , getName( (TextureFormat::Enum)m_textureFormat)
2909            , getName( (TextureFormat::Enum)m_requestedFormat)
2910            , textureWidth
2911            , textureHeight
2912            , imageContainer.m_cubeMap ? "x6" : ""
2913            , 0 != (m_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : ""
2914            );
2915
2916         BX_WARN(!swizzle && !convert, "Texture %s%s%s from %s to %s."
2917               , swizzle ? "swizzle" : ""
2918               , swizzle&&convert ? " and " : ""
2919               , convert ? "convert" : ""
2920               , getName( (TextureFormat::Enum)m_requestedFormat)
2921               , getName( (TextureFormat::Enum)m_textureFormat)
2922               );
2923
2924         uint8_t* temp = NULL;
2925         if (convert || swizzle)
2926         {
2927            temp = (uint8_t*)BX_ALLOC(g_allocator, textureWidth*textureHeight*4);
2928         }
2929
2930         for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
2931         {
2932            uint32_t width  = textureWidth;
2933            uint32_t height = textureHeight;
2934            uint32_t depth  = imageContainer.m_depth;
2935
2936            for (uint32_t lod = 0, num = numMips; lod < num; ++lod)
2937            {
2938               width  = bx::uint32_max(blockWidth,  width);
2939               height = bx::uint32_max(blockHeight, height);
2940               depth  = bx::uint32_max(1, depth);
2941
2942               ImageMip mip;
2943               if (imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) )
2944               {
2945                  if (compressed)
2946                  {
2947                     compressedTexImage(target+side
2948                        , lod
2949                        , internalFmt
2950                        , width
2951                        , height
2952                        , depth
2953                        , 0
2954                        , mip.m_size
2955                        , mip.m_data
2956                        );
2957                  }
2958                  else
2959                  {
2960                     const uint8_t* data = mip.m_data;
2961
2962                     if (convert)
2963                     {
2964                        imageDecodeToBgra8(temp, mip.m_data, mip.m_width, mip.m_height, mip.m_width*4, mip.m_format);
2965                        data = temp;
2966                     }
2967
2968                     if (swizzle)
2969                     {
2970                        imageSwizzleBgra8(width, height, mip.m_width*4, data, temp);
2971                        data = temp;
2972                     }
2973
2974                     texImage(target+side
2975                        , lod
2976                        , internalFmt
2977                        , width
2978                        , height
2979                        , depth
2980                        , 0
2981                        , m_fmt
2982                        , m_type
2983                        , data
2984                        );
2985                  }
2986               }
2987               else
2988               {
2989                  if (compressed)
2990                  {
2991                     uint32_t size = bx::uint32_max(1, (width  + 3)>>2)
2992                                * bx::uint32_max(1, (height + 3)>>2)
2993                                * 4*4*getBitsPerPixel(TextureFormat::Enum(m_textureFormat) )/8
2994                                ;
2995
2996                     compressedTexImage(target+side
2997                        , lod
2998                        , internalFmt
2999                        , width
3000                        , height
3001                        , depth
3002                        , 0
3003                        , size
3004                        , NULL
3005                        );
3006                  }
3007                  else
3008                  {
3009                     texImage(target+side
3010                        , lod
3011                        , internalFmt
3012                        , width
3013                        , height
3014                        , depth
3015                        , 0
3016                        , m_fmt
3017                        , m_type
3018                        , NULL
3019                        );
3020                  }
3021               }
3022
3023               width  >>= 1;
3024               height >>= 1;
3025               depth  >>= 1;
3026            }
3027         }
3028
3029         if (NULL != temp)
3030         {
3031            BX_FREE(g_allocator, temp);
3032         }
3033      }
3034
3035      GL_CHECK(glBindTexture(m_target, 0) );
3036   }
3037
3038   void TextureGL::destroy()
3039   {
3040      if (0 != m_id)
3041      {
3042         GL_CHECK(glBindTexture(m_target, 0) );
3043         GL_CHECK(glDeleteTextures(1, &m_id) );
3044         m_id = 0;
3045      }
3046
3047      if (0 != m_rbo)
3048      {
3049         GL_CHECK(glDeleteRenderbuffers(1, &m_rbo) );
3050         m_rbo = 0;
3051      }
3052   }
3053
3054   void TextureGL::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)
3055   {
3056      BX_UNUSED(_z, _depth);
3057
3058      const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
3059      const uint32_t rectpitch = _rect.m_width*bpp/8;
3060      uint32_t srcpitch  = UINT16_MAX == _pitch ? rectpitch : _pitch;
3061
3062      GL_CHECK(glBindTexture(m_target, m_id) );
3063      GL_CHECK(glPixelStorei(GL_UNPACK_ALIGNMENT, 1) );
3064
3065      GLenum target = GL_TEXTURE_CUBE_MAP == m_target ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : m_target;
3066
3067      const bool swizzle = true
3068         && TextureFormat::BGRA8 == m_textureFormat
3069         && GL_RGBA == m_fmt
3070         && !s_renderGL->m_textureSwizzleSupport
3071         ;
3072      const bool unpackRowLength = BX_IGNORE_C4127(!!BGFX_CONFIG_RENDERER_OPENGL || s_extension[Extension::EXT_unpack_subimage].m_supported);
3073      const bool convert         = m_textureFormat != m_requestedFormat;
3074      const bool compressed      = isCompressed(TextureFormat::Enum(m_textureFormat) );
3075
3076      const uint32_t width  = _rect.m_width;
3077      const uint32_t height = _rect.m_height;
3078
3079      uint8_t* temp = NULL;
3080      if (convert
3081      ||  swizzle
3082      ||  !unpackRowLength)
3083      {
3084         temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*height);
3085      }
3086      else if (unpackRowLength)
3087      {
3088         GL_CHECK(glPixelStorei(GL_UNPACK_ROW_LENGTH, srcpitch*8/bpp) );
3089      }
3090
3091      if (compressed)
3092      {
3093         const uint8_t* data = _mem->data;
3094
3095         if (!unpackRowLength)
3096         {
3097            imageCopy(width, height, bpp, srcpitch, data, temp);
3098            data = temp;
3099         }
3100
3101         GL_CHECK(compressedTexSubImage(target+_side
3102            , _mip
3103            , _rect.m_x
3104            , _rect.m_y
3105            , _z
3106            , _rect.m_width
3107            , _rect.m_height
3108            , _depth
3109            , m_fmt
3110            , _mem->size
3111            , data
3112            ) );
3113      }
3114      else
3115      {
3116         const uint8_t* data = _mem->data;
3117
3118         if (convert)
3119         {
3120            imageDecodeToBgra8(temp, data, width, height, srcpitch, m_requestedFormat);
3121            data = temp;
3122            srcpitch = rectpitch;
3123         }
3124
3125         if (swizzle)
3126         {
3127            imageSwizzleBgra8(width, height, srcpitch, data, temp);
3128            data = temp;
3129         }
3130         else if (!unpackRowLength && !convert)
3131         {
3132            imageCopy(width, height, bpp, srcpitch, data, temp);
3133            data = temp;
3134         }
3135
3136         GL_CHECK(texSubImage(target+_side
3137            , _mip
3138            , _rect.m_x
3139            , _rect.m_y
3140            , _z
3141            , _rect.m_width
3142            , _rect.m_height
3143            , _depth
3144            , m_fmt
3145            , m_type
3146            , data
3147            ) );
3148      }
3149
3150      if (NULL != temp)
3151      {
3152         BX_FREE(g_allocator, temp);
3153      }
3154   }
3155
3156   void TextureGL::setSamplerState(uint32_t _flags)
3157   {
3158      const uint32_t flags = (0 != (BGFX_SAMPLER_DEFAULT_FLAGS & _flags) ? m_flags : _flags) & BGFX_TEXTURE_SAMPLER_BITS_MASK;
3159      if (flags != m_currentFlags)
3160      {
3161         const GLenum target = m_target;
3162         const uint8_t numMips = m_numMips;
3163
3164         GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_S, s_textureAddress[(flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT]) );
3165         GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_T, s_textureAddress[(flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT]) );
3166
3167         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES >= 30)
3168         ||  s_extension[Extension::APPLE_texture_max_level].m_supported)
3169         {
3170            GL_CHECK(glTexParameteri(target, GL_TEXTURE_MAX_LEVEL, numMips-1) );
3171         }
3172
3173         if (target == GL_TEXTURE_3D)
3174         {
3175            GL_CHECK(glTexParameteri(target, GL_TEXTURE_WRAP_R, s_textureAddress[(flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT]) );
3176         }
3177
3178         const uint32_t mag = (flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT;
3179         const uint32_t min = (flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT;
3180         const uint32_t mip = (flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT;
3181         const GLenum minFilter = s_textureFilterMin[min][1 < numMips ? mip+1 : 0];
3182         GL_CHECK(glTexParameteri(target, GL_TEXTURE_MAG_FILTER, s_textureFilterMag[mag]) );
3183         GL_CHECK(glTexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilter) );
3184         if (0 != (flags & (BGFX_TEXTURE_MIN_ANISOTROPIC|BGFX_TEXTURE_MAG_ANISOTROPIC) )
3185         &&  0.0f < s_renderGL->m_maxAnisotropy)
3186         {
3187            GL_CHECK(glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, s_renderGL->m_maxAnisotropy) );
3188         }
3189
3190         if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30)
3191         ||  s_renderGL->m_shadowSamplersSupport)
3192         {
3193            const uint32_t cmpFunc = (flags&BGFX_TEXTURE_COMPARE_MASK)>>BGFX_TEXTURE_COMPARE_SHIFT;
3194            if (0 == cmpFunc)
3195            {
3196               GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_COMPARE_MODE, GL_NONE) );
3197            }
3198            else
3199            {
3200               GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_REF_TO_TEXTURE) );
3201               GL_CHECK(glTexParameteri(m_target, GL_TEXTURE_COMPARE_FUNC, s_cmpFunc[cmpFunc]) );
3202            }
3203         }
3204
3205         m_currentFlags = flags;
3206      }
3207   }
3208
3209   void TextureGL::commit(uint32_t _stage, uint32_t _flags)
3210   {
3211      GL_CHECK(glActiveTexture(GL_TEXTURE0+_stage) );
3212      GL_CHECK(glBindTexture(m_target, m_id) );
3213
3214      if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES)
3215      &&  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES < 30) )
3216      {
3217         // GLES2 doesn't have support for sampler object.
3218         setSamplerState(_flags);
3219      }
3220      else if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
3221          &&  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL < 31) )
3222      {
3223         // In case that GL 2.1 sampler object is supported via extension.
3224         if (s_renderGL->m_samplerObjectSupport)
3225         {
3226            s_renderGL->setSamplerState(_stage, m_numMips, _flags);
3227         }
3228         else
3229         {
3230            setSamplerState(_flags);
3231         }
3232      }
3233      else
3234      {
3235         // Everything else has sampler object.
3236         s_renderGL->setSamplerState(_stage, m_numMips, _flags);
3237      }
3238   }
3239
3240   void writeString(bx::WriterI* _writer, const char* _str)
3241   {
3242      bx::write(_writer, _str, (int32_t)strlen(_str) );
3243   }
3244
3245   void writeStringf(bx::WriterI* _writer, const char* _format, ...)
3246   {
3247      char temp[512];
3248
3249      va_list argList;
3250      va_start(argList, _format);
3251      int len = bx::vsnprintf(temp, BX_COUNTOF(temp), _format, argList);
3252      va_end(argList);
3253
3254      bx::write(_writer, temp, len);
3255   }
3256
3257   void strins(char* _str, const char* _insert)
3258   {
3259      size_t len = strlen(_insert);
3260      memmove(&_str[len], _str, strlen(_str)+1);
3261      memcpy(_str, _insert, len);
3262   }
3263
3264   void ShaderGL::create(Memory* _mem)
3265   {
3266      bx::MemoryReader reader(_mem->data, _mem->size);
3267      m_hash = bx::hashMurmur2A(_mem->data, _mem->size);
3268
3269      uint32_t magic;
3270      bx::read(&reader, magic);
3271
3272      switch (magic)
3273      {
3274      case BGFX_CHUNK_MAGIC_CSH: m_type = GL_COMPUTE_SHADER;  break;
3275      case BGFX_CHUNK_MAGIC_FSH: m_type = GL_FRAGMENT_SHADER;   break;
3276      case BGFX_CHUNK_MAGIC_VSH: m_type = GL_VERTEX_SHADER;   break;
3277
3278      default:
3279         BGFX_FATAL(false, Fatal::InvalidShader, "Unknown shader format %x.", magic);
3280         break;
3281      }
3282
3283      uint32_t iohash;
3284      bx::read(&reader, iohash);
3285
3286      uint16_t count;
3287      bx::read(&reader, count);
3288
3289      BX_TRACE("%s Shader consts %d"
3290         , BGFX_CHUNK_MAGIC_FSH == magic ? "Fragment" : BGFX_CHUNK_MAGIC_VSH == magic ? "Vertex" : "Compute"
3291         , count
3292         );
3293
3294      for (uint32_t ii = 0; ii < count; ++ii)
3295      {
3296         uint8_t nameSize;
3297         bx::read(&reader, nameSize);
3298
3299         char name[256];
3300         bx::read(&reader, &name, nameSize);
3301         name[nameSize] = '\0';
3302
3303         uint8_t type;
3304         bx::read(&reader, type);
3305
3306         uint8_t num;
3307         bx::read(&reader, num);
3308
3309         uint16_t regIndex;
3310         bx::read(&reader, regIndex);
3311
3312         uint16_t regCount;
3313         bx::read(&reader, regCount);
3314      }
3315
3316      uint32_t shaderSize;
3317      bx::read(&reader, shaderSize);
3318
3319      m_id = glCreateShader(m_type);
3320
3321      const char* code = (const char*)reader.getDataPtr();
3322
3323      if (0 != m_id)
3324      {
3325         if (GL_COMPUTE_SHADER != m_type)
3326         {
3327            int32_t codeLen = (int32_t)strlen(code);
3328            int32_t tempLen = codeLen + (4<<10);
3329            char* temp = (char*)alloca(tempLen);
3330            bx::StaticMemoryBlockWriter writer(temp, tempLen);
3331
3332            if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES)
3333            &&  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES < 30) )
3334            {
3335               writeString(&writer
3336                  , "#define flat\n"
3337                    "#define smooth\n"
3338                    "#define noperspective\n"
3339                  );
3340
3341               bool usesDerivatives = s_extension[Extension::OES_standard_derivatives].m_supported
3342                  && bx::findIdentifierMatch(code, s_OES_standard_derivatives)
3343                  ;
3344
3345               bool usesFragDepth = !!bx::findIdentifierMatch(code, "gl_FragDepth");
3346
3347               bool usesShadowSamplers = !!bx::findIdentifierMatch(code, s_EXT_shadow_samplers);
3348
3349               bool usesTexture3D = s_extension[Extension::OES_texture_3D].m_supported
3350                  && bx::findIdentifierMatch(code, s_OES_texture_3D)
3351                  ;
3352
3353               bool usesTextureLod = !!bx::findIdentifierMatch(code, s_EXT_shader_texture_lod);
3354
3355               bool usesFragmentOrdering = !!bx::findIdentifierMatch(code, "beginFragmentShaderOrdering");
3356
3357               if (usesDerivatives)
3358               {
3359                  writeString(&writer, "#extension GL_OES_standard_derivatives : enable\n");
3360               }
3361
3362               bool insertFragDepth = false;
3363               if (usesFragDepth)
3364               {
3365                  BX_WARN(s_extension[Extension::EXT_frag_depth].m_supported, "EXT_frag_depth is used but not supported by GLES2 driver.");
3366                  if (s_extension[Extension::EXT_frag_depth].m_supported)
3367                  {
3368                     writeString(&writer
3369                        , "#extension GL_EXT_frag_depth : enable\n"
3370                          "#define bgfx_FragDepth gl_FragDepthEXT\n"
3371                        );
3372
3373                     char str[128];
3374                     bx::snprintf(str, BX_COUNTOF(str), "%s float gl_FragDepthEXT;\n"
3375                        , s_extension[Extension::OES_fragment_precision_high].m_supported ? "highp" : "mediump"
3376                        );
3377                     writeString(&writer, str);
3378                  }
3379                  else
3380                  {
3381                     insertFragDepth = true;
3382                  }
3383               }
3384
3385               if (usesShadowSamplers)
3386               {
3387                  if (s_renderGL->m_shadowSamplersSupport)
3388                  {
3389                     writeString(&writer
3390                        , "#extension GL_EXT_shadow_samplers : enable\n"
3391                          "#define shadow2D shadow2DEXT\n"
3392                          "#define shadow2DProj shadow2DProjEXT\n"
3393                        );
3394                  }
3395                  else
3396                  {
3397                     writeString(&writer
3398                        , "#define sampler2DShadow sampler2D\n"
3399                          "#define shadow2D(_sampler, _coord) step(_coord.z, texture2D(_sampler, _coord.xy).x)\n"
3400                          "#define shadow2DProj(_sampler, _coord) step(_coord.z/_coord.w, texture2DProj(_sampler, _coord).x)\n"
3401                        );
3402                  }
3403               }
3404
3405               if (usesTexture3D)
3406               {
3407                  writeString(&writer, "#extension GL_OES_texture_3D : enable\n");
3408               }
3409
3410               if (usesTextureLod)
3411               {
3412                  BX_WARN(s_extension[Extension::EXT_shader_texture_lod].m_supported, "EXT_shader_texture_lod is used but not supported by GLES2 driver.");
3413                  if (s_extension[Extension::EXT_shader_texture_lod].m_supported)
3414                  {
3415                     writeString(&writer
3416                        , "#extension GL_EXT_shader_texture_lod : enable\n"
3417                          "#define texture2DLod texture2DLodEXT\n"
3418                          "#define texture2DProjLod texture2DProjLodEXT\n"
3419                          "#define textureCubeLod textureCubeLodEXT\n"
3420                        );
3421                  }
3422                  else
3423                  {
3424                     writeString(&writer
3425                        , "#define texture2DLod(_sampler, _coord, _level) texture2D(_sampler, _coord)\n"
3426                          "#define texture2DProjLod(_sampler, _coord, _level) texture2DProj(_sampler, _coord)\n"
3427                          "#define textureCubeLod(_sampler, _coord, _level) textureCube(_sampler, _coord)\n"
3428                        );
3429                  }
3430               }
3431
3432               if (usesFragmentOrdering)
3433               {
3434                  if (s_extension[Extension::INTEL_fragment_shader_ordering].m_supported)
3435                  {
3436                     writeString(&writer, "#extension GL_INTEL_fragment_shader_ordering : enable\n");
3437                  }
3438                  else
3439                  {
3440                     writeString(&writer, "#define beginFragmentShaderOrdering()\n");
3441                  }
3442               }
3443
3444               writeString(&writer, "precision mediump float;\n");
3445
3446               bx::write(&writer, code, codeLen);
3447               bx::write(&writer, '\0');
3448
3449               if (insertFragDepth)
3450               {
3451                  char* entry = strstr(temp, "void main ()");
3452                  if (NULL != entry)
3453                  {
3454                     char* brace = strstr(entry, "{");
3455                     if (NULL != brace)
3456                     {
3457                        const char* end = bx::strmb(brace, '{', '}');
3458                        if (NULL != end)
3459                        {
3460                           strins(brace+1, "\n  float bgfx_FragDepth = 0.0;\n");
3461                        }
3462                     }
3463                  }
3464               }
3465
3466               // Replace all instances of gl_FragDepth with bgfx_FragDepth.
3467               for (const char* fragDepth = bx::findIdentifierMatch(temp, "gl_FragDepth"); NULL != fragDepth; fragDepth = bx::findIdentifierMatch(fragDepth, "gl_FragDepth") )
3468               {
3469                  char* insert = const_cast<char*>(fragDepth);
3470                  strins(insert, "bg");
3471                  memcpy(insert + 2, "fx", 2);
3472               }
3473            }
3474            else if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
3475                &&  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL <= 21) )
3476            {
3477               bool usesTextureLod = s_extension[Extension::ARB_shader_texture_lod].m_supported
3478                  && bx::findIdentifierMatch(code, s_ARB_shader_texture_lod)
3479                  ;
3480
3481               if (usesTextureLod)
3482               {
3483                  writeString(&writer, "#version 120\n");
3484
3485                  if (m_type == GL_FRAGMENT_SHADER)
3486                  {
3487                     writeString(&writer, "#extension GL_ARB_shader_texture_lod : enable\n");
3488                  }
3489               }
3490
3491               writeString(&writer
3492                     , "#define lowp\n"
3493                       "#define mediump\n"
3494                       "#define highp\n"
3495                       "#define flat\n"
3496                       "#define smooth\n"
3497                       "#define noperspective\n"
3498                     );
3499
3500               bx::write(&writer, code, codeLen);
3501               bx::write(&writer, '\0');
3502            }
3503            else if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL   >= 31)
3504                ||  BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
3505            {
3506               if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
3507               {
3508                  writeString(&writer
3509                     , "#version 300 es\n"
3510                       "precision mediump float;\n"
3511                     );
3512               }
3513               else
3514               {
3515                  writeString(&writer, "#version 140\n");
3516               }
3517
3518               if (m_type == GL_FRAGMENT_SHADER)
3519               {
3520                  writeString(&writer, "#define varying in\n");
3521                  writeString(&writer, "#define texture2D texture\n");
3522                  writeString(&writer, "#define texture2DLod textureLod\n");
3523                  writeString(&writer, "#define texture2DProj textureProj\n");
3524
3525                  if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
3526                  {
3527                     writeString(&writer, "#define shadow2D(_sampler, _coord) vec2(textureProj(_sampler, vec4(_coord, 1.0) ) )\n");
3528                     writeString(&writer, "#define shadow2DProj(_sampler, _coord) vec2(textureProj(_sampler, _coord) ) )\n");
3529                  }
3530                  else
3531                  {
3532                     writeString(&writer, "#define shadow2D(_sampler, _coord) (textureProj(_sampler, vec4(_coord, 1.0) ) )\n");
3533                     writeString(&writer, "#define shadow2DProj(_sampler, _coord) (textureProj(_sampler, _coord) ) )\n");
3534                  }
3535
3536                  writeString(&writer, "#define texture3D texture\n");
3537                  writeString(&writer, "#define texture3DLod textureLod\n");
3538                  writeString(&writer, "#define textureCube texture\n");
3539                  writeString(&writer, "#define textureCubeLod textureLod\n");
3540
3541                  uint32_t fragData = 0;
3542
3543                  if (!!bx::findIdentifierMatch(code, "gl_FragData") )
3544                  {
3545                     using namespace bx;
3546                     fragData = uint32_max(fragData, NULL == strstr(code, "gl_FragData[0]") ? 0 : 1);
3547                     fragData = uint32_max(fragData, NULL == strstr(code, "gl_FragData[1]") ? 0 : 2);
3548                     fragData = uint32_max(fragData, NULL == strstr(code, "gl_FragData[2]") ? 0 : 3);
3549                     fragData = uint32_max(fragData, NULL == strstr(code, "gl_FragData[3]") ? 0 : 4);
3550
3551                     BGFX_FATAL(0 != fragData, Fatal::InvalidShader, "Unable to find and patch gl_FragData!");
3552                  }
3553
3554                  if (!!bx::findIdentifierMatch(code, "beginFragmentShaderOrdering") )
3555                  {
3556                     if (s_extension[Extension::INTEL_fragment_shader_ordering].m_supported)
3557                     {
3558                        writeString(&writer, "#extension GL_INTEL_fragment_shader_ordering : enable\n");
3559                     }
3560                     else
3561                     {
3562                        writeString(&writer, "#define beginFragmentShaderOrdering()\n");
3563                     }
3564                  }
3565
3566                  if (0 != fragData)
3567                  {
3568                     writeStringf(&writer, "out vec4 bgfx_FragData[%d];\n", fragData);
3569                     writeString(&writer, "#define gl_FragData bgfx_FragData\n");
3570                  }
3571                  else
3572                  {
3573                     writeString(&writer, "out vec4 bgfx_FragColor;\n");
3574                     writeString(&writer, "#define gl_FragColor bgfx_FragColor\n");
3575                  }
3576               }
3577               else
3578               {
3579                  writeString(&writer, "#define attribute in\n");
3580                  writeString(&writer, "#define varying out\n");
3581               }
3582
3583               if (!BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 30) )
3584               {
3585                  writeString(&writer
3586                        , "#define lowp\n"
3587                          "#define mediump\n"
3588                          "#define highp\n"
3589                        );
3590               }
3591
3592               bx::write(&writer, code, codeLen);
3593               bx::write(&writer, '\0');
3594            }
3595
3596            code = temp;
3597         }
3598
3599         GL_CHECK(glShaderSource(m_id, 1, (const GLchar**)&code, NULL) );
3600         GL_CHECK(glCompileShader(m_id) );
3601
3602         GLint compiled = 0;
3603         GL_CHECK(glGetShaderiv(m_id, GL_COMPILE_STATUS, &compiled) );
3604
3605         if (0 == compiled)
3606         {
3607            BX_TRACE("\n####\n%s\n####", code);
3608
3609            GLsizei len;
3610            char log[1024];
3611            GL_CHECK(glGetShaderInfoLog(m_id, sizeof(log), &len, log) );
3612            BX_TRACE("Failed to compile shader. %d: %s", compiled, log);
3613
3614            GL_CHECK(glDeleteShader(m_id) );
3615            BGFX_FATAL(false, bgfx::Fatal::InvalidShader, "Failed to compile shader.");
3616         }
3617         else if (BX_ENABLED(BGFX_CONFIG_DEBUG)
3618             &&  s_extension[Extension::ANGLE_translated_shader_source].m_supported
3619             &&  NULL != glGetTranslatedShaderSourceANGLE)
3620         {
3621            GLsizei len;
3622            GL_CHECK(glGetShaderiv(m_id, GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, &len) );
3623
3624            char* source = (char*)alloca(len);
3625            GL_CHECK(glGetTranslatedShaderSourceANGLE(m_id, len, &len, source) );
3626
3627            BX_TRACE("ANGLE source (len: %d):\n%s\n####", len, source);
3628         }
3629      }
3630   }
3631
3632   void ShaderGL::destroy()
3633   {
3634      if (0 != m_id)
3635      {
3636         GL_CHECK(glDeleteShader(m_id) );
3637         m_id = 0;
3638      }
3639   }
3640
3641   static void frameBufferValidate()
3642   {
3643      GLenum complete = glCheckFramebufferStatus(GL_FRAMEBUFFER);
3644      BX_CHECK(GL_FRAMEBUFFER_COMPLETE == complete
3645         , "glCheckFramebufferStatus failed 0x%08x: %s"
3646         , complete
3647         , glEnumName(complete)
3648      );
3649      BX_UNUSED(complete);
3650   }
3651
3652   void FrameBufferGL::create(uint8_t _num, const TextureHandle* _handles)
3653   {
3654      GL_CHECK(glGenFramebuffers(1, &m_fbo[0]) );
3655      GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo[0]) );
3656
3657      bool needResolve = false;
3658
3659      GLenum buffers[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
3660
3661      uint32_t colorIdx = 0;
3662      for (uint32_t ii = 0; ii < _num; ++ii)
3663      {
3664         TextureHandle handle = _handles[ii];
3665         if (isValid(handle) )
3666         {
3667            const TextureGL& texture = s_renderGL->m_textures[handle.idx];
3668
3669            if (0 == colorIdx)
3670            {
3671               m_width  = texture.m_width;
3672               m_height = texture.m_height;
3673            }
3674
3675            GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx;
3676            if (isDepth( (TextureFormat::Enum)texture.m_textureFormat) )
3677            {
3678               attachment = GL_DEPTH_ATTACHMENT;
3679            }
3680            else
3681            {
3682               buffers[colorIdx] = attachment;
3683               ++colorIdx;
3684            }
3685
3686            if (0 != texture.m_rbo)
3687            {
3688               GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER
3689                  , attachment
3690                  , GL_RENDERBUFFER
3691                  , texture.m_rbo
3692                  ) );
3693            }
3694            else
3695            {
3696               GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER
3697                  , attachment
3698                  , texture.m_target
3699                  , texture.m_id
3700                  , 0
3701                  ) );
3702            }
3703           
3704            needResolve |= (0 != texture.m_rbo) && (0 != texture.m_id);
3705         }
3706      }
3707
3708      m_num = colorIdx;
3709
3710      if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) )
3711      {
3712         if (0 == colorIdx)
3713         {
3714            // When only depth is attached disable draw buffer to avoid
3715            // GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER.
3716            GL_CHECK(glDrawBuffer(GL_NONE) );
3717         }
3718         else
3719         {
3720            GL_CHECK(glDrawBuffers(colorIdx, buffers) );
3721         }
3722
3723         // Disable read buffer to avoid GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER.
3724         GL_CHECK(glReadBuffer(GL_NONE) );
3725      }
3726
3727      frameBufferValidate();
3728
3729      if (needResolve)
3730      {
3731         GL_CHECK(glGenFramebuffers(1, &m_fbo[1]) );
3732         GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo[1]) );
3733
3734         for (uint32_t ii = 0, colorIdx = 0; ii < _num; ++ii)
3735         {
3736            TextureHandle handle = _handles[ii];
3737            if (isValid(handle) )
3738            {
3739               const TextureGL& texture = s_renderGL->m_textures[handle.idx];
3740
3741               if (0 != texture.m_id)
3742               {
3743                  GLenum attachment = GL_COLOR_ATTACHMENT0 + colorIdx;
3744                  if (!isDepth( (TextureFormat::Enum)texture.m_textureFormat) )
3745                  {
3746                     ++colorIdx;
3747                     GL_CHECK(glFramebufferTexture2D(GL_FRAMEBUFFER
3748                        , attachment
3749                        , texture.m_target
3750                        , texture.m_id
3751                        , 0
3752                        ) );
3753                  }
3754               }
3755            }
3756         }
3757
3758         frameBufferValidate();
3759      }
3760
3761      GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, s_renderGL->m_msaaBackBufferFbo) );
3762   }
3763
3764   void FrameBufferGL::destroy()
3765   {
3766      GL_CHECK(glDeleteFramebuffers(0 == m_fbo[1] ? 1 : 2, m_fbo) );
3767      memset(m_fbo, 0, sizeof(m_fbo) );
3768      m_num = 0;
3769   }
3770
3771   void FrameBufferGL::resolve()
3772   {
3773      if (0 != m_fbo[1])
3774      {
3775         GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo[0]) );
3776         GL_CHECK(glReadBuffer(GL_COLOR_ATTACHMENT0) );
3777         GL_CHECK(glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_fbo[1]) );
3778         GL_CHECK(glBlitFramebuffer(0
3779            , 0
3780            , m_width
3781            , m_height
3782            , 0
3783            , 0
3784            , m_width
3785            , m_height
3786            , GL_COLOR_BUFFER_BIT
3787            , GL_LINEAR
3788            ) );
3789         GL_CHECK(glBindFramebuffer(GL_READ_FRAMEBUFFER, m_fbo[0]) );
3790         GL_CHECK(glReadBuffer(GL_NONE) );
3791         GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, s_renderGL->m_msaaBackBufferFbo) );
3792      }
3793   }
3794
3795   void RendererContextGL::submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter)
3796   {
3797      const GLuint defaultVao = s_renderGL->m_vao;
3798      if (0 != defaultVao)
3799      {
3800         GL_CHECK(glBindVertexArray(defaultVao) );
3801      }
3802
3803      GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, s_renderGL->m_backBufferFbo) );
3804
3805      updateResolution(_render->m_resolution);
3806
3807      int64_t elapsed = -bx::getHPCounter();
3808      int64_t captureElapsed = 0;
3809
3810      if (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
3811      && (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) ) )
3812      {
3813         s_renderGL->m_queries.begin(0, GL_TIME_ELAPSED);
3814      }
3815
3816      if (0 < _render->m_iboffset)
3817      {
3818         TransientIndexBuffer* ib = _render->m_transientIb;
3819         s_renderGL->m_indexBuffers[ib->handle.idx].update(0, _render->m_iboffset, ib->data);
3820      }
3821
3822      if (0 < _render->m_vboffset)
3823      {
3824         TransientVertexBuffer* vb = _render->m_transientVb;
3825         s_renderGL->m_vertexBuffers[vb->handle.idx].update(0, _render->m_vboffset, vb->data);
3826      }
3827
3828      _render->sort();
3829
3830      RenderDraw currentState;
3831      currentState.clear();
3832      currentState.m_flags = BGFX_STATE_NONE;
3833      currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE);
3834
3835      Matrix4 viewProj[BGFX_CONFIG_MAX_VIEWS];
3836      for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
3837      {
3838         bx::float4x4_mul(&viewProj[ii].un.f4x4, &_render->m_view[ii].un.f4x4, &_render->m_proj[ii].un.f4x4);
3839      }
3840
3841      Matrix4 invView;
3842      Matrix4 invProj;
3843      Matrix4 invViewProj;
3844      uint8_t invViewCached = 0xff;
3845      uint8_t invProjCached = 0xff;
3846      uint8_t invViewProjCached = 0xff;
3847
3848      uint16_t programIdx = invalidHandle;
3849      SortKey key;
3850      uint8_t view = 0xff;
3851      FrameBufferHandle fbh = BGFX_INVALID_HANDLE;
3852      int32_t height = _render->m_resolution.m_height;
3853      float alphaRef = 0.0f;
3854      uint32_t blendFactor = 0;
3855
3856      const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : 0;
3857      uint8_t primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
3858      PrimInfo prim = s_primInfo[primIndex];
3859
3860      uint32_t baseVertex = 0;
3861      GLuint currentVao = 0;
3862      bool viewHasScissor = false;
3863      Rect viewScissorRect;
3864      viewScissorRect.clear();
3865
3866      const bool blendIndependentSupported = s_extension[Extension::ARB_draw_buffers_blend].m_supported;
3867      const bool computeSupported = (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) && s_extension[Extension::ARB_compute_shader].m_supported)
3868                           || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES >= 31)
3869                           ;
3870
3871      uint32_t statsNumPrimsSubmitted[BX_COUNTOF(s_primInfo)] = {};
3872      uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {};
3873      uint32_t statsNumInstances[BX_COUNTOF(s_primInfo)] = {};
3874      uint32_t statsNumIndices = 0;
3875
3876      if (0 == (_render->m_debug&BGFX_DEBUG_IFH) )
3877      {
3878         GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, s_renderGL->m_msaaBackBufferFbo) );
3879
3880         for (uint32_t item = 0, numItems = _render->m_num; item < numItems; ++item)
3881         {
3882            const bool isCompute   = key.decode(_render->m_sortKeys[item]);
3883            const bool viewChanged = key.m_view != view;
3884
3885            const RenderItem& renderItem = _render->m_renderItem[_render->m_sortValues[item] ];
3886
3887            if (viewChanged)
3888            {
3889               GL_CHECK(glInsertEventMarker(0, s_viewName[key.m_view]) );
3890
3891               view = key.m_view;
3892               programIdx = invalidHandle;
3893
3894               if (_render->m_fb[view].idx != fbh.idx)
3895               {
3896                  fbh = _render->m_fb[view];
3897                  height = s_renderGL->setFrameBuffer(fbh, _render->m_resolution.m_height);
3898               }
3899
3900               const Rect& rect = _render->m_rect[view];
3901               const Rect& scissorRect = _render->m_scissor[view];
3902               viewHasScissor = !scissorRect.isZero();
3903               viewScissorRect = viewHasScissor ? scissorRect : rect;
3904
3905               GL_CHECK(glViewport(rect.m_x, height-rect.m_height-rect.m_y, rect.m_width, rect.m_height) );
3906
3907               Clear& clear = _render->m_clear[view];
3908
3909               if (BGFX_CLEAR_NONE != clear.m_flags)
3910               {
3911                  clearQuad(_clearQuad, rect, clear, height);
3912               }
3913
3914               GL_CHECK(glDisable(GL_STENCIL_TEST) );
3915               GL_CHECK(glEnable(GL_DEPTH_TEST) );
3916               GL_CHECK(glDepthFunc(GL_LESS) );
3917               GL_CHECK(glEnable(GL_CULL_FACE) );
3918               GL_CHECK(glDisable(GL_BLEND) );
3919            }
3920
3921            if (isCompute)
3922            {
3923               if (computeSupported)
3924               {
3925                  const RenderCompute& compute = renderItem.compute;
3926
3927                  ProgramGL& program = m_program[key.m_program];
3928                   GL_CHECK(glUseProgram(program.m_id) );
3929
3930                  GLbitfield barrier = 0;
3931                  for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii)
3932                  {
3933                     const ComputeBinding& bind = compute.m_bind[ii];
3934                     if (invalidHandle != bind.m_idx)
3935                     {
3936                        switch (bind.m_type)
3937                        {
3938                        case ComputeBinding::Image:
3939                           {
3940                              const TextureGL& texture = m_textures[bind.m_idx];
3941                              GL_CHECK(glBindImageTexture(ii, texture.m_id, bind.m_mip, GL_FALSE, 0, s_access[bind.m_access], s_imageFormat[bind.m_format]) );
3942                              barrier |= GL_SHADER_IMAGE_ACCESS_BARRIER_BIT;
3943                           }
3944                           break;
3945
3946                        case ComputeBinding::Buffer:
3947                           {
3948//                               const VertexBufferGL& vertexBuffer = m_vertexBuffers[bind.m_idx];
3949//                               GL_CHECK(glBindBufferBase(GL_SHADER_STORAGE_BUFFER, ii, vertexBuffer.m_id) );
3950//                               barrier |= GL_SHADER_STORAGE_BARRIER_BIT;
3951                           }
3952                           break;
3953                        }
3954                     }
3955                  }
3956
3957                  if (0 != barrier)
3958                  {
3959                     bool constantsChanged = compute.m_constBegin < compute.m_constEnd;
3960                     rendererUpdateUniforms(this, _render->m_constantBuffer, compute.m_constBegin, compute.m_constEnd);
3961
3962                     if (constantsChanged)
3963                     {
3964                        commit(*program.m_constantBuffer);
3965                     }
3966
3967                     GL_CHECK(glDispatchCompute(compute.m_numX, compute.m_numY, compute.m_numZ) );
3968                     GL_CHECK(glMemoryBarrier(barrier) );
3969                  }
3970               }
3971
3972               continue;
3973            }
3974
3975            const RenderDraw& draw = renderItem.draw;
3976
3977            const uint64_t newFlags = draw.m_flags;
3978            uint64_t changedFlags = currentState.m_flags ^ draw.m_flags;
3979            currentState.m_flags = newFlags;
3980
3981            const uint64_t newStencil = draw.m_stencil;
3982            uint64_t changedStencil = currentState.m_stencil ^ draw.m_stencil;
3983            currentState.m_stencil = newStencil;
3984
3985            if (viewChanged)
3986            {
3987               currentState.clear();
3988               currentState.m_scissor = !draw.m_scissor;
3989               changedFlags = BGFX_STATE_MASK;
3990               changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK);
3991               currentState.m_flags = newFlags;
3992               currentState.m_stencil = newStencil;
3993            }
3994
3995            uint16_t scissor = draw.m_scissor;
3996            if (currentState.m_scissor != scissor)
3997            {
3998               currentState.m_scissor = scissor;
3999
4000               if (UINT16_MAX == scissor)
4001               {
4002                  if (viewHasScissor)
4003                  {
4004                     GL_CHECK(glEnable(GL_SCISSOR_TEST) );
4005                     GL_CHECK(glScissor(viewScissorRect.m_x, height-viewScissorRect.m_height-viewScissorRect.m_y, viewScissorRect.m_width, viewScissorRect.m_height) );
4006                  }
4007                  else
4008                  {
4009                     GL_CHECK(glDisable(GL_SCISSOR_TEST) );
4010                  }
4011               }
4012               else
4013               {
4014                  Rect scissorRect;
4015                  scissorRect.intersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]);
4016                  GL_CHECK(glEnable(GL_SCISSOR_TEST) );
4017                  GL_CHECK(glScissor(scissorRect.m_x, height-scissorRect.m_height-scissorRect.m_y, scissorRect.m_width, scissorRect.m_height) );
4018               }
4019            }
4020
4021            if (0 != changedStencil)
4022            {
4023               if (0 != newStencil)
4024               {
4025                  GL_CHECK(glEnable(GL_STENCIL_TEST) );
4026
4027                  uint32_t bstencil = unpackStencil(1, newStencil);
4028                  uint32_t frontAndBack = bstencil != BGFX_STENCIL_NONE && bstencil != unpackStencil(0, newStencil);
4029
4030//                   uint32_t bchanged = unpackStencil(1, changedStencil);
4031//                   if (BGFX_STENCIL_FUNC_RMASK_MASK & bchanged)
4032//                   {
4033//                      uint32_t wmask = (bstencil&BGFX_STENCIL_FUNC_RMASK_MASK)>>BGFX_STENCIL_FUNC_RMASK_SHIFT;
4034//                      GL_CHECK(glStencilMask(wmask) );
4035//                   }
4036
4037                  for (uint32_t ii = 0, num = frontAndBack+1; ii < num; ++ii)
4038                  {
4039                     uint32_t stencil = unpackStencil(ii, newStencil);
4040                     uint32_t changed = unpackStencil(ii, changedStencil);
4041                     GLenum face = s_stencilFace[frontAndBack+ii];
4042
4043                     if ( (BGFX_STENCIL_TEST_MASK|BGFX_STENCIL_FUNC_REF_MASK|BGFX_STENCIL_FUNC_RMASK_MASK) & changed)
4044                     {
4045                        GLint ref = (stencil&BGFX_STENCIL_FUNC_REF_MASK)>>BGFX_STENCIL_FUNC_REF_SHIFT;
4046                        GLint mask = (stencil&BGFX_STENCIL_FUNC_RMASK_MASK)>>BGFX_STENCIL_FUNC_RMASK_SHIFT;
4047                        uint32_t func = (stencil&BGFX_STENCIL_TEST_MASK)>>BGFX_STENCIL_TEST_SHIFT;
4048                        GL_CHECK(glStencilFuncSeparate(face, s_cmpFunc[func], ref, mask));
4049                     }
4050
4051                     if ( (BGFX_STENCIL_OP_FAIL_S_MASK|BGFX_STENCIL_OP_FAIL_Z_MASK|BGFX_STENCIL_OP_PASS_Z_MASK) & changed)
4052                     {
4053                        uint32_t sfail = (stencil&BGFX_STENCIL_OP_FAIL_S_MASK)>>BGFX_STENCIL_OP_FAIL_S_SHIFT;
4054                        uint32_t zfail = (stencil&BGFX_STENCIL_OP_FAIL_Z_MASK)>>BGFX_STENCIL_OP_FAIL_Z_SHIFT;
4055                        uint32_t zpass = (stencil&BGFX_STENCIL_OP_PASS_Z_MASK)>>BGFX_STENCIL_OP_PASS_Z_SHIFT;
4056                        GL_CHECK(glStencilOpSeparate(face, s_stencilOp[sfail], s_stencilOp[zfail], s_stencilOp[zpass]) );
4057                     }
4058                  }
4059               }
4060               else
4061               {
4062                  GL_CHECK(glDisable(GL_STENCIL_TEST) );
4063               }
4064            }
4065
4066            if ( (0
4067                | BGFX_STATE_CULL_MASK
4068                | BGFX_STATE_DEPTH_WRITE
4069                | BGFX_STATE_DEPTH_TEST_MASK
4070                | BGFX_STATE_RGB_WRITE
4071                | BGFX_STATE_ALPHA_WRITE
4072                | BGFX_STATE_BLEND_MASK
4073                | BGFX_STATE_BLEND_EQUATION_MASK
4074                | BGFX_STATE_ALPHA_REF_MASK
4075                | BGFX_STATE_PT_MASK
4076                | BGFX_STATE_POINT_SIZE_MASK
4077                | BGFX_STATE_MSAA
4078                ) & changedFlags)
4079            {
4080               if (BGFX_STATE_CULL_MASK & changedFlags)
4081               {
4082                  if (BGFX_STATE_CULL_CW & newFlags)
4083                  {
4084                     GL_CHECK(glEnable(GL_CULL_FACE) );
4085                     GL_CHECK(glCullFace(GL_BACK) );
4086                  }
4087                  else if (BGFX_STATE_CULL_CCW & newFlags)
4088                  {
4089                     GL_CHECK(glEnable(GL_CULL_FACE) );
4090                     GL_CHECK(glCullFace(GL_FRONT) );
4091                  }
4092                  else
4093                  {
4094                     GL_CHECK(glDisable(GL_CULL_FACE) );
4095                  }
4096               }
4097
4098               if (BGFX_STATE_DEPTH_WRITE & changedFlags)
4099               {
4100                  GL_CHECK(glDepthMask(!!(BGFX_STATE_DEPTH_WRITE & newFlags) ) );
4101               }
4102
4103               if (BGFX_STATE_DEPTH_TEST_MASK & changedFlags)
4104               {
4105                  uint32_t func = (newFlags&BGFX_STATE_DEPTH_TEST_MASK)>>BGFX_STATE_DEPTH_TEST_SHIFT;
4106
4107                  if (0 != func)
4108                  {
4109                     GL_CHECK(glEnable(GL_DEPTH_TEST) );
4110                     GL_CHECK(glDepthFunc(s_cmpFunc[func]) );
4111                  }
4112                  else
4113                  {
4114                     GL_CHECK(glDisable(GL_DEPTH_TEST) );
4115                  }
4116               }
4117
4118               if (BGFX_STATE_ALPHA_REF_MASK & changedFlags)
4119               {
4120                  uint32_t ref = (newFlags&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT;
4121                  alphaRef = ref/255.0f;
4122               }
4123
4124#if BGFX_CONFIG_RENDERER_OPENGL
4125               if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags)
4126               {
4127                  float pointSize = (float)(bx::uint32_max(1, (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) );
4128                  GL_CHECK(glPointSize(pointSize) );
4129               }
4130
4131               if (BGFX_STATE_MSAA & changedFlags)
4132               {
4133                  if (BGFX_STATE_MSAA & newFlags)
4134                  {
4135                     GL_CHECK(glEnable(GL_MULTISAMPLE) );
4136                  }
4137                  else
4138                  {
4139                     GL_CHECK(glDisable(GL_MULTISAMPLE) );
4140                  }
4141               }
4142#endif // BGFX_CONFIG_RENDERER_OPENGL
4143
4144               if ( (BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags)
4145               {
4146                  GLboolean alpha = !!(newFlags&BGFX_STATE_ALPHA_WRITE);
4147                  GLboolean rgb = !!(newFlags&BGFX_STATE_RGB_WRITE);
4148                  GL_CHECK(glColorMask(rgb, rgb, rgb, alpha) );
4149               }
4150
4151               if ( (BGFX_STATE_BLEND_MASK|BGFX_STATE_BLEND_EQUATION_MASK|BGFX_STATE_BLEND_INDEPENDENT) & changedFlags
4152               ||  blendFactor != draw.m_rgba)
4153               {
4154                  if ( (BGFX_STATE_BLEND_MASK|BGFX_STATE_BLEND_EQUATION_MASK|BGFX_STATE_BLEND_INDEPENDENT) & newFlags
4155                  ||  blendFactor != draw.m_rgba)
4156                  {
4157                     const bool enabled = !!(BGFX_STATE_BLEND_MASK & newFlags);
4158                     const bool independent = !!(BGFX_STATE_BLEND_INDEPENDENT & newFlags)
4159                        && blendIndependentSupported
4160                        ;
4161
4162                     const uint32_t blend    = uint32_t( (newFlags&BGFX_STATE_BLEND_MASK)>>BGFX_STATE_BLEND_SHIFT);
4163                     const uint32_t equation = uint32_t( (newFlags&BGFX_STATE_BLEND_EQUATION_MASK)>>BGFX_STATE_BLEND_EQUATION_SHIFT);
4164
4165                     const uint32_t srcRGB  = (blend    )&0xf;
4166                     const uint32_t dstRGB  = (blend>> 4)&0xf;
4167                     const uint32_t srcA    = (blend>> 8)&0xf;
4168                     const uint32_t dstA    = (blend>>12)&0xf;
4169
4170                     const uint32_t equRGB = (equation   )&0x7;
4171                     const uint32_t equA   = (equation>>3)&0x7;
4172
4173                     const uint32_t numRt = getNumRt();
4174
4175                     if (!BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL)
4176                     ||  1 >= numRt
4177                     ||  !independent)
4178                     {
4179                        if (enabled)
4180                        {
4181                           GL_CHECK(glEnable(GL_BLEND) );
4182                           GL_CHECK(glBlendFuncSeparate(s_blendFactor[srcRGB].m_src
4183                              , s_blendFactor[dstRGB].m_dst
4184                              , s_blendFactor[srcA].m_src
4185                              , s_blendFactor[dstA].m_dst
4186                              ) );
4187                           GL_CHECK(glBlendEquationSeparate(s_blendEquation[equRGB], s_blendEquation[equA]) );
4188
4189                           if ( (s_blendFactor[srcRGB].m_factor || s_blendFactor[dstRGB].m_factor)
4190                           &&  blendFactor != draw.m_rgba)
4191                           {
4192                              const uint32_t rgba = draw.m_rgba;
4193                              GLclampf rr = ( (rgba>>24)     )/255.0f;
4194                              GLclampf gg = ( (rgba>>16)&0xff)/255.0f;
4195                              GLclampf bb = ( (rgba>> 8)&0xff)/255.0f;
4196                              GLclampf aa = ( (rgba    )&0xff)/255.0f;
4197
4198                              GL_CHECK(glBlendColor(rr, gg, bb, aa) );
4199                           }
4200                        }
4201                        else
4202                        {
4203                           GL_CHECK(glDisable(GL_BLEND) );
4204                        }
4205                     }
4206                     else
4207                     {
4208                        if (enabled)
4209                        {
4210                           GL_CHECK(glEnablei(GL_BLEND, 0) );
4211                           GL_CHECK(glBlendFuncSeparatei(0
4212                              , s_blendFactor[srcRGB].m_src
4213                              , s_blendFactor[dstRGB].m_dst
4214                              , s_blendFactor[srcA].m_src
4215                              , s_blendFactor[dstA].m_dst
4216                              ) );
4217                           GL_CHECK(glBlendEquationSeparatei(0
4218                              , s_blendEquation[equRGB]
4219                              , s_blendEquation[equA]
4220                              ) );
4221                        }
4222                        else
4223                        {
4224                           GL_CHECK(glDisablei(GL_BLEND, 0) );
4225                        }
4226
4227                        for (uint32_t ii = 1, rgba = draw.m_rgba; ii < numRt; ++ii, rgba >>= 11)
4228                        {
4229                           if (0 != (rgba&0x7ff) )
4230                           {
4231                              const uint32_t src      = (rgba   )&0xf;
4232                              const uint32_t dst      = (rgba>>4)&0xf;
4233                              const uint32_t equation = (rgba>>8)&0x7;
4234                              GL_CHECK(glEnablei(GL_BLEND, ii) );
4235                              GL_CHECK(glBlendFunci(ii, s_blendFactor[src].m_src, s_blendFactor[dst].m_dst) );
4236                              GL_CHECK(glBlendEquationi(ii, s_blendEquation[equation]) );
4237                           }
4238                           else
4239                           {
4240                              GL_CHECK(glDisablei(GL_BLEND, ii) );
4241                           }
4242                        }
4243                     }
4244                  }
4245                  else
4246                  {
4247                     GL_CHECK(glDisable(GL_BLEND) );
4248                  }
4249
4250                  blendFactor = draw.m_rgba;
4251               }
4252
4253               const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : newFlags&BGFX_STATE_PT_MASK;
4254               primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
4255               prim = s_primInfo[primIndex];
4256            }
4257
4258            bool programChanged = false;
4259            bool constantsChanged = draw.m_constBegin < draw.m_constEnd;
4260            bool bindAttribs = false;
4261            rendererUpdateUniforms(this, _render->m_constantBuffer, draw.m_constBegin, draw.m_constEnd);
4262
4263            if (key.m_program != programIdx)
4264            {
4265               programIdx = key.m_program;
4266               GLuint id = invalidHandle == programIdx ? 0 : m_program[programIdx].m_id;
4267               GL_CHECK(glUseProgram(id) );
4268               programChanged =
4269                  constantsChanged =
4270                  bindAttribs = true;
4271            }
4272
4273            if (invalidHandle != programIdx)
4274            {
4275               ProgramGL& program = m_program[programIdx];
4276
4277               if (constantsChanged)
4278               {
4279                  commit(*program.m_constantBuffer);
4280               }
4281
4282               for (uint32_t ii = 0, num = program.m_numPredefined; ii < num; ++ii)
4283               {
4284                  PredefinedUniform& predefined = program.m_predefined[ii];
4285                  switch (predefined.m_type)
4286                  {
4287                  case PredefinedUniform::ViewRect:
4288                     {
4289                        float rect[4];
4290                        rect[0] = _render->m_rect[view].m_x;
4291                        rect[1] = _render->m_rect[view].m_y;
4292                        rect[2] = _render->m_rect[view].m_width;
4293                        rect[3] = _render->m_rect[view].m_height;
4294
4295                        GL_CHECK(glUniform4fv(predefined.m_loc
4296                           , 1
4297                           , &rect[0]
4298                        ) );
4299                     }
4300                     break;
4301
4302                  case PredefinedUniform::ViewTexel:
4303                     {
4304                        float rect[4];
4305                        rect[0] = 1.0f/float(_render->m_rect[view].m_width);
4306                        rect[1] = 1.0f/float(_render->m_rect[view].m_height);
4307
4308                        GL_CHECK(glUniform4fv(predefined.m_loc
4309                           , 1
4310                           , &rect[0]
4311                        ) );
4312                     }
4313                     break;
4314
4315                  case PredefinedUniform::View:
4316                     {
4317                        GL_CHECK(glUniformMatrix4fv(predefined.m_loc
4318                           , 1
4319                           , GL_FALSE
4320                           , _render->m_view[view].un.val
4321                           ) );
4322                     }
4323                     break;
4324
4325                  case PredefinedUniform::InvView:
4326                     {
4327                        if (view != invViewCached)
4328                        {
4329                           invViewCached = view;
4330                           bx::float4x4_inverse(&invView.un.f4x4, &_render->m_view[view].un.f4x4);
4331                        }
4332
4333                        GL_CHECK(glUniformMatrix4fv(predefined.m_loc
4334                           , 1
4335                           , GL_FALSE
4336                           , invView.un.val
4337                           ) );
4338                     }
4339                     break;
4340
4341                  case PredefinedUniform::Proj:
4342                     {
4343                        GL_CHECK(glUniformMatrix4fv(predefined.m_loc
4344                           , 1
4345                           , GL_FALSE
4346                           , _render->m_proj[view].un.val
4347                           ) );
4348                     }
4349                     break;
4350
4351                  case PredefinedUniform::InvProj:
4352                     {
4353                        if (view != invProjCached)
4354                        {
4355                           invProjCached = view;
4356                           bx::float4x4_inverse(&invProj.un.f4x4, &_render->m_proj[view].un.f4x4);
4357                        }
4358
4359                        GL_CHECK(glUniformMatrix4fv(predefined.m_loc
4360                           , 1
4361                           , GL_FALSE
4362                           , invProj.un.val
4363                           ) );
4364                     }
4365                     break;
4366
4367                  case PredefinedUniform::ViewProj:
4368                     {
4369                        GL_CHECK(glUniformMatrix4fv(predefined.m_loc
4370                           , 1
4371                           , GL_FALSE
4372                           , viewProj[view].un.val
4373                           ) );
4374                     }
4375                     break;
4376
4377                  case PredefinedUniform::InvViewProj:
4378                     {
4379                        if (view != invViewProjCached)
4380                        {
4381                           invViewProjCached = view;
4382                           bx::float4x4_inverse(&invViewProj.un.f4x4, &viewProj[view].un.f4x4);
4383                        }
4384
4385                        GL_CHECK(glUniformMatrix4fv(predefined.m_loc
4386                           , 1
4387                           , GL_FALSE
4388                           , invViewProj.un.val
4389                           ) );
4390                     }
4391                     break;
4392
4393                  case PredefinedUniform::Model:
4394                     {
4395                        const Matrix4& model = _render->m_matrixCache.m_cache[draw.m_matrix];
4396                        GL_CHECK(glUniformMatrix4fv(predefined.m_loc
4397                           , bx::uint32_min(predefined.m_count, draw.m_num)
4398                           , GL_FALSE
4399                           , model.un.val
4400                           ) );
4401                     }
4402                     break;
4403
4404                  case PredefinedUniform::ModelView:
4405                     {
4406                        Matrix4 modelView;
4407                        const Matrix4& model = _render->m_matrixCache.m_cache[draw.m_matrix];
4408                        bx::float4x4_mul(&modelView.un.f4x4, &model.un.f4x4, &_render->m_view[view].un.f4x4);
4409
4410                        GL_CHECK(glUniformMatrix4fv(predefined.m_loc
4411                           , 1
4412                           , GL_FALSE
4413                           , modelView.un.val
4414                           ) );
4415                     }
4416                     break;
4417
4418                  case PredefinedUniform::ModelViewProj:
4419                     {
4420                        Matrix4 modelViewProj;
4421                        const Matrix4& model = _render->m_matrixCache.m_cache[draw.m_matrix];
4422                        bx::float4x4_mul(&modelViewProj.un.f4x4, &model.un.f4x4, &viewProj[view].un.f4x4);
4423
4424                        GL_CHECK(glUniformMatrix4fv(predefined.m_loc
4425                           , 1
4426                           , GL_FALSE
4427                           , modelViewProj.un.val
4428                           ) );
4429                     }
4430                     break;
4431
4432                  case PredefinedUniform::AlphaRef:
4433                     {
4434                        GL_CHECK(glUniform1f(predefined.m_loc, alphaRef) );
4435                     }
4436                     break;
4437
4438                  case PredefinedUniform::Count:
4439                     break;
4440                  }
4441               }
4442
4443               {
4444                  for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
4445                  {
4446                     const Sampler& sampler = draw.m_sampler[stage];
4447                     Sampler& current = currentState.m_sampler[stage];
4448                     if (current.m_idx != sampler.m_idx
4449                     ||  current.m_flags != sampler.m_flags
4450                     ||  programChanged)
4451                     {
4452                        if (invalidHandle != sampler.m_idx)
4453                        {
4454                           TextureGL& texture = m_textures[sampler.m_idx];
4455                           texture.commit(stage, sampler.m_flags);
4456                        }
4457                     }
4458
4459                     current = sampler;
4460                  }
4461               }
4462
4463               if (0 != defaultVao
4464               &&  0 == draw.m_startVertex
4465               &&  0 == draw.m_instanceDataOffset)
4466               {
4467                  if (programChanged
4468                  ||  currentState.m_vertexBuffer.idx != draw.m_vertexBuffer.idx
4469                  ||  currentState.m_indexBuffer.idx != draw.m_indexBuffer.idx
4470                  ||  currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx
4471                  ||  currentState.m_instanceDataOffset != draw.m_instanceDataOffset
4472                  ||  currentState.m_instanceDataStride != draw.m_instanceDataStride)
4473                  {
4474                     bx::HashMurmur2A murmur;
4475                     murmur.begin();
4476                     murmur.add(draw.m_vertexBuffer.idx);
4477                     murmur.add(draw.m_indexBuffer.idx);
4478                     murmur.add(draw.m_instanceDataBuffer.idx);
4479                     murmur.add(draw.m_instanceDataOffset);
4480                     murmur.add(draw.m_instanceDataStride);
4481                     murmur.add(programIdx);
4482                     uint32_t hash = murmur.end();
4483
4484                     currentState.m_vertexBuffer = draw.m_vertexBuffer;
4485                     currentState.m_indexBuffer = draw.m_indexBuffer;
4486                     currentState.m_instanceDataOffset = draw.m_instanceDataOffset;
4487                     currentState.m_instanceDataStride = draw.m_instanceDataStride;
4488                     baseVertex = draw.m_startVertex;
4489
4490                     GLuint id = m_vaoStateCache.find(hash);
4491                     if (UINT32_MAX != id)
4492                     {
4493                        currentVao = id;
4494                        GL_CHECK(glBindVertexArray(id) );
4495                     }
4496                     else
4497                     {
4498                        id = m_vaoStateCache.add(hash);
4499                        currentVao = id;
4500                        GL_CHECK(glBindVertexArray(id) );
4501
4502                        ProgramGL& program = m_program[programIdx];
4503                        program.add(hash);
4504
4505                        if (isValid(draw.m_vertexBuffer) )
4506                        {
4507                           VertexBufferGL& vb = m_vertexBuffers[draw.m_vertexBuffer.idx];
4508                           vb.add(hash);
4509                           GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) );
4510
4511                           uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx;
4512                           program.bindAttributes(m_vertexDecls[decl], draw.m_startVertex);
4513
4514                           if (isValid(draw.m_instanceDataBuffer) )
4515                           {
4516                              VertexBufferGL& instanceVb = m_vertexBuffers[draw.m_instanceDataBuffer.idx];
4517                              instanceVb.add(hash);
4518                              GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, instanceVb.m_id) );
4519                              program.bindInstanceData(draw.m_instanceDataStride, draw.m_instanceDataOffset);
4520                           }
4521                        }
4522                        else
4523                        {
4524                           GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0) );
4525                        }
4526
4527                        if (isValid(draw.m_indexBuffer) )
4528                        {
4529                           IndexBufferGL& ib = m_indexBuffers[draw.m_indexBuffer.idx];
4530                           ib.add(hash);
4531                           GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ib.m_id) );
4532                        }
4533                        else
4534                        {
4535                           GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) );
4536                        }
4537                     }
4538                  }
4539               }
4540               else
4541               {
4542                  if (0 != defaultVao
4543                  &&  0 != currentVao)
4544                  {
4545                     GL_CHECK(glBindVertexArray(defaultVao) );
4546                     currentState.m_vertexBuffer.idx = invalidHandle;
4547                     currentState.m_indexBuffer.idx = invalidHandle;
4548                     bindAttribs = true;
4549                     currentVao = 0;
4550                  }
4551
4552                  if (programChanged
4553                  ||  currentState.m_vertexBuffer.idx != draw.m_vertexBuffer.idx
4554                  ||  currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx
4555                  ||  currentState.m_instanceDataOffset != draw.m_instanceDataOffset
4556                  ||  currentState.m_instanceDataStride != draw.m_instanceDataStride)
4557                  {
4558                     currentState.m_vertexBuffer = draw.m_vertexBuffer;
4559                     currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx;
4560                     currentState.m_instanceDataOffset = draw.m_instanceDataOffset;
4561                     currentState.m_instanceDataStride = draw.m_instanceDataStride;
4562
4563                     uint16_t handle = draw.m_vertexBuffer.idx;
4564                     if (invalidHandle != handle)
4565                     {
4566                        VertexBufferGL& vb = m_vertexBuffers[handle];
4567                        GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, vb.m_id) );
4568                        bindAttribs = true;
4569                     }
4570                     else
4571                     {
4572                        GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0) );
4573                     }
4574                  }
4575
4576                  if (currentState.m_indexBuffer.idx != draw.m_indexBuffer.idx)
4577                  {
4578                     currentState.m_indexBuffer = draw.m_indexBuffer;
4579
4580                     uint16_t handle = draw.m_indexBuffer.idx;
4581                     if (invalidHandle != handle)
4582                     {
4583                        IndexBufferGL& ib = m_indexBuffers[handle];
4584                        GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ib.m_id) );
4585                     }
4586                     else
4587                     {
4588                        GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) );
4589                     }
4590                  }
4591
4592                  if (isValid(currentState.m_vertexBuffer) )
4593                  {
4594                     if (baseVertex != draw.m_startVertex
4595                     ||  bindAttribs)
4596                     {
4597                        baseVertex = draw.m_startVertex;
4598                        const VertexBufferGL& vb = m_vertexBuffers[draw.m_vertexBuffer.idx];
4599                        uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx;
4600                        const ProgramGL& program = m_program[programIdx];
4601                        program.bindAttributes(m_vertexDecls[decl], draw.m_startVertex);
4602
4603                        if (isValid(draw.m_instanceDataBuffer) )
4604                        {
4605                           GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffers[draw.m_instanceDataBuffer.idx].m_id) );
4606                           program.bindInstanceData(draw.m_instanceDataStride, draw.m_instanceDataOffset);
4607                        }
4608                     }
4609                  }
4610               }
4611
4612               if (isValid(currentState.m_vertexBuffer) )
4613               {
4614                  uint32_t numVertices = draw.m_numVertices;
4615                  if (UINT32_MAX == numVertices)
4616                  {
4617                     const VertexBufferGL& vb = m_vertexBuffers[currentState.m_vertexBuffer.idx];
4618                     uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx;
4619                     const VertexDecl& vertexDecl = m_vertexDecls[decl];
4620                     numVertices = vb.m_size/vertexDecl.m_stride;
4621                  }
4622
4623                  uint32_t numIndices = 0;
4624                  uint32_t numPrimsSubmitted = 0;
4625                  uint32_t numInstances = 0;
4626                  uint32_t numPrimsRendered = 0;
4627
4628                  if (isValid(draw.m_indexBuffer) )
4629                  {
4630                     if (UINT32_MAX == draw.m_numIndices)
4631                     {
4632                        numIndices = m_indexBuffers[draw.m_indexBuffer.idx].m_size/2;
4633                        numPrimsSubmitted = numIndices/prim.m_div - prim.m_sub;
4634                        numInstances = draw.m_numInstances;
4635                        numPrimsRendered = numPrimsSubmitted*draw.m_numInstances;
4636
4637                        GL_CHECK(glDrawElementsInstanced(prim.m_type
4638                           , numIndices
4639                           , GL_UNSIGNED_SHORT
4640                           , (void*)0
4641                           , draw.m_numInstances
4642                           ) );
4643                     }
4644                     else if (prim.m_min <= draw.m_numIndices)
4645                     {
4646                        numIndices = draw.m_numIndices;
4647                        numPrimsSubmitted = numIndices/prim.m_div - prim.m_sub;
4648                        numInstances = draw.m_numInstances;
4649                        numPrimsRendered = numPrimsSubmitted*draw.m_numInstances;
4650
4651                        GL_CHECK(glDrawElementsInstanced(prim.m_type
4652                           , numIndices
4653                           , GL_UNSIGNED_SHORT
4654                           , (void*)(uintptr_t)(draw.m_startIndex*2)
4655                           , draw.m_numInstances
4656                           ) );
4657                     }
4658                  }
4659                  else
4660                  {
4661                     numPrimsSubmitted = numVertices/prim.m_div - prim.m_sub;
4662                     numInstances = draw.m_numInstances;
4663                     numPrimsRendered = numPrimsSubmitted*draw.m_numInstances;
4664
4665                     GL_CHECK(glDrawArraysInstanced(prim.m_type
4666                        , 0
4667                        , numVertices
4668                        , draw.m_numInstances
4669                        ) );
4670                  }
4671
4672                  statsNumPrimsSubmitted[primIndex] += numPrimsSubmitted;
4673                  statsNumPrimsRendered[primIndex]  += numPrimsRendered;
4674                  statsNumInstances[primIndex]      += numInstances;
4675                  statsNumIndices += numIndices;
4676               }
4677            }
4678         }
4679
4680         blitMsaaFbo();
4681
4682         if (0 < _render->m_num)
4683         {
4684            captureElapsed = -bx::getHPCounter();
4685            capture();
4686            captureElapsed += bx::getHPCounter();
4687         }
4688      }
4689
4690      int64_t now = bx::getHPCounter();
4691      elapsed += now;
4692
4693      static int64_t last = now;
4694      int64_t frameTime = now - last;
4695      last = now;
4696
4697      static int64_t min = frameTime;
4698      static int64_t max = frameTime;
4699      min = min > frameTime ? frameTime : min;
4700      max = max < frameTime ? frameTime : max;
4701
4702      if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
4703      {
4704         double elapsedGpuMs = 0.0;
4705#if BGFX_CONFIG_RENDERER_OPENGL
4706         m_queries.end(GL_TIME_ELAPSED);
4707         uint64_t elapsedGl = m_queries.getResult(0);
4708         elapsedGpuMs = double(elapsedGl)/1e6;
4709#endif // BGFX_CONFIG_RENDERER_OPENGL
4710
4711         TextVideoMem& tvm = m_textVideoMem;
4712
4713         static int64_t next = now;
4714
4715         if (now >= next)
4716         {
4717            next = now + bx::getHPFrequency();
4718            double freq = double(bx::getHPFrequency() );
4719            double toMs = 1000.0/freq;
4720
4721            tvm.clear();
4722            uint16_t pos = 0;
4723            tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x89 : 0x8f, " %s / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " "
4724               , getRendererName()
4725               );
4726            tvm.printf(0, pos++, 0x0f, "      Vendor: %s", m_vendor);
4727            tvm.printf(0, pos++, 0x0f, "    Renderer: %s", m_renderer);
4728            tvm.printf(0, pos++, 0x0f, "     Version: %s", m_version);
4729            tvm.printf(0, pos++, 0x0f, "GLSL version: %s", m_glslVersion);
4730
4731            pos = 10;
4732            tvm.printf(10, pos++, 0x8e, "      Frame CPU: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS "
4733               , double(frameTime)*toMs
4734               , double(min)*toMs
4735               , double(max)*toMs
4736               , freq/frameTime
4737               );
4738
4739            const uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT;
4740            tvm.printf(10, pos++, 0x8e, "    Reset flags: [%c] vsync, [%c] MSAAx%d "
4741               , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' '
4742               , 0 != msaa ? '\xfe' : ' '
4743               , 1<<msaa
4744               );
4745
4746            double elapsedCpuMs = double(elapsed)*toMs;
4747            tvm.printf(10, pos++, 0x8e, " Draw calls: %4d / CPU %3.4f [ms] %c GPU %3.4f [ms]"
4748               , _render->m_num
4749               , elapsedCpuMs
4750               , elapsedCpuMs > elapsedGpuMs ? '>' : '<'
4751               , elapsedGpuMs
4752               );
4753            for (uint32_t ii = 0; ii < BX_COUNTOF(s_primInfo); ++ii)
4754            {
4755               tvm.printf(10, pos++, 0x8e, "   %8s: %7d (#inst: %5d), submitted: %7d"
4756                  , s_primName[ii]
4757                  , statsNumPrimsRendered[ii]
4758                  , statsNumInstances[ii]
4759                  , statsNumPrimsSubmitted[ii]
4760                  );
4761            }
4762
4763            tvm.printf(10, pos++, 0x8e, "    Indices: %7d", statsNumIndices);
4764            tvm.printf(10, pos++, 0x8e, "   DVB size: %7d", _render->m_vboffset);
4765            tvm.printf(10, pos++, 0x8e, "   DIB size: %7d", _render->m_iboffset);
4766
4767            double captureMs = double(captureElapsed)*toMs;
4768            tvm.printf(10, pos++, 0x8e, "    Capture: %3.4f [ms]", captureMs);
4769
4770#if BGFX_CONFIG_RENDERER_OPENGL
4771            if (s_extension[Extension::ATI_meminfo].m_supported)
4772            {
4773               GLint vboFree[4];
4774               GL_CHECK(glGetIntegerv(GL_VBO_FREE_MEMORY_ATI, vboFree) );
4775
4776               GLint texFree[4];
4777               GL_CHECK(glGetIntegerv(GL_TEXTURE_FREE_MEMORY_ATI, texFree) );
4778
4779               GLint rbfFree[4];
4780               GL_CHECK(glGetIntegerv(GL_RENDERBUFFER_FREE_MEMORY_ATI, rbfFree) );
4781
4782               pos++;
4783               tvm.printf(10, pos++, 0x8c, " -------------|    free|  free b|     aux|  aux fb");
4784               tvm.printf(10, pos++, 0x8e, "           VBO: %7d, %7d, %7d, %7d", vboFree[0], vboFree[1], vboFree[2], vboFree[3]);
4785               tvm.printf(10, pos++, 0x8e, "       Texture: %7d, %7d, %7d, %7d", texFree[0], texFree[1], texFree[2], texFree[3]);
4786               tvm.printf(10, pos++, 0x8e, " Render Buffer: %7d, %7d, %7d, %7d", rbfFree[0], rbfFree[1], rbfFree[2], rbfFree[3]);
4787            }
4788            else if (s_extension[Extension::NVX_gpu_memory_info].m_supported)
4789            {
4790               GLint dedicated;
4791               GL_CHECK(glGetIntegerv(GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX, &dedicated) );
4792
4793               GLint totalAvail;
4794               GL_CHECK(glGetIntegerv(GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX, &totalAvail) );
4795
4796               GLint currAvail;
4797               GL_CHECK(glGetIntegerv(GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX, &currAvail) );
4798
4799               GLint evictedCount;
4800               GL_CHECK(glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX, &evictedCount) );
4801
4802               GLint evictedMemory;
4803               GL_CHECK(glGetIntegerv(GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX, &evictedMemory) );
4804
4805               pos++;
4806               tvm.printf(10, pos++, 0x8c, "----------|");
4807               tvm.printf(10, pos++, 0x8e, " Dedicated: %7d", dedicated);
4808               tvm.printf(10, pos++, 0x8e, " Available: %7d (%7d)", currAvail, totalAvail);
4809               tvm.printf(10, pos++, 0x8e, "  Eviction: %7d / %7d", evictedCount, evictedMemory);
4810            }
4811#endif // BGFX_CONFIG_RENDERER_OPENGL
4812
4813            uint8_t attr[2] = { 0x89, 0x8a };
4814            uint8_t attrIndex = _render->m_waitSubmit < _render->m_waitRender;
4815
4816            pos++;
4817            tvm.printf(10, pos++, attr[attrIndex&1], "Submit wait: %3.4f [ms]", double(_render->m_waitSubmit)*toMs);
4818            tvm.printf(10, pos++, attr[(attrIndex+1)&1], "Render wait: %3.4f [ms]", double(_render->m_waitRender)*toMs);
4819
4820            min = frameTime;
4821            max = frameTime;
4822         }
4823
4824         blit(this, _textVideoMemBlitter, tvm);
4825      }
4826      else if (_render->m_debug & BGFX_DEBUG_TEXT)
4827      {
4828         blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
4829      }
4830
4831      GL_CHECK(glFrameTerminatorGREMEDY() );
4832   }
4833} // namespace bgfx
4834
4835#else
4836
4837namespace bgfx
4838{
4839   RendererContextI* rendererCreateGL()
4840   {
4841      return NULL;
4842   }
4843
4844   void rendererDestroyGL()
4845   {
4846   }
4847} // namespace bgfx
4848
4849#endif // (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
Property changes on: branches/osd/src/lib/bgfx/renderer_gl.cpp
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/fs_debugfont.sc
r0r31734
1$input v_color0, v_color1, v_texcoord0
2
3/*
4 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
5 * License: http://www.opensource.org/licenses/BSD-2-Clause
6 */
7
8#include "bgfx_shader.sh"
9
10SAMPLER2D(u_texColor, 0);
11
12void main()
13{
14   vec4 color = mix(v_color1, v_color0, texture2D(u_texColor, v_texcoord0).xxxx);
15   if (color.w < 1.0/255.0)
16   {
17      discard;
18   }
19   gl_FragColor = color;
20}
Property changes on: branches/osd/src/lib/bgfx/fs_debugfont.sc
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/renderer_d3d9.cpp
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7
8#if BGFX_CONFIG_RENDERER_DIRECT3D9
9#   include "renderer_d3d9.h"
10
11namespace bgfx
12{
13   static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][256];
14
15   struct PrimInfo
16   {
17      D3DPRIMITIVETYPE m_type;
18      uint32_t m_min;
19      uint32_t m_div;
20      uint32_t m_sub;
21   };
22
23   static const PrimInfo s_primInfo[] =
24   {
25      { D3DPT_TRIANGLELIST,  3, 3, 0 },
26      { D3DPT_TRIANGLESTRIP, 3, 1, 2 },
27      { D3DPT_LINELIST,      2, 2, 0 },
28      { D3DPT_POINTLIST,     1, 1, 0 },
29   };
30
31   static const char* s_primName[] =
32   {
33      "TriList",
34      "TriStrip",
35      "Line",
36      "Point",
37   };
38
39   static const D3DMULTISAMPLE_TYPE s_checkMsaa[] =
40   {
41      D3DMULTISAMPLE_NONE,
42      D3DMULTISAMPLE_2_SAMPLES,
43      D3DMULTISAMPLE_4_SAMPLES,
44      D3DMULTISAMPLE_8_SAMPLES,
45      D3DMULTISAMPLE_16_SAMPLES,
46   };
47
48   static Msaa s_msaa[] =
49   {
50      { D3DMULTISAMPLE_NONE,       0 },
51      { D3DMULTISAMPLE_2_SAMPLES,  0 },
52      { D3DMULTISAMPLE_4_SAMPLES,  0 },
53      { D3DMULTISAMPLE_8_SAMPLES,  0 },
54      { D3DMULTISAMPLE_16_SAMPLES, 0 },
55   };
56
57   struct Blend
58   {
59      D3DBLEND m_src;
60      D3DBLEND m_dst;
61      bool m_factor;
62   };
63
64   static const Blend s_blendFactor[] =
65   {
66      { (D3DBLEND)0,             (D3DBLEND)0,             false }, // ignored
67      { D3DBLEND_ZERO,           D3DBLEND_ZERO,           false }, // ZERO
68      { D3DBLEND_ONE,            D3DBLEND_ONE,            false }, // ONE
69      { D3DBLEND_SRCCOLOR,       D3DBLEND_SRCCOLOR,       false }, // SRC_COLOR
70      { D3DBLEND_INVSRCCOLOR,    D3DBLEND_INVSRCCOLOR,    false }, // INV_SRC_COLOR
71      { D3DBLEND_SRCALPHA,       D3DBLEND_SRCALPHA,       false }, // SRC_ALPHA
72      { D3DBLEND_INVSRCALPHA,    D3DBLEND_INVSRCALPHA,    false }, // INV_SRC_ALPHA
73      { D3DBLEND_DESTALPHA,      D3DBLEND_DESTALPHA,      false }, // DST_ALPHA
74      { D3DBLEND_INVDESTALPHA,   D3DBLEND_INVDESTALPHA,   false }, // INV_DST_ALPHA
75      { D3DBLEND_DESTCOLOR,      D3DBLEND_DESTCOLOR,      false }, // DST_COLOR
76      { D3DBLEND_INVDESTCOLOR,   D3DBLEND_INVDESTCOLOR,   false }, // INV_DST_COLOR
77      { D3DBLEND_SRCALPHASAT,    D3DBLEND_ONE,            false }, // SRC_ALPHA_SAT
78      { D3DBLEND_BLENDFACTOR,    D3DBLEND_BLENDFACTOR,    true  }, // FACTOR
79      { D3DBLEND_INVBLENDFACTOR, D3DBLEND_INVBLENDFACTOR, true  }, // INV_FACTOR
80   };
81
82   static const D3DBLENDOP s_blendEquation[] =
83   {
84      D3DBLENDOP_ADD,
85      D3DBLENDOP_SUBTRACT,
86      D3DBLENDOP_REVSUBTRACT,
87      D3DBLENDOP_MIN,
88      D3DBLENDOP_MAX,
89   };
90
91   static const D3DCMPFUNC s_cmpFunc[] =
92   {
93      (D3DCMPFUNC)0, // ignored
94      D3DCMP_LESS,
95      D3DCMP_LESSEQUAL,
96      D3DCMP_EQUAL,
97      D3DCMP_GREATEREQUAL,
98      D3DCMP_GREATER,
99      D3DCMP_NOTEQUAL,
100      D3DCMP_NEVER,
101      D3DCMP_ALWAYS,
102   };
103
104   static const D3DSTENCILOP s_stencilOp[] =
105   {
106      D3DSTENCILOP_ZERO,
107      D3DSTENCILOP_KEEP,
108      D3DSTENCILOP_REPLACE,
109      D3DSTENCILOP_INCR,
110      D3DSTENCILOP_INCRSAT,
111      D3DSTENCILOP_DECR,
112      D3DSTENCILOP_DECRSAT,
113      D3DSTENCILOP_INVERT,
114   };
115
116   static const D3DRENDERSTATETYPE s_stencilFuncRs[] =
117   {
118      D3DRS_STENCILFUNC,
119      D3DRS_CCW_STENCILFUNC,
120   };
121
122   static const D3DRENDERSTATETYPE s_stencilFailRs[] =
123   {
124      D3DRS_STENCILFAIL,
125      D3DRS_CCW_STENCILFAIL,
126   };
127
128   static const D3DRENDERSTATETYPE s_stencilZFailRs[] =
129   {
130      D3DRS_STENCILZFAIL,
131      D3DRS_CCW_STENCILZFAIL,
132   };
133
134   static const D3DRENDERSTATETYPE s_stencilZPassRs[] =
135   {
136      D3DRS_STENCILPASS,
137      D3DRS_CCW_STENCILPASS,
138   };
139
140   static const D3DCULL s_cullMode[] =
141   {
142      D3DCULL_NONE,
143      D3DCULL_CW,
144      D3DCULL_CCW,
145   };
146
147   static const D3DFORMAT s_checkColorFormats[] =
148   {
149      D3DFMT_UNKNOWN,
150      D3DFMT_A8R8G8B8, D3DFMT_UNKNOWN,
151      D3DFMT_R32F, D3DFMT_R16F, D3DFMT_G16R16, D3DFMT_A8R8G8B8, D3DFMT_UNKNOWN,
152
153      D3DFMT_UNKNOWN, // terminator
154   };
155
156   static D3DFORMAT s_colorFormat[] =
157   {
158      D3DFMT_UNKNOWN, // ignored
159      D3DFMT_A8R8G8B8,
160      D3DFMT_A2B10G10R10,
161      D3DFMT_A16B16G16R16,
162      D3DFMT_A16B16G16R16F,
163      D3DFMT_R16F,
164      D3DFMT_R32F,
165   };
166
167   static const D3DTEXTUREADDRESS s_textureAddress[] =
168   {
169      D3DTADDRESS_WRAP,
170      D3DTADDRESS_MIRROR,
171      D3DTADDRESS_CLAMP,
172   };
173
174   static const D3DTEXTUREFILTERTYPE s_textureFilter[] =
175   {
176      D3DTEXF_LINEAR,
177      D3DTEXF_POINT,
178      D3DTEXF_ANISOTROPIC,
179   };
180
181   struct TextureFormatInfo
182   {
183      D3DFORMAT m_fmt;
184   };
185
186   static TextureFormatInfo s_textureFormat[] =
187   {
188      { D3DFMT_DXT1          }, // BC1
189      { D3DFMT_DXT3          }, // BC2
190      { D3DFMT_DXT5          }, // BC3
191      { D3DFMT_UNKNOWN       }, // BC4
192      { D3DFMT_UNKNOWN       }, // BC5
193      { D3DFMT_UNKNOWN       }, // BC6H
194      { D3DFMT_UNKNOWN       }, // BC7
195      { D3DFMT_UNKNOWN       }, // ETC1
196      { D3DFMT_UNKNOWN       }, // ETC2
197      { D3DFMT_UNKNOWN       }, // ETC2A
198      { D3DFMT_UNKNOWN       }, // ETC2A1
199      { D3DFMT_UNKNOWN       }, // PTC12
200      { D3DFMT_UNKNOWN       }, // PTC14
201      { D3DFMT_UNKNOWN       }, // PTC12A
202      { D3DFMT_UNKNOWN       }, // PTC14A
203      { D3DFMT_UNKNOWN       }, // PTC22
204      { D3DFMT_UNKNOWN       }, // PTC24
205      { D3DFMT_UNKNOWN       }, // Unknown
206      { D3DFMT_A1            }, // R1
207      { D3DFMT_L8            }, // R8
208      { D3DFMT_G16R16        }, // R16
209      { D3DFMT_R16F          }, // R16F
210      { D3DFMT_UNKNOWN       }, // R32
211      { D3DFMT_R32F          }, // R32F
212      { D3DFMT_A8L8          }, // RG8
213      { D3DFMT_G16R16        }, // RG16
214      { D3DFMT_G16R16F       }, // RG16F
215      { D3DFMT_UNKNOWN       }, // RG32
216      { D3DFMT_G32R32F       }, // RG32F
217      { D3DFMT_A8R8G8B8      }, // BGRA8
218      { D3DFMT_A16B16G16R16  }, // RGBA16
219      { D3DFMT_A16B16G16R16F }, // RGBA16F
220      { D3DFMT_UNKNOWN       }, // RGBA32
221      { D3DFMT_A32B32G32R32F }, // RGBA32F
222      { D3DFMT_R5G6B5        }, // R5G6B5
223      { D3DFMT_A4R4G4B4      }, // RGBA4
224      { D3DFMT_A1R5G5B5      }, // RGB5A1
225      { D3DFMT_A2B10G10R10   }, // RGB10A2
226      { D3DFMT_UNKNOWN       }, // UnknownDepth
227      { D3DFMT_D16           }, // D16 
228      { D3DFMT_D24X8         }, // D24 
229      { D3DFMT_D24S8         }, // D24S8
230      { D3DFMT_D32           }, // D32 
231      { D3DFMT_DF16          }, // D16F
232      { D3DFMT_DF24          }, // D24F
233      { D3DFMT_D32F_LOCKABLE }, // D32F
234      { D3DFMT_S8_LOCKABLE   }, // D0S8
235   };
236   BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) );
237
238   static ExtendedFormat s_extendedFormats[ExtendedFormat::Count] =
239   {
240      { D3DFMT_ATI1, 0,                     D3DRTYPE_TEXTURE, false },
241      { D3DFMT_ATI2, 0,                     D3DRTYPE_TEXTURE, false },
242      { D3DFMT_DF16, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, false },
243      { D3DFMT_DF24, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, false },
244      { D3DFMT_INST, 0,                     D3DRTYPE_SURFACE, false },
245      { D3DFMT_INTZ, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, false },
246      { D3DFMT_NULL, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, false },
247      { D3DFMT_RESZ, D3DUSAGE_RENDERTARGET, D3DRTYPE_SURFACE, false },
248      { D3DFMT_RAWZ, D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, false },
249   };
250
251   static const GUID IID_IDirect3D9         = { 0x81bdcbca, 0x64d4, 0x426d, { 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c } };
252   static const GUID IID_IDirect3DDevice9Ex = { 0xb18b10ce, 0x2649, 0x405a, { 0x87, 0xf, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a } };
253
254   struct RendererContextD3D9 : public RendererContextI
255   {
256      RendererContextD3D9()
257         : m_d3d9(NULL)
258         , m_device(NULL)
259         , m_backBufferColor(NULL)
260         , m_backBufferDepthStencil(NULL)
261         , m_captureTexture(NULL)
262         , m_captureSurface(NULL)
263         , m_captureResolve(NULL)
264         , m_flags(BGFX_RESET_NONE)
265         , m_initialized(false)
266         , m_amd(false)
267         , m_nvidia(false)
268         , m_instancing(false)
269         , m_rtMsaa(false)
270      {
271         m_fbh.idx = invalidHandle;
272         memset(m_uniforms, 0, sizeof(m_uniforms) );
273         memset(&m_resolution, 0, sizeof(m_resolution) );
274
275         D3DFORMAT adapterFormat = D3DFMT_X8R8G8B8;
276
277         // http://msdn.microsoft.com/en-us/library/windows/desktop/bb172588%28v=vs.85%29.aspx
278         memset(&m_params, 0, sizeof(m_params) );
279         m_params.BackBufferWidth = BGFX_DEFAULT_WIDTH;
280         m_params.BackBufferHeight = BGFX_DEFAULT_HEIGHT;
281         m_params.BackBufferFormat = adapterFormat;
282         m_params.BackBufferCount = 1;
283         m_params.MultiSampleType = D3DMULTISAMPLE_NONE;
284         m_params.MultiSampleQuality = 0;
285         m_params.EnableAutoDepthStencil = TRUE;
286         m_params.AutoDepthStencilFormat = D3DFMT_D24S8;
287         m_params.Flags = D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL;
288#if BX_PLATFORM_WINDOWS
289         m_params.FullScreen_RefreshRateInHz = 0;
290         m_params.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
291         m_params.SwapEffect = D3DSWAPEFFECT_DISCARD;
292         m_params.hDeviceWindow = g_bgfxHwnd;
293         m_params.Windowed = true;
294
295         RECT rect;
296         GetWindowRect(g_bgfxHwnd, &rect);
297         m_params.BackBufferWidth = rect.right-rect.left;
298         m_params.BackBufferHeight = rect.bottom-rect.top;
299
300         m_d3d9dll = bx::dlopen("d3d9.dll");
301         BGFX_FATAL(NULL != m_d3d9dll, Fatal::UnableToInitialize, "Failed to load d3d9.dll.");
302
303#if BGFX_CONFIG_DEBUG_PIX
304         m_D3DPERF_SetMarker = (D3DPERF_SetMarkerFunc)bx::dlsym(m_d3d9dll, "D3DPERF_SetMarker");
305         m_D3DPERF_BeginEvent = (D3DPERF_BeginEventFunc)bx::dlsym(m_d3d9dll, "D3DPERF_BeginEvent");
306         m_D3DPERF_EndEvent = (D3DPERF_EndEventFunc)bx::dlsym(m_d3d9dll, "D3DPERF_EndEvent");
307
308         BX_CHECK(NULL != m_D3DPERF_SetMarker
309              && NULL != m_D3DPERF_BeginEvent
310              && NULL != m_D3DPERF_EndEvent
311              , "Failed to initialize PIX events."
312              );
313#endif // BGFX_CONFIG_DEBUG_PIX
314
315#if BGFX_CONFIG_RENDERER_DIRECT3D9EX
316         m_d3d9ex = NULL;
317
318         Direct3DCreate9ExFn direct3DCreate9Ex = (Direct3DCreate9ExFn)bx::dlsym(m_d3d9dll, "Direct3DCreate9Ex");
319         if (NULL != direct3DCreate9Ex)
320         {
321            direct3DCreate9Ex(D3D_SDK_VERSION, &m_d3d9ex);
322            DX_CHECK(m_d3d9ex->QueryInterface(IID_IDirect3D9, (void**)&m_d3d9) );
323            m_pool = D3DPOOL_DEFAULT;
324         }
325         else
326#endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX
327         {
328            Direct3DCreate9Fn direct3DCreate9 = (Direct3DCreate9Fn)bx::dlsym(m_d3d9dll, "Direct3DCreate9");
329            BGFX_FATAL(NULL != direct3DCreate9, Fatal::UnableToInitialize, "Function Direct3DCreate9 not found.");
330            m_d3d9 = direct3DCreate9(D3D_SDK_VERSION);
331            m_pool = D3DPOOL_MANAGED;
332         }
333
334         BGFX_FATAL(m_d3d9, Fatal::UnableToInitialize, "Unable to create Direct3D.");
335
336         m_adapter = D3DADAPTER_DEFAULT;
337         m_deviceType = D3DDEVTYPE_HAL;
338
339         uint32_t adapterCount = m_d3d9->GetAdapterCount();
340         for (uint32_t ii = 0; ii < adapterCount; ++ii)
341         {
342            D3DADAPTER_IDENTIFIER9 identifier;
343            HRESULT hr = m_d3d9->GetAdapterIdentifier(ii, 0, &identifier);
344            if (SUCCEEDED(hr) )
345            {
346               BX_TRACE("Adapter #%d", ii);
347               BX_TRACE("\tDriver: %s", identifier.Driver);
348               BX_TRACE("\tDescription: %s", identifier.Description);
349               BX_TRACE("\tDeviceName: %s", identifier.DeviceName);
350               BX_TRACE("\tVendorId: 0x%08x, DeviceId: 0x%08x, SubSysId: 0x%08x, Revision: 0x%08x"
351                  , identifier.VendorId
352                  , identifier.DeviceId
353                  , identifier.SubSysId
354                  , identifier.Revision
355                  );
356
357#if BGFX_CONFIG_DEBUG_PERFHUD
358               if (0 != strstr(identifier.Description, "PerfHUD") )
359               {
360                  m_adapter = ii;
361                  m_deviceType = D3DDEVTYPE_REF;
362               }
363#endif // BGFX_CONFIG_DEBUG_PERFHUD
364            }
365         }
366
367         DX_CHECK(m_d3d9->GetAdapterIdentifier(m_adapter, 0, &m_identifier) );
368         m_amd = m_identifier.VendorId == 0x1002;
369         m_nvidia = m_identifier.VendorId == 0x10de;
370
371         uint32_t behaviorFlags[] =
372         {
373            D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_PUREDEVICE|D3DCREATE_FPU_PRESERVE,
374            D3DCREATE_MIXED_VERTEXPROCESSING|D3DCREATE_FPU_PRESERVE,
375            D3DCREATE_SOFTWARE_VERTEXPROCESSING|D3DCREATE_FPU_PRESERVE,
376         };
377
378         for (uint32_t ii = 0; ii < BX_COUNTOF(behaviorFlags) && NULL == m_device; ++ii)
379         {
380#if 0 // BGFX_CONFIG_RENDERER_DIRECT3D9EX
381            DX_CHECK(m_d3d9->CreateDeviceEx(m_adapter
382                  , m_deviceType
383                  , g_bgfxHwnd
384                  , behaviorFlags[ii]
385                  , &m_params
386                  , NULL
387                  , &m_device
388                  ) );
389#else
390            DX_CHECK(m_d3d9->CreateDevice(m_adapter
391               , m_deviceType
392               , g_bgfxHwnd
393               , behaviorFlags[ii]
394               , &m_params
395               , &m_device
396               ) );
397#endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX
398         }
399
400         BGFX_FATAL(m_device, Fatal::UnableToInitialize, "Unable to create Direct3D9 device.");
401
402#if BGFX_CONFIG_RENDERER_DIRECT3D9EX
403         if (NULL != m_d3d9ex)
404         {
405            DX_CHECK(m_device->QueryInterface(IID_IDirect3DDevice9Ex, (void**)&m_deviceEx) );
406         }
407#endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX
408
409         DX_CHECK(m_device->GetDeviceCaps(&m_caps) );
410
411         // For shit GPUs that can create DX9 device but can't do simple stuff. GTFO!
412         BGFX_FATAL( (D3DPTEXTURECAPS_SQUAREONLY & m_caps.TextureCaps) == 0, Fatal::MinimumRequiredSpecs, "D3DPTEXTURECAPS_SQUAREONLY");
413         BGFX_FATAL( (D3DPTEXTURECAPS_MIPMAP & m_caps.TextureCaps) == D3DPTEXTURECAPS_MIPMAP, Fatal::MinimumRequiredSpecs, "D3DPTEXTURECAPS_MIPMAP");
414         BGFX_FATAL( (D3DPTEXTURECAPS_ALPHA & m_caps.TextureCaps) == D3DPTEXTURECAPS_ALPHA, Fatal::MinimumRequiredSpecs, "D3DPTEXTURECAPS_ALPHA");
415         BGFX_FATAL(m_caps.VertexShaderVersion >= D3DVS_VERSION(2, 0) && m_caps.PixelShaderVersion >= D3DPS_VERSION(2, 1)
416                 , Fatal::MinimumRequiredSpecs
417                 , "Shader Model Version (vs: %x, ps: %x)."
418                 , m_caps.VertexShaderVersion
419                 , m_caps.PixelShaderVersion
420                 );
421         BX_TRACE("Max vertex shader 3.0 instr. slots: %d", m_caps.MaxVertexShader30InstructionSlots);
422         BX_TRACE("Max vertex shader constants: %d", m_caps.MaxVertexShaderConst);
423         BX_TRACE("Max fragment shader 2.0 instr. slots: %d", m_caps.PS20Caps.NumInstructionSlots);
424         BX_TRACE("Max fragment shader 3.0 instr. slots: %d", m_caps.MaxPixelShader30InstructionSlots);
425         BX_TRACE("Num simultaneous render targets: %d", m_caps.NumSimultaneousRTs);
426
427         g_caps.supported |= ( 0
428                        | BGFX_CAPS_TEXTURE_3D
429                        | BGFX_CAPS_TEXTURE_COMPARE_LEQUAL
430                        | BGFX_CAPS_VERTEX_ATTRIB_HALF
431                        | BGFX_CAPS_FRAGMENT_DEPTH
432                        );
433         g_caps.maxTextureSize = bx::uint32_min(m_caps.MaxTextureWidth, m_caps.MaxTextureHeight);
434
435         m_caps.NumSimultaneousRTs = bx::uint32_min(m_caps.NumSimultaneousRTs, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS);
436         g_caps.maxFBAttachments = (uint8_t)m_caps.NumSimultaneousRTs;
437
438#if BGFX_CONFIG_RENDERER_USE_EXTENSIONS
439         BX_TRACE("Extended formats:");
440         for (uint32_t ii = 0; ii < ExtendedFormat::Count; ++ii)
441         {
442            ExtendedFormat& fmt = s_extendedFormats[ii];
443            fmt.m_supported = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, fmt.m_usage, fmt.m_type, fmt.m_fmt) );
444            const char* fourcc = (const char*)&fmt.m_fmt;
445            BX_TRACE("\t%2d: %c%c%c%c %s", ii, fourcc[0], fourcc[1], fourcc[2], fourcc[3], fmt.m_supported ? "supported" : "");
446            BX_UNUSED(fourcc);
447         }
448
449         m_instancing = false
450            || s_extendedFormats[ExtendedFormat::Inst].m_supported
451            || (m_caps.VertexShaderVersion >= D3DVS_VERSION(3, 0) )
452            ;
453
454         if (m_amd
455         &&  s_extendedFormats[ExtendedFormat::Inst].m_supported)
456         {
457            // AMD only
458            m_device->SetRenderState(D3DRS_POINTSIZE, D3DFMT_INST);
459         }
460
461         if (s_extendedFormats[ExtendedFormat::Intz].m_supported)
462         {
463            s_textureFormat[TextureFormat::D24].m_fmt = D3DFMT_INTZ;
464            s_textureFormat[TextureFormat::D32].m_fmt = D3DFMT_INTZ;
465         }
466
467         s_textureFormat[TextureFormat::BC4].m_fmt = s_extendedFormats[ExtendedFormat::Ati1].m_supported ? D3DFMT_ATI1 : D3DFMT_UNKNOWN;
468         s_textureFormat[TextureFormat::BC5].m_fmt = s_extendedFormats[ExtendedFormat::Ati2].m_supported ? D3DFMT_ATI2 : D3DFMT_UNKNOWN;
469
470         g_caps.supported |= m_instancing ? BGFX_CAPS_INSTANCING : 0;
471
472         for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
473         {
474            g_caps.formats[ii] = SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter
475               , m_deviceType
476               , adapterFormat
477               , 0
478               , D3DRTYPE_TEXTURE
479               , s_textureFormat[ii].m_fmt
480               ) ) ? 1 : 0;
481         }
482#endif // BGFX_CONFIG_RENDERER_USE_EXTENSIONS
483
484         uint32_t index = 1;
485         for (const D3DFORMAT* fmt = &s_checkColorFormats[index]; *fmt != D3DFMT_UNKNOWN; ++fmt, ++index)
486         {
487            for (; *fmt != D3DFMT_UNKNOWN; ++fmt)
488            {
489               if (SUCCEEDED(m_d3d9->CheckDeviceFormat(m_adapter, m_deviceType, adapterFormat, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, *fmt) ) )
490               {
491                  s_colorFormat[index] = *fmt;
492                  break;
493               }
494            }
495
496            for (; *fmt != D3DFMT_UNKNOWN; ++fmt);
497         }
498
499         m_fmtDepth = D3DFMT_D24S8;
500
501#elif BX_PLATFORM_XBOX360
502         m_params.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
503         m_params.DisableAutoBackBuffer = FALSE;
504         m_params.DisableAutoFrontBuffer = FALSE;
505         m_params.FrontBufferFormat = D3DFMT_X8R8G8B8;
506         m_params.FrontBufferColorSpace = D3DCOLORSPACE_RGB;
507
508         m_d3d9 = Direct3DCreate9(D3D_SDK_VERSION);
509         BX_TRACE("Creating D3D9 %p", m_d3d9);
510
511         XVIDEO_MODE videoMode;
512         XGetVideoMode(&videoMode);
513         if (!videoMode.fIsWideScreen)
514         {
515            m_params.Flags |= D3DPRESENTFLAG_NO_LETTERBOX;
516         }
517
518         BX_TRACE("Creating device");
519         DX_CHECK(m_d3d9->CreateDevice(m_adapter
520               , m_deviceType
521               , NULL
522               , D3DCREATE_HARDWARE_VERTEXPROCESSING|D3DCREATE_BUFFER_2_FRAMES
523               , &m_params
524               , &m_device
525               ) );
526
527         BX_TRACE("Device %p", m_device);
528
529         m_fmtDepth = D3DFMT_D24FS8;
530#endif // BX_PLATFORM_WINDOWS
531
532         postReset();
533
534         m_initialized = true;
535      }
536
537      ~RendererContextD3D9()
538      {
539         preReset();
540
541         for (uint32_t ii = 0; ii < BX_COUNTOF(m_indexBuffers); ++ii)
542         {
543            m_indexBuffers[ii].destroy();
544         }
545
546         for (uint32_t ii = 0; ii < BX_COUNTOF(m_vertexBuffers); ++ii)
547         {
548            m_vertexBuffers[ii].destroy();
549         }
550
551         for (uint32_t ii = 0; ii < BX_COUNTOF(m_shaders); ++ii)
552         {
553            m_shaders[ii].destroy();
554         }
555
556         for (uint32_t ii = 0; ii < BX_COUNTOF(m_textures); ++ii)
557         {
558            m_textures[ii].destroy();
559         }
560
561         for (uint32_t ii = 0; ii < BX_COUNTOF(m_vertexDecls); ++ii)
562         {
563            m_vertexDecls[ii].destroy();
564         }
565
566#if BGFX_CONFIG_RENDERER_DIRECT3D9EX
567         if (NULL != m_d3d9ex)
568         {
569            DX_RELEASE(m_deviceEx, 1);
570            DX_RELEASE(m_device, 0);
571            DX_RELEASE(m_d3d9, 1);
572            DX_RELEASE(m_d3d9ex, 0);
573         }
574         else
575#endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX
576         {
577            DX_RELEASE(m_device, 0);
578            DX_RELEASE(m_d3d9, 0);
579         }
580
581#if BX_PLATFORM_WINDOWS
582         bx::dlclose(m_d3d9dll);
583#endif // BX_PLATFORM_WINDOWS
584
585         m_initialized = false;
586      }
587
588      RendererType::Enum getRendererType() const BX_OVERRIDE
589      {
590         return RendererType::Direct3D9;
591      }
592
593      const char* getRendererName() const BX_OVERRIDE
594      {
595         return BGFX_RENDERER_DIRECT3D9_NAME;
596      }
597
598      void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem) BX_OVERRIDE
599      {
600         m_indexBuffers[_handle.idx].create(_mem->size, _mem->data);
601      }
602
603      void destroyIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE
604      {
605         m_indexBuffers[_handle.idx].destroy();
606      }
607
608      void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE
609      {
610         m_vertexDecls[_handle.idx].create(_decl);
611      }
612
613      void destroyVertexDecl(VertexDeclHandle _handle) BX_OVERRIDE
614      {
615         m_vertexDecls[_handle.idx].destroy();
616      }
617
618      void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle) BX_OVERRIDE
619      {
620         m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle);
621      }
622
623      void destroyVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE
624      {
625         m_vertexBuffers[_handle.idx].destroy();
626      }
627
628      void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size) BX_OVERRIDE
629      {
630         m_indexBuffers[_handle.idx].create(_size, NULL);
631      }
632
633      void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE
634      {
635         m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
636      }
637
638      void destroyDynamicIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE
639      {
640         m_indexBuffers[_handle.idx].destroy();
641      }
642
643      void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size) BX_OVERRIDE
644      {
645         VertexDeclHandle decl = BGFX_INVALID_HANDLE;
646         m_vertexBuffers[_handle.idx].create(_size, NULL, decl);
647      }
648
649      void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE
650      {
651         m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
652      }
653
654      void destroyDynamicVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE
655      {
656         m_vertexBuffers[_handle.idx].destroy();
657      }
658
659      void createShader(ShaderHandle _handle, Memory* _mem) BX_OVERRIDE
660      {
661         m_shaders[_handle.idx].create(_mem);
662      }
663
664      void destroyShader(ShaderHandle _handle) BX_OVERRIDE
665      {
666         m_shaders[_handle.idx].destroy();
667      }
668
669      void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) BX_OVERRIDE
670      {
671         m_program[_handle.idx].create(m_shaders[_vsh.idx], m_shaders[_fsh.idx]);
672      }
673
674      void destroyProgram(ProgramHandle _handle) BX_OVERRIDE
675      {
676         m_program[_handle.idx].destroy();
677      }
678
679      void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) BX_OVERRIDE
680      {
681         m_textures[_handle.idx].create(_mem, _flags, _skip);
682      }
683
684      void updateTextureBegin(TextureHandle _handle, uint8_t _side, uint8_t _mip) BX_OVERRIDE
685      {
686         m_updateTexture = &m_textures[_handle.idx];
687         m_updateTexture->updateBegin(_side, _mip);
688      }
689
690      void updateTexture(TextureHandle /*_handle*/, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) BX_OVERRIDE
691      {
692         m_updateTexture->update(_side, _mip, _rect, _z, _depth, _pitch, _mem);
693      }
694
695      void updateTextureEnd() BX_OVERRIDE
696      {
697         m_updateTexture->updateEnd();
698         m_updateTexture = NULL;
699      }
700
701      void destroyTexture(TextureHandle _handle) BX_OVERRIDE
702      {
703         m_textures[_handle.idx].destroy();
704      }
705
706      void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE
707      {
708         m_frameBuffers[_handle.idx].create(_num, _textureHandles);
709      }
710
711      void destroyFrameBuffer(FrameBufferHandle _handle) BX_OVERRIDE
712      {
713         m_frameBuffers[_handle.idx].destroy();
714      }
715
716      void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) BX_OVERRIDE
717      {
718         if (NULL != m_uniforms[_handle.idx])
719         {
720            BX_FREE(g_allocator, m_uniforms[_handle.idx]);
721         }
722
723         uint32_t size = BX_ALIGN_16(g_uniformTypeSize[_type]*_num);
724         void* data = BX_ALLOC(g_allocator, size);
725         memset(data, 0, size);
726         m_uniforms[_handle.idx] = data;
727         m_uniformReg.add(_handle, _name, data);
728      }
729
730      void destroyUniform(UniformHandle _handle) BX_OVERRIDE
731      {
732         BX_FREE(g_allocator, m_uniforms[_handle.idx]);
733         m_uniforms[_handle.idx] = NULL;
734      }
735
736      void saveScreenShot(const char* _filePath) BX_OVERRIDE
737      {
738#if BX_PLATFORM_WINDOWS
739         IDirect3DSurface9* surface;
740         D3DDEVICE_CREATION_PARAMETERS dcp;
741         DX_CHECK(m_device->GetCreationParameters(&dcp) );
742
743         D3DDISPLAYMODE dm;
744         DX_CHECK(m_d3d9->GetAdapterDisplayMode(dcp.AdapterOrdinal, &dm) );
745
746         DX_CHECK(m_device->CreateOffscreenPlainSurface(dm.Width
747            , dm.Height
748            , D3DFMT_A8R8G8B8
749            , D3DPOOL_SCRATCH
750            , &surface
751            , NULL
752            ) );
753
754         DX_CHECK(m_device->GetFrontBufferData(0, surface) );
755
756         D3DLOCKED_RECT rect;
757         DX_CHECK(surface->LockRect(&rect
758            , NULL
759            , D3DLOCK_NO_DIRTY_UPDATE|D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY
760            ) );
761
762         RECT rc;
763         GetClientRect(g_bgfxHwnd, &rc);
764         POINT point;
765         point.x = rc.left;
766         point.y = rc.top;
767         ClientToScreen(g_bgfxHwnd, &point);
768         uint8_t* data = (uint8_t*)rect.pBits;
769         uint32_t bytesPerPixel = rect.Pitch/dm.Width;
770
771         g_callback->screenShot(_filePath
772            , m_params.BackBufferWidth
773            , m_params.BackBufferHeight
774            , rect.Pitch
775            , &data[point.y*rect.Pitch+point.x*bytesPerPixel]
776         , m_params.BackBufferHeight*rect.Pitch
777            , false
778            );
779
780         DX_CHECK(surface->UnlockRect() );
781         DX_RELEASE(surface, 0);
782#endif // BX_PLATFORM_WINDOWS
783      }
784
785      void updateViewName(uint8_t _id, const char* _name) BX_OVERRIDE
786      {
787         mbstowcs(&s_viewNameW[_id][0], _name, BX_COUNTOF(s_viewNameW[0]) );
788      }
789
790      void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE
791      {
792         memcpy(m_uniforms[_loc], _data, _size);
793      }
794
795      void setMarker(const char* _marker, uint32_t _size) BX_OVERRIDE
796      {
797#if BGFX_CONFIG_DEBUG_PIX
798         uint32_t size = _size*sizeof(wchar_t);
799         wchar_t* name = (wchar_t*)alloca(size);
800         mbstowcs(name, _marker, size-2);
801         PIX_SETMARKER(D3DCOLOR_RGBA(0xff, 0xff, 0xff, 0xff), name);
802#endif // BGFX_CONFIG_DEBUG_PIX
803         BX_UNUSED(_marker, _size);
804      }
805
806      void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) BX_OVERRIDE;
807
808      void blitSetup(TextVideoMemBlitter& _blitter) BX_OVERRIDE
809      {
810         uint32_t width  = m_params.BackBufferWidth;
811         uint32_t height = m_params.BackBufferHeight;
812
813         FrameBufferHandle fbh = BGFX_INVALID_HANDLE;
814         setFrameBuffer(fbh, false);
815
816         D3DVIEWPORT9 vp;
817         vp.X = 0;
818         vp.Y = 0;
819         vp.Width = width;
820         vp.Height = height;
821         vp.MinZ = 0.0f;
822         vp.MaxZ = 1.0f;
823
824         IDirect3DDevice9* device = m_device;
825         DX_CHECK(device->SetViewport(&vp) );
826         DX_CHECK(device->SetRenderState(D3DRS_STENCILENABLE, FALSE) );
827         DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, FALSE) );
828         DX_CHECK(device->SetRenderState(D3DRS_ZFUNC, D3DCMP_ALWAYS) );
829         DX_CHECK(device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE) );
830         DX_CHECK(device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE) );
831         DX_CHECK(device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER) );
832         DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE) );
833         DX_CHECK(device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID) );
834
835         ProgramD3D9& program = m_program[_blitter.m_program.idx];
836         DX_CHECK(device->SetVertexShader(program.m_vsh->m_vertexShader) );
837         DX_CHECK(device->SetPixelShader(program.m_fsh->m_pixelShader) );
838
839         VertexBufferD3D9& vb = m_vertexBuffers[_blitter.m_vb->handle.idx];
840         VertexDeclaration& vertexDecl = m_vertexDecls[_blitter.m_vb->decl.idx];
841         DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, vertexDecl.m_decl.m_stride) );
842         DX_CHECK(device->SetVertexDeclaration(vertexDecl.m_ptr) );
843
844         IndexBufferD3D9& ib = m_indexBuffers[_blitter.m_ib->handle.idx];
845         DX_CHECK(device->SetIndices(ib.m_ptr) );
846
847         float proj[16];
848         mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f);
849
850         PredefinedUniform& predefined = program.m_predefined[0];
851         uint8_t flags = predefined.m_type;
852         setShaderConstantF(flags, predefined.m_loc, proj, 4);
853
854         m_textures[_blitter.m_texture.idx].commit(0);
855      }
856
857      void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) BX_OVERRIDE
858      {
859         uint32_t numVertices = _numIndices*4/6;
860         m_indexBuffers[_blitter.m_ib->handle.idx].update(0, _numIndices*2, _blitter.m_ib->data, true);
861         m_vertexBuffers[_blitter.m_vb->handle.idx].update(0, numVertices*_blitter.m_decl.m_stride, _blitter.m_vb->data, true);
862
863         DX_CHECK(m_device->DrawIndexedPrimitive(D3DPT_TRIANGLELIST
864            , 0
865            , 0
866            , numVertices
867            , 0
868            , _numIndices/3
869            ) );
870      }
871
872      void updateMsaa()
873      {
874         for (uint32_t ii = 1, last = 0; ii < BX_COUNTOF(s_checkMsaa); ++ii)
875         {
876            D3DMULTISAMPLE_TYPE msaa = s_checkMsaa[ii];
877            DWORD quality;
878
879            HRESULT hr = m_d3d9->CheckDeviceMultiSampleType(m_adapter
880               , m_deviceType
881               , m_params.BackBufferFormat
882               , m_params.Windowed
883               , msaa
884               , &quality
885               );
886
887            if (SUCCEEDED(hr) )
888            {
889               s_msaa[ii].m_type = msaa;
890               s_msaa[ii].m_quality = bx::uint32_imax(0, quality-1);
891               last = ii;
892            }
893            else
894            {
895               s_msaa[ii] = s_msaa[last];
896            }
897         }
898      }
899
900      void updateResolution(const Resolution& _resolution)
901      {
902         if (m_params.BackBufferWidth != _resolution.m_width
903            ||  m_params.BackBufferHeight != _resolution.m_height
904            ||  m_flags != _resolution.m_flags)
905         {
906            m_flags = _resolution.m_flags;
907
908            m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
909            m_textVideoMem.clear();
910
911#if BX_PLATFORM_WINDOWS
912            D3DDEVICE_CREATION_PARAMETERS dcp;
913            DX_CHECK(m_device->GetCreationParameters(&dcp) );
914
915            D3DDISPLAYMODE dm;
916            DX_CHECK(m_d3d9->GetAdapterDisplayMode(dcp.AdapterOrdinal, &dm) );
917
918            m_params.BackBufferFormat = dm.Format;
919#endif // BX_PLATFORM_WINDOWS
920
921            m_params.BackBufferWidth = _resolution.m_width;
922            m_params.BackBufferHeight = _resolution.m_height;
923            m_params.FullScreen_RefreshRateInHz = BGFX_RESET_FULLSCREEN == (m_flags&BGFX_RESET_FULLSCREEN_MASK) ? 60 : 0;
924            m_params.PresentationInterval = !!(m_flags&BGFX_RESET_VSYNC) ? D3DPRESENT_INTERVAL_ONE : D3DPRESENT_INTERVAL_IMMEDIATE;
925
926            updateMsaa();
927
928            Msaa& msaa = s_msaa[(m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
929            m_params.MultiSampleType = msaa.m_type;
930            m_params.MultiSampleQuality = msaa.m_quality;
931
932            m_resolution = _resolution;
933
934            preReset();
935            DX_CHECK(m_device->Reset(&m_params) );
936            postReset();
937         }
938      }
939
940      void setFrameBuffer(FrameBufferHandle _fbh, bool _msaa = true)
941      {
942         if (isValid(m_fbh)
943         &&  m_fbh.idx != _fbh.idx
944         &&  m_rtMsaa)
945         {
946            FrameBufferD3D9& frameBuffer = m_frameBuffers[m_fbh.idx];
947            frameBuffer.resolve();
948         }
949
950         if (!isValid(_fbh) )
951         {
952            DX_CHECK(m_device->SetRenderTarget(0, m_backBufferColor) );
953            for (uint32_t ii = 1, num = g_caps.maxFBAttachments; ii < num; ++ii)
954            {
955               DX_CHECK(m_device->SetRenderTarget(ii, NULL) );
956            }
957            DX_CHECK(m_device->SetDepthStencilSurface(m_backBufferDepthStencil) );
958         }
959         else
960         {
961            const FrameBufferD3D9& frameBuffer = m_frameBuffers[_fbh.idx];
962
963            // If frame buffer has only depth attachment D3DFMT_NULL
964            // render target is created.
965            uint32_t fbnum = bx::uint32_max(1, frameBuffer.m_num);
966
967            for (uint32_t ii = 0; ii < fbnum; ++ii)
968            {
969               DX_CHECK(m_device->SetRenderTarget(ii, frameBuffer.m_color[ii]) );
970            }
971
972            for (uint32_t ii = fbnum, num = g_caps.maxFBAttachments; ii < num; ++ii)
973            {
974               DX_CHECK(m_device->SetRenderTarget(ii, NULL) );
975            }
976
977            IDirect3DSurface9* depthStencil = frameBuffer.m_depthStencil;
978            DX_CHECK(m_device->SetDepthStencilSurface(NULL != depthStencil ? depthStencil : m_backBufferDepthStencil) );
979         }
980
981         m_fbh = _fbh;
982         m_rtMsaa = _msaa;
983      }
984
985      void setShaderConstantF(uint8_t _flags, uint16_t _regIndex, const float* _val, uint16_t _numRegs)
986      {
987         if (_flags&BGFX_UNIFORM_FRAGMENTBIT)
988         {
989            DX_CHECK(m_device->SetPixelShaderConstantF(_regIndex, _val, _numRegs) );
990         }
991         else
992         {
993            DX_CHECK(m_device->SetVertexShaderConstantF(_regIndex, _val, _numRegs) );
994         }
995      }
996
997      void reset()
998      {
999         preReset();
1000
1001         HRESULT hr;
1002
1003         do
1004         {
1005            hr = m_device->Reset(&m_params);
1006         } while (FAILED(hr) );
1007
1008         postReset();
1009      }
1010
1011      bool isLost(HRESULT _hr) const
1012      {
1013         return D3DERR_DEVICELOST == _hr
1014            || D3DERR_DRIVERINTERNALERROR == _hr
1015#if !defined(D3D_DISABLE_9EX)
1016            || D3DERR_DEVICEHUNG == _hr
1017            || D3DERR_DEVICEREMOVED == _hr
1018#endif // !defined(D3D_DISABLE_9EX)
1019            ;
1020      }
1021
1022      void flip() BX_OVERRIDE
1023      {
1024         if (NULL != m_device)
1025         {
1026#if BGFX_CONFIG_RENDERER_DIRECT3D9EX
1027            if (NULL != m_deviceEx)
1028            {
1029               DX_CHECK(m_deviceEx->WaitForVBlank(0) );
1030            }
1031#endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX
1032
1033            HRESULT hr;
1034            hr = m_device->Present(NULL, NULL, NULL, NULL);
1035
1036#if BX_PLATFORM_WINDOWS
1037            if (isLost(hr) )
1038            {
1039               do
1040               {
1041                  do
1042                  {
1043                     hr = m_device->TestCooperativeLevel();
1044                  }
1045                  while (D3DERR_DEVICENOTRESET != hr);
1046
1047                  reset();
1048                  hr = m_device->TestCooperativeLevel();
1049               }
1050               while (FAILED(hr) );
1051            }
1052            else if (FAILED(hr) )
1053            {
1054               BX_TRACE("Present failed with err 0x%08x.", hr);
1055            }
1056#endif // BX_PLATFORM_
1057         }
1058      }
1059
1060      void preReset()
1061      {
1062         invalidateSamplerState();
1063
1064         for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
1065         {
1066            DX_CHECK(m_device->SetTexture(stage, NULL) );
1067         }
1068
1069         DX_CHECK(m_device->SetRenderTarget(0, m_backBufferColor) );
1070         for (uint32_t ii = 1, num = g_caps.maxFBAttachments; ii < num; ++ii)
1071         {
1072            DX_CHECK(m_device->SetRenderTarget(ii, NULL) );
1073         }
1074         DX_CHECK(m_device->SetDepthStencilSurface(m_backBufferDepthStencil) );
1075         DX_CHECK(m_device->SetVertexShader(NULL) );
1076         DX_CHECK(m_device->SetPixelShader(NULL) );
1077         DX_CHECK(m_device->SetStreamSource(0, NULL, 0, 0) );
1078         DX_CHECK(m_device->SetIndices(NULL) );
1079
1080         DX_RELEASE(m_backBufferColor, 0);
1081         DX_RELEASE(m_backBufferDepthStencil, 0);
1082
1083         capturePreReset();
1084
1085         for (uint32_t ii = 0; ii < BX_COUNTOF(m_indexBuffers); ++ii)
1086         {
1087            m_indexBuffers[ii].preReset();
1088         }
1089
1090         for (uint32_t ii = 0; ii < BX_COUNTOF(m_vertexBuffers); ++ii)
1091         {
1092            m_vertexBuffers[ii].preReset();
1093         }
1094
1095         for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii)
1096         {
1097            m_frameBuffers[ii].preReset();
1098         }
1099
1100         for (uint32_t ii = 0; ii < BX_COUNTOF(m_textures); ++ii)
1101         {
1102            m_textures[ii].preReset();
1103         }
1104      }
1105
1106      void postReset()
1107      {
1108         DX_CHECK(m_device->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &m_backBufferColor) );
1109         DX_CHECK(m_device->GetDepthStencilSurface(&m_backBufferDepthStencil) );
1110
1111         capturePostReset();
1112
1113         for (uint32_t ii = 0; ii < BX_COUNTOF(m_indexBuffers); ++ii)
1114         {
1115            m_indexBuffers[ii].postReset();
1116         }
1117
1118         for (uint32_t ii = 0; ii < BX_COUNTOF(m_vertexBuffers); ++ii)
1119         {
1120            m_vertexBuffers[ii].postReset();
1121         }
1122
1123         for (uint32_t ii = 0; ii < BX_COUNTOF(m_textures); ++ii)
1124         {
1125            m_textures[ii].postReset();
1126         }
1127
1128         for (uint32_t ii = 0; ii < BX_COUNTOF(m_frameBuffers); ++ii)
1129         {
1130            m_frameBuffers[ii].postReset();
1131         }
1132      }
1133
1134      void invalidateSamplerState()
1135      {
1136         for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
1137         {
1138            m_samplerFlags[stage] = UINT32_MAX;
1139         }
1140      }
1141
1142      void setSamplerState(uint8_t _stage, uint32_t _flags)
1143      {
1144         const uint32_t flags = _flags&( (~BGFX_TEXTURE_RESERVED_MASK) | BGFX_TEXTURE_SAMPLER_BITS_MASK);
1145         if (m_samplerFlags[_stage] != flags)
1146         {
1147            m_samplerFlags[_stage] = flags;
1148            IDirect3DDevice9* device = m_device;
1149            D3DTEXTUREADDRESS tau = s_textureAddress[(_flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT];
1150            D3DTEXTUREADDRESS tav = s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT];
1151            D3DTEXTUREADDRESS taw = s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT];
1152            D3DTEXTUREFILTERTYPE minFilter = s_textureFilter[(_flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT];
1153            D3DTEXTUREFILTERTYPE magFilter = s_textureFilter[(_flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT];
1154            D3DTEXTUREFILTERTYPE mipFilter = s_textureFilter[(_flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT];
1155            DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_ADDRESSU, tau) );
1156            DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_ADDRESSV, tav) );
1157            DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MINFILTER, minFilter) );
1158            DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MAGFILTER, magFilter) );
1159            DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_MIPFILTER, mipFilter) );
1160            DX_CHECK(device->SetSamplerState(_stage, D3DSAMP_ADDRESSW, taw) );
1161         }
1162      }
1163
1164      void capturePreReset()
1165      {
1166         if (NULL != m_captureSurface)
1167         {
1168            g_callback->captureEnd();
1169         }
1170         DX_RELEASE(m_captureSurface, 1);
1171         DX_RELEASE(m_captureTexture, 0);
1172         DX_RELEASE(m_captureResolve, 0);
1173      }
1174
1175      void capturePostReset()
1176      {
1177         if (m_flags&BGFX_RESET_CAPTURE)
1178         {
1179            uint32_t width = m_params.BackBufferWidth;
1180            uint32_t height = m_params.BackBufferHeight;
1181            D3DFORMAT fmt = m_params.BackBufferFormat;
1182
1183            DX_CHECK(m_device->CreateTexture(width
1184               , height
1185               , 1
1186               , 0
1187               , fmt
1188               , D3DPOOL_SYSTEMMEM
1189               , &m_captureTexture
1190               , NULL
1191               ) );
1192
1193            DX_CHECK(m_captureTexture->GetSurfaceLevel(0
1194               , &m_captureSurface
1195               ) );
1196
1197            if (m_params.MultiSampleType != D3DMULTISAMPLE_NONE)
1198            {
1199               DX_CHECK(m_device->CreateRenderTarget(width
1200                  , height
1201                  , fmt
1202                  , D3DMULTISAMPLE_NONE
1203                  , 0
1204                  , false
1205                  , &m_captureResolve
1206                  , NULL
1207                  ) );
1208            }
1209
1210            g_callback->captureBegin(width, height, width*4, TextureFormat::BGRA8, false);
1211         }
1212      }
1213
1214      void capture()
1215      {
1216         if (NULL != m_captureSurface)
1217         {
1218            IDirect3DSurface9* resolve = m_backBufferColor;
1219
1220            if (NULL != m_captureResolve)
1221            {
1222               resolve = m_captureResolve;
1223               DX_CHECK(m_device->StretchRect(m_backBufferColor
1224                  , 0
1225                  , m_captureResolve
1226                  , NULL
1227                  , D3DTEXF_NONE
1228                  ) );
1229            }
1230
1231            HRESULT hr = m_device->GetRenderTargetData(resolve, m_captureSurface);
1232            if (SUCCEEDED(hr) )
1233            {
1234               D3DLOCKED_RECT rect;
1235               DX_CHECK(m_captureSurface->LockRect(&rect
1236                  , NULL
1237                  , D3DLOCK_NO_DIRTY_UPDATE|D3DLOCK_NOSYSLOCK|D3DLOCK_READONLY
1238                  ) );
1239
1240               g_callback->captureFrame(rect.pBits, m_params.BackBufferHeight*rect.Pitch);
1241
1242               DX_CHECK(m_captureSurface->UnlockRect() );
1243            }
1244         }
1245      }
1246
1247      void commit(ConstantBuffer& _constantBuffer)
1248      {
1249         _constantBuffer.reset();
1250
1251         IDirect3DDevice9* device = m_device;
1252
1253         for (;;)
1254         {
1255            uint32_t opcode = _constantBuffer.read();
1256
1257            if (UniformType::End == opcode)
1258            {
1259               break;
1260            }
1261
1262            UniformType::Enum type;
1263            uint16_t loc;
1264            uint16_t num;
1265            uint16_t copy;
1266            ConstantBuffer::decodeOpcode(opcode, type, loc, num, copy);
1267
1268            const char* data;
1269            if (copy)
1270            {
1271               data = _constantBuffer.read(g_uniformTypeSize[type]*num);
1272            }
1273            else
1274            {
1275               UniformHandle handle;
1276               memcpy(&handle, _constantBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
1277               data = (const char*)m_uniforms[handle.idx];
1278            }
1279
1280#define CASE_IMPLEMENT_UNIFORM(_uniform, _dxsuffix, _type) \
1281            case UniformType::_uniform: \
1282            { \
1283               _type* value = (_type*)data; \
1284               DX_CHECK(device->SetVertexShaderConstant##_dxsuffix(loc, value, num) ); \
1285            } \
1286            break; \
1287            \
1288            case UniformType::_uniform|BGFX_UNIFORM_FRAGMENTBIT: \
1289            { \
1290               _type* value = (_type*)data; \
1291               DX_CHECK(device->SetPixelShaderConstant##_dxsuffix(loc, value, num) ); \
1292            } \
1293            break
1294
1295            switch ( (int32_t)type)
1296            {
1297            case UniformType::Uniform3x3fv:
1298               {
1299                  float* value = (float*)data;
1300                  for (uint32_t ii = 0, count = num/3; ii < count; ++ii,  loc += 3, value += 9)
1301                  {
1302                     Matrix4 mtx;
1303                     mtx.un.val[ 0] = value[0];
1304                     mtx.un.val[ 1] = value[1];
1305                     mtx.un.val[ 2] = value[2];
1306                     mtx.un.val[ 3] = 0.0f;
1307                     mtx.un.val[ 4] = value[3];
1308                     mtx.un.val[ 5] = value[4];
1309                     mtx.un.val[ 6] = value[5];
1310                     mtx.un.val[ 7] = 0.0f;
1311                     mtx.un.val[ 8] = value[6];
1312                     mtx.un.val[ 9] = value[7];
1313                     mtx.un.val[10] = value[8];
1314                     mtx.un.val[11] = 0.0f;
1315                     DX_CHECK(device->SetVertexShaderConstantF(loc, &mtx.un.val[0], 3) );
1316                  }
1317               }
1318               break;
1319
1320            case UniformType::Uniform3x3fv|BGFX_UNIFORM_FRAGMENTBIT:
1321               {
1322                  float* value = (float*)data;
1323                  for (uint32_t ii = 0, count = num/3; ii < count; ++ii, loc += 3, value += 9)
1324                  {
1325                     Matrix4 mtx;
1326                     mtx.un.val[ 0] = value[0];
1327                     mtx.un.val[ 1] = value[1];
1328                     mtx.un.val[ 2] = value[2];
1329                     mtx.un.val[ 3] = 0.0f;
1330                     mtx.un.val[ 4] = value[3];
1331                     mtx.un.val[ 5] = value[4];
1332                     mtx.un.val[ 6] = value[5];
1333                     mtx.un.val[ 7] = 0.0f;
1334                     mtx.un.val[ 8] = value[6];
1335                     mtx.un.val[ 9] = value[7];
1336                     mtx.un.val[10] = value[8];
1337                     mtx.un.val[11] = 0.0f;
1338                     DX_CHECK(device->SetPixelShaderConstantF(loc, &mtx.un.val[0], 3) );
1339                  }
1340               }
1341               break;
1342
1343            CASE_IMPLEMENT_UNIFORM(Uniform1i,    I, int);
1344            CASE_IMPLEMENT_UNIFORM(Uniform1f,    F, float);
1345            CASE_IMPLEMENT_UNIFORM(Uniform1iv,   I, int);
1346            CASE_IMPLEMENT_UNIFORM(Uniform1fv,   F, float);
1347            CASE_IMPLEMENT_UNIFORM(Uniform2fv,   F, float);
1348            CASE_IMPLEMENT_UNIFORM(Uniform3fv,   F, float);
1349            CASE_IMPLEMENT_UNIFORM(Uniform4fv,   F, float);
1350            CASE_IMPLEMENT_UNIFORM(Uniform4x4fv, F, float);
1351
1352            case UniformType::End:
1353               break;
1354
1355            default:
1356               BX_TRACE("%4d: INVALID 0x%08x, t %d, l %d, n %d, c %d", _constantBuffer.getPos(), opcode, type, loc, num, copy);
1357               break;
1358            }
1359
1360#undef CASE_IMPLEMENT_UNIFORM
1361
1362         }
1363      }
1364
1365#if BX_PLATFORM_WINDOWS
1366      D3DCAPS9 m_caps;
1367
1368#   if BGFX_CONFIG_DEBUG_PIX
1369      D3DPERF_SetMarkerFunc m_D3DPERF_SetMarker;
1370      D3DPERF_BeginEventFunc m_D3DPERF_BeginEvent;
1371      D3DPERF_EndEventFunc m_D3DPERF_EndEvent;
1372#   endif // BGFX_CONFIG_DEBUG_PIX
1373#endif // BX_PLATFORM_WINDOWS
1374
1375#if BGFX_CONFIG_RENDERER_DIRECT3D9EX
1376      IDirect3D9Ex* m_d3d9ex;
1377      IDirect3DDevice9Ex* m_deviceEx;
1378#endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX
1379
1380      IDirect3D9* m_d3d9;
1381      IDirect3DDevice9* m_device;
1382      D3DPOOL m_pool;
1383
1384      IDirect3DSurface9* m_backBufferColor;
1385      IDirect3DSurface9* m_backBufferDepthStencil;
1386
1387      IDirect3DTexture9* m_captureTexture;
1388      IDirect3DSurface9* m_captureSurface;
1389      IDirect3DSurface9* m_captureResolve;
1390
1391      IDirect3DVertexDeclaration9* m_instanceDataDecls[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT];
1392
1393      void* m_d3d9dll;
1394      uint32_t m_adapter;
1395      D3DDEVTYPE m_deviceType;
1396      D3DPRESENT_PARAMETERS m_params;
1397      uint32_t m_flags;
1398      D3DADAPTER_IDENTIFIER9 m_identifier;
1399      Resolution m_resolution;
1400
1401      bool m_initialized;
1402      bool m_amd;
1403      bool m_nvidia;
1404      bool m_instancing;
1405
1406      D3DFORMAT m_fmtDepth;
1407
1408      IndexBufferD3D9 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS];
1409      VertexBufferD3D9 m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS];
1410      ShaderD3D9 m_shaders[BGFX_CONFIG_MAX_SHADERS];
1411      ProgramD3D9 m_program[BGFX_CONFIG_MAX_PROGRAMS];
1412      TextureD3D9 m_textures[BGFX_CONFIG_MAX_TEXTURES];
1413      VertexDeclaration m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS];
1414      FrameBufferD3D9 m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS];
1415      UniformRegistry m_uniformReg;
1416      void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS];
1417
1418      uint32_t m_samplerFlags[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
1419
1420      TextureD3D9* m_updateTexture;
1421      uint8_t* m_updateTextureBits;
1422      uint32_t m_updateTexturePitch;
1423      uint8_t m_updateTextureSide;
1424      uint8_t m_updateTextureMip;
1425
1426      TextVideoMem m_textVideoMem;
1427
1428      FrameBufferHandle m_fbh;
1429      bool m_rtMsaa;
1430   };
1431
1432   static RendererContextD3D9* s_renderD3D9;
1433
1434   RendererContextI* rendererCreateD3D9()
1435   {
1436      s_renderD3D9 = BX_NEW(g_allocator, RendererContextD3D9);
1437      return s_renderD3D9;
1438   }
1439
1440   void rendererDestroyD3D9()
1441   {
1442      BX_DELETE(g_allocator, s_renderD3D9);
1443      s_renderD3D9 = NULL;
1444   }
1445
1446   void IndexBufferD3D9::create(uint32_t _size, void* _data)
1447   {
1448      m_size = _size;
1449      m_dynamic = NULL == _data;
1450
1451      uint32_t usage = D3DUSAGE_WRITEONLY;
1452      D3DPOOL pool = s_renderD3D9->m_pool;
1453
1454      if (m_dynamic)
1455      {
1456         usage |= D3DUSAGE_DYNAMIC;
1457         pool = D3DPOOL_DEFAULT;
1458      }
1459
1460      DX_CHECK(s_renderD3D9->m_device->CreateIndexBuffer(m_size
1461         , usage
1462         , D3DFMT_INDEX16
1463         , pool
1464         , &m_ptr
1465         , NULL
1466         ) );
1467
1468      if (NULL != _data)
1469      {
1470         update(0, _size, _data);
1471      }
1472   }
1473
1474   void IndexBufferD3D9::preReset()
1475   {
1476      if (m_dynamic)
1477      {
1478         DX_RELEASE(m_ptr, 0);
1479      }
1480   }
1481
1482   void IndexBufferD3D9::postReset()
1483   {
1484      if (m_dynamic)
1485      {
1486         DX_CHECK(s_renderD3D9->m_device->CreateIndexBuffer(m_size
1487            , D3DUSAGE_WRITEONLY|D3DUSAGE_DYNAMIC
1488            , D3DFMT_INDEX16
1489            , D3DPOOL_DEFAULT
1490            , &m_ptr
1491            , NULL
1492            ) );
1493      }
1494   }
1495
1496   void VertexBufferD3D9::create(uint32_t _size, void* _data, VertexDeclHandle _declHandle)
1497   {
1498      m_size = _size;
1499      m_decl = _declHandle;
1500      m_dynamic = NULL == _data;
1501
1502      uint32_t usage = D3DUSAGE_WRITEONLY;
1503      D3DPOOL pool = s_renderD3D9->m_pool;
1504
1505      if (m_dynamic)
1506      {
1507         usage |= D3DUSAGE_DYNAMIC;
1508         pool = D3DPOOL_DEFAULT;
1509      }
1510
1511      DX_CHECK(s_renderD3D9->m_device->CreateVertexBuffer(m_size
1512            , usage
1513            , 0
1514            , pool
1515            , &m_ptr
1516            , NULL
1517            ) );
1518
1519      if (NULL != _data)
1520      {
1521         update(0, _size, _data);
1522      }
1523   }
1524
1525   void VertexBufferD3D9::preReset()
1526   {
1527      if (m_dynamic)
1528      {
1529         DX_RELEASE(m_ptr, 0);
1530      }
1531   }
1532
1533   void VertexBufferD3D9::postReset()
1534   {
1535      if (m_dynamic)
1536      {
1537         DX_CHECK(s_renderD3D9->m_device->CreateVertexBuffer(m_size
1538               , D3DUSAGE_WRITEONLY|D3DUSAGE_DYNAMIC
1539               , 0
1540               , D3DPOOL_DEFAULT
1541               , &m_ptr
1542               , NULL
1543               ) );
1544      }
1545   }
1546
1547   static const D3DVERTEXELEMENT9 s_attrib[] =
1548   {
1549      { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION,     0 },
1550      { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL,       0 },
1551      { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT,      0 },
1552      { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BINORMAL,     0 },
1553      { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,        0 },
1554      { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR,        1 },
1555      { 0, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDINDICES, 0 },
1556      { 0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BLENDWEIGHT,  0 },
1557      { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,     0 },
1558      { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,     1 },
1559      { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,     2 },
1560      { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,     3 },
1561      { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,     4 },
1562      { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,     5 },
1563      { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,     6 },
1564      { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD,     7 },
1565      D3DDECL_END()
1566   };
1567   BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attrib)-1);
1568
1569   static const D3DDECLTYPE s_attribType[AttribType::Count][4][2] =
1570   {
1571      {
1572         { D3DDECLTYPE_UBYTE4,    D3DDECLTYPE_UBYTE4N   },
1573         { D3DDECLTYPE_UBYTE4,    D3DDECLTYPE_UBYTE4N   },
1574         { D3DDECLTYPE_UBYTE4,    D3DDECLTYPE_UBYTE4N   },
1575         { D3DDECLTYPE_UBYTE4,    D3DDECLTYPE_UBYTE4N   },
1576      },
1577      {
1578         { D3DDECLTYPE_SHORT2,    D3DDECLTYPE_SHORT2N   },
1579         { D3DDECLTYPE_SHORT2,    D3DDECLTYPE_SHORT2N   },
1580         { D3DDECLTYPE_SHORT4,    D3DDECLTYPE_SHORT4N   },
1581         { D3DDECLTYPE_SHORT4,    D3DDECLTYPE_SHORT4N   },
1582      },
1583      {
1584         { D3DDECLTYPE_FLOAT16_2, D3DDECLTYPE_FLOAT16_2 },
1585         { D3DDECLTYPE_FLOAT16_2, D3DDECLTYPE_FLOAT16_2 },
1586         { D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_FLOAT16_4 },
1587         { D3DDECLTYPE_FLOAT16_4, D3DDECLTYPE_FLOAT16_4 },
1588      },
1589      {
1590         { D3DDECLTYPE_FLOAT1,    D3DDECLTYPE_FLOAT1    },
1591         { D3DDECLTYPE_FLOAT2,    D3DDECLTYPE_FLOAT2    },
1592         { D3DDECLTYPE_FLOAT3,    D3DDECLTYPE_FLOAT3    },
1593         { D3DDECLTYPE_FLOAT4,    D3DDECLTYPE_FLOAT4    },
1594      },
1595   };
1596
1597   static D3DVERTEXELEMENT9* fillVertexDecl(D3DVERTEXELEMENT9* _out, const VertexDecl& _decl)
1598   {
1599      D3DVERTEXELEMENT9* elem = _out;
1600
1601      for (uint32_t attr = 0; attr < Attrib::Count; ++attr)
1602      {
1603         if (0xff != _decl.m_attributes[attr])
1604         {
1605            uint8_t num;
1606            AttribType::Enum type;
1607            bool normalized;
1608            bool asInt;
1609            _decl.decode(Attrib::Enum(attr), num, type, normalized, asInt);
1610
1611            memcpy(elem, &s_attrib[attr], sizeof(D3DVERTEXELEMENT9) );
1612
1613            elem->Type = s_attribType[type][num-1][normalized];
1614            elem->Offset = _decl.m_offset[attr];
1615            ++elem;
1616         }
1617      }
1618
1619      return elem;
1620   }
1621
1622   static IDirect3DVertexDeclaration9* createVertexDeclaration(const VertexDecl& _decl, uint8_t _numInstanceData)
1623   {
1624      D3DVERTEXELEMENT9 vertexElements[Attrib::Count+1+BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT];
1625      D3DVERTEXELEMENT9* elem = fillVertexDecl(vertexElements, _decl);
1626
1627      const D3DVERTEXELEMENT9 inst = { 1, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 };
1628
1629      for (uint32_t ii = 0; ii < _numInstanceData; ++ii)
1630      {
1631         memcpy(elem, &inst, sizeof(D3DVERTEXELEMENT9) );
1632         elem->UsageIndex = 8-_numInstanceData+ii;
1633         elem->Offset = ii*16;
1634         ++elem;
1635      }
1636
1637      memcpy(elem, &s_attrib[Attrib::Count], sizeof(D3DVERTEXELEMENT9) );
1638
1639      IDirect3DVertexDeclaration9* ptr;
1640      DX_CHECK(s_renderD3D9->m_device->CreateVertexDeclaration(vertexElements, &ptr) );
1641      return ptr;
1642   }
1643
1644   void VertexDeclaration::create(const VertexDecl& _decl)
1645   {
1646      memcpy(&m_decl, &_decl, sizeof(VertexDecl) );
1647      dump(m_decl);
1648      m_ptr = createVertexDeclaration(_decl, 0);
1649   }
1650
1651   void ShaderD3D9::create(const Memory* _mem)
1652   {
1653      bx::MemoryReader reader(_mem->data, _mem->size);
1654
1655      uint32_t magic;
1656      bx::read(&reader, magic);
1657
1658      switch (magic)
1659      {
1660      case BGFX_CHUNK_MAGIC_FSH:
1661      case BGFX_CHUNK_MAGIC_VSH:
1662         break;
1663
1664      default:
1665         BGFX_FATAL(false, Fatal::InvalidShader, "Unknown shader format %x.", magic);
1666         break;
1667      }
1668
1669      bool fragment = BGFX_CHUNK_MAGIC_FSH == magic;
1670
1671      uint32_t iohash;
1672      bx::read(&reader, iohash);
1673
1674      uint16_t count;
1675      bx::read(&reader, count);
1676
1677      m_numPredefined = 0;
1678
1679      BX_TRACE("Shader consts %d", count);
1680
1681      uint8_t fragmentBit = fragment ? BGFX_UNIFORM_FRAGMENTBIT : 0;
1682
1683      if (0 < count)
1684      {
1685         m_constantBuffer = ConstantBuffer::create(1024);
1686
1687         for (uint32_t ii = 0; ii < count; ++ii)
1688         {
1689            uint8_t nameSize;
1690            bx::read(&reader, nameSize);
1691
1692            char name[256];
1693            bx::read(&reader, &name, nameSize);
1694            name[nameSize] = '\0';
1695
1696            uint8_t type;
1697            bx::read(&reader, type);
1698
1699            uint8_t num;
1700            bx::read(&reader, num);
1701
1702            uint16_t regIndex;
1703            bx::read(&reader, regIndex);
1704
1705            uint16_t regCount;
1706            bx::read(&reader, regCount);
1707
1708            const char* kind = "invalid";
1709
1710            PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name);
1711            if (PredefinedUniform::Count != predefined)
1712            {
1713               kind = "predefined";
1714               m_predefined[m_numPredefined].m_loc = regIndex;
1715               m_predefined[m_numPredefined].m_count = regCount;
1716               m_predefined[m_numPredefined].m_type = predefined|fragmentBit;
1717               m_numPredefined++;
1718            }
1719            else
1720            {
1721               const UniformInfo* info = s_renderD3D9->m_uniformReg.find(name);
1722               BX_CHECK(NULL != info, "User defined uniform '%s' is not found, it won't be set.", name);
1723               if (NULL != info)
1724               {
1725                  kind = "user";
1726                  m_constantBuffer->writeUniformHandle( (UniformType::Enum)(type|fragmentBit), regIndex, info->m_handle, regCount);
1727               }
1728            }
1729
1730            BX_TRACE("\t%s: %s, type %2d, num %2d, r.index %3d, r.count %2d"
1731               , kind
1732               , name
1733               , type
1734               , num
1735               , regIndex
1736               , regCount
1737               );
1738            BX_UNUSED(kind);
1739         }
1740
1741         m_constantBuffer->finish();
1742      }
1743
1744      uint16_t shaderSize;
1745      bx::read(&reader, shaderSize);
1746
1747      const DWORD* code = (const DWORD*)reader.getDataPtr();
1748
1749      if (fragment)
1750      {
1751         m_type = 1;
1752         DX_CHECK(s_renderD3D9->m_device->CreatePixelShader(code, &m_pixelShader) );
1753         BGFX_FATAL(NULL != m_pixelShader, bgfx::Fatal::InvalidShader, "Failed to create fragment shader.");
1754      }
1755      else
1756      {
1757         m_type = 0;
1758         DX_CHECK(s_renderD3D9->m_device->CreateVertexShader(code, &m_vertexShader) );
1759         BGFX_FATAL(NULL != m_vertexShader, bgfx::Fatal::InvalidShader, "Failed to create vertex shader.");
1760      }
1761   }
1762
1763   void TextureD3D9::createTexture(uint32_t _width, uint32_t _height, uint8_t _numMips)
1764   {
1765      m_width = (uint16_t)_width;
1766      m_height = (uint16_t)_height;
1767      m_numMips = _numMips;
1768      m_type = Texture2D;
1769      const TextureFormat::Enum fmt = (TextureFormat::Enum)m_textureFormat;
1770
1771      DWORD usage = 0;
1772      D3DPOOL pool = s_renderD3D9->m_pool;
1773
1774      const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK);
1775      if (isDepth(fmt) )
1776      {
1777         usage = D3DUSAGE_DEPTHSTENCIL;
1778         pool = D3DPOOL_DEFAULT;
1779      }
1780      else if (renderTarget)
1781      {
1782         usage = D3DUSAGE_RENDERTARGET;
1783         pool = D3DPOOL_DEFAULT;
1784      }
1785
1786      if (renderTarget)
1787      {
1788         uint32_t msaaQuality = ( (m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT);
1789         msaaQuality = bx::uint32_satsub(msaaQuality, 1);
1790
1791         bool bufferOnly = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
1792
1793         if (0 != msaaQuality
1794         ||  bufferOnly)
1795         {
1796            const Msaa& msaa = s_msaa[msaaQuality];
1797
1798            if (isDepth(fmt) )
1799            {
1800               DX_CHECK(s_renderD3D9->m_device->CreateDepthStencilSurface(
1801                    m_width
1802                  , m_height
1803                  , s_textureFormat[m_textureFormat].m_fmt
1804                  , msaa.m_type
1805                  , msaa.m_quality
1806                  , FALSE
1807                  , &m_surface
1808                  , NULL
1809                  ) );
1810            }
1811            else
1812            {
1813               DX_CHECK(s_renderD3D9->m_device->CreateRenderTarget(
1814                    m_width
1815                  , m_height
1816                  , s_textureFormat[m_textureFormat].m_fmt
1817                  , msaa.m_type
1818                  , msaa.m_quality
1819                  , FALSE
1820                  , &m_surface
1821                  , NULL
1822                  ) );
1823            }
1824
1825            if (bufferOnly)
1826            {
1827               // This is render buffer, there is no sampling, no need
1828               // to create texture.
1829               return;
1830            }
1831         }
1832      }
1833
1834      DX_CHECK(s_renderD3D9->m_device->CreateTexture(_width
1835         , _height
1836         , _numMips
1837         , usage
1838         , s_textureFormat[fmt].m_fmt
1839         , pool
1840         , &m_texture2d
1841         , NULL
1842         ) );
1843
1844      BGFX_FATAL(NULL != m_texture2d, Fatal::UnableToCreateTexture, "Failed to create texture (size: %dx%d, mips: %d, fmt: %d)."
1845         , _width
1846         , _height
1847         , _numMips
1848         , getName(fmt)
1849         );
1850   }
1851
1852   void TextureD3D9::createVolumeTexture(uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _numMips)
1853   {
1854      m_type = Texture3D;
1855      const TextureFormat::Enum fmt = (TextureFormat::Enum)m_textureFormat;
1856
1857      DX_CHECK(s_renderD3D9->m_device->CreateVolumeTexture(_width
1858         , _height
1859         , _depth
1860         , _numMips
1861         , 0
1862         , s_textureFormat[fmt].m_fmt
1863         , s_renderD3D9->m_pool
1864         , &m_texture3d
1865         , NULL
1866         ) );
1867
1868      BGFX_FATAL(NULL != m_texture3d, Fatal::UnableToCreateTexture, "Failed to create volume texture (size: %dx%dx%d, mips: %d, fmt: %s)."
1869         , _width
1870         , _height
1871         , _depth
1872         , _numMips
1873         , getName(fmt)
1874         );
1875   }
1876
1877   void TextureD3D9::createCubeTexture(uint32_t _edge, uint32_t _numMips)
1878   {
1879      m_type = TextureCube;
1880      const TextureFormat::Enum fmt = (TextureFormat::Enum)m_textureFormat;
1881
1882      DX_CHECK(s_renderD3D9->m_device->CreateCubeTexture(_edge
1883         , _numMips
1884         , 0
1885         , s_textureFormat[fmt].m_fmt
1886         , s_renderD3D9->m_pool
1887         , &m_textureCube
1888         , NULL
1889         ) );
1890
1891      BGFX_FATAL(NULL != m_textureCube, Fatal::UnableToCreateTexture, "Failed to create cube texture (edge: %d, mips: %d, fmt: %s)."
1892         , _edge
1893         , _numMips
1894         , getName(fmt)
1895         );
1896   }
1897
1898   uint8_t* TextureD3D9::lock(uint8_t _side, uint8_t _lod, uint32_t& _pitch, uint32_t& _slicePitch, const Rect* _rect)
1899   {
1900      switch (m_type)
1901      {
1902      case Texture2D:
1903         {
1904            D3DLOCKED_RECT lockedRect;
1905
1906            if (NULL != _rect)
1907            {
1908               RECT rect;
1909               rect.left = _rect->m_x;
1910               rect.top = _rect->m_y;
1911               rect.right = rect.left + _rect->m_width;
1912               rect.bottom = rect.top + _rect->m_height;
1913               DX_CHECK(m_texture2d->LockRect(_lod, &lockedRect, &rect, 0) );
1914            }
1915            else
1916            {
1917               DX_CHECK(m_texture2d->LockRect(_lod, &lockedRect, NULL, 0) );
1918            }
1919
1920            _pitch = lockedRect.Pitch;
1921            _slicePitch = 0;
1922            return (uint8_t*)lockedRect.pBits;
1923         }
1924
1925      case Texture3D:
1926         {
1927            D3DLOCKED_BOX box;
1928            DX_CHECK(m_texture3d->LockBox(_lod, &box, NULL, 0) );
1929            _pitch = box.RowPitch;
1930            _slicePitch = box.SlicePitch;
1931            return (uint8_t*)box.pBits;
1932         }
1933
1934      case TextureCube:
1935         {
1936            D3DLOCKED_RECT lockedRect;
1937
1938            if (NULL != _rect)
1939            {
1940               RECT rect;
1941               rect.left = _rect->m_x;
1942               rect.top = _rect->m_y;
1943               rect.right = rect.left + _rect->m_width;
1944               rect.bottom = rect.top + _rect->m_height;
1945               DX_CHECK(m_textureCube->LockRect(D3DCUBEMAP_FACES(_side), _lod, &lockedRect, &rect, 0) );
1946            }
1947            else
1948            {
1949               DX_CHECK(m_textureCube->LockRect(D3DCUBEMAP_FACES(_side), _lod, &lockedRect, NULL, 0) );
1950            }
1951
1952            _pitch = lockedRect.Pitch;
1953            _slicePitch = 0;
1954            return (uint8_t*)lockedRect.pBits;
1955         }
1956      }
1957
1958      BX_CHECK(false, "You should not be here.");
1959      _pitch = 0;
1960      _slicePitch = 0;
1961      return NULL;
1962   }
1963
1964   void TextureD3D9::unlock(uint8_t _side, uint8_t _lod)
1965   {
1966      switch (m_type)
1967      {
1968      case Texture2D:
1969         {
1970            DX_CHECK(m_texture2d->UnlockRect(_lod) );
1971         }
1972         return;
1973
1974      case Texture3D:
1975         {
1976            DX_CHECK(m_texture3d->UnlockBox(_lod) );
1977         }
1978         return;
1979
1980      case TextureCube:
1981         {
1982            DX_CHECK(m_textureCube->UnlockRect(D3DCUBEMAP_FACES(_side), _lod) );
1983         }
1984         return;
1985      }
1986
1987      BX_CHECK(false, "You should not be here.");
1988   }
1989
1990   void TextureD3D9::dirty(uint8_t _side, const Rect& _rect, uint16_t _z, uint16_t _depth)
1991   {
1992      switch (m_type)
1993      {
1994      case Texture2D:
1995         {
1996            RECT rect;
1997            rect.left = _rect.m_x;
1998            rect.top = _rect.m_y;
1999            rect.right = rect.left + _rect.m_width;
2000            rect.bottom = rect.top + _rect.m_height;
2001            DX_CHECK(m_texture2d->AddDirtyRect(&rect) );
2002         }
2003         return;
2004
2005      case Texture3D:
2006         {
2007            D3DBOX box;
2008            box.Left = _rect.m_x;
2009            box.Top = _rect.m_y;
2010            box.Right = box.Left + _rect.m_width;
2011            box.Bottom = box.Top + _rect.m_height;
2012            box.Front = _z;
2013            box.Back = box.Front + _depth;
2014            DX_CHECK(m_texture3d->AddDirtyBox(&box) );
2015         }
2016         return;
2017
2018      case TextureCube:
2019         {
2020            RECT rect;
2021            rect.left = _rect.m_x;
2022            rect.top = _rect.m_y;
2023            rect.right = rect.left + _rect.m_width;
2024            rect.bottom = rect.top + _rect.m_height;
2025            DX_CHECK(m_textureCube->AddDirtyRect(D3DCUBEMAP_FACES(_side), &rect) );
2026         }
2027         return;
2028      }
2029
2030      BX_CHECK(false, "You should not be here.");
2031   }
2032
2033   void TextureD3D9::create(const Memory* _mem, uint32_t _flags, uint8_t _skip)
2034   {
2035      m_flags = _flags;
2036
2037      ImageContainer imageContainer;
2038
2039      if (imageParse(imageContainer, _mem->data, _mem->size) )
2040      {
2041         uint8_t numMips = imageContainer.m_numMips;
2042         const uint32_t startLod = bx::uint32_min(_skip, numMips-1);
2043         numMips -= startLod;
2044         const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
2045         const uint32_t textureWidth  = bx::uint32_max(blockInfo.blockWidth,  imageContainer.m_width >>startLod);
2046         const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
2047
2048         m_requestedFormat = imageContainer.m_format;
2049         m_textureFormat   = imageContainer.m_format;
2050
2051         const TextureFormatInfo& tfi = s_textureFormat[m_requestedFormat];
2052         const bool convert = D3DFMT_UNKNOWN == tfi.m_fmt;
2053
2054         uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
2055         if (convert)
2056         {
2057            m_textureFormat = (uint8_t)TextureFormat::BGRA8;
2058            bpp = 32;
2059         }
2060
2061         if (imageContainer.m_cubeMap)
2062         {
2063            createCubeTexture(textureWidth, numMips);
2064         }
2065         else if (imageContainer.m_depth > 1)
2066         {
2067            createVolumeTexture(textureWidth, textureHeight, imageContainer.m_depth, numMips);
2068         }
2069         else
2070         {
2071            createTexture(textureWidth, textureHeight, numMips);
2072         }
2073
2074         BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s%s."
2075            , this - s_renderD3D9->m_textures
2076            , getName( (TextureFormat::Enum)m_textureFormat)
2077            , getName( (TextureFormat::Enum)m_requestedFormat)
2078            , textureWidth
2079            , textureHeight
2080            , imageContainer.m_cubeMap ? "x6" : ""
2081            , 0 != (m_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : ""
2082            );
2083
2084         if (0 != (_flags&BGFX_TEXTURE_RT_BUFFER_ONLY) )
2085         {
2086            return;
2087         }
2088
2089         // For BC4 and B5 in DX9 LockRect returns wrong number of
2090         // bytes. If actual mip size is used it causes memory corruption.
2091         // http://www.aras-p.info/texts/D3D9GPUHacks.html#3dc
2092         const bool useMipSize = true
2093                     && imageContainer.m_format != TextureFormat::BC4
2094                     && imageContainer.m_format != TextureFormat::BC5
2095                     ;
2096
2097         for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
2098         {
2099            uint32_t width     = textureWidth;
2100            uint32_t height    = textureHeight;
2101            uint32_t depth     = imageContainer.m_depth;
2102            uint32_t mipWidth  = imageContainer.m_width;
2103            uint32_t mipHeight = imageContainer.m_height;
2104
2105            for (uint32_t lod = 0, num = numMips; lod < num; ++lod)
2106            {
2107               width     = bx::uint32_max(1, width);
2108               height    = bx::uint32_max(1, height);
2109               depth     = bx::uint32_max(1, depth);
2110               mipWidth  = bx::uint32_max(blockInfo.blockWidth,  mipWidth);
2111               mipHeight = bx::uint32_max(blockInfo.blockHeight, mipHeight);
2112               uint32_t mipSize = width*height*depth*bpp/8;
2113
2114               ImageMip mip;
2115               if (imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) )
2116               {
2117                  uint32_t pitch;
2118                  uint32_t slicePitch;
2119                  uint8_t* bits = lock(side, lod, pitch, slicePitch);
2120
2121                  if (convert)
2122                  {
2123                     if (width  != mipWidth
2124                     ||  height != mipHeight)
2125                     {
2126                        uint32_t srcpitch = mipWidth*bpp/8;
2127
2128                        uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, srcpitch*mipHeight);
2129                        imageDecodeToBgra8(temp, mip.m_data, mip.m_width, mip.m_height, srcpitch, mip.m_format);
2130
2131                        uint32_t dstpitch = pitch;
2132                        for (uint32_t yy = 0; yy < height; ++yy)
2133                        {
2134                           uint8_t* src = &temp[yy*srcpitch];
2135                           uint8_t* dst = &bits[yy*dstpitch];
2136                           memcpy(dst, src, dstpitch);
2137                        }
2138
2139                        BX_FREE(g_allocator, temp);
2140                     }
2141                     else
2142                     {
2143                        imageDecodeToBgra8(bits, mip.m_data, mip.m_width, mip.m_height, pitch, mip.m_format);
2144                     }
2145                  }
2146                  else
2147                  {
2148                     uint32_t size = useMipSize ? mip.m_size : mipSize;
2149                     memcpy(bits, mip.m_data, size);
2150                  }
2151
2152                  unlock(side, lod);
2153               }
2154
2155               width     >>= 1;
2156               height    >>= 1;
2157               depth     >>= 1;
2158               mipWidth  >>= 1;
2159               mipHeight >>= 1;
2160            }
2161         }
2162      }
2163   }
2164
2165   void TextureD3D9::updateBegin(uint8_t _side, uint8_t _mip)
2166   {
2167      uint32_t slicePitch;
2168      s_renderD3D9->m_updateTextureSide = _side;
2169      s_renderD3D9->m_updateTextureMip = _mip;
2170      s_renderD3D9->m_updateTextureBits = lock(_side, _mip, s_renderD3D9->m_updateTexturePitch, slicePitch);
2171   }
2172
2173   void TextureD3D9::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)
2174   {
2175      const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
2176      const uint32_t rectpitch = _rect.m_width*bpp/8;
2177      const uint32_t srcpitch  = UINT16_MAX == _pitch ? rectpitch : _pitch;
2178      const uint32_t dstpitch  = s_renderD3D9->m_updateTexturePitch;
2179      uint8_t* bits = s_renderD3D9->m_updateTextureBits + _rect.m_y*dstpitch + _rect.m_x*bpp/8;
2180
2181      const bool convert = m_textureFormat != m_requestedFormat;
2182     
2183      uint8_t* data = _mem->data;
2184      uint8_t* temp = NULL;
2185
2186      if (convert)
2187      {
2188         uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
2189         imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, m_requestedFormat);
2190         data = temp;
2191      }
2192
2193      {
2194         uint8_t* src = data;
2195         uint8_t* dst = bits;
2196         for (uint32_t yy = 0, height = _rect.m_height; yy < height; ++yy)
2197         {
2198            memcpy(dst, src, rectpitch);
2199            src += srcpitch;
2200            dst += dstpitch;
2201         }
2202      }
2203
2204      if (NULL != temp)
2205      {
2206         BX_FREE(g_allocator, temp);
2207      }
2208
2209      if (0 == _mip)
2210      {
2211         dirty(_side, _rect, _z, _depth);
2212      }
2213   }
2214
2215   void TextureD3D9::updateEnd()
2216   {
2217      unlock(s_renderD3D9->m_updateTextureSide, s_renderD3D9->m_updateTextureMip);
2218   }
2219
2220   void TextureD3D9::commit(uint8_t _stage, uint32_t _flags)
2221   {
2222      s_renderD3D9->setSamplerState(_stage, 0 == (BGFX_SAMPLER_DEFAULT_FLAGS & _flags) ? _flags : m_flags);
2223      DX_CHECK(s_renderD3D9->m_device->SetTexture(_stage, m_ptr) );
2224   }
2225
2226   void TextureD3D9::resolve() const
2227   {
2228      if (NULL != m_surface
2229      &&  NULL != m_texture2d)
2230      {
2231         IDirect3DSurface9* surface;
2232         DX_CHECK(m_texture2d->GetSurfaceLevel(0, &surface) );
2233         DX_CHECK(s_renderD3D9->m_device->StretchRect(m_surface
2234            , NULL
2235            , surface
2236            , NULL
2237            , D3DTEXF_LINEAR
2238            ) );
2239         DX_RELEASE(surface, 1);
2240      }
2241   }
2242
2243   void TextureD3D9::preReset()
2244   {
2245      TextureFormat::Enum fmt = (TextureFormat::Enum)m_textureFormat;
2246      if (TextureFormat::Unknown != fmt
2247      && (isDepth(fmt) || !!(m_flags&BGFX_TEXTURE_RT_MASK) ) )
2248      {
2249         DX_RELEASE(m_ptr, 0);
2250         DX_RELEASE(m_surface, 0);
2251      }
2252   }
2253
2254   void TextureD3D9::postReset()
2255   {
2256      TextureFormat::Enum fmt = (TextureFormat::Enum)m_textureFormat;
2257      if (TextureFormat::Unknown != fmt
2258      && (isDepth(fmt) || !!(m_flags&BGFX_TEXTURE_RT_MASK) ) )
2259      {
2260         createTexture(m_width, m_height, m_numMips);
2261      }
2262   }
2263
2264   void FrameBufferD3D9::create(uint8_t _num, const TextureHandle* _handles)
2265   {
2266      for (uint32_t ii = 0; ii < BX_COUNTOF(m_color); ++ii)
2267      {
2268         m_color[ii] = NULL;
2269      }
2270      m_depthStencil = NULL;
2271
2272      m_num = 0;
2273      m_needResolve = false;
2274      for (uint32_t ii = 0; ii < _num; ++ii)
2275      {
2276         TextureHandle handle = _handles[ii];
2277         if (isValid(handle) )
2278         {
2279            const TextureD3D9& texture = s_renderD3D9->m_textures[handle.idx];
2280
2281            if (isDepth( (TextureFormat::Enum)texture.m_textureFormat) )
2282            {
2283               m_depthHandle = handle;
2284               if (NULL != texture.m_surface)
2285               {
2286                  m_depthStencil = texture.m_surface;
2287                  m_depthStencil->AddRef();
2288               }
2289               else
2290               {
2291                  DX_CHECK(texture.m_texture2d->GetSurfaceLevel(0, &m_depthStencil) );
2292               }
2293            }
2294            else
2295            {
2296               m_colorHandle[m_num] = handle;
2297               if (NULL != texture.m_surface)
2298               {
2299                  m_color[m_num] = texture.m_surface;
2300                  m_color[m_num]->AddRef();
2301               }
2302               else
2303               {
2304                  DX_CHECK(texture.m_texture2d->GetSurfaceLevel(0, &m_color[m_num]) );
2305               }
2306               m_num++;
2307            }
2308
2309            m_needResolve |= (NULL != texture.m_surface) && (NULL != texture.m_texture2d);
2310         }
2311      }
2312
2313      if (0 == m_num)
2314      {
2315         createNullColorRT();
2316      }
2317   }
2318
2319   void FrameBufferD3D9::destroy()
2320   {
2321      for (uint32_t ii = 0, num = m_num; ii < num; ++ii)
2322      {
2323         m_colorHandle[ii].idx = invalidHandle;
2324
2325         IDirect3DSurface9* ptr = m_color[ii];
2326         if (NULL != ptr)
2327         {
2328            ptr->Release();
2329            m_color[ii] = NULL;
2330         }
2331      }
2332
2333      if (NULL != m_depthStencil)
2334      {
2335         if (0 == m_num)
2336         {
2337            IDirect3DSurface9* ptr = m_color[0];
2338            if (NULL != ptr)
2339            {
2340               ptr->Release();
2341               m_color[0] = NULL;
2342            }
2343         }
2344
2345         m_depthStencil->Release();
2346         m_depthStencil = NULL;
2347      }
2348
2349      m_num = 0;
2350      m_depthHandle.idx = invalidHandle;
2351   }
2352
2353   void FrameBufferD3D9::resolve() const
2354   {
2355      if (m_needResolve)
2356      {
2357         if (isValid(m_depthHandle) )
2358         {
2359            const TextureD3D9& texture = s_renderD3D9->m_textures[m_depthHandle.idx];
2360            texture.resolve();
2361         }
2362
2363         for (uint32_t ii = 0, num = m_num; ii < num; ++ii)
2364         {
2365            const TextureD3D9& texture = s_renderD3D9->m_textures[m_colorHandle[ii].idx];
2366            texture.resolve();
2367         }
2368      }
2369   }
2370
2371   void FrameBufferD3D9::preReset()
2372   {
2373      for (uint32_t ii = 0, num = m_num; ii < num; ++ii)
2374      {
2375         m_color[ii]->Release();
2376         m_color[ii] = NULL;
2377      }
2378
2379      if (isValid(m_depthHandle) )
2380      {
2381         if (0 == m_num)
2382         {
2383            m_color[0]->Release();
2384            m_color[0] = NULL;
2385         }
2386
2387         m_depthStencil->Release();
2388         m_depthStencil = NULL;
2389      }
2390   }
2391
2392   void FrameBufferD3D9::postReset()
2393   {
2394      for (uint32_t ii = 0, num = m_num; ii < num; ++ii)
2395      {
2396         TextureD3D9& texture = s_renderD3D9->m_textures[m_colorHandle[ii].idx];
2397         if (NULL != texture.m_surface)
2398         {
2399            m_color[ii] = texture.m_surface;
2400            m_color[ii]->AddRef();
2401         }
2402         else
2403         {
2404            DX_CHECK(texture.m_texture2d->GetSurfaceLevel(0, &m_color[ii]) );
2405         }
2406      }
2407
2408      if (isValid(m_depthHandle) )
2409      {
2410         TextureD3D9& texture = s_renderD3D9->m_textures[m_depthHandle.idx];
2411         if (NULL != texture.m_surface)
2412         {
2413            m_depthStencil = texture.m_surface;
2414            m_depthStencil->AddRef();
2415         }
2416         else
2417         {
2418            DX_CHECK(texture.m_texture2d->GetSurfaceLevel(0, &m_depthStencil) );
2419         }
2420
2421         if (0 == m_num)
2422         {
2423            createNullColorRT();
2424         }
2425      }
2426   }
2427
2428   void FrameBufferD3D9::createNullColorRT()
2429   {
2430      const TextureD3D9& texture = s_renderD3D9->m_textures[m_depthHandle.idx];
2431      DX_CHECK(s_renderD3D9->m_device->CreateRenderTarget(texture.m_width
2432         , texture.m_height
2433         , D3DFMT_NULL
2434         , D3DMULTISAMPLE_NONE
2435         , 0
2436         , false
2437         , &m_color[0]
2438         , NULL
2439         ) );
2440   }
2441
2442   void RendererContextD3D9::submit(Frame* _render, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& _textVideoMemBlitter)
2443   {
2444      IDirect3DDevice9* device = m_device;
2445
2446      PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
2447
2448      updateResolution(_render->m_resolution);
2449
2450      int64_t elapsed = -bx::getHPCounter();
2451      int64_t captureElapsed = 0;
2452
2453      device->BeginScene();
2454
2455      if (0 < _render->m_iboffset)
2456      {
2457         TransientIndexBuffer* ib = _render->m_transientIb;
2458         m_indexBuffers[ib->handle.idx].update(0, _render->m_iboffset, ib->data, true);
2459      }
2460
2461      if (0 < _render->m_vboffset)
2462      {
2463         TransientVertexBuffer* vb = _render->m_transientVb;
2464         m_vertexBuffers[vb->handle.idx].update(0, _render->m_vboffset, vb->data, true);
2465      }
2466
2467      _render->sort();
2468
2469      RenderDraw currentState;
2470      currentState.clear();
2471      currentState.m_flags = BGFX_STATE_NONE;
2472      currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE);
2473
2474      Matrix4 viewProj[BGFX_CONFIG_MAX_VIEWS];
2475      for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
2476      {
2477         bx::float4x4_mul(&viewProj[ii].un.f4x4, &_render->m_view[ii].un.f4x4, &_render->m_proj[ii].un.f4x4);
2478      }
2479
2480      Matrix4 invView;
2481      Matrix4 invProj;
2482      Matrix4 invViewProj;
2483      uint8_t invViewCached = 0xff;
2484      uint8_t invProjCached = 0xff;
2485      uint8_t invViewProjCached = 0xff;
2486
2487      DX_CHECK(device->SetRenderState(D3DRS_FILLMODE, _render->m_debug&BGFX_DEBUG_WIREFRAME ? D3DFILL_WIREFRAME : D3DFILL_SOLID) );
2488      uint16_t programIdx = invalidHandle;
2489      SortKey key;
2490      uint8_t view = 0xff;
2491      FrameBufferHandle fbh = BGFX_INVALID_HANDLE;
2492      float alphaRef = 0.0f;
2493      uint32_t blendFactor = 0;
2494
2495      const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : 0;
2496      uint8_t primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
2497      PrimInfo prim = s_primInfo[primIndex];
2498
2499      bool viewHasScissor = false;
2500      Rect viewScissorRect;
2501      viewScissorRect.clear();
2502
2503      uint32_t statsNumPrimsSubmitted[BX_COUNTOF(s_primInfo)] = {};
2504      uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {};
2505      uint32_t statsNumInstances[BX_COUNTOF(s_primInfo)] = {};
2506      uint32_t statsNumIndices = 0;
2507
2508      invalidateSamplerState();
2509
2510      if (0 == (_render->m_debug&BGFX_DEBUG_IFH) )
2511      {
2512         for (uint32_t item = 0, numItems = _render->m_num; item < numItems; ++item)
2513         {
2514            const bool isCompute = key.decode(_render->m_sortKeys[item]);
2515
2516            if (isCompute)
2517            {
2518               BX_CHECK(false, "Compute is not supported on DirectX 9.");
2519               continue;
2520            }
2521
2522            const RenderDraw& draw = _render->m_renderItem[_render->m_sortValues[item] ].draw;
2523
2524            const uint64_t newFlags = draw.m_flags;
2525            uint64_t changedFlags = currentState.m_flags ^ draw.m_flags;
2526            currentState.m_flags = newFlags;
2527
2528            const uint64_t newStencil = draw.m_stencil;
2529            uint64_t changedStencil = currentState.m_stencil ^ draw.m_stencil;
2530            currentState.m_stencil = newStencil;
2531
2532            if (key.m_view != view)
2533            {
2534               currentState.clear();
2535               currentState.m_scissor = !draw.m_scissor;
2536               changedFlags = BGFX_STATE_MASK;
2537               changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK);
2538               currentState.m_flags = newFlags;
2539               currentState.m_stencil = newStencil;
2540
2541               PIX_ENDEVENT();
2542               PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), s_viewNameW[key.m_view]);
2543
2544               view = key.m_view;
2545               programIdx = invalidHandle;
2546
2547               if (_render->m_fb[view].idx != fbh.idx)
2548               {
2549                  fbh = _render->m_fb[view];
2550                  setFrameBuffer(fbh);
2551               }
2552
2553               const Rect& rect = _render->m_rect[view];
2554               const Rect& scissorRect = _render->m_scissor[view];
2555               viewHasScissor = !scissorRect.isZero();
2556               viewScissorRect = viewHasScissor ? scissorRect : rect;
2557
2558               D3DVIEWPORT9 vp;
2559               vp.X = rect.m_x;
2560               vp.Y = rect.m_y;
2561               vp.Width = rect.m_width;
2562               vp.Height = rect.m_height;
2563               vp.MinZ = 0.0f;
2564               vp.MaxZ = 1.0f;
2565               DX_CHECK(device->SetViewport(&vp) );
2566
2567               Clear& clear = _render->m_clear[view];
2568
2569               if (BGFX_CLEAR_NONE != clear.m_flags)
2570               {
2571                  D3DCOLOR color = 0;
2572                  DWORD flags = 0;
2573
2574                  if (BGFX_CLEAR_COLOR_BIT & clear.m_flags)
2575                  {
2576                     flags |= D3DCLEAR_TARGET;
2577                     uint32_t rgba = clear.m_rgba;
2578                     color = D3DCOLOR_RGBA(rgba>>24, (rgba>>16)&0xff, (rgba>>8)&0xff, rgba&0xff);
2579                     DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE|D3DCOLORWRITEENABLE_ALPHA) );
2580                  }
2581
2582                  if (BGFX_CLEAR_DEPTH_BIT & clear.m_flags)
2583                  {
2584                     flags |= D3DCLEAR_ZBUFFER;
2585                     DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, TRUE) );
2586                  }
2587
2588                  if (BGFX_CLEAR_STENCIL_BIT & clear.m_flags)
2589                  {
2590                     flags |= D3DCLEAR_STENCIL;
2591                  }
2592
2593                  if (0 != flags)
2594                  {
2595                     RECT rc;
2596                     rc.left = rect.m_x;
2597                     rc.top = rect.m_y;
2598                     rc.right = rect.m_x + rect.m_width;
2599                     rc.bottom = rect.m_y + rect.m_height;
2600                     DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE) );
2601                     DX_CHECK(device->SetScissorRect(&rc) );
2602                     DX_CHECK(device->Clear(0, NULL, flags, color, clear.m_depth, clear.m_stencil) );
2603                     DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE) );
2604                  }
2605               }
2606
2607               DX_CHECK(device->SetRenderState(D3DRS_STENCILENABLE, FALSE) );
2608               DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, TRUE) );
2609               DX_CHECK(device->SetRenderState(D3DRS_ZFUNC, D3DCMP_LESS) );
2610               DX_CHECK(device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE) );
2611               DX_CHECK(device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE) );
2612               DX_CHECK(device->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER) );
2613            }
2614
2615            uint16_t scissor = draw.m_scissor;
2616            if (currentState.m_scissor != scissor)
2617            {
2618               currentState.m_scissor = scissor;
2619
2620               if (UINT16_MAX == scissor)
2621               {
2622                  DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, viewHasScissor) );
2623                  if (viewHasScissor)
2624                  {
2625                     RECT rc;
2626                     rc.left = viewScissorRect.m_x;
2627                     rc.top = viewScissorRect.m_y;
2628                     rc.right = viewScissorRect.m_x + viewScissorRect.m_width;
2629                     rc.bottom = viewScissorRect.m_y + viewScissorRect.m_height;
2630                     DX_CHECK(device->SetScissorRect(&rc) );
2631                  }
2632               }
2633               else
2634               {
2635                  Rect scissorRect;
2636                  scissorRect.intersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]);
2637                  DX_CHECK(device->SetRenderState(D3DRS_SCISSORTESTENABLE, true) );
2638                  RECT rc;
2639                  rc.left = scissorRect.m_x;
2640                  rc.top = scissorRect.m_y;
2641                  rc.right = scissorRect.m_x + scissorRect.m_width;
2642                  rc.bottom = scissorRect.m_y + scissorRect.m_height;
2643                  DX_CHECK(device->SetScissorRect(&rc) );
2644               }
2645            }
2646
2647            if (0 != changedStencil)
2648            {
2649               bool enable = 0 != newStencil;
2650               DX_CHECK(device->SetRenderState(D3DRS_STENCILENABLE, enable) );
2651               
2652               if (0 != newStencil)
2653               {
2654                  uint32_t fstencil = unpackStencil(0, newStencil);
2655                  uint32_t bstencil = unpackStencil(1, newStencil);
2656                  uint32_t frontAndBack = bstencil != BGFX_STENCIL_NONE && bstencil != fstencil;
2657                  DX_CHECK(device->SetRenderState(D3DRS_TWOSIDEDSTENCILMODE, 0 != frontAndBack) );
2658
2659                  uint32_t fchanged = unpackStencil(0, changedStencil);
2660                  if ( (BGFX_STENCIL_FUNC_REF_MASK|BGFX_STENCIL_FUNC_RMASK_MASK) & fchanged)
2661                  {
2662                     uint32_t ref = (fstencil&BGFX_STENCIL_FUNC_REF_MASK)>>BGFX_STENCIL_FUNC_REF_SHIFT;
2663                     DX_CHECK(device->SetRenderState(D3DRS_STENCILREF, ref) );
2664
2665                     uint32_t rmask = (fstencil&BGFX_STENCIL_FUNC_RMASK_MASK)>>BGFX_STENCIL_FUNC_RMASK_SHIFT;
2666                     DX_CHECK(device->SetRenderState(D3DRS_STENCILMASK, rmask) );
2667                  }
2668
2669//                   uint32_t bchanged = unpackStencil(1, changedStencil);
2670//                   if (BGFX_STENCIL_FUNC_RMASK_MASK & bchanged)
2671//                   {
2672//                      uint32_t wmask = (bstencil&BGFX_STENCIL_FUNC_RMASK_MASK)>>BGFX_STENCIL_FUNC_RMASK_SHIFT;
2673//                      DX_CHECK(device->SetRenderState(D3DRS_STENCILWRITEMASK, wmask) );
2674//                   }
2675
2676                  for (uint32_t ii = 0, num = frontAndBack+1; ii < num; ++ii)
2677                  {
2678                     uint32_t stencil = unpackStencil(ii, newStencil);
2679                     uint32_t changed = unpackStencil(ii, changedStencil);
2680
2681                     if ( (BGFX_STENCIL_TEST_MASK|BGFX_STENCIL_FUNC_REF_MASK|BGFX_STENCIL_FUNC_RMASK_MASK) & changed)
2682                     {
2683                        uint32_t func = (stencil&BGFX_STENCIL_TEST_MASK)>>BGFX_STENCIL_TEST_SHIFT;
2684                        DX_CHECK(device->SetRenderState(s_stencilFuncRs[ii], s_cmpFunc[func]) );
2685                     }
2686
2687                     if ( (BGFX_STENCIL_OP_FAIL_S_MASK|BGFX_STENCIL_OP_FAIL_Z_MASK|BGFX_STENCIL_OP_PASS_Z_MASK) & changed)
2688                     {
2689                        uint32_t sfail = (stencil&BGFX_STENCIL_OP_FAIL_S_MASK)>>BGFX_STENCIL_OP_FAIL_S_SHIFT;
2690                        DX_CHECK(device->SetRenderState(s_stencilFailRs[ii], s_stencilOp[sfail]) );
2691
2692                        uint32_t zfail = (stencil&BGFX_STENCIL_OP_FAIL_Z_MASK)>>BGFX_STENCIL_OP_FAIL_Z_SHIFT;
2693                        DX_CHECK(device->SetRenderState(s_stencilZFailRs[ii], s_stencilOp[zfail]) );
2694
2695                        uint32_t zpass = (stencil&BGFX_STENCIL_OP_PASS_Z_MASK)>>BGFX_STENCIL_OP_PASS_Z_SHIFT;
2696                        DX_CHECK(device->SetRenderState(s_stencilZPassRs[ii], s_stencilOp[zpass]) );
2697                     }
2698                  }
2699               }
2700            }
2701
2702            if ( (0
2703                | BGFX_STATE_CULL_MASK
2704                | BGFX_STATE_DEPTH_WRITE
2705                | BGFX_STATE_DEPTH_TEST_MASK
2706                | BGFX_STATE_RGB_WRITE
2707                | BGFX_STATE_ALPHA_WRITE
2708                | BGFX_STATE_BLEND_MASK
2709                | BGFX_STATE_BLEND_EQUATION_MASK
2710                | BGFX_STATE_ALPHA_REF_MASK
2711                | BGFX_STATE_PT_MASK
2712                | BGFX_STATE_POINT_SIZE_MASK
2713                | BGFX_STATE_MSAA
2714                ) & changedFlags)
2715            {
2716               if (BGFX_STATE_CULL_MASK & changedFlags)
2717               {
2718                  uint32_t cull = (newFlags&BGFX_STATE_CULL_MASK)>>BGFX_STATE_CULL_SHIFT;
2719                  DX_CHECK(device->SetRenderState(D3DRS_CULLMODE, s_cullMode[cull]) );
2720               }
2721
2722               if (BGFX_STATE_DEPTH_WRITE & changedFlags)
2723               {
2724                  DX_CHECK(device->SetRenderState(D3DRS_ZWRITEENABLE, !!(BGFX_STATE_DEPTH_WRITE & newFlags) ) );
2725               }
2726
2727               if (BGFX_STATE_DEPTH_TEST_MASK & changedFlags)
2728               {
2729                  uint32_t func = (newFlags&BGFX_STATE_DEPTH_TEST_MASK)>>BGFX_STATE_DEPTH_TEST_SHIFT;
2730                  DX_CHECK(device->SetRenderState(D3DRS_ZENABLE, 0 != func) );
2731
2732                  if (0 != func)
2733                  {
2734                     DX_CHECK(device->SetRenderState(D3DRS_ZFUNC, s_cmpFunc[func]) );
2735                  }
2736               }
2737
2738               if (BGFX_STATE_ALPHA_REF_MASK & changedFlags)
2739               {
2740                  uint32_t ref = (newFlags&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT;
2741                  alphaRef = ref/255.0f;
2742               }
2743
2744               if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags)
2745               {
2746                  DX_CHECK(device->SetRenderState(D3DRS_POINTSIZE, castfu( (float)( (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) ) ) );
2747               }
2748
2749               if (BGFX_STATE_MSAA & changedFlags)
2750               {
2751                  DX_CHECK(device->SetRenderState(D3DRS_MULTISAMPLEANTIALIAS, (newFlags&BGFX_STATE_MSAA) == BGFX_STATE_MSAA) );
2752               }
2753
2754               if ( (BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags)
2755               {
2756                  uint32_t writeEnable = (newFlags&BGFX_STATE_ALPHA_WRITE) ? D3DCOLORWRITEENABLE_ALPHA : 0;
2757                   writeEnable |= (newFlags&BGFX_STATE_RGB_WRITE) ? D3DCOLORWRITEENABLE_RED|D3DCOLORWRITEENABLE_GREEN|D3DCOLORWRITEENABLE_BLUE : 0;
2758                  DX_CHECK(device->SetRenderState(D3DRS_COLORWRITEENABLE, writeEnable) );
2759               }
2760
2761               if ( (BGFX_STATE_BLEND_MASK|BGFX_STATE_BLEND_EQUATION_MASK) & changedFlags
2762               ||  blendFactor != draw.m_rgba)
2763               {
2764                  bool enabled = !!(BGFX_STATE_BLEND_MASK & newFlags);
2765                  DX_CHECK(device->SetRenderState(D3DRS_ALPHABLENDENABLE, enabled) );
2766
2767                  if (enabled)
2768                  {
2769                     const uint32_t blend    = uint32_t( (newFlags&BGFX_STATE_BLEND_MASK)>>BGFX_STATE_BLEND_SHIFT);
2770                     const uint32_t equation = uint32_t( (newFlags&BGFX_STATE_BLEND_EQUATION_MASK)>>BGFX_STATE_BLEND_EQUATION_SHIFT);
2771
2772                     const uint32_t srcRGB  = (blend    )&0xf;
2773                     const uint32_t dstRGB  = (blend>> 4)&0xf;
2774                     const uint32_t srcA    = (blend>> 8)&0xf;
2775                     const uint32_t dstA    = (blend>>12)&0xf;
2776
2777                     const uint32_t equRGB = (equation   )&0x7;
2778                     const uint32_t equA   = (equation>>3)&0x7;
2779
2780                      DX_CHECK(device->SetRenderState(D3DRS_SRCBLEND,  s_blendFactor[srcRGB].m_src) );
2781                     DX_CHECK(device->SetRenderState(D3DRS_DESTBLEND, s_blendFactor[dstRGB].m_dst) );
2782                     DX_CHECK(device->SetRenderState(D3DRS_BLENDOP,   s_blendEquation[equRGB]) );
2783
2784                     const bool separate = srcRGB != srcA || dstRGB != dstA || equRGB != equA;
2785
2786                     DX_CHECK(device->SetRenderState(D3DRS_SEPARATEALPHABLENDENABLE, separate) );
2787                     if (separate)
2788                     {
2789                        DX_CHECK(device->SetRenderState(D3DRS_SRCBLENDALPHA,  s_blendFactor[srcA].m_src) );
2790                        DX_CHECK(device->SetRenderState(D3DRS_DESTBLENDALPHA, s_blendFactor[dstA].m_dst) );
2791                        DX_CHECK(device->SetRenderState(D3DRS_BLENDOPALPHA,   s_blendEquation[equA]) );
2792                     }
2793
2794                     if ( (s_blendFactor[srcRGB].m_factor || s_blendFactor[dstRGB].m_factor)
2795                     &&  blendFactor != draw.m_rgba)
2796                     {
2797                        const uint32_t rgba = draw.m_rgba;
2798                        D3DCOLOR color = D3DCOLOR_RGBA(rgba>>24
2799                                             , (rgba>>16)&0xff
2800                                             , (rgba>> 8)&0xff
2801                                             , (rgba    )&0xff
2802                                             );
2803                        DX_CHECK(device->SetRenderState(D3DRS_BLENDFACTOR, color) );
2804                     }
2805                  }
2806
2807                  blendFactor = draw.m_rgba;
2808               }
2809
2810               const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : newFlags&BGFX_STATE_PT_MASK;
2811               primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
2812               prim = s_primInfo[primIndex];
2813            }
2814
2815            bool programChanged = false;
2816            bool constantsChanged = draw.m_constBegin < draw.m_constEnd;
2817            rendererUpdateUniforms(this, _render->m_constantBuffer, draw.m_constBegin, draw.m_constEnd);
2818
2819            if (key.m_program != programIdx)
2820            {
2821               programIdx = key.m_program;
2822
2823               if (invalidHandle == programIdx)
2824               {
2825                  device->SetVertexShader(NULL);
2826                  device->SetPixelShader(NULL);
2827               }
2828               else
2829               {
2830                  ProgramD3D9& program = m_program[programIdx];
2831                  device->SetVertexShader(program.m_vsh->m_vertexShader);
2832                  device->SetPixelShader(program.m_fsh->m_pixelShader);
2833               }
2834
2835               programChanged =
2836                  constantsChanged = true;
2837            }
2838
2839            if (invalidHandle != programIdx)
2840            {
2841               ProgramD3D9& program = m_program[programIdx];
2842
2843               if (constantsChanged)
2844               {
2845                  ConstantBuffer* vcb = program.m_vsh->m_constantBuffer;
2846                  if (NULL != vcb)
2847                  {
2848                     commit(*vcb);
2849                  }
2850
2851                  ConstantBuffer* fcb = program.m_fsh->m_constantBuffer;
2852                  if (NULL != fcb)
2853                  {
2854                     commit(*fcb);
2855                  }
2856               }
2857
2858               for (uint32_t ii = 0, num = program.m_numPredefined; ii < num; ++ii)
2859               {
2860                  PredefinedUniform& predefined = program.m_predefined[ii];
2861                  uint8_t flags = predefined.m_type&BGFX_UNIFORM_FRAGMENTBIT;
2862                  switch (predefined.m_type&(~BGFX_UNIFORM_FRAGMENTBIT) )
2863                  {
2864                  case PredefinedUniform::ViewRect:
2865                     {
2866                        float rect[4];
2867                        rect[0] = _render->m_rect[view].m_x;
2868                        rect[1] = _render->m_rect[view].m_y;
2869                        rect[2] = _render->m_rect[view].m_width;
2870                        rect[3] = _render->m_rect[view].m_height;
2871
2872                        setShaderConstantF(flags, predefined.m_loc, &rect[0], 1);
2873                     }
2874                     break;
2875
2876                  case PredefinedUniform::ViewTexel:
2877                     {
2878                        float rect[4];
2879                        rect[0] = 1.0f/float(_render->m_rect[view].m_width);
2880                        rect[1] = 1.0f/float(_render->m_rect[view].m_height);
2881
2882                        setShaderConstantF(flags, predefined.m_loc, &rect[0], 1);
2883                     }
2884                     break;
2885
2886                  case PredefinedUniform::View:
2887                     {
2888                        setShaderConstantF(flags, predefined.m_loc, _render->m_view[view].un.val, bx::uint32_min(4, predefined.m_count) );
2889                     }
2890                     break;
2891
2892                  case PredefinedUniform::InvView:
2893                     {
2894                        if (view != invViewCached)
2895                        {
2896                           invViewCached = view;
2897                           bx::float4x4_inverse(&invView.un.f4x4, &_render->m_view[view].un.f4x4);
2898                        }
2899
2900                        setShaderConstantF(flags, predefined.m_loc, invView.un.val, bx::uint32_min(4, predefined.m_count) );
2901                     }
2902                     break;
2903
2904                  case PredefinedUniform::Proj:
2905                     {
2906                        setShaderConstantF(flags, predefined.m_loc, _render->m_proj[view].un.val, bx::uint32_min(4, predefined.m_count) );
2907                     }
2908                     break;
2909
2910                  case PredefinedUniform::InvProj:
2911                     {
2912                        if (view != invProjCached)
2913                        {
2914                           invProjCached = view;
2915                           bx::float4x4_inverse(&invProj.un.f4x4, &_render->m_proj[view].un.f4x4);
2916                        }
2917
2918                        setShaderConstantF(flags, predefined.m_loc, invProj.un.val, bx::uint32_min(4, predefined.m_count) );
2919                     }
2920                     break;
2921
2922                  case PredefinedUniform::ViewProj:
2923                     {
2924                        setShaderConstantF(flags, predefined.m_loc, viewProj[view].un.val, bx::uint32_min(4, predefined.m_count) );
2925                     }
2926                     break;
2927
2928                  case PredefinedUniform::InvViewProj:
2929                     {
2930                        if (view != invViewProjCached)
2931                        {
2932                           invViewProjCached = view;
2933                           bx::float4x4_inverse(&invViewProj.un.f4x4, &viewProj[view].un.f4x4);
2934                        }
2935
2936                        setShaderConstantF(flags, predefined.m_loc, invViewProj.un.val, bx::uint32_min(4, predefined.m_count) );
2937                     }
2938                     break;
2939
2940                  case PredefinedUniform::Model:
2941                     {
2942                         const Matrix4& model = _render->m_matrixCache.m_cache[draw.m_matrix];
2943                        setShaderConstantF(flags, predefined.m_loc, model.un.val, bx::uint32_min(draw.m_num*4, predefined.m_count) );
2944                     }
2945                     break;
2946
2947                  case PredefinedUniform::ModelView:
2948                     {
2949                        Matrix4 modelView;
2950                        const Matrix4& model = _render->m_matrixCache.m_cache[draw.m_matrix];
2951                        bx::float4x4_mul(&modelView.un.f4x4, &model.un.f4x4, &_render->m_view[view].un.f4x4);
2952                        setShaderConstantF(flags, predefined.m_loc, modelView.un.val, bx::uint32_min(4, predefined.m_count) );
2953                     }
2954                     break;
2955
2956                  case PredefinedUniform::ModelViewProj:
2957                     {
2958                        Matrix4 modelViewProj;
2959                        const Matrix4& model = _render->m_matrixCache.m_cache[draw.m_matrix];
2960                        bx::float4x4_mul(&modelViewProj.un.f4x4, &model.un.f4x4, &viewProj[view].un.f4x4);
2961                        setShaderConstantF(flags, predefined.m_loc, modelViewProj.un.val, bx::uint32_min(4, predefined.m_count) );
2962                     }
2963                     break;
2964
2965                  case PredefinedUniform::AlphaRef:
2966                     {
2967                        setShaderConstantF(flags, predefined.m_loc, &alphaRef, 1);
2968                     }
2969                     break;
2970
2971                  default:
2972                     BX_CHECK(false, "predefined %d not handled", predefined.m_type);
2973                     break;
2974                  }
2975               }
2976            }
2977
2978            {
2979               for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
2980               {
2981                  const Sampler& sampler = draw.m_sampler[stage];
2982                  Sampler& current = currentState.m_sampler[stage];
2983                  if (current.m_idx != sampler.m_idx
2984                  ||  current.m_flags != sampler.m_flags
2985                  ||  programChanged)
2986                  {
2987                     if (invalidHandle != sampler.m_idx)
2988                     {
2989                        m_textures[sampler.m_idx].commit(stage, sampler.m_flags);
2990                     }
2991                     else
2992                     {
2993                        DX_CHECK(device->SetTexture(stage, NULL) );
2994                     }
2995                  }
2996
2997                  current = sampler;
2998               }
2999            }
3000
3001            if (programChanged
3002            ||  currentState.m_vertexBuffer.idx != draw.m_vertexBuffer.idx
3003            ||  currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx
3004            ||  currentState.m_instanceDataOffset != draw.m_instanceDataOffset
3005            ||  currentState.m_instanceDataStride != draw.m_instanceDataStride)
3006            {
3007               currentState.m_vertexBuffer = draw.m_vertexBuffer;
3008               currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx;
3009               currentState.m_instanceDataOffset = draw.m_instanceDataOffset;
3010               currentState.m_instanceDataStride = draw.m_instanceDataStride;
3011
3012               uint16_t handle = draw.m_vertexBuffer.idx;
3013               if (invalidHandle != handle)
3014               {
3015                  const VertexBufferD3D9& vb = m_vertexBuffers[handle];
3016
3017                  uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx;
3018                  const VertexDeclaration& vertexDecl = m_vertexDecls[decl];
3019                  DX_CHECK(device->SetStreamSource(0, vb.m_ptr, 0, vertexDecl.m_decl.m_stride) );
3020
3021                  if (isValid(draw.m_instanceDataBuffer)
3022                  &&  m_instancing)
3023                  {
3024                     const VertexBufferD3D9& inst = m_vertexBuffers[draw.m_instanceDataBuffer.idx];
3025                     DX_CHECK(device->SetStreamSourceFreq(0, D3DSTREAMSOURCE_INDEXEDDATA|draw.m_numInstances) );
3026                     DX_CHECK(device->SetStreamSourceFreq(1, UINT(D3DSTREAMSOURCE_INSTANCEDATA|1) ) );
3027                     DX_CHECK(device->SetStreamSource(1, inst.m_ptr, draw.m_instanceDataOffset, draw.m_instanceDataStride) );
3028
3029                     IDirect3DVertexDeclaration9* ptr = createVertexDeclaration(vertexDecl.m_decl, draw.m_instanceDataStride/16);
3030                     DX_CHECK(device->SetVertexDeclaration(ptr) );
3031                     DX_RELEASE(ptr, 0);
3032                  }
3033                  else
3034                  {
3035                     DX_CHECK(device->SetStreamSourceFreq(0, 1) );
3036                     DX_CHECK(device->SetStreamSource(1, NULL, 0, 0) );
3037                     DX_CHECK(device->SetVertexDeclaration(vertexDecl.m_ptr) );
3038                  }
3039               }
3040               else
3041               {
3042                  DX_CHECK(device->SetStreamSource(0, NULL, 0, 0) );
3043                  DX_CHECK(device->SetStreamSource(1, NULL, 0, 0) );
3044               }
3045            }
3046
3047            if (currentState.m_indexBuffer.idx != draw.m_indexBuffer.idx)
3048            {
3049               currentState.m_indexBuffer = draw.m_indexBuffer;
3050
3051               uint16_t handle = draw.m_indexBuffer.idx;
3052               if (invalidHandle != handle)
3053               {
3054                  const IndexBufferD3D9& ib = m_indexBuffers[handle];
3055                  DX_CHECK(device->SetIndices(ib.m_ptr) );
3056               }
3057               else
3058               {
3059                  DX_CHECK(device->SetIndices(NULL) );
3060               }
3061            }
3062
3063            if (isValid(currentState.m_vertexBuffer) )
3064            {
3065               uint32_t numVertices = draw.m_numVertices;
3066               if (UINT32_MAX == numVertices)
3067               {
3068                  const VertexBufferD3D9& vb = m_vertexBuffers[currentState.m_vertexBuffer.idx];
3069                  uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx;
3070                  const VertexDeclaration& vertexDecl = m_vertexDecls[decl];
3071                  numVertices = vb.m_size/vertexDecl.m_decl.m_stride;
3072               }
3073
3074               uint32_t numIndices = 0;
3075               uint32_t numPrimsSubmitted = 0;
3076               uint32_t numInstances = 0;
3077               uint32_t numPrimsRendered = 0;
3078
3079               if (isValid(draw.m_indexBuffer) )
3080               {
3081                  if (UINT32_MAX == draw.m_numIndices)
3082                  {
3083                     numIndices = m_indexBuffers[draw.m_indexBuffer.idx].m_size/2;
3084                     numPrimsSubmitted = numIndices/prim.m_div - prim.m_sub;
3085                     numInstances = draw.m_numInstances;
3086                     numPrimsRendered = numPrimsSubmitted*draw.m_numInstances;
3087
3088                     DX_CHECK(device->DrawIndexedPrimitive(prim.m_type
3089                        , draw.m_startVertex
3090                        , 0
3091                        , numVertices
3092                        , 0
3093                        , numPrimsSubmitted
3094                        ) );
3095                  }
3096                  else if (prim.m_min <= draw.m_numIndices)
3097                  {
3098                     numIndices = draw.m_numIndices;
3099                     numPrimsSubmitted = numIndices/prim.m_div - prim.m_sub;
3100                     numInstances = draw.m_numInstances;
3101                     numPrimsRendered = numPrimsSubmitted*draw.m_numInstances;
3102
3103                     DX_CHECK(device->DrawIndexedPrimitive(prim.m_type
3104                        , draw.m_startVertex
3105                        , 0
3106                        , numVertices
3107                        , draw.m_startIndex
3108                        , numPrimsSubmitted
3109                        ) );
3110                  }
3111               }
3112               else
3113               {
3114                  numPrimsSubmitted = numVertices/prim.m_div - prim.m_sub;
3115                  numInstances = draw.m_numInstances;
3116                  numPrimsRendered = numPrimsSubmitted*draw.m_numInstances;
3117
3118                  DX_CHECK(device->DrawPrimitive(prim.m_type
3119                     , draw.m_startVertex
3120                     , numPrimsSubmitted
3121                     ) );
3122               }
3123
3124               statsNumPrimsSubmitted[primIndex] += numPrimsSubmitted;
3125               statsNumPrimsRendered[primIndex]  += numPrimsRendered;
3126               statsNumInstances[primIndex]      += numInstances;
3127               statsNumIndices += numIndices;
3128            }
3129         }
3130
3131         PIX_ENDEVENT();
3132
3133         if (0 < _render->m_num)
3134         {
3135            captureElapsed = -bx::getHPCounter();
3136            capture();
3137            captureElapsed += bx::getHPCounter();
3138         }
3139      }
3140
3141      int64_t now = bx::getHPCounter();
3142      elapsed += now;
3143
3144      static int64_t last = now;
3145      int64_t frameTime = now - last;
3146      last = now;
3147
3148      static int64_t min = frameTime;
3149      static int64_t max = frameTime;
3150      min = min > frameTime ? frameTime : min;
3151      max = max < frameTime ? frameTime : max;
3152
3153      if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
3154      {
3155         PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
3156
3157         TextVideoMem& tvm = m_textVideoMem;
3158
3159         static int64_t next = now;
3160
3161         if (now >= next)
3162         {
3163            next = now + bx::getHPFrequency();
3164
3165            double freq = double(bx::getHPFrequency() );
3166            double toMs = 1000.0/freq;
3167
3168            tvm.clear();
3169            uint16_t pos = 0;
3170            tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x89 : 0x8f, " %s / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " "
3171               , getRendererName()
3172               );
3173
3174            const D3DADAPTER_IDENTIFIER9& identifier = m_identifier;
3175            tvm.printf(0, pos++, 0x0f, " Device: %s (%s)", identifier.Description, identifier.Driver);
3176
3177            pos = 10;
3178            tvm.printf(10, pos++, 0x8e, "       Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS "
3179               , double(frameTime)*toMs
3180               , double(min)*toMs
3181               , double(max)*toMs
3182               , freq/frameTime
3183               );
3184
3185            const uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT;
3186            tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d "
3187               , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' '
3188               , 0 != msaa ? '\xfe' : ' '
3189               , 1<<msaa
3190               );
3191
3192            double elapsedCpuMs = double(elapsed)*toMs;
3193            tvm.printf(10, pos++, 0x8e, "  Draw calls: %4d / CPU %3.4f [ms]"
3194               , _render->m_num
3195               , elapsedCpuMs
3196               );
3197            for (uint32_t ii = 0; ii < BX_COUNTOF(s_primInfo); ++ii)
3198            {
3199               tvm.printf(10, pos++, 0x8e, "    %8s: %7d (#inst: %5d), submitted: %7d"
3200                  , s_primName[ii]
3201                  , statsNumPrimsRendered[ii]
3202                  , statsNumInstances[ii]
3203                  , statsNumPrimsSubmitted[ii]
3204                  );
3205            }
3206
3207            tvm.printf(10, pos++, 0x8e, "     Indices: %7d", statsNumIndices);
3208            tvm.printf(10, pos++, 0x8e, "    DVB size: %7d", _render->m_vboffset);
3209            tvm.printf(10, pos++, 0x8e, "    DIB size: %7d", _render->m_iboffset);
3210
3211            double captureMs = double(captureElapsed)*toMs;
3212            tvm.printf(10, pos++, 0x8e, "     Capture: %3.4f [ms]", captureMs);
3213
3214            uint8_t attr[2] = { 0x89, 0x8a };
3215            uint8_t attrIndex = _render->m_waitSubmit < _render->m_waitRender;
3216
3217            tvm.printf(10, pos++, attr[attrIndex&1], " Submit wait: %3.4f [ms]", _render->m_waitSubmit*toMs);
3218            tvm.printf(10, pos++, attr[(attrIndex+1)&1], " Render wait: %3.4f [ms]", _render->m_waitRender*toMs);
3219
3220            min = frameTime;
3221            max = frameTime;
3222         }
3223
3224         blit(this, _textVideoMemBlitter, tvm);
3225
3226         PIX_ENDEVENT();
3227      }
3228      else if (_render->m_debug & BGFX_DEBUG_TEXT)
3229      {
3230         PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
3231
3232         blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
3233
3234         PIX_ENDEVENT();
3235      }
3236
3237      device->EndScene();
3238   }
3239} // namespace bgfx
3240
3241#else
3242
3243namespace bgfx
3244{
3245   RendererContextI* rendererCreateD3D9()
3246   {
3247      return NULL;
3248   }
3249
3250   void rendererDestroyD3D9()
3251   {
3252   }
3253} // namespace bgfx
3254
3255#endif // BGFX_CONFIG_RENDERER_DIRECT3D9
Property changes on: branches/osd/src/lib/bgfx/renderer_d3d9.cpp
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/makefile
r0r31734
1#
2# Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3# License: http://www.opensource.org/licenses/BSD-2-Clause
4#
5
6include ../premake/shader-embeded.mk
7
8rebuild:
9   @make -s --no-print-directory clean all
Property changes on: branches/osd/src/lib/bgfx/makefile
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_egl.cpp
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7
8#if (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL)
9#   include "renderer_gl.h"
10
11#   if BGFX_USE_EGL
12
13#ifndef EGL_CONTEXT_MAJOR_VERSION_KHR
14#   define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION
15#endif // EGL_CONTEXT_MAJOR_VERSION_KHR
16
17#ifndef EGL_CONTEXT_MINOR_VERSION_KHR
18#   define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
19#endif // EGL_CONTEXT_MINOR_VERSION_KHR
20
21namespace bgfx
22{
23#if BGFX_USE_GL_DYNAMIC_LIB
24
25   typedef void (*EGLPROC)(void);
26
27   typedef EGLPROC (EGLAPIENTRY* PFNEGLGETPROCADDRESSPROC)(const char *procname);
28   typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPINTERVALPROC)(EGLDisplay dpy, EGLint interval);
29   typedef EGLBoolean (EGLAPIENTRY* PFNEGLMAKECURRENTPROC)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
30   typedef EGLContext (EGLAPIENTRY* PFNEGLCREATECONTEXTPROC)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
31   typedef EGLSurface (EGLAPIENTRY* PFNEGLCREATEWINDOWSURFACEPROC)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
32   typedef EGLBoolean (EGLAPIENTRY* PFNEGLCHOOSECONFIGPROC)(EGLDisplay dpy, const EGLint *attrib_list,   EGLConfig *configs, EGLint config_size,   EGLint *num_config);
33   typedef EGLBoolean (EGLAPIENTRY* PFNEGLINITIALIZEPROC)(EGLDisplay dpy, EGLint *major, EGLint *minor);
34   typedef EGLDisplay (EGLAPIENTRY* PFNEGLGETDISPLAYPROC)(EGLNativeDisplayType display_id);
35   typedef EGLBoolean (EGLAPIENTRY* PFNEGLTERMINATEPROC)(EGLDisplay dpy);
36   typedef EGLBoolean (EGLAPIENTRY* PFNEGLDESTROYSURFACEPROC)(EGLDisplay dpy, EGLSurface surface);
37   typedef EGLBoolean (EGLAPIENTRY* PFNEGLDESTROYCONTEXTPROC)(EGLDisplay dpy, EGLContext ctx);
38   typedef EGLBoolean (EGLAPIENTRY* PFNEGLSWAPBUFFERSPROC)(EGLDisplay dpy, EGLSurface surface);
39
40#define EGL_IMPORT \
41         EGL_IMPORT_FUNC(PFNEGLGETPROCADDRESSPROC,      eglGetProcAddress); \
42         EGL_IMPORT_FUNC(PFNEGLSWAPINTERVALPROC,        eglSwapInterval); \
43         EGL_IMPORT_FUNC(PFNEGLMAKECURRENTPROC,         eglMakeCurrent); \
44         EGL_IMPORT_FUNC(PFNEGLCREATECONTEXTPROC,       eglCreateContext); \
45         EGL_IMPORT_FUNC(PFNEGLCREATEWINDOWSURFACEPROC, eglCreateWindowSurface); \
46         EGL_IMPORT_FUNC(PFNEGLCHOOSECONFIGPROC,        eglChooseConfig); \
47         EGL_IMPORT_FUNC(PFNEGLINITIALIZEPROC,          eglInitialize); \
48         EGL_IMPORT_FUNC(PFNEGLGETDISPLAYPROC,          eglGetDisplay); \
49         EGL_IMPORT_FUNC(PFNEGLTERMINATEPROC,           eglTerminate); \
50         EGL_IMPORT_FUNC(PFNEGLDESTROYSURFACEPROC,      eglDestroySurface); \
51         EGL_IMPORT_FUNC(PFNEGLDESTROYCONTEXTPROC,      eglDestroyContext); \
52         EGL_IMPORT_FUNC(PFNEGLSWAPBUFFERSPROC,         eglSwapBuffers);
53
54#define EGL_IMPORT_FUNC(_proto, _func) _proto _func
55EGL_IMPORT
56#undef EGL_IMPORT_FUNC
57
58   void* eglOpen()
59   {
60      void* handle = bx::dlopen("libEGL.dll");
61      BGFX_FATAL(NULL != handle, Fatal::UnableToInitialize, "Failed to load libEGL dynamic library.");
62
63#define EGL_IMPORT_FUNC(_proto, _func) \
64         _func = (_proto)bx::dlsym(handle, #_func); \
65         BX_TRACE("%p " #_func, _func); \
66         BGFX_FATAL(NULL != _func, Fatal::UnableToInitialize, "Failed get " #_func ".")
67EGL_IMPORT
68#undef EGL_IMPORT_FUNC
69
70      return handle;
71   }
72
73   void eglClose(void* _handle)
74   {
75      bx::dlclose(_handle);
76
77#define EGL_IMPORT_FUNC(_proto, _func) _func = NULL
78EGL_IMPORT
79#undef EGL_IMPORT_FUNC
80   }
81
82#else
83
84   void* eglOpen()
85   {
86      return NULL;
87   }
88
89   void eglClose(void* /*_handle*/)
90   {
91   }
92#endif // BGFX_USE_GL_DYNAMIC_LIB
93
94#   define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
95#   include "glimports.h"
96
97   void GlContext::create(uint32_t _width, uint32_t _height)
98   {
99      m_eglLibrary = eglOpen();
100
101      BX_UNUSED(_width, _height);
102      EGLNativeDisplayType ndt = EGL_DEFAULT_DISPLAY;
103      EGLNativeWindowType nwt = (EGLNativeWindowType)NULL;
104#   if BX_PLATFORM_WINDOWS
105      ndt = GetDC(g_bgfxHwnd);
106      nwt = g_bgfxHwnd;
107#   endif // BX_PLATFORM_
108      m_display = eglGetDisplay(ndt);
109      BGFX_FATAL(m_display != EGL_NO_DISPLAY, Fatal::UnableToInitialize, "Failed to create display %p", m_display);
110
111      EGLint major = 0;
112      EGLint minor = 0;
113      EGLBoolean success = eglInitialize(m_display, &major, &minor);
114      BGFX_FATAL(success && major >= 1 && minor >= 3, Fatal::UnableToInitialize, "Failed to initialize %d.%d", major, minor);
115
116      EGLint attrs[] =
117      {
118         EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
119
120#   if BX_PLATFORM_ANDROID
121         EGL_DEPTH_SIZE, 16,
122#   else
123         EGL_DEPTH_SIZE, 24,
124#   endif // BX_PLATFORM_
125         EGL_STENCIL_SIZE, 8,
126
127         EGL_NONE
128      };
129
130      EGLint numConfig = 0;
131      EGLConfig config;
132      success = eglChooseConfig(m_display, attrs, &config, 1, &numConfig);
133      BGFX_FATAL(success, Fatal::UnableToInitialize, "eglChooseConfig");
134
135#   if BX_PLATFORM_ANDROID
136      EGLint format;
137      eglGetConfigAttrib(m_display, config, EGL_NATIVE_VISUAL_ID, &format);
138      ANativeWindow_setBuffersGeometry(g_bgfxAndroidWindow, _width, _height, format);
139      nwt = g_bgfxAndroidWindow;
140#   endif // BX_PLATFORM_ANDROID
141
142      m_surface = eglCreateWindowSurface(m_display, config, nwt, NULL);
143      BGFX_FATAL(m_surface != EGL_NO_SURFACE, Fatal::UnableToInitialize, "Failed to create surface.");
144
145      EGLint contextAttrs[] =
146      {
147#   if BGFX_CONFIG_RENDERER_OPENGLES >= 30
148         EGL_CONTEXT_MAJOR_VERSION_KHR, 3,
149#      if BGFX_CONFIG_RENDERER_OPENGLES >= 31
150         EGL_CONTEXT_MINOR_VERSION_KHR, 1,
151#      else
152//         EGL_CONTEXT_MINOR_VERSION_KHR, 0,
153#      endif // BGFX_CONFIG_RENDERER_OPENGLES >= 31
154#   elif BGFX_CONFIG_RENDERER_OPENGLES
155         EGL_CONTEXT_MAJOR_VERSION_KHR, 2,
156//         EGL_CONTEXT_MINOR_VERSION_KHR, 0,
157#   endif // BGFX_CONFIG_RENDERER_
158
159         EGL_NONE
160      };
161
162      m_context = eglCreateContext(m_display, config, EGL_NO_CONTEXT, contextAttrs);
163      BGFX_FATAL(m_context != EGL_NO_CONTEXT, Fatal::UnableToInitialize, "Failed to create context.");
164
165      success = eglMakeCurrent(m_display, m_surface, m_surface, m_context);
166      BGFX_FATAL(success, Fatal::UnableToInitialize, "Failed to set context.");
167
168      eglSwapInterval(m_display, 0);
169
170#   if BX_PLATFORM_EMSCRIPTEN
171      emscripten_set_canvas_size(_width, _height);
172#   endif // BX_PLATFORM_EMSCRIPTEN
173
174      import();
175   }
176
177   void GlContext::destroy()
178   {
179      eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
180      eglDestroyContext(m_display, m_context);
181      eglDestroySurface(m_display, m_surface);
182      eglTerminate(m_display);
183      m_context = NULL;
184
185      eglClose(m_eglLibrary);
186   }
187
188   void GlContext::resize(uint32_t /*_width*/, uint32_t /*_height*/, bool _vsync)
189   {
190      eglSwapInterval(m_display, _vsync ? 1 : 0);
191   }
192
193   void GlContext::swap()
194   {
195      eglMakeCurrent(m_display, m_surface, m_surface, m_context);
196      eglSwapBuffers(m_display, m_surface);
197   }
198
199   void GlContext::import()
200   {
201      BX_TRACE("Import:");
202#   if BX_PLATFORM_WINDOWS
203      void* glesv2 = bx::dlopen("libGLESv2.dll");
204#      define GL_EXTENSION(_optional, _proto, _func, _import) \
205               { \
206                  if (NULL == _func) \
207                  { \
208                     _func = (_proto)bx::dlsym(glesv2, #_import); \
209                     BX_TRACE("\t%p " #_func " (" #_import ")", _func); \
210                     BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. eglGetProcAddress(\"%s\")", #_import); \
211                  } \
212               }
213#   else
214#      define GL_EXTENSION(_optional, _proto, _func, _import) \
215               { \
216                  if (NULL == _func) \
217                  { \
218                     _func = (_proto)eglGetProcAddress(#_import); \
219                     BX_TRACE("\t%p " #_func " (" #_import ")", _func); \
220                     BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGLES context. eglGetProcAddress(\"%s\")", #_import); \
221                  } \
222               }
223#   endif // BX_PLATFORM_
224#   include "glimports.h"
225   }
226
227} // namespace bgfx
228
229#   endif // BGFX_USE_EGL
230#endif // (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL)
Property changes on: branches/osd/src/lib/bgfx/glcontext_egl.cpp
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/varying.def.sc
r0r31734
1vec4 v_color0    : COLOR0    = vec4(1.0, 0.0, 0.0, 1.0);
2vec4 v_color1    : COLOR1    = vec4(0.0, 1.0, 0.0, 1.0);
3vec2 v_texcoord0 : TEXCOORD0 = vec2(0.0, 0.0);
4vec3 v_normal    : TEXCOORD1 = vec3(0.0, 1.0, 0.0);
5
6vec3 a_position  : POSITION;
7vec3 a_normal    : NORMAL0;
8vec4 a_color0    : COLOR0;
9vec4 a_color1    : COLOR1;
10vec2 a_texcoord0 : TEXCOORD0;
Property changes on: branches/osd/src/lib/bgfx/varying.def.sc
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_nsgl.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
7#define BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
8
9#if BX_PLATFORM_OSX
10
11namespace bgfx
12{
13   struct GlContext
14   {
15      GlContext()
16         : m_context(0)
17      {
18      }
19
20      void create(uint32_t _width, uint32_t _height);
21      void destroy();
22      void resize(uint32_t _width, uint32_t _height, bool _vsync);
23      void swap();
24      void import();
25
26      bool isValid() const
27      {
28         return 0 != m_context;
29      }
30
31      void* m_view;
32      void* m_context;
33   };
34} // namespace bgfx
35
36#endif // BX_PLATFORM_OSX
37
38#endif // BGFX_GLCONTEXT_NSGL_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/glcontext_nsgl.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/renderer_null.cpp
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7
8#if BGFX_CONFIG_RENDERER_NULL
9
10namespace bgfx
11{
12   struct RendererContextNULL : public RendererContextI
13   {
14      RendererContextNULL()
15      {
16      }
17
18      ~RendererContextNULL()
19      {
20      }
21
22      RendererType::Enum getRendererType() const BX_OVERRIDE
23      {
24         return RendererType::Null;
25      }
26
27      const char* getRendererName() const BX_OVERRIDE
28      {
29         return BGFX_RENDERER_NULL_NAME;
30      }
31
32      void flip() BX_OVERRIDE
33      {
34      }
35
36      void createIndexBuffer(IndexBufferHandle /*_handle*/, Memory* /*_mem*/) BX_OVERRIDE
37      {
38      }
39
40      void destroyIndexBuffer(IndexBufferHandle /*_handle*/) BX_OVERRIDE
41      {
42      }
43
44      void createVertexDecl(VertexDeclHandle /*_handle*/, const VertexDecl& /*_decl*/) BX_OVERRIDE
45      {
46      }
47
48      void destroyVertexDecl(VertexDeclHandle /*_handle*/) BX_OVERRIDE
49      {
50      }
51
52      void createVertexBuffer(VertexBufferHandle /*_handle*/, Memory* /*_mem*/, VertexDeclHandle /*_declHandle*/) BX_OVERRIDE
53      {
54      }
55
56      void destroyVertexBuffer(VertexBufferHandle /*_handle*/) BX_OVERRIDE
57      {
58      }
59
60      void createDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_size*/) BX_OVERRIDE
61      {
62      }
63
64      void updateDynamicIndexBuffer(IndexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) BX_OVERRIDE
65      {
66      }
67
68      void destroyDynamicIndexBuffer(IndexBufferHandle /*_handle*/) BX_OVERRIDE
69      {
70      }
71
72      void createDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_size*/) BX_OVERRIDE
73      {
74      }
75
76      void updateDynamicVertexBuffer(VertexBufferHandle /*_handle*/, uint32_t /*_offset*/, uint32_t /*_size*/, Memory* /*_mem*/) BX_OVERRIDE
77      {
78      }
79
80      void destroyDynamicVertexBuffer(VertexBufferHandle /*_handle*/) BX_OVERRIDE
81      {
82      }
83
84      void createShader(ShaderHandle /*_handle*/, Memory* /*_mem*/) BX_OVERRIDE
85      {
86      }
87
88      void destroyShader(ShaderHandle /*_handle*/) BX_OVERRIDE
89      {
90      }
91
92      void createProgram(ProgramHandle /*_handle*/, ShaderHandle /*_vsh*/, ShaderHandle /*_fsh*/) BX_OVERRIDE
93      {
94      }
95
96      void destroyProgram(ProgramHandle /*_handle*/) BX_OVERRIDE
97      {
98      }
99
100      void createTexture(TextureHandle /*_handle*/, Memory* /*_mem*/, uint32_t /*_flags*/, uint8_t /*_skip*/) BX_OVERRIDE
101      {
102      }
103
104      void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) BX_OVERRIDE
105      {
106      }
107
108      void updateTexture(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/, const Rect& /*_rect*/, uint16_t /*_z*/, uint16_t /*_depth*/, uint16_t /*_pitch*/, const Memory* /*_mem*/) BX_OVERRIDE
109      {
110      }
111
112      void updateTextureEnd() BX_OVERRIDE
113      {
114      }
115
116      void destroyTexture(TextureHandle /*_handle*/) BX_OVERRIDE
117      {
118      }
119
120      void createFrameBuffer(FrameBufferHandle /*_handle*/, uint8_t /*_num*/, const TextureHandle* /*_textureHandles*/) BX_OVERRIDE
121      {
122      }
123
124      void destroyFrameBuffer(FrameBufferHandle /*_handle*/) BX_OVERRIDE
125      {
126      }
127
128      void createUniform(UniformHandle /*_handle*/, UniformType::Enum /*_type*/, uint16_t /*_num*/, const char* /*_name*/) BX_OVERRIDE
129      {
130      }
131
132      void destroyUniform(UniformHandle /*_handle*/) BX_OVERRIDE
133      {
134      }
135
136      void saveScreenShot(const char* /*_filePath*/) BX_OVERRIDE
137      {
138      }
139
140      void updateViewName(uint8_t /*_id*/, const char* /*_name*/) BX_OVERRIDE
141      {
142      }
143
144      void updateUniform(uint16_t /*_loc*/, const void* /*_data*/, uint32_t /*_size*/) BX_OVERRIDE
145      {
146      }
147
148      void setMarker(const char* /*_marker*/, uint32_t /*_size*/) BX_OVERRIDE
149      {
150      }
151
152      void submit(Frame* /*_render*/, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& /*_textVideoMemBlitter*/) BX_OVERRIDE
153      {
154      }
155
156      void blitSetup(TextVideoMemBlitter& /*_blitter*/) BX_OVERRIDE
157      {
158      }
159
160      void blitRender(TextVideoMemBlitter& /*_blitter*/, uint32_t /*_numIndices*/) BX_OVERRIDE
161      {
162      }
163   };
164
165   static RendererContextNULL* s_renderNULL;
166
167   RendererContextI* rendererCreateNULL()
168   {
169      s_renderNULL = BX_NEW(g_allocator, RendererContextNULL);
170      return s_renderNULL;
171   }
172
173   void rendererDestroyNULL()
174   {
175      BX_DELETE(g_allocator, s_renderNULL);
176      s_renderNULL = NULL;
177   }
178} // namespace bgfx
179
180#else
181
182namespace bgfx
183{
184   RendererContextI* rendererCreateNULL()
185   {
186      return NULL;
187   }
188
189   void rendererDestroyNULL()
190   {
191   }
192} // namespace bgfx
193
194#endif // BGFX_CONFIG_RENDERER_NULL
Property changes on: branches/osd/src/lib/bgfx/renderer_null.cpp
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_ppapi.cpp
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7
8#if BX_PLATFORM_NACL && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
9#   include <bgfxplatform.h>
10#   include "renderer_gl.h"
11
12namespace bgfx
13{
14#   define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
15#   include "glimports.h"
16
17   void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/);
18
19   PP_CompletionCallback naclSwapComplete =
20   {
21      naclSwapCompleteCb,
22      NULL,
23      PP_COMPLETIONCALLBACK_FLAG_NONE
24   };
25
26   struct Ppapi
27   {
28      Ppapi()
29         : m_context(0)
30         , m_instance(0)
31         , m_instInterface(NULL)
32         , m_graphicsInterface(NULL)
33         , m_instancedArrays(NULL)
34         , m_postSwapBuffers(NULL)
35         , m_forceSwap(true)
36      {
37      }
38
39      bool setInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers);
40
41      void resize(uint32_t _width, uint32_t _height, bool /*_vsync*/)
42      {
43         m_graphicsInterface->ResizeBuffers(m_context, _width, _height);
44      }
45
46      void swap()
47      {
48         glSetCurrentContextPPAPI(m_context);
49         m_graphicsInterface->SwapBuffers(m_context, naclSwapComplete);
50      }
51
52      bool isValid() const
53      {
54         return 0 != m_context;
55      }
56
57      PP_Resource m_context;
58      PP_Instance m_instance;
59      const PPB_Instance* m_instInterface;
60      const PPB_Graphics3D* m_graphicsInterface;
61      const PPB_OpenGLES2InstancedArrays* m_instancedArrays;
62      PostSwapBuffersFn m_postSwapBuffers;
63      bool m_forceSwap;
64   };
65   
66   static Ppapi s_ppapi;
67
68   void naclSwapCompleteCb(void* /*_data*/, int32_t /*_result*/)
69   {
70      // For NaCl bgfx doesn't create render thread, but rendering is always
71      // multithreaded. Frame rendering is done on main thread, and context
72      // is initialized when PPAPI interfaces are set. Force swap is there to
73      // keep calling swap complete callback, so that initialization doesn't
74      // deadlock on semaphores.
75      if (s_ppapi.m_forceSwap)
76      {
77         s_ppapi.swap();
78      }
79
80      renderFrame();
81   }
82
83   static void GL_APIENTRY naclVertexAttribDivisor(GLuint _index, GLuint _divisor)
84   {
85      s_ppapi.m_instancedArrays->VertexAttribDivisorANGLE(s_ppapi.m_context, _index, _divisor);
86   }
87
88   static void GL_APIENTRY naclDrawArraysInstanced(GLenum _mode, GLint _first, GLsizei _count, GLsizei _primcount)
89   {
90      s_ppapi.m_instancedArrays->DrawArraysInstancedANGLE(s_ppapi.m_context, _mode, _first, _count, _primcount);
91   }
92
93   static void GL_APIENTRY naclDrawElementsInstanced(GLenum _mode, GLsizei _count, GLenum _type, const GLvoid* _indices, GLsizei _primcount)
94   {
95      s_ppapi.m_instancedArrays->DrawElementsInstancedANGLE(s_ppapi.m_context, _mode, _count, _type, _indices, _primcount);
96   }
97
98   bool naclSetInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers)
99   {
100      return s_ppapi.setInterfaces( _instance, _instInterface, _graphicsInterface, _postSwapBuffers);
101   }
102
103   bool Ppapi::setInterfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, PostSwapBuffersFn _postSwapBuffers)
104   {
105      BX_TRACE("PPAPI Interfaces");
106
107      m_instance = _instance;
108      m_instInterface = _instInterface;
109      m_graphicsInterface = _graphicsInterface;
110      m_instancedArrays = glGetInstancedArraysInterfacePPAPI();
111      m_postSwapBuffers = _postSwapBuffers;
112
113      int32_t attribs[] =
114      {
115         PP_GRAPHICS3DATTRIB_ALPHA_SIZE, 8,
116         PP_GRAPHICS3DATTRIB_DEPTH_SIZE, 24,
117         PP_GRAPHICS3DATTRIB_STENCIL_SIZE, 8,
118         PP_GRAPHICS3DATTRIB_SAMPLES, 0,
119         PP_GRAPHICS3DATTRIB_SAMPLE_BUFFERS, 0,
120         PP_GRAPHICS3DATTRIB_WIDTH, BGFX_DEFAULT_WIDTH,
121         PP_GRAPHICS3DATTRIB_HEIGHT, BGFX_DEFAULT_HEIGHT,
122         PP_GRAPHICS3DATTRIB_NONE
123      };
124
125      m_context = m_graphicsInterface->Create(m_instance, 0, attribs);
126      if (0 == m_context)
127      {
128         BX_TRACE("Failed to create context!");
129         return false;
130      }
131
132      m_instInterface->BindGraphics(m_instance, m_context);
133      glSetCurrentContextPPAPI(m_context);
134      m_graphicsInterface->SwapBuffers(m_context, naclSwapComplete);
135
136      glVertexAttribDivisor   = naclVertexAttribDivisor;
137      glDrawArraysInstanced   = naclDrawArraysInstanced;
138      glDrawElementsInstanced = naclDrawElementsInstanced;
139
140      // Prevent render thread creation.
141      RenderFrame::Enum result = renderFrame();
142      return RenderFrame::NoContext == result;
143   }
144
145   void GlContext::create(uint32_t _width, uint32_t _height)
146   {
147      BX_UNUSED(_width, _height);
148      BX_TRACE("GlContext::create");
149   }
150
151   void GlContext::destroy()
152   {
153   }
154
155   void GlContext::resize(uint32_t _width, uint32_t _height, bool _vsync)
156   {
157      s_ppapi.m_forceSwap = false;
158      s_ppapi.resize(_width, _height, _vsync);
159   }
160
161   void GlContext::swap()
162   {
163      s_ppapi.swap();
164   }
165
166   void GlContext::import()
167   {
168   }
169
170   bool GlContext::isValid() const
171   {
172      return s_ppapi.isValid();
173   }
174
175} // namespace bgfx
176
177#endif // BX_PLATFORM_NACL && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
Property changes on: branches/osd/src/lib/bgfx/glcontext_ppapi.cpp
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/vs_debugfont.bin.h
r0r31734
1static const uint8_t vs_debugfont_glsl[521] =
2{
3   0x56, 0x53, 0x48, 0x03, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod
4   0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x01, 0x00, 0x00, 0x01, 0x00, // elViewProj......
5   0xe4, 0x01, 0x00, 0x00, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x6d, 0x65, // ....attribute me
6   0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, // diump vec4 a_col
7   0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x6d, // or0;.attribute m
8   0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, // ediump vec4 a_co
9   0x6c, 0x6f, 0x72, 0x31, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, // lor1;.attribute
10   0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x70, // mediump vec3 a_p
11   0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, // osition;.attribu
12   0x74, 0x65, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // te mediump vec2
13   0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, // a_texcoord0;.var
14   0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, // ying mediump vec
15   0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, // 4 v_color0;.vary
16   0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // ing mediump vec4
17   0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, //  v_color1;.varyi
18   0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, // ng mediump vec2
19   0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, 0x6e, 0x69, // v_texcoord0;.uni
20   0x66, 0x6f, 0x72, 0x6d, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x6d, 0x61, 0x74, // form mediump mat
21   0x34, 0x20, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // 4 u_modelViewPro
22   0x6a, 0x3b, 0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, // j;.void main ().
23   0x7b, 0x0a, 0x20, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, // {.  mediump vec4
24   0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, //  tmpvar_1;.  tmp
25   0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, // var_1.w = 1.0;.
26   0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, //  tmpvar_1.xyz =
27   0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // a_position;.  gl
28   0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x28, 0x75, 0x5f, 0x6d, // _Position = (u_m
29   0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x20, 0x2a, 0x20, 0x74, // odelViewProj * t
30   0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x74, 0x65, // mpvar_1);.  v_te
31   0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x74, 0x65, 0x78, 0x63, // xcoord0 = a_texc
32   0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // oord0;.  v_color
33   0x30, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, // 0 = a_color0;. 
34   0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x20, 0x3d, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, // v_color1 = a_col
35   0x6f, 0x72, 0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00,                                           // or1;.}...
36};
37static const uint8_t vs_debugfont_dx9[391] =
38{
39   0x56, 0x53, 0x48, 0x03, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod
40   0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x01, 0x00, 0x00, 0x04, 0x00, // elViewProj......
41   0x64, 0x01, 0x00, 0x03, 0xfe, 0xff, 0xfe, 0xff, 0x23, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, // d.......#.CTAB..
42   0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x03, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, // ..W.............
43   0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, // ......P...0.....
44   0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......@.......u_
45   0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x03, 0x00, // modelViewProj...
46   0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x73, // ..............vs
47   0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, // _3_0.Microsoft (
48   0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, // R) HLSL Shader C
49   0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, // ompiler 9.29.952
50   0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, // .3111...........
51   0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x01, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, // ................
52   0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................
53   0x00, 0x80, 0x03, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, // ................
54   0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0xe0, 0x1f, 0x00, // ................
55   0x00, 0x02, 0x0a, 0x00, 0x01, 0x80, 0x02, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x05, 0x00, // ................
56   0x00, 0x80, 0x03, 0x00, 0x03, 0xe0, 0x05, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x01, 0x00, // ................
57   0xe4, 0xa0, 0x02, 0x00, 0x55, 0x90, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, // ....U...........
58   0xe4, 0xa0, 0x02, 0x00, 0x00, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, // ................
59   0x0f, 0x80, 0x02, 0x00, 0xe4, 0xa0, 0x02, 0x00, 0xaa, 0x90, 0x00, 0x00, 0xe4, 0x80, 0x02, 0x00, // ................
60   0x00, 0x03, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x80, 0x03, 0x00, 0xe4, 0xa0, 0x01, 0x00, // ................
61   0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x02, 0x00, // ................
62   0x0f, 0xe0, 0x01, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x03, 0x00, 0x03, 0xe0, 0x03, 0x00, // ................
63   0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00,                                                       // .......
64};
65static const uint8_t vs_debugfont_dx11[1486] =
66{
67   0x56, 0x53, 0x48, 0x03, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0f, 0x75, 0x5f, 0x6d, 0x6f, 0x64, // VSH..."f...u_mod
68   0x65, 0x6c, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, 0x6a, 0x09, 0x00, 0xe0, 0x09, 0x04, 0x00, // elViewProj......
69   0xa0, 0x05, 0x44, 0x58, 0x42, 0x43, 0xd8, 0x0a, 0x62, 0xda, 0x4f, 0xc6, 0x4b, 0xc9, 0x8b, 0x8f, // ..DXBC..b.O.K...
70   0x39, 0xd9, 0xc4, 0x30, 0xee, 0xfe, 0x01, 0x00, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0x05, 0x00, // 9..0............
71   0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0xb4, 0x02, 0x00, 0x00, 0x3c, 0x03, 0x00, 0x00, 0xc8, 0x03, // ..4.......<.....
72   0x00, 0x00, 0x24, 0x05, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0x78, 0x02, 0x00, 0x00, 0x01, 0x00, // ..$...RDEFx.....
73   0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, // ..H.............
74   0xfe, 0xff, 0x00, 0x91, 0x00, 0x00, 0x44, 0x02, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, // ......D...<.....
75   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
76   0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x47, 0x6c, 0x6f, 0x62, 0x61, // ..........$Globa
77   0x6c, 0x73, 0x00, 0xab, 0xab, 0xab, 0x3c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x60, 0x00, // ls....<.......`.
78   0x00, 0x00, 0x30, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, // ..0.............
79   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x01, // ................
80   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, // ................
81   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa8, 0x01, // ................
82   0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x01, // .. ...@.........
83   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x40, 0x00, // ..........`...@.
84   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0x01, // ................
85   0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x01, // ......@.........
86   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0x01, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x40, 0x00, // ..............@.
87   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdb, 0x01, // ................
88   0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x01, // .. ...@.........
89   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe6, 0x01, 0x00, 0x00, 0x60, 0x01, 0x00, 0x00, 0x40, 0x00, // ..........`...@.
90   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf4, 0x01, // ................
91   0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, // ................
92   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x02, 0x00, 0x00, 0xa0, 0x09, 0x00, 0x00, 0x40, 0x00, // ..............@.
93   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x02, // ................
94   0x00, 0x00, 0xe0, 0x09, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xb0, 0x01, // ......@.........
95   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x02, 0x00, 0x00, 0x20, 0x0a, 0x00, 0x00, 0x04, 0x00, // ......(... .....
96   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ......4.......u_
97   0x76, 0x69, 0x65, 0x77, 0x52, 0x65, 0x63, 0x74, 0x00, 0xab, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, // viewRect........
98   0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, // ..........u_view
99   0x54, 0x65, 0x78, 0x65, 0x6c, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x00, 0xab, 0x03, 0x00, // Texel.u_view....
100   0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, // ..............u_
101   0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x00, 0x75, 0x5f, 0x70, 0x72, 0x6f, 0x6a, 0x00, 0x75, // invView.u_proj.u
102   0x5f, 0x69, 0x6e, 0x76, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x75, 0x5f, 0x76, 0x69, 0x65, 0x77, 0x50, // _invProj.u_viewP
103   0x72, 0x6f, 0x6a, 0x00, 0x75, 0x5f, 0x69, 0x6e, 0x76, 0x56, 0x69, 0x65, 0x77, 0x50, 0x72, 0x6f, // roj.u_invViewPro
104   0x6a, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x00, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, // j.u_model.......
105   0x04, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, // .. .......u_mode
106   0x6c, 0x56, 0x69, 0x65, 0x77, 0x00, 0x75, 0x5f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x56, 0x69, 0x65, // lView.u_modelVie
107   0x77, 0x50, 0x72, 0x6f, 0x6a, 0x00, 0x75, 0x5f, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x52, 0x65, 0x66, // wProj.u_alphaRef
108   0x00, 0xab, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
109   0x00, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, // ..Microsoft (R)
110   0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, // HLSL Shader Comp
111   0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, // iler 9.29.952.31
112   0x31, 0x31, 0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, // 11....ISGN......
113   0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......h.........
114   0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x68, 0x00, // ..............h.
115   0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, // ................
116   0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......n.........
117   0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x77, 0x00, // ..............w.
118   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, // ................
119   0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x4f, 0x53, 0x49, // ......COLOR.POSI
120   0x54, 0x49, 0x4f, 0x4e, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x4f, 0x53, // TION.TEXCOORD.OS
121   0x47, 0x4e, 0x84, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, // GN............h.
122   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
123   0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......t.........
124   0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x74, 0x00, // ..............t.
125   0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, // ................
126   0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ......z.........
127   0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x00, 0x00, 0x53, 0x56, // ..............SV
128   0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, // _POSITION.COLOR.
129   0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x53, 0x48, 0x44, 0x52, 0x54, 0x01, // TEXCOORD..SHDRT.
130   0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x55, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, // ..@...U...Y...F.
131   0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, //  ........._.....
132   0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, // ......_.........
133   0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5f, 0x00, // .._...r......._.
134   0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, // ..2.......g....
135   0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, // ..........e....
136   0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, // ......e.... ....
137   0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x68, 0x00, // ..e...2 ......h.
138   0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......8.........
139   0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..V.......F. ...
140   0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, // ......2.........
141   0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x00, 0x00, 0x00, 0x06, 0x10, // ..F. ...........
142   0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x00, // ......F.......2.
143   0x00, 0x0a, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..........F. ...
144   0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0xa6, 0x1a, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x0e, // ..............F.
145   0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, // ........... ....
146   0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8e, 0x20, 0x00, 0x00, 0x00, // ..F.......F. ...
147   0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, // ......6.... ....
148   0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, // ..F.......6....
149   0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, // ......F.......6.
150   0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x03, 0x00, // ..2 ......F.....
151   0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00, 0x08, 0x00, // ..>...STATt.....
152   0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, // ................
153   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
154   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
155   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
156   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
157   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
158   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
159   0x00, 0x00, 0x00, 0x04, 0x05, 0x00, 0x06, 0x00, 0x01, 0x00, 0x10, 0x00, 0x30, 0x0a,             // ............0.
160};
Property changes on: branches/osd/src/lib/bgfx/vs_debugfont.bin.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/bgfx_shader.sh
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_SHADER_H_HEADER_GUARD
7#define BGFX_SHADER_H_HEADER_GUARD
8
9#if !defined(BGFX_CONFIG_MAX_BONES)
10#   define BGFX_CONFIG_MAX_BONES 32
11#endif // !defined(BGFX_CONFIG_MAX_BONES)
12
13#ifndef __cplusplus
14
15#if BGFX_SHADER_LANGUAGE_HLSL
16#   define dFdx(_x) ddx(_x)
17#   define dFdy(_y) ddy(-_y)
18#   define inversesqrt(_x) rsqrt(_x)
19#   define fract(_x) frac(_x)
20
21#   define bvec2 bool2
22#   define bvec3 bool3
23#   define bvec4 bool4
24
25#   if BGFX_SHADER_LANGUAGE_HLSL > 3
26struct BgfxSampler2D
27{
28   SamplerState m_sampler;
29   Texture2D m_texture;
30};
31
32vec4 bgfxTexture2D(BgfxSampler2D _sampler, vec2 _coord)
33{
34   return _sampler.m_texture.Sample(_sampler.m_sampler, _coord);
35}
36
37vec4 bgfxTexture2DLod(BgfxSampler2D _sampler, vec2 _coord, float _level)
38{
39   return _sampler.m_texture.SampleLevel(_sampler.m_sampler, _coord, _level);
40}
41
42vec4 bgfxTexture2DProj(BgfxSampler2D _sampler, vec3 _coord)
43{
44   vec2 coord = _coord.xy * rcp(_coord.z);
45   return _sampler.m_texture.Sample(_sampler.m_sampler, coord);
46}
47
48vec4 bgfxTexture2DProj(BgfxSampler2D _sampler, vec4 _coord)
49{
50   vec2 coord = _coord.xy * rcp(_coord.w);
51   return _sampler.m_texture.Sample(_sampler.m_sampler, coord);
52}
53
54struct BgfxSampler2DShadow
55{
56   SamplerComparisonState m_sampler;
57   Texture2D m_texture;
58};
59
60float bgfxShadow2D(BgfxSampler2DShadow _sampler, vec3 _coord)
61{
62   return _sampler.m_texture.SampleCmp(_sampler.m_sampler, _coord.xy, _coord.z * 2.0 - 1.0);
63}
64
65float bgfxShadow2DProj(BgfxSampler2DShadow _sampler, vec4 _coord)
66{
67   vec3 coord = _coord.xyz * rcp(_coord.w);
68   return _sampler.m_texture.SampleCmp(_sampler.m_sampler, coord.xy, coord.z * 2.0 - 1.0);
69}
70
71struct BgfxSampler3D
72{
73   SamplerState m_sampler;
74   Texture3D m_texture;
75};
76
77vec4 bgfxTexture3D(BgfxSampler3D _sampler, vec3 _coord)
78{
79   return _sampler.m_texture.Sample(_sampler.m_sampler, _coord);
80}
81
82vec4 bgfxTexture3DLod(BgfxSampler3D _sampler, vec3 _coord, float _level)
83{
84   return _sampler.m_texture.SampleLevel(_sampler.m_sampler, _coord, _level);
85}
86
87struct BgfxSamplerCube
88{
89   SamplerState m_sampler;
90   TextureCube m_texture;
91};
92
93vec4 bgfxTextureCube(BgfxSamplerCube _sampler, vec3 _coord)
94{
95   return _sampler.m_texture.Sample(_sampler.m_sampler, _coord);
96}
97
98vec4 bgfxTextureCubeLod(BgfxSamplerCube _sampler, vec3 _coord, float _level)
99{
100   return _sampler.m_texture.SampleLevel(_sampler.m_sampler, _coord, _level);
101}
102
103#      define SAMPLER2D(_name, _reg) \
104         uniform SamplerState _name ## Sampler : register(s[_reg]); \
105         uniform Texture2D _name ## Texture : register(t[_reg]); \
106         static BgfxSampler2D _name = { _name ## Sampler, _name ## Texture }
107#      define sampler2D BgfxSampler2D
108#      define texture2D(_sampler, _coord) bgfxTexture2D(_sampler, _coord)
109#      define texture2DLod(_sampler, _coord, _level) bgfxTexture2DLod(_sampler, _coord, _level)
110#      define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord)
111
112#      define SAMPLER2DSHADOW(_name, _reg) \
113         uniform SamplerComparisonState _name ## Sampler : register(s[_reg]); \
114         uniform Texture2D _name ## Texture : register(t[_reg]); \
115         static BgfxSampler2DShadow _name = { _name ## Sampler, _name ## Texture }
116#      define sampler2DShadow BgfxSampler2DShadow
117#      define shadow2D(_sampler, _coord) bgfxShadow2D(_sampler, _coord)
118#      define shadow2DProj(_sampler, _coord) bgfxShadow2DProj(_sampler, _coord)
119
120#      define SAMPLER3D(_name, _reg) \
121         uniform SamplerState _name ## Sampler : register(s[_reg]); \
122         uniform Texture3D _name ## Texture : register(t[_reg]); \
123         static BgfxSampler3D _name = { _name ## Sampler, _name ## Texture }
124#      define sampler3D BgfxSampler3D
125#      define texture3D(_sampler, _coord) bgfxTexture3D(_sampler, _coord)
126#      define texture3DLod(_sampler, _coord, _level) bgfxTexture3DLod(_sampler, _coord, _level)
127
128#      define SAMPLERCUBE(_name, _reg) \
129         uniform SamplerState _name ## Sampler : register(s[_reg]); \
130         uniform TextureCube _name ## Texture : register(t[_reg]); \
131         static BgfxSamplerCube _name = { _name ## Sampler, _name ## Texture }
132#      define samplerCube BgfxSamplerCube
133#      define textureCube(_sampler, _coord) bgfxTextureCube(_sampler, _coord)
134#      define textureCubeLod(_sampler, _coord, _level) bgfxTextureCubeLod(_sampler, _coord, _level)
135#   else
136
137#      define sampler2DShadow sampler2D
138
139vec4 bgfxTexture2DProj(sampler2D _sampler, vec3 _coord)
140{
141   return tex2Dproj(_sampler, vec4(_coord.xy, 0.0, _coord.z) );
142}
143
144vec4 bgfxTexture2DProj(sampler2D _sampler, vec4 _coord)
145{
146   return tex2Dproj(_sampler, _coord);
147}
148
149float bgfxShadow2D(sampler2DShadow _sampler, vec3 _coord)
150{
151#if 0
152   float occluder = tex2D(_sampler, _coord.xy).x;
153   return step(_coord.z * 2.0 - 1.0, occluder);
154#else
155   return tex2Dproj(_sampler, vec4(_coord.xy, _coord.z * 2.0 - 1.0, 1.0) ).x;
156#endif // 0
157}
158
159float bgfxShadow2DProj(sampler2DShadow _sampler, vec4 _coord)
160{
161#if 0
162   vec3 coord = _coord.xyz * rcp(_coord.w);
163   float occluder = tex2D(_sampler, coord.xy).x;
164   return step(coord.z * 2.0 - 1.0, occluder);
165#else
166   return tex2Dproj(_sampler, _coord).x;
167#endif // 0
168}
169
170#      define SAMPLER2D(_name, _reg) uniform sampler2D _name : register(s ## _reg)
171#      define texture2D(_sampler, _coord) tex2D(_sampler, _coord)
172#      define texture2DLod(_sampler, _coord, _level) tex2Dlod(_sampler, vec4( (_coord).xy, 0.0, _level) )
173#      define texture2DProj(_sampler, _coord) bgfxTexture2DProj(_sampler, _coord)
174
175#      define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name : register(s ## _reg)
176#      define shadow2D(_sampler, _coord) bgfxShadow2D(_sampler, _coord)
177#      define shadow2DProj(_sampler, _coord) bgfxShadow2DProj(_sampler, _coord)
178
179#      define SAMPLER3D(_name, _reg) uniform sampler3D _name : register(s ## _reg)
180#      define texture3D(_sampler, _coord) tex3D(_sampler, _coord)
181#      define texture3DLod(_sampler, _coord, _level) tex3Dlod(_sampler, vec4( (_coord).xyz, _level) )
182
183#      define SAMPLERCUBE(_name, _reg) uniform samplerCUBE _name : register(s[_reg])
184#      define textureCube(_sampler, _coord) texCUBE(_sampler, _coord)
185#      define textureCubeLod(_sampler, _coord, _level) texCUBElod(_sampler, vec4( (_coord).xyz, _level) )
186#   endif //
187
188vec2 vec2_splat(float _x) { return vec2(_x, _x); }
189vec3 vec3_splat(float _x) { return vec3(_x, _x, _x); }
190vec4 vec4_splat(float _x) { return vec4(_x, _x, _x, _x); }
191
192vec3 instMul(vec3 _vec, mat3 _mtx) { return mul(_mtx, _vec); }
193vec3 instMul(mat3 _mtx, vec3 _vec) { return mul(_vec, _mtx); }
194vec4 instMul(vec4 _vec, mat4 _mtx) { return mul(_mtx, _vec); }
195vec4 instMul(mat4 _mtx, vec4 _vec) { return mul(_vec, _mtx); }
196
197bvec2 lessThan(vec2 _a, vec2 _b) { return _a < _b; }
198bvec3 lessThan(vec3 _a, vec3 _b) { return _a < _b; }
199bvec4 lessThan(vec4 _a, vec4 _b) { return _a < _b; }
200
201bvec2 lessThanEqual(vec2 _a, vec2 _b) { return _a <= _b; }
202bvec3 lessThanEqual(vec3 _a, vec3 _b) { return _a <= _b; }
203bvec4 lessThanEqual(vec4 _a, vec4 _b) { return _a <= _b; }
204
205bvec2 greaterThan(vec2 _a, vec2 _b) { return _a > _b; }
206bvec3 greaterThan(vec3 _a, vec3 _b) { return _a > _b; }
207bvec4 greaterThan(vec4 _a, vec4 _b) { return _a > _b; }
208
209bvec2 greaterThanEqual(vec2 _a, vec2 _b) { return _a >= _b; }
210bvec3 greaterThanEqual(vec3 _a, vec3 _b) { return _a >= _b; }
211bvec4 greaterThanEqual(vec4 _a, vec4 _b) { return _a >= _b; }
212
213bvec2 notEqual(vec2 _a, vec2 _b) { return _a != _b; }
214bvec3 notEqual(vec3 _a, vec3 _b) { return _a != _b; }
215bvec4 notEqual(vec4 _a, vec4 _b) { return _a != _b; }
216
217bvec2 equal(vec2 _a, vec2 _b) { return _a == _b; }
218bvec3 equal(vec3 _a, vec3 _b) { return _a == _b; }
219bvec4 equal(vec4 _a, vec4 _b) { return _a == _b; }
220
221float mix(float _a, float _b, float _t) { return lerp(_a, _b, _t); }
222vec2  mix(vec2  _a, vec2  _b, vec2  _t) { return lerp(_a, _b, _t); }
223vec3  mix(vec3  _a, vec3  _b, vec3  _t) { return lerp(_a, _b, _t); }
224vec4  mix(vec4  _a, vec4  _b, vec4  _t) { return lerp(_a, _b, _t); }
225
226float mod(float _a, float _b) { return _a - _b * floor(_a / _b); }
227vec2  mod(vec2  _a, vec2  _b) { return _a - _b * floor(_a / _b); }
228vec3  mod(vec3  _a, vec3  _b) { return _a - _b * floor(_a / _b); }
229vec4  mod(vec4  _a, vec4  _b) { return _a - _b * floor(_a / _b); }
230
231#elif BGFX_SHADER_LANGUAGE_GLSL
232#   define atan2(_x, _y) atan(_x, _y)
233#   define mul(_a, _b) ( (_a) * (_b) )
234#   define saturate(_x) clamp(_x, 0.0, 1.0)
235#   define SAMPLER2D(_name, _reg) uniform sampler2D _name
236#   define SAMPLER3D(_name, _reg) uniform sampler3D _name
237#   define SAMPLERCUBE(_name, _reg) uniform samplerCube _name
238#   define SAMPLER2DSHADOW(_name, _reg) uniform sampler2DShadow _name
239#   define vec2_splat(_x) vec2(_x)
240#   define vec3_splat(_x) vec3(_x)
241#   define vec4_splat(_x) vec4(_x)
242
243vec3 instMul(vec3 _vec, mat3 _mtx) { return mul(_vec, _mtx); }
244vec3 instMul(mat3 _mtx, vec3 _vec) { return mul(_mtx, _vec); }
245vec4 instMul(vec4 _vec, mat4 _mtx) { return mul(_vec, _mtx); }
246vec4 instMul(mat4 _mtx, vec4 _vec) { return mul(_mtx, _vec); }
247
248float rcp(float _a) { return 1.0/_a; }
249vec2  rcp(vec2  _a) { return vec2(1.0)/_a; }
250vec3  rcp(vec3  _a) { return vec3(1.0)/_a; }
251vec4  rcp(vec4  _a) { return vec4(1.0)/_a; }
252#endif // BGFX_SHADER_LANGUAGE_HLSL
253
254uniform vec4  u_viewRect;
255uniform vec4  u_viewTexel;
256uniform mat4  u_view;
257uniform mat4  u_invView;
258uniform mat4  u_proj;
259uniform mat4  u_invProj;
260uniform mat4  u_viewProj;
261uniform mat4  u_invViewProj;
262uniform mat4  u_model[BGFX_CONFIG_MAX_BONES];
263uniform mat4  u_modelView;
264uniform mat4  u_modelViewProj;
265uniform float u_alphaRef;
266
267#endif // __cplusplus
268
269#endif // BGFX_SHADER_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/bgfx_shader.sh
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_eagl.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_GLCONTEXT_EAGL_H_HEADER_GUARD
7#define BGFX_GLCONTEXT_EAGL_H_HEADER_GUARD
8
9#if BX_PLATFORM_IOS
10
11namespace bgfx
12{
13   struct GlContext
14   {
15      GlContext()
16         : m_context(0)
17      {
18      }
19
20      void create(uint32_t _width, uint32_t _height);
21      void destroy();
22      void resize(uint32_t _width, uint32_t _height, bool _vsync);
23      void swap();
24      void import();
25
26      bool isValid() const
27      {
28         return 0 != m_context;
29      }
30
31      void* m_view;
32      void* m_context;
33
34      GLuint m_fbo;
35      GLuint m_colorRbo;
36      GLuint m_depthStencilRbo;
37   };
38} // namespace bgfx
39
40#endif // BX_PLATFORM_IOS
41
42#endif // BGFX_GLCONTEXT_EAGL_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/glcontext_eagl.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/renderer_d3d.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_RENDERER_D3D_H_HEADER_GUARD
7#define BGFX_RENDERER_D3D_H_HEADER_GUARD
8
9#if BGFX_CONFIG_DEBUG && BGFX_CONFIG_RENDERER_DIRECT3D9 && !(BX_COMPILER_GCC || BX_COMPILER_CLANG)
10#   include <sal.h>
11#   include <dxerr.h>
12#   if BX_COMPILER_MSVC
13#      pragma comment(lib, "dxerr.lib")
14#   endif // BX_COMPILER_MSVC
15#   define DX_CHECK_EXTRA_F " (%s): %s"
16#   define DX_CHECK_EXTRA_ARGS , DXGetErrorString(__hr__), DXGetErrorDescription(__hr__)
17#else
18#   define DX_CHECK_EXTRA_F ""
19#   define DX_CHECK_EXTRA_ARGS
20#endif // BGFX_CONFIG_DEBUG && BGFX_CONFIG_RENDERER_DIRECT3D9
21
22namespace bgfx
23{
24#define _DX_CHECK(_call) \
25         BX_MACRO_BLOCK_BEGIN \
26            HRESULT __hr__ = _call; \
27            BX_CHECK(SUCCEEDED(__hr__), #_call " FAILED 0x%08x" DX_CHECK_EXTRA_F "\n" \
28               , (uint32_t)__hr__ \
29               DX_CHECK_EXTRA_ARGS \
30               ); \
31         BX_MACRO_BLOCK_END
32
33#define _DX_RELEASE(_ptr, _expected, _check) \
34         BX_MACRO_BLOCK_BEGIN \
35            if (NULL != _ptr) \
36            { \
37               ULONG count = _ptr->Release(); \
38               _check(isGraphicsDebuggerPresent() || _expected == count, "%p RefCount is %d (expected %d).", _ptr, count, _expected); BX_UNUSED(count); \
39               _ptr = NULL; \
40            } \
41         BX_MACRO_BLOCK_END
42
43#   define _DX_CHECK_REFCOUNT(_ptr, _expected) \
44         BX_MACRO_BLOCK_BEGIN \
45            ULONG count = getRefCount(_ptr); \
46            BX_CHECK(isGraphicsDebuggerPresent() || _expected == count, "%p RefCount is %d (expected %d).", _ptr, count, _expected); \
47         BX_MACRO_BLOCK_END
48
49#if BGFX_CONFIG_DEBUG
50#   define DX_CHECK(_call) _DX_CHECK(_call)
51#   define DX_CHECK_REFCOUNT(_ptr, _expected) _DX_CHECK_REFCOUNT(_ptr, _expected)
52#else
53#   define DX_CHECK(_call) _call
54#   define DX_CHECK_REFCOUNT(_ptr, _expected)
55#endif // BGFX_CONFIG_DEBUG
56
57#define DX_RELEASE(_ptr, _expected) _DX_RELEASE(_ptr, _expected, BX_CHECK)
58#define DX_RELEASE_WARNONLY(_ptr, _expected) _DX_RELEASE(_ptr, _expected, BX_WARN)
59
60   typedef int (WINAPI *D3DPERF_BeginEventFunc)(DWORD _color, LPCWSTR _wszName);
61   typedef int (WINAPI *D3DPERF_EndEventFunc)();
62   typedef void (WINAPI *D3DPERF_SetMarkerFunc)(DWORD _color, LPCWSTR _wszName);
63   typedef void (WINAPI *D3DPERF_SetRegionFunc)(DWORD _color, LPCWSTR _wszName);
64   typedef BOOL (WINAPI *D3DPERF_QueryRepeatFrameFunc)();
65   typedef void (WINAPI *D3DPERF_SetOptionsFunc)(DWORD _options);
66   typedef DWORD (WINAPI *D3DPERF_GetStatusFunc)();
67
68#define _PIX_SETMARKER(_col, _name) m_D3DPERF_SetMarker(_col, _name)
69#define _PIX_BEGINEVENT(_col, _name) m_D3DPERF_BeginEvent(_col, _name)
70#define _PIX_ENDEVENT() m_D3DPERF_EndEvent()
71
72#if BGFX_CONFIG_DEBUG_PIX
73#   define PIX_SETMARKER(_color, _name) _PIX_SETMARKER(_color, _name)
74#   define PIX_BEGINEVENT(_color, _name) _PIX_BEGINEVENT(_color, _name)
75#   define PIX_ENDEVENT() _PIX_ENDEVENT()
76#else
77#   define PIX_SETMARKER(_color, _name)
78#   define PIX_BEGINEVENT(_color, _name)
79#   define PIX_ENDEVENT()
80#endif // BGFX_CONFIG_DEBUG_PIX
81
82   inline int getRefCount(IUnknown* _interface)
83   {
84      _interface->AddRef();
85      return _interface->Release();
86   }
87
88} // namespace bgfx
89
90#endif // BGFX_RENDERER_D3D_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/renderer_d3d.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/renderer_d3d11.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_RENDERER_D3D11_H_HEADER_GUARD
7#define BGFX_RENDERER_D3D11_H_HEADER_GUARD
8
9#define USE_D3D11_DYNAMIC_LIB !BX_PLATFORM_WINRT
10
11#if !USE_D3D11_DYNAMIC_LIB
12#   undef  BGFX_CONFIG_DEBUG_PIX
13#   define BGFX_CONFIG_DEBUG_PIX 0
14#endif // !USE_D3D11_DYNAMIC_LIB
15
16#define D3D11_NO_HELPERS
17#include <d3d11.h>
18#include "renderer_d3d.h"
19
20#define D3DCOLOR_ARGB(_a, _r, _g, _b) ( (DWORD)( ( ( (_a)&0xff)<<24)|( ( (_r)&0xff)<<16)|( ( (_g)&0xff)<<8)|( (_b)&0xff) ) )
21#define D3DCOLOR_RGBA(_r, _g, _b, _a) D3DCOLOR_ARGB(_a, _r, _g, _b)
22
23namespace bgfx
24{
25   typedef HRESULT (WINAPI * PFN_CREATEDXGIFACTORY)(REFIID _riid, void** _factory);
26
27   template <typename Ty>
28   class StateCacheT
29   {
30   public:
31      void add(uint64_t _id, Ty* _item)
32      {
33         invalidate(_id);
34         m_hashMap.insert(stl::make_pair(_id, _item) );
35      }
36
37      Ty* find(uint64_t _id)
38      {
39         HashMap::iterator it = m_hashMap.find(_id);
40         if (it != m_hashMap.end() )
41         {
42            return it->second;
43         }
44
45         return NULL;
46      }
47
48      void invalidate(uint64_t _id)
49      {
50         HashMap::iterator it = m_hashMap.find(_id);
51         if (it != m_hashMap.end() )
52         {
53            DX_RELEASE_WARNONLY(it->second, 0);
54            m_hashMap.erase(it);
55         }
56      }
57
58      void invalidate()
59      {
60         for (HashMap::iterator it = m_hashMap.begin(), itEnd = m_hashMap.end(); it != itEnd; ++it)
61         {
62            DX_CHECK_REFCOUNT(it->second, 1);
63            it->second->Release();
64         }
65
66         m_hashMap.clear();
67      }
68
69   private:
70      typedef stl::unordered_map<uint64_t, Ty*> HashMap;
71      HashMap m_hashMap;
72   };
73
74   struct IndexBufferD3D11
75   {
76      IndexBufferD3D11()
77         : m_ptr(NULL)
78         , m_dynamic(false)
79      {
80      }
81
82      void create(uint32_t _size, void* _data);
83      void update(uint32_t _offset, uint32_t _size, void* _data);
84
85      void destroy()
86      {
87         if (NULL != m_ptr)
88         {
89            DX_RELEASE(m_ptr, 0);
90            m_dynamic = false;
91         }
92      }
93
94      ID3D11Buffer* m_ptr;
95      uint32_t m_size;
96      bool m_dynamic;
97   };
98
99   struct VertexBufferD3D11
100   {
101      VertexBufferD3D11()
102         : m_ptr(NULL)
103         , m_dynamic(false)
104      {
105      }
106
107      void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle);
108      void update(uint32_t _offset, uint32_t _size, void* _data);
109
110      void destroy()
111      {
112         if (NULL != m_ptr)
113         {
114            DX_RELEASE(m_ptr, 0);
115            m_dynamic = false;
116         }
117      }
118
119      ID3D11Buffer* m_ptr;
120      uint32_t m_size;
121      VertexDeclHandle m_decl;
122      bool m_dynamic;
123   };
124
125   struct ShaderD3D11
126   {
127      ShaderD3D11()
128         : m_ptr(NULL)
129         , m_code(NULL)
130         , m_buffer(NULL)
131         , m_constantBuffer(NULL)
132         , m_hash(0)
133         , m_numUniforms(0)
134         , m_numPredefined(0)
135      {
136      }
137
138      void create(const Memory* _mem);
139      DWORD* getShaderCode(uint8_t _fragmentBit, const Memory* _mem);
140
141      void destroy()
142      {
143         if (NULL != m_constantBuffer)
144         {
145            ConstantBuffer::destroy(m_constantBuffer);
146            m_constantBuffer = NULL;
147         }
148
149         m_numPredefined = 0;
150
151         if (NULL != m_buffer)
152         {
153            DX_RELEASE(m_buffer, 0);
154         }
155
156         DX_RELEASE(m_ptr, 0);
157
158         if (NULL != m_code)
159         {
160            release(m_code);
161            m_code = NULL;
162            m_hash = 0;
163         }
164      }
165
166      union
167      {
168         ID3D11ComputeShader* m_computeShader;
169         ID3D11PixelShader*   m_pixelShader;
170         ID3D11VertexShader*  m_vertexShader;
171         IUnknown*            m_ptr;
172      };
173      const Memory* m_code;
174      ID3D11Buffer* m_buffer;
175      ConstantBuffer* m_constantBuffer;
176
177      PredefinedUniform m_predefined[PredefinedUniform::Count];
178      uint8_t m_attrMask[Attrib::Count];
179
180      uint32_t m_hash;
181
182      uint16_t m_numUniforms;
183      uint8_t m_numPredefined;
184   };
185
186   struct ProgramD3D11
187   {
188      ProgramD3D11()
189         : m_vsh(NULL)
190         , m_fsh(NULL)
191      {
192      }
193
194      void create(const ShaderD3D11* _vsh, const ShaderD3D11* _fsh)
195      {
196         BX_CHECK(NULL != _vsh->m_ptr, "Vertex shader doesn't exist.");
197         m_vsh = _vsh;
198         memcpy(&m_predefined[0], _vsh->m_predefined, _vsh->m_numPredefined*sizeof(PredefinedUniform) );
199         m_numPredefined = _vsh->m_numPredefined;
200
201         if (NULL != _fsh)
202         {
203            BX_CHECK(NULL != _fsh->m_ptr, "Fragment shader doesn't exist.");
204            m_fsh = _fsh;
205            memcpy(&m_predefined[m_numPredefined], _fsh->m_predefined, _fsh->m_numPredefined*sizeof(PredefinedUniform) );
206            m_numPredefined += _fsh->m_numPredefined;
207         }
208      }
209
210      void destroy()
211      {
212         m_numPredefined = 0;
213         m_vsh = NULL;
214         m_fsh = NULL;
215      }
216
217      const ShaderD3D11* m_vsh;
218      const ShaderD3D11* m_fsh;
219
220      PredefinedUniform m_predefined[PredefinedUniform::Count*2];
221      uint8_t m_numPredefined;
222   };
223
224   struct TextureD3D11
225   {
226      enum Enum
227      {
228         Texture2D,
229         Texture3D,
230         TextureCube,
231      };
232
233      TextureD3D11()
234         : m_ptr(NULL)
235         , m_srv(NULL)
236         , m_uav(NULL)
237         , m_sampler(NULL)
238         , m_numMips(0)
239      {
240      }
241
242      void create(const Memory* _mem, uint32_t _flags, uint8_t _skip);
243      void destroy();
244      void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem);
245      void commit(uint8_t _stage, uint32_t _flags = BGFX_SAMPLER_DEFAULT_FLAGS);
246      void resolve();
247
248      union
249      {
250         ID3D11Resource* m_ptr;
251         ID3D11Texture2D* m_texture2d;
252         ID3D11Texture3D* m_texture3d;
253      };
254
255      ID3D11ShaderResourceView* m_srv;
256      ID3D11UnorderedAccessView* m_uav;
257      ID3D11SamplerState* m_sampler;
258      uint32_t m_flags;
259      uint8_t m_type;
260      uint8_t m_requestedFormat;
261      uint8_t m_textureFormat;
262      uint8_t m_numMips;
263   };
264
265   struct FrameBufferD3D11
266   {
267      FrameBufferD3D11()
268         : m_num(0)
269      {
270      }
271
272      void create(uint8_t _num, const TextureHandle* _handles);
273      void destroy();
274      void resolve();
275      void clear(const Clear& _clear);
276
277      ID3D11RenderTargetView* m_rtv[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1];
278      ID3D11ShaderResourceView* m_srv[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1];
279      ID3D11DepthStencilView* m_dsv;
280      uint8_t m_num;
281   };
282
283} // namespace bgfx
284
285#endif // BGFX_RENDERER_D3D11_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/renderer_d3d11.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/vs_debugfont.sc
r0r31734
1$input a_position, a_color0, a_color1, a_texcoord0
2$output v_color0, v_color1, v_texcoord0
3
4/*
5 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
6 * License: http://www.opensource.org/licenses/BSD-2-Clause
7 */
8
9#include "bgfx_shader.sh"
10
11void main()
12{
13   gl_Position = mul(u_modelViewProj, vec4(a_position, 1.0) );
14   v_texcoord0 = a_texcoord0;
15   v_color0 = a_color0;
16   v_color1 = a_color1;
17}
Property changes on: branches/osd/src/lib/bgfx/vs_debugfont.sc
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/bgfx_compute.sh
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_COMPUTE_H_HEADER_GUARD
7#define BGFX_COMPUTE_H_HEADER_GUARD
8
9#ifndef __cplusplus
10
11#if BGFX_SHADER_LANGUAGE_HLSL
12
13#define IMAGE2D_RO(_name, _reg) Texture2D           _name : register(t[_reg])
14#define IMAGE2D_RW(_name, _reg) RWTexture2D<float4> _name : register(u[_reg])
15#define IMAGE2D_WR(_name, _reg) IMAGE2D_RW(_name, _reg)
16
17#define BUFFER_RO(_name, _struct, _reg) StructuredBuffer<_struct>   _name : register(b[_reg])
18#define BUFFER_RW(_name, _struct, _reg) RWStructuredBuffer<_struct> _name : register(b[_reg])
19#define BUFFER_WR(_name, _struct, _reg) BUFFER_RW(_name, _struct, _reg)
20
21#define NUM_THREADS(_x, _y, _z) [numthreads(_x, _y, _z)]
22
23vec4 imageLoad(Texture2D _image, ivec2 _uv)
24{
25   return _image.Load(uint3(_uv.xy, 0) );
26}
27
28ivec2 imageSize(Texture2D _image)
29{
30   ivec2 result;
31   _image.GetDimensions(result.x, result.y);
32   return result;
33}
34
35//vec4 imageLoad(RWTexture2D<float4> _image, ivec2 _uv)
36//{
37//   return _image[_uv];
38//}
39
40ivec2 imageSize(RWTexture2D<float4> _image)
41{
42   ivec2 result;
43   _image.GetDimensions(result.x, result.y);
44   return result;
45}
46
47void imageStore(RWTexture2D<float4> _image, ivec2 _uv, vec4 _rgba)
48{
49   _image[_uv] = _rgba;
50}
51
52#define __ATOMIC_IMPL_TYPE(_genType, _glFunc, _dxFunc) \
53         _genType _glFunc(_genType _mem, _genType _data) \
54         { \
55            _genType result; \
56            _dxFunc(_mem, _data, result); \
57            return result; \
58         }
59
60#define __ATOMIC_IMPL(_glFunc, _dxFunc) \
61         __ATOMIC_IMPL_TYPE(int,  _glFunc, _dxFunc) \
62         __ATOMIC_IMPL_TYPE(uint, _glFunc, _dxFunc)
63
64__ATOMIC_IMPL(atomicAdd,      InterlockedAdd);
65__ATOMIC_IMPL(atomicAnd,      InterlockedAnd);
66__ATOMIC_IMPL(atomicExchange, InterlockedExchange);
67__ATOMIC_IMPL(atomicMax,      InterlockedMax);
68__ATOMIC_IMPL(atomicMin,      InterlockedMin);
69__ATOMIC_IMPL(atomicOr,       InterlockedOr);
70__ATOMIC_IMPL(atomicXor,      InterlockedXor);
71
72int atomicCompSwap(int _mem, int _compare, int _data)
73{
74   int result;
75   InterlockedCompareExchange(_mem, _compare, _data, result);
76   return result;
77}
78
79uint atomicCompSwap(uint _mem, uint _compare, uint _data)
80{
81   uint result;
82   InterlockedCompareExchange(_mem, _compare, _data, result);
83   return result;
84}
85
86// InterlockedCompareStore
87
88#define barrier()                    GroupMemoryBarrierWithGroupSync()
89#define memoryBarrier()              GroupMemoryBarrierWithGroupSync()
90#define memoryBarrierAtomicCounter() GroupMemoryBarrierWithGroupSync()
91#define memoryBarrierBuffer()        GroupMemoryBarrierWithGroupSync()
92#define memoryBarrierImage()         GroupMemoryBarrierWithGroupSync()
93#define memoryBarrierShared()        GroupMemoryBarrierWithGroupSync()
94#define groupMemoryBarrier()         GroupMemoryBarrierWithGroupSync()
95
96#else
97
98#define __IMAGE2D_XX(_name, _reg, _access) \
99         layout(rgba8, binding=_reg) _access uniform highp image2D _name
100
101#define IMAGE2D_RO(_name, _reg) __IMAGE2D_XX(_name, _reg, readonly)
102#define IMAGE2D_RW(_name, _reg) __IMAGE2D_XX(_name, _reg, readwrite)
103#define IMAGE2D_WR(_name, _reg) __IMAGE2D_XX(_name, _reg, writeonly)
104
105#define __BUFFER_XX(_name, _type, _reg, _access) \
106         layout(std430, binding=_reg) _access buffer _name ## Buffer \
107         { \
108            _type _name[]; \
109         }
110
111#define BUFFER_RO(_name, _type, _reg) __BUFFER_XX(_name, _type, _reg, readonly)
112#define BUFFER_RW(_name, _type, _reg) __BUFFER_XX(_name, _type, _reg, readwrite)
113#define BUFFER_WR(_name, _type, _reg) __BUFFER_XX(_name, _type, _reg, writeonly)
114
115#define NUM_THREADS(_x, _y, _z) layout (local_size_x = _x, local_size_y = _y, local_size_z = _z) in;
116
117#endif // BGFX_SHADER_LANGUAGE_HLSL
118
119#endif // __cplusplus
120
121#endif // BGFX_COMPUTE_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/bgfx_compute.sh
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/config.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_CONFIG_H_HEADER_GUARD
7#define BGFX_CONFIG_H_HEADER_GUARD
8
9#include <bx/platform.h>
10
11#ifndef BGFX_CONFIG_DEBUG
12#   define BGFX_CONFIG_DEBUG 0
13#endif // BGFX_CONFIG_DEBUG
14
15#if !defined(BGFX_CONFIG_RENDERER_DIRECT3D9) \
16   && !defined(BGFX_CONFIG_RENDERER_DIRECT3D11) \
17   && !defined(BGFX_CONFIG_RENDERER_OPENGL) \
18   && !defined(BGFX_CONFIG_RENDERER_OPENGLES) \
19   && !defined(BGFX_CONFIG_RENDERER_NULL)
20
21#   ifndef BGFX_CONFIG_RENDERER_DIRECT3D9
22#      define BGFX_CONFIG_RENDERER_DIRECT3D9 (0 \
23               || (BX_PLATFORM_WINDOWS && BX_PLATFORM_WINDOWS < 0x0602 /*_WIN32_WINNT_WIN8*/) \
24               || BX_PLATFORM_XBOX360 \
25               ? 1 : 0)
26#   endif // BGFX_CONFIG_RENDERER_DIRECT3D9
27
28#   ifndef BGFX_CONFIG_RENDERER_DIRECT3D11
29#      define BGFX_CONFIG_RENDERER_DIRECT3D11 (0 \
30               || (BX_PLATFORM_WINDOWS && BX_PLATFORM_WINDOWS >= 0x0601 /*_WIN32_WINNT_WIN7*/) \
31               ? 1 : 0)
32#   endif // BGFX_CONFIG_RENDERER_DIRECT3D11
33
34#   ifndef BGFX_CONFIG_RENDERER_OPENGL
35#      define BGFX_CONFIG_RENDERER_OPENGL (0 \
36               || BX_PLATFORM_WINDOWS \
37               || BX_PLATFORM_LINUX \
38               || BX_PLATFORM_FREEBSD \
39               || BX_PLATFORM_OSX \
40               ? 1 : 0)
41#   endif // BGFX_CONFIG_RENDERER_OPENGL
42
43#   ifndef BGFX_CONFIG_RENDERER_OPENGLES
44#      define BGFX_CONFIG_RENDERER_OPENGLES (0 \
45               || BX_PLATFORM_EMSCRIPTEN \
46               || BX_PLATFORM_NACL \
47               || BX_PLATFORM_ANDROID \
48               || BX_PLATFORM_IOS \
49               || BX_PLATFORM_QNX \
50               ? 1 : 0)
51#   endif // BGFX_CONFIG_RENDERER_OPENGLES
52
53#   ifndef BGFX_CONFIG_RENDERER_NULL
54#      define BGFX_CONFIG_RENDERER_NULL (!(0 \
55               || BGFX_CONFIG_RENDERER_DIRECT3D9 \
56               || BGFX_CONFIG_RENDERER_DIRECT3D11 \
57               || BGFX_CONFIG_RENDERER_OPENGL \
58               || BGFX_CONFIG_RENDERER_OPENGLES \
59               ? 1 : 0) )
60#   endif // BGFX_CONFIG_RENDERER_NULL
61#else
62#   ifndef BGFX_CONFIG_RENDERER_DIRECT3D9
63#      define BGFX_CONFIG_RENDERER_DIRECT3D9 0
64#   endif // BGFX_CONFIG_RENDERER_DIRECT3D9
65
66#   ifndef BGFX_CONFIG_RENDERER_DIRECT3D11
67#      define BGFX_CONFIG_RENDERER_DIRECT3D11 0
68#   endif // BGFX_CONFIG_RENDERER_DIRECT3D11
69
70#   ifndef BGFX_CONFIG_RENDERER_OPENGL
71#      define BGFX_CONFIG_RENDERER_OPENGL 0
72#   endif // BGFX_CONFIG_RENDERER_OPENGL
73
74#   ifndef BGFX_CONFIG_RENDERER_OPENGLES
75#      define BGFX_CONFIG_RENDERER_OPENGLES 0
76#   endif // BGFX_CONFIG_RENDERER_OPENGLES
77
78#   ifndef BGFX_CONFIG_RENDERER_NULL
79#      define BGFX_CONFIG_RENDERER_NULL 0
80#   endif // BGFX_CONFIG_RENDERER_NULL
81#endif // !defined...
82
83#if BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGL < 21
84#   undef BGFX_CONFIG_RENDERER_OPENGL
85#   define BGFX_CONFIG_RENDERER_OPENGL 21
86#endif // BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGL < 21
87
88#if BGFX_CONFIG_RENDERER_OPENGLES && BGFX_CONFIG_RENDERER_OPENGLES < 20
89#   undef BGFX_CONFIG_RENDERER_OPENGLES
90#   define BGFX_CONFIG_RENDERER_OPENGLES 20
91#endif // BGFX_CONFIG_RENDERER_OPENGLES && BGFX_CONFIG_RENDERER_OPENGLES < 20
92
93#if BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGLES
94#   error "Can't define both BGFX_CONFIG_RENDERER_OPENGL and BGFX_CONFIG_RENDERER_OPENGLES"
95#endif // BGFX_CONFIG_RENDERER_OPENGL && BGFX_CONFIG_RENDERER_OPENGLES
96
97#ifndef BGFX_CONFIG_DEBUG_PERFHUD
98#   define BGFX_CONFIG_DEBUG_PERFHUD 0
99#endif // BGFX_CONFIG_DEBUG_NVPERFHUD
100
101#ifndef BGFX_CONFIG_RENDERER_USE_EXTENSIONS
102#   define BGFX_CONFIG_RENDERER_USE_EXTENSIONS 1
103#endif // BGFX_CONFIG_RENDERER_USE_EXTENSIONS
104
105/// DX9 PIX markers
106#ifndef BGFX_CONFIG_DEBUG_PIX
107#   define BGFX_CONFIG_DEBUG_PIX BGFX_CONFIG_DEBUG
108#endif // BGFX_CONFIG_DEBUG_PIX
109
110/// DX11 object names
111#ifndef BGFX_CONFIG_DEBUG_OBJECT_NAME
112#   define BGFX_CONFIG_DEBUG_OBJECT_NAME BGFX_CONFIG_DEBUG
113#endif // BGFX_CONFIG_DEBUG_OBJECT_NAME
114
115#ifndef BGFX_CONFIG_MULTITHREADED
116#   define BGFX_CONFIG_MULTITHREADED ( (!BGFX_CONFIG_RENDERER_NULL)&&(0 \
117                  || BX_PLATFORM_ANDROID \
118                  || BX_PLATFORM_IOS \
119                  || BX_PLATFORM_LINUX \
120                  || BX_PLATFORM_FREEBSD \
121                  || BX_PLATFORM_NACL \
122                  || BX_PLATFORM_OSX \
123                  || BX_PLATFORM_QNX \
124                  || BX_PLATFORM_WINDOWS \
125                  || BX_PLATFORM_XBOX360 \
126                  ? 1 : 0) )
127#endif // BGFX_CONFIG_MULTITHREADED
128
129#ifndef BGFX_CONFIG_MAX_DRAW_CALLS
130#   define BGFX_CONFIG_MAX_DRAW_CALLS ( (64<<10)-1)
131#endif // BGFX_CONFIG_MAX_DRAW_CALLS
132
133#ifndef BGFX_CONFIG_MAX_MATRIX_CACHE
134#   define BGFX_CONFIG_MAX_MATRIX_CACHE (64<<10)
135#endif // BGFX_CONFIG_MAX_MATRIX_CACHE
136
137#ifndef BGFX_CONFIG_MAX_RECT_CACHE
138#   define BGFX_CONFIG_MAX_RECT_CACHE (4<<10)
139#endif //  BGFX_CONFIG_MAX_RECT_CACHE
140
141#ifndef BGFX_CONFIG_MAX_VIEWS
142// Do not change. Must be power of 2.
143#   define BGFX_CONFIG_MAX_VIEWS 32
144#endif // BGFX_CONFIG_MAX_VIEWS
145
146#ifndef BGFX_CONFIG_MAX_VERTEX_DECLS
147#   define BGFX_CONFIG_MAX_VERTEX_DECLS 64
148#endif // BGFX_CONFIG_MAX_VERTEX_DECLS
149
150#ifndef BGFX_CONFIG_MAX_INDEX_BUFFERS
151#   define BGFX_CONFIG_MAX_INDEX_BUFFERS (4<<10)
152#endif // BGFX_CONFIG_MAX_INDEX_BUFFERS
153
154#ifndef BGFX_CONFIG_MAX_VERTEX_BUFFERS
155#   define BGFX_CONFIG_MAX_VERTEX_BUFFERS (4<<10)
156#endif // BGFX_CONFIG_MAX_VERTEX_BUFFERS
157
158#ifndef BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS
159#   define BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS (4<<10)
160#endif // BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS
161
162#ifndef BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS
163#   define BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS (4<<10)
164#endif // BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS
165
166#ifndef BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE
167#   define BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE (1<<20)
168#endif // BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE
169
170#ifndef BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE
171#   define BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE (3<<20)
172#endif // BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE
173
174#ifndef BGFX_CONFIG_MAX_SHADERS
175#   define BGFX_CONFIG_MAX_SHADERS 512
176#endif // BGFX_CONFIG_MAX_FRAGMENT_SHADERS
177
178#ifndef BGFX_CONFIG_MAX_PROGRAMS
179// Must be power of 2.
180#   define BGFX_CONFIG_MAX_PROGRAMS 512
181#endif // BGFX_CONFIG_MAX_PROGRAMS
182
183#ifndef BGFX_CONFIG_MAX_TEXTURES
184#   define BGFX_CONFIG_MAX_TEXTURES (4<<10)
185#endif // BGFX_CONFIG_MAX_TEXTURES
186
187#ifndef BGFX_CONFIG_MAX_TEXTURE_SAMPLERS
188#   define BGFX_CONFIG_MAX_TEXTURE_SAMPLERS 16
189#endif // BGFX_CONFIG_MAX_TEXTURE_SAMPLERS
190
191#ifndef BGFX_CONFIG_MAX_FRAME_BUFFERS
192#   define BGFX_CONFIG_MAX_FRAME_BUFFERS 64
193#endif // BGFX_CONFIG_MAX_FRAME_BUFFERS
194
195#ifndef BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS
196#   define BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS 4
197#endif // BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS
198
199#ifndef BGFX_CONFIG_MAX_UNIFORMS
200#   define BGFX_CONFIG_MAX_UNIFORMS 512
201#endif // BGFX_CONFIG_MAX_CONSTANTS
202
203#ifndef BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE
204#   define BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE (64<<10)
205#endif // BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE
206
207#ifndef BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE
208#   define BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE (6<<20)
209#endif // BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE
210
211#ifndef BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE
212#   define BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE (2<<20)
213#endif // BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE
214
215#ifndef BGFX_CONFIG_MAX_CONSTANT_BUFFER_SIZE
216#   define BGFX_CONFIG_MAX_CONSTANT_BUFFER_SIZE (512<<10)
217#endif // BGFX_CONFIG_MAX_CONSTANT_BUFFER_SIZE
218
219#ifndef BGFX_CONFIG_USE_TINYSTL
220#   define BGFX_CONFIG_USE_TINYSTL 1
221#endif // BGFX_CONFIG_USE_TINYSTL
222
223#ifndef BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT
224#   define BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT 5
225#endif // BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT
226
227#ifndef BGFX_CONFIG_CLEAR_QUAD
228#   define BGFX_CONFIG_CLEAR_QUAD (BGFX_CONFIG_RENDERER_DIRECT3D11|BGFX_CONFIG_RENDERER_OPENGL)
229#endif // BGFX_CONFIG_CLEAR_QUAD
230
231#endif // BGFX_CONFIG_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/config.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/vertexdecl.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_VERTEXDECL_H_HEADER_GUARD
7#define BGFX_VERTEXDECL_H_HEADER_GUARD
8
9#include <bgfx.h>
10#include <bx/readerwriter.h>
11
12namespace bgfx
13{
14   ///
15   void initAttribTypeSizeTable(RendererType::Enum _type);
16
17   /// Returns attribute name.
18   const char* getAttribName(Attrib::Enum _attr);
19
20   /// Dump vertex declaration into debug output.
21   void dump(const VertexDecl& _decl);
22
23   ///
24   Attrib::Enum idToAttrib(uint16_t id);
25
26   ///
27   uint16_t attribToId(Attrib::Enum _attr);
28
29   ///
30   AttribType::Enum idToAttribType(uint16_t id);
31
32   ///
33   int32_t write(bx::WriterI* _writer, const bgfx::VertexDecl& _decl);
34
35   ///
36   int32_t read(bx::ReaderI* _reader, bgfx::VertexDecl& _decl);
37
38} // namespace bgfx
39
40#endif // BGFX_VERTEXDECL_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/vertexdecl.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_wgl.cpp
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7
8#if (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL)
9#   include "renderer_gl.h"
10
11#   if BGFX_USE_WGL
12
13namespace bgfx
14{
15   PFNWGLGETPROCADDRESSPROC wglGetProcAddress;
16   PFNWGLMAKECURRENTPROC wglMakeCurrent;
17   PFNWGLCREATECONTEXTPROC wglCreateContext;
18   PFNWGLDELETECONTEXTPROC wglDeleteContext;
19   PFNWGLGETEXTENSIONSSTRINGARBPROC wglGetExtensionsStringARB;
20   PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormatARB;
21   PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB;
22   PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT;
23
24#   define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
25#   include "glimports.h"
26
27   static HGLRC createContext(HDC _hdc)
28   {
29      PIXELFORMATDESCRIPTOR pfd;
30      memset(&pfd, 0, sizeof(pfd) );
31      pfd.nSize = sizeof(PIXELFORMATDESCRIPTOR);
32      pfd.nVersion = 1;
33      pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
34      pfd.iPixelType = PFD_TYPE_RGBA;
35      pfd.cColorBits = 32;
36      pfd.cAlphaBits = 8;
37      pfd.cDepthBits = 24;
38      pfd.cStencilBits = 8;
39      pfd.iLayerType = PFD_MAIN_PLANE;
40
41      int pixelFormat = ChoosePixelFormat(_hdc, &pfd);
42      BGFX_FATAL(0 != pixelFormat, Fatal::UnableToInitialize, "ChoosePixelFormat failed!");
43
44      DescribePixelFormat(_hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
45
46      BX_TRACE("Pixel format:\n"
47         "\tiPixelType %d\n"
48         "\tcColorBits %d\n"
49         "\tcAlphaBits %d\n"
50         "\tcDepthBits %d\n"
51         "\tcStencilBits %d\n"
52         , pfd.iPixelType
53         , pfd.cColorBits
54         , pfd.cAlphaBits
55         , pfd.cDepthBits
56         , pfd.cStencilBits
57         );
58
59      int result;
60      result = SetPixelFormat(_hdc, pixelFormat, &pfd);
61      BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "SetPixelFormat failed!");
62
63      HGLRC context = wglCreateContext(_hdc);
64      BGFX_FATAL(NULL != context, Fatal::UnableToInitialize, "wglCreateContext failed!");
65
66      result = wglMakeCurrent(_hdc, context);
67      BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "wglMakeCurrent failed!");
68
69      return context;
70   }
71
72   void GlContext::create(uint32_t /*_width*/, uint32_t /*_height*/)
73   {
74      m_opengl32dll = bx::dlopen("opengl32.dll");
75      BGFX_FATAL(NULL != m_opengl32dll, Fatal::UnableToInitialize, "Failed to load opengl32.dll.");
76
77      wglGetProcAddress = (PFNWGLGETPROCADDRESSPROC)bx::dlsym(m_opengl32dll, "wglGetProcAddress");
78      BGFX_FATAL(NULL != wglGetProcAddress, Fatal::UnableToInitialize, "Failed get wglGetProcAddress.");
79
80      // If g_bgfxHwnd is NULL, the assumption is that GL context was created
81      // by user (for example, using SDL, GLFW, etc.)
82      BX_WARN(NULL != g_bgfxHwnd
83         , "bgfx::winSetHwnd with valid window is not called. This might "
84           "be intentional when GL context is created by the user."
85         );
86
87      if (NULL != g_bgfxHwnd)
88      {
89         wglMakeCurrent = (PFNWGLMAKECURRENTPROC)bx::dlsym(m_opengl32dll, "wglMakeCurrent");
90         BGFX_FATAL(NULL != wglMakeCurrent, Fatal::UnableToInitialize, "Failed get wglMakeCurrent.");
91
92         wglCreateContext = (PFNWGLCREATECONTEXTPROC)bx::dlsym(m_opengl32dll, "wglCreateContext");
93         BGFX_FATAL(NULL != wglCreateContext, Fatal::UnableToInitialize, "Failed get wglCreateContext.");
94
95         wglDeleteContext = (PFNWGLDELETECONTEXTPROC)bx::dlsym(m_opengl32dll, "wglDeleteContext");
96         BGFX_FATAL(NULL != wglDeleteContext, Fatal::UnableToInitialize, "Failed get wglDeleteContext.");
97
98         m_hdc = GetDC(g_bgfxHwnd);
99         BGFX_FATAL(NULL != m_hdc, Fatal::UnableToInitialize, "GetDC failed!");
100
101         // Dummy window to peek into WGL functionality.
102         //
103         // An application can only set the pixel format of a window one time.
104         // Once a window's pixel format is set, it cannot be changed.
105         // MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/dd369049%28v=vs.85%29.aspx
106         HWND hwnd = CreateWindowA("STATIC"
107            , ""
108            , WS_POPUP|WS_DISABLED
109            , -32000
110            , -32000
111            , 0
112            , 0
113            , NULL
114            , NULL
115            , GetModuleHandle(NULL)
116            , 0
117            );
118
119         HDC hdc = GetDC(hwnd);
120         BGFX_FATAL(NULL != hdc, Fatal::UnableToInitialize, "GetDC failed!");
121
122         HGLRC context = createContext(hdc);
123
124         wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
125         wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
126         wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
127         wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
128
129         if (NULL != wglGetExtensionsStringARB)
130         {
131            const char* extensions = (const char*)wglGetExtensionsStringARB(hdc);
132            BX_TRACE("WGL extensions:");
133            dumpExtensions(extensions);
134         }
135
136         if (NULL != wglChoosePixelFormatARB
137         &&  NULL != wglCreateContextAttribsARB)
138         {
139            int32_t attrs[] =
140            {
141               WGL_SAMPLE_BUFFERS_ARB, 0,
142               WGL_SAMPLES_ARB, 0,
143               WGL_SUPPORT_OPENGL_ARB, true,
144               WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
145               WGL_DRAW_TO_WINDOW_ARB, true,
146               WGL_DOUBLE_BUFFER_ARB, true,
147               WGL_COLOR_BITS_ARB, 32,
148               WGL_DEPTH_BITS_ARB, 24,
149               WGL_STENCIL_BITS_ARB, 8,
150               0
151            };
152
153            int result;
154            int pixelFormat;
155            uint32_t numFormats = 0;
156            do
157            {
158               result = wglChoosePixelFormatARB(m_hdc, attrs, NULL, 1, &pixelFormat, &numFormats);
159               if (0 == result
160                  ||  0 == numFormats)
161               {
162                  attrs[3] >>= 1;
163                  attrs[1] = attrs[3] == 0 ? 0 : 1;
164               }
165
166            } while (0 == numFormats);
167
168            PIXELFORMATDESCRIPTOR pfd;
169            DescribePixelFormat(m_hdc, pixelFormat, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
170
171            BX_TRACE("Pixel format:\n"
172               "\tiPixelType %d\n"
173               "\tcColorBits %d\n"
174               "\tcAlphaBits %d\n"
175               "\tcDepthBits %d\n"
176               "\tcStencilBits %d\n"
177               , pfd.iPixelType
178               , pfd.cColorBits
179               , pfd.cAlphaBits
180               , pfd.cDepthBits
181               , pfd.cStencilBits
182               );
183
184            result = SetPixelFormat(m_hdc, pixelFormat, &pfd);
185            // When window is created by SDL and SDL_WINDOW_OPENGL is set SetPixelFormat
186            // will fail. Just warn and continue. In case it failed for some other reason
187            // create context will fail and it will error out there.
188            BX_WARN(result, "SetPixelFormat failed (last err: 0x%08x)!", GetLastError() );
189
190            uint32_t flags = BGFX_CONFIG_DEBUG ? WGL_CONTEXT_DEBUG_BIT_ARB : 0;
191            BX_UNUSED(flags);
192            int32_t contextAttrs[9] =
193            {
194#if BGFX_CONFIG_RENDERER_OPENGL >= 31
195               WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
196               WGL_CONTEXT_MINOR_VERSION_ARB, 1,
197               WGL_CONTEXT_FLAGS_ARB, flags,
198               WGL_CONTEXT_PROFILE_MASK_ARB, WGL_CONTEXT_CORE_PROFILE_BIT_ARB,
199#else
200               WGL_CONTEXT_MAJOR_VERSION_ARB, 2,
201               WGL_CONTEXT_MINOR_VERSION_ARB, 1,
202               0, 0,
203               0, 0,
204#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
205               0
206            };
207
208            m_context = wglCreateContextAttribsARB(m_hdc, 0, contextAttrs);
209            if (NULL == m_context)
210            {
211               // nVidia doesn't like context profile mask for contexts below 3.2?
212               contextAttrs[6] = WGL_CONTEXT_PROFILE_MASK_ARB == contextAttrs[6] ? 0 : contextAttrs[6];
213               m_context = wglCreateContextAttribsARB(m_hdc, 0, contextAttrs);
214            }
215            BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create context 0x%08x.", GetLastError() );
216         }
217
218         wglMakeCurrent(NULL, NULL);
219         wglDeleteContext(context);
220         DestroyWindow(hwnd);
221
222         if (NULL == m_context)
223         {
224            m_context = createContext(m_hdc);
225         }
226
227         int result = wglMakeCurrent(m_hdc, m_context);
228         BGFX_FATAL(0 != result, Fatal::UnableToInitialize, "wglMakeCurrent failed!");
229
230         if (NULL != wglSwapIntervalEXT)
231         {
232            wglSwapIntervalEXT(0);
233         }
234      }
235
236      import();
237   }
238
239   void GlContext::destroy()
240   {
241      if (NULL != g_bgfxHwnd)
242      {
243         wglMakeCurrent(NULL, NULL);
244
245         wglDeleteContext(m_context);
246         m_context = NULL;
247
248         ReleaseDC(g_bgfxHwnd, m_hdc);
249         m_hdc = NULL;
250      }
251
252      bx::dlclose(m_opengl32dll);
253      m_opengl32dll = NULL;
254   }
255
256   void GlContext::resize(uint32_t /*_width*/, uint32_t /*_height*/, bool _vsync)
257   {
258      if (NULL != wglSwapIntervalEXT)
259      {
260         wglSwapIntervalEXT(_vsync ? 1 : 0);
261      }
262   }
263
264   void GlContext::swap()
265   {
266      if (NULL != g_bgfxHwnd)
267      {
268         wglMakeCurrent(m_hdc, m_context);
269         SwapBuffers(m_hdc);
270      }
271   }
272
273   void GlContext::import()
274   {
275      BX_TRACE("Import:");
276#   define GL_EXTENSION(_optional, _proto, _func, _import) \
277            { \
278               if (NULL == _func) \
279               { \
280                  _func = (_proto)wglGetProcAddress(#_import); \
281                  if (_func == NULL) \
282                  { \
283                     _func = (_proto)bx::dlsym(m_opengl32dll, #_import); \
284                     BX_TRACE("    %p " #_func " (" #_import ")", _func); \
285                  } \
286                  else \
287                  { \
288                     BX_TRACE("wgl %p " #_func " (" #_import ")", _func); \
289                  } \
290                  BGFX_FATAL(BX_IGNORE_C4127(_optional) || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. wglGetProcAddress(\"%s\")", #_import); \
291               } \
292            }
293#   include "glimports.h"
294   }
295
296} // namespace bgfx
297
298#   endif // BGFX_USE_WGL
299#endif // (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL)
Property changes on: branches/osd/src/lib/bgfx/glcontext_wgl.cpp
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/fs_clear0.sc
r0r31734
1$input v_color0
2
3/*
4 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
5 * License: http://www.opensource.org/licenses/BSD-2-Clause
6 */
7
8#include "bgfx_shader.sh"
9
10void main()
11{
12   gl_FragColor = v_color0;
13}
Property changes on: branches/osd/src/lib/bgfx/fs_clear0.sc
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/vs_clear.sc
r0r31734
1$input a_position, a_color0
2$output v_color0
3
4/*
5 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
6 * License: http://www.opensource.org/licenses/BSD-2-Clause
7 */
8
9#include "bgfx_shader.sh"
10
11void main()
12{
13   gl_Position = vec4(a_position, 1.0);
14   v_color0 = a_color0;
15}
Property changes on: branches/osd/src/lib/bgfx/vs_clear.sc
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/fs_clear2.sc
r0r31734
1$input v_color0
2
3/*
4 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
5 * License: http://www.opensource.org/licenses/BSD-2-Clause
6 */
7
8#include "bgfx_shader.sh"
9
10void main()
11{
12   gl_FragData[0] = v_color0;
13   gl_FragData[1] = v_color0;
14   gl_FragData[2] = v_color0;
15}
Property changes on: branches/osd/src/lib/bgfx/fs_clear2.sc
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_glx.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_GLCONTEXT_GLX_H_HEADER_GUARD
7#define BGFX_GLCONTEXT_GLX_H_HEADER_GUARD
8
9#if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
10
11#   include <X11/Xlib.h>
12#   include <GL/glx.h>
13
14namespace bgfx
15{
16   struct GlContext
17   {
18      GlContext()
19         : m_context(0)
20      {
21      }
22
23      void create(uint32_t _width, uint32_t _height);
24      void destroy();
25      void resize(uint32_t _width, uint32_t _height, bool _vsync);
26      void swap();
27      void import();
28
29      bool isValid() const
30      {
31         return 0 != m_context;
32      }
33
34      GLXContext m_context;
35   };
36} // namespace bgfx
37
38#endif // BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
39
40#endif // BGFX_GLCONTEXT_GLX_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/glcontext_glx.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_eagl.mm
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7
8#if BX_PLATFORM_IOS && (BGFX_CONFIG_RENDERER_OPENGLES|BGFX_CONFIG_RENDERER_OPENGL)
9#   include <UIKit/UIKit.h>
10#   include <QuartzCore/CAEAGLLayer.h>
11#   include "renderer_gl.h"
12
13namespace bgfx
14{
15#   define GL_IMPORT(_optional, _proto, _func, _import) _proto _func = NULL
16#   include "glimports.h"
17
18   void GlContext::create(uint32_t _width, uint32_t _height)
19   {
20      BX_UNUSED(_width, _height);
21      CAEAGLLayer* layer = (CAEAGLLayer*)g_bgfxEaglLayer;
22      layer.opaque = true;
23
24      layer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys
25                              : [NSNumber numberWithBool:false]
26                              , kEAGLDrawablePropertyRetainedBacking
27                              , kEAGLColorFormatRGBA8
28                              , kEAGLDrawablePropertyColorFormat
29                              , nil
30                              ];
31
32      EAGLContext* context = [ [EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
33      BX_CHECK(NULL != context, "Failed to create kEAGLRenderingAPIOpenGLES2 context.");
34      m_context = (void*)context;
35      [EAGLContext setCurrentContext:context];
36
37      GL_CHECK(glGenFramebuffers(1, &m_fbo) );
38      GL_CHECK(glBindFramebuffer(GL_FRAMEBUFFER, m_fbo) );
39
40      GL_CHECK(glGenRenderbuffers(1, &m_colorRbo) );
41      GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_colorRbo) );
42
43      [context renderbufferStorage:GL_RENDERBUFFER fromDrawable:layer];
44      GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_colorRbo) );
45
46      GLint width;
47      GLint height;
48      GL_CHECK(glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_WIDTH, &width) );
49      GL_CHECK(glGetRenderbufferParameteriv(GL_RENDERBUFFER, GL_RENDERBUFFER_HEIGHT, &height) );
50      BX_TRACE("Screen size: %d x %d", width, height);
51
52      GL_CHECK(glGenRenderbuffers(1, &m_depthStencilRbo) );
53      GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_depthStencilRbo) );
54      GL_CHECK(glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8_OES, width, height) ); // from OES_packed_depth_stencil
55      GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) );
56      GL_CHECK(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, m_depthStencilRbo) );
57       
58      BX_CHECK(GL_FRAMEBUFFER_COMPLETE ==  glCheckFramebufferStatus(GL_FRAMEBUFFER)
59         , "glCheckFramebufferStatus failed 0x%08x"
60         , glCheckFramebufferStatus(GL_FRAMEBUFFER)
61         );
62   }
63
64   void GlContext::destroy()
65   {
66      if (0 != m_fbo)
67      {
68         GL_CHECK(glDeleteFramebuffers(1, &m_fbo) );
69         m_fbo = 0;
70      }
71
72      if (0 != m_colorRbo)
73      {
74         GL_CHECK(glDeleteRenderbuffers(1, &m_colorRbo) );
75         m_colorRbo = 0;
76      }
77
78      if (0 != m_depthStencilRbo)
79      {
80         GL_CHECK(glDeleteRenderbuffers(1, &m_depthStencilRbo) );
81         m_depthStencilRbo = 0;
82      }
83
84      EAGLContext* context = (EAGLContext*)m_context;
85      [context release];
86   }
87
88   void GlContext::resize(uint32_t _width, uint32_t _height, bool _vsync)
89   {
90      BX_UNUSED(_width, _height, _vsync);
91      BX_TRACE("resize context");
92   }
93
94   void GlContext::swap()
95   {
96      GL_CHECK(glBindRenderbuffer(GL_RENDERBUFFER, m_colorRbo) );
97      EAGLContext* context = (EAGLContext*)m_context;
98      [context presentRenderbuffer:GL_RENDERBUFFER];
99   }
100
101   void GlContext::import()
102   {
103   }
104
105} // namespace bgfx
106
107#endif // BX_PLATFORM_IOS && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)
Property changes on: branches/osd/src/lib/bgfx/glcontext_eagl.mm
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/bgfx.cpp
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7
8namespace bgfx
9{
10#define BGFX_MAIN_THREAD_MAGIC 0x78666762
11
12#if BGFX_CONFIG_MULTITHREADED && !BX_PLATFORM_OSX && !BX_PLATFORM_IOS
13#   define BGFX_CHECK_MAIN_THREAD() \
14            BX_CHECK(NULL != s_ctx, "Library is not initialized yet."); \
15            BX_CHECK(BGFX_MAIN_THREAD_MAGIC == s_threadIndex, "Must be called from main thread.")
16#   define BGFX_CHECK_RENDER_THREAD() BX_CHECK(BGFX_MAIN_THREAD_MAGIC != s_threadIndex, "Must be called from render thread.")
17#else
18#   define BGFX_CHECK_MAIN_THREAD()
19#   define BGFX_CHECK_RENDER_THREAD()
20#endif // BGFX_CONFIG_MULTITHREADED && !BX_PLATFORM_OSX && !BX_PLATFORM_IOS
21
22#if BX_PLATFORM_ANDROID
23   ::ANativeWindow* g_bgfxAndroidWindow = NULL;
24   void androidSetWindow(::ANativeWindow* _window)
25   {
26      g_bgfxAndroidWindow = _window;
27   }
28#elif BX_PLATFORM_IOS
29   void* g_bgfxEaglLayer = NULL;
30   void iosSetEaglLayer(void* _layer)
31   {
32      g_bgfxEaglLayer = _layer;
33   }
34
35#elif BX_PLATFORM_OSX
36   void* g_bgfxNSWindow = NULL;
37
38   void osxSetNSWindow(void* _window)
39   {
40      g_bgfxNSWindow = _window;
41   }
42#elif BX_PLATFORM_WINDOWS
43   ::HWND g_bgfxHwnd = NULL;
44
45   void winSetHwnd(::HWND _window)
46   {
47      g_bgfxHwnd = _window;
48   }
49#endif // BX_PLATFORM_*
50
51#if BGFX_CONFIG_USE_TINYSTL
52   void* TinyStlAllocator::static_allocate(size_t _bytes)
53   {
54      return BX_ALLOC(g_allocator, _bytes);
55   }
56
57   void TinyStlAllocator::static_deallocate(void* _ptr, size_t /*_bytes*/)
58   {
59      if (NULL != _ptr)
60      {
61         BX_FREE(g_allocator, _ptr);
62      }
63   }
64#endif // BGFX_CONFIG_USE_TINYSTL
65
66   struct CallbackStub : public CallbackI
67   {
68      virtual ~CallbackStub()
69      {
70      }
71
72      virtual void fatal(Fatal::Enum _code, const char* _str) BX_OVERRIDE
73      {
74         if (Fatal::DebugCheck == _code)
75         {
76            bx::debugBreak();
77         }
78         else
79         {
80            BX_TRACE("0x%08x: %s", _code, _str);
81            BX_UNUSED(_code, _str);
82            abort();
83         }
84      }
85
86      virtual uint32_t cacheReadSize(uint64_t /*_id*/) BX_OVERRIDE
87      {
88         return 0;
89      }
90
91      virtual bool cacheRead(uint64_t /*_id*/, void* /*_data*/, uint32_t /*_size*/) BX_OVERRIDE
92      {
93         return false;
94      }
95
96      virtual void cacheWrite(uint64_t /*_id*/, const void* /*_data*/, uint32_t /*_size*/) BX_OVERRIDE
97      {
98      }
99
100      virtual void screenShot(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data, uint32_t _size, bool _yflip) BX_OVERRIDE
101      {
102         BX_UNUSED(_filePath, _width, _height, _pitch, _data, _size, _yflip);
103
104#if BX_CONFIG_CRT_FILE_READER_WRITER
105         char* filePath = (char*)alloca(strlen(_filePath)+5);
106         strcpy(filePath, _filePath);
107         strcat(filePath, ".tga");
108
109         bx::CrtFileWriter writer;
110         if (0 == writer.open(filePath) )
111         {
112            imageWriteTga(&writer, _width, _height, _pitch, _data, false, _yflip);
113            writer.close();
114         }
115#endif // BX_CONFIG_CRT_FILE_READER_WRITER
116      }
117
118      virtual void captureBegin(uint32_t /*_width*/, uint32_t /*_height*/, uint32_t /*_pitch*/, TextureFormat::Enum /*_format*/, bool /*_yflip*/) BX_OVERRIDE
119      {
120         BX_TRACE("Warning: using capture without callback (a.k.a. pointless).");
121      }
122
123      virtual void captureEnd() BX_OVERRIDE
124      {
125      }
126
127      virtual void captureFrame(const void* /*_data*/, uint32_t /*_size*/) BX_OVERRIDE
128      {
129      }
130   };
131
132#ifndef BGFX_CONFIG_MEMORY_TRACKING
133#   define BGFX_CONFIG_MEMORY_TRACKING (BGFX_CONFIG_DEBUG && BX_CONFIG_SUPPORTED_THREADING)
134#endif // BGFX_CONFIG_MEMORY_TRACKING
135
136   class AllocatorStub : public bx::ReallocatorI
137   {
138   public:
139      AllocatorStub()
140#if BGFX_CONFIG_MEMORY_TRACKING
141         : m_numBlocks(0)
142         , m_maxBlocks(0)
143#endif // BGFX_CONFIG_MEMORY_TRACKING
144      {
145      }
146
147      virtual void* alloc(size_t _size, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE
148      {
149         if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
150         {
151#if BGFX_CONFIG_MEMORY_TRACKING
152            {
153               bx::LwMutexScope scope(m_mutex);
154               ++m_numBlocks;
155               m_maxBlocks = bx::uint32_max(m_maxBlocks, m_numBlocks);
156            }
157#endif // BGFX_CONFIG_MEMORY_TRACKING
158
159            return ::malloc(_size);
160         }
161
162         return bx::alignedAlloc(this, _size, _align, _file, _line);
163      }
164
165      virtual void free(void* _ptr, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE
166      {
167         if (NULL != _ptr)
168         {
169            if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
170            {
171#if BGFX_CONFIG_MEMORY_TRACKING
172               {
173                  bx::LwMutexScope scope(m_mutex);
174                  BX_CHECK(m_numBlocks > 0, "Number of blocks is 0. Possible alloc/free mismatch?");
175                  --m_numBlocks;
176               }
177#endif // BGFX_CONFIG_MEMORY_TRACKING
178
179               ::free(_ptr);
180            }
181            else
182            {
183               bx::alignedFree(this, _ptr, _align, _file, _line);
184            }
185         }
186      }
187
188      virtual void* realloc(void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line) BX_OVERRIDE
189      {
190         if (BX_CONFIG_ALLOCATOR_NATURAL_ALIGNMENT >= _align)
191         {
192#if BGFX_CONFIG_MEMORY_TRACKING
193            if (NULL == _ptr)
194            {
195               bx::LwMutexScope scope(m_mutex);
196               ++m_numBlocks;
197               m_maxBlocks = bx::uint32_max(m_maxBlocks, m_numBlocks);
198            }
199#endif // BGFX_CONFIG_MEMORY_TRACKING
200
201            return ::realloc(_ptr, _size);
202         }
203
204         return bx::alignedRealloc(this, _ptr, _size, _align, _file, _line);
205      }
206
207      void checkLeaks()
208      {
209#if BGFX_CONFIG_MEMORY_TRACKING
210         BX_WARN(0 == m_numBlocks, "MEMORY LEAK: %d (max: %d)", m_numBlocks, m_maxBlocks);
211#endif // BGFX_CONFIG_MEMORY_TRACKING
212      }
213
214   protected:
215#if BGFX_CONFIG_MEMORY_TRACKING
216      bx::LwMutex m_mutex;
217      uint32_t m_numBlocks;
218      uint32_t m_maxBlocks;
219#endif // BGFX_CONFIG_MEMORY_TRACKING
220   };
221
222   static CallbackStub* s_callbackStub = NULL;
223   static AllocatorStub* s_allocatorStub = NULL;
224   static bool s_graphicsDebuggerPresent = false;
225
226   CallbackI* g_callback = NULL;
227   bx::ReallocatorI* g_allocator = NULL;
228
229   Caps g_caps;
230
231   static BX_THREAD uint32_t s_threadIndex = 0;
232   static Context* s_ctx = NULL;
233   static bool s_renderFrameCalled = false;
234
235   void setGraphicsDebuggerPresent(bool _present)
236   {
237      BX_TRACE("Graphics debugger is %spresent.", _present ? "" : "not ");
238      s_graphicsDebuggerPresent = _present;
239   }
240
241   bool isGraphicsDebuggerPresent()
242   {
243      return s_graphicsDebuggerPresent;
244   }
245
246   void fatal(Fatal::Enum _code, const char* _format, ...)
247   {
248      char temp[8192];
249
250      va_list argList;
251      va_start(argList, _format);
252      bx::vsnprintf(temp, sizeof(temp), _format, argList);
253      va_end(argList);
254
255      temp[sizeof(temp)-1] = '\0';
256
257      g_callback->fatal(_code, temp);
258   }
259
260   void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far)
261   {
262      const float aa = 2.0f/(_right - _left);
263      const float bb = 2.0f/(_top - _bottom);
264      const float cc = 1.0f/(_far - _near);
265      const float dd = (_left + _right)/(_left - _right);
266      const float ee = (_top + _bottom)/(_bottom - _top);
267      const float ff = _near / (_near - _far);
268
269      memset(_result, 0, sizeof(float)*16);
270      _result[0] = aa;
271      _result[5] = bb;
272      _result[10] = cc;
273      _result[12] = dd;
274      _result[13] = ee;
275      _result[14] = ff;
276      _result[15] = 1.0f;
277   }
278
279#include "charset.h"
280
281   void charsetFillTexture(const uint8_t* _charset, uint8_t* _rgba, uint32_t _height, uint32_t _pitch, uint32_t _bpp)
282   {
283      for (uint32_t ii = 0; ii < 256; ++ii)
284      {
285         uint8_t* pix = &_rgba[ii*8*_bpp];
286         for (uint32_t yy = 0; yy < _height; ++yy)
287         {
288            for (uint32_t xx = 0; xx < 8; ++xx)
289            {
290               uint8_t bit = 1<<(7-xx);
291               memset(&pix[xx*_bpp], _charset[ii*_height+yy]&bit ? 255 : 0, _bpp);
292            }
293
294            pix += _pitch;
295         }
296      }
297   }
298
299   static const uint32_t numCharsPerBatch = 1024;
300   static const uint32_t numBatchVertices = numCharsPerBatch*4;
301   static const uint32_t numBatchIndices = numCharsPerBatch*6;
302
303   void TextVideoMemBlitter::init()
304   {
305      BGFX_CHECK_MAIN_THREAD();
306      m_decl
307         .begin()
308         .add(Attrib::Position,  3, AttribType::Float)
309         .add(Attrib::Color0,    4, AttribType::Uint8, true)
310         .add(Attrib::Color1,    4, AttribType::Uint8, true)
311         .add(Attrib::TexCoord0, 2, AttribType::Float)
312         .end();
313
314      uint16_t width = 2048;
315      uint16_t height = 24;
316      uint8_t bpp = 1;
317      uint32_t pitch = width*bpp;
318
319      const Memory* mem;
320
321      mem = alloc(pitch*height);
322      uint8_t* rgba = mem->data;
323      charsetFillTexture(vga8x8, rgba, 8, pitch, bpp);
324      charsetFillTexture(vga8x16, &rgba[8*pitch], 16, pitch, bpp);
325      m_texture = createTexture2D(width, height, 1, TextureFormat::R8
326                  , BGFX_TEXTURE_MIN_POINT
327                  | BGFX_TEXTURE_MAG_POINT
328                  | BGFX_TEXTURE_MIP_POINT
329                  | BGFX_TEXTURE_U_CLAMP
330                  | BGFX_TEXTURE_V_CLAMP
331                  , mem
332                  );
333
334      switch (g_caps.rendererType)
335      {
336      case RendererType::Direct3D9:
337         mem = makeRef(vs_debugfont_dx9, sizeof(vs_debugfont_dx9) );
338         break;
339
340      case RendererType::Direct3D11:
341         mem = makeRef(vs_debugfont_dx11, sizeof(vs_debugfont_dx11) );
342         break;
343
344      default:
345         mem = makeRef(vs_debugfont_glsl, sizeof(vs_debugfont_glsl) );
346         break;
347      }
348
349      ShaderHandle vsh = createShader(mem);
350
351      switch (g_caps.rendererType)
352      {
353      case RendererType::Direct3D9:
354         mem = makeRef(fs_debugfont_dx9, sizeof(fs_debugfont_dx9) );
355         break;
356
357      case RendererType::Direct3D11:
358         mem = makeRef(fs_debugfont_dx11, sizeof(fs_debugfont_dx11) );
359         break;
360
361      default:
362         mem = makeRef(fs_debugfont_glsl, sizeof(fs_debugfont_glsl) );
363         break;
364      }
365
366      ShaderHandle fsh = createShader(mem);
367
368      m_program = createProgram(vsh, fsh, true);
369
370      m_vb = s_ctx->createTransientVertexBuffer(numBatchVertices*m_decl.m_stride, &m_decl);
371      m_ib = s_ctx->createTransientIndexBuffer(numBatchIndices*2);
372   }
373
374   void TextVideoMemBlitter::shutdown()
375   {
376      BGFX_CHECK_MAIN_THREAD();
377
378      destroyProgram(m_program);
379      destroyTexture(m_texture);
380      s_ctx->destroyTransientVertexBuffer(m_vb);
381      s_ctx->destroyTransientIndexBuffer(m_ib);
382   }
383
384   void blit(RendererContextI* _renderCtx, TextVideoMemBlitter& _blitter, const TextVideoMem& _mem)
385   {
386      BGFX_CHECK_RENDER_THREAD();
387      struct Vertex
388      {
389         float m_x;
390         float m_y;
391         float m_z;
392         uint32_t m_fg;
393         uint32_t m_bg;
394         float m_u;
395         float m_v;
396      };
397
398      static uint32_t palette[16] =
399      {
400         0x0,
401         0xff0000cc,
402         0xff069a4e,
403         0xff00a0c4,
404         0xffa46534,
405         0xff7b5075,
406         0xff9a9806,
407         0xffcfd7d3,
408         0xff535755,
409         0xff2929ef,
410         0xff34e28a,
411         0xff4fe9fc,
412         0xffcf9f72,
413         0xffa87fad,
414         0xffe2e234,
415         0xffeceeee,
416      };
417
418      uint32_t yy = 0;
419      uint32_t xx = 0;
420
421      const float texelWidth = 1.0f/2048.0f;
422      const float texelWidthHalf = texelWidth*0.5f;
423      const float texelHeight = 1.0f/24.0f;
424      const float texelHeightHalf = RendererType::Direct3D9 == g_caps.rendererType ? texelHeight*0.5f : 0.0f;
425      const float utop = (_mem.m_small ? 0.0f : 8.0f)*texelHeight + texelHeightHalf;
426      const float ubottom = (_mem.m_small ? 8.0f : 24.0f)*texelHeight + texelHeightHalf;
427      const float fontHeight = (_mem.m_small ? 8.0f : 16.0f);
428
429      _renderCtx->blitSetup(_blitter);
430
431      for (;yy < _mem.m_height;)
432      {
433         Vertex* vertex = (Vertex*)_blitter.m_vb->data;
434         uint16_t* indices = (uint16_t*)_blitter.m_ib->data;
435         uint32_t startVertex = 0;
436         uint32_t numIndices = 0;
437
438         for (; yy < _mem.m_height && numIndices < numBatchIndices; ++yy)
439         {
440            xx = xx < _mem.m_width ? xx : 0;
441            const uint8_t* line = &_mem.m_mem[(yy*_mem.m_width+xx)*2];
442
443            for (; xx < _mem.m_width && numIndices < numBatchIndices; ++xx)
444            {
445               uint8_t ch = line[0];
446               uint8_t attr = line[1];
447
448               if (0 != (ch|attr)
449               && (' ' != ch || 0 != (attr&0xf0) ) )
450               {
451                  uint32_t fg = palette[attr&0xf];
452                  uint32_t bg = palette[(attr>>4)&0xf];
453
454                  Vertex vert[4] =
455                  {
456                     { (xx  )*8.0f, (yy  )*fontHeight, 0.0f, fg, bg, (ch  )*8.0f*texelWidth - texelWidthHalf, utop },
457                     { (xx+1)*8.0f, (yy  )*fontHeight, 0.0f, fg, bg, (ch+1)*8.0f*texelWidth - texelWidthHalf, utop },
458                     { (xx+1)*8.0f, (yy+1)*fontHeight, 0.0f, fg, bg, (ch+1)*8.0f*texelWidth - texelWidthHalf, ubottom },
459                     { (xx  )*8.0f, (yy+1)*fontHeight, 0.0f, fg, bg, (ch  )*8.0f*texelWidth - texelWidthHalf, ubottom },
460                  };
461
462                  memcpy(vertex, vert, sizeof(vert) );
463                  vertex += 4;
464
465                  indices[0] = startVertex+0;
466                  indices[1] = startVertex+1;
467                  indices[2] = startVertex+2;
468                  indices[3] = startVertex+2;
469                  indices[4] = startVertex+3;
470                  indices[5] = startVertex+0;
471
472                  startVertex += 4;
473                  indices += 6;
474
475                  numIndices += 6;
476               }
477
478               line += 2;
479            }
480
481            if (numIndices >= numBatchIndices)
482            {
483               break;
484            }
485         }
486
487         _renderCtx->blitRender(_blitter, numIndices);
488      }
489   }
490
491   void ClearQuad::init()
492   {
493      BGFX_CHECK_MAIN_THREAD();
494
495      if (BX_ENABLED(BGFX_CONFIG_CLEAR_QUAD)
496      &&  RendererType::OpenGLES  != g_caps.rendererType
497      &&  RendererType::Direct3D9 != g_caps.rendererType
498      &&  RendererType::Null      != g_caps.rendererType)
499      {
500         m_decl
501            .begin()
502            .add(Attrib::Position, 3, AttribType::Float)
503            .add(Attrib::Color0,   4, AttribType::Uint8, true)
504            .end();
505
506         ShaderHandle vsh = BGFX_INVALID_HANDLE;
507         
508         const Memory* fragMem[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
509         if (RendererType::Direct3D11 == g_caps.rendererType)
510         {
511            vsh = createShader(makeRef(vs_clear_dx11, sizeof(vs_clear_dx11) ) );
512            fragMem[0] = makeRef(fs_clear0_dx11, sizeof(fs_clear0_dx11) );
513            fragMem[1] = makeRef(fs_clear1_dx11, sizeof(fs_clear1_dx11) );
514            fragMem[2] = makeRef(fs_clear2_dx11, sizeof(fs_clear2_dx11) );
515            fragMem[3] = makeRef(fs_clear3_dx11, sizeof(fs_clear3_dx11) );
516         }
517         else if (RendererType::OpenGL == g_caps.rendererType)
518         {
519            vsh = createShader(makeRef(vs_clear_glsl, sizeof(vs_clear_glsl) ) );
520            fragMem[0] = makeRef(fs_clear0_glsl, sizeof(fs_clear0_glsl) );
521            fragMem[1] = makeRef(fs_clear1_glsl, sizeof(fs_clear1_glsl) );
522            fragMem[2] = makeRef(fs_clear2_glsl, sizeof(fs_clear2_glsl) );
523            fragMem[3] = makeRef(fs_clear3_glsl, sizeof(fs_clear3_glsl) );
524         }
525
526         for (uint32_t ii = 0, num = g_caps.maxFBAttachments; ii < num; ++ii)
527         {
528            ShaderHandle fsh = createShader(fragMem[ii]);
529            m_program[ii] = createProgram(vsh, fsh);
530            destroyShader(fsh);
531         }
532
533         destroyShader(vsh);
534
535         m_vb = s_ctx->createTransientVertexBuffer(4*m_decl.m_stride, &m_decl);
536
537         const Memory* mem = alloc(6*sizeof(uint16_t) );
538         uint16_t* indices = (uint16_t*)mem->data;
539         indices[0] = 0;
540         indices[1] = 1;
541         indices[2] = 2;
542         indices[3] = 2;
543         indices[4] = 3;
544         indices[5] = 0;
545         m_ib = s_ctx->createIndexBuffer(mem);
546      }
547   }
548
549   void ClearQuad::shutdown()
550   {
551      BGFX_CHECK_MAIN_THREAD();
552
553      if (BX_ENABLED(BGFX_CONFIG_CLEAR_QUAD)
554      &&  RendererType::OpenGLES  != g_caps.rendererType
555      &&  RendererType::Direct3D9 != g_caps.rendererType
556      &&  RendererType::Null      != g_caps.rendererType)
557      {
558         for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS; ++ii)
559         {
560            if (isValid(m_program[ii]) )
561            {
562               destroyProgram(m_program[ii]);
563               m_program[ii].idx = invalidHandle;
564            }
565         }
566         destroyIndexBuffer(m_ib);
567         s_ctx->destroyTransientVertexBuffer(m_vb);
568      }
569   }
570
571   const char* s_uniformTypeName[UniformType::Count] =
572   {
573      "int",
574      "float",
575      NULL,
576      "int",
577      "float",
578      "vec2",
579      "vec3",
580      "vec4",
581      "mat3",
582      "mat4",
583   };
584
585   const char* getUniformTypeName(UniformType::Enum _enum)
586   {
587      return s_uniformTypeName[_enum];
588   }
589
590   UniformType::Enum nameToUniformTypeEnum(const char* _name)
591   {
592      for (uint32_t ii = 0; ii < UniformType::Count; ++ii)
593      {
594         if (NULL != s_uniformTypeName[ii]
595         &&  0 == strcmp(_name, s_uniformTypeName[ii]) )
596         {
597            return UniformType::Enum(ii);
598         }
599      }
600
601      return UniformType::Count;
602   }
603
604   static const char* s_predefinedName[PredefinedUniform::Count] =
605   {
606      "u_viewRect",
607      "u_viewTexel",
608      "u_view",
609      "u_invView",
610      "u_proj",
611      "u_invProj",
612      "u_viewProj",
613      "u_invViewProj",
614      "u_model",
615      "u_modelView",
616      "u_modelViewProj",
617      "u_alphaRef",
618   };
619
620   const char* getPredefinedUniformName(PredefinedUniform::Enum _enum)
621   {
622      return s_predefinedName[_enum];
623   }
624
625   PredefinedUniform::Enum nameToPredefinedUniformEnum(const char* _name)
626   {
627      for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii)
628      {
629         if (0 == strcmp(_name, s_predefinedName[ii]) )
630         {
631            return PredefinedUniform::Enum(ii);
632         }
633      }
634
635      return PredefinedUniform::Count;
636   }
637
638   uint32_t Frame::submit(uint8_t _id, int32_t _depth)
639   {
640      if (m_discard)
641      {
642         discard();
643         return m_num;
644      }
645
646      if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num
647      || (0 == m_draw.m_numVertices && 0 == m_draw.m_numIndices) )
648      {
649         ++m_numDropped;
650         return m_num;
651      }
652
653      m_constEnd = m_constantBuffer->getPos();
654
655      BX_WARN(invalidHandle != m_key.m_program, "Program with invalid handle");
656      if (invalidHandle != m_key.m_program)
657      {
658         m_key.m_depth = _depth;
659         m_key.m_view = _id;
660         m_key.m_seq = s_ctx->m_seq[_id] & s_ctx->m_seqMask[_id];
661         s_ctx->m_seq[_id]++;
662         uint64_t key = m_key.encodeDraw();
663         m_sortKeys[m_num] = key;
664         m_sortValues[m_num] = m_numRenderItems;
665         ++m_num;
666
667         m_draw.m_constBegin = m_constBegin;
668         m_draw.m_constEnd   = m_constEnd;
669         m_draw.m_flags |= m_flags;
670         m_renderItem[m_numRenderItems].draw = m_draw;
671         ++m_numRenderItems;
672      }
673
674      m_draw.clear();
675      m_constBegin = m_constEnd;
676      m_flags = BGFX_STATE_NONE;
677
678      return m_num;
679   }
680
681   uint32_t Frame::submitMask(uint32_t _viewMask, int32_t _depth)
682   {
683      if (m_discard)
684      {
685         discard();
686         return m_num;
687      }
688
689      if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num
690      || (0 == m_draw.m_numVertices && 0 == m_draw.m_numIndices) )
691      {
692         m_numDropped += bx::uint32_cntbits(_viewMask);
693         return m_num;
694      }
695
696      m_constEnd = m_constantBuffer->getPos();
697
698      BX_WARN(invalidHandle != m_key.m_program, "Program with invalid handle");
699      if (invalidHandle != m_key.m_program)
700      {
701         m_key.m_depth = _depth;
702
703         for (uint32_t id = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, id += 1, ntz = bx::uint32_cnttz(viewMask) )
704         {
705            viewMask >>= ntz;
706            id += ntz;
707
708            m_key.m_view = id;
709            m_key.m_seq = s_ctx->m_seq[id] & s_ctx->m_seqMask[id];
710            s_ctx->m_seq[id]++;
711            uint64_t key = m_key.encodeDraw();
712            m_sortKeys[m_num] = key;
713            m_sortValues[m_num] = m_numRenderItems;
714            ++m_num;
715         }
716
717         m_draw.m_constBegin = m_constBegin;
718         m_draw.m_constEnd   = m_constEnd;
719         m_draw.m_flags |= m_flags;
720         m_renderItem[m_numRenderItems].draw = m_draw;
721         ++m_numRenderItems;
722      }
723
724      m_draw.clear();
725      m_constBegin = m_constEnd;
726      m_flags = BGFX_STATE_NONE;
727
728      return m_num;
729   }
730
731   uint32_t Frame::dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ)
732   {
733      if (m_discard)
734      {
735         discard();
736         return m_num;
737      }
738
739      if (BGFX_CONFIG_MAX_DRAW_CALLS-1 <= m_num)
740      {
741         ++m_numDropped;
742         return m_num;
743      }
744
745      m_constEnd = m_constantBuffer->getPos();
746
747      m_compute.m_numX = bx::uint16_max(_numX, 1);
748      m_compute.m_numY = bx::uint16_max(_numY, 1);
749      m_compute.m_numZ = bx::uint16_max(_numZ, 1);
750      m_key.m_program = _handle.idx;
751      if (invalidHandle != m_key.m_program)
752      {
753         m_key.m_depth = 0;
754         m_key.m_view = _id;
755         m_key.m_seq = s_ctx->m_seq[_id] & s_ctx->m_seqMask[_id];
756         s_ctx->m_seq[_id]++;
757         uint64_t key = m_key.encodeCompute();
758         m_sortKeys[m_num] = key;
759         m_sortValues[m_num] = m_numRenderItems;
760         ++m_num;
761
762         m_compute.m_constBegin = m_constBegin;
763         m_compute.m_constEnd   = m_constEnd;
764         m_renderItem[m_numRenderItems].compute = m_compute;
765         ++m_numRenderItems;
766      }
767
768      m_compute.clear();
769      m_constBegin = m_constEnd;
770
771      return m_num;
772   }
773
774   void Frame::sort()
775   {
776      bx::radixSort64(m_sortKeys, s_ctx->m_tempKeys, m_sortValues, s_ctx->m_tempValues, m_num);
777   }
778
779   RenderFrame::Enum renderFrame()
780   {
781      if (NULL == s_ctx)
782      {
783         s_renderFrameCalled = true;
784         return RenderFrame::NoContext;
785      }
786
787      BGFX_CHECK_RENDER_THREAD();
788      if (s_ctx->renderFrame() )
789      {
790         return RenderFrame::Exiting;
791      }
792
793      return RenderFrame::Render;
794   }
795
796   const uint32_t g_uniformTypeSize[UniformType::Count+1] =
797   {
798      sizeof(int32_t),
799      sizeof(float),
800      0,
801      1*sizeof(int32_t),
802      1*sizeof(float),
803      2*sizeof(float),
804      3*sizeof(float),
805      4*sizeof(float),
806      3*3*sizeof(float),
807      4*4*sizeof(float),
808      1,
809   };
810
811   void ConstantBuffer::writeUniform(UniformType::Enum _type, uint16_t _loc, const void* _value, uint16_t _num)
812   {
813      uint32_t opcode = encodeOpcode(_type, _loc, _num, true);
814      write(opcode);
815      write(_value, g_uniformTypeSize[_type]*_num);
816   }
817
818   void ConstantBuffer::writeUniformHandle(UniformType::Enum _type, uint16_t _loc, UniformHandle _handle, uint16_t _num)
819   {
820      uint32_t opcode = encodeOpcode(_type, _loc, _num, false);
821      write(opcode);
822      write(&_handle, sizeof(UniformHandle) );
823   }
824
825   void ConstantBuffer::writeMarker(const char* _marker)
826   {
827      uint16_t num = (uint16_t)strlen(_marker)+1;
828      uint32_t opcode = encodeOpcode(bgfx::UniformType::Count, 0, num, true);
829      write(opcode);
830      write(_marker, num);
831   }
832
833   struct CapsFlags
834   {
835      uint64_t m_flag;
836      const char* m_str;
837   };
838
839   static const CapsFlags s_capsFlags[] =
840   {
841#define CAPS_FLAGS(_x) { _x, #_x }
842      CAPS_FLAGS(BGFX_CAPS_TEXTURE_COMPARE_LEQUAL),
843      CAPS_FLAGS(BGFX_CAPS_TEXTURE_COMPARE_ALL),
844      CAPS_FLAGS(BGFX_CAPS_TEXTURE_3D),
845      CAPS_FLAGS(BGFX_CAPS_VERTEX_ATTRIB_HALF),
846      CAPS_FLAGS(BGFX_CAPS_INSTANCING),
847      CAPS_FLAGS(BGFX_CAPS_RENDERER_MULTITHREADED),
848      CAPS_FLAGS(BGFX_CAPS_FRAGMENT_DEPTH),
849      CAPS_FLAGS(BGFX_CAPS_BLEND_INDEPENDENT),
850      CAPS_FLAGS(BGFX_CAPS_COMPUTE),
851#undef CAPS_FLAGS
852   };
853
854   static void dumpCaps()
855   {
856      BX_TRACE("Supported capabilities (%s):", s_ctx->m_renderCtx->getRendererName() );
857      for (uint32_t ii = 0; ii < BX_COUNTOF(s_capsFlags); ++ii)
858      {
859         if (0 != (g_caps.supported & s_capsFlags[ii].m_flag) )
860         {
861            BX_TRACE("\t%s", s_capsFlags[ii].m_str);
862         }
863      }
864
865      BX_TRACE("Emulated capabilities:");
866      for (uint32_t ii = 0; ii < BX_COUNTOF(s_capsFlags); ++ii)
867      {
868         if (0 != (g_caps.emulated & s_capsFlags[ii].m_flag) )
869         {
870            BX_TRACE("\t%s", s_capsFlags[ii].m_str);
871         }
872      }
873
874      BX_TRACE("Supported texture formats:");
875      for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
876      {
877         if (TextureFormat::Unknown != ii
878         &&  TextureFormat::UnknownDepth != ii)
879         {
880            uint8_t flags = g_caps.formats[ii];
881            BX_TRACE("\t[%c] %s"
882               , flags&1 ? 'x' : flags&2 ? '*' : ' '
883               , getName(TextureFormat::Enum(ii) )
884               );
885            BX_UNUSED(flags);
886         }
887      }
888
889      BX_TRACE("Max FB attachments: %d", g_caps.maxFBAttachments);
890   }
891
892   static TextureFormat::Enum s_emulatedFormats[] =
893   {
894      TextureFormat::BC1,
895      TextureFormat::BC2,
896      TextureFormat::BC3,
897      TextureFormat::BC4,
898      TextureFormat::BC5,
899      TextureFormat::ETC1,
900      TextureFormat::ETC2,
901      TextureFormat::ETC2A,
902      TextureFormat::ETC2A1,
903   };
904
905   void Context::init(RendererType::Enum _type)
906   {
907      BX_CHECK(!m_rendererInitialized, "Already initialized?");
908
909      m_exit = false;
910      m_frames = 0;
911      m_render = &m_frame[0];
912      m_submit = &m_frame[1];
913      m_debug = BGFX_DEBUG_NONE;
914
915      m_submit->create();
916      m_render->create();
917
918#if BGFX_CONFIG_MULTITHREADED
919      if (s_renderFrameCalled)
920      {
921         // When bgfx::renderFrame is called before init render thread
922         // should not be created.
923         BX_TRACE("Application called bgfx::renderFrame directly, not creating render thread.");
924      }
925      else
926      {
927         BX_TRACE("Creating rendering thread.");
928         m_thread.init(renderThread, this);
929      }
930#else
931      BX_TRACE("Multithreaded renderer is disabled.");
932#endif // BGFX_CONFIG_MULTITHREADED
933
934      memset(m_fb, 0xff, sizeof(m_fb) );
935      memset(m_clear, 0, sizeof(m_clear) );
936      memset(m_rect, 0, sizeof(m_rect) );
937      memset(m_scissor, 0, sizeof(m_scissor) );
938      memset(m_seq, 0, sizeof(m_seq) );
939      memset(m_seqMask, 0, sizeof(m_seqMask) );
940
941      for (uint32_t ii = 0; ii < BX_COUNTOF(m_rect); ++ii)
942      {
943         m_rect[ii].m_width = 1;
944         m_rect[ii].m_height = 1;
945      }
946
947      m_declRef.init();
948
949      CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::RendererInit);
950      cmdbuf.write(_type);
951
952      frameNoRenderWait();
953
954      // Make sure renderer init is called from render thread.
955      // g_caps is initialized and available after this point.
956      frame();
957
958      for (uint32_t ii = 0; ii < BX_COUNTOF(s_emulatedFormats); ++ii)
959      {
960         if (0 == g_caps.formats[s_emulatedFormats[ii] ])
961         {
962            g_caps.formats[s_emulatedFormats[ii] ] = 2;
963         }
964      }
965
966      g_caps.rendererType = m_renderCtx->getRendererType();
967      initAttribTypeSizeTable(g_caps.rendererType);
968
969      dumpCaps();
970
971      m_textVideoMemBlitter.init();
972      m_clearQuad.init();
973
974      m_submit->m_transientVb = createTransientVertexBuffer(BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
975      m_submit->m_transientIb = createTransientIndexBuffer(BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
976      frame();
977      m_submit->m_transientVb = createTransientVertexBuffer(BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
978      m_submit->m_transientIb = createTransientIndexBuffer(BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
979      frame();
980
981      for (uint8_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
982      {
983         char name[256];
984         bx::snprintf(name, sizeof(name), "%02d view", ii);
985         setViewName(ii, name);
986      }
987   }
988
989   void Context::shutdown()
990   {
991      getCommandBuffer(CommandBuffer::RendererShutdownBegin);
992      frame();
993
994      destroyTransientVertexBuffer(m_submit->m_transientVb);
995      destroyTransientIndexBuffer(m_submit->m_transientIb);
996      m_textVideoMemBlitter.shutdown();
997      m_clearQuad.shutdown();
998      frame();
999
1000      destroyTransientVertexBuffer(m_submit->m_transientVb);
1001      destroyTransientIndexBuffer(m_submit->m_transientIb);
1002      frame();
1003
1004      frame(); // If any VertexDecls needs to be destroyed.
1005
1006      getCommandBuffer(CommandBuffer::RendererShutdownEnd);
1007      frame();
1008
1009      m_declRef.shutdown(m_vertexDeclHandle);
1010
1011#if BGFX_CONFIG_MULTITHREADED
1012      if (m_thread.isRunning() )
1013      {
1014         m_thread.shutdown();
1015      }
1016#endif // BGFX_CONFIG_MULTITHREADED
1017
1018      s_ctx = NULL; // Can't be used by renderFrame at this point.
1019      renderSemWait();
1020
1021      m_submit->destroy();
1022      m_render->destroy();
1023
1024      if (BX_ENABLED(BGFX_CONFIG_DEBUG) )
1025      {
1026#define CHECK_HANDLE_LEAK(_handleAlloc) \
1027               BX_MACRO_BLOCK_BEGIN \
1028                  BX_WARN(0 == _handleAlloc.getNumHandles() \
1029                     , "LEAK: " #_handleAlloc " %d (max: %d)" \
1030                     , _handleAlloc.getNumHandles() \
1031                     , _handleAlloc.getMaxHandles() \
1032                     ); \
1033               BX_MACRO_BLOCK_END
1034
1035         CHECK_HANDLE_LEAK(m_dynamicIndexBufferHandle);
1036         CHECK_HANDLE_LEAK(m_dynamicVertexBufferHandle);
1037         CHECK_HANDLE_LEAK(m_indexBufferHandle);
1038         CHECK_HANDLE_LEAK(m_vertexDeclHandle);
1039         CHECK_HANDLE_LEAK(m_vertexBufferHandle);
1040         CHECK_HANDLE_LEAK(m_shaderHandle);
1041         CHECK_HANDLE_LEAK(m_programHandle);
1042         CHECK_HANDLE_LEAK(m_textureHandle);
1043         CHECK_HANDLE_LEAK(m_frameBufferHandle);
1044         CHECK_HANDLE_LEAK(m_uniformHandle);
1045
1046#undef CHECK_HANDLE_LEAK
1047      }
1048   }
1049
1050   void Context::freeDynamicBuffers()
1051   {
1052      for (uint16_t ii = 0, num = m_numFreeDynamicIndexBufferHandles; ii < num; ++ii)
1053      {
1054         destroyDynamicIndexBufferInternal(m_freeDynamicIndexBufferHandle[ii]);
1055      }
1056      m_numFreeDynamicIndexBufferHandles = 0;
1057
1058      for (uint16_t ii = 0, num = m_numFreeDynamicVertexBufferHandles; ii < num; ++ii)
1059      {
1060         destroyDynamicVertexBufferInternal(m_freeDynamicVertexBufferHandle[ii]);
1061      }
1062      m_numFreeDynamicVertexBufferHandles = 0;
1063   }
1064
1065   void Context::freeAllHandles(Frame* _frame)
1066   {
1067      for (uint16_t ii = 0, num = _frame->m_numFreeIndexBufferHandles; ii < num; ++ii)
1068      {
1069         m_indexBufferHandle.free(_frame->m_freeIndexBufferHandle[ii].idx);
1070      }
1071
1072      for (uint16_t ii = 0, num = _frame->m_numFreeVertexDeclHandles; ii < num; ++ii)
1073      {
1074         m_vertexDeclHandle.free(_frame->m_freeVertexDeclHandle[ii].idx);
1075      }
1076
1077      for (uint16_t ii = 0, num = _frame->m_numFreeVertexBufferHandles; ii < num; ++ii)
1078      {
1079         destroyVertexBufferInternal(_frame->m_freeVertexBufferHandle[ii]);
1080      }
1081
1082      for (uint16_t ii = 0, num = _frame->m_numFreeShaderHandles; ii < num; ++ii)
1083      {
1084         m_shaderHandle.free(_frame->m_freeShaderHandle[ii].idx);
1085      }
1086
1087      for (uint16_t ii = 0, num = _frame->m_numFreeProgramHandles; ii < num; ++ii)
1088      {
1089         m_programHandle.free(_frame->m_freeProgramHandle[ii].idx);
1090      }
1091
1092      for (uint16_t ii = 0, num = _frame->m_numFreeTextureHandles; ii < num; ++ii)
1093      {
1094         m_textureHandle.free(_frame->m_freeTextureHandle[ii].idx);
1095      }
1096
1097      for (uint16_t ii = 0, num = _frame->m_numFreeFrameBufferHandles; ii < num; ++ii)
1098      {
1099         m_frameBufferHandle.free(_frame->m_freeFrameBufferHandle[ii].idx);
1100      }
1101
1102      for (uint16_t ii = 0, num = _frame->m_numFreeUniformHandles; ii < num; ++ii)
1103      {
1104         m_uniformHandle.free(_frame->m_freeUniformHandle[ii].idx);
1105      }
1106   }
1107
1108   uint32_t Context::frame()
1109   {
1110      BX_CHECK(0 == m_instBufferCount, "Instance buffer allocated, but not used. This is incorrect, and causes memory leak.");
1111
1112      // wait for render thread to finish
1113      renderSemWait();
1114      frameNoRenderWait();
1115
1116      return m_frames;
1117   }
1118
1119   void Context::frameNoRenderWait()
1120   {
1121      swap();
1122
1123      // release render thread
1124      gameSemPost();
1125
1126#if !BGFX_CONFIG_MULTITHREADED
1127      renderFrame();
1128#endif // BGFX_CONFIG_MULTITHREADED
1129   }
1130
1131   void Context::swap()
1132   {
1133      freeDynamicBuffers();
1134      m_submit->m_resolution = m_resolution;
1135      m_submit->m_debug = m_debug;
1136      memcpy(m_submit->m_fb, m_fb, sizeof(m_fb) );
1137      memcpy(m_submit->m_clear, m_clear, sizeof(m_clear) );
1138      memcpy(m_submit->m_rect, m_rect, sizeof(m_rect) );
1139      memcpy(m_submit->m_scissor, m_scissor, sizeof(m_scissor) );
1140      memcpy(m_submit->m_view, m_view, sizeof(m_view) );
1141      memcpy(m_submit->m_proj, m_proj, sizeof(m_proj) );
1142      m_submit->finish();
1143
1144      Frame* temp = m_render;
1145      m_render = m_submit;
1146      m_submit = temp;
1147
1148      m_frames++;
1149      m_submit->start();
1150
1151      memset(m_seq, 0, sizeof(m_seq) );
1152      freeAllHandles(m_submit);
1153
1154      m_submit->resetFreeHandles();
1155      m_submit->m_textVideoMem->resize(m_render->m_textVideoMem->m_small, m_resolution.m_width, m_resolution.m_height);
1156   }
1157
1158   bool Context::renderFrame()
1159   {
1160      if (m_rendererInitialized)
1161      {
1162         m_renderCtx->flip();
1163      }
1164
1165      gameSemWait();
1166
1167      rendererExecCommands(m_render->m_cmdPre);
1168      if (m_rendererInitialized)
1169      {
1170         m_renderCtx->submit(m_render, m_clearQuad, m_textVideoMemBlitter);
1171      }
1172      rendererExecCommands(m_render->m_cmdPost);
1173
1174      renderSemPost();
1175
1176      return m_exit;
1177   }
1178
1179   void rendererUpdateUniforms(RendererContextI* _renderCtx, ConstantBuffer* _constantBuffer, uint32_t _begin, uint32_t _end)
1180   {
1181      _constantBuffer->reset(_begin);
1182      while (_constantBuffer->getPos() < _end)
1183      {
1184         uint32_t opcode = _constantBuffer->read();
1185
1186         if (UniformType::End == opcode)
1187         {
1188            break;
1189         }
1190
1191         UniformType::Enum type;
1192         uint16_t loc;
1193         uint16_t num;
1194         uint16_t copy;
1195         ConstantBuffer::decodeOpcode(opcode, type, loc, num, copy);
1196
1197         uint32_t size = g_uniformTypeSize[type]*num;
1198         const char* data = _constantBuffer->read(size);
1199         if (UniformType::Count > type)
1200         {
1201            if (copy)
1202            {
1203               _renderCtx->updateUniform(loc, data, size);
1204            }
1205            else
1206            {
1207               _renderCtx->updateUniform(loc, *(const char**)(data), size);
1208            }
1209         }
1210         else
1211         {
1212            _renderCtx->setMarker(data, size);
1213         }
1214      }
1215   }
1216
1217   void Context::flushTextureUpdateBatch(CommandBuffer& _cmdbuf)
1218   {
1219      if (m_textureUpdateBatch.sort() )
1220      {
1221         const uint32_t pos = _cmdbuf.m_pos;
1222
1223         uint32_t currentKey = UINT32_MAX;
1224
1225         for (uint32_t ii = 0, num = m_textureUpdateBatch.m_num; ii < num; ++ii)
1226         {
1227            _cmdbuf.m_pos = m_textureUpdateBatch.m_values[ii];
1228
1229            TextureHandle handle;
1230            _cmdbuf.read(handle);
1231
1232            uint8_t side;
1233            _cmdbuf.read(side);
1234
1235            uint8_t mip;
1236            _cmdbuf.read(mip);
1237
1238            Rect rect;
1239            _cmdbuf.read(rect);
1240
1241            uint16_t zz;
1242            _cmdbuf.read(zz);
1243
1244            uint16_t depth;
1245            _cmdbuf.read(depth);
1246
1247            uint16_t pitch;
1248            _cmdbuf.read(pitch);
1249
1250            Memory* mem;
1251            _cmdbuf.read(mem);
1252
1253            uint32_t key = m_textureUpdateBatch.m_keys[ii];
1254            if (key != currentKey)
1255            {
1256               if (currentKey != UINT32_MAX)
1257               {
1258                  m_renderCtx->updateTextureEnd();
1259               }
1260               currentKey = key;
1261               m_renderCtx->updateTextureBegin(handle, side, mip);
1262            }
1263
1264            m_renderCtx->updateTexture(handle, side, mip, rect, zz, depth, pitch, mem);
1265
1266            release(mem);
1267         }
1268
1269         if (currentKey != UINT32_MAX)
1270         {
1271            m_renderCtx->updateTextureEnd();
1272         }
1273
1274         m_textureUpdateBatch.reset();
1275
1276         _cmdbuf.m_pos = pos;
1277      }
1278   }
1279
1280   typedef RendererContextI* (*RendererCreateFn)();
1281   typedef void (*RendererDestroyFn)();
1282
1283   extern RendererContextI* rendererCreateNULL();
1284   extern void rendererDestroyNULL();
1285
1286   extern RendererContextI* rendererCreateGL();
1287   extern void rendererDestroyGL();
1288
1289   extern RendererContextI* rendererCreateD3D9();
1290   extern void rendererDestroyD3D9();
1291
1292   extern RendererContextI* rendererCreateD3D11();
1293   extern void rendererDestroyD3D11();
1294
1295   struct RendererCreator
1296   {
1297      RendererCreateFn  createFn;
1298      RendererDestroyFn destroyFn;
1299      const char* name;
1300      bool supported;
1301   };
1302
1303   static const RendererCreator s_rendererCreator[RendererType::Count] =
1304   {
1305      { rendererCreateNULL,  rendererDestroyNULL,  BGFX_RENDERER_NULL_NAME,       !!BGFX_CONFIG_RENDERER_NULL       }, // Null
1306      { rendererCreateD3D9,  rendererDestroyD3D9,  BGFX_RENDERER_DIRECT3D9_NAME,  !!BGFX_CONFIG_RENDERER_DIRECT3D9  }, // Direct3D9
1307      { rendererCreateD3D11, rendererDestroyD3D11, BGFX_RENDERER_DIRECT3D11_NAME, !!BGFX_CONFIG_RENDERER_DIRECT3D11 }, // Direct3D11
1308      { rendererCreateGL,    rendererDestroyGL,    BGFX_RENDERER_OPENGL_NAME,     !!BGFX_CONFIG_RENDERER_OPENGLES   }, // OpenGLES
1309      { rendererCreateGL,    rendererDestroyGL,    BGFX_RENDERER_OPENGL_NAME,     !!BGFX_CONFIG_RENDERER_OPENGL     }, // OpenGL
1310   };
1311
1312   uint32_t getWindowsVersion()
1313   {
1314#if BX_PLATFORM_WINDOWS
1315      OSVERSIONINFOEXA ovi;
1316      memset(&ovi, 0, sizeof(ovi) );
1317      ovi.dwOSVersionInfoSize = sizeof(ovi);
1318      if (!GetVersionExA( (LPOSVERSIONINFOA)&ovi) )
1319      {
1320         return 0x0501; // _WIN32_WINNT_WINXP
1321      }
1322
1323      // _WIN32_WINNT_WINBLUE 0x0602
1324      // _WIN32_WINNT_WIN8    0x0602
1325      // _WIN32_WINNT_WIN7    0x0601
1326      // _WIN32_WINNT_VISTA   0x0600
1327      return (ovi.dwMajorVersion<<8)
1328          |  ovi.dwMinorVersion
1329          ;
1330#else
1331      return 0;
1332#endif // BX_PLATFORM_WINDOWS
1333   }
1334
1335   RendererContextI* rendererCreate(RendererType::Enum _type)
1336   {
1337      if (RendererType::Count == _type)
1338      {
1339again:
1340         if (BX_ENABLED(BX_PLATFORM_WINDOWS) )
1341         {
1342            RendererType::Enum first  = RendererType::Direct3D9;
1343            RendererType::Enum second = RendererType::Direct3D11;
1344            if (0x602 == getWindowsVersion() )
1345            {
1346               first  = RendererType::Direct3D11;
1347               second = RendererType::Direct3D9;
1348            }
1349
1350            if (s_rendererCreator[first].supported)
1351            {
1352               _type = first;
1353            }
1354            else if (s_rendererCreator[second].supported)
1355            {
1356               _type = second;
1357            }
1358            else if (s_rendererCreator[RendererType::OpenGL].supported)
1359            {
1360               _type = RendererType::OpenGL;
1361            }
1362            else if (s_rendererCreator[RendererType::OpenGLES].supported)
1363            {
1364               _type = RendererType::OpenGLES;
1365            }
1366         }
1367         else if (BX_ENABLED(0
1368             ||  BX_PLATFORM_ANDROID
1369             ||  BX_PLATFORM_EMSCRIPTEN
1370             ||  BX_PLATFORM_IOS
1371             ||  BX_PLATFORM_NACL
1372             ) )
1373         {
1374            _type = RendererType::OpenGLES;
1375         }
1376         else
1377         {
1378            _type = RendererType::OpenGL;
1379         }
1380
1381         if (!s_rendererCreator[_type].supported)
1382         {
1383            _type = RendererType::Null;
1384         }
1385      }
1386
1387      RendererContextI* renderCtx = s_rendererCreator[_type].createFn();
1388
1389      if (NULL == renderCtx)
1390      {
1391         goto again;
1392      }
1393
1394      return renderCtx;
1395   }
1396
1397   void rendererDestroy()
1398   {
1399      const RendererType::Enum type = getRendererType();
1400      s_rendererCreator[type].destroyFn();
1401   }
1402
1403   void Context::rendererExecCommands(CommandBuffer& _cmdbuf)
1404   {
1405      _cmdbuf.reset();
1406
1407      bool end = false;
1408
1409      do
1410      {
1411         uint8_t command;
1412         _cmdbuf.read(command);
1413
1414         switch (command)
1415         {
1416         case CommandBuffer::RendererInit:
1417            {
1418               BX_CHECK(!m_rendererInitialized, "This shouldn't happen! Bad synchronization?");
1419
1420               RendererType::Enum type;
1421               _cmdbuf.read(type);
1422
1423               m_renderCtx = rendererCreate(type);
1424               m_rendererInitialized = true;
1425            }
1426            break;
1427
1428         case CommandBuffer::RendererShutdownBegin:
1429            {
1430               BX_CHECK(m_rendererInitialized, "This shouldn't happen! Bad synchronization?");
1431               m_rendererInitialized = false;
1432            }
1433            break;
1434
1435         case CommandBuffer::RendererShutdownEnd:
1436            {
1437               BX_CHECK(!m_rendererInitialized && !m_exit, "This shouldn't happen! Bad synchronization?");
1438               rendererDestroy();
1439               m_renderCtx = NULL;
1440               m_exit = true;
1441            }
1442            break;
1443
1444         case CommandBuffer::CreateIndexBuffer:
1445            {
1446               IndexBufferHandle handle;
1447               _cmdbuf.read(handle);
1448
1449               Memory* mem;
1450               _cmdbuf.read(mem);
1451
1452               m_renderCtx->createIndexBuffer(handle, mem);
1453
1454               release(mem);
1455            }
1456            break;
1457
1458         case CommandBuffer::DestroyIndexBuffer:
1459            {
1460               IndexBufferHandle handle;
1461               _cmdbuf.read(handle);
1462
1463               m_renderCtx->destroyIndexBuffer(handle);
1464            }
1465            break;
1466
1467         case CommandBuffer::CreateVertexDecl:
1468            {
1469               VertexDeclHandle handle;
1470               _cmdbuf.read(handle);
1471
1472               VertexDecl decl;
1473               _cmdbuf.read(decl);
1474
1475               m_renderCtx->createVertexDecl(handle, decl);
1476            }
1477            break;
1478
1479         case CommandBuffer::DestroyVertexDecl:
1480            {
1481               VertexDeclHandle handle;
1482               _cmdbuf.read(handle);
1483
1484               m_renderCtx->destroyVertexDecl(handle);
1485            }
1486            break;
1487
1488         case CommandBuffer::CreateVertexBuffer:
1489            {
1490               VertexBufferHandle handle;
1491               _cmdbuf.read(handle);
1492
1493               Memory* mem;
1494               _cmdbuf.read(mem);
1495
1496               VertexDeclHandle declHandle;
1497               _cmdbuf.read(declHandle);
1498
1499               m_renderCtx->createVertexBuffer(handle, mem, declHandle);
1500
1501               release(mem);
1502            }
1503            break;
1504
1505         case CommandBuffer::DestroyVertexBuffer:
1506            {
1507               VertexBufferHandle handle;
1508               _cmdbuf.read(handle);
1509
1510               m_renderCtx->destroyVertexBuffer(handle);
1511            }
1512            break;
1513
1514         case CommandBuffer::CreateDynamicIndexBuffer:
1515            {
1516               IndexBufferHandle handle;
1517               _cmdbuf.read(handle);
1518
1519               uint32_t size;
1520               _cmdbuf.read(size);
1521
1522               m_renderCtx->createDynamicIndexBuffer(handle, size);
1523            }
1524            break;
1525
1526         case CommandBuffer::UpdateDynamicIndexBuffer:
1527            {
1528               IndexBufferHandle handle;
1529               _cmdbuf.read(handle);
1530
1531               uint32_t offset;
1532               _cmdbuf.read(offset);
1533
1534               uint32_t size;
1535               _cmdbuf.read(size);
1536
1537               Memory* mem;
1538               _cmdbuf.read(mem);
1539
1540               m_renderCtx->updateDynamicIndexBuffer(handle, offset, size, mem);
1541
1542               release(mem);
1543            }
1544            break;
1545
1546         case CommandBuffer::DestroyDynamicIndexBuffer:
1547            {
1548               IndexBufferHandle handle;
1549               _cmdbuf.read(handle);
1550
1551               m_renderCtx->destroyDynamicIndexBuffer(handle);
1552            }
1553            break;
1554
1555         case CommandBuffer::CreateDynamicVertexBuffer:
1556            {
1557               VertexBufferHandle handle;
1558               _cmdbuf.read(handle);
1559
1560               uint32_t size;
1561               _cmdbuf.read(size);
1562
1563               m_renderCtx->createDynamicVertexBuffer(handle, size);
1564            }
1565            break;
1566
1567         case CommandBuffer::UpdateDynamicVertexBuffer:
1568            {
1569               VertexBufferHandle handle;
1570               _cmdbuf.read(handle);
1571
1572               uint32_t offset;
1573               _cmdbuf.read(offset);
1574
1575               uint32_t size;
1576               _cmdbuf.read(size);
1577
1578               Memory* mem;
1579               _cmdbuf.read(mem);
1580
1581               m_renderCtx->updateDynamicVertexBuffer(handle, offset, size, mem);
1582
1583               release(mem);
1584            }
1585            break;
1586
1587         case CommandBuffer::DestroyDynamicVertexBuffer:
1588            {
1589               VertexBufferHandle handle;
1590               _cmdbuf.read(handle);
1591
1592               m_renderCtx->destroyDynamicVertexBuffer(handle);
1593            }
1594            break;
1595
1596         case CommandBuffer::CreateShader:
1597            {
1598               ShaderHandle handle;
1599               _cmdbuf.read(handle);
1600
1601               Memory* mem;
1602               _cmdbuf.read(mem);
1603
1604               m_renderCtx->createShader(handle, mem);
1605
1606               release(mem);
1607            }
1608            break;
1609
1610         case CommandBuffer::DestroyShader:
1611            {
1612               ShaderHandle handle;
1613               _cmdbuf.read(handle);
1614
1615               m_renderCtx->destroyShader(handle);
1616            }
1617            break;
1618
1619         case CommandBuffer::CreateProgram:
1620            {
1621               ProgramHandle handle;
1622               _cmdbuf.read(handle);
1623
1624               ShaderHandle vsh;
1625               _cmdbuf.read(vsh);
1626
1627               ShaderHandle fsh;
1628               _cmdbuf.read(fsh);
1629
1630               m_renderCtx->createProgram(handle, vsh, fsh);
1631            }
1632            break;
1633
1634         case CommandBuffer::DestroyProgram:
1635            {
1636               ProgramHandle handle;
1637               _cmdbuf.read(handle);
1638
1639               m_renderCtx->destroyProgram(handle);
1640            }
1641            break;
1642
1643         case CommandBuffer::CreateTexture:
1644            {
1645               TextureHandle handle;
1646               _cmdbuf.read(handle);
1647
1648               Memory* mem;
1649               _cmdbuf.read(mem);
1650
1651               uint32_t flags;
1652               _cmdbuf.read(flags);
1653
1654               uint8_t skip;
1655               _cmdbuf.read(skip);
1656
1657               m_renderCtx->createTexture(handle, mem, flags, skip);
1658
1659               bx::MemoryReader reader(mem->data, mem->size);
1660
1661               uint32_t magic;
1662               bx::read(&reader, magic);
1663
1664               if (BGFX_CHUNK_MAGIC_TEX == magic)
1665               {
1666                  TextureCreate tc;
1667                  bx::read(&reader, tc);
1668
1669                  if (NULL != tc.m_mem)
1670                  {
1671                     release(tc.m_mem);
1672                  }
1673               }
1674
1675               release(mem);
1676            }
1677            break;
1678
1679         case CommandBuffer::UpdateTexture:
1680            {
1681               if (m_textureUpdateBatch.isFull() )
1682               {
1683                  flushTextureUpdateBatch(_cmdbuf);
1684               }
1685
1686               uint32_t value = _cmdbuf.m_pos;
1687
1688               TextureHandle handle;
1689               _cmdbuf.read(handle);
1690
1691               uint8_t side;
1692               _cmdbuf.read(side);
1693
1694               uint8_t mip;
1695               _cmdbuf.read(mip);
1696
1697               _cmdbuf.skip<Rect>();
1698               _cmdbuf.skip<uint16_t>();
1699               _cmdbuf.skip<uint16_t>();
1700               _cmdbuf.skip<uint16_t>();
1701               _cmdbuf.skip<Memory*>();
1702
1703               uint32_t key = (handle.idx<<16)
1704                  | (side<<8)
1705                  | mip
1706                  ;
1707
1708               m_textureUpdateBatch.add(key, value);
1709            }
1710            break;
1711
1712         case CommandBuffer::DestroyTexture:
1713            {
1714               TextureHandle handle;
1715               _cmdbuf.read(handle);
1716
1717               m_renderCtx->destroyTexture(handle);
1718            }
1719            break;
1720
1721         case CommandBuffer::CreateFrameBuffer:
1722            {
1723               FrameBufferHandle handle;
1724               _cmdbuf.read(handle);
1725
1726               uint8_t num;
1727               _cmdbuf.read(num);
1728
1729               TextureHandle textureHandles[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
1730               for (uint32_t ii = 0; ii < num; ++ii)
1731               {
1732                  _cmdbuf.read(textureHandles[ii]);
1733               }
1734
1735               m_renderCtx->createFrameBuffer(handle, num, textureHandles);
1736            }
1737            break;
1738
1739         case CommandBuffer::DestroyFrameBuffer:
1740            {
1741               FrameBufferHandle handle;
1742               _cmdbuf.read(handle);
1743
1744               m_renderCtx->destroyFrameBuffer(handle);
1745            }
1746            break;
1747
1748         case CommandBuffer::CreateUniform:
1749            {
1750               UniformHandle handle;
1751               _cmdbuf.read(handle);
1752
1753               UniformType::Enum type;
1754               _cmdbuf.read(type);
1755
1756               uint16_t num;
1757               _cmdbuf.read(num);
1758
1759               uint8_t len;
1760               _cmdbuf.read(len);
1761
1762               const char* name = (const char*)_cmdbuf.skip(len);
1763
1764               m_renderCtx->createUniform(handle, type, num, name);
1765            }
1766            break;
1767
1768         case CommandBuffer::DestroyUniform:
1769            {
1770               UniformHandle handle;
1771               _cmdbuf.read(handle);
1772
1773               m_renderCtx->destroyUniform(handle);
1774            }
1775            break;
1776
1777         case CommandBuffer::SaveScreenShot:
1778            {
1779               uint16_t len;
1780               _cmdbuf.read(len);
1781
1782               const char* filePath = (const char*)_cmdbuf.skip(len);
1783
1784               m_renderCtx->saveScreenShot(filePath);
1785            }
1786            break;
1787
1788         case CommandBuffer::UpdateViewName:
1789            {
1790               uint8_t id;
1791               _cmdbuf.read(id);
1792
1793               uint16_t len;
1794               _cmdbuf.read(len);
1795
1796               const char* name = (const char*)_cmdbuf.skip(len);
1797
1798               m_renderCtx->updateViewName(id, name);
1799            }
1800            break;
1801
1802         case CommandBuffer::End:
1803            end = true;
1804            break;
1805
1806         default:
1807            BX_CHECK(false, "Invalid command: %d", command);
1808            break;
1809         }
1810      } while (!end);
1811
1812      flushTextureUpdateBatch(_cmdbuf);
1813   }
1814
1815   uint8_t getSupportedRenderers(RendererType::Enum _enum[RendererType::Count])
1816   {
1817      uint8_t num = 0;
1818      for (uint8_t ii = 0; ii < uint8_t(RendererType::Count); ++ii)
1819      {
1820         if (s_rendererCreator[ii].supported)
1821         {
1822            _enum[num++] = RendererType::Enum(ii);
1823         }
1824      }
1825
1826      return num;
1827   }
1828
1829   const char* getRendererName(RendererType::Enum _type)
1830   {
1831      BX_CHECK(_type < RendererType::Count, "Invalid renderer type %d.", _type);
1832      return s_rendererCreator[_type].name;
1833   }
1834
1835   void init(RendererType::Enum _type, CallbackI* _callback, bx::ReallocatorI* _allocator)
1836   {
1837      BX_CHECK(NULL == s_ctx, "bgfx is already initialized.");
1838      BX_TRACE("Init...");
1839
1840      memset(&g_caps, 0, sizeof(g_caps) );
1841      g_caps.supported = 0
1842         | (BGFX_CONFIG_MULTITHREADED ? BGFX_CAPS_RENDERER_MULTITHREADED : 0)
1843         ;
1844      g_caps.emulated = 0;
1845      g_caps.maxDrawCalls = BGFX_CONFIG_MAX_DRAW_CALLS;
1846      g_caps.maxFBAttachments = 1;
1847
1848      if (NULL != _allocator)
1849      {
1850         g_allocator = _allocator;
1851      }
1852      else
1853      {
1854         bx::CrtAllocator allocator;
1855         g_allocator =
1856            s_allocatorStub = BX_NEW(&allocator, AllocatorStub);
1857      }
1858
1859      if (NULL != _callback)
1860      {
1861         g_callback = _callback;
1862      }
1863      else
1864      {
1865         g_callback =
1866            s_callbackStub = BX_NEW(g_allocator, CallbackStub);
1867      }
1868
1869      s_threadIndex = BGFX_MAIN_THREAD_MAGIC;
1870
1871      s_ctx = BX_ALIGNED_NEW(g_allocator, Context, 16);
1872      s_ctx->init(_type);
1873
1874      BX_TRACE("Init complete.");
1875   }
1876
1877   void shutdown()
1878   {
1879      BX_TRACE("Shutdown...");
1880
1881      BGFX_CHECK_MAIN_THREAD();
1882      Context* ctx = s_ctx; // it's going to be NULLd inside shutdown.
1883      ctx->shutdown();
1884
1885      BX_ALIGNED_DELETE(g_allocator, ctx, 16);
1886
1887      if (NULL != s_callbackStub)
1888      {
1889         BX_DELETE(g_allocator, s_callbackStub);
1890         s_callbackStub = NULL;
1891      }
1892
1893      if (NULL != s_allocatorStub)
1894      {
1895         s_allocatorStub->checkLeaks();
1896
1897         bx::CrtAllocator allocator;
1898         BX_DELETE(&allocator, s_allocatorStub);
1899         s_allocatorStub = NULL;
1900      }
1901
1902      s_threadIndex = 0;
1903      g_callback = NULL;
1904      g_allocator = NULL;
1905
1906      BX_TRACE("Shutdown complete.");
1907   }
1908
1909   void reset(uint32_t _width, uint32_t _height, uint32_t _flags)
1910   {
1911      BGFX_CHECK_MAIN_THREAD();
1912      s_ctx->reset(_width, _height, _flags);
1913   }
1914
1915   uint32_t frame()
1916   {
1917      BGFX_CHECK_MAIN_THREAD();
1918      return s_ctx->frame();
1919   }
1920
1921   const Caps* getCaps()
1922   {
1923      return &g_caps;
1924   }
1925
1926   RendererType::Enum getRendererType()
1927   {
1928      return g_caps.rendererType;
1929   }
1930
1931   const Memory* alloc(uint32_t _size)
1932   {
1933      Memory* mem = (Memory*)BX_ALLOC(g_allocator, sizeof(Memory) + _size);
1934      mem->size = _size;
1935      mem->data = (uint8_t*)mem + sizeof(Memory);
1936      return mem;
1937   }
1938
1939   const Memory* copy(const void* _data, uint32_t _size)
1940   {
1941      const Memory* mem = alloc(_size);
1942      memcpy(mem->data, _data, _size);
1943      return mem;
1944   }
1945
1946   const Memory* makeRef(const void* _data, uint32_t _size)
1947   {
1948      Memory* mem = (Memory*)BX_ALLOC(g_allocator, sizeof(Memory) );
1949      mem->size = _size;
1950      mem->data = (uint8_t*)_data;
1951      return mem;
1952   }
1953
1954   void release(const Memory* _mem)
1955   {
1956      BX_CHECK(NULL != _mem, "_mem can't be NULL");
1957      BX_FREE(g_allocator, const_cast<Memory*>(_mem) );
1958   }
1959
1960   void setDebug(uint32_t _debug)
1961   {
1962      BGFX_CHECK_MAIN_THREAD();
1963      s_ctx->setDebug(_debug);
1964   }
1965
1966   void dbgTextClear(uint8_t _attr, bool _small)
1967   {
1968      BGFX_CHECK_MAIN_THREAD();
1969      s_ctx->dbgTextClear(_attr, _small);
1970   }
1971
1972   void dbgTextPrintfVargs(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList)
1973   {
1974      s_ctx->dbgTextPrintfVargs(_x, _y, _attr, _format, _argList);
1975   }
1976
1977   void dbgTextPrintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...)
1978   {
1979      BGFX_CHECK_MAIN_THREAD();
1980      va_list argList;
1981      va_start(argList, _format);
1982      s_ctx->dbgTextPrintfVargs(_x, _y, _attr, _format, argList);
1983      va_end(argList);
1984   }
1985
1986   IndexBufferHandle createIndexBuffer(const Memory* _mem)
1987   {
1988      BGFX_CHECK_MAIN_THREAD();
1989      return s_ctx->createIndexBuffer(_mem);
1990   }
1991
1992   void destroyIndexBuffer(IndexBufferHandle _handle)
1993   {
1994      BGFX_CHECK_MAIN_THREAD();
1995      s_ctx->destroyIndexBuffer(_handle);
1996   }
1997
1998   VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl)
1999   {
2000      BGFX_CHECK_MAIN_THREAD();
2001      BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
2002      return s_ctx->createVertexBuffer(_mem, _decl);
2003   }
2004
2005   void destroyVertexBuffer(VertexBufferHandle _handle)
2006   {
2007      BGFX_CHECK_MAIN_THREAD();
2008      s_ctx->destroyVertexBuffer(_handle);
2009   }
2010
2011   DynamicIndexBufferHandle createDynamicIndexBuffer(uint32_t _num)
2012   {
2013      BGFX_CHECK_MAIN_THREAD();
2014      return s_ctx->createDynamicIndexBuffer(_num);
2015   }
2016
2017   DynamicIndexBufferHandle createDynamicIndexBuffer(const Memory* _mem)
2018   {
2019      BGFX_CHECK_MAIN_THREAD();
2020      BX_CHECK(NULL != _mem, "_mem can't be NULL");
2021      return s_ctx->createDynamicIndexBuffer(_mem);
2022   }
2023
2024   void updateDynamicIndexBuffer(DynamicIndexBufferHandle _handle, const Memory* _mem)
2025   {
2026      BGFX_CHECK_MAIN_THREAD();
2027      BX_CHECK(NULL != _mem, "_mem can't be NULL");
2028      s_ctx->updateDynamicIndexBuffer(_handle, _mem);
2029   }
2030
2031   void destroyDynamicIndexBuffer(DynamicIndexBufferHandle _handle)
2032   {
2033      BGFX_CHECK_MAIN_THREAD();
2034      s_ctx->destroyDynamicIndexBuffer(_handle);
2035   }
2036
2037   DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl)
2038   {
2039      BGFX_CHECK_MAIN_THREAD();
2040      BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
2041      return s_ctx->createDynamicVertexBuffer(_num, _decl);
2042   }
2043
2044   DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl)
2045   {
2046      BGFX_CHECK_MAIN_THREAD();
2047      BX_CHECK(NULL != _mem, "_mem can't be NULL");
2048      BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
2049      return s_ctx->createDynamicVertexBuffer(_mem, _decl);
2050   }
2051
2052   void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, const Memory* _mem)
2053   {
2054      BGFX_CHECK_MAIN_THREAD();
2055      BX_CHECK(NULL != _mem, "_mem can't be NULL");
2056      s_ctx->updateDynamicVertexBuffer(_handle, _mem);
2057   }
2058
2059   void destroyDynamicVertexBuffer(DynamicVertexBufferHandle _handle)
2060   {
2061      BGFX_CHECK_MAIN_THREAD();
2062      s_ctx->destroyDynamicVertexBuffer(_handle);
2063   }
2064
2065   bool checkAvailTransientIndexBuffer(uint32_t _num)
2066   {
2067      BGFX_CHECK_MAIN_THREAD();
2068      BX_CHECK(0 < _num, "Requesting 0 indices.");
2069      return s_ctx->checkAvailTransientIndexBuffer(_num);
2070   }
2071
2072   bool checkAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl)
2073   {
2074      BGFX_CHECK_MAIN_THREAD();
2075      BX_CHECK(0 < _num, "Requesting 0 vertices.");
2076      BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
2077      return s_ctx->checkAvailTransientVertexBuffer(_num, _decl.m_stride);
2078   }
2079
2080   bool checkAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride)
2081   {
2082      BGFX_CHECK_MAIN_THREAD();
2083      BX_CHECK(0 < _num, "Requesting 0 instances.");
2084      return s_ctx->checkAvailTransientVertexBuffer(_num, _stride);
2085   }
2086
2087   bool checkAvailTransientBuffers(uint32_t _numVertices, const VertexDecl& _decl, uint32_t _numIndices)
2088   {
2089      BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
2090      return checkAvailTransientVertexBuffer(_numVertices, _decl)
2091         && checkAvailTransientIndexBuffer(_numIndices)
2092         ;
2093   }
2094
2095   void allocTransientIndexBuffer(TransientIndexBuffer* _tib, uint32_t _num)
2096   {
2097      BGFX_CHECK_MAIN_THREAD();
2098      BX_CHECK(NULL != _tib, "_tib can't be NULL");
2099      BX_CHECK(0 < _num, "Requesting 0 indices.");
2100      return s_ctx->allocTransientIndexBuffer(_tib, _num);
2101   }
2102
2103   void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, const VertexDecl& _decl)
2104   {
2105      BGFX_CHECK_MAIN_THREAD();
2106      BX_CHECK(NULL != _tvb, "_tvb can't be NULL");
2107      BX_CHECK(0 < _num, "Requesting 0 vertices.");
2108      BX_CHECK(UINT16_MAX >= _num, "Requesting %d vertices (max: %d).", _num, UINT16_MAX);
2109      BX_CHECK(0 != _decl.m_stride, "Invalid VertexDecl.");
2110      return s_ctx->allocTransientVertexBuffer(_tvb, _num, _decl);
2111   }
2112
2113   bool allocTransientBuffers(bgfx::TransientVertexBuffer* _tvb, const bgfx::VertexDecl& _decl, uint16_t _numVertices, bgfx::TransientIndexBuffer* _tib, uint16_t _numIndices)
2114   {
2115      if (checkAvailTransientBuffers(_numVertices, _decl, _numIndices) )
2116      {
2117         allocTransientVertexBuffer(_tvb, _numVertices, _decl);
2118         allocTransientIndexBuffer(_tib, _numIndices);
2119         return true;
2120      }
2121
2122      return false;
2123   }
2124
2125   const InstanceDataBuffer* allocInstanceDataBuffer(uint32_t _num, uint16_t _stride)
2126   {
2127      BGFX_CHECK_MAIN_THREAD();
2128      BX_CHECK(0 != (g_caps.supported & BGFX_CAPS_INSTANCING), "Instancing is not supported! Use bgfx::getCaps to check backend renderer capabilities.");
2129      BX_CHECK(0 < _num, "Requesting 0 instanced data vertices.");
2130      return s_ctx->allocInstanceDataBuffer(_num, _stride);
2131   }
2132
2133   ShaderHandle createShader(const Memory* _mem)
2134   {
2135      BGFX_CHECK_MAIN_THREAD();
2136      BX_CHECK(NULL != _mem, "_mem can't be NULL");
2137      return s_ctx->createShader(_mem);
2138   }
2139
2140   uint16_t getShaderUniforms(ShaderHandle _handle, UniformHandle* _uniforms, uint16_t _max)
2141   {
2142      BGFX_CHECK_MAIN_THREAD();
2143      return s_ctx->getShaderUniforms(_handle, _uniforms, _max);
2144   }
2145
2146   void destroyShader(ShaderHandle _handle)
2147   {
2148      BGFX_CHECK_MAIN_THREAD();
2149      s_ctx->destroyShader(_handle);
2150   }
2151
2152   ProgramHandle createProgram(ShaderHandle _vsh, ShaderHandle _fsh, bool _destroyShaders)
2153   {
2154      BGFX_CHECK_MAIN_THREAD();
2155      ProgramHandle handle = s_ctx->createProgram(_vsh, _fsh);
2156
2157      if (_destroyShaders)
2158      {
2159         destroyShader(_vsh);
2160         destroyShader(_fsh);
2161      }
2162
2163      return handle;
2164   }
2165
2166   ProgramHandle createProgram(ShaderHandle _vsh, bool _destroyShaders)
2167   {
2168      BGFX_CHECK_MAIN_THREAD();
2169      ProgramHandle handle = s_ctx->createProgram(_vsh);
2170
2171      if (_destroyShaders)
2172      {
2173         destroyShader(_vsh);
2174      }
2175
2176      return handle;
2177   }
2178
2179   void destroyProgram(ProgramHandle _handle)
2180   {
2181      BGFX_CHECK_MAIN_THREAD();
2182      s_ctx->destroyProgram(_handle);
2183   }
2184
2185   void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, TextureFormat::Enum _format)
2186   {
2187      _width   = bx::uint32_max(1, _width);
2188      _height  = bx::uint32_max(1, _height);
2189      _depth   = bx::uint32_max(1, _depth);
2190
2191      uint32_t width  = _width;
2192      uint32_t height = _height;
2193      uint32_t depth  = _depth;
2194
2195      uint32_t bpp = getBitsPerPixel(_format);
2196      uint32_t size = 0;
2197
2198      for (uint32_t lod = 0; lod < _numMips; ++lod)
2199      {
2200         width  = bx::uint32_max(1, width);
2201         height = bx::uint32_max(1, height);
2202         depth  = bx::uint32_max(1, depth);
2203
2204         size += width*height*depth*bpp/8;
2205
2206         width >>= 1;
2207         height >>= 1;
2208         depth >>= 1;
2209      }
2210
2211      _info.format = _format;
2212      _info.storageSize = size;
2213      _info.width = _width;
2214      _info.height = _height;
2215      _info.depth = _depth;
2216      _info.numMips = _numMips;
2217      _info.bitsPerPixel = bpp;
2218   }
2219
2220   TextureHandle createTexture(const Memory* _mem, uint32_t _flags, uint8_t _skip, TextureInfo* _info)
2221   {
2222      BGFX_CHECK_MAIN_THREAD();
2223      BX_CHECK(NULL != _mem, "_mem can't be NULL");
2224      return s_ctx->createTexture(_mem, _flags, _skip, _info);
2225   }
2226
2227   TextureHandle createTexture2D(uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
2228   {
2229      BGFX_CHECK_MAIN_THREAD();
2230
2231      _numMips = bx::uint32_max(1, _numMips);
2232
2233      if (BX_ENABLED(BGFX_CONFIG_DEBUG)
2234      &&  NULL != _mem)
2235      {
2236         TextureInfo ti;
2237         calcTextureSize(ti, _width, _height, 1, _numMips, _format);
2238         BX_CHECK(ti.storageSize == _mem->size
2239            , "createTexture2D: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
2240            , ti.storageSize
2241            , _mem->size
2242            );
2243      }
2244
2245      uint32_t size = sizeof(uint32_t)+sizeof(TextureCreate);
2246      const Memory* mem = alloc(size);
2247
2248      bx::StaticMemoryBlockWriter writer(mem->data, mem->size);
2249      uint32_t magic = BGFX_CHUNK_MAGIC_TEX;
2250      bx::write(&writer, magic);
2251
2252      TextureCreate tc;
2253      tc.m_flags = _flags;
2254      tc.m_width = _width;
2255      tc.m_height = _height;
2256      tc.m_sides = 0;
2257      tc.m_depth = 0;
2258      tc.m_numMips = _numMips;
2259      tc.m_format = uint8_t(_format);
2260      tc.m_cubeMap = false;
2261      tc.m_mem = _mem;
2262      bx::write(&writer, tc);
2263
2264      return s_ctx->createTexture(mem, _flags, 0, NULL);
2265   }
2266
2267   TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
2268   {
2269      BGFX_CHECK_MAIN_THREAD();
2270      BX_CHECK(0 != (g_caps.supported & BGFX_CAPS_TEXTURE_3D), "Texture3D is not supported! Use bgfx::getCaps to check backend renderer capabilities.");
2271
2272      _numMips = bx::uint32_max(1, _numMips);
2273
2274      if (BX_ENABLED(BGFX_CONFIG_DEBUG)
2275      &&  NULL != _mem)
2276      {
2277         TextureInfo ti;
2278         calcTextureSize(ti, _width, _height, _depth, _numMips, _format);
2279         BX_CHECK(ti.storageSize == _mem->size
2280            , "createTexture3D: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
2281            , ti.storageSize
2282            , _mem->size
2283            );
2284      }
2285
2286      uint32_t size = sizeof(uint32_t)+sizeof(TextureCreate);
2287      const Memory* mem = alloc(size);
2288
2289      bx::StaticMemoryBlockWriter writer(mem->data, mem->size);
2290      uint32_t magic = BGFX_CHUNK_MAGIC_TEX;
2291      bx::write(&writer, magic);
2292
2293      TextureCreate tc;
2294      tc.m_flags = _flags;
2295      tc.m_width = _width;
2296      tc.m_height = _height;
2297      tc.m_sides = 0;
2298      tc.m_depth = _depth;
2299      tc.m_numMips = _numMips;
2300      tc.m_format = uint8_t(_format);
2301      tc.m_cubeMap = false;
2302      tc.m_mem = _mem;
2303      bx::write(&writer, tc);
2304
2305      return s_ctx->createTexture(mem, _flags, 0, NULL);
2306   }
2307
2308   TextureHandle createTextureCube(uint16_t _size, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags, const Memory* _mem)
2309   {
2310      BGFX_CHECK_MAIN_THREAD();
2311
2312      _numMips = bx::uint32_max(1, _numMips);
2313
2314      if (BX_ENABLED(BGFX_CONFIG_DEBUG)
2315      &&  NULL != _mem)
2316      {
2317         TextureInfo ti;
2318         calcTextureSize(ti, _size, _size, 1, _numMips, _format);
2319         BX_CHECK(ti.storageSize*6 == _mem->size
2320            , "createTextureCube: Texture storage size doesn't match passed memory size (storage size: %d, memory size: %d)"
2321            , ti.storageSize*6
2322            , _mem->size
2323            );
2324      }
2325
2326      uint32_t size = sizeof(uint32_t)+sizeof(TextureCreate);
2327      const Memory* mem = alloc(size);
2328
2329      bx::StaticMemoryBlockWriter writer(mem->data, mem->size);
2330      uint32_t magic = BGFX_CHUNK_MAGIC_TEX;
2331      bx::write(&writer, magic);
2332
2333      TextureCreate tc;
2334      tc.m_flags = _flags;
2335      tc.m_width = _size;
2336      tc.m_height = _size;
2337      tc.m_sides = 6;
2338      tc.m_depth = 0;
2339      tc.m_numMips = _numMips;
2340      tc.m_format = uint8_t(_format);
2341      tc.m_cubeMap = true;
2342      tc.m_mem = _mem;
2343      bx::write(&writer, tc);
2344
2345      return s_ctx->createTexture(mem, _flags, 0, NULL);
2346   }
2347
2348   void destroyTexture(TextureHandle _handle)
2349   {
2350      BGFX_CHECK_MAIN_THREAD();
2351      s_ctx->destroyTexture(_handle);
2352   }
2353
2354   void updateTexture2D(TextureHandle _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
2355   {
2356      BGFX_CHECK_MAIN_THREAD();
2357      BX_CHECK(NULL != _mem, "_mem can't be NULL");
2358      if (_width == 0
2359      ||  _height == 0)
2360      {
2361         release(_mem);
2362      }
2363      else
2364      {
2365         s_ctx->updateTexture(_handle, 0, _mip, _x, _y, 0, _width, _height, 1, _pitch, _mem);
2366      }
2367   }
2368
2369   void updateTexture3D(TextureHandle _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const Memory* _mem)
2370   {
2371      BGFX_CHECK_MAIN_THREAD();
2372      BX_CHECK(NULL != _mem, "_mem can't be NULL");
2373      if (_width == 0
2374      ||  _height == 0
2375      ||  _depth == 0)
2376      {
2377         release(_mem);
2378      }
2379      else
2380      {
2381         s_ctx->updateTexture(_handle, 0, _mip, _x, _y, _z, _width, _height, _depth, UINT16_MAX, _mem);
2382      }
2383   }
2384
2385   void updateTextureCube(TextureHandle _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch)
2386   {
2387      BGFX_CHECK_MAIN_THREAD();
2388      BX_CHECK(NULL != _mem, "_mem can't be NULL");
2389      BX_CHECK(_side <= 5, "Invalid side %d.", _side);
2390      if (_width == 0
2391      ||  _height == 0)
2392      {
2393         release(_mem);
2394      }
2395      else
2396      {
2397         s_ctx->updateTexture(_handle, _side, _mip, _x, _y, 0, _width, _height, 1, _pitch, _mem);
2398      }
2399   }
2400
2401   FrameBufferHandle createFrameBuffer(uint16_t _width, uint16_t _height, TextureFormat::Enum _format, uint32_t _textureFlags)
2402   {
2403      _textureFlags |= _textureFlags&BGFX_TEXTURE_RT_MSAA_MASK ? 0 : BGFX_TEXTURE_RT;
2404      TextureHandle th = createTexture2D(_width, _height, 1, _format, _textureFlags);
2405      return createFrameBuffer(1, &th, true);
2406   }
2407
2408   FrameBufferHandle createFrameBuffer(uint8_t _num, TextureHandle* _handles, bool _destroyTextures)
2409   {
2410      BGFX_CHECK_MAIN_THREAD();
2411      BX_CHECK(NULL != _handles, "_handles can't be NULL");
2412      FrameBufferHandle handle = s_ctx->createFrameBuffer(_num, _handles);
2413      if (_destroyTextures)
2414      {
2415         for (uint32_t ii = 0; ii < _num; ++ii)
2416         {
2417            destroyTexture(_handles[ii]);
2418         }
2419      }
2420
2421      return handle;
2422   }
2423
2424   void destroyFrameBuffer(FrameBufferHandle _handle)
2425   {
2426      BGFX_CHECK_MAIN_THREAD();
2427      s_ctx->destroyFrameBuffer(_handle);
2428   }
2429
2430   UniformHandle createUniform(const char* _name, UniformType::Enum _type, uint16_t _num)
2431   {
2432      BGFX_CHECK_MAIN_THREAD();
2433      return s_ctx->createUniform(_name, _type, _num);
2434   }
2435
2436   void destroyUniform(UniformHandle _handle)
2437   {
2438      BGFX_CHECK_MAIN_THREAD();
2439      s_ctx->destroyUniform(_handle);
2440   }
2441
2442   void setViewName(uint8_t _id, const char* _name)
2443   {
2444      BGFX_CHECK_MAIN_THREAD();
2445      s_ctx->setViewName(_id, _name);
2446   }
2447
2448   void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
2449   {
2450      BGFX_CHECK_MAIN_THREAD();
2451      s_ctx->setViewRect(_id, _x, _y, _width, _height);
2452   }
2453
2454   void setViewRectMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
2455   {
2456      BGFX_CHECK_MAIN_THREAD();
2457      s_ctx->setViewRectMask(_viewMask, _x, _y, _width, _height);
2458   }
2459
2460   void setViewScissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
2461   {
2462      BGFX_CHECK_MAIN_THREAD();
2463      s_ctx->setViewScissor(_id, _x, _y, _width, _height);
2464   }
2465
2466   void setViewScissorMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
2467   {
2468      BGFX_CHECK_MAIN_THREAD();
2469      s_ctx->setViewScissorMask(_viewMask, _x, _y, _width, _height);
2470   }
2471
2472   void setViewClear(uint8_t _id, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil)
2473   {
2474      BGFX_CHECK_MAIN_THREAD();
2475      s_ctx->setViewClear(_id, _flags, _rgba, _depth, _stencil);
2476   }
2477
2478   void setViewClearMask(uint32_t _viewMask, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil)
2479   {
2480      BGFX_CHECK_MAIN_THREAD();
2481      s_ctx->setViewClearMask(_viewMask, _flags, _rgba, _depth, _stencil);
2482   }
2483
2484   void setViewSeq(uint8_t _id, bool _enabled)
2485   {
2486      BGFX_CHECK_MAIN_THREAD();
2487      s_ctx->setViewSeq(_id, _enabled);
2488   }
2489
2490   void setViewSeqMask(uint32_t _viewMask, bool _enabled)
2491   {
2492      BGFX_CHECK_MAIN_THREAD();
2493      s_ctx->setViewSeqMask(_viewMask, _enabled);
2494   }
2495
2496   void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle)
2497   {
2498      BGFX_CHECK_MAIN_THREAD();
2499      s_ctx->setViewFrameBuffer(_id, _handle);
2500   }
2501
2502   void setViewFrameBufferMask(uint32_t _mask, FrameBufferHandle _handle)
2503   {
2504      BGFX_CHECK_MAIN_THREAD();
2505      s_ctx->setViewFrameBufferMask(_mask, _handle);
2506   }
2507
2508   void setViewTransform(uint8_t _id, const void* _view, const void* _proj)
2509   {
2510      BGFX_CHECK_MAIN_THREAD();
2511      s_ctx->setViewTransform(_id, _view, _proj);
2512   }
2513
2514   void setViewTransformMask(uint32_t _viewMask, const void* _view, const void* _proj)
2515   {
2516      BGFX_CHECK_MAIN_THREAD();
2517      s_ctx->setViewTransformMask(_viewMask, _view, _proj);
2518   }
2519
2520   void setMarker(const char* _marker)
2521   {
2522      BGFX_CHECK_MAIN_THREAD();
2523      s_ctx->setMarker(_marker);
2524   }
2525
2526   void setState(uint64_t _state, uint32_t _rgba)
2527   {
2528      BGFX_CHECK_MAIN_THREAD();
2529      s_ctx->setState(_state, _rgba);
2530   }
2531
2532   void setStencil(uint32_t _fstencil, uint32_t _bstencil)
2533   {
2534      BGFX_CHECK_MAIN_THREAD();
2535      s_ctx->setStencil(_fstencil, _bstencil);
2536   }
2537
2538   uint16_t setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
2539   {
2540      BGFX_CHECK_MAIN_THREAD();
2541      return s_ctx->setScissor(_x, _y, _width, _height);
2542   }
2543
2544   void setScissor(uint16_t _cache)
2545   {
2546      BGFX_CHECK_MAIN_THREAD();
2547      s_ctx->setScissor(_cache);
2548   }
2549
2550   uint32_t setTransform(const void* _mtx, uint16_t _num)
2551   {
2552      BGFX_CHECK_MAIN_THREAD();
2553      return s_ctx->setTransform(_mtx, _num);
2554   }
2555
2556   void setTransform(uint32_t _cache, uint16_t _num)
2557   {
2558      BGFX_CHECK_MAIN_THREAD();
2559      s_ctx->setTransform(_cache, _num);
2560   }
2561
2562   void setUniform(UniformHandle _handle, const void* _value, uint16_t _num)
2563   {
2564      BGFX_CHECK_MAIN_THREAD();
2565      s_ctx->setUniform(_handle, _value, _num);
2566   }
2567
2568   void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
2569   {
2570      BGFX_CHECK_MAIN_THREAD();
2571      s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
2572   }
2573
2574   void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
2575   {
2576      BGFX_CHECK_MAIN_THREAD();
2577      s_ctx->setIndexBuffer(_handle, _firstIndex, _numIndices);
2578   }
2579
2580   void setIndexBuffer(const TransientIndexBuffer* _tib)
2581   {
2582      setIndexBuffer(_tib, 0, UINT32_MAX);
2583   }
2584
2585   void setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _firstIndex, uint32_t _numIndices)
2586   {
2587      BGFX_CHECK_MAIN_THREAD();
2588      BX_CHECK(NULL != _tib, "_tib can't be NULL");
2589      uint32_t numIndices = bx::uint32_min(_numIndices, _tib->size/2);
2590      s_ctx->setIndexBuffer(_tib, _tib->startIndex + _firstIndex, numIndices);
2591   }
2592
2593   void setVertexBuffer(VertexBufferHandle _handle)
2594   {
2595      setVertexBuffer(_handle, 0, UINT32_MAX);
2596   }
2597
2598   void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices)
2599   {
2600      BGFX_CHECK_MAIN_THREAD();
2601      s_ctx->setVertexBuffer(_handle, _startVertex, _numVertices);
2602   }
2603
2604   void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices)
2605   {
2606      BGFX_CHECK_MAIN_THREAD();
2607      s_ctx->setVertexBuffer(_handle, _numVertices);
2608   }
2609
2610   void setVertexBuffer(const TransientVertexBuffer* _tvb)
2611   {
2612      setVertexBuffer(_tvb, 0, UINT32_MAX);
2613   }
2614
2615   void setVertexBuffer(const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices)
2616   {
2617      BGFX_CHECK_MAIN_THREAD();
2618      BX_CHECK(NULL != _tvb, "_tvb can't be NULL");
2619      s_ctx->setVertexBuffer(_tvb, _tvb->startVertex + _startVertex, _numVertices);
2620   }
2621
2622   void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint16_t _num)
2623   {
2624      BGFX_CHECK_MAIN_THREAD();
2625      s_ctx->setInstanceDataBuffer(_idb, _num);
2626   }
2627
2628   void setProgram(ProgramHandle _handle)
2629   {
2630      BGFX_CHECK_MAIN_THREAD();
2631      s_ctx->setProgram(_handle);
2632   }
2633
2634   void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags)
2635   {
2636      BGFX_CHECK_MAIN_THREAD();
2637      s_ctx->setTexture(_stage, _sampler, _handle, _flags);
2638   }
2639
2640   void setTexture(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, uint32_t _flags)
2641   {
2642      BGFX_CHECK_MAIN_THREAD();
2643      s_ctx->setTexture(_stage, _sampler, _handle, _attachment, _flags);
2644   }
2645
2646   uint32_t submit(uint8_t _id, int32_t _depth)
2647   {
2648      BGFX_CHECK_MAIN_THREAD();
2649      return s_ctx->submit(_id, _depth);
2650   }
2651
2652   uint32_t submitMask(uint32_t _viewMask, int32_t _depth)
2653   {
2654      BGFX_CHECK_MAIN_THREAD();
2655      return s_ctx->submitMask(_viewMask, _depth);
2656   }
2657
2658   void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access)
2659   {
2660      BGFX_CHECK_MAIN_THREAD();
2661      s_ctx->setImage(_stage, _sampler, _handle, _mip, _format, _access);
2662   }
2663
2664   void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, TextureFormat::Enum _format, Access::Enum _access)
2665   {
2666      BGFX_CHECK_MAIN_THREAD();
2667      s_ctx->setImage(_stage, _sampler, _handle, _attachment, _format, _access);
2668   }
2669
2670   void dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ)
2671   {
2672      BGFX_CHECK_MAIN_THREAD();
2673      s_ctx->dispatch(_id, _handle, _numX, _numY, _numZ);
2674   }
2675
2676   void discard()
2677   {
2678      BGFX_CHECK_MAIN_THREAD();
2679      s_ctx->discard();
2680   }
2681
2682   void saveScreenShot(const char* _filePath)
2683   {
2684      BGFX_CHECK_MAIN_THREAD();
2685      s_ctx->saveScreenShot(_filePath);
2686   }
2687} // namespace bgfx
2688
2689#include <bgfx.c99.h>
2690#include <bgfxplatform.c99.h>
2691
2692BX_STATIC_ASSERT(bgfx::RendererType::Count  == bgfx::RendererType::Enum(BGFX_RENDERER_TYPE_COUNT) );
2693BX_STATIC_ASSERT(bgfx::Attrib::Count        == bgfx::Attrib::Enum(BGFX_ATTRIB_COUNT) );
2694BX_STATIC_ASSERT(bgfx::AttribType::Count    == bgfx::AttribType::Enum(BGFX_ATTRIB_TYPE_COUNT) );
2695BX_STATIC_ASSERT(bgfx::TextureFormat::Count == bgfx::TextureFormat::Enum(BGFX_TEXTURE_FORMAT_COUNT) );
2696BX_STATIC_ASSERT(bgfx::UniformType::Count   == bgfx::UniformType::Enum(BGFX_UNIFORM_TYPE_COUNT) );
2697BX_STATIC_ASSERT(bgfx::RenderFrame::Count   == bgfx::RenderFrame::Enum(BGFX_RENDER_FRAME_COUNT) );
2698
2699BX_STATIC_ASSERT(sizeof(bgfx::Memory)                == sizeof(bgfx_memory_t) );
2700BX_STATIC_ASSERT(sizeof(bgfx::VertexDecl)            == sizeof(bgfx_vertex_decl_t) );
2701BX_STATIC_ASSERT(sizeof(bgfx::TransientIndexBuffer)  == sizeof(bgfx_transient_index_buffer_t) );
2702BX_STATIC_ASSERT(sizeof(bgfx::TransientVertexBuffer) == sizeof(bgfx_transient_vertex_buffer_t) );
2703BX_STATIC_ASSERT(sizeof(bgfx::InstanceDataBuffer)    == sizeof(bgfx_instance_data_buffer_t) );
2704BX_STATIC_ASSERT(sizeof(bgfx::TextureInfo)           == sizeof(bgfx_texture_info_t) );
2705BX_STATIC_ASSERT(sizeof(bgfx::Caps)                  == sizeof(bgfx_caps_t) );
2706
2707BGFX_C_API void bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer)
2708{
2709   bgfx::VertexDecl* decl = (bgfx::VertexDecl*)_decl;
2710   decl->begin(bgfx::RendererType::Enum(_renderer) );
2711}
2712
2713BGFX_C_API void bgfx_vertex_decl_add(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt)
2714{
2715   bgfx::VertexDecl* decl = (bgfx::VertexDecl*)_decl;
2716   decl->add(bgfx::Attrib::Enum(_attrib)
2717      , _num
2718      , bgfx::AttribType::Enum(_type)
2719      , _normalized
2720      , _asInt
2721      );
2722}
2723
2724BGFX_C_API void bgfx_vertex_decl_skip(bgfx_vertex_decl_t* _decl, uint8_t _num)
2725{
2726   bgfx::VertexDecl* decl = (bgfx::VertexDecl*)_decl;
2727   decl->skip(_num);
2728}
2729
2730BGFX_C_API void bgfx_vertex_decl_end(bgfx_vertex_decl_t* _decl)
2731{
2732   bgfx::VertexDecl* decl = (bgfx::VertexDecl*)_decl;
2733   decl->end();
2734}
2735
2736BGFX_C_API void bgfx_vertex_pack(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, void* _data, uint32_t _index)
2737{
2738   bgfx::VertexDecl& decl = *(bgfx::VertexDecl*)_decl;
2739   bgfx::vertexPack(_input, _inputNormalized, bgfx::Attrib::Enum(_attr), decl, _data, _index);
2740}
2741
2742BGFX_C_API void bgfx_vertex_unpack(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, const void* _data, uint32_t _index)
2743{
2744   bgfx::VertexDecl& decl = *(bgfx::VertexDecl*)_decl;
2745   bgfx::vertexUnpack(_output, bgfx::Attrib::Enum(_attr), decl, _data, _index);
2746}
2747
2748BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_decl_t* _destDecl, void* _destData, const bgfx_vertex_decl_t* _srcDecl, const void* _srcData, uint32_t _num)
2749{
2750   bgfx::VertexDecl& destDecl = *(bgfx::VertexDecl*)_destDecl;
2751   bgfx::VertexDecl& srcDecl  = *(bgfx::VertexDecl*)_srcDecl;
2752   bgfx::vertexConvert(destDecl, _destData, srcDecl, _srcData, _num);
2753}
2754
2755BGFX_C_API uint16_t bgfx_weld_vertices(uint16_t* _output, const bgfx_vertex_decl_t* _decl, const void* _data, uint16_t _num, float _epsilon)
2756{
2757   bgfx::VertexDecl& decl = *(bgfx::VertexDecl*)_decl;
2758   return bgfx::weldVertices(_output, decl, _data, _num, _epsilon);
2759}
2760
2761BGFX_C_API void bgfx_image_swizzle_bgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
2762{
2763   bgfx::imageSwizzleBgra8(_width, _height, _pitch, _src, _dst);
2764}
2765
2766BGFX_C_API void bgfx_image_rgba8_downsample_2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst)
2767{
2768   bgfx::imageRgba8Downsample2x2(_width, _height, _pitch, _src, _dst);
2769}
2770
2771BGFX_C_API uint8_t bgfx_get_supported_renderers(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT])
2772{
2773   return bgfx::getSupportedRenderers( (bgfx::RendererType::Enum*)_enum);
2774}
2775
2776BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type)
2777{
2778   return bgfx::getRendererName(bgfx::RendererType::Enum(_type) );
2779}
2780
2781BGFX_C_API void bgfx_init(bgfx_renderer_type_t _type, struct bgfx_callback_interface* _callback, struct bgfx_reallocator_interface* _allocator)
2782{
2783   return bgfx::init(bgfx::RendererType::Enum(_type)
2784      , reinterpret_cast<bgfx::CallbackI*>(_callback)
2785      , reinterpret_cast<bx::ReallocatorI*>(_allocator)
2786      );
2787}
2788
2789BGFX_C_API void bgfx_shutdown()
2790{
2791   return bgfx::shutdown();
2792}
2793
2794BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags)
2795{
2796   bgfx::reset(_width, _height, _flags);
2797}
2798
2799BGFX_C_API uint32_t bgfx_frame()
2800{
2801   return bgfx::frame();
2802}
2803
2804BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type()
2805{
2806   return bgfx_renderer_type_t(bgfx::getRendererType() );
2807}
2808
2809BGFX_C_API bgfx_caps_t* bgfx_get_caps()
2810{
2811   return (bgfx_caps_t*)bgfx::getCaps();
2812}
2813
2814BGFX_C_API const bgfx_memory_t* bgfx_alloc(uint32_t _size)
2815{
2816   return (const bgfx_memory_t*)bgfx::alloc(_size);
2817}
2818
2819BGFX_C_API const bgfx_memory_t* bgfx_copy(const void* _data, uint32_t _size)
2820{
2821   return (const bgfx_memory_t*)bgfx::copy(_data, _size);
2822}
2823
2824BGFX_C_API const bgfx_memory_t* bgfx_make_ref(const void* _data, uint32_t _size)
2825{
2826   return (const bgfx_memory_t*)bgfx::makeRef(_data, _size);
2827}
2828
2829BGFX_C_API void bgfx_set_debug(uint32_t _debug)
2830{
2831   bgfx::setDebug(_debug);
2832}
2833
2834BGFX_C_API void bgfx_dbg_text_clear(uint8_t _attr, bool _small)
2835{
2836   bgfx::dbgTextClear(_attr, _small);
2837}
2838
2839BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...)
2840{
2841   va_list argList;
2842   va_start(argList, _format);
2843   bgfx::dbgTextPrintfVargs(_x, _y, _attr, _format, argList);
2844   va_end(argList);
2845}
2846
2847BGFX_C_API bgfx_index_buffer_handle_t bgfx_create_index_buffer(const bgfx_memory_t* _mem)
2848{
2849   union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle;
2850   handle.cpp = bgfx::createIndexBuffer( (const bgfx::Memory*)_mem);
2851   return handle.c;
2852}
2853
2854BGFX_C_API void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle)
2855{
2856   union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
2857   bgfx::destroyIndexBuffer(handle.cpp);
2858}
2859
2860BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl)
2861{
2862   const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
2863   union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle;
2864   handle.cpp = bgfx::createVertexBuffer( (const bgfx::Memory*)_mem, decl);
2865   return handle.c;
2866}
2867
2868BGFX_C_API void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle)
2869{
2870   union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
2871   bgfx::destroyVertexBuffer(handle.cpp);
2872}
2873
2874BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint32_t _num)
2875{
2876   union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle;
2877   handle.cpp = bgfx::createDynamicIndexBuffer(_num);
2878   return handle.c;
2879}
2880
2881BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const bgfx_memory_t* _mem)
2882{
2883   union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle;
2884   handle.cpp = bgfx::createDynamicIndexBuffer( (const bgfx::Memory*)_mem);
2885   return handle.c;
2886}
2887
2888BGFX_C_API void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, const bgfx_memory_t* _mem)
2889{
2890   union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
2891   bgfx::updateDynamicIndexBuffer(handle.cpp, (const bgfx::Memory*)_mem);
2892}
2893
2894BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle)
2895{
2896   union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
2897   bgfx::destroyDynamicIndexBuffer(handle.cpp);
2898}
2899
2900BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint16_t _num, const bgfx_vertex_decl_t* _decl)
2901{
2902   const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
2903   union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle;
2904   handle.cpp = bgfx::createDynamicVertexBuffer(_num, decl);
2905   return handle.c;
2906}
2907
2908BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl)
2909{
2910   const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
2911   union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle;
2912   handle.cpp = bgfx::createDynamicVertexBuffer( (const bgfx::Memory*)_mem, decl);
2913   return handle.c;
2914}
2915
2916BGFX_C_API void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, const bgfx_memory_t* _mem)
2917{
2918   union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
2919   bgfx::updateDynamicVertexBuffer(handle.cpp, (const bgfx::Memory*)_mem);
2920}
2921
2922BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle)
2923{
2924   union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
2925   bgfx::destroyDynamicVertexBuffer(handle.cpp);
2926}
2927
2928BGFX_C_API bool bgfx_check_avail_transient_index_buffer(uint32_t _num)
2929{
2930   return bgfx::checkAvailTransientIndexBuffer(_num);
2931}
2932
2933BGFX_C_API bool bgfx_check_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl)
2934{
2935   const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
2936   return bgfx::checkAvailTransientVertexBuffer(_num, decl);
2937}
2938
2939BGFX_C_API bool bgfx_check_avail_instance_data_buffer(uint32_t _num, uint16_t _stride)
2940{
2941   return bgfx::checkAvailInstanceDataBuffer(_num, _stride);
2942}
2943
2944BGFX_C_API bool bgfx_check_avail_transient_buffers(uint32_t _numVertices, const bgfx_vertex_decl_t* _decl, uint32_t _numIndices)
2945{
2946   const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
2947   return bgfx::checkAvailTransientBuffers(_numVertices, decl, _numIndices);
2948}
2949
2950BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint32_t _num)
2951{
2952   bgfx::allocTransientIndexBuffer( (bgfx::TransientIndexBuffer*)_tib, _num);
2953}
2954
2955BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t* _decl)
2956{
2957   const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
2958   bgfx::allocTransientVertexBuffer( (bgfx::TransientVertexBuffer*)_tvb, _num, decl);
2959}
2960
2961BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint16_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint16_t _numIndices)
2962{
2963   const bgfx::VertexDecl& decl = *(const bgfx::VertexDecl*)_decl;
2964   return bgfx::allocTransientBuffers( (bgfx::TransientVertexBuffer*)_tvb, decl, _numVertices, (bgfx::TransientIndexBuffer*)_tib, _numIndices);
2965}
2966
2967BGFX_C_API const bgfx_instance_data_buffer_t* bgfx_alloc_instance_data_buffer(uint32_t _num, uint16_t _stride)
2968{
2969   return (bgfx_instance_data_buffer_t*)bgfx::allocInstanceDataBuffer(_num, _stride);
2970}
2971
2972BGFX_C_API bgfx_shader_handle_t bgfx_create_shader(const bgfx_memory_t* _mem)
2973{
2974   union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle;
2975   handle.cpp = bgfx::createShader( (const bgfx::Memory*)_mem);
2976   return handle.c;
2977}
2978
2979BGFX_C_API uint16_t bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, uint16_t _max)
2980{
2981   union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle };
2982   return bgfx::getShaderUniforms(handle.cpp, (bgfx::UniformHandle*)_uniforms, _max);
2983}
2984
2985BGFX_C_API void bgfx_destroy_shader(bgfx_shader_handle_t _handle)
2986{
2987   union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle };
2988   bgfx::destroyShader(handle.cpp);
2989}
2990
2991BGFX_C_API bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders)
2992{
2993   union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } vsh = { _vsh };
2994   union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } fsh = { _fsh };
2995   union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle;
2996   handle.cpp = bgfx::createProgram(vsh.cpp, fsh.cpp, _destroyShaders);
2997   return handle.c;
2998}
2999
3000BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle)
3001{
3002   union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle };
3003   bgfx::destroyProgram(handle.cpp);
3004}
3005
3006BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format)
3007{
3008   bgfx::TextureInfo& info = *(bgfx::TextureInfo*)_info;
3009   bgfx::calcTextureSize(info, _width, _height, _depth, _numMips, bgfx::TextureFormat::Enum(_format) );
3010}
3011
3012BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info)
3013{
3014   union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
3015   bgfx::TextureInfo* info = (bgfx::TextureInfo*)_info;
3016   handle.cpp = bgfx::createTexture( (const bgfx::Memory*)_mem, _flags, _skip, info);
3017   return handle.c;
3018}
3019
3020BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
3021{
3022   union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
3023   handle.cpp = bgfx::createTexture2D(_width, _height, _numMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
3024   return handle.c;
3025}
3026
3027BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
3028{
3029   union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
3030   handle.cpp = bgfx::createTexture3D(_width, _height, _depth, _numMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
3031   return handle.c;
3032}
3033
3034BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem)
3035{
3036   union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle;
3037   handle.cpp = bgfx::createTextureCube(_size, _numMips, bgfx::TextureFormat::Enum(_format), _flags, (const bgfx::Memory*)_mem);
3038   return handle.c;
3039}
3040
3041BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
3042{
3043   union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
3044   bgfx::updateTexture2D(handle.cpp, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
3045}
3046
3047BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem)
3048{
3049   union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
3050   bgfx::updateTexture3D(handle.cpp, _mip, _x, _y, _z, _width, _height, _depth, (const bgfx::Memory*)_mem);
3051}
3052
3053BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
3054{
3055   union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
3056   bgfx::updateTextureCube(handle.cpp, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
3057}
3058
3059BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle)
3060{
3061   union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
3062   bgfx::destroyTexture(handle.cpp);
3063}
3064
3065BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags)
3066{
3067   union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
3068   handle.cpp = bgfx::createFrameBuffer(_width, _height, bgfx::TextureFormat::Enum(_format), _textureFlags);
3069   return handle.c;
3070}
3071
3072BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, bgfx_texture_handle_t* _handles, bool _destroyTextures)
3073{
3074   union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle;
3075   handle.cpp = bgfx::createFrameBuffer(_num, (bgfx::TextureHandle*)_handles, _destroyTextures);
3076   return handle.c;
3077}
3078
3079BGFX_C_API void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle)
3080{
3081   union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
3082   bgfx::destroyFrameBuffer(handle.cpp);
3083}
3084
3085BGFX_C_API bgfx_uniform_handle_t bgfx_create_uniform(const char* _name, bgfx_uniform_type_t _type, uint16_t _num)
3086{
3087   union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle;
3088   handle.cpp = bgfx::createUniform(_name, bgfx::UniformType::Enum(_type), _num);
3089   return handle.c;
3090}
3091
3092BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle)
3093{
3094   union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle };
3095   bgfx::destroyUniform(handle.cpp);
3096}
3097
3098BGFX_C_API void bgfx_set_view_name(uint8_t _id, const char* _name)
3099{
3100   bgfx::setViewName(_id, _name);
3101}
3102
3103BGFX_C_API void bgfx_set_view_rect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
3104{
3105   bgfx::setViewRect(_id, _x, _y, _width, _height);
3106}
3107
3108BGFX_C_API void bgfx_set_view_rect_mask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
3109{
3110   bgfx::setViewRectMask(_viewMask, _x, _y, _width, _height);
3111}
3112
3113BGFX_C_API void bgfx_set_view_scissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
3114{
3115   bgfx::setViewScissor(_id, _x, _y, _width, _height);
3116}
3117
3118BGFX_C_API void bgfx_set_view_scissor_mask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
3119{
3120   bgfx::setViewScissorMask(_viewMask, _x, _y, _width, _height);
3121}
3122
3123BGFX_C_API void bgfx_set_view_clear(uint8_t _id, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil)
3124{
3125   bgfx::setViewClear(_id, _flags, _rgba, _depth, _stencil);
3126}
3127
3128BGFX_C_API void bgfx_set_view_clear_mask(uint32_t _viewMask, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil)
3129{
3130   bgfx::setViewClearMask(_viewMask, _flags, _rgba, _depth, _stencil);
3131}
3132
3133BGFX_C_API void bgfx_set_view_seq(uint8_t _id, bool _enabled)
3134{
3135   bgfx::setViewSeq(_id, _enabled);
3136}
3137
3138BGFX_C_API void bgfx_set_view_seq_mask(uint32_t _viewMask, bool _enabled)
3139{
3140   bgfx::setViewSeqMask(_viewMask, _enabled);
3141}
3142
3143BGFX_C_API void bgfx_set_view_frame_buffer(uint8_t _id, bgfx_frame_buffer_handle_t _handle)
3144{
3145   union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
3146   bgfx::setViewFrameBuffer(_id, handle.cpp);
3147}
3148
3149BGFX_C_API void bgfx_set_view_frame_buffer_mask(uint32_t _viewMask, bgfx_frame_buffer_handle_t _handle)
3150{
3151   union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
3152   bgfx::setViewFrameBufferMask(_viewMask, handle.cpp);
3153}
3154
3155BGFX_C_API void bgfx_set_view_transform(uint8_t _id, const void* _view, const void* _proj)
3156{
3157   bgfx::setViewTransform(_id, _view, _proj);
3158}
3159
3160BGFX_C_API void bgfx_set_view_transform_mask(uint32_t _viewMask, const void* _view, const void* _proj)
3161{
3162   bgfx::setViewTransformMask(_viewMask, _view, _proj);
3163}
3164
3165BGFX_C_API void bgfx_set_marker(const char* _marker)
3166{
3167   bgfx::setMarker(_marker);
3168}
3169
3170BGFX_C_API void bgfx_set_state(uint64_t _state, uint32_t _rgba)
3171{
3172   bgfx::setState(_state, _rgba);
3173}
3174
3175BGFX_C_API void bgfx_set_stencil(uint32_t _fstencil, uint32_t _bstencil)
3176{
3177   bgfx::setStencil(_fstencil, _bstencil);
3178}
3179
3180BGFX_C_API uint16_t bgfx_set_scissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
3181{
3182   return bgfx::setScissor(_x, _y, _width, _height);
3183}
3184
3185BGFX_C_API void bgfx_set_scissor_cached(uint16_t _cache)
3186{
3187   bgfx::setScissor(_cache);
3188}
3189
3190BGFX_C_API uint32_t bgfx_set_transform(const void* _mtx, uint16_t _num)
3191{
3192   return bgfx::setTransform(_mtx, _num);
3193}
3194
3195BGFX_C_API void bgfx_set_transform_cached(uint32_t _cache, uint16_t _num)
3196{
3197   bgfx::setTransform(_cache, _num);
3198}
3199
3200BGFX_C_API void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num)
3201{
3202   union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle };
3203   bgfx::setUniform(handle.cpp, _value, _num);
3204}
3205
3206BGFX_C_API void bgfx_set_index_buffer(bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices)
3207{
3208   union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
3209   bgfx::setIndexBuffer(handle.cpp, _firstIndex, _numIndices);
3210}
3211
3212BGFX_C_API void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices)
3213{
3214   union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
3215   bgfx::setIndexBuffer(handle.cpp, _firstIndex, _numIndices);
3216}
3217
3218BGFX_C_API void bgfx_set_transient_index_buffer(const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices)
3219{
3220   bgfx::setIndexBuffer( (const bgfx::TransientIndexBuffer*)_tib, _firstIndex, _numIndices);
3221}
3222
3223BGFX_C_API void bgfx_set_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices)
3224{
3225   union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
3226   bgfx::setVertexBuffer(handle.cpp, _startVertex, _numVertices);
3227}
3228
3229BGFX_C_API void bgfx_set_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _numVertices)
3230{
3231   union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
3232   bgfx::setVertexBuffer(handle.cpp, _numVertices);
3233}
3234
3235BGFX_C_API void bgfx_set_transient_vertex_buffer(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices)
3236{
3237   bgfx::setVertexBuffer( (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices);
3238}
3239
3240BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint16_t _num)
3241{
3242   bgfx::setInstanceDataBuffer( (const bgfx::InstanceDataBuffer*)_idb, _num);
3243}
3244
3245BGFX_C_API void bgfx_set_program(bgfx_program_handle_t _handle)
3246{
3247   union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle };
3248   bgfx::setProgram(handle.cpp);
3249}
3250
3251BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags)
3252{
3253   union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler };
3254   union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle  = { _handle  };
3255   bgfx::setTexture(_stage, sampler.cpp, handle.cpp, _flags);
3256}
3257
3258BGFX_C_API void bgfx_set_texture_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, uint32_t _flags)
3259{
3260   union { bgfx_uniform_handle_t c;      bgfx::UniformHandle cpp;     } sampler = { _sampler };
3261   union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle  = { _handle };
3262   bgfx::setTexture(_stage, sampler.cpp, handle.cpp, _attachment, _flags);
3263}
3264
3265BGFX_C_API uint32_t bgfx_submit(uint8_t _id, int32_t _depth)
3266{
3267   return bgfx::submit(_id, _depth);
3268}
3269
3270BGFX_C_API uint32_t bgfx_submit_mask(uint32_t _viewMask, int32_t _depth)
3271{
3272   return bgfx::submitMask(_viewMask, _depth);
3273}
3274
3275BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_texture_format_t _format, bgfx_access_t _access)
3276{
3277   union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler };
3278   union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle  = { _handle  };
3279   bgfx::setImage(_stage, sampler.cpp, handle.cpp, _mip, bgfx::TextureFormat::Enum(_format), bgfx::Access::Enum(_access) );
3280}
3281
3282BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_texture_format_t _format, bgfx_access_t _access)
3283{
3284   union { bgfx_uniform_handle_t c;      bgfx::UniformHandle cpp;     } sampler = { _sampler };
3285   union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle  = { _handle };
3286   bgfx::setImage(_stage, sampler.cpp, handle.cpp, _attachment, bgfx::TextureFormat::Enum(_format), bgfx::Access::Enum(_access) );
3287}
3288
3289BGFX_C_API void bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ)
3290{
3291   union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle };
3292   bgfx::dispatch(_id, handle.cpp, _numX, _numY, _numZ);
3293}
3294
3295BGFX_C_API void bgfx_discard()
3296{
3297   bgfx::discard();
3298}
3299
3300BGFX_C_API void bgfx_save_screen_shot(const char* _filePath)
3301{
3302   bgfx::saveScreenShot(_filePath);
3303}
3304
3305BGFX_C_API bgfx_render_frame_t bgfx_render_frame()
3306{
3307   return bgfx_render_frame_t(bgfx::renderFrame() );
3308}
3309
3310#if BX_PLATFORM_ANDROID
3311BGFX_C_API void bgfx_android_set_window(ANativeWindow* _window)
3312{
3313   bgfx::androidSetWindow(_window);
3314}
3315
3316#elif BX_PLATFORM_IOS
3317BGFX_C_API void bgfx_ios_set_eagl_layer(void* _layer)
3318{
3319   bgfx::iosSetEaglLayer(_layer);
3320}
3321
3322#elif BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
3323BGFX_C_API void bgfx_x11_set_display_window(::Display* _display, ::Window _window)
3324{
3325   bgfx::x11SetDisplayWindow(_display, _window);
3326}
3327
3328#elif BX_PLATFORM_NACL
3329BGFX_C_API bool bgfx_nacl_set_interfaces(PP_Instance _instance, const PPB_Instance* _instInterface, const PPB_Graphics3D* _graphicsInterface, bgfx_post_swap_buffers_fn _postSwapBuffers)
3330{
3331   return bgfx::naclSetInterfaces(_instance, _instInterface, _graphicsInterface, _postSwapBuffers);
3332}
3333
3334#elif BX_PLATFORM_OSX
3335BGFX_C_API void bgfx_osx_set_ns_window(void* _window)
3336{
3337   bgfx::osxSetNSWindow(_window);
3338}
3339
3340#elif BX_PLATFORM_WINDOWS
3341BGFX_C_API void bgfx_win_set_hwnd(HWND _window)
3342{
3343   bgfx::winSetHwnd(_window);
3344}
3345
3346#endif // BX_PLATFORM_*
Property changes on: branches/osd/src/lib/bgfx/bgfx.cpp
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/image.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_IMAGE_H_HEADER_GUARD
7#define BGFX_IMAGE_H_HEADER_GUARD
8
9#include <stdint.h>
10
11namespace bgfx
12{
13   struct ImageContainer
14   {
15      void* m_data;
16      uint32_t m_size;
17      uint32_t m_offset;
18      uint32_t m_width;
19      uint32_t m_height;
20      uint32_t m_depth;
21      uint8_t m_format;
22      uint8_t m_numMips;
23      bool m_hasAlpha;
24      bool m_cubeMap;
25      bool m_ktx;
26   };
27
28   struct ImageMip
29   {
30      uint32_t m_width;
31      uint32_t m_height;
32      uint32_t m_blockSize;
33      uint32_t m_size;
34      uint8_t m_bpp;
35      uint8_t m_format;
36      bool m_hasAlpha;
37      const uint8_t* m_data;
38   };
39
40   struct ImageBlockInfo
41   {
42      uint8_t bitsPerPixel;
43      uint8_t blockWidth;
44      uint8_t blockHeight;
45      uint8_t blockSize;
46   };
47
48   ///
49   bool isCompressed(TextureFormat::Enum _format);
50
51   ///
52   bool isColor(TextureFormat::Enum _format);
53
54   ///
55   bool isDepth(TextureFormat::Enum _format);
56
57   ///
58   uint8_t getBitsPerPixel(TextureFormat::Enum _format);
59
60   ///
61   const ImageBlockInfo& getBlockInfo(TextureFormat::Enum _format);
62
63   ///
64   const char* getName(TextureFormat::Enum _format);
65
66   ///
67   void imageSolid(uint32_t _width, uint32_t _height, uint32_t _solid, void* _dst);
68
69   ///
70   void imageCheckerboard(uint32_t _width, uint32_t _height, uint32_t _step, uint32_t _0, uint32_t _1, void* _dst);
71
72   ///
73   void imageRgba8Downsample2x2(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst);
74
75   ///
76   void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst);
77
78   ///
79   void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _srcPitch, const void* _src, void* _dst);
80
81   ///
82   void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip);
83
84   ///
85   bool imageParse(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader);
86
87   ///
88   bool imageParse(ImageContainer& _imageContainer, const void* _data, uint32_t _size);
89
90   ///
91   void imageDecodeToBgra8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint32_t _srcPitch, uint8_t _type);
92
93   ///
94   bool imageGetRawData(const ImageContainer& _dds, uint8_t _side, uint8_t _index, const void* _data, uint32_t _size, ImageMip& _mip);
95
96} // namespace bgfx
97
98#endif // BGFX_IMAGE_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/image.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/renderer_gl.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_RENDERER_GL_H_HEADER_GUARD
7#define BGFX_RENDERER_GL_H_HEADER_GUARD
8
9#define BGFX_USE_EGL (BGFX_CONFIG_RENDERER_OPENGLES && (BX_PLATFORM_ANDROID || BX_PLATFORM_EMSCRIPTEN || BX_PLATFORM_QNX || BX_PLATFORM_WINDOWS) )
10#define BGFX_USE_WGL (BGFX_CONFIG_RENDERER_OPENGL && BX_PLATFORM_WINDOWS)
11#define BGFX_USE_GL_DYNAMIC_LIB (BX_PLATFORM_LINUX || BX_PLATFORM_OSX || BX_PLATFORM_WINDOWS)
12
13#if BGFX_CONFIG_RENDERER_OPENGL
14#   if BGFX_CONFIG_RENDERER_OPENGL >= 31
15#      include <gl/glcorearb.h>
16#      if BX_PLATFORM_OSX
17#         define GL_ARB_shader_objects // OSX collsion with GLhandleARB in gltypes.h
18#      endif // BX_PLATFORM_OSX
19#   else
20#      if BX_PLATFORM_LINUX
21#         define GL_PROTOTYPES
22#         define GL_GLEXT_LEGACY
23#         include <GL/gl.h>
24#         undef GL_PROTOTYPES
25#      elif BX_PLATFORM_OSX
26#         define GL_GLEXT_LEGACY
27#         define long ptrdiff_t
28#         include <OpenGL/gl.h>
29#         undef long
30#         undef GL_VERSION_1_2
31#         undef GL_VERSION_1_3
32#         undef GL_VERSION_1_4
33#         undef GL_VERSION_1_5
34#         undef GL_VERSION_2_0
35#      else
36#         include <GL/gl.h>
37#      endif // BX_PLATFORM_
38
39#      include <gl/glext.h>
40#   endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
41
42#elif BGFX_CONFIG_RENDERER_OPENGLES
43typedef double GLdouble;
44#   if BGFX_CONFIG_RENDERER_OPENGLES < 30
45#      if BX_PLATFORM_IOS
46#         include <OpenGLES/ES2/gl.h>
47#         include <OpenGLES/ES2/glext.h>
48//#define GL_UNSIGNED_INT_10_10_10_2_OES                          0x8DF6
49#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT                      0x8368
50#define GL_TEXTURE_3D_OES                                       0x806F
51#define GL_SAMPLER_3D_OES                                       0x8B5F
52#define GL_TEXTURE_WRAP_R_OES                                   0x8072
53#define GL_PROGRAM_BINARY_LENGTH_OES                            0x8741
54#      else
55#         include <GLES2/gl2platform.h>
56#         include <GLES2/gl2.h>
57#         include <GLES2/gl2ext.h>
58#      endif // BX_PLATFORM_
59typedef int64_t  GLint64;
60typedef uint64_t GLuint64;
61#      define GL_PROGRAM_BINARY_LENGTH GL_PROGRAM_BINARY_LENGTH_OES
62#      define GL_HALF_FLOAT GL_HALF_FLOAT_OES
63#      define GL_RGBA8 GL_RGBA8_OES
64#      define GL_UNSIGNED_INT_2_10_10_10_REV GL_UNSIGNED_INT_2_10_10_10_REV_EXT
65#      define GL_TEXTURE_3D GL_TEXTURE_3D_OES
66#      define GL_SAMPLER_3D GL_SAMPLER_3D_OES
67#      define GL_TEXTURE_WRAP_R GL_TEXTURE_WRAP_R_OES
68#      define GL_MIN GL_MIN_EXT
69#      define GL_MAX GL_MAX_EXT
70#      define GL_DEPTH_COMPONENT24 GL_DEPTH_COMPONENT24_OES
71#      define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
72#      define GL_DEPTH_COMPONENT32 GL_DEPTH_COMPONENT32_OES
73#      define GL_UNSIGNED_INT_24_8 GL_UNSIGNED_INT_24_8_OES
74#   elif BGFX_CONFIG_RENDERER_OPENGLES >= 30
75#      include <GLES3/gl3platform.h>
76#      include <GLES3/gl3.h>
77#      include <GLES3/gl3ext.h>
78#   endif // BGFX_CONFIG_RENDERER_
79
80#   if BGFX_USE_EGL
81#      include "glcontext_egl.h"
82#   endif // BGFX_USE_EGL
83
84#   if BX_PLATFORM_EMSCRIPTEN
85#      include <emscripten/emscripten.h>
86#   endif // BX_PLATFORM_EMSCRIPTEN
87
88#endif // BGFX_CONFIG_RENDERER_OPENGL
89
90#ifndef GL_LUMINANCE
91#   define GL_LUMINANCE 0x1909
92#endif // GL_LUMINANCE
93
94#ifndef GL_BGRA
95#   define GL_BGRA 0x80E1
96#endif // GL_BGRA
97
98#ifndef GL_R8
99#   define GL_R8 0x8229
100#endif // GL_R8
101
102#ifndef GL_R16
103#   define GL_R16 0x822A
104#endif // GL_R16
105
106#ifndef GL_R16F
107#   define GL_R16F 0x822D
108#endif // GL_R16F
109
110#ifndef GL_R32UI
111#   define GL_R32UI 0x8236
112#endif // GL_R32UI
113
114#ifndef GL_R32F
115#   define GL_R32F 0x822E
116#endif // GL_R32F
117
118#ifndef GL_RG8
119#   define GL_RG8 0x822B
120#endif // GL_RG8
121
122#ifndef GL_RG16
123#   define GL_RG16 0x822C
124#endif // GL_RG16
125
126#ifndef GL_RG16F
127#   define GL_RG16F 0x822F
128#endif // GL_RG16F
129
130#ifndef GL_R32UI
131#   define GL_R32UI 0x8236
132#endif // GL_R32UI
133
134#ifndef GL_RG32UI
135#   define GL_RG32UI 0x823C
136#endif // GL_RG32UI
137
138#ifndef GL_RG32F
139#   define GL_RG32F 0x8230
140#endif // GL_RG32F
141
142#ifndef GL_RGBA32UI
143#   define GL_RGBA32UI 0x8D70
144#endif // GL_RGBA32UI
145
146#ifndef GL_RGBA32F
147#   define GL_RGBA32F 0x8814
148#endif // GL_RGBA32F
149
150#ifndef GL_RED
151#   define GL_RED 0x1903
152#endif // GL_RED
153
154#ifndef GL_RED_INTEGER
155#   define GL_RED_INTEGER 0x8D94
156#endif // GL_RED_INTEGER
157
158#ifndef GL_RG
159#   define GL_RG 0x8227
160#endif // GL_RG
161
162#ifndef GL_GREEN
163#   define GL_GREEN 0x1904
164#endif // GL_GREEN
165
166#ifndef GL_BLUE
167#   define GL_BLUE 0x1905
168#endif // GL_BLUE
169
170#ifndef GL_RGBA_INTEGER
171#   define GL_RGBA_INTEGER 0x8D99
172#endif // GL_RGBA_INTEGER
173
174#ifndef GL_RGB10_A2
175#   define GL_RGB10_A2 0x8059
176#endif // GL_RGB10_A2
177
178#ifndef GL_RGBA16
179#   define GL_RGBA16 0x805B
180#endif // GL_RGBA16
181
182#ifndef GL_RGBA16F
183#   define GL_RGBA16F 0x881A
184#endif // GL_RGBA16F
185
186#ifndef GL_R16UI
187#   define GL_R16UI 0x8234
188#endif // GL_R16UI
189
190#ifndef GL_RGBA16UI
191#   define GL_RGBA16UI 0x8D76
192#endif // GL_RGBA16UI
193
194#ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
195#   define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
196#endif // GL_COMPRESSED_RGB_S3TC_DXT1_EXT
197
198#ifndef GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
199#   define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
200#endif // GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
201
202#ifndef GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
203#   define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
204#endif // GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
205
206#ifndef GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
207#   define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
208#endif // GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
209
210#ifndef GL_COMPRESSED_LUMINANCE_LATC1_EXT
211#   define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
212#endif // GL_COMPRESSED_LUMINANCE_LATC1_EXT
213
214#ifndef GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT
215#   define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
216#endif // GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT
217
218#ifndef GL_COMPRESSED_RED_RGTC1
219#   define GL_COMPRESSED_RED_RGTC1 0x8DBB
220#endif // GL_COMPRESSED_RED_RGTC1
221
222#ifndef GL_COMPRESSED_RG_RGTC2
223#   define GL_COMPRESSED_RG_RGTC2 0x8DBD
224#endif // GL_COMPRESSED_RG_RGTC2
225
226#ifndef GL_ETC1_RGB8_OES
227#   define GL_ETC1_RGB8_OES 0x8D64
228#endif // GL_ETC1_RGB8_OES
229
230#ifndef GL_COMPRESSED_RGB8_ETC2
231#   define GL_COMPRESSED_RGB8_ETC2 0x9274
232#endif // GL_COMPRESSED_RGB8_ETC2
233
234#ifndef GL_COMPRESSED_RGBA8_ETC2_EAC
235#   define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
236#endif // GL_COMPRESSED_RGBA8_ETC2_EAC
237
238#ifndef GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
239#   define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
240#endif // GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2
241
242#ifndef GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
243#   define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
244#endif // GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG
245
246#ifndef GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
247#   define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
248#endif // GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
249
250#ifndef GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
251#   define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
252#endif // GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG
253
254#ifndef GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
255#   define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
256#endif // GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG
257
258#ifndef GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG
259#   define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
260#endif // GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG
261
262#ifndef GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG
263#   define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
264#endif // GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG
265
266#ifndef GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
267#   define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
268#endif // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB
269
270#ifndef GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
271#   define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
272#endif // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB
273
274#ifndef GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
275#   define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
276#endif // GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
277
278#ifndef GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
279#   define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
280#endif // GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB
281
282#ifndef GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE
283#   define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
284#endif // GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE
285
286#ifndef GL_TEXTURE_MAX_ANISOTROPY_EXT
287#   define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
288#endif // GL_TEXTURE_MAX_ANISOTROPY_EXT
289
290#ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
291#   define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
292#endif // GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
293
294#ifndef GL_TEXTURE_SWIZZLE_RGBA
295#   define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
296#endif // GL_TEXTURE_SWIZZLE_RGBA
297
298#ifndef GL_MAX_SAMPLES
299#   define GL_MAX_SAMPLES 0x8D57
300#endif // GL_MAX_SAMPLES
301
302#ifndef GL_MAX_COLOR_ATTACHMENTS
303#   define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
304#endif // GL_MAX_COLOR_ATTACHMENTS
305
306#ifndef GL_QUERY_RESULT
307#   define GL_QUERY_RESULT 0x8866
308#endif // GL_QUERY_RESULT
309
310#ifndef GL_READ_FRAMEBUFFER
311#   define GL_READ_FRAMEBUFFER 0x8CA8
312#endif /// GL_READ_FRAMEBUFFER
313
314#ifndef GL_DRAW_FRAMEBUFFER
315#   define GL_DRAW_FRAMEBUFFER 0x8CA9
316#endif // GL_DRAW_FRAMEBUFFER
317
318#ifndef GL_TIME_ELAPSED
319#   define GL_TIME_ELAPSED 0x88BF
320#endif // GL_TIME_ELAPSED
321
322#ifndef GL_VBO_FREE_MEMORY_ATI
323#   define GL_VBO_FREE_MEMORY_ATI 0x87FB
324#endif // GL_VBO_FREE_MEMORY_ATI
325
326#ifndef GL_TEXTURE_FREE_MEMORY_ATI
327#   define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
328#endif // GL_TEXTURE_FREE_MEMORY_ATI
329
330#ifndef GL_RENDERBUFFER_FREE_MEMORY_ATI
331#   define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
332#endif // GL_RENDERBUFFER_FREE_MEMORY_ATI
333
334// http://developer.download.nvidia.com/opengl/specs/GL_NVX_gpu_memory_info.txt
335#ifndef GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX
336#   define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
337#endif // GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX
338
339#ifndef GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX
340#   define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
341#endif // GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX
342
343#ifndef GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX
344#   define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
345#endif // GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX
346
347#ifndef GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX
348#   define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
349#endif // GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX
350
351#ifndef GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX
352#   define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
353#endif // GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX
354
355#ifndef GL_UNPACK_ROW_LENGTH
356#   define GL_UNPACK_ROW_LENGTH 0x0CF2
357#endif // GL_UNPACK_ROW_LENGTH
358
359#ifndef GL_DEPTH_STENCIL
360#   define GL_DEPTH_STENCIL 0x84F9
361#endif // GL_DEPTH_STENCIL
362
363#ifndef GL_DEPTH_COMPONENT32
364#   define GL_DEPTH_COMPONENT32 0x81A7
365#endif // GL_DEPTH_COMPONENT32
366
367#ifndef GL_DEPTH_COMPONENT32F
368#   define GL_DEPTH_COMPONENT32F 0x8CAC
369#endif // GL_DEPTH_COMPONENT32F
370
371#ifndef GL_DEPTH_STENCIL_ATTACHMENT
372#   define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
373#endif // GL_DEPTH_STENCIL_ATTACHMENT
374
375#ifndef GL_TEXTURE_COMPARE_MODE
376#   define GL_TEXTURE_COMPARE_MODE 0x884C
377#endif // GL_TEXTURE_COMPARE_MODE
378
379#ifndef GL_TEXTURE_COMPARE_FUNC
380#   define GL_TEXTURE_COMPARE_FUNC 0x884D
381#endif // GL_TEXTURE_COMPARE_FUNC
382
383#ifndef GL_COMPARE_REF_TO_TEXTURE
384#   define GL_COMPARE_REF_TO_TEXTURE 0x884E
385#endif // GL_COMPARE_REF_TO_TEXTURE
386
387#ifndef GL_SAMPLER_2D_SHADOW
388#   define GL_SAMPLER_2D_SHADOW 0x8B62
389#endif // GL_SAMPLER_2D_SHADOW
390
391#ifndef GL_TEXTURE_MAX_LEVEL
392#   define GL_TEXTURE_MAX_LEVEL 0x813D
393#endif // GL_TEXTURE_MAX_LEVEL
394
395#ifndef GL_COMPUTE_SHADER
396#   define GL_COMPUTE_SHADER 0x91B9
397#endif // GL_COMPUTE_SHADER
398
399#ifndef GL_READ_ONLY
400#   define GL_READ_ONLY 0x88B8
401#endif // GL_READ_ONLY
402
403#ifndef GL_WRITE_ONLY
404#   define GL_WRITE_ONLY 0x88B9
405#endif // GL_WRITE_ONLY
406
407#ifndef GL_READ_WRITE
408#   define GL_READ_WRITE 0x88BA
409#endif // GL_READ_WRITE
410
411#ifndef GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT
412#   define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
413#endif // GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT
414
415#ifndef GL_ELEMENT_ARRAY_BARRIER_BIT
416#   define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002
417#endif // GL_ELEMENT_ARRAY_BARRIER_BIT
418
419#ifndef GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
420#   define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
421#endif // GL_SHADER_IMAGE_ACCESS_BARRIER_BIT
422
423#ifndef GL_SHADER_STORAGE_BARRIER_BIT
424#   define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
425#endif // GL_SHADER_STORAGE_BARRIER_BIT
426
427#ifndef GL_SHADER_STORAGE_BUFFER
428#   define GL_SHADER_STORAGE_BUFFER 0x90D2
429#endif // GL_SHADER_STORAGE_BUFFER
430
431#ifndef GL_IMAGE_1D
432#   define GL_IMAGE_1D 0x904C
433#endif // GL_IMAGE_1D
434
435#ifndef GL_IMAGE_2D
436#   define GL_IMAGE_2D 0x904D
437#endif // GL_IMAGE_2D
438
439#ifndef GL_IMAGE_3D
440#   define GL_IMAGE_3D 0x904E
441#endif // GL_IMAGE_3D
442
443#ifndef GL_IMAGE_CUBE
444#   define GL_IMAGE_CUBE 0x9050
445#endif // GL_IMAGE_CUBE
446
447#ifndef GL_PROGRAM_INPUT
448#   define GL_PROGRAM_INPUT 0x92E3
449#endif // GL_PROGRAM_INPUT
450
451#ifndef GL_ACTIVE_RESOURCES
452#   define GL_ACTIVE_RESOURCES 0x92F5
453#endif // GL_ACTIVE_RESOURCES
454
455#ifndef GL_UNIFORM
456#   define GL_UNIFORM 0x92E1
457#endif // GL_UNIFORM
458
459#ifndef GL_BUFFER_VARIABLE
460#   define GL_BUFFER_VARIABLE 0x92E5
461#endif // GL_BUFFER_VARIABLE
462
463#ifndef GL_UNSIGNED_INT_VEC2
464#   define GL_UNSIGNED_INT_VEC2 0x8DC6
465#endif // GL_UNSIGNED_INT_VEC2
466
467#ifndef GL_UNSIGNED_INT_VEC3
468#   define GL_UNSIGNED_INT_VEC3 0x8DC7
469#endif // GL_UNSIGNED_INT_VEC3
470
471#ifndef GL_UNSIGNED_INT_VEC4
472#   define GL_UNSIGNED_INT_VEC4 0x8DC8
473#endif // GL_UNSIGNED_INT_VEC4
474
475#ifndef GL_TYPE
476#   define GL_TYPE 0x92FA
477#endif // GL_TYPE
478
479#ifndef GL_ARRAY_SIZE
480#   define GL_ARRAY_SIZE 0x92FB
481#endif // GL_ARRAY_SIZE
482
483#ifndef GL_LOCATION
484#   define GL_LOCATION 0x930E
485#endif // GL_LOCATION
486
487#if BX_PLATFORM_NACL
488#   include "glcontext_ppapi.h"
489#elif BX_PLATFORM_WINDOWS
490#   include <windows.h>
491#elif BX_PLATFORM_LINUX
492#   include "glcontext_glx.h"
493#elif BX_PLATFORM_OSX
494#   include "glcontext_nsgl.h"
495#elif BX_PLATFORM_IOS
496#   include "glcontext_eagl.h"
497#endif // BX_PLATFORM_
498
499#if BGFX_USE_WGL
500#   include "glcontext_wgl.h"
501#endif // BGFX_USE_WGL
502
503#ifndef GL_APIENTRY
504#   define GL_APIENTRY APIENTRY
505#endif // GL_APIENTRY
506
507#ifndef GL_APIENTRYP
508#   define GL_APIENTRYP GL_APIENTRY*
509#endif // GL_APIENTRYP
510
511#if !BGFX_CONFIG_RENDERER_OPENGL
512#   define glClearDepth glClearDepthf
513#endif // !BGFX_CONFIG_RENDERER_OPENGL
514
515namespace bgfx
516{
517   class ConstantBuffer;
518   void dumpExtensions(const char* _extensions);
519
520   const char* glEnumName(GLenum _enum);
521
522#define _GL_CHECK(_check, _call) \
523            BX_MACRO_BLOCK_BEGIN \
524               /*BX_TRACE(#_call);*/ \
525               _call; \
526               GLenum err = glGetError(); \
527               _check(0 == err, #_call "; GL error 0x%x: %s", err, glEnumName(err) ); \
528               BX_UNUSED(err); \
529            BX_MACRO_BLOCK_END
530
531#define IGNORE_GL_ERROR_CHECK(...) BX_NOOP()
532
533#if BGFX_CONFIG_DEBUG
534#   define GL_CHECK(_call)   _GL_CHECK(BX_CHECK, _call)
535#   define GL_CHECK_I(_call) _GL_CHECK(IGNORE_GL_ERROR_CHECK, _call)
536#else
537#   define GL_CHECK(_call)   _call
538#   define GL_CHECK_I(_call) _call
539#endif // BGFX_CONFIG_DEBUG
540
541#define GL_IMPORT_TYPEDEFS 1
542#define GL_IMPORT(_optional, _proto, _func, _import) extern _proto _func
543#include "glimports.h"
544
545   class VaoStateCache
546   {
547   public:
548      GLuint add(uint32_t _hash)
549      {
550         invalidate(_hash);
551
552         GLuint arrayId;
553         GL_CHECK(glGenVertexArrays(1, &arrayId) );
554
555         m_hashMap.insert(stl::make_pair(_hash, arrayId) );
556
557         return arrayId;
558      }
559
560      GLuint find(uint32_t _hash)
561      {
562         HashMap::iterator it = m_hashMap.find(_hash);
563         if (it != m_hashMap.end() )
564         {
565            return it->second;
566         }
567
568         return UINT32_MAX;
569      }
570
571      void invalidate(uint32_t _hash)
572      {
573         GL_CHECK(glBindVertexArray(0) );
574
575         HashMap::iterator it = m_hashMap.find(_hash);
576         if (it != m_hashMap.end() )
577         {
578            GL_CHECK(glDeleteVertexArrays(1, &it->second) );
579            m_hashMap.erase(it);
580         }
581      }
582
583      void invalidate()
584      {
585         GL_CHECK(glBindVertexArray(0) );
586
587         for (HashMap::iterator it = m_hashMap.begin(), itEnd = m_hashMap.end(); it != itEnd; ++it)
588         {
589            GL_CHECK(glDeleteVertexArrays(1, &it->second) );
590         }
591         m_hashMap.clear();
592      }
593
594   private:
595      typedef stl::unordered_map<uint32_t, GLuint> HashMap;
596      HashMap m_hashMap;
597   };
598
599   class VaoCacheRef
600   {
601   public:
602      void add(uint32_t _hash)
603      {
604         m_vaoSet.insert(_hash);
605      }
606
607      void invalidate(VaoStateCache& _vaoCache)
608      {
609         for (VaoSet::iterator it = m_vaoSet.begin(), itEnd = m_vaoSet.end(); it != itEnd; ++it)
610         {
611            _vaoCache.invalidate(*it);
612         }
613
614         m_vaoSet.clear();
615      }
616
617      typedef stl::unordered_set<uint32_t> VaoSet;
618      VaoSet m_vaoSet;
619   };
620
621   class SamplerStateCache
622   {
623   public:
624      GLuint add(uint32_t _hash)
625      {
626         invalidate(_hash);
627
628         GLuint samplerId;
629         GL_CHECK(glGenSamplers(1, &samplerId) );
630
631         m_hashMap.insert(stl::make_pair(_hash, samplerId) );
632
633         return samplerId;
634      }
635
636      GLuint find(uint32_t _hash)
637      {
638         HashMap::iterator it = m_hashMap.find(_hash);
639         if (it != m_hashMap.end() )
640         {
641            return it->second;
642         }
643
644         return UINT32_MAX;
645      }
646
647      void invalidate(uint32_t _hash)
648      {
649         HashMap::iterator it = m_hashMap.find(_hash);
650         if (it != m_hashMap.end() )
651         {
652            GL_CHECK(glDeleteSamplers(1, &it->second) );
653            m_hashMap.erase(it);
654         }
655      }
656
657      void invalidate()
658      {
659         for (HashMap::iterator it = m_hashMap.begin(), itEnd = m_hashMap.end(); it != itEnd; ++it)
660         {
661            GL_CHECK(glDeleteSamplers(1, &it->second) );
662         }
663         m_hashMap.clear();
664      }
665
666   private:
667      typedef stl::unordered_map<uint32_t, GLuint> HashMap;
668      HashMap m_hashMap;
669   };
670
671   struct IndexBufferGL
672   {
673      void create(uint32_t _size, void* _data)
674      {
675         m_size = _size;
676
677         GL_CHECK(glGenBuffers(1, &m_id) );
678         BX_CHECK(0 != m_id, "Failed to generate buffer id.");
679         GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_id) );
680         GL_CHECK(glBufferData(GL_ELEMENT_ARRAY_BUFFER
681            , _size
682            , _data
683            , (NULL==_data)?GL_DYNAMIC_DRAW:GL_STATIC_DRAW
684            ) );
685         GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) );
686      }
687
688      void update(uint32_t _offset, uint32_t _size, void* _data)
689      {
690         BX_CHECK(0 != m_id, "Updating invalid index buffer.");
691         GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_id) );
692         GL_CHECK(glBufferSubData(GL_ELEMENT_ARRAY_BUFFER
693            , _offset
694            , _size
695            , _data
696            ) );
697         GL_CHECK(glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0) );
698      }
699
700      void destroy();
701
702      void add(uint32_t _hash)
703      {
704         m_vcref.add(_hash);
705      }
706
707      GLuint m_id;
708      uint32_t m_size;
709      VaoCacheRef m_vcref;
710   };
711
712   struct VertexBufferGL
713   {
714      void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle)
715      {
716         m_size = _size;
717         m_decl = _declHandle;
718
719         GL_CHECK(glGenBuffers(1, &m_id) );
720         BX_CHECK(0 != m_id, "Failed to generate buffer id.");
721         GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, m_id) );
722         GL_CHECK(glBufferData(GL_ARRAY_BUFFER
723            , _size
724            , _data
725            , (NULL==_data)?GL_DYNAMIC_DRAW:GL_STATIC_DRAW
726            ) );
727         GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0) );
728      }
729
730      void update(uint32_t _offset, uint32_t _size, void* _data)
731      {
732         BX_CHECK(0 != m_id, "Updating invalid vertex buffer.");
733         GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, m_id) );
734         GL_CHECK(glBufferSubData(GL_ARRAY_BUFFER
735            , _offset
736            , _size
737            , _data
738            ) );
739         GL_CHECK(glBindBuffer(GL_ARRAY_BUFFER, 0) );
740      }
741
742      void destroy();
743
744      void add(uint32_t _hash)
745      {
746         m_vcref.add(_hash);
747      }
748
749      GLuint m_id;
750      uint32_t m_size;
751      VertexDeclHandle m_decl;
752      VaoCacheRef m_vcref;
753   };
754
755   struct TextureGL
756   {
757      TextureGL()
758         : m_id(0)
759         , m_rbo(0)
760         , m_target(GL_TEXTURE_2D)
761         , m_fmt(GL_ZERO)
762         , m_type(GL_ZERO)
763         , m_flags(0)
764         , m_currentFlags(UINT32_MAX)
765         , m_numMips(0)
766      {
767      }
768
769      bool init(GLenum _target, uint32_t _width, uint32_t _height, uint8_t _format, uint8_t _numMips, uint32_t _flags);
770      void create(const Memory* _mem, uint32_t _flags, uint8_t _skip);
771      void destroy();
772      void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem);
773      void setSamplerState(uint32_t _flags);
774      void commit(uint32_t _stage, uint32_t _flags);
775
776      GLuint m_id;
777      GLuint m_rbo;
778      GLenum m_target;
779      GLenum m_fmt;
780      GLenum m_type;
781      uint32_t m_flags;
782      uint32_t m_currentFlags;
783      uint32_t m_width;
784      uint32_t m_height;
785      uint8_t m_numMips;
786      uint8_t m_requestedFormat;
787      uint8_t m_textureFormat;
788   };
789
790   struct ShaderGL
791   {
792      ShaderGL()
793         : m_id(0)
794         , m_type(0)
795         , m_hash(0)
796      {
797      }
798
799      void create(Memory* _mem);
800      void destroy();
801
802      GLuint m_id;
803      GLenum m_type;
804      uint32_t m_hash;
805   };
806
807   struct FrameBufferGL
808   {
809      FrameBufferGL()
810         : m_num(0)
811      {
812         memset(m_fbo, 0, sizeof(m_fbo) );
813      }
814
815      void create(uint8_t _num, const TextureHandle* _handles);
816      void destroy();
817      void resolve();
818
819      uint8_t m_num;
820      GLuint m_fbo[2];
821      uint32_t m_width;
822      uint32_t m_height;
823   };
824
825   struct ProgramGL
826   {
827      ProgramGL()
828         : m_id(0)
829         , m_constantBuffer(NULL)
830         , m_numPredefined(0)
831      {
832      }
833
834      void create(const ShaderGL& _vsh, const ShaderGL& _fsh);
835      void destroy();
836       void init();
837       void bindAttributes(const VertexDecl& _vertexDecl, uint32_t _baseVertex = 0) const;
838      void bindInstanceData(uint32_t _stride, uint32_t _baseVertex = 0) const;
839
840      void add(uint32_t _hash)
841      {
842         m_vcref.add(_hash);
843      }
844
845      GLuint m_id;
846
847      uint8_t m_used[Attrib::Count+1]; // dense
848      GLint m_attributes[Attrib::Count]; // sparse
849      GLint m_instanceData[BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT];
850
851       GLint m_sampler[BGFX_CONFIG_MAX_TEXTURES];
852       uint8_t m_numSamplers;
853
854      ConstantBuffer* m_constantBuffer;
855      PredefinedUniform m_predefined[PredefinedUniform::Count];
856      uint8_t m_numPredefined;
857      VaoCacheRef m_vcref;
858   };
859
860   struct QueriesGL
861   {
862      void create()
863      {
864         glGenQueries(BX_COUNTOF(m_queries), m_queries);
865      }
866
867      void destroy()
868      {
869         glDeleteQueries(BX_COUNTOF(m_queries), m_queries);
870      }
871
872      void begin(uint16_t _id, GLenum _target) const
873      {
874         glBeginQuery(_target, m_queries[_id]);
875      }
876
877      void end(GLenum _target) const
878      {
879         glEndQuery(_target);
880      }
881
882      uint64_t getResult(uint16_t _id) const
883      {
884         uint64_t result;
885         glGetQueryObjectui64v(m_queries[_id], GL_QUERY_RESULT, &result);
886         return result;
887      }
888
889      GLuint m_queries[64];
890   };
891
892} // namespace bgfx
893
894#endif // BGFX_RENDERER_GL_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/renderer_gl.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/charset.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6static const uint8_t vga8x8[256*8] =
7{
8   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
9   0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81, 0x7e,
10   0x7e, 0xff, 0xdb, 0xff, 0xc3, 0xe7, 0xff, 0x7e,
11   0x6c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00,
12   0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00,
13   0x38, 0x7c, 0x38, 0xfe, 0xfe, 0x92, 0x10, 0x7c,
14   0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x7c,
15   0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00,
16   0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff,
17   0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00,
18   0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff,
19   0x0f, 0x07, 0x0f, 0x7d, 0xcc, 0xcc, 0xcc, 0x78,
20   0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18,
21   0x3f, 0x33, 0x3f, 0x30, 0x30, 0x70, 0xf0, 0xe0,
22   0x7f, 0x63, 0x7f, 0x63, 0x63, 0x67, 0xe6, 0xc0,
23   0x99, 0x5a, 0x3c, 0xe7, 0xe7, 0x3c, 0x5a, 0x99,
24   0x80, 0xe0, 0xf8, 0xfe, 0xf8, 0xe0, 0x80, 0x00,
25   0x02, 0x0e, 0x3e, 0xfe, 0x3e, 0x0e, 0x02, 0x00,
26   0x18, 0x3c, 0x7e, 0x18, 0x18, 0x7e, 0x3c, 0x18,
27   0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00,
28   0x7f, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x00,
29   0x3e, 0x63, 0x38, 0x6c, 0x6c, 0x38, 0x86, 0xfc,
30   0x00, 0x00, 0x00, 0x00, 0x7e, 0x7e, 0x7e, 0x00,
31   0x18, 0x3c, 0x7e, 0x18, 0x7e, 0x3c, 0x18, 0xff,
32   0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00,
33   0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00,
34   0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00,
35   0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00,
36   0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00,
37   0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00,
38   0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00,
39   0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00,
40   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41   0x18, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x18, 0x00,
42   0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00,
43   0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00,
44   0x18, 0x7e, 0xc0, 0x7c, 0x06, 0xfc, 0x18, 0x00,
45   0x00, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x00,
46   0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x00,
47   0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
48   0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00,
49   0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00,
50   0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00,
51   0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00,
52   0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30,
53   0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
54   0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,
55   0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00,
56   0x7c, 0xce, 0xde, 0xf6, 0xe6, 0xc6, 0x7c, 0x00,
57   0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xfc, 0x00,
58   0x78, 0xcc, 0x0c, 0x38, 0x60, 0xcc, 0xfc, 0x00,
59   0x78, 0xcc, 0x0c, 0x38, 0x0c, 0xcc, 0x78, 0x00,
60   0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x1e, 0x00,
61   0xfc, 0xc0, 0xf8, 0x0c, 0x0c, 0xcc, 0x78, 0x00,
62   0x38, 0x60, 0xc0, 0xf8, 0xcc, 0xcc, 0x78, 0x00,
63   0xfc, 0xcc, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x00,
64   0x78, 0xcc, 0xcc, 0x78, 0xcc, 0xcc, 0x78, 0x00,
65   0x78, 0xcc, 0xcc, 0x7c, 0x0c, 0x18, 0x70, 0x00,
66   0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00,
67   0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30,
68   0x18, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x18, 0x00,
69   0x00, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00, 0x00,
70   0x60, 0x30, 0x18, 0x0c, 0x18, 0x30, 0x60, 0x00,
71   0x3c, 0x66, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x00,
72   0x7c, 0xc6, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00,
73   0x30, 0x78, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0x00,
74   0xfc, 0x66, 0x66, 0x7c, 0x66, 0x66, 0xfc, 0x00,
75   0x3c, 0x66, 0xc0, 0xc0, 0xc0, 0x66, 0x3c, 0x00,
76   0xf8, 0x6c, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00,
77   0xfe, 0x62, 0x68, 0x78, 0x68, 0x62, 0xfe, 0x00,
78   0xfe, 0x62, 0x68, 0x78, 0x68, 0x60, 0xf0, 0x00,
79   0x3c, 0x66, 0xc0, 0xc0, 0xce, 0x66, 0x3a, 0x00,
80   0xcc, 0xcc, 0xcc, 0xfc, 0xcc, 0xcc, 0xcc, 0x00,
81   0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
82   0x1e, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78, 0x00,
83   0xe6, 0x66, 0x6c, 0x78, 0x6c, 0x66, 0xe6, 0x00,
84   0xf0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00,
85   0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0x00,
86   0xc6, 0xe6, 0xf6, 0xde, 0xce, 0xc6, 0xc6, 0x00,
87   0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00,
88   0xfc, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00,
89   0x7c, 0xc6, 0xc6, 0xc6, 0xd6, 0x7c, 0x0e, 0x00,
90   0xfc, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0xe6, 0x00,
91   0x7c, 0xc6, 0xe0, 0x78, 0x0e, 0xc6, 0x7c, 0x00,
92   0xfc, 0xb4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
93   0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xfc, 0x00,
94   0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00,
95   0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x00,
96   0xc6, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0xc6, 0x00,
97   0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x30, 0x78, 0x00,
98   0xfe, 0xc6, 0x8c, 0x18, 0x32, 0x66, 0xfe, 0x00,
99   0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00,
100   0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00,
101   0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00,
102   0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
103   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
104   0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
105   0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00,
106   0xe0, 0x60, 0x60, 0x7c, 0x66, 0x66, 0xdc, 0x00,
107   0x00, 0x00, 0x78, 0xcc, 0xc0, 0xcc, 0x78, 0x00,
108   0x1c, 0x0c, 0x0c, 0x7c, 0xcc, 0xcc, 0x76, 0x00,
109   0x00, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00,
110   0x38, 0x6c, 0x64, 0xf0, 0x60, 0x60, 0xf0, 0x00,
111   0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8,
112   0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0xe6, 0x00,
113   0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
114   0x0c, 0x00, 0x1c, 0x0c, 0x0c, 0xcc, 0xcc, 0x78,
115   0xe0, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0xe6, 0x00,
116   0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00,
117   0x00, 0x00, 0xcc, 0xfe, 0xfe, 0xd6, 0xd6, 0x00,
118   0x00, 0x00, 0xb8, 0xcc, 0xcc, 0xcc, 0xcc, 0x00,
119   0x00, 0x00, 0x78, 0xcc, 0xcc, 0xcc, 0x78, 0x00,
120   0x00, 0x00, 0xdc, 0x66, 0x66, 0x7c, 0x60, 0xf0,
121   0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0x1e,
122   0x00, 0x00, 0xdc, 0x76, 0x62, 0x60, 0xf0, 0x00,
123   0x00, 0x00, 0x7c, 0xc0, 0x70, 0x1c, 0xf8, 0x00,
124   0x10, 0x30, 0xfc, 0x30, 0x30, 0x34, 0x18, 0x00,
125   0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00,
126   0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x78, 0x30, 0x00,
127   0x00, 0x00, 0xc6, 0xc6, 0xd6, 0xfe, 0x6c, 0x00,
128   0x00, 0x00, 0xc6, 0x6c, 0x38, 0x6c, 0xc6, 0x00,
129   0x00, 0x00, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8,
130   0x00, 0x00, 0xfc, 0x98, 0x30, 0x64, 0xfc, 0x00,
131   0x1c, 0x30, 0x30, 0xe0, 0x30, 0x30, 0x1c, 0x00,
132   0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00,
133   0xe0, 0x30, 0x30, 0x1c, 0x30, 0x30, 0xe0, 0x00,
134   0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
135   0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0x00,
136   0x7c, 0xc6, 0xc0, 0xc6, 0x7c, 0x0c, 0x06, 0x7c,
137   0x00, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00,
138   0x1c, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00,
139   0x7e, 0x81, 0x3c, 0x06, 0x3e, 0x66, 0x3b, 0x00,
140   0xcc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00,
141   0xe0, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00,
142   0x30, 0x30, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00,
143   0x00, 0x00, 0x7c, 0xc6, 0xc0, 0x78, 0x0c, 0x38,
144   0x7e, 0x81, 0x3c, 0x66, 0x7e, 0x60, 0x3c, 0x00,
145   0xcc, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00,
146   0xe0, 0x00, 0x78, 0xcc, 0xfc, 0xc0, 0x78, 0x00,
147   0xcc, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
148   0x7c, 0x82, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00,
149   0xe0, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
150   0xc6, 0x10, 0x7c, 0xc6, 0xfe, 0xc6, 0xc6, 0x00,
151   0x30, 0x30, 0x00, 0x78, 0xcc, 0xfc, 0xcc, 0x00,
152   0x1c, 0x00, 0xfc, 0x60, 0x78, 0x60, 0xfc, 0x00,
153   0x00, 0x00, 0x7f, 0x0c, 0x7f, 0xcc, 0x7f, 0x00,
154   0x3e, 0x6c, 0xcc, 0xfe, 0xcc, 0xcc, 0xce, 0x00,
155   0x78, 0x84, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00,
156   0x00, 0xcc, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00,
157   0x00, 0xe0, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00,
158   0x78, 0x84, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00,
159   0x00, 0xe0, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00,
160   0x00, 0xcc, 0x00, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8,
161   0xc3, 0x18, 0x3c, 0x66, 0x66, 0x3c, 0x18, 0x00,
162   0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00,
163   0x18, 0x18, 0x7e, 0xc0, 0xc0, 0x7e, 0x18, 0x18,
164   0x38, 0x6c, 0x64, 0xf0, 0x60, 0xe6, 0xfc, 0x00,
165   0xcc, 0xcc, 0x78, 0x30, 0xfc, 0x30, 0xfc, 0x30,
166   0xf8, 0xcc, 0xcc, 0xfa, 0xc6, 0xcf, 0xc6, 0xc3,
167   0x0e, 0x1b, 0x18, 0x3c, 0x18, 0x18, 0xd8, 0x70,
168   0x1c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00,
169   0x38, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00,
170   0x00, 0x1c, 0x00, 0x78, 0xcc, 0xcc, 0x78, 0x00,
171   0x00, 0x1c, 0x00, 0xcc, 0xcc, 0xcc, 0x76, 0x00,
172   0x00, 0xf8, 0x00, 0xb8, 0xcc, 0xcc, 0xcc, 0x00,
173   0xfc, 0x00, 0xcc, 0xec, 0xfc, 0xdc, 0xcc, 0x00,
174   0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00,
175   0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00,
176   0x18, 0x00, 0x18, 0x18, 0x30, 0x66, 0x3c, 0x00,
177   0x00, 0x00, 0x00, 0xfc, 0xc0, 0xc0, 0x00, 0x00,
178   0x00, 0x00, 0x00, 0xfc, 0x0c, 0x0c, 0x00, 0x00,
179   0xc6, 0xcc, 0xd8, 0x36, 0x6b, 0xc2, 0x84, 0x0f,
180   0xc3, 0xc6, 0xcc, 0xdb, 0x37, 0x6d, 0xcf, 0x03,
181   0x18, 0x00, 0x18, 0x18, 0x3c, 0x3c, 0x18, 0x00,
182   0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00,
183   0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00,
184   0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88,
185   0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
186   0xdb, 0xf6, 0xdb, 0x6f, 0xdb, 0x7e, 0xd7, 0xed,
187   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
188   0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18,
189   0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18,
190   0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36,
191   0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36,
192   0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18,
193   0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36,
194   0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
195   0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36,
196   0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00,
197   0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00,
198   0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00,
199   0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18,
200   0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00,
201   0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00,
202   0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18,
203   0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18,
204   0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00,
205   0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18,
206   0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18,
207   0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36,
208   0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00,
209   0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36,
210   0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00,
211   0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36,
212   0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36,
213   0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
214   0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36,
215   0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00,
216   0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00,
217   0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18,
218   0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36,
219   0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00,
220   0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00,
221   0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18,
222   0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36,
223   0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36,
224   0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18,
225   0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00,
226   0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18,
227   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
228   0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff,
229   0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
230   0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
231   0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
232   0x00, 0x00, 0x76, 0xdc, 0xc8, 0xdc, 0x76, 0x00,
233   0x00, 0x78, 0xcc, 0xf8, 0xcc, 0xf8, 0xc0, 0xc0,
234   0x00, 0xfc, 0xcc, 0xc0, 0xc0, 0xc0, 0xc0, 0x00,
235   0x00, 0x00, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x00,
236   0xfc, 0xcc, 0x60, 0x30, 0x60, 0xcc, 0xfc, 0x00,
237   0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0x70, 0x00,
238   0x00, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0xc0,
239   0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x00,
240   0xfc, 0x30, 0x78, 0xcc, 0xcc, 0x78, 0x30, 0xfc,
241   0x38, 0x6c, 0xc6, 0xfe, 0xc6, 0x6c, 0x38, 0x00,
242   0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x6c, 0xee, 0x00,
243   0x1c, 0x30, 0x18, 0x7c, 0xcc, 0xcc, 0x78, 0x00,
244   0x00, 0x00, 0x7e, 0xdb, 0xdb, 0x7e, 0x00, 0x00,
245   0x06, 0x0c, 0x7e, 0xdb, 0xdb, 0x7e, 0x60, 0xc0,
246   0x38, 0x60, 0xc0, 0xf8, 0xc0, 0x60, 0x38, 0x00,
247   0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x00,
248   0x00, 0x7e, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x00,
249   0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x7e, 0x00,
250   0x60, 0x30, 0x18, 0x30, 0x60, 0x00, 0xfc, 0x00,
251   0x18, 0x30, 0x60, 0x30, 0x18, 0x00, 0xfc, 0x00,
252   0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18,
253   0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x70,
254   0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00,
255   0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00,
256   0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
257   0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00,
258   0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
259   0x0f, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c, 0x1c,
260   0x58, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00,
261   0x70, 0x98, 0x30, 0x60, 0xf8, 0x00, 0x00, 0x00,
262   0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00,
263   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
264};
265
266static const uint8_t vga8x16[256*16] =
267{
268   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
269   0x00, 0x00, 0x7e, 0x81, 0xa5, 0x81, 0x81, 0xbd, 0x99, 0x81, 0x81, 0x7e, 0x00, 0x00, 0x00, 0x00,
270   0x00, 0x00, 0x7e, 0xff, 0xdb, 0xff, 0xff, 0xc3, 0xe7, 0xff, 0xff, 0x7e, 0x00, 0x00, 0x00, 0x00,
271   0x00, 0x00, 0x00, 0x00, 0x6c, 0xfe, 0xfe, 0xfe, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
272   0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7c, 0xfe, 0x7c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
273   0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0xe7, 0xe7, 0xe7, 0x99, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
274   0x00, 0x00, 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x7e, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
275   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
276   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe7, 0xc3, 0xc3, 0xe7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
277   0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x42, 0x42, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
278   0xff, 0xff, 0xff, 0xff, 0xff, 0xc3, 0x99, 0xbd, 0xbd, 0x99, 0xc3, 0xff, 0xff, 0xff, 0xff, 0xff,
279   0x00, 0x00, 0x1e, 0x0e, 0x1a, 0x32, 0x78, 0xcc, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
280   0x00, 0x00, 0x3c, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
281   0x00, 0x00, 0x3f, 0x33, 0x3f, 0x30, 0x30, 0x30, 0x30, 0x70, 0xf0, 0xe0, 0x00, 0x00, 0x00, 0x00,
282   0x00, 0x00, 0x7f, 0x63, 0x7f, 0x63, 0x63, 0x63, 0x63, 0x67, 0xe7, 0xe6, 0xc0, 0x00, 0x00, 0x00,
283   0x00, 0x00, 0x00, 0x18, 0x18, 0xdb, 0x3c, 0xe7, 0x3c, 0xdb, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
284   0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfe, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
285   0x00, 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0xfe, 0x3e, 0x1e, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
286   0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
287   0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
288   0x00, 0x00, 0x7f, 0xdb, 0xdb, 0xdb, 0x7b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00, 0x00, 0x00, 0x00,
289   0x00, 0x7c, 0xc6, 0x60, 0x38, 0x6c, 0xc6, 0xc6, 0x6c, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00,
290   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00,
291   0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00,
292   0x00, 0x00, 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
293   0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
294   0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
295   0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
296   0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
297   0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x6c, 0xfe, 0x6c, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
298   0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x38, 0x7c, 0x7c, 0xfe, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
299   0x00, 0x00, 0x00, 0x00, 0xfe, 0xfe, 0x7c, 0x7c, 0x38, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
300   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
301   0x00, 0x00, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
302   0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
303   0x00, 0x00, 0x00, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x6c, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
304   0x18, 0x18, 0x7c, 0xc6, 0xc2, 0xc0, 0x7c, 0x06, 0x86, 0xc6, 0x7c, 0x18, 0x18, 0x00, 0x00, 0x00,
305   0x00, 0x00, 0x00, 0x00, 0xc2, 0xc6, 0x0c, 0x18, 0x30, 0x60, 0xc6, 0x86, 0x00, 0x00, 0x00, 0x00,
306   0x00, 0x00, 0x38, 0x6c, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
307   0x00, 0x30, 0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
308   0x00, 0x00, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00,
309   0x00, 0x00, 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
310   0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
311   0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
312   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00,
313   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
314   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
315   0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0x80, 0x00, 0x00, 0x00, 0x00,
316   0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xce, 0xd6, 0xd6, 0xe6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
317   0x00, 0x00, 0x18, 0x38, 0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
318   0x00, 0x00, 0x7c, 0xc6, 0x06, 0x0c, 0x18, 0x30, 0x60, 0xc0, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
319   0x00, 0x00, 0x7c, 0xc6, 0x06, 0x06, 0x3c, 0x06, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
320   0x00, 0x00, 0x0c, 0x1c, 0x3c, 0x6c, 0xcc, 0xfe, 0x0c, 0x0c, 0x0c, 0x1e, 0x00, 0x00, 0x00, 0x00,
321   0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xfc, 0x0e, 0x06, 0x06, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
322   0x00, 0x00, 0x38, 0x60, 0xc0, 0xc0, 0xfc, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
323   0x00, 0x00, 0xfe, 0xc6, 0x06, 0x06, 0x0c, 0x18, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00,
324   0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
325   0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x06, 0x06, 0x0c, 0x78, 0x00, 0x00, 0x00, 0x00,
326   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
327   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00,
328   0x00, 0x00, 0x00, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x00, 0x00, 0x00, 0x00,
329   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
330   0x00, 0x00, 0x00, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00,
331   0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x0c, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
332   0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xde, 0xde, 0xde, 0xdc, 0xc0, 0x7c, 0x00, 0x00, 0x00, 0x00,
333   0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
334   0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x66, 0x66, 0x66, 0x66, 0xfc, 0x00, 0x00, 0x00, 0x00,
335   0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
336   0x00, 0x00, 0xf8, 0x6c, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x6c, 0xf8, 0x00, 0x00, 0x00, 0x00,
337   0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
338   0x00, 0x00, 0xfe, 0x66, 0x62, 0x68, 0x78, 0x68, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
339   0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xde, 0xc6, 0xc6, 0x66, 0x3a, 0x00, 0x00, 0x00, 0x00,
340   0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
341   0x00, 0x00, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
342   0x00, 0x00, 0x1e, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xcc, 0xcc, 0xcc, 0x78, 0x00, 0x00, 0x00, 0x00,
343   0x00, 0x00, 0xe6, 0x66, 0x6c, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
344   0x00, 0x00, 0xf0, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x62, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
345   0x00, 0x00, 0xc6, 0xee, 0xfe, 0xfe, 0xd6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
346   0x00, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
347   0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
348   0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
349   0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xde, 0x7c, 0x0c, 0x0e, 0x00, 0x00,
350   0x00, 0x00, 0xfc, 0x66, 0x66, 0x66, 0x7c, 0x6c, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
351   0x00, 0x00, 0x7c, 0xc6, 0xc6, 0x60, 0x38, 0x0c, 0x06, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
352   0x00, 0x00, 0x7e, 0x7e, 0x5a, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
353   0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
354   0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
355   0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xfe, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
356   0x00, 0x00, 0xc6, 0xc6, 0x6c, 0x6c, 0x38, 0x38, 0x6c, 0x6c, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
357   0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
358   0x00, 0x00, 0xfe, 0xc6, 0x86, 0x0c, 0x18, 0x30, 0x60, 0xc2, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
359   0x00, 0x00, 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00, 0x00, 0x00, 0x00,
360   0x00, 0x00, 0x00, 0x80, 0xc0, 0xe0, 0x70, 0x38, 0x1c, 0x0e, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00,
361   0x00, 0x00, 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00, 0x00, 0x00, 0x00,
362   0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
363   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
364   0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
365   0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
366   0x00, 0x00, 0xe0, 0x60, 0x60, 0x78, 0x6c, 0x66, 0x66, 0x66, 0x66, 0xdc, 0x00, 0x00, 0x00, 0x00,
367   0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
368   0x00, 0x00, 0x1c, 0x0c, 0x0c, 0x3c, 0x6c, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
369   0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
370   0x00, 0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
371   0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0xcc, 0x78, 0x00,
372   0x00, 0x00, 0xe0, 0x60, 0x60, 0x6c, 0x76, 0x66, 0x66, 0x66, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
373   0x00, 0x00, 0x18, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
374   0x00, 0x00, 0x06, 0x06, 0x00, 0x0e, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c, 0x00,
375   0x00, 0x00, 0xe0, 0x60, 0x60, 0x66, 0x6c, 0x78, 0x78, 0x6c, 0x66, 0xe6, 0x00, 0x00, 0x00, 0x00,
376   0x00, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
377   0x00, 0x00, 0x00, 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0xd6, 0xd6, 0x00, 0x00, 0x00, 0x00,
378   0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
379   0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
380   0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xf0, 0x00,
381   0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x7c, 0x0c, 0x0c, 0x1e, 0x00,
382   0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x76, 0x62, 0x60, 0x60, 0x60, 0xf0, 0x00, 0x00, 0x00, 0x00,
383   0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0xc6, 0x60, 0x38, 0x0c, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
384   0x00, 0x00, 0x10, 0x30, 0x30, 0xfc, 0x30, 0x30, 0x30, 0x30, 0x36, 0x1c, 0x00, 0x00, 0x00, 0x00,
385   0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
386   0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
387   0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xd6, 0xd6, 0xfe, 0x6c, 0x00, 0x00, 0x00, 0x00,
388   0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0x6c, 0x38, 0x38, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00,
389   0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0xf8, 0x00,
390   0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xcc, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
391   0x00, 0x00, 0x0e, 0x18, 0x18, 0x18, 0x70, 0x18, 0x18, 0x18, 0x18, 0x0e, 0x00, 0x00, 0x00, 0x00,
392   0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
393   0x00, 0x00, 0x70, 0x18, 0x18, 0x18, 0x0e, 0x18, 0x18, 0x18, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00,
394   0x00, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
395   0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
396   0x00, 0x00, 0x3c, 0x66, 0xc2, 0xc0, 0xc0, 0xc0, 0xc2, 0x66, 0x3c, 0x0c, 0x06, 0x7c, 0x00, 0x00,
397   0x00, 0x00, 0xcc, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
398   0x00, 0x0c, 0x18, 0x30, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
399   0x00, 0x10, 0x38, 0x6c, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
400   0x00, 0x00, 0xcc, 0xcc, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
401   0x00, 0x60, 0x30, 0x18, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
402   0x00, 0x38, 0x6c, 0x38, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
403   0x00, 0x00, 0x00, 0x00, 0x3c, 0x66, 0x60, 0x60, 0x66, 0x3c, 0x0c, 0x06, 0x3c, 0x00, 0x00, 0x00,
404   0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
405   0x00, 0x00, 0xc6, 0xc6, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
406   0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0xc0, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
407   0x00, 0x00, 0x66, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
408   0x00, 0x18, 0x3c, 0x66, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
409   0x00, 0x60, 0x30, 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
410   0x00, 0xc6, 0xc6, 0x10, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
411   0x38, 0x6c, 0x38, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
412   0x18, 0x30, 0x60, 0x00, 0xfe, 0x66, 0x60, 0x7c, 0x60, 0x60, 0x66, 0xfe, 0x00, 0x00, 0x00, 0x00,
413   0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x76, 0x36, 0x7e, 0xd8, 0xd8, 0x6e, 0x00, 0x00, 0x00, 0x00,
414   0x00, 0x00, 0x3e, 0x6c, 0xcc, 0xcc, 0xfe, 0xcc, 0xcc, 0xcc, 0xcc, 0xce, 0x00, 0x00, 0x00, 0x00,
415   0x00, 0x10, 0x38, 0x6c, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
416   0x00, 0x00, 0xc6, 0xc6, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
417   0x00, 0x60, 0x30, 0x18, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
418   0x00, 0x30, 0x78, 0xcc, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
419   0x00, 0x60, 0x30, 0x18, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
420   0x00, 0x00, 0xc6, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7e, 0x06, 0x0c, 0x78, 0x00,
421   0x00, 0xc6, 0xc6, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
422   0x00, 0xc6, 0xc6, 0x00, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
423   0x00, 0x18, 0x18, 0x3c, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3c, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
424   0x00, 0x38, 0x6c, 0x64, 0x60, 0xf0, 0x60, 0x60, 0x60, 0x60, 0xe6, 0xfc, 0x00, 0x00, 0x00, 0x00,
425   0x00, 0x00, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
426   0x00, 0xf8, 0xcc, 0xcc, 0xf8, 0xc4, 0xcc, 0xde, 0xcc, 0xcc, 0xcc, 0xc6, 0x00, 0x00, 0x00, 0x00,
427   0x00, 0x0e, 0x1b, 0x18, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0x70, 0x00, 0x00,
428   0x00, 0x18, 0x30, 0x60, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
429   0x00, 0x0c, 0x18, 0x30, 0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00, 0x00, 0x00, 0x00,
430   0x00, 0x18, 0x30, 0x60, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
431   0x00, 0x18, 0x30, 0x60, 0x00, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x76, 0x00, 0x00, 0x00, 0x00,
432   0x00, 0x00, 0x76, 0xdc, 0x00, 0xdc, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00,
433   0x76, 0xdc, 0x00, 0xc6, 0xe6, 0xf6, 0xfe, 0xde, 0xce, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
434   0x00, 0x3c, 0x6c, 0x6c, 0x3e, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
435   0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
436   0x00, 0x00, 0x30, 0x30, 0x00, 0x30, 0x30, 0x60, 0xc0, 0xc6, 0xc6, 0x7c, 0x00, 0x00, 0x00, 0x00,
437   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00,
438   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00,
439   0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x60, 0xce, 0x93, 0x06, 0x0c, 0x1f, 0x00, 0x00,
440   0x00, 0xc0, 0xc0, 0xc2, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xce, 0x9a, 0x3f, 0x06, 0x0f, 0x00, 0x00,
441   0x00, 0x00, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x3c, 0x3c, 0x3c, 0x18, 0x00, 0x00, 0x00, 0x00,
442   0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
443   0x00, 0x00, 0x00, 0x00, 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
444   0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44, 0x11, 0x44,
445   0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa,
446   0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77,
447   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
448   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
449   0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
450   0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
451   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
452   0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
453   0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
454   0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
455   0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
456   0x36, 0x36, 0x36, 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
457   0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
458   0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
459   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
460   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
461   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
462   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
463   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
464   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
465   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
466   0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
467   0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
468   0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
469   0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
470   0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
471   0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
472   0x36, 0x36, 0x36, 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
473   0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
474   0x36, 0x36, 0x36, 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
475   0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
476   0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
477   0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
478   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
479   0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
480   0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
481   0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
482   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
483   0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36,
484   0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
485   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
486   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
487   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
488   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
489   0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0,
490   0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f,
491   0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
492   0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0xd8, 0xd8, 0xd8, 0xdc, 0x76, 0x00, 0x00, 0x00, 0x00,
493   0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xc6, 0xfc, 0xc6, 0xc6, 0xfc, 0xc0, 0xc0, 0xc0, 0x00, 0x00,
494   0x00, 0x00, 0xfe, 0xc6, 0xc6, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00,
495   0x00, 0x00, 0x00, 0x00, 0x80, 0xfe, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00,
496   0x00, 0x00, 0x00, 0xfe, 0xc6, 0x60, 0x30, 0x18, 0x30, 0x60, 0xc6, 0xfe, 0x00, 0x00, 0x00, 0x00,
497   0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xd8, 0xd8, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00,
498   0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x7c, 0x60, 0x60, 0xc0, 0x00, 0x00, 0x00,
499   0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00,
500   0x00, 0x00, 0x00, 0x7e, 0x18, 0x3c, 0x66, 0x66, 0x66, 0x3c, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00,
501   0x00, 0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xfe, 0xc6, 0xc6, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00,
502   0x00, 0x00, 0x38, 0x6c, 0xc6, 0xc6, 0xc6, 0x6c, 0x6c, 0x6c, 0x6c, 0xee, 0x00, 0x00, 0x00, 0x00,
503   0x00, 0x00, 0x1e, 0x30, 0x18, 0x0c, 0x3e, 0x66, 0x66, 0x66, 0x66, 0x3c, 0x00, 0x00, 0x00, 0x00,
504   0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xdb, 0xdb, 0xdb, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
505   0x00, 0x00, 0x00, 0x03, 0x06, 0x7e, 0xcf, 0xdb, 0xf3, 0x7e, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00,
506   0x00, 0x00, 0x1c, 0x30, 0x60, 0x60, 0x7c, 0x60, 0x60, 0x60, 0x30, 0x1c, 0x00, 0x00, 0x00, 0x00,
507   0x00, 0x00, 0x00, 0x7c, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0x00, 0x00, 0x00, 0x00,
508   0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00,
509   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
510   0x00, 0x00, 0x00, 0x30, 0x18, 0x0c, 0x06, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
511   0x00, 0x00, 0x00, 0x0c, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00,
512   0x00, 0x00, 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,
513   0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0xd8, 0x70, 0x00, 0x00, 0x00, 0x00,
514   0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
515   0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
516   0x00, 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
517   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
518   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
519   0x00, 0x0f, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x6c, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00,
520   0x00, 0xd8, 0x6c, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
521   0x00, 0x70, 0x98, 0x30, 0x60, 0xc8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
522   0x00, 0x00, 0x00, 0x00, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00,
523   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
524};
525
526#include "vs_debugfont.bin.h"
527#include "fs_debugfont.bin.h"
528
529#include "vs_clear.bin.h"
530#include "fs_clear0.bin.h"
531#include "fs_clear1.bin.h"
532#include "fs_clear2.bin.h"
533#include "fs_clear3.bin.h"
Property changes on: branches/osd/src/lib/bgfx/charset.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/renderer_d3d9.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_RENDERER_D3D9_H_HEADER_GUARD
7#define BGFX_RENDERER_D3D9_H_HEADER_GUARD
8
9#define BGFX_CONFIG_RENDERER_DIRECT3D9EX (BX_PLATFORM_WINDOWS && 0)
10
11#if BX_PLATFORM_WINDOWS
12#   if !BGFX_CONFIG_RENDERER_DIRECT3D9EX
13#      define D3D_DISABLE_9EX
14#   endif // !BGFX_CONFIG_RENDERER_DIRECT3D9EX
15#   include <d3d9.h>
16
17#   if BGFX_CONFIG_RENDERER_DIRECT3D9EX
18typedef HRESULT (WINAPI *Direct3DCreate9ExFn)(UINT SDKVersion, IDirect3D9Ex**);
19#   endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX
20typedef IDirect3D9* (WINAPI *Direct3DCreate9Fn)(UINT SDKVersion);
21
22#elif BX_PLATFORM_XBOX360
23#   include <xgraphics.h>
24#   define D3DUSAGE_DYNAMIC 0 // not supported on X360
25#   define D3DLOCK_DISCARD 0 // not supported on X360
26#   define D3DERR_DEVICEHUNG D3DERR_DEVICELOST // not supported on X360
27#   define D3DERR_DEVICEREMOVED D3DERR_DEVICELOST // not supported on X360
28#   define D3DMULTISAMPLE_8_SAMPLES D3DMULTISAMPLE_4_SAMPLES
29#   define D3DMULTISAMPLE_16_SAMPLES D3DMULTISAMPLE_4_SAMPLES
30
31#   define D3DFMT_DF24 D3DFMT_D24FS8
32
33#   define _PIX_SETMARKER(_col, _name) BX_NOOP()
34#   define _PIX_BEGINEVENT(_col, _name) BX_NOOP()
35#   define _PIX_ENDEVENT() BX_NOOP
36#endif // BX_PLATFORM_
37
38#ifndef D3DSTREAMSOURCE_INDEXEDDATA
39#   define D3DSTREAMSOURCE_INDEXEDDATA  (1<<30)
40#endif// D3DSTREAMSOURCE_INDEXEDDATA
41
42#ifndef D3DSTREAMSOURCE_INSTANCEDATA
43#   define D3DSTREAMSOURCE_INSTANCEDATA (2<<30)
44#endif // D3DSTREAMSOURCE_INSTANCEDATA
45
46#include "renderer_d3d.h"
47
48namespace bgfx
49{
50#   if defined(D3D_DISABLE_9EX)
51#      define D3DFMT_S8_LOCKABLE D3DFORMAT( 85)
52#      define D3DFMT_A1          D3DFORMAT(118)
53#   endif // defined(D3D_DISABLE_9EX)
54
55#   ifndef D3DFMT_ATI1
56#      define D3DFMT_ATI1 ( (D3DFORMAT)BX_MAKEFOURCC('A', 'T', 'I', '1') )
57#   endif // D3DFMT_ATI1
58
59#   ifndef D3DFMT_ATI2
60#      define D3DFMT_ATI2 ( (D3DFORMAT)BX_MAKEFOURCC('A', 'T', 'I', '2') )
61#   endif // D3DFMT_ATI2
62
63#   ifndef D3DFMT_ATOC
64#      define D3DFMT_ATOC ( (D3DFORMAT)BX_MAKEFOURCC('A', 'T', 'O', 'C') )
65#   endif // D3DFMT_ATOC
66
67#   ifndef D3DFMT_DF16
68#      define D3DFMT_DF16 ( (D3DFORMAT)BX_MAKEFOURCC('D', 'F', '1', '6') )
69#   endif // D3DFMT_DF16
70
71#   ifndef D3DFMT_DF24
72#      define D3DFMT_DF24 ( (D3DFORMAT)BX_MAKEFOURCC('D', 'F', '2', '4') )
73#   endif // D3DFMT_DF24
74
75#   ifndef D3DFMT_INST
76#      define D3DFMT_INST ( (D3DFORMAT)BX_MAKEFOURCC('I', 'N', 'S', 'T') )
77#   endif // D3DFMT_INST
78
79#   ifndef D3DFMT_INTZ
80#      define D3DFMT_INTZ ( (D3DFORMAT)BX_MAKEFOURCC('I', 'N', 'T', 'Z') )
81#   endif // D3DFMT_INTZ
82
83#   ifndef D3DFMT_NULL
84#      define D3DFMT_NULL ( (D3DFORMAT)BX_MAKEFOURCC('N', 'U', 'L', 'L') )
85#   endif // D3DFMT_NULL
86
87#   ifndef D3DFMT_RESZ
88#      define D3DFMT_RESZ ( (D3DFORMAT)BX_MAKEFOURCC('R', 'E', 'S', 'Z') )
89#   endif // D3DFMT_RESZ
90
91#   ifndef D3DFMT_RAWZ
92#      define D3DFMT_RAWZ ( (D3DFORMAT)BX_MAKEFOURCC('R', 'A', 'W', 'Z') )
93#   endif // D3DFMT_RAWZ
94
95   struct ExtendedFormat
96   {
97      enum Enum
98      {
99         Ati1,
100         Ati2,
101         Df16,
102         Df24,
103         Inst,
104         Intz,
105         Null,
106         Resz,
107         Rawz,
108
109         Count,
110      };
111
112      D3DFORMAT m_fmt;
113      DWORD m_usage;
114      D3DRESOURCETYPE m_type;
115      bool m_supported;
116   };
117
118   struct Msaa
119   {
120      D3DMULTISAMPLE_TYPE m_type;
121      DWORD m_quality;
122   };
123
124   struct IndexBufferD3D9
125   {
126      IndexBufferD3D9()
127         : m_ptr(NULL)
128         , m_dynamic(false)
129      {
130      }
131
132      void create(uint32_t _size, void* _data);
133      void update(uint32_t _offset, uint32_t _size, void* _data, bool _discard = false)
134      {
135         void* buffer;
136         DX_CHECK(m_ptr->Lock(_offset
137            , _size
138            , &buffer
139            , _discard || (m_dynamic && 0 == _offset && m_size == _size) ? D3DLOCK_DISCARD : 0
140            ) );
141
142         memcpy(buffer, _data, _size);
143
144         m_ptr->Unlock();
145      }
146
147      void destroy()
148      {
149         if (NULL != m_ptr)
150         {
151            DX_RELEASE(m_ptr, 0);
152            m_dynamic = false;
153         }
154      }
155
156      void preReset();
157      void postReset();
158
159      IDirect3DIndexBuffer9* m_ptr;
160      uint32_t m_size;
161      bool m_dynamic;
162   };
163
164   struct VertexBufferD3D9
165   {
166      VertexBufferD3D9()
167         : m_ptr(NULL)
168         , m_dynamic(false)
169      {
170      }
171
172      void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle);
173      void update(uint32_t _offset, uint32_t _size, void* _data, bool _discard = false)
174      {
175         void* buffer;
176         DX_CHECK(m_ptr->Lock(_offset
177            , _size
178            , &buffer
179            , _discard || (m_dynamic && 0 == _offset && m_size == _size) ? D3DLOCK_DISCARD : 0
180            ) );
181
182         memcpy(buffer, _data, _size);
183
184         m_ptr->Unlock();
185      }
186
187      void destroy()
188      {
189         if (NULL != m_ptr)
190         {
191            DX_RELEASE(m_ptr, 0);
192            m_dynamic = false;
193         }
194      }
195
196      void preReset();
197      void postReset();
198
199      IDirect3DVertexBuffer9* m_ptr;
200      uint32_t m_size;
201      VertexDeclHandle m_decl;
202      bool m_dynamic;
203   };
204
205   struct VertexDeclaration
206   {
207      VertexDeclaration()
208         : m_ptr(NULL)
209      {
210      }
211
212      void create(const VertexDecl& _decl);
213
214      void destroy()
215      {
216         DX_RELEASE(m_ptr, 0);
217      }
218
219      IDirect3DVertexDeclaration9* m_ptr;
220      VertexDecl m_decl;
221   };
222
223   struct ShaderD3D9
224   {
225      ShaderD3D9()
226         : m_vertexShader(NULL)
227         , m_constantBuffer(NULL)
228         , m_numPredefined(0)
229         , m_type(0)
230      {
231      }
232
233      void create(const Memory* _mem);
234      DWORD* getShaderCode(uint8_t _fragmentBit, const Memory* _mem);
235
236      void destroy()
237      {
238         if (NULL != m_constantBuffer)
239         {
240            ConstantBuffer::destroy(m_constantBuffer);
241            m_constantBuffer = NULL;
242         }
243         m_numPredefined = 0;
244
245         switch (m_type)
246         {
247         case 0:  DX_RELEASE(m_vertexShader, 0);
248         default: DX_RELEASE(m_pixelShader,  0);
249         }
250      }
251
252      union
253      {
254         // X360 doesn't have interface inheritance (can't use IUnknown*).
255         IDirect3DVertexShader9* m_vertexShader;
256         IDirect3DPixelShader9*  m_pixelShader;
257      };
258      ConstantBuffer* m_constantBuffer;
259      PredefinedUniform m_predefined[PredefinedUniform::Count];
260      uint8_t m_numPredefined;
261      uint8_t m_type;
262   };
263
264   struct ProgramD3D9
265   {
266      void create(const ShaderD3D9& _vsh, const ShaderD3D9& _fsh)
267      {
268         BX_CHECK(NULL != _vsh.m_vertexShader, "Vertex shader doesn't exist.");
269         m_vsh = &_vsh;
270
271         BX_CHECK(NULL != _fsh.m_pixelShader, "Fragment shader doesn't exist.");
272         m_fsh = &_fsh;
273
274         memcpy(&m_predefined[0], _vsh.m_predefined, _vsh.m_numPredefined*sizeof(PredefinedUniform) );
275         memcpy(&m_predefined[_vsh.m_numPredefined], _fsh.m_predefined, _fsh.m_numPredefined*sizeof(PredefinedUniform) );
276         m_numPredefined = _vsh.m_numPredefined + _fsh.m_numPredefined;
277      }
278
279      void destroy()
280      {
281         m_numPredefined = 0;
282         m_vsh = NULL;
283         m_fsh = NULL;
284      }
285
286      const ShaderD3D9* m_vsh;
287      const ShaderD3D9* m_fsh;
288
289      PredefinedUniform m_predefined[PredefinedUniform::Count*2];
290      uint8_t m_numPredefined;
291   };
292
293   struct TextureD3D9
294   {
295      enum Enum
296      {
297         Texture2D,
298         Texture3D,
299         TextureCube,
300      };
301
302      TextureD3D9()
303         : m_ptr(NULL)
304         , m_surface(NULL)
305         , m_textureFormat(TextureFormat::Unknown)
306      {
307      }
308
309      void createTexture(uint32_t _width, uint32_t _height, uint8_t _numMips);
310      void createVolumeTexture(uint32_t _width, uint32_t _height, uint32_t _depth, uint32_t _numMips);
311      void createCubeTexture(uint32_t _edge, uint32_t _numMips);
312
313      uint8_t* lock(uint8_t _side, uint8_t _lod, uint32_t& _pitch, uint32_t& _slicePitch, const Rect* _rect = NULL);
314      void unlock(uint8_t _side, uint8_t _lod);
315      void dirty(uint8_t _side, const Rect& _rect, uint16_t _z, uint16_t _depth);
316
317      void create(const Memory* _mem, uint32_t _flags, uint8_t _skip);
318
319      void destroy()
320      {
321         DX_RELEASE(m_ptr, 0);
322         DX_RELEASE(m_surface, 0);
323         m_textureFormat = TextureFormat::Unknown;
324      }
325
326      void updateBegin(uint8_t _side, uint8_t _mip);
327      void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem);
328      void updateEnd();
329      void commit(uint8_t _stage, uint32_t _flags = BGFX_SAMPLER_DEFAULT_FLAGS);
330      void resolve() const;
331
332      void preReset();
333      void postReset();
334   
335      union
336      {
337         IDirect3DBaseTexture9*   m_ptr;
338         IDirect3DTexture9*       m_texture2d;
339         IDirect3DVolumeTexture9* m_texture3d;
340         IDirect3DCubeTexture9*   m_textureCube;
341      };
342
343      IDirect3DSurface9* m_surface;
344      uint32_t m_flags;
345      uint16_t m_width;
346      uint16_t m_height;
347      uint8_t m_numMips;
348      uint8_t m_type;
349      uint8_t m_requestedFormat;
350      uint8_t m_textureFormat;
351   };
352
353   struct FrameBufferD3D9
354   {
355      FrameBufferD3D9()
356         : m_num(0)
357         , m_needResolve(0)
358      {
359         m_depthHandle.idx = invalidHandle;
360      }
361
362      void create(uint8_t _num, const TextureHandle* _handles);
363      void destroy();
364      void resolve() const;
365      void preReset();
366      void postReset();
367      void createNullColorRT();
368
369      IDirect3DSurface9* m_color[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1];
370      IDirect3DSurface9* m_depthStencil;
371      TextureHandle m_colorHandle[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1];
372      TextureHandle m_depthHandle;
373      uint8_t m_num;
374      bool m_needResolve;
375   };
376
377} // namespace bgfx
378
379#endif // BGFX_RENDERER_D3D9_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/renderer_d3d9.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/include/bgfx.c99.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
4 *
5 * vim: set tabstop=4 expandtab:
6 */
7
8#ifndef BGFX_C99_H_HEADER_GUARD
9#define BGFX_C99_H_HEADER_GUARD
10
11#include <stdbool.h> // bool
12#include <stdint.h>  // uint32_t
13#include <stdlib.h>  // size_t
14
15#include "bgfxdefines.h"
16
17typedef enum bgfx_renderer_type
18{
19    BGFX_RENDERER_TYPE_NULL,
20    BGFX_RENDERER_TYPE_DIRECT3D9,
21    BGFX_RENDERER_TYPE_DIRECT3D11,
22    BGFX_RENDERER_TYPE_OPENGLES,
23    BGFX_RENDERER_TYPE_OPENGL,
24
25    BGFX_RENDERER_TYPE_COUNT
26
27} bgfx_renderer_type_t;
28
29typedef enum bgfx_access
30{
31   BGFX_ACCESS_READ,
32   BGFX_ACCESS_WRITE,
33   BGFX_ACCESS_READWRITE,
34
35   BGFX_ACCESS_COUNT
36
37} bgfx_access_t;
38
39typedef enum bgfx_attrib
40{
41    BGFX_ATTRIB_POSITION,
42    BGFX_ATTRIB_NORMAL,
43    BGFX_ATTRIB_TANGENT,
44    BGFX_ATTRIB_BITANGENT,
45    BGFX_ATTRIB_COLOR0,
46    BGFX_ATTRIB_COLOR1,
47    BGFX_ATTRIB_INDICES,
48    BGFX_ATTRIB_WEIGHT,
49    BGFX_ATTRIB_TEXCOORD0,
50    BGFX_ATTRIB_TEXCOORD1,
51    BGFX_ATTRIB_TEXCOORD2,
52    BGFX_ATTRIB_TEXCOORD3,
53    BGFX_ATTRIB_TEXCOORD4,
54    BGFX_ATTRIB_TEXCOORD5,
55    BGFX_ATTRIB_TEXCOORD6,
56    BGFX_ATTRIB_TEXCOORD7,
57
58    BGFX_ATTRIB_COUNT
59
60} bgfx_attrib_t;
61
62typedef enum bgfx_attrib_type
63{
64    BGFX_ATTRIB_TYPE_UINT8,
65    BGFX_ATTRIB_TYPE_INT16,
66    BGFX_ATTRIB_TYPE_HALF,
67    BGFX_ATTRIB_TYPE_FLOAT,
68
69    BGFX_ATTRIB_TYPE_COUNT
70
71} bgfx_attrib_type_t;
72
73typedef enum bgfx_texture_format
74{
75    BGFX_TEXTURE_FORMAT_BC1,
76    BGFX_TEXTURE_FORMAT_BC2,
77    BGFX_TEXTURE_FORMAT_BC3,
78    BGFX_TEXTURE_FORMAT_BC4,
79    BGFX_TEXTURE_FORMAT_BC5,
80    BGFX_TEXTURE_FORMAT_BC6H,
81    BGFX_TEXTURE_FORMAT_BC7,
82    BGFX_TEXTURE_FORMAT_ETC1,
83    BGFX_TEXTURE_FORMAT_ETC2,
84    BGFX_TEXTURE_FORMAT_ETC2A,
85    BGFX_TEXTURE_FORMAT_ETC2A1,
86    BGFX_TEXTURE_FORMAT_PTC12,
87    BGFX_TEXTURE_FORMAT_PTC14,
88    BGFX_TEXTURE_FORMAT_PTC12A,
89    BGFX_TEXTURE_FORMAT_PTC14A,
90    BGFX_TEXTURE_FORMAT_PTC22,
91    BGFX_TEXTURE_FORMAT_PTC24,
92
93    BGFX_TEXTURE_FORMAT_UNKNOWN,
94
95    BGFX_TEXTURE_FORMAT_R1,
96    BGFX_TEXTURE_FORMAT_R8,
97    BGFX_TEXTURE_FORMAT_R16,
98    BGFX_TEXTURE_FORMAT_R16F,
99    BGFX_TEXTURE_FORMAT_R32,
100    BGFX_TEXTURE_FORMAT_R32F,
101    BGFX_TEXTURE_FORMAT_RG8,
102    BGFX_TEXTURE_FORMAT_RG16,
103    BGFX_TEXTURE_FORMAT_RG16F,
104    BGFX_TEXTURE_FORMAT_RG32,
105    BGFX_TEXTURE_FORMAT_RG32F,
106    BGFX_TEXTURE_FORMAT_BGRA8,
107    BGFX_TEXTURE_FORMAT_RGBA16,
108    BGFX_TEXTURE_FORMAT_RGBA16F,
109    BGFX_TEXTURE_FORMAT_RGBA32,
110    BGFX_TEXTURE_FORMAT_RGBA32F,
111    BGFX_TEXTURE_FORMAT_R5G6B5,
112    BGFX_TEXTURE_FORMAT_RGBA4,
113    BGFX_TEXTURE_FORMAT_RGB5A1,
114    BGFX_TEXTURE_FORMAT_RGB10A2,
115
116    BGFX_TEXTURE_FORMAT_UNKNOWN_DEPTH,
117
118    BGFX_TEXTURE_FORMAT_D16,
119    BGFX_TEXTURE_FORMAT_D24,
120    BGFX_TEXTURE_FORMAT_D24S8,
121    BGFX_TEXTURE_FORMAT_D32,
122    BGFX_TEXTURE_FORMAT_D16F,
123    BGFX_TEXTURE_FORMAT_D24F,
124    BGFX_TEXTURE_FORMAT_D32F,
125    BGFX_TEXTURE_FORMAT_D0S8,
126
127    BGFX_TEXTURE_FORMAT_COUNT
128
129} bgfx_texture_format_t;
130
131typedef enum bgfx_uniform_type
132{
133    BGFX_UNIFORM_TYPE_UNIFORM1I,
134    BGFX_UNIFORM_TYPE_UNIFORM1F,
135    BGFX_UNIFORM_TYPE_END,
136
137    BGFX_UNIFORM_TYPE_UNIFORM1IV,
138    BGFX_UNIFORM_TYPE_UNIFORM1FV,
139    BGFX_UNIFORM_TYPE_UNIFORM2FV,
140    BGFX_UNIFORM_TYPE_UNIFORM3FV,
141    BGFX_UNIFORM_TYPE_UNIFORM4FV,
142    BGFX_UNIFORM_TYPE_UNIFORM3X3FV,
143    BGFX_UNIFORM_TYPE_UNIFORM4X4FV,
144
145    BGFX_UNIFORM_TYPE_COUNT
146
147} bgfx_uniform_type_t;
148
149#define BGFX_HANDLE_T(_name) \
150    typedef struct _name { uint16_t idx; } _name##_t;
151
152BGFX_HANDLE_T(bgfx_dynamic_index_buffer_handle);
153BGFX_HANDLE_T(bgfx_dynamic_vertex_buffer_handle);
154BGFX_HANDLE_T(bgfx_frame_buffer_handle);
155BGFX_HANDLE_T(bgfx_index_buffer_handle);
156BGFX_HANDLE_T(bgfx_program_handle);
157BGFX_HANDLE_T(bgfx_shader_handle);
158BGFX_HANDLE_T(bgfx_texture_handle);
159BGFX_HANDLE_T(bgfx_uniform_handle);
160BGFX_HANDLE_T(bgfx_vertex_buffer_handle);
161BGFX_HANDLE_T(bgfx_vertex_decl_handle);
162
163#undef BGFX_HANDLE_T
164
165/**
166 */
167typedef struct bgfx_memory
168{
169    uint8_t* data;
170    uint32_t size;
171
172} bgfx_memory_t;
173
174/**
175 * Vertex declaration.
176 */
177typedef struct bgfx_vertex_decl
178{
179    uint32_t hash;
180    uint16_t stride;
181    uint16_t offset[BGFX_ATTRIB_COUNT];
182    uint8_t  attributes[BGFX_ATTRIB_COUNT];
183
184} bgfx_vertex_decl_t;
185
186/**
187 */
188typedef struct bgfx_transient_index_buffer
189{
190    uint8_t* data;
191    uint32_t size;
192    bgfx_index_buffer_handle_t handle;
193    uint32_t startIndex;
194
195} bgfx_transient_index_buffer_t;
196
197/**
198 */
199typedef struct bgfx_transient_vertex_buffer
200{
201    uint8_t* data;
202    uint32_t size;
203    uint32_t startVertex;
204    uint16_t stride;
205    bgfx_vertex_buffer_handle_t handle;
206    bgfx_vertex_decl_handle_t decl;
207
208} bgfx_transient_vertex_buffer_t;
209
210/**
211 */
212typedef struct bgfx_instance_data_buffer
213{
214    uint8_t* data;
215    uint32_t size;
216    uint32_t offset;
217    uint16_t stride;
218    uint16_t num;
219    bgfx_vertex_buffer_handle_t handle;
220
221} bgfx_instance_data_buffer_t;
222
223/**
224 */
225typedef struct bgfx_texture_info
226{
227    bgfx_texture_format_t format;
228    uint32_t storageSize;
229    uint16_t width;
230    uint16_t height;
231    uint16_t depth;
232    uint8_t numMips;
233    uint8_t bitsPerPixel;
234
235} bgfx_texture_info_t;
236
237/**
238 *  Renderer capabilities.
239 */
240typedef struct bgfx_caps
241{
242    /**
243     *  Renderer backend type.
244     */
245    bgfx_renderer_type_t rendererType;
246
247    /**
248     *  Supported functionality, it includes emulated functionality.
249     *  Checking supported and not emulated will give functionality
250     *  natively supported by renderer.
251     */
252    uint64_t supported;
253
254    /**
255     *  Emulated functionality. For example some texture compression
256     *  modes are not natively supported by all renderers. The library
257     *  internally decompresses texture into supported format.
258     */
259    uint64_t emulated;
260
261    uint16_t maxTextureSize;    /* < Maximum texture size.             */
262    uint16_t maxDrawCalls;      /* < Maximum draw calls.               */
263    uint8_t  maxFBAttachments;  /* < Maximum frame buffer attachments. */
264
265    /**
266     *  Supported texture formats.
267     *    0 - not supported
268     *    1 - supported
269     *    2 - emulated
270     */
271    uint8_t formats[BGFX_TEXTURE_FORMAT_COUNT];
272
273} bgfx_caps_t;
274
275/**
276 */
277typedef enum bgfx_fatal
278{
279    BGFX_FATAL_DEBUG_CHECK,
280    BGFX_FATAL_MINIMUM_REQUIRED_SPECS,
281    BGFX_FATAL_INVALID_SHADER,
282    BGFX_FATAL_UNABLE_TO_INITIALIZE,
283    BGFX_FATAL_UNABLE_TO_CREATE_TEXTURE,
284
285} bgfx_fatal_t;
286
287#ifndef BGFX_SHARED_LIB_BUILD
288#    define BGFX_SHARED_LIB_BUILD 0
289#endif // BGFX_SHARED_LIB_BUILD
290
291#ifndef BGFX_SHARED_LIB_USE
292#    define BGFX_SHARED_LIB_USE 0
293#endif // BGFX_SHARED_LIB_USE
294
295#if defined(_MSC_VER)
296#   define BGFX_VTBL_CALL __stdcall
297#   define BGFX_VTBL_THIS  // passed via ecx
298#   define BGFX_VTBL_THIS_ // passed via ecx
299#   if BGFX_SHARED_LIB_BUILD
300#       define BGFX_SHARED_LIB_API __declspec(dllexport)
301#   elif BGFX_SHARED_LIB_USE
302#       define BGFX_SHARED_LIB_API __declspec(dllimport)
303#   else
304#       define BGFX_SHARED_LIB_API
305#   endif // BGFX_SHARED_LIB_*
306#else
307#   define BGFX_VTBL_CALL
308#   define BGFX_VTBL_THIS  BGFX_VTBL_INTEFRACE _this
309#   define BGFX_VTBL_THIS_ BGFX_VTBL_INTEFRACE _this,
310#   define BGFX_SHARED_LIB_API
311#endif // defined(_MSC_VER)
312
313#if defined(__cplusplus)
314#   define BGFX_C_API extern "C" BGFX_SHARED_LIB_API
315#else
316#   define BGFX_C_API BGFX_SHARED_LIB_API
317#endif // defined(__cplusplus)
318
319/**
320 */
321typedef struct bgfx_callback_interface
322{
323    const struct bgfx_callback_vtbl* vtbl;
324
325} bgfx_callback_interface_t;
326
327/**
328 *  Callback interface to implement application specific behavior.
329 *  Cached items are currently used only for OpenGL binary shaders.
330 *
331 *  NOTE:
332 *    'fatal' callback can be called from any thread. Other callbacks
333 *    are called from the render thread.
334 */
335typedef struct bgfx_callback_vtbl
336{
337#   define BGFX_VTBL_INTEFRACE bgfx_callback_interface_t
338
339    void* ctor;
340
341    /**
342     *  If fatal code code is not BGFX_FATAL_DEBUG_CHECK this callback is
343     *  called on unrecoverable error. It's not safe to continue, inform
344     *  user and terminate application from this call.
345     */
346    void (BGFX_VTBL_CALL *fatal)(BGFX_VTBL_THIS_ bgfx_fatal_t _code, const char* _str);
347
348    /**
349     *  Return size of for cached item. Return 0 if no cached item was
350     *  found.
351     */
352    uint32_t (BGFX_VTBL_CALL *cache_read_size)(BGFX_VTBL_THIS_ uint64_t _id);
353
354    /**
355     *  Read cached item.
356     */
357    bool (BGFX_VTBL_CALL *cache_read)(BGFX_VTBL_THIS_ uint64_t _id, void* _data, uint32_t _size);
358
359    /**
360     *  Write cached item.
361     */
362    void (BGFX_VTBL_CALL *cache_write)(BGFX_VTBL_THIS_ uint64_t _id, const void* _data, uint32_t _size);
363
364    /**
365     *  Screenshot captured. Screenshot format is always 4-byte BGRA.
366     */
367    void (BGFX_VTBL_CALL *screen_shot)(BGFX_VTBL_THIS_ const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data, uint32_t _size, bool _yflip);
368
369    /**
370     *  Called when capture begins.
371     */
372    void (BGFX_VTBL_CALL *capture_begin)(BGFX_VTBL_THIS_ uint32_t _width, uint32_t _height, uint32_t _pitch, bgfx_texture_format_t _format, bool _yflip);
373
374    /**
375     *  Called when capture ends.
376     */
377    void (BGFX_VTBL_CALL *capture_end)(BGFX_VTBL_THIS);
378
379    /**
380     *  Captured frame.
381     */
382    void (BGFX_VTBL_CALL *capture_frame)(BGFX_VTBL_THIS_ const void* _data, uint32_t _size);
383
384#   undef BGFX_VTBL_INTEFRACE
385
386} bgfx_callback_vtbl_t;
387
388/**
389 */
390typedef struct bgfx_reallocator_interface
391{
392    const struct bgfx_reallocator_vtbl* vtbl;
393
394} bgfx_reallocator_interface_t;
395
396/**
397 */
398typedef struct bgfx_reallocator_vtbl
399{
400#   define BGFX_VTBL_INTEFRACE bgfx_reallocator_interface_t
401
402    void* ctor;
403    void* (BGFX_VTBL_CALL *alloc)(BGFX_VTBL_THIS_ size_t _size, size_t _align, const char* _file, uint32_t _line);
404    void  (BGFX_VTBL_CALL *free)(BGFX_VTBL_THIS_ void* _ptr, size_t _align, const char* _file, uint32_t _line);
405    void* (BGFX_VTBL_CALL *realloc)(BGFX_VTBL_THIS_ void* _ptr, size_t _size, size_t _align, const char* _file, uint32_t _line);
406
407#   undef BGFX_VTBL_INTEFRACE
408
409} bgfx_reallocator_vtbl_t;
410
411/**
412 *  Start vertex declaration.
413 */
414BGFX_C_API void bgfx_vertex_decl_begin(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer);
415
416/**
417 *  Add attribute to vertex declaration.
418 *
419 *  @param _attrib Attribute semantics.
420 *  @param _num Number of elements 1, 2, 3 or 4.
421 *  @param _type Element type.
422 *  @param _normalized When using fixed point AttribType (f.e. Uint8)
423 *    value will be normalized for vertex shader usage. When normalized
424 *    is set to true, AttribType::Uint8 value in range 0-255 will be
425 *    in range 0.0-1.0 in vertex shader.
426 *  @param _asInt Packaging rule for vertexPack, vertexUnpack, and
427 *    vertexConvert for AttribType::Uint8 and AttribType::Int16.
428 *    Unpacking code must be implemented inside vertex shader.
429 *
430 *  NOTE:
431 *    Must be called between begin/end.
432 */
433BGFX_C_API void bgfx_vertex_decl_add(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
434
435/**
436 *  Skip _num bytes in vertex stream.
437 */
438BGFX_C_API void bgfx_vertex_decl_skip(bgfx_vertex_decl_t* _decl, uint8_t _num);
439
440/**
441 *  End vertex declaration.
442 */
443BGFX_C_API void bgfx_vertex_decl_end(bgfx_vertex_decl_t* _decl);
444
445/**
446 *  Pack vec4 into vertex stream format.
447 */
448BGFX_C_API void bgfx_vertex_pack(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, void* _data, uint32_t _index);
449
450/**
451 *  Unpack vec4 from vertex stream format.
452 */
453BGFX_C_API void bgfx_vertex_unpack(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_decl_t* _decl, const void* _data, uint32_t _index);
454
455/**
456 *  Converts vertex stream data from one vertex stream format to another.
457 *
458 *  @param _destDecl Destination vertex stream declaration.
459 *  @param _destData Destination vertex stream.
460 *  @param _srcDecl Source vertex stream declaration.
461 *  @param _srcData Source vertex stream data.
462 *  @param _num Number of vertices to convert from source to destination.
463 */
464BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_decl_t* _destDecl, void* _destData, const bgfx_vertex_decl_t* _srcDecl, const void* _srcData, uint32_t _num);
465
466/**
467 *  Weld vertices.
468 *
469 *  @param _output Welded vertices remapping table. The size of buffer
470 *    must be the same as number of vertices.
471 *  @param _decl Vertex stream declaration.
472 *  @param _data Vertex stream.
473 *  @param _num Number of vertices in vertex stream.
474 *  @param _epsilon Error tolerance for vertex position comparison.
475 *  @returns Number of unique vertices after vertex welding.
476 */
477BGFX_C_API uint16_t bgfx_weld_vertices(uint16_t* _output, const bgfx_vertex_decl_t* _decl, const void* _data, uint16_t _num, float _epsilon);
478
479/**
480 *  Swizzle RGBA8 image to BGRA8.
481 *
482 *  @param _width Width of input image (pixels).
483 *  @param _height Height of input image (pixels).
484 *  @param _pitch Pitch of input image (bytes).
485 *  @param _src Source image.
486 *  @param _dst Destination image. Must be the same size as input image.
487 *    _dst might be pointer to the same memory as _src.
488 */
489BGFX_C_API void bgfx_image_swizzle_bgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
490
491/**
492 *  Downsample RGBA8 image with 2x2 pixel average filter.
493 *
494 *  @param _width Width of input image (pixels).
495 *  @param _height Height of input image (pixels).
496 *  @param _pitch Pitch of input image (bytes).
497 *  @param _src Source image.
498 *  @param _dst Destination image. Must be at least quarter size of
499 *    input image. _dst might be pointer to the same memory as _src.
500 */
501BGFX_C_API void bgfx_image_rgba8_downsample_2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
502
503/**
504 *  Returns supported backend API renderers.
505 */
506BGFX_C_API uint8_t bgfx_get_supported_renderers(bgfx_renderer_type_t _enum[BGFX_RENDERER_TYPE_COUNT]);
507
508/**
509 *  Returns name of renderer.
510 */
511BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type);
512
513/**
514 *  Initialize bgfx library.
515 *
516 *  @param _type Select rendering backend. When set to RendererType::Count
517 *    default rendering backend will be selected.
518 *
519 *  @param _callback Provide application specific callback interface.
520 *    See: CallbackI
521 *
522 *  @param _reallocator Custom allocator. When custom allocator is not
523 *    specified, library uses default CRT allocator. The library assumes
524 *    custom allocator is thread safe.
525 */
526BGFX_C_API void bgfx_init(bgfx_renderer_type_t _type, bgfx_callback_interface_t* _callback, bgfx_reallocator_interface_t* _allocator);
527
528/**
529 *  Shutdown bgfx library.
530 */
531BGFX_C_API void bgfx_shutdown();
532
533/**
534 *  Reset graphic settings.
535 */
536BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags);
537
538/**
539 *  Advance to next frame. When using multithreaded renderer, this call
540 *  just swaps internal buffers, kicks render thread, and returns. In
541 *  singlethreaded renderer this call does frame rendering.
542 *
543 *  @returns Current frame number. This might be used in conjunction with
544 *    double/multi buffering data outside the library and passing it to
545 *    library via makeRef calls.
546 */
547BGFX_C_API uint32_t bgfx_frame();
548
549/**
550 *  Returns current renderer backend API type.
551 *
552 *  NOTE:
553 *    Library must be initialized.
554 */
555BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type();
556
557/**
558 *  Returns renderer capabilities.
559 *
560 *  NOTE:
561 *    Library must be initialized.
562 */
563BGFX_C_API bgfx_caps_t* bgfx_get_caps();
564
565/**
566 *  Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
567 */
568BGFX_C_API const bgfx_memory_t* bgfx_alloc(uint32_t _size);
569
570/**
571 *  Allocate buffer and copy data into it. Data will be freed inside bgfx.
572 */
573BGFX_C_API const bgfx_memory_t* bgfx_copy(const void* _data, uint32_t _size);
574
575/**
576 *  Make reference to data to pass to bgfx. Unlike bgfx::alloc this call
577 *  doesn't allocate memory for data. It just copies pointer to data.
578 *  You must make sure data is available for at least 2 bgfx::frame calls.
579 */
580BGFX_C_API const bgfx_memory_t* bgfx_make_ref(const void* _data, uint32_t _size);
581
582/**
583 *  Set debug flags.
584 *
585 *  @param _debug Available flags:
586 *
587 *    BGFX_DEBUG_IFH - Infinitely fast hardware. When this flag is set
588 *      all rendering calls will be skipped. It's useful when profiling
589 *      to quickly assess bottleneck between CPU and GPU.
590 *
591 *    BGFX_DEBUG_STATS - Display internal statistics.
592 *
593 *    BGFX_DEBUG_TEXT - Display debug text.
594 *
595 *    BGFX_DEBUG_WIREFRAME - Wireframe rendering. All rendering
596 *      primitives will be rendered as lines.
597 */
598BGFX_C_API void bgfx_set_debug(uint32_t _debug);
599
600/**
601 *  Clear internal debug text buffer.
602 */
603BGFX_C_API void bgfx_dbg_text_clear(uint8_t _attr, bool _small);
604
605/**
606 *  Print into internal debug text buffer.
607 */
608BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
609
610/**
611 *  Create static index buffer.
612 *
613 *  NOTE:
614 *    Only 16-bit index buffer is supported.
615 */
616BGFX_C_API bgfx_index_buffer_handle_t bgfx_create_index_buffer(const bgfx_memory_t* _mem);
617
618/**
619 *  Destroy static index buffer.
620 */
621BGFX_C_API void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle);
622
623/**
624 *  Create static vertex buffer.
625 *
626 *  @param _mem Vertex buffer data.
627 *  @param _decl Vertex declaration.
628 *  @returns Static vertex buffer handle.
629 */
630BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl);
631
632/**
633 *  Destroy static vertex buffer.
634 *
635 *  @param _handle Static vertex buffer handle.
636 */
637BGFX_C_API void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle);
638
639/**
640 *  Create empty dynamic index buffer.
641 *
642 *  @param _num Number of indices.
643 *
644 *  NOTE:
645 *    Only 16-bit index buffer is supported.
646 */
647BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint32_t _num);
648
649/**
650 *  Create dynamic index buffer and initialized it.
651 *
652 *  @param _mem Index buffer data.
653 *
654 *  NOTE:
655 *    Only 16-bit index buffer is supported.
656 */
657BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const bgfx_memory_t* _mem);
658
659/**
660 *  Update dynamic index buffer.
661 *
662 *  @param _handle Dynamic index buffer handle.
663 *  @param _mem Index buffer data.
664 */
665BGFX_C_API void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, const bgfx_memory_t* _mem);
666
667/**
668 *  Destroy dynamic index buffer.
669 *
670 *  @param _handle Dynamic index buffer handle.
671 */
672BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle);
673
674/**
675 *  Create empty dynamic vertex buffer.
676 *
677 *  @param _num Number of vertices.
678 *  @param _decl Vertex declaration.
679 */
680BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint16_t _num, const bgfx_vertex_decl_t* _decl);
681
682/**
683 *  Create dynamic vertex buffer and initialize it.
684 *
685 *  @param _mem Vertex buffer data.
686 *  @param _decl Vertex declaration.
687 */
688BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t* _mem, const bgfx_vertex_decl_t* _decl);
689
690/**
691 *  Update dynamic vertex buffer.
692 */
693BGFX_C_API void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, const bgfx_memory_t* _mem);
694
695/**
696 *  Destroy dynamic vertex buffer.
697 */
698BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle);
699
700/**
701 *  Returns true if internal transient index buffer has enough space.
702 *
703 *  @param _num Number of indices.
704 */
705BGFX_C_API bool bgfx_check_avail_transient_index_buffer(uint32_t _num);
706
707/**
708 *  Returns true if internal transient vertex buffer has enough space.
709 *
710 *  @param _num Number of vertices.
711 *  @param _decl Vertex declaration.
712 */
713BGFX_C_API bool bgfx_check_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_decl_t* _decl);
714
715/**
716 *  Returns true if internal instance data buffer has enough space.
717 *
718 *  @param _num Number of instances.
719 *  @param _stride Stride per instance.
720 */
721BGFX_C_API bool bgfx_check_avail_instance_data_buffer(uint32_t _num, uint16_t _stride);
722
723/**
724 *  Returns true if both internal transient index and vertex buffer have
725 *  enough space.
726 *
727 *  @param _numVertices Number of vertices.
728 *  @param _decl Vertex declaration.
729 *  @param _numIndices Number of indices.
730 */
731BGFX_C_API bool bgfx_check_avail_transient_buffers(uint32_t _numVertices, const bgfx_vertex_decl_t* _decl, uint32_t _numIndices);
732
733/**
734 *  Allocate transient index buffer.
735 *
736 *  @param[out] _tib TransientIndexBuffer structure is filled and is valid
737 *    for the duration of frame, and it can be reused for multiple draw
738 *    calls.
739 *  @param _num Number of indices to allocate.
740 *
741 *  NOTE:
742 *    1. You must call setIndexBuffer after alloc in order to avoid memory
743 *       leak.
744 *    2. Only 16-bit index buffer is supported.
745 */
746BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint32_t _num);
747
748/**
749 *  Allocate transient vertex buffer.
750 *
751 *  @param[out] _tvb TransientVertexBuffer structure is filled and is valid
752 *    for the duration of frame, and it can be reused for multiple draw
753 *    calls.
754 *  @param _num Number of vertices to allocate.
755 *  @param _decl Vertex declaration.
756 *
757 *  NOTE:
758 *    You must call setVertexBuffer after alloc in order to avoid memory
759 *    leak.
760 */
761BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_decl_t* _decl);
762
763/**
764 *  Check for required space and allocate transient vertex and index
765 *  buffers. If both space requirements are satisfied function returns
766 *  true.
767 *
768 *  NOTE:
769 *    Only 16-bit index buffer is supported.
770 */
771BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_decl_t* _decl, uint16_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint16_t _numIndices);
772
773/**
774 *  Allocate instance data buffer.
775 *
776 *  NOTE:
777 *    You must call setInstanceDataBuffer after alloc in order to avoid
778 *    memory leak.
779 */
780BGFX_C_API const bgfx_instance_data_buffer_t* bgfx_alloc_instance_data_buffer(uint32_t _num, uint16_t _stride);
781
782/**
783 *  Create shader from memory buffer.
784 */
785BGFX_C_API bgfx_shader_handle_t bgfx_create_shader(const bgfx_memory_t* _mem);
786
787/**
788 *  Returns num of uniforms, and uniform handles used inside shader.
789 *
790 *  @param _handle Shader handle.
791 *  @param _uniforms UniformHandle array where data will be stored.
792 *  @param _max Maximum capacity of array.
793 *  @returns Number of uniforms used by shader.
794 *
795 *  NOTE:
796 *    Only non-predefined uniforms are returned.
797 */
798BGFX_C_API uint16_t bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, uint16_t _max);
799
800/**
801 *  Destroy shader. Once program is created with shader it is safe to
802 *  destroy shader.
803 */
804BGFX_C_API void bgfx_destroy_shader(bgfx_shader_handle_t _handle);
805
806/**
807 *  Create program with vertex and fragment shaders.
808 *
809 *  @param _vsh Vertex shader.
810 *  @param _fsh Fragment shader.
811 *  @param _destroyShaders If true, shaders will be destroyed when
812 *    program is destroyed.
813 *  @returns Program handle if vertex shader output and fragment shader
814 *    input are matching, otherwise returns invalid program handle.
815 */
816BGFX_C_API bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders);
817
818/**
819 *  Destroy program.
820 */
821BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle);
822
823/**
824 *  Calculate amount of memory required for texture.
825 */
826BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t* _info, uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format);
827
828/**
829 *  Create texture from memory buffer.
830 *
831 *  @param _mem DDS, KTX or PVR texture data.
832 *  @param _flags Default texture sampling mode is linear, and wrap mode
833 *    is repeat.
834 *
835 *    BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap
836 *      mode.
837 *
838 *    BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic
839 *      sampling.
840 *
841 *  @param _skip Skip top level mips when parsing texture.
842 *  @param _info Returns parsed texture information.
843 *  @returns Texture handle.
844 */
845BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint32_t _flags, uint8_t _skip, bgfx_texture_info_t* _info);
846
847/**
848 *  Create 2D texture.
849 *
850 *  @param _width
851 *  @param _height
852 *  @param _numMips
853 *  @param _format
854 *  @param _flags
855 *  @param _mem
856 */
857BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
858
859/**
860 *  Create 3D texture.
861 *
862 *  @param _width
863 *  @param _height
864 *  @param _depth
865 *  @param _numMips
866 *  @param _format
867 *  @param _flags
868 *  @param _mem
869 */
870BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
871
872/**
873 *  Create Cube texture.
874 *
875 *  @param _size
876 *  @param _numMips
877 *  @param _format
878 *  @param _flags
879 *  @param _mem
880 */
881BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, uint8_t _numMips, bgfx_texture_format_t _format, uint32_t _flags, const bgfx_memory_t* _mem);
882
883/**
884 *  Update 2D texture.
885 *
886 *  @param _handle
887 *  @param _mip
888 *  @param _x
889 *  @param _y
890 *  @param _width
891 *  @param _height
892 *  @param _mem
893 *  @param _pitch Pitch of input image (bytes). When _pitch is set to
894 *    UINT16_MAX, it will be calculated internally based on _width.
895 */
896BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
897
898/**
899 *  Update 3D texture.
900 *
901 *  @param _handle
902 *  @param _mip
903 *  @param _x
904 *  @param _y
905 *  @param _z
906 *  @param _width
907 *  @param _height
908 *  @param _depth
909 *  @param _mem
910 */
911BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem);
912
913/**
914 *  Update Cube texture.
915 *
916 *  @param _handle
917 *  @param _side Cubemap side, where 0 is +X, 1 is -X, 2 is +Y, 3 is
918 *    -Y, 4 is +Z, and 5 is -Z.
919 *
920 *               +----------+
921 *               |-z       2|
922 *               | ^  +y    |
923 *               | |        |
924 *               | +---->+x |
925 *    +----------+----------+----------+----------+
926 *    |+y       1|+y       4|+y       0|+y       5|
927 *    | ^  -x    | ^  +z    | ^  +x    | ^  -z    |
928 *    | |        | |        | |        | |        |
929 *    | +---->+z | +---->+x | +---->-z | +---->-x |
930 *    +----------+----------+----------+----------+
931 *               |+z       3|
932 *               | ^  -y    |
933 *               | |        |
934 *               | +---->+x |
935 *               +----------+
936 *
937 *  @param _mip
938 *  @param _x
939 *  @param _y
940 *  @param _width
941 *  @param _height
942 *  @param _mem
943 *  @param _pitch Pitch of input image (bytes). When _pitch is set to
944 *    UINT16_MAX, it will be calculated internally based on _width.
945 */
946BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch);
947
948/**
949 *  Destroy texture.
950 */
951BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle);
952
953/**
954 *  Create frame buffer (simple).
955 *
956 *  @param _width Texture width.
957 *  @param _height Texture height.
958 *  @param _format Texture format.
959 *  @param _textureFlags Texture flags.
960 */
961BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags);
962
963/**
964 *  Create frame buffer.
965 *
966 *  @param _num Number of texture attachments.
967 *  @param _handles Texture attachments.
968 *  @param _destroyTextures If true, textures will be destroyed when
969 *    frame buffer is destroyed.
970 */
971BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, bgfx_texture_handle_t* _handles, bool _destroyTextures);
972
973/**
974 *  Destroy frame buffer.
975 */
976BGFX_C_API void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle);
977
978/**
979 *  Create shader uniform parameter.
980 *
981 *  @param _name Uniform name in shader.
982 *  @param _type Type of uniform (See: UniformType).
983 *  @param _num Number of elements in array.
984 *
985 *  Predefined uniforms:
986 *
987 *    u_viewRect vec4(x, y, width, height) - view rectangle for current
988 *      view.
989 *
990 *    u_viewTexel vec4(1.0/width, 1.0/height, undef, undef) - inverse
991 *      width and height
992 *
993 *    u_view mat4 - view matrix
994 *
995 *    u_invView mat4 - inverted view matrix
996 *
997 *    u_proj mat4 - projection matrix
998 *
999 *    u_invProj mat4 - inverted projection matrix
1000 *
1001 *    u_viewProj mat4 - concatenated view projection matrix
1002 *
1003 *    u_invViewProj mat4 - concatenated inverted view projection matrix
1004 *
1005 *    u_model mat4[BGFX_CONFIG_MAX_BONES] - array of model matrices.
1006 *
1007 *    u_modelView mat4 - concatenated model view matrix, only first
1008 *      model matrix from array is used.
1009 *
1010 *    u_modelViewProj mat4 - concatenated model view projection matrix.
1011 *
1012 *    u_alphaRef float - alpha reference value for alpha test.
1013 */
1014BGFX_C_API bgfx_uniform_handle_t bgfx_create_uniform(const char* _name, bgfx_uniform_type_t _type, uint16_t _num);
1015
1016/**
1017 *  Destroy shader uniform parameter.
1018 */
1019BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle);
1020
1021/**
1022 *  Set view name.
1023 *
1024 *  @param _id View id.
1025 *  @param _name View name.
1026 *
1027 *  NOTE:
1028 *    This is debug only feature.
1029 */
1030BGFX_C_API void bgfx_set_view_name(uint8_t _id, const char* _name);
1031
1032/**
1033 *  Set view rectangle. Draw primitive outside view will be clipped.
1034 *
1035 *  @param _id View id.
1036 *  @param _x Position x from the left corner of the window.
1037 *  @param _y Position y from the top corner of the window.
1038 *  @param _width Width of view port region.
1039 *  @param _height Height of view port region.
1040 */
1041BGFX_C_API void bgfx_set_view_rect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
1042
1043/**
1044 *  Set view rectangle for multiple views.
1045 *
1046 *  @param _viewMask Bit mask representing affected views.
1047 *  @param _x Position x from the left corner of the window.
1048 *  @param _y Position y from the top corner of the window.
1049 *  @param _width Width of view port region.
1050 *  @param _height Height of view port region.
1051 */
1052BGFX_C_API void bgfx_set_view_rect_mask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
1053
1054/**
1055 *  Set view scissor. Draw primitive outside view will be clipped. When
1056 *  _x, _y, _width and _height are set to 0, scissor will be disabled.
1057 *
1058 *  @param _x Position x from the left corner of the window.
1059 *  @param _y Position y from the top corner of the window.
1060 *  @param _width Width of scissor region.
1061 *  @param _height Height of scissor region.
1062 */
1063BGFX_C_API void bgfx_set_view_scissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
1064
1065/**
1066 *  Set view scissor for multiple views. When _x, _y, _width and _height
1067 *  are set to 0, scissor will be disabled.
1068 *
1069 *  @param _id View id.
1070 *  @param _viewMask Bit mask representing affected views.
1071 *  @param _x Position x from the left corner of the window.
1072 *  @param _y Position y from the top corner of the window.
1073 *  @param _width Width of scissor region.
1074 *  @param _height Height of scissor region.
1075 */
1076BGFX_C_API void bgfx_set_view_scissor_mask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
1077
1078/**
1079 *  Set view clear flags.
1080 *
1081 *  @param _id View id.
1082 *  @param _flags Clear flags. Use BGFX_CLEAR_NONE to remove any clear
1083 *    operation. See: BGFX_CLEAR_*.
1084 *  @param _rgba Color clear value.
1085 *  @param _depth Depth clear value.
1086 *  @param _stencil Stencil clear value.
1087 */
1088BGFX_C_API void bgfx_set_view_clear(uint8_t _id, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil);
1089
1090/**
1091 *  Set view clear flags for multiple views.
1092 */
1093BGFX_C_API void bgfx_set_view_clear_mask(uint32_t _viewMask, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil);
1094
1095/**
1096 *  Set view into sequential mode. Draw calls will be sorted in the same
1097 *  order in which submit calls were called.
1098 */
1099BGFX_C_API void bgfx_set_view_seq(uint8_t _id, bool _enabled);
1100
1101/**
1102 *  Set multiple views into sequential mode.
1103 */
1104BGFX_C_API void bgfx_set_view_seq_mask(uint32_t _viewMask, bool _enabled);
1105
1106/**
1107 *  Set view frame buffer.
1108 *
1109 *  @param _id View id.
1110 *  @param _handle Frame buffer handle. Passing BGFX_INVALID_HANDLE as
1111 *    frame buffer handle will draw primitives from this view into
1112 *    default back buffer.
1113 */
1114BGFX_C_API void bgfx_set_view_frame_buffer(uint8_t _id, bgfx_frame_buffer_handle_t _handle);
1115
1116/**
1117 *  Set view frame buffer for multiple views.
1118 *
1119 *  @param _viewMask View mask.
1120 *  @param _handle Frame buffer handle. Passing BGFX_INVALID_HANDLE as
1121 *    frame buffer handle will draw primitives from this view into
1122 *    default back buffer.
1123 */
1124BGFX_C_API void bgfx_set_view_frame_buffer_mask(uint32_t _viewMask, bgfx_frame_buffer_handle_t _handle);
1125
1126/**
1127 *  Set view view and projection matrices, all draw primitives in this
1128 *  view will use these matrices.
1129 */
1130BGFX_C_API void bgfx_set_view_transform(uint8_t _id, const void* _view, const void* _proj);
1131
1132/**
1133 *  Set view view and projection matrices for multiple views.
1134 */
1135BGFX_C_API void bgfx_set_view_transform_mask(uint32_t _viewMask, const void* _view, const void* _proj);
1136
1137/**
1138 *  Sets debug marker.
1139 */
1140BGFX_C_API void bgfx_set_marker(const char* _marker);
1141
1142/**
1143 *  Set render states for draw primitive.
1144 *
1145 *  @param _state State flags. Default state for primitive type is
1146 *    triangles. See: BGFX_STATE_DEFAULT.
1147 *
1148 *    BGFX_STATE_ALPHA_WRITE - Enable alpha write.
1149 *    BGFX_STATE_DEPTH_WRITE - Enable depth write.
1150 *    BGFX_STATE_DEPTH_TEST_* - Depth test function.
1151 *    BGFX_STATE_BLEND_* - See NOTE 1: BGFX_STATE_BLEND_FUNC.
1152 *    BGFX_STATE_BLEND_EQUATION_* - See NOTE 2.
1153 *    BGFX_STATE_CULL_* - Backface culling mode.
1154 *    BGFX_STATE_RGB_WRITE - Enable RGB write.
1155 *    BGFX_STATE_MSAA - Enable MSAA.
1156 *    BGFX_STATE_PT_[LINES/POINTS] - Primitive type.
1157 *
1158 *  @param _rgba Sets blend factor used by BGFX_STATE_BLEND_FACTOR and
1159 *    BGFX_STATE_BLEND_INV_FACTOR blend modes.
1160 *
1161 *  NOTE:
1162 *    1. Use BGFX_STATE_ALPHA_REF, BGFX_STATE_POINT_SIZE and
1163 *       BGFX_STATE_BLEND_FUNC macros to setup more complex states.
1164 *    2. BGFX_STATE_BLEND_EQUATION_ADD is set when no other blend
1165 *       equation is specified.
1166 */
1167BGFX_C_API void bgfx_set_state(uint64_t _state, uint32_t _rgba);
1168
1169/**
1170 *  Set stencil test state.
1171 *
1172 *  @param _fstencil Front stencil state.
1173 *  @param _bstencil Back stencil state. If back is set to BGFX_STENCIL_NONE
1174 *    _fstencil is applied to both front and back facing primitives.
1175 */
1176BGFX_C_API void bgfx_set_stencil(uint32_t _fstencil, uint32_t _bstencil);
1177
1178/**
1179 *  Set scissor for draw primitive. For scissor for all primitives in
1180 *  view see setViewScissor.
1181 *
1182 *  @param _x Position x from the left corner of the window.
1183 *  @param _y Position y from the top corner of the window.
1184 *  @param _width Width of scissor region.
1185 *  @param _height Height of scissor region.
1186 *  @returns Scissor cache index.
1187 */
1188BGFX_C_API uint16_t bgfx_set_scissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
1189
1190/**
1191 *  Set scissor from cache for draw primitive.
1192 *
1193 *  @param _cache Index in scissor cache. Passing UINT16_MAX unset primitive
1194 *    scissor and primitive will use view scissor instead.
1195 */
1196BGFX_C_API void bgfx_set_scissor_cached(uint16_t _cache);
1197
1198/**
1199 *  Set model matrix for draw primitive. If it is not called model will
1200 *  be rendered with identity model matrix.
1201 *
1202 *  @param _mtx Pointer to first matrix in array.
1203 *  @param _num Number of matrices in array.
1204 *  @returns index into matrix cache in case the same model matrix has
1205 *    to be used for other draw primitive call.
1206 */
1207BGFX_C_API uint32_t bgfx_set_transform(const void* _mtx, uint16_t _num);
1208
1209/**
1210 *  Set model matrix from matrix cache for draw primitive.
1211 *
1212 *  @param _cache Index in matrix cache.
1213 *  @param _num Number of matrices from cache.
1214 */
1215BGFX_C_API void bgfx_set_transform_cached(uint32_t _cache, uint16_t _num);
1216
1217/**
1218 *  Set shader uniform parameter for draw primitive.
1219 */
1220BGFX_C_API void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num);
1221
1222/**
1223 *  Set index buffer for draw primitive.
1224 */
1225BGFX_C_API void bgfx_set_index_buffer(bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
1226
1227/**
1228 *  Set index buffer for draw primitive.
1229 */
1230BGFX_C_API void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices);
1231
1232/**
1233 *  Set index buffer for draw primitive.
1234 */
1235BGFX_C_API void bgfx_set_transient_index_buffer(const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices);
1236
1237/**
1238 *  Set vertex buffer for draw primitive.
1239 */
1240BGFX_C_API void bgfx_set_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices);
1241
1242/**
1243 *  Set vertex buffer for draw primitive.
1244 */
1245BGFX_C_API void bgfx_set_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _numVertices);
1246
1247/**
1248 *  Set vertex buffer for draw primitive.
1249 */
1250BGFX_C_API void bgfx_set_transient_vertex_buffer(const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices);
1251
1252/**
1253 *  Set instance data buffer for draw primitive.
1254 */
1255BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint16_t _num);
1256
1257/**
1258 *  Set program for draw primitive.
1259 */
1260BGFX_C_API void bgfx_set_program(bgfx_program_handle_t _handle);
1261
1262/**
1263 *  Set texture stage for draw primitive.
1264 *
1265 *  @param _stage Texture unit.
1266 *  @param _sampler Program sampler.
1267 *  @param _handle Texture handle.
1268 *  @param _flags Texture sampling mode. Default value UINT32_MAX uses
1269 *    texture sampling settings from the texture.
1270 *
1271 *    BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap
1272 *      mode.
1273 *
1274 *    BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic
1275 *      sampling.
1276 *
1277 *  @param _flags Texture sampler filtering flags. UINT32_MAX use the
1278 *    sampler filtering mode set by texture.
1279 */
1280BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags);
1281
1282/**
1283 *  Set texture stage for draw primitive.
1284 *
1285 *  @param _stage Texture unit.
1286 *  @param _sampler Program sampler.
1287 *  @param _handle Frame buffer handle.
1288 *  @param _attachment Attachment index.
1289 *  @param _flags Texture sampling mode. Default value UINT32_MAX uses
1290 *    texture sampling settings from the texture.
1291 *
1292 *    BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap
1293 *      mode.
1294 *
1295 *    BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic
1296 *      sampling.
1297 */
1298BGFX_C_API void bgfx_set_texture_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, uint32_t _flags);
1299
1300/**
1301 *  Submit primitive for rendering into single view.
1302 *
1303 *  @param _id View id.
1304 *  @param _depth Depth for sorting.
1305 *  @returns Number of draw calls.
1306 */
1307BGFX_C_API uint32_t bgfx_submit(uint8_t _id, int32_t _depth);
1308
1309/**
1310 *  Submit primitive for rendering into multiple views.
1311 *
1312 *  @param _viewMask Mask to which views to submit draw primitive calls.
1313 *  @param _depth Depth for sorting.
1314 *  @returns Number of draw calls.
1315 */
1316BGFX_C_API uint32_t bgfx_submit_mask(uint32_t _viewMask, int32_t _depth);
1317
1318/**
1319 *
1320 */
1321BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_texture_format_t _format, bgfx_access_t _access);
1322
1323/**
1324 *
1325 */
1326BGFX_C_API void bgfx_set_image_from_frame_buffer(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, bgfx_texture_format_t _format, bgfx_access_t _access);
1327
1328/**
1329 * Dispatch compute.
1330 */
1331BGFX_C_API void bgfx_dispatch(uint8_t _id, bgfx_program_handle_t _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ);
1332
1333/**
1334 *  Discard all previously set state for draw call.
1335 */
1336BGFX_C_API void bgfx_discard();
1337
1338/**
1339 *  Request screen shot.
1340 *
1341 *  @param _filePath Will be passed to CallbackI::screenShot callback.
1342 *
1343 *  NOTE:
1344 *    CallbackI::screenShot must be implemented.
1345 */
1346BGFX_C_API void bgfx_save_screen_shot(const char* _filePath);
1347
1348#endif // BGFX_C99_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/include/bgfx.c99.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/include/bgfxplatform.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
4 */
5
6#ifndef BGFX_PLATFORM_H_HEADER_GUARD
7#define BGFX_PLATFORM_H_HEADER_GUARD
8
9// NOTICE:
10// This header file contains platform specific interfaces. It is only
11// necessary to use this header in conjunction with creating windows.
12
13#include <bx/platform.h>
14
15namespace bgfx
16{
17   struct RenderFrame
18   {
19      enum Enum
20      {
21         NoContext,
22         Render,
23         Exiting,
24
25         Count
26      };
27   };
28
29   /// WARNING: This call should be only used on platforms that don't
30   /// allow creating separate rendering thread. If it is called before
31   /// to bgfx::init, render thread won't be created by bgfx::init call.
32   RenderFrame::Enum renderFrame();
33}
34
35#if BX_PLATFORM_ANDROID
36#   include <android/native_window.h>
37
38namespace bgfx
39{
40   ///
41   void androidSetWindow(::ANativeWindow* _window);
42
43} // namespace bgfx
44
45#elif BX_PLATFORM_IOS
46namespace bgfx
47{
48   ///
49   void iosSetEaglLayer(void* _layer);
50
51} // namespace bgfx
52
53#elif BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
54#   include <X11/Xlib.h>
55
56namespace bgfx
57{
58   ///
59   void x11SetDisplayWindow(::Display* _display, ::Window _window);
60
61} // namespace bgfx
62
63#elif BX_PLATFORM_NACL
64#   include <ppapi/c/ppb_graphics_3d.h>
65#   include <ppapi/c/ppb_instance.h>
66
67namespace bgfx
68{
69   typedef void (*PostSwapBuffersFn)(uint32_t _width, uint32_t _height);
70
71   ///
72   bool naclSetInterfaces(::PP_Instance, const ::PPB_Instance*, const ::PPB_Graphics3D*, PostSwapBuffersFn);
73
74} // namespace bgfx
75
76#elif BX_PLATFORM_OSX
77namespace bgfx
78{
79   ///
80   void osxSetNSWindow(void* _window);
81
82} // namespace bgfx
83
84#elif BX_PLATFORM_WINDOWS
85#   include <windows.h>
86
87namespace bgfx
88{
89   ///
90   void winSetHwnd(::HWND _window);
91
92} // namespace bgfx
93
94#endif // BX_PLATFORM_
95
96#if defined(_SDL_H)
97// If SDL.h is included before bgfxplatform.h we can enable SDL window
98// interop convenience code.
99
100#   include <SDL2/SDL_syswm.h>
101
102namespace bgfx
103{
104   ///
105   inline bool sdlSetWindow(SDL_Window* _window)
106   {
107      SDL_SysWMinfo wmi;
108      SDL_VERSION(&wmi.version);
109      if (!SDL_GetWindowWMInfo(_window, &wmi) )
110      {
111         return false;
112      }
113
114#   if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
115      x11SetDisplayWindow(wmi.info.x11.display, wmi.info.x11.window);
116#   elif BX_PLATFORM_OSX
117      osxSetNSWindow(wmi.info.cocoa.window);
118#   elif BX_PLATFORM_WINDOWS
119      winSetHwnd(wmi.info.win.window);
120#   endif // BX_PLATFORM_
121
122      return true;
123   }
124
125} // namespace bgfx
126
127#elif defined(_glfw3_h_)
128// If GLFW/glfw3.h is included before bgfxplatform.h we can enable GLFW3
129// window interop convenience code.
130
131#   if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
132#      define GLFW_EXPOSE_NATIVE_X11
133#      define GLFW_EXPOSE_NATIVE_GLX
134#   elif BX_PLATFORM_OSX
135#      define GLFW_EXPOSE_NATIVE_COCOA
136#      define GLFW_EXPOSE_NATIVE_NSGL
137#   elif BX_PLATFORM_WINDOWS
138#      define GLFW_EXPOSE_NATIVE_WIN32
139#      define GLFW_EXPOSE_NATIVE_WGL
140#   endif //
141#   include <GLFW/glfw3native.h>
142
143namespace bgfx
144{
145   inline void glfwSetWindow(GLFWwindow* _window)
146   {
147#   if BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
148      ::Display* display = glfwGetX11Display();
149      ::Window window = glfwGetX11Window(_window);
150      x11SetDisplayWindow(display, window);
151#   elif BX_PLATFORM_OSX
152      void* id = glfwGetCocoaWindow(_window);
153      osxSetNSWindow(id);
154#   elif BX_PLATFORM_WINDOWS
155      HWND hwnd = glfwGetWin32Window(_window);
156      winSetHwnd(hwnd);
157#   endif BX_PLATFORM_WINDOWS
158   }
159
160} // namespace bgfx
161
162#endif // defined(_SDL_H)
163
164#endif // BGFX_PLATFORM_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/include/bgfxplatform.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/include/bgfxplatform.c99.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
4 *
5 * vim: set tabstop=4 expandtab:
6 */
7
8#ifndef BGFX_PLATFORM_C99_H_HEADER_GUARD
9#define BGFX_PLATFORM_C99_H_HEADER_GUARD
10
11// NOTICE:
12// This header file contains platform specific interfaces. It is only
13// necessary to use this header in conjunction with creating windows.
14
15#include <bx/platform.h>
16
17typedef enum bgfx_render_frame
18{
19    BGFX_RENDER_FRAME_NO_CONTEXT,
20    BGFX_RENDER_FRAME_RENDER,
21    BGFX_RENDER_FRAME_EXITING,
22
23    BGFX_RENDER_FRAME_COUNT
24
25} bgfx_render_frame_t;
26
27/**
28 * WARNING: This call should be only used on platforms that don't
29 * allow creating separate rendering thread. If it is called before
30 * to bgfx_init, render thread won't be created by bgfx_init call.
31 */
32BGFX_C_API bgfx_render_frame_t bgfx_render_frame();
33
34#if BX_PLATFORM_ANDROID
35#    include <android/native_window.h>
36
37/**
38 *
39 */
40BGFX_C_API void bgfx_android_set_window(ANativeWindow* _window);
41
42#elif BX_PLATFORM_IOS
43
44/**
45 *
46 */
47BGFX_C_API void bgfx_ios_set_eagl_layer(void* _layer);
48
49#elif BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD
50#    include <X11/Xlib.h>
51
52/**
53 *
54 */
55BGFX_C_API void bgfx_x11_set_display_window(Display* _display, Window _window);
56
57#elif BX_PLATFORM_NACL
58#    include <ppapi/c/ppb_graphics_3d.h>
59#    include <ppapi/c/ppb_instance.h>
60
61typedef void (*bgfx_post_swap_buffers_fn)(uint32_t _width, uint32_t _height);
62
63/**
64 *
65 */
66BGFX_C_API bool bgfx_nacl_set_interfaces(PP_Instance, const PPB_Instance*, const PPB_Graphics3D*, bgfx_post_swap_buffers_fn);
67
68#elif BX_PLATFORM_OSX
69
70/**
71 *
72 */
73BGFX_C_API void bgfx_osx_set_ns_window(void* _window);
74
75#elif BX_PLATFORM_WINDOWS
76#    include <windows.h>
77
78/**
79 *
80 */
81BGFX_C_API void bgfx_win_set_hwnd(HWND _window);
82
83#endif // BX_PLATFORM_
84
85#endif // BGFX_PLATFORM_C99_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/include/bgfxplatform.c99.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/include/bgfxdefines.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_DEFINES_H_HEADER_GUARD
7#define BGFX_DEFINES_H_HEADER_GUARD
8
9///
10#define BGFX_STATE_RGB_WRITE             UINT64_C(0x0000000000000001)
11#define BGFX_STATE_ALPHA_WRITE           UINT64_C(0x0000000000000002)
12#define BGFX_STATE_DEPTH_WRITE           UINT64_C(0x0000000000000004)
13
14#define BGFX_STATE_DEPTH_TEST_LESS       UINT64_C(0x0000000000000010)
15#define BGFX_STATE_DEPTH_TEST_LEQUAL     UINT64_C(0x0000000000000020)
16#define BGFX_STATE_DEPTH_TEST_EQUAL      UINT64_C(0x0000000000000030)
17#define BGFX_STATE_DEPTH_TEST_GEQUAL     UINT64_C(0x0000000000000040)
18#define BGFX_STATE_DEPTH_TEST_GREATER    UINT64_C(0x0000000000000050)
19#define BGFX_STATE_DEPTH_TEST_NOTEQUAL   UINT64_C(0x0000000000000060)
20#define BGFX_STATE_DEPTH_TEST_NEVER      UINT64_C(0x0000000000000070)
21#define BGFX_STATE_DEPTH_TEST_ALWAYS     UINT64_C(0x0000000000000080)
22#define BGFX_STATE_DEPTH_TEST_SHIFT      4
23#define BGFX_STATE_DEPTH_TEST_MASK       UINT64_C(0x00000000000000f0)
24
25#define BGFX_STATE_BLEND_ZERO            UINT64_C(0x0000000000001000)
26#define BGFX_STATE_BLEND_ONE             UINT64_C(0x0000000000002000)
27#define BGFX_STATE_BLEND_SRC_COLOR       UINT64_C(0x0000000000003000)
28#define BGFX_STATE_BLEND_INV_SRC_COLOR   UINT64_C(0x0000000000004000)
29#define BGFX_STATE_BLEND_SRC_ALPHA       UINT64_C(0x0000000000005000)
30#define BGFX_STATE_BLEND_INV_SRC_ALPHA   UINT64_C(0x0000000000006000)
31#define BGFX_STATE_BLEND_DST_ALPHA       UINT64_C(0x0000000000007000)
32#define BGFX_STATE_BLEND_INV_DST_ALPHA   UINT64_C(0x0000000000008000)
33#define BGFX_STATE_BLEND_DST_COLOR       UINT64_C(0x0000000000009000)
34#define BGFX_STATE_BLEND_INV_DST_COLOR   UINT64_C(0x000000000000a000)
35#define BGFX_STATE_BLEND_SRC_ALPHA_SAT   UINT64_C(0x000000000000b000)
36#define BGFX_STATE_BLEND_FACTOR          UINT64_C(0x000000000000c000)
37#define BGFX_STATE_BLEND_INV_FACTOR      UINT64_C(0x000000000000d000)
38#define BGFX_STATE_BLEND_SHIFT           12
39#define BGFX_STATE_BLEND_MASK            UINT64_C(0x000000000ffff000)
40
41#define BGFX_STATE_BLEND_EQUATION_SUB    UINT64_C(0x0000000010000000)
42#define BGFX_STATE_BLEND_EQUATION_REVSUB UINT64_C(0x0000000020000000)
43#define BGFX_STATE_BLEND_EQUATION_MIN    UINT64_C(0x0000000030000000)
44#define BGFX_STATE_BLEND_EQUATION_MAX    UINT64_C(0x0000000040000000)
45#define BGFX_STATE_BLEND_EQUATION_SHIFT  28
46#define BGFX_STATE_BLEND_EQUATION_MASK   UINT64_C(0x00000003f0000000)
47
48#define BGFX_STATE_BLEND_INDEPENDENT     UINT64_C(0x0000000400000000)
49
50#define BGFX_STATE_CULL_CW               UINT64_C(0x0000001000000000)
51#define BGFX_STATE_CULL_CCW              UINT64_C(0x0000002000000000)
52#define BGFX_STATE_CULL_SHIFT            36
53#define BGFX_STATE_CULL_MASK             UINT64_C(0x0000003000000000)
54
55#define BGFX_STATE_ALPHA_REF_SHIFT       40
56#define BGFX_STATE_ALPHA_REF_MASK        UINT64_C(0x0000ff0000000000)
57
58#define BGFX_STATE_PT_TRISTRIP           UINT64_C(0x0001000000000000)
59#define BGFX_STATE_PT_LINES              UINT64_C(0x0002000000000000)
60#define BGFX_STATE_PT_POINTS             UINT64_C(0x0003000000000000)
61#define BGFX_STATE_PT_SHIFT              48
62#define BGFX_STATE_PT_MASK               UINT64_C(0x0003000000000000)
63
64#define BGFX_STATE_POINT_SIZE_SHIFT      52
65#define BGFX_STATE_POINT_SIZE_MASK       UINT64_C(0x0ff0000000000000)
66
67#define BGFX_STATE_MSAA                  UINT64_C(0x1000000000000000)
68
69#define BGFX_STATE_RESERVED_MASK         UINT64_C(0xe000000000000000)
70
71#define BGFX_STATE_NONE                  UINT64_C(0x0000000000000000)
72#define BGFX_STATE_MASK                  UINT64_C(0xffffffffffffffff)
73#define BGFX_STATE_DEFAULT (0 \
74               | BGFX_STATE_RGB_WRITE \
75               | BGFX_STATE_ALPHA_WRITE \
76               | BGFX_STATE_DEPTH_TEST_LESS \
77               | BGFX_STATE_DEPTH_WRITE \
78               | BGFX_STATE_CULL_CW \
79               | BGFX_STATE_MSAA \
80               )
81
82#define BGFX_STATE_ALPHA_REF(_ref) ( (uint64_t(_ref)<<BGFX_STATE_ALPHA_REF_SHIFT)&BGFX_STATE_ALPHA_REF_MASK)
83#define BGFX_STATE_POINT_SIZE(_size) ( (uint64_t(_size)<<BGFX_STATE_POINT_SIZE_SHIFT)&BGFX_STATE_POINT_SIZE_MASK)
84
85///
86#define BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA) (0 \
87               | ( (uint64_t(_srcRGB)|(uint64_t(_dstRGB)<<4) )   ) \
88               | ( (uint64_t(_srcA  )|(uint64_t(_dstA  )<<4) )<<8) \
89               )
90
91#define BGFX_STATE_BLEND_EQUATION_SEPARATE(_rgb, _a) (uint64_t(_rgb)|(uint64_t(_a)<<3) )
92
93///
94#define BGFX_STATE_BLEND_FUNC(_src, _dst)    BGFX_STATE_BLEND_FUNC_SEPARATE(_src, _dst, _src, _dst)
95#define BGFX_STATE_BLEND_EQUATION(_equation) BGFX_STATE_BLEND_EQUATION_SEPARATE(_equation, _equation)
96
97#define BGFX_STATE_BLEND_ADD         (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE,       BGFX_STATE_BLEND_ONE          ) )
98#define BGFX_STATE_BLEND_ALPHA       (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA) )
99#define BGFX_STATE_BLEND_DARKEN      (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE,       BGFX_STATE_BLEND_ONE          ) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_MIN) )
100#define BGFX_STATE_BLEND_LIGHTEN     (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE,       BGFX_STATE_BLEND_ONE          ) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_MAX) )
101#define BGFX_STATE_BLEND_MULTIPLY    (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_ZERO         ) )
102#define BGFX_STATE_BLEND_NORMAL      (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE,       BGFX_STATE_BLEND_INV_SRC_ALPHA) )
103#define BGFX_STATE_BLEND_SCREEN      (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_ONE,       BGFX_STATE_BLEND_INV_SRC_COLOR) )
104#define BGFX_STATE_BLEND_LINEAR_BURN (BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_DST_COLOR, BGFX_STATE_BLEND_INV_DST_COLOR) | BGFX_STATE_BLEND_EQUATION(BGFX_STATE_BLEND_EQUATION_SUB) )
105
106///
107#define BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) (0 \
108               | ( uint32_t( (_src)>>BGFX_STATE_BLEND_SHIFT) \
109               | ( uint32_t( (_dst)>>BGFX_STATE_BLEND_SHIFT)<<4) ) \
110               )
111
112#define BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation) (0 \
113               | BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst) \
114               | ( uint32_t( (_equation)>>BGFX_STATE_BLEND_EQUATION_SHIFT)<<8) \
115               )
116
117#define BGFX_STATE_BLEND_FUNC_RT_1(_src, _dst)  (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<< 0)
118#define BGFX_STATE_BLEND_FUNC_RT_2(_src, _dst)  (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<<11)
119#define BGFX_STATE_BLEND_FUNC_RT_3(_src, _dst)  (BGFX_STATE_BLEND_FUNC_RT_x(_src, _dst)<<22)
120
121#define BGFX_STATE_BLEND_FUNC_RT_1E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<< 0)
122#define BGFX_STATE_BLEND_FUNC_RT_2E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<<11)
123#define BGFX_STATE_BLEND_FUNC_RT_3E(_src, _dst, _equation) (BGFX_STATE_BLEND_FUNC_RT_xE(_src, _dst, _equation)<<22)
124
125///
126#define BGFX_STENCIL_FUNC_REF_SHIFT      0
127#define BGFX_STENCIL_FUNC_REF_MASK       UINT32_C(0x000000ff)
128#define BGFX_STENCIL_FUNC_RMASK_SHIFT    8
129#define BGFX_STENCIL_FUNC_RMASK_MASK     UINT32_C(0x0000ff00)
130
131#define BGFX_STENCIL_TEST_LESS           UINT32_C(0x00010000)
132#define BGFX_STENCIL_TEST_LEQUAL         UINT32_C(0x00020000)
133#define BGFX_STENCIL_TEST_EQUAL          UINT32_C(0x00030000)
134#define BGFX_STENCIL_TEST_GEQUAL         UINT32_C(0x00040000)
135#define BGFX_STENCIL_TEST_GREATER        UINT32_C(0x00050000)
136#define BGFX_STENCIL_TEST_NOTEQUAL       UINT32_C(0x00060000)
137#define BGFX_STENCIL_TEST_NEVER          UINT32_C(0x00070000)
138#define BGFX_STENCIL_TEST_ALWAYS         UINT32_C(0x00080000)
139#define BGFX_STENCIL_TEST_SHIFT          16
140#define BGFX_STENCIL_TEST_MASK           UINT32_C(0x000f0000)
141
142#define BGFX_STENCIL_OP_FAIL_S_ZERO      UINT32_C(0x00000000)
143#define BGFX_STENCIL_OP_FAIL_S_KEEP      UINT32_C(0x00100000)
144#define BGFX_STENCIL_OP_FAIL_S_REPLACE   UINT32_C(0x00200000)
145#define BGFX_STENCIL_OP_FAIL_S_INCR      UINT32_C(0x00300000)
146#define BGFX_STENCIL_OP_FAIL_S_INCRSAT   UINT32_C(0x00400000)
147#define BGFX_STENCIL_OP_FAIL_S_DECR      UINT32_C(0x00500000)
148#define BGFX_STENCIL_OP_FAIL_S_DECRSAT   UINT32_C(0x00600000)
149#define BGFX_STENCIL_OP_FAIL_S_INVERT    UINT32_C(0x00700000)
150#define BGFX_STENCIL_OP_FAIL_S_SHIFT     20
151#define BGFX_STENCIL_OP_FAIL_S_MASK      UINT32_C(0x00f00000)
152
153#define BGFX_STENCIL_OP_FAIL_Z_ZERO      UINT32_C(0x00000000)
154#define BGFX_STENCIL_OP_FAIL_Z_KEEP      UINT32_C(0x01000000)
155#define BGFX_STENCIL_OP_FAIL_Z_REPLACE   UINT32_C(0x02000000)
156#define BGFX_STENCIL_OP_FAIL_Z_INCR      UINT32_C(0x03000000)
157#define BGFX_STENCIL_OP_FAIL_Z_INCRSAT   UINT32_C(0x04000000)
158#define BGFX_STENCIL_OP_FAIL_Z_DECR      UINT32_C(0x05000000)
159#define BGFX_STENCIL_OP_FAIL_Z_DECRSAT   UINT32_C(0x06000000)
160#define BGFX_STENCIL_OP_FAIL_Z_INVERT    UINT32_C(0x07000000)
161#define BGFX_STENCIL_OP_FAIL_Z_SHIFT     24
162#define BGFX_STENCIL_OP_FAIL_Z_MASK      UINT32_C(0x0f000000)
163
164#define BGFX_STENCIL_OP_PASS_Z_ZERO      UINT32_C(0x00000000)
165#define BGFX_STENCIL_OP_PASS_Z_KEEP      UINT32_C(0x10000000)
166#define BGFX_STENCIL_OP_PASS_Z_REPLACE   UINT32_C(0x20000000)
167#define BGFX_STENCIL_OP_PASS_Z_INCR      UINT32_C(0x30000000)
168#define BGFX_STENCIL_OP_PASS_Z_INCRSAT   UINT32_C(0x40000000)
169#define BGFX_STENCIL_OP_PASS_Z_DECR      UINT32_C(0x50000000)
170#define BGFX_STENCIL_OP_PASS_Z_DECRSAT   UINT32_C(0x60000000)
171#define BGFX_STENCIL_OP_PASS_Z_INVERT    UINT32_C(0x70000000)
172#define BGFX_STENCIL_OP_PASS_Z_SHIFT     28
173#define BGFX_STENCIL_OP_PASS_Z_MASK      UINT32_C(0xf0000000)
174
175#define BGFX_STENCIL_NONE                UINT32_C(0x00000000)
176#define BGFX_STENCIL_MASK                UINT32_C(0xffffffff)
177#define BGFX_STENCIL_DEFAULT             UINT32_C(0x00000000)
178
179#define BGFX_STENCIL_FUNC_REF(_ref) ( (uint32_t(_ref)<<BGFX_STENCIL_FUNC_REF_SHIFT)&BGFX_STENCIL_FUNC_REF_MASK)
180#define BGFX_STENCIL_FUNC_RMASK(_mask) ( (uint32_t(_mask)<<BGFX_STENCIL_FUNC_RMASK_SHIFT)&BGFX_STENCIL_FUNC_RMASK_MASK)
181
182///
183#define BGFX_CLEAR_NONE                  UINT8_C(0x00)
184#define BGFX_CLEAR_COLOR_BIT             UINT8_C(0x01)
185#define BGFX_CLEAR_DEPTH_BIT             UINT8_C(0x02)
186#define BGFX_CLEAR_STENCIL_BIT           UINT8_C(0x04)
187
188///
189#define BGFX_DEBUG_NONE                  UINT32_C(0x00000000)
190#define BGFX_DEBUG_WIREFRAME             UINT32_C(0x00000001)
191#define BGFX_DEBUG_IFH                   UINT32_C(0x00000002)
192#define BGFX_DEBUG_STATS                 UINT32_C(0x00000004)
193#define BGFX_DEBUG_TEXT                  UINT32_C(0x00000008)
194
195///
196#define BGFX_TEXTURE_NONE                UINT32_C(0x00000000)
197#define BGFX_TEXTURE_U_MIRROR            UINT32_C(0x00000001)
198#define BGFX_TEXTURE_U_CLAMP             UINT32_C(0x00000002)
199#define BGFX_TEXTURE_U_SHIFT             0
200#define BGFX_TEXTURE_U_MASK              UINT32_C(0x00000003)
201#define BGFX_TEXTURE_V_MIRROR            UINT32_C(0x00000004)
202#define BGFX_TEXTURE_V_CLAMP             UINT32_C(0x00000008)
203#define BGFX_TEXTURE_V_SHIFT             2
204#define BGFX_TEXTURE_V_MASK              UINT32_C(0x0000000c)
205#define BGFX_TEXTURE_W_MIRROR            UINT32_C(0x00000010)
206#define BGFX_TEXTURE_W_CLAMP             UINT32_C(0x00000020)
207#define BGFX_TEXTURE_W_SHIFT             4
208#define BGFX_TEXTURE_W_MASK              UINT32_C(0x00000030)
209#define BGFX_TEXTURE_MIN_POINT           UINT32_C(0x00000040)
210#define BGFX_TEXTURE_MIN_ANISOTROPIC     UINT32_C(0x00000080)
211#define BGFX_TEXTURE_MIN_SHIFT           6
212#define BGFX_TEXTURE_MIN_MASK            UINT32_C(0x000000c0)
213#define BGFX_TEXTURE_MAG_POINT           UINT32_C(0x00000100)
214#define BGFX_TEXTURE_MAG_ANISOTROPIC     UINT32_C(0x00000200)
215#define BGFX_TEXTURE_MAG_SHIFT           8
216#define BGFX_TEXTURE_MAG_MASK            UINT32_C(0x00000300)
217#define BGFX_TEXTURE_MIP_POINT           UINT32_C(0x00000400)
218#define BGFX_TEXTURE_MIP_SHIFT           10
219#define BGFX_TEXTURE_MIP_MASK            UINT32_C(0x00000400)
220#define BGFX_TEXTURE_RT                  UINT32_C(0x00001000)
221#define BGFX_TEXTURE_RT_MSAA_X2          UINT32_C(0x00002000)
222#define BGFX_TEXTURE_RT_MSAA_X4          UINT32_C(0x00003000)
223#define BGFX_TEXTURE_RT_MSAA_X8          UINT32_C(0x00004000)
224#define BGFX_TEXTURE_RT_MSAA_X16         UINT32_C(0x00005000)
225#define BGFX_TEXTURE_RT_MSAA_SHIFT       12
226#define BGFX_TEXTURE_RT_MSAA_MASK        UINT32_C(0x00007000)
227#define BGFX_TEXTURE_RT_BUFFER_ONLY      UINT32_C(0x00008000)
228#define BGFX_TEXTURE_RT_MASK             UINT32_C(0x0000f000)
229#define BGFX_TEXTURE_COMPARE_LESS        UINT32_C(0x00010000)
230#define BGFX_TEXTURE_COMPARE_LEQUAL      UINT32_C(0x00020000)
231#define BGFX_TEXTURE_COMPARE_EQUAL       UINT32_C(0x00030000)
232#define BGFX_TEXTURE_COMPARE_GEQUAL      UINT32_C(0x00040000)
233#define BGFX_TEXTURE_COMPARE_GREATER     UINT32_C(0x00050000)
234#define BGFX_TEXTURE_COMPARE_NOTEQUAL    UINT32_C(0x00060000)
235#define BGFX_TEXTURE_COMPARE_NEVER       UINT32_C(0x00070000)
236#define BGFX_TEXTURE_COMPARE_ALWAYS      UINT32_C(0x00080000)
237#define BGFX_TEXTURE_COMPARE_SHIFT       16
238#define BGFX_TEXTURE_COMPARE_MASK        UINT32_C(0x000f0000)
239#define BGFX_TEXTURE_COMPUTE_WRITE       UINT32_C(0x00100000)
240#define BGFX_TEXTURE_RESERVED_SHIFT      24
241#define BGFX_TEXTURE_RESERVED_MASK       UINT32_C(0xff000000)
242
243#define BGFX_TEXTURE_SAMPLER_BITS_MASK (0 \
244         | BGFX_TEXTURE_U_MASK \
245         | BGFX_TEXTURE_V_MASK \
246         | BGFX_TEXTURE_W_MASK \
247         | BGFX_TEXTURE_MIN_MASK \
248         | BGFX_TEXTURE_MAG_MASK \
249         | BGFX_TEXTURE_MIP_MASK \
250         | BGFX_TEXTURE_COMPARE_MASK \
251         )
252
253///
254#define BGFX_RESET_NONE                  UINT32_C(0x00000000)
255#define BGFX_RESET_FULLSCREEN            UINT32_C(0x00000001)
256#define BGFX_RESET_FULLSCREEN_SHIFT      0
257#define BGFX_RESET_FULLSCREEN_MASK       UINT32_C(0x00000001)
258#define BGFX_RESET_MSAA_X2               UINT32_C(0x00000010)
259#define BGFX_RESET_MSAA_X4               UINT32_C(0x00000020)
260#define BGFX_RESET_MSAA_X8               UINT32_C(0x00000030)
261#define BGFX_RESET_MSAA_X16              UINT32_C(0x00000040)
262#define BGFX_RESET_MSAA_SHIFT            4
263#define BGFX_RESET_MSAA_MASK             UINT32_C(0x00000070)
264#define BGFX_RESET_VSYNC                 UINT32_C(0x00000080)
265#define BGFX_RESET_CAPTURE               UINT32_C(0x00000100)
266
267///
268#define BGFX_CAPS_TEXTURE_COMPARE_LEQUAL UINT64_C(0x0000000000000001)
269#define BGFX_CAPS_TEXTURE_COMPARE_ALL    UINT64_C(0x0000000000000003)
270#define BGFX_CAPS_TEXTURE_3D             UINT64_C(0x0000000000000004)
271#define BGFX_CAPS_VERTEX_ATTRIB_HALF     UINT64_C(0x0000000000000008)
272#define BGFX_CAPS_INSTANCING             UINT64_C(0x0000000000000010)
273#define BGFX_CAPS_RENDERER_MULTITHREADED UINT64_C(0x0000000000000020)
274#define BGFX_CAPS_FRAGMENT_DEPTH         UINT64_C(0x0000000000000040)
275#define BGFX_CAPS_BLEND_INDEPENDENT      UINT64_C(0x0000000000000080)
276#define BGFX_CAPS_COMPUTE                UINT64_C(0x0000000000000100)
277#define BGFX_CAPS_FRAGMENT_ORDERING      UINT64_C(0x0000000000000200)
278
279#endif // BGFX_DEFINES_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/include/bgfxdefines.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/include/bgfx.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
4 */
5
6#ifndef BGFX_H_HEADER_GUARD
7#define BGFX_H_HEADER_GUARD
8
9#include <stdint.h> // uint32_t
10#include <stdlib.h> // size_t
11
12#include "bgfxdefines.h"
13
14///
15#define BGFX_HANDLE(_name) \
16         struct _name { uint16_t idx; }; \
17         inline bool isValid(_name _handle) { return bgfx::invalidHandle != _handle.idx; }
18
19#define BGFX_INVALID_HANDLE { bgfx::invalidHandle }
20
21namespace bx { struct ReallocatorI; }
22
23/// BGFX
24namespace bgfx
25{
26   struct Fatal
27   {
28      enum Enum
29      {
30         DebugCheck,
31         MinimumRequiredSpecs,
32         InvalidShader,
33         UnableToInitialize,
34         UnableToCreateTexture,
35      };
36   };
37
38   struct RendererType
39   {
40      enum Enum
41      {
42         Null,
43         Direct3D9,
44         Direct3D11,
45         OpenGLES,
46         OpenGL,
47
48         Count
49      };
50   };
51
52   struct Access
53   {
54      enum Enum
55      {
56         Read,
57         Write,
58         ReadWrite,
59
60         Count
61      };
62   };
63
64   struct Attrib
65   {
66      enum Enum // corresponds to vertex shader attribute:
67      {
68         Position,  // a_position
69         Normal,    // a_normal
70         Tangent,   // a_tangent
71         Bitangent, // a_bitangent
72         Color0,    // a_color0
73         Color1,    // a_color1
74         Indices,   // a_indices
75         Weight,    // a_weight
76         TexCoord0, // a_texcoord0
77         TexCoord1, // a_texcoord1
78         TexCoord2, // a_texcoord2
79         TexCoord3, // a_texcoord3
80         TexCoord4, // a_texcoord4
81         TexCoord5, // a_texcoord5
82         TexCoord6, // a_texcoord6
83         TexCoord7, // a_texcoord7
84
85         Count
86      };
87   };
88
89   struct AttribType
90   {
91      enum Enum
92      {
93         Uint8,
94         Int16,
95         Half, // Availability depends on: BGFX_CAPS_VERTEX_ATTRIB_HALF.
96         Float,
97
98         Count
99      };
100   };
101
102   struct TextureFormat
103   {
104      // Availability depends on Caps (see: formats).
105      enum Enum
106      {
107         BC1,    // DXT1
108         BC2,    // DXT3
109         BC3,    // DXT5
110         BC4,    // LATC1/ATI1
111         BC5,    // LATC2/ATI2
112         BC6H,   // BC6H
113         BC7,    // BC7
114         ETC1,   // ETC1 RGB8
115         ETC2,   // ETC2 RGB8
116         ETC2A,  // ETC2 RGBA8
117         ETC2A1, // ETC2 RGB8A1
118         PTC12,  // PVRTC1 RGB 2BPP
119         PTC14,  // PVRTC1 RGB 4BPP
120         PTC12A, // PVRTC1 RGBA 2BPP
121         PTC14A, // PVRTC1 RGBA 4BPP
122         PTC22,  // PVRTC2 RGBA 2BPP
123         PTC24,  // PVRTC2 RGBA 4BPP
124
125         Unknown, // compressed formats above
126
127         R1,
128         R8,
129         R16,
130         R16F,
131         R32,
132         R32F,
133         RG8,
134         RG16,
135         RG16F,
136         RG32,
137         RG32F,
138         BGRA8,
139         RGBA16,
140         RGBA16F,
141         RGBA32,
142         RGBA32F,
143         R5G6B5,
144         RGBA4,
145         RGB5A1,
146         RGB10A2,
147
148         UnknownDepth, // depth formats below
149
150         D16,
151         D24,
152         D24S8,
153         D32,
154         D16F,
155         D24F,
156         D32F,
157         D0S8,
158         
159         Count
160      };
161   };
162
163   struct UniformType
164   {
165      enum Enum
166      {
167         Uniform1i,
168         Uniform1f,
169         End,
170
171         Uniform1iv,
172         Uniform1fv,
173         Uniform2fv,
174         Uniform3fv,
175         Uniform4fv,
176         Uniform3x3fv,
177         Uniform4x4fv,
178
179         Count
180      };
181   };
182
183   static const uint16_t invalidHandle = UINT16_MAX;
184
185   BGFX_HANDLE(DynamicIndexBufferHandle);
186   BGFX_HANDLE(DynamicVertexBufferHandle);
187   BGFX_HANDLE(FrameBufferHandle);
188   BGFX_HANDLE(IndexBufferHandle);
189   BGFX_HANDLE(ProgramHandle);
190   BGFX_HANDLE(ShaderHandle);
191   BGFX_HANDLE(TextureHandle);
192   BGFX_HANDLE(UniformHandle);
193   BGFX_HANDLE(VertexBufferHandle);
194   BGFX_HANDLE(VertexDeclHandle);
195
196   /// Callback interface to implement application specific behavior.
197   /// Cached items are currently used only for OpenGL binary shaders.
198   ///
199   /// NOTE:
200   ///   'fatal' callback can be called from any thread. Other callbacks
201   ///   are called from the render thread.
202   ///
203   struct CallbackI
204   {
205      virtual ~CallbackI() = 0;
206
207      /// If fatal code code is not Fatal::DebugCheck this callback is
208      /// called on unrecoverable error. It's not safe to continue, inform
209      /// user and terminate application from this call.
210      virtual void fatal(Fatal::Enum _code, const char* _str) = 0;
211
212      /// Return size of for cached item. Return 0 if no cached item was
213      /// found.
214      virtual uint32_t cacheReadSize(uint64_t _id) = 0;
215
216      /// Read cached item.
217      virtual bool cacheRead(uint64_t _id, void* _data, uint32_t _size) = 0;
218
219      /// Write cached item.
220      virtual void cacheWrite(uint64_t _id, const void* _data, uint32_t _size) = 0;
221
222      /// Screenshot captured. Screenshot format is always 4-byte BGRA.
223      virtual void screenShot(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data, uint32_t _size, bool _yflip) = 0;
224
225      /// Called when capture begins.
226      virtual void captureBegin(uint32_t _width, uint32_t _height, uint32_t _pitch, TextureFormat::Enum _format, bool _yflip) = 0;
227
228      /// Called when capture ends.
229      virtual void captureEnd() = 0;
230
231      /// Captured frame.
232      virtual void captureFrame(const void* _data, uint32_t _size) = 0;
233   };
234
235   inline CallbackI::~CallbackI()
236   {
237   }
238
239   struct Memory
240   {
241      uint8_t* data;
242      uint32_t size;
243   };
244
245   /// Renderer capabilities.
246   struct Caps
247   {
248      /// Renderer backend type.
249      RendererType::Enum rendererType;
250
251      /// Supported functionality, it includes emulated functionality.
252      /// Checking supported and not emulated will give functionality
253      /// natively supported by renderer.
254      uint64_t supported;
255
256      /// Emulated functionality. For example some texture compression
257      /// modes are not natively supported by all renderers. The library
258      /// internally decompresses texture into supported format.
259      uint64_t emulated;
260
261      uint16_t maxTextureSize;   ///< Maximum texture size.
262      uint16_t maxDrawCalls;     ///< Maximum draw calls.
263      uint8_t  maxFBAttachments; ///< Maximum frame buffer attachments.
264
265      /// Supported texture formats.
266      ///   0 - not supported
267      ///   1 - supported
268      ///   2 - emulated
269      uint8_t formats[TextureFormat::Count];
270   };
271
272   struct TransientIndexBuffer
273   {
274      uint8_t* data;
275      uint32_t size;
276      IndexBufferHandle handle;
277      uint32_t startIndex;
278   };
279
280   struct TransientVertexBuffer
281   {
282      uint8_t* data;
283      uint32_t size;
284      uint32_t startVertex;
285      uint16_t stride;
286      VertexBufferHandle handle;
287      VertexDeclHandle decl;
288   };
289
290   struct InstanceDataBuffer
291   {
292      uint8_t* data;
293      uint32_t size;
294      uint32_t offset;
295      uint16_t stride;
296      uint16_t num;
297      VertexBufferHandle handle;
298   };
299
300   struct TextureInfo
301   {
302      TextureFormat::Enum format;
303      uint32_t storageSize;
304      uint16_t width;
305      uint16_t height;
306      uint16_t depth;
307      uint8_t numMips;
308      uint8_t bitsPerPixel;
309   };
310
311   /// Vertex declaration.
312   struct VertexDecl
313   {
314      VertexDecl();
315
316      /// Start VertexDecl.
317      VertexDecl& begin(RendererType::Enum _renderer = RendererType::Null);
318
319      /// End VertexDecl.
320      void end();
321
322      /// Add attribute to VertexDecl.
323      ///
324      /// @param _attrib Attribute semantics.
325      /// @param _num Number of elements 1, 2, 3 or 4.
326      /// @param _type Element type.
327      /// @param _normalized When using fixed point AttribType (f.e. Uint8)
328      ///   value will be normalized for vertex shader usage. When normalized
329      ///   is set to true, AttribType::Uint8 value in range 0-255 will be
330      ///   in range 0.0-1.0 in vertex shader.
331      /// @param _asInt Packaging rule for vertexPack, vertexUnpack, and
332      ///   vertexConvert for AttribType::Uint8 and AttribType::Int16.
333      ///   Unpacking code must be implemented inside vertex shader.
334      ///
335      /// NOTE:
336      ///   Must be called between begin/end.
337      ///
338      VertexDecl& add(Attrib::Enum _attrib, uint8_t _num, AttribType::Enum _type, bool _normalized = false, bool _asInt = false);
339
340      /// Skip _num bytes in vertex stream.
341      VertexDecl& skip(uint8_t _num);
342
343      /// Decode attribute.
344      void decode(Attrib::Enum _attrib, uint8_t& _num, AttribType::Enum& _type, bool& _normalized, bool& _asInt) const;
345
346      /// Returns true if VertexDecl contains attribute.
347      bool has(Attrib::Enum _attrib) const { return 0xff != m_attributes[_attrib]; }
348
349      /// Returns relative attribute offset from the vertex.
350      uint16_t getOffset(Attrib::Enum _attrib) const { return m_offset[_attrib]; }
351
352      /// Returns vertex stride.
353      uint16_t getStride() const { return m_stride; }
354
355      /// Returns size of vertex buffer for number of vertices.
356      uint32_t getSize(uint32_t _num) const { return _num*m_stride; }
357
358      uint32_t m_hash;
359      uint16_t m_stride;
360      uint16_t m_offset[Attrib::Count];
361      uint8_t m_attributes[Attrib::Count];
362   };
363
364   /// Pack vec4 into vertex stream format.
365   void vertexPack(const float _input[4], bool _inputNormalized, Attrib::Enum _attr, const VertexDecl& _decl, void* _data, uint32_t _index = 0);
366
367   /// Unpack vec4 from vertex stream format.
368   void vertexUnpack(float _output[4], Attrib::Enum _attr, const VertexDecl& _decl, const void* _data, uint32_t _index = 0);
369
370   /// Converts vertex stream data from one vertex stream format to another.
371   ///
372   /// @param _destDecl Destination vertex stream declaration.
373   /// @param _destData Destination vertex stream.
374   /// @param _srcDecl Source vertex stream declaration.
375   /// @param _srcData Source vertex stream data.
376   /// @param _num Number of vertices to convert from source to destination.
377   ///
378   void vertexConvert(const VertexDecl& _destDecl, void* _destData, const VertexDecl& _srcDecl, const void* _srcData, uint32_t _num = 1);
379
380   /// Weld vertices.
381   ///
382   /// @param _output Welded vertices remapping table. The size of buffer
383   ///   must be the same as number of vertices.
384   /// @param _decl Vertex stream declaration.
385   /// @param _data Vertex stream.
386   /// @param _num Number of vertices in vertex stream.
387   /// @param _epsilon Error tolerance for vertex position comparison.
388   /// @returns Number of unique vertices after vertex welding.
389   ///
390   uint16_t weldVertices(uint16_t* _output, const VertexDecl& _decl, const void* _data, uint16_t _num, float _epsilon = 0.001f);
391
392   /// Swizzle RGBA8 image to BGRA8.
393   ///
394   /// @param _width Width of input image (pixels).
395   /// @param _height Height of input image (pixels).
396   /// @param _pitch Pitch of input image (bytes).
397   /// @param _src Source image.
398   /// @param _dst Destination image. Must be the same size as input image.
399   ///   _dst might be pointer to the same memory as _src.
400   ///
401   void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
402
403   /// Downsample RGBA8 image with 2x2 pixel average filter.
404   ///
405   /// @param _width Width of input image (pixels).
406   /// @param _height Height of input image (pixels).
407   /// @param _pitch Pitch of input image (bytes).
408   /// @param _src Source image.
409   /// @param _dst Destination image. Must be at least quarter size of
410   ///   input image. _dst might be pointer to the same memory as _src.
411   ///
412   void imageRgba8Downsample2x2(uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _src, void* _dst);
413
414   /// Returns supported backend API renderers.
415   uint8_t getSupportedRenderers(RendererType::Enum _enum[RendererType::Count]);
416
417   /// Returns name of renderer.
418   const char* getRendererName(RendererType::Enum _type);
419
420   /// Initialize bgfx library.
421   ///
422   /// @param _type Select rendering backend. When set to RendererType::Count
423   ///   default rendering backend will be selected.
424   ///
425   /// @param _callback Provide application specific callback interface.
426   ///   See: CallbackI
427   ///
428   /// @param _reallocator Custom allocator. When custom allocator is not
429   ///   specified, library uses default CRT allocator. The library assumes
430   ///   custom allocator is thread safe.
431   ///
432   void init(RendererType::Enum _type = RendererType::Count, CallbackI* _callback = NULL, bx::ReallocatorI* _reallocator = NULL);
433
434   /// Shutdown bgfx library.
435   void shutdown();
436
437   /// Reset graphic settings.
438   void reset(uint32_t _width, uint32_t _height, uint32_t _flags = BGFX_RESET_NONE);
439
440   /// Advance to next frame. When using multithreaded renderer, this call
441   /// just swaps internal buffers, kicks render thread, and returns. In
442   /// singlethreaded renderer this call does frame rendering.
443   ///
444   /// @returns Current frame number. This might be used in conjunction with
445   ///   double/multi buffering data outside the library and passing it to
446   ///   library via makeRef calls.
447   ///
448   uint32_t frame();
449
450   /// Returns current renderer backend API type.
451   ///
452   /// NOTE:
453   ///   Library must be initialized.
454   ///
455   RendererType::Enum getRendererType();
456
457   /// Returns renderer capabilities.
458   ///
459   /// NOTE:
460   ///   Library must be initialized.
461   ///
462   const Caps* getCaps();
463
464   /// Allocate buffer to pass to bgfx calls. Data will be freed inside bgfx.
465   const Memory* alloc(uint32_t _size);
466
467   /// Allocate buffer and copy data into it. Data will be freed inside bgfx.
468   const Memory* copy(const void* _data, uint32_t _size);
469
470   /// Make reference to data to pass to bgfx. Unlike bgfx::alloc this call
471   /// doesn't allocate memory for data. It just copies pointer to data.
472   /// You must make sure data is available for at least 2 bgfx::frame calls.
473   const Memory* makeRef(const void* _data, uint32_t _size);
474
475   /// Set debug flags.
476   ///
477   /// @param _debug Available flags:
478   ///
479   ///   BGFX_DEBUG_IFH - Infinitely fast hardware. When this flag is set
480   ///     all rendering calls will be skipped. It's useful when profiling
481   ///     to quickly assess bottleneck between CPU and GPU.
482   ///
483   ///   BGFX_DEBUG_STATS - Display internal statistics.
484   ///
485   ///   BGFX_DEBUG_TEXT - Display debug text.
486   ///
487   ///   BGFX_DEBUG_WIREFRAME - Wireframe rendering. All rendering
488   ///     primitives will be rendered as lines.
489   ///
490   void setDebug(uint32_t _debug);
491
492   /// Clear internal debug text buffer.
493   void dbgTextClear(uint8_t _attr = 0, bool _small = false);
494
495   /// Print into internal debug text buffer.
496   void dbgTextPrintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...);
497
498   /// Create static index buffer.
499   ///
500   /// NOTE:
501   ///   Only 16-bit index buffer is supported.
502   ///
503   IndexBufferHandle createIndexBuffer(const Memory* _mem);
504
505   /// Destroy static index buffer.
506   void destroyIndexBuffer(IndexBufferHandle _handle);
507
508   /// Create static vertex buffer.
509   ///
510   /// @param _mem Vertex buffer data.
511   /// @param _decl Vertex declaration.
512   /// @returns Static vertex buffer handle.
513   ///
514   VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl);
515
516   /// Destroy static vertex buffer.
517   ///
518   /// @param _handle Static vertex buffer handle.
519   ///
520   void destroyVertexBuffer(VertexBufferHandle _handle);
521
522   /// Create empty dynamic index buffer.
523   ///
524   /// @param _num Number of indices.
525   ///
526   /// NOTE:
527   ///   Only 16-bit index buffer is supported.
528   ///
529   DynamicIndexBufferHandle createDynamicIndexBuffer(uint32_t _num);
530
531   /// Create dynamic index buffer and initialized it.
532   ///
533   /// @param _mem Index buffer data.
534   ///
535   /// NOTE:
536   ///   Only 16-bit index buffer is supported.
537   ///
538   DynamicIndexBufferHandle createDynamicIndexBuffer(const Memory* _mem);
539
540   /// Update dynamic index buffer.
541   ///
542   /// @param _handle Dynamic index buffer handle.
543   /// @param _mem Index buffer data.
544   ///
545   void updateDynamicIndexBuffer(DynamicIndexBufferHandle _handle, const Memory* _mem);
546
547   /// Destroy dynamic index buffer.
548   ///
549   /// @param _handle Dynamic index buffer handle.
550   ///
551   void destroyDynamicIndexBuffer(DynamicIndexBufferHandle _handle);
552
553   /// Create empty dynamic vertex buffer.
554   ///
555   /// @param _num Number of vertices.
556   /// @param _decl Vertex declaration.
557   ///
558   DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl);
559
560   /// Create dynamic vertex buffer and initialize it.
561   ///
562   /// @param _mem Vertex buffer data.
563   /// @param _decl Vertex declaration.
564   ///
565   DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl);
566
567   /// Update dynamic vertex buffer.
568   void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, const Memory* _mem);
569
570   /// Destroy dynamic vertex buffer.
571   void destroyDynamicVertexBuffer(DynamicVertexBufferHandle _handle);
572
573   /// Returns true if internal transient index buffer has enough space.
574   ///
575   /// @param _num Number of indices.
576   ///
577   bool checkAvailTransientIndexBuffer(uint32_t _num);
578
579   /// Returns true if internal transient vertex buffer has enough space.
580   ///
581   /// @param _num Number of vertices.
582   /// @param _decl Vertex declaration.
583   ///
584   bool checkAvailTransientVertexBuffer(uint32_t _num, const VertexDecl& _decl);
585
586   /// Returns true if internal instance data buffer has enough space.
587   ///
588   /// @param _num Number of instances.
589   /// @param _stride Stride per instance.
590   ///
591   bool checkAvailInstanceDataBuffer(uint32_t _num, uint16_t _stride);
592
593   /// Returns true if both internal transient index and vertex buffer have
594   /// enough space.
595   ///
596   /// @param _numVertices Number of vertices.
597   /// @param _decl Vertex declaration.
598   /// @param _numIndices Number of indices.
599   ///
600   bool checkAvailTransientBuffers(uint32_t _numVertices, const VertexDecl& _decl, uint32_t _numIndices);
601
602   /// Allocate transient index buffer.
603   ///
604   /// @param[out] _tib TransientIndexBuffer structure is filled and is valid
605   ///   for the duration of frame, and it can be reused for multiple draw
606   ///   calls.
607   /// @param _num Number of indices to allocate.
608   ///
609   /// NOTE:
610   ///   1. You must call setIndexBuffer after alloc in order to avoid memory
611   ///      leak.
612   ///   2. Only 16-bit index buffer is supported.
613   ///
614   void allocTransientIndexBuffer(TransientIndexBuffer* _tib, uint32_t _num);
615
616   /// Allocate transient vertex buffer.
617   ///
618   /// @param[out] _tvb TransientVertexBuffer structure is filled and is valid
619   ///   for the duration of frame, and it can be reused for multiple draw
620   ///   calls.
621   /// @param _num Number of vertices to allocate.
622   /// @param _decl Vertex declaration.
623   ///
624   /// NOTE:
625   ///   You must call setVertexBuffer after alloc in order to avoid memory
626   ///   leak.
627   ///
628   void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, const VertexDecl& _decl);
629
630   /// Check for required space and allocate transient vertex and index
631   /// buffers. If both space requirements are satisfied function returns
632   /// true.
633   ///
634   /// NOTE:
635   ///   Only 16-bit index buffer is supported.
636   ///
637   bool allocTransientBuffers(TransientVertexBuffer* _tvb, const VertexDecl& _decl, uint16_t _numVertices, TransientIndexBuffer* _tib, uint16_t _numIndices);
638
639   /// Allocate instance data buffer.
640   ///
641   /// NOTE:
642   ///   You must call setInstanceDataBuffer after alloc in order to avoid
643   ///   memory leak.
644   ///
645   const InstanceDataBuffer* allocInstanceDataBuffer(uint32_t _num, uint16_t _stride);
646
647   /// Create shader from memory buffer.
648   ShaderHandle createShader(const Memory* _mem);
649
650   /// Returns num of uniforms, and uniform handles used inside shader.
651   ///
652   /// @param _handle Shader handle.
653   /// @param _uniforms UniformHandle array where data will be stored.
654   /// @param _max Maximum capacity of array.
655   /// @returns Number of uniforms used by shader.
656   ///
657   /// NOTE:
658   ///   Only non-predefined uniforms are returned.
659   ///
660   uint16_t getShaderUniforms(ShaderHandle _handle, UniformHandle* _uniforms = NULL, uint16_t _max = 0);
661
662   /// Destroy shader. Once program is created with shader it is safe to
663   /// destroy shader.
664   void destroyShader(ShaderHandle _handle);
665
666   /// Create program with vertex and fragment shaders.
667   ///
668   /// @param _vsh Vertex shader.
669   /// @param _fsh Fragment shader.
670   /// @param _destroyShaders If true, shaders will be destroyed when
671   ///   program is destroyed.
672   /// @returns Program handle if vertex shader output and fragment shader
673   ///   input are matching, otherwise returns invalid program handle.
674   ///
675   ProgramHandle createProgram(ShaderHandle _vsh, ShaderHandle _fsh, bool _destroyShaders = false);
676
677   /// Destroy program.
678   void destroyProgram(ProgramHandle _handle);
679
680   /// Calculate amount of memory required for texture.
681   void calcTextureSize(TextureInfo& _info, uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, TextureFormat::Enum _format);
682
683   /// Create texture from memory buffer.
684   ///
685   /// @param _mem DDS, KTX or PVR texture data.
686   /// @param _flags Default texture sampling mode is linear, and wrap mode
687   ///   is repeat.
688   ///
689   ///   BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap
690   ///     mode.
691   ///
692   ///   BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic
693   ///     sampling.
694   ///
695   /// @param _skip Skip top level mips when parsing texture.
696   /// @param _info Returns parsed texture information.
697   /// @returns Texture handle.
698   ///
699   TextureHandle createTexture(const Memory* _mem, uint32_t _flags = BGFX_TEXTURE_NONE, uint8_t _skip = 0, TextureInfo* _info = NULL);
700
701   /// Create 2D texture.
702   ///
703   /// @param _width
704   /// @param _height
705   /// @param _numMips
706   /// @param _format
707   /// @param _flags
708   /// @param _mem
709   ///
710   TextureHandle createTexture2D(uint16_t _width, uint16_t _height, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags = BGFX_TEXTURE_NONE, const Memory* _mem = NULL);
711
712   /// Create 3D texture.
713   ///
714   /// @param _width
715   /// @param _height
716   /// @param _depth
717   /// @param _numMips
718   /// @param _format
719   /// @param _flags
720   /// @param _mem
721   ///
722   TextureHandle createTexture3D(uint16_t _width, uint16_t _height, uint16_t _depth, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags = BGFX_TEXTURE_NONE, const Memory* _mem = NULL);
723
724   /// Create Cube texture.
725   ///
726   /// @param _size
727   /// @param _numMips
728   /// @param _format
729   /// @param _flags
730   /// @param _mem
731   ///
732   TextureHandle createTextureCube(uint16_t _size, uint8_t _numMips, TextureFormat::Enum _format, uint32_t _flags = BGFX_TEXTURE_NONE, const Memory* _mem = NULL);
733
734   /// Update 2D texture.
735   ///
736   /// @param _handle
737   /// @param _mip
738   /// @param _x
739   /// @param _y
740   /// @param _width
741   /// @param _height
742   /// @param _mem
743   /// @param _pitch Pitch of input image (bytes). When _pitch is set to
744   ///   UINT16_MAX, it will be calculated internally based on _width.
745   ///
746   void updateTexture2D(TextureHandle _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch = UINT16_MAX);
747
748   /// Update 3D texture.
749   ///
750   /// @param _handle
751   /// @param _mip
752   /// @param _x
753   /// @param _y
754   /// @param _z
755   /// @param _width
756   /// @param _height
757   /// @param _depth
758   /// @param _mem
759   ///
760   void updateTexture3D(TextureHandle _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const Memory* _mem);
761
762   /// Update Cube texture.
763   ///
764   /// @param _handle
765   /// @param _side Cubemap side, where 0 is +X, 1 is -X, 2 is +Y, 3 is
766   ///   -Y, 4 is +Z, and 5 is -Z.
767   ///
768   ///              +----------+
769   ///              |-z       2|
770   ///              | ^  +y    |
771   ///              | |        |
772   ///              | +---->+x |
773   ///   +----------+----------+----------+----------+
774   ///   |+y       1|+y       4|+y       0|+y       5|
775   ///   | ^  -x    | ^  +z    | ^  +x    | ^  -z    |
776   ///   | |        | |        | |        | |        |
777   ///   | +---->+z | +---->+x | +---->-z | +---->-x |
778   ///   +----------+----------+----------+----------+
779   ///              |+z       3|
780   ///              | ^  -y    |
781   ///              | |        |
782   ///              | +---->+x |
783   ///              +----------+
784   ///
785   /// @param _mip
786   /// @param _x
787   /// @param _y
788   /// @param _width
789   /// @param _height
790   /// @param _mem
791   /// @param _pitch Pitch of input image (bytes). When _pitch is set to
792   ///   UINT16_MAX, it will be calculated internally based on _width.
793   ///
794   void updateTextureCube(TextureHandle _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem, uint16_t _pitch = UINT16_MAX);
795
796   /// Destroy texture.
797   void destroyTexture(TextureHandle _handle);
798
799   /// Create frame buffer (simple).
800   ///
801   /// @param _width Texture width.
802   /// @param _height Texture height.
803   /// @param _format Texture format.
804   /// @param _textureFlags Texture flags.
805   ///
806   FrameBufferHandle createFrameBuffer(uint16_t _width, uint16_t _height, TextureFormat::Enum _format, uint32_t _textureFlags = BGFX_TEXTURE_U_CLAMP|BGFX_TEXTURE_V_CLAMP);
807
808   /// Create frame buffer.
809   ///
810   /// @param _num Number of texture attachments.
811   /// @param _handles Texture attachments.
812   /// @param _destroyTextures If true, textures will be destroyed when
813   ///   frame buffer is destroyed.
814   ///
815   FrameBufferHandle createFrameBuffer(uint8_t _num, TextureHandle* _handles, bool _destroyTextures = false);
816
817   /// Destroy frame buffer.
818   void destroyFrameBuffer(FrameBufferHandle _handle);
819
820   /// Create shader uniform parameter.
821   ///
822   /// @param _name Uniform name in shader.
823   /// @param _type Type of uniform (See: UniformType).
824   /// @param _num Number of elements in array.
825   ///
826   /// Predefined uniforms:
827   ///
828   ///   u_viewRect vec4(x, y, width, height) - view rectangle for current
829   ///     view.
830   ///
831   ///   u_viewTexel vec4(1.0/width, 1.0/height, undef, undef) - inverse
832   ///     width and height
833   ///
834   ///   u_view mat4 - view matrix
835   ///
836   ///   u_invView mat4 - inverted view matrix
837   ///
838   ///   u_proj mat4 - projection matrix
839   ///
840   ///   u_invProj mat4 - inverted projection matrix
841   ///
842   ///   u_viewProj mat4 - concatenated view projection matrix
843   ///
844   ///   u_invViewProj mat4 - concatenated inverted view projection matrix
845   ///
846   ///   u_model mat4[BGFX_CONFIG_MAX_BONES] - array of model matrices.
847   ///
848   ///   u_modelView mat4 - concatenated model view matrix, only first
849   ///     model matrix from array is used.
850   ///
851   ///   u_modelViewProj mat4 - concatenated model view projection matrix.
852   ///
853   ///   u_alphaRef float - alpha reference value for alpha test.
854   ///
855   UniformHandle createUniform(const char* _name, UniformType::Enum _type, uint16_t _num = 1);
856
857   /// Destroy shader uniform parameter.
858   void destroyUniform(UniformHandle _handle);
859
860   /// Set view name.
861   ///
862   /// @param _id View id.
863   /// @param _name View name.
864   ///
865   /// NOTE:
866   ///   This is debug only feature.
867   ///
868   void setViewName(uint8_t _id, const char* _name);
869
870   /// Set view rectangle. Draw primitive outside view will be clipped.
871   ///
872   /// @param _id View id.
873   /// @param _x Position x from the left corner of the window.
874   /// @param _y Position y from the top corner of the window.
875   /// @param _width Width of view port region.
876   /// @param _height Height of view port region.
877   ///
878   void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
879
880   /// Set view rectangle for multiple views.
881   ///
882   /// @param _viewMask Bit mask representing affected views.
883   /// @param _x Position x from the left corner of the window.
884   /// @param _y Position y from the top corner of the window.
885   /// @param _width Width of view port region.
886   /// @param _height Height of view port region.
887   ///
888   void setViewRectMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
889
890   /// Set view scissor. Draw primitive outside view will be clipped. When
891   /// _x, _y, _width and _height are set to 0, scissor will be disabled.
892   ///
893   /// @param _x Position x from the left corner of the window.
894   /// @param _y Position y from the top corner of the window.
895   /// @param _width Width of scissor region.
896   /// @param _height Height of scissor region.
897   ///
898   void setViewScissor(uint8_t _id, uint16_t _x = 0, uint16_t _y = 0, uint16_t _width = 0, uint16_t _height = 0);
899
900   /// Set view scissor for multiple views. When _x, _y, _width and _height
901   /// are set to 0, scissor will be disabled.
902   ///
903   /// @param _id View id.
904   /// @param _viewMask Bit mask representing affected views.
905   /// @param _x Position x from the left corner of the window.
906   /// @param _y Position y from the top corner of the window.
907   /// @param _width Width of scissor region.
908   /// @param _height Height of scissor region.
909   ///
910   void setViewScissorMask(uint32_t _viewMask, uint16_t _x = 0, uint16_t _y = 0, uint16_t _width = 0, uint16_t _height = 0);
911
912   /// Set view clear flags.
913   ///
914   /// @param _id View id.
915   /// @param _flags Clear flags. Use BGFX_CLEAR_NONE to remove any clear
916   ///   operation. See: BGFX_CLEAR_*.
917   /// @param _rgba Color clear value.
918   /// @param _depth Depth clear value.
919   /// @param _stencil Stencil clear value.
920   ///
921   void setViewClear(uint8_t _id, uint8_t _flags, uint32_t _rgba = 0x000000ff, float _depth = 1.0f, uint8_t _stencil = 0);
922
923   /// Set view clear flags for multiple views.
924   void setViewClearMask(uint32_t _viewMask, uint8_t _flags, uint32_t _rgba = 0x000000ff, float _depth = 1.0f, uint8_t _stencil = 0);
925
926   /// Set view into sequential mode. Draw calls will be sorted in the same
927   /// order in which submit calls were called.
928   void setViewSeq(uint8_t _id, bool _enabled);
929
930   /// Set multiple views into sequential mode.
931   void setViewSeqMask(uint32_t _viewMask, bool _enabled);
932
933   /// Set view frame buffer.
934   ///
935   /// @param _id View id.
936   /// @param _handle Frame buffer handle. Passing BGFX_INVALID_HANDLE as
937   ///   frame buffer handle will draw primitives from this view into
938   ///   default back buffer.
939   ///
940   void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle);
941
942   /// Set view frame buffer for multiple views.
943   ///
944   /// @param _viewMask View mask.
945   /// @param _handle Frame buffer handle. Passing BGFX_INVALID_HANDLE as
946   ///   frame buffer handle will draw primitives from this view into
947   ///   default back buffer.
948   ///
949   void setViewFrameBufferMask(uint32_t _viewMask, FrameBufferHandle _handle);
950
951   /// Set view view and projection matrices, all draw primitives in this
952   /// view will use these matrices.
953   void setViewTransform(uint8_t _id, const void* _view, const void* _proj);
954
955   /// Set view view and projection matrices for multiple views.
956   void setViewTransformMask(uint32_t _viewMask, const void* _view, const void* _proj);
957
958   /// Sets debug marker.
959   void setMarker(const char* _marker);
960
961   /// Set render states for draw primitive.
962   ///
963   /// @param _state State flags. Default state for primitive type is
964   ///   triangles. See: BGFX_STATE_DEFAULT.
965   ///
966   ///   BGFX_STATE_ALPHA_WRITE - Enable alpha write.
967   ///   BGFX_STATE_DEPTH_WRITE - Enable depth write.
968   ///   BGFX_STATE_DEPTH_TEST_* - Depth test function.
969   ///   BGFX_STATE_BLEND_* - See NOTE 1: BGFX_STATE_BLEND_FUNC.
970   ///   BGFX_STATE_BLEND_EQUATION_* - See NOTE 2.
971   ///   BGFX_STATE_CULL_* - Backface culling mode.
972   ///   BGFX_STATE_RGB_WRITE - Enable RGB write.
973   ///   BGFX_STATE_MSAA - Enable MSAA.
974   ///   BGFX_STATE_PT_[LINES/POINTS] - Primitive type.
975   ///
976   /// @param _rgba Sets blend factor used by BGFX_STATE_BLEND_FACTOR and
977   ///   BGFX_STATE_BLEND_INV_FACTOR blend modes.
978   ///
979   /// NOTE:
980   ///   1. Use BGFX_STATE_ALPHA_REF, BGFX_STATE_POINT_SIZE and
981   ///      BGFX_STATE_BLEND_FUNC macros to setup more complex states.
982   ///   2. BGFX_STATE_BLEND_EQUATION_ADD is set when no other blend
983   ///      equation is specified.
984   ///
985   void setState(uint64_t _state, uint32_t _rgba = 0);
986
987   /// Set stencil test state.
988   ///
989   /// @param _fstencil Front stencil state.
990   /// @param _bstencil Back stencil state. If back is set to BGFX_STENCIL_NONE
991   ///   _fstencil is applied to both front and back facing primitives.
992   ///
993   void setStencil(uint32_t _fstencil, uint32_t _bstencil = BGFX_STENCIL_NONE);
994
995   /// Set scissor for draw primitive. For scissor for all primitives in
996   /// view see setViewScissor.
997   ///
998   /// @param _x Position x from the left corner of the window.
999   /// @param _y Position y from the top corner of the window.
1000   /// @param _width Width of scissor region.
1001   /// @param _height Height of scissor region.
1002   /// @returns Scissor cache index.
1003   ///
1004   uint16_t setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);
1005
1006   /// Set scissor from cache for draw primitive.
1007   ///
1008   /// @param _cache Index in scissor cache. Passing UINT16_MAX unset primitive
1009   ///   scissor and primitive will use view scissor instead.
1010   ///
1011   void setScissor(uint16_t _cache = UINT16_MAX);
1012
1013   /// Set model matrix for draw primitive. If it is not called model will
1014   /// be rendered with identity model matrix.
1015   ///
1016   /// @param _mtx Pointer to first matrix in array.
1017   /// @param _num Number of matrices in array.
1018   /// @returns index into matrix cache in case the same model matrix has
1019   ///   to be used for other draw primitive call.
1020   ///
1021   uint32_t setTransform(const void* _mtx, uint16_t _num = 1);
1022
1023   /// Set model matrix from matrix cache for draw primitive.
1024   ///
1025   /// @param _cache Index in matrix cache.
1026   /// @param _num Number of matrices from cache.
1027   ///
1028   void setTransform(uint32_t _cache, uint16_t _num = 1);
1029
1030   /// Set shader uniform parameter for draw primitive.
1031   void setUniform(UniformHandle _handle, const void* _value, uint16_t _num = 1);
1032
1033   /// Set index buffer for draw primitive.
1034   void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex = 0, uint32_t _numIndices = UINT32_MAX);
1035
1036   /// Set index buffer for draw primitive.
1037   void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex = 0, uint32_t _numIndices = UINT32_MAX);
1038
1039   /// Set index buffer for draw primitive.
1040   void setIndexBuffer(const TransientIndexBuffer* _tib);
1041
1042   /// Set index buffer for draw primitive.
1043   void setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _firstIndex, uint32_t _numIndices);
1044
1045   /// Set vertex buffer for draw primitive.
1046   void setVertexBuffer(VertexBufferHandle _handle);
1047
1048   /// Set vertex buffer for draw primitive.
1049   void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices);
1050
1051   /// Set vertex buffer for draw primitive.
1052   void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices = UINT32_MAX);
1053
1054   /// Set vertex buffer for draw primitive.
1055   void setVertexBuffer(const TransientVertexBuffer* _tvb);
1056
1057   /// Set vertex buffer for draw primitive.
1058   void setVertexBuffer(const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices);
1059
1060   /// Set instance data buffer for draw primitive.
1061   void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint16_t _num = UINT16_MAX);
1062
1063   /// Set program for draw primitive.
1064   void setProgram(ProgramHandle _handle);
1065
1066   /// Set texture stage for draw primitive.
1067   ///
1068   /// @param _stage Texture unit.
1069   /// @param _sampler Program sampler.
1070   /// @param _handle Texture handle.
1071   /// @param _flags Texture sampling mode. Default value UINT32_MAX uses
1072   ///   texture sampling settings from the texture.
1073   ///
1074   ///   BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap
1075   ///     mode.
1076   ///
1077   ///   BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic
1078   ///     sampling.
1079   ///
1080   /// @param _flags Texture sampler filtering flags. UINT32_MAX use the
1081   ///   sampler filtering mode set by texture.
1082   ///
1083   void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags = UINT32_MAX);
1084
1085   /// Set texture stage for draw primitive.
1086   ///
1087   /// @param _stage Texture unit.
1088   /// @param _sampler Program sampler.
1089   /// @param _handle Frame buffer handle.
1090   /// @param _attachment Attachment index.
1091   /// @param _flags Texture sampling mode. Default value UINT32_MAX uses
1092   ///   texture sampling settings from the texture.
1093   ///
1094   ///   BGFX_TEXTURE_[U/V/W]_[MIRROR/CLAMP] - Mirror or clamp to edge wrap
1095   ///     mode.
1096   ///
1097   ///   BGFX_TEXTURE_[MIN/MAG/MIP]_[POINT/ANISOTROPIC] - Point or anisotropic
1098   ///     sampling.
1099   ///
1100   void setTexture(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment = 0, uint32_t _flags = UINT32_MAX);
1101
1102   /// Submit primitive for rendering into single view.
1103   ///
1104   /// @param _id View id.
1105   /// @param _depth Depth for sorting.
1106   /// @returns Number of draw calls.
1107   ///
1108   uint32_t submit(uint8_t _id, int32_t _depth = 0);
1109
1110   /// Submit primitive for rendering into multiple views.
1111   ///
1112   /// @param _viewMask Mask to which views to submit draw primitive calls.
1113   /// @param _depth Depth for sorting.
1114   /// @returns Number of draw calls.
1115   ///
1116   uint32_t submitMask(uint32_t _viewMask, int32_t _depth = 0);
1117
1118   ///
1119   void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access);
1120
1121   ///
1122   void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, TextureFormat::Enum _format, Access::Enum _access);
1123
1124   /// Dispatch compute.
1125   void dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX = 1, uint16_t _numY = 1, uint16_t _numZ = 1);
1126
1127   /// Discard all previously set state for draw or compute call.
1128   void discard();
1129
1130   /// Request screen shot.
1131   ///
1132   /// @param _filePath Will be passed to CallbackI::screenShot callback.
1133   ///
1134   /// NOTE:
1135   ///   CallbackI::screenShot must be implemented.
1136   ///
1137   void saveScreenShot(const char* _filePath);
1138
1139} // namespace bgfx
1140
1141#endif // BGFX_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/include/bgfx.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/renderer_d3d11.cpp
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7
8#if BGFX_CONFIG_RENDERER_DIRECT3D11
9#   include "renderer_d3d11.h"
10
11namespace bgfx
12{
13   static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][256];
14
15   struct PrimInfo
16   {
17      D3D11_PRIMITIVE_TOPOLOGY m_type;
18      uint32_t m_min;
19      uint32_t m_div;
20      uint32_t m_sub;
21   };
22
23   static const PrimInfo s_primInfo[] =
24   {
25      { D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST,  3, 3, 0 },
26      { D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, 3, 1, 2 },
27      { D3D11_PRIMITIVE_TOPOLOGY_LINELIST,      2, 2, 0 },
28      { D3D11_PRIMITIVE_TOPOLOGY_POINTLIST,     1, 1, 0 },
29   };
30
31   static const char* s_primName[] =
32   {
33      "TriList",
34      "TriStrip",
35      "Line",
36      "Point",
37   };
38
39   static const uint32_t s_checkMsaa[] =
40   {
41      0,
42      2,
43      4,
44      8,
45      16,
46   };
47
48   static DXGI_SAMPLE_DESC s_msaa[] =
49   {
50      {  1, 0 },
51      {  2, 0 },
52      {  4, 0 },
53      {  8, 0 },
54      { 16, 0 },
55   };
56
57   static const D3D11_BLEND s_blendFactor[][2] =
58   {
59      { (D3D11_BLEND)0,               (D3D11_BLEND)0               }, // ignored
60      { D3D11_BLEND_ZERO,             D3D11_BLEND_ZERO             }, // ZERO
61      { D3D11_BLEND_ONE,              D3D11_BLEND_ONE              },   // ONE
62      { D3D11_BLEND_SRC_COLOR,        D3D11_BLEND_SRC_ALPHA        },   // SRC_COLOR
63      { D3D11_BLEND_INV_SRC_COLOR,    D3D11_BLEND_INV_SRC_ALPHA    },   // INV_SRC_COLOR
64      { D3D11_BLEND_SRC_ALPHA,        D3D11_BLEND_SRC_ALPHA        },   // SRC_ALPHA
65      { D3D11_BLEND_INV_SRC_ALPHA,    D3D11_BLEND_INV_SRC_ALPHA    },   // INV_SRC_ALPHA
66      { D3D11_BLEND_DEST_ALPHA,       D3D11_BLEND_DEST_ALPHA       },   // DST_ALPHA
67      { D3D11_BLEND_INV_DEST_ALPHA,   D3D11_BLEND_INV_DEST_ALPHA   },   // INV_DST_ALPHA
68      { D3D11_BLEND_DEST_COLOR,       D3D11_BLEND_DEST_ALPHA       },   // DST_COLOR
69      { D3D11_BLEND_INV_DEST_COLOR,   D3D11_BLEND_INV_DEST_ALPHA   },   // INV_DST_COLOR
70      { D3D11_BLEND_SRC_ALPHA_SAT,    D3D11_BLEND_ONE              },   // SRC_ALPHA_SAT
71      { D3D11_BLEND_BLEND_FACTOR,     D3D11_BLEND_BLEND_FACTOR     },   // FACTOR
72      { D3D11_BLEND_INV_BLEND_FACTOR, D3D11_BLEND_INV_BLEND_FACTOR },   // INV_FACTOR
73   };
74
75   static const D3D11_BLEND_OP s_blendEquation[] =
76   {
77      D3D11_BLEND_OP_ADD,
78      D3D11_BLEND_OP_SUBTRACT,
79      D3D11_BLEND_OP_REV_SUBTRACT,
80      D3D11_BLEND_OP_MIN,
81      D3D11_BLEND_OP_MAX,
82   };
83
84   static const D3D11_COMPARISON_FUNC s_cmpFunc[] =
85   {
86      D3D11_COMPARISON_FUNC(0), // ignored
87      D3D11_COMPARISON_LESS,
88      D3D11_COMPARISON_LESS_EQUAL,
89      D3D11_COMPARISON_EQUAL,
90      D3D11_COMPARISON_GREATER_EQUAL,
91      D3D11_COMPARISON_GREATER,
92      D3D11_COMPARISON_NOT_EQUAL,
93      D3D11_COMPARISON_NEVER,
94      D3D11_COMPARISON_ALWAYS,
95   };
96
97   static const D3D11_STENCIL_OP s_stencilOp[] =
98   {
99      D3D11_STENCIL_OP_ZERO,
100      D3D11_STENCIL_OP_KEEP,
101      D3D11_STENCIL_OP_REPLACE,
102      D3D11_STENCIL_OP_INCR,
103      D3D11_STENCIL_OP_INCR_SAT,
104      D3D11_STENCIL_OP_DECR,
105      D3D11_STENCIL_OP_DECR_SAT,
106      D3D11_STENCIL_OP_INVERT,
107   };
108
109   static const D3D11_CULL_MODE s_cullMode[] =
110   {
111      D3D11_CULL_NONE,
112      D3D11_CULL_FRONT,
113      D3D11_CULL_BACK,
114   };
115
116   static DXGI_FORMAT s_colorFormat[] =
117   {
118      DXGI_FORMAT_UNKNOWN, // ignored
119      DXGI_FORMAT_R8G8B8A8_UNORM,
120      DXGI_FORMAT_R10G10B10A2_UNORM,
121      DXGI_FORMAT_R16G16B16A16_UNORM,
122      DXGI_FORMAT_R16G16B16A16_FLOAT,
123      DXGI_FORMAT_R16_FLOAT,
124      DXGI_FORMAT_R32_FLOAT,
125   };
126
127   static const DXGI_FORMAT s_depthFormat[] =
128   {
129      DXGI_FORMAT_UNKNOWN,           // ignored
130      DXGI_FORMAT_D16_UNORM,         // D16
131      DXGI_FORMAT_D24_UNORM_S8_UINT, // D24
132      DXGI_FORMAT_D24_UNORM_S8_UINT, // D24S8
133      DXGI_FORMAT_D24_UNORM_S8_UINT, // D32
134      DXGI_FORMAT_D32_FLOAT,         // D16F
135      DXGI_FORMAT_D32_FLOAT,         // D24F
136      DXGI_FORMAT_D32_FLOAT,         // D32F
137      DXGI_FORMAT_D24_UNORM_S8_UINT, // D0S8
138   };
139
140   static const D3D11_TEXTURE_ADDRESS_MODE s_textureAddress[] =
141   {
142      D3D11_TEXTURE_ADDRESS_WRAP,
143      D3D11_TEXTURE_ADDRESS_MIRROR,
144      D3D11_TEXTURE_ADDRESS_CLAMP,
145   };
146
147   /*
148    * D3D11_FILTER_MIN_MAG_MIP_POINT               = 0x00,
149    * D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR        = 0x01,
150    * D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT  = 0x04,
151    * D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR        = 0x05,
152    * D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT        = 0x10,
153    * D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 0x11,
154    * D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT        = 0x14,
155    * D3D11_FILTER_MIN_MAG_MIP_LINEAR              = 0x15,
156    * D3D11_FILTER_ANISOTROPIC                     = 0x55,
157    *
158    * D3D11_COMPARISON_FILTERING_BIT               = 0x80,
159    * D3D11_ANISOTROPIC_FILTERING_BIT              = 0x40,
160    *
161    * According to D3D11_FILTER enum bits for mip, mag and mip are:
162    * 0x10 // MIN_LINEAR
163    * 0x04 // MAG_LINEAR
164    * 0x01 // MIP_LINEAR
165    */
166
167   static const uint32_t s_textureFilter[3][3] =
168   {
169      {
170         0x10, // min linear
171         0x00, // min point
172         0x55, // anisotopic
173      },
174      {
175         0x04, // mag linear
176         0x00, // mag point
177         0x55, // anisotopic
178      },
179      {
180         0x01, // mip linear
181         0x00, // mip point
182         0x55, // anisotopic
183      },
184   };
185
186   struct TextureFormatInfo
187   {
188      DXGI_FORMAT m_fmt;
189      DXGI_FORMAT m_fmtSrv;
190      DXGI_FORMAT m_fmtDsv;
191   };
192
193#ifndef DXGI_FORMAT_B4G4R4A4_UNORM
194// Win8 only BS
195// https://blogs.msdn.com/b/chuckw/archive/2012/11/14/directx-11-1-and-windows-7.aspx?Redirected=true
196// http://msdn.microsoft.com/en-us/library/windows/desktop/bb173059%28v=vs.85%29.aspx
197#   define DXGI_FORMAT_B4G4R4A4_UNORM DXGI_FORMAT(115)
198#endif // DXGI_FORMAT_B4G4R4A4_UNORM
199
200   static const TextureFormatInfo s_textureFormat[] =
201   {
202      { DXGI_FORMAT_BC1_UNORM,          DXGI_FORMAT_BC1_UNORM,             DXGI_FORMAT_UNKNOWN           }, // BC1
203      { DXGI_FORMAT_BC2_UNORM,          DXGI_FORMAT_BC2_UNORM,             DXGI_FORMAT_UNKNOWN           }, // BC2
204      { DXGI_FORMAT_BC3_UNORM,          DXGI_FORMAT_BC3_UNORM,             DXGI_FORMAT_UNKNOWN           }, // BC3
205      { DXGI_FORMAT_BC4_UNORM,          DXGI_FORMAT_BC4_UNORM,             DXGI_FORMAT_UNKNOWN           }, // BC4
206      { DXGI_FORMAT_BC5_UNORM,          DXGI_FORMAT_BC5_UNORM,             DXGI_FORMAT_UNKNOWN           }, // BC5
207      { DXGI_FORMAT_BC6H_SF16,          DXGI_FORMAT_BC6H_SF16,             DXGI_FORMAT_UNKNOWN           }, // BC6H
208      { DXGI_FORMAT_BC7_UNORM,          DXGI_FORMAT_BC7_UNORM,             DXGI_FORMAT_UNKNOWN           }, // BC7
209      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // ETC1
210      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // ETC2
211      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // ETC2A
212      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // ETC2A1
213      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // PTC12
214      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // PTC14
215      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // PTC12A
216      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // PTC14A
217      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // PTC22
218      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // PTC24
219      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // Unknown
220      { DXGI_FORMAT_R1_UNORM,           DXGI_FORMAT_R1_UNORM,              DXGI_FORMAT_UNKNOWN           }, // R1
221      { DXGI_FORMAT_R8_UNORM,           DXGI_FORMAT_R8_UNORM,              DXGI_FORMAT_UNKNOWN           }, // R8
222      { DXGI_FORMAT_R16_UNORM,          DXGI_FORMAT_R16_UNORM,             DXGI_FORMAT_UNKNOWN           }, // R16
223      { DXGI_FORMAT_R16_FLOAT,          DXGI_FORMAT_R16_FLOAT,             DXGI_FORMAT_UNKNOWN           }, // R16F
224      { DXGI_FORMAT_R32_UINT,           DXGI_FORMAT_R32_UINT,              DXGI_FORMAT_UNKNOWN           }, // R32
225      { DXGI_FORMAT_R32_FLOAT,          DXGI_FORMAT_R32_FLOAT,             DXGI_FORMAT_UNKNOWN           }, // R32F
226      { DXGI_FORMAT_R8G8_UNORM,         DXGI_FORMAT_R8G8_UNORM,            DXGI_FORMAT_UNKNOWN           }, // RG8
227      { DXGI_FORMAT_R16G16_UNORM,       DXGI_FORMAT_R16G16_UNORM,          DXGI_FORMAT_UNKNOWN           }, // RG16
228      { DXGI_FORMAT_R16G16_FLOAT,       DXGI_FORMAT_R16G16_FLOAT,          DXGI_FORMAT_UNKNOWN           }, // RG16F
229      { DXGI_FORMAT_R32G32_UINT,        DXGI_FORMAT_R32G32_UINT,           DXGI_FORMAT_UNKNOWN           }, // RG32
230      { DXGI_FORMAT_R32G32_FLOAT,       DXGI_FORMAT_R32G32_FLOAT,          DXGI_FORMAT_UNKNOWN           }, // RG32F
231      { DXGI_FORMAT_B8G8R8A8_UNORM,     DXGI_FORMAT_B8G8R8A8_UNORM,        DXGI_FORMAT_UNKNOWN           }, // BGRA8
232      { DXGI_FORMAT_R16G16B16A16_UNORM, DXGI_FORMAT_R16G16B16A16_UNORM,    DXGI_FORMAT_UNKNOWN           }, // RGBA16
233      { DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT,    DXGI_FORMAT_UNKNOWN           }, // RGBA16F
234      { DXGI_FORMAT_R32G32B32A32_UINT,  DXGI_FORMAT_R32G32B32A32_UINT,     DXGI_FORMAT_UNKNOWN           }, // RGBA32
235      { DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT,    DXGI_FORMAT_UNKNOWN           }, // RGBA32F
236      { DXGI_FORMAT_B5G6R5_UNORM,       DXGI_FORMAT_B5G6R5_UNORM,          DXGI_FORMAT_UNKNOWN           }, // R5G6B5
237      { DXGI_FORMAT_B4G4R4A4_UNORM,     DXGI_FORMAT_B4G4R4A4_UNORM,        DXGI_FORMAT_UNKNOWN           }, // RGBA4
238      { DXGI_FORMAT_B5G5R5A1_UNORM,     DXGI_FORMAT_B5G5R5A1_UNORM,        DXGI_FORMAT_UNKNOWN           }, // RGB5A1
239      { DXGI_FORMAT_R10G10B10A2_UNORM,  DXGI_FORMAT_R10G10B10A2_UNORM,     DXGI_FORMAT_UNKNOWN           }, // RGB10A2
240      { DXGI_FORMAT_UNKNOWN,            DXGI_FORMAT_UNKNOWN,               DXGI_FORMAT_UNKNOWN           }, // UnknownDepth
241      { DXGI_FORMAT_R16_TYPELESS,       DXGI_FORMAT_R16_UNORM,             DXGI_FORMAT_D16_UNORM         }, // D16
242      { DXGI_FORMAT_R24G8_TYPELESS,     DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT }, // D24
243      { DXGI_FORMAT_R24G8_TYPELESS,     DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT }, // D24S8
244      { DXGI_FORMAT_R24G8_TYPELESS,     DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT }, // D32
245      { DXGI_FORMAT_R32_TYPELESS,       DXGI_FORMAT_R32_FLOAT,             DXGI_FORMAT_D32_FLOAT         }, // D16F
246      { DXGI_FORMAT_R32_TYPELESS,       DXGI_FORMAT_R32_FLOAT,             DXGI_FORMAT_D32_FLOAT         }, // D24F
247      { DXGI_FORMAT_R32_TYPELESS,       DXGI_FORMAT_R32_FLOAT,             DXGI_FORMAT_D32_FLOAT         }, // D32F
248      { DXGI_FORMAT_R24G8_TYPELESS,     DXGI_FORMAT_R24_UNORM_X8_TYPELESS, DXGI_FORMAT_D24_UNORM_S8_UINT }, // D0S8
249   };
250   BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormat) );
251
252   static const D3D11_INPUT_ELEMENT_DESC s_attrib[] =
253   {
254      { "POSITION",     0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
255      { "NORMAL",       0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
256      { "TANGENT",      0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
257      { "BITANGENT",    0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
258      { "COLOR",        0, DXGI_FORMAT_R8G8B8A8_UINT,   0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
259      { "COLOR",        1, DXGI_FORMAT_R8G8B8A8_UINT,   0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
260      { "BLENDINDICES", 0, DXGI_FORMAT_R8G8B8A8_UINT,   0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
261      { "BLENDWEIGHT",  0, DXGI_FORMAT_R32G32B32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
262      { "TEXCOORD",     0, DXGI_FORMAT_R32G32_FLOAT,    0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
263      { "TEXCOORD",     1, DXGI_FORMAT_R32G32_FLOAT,    0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
264      { "TEXCOORD",     2, DXGI_FORMAT_R32G32_FLOAT,    0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
265      { "TEXCOORD",     3, DXGI_FORMAT_R32G32_FLOAT,    0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
266      { "TEXCOORD",     4, DXGI_FORMAT_R32G32_FLOAT,    0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
267      { "TEXCOORD",     5, DXGI_FORMAT_R32G32_FLOAT,    0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
268      { "TEXCOORD",     6, DXGI_FORMAT_R32G32_FLOAT,    0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
269      { "TEXCOORD",     7, DXGI_FORMAT_R32G32_FLOAT,    0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_VERTEX_DATA, 0 },
270   };
271   BX_STATIC_ASSERT(Attrib::Count == BX_COUNTOF(s_attrib) );
272
273   static const DXGI_FORMAT s_attribType[AttribType::Count][4][2] =
274   {
275      {
276         { DXGI_FORMAT_R8_UINT,            DXGI_FORMAT_R8_UNORM           },
277         { DXGI_FORMAT_R8G8_UINT,          DXGI_FORMAT_R8G8_UNORM         },
278         { DXGI_FORMAT_R8G8B8A8_UINT,      DXGI_FORMAT_R8G8B8A8_UNORM     },
279         { DXGI_FORMAT_R8G8B8A8_UINT,      DXGI_FORMAT_R8G8B8A8_UNORM     },
280      },
281      {
282         { DXGI_FORMAT_R16_SINT,           DXGI_FORMAT_R16_SNORM          },
283         { DXGI_FORMAT_R16G16_SINT,        DXGI_FORMAT_R16G16_SNORM       },
284         { DXGI_FORMAT_R16G16B16A16_SINT,  DXGI_FORMAT_R16G16B16A16_SNORM },
285         { DXGI_FORMAT_R16G16B16A16_SINT,  DXGI_FORMAT_R16G16B16A16_SNORM },
286      },
287      {
288         { DXGI_FORMAT_R16_FLOAT,          DXGI_FORMAT_R16_FLOAT          },
289         { DXGI_FORMAT_R16G16_FLOAT,       DXGI_FORMAT_R16G16_FLOAT       },
290         { DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT },
291         { DXGI_FORMAT_R16G16B16A16_FLOAT, DXGI_FORMAT_R16G16B16A16_FLOAT },
292      },
293      {
294         { DXGI_FORMAT_R32_FLOAT,          DXGI_FORMAT_R32_FLOAT          },
295         { DXGI_FORMAT_R32G32_FLOAT,       DXGI_FORMAT_R32G32_FLOAT       },
296         { DXGI_FORMAT_R32G32B32_FLOAT,    DXGI_FORMAT_R32G32B32_FLOAT    },
297         { DXGI_FORMAT_R32G32B32A32_FLOAT, DXGI_FORMAT_R32G32B32A32_FLOAT },
298      },
299   };
300
301   static D3D11_INPUT_ELEMENT_DESC* fillVertexDecl(D3D11_INPUT_ELEMENT_DESC* _out, const VertexDecl& _decl)
302   {
303      D3D11_INPUT_ELEMENT_DESC* elem = _out;
304
305      for (uint32_t attr = 0; attr < Attrib::Count; ++attr)
306      {
307         if (0xff != _decl.m_attributes[attr])
308         {
309            memcpy(elem, &s_attrib[attr], sizeof(D3D11_INPUT_ELEMENT_DESC) );
310
311            if (0 == _decl.m_attributes[attr])
312            {
313               elem->AlignedByteOffset = 0;
314            }
315            else
316            {
317               uint8_t num;
318               AttribType::Enum type;
319               bool normalized;
320               bool asInt;
321               _decl.decode(Attrib::Enum(attr), num, type, normalized, asInt);
322               elem->Format = s_attribType[type][num-1][normalized];
323               elem->AlignedByteOffset = _decl.m_offset[attr];
324            }
325
326            ++elem;
327         }
328      }
329
330      return elem;
331   }
332
333   struct TextureStage
334   {
335      TextureStage()
336      {
337         clear();
338      }
339
340      void clear()
341      {
342         memset(m_srv, 0, sizeof(m_srv) );
343         memset(m_sampler, 0, sizeof(m_sampler) );
344      }
345
346      ID3D11ShaderResourceView* m_srv[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
347      ID3D11SamplerState* m_sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
348   };
349
350   static const GUID WKPDID_D3DDebugObjectName = { 0x429b8c22, 0x9188, 0x4b0c, { 0x87, 0x42, 0xac, 0xb0, 0xbf, 0x85, 0xc2, 0x00 } };
351
352   template <typename Ty>
353   static BX_NO_INLINE void setDebugObjectName(Ty* _interface, const char* _format, ...)
354   {
355      if (BX_ENABLED(BGFX_CONFIG_DEBUG_OBJECT_NAME) )
356      {
357         char temp[2048];
358         va_list argList;
359         va_start(argList, _format);
360         int size = bx::uint32_min(sizeof(temp)-1, vsnprintf(temp, sizeof(temp), _format, argList) );
361         va_end(argList);
362         temp[size] = '\0';
363
364         _interface->SetPrivateData(WKPDID_D3DDebugObjectName, size, temp);
365      }
366   }
367
368   static BX_NO_INLINE bool getIntelExtensions(ID3D11Device* _device)
369   {
370      uint8_t temp[28];
371
372      D3D11_BUFFER_DESC desc;
373      desc.ByteWidth = sizeof(temp);
374      desc.Usage = D3D11_USAGE_STAGING;
375      desc.BindFlags = 0;
376      desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
377      desc.MiscFlags = 0;
378      desc.StructureByteStride = 0;
379
380      D3D11_SUBRESOURCE_DATA initData;
381      initData.pSysMem = &temp;
382      initData.SysMemPitch = sizeof(temp);
383      initData.SysMemSlicePitch = 0;
384
385      bx::StaticMemoryBlockWriter writer(&temp, sizeof(temp) );
386      bx::write(&writer, "INTCEXTNCAPSFUNC", 16);
387      bx::write(&writer, UINT32_C(0x00010000) );
388      bx::write(&writer, UINT32_C(0) );
389      bx::write(&writer, UINT32_C(0) );
390
391      ID3D11Buffer* buffer;
392      HRESULT hr = _device->CreateBuffer(&desc, &initData, &buffer);
393
394      if (SUCCEEDED(hr) )
395      {
396         buffer->Release();
397
398         bx::MemoryReader reader(&temp, sizeof(temp) );
399         bx::skip(&reader, 16);
400
401         uint32_t version;
402         bx::read(&reader, version);
403
404         uint32_t driverVersion;
405         bx::read(&reader, driverVersion);
406
407         return version <= driverVersion;
408      }
409
410      return false;
411   };
412
413   struct RendererContextD3D11 : public RendererContextI
414   {
415      RendererContextD3D11()
416         : m_captureTexture(NULL)
417         , m_captureResolve(NULL)
418         , m_wireframe(false)
419         , m_flags(BGFX_RESET_NONE)
420         , m_vsChanges(0)
421         , m_fsChanges(0)
422         , m_rtMsaa(false)
423      {
424         m_fbh.idx = invalidHandle;
425         memset(m_uniforms, 0, sizeof(m_uniforms) );
426         memset(&m_resolution, 0, sizeof(m_resolution) );
427
428#if USE_D3D11_DYNAMIC_LIB
429         m_d3d11dll = bx::dlopen("d3d11.dll");
430         BGFX_FATAL(NULL != m_d3d11dll, Fatal::UnableToInitialize, "Failed to load d3d11.dll.");
431
432         if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
433         {
434            // D3D11_1.h has ID3DUserDefinedAnnotation
435            // http://msdn.microsoft.com/en-us/library/windows/desktop/hh446881%28v=vs.85%29.aspx
436            m_d3d9dll = bx::dlopen("d3d9.dll");
437            BGFX_FATAL(NULL != m_d3d9dll, Fatal::UnableToInitialize, "Failed to load d3d9.dll.");
438
439            m_D3DPERF_SetMarker  = (D3DPERF_SetMarkerFunc )bx::dlsym(m_d3d9dll, "D3DPERF_SetMarker" );
440            m_D3DPERF_BeginEvent = (D3DPERF_BeginEventFunc)bx::dlsym(m_d3d9dll, "D3DPERF_BeginEvent");
441            m_D3DPERF_EndEvent   = (D3DPERF_EndEventFunc  )bx::dlsym(m_d3d9dll, "D3DPERF_EndEvent"  );
442            BX_CHECK(NULL != m_D3DPERF_SetMarker
443                 && NULL != m_D3DPERF_BeginEvent
444                 && NULL != m_D3DPERF_EndEvent
445                 , "Failed to initialize PIX events."
446                 );
447         }
448
449         PFN_D3D11_CREATE_DEVICE d3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)bx::dlsym(m_d3d11dll, "D3D11CreateDevice");
450         BGFX_FATAL(NULL != d3D11CreateDevice, Fatal::UnableToInitialize, "Function D3D11CreateDevice not found.");
451
452         m_dxgidll = bx::dlopen("dxgi.dll");
453         BGFX_FATAL(NULL != m_dxgidll, Fatal::UnableToInitialize, "Failed to load dxgi.dll.");
454
455         PFN_CREATEDXGIFACTORY dxgiCreateDXGIFactory = (PFN_CREATEDXGIFACTORY)bx::dlsym(m_dxgidll, "CreateDXGIFactory");
456         BGFX_FATAL(NULL != dxgiCreateDXGIFactory, Fatal::UnableToInitialize, "Function CreateDXGIFactory not found.");
457#else
458         PFN_D3D11_CREATE_DEVICE d3D11CreateDevice     = D3D11CreateDevice;
459         PFN_CREATEDXGIFACTORY   dxgiCreateDXGIFactory = CreateDXGIFactory;
460#endif // USE_D3D11_DYNAMIC_LIB
461
462         HRESULT hr;
463
464         IDXGIFactory* factory;
465         hr = dxgiCreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory);
466         BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create DXGI factory.");
467
468         m_adapter = NULL;
469         m_driverType = D3D_DRIVER_TYPE_HARDWARE;
470
471         IDXGIAdapter* adapter;
472         for (uint32_t ii = 0; DXGI_ERROR_NOT_FOUND != factory->EnumAdapters(ii, &adapter); ++ii)
473         {
474            DXGI_ADAPTER_DESC desc;
475            hr = adapter->GetDesc(&desc);
476            if (SUCCEEDED(hr) )
477            {
478               BX_TRACE("Adapter #%d", ii);
479
480               char description[BX_COUNTOF(desc.Description)];
481               wcstombs(description, desc.Description, BX_COUNTOF(desc.Description) );
482               BX_TRACE("\tDescription: %s", description);
483               BX_TRACE("\tVendorId: 0x%08x, DeviceId: 0x%08x, SubSysId: 0x%08x, Revision: 0x%08x"
484                  , desc.VendorId
485                  , desc.DeviceId
486                  , desc.SubSysId
487                  , desc.Revision
488                  );
489               BX_TRACE("\tMemory: %" PRIi64 " (video), %" PRIi64 " (system), %" PRIi64 " (shared)"
490                  , desc.DedicatedVideoMemory
491                  , desc.DedicatedSystemMemory
492                  , desc.SharedSystemMemory
493                  );
494
495               if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD)
496               &&  0 != strstr(description, "PerfHUD") )
497               {
498                  m_adapter = adapter;
499                  m_driverType = D3D_DRIVER_TYPE_REFERENCE;
500               }
501            }
502
503            DX_RELEASE(adapter, adapter == m_adapter ? 1 : 0);
504         }
505         DX_RELEASE(factory, NULL != m_adapter ? 1 : 0);
506
507         D3D_FEATURE_LEVEL features[] =
508         {
509            D3D_FEATURE_LEVEL_11_0,
510            D3D_FEATURE_LEVEL_10_1,
511            D3D_FEATURE_LEVEL_10_0,
512         };
513
514         memset(&m_scd, 0, sizeof(m_scd) );
515         m_scd.BufferDesc.Width = BGFX_DEFAULT_WIDTH;
516         m_scd.BufferDesc.Height = BGFX_DEFAULT_HEIGHT;
517         m_scd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
518         m_scd.BufferDesc.RefreshRate.Numerator = 60;
519         m_scd.BufferDesc.RefreshRate.Denominator = 1;
520         m_scd.SampleDesc.Count = 1;
521         m_scd.SampleDesc.Quality = 0;
522         m_scd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
523         m_scd.BufferCount = 1;
524         m_scd.OutputWindow = g_bgfxHwnd;
525         m_scd.Windowed = true;
526
527         uint32_t flags = D3D11_CREATE_DEVICE_SINGLETHREADED
528#if BGFX_CONFIG_DEBUG
529            | D3D11_CREATE_DEVICE_DEBUG
530#endif // BGFX_CONFIG_DEBUG
531            ;
532
533         D3D_FEATURE_LEVEL featureLevel;
534
535         hr = d3D11CreateDevice(m_adapter
536            , m_driverType
537            , NULL
538            , flags
539            , features
540            , 1
541            , D3D11_SDK_VERSION
542            , &m_device
543            , &featureLevel
544            , &m_deviceCtx
545            );
546         BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
547
548         IDXGIDevice* device;
549         hr = m_device->QueryInterface(__uuidof(IDXGIDevice), (void**)&device);
550         BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
551
552         hr = device->GetParent(__uuidof(IDXGIAdapter), (void**)&adapter);
553         BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
554
555         // GPA increases device ref count and triggers assert in debug
556         // build. Set flag to disable reference count checks.
557         setGraphicsDebuggerPresent(3 < getRefCount(device) );
558         DX_RELEASE(device, 2);
559
560         hr = adapter->GetDesc(&m_adapterDesc);
561         BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
562
563         hr = adapter->GetParent(__uuidof(IDXGIFactory), (void**)&m_factory);
564         BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Unable to create Direct3D11 device.");
565         DX_RELEASE(adapter, 2);
566
567         hr = m_factory->CreateSwapChain(m_device
568                              , &m_scd
569                              , &m_swapChain
570                              );
571         BGFX_FATAL(SUCCEEDED(hr), Fatal::UnableToInitialize, "Failed to create swap chain.");
572
573         if (BX_ENABLED(BGFX_CONFIG_DEBUG) )
574         {
575            ID3D11InfoQueue* infoQueue;
576            hr = m_device->QueryInterface(__uuidof(ID3D11InfoQueue), (void**)&infoQueue);
577
578            if (SUCCEEDED(hr) )
579            {
580               infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_CORRUPTION, true);
581               infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_ERROR,      true);
582               infoQueue->SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY_WARNING,    false);
583
584               D3D11_INFO_QUEUE_FILTER filter;
585               memset(&filter, 0, sizeof(filter) );
586
587               D3D11_MESSAGE_CATEGORY categies[] =
588               {
589                  D3D11_MESSAGE_CATEGORY_STATE_SETTING,
590                  D3D11_MESSAGE_CATEGORY_EXECUTION,
591               };
592               filter.DenyList.NumCategories = BX_COUNTOF(categies);
593               filter.DenyList.pCategoryList = categies;
594               infoQueue->PushStorageFilter(&filter);
595
596               DX_RELEASE(infoQueue, 3);
597            }
598            else
599            {
600               // InfoQueue QueryInterface will fail when AMD GPU Perfstudio 2 is present.
601               setGraphicsDebuggerPresent(true);
602            }
603         }
604
605         UniformHandle handle = BGFX_INVALID_HANDLE;
606         for (uint32_t ii = 0; ii < PredefinedUniform::Count; ++ii)
607         {
608            m_uniformReg.add(handle, getPredefinedUniformName(PredefinedUniform::Enum(ii) ), &m_predefinedUniforms[ii]);
609         }
610
611         g_caps.supported |= ( 0
612                        | BGFX_CAPS_TEXTURE_3D
613                        | BGFX_CAPS_TEXTURE_COMPARE_ALL
614                        | BGFX_CAPS_INSTANCING
615                        | BGFX_CAPS_VERTEX_ATTRIB_HALF
616                        | BGFX_CAPS_FRAGMENT_DEPTH
617                        | BGFX_CAPS_BLEND_INDEPENDENT
618                        | BGFX_CAPS_COMPUTE
619                        | (getIntelExtensions(m_device) ? BGFX_CAPS_FRAGMENT_ORDERING : 0)
620                        );
621         g_caps.maxTextureSize   = D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
622         g_caps.maxFBAttachments = bx::uint32_min(D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS);
623
624         for (uint32_t ii = 0; ii < TextureFormat::Count; ++ii)
625         {
626            g_caps.formats[ii] = DXGI_FORMAT_UNKNOWN == s_textureFormat[ii].m_fmt ? 0 : 1;
627         }
628
629         updateMsaa();
630         postReset();
631      }
632
633      ~RendererContextD3D11()
634      {
635         preReset();
636
637         m_deviceCtx->ClearState();
638
639         invalidateCache();
640
641         for (uint32_t ii = 0; ii < BX_COUNTOF(m_indexBuffers); ++ii)
642         {
643            m_indexBuffers[ii].destroy();
644         }
645
646         for (uint32_t ii = 0; ii < BX_COUNTOF(m_vertexBuffers); ++ii)
647         {
648            m_vertexBuffers[ii].destroy();
649         }
650
651         for (uint32_t ii = 0; ii < BX_COUNTOF(m_shaders); ++ii)
652         {
653            m_shaders[ii].destroy();
654         }
655
656         for (uint32_t ii = 0; ii < BX_COUNTOF(m_textures); ++ii)
657         {
658            m_textures[ii].destroy();
659         }
660
661         DX_RELEASE(m_swapChain, 0);
662         DX_RELEASE(m_deviceCtx, 0);
663         DX_RELEASE(m_device, 0);
664         DX_RELEASE(m_factory, 0);
665
666#if USE_D3D11_DYNAMIC_LIB
667         bx::dlclose(m_dxgidll);
668         bx::dlclose(m_d3d11dll);
669#endif // USE_D3D11_DYNAMIC_LIB
670      }
671
672      RendererType::Enum getRendererType() const BX_OVERRIDE
673      {
674         return RendererType::Direct3D11;
675      }
676
677      const char* getRendererName() const BX_OVERRIDE
678      {
679         return BGFX_RENDERER_DIRECT3D11_NAME;
680      }
681
682      void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem) BX_OVERRIDE
683      {
684         m_indexBuffers[_handle.idx].create(_mem->size, _mem->data);
685      }
686
687      void destroyIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE
688      {
689         m_indexBuffers[_handle.idx].destroy();
690      }
691
692      void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) BX_OVERRIDE
693      {
694         VertexDecl& decl = m_vertexDecls[_handle.idx];
695         memcpy(&decl, &_decl, sizeof(VertexDecl) );
696         dump(decl);
697      }
698
699      void destroyVertexDecl(VertexDeclHandle /*_handle*/) BX_OVERRIDE
700      {
701      }
702
703      void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle) BX_OVERRIDE
704      {
705         m_vertexBuffers[_handle.idx].create(_mem->size, _mem->data, _declHandle);
706      }
707
708      void destroyVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE
709      {
710         m_vertexBuffers[_handle.idx].destroy();
711      }
712
713      void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size) BX_OVERRIDE
714      {
715         m_indexBuffers[_handle.idx].create(_size, NULL);
716      }
717
718      void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE
719      {
720         m_indexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
721      }
722
723      void destroyDynamicIndexBuffer(IndexBufferHandle _handle) BX_OVERRIDE
724      {
725         m_indexBuffers[_handle.idx].destroy();
726      }
727
728      void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size) BX_OVERRIDE
729      {
730         VertexDeclHandle decl = BGFX_INVALID_HANDLE;
731         m_vertexBuffers[_handle.idx].create(_size, NULL, decl);
732      }
733
734      void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) BX_OVERRIDE
735      {
736         m_vertexBuffers[_handle.idx].update(_offset, bx::uint32_min(_size, _mem->size), _mem->data);
737      }
738
739      void destroyDynamicVertexBuffer(VertexBufferHandle _handle) BX_OVERRIDE
740      {
741         m_vertexBuffers[_handle.idx].destroy();
742      }
743
744      void createShader(ShaderHandle _handle, Memory* _mem) BX_OVERRIDE
745      {
746         m_shaders[_handle.idx].create(_mem);
747      }
748
749      void destroyShader(ShaderHandle _handle) BX_OVERRIDE
750      {
751         m_shaders[_handle.idx].destroy();
752      }
753
754      void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) BX_OVERRIDE
755      {
756         m_program[_handle.idx].create(&m_shaders[_vsh.idx], isValid(_fsh) ? &m_shaders[_fsh.idx] : NULL);
757      }
758
759      void destroyProgram(ProgramHandle _handle) BX_OVERRIDE
760      {
761         m_program[_handle.idx].destroy();
762      }
763
764      void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) BX_OVERRIDE
765      {
766         m_textures[_handle.idx].create(_mem, _flags, _skip);
767      }
768
769      void updateTextureBegin(TextureHandle /*_handle*/, uint8_t /*_side*/, uint8_t /*_mip*/) BX_OVERRIDE
770      {
771      }
772
773      void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) BX_OVERRIDE
774      {
775         m_textures[_handle.idx].update(_side, _mip, _rect, _z, _depth, _pitch, _mem);
776      }
777
778      void updateTextureEnd() BX_OVERRIDE
779      {
780      }
781
782      void destroyTexture(TextureHandle _handle) BX_OVERRIDE
783      {
784         m_textures[_handle.idx].destroy();
785      }
786
787      void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) BX_OVERRIDE
788      {
789         m_frameBuffers[_handle.idx].create(_num, _textureHandles);
790      }
791
792      void destroyFrameBuffer(FrameBufferHandle _handle) BX_OVERRIDE
793      {
794         m_frameBuffers[_handle.idx].destroy();
795      }
796
797      void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) BX_OVERRIDE
798      {
799         if (NULL != m_uniforms[_handle.idx])
800         {
801            BX_FREE(g_allocator, m_uniforms[_handle.idx]);
802         }
803
804         uint32_t size = BX_ALIGN_16(g_uniformTypeSize[_type]*_num);
805         void* data = BX_ALLOC(g_allocator, size);
806         memset(data, 0, size);
807         m_uniforms[_handle.idx] = data;
808         m_uniformReg.add(_handle, _name, data);
809      }
810
811      void destroyUniform(UniformHandle _handle) BX_OVERRIDE
812      {
813         BX_FREE(g_allocator, m_uniforms[_handle.idx]);
814         m_uniforms[_handle.idx] = NULL;
815      }
816
817      void saveScreenShot(const char* _filePath) BX_OVERRIDE
818      {
819         ID3D11Texture2D* backBuffer;
820         DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&backBuffer) );
821
822         D3D11_TEXTURE2D_DESC backBufferDesc;
823         backBuffer->GetDesc(&backBufferDesc);
824
825         D3D11_TEXTURE2D_DESC desc;
826         memcpy(&desc, &backBufferDesc, sizeof(desc) );
827         desc.SampleDesc.Count = 1;
828         desc.SampleDesc.Quality = 0;
829         desc.Usage = D3D11_USAGE_STAGING;
830         desc.BindFlags = 0;
831         desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
832
833         ID3D11Texture2D* texture;
834         HRESULT hr = m_device->CreateTexture2D(&desc, NULL, &texture);
835         if (SUCCEEDED(hr) )
836         {
837            if (backBufferDesc.SampleDesc.Count == 1)
838            {
839               m_deviceCtx->CopyResource(texture, backBuffer);
840            }
841            else
842            {
843               desc.Usage = D3D11_USAGE_DEFAULT;
844               desc.CPUAccessFlags = 0;
845               ID3D11Texture2D* resolve;
846               HRESULT hr = m_device->CreateTexture2D(&desc, NULL, &resolve);
847               if (SUCCEEDED(hr) )
848               {
849                  m_deviceCtx->ResolveSubresource(resolve, 0, backBuffer, 0, desc.Format);
850                  m_deviceCtx->CopyResource(texture, resolve);
851                  DX_RELEASE(resolve, 0);
852               }
853            }
854
855            D3D11_MAPPED_SUBRESOURCE mapped;
856            DX_CHECK(m_deviceCtx->Map(texture, 0, D3D11_MAP_READ, 0, &mapped) );
857            g_callback->screenShot(_filePath
858               , backBufferDesc.Width
859               , backBufferDesc.Height
860               , mapped.RowPitch
861               , mapped.pData
862               , backBufferDesc.Height*mapped.RowPitch
863               , false
864               );
865            m_deviceCtx->Unmap(texture, 0);
866
867            DX_RELEASE(texture, 0);
868         }
869
870         DX_RELEASE(backBuffer, 0);
871      }
872
873      void updateViewName(uint8_t _id, const char* _name) BX_OVERRIDE
874      {
875         mbstowcs(&s_viewNameW[_id][0], _name, BX_COUNTOF(s_viewNameW[0]) );
876      }
877
878      void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) BX_OVERRIDE
879      {
880         memcpy(m_uniforms[_loc], _data, _size);
881      }
882
883      void setMarker(const char* _marker, uint32_t _size) BX_OVERRIDE
884      {
885         if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
886         {
887            uint32_t size = _size*sizeof(wchar_t);
888            wchar_t* name = (wchar_t*)alloca(size);
889            mbstowcs(name, _marker, size-2);
890            PIX_SETMARKER(D3DCOLOR_RGBA(0xff, 0xff, 0xff, 0xff), name);
891         }
892      }
893
894      void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) BX_OVERRIDE;
895
896      void blitSetup(TextVideoMemBlitter& _blitter) BX_OVERRIDE
897      {
898         ID3D11DeviceContext* deviceCtx = m_deviceCtx;
899
900         uint32_t width  = m_scd.BufferDesc.Width;
901         uint32_t height = m_scd.BufferDesc.Height;
902
903         FrameBufferHandle fbh = BGFX_INVALID_HANDLE;
904         setFrameBuffer(fbh, false);
905
906         D3D11_VIEWPORT vp;
907         vp.TopLeftX = 0;
908         vp.TopLeftY = 0;
909         vp.Width = (float)width;
910         vp.Height = (float)height;
911         vp.MinDepth = 0.0f;
912         vp.MaxDepth = 1.0f;
913         deviceCtx->RSSetViewports(1, &vp);
914
915         uint64_t state = BGFX_STATE_RGB_WRITE
916            | BGFX_STATE_ALPHA_WRITE
917            | BGFX_STATE_DEPTH_TEST_ALWAYS
918            ;
919
920         setBlendState(state);
921         setDepthStencilState(state);
922         setRasterizerState(state);
923
924         ProgramD3D11& program = m_program[_blitter.m_program.idx];
925         m_currentProgram = &program;
926         deviceCtx->VSSetShader(program.m_vsh->m_vertexShader, NULL, 0);
927         deviceCtx->VSSetConstantBuffers(0, 1, &program.m_vsh->m_buffer);
928         deviceCtx->PSSetShader(program.m_fsh->m_pixelShader, NULL, 0);
929         deviceCtx->PSSetConstantBuffers(0, 1, &program.m_fsh->m_buffer);
930
931         VertexBufferD3D11& vb = m_vertexBuffers[_blitter.m_vb->handle.idx];
932         VertexDecl& vertexDecl = m_vertexDecls[_blitter.m_vb->decl.idx];
933         uint32_t stride = vertexDecl.m_stride;
934         uint32_t offset = 0;
935         deviceCtx->IASetVertexBuffers(0, 1, &vb.m_ptr, &stride, &offset);
936         setInputLayout(vertexDecl, program, 0);
937
938         IndexBufferD3D11& ib = m_indexBuffers[_blitter.m_ib->handle.idx];
939         deviceCtx->IASetIndexBuffer(ib.m_ptr, DXGI_FORMAT_R16_UINT, 0);
940
941         float proj[16];
942         mtxOrtho(proj, 0.0f, (float)width, (float)height, 0.0f, 0.0f, 1000.0f);
943
944         PredefinedUniform& predefined = program.m_predefined[0];
945         uint8_t flags = predefined.m_type;
946         setShaderConstant(flags, predefined.m_loc, proj, 4);
947
948         commitShaderConstants();
949         m_textures[_blitter.m_texture.idx].commit(0);
950         commitTextureStage();
951      }
952
953      void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) BX_OVERRIDE
954      {
955         ID3D11DeviceContext* deviceCtx = m_deviceCtx;
956
957         IndexBufferD3D11& ib = m_indexBuffers[_blitter.m_ib->handle.idx];
958         ib.update(0, _numIndices*2, _blitter.m_ib->data);
959
960         uint32_t numVertices = _numIndices*4/6;
961         m_vertexBuffers[_blitter.m_vb->handle.idx].update(0, numVertices*_blitter.m_decl.m_stride, _blitter.m_vb->data);
962
963         deviceCtx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
964         deviceCtx->DrawIndexed(_numIndices, 0, 0);
965      }
966
967      void preReset()
968      {
969         DX_RELEASE(m_backBufferDepthStencil, 0);
970         DX_RELEASE(m_backBufferColor, 0);
971
972//         invalidateCache();
973
974         capturePreReset();
975      }
976
977      void postReset()
978      {
979         ID3D11Texture2D* color;
980         DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&color) );
981
982         DX_CHECK(m_device->CreateRenderTargetView(color, NULL, &m_backBufferColor) );
983         DX_RELEASE(color, 0);
984
985         D3D11_TEXTURE2D_DESC dsd;
986         dsd.Width = m_scd.BufferDesc.Width;
987         dsd.Height = m_scd.BufferDesc.Height;
988         dsd.MipLevels = 1;
989         dsd.ArraySize = 1;
990         dsd.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
991         dsd.SampleDesc = m_scd.SampleDesc;
992         dsd.Usage = D3D11_USAGE_DEFAULT;
993         dsd.BindFlags = D3D11_BIND_DEPTH_STENCIL;
994         dsd.CPUAccessFlags = 0;
995         dsd.MiscFlags = 0;
996
997         ID3D11Texture2D* depthStencil;
998         DX_CHECK(m_device->CreateTexture2D(&dsd, NULL, &depthStencil) );
999         DX_CHECK(m_device->CreateDepthStencilView(depthStencil, NULL, &m_backBufferDepthStencil) );
1000         DX_RELEASE(depthStencil, 0);
1001
1002         m_deviceCtx->OMSetRenderTargets(1, &m_backBufferColor, m_backBufferDepthStencil);
1003
1004         m_currentColor = m_backBufferColor;
1005         m_currentDepthStencil = m_backBufferDepthStencil;
1006
1007         capturePostReset();
1008      }
1009
1010      void flip() BX_OVERRIDE
1011      {
1012         if (NULL != m_swapChain)
1013         {
1014            uint32_t syncInterval = !!(m_flags & BGFX_RESET_VSYNC);
1015            DX_CHECK(m_swapChain->Present(syncInterval, 0) );
1016         }
1017      }
1018
1019      void invalidateCache()
1020      {
1021         m_inputLayoutCache.invalidate();
1022         m_blendStateCache.invalidate();
1023         m_depthStencilStateCache.invalidate();
1024         m_rasterizerStateCache.invalidate();
1025         m_samplerStateCache.invalidate();
1026      }
1027
1028      void updateMsaa()
1029      {
1030         for (uint32_t ii = 1, last = 0; ii < BX_COUNTOF(s_msaa); ++ii)
1031         {
1032            uint32_t msaa = s_checkMsaa[ii];
1033            uint32_t quality = 0;
1034            HRESULT hr = m_device->CheckMultisampleQualityLevels(m_scd.BufferDesc.Format, msaa, &quality);
1035
1036            if (SUCCEEDED(hr)
1037            &&  0 < quality)
1038            {
1039               s_msaa[ii].Count = msaa;
1040               s_msaa[ii].Quality = quality - 1;
1041               last = ii;
1042            }
1043            else
1044            {
1045               s_msaa[ii] = s_msaa[last];
1046            }
1047         }
1048      }
1049
1050      void updateResolution(const Resolution& _resolution)
1051      {
1052         if ( (uint32_t)m_scd.BufferDesc.Width != _resolution.m_width
1053         ||   (uint32_t)m_scd.BufferDesc.Height != _resolution.m_height
1054         ||   m_flags != _resolution.m_flags)
1055         {
1056            bool resize = (m_flags&BGFX_RESET_MSAA_MASK) == (_resolution.m_flags&BGFX_RESET_MSAA_MASK);
1057            m_flags = _resolution.m_flags;
1058
1059            m_textVideoMem.resize(false, _resolution.m_width, _resolution.m_height);
1060            m_textVideoMem.clear();
1061
1062            m_resolution = _resolution;
1063
1064            m_scd.BufferDesc.Width = _resolution.m_width;
1065            m_scd.BufferDesc.Height = _resolution.m_height;
1066
1067            preReset();
1068
1069            if (resize)
1070            {
1071               DX_CHECK(m_swapChain->ResizeBuffers(2
1072                  , m_scd.BufferDesc.Width
1073                  , m_scd.BufferDesc.Height
1074                  , m_scd.BufferDesc.Format
1075                  , DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH
1076                  ) );
1077            }
1078            else
1079            {
1080               updateMsaa();
1081               m_scd.SampleDesc = s_msaa[(m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT];
1082
1083               DX_RELEASE(m_swapChain, 0);
1084
1085               HRESULT hr;
1086               hr = m_factory->CreateSwapChain(m_device
1087                  , &m_scd
1088                  , &m_swapChain
1089                  );
1090               BGFX_FATAL(SUCCEEDED(hr), bgfx::Fatal::UnableToInitialize, "Failed to create swap chain.");
1091            }
1092
1093            postReset();
1094         }
1095      }
1096
1097      void setShaderConstant(uint8_t _flags, uint16_t _regIndex, const void* _val, uint16_t _numRegs)
1098      {
1099         if (_flags&BGFX_UNIFORM_FRAGMENTBIT)
1100         {
1101            memcpy(&m_fsScratch[_regIndex], _val, _numRegs*16);
1102            m_fsChanges += _numRegs;
1103         }
1104         else
1105         {
1106            memcpy(&m_vsScratch[_regIndex], _val, _numRegs*16);
1107            m_vsChanges += _numRegs;
1108         }
1109      }
1110
1111      void commitShaderConstants()
1112      {
1113         if (0 < m_vsChanges)
1114         {
1115            if (NULL != m_currentProgram->m_vsh->m_buffer)
1116            {
1117               m_deviceCtx->UpdateSubresource(m_currentProgram->m_vsh->m_buffer, 0, 0, m_vsScratch, 0, 0);
1118            }
1119
1120            m_vsChanges = 0;
1121         }
1122
1123         if (0 < m_fsChanges)
1124         {
1125            if (NULL != m_currentProgram->m_fsh->m_buffer)
1126            {
1127               m_deviceCtx->UpdateSubresource(m_currentProgram->m_fsh->m_buffer, 0, 0, m_fsScratch, 0, 0);
1128            }
1129
1130            m_fsChanges = 0;
1131         }
1132      }
1133
1134      void setFrameBuffer(FrameBufferHandle _fbh, bool _msaa = true)
1135      {
1136         BX_UNUSED(_msaa);
1137         if (!isValid(_fbh) )
1138         {
1139            m_deviceCtx->OMSetRenderTargets(1, &m_backBufferColor, m_backBufferDepthStencil);
1140
1141            m_currentColor = m_backBufferColor;
1142            m_currentDepthStencil = m_backBufferDepthStencil;
1143         }
1144         else
1145         {
1146            invalidateTextureStage();
1147
1148            FrameBufferD3D11& frameBuffer = m_frameBuffers[_fbh.idx];
1149            m_deviceCtx->OMSetRenderTargets(frameBuffer.m_num, frameBuffer.m_rtv, frameBuffer.m_dsv);
1150
1151            m_currentColor = frameBuffer.m_rtv[0];
1152            m_currentDepthStencil = frameBuffer.m_dsv;
1153         }
1154
1155         if (isValid(m_fbh)
1156         &&  m_fbh.idx != _fbh.idx
1157         &&  m_rtMsaa)
1158         {
1159            FrameBufferD3D11& frameBuffer = m_frameBuffers[m_fbh.idx];
1160            frameBuffer.resolve();
1161         }
1162
1163         m_fbh = _fbh;
1164         m_rtMsaa = _msaa;
1165      }
1166
1167      void clear(const Clear& _clear)
1168      {
1169         if (isValid(m_fbh) )
1170         {
1171            FrameBufferD3D11& frameBuffer = m_frameBuffers[m_fbh.idx];
1172            frameBuffer.clear(_clear);
1173         }
1174         else
1175         {
1176            if (NULL != m_currentColor
1177            &&  BGFX_CLEAR_COLOR_BIT & _clear.m_flags)
1178            {
1179               uint32_t rgba = _clear.m_rgba;
1180               float frgba[4] = { (rgba>>24)/255.0f, ( (rgba>>16)&0xff)/255.0f, ( (rgba>>8)&0xff)/255.0f, (rgba&0xff)/255.0f };
1181               m_deviceCtx->ClearRenderTargetView(m_currentColor, frgba);
1182            }
1183
1184            if (NULL != m_currentDepthStencil
1185            && (BGFX_CLEAR_DEPTH_BIT|BGFX_CLEAR_STENCIL_BIT) & _clear.m_flags)
1186            {
1187               DWORD flags = 0;
1188               flags |= (_clear.m_flags & BGFX_CLEAR_DEPTH_BIT) ? D3D11_CLEAR_DEPTH : 0;
1189               flags |= (_clear.m_flags & BGFX_CLEAR_STENCIL_BIT) ? D3D11_CLEAR_STENCIL : 0;
1190               m_deviceCtx->ClearDepthStencilView(m_currentDepthStencil, flags, _clear.m_depth, _clear.m_stencil);
1191            }
1192         }
1193      }
1194
1195      void setInputLayout(const VertexDecl& _vertexDecl, const ProgramD3D11& _program, uint8_t _numInstanceData)
1196      {
1197         uint64_t layoutHash = (uint64_t(_vertexDecl.m_hash)<<32) | _program.m_vsh->m_hash;
1198         layoutHash ^= _numInstanceData;
1199         ID3D11InputLayout* layout = m_inputLayoutCache.find(layoutHash);
1200         if (NULL == layout)
1201         {
1202            D3D11_INPUT_ELEMENT_DESC vertexElements[Attrib::Count+1+BGFX_CONFIG_MAX_INSTANCE_DATA_COUNT];
1203
1204            VertexDecl decl;
1205            memcpy(&decl, &_vertexDecl, sizeof(VertexDecl) );
1206            const uint8_t* attrMask = _program.m_vsh->m_attrMask;
1207
1208            for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
1209            {
1210               uint8_t mask = attrMask[ii];
1211               uint8_t attr = (decl.m_attributes[ii] & mask);
1212               decl.m_attributes[ii] = attr == 0 ? 0xff : attr == 0xff ? 0 : attr;
1213            }
1214
1215            D3D11_INPUT_ELEMENT_DESC* elem = fillVertexDecl(vertexElements, decl);
1216            uint32_t num = uint32_t(elem-vertexElements);
1217
1218            const D3D11_INPUT_ELEMENT_DESC inst = { "TEXCOORD", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, D3D11_APPEND_ALIGNED_ELEMENT, D3D11_INPUT_PER_INSTANCE_DATA, 1 };
1219
1220            for (uint32_t ii = 0; ii < _numInstanceData; ++ii)
1221            {
1222               uint32_t index = 8-_numInstanceData+ii;
1223
1224               uint32_t jj;
1225               D3D11_INPUT_ELEMENT_DESC* curr = vertexElements;
1226               for (jj = 0; jj < num; ++jj)
1227               {
1228                  curr = &vertexElements[jj];
1229                  if (0 == strcmp(curr->SemanticName, "TEXCOORD")
1230                     &&  curr->SemanticIndex == index)
1231                  {
1232                     break;
1233                  }
1234               }
1235
1236               if (jj == num)
1237               {
1238                  curr = elem;
1239                  ++elem;
1240               }
1241
1242               memcpy(curr, &inst, sizeof(D3D11_INPUT_ELEMENT_DESC) );
1243               curr->InputSlot = 1;
1244               curr->SemanticIndex = index;
1245               curr->AlignedByteOffset = ii*16;
1246            }
1247
1248            num = uint32_t(elem-vertexElements);
1249            DX_CHECK(m_device->CreateInputLayout(vertexElements
1250               , num
1251               , _program.m_vsh->m_code->data
1252               , _program.m_vsh->m_code->size
1253               , &layout
1254               ) );
1255            m_inputLayoutCache.add(layoutHash, layout);
1256         }
1257
1258         m_deviceCtx->IASetInputLayout(layout);
1259      }
1260
1261      void setBlendState(uint64_t _state, uint32_t _rgba = 0)
1262      {
1263         _state &= 0
1264            | BGFX_STATE_BLEND_MASK
1265            | BGFX_STATE_BLEND_EQUATION_MASK
1266            | BGFX_STATE_BLEND_INDEPENDENT
1267            | BGFX_STATE_ALPHA_WRITE
1268            | BGFX_STATE_RGB_WRITE
1269            ;
1270
1271         bx::HashMurmur2A murmur;
1272         murmur.begin();
1273         murmur.add(_state);
1274
1275         const uint64_t f0 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_FACTOR, BGFX_STATE_BLEND_FACTOR);
1276         const uint64_t f1 = BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_INV_FACTOR, BGFX_STATE_BLEND_INV_FACTOR);
1277         bool hasFactor = f0 == (_state & f0)
1278            || f1 == (_state & f1)
1279            ;
1280
1281         float blendFactor[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
1282         if (hasFactor)
1283         {
1284            blendFactor[0] = ( (_rgba>>24)     )/255.0f;
1285            blendFactor[1] = ( (_rgba>>16)&0xff)/255.0f;
1286            blendFactor[2] = ( (_rgba>> 8)&0xff)/255.0f;
1287            blendFactor[3] = ( (_rgba    )&0xff)/255.0f;
1288         }
1289         else
1290         {
1291            murmur.add(_rgba);
1292         }
1293
1294         uint32_t hash = murmur.end();
1295
1296         ID3D11BlendState* bs = m_blendStateCache.find(hash);
1297         if (NULL == bs)
1298         {
1299            D3D11_BLEND_DESC desc;
1300            memset(&desc, 0, sizeof(desc) );
1301            desc.IndependentBlendEnable = !!(BGFX_STATE_BLEND_INDEPENDENT & _state);
1302
1303            D3D11_RENDER_TARGET_BLEND_DESC* drt = &desc.RenderTarget[0];
1304            drt->BlendEnable = !!(BGFX_STATE_BLEND_MASK & _state);
1305
1306            const uint32_t blend    = uint32_t( (_state&BGFX_STATE_BLEND_MASK)>>BGFX_STATE_BLEND_SHIFT);
1307            const uint32_t equation = uint32_t( (_state&BGFX_STATE_BLEND_EQUATION_MASK)>>BGFX_STATE_BLEND_EQUATION_SHIFT);
1308
1309            const uint32_t srcRGB = (blend    )&0xf;
1310            const uint32_t dstRGB = (blend>> 4)&0xf;
1311            const uint32_t srcA   = (blend>> 8)&0xf;
1312            const uint32_t dstA   = (blend>>12)&0xf;
1313
1314            const uint32_t equRGB = (equation   )&0x7;
1315            const uint32_t equA   = (equation>>3)&0x7;
1316
1317            drt->SrcBlend       = s_blendFactor[srcRGB][0];
1318            drt->DestBlend      = s_blendFactor[dstRGB][0];
1319            drt->BlendOp        = s_blendEquation[equRGB];
1320
1321            drt->SrcBlendAlpha  = s_blendFactor[srcA][1];
1322            drt->DestBlendAlpha = s_blendFactor[dstA][1];
1323            drt->BlendOpAlpha   = s_blendEquation[equA];
1324
1325            uint32_t writeMask = (_state&BGFX_STATE_ALPHA_WRITE) ? D3D11_COLOR_WRITE_ENABLE_ALPHA : 0;
1326            writeMask |= (_state&BGFX_STATE_RGB_WRITE) ? D3D11_COLOR_WRITE_ENABLE_RED|D3D11_COLOR_WRITE_ENABLE_GREEN|D3D11_COLOR_WRITE_ENABLE_BLUE : 0;
1327
1328            drt->RenderTargetWriteMask = writeMask;
1329
1330            if (desc.IndependentBlendEnable)
1331            {
1332               for (uint32_t ii = 1, rgba = _rgba; ii < BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS; ++ii, rgba >>= 11)
1333               {
1334                  drt = &desc.RenderTarget[ii];
1335                  drt->BlendEnable = 0 != (rgba&0x7ff);
1336
1337                  const uint32_t src      = (rgba   )&0xf;
1338                  const uint32_t dst      = (rgba>>4)&0xf;
1339                  const uint32_t equation = (rgba>>8)&0x7;
1340
1341                  drt->SrcBlend       = s_blendFactor[src][0];
1342                  drt->DestBlend      = s_blendFactor[dst][0];
1343                  drt->BlendOp        = s_blendEquation[equation];
1344
1345                  drt->SrcBlendAlpha  = s_blendFactor[src][1];
1346                  drt->DestBlendAlpha = s_blendFactor[dst][1];
1347                  drt->BlendOpAlpha   = s_blendEquation[equation];
1348
1349                  drt->RenderTargetWriteMask = writeMask;
1350               }
1351            }
1352            else
1353            {
1354               for (uint32_t ii = 1; ii < BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS; ++ii)
1355               {
1356                  memcpy(&desc.RenderTarget[ii], drt, sizeof(D3D11_RENDER_TARGET_BLEND_DESC) );
1357               }
1358            }
1359
1360            DX_CHECK(m_device->CreateBlendState(&desc, &bs) );
1361
1362            m_blendStateCache.add(hash, bs);
1363         }
1364
1365         m_deviceCtx->OMSetBlendState(bs, blendFactor, 0xffffffff);
1366      }
1367
1368      void setDepthStencilState(uint64_t _state, uint64_t _stencil = 0)
1369      {
1370         _state &= BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK;
1371
1372         uint32_t fstencil = unpackStencil(0, _stencil);
1373         uint32_t ref = (fstencil&BGFX_STENCIL_FUNC_REF_MASK)>>BGFX_STENCIL_FUNC_REF_SHIFT;
1374         _stencil &= packStencil(~BGFX_STENCIL_FUNC_REF_MASK, BGFX_STENCIL_MASK);
1375
1376         bx::HashMurmur2A murmur;
1377         murmur.begin();
1378         murmur.add(_state);
1379         murmur.add(_stencil);
1380         uint32_t hash = murmur.end();
1381
1382         ID3D11DepthStencilState* dss = m_depthStencilStateCache.find(hash);
1383         if (NULL == dss)
1384         {
1385            D3D11_DEPTH_STENCIL_DESC desc;
1386            memset(&desc, 0, sizeof(desc) );
1387            uint32_t func = (_state&BGFX_STATE_DEPTH_TEST_MASK)>>BGFX_STATE_DEPTH_TEST_SHIFT;
1388            desc.DepthEnable = 0 != func;
1389            desc.DepthWriteMask = !!(BGFX_STATE_DEPTH_WRITE & _state) ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO;
1390            desc.DepthFunc = s_cmpFunc[func];
1391
1392            uint32_t bstencil = unpackStencil(1, _stencil);
1393            uint32_t frontAndBack = bstencil != BGFX_STENCIL_NONE && bstencil != fstencil;
1394            bstencil = frontAndBack ? bstencil : fstencil;
1395
1396            desc.StencilEnable = 0 != _stencil;
1397            desc.StencilReadMask = (fstencil&BGFX_STENCIL_FUNC_RMASK_MASK)>>BGFX_STENCIL_FUNC_RMASK_SHIFT;
1398            desc.StencilWriteMask = 0xff;
1399            desc.FrontFace.StencilFailOp      = s_stencilOp[(fstencil&BGFX_STENCIL_OP_FAIL_S_MASK)>>BGFX_STENCIL_OP_FAIL_S_SHIFT];
1400            desc.FrontFace.StencilDepthFailOp = s_stencilOp[(fstencil&BGFX_STENCIL_OP_FAIL_Z_MASK)>>BGFX_STENCIL_OP_FAIL_Z_SHIFT];
1401            desc.FrontFace.StencilPassOp      = s_stencilOp[(fstencil&BGFX_STENCIL_OP_PASS_Z_MASK)>>BGFX_STENCIL_OP_PASS_Z_SHIFT];
1402            desc.FrontFace.StencilFunc        = s_cmpFunc[(fstencil&BGFX_STENCIL_TEST_MASK)>>BGFX_STENCIL_TEST_SHIFT];
1403            desc.BackFace.StencilFailOp       = s_stencilOp[(bstencil&BGFX_STENCIL_OP_FAIL_S_MASK)>>BGFX_STENCIL_OP_FAIL_S_SHIFT];
1404            desc.BackFace.StencilDepthFailOp  = s_stencilOp[(bstencil&BGFX_STENCIL_OP_FAIL_Z_MASK)>>BGFX_STENCIL_OP_FAIL_Z_SHIFT];
1405            desc.BackFace.StencilPassOp       = s_stencilOp[(bstencil&BGFX_STENCIL_OP_PASS_Z_MASK)>>BGFX_STENCIL_OP_PASS_Z_SHIFT];
1406            desc.BackFace.StencilFunc         = s_cmpFunc[(bstencil&BGFX_STENCIL_TEST_MASK)>>BGFX_STENCIL_TEST_SHIFT];
1407
1408            DX_CHECK(m_device->CreateDepthStencilState(&desc, &dss) );
1409
1410            m_depthStencilStateCache.add(hash, dss);
1411         }
1412
1413         m_deviceCtx->OMSetDepthStencilState(dss, ref);
1414      }
1415
1416      void setDebugWireframe(bool _wireframe)
1417      {
1418         if (m_wireframe != _wireframe)
1419         {
1420            m_wireframe = _wireframe;
1421            m_rasterizerStateCache.invalidate();
1422         }
1423      }
1424
1425      void setRasterizerState(uint64_t _state, bool _wireframe = false, bool _scissor = false)
1426      {
1427         _state &= BGFX_STATE_CULL_MASK|BGFX_STATE_MSAA;
1428         _state |= _wireframe ? BGFX_STATE_PT_LINES : BGFX_STATE_NONE;
1429         _state |= _scissor ? BGFX_STATE_RESERVED_MASK : 0;
1430
1431         ID3D11RasterizerState* rs = m_rasterizerStateCache.find(_state);
1432         if (NULL == rs)
1433         {
1434            uint32_t cull = (_state&BGFX_STATE_CULL_MASK)>>BGFX_STATE_CULL_SHIFT;
1435
1436            D3D11_RASTERIZER_DESC desc;
1437            desc.FillMode = _wireframe ? D3D11_FILL_WIREFRAME : D3D11_FILL_SOLID;
1438            desc.CullMode = s_cullMode[cull];
1439            desc.FrontCounterClockwise = false;
1440            desc.DepthBias = 0;
1441            desc.DepthBiasClamp = 0.0f;
1442            desc.SlopeScaledDepthBias = 0.0f;
1443            desc.DepthClipEnable = false;
1444            desc.ScissorEnable = _scissor;
1445            desc.MultisampleEnable = !!(_state&BGFX_STATE_MSAA);
1446            desc.AntialiasedLineEnable = false;
1447
1448            DX_CHECK(m_device->CreateRasterizerState(&desc, &rs) );
1449
1450            m_rasterizerStateCache.add(_state, rs);
1451         }
1452
1453         m_deviceCtx->RSSetState(rs);
1454      }
1455
1456      ID3D11SamplerState* getSamplerState(uint32_t _flags)
1457      {
1458         _flags &= BGFX_TEXTURE_SAMPLER_BITS_MASK;
1459         ID3D11SamplerState* sampler = m_samplerStateCache.find(_flags);
1460         if (NULL == sampler)
1461         {
1462            const uint32_t cmpFunc = (_flags&BGFX_TEXTURE_COMPARE_MASK)>>BGFX_TEXTURE_COMPARE_SHIFT;
1463            const uint8_t minFilter = s_textureFilter[0][(_flags&BGFX_TEXTURE_MIN_MASK)>>BGFX_TEXTURE_MIN_SHIFT];
1464            const uint8_t magFilter = s_textureFilter[1][(_flags&BGFX_TEXTURE_MAG_MASK)>>BGFX_TEXTURE_MAG_SHIFT];
1465            const uint8_t mipFilter = s_textureFilter[2][(_flags&BGFX_TEXTURE_MIP_MASK)>>BGFX_TEXTURE_MIP_SHIFT];
1466            const uint8_t filter = 0 == cmpFunc ? 0 : D3D11_COMPARISON_FILTERING_BIT;
1467
1468            D3D11_SAMPLER_DESC sd;
1469            sd.Filter = (D3D11_FILTER)(filter|minFilter|magFilter|mipFilter);
1470            sd.AddressU = s_textureAddress[(_flags&BGFX_TEXTURE_U_MASK)>>BGFX_TEXTURE_U_SHIFT];
1471            sd.AddressV = s_textureAddress[(_flags&BGFX_TEXTURE_V_MASK)>>BGFX_TEXTURE_V_SHIFT];
1472            sd.AddressW = s_textureAddress[(_flags&BGFX_TEXTURE_W_MASK)>>BGFX_TEXTURE_W_SHIFT];
1473            sd.MipLODBias = 0.0f;
1474            sd.MaxAnisotropy = 1;
1475            sd.ComparisonFunc = 0 == cmpFunc ? D3D11_COMPARISON_NEVER : s_cmpFunc[cmpFunc];
1476            sd.BorderColor[0] = 0.0f;
1477            sd.BorderColor[1] = 0.0f;
1478            sd.BorderColor[2] = 0.0f;
1479            sd.BorderColor[3] = 0.0f;
1480            sd.MinLOD = 0;
1481            sd.MaxLOD = D3D11_FLOAT32_MAX;
1482
1483            m_device->CreateSamplerState(&sd, &sampler);
1484            DX_CHECK_REFCOUNT(sampler, 1);
1485
1486            m_samplerStateCache.add(_flags, sampler);
1487         }
1488
1489         return sampler;
1490      }
1491
1492      void commitTextureStage()
1493      {
1494         m_deviceCtx->PSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, m_textureStage.m_srv);
1495         m_deviceCtx->PSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, m_textureStage.m_sampler);
1496      }
1497
1498      void invalidateTextureStage()
1499      {
1500         m_textureStage.clear();
1501         commitTextureStage();
1502      }
1503
1504      void capturePostReset()
1505      {
1506         if (m_flags&BGFX_RESET_CAPTURE)
1507         {
1508            ID3D11Texture2D* backBuffer;
1509            DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&backBuffer) );
1510
1511            D3D11_TEXTURE2D_DESC backBufferDesc;
1512            backBuffer->GetDesc(&backBufferDesc);
1513
1514            D3D11_TEXTURE2D_DESC desc;
1515            memcpy(&desc, &backBufferDesc, sizeof(desc) );
1516            desc.SampleDesc.Count = 1;
1517            desc.SampleDesc.Quality = 0;
1518            desc.Usage = D3D11_USAGE_STAGING;
1519            desc.BindFlags = 0;
1520            desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ;
1521
1522            HRESULT hr = m_device->CreateTexture2D(&desc, NULL, &m_captureTexture);
1523            if (SUCCEEDED(hr) )
1524            {
1525               if (backBufferDesc.SampleDesc.Count != 1)
1526               {
1527                  desc.Usage = D3D11_USAGE_DEFAULT;
1528                  desc.CPUAccessFlags = 0;
1529                  m_device->CreateTexture2D(&desc, NULL, &m_captureResolve);
1530               }
1531
1532               g_callback->captureBegin(backBufferDesc.Width, backBufferDesc.Height, backBufferDesc.Width*4, TextureFormat::BGRA8, false);
1533            }
1534
1535            DX_RELEASE(backBuffer, 0);
1536         }
1537      }
1538
1539      void capturePreReset()
1540      {
1541         if (NULL != m_captureTexture)
1542         {
1543            g_callback->captureEnd();
1544         }
1545
1546         DX_RELEASE(m_captureResolve, 0);
1547         DX_RELEASE(m_captureTexture, 0);
1548      }
1549
1550      void capture()
1551      {
1552         if (NULL != m_captureTexture)
1553         {
1554            ID3D11Texture2D* backBuffer;
1555            DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&backBuffer) );
1556
1557            DXGI_MODE_DESC& desc = m_scd.BufferDesc;
1558
1559            if (NULL == m_captureResolve)
1560            {
1561               m_deviceCtx->CopyResource(m_captureTexture, backBuffer);
1562            }
1563            else
1564            {
1565               m_deviceCtx->ResolveSubresource(m_captureResolve, 0, backBuffer, 0, desc.Format);
1566               m_deviceCtx->CopyResource(m_captureTexture, m_captureResolve);
1567            }
1568
1569            D3D11_MAPPED_SUBRESOURCE mapped;
1570            DX_CHECK(m_deviceCtx->Map(m_captureTexture, 0, D3D11_MAP_READ, 0, &mapped) );
1571
1572            g_callback->captureFrame(mapped.pData, desc.Height*mapped.RowPitch);
1573
1574            m_deviceCtx->Unmap(m_captureTexture, 0);
1575
1576            DX_RELEASE(backBuffer, 0);
1577         }
1578      }
1579
1580      void commit(ConstantBuffer& _constantBuffer)
1581      {
1582         _constantBuffer.reset();
1583
1584         for (;;)
1585         {
1586            uint32_t opcode = _constantBuffer.read();
1587
1588            if (UniformType::End == opcode)
1589            {
1590               break;
1591            }
1592
1593            UniformType::Enum type;
1594            uint16_t loc;
1595            uint16_t num;
1596            uint16_t copy;
1597            ConstantBuffer::decodeOpcode(opcode, type, loc, num, copy);
1598
1599            const char* data;
1600            if (copy)
1601            {
1602               data = _constantBuffer.read(g_uniformTypeSize[type]*num);
1603            }
1604            else
1605            {
1606               UniformHandle handle;
1607               memcpy(&handle, _constantBuffer.read(sizeof(UniformHandle) ), sizeof(UniformHandle) );
1608               data = (const char*)m_uniforms[handle.idx];
1609            }
1610
1611#define CASE_IMPLEMENT_UNIFORM(_uniform, _dxsuffix, _type) \
1612      case UniformType::_uniform: \
1613      case UniformType::_uniform|BGFX_UNIFORM_FRAGMENTBIT: \
1614            { \
1615               setShaderConstant(type, loc, data, num); \
1616            } \
1617            break;
1618
1619            switch ( (int32_t)type)
1620            {
1621            case UniformType::Uniform3x3fv:
1622            case UniformType::Uniform3x3fv|BGFX_UNIFORM_FRAGMENTBIT: \
1623                {
1624                   float* value = (float*)data;
1625                   for (uint32_t ii = 0, count = num/3; ii < count; ++ii,  loc += 3*16, value += 9)
1626                   {
1627                      Matrix4 mtx;
1628                      mtx.un.val[ 0] = value[0];
1629                      mtx.un.val[ 1] = value[1];
1630                      mtx.un.val[ 2] = value[2];
1631                      mtx.un.val[ 3] = 0.0f;
1632                      mtx.un.val[ 4] = value[3];
1633                      mtx.un.val[ 5] = value[4];
1634                      mtx.un.val[ 6] = value[5];
1635                      mtx.un.val[ 7] = 0.0f;
1636                      mtx.un.val[ 8] = value[6];
1637                      mtx.un.val[ 9] = value[7];
1638                      mtx.un.val[10] = value[8];
1639                      mtx.un.val[11] = 0.0f;
1640                      setShaderConstant(type, loc, &mtx.un.val[0], 3);
1641                   }
1642               }
1643               break;
1644
1645            CASE_IMPLEMENT_UNIFORM(Uniform1i,    I, int);
1646            CASE_IMPLEMENT_UNIFORM(Uniform1f,    F, float);
1647            CASE_IMPLEMENT_UNIFORM(Uniform1iv,   I, int);
1648            CASE_IMPLEMENT_UNIFORM(Uniform1fv,   F, float);
1649            CASE_IMPLEMENT_UNIFORM(Uniform2fv,   F, float);
1650            CASE_IMPLEMENT_UNIFORM(Uniform3fv,   F, float);
1651            CASE_IMPLEMENT_UNIFORM(Uniform4fv,   F, float);
1652            CASE_IMPLEMENT_UNIFORM(Uniform4x4fv, F, float);
1653
1654            case UniformType::End:
1655               break;
1656
1657            default:
1658               BX_TRACE("%4d: INVALID 0x%08x, t %d, l %d, n %d, c %d", _constantBuffer.getPos(), opcode, type, loc, num, copy);
1659               break;
1660            }
1661
1662#undef CASE_IMPLEMENT_UNIFORM
1663
1664         }
1665      }
1666
1667      void clearQuad(ClearQuad& _clearQuad, const Rect& _rect, const Clear& _clear, uint32_t _height = 0)
1668      {
1669         BX_UNUSED(_height);
1670         uint32_t width  = m_scd.BufferDesc.Width;
1671         uint32_t height = m_scd.BufferDesc.Height;
1672
1673         if (0 == _rect.m_x
1674         &&  0 == _rect.m_y
1675         &&  width == _rect.m_width
1676         &&  height == _rect.m_height)
1677         {
1678            clear(_clear);
1679         }
1680         else
1681         {
1682            ID3D11DeviceContext* deviceCtx = m_deviceCtx;
1683
1684            uint64_t state = 0;
1685            state |= _clear.m_flags & BGFX_CLEAR_COLOR_BIT ? BGFX_STATE_RGB_WRITE|BGFX_STATE_ALPHA_WRITE : 0;
1686            state |= _clear.m_flags & BGFX_CLEAR_DEPTH_BIT ? BGFX_STATE_DEPTH_TEST_ALWAYS|BGFX_STATE_DEPTH_WRITE : 0;
1687
1688            uint64_t stencil = 0;
1689            stencil |= _clear.m_flags & BGFX_CLEAR_STENCIL_BIT ? 0
1690               | BGFX_STENCIL_TEST_ALWAYS
1691               | BGFX_STENCIL_FUNC_REF(_clear.m_stencil)
1692               | BGFX_STENCIL_FUNC_RMASK(0xff)
1693               | BGFX_STENCIL_OP_FAIL_S_REPLACE
1694               | BGFX_STENCIL_OP_FAIL_Z_REPLACE
1695               | BGFX_STENCIL_OP_PASS_Z_REPLACE
1696               : 0
1697               ;
1698
1699            setBlendState(state);
1700            setDepthStencilState(state, stencil);
1701            setRasterizerState(state);
1702
1703            uint32_t numMrt = 0;
1704            FrameBufferHandle fbh = m_fbh;
1705            if (isValid(fbh) )
1706            {
1707               const FrameBufferD3D11& fb = m_frameBuffers[fbh.idx];
1708               numMrt = bx::uint32_max(1, fb.m_num)-1;
1709            }
1710
1711            ProgramD3D11& program = m_program[_clearQuad.m_program[numMrt].idx];
1712            m_currentProgram = &program;
1713            deviceCtx->VSSetShader(program.m_vsh->m_vertexShader, NULL, 0);
1714            deviceCtx->VSSetConstantBuffers(0, 0, NULL);
1715            if (NULL != m_currentColor)
1716            {
1717               deviceCtx->PSSetShader(program.m_fsh->m_pixelShader, NULL, 0);
1718               deviceCtx->PSSetConstantBuffers(0, 0, NULL);
1719            }
1720            else
1721            {
1722               deviceCtx->PSSetShader(NULL, NULL, 0);
1723            }
1724
1725            VertexBufferD3D11& vb = m_vertexBuffers[_clearQuad.m_vb->handle.idx];
1726            VertexDecl& vertexDecl = m_vertexDecls[_clearQuad.m_vb->decl.idx];
1727            uint32_t stride = vertexDecl.m_stride;
1728            uint32_t offset = 0;
1729
1730            {
1731               struct Vertex
1732               {
1733                  float m_x;
1734                  float m_y;
1735                  float m_z;
1736                  uint32_t m_abgr;
1737               } * vertex = (Vertex*)_clearQuad.m_vb->data;
1738               BX_CHECK(stride == sizeof(Vertex), "Stride/Vertex mismatch (stride %d, sizeof(Vertex) %d)", stride, sizeof(Vertex) );
1739
1740               const uint32_t abgr = bx::endianSwap(_clear.m_rgba);
1741               const float depth = _clear.m_depth;
1742
1743               vertex->m_x = -1.0f;
1744               vertex->m_y = -1.0f;
1745               vertex->m_z = depth;
1746               vertex->m_abgr = abgr;
1747               vertex++;
1748               vertex->m_x =  1.0f;
1749               vertex->m_y = -1.0f;
1750               vertex->m_z = depth;
1751               vertex->m_abgr = abgr;
1752               vertex++;
1753               vertex->m_x =  1.0f;
1754               vertex->m_y =  1.0f;
1755               vertex->m_z = depth;
1756               vertex->m_abgr = abgr;
1757               vertex++;
1758               vertex->m_x = -1.0f;
1759               vertex->m_y =  1.0f;
1760               vertex->m_z = depth;
1761               vertex->m_abgr = abgr;
1762            }
1763
1764            m_vertexBuffers[_clearQuad.m_vb->handle.idx].update(0, 4*_clearQuad.m_decl.m_stride, _clearQuad.m_vb->data);
1765            deviceCtx->IASetVertexBuffers(0, 1, &vb.m_ptr, &stride, &offset);
1766            setInputLayout(vertexDecl, program, 0);
1767
1768            IndexBufferD3D11& ib = m_indexBuffers[_clearQuad.m_ib.idx];
1769            deviceCtx->IASetIndexBuffer(ib.m_ptr, DXGI_FORMAT_R16_UINT, 0);
1770
1771            deviceCtx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
1772            deviceCtx->DrawIndexed(6, 0, 0);
1773         }
1774      }
1775
1776      void* m_d3d9dll;
1777      D3DPERF_SetMarkerFunc m_D3DPERF_SetMarker;
1778      D3DPERF_BeginEventFunc m_D3DPERF_BeginEvent;
1779      D3DPERF_EndEventFunc m_D3DPERF_EndEvent;
1780
1781#if USE_D3D11_DYNAMIC_LIB
1782      void* m_d3d11dll;
1783      void* m_dxgidll;
1784#endif // USE_D3D11_DYNAMIC_LIB
1785
1786      D3D_DRIVER_TYPE m_driverType;
1787      IDXGIAdapter* m_adapter;
1788      DXGI_ADAPTER_DESC m_adapterDesc;
1789      IDXGIFactory* m_factory;
1790      IDXGISwapChain* m_swapChain;
1791      ID3D11Device* m_device;
1792      ID3D11DeviceContext* m_deviceCtx;
1793      ID3D11RenderTargetView* m_backBufferColor;
1794      ID3D11DepthStencilView* m_backBufferDepthStencil;
1795      ID3D11RenderTargetView* m_currentColor;
1796      ID3D11DepthStencilView* m_currentDepthStencil;
1797
1798      ID3D11Texture2D* m_captureTexture;
1799      ID3D11Texture2D* m_captureResolve;
1800
1801      Resolution m_resolution;
1802      bool m_wireframe;
1803
1804      DXGI_SWAP_CHAIN_DESC m_scd;
1805      uint32_t m_flags;
1806
1807      IndexBufferD3D11 m_indexBuffers[BGFX_CONFIG_MAX_INDEX_BUFFERS];
1808      VertexBufferD3D11 m_vertexBuffers[BGFX_CONFIG_MAX_VERTEX_BUFFERS];
1809      ShaderD3D11 m_shaders[BGFX_CONFIG_MAX_SHADERS];
1810      ProgramD3D11 m_program[BGFX_CONFIG_MAX_PROGRAMS];
1811      TextureD3D11 m_textures[BGFX_CONFIG_MAX_TEXTURES];
1812      VertexDecl m_vertexDecls[BGFX_CONFIG_MAX_VERTEX_DECLS];
1813      FrameBufferD3D11 m_frameBuffers[BGFX_CONFIG_MAX_FRAME_BUFFERS];
1814      void* m_uniforms[BGFX_CONFIG_MAX_UNIFORMS];
1815      Matrix4 m_predefinedUniforms[PredefinedUniform::Count];
1816      UniformRegistry m_uniformReg;
1817     
1818      StateCacheT<ID3D11BlendState> m_blendStateCache;
1819      StateCacheT<ID3D11DepthStencilState> m_depthStencilStateCache;
1820      StateCacheT<ID3D11InputLayout> m_inputLayoutCache;
1821      StateCacheT<ID3D11RasterizerState> m_rasterizerStateCache;
1822      StateCacheT<ID3D11SamplerState> m_samplerStateCache;
1823
1824      TextVideoMem m_textVideoMem;
1825
1826      TextureStage m_textureStage;
1827
1828      ProgramD3D11* m_currentProgram;
1829
1830      uint8_t m_vsScratch[64<<10];
1831      uint8_t m_fsScratch[64<<10];
1832
1833      uint32_t m_vsChanges;
1834      uint32_t m_fsChanges;
1835
1836      FrameBufferHandle m_fbh;
1837      bool m_rtMsaa;
1838   };
1839
1840   static RendererContextD3D11* s_renderD3D11;
1841
1842   RendererContextI* rendererCreateD3D11()
1843   {
1844      s_renderD3D11 = BX_NEW(g_allocator, RendererContextD3D11);
1845      return s_renderD3D11;
1846   }
1847
1848   void rendererDestroyD3D11()
1849   {
1850      BX_DELETE(g_allocator, s_renderD3D11);
1851      s_renderD3D11 = NULL;
1852   }
1853
1854   void IndexBufferD3D11::create(uint32_t _size, void* _data)
1855   {
1856      m_size = _size;
1857      m_dynamic = NULL == _data;
1858
1859      D3D11_BUFFER_DESC desc;
1860      desc.ByteWidth = _size;
1861      desc.BindFlags = D3D11_BIND_INDEX_BUFFER;
1862      desc.MiscFlags = 0;
1863      desc.StructureByteStride = 0;
1864
1865      if (m_dynamic)
1866      {
1867         desc.Usage = D3D11_USAGE_DYNAMIC;
1868         desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
1869
1870         DX_CHECK(s_renderD3D11->m_device->CreateBuffer(&desc
1871            , NULL
1872            , &m_ptr
1873            ) );
1874      }
1875      else
1876      {
1877         desc.Usage = D3D11_USAGE_IMMUTABLE;
1878         desc.CPUAccessFlags = 0;
1879
1880         D3D11_SUBRESOURCE_DATA srd;
1881         srd.pSysMem = _data;
1882         srd.SysMemPitch = 0;
1883         srd.SysMemSlicePitch = 0;
1884
1885         DX_CHECK(s_renderD3D11->m_device->CreateBuffer(&desc
1886            , &srd
1887            , &m_ptr
1888            ) );
1889      }
1890   }
1891
1892   void IndexBufferD3D11::update(uint32_t _offset, uint32_t _size, void* _data)
1893   {
1894      ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx;
1895      BX_CHECK(m_dynamic, "Must be dynamic!");
1896
1897      D3D11_MAPPED_SUBRESOURCE mapped;
1898      D3D11_MAP type = m_dynamic && 0 == _offset && m_size == _size ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE;
1899      DX_CHECK(deviceCtx->Map(m_ptr, 0, type, 0, &mapped) );
1900      memcpy( (uint8_t*)mapped.pData + _offset, _data, _size);
1901      deviceCtx->Unmap(m_ptr, 0);
1902   }
1903
1904   void VertexBufferD3D11::create(uint32_t _size, void* _data, VertexDeclHandle _declHandle)
1905   {
1906      m_size = _size;
1907      m_decl = _declHandle;
1908      m_dynamic = NULL == _data;
1909
1910      D3D11_BUFFER_DESC desc;
1911      desc.ByteWidth = _size;
1912      desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
1913      desc.MiscFlags = 0;
1914
1915      if (m_dynamic)
1916      {
1917         desc.Usage = D3D11_USAGE_DYNAMIC;
1918         desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
1919         desc.StructureByteStride = 0;
1920
1921         DX_CHECK(s_renderD3D11->m_device->CreateBuffer(&desc
1922            , NULL
1923            , &m_ptr
1924            ) );
1925      }
1926      else
1927      {
1928         desc.Usage = D3D11_USAGE_IMMUTABLE;
1929         desc.CPUAccessFlags = 0;
1930         desc.StructureByteStride = 0;
1931
1932         D3D11_SUBRESOURCE_DATA srd;
1933         srd.pSysMem = _data;
1934         srd.SysMemPitch = 0;
1935         srd.SysMemSlicePitch = 0;
1936
1937         DX_CHECK(s_renderD3D11->m_device->CreateBuffer(&desc
1938            , &srd
1939            , &m_ptr
1940            ) );
1941      }
1942   }
1943
1944   void VertexBufferD3D11::update(uint32_t _offset, uint32_t _size, void* _data)
1945   {
1946      ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx;
1947      BX_CHECK(m_dynamic, "Must be dynamic!");
1948
1949      D3D11_MAPPED_SUBRESOURCE mapped;
1950      D3D11_MAP type = m_dynamic && 0 == _offset && m_size == _size ? D3D11_MAP_WRITE_DISCARD : D3D11_MAP_WRITE_NO_OVERWRITE;
1951      DX_CHECK(deviceCtx->Map(m_ptr, 0, type, 0, &mapped) );
1952      memcpy( (uint8_t*)mapped.pData + _offset, _data, _size);
1953      deviceCtx->Unmap(m_ptr, 0);
1954   }
1955
1956   void ShaderD3D11::create(const Memory* _mem)
1957   {
1958      bx::MemoryReader reader(_mem->data, _mem->size);
1959
1960      uint32_t magic;
1961      bx::read(&reader, magic);
1962
1963      switch (magic)
1964      {
1965      case BGFX_CHUNK_MAGIC_CSH:
1966      case BGFX_CHUNK_MAGIC_FSH:
1967      case BGFX_CHUNK_MAGIC_VSH:
1968         break;
1969
1970      default:
1971         BGFX_FATAL(false, Fatal::InvalidShader, "Unknown shader format %x.", magic);
1972         break;
1973      }
1974
1975      bool fragment = BGFX_CHUNK_MAGIC_FSH == magic;
1976
1977      uint32_t iohash;
1978      bx::read(&reader, iohash);
1979
1980      uint16_t count;
1981      bx::read(&reader, count);
1982
1983      m_numPredefined = 0;
1984      m_numUniforms = count;
1985
1986      BX_TRACE("%s Shader consts %d"
1987         , BGFX_CHUNK_MAGIC_FSH == magic ? "Fragment" : BGFX_CHUNK_MAGIC_VSH == magic ? "Vertex" : "Compute"
1988         , count
1989         );
1990
1991      uint8_t fragmentBit = fragment ? BGFX_UNIFORM_FRAGMENTBIT : 0;
1992
1993      if (0 < count)
1994      {
1995         m_constantBuffer = ConstantBuffer::create(1024);
1996
1997         for (uint32_t ii = 0; ii < count; ++ii)
1998         {
1999            uint8_t nameSize;
2000            bx::read(&reader, nameSize);
2001
2002            char name[256];
2003            bx::read(&reader, &name, nameSize);
2004            name[nameSize] = '\0';
2005
2006            uint8_t type;
2007            bx::read(&reader, type);
2008
2009            uint8_t num;
2010            bx::read(&reader, num);
2011
2012            uint16_t regIndex;
2013            bx::read(&reader, regIndex);
2014
2015            uint16_t regCount;
2016            bx::read(&reader, regCount);
2017
2018            const char* kind = "invalid";
2019
2020            PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name);
2021            if (PredefinedUniform::Count != predefined)
2022            {
2023               kind = "predefined";
2024               m_predefined[m_numPredefined].m_loc   = regIndex;
2025               m_predefined[m_numPredefined].m_count = regCount;
2026               m_predefined[m_numPredefined].m_type  = predefined|fragmentBit;
2027               m_numPredefined++;
2028            }
2029            else
2030            {
2031               const UniformInfo* info = s_renderD3D11->m_uniformReg.find(name);
2032
2033               if (NULL != info)
2034               {
2035                  kind = "user";
2036                  m_constantBuffer->writeUniformHandle( (UniformType::Enum)(type|fragmentBit), regIndex, info->m_handle, regCount);
2037               }
2038            }
2039
2040            BX_TRACE("\t%s: %s (%s), num %2d, r.index %3d, r.count %2d"
2041               , kind
2042               , name
2043               , getUniformTypeName(UniformType::Enum(type&~BGFX_UNIFORM_FRAGMENTBIT) )
2044               , num
2045               , regIndex
2046               , regCount
2047               );
2048         }
2049
2050         m_constantBuffer->finish();
2051      }
2052
2053      uint16_t shaderSize;
2054      bx::read(&reader, shaderSize);
2055
2056      const DWORD* code = (const DWORD*)reader.getDataPtr();
2057      bx::skip(&reader, shaderSize+1);
2058
2059      if (BGFX_CHUNK_MAGIC_FSH == magic)
2060      {
2061         DX_CHECK(s_renderD3D11->m_device->CreatePixelShader(code, shaderSize, NULL, &m_pixelShader) );
2062         BGFX_FATAL(NULL != m_ptr, bgfx::Fatal::InvalidShader, "Failed to create fragment shader.");
2063      }
2064      else if (BGFX_CHUNK_MAGIC_VSH == magic)
2065      {
2066         m_hash = bx::hashMurmur2A(code, shaderSize);
2067         m_code = alloc(shaderSize);
2068         memcpy(m_code->data, code, shaderSize);
2069
2070         DX_CHECK(s_renderD3D11->m_device->CreateVertexShader(code, shaderSize, NULL, &m_vertexShader) );
2071         BGFX_FATAL(NULL != m_ptr, bgfx::Fatal::InvalidShader, "Failed to create vertex shader.");
2072      }
2073      else
2074      {
2075         DX_CHECK(s_renderD3D11->m_device->CreateComputeShader(code, shaderSize, NULL, &m_computeShader) );
2076         BGFX_FATAL(NULL != m_ptr, bgfx::Fatal::InvalidShader, "Failed to create compute shader.");
2077      }
2078
2079      uint8_t numAttrs;
2080      bx::read(&reader, numAttrs);
2081
2082      memset(m_attrMask, 0, sizeof(m_attrMask));
2083
2084      for (uint32_t ii = 0; ii < numAttrs; ++ii)
2085      {
2086         uint16_t id;
2087         bx::read(&reader, id);
2088
2089         Attrib::Enum attr = idToAttrib(id);
2090
2091         if (Attrib::Count != attr)
2092         {
2093            m_attrMask[attr] = 0xff;
2094         }
2095      }
2096
2097      uint16_t size;
2098      bx::read(&reader, size);
2099
2100      if (0 < size)
2101      {
2102         D3D11_BUFFER_DESC desc;
2103         desc.ByteWidth = size;
2104         desc.Usage = D3D11_USAGE_DEFAULT;
2105         desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
2106         desc.CPUAccessFlags = 0;
2107         desc.MiscFlags = 0;
2108         desc.StructureByteStride = 0;
2109         DX_CHECK(s_renderD3D11->m_device->CreateBuffer(&desc, NULL, &m_buffer) );
2110      }
2111   }
2112
2113   void TextureD3D11::create(const Memory* _mem, uint32_t _flags, uint8_t _skip)
2114   {
2115      m_sampler = s_renderD3D11->getSamplerState(_flags);
2116
2117      ImageContainer imageContainer;
2118
2119      if (imageParse(imageContainer, _mem->data, _mem->size) )
2120      {
2121         uint8_t numMips = imageContainer.m_numMips;
2122         const uint32_t startLod = bx::uint32_min(_skip, numMips-1);
2123         numMips -= startLod;
2124         const ImageBlockInfo& blockInfo = getBlockInfo(TextureFormat::Enum(imageContainer.m_format) );
2125         const uint32_t textureWidth  = bx::uint32_max(blockInfo.blockWidth,  imageContainer.m_width >>startLod);
2126         const uint32_t textureHeight = bx::uint32_max(blockInfo.blockHeight, imageContainer.m_height>>startLod);
2127
2128         m_flags = _flags;
2129         m_requestedFormat = (uint8_t)imageContainer.m_format;
2130         m_textureFormat   = (uint8_t)imageContainer.m_format;
2131
2132         const TextureFormatInfo& tfi = s_textureFormat[m_requestedFormat];
2133         const bool convert = DXGI_FORMAT_UNKNOWN == tfi.m_fmt;
2134
2135         uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
2136         if (convert)
2137         {
2138            m_textureFormat = (uint8_t)TextureFormat::BGRA8;
2139            bpp = 32;
2140         }
2141
2142         if (imageContainer.m_cubeMap)
2143         {
2144            m_type = TextureCube;
2145         }
2146         else if (imageContainer.m_depth > 1)
2147         {
2148            m_type = Texture3D;
2149         }
2150         else
2151         {
2152            m_type = Texture2D;
2153         }
2154
2155         m_numMips = numMips;
2156
2157         uint32_t numSrd = numMips*(imageContainer.m_cubeMap ? 6 : 1);
2158         D3D11_SUBRESOURCE_DATA* srd = (D3D11_SUBRESOURCE_DATA*)alloca(numSrd*sizeof(D3D11_SUBRESOURCE_DATA) );
2159
2160         uint32_t kk = 0;
2161
2162         const bool compressed = isCompressed(TextureFormat::Enum(m_textureFormat) );
2163         const bool swizzle    = TextureFormat::BGRA8 == m_textureFormat && 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE);
2164
2165         BX_TRACE("Texture %3d: %s (requested: %s), %dx%d%s%s%s."
2166            , this - s_renderD3D11->m_textures
2167            , getName( (TextureFormat::Enum)m_textureFormat)
2168            , getName( (TextureFormat::Enum)m_requestedFormat)
2169            , textureWidth
2170            , textureHeight
2171            , imageContainer.m_cubeMap ? "x6" : ""
2172            , 0 != (m_flags&BGFX_TEXTURE_RT_MASK) ? " (render target)" : ""
2173            , swizzle ? " (swizzle BGRA8 -> RGBA8)" : ""
2174            );
2175
2176         for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
2177         {
2178            uint32_t width  = textureWidth;
2179            uint32_t height = textureHeight;
2180            uint32_t depth  = imageContainer.m_depth;
2181
2182            for (uint32_t lod = 0, num = numMips; lod < num; ++lod)
2183            {
2184               width  = bx::uint32_max(1, width);
2185               height = bx::uint32_max(1, height);
2186               depth  = bx::uint32_max(1, depth);
2187
2188               ImageMip mip;
2189               if (imageGetRawData(imageContainer, side, lod+startLod, _mem->data, _mem->size, mip) )
2190               {
2191                  srd[kk].pSysMem = mip.m_data;
2192
2193                  if (convert)
2194                  {
2195                     uint32_t srcpitch = mip.m_width*bpp/8;
2196                     uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, mip.m_width*mip.m_height*bpp/8);
2197                     imageDecodeToBgra8(temp, mip.m_data, mip.m_width, mip.m_height, srcpitch, mip.m_format);
2198
2199                     srd[kk].pSysMem = temp;
2200                     srd[kk].SysMemPitch = srcpitch;
2201                  }
2202                  else if (compressed)
2203                  {
2204                     srd[kk].SysMemPitch      = (mip.m_width /blockInfo.blockWidth )*mip.m_blockSize;
2205                     srd[kk].SysMemSlicePitch = (mip.m_height/blockInfo.blockHeight)*srd[kk].SysMemPitch;
2206                  }
2207                  else
2208                  {
2209                     srd[kk].SysMemPitch = mip.m_width*mip.m_bpp/8;
2210                  }
2211
2212                   if (swizzle)
2213                   {
2214//                      imageSwizzleBgra8(width, height, mip.m_width*4, data, temp);
2215                   }
2216
2217                  srd[kk].SysMemSlicePitch = mip.m_height*srd[kk].SysMemPitch;
2218                  ++kk;
2219               }
2220
2221               width  >>= 1;
2222               height >>= 1;
2223               depth  >>= 1;
2224            }
2225         }
2226
2227         const bool bufferOnly   = 0 != (m_flags&BGFX_TEXTURE_RT_BUFFER_ONLY);
2228         const bool computeWrite = 0 != (m_flags&BGFX_TEXTURE_COMPUTE_WRITE);
2229         const bool renderTarget = 0 != (m_flags&BGFX_TEXTURE_RT_MASK);
2230         const uint32_t msaaQuality = bx::uint32_satsub( (m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1);
2231         const DXGI_SAMPLE_DESC& msaa = s_msaa[msaaQuality];
2232
2233         D3D11_SHADER_RESOURCE_VIEW_DESC srvd;
2234         memset(&srvd, 0, sizeof(srvd) );
2235         srvd.Format = s_textureFormat[m_textureFormat].m_fmtSrv;
2236         DXGI_FORMAT format = s_textureFormat[m_textureFormat].m_fmt;
2237
2238         if (swizzle)
2239         {
2240            format      = DXGI_FORMAT_R8G8B8A8_UNORM;
2241            srvd.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
2242         }
2243
2244         switch (m_type)
2245         {
2246         case Texture2D:
2247         case TextureCube:
2248            {
2249               D3D11_TEXTURE2D_DESC desc;
2250               desc.Width = textureWidth;
2251               desc.Height = textureHeight;
2252               desc.MipLevels = numMips;
2253               desc.Format = format;
2254               desc.SampleDesc = msaa;
2255               desc.Usage = kk == 0 ? D3D11_USAGE_DEFAULT : D3D11_USAGE_IMMUTABLE;
2256               desc.BindFlags = bufferOnly ? 0 : D3D11_BIND_SHADER_RESOURCE;
2257               desc.CPUAccessFlags = 0;
2258
2259               if (isDepth( (TextureFormat::Enum)m_textureFormat) )
2260               {
2261                  desc.BindFlags |= D3D11_BIND_DEPTH_STENCIL;
2262                  desc.Usage = D3D11_USAGE_DEFAULT;
2263               }
2264               else if (renderTarget)
2265               {
2266                  desc.BindFlags |= D3D11_BIND_RENDER_TARGET;
2267                  desc.Usage = D3D11_USAGE_DEFAULT;
2268               }
2269
2270               if (computeWrite)
2271               {
2272                  desc.BindFlags |= D3D11_BIND_UNORDERED_ACCESS;
2273                  desc.Usage = D3D11_USAGE_DEFAULT;
2274               }
2275
2276               if (imageContainer.m_cubeMap)
2277               {
2278                  desc.ArraySize = 6;
2279                  desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;
2280                  srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
2281                  srvd.TextureCube.MipLevels = numMips;
2282               }
2283               else
2284               {
2285                  desc.ArraySize = 1;
2286                  desc.MiscFlags = 0;
2287                  srvd.ViewDimension = 1 < msaa.Count ? D3D11_SRV_DIMENSION_TEXTURE2DMS : D3D11_SRV_DIMENSION_TEXTURE2D;
2288                  srvd.Texture2D.MipLevels = numMips;
2289               }
2290
2291               DX_CHECK(s_renderD3D11->m_device->CreateTexture2D(&desc, kk == 0 ? NULL : srd, &m_texture2d) );
2292            }
2293            break;
2294
2295         case Texture3D:
2296            {
2297               D3D11_TEXTURE3D_DESC desc;
2298               desc.Width = textureWidth;
2299               desc.Height = textureHeight;
2300               desc.Depth = imageContainer.m_depth;
2301               desc.MipLevels = imageContainer.m_numMips;
2302               desc.Format = format;
2303               desc.Usage = kk == 0 ? D3D11_USAGE_DEFAULT : D3D11_USAGE_IMMUTABLE;
2304               desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
2305               desc.CPUAccessFlags = 0;
2306               desc.MiscFlags = 0;
2307
2308               if (computeWrite)
2309               {
2310                  desc.BindFlags |= D3D11_BIND_UNORDERED_ACCESS;
2311                  desc.Usage = D3D11_USAGE_DEFAULT;
2312               }
2313
2314               srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE3D;
2315               srvd.Texture3D.MipLevels = numMips;
2316
2317               DX_CHECK(s_renderD3D11->m_device->CreateTexture3D(&desc, kk == 0 ? NULL : srd, &m_texture3d) );
2318            }
2319            break;
2320         }
2321
2322         if (!bufferOnly)
2323         {
2324            DX_CHECK(s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, &srvd, &m_srv) );
2325         }
2326
2327         if (computeWrite)
2328         {
2329            DX_CHECK(s_renderD3D11->m_device->CreateUnorderedAccessView(m_ptr, NULL, &m_uav) );
2330         }
2331
2332         if (convert
2333         &&  0 != kk)
2334         {
2335            kk = 0;
2336            for (uint8_t side = 0, numSides = imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
2337            {
2338               for (uint32_t lod = 0, num = numMips; lod < num; ++lod)
2339               {
2340                  BX_FREE(g_allocator, const_cast<void*>(srd[kk].pSysMem) );
2341                  ++kk;
2342               }
2343            }
2344         }
2345      }
2346   }
2347
2348   void TextureD3D11::destroy()
2349   {
2350      DX_RELEASE(m_srv, 0);
2351      DX_RELEASE(m_uav, 0);
2352      DX_RELEASE(m_ptr, 0);
2353   }
2354
2355   void TextureD3D11::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)
2356   {
2357      ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx;
2358
2359      D3D11_BOX box;
2360      box.left = _rect.m_x;
2361      box.top = _rect.m_y;
2362      box.right = box.left + _rect.m_width;
2363      box.bottom = box.top + _rect.m_height;
2364      box.front = _z;
2365      box.back = box.front + _depth;
2366
2367      const uint32_t subres = _mip + (_side * m_numMips);
2368      const uint32_t bpp = getBitsPerPixel(TextureFormat::Enum(m_textureFormat) );
2369      const uint32_t rectpitch = _rect.m_width*bpp/8;
2370      const uint32_t srcpitch  = UINT16_MAX == _pitch ? rectpitch : _pitch;
2371
2372      const bool convert = m_textureFormat != m_requestedFormat;
2373
2374      uint8_t* data = _mem->data;
2375      uint8_t* temp = NULL;
2376
2377      if (convert)
2378      {
2379         uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
2380         imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, m_requestedFormat);
2381         data = temp;
2382      }
2383
2384      deviceCtx->UpdateSubresource(m_ptr, subres, &box, data, srcpitch, 0);
2385
2386      if (NULL != temp)
2387      {
2388         BX_FREE(g_allocator, temp);
2389      }
2390   }
2391
2392   void TextureD3D11::commit(uint8_t _stage, uint32_t _flags)
2393   {
2394      TextureStage& ts = s_renderD3D11->m_textureStage;
2395      ts.m_srv[_stage] = m_srv;
2396      ts.m_sampler[_stage] = 0 == (BGFX_SAMPLER_DEFAULT_FLAGS & _flags)
2397         ? s_renderD3D11->getSamplerState(_flags)
2398         : m_sampler
2399         ;
2400   }
2401
2402   void TextureD3D11::resolve()
2403   {
2404   }
2405
2406   void FrameBufferD3D11::create(uint8_t _num, const TextureHandle* _handles)
2407   {
2408      for (uint32_t ii = 0; ii < BX_COUNTOF(m_rtv); ++ii)
2409      {
2410         m_rtv[ii] = NULL;
2411      }
2412      m_dsv = NULL;
2413
2414      m_num = 0;
2415      for (uint32_t ii = 0; ii < _num; ++ii)
2416      {
2417         TextureHandle handle = _handles[ii];
2418         if (isValid(handle) )
2419         {
2420            const TextureD3D11& texture = s_renderD3D11->m_textures[handle.idx];
2421            if (isDepth( (TextureFormat::Enum)texture.m_textureFormat) )
2422            {
2423               BX_CHECK(NULL == m_dsv, "Frame buffer already has depth-stencil attached.");
2424
2425               const uint32_t msaaQuality = bx::uint32_satsub( (texture.m_flags&BGFX_TEXTURE_RT_MSAA_MASK)>>BGFX_TEXTURE_RT_MSAA_SHIFT, 1);
2426               const DXGI_SAMPLE_DESC& msaa = s_msaa[msaaQuality];
2427
2428               D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc;
2429               dsvDesc.Format = s_textureFormat[texture.m_textureFormat].m_fmtDsv;
2430               dsvDesc.ViewDimension = 1 < msaa.Count ? D3D11_DSV_DIMENSION_TEXTURE2DMS : D3D11_DSV_DIMENSION_TEXTURE2D;
2431               dsvDesc.Flags = 0;
2432               dsvDesc.Texture2D.MipSlice = 0;
2433               DX_CHECK(s_renderD3D11->m_device->CreateDepthStencilView(texture.m_ptr, &dsvDesc, &m_dsv) );
2434            }
2435            else
2436            {
2437               DX_CHECK(s_renderD3D11->m_device->CreateRenderTargetView(texture.m_ptr, NULL, &m_rtv[m_num]) );
2438               DX_CHECK(s_renderD3D11->m_device->CreateShaderResourceView(texture.m_ptr, NULL, &m_srv[m_num]) );
2439               m_num++;
2440            }
2441         }
2442      }
2443   }
2444
2445   void FrameBufferD3D11::destroy()
2446   {
2447      for (uint32_t ii = 0, num = m_num; ii < num; ++ii)
2448      {
2449         DX_RELEASE(m_srv[ii], 0);
2450         DX_RELEASE(m_rtv[ii], 0);
2451      }
2452
2453      DX_RELEASE(m_dsv, 0);
2454
2455      m_num = 0;
2456   }
2457
2458   void FrameBufferD3D11::resolve()
2459   {
2460   }
2461
2462   void FrameBufferD3D11::clear(const Clear& _clear)
2463   {
2464      ID3D11DeviceContext* deviceCtx = s_renderD3D11->m_deviceCtx;
2465
2466      if (BGFX_CLEAR_COLOR_BIT & _clear.m_flags)
2467      {
2468         uint32_t rgba = _clear.m_rgba;
2469         float frgba[4] = { (rgba>>24)/255.0f, ( (rgba>>16)&0xff)/255.0f, ( (rgba>>8)&0xff)/255.0f, (rgba&0xff)/255.0f };
2470         for (uint32_t ii = 0, num = m_num; ii < num; ++ii)
2471         {
2472            if (NULL != m_rtv[ii])
2473            {
2474               deviceCtx->ClearRenderTargetView(m_rtv[ii], frgba);
2475            }
2476         }
2477      }
2478
2479      if (NULL != m_dsv
2480      && (BGFX_CLEAR_DEPTH_BIT|BGFX_CLEAR_STENCIL_BIT) & _clear.m_flags)
2481      {
2482         DWORD flags = 0;
2483         flags |= (_clear.m_flags & BGFX_CLEAR_DEPTH_BIT) ? D3D11_CLEAR_DEPTH : 0;
2484         flags |= (_clear.m_flags & BGFX_CLEAR_STENCIL_BIT) ? D3D11_CLEAR_STENCIL : 0;
2485         deviceCtx->ClearDepthStencilView(m_dsv, flags, _clear.m_depth, _clear.m_stencil);
2486      }
2487   }
2488
2489   void RendererContextD3D11::submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter)
2490   {
2491      PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
2492
2493      ID3D11DeviceContext* deviceCtx = m_deviceCtx;
2494
2495      updateResolution(_render->m_resolution);
2496
2497      int64_t elapsed = -bx::getHPCounter();
2498      int64_t captureElapsed = 0;
2499
2500      if (0 < _render->m_iboffset)
2501      {
2502         TransientIndexBuffer* ib = _render->m_transientIb;
2503         m_indexBuffers[ib->handle.idx].update(0, _render->m_iboffset, ib->data);
2504      }
2505
2506      if (0 < _render->m_vboffset)
2507      {
2508         TransientVertexBuffer* vb = _render->m_transientVb;
2509         m_vertexBuffers[vb->handle.idx].update(0, _render->m_vboffset, vb->data);
2510      }
2511
2512      _render->sort();
2513
2514      RenderDraw currentState;
2515      currentState.clear();
2516      currentState.m_flags = BGFX_STATE_NONE;
2517      currentState.m_stencil = packStencil(BGFX_STENCIL_NONE, BGFX_STENCIL_NONE);
2518
2519      Matrix4 viewProj[BGFX_CONFIG_MAX_VIEWS];
2520      for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
2521      {
2522         bx::float4x4_mul(&viewProj[ii].un.f4x4, &_render->m_view[ii].un.f4x4, &_render->m_proj[ii].un.f4x4);
2523      }
2524
2525      Matrix4 invView;
2526      Matrix4 invProj;
2527      Matrix4 invViewProj;
2528      uint8_t invViewCached = 0xff;
2529      uint8_t invProjCached = 0xff;
2530      uint8_t invViewProjCached = 0xff;
2531
2532      bool wireframe = !!(_render->m_debug&BGFX_DEBUG_WIREFRAME);
2533      bool scissorEnabled = false;
2534      setDebugWireframe(wireframe);
2535
2536      uint16_t programIdx = invalidHandle;
2537      SortKey key;
2538      uint8_t view = 0xff;
2539      FrameBufferHandle fbh = BGFX_INVALID_HANDLE;
2540      float alphaRef = 0.0f;
2541
2542      const uint64_t pt = _render->m_debug&BGFX_DEBUG_WIREFRAME ? BGFX_STATE_PT_LINES : 0;
2543      uint8_t primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
2544      PrimInfo prim = s_primInfo[primIndex];
2545      deviceCtx->IASetPrimitiveTopology(prim.m_type);
2546
2547      bool wasCompute = false;
2548      bool viewHasScissor = false;
2549      Rect viewScissorRect;
2550      viewScissorRect.clear();
2551
2552      uint32_t statsNumPrimsSubmitted[BX_COUNTOF(s_primInfo)] = {};
2553      uint32_t statsNumPrimsRendered[BX_COUNTOF(s_primInfo)] = {};
2554      uint32_t statsNumInstances[BX_COUNTOF(s_primInfo)] = {};
2555      uint32_t statsNumIndices = 0;
2556
2557      if (0 == (_render->m_debug&BGFX_DEBUG_IFH) )
2558      {
2559         for (uint32_t item = 0, numItems = _render->m_num; item < numItems; ++item)
2560         {
2561            const bool isCompute = key.decode(_render->m_sortKeys[item]);
2562            const bool viewChanged = key.m_view != view;
2563
2564            const RenderItem& renderItem = _render->m_renderItem[_render->m_sortValues[item] ];
2565
2566            if (viewChanged)
2567            {
2568               PIX_ENDEVENT();
2569               PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), s_viewNameW[key.m_view]);
2570
2571               view = key.m_view;
2572               programIdx = invalidHandle;
2573
2574               if (_render->m_fb[view].idx != fbh.idx)
2575               {
2576                  fbh = _render->m_fb[view];
2577                  setFrameBuffer(fbh);
2578               }
2579
2580               const Rect& rect = _render->m_rect[view];
2581               const Rect& scissorRect = _render->m_scissor[view];
2582               viewHasScissor = !scissorRect.isZero();
2583               viewScissorRect = viewHasScissor ? scissorRect : rect;
2584
2585               D3D11_VIEWPORT vp;
2586               vp.TopLeftX = rect.m_x;
2587               vp.TopLeftY = rect.m_y;
2588               vp.Width = rect.m_width;
2589               vp.Height = rect.m_height;
2590               vp.MinDepth = 0.0f;
2591               vp.MaxDepth = 1.0f;
2592               deviceCtx->RSSetViewports(1, &vp);
2593               Clear& clear = _render->m_clear[view];
2594
2595               if (BGFX_CLEAR_NONE != clear.m_flags)
2596               {
2597                  clearQuad(_clearQuad, rect, clear);
2598               }
2599            }
2600
2601            if (isCompute)
2602            {
2603               if (!wasCompute)
2604               {
2605                  wasCompute = true;
2606
2607                  ID3D11ShaderResourceView* srv[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
2608                  deviceCtx->VSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, srv);
2609                  deviceCtx->PSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, srv);
2610
2611                  ID3D11SamplerState* sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
2612                  deviceCtx->VSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, sampler);
2613                  deviceCtx->PSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, sampler);
2614               }
2615
2616               const RenderCompute& compute = renderItem.compute;
2617
2618               bool programChanged = false;
2619               bool constantsChanged = compute.m_constBegin < compute.m_constEnd;
2620               rendererUpdateUniforms(this, _render->m_constantBuffer, compute.m_constBegin, compute.m_constEnd);
2621
2622               if (key.m_program != programIdx)
2623               {
2624                  programIdx = key.m_program;
2625
2626                  ProgramD3D11& program = m_program[key.m_program];
2627                  m_currentProgram = &program;
2628
2629                  deviceCtx->CSSetShader(program.m_vsh->m_computeShader, NULL, 0);
2630                  deviceCtx->CSSetConstantBuffers(0, 1, &program.m_vsh->m_buffer);
2631
2632                  programChanged =
2633                     constantsChanged = true;
2634               }
2635
2636               if (invalidHandle != programIdx)
2637               {
2638                  ProgramD3D11& program = m_program[programIdx];
2639
2640                  if (constantsChanged)
2641                  {
2642                     ConstantBuffer* vcb = program.m_vsh->m_constantBuffer;
2643                     if (NULL != vcb)
2644                     {
2645                        commit(*vcb);
2646                     }
2647                  }
2648
2649                  if (constantsChanged
2650                  ||  program.m_numPredefined > 0)
2651                  {
2652                     commitShaderConstants();
2653                  }
2654               }
2655
2656               ID3D11UnorderedAccessView* uav[BGFX_MAX_COMPUTE_BINDINGS] = {};
2657               ID3D11ShaderResourceView*  srv[BGFX_MAX_COMPUTE_BINDINGS] = {};
2658               ID3D11SamplerState*    sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
2659
2660               for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii)
2661               {
2662                  const ComputeBinding& bind = compute.m_bind[ii];
2663                  if (invalidHandle != bind.m_idx)
2664                  {
2665                     switch (bind.m_type)
2666                     {
2667                     case ComputeBinding::Image:
2668                        {
2669                           const TextureD3D11& texture = m_textures[bind.m_idx];
2670                           if (Access::Read != bind.m_access)
2671                           {
2672                              uav[ii] = texture.m_uav;
2673                           }
2674                           else
2675                           {
2676                              srv[ii] = texture.m_srv;
2677                              sampler[ii] = texture.m_sampler;
2678                           }
2679                        }
2680                        break;
2681
2682                     case ComputeBinding::Buffer:
2683                        {
2684                           const VertexBufferD3D11& vertexBuffer = m_vertexBuffers[bind.m_idx];
2685                           BX_UNUSED(vertexBuffer);
2686                        }
2687                        break;
2688                     }
2689                  }
2690               }
2691
2692               deviceCtx->CSSetUnorderedAccessViews(0, BGFX_MAX_COMPUTE_BINDINGS, uav, NULL);
2693               deviceCtx->CSSetShaderResources(0, BGFX_MAX_COMPUTE_BINDINGS, srv);
2694               deviceCtx->CSSetSamplers(0, BGFX_MAX_COMPUTE_BINDINGS, sampler);
2695
2696               deviceCtx->Dispatch(compute.m_numX, compute.m_numY, compute.m_numZ);
2697
2698               continue;
2699            }
2700
2701            if (wasCompute)
2702            {
2703               wasCompute = false;
2704
2705               programIdx = invalidHandle;
2706               m_currentProgram = NULL;
2707
2708               deviceCtx->CSSetShader(NULL, NULL, 0);
2709
2710               ID3D11UnorderedAccessView* uav[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
2711               deviceCtx->CSSetUnorderedAccessViews(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, uav, NULL);
2712
2713               ID3D11ShaderResourceView* srv[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
2714               deviceCtx->CSSetShaderResources(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, srv);
2715
2716               ID3D11SamplerState* samplers[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS] = {};
2717               m_deviceCtx->CSSetSamplers(0, BGFX_CONFIG_MAX_TEXTURE_SAMPLERS, samplers);
2718            }
2719
2720            const RenderDraw& draw = renderItem.draw;
2721
2722            const uint64_t newFlags = draw.m_flags;
2723            uint64_t changedFlags = currentState.m_flags ^ draw.m_flags;
2724            currentState.m_flags = newFlags;
2725
2726            const uint64_t newStencil = draw.m_stencil;
2727            uint64_t changedStencil = currentState.m_stencil ^ draw.m_stencil;
2728            currentState.m_stencil = newStencil;
2729
2730            if (viewChanged)
2731            {
2732               currentState.clear();
2733               currentState.m_scissor = !draw.m_scissor;
2734               changedFlags = BGFX_STATE_MASK;
2735               changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK);
2736               currentState.m_flags = newFlags;
2737               currentState.m_stencil = newStencil;
2738
2739               uint64_t newFlags = renderItem.draw.m_flags;
2740               setBlendState(newFlags);
2741               setDepthStencilState(newFlags, packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT) );
2742
2743               const uint64_t pt = newFlags&BGFX_STATE_PT_MASK;
2744               primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
2745               if (prim.m_type != s_primInfo[primIndex].m_type)
2746               {
2747                  prim = s_primInfo[primIndex];
2748                  deviceCtx->IASetPrimitiveTopology(prim.m_type);
2749               }
2750            }
2751
2752            uint16_t scissor = draw.m_scissor;
2753            if (currentState.m_scissor != scissor)
2754            {
2755               currentState.m_scissor = scissor;
2756
2757               if (UINT16_MAX == scissor)
2758               {
2759                  scissorEnabled = viewHasScissor;
2760                  if (viewHasScissor)
2761                  {
2762                     D3D11_RECT rc;
2763                     rc.left = viewScissorRect.m_x;
2764                     rc.top = viewScissorRect.m_y;
2765                     rc.right = viewScissorRect.m_x + viewScissorRect.m_width;
2766                     rc.bottom = viewScissorRect.m_y + viewScissorRect.m_height;
2767                     deviceCtx->RSSetScissorRects(1, &rc);
2768                  }
2769               }
2770               else
2771               {
2772                  Rect scissorRect;
2773                  scissorRect.intersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]);
2774                  scissorEnabled = true;
2775                  D3D11_RECT rc;
2776                  rc.left = scissorRect.m_x;
2777                  rc.top = scissorRect.m_y;
2778                  rc.right = scissorRect.m_x + scissorRect.m_width;
2779                  rc.bottom = scissorRect.m_y + scissorRect.m_height;
2780                  deviceCtx->RSSetScissorRects(1, &rc);
2781               }
2782
2783               setRasterizerState(newFlags, wireframe, scissorEnabled);
2784            }
2785
2786            if ( (BGFX_STATE_DEPTH_WRITE|BGFX_STATE_DEPTH_TEST_MASK) & changedFlags
2787            || 0 != changedStencil)
2788            {
2789               setDepthStencilState(newFlags, newStencil);
2790            }
2791
2792            if ( (0
2793                | BGFX_STATE_CULL_MASK
2794                | BGFX_STATE_RGB_WRITE
2795                | BGFX_STATE_ALPHA_WRITE
2796                | BGFX_STATE_BLEND_MASK
2797                | BGFX_STATE_BLEND_EQUATION_MASK
2798                | BGFX_STATE_ALPHA_REF_MASK
2799                | BGFX_STATE_PT_MASK
2800                | BGFX_STATE_POINT_SIZE_MASK
2801                | BGFX_STATE_MSAA
2802                ) & changedFlags)
2803            {
2804               if ( (BGFX_STATE_BLEND_MASK|BGFX_STATE_BLEND_EQUATION_MASK|BGFX_STATE_ALPHA_WRITE|BGFX_STATE_RGB_WRITE) & changedFlags)
2805               {
2806                  setBlendState(newFlags, draw.m_rgba);
2807               }
2808
2809               if ( (BGFX_STATE_CULL_MASK|BGFX_STATE_MSAA) & changedFlags)
2810               {
2811                  setRasterizerState(newFlags, wireframe, scissorEnabled);
2812               }
2813
2814               if (BGFX_STATE_ALPHA_REF_MASK & changedFlags)
2815               {
2816                  uint32_t ref = (newFlags&BGFX_STATE_ALPHA_REF_MASK)>>BGFX_STATE_ALPHA_REF_SHIFT;
2817                  alphaRef = ref/255.0f;
2818               }
2819
2820               const uint64_t pt = newFlags&BGFX_STATE_PT_MASK;
2821               primIndex = uint8_t(pt>>BGFX_STATE_PT_SHIFT);
2822               if (prim.m_type != s_primInfo[primIndex].m_type)
2823               {
2824                  prim = s_primInfo[primIndex];
2825                  deviceCtx->IASetPrimitiveTopology(prim.m_type);
2826               }
2827            }
2828
2829            bool programChanged = false;
2830            bool constantsChanged = draw.m_constBegin < draw.m_constEnd;
2831            rendererUpdateUniforms(this, _render->m_constantBuffer, draw.m_constBegin, draw.m_constEnd);
2832
2833            if (key.m_program != programIdx)
2834            {
2835               programIdx = key.m_program;
2836
2837               if (invalidHandle == programIdx)
2838               {
2839                  m_currentProgram = NULL;
2840
2841                  deviceCtx->VSSetShader(NULL, NULL, 0);
2842                  deviceCtx->PSSetShader(NULL, NULL, 0);
2843               }
2844               else
2845               {
2846                  ProgramD3D11& program = m_program[programIdx];
2847                  m_currentProgram = &program;
2848
2849                  const ShaderD3D11* vsh = program.m_vsh;
2850                  deviceCtx->VSSetShader(vsh->m_vertexShader, NULL, 0);
2851                  deviceCtx->VSSetConstantBuffers(0, 1, &vsh->m_buffer);
2852
2853                  if (NULL != m_currentColor)
2854                  {
2855                     const ShaderD3D11* fsh = program.m_fsh;
2856                     deviceCtx->PSSetShader(fsh->m_pixelShader, NULL, 0);
2857                     deviceCtx->PSSetConstantBuffers(0, 1, &fsh->m_buffer);
2858                  }
2859                  else
2860                  {
2861                     deviceCtx->PSSetShader(NULL, NULL, 0);
2862                  }
2863               }
2864
2865               programChanged =
2866                  constantsChanged = true;
2867            }
2868
2869            if (invalidHandle != programIdx)
2870            {
2871               ProgramD3D11& program = m_program[programIdx];
2872
2873               if (constantsChanged)
2874               {
2875                  ConstantBuffer* vcb = program.m_vsh->m_constantBuffer;
2876                  if (NULL != vcb)
2877                  {
2878                     commit(*vcb);
2879                  }
2880
2881                  ConstantBuffer* fcb = program.m_fsh->m_constantBuffer;
2882                  if (NULL != fcb)
2883                  {
2884                     commit(*fcb);
2885                  }
2886               }
2887
2888               for (uint32_t ii = 0, num = program.m_numPredefined; ii < num; ++ii)
2889               {
2890                  PredefinedUniform& predefined = program.m_predefined[ii];
2891                  uint8_t flags = predefined.m_type&BGFX_UNIFORM_FRAGMENTBIT;
2892                  switch (predefined.m_type&(~BGFX_UNIFORM_FRAGMENTBIT) )
2893                  {
2894                  case PredefinedUniform::ViewRect:
2895                     {
2896                        float rect[4];
2897                        rect[0] = _render->m_rect[view].m_x;
2898                        rect[1] = _render->m_rect[view].m_y;
2899                        rect[2] = _render->m_rect[view].m_width;
2900                        rect[3] = _render->m_rect[view].m_height;
2901
2902                        setShaderConstant(flags, predefined.m_loc, &rect[0], 1);
2903                     }
2904                     break;
2905
2906                  case PredefinedUniform::ViewTexel:
2907                     {
2908                        float rect[4];
2909                        rect[0] = 1.0f/float(_render->m_rect[view].m_width);
2910                        rect[1] = 1.0f/float(_render->m_rect[view].m_height);
2911
2912                        setShaderConstant(flags, predefined.m_loc, &rect[0], 1);
2913                     }
2914                     break;
2915
2916                  case PredefinedUniform::View:
2917                     {
2918                        setShaderConstant(flags, predefined.m_loc, _render->m_view[view].un.val, bx::uint32_min(4, predefined.m_count) );
2919                     }
2920                     break;
2921
2922                  case PredefinedUniform::InvView:
2923                     {
2924                        if (view != invViewCached)
2925                        {
2926                           invViewCached = view;
2927                           bx::float4x4_inverse(&invView.un.f4x4, &_render->m_view[view].un.f4x4);
2928                        }
2929
2930                        setShaderConstant(flags, predefined.m_loc, invView.un.val, bx::uint32_min(4, predefined.m_count) );
2931                     }
2932                     break;
2933
2934                  case PredefinedUniform::Proj:
2935                     {
2936                        setShaderConstant(flags, predefined.m_loc, _render->m_proj[view].un.val, bx::uint32_min(4, predefined.m_count) );
2937                     }
2938                     break;
2939
2940                  case PredefinedUniform::InvProj:
2941                     {
2942                        if (view != invProjCached)
2943                        {
2944                           invProjCached = view;
2945                           bx::float4x4_inverse(&invProj.un.f4x4, &_render->m_proj[view].un.f4x4);
2946                        }
2947
2948                        setShaderConstant(flags, predefined.m_loc, invProj.un.val, bx::uint32_min(4, predefined.m_count) );
2949                     }
2950                     break;
2951
2952                  case PredefinedUniform::ViewProj:
2953                     {
2954                        setShaderConstant(flags, predefined.m_loc, viewProj[view].un.val, bx::uint32_min(4, predefined.m_count) );
2955                     }
2956                     break;
2957
2958                  case PredefinedUniform::InvViewProj:
2959                     {
2960                        if (view != invViewProjCached)
2961                        {
2962                           invViewProjCached = view;
2963                           bx::float4x4_inverse(&invViewProj.un.f4x4, &viewProj[view].un.f4x4);
2964                        }
2965
2966                        setShaderConstant(flags, predefined.m_loc, invViewProj.un.val, bx::uint32_min(4, predefined.m_count) );
2967                     }
2968                     break;
2969
2970                  case PredefinedUniform::Model:
2971                     {
2972                        const Matrix4& model = _render->m_matrixCache.m_cache[draw.m_matrix];
2973                        setShaderConstant(flags, predefined.m_loc, model.un.val, bx::uint32_min(draw.m_num*4, predefined.m_count) );
2974                     }
2975                     break;
2976
2977                  case PredefinedUniform::ModelView:
2978                     {
2979                        Matrix4 modelView;
2980                        const Matrix4& model = _render->m_matrixCache.m_cache[draw.m_matrix];
2981                        bx::float4x4_mul(&modelView.un.f4x4, &model.un.f4x4, &_render->m_view[view].un.f4x4);
2982                        setShaderConstant(flags, predefined.m_loc, modelView.un.val, bx::uint32_min(4, predefined.m_count) );
2983                     }
2984                     break;
2985
2986                  case PredefinedUniform::ModelViewProj:
2987                     {
2988                        Matrix4 modelViewProj;
2989                        const Matrix4& model = _render->m_matrixCache.m_cache[draw.m_matrix];
2990                        bx::float4x4_mul(&modelViewProj.un.f4x4, &model.un.f4x4, &viewProj[view].un.f4x4);
2991                        setShaderConstant(flags, predefined.m_loc, modelViewProj.un.val, bx::uint32_min(4, predefined.m_count) );
2992                     }
2993                     break;
2994
2995                  case PredefinedUniform::AlphaRef:
2996                     {
2997                        setShaderConstant(flags, predefined.m_loc, &alphaRef, 1);
2998                     }
2999                     break;
3000
3001                  default:
3002                     BX_CHECK(false, "predefined %d not handled", predefined.m_type);
3003                     break;
3004                  }
3005               }
3006
3007               if (constantsChanged
3008               ||  program.m_numPredefined > 0)
3009               {
3010                  commitShaderConstants();
3011               }
3012            }
3013
3014            {
3015               uint32_t changes = 0;
3016               for (uint32_t stage = 0; stage < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++stage)
3017               {
3018                  const Sampler& sampler = draw.m_sampler[stage];
3019                  Sampler& current = currentState.m_sampler[stage];
3020                  if (current.m_idx != sampler.m_idx
3021                  ||  current.m_flags != sampler.m_flags
3022                  ||  programChanged)
3023                  {
3024                     if (invalidHandle != sampler.m_idx)
3025                     {
3026                        TextureD3D11& texture = m_textures[sampler.m_idx];
3027                        texture.commit(stage, sampler.m_flags);
3028                     }
3029                     else
3030                     {
3031                        m_textureStage.m_srv[stage] = NULL;
3032                        m_textureStage.m_sampler[stage] = NULL;
3033                     }
3034
3035                     ++changes;
3036                  }
3037
3038                  current = sampler;
3039               }
3040
3041               if (0 < changes)
3042               {
3043                  commitTextureStage();
3044               }
3045            }
3046
3047            if (programChanged
3048            ||  currentState.m_vertexBuffer.idx != draw.m_vertexBuffer.idx
3049            ||  currentState.m_instanceDataBuffer.idx != draw.m_instanceDataBuffer.idx
3050            ||  currentState.m_instanceDataOffset != draw.m_instanceDataOffset
3051            ||  currentState.m_instanceDataStride != draw.m_instanceDataStride)
3052            {
3053               currentState.m_vertexBuffer = draw.m_vertexBuffer;
3054               currentState.m_instanceDataBuffer.idx = draw.m_instanceDataBuffer.idx;
3055               currentState.m_instanceDataOffset = draw.m_instanceDataOffset;
3056               currentState.m_instanceDataStride = draw.m_instanceDataStride;
3057
3058               uint16_t handle = draw.m_vertexBuffer.idx;
3059               if (invalidHandle != handle)
3060               {
3061                  const VertexBufferD3D11& vb = m_vertexBuffers[handle];
3062
3063                  uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx;
3064                  const VertexDecl& vertexDecl = m_vertexDecls[decl];
3065                  uint32_t stride = vertexDecl.m_stride;
3066                  uint32_t offset = 0;
3067                  deviceCtx->IASetVertexBuffers(0, 1, &vb.m_ptr, &stride, &offset);
3068
3069                  if (isValid(draw.m_instanceDataBuffer) )
3070                  {
3071                      const VertexBufferD3D11& inst = m_vertexBuffers[draw.m_instanceDataBuffer.idx];
3072                     uint32_t instStride = draw.m_instanceDataStride;
3073                     deviceCtx->IASetVertexBuffers(1, 1, &inst.m_ptr, &instStride, &draw.m_instanceDataOffset);
3074                     setInputLayout(vertexDecl, m_program[programIdx], draw.m_instanceDataStride/16);
3075                  }
3076                  else
3077                  {
3078                     deviceCtx->IASetVertexBuffers(1, 0, NULL, NULL, NULL);
3079                     setInputLayout(vertexDecl, m_program[programIdx], 0);
3080                  }
3081               }
3082               else
3083               {
3084                  deviceCtx->IASetVertexBuffers(0, 0, NULL, NULL, NULL);
3085               }
3086            }
3087
3088            if (currentState.m_indexBuffer.idx != draw.m_indexBuffer.idx)
3089            {
3090               currentState.m_indexBuffer = draw.m_indexBuffer;
3091
3092               uint16_t handle = draw.m_indexBuffer.idx;
3093               if (invalidHandle != handle)
3094               {
3095                  const IndexBufferD3D11& ib = m_indexBuffers[handle];
3096                  deviceCtx->IASetIndexBuffer(ib.m_ptr, DXGI_FORMAT_R16_UINT, 0);
3097               }
3098               else
3099               {
3100                  deviceCtx->IASetIndexBuffer(NULL, DXGI_FORMAT_R16_UINT, 0);
3101               }
3102            }
3103
3104            if (isValid(currentState.m_vertexBuffer) )
3105            {
3106               uint32_t numVertices = draw.m_numVertices;
3107               if (UINT32_MAX == numVertices)
3108               {
3109                  const VertexBufferD3D11& vb = m_vertexBuffers[currentState.m_vertexBuffer.idx];
3110                  uint16_t decl = !isValid(vb.m_decl) ? draw.m_vertexDecl.idx : vb.m_decl.idx;
3111                  const VertexDecl& vertexDecl = m_vertexDecls[decl];
3112                  numVertices = vb.m_size/vertexDecl.m_stride;
3113               }
3114
3115               uint32_t numIndices = 0;
3116               uint32_t numPrimsSubmitted = 0;
3117               uint32_t numInstances = 0;
3118               uint32_t numPrimsRendered = 0;
3119
3120               if (isValid(draw.m_indexBuffer) )
3121               {
3122                  if (UINT32_MAX == draw.m_numIndices)
3123                  {
3124                     numIndices = m_indexBuffers[draw.m_indexBuffer.idx].m_size/2;
3125                     numPrimsSubmitted = numIndices/prim.m_div - prim.m_sub;
3126                     numInstances = draw.m_numInstances;
3127                     numPrimsRendered = numPrimsSubmitted*draw.m_numInstances;
3128
3129                     deviceCtx->DrawIndexedInstanced(numIndices
3130                        , draw.m_numInstances
3131                        , 0
3132                        , draw.m_startVertex
3133                        , 0
3134                        );
3135                  }
3136                  else if (prim.m_min <= draw.m_numIndices)
3137                  {
3138                     numIndices = draw.m_numIndices;
3139                     numPrimsSubmitted = numIndices/prim.m_div - prim.m_sub;
3140                     numInstances = draw.m_numInstances;
3141                     numPrimsRendered = numPrimsSubmitted*draw.m_numInstances;
3142
3143                     deviceCtx->DrawIndexedInstanced(numIndices
3144                        , draw.m_numInstances
3145                        , draw.m_startIndex
3146                        , draw.m_startVertex
3147                        , 0
3148                        );
3149                  }
3150               }
3151               else
3152               {
3153                  numPrimsSubmitted = numVertices/prim.m_div - prim.m_sub;
3154                  numInstances = draw.m_numInstances;
3155                  numPrimsRendered = numPrimsSubmitted*draw.m_numInstances;
3156
3157                  deviceCtx->DrawInstanced(numVertices
3158                     , draw.m_numInstances
3159                     , draw.m_startVertex
3160                     , 0
3161                     );
3162               }
3163
3164               statsNumPrimsSubmitted[primIndex] += numPrimsSubmitted;
3165               statsNumPrimsRendered[primIndex]  += numPrimsRendered;
3166               statsNumInstances[primIndex]      += numInstances;
3167               statsNumIndices += numIndices;
3168            }
3169         }
3170
3171         if (0 < _render->m_num)
3172         {
3173            captureElapsed = -bx::getHPCounter();
3174            capture();
3175            captureElapsed += bx::getHPCounter();
3176         }
3177      }
3178
3179      int64_t now = bx::getHPCounter();
3180      elapsed += now;
3181
3182      static int64_t last = now;
3183      int64_t frameTime = now - last;
3184      last = now;
3185
3186      static int64_t min = frameTime;
3187      static int64_t max = frameTime;
3188      min = min > frameTime ? frameTime : min;
3189      max = max < frameTime ? frameTime : max;
3190
3191      if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
3192      {
3193         PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
3194
3195         TextVideoMem& tvm = m_textVideoMem;
3196
3197         static int64_t next = now;
3198
3199         if (now >= next)
3200         {
3201            next = now + bx::getHPFrequency();
3202            double freq = double(bx::getHPFrequency() );
3203            double toMs = 1000.0/freq;
3204
3205            tvm.clear();
3206            uint16_t pos = 0;
3207            tvm.printf(0, pos++, BGFX_CONFIG_DEBUG ? 0x89 : 0x8f, " %s / " BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME " "
3208               , getRendererName()
3209               );
3210
3211            const DXGI_ADAPTER_DESC& desc = m_adapterDesc;
3212            char description[BX_COUNTOF(desc.Description)];
3213            wcstombs(description, desc.Description, BX_COUNTOF(desc.Description) );
3214            tvm.printf(0, pos++, 0x0f, " Device: %s", description);
3215            tvm.printf(0, pos++, 0x0f, " Memory: %" PRIi64 " (video), %" PRIi64 " (system), %" PRIi64 " (shared)"
3216               , desc.DedicatedVideoMemory
3217               , desc.DedicatedSystemMemory
3218               , desc.SharedSystemMemory
3219               );
3220
3221            pos = 10;
3222            tvm.printf(10, pos++, 0x8e, "       Frame: %7.3f, % 7.3f \x1f, % 7.3f \x1e [ms] / % 6.2f FPS "
3223               , double(frameTime)*toMs
3224               , double(min)*toMs
3225               , double(max)*toMs
3226               , freq/frameTime
3227               );
3228
3229            const uint32_t msaa = (m_resolution.m_flags&BGFX_RESET_MSAA_MASK)>>BGFX_RESET_MSAA_SHIFT;
3230            tvm.printf(10, pos++, 0x8e, " Reset flags: [%c] vsync, [%c] MSAAx%d "
3231               , !!(m_resolution.m_flags&BGFX_RESET_VSYNC) ? '\xfe' : ' '
3232               , 0 != msaa ? '\xfe' : ' '
3233               , 1<<msaa
3234               );
3235
3236            double elapsedCpuMs = double(elapsed)*toMs;
3237            tvm.printf(10, pos++, 0x8e, "  Draw calls: %4d / CPU %3.4f [ms]"
3238               , _render->m_num
3239               , elapsedCpuMs
3240               );
3241            for (uint32_t ii = 0; ii < BX_COUNTOF(s_primInfo); ++ii)
3242            {
3243               tvm.printf(10, pos++, 0x8e, "    %8s: %7d (#inst: %5d), submitted: %7d"
3244                  , s_primName[ii]
3245                  , statsNumPrimsRendered[ii]
3246                  , statsNumInstances[ii]
3247                  , statsNumPrimsSubmitted[ii]
3248                  );
3249            }
3250
3251            tvm.printf(10, pos++, 0x8e, "     Indices: %7d", statsNumIndices);
3252            tvm.printf(10, pos++, 0x8e, "    DVB size: %7d", _render->m_vboffset);
3253            tvm.printf(10, pos++, 0x8e, "    DIB size: %7d", _render->m_iboffset);
3254
3255            double captureMs = double(captureElapsed)*toMs;
3256            tvm.printf(10, pos++, 0x8e, "     Capture: %3.4f [ms]", captureMs);
3257
3258            uint8_t attr[2] = { 0x89, 0x8a };
3259            uint8_t attrIndex = _render->m_waitSubmit < _render->m_waitRender;
3260
3261            tvm.printf(10, pos++, attr[attrIndex&1], " Submit wait: %3.4f [ms]", _render->m_waitSubmit*toMs);
3262            tvm.printf(10, pos++, attr[(attrIndex+1)&1], " Render wait: %3.4f [ms]", _render->m_waitRender*toMs);
3263
3264            min = frameTime;
3265            max = frameTime;
3266         }
3267
3268         blit(this, _textVideoMemBlitter, tvm);
3269
3270         PIX_ENDEVENT();
3271      }
3272      else if (_render->m_debug & BGFX_DEBUG_TEXT)
3273      {
3274         PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
3275
3276         blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
3277
3278         PIX_ENDEVENT();
3279      }
3280   }
3281} // namespace bgfx
3282
3283#else
3284
3285namespace bgfx
3286{
3287   RendererContextI* rendererCreateD3D11()
3288   {
3289      return NULL;
3290   }
3291
3292   void rendererDestroyD3D11()
3293   {
3294   }
3295} // namespace bgfx
3296
3297#endif // BGFX_CONFIG_RENDERER_DIRECT3D11
Property changes on: branches/osd/src/lib/bgfx/renderer_d3d11.cpp
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_egl.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_GLCONTEXT_EGL_H_HEADER_GUARD
7#define BGFX_GLCONTEXT_EGL_H_HEADER_GUARD
8
9#if BGFX_USE_EGL
10
11#include <EGL/egl.h>
12
13namespace bgfx
14{
15   struct GlContext
16   {
17      GlContext()
18         : m_context(NULL)
19         , m_display(NULL)
20         , m_surface(NULL)
21      {
22      }
23
24      void create(uint32_t _width, uint32_t _height);
25      void destroy();
26      void resize(uint32_t _width, uint32_t _height, bool _vsync);
27      void swap();
28      void import();
29
30      bool isValid() const
31      {
32         return NULL != m_context;
33      }
34
35      void* m_eglLibrary;
36      EGLContext m_context;
37      EGLDisplay m_display;
38      EGLSurface m_surface;
39   };
40} // namespace bgfx
41
42#endif // BGFX_USE_EGL
43
44#endif // BGFX_GLCONTEXT_EGL_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/glcontext_egl.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_ppapi.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_GLCONTEXT_PPAPI_H_HEADER_GUARD
7#define BGFX_GLCONTEXT_PPAPI_H_HEADER_GUARD
8
9#if BX_PLATFORM_NACL
10
11#   include <ppapi/gles2/gl2ext_ppapi.h>
12#   include <ppapi/c/pp_completion_callback.h>
13#   include <ppapi/c/ppb_instance.h>
14#   include <ppapi/c/ppb_graphics_3d.h>
15
16namespace bgfx
17{
18   struct GlContext
19   {
20      GlContext()
21      {
22      }
23
24      void create(uint32_t _width, uint32_t _height);
25      void destroy();
26      void resize(uint32_t _width, uint32_t _height, bool _vsync);
27      void swap();
28      void import();
29      bool isValid() const;
30   };
31} // namespace bgfx
32
33#endif // BX_PLATFORM_NACL
34
35#endif // BGFX_GLCONTEXT_PPAPI_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/glcontext_ppapi.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/vertexdecl.cpp
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include <string.h>
7#include <bx/debug.h>
8#include <bx/hash.h>
9#include <bx/uint32_t.h>
10#include <bx/string.h>
11#include <bx/readerwriter.h>
12
13#include "config.h"
14#include "vertexdecl.h"
15
16namespace bgfx
17{
18   static const uint8_t s_attribTypeSizeDx9[AttribType::Count][4] =
19   {
20      {  4,  4,  4,  4 },
21      {  4,  4,  8,  8 },
22      {  4,  4,  8,  8 },
23      {  4,  8, 12, 16 },
24   };
25
26   static const uint8_t s_attribTypeSizeDx11[AttribType::Count][4] =
27   {
28      {  1,  2,  4,  4 },
29      {  2,  4,  8,  8 },
30      {  2,  4,  8,  8 },
31      {  4,  8, 12, 16 },
32   };
33
34   static const uint8_t s_attribTypeSizeGl[AttribType::Count][4] =
35   {
36      {  1,  2,  4,  4 },
37      {  2,  4,  6,  8 },
38      {  2,  4,  6,  8 },
39      {  4,  8, 12, 16 },
40   };
41
42   static const uint8_t (*s_attribTypeSize[RendererType::Count])[AttribType::Count][4] =
43   {
44#if BGFX_CONFIG_RENDERER_DIRECT3D9
45      &s_attribTypeSizeDx9,
46#elif BGFX_CONFIG_RENDERER_DIRECT3D11
47      &s_attribTypeSizeDx11,
48#elif BGFX_CONFIG_RENDERER_OPENGL || BGFX_CONFIG_RENDERER_OPENGLES
49      &s_attribTypeSizeGl,
50#else
51      &s_attribTypeSizeDx9,
52#endif // BGFX_CONFIG_RENDERER_
53      &s_attribTypeSizeDx9,
54      &s_attribTypeSizeDx11,
55      &s_attribTypeSizeGl,
56      &s_attribTypeSizeGl,
57   };
58
59   void initAttribTypeSizeTable(RendererType::Enum _type)
60   {
61      s_attribTypeSize[0] = s_attribTypeSize[_type];
62   }
63
64   void dbgPrintfVargs(const char* _format, va_list _argList)
65   {
66      char temp[8192];
67      char* out = temp;
68      int32_t len = bx::vsnprintf(out, sizeof(temp), _format, _argList);
69      if ( (int32_t)sizeof(temp) < len)
70      {
71         out = (char*)alloca(len+1);
72         len = bx::vsnprintf(out, len, _format, _argList);
73      }
74      out[len] = '\0';
75      bx::debugOutput(out);
76   }
77
78   void dbgPrintf(const char* _format, ...)
79   {
80      va_list argList;
81      va_start(argList, _format);
82      dbgPrintfVargs(_format, argList);
83      va_end(argList);
84   }
85
86   VertexDecl::VertexDecl()
87   {
88      // BK - struct need to have ctor to qualify as non-POD data.
89      // Need this to catch programming errors when serializing struct.
90   }
91
92   VertexDecl& VertexDecl::begin(RendererType::Enum _renderer)
93   {
94      m_hash = _renderer; // use hash to store renderer type while building VertexDecl.
95      m_stride = 0;
96      memset(m_attributes, 0xff, sizeof(m_attributes) );
97      memset(m_offset, 0, sizeof(m_offset) );
98
99      return *this;
100   }
101
102   void VertexDecl::end()
103   {
104      bx::HashMurmur2A murmur;
105      murmur.begin();
106      murmur.add(m_attributes, sizeof(m_attributes) );
107      murmur.add(m_offset, sizeof(m_offset) );
108      m_hash = murmur.end();
109   }
110
111   VertexDecl& VertexDecl::add(Attrib::Enum _attrib, uint8_t _num, AttribType::Enum _type, bool _normalized, bool _asInt)
112   {
113      const uint8_t encodedNorm = (_normalized&1)<<6;
114      const uint8_t encodedType = (_type&3)<<3;
115      const uint8_t encodedNum  = (_num-1)&3;
116      const uint8_t encodeAsInt = (_asInt&(!!"\x1\x1\x0\x0"[_type]) )<<7;
117      m_attributes[_attrib] = encodedNorm|encodedType|encodedNum|encodeAsInt;
118
119      m_offset[_attrib] = m_stride;
120      m_stride += (*s_attribTypeSize[m_hash])[_type][_num-1];
121
122      return *this;
123   }
124
125   VertexDecl& VertexDecl::skip(uint8_t _num)
126   {
127      m_stride += _num;
128
129      return *this;
130   }
131
132   void VertexDecl::decode(Attrib::Enum _attrib, uint8_t& _num, AttribType::Enum& _type, bool& _normalized, bool& _asInt) const
133   {
134      uint8_t val = m_attributes[_attrib];
135      _num        = (val&3)+1;
136      _type       = AttribType::Enum((val>>3)&3);
137      _normalized = !!(val&(1<<6) );
138      _asInt      = !!(val&(1<<7) );
139   }
140
141   static const char* s_attrName[] =
142   {
143      "Attrib::Position",
144      "Attrib::Normal",
145      "Attrib::Tangent",
146      "Attrib::Bitangent",
147      "Attrib::Color0",
148      "Attrib::Color1",
149      "Attrib::Indices",
150      "Attrib::Weights",
151      "Attrib::TexCoord0",
152      "Attrib::TexCoord1",
153      "Attrib::TexCoord2",
154      "Attrib::TexCoord3",
155      "Attrib::TexCoord4",
156      "Attrib::TexCoord5",
157      "Attrib::TexCoord6",
158      "Attrib::TexCoord7",
159   };
160   BX_STATIC_ASSERT(BX_COUNTOF(s_attrName) == Attrib::Count);
161
162   const char* getAttribName(Attrib::Enum _attr)
163   {
164      return s_attrName[_attr];
165   }
166
167   void dump(const VertexDecl& _decl)
168   {
169      if (BX_ENABLED(BGFX_CONFIG_DEBUG) )
170      {
171         dbgPrintf("vertexdecl %08x (%08x), stride %d\n"
172            , _decl.m_hash
173            , bx::hashMurmur2A(_decl.m_attributes)
174            , _decl.m_stride
175            );
176
177         for (uint32_t attr = 0; attr < Attrib::Count; ++attr)
178         {
179            if (0xff != _decl.m_attributes[attr])
180            {
181               uint8_t num;
182               AttribType::Enum type;
183               bool normalized;
184               bool asInt;
185               _decl.decode(Attrib::Enum(attr), num, type, normalized, asInt);
186
187               dbgPrintf("\tattr %d - %s, num %d, type %d, norm %d, asint %d, offset %d\n"
188                  , attr
189                  , getAttribName(Attrib::Enum(attr) )
190                  , num
191                  , type
192                  , normalized
193                  , asInt
194                  , _decl.m_offset[attr]
195               );
196            }
197         }
198      }
199   }
200
201   struct AttribToId
202   {
203      Attrib::Enum attr;
204      uint16_t id;
205   };
206
207   static AttribToId s_attribToId[] =
208   {
209      // NOTICE:
210      // Attrib must be in order how it appears in Attrib::Enum! id is
211      // unique and should not be changed if new Attribs are added.
212      { Attrib::Position,  0x0001 },
213      { Attrib::Normal,    0x0002 },
214      { Attrib::Tangent,   0x0003 },
215      { Attrib::Bitangent, 0x0004 },
216      { Attrib::Color0,    0x0005 },
217      { Attrib::Color1,    0x0006 },
218      { Attrib::Indices,   0x000e },
219      { Attrib::Weight,    0x000f },
220      { Attrib::TexCoord0, 0x0010 },
221      { Attrib::TexCoord1, 0x0011 },
222      { Attrib::TexCoord2, 0x0012 },
223      { Attrib::TexCoord3, 0x0013 },
224      { Attrib::TexCoord4, 0x0014 },
225      { Attrib::TexCoord5, 0x0015 },
226      { Attrib::TexCoord6, 0x0016 },
227      { Attrib::TexCoord7, 0x0017 },
228   };
229   BX_STATIC_ASSERT(BX_COUNTOF(s_attribToId) == Attrib::Count);
230
231   Attrib::Enum idToAttrib(uint16_t id)
232   {
233      for (uint32_t ii = 0; ii < BX_COUNTOF(s_attribToId); ++ii)
234      {
235         if (s_attribToId[ii].id == id)
236         {
237            return s_attribToId[ii].attr;
238         }
239      }
240
241      return Attrib::Count;
242   }
243
244   uint16_t attribToId(Attrib::Enum _attr)
245   {
246      return s_attribToId[_attr].id;
247   }
248
249   struct AttribTypeToId
250   {
251      AttribType::Enum type;
252      uint16_t id;
253   };
254
255   static AttribTypeToId s_attribTypeToId[] =
256   {
257      // NOTICE:
258      // AttribType must be in order how it appears in AttribType::Enum!
259      // id is unique and should not be changed if new AttribTypes are
260      // added.
261      { AttribType::Uint8, 0x0001 },
262      { AttribType::Int16, 0x0002 },
263      { AttribType::Half,  0x0003 },
264      { AttribType::Float, 0x0004 },
265   };
266   BX_STATIC_ASSERT(BX_COUNTOF(s_attribTypeToId) == AttribType::Count);
267
268   AttribType::Enum idToAttribType(uint16_t id)
269   {
270      for (uint32_t ii = 0; ii < BX_COUNTOF(s_attribTypeToId); ++ii)
271      {
272         if (s_attribTypeToId[ii].id == id)
273         {
274            return s_attribTypeToId[ii].type;
275         }
276      }
277
278      return AttribType::Count;
279   }
280
281   uint16_t attribTypeToId(AttribType::Enum _attr)
282   {
283      return s_attribTypeToId[_attr].id;
284   }
285
286   int32_t write(bx::WriterI* _writer, const VertexDecl& _decl)
287   {
288      int32_t total = 0;
289      uint8_t numAttrs = 0;
290
291      for (uint32_t attr = 0; attr < Attrib::Count; ++attr)
292      {
293         numAttrs += 0xff == _decl.m_attributes[attr] ? 0 : 1;
294      }
295
296      total += bx::write(_writer, numAttrs);
297      total += bx::write(_writer, _decl.m_stride);
298
299      for (uint32_t attr = 0; attr < Attrib::Count; ++attr)
300      {
301         if (0xff != _decl.m_attributes[attr])
302         {
303            uint8_t num;
304            AttribType::Enum type;
305            bool normalized;
306            bool asInt;
307            _decl.decode(Attrib::Enum(attr), num, type, normalized, asInt);
308            total += bx::write(_writer, _decl.m_offset[attr]);
309            total += bx::write(_writer, s_attribToId[attr].id);
310            total += bx::write(_writer, num);
311            total += bx::write(_writer, s_attribTypeToId[type].id);
312            total += bx::write(_writer, normalized);
313            total += bx::write(_writer, asInt);
314         }
315      }
316
317      return total;
318   }
319
320   int32_t read(bx::ReaderI* _reader, VertexDecl& _decl)
321   {
322      int32_t total = 0;
323
324      uint8_t numAttrs;
325      total += bx::read(_reader, numAttrs);
326
327      uint16_t stride;
328      total += bx::read(_reader, stride);
329
330      _decl.begin();
331
332      for (uint32_t ii = 0; ii < numAttrs; ++ii)
333      {
334         uint16_t offset;
335         total += bx::read(_reader, offset);
336
337         uint16_t attribId = 0;
338         total += bx::read(_reader, attribId);
339
340         uint8_t num;
341         total += bx::read(_reader, num);
342
343         uint16_t attribTypeId;
344         total += bx::read(_reader, attribTypeId);
345
346         bool normalized;
347         total += bx::read(_reader, normalized);
348
349         bool asInt;
350         total += bx::read(_reader, asInt);
351
352         Attrib::Enum     attr = idToAttrib(attribId);
353         AttribType::Enum type = idToAttribType(attribTypeId);
354         if (Attrib::Count != attr
355         &&  AttribType::Count != type)
356         {
357            _decl.add(attr, num, type, normalized, asInt);
358            _decl.m_offset[attr] = offset;
359         }
360      }
361
362      _decl.end();
363      _decl.m_stride = stride;
364
365      return total;
366   }
367
368   void vertexPack(const float _input[4], bool _inputNormalized, Attrib::Enum _attr, const VertexDecl& _decl, void* _data, uint32_t _index)
369   {
370      if (!_decl.has(_attr) )
371      {
372         return;
373      }
374
375      uint32_t stride = _decl.getStride();
376      uint8_t* data = (uint8_t*)_data + _index*stride + _decl.getOffset(_attr);
377
378      uint8_t num;
379      AttribType::Enum type;
380      bool normalized;
381      bool asInt;
382      _decl.decode(_attr, num, type, normalized, asInt);
383
384      switch (type)
385      {
386      default:
387      case AttribType::Uint8:
388         {
389            uint8_t* packed = (uint8_t*)data;
390            if (_inputNormalized)
391            {
392               if (asInt)
393               {
394                  switch (num)
395                  {
396                  default: *packed++ = uint8_t(*_input++ * 127.0f + 128.0f);
397                  case 3:  *packed++ = uint8_t(*_input++ * 127.0f + 128.0f);
398                  case 2:  *packed++ = uint8_t(*_input++ * 127.0f + 128.0f);
399                  case 1:  *packed++ = uint8_t(*_input++ * 127.0f + 128.0f);
400                  }
401               }
402               else
403               {
404                  switch (num)
405                  {
406                  default: *packed++ = uint8_t(*_input++ * 255.0f);
407                  case 3:  *packed++ = uint8_t(*_input++ * 255.0f);
408                  case 2:  *packed++ = uint8_t(*_input++ * 255.0f);
409                  case 1:  *packed++ = uint8_t(*_input++ * 255.0f);
410                  }
411               }
412            }
413            else
414            {
415               switch (num)
416               {
417               default: *packed++ = uint8_t(*_input++);
418               case 3:  *packed++ = uint8_t(*_input++);
419               case 2:  *packed++ = uint8_t(*_input++);
420               case 1:  *packed++ = uint8_t(*_input++);
421               }
422            }
423         }
424         break;
425
426      case AttribType::Int16:
427         {
428            int16_t* packed = (int16_t*)data;
429            if (_inputNormalized)
430            {
431               if (asInt)
432               {
433                  switch (num)
434                  {
435                  default: *packed++ = int16_t(*_input++ * 32767.0f);
436                  case 3:  *packed++ = int16_t(*_input++ * 32767.0f);
437                  case 2:  *packed++ = int16_t(*_input++ * 32767.0f);
438                  case 1:  *packed++ = int16_t(*_input++ * 32767.0f);
439                  }
440               }
441               else
442               {
443                  switch (num)
444                  {
445                  default: *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
446                  case 3:  *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
447                  case 2:  *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
448                  case 1:  *packed++ = int16_t(*_input++ * 65535.0f - 32768.0f);
449                  }
450               }
451            }
452            else
453            {
454               switch (num)
455               {
456               default: *packed++ = int16_t(*_input++);
457               case 3:  *packed++ = int16_t(*_input++);
458               case 2:  *packed++ = int16_t(*_input++);
459               case 1:  *packed++ = int16_t(*_input++);
460               }
461            }
462         }
463         break;
464
465      case AttribType::Half:
466         {
467            uint16_t* packed = (uint16_t*)data;
468            switch (num)
469            {
470            default: *packed++ = bx::halfFromFloat(*_input++);
471            case 3:  *packed++ = bx::halfFromFloat(*_input++);
472            case 2:  *packed++ = bx::halfFromFloat(*_input++);
473            case 1:  *packed++ = bx::halfFromFloat(*_input++);
474            }
475         }
476         break;
477
478      case AttribType::Float:
479         memcpy(data, _input, num*sizeof(float) );
480         break;
481      }
482   }
483
484   void vertexUnpack(float _output[4], Attrib::Enum _attr, const VertexDecl& _decl, const void* _data, uint32_t _index)
485   {
486      if (!_decl.has(_attr) )
487      {
488         memset(_output, 0, 4*sizeof(float) );
489         return;
490      }
491
492      uint32_t stride = _decl.getStride();
493      uint8_t* data = (uint8_t*)_data + _index*stride + _decl.getOffset(_attr);
494
495      uint8_t num;
496      AttribType::Enum type;
497      bool normalized;
498      bool asInt;
499      _decl.decode(_attr, num, type, normalized, asInt);
500
501      switch (type)
502      {
503      default:
504      case AttribType::Uint8:
505         {
506            uint8_t* packed = (uint8_t*)data;
507            if (asInt)
508            {
509               switch (num)
510               {
511               default: *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f;
512               case 3:  *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f;
513               case 2:  *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f;
514               case 1:  *_output++ = (float(*packed++) - 128.0f)*1.0f/127.0f;
515               }
516            }
517            else
518            {
519               switch (num)
520               {
521               default: *_output++ = float(*packed++)*1.0f/255.0f;
522               case 3:  *_output++ = float(*packed++)*1.0f/255.0f;
523               case 2:  *_output++ = float(*packed++)*1.0f/255.0f;
524               case 1:  *_output++ = float(*packed++)*1.0f/255.0f;
525               }
526            }
527         }
528         break;
529
530      case AttribType::Int16:
531         {
532            int16_t* packed = (int16_t*)data;
533            if (asInt)
534            {
535               switch (num)
536               {
537               default: *_output++ = float(*packed++)*1.0f/32767.0f;
538               case 3:  *_output++ = float(*packed++)*1.0f/32767.0f;
539               case 2:  *_output++ = float(*packed++)*1.0f/32767.0f;
540               case 1:  *_output++ = float(*packed++)*1.0f/32767.0f;
541               }
542            }
543            else
544            {
545               switch (num)
546               {
547               default: *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
548               case 3:  *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
549               case 2:  *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
550               case 1:  *_output++ = (float(*packed++) + 32768.0f)*1.0f/65535.0f;
551               }
552            }
553         }
554         break;
555
556      case AttribType::Half:
557         {
558            uint16_t* packed = (uint16_t*)data;
559            switch (num)
560            {
561            default: *_output++ = bx::halfToFloat(*packed++);
562            case 3:  *_output++ = bx::halfToFloat(*packed++);
563            case 2:  *_output++ = bx::halfToFloat(*packed++);
564            case 1:  *_output++ = bx::halfToFloat(*packed++);
565            }
566         }
567         break;
568
569      case AttribType::Float:
570         memcpy(_output, data, num*sizeof(float) );
571         _output += num;
572         break;
573      }
574
575      switch (num)
576      {
577      case 1: *_output++ = 0.0f;
578      case 2: *_output++ = 0.0f;
579      case 3: *_output++ = 0.0f;
580      default: break;
581      }
582   }
583
584   void vertexConvert(const VertexDecl& _destDecl, void* _destData, const VertexDecl& _srcDecl, const void* _srcData, uint32_t _num)
585   {
586      if (_destDecl.m_hash == _srcDecl.m_hash)
587      {
588         memcpy(_destData, _srcData, _srcDecl.getSize(_num) );
589         return;
590      }
591
592      struct ConvertOp
593      {
594         enum Enum
595         {
596            Set,
597            Copy,
598            Convert,
599         };
600
601         Attrib::Enum attr;
602         Enum op;
603         uint32_t src;
604         uint32_t dest;
605         uint32_t size;
606      };
607
608      ConvertOp convertOp[Attrib::Count];
609      uint32_t numOps = 0;
610
611      for (uint32_t ii = 0; ii < Attrib::Count; ++ii)
612      {
613         Attrib::Enum attr = (Attrib::Enum)ii;
614
615         if (_destDecl.has(attr) )
616         {
617            ConvertOp& cop = convertOp[numOps];
618            cop.attr = attr;
619            cop.dest = _destDecl.getOffset(attr);
620
621            uint8_t num;
622            AttribType::Enum type;
623            bool normalized;
624            bool asInt;
625            _destDecl.decode(attr, num, type, normalized, asInt);
626            cop.size = (*s_attribTypeSize[0])[type][num-1];
627
628            if (_srcDecl.has(attr) )
629            {
630               cop.src = _srcDecl.getOffset(attr);
631               cop.op = _destDecl.m_attributes[attr] == _srcDecl.m_attributes[attr] ? ConvertOp::Copy : ConvertOp::Convert;
632            }
633            else
634            {
635               cop.op = ConvertOp::Set;
636            }
637
638            ++numOps;
639         }
640      }
641
642      if (0 < numOps)
643      {
644         const uint8_t* src = (const uint8_t*)_srcData;
645         uint32_t srcStride = _srcDecl.getStride();
646
647         uint8_t* dest = (uint8_t*)_destData;
648         uint32_t destStride = _destDecl.getStride();
649
650         float unpacked[4];
651
652         for (uint32_t ii = 0; ii < _num; ++ii)
653         {
654            for (uint32_t jj = 0; jj < numOps; ++jj)
655            {
656               const ConvertOp& cop = convertOp[jj];
657
658               switch (cop.op)
659               {
660               case ConvertOp::Set:
661                  memset(dest + cop.dest, 0, cop.size);
662                  break;
663
664               case ConvertOp::Copy:
665                  memcpy(dest + cop.dest, src + cop.src, cop.size);
666                  break;
667
668               case ConvertOp::Convert:
669                  vertexUnpack(unpacked, cop.attr, _srcDecl, src);
670                  vertexPack(unpacked, true, cop.attr, _destDecl, dest);
671                  break;
672               }
673            }
674
675            src += srcStride;
676            dest += destStride;
677         }
678      }
679   }
680
681   inline float sqLength(const float _a[3], const float _b[3])
682   {
683      const float xx = _a[0] - _b[0];
684      const float yy = _a[1] - _b[1];
685      const float zz = _a[2] - _b[2];
686      return xx*xx + yy*yy + zz*zz;
687   }
688
689   uint16_t weldVerticesRef(uint16_t* _output, const VertexDecl& _decl, const void* _data, uint16_t _num, float _epsilon)
690   {
691      // Brute force slow vertex welding...
692      const float epsilonSq = _epsilon*_epsilon;
693
694      uint32_t numVertices = 0;
695      memset(_output, 0xff, _num*sizeof(uint16_t) );
696
697      for (uint32_t ii = 0; ii < _num; ++ii)
698      {
699         if (UINT16_MAX != _output[ii])
700         {
701            continue;
702         }
703
704         _output[ii] = (uint16_t)ii;
705         ++numVertices;
706
707         float pos[4];
708         vertexUnpack(pos, Attrib::Position, _decl, _data, ii);
709
710         for (uint32_t jj = 0; jj < _num; ++jj)
711         {
712            if (UINT16_MAX != _output[jj])
713            {
714               continue;
715            }
716
717            float test[4];
718            vertexUnpack(test, Attrib::Position, _decl, _data, jj);
719
720            if (sqLength(test, pos) < epsilonSq)
721            {
722               _output[jj] = (uint16_t)ii;
723            }
724         }
725      }
726
727      return (uint16_t)numVertices;
728   }
729
730   uint16_t weldVertices(uint16_t* _output, const VertexDecl& _decl, const void* _data, uint16_t _num, float _epsilon)
731   {
732      const uint32_t hashSize = bx::uint32_nextpow2(_num);
733      const uint32_t hashMask = hashSize-1;
734      const float epsilonSq = _epsilon*_epsilon;
735
736      uint32_t numVertices = 0;
737
738      const uint32_t size = sizeof(uint16_t)*(hashSize + _num);
739      uint16_t* hashTable = (uint16_t*)alloca(size);
740      memset(hashTable, 0xff, size);
741
742      uint16_t* next = hashTable + hashSize;
743
744      for (uint32_t ii = 0; ii < _num; ++ii)
745      {
746         float pos[4];
747         vertexUnpack(pos, Attrib::Position, _decl, _data, ii);
748         uint32_t hashValue = bx::hashMurmur2A(pos, 3*sizeof(float) ) & hashMask;
749
750         uint16_t offset = hashTable[hashValue];
751         for (; UINT16_MAX != offset; offset = next[offset])
752         {
753            float test[4];
754            vertexUnpack(test, Attrib::Position, _decl, _data, _output[offset]);
755
756            if (sqLength(test, pos) < epsilonSq)
757            {
758               _output[ii] = _output[offset];
759               break;
760            }
761         }
762
763         if (UINT16_MAX == offset)
764         {
765            _output[ii] = (uint16_t)ii;
766            next[ii] = hashTable[hashValue];
767            hashTable[hashValue] = (uint16_t)ii;
768            numVertices++;
769         }
770      }
771
772      return (uint16_t)numVertices;
773   }
774} // namespace bgfx
Property changes on: branches/osd/src/lib/bgfx/vertexdecl.cpp
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/bgfx_p.h
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#ifndef BGFX_P_H_HEADER_GUARD
7#define BGFX_P_H_HEADER_GUARD
8
9#include "bgfx.h"
10#include "config.h"
11
12#include <inttypes.h>
13#include <stdarg.h> // va_list
14#include <stdio.h>
15#include <stdlib.h>
16#include <string.h>
17#include <alloca.h>
18
19namespace bgfx
20{
21   void fatal(Fatal::Enum _code, const char* _format, ...);
22   void dbgPrintf(const char* _format, ...);
23}
24
25#define _BX_TRACE(_format, ...) \
26            BX_MACRO_BLOCK_BEGIN \
27               bgfx::dbgPrintf(BX_FILE_LINE_LITERAL "BGFX " _format "\n", ##__VA_ARGS__); \
28            BX_MACRO_BLOCK_END
29
30#define _BX_WARN(_condition, _format, ...) \
31            BX_MACRO_BLOCK_BEGIN \
32               if (!BX_IGNORE_C4127(_condition) ) \
33               { \
34                  BX_TRACE("WARN " _format, ##__VA_ARGS__); \
35               } \
36            BX_MACRO_BLOCK_END
37
38#define _BX_CHECK(_condition, _format, ...) \
39            BX_MACRO_BLOCK_BEGIN \
40               if (!BX_IGNORE_C4127(_condition) ) \
41               { \
42                  BX_TRACE("CHECK " _format, ##__VA_ARGS__); \
43                  bgfx::fatal(bgfx::Fatal::DebugCheck, _format, ##__VA_ARGS__); \
44               } \
45            BX_MACRO_BLOCK_END
46
47#if BGFX_CONFIG_DEBUG
48#   define BX_TRACE _BX_TRACE
49#   define BX_WARN  _BX_WARN
50#   define BX_CHECK _BX_CHECK
51#   define BX_CONFIG_ALLOCATOR_DEBUG 1
52#endif // BGFX_CONFIG_DEBUG
53
54#define BGFX_FATAL(_condition, _err, _format, ...) \
55         BX_MACRO_BLOCK_BEGIN \
56            if (!BX_IGNORE_C4127(_condition) ) \
57            { \
58               fatal(_err, _format, ##__VA_ARGS__); \
59            } \
60         BX_MACRO_BLOCK_END
61
62#include <bx/bx.h>
63#include <bx/debug.h>
64#include <bx/float4x4_t.h>
65#include <bx/blockalloc.h>
66#include <bx/endian.h>
67#include <bx/handlealloc.h>
68#include <bx/hash.h>
69#include <bx/radixsort.h>
70#include <bx/ringbuffer.h>
71#include <bx/uint32_t.h>
72#include <bx/readerwriter.h>
73#include <bx/allocator.h>
74#include <bx/string.h>
75#include <bx/os.h>
76
77#include "bgfxplatform.h"
78#include "image.h"
79
80#define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', 0x1)
81#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', 0x3)
82#define BGFX_CHUNK_MAGIC_TEX BX_MAKEFOURCC('T', 'E', 'X', 0x0)
83#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', 0x3)
84
85#include <list> // mingw wants it to be before tr1/unordered_*...
86
87#if BGFX_CONFIG_USE_TINYSTL
88namespace bgfx
89{
90   struct TinyStlAllocator
91   {
92      static void* static_allocate(size_t _bytes);
93      static void static_deallocate(void* _ptr, size_t /*_bytes*/);
94   };
95} // namespace bgfx
96#   define TINYSTL_ALLOCATOR bgfx::TinyStlAllocator
97#   include <tinystl/string.h>
98#   include <tinystl/unordered_map.h>
99#   include <tinystl/unordered_set.h>
100namespace stl = tinystl;
101#else
102#   include <string>
103#   include <unordered_map>
104#   include <unordered_set>
105namespace stl
106{
107   using namespace std;
108   using namespace std::tr1;
109}
110#endif // BGFX_CONFIG_USE_TINYSTL
111
112#if BX_PLATFORM_ANDROID
113#   include <android/native_window.h>
114#elif BX_PLATFORM_WINDOWS
115#   include <windows.h>
116#elif BX_PLATFORM_XBOX360
117#   include <malloc.h>
118#   include <xtl.h>
119#endif // BX_PLATFORM_*
120
121#include <bx/cpu.h>
122#include <bx/thread.h>
123#include <bx/timer.h>
124
125#include "vertexdecl.h"
126
127#define BGFX_DEFAULT_WIDTH  1280
128#define BGFX_DEFAULT_HEIGHT 720
129
130#define BGFX_MAX_COMPUTE_BINDINGS 8
131
132#define BGFX_SAMPLER_DEFAULT_FLAGS UINT32_C(0x10000000)
133
134#define BGFX_RENDERER_DIRECT3D9_NAME "Direct3D 9"
135#define BGFX_RENDERER_DIRECT3D11_NAME "Direct3D 11"
136#define BGFX_RENDERER_NULL_NAME "NULL"
137
138#if BGFX_CONFIG_RENDERER_OPENGL
139#   if BGFX_CONFIG_RENDERER_OPENGL >= 31
140#      define BGFX_RENDERER_OPENGL_NAME "OpenGL 3.1"
141#   else
142#      define BGFX_RENDERER_OPENGL_NAME "OpenGL 2.1"
143#   endif // BGFX_CONFIG_RENDERER_OPENGL
144#elif BGFX_CONFIG_RENDERER_OPENGLES
145#   if BGFX_CONFIG_RENDERER_OPENGLES == 30
146#      define BGFX_RENDERER_OPENGL_NAME "OpenGL ES 3.0"
147#   elif BGFX_CONFIG_RENDERER_OPENGLES >= 31
148#      define BGFX_RENDERER_OPENGL_NAME "OpenGL ES 3.1"
149#   else
150#      define BGFX_RENDERER_OPENGL_NAME "OpenGL ES 2.0"
151#   endif // BGFX_CONFIG_RENDERER_OPENGLES
152#else
153#   define BGFX_RENDERER_OPENGL_NAME "OpenGL"
154#endif //
155
156namespace bgfx
157{
158#if BX_PLATFORM_ANDROID
159   extern ::ANativeWindow* g_bgfxAndroidWindow;
160#elif BX_PLATFORM_IOS
161   extern void* g_bgfxEaglLayer;
162#elif BX_PLATFORM_OSX
163   extern void* g_bgfxNSWindow;
164#elif BX_PLATFORM_WINDOWS
165   extern ::HWND g_bgfxHwnd;
166#endif // BX_PLATFORM_*
167
168   struct Clear
169   {
170      uint32_t m_rgba;
171      float m_depth;
172      uint8_t m_stencil;
173      uint8_t m_flags;
174   };
175
176   struct Rect
177   {
178      void clear()
179      {
180         m_x =
181         m_y =
182         m_width =
183         m_height = 0;
184      }
185
186      bool isZero() const
187      {
188         uint64_t ui64 = *( (uint64_t*)this);
189         return UINT64_C(0) == ui64;
190      }
191
192      void intersect(const Rect& _a, const Rect& _b)
193      {
194         using namespace bx;
195         const uint16_t sx = uint16_max(_a.m_x, _b.m_x);
196         const uint16_t sy = uint16_max(_a.m_y, _b.m_y);
197         const uint16_t ex = uint16_min(_a.m_x + _a.m_width,  _b.m_x + _b.m_width );
198         const uint16_t ey = uint16_min(_a.m_y + _a.m_height, _b.m_y + _b.m_height);
199         m_x = sx;
200         m_y = sy;
201         m_width  = (uint16_t)uint32_satsub(ex, sx);
202         m_height = (uint16_t)uint32_satsub(ey, sy);
203      }
204
205      uint16_t m_x;
206      uint16_t m_y;
207      uint16_t m_width;
208      uint16_t m_height;
209   };
210
211   struct TextureCreate
212   {
213      uint32_t m_flags;
214      uint16_t m_width;
215      uint16_t m_height;
216      uint16_t m_sides;
217      uint16_t m_depth;
218      uint8_t m_numMips;
219      uint8_t m_format;
220      bool m_cubeMap;
221      const Memory* m_mem;
222   };
223
224   extern const uint32_t g_uniformTypeSize[UniformType::Count+1];
225   extern CallbackI* g_callback;
226   extern bx::ReallocatorI* g_allocator;
227   extern Caps g_caps;
228
229   void setGraphicsDebuggerPresent(bool _present);
230   bool isGraphicsDebuggerPresent();
231   void release(const Memory* _mem);
232   const char* getAttribName(Attrib::Enum _attr);
233
234   inline uint32_t gcd(uint32_t _a, uint32_t _b)
235   {
236      do
237      {
238         uint32_t tmp = _a % _b;
239         _a = _b;
240         _b = tmp;
241      }
242      while (_b);
243
244      return _a;
245   }
246
247   inline uint32_t lcm(uint32_t _a, uint32_t _b)
248   {
249      return _a * (_b / gcd(_a, _b) );
250   }
251
252   inline uint32_t strideAlign(uint32_t _offset, uint32_t _stride)
253   {
254      using namespace bx;
255      const uint32_t mod    = uint32_mod(_offset, _stride);
256      const uint32_t add    = uint32_sub(_stride, mod);
257      const uint32_t mask   = uint32_cmpeq(mod, 0);
258      const uint32_t tmp    = uint32_selb(mask, 0, add);
259      const uint32_t result = uint32_add(_offset, tmp);
260
261      return result;
262   }
263
264   inline uint32_t strideAlign16(uint32_t _offset, uint32_t _stride)
265   {
266      uint32_t align = lcm(16, _stride);
267      return _offset+align-(_offset%align);
268   }
269
270   inline uint32_t strideAlign256(uint32_t _offset, uint32_t _stride)
271   {
272      uint32_t align = lcm(256, _stride);
273      return _offset+align-(_offset%align);
274   }
275
276   inline uint32_t castfu(float _value)
277   {
278      union {   float fl; uint32_t ui; } un;
279      un.fl = _value;
280      return un.ui;
281   }
282
283   inline uint64_t packStencil(uint32_t _fstencil, uint32_t _bstencil)
284   {
285      return (uint64_t(_bstencil)<<32)|uint64_t(_fstencil);
286   }
287
288   inline uint32_t unpackStencil(uint8_t _0or1, uint64_t _stencil)
289   {
290      return uint32_t( (_stencil >> (32*_0or1) ) );
291   }
292
293   void dump(const VertexDecl& _decl);
294
295   struct TextVideoMem
296   {
297      TextVideoMem()
298         : m_mem(NULL)
299         , m_size(0)
300         , m_width(0)
301         , m_height(0)
302         , m_small(false)
303      {
304         resize();
305         clear();
306      }
307
308      ~TextVideoMem()
309      {
310         BX_FREE(g_allocator, m_mem);
311      }
312
313      void resize(bool _small = false, uint16_t _width = BGFX_DEFAULT_WIDTH, uint16_t _height = BGFX_DEFAULT_HEIGHT)
314      {
315         uint32_t width = bx::uint32_max(1, _width/8);
316         uint32_t height = bx::uint32_max(1, _height/(_small ? 8 : 16) );
317
318         if (NULL == m_mem
319         ||  m_width != width
320         ||  m_height != height
321         ||  m_small != _small)
322         {
323            m_small = _small;
324            m_width = (uint16_t)width;
325            m_height = (uint16_t)height;
326
327            uint32_t size = m_size;
328            m_size = m_width * m_height * 2;
329
330            m_mem = (uint8_t*)BX_REALLOC(g_allocator, m_mem, m_size);
331
332            if (size < m_size)
333            {
334               memset(&m_mem[size], 0, m_size-size);
335            }
336         }
337      }
338
339      void clear(uint8_t _attr = 0)
340      {
341         uint8_t* mem = m_mem;
342         for (uint32_t ii = 0, num = m_size/2; ii < num; ++ii)
343         {
344            mem[0] = 0;
345            mem[1] = _attr;
346            mem += 2;
347         }
348      }
349
350      void printfVargs(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList)
351      {
352         if (_x < m_width && _y < m_height)
353         {
354            char* temp = (char*)alloca(m_width);
355
356            uint32_t num = bx::vsnprintf(temp, m_width, _format, _argList);
357
358            uint8_t* mem = &m_mem[(_y*m_width+_x)*2];
359            for (uint32_t ii = 0, xx = _x; ii < num && xx < m_width; ++ii, ++xx)
360            {
361               mem[0] = temp[ii];
362               mem[1] = _attr;
363               mem += 2;
364            }
365         }
366      }
367
368      void printf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ...)
369      {
370         va_list argList;
371         va_start(argList, _format);
372         printfVargs(_x, _y, _attr, _format, argList);
373         va_end(argList);
374      }
375
376      uint8_t* m_mem;
377      uint32_t m_size;
378      uint16_t m_width;
379      uint16_t m_height;
380      bool m_small;
381   };
382
383   struct TextVideoMemBlitter
384   {
385      void init();
386      void shutdown();
387
388      TextureHandle m_texture;
389      TransientVertexBuffer* m_vb;
390      TransientIndexBuffer* m_ib;
391      VertexDecl m_decl;
392      ProgramHandle m_program;
393      bool m_init;
394   };
395
396   struct RendererContextI;
397
398   extern void blit(RendererContextI* _renderCtx, TextVideoMemBlitter& _blitter, const TextVideoMem& _mem);
399
400   inline void blit(RendererContextI* _renderCtx, TextVideoMemBlitter& _blitter, const TextVideoMem* _mem)
401   {
402      blit(_renderCtx, _blitter, *_mem);
403   }
404
405   template <uint32_t maxKeys>
406   struct UpdateBatchT
407   {
408      UpdateBatchT()
409         : m_num(0)
410      {
411      }
412
413      void add(uint32_t _key, uint32_t _value)
414      {
415         uint32_t num = m_num++;
416         m_keys[num] = _key;
417         m_values[num] = _value;
418      }
419
420      bool sort()
421      {
422         if (0 < m_num)
423         {
424            uint32_t* tempKeys = (uint32_t*)alloca(sizeof(m_keys) );
425            uint32_t* tempValues = (uint32_t*)alloca(sizeof(m_values) );
426            bx::radixSort32(m_keys, tempKeys, m_values, tempValues, m_num);
427            return true;
428         }
429
430         return false;
431      }
432
433      bool isFull() const
434      {
435         return m_num >= maxKeys;
436      }
437
438      void reset()
439      {
440         m_num = 0;
441      }
442
443      uint32_t m_num;
444      uint32_t m_keys[maxKeys];
445      uint32_t m_values[maxKeys];
446   };
447
448   struct ClearQuad
449   {
450      ClearQuad()
451      {
452         for (uint32_t ii = 0; ii < BX_COUNTOF(m_program); ++ii)
453         {
454            m_program[ii].idx = invalidHandle;
455         }
456      }
457
458      void init();
459      void shutdown();
460
461      TransientVertexBuffer* m_vb;
462      IndexBufferHandle m_ib;
463      VertexDecl m_decl;
464      ProgramHandle m_program[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
465   };
466
467   struct PredefinedUniform
468   {
469      enum Enum
470      {
471         ViewRect,
472         ViewTexel,
473         View,
474         InvView,
475         Proj,
476         InvProj,
477         ViewProj,
478         InvViewProj,
479         Model,
480         ModelView,
481         ModelViewProj,
482         AlphaRef,
483         Count
484      };
485
486      uint32_t m_loc;
487      uint16_t m_count;
488      uint8_t m_type;
489   };
490
491   const char* getUniformTypeName(UniformType::Enum _enum);
492   UniformType::Enum nameToUniformTypeEnum(const char* _name);
493   const char* getPredefinedUniformName(PredefinedUniform::Enum _enum);
494   PredefinedUniform::Enum nameToPredefinedUniformEnum(const char* _name);
495
496   struct CommandBuffer
497   {
498      CommandBuffer()
499         : m_pos(0)
500         , m_size(BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE)
501      {
502         finish();
503      }
504
505      enum Enum
506      {
507         RendererInit,
508         RendererShutdownBegin,
509         CreateVertexDecl,
510         CreateIndexBuffer,
511         CreateVertexBuffer,
512         CreateDynamicIndexBuffer,
513         UpdateDynamicIndexBuffer,
514         CreateDynamicVertexBuffer,
515         UpdateDynamicVertexBuffer,
516         CreateShader,
517         CreateProgram,
518         CreateTexture,
519         UpdateTexture,
520         CreateFrameBuffer,
521         CreateUniform,
522         UpdateViewName,
523         End,
524         RendererShutdownEnd,
525         DestroyVertexDecl,
526         DestroyIndexBuffer,
527         DestroyVertexBuffer,
528         DestroyDynamicIndexBuffer,
529         DestroyDynamicVertexBuffer,
530         DestroyShader,
531         DestroyProgram,
532         DestroyTexture,
533         DestroyFrameBuffer,
534         DestroyUniform,
535         SaveScreenShot,
536      };
537
538      void write(const void* _data, uint32_t _size)
539      {
540         BX_CHECK(m_size == BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE, "Called write outside start/finish?");
541         BX_CHECK(m_pos < m_size, "");
542         memcpy(&m_buffer[m_pos], _data, _size);
543         m_pos += _size;
544      }
545
546      template<typename Type>
547      void write(const Type& _in)
548      {
549         align(BX_ALIGNOF(Type) );
550         write(reinterpret_cast<const uint8_t*>(&_in), sizeof(Type) );
551      }
552
553      void read(void* _data, uint32_t _size)
554      {
555         BX_CHECK(m_pos < m_size, "");
556         memcpy(_data, &m_buffer[m_pos], _size);
557         m_pos += _size;
558      }
559
560      template<typename Type>
561      void read(Type& _in)
562      {
563         align(BX_ALIGNOF(Type) );
564         read(reinterpret_cast<uint8_t*>(&_in), sizeof(Type) );
565      }
566
567      const uint8_t* skip(uint32_t _size)
568      {
569         BX_CHECK(m_pos < m_size, "");
570         const uint8_t* result = &m_buffer[m_pos];
571         m_pos += _size;
572         return result;
573      }
574
575      template<typename Type>
576      void skip()
577      {
578         align(BX_ALIGNOF(Type) );
579         skip(sizeof(Type) );
580      }
581
582      void align(uint32_t _alignment)
583      {
584         const uint32_t mask = _alignment-1;
585         const uint32_t pos = (m_pos+mask) & (~mask);
586         m_pos = pos;
587      }
588
589      void reset()
590      {
591         m_pos = 0;
592      }
593
594      void start()
595      {
596         m_pos = 0;
597         m_size = BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE;
598      }
599
600      void finish()
601      {
602         uint8_t cmd = End;
603         write(cmd);
604         m_size = m_pos;
605         m_pos = 0;
606      }
607
608      uint32_t m_pos;
609      uint32_t m_size;
610      uint8_t m_buffer[BGFX_CONFIG_MAX_COMMAND_BUFFER_SIZE];
611
612   private:
613      CommandBuffer(const CommandBuffer&);
614      void operator=(const CommandBuffer&);
615   };
616
617#define SORT_KEY_RENDER_DRAW UINT64_C(0x0000000800000000)
618   struct SortKey
619   {
620      uint64_t encodeDraw()
621      {
622         // |               3               2               1               0|
623         // |fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210|
624         // |            vvvvvsssssssssssdttpppppppppdddddddddddddddddddddddd|
625         // |                ^          ^^ ^        ^                       ^|
626         // |                |          || |        |                       ||
627         // |           view-+      seq-+| +-trans  +-program         depth-+|
628         // |                            +-draw                              |
629
630         const uint64_t depth   = m_depth;
631         const uint64_t program = uint64_t(m_program)<<0x18;
632         const uint64_t trans   = uint64_t(m_trans  )<<0x21;
633         const uint64_t seq     = uint64_t(m_seq    )<<0x24;
634         const uint64_t view    = uint64_t(m_view   )<<0x2f;
635         const uint64_t key     = depth|program|trans|SORT_KEY_RENDER_DRAW|seq|view;
636         return key;
637      }
638
639      uint64_t encodeCompute()
640      {
641         // |               3               2               1               0|
642         // |fedcba9876543210fedcba9876543210fedcba9876543210fedcba9876543210|
643         // |            vvvvvsssssssssssdppppppppp                          |
644         // |                ^          ^^        ^                          |
645         // |                |          ||        |                          |
646         // |           view-+      seq-+|        +-program                  |
647         // |                            +-draw                              |
648
649         const uint64_t program = uint64_t(m_program)<<0x1a;
650         const uint64_t seq     = uint64_t(m_seq    )<<0x24;
651         const uint64_t view    = uint64_t(m_view   )<<0x2f;
652         const uint64_t key     = program|seq|view;
653         return key;
654      }
655
656      /// Returns true if item is command.
657      bool decode(uint64_t _key)
658      {
659         m_seq     = (_key>>0x24)& 0x7ff;
660         m_view    = (_key>>0x2f)&(BGFX_CONFIG_MAX_VIEWS-1);
661         if (_key & SORT_KEY_RENDER_DRAW)
662         {
663            m_depth   =  _key       & 0xffffffff;
664            m_program = (_key>>0x18)&(BGFX_CONFIG_MAX_PROGRAMS-1);
665            m_trans   = (_key>>0x21)& 0x3;
666            return false; // draw
667         }
668
669         m_program = (_key>>0x1a)&(BGFX_CONFIG_MAX_PROGRAMS-1);
670         return true; // compute
671      }
672
673      void reset()
674      {
675         m_depth   = 0;
676         m_program = 0;
677         m_seq     = 0;
678         m_view    = 0;
679         m_trans   = 0;
680      }
681
682      int32_t  m_depth;
683      uint16_t m_program;
684      uint16_t m_seq;
685      uint8_t  m_view;
686      uint8_t  m_trans;
687   };
688#undef SORT_KEY_RENDER_DRAW
689
690   BX_ALIGN_STRUCT_16(struct) Matrix4
691   {
692      union
693      {
694         float val[16];
695         bx::float4x4_t f4x4;
696      } un;
697
698      void setIdentity()
699      {
700         memset(un.val, 0, sizeof(un.val) );
701         un.val[0] = un.val[5] = un.val[10] = un.val[15] = 1.0f;
702      }
703   };
704
705   void mtxOrtho(float* _result, float _left, float _right, float _bottom, float _top, float _near, float _far);
706
707   struct MatrixCache
708   {
709      MatrixCache()
710         : m_num(1)
711      {
712         m_cache[0].setIdentity();
713      }
714
715      void reset()
716      {
717         m_num = 1;
718      }
719
720      uint32_t add(const void* _mtx, uint16_t _num)
721      {
722         if (NULL != _mtx)
723         {
724            BX_CHECK(m_num+_num < BGFX_CONFIG_MAX_MATRIX_CACHE, "Matrix cache overflow. %d (max: %d)", m_num+_num, BGFX_CONFIG_MAX_MATRIX_CACHE);
725
726            uint32_t num = bx::uint32_min(BGFX_CONFIG_MAX_MATRIX_CACHE-m_num, _num);
727            uint32_t first = m_num;
728            memcpy(&m_cache[m_num], _mtx, sizeof(Matrix4)*num);
729            m_num += num;
730            return first;
731         }
732
733         return 0;
734      }
735
736      Matrix4 m_cache[BGFX_CONFIG_MAX_MATRIX_CACHE];
737      uint32_t m_num;
738   };
739
740   struct RectCache
741   {
742      RectCache()
743         : m_num(0)
744      {
745      }
746
747      void reset()
748      {
749         m_num = 0;
750      }
751
752      uint32_t add(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
753      {
754         BX_CHECK(m_num+1 < BGFX_CONFIG_MAX_RECT_CACHE, "Rect cache overflow. %d (max: %d)", m_num, BGFX_CONFIG_MAX_RECT_CACHE);
755
756         uint32_t first = m_num;
757         Rect& rect = m_cache[m_num];
758
759         rect.m_x = _x;
760         rect.m_y = _y;
761         rect.m_width = _width;
762         rect.m_height = _height;
763
764         m_num++;
765         return first;
766      }
767
768      Rect m_cache[BGFX_CONFIG_MAX_RECT_CACHE];
769      uint32_t m_num;
770   };
771
772#define CONSTANT_OPCODE_TYPE_SHIFT 27
773#define CONSTANT_OPCODE_TYPE_MASK  UINT32_C(0xf8000000)
774#define CONSTANT_OPCODE_LOC_SHIFT  11
775#define CONSTANT_OPCODE_LOC_MASK   UINT32_C(0x07fff800)
776#define CONSTANT_OPCODE_NUM_SHIFT  1
777#define CONSTANT_OPCODE_NUM_MASK   UINT32_C(0x000007fe)
778#define CONSTANT_OPCODE_COPY_SHIFT 0
779#define CONSTANT_OPCODE_COPY_MASK  UINT32_C(0x00000001)
780
781#define BGFX_UNIFORM_FRAGMENTBIT UINT8_C(0x10)
782
783   class ConstantBuffer
784   {
785   public:
786      static ConstantBuffer* create(uint32_t _size)
787      {
788         uint32_t size = BX_ALIGN_16(bx::uint32_max(_size, sizeof(ConstantBuffer) ) );
789         void* data = BX_ALLOC(g_allocator, size);
790         return ::new(data) ConstantBuffer(_size);
791      }
792
793      static void destroy(ConstantBuffer* _constantBuffer)
794      {
795         _constantBuffer->~ConstantBuffer();
796         BX_FREE(g_allocator, _constantBuffer);
797      }
798
799      static uint32_t encodeOpcode(UniformType::Enum _type, uint16_t _loc, uint16_t _num, uint16_t _copy)
800      {
801         const uint32_t type = _type << CONSTANT_OPCODE_TYPE_SHIFT;
802         const uint32_t loc  = _loc  << CONSTANT_OPCODE_LOC_SHIFT;
803         const uint32_t num  = _num  << CONSTANT_OPCODE_NUM_SHIFT;
804         const uint32_t copy = _copy << CONSTANT_OPCODE_COPY_SHIFT;
805         return type|loc|num|copy;
806      }
807
808      static void decodeOpcode(uint32_t _opcode, UniformType::Enum& _type, uint16_t& _loc, uint16_t& _num, uint16_t& _copy)
809      {
810         const uint32_t type = (_opcode&CONSTANT_OPCODE_TYPE_MASK) >> CONSTANT_OPCODE_TYPE_SHIFT;
811         const uint32_t loc  = (_opcode&CONSTANT_OPCODE_LOC_MASK ) >> CONSTANT_OPCODE_LOC_SHIFT;
812         const uint32_t num  = (_opcode&CONSTANT_OPCODE_NUM_MASK ) >> CONSTANT_OPCODE_NUM_SHIFT;
813         const uint32_t copy = (_opcode&CONSTANT_OPCODE_COPY_MASK); // >> CONSTANT_OPCODE_COPY_SHIFT;
814
815         _type = (UniformType::Enum)(type);
816         _copy = (uint16_t)copy;
817         _num  = (uint16_t)num;
818         _loc  = (uint16_t)loc;
819      }
820
821      void write(const void* _data, uint32_t _size)
822      {
823         BX_CHECK(m_pos + _size < m_size, "Write would go out of bounds. pos %d + size %d > max size: %d).", m_pos, _size, m_size);
824
825         if (m_pos + _size < m_size)
826         {
827            memcpy(&m_buffer[m_pos], _data, _size);
828            m_pos += _size;
829         }
830      }
831
832      void write(uint32_t _value)
833      {
834         write(&_value, sizeof(uint32_t) );
835      }
836
837      const char* read(uint32_t _size)
838      {
839         BX_CHECK(m_pos < m_size, "Out of bounds %d (size: %d).", m_pos, m_size);
840         const char* result = &m_buffer[m_pos];
841         m_pos += _size;
842         return result;
843      }
844
845      uint32_t read()
846      {
847         uint32_t result;
848         memcpy(&result, read(sizeof(uint32_t) ), sizeof(uint32_t) );
849         return result;
850      }
851
852      bool isEmpty() const
853      {
854         return 0 == m_pos;
855      }
856
857      uint32_t getPos() const
858      {
859         return m_pos;
860      }
861
862      void reset(uint32_t _pos = 0)
863      {
864         m_pos = _pos;
865      }
866
867      void finish()
868      {
869         write(UniformType::End);
870         m_pos = 0;
871      }
872
873      void writeUniform(UniformType::Enum _type, uint16_t _loc, const void* _value, uint16_t _num = 1);
874      void writeUniformHandle(UniformType::Enum _type, uint16_t _loc, UniformHandle _handle, uint16_t _num = 1);
875      void writeMarker(const char* _marker);
876
877   private:
878      ConstantBuffer(uint32_t _size)
879         : m_size(_size-sizeof(m_buffer) )
880         , m_pos(0)
881      {
882         finish();
883      }
884
885      ~ConstantBuffer()
886      {
887      }
888
889      uint32_t m_size;
890      uint32_t m_pos;
891      char m_buffer[8];
892   };
893
894   typedef const void* (*UniformFn)(const void* _data);
895
896   struct UniformInfo
897   {
898      const void* m_data;
899      UniformFn m_func;
900      UniformHandle m_handle;
901   };
902
903    class UniformRegistry
904    {
905   public:
906      UniformRegistry()
907      {
908      }
909
910      ~UniformRegistry()
911      {
912      }
913
914       const UniformInfo* find(const char* _name) const
915       {
916         UniformHashMap::const_iterator it = m_uniforms.find(_name);
917         if (it != m_uniforms.end() )
918         {
919            return &it->second;
920         }
921
922          return NULL;
923       }
924
925      const UniformInfo& add(UniformHandle _handle, const char* _name, const void* _data, UniformFn _func = NULL)
926      {
927         UniformHashMap::iterator it = m_uniforms.find(_name);
928         if (it == m_uniforms.end() )
929         {
930            UniformInfo info;
931            info.m_data   = _data;
932            info.m_func   = _func;
933            info.m_handle = _handle;
934
935            stl::pair<UniformHashMap::iterator, bool> result = m_uniforms.insert(UniformHashMap::value_type(_name, info) );
936            return result.first->second;
937         }
938
939         UniformInfo& info = it->second;
940         info.m_data   = _data;
941         info.m_func   = _func;
942         info.m_handle = _handle;
943
944         return info;
945      }
946
947    private:
948       typedef stl::unordered_map<stl::string, UniformInfo> UniformHashMap;
949       UniformHashMap m_uniforms;
950    };
951
952   struct Sampler
953   {
954      uint32_t m_flags;
955      uint16_t m_idx;
956   };
957
958   struct RenderDraw
959   {
960      void clear()
961      {
962         m_constBegin = 0;
963         m_constEnd   = 0;
964         m_flags = BGFX_STATE_DEFAULT;
965         m_stencil = packStencil(BGFX_STENCIL_DEFAULT, BGFX_STENCIL_DEFAULT);
966         m_rgba = 0;
967         m_matrix = 0;
968         m_startIndex = 0;
969         m_numIndices = UINT32_MAX;
970         m_startVertex = 0;
971         m_numVertices = UINT32_MAX;
972         m_instanceDataOffset = 0;
973         m_instanceDataStride = 0;
974         m_numInstances = 1;
975         m_num = 1;
976         m_scissor = UINT16_MAX;
977         m_vertexBuffer.idx = invalidHandle;
978         m_vertexDecl.idx = invalidHandle;
979         m_indexBuffer.idx = invalidHandle;
980         m_instanceDataBuffer.idx = invalidHandle;
981
982         for (uint32_t ii = 0; ii < BGFX_CONFIG_MAX_TEXTURE_SAMPLERS; ++ii)
983         {
984            m_sampler[ii].m_idx = invalidHandle;
985            m_sampler[ii].m_flags = 0;
986         }
987      }
988
989      uint64_t m_flags;
990      uint64_t m_stencil;
991      uint32_t m_rgba;
992      uint32_t m_constBegin;
993      uint32_t m_constEnd;
994      uint32_t m_matrix;
995      uint32_t m_startIndex;
996      uint32_t m_numIndices;
997      uint32_t m_startVertex;
998      uint32_t m_numVertices;
999      uint32_t m_instanceDataOffset;
1000      uint16_t m_instanceDataStride;
1001      uint16_t m_numInstances;
1002      uint16_t m_num;
1003      uint16_t m_scissor;
1004
1005      VertexBufferHandle m_vertexBuffer;
1006      VertexDeclHandle   m_vertexDecl;
1007      IndexBufferHandle  m_indexBuffer;
1008      VertexBufferHandle m_instanceDataBuffer;
1009      Sampler m_sampler[BGFX_CONFIG_MAX_TEXTURE_SAMPLERS];
1010   };
1011
1012   struct ComputeBinding
1013   {
1014      enum Enum
1015      {
1016         Image,
1017         Buffer,
1018         
1019         Count
1020      };
1021
1022      uint16_t m_idx;
1023      uint8_t m_format;
1024      uint8_t m_access;
1025      uint8_t m_mip;
1026      uint8_t m_type;
1027   };
1028
1029   struct RenderCompute
1030   {
1031      void clear()
1032      {
1033         m_constBegin = 0;
1034         m_constEnd   = 0;
1035         m_numX = 0;
1036         m_numY = 0;
1037         m_numZ = 0;
1038
1039         for (uint32_t ii = 0; ii < BGFX_MAX_COMPUTE_BINDINGS; ++ii)
1040         {
1041            m_bind[ii].m_idx = invalidHandle;
1042         }
1043      }
1044
1045      uint32_t m_constBegin;
1046      uint32_t m_constEnd;
1047
1048      uint16_t m_numX;
1049      uint16_t m_numY;
1050      uint16_t m_numZ;
1051
1052      ComputeBinding m_bind[BGFX_MAX_COMPUTE_BINDINGS];
1053   };
1054
1055   union RenderItem
1056   {
1057      RenderDraw    draw;
1058      RenderCompute compute;
1059   };
1060
1061   struct Resolution
1062   {
1063      Resolution()
1064         : m_width(BGFX_DEFAULT_WIDTH)
1065         , m_height(BGFX_DEFAULT_HEIGHT)
1066         , m_flags(BGFX_RESET_NONE)
1067      {
1068      }
1069
1070      uint32_t m_width;
1071      uint32_t m_height;
1072      uint32_t m_flags;
1073   };
1074
1075   struct DynamicIndexBuffer
1076   {
1077      IndexBufferHandle m_handle;
1078      uint32_t m_offset;
1079      uint32_t m_size;
1080   };
1081
1082   struct DynamicVertexBuffer
1083   {
1084      VertexBufferHandle m_handle;
1085      uint32_t m_offset;
1086      uint32_t m_size;
1087      uint32_t m_startVertex;
1088      uint32_t m_numVertices;
1089      uint32_t m_stride;
1090      VertexDeclHandle m_decl;
1091   };
1092
1093   struct Frame
1094   {
1095      BX_CACHE_LINE_ALIGN_MARKER();
1096
1097      Frame()
1098         : m_waitSubmit(0)
1099         , m_waitRender(0)
1100      {
1101      }
1102
1103      ~Frame()
1104      {
1105      }
1106
1107      void create()
1108      {
1109         m_constantBuffer = ConstantBuffer::create(BGFX_CONFIG_MAX_CONSTANT_BUFFER_SIZE);
1110         reset();
1111         start();
1112         m_textVideoMem = BX_NEW(g_allocator, TextVideoMem);
1113      }
1114
1115      void destroy()
1116      {
1117         ConstantBuffer::destroy(m_constantBuffer);
1118         BX_DELETE(g_allocator, m_textVideoMem);
1119      }
1120
1121      void reset()
1122      {
1123         start();
1124         finish();
1125         resetFreeHandles();
1126      }
1127
1128      void start()
1129      {
1130         m_flags = BGFX_STATE_NONE;
1131         m_constBegin = 0;
1132         m_constEnd   = 0;
1133         m_draw.clear();
1134         m_compute.clear();
1135         m_matrixCache.reset();
1136         m_rectCache.reset();
1137         m_key.reset();
1138         m_num = 0;
1139         m_numRenderItems = 0;
1140         m_numDropped = 0;
1141         m_iboffset = 0;
1142         m_vboffset = 0;
1143         m_cmdPre.start();
1144         m_cmdPost.start();
1145         m_constantBuffer->reset();
1146         m_discard = false;
1147      }
1148
1149      void finish()
1150      {
1151         m_cmdPre.finish();
1152         m_cmdPost.finish();
1153
1154         m_constantBuffer->finish();
1155
1156         if (0 < m_numDropped)
1157         {
1158            BX_TRACE("Too many draw calls: %d, dropped %d (max: %d)"
1159               , m_num+m_numDropped
1160               , m_numDropped
1161               , BGFX_CONFIG_MAX_DRAW_CALLS
1162               );
1163         }
1164      }
1165
1166      void setMarker(const char* _name)
1167      {
1168         m_constantBuffer->writeMarker(_name);
1169      }
1170
1171      void setState(uint64_t _state, uint32_t _rgba)
1172      {
1173         uint8_t blend = ( (_state&BGFX_STATE_BLEND_MASK)>>BGFX_STATE_BLEND_SHIFT)&0xff;
1174         // transparency sort order table
1175         m_key.m_trans = "\x0\x1\x1\x2\x2\x1\x2\x1\x2\x1\x1\x1\x1\x1\x1\x1\x1\x1\x1"[( (blend)&0xf) + (!!blend)];
1176         m_draw.m_flags = _state;
1177         m_draw.m_rgba = _rgba;
1178      }
1179
1180      void setStencil(uint32_t _fstencil, uint32_t _bstencil)
1181      {
1182         m_draw.m_stencil = packStencil(_fstencil, _bstencil);
1183      }
1184
1185      uint16_t setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
1186      {
1187         uint16_t scissor = (uint16_t)m_rectCache.add(_x, _y, _width, _height);
1188         m_draw.m_scissor = scissor;
1189         return scissor;
1190      }
1191
1192      void setScissor(uint16_t _cache)
1193      {
1194         m_draw.m_scissor = _cache;
1195      }
1196
1197      uint32_t setTransform(const void* _mtx, uint16_t _num)
1198      {
1199         m_draw.m_matrix = m_matrixCache.add(_mtx, _num);
1200         m_draw.m_num = _num;
1201
1202         return m_draw.m_matrix;
1203      }
1204
1205      void setTransform(uint32_t _cache, uint16_t _num)
1206      {
1207         m_draw.m_matrix = _cache;
1208         m_draw.m_num = _num;
1209      }
1210
1211      void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices)
1212      {
1213         m_draw.m_startIndex = _firstIndex;
1214         m_draw.m_numIndices = _numIndices;
1215         m_draw.m_indexBuffer = _handle;
1216      }
1217
1218      void setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _firstIndex, uint32_t _numIndices)
1219      {
1220         m_draw.m_indexBuffer = _tib->handle;
1221         m_draw.m_startIndex = _firstIndex;
1222         m_draw.m_numIndices = _numIndices;
1223         m_discard = 0 == _numIndices;
1224      }
1225
1226      void setVertexBuffer(VertexBufferHandle _handle, uint32_t _startVertex, uint32_t _numVertices)
1227      {
1228         BX_CHECK(_handle.idx < BGFX_CONFIG_MAX_VERTEX_BUFFERS, "Invalid vertex buffer handle. %d (< %d)", _handle.idx, BGFX_CONFIG_MAX_VERTEX_BUFFERS);
1229         m_draw.m_startVertex = _startVertex;
1230         m_draw.m_numVertices = _numVertices;
1231         m_draw.m_vertexBuffer = _handle;
1232      }
1233
1234      void setVertexBuffer(const DynamicVertexBuffer& _dvb, uint32_t _numVertices)
1235      {
1236         m_draw.m_startVertex = _dvb.m_startVertex;
1237         m_draw.m_numVertices = bx::uint32_min(_dvb.m_numVertices, _numVertices);
1238         m_draw.m_vertexBuffer = _dvb.m_handle;
1239         m_draw.m_vertexDecl = _dvb.m_decl;
1240      }
1241
1242      void setVertexBuffer(const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices)
1243      {
1244         m_draw.m_startVertex = _startVertex;
1245         m_draw.m_numVertices = bx::uint32_min(_tvb->size/_tvb->stride, _numVertices);
1246         m_draw.m_vertexBuffer = _tvb->handle;
1247         m_draw.m_vertexDecl = _tvb->decl;
1248      }
1249
1250      void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint16_t _num)
1251      {
1252          m_draw.m_instanceDataOffset = _idb->offset;
1253         m_draw.m_instanceDataStride = _idb->stride;
1254         m_draw.m_numInstances = bx::uint16_min( (uint16_t)_idb->num, _num);
1255         m_draw.m_instanceDataBuffer = _idb->handle;
1256         BX_FREE(g_allocator, const_cast<InstanceDataBuffer*>(_idb) );
1257      }
1258
1259      void setProgram(ProgramHandle _handle)
1260      {
1261         BX_CHECK(isValid(_handle), "Can't set program with invalid handle.");
1262         m_key.m_program = _handle.idx;
1263      }
1264
1265      void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags)
1266      {
1267         Sampler& sampler = m_draw.m_sampler[_stage];
1268         sampler.m_idx = _handle.idx;
1269         sampler.m_flags = (_flags&BGFX_SAMPLER_DEFAULT_FLAGS) ? BGFX_SAMPLER_DEFAULT_FLAGS : _flags;
1270
1271         if (isValid(_sampler)
1272         && (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) ) )
1273         {
1274            uint32_t stage = _stage;
1275            setUniform(_sampler, &stage);
1276         }
1277      }
1278
1279      void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access)
1280      {
1281         ComputeBinding& bind = m_compute.m_bind[_stage];
1282         bind.m_idx     = _handle.idx;
1283         bind.m_format  = uint8_t(_format);
1284         bind.m_access  = uint8_t(_access);
1285         bind.m_mip     = _mip;
1286         bind.m_type    = uint8_t(ComputeBinding::Image);
1287
1288         if (isValid(_sampler)
1289         && (BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGL) || BX_ENABLED(BGFX_CONFIG_RENDERER_OPENGLES) ) )
1290         {
1291            uint32_t stage = _stage;
1292            setUniform(_sampler, &stage);
1293         }
1294      }
1295
1296      void discard()
1297      {
1298         m_discard = false;
1299         m_draw.clear();
1300         m_compute.clear();
1301         m_flags = BGFX_STATE_NONE;
1302      }
1303
1304      uint32_t submit(uint8_t _id, int32_t _depth);
1305      uint32_t submitMask(uint32_t _viewMask, int32_t _depth);
1306      uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _ngx, uint16_t _ngy, uint16_t _ngz);
1307      void sort();
1308
1309      bool checkAvailTransientIndexBuffer(uint32_t _num)
1310      {
1311         uint32_t offset = m_iboffset;
1312         uint32_t iboffset = offset + _num*sizeof(uint16_t);
1313         iboffset = bx::uint32_min(iboffset, BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
1314         uint32_t num = (iboffset-offset)/sizeof(uint16_t);
1315         return num == _num;
1316      }
1317
1318      uint32_t allocTransientIndexBuffer(uint32_t& _num)
1319      {
1320         uint32_t offset = m_iboffset;
1321         m_iboffset = offset + _num*sizeof(uint16_t);
1322         m_iboffset = bx::uint32_min(m_iboffset, BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
1323         _num = (m_iboffset-offset)/sizeof(uint16_t);
1324         return offset;
1325      }
1326
1327      bool checkAvailTransientVertexBuffer(uint32_t _num, uint16_t _stride)
1328      {
1329         uint32_t offset = strideAlign(m_vboffset, _stride);
1330         uint32_t vboffset = offset + _num * _stride;
1331         vboffset = bx::uint32_min(vboffset, BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
1332         uint32_t num = (vboffset-offset)/_stride;
1333         return num == _num;
1334      }
1335
1336      uint32_t allocTransientVertexBuffer(uint32_t& _num, uint16_t _stride)
1337      {
1338         uint32_t offset = strideAlign(m_vboffset, _stride);
1339         m_vboffset = offset + _num * _stride;
1340         m_vboffset = bx::uint32_min(m_vboffset, BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
1341         _num = (m_vboffset-offset)/_stride;
1342         return offset;
1343      }
1344
1345      void writeUniform(UniformType::Enum _type, UniformHandle _handle, const void* _value, uint16_t _num)
1346      {
1347         m_constantBuffer->writeUniform(_type, _handle.idx, _value, _num);
1348      }
1349
1350      void free(IndexBufferHandle _handle)
1351      {
1352         m_freeIndexBufferHandle[m_numFreeIndexBufferHandles] = _handle;
1353         ++m_numFreeIndexBufferHandles;
1354      }
1355
1356      void free(VertexDeclHandle _handle)
1357      {
1358         m_freeVertexDeclHandle[m_numFreeVertexDeclHandles] = _handle;
1359         ++m_numFreeVertexDeclHandles;
1360      }
1361
1362      void free(VertexBufferHandle _handle)
1363      {
1364         m_freeVertexBufferHandle[m_numFreeVertexBufferHandles] = _handle;
1365         ++m_numFreeVertexBufferHandles;
1366      }
1367
1368      void free(ShaderHandle _handle)
1369      {
1370         m_freeShaderHandle[m_numFreeShaderHandles] = _handle;
1371         ++m_numFreeShaderHandles;
1372      }
1373
1374      void free(ProgramHandle _handle)
1375      {
1376         m_freeProgramHandle[m_numFreeProgramHandles] = _handle;
1377         ++m_numFreeProgramHandles;
1378      }
1379
1380      void free(TextureHandle _handle)
1381      {
1382         m_freeTextureHandle[m_numFreeTextureHandles] = _handle;
1383         ++m_numFreeTextureHandles;
1384      }
1385
1386      void free(FrameBufferHandle _handle)
1387      {
1388         m_freeFrameBufferHandle[m_numFreeFrameBufferHandles] = _handle;
1389         ++m_numFreeFrameBufferHandles;
1390      }
1391
1392      void free(UniformHandle _handle)
1393      {
1394         m_freeUniformHandle[m_numFreeUniformHandles] = _handle;
1395         ++m_numFreeUniformHandles;
1396      }
1397
1398      void resetFreeHandles()
1399      {
1400         m_numFreeIndexBufferHandles = 0;
1401         m_numFreeVertexDeclHandles = 0;
1402         m_numFreeVertexBufferHandles = 0;
1403         m_numFreeShaderHandles = 0;
1404         m_numFreeProgramHandles = 0;
1405         m_numFreeTextureHandles = 0;
1406         m_numFreeFrameBufferHandles = 0;
1407         m_numFreeUniformHandles = 0;
1408      }
1409
1410      SortKey m_key;
1411
1412      FrameBufferHandle m_fb[BGFX_CONFIG_MAX_VIEWS];
1413      Clear m_clear[BGFX_CONFIG_MAX_VIEWS];
1414      Rect m_rect[BGFX_CONFIG_MAX_VIEWS];
1415      Rect m_scissor[BGFX_CONFIG_MAX_VIEWS];
1416      Matrix4 m_view[BGFX_CONFIG_MAX_VIEWS];
1417      Matrix4 m_proj[BGFX_CONFIG_MAX_VIEWS];
1418
1419      uint64_t m_sortKeys[BGFX_CONFIG_MAX_DRAW_CALLS];
1420      uint16_t m_sortValues[BGFX_CONFIG_MAX_DRAW_CALLS];
1421      RenderItem m_renderItem[BGFX_CONFIG_MAX_DRAW_CALLS];
1422      RenderDraw m_draw;
1423      RenderCompute m_compute;
1424      uint64_t m_flags;
1425      uint32_t m_constBegin;
1426      uint32_t m_constEnd;
1427
1428      ConstantBuffer* m_constantBuffer;
1429
1430      uint16_t m_num;
1431      uint16_t m_numRenderItems;
1432      uint16_t m_numDropped;
1433
1434      MatrixCache m_matrixCache;
1435      RectCache m_rectCache;
1436
1437      uint32_t m_iboffset;
1438      uint32_t m_vboffset;
1439      TransientIndexBuffer* m_transientIb;
1440      TransientVertexBuffer* m_transientVb;
1441
1442      Resolution m_resolution;
1443      uint32_t m_debug;
1444
1445      CommandBuffer m_cmdPre;
1446      CommandBuffer m_cmdPost;
1447
1448      uint16_t m_numFreeIndexBufferHandles;
1449      uint16_t m_numFreeVertexDeclHandles;
1450      uint16_t m_numFreeVertexBufferHandles;
1451      uint16_t m_numFreeShaderHandles;
1452      uint16_t m_numFreeProgramHandles;
1453      uint16_t m_numFreeTextureHandles;
1454      uint16_t m_numFreeFrameBufferHandles;
1455      uint16_t m_numFreeUniformHandles;
1456
1457      IndexBufferHandle m_freeIndexBufferHandle[BGFX_CONFIG_MAX_INDEX_BUFFERS];
1458      VertexDeclHandle m_freeVertexDeclHandle[BGFX_CONFIG_MAX_VERTEX_DECLS];
1459      VertexBufferHandle m_freeVertexBufferHandle[BGFX_CONFIG_MAX_VERTEX_BUFFERS];
1460      ShaderHandle m_freeShaderHandle[BGFX_CONFIG_MAX_SHADERS];
1461      ProgramHandle m_freeProgramHandle[BGFX_CONFIG_MAX_PROGRAMS];
1462      TextureHandle m_freeTextureHandle[BGFX_CONFIG_MAX_TEXTURES];
1463      FrameBufferHandle m_freeFrameBufferHandle[BGFX_CONFIG_MAX_FRAME_BUFFERS];
1464      UniformHandle m_freeUniformHandle[BGFX_CONFIG_MAX_UNIFORMS];
1465      TextVideoMem* m_textVideoMem;
1466
1467      int64_t m_waitSubmit;
1468      int64_t m_waitRender;
1469
1470      bool m_discard;
1471   };
1472
1473   struct VertexDeclRef
1474   {
1475      VertexDeclRef()
1476      {
1477      }
1478
1479      void init()
1480      {
1481         memset(m_vertexDeclRef, 0, sizeof(m_vertexDeclRef) );
1482         memset(m_vertexBufferRef, 0xff, sizeof(m_vertexBufferRef) );
1483      }
1484
1485      template <uint16_t MaxHandlesT>
1486      void shutdown(bx::HandleAllocT<MaxHandlesT>& _handleAlloc)
1487      {
1488         for (VertexDeclMap::iterator it = m_vertexDeclMap.begin(), itEnd = m_vertexDeclMap.end(); it != itEnd; ++it)
1489         {
1490            _handleAlloc.free(it->second.idx);
1491         }
1492
1493         m_vertexDeclMap.clear();
1494      }
1495
1496      VertexDeclHandle find(uint32_t _hash)
1497      {
1498         VertexDeclMap::const_iterator it = m_vertexDeclMap.find(_hash);
1499         if (it != m_vertexDeclMap.end() )
1500         {
1501            return it->second;
1502         }
1503
1504         VertexDeclHandle result = BGFX_INVALID_HANDLE;
1505         return result;
1506      }
1507
1508      void add(VertexBufferHandle _handle, VertexDeclHandle _declHandle, uint32_t _hash)
1509      {
1510         m_vertexBufferRef[_handle.idx] = _declHandle;
1511         m_vertexDeclRef[_declHandle.idx]++;
1512         m_vertexDeclMap.insert(stl::make_pair(_hash, _declHandle) );
1513      }
1514
1515      VertexDeclHandle release(VertexBufferHandle _handle)
1516      {
1517         VertexDeclHandle declHandle = m_vertexBufferRef[_handle.idx];
1518         if (isValid(declHandle) )
1519         {
1520            m_vertexDeclRef[declHandle.idx]--;
1521
1522            if (0 != m_vertexDeclRef[declHandle.idx])
1523            {
1524               VertexDeclHandle invalid = BGFX_INVALID_HANDLE;
1525               return invalid;
1526            }
1527         }
1528
1529         return declHandle;
1530      }
1531
1532      typedef stl::unordered_map<uint32_t, VertexDeclHandle> VertexDeclMap;
1533      VertexDeclMap m_vertexDeclMap;
1534      uint16_t m_vertexDeclRef[BGFX_CONFIG_MAX_VERTEX_DECLS];
1535      VertexDeclHandle m_vertexBufferRef[BGFX_CONFIG_MAX_VERTEX_BUFFERS];
1536   };
1537
1538   // First-fit non-local allocator.
1539   class NonLocalAllocator
1540   {
1541   public:
1542      static const uint64_t invalidBlock = UINT64_MAX;
1543
1544      NonLocalAllocator()
1545      {
1546      }
1547
1548      ~NonLocalAllocator()
1549      {
1550      }
1551
1552      void reset()
1553      {
1554         m_free.clear();
1555         m_used.clear();
1556      }
1557
1558      void add(uint64_t _ptr, uint32_t _size)
1559      {
1560         m_free.push_back(Free(_ptr, _size) );
1561      }
1562
1563      uint64_t alloc(uint32_t _size)
1564      {
1565         for (FreeList::iterator it = m_free.begin(), itEnd = m_free.end(); it != itEnd; ++it)
1566         {
1567            if (it->m_size >= _size)
1568            {
1569               uint64_t ptr = it->m_ptr;
1570
1571               m_used.insert(stl::make_pair(ptr, _size) );
1572
1573               if (it->m_size != _size)
1574               {
1575                  it->m_size -= _size;
1576                  it->m_ptr += _size;
1577               }
1578               else
1579               {
1580                  m_free.erase(it);
1581               }
1582
1583               return ptr;
1584            }
1585         }
1586
1587         // there is no block large enough.
1588         return invalidBlock;
1589      }
1590
1591      void free(uint64_t _block)
1592      {
1593         UsedList::iterator it = m_used.find(_block);
1594         if (it != m_used.end() )
1595         {
1596            m_free.push_front(Free(it->first, it->second) );
1597            m_used.erase(it);
1598         }
1599      }
1600
1601      void compact()
1602      {
1603         m_free.sort();
1604
1605         for (FreeList::iterator it = m_free.begin(), next = it, itEnd = m_free.end(); next != itEnd;)
1606         {
1607            if ( (it->m_ptr + it->m_size) == next->m_ptr)
1608            {
1609               it->m_size += next->m_size;
1610               next = m_free.erase(next);
1611            }
1612            else
1613            {
1614               it = next;
1615               ++next;
1616            }
1617         }
1618      }
1619
1620   private:
1621      struct Free
1622      {
1623         Free(uint64_t _ptr, uint32_t _size)
1624            : m_ptr(_ptr)
1625            , m_size(_size)
1626         {
1627         }
1628
1629         bool operator<(const Free& rhs) const
1630         {
1631            return m_ptr < rhs.m_ptr;
1632         }
1633
1634         uint64_t m_ptr;
1635         uint32_t m_size;
1636      };
1637
1638      typedef std::list<Free> FreeList;
1639      FreeList m_free;
1640
1641      typedef stl::unordered_map<uint64_t, uint32_t> UsedList;
1642      UsedList m_used;
1643   };
1644
1645   struct BX_NO_VTABLE RendererContextI
1646   {
1647      virtual ~RendererContextI() = 0;
1648      virtual RendererType::Enum getRendererType() const = 0;
1649      virtual const char* getRendererName() const = 0;
1650      virtual void flip() = 0;
1651      virtual void createIndexBuffer(IndexBufferHandle _handle, Memory* _mem) = 0;
1652      virtual void destroyIndexBuffer(IndexBufferHandle _handle) = 0;
1653      virtual void createVertexDecl(VertexDeclHandle _handle, const VertexDecl& _decl) = 0;
1654      virtual void destroyVertexDecl(VertexDeclHandle _handle) = 0;
1655      virtual void createVertexBuffer(VertexBufferHandle _handle, Memory* _mem, VertexDeclHandle _declHandle) = 0;
1656      virtual void destroyVertexBuffer(VertexBufferHandle _handle) = 0;
1657      virtual void createDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _size) = 0;
1658      virtual void updateDynamicIndexBuffer(IndexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) = 0;
1659      virtual void destroyDynamicIndexBuffer(IndexBufferHandle _handle) = 0;
1660      virtual void createDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _size) = 0;
1661      virtual void updateDynamicVertexBuffer(VertexBufferHandle _handle, uint32_t _offset, uint32_t _size, Memory* _mem) = 0;
1662      virtual void destroyDynamicVertexBuffer(VertexBufferHandle _handle) = 0;
1663      virtual void createShader(ShaderHandle _handle, Memory* _mem) = 0;
1664      virtual void destroyShader(ShaderHandle _handle) = 0;
1665      virtual void createProgram(ProgramHandle _handle, ShaderHandle _vsh, ShaderHandle _fsh) = 0;
1666      virtual void destroyProgram(ProgramHandle _handle) = 0;
1667      virtual void createTexture(TextureHandle _handle, Memory* _mem, uint32_t _flags, uint8_t _skip) = 0;
1668      virtual void updateTextureBegin(TextureHandle _handle, uint8_t _side, uint8_t _mip) = 0;
1669      virtual void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem) = 0;
1670      virtual void updateTextureEnd() = 0;
1671      virtual void destroyTexture(TextureHandle _handle) = 0;
1672      virtual void createFrameBuffer(FrameBufferHandle _handle, uint8_t _num, const TextureHandle* _textureHandles) = 0;
1673      virtual void destroyFrameBuffer(FrameBufferHandle _handle) = 0;
1674      virtual void createUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name) = 0;
1675      virtual void destroyUniform(UniformHandle _handle) = 0;
1676      virtual void saveScreenShot(const char* _filePath) = 0;
1677      virtual void updateViewName(uint8_t _id, const char* _name) = 0;
1678      virtual void updateUniform(uint16_t _loc, const void* _data, uint32_t _size) = 0;
1679      virtual void setMarker(const char* _marker, uint32_t _size) = 0;
1680      virtual void submit(Frame* _render, ClearQuad& _clearQuad, TextVideoMemBlitter& _textVideoMemBlitter) = 0;
1681      virtual void blitSetup(TextVideoMemBlitter& _blitter) = 0;
1682      virtual void blitRender(TextVideoMemBlitter& _blitter, uint32_t _numIndices) = 0;
1683   };
1684
1685   inline RendererContextI::~RendererContextI()
1686   {
1687   }
1688
1689   void rendererUpdateUniforms(RendererContextI* _renderCtx, ConstantBuffer* _constantBuffer, uint32_t _begin, uint32_t _end);
1690
1691#if BGFX_CONFIG_DEBUG
1692#   define BGFX_API_FUNC(_func) BX_NO_INLINE _func
1693#else
1694#   define BGFX_API_FUNC(_func) _func
1695#endif // BGFX_CONFIG_DEBUG
1696
1697   struct Context
1698   {
1699      Context()
1700         : m_render(&m_frame[0])
1701         , m_submit(&m_frame[1])
1702         , m_numFreeDynamicIndexBufferHandles(0)
1703         , m_numFreeDynamicVertexBufferHandles(0)
1704         , m_instBufferCount(0)
1705         , m_frames(0)
1706         , m_debug(BGFX_DEBUG_NONE)
1707         , m_rendererInitialized(false)
1708         , m_exit(false)
1709      {
1710      }
1711
1712      ~Context()
1713      {
1714      }
1715
1716      static int32_t renderThread(void* _userData)
1717      {
1718         BX_TRACE("render thread start");
1719         Context* ctx = (Context*)_userData;
1720         while (!ctx->renderFrame() ) {};
1721         BX_TRACE("render thread exit");
1722         return EXIT_SUCCESS;
1723      }
1724
1725      // game thread
1726      void init(RendererType::Enum _type);
1727      void shutdown();
1728
1729      CommandBuffer& getCommandBuffer(CommandBuffer::Enum _cmd)
1730      {
1731         CommandBuffer& cmdbuf = _cmd < CommandBuffer::End ? m_submit->m_cmdPre : m_submit->m_cmdPost;
1732         uint8_t cmd = (uint8_t)_cmd;
1733         cmdbuf.write(cmd);
1734         return cmdbuf;
1735      }
1736
1737      BGFX_API_FUNC(void reset(uint32_t _width, uint32_t _height, uint32_t _flags) )
1738      {
1739         BX_WARN(0 != _width && 0 != _height, "Frame buffer resolution width or height cannot be 0 (width %d, height %d).", _width, _height);
1740         m_resolution.m_width = bx::uint32_max(1, _width);
1741         m_resolution.m_height = bx::uint32_max(1, _height);
1742         m_resolution.m_flags = _flags;
1743
1744         memset(m_fb, 0xff, sizeof(m_fb) );
1745      }
1746
1747      BGFX_API_FUNC(void setDebug(uint32_t _debug) )
1748      {
1749         m_debug = _debug;
1750      }
1751
1752      BGFX_API_FUNC(void dbgTextClear(uint8_t _attr, bool _small) )
1753      {
1754         m_submit->m_textVideoMem->resize(_small, (uint16_t)m_resolution.m_width, (uint16_t)m_resolution.m_height);
1755         m_submit->m_textVideoMem->clear(_attr);
1756      }
1757
1758      BGFX_API_FUNC(void dbgTextPrintfVargs(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList) )
1759      {
1760         m_submit->m_textVideoMem->printfVargs(_x, _y, _attr, _format, _argList);
1761      }
1762
1763      BGFX_API_FUNC(IndexBufferHandle createIndexBuffer(const Memory* _mem) )
1764      {
1765         IndexBufferHandle handle = { m_indexBufferHandle.alloc() };
1766
1767         BX_WARN(isValid(handle), "Failed to allocate index buffer handle.");
1768         if (isValid(handle) )
1769         {
1770            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateIndexBuffer);
1771            cmdbuf.write(handle);
1772            cmdbuf.write(_mem);
1773         }
1774
1775         return handle;
1776      }
1777
1778      BGFX_API_FUNC(void destroyIndexBuffer(IndexBufferHandle _handle) )
1779      {
1780         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyIndexBuffer);
1781         cmdbuf.write(_handle);
1782         m_submit->free(_handle);
1783      }
1784
1785      VertexDeclHandle findVertexDecl(const VertexDecl& _decl)
1786      {
1787         VertexDeclHandle declHandle = m_declRef.find(_decl.m_hash);
1788
1789         if (!isValid(declHandle) )
1790         {
1791            VertexDeclHandle temp = { m_vertexDeclHandle.alloc() };
1792            declHandle = temp;
1793            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateVertexDecl);
1794            cmdbuf.write(declHandle);
1795            cmdbuf.write(_decl);
1796         }
1797
1798         return declHandle;
1799      }
1800
1801      BGFX_API_FUNC(VertexBufferHandle createVertexBuffer(const Memory* _mem, const VertexDecl& _decl) )
1802      {
1803         VertexBufferHandle handle = { m_vertexBufferHandle.alloc() };
1804
1805         BX_WARN(isValid(handle), "Failed to allocate vertex buffer handle.");
1806         if (isValid(handle) )
1807         {
1808            VertexDeclHandle declHandle = findVertexDecl(_decl);
1809            m_declRef.add(handle, declHandle, _decl.m_hash);
1810
1811            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateVertexBuffer);
1812            cmdbuf.write(handle);
1813            cmdbuf.write(_mem);
1814            cmdbuf.write(declHandle);
1815         }
1816
1817         return handle;
1818      }
1819
1820      BGFX_API_FUNC(void destroyVertexBuffer(VertexBufferHandle _handle) )
1821      {
1822         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyVertexBuffer);
1823         cmdbuf.write(_handle);
1824         m_submit->free(_handle);
1825      }
1826
1827      void destroyVertexBufferInternal(VertexBufferHandle _handle)
1828      {
1829         VertexDeclHandle declHandle = m_declRef.release(_handle);
1830         if (isValid(declHandle) )
1831         {
1832            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyVertexDecl);
1833            cmdbuf.write(declHandle);
1834         }
1835
1836         m_vertexBufferHandle.free(_handle.idx);
1837      }
1838
1839      BGFX_API_FUNC(DynamicIndexBufferHandle createDynamicIndexBuffer(uint32_t _num) )
1840      {
1841         DynamicIndexBufferHandle handle = BGFX_INVALID_HANDLE;
1842         uint32_t size = BX_ALIGN_16(_num*2);
1843         uint64_t ptr = m_dynamicIndexBufferAllocator.alloc(size);
1844         if (ptr == NonLocalAllocator::invalidBlock)
1845         {
1846            IndexBufferHandle indexBufferHandle = { m_indexBufferHandle.alloc() };
1847            BX_WARN(isValid(indexBufferHandle), "Failed to allocate index buffer handle.");
1848            if (!isValid(indexBufferHandle) )
1849            {
1850               return handle;
1851            }
1852
1853            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicIndexBuffer);
1854            cmdbuf.write(indexBufferHandle);
1855            cmdbuf.write(BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE);
1856
1857            m_dynamicIndexBufferAllocator.add(uint64_t(indexBufferHandle.idx)<<32, BGFX_CONFIG_DYNAMIC_INDEX_BUFFER_SIZE);
1858            ptr = m_dynamicIndexBufferAllocator.alloc(size);
1859         }
1860
1861         handle.idx = m_dynamicIndexBufferHandle.alloc();
1862         BX_WARN(isValid(handle), "Failed to allocate dynamic index buffer handle.");
1863         if (!isValid(handle) )
1864         {
1865            return handle;
1866         }
1867
1868         DynamicIndexBuffer& dib = m_dynamicIndexBuffers[handle.idx];
1869         dib.m_handle.idx = uint16_t(ptr>>32);
1870         dib.m_offset = uint32_t(ptr);
1871         dib.m_size = size;
1872
1873         return handle;
1874      }
1875
1876      BGFX_API_FUNC(DynamicIndexBufferHandle createDynamicIndexBuffer(const Memory* _mem) )
1877      {
1878         DynamicIndexBufferHandle handle = createDynamicIndexBuffer(_mem->size/2);
1879         if (isValid(handle) )
1880         {
1881            updateDynamicIndexBuffer(handle, _mem);
1882         }
1883         return handle;
1884      }
1885
1886      BGFX_API_FUNC(void updateDynamicIndexBuffer(DynamicIndexBufferHandle _handle, const Memory* _mem) )
1887      {
1888         DynamicIndexBuffer& dib = m_dynamicIndexBuffers[_handle.idx];
1889         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::UpdateDynamicIndexBuffer);
1890         cmdbuf.write(dib.m_handle);
1891         cmdbuf.write(dib.m_offset);
1892         cmdbuf.write(dib.m_size);
1893         cmdbuf.write(_mem);
1894      }
1895
1896      BGFX_API_FUNC(void destroyDynamicIndexBuffer(DynamicIndexBufferHandle _handle) )
1897      {
1898         m_freeDynamicIndexBufferHandle[m_numFreeDynamicIndexBufferHandles++] = _handle;
1899      }
1900
1901      void destroyDynamicIndexBufferInternal(DynamicIndexBufferHandle _handle)
1902      {
1903         DynamicIndexBuffer& dib = m_dynamicIndexBuffers[_handle.idx];
1904         m_dynamicIndexBufferAllocator.free(uint64_t(dib.m_handle.idx)<<32 | dib.m_offset);
1905         m_dynamicIndexBufferHandle.free(_handle.idx);
1906      }
1907
1908      BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl) )
1909      {
1910         DynamicVertexBufferHandle handle = BGFX_INVALID_HANDLE;
1911         uint32_t size = strideAlign16(_num*_decl.m_stride, _decl.m_stride);
1912         uint64_t ptr = m_dynamicVertexBufferAllocator.alloc(size);
1913         if (ptr == NonLocalAllocator::invalidBlock)
1914         {
1915            VertexBufferHandle vertexBufferHandle = { m_vertexBufferHandle.alloc() };
1916
1917            BX_WARN(isValid(handle), "Failed to allocate dynamic vertex buffer handle.");
1918            if (!isValid(vertexBufferHandle) )
1919            {
1920               return handle;
1921            }
1922
1923            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicVertexBuffer);
1924            cmdbuf.write(vertexBufferHandle);
1925            cmdbuf.write(BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE);
1926
1927            m_dynamicVertexBufferAllocator.add(uint64_t(vertexBufferHandle.idx)<<32, BGFX_CONFIG_DYNAMIC_VERTEX_BUFFER_SIZE);
1928            ptr = m_dynamicVertexBufferAllocator.alloc(size);
1929         }
1930
1931         VertexDeclHandle declHandle = findVertexDecl(_decl);
1932
1933         handle.idx = m_dynamicVertexBufferHandle.alloc();
1934         DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[handle.idx];
1935         dvb.m_handle.idx = uint16_t(ptr>>32);
1936         dvb.m_offset = uint32_t(ptr);
1937         dvb.m_size = size;
1938         dvb.m_startVertex = dvb.m_offset/_decl.m_stride;
1939         dvb.m_numVertices = dvb.m_size/_decl.m_stride;
1940         dvb.m_decl = declHandle;
1941         m_declRef.add(dvb.m_handle, declHandle, _decl.m_hash);
1942
1943         return handle;
1944      }
1945
1946      BGFX_API_FUNC(DynamicVertexBufferHandle createDynamicVertexBuffer(const Memory* _mem, const VertexDecl& _decl) )
1947      {
1948         uint32_t numVertices = _mem->size/_decl.m_stride;
1949         BX_CHECK(numVertices <= UINT16_MAX, "Num vertices exceeds maximum (num %d, max %d).", numVertices, UINT16_MAX);
1950         DynamicVertexBufferHandle handle = createDynamicVertexBuffer(uint16_t(numVertices), _decl);
1951         if (isValid(handle) )
1952         {
1953            updateDynamicVertexBuffer(handle, _mem);
1954         }
1955         return handle;
1956      }
1957
1958      BGFX_API_FUNC(void updateDynamicVertexBuffer(DynamicVertexBufferHandle _handle, const Memory* _mem) )
1959      {
1960         DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx];
1961         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::UpdateDynamicVertexBuffer);
1962         cmdbuf.write(dvb.m_handle);
1963         cmdbuf.write(dvb.m_offset);
1964         cmdbuf.write(dvb.m_size);
1965         cmdbuf.write(_mem);
1966      }
1967
1968      BGFX_API_FUNC(void destroyDynamicVertexBuffer(DynamicVertexBufferHandle _handle) )
1969      {
1970         m_freeDynamicVertexBufferHandle[m_numFreeDynamicVertexBufferHandles++] = _handle;
1971      }
1972
1973      void destroyDynamicVertexBufferInternal(DynamicVertexBufferHandle _handle)
1974      {
1975         DynamicVertexBuffer& dvb = m_dynamicVertexBuffers[_handle.idx];
1976
1977         VertexDeclHandle declHandle = m_declRef.release(dvb.m_handle);
1978         if (invalidHandle != declHandle.idx)
1979         {
1980            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyVertexDecl);
1981            cmdbuf.write(declHandle);
1982         }
1983
1984         m_dynamicVertexBufferAllocator.free(uint64_t(dvb.m_handle.idx)<<32 | dvb.m_offset);
1985         m_dynamicVertexBufferHandle.free(_handle.idx);
1986      }
1987
1988      BGFX_API_FUNC(bool checkAvailTransientIndexBuffer(uint32_t _num) const)
1989      {
1990         return m_submit->checkAvailTransientIndexBuffer(_num);
1991      }
1992
1993      BGFX_API_FUNC(bool checkAvailTransientVertexBuffer(uint32_t _num, uint16_t _stride) const)
1994      {
1995         return m_submit->checkAvailTransientVertexBuffer(_num, _stride);
1996      }
1997
1998      TransientIndexBuffer* createTransientIndexBuffer(uint32_t _size)
1999      {
2000         TransientIndexBuffer* ib = NULL;
2001
2002         IndexBufferHandle handle = { m_indexBufferHandle.alloc() };
2003         BX_WARN(isValid(handle), "Failed to allocate transient index buffer handle.");
2004         if (isValid(handle) )
2005         {
2006            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicIndexBuffer);
2007            cmdbuf.write(handle);
2008            cmdbuf.write(_size);
2009
2010            ib = (TransientIndexBuffer*)BX_ALLOC(g_allocator, sizeof(TransientIndexBuffer)+_size);
2011            ib->data = (uint8_t*)&ib[1];
2012            ib->size = _size;
2013            ib->handle = handle;
2014         }
2015
2016         return ib;
2017      }
2018
2019      void destroyTransientIndexBuffer(TransientIndexBuffer* _ib)
2020      {
2021         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyDynamicIndexBuffer);
2022         cmdbuf.write(_ib->handle);
2023
2024         m_submit->free(_ib->handle);
2025         BX_FREE(g_allocator, const_cast<TransientIndexBuffer*>(_ib) );
2026      }
2027
2028      BGFX_API_FUNC(void allocTransientIndexBuffer(TransientIndexBuffer* _tib, uint32_t _num) )
2029      {
2030         uint32_t offset = m_submit->allocTransientIndexBuffer(_num);
2031
2032         TransientIndexBuffer& dib = *m_submit->m_transientIb;
2033
2034         _tib->data = &dib.data[offset];
2035         _tib->size = _num * sizeof(uint16_t);
2036         _tib->handle = dib.handle;
2037         _tib->startIndex = offset/sizeof(uint16_t);
2038      }
2039
2040      TransientVertexBuffer* createTransientVertexBuffer(uint32_t _size, const VertexDecl* _decl = NULL)
2041      {
2042         TransientVertexBuffer* vb = NULL;
2043
2044         VertexBufferHandle handle = { m_vertexBufferHandle.alloc() };
2045
2046         BX_WARN(isValid(handle), "Failed to allocate transient vertex buffer handle.");
2047         if (isValid(handle) )
2048         {
2049            uint16_t stride = 0;
2050            VertexDeclHandle declHandle = BGFX_INVALID_HANDLE;
2051
2052            if (NULL != _decl)
2053            {
2054               declHandle = findVertexDecl(*_decl);
2055               m_declRef.add(handle, declHandle, _decl->m_hash);
2056
2057               stride = _decl->m_stride;
2058            }
2059
2060            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateDynamicVertexBuffer);
2061            cmdbuf.write(handle);
2062            cmdbuf.write(_size);
2063
2064            vb = (TransientVertexBuffer*)BX_ALLOC(g_allocator, sizeof(TransientVertexBuffer)+_size);
2065            vb->data = (uint8_t*)&vb[1];
2066            vb->size = _size;
2067            vb->startVertex = 0;
2068            vb->stride = stride;
2069            vb->handle = handle;
2070            vb->decl = declHandle;
2071         }
2072
2073         return vb;
2074      }
2075
2076      void destroyTransientVertexBuffer(TransientVertexBuffer* _vb)
2077      {
2078         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyDynamicVertexBuffer);
2079         cmdbuf.write(_vb->handle);
2080
2081         m_submit->free(_vb->handle);
2082         BX_FREE(g_allocator, const_cast<TransientVertexBuffer*>(_vb) );
2083      }
2084
2085      BGFX_API_FUNC(void allocTransientVertexBuffer(TransientVertexBuffer* _tvb, uint32_t _num, const VertexDecl& _decl) )
2086      {
2087         VertexDeclHandle declHandle = m_declRef.find(_decl.m_hash);
2088
2089         TransientVertexBuffer& dvb = *m_submit->m_transientVb;
2090
2091         if (!isValid(declHandle) )
2092         {
2093            VertexDeclHandle temp = { m_vertexDeclHandle.alloc() };
2094            declHandle = temp;
2095            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateVertexDecl);
2096            cmdbuf.write(declHandle);
2097            cmdbuf.write(_decl);
2098            m_declRef.add(dvb.handle, declHandle, _decl.m_hash);
2099         }
2100
2101         uint32_t offset = m_submit->allocTransientVertexBuffer(_num, _decl.m_stride);
2102
2103         _tvb->data = &dvb.data[offset];
2104         _tvb->size = _num * _decl.m_stride;
2105         _tvb->startVertex = offset/_decl.m_stride;
2106         _tvb->stride = _decl.m_stride;
2107         _tvb->handle = dvb.handle;
2108         _tvb->decl = declHandle;
2109      }
2110
2111      BGFX_API_FUNC(const InstanceDataBuffer* allocInstanceDataBuffer(uint32_t _num, uint16_t _stride) )
2112      {
2113         ++m_instBufferCount;
2114
2115         uint16_t stride = BX_ALIGN_16(_stride);
2116         uint32_t offset = m_submit->allocTransientVertexBuffer(_num, stride);
2117
2118         TransientVertexBuffer& dvb = *m_submit->m_transientVb;
2119         InstanceDataBuffer* idb = (InstanceDataBuffer*)BX_ALLOC(g_allocator, sizeof(InstanceDataBuffer) );
2120         idb->data = &dvb.data[offset];
2121         idb->size = _num * stride;
2122         idb->offset = offset;
2123         idb->stride = stride;
2124         idb->num = _num;
2125         idb->handle = dvb.handle;
2126
2127         return idb;
2128      }
2129
2130      BGFX_API_FUNC(ShaderHandle createShader(const Memory* _mem) )
2131      {
2132         bx::MemoryReader reader(_mem->data, _mem->size);
2133
2134         uint32_t magic;
2135         bx::read(&reader, magic);
2136
2137         if (BGFX_CHUNK_MAGIC_CSH != magic
2138         &&  BGFX_CHUNK_MAGIC_FSH != magic
2139         &&  BGFX_CHUNK_MAGIC_VSH != magic)
2140         {
2141            BX_WARN(false, "Invalid shader signature! 0x%08x.", magic);
2142            ShaderHandle invalid = BGFX_INVALID_HANDLE;
2143            return invalid;
2144         }
2145
2146         ShaderHandle handle = { m_shaderHandle.alloc() };
2147
2148         BX_WARN(isValid(handle), "Failed to allocate shader handle.");
2149         if (isValid(handle) )
2150         {
2151            uint32_t iohash;
2152            bx::read(&reader, iohash);
2153
2154            uint16_t count;
2155            bx::read(&reader, count);
2156
2157            ShaderRef& sr = m_shaderRef[handle.idx];
2158            sr.m_refCount = 1;
2159            sr.m_hash     = iohash;
2160            sr.m_num      = 0;
2161            sr.m_uniforms = NULL;
2162
2163            UniformHandle* uniforms = (UniformHandle*)alloca(count*sizeof(UniformHandle) );
2164
2165            for (uint32_t ii = 0; ii < count; ++ii)
2166            {
2167               uint8_t nameSize;
2168               bx::read(&reader, nameSize);
2169
2170               char name[256];
2171               bx::read(&reader, &name, nameSize);
2172               name[nameSize] = '\0';
2173
2174               uint8_t type;
2175               bx::read(&reader, type);
2176               type &= ~BGFX_UNIFORM_FRAGMENTBIT;
2177
2178               uint8_t num;
2179               bx::read(&reader, num);
2180
2181               uint16_t regIndex;
2182               bx::read(&reader, regIndex);
2183
2184               uint16_t regCount;
2185               bx::read(&reader, regCount);
2186
2187               PredefinedUniform::Enum predefined = nameToPredefinedUniformEnum(name);
2188               if (PredefinedUniform::Count == predefined)
2189               {
2190                  uniforms[sr.m_num] = createUniform(name, UniformType::Enum(type), regCount);
2191                  sr.m_num++;
2192               }
2193            }
2194
2195            if (0 != sr.m_num)
2196            {
2197               uint32_t size = sr.m_num*sizeof(UniformHandle);
2198               sr.m_uniforms = (UniformHandle*)BX_ALLOC(g_allocator, size);
2199               memcpy(sr.m_uniforms, uniforms, size);
2200            }
2201
2202            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateShader);
2203            cmdbuf.write(handle);
2204            cmdbuf.write(_mem);
2205         }
2206
2207         return handle;
2208      }
2209
2210      BGFX_API_FUNC(uint16_t getShaderUniforms(ShaderHandle _handle, UniformHandle* _uniforms, uint16_t _max) )
2211      {
2212         if (!isValid(_handle) )
2213         {
2214            BX_WARN(false, "Passing invalid shader handle to bgfx::getShaderUniforms.");
2215            return 0;
2216         }
2217
2218         ShaderRef& sr = m_shaderRef[_handle.idx];
2219         if (NULL != _uniforms)
2220         {
2221            memcpy(_uniforms, sr.m_uniforms, bx::uint16_min(_max, sr.m_num)*sizeof(UniformHandle) );
2222         }
2223
2224         return sr.m_num;
2225      }
2226
2227      BGFX_API_FUNC(void destroyShader(ShaderHandle _handle) )
2228      {
2229         if (!isValid(_handle) )
2230         {
2231            BX_WARN(false, "Passing invalid shader handle to bgfx::destroyShader.");
2232            return;
2233         }
2234
2235         shaderDecRef(_handle);
2236      }
2237
2238      void shaderIncRef(ShaderHandle _handle)
2239      {
2240         ShaderRef& sr = m_shaderRef[_handle.idx];
2241         ++sr.m_refCount;
2242      }
2243
2244      void shaderDecRef(ShaderHandle _handle)
2245      {
2246         ShaderRef& sr = m_shaderRef[_handle.idx];
2247         int32_t refs = --sr.m_refCount;
2248         if (0 == refs)
2249         {
2250            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyShader);
2251            cmdbuf.write(_handle);
2252            m_submit->free(_handle);
2253
2254            if (0 != sr.m_num)
2255            {
2256               for (uint32_t ii = 0, num = sr.m_num; ii < num; ++ii)
2257               {
2258                  destroyUniform(sr.m_uniforms[ii]);
2259               }
2260
2261               BX_FREE(g_allocator, sr.m_uniforms);
2262               sr.m_uniforms = NULL;
2263               sr.m_num = 0;
2264            }
2265         }
2266      }
2267
2268      BGFX_API_FUNC(ProgramHandle createProgram(ShaderHandle _vsh, ShaderHandle _fsh) )
2269      {
2270         if (!isValid(_vsh)
2271         ||  !isValid(_fsh) )
2272         {
2273            BX_WARN(false, "Vertex/fragment shader is invalid (vsh %d, fsh %d).", _vsh.idx, _fsh.idx);
2274            ProgramHandle invalid = BGFX_INVALID_HANDLE;
2275            return invalid;
2276         }
2277
2278         const ShaderRef& vsr = m_shaderRef[_vsh.idx];
2279         const ShaderRef& fsr = m_shaderRef[_fsh.idx];
2280         if (vsr.m_hash != fsr.m_hash)
2281         {
2282            BX_WARN(vsr.m_hash == fsr.m_hash, "Vertex shader output doesn't match fragment shader input.");
2283            ProgramHandle invalid = BGFX_INVALID_HANDLE;
2284            return invalid;
2285         }
2286
2287         ProgramHandle handle;
2288          handle.idx = m_programHandle.alloc();
2289
2290         BX_WARN(isValid(handle), "Failed to allocate program handle.");
2291         if (isValid(handle) )
2292         {
2293            shaderIncRef(_vsh);
2294            shaderIncRef(_fsh);
2295            m_programRef[handle.idx].m_vsh = _vsh;
2296            m_programRef[handle.idx].m_fsh = _fsh;
2297
2298            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateProgram);
2299            cmdbuf.write(handle);
2300            cmdbuf.write(_vsh);
2301            cmdbuf.write(_fsh);
2302         }
2303
2304         return handle;
2305      }
2306
2307      BGFX_API_FUNC(ProgramHandle createProgram(ShaderHandle _vsh) )
2308      {
2309         if (!isValid(_vsh) )
2310         {
2311            BX_WARN(false, "Vertex/fragment shader is invalid (vsh %d).", _vsh.idx);
2312            ProgramHandle invalid = BGFX_INVALID_HANDLE;
2313            return invalid;
2314         }
2315
2316         ProgramHandle handle;
2317         handle.idx = m_programHandle.alloc();
2318
2319         BX_WARN(isValid(handle), "Failed to allocate program handle.");
2320         if (isValid(handle) )
2321         {
2322            shaderIncRef(_vsh);
2323            m_programRef[handle.idx].m_vsh = _vsh;
2324
2325            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateProgram);
2326            cmdbuf.write(handle);
2327            cmdbuf.write(_vsh);
2328
2329            ShaderHandle invalid = BGFX_INVALID_HANDLE;
2330            cmdbuf.write(invalid);
2331         }
2332
2333         return handle;
2334      }
2335
2336      BGFX_API_FUNC(void destroyProgram(ProgramHandle _handle) )
2337      {
2338         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyProgram);
2339         cmdbuf.write(_handle);
2340         m_submit->free(_handle);
2341
2342         shaderDecRef(m_programRef[_handle.idx].m_vsh);
2343         shaderDecRef(m_programRef[_handle.idx].m_fsh);
2344      }
2345
2346      BGFX_API_FUNC(TextureHandle createTexture(const Memory* _mem, uint32_t _flags, uint8_t _skip, TextureInfo* _info) )
2347      {
2348         if (NULL != _info)
2349         {
2350            ImageContainer imageContainer;
2351            if (imageParse(imageContainer, _mem->data, _mem->size) )
2352            {
2353               calcTextureSize(*_info
2354                  , (uint16_t)imageContainer.m_width
2355                  , (uint16_t)imageContainer.m_height
2356                  , (uint16_t)imageContainer.m_depth
2357                  , imageContainer.m_numMips
2358                  , TextureFormat::Enum(imageContainer.m_format)
2359                  );
2360            }
2361            else
2362            {
2363               _info->format = TextureFormat::Unknown;
2364               _info->storageSize = 0;
2365               _info->width = 0;
2366               _info->height = 0;
2367               _info->depth = 0;
2368               _info->numMips = 0;
2369               _info->bitsPerPixel = 0;
2370            }
2371         }
2372
2373         TextureHandle handle = { m_textureHandle.alloc() };
2374         BX_WARN(isValid(handle), "Failed to allocate texture handle.");
2375         if (isValid(handle) )
2376         {
2377            TextureRef& ref = m_textureRef[handle.idx];
2378            ref.m_refCount = 1;
2379
2380            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateTexture);
2381            cmdbuf.write(handle);
2382            cmdbuf.write(_mem);
2383            cmdbuf.write(_flags);
2384            cmdbuf.write(_skip);
2385         }
2386
2387         return handle;
2388      }
2389
2390      BGFX_API_FUNC(void destroyTexture(TextureHandle _handle) )
2391      {
2392         if (!isValid(_handle) )
2393         {
2394            BX_WARN(false, "Passing invalid texture handle to bgfx::destroyTexture");
2395            return;
2396         }
2397
2398         textureDecRef(_handle);
2399      }
2400
2401      void textureIncRef(TextureHandle _handle)
2402      {
2403         TextureRef& ref = m_textureRef[_handle.idx];
2404         ++ref.m_refCount;
2405      }
2406
2407      void textureDecRef(TextureHandle _handle)
2408      {
2409         TextureRef& ref = m_textureRef[_handle.idx];
2410         int32_t refs = --ref.m_refCount;
2411         if (0 == refs)
2412         {
2413            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyTexture);
2414            cmdbuf.write(_handle);
2415            m_submit->free(_handle);
2416         }
2417      }
2418
2419      BGFX_API_FUNC(void updateTexture(TextureHandle _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, uint16_t _pitch, const Memory* _mem) )
2420      {
2421         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::UpdateTexture);
2422         cmdbuf.write(_handle);
2423         cmdbuf.write(_side);
2424         cmdbuf.write(_mip);
2425         Rect rect;
2426         rect.m_x = _x;
2427         rect.m_y = _y;
2428         rect.m_width = _width;
2429         rect.m_height = _height;
2430         cmdbuf.write(rect);
2431         cmdbuf.write(_z);
2432         cmdbuf.write(_depth);
2433         cmdbuf.write(_pitch);
2434         cmdbuf.write(_mem);
2435      }
2436
2437      BGFX_API_FUNC(FrameBufferHandle createFrameBuffer(uint8_t _num, TextureHandle* _handles) )
2438      {
2439         FrameBufferHandle handle = { m_frameBufferHandle.alloc() };
2440         BX_WARN(isValid(handle), "Failed to allocate render target handle.");
2441
2442         if (isValid(handle) )
2443         {
2444            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateFrameBuffer);
2445            cmdbuf.write(handle);
2446            cmdbuf.write(_num);
2447
2448            FrameBufferRef& ref = m_frameBufferRef[handle.idx];
2449            memset(ref.m_th, 0xff, sizeof(ref.m_th) );
2450            for (uint32_t ii = 0; ii < _num; ++ii)
2451            {
2452               TextureHandle handle = _handles[ii];
2453
2454               cmdbuf.write(handle);
2455
2456               ref.m_th[ii] = handle;
2457               textureIncRef(handle);
2458            }
2459         }
2460
2461         return handle;
2462      }
2463
2464      BGFX_API_FUNC(void destroyFrameBuffer(FrameBufferHandle _handle) )
2465      {
2466         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyFrameBuffer);
2467         cmdbuf.write(_handle);
2468         m_submit->free(_handle);
2469
2470         FrameBufferRef& ref = m_frameBufferRef[_handle.idx];
2471         for (uint32_t ii = 0; ii < BX_COUNTOF(ref.m_th); ++ii)
2472         {
2473            TextureHandle th = ref.m_th[ii];
2474            if (isValid(th) )
2475            {
2476               textureDecRef(th);
2477            }
2478         }
2479      }
2480
2481      BGFX_API_FUNC(UniformHandle createUniform(const char* _name, UniformType::Enum _type, uint16_t _num) )
2482      {
2483         BX_WARN(PredefinedUniform::Count == nameToPredefinedUniformEnum(_name), "%s is predefined uniform name.", _name);
2484         if (PredefinedUniform::Count != nameToPredefinedUniformEnum(_name) )
2485         {
2486            UniformHandle handle = BGFX_INVALID_HANDLE;
2487            return handle;
2488         }
2489
2490         UniformHashMap::iterator it = m_uniformHashMap.find(_name);
2491         if (it != m_uniformHashMap.end() )
2492         {
2493            UniformHandle handle = it->second;
2494            UniformRef& uniform = m_uniformRef[handle.idx];
2495
2496            uint32_t oldsize = g_uniformTypeSize[uniform.m_type];
2497            uint32_t newsize = g_uniformTypeSize[_type];
2498
2499            if (oldsize < newsize
2500            ||  uniform.m_num < _num)
2501            {
2502               uniform.m_type = oldsize < newsize ? _type : uniform.m_type;
2503               uniform.m_num  = bx::uint16_max(uniform.m_num, _num);
2504
2505               CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateUniform);
2506               cmdbuf.write(handle);
2507               cmdbuf.write(uniform.m_type);
2508               cmdbuf.write(uniform.m_num);
2509               uint8_t len = (uint8_t)strlen(_name)+1;
2510               cmdbuf.write(len);
2511               cmdbuf.write(_name, len);
2512            }
2513
2514            ++uniform.m_refCount;
2515            return handle;
2516         }
2517
2518         UniformHandle handle = { m_uniformHandle.alloc() };
2519
2520         BX_WARN(isValid(handle), "Failed to allocate uniform handle.");
2521         if (isValid(handle) )
2522         {
2523            UniformRef& uniform = m_uniformRef[handle.idx];
2524            uniform.m_refCount = 1;
2525            uniform.m_type = _type;
2526            uniform.m_num  = _num;
2527
2528            m_uniformHashMap.insert(stl::make_pair(stl::string(_name), handle) );
2529
2530            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::CreateUniform);
2531            cmdbuf.write(handle);
2532            cmdbuf.write(_type);
2533            cmdbuf.write(_num);
2534            uint8_t len = (uint8_t)strlen(_name)+1;
2535            cmdbuf.write(len);
2536            cmdbuf.write(_name, len);
2537         }
2538
2539         return handle;
2540      }
2541
2542      BGFX_API_FUNC(void destroyUniform(UniformHandle _handle) )
2543      {
2544         UniformRef& uniform = m_uniformRef[_handle.idx];
2545         BX_CHECK(uniform.m_refCount > 0, "Destroying already destroyed uniform %d.", _handle.idx);
2546         int32_t refs = --uniform.m_refCount;
2547
2548         if (0 == refs)
2549         {
2550            CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::DestroyUniform);
2551            cmdbuf.write(_handle);
2552            m_submit->free(_handle);
2553         }
2554      }
2555
2556      BGFX_API_FUNC(void saveScreenShot(const char* _filePath) )
2557      {
2558         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::SaveScreenShot);
2559         uint16_t len = (uint16_t)strlen(_filePath)+1;
2560         cmdbuf.write(len);
2561         cmdbuf.write(_filePath, len);
2562      }
2563
2564      BGFX_API_FUNC(void setViewName(uint8_t _id, const char* _name) )
2565      {
2566         CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::UpdateViewName);
2567         cmdbuf.write(_id);
2568         uint16_t len = (uint16_t)strlen(_name)+1;
2569         cmdbuf.write(len);
2570         cmdbuf.write(_name, len);
2571      }
2572
2573      BGFX_API_FUNC(void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) )
2574      {
2575         Rect& rect = m_rect[_id];
2576         rect.m_x = _x;
2577         rect.m_y = _y;
2578         rect.m_width = bx::uint16_max(_width, 1);
2579         rect.m_height = bx::uint16_max(_height, 1);
2580      }
2581
2582      BGFX_API_FUNC(void setViewRectMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) )
2583      {
2584         for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
2585         {
2586            viewMask >>= ntz;
2587            view += ntz;
2588
2589            setViewRect( (uint8_t)view, _x, _y, _width, _height);
2590         }
2591      }
2592
2593      BGFX_API_FUNC(void setViewScissor(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) )
2594      {
2595         Rect& scissor = m_scissor[_id];
2596         scissor.m_x = _x;
2597         scissor.m_y = _y;
2598         scissor.m_width = _width;
2599         scissor.m_height = _height;
2600      }
2601
2602      BGFX_API_FUNC(void setViewScissorMask(uint32_t _viewMask, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) )
2603      {
2604         for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
2605         {
2606            viewMask >>= ntz;
2607            view += ntz;
2608
2609            setViewScissor( (uint8_t)view, _x, _y, _width, _height);
2610         }
2611      }
2612
2613      BGFX_API_FUNC(void setViewClear(uint8_t _id, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) )
2614      {
2615         Clear& clear = m_clear[_id];
2616         clear.m_flags = _flags;
2617         clear.m_rgba = _rgba;
2618         clear.m_depth = _depth;
2619         clear.m_stencil = _stencil;
2620      }
2621
2622      BGFX_API_FUNC(void setViewClearMask(uint32_t _viewMask, uint8_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil) )
2623      {
2624         for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
2625         {
2626            viewMask >>= ntz;
2627            view += ntz;
2628
2629            setViewClear( (uint8_t)view, _flags, _rgba, _depth, _stencil);
2630         }
2631      }
2632
2633      BGFX_API_FUNC(void setViewSeq(uint8_t _id, bool _enabled) )
2634      {
2635         m_seqMask[_id] = _enabled ? 0xffff : 0x0;
2636      }
2637
2638      BGFX_API_FUNC(void setViewSeqMask(uint32_t _viewMask, bool _enabled) )
2639      {
2640         uint16_t mask = _enabled ? 0xffff : 0x0;
2641         for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
2642         {
2643            viewMask >>= ntz;
2644            view += ntz;
2645
2646            m_seqMask[view] = mask;
2647         }
2648      }
2649
2650      BGFX_API_FUNC(void setViewFrameBuffer(uint8_t _id, FrameBufferHandle _handle) )
2651      {
2652         m_fb[_id] = _handle;
2653      }
2654
2655      BGFX_API_FUNC(void setViewFrameBufferMask(uint32_t _viewMask, FrameBufferHandle _handle) )
2656      {
2657         for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
2658         {
2659            viewMask >>= ntz;
2660            view += ntz;
2661
2662            m_fb[view] = _handle;
2663         }
2664      }
2665
2666      BGFX_API_FUNC(void setViewTransform(uint8_t _id, const void* _view, const void* _proj) )
2667      {
2668         if (NULL != _view)
2669         {
2670            memcpy(m_view[_id].un.val, _view, sizeof(Matrix4) );
2671         }
2672         else
2673         {
2674            m_view[_id].setIdentity();
2675         }
2676
2677         if (NULL != _proj)
2678         {
2679            memcpy(m_proj[_id].un.val, _proj, sizeof(Matrix4) );
2680         }
2681         else
2682         {
2683            m_proj[_id].setIdentity();
2684         }
2685      }
2686
2687      BGFX_API_FUNC(void setViewTransformMask(uint32_t _viewMask, const void* _view, const void* _proj) )
2688      {
2689         for (uint32_t view = 0, viewMask = _viewMask, ntz = bx::uint32_cnttz(_viewMask); 0 != viewMask; viewMask >>= 1, view += 1, ntz = bx::uint32_cnttz(viewMask) )
2690         {
2691            viewMask >>= ntz;
2692            view += ntz;
2693
2694            setViewTransform( (uint8_t)view, _view, _proj);
2695         }
2696      }
2697
2698      BGFX_API_FUNC(void setMarker(const char* _marker) )
2699      {
2700         m_submit->setMarker(_marker);
2701      }
2702
2703      BGFX_API_FUNC(void setState(uint64_t _state, uint32_t _rgba) )
2704      {
2705         m_submit->setState(_state, _rgba);
2706      }
2707
2708      BGFX_API_FUNC(void setStencil(uint32_t _fstencil, uint32_t _bstencil) )
2709      {
2710         m_submit->setStencil(_fstencil, _bstencil);
2711      }
2712
2713      BGFX_API_FUNC(uint16_t setScissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height) )
2714      {
2715         return m_submit->setScissor(_x, _y, _width, _height);
2716      }
2717
2718      BGFX_API_FUNC(void setScissor(uint16_t _cache) )
2719      {
2720         m_submit->setScissor(_cache);
2721      }
2722
2723      BGFX_API_FUNC(uint32_t setTransform(const void* _mtx, uint16_t _num) )
2724      {
2725         return m_submit->setTransform(_mtx, _num);
2726      }
2727
2728      BGFX_API_FUNC(void setTransform(uint32_t _cache, uint16_t _num) )
2729      {
2730         m_submit->setTransform(_cache, _num);
2731      }
2732
2733      BGFX_API_FUNC(void setUniform(UniformHandle _handle, const void* _value, uint16_t _num) )
2734      {
2735         UniformRef& uniform = m_uniformRef[_handle.idx];
2736         BX_CHECK(uniform.m_num >= _num, "Truncated uniform update. %d (max: %d)", _num, uniform.m_num);
2737         m_submit->writeUniform(uniform.m_type, _handle, _value, bx::uint16_min(uniform.m_num, _num) );
2738      }
2739
2740      BGFX_API_FUNC(void setIndexBuffer(IndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) )
2741      {
2742         m_submit->setIndexBuffer(_handle, _firstIndex, _numIndices);
2743      }
2744
2745      BGFX_API_FUNC(void setIndexBuffer(DynamicIndexBufferHandle _handle, uint32_t _firstIndex, uint32_t _numIndices) )
2746      {
2747         m_submit->setIndexBuffer(m_dynamicIndexBuffers[_handle.idx].m_handle, _firstIndex, _numIndices);
2748      }
2749
2750      BGFX_API_FUNC(void setIndexBuffer(const TransientIndexBuffer* _tib, uint32_t _firstIndex, uint32_t _numIndices) )
2751      {
2752         m_submit->setIndexBuffer(_tib, _firstIndex, _numIndices);
2753      }
2754
2755      BGFX_API_FUNC(void setVertexBuffer(VertexBufferHandle _handle, uint32_t _numVertices, uint32_t _startVertex) )
2756      {
2757         m_submit->setVertexBuffer(_handle, _numVertices, _startVertex);
2758      }
2759
2760      BGFX_API_FUNC(void setVertexBuffer(DynamicVertexBufferHandle _handle, uint32_t _numVertices) )
2761      {
2762         m_submit->setVertexBuffer(m_dynamicVertexBuffers[_handle.idx], _numVertices);
2763      }
2764
2765      BGFX_API_FUNC(void setVertexBuffer(const TransientVertexBuffer* _tvb, uint32_t _startVertex, uint32_t _numVertices) )
2766      {
2767         m_submit->setVertexBuffer(_tvb, _startVertex, _numVertices);
2768      }
2769
2770      BGFX_API_FUNC(void setInstanceDataBuffer(const InstanceDataBuffer* _idb, uint16_t _num) )
2771      {
2772         --m_instBufferCount;
2773
2774         m_submit->setInstanceDataBuffer(_idb, _num);
2775      }
2776
2777      BGFX_API_FUNC(void setProgram(ProgramHandle _handle) )
2778      {
2779         m_submit->setProgram(_handle);
2780      }
2781
2782      BGFX_API_FUNC(void setTexture(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint32_t _flags) )
2783      {
2784         m_submit->setTexture(_stage, _sampler, _handle, _flags);
2785      }
2786
2787      BGFX_API_FUNC(void setTexture(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, uint32_t _flags) )
2788      {
2789         BX_CHECK(_attachment < g_caps.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment);
2790         TextureHandle textureHandle = BGFX_INVALID_HANDLE;
2791         if (isValid(_handle) )
2792         {
2793            textureHandle = m_frameBufferRef[_handle.idx].m_th[_attachment];
2794            BX_CHECK(isValid(textureHandle), "Frame buffer texture %d is invalid.", _attachment);
2795         }
2796
2797         m_submit->setTexture(_stage, _sampler, textureHandle, _flags);
2798      }
2799
2800      BGFX_API_FUNC(uint32_t submit(uint8_t _id, int32_t _depth) )
2801      {
2802         return m_submit->submit(_id, _depth);
2803      }
2804
2805      BGFX_API_FUNC(uint32_t submitMask(uint32_t _viewMask, int32_t _depth) )
2806      {
2807         return m_submit->submitMask(_viewMask, _depth);
2808      }
2809
2810      BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, TextureHandle _handle, uint8_t _mip, TextureFormat::Enum _format, Access::Enum _access) )
2811      {
2812         m_submit->setImage(_stage, _sampler, _handle, _mip, _format, _access);
2813      }
2814
2815      BGFX_API_FUNC(void setImage(uint8_t _stage, UniformHandle _sampler, FrameBufferHandle _handle, uint8_t _attachment, TextureFormat::Enum _format, Access::Enum _access) )
2816      {
2817         BX_CHECK(_attachment < g_caps.maxFBAttachments, "Frame buffer attachment index %d is invalid.", _attachment);
2818         TextureHandle textureHandle = BGFX_INVALID_HANDLE;
2819         if (isValid(_handle) )
2820         {
2821            textureHandle = m_frameBufferRef[_handle.idx].m_th[_attachment];
2822            BX_CHECK(isValid(textureHandle), "Frame buffer texture %d is invalid.", _attachment);
2823         }
2824
2825         setImage(_stage, _sampler, textureHandle, 0, _format, _access);
2826      }
2827
2828      BGFX_API_FUNC(uint32_t dispatch(uint8_t _id, ProgramHandle _handle, uint16_t _numX, uint16_t _numY, uint16_t _numZ) )
2829      {
2830         return m_submit->dispatch(_id, _handle, _numX, _numY, _numZ);
2831      }
2832
2833      BGFX_API_FUNC(void discard() )
2834      {
2835         m_submit->discard();
2836      }
2837
2838      BGFX_API_FUNC(uint32_t frame() );
2839
2840      void dumpViewStats();
2841      void freeDynamicBuffers();
2842      void freeAllHandles(Frame* _frame);
2843      void frameNoRenderWait();
2844      void swap();
2845
2846      // render thread
2847      bool renderFrame();
2848      void flushTextureUpdateBatch(CommandBuffer& _cmdbuf);
2849      void rendererExecCommands(CommandBuffer& _cmdbuf);
2850
2851#if BGFX_CONFIG_MULTITHREADED
2852      void gameSemPost()
2853      {
2854         m_gameSem.post();
2855      }
2856
2857      void gameSemWait()
2858      {
2859         int64_t start = bx::getHPCounter();
2860         bool ok = m_gameSem.wait();
2861         BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok);
2862         m_render->m_waitSubmit = bx::getHPCounter()-start;
2863      }
2864
2865      void renderSemPost()
2866      {
2867         m_renderSem.post();
2868      }
2869
2870      void renderSemWait()
2871      {
2872         int64_t start = bx::getHPCounter();
2873         bool ok = m_renderSem.wait();
2874         BX_CHECK(ok, "Semaphore wait failed."); BX_UNUSED(ok);
2875         m_submit->m_waitRender = bx::getHPCounter() - start;
2876      }
2877
2878      bx::Semaphore m_renderSem;
2879      bx::Semaphore m_gameSem;
2880      bx::Thread m_thread;
2881#else
2882      void gameSemPost()
2883      {
2884      }
2885
2886      void gameSemWait()
2887      {
2888      }
2889
2890      void renderSemPost()
2891      {
2892      }
2893
2894      void renderSemWait()
2895      {
2896      }
2897#endif // BGFX_CONFIG_MULTITHREADED
2898
2899      Frame m_frame[2];
2900      Frame* m_render;
2901      Frame* m_submit;
2902
2903      uint64_t m_tempKeys[BGFX_CONFIG_MAX_DRAW_CALLS];
2904      uint16_t m_tempValues[BGFX_CONFIG_MAX_DRAW_CALLS];
2905
2906      DynamicIndexBuffer m_dynamicIndexBuffers[BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS];
2907      DynamicVertexBuffer m_dynamicVertexBuffers[BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS];
2908
2909      uint16_t m_numFreeDynamicIndexBufferHandles;
2910      uint16_t m_numFreeDynamicVertexBufferHandles;
2911      DynamicIndexBufferHandle m_freeDynamicIndexBufferHandle[BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS];
2912      DynamicVertexBufferHandle m_freeDynamicVertexBufferHandle[BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS];
2913
2914      NonLocalAllocator m_dynamicIndexBufferAllocator;
2915      bx::HandleAllocT<BGFX_CONFIG_MAX_DYNAMIC_INDEX_BUFFERS> m_dynamicIndexBufferHandle;
2916      NonLocalAllocator m_dynamicVertexBufferAllocator;
2917      bx::HandleAllocT<BGFX_CONFIG_MAX_DYNAMIC_VERTEX_BUFFERS> m_dynamicVertexBufferHandle;
2918
2919      bx::HandleAllocT<BGFX_CONFIG_MAX_INDEX_BUFFERS> m_indexBufferHandle;
2920      bx::HandleAllocT<BGFX_CONFIG_MAX_VERTEX_DECLS > m_vertexDeclHandle;
2921
2922      bx::HandleAllocT<BGFX_CONFIG_MAX_VERTEX_BUFFERS> m_vertexBufferHandle;
2923      bx::HandleAllocT<BGFX_CONFIG_MAX_SHADERS> m_shaderHandle;
2924      bx::HandleAllocT<BGFX_CONFIG_MAX_PROGRAMS> m_programHandle;
2925      bx::HandleAllocT<BGFX_CONFIG_MAX_TEXTURES> m_textureHandle;
2926      bx::HandleAllocT<BGFX_CONFIG_MAX_FRAME_BUFFERS> m_frameBufferHandle;
2927      bx::HandleAllocT<BGFX_CONFIG_MAX_UNIFORMS> m_uniformHandle;
2928
2929      struct ShaderRef
2930      {
2931         UniformHandle* m_uniforms;
2932         uint32_t m_hash;
2933         int16_t  m_refCount;
2934         uint16_t m_num;
2935      };
2936     
2937      struct ProgramRef
2938      {
2939         ShaderHandle m_vsh;
2940         ShaderHandle m_fsh;
2941      };
2942
2943      struct UniformRef
2944      {
2945         UniformType::Enum m_type;
2946         uint16_t m_num;
2947         int16_t m_refCount;
2948      };
2949
2950      struct TextureRef
2951      {
2952         int16_t m_refCount;
2953      };
2954
2955      struct FrameBufferRef
2956      {
2957         TextureHandle m_th[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS];
2958      };
2959
2960      typedef stl::unordered_map<stl::string, UniformHandle> UniformHashMap;
2961      UniformHashMap m_uniformHashMap;
2962      UniformRef m_uniformRef[BGFX_CONFIG_MAX_UNIFORMS];
2963      ShaderRef m_shaderRef[BGFX_CONFIG_MAX_SHADERS];
2964      ProgramRef m_programRef[BGFX_CONFIG_MAX_PROGRAMS];
2965      TextureRef m_textureRef[BGFX_CONFIG_MAX_TEXTURES];
2966      FrameBufferRef m_frameBufferRef[BGFX_CONFIG_MAX_FRAME_BUFFERS];
2967      VertexDeclRef m_declRef;
2968
2969      FrameBufferHandle m_fb[BGFX_CONFIG_MAX_VIEWS];
2970      Clear m_clear[BGFX_CONFIG_MAX_VIEWS];
2971      Rect m_rect[BGFX_CONFIG_MAX_VIEWS];
2972      Rect m_scissor[BGFX_CONFIG_MAX_VIEWS];
2973      Matrix4 m_view[BGFX_CONFIG_MAX_VIEWS];
2974      Matrix4 m_proj[BGFX_CONFIG_MAX_VIEWS];
2975      uint16_t m_seq[BGFX_CONFIG_MAX_VIEWS];
2976      uint16_t m_seqMask[BGFX_CONFIG_MAX_VIEWS];
2977
2978      Resolution m_resolution;
2979      int32_t  m_instBufferCount;
2980      uint32_t m_frames;
2981      uint32_t m_debug;
2982
2983      TextVideoMemBlitter m_textVideoMemBlitter;
2984      ClearQuad m_clearQuad;
2985
2986      RendererContextI* m_renderCtx;
2987
2988      bool m_rendererInitialized;
2989      bool m_exit;
2990
2991      BX_CACHE_LINE_ALIGN_MARKER();
2992      typedef UpdateBatchT<256> TextureUpdateBatch;
2993      TextureUpdateBatch m_textureUpdateBatch;
2994   };
2995
2996#undef BGFX_API_FUNC
2997
2998} // namespace bgfx
2999
3000#endif // BGFX_P_H_HEADER_GUARD
Property changes on: branches/osd/src/lib/bgfx/bgfx_p.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/fs_clear0.bin.h
r0r31734
1static const uint8_t fs_clear0_glsl[91] =
2{
3   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x76, 0x61, // FSH....I..L...va
4   0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, // rying mediump ve
5   0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x6f, 0x69, // c4 v_color0;.voi
6   0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // d main ().{.  gl
7   0x5f, 0x46, 0x72, 0x61, 0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, // _FragColor = v_c
8   0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00,                               // olor0;.}...
9};
10static const uint8_t fs_clear0_dx9[137] =
11{
12   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I..|.....
13   0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#...
14   0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, // ................
15   0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro
16   0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh
17   0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9.
18   0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, // 29.952.3111.....
19   0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, // ................
20   0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00,                                           // .........
21};
22static const uint8_t fs_clear0_dx11[480] =
23{
24   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0xd0, 0x01, 0x44, 0x58, 0x42, 0x43, // FSH....I....DXBC
25   0xa9, 0x98, 0xd1, 0xdb, 0x4a, 0xa2, 0x9c, 0xfe, 0x9c, 0xf1, 0xe4, 0xd0, 0x2c, 0xa5, 0xd6, 0xb6, // ....J.......,...
26   0x01, 0x00, 0x00, 0x00, 0xd0, 0x01, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, // ............4...
27   0x8c, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x14, 0x01, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, // ............T...
28   0x52, 0x44, 0x45, 0x46, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // RDEFP...........
29   0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0xff, 0x00, 0x91, 0x00, 0x00, // ................
30   0x1c, 0x00, 0x00, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, // ....Microsoft (R
31   0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, // ) HLSL Shader Co
32   0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, // mpiler 9.29.952.
33   0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, // 3111....ISGNL...
34   0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........8.......
35   0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................
36   0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // D...............
37   0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, // ........SV_POSIT
38   0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, // ION.COLOR...OSGN
39   0x2c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, // ,........... ...
40   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
41   0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, // ....SV_TARGET...
42   0x53, 0x48, 0x44, 0x52, 0x38, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, // SHDR8...@.......
43   0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, // b...........e...
44   0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, // . ......6.... ..
45   0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, // ....F.......>...
46   0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // STATt...........
47   0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
48   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
49   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
50   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
51   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
52   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
53   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
54};
Property changes on: branches/osd/src/lib/bgfx/fs_clear0.bin.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/vs_clear.bin.h
r0r31734
1static const uint8_t vs_clear_glsl[255] =
2{
3   0x56, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x61, 0x74, // VSH....I......at
4   0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, // tribute mediump
5   0x76, 0x65, 0x63, 0x34, 0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x61, // vec4 a_color0;.a
6   0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, // ttribute mediump
7   0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x61, 0x5f, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, //  vec3 a_position
8   0x3b, 0x0a, 0x76, 0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, // ;.varying medium
9   0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, // p vec4 v_color0;
10   0x0a, 0x76, 0x6f, 0x69, 0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, // .void main ().{.
11   0x20, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, //   mediump vec4 t
12   0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, // mpvar_1;.  tmpva
13   0x72, 0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3d, 0x20, 0x31, 0x2e, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x74, // r_1.w = 1.0;.  t
14   0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x2e, 0x78, 0x79, 0x7a, 0x20, 0x3d, 0x20, 0x61, 0x5f, // mpvar_1.xyz = a_
15   0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x50, // position;.  gl_P
16   0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // osition = tmpvar
17   0x5f, 0x31, 0x3b, 0x0a, 0x20, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x20, 0x3d, // _1;.  v_color0 =
18   0x20, 0x61, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00,       //  a_color0;.}...
19};
20static const uint8_t vs_clear_dx9[217] =
21{
22   0x56, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0xcc, 0x00, 0x00, 0x03, 0xfe, 0xff, // VSH....I........
23   0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#...
24   0x00, 0x03, 0xfe, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, // ................
25   0x1c, 0x00, 0x00, 0x00, 0x76, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....vs_3_0.Micro
26   0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh
27   0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9.
28   0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, // 29.952.3111.Q...
29   0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // .......?........
30   0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, // ................
31   0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................
32   0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, // ................
33   0x01, 0x00, 0x0f, 0xe0, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0xe0, 0x01, 0x00, 0x24, 0x90, // ..............$.
34   0x00, 0x00, 0x40, 0xa0, 0x00, 0x00, 0x15, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0xe0, // ..@.............
35   0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00,                                           // .........
36};
37static const uint8_t vs_clear_dx11[580] =
38{
39   0x56, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x30, 0x02, 0x44, 0x58, 0x42, 0x43, // VSH....I..0.DXBC
40   0x04, 0xac, 0x6e, 0xb3, 0xfa, 0xa6, 0xc0, 0x40, 0x10, 0xce, 0x75, 0xe7, 0xa0, 0x24, 0xd6, 0x56, // ..n....@..u..$.V
41   0x01, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, // ....0.......4...
42   0x8c, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0xb4, 0x01, 0x00, 0x00, // ........0.......
43   0x52, 0x44, 0x45, 0x46, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // RDEFP...........
44   0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xfe, 0xff, 0x00, 0x91, 0x00, 0x00, // ................
45   0x1c, 0x00, 0x00, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, // ....Microsoft (R
46   0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, // ) HLSL Shader Co
47   0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, // mpiler 9.29.952.
48   0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x48, 0x00, 0x00, 0x00, // 3111....ISGNH...
49   0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........8.......
50   0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, // ................
51   0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // >...............
52   0x01, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x50, 0x4f, // ........COLOR.PO
53   0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, // SITION..OSGNL...
54   0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........8.......
55   0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................
56   0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // D...............
57   0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, // ........SV_POSIT
58   0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, // ION.COLOR...SHDR
59   0x7c, 0x00, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, // |...@......._...
60   0xf2, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5f, 0x00, 0x00, 0x03, 0x72, 0x10, 0x10, 0x00, // ........_...r...
61   0x01, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....g.... ......
62   0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....e.... ......
63   0x36, 0x00, 0x00, 0x05, 0x72, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x12, 0x10, 0x00, // 6...r ......F...
64   0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x82, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....6.... ......
65   0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, // .@.....?6.... ..
66   0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, // ....F.......>...
67   0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // STATt...........
68   0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
69   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
70   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
71   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
72   0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
73   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
74   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x05, 0x00, // ................
75   0x01, 0x00, 0x00, 0x00,                                                                         // ....
76};
Property changes on: branches/osd/src/lib/bgfx/vs_clear.bin.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/fs_clear1.bin.h
r0r31734
1static const uint8_t fs_clear1_glsl[122] =
2{
3   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x6b, 0x00, 0x00, 0x00, 0x76, 0x61, // FSH....I..k...va
4   0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, // rying mediump ve
5   0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x6f, 0x69, // c4 v_color0;.voi
6   0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // d main ().{.  gl
7   0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5b, 0x30, 0x5d, 0x20, 0x3d, 0x20, 0x76, // _FragData[0] = v
8   0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // _color0;.  gl_Fr
9   0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5b, 0x31, 0x5d, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, // agData[1] = v_co
10   0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00,                                     // lor0;.}...
11};
12static const uint8_t fs_clear1_dx9[149] =
13{
14   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x88, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I........
15   0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#...
16   0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, // ................
17   0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro
18   0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh
19   0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9.
20   0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, // 29.952.3111.....
21   0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, // ................
22   0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, // ................
23   0xff, 0xff, 0x00, 0x00, 0x00,                                                                   // .....
24};
25static const uint8_t fs_clear1_dx11[536] =
26{
27   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x08, 0x02, 0x44, 0x58, 0x42, 0x43, // FSH....I....DXBC
28   0x07, 0x29, 0x65, 0xce, 0x1c, 0xcc, 0xcb, 0x0a, 0x31, 0xfd, 0xe4, 0xfc, 0xc8, 0x95, 0x4a, 0x88, // .)e.....1.....J.
29   0x01, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, // ............4...
30   0x8c, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x2c, 0x01, 0x00, 0x00, 0x8c, 0x01, 0x00, 0x00, // ........,.......
31   0x52, 0x44, 0x45, 0x46, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // RDEFP...........
32   0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0xff, 0x00, 0x91, 0x00, 0x00, // ................
33   0x1c, 0x00, 0x00, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, // ....Microsoft (R
34   0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, // ) HLSL Shader Co
35   0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, // mpiler 9.29.952.
36   0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, // 3111....ISGNL...
37   0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........8.......
38   0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................
39   0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // D...............
40   0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, // ........SV_POSIT
41   0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, // ION.COLOR...OSGN
42   0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, // D...........8...
43   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
44   0x0f, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....8...........
45   0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, // ............SV_T
46   0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x58, 0x00, 0x00, 0x00, // ARGET...SHDRX...
47   0x40, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, // @.......b.......
48   0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ......
49   0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, // e.... ......6...
50   0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // . ......F.......
51   0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, // 6.... ......F...
52   0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00, // ....>...STATt...
53   0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // ................
54   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................
55   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
56   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
57   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
58   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
59   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
60   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                 // ........
61};
Property changes on: branches/osd/src/lib/bgfx/fs_clear1.bin.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/fs_clear2.bin.h
r0r31734
1static const uint8_t fs_clear2_glsl[151] =
2{
3   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x76, 0x61, // FSH....I......va
4   0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, // rying mediump ve
5   0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x6f, 0x69, // c4 v_color0;.voi
6   0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // d main ().{.  gl
7   0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5b, 0x30, 0x5d, 0x20, 0x3d, 0x20, 0x76, // _FragData[0] = v
8   0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // _color0;.  gl_Fr
9   0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5b, 0x31, 0x5d, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, // agData[1] = v_co
10   0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // lor0;.  gl_FragD
11   0x61, 0x74, 0x61, 0x5b, 0x32, 0x5d, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ata[2] = v_color
12   0x30, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00,                                                       // 0;.}...
13};
14static const uint8_t fs_clear2_dx9[161] =
15{
16   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x94, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I........
17   0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#...
18   0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, // ................
19   0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro
20   0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh
21   0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9.
22   0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, // 29.952.3111.....
23   0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, // ................
24   0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, // ................
25   0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, // ................
26   0x00,                                                                                           // .
27};
28static const uint8_t fs_clear2_dx11[592] =
29{
30   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x40, 0x02, 0x44, 0x58, 0x42, 0x43, // FSH....I..@.DXBC
31   0xdf, 0xef, 0x73, 0x33, 0x5f, 0x1a, 0xe9, 0x7a, 0xc5, 0xf8, 0x6b, 0x15, 0x61, 0x87, 0xb5, 0x29, // ..s3_..z..k.a..)
32   0x01, 0x00, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, // ....@.......4...
33   0x8c, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x44, 0x01, 0x00, 0x00, 0xc4, 0x01, 0x00, 0x00, // ........D.......
34   0x52, 0x44, 0x45, 0x46, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // RDEFP...........
35   0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0xff, 0x00, 0x91, 0x00, 0x00, // ................
36   0x1c, 0x00, 0x00, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, // ....Microsoft (R
37   0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, // ) HLSL Shader Co
38   0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, // mpiler 9.29.952.
39   0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, // 3111....ISGNL...
40   0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........8.......
41   0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................
42   0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // D...............
43   0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, // ........SV_POSIT
44   0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, // ION.COLOR...OSGN
45   0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, // ............P...
46   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
47   0x0f, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....P...........
48   0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, // ............P...
49   0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
50   0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, // ....SV_TARGET...
51   0x53, 0x48, 0x44, 0x52, 0x78, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, // SHDRx...@.......
52   0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, // b...........e...
53   0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, // . ......e.... ..
54   0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ....e.... ......
55   0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, // 6.... ......F...
56   0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ....6.... ......
57   0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, // F.......6.... ..
58   0x02, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, // ....F.......>...
59   0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // STATt...........
60   0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
61   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
62   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
63   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
64   0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
65   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
66   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
67};
Property changes on: branches/osd/src/lib/bgfx/fs_clear2.bin.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/fs_clear3.bin.h
r0r31734
1static const uint8_t fs_clear3_glsl[180] =
2{
3   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0xa5, 0x00, 0x00, 0x00, 0x76, 0x61, // FSH....I......va
4   0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, // rying mediump ve
5   0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x6f, 0x69, // c4 v_color0;.voi
6   0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x67, 0x6c, // d main ().{.  gl
7   0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5b, 0x30, 0x5d, 0x20, 0x3d, 0x20, 0x76, // _FragData[0] = v
8   0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, // _color0;.  gl_Fr
9   0x61, 0x67, 0x44, 0x61, 0x74, 0x61, 0x5b, 0x31, 0x5d, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, // agData[1] = v_co
10   0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, // lor0;.  gl_FragD
11   0x61, 0x74, 0x61, 0x5b, 0x32, 0x5d, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, // ata[2] = v_color
12   0x30, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, 0x67, 0x44, 0x61, 0x74, 0x61, // 0;.  gl_FragData
13   0x5b, 0x33, 0x5d, 0x20, 0x3d, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, // [3] = v_color0;.
14   0x7d, 0x0a, 0x0a, 0x00,                                                                         // }...
15};
16static const uint8_t fs_clear3_dx9[173] =
17{
18   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0xa0, 0x00, 0x00, 0x03, 0xff, 0xff, // FSH....I........
19   0xfe, 0xff, 0x16, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, // ....CTAB....#...
20   0x00, 0x03, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, // ................
21   0x1c, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro
22   0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh
23   0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9.
24   0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x1f, 0x00, 0x00, 0x02, // 29.952.3111.....
25   0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, 0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, // ................
26   0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, 0x01, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, // ................
27   0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, 0x01, 0x00, 0x00, 0x02, // ................
28   0x03, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x90, 0xff, 0xff, 0x00, 0x00, 0x00,                   // .............
29};
30static const uint8_t fs_clear3_dx11[648] =
31{
32   0x46, 0x53, 0x48, 0x03, 0xa4, 0x8b, 0xef, 0x49, 0x00, 0x00, 0x78, 0x02, 0x44, 0x58, 0x42, 0x43, // FSH....I..x.DXBC
33   0xec, 0x65, 0x4d, 0xe1, 0x28, 0x13, 0xaf, 0x45, 0xea, 0x5d, 0x5d, 0xcc, 0x29, 0xb7, 0xa4, 0x45, // .eM.(..E.]].)..E
34   0x01, 0x00, 0x00, 0x00, 0x78, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, // ....x.......4...
35   0x8c, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x5c, 0x01, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, // ................
36   0x52, 0x44, 0x45, 0x46, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // RDEFP...........
37   0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0xff, 0x00, 0x91, 0x00, 0x00, // ................
38   0x1c, 0x00, 0x00, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, // ....Microsoft (R
39   0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, // ) HLSL Shader Co
40   0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, // mpiler 9.29.952.
41   0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, // 3111....ISGNL...
42   0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........8.......
43   0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................
44   0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, // D...............
45   0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, 0x4f, 0x53, 0x49, 0x54, // ........SV_POSIT
46   0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0xab, 0xab, 0x4f, 0x53, 0x47, 0x4e, // ION.COLOR...OSGN
47   0x74, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, // t...........h...
48   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
49   0x0f, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....h...........
50   0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, // ............h...
51   0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
52   0x0f, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....h...........
53   0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x54, // ............SV_T
54   0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, 0x98, 0x00, 0x00, 0x00, // ARGET...SHDR....
55   0x40, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, // @...&...b.......
56   0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....e.... ......
57   0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, // e.... ......e...
58   0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00, // . ......e.... ..
59   0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....6.... ......
60   0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, // F.......6.... ..
61   0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, // ....F.......6...
62   0xf2, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // . ......F.......
63   0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x00, // 6.... ......F...
64   0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00, // ....>...STATt...
65   0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ................
66   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................
67   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
68   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
69   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................
70   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
71   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
72   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                 // ........
73};
Property changes on: branches/osd/src/lib/bgfx/fs_clear3.bin.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_nsgl.mm
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7
8#if BX_PLATFORM_OSX && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)
9#   include "renderer_gl.h"
10#   include <Cocoa/Cocoa.h>
11#   include <bx/os.h>
12
13namespace bgfx
14{
15
16#   define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
17#   include "glimports.h"
18   
19   static void* s_opengl = NULL;
20
21   void GlContext::create(uint32_t _width, uint32_t _height)
22   {
23      BX_UNUSED(_width, _height);
24
25      s_opengl = bx::dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL");
26      BX_CHECK(NULL != s_opengl, "OpenGL dynamic library is not found!");
27
28      NSWindow* nsWindow = (NSWindow*)g_bgfxNSWindow;
29
30      NSOpenGLPixelFormatAttribute profile =
31#if BGFX_CONFIG_RENDERER_OPENGL >= 31
32         NSOpenGLProfileVersion3_2Core
33#else
34         NSOpenGLProfileVersionLegacy
35#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
36         ;
37
38      NSOpenGLPixelFormatAttribute pixelFormatAttributes[] = {
39         NSOpenGLPFAOpenGLProfile, profile,
40         NSOpenGLPFAColorSize,     24,
41         NSOpenGLPFAAlphaSize,     8,
42         NSOpenGLPFADepthSize,     24,
43         NSOpenGLPFAStencilSize,   8,
44         NSOpenGLPFADoubleBuffer,  true,
45         NSOpenGLPFAAccelerated,   true,
46         NSOpenGLPFANoRecovery,    true,
47         0,                        0,
48      };
49
50      NSOpenGLPixelFormat* pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:pixelFormatAttributes];
51      BGFX_FATAL(NULL != pixelFormat, Fatal::UnableToInitialize, "Failed to initialize pixel format.");
52
53      NSRect glViewRect = [[nsWindow contentView] bounds];
54      NSOpenGLView* glView = [[NSOpenGLView alloc] initWithFrame:glViewRect pixelFormat:pixelFormat];
55     
56      [pixelFormat release];
57      [nsWindow setContentView:glView];
58     
59      NSOpenGLContext* glContext = [glView openGLContext];
60      BGFX_FATAL(NULL != glContext, Fatal::UnableToInitialize, "Failed to initialize GL context.");
61
62      [glContext makeCurrentContext];
63      GLint interval = 0;
64      [glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
65     
66      m_view    = glView;
67      m_context = glContext;
68
69      import();
70   }
71
72   void GlContext::destroy()
73   {
74      NSOpenGLView* glView = (NSOpenGLView*)m_view;
75      m_view = 0;
76      m_context = 0;
77      [glView release];
78
79      bx::dlclose(s_opengl);
80   }
81
82   void GlContext::resize(uint32_t _width, uint32_t _height, bool _vsync)
83   {
84      BX_UNUSED(_width, _height, _vsync);
85
86      GLint interval = _vsync ? 1 : 0;
87      NSOpenGLContext* glContext = (NSOpenGLContext*)m_context;
88      [glContext setValues:&interval forParameter:NSOpenGLCPSwapInterval];
89   }
90
91   void GlContext::swap()
92   {
93      NSOpenGLContext* glContext = (NSOpenGLContext*)m_context;
94      [glContext makeCurrentContext];
95      [glContext flushBuffer];
96   }
97
98   void GlContext::import()
99   {
100      BX_TRACE("Import:");
101#   define GL_EXTENSION(_optional, _proto, _func, _import) \
102            { \
103               if (_func == NULL) \
104               { \
105                  _func = (_proto)bx::dlsym(s_opengl, #_import); \
106                  BX_TRACE("%p " #_func " (" #_import ")", _func); \
107               } \
108               BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. NSGLGetProcAddress(\"%s\")", #_import); \
109            }
110#   include "glimports.h"
111   }
112
113} // namespace bgfx
114
115#endif // BX_PLATFORM_OSX && (BGFX_CONFIG_RENDERER_OPENGLES2|BGFX_CONFIG_RENDERER_OPENGLES3|BGFX_CONFIG_RENDERER_OPENGL)
Property changes on: branches/osd/src/lib/bgfx/glcontext_nsgl.mm
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/glcontext_glx.cpp
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7
8#if (BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD) && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
9#   include "renderer_gl.h"
10#   define GLX_GLXEXT_PROTOTYPES
11#   include <glx/glxext.h>
12
13namespace bgfx
14{
15   typedef int (*PFNGLXSWAPINTERVALMESAPROC)(uint32_t _interval);
16
17   PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB;
18   PFNGLXSWAPINTERVALEXTPROC glXSwapIntervalEXT;
19   PFNGLXSWAPINTERVALMESAPROC glXSwapIntervalMESA;
20   PFNGLXSWAPINTERVALSGIPROC glXSwapIntervalSGI;
21
22#   define GL_IMPORT(_optional, _proto, _func, _import) _proto _func
23#   include "glimports.h"
24
25   static ::Display* s_display;
26   static ::Window s_window;
27
28   void x11SetDisplayWindow(::Display* _display, ::Window _window)
29   {
30      s_display = _display;
31      s_window = _window;
32   }
33
34   void GlContext::create(uint32_t _width, uint32_t _height)
35   {
36      BX_UNUSED(_width, _height);
37      XLockDisplay(s_display);
38
39      int major, minor;
40      bool version = glXQueryVersion(s_display, &major, &minor);
41      BGFX_FATAL(version, Fatal::UnableToInitialize, "Failed to query GLX version");
42      BGFX_FATAL( (major == 1 && minor >= 2) || major > 1
43            , Fatal::UnableToInitialize
44            , "GLX version is not >=1.2 (%d.%d)."
45            , major
46            , minor
47            );
48
49      int32_t screen = DefaultScreen(s_display);
50
51      const char* extensions = glXQueryExtensionsString(s_display, screen);
52      BX_TRACE("GLX extensions:");
53      dumpExtensions(extensions);
54
55      const int attrsGlx[] =
56      {
57         GLX_RENDER_TYPE, GLX_RGBA_BIT,
58         GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
59         GLX_DOUBLEBUFFER, true,
60         GLX_RED_SIZE, 8,
61         GLX_BLUE_SIZE, 8,
62         GLX_GREEN_SIZE, 8,
63//         GLX_ALPHA_SIZE, 8,
64         GLX_DEPTH_SIZE, 24,
65         GLX_STENCIL_SIZE, 8,
66         0,
67      };
68
69      // Find suitable config
70      GLXFBConfig bestConfig = NULL;
71
72      int numConfigs;
73      GLXFBConfig* configs = glXChooseFBConfig(s_display, screen, attrsGlx, &numConfigs);
74
75      BX_TRACE("glX num configs %d", numConfigs);
76
77      XVisualInfo* visualInfo = NULL;
78      for (int ii = 0; ii < numConfigs; ++ii)
79      {
80         visualInfo = glXGetVisualFromFBConfig(s_display, configs[ii]);
81         if (NULL != visualInfo)
82         {
83            BX_TRACE("---");
84            bool valid = true;
85            for (uint32_t attr = 6; attr < BX_COUNTOF(attrsGlx)-1 && attrsGlx[attr] != None; attr += 2)
86            {
87               int value;
88               glXGetFBConfigAttrib(s_display, configs[ii], attrsGlx[attr], &value);
89               BX_TRACE("glX %d/%d %2d: %4x, %8x (%8x%s)"
90                     , ii
91                     , numConfigs
92                     , attr/2
93                     , attrsGlx[attr]
94                     , value
95                     , attrsGlx[attr + 1]
96                     , value < attrsGlx[attr + 1] ? " *" : ""
97                     );
98
99               if (value < attrsGlx[attr + 1])
100               {
101                  valid = false;
102#if !BGFX_CONFIG_DEBUG
103                  break;
104#endif // BGFX_CONFIG_DEBUG
105               }
106            }
107
108            if (valid)
109            {
110               bestConfig = configs[ii];
111               BX_TRACE("Best config %d.", ii);
112               break;
113            }
114         }
115
116         XFree(visualInfo);
117         visualInfo = NULL;
118      }
119
120      XFree(configs);
121      BGFX_FATAL(visualInfo, Fatal::UnableToInitialize, "Failed to find a suitable X11 display configuration.");
122
123      BX_TRACE("Create GL 2.1 context.");
124      m_context = glXCreateContext(s_display, visualInfo, 0, GL_TRUE);
125      BGFX_FATAL(NULL != m_context, Fatal::UnableToInitialize, "Failed to create GL 2.1 context.");
126
127      XFree(visualInfo);
128
129#if BGFX_CONFIG_RENDERER_OPENGL >= 31
130      glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress( (const GLubyte*)"glXCreateContextAttribsARB");
131
132      if (NULL != glXCreateContextAttribsARB)
133      {
134         BX_TRACE("Create GL 3.1 context.");
135         const int contextAttrs[] =
136         {
137            GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
138            GLX_CONTEXT_MINOR_VERSION_ARB, 1,
139            GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
140            0,
141         };
142
143         GLXContext context = glXCreateContextAttribsARB(s_display, bestConfig, 0, true, contextAttrs);
144
145         if (NULL != context)
146         {
147            glXDestroyContext(s_display, m_context);
148            m_context = context;
149         }
150      }
151#else
152      BX_UNUSED(bestConfig);
153#endif // BGFX_CONFIG_RENDERER_OPENGL >= 31
154
155      XUnlockDisplay(s_display);
156
157      import();
158
159      glXMakeCurrent(s_display, s_window, m_context);
160
161      glXSwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)glXGetProcAddress( (const GLubyte*)"glXSwapIntervalEXT");
162      if (NULL != glXSwapIntervalEXT)
163      {
164         BX_TRACE("Using glXSwapIntervalEXT.");
165         glXSwapIntervalEXT(s_display, s_window, 0);
166      }
167      else
168      {
169         glXSwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)glXGetProcAddress( (const GLubyte*)"glXSwapIntervalMESA");
170         if (NULL != glXSwapIntervalMESA)
171         {
172            BX_TRACE("Using glXSwapIntervalMESA.");
173            glXSwapIntervalMESA(0);
174         }
175         else
176         {
177            glXSwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)glXGetProcAddress( (const GLubyte*)"glXSwapIntervalSGI");
178            if (NULL != glXSwapIntervalSGI)
179            {
180               BX_TRACE("Using glXSwapIntervalSGI.");
181               glXSwapIntervalSGI(0);
182            }
183         }
184      }
185
186      glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
187      glClear(GL_COLOR_BUFFER_BIT);
188      glXSwapBuffers(s_display, s_window);
189   }
190
191   void GlContext::destroy()
192   {
193      glXMakeCurrent(s_display, 0, 0);
194      glXDestroyContext(s_display, m_context);
195   }
196
197   void GlContext::resize(uint32_t /*_width*/, uint32_t /*_height*/, bool _vsync)
198   {
199      int32_t interval = _vsync ? 1 : 0;
200
201      if (NULL != glXSwapIntervalEXT)
202      {
203         glXSwapIntervalEXT(s_display, s_window, interval);
204      }
205      else if (NULL != glXSwapIntervalMESA)
206      {
207         glXSwapIntervalMESA(interval);
208      }
209      else if (NULL != glXSwapIntervalSGI)
210      {
211         glXSwapIntervalSGI(interval);
212      }
213   }
214
215   void GlContext::swap()
216   {
217      glXSwapBuffers(s_display, s_window);
218   }
219
220   void GlContext::import()
221   {
222#   define GL_EXTENSION(_optional, _proto, _func, _import) \
223            { \
224               if (NULL == _func) \
225               { \
226                  _func = (_proto)glXGetProcAddress( (const GLubyte*)#_import); \
227                  BX_TRACE("%p " #_func " (" #_import ")", _func); \
228                  BGFX_FATAL(_optional || NULL != _func, Fatal::UnableToInitialize, "Failed to create OpenGL context. glXGetProcAddress %s", #_import); \
229               } \
230            }
231#   include "glimports.h"
232   }
233
234} // namespace bgfx
235
236#endif // (BX_PLATFORM_LINUX || BX_PLATFORM_FREEBSD) && (BGFX_CONFIG_RENDERER_OPENGLES || BGFX_CONFIG_RENDERER_OPENGL)
Property changes on: branches/osd/src/lib/bgfx/glcontext_glx.cpp
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/fs_debugfont.bin.h
r0r31734
1static const uint8_t fs_debugfont_glsl[359] =
2{
3   0x46, 0x53, 0x48, 0x03, 0xb8, 0xbe, 0x22, 0x66, 0x01, 0x00, 0x0a, 0x75, 0x5f, 0x74, 0x65, 0x78, // FSH..."f...u_tex
4   0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x47, 0x01, 0x00, 0x00, 0x76, // Color......G...v
5   0x61, 0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, // arying mediump v
6   0x65, 0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x3b, 0x0a, 0x76, 0x61, // ec4 v_color0;.va
7   0x72, 0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, // rying mediump ve
8   0x63, 0x34, 0x20, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x3b, 0x0a, 0x76, 0x61, 0x72, // c4 v_color1;.var
9   0x79, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x20, 0x76, 0x65, 0x63, // ying mediump vec
10   0x32, 0x20, 0x76, 0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x3b, 0x0a, 0x75, // 2 v_texcoord0;.u
11   0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x73, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x32, 0x44, // niform sampler2D
12   0x20, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x76, 0x6f, 0x69, //  u_texColor;.voi
13   0x64, 0x20, 0x6d, 0x61, 0x69, 0x6e, 0x20, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20, 0x6c, 0x6f, // d main ().{.  lo
14   0x77, 0x70, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, // wp vec4 tmpvar_1
15   0x3b, 0x0a, 0x20, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, 0x31, 0x20, 0x3d, 0x20, 0x6d, // ;.  tmpvar_1 = m
16   0x69, 0x78, 0x20, 0x28, 0x76, 0x5f, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x31, 0x2c, 0x20, 0x76, 0x5f, // ix (v_color1, v_
17   0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x30, 0x2c, 0x20, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x32, // color0, texture2
18   0x44, 0x20, 0x28, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x76, // D (u_texColor, v
19   0x5f, 0x74, 0x65, 0x78, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x30, 0x29, 0x2e, 0x78, 0x78, 0x78, 0x78, // _texcoord0).xxxx
20   0x29, 0x3b, 0x0a, 0x20, 0x20, 0x69, 0x66, 0x20, 0x28, 0x28, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, // );.  if ((tmpvar
21   0x5f, 0x31, 0x2e, 0x77, 0x20, 0x3c, 0x20, 0x30, 0x2e, 0x30, 0x30, 0x33, 0x39, 0x32, 0x31, 0x35, // _1.w < 0.0039215
22   0x37, 0x29, 0x29, 0x20, 0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x64, 0x69, 0x73, 0x63, 0x61, 0x72, // 7)) {.    discar
23   0x64, 0x3b, 0x0a, 0x20, 0x20, 0x7d, 0x3b, 0x0a, 0x20, 0x20, 0x67, 0x6c, 0x5f, 0x46, 0x72, 0x61, // d;.  };.  gl_Fra
24   0x67, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x74, 0x6d, 0x70, 0x76, 0x61, 0x72, 0x5f, // gColor = tmpvar_
25   0x31, 0x3b, 0x0a, 0x7d, 0x0a, 0x0a, 0x00,                                                       // 1;.}...
26};
27static const uint8_t fs_debugfont_dx9[353] =
28{
29   0x46, 0x53, 0x48, 0x03, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x54, 0x01, 0x00, 0x03, 0xff, 0xff, // FSH..."f..T.....
30   0xfe, 0xff, 0x22, 0x00, 0x43, 0x54, 0x41, 0x42, 0x1c, 0x00, 0x00, 0x00, 0x53, 0x00, 0x00, 0x00, // ..".CTAB....S...
31   0x00, 0x03, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, // ................
32   0x4c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, // L...0...........
33   0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, // <.......u_texCol
34   0x6f, 0x72, 0x00, 0xab, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, // or..............
35   0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x33, 0x5f, 0x30, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, // ....ps_3_0.Micro
36   0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, // soft (R) HLSL Sh
37   0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, // ader Compiler 9.
38   0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0x51, 0x00, 0x00, 0x05, // 29.952.3111.Q...
39   0x00, 0x00, 0x0f, 0xa0, 0x81, 0x80, 0x80, 0xbb, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0xbf, // ................
40   0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0f, 0x90, // ................
41   0x1f, 0x00, 0x00, 0x02, 0x0a, 0x00, 0x01, 0x80, 0x01, 0x00, 0x0f, 0x90, 0x1f, 0x00, 0x00, 0x02, // ................
42   0x05, 0x00, 0x00, 0x80, 0x02, 0x00, 0x03, 0x90, 0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, // ................
43   0x00, 0x08, 0x0f, 0xa0, 0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x02, 0x00, 0xe4, 0x90, // ....B...........
44   0x00, 0x08, 0xe4, 0xa0, 0x01, 0x00, 0x00, 0x02, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x90, // ................
45   0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0xe4, 0x81, 0x00, 0x00, 0xe4, 0x90, // ................
46   0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0xe4, 0x80, // ................
47   0x01, 0x00, 0xe4, 0x90, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x80, 0x00, 0x00, 0xff, 0x80, // ................
48   0x00, 0x00, 0x00, 0xa0, 0x58, 0x00, 0x00, 0x04, 0x01, 0x00, 0x0f, 0x80, 0x01, 0x00, 0x00, 0x80, // ....X...........
49   0x00, 0x00, 0x55, 0xa0, 0x00, 0x00, 0xaa, 0xa0, 0x41, 0x00, 0x00, 0x01, 0x01, 0x00, 0x0f, 0x80, // ..U.....A.......
50   0x01, 0x00, 0x00, 0x02, 0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00, // ................
51   0x00,                                                                                           // .
52};
53static const uint8_t fs_debugfont_dx11[856] =
54{
55   0x46, 0x53, 0x48, 0x03, 0xb8, 0xbe, 0x22, 0x66, 0x00, 0x00, 0x48, 0x03, 0x44, 0x58, 0x42, 0x43, // FSH..."f..H.DXBC
56   0xa5, 0x4a, 0xda, 0x47, 0x04, 0x25, 0xa7, 0xd3, 0xbb, 0x09, 0x30, 0x0f, 0x56, 0xae, 0xf7, 0xbe, // .J.G.%....0.V...
57   0x01, 0x00, 0x00, 0x00, 0x48, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, // ....H.......4...
58   0x00, 0x01, 0x00, 0x00, 0x8c, 0x01, 0x00, 0x00, 0xc0, 0x01, 0x00, 0x00, 0xcc, 0x02, 0x00, 0x00, // ................
59   0x52, 0x44, 0x45, 0x46, 0xc4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // RDEF............
60   0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x04, 0xff, 0xff, 0x00, 0x91, 0x00, 0x00, // ................
61   0x92, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
62   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................
63   0x01, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, // ....w...........
64   0x04, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................
65   0x0d, 0x00, 0x00, 0x00, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x75, 0x5f, // ....u_texColoru_
66   0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x72, 0x00, 0x75, // texColorampler.u
67   0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x75, 0x5f, 0x74, 0x65, 0x78, 0x43, 0x6f, // _texColoru_texCo
68   0x6c, 0x6f, 0x72, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x00, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, // lorexture.Micros
69   0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, // oft (R) HLSL Sha
70   0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e, 0x32, // der Compiler 9.2
71   0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00, 0xab, 0x49, 0x53, 0x47, 0x4e, // 9.952.3111..ISGN
72   0x84, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, // ............h...
73   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
74   0x0f, 0x00, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....t...........
75   0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x00, 0x00, 0x74, 0x00, 0x00, 0x00, // ............t...
76   0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
77   0x0f, 0x0f, 0x00, 0x00, 0x7a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ....z...........
78   0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x50, // ............SV_P
79   0x4f, 0x53, 0x49, 0x54, 0x49, 0x4f, 0x4e, 0x00, 0x43, 0x4f, 0x4c, 0x4f, 0x52, 0x00, 0x54, 0x45, // OSITION.COLOR.TE
80   0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0xab, 0x4f, 0x53, 0x47, 0x4e, 0x2c, 0x00, 0x00, 0x00, // XCOORD..OSGN,...
81   0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ........ .......
82   0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, // ................
83   0x53, 0x56, 0x5f, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x00, 0xab, 0xab, 0x53, 0x48, 0x44, 0x52, // SV_TARGET...SHDR
84   0x04, 0x01, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x00, 0x03, // ....@...A...Z...
85   0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, // .`......X....p..
86   0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, // ....UU..b.......
87   0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xf2, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, // ....b...........
88   0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, // b...2.......e...
89   0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, // . ......h.......
90   0x45, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, // E...........F...
91   0x03, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, // ....F~.......`..
92   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xf2, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ................
93   0x46, 0x1e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1e, 0x10, 0x80, 0x41, 0x00, 0x00, 0x00, // F.......F...A...
94   0x02, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x09, 0xf2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, // ....2...........
95   0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ........F.......
96   0x46, 0x1e, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x31, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, // F.......1.......
97   0x01, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, // ....:........@..
98   0x81, 0x80, 0x80, 0x3b, 0x0d, 0x00, 0x04, 0x03, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, // ...;............
99   0x36, 0x00, 0x00, 0x05, 0xf2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0e, 0x10, 0x00, // 6.... ......F...
100   0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00, // ....>...STATt...
101   0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, // ................
102   0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, // ................
103   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
104   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
105   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, // ................
106   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
107   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // ................
108   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,                                                 // ........
109};
Property changes on: branches/osd/src/lib/bgfx/fs_debugfont.bin.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/image.cpp
r0r31734
1/*
2 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
3 * License: http://www.opensource.org/licenses/BSD-2-Clause
4 */
5
6#include "bgfx_p.h"
7#include <math.h> // powf, sqrtf
8
9#include "image.h"
10
11namespace bgfx
12{
13   static const ImageBlockInfo s_imageBlockInfo[] =
14   {
15      {   4, 4, 4,  8 }, // BC1
16      {   8, 4, 4, 16 }, // BC2
17      {   8, 4, 4, 16 }, // BC3
18      {   4, 4, 4,  8 }, // BC4
19      {   8, 4, 4, 16 }, // BC5
20      {   8, 4, 4, 16 }, // BC6H
21      {   8, 4, 4, 16 }, // BC7
22      {   4, 4, 4,  8 }, // ETC1
23      {   4, 4, 4,  8 }, // ETC2
24      {   8, 4, 4, 16 }, // ETC2A
25      {   4, 4, 4,  8 }, // ETC2A1
26      {   2, 8, 4,  8 }, // PTC12
27      {   4, 4, 4,  8 }, // PTC14
28      {   2, 8, 4,  8 }, // PTC12A
29      {   4, 4, 4,  8 }, // PTC14A
30      {   2, 8, 4,  8 }, // PTC22
31      {   4, 4, 4,  8 }, // PTC24
32      {   0, 0, 0,  0 }, // Unknown
33      {   1, 8, 1,  1 }, // R1
34      {   8, 1, 1,  1 }, // R8
35      {  16, 1, 1,  2 }, // R16
36      {  16, 1, 1,  2 }, // R16F
37      {  32, 1, 1,  4 }, // R32
38      {  32, 1, 1,  4 }, // R32F
39      {  16, 1, 1,  2 }, // RG8
40      {  32, 1, 1,  4 }, // RG16
41      {  32, 1, 1,  4 }, // RG16F
42      {  64, 1, 1,  8 }, // RG32
43      {  64, 1, 1,  8 }, // RG32F
44      {  32, 1, 1,  4 }, // BGRA8
45      {  64, 1, 1,  8 }, // RGBA16
46      {  64, 1, 1,  8 }, // RGBA16F
47      { 128, 1, 1, 16 }, // RGBA32
48      { 128, 1, 1, 16 }, // RGBA32F
49      {  16, 1, 1,  2 }, // R5G6B5
50      {  16, 1, 1,  2 }, // RGBA4
51      {  16, 1, 1,  2 }, // RGB5A1
52      {  32, 1, 1,  4 }, // RGB10A2
53      {   0, 0, 0,  0 }, // UnknownDepth
54      {  16, 1, 1,  2 }, // D16
55      {  24, 1, 1,  3 }, // D24
56      {  32, 1, 1,  4 }, // D24S8
57      {  32, 1, 1,  4 }, // D32
58      {  16, 1, 1,  2 }, // D16F
59      {  24, 1, 1,  3 }, // D24F
60      {  32, 1, 1,  4 }, // D32F
61      {   8, 1, 1,  1 }, // D0S8
62   };
63   BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_imageBlockInfo) );
64
65   static const char* s_textureFormatName[] =
66   {
67      "BC1",       // BC1
68      "BC2",       // BC2
69      "BC3",       // BC3
70      "BC4",       // BC4
71      "BC5",       // BC5
72      "BC6H",      // BC6H
73      "BC7",       // BC7
74      "ETC1",      // ETC1
75      "ETC2",      // ETC2
76      "ETC2A",     // ETC2A
77      "ETC2A1",    // ETC2A1
78      "PTC12",     // PTC12
79      "PTC14",     // PTC14
80      "PTC12A",    // PTC12A
81      "PTC14A",    // PTC14A
82      "PTC22",     // PTC22
83      "PTC24",     // PTC24
84      "<unknown>", // Unknown
85      "R1",        // R1
86      "R8",        // R8
87      "R16",       // R16
88      "R16F",      // R16F
89      "R32",       // R32
90      "R32F",      // R32F
91      "RG8",       // RG8
92      "RG16",      // RG16
93      "RG16F",     // RG16F
94      "RG32",      // RG32
95      "RG32F",     // RG32F
96      "BGRA8",     // BGRA8
97      "RGBA16",    // RGBA16
98      "RGBA16F",   // RGBA16F
99      "RGBA32",    // RGBA32
100      "RGBA32F",   // RGBA32F
101      "R5G6B5",    // R5G6B5
102      "RGBA4",     // RGBA4
103      "RGB5A1",    // RGB5A1
104      "RGB10A2",   // RGB10A2
105      "<unknown>", // UnknownDepth
106      "D16",       // D16
107      "D24",       // D24
108      "D24S8",     // D24S8
109      "D32",       // D32
110      "D16F",      // D16F
111      "D24F",      // D24F
112      "D32F",      // D32F
113      "D0S8",      // D0S8
114   };
115   BX_STATIC_ASSERT(TextureFormat::Count == BX_COUNTOF(s_textureFormatName) );
116
117   bool isCompressed(TextureFormat::Enum _format)
118   {
119      return _format < TextureFormat::Unknown;
120   }
121
122   bool isColor(TextureFormat::Enum _format)
123   {
124      return _format > TextureFormat::Unknown
125         && _format < TextureFormat::UnknownDepth
126         ;
127   }
128
129   bool isDepth(TextureFormat::Enum _format)
130   {
131      return _format > TextureFormat::UnknownDepth
132         && _format < TextureFormat::Count
133         ;
134   }
135
136   uint8_t getBitsPerPixel(TextureFormat::Enum _format)
137   {
138      return s_imageBlockInfo[_format].bitsPerPixel;
139   }
140
141   const ImageBlockInfo& getBlockInfo(TextureFormat::Enum _format)
142   {
143      return s_imageBlockInfo[_format];
144   }
145
146   uint8_t getBlockSize(TextureFormat::Enum _format)
147   {
148      return s_imageBlockInfo[_format].blockSize;
149   }
150
151   const char* getName(TextureFormat::Enum _format)
152   {
153      return s_textureFormatName[_format];
154   }
155
156   void imageSolid(uint32_t _width, uint32_t _height, uint32_t _solid, void* _dst)
157   {
158      uint32_t* dst = (uint32_t*)_dst;
159      for (uint32_t ii = 0, num = _width*_height; ii < num; ++ii)
160      {
161         *dst++ = _solid;
162      }
163   }
164
165   void imageCheckerboard(uint32_t _width, uint32_t _height, uint32_t _step, uint32_t _0, uint32_t _1, void* _dst)
166   {
167      uint32_t* dst = (uint32_t*)_dst;
168      for (uint32_t yy = 0; yy < _height; ++yy)
169      {
170         for (uint32_t xx = 0; xx < _width; ++xx)
171         {
172            uint32_t abgr = ( (xx/_step)&1) ^ ( (yy/_step)&1) ? _1 : _0;
173            *dst++ = abgr;
174         }
175      }
176   }
177
178   void imageRgba8Downsample2x2Ref(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst)
179   {
180      const uint32_t dstwidth  = _width/2;
181      const uint32_t dstheight = _height/2;
182
183      if (0 == dstwidth
184      ||  0 == dstheight)
185      {
186         return;
187      }
188
189      uint8_t* dst = (uint8_t*)_dst;
190      const uint8_t* src = (const uint8_t*)_src;
191     
192      for (uint32_t yy = 0, ystep = _srcPitch*2; yy < dstheight; ++yy, src += ystep)
193      {
194         const uint8_t* rgba = src;
195         for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 8, dst += 4)
196         {
197            float rr = powf(rgba[          0], 2.2f);
198            float gg = powf(rgba[          1], 2.2f);
199            float bb = powf(rgba[          2], 2.2f);
200            float aa =      rgba[          3];
201            rr      += powf(rgba[          4], 2.2f);
202            gg      += powf(rgba[          5], 2.2f);
203            bb      += powf(rgba[          6], 2.2f);
204            aa      +=      rgba[          7];
205            rr      += powf(rgba[_srcPitch+0], 2.2f);
206            gg      += powf(rgba[_srcPitch+1], 2.2f);
207            bb      += powf(rgba[_srcPitch+2], 2.2f);
208            aa      +=      rgba[_srcPitch+3];
209            rr      += powf(rgba[_srcPitch+4], 2.2f);
210            gg      += powf(rgba[_srcPitch+5], 2.2f);
211            bb      += powf(rgba[_srcPitch+6], 2.2f);
212            aa      +=      rgba[_srcPitch+7];
213
214            rr *= 0.25f;
215            gg *= 0.25f;
216            bb *= 0.25f;
217            aa *= 0.25f;
218            rr = powf(rr, 1.0f/2.2f);
219            gg = powf(gg, 1.0f/2.2f);
220            bb = powf(bb, 1.0f/2.2f);
221            dst[0] = (uint8_t)rr;
222            dst[1] = (uint8_t)gg;
223            dst[2] = (uint8_t)bb;
224            dst[3] = (uint8_t)aa;
225         }
226      }
227   }
228
229   void imageRgba8Downsample2x2(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst)
230   {
231      const uint32_t dstwidth  = _width/2;
232      const uint32_t dstheight = _height/2;
233
234      if (0 == dstwidth
235      ||  0 == dstheight)
236      {
237         return;
238      }
239
240      uint8_t* dst = (uint8_t*)_dst;
241      const uint8_t* src = (const uint8_t*)_src;
242
243      using namespace bx;
244      const float4_t unpack = float4_ld(1.0f, 1.0f/256.0f, 1.0f/65536.0f, 1.0f/16777216.0f);
245      const float4_t pack   = float4_ld(1.0f, 256.0f*0.5f, 65536.0f, 16777216.0f*0.5f);
246      const float4_t umask  = float4_ild(0xff, 0xff00, 0xff0000, 0xff000000);
247      const float4_t pmask  = float4_ild(0xff, 0x7f80, 0xff0000, 0x7f800000);
248      const float4_t wflip  = float4_ild(0, 0, 0, 0x80000000);
249      const float4_t wadd   = float4_ld(0.0f, 0.0f, 0.0f, 32768.0f*65536.0f);
250      const float4_t gamma  = float4_ld(1.0f/2.2f, 1.0f/2.2f, 1.0f/2.2f, 1.0f);
251      const float4_t linear = float4_ld(2.2f, 2.2f, 2.2f, 1.0f);
252      const float4_t quater = float4_splat(0.25f);
253
254      for (uint32_t yy = 0, ystep = _srcPitch*2; yy < dstheight; ++yy, src += ystep)
255      {
256         const uint8_t* rgba = src;
257         for (uint32_t xx = 0; xx < dstwidth; ++xx, rgba += 8, dst += 4)
258         {
259            const float4_t abgr0  = float4_splat(rgba);
260            const float4_t abgr1  = float4_splat(rgba+4);
261            const float4_t abgr2  = float4_splat(rgba+_srcPitch);
262            const float4_t abgr3  = float4_splat(rgba+_srcPitch+4);
263
264            const float4_t abgr0m = float4_and(abgr0, umask);
265            const float4_t abgr1m = float4_and(abgr1, umask);
266            const float4_t abgr2m = float4_and(abgr2, umask);
267            const float4_t abgr3m = float4_and(abgr3, umask);
268            const float4_t abgr0x = float4_xor(abgr0m, wflip);
269            const float4_t abgr1x = float4_xor(abgr1m, wflip);
270            const float4_t abgr2x = float4_xor(abgr2m, wflip);
271            const float4_t abgr3x = float4_xor(abgr3m, wflip);
272            const float4_t abgr0f = float4_itof(abgr0x);
273            const float4_t abgr1f = float4_itof(abgr1x);
274            const float4_t abgr2f = float4_itof(abgr2x);
275            const float4_t abgr3f = float4_itof(abgr3x);
276            const float4_t abgr0c = float4_add(abgr0f, wadd);
277            const float4_t abgr1c = float4_add(abgr1f, wadd);
278            const float4_t abgr2c = float4_add(abgr2f, wadd);
279            const float4_t abgr3c = float4_add(abgr3f, wadd);
280            const float4_t abgr0n = float4_mul(abgr0c, unpack);
281            const float4_t abgr1n = float4_mul(abgr1c, unpack);
282            const float4_t abgr2n = float4_mul(abgr2c, unpack);
283            const float4_t abgr3n = float4_mul(abgr3c, unpack);
284
285            const float4_t abgr0l = float4_pow(abgr0n, linear);
286            const float4_t abgr1l = float4_pow(abgr1n, linear);
287            const float4_t abgr2l = float4_pow(abgr2n, linear);
288            const float4_t abgr3l = float4_pow(abgr3n, linear);
289
290            const float4_t sum0   = float4_add(abgr0l, abgr1l);
291            const float4_t sum1   = float4_add(abgr2l, abgr3l);
292            const float4_t sum2   = float4_add(sum0, sum1);
293            const float4_t avg0   = float4_mul(sum2, quater);
294            const float4_t avg1   = float4_pow(avg0, gamma);
295
296            const float4_t avg2   = float4_mul(avg1, pack);
297            const float4_t ftoi0  = float4_ftoi(avg2);
298            const float4_t ftoi1  = float4_and(ftoi0, pmask);
299            const float4_t zwxy   = float4_swiz_zwxy(ftoi1);
300            const float4_t tmp0   = float4_or(ftoi1, zwxy);
301            const float4_t yyyy   = float4_swiz_yyyy(tmp0);
302            const float4_t tmp1   = float4_iadd(yyyy, yyyy);
303            const float4_t result = float4_or(tmp0, tmp1);
304
305            float4_stx(dst, result);
306         }
307      }
308   }
309
310   void imageSwizzleBgra8Ref(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst)
311   {
312      const uint8_t* src = (uint8_t*) _src;
313      const uint8_t* next = src + _srcPitch;
314      uint8_t* dst = (uint8_t*)_dst;
315
316      for (uint32_t yy = 0; yy < _height; ++yy, src = next, next += _srcPitch)
317      {
318         for (uint32_t xx = 0; xx < _width; ++xx, src += 4, dst += 4)
319         {
320            uint8_t rr = src[0];
321            uint8_t gg = src[1];
322            uint8_t bb = src[2];
323            uint8_t aa = src[3];
324            dst[0] = bb;
325            dst[1] = gg;
326            dst[2] = rr;
327            dst[3] = aa;
328         }
329      }
330   }
331
332   void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst)
333   {
334      // Test can we do four 4-byte pixels at the time.
335      if (0 != (_width&0x3)
336      ||  _width < 4
337      ||  !bx::isPtrAligned(_src, 16)
338      ||  !bx::isPtrAligned(_dst, 16) )
339      {
340         BX_WARN(false, "Image swizzle is taking slow path.");
341         BX_WARN(bx::isPtrAligned(_src, 16), "Source %p is not 16-byte aligned.", _src);
342         BX_WARN(bx::isPtrAligned(_dst, 16), "Destination %p is not 16-byte aligned.", _dst);
343         BX_WARN(_width < 4, "Image width must be multiple of 4 (width %d).", _width);
344         imageSwizzleBgra8Ref(_width, _height, _srcPitch, _src, _dst);
345         return;
346      }
347
348      using namespace bx;
349
350      const float4_t mf0f0 = float4_isplat(0xff00ff00);
351      const float4_t m0f0f = float4_isplat(0x00ff00ff);
352      const uint8_t* src = (uint8_t*) _src;
353      const uint8_t* next = src + _srcPitch;
354      uint8_t* dst = (uint8_t*)_dst;
355
356      const uint32_t width = _width/4;
357
358      for (uint32_t yy = 0; yy < _height; ++yy, src = next, next += _srcPitch)
359      {
360         for (uint32_t xx = 0; xx < width; ++xx, src += 16, dst += 16)
361         {
362            const float4_t tabgr = float4_ld(src);
363            const float4_t t00ab = float4_srl(tabgr, 16);
364            const float4_t tgr00 = float4_sll(tabgr, 16);
365            const float4_t tgrab = float4_or(t00ab, tgr00);
366            const float4_t ta0g0 = float4_and(tabgr, mf0f0);
367            const float4_t t0r0b = float4_and(tgrab, m0f0f);
368            const float4_t targb = float4_or(ta0g0, t0r0b);
369            float4_st(dst, targb);
370         }
371      }
372   }
373
374   void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _srcPitch, const void* _src, void* _dst)
375   {
376      const uint32_t pitch = _width*_bpp/8;
377      const uint8_t* src = (uint8_t*) _src;
378      const uint8_t* next = src + _srcPitch;
379      uint8_t* dst = (uint8_t*)_dst;
380
381      for (uint32_t yy = 0; yy < _height; ++yy, src = next, next += _srcPitch, dst += pitch)
382      {
383         memcpy(dst, src, pitch);
384      }
385   }
386
387   void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip)
388   {
389      uint8_t type = _grayscale ? 3 : 2;
390      uint8_t bpp = _grayscale ? 8 : 32;
391
392      uint8_t header[18] = {};
393      header[2] = type;
394      header[12] = _width&0xff;
395      header[13] = (_width>>8)&0xff;
396      header[14] = _height&0xff;
397      header[15] = (_height>>8)&0xff;
398      header[16] = bpp;
399      header[17] = 32;
400
401      bx::write(_writer, header, sizeof(header) );
402
403      uint32_t dstPitch = _width*bpp/8;
404      if (_yflip)
405      {
406         uint8_t* data = (uint8_t*)_src + _srcPitch*_height - _srcPitch;
407         for (uint32_t yy = 0; yy < _height; ++yy)
408         {
409            bx::write(_writer, data, dstPitch);
410            data -= _srcPitch;
411         }
412      }
413      else if (_srcPitch == dstPitch)
414      {
415         bx::write(_writer, _src, _height*_srcPitch);
416      }
417      else
418      {
419         uint8_t* data = (uint8_t*)_src;
420         for (uint32_t yy = 0; yy < _height; ++yy)
421         {
422            bx::write(_writer, data, dstPitch);
423            data += _srcPitch;
424         }
425      }
426   }
427
428   uint32_t bitRangeConvert(uint32_t _in, uint32_t _from, uint32_t _to)
429   {
430      using namespace bx;
431      uint32_t tmp0   = uint32_sll(1, _to);
432      uint32_t tmp1   = uint32_sll(1, _from);
433      uint32_t tmp2   = uint32_dec(tmp0);
434      uint32_t tmp3   = uint32_dec(tmp1);
435      uint32_t tmp4   = uint32_mul(_in, tmp2);
436      uint32_t tmp5   = uint32_add(tmp3, tmp4);
437      uint32_t tmp6   = uint32_srl(tmp5, _from);
438      uint32_t tmp7   = uint32_add(tmp5, tmp6);
439      uint32_t result = uint32_srl(tmp7, _from);
440
441      return result;
442   }
443
444   void decodeBlockDxt(uint8_t _dst[16*4], const uint8_t _src[8])
445   {
446      uint8_t colors[4*3];
447
448      uint32_t c0 = _src[0] | (_src[1] << 8);
449      colors[0] = bitRangeConvert( (c0>> 0)&0x1f, 5, 8);
450      colors[1] = bitRangeConvert( (c0>> 5)&0x3f, 6, 8);
451      colors[2] = bitRangeConvert( (c0>>11)&0x1f, 5, 8);
452
453      uint32_t c1 = _src[2] | (_src[3] << 8);
454      colors[3] = bitRangeConvert( (c1>> 0)&0x1f, 5, 8);
455      colors[4] = bitRangeConvert( (c1>> 5)&0x3f, 6, 8);
456      colors[5] = bitRangeConvert( (c1>>11)&0x1f, 5, 8);
457
458      colors[6] = (2*colors[0] + colors[3]) / 3;
459      colors[7] = (2*colors[1] + colors[4]) / 3;
460      colors[8] = (2*colors[2] + colors[5]) / 3;
461
462      colors[ 9] = (colors[0] + 2*colors[3]) / 3;
463      colors[10] = (colors[1] + 2*colors[4]) / 3;
464      colors[11] = (colors[2] + 2*colors[5]) / 3;
465
466      for (uint32_t ii = 0, next = 8*4; ii < 16*4; ii += 4, next += 2)
467      {
468         int idx = ( (_src[next>>3] >> (next & 7) ) & 3) * 3;
469         _dst[ii+0] = colors[idx+0];
470         _dst[ii+1] = colors[idx+1];
471         _dst[ii+2] = colors[idx+2];
472      }
473   }
474
475   void decodeBlockDxt1(uint8_t _dst[16*4], const uint8_t _src[8])
476   {
477      uint8_t colors[4*4];
478
479      uint32_t c0 = _src[0] | (_src[1] << 8);
480      colors[0] = bitRangeConvert( (c0>> 0)&0x1f, 5, 8);
481      colors[1] = bitRangeConvert( (c0>> 5)&0x3f, 6, 8);
482      colors[2] = bitRangeConvert( (c0>>11)&0x1f, 5, 8);
483      colors[3] = 255;
484
485      uint32_t c1 = _src[2] | (_src[3] << 8);
486      colors[4] = bitRangeConvert( (c1>> 0)&0x1f, 5, 8);
487      colors[5] = bitRangeConvert( (c1>> 5)&0x3f, 6, 8);
488      colors[6] = bitRangeConvert( (c1>>11)&0x1f, 5, 8);
489      colors[7] = 255;
490
491      if (c0 > c1)
492      {
493         colors[ 8] = (2*colors[0] + colors[4]) / 3;
494         colors[ 9] = (2*colors[1] + colors[5]) / 3;
495         colors[10] = (2*colors[2] + colors[6]) / 3;
496         colors[11] = 255;
497
498         colors[12] = (colors[0] + 2*colors[4]) / 3;
499         colors[13] = (colors[1] + 2*colors[5]) / 3;
500         colors[14] = (colors[2] + 2*colors[6]) / 3;
501         colors[15] = 255;
502      }
503      else
504      {
505         colors[ 8] = (colors[0] + colors[4]) / 2;
506         colors[ 9] = (colors[1] + colors[5]) / 2;
507         colors[10] = (colors[2] + colors[6]) / 2;
508         colors[11] = 255;
509         
510         colors[12] = 0;
511         colors[13] = 0;
512         colors[14] = 0;
513         colors[15] = 0;
514      }
515
516      for (uint32_t ii = 0, next = 8*4; ii < 16*4; ii += 4, next += 2)
517      {
518         int idx = ( (_src[next>>3] >> (next & 7) ) & 3) * 4;
519         _dst[ii+0] = colors[idx+0];
520         _dst[ii+1] = colors[idx+1];
521         _dst[ii+2] = colors[idx+2];
522         _dst[ii+3] = colors[idx+3];
523      }
524   }
525
526   void decodeBlockDxt23A(uint8_t _dst[16*4], const uint8_t _src[8])
527   {
528      for (uint32_t ii = 0, next = 0; ii < 16*4; ii += 4, next += 4)
529      {
530         uint32_t c0 = (_src[next>>3] >> (next&7) ) & 0xf;
531         _dst[ii] = bitRangeConvert(c0, 4, 8);
532      }
533   }
534
535   void decodeBlockDxt45A(uint8_t _dst[16*4], const uint8_t _src[8])
536   {
537      uint8_t alpha[8];
538      alpha[0] = _src[0];
539      alpha[1] = _src[1];
540
541      if (alpha[0] > alpha[1])
542      {
543         alpha[2] = (6*alpha[0] + 1*alpha[1]) / 7;
544         alpha[3] = (5*alpha[0] + 2*alpha[1]) / 7;
545         alpha[4] = (4*alpha[0] + 3*alpha[1]) / 7;
546         alpha[5] = (3*alpha[0] + 4*alpha[1]) / 7;
547         alpha[6] = (2*alpha[0] + 5*alpha[1]) / 7;
548         alpha[7] = (1*alpha[0] + 6*alpha[1]) / 7;
549      }
550      else
551      {
552         alpha[2] = (4*alpha[0] + 1*alpha[1]) / 5;
553         alpha[3] = (3*alpha[0] + 2*alpha[1]) / 5;
554         alpha[4] = (2*alpha[0] + 3*alpha[1]) / 5;
555         alpha[5] = (1*alpha[0] + 4*alpha[1]) / 5;
556         alpha[6] = 0;
557         alpha[7] = 255;
558      }
559
560      uint32_t idx0 = _src[2];
561      uint32_t idx1 = _src[5];
562      idx0 |= uint32_t(_src[3])<<8;
563      idx1 |= uint32_t(_src[6])<<8;
564      idx0 |= uint32_t(_src[4])<<16;
565      idx1 |= uint32_t(_src[7])<<16;
566      for (uint32_t ii = 0; ii < 8*4; ii += 4)
567      {
568         _dst[ii]    = alpha[idx0&7];
569         _dst[ii+32] = alpha[idx1&7];
570         idx0 >>= 3;
571         idx1 >>= 3;
572      }
573   }
574
575   static const int32_t s_etc1Mod[8][4] =
576   {
577      {  2,   8,  -2,   -8},
578      {  5,  17,  -5,  -17},
579      {  9,  29,  -9,  -29},
580      { 13,  42, -13,  -42},
581      { 18,  60, -18,  -60},
582      { 24,  80, -24,  -80},
583      { 33, 106, -33, -106},
584      { 47, 183, -47, -183},
585   };
586
587   static const uint8_t s_etc2Mod[8] = { 3, 6, 11, 16, 23, 32, 41, 64 };
588
589   uint8_t uint8_sat(int32_t _a)
590   {
591      using namespace bx;
592      const uint32_t min    = uint32_imin(_a, 255);
593      const uint32_t result = uint32_imax(min, 0);
594      return (uint8_t)result;
595   }
596
597   uint8_t uint8_satadd(int32_t _a, int32_t _b)
598   {
599      const int32_t add = _a + _b;
600      return uint8_sat(add);
601   }
602
603   void decodeBlockEtc2ModeT(uint8_t _dst[16*4], const uint8_t _src[8])
604   {
605      uint8_t rgb[16];
606
607      // 0       1       2       3       4       5       6       7
608      // 7654321076543210765432107654321076543210765432107654321076543210
609      // ...rr.rrggggbbbbrrrrggggbbbbDDD.mmmmmmmmmmmmmmmmllllllllllllllll
610      //    ^            ^           ^   ^               ^
611      //    +-- c0       +-- c1      |   +-- msb         +-- lsb
612      //                             +-- dist
613
614      rgb[ 0] = ( (_src[0] >> 1) & 0xc)
615             | (_src[0] & 0x3)
616             ;
617      rgb[ 1] = _src[1] >> 4;
618      rgb[ 2] = _src[1] & 0xf;
619
620      rgb[ 8] = _src[2] >> 4;
621      rgb[ 9] = _src[2] & 0xf;
622      rgb[10] = _src[3] >> 4;
623
624      rgb[ 0] = bitRangeConvert(rgb[ 0], 4, 8);
625      rgb[ 1] = bitRangeConvert(rgb[ 1], 4, 8);
626      rgb[ 2] = bitRangeConvert(rgb[ 2], 4, 8);
627      rgb[ 8] = bitRangeConvert(rgb[ 8], 4, 8);
628      rgb[ 9] = bitRangeConvert(rgb[ 9], 4, 8);
629      rgb[10] = bitRangeConvert(rgb[10], 4, 8);
630
631      uint8_t dist = (_src[3] >> 1) & 0x7;
632      int32_t mod = s_etc2Mod[dist];
633
634      rgb[ 4] = uint8_satadd(rgb[ 8],  mod);
635      rgb[ 5] = uint8_satadd(rgb[ 9],  mod);
636      rgb[ 6] = uint8_satadd(rgb[10],  mod);
637
638      rgb[12] = uint8_satadd(rgb[ 8], -mod);
639      rgb[13] = uint8_satadd(rgb[ 9], -mod);
640      rgb[14] = uint8_satadd(rgb[10], -mod);
641
642      uint32_t indexMsb = (_src[4]<<8) | _src[5];
643      uint32_t indexLsb = (_src[6]<<8) | _src[7];
644
645      for (uint32_t ii = 0; ii < 16; ++ii)
646      {
647         const uint32_t idx  = (ii&0xc) | ( (ii & 0x3)<<4);
648         const uint32_t lsbi = indexLsb & 1;
649         const uint32_t msbi = (indexMsb & 1)<<1;
650         const uint32_t pal  = (lsbi | msbi)<<2;
651
652         _dst[idx + 0] = rgb[pal+2];
653         _dst[idx + 1] = rgb[pal+1];
654         _dst[idx + 2] = rgb[pal+0];
655         _dst[idx + 3] = 255;
656
657         indexLsb >>= 1;
658         indexMsb >>= 1;
659      }
660   }
661
662   void decodeBlockEtc2ModeH(uint8_t _dst[16*4], const uint8_t _src[8])
663   {
664      uint8_t rgb[16];
665
666      // 0       1       2       3       4       5       6       7
667      // 7654321076543210765432107654321076543210765432107654321076543210
668      // .rrrrggg...gb.bbbrrrrggggbbbbDD.mmmmmmmmmmmmmmmmllllllllllllllll
669      //  ^               ^           ^  ^               ^
670      //  +-- c0          +-- c1      |  +-- msb         +-- lsb
671      //                              +-- dist
672
673      rgb[ 0] = (_src[0] >> 3) & 0xf;
674      rgb[ 1] = ( (_src[0] << 1) & 0xe)
675            | ( (_src[1] >> 4) & 0x1)
676            ;
677      rgb[ 2] = (_src[1] & 0x8)
678            | ( (_src[1] << 1) & 0x6)
679            | (_src[2] >> 7)
680            ;
681
682      rgb[ 8] = (_src[2] >> 3) & 0xf;
683      rgb[ 9] = ( (_src[2] << 1) & 0xe)
684            | (_src[3] >> 7)
685            ;
686      rgb[10] = (_src[2] >> 3) & 0xf;
687
688      rgb[ 0] = bitRangeConvert(rgb[ 0], 4, 8);
689      rgb[ 1] = bitRangeConvert(rgb[ 1], 4, 8);
690      rgb[ 2] = bitRangeConvert(rgb[ 2], 4, 8);
691      rgb[ 8] = bitRangeConvert(rgb[ 8], 4, 8);
692      rgb[ 9] = bitRangeConvert(rgb[ 9], 4, 8);
693      rgb[10] = bitRangeConvert(rgb[10], 4, 8);
694
695      uint32_t col0 = uint32_t(rgb[0]<<16) | uint32_t(rgb[1]<<8) | uint32_t(rgb[ 2]);
696      uint32_t col1 = uint32_t(rgb[8]<<16) | uint32_t(rgb[9]<<8) | uint32_t(rgb[10]);
697      uint8_t dist = (_src[3] & 0x6) | (col0 >= col1);
698      int32_t mod = s_etc2Mod[dist];
699
700      rgb[ 4] = uint8_satadd(rgb[ 0], -mod);
701      rgb[ 5] = uint8_satadd(rgb[ 1], -mod);
702      rgb[ 6] = uint8_satadd(rgb[ 2], -mod);
703
704      rgb[ 0] = uint8_satadd(rgb[ 0],  mod);
705      rgb[ 1] = uint8_satadd(rgb[ 1],  mod);
706      rgb[ 2] = uint8_satadd(rgb[ 2],  mod);
707
708      rgb[12] = uint8_satadd(rgb[ 8], -mod);
709      rgb[13] = uint8_satadd(rgb[ 9], -mod);
710      rgb[14] = uint8_satadd(rgb[10], -mod);
711
712      rgb[ 8] = uint8_satadd(rgb[ 8],  mod);
713      rgb[ 9] = uint8_satadd(rgb[ 9],  mod);
714      rgb[10] = uint8_satadd(rgb[10],  mod);
715
716      uint32_t indexMsb = (_src[4]<<8) | _src[5];
717      uint32_t indexLsb = (_src[6]<<8) | _src[7];
718
719      for (uint32_t ii = 0; ii < 16; ++ii)
720      {
721         const uint32_t idx  = (ii&0xc) | ( (ii & 0x3)<<4);
722         const uint32_t lsbi = indexLsb & 1;
723         const uint32_t msbi = (indexMsb & 1)<<1;
724         const uint32_t pal  = (lsbi | msbi)<<2;
725
726         _dst[idx + 0] = rgb[pal+2];
727         _dst[idx + 1] = rgb[pal+1];
728         _dst[idx + 2] = rgb[pal+0];
729         _dst[idx + 3] = 255;
730
731         indexLsb >>= 1;
732         indexMsb >>= 1;
733      }
734   }
735
736   void decodeBlockEtc2ModePlanar(uint8_t _dst[16*4], const uint8_t _src[8])
737   {
738      // 0       1       2       3       4       5       6       7
739      // 7654321076543210765432107654321076543210765432107654321076543210
740      // .rrrrrrg.ggggggb...bb.bbbrrrrr.rgggggggbbbbbbrrrrrrgggggggbbbbbb
741      //  ^                       ^                   ^
742      //  +-- c0                  +-- cH              +-- cV
743
744      uint8_t c0[3];
745      uint8_t cH[3];
746      uint8_t cV[3];
747
748      c0[0] = (_src[0] >> 1) & 0x3f;
749      c0[1] = ( (_src[0] & 1) << 6)
750           | ( (_src[1] >> 1) & 0x3f)
751           ;
752      c0[2] = ( (_src[1] & 1) << 5)
753           | ( (_src[2] & 0x18) )
754           | ( (_src[2] << 1) & 6)
755           | ( (_src[3] >> 7) )
756           ;
757
758      cH[0] = ( (_src[3] >> 1) & 0x3e)
759           | (_src[3] & 1)
760           ;
761      cH[1] = _src[4] >> 1;
762      cH[2] = ( (_src[4] & 1) << 5)
763           | (_src[5] >> 3)
764           ;
765
766      cV[0] = ( (_src[5] & 0x7) << 3)
767           | (_src[6] >> 5)
768           ;
769      cV[1] = ( (_src[6] & 0x1f) << 2)
770           | (_src[7] >> 5)
771           ;
772      cV[2] = _src[7] & 0x3f;
773
774      c0[0] = bitRangeConvert(c0[0], 6, 8);
775      c0[1] = bitRangeConvert(c0[1], 7, 8);
776      c0[2] = bitRangeConvert(c0[2], 6, 8);
777
778      cH[0] = bitRangeConvert(cH[0], 6, 8);
779      cH[1] = bitRangeConvert(cH[1], 7, 8);
780      cH[2] = bitRangeConvert(cH[2], 6, 8);
781
782      cV[0] = bitRangeConvert(cV[0], 6, 8);
783      cV[1] = bitRangeConvert(cV[1], 7, 8);
784      cV[2] = bitRangeConvert(cV[2], 6, 8);
785
786      int16_t dy[3];
787      dy[0] = cV[0] - c0[0];
788      dy[1] = cV[1] - c0[1];
789      dy[2] = cV[2] - c0[2];
790
791      int16_t sx[3];
792      sx[0] = int16_t(c0[0])<<2;
793      sx[1] = int16_t(c0[1])<<2;
794      sx[2] = int16_t(c0[2])<<2;
795
796      int16_t ex[3];
797      ex[0] = int16_t(cH[0])<<2;
798      ex[1] = int16_t(cH[1])<<2;
799      ex[2] = int16_t(cH[2])<<2;
800
801      for (int32_t vv = 0; vv < 4; ++vv)
802      {
803         int16_t dx[3];
804         dx[0] = (ex[0] - sx[0])>>2;
805         dx[1] = (ex[1] - sx[1])>>2;
806         dx[2] = (ex[2] - sx[2])>>2;
807
808         for (int32_t hh = 0; hh < 4; ++hh)
809         {
810            const uint32_t idx  = (vv<<4) + (hh<<2);
811
812            _dst[idx + 0] = uint8_sat( (sx[2] + dx[2]*hh)>>2);
813            _dst[idx + 1] = uint8_sat( (sx[1] + dx[1]*hh)>>2);
814            _dst[idx + 2] = uint8_sat( (sx[0] + dx[0]*hh)>>2);
815            _dst[idx + 3] = 255;
816         }
817
818         sx[0] += dy[0];
819         sx[1] += dy[1];
820         sx[2] += dy[2];
821
822         ex[0] += dy[0];
823         ex[1] += dy[1];
824         ex[2] += dy[2];
825      }
826   }
827
828   void decodeBlockEtc12(uint8_t _dst[16*4], const uint8_t _src[8])
829   {
830      bool flipBit = 0 != (_src[3] & 0x1);
831      bool diffBit = 0 != (_src[3] & 0x2);
832
833      uint8_t rgb[8];
834
835      if (diffBit)
836      {
837         rgb[0]  = _src[0] >> 3;
838         rgb[1]  = _src[1] >> 3;
839         rgb[2]  = _src[2] >> 3;
840
841         int8_t diff[3];
842         diff[0] = int8_t( (_src[0] & 0x7)<<5)>>5;
843         diff[1] = int8_t( (_src[1] & 0x7)<<5)>>5;
844         diff[2] = int8_t( (_src[2] & 0x7)<<5)>>5;
845
846         int8_t rr = rgb[0] + diff[0];
847         int8_t gg = rgb[1] + diff[1];
848         int8_t bb = rgb[2] + diff[2];
849
850         // Etc2 3-modes
851         if (rr < 0 || rr > 31)
852         {
853            decodeBlockEtc2ModeT(_dst, _src);
854            return;
855         }
856         if (gg < 0 || gg > 31)
857         {
858            decodeBlockEtc2ModeH(_dst, _src);
859            return;
860         }
861         if (bb < 0 || bb > 31)
862         {
863            decodeBlockEtc2ModePlanar(_dst, _src);
864            return;
865         }
866
867         // Etc1
868         rgb[0] = bitRangeConvert(rgb[0], 5, 8);
869         rgb[1] = bitRangeConvert(rgb[1], 5, 8);
870         rgb[2] = bitRangeConvert(rgb[2], 5, 8);
871         rgb[4] = bitRangeConvert(rr, 5, 8);
872         rgb[5] = bitRangeConvert(gg, 5, 8);
873         rgb[6] = bitRangeConvert(bb, 5, 8);
874      }
875      else
876      {
877         rgb[0] = _src[0] >> 4;
878         rgb[1] = _src[1] >> 4;
879         rgb[2] = _src[2] >> 4;
880
881         rgb[4] = _src[0] & 0xf;
882         rgb[5] = _src[1] & 0xf;
883         rgb[6] = _src[2] & 0xf;
884
885         rgb[0] = bitRangeConvert(rgb[0], 4, 8);
886         rgb[1] = bitRangeConvert(rgb[1], 4, 8);
887         rgb[2] = bitRangeConvert(rgb[2], 4, 8);
888         rgb[4] = bitRangeConvert(rgb[4], 4, 8);
889         rgb[5] = bitRangeConvert(rgb[5], 4, 8);
890         rgb[6] = bitRangeConvert(rgb[6], 4, 8);
891      }
892
893      uint32_t table[2];
894      table[0] = (_src[3] >> 5) & 0x7;
895      table[1] = (_src[3] >> 2) & 0x7;
896
897      uint32_t indexMsb = (_src[4]<<8) | _src[5];
898      uint32_t indexLsb = (_src[6]<<8) | _src[7];
899
900      if (flipBit)
901      {
902         for (uint32_t ii = 0; ii < 16; ++ii)
903         {
904            const uint32_t block = (ii>>1)&1;
905            const uint32_t color = block<<2;
906            const uint32_t idx   = (ii&0xc) | ( (ii & 0x3)<<4);
907            const uint32_t lsbi  = indexLsb & 1;
908            const uint32_t msbi  = (indexMsb & 1)<<1;
909            const  int32_t mod   = s_etc1Mod[table[block] ][lsbi | msbi];
910
911            _dst[idx + 0] = uint8_satadd(rgb[color+2], mod);
912            _dst[idx + 1] = uint8_satadd(rgb[color+1], mod);
913            _dst[idx + 2] = uint8_satadd(rgb[color+0], mod);
914            _dst[idx + 3] = 255;
915
916            indexLsb >>= 1;
917            indexMsb >>= 1;
918         }
919      }
920      else
921      {
922         for (uint32_t ii = 0; ii < 16; ++ii)
923         {
924            const uint32_t block = ii>>3;
925            const uint32_t color = block<<2;
926            const uint32_t idx   = (ii&0xc) | ( (ii & 0x3)<<4);
927            const uint32_t lsbi  = indexLsb & 1;
928            const uint32_t msbi  = (indexMsb & 1)<<1;
929            const  int32_t mod   = s_etc1Mod[table[block] ][lsbi | msbi];
930
931            _dst[idx + 0] = uint8_satadd(rgb[color+2], mod);
932            _dst[idx + 1] = uint8_satadd(rgb[color+1], mod);
933            _dst[idx + 2] = uint8_satadd(rgb[color+0], mod);
934            _dst[idx + 3] = 255;
935
936            indexLsb >>= 1;
937            indexMsb >>= 1;
938         }
939      }
940   }
941
942// DDS
943#define DDS_MAGIC             BX_MAKEFOURCC('D', 'D', 'S', ' ')
944#define DDS_HEADER_SIZE       124
945
946#define DDS_DXT1 BX_MAKEFOURCC('D', 'X', 'T', '1')
947#define DDS_DXT2 BX_MAKEFOURCC('D', 'X', 'T', '2')
948#define DDS_DXT3 BX_MAKEFOURCC('D', 'X', 'T', '3')
949#define DDS_DXT4 BX_MAKEFOURCC('D', 'X', 'T', '4')
950#define DDS_DXT5 BX_MAKEFOURCC('D', 'X', 'T', '5')
951#define DDS_ATI1 BX_MAKEFOURCC('A', 'T', 'I', '1')
952#define DDS_BC4U BX_MAKEFOURCC('B', 'C', '4', 'U')
953#define DDS_ATI2 BX_MAKEFOURCC('A', 'T', 'I', '2')
954#define DDS_BC5U BX_MAKEFOURCC('B', 'C', '5', 'U')
955#define DDS_DX10 BX_MAKEFOURCC('D', 'X', '1', '0')
956
957#define D3DFMT_A8R8G8B8       21
958#define D3DFMT_R5G6B5         23
959#define D3DFMT_A1R5G5B5       25
960#define D3DFMT_A4R4G4B4       26
961#define D3DFMT_A2B10G10R10    31
962#define D3DFMT_G16R16         34
963#define D3DFMT_A2R10G10B10    35
964#define D3DFMT_A16B16G16R16   36
965#define D3DFMT_A8L8           51
966#define D3DFMT_R16F           111
967#define D3DFMT_G16R16F        112
968#define D3DFMT_A16B16G16R16F  113
969#define D3DFMT_R32F           114
970#define D3DFMT_G32R32F        115
971#define D3DFMT_A32B32G32R32F  116
972
973#define DXGI_FORMAT_R32G32B32A32_FLOAT 2
974#define DXGI_FORMAT_R32G32B32A32_UINT  3
975#define DXGI_FORMAT_R16G16B16A16_FLOAT 10
976#define DXGI_FORMAT_R16G16B16A16_UNORM 11
977#define DXGI_FORMAT_R16G16B16A16_UINT  12
978#define DXGI_FORMAT_R32G32_FLOAT       16
979#define DXGI_FORMAT_R32G32_UINT        17
980#define DXGI_FORMAT_R10G10B10A2_UNORM  24
981#define DXGI_FORMAT_R16G16_FLOAT       34
982#define DXGI_FORMAT_R16G16_UNORM       35
983#define DXGI_FORMAT_R32_FLOAT          41
984#define DXGI_FORMAT_R32_UINT           42
985#define DXGI_FORMAT_R8G8_UNORM         49
986#define DXGI_FORMAT_R16_FLOAT          54
987#define DXGI_FORMAT_R16_UNORM          56
988#define DXGI_FORMAT_R8_UNORM           61
989#define DXGI_FORMAT_BC1_UNORM          71
990#define DXGI_FORMAT_BC2_UNORM          74
991#define DXGI_FORMAT_BC3_UNORM          77
992#define DXGI_FORMAT_BC4_UNORM          80
993#define DXGI_FORMAT_BC5_UNORM          83
994#define DXGI_FORMAT_B5G6R5_UNORM       85
995#define DXGI_FORMAT_B5G5R5A1_UNORM     86
996#define DXGI_FORMAT_B8G8R8A8_UNORM     87
997#define DXGI_FORMAT_BC6H_SF16          96
998#define DXGI_FORMAT_BC7_UNORM          98
999#define DXGI_FORMAT_B4G4R4A4_UNORM     115
1000
1001#define DDSD_CAPS                   0x00000001
1002#define DDSD_HEIGHT                 0x00000002
1003#define DDSD_WIDTH                  0x00000004
1004#define DDSD_PITCH                  0x00000008
1005#define DDSD_PIXELFORMAT            0x00001000
1006#define DDSD_MIPMAPCOUNT            0x00020000
1007#define DDSD_LINEARSIZE             0x00080000
1008#define DDSD_DEPTH                  0x00800000
1009
1010#define DDPF_ALPHAPIXELS            0x00000001
1011#define DDPF_ALPHA                  0x00000002
1012#define DDPF_FOURCC                 0x00000004
1013#define DDPF_INDEXED                0x00000020
1014#define DDPF_RGB                    0x00000040
1015#define DDPF_YUV                    0x00000200
1016#define DDPF_LUMINANCE              0x00020000
1017
1018#define DDSCAPS_COMPLEX             0x00000008
1019#define DDSCAPS_TEXTURE             0x00001000
1020#define DDSCAPS_MIPMAP              0x00400000
1021
1022#define DDSCAPS2_CUBEMAP            0x00000200
1023#define DDSCAPS2_CUBEMAP_POSITIVEX  0x00000400
1024#define DDSCAPS2_CUBEMAP_NEGATIVEX  0x00000800
1025#define DDSCAPS2_CUBEMAP_POSITIVEY  0x00001000
1026#define DDSCAPS2_CUBEMAP_NEGATIVEY  0x00002000
1027#define DDSCAPS2_CUBEMAP_POSITIVEZ  0x00004000
1028#define DDSCAPS2_CUBEMAP_NEGATIVEZ  0x00008000
1029
1030#define DDS_CUBEMAP_ALLFACES (DDSCAPS2_CUBEMAP_POSITIVEX|DDSCAPS2_CUBEMAP_NEGATIVEX \
1031                      |DDSCAPS2_CUBEMAP_POSITIVEY|DDSCAPS2_CUBEMAP_NEGATIVEY \
1032                      |DDSCAPS2_CUBEMAP_POSITIVEZ|DDSCAPS2_CUBEMAP_NEGATIVEZ)
1033
1034#define DDSCAPS2_VOLUME             0x00200000
1035
1036   struct TranslateDdsFormat
1037   {
1038      uint32_t m_format;
1039      TextureFormat::Enum m_textureFormat;
1040
1041   };
1042   
1043   static TranslateDdsFormat s_translateDdsFormat[] =
1044   {
1045      { DDS_DXT1,                  TextureFormat::BC1     },
1046      { DDS_DXT2,                  TextureFormat::BC2     },
1047      { DDS_DXT3,                  TextureFormat::BC2     },
1048      { DDS_DXT4,                  TextureFormat::BC3     },
1049      { DDS_DXT5,                  TextureFormat::BC3     },
1050      { DDS_ATI1,                  TextureFormat::BC4     },
1051      { DDS_BC4U,                  TextureFormat::BC4     },
1052      { DDS_ATI2,                  TextureFormat::BC5     },
1053      { DDS_BC5U,                  TextureFormat::BC5     },
1054      { D3DFMT_A16B16G16R16,       TextureFormat::RGBA16  },
1055      { D3DFMT_A16B16G16R16F,      TextureFormat::RGBA16F },
1056      { DDPF_RGB|DDPF_ALPHAPIXELS, TextureFormat::BGRA8   },
1057      { DDPF_INDEXED,              TextureFormat::R8      },
1058      { DDPF_LUMINANCE,            TextureFormat::R8      },
1059      { DDPF_ALPHA,                TextureFormat::R8      },
1060      { D3DFMT_R16F,               TextureFormat::R16F    },
1061      { D3DFMT_R32F,               TextureFormat::R32F    },
1062      { D3DFMT_A8L8,               TextureFormat::RG8     },
1063      { D3DFMT_G16R16,             TextureFormat::RG16    },
1064      { D3DFMT_G16R16F,            TextureFormat::RG16F   },
1065      { D3DFMT_G32R32F,            TextureFormat::RG32F   },
1066      { D3DFMT_A8R8G8B8,           TextureFormat::BGRA8   },
1067      { D3DFMT_A16B16G16R16,       TextureFormat::RGBA16  },
1068      { D3DFMT_A16B16G16R16F,      TextureFormat::RGBA16F },
1069      { D3DFMT_A32B32G32R32F,      TextureFormat::RGBA32F },
1070      { D3DFMT_R5G6B5,             TextureFormat::R5G6B5  },
1071      { D3DFMT_A4R4G4B4,           TextureFormat::RGBA4   },
1072      { D3DFMT_A1R5G5B5,           TextureFormat::RGB5A1  },
1073      { D3DFMT_A2B10G10R10,        TextureFormat::RGB10A2 },
1074   };
1075
1076   static TranslateDdsFormat s_translateDxgiFormat[] =
1077   {
1078      { DXGI_FORMAT_BC1_UNORM,          TextureFormat::BC1     },
1079      { DXGI_FORMAT_BC2_UNORM,          TextureFormat::BC2     },
1080      { DXGI_FORMAT_BC3_UNORM,          TextureFormat::BC3     },
1081      { DXGI_FORMAT_BC4_UNORM,          TextureFormat::BC4     },
1082      { DXGI_FORMAT_BC5_UNORM,          TextureFormat::BC5     },
1083      { DXGI_FORMAT_BC6H_SF16,          TextureFormat::BC6H    },
1084      { DXGI_FORMAT_BC7_UNORM,          TextureFormat::BC7     },
1085
1086      { DXGI_FORMAT_R8_UNORM,           TextureFormat::R8      },
1087      { DXGI_FORMAT_R16_UNORM,          TextureFormat::R16     },
1088      { DXGI_FORMAT_R16_FLOAT,          TextureFormat::R16F    },
1089      { DXGI_FORMAT_R32_UINT,           TextureFormat::R32     },
1090      { DXGI_FORMAT_R32_FLOAT,          TextureFormat::R32F    },
1091      { DXGI_FORMAT_R8G8_UNORM,         TextureFormat::RG8     },
1092      { DXGI_FORMAT_R16G16_UNORM,       TextureFormat::RG16    },
1093      { DXGI_FORMAT_R16G16_FLOAT,       TextureFormat::RG16F   },
1094      { DXGI_FORMAT_R32G32_UINT,        TextureFormat::RG32    },
1095      { DXGI_FORMAT_R32G32_FLOAT,       TextureFormat::RG32F   },
1096      { DXGI_FORMAT_B8G8R8A8_UNORM,     TextureFormat::BGRA8   },
1097      { DXGI_FORMAT_R16G16B16A16_UNORM, TextureFormat::RGBA16  },
1098      { DXGI_FORMAT_R16G16B16A16_FLOAT, TextureFormat::RGBA16F },
1099      { DXGI_FORMAT_R32G32B32A32_UINT,  TextureFormat::RGBA32  },
1100      { DXGI_FORMAT_R32G32B32A32_FLOAT, TextureFormat::RGBA32F },
1101      { DXGI_FORMAT_B5G6R5_UNORM,       TextureFormat::R5G6B5  },
1102      { DXGI_FORMAT_B4G4R4A4_UNORM,     TextureFormat::RGBA4   },
1103      { DXGI_FORMAT_B5G5R5A1_UNORM,     TextureFormat::RGB5A1  },
1104      { DXGI_FORMAT_R10G10B10A2_UNORM,  TextureFormat::RGB10A2 },
1105   };
1106
1107   bool imageParseDds(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader)
1108   {
1109      uint32_t headerSize;
1110      bx::read(_reader, headerSize);
1111
1112      if (headerSize < DDS_HEADER_SIZE)
1113      {
1114         return false;
1115      }
1116
1117      uint32_t flags;
1118      bx::read(_reader, flags);
1119
1120      if ( (flags & (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT) ) != (DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT) )
1121      {
1122         return false;
1123      }
1124
1125      uint32_t height;
1126      bx::read(_reader, height);
1127
1128      uint32_t width;
1129      bx::read(_reader, width);
1130
1131      uint32_t pitch;
1132      bx::read(_reader, pitch);
1133
1134      uint32_t depth;
1135      bx::read(_reader, depth);
1136
1137      uint32_t mips;
1138      bx::read(_reader, mips);
1139
1140      bx::skip(_reader, 44); // reserved
1141
1142      uint32_t pixelFormatSize;
1143      bx::read(_reader, pixelFormatSize);
1144
1145      uint32_t pixelFlags;
1146      bx::read(_reader, pixelFlags);
1147
1148      uint32_t fourcc;
1149      bx::read(_reader, fourcc);
1150
1151      uint32_t rgbCount;
1152      bx::read(_reader, rgbCount);
1153
1154      uint32_t rbitmask;
1155      bx::read(_reader, rbitmask);
1156
1157      uint32_t gbitmask;
1158      bx::read(_reader, gbitmask);
1159
1160      uint32_t bbitmask;
1161      bx::read(_reader, bbitmask);
1162
1163      uint32_t abitmask;
1164      bx::read(_reader, abitmask);
1165
1166      uint32_t caps[4];
1167      bx::read(_reader, caps);
1168
1169      bx::skip(_reader, 4); // reserved
1170
1171      uint32_t dxgiFormat = 0;
1172      if (DDPF_FOURCC == pixelFlags
1173      &&  DDS_DX10 == fourcc)
1174      {
1175         bx::read(_reader, dxgiFormat);
1176
1177         uint32_t dims;
1178         bx::read(_reader, dims);
1179
1180         uint32_t miscFlags;
1181         bx::read(_reader, miscFlags);
1182
1183         uint32_t arraySize;
1184         bx::read(_reader, arraySize);
1185
1186         uint32_t miscFlags2;
1187         bx::read(_reader, miscFlags2);
1188      }
1189
1190      if ( (caps[0] & DDSCAPS_TEXTURE) == 0)
1191      {
1192         return false;
1193      }
1194
1195      bool cubeMap = 0 != (caps[1] & DDSCAPS2_CUBEMAP);
1196      if (cubeMap)
1197      {
1198         if ( (caps[1] & DDS_CUBEMAP_ALLFACES) != DDS_CUBEMAP_ALLFACES)
1199         {
1200            // parital cube map is not supported.
1201            return false;
1202         }
1203      }
1204
1205      TextureFormat::Enum format = TextureFormat::Unknown;
1206      bool hasAlpha = pixelFlags & DDPF_ALPHAPIXELS;
1207
1208      if (dxgiFormat == 0)
1209      {
1210         uint32_t ddsFormat = pixelFlags & DDPF_FOURCC ? fourcc : pixelFlags;
1211
1212         for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDdsFormat); ++ii)
1213         {
1214            if (s_translateDdsFormat[ii].m_format == ddsFormat)
1215            {
1216               format = s_translateDdsFormat[ii].m_textureFormat;
1217               break;
1218            }
1219         }
1220      }
1221      else
1222      {
1223         for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateDxgiFormat); ++ii)
1224         {
1225            if (s_translateDxgiFormat[ii].m_format == dxgiFormat)
1226            {
1227               format = s_translateDxgiFormat[ii].m_textureFormat;
1228               break;
1229            }
1230         }
1231      }
1232
1233      _imageContainer.m_data = NULL;
1234      _imageContainer.m_size = 0;
1235      _imageContainer.m_offset = (uint32_t)bx::seek(_reader);
1236      _imageContainer.m_width = width;
1237      _imageContainer.m_height = height;
1238      _imageContainer.m_depth = depth;
1239      _imageContainer.m_format = format;
1240      _imageContainer.m_numMips = (caps[0] & DDSCAPS_MIPMAP) ? mips : 1;
1241      _imageContainer.m_hasAlpha = hasAlpha;
1242      _imageContainer.m_cubeMap = cubeMap;
1243      _imageContainer.m_ktx = false;
1244
1245      return TextureFormat::Unknown != format;
1246   }
1247
1248// KTX
1249#define KTX_MAGIC       BX_MAKEFOURCC(0xAB, 'K', 'T', 'X')
1250#define KTX_HEADER_SIZE 64
1251
1252#define KTX_ETC1_RGB8_OES                             0x8D64
1253#define KTX_COMPRESSED_R11_EAC                        0x9270
1254#define KTX_COMPRESSED_SIGNED_R11_EAC                 0x9271
1255#define KTX_COMPRESSED_RG11_EAC                       0x9272
1256#define KTX_COMPRESSED_SIGNED_RG11_EAC                0x9273
1257#define KTX_COMPRESSED_RGB8_ETC2                      0x9274
1258#define KTX_COMPRESSED_SRGB8_ETC2                     0x9275
1259#define KTX_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2  0x9276
1260#define KTX_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
1261#define KTX_COMPRESSED_RGBA8_ETC2_EAC                 0x9278
1262#define KTX_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC          0x9279
1263#define KTX_COMPRESSED_RGB_PVRTC_4BPPV1_IMG           0x8C00
1264#define KTX_COMPRESSED_RGB_PVRTC_2BPPV1_IMG           0x8C01
1265#define KTX_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG          0x8C02
1266#define KTX_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG          0x8C03
1267#define KTX_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG          0x9137
1268#define KTX_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG          0x9138
1269#define KTX_COMPRESSED_RGBA_S3TC_DXT1_EXT             0x83F1
1270#define KTX_COMPRESSED_RGBA_S3TC_DXT3_EXT             0x83F2
1271#define KTX_COMPRESSED_RGBA_S3TC_DXT5_EXT             0x83F3
1272#define KTX_COMPRESSED_LUMINANCE_LATC1_EXT            0x8C70
1273#define KTX_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT      0x8C72
1274#define KTX_COMPRESSED_RGBA_BPTC_UNORM_ARB            0x8E8C
1275#define KTX_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB      0x8E8D
1276#define KTX_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB      0x8E8E
1277#define KTX_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB    0x8E8F
1278#define KTX_R8                                        0x8229
1279#define KTX_R16                                       0x822A
1280#define KTX_RG8                                       0x822B
1281#define KTX_RG16                                      0x822C
1282#define KTX_R16F                                      0x822D
1283#define KTX_R32F                                      0x822E
1284#define KTX_RG16F                                     0x822F
1285#define KTX_RG32F                                     0x8230
1286#define KTX_RGBA16                                    0x805B
1287#define KTX_RGBA16F                                   0x881A
1288#define KTX_R32UI                                     0x8236
1289#define KTX_RG32UI                                    0x823C
1290#define KTX_RGBA32UI                                  0x8D70
1291#define KTX_BGRA                                      0x80E1
1292#define KTX_RGBA32F                                   0x8814
1293#define KTX_RGB565                                    0x8D62
1294#define KTX_RGBA4                                     0x8056
1295#define KTX_RGB5_A1                                   0x8057
1296#define KTX_RGB10_A2                                  0x8059
1297
1298   static struct TranslateKtxFormat
1299   {
1300      uint32_t m_format;
1301      TextureFormat::Enum m_textureFormat;
1302
1303   } s_translateKtxFormat[] =
1304   {
1305      { KTX_COMPRESSED_RGBA_S3TC_DXT1_EXT,             TextureFormat::BC1     },
1306      { KTX_COMPRESSED_RGBA_S3TC_DXT3_EXT,             TextureFormat::BC2     },
1307      { KTX_COMPRESSED_RGBA_S3TC_DXT5_EXT,             TextureFormat::BC3     },
1308      { KTX_COMPRESSED_LUMINANCE_LATC1_EXT,            TextureFormat::BC4     },
1309      { KTX_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT,      TextureFormat::BC5     },
1310      { KTX_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB,      TextureFormat::BC6H    },
1311      { KTX_COMPRESSED_RGBA_BPTC_UNORM_ARB,            TextureFormat::BC7     },
1312      { KTX_ETC1_RGB8_OES,                             TextureFormat::ETC1    },
1313      { KTX_COMPRESSED_RGB8_ETC2,                      TextureFormat::ETC2    },
1314      { KTX_COMPRESSED_RGBA8_ETC2_EAC,                 TextureFormat::ETC2A   },
1315      { KTX_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,  TextureFormat::ETC2A1  },
1316      { KTX_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,           TextureFormat::PTC12   },
1317      { KTX_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,          TextureFormat::PTC12A  },
1318      { KTX_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,           TextureFormat::PTC14   },
1319      { KTX_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,          TextureFormat::PTC14A  },
1320      { KTX_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG,          TextureFormat::PTC22   },
1321      { KTX_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG,          TextureFormat::PTC24   },
1322      { KTX_R8,                                        TextureFormat::R8      },
1323      { KTX_RGBA16,                                    TextureFormat::RGBA16  },
1324      { KTX_RGBA16F,                                   TextureFormat::RGBA16F },
1325      { KTX_R32UI,                                     TextureFormat::R32     },
1326      { KTX_R32F,                                      TextureFormat::R32F    },
1327      { KTX_RG8,                                       TextureFormat::RG8     },
1328      { KTX_RG16,                                      TextureFormat::RG16    },
1329      { KTX_RG16F,                                     TextureFormat::RG16F   },
1330      { KTX_RG32UI,                                    TextureFormat::RG32    },
1331      { KTX_RG32F,                                     TextureFormat::RG32F   },
1332      { KTX_BGRA,                                      TextureFormat::BGRA8   },
1333      { KTX_RGBA16,                                    TextureFormat::RGBA16  },
1334      { KTX_RGBA16F,                                   TextureFormat::RGBA16F },
1335      { KTX_RGBA32UI,                                  TextureFormat::RGBA32  },
1336      { KTX_RGBA32F,                                   TextureFormat::RGBA32F },
1337      { KTX_RGB565,                                    TextureFormat::R5G6B5  },
1338      { KTX_RGBA4,                                     TextureFormat::RGBA4   },
1339      { KTX_RGB5_A1,                                   TextureFormat::RGB5A1  },
1340      { KTX_RGB10_A2,                                  TextureFormat::RGB10A2 },
1341   };
1342
1343   bool imageParseKtx(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader)
1344   {
1345      uint8_t identifier[8];
1346      bx::read(_reader, identifier);
1347
1348      if (identifier[1] != '1'
1349      &&  identifier[2] != '1')
1350      {
1351         return false;
1352      }
1353
1354      uint32_t endianness;
1355      bx::read(_reader, endianness);
1356
1357      bool fromLittleEndian = 0x04030201 == endianness;
1358
1359      uint32_t glType;
1360      bx::readHE(_reader, glType, fromLittleEndian);
1361
1362      uint32_t glTypeSize;
1363      bx::readHE(_reader, glTypeSize, fromLittleEndian);
1364
1365      uint32_t glFormat;
1366      bx::readHE(_reader, glFormat, fromLittleEndian);
1367
1368      uint32_t glInternalFormat;
1369      bx::readHE(_reader, glInternalFormat, fromLittleEndian);
1370
1371      uint32_t glBaseInternalFormat;
1372      bx::readHE(_reader, glBaseInternalFormat, fromLittleEndian);
1373
1374      uint32_t width;
1375      bx::readHE(_reader, width, fromLittleEndian);
1376
1377      uint32_t height;
1378      bx::readHE(_reader, height, fromLittleEndian);
1379
1380      uint32_t depth;
1381      bx::readHE(_reader, depth, fromLittleEndian);
1382
1383      uint32_t numberOfArrayElements;
1384      bx::readHE(_reader, numberOfArrayElements, fromLittleEndian);
1385
1386      uint32_t numFaces;
1387      bx::readHE(_reader, numFaces, fromLittleEndian);
1388
1389      uint32_t numMips;
1390      bx::readHE(_reader, numMips, fromLittleEndian);
1391
1392      uint32_t metaDataSize;
1393      bx::readHE(_reader, metaDataSize, fromLittleEndian);
1394
1395      // skip meta garbage...
1396      int64_t offset = bx::skip(_reader, metaDataSize);
1397
1398      TextureFormat::Enum format = TextureFormat::Unknown;
1399      bool hasAlpha = false;
1400
1401      for (uint32_t ii = 0; ii < BX_COUNTOF(s_translateKtxFormat); ++ii)
1402      {
1403         if (s_translateKtxFormat[ii].m_format == glInternalFormat)
1404         {
1405            format = s_translateKtxFormat[ii].m_textureFormat;
1406            break;
1407         }
1408      }
1409
1410      _imageContainer.m_data = NULL;
1411      _imageContainer.m_size = 0;
1412      _imageContainer.m_offset = (uint32_t)offset;
1413      _imageContainer.m_width = width;
1414      _imageContainer.m_height = height;
1415      _imageContainer.m_depth = depth;
1416      _imageContainer.m_format = format;
1417      _imageContainer.m_numMips = numMips;
1418      _imageContainer.m_hasAlpha = hasAlpha;
1419      _imageContainer.m_cubeMap = numFaces > 1;
1420      _imageContainer.m_ktx = true;
1421
1422      return TextureFormat::Unknown != format;
1423   }
1424
1425// PVR3
1426#define PVR3_MAKE8CC(_a, _b, _c, _d, _e, _f, _g, _h) (uint64_t(BX_MAKEFOURCC(_a, _b, _c, _d) ) | (uint64_t(BX_MAKEFOURCC(_e, _f, _g, _h) )<<32) )
1427
1428#define PVR3_MAGIC            BX_MAKEFOURCC('P', 'V', 'R', 3)
1429#define PVR3_HEADER_SIZE      52
1430
1431#define PVR3_PVRTC1_2BPP_RGB  0
1432#define PVR3_PVRTC1_2BPP_RGBA 1
1433#define PVR3_PVRTC1_4BPP_RGB  2
1434#define PVR3_PVRTC1_4BPP_RGBA 3
1435#define PVR3_PVRTC2_2BPP_RGBA 4
1436#define PVR3_PVRTC2_4BPP_RGBA 5
1437#define PVR3_ETC1             6
1438#define PVR3_DXT1             7
1439#define PVR3_DXT2             8
1440#define PVR3_DXT3             9
1441#define PVR3_DXT4             10
1442#define PVR3_DXT5             11
1443#define PVR3_BC4              12
1444#define PVR3_BC5              13
1445#define PVR3_R8               PVR3_MAKE8CC('r',   0,   0,   0,  8,  0,  0,  0)
1446#define PVR3_R16              PVR3_MAKE8CC('r',   0,   0,   0, 16,  0,  0,  0)
1447#define PVR3_R32              PVR3_MAKE8CC('r',   0,   0,   0, 32,  0,  0,  0)
1448#define PVR3_RG8              PVR3_MAKE8CC('r', 'g',   0,   0,  8,  8,  0,  0)
1449#define PVR3_RG16             PVR3_MAKE8CC('r', 'g',   0,   0, 16, 16,  0,  0)
1450#define PVR3_RG32             PVR3_MAKE8CC('r', 'g',   0,   0, 32, 32,  0,  0)
1451#define PVR3_BGRA8            PVR3_MAKE8CC('b', 'g', 'r', 'a',  8,  8,  8,  8)
1452#define PVR3_RGBA16           PVR3_MAKE8CC('r', 'g', 'b', 'a', 16, 16, 16, 16)
1453#define PVR3_RGBA32           PVR3_MAKE8CC('r', 'g', 'b', 'a', 32, 32, 32, 32)
1454#define PVR3_RGB565           PVR3_MAKE8CC('r', 'g', 'b',   0,  5,  6,  5,  0)
1455#define PVR3_RGBA4            PVR3_MAKE8CC('r', 'g', 'b', 'a',  4,  4,  4,  4)
1456#define PVR3_RGBA51           PVR3_MAKE8CC('r', 'g', 'b', 'a',  5,  5,  5,  1)
1457#define PVR3_RGB10A2          PVR3_MAKE8CC('r', 'g', 'b', 'a', 10, 10, 10,  2)
1458
1459#define PVR3_CHANNEL_TYPE_ANY   UINT32_MAX
1460#define PVR3_CHANNEL_TYPE_FLOAT UINT32_C(12)
1461
1462   static struct TranslatePvr3Format
1463   {
1464      uint64_t m_format;
1465      uint32_t m_channelTypeMask;
1466      TextureFormat::Enum m_textureFormat;
1467
1468   } s_translatePvr3Format[] =
1469   {
1470      { PVR3_PVRTC1_2BPP_RGB,  PVR3_CHANNEL_TYPE_ANY,   TextureFormat::PTC12   },
1471      { PVR3_PVRTC1_2BPP_RGBA, PVR3_CHANNEL_TYPE_ANY,   TextureFormat::PTC12A  },
1472      { PVR3_PVRTC1_4BPP_RGB,  PVR3_CHANNEL_TYPE_ANY,   TextureFormat::PTC14   },
1473      { PVR3_PVRTC1_4BPP_RGBA, PVR3_CHANNEL_TYPE_ANY,   TextureFormat::PTC14A  },
1474      { PVR3_PVRTC2_2BPP_RGBA, PVR3_CHANNEL_TYPE_ANY,   TextureFormat::PTC22   },
1475      { PVR3_PVRTC2_4BPP_RGBA, PVR3_CHANNEL_TYPE_ANY,   TextureFormat::PTC24   },
1476      { PVR3_ETC1,             PVR3_CHANNEL_TYPE_ANY,   TextureFormat::ETC1    },
1477      { PVR3_DXT1,             PVR3_CHANNEL_TYPE_ANY,   TextureFormat::BC1     },
1478      { PVR3_DXT2,             PVR3_CHANNEL_TYPE_ANY,   TextureFormat::BC2     },
1479      { PVR3_DXT3,             PVR3_CHANNEL_TYPE_ANY,   TextureFormat::BC2     },
1480      { PVR3_DXT4,             PVR3_CHANNEL_TYPE_ANY,   TextureFormat::BC3     },
1481      { PVR3_DXT5,             PVR3_CHANNEL_TYPE_ANY,   TextureFormat::BC3     },
1482      { PVR3_BC4,              PVR3_CHANNEL_TYPE_ANY,   TextureFormat::BC4     },
1483      { PVR3_BC5,              PVR3_CHANNEL_TYPE_ANY,   TextureFormat::BC5     },
1484      { PVR3_R8,               PVR3_CHANNEL_TYPE_ANY,   TextureFormat::R8      },
1485      { PVR3_R16,              PVR3_CHANNEL_TYPE_ANY,   TextureFormat::R16     },
1486      { PVR3_R16,              PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::R16F    },
1487      { PVR3_R32,              PVR3_CHANNEL_TYPE_ANY,   TextureFormat::R32     },
1488      { PVR3_R32,              PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::R32F    },
1489      { PVR3_RG8,              PVR3_CHANNEL_TYPE_ANY,   TextureFormat::RG8     },
1490      { PVR3_RG16,             PVR3_CHANNEL_TYPE_ANY,   TextureFormat::RG16    },
1491      { PVR3_RG16,             PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::RG16F   },
1492      { PVR3_RG32,             PVR3_CHANNEL_TYPE_ANY,   TextureFormat::RG16    },
1493      { PVR3_RG32,             PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::RG32F   },
1494      { PVR3_BGRA8,            PVR3_CHANNEL_TYPE_ANY,   TextureFormat::BGRA8   },
1495      { PVR3_RGBA16,           PVR3_CHANNEL_TYPE_ANY,   TextureFormat::RGBA16  },
1496      { PVR3_RGBA16,           PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::RGBA16F },
1497      { PVR3_RGBA32,           PVR3_CHANNEL_TYPE_ANY,   TextureFormat::RGBA32  },
1498      { PVR3_RGBA32,           PVR3_CHANNEL_TYPE_FLOAT, TextureFormat::RGBA32F },
1499      { PVR3_RGB565,           PVR3_CHANNEL_TYPE_ANY,   TextureFormat::R5G6B5  },
1500      { PVR3_RGBA4,            PVR3_CHANNEL_TYPE_ANY,   TextureFormat::RGBA4   },
1501      { PVR3_RGBA51,           PVR3_CHANNEL_TYPE_ANY,   TextureFormat::RGB5A1  },
1502      { PVR3_RGB10A2,          PVR3_CHANNEL_TYPE_ANY,   TextureFormat::RGB10A2 },
1503   };
1504
1505   bool imageParsePvr3(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader)
1506   {
1507      uint32_t flags;
1508      bx::read(_reader, flags);
1509
1510      uint64_t pixelFormat;
1511      bx::read(_reader, pixelFormat);
1512
1513      uint32_t colorSpace;
1514      bx::read(_reader, colorSpace); // 0 - linearRGB, 1 - sRGB
1515
1516      uint32_t channelType;
1517      bx::read(_reader, channelType);
1518
1519      uint32_t height;
1520      bx::read(_reader, height);
1521
1522      uint32_t width;
1523      bx::read(_reader, width);
1524
1525      uint32_t depth;
1526      bx::read(_reader, depth);
1527
1528      uint32_t numSurfaces;
1529      bx::read(_reader, numSurfaces);
1530
1531      uint32_t numFaces;
1532      bx::read(_reader, numFaces);
1533
1534      uint32_t numMips;
1535      bx::read(_reader, numMips);
1536
1537      uint32_t metaDataSize;
1538      bx::read(_reader, metaDataSize);
1539
1540      // skip meta garbage...
1541      int64_t offset = bx::skip(_reader, metaDataSize);
1542
1543      TextureFormat::Enum format = TextureFormat::Unknown;
1544      bool hasAlpha = false;
1545
1546      for (uint32_t ii = 0; ii < BX_COUNTOF(s_translatePvr3Format); ++ii)
1547      {
1548         if (s_translatePvr3Format[ii].m_format == pixelFormat
1549         &&  channelType == (s_translatePvr3Format[ii].m_channelTypeMask & channelType) )
1550         {
1551            format = s_translatePvr3Format[ii].m_textureFormat;
1552            break;
1553         }
1554      }
1555
1556      _imageContainer.m_data = NULL;
1557      _imageContainer.m_size = 0;
1558      _imageContainer.m_offset = (uint32_t)offset;
1559      _imageContainer.m_width = width;
1560      _imageContainer.m_height = height;
1561      _imageContainer.m_depth = depth;
1562      _imageContainer.m_format = format;
1563      _imageContainer.m_numMips = numMips;
1564      _imageContainer.m_hasAlpha = hasAlpha;
1565      _imageContainer.m_cubeMap = numFaces > 1;
1566      _imageContainer.m_ktx = false;
1567
1568      return TextureFormat::Unknown != format;
1569   }
1570
1571   bool imageParse(ImageContainer& _imageContainer, bx::ReaderSeekerI* _reader)
1572   {
1573      uint32_t magic;
1574      bx::read(_reader, magic);
1575
1576      if (DDS_MAGIC == magic)
1577      {
1578         return imageParseDds(_imageContainer, _reader);
1579      }
1580      else if (KTX_MAGIC == magic)
1581      {
1582         return imageParseKtx(_imageContainer, _reader);
1583      }
1584      else if (PVR3_MAGIC == magic)
1585      {
1586         return imageParsePvr3(_imageContainer, _reader);
1587      }
1588      else if (BGFX_CHUNK_MAGIC_TEX == magic)
1589      {
1590         TextureCreate tc;
1591         bx::read(_reader, tc);
1592
1593         _imageContainer.m_format = tc.m_format;
1594         _imageContainer.m_offset = UINT32_MAX;
1595         if (NULL == tc.m_mem)
1596         {
1597            _imageContainer.m_data = NULL;
1598            _imageContainer.m_size = 0;
1599         }
1600         else
1601         {
1602            _imageContainer.m_data = tc.m_mem->data;
1603            _imageContainer.m_size = tc.m_mem->size;
1604         }
1605         _imageContainer.m_width = tc.m_width;
1606         _imageContainer.m_height = tc.m_height;
1607         _imageContainer.m_depth = tc.m_depth;
1608         _imageContainer.m_numMips = tc.m_numMips;
1609         _imageContainer.m_hasAlpha = false;
1610         _imageContainer.m_cubeMap = tc.m_cubeMap;
1611         _imageContainer.m_ktx = false;
1612
1613         return true;
1614      }
1615
1616      return false;
1617   }
1618
1619   bool imageParse(ImageContainer& _imageContainer, const void* _data, uint32_t _size)
1620   {
1621      bx::MemoryReader reader(_data, _size);
1622      return imageParse(_imageContainer, &reader);
1623   }
1624
1625   void imageDecodeToBgra8(uint8_t* _dst, const uint8_t* _src, uint32_t _width, uint32_t _height, uint32_t _pitch, uint8_t _type)
1626   {
1627      const uint8_t* src = _src;
1628
1629      uint32_t width  = _width/4;
1630      uint32_t height = _height/4;
1631
1632      uint8_t temp[16*4];
1633
1634      switch (_type)
1635      {
1636      case TextureFormat::BC1:
1637         for (uint32_t yy = 0; yy < height; ++yy)
1638         {
1639            for (uint32_t xx = 0; xx < width; ++xx)
1640            {
1641               decodeBlockDxt1(temp, src);
1642               src += 8;
1643
1644               uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
1645               memcpy(&dst[0*_pitch], &temp[ 0], 16);
1646               memcpy(&dst[1*_pitch], &temp[16], 16);
1647               memcpy(&dst[2*_pitch], &temp[32], 16);
1648               memcpy(&dst[3*_pitch], &temp[48], 16);
1649            }
1650         }
1651         break;
1652
1653      case TextureFormat::BC2:
1654         for (uint32_t yy = 0; yy < height; ++yy)
1655         {
1656            for (uint32_t xx = 0; xx < width; ++xx)
1657            {
1658               decodeBlockDxt23A(temp+3, src);
1659               src += 8;
1660               decodeBlockDxt(temp, src);
1661               src += 8;
1662
1663               uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
1664               memcpy(&dst[0*_pitch], &temp[ 0], 16);
1665               memcpy(&dst[1*_pitch], &temp[16], 16);
1666               memcpy(&dst[2*_pitch], &temp[32], 16);
1667               memcpy(&dst[3*_pitch], &temp[48], 16);
1668            }
1669         }
1670         break;
1671
1672      case TextureFormat::BC3:
1673         for (uint32_t yy = 0; yy < height; ++yy)
1674         {
1675            for (uint32_t xx = 0; xx < width; ++xx)
1676            {
1677               decodeBlockDxt45A(temp+3, src);
1678               src += 8;
1679               decodeBlockDxt(temp, src);
1680               src += 8;
1681
1682               uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
1683               memcpy(&dst[0*_pitch], &temp[ 0], 16);
1684               memcpy(&dst[1*_pitch], &temp[16], 16);
1685               memcpy(&dst[2*_pitch], &temp[32], 16);
1686               memcpy(&dst[3*_pitch], &temp[48], 16);
1687            }
1688         }
1689         break;
1690
1691      case TextureFormat::BC4:
1692         for (uint32_t yy = 0; yy < height; ++yy)
1693         {
1694            for (uint32_t xx = 0; xx < width; ++xx)
1695            {
1696               decodeBlockDxt45A(temp, src);
1697               src += 8;
1698
1699               uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
1700               memcpy(&dst[0*_pitch], &temp[ 0], 16);
1701               memcpy(&dst[1*_pitch], &temp[16], 16);
1702               memcpy(&dst[2*_pitch], &temp[32], 16);
1703               memcpy(&dst[3*_pitch], &temp[48], 16);
1704            }
1705         }
1706         break;
1707
1708      case TextureFormat::BC5:
1709         for (uint32_t yy = 0; yy < height; ++yy)
1710         {
1711            for (uint32_t xx = 0; xx < width; ++xx)
1712            {
1713               decodeBlockDxt45A(temp+1, src);
1714               src += 8;
1715               decodeBlockDxt45A(temp+2, src);
1716               src += 8;
1717
1718               for (uint32_t ii = 0; ii < 16; ++ii)
1719               {
1720                  float nx = temp[ii*4+2]*2.0f/255.0f - 1.0f;
1721                  float ny = temp[ii*4+1]*2.0f/255.0f - 1.0f;
1722                  float nz = sqrtf(1.0f - nx*nx - ny*ny);
1723                  temp[ii*4+0] = uint8_t( (nz + 1.0f)*255.0f/2.0f);
1724                  temp[ii*4+3] = 0;
1725               }
1726
1727               uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
1728               memcpy(&dst[0*_pitch], &temp[ 0], 16);
1729               memcpy(&dst[1*_pitch], &temp[16], 16);
1730               memcpy(&dst[2*_pitch], &temp[32], 16);
1731               memcpy(&dst[3*_pitch], &temp[48], 16);
1732            }
1733         }
1734         break;
1735
1736      case TextureFormat::ETC1:
1737      case TextureFormat::ETC2:
1738         for (uint32_t yy = 0; yy < height; ++yy)
1739         {
1740            for (uint32_t xx = 0; xx < width; ++xx)
1741            {
1742               decodeBlockEtc12(temp, src);
1743               src += 8;
1744
1745               uint8_t* dst = &_dst[(yy*_pitch+xx*4)*4];
1746               memcpy(&dst[0*_pitch], &temp[ 0], 16);
1747               memcpy(&dst[1*_pitch], &temp[16], 16);
1748               memcpy(&dst[2*_pitch], &temp[32], 16);
1749               memcpy(&dst[3*_pitch], &temp[48], 16);
1750            }
1751         }
1752         break;
1753
1754      case TextureFormat::ETC2A:
1755         BX_WARN(false, "ETC2A decoder is not implemented.");
1756         imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xff00ff00), _dst);
1757         break;
1758
1759      case TextureFormat::ETC2A1:
1760         BX_WARN(false, "ETC2A1 decoder is not implemented.");
1761         imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffff0000), _dst);
1762         break;
1763
1764      case TextureFormat::PTC12:
1765         BX_WARN(false, "PTC12 decoder is not implemented.");
1766         imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffff00ff), _dst);
1767         break;
1768
1769      case TextureFormat::PTC12A:
1770         BX_WARN(false, "PTC12A decoder is not implemented.");
1771         imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffff00), _dst);
1772         break;
1773
1774      case TextureFormat::PTC14:
1775         BX_WARN(false, "PTC14 decoder is not implemented.");
1776         imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xff00ffff), _dst);
1777         break;
1778
1779      case TextureFormat::PTC14A:
1780         BX_WARN(false, "PTC14A decoder is not implemented.");
1781         imageCheckerboard(_width, _height, 16, UINT32_C(0xffff0000), UINT32_C(0xff0000ff), _dst);
1782         break;
1783
1784      case TextureFormat::PTC22:
1785         BX_WARN(false, "PTC22 decoder is not implemented.");
1786         imageCheckerboard(_width, _height, 16, UINT32_C(0xff00ff00), UINT32_C(0xff0000ff), _dst);
1787         break;
1788
1789      case TextureFormat::PTC24:
1790         BX_WARN(false, "PTC24 decoder is not implemented.");
1791         imageCheckerboard(_width, _height, 16, UINT32_C(0xff000000), UINT32_C(0xffffffff), _dst);
1792         break;
1793
1794      default:
1795         // Decompression not implemented... Make ugly red-yellow checkerboard texture.
1796         imageCheckerboard(_width, _height, 16, UINT32_C(0xffff0000), UINT32_C(0xffffff00), _dst);
1797         break;
1798      }
1799   }
1800
1801   bool imageGetRawData(const ImageContainer& _imageContainer, uint8_t _side, uint8_t _lod, const void* _data, uint32_t _size, ImageMip& _mip)
1802   {
1803      uint32_t offset = _imageContainer.m_offset;
1804      TextureFormat::Enum type = TextureFormat::Enum(_imageContainer.m_format);
1805      bool hasAlpha = _imageContainer.m_hasAlpha;
1806
1807      const ImageBlockInfo& blockInfo = s_imageBlockInfo[type];
1808      const uint8_t  bpp         = blockInfo.bitsPerPixel;
1809      const uint32_t blockSize   = blockInfo.blockSize;
1810      const uint32_t blockWidth  = blockInfo.blockWidth;
1811      const uint32_t blockHeight = blockInfo.blockHeight;
1812
1813      if (UINT32_MAX == _imageContainer.m_offset)
1814      {
1815         if (NULL == _imageContainer.m_data)
1816         {
1817            return false;
1818         }
1819
1820         offset = 0;
1821         _data = _imageContainer.m_data;
1822         _size = _imageContainer.m_size;
1823      }
1824
1825      for (uint8_t side = 0, numSides = _imageContainer.m_cubeMap ? 6 : 1; side < numSides; ++side)
1826      {
1827         uint32_t width  = _imageContainer.m_width;
1828         uint32_t height = _imageContainer.m_height;
1829         uint32_t depth  = _imageContainer.m_depth;
1830
1831         for (uint8_t lod = 0, num = _imageContainer.m_numMips; lod < num; ++lod)
1832         {
1833            // skip imageSize in KTX format.
1834            offset += _imageContainer.m_ktx ? sizeof(uint32_t) : 0;
1835
1836            width  = bx::uint32_max(blockWidth,  ( (width +blockWidth -1)/blockWidth )*blockWidth);
1837            height = bx::uint32_max(blockHeight, ( (height+blockHeight-1)/blockHeight)*blockHeight);
1838            depth  = bx::uint32_max(1, depth);
1839
1840            uint32_t size = width*height*depth*bpp/8;
1841
1842            if (side == _side
1843            &&  lod == _lod)
1844            {
1845               _mip.m_width = width;
1846               _mip.m_height = height;
1847               _mip.m_blockSize = blockSize;
1848               _mip.m_size = size;
1849               _mip.m_data = (const uint8_t*)_data + offset;
1850               _mip.m_bpp = bpp;
1851               _mip.m_format = type;
1852               _mip.m_hasAlpha = hasAlpha;
1853               return true;
1854            }
1855
1856            offset += size;
1857
1858            BX_CHECK(offset <= _size, "Reading past size of data buffer! (offset %d, size %d)", offset, _size);
1859            BX_UNUSED(_size);
1860
1861            width  >>= 1;
1862            height >>= 1;
1863            depth  >>= 1;
1864         }
1865      }
1866
1867      return false;
1868   }
1869
1870} // namespace bgfx
Property changes on: branches/osd/src/lib/bgfx/image.cpp
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/src/lib/bgfx/fs_clear1.sc
r0r31734
1$input v_color0
2
3/*
4 * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
5 * License: http://www.opensource.org/licenses/BSD-2-Clause
6 */
7
8#include "bgfx_shader.sh"
9
10void main()
11{
12   gl_FragData[0] = v_color0;
13   gl_FragData[1] = v_color0;
14}
Property changes on: branches/osd/src/lib/bgfx/fs_clear1.sc
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
branches/osd/makefile
r31733r31734
493493
494494# CFLAGS is defined based on C or C++ targets
495495# (remember, expansion only happens when used, so doing it here is ok)
496CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
496CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS) $(INCPATH)
497497
498498# we compile C-only to C89 standard with GNU extensions
499499# we compile C++ code to C++98 standard with GNU extensions
r31733r31734
762762# add SQLite3 library
763763SQLITE3_LIB = $(OBJ)/libsqlite3.a
764764
765# add BGFX library
766BGFX_LIB = $(OBJ)/libbgfx.a
767
765768# add PortMidi MIDI library
766769ifeq ($(BUILD_MIDILIB),1)
767770INCPATH += -I$(SRC)/lib/portmidi
r31733r31734
817820include $(SRC)/regtests/regtests.mak
818821
819822# combine the various definitions to one
820CCOMFLAGS += $(INCPATH)
821823CDEFS = $(DEFS)
822824
823825# TODO: -x c++ should not be hard-coded
r31733r31734
885887
886888ifndef EXECUTABLE_DEFINED
887889
888$(EMULATOR): $(EMUINFOOBJ) $(DRIVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBBUS) $(LIBOPTIONAL) $(LIBEMU) $(LIBDASM) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(JPEG_LIB) $(FLAC_LIB) $(7Z_LIB) $(FORMATS_LIB) $(LUA_LIB) $(SQLITE3_LIB) $(WEB_LIB) $(ZLIB) $(LIBOCORE) $(MIDI_LIB) $(RESFILE)
890$(EMULATOR): $(EMUINFOOBJ) $(DRIVLISTOBJ) $(DRVLIBS) $(LIBOSD) $(LIBBUS) $(LIBOPTIONAL) $(LIBEMU) $(LIBDASM) $(LIBUTIL) $(EXPAT) $(SOFTFLOAT) $(JPEG_LIB) $(FLAC_LIB) $(7Z_LIB) $(FORMATS_LIB) $(LUA_LIB) $(SQLITE3_LIB) $(WEB_LIB) $(BGFX_LIB) $(ZLIB) $(LIBOCORE) $(MIDI_LIB) $(RESFILE)
889891   $(CC) $(CDEFS) $(CFLAGS) -c $(SRC)/version.c -o $(VERSIONOBJ)
890892   @echo Linking $@...
891893   $(LD) $(LDFLAGS) $(LDFLAGSEMULATOR) $(VERSIONOBJ) $^ $(LIBS) -o $@
r31733r31734
961963ifeq ($(TARGETOS),macosx)
962964$(OBJ)/%.o: $(SRC)/%.m | $(OSPREBUILD)
963965   @echo Objective-C compiling $<...
964   $(CC) $(CDEFS) $(COBJFLAGS) $(CCOMFLAGS) -c $< -o $@
966   $(CC) $(CDEFS) $(COBJFLAGS) $(CCOMFLAGS) $(INCPATH) -c $< -o $@
965967endif
966968
967969

Previous 199869 Revisions Next


© 1997-2024 The MAME Team