logo
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
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
//! Bindings to Gles2 2.0/3.0/3.1/3.2
//!
//! Generated by [phosphorus](https://docs.rs/phosphorus/0.0.24/phosphorus/).
//!
//! Included Extensions (activate via cargo feature):
//! * `GL_AMD_compressed_3DC_texture`
//! * `GL_AMD_compressed_ATC_texture`
//! * `GL_AMD_framebuffer_multisample_advanced`
//! * `GL_AMD_performance_monitor`
//! * `GL_AMD_program_binary_Z400`
//! * `GL_ANDROID_extension_pack_es31a`
//! * `GL_ANGLE_depth_texture`
//! * `GL_ANGLE_framebuffer_blit`
//! * `GL_ANGLE_framebuffer_multisample`
//! * `GL_ANGLE_instanced_arrays`
//! * `GL_ANGLE_pack_reverse_row_order`
//! * `GL_ANGLE_program_binary`
//! * `GL_ANGLE_texture_compression_dxt3`
//! * `GL_ANGLE_texture_compression_dxt5`
//! * `GL_ANGLE_texture_usage`
//! * `GL_ANGLE_translated_shader_source`
//! * `GL_APPLE_clip_distance`
//! * `GL_APPLE_color_buffer_packed_float`
//! * `GL_APPLE_copy_texture_levels`
//! * `GL_APPLE_framebuffer_multisample`
//! * `GL_APPLE_rgb_422`
//! * `GL_APPLE_sync`
//! * `GL_APPLE_texture_format_BGRA8888`
//! * `GL_APPLE_texture_max_level`
//! * `GL_APPLE_texture_packed_float`
//! * `GL_ARM_mali_program_binary`
//! * `GL_ARM_mali_shader_binary`
//! * `GL_ARM_rgba8`
//! * `GL_ARM_shader_framebuffer_fetch`
//! * `GL_ARM_shader_framebuffer_fetch_depth_stencil`
//! * `GL_ARM_texture_unnormalized_coordinates`
//! * `GL_DMP_program_binary`
//! * `GL_DMP_shader_binary`
//! * `GL_EXT_EGL_image_array`
//! * `GL_EXT_EGL_image_storage`
//! * `GL_EXT_YUV_target`
//! * `GL_EXT_base_instance`
//! * `GL_EXT_blend_func_extended`
//! * `GL_EXT_blend_minmax`
//! * `GL_EXT_buffer_storage`
//! * `GL_EXT_clear_texture`
//! * `GL_EXT_clip_control`
//! * `GL_EXT_clip_cull_distance`
//! * `GL_EXT_color_buffer_float`
//! * `GL_EXT_color_buffer_half_float`
//! * `GL_EXT_conservative_depth`
//! * `GL_EXT_copy_image`
//! * `GL_EXT_debug_label`
//! * `GL_EXT_debug_marker`
//! * `GL_EXT_depth_clamp`
//! * `GL_EXT_discard_framebuffer`
//! * `GL_EXT_disjoint_timer_query`
//! * `GL_EXT_draw_buffers`
//! * `GL_EXT_draw_buffers_indexed`
//! * `GL_EXT_draw_elements_base_vertex`
//! * `GL_EXT_draw_instanced`
//! * `GL_EXT_draw_transform_feedback`
//! * `GL_EXT_external_buffer`
//! * `GL_EXT_float_blend`
//! * `GL_EXT_geometry_point_size`
//! * `GL_EXT_geometry_shader`
//! * `GL_EXT_gpu_shader5`
//! * `GL_EXT_instanced_arrays`
//! * `GL_EXT_map_buffer_range`
//! * `GL_EXT_memory_object`
//! * `GL_EXT_memory_object_fd`
//! * `GL_EXT_memory_object_win32`
//! * `GL_EXT_multi_draw_arrays`
//! * `GL_EXT_multi_draw_indirect`
//! * `GL_EXT_multisampled_render_to_texture`
//! * `GL_EXT_multisampled_render_to_texture2`
//! * `GL_EXT_multiview_draw_buffers`
//! * `GL_EXT_multiview_tessellation_geometry_shader`
//! * `GL_EXT_multiview_texture_multisample`
//! * `GL_EXT_multiview_timer_query`
//! * `GL_EXT_occlusion_query_boolean`
//! * `GL_EXT_polygon_offset_clamp`
//! * `GL_EXT_post_depth_coverage`
//! * `GL_EXT_primitive_bounding_box`
//! * `GL_EXT_protected_textures`
//! * `GL_EXT_pvrtc_sRGB`
//! * `GL_EXT_raster_multisample`
//! * `GL_EXT_read_format_bgra`
//! * `GL_EXT_render_snorm`
//! * `GL_EXT_robustness`
//! * `GL_EXT_sRGB`
//! * `GL_EXT_sRGB_write_control`
//! * `GL_EXT_semaphore`
//! * `GL_EXT_semaphore_fd`
//! * `GL_EXT_semaphore_win32`
//! * `GL_EXT_separate_shader_objects`
//! * `GL_EXT_shader_framebuffer_fetch`
//! * `GL_EXT_shader_framebuffer_fetch_non_coherent`
//! * `GL_EXT_shader_group_vote`
//! * `GL_EXT_shader_implicit_conversions`
//! * `GL_EXT_shader_integer_mix`
//! * `GL_EXT_shader_io_blocks`
//! * `GL_EXT_shader_non_constant_global_initializers`
//! * `GL_EXT_shader_pixel_local_storage`
//! * `GL_EXT_shader_pixel_local_storage2`
//! * `GL_EXT_shader_texture_lod`
//! * `GL_EXT_shadow_samplers`
//! * `GL_EXT_sparse_texture`
//! * `GL_EXT_sparse_texture2`
//! * `GL_EXT_tessellation_point_size`
//! * `GL_EXT_tessellation_shader`
//! * `GL_EXT_texture_border_clamp`
//! * `GL_EXT_texture_buffer`
//! * `GL_EXT_texture_compression_astc_decode_mode`
//! * `GL_EXT_texture_compression_bptc`
//! * `GL_EXT_texture_compression_dxt1`
//! * `GL_EXT_texture_compression_rgtc`
//! * `GL_EXT_texture_compression_s3tc`
//! * `GL_EXT_texture_compression_s3tc_srgb`
//! * `GL_EXT_texture_cube_map_array`
//! * `GL_EXT_texture_filter_anisotropic`
//! * `GL_EXT_texture_filter_minmax`
//! * `GL_EXT_texture_format_BGRA8888`
//! * `GL_EXT_texture_format_sRGB_override`
//! * `GL_EXT_texture_mirror_clamp_to_edge`
//! * `GL_EXT_texture_norm16`
//! * `GL_EXT_texture_query_lod`
//! * `GL_EXT_texture_rg`
//! * `GL_EXT_texture_sRGB_R8`
//! * `GL_EXT_texture_sRGB_RG8`
//! * `GL_EXT_texture_sRGB_decode`
//! * `GL_EXT_texture_shadow_lod`
//! * `GL_EXT_texture_storage`
//! * `GL_EXT_texture_type_2_10_10_10_REV`
//! * `GL_EXT_texture_view`
//! * `GL_EXT_unpack_subimage`
//! * `GL_EXT_win32_keyed_mutex`
//! * `GL_EXT_window_rectangles`
//! * `GL_FJ_shader_binary_GCCSO`
//! * `GL_IMG_bindless_texture`
//! * `GL_IMG_framebuffer_downsample`
//! * `GL_IMG_multisampled_render_to_texture`
//! * `GL_IMG_program_binary`
//! * `GL_IMG_read_format`
//! * `GL_IMG_shader_binary`
//! * `GL_IMG_texture_compression_pvrtc`
//! * `GL_IMG_texture_compression_pvrtc2`
//! * `GL_IMG_texture_filter_cubic`
//! * `GL_INTEL_blackhole_render`
//! * `GL_INTEL_conservative_rasterization`
//! * `GL_INTEL_framebuffer_CMAA`
//! * `GL_INTEL_performance_query`
//! * `GL_KHR_blend_equation_advanced`
//! * `GL_KHR_blend_equation_advanced_coherent`
//! * `GL_KHR_context_flush_control`
//! * `GL_KHR_debug`
//! * `GL_KHR_no_error`
//! * `GL_KHR_parallel_shader_compile`
//! * `GL_KHR_robust_buffer_access_behavior`
//! * `GL_KHR_robustness`
//! * `GL_KHR_shader_subgroup`
//! * `GL_KHR_texture_compression_astc_hdr`
//! * `GL_KHR_texture_compression_astc_ldr`
//! * `GL_KHR_texture_compression_astc_sliced_3d`
//! * `GL_MESA_bgra`
//! * `GL_MESA_framebuffer_flip_x`
//! * `GL_MESA_framebuffer_flip_y`
//! * `GL_MESA_framebuffer_swap_xy`
//! * `GL_MESA_program_binary_formats`
//! * `GL_NVX_blend_equation_advanced_multi_draw_buffers`
//! * `GL_NV_bindless_texture`
//! * `GL_NV_blend_equation_advanced`
//! * `GL_NV_blend_equation_advanced_coherent`
//! * `GL_NV_blend_minmax_factor`
//! * `GL_NV_clip_space_w_scaling`
//! * `GL_NV_compute_shader_derivatives`
//! * `GL_NV_conditional_render`
//! * `GL_NV_conservative_raster`
//! * `GL_NV_conservative_raster_pre_snap`
//! * `GL_NV_conservative_raster_pre_snap_triangles`
//! * `GL_NV_copy_buffer`
//! * `GL_NV_coverage_sample`
//! * `GL_NV_depth_nonlinear`
//! * `GL_NV_draw_buffers`
//! * `GL_NV_draw_instanced`
//! * `GL_NV_draw_vulkan_image`
//! * `GL_NV_explicit_attrib_location`
//! * `GL_NV_fbo_color_attachments`
//! * `GL_NV_fence`
//! * `GL_NV_fill_rectangle`
//! * `GL_NV_fragment_coverage_to_color`
//! * `GL_NV_fragment_shader_barycentric`
//! * `GL_NV_fragment_shader_interlock`
//! * `GL_NV_framebuffer_blit`
//! * `GL_NV_framebuffer_mixed_samples`
//! * `GL_NV_framebuffer_multisample`
//! * `GL_NV_generate_mipmap_sRGB`
//! * `GL_NV_geometry_shader_passthrough`
//! * `GL_NV_gpu_shader5`
//! * `GL_NV_image_formats`
//! * `GL_NV_instanced_arrays`
//! * `GL_NV_internalformat_sample_query`
//! * `GL_NV_memory_attachment`
//! * `GL_NV_memory_object_sparse`
//! * `GL_NV_mesh_shader`
//! * `GL_NV_non_square_matrices`
//! * `GL_NV_path_rendering`
//! * `GL_NV_path_rendering_shared_edge`
//! * `GL_NV_pixel_buffer_object`
//! * `GL_NV_polygon_mode`
//! * `GL_NV_primitive_shading_rate`
//! * `GL_NV_read_buffer`
//! * `GL_NV_read_depth_stencil`
//! * `GL_NV_representative_fragment_test`
//! * `GL_NV_sRGB_formats`
//! * `GL_NV_sample_locations`
//! * `GL_NV_sample_mask_override_coverage`
//! * `GL_NV_scissor_exclusive`
//! * `GL_NV_shader_atomic_fp16_vector`
//! * `GL_NV_shader_noperspective_interpolation`
//! * `GL_NV_shader_subgroup_partitioned`
//! * `GL_NV_shader_texture_footprint`
//! * `GL_NV_shading_rate_image`
//! * `GL_NV_shadow_samplers_array`
//! * `GL_NV_shadow_samplers_cube`
//! * `GL_NV_stereo_view_rendering`
//! * `GL_NV_texture_border_clamp`
//! * `GL_NV_texture_compression_s3tc_update`
//! * `GL_NV_texture_npot_2D_mipmap`
//! * `GL_NV_timeline_semaphore`
//! * `GL_NV_viewport_array`
//! * `GL_NV_viewport_array2`
//! * `GL_NV_viewport_swizzle`
//! * `GL_OES_EGL_image`
//! * `GL_OES_EGL_image_external`
//! * `GL_OES_EGL_image_external_essl3`
//! * `GL_OES_compressed_ETC1_RGB8_texture`
//! * `GL_OES_compressed_paletted_texture`
//! * `GL_OES_copy_image`
//! * `GL_OES_depth24`
//! * `GL_OES_depth32`
//! * `GL_OES_depth_texture`
//! * `GL_OES_draw_buffers_indexed`
//! * `GL_OES_draw_elements_base_vertex`
//! * `GL_OES_element_index_uint`
//! * `GL_OES_fbo_render_mipmap`
//! * `GL_OES_fragment_precision_high`
//! * `GL_OES_geometry_shader`
//! * `GL_OES_get_program_binary`
//! * `GL_OES_gpu_shader5`
//! * `GL_OES_mapbuffer`
//! * `GL_OES_packed_depth_stencil`
//! * `GL_OES_primitive_bounding_box`
//! * `GL_OES_required_internalformat`
//! * `GL_OES_rgb8_rgba8`
//! * `GL_OES_sample_shading`
//! * `GL_OES_sample_variables`
//! * `GL_OES_shader_image_atomic`
//! * `GL_OES_shader_io_blocks`
//! * `GL_OES_shader_multisample_interpolation`
//! * `GL_OES_standard_derivatives`
//! * `GL_OES_stencil1`
//! * `GL_OES_stencil4`
//! * `GL_OES_surfaceless_context`
//! * `GL_OES_tessellation_point_size`
//! * `GL_OES_tessellation_shader`
//! * `GL_OES_texture_3D`
//! * `GL_OES_texture_border_clamp`
//! * `GL_OES_texture_buffer`
//! * `GL_OES_texture_compression_astc`
//! * `GL_OES_texture_cube_map_array`
//! * `GL_OES_texture_float`
//! * `GL_OES_texture_float_linear`
//! * `GL_OES_texture_half_float`
//! * `GL_OES_texture_half_float_linear`
//! * `GL_OES_texture_npot`
//! * `GL_OES_texture_stencil8`
//! * `GL_OES_texture_storage_multisample_2d_array`
//! * `GL_OES_texture_view`
//! * `GL_OES_vertex_array_object`
//! * `GL_OES_vertex_half_float`
//! * `GL_OES_vertex_type_10_10_10_2`
//! * `GL_OES_viewport_array`
//! * `GL_OVR_multiview`
//! * `GL_OVR_multiview2`
//! * `GL_OVR_multiview_multisampled_render_to_texture`
//! * `GL_QCOM_YUV_texture_gather`
//! * `GL_QCOM_alpha_test`
//! * `GL_QCOM_binning_control`
//! * `GL_QCOM_driver_control`
//! * `GL_QCOM_extended_get`
//! * `GL_QCOM_extended_get2`
//! * `GL_QCOM_frame_extrapolation`
//! * `GL_QCOM_framebuffer_foveated`
//! * `GL_QCOM_motion_estimation`
//! * `GL_QCOM_render_shared_exponent`
//! * `GL_QCOM_shader_framebuffer_fetch_noncoherent`
//! * `GL_QCOM_shader_framebuffer_fetch_rate`
//! * `GL_QCOM_shading_rate`
//! * `GL_QCOM_texture_foveated`
//! * `GL_QCOM_texture_foveated2`
//! * `GL_QCOM_texture_foveated_subsampled_layout`
//! * `GL_QCOM_tiled_rendering`
//! * `GL_QCOM_writeonly_rendering`
//! * `GL_VIV_shader_binary`

