File: COGLES2ExtensionHandler.h

package info (click to toggle)
supertuxkart 1.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 767,580 kB
  • sloc: cpp: 412,075; xml: 106,334; ansic: 83,792; asm: 1,559; python: 1,403; sh: 1,366; objc: 452; makefile: 333; javascript: 23; awk: 20
file content (265 lines) | stat: -rw-r--r-- 8,318 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
// Copyright (C) 2009-2010 Amundis
// Heavily based on the OpenGL driver implemented by Nikolaus Gebhardt
// and OpenGL ES driver implemented by Christian Stehno
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in Irrlicht.h

#ifndef __C_OGLES2_EXTENSION_HANDLER_H_INCLUDED__
#define __C_OGLES2_EXTENSION_HANDLER_H_INCLUDED__

#include "IrrCompileConfig.h"

#ifdef _IRR_COMPILE_WITH_OGLES2_

#if defined(_IRR_COMPILE_WITH_SDL_DEVICE_)
#include "glad/gl.h"
#else

#ifdef IOS_STK
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#else
#include <GLES2/gl2.h>
// seems to be missing...
typedef char GLchar;
#if defined(_IRR_OGLES2_USE_EXTPOINTER_)
#include "gles2-ext.h"
#endif
#endif

#endif
#include "os.h"
#include "EDriverFeatures.h"

namespace irr
{
namespace video
{
	class COGLES2Driver;
	class COGLES2ExtensionHandler
	{
	public:
		enum EOGLES2Features
		{
			IRR_AMD_compressed_3DC_texture=0, // 39
			IRR_AMD_compressed_ATC_texture, // 40
			IRR_AMD_performance_monitor, // 50
			IRR_AMD_program_binary_Z400, // 48
			IRR_ANGLE_framebuffer_blit, // 84
			IRR_ANGLE_framebuffer_multisample, // 84
			IRR_ANGLE_instanced_arrays, // 109
			IRR_ANGLE_pack_reverse_row_order, // 110
			IRR_ANGLE_texture_compression_dxt3, // 111
			IRR_ANGLE_texture_compression_dxt5, // 111
			IRR_ANGLE_texture_usage, // 112
			IRR_ANGLE_translated_shader_source, // 113
			IRR_APPLE_copy_texture_levels, // 123
			IRR_APPLE_framebuffer_multisample, // 78
			IRR_APPLE_rgb_422, // 76
			IRR_APPLE_sync, // 124
			IRR_APPLE_texture_2D_limited_npot, // 59
			IRR_APPLE_texture_format_BGRA8888, // 79
			IRR_APPLE_texture_max_level, // 80
			IRR_ARB_texture_env_combine, //ogl, IMG simulator
			IRR_ARB_texture_env_dot3, //ogl, IMG simulator
			IRR_ARM_mali_program_binary, // 120
			IRR_ARM_mali_shader_binary, // 81
			IRR_ARM_rgba8, // 82
			IRR_DMP_shader_binary, // 88
			IRR_EXT_blend_minmax, // 65
			IRR_EXT_color_buffer_half_float, // 97
			IRR_EXT_debug_label, // 98
			IRR_EXT_debug_marker, // 99
			IRR_EXT_discard_framebuffer, // 64
			IRR_EXT_frag_depth, // 86
			IRR_EXT_map_buffer_range, // 121
			IRR_EXT_multisampled_render_to_texture, // 106
			IRR_EXT_multiview_draw_buffers, // 125
			IRR_EXT_multi_draw_arrays, // 69
			IRR_EXT_occlusion_query_boolean, // 100
			IRR_EXT_read_format_bgra, // 66
			IRR_EXT_robustness, // 107
			IRR_EXT_separate_shader_objects, // 101
			IRR_EXT_shader_framebuffer_fetch, // 122
			IRR_EXT_shader_texture_lod, // 77
			IRR_EXT_shadow_samplers, // 102
			IRR_EXT_sRGB, // 105
			IRR_EXT_texture_compression_dxt1, // 49
			IRR_EXT_texture_filter_anisotropic, // 41
			IRR_EXT_texture_format_BGRA8888, // 51
			IRR_EXT_texture_lod_bias, // 60
			IRR_EXT_texture_rg, // 103
			IRR_EXT_texture_storage, // 108
			IRR_EXT_texture_type_2_10_10_10_REV, // 42
			IRR_EXT_unpack_subimage, // 90
			IRR_FJ_shader_binary_GCCSO, // 114
			IRR_IMG_multisampled_render_to_texture, // 74
			IRR_IMG_program_binary, // 67
			IRR_IMG_read_format, // 53
			IRR_IMG_shader_binary, // 68
			IRR_IMG_texture_compression_pvrtc, // 54
			IRR_IMG_texture_env_enhanced_fixed_function, // 58
			IRR_IMG_texture_format_BGRA8888, // replaced by EXT version
			IRR_IMG_user_clip_plane, // 57, was clip_planes
			IRR_IMG_vertex_program, // non-standard
			IRR_KHR_debug, // 118
			IRR_KHR_texture_compression_astc_ldr, // 117
			IRR_NV_coverage_sample, // 72
			IRR_NV_depth_nonlinear, // 73
			IRR_NV_draw_buffers, // 91
			IRR_NV_EGL_stream_consumer_external, // 104
			IRR_NV_fbo_color_attachments, // 92
			IRR_NV_fence, // 52
			IRR_NV_read_buffer, // 93
			IRR_NV_read_buffer_front, // part of 93
			IRR_NV_read_depth, // part of 94
			IRR_NV_read_depth_stencil, // 94
			IRR_NV_read_stencil, // part of 94
			IRR_NV_texture_compression_s3tc_update, // 95
			IRR_NV_texture_npot_2D_mipmap, // 96
			IRR_OES_blend_equation_separate, // 1
			IRR_OES_blend_func_separate, // 2
			IRR_OES_blend_subtract, // 3
			IRR_OES_byte_coordinates, // 4
			IRR_OES_compressed_ETC1_RGB8_texture, // 5
			IRR_OES_compressed_paletted_texture, // 6
			IRR_OES_depth24, // 24
			IRR_OES_depth32, // 25
			IRR_OES_depth_texture, // 43
			IRR_OES_draw_texture, // 7
			IRR_OES_EGL_image, // 23
			IRR_OES_EGL_image_external, // 87
			IRR_OES_EGL_sync, // 75
			IRR_OES_element_index_uint, // 26
			IRR_OES_extended_matrix_palette, // 8
			IRR_OES_fbo_render_mipmap, // 27
			IRR_OES_fixed_point, // 9
			IRR_OES_fragment_precision_high, // 28
			IRR_OES_framebuffer_object, // 10
			IRR_OES_get_program_binary, // 47
			IRR_OES_mapbuffer, // 29
			IRR_OES_matrix_get, // 11
			IRR_OES_matrix_palette, // 12
			IRR_OES_packed_depth_stencil, // 44
			IRR_OES_point_size_array, // 14
			IRR_OES_point_sprite, // 15
			IRR_OES_query_matrix, // 16
			IRR_OES_read_format, // 17
			IRR_OES_required_internalformat, // 115
			IRR_OES_rgb8_rgba8, // 30
			IRR_OES_single_precision, // 18
			IRR_OES_standard_derivatives, // 45
			IRR_OES_stencil1, // 31
			IRR_OES_stencil4, // 32
			IRR_OES_stencil8, // 33
			IRR_OES_stencil_wrap, // 19
			IRR_OES_surfaceless_context, // 116
			IRR_OES_texture_3D, // 34
			IRR_OES_texture_cube_map, // 20
			IRR_OES_texture_env_crossbar, // 21
			IRR_OES_texture_float, // 36
			IRR_OES_texture_float_linear, // 35
			IRR_OES_texture_half_float, // 36
			IRR_OES_texture_half_float_linear, // 35
			IRR_OES_texture_mirrored_repeat, // 22
			IRR_OES_texture_npot, // 37
			IRR_OES_vertex_array_object, // 71
			IRR_OES_vertex_half_float, // 38
			IRR_OES_vertex_type_10_10_10_2, // 46
			IRR_QCOM_alpha_test, // 89
			IRR_QCOM_binning_control, // 119
			IRR_QCOM_driver_control, // 55
			IRR_QCOM_extended_get, // 62
			IRR_QCOM_extended_get2, // 63
			IRR_QCOM_performance_monitor_global_mode, // 56
			IRR_QCOM_tiled_rendering, // 70
			IRR_QCOM_writeonly_rendering, // 61
			IRR_SUN_multi_draw_arrays, // 69
			IRR_VIV_shader_binary, // 85

