support getSupportedExtensions

This commit is contained in:
Halil Durak
2025-11-13 14:35:53 +03:00
parent 7404b20228
commit a8298a0fda

View File

@@ -112,6 +112,16 @@ pub const Extension = union(enum) {
};
};
/// An array of supported WebGL extensions.
const extension_array = blk: {
const fields = @typeInfo(Extension.Kind).@"enum".fields;
var items: [fields.len][:0]const u8 = undefined;
for (fields, 0..) |field, i| {
items[i] = field.name;
}
break :blk items;
};
/// Enables a WebGL extension.
pub fn _getExtension(self: *const WebGLRenderingContext, name: []const u8) ?Extension {
_ = self;
@@ -123,3 +133,8 @@ pub fn _getExtension(self: *const WebGLRenderingContext, name: []const u8) ?Exte
inline else => |comptime_enum| @unionInit(Extension, @tagName(comptime_enum), {}),
};
}
/// Returns a list of all the supported WebGL extensions.
pub fn _getSupportedExtensions(_: *const WebGLRenderingContext) []const []const u8 {
return &extension_array;
}