pub mod canvas;
pub mod core20;
pub mod core30;

pub mod ffi;

pub mod enums;

pub mod utils;

#[allow(missing_docs)]
mod types;
pub use types::*;

// // we keep here struct loader for future
// pub mod structloader;

/// Check opengl errors
#[macro_export]
macro_rules! glchk {
    ($message:literal) => {{
        if cfg!(debug_assertions) {
            use $crate::platform::gles::{core20::gl, enums::*};
            let err = gl::get_error();
            if err != GL_NO_ERROR {
                let err_str = match err {
                    GL_INVALID_ENUM => "GL_INVALID_ENUM",
                    GL_INVALID_VALUE => "GL_INVALID_VALUE",
                    GL_INVALID_OPERATION => "GL_INVALID_OPERATION",
                    GL_INVALID_FRAMEBUFFER_OPERATION => "GL_INVALID_FRAMEBUFFER_OPERATION",
                    GL_OUT_OF_MEMORY => "GL_OUT_OF_MEMORY",
                    // GL_STACK_UNDERFLOW => "GL_STACK_UNDERFLOW",
                    // GL_STACK_OVERFLOW => "GL_STACK_OVERFLOW",
                    _ => "unknown error",
                };
                println!("{}:{} - {} caused {}", file!(), line!(), $message, err_str);
            }
        }
    }};
}