			IRR_OGLES2_Feature_Count
		};

		//! queries the features of the driver, returns true if feature is available
		bool queryOpenGLFeature(EOGLES2Features feature) const
		{
			return FeatureAvailable[feature];
		}


	protected:
		COGLES2ExtensionHandler();

		bool queryFeature(video::E_VIDEO_DRIVER_FEATURE feature) const
		{
			switch (feature)
			{
			case EVDF_RENDER_TO_TARGET:
			case EVDF_HARDWARE_TL:
			case EVDF_MULTITEXTURE:
			case EVDF_BILINEAR_FILTER:
			case EVDF_MIP_MAP:
			case EVDF_MIP_MAP_AUTO_UPDATE:
			case EVDF_VERTEX_SHADER_1_1:
			case EVDF_PIXEL_SHADER_1_1:
			case EVDF_PIXEL_SHADER_1_2:
			case EVDF_PIXEL_SHADER_2_0:
			case EVDF_VERTEX_SHADER_2_0:
			case EVDF_ARB_GLSL:
			case EVDF_TEXTURE_NSQUARE:
			case EVDF_TEXTURE_NPOT:
			case EVDF_FRAMEBUFFER_OBJECT:
			case EVDF_VERTEX_BUFFER_OBJECT:
			case EVDF_COLOR_MASK:
			case EVDF_ALPHA_TO_COVERAGE:
			case EVDF_POLYGON_OFFSET:
			case EVDF_TEXTURE_MATRIX:
				return true;
			case EVDF_ARB_VERTEX_PROGRAM_1:
			case EVDF_ARB_FRAGMENT_PROGRAM_1:
			case EVDF_GEOMETRY_SHADER:
			case EVDF_MULTIPLE_RENDER_TARGETS:
			case EVDF_MRT_BLEND:
			case EVDF_MRT_COLOR_MASK:
			case EVDF_MRT_BLEND_FUNC:
			case EVDF_OCCLUSION_QUERY:
				return false;
			case EVDF_BLEND_OPERATIONS:
				return false;
			case EVDF_TEXTURE_COMPRESSED_DXT:
				return false; // NV Tegra need improvements here
			case EVDF_STENCIL_BUFFER:
				return StencilBuffer;
			default:
				return false;
			};
		}

		void dump() const;

        void initExtensions(COGLES2Driver* driver,
                bool withStencil);

	protected:
		u16 Version;
		u8 MaxTextureUnits;
		u8 MaxSupportedTextures;
		u8 MaxAnisotropy;
		u32 MaxIndices;
		u32 MaxTextureSize;
		f32 MaxTextureLODBias;
		//! Minimal and maximal supported thickness for lines without smoothing
		GLfloat DimAliasedLine[2];
		//! Minimal and maximal supported thickness for points without smoothing
		GLfloat DimAliasedPoint[2];
		bool StencilBuffer;
		bool FeatureAvailable[IRR_OGLES2_Feature_Count];
	};

} // end namespace video
} // end namespace irr


#endif // _IRR_COMPILE_WITH_OGLES2_
#endif