Skip to content

Instantly share code, notes, and snippets.

@xophiix
Created April 29, 2014 13:47
Show Gist options
  • Save xophiix/11400901 to your computer and use it in GitHub Desktop.
Save xophiix/11400901 to your computer and use it in GitHub Desktop.
input several gl extension list file, extract common extensions and differences
/**
* Created with JetBrains WebStorm.
* User: xophiix
* Date: 14-4-24
* Time: 22:58
* To change this template use File | Settings | File Templates.
*/
var passGroup = ["hongmi", "ios-simulator", "ipad2", "lenovo"];
var failGroup = ["htc", "sony", "xiaomi"];
var fs = require("fs");
function getExtesions(type) {
var filename = "ext/gles-ext-log-" + type + ".txt";
return fs.readFileSync(filename, "utf-8").split("\n").map(function (s) {
return s.toLowerCase();
});
}
function getCommon(extesionsArray) {
var common = [];
var map = {};
for (var i = 0; i < extesionsArray.length; ++i) {
var extensions = extesionsArray[i];
extensions.forEach(function (ext) {
map[ext] = map[ext] || 0;
map[ext]++;
if (map[ext] == arguments.length) {
common.push(ext);
}
});
}
return common;
}
var commonExtesionsFail = getCommon(
failGroup.map(function (type) {
return getExtesions(type);
})
);
var commonExtesionsPass = getCommon(
passGroup.map(function (type) {
return getExtesions(type);
})
);
function getNotIn(extensions, notInCheckExtensionArray) {
var result = extensions.concat();
for (var i = 0; i < notInCheckExtensionArray.length; ++i) {
var checkExtensions = notInCheckExtensionArray[i];
for (var j = 0; j < result.length; ) {
if (checkExtensions.indexOf(result[j]) >= 0) {
result.splice(j, 1);
} else {
++j;
}
}
}
return result;
}
var extensionsNoInFailGroup = getNotIn(commonExtesionsPass, failGroup.map(function (type) {
return getExtesions(type);
}));
console.log("common extensions in fail group: \n", commonExtesionsFail);
console.log("common extensions in fail group and not in pass group: \n", getNotIn(commonExtesionsFail, passGroup.map(function (type) {
return getExtesions(type);
})));
console.log("extensions that pass group own and fail group not: \n", extensionsNoInFailGroup);
GL_EXT_debug_marker
GL_EXT_discard_framebuffer
GL_EXT_multi_draw_arrays
GL_EXT_shader_texture_lod
GL_EXT_texture_format_BGRA8888
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_format_BGRA8888
GL_IMG_texture_npot
GL_IMG_uniform_buffer_object
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_depth24
GL_OES_depth_texture
GL_OES_egl_sync
GL_OES_element_index_uint
GL_OES_fragment_precision_high
GL_OES_get_program_binary
GL_OES_mapbuffer
GL_OES_packed_depth_stencil
GL_OES_required_internalformat
GL_OES_rgb8_rgba8
GL_OES_standard_derivatives
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_texture_npot
GL_OES_vertex_array_object
GL_OES_vertex_half_float
GL_AMD_compressed_3DC_texture
GL_AMD_compressed_ATC_texture
GL_AMD_performance_monitor
GL_AMD_program_binary_Z400
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_format_BGRA8888
GL_EXT_texture_type_2_10_10_10_REV
GL_NV_fence
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_depth24
GL_OES_depth_texture
GL_OES_element_index_uint
GL_OES_fbo_render_mipmap
GL_OES_fragment_precision_high
GL_OES_get_program_binary
GL_OES_packed_depth_stencil
GL_OES_rgb8_rgba8
GL_OES_standard_derivatives
GL_OES_texture_3D
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_texture_half_float_linear
GL_OES_texture_npot
GL_OES_vertex_array_object
GL_OES_vertex_half_float
GL_OES_vertex_type_10_10_10_2
GL_QCOM_alpha_test
GL_QCOM_binning_control
GL_QCOM_driver_control
GL_QCOM_extended_get
GL_QCOM_extended_get2
GL_QCOM_perfmon_global_mode
GL_QCOM_tiled_rendering
GL_QCOM_writeonly_rendering
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_EXT_blend_minmax
GL_EXT_color_buffer_half_float
GL_EXT_debug_label
GL_EXT_debug_marker
GL_EXT_discard_framebuffer
GL_EXT_draw_instanced
GL_EXT_instanced_arrays
GL_EXT_map_buffer_range
GL_EXT_occlusion_query_boolean
GL_EXT_pvrtc_sRGB
GL_EXT_read_format_bgra
GL_EXT_sRGB
GL_EXT_separate_shader_objects
GL_EXT_shader_framebuffer_fetch
GL_EXT_shader_texture_lod
GL_EXT_shadow_samplers
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_rg
GL_EXT_texture_storage
GL_IMG_read_format
GL_IMG_texture_compression_pvrtc
GL_OES_depth24
GL_OES_depth_texture
GL_OES_element_index_uint
GL_OES_fbo_render_mipmap
GL_OES_mapbuffer
GL_OES_packed_depth_stencil
GL_OES_rgb8_rgba8
GL_OES_standard_derivatives
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_texture_half_float_linear
GL_OES_vertex_array_object
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_EXT_blend_minmax
GL_EXT_color_buffer_half_float
GL_EXT_debug_label
GL_EXT_debug_marker
GL_EXT_discard_framebuffer
GL_EXT_draw_instanced
GL_EXT_instanced_arrays
GL_EXT_map_buffer_range
GL_EXT_occlusion_query_boolean
GL_EXT_pvrtc_sRGB
GL_EXT_read_format_bgra
GL_EXT_sRGB
GL_EXT_separate_shader_objects
GL_EXT_shader_framebuffer_fetch
GL_EXT_shader_texture_lod
GL_EXT_shadow_samplers
GL_EXT_texture_filter_anisotropic
GL_EXT_texture_rg
GL_EXT_texture_storage
GL_IMG_read_format
GL_IMG_texture_compression_pvrtc
GL_OES_depth24
GL_OES_depth_texture
GL_OES_element_index_uint
GL_OES_fbo_render_mipmap
GL_OES_mapbuffer
GL_OES_packed_depth_stencil
GL_OES_rgb8_rgba8
GL_OES_standard_derivatives
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_texture_half_float_linear
GL_OES_vertex_array_object
GL_ARM_mali_program_binary
GL_ARM_mali_shader_binary
GL_ARM_rgba8
GL_EXT_blend_minmax
GL_EXT_debug_marker
GL_EXT_discard_framebuffer
GL_EXT_multisampled_render_to_texture
GL_EXT_robustness
GL_EXT_shader_texture_lod
GL_EXT_texture_format_BGRA8888
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_EGL_sync
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_depth24
GL_OES_depth_texture
GL_OES_get_program_binary
GL_OES_packed_depth_stencil
GL_OES_rgb8_rgba8
GL_OES_standard_derivatives
GL_OES_texture_npot
GL_AMD_compressed_3DC_texture
GL_AMD_compressed_ATC_texture
GL_AMD_performance_monitor
GL_AMD_program_binary_Z400
GL_EXT_debug_marker
GL_EXT_robustness
GL_EXT_texture_format_BGRA8888
GL_EXT_texture_type_2_10_10_10_REV
GL_NV_fence
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_depth24
GL_OES_depth_texture
GL_OES_element_index_uint
GL_OES_fbo_render_mipmap
GL_OES_fragment_precision_high
GL_OES_get_program_binary
GL_OES_packed_depth_stencil
GL_OES_rgb8_rgba8
GL_OES_standard_derivatives
GL_OES_texture_3D
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_texture_half_float_linear
GL_OES_texture_npot
GL_OES_vertex_array_object
GL_OES_vertex_half_float
GL_OES_vertex_type_10_10_10_2
GL_QCOM_alpha_test
GL_QCOM_binning_control
GL_QCOM_driver_control
GL_QCOM_extended_get
GL_QCOM_extended_get2
GL_QCOM_perfmon_global_mode
GL_QCOM_tiled_rendering
GL_QCOM_writeonly_rende
GL_AMD_compressed_3DC_texture
GL_AMD_compressed_ATC_texture
GL_AMD_performance_monitor
GL_AMD_program_binary_Z400
GL_EXT_debug_marker
GL_EXT_robustness
GL_EXT_texture_format_BGRA8888
GL_EXT_texture_type_2_10_10_10_REV
GL_NV_fence
GL_OES_EGL_image
GL_OES_EGL_image_external
GL_OES_compressed_ETC1_RGB8_texture
GL_OES_depth24
GL_OES_depth_texture
GL_OES_element_index_uint
GL_OES_fbo_render_mipmap
GL_OES_fragment_precision_high
GL_OES_get_program_binary
GL_OES_packed_depth_stencil
GL_OES_rgb8_rgba8
GL_OES_standard_derivatives
GL_OES_texture_3D
GL_OES_texture_float
GL_OES_texture_half_float
GL_OES_texture_half_float_linear
GL_OES_texture_npot
GL_OES_vertex_array_object
GL_OES_vertex_half_float
GL_OES_vertex_type_10_10_10_2
GL_QCOM_alpha_test
GL_QCOM_binning_control
GL_QCOM_driver_control
GL_QCOM_extended_get
GL_QCOM_extended_get2
GL_QCOM_perfmon_global_mode
GL_QCOM_tiled_rendering
GL_QCOM_writeonly_rende
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment