GteGL4Texture.cpp
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #include <GTEnginePCH.h>
10 using namespace gte;
11 
13  :
14  GL4Resource(texture),
15  mTarget(target),
16  mTargetBinding(targetBinding),
17  mNumLevels(texture->GetNumLevels()),
18  mInternalFormat(msGLTextureInternalFormat[texture->GetFormat()]),
19  mExternalFormat(msGLTextureExternalFormat[texture->GetFormat()]),
20  mExternalType(msGLTextureExternalType[DataFormat::GetChannelType(texture->GetFormat())])
21 {
22 }
23 
25 {
26  0, // DF_UNKNOWN
27  0, // DF_R32G32B32A32_TYPELESS
28  GL_RGBA32F, // DF_R32G32B32A32_FLOAT
29  GL_RGBA32UI, // DF_R32G32B32A32_UINT
30  GL_RGBA32I, // DF_R32G32B32A32_SINT
31  0, // DF_R32G32B32_TYPELESS
32  GL_RGB32F, // DF_R32G32B32_FLOAT
33  GL_RGB32UI, // DF_R32G32B32_UINT
34  GL_RGB32I, // DF_R32G32B32_SINT
35  0, // DF_R16G16B16A16_TYPELESS
36  GL_RGBA16F, // DF_R16G16B16A16_FLOAT
37  GL_RGBA16, // DF_R16G16B16A16_UNORM
38  GL_RGBA16UI, // DF_R16G16B16A16_UINT
39  GL_RGBA16_SNORM, // DF_R16G16B16A16_SNORM
40  GL_RGBA16I, // DF_R16G16B16A16_SINT
41  0, // DF_R32G32_TYPELESS
42  GL_RG32F, // DF_R32G32_FLOAT
43  GL_RG32UI, // DF_R32G32_UINT
44  GL_RG32I, // DF_R32G32_SINT
45  0, // DF_R32G8X24_TYPELESS
46  0, // DF_D32_FLOAT_S8X24_UINT
47  0, // DF_R32_FLOAT_X8X24_TYPELESS
48  0, // DF_X32_TYPELESS_G8X24_UINT
49  0, // DF_R10G10B10A2_TYPELESS
50  0, // DF_R10G10B10A2_UNORM
51  0, // DF_R10G10B10A2_UINT
52  GL_R11F_G11F_B10F, // DF_R11G11B10_FLOAT
53  0, // DF_R8G8B8A8_TYPELESS
54  GL_RGBA8, // DF_R8G8B8A8_UNORM
55  GL_RGBA8, // DF_R8G8B8A8_UNORM_SRGB
56  GL_RGBA8UI, // DF_R8G8B8A8_UINT
57  GL_RGBA8_SNORM, // DF_R8G8B8A8_SNORM
58  GL_RGBA8I, // DF_R8G8B8A8_SINT
59  0, // DF_R16G16_TYPELESS
60  GL_RG16F, // DF_R16G16_FLOAT
61  GL_RG16, // DF_R16G16_UNORM
62  GL_RG16UI, // DF_R16G16_UINT
63  GL_R16_SNORM, // DF_R16G16_SNORM
64  GL_R16I, // DF_R16G16_SINT
65  0, // DF_R32_TYPELESS
66  GL_DEPTH_COMPONENT32F, // DF_D32_FLOAT
67  GL_R32F, // DF_R32_FLOAT
68  GL_R32UI, // DF_R32_UINT
69  GL_R32I, // DF_R32_SINT
70  0, // DF_R24G8_TYPELESS
71  GL_DEPTH24_STENCIL8, // DF_D24_UNORM_S8_UINT
72  0, // DF_R24_UNORM_X8_TYPELESS
73  0, // DF_X24_TYPELESS_G8_UINT
74  0, // DF_R8G8_TYPELESS
75  GL_RG8, // DF_R8G8_UNORM
76  GL_RG8UI, // DF_R8G8_UINT
77  GL_RG8_SNORM, // DF_R8G8_SNORM
78  GL_RG8I, // DF_R8G8_SINT
79  0, // DF_R16_TYPELESS
80  GL_R16F, // DF_R16_FLOAT
81  GL_DEPTH_COMPONENT16, // DF_D16_UNORM
82  GL_R16, // DF_R16_UNORM
83  GL_R16UI, // DF_R16_UINT
84  GL_R16_SNORM, // DF_R16_SNORM
85  GL_R16I, // DF_R16_SINT
86  0, // DF_R8_TYPELESS
87  GL_R8, // DF_R8_UNORM
88  GL_R8UI, // DF_R8_UINT
89  GL_R8_SNORM, // DF_R8_SNORM
90  GL_R8I, // DF_R8_SINT
91  0, // DF_A8_UNORM
92  0, // DF_R1_UNORM
93  GL_RGB9_E5, // DF_R9G9B9E5_SHAREDEXP
94  0, // DF_R8G8_B8G8_UNORM
95  0, // DF_G8R8_G8B8_UNORM
96  0, // DF_BC1_TYPELESS
97  0, // DF_BC1_UNORM
98  0, // DF_BC1_UNORM_SRGB
99  0, // DF_BC2_TYPELESS
100  0, // DF_BC2_UNORM
101  0, // DF_BC2_UNORM_SRGB
102  0, // DF_BC3_TYPELESS
103  0, // DF_BC3_UNORM
104  0, // DF_BC3_UNORM_SRGB
105  0, // DF_BC4_TYPELESS
106  0, // DF_BC4_UNORM
107  0, // DF_BC4_SNORM
108  0, // DF_BC5_TYPELESS
109  0, // DF_BC5_UNORM
110  0, // DF_BC5_SNORM
111  GL_RGB565, // DF_B5G6R5_UNORM
112  GL_RGB5_A1, // DF_B5G5R5A1_UNORM
113  GL_RGBA8, // DF_B8G8R8A8_UNORM
114  GL_RGBA8, // DF_B8G8R8X8_UNORM
115  GL_RGB10_A2, // DF_R10G10B10_XR_BIAS_A2_UNORM
116  0, // DF_B8G8R8A8_TYPELESS
117  GL_RGBA8, // DF_B8G8R8A8_UNORM_SRGB
118  0, // DF_B8G8R8X8_TYPELESS
119  GL_RGBA8, // DF_B8G8R8X8_UNORM_SRGB
120  0, // DF_BC6H_TYPELESS
121  0, // DF_BC6H_UF16
122  0, // DF_BC6H_SF16
123  0, // DF_BC7_TYPELESS
124  0, // DF_BC7_UNORM
125  0, // DF_BC7_UNORM_SRGB
126  // DX11.1 formats (TODO: Determine number of channels)
127  0, // DF_AYUV
128  0, // DF_Y410
129  0, // DF_Y416
130  0, // DF_NV12
131  0, // DF_P010
132  0, // DF_P016
133  0, // DF_420_OPAQUE
134  0, // DF_YUY2
135  0, // DF_Y210
136  0, // DF_Y216
137  0, // DF_NV11
138  0, // DF_AI44
139  0, // DF_IA44
140  0, // DF_P8
141  0, // DF_A8P8
142  0 // DF_B4G4R4A4_UNORM
143 };
144 
145 GLuint const GL4Texture::msGLTextureExternalFormat[DF_NUM_FORMATS]
146 {
147  0, // DF_UNKNOWN
148  GL_RGBA, // DF_R32G32B32A32_TYPELESS
149  GL_RGBA, // DF_R32G32B32A32_FLOAT
150  GL_RGBA_INTEGER, // DF_R32G32B32A32_UINT
151  GL_RGBA_INTEGER, // DF_R32G32B32A32_SINT
152  GL_RGB, // DF_R32G32B32_TYPELESS
153  GL_RGB, // DF_R32G32B32_FLOAT
154  GL_RGB_INTEGER, // DF_R32G32B32_UINT
155  GL_RGB_INTEGER, // DF_R32G32B32_SINT
156  GL_RGBA, // DF_R16G16B16A16_TYPELESS
157  GL_RGBA, // DF_R16G16B16A16_FLOAT
158  GL_RGBA, // DF_R16G16B16A16_UNORM
159  GL_RGBA_INTEGER, // DF_R16G16B16A16_UINT
160  GL_RGBA, // DF_R16G16B16A16_SNORM
161  GL_RGBA_INTEGER, // DF_R16G16B16A16_SINT
162  GL_RG, // DF_R32G32_TYPELESS
163  GL_RG, // DF_R32G32_FLOAT
164  GL_RG_INTEGER, // DF_R32G32_UINT
165  GL_RG_INTEGER, // DF_R32G32_SINT
166  0, // DF_R32G8X24_TYPELESS
167  0, // DF_D32_FLOAT_S8X24_UINT
168  0, // DF_R32_FLOAT_X8X24_TYPELESS
169  0, // DF_X32_TYPELESS_G8X24_UINT
170  GL_RGBA, // DF_R10G10B10A2_TYPELESS
171  GL_RGBA, // DF_R10G10B10A2_UNORM
172  GL_RGBA_INTEGER, // DF_R10G10B10A2_UINT
173  GL_RGB, // DF_R11G11B10_FLOAT
174  GL_RGBA, // DF_R8G8B8A8_TYPELESS
175  GL_RGBA, // DF_R8G8B8A8_UNORM
176  GL_RGBA, // DF_R8G8B8A8_UNORM_SRGB
177  GL_RGBA_INTEGER, // DF_R8G8B8A8_UINT
178  GL_RGBA, // DF_R8G8B8A8_SNORM
179  GL_RGBA_INTEGER, // DF_R8G8B8A8_SINT
180  GL_RG, // DF_R16G16_TYPELESS
181  GL_RG, // DF_R16G16_FLOAT
182  GL_RG, // DF_R16G16_UNORM
183  GL_RG_INTEGER, // DF_R16G16_UINT
184  GL_RG, // DF_R16G16_SNORM
185  GL_RG_INTEGER, // DF_R16G16_SINT
186  GL_RED, // DF_R32_TYPELESS
187  GL_DEPTH_COMPONENT, // DF_D32_FLOAT
188  GL_RED, // DF_R32_FLOAT
189  GL_RED_INTEGER, // DF_R32_UINT
190  GL_RED_INTEGER, // DF_R32_SINT
191  GL_RG, // DF_R24G8_TYPELESS
192  GL_DEPTH_COMPONENT, // DF_D24_UNORM_S8_UINT
193  0, // DF_R24_UNORM_X8_TYPELESS
194  0, // DF_X24_TYPELESS_G8_UINT
195  GL_RG, // DF_R8G8_TYPELESS
196  GL_RG, // DF_R8G8_UNORM
197  GL_RG_INTEGER, // DF_R8G8_UINT
198  GL_RG, // DF_R8G8_SNORM
199  GL_RG_INTEGER, // DF_R8G8_SINT
200  GL_RED, // DF_R16_TYPELESS
201  GL_RED, // DF_R16_FLOAT
202  GL_DEPTH_COMPONENT, // DF_D16_UNORM
203  GL_RED, // DF_R16_UNORM
204  GL_RED_INTEGER, // DF_R16_UINT
205  GL_RED, // DF_R16_SNORM
206  GL_RED_INTEGER, // DF_R16_SINT
207  GL_RED, // DF_R8_TYPELESS
208  GL_RED, // DF_R8_UNORM
209  GL_RED_INTEGER, // DF_R8_UINT
210  GL_RED, // DF_R8_SNORM
211  GL_RED_INTEGER, // DF_R8_SINT
212  0, // DF_A8_UNORM
213  0, // DF_R1_UNORM
214  0, // DF_R9G9B9E5_SHAREDEXP
215  0, // DF_R8G8_B8G8_UNORM
216  0, // DF_G8R8_G8B8_UNORM
217  0, // DF_BC1_TYPELESS
218  0, // DF_BC1_UNORM
219  0, // DF_BC1_UNORM_SRGB
220  0, // DF_BC2_TYPELESS
221  0, // DF_BC2_UNORM
222  0, // DF_BC2_UNORM_SRGB
223  0, // DF_BC3_TYPELESS
224  0, // DF_BC3_UNORM
225  0, // DF_BC3_UNORM_SRGB
226  0, // DF_BC4_TYPELESS
227  0, // DF_BC4_UNORM
228  0, // DF_BC4_SNORM
229  0, // DF_BC5_TYPELESS
230  0, // DF_BC5_UNORM
231  0, // DF_BC5_SNORM
232  GL_BGR, // DF_B5G6R5_UNORM
233  GL_BGRA, // DF_B5G5R5A1_UNORM
234  GL_BGRA, // DF_B8G8R8A8_UNORM
235  GL_BGRA, // DF_B8G8R8X8_UNORM
236  0, // DF_R10G10B10_XR_BIAS_A2_UNORM
237  GL_BGRA, // DF_B8G8R8A8_TYPELESS
238  GL_BGRA, // DF_B8G8R8A8_UNORM_SRGB
239  GL_BGRA, // DF_B8G8R8X8_TYPELESS
240  GL_BGRA, // DF_B8G8R8X8_UNORM_SRGB
241  0, // DF_BC6H_TYPELESS
242  0, // DF_BC6H_UF16
243  0, // DF_BC6H_SF16
244  0, // DF_BC7_TYPELESS
245  0, // DF_BC7_UNORM
246  0, // DF_BC7_UNORM_SRGB
247  // DX11.1 formats (TODO: Determine number of channels)
248  0, // DF_AYUV
249  0, // DF_Y410
250  0, // DF_Y416
251  0, // DF_NV12
252  0, // DF_P010
253  0, // DF_P016
254  0, // DF_420_OPAQUE
255  0, // DF_YUY2
256  0, // DF_Y210
257  0, // DF_Y216
258  0, // DF_NV11
259  0, // DF_AI44
260  0, // DF_IA44
261  0, // DF_P8
262  0, // DF_A8P8
263  0 // DF_B4G4R4A4_UNORM
264 };
265 
266 GLuint const GL4Texture::msGLTextureExternalType[DF_NUM_CHANNEL_TYPES] =
267 {
268  GL_ZERO, // DF_UNSUPPORTED
269  GL_BYTE, // DF_BYTE
270  GL_UNSIGNED_BYTE, // DF_UBYTE
271  GL_SHORT, // DF_SHORT
272  GL_UNSIGNED_SHORT, // DF_USHORT
273  GL_INT, // DF_INT
274  GL_UNSIGNED_INT, // DF_UINT
275  GL_HALF_FLOAT, // DF_HALF_FLOAT
276  GL_FLOAT, // DF_FLOAT
277  GL_DOUBLE, // DF_DOUBLE
278  GL_INT_2_10_10_10_REV, // DF_INT_10_10_2
279  GL_UNSIGNED_INT_2_10_10_10_REV, // DF_UINT_10_10_2
280  GL_UNSIGNED_INT_10F_11F_11F_REV // DF_FLOAT_11_11_10
281 };
#define GL_RGBA16UI
Definition: glcorearb.h:1058
#define GL_RGBA8I
Definition: glcorearb.h:1066
#define GL_RGB5_A1
Definition: glcorearb.h:394
#define GL_RG32F
Definition: glcorearb.h:1203
#define GL_RGBA
Definition: glcorearb.h:360
unsigned int GLuint
Definition: glcorearb.h:89
#define GL_SHORT
Definition: glcorearb.h:325
#define GL_RGB565
Definition: glcorearb.h:1898
#define GL_R16_SNORM
Definition: glcorearb.h:1410
#define GL_RGBA8UI
Definition: glcorearb.h:1060
#define GL_R16UI
Definition: glcorearb.h:1207
#define GL_ZERO
Definition: glcorearb.h:217
#define GL_RGB32F
Definition: glcorearb.h:1020
#define GL_DEPTH_COMPONENT
Definition: glcorearb.h:354
#define GL_UNSIGNED_INT_2_10_10_10_REV
Definition: glcorearb.h:455
#define GL_FLOAT
Definition: glcorearb.h:329
#define GL_R32I
Definition: glcorearb.h:1208
#define GL_RG32UI
Definition: glcorearb.h:1215
#define GL_RGBA8_SNORM
Definition: glcorearb.h:1409
#define GL_DOUBLE
Definition: glcorearb.h:330
#define GL_RG8_SNORM
Definition: glcorearb.h:1407
#define GL_RGBA16
Definition: glcorearb.h:398
#define GL_RGB10_A2
Definition: glcorearb.h:396
GLenum target
Definition: glcorearb.h:1662
#define GL_R32UI
Definition: glcorearb.h:1209
#define GL_R11F_G11F_B10F
Definition: glcorearb.h:1036
#define GL_RGBA32I
Definition: glcorearb.h:1062
static GLuint const msGLTextureExternalFormat[DF_NUM_FORMATS]
Definition: GteGL4Texture.h:43
#define GL_RGBA16F
Definition: glcorearb.h:1021
#define GL_RG8
Definition: glcorearb.h:1198
#define GL_RGB_INTEGER
Definition: glcorearb.h:1071
#define GL_RGBA8
Definition: glcorearb.h:395
unsigned int GLenum
Definition: glcorearb.h:83
#define GL_BGR
Definition: glcorearb.h:456
#define GL_RGBA32F
Definition: glcorearb.h:1019
#define GL_R8I
Definition: glcorearb.h:1204
#define GL_RGBA16I
Definition: glcorearb.h:1064
#define GL_RG8UI
Definition: glcorearb.h:1211
#define GL_RG8I
Definition: glcorearb.h:1210
#define GL_BGRA
Definition: glcorearb.h:457
GLuint texture
Definition: glcorearb.h:410
#define GL_RED
Definition: glcorearb.h:355
#define GL_DEPTH24_STENCIL8
Definition: glcorearb.h:1120
#define GL_RGBA32UI
Definition: glcorearb.h:1056
#define GL_R32F
Definition: glcorearb.h:1201
#define GL_RG16UI
Definition: glcorearb.h:1213
#define GL_UNSIGNED_BYTE
Definition: glcorearb.h:324
#define GL_RGB32UI
Definition: glcorearb.h:1057
#define GL_RG16F
Definition: glcorearb.h:1202
#define GL_RGBA_INTEGER
Definition: glcorearb.h:1072
#define GL_R8_SNORM
Definition: glcorearb.h:1406
#define GL_RGBA16_SNORM
Definition: glcorearb.h:1413
#define GL_RGB
Definition: glcorearb.h:359
#define GL_RGB9_E5
Definition: glcorearb.h:1038
static GLuint const msGLTextureExternalType[DF_NUM_CHANNEL_TYPES]
Definition: GteGL4Texture.h:44
#define GL_RED_INTEGER
Definition: glcorearb.h:1068
#define GL_R16F
Definition: glcorearb.h:1200
#define GL_UNSIGNED_INT
Definition: glcorearb.h:328
#define GL_INT_2_10_10_10_REV
Definition: glcorearb.h:1645
#define GL_R16
Definition: glcorearb.h:1197
#define GL_DEPTH_COMPONENT32F
Definition: glcorearb.h:1102
#define GL_RGB32I
Definition: glcorearb.h:1063
#define GL_BYTE
Definition: glcorearb.h:323
#define GL_R16I
Definition: glcorearb.h:1206
#define GL_UNSIGNED_INT_10F_11F_11F_REV
Definition: glcorearb.h:1037
#define GL_RG32I
Definition: glcorearb.h:1214
#define GL_UNSIGNED_SHORT
Definition: glcorearb.h:326
#define GL_RG16
Definition: glcorearb.h:1199
#define GL_RG
Definition: glcorearb.h:1194
#define GL_RG_INTEGER
Definition: glcorearb.h:1195
#define GL_DEPTH_COMPONENT16
Definition: glcorearb.h:572
#define GL_HALF_FLOAT
Definition: glcorearb.h:1183
#define GL_R8
Definition: glcorearb.h:1196
#define GL_INT
Definition: glcorearb.h:327
static GLuint const msGLTextureInternalFormat[DF_NUM_FORMATS]
Definition: GteGL4Texture.h:42
#define GL_R8UI
Definition: glcorearb.h:1205
GL4Texture(Texture const *texture, GLenum target, GLenum targetBinding)


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:00