Bug 1418315 - Re-vendor third-party rust libraries. r=nical

MozReview-Commit-ID: DV8QCCHIVFx

--HG--
rename : third_party/rust/core-text/Cargo.toml => third_party/rust/foreign-types/Cargo.toml
rename : third_party/rust/khronos_api/api/gl.xml => third_party/rust/khronos_api/api/xml/gl.xml
rename : third_party/rust/khronos_api/api/glx.xml => third_party/rust/khronos_api/api/xml/glx.xml
rename : third_party/rust/khronos_api/api/wgl.xml => third_party/rust/khronos_api/api/xml/wgl.xml
rename : third_party/rust/khronos_api/api/egl.xml => third_party/rust/khronos_api/api_egl/api/egl.xml
extra : rebase_source : ee945bb5b0b787f61df51c3a5deaadb28f6f5225
This commit is contained in:
Kartikaya Gupta 2017-11-21 10:44:27 -05:00
Родитель a687e9315b
Коммит ee39c91a2b
78 изменённых файлов: 8431 добавлений и 22908 удалений

Просмотреть файл

@ -1 +1 @@
{"files":{".travis.yml":"b71b9a6f84b9263b2b89be6ec90dff5920ee68cf9e5768d73ed71957de2d0670","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"7ec2f5418172e650baa8dfd874a0f337370d512f6abcbf5c86b8c8535156f2f6","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"4a45abeb1e684e30bb361dfa7db59189423348e18d310cbae694b7c8c57cd86a","src/base.rs":"3f0a5be163f86c864c995c6beb081d2943263a2fca28491b9fe0eaea5e3ff401","src/color_space.rs":"deef20773dc8ef0e75654ca730876ee25b2914539a0dc587755dfd5301584da7","src/context.rs":"4a19c23444d1d1df8bba4228053636c89d9209e7abe255f774afc0ab6317dd72","src/data_provider.rs":"a5dd6593af681aace97ef9a2eed006d11fe44039d40d37c1780d01969cd145fe","src/display.rs":"fe253013b5c8e2a57a242dec90236753011e8d99b827a7bc404b1a483f9f0332","src/event.rs":"36052e6ea7db7606060e088e507499d4e4125825513735b495062d991bbad8e7","src/event_source.rs":"8a8282e944208db52839a56f0d55d687358264f1458eebf6fefcd9e42c7ddeac","src/font.rs":"27fc377a1e2bb08cada16da7ff0ff6c13d9cfaee0a33524580987549e6b02e3e","src/geometry.rs":"58758d6f3b58fb472f14d4ec694882d41e5e1f6dbb1ed766f241ad39eff56c36","src/image.rs":"de0797097d52dd8fd2bc5816357ba614b734a69834155c39c17f90468bb1bf7b","src/lib.rs":"e46cd5770ef451f7502a6dd39bd0f14632634e10abd668700fcdea35e6e48212","src/private.rs":"87c96ed2002bd567bf02535b4c6e8e3f22827afb2dd92ee17d91cfb45bc6072c"},"package":"2fd47addfc77b7e574d24e5434f95bb64a863769dfd4f1d451ca4ff5530ba01a"}
{"files":{".travis.yml":"b71b9a6f84b9263b2b89be6ec90dff5920ee68cf9e5768d73ed71957de2d0670","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"7391fc331e49b10143113e243bab8301c1df67488078189b7f83576944f007ac","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"4a45abeb1e684e30bb361dfa7db59189423348e18d310cbae694b7c8c57cd86a","src/base.rs":"10f3eeae06c6dd25cdf3e11b7e2fbbe5d003469ebb4aa1b069625a1637633879","src/color_space.rs":"bada04ad391869474428070ad9ae5dbb5e7f5e03646226fab0b03e8e84240bfa","src/context.rs":"601cb85abd122422abdbcbd8f6116ee4622009aee717cb478f6f0937d481b212","src/data_provider.rs":"78e9fc5c1c609bfb6a29136cd334575b77c6f4c994e444291dbccc52cfd35363","src/display.rs":"1c1a2fe5e52ba31437d5155adcc73f103a62bdaabca55ba290ec0b0b15cb9c7e","src/event.rs":"5f2a645cbd9582cc6861236a3696b9fa1655457bed884fdc218fc8b5b75921cb","src/event_source.rs":"d55a4f5b5e62789325028febc51bbf54c74b15ab1a4e70c6ad749a2f9753e081","src/font.rs":"d47701d76ca3aa7b0f47d31ccf6c7a0fd7c2141767a0e0d36058309d6692f513","src/geometry.rs":"b94e50a16b8540dc6f37bfe4b1549ac68974cd6ba6c0bbd9209559f8a46d86eb","src/image.rs":"fb77ae359b918cf3341662cb858cde6111eaa358f60fdd1ebbf264e023d25401","src/lib.rs":"19d5e558cec5596d546f1753529a8e3cf951993f4500ee12fad0d7eb2dc86bc8","src/path.rs":"d8dccd0bc2a1888a0a598fcca25067e932451e220dbec75999982cef9477d3ab","src/private.rs":"da3fd61338bab2d8e26aa5433b2e18ecd2a0a408c62e1ac2b33a0f87f2dad88a","src/sys.rs":"27e00f7ad7645af05014f35939128833456cac766a2978c5da295c3757708a86"},"package":"5dc0a78ab2ac23b6ea7b3fe5fe93b227900dc0956979735b8f68032417976dd4"}

13
third_party/rust/core-graphics/Cargo.toml поставляемый
Просмотреть файл

@ -12,20 +12,23 @@
[package]
name = "core-graphics"
version = "0.9.1"
version = "0.12.3"
authors = ["The Servo Project Developers"]
description = "Bindings to Core Graphics for OS X"
homepage = "https://github.com/servo/core-graphics-rs"
license = "MIT / Apache-2.0"
repository = "https://github.com/servo/core-graphics-rs"
[dependencies.libc]
version = "0.2"
[dependencies.bitflags]
version = "1.0"
[dependencies.core-foundation]
version = "0.4"
[dependencies.bitflags]
version = "0.9"
[dependencies.foreign-types]
version = "0.3.0"
[dependencies.libc]
version = "0.2"
[features]
default = []

4
third_party/rust/core-graphics/src/base.rs поставляемый
Просмотреть файл

@ -28,10 +28,6 @@ pub type CGFloat = libc::c_float;
pub type CGError = libc::int32_t;
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum CGAffineTransform {}
pub const kCGImageAlphaNone: u32 = 0;
pub const kCGImageAlphaPremultipliedLast: u32 = 1;
pub const kCGImageAlphaPremultipliedFirst: u32 = 2;

Просмотреть файл

@ -7,81 +7,53 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType};
use std::mem;
use core_foundation::base::{CFRelease, CFRetain, CFTypeID};
use core_foundation::string::CFStringRef;
use foreign_types::ForeignType;
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum __CGColorSpace {}
pub type CGColorSpaceRef = *const __CGColorSpace;
pub struct CGColorSpace {
obj: CGColorSpaceRef,
foreign_type! {
#[doc(hidden)]
type CType = ::sys::CGColorSpace;
fn drop = |p| CFRelease(p as *mut _);
fn clone = |p| CFRetain(p as *const _) as *mut _;
pub struct CGColorSpace;
pub struct CGColorSpaceRef;
}
impl Drop for CGColorSpace {
fn drop(&mut self) {
unsafe {
CFRelease(self.as_CFTypeRef())
}
}
}
impl Clone for CGColorSpace {
fn clone(&self) -> CGColorSpace {
unsafe {
TCFType::wrap_under_get_rule(self.as_concrete_TypeRef())
}
}
}
impl TCFType<CGColorSpaceRef> for CGColorSpace {
#[inline]
fn as_concrete_TypeRef(&self) -> CGColorSpaceRef {
self.obj
}
#[inline]
unsafe fn wrap_under_get_rule(reference: CGColorSpaceRef) -> CGColorSpace {
let reference: CGColorSpaceRef = mem::transmute(CFRetain(mem::transmute(reference)));
TCFType::wrap_under_create_rule(reference)
}
#[inline]
fn as_CFTypeRef(&self) -> CFTypeRef {
unsafe {
mem::transmute(self.as_concrete_TypeRef())
}
}
#[inline]
unsafe fn wrap_under_create_rule(obj: CGColorSpaceRef) -> CGColorSpace {
CGColorSpace {
obj: obj,
}
}
#[inline]
fn type_id() -> CFTypeID {
impl CGColorSpace {
pub fn type_id() -> CFTypeID {
unsafe {
CGColorSpaceGetTypeID()
}
}
}
impl CGColorSpace {
pub fn create_with_name(name: CFStringRef) -> Option<CGColorSpace> {
unsafe {
let p = CGColorSpaceCreateWithName(name);
if !p.is_null() {Some(CGColorSpace::from_ptr(p))} else {None}
}
}
pub fn create_device_rgb() -> CGColorSpace {
unsafe {
let result = CGColorSpaceCreateDeviceRGB();
TCFType::wrap_under_create_rule(result)
CGColorSpace::from_ptr(result)
}
}
}
#[link(name = "ApplicationServices", kind = "framework")]
#[link(name = "CoreGraphics", kind = "framework")]
extern {
fn CGColorSpaceCreateDeviceRGB() -> CGColorSpaceRef;
pub static kCGColorSpaceSRGB: CFStringRef;
pub static kCGColorSpaceAdobeRGB1998: CFStringRef;
pub static kCGColorSpaceGenericGray: CFStringRef;
pub static kCGColorSpaceGenericRGB: CFStringRef;
pub static kCGColorSpaceGenericCMYK: CFStringRef;
pub static kCGColorSpaceGenericRGBLinear: CFStringRef;
pub static kCGColorSpaceGenericGrayGamma2_2: CFStringRef;
fn CGColorSpaceCreateDeviceRGB() -> ::sys::CGColorSpaceRef;
fn CGColorSpaceCreateWithName(name: CFStringRef) -> ::sys::CGColorSpaceRef;
fn CGColorSpaceGetTypeID() -> CFTypeID;
}

223
third_party/rust/core-graphics/src/context.rs поставляемый
Просмотреть файл

@ -8,14 +8,18 @@
// except according to those terms.
use base::CGFloat;
use color_space::{CGColorSpace, CGColorSpaceRef};
use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType};
use color_space::CGColorSpace;
use core_foundation::base::{CFRelease, CFRetain, CFTypeID};
use font::{CGFont, CGGlyph};
use geometry::CGPoint;
use libc::{c_void, c_int, size_t};
use std::mem;
use std::cmp;
use std::ptr;
use std::slice;
use geometry::CGRect;
use image::{CGImage, CGImageRef};
use geometry::{CGAffineTransform, CGRect};
use image::CGImage;
use foreign_types::ForeignType;
#[repr(C)]
pub enum CGTextDrawingMode {
@ -28,67 +32,22 @@ pub enum CGTextDrawingMode {
CGTextClip
}
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum __CGContext {}
pub type CGContextRef = *const __CGContext;
pub struct CGContext {
obj: CGContextRef,
foreign_type! {
#[doc(hidden)]
type CType = ::sys::CGContext;
fn drop = |cs| CFRelease(cs as *mut _);
fn clone = |p| CFRetain(p as *const _) as *mut _;
pub struct CGContext;
pub struct CGContextRef;
}
impl Drop for CGContext {
fn drop(&mut self) {
unsafe {
CFRelease(self.as_CFTypeRef())
}
}
}
impl Clone for CGContext {
fn clone(&self) -> CGContext {
unsafe {
TCFType::wrap_under_get_rule(self.as_concrete_TypeRef())
}
}
}
impl TCFType<CGContextRef> for CGContext {
#[inline]
fn as_concrete_TypeRef(&self) -> CGContextRef {
self.obj
}
#[inline]
unsafe fn wrap_under_get_rule(reference: CGContextRef) -> CGContext {
let reference: CGContextRef = mem::transmute(CFRetain(mem::transmute(reference)));
TCFType::wrap_under_create_rule(reference)
}
#[inline]
fn as_CFTypeRef(&self) -> CFTypeRef {
unsafe {
mem::transmute(self.as_concrete_TypeRef())
}
}
#[inline]
unsafe fn wrap_under_create_rule(obj: CGContextRef) -> CGContext {
CGContext {
obj: obj,
}
}
#[inline]
fn type_id() -> CFTypeID {
impl CGContext {
pub fn type_id() -> CFTypeID {
unsafe {
CGContextGetTypeID()
}
}
}
impl CGContext {
pub fn create_bitmap_context(data: Option<*mut c_void>,
width: size_t,
height: size_t,
@ -103,163 +62,223 @@ impl CGContext {
height,
bits_per_component,
bytes_per_row,
space.as_concrete_TypeRef(),
space.as_ptr(),
bitmap_info);
TCFType::wrap_under_create_rule(result)
assert!(!result.is_null());
Self::from_ptr(result)
}
}
pub fn data(&mut self) -> &mut [u8] {
unsafe {
slice::from_raw_parts_mut(
CGBitmapContextGetData(self.as_concrete_TypeRef()) as *mut u8,
CGBitmapContextGetData(self.as_ptr()) as *mut u8,
(self.height() * self.bytes_per_row()) as usize)
}
}
pub fn width(&self) -> size_t {
unsafe {
CGBitmapContextGetWidth(self.as_concrete_TypeRef())
CGBitmapContextGetWidth(self.as_ptr())
}
}
pub fn height(&self) -> size_t {
unsafe {
CGBitmapContextGetHeight(self.as_concrete_TypeRef())
CGBitmapContextGetHeight(self.as_ptr())
}
}
pub fn bytes_per_row(&self) -> size_t {
unsafe {
CGBitmapContextGetBytesPerRow(self.as_concrete_TypeRef())
CGBitmapContextGetBytesPerRow(self.as_ptr())
}
}
pub fn set_rgb_fill_color(&self, red: CGFloat, green: CGFloat, blue: CGFloat, alpha: CGFloat) {
unsafe {
CGContextSetRGBFillColor(self.as_concrete_TypeRef(), red, green, blue, alpha)
CGContextSetRGBFillColor(self.as_ptr(), red, green, blue, alpha)
}
}
pub fn set_allows_font_smoothing(&self, allows_font_smoothing: bool) {
unsafe {
CGContextSetAllowsFontSmoothing(self.as_concrete_TypeRef(), allows_font_smoothing)
CGContextSetAllowsFontSmoothing(self.as_ptr(), allows_font_smoothing)
}
}
pub fn set_font_smoothing_style(&self, style: i32) {
unsafe {
CGContextSetFontSmoothingStyle(self.as_concrete_TypeRef(), style as _);
CGContextSetFontSmoothingStyle(self.as_ptr(), style as _);
}
}
pub fn set_should_smooth_fonts(&self, should_smooth_fonts: bool) {
unsafe {
CGContextSetShouldSmoothFonts(self.as_concrete_TypeRef(), should_smooth_fonts)
CGContextSetShouldSmoothFonts(self.as_ptr(), should_smooth_fonts)
}
}
pub fn set_allows_antialiasing(&self, allows_antialiasing: bool) {
unsafe {
CGContextSetAllowsAntialiasing(self.as_concrete_TypeRef(), allows_antialiasing)
CGContextSetAllowsAntialiasing(self.as_ptr(), allows_antialiasing)
}
}
pub fn set_should_antialias(&self, should_antialias: bool) {
unsafe {
CGContextSetShouldAntialias(self.as_concrete_TypeRef(), should_antialias)
CGContextSetShouldAntialias(self.as_ptr(), should_antialias)
}
}
pub fn set_allows_font_subpixel_quantization(&self, allows_font_subpixel_quantization: bool) {
unsafe {
CGContextSetAllowsFontSubpixelQuantization(self.as_concrete_TypeRef(), allows_font_subpixel_quantization)
CGContextSetAllowsFontSubpixelQuantization(self.as_ptr(), allows_font_subpixel_quantization)
}
}
pub fn set_should_subpixel_quantize_fonts(&self, should_subpixel_quantize_fonts: bool) {
unsafe {
CGContextSetShouldSubpixelQuantizeFonts(self.as_concrete_TypeRef(), should_subpixel_quantize_fonts)
CGContextSetShouldSubpixelQuantizeFonts(self.as_ptr(), should_subpixel_quantize_fonts)
}
}
pub fn set_allows_font_subpixel_positioning(&self, allows_font_subpixel_positioning: bool) {
unsafe {
CGContextSetAllowsFontSubpixelPositioning(self.as_concrete_TypeRef(), allows_font_subpixel_positioning)
CGContextSetAllowsFontSubpixelPositioning(self.as_ptr(), allows_font_subpixel_positioning)
}
}
pub fn set_should_subpixel_position_fonts(&self, should_subpixel_position_fonts: bool) {
unsafe {
CGContextSetShouldSubpixelPositionFonts(self.as_concrete_TypeRef(), should_subpixel_position_fonts)
CGContextSetShouldSubpixelPositionFonts(self.as_ptr(), should_subpixel_position_fonts)
}
}
pub fn set_text_drawing_mode(&self, mode: CGTextDrawingMode) {
unsafe {
CGContextSetTextDrawingMode(self.as_concrete_TypeRef(), mode)
CGContextSetTextDrawingMode(self.as_ptr(), mode)
}
}
pub fn fill_rect(&self, rect: CGRect) {
unsafe {
CGContextFillRect(self.as_concrete_TypeRef(), rect)
CGContextFillRect(self.as_ptr(), rect)
}
}
pub fn draw_image(&self, rect: CGRect, image: &CGImage) {
unsafe {
CGContextDrawImage(self.as_concrete_TypeRef(), rect, image.as_concrete_TypeRef());
CGContextDrawImage(self.as_ptr(), rect, image.as_ptr());
}
}
pub fn create_image(&self) -> Option<CGImage> {
let image = unsafe { CGBitmapContextCreateImage(self.as_concrete_TypeRef()) };
if image != ptr::null() {
Some(unsafe { CGImage::wrap_under_create_rule(image) })
let image = unsafe { CGBitmapContextCreateImage(self.as_ptr()) };
if !image.is_null() {
Some(unsafe { CGImage::from_ptr(image) })
} else {
None
}
}
pub fn set_font(&self, font: &CGFont) {
unsafe {
CGContextSetFont(self.as_ptr(), font.as_ptr())
}
}
pub fn set_font_size(&self, size: CGFloat) {
unsafe {
CGContextSetFontSize(self.as_ptr(), size)
}
}
pub fn set_text_matrix(&self, t: &CGAffineTransform) {
unsafe {
CGContextSetTextMatrix(self.as_ptr(), *t)
}
}
pub fn show_glyphs_at_positions(&self, glyphs: &[CGGlyph], positions: &[CGPoint]) {
unsafe {
let count = cmp::min(glyphs.len(), positions.len());
CGContextShowGlyphsAtPositions(self.as_ptr(),
glyphs.as_ptr(),
positions.as_ptr(),
count)
}
}
}
#[link(name = "ApplicationServices", kind = "framework")]
#[test]
fn create_bitmap_context_test() {
use geometry::*;
let cs = CGColorSpace::create_device_rgb();
let ctx = CGContext::create_bitmap_context(None,
16, 8,
8, 0,
&cs,
::base::kCGImageAlphaPremultipliedLast);
ctx.set_rgb_fill_color(1.,0.,1.,1.);
ctx.fill_rect(CGRect::new(&CGPoint::new(0.,0.), &CGSize::new(8.,8.)));
let img = ctx.create_image().unwrap();
assert_eq!(16, img.width());
assert_eq!(8, img.height());
assert_eq!(8, img.bits_per_component());
assert_eq!(32, img.bits_per_pixel());
let data = img.data();
assert_eq!(255, data.bytes()[0]);
assert_eq!(0, data.bytes()[1]);
assert_eq!(255, data.bytes()[2]);
assert_eq!(255, data.bytes()[3]);
}
#[link(name = "CoreGraphics", kind = "framework")]
extern {
fn CGBitmapContextCreate(data: *mut c_void,
width: size_t,
height: size_t,
bitsPerComponent: size_t,
bytesPerRow: size_t,
space: CGColorSpaceRef,
space: ::sys::CGColorSpaceRef,
bitmapInfo: u32)
-> CGContextRef;
fn CGBitmapContextGetData(context: CGContextRef) -> *mut c_void;
fn CGBitmapContextGetWidth(context: CGContextRef) -> size_t;
fn CGBitmapContextGetHeight(context: CGContextRef) -> size_t;
fn CGBitmapContextGetBytesPerRow(context: CGContextRef) -> size_t;
fn CGBitmapContextCreateImage(context: CGContextRef) -> CGImageRef;
-> ::sys::CGContextRef;
fn CGBitmapContextGetData(context: ::sys::CGContextRef) -> *mut c_void;
fn CGBitmapContextGetWidth(context: ::sys::CGContextRef) -> size_t;
fn CGBitmapContextGetHeight(context: ::sys::CGContextRef) -> size_t;
fn CGBitmapContextGetBytesPerRow(context: ::sys::CGContextRef) -> size_t;
fn CGBitmapContextCreateImage(context: ::sys::CGContextRef) -> ::sys::CGImageRef;
fn CGContextGetTypeID() -> CFTypeID;
fn CGContextSetAllowsFontSmoothing(c: CGContextRef, allowsFontSmoothing: bool);
fn CGContextSetShouldSmoothFonts(c: CGContextRef, shouldSmoothFonts: bool);
fn CGContextSetFontSmoothingStyle(c: CGContextRef, style: c_int);
fn CGContextSetAllowsAntialiasing(c: CGContextRef, allowsAntialiasing: bool);
fn CGContextSetShouldAntialias(c: CGContextRef, shouldAntialias: bool);
fn CGContextSetAllowsFontSubpixelQuantization(c: CGContextRef,
fn CGContextSetAllowsFontSmoothing(c: ::sys::CGContextRef, allowsFontSmoothing: bool);
fn CGContextSetShouldSmoothFonts(c: ::sys::CGContextRef, shouldSmoothFonts: bool);
fn CGContextSetFontSmoothingStyle(c: ::sys::CGContextRef, style: c_int);
fn CGContextSetAllowsAntialiasing(c: ::sys::CGContextRef, allowsAntialiasing: bool);
fn CGContextSetShouldAntialias(c: ::sys::CGContextRef, shouldAntialias: bool);
fn CGContextSetAllowsFontSubpixelQuantization(c: ::sys::CGContextRef,
allowsFontSubpixelQuantization: bool);
fn CGContextSetShouldSubpixelQuantizeFonts(c: CGContextRef,
fn CGContextSetShouldSubpixelQuantizeFonts(c: ::sys::CGContextRef,
shouldSubpixelQuantizeFonts: bool);
fn CGContextSetAllowsFontSubpixelPositioning(c: CGContextRef,
fn CGContextSetAllowsFontSubpixelPositioning(c: ::sys::CGContextRef,
allowsFontSubpixelPositioning: bool);
fn CGContextSetShouldSubpixelPositionFonts(c: CGContextRef,
fn CGContextSetShouldSubpixelPositionFonts(c: ::sys::CGContextRef,
shouldSubpixelPositionFonts: bool);
fn CGContextSetTextDrawingMode(c: CGContextRef, mode: CGTextDrawingMode);
fn CGContextSetRGBFillColor(context: CGContextRef,
fn CGContextSetTextDrawingMode(c: ::sys::CGContextRef, mode: CGTextDrawingMode);
fn CGContextSetRGBFillColor(context: ::sys::CGContextRef,
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat);
fn CGContextFillRect(context: CGContextRef,
fn CGContextFillRect(context: ::sys::CGContextRef,
rect: CGRect);
fn CGContextDrawImage(c: CGContextRef, rect: CGRect, image: CGImageRef);
fn CGContextDrawImage(c: ::sys::CGContextRef, rect: CGRect, image: ::sys::CGImageRef);
fn CGContextSetFont(c: ::sys::CGContextRef, font: ::sys::CGFontRef);
fn CGContextSetFontSize(c: ::sys::CGContextRef, size: CGFloat);
fn CGContextSetTextMatrix(c: ::sys::CGContextRef, t: CGAffineTransform);
fn CGContextShowGlyphsAtPositions(c: ::sys::CGContextRef,
glyphs: *const CGGlyph,
positions: *const CGPoint,
count: size_t);
}

Просмотреть файл

@ -7,12 +7,14 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType};
use core_foundation::base::{CFRelease, CFRetain, CFTypeID, TCFType};
use core_foundation::data::{CFData, CFDataRef};
use libc::{c_void, size_t, off_t};
use std::mem;
use std::ptr;
use std::sync::Arc;
use foreign_types::{ForeignType, ForeignTypeRef};
pub type CGDataProviderGetBytesCallback = Option<unsafe extern fn (*mut c_void, *mut c_void, size_t) -> size_t>;
pub type CGDataProviderReleaseInfoCallback = Option<unsafe extern fn (*mut c_void)>;
@ -26,78 +28,51 @@ pub type CGDataProviderReleaseBytePointerCallback = Option<unsafe extern fn (*mu
pub type CGDataProviderReleaseDataCallback = Option<unsafe extern fn (*mut c_void, *const c_void, size_t)>;
pub type CGDataProviderGetBytesAtPositionCallback = Option<unsafe extern fn (*mut c_void, *mut c_void, off_t, size_t)>;
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum __CGDataProvider {}
pub type CGDataProviderRef = *const __CGDataProvider;
pub struct CGDataProvider {
obj: CGDataProviderRef,
foreign_type! {
#[doc(hidden)]
type CType = ::sys::CGDataProvider;
fn drop = |cs| CFRelease(cs as *mut _);
fn clone = |p| CFRetain(p as *const _) as *mut _;
pub struct CGDataProvider;
pub struct CGDataProviderRef;
}
impl Drop for CGDataProvider {
fn drop(&mut self) {
unsafe {
CFRelease(self.as_CFTypeRef())
}
}
}
impl TCFType<CGDataProviderRef> for CGDataProvider {
#[inline]
fn as_concrete_TypeRef(&self) -> CGDataProviderRef {
self.obj
}
#[inline]
unsafe fn wrap_under_get_rule(reference: CGDataProviderRef) -> CGDataProvider {
let reference: CGDataProviderRef = mem::transmute(CFRetain(mem::transmute(reference)));
TCFType::wrap_under_create_rule(reference)
}
#[inline]
fn as_CFTypeRef(&self) -> CFTypeRef {
unsafe {
mem::transmute(self.as_concrete_TypeRef())
}
}
#[inline]
unsafe fn wrap_under_create_rule(obj: CGDataProviderRef) -> CGDataProvider {
CGDataProvider {
obj: obj,
}
}
#[inline]
fn type_id() -> CFTypeID {
impl CGDataProvider {
pub fn type_id() -> CFTypeID {
unsafe {
CGDataProviderGetTypeID()
}
}
}
impl CGDataProvider {
pub fn from_buffer(buffer: &[u8]) -> CGDataProvider {
/// Creates a data provider from the given reference-counted buffer.
///
/// The `CGDataProvider` object takes ownership of the reference. Once the data provider
/// is destroyed, the reference count of the buffer is automatically decremented.
pub fn from_buffer(buffer: Arc<Vec<u8>>) -> Self {
unsafe {
let result = CGDataProviderCreateWithData(ptr::null_mut(),
buffer.as_ptr() as *const c_void,
buffer.len() as size_t,
None);
TCFType::wrap_under_create_rule(result)
let ptr = (*buffer).as_ptr() as *const c_void;
let len = buffer.len() as size_t;
let info = mem::transmute::<Arc<Vec<u8>>, *mut c_void>(buffer);
let result = CGDataProviderCreateWithData(info, ptr, len, Some(release));
return CGDataProvider::from_ptr(result);
}
unsafe extern "C" fn release(info: *mut c_void, _: *const c_void, _: size_t) {
drop(mem::transmute::<*mut c_void, Arc<Vec<u8>>>(info))
}
}
}
impl CGDataProviderRef {
/// Creates a copy of the data from the underlying `CFDataProviderRef`.
pub fn copy_data(&self) -> CFData {
unsafe { CFData::wrap_under_create_rule(CGDataProviderCopyData(self.obj)) }
unsafe { CFData::wrap_under_create_rule(CGDataProviderCopyData(self.as_ptr())) }
}
}
#[link(name = "ApplicationServices", kind = "framework")]
#[link(name = "CoreGraphics", kind = "framework")]
extern {
fn CGDataProviderCopyData(provider: CGDataProviderRef) -> CFDataRef;
fn CGDataProviderCopyData(provider: ::sys::CGDataProviderRef) -> CFDataRef;
//fn CGDataProviderCreateDirect
//fn CGDataProviderCreateSequential
//fn CGDataProviderCreateWithCFData
@ -105,7 +80,7 @@ extern {
data: *const c_void,
size: size_t,
releaseData: CGDataProviderReleaseDataCallback
) -> CGDataProviderRef;
) -> ::sys::CGDataProviderRef;
//fn CGDataProviderCreateWithFilename(filename: *c_char) -> CGDataProviderRef;
//fn CGDataProviderCreateWithURL
fn CGDataProviderGetTypeID() -> CFTypeID;

407
third_party/rust/core-graphics/src/display.rs поставляемый
Просмотреть файл

@ -9,13 +9,14 @@
#![allow(non_upper_case_globals)]
extern crate core_foundation;
use libc;
use std::ptr;
pub use base::{CGError, boolean_t};
pub use geometry::{CGRect, CGPoint, CGSize};
use image::CGImageRef;
use core_foundation::base::{CFRetain, TCFType};
use image::CGImage;
use foreign_types::ForeignType;
pub type CGDirectDisplayID = libc::uint32_t;
pub type CGWindowID = libc::uint32_t;
@ -46,11 +47,365 @@ pub use core_foundation::array::{ CFArray, CFArrayRef };
pub use core_foundation::array::{ CFArrayGetCount, CFArrayGetValueAtIndex };
pub use core_foundation::base::{ CFIndex, CFRelease, CFTypeRef };
#[link(name = "ApplicationServices", kind = "framework")]
extern {
#[derive(Copy, Clone, Debug)]
pub struct CGDisplay {
pub id: CGDirectDisplayID,
}
foreign_type! {
#[doc(hidden)]
type CType = ::sys::CGDisplayMode;
fn drop = CGDisplayModeRelease;
fn clone = |p| CFRetain(p as *const _) as *mut _;
pub struct CGDisplayMode;
pub struct CGDisplayModeRef;
}
impl CGDisplay {
#[inline]
pub fn new(id: CGDirectDisplayID) -> CGDisplay {
CGDisplay { id: id }
}
/// Returns the the main display.
#[inline]
pub fn main() -> CGDisplay {
CGDisplay::new(unsafe { CGMainDisplayID() })
}
/// Returns the bounds of a display in the global display coordinate space.
#[inline]
pub fn bounds(&self) -> CGRect {
unsafe { CGDisplayBounds(self.id) }
}
/// Returns information about a display's current configuration.
#[inline]
pub fn display_mode(&self) -> Option<CGDisplayMode> {
unsafe {
let mode_ref = CGDisplayCopyDisplayMode(self.id);
if !mode_ref.is_null() {
Some(CGDisplayMode::from_ptr(mode_ref))
} else {
None
}
}
}
/// Returns an image containing the contents of the specified display.
#[inline]
pub fn image(&self) -> Option<CGImage> {
unsafe {
let image_ref = CGDisplayCreateImage(self.id);
if !image_ref.is_null() {
Some(CGImage::from_ptr(image_ref))
} else {
None
}
}
}
/// Returns a composite image based on a dynamically generated list of
/// windows.
#[inline]
pub fn screenshot(
bounds: CGRect,
list_option: CGWindowListOption,
window_id: CGWindowID,
image_option: CGWindowImageOption,
) -> Option<CGImage> {
unsafe {
let image_ref = CGWindowListCreateImage(bounds, list_option, window_id, image_option);
if !image_ref.is_null() {
Some(CGImage::from_ptr(image_ref))
} else {
None
}
}
}
/// Returns a composite image of the specified windows.
#[inline]
pub fn screenshot_from_windows(
bounds: CGRect,
windows: CFArray,
image_option: CGWindowImageOption,
) -> Option<CGImage> {
unsafe {
let image_ref = CGWindowListCreateImageFromArray(
bounds,
windows.as_concrete_TypeRef(),
image_option,
);
if !image_ref.is_null() {
Some(CGImage::from_ptr(image_ref))
} else {
None
}
}
}
/// Generates and returns information about the selected windows in the
/// current user session.
pub fn window_list_info(
option: CGWindowListOption,
relative_to_window: Option<CGWindowID>,
) -> Option<CFArray> {
let relative_to_window = relative_to_window.unwrap_or(kCGNullWindowID);
let array_ref = unsafe { CGWindowListCopyWindowInfo(option, relative_to_window) };
if array_ref != ptr::null() {
Some(unsafe { TCFType::wrap_under_create_rule(array_ref) })
} else {
None
}
}
/// Returns a Boolean value indicating whether a display is active.
#[inline]
pub fn is_active(&self) -> bool {
unsafe { CGDisplayIsActive(self.id) != 0 }
}
/// Returns a boolean indicating whether a display is always in a
/// mirroring set.
#[inline]
pub fn is_always_in_mirror_set(&self) -> bool {
unsafe { CGDisplayIsAlwaysInMirrorSet(self.id) != 0 }
}
/// Returns a boolean indicating whether a display is sleeping (and is
/// therefore not drawable.)
#[inline]
pub fn is_asleep(&self) -> bool {
unsafe { CGDisplayIsAsleep(self.id) != 0 }
}
/// Returns a boolean indicating whether a display is built-in, such as
/// the internal display in portable systems.
#[inline]
pub fn is_builtin(&self) -> bool {
unsafe { CGDisplayIsBuiltin(self.id) != 0 }
}
/// Returns a boolean indicating whether a display is in a hardware
/// mirroring set.
#[inline]
pub fn is_in_hw_mirror_set(&self) -> bool {
unsafe { CGDisplayIsInHWMirrorSet(self.id) != 0 }
}
/// Returns a boolean indicating whether a display is in a mirroring set.
#[inline]
pub fn is_in_mirror_set(&self) -> bool {
unsafe { CGDisplayIsInMirrorSet(self.id) != 0 }
}
/// Returns a boolean indicating whether a display is the main display.
#[inline]
pub fn is_main(&self) -> bool {
unsafe { CGDisplayIsMain(self.id) != 0 }
}
/// Returns a boolean indicating whether a display is connected or online.
#[inline]
pub fn is_online(&self) -> bool {
unsafe { CGDisplayIsOnline(self.id) != 0 }
}
/// Returns a boolean indicating whether Quartz is using OpenGL-based
/// window acceleration (Quartz Extreme) to render in a display.
#[inline]
pub fn uses_open_gl_acceleration(&self) -> bool {
unsafe { CGDisplayUsesOpenGLAcceleration(self.id) != 0 }
}
/// Returns a boolean indicating whether a display is running in a stereo
/// graphics mode.
#[inline]
pub fn is_stereo(&self) -> bool {
unsafe { CGDisplayIsStereo(self.id) != 0 }
}
/// For a secondary display in a mirroring set, returns the primary
/// display.
#[inline]
pub fn mirrors_display(&self) -> CGDirectDisplayID {
unsafe { CGDisplayMirrorsDisplay(self.id) }
}
/// Returns the primary display in a hardware mirroring set.
#[inline]
pub fn primary_display(&self) -> CGDirectDisplayID {
unsafe { CGDisplayPrimaryDisplay(self.id) }
}
/// Returns the rotation angle of a display in degrees.
#[inline]
pub fn rotation(&self) -> f64 {
unsafe { CGDisplayRotation(self.id) }
}
/// Returns the width and height of a display in millimeters.
#[inline]
pub fn screen_size(&self) -> CGSize {
unsafe { CGDisplayScreenSize(self.id) }
}
/// Returns the serial number of a display monitor.
#[inline]
pub fn serial_number(&self) -> u32 {
unsafe { CGDisplaySerialNumber(self.id) }
}
/// Returns the logical unit number of a display.
#[inline]
pub fn unit_number(&self) -> u32 {
unsafe { CGDisplayUnitNumber(self.id) }
}
/// Returns the vendor number of the specified display's monitor.
#[inline]
pub fn vendor_number(&self) -> u32 {
unsafe { CGDisplayVendorNumber(self.id) }
}
/// Returns the model number of a display monitor.
#[inline]
pub fn model_number(&self) -> u32 {
unsafe { CGDisplayModelNumber(self.id) }
}
/// Returns the display height in pixel units.
#[inline]
pub fn pixels_high(&self) -> u64 {
unsafe { CGDisplayPixelsHigh(self.id) as u64 }
}
/// Returns the display width in pixel units.
#[inline]
pub fn pixels_wide(&self) -> u64 {
unsafe { CGDisplayPixelsWide(self.id) as u64 }
}
/// Provides a list of displays that are active (or drawable).
#[inline]
pub fn active_displays() -> Result<Vec<CGDirectDisplayID>, CGError> {
let count = try!(CGDisplay::active_display_count());
let mut buf: Vec<CGDirectDisplayID> = vec![0; count as usize];
let result =
unsafe { CGGetActiveDisplayList(count as u32, buf.as_mut_ptr(), ptr::null_mut()) };
if result == 0 {
Ok(buf)
} else {
Err(result)
}
}
/// Provides count of displays that are active (or drawable).
#[inline]
pub fn active_display_count() -> Result<u32, CGError> {
let mut count: libc::uint32_t = 0;
let result = unsafe { CGGetActiveDisplayList(0, ptr::null_mut(), &mut count) };
if result == 0 {
Ok(count as u32)
} else {
Err(result)
}
}
/// Hides the mouse cursor, and increments the hide cursor count.
#[inline]
pub fn hide_cursor(&self) -> Result<(), CGError> {
let result = unsafe { CGDisplayHideCursor(self.id) };
if result == 0 {
Ok(())
} else {
Err(result)
}
}
/// Decrements the hide cursor count, and shows the mouse cursor if the
/// count is 0.
#[inline]
pub fn show_cursor(&self) -> Result<(), CGError> {
let result = unsafe { CGDisplayShowCursor(self.id) };
if result == 0 {
Ok(())
} else {
Err(result)
}
}
/// Moves the mouse cursor to a specified point relative to the display
/// origin (the upper-left corner of the display).
#[inline]
pub fn move_cursor_to_point(&self, point: CGPoint) -> Result<(), CGError> {
let result = unsafe { CGDisplayMoveCursorToPoint(self.id, point) };
if result == 0 {
Ok(())
} else {
Err(result)
}
}
/// Moves the mouse cursor without generating events.
#[inline]
pub fn warp_mouse_cursor_position(point: CGPoint) -> Result<(), CGError> {
let result = unsafe { CGWarpMouseCursorPosition(point) };
if result == 0 {
Ok(())
} else {
Err(result)
}
}
/// Connects or disconnects the mouse and cursor while an application is
/// in the foreground.
#[inline]
pub fn associate_mouse_and_mouse_cursor_position(connected: bool) -> Result<(), CGError> {
let result = unsafe { CGAssociateMouseAndMouseCursorPosition(connected as boolean_t) };
if result == 0 {
Ok(())
} else {
Err(result)
}
}
}
impl CGDisplayMode {
#[inline]
pub fn height(&self) -> u64 {
unsafe { CGDisplayModeGetHeight(self.as_ptr()) as u64 }
}
#[inline]
pub fn width(&self) -> u64 {
unsafe { CGDisplayModeGetWidth(self.as_ptr()) as u64 }
}
#[inline]
pub fn pixel_height(&self) -> u64 {
unsafe { CGDisplayModeGetPixelHeight(self.as_ptr()) as u64 }
}
#[inline]
pub fn pixel_width(&self) -> u64 {
unsafe { CGDisplayModeGetPixelWidth(self.as_ptr()) as u64 }
}
#[inline]
pub fn refresh_rate(&self) -> f64 {
unsafe { CGDisplayModeGetRefreshRate(self.as_ptr()) }
}
}
#[link(name = "CoreGraphics", kind = "framework")]
extern "C" {
pub static CGRectNull: CGRect;
pub static CGRectInfinite: CGRect;
pub fn CGDisplayModeRelease(mode: ::sys::CGDisplayModeRef);
pub fn CGMainDisplayID() -> CGDirectDisplayID;
pub fn CGDisplayIsActive(display: CGDirectDisplayID) -> boolean_t;
pub fn CGDisplayIsAlwaysInMirrorSet(display: CGDirectDisplayID) -> boolean_t;
@ -69,29 +424,45 @@ extern {
pub fn CGDisplayUnitNumber(display: CGDirectDisplayID) -> libc::uint32_t;
pub fn CGDisplayUsesOpenGLAcceleration(display: CGDirectDisplayID) -> boolean_t;
pub fn CGDisplayVendorNumber(display: CGDirectDisplayID) -> libc::uint32_t;
pub fn CGGetActiveDisplayList(max_displays: libc::uint32_t,
active_displays: *mut CGDirectDisplayID,
display_count: *mut libc::uint32_t) -> CGError;
pub fn CGGetActiveDisplayList(
max_displays: libc::uint32_t,
active_displays: *mut CGDirectDisplayID,
display_count: *mut libc::uint32_t,
) -> CGError;
pub fn CGDisplayModelNumber(display: CGDirectDisplayID) -> libc::uint32_t;
pub fn CGDisplayPixelsHigh(display: CGDirectDisplayID) -> libc::size_t;
pub fn CGDisplayPixelsWide(display: CGDirectDisplayID) -> libc::size_t;
pub fn CGDisplayBounds(display: CGDirectDisplayID) -> CGRect;
pub fn CGDisplayCreateImage(display: CGDirectDisplayID) -> CGImageRef;
pub fn CGDisplayCreateImage(display: CGDirectDisplayID) -> ::sys::CGImageRef;
pub fn CGDisplayCopyDisplayMode(display: CGDirectDisplayID) -> ::sys::CGDisplayModeRef;
pub fn CGDisplayModeGetHeight(mode: ::sys::CGDisplayModeRef) -> libc::size_t;
pub fn CGDisplayModeGetWidth(mode: ::sys::CGDisplayModeRef) -> libc::size_t;
pub fn CGDisplayModeGetPixelHeight(mode: ::sys::CGDisplayModeRef) -> libc::size_t;
pub fn CGDisplayModeGetPixelWidth(mode: ::sys::CGDisplayModeRef) -> libc::size_t;
pub fn CGDisplayModeGetRefreshRate(mode: ::sys::CGDisplayModeRef) -> libc::c_double;
// mouse stuff
pub fn CGDisplayHideCursor(display: CGDirectDisplayID) -> CGError;
pub fn CGDisplayShowCursor(display: CGDirectDisplayID) -> CGError;
pub fn CGDisplayMoveCursorToPoint(display: CGDirectDisplayID, point: CGPoint) -> CGError;
pub fn CGWarpMouseCursorPosition(point: CGPoint) -> CGError;
pub fn CGAssociateMouseAndMouseCursorPosition(connected: bool) -> CGError;
pub fn CGAssociateMouseAndMouseCursorPosition(connected: boolean_t) -> CGError;
// Window Services Reference
pub fn CGWindowListCopyWindowInfo(option: CGWindowListOption, relativeToWindow: CGWindowID ) -> CFArrayRef;
pub fn CGWindowListCreateImage(screenBounds: CGRect,
listOptions: CGWindowListOption,
windowId: CGWindowID,
imageOptions: CGWindowImageOption) -> CGImageRef;
pub fn CGWindowListCreateImageFromArray(screenBounds: CGRect,
windowArray: CFArrayRef,
imageOptions: CGWindowImageOption) -> CGImageRef;
pub fn CGWindowListCopyWindowInfo(
option: CGWindowListOption,
relativeToWindow: CGWindowID,
) -> CFArrayRef;
pub fn CGWindowListCreateImage(
screenBounds: CGRect,
listOptions: CGWindowListOption,
windowId: CGWindowID,
imageOptions: CGWindowImageOption,
) -> ::sys::CGImageRef;
pub fn CGWindowListCreateImageFromArray(
screenBounds: CGRect,
windowArray: CFArrayRef,
imageOptions: CGWindowImageOption,
) -> ::sys::CGImageRef;
}

476
third_party/rust/core-graphics/src/event.rs поставляемый
Просмотреть файл

@ -1,11 +1,14 @@
use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType};
#![allow(non_upper_case_globals)]
use core_foundation::base::{CFRelease, CFRetain, CFTypeID};
use geometry::CGPoint;
use event_source::{CGEventSource,CGEventSourceRef};
use event_source::CGEventSource;
use libc;
use std::mem;
use std::ptr;
use foreign_types::ForeignType;
pub type CGEventField = libc::uint32_t;
pub type CGKeyCode = libc::uint16_t;
/// Flags for events
@ -35,6 +38,62 @@ bitflags! {
}
}
/// Key codes for keys that are independent of keyboard layout.
///
/// [Ref](https://github.com/phracker/MacOSX-SDKs/blob/master/MacOSX10.13.sdk/System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Events.h)
#[repr(C)]
pub struct KeyCode;
impl KeyCode {
pub const RETURN: CGKeyCode = 0x24;
pub const TAB: CGKeyCode = 0x30;
pub const SPACE: CGKeyCode = 0x31;
pub const DELETE: CGKeyCode = 0x33;
pub const ESCAPE: CGKeyCode = 0x35;
pub const COMMAND: CGKeyCode = 0x37;
pub const SHIFT: CGKeyCode = 0x38;
pub const CAPS_LOCK: CGKeyCode = 0x39;
pub const OPTION: CGKeyCode = 0x3A;
pub const CONTROL: CGKeyCode = 0x3B;
pub const RIGHT_COMMAND: CGKeyCode = 0x36;
pub const RIGHT_SHIFT: CGKeyCode = 0x3C;
pub const RIGHT_OPTION: CGKeyCode = 0x3D;
pub const RIGHT_CONTROL: CGKeyCode = 0x3E;
pub const FUNCTION: CGKeyCode = 0x3F;
pub const VOLUME_UP: CGKeyCode = 0x48;
pub const VOLUME_DOWN: CGKeyCode = 0x49;
pub const MUTE: CGKeyCode = 0x4A;
pub const F1: CGKeyCode = 0x7A;
pub const F2: CGKeyCode = 0x78;
pub const F3: CGKeyCode = 0x63;
pub const F4: CGKeyCode = 0x76;
pub const F5: CGKeyCode = 0x60;
pub const F6: CGKeyCode = 0x61;
pub const F7: CGKeyCode = 0x62;
pub const F8: CGKeyCode = 0x64;
pub const F9: CGKeyCode = 0x65;
pub const F10: CGKeyCode = 0x6D;
pub const F11: CGKeyCode = 0x67;
pub const F12: CGKeyCode = 0x6F;
pub const F13: CGKeyCode = 0x69;
pub const F14: CGKeyCode = 0x6B;
pub const F15: CGKeyCode = 0x71;
pub const F16: CGKeyCode = 0x6A;
pub const F17: CGKeyCode = 0x40;
pub const F18: CGKeyCode = 0x4F;
pub const F19: CGKeyCode = 0x50;
pub const F20: CGKeyCode = 0x5A;
pub const HELP: CGKeyCode = 0x72;
pub const HOME: CGKeyCode = 0x73;
pub const PAGE_UP: CGKeyCode = 0x74;
pub const FORWARD_DELETE: CGKeyCode = 0x75;
pub const END: CGKeyCode = 0x77;
pub const PAGE_DOWN: CGKeyCode = 0x79;
pub const LEFT_ARROW: CGKeyCode = 0x7B;
pub const RIGHT_ARROW: CGKeyCode = 0x7C;
pub const DOWN_ARROW: CGKeyCode = 0x7D;
pub const UP_ARROW: CGKeyCode = 0x7E;
}
/// Constants that specify the different types of input events.
///
/// [Ref](http://opensource.apple.com/source/IOHIDFamily/IOHIDFamily-700/IOHIDSystem/IOKit/hidsystem/IOLLEvent.h)
@ -71,6 +130,234 @@ pub enum CGEventType {
TapDisabledByUserInput = 0xFFFFFFFF,
}
/// Constants used as keys to access specialized fields in low-level events.
///
/// [Ref](https://developer.apple.com/documentation/coregraphics/cgeventfield)
pub struct EventField;
impl EventField {
/// Key to access an integer field that contains the mouse button event
/// number. Matching mouse-down and mouse-up events will have the same
/// event number.
pub const MOUSE_EVENT_NUMBER: CGEventField = 0;
/// Key to access an integer field that contains the mouse button click
/// state. A click state of 1 represents a single click. A click state of
/// 2 represents a double-click. A click state of 3 represents a
/// triple-click.
pub const MOUSE_EVENT_CLICK_STATE: CGEventField = 1;
/// Key to access a double field that contains the mouse button pressure.
/// The pressure value may range from 0 to 1, with 0 representing the
/// mouse being up. This value is commonly set by tablet pens mimicking a
/// mouse.
pub const MOUSE_EVENT_PRESSURE: CGEventField = 2;
/// Key to access an integer field that contains the mouse button number.
pub const MOUSE_EVENT_BUTTON_NUMBER: CGEventField = 3;
/// Key to access an integer field that contains the horizontal mouse
/// delta since the last mouse movement event.
pub const MOUSE_EVENT_DELTA_X: CGEventField = 4;
/// Key to access an integer field that contains the vertical mouse delta
/// since the last mouse movement event.
pub const MOUSE_EVENT_DELTA_Y: CGEventField = 5;
/// Key to access an integer field. The value is non-zero if the event
/// should be ignored by the Inkwell subsystem.
pub const MOUSE_EVENT_INSTANT_MOUSER: CGEventField = 6;
/// Key to access an integer field that encodes the mouse event subtype as
/// a `kCFNumberIntType'.
pub const MOUSE_EVENT_SUB_TYPE: CGEventField = 7;
/// Key to access an integer field, non-zero when this is an autorepeat of
/// a key-down, and zero otherwise.
pub const KEYBOARD_EVENT_AUTOREPEAT: CGEventField = 8;
/// Key to access an integer field that contains the virtual keycode of the
/// key-down or key-up event.
pub const KEYBOARD_EVENT_KEYCODE: CGEventField = 9;
/// Key to access an integer field that contains the keyboard type
/// identifier.
pub const KEYBOARD_EVENT_KEYBOARD_TYPE: CGEventField = 10;
/// Key to access an integer field that contains scrolling data. This field
/// typically contains the change in vertical position since the last
/// scrolling event from a Mighty Mouse scroller or a single-wheel mouse
/// scroller.
pub const SCROLL_WHEEL_EVENT_DELTA_AXIS_1: CGEventField = 11;
/// Key to access an integer field that contains scrolling data. This field
/// typically contains the change in horizontal position since the last
/// scrolling event from a Mighty Mouse scroller.
pub const SCROLL_WHEEL_EVENT_DELTA_AXIS_2: CGEventField = 12;
/// Key to access a field that contains scrolling data. The scrolling data
/// represents a line-based or pixel-based change in vertical position
/// since the last scrolling event from a Mighty Mouse scroller or a
/// single-wheel mouse scroller. The scrolling data uses a fixed-point
/// 16.16 signed integer format. If this key is passed to
/// `CGEventGetDoubleValueField', the fixed-point value is converted to a
/// double value.
pub const SCROLL_WHEEL_EVENT_FIXED_POINT_DELTA_AXIS_1: CGEventField = 93;
/// Key to access a field that contains scrolling data. The scrolling data
/// represents a line-based or pixel-based change in horizontal position
/// since the last scrolling event from a Mighty Mouse scroller. The
/// scrolling data uses a fixed-point 16.16 signed integer format. If this
/// key is passed to `CGEventGetDoubleValueField', the fixed-point value is
/// converted to a double value.
pub const SCROLL_WHEEL_EVENT_FIXED_POINT_DELTA_AXIS_2: CGEventField = 94;
/// Key to access an integer field that contains pixel-based scrolling
/// data. The scrolling data represents the change in vertical position
/// since the last scrolling event from a Mighty Mouse scroller or a
/// single-wheel mouse scroller.
pub const SCROLL_WHEEL_EVENT_POINT_DELTA_AXIS_1: CGEventField = 96;
/// Key to access an integer field that contains pixel-based scrolling
/// data. The scrolling data represents the change in horizontal position
/// since the last scrolling event from a Mighty Mouse scroller.
pub const SCROLL_WHEEL_EVENT_POINT_DELTA_AXIS_2: CGEventField = 97;
/// Key to access an integer field that indicates whether the event should
/// be ignored by the Inkwell subsystem. If the value is non-zero, the
/// event should be ignored.
pub const SCROLL_WHEEL_EVENT_INSTANT_MOUSER: CGEventField = 14;
/// Key to access an integer field that contains the absolute X coordinate
/// in tablet space at full tablet resolution.
pub const TABLET_EVENT_POINT_X: CGEventField = 15;
/// Key to access an integer field that contains the absolute Y coordinate
/// in tablet space at full tablet resolution.
pub const TABLET_EVENT_POINT_Y: CGEventField = 16;
/// Key to access an integer field that contains the absolute Z coordinate
/// in tablet space at full tablet resolution.
pub const TABLET_EVENT_POINT_Z: CGEventField = 17;
/// Key to access an integer field that contains the tablet button state.
/// Bit 0 is the first button, and a set bit represents a closed or pressed
/// button. Up to 16 buttons are supported.
pub const TABLET_EVENT_POINT_BUTTONS: CGEventField = 18;
/// Key to access a double field that contains the tablet pen pressure. A
/// value of 0.0 represents no pressure, and 1.0 represents maximum
/// pressure.
pub const TABLET_EVENT_POINT_PRESSURE: CGEventField = 19;
/// Key to access a double field that contains the horizontal tablet pen
/// tilt. A value of 0 represents no tilt, and 1 represents maximum tilt.
pub const TABLET_EVENT_TILT_X: CGEventField = 20;
/// Key to access a double field that contains the vertical tablet pen
/// tilt. A value of 0 represents no tilt, and 1 represents maximum tilt.
pub const TABLET_EVENT_TILT_Y: CGEventField = 21;
/// Key to access a double field that contains the tablet pen rotation.
pub const TABLET_EVENT_ROTATION: CGEventField = 22;
/// Key to access a double field that contains the tangential pressure on
/// the device. A value of 0.0 represents no pressure, and 1.0 represents
/// maximum pressure.
pub const TABLET_EVENT_TANGENTIAL_PRESSURE: CGEventField = 23;
/// Key to access an integer field that contains the system-assigned unique
/// device ID.
pub const TABLET_EVENT_DEVICE_ID: CGEventField = 24;
/// Key to access an integer field that contains a vendor-specified value.
pub const TABLET_EVENT_VENDOR_1: CGEventField = 25;
/// Key to access an integer field that contains a vendor-specified value.
pub const TABLET_EVENT_VENDOR_2: CGEventField = 26;
/// Key to access an integer field that contains a vendor-specified value.
pub const TABLET_EVENT_VENDOR_3: CGEventField = 27;
/// Key to access an integer field that contains the vendor-defined ID,
/// typically the USB vendor ID.
pub const TABLET_PROXIMITY_EVENT_VENDOR_ID: CGEventField = 28;
/// Key to access an integer field that contains the vendor-defined tablet
/// ID, typically the USB product ID.
pub const TABLET_PROXIMITY_EVENT_TABLET_ID: CGEventField = 29;
/// Key to access an integer field that contains the vendor-defined ID of
/// the pointing device.
pub const TABLET_PROXIMITY_EVENT_POINTER_ID: CGEventField = 30;
/// Key to access an integer field that contains the system-assigned
/// device ID.
pub const TABLET_PROXIMITY_EVENT_DEVICE_ID: CGEventField = 31;
/// Key to access an integer field that contains the system-assigned
/// unique tablet ID.
pub const TABLET_PROXIMITY_EVENT_SYSTEM_TABLET_ID: CGEventField = 32;
/// Key to access an integer field that contains the vendor-assigned
/// pointer type.
pub const TABLET_PROXIMITY_EVENT_VENDOR_POINTER_TYPE: CGEventField = 33;
/// Key to access an integer field that contains the vendor-defined
/// pointer serial number.
pub const TABLET_PROXIMITY_EVENT_VENDOR_POINTER_SERIAL_NUMBER: CGEventField = 34;
/// Key to access an integer field that contains the vendor-defined unique
/// ID.
pub const TABLET_PROXIMITY_EVENT_VENDOR_UNIQUE_ID: CGEventField = 35;
/// Key to access an integer field that contains the device capabilities
/// mask.
pub const TABLET_PROXIMITY_EVENT_CAPABILITY_MASK: CGEventField = 36;
/// Key to access an integer field that contains the pointer type.
pub const TABLET_PROXIMITY_EVENT_POINTER_TYPE: CGEventField = 37;
/// Key to access an integer field that indicates whether the pen is in
/// proximity to the tablet. The value is non-zero if the pen is in
/// proximity to the tablet and zero when leaving the tablet.
pub const TABLET_PROXIMITY_EVENT_ENTER_PROXIMITY: CGEventField = 38;
/// Key to access a field that contains the event target process serial
/// number. The value is a 64-bit value.
pub const EVENT_TARGET_PROCESS_SERIAL_NUMBER: CGEventField = 39;
/// Key to access a field that contains the event target Unix process ID.
pub const EVENT_TARGET_UNIX_PROCESS_ID: CGEventField = 40;
/// Key to access a field that contains the event source Unix process ID.
pub const EVENT_SOURCE_UNIX_PROCESS_ID: CGEventField = 41;
/// Key to access a field that contains the event source user-supplied
/// data, up to 64 bits.
pub const EVENT_SOURCE_USER_DATA: CGEventField = 42;
/// Key to access a field that contains the event source Unix effective UID.
pub const EVENT_SOURCE_USER_ID: CGEventField = 43;
/// Key to access a field that contains the event source Unix effective
/// GID.
pub const EVENT_SOURCE_GROUP_ID: CGEventField = 44;
/// Key to access a field that contains the event source state ID used to
/// create this event.
pub const EVENT_SOURCE_STATE_ID: CGEventField = 45;
/// Key to access an integer field that indicates whether a scrolling event
/// contains continuous, pixel-based scrolling data. The value is non-zero
/// when the scrolling data is pixel-based and zero when the scrolling data
/// is line-based.
pub const SCROLL_WHEEL_EVENT_IS_CONTINUOUS: CGEventField = 88;
/// Added in 10.5; made public in 10.7.
pub const MOUSE_EVENT_WINDOW_UNDER_MOUSE_POINTER: CGEventField = 91;
pub const MOUSE_EVENT_WINDOW_UNDER_MOUSE_POINTER_THAT_CAN_HANDLE_THIS_EVENT: CGEventField = 92;
}
// Constants that specify buttons on a one, two, or three-button mouse.
#[repr(C)]
#[derive(Clone, Copy, Debug)]
@ -89,75 +376,27 @@ pub enum CGEventTapLocation {
AnnotatedSession,
}
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum __CGEvent {}
pub type CGEventRef = *const __CGEvent;
pub struct CGEvent {
obj: CGEventRef,
foreign_type! {
#[doc(hidden)]
type CType = ::sys::CGEvent;
fn drop = |p| CFRelease(p as *mut _);
fn clone = |p| CFRetain(p as *const _) as *mut _;
pub struct CGEvent;
pub struct CGEventRef;
}
impl Clone for CGEvent {
#[inline]
fn clone(&self) -> CGEvent {
unsafe {
TCFType::wrap_under_get_rule(self.obj)
}
}
}
impl Drop for CGEvent {
fn drop(&mut self) {
unsafe {
let ptr = self.as_CFTypeRef();
assert!(ptr != ptr::null());
CFRelease(ptr);
}
}
}
impl TCFType<CGEventRef> for CGEvent {
#[inline]
fn as_concrete_TypeRef(&self) -> CGEventRef {
self.obj
}
#[inline]
unsafe fn wrap_under_get_rule(reference: CGEventRef) -> CGEvent {
let reference: CGEventRef = mem::transmute(CFRetain(mem::transmute(reference)));
TCFType::wrap_under_create_rule(reference)
}
#[inline]
fn as_CFTypeRef(&self) -> CFTypeRef {
unsafe {
mem::transmute(self.as_concrete_TypeRef())
}
}
#[inline]
unsafe fn wrap_under_create_rule(obj: CGEventRef) -> CGEvent {
CGEvent {
obj: obj,
}
}
#[inline]
fn type_id() -> CFTypeID {
impl CGEvent {
pub fn type_id() -> CFTypeID {
unsafe {
CGEventGetTypeID()
}
}
}
impl CGEvent {
pub fn new(source: CGEventSource) -> Result<CGEvent, ()> {
unsafe {
let event_ref = CGEventCreate(source.as_concrete_TypeRef());
if event_ref != ptr::null() {
Ok(TCFType::wrap_under_create_rule(event_ref))
let event_ref = CGEventCreate(source.as_ptr());
if !event_ref.is_null() {
Ok(Self::from_ptr(event_ref))
} else {
Err(())
}
@ -170,9 +409,9 @@ impl CGEvent {
keydown: bool
) -> Result<CGEvent, ()> {
unsafe {
let event_ref = CGEventCreateKeyboardEvent(source.as_concrete_TypeRef(), keycode, keydown);
if event_ref != ptr::null() {
Ok(TCFType::wrap_under_create_rule(event_ref))
let event_ref = CGEventCreateKeyboardEvent(source.as_ptr(), keycode, keydown);
if !event_ref.is_null() {
Ok(Self::from_ptr(event_ref))
} else {
Err(())
}
@ -186,10 +425,10 @@ impl CGEvent {
mouse_button: CGMouseButton
) -> Result<CGEvent, ()> {
unsafe {
let event_ref = CGEventCreateMouseEvent(source.as_concrete_TypeRef(), mouse_type,
let event_ref = CGEventCreateMouseEvent(source.as_ptr(), mouse_type,
mouse_cursor_position, mouse_button);
if event_ref != ptr::null() {
Ok(TCFType::wrap_under_create_rule(event_ref))
if !event_ref.is_null() {
Ok(Self::from_ptr(event_ref))
} else {
Err(())
}
@ -198,51 +437,51 @@ impl CGEvent {
pub fn post(&self, tap_location: CGEventTapLocation) {
unsafe {
CGEventPost(tap_location, self.as_concrete_TypeRef());
CGEventPost(tap_location, self.as_ptr());
}
}
pub fn location(&self) -> CGPoint {
unsafe {
CGEventGetLocation(self.as_concrete_TypeRef())
CGEventGetLocation(self.as_ptr())
}
}
#[cfg(feature = "elcapitan")]
pub fn post_to_pid(&self, pid: libc::pid_t) {
unsafe {
CGEventPostToPid(pid, self.as_concrete_TypeRef());
CGEventPostToPid(pid, self.as_ptr());
}
}
pub fn set_flags(&self, flags: CGEventFlags) {
unsafe {
CGEventSetFlags(self.as_concrete_TypeRef(), flags);
CGEventSetFlags(self.as_ptr(), flags);
}
}
pub fn get_flags(&self) -> CGEventFlags {
unsafe {
CGEventGetFlags(self.as_concrete_TypeRef())
CGEventGetFlags(self.as_ptr())
}
}
pub fn set_type(&self, event_type: CGEventType) {
unsafe {
CGEventSetType(self.as_concrete_TypeRef(), event_type);
CGEventSetType(self.as_ptr(), event_type);
}
}
pub fn get_type(&self) -> CGEventType {
unsafe {
CGEventGetType(self.as_concrete_TypeRef())
CGEventGetType(self.as_ptr())
}
}
pub fn set_string_from_utf16_unchecked(&self, buf: &[u16]) {
let buflen = buf.len() as libc::c_ulong;
unsafe {
CGEventKeyboardSetUnicodeString(self.as_concrete_TypeRef(), buflen, buf.as_ptr());
CGEventKeyboardSetUnicodeString(self.as_ptr(), buflen, buf.as_ptr());
}
}
@ -250,16 +489,32 @@ impl CGEvent {
let buf: Vec<u16> = string.encode_utf16().collect();
self.set_string_from_utf16_unchecked(&buf);
}
pub fn get_integer_value_field(&self, field: CGEventField) -> i64 {
unsafe { CGEventGetIntegerValueField(self.as_ptr(), field) }
}
pub fn set_integer_value_field(&self, field: CGEventField, value: i64) {
unsafe { CGEventSetIntegerValueField(self.as_ptr(), field, value) }
}
pub fn get_double_value_field(&self, field: CGEventField) -> f64 {
unsafe { CGEventGetDoubleValueField(self.as_ptr(), field) }
}
pub fn set_double_value_field(&self, field: CGEventField, value: f64) {
unsafe { CGEventSetDoubleValueField(self.as_ptr(), field, value) }
}
}
#[link(name = "ApplicationServices", kind = "framework")]
#[link(name = "CoreGraphics", kind = "framework")]
extern {
/// Return the type identifier for the opaque type `CGEventRef'.
fn CGEventGetTypeID() -> CFTypeID;
/// Return a new event using the event source `source'. If `source' is NULL,
/// the default source is used.
fn CGEventCreate(source: CGEventSourceRef) -> CGEventRef;
fn CGEventCreate(source: ::sys::CGEventSourceRef) -> ::sys::CGEventRef;
/// Return a new keyboard event.
///
@ -271,8 +526,8 @@ extern {
/// SHIFT, CONTROL, OPTION, and COMMAND keys. For example, to produce a 'Z',
/// the SHIFT key must be down, the 'z' key must go down, and then the SHIFT
/// and 'z' key must be released:
fn CGEventCreateKeyboardEvent(source: CGEventSourceRef, keycode: CGKeyCode,
keydown: bool) -> CGEventRef;
fn CGEventCreateKeyboardEvent(source: ::sys::CGEventSourceRef, keycode: CGKeyCode,
keydown: bool) -> ::sys::CGEventRef;
/// Return a new mouse event.
///
@ -283,39 +538,39 @@ extern {
/// is ignored unless `mouseType' is one of `kCGEventOtherMouseDown',
/// `kCGEventOtherMouseDragged', or `kCGEventOtherMouseUp'.
///
/// The current implemementation of the event system supports a maximum of
/// The current implementation of the event system supports a maximum of
/// thirty-two buttons. Mouse button 0 is the primary button on the mouse.
/// Mouse button 1 is the secondary mouse button (right). Mouse button 2 is
/// the center button, and the remaining buttons are in USB device order.
fn CGEventCreateMouseEvent(source: CGEventSourceRef, mouseType: CGEventType,
mouseCursorPosition: CGPoint, mouseButton: CGMouseButton) -> CGEventRef;
fn CGEventCreateMouseEvent(source: ::sys::CGEventSourceRef, mouseType: CGEventType,
mouseCursorPosition: CGPoint, mouseButton: CGMouseButton) -> ::sys::CGEventRef;
/// Post an event into the event stream at a specified location.
///
/// This function posts the specified event immediately before any event taps
/// instantiated for that location, and the event passes through any such
/// taps.
fn CGEventPost(tapLocation: CGEventTapLocation, event: CGEventRef);
fn CGEventPost(tapLocation: CGEventTapLocation, event: ::sys::CGEventRef);
#[cfg(feature = "elcapitan")]
/// Post an event to a specified process ID
fn CGEventPostToPid(pid: libc::pid_t, event: CGEventRef);
fn CGEventPostToPid(pid: libc::pid_t, event: ::sys::CGEventRef);
/// Set the event flags of an event.
fn CGEventSetFlags(event: CGEventRef, flags: CGEventFlags);
fn CGEventSetFlags(event: ::sys::CGEventRef, flags: CGEventFlags);
/// Return the event flags of an event.
fn CGEventGetFlags(event: CGEventRef) -> CGEventFlags;
fn CGEventGetFlags(event: ::sys::CGEventRef) -> CGEventFlags;
/// Return the location of an event in global display coordinates.
/// CGPointZero is returned if event is not a valid CGEventRef.
fn CGEventGetLocation(event: CGEventRef) -> CGPoint;
/// CGPointZero is returned if event is not a valid ::sys::CGEventRef.
fn CGEventGetLocation(event: ::sys::CGEventRef) -> CGPoint;
/// Set the event type of an event.
fn CGEventSetType(event: CGEventRef, eventType: CGEventType);
fn CGEventSetType(event: ::sys::CGEventRef, eventType: CGEventType);
/// Return the event type of an event (left mouse down, for example).
fn CGEventGetType(event: CGEventRef) -> CGEventType;
fn CGEventGetType(event: ::sys::CGEventRef) -> CGEventType;
/// Set the Unicode string associated with a keyboard event.
///
@ -325,7 +580,40 @@ extern {
/// Note that application frameworks may ignore the Unicode string in a
/// keyboard event and do their own translation based on the virtual
/// keycode and perceived event state.
fn CGEventKeyboardSetUnicodeString(event: CGEventRef,
fn CGEventKeyboardSetUnicodeString(event: ::sys::CGEventRef,
length: libc::c_ulong,
string: *const u16);
/// Return the integer value of a field in an event.
fn CGEventGetIntegerValueField(event: ::sys::CGEventRef, field: CGEventField) -> i64;
/// Set the integer value of a field in an event.
///
/// Before calling this function, the event type must be set using a typed
/// event creation function such as `CGEventCreateMouseEvent', or by
/// calling `CGEventSetType'.
///
/// If you are creating a mouse event generated by a tablet, call this
/// function and specify the field `kCGMouseEventSubtype' with a value of
/// `kCGEventMouseSubtypeTabletPoint' or
/// `kCGEventMouseSubtypeTabletProximity' before setting other parameters.
fn CGEventSetIntegerValueField(event: ::sys::CGEventRef, field: CGEventField, value: i64);
/// Return the floating-point value of a field in an event.
///
/// In cases where the field value is represented within the event by a fixed
/// point number or an integer, the result is scaled to the appropriate range
/// as part of creating the floating-point representation.
fn CGEventGetDoubleValueField(event: ::sys::CGEventRef, field: CGEventField) -> f64;
/// Set the floating-point value of a field in an event.
///
/// Before calling this function, the event type must be set using a typed
/// event creation function such as `CGEventCreateMouseEvent', or by calling
/// `CGEventSetType'.
///
/// In cases where the fields value is represented within the event by a
/// fixed point number or integer, the value parameter is scaled as needed
/// and converted to the appropriate type.
fn CGEventSetDoubleValueField(event: ::sys::CGEventRef, field: CGEventField, value: f64);
}

Просмотреть файл

@ -1,7 +1,5 @@
use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType};
use std::mem;
use std::ptr;
use core_foundation::base::{CFRelease, CFRetain, CFTypeID};
use foreign_types::ForeignType;
/// Possible source states of an event source.
#[repr(C)]
@ -12,75 +10,27 @@ pub enum CGEventSourceStateID {
HIDSystemState = 1,
}
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum __CGEventSource {}
pub type CGEventSourceRef = *const __CGEventSource;
pub struct CGEventSource {
obj: CGEventSourceRef,
foreign_type! {
#[doc(hidden)]
type CType = ::sys::CGEventSource;
fn drop = |p| CFRelease(p as *mut _);
fn clone = |p| CFRetain(p as *const _) as *mut _;
pub struct CGEventSource;
pub struct CGEventSourceRef;
}
impl Clone for CGEventSource {
#[inline]
fn clone(&self) -> CGEventSource {
unsafe {
TCFType::wrap_under_get_rule(self.obj)
}
}
}
impl Drop for CGEventSource {
fn drop(&mut self) {
unsafe {
let ptr = self.as_CFTypeRef();
assert!(ptr != ptr::null());
CFRelease(ptr);
}
}
}
impl TCFType<CGEventSourceRef> for CGEventSource {
#[inline]
fn as_concrete_TypeRef(&self) -> CGEventSourceRef {
self.obj
}
#[inline]
unsafe fn wrap_under_get_rule(reference: CGEventSourceRef) -> CGEventSource {
let reference: CGEventSourceRef = mem::transmute(CFRetain(mem::transmute(reference)));
TCFType::wrap_under_create_rule(reference)
}
#[inline]
fn as_CFTypeRef(&self) -> CFTypeRef {
unsafe {
mem::transmute(self.as_concrete_TypeRef())
}
}
#[inline]
unsafe fn wrap_under_create_rule(obj: CGEventSourceRef) -> CGEventSource {
CGEventSource {
obj: obj,
}
}
#[inline]
fn type_id() -> CFTypeID {
impl CGEventSource {
pub fn type_id() -> CFTypeID {
unsafe {
CGEventSourceGetTypeID()
}
}
}
impl CGEventSource {
pub fn new(state_id: CGEventSourceStateID) -> Result<CGEventSource, ()> {
pub fn new(state_id: CGEventSourceStateID) -> Result<Self, ()> {
unsafe {
let event_source_ref = CGEventSourceCreate(state_id);
if event_source_ref != ptr::null() {
Ok(TCFType::wrap_under_create_rule(event_source_ref))
if !event_source_ref.is_null() {
Ok(Self::from_ptr(event_source_ref))
} else {
Err(())
}
@ -88,11 +38,11 @@ impl CGEventSource {
}
}
#[link(name = "ApplicationServices", kind = "framework")]
#[link(name = "CoreGraphics", kind = "framework")]
extern {
/// Return the type identifier for the opaque type `CGEventSourceRef'.
fn CGEventSourceGetTypeID() -> CFTypeID;
/// Return a Quartz event source created with a specified source state.
fn CGEventSourceCreate(stateID: CGEventSourceStateID) -> CGEventSourceRef;
fn CGEventSourceCreate(stateID: CGEventSourceStateID) -> ::sys::CGEventSourceRef;
}

153
third_party/rust/core-graphics/src/font.rs поставляемый
Просмотреть файл

@ -7,88 +7,42 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core_foundation::base::{CFRelease, CFRetain, CFTypeID, CFTypeRef, TCFType};
use core_foundation::base::{CFRelease, CFRetain, CFTypeID, TCFType};
use core_foundation::string::{CFString, CFStringRef};
use data_provider::{CGDataProvider, CGDataProviderRef};
use core_foundation::dictionary::{CFDictionary, CFDictionaryRef};
use data_provider::CGDataProvider;
use geometry::CGRect;
use libc;
use std::mem;
use std::ptr;
use foreign_types::ForeignType;
use libc::{self, c_int, size_t};
pub type CGGlyph = libc::c_ushort;
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum __CGFont {}
pub type CGFontRef = *const __CGFont;
pub struct CGFont {
obj: CGFontRef,
foreign_type! {
#[doc(hidden)]
type CType = ::sys::CGFont;
fn drop = |p| CFRelease(p as *mut _);
fn clone = |p| CFRetain(p as *const _) as *mut _;
pub struct CGFont;
pub struct CGFontRef;
}
unsafe impl Send for CGFont {}
unsafe impl Sync for CGFont {}
impl Clone for CGFont {
#[inline]
fn clone(&self) -> CGFont {
unsafe {
TCFType::wrap_under_get_rule(self.obj)
}
}
}
impl Drop for CGFont {
fn drop(&mut self) {
unsafe {
let ptr = self.as_CFTypeRef();
assert!(ptr != ptr::null());
CFRelease(ptr);
}
}
}
impl TCFType<CGFontRef> for CGFont {
#[inline]
fn as_concrete_TypeRef(&self) -> CGFontRef {
self.obj
}
#[inline]
unsafe fn wrap_under_get_rule(reference: CGFontRef) -> CGFont {
let reference: CGFontRef = mem::transmute(CFRetain(mem::transmute(reference)));
TCFType::wrap_under_create_rule(reference)
}
#[inline]
fn as_CFTypeRef(&self) -> CFTypeRef {
unsafe {
mem::transmute(self.as_concrete_TypeRef())
}
}
#[inline]
unsafe fn wrap_under_create_rule(obj: CGFontRef) -> CGFont {
CGFont {
obj: obj,
}
}
#[inline]
fn type_id() -> CFTypeID {
impl CGFont {
pub fn type_id() -> CFTypeID {
unsafe {
CGFontGetTypeID()
}
}
}
impl CGFont {
pub fn from_data_provider(provider: CGDataProvider) -> Result<CGFont, ()> {
unsafe {
let font_ref = CGFontCreateWithDataProvider(provider.as_concrete_TypeRef());
if font_ref != ptr::null() {
Ok(TCFType::wrap_under_create_rule(font_ref))
let font_ref = CGFontCreateWithDataProvider(provider.as_ptr());
if !font_ref.is_null() {
Ok(CGFont::from_ptr(font_ref))
} else {
Err(())
}
@ -98,8 +52,20 @@ impl CGFont {
pub fn from_name(name: &CFString) -> Result<CGFont, ()> {
unsafe {
let font_ref = CGFontCreateWithFontName(name.as_concrete_TypeRef());
if font_ref != ptr::null() {
Ok(TCFType::wrap_under_create_rule(font_ref))
if !font_ref.is_null() {
Ok(CGFont::from_ptr(font_ref))
} else {
Err(())
}
}
}
pub fn create_copy_from_variations(&self, vars: &CFDictionary) -> Result<CGFont, ()> {
unsafe {
let font_ref = CGFontCreateCopyWithVariations(self.as_ptr(),
vars.as_concrete_TypeRef());
if !font_ref.is_null() {
Ok(CGFont::from_ptr(font_ref))
} else {
Err(())
}
@ -108,23 +74,62 @@ impl CGFont {
pub fn postscript_name(&self) -> CFString {
unsafe {
let string_ref = CGFontCopyPostScriptName(self.obj);
let string_ref = CGFontCopyPostScriptName(self.as_ptr());
TCFType::wrap_under_create_rule(string_ref)
}
}
pub fn get_glyph_b_boxes(&self, glyphs: &[CGGlyph], bboxes: &mut [CGRect]) -> bool {
unsafe {
assert!(bboxes.len() >= glyphs.len());
CGFontGetGlyphBBoxes(self.as_ptr(),
glyphs.as_ptr(),
glyphs.len(),
bboxes.as_mut_ptr())
}
}
pub fn get_glyph_advances(&self, glyphs: &[CGGlyph], advances: &mut [c_int]) -> bool {
unsafe {
assert!(advances.len() >= glyphs.len());
CGFontGetGlyphAdvances(self.as_ptr(),
glyphs.as_ptr(),
glyphs.len(),
advances.as_mut_ptr())
}
}
pub fn get_units_per_em(&self) -> c_int {
unsafe {
CGFontGetUnitsPerEm(self.as_ptr())
}
}
}
#[link(name = "ApplicationServices", kind = "framework")]
#[link(name = "CoreGraphics", kind = "framework")]
extern {
// TODO: basically nothing has bindings (even commented-out) besides what we use.
fn CGFontCreateWithDataProvider(provider: CGDataProviderRef) -> CGFontRef;
fn CGFontCreateWithFontName(name: CFStringRef) -> CGFontRef;
fn CGFontCreateWithDataProvider(provider: ::sys::CGDataProviderRef) -> ::sys::CGFontRef;
fn CGFontCreateWithFontName(name: CFStringRef) -> ::sys::CGFontRef;
fn CGFontCreateCopyWithVariations(font: ::sys::CGFontRef, vars: CFDictionaryRef) -> ::sys::CGFontRef;
fn CGFontGetTypeID() -> CFTypeID;
fn CGFontCopyPostScriptName(font: CGFontRef) -> CFStringRef;
fn CGFontCopyPostScriptName(font: ::sys::CGFontRef) -> CFStringRef;
// These do the same thing as CFRetain/CFRelease, except
// gracefully handle a NULL argument. We don't use them.
//fn CGFontRetain(font: CGFontRef);
//fn CGFontRelease(font: CGFontRef);
//fn CGFontRetain(font: ::sys::CGFontRef);
//fn CGFontRelease(font: ::sys::CGFontRef);
fn CGFontGetGlyphBBoxes(font: ::sys::CGFontRef,
glyphs: *const CGGlyph,
count: size_t,
bboxes: *mut CGRect)
-> bool;
fn CGFontGetGlyphAdvances(font: ::sys::CGFontRef,
glyphs: *const CGGlyph,
count: size_t,
advances: *mut c_int)
-> bool;
fn CGFontGetUnitsPerEm(font: ::sys::CGFontRef) -> c_int;
}

Просмотреть файл

@ -16,8 +16,24 @@ pub const CG_ZERO_POINT: CGPoint = CGPoint {
y: 0.0,
};
pub const CG_ZERO_SIZE: CGSize = CGSize {
width: 0.0,
height: 0.0,
};
pub const CG_ZERO_RECT: CGRect = CGRect {
origin: CG_ZERO_POINT,
size: CG_ZERO_SIZE,
};
pub const CG_AFFINE_TRANSFORM_IDENTITY: CGAffineTransform = CGAffineTransform {
a: 1.0, b: 0.0,
c: 0.0, d: 1.0,
tx: 0.0, ty: 0.0,
};
#[repr(C)]
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, Default)]
pub struct CGSize {
pub width: CGFloat,
pub height: CGFloat,
@ -31,10 +47,17 @@ impl CGSize {
height: height,
}
}
#[inline]
pub fn apply_transform(&self, t: &CGAffineTransform) -> CGSize {
unsafe {
ffi::CGSizeApplyAffineTransform(*self, *t)
}
}
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, Default)]
pub struct CGPoint {
pub x: CGFloat,
pub y: CGFloat,
@ -48,10 +71,17 @@ impl CGPoint {
y: y,
}
}
#[inline]
pub fn apply_transform(&self, t: &CGAffineTransform) -> CGPoint {
unsafe {
ffi::CGPointApplyAffineTransform(*self, *t)
}
}
}
#[repr(C)]
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, Default)]
pub struct CGRect {
pub origin: CGPoint,
pub size: CGSize
@ -101,20 +131,65 @@ impl CGRect {
ffi::CGRectIntersectsRect(*self, *other) == 1
}
}
#[inline]
pub fn apply_transform(&self, t: &CGAffineTransform) -> CGRect {
unsafe {
ffi::CGRectApplyAffineTransform(*self, *t)
}
}
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Default)]
pub struct CGAffineTransform {
pub a: CGFloat,
pub b: CGFloat,
pub c: CGFloat,
pub d: CGFloat,
pub tx: CGFloat,
pub ty: CGFloat,
}
impl CGAffineTransform {
#[inline]
pub fn new(
a: CGFloat,
b: CGFloat,
c: CGFloat,
d: CGFloat,
tx: CGFloat,
ty: CGFloat,
) -> CGAffineTransform {
CGAffineTransform { a, b, c, d, tx, ty }
}
#[inline]
pub fn invert(&self) -> CGAffineTransform {
unsafe {
ffi::CGAffineTransformInvert(*self)
}
}
}
mod ffi {
use base::{CGFloat, boolean_t};
use geometry::CGRect;
use geometry::{CGAffineTransform, CGPoint, CGRect, CGSize};
use core_foundation::dictionary::CFDictionaryRef;
#[link(name = "ApplicationServices", kind = "framework")]
#[link(name = "CoreGraphics", kind = "framework")]
extern {
pub fn CGRectInset(rect: CGRect, dx: CGFloat, dy: CGFloat) -> CGRect;
pub fn CGRectMakeWithDictionaryRepresentation(dict: CFDictionaryRef,
rect: *mut CGRect) -> boolean_t;
pub fn CGRectIsEmpty(rect: CGRect) -> boolean_t;
pub fn CGRectIntersectsRect(rect1: CGRect, rect2: CGRect) -> boolean_t;
pub fn CGAffineTransformInvert(t: CGAffineTransform) -> CGAffineTransform;
pub fn CGPointApplyAffineTransform(point: CGPoint, t: CGAffineTransform) -> CGPoint;
pub fn CGRectApplyAffineTransform(rect: CGRect, t: CGAffineTransform) -> CGRect;
pub fn CGSizeApplyAffineTransform(size: CGSize, t: CGAffineTransform) -> CGSize;
}
}

123
third_party/rust/core-graphics/src/image.rs поставляемый
Просмотреть файл

@ -1,15 +1,14 @@
use core_foundation::base::{CFRetain, CFTypeID, CFTypeRef, TCFType};
use core_foundation::base::{CFRetain, CFTypeID};
use core_foundation::data::CFData;
use color_space::{CGColorSpace, CGColorSpaceRef};
use data_provider::{CGDataProvider, CGDataProviderRef};
use color_space::CGColorSpace;
use data_provider::CGDataProviderRef;
use libc::size_t;
use std::ops::Deref;
use std::mem;
use foreign_types::{ForeignType, ForeignTypeRef};
#[repr(C)]
pub enum CGImageAlphaInfo {
CGImageAlphaNone, /* For example, RGB. */
CGImageAlphaPremultipliedLast, /* For example, premultiplied RGBA */
CGImageAlphaPremultipliedLast, /* For example, premultiplied RGBA */
CGImageAlphaPremultipliedFirst, /* For example, premultiplied ARGB */
CGImageAlphaLast, /* For example, non-premultiplied RGBA */
CGImageAlphaFirst, /* For example, non-premultiplied ARGB */
@ -27,102 +26,59 @@ pub enum CGImageByteOrderInfo {
CGImageByteOrder32Big = (4 << 12)
}
// This is an enum due to zero-sized types warnings.
// For more details see https://github.com/rust-lang/rust/issues/27303
pub enum __CGImage {}
pub type CGImageRef = *const __CGImage;
pub struct CGImage {
obj: CGImageRef,
foreign_type! {
#[doc(hidden)]
type CType = ::sys::CGImage;
fn drop = CGImageRelease;
fn clone = |p| CFRetain(p as *const _) as *mut _;
pub struct CGImage;
pub struct CGImageRef;
}
impl Drop for CGImage {
fn drop(&mut self) {
unsafe {
CGImageRelease(self.as_concrete_TypeRef())
}
}
}
impl Clone for CGImage {
fn clone(&self) -> CGImage {
unsafe {
TCFType::wrap_under_get_rule(self.as_concrete_TypeRef())
}
}
}
// TODO: Replace all this stuff by simply using:
// impl_TCFType!(CGImage, CGImageRef, CGImageGetTypeID);
impl TCFType<CGImageRef> for CGImage {
#[inline]
fn as_concrete_TypeRef(&self) -> CGImageRef {
self.obj
}
#[inline]
unsafe fn wrap_under_get_rule(reference: CGImageRef) -> CGImage {
let reference: CGImageRef = mem::transmute(CFRetain(mem::transmute(reference)));
TCFType::wrap_under_create_rule(reference)
}
#[inline]
fn as_CFTypeRef(&self) -> CFTypeRef {
unsafe {
mem::transmute(self.as_concrete_TypeRef())
}
}
#[inline]
unsafe fn wrap_under_create_rule(obj: CGImageRef) -> CGImage {
CGImage {
obj: obj,
}
}
#[inline]
fn type_id() -> CFTypeID {
impl CGImage {
pub fn type_id() -> CFTypeID {
unsafe {
CGImageGetTypeID()
}
}
}
impl CGImage {
impl CGImageRef {
pub fn width(&self) -> size_t {
unsafe {
CGImageGetWidth(self.as_concrete_TypeRef())
CGImageGetWidth(self.as_ptr())
}
}
pub fn height(&self) -> size_t {
unsafe {
CGImageGetHeight(self.as_concrete_TypeRef())
CGImageGetHeight(self.as_ptr())
}
}
pub fn bits_per_component(&self) -> size_t {
unsafe {
CGImageGetBitsPerComponent(self.as_concrete_TypeRef())
CGImageGetBitsPerComponent(self.as_ptr())
}
}
pub fn bits_per_pixel(&self) -> size_t {
unsafe {
CGImageGetBitsPerPixel(self.as_concrete_TypeRef())
CGImageGetBitsPerPixel(self.as_ptr())
}
}
pub fn bytes_per_row(&self) -> size_t {
unsafe {
CGImageGetBytesPerRow(self.as_concrete_TypeRef())
CGImageGetBytesPerRow(self.as_ptr())
}
}
pub fn color_space(&self) -> CGColorSpace {
unsafe {
TCFType::wrap_under_get_rule(CGImageGetColorSpace(self.as_concrete_TypeRef()))
let cs = CGImageGetColorSpace(self.as_ptr());
CFRetain(cs as *mut _);
CGColorSpace::from_ptr(cs)
}
}
@ -130,33 +86,24 @@ impl CGImage {
/// underlying buffer.
pub fn data(&self) -> CFData {
let data_provider = unsafe {
CGDataProvider::wrap_under_get_rule(CGImageGetDataProvider(self.as_concrete_TypeRef()))
CGDataProviderRef::from_ptr(CGImageGetDataProvider(self.as_ptr()))
};
data_provider.copy_data()
}
}
impl Deref for CGImage {
type Target = CGImageRef;
#[inline]
fn deref(&self) -> &CGImageRef {
&self.obj
}
}
#[link(name = "ApplicationServices", kind = "framework")]
#[link(name = "CoreGraphics", kind = "framework")]
extern {
fn CGImageGetTypeID() -> CFTypeID;
fn CGImageGetWidth(image: CGImageRef) -> size_t;
fn CGImageGetHeight(image: CGImageRef) -> size_t;
fn CGImageGetBitsPerComponent(image: CGImageRef) -> size_t;
fn CGImageGetBitsPerPixel(image: CGImageRef) -> size_t;
fn CGImageGetBytesPerRow(image: CGImageRef) -> size_t;
fn CGImageGetColorSpace(image: CGImageRef) -> CGColorSpaceRef;
fn CGImageGetDataProvider(image: CGImageRef) -> CGDataProviderRef;
fn CGImageRelease(image: CGImageRef);
fn CGImageGetWidth(image: ::sys::CGImageRef) -> size_t;
fn CGImageGetHeight(image: ::sys::CGImageRef) -> size_t;
fn CGImageGetBitsPerComponent(image: ::sys::CGImageRef) -> size_t;
fn CGImageGetBitsPerPixel(image: ::sys::CGImageRef) -> size_t;
fn CGImageGetBytesPerRow(image: ::sys::CGImageRef) -> size_t;
fn CGImageGetColorSpace(image: ::sys::CGImageRef) -> ::sys::CGColorSpaceRef;
fn CGImageGetDataProvider(image: ::sys::CGImageRef) -> ::sys::CGDataProviderRef;
fn CGImageRelease(image: ::sys::CGImageRef);
//fn CGImageGetAlphaInfo(image: CGImageRef) -> CGImageAlphaInfo;
//fn CGImageCreateCopyWithColorSpace(image: CGImageRef, space: CGColorSpaceRef) -> CGImageRef
//fn CGImageGetAlphaInfo(image: ::sys::CGImageRef) -> CGImageAlphaInfo;
//fn CGImageCreateCopyWithColorSpace(image: ::sys::CGImageRef, space: ::sys::CGColorSpaceRef) -> ::sys::CGImageRef
}

10
third_party/rust/core-graphics/src/lib.rs поставляемый
Просмотреть файл

@ -11,16 +11,26 @@ extern crate libc;
extern crate core_foundation;
#[macro_use]
#[cfg(target_os = "macos")]
extern crate bitflags;
#[macro_use]
extern crate foreign_types;
pub mod base;
pub mod color_space;
pub mod context;
pub mod data_provider;
#[cfg(target_os = "macos")]
pub mod display;
#[cfg(target_os = "macos")]
pub mod event;
#[cfg(target_os = "macos")]
pub mod event_source;
pub mod font;
pub mod geometry;
#[cfg(target_os = "macos")]
pub mod private;
pub mod image;
pub mod path;
mod sys;

115
third_party/rust/core-graphics/src/path.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,115 @@
// Copyright 2017 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use core_foundation::base::{CFRelease, CFRetain, CFTypeID};
use foreign_types::ForeignType;
use geometry::CGPoint;
use libc::c_void;
use std::fmt::{self, Debug, Formatter};
use std::marker::PhantomData;
use std::ops::Deref;
use std::slice;
foreign_type! {
#[doc(hidden)]
type CType = ::sys::CGPath;
fn drop = |p| CFRelease(p as *mut _);
fn clone = |p| CFRetain(p as *const _) as *mut _;
pub struct CGPath;
pub struct CGPathRef;
}
impl CGPath {
pub fn type_id() -> CFTypeID {
unsafe {
CGPathGetTypeID()
}
}
pub fn apply<'a, F>(&'a self, mut closure: &'a F) where F: FnMut(CGPathElementRef<'a>) {
unsafe {
CGPathApply(self.as_ptr(), &mut closure as *mut _ as *mut c_void, do_apply::<F>);
}
unsafe extern "C" fn do_apply<'a, F>(info: *mut c_void, element: *const CGPathElement)
where F: FnMut(CGPathElementRef<'a>) {
let closure = info as *mut *mut F;
(**closure)(CGPathElementRef::new(element))
}
}
}
#[repr(i32)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CGPathElementType {
MoveToPoint = 0,
AddLineToPoint = 1,
AddQuadCurveToPoint = 2,
AddCurveToPoint = 3,
CloseSubpath = 4,
}
pub struct CGPathElementRef<'a> {
element: *const CGPathElement,
phantom: PhantomData<&'a CGPathElement>,
}
impl<'a> CGPathElementRef<'a> {
fn new<'b>(element: *const CGPathElement) -> CGPathElementRef<'b> {
CGPathElementRef {
element: element,
phantom: PhantomData,
}
}
}
impl<'a> Deref for CGPathElementRef<'a> {
type Target = CGPathElement;
fn deref(&self) -> &CGPathElement {
unsafe {
&*self.element
}
}
}
#[repr(C)]
pub struct CGPathElement {
pub element_type: CGPathElementType,
points: *mut CGPoint,
}
impl Debug for CGPathElement {
fn fmt(&self, formatter: &mut Formatter) -> Result<(), fmt::Error> {
write!(formatter, "{:?}: {:?}", self.element_type, self.points())
}
}
impl CGPathElement {
pub fn points(&self) -> &[CGPoint] {
unsafe {
match self.element_type {
CGPathElementType::CloseSubpath => &[],
CGPathElementType::MoveToPoint | CGPathElementType::AddLineToPoint => {
slice::from_raw_parts(self.points, 1)
}
CGPathElementType::AddQuadCurveToPoint => slice::from_raw_parts(self.points, 2),
CGPathElementType::AddCurveToPoint => slice::from_raw_parts(self.points, 3),
}
}
}
}
type CGPathApplierFunction = unsafe extern "C" fn(info: *mut c_void,
element: *const CGPathElement);
#[link(name = "CoreGraphics", kind = "framework")]
extern {
fn CGPathApply(path: ::sys::CGPathRef, info: *mut c_void, function: CGPathApplierFunction);
fn CGPathGetTypeID() -> CFTypeID;
}

Просмотреть файл

@ -97,7 +97,7 @@ mod ffi {
pub type CGSRegionRef = *mut CGSRegionObject;
pub type OSStatus = i32;
#[link(name = "ApplicationServices", kind = "framework")]
#[link(name = "CoreGraphics", kind = "framework")]
extern {
pub fn CGSRegionRelease(region: CGSRegionRef);
pub fn CGSNewRegionWithRect(rect: *const CGRect, outRegion: *mut CGSRegionRef) -> CGError;

32
third_party/rust/core-graphics/src/sys.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,32 @@
pub enum CGImage {}
pub type CGImageRef = *mut CGImage;
pub enum CGColorSpace {}
pub type CGColorSpaceRef = *mut CGColorSpace;
pub enum CGPath {}
pub type CGPathRef = *mut CGPath;
pub enum CGDataProvider {}
pub type CGDataProviderRef = *mut CGDataProvider;
pub enum CGFont {}
pub type CGFontRef = *mut CGFont;
pub enum CGContext {}
pub type CGContextRef = *mut CGContext;
#[cfg(target_os = "macos")]
mod macos {
pub enum CGEvent {}
pub type CGEventRef = *mut CGEvent;
pub enum CGEventSource {}
pub type CGEventSourceRef = *mut CGEventSource;
pub enum CGDisplayMode {}
pub type CGDisplayModeRef = *mut CGDisplayMode;
}
#[cfg(target_os = "macos")]
pub use self::macos::*;

Просмотреть файл

@ -1 +1 @@
{"files":{".travis.yml":"6aad961651169d31d79c0595624d1777b5c4cbb4cf2bed9a126c7e72d29411fd","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"227a4fb6741d1bcf824afe7cfff7a716a8983543a5c4939a16edbf8ef7eab30d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"0c82015d302c9937e6376debd961350afeaeb6dde228aac95e3a3115c5813613","src/font.rs":"d73139838b7dc15319645a3b03bd3692a3b453fcd6304c7ebdeb454166e22db2","src/font_collection.rs":"5a8f5a17aec1dccf858ef1205c21d035fc5a8c7ac8ed7c089896a1f779bef126","src/font_descriptor.rs":"f932e5626ad8f93d88d82ed3bec9b249bdeccf3c44b1d5abfaed91e018e537d9","src/font_manager.rs":"de5e22620528322d6811d01f03975c53b676ec743297590de5e17a45393df0f1","src/lib.rs":"b1fc720a9ab7ae4f054f0767e05ba5640b2d9fc8c34d05ae04f25b9dd44f6b81"},"package":"2a23bef779fab70e5e6af23e36eed03a48e1c1687dea8929505d405ea48d1f5e"}
{"files":{".travis.yml":"6aad961651169d31d79c0595624d1777b5c4cbb4cf2bed9a126c7e72d29411fd","COPYRIGHT":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"dbf9d3ddfff7cc11bbff7b477652dab547a7f1afaa5cc0706cdb04d812663c86","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"0c82015d302c9937e6376debd961350afeaeb6dde228aac95e3a3115c5813613","src/font.rs":"39f65fd202feb019b184c69570866050d0379f2d6adf1e1609010f1b980e2ef2","src/font_collection.rs":"5a8f5a17aec1dccf858ef1205c21d035fc5a8c7ac8ed7c089896a1f779bef126","src/font_descriptor.rs":"f932e5626ad8f93d88d82ed3bec9b249bdeccf3c44b1d5abfaed91e018e537d9","src/font_manager.rs":"de5e22620528322d6811d01f03975c53b676ec743297590de5e17a45393df0f1","src/lib.rs":"dfff85c1e4dbbc5d360dd022a8e539be4e5f195d8695467e1dcb25bd0bac4f47"},"package":"bcad23756dd1dc4b47bf6a914ace27aadb8fa68889db5837af2308d018d0467c"}

16
third_party/rust/core-text/Cargo.toml поставляемый
Просмотреть файл

@ -12,19 +12,23 @@
[package]
name = "core-text"
version = "7.0.0"
version = "8.0.0"
authors = ["The Servo Project Developers"]
description = "Bindings to the Core Text framework."
license = "MIT/Apache-2.0"
repository = "https://github.com/servo/core-text-rs"
[dependencies.core-graphics]
version = "0.12.1"
[dependencies.core-foundation]
version = "0.4"
[dependencies.libc]
version = "0.2"
[dependencies.foreign-types]
version = "0.3"
[features]
default = ["mountainlion"]
mountainlion = []
[target.x86_64-apple-darwin.dependencies.core-foundation]
version = "0.4"
[target.x86_64-apple-darwin.dependencies.core-graphics]
version = "0.9"

40
third_party/rust/core-text/src/font.rs поставляемый
Просмотреть файл

@ -18,15 +18,21 @@ use core_foundation::data::{CFData, CFDataRef};
use core_foundation::dictionary::CFDictionaryRef;
use core_foundation::string::{CFString, CFStringRef, UniChar};
use core_foundation::url::{CFURL, CFURLRef};
use core_graphics::base::{CGAffineTransform, CGFloat};
use core_graphics::context::{CGContext, CGContextRef};
use core_graphics::font::{CGGlyph, CGFont, CGFontRef};
use core_graphics::geometry::{CGPoint, CGRect, CGSize};
use core_graphics::base::CGFloat;
use core_graphics::context::CGContext;
use core_graphics::font::{CGGlyph, CGFont};
use core_graphics::geometry::{CGAffineTransform, CGPoint, CGRect, CGSize};
use core_graphics::path::CGPath;
use foreign_types::ForeignType;
use libc::{self, size_t, c_void};
use std::mem;
use std::ptr;
type CGContextRef = *mut <CGContext as ForeignType>::CType;
type CGFontRef = *mut <CGFont as ForeignType>::CType;
type CGPathRef = *mut <CGPath as ForeignType>::CType;
pub type CTFontUIFontType = u32;
// kCTFontNoFontType: CTFontUIFontType = -1;
pub const kCTFontUserFontType: CTFontUIFontType = 0;
@ -132,7 +138,7 @@ impl TCFType<CTFontRef> for CTFont {
pub fn new_from_CGFont(cgfont: &CGFont, pt_size: f64) -> CTFont {
unsafe {
let font_ref = CTFontCreateWithGraphicsFont(cgfont.as_concrete_TypeRef(),
let font_ref = CTFontCreateWithGraphicsFont(cgfont.as_ptr() as *mut _,
pt_size as CGFloat,
ptr::null(),
ptr::null());
@ -177,7 +183,7 @@ impl CTFont {
pub fn copy_to_CGFont(&self) -> CGFont {
unsafe {
let cgfont_ref = CTFontCopyGraphicsFont(self.obj, ptr::null_mut());
TCFType::wrap_under_create_rule(cgfont_ref)
CGFont::from_ptr(cgfont_ref as *mut _)
}
}
@ -331,7 +337,7 @@ impl CTFont {
glyphs.as_ptr(),
positions.as_ptr(),
glyphs.len() as size_t,
context.as_concrete_TypeRef())
context.as_ptr())
}
}
@ -345,6 +351,18 @@ impl CTFont {
}
}
}
pub fn create_path_for_glyph(&self, glyph: CGGlyph, matrix: &CGAffineTransform)
-> Result<CGPath, ()> {
unsafe {
let path = CTFontCreatePathForGlyph(self.obj, glyph, matrix);
if path.is_null() {
Err(())
} else {
Ok(CGPath::from_ptr(path))
}
}
}
}
// Helper methods
@ -399,7 +417,7 @@ pub fn cascade_list_for_languages(font: &CTFont, language_pref_list: &CFArray) -
}
}
#[link(name = "ApplicationServices", kind = "framework")]
#[link(name = "CoreText", kind = "framework")]
extern {
/*
* CTFont.h
@ -497,7 +515,8 @@ extern {
fn CTFontGetXHeight(font: CTFontRef) -> CGFloat;
/* Getting Glyph Data */
//fn CTFontCreatePathForGlyph
fn CTFontCreatePathForGlyph(font: CTFontRef, glyph: CGGlyph, matrix: *const CGAffineTransform)
-> CGPathRef;
//fn CTFontGetGlyphWithName
fn CTFontGetBoundingRectsForGlyphs(font: CTFontRef,
orientation: CTFontOrientation,
@ -526,7 +545,8 @@ extern {
//fn CTFontGetLigatureCaretPositions
/* Converting Fonts */
fn CTFontCopyGraphicsFont(font: CTFontRef, attributes: *mut CTFontDescriptorRef) -> CGFontRef;
fn CTFontCopyGraphicsFont(font: CTFontRef, attributes: *mut CTFontDescriptorRef)
-> CGFontRef;
fn CTFontCreateWithGraphicsFont(graphicsFont: CGFontRef, size: CGFloat,
matrix: *const CGAffineTransform,
attributes: CTFontDescriptorRef) -> CTFontRef;

1
third_party/rust/core-text/src/lib.rs поставляемый
Просмотреть файл

@ -12,6 +12,7 @@
#![allow(non_snake_case)]
extern crate foreign_types;
extern crate libc;
extern crate core_foundation;

1
third_party/rust/foreign-types/.cargo-checksum.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
{"files":{"Cargo.toml":"8d5fad39da737a92e5edb94a34e67d1cee8179f1809d791171a688a6262a2f7d","LICENSE-APACHE":"c6596eb7be8581c18be736c846fb9173b69eccf6ef94c5135893ec56bd92ba08","LICENSE-MIT":"333ea3aaa3cadb819f4acd9f9153f9feee060a995ca8710f32bc5bd9a4b91734","README.md":"6f3f1429f2724a481df811842f318d0d3b83160ada953fd869d4b685f7fd72e4","circle.yml":"716b19600977a1b3e29d3e0ac17146afd6b18bf1ef6e9724ddbbc6429f365f7d","src/lib.rs":"31a510819cacc200bdb416982b817edd8b294886f3bae877e7d8b10ac42b6c98"},"package":"5ebc04f19019fff1f2d627b5581574ead502f80c48c88900575a46e0840fe5d0"}

22
third_party/rust/foreign-types/Cargo.toml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,22 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g. crates.io) dependencies
#
# If you believe there's an error in this file please file an
# issue against the rust-lang/cargo repository. If you're
# editing this file be aware that the upstream Cargo.toml
# will likely look very different (and much more reasonable)
[package]
name = "foreign-types"
version = "0.3.0"
authors = ["Steven Fackler <sfackler@gmail.com>"]
description = "A framework for Rust wrappers over C APIs"
readme = "README.md"
license = "MIT/Apache-2.0"
repository = "https://github.com/sfackler/foreign-types"
[dependencies]

202
third_party/rust/foreign-types/LICENSE-APACHE поставляемый Normal file
Просмотреть файл

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

19
third_party/rust/foreign-types/LICENSE-MIT поставляемый Normal file
Просмотреть файл

@ -0,0 +1,19 @@
Copyright (c) 2017 The foreign-types Developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

23
third_party/rust/foreign-types/README.md поставляемый Normal file
Просмотреть файл

@ -0,0 +1,23 @@
# foreign-types
[![CircleCI](https://circleci.com/gh/sfackler/foreign-types.svg?style=shield)](https://circleci.com/gh/sfackler/foreign-types)
[Documentation](https://docs.rs/foreign-types)
A framework for Rust wrappers over C APIs.
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
at your option.
### Contribution
Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
license, shall be dual licensed as above, without any additional terms or
conditions.

23
third_party/rust/foreign-types/circle.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,23 @@
version: 2
jobs:
build:
working_directory: ~/build
docker:
- image: jimmycuadra/rust:1.13.0
steps:
- checkout
- restore_cache:
key: registry
- run: cargo generate-lockfile
- save_cache:
key: registry-{{ epoch }}
paths:
- ~/.cargo/registry/index
- restore_cache:
key: dependencies-1.13-{{ checksum "Cargo.lock" }}
- run: cargo test
- save_cache:
key: dependencies-1.13-{{ checksum "Cargo.lock" }}
paths:
- target
- ~/.cargo/registry/cache

348
third_party/rust/foreign-types/src/lib.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,348 @@
//! A framework for Rust wrappers over C APIs.
//!
//! Ownership is as important in C as it is in Rust, but the semantics are often implicit. In
//! particular, pointer-to-value is commonly used to pass C values both when transferring ownership
//! or a borrow.
//!
//! This crate provides a framework to define a Rust wrapper over these kinds of raw C APIs in a way
//! that allows ownership semantics to be expressed in an ergonomic manner. The framework takes a
//! dual-type approach similar to APIs in the standard library such as `PathBuf`/`Path` or `String`/
//! `str`. One type represents an owned value and references to the other represent borrowed
//! values.
//!
//! # Examples
//!
//! ```
//! use foreign_types::{ForeignType, ForeignTypeRef, Opaque};
//! use std::ops::{Deref, DerefMut};
//!
//! mod foo_sys {
//! pub enum FOO {}
//!
//! extern {
//! pub fn FOO_free(foo: *mut FOO);
//! }
//! }
//!
//! // The borrowed type is a newtype wrapper around an `Opaque` value.
//! //
//! // `FooRef` values never exist; we instead create references to `FooRef`s
//! // from raw C pointers.
//! pub struct FooRef(Opaque);
//!
//! impl ForeignTypeRef for FooRef {
//! type CType = foo_sys::FOO;
//! }
//!
//! // The owned type is simply a newtype wrapper around the raw C type.
//! //
//! // It dereferences to `FooRef`, so methods that do not require ownership
//! // should be defined there.
//! pub struct Foo(*mut foo_sys::FOO);
//!
//! impl Drop for Foo {
//! fn drop(&mut self) {
//! unsafe { foo_sys::FOO_free(self.0) }
//! }
//! }
//!
//! impl ForeignType for Foo {
//! type CType = foo_sys::FOO;
//! type Ref = FooRef;
//!
//! unsafe fn from_ptr(ptr: *mut foo_sys::FOO) -> Foo {
//! Foo(ptr)
//! }
//!
//! fn as_ptr(&self) -> *mut foo_sys::FOO {
//! self.0
//! }
//! }
//!
//! impl Deref for Foo {
//! type Target = FooRef;
//!
//! fn deref(&self) -> &FooRef {
//! unsafe { FooRef::from_ptr(self.0) }
//! }
//! }
//!
//! impl DerefMut for Foo {
//! fn deref_mut(&mut self) -> &mut FooRef {
//! unsafe { FooRef::from_ptr_mut(self.0) }
//! }
//! }
//! ```
//!
//! The `foreign_type!` macro can generate this boilerplate for you:
//!
//! ```
//! #[macro_use]
//! extern crate foreign_types;
//!
//! mod foo_sys {
//! pub enum FOO {}
//!
//! extern {
//! pub fn FOO_free(foo: *mut FOO);
//! pub fn FOO_duplicate(foo: *mut FOO) -> *mut FOO; // Optional
//! }
//! }
//!
//! foreign_type! {
//! type CType = foo_sys::FOO;
//! fn drop = foo_sys::FOO_free;
//! fn clone = foo_sys::FOO_duplicate; // Optional
//! /// A Foo.
//! pub struct Foo;
//! /// A borrowed Foo.
//! pub struct FooRef;
//! }
//!
//! # fn main() {}
//! ```
//!
//! If `fn clone` is specified, then it must take `CType` as an argument and return a copy of it as `CType`.
//! It will be used to implement `ToOwned` and `Clone`.
//!
//! `#[derive(…)] is permitted before the lines with `pub struct`.
//! `#[doc(hidden)]` before the `type CType` line will hide the `foreign_type!` implementations from documentation.
//!
//! Say we then have a separate type in our C API that contains a `FOO`:
//!
//! ```
//! mod foo_sys {
//! pub enum FOO {}
//! pub enum BAR {}
//!
//! extern {
//! pub fn FOO_free(foo: *mut FOO);
//! pub fn BAR_free(bar: *mut BAR);
//! pub fn BAR_get_foo(bar: *mut BAR) -> *mut FOO;
//! }
//! }
//! ```
//!
//! The documentation for the C library states that `BAR_get_foo` returns a reference into the `BAR`
//! passed to it, which translates into a reference in Rust. It also says that we're allowed to
//! modify the `FOO`, so we'll define a pair of accessor methods, one immutable and one mutable:
//!
//! ```
//! #[macro_use]
//! extern crate foreign_types;
//!
//! use foreign_types::ForeignTypeRef;
//!
//! mod foo_sys {
//! pub enum FOO {}
//! pub enum BAR {}
//!
//! extern {
//! pub fn FOO_free(foo: *mut FOO);
//! pub fn BAR_free(bar: *mut BAR);
//! pub fn BAR_get_foo(bar: *mut BAR) -> *mut FOO;
//! }
//! }
//!
//! foreign_type! {
//! #[doc(hidden)]
//! type CType = foo_sys::FOO;
//! fn drop = foo_sys::FOO_free;
//! /// A Foo.
//! pub struct Foo;
//! /// A borrowed Foo.
//! pub struct FooRef;
//! }
//!
//! foreign_type! {
//! type CType = foo_sys::BAR;
//! fn drop = foo_sys::BAR_free;
//! /// A Foo.
//! pub struct Bar;
//! /// A borrowed Bar.
//! pub struct BarRef;
//! }
//!
//! impl BarRef {
//! fn foo(&self) -> &FooRef {
//! unsafe { FooRef::from_ptr(foo_sys::BAR_get_foo(self.as_ptr())) }
//! }
//!
//! fn foo_mut(&mut self) -> &mut FooRef {
//! unsafe { FooRef::from_ptr_mut(foo_sys::BAR_get_foo(self.as_ptr())) }
//! }
//! }
//!
//! # fn main() {}
//! ```
#![no_std]
#![warn(missing_docs)]
#![doc(html_root_url="https://docs.rs/foreign-types/0.3")]
use core::cell::UnsafeCell;
/// An opaque type used to define `ForeignTypeRef` types.
///
/// A type implementing `ForeignTypeRef` should simply be a newtype wrapper around this type.
pub struct Opaque(UnsafeCell<()>);
/// A type implemented by wrappers over foreign types.
pub trait ForeignType: Sized {
/// The raw C type.
type CType;
/// The type representing a reference to this type.
type Ref: ForeignTypeRef<CType = Self::CType>;
/// Constructs an instance of this type from its raw type.
unsafe fn from_ptr(ptr: *mut Self::CType) -> Self;
/// Returns a raw pointer to the wrapped value.
fn as_ptr(&self) -> *mut Self::CType;
}
/// A trait implemented by types which reference borrowed foreign types.
pub trait ForeignTypeRef: Sized {
/// The raw C type.
type CType;
/// Constructs a shared instance of this type from its raw type.
#[inline]
unsafe fn from_ptr<'a>(ptr: *mut Self::CType) -> &'a Self {
&*(ptr as *mut _)
}
/// Constructs a mutable reference of this type from its raw type.
#[inline]
unsafe fn from_ptr_mut<'a>(ptr: *mut Self::CType) -> &'a mut Self {
&mut *(ptr as *mut _)
}
/// Returns a raw pointer to the wrapped value.
#[inline]
fn as_ptr(&self) -> *mut Self::CType {
self as *const _ as *mut _
}
}
/// A macro to easily define wrappers for foreign types.
///
/// # Examples
///
/// ```
/// #[macro_use]
/// extern crate foreign_types;
///
/// # mod openssl_sys { pub type SSL = (); pub unsafe fn SSL_free(_: *mut SSL) {} pub unsafe fn SSL_dup(x: *mut SSL) -> *mut SSL {x} }
/// foreign_type! {
/// type CType = openssl_sys::SSL;
/// fn drop = openssl_sys::SSL_free;
/// fn clone = openssl_sys::SSL_dup;
/// /// Documentation for the owned type.
/// pub struct Ssl;
/// /// Documentation for the borrowed type.
/// pub struct SslRef;
/// }
///
/// # fn main() {}
/// ```
#[macro_export]
macro_rules! foreign_type {
(
$(#[$impl_attr:meta])*
type CType = $ctype:ty;
fn drop = $drop:expr;
$(fn clone = $clone:expr;)*
$(#[$owned_attr:meta])*
pub struct $owned:ident;
$(#[$borrowed_attr:meta])*
pub struct $borrowed:ident;
) => {
$(#[$owned_attr])*
pub struct $owned(*mut $ctype);
$(#[$impl_attr])*
impl $crate::ForeignType for $owned {
type CType = $ctype;
type Ref = $borrowed;
#[inline]
unsafe fn from_ptr(ptr: *mut $ctype) -> $owned {
$owned(ptr)
}
#[inline]
fn as_ptr(&self) -> *mut $ctype {
self.0
}
}
impl Drop for $owned {
#[inline]
fn drop(&mut self) {
unsafe { $drop(self.0) }
}
}
$(
impl Clone for $owned {
#[inline]
fn clone(&self) -> $owned {
unsafe {
let handle: *mut $ctype = $clone(self.0);
$crate::ForeignType::from_ptr(handle)
}
}
}
impl ::std::borrow::ToOwned for $borrowed {
type Owned = $owned;
#[inline]
fn to_owned(&self) -> $owned {
unsafe {
let handle: *mut $ctype = $clone($crate::ForeignTypeRef::as_ptr(self));
$crate::ForeignType::from_ptr(handle)
}
}
}
)*
impl ::std::ops::Deref for $owned {
type Target = $borrowed;
#[inline]
fn deref(&self) -> &$borrowed {
unsafe { $crate::ForeignTypeRef::from_ptr(self.0) }
}
}
impl ::std::ops::DerefMut for $owned {
#[inline]
fn deref_mut(&mut self) -> &mut $borrowed {
unsafe { $crate::ForeignTypeRef::from_ptr_mut(self.0) }
}
}
impl ::std::borrow::Borrow<$borrowed> for $owned {
#[inline]
fn borrow(&self) -> &$borrowed {
&**self
}
}
impl ::std::convert::AsRef<$borrowed> for $owned {
#[inline]
fn as_ref(&self) -> &$borrowed {
&**self
}
}
$(#[$borrowed_attr])*
pub struct $borrowed($crate::Opaque);
$(#[$impl_attr])*
impl $crate::ForeignTypeRef for $borrowed {
type CType = $ctype;
}
}
}

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"313b48b1cf4f84dafffe0ccfb10e8d98eada41a4b21bc239a25eb90acb57c82c","README.md":"e0ae9e1224f6ce5d6df8e30272a1a23044d2d33b0051bf32ccd74e559f8a9f6c","generators/debug_struct_gen.rs":"8bd1187f346aa927a30781bdf24ca6cb86324b42109bf52a018aae9ae947a46c","generators/global_gen.rs":"2aed997706c797a3b3e60adc91ecad67056ee824fad29e27349f6d37293b5a1e","generators/mod.rs":"58fab4bbfac335de7bd61a01063bea0547d311fec1aaee6946871902adc14072","generators/static_gen.rs":"9fb4ee9f056263611658234539977fb415f93435d290053b84b092e05de16924","generators/static_struct_gen.rs":"23b910c2b14936766036876b9915639058e0cf3bca468c317d4edc7f6498b471","generators/struct_gen.rs":"87d37c9f6f8b457f3de3578b15d552d36843ed62837a0b33cd674103185f43e0","generators/templates/types/egl.rs":"881506faddd220f5ccbd7fc21d74860233f2204ed3dee31d891ae273b1643a74","generators/templates/types/gl.rs":"f71f3a2200c0fa13f09687ef05e51c28c5b11c1bb841acd402c0097d8f9130bd","generators/templates/types/glx.rs":"a2d6a91fc1bf46fab6868b9a01f36fc47e9a9837bc9ed79eba4d08f31117d063","generators/templates/types/wgl.rs":"2270dcf994250a5905b7246ccdbf3770c494cac0642a720ccbb91ac1886490e2","lib.rs":"4d68840c600a1025025438454d68d70e6da3891f2a5bb33406d4255cb257cda1","registry/mod.rs":"7834029699b1bcfa9d395bf03b4b328f38a7d69e4a4c3d3e01e626919b00ed63","registry/parse.rs":"4498677f167fcd6fa5fd34241ae86a6a17b98fe8566fa48f38b3860a7f941f9b"},"package":"0940975a4ca12b088d32b5d5134826c47d2e73de4b0b459b05244c01503eccbb"}
{"files":{"Cargo.toml":"68c6f061a73673e3ac3c64c6e3b54bea2cb7fe09c6cda794b345497d048ed7d7","README.md":"e0ae9e1224f6ce5d6df8e30272a1a23044d2d33b0051bf32ccd74e559f8a9f6c","generators/debug_struct_gen.rs":"35984ebe92529467d61112d95c380c84d4bd00d5dc8280749c4eb2f185313df7","generators/global_gen.rs":"eb7836db702777cb13b47b4ab46b9287a3c41995d4bafa0e659ba23688d34475","generators/mod.rs":"8622cd66c69530ed156dd3852d126a44a1ab6d84ea3086240c0b5f5cd7e91316","generators/static_gen.rs":"9fb4ee9f056263611658234539977fb415f93435d290053b84b092e05de16924","generators/static_struct_gen.rs":"23b910c2b14936766036876b9915639058e0cf3bca468c317d4edc7f6498b471","generators/struct_gen.rs":"07d1b52409c31c09010bd7f03459559f772f8b9396b3c60563401a8627b5e247","generators/templates/types/egl.rs":"881506faddd220f5ccbd7fc21d74860233f2204ed3dee31d891ae273b1643a74","generators/templates/types/gl.rs":"f71f3a2200c0fa13f09687ef05e51c28c5b11c1bb841acd402c0097d8f9130bd","generators/templates/types/glx.rs":"a2d6a91fc1bf46fab6868b9a01f36fc47e9a9837bc9ed79eba4d08f31117d063","generators/templates/types/wgl.rs":"2270dcf994250a5905b7246ccdbf3770c494cac0642a720ccbb91ac1886490e2","lib.rs":"4d68840c600a1025025438454d68d70e6da3891f2a5bb33406d4255cb257cda1","registry/mod.rs":"4c42448775dc25449c9995a5ec76e95d6c0762d92443f3c12e865768e4e1dc2a","registry/parse.rs":"e508a1c20c47a92f000d444c34e7818443b15cc9e4a45350e73791fb9c6f68a8"},"package":"75d69f914b49d9ff32fdf394cbd798f8c716d74fd19f9cc29da3e99797b2a78d"}

17
third_party/rust/gl_generator/Cargo.toml поставляемый
Просмотреть файл

@ -12,25 +12,28 @@
[package]
name = "gl_generator"
version = "0.5.3"
version = "0.6.1"
authors = ["Brendan Zabarauskas <bjzaba@yahoo.com.au>", "Corey Richardson", "Arseny Kapoulkine"]
description = "Code generators for creating bindings to the Khronos OpenGL APIs."
homepage = "https://github.com/brendanzab/gl-rs/gl_generator/"
documentation = "https://docs.rs/gl_generator"
readme = "README.md"
keywords = ["gl", "egl", "opengl", "khronos"]
categories = ["api-bindings", "rendering::graphics-api"]
license = "Apache-2.0"
repository = "https://github.com/brendanzab/gl-rs/"
[lib]
name = "gl_generator"
path = "lib.rs"
[dependencies]
log = "0.3.5"
xml-rs = "0.3.0"
[dependencies.khronos_api]
version = "1.0.1"
version = "2.0.0"
[dependencies.log]
version = "0.3.5"
[dependencies.xml-rs]
version = "0.7.0"
[features]
unstable_generator_utils = []

Просмотреть файл

@ -149,6 +149,7 @@ fn write_struct<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
}
try!(writeln!(dest, "pub {name}: FnPtr,", name = cmd.proto.ident));
}
try!(writeln!(dest, "_priv: ()"));
writeln!(dest, "}}")
}
@ -202,6 +203,7 @@ fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
},
))
}
try!(writeln!(dest, "_priv: ()"));
try!(writeln!(dest,
"}}

Просмотреть файл

@ -57,7 +57,7 @@ fn write_metaloadfn<W>(dest: &mut W) -> io::Result<()>
writeln!(dest,
r#"
#[inline(never)]
fn metaloadfn(mut loadfn: &mut FnMut(&str) -> *const __gl_imports::raw::c_void,
fn metaloadfn(loadfn: &mut FnMut(&str) -> *const __gl_imports::raw::c_void,
symbol: &str,
fallbacks: &[&str]) -> *const __gl_imports::raw::c_void {{
let mut ptr = loadfn(symbol);
@ -264,7 +264,7 @@ fn write_load_fn<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
for c in &registry.cmds {
try!(writeln!(dest,
"{cmd_name}::load_with(|s| loadfn(s));",
"{cmd_name}::load_with(&mut loadfn);",
cmd_name = &c.proto.ident[..]));
}

Просмотреть файл

@ -37,6 +37,7 @@ pub fn gen_struct_name(api: Api) -> &'static str {
Api::GlCore => "GlCore",
Api::Gles1 => "Gles1",
Api::Gles2 => "Gles2",
Api::Glsc2 => "Glsc2",
}
}
@ -100,7 +101,7 @@ pub fn gen_parameters(cmd: &Cmd, with_idents: bool, with_types: bool) -> Vec<Str
/// Example results: `"glClear"`, `"wglCreateContext"`, etc.
pub fn gen_symbol_name(api: Api, cmd: &str) -> String {
match api {
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 => format!("gl{}", cmd),
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 | Api::Glsc2 => format!("gl{}", cmd),
Api::Glx => format!("glX{}", cmd),
Api::Wgl => format!("wgl{}", cmd),
Api::Egl => format!("egl{}", cmd),

Просмотреть файл

@ -149,6 +149,7 @@ fn write_struct<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
}
try!(writeln!(dest, "pub {name}: FnPtr,", name = cmd.proto.ident));
}
try!(writeln!(dest, "_priv: ()"));
writeln!(dest, "}}")
}
@ -203,6 +204,8 @@ fn write_impl<W>(registry: &Registry, dest: &mut W) -> io::Result<()>
))
}
try!(writeln!(dest, "_priv: ()"));
try!(writeln!(dest,
"}}
}}"));

Просмотреть файл

@ -34,6 +34,7 @@ pub enum Api {
GlCore,
Gles1,
Gles2,
Glsc2,
}
impl fmt::Display for Api {
@ -46,6 +47,7 @@ impl fmt::Display for Api {
Api::GlCore => write!(fmt, "glcore"),
Api::Gles1 => write!(fmt, "gles1"),
Api::Gles2 => write!(fmt, "gles2"),
Api::Glsc2 => write!(fmt, "glsc2"),
}
}
}
@ -137,7 +139,7 @@ impl Registry {
};
let src = match api {
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 => khronos_api::GL_XML,
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 | Api::Glsc2 => khronos_api::GL_XML,
Api::Glx => khronos_api::GLX_XML,
Api::Wgl => khronos_api::WGL_XML,
Api::Egl => khronos_api::EGL_XML,

Просмотреть файл

@ -92,6 +92,7 @@ fn api_from_str(src: &str) -> Result<Api, ()> {
"glcore" => Ok(Api::GlCore),
"gles1" => Ok(Api::Gles1),
"gles2" => Ok(Api::Gles2),
"glsc2" => Ok(Api::Glsc2),
_ => Err(()),
}
}
@ -130,7 +131,7 @@ fn trim_str<'a>(s: &'a str, trim: &str) -> &'a str {
fn trim_enum_prefix(ident: &str, api: Api) -> String {
let ident = match api {
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 => trim_str(ident, "GL_"),
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 | Api::Glsc2 => trim_str(ident, "GL_"),
Api::Glx => trim_str(ident, "GLX_"),
Api::Wgl => trim_str(ident, "WGL_"),
Api::Egl => trim_str(ident, "EGL_"),
@ -150,6 +151,18 @@ fn make_enum(ident: String, ty: Option<String>, value: String, alias: Option<Str
let ty = working[..i].to_string();
let value = working[i + 1..].to_string();
(Cow::Owned(ty), value, true)
} else {
panic!("Unexpected value format: {}", value)
}
} else if value.starts_with("EGL_CAST(") && value.ends_with(")") {
// Handling "SpecialNumbers" in the egl.xml file
// The values for these enums has the form `'EGL_CAST(' type ',' expr ')'`.
let working = &value[9..value.len() - 1];
if let Some((i, _)) = working.match_indices(",").next() {
let ty = working[..i].to_string();
let value = working[i + 1..].to_string();
(Cow::Owned(ty), value, true)
} else {
panic!("Unexpected value format: {}", value)
@ -178,7 +191,7 @@ fn make_enum(ident: String, ty: Option<String>, value: String, alias: Option<Str
fn trim_cmd_prefix(ident: &str, api: Api) -> &str {
match api {
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 => trim_str(ident, "gl"),
Api::Gl | Api::GlCore | Api::Gles1 | Api::Gles2 | Api::Glsc2 => trim_str(ident, "gl"),
Api::Glx => trim_str(ident, "glX"),
Api::Wgl => trim_str(ident, "wgl"),
Api::Egl => trim_str(ident, "egl"),
@ -698,7 +711,7 @@ impl FromXml for String {
/// Converts a C style type definition to the Rust equivalent
pub fn to_rust_ty<T: AsRef<str>>(ty: T) -> Cow<'static, str> {
let ty = match ty.as_ref() {
let ty = match ty.as_ref().trim() {
// gl.xml types
"GLDEBUGPROC" => "types::GLDEBUGPROC",
"GLDEBUGPROCAMD" => "types::GLDEBUGPROCAMD",
@ -733,7 +746,7 @@ pub fn to_rust_ty<T: AsRef<str>>(ty: T) -> Cow<'static, str> {
"GLuint64EXT" => "types::GLuint64EXT",
"GLushort" => "types::GLushort",
"GLvdpauSurfaceNV" => "types::GLvdpauSurfaceNV",
"void " => "()",
"void" => "()",
"GLboolean *" => "*mut types::GLboolean",
"GLchar *" => "*mut types::GLchar",
"GLcharARB *" => "*mut types::GLcharARB",
@ -824,11 +837,11 @@ pub fn to_rust_ty<T: AsRef<str>>(ty: T) -> Cow<'static, str> {
"Window" => "types::Window",
"__GLXextFuncPtr" => "types::__GLXextFuncPtr",
"const GLXContext" => "const types::GLXContext",
"float " => "__gl_imports::raw::c_float",
"int " => "__gl_imports::raw::c_int",
"float" => "__gl_imports::raw::c_float",
"int" => "__gl_imports::raw::c_int",
"int64_t" => "i64",
"unsigned int " => "__gl_imports::raw::c_uint",
"unsigned long " => "__gl_imports::raw::c_ulong",
"unsigned int" => "__gl_imports::raw::c_uint",
"unsigned long" => "__gl_imports::raw::c_ulong",
// "void " => "()",
"DMparams *" => "*mut types::DMparams",
"Display *" => "*mut types::Display",
@ -975,6 +988,15 @@ pub fn to_rust_ty<T: AsRef<str>>(ty: T) -> Cow<'static, str> {
"EGLOutputPortEXT *" => "*mut types::EGLOutputPortEXT",
"EGLuint64KHR *" => "*mut types::EGLuint64KHR",
"GLeglClientBufferEXT" => "types::GLeglClientBufferEXT",
"GLVULKANPROCNV" => "type::GLVULKANPROCNV",
"EGLDEBUGPROCKHR" => "type::EGLDEBUGPROCKHR",
"EGLObjectKHR" => "type::EGLObjectKHR",
"EGLLabelKHR" => "type::EGLLabelKHR",
"EGLnsecsANDROID" => "type::EGLnsecsANDROID",
"EGLnsecsANDROID *" => "*mut type::EGLnsecsANDROID",
"EGLBoolean *" => "*mut type::EGLBoolean",
// failure
_ => panic!("Type conversion not implemented for `{}`", ty.as_ref()),
};
@ -1042,6 +1064,17 @@ mod tests {
assert_eq!(e.alias, Some("BAR".to_string()));
}
#[test]
fn test_cast_egl() {
let e = parse::make_enum("FOO".to_string(),
None,
"EGL_CAST(EGLint,-1)".to_string(),
Some("BAR".to_string()));
assert_eq!(e.ident, "FOO");
assert_eq!((&*e.ty, &*e.value), ("EGLint", "-1"));
assert_eq!(e.alias, Some("BAR".to_string()));
}
#[test]
fn test_no_type() {
let e = parse::make_enum("FOO".to_string(),

2
third_party/rust/gleam/.cargo-checksum.json поставляемый
Просмотреть файл

@ -1 +1 @@
{"files":{".travis.yml":"29b74b95210896ce634c11a9037638668473b5a1b3b1716c505cb04dbb6341fa","COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"c11e04556e4f6f911e518f0d9f49d35d1d765b837eee089ecda5fcaf9721f8f0","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"2de24b7458d6b88f20324303a48acf64a4f2bbfb83d2ec4d6ff2b4f4a1fd2275","build.rs":"a9e320b7ebeb61be7f1ae594a0dcc022a6629f18c335e1b9ace11f573201c610","src/gl.rs":"16c5e4405dbdb286ea60d93bed1f75099bc0d70da2da9ceef4107e55bdcafb62","src/gl_fns.rs":"b945febd7d8dad3df27389d1595724e68ca7074328dcffd49b6fcf610e544387","src/gles_fns.rs":"0c1c93e1e6b71dc2e9602e80869e5e2fdf092381b8cc99c8dfac7b092be55695","src/lib.rs":"16610c19b45a3f26d56b379a3591aa2e4fc9477e7bd88f86b31c6ea32e834861"},"package":"bf887141f0c2a83eae026cbf3fba74f0a5cb0f01d20e5cdfcd8c4ad39295be1e"}
{"files":{".travis.yml":"29b74b95210896ce634c11a9037638668473b5a1b3b1716c505cb04dbb6341fa","COPYING":"ec82b96487e9e778ee610c7ab245162464782cfa1f555c2299333f8dbe5c036a","Cargo.toml":"0417239a0f167b2c99eead895cdf7a46c39a84bbd9c172e31e99157e41f5a5d2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"62065228e42caebca7e7d7db1204cbb867033de5982ca4009928915e4095f3a3","README.md":"2de24b7458d6b88f20324303a48acf64a4f2bbfb83d2ec4d6ff2b4f4a1fd2275","build.rs":"d2a1c4b40ecbc29ddf005ec32f5b68f9242c8d54b703027bf3a1b605a0882d6a","src/gl.rs":"dea0447dd130a46d648f9526b927e0ba6d52b7ef5d1ec92471ac013119cbdee3","src/gl_fns.rs":"b9460d03ea3178672184bcb11e2075dffa8ce18b842be954d996bce9e701d62e","src/gles_fns.rs":"4344505df0aae7bded0048a2e4761920ddbd61acd0370d830d69c23a1f946fb1","src/lib.rs":"16610c19b45a3f26d56b379a3591aa2e4fc9477e7bd88f86b31c6ea32e834861"},"package":"8bd6aa276bc0bf40348728e916a82f8f9cc10b1922cabf9f2fe9cd5e8b98d55b"}

27
third_party/rust/gleam/Cargo.toml поставляемый
Просмотреть файл

@ -1,13 +1,26 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g. crates.io) dependencies
#
# If you believe there's an error in this file please file an
# issue against the rust-lang/cargo repository. If you're
# editing this file be aware that the upstream Cargo.toml
# will likely look very different (and much more reasonable)
[package]
name = "gleam"
version = "0.4.8"
license = "Apache-2.0/MIT"
version = "0.4.14"
authors = ["The Servo Project Developers"]
build = "build.rs"
documentation = "http://doc.servo.org/gleam/"
repository = "https://github.com/servo/gleam"
description = "Generated OpenGL bindings and wrapper for Servo."
documentation = "http://doc.servo.org/gleam/"
license = "Apache-2.0/MIT"
repository = "https://github.com/servo/gleam"
[build-dependencies.gl_generator]
version = "0.6.1"
[build-dependencies]
gl_generator = "0.5.0"
pkg-config = "0.3.8"
[build-dependencies.pkg-config]
version = "0.3.8"

11
third_party/rust/gleam/build.rs поставляемый
Просмотреть файл

@ -13,12 +13,17 @@ fn main() {
let mut file_gles = File::create(&Path::new(&dest).join("gles_bindings.rs")).unwrap();
// OpenGL 3.3 bindings
let gl_extensions = ["GL_ARB_texture_rectangle", "GL_EXT_debug_marker"];
let gl_extensions = ["GL_ARB_texture_rectangle",
"GL_EXT_debug_marker",
"GL_APPLE_client_storage",
"GL_APPLE_texture_range",
"GL_APPLE_fence",
"GL_ARB_get_program_binary"];
let gl_reg = Registry::new(Api::Gl, (3, 3), Profile::Core, Fallbacks::All, gl_extensions);
gl_reg.write_bindings(gl_generator::StructGenerator, &mut file_gl)
.unwrap();
// GLES 2.0 bindings
// GLES 3.0 bindings
let gles_extensions = [
"GL_EXT_texture_format_BGRA8888",
"GL_OES_EGL_image",
@ -28,7 +33,7 @@ fn main() {
gles_reg.write_bindings(gl_generator::StructGenerator, &mut file_gles)
.unwrap();
// OpenGL 3.3 + GLES 2.0 bindings. Used to get all enums
// OpenGL 3.3 + GLES 3.0 bindings. Used to get all enums
let gl_reg = gl_reg + gles_reg;
gl_reg.write_bindings(gl_generator::StructGenerator, &mut file_gl_and_gles)
.unwrap();

19
third_party/rust/gleam/src/gl.rs поставляемый
Просмотреть файл

@ -30,11 +30,11 @@ pub enum GlType {
}
impl Default for GlType {
#[cfg(target_os="android")]
#[cfg(any(target_os="android", target_os="ios"))]
fn default() -> GlType {
GlType::Gles
}
#[cfg(not(target_os="android"))]
#[cfg(not(any(target_os="android", target_os="ios")))]
fn default() -> GlType {
GlType::Gl
}
@ -50,10 +50,12 @@ fn calculate_length(width: GLsizei, height: GLsizei, format: GLenum, pixel_type:
ffi::ALPHA => 1,
ffi::LUMINANCE => 1,
ffi::DEPTH_COMPONENT => 1,
_ => panic!("unsupported format for read_pixels"),
};
let depth = match pixel_type {
ffi::UNSIGNED_BYTE => 1,
ffi::FLOAT=> 4,
_ => panic!("unsupported pixel_type for read_pixels"),
};
@ -128,7 +130,9 @@ pub trait Gl {
fn attach_shader(&self, program: GLuint, shader: GLuint);
fn bind_attrib_location(&self, program: GLuint, index: GLuint, name: &str);
fn get_uniform_block_index(&self, program: GLuint, name: &str) -> GLuint;
fn get_uniform_indices(&self, program: GLuint, names: &[&str]) -> Vec<GLuint>;
fn bind_buffer_base(&self, target: GLenum, index: GLuint, buffer: GLuint);
fn bind_buffer_range(&self, target: GLenum, index: GLuint, buffer: GLuint, offset: GLintptr, size: GLsizeiptr);
fn uniform_block_binding(&self,
program: GLuint,
uniform_block_index: GLuint,
@ -249,6 +253,9 @@ pub trait Gl {
ty: GLenum,
offset: usize);
fn get_integer_v(&self, name: GLenum) -> GLint;
fn get_integer_64v(&self, name: GLenum) -> GLint64;
fn get_integer_iv(&self, name: GLenum, index: GLuint) -> GLint;
fn get_integer_64iv(&self, name: GLenum, index: GLuint) -> GLint64;
fn get_boolean_v(&self, name: GLenum) -> GLboolean;
fn get_float_v(&self, name: GLenum) -> GLfloat;
fn tex_parameter_i(&self, target: GLenum, pname: GLenum, param: GLint);
@ -369,17 +376,25 @@ pub trait Gl {
fn depth_range(&self, near: f64, far: f64);
fn get_active_attrib(&self, program: GLuint, index: GLuint) -> (i32, u32, String);
fn get_active_uniform(&self, program: GLuint, index: GLuint) -> (i32, u32, String);
fn get_active_uniforms_iv(&self, program: GLuint, indices: Vec<GLuint>, pname: GLenum) -> Vec<GLint>;
fn get_active_uniform_block_i(&self, program: GLuint, index: GLuint, pname: GLenum) -> GLint;
fn get_active_uniform_block_iv(&self, program: GLuint, index: GLuint, pname: GLenum) -> Vec<GLint>;
fn get_active_uniform_block_name(&self, program: GLuint, index: GLuint) -> String;
fn get_attrib_location(&self, program: GLuint, name: &str) -> c_int;
fn get_frag_data_location(&self, program: GLuint, name: &str) -> c_int;
fn get_uniform_location(&self, program: GLuint, name: &str) -> c_int;
fn get_program_info_log(&self, program: GLuint) -> String;
fn get_program_iv(&self, program: GLuint, pname: GLenum) -> GLint;
fn get_program_binary(&self, program: GLuint) -> (Vec<u8>, GLenum);
fn program_binary(&self, program: GLuint, format: GLenum, binary: &[u8]);
fn program_parameter_i(&self, program: GLuint, pname: GLenum, value: GLint);
fn get_vertex_attrib_iv(&self, index: GLuint, pname: GLenum) -> GLint;
fn get_vertex_attrib_fv(&self, index: GLuint, pname: GLenum) -> Vec<GLfloat>;
fn get_vertex_attrib_pointer_v(&self, index: GLuint, pname: GLenum) -> GLsizeiptr;
fn get_buffer_parameter_iv(&self, target: GLuint, pname: GLenum) -> GLint;
fn get_shader_info_log(&self, shader: GLuint) -> String;
fn get_string(&self, which: GLenum) -> String;
fn get_string_i(&self, which: GLenum, index: GLuint) -> String;
fn get_shader_iv(&self, shader: GLuint, pname: GLenum) -> GLint;
fn get_shader_precision_format(&self,
shader_type: GLuint,

151
third_party/rust/gleam/src/gl_fns.rs поставляемый
Просмотреть файл

@ -300,12 +300,32 @@ impl Gl for GlFns {
}
}
fn get_uniform_indices(&self, program: GLuint, names: &[&str]) -> Vec<GLuint> {
let c_strings: Vec<CString> = names.iter().map(|n| CString::new(*n).unwrap()).collect();
let pointers: Vec<*const GLchar> = c_strings.iter().map(|string| string.as_ptr()).collect();
let mut result = Vec::with_capacity(c_strings.len());
unsafe {
result.set_len(c_strings.len());
self.ffi_gl_.GetUniformIndices(program,
pointers.len() as GLsizei,
pointers.as_ptr(),
result.as_mut_ptr());
}
result
}
fn bind_buffer_base(&self, target: GLenum, index: GLuint, buffer: GLuint) {
unsafe {
self.ffi_gl_.BindBufferBase(target, index, buffer);
}
}
fn bind_buffer_range(&self, target: GLenum, index: GLuint, buffer: GLuint, offset: GLintptr, size: GLsizeiptr) {
unsafe {
self.ffi_gl_.BindBufferRange(target, index, buffer, offset, size);
}
}
fn uniform_block_binding(&self, program: GLuint, uniform_block_index: GLuint, uniform_block_binding: GLuint) {
unsafe {
self.ffi_gl_.UniformBlockBinding(program, uniform_block_index, uniform_block_binding);
@ -578,13 +598,37 @@ impl Gl for GlFns {
}
fn get_integer_v(&self, name: GLenum) -> GLint {
let mut result: GLint = 0 as GLint;
let mut result = 0;
unsafe {
self.ffi_gl_.GetIntegerv(name, &mut result);
}
result
}
fn get_integer_64v(&self, name: GLenum) -> GLint64 {
let mut result = 0;
unsafe {
self.ffi_gl_.GetInteger64v(name, &mut result);
}
result
}
fn get_integer_iv(&self, name: GLenum, index: GLuint) -> GLint {
let mut result = 0;
unsafe {
self.ffi_gl_.GetIntegeri_v(name, index, &mut result);
}
result
}
fn get_integer_64iv(&self, name: GLenum, index: GLuint) -> GLint64 {
let mut result = 0;
unsafe {
self.ffi_gl_.GetInteger64i_v(name, index, &mut result);
}
result
}
fn get_boolean_v(&self, name: GLenum) -> GLboolean {
let mut result: GLboolean = 0 as GLboolean;
unsafe {
@ -1107,6 +1151,53 @@ impl Gl for GlFns {
(size, type_, String::from_utf8(name).unwrap())
}
fn get_active_uniforms_iv(&self, program: GLuint, indices: Vec<GLuint>, pname: GLenum) -> Vec<GLint> {
let mut result = Vec::with_capacity(indices.len());
unsafe {
result.set_len(indices.len());
self.ffi_gl_.GetActiveUniformsiv(program,
indices.len() as GLsizei,
indices.as_ptr(),
pname,
result.as_mut_ptr());
}
result
}
fn get_active_uniform_block_i(&self, program: GLuint, index: GLuint, pname: GLenum) -> GLint {
let mut result = 0;
unsafe {
self.ffi_gl_.GetActiveUniformBlockiv(program, index, pname, &mut result);
}
result
}
fn get_active_uniform_block_iv(&self, program: GLuint, index: GLuint, pname: GLenum) -> Vec<GLint> {
let count = self.get_active_uniform_block_i(program, index, ffi::UNIFORM_BLOCK_ACTIVE_UNIFORMS);
let mut result = Vec::with_capacity(count as usize);
unsafe {
result.set_len(count as usize);
self.ffi_gl_.GetActiveUniformBlockiv(program, index, pname, result.as_mut_ptr());
}
result
}
fn get_active_uniform_block_name(&self, program: GLuint, index: GLuint) -> String {
let buf_size = self.get_active_uniform_block_i(program, index, ffi::UNIFORM_BLOCK_NAME_LENGTH);
let mut name = vec![0 as u8; buf_size as usize];
let mut length: GLsizei = 0;
unsafe {
self.ffi_gl_.GetActiveUniformBlockName(program,
index,
buf_size,
&mut length,
name.as_mut_ptr() as *mut GLchar);
}
name.truncate(if length > 0 { length as usize } else { 0 });
String::from_utf8(name).unwrap()
}
fn get_attrib_location(&self, program: GLuint, name: &str) -> c_int {
let name = CString::new(name).unwrap();
unsafe {
@ -1149,6 +1240,53 @@ impl Gl for GlFns {
}
}
fn get_program_binary(&self, program: GLuint) -> (Vec<u8>, GLenum) {
if !self.ffi_gl_.GetProgramBinary.is_loaded() {
return (Vec::new(), NONE);
}
let len = self.get_program_iv(program, ffi::PROGRAM_BINARY_LENGTH);
if len <= 0 {
return (Vec::new(), NONE);
}
let mut binary: Vec<u8> = Vec::with_capacity(len as usize);
let mut format = NONE;
let mut out_len = 0;
unsafe {
binary.set_len(len as usize);
self.ffi_gl_.GetProgramBinary(program,
len,
&mut out_len as *mut GLsizei,
&mut format,
binary.as_mut_ptr() as *mut c_void);
}
if len != out_len {
return (Vec::new(), NONE);
}
(binary, format)
}
fn program_binary(&self, program: GLuint, format: GLenum, binary: &[u8]) {
if !self.ffi_gl_.ProgramBinary.is_loaded() {
return;
}
unsafe {
self.ffi_gl_.ProgramBinary(program,
format,
binary.as_ptr() as *const c_void,
binary.len() as GLsizei);
}
}
fn program_parameter_i(&self, program: GLuint, pname: GLenum, value: GLint) {
if !self.ffi_gl_.ProgramParameteri.is_loaded() {
return;
}
unsafe {
self.ffi_gl_.ProgramParameteri(program, pname, value);
}
}
fn get_vertex_attrib_iv(&self, index: GLuint, pname: GLenum) -> GLint {
unsafe {
let mut result: GLint = 0 as GLint;
@ -1205,6 +1343,17 @@ impl Gl for GlFns {
}
}
fn get_string_i(&self, which: GLenum, index: GLuint) -> String {
unsafe {
let llstr = self.ffi_gl_.GetStringi(which, index);
if !llstr.is_null() {
str::from_utf8_unchecked(CStr::from_ptr(llstr as *const c_char).to_bytes()).to_string()
} else {
"".to_string()
}
}
}
fn get_shader_iv(&self, shader: GLuint, pname: GLenum) -> GLint {
unsafe {
let mut result: GLint = 0 as GLint;

142
third_party/rust/gleam/src/gles_fns.rs поставляемый
Просмотреть файл

@ -278,12 +278,32 @@ impl Gl for GlesFns {
}
}
fn get_uniform_indices(&self, program: GLuint, names: &[&str]) -> Vec<GLuint> {
let c_strings: Vec<CString> = names.iter().map(|n| CString::new(*n).unwrap()).collect();
let pointers: Vec<*const GLchar> = c_strings.iter().map(|string| string.as_ptr()).collect();
let mut result = Vec::with_capacity(c_strings.len());
unsafe {
result.set_len(c_strings.len());
self.ffi_gl_.GetUniformIndices(program,
pointers.len() as GLsizei,
pointers.as_ptr(),
result.as_mut_ptr());
}
result
}
fn bind_buffer_base(&self, target: GLenum, index: GLuint, buffer: GLuint) {
unsafe {
self.ffi_gl_.BindBufferBase(target, index, buffer);
}
}
fn bind_buffer_range(&self, target: GLenum, index: GLuint, buffer: GLuint, offset: GLintptr, size: GLsizeiptr) {
unsafe {
self.ffi_gl_.BindBufferRange(target, index, buffer, offset, size);
}
}
fn uniform_block_binding(&self, program: GLuint, uniform_block_index: GLuint, uniform_block_binding: GLuint) {
unsafe {
self.ffi_gl_.UniformBlockBinding(program, uniform_block_index, uniform_block_binding);
@ -556,13 +576,37 @@ impl Gl for GlesFns {
}
fn get_integer_v(&self, name: GLenum) -> GLint {
let mut result: GLint = 0 as GLint;
let mut result = 0;
unsafe {
self.ffi_gl_.GetIntegerv(name, &mut result);
}
result
}
fn get_integer_64v(&self, name: GLenum) -> GLint64 {
let mut result = 0;
unsafe {
self.ffi_gl_.GetInteger64v(name, &mut result);
}
result
}
fn get_integer_iv(&self, name: GLenum, index: GLuint) -> GLint {
let mut result = 0;
unsafe {
self.ffi_gl_.GetIntegeri_v(name, index, &mut result);
}
result
}
fn get_integer_64iv(&self, name: GLenum, index: GLuint) -> GLint64 {
let mut result = 0;
unsafe {
self.ffi_gl_.GetInteger64i_v(name, index, &mut result);
}
result
}
fn get_boolean_v(&self, name: GLenum) -> GLboolean {
let mut result: GLboolean = 0 as GLboolean;
unsafe {
@ -1081,6 +1125,53 @@ impl Gl for GlesFns {
(size, type_, String::from_utf8(name).unwrap())
}
fn get_active_uniforms_iv(&self, program: GLuint, indices: Vec<GLuint>, pname: GLenum) -> Vec<GLint> {
let mut result = Vec::with_capacity(indices.len());
unsafe {
result.set_len(indices.len());
self.ffi_gl_.GetActiveUniformsiv(program,
indices.len() as GLsizei,
indices.as_ptr(),
pname,
result.as_mut_ptr());
}
result
}
fn get_active_uniform_block_i(&self, program: GLuint, index: GLuint, pname: GLenum) -> GLint {
let mut result = 0;
unsafe {
self.ffi_gl_.GetActiveUniformBlockiv(program, index, pname, &mut result);
}
result
}
fn get_active_uniform_block_iv(&self, program: GLuint, index: GLuint, pname: GLenum) -> Vec<GLint> {
let count = self.get_active_uniform_block_i(program, index, ffi::UNIFORM_BLOCK_ACTIVE_UNIFORMS);
let mut result = Vec::with_capacity(count as usize);
unsafe {
result.set_len(count as usize);
self.ffi_gl_.GetActiveUniformBlockiv(program, index, pname, result.as_mut_ptr());
}
result
}
fn get_active_uniform_block_name(&self, program: GLuint, index: GLuint) -> String {
let buf_size = self.get_active_uniform_block_i(program, index, ffi::UNIFORM_BLOCK_NAME_LENGTH);
let mut name = vec![0 as u8; buf_size as usize];
let mut length: GLsizei = 0;
unsafe {
self.ffi_gl_.GetActiveUniformBlockName(program,
index,
buf_size,
&mut length,
name.as_mut_ptr() as *mut GLchar);
}
name.truncate(if length > 0 { length as usize } else { 0 });
String::from_utf8(name).unwrap()
}
fn get_attrib_location(&self, program: GLuint, name: &str) -> c_int {
let name = CString::new(name).unwrap();
unsafe {
@ -1121,6 +1212,44 @@ impl Gl for GlesFns {
}
}
fn get_program_binary(&self, program: GLuint) -> (Vec<u8>, GLenum) {
let len = self.get_program_iv(program, ffi::PROGRAM_BINARY_LENGTH);
if len <= 0 {
return (Vec::new(), NONE);
}
let mut binary: Vec<u8> = Vec::with_capacity(len as usize);
let mut format = NONE;
let mut out_len = 0;
unsafe {
binary.set_len(len as usize);
self.ffi_gl_.GetProgramBinary(program,
len,
&mut out_len as *mut GLsizei,
&mut format,
binary.as_mut_ptr() as *mut c_void);
}
if len != out_len {
return (Vec::new(), NONE);
}
(binary, format)
}
fn program_binary(&self, program: GLuint, format: GLenum, binary: &[u8]) {
unsafe {
self.ffi_gl_.ProgramBinary(program,
format,
binary.as_ptr() as *const c_void,
binary.len() as GLsizei);
}
}
fn program_parameter_i(&self, program: GLuint, pname: GLenum, value: GLint) {
unsafe {
self.ffi_gl_.ProgramParameteri(program, pname, value);
}
}
fn get_vertex_attrib_iv(&self, index: GLuint, pname: GLenum) -> GLint {
unsafe {
let mut result: GLint = 0 as GLint;
@ -1177,6 +1306,17 @@ impl Gl for GlesFns {
}
}
fn get_string_i(&self, which: GLenum, index: GLuint) -> String {
unsafe {
let llstr = self.ffi_gl_.GetStringi(which, index);
if !llstr.is_null() {
str::from_utf8_unchecked(CStr::from_ptr(llstr as *const c_char).to_bytes()).to_string()
} else {
"".to_string()
}
}
}
fn get_shader_iv(&self, shader: GLuint, pname: GLenum) -> GLint {
unsafe {
let mut result: GLint = 0 as GLint;

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"d5b14cfc2a6504e54c9ceca859378c92d1a4a4cb59d67d3af944d91c2f6bef12","README.md":"dff09e27dcecc37f1e477d62ea89aa49b4dc743514ea6990c7c83b8b0fc602e4","api/.htaccess":"e600e7ce93361e8de3e32f588f9cc8f472243af676d078a7393acaf142245918","api/GL/glcorearb.h":"d411f59f28484725f6a2927d8f283ef10bf8e14d3b685e76de30c3871ca176e6","api/GL/glext.h":"fd30a350477613fb9a0b3cdaa5b22b18fed56cdbd369c587058c71ea83c8935b","api/GL/glxext.h":"0024c262e896dd3bfcd8c458e809bd2910d8eeae1316998a0654cdb75e5f2019","api/GL/wglext.h":"2fdace6ceefaf6bee7a5d821bcd599774689da354c7670839df4f4a836fd8386","api/Makefile":"fa42b2bf27a450c5be83f3178ca08f9bd24f611786dd503033b84c98ae67d37f","api/README.txt":"8c0b31285b1ce7d661ebdbf2f884264c9a588f7721221a2ad5fba7cafdf5b76f","api/egl.xml":"2590ce135d8b5364f11ae4ca04a0abe1fa781cde99a2b4ade8a2f0fdac09d5e4","api/genheaders.py":"3ddf420a48450c0d74b5c95d956ac09f4aceff2e225b148f0d1415a14f182a11","api/gl.xml":"5cf25ca370fd8c13407192533d5aa6febc4c16b7038882ae75d106f555e8f0e1","api/glx.xml":"9653c70d281fbac1c28292ef6532f41a9aee3c6998260d186b860f7cc2cc7ecd","api/readme.pdf":"26b9a42b4bc0803ee4854d5aa908b76bf08cafb478fd2e772a3b6cf6820daa2f","api/readme.tex":"542e27bcbd975f5c24e19fc2b89d62e8a4af8657f5f0ecebfac1c2640e23a5b6","api/reg.py":"469c294591df494d727bf13333b7080f04ba7c4938baeff14a5ead95b0cbd7c8","api/registry.rnc":"e76be90498a47ab63f9f0eb10b6a63d795a9e4b5a0bde2c89f1709ed8ebf937e","api/wgl.xml":"38b53bc1bc2c16dce1cc627feebcda4fb666c2d23ab0baf09bdecf6cb85bb005","src/lib.rs":"6773dcdb7458a9bebcbefcd28add5f6aa4720bf69c10f348f94615e127f51a2d"},"package":"d5a08e2a31d665af8f1ca437eab6d00a93c9d62a549f73f9ed8fc2e55b5a91a7"}
{"files":{"Cargo.toml":"b66b03a3e075e128ad40dc3d3d62c38ea14c47257634b8a012d99965e5071ddd","README.md":"dff09e27dcecc37f1e477d62ea89aa49b4dc743514ea6990c7c83b8b0fc602e4","api/xml/gl.xml":"5c3d768a361dc998b3497e93c1e0d837615c942ab82ff17dfeed8c1917b74bbb","api/xml/glx.xml":"1862e651300ae36fa6621b23910f55f63f29cd3550c114312be27c204e9828c5","api/xml/wgl.xml":"27fdf88d0f9fae2b025820f28ee3cb67dfc0388e68532a135ca7043db0427a35","api_egl/api/egl.xml":"7b20c062af2fda6dd340f4d03983c49204d75067ed161f10f671c805ace692f7","src/lib.rs":"9ff0a4ccce8f3fca7b2c6340a42d8b0f2f52f30ccae28db5a86be10c4341ca01"},"package":"d867c645cfeb8a7fec503731679eac03ac11b7105aa5a71cb8f8ee5271636add"}

6
third_party/rust/khronos_api/Cargo.toml поставляемый
Просмотреть файл

@ -12,12 +12,14 @@
[package]
name = "khronos_api"
version = "1.0.1"
version = "2.0.0"
authors = ["Brendan Zabarauskas <bjzaba@yahoo.com.au>", "Corey Richardson", "Arseny Kapoulkine", "Pierre Krieger <pierre.krieger1708@gmail.com>"]
include = ["/README.md", "/src/**/*", "/Cargo.toml", "/api/xml/**/*.xml", "/api_egl/api/**/*.xml"]
description = "The Khronos XML API Registry, exposed as byte string constants."
homepage = "https://github.com/brendanzab/gl-rs/khronos_api/"
documentation = "https://docs.rs/khronos_api"
readme = "README.md"
keywords = ["opengl", "khronos"]
keywords = ["gl", "egl", "opengl", "khronos"]
categories = ["rendering::graphics-api"]
license = "Apache-2.0"
repository = "https://github.com/brendanzab/gl-rs/"

23
third_party/rust/khronos_api/api/.htaccess поставляемый
Просмотреть файл

@ -1,23 +0,0 @@
# Redirect old .spec file URLs to the cached locations
redirect 301 /registry/api/enum.spec http://www.opengl.org/registry/oldspecs/enum.spec
redirect 301 /registry/api/enumext.spec http://www.opengl.org/registry/oldspecs//enumext.spec
redirect 301 /registry/api/gl.spec http://www.opengl.org/registry/oldspecs//gl.spec
redirect 301 /registry/api/gl.tm http://www.opengl.org/registry/oldspecs//gl.tm
redirect 301 /registry/api/gl3.h http://www.opengl.org/registry/oldspecs//gl3.h
redirect 301 /registry/api/glcorearb.h http://www.opengl.org/registry/oldspecs//glcorearb.h
redirect 301 /registry/api/glcorearbrelease.txt http://www.opengl.org/registry/oldspecs//glcorearbrelease.txt
redirect 301 /registry/api/glext.h http://www.opengl.org/registry/oldspecs//glext.h
redirect 301 /registry/api/glextrelease.txt http://www.opengl.org/registry/oldspecs//glextrelease.txt
redirect 301 /registry/api/glx.spec http://www.opengl.org/registry/oldspecs//glx.spec
redirect 301 /registry/api/glx.tm http://www.opengl.org/registry/oldspecs//glx.tm
redirect 301 /registry/api/glxenum.spec http://www.opengl.org/registry/oldspecs//glxenum.spec
redirect 301 /registry/api/glxenumext.spec http://www.opengl.org/registry/oldspecs//glxenumext.spec
redirect 301 /registry/api/glxext.h http://www.opengl.org/registry/oldspecs//glxext.h
redirect 301 /registry/api/glxext.spec http://www.opengl.org/registry/oldspecs//glxext.spec
redirect 301 /registry/api/wgl.spec http://www.opengl.org/registry/oldspecs//wgl.spec
redirect 301 /registry/api/wgl.tm http://www.opengl.org/registry/oldspecs//wgl.tm
redirect 301 /registry/api/wglenum.spec http://www.opengl.org/registry/oldspecs//wglenum.spec
redirect 301 /registry/api/wglenumext.spec http://www.opengl.org/registry/oldspecs//wglenumext.spec
redirect 301 /registry/api/wglext.h http://www.opengl.org/registry/oldspecs//wglext.h
redirect 301 /registry/api/wglext.spec http://www.opengl.org/registry/oldspecs//wglext.spec

3617
third_party/rust/khronos_api/api/GL/glcorearb.h поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

12046
third_party/rust/khronos_api/api/GL/glext.h поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

926
third_party/rust/khronos_api/api/GL/glxext.h поставляемый
Просмотреть файл

@ -1,926 +0,0 @@
#ifndef __glxext_h_
#define __glxext_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2013-2015 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/*
** This header is generated from the Khronos OpenGL / OpenGL ES XML
** API Registry. The current version of the Registry, generator scripts
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision$ on $Date$
*/
#define GLX_GLXEXT_VERSION 20150623
/* Generated C header for:
* API: glx
* Versions considered: .*
* Versions emitted: 1\.[3-9]
* Default extensions included: glx
* Additional extensions included: _nomatch_^
* Extensions removed: _nomatch_^
*/
#ifndef GLX_VERSION_1_3
#define GLX_VERSION_1_3 1
typedef XID GLXContextID;
typedef struct __GLXFBConfigRec *GLXFBConfig;
typedef XID GLXWindow;
typedef XID GLXPbuffer;
#define GLX_WINDOW_BIT 0x00000001
#define GLX_PIXMAP_BIT 0x00000002
#define GLX_PBUFFER_BIT 0x00000004
#define GLX_RGBA_BIT 0x00000001
#define GLX_COLOR_INDEX_BIT 0x00000002
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
#define GLX_AUX_BUFFERS_BIT 0x00000010
#define GLX_DEPTH_BUFFER_BIT 0x00000020
#define GLX_STENCIL_BUFFER_BIT 0x00000040
#define GLX_ACCUM_BUFFER_BIT 0x00000080
#define GLX_CONFIG_CAVEAT 0x20
#define GLX_X_VISUAL_TYPE 0x22
#define GLX_TRANSPARENT_TYPE 0x23
#define GLX_TRANSPARENT_INDEX_VALUE 0x24
#define GLX_TRANSPARENT_RED_VALUE 0x25
#define GLX_TRANSPARENT_GREEN_VALUE 0x26
#define GLX_TRANSPARENT_BLUE_VALUE 0x27
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
#define GLX_DONT_CARE 0xFFFFFFFF
#define GLX_NONE 0x8000
#define GLX_SLOW_CONFIG 0x8001
#define GLX_TRUE_COLOR 0x8002
#define GLX_DIRECT_COLOR 0x8003
#define GLX_PSEUDO_COLOR 0x8004
#define GLX_STATIC_COLOR 0x8005
#define GLX_GRAY_SCALE 0x8006
#define GLX_STATIC_GRAY 0x8007
#define GLX_TRANSPARENT_RGB 0x8008
#define GLX_TRANSPARENT_INDEX 0x8009
#define GLX_VISUAL_ID 0x800B
#define GLX_SCREEN 0x800C
#define GLX_NON_CONFORMANT_CONFIG 0x800D
#define GLX_DRAWABLE_TYPE 0x8010
#define GLX_RENDER_TYPE 0x8011
#define GLX_X_RENDERABLE 0x8012
#define GLX_FBCONFIG_ID 0x8013
#define GLX_RGBA_TYPE 0x8014
#define GLX_COLOR_INDEX_TYPE 0x8015
#define GLX_MAX_PBUFFER_WIDTH 0x8016
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
#define GLX_MAX_PBUFFER_PIXELS 0x8018
#define GLX_PRESERVED_CONTENTS 0x801B
#define GLX_LARGEST_PBUFFER 0x801C
#define GLX_WIDTH 0x801D
#define GLX_HEIGHT 0x801E
#define GLX_EVENT_MASK 0x801F
#define GLX_DAMAGED 0x8020
#define GLX_SAVED 0x8021
#define GLX_WINDOW 0x8022
#define GLX_PBUFFER 0x8023
#define GLX_PBUFFER_HEIGHT 0x8040
#define GLX_PBUFFER_WIDTH 0x8041
typedef GLXFBConfig *( *PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
typedef GLXFBConfig *( *PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
typedef int ( *PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
typedef GLXWindow ( *PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
typedef void ( *PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
typedef GLXPixmap ( *PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
typedef void ( *PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
typedef GLXPbuffer ( *PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
typedef void ( *PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
typedef void ( *PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
typedef GLXContext ( *PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
typedef Bool ( *PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
typedef int ( *PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
typedef void ( *PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
typedef void ( *PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXFBConfig *glXGetFBConfigs (Display *dpy, int screen, int *nelements);
GLXFBConfig *glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements);
int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value);
XVisualInfo *glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config);
GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
void glXDestroyWindow (Display *dpy, GLXWindow win);
GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap);
GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list);
void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf);
void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
Bool glXMakeContextCurrent (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
GLXDrawable glXGetCurrentReadDrawable (void);
int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value);
void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask);
void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
#endif
#endif /* GLX_VERSION_1_3 */
#ifndef GLX_VERSION_1_4
#define GLX_VERSION_1_4 1
typedef void ( *__GLXextFuncPtr)(void);
#define GLX_SAMPLE_BUFFERS 100000
#define GLX_SAMPLES 100001
typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
#ifdef GLX_GLXEXT_PROTOTYPES
__GLXextFuncPtr glXGetProcAddress (const GLubyte *procName);
#endif
#endif /* GLX_VERSION_1_4 */
#ifndef GLX_ARB_context_flush_control
#define GLX_ARB_context_flush_control 1
#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
#endif /* GLX_ARB_context_flush_control */
#ifndef GLX_ARB_create_context
#define GLX_ARB_create_context 1
#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
#define GLX_CONTEXT_FLAGS_ARB 0x2094
typedef GLXContext ( *PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
#endif
#endif /* GLX_ARB_create_context */
#ifndef GLX_ARB_create_context_profile
#define GLX_ARB_create_context_profile 1
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
#endif /* GLX_ARB_create_context_profile */
#ifndef GLX_ARB_create_context_robustness
#define GLX_ARB_create_context_robustness 1
#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261
#endif /* GLX_ARB_create_context_robustness */
#ifndef GLX_ARB_fbconfig_float
#define GLX_ARB_fbconfig_float 1
#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9
#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004
#endif /* GLX_ARB_fbconfig_float */
#ifndef GLX_ARB_framebuffer_sRGB
#define GLX_ARB_framebuffer_sRGB 1
#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2
#endif /* GLX_ARB_framebuffer_sRGB */
#ifndef GLX_ARB_get_proc_address
#define GLX_ARB_get_proc_address 1
typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
#ifdef GLX_GLXEXT_PROTOTYPES
__GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
#endif
#endif /* GLX_ARB_get_proc_address */
#ifndef GLX_ARB_multisample
#define GLX_ARB_multisample 1
#define GLX_SAMPLE_BUFFERS_ARB 100000
#define GLX_SAMPLES_ARB 100001
#endif /* GLX_ARB_multisample */
#ifndef GLX_ARB_robustness_application_isolation
#define GLX_ARB_robustness_application_isolation 1
#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
#endif /* GLX_ARB_robustness_application_isolation */
#ifndef GLX_ARB_robustness_share_group_isolation
#define GLX_ARB_robustness_share_group_isolation 1
#endif /* GLX_ARB_robustness_share_group_isolation */
#ifndef GLX_ARB_vertex_buffer_object
#define GLX_ARB_vertex_buffer_object 1
#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095
#endif /* GLX_ARB_vertex_buffer_object */
#ifndef GLX_3DFX_multisample
#define GLX_3DFX_multisample 1
#define GLX_SAMPLE_BUFFERS_3DFX 0x8050
#define GLX_SAMPLES_3DFX 0x8051
#endif /* GLX_3DFX_multisample */
#ifndef GLX_AMD_gpu_association
#define GLX_AMD_gpu_association 1
#define GLX_GPU_VENDOR_AMD 0x1F00
#define GLX_GPU_RENDERER_STRING_AMD 0x1F01
#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
#define GLX_GPU_RAM_AMD 0x21A3
#define GLX_GPU_CLOCK_AMD 0x21A4
#define GLX_GPU_NUM_PIPES_AMD 0x21A5
#define GLX_GPU_NUM_SIMD_AMD 0x21A6
#define GLX_GPU_NUM_RB_AMD 0x21A7
#define GLX_GPU_NUM_SPI_AMD 0x21A8
typedef unsigned int ( *PFNGLXGETGPUIDSAMDPROC) (unsigned int maxCount, unsigned int *ids);
typedef int ( *PFNGLXGETGPUINFOAMDPROC) (unsigned int id, int property, GLenum dataType, unsigned int size, void *data);
typedef unsigned int ( *PFNGLXGETCONTEXTGPUIDAMDPROC) (GLXContext ctx);
typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC) (unsigned int id, GLXContext share_list);
typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (unsigned int id, GLXContext share_context, const int *attribList);
typedef Bool ( *PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC) (GLXContext ctx);
typedef Bool ( *PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx);
typedef GLXContext ( *PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
typedef void ( *PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC) (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#ifdef GLX_GLXEXT_PROTOTYPES
unsigned int glXGetGPUIDsAMD (unsigned int maxCount, unsigned int *ids);
int glXGetGPUInfoAMD (unsigned int id, int property, GLenum dataType, unsigned int size, void *data);
unsigned int glXGetContextGPUIDAMD (GLXContext ctx);
GLXContext glXCreateAssociatedContextAMD (unsigned int id, GLXContext share_list);
GLXContext glXCreateAssociatedContextAttribsAMD (unsigned int id, GLXContext share_context, const int *attribList);
Bool glXDeleteAssociatedContextAMD (GLXContext ctx);
Bool glXMakeAssociatedContextCurrentAMD (GLXContext ctx);
GLXContext glXGetCurrentAssociatedContextAMD (void);
void glXBlitContextFramebufferAMD (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif
#endif /* GLX_AMD_gpu_association */
#ifndef GLX_EXT_buffer_age
#define GLX_EXT_buffer_age 1
#define GLX_BACK_BUFFER_AGE_EXT 0x20F4
#endif /* GLX_EXT_buffer_age */
#ifndef GLX_EXT_create_context_es2_profile
#define GLX_EXT_create_context_es2_profile 1
#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
#endif /* GLX_EXT_create_context_es2_profile */
#ifndef GLX_EXT_create_context_es_profile
#define GLX_EXT_create_context_es_profile 1
#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
#endif /* GLX_EXT_create_context_es_profile */
#ifndef GLX_EXT_fbconfig_packed_float
#define GLX_EXT_fbconfig_packed_float 1
#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1
#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008
#endif /* GLX_EXT_fbconfig_packed_float */
#ifndef GLX_EXT_framebuffer_sRGB
#define GLX_EXT_framebuffer_sRGB 1
#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2
#endif /* GLX_EXT_framebuffer_sRGB */
#ifndef GLX_EXT_import_context
#define GLX_EXT_import_context 1
#define GLX_SHARE_CONTEXT_EXT 0x800A
#define GLX_VISUAL_ID_EXT 0x800B
#define GLX_SCREEN_EXT 0x800C
typedef Display *( *PFNGLXGETCURRENTDISPLAYEXTPROC) (void);
typedef int ( *PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value);
typedef GLXContextID ( *PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);
typedef GLXContext ( *PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID);
typedef void ( *PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context);
#ifdef GLX_GLXEXT_PROTOTYPES
Display *glXGetCurrentDisplayEXT (void);
int glXQueryContextInfoEXT (Display *dpy, GLXContext context, int attribute, int *value);
GLXContextID glXGetContextIDEXT (const GLXContext context);
GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID);
void glXFreeContextEXT (Display *dpy, GLXContext context);
#endif
#endif /* GLX_EXT_import_context */
#ifndef GLX_EXT_stereo_tree
#define GLX_EXT_stereo_tree 1
typedef struct {
int type;
unsigned long serial;
Bool send_event;
Display *display;
int extension;
int evtype;
GLXDrawable window;
Bool stereo_tree;
} GLXStereoNotifyEventEXT;
#define GLX_STEREO_TREE_EXT 0x20F5
#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001
#define GLX_STEREO_NOTIFY_EXT 0x00000000
#endif /* GLX_EXT_stereo_tree */
#ifndef GLX_EXT_swap_control
#define GLX_EXT_swap_control 1
#define GLX_SWAP_INTERVAL_EXT 0x20F1
#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
typedef void ( *PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXSwapIntervalEXT (Display *dpy, GLXDrawable drawable, int interval);
#endif
#endif /* GLX_EXT_swap_control */
#ifndef GLX_EXT_swap_control_tear
#define GLX_EXT_swap_control_tear 1
#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3
#endif /* GLX_EXT_swap_control_tear */
#ifndef GLX_EXT_texture_from_pixmap
#define GLX_EXT_texture_from_pixmap 1
#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
#define GLX_Y_INVERTED_EXT 0x20D4
#define GLX_TEXTURE_FORMAT_EXT 0x20D5
#define GLX_TEXTURE_TARGET_EXT 0x20D6
#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
#define GLX_TEXTURE_1D_EXT 0x20DB
#define GLX_TEXTURE_2D_EXT 0x20DC
#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
#define GLX_FRONT_LEFT_EXT 0x20DE
#define GLX_FRONT_RIGHT_EXT 0x20DF
#define GLX_BACK_LEFT_EXT 0x20E0
#define GLX_BACK_RIGHT_EXT 0x20E1
#define GLX_FRONT_EXT 0x20DE
#define GLX_BACK_EXT 0x20E0
#define GLX_AUX0_EXT 0x20E2
#define GLX_AUX1_EXT 0x20E3
#define GLX_AUX2_EXT 0x20E4
#define GLX_AUX3_EXT 0x20E5
#define GLX_AUX4_EXT 0x20E6
#define GLX_AUX5_EXT 0x20E7
#define GLX_AUX6_EXT 0x20E8
#define GLX_AUX7_EXT 0x20E9
#define GLX_AUX8_EXT 0x20EA
#define GLX_AUX9_EXT 0x20EB
typedef void ( *PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
typedef void ( *PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXBindTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
void glXReleaseTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer);
#endif
#endif /* GLX_EXT_texture_from_pixmap */
#ifndef GLX_EXT_visual_info
#define GLX_EXT_visual_info 1
#define GLX_X_VISUAL_TYPE_EXT 0x22
#define GLX_TRANSPARENT_TYPE_EXT 0x23
#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
#define GLX_NONE_EXT 0x8000
#define GLX_TRUE_COLOR_EXT 0x8002
#define GLX_DIRECT_COLOR_EXT 0x8003
#define GLX_PSEUDO_COLOR_EXT 0x8004
#define GLX_STATIC_COLOR_EXT 0x8005
#define GLX_GRAY_SCALE_EXT 0x8006
#define GLX_STATIC_GRAY_EXT 0x8007
#define GLX_TRANSPARENT_RGB_EXT 0x8008
#define GLX_TRANSPARENT_INDEX_EXT 0x8009
#endif /* GLX_EXT_visual_info */
#ifndef GLX_EXT_visual_rating
#define GLX_EXT_visual_rating 1
#define GLX_VISUAL_CAVEAT_EXT 0x20
#define GLX_SLOW_VISUAL_EXT 0x8001
#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
#endif /* GLX_EXT_visual_rating */
#ifndef GLX_INTEL_swap_event
#define GLX_INTEL_swap_event 1
#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000
#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180
#define GLX_COPY_COMPLETE_INTEL 0x8181
#define GLX_FLIP_COMPLETE_INTEL 0x8182
#endif /* GLX_INTEL_swap_event */
#ifndef GLX_MESA_agp_offset
#define GLX_MESA_agp_offset 1
typedef unsigned int ( *PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer);
#ifdef GLX_GLXEXT_PROTOTYPES
unsigned int glXGetAGPOffsetMESA (const void *pointer);
#endif
#endif /* GLX_MESA_agp_offset */
#ifndef GLX_MESA_copy_sub_buffer
#define GLX_MESA_copy_sub_buffer 1
typedef void ( *PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXCopySubBufferMESA (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
#endif
#endif /* GLX_MESA_copy_sub_buffer */
#ifndef GLX_MESA_pixmap_colormap
#define GLX_MESA_pixmap_colormap 1
typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
#endif
#endif /* GLX_MESA_pixmap_colormap */
#ifndef GLX_MESA_query_renderer
#define GLX_MESA_query_renderer 1
#define GLX_RENDERER_VENDOR_ID_MESA 0x8183
#define GLX_RENDERER_DEVICE_ID_MESA 0x8184
#define GLX_RENDERER_VERSION_MESA 0x8185
#define GLX_RENDERER_ACCELERATED_MESA 0x8186
#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187
#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188
#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189
#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A
#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B
#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C
#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D
#define GLX_RENDERER_ID_MESA 0x818E
typedef Bool ( *PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int *value);
typedef const char *( *PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC) (int attribute);
typedef Bool ( *PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display *dpy, int screen, int renderer, int attribute, unsigned int *value);
typedef const char *( *PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int screen, int renderer, int attribute);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXQueryCurrentRendererIntegerMESA (int attribute, unsigned int *value);
const char *glXQueryCurrentRendererStringMESA (int attribute);
Bool glXQueryRendererIntegerMESA (Display *dpy, int screen, int renderer, int attribute, unsigned int *value);
const char *glXQueryRendererStringMESA (Display *dpy, int screen, int renderer, int attribute);
#endif
#endif /* GLX_MESA_query_renderer */
#ifndef GLX_MESA_release_buffers
#define GLX_MESA_release_buffers 1
typedef Bool ( *PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXReleaseBuffersMESA (Display *dpy, GLXDrawable drawable);
#endif
#endif /* GLX_MESA_release_buffers */
#ifndef GLX_MESA_set_3dfx_mode
#define GLX_MESA_set_3dfx_mode 1
#define GLX_3DFX_WINDOW_MODE_MESA 0x1
#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
typedef Bool ( *PFNGLXSET3DFXMODEMESAPROC) (int mode);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXSet3DfxModeMESA (int mode);
#endif
#endif /* GLX_MESA_set_3dfx_mode */
#ifndef GLX_NV_copy_buffer
#define GLX_NV_copy_buffer 1
typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
void glXNamedCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
#endif
#endif /* GLX_NV_copy_buffer */
#ifndef GLX_NV_copy_image
#define GLX_NV_copy_image 1
typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#endif
#endif /* GLX_NV_copy_image */
#ifndef GLX_NV_delay_before_swap
#define GLX_NV_delay_before_swap 1
typedef Bool ( *PFNGLXDELAYBEFORESWAPNVPROC) (Display *dpy, GLXDrawable drawable, GLfloat seconds);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXDelayBeforeSwapNV (Display *dpy, GLXDrawable drawable, GLfloat seconds);
#endif
#endif /* GLX_NV_delay_before_swap */
#ifndef GLX_NV_float_buffer
#define GLX_NV_float_buffer 1
#define GLX_FLOAT_COMPONENTS_NV 0x20B0
#endif /* GLX_NV_float_buffer */
#ifndef GLX_NV_multisample_coverage
#define GLX_NV_multisample_coverage 1
#define GLX_COVERAGE_SAMPLES_NV 100001
#define GLX_COLOR_SAMPLES_NV 0x20B3
#endif /* GLX_NV_multisample_coverage */
#ifndef GLX_NV_present_video
#define GLX_NV_present_video 1
#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0
typedef unsigned int *( *PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);
typedef int ( *PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
#ifdef GLX_GLXEXT_PROTOTYPES
unsigned int *glXEnumerateVideoDevicesNV (Display *dpy, int screen, int *nelements);
int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
#endif
#endif /* GLX_NV_present_video */
#ifndef GLX_NV_swap_group
#define GLX_NV_swap_group 1
typedef Bool ( *PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);
typedef Bool ( *PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier);
typedef Bool ( *PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
typedef Bool ( *PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
typedef Bool ( *PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen, GLuint *count);
typedef Bool ( *PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXJoinSwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint group);
Bool glXBindSwapBarrierNV (Display *dpy, GLuint group, GLuint barrier);
Bool glXQuerySwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
Bool glXQueryMaxSwapGroupsNV (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
Bool glXQueryFrameCountNV (Display *dpy, int screen, GLuint *count);
Bool glXResetFrameCountNV (Display *dpy, int screen);
#endif
#endif /* GLX_NV_swap_group */
#ifndef GLX_NV_video_capture
#define GLX_NV_video_capture 1
typedef XID GLXVideoCaptureDeviceNV;
#define GLX_DEVICE_ID_NV 0x20CD
#define GLX_UNIQUE_ID_NV 0x20CE
#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
typedef int ( *PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
typedef GLXVideoCaptureDeviceNV *( *PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements);
typedef void ( *PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
typedef int ( *PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
typedef void ( *PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXBindVideoCaptureDeviceNV (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
GLXVideoCaptureDeviceNV *glXEnumerateVideoCaptureDevicesNV (Display *dpy, int screen, int *nelements);
void glXLockVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
int glXQueryVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
#endif
#endif /* GLX_NV_video_capture */
#ifndef GLX_NV_video_out
#define GLX_NV_video_out 1
typedef unsigned int GLXVideoDeviceNV;
#define GLX_VIDEO_OUT_COLOR_NV 0x20C3
#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4
#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5
#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
#define GLX_VIDEO_OUT_FRAME_NV 0x20C8
#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9
#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA
#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB
#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC
typedef int ( *PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
typedef int ( *PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
typedef int ( *PFNGLXBINDVIDEOIMAGENVPROC) (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
typedef int ( *PFNGLXRELEASEVIDEOIMAGENVPROC) (Display *dpy, GLXPbuffer pbuf);
typedef int ( *PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
typedef int ( *PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXGetVideoDeviceNV (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
int glXReleaseVideoDeviceNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
int glXBindVideoImageNV (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf);
int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#endif
#endif /* GLX_NV_video_out */
#ifndef GLX_OML_swap_method
#define GLX_OML_swap_method 1
#define GLX_SWAP_METHOD_OML 0x8060
#define GLX_SWAP_EXCHANGE_OML 0x8061
#define GLX_SWAP_COPY_OML 0x8062
#define GLX_SWAP_UNDEFINED_OML 0x8063
#endif /* GLX_OML_swap_method */
#ifndef GLX_OML_sync_control
#define GLX_OML_sync_control 1
#ifndef GLEXT_64_TYPES_DEFINED
/* This code block is duplicated in glext.h, so must be protected */
#define GLEXT_64_TYPES_DEFINED
/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
/* (as used in the GLX_OML_sync_control extension). */
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#include <inttypes.h>
#elif defined(__sun__) || defined(__digital__)
#include <inttypes.h>
#if defined(__STDC__)
#if defined(__arch64__) || defined(_LP64)
typedef long int int64_t;
typedef unsigned long int uint64_t;
#else
typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#endif /* __arch64__ */
#endif /* __STDC__ */
#elif defined( __VMS ) || defined(__sgi)
#include <inttypes.h>
#elif defined(__SCO__) || defined(__USLC__)
#include <stdint.h>
#elif defined(__UNIXOS2__) || defined(__SOL64__)
typedef long int int32_t;
typedef long long int int64_t;
typedef unsigned long long int uint64_t;
#elif defined(_WIN32) && defined(__GNUC__)
#include <stdint.h>
#elif defined(_WIN32)
typedef __int32 int32_t;
typedef __int64 int64_t;
typedef unsigned __int64 uint64_t;
#else
/* Fallback if nothing above works */
#include <inttypes.h>
#endif
#endif
typedef Bool ( *PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
typedef Bool ( *PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
typedef int64_t ( *PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
typedef Bool ( *PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
typedef Bool ( *PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXGetSyncValuesOML (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
Bool glXGetMscRateOML (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
int64_t glXSwapBuffersMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
Bool glXWaitForMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
Bool glXWaitForSbcOML (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
#endif
#endif /* GLX_OML_sync_control */
#ifndef GLX_SGIS_blended_overlay
#define GLX_SGIS_blended_overlay 1
#define GLX_BLENDED_RGBA_SGIS 0x8025
#endif /* GLX_SGIS_blended_overlay */
#ifndef GLX_SGIS_multisample
#define GLX_SGIS_multisample 1
#define GLX_SAMPLE_BUFFERS_SGIS 100000
#define GLX_SAMPLES_SGIS 100001
#endif /* GLX_SGIS_multisample */
#ifndef GLX_SGIS_shared_multisample
#define GLX_SGIS_shared_multisample 1
#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026
#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027
#endif /* GLX_SGIS_shared_multisample */
#ifndef GLX_SGIX_dmbuffer
#define GLX_SGIX_dmbuffer 1
typedef XID GLXPbufferSGIX;
#ifdef _DM_BUFFER_H_
#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024
typedef Bool ( *PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXAssociateDMPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
#endif
#endif /* _DM_BUFFER_H_ */
#endif /* GLX_SGIX_dmbuffer */
#ifndef GLX_SGIX_fbconfig
#define GLX_SGIX_fbconfig 1
typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
#define GLX_WINDOW_BIT_SGIX 0x00000001
#define GLX_PIXMAP_BIT_SGIX 0x00000002
#define GLX_RGBA_BIT_SGIX 0x00000001
#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002
#define GLX_DRAWABLE_TYPE_SGIX 0x8010
#define GLX_RENDER_TYPE_SGIX 0x8011
#define GLX_X_RENDERABLE_SGIX 0x8012
#define GLX_FBCONFIG_ID_SGIX 0x8013
#define GLX_RGBA_TYPE_SGIX 0x8014
#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015
typedef int ( *PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
typedef GLXFBConfigSGIX *( *PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements);
typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
typedef GLXContext ( *PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config);
typedef GLXFBConfigSGIX ( *PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXGetFBConfigAttribSGIX (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
GLXFBConfigSGIX *glXChooseFBConfigSGIX (Display *dpy, int screen, int *attrib_list, int *nelements);
GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
GLXContext glXCreateContextWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
XVisualInfo *glXGetVisualFromFBConfigSGIX (Display *dpy, GLXFBConfigSGIX config);
GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *dpy, XVisualInfo *vis);
#endif
#endif /* GLX_SGIX_fbconfig */
#ifndef GLX_SGIX_hyperpipe
#define GLX_SGIX_hyperpipe 1
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int networkId;
} GLXHyperpipeNetworkSGIX;
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int channel;
unsigned int participationType;
int timeSlice;
} GLXHyperpipeConfigSGIX;
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int srcXOrigin, srcYOrigin, srcWidth, srcHeight;
int destXOrigin, destYOrigin, destWidth, destHeight;
} GLXPipeRect;
typedef struct {
char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
int XOrigin, YOrigin, maxHeight, maxWidth;
} GLXPipeRectLimits;
#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80
#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91
#define GLX_BAD_HYPERPIPE_SGIX 92
#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001
#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002
#define GLX_PIPE_RECT_SGIX 0x00000001
#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002
#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003
#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004
#define GLX_HYPERPIPE_ID_SGIX 0x8030
typedef GLXHyperpipeNetworkSGIX *( *PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);
typedef int ( *PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
typedef GLXHyperpipeConfigSGIX *( *PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes);
typedef int ( *PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId);
typedef int ( *PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId);
typedef int ( *PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
typedef int ( *PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
typedef int ( *PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXHyperpipeNetworkSGIX *glXQueryHyperpipeNetworkSGIX (Display *dpy, int *npipes);
int glXHyperpipeConfigSGIX (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
GLXHyperpipeConfigSGIX *glXQueryHyperpipeConfigSGIX (Display *dpy, int hpId, int *npipes);
int glXDestroyHyperpipeConfigSGIX (Display *dpy, int hpId);
int glXBindHyperpipeSGIX (Display *dpy, int hpId);
int glXQueryHyperpipeBestAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
int glXHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
#endif
#endif /* GLX_SGIX_hyperpipe */
#ifndef GLX_SGIX_pbuffer
#define GLX_SGIX_pbuffer 1
#define GLX_PBUFFER_BIT_SGIX 0x00000004
#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000
#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001
#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002
#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004
#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008
#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010
#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020
#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040
#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080
#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100
#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016
#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017
#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018
#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019
#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A
#define GLX_PRESERVED_CONTENTS_SGIX 0x801B
#define GLX_LARGEST_PBUFFER_SGIX 0x801C
#define GLX_WIDTH_SGIX 0x801D
#define GLX_HEIGHT_SGIX 0x801E
#define GLX_EVENT_MASK_SGIX 0x801F
#define GLX_DAMAGED_SGIX 0x8020
#define GLX_SAVED_SGIX 0x8021
#define GLX_WINDOW_SGIX 0x8022
#define GLX_PBUFFER_SGIX 0x8023
typedef GLXPbufferSGIX ( *PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
typedef void ( *PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf);
typedef int ( *PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
typedef void ( *PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask);
typedef void ( *PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
void glXDestroyGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf);
int glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
void glXSelectEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long mask);
void glXGetSelectedEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long *mask);
#endif
#endif /* GLX_SGIX_pbuffer */
#ifndef GLX_SGIX_swap_barrier
#define GLX_SGIX_swap_barrier 1
typedef void ( *PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);
typedef Bool ( *PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXBindSwapBarrierSGIX (Display *dpy, GLXDrawable drawable, int barrier);
Bool glXQueryMaxSwapBarriersSGIX (Display *dpy, int screen, int *max);
#endif
#endif /* GLX_SGIX_swap_barrier */
#ifndef GLX_SGIX_swap_group
#define GLX_SGIX_swap_group 1
typedef void ( *PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXJoinSwapGroupSGIX (Display *dpy, GLXDrawable drawable, GLXDrawable member);
#endif
#endif /* GLX_SGIX_swap_group */
#ifndef GLX_SGIX_video_resize
#define GLX_SGIX_video_resize 1
#define GLX_SYNC_FRAME_SGIX 0x00000000
#define GLX_SYNC_SWAP_SGIX 0x00000001
typedef int ( *PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window);
typedef int ( *PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h);
typedef int ( *PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
typedef int ( *PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
typedef int ( *PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXBindChannelToWindowSGIX (Display *display, int screen, int channel, Window window);
int glXChannelRectSGIX (Display *display, int screen, int channel, int x, int y, int w, int h);
int glXQueryChannelRectSGIX (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
int glXQueryChannelDeltasSGIX (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
int glXChannelRectSyncSGIX (Display *display, int screen, int channel, GLenum synctype);
#endif
#endif /* GLX_SGIX_video_resize */
#ifndef GLX_SGIX_video_source
#define GLX_SGIX_video_source 1
typedef XID GLXVideoSourceSGIX;
#ifdef _VL_H
typedef GLXVideoSourceSGIX ( *PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
typedef void ( *PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource);
#ifdef GLX_GLXEXT_PROTOTYPES
GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
void glXDestroyGLXVideoSourceSGIX (Display *dpy, GLXVideoSourceSGIX glxvideosource);
#endif
#endif /* _VL_H */
#endif /* GLX_SGIX_video_source */
#ifndef GLX_SGIX_visual_select_group
#define GLX_SGIX_visual_select_group 1
#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028
#endif /* GLX_SGIX_visual_select_group */
#ifndef GLX_SGI_cushion
#define GLX_SGI_cushion 1
typedef void ( *PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion);
#ifdef GLX_GLXEXT_PROTOTYPES
void glXCushionSGI (Display *dpy, Window window, float cushion);
#endif
#endif /* GLX_SGI_cushion */
#ifndef GLX_SGI_make_current_read
#define GLX_SGI_make_current_read 1
typedef Bool ( *PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);
#ifdef GLX_GLXEXT_PROTOTYPES
Bool glXMakeCurrentReadSGI (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
GLXDrawable glXGetCurrentReadDrawableSGI (void);
#endif
#endif /* GLX_SGI_make_current_read */
#ifndef GLX_SGI_swap_control
#define GLX_SGI_swap_control 1
typedef int ( *PFNGLXSWAPINTERVALSGIPROC) (int interval);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXSwapIntervalSGI (int interval);
#endif
#endif /* GLX_SGI_swap_control */
#ifndef GLX_SGI_video_sync
#define GLX_SGI_video_sync 1
typedef int ( *PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count);
typedef int ( *PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count);
#ifdef GLX_GLXEXT_PROTOTYPES
int glXGetVideoSyncSGI (unsigned int *count);
int glXWaitVideoSyncSGI (int divisor, int remainder, unsigned int *count);
#endif
#endif /* GLX_SGI_video_sync */
#ifndef GLX_SUN_get_transparent_index
#define GLX_SUN_get_transparent_index 1
typedef Status ( *PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
#ifdef GLX_GLXEXT_PROTOTYPES
Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
#endif
#endif /* GLX_SUN_get_transparent_index */
#ifdef __cplusplus
}
#endif
#endif

840
third_party/rust/khronos_api/api/GL/wglext.h поставляемый
Просмотреть файл

@ -1,840 +0,0 @@
#ifndef __wglext_h_
#define __wglext_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
/*
** Copyright (c) 2013-2015 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/*
** This header is generated from the Khronos OpenGL / OpenGL ES XML
** API Registry. The current version of the Registry, generator scripts
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
**
** Khronos $Revision$ on $Date$
*/
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#endif
#define WGL_WGLEXT_VERSION 20150623
/* Generated C header for:
* API: wgl
* Versions considered: .*
* Versions emitted: _nomatch_^
* Default extensions included: wgl
* Additional extensions included: _nomatch_^
* Extensions removed: _nomatch_^
*/
#ifndef WGL_ARB_buffer_region
#define WGL_ARB_buffer_region 1
#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
#ifdef WGL_WGLEXT_PROTOTYPES
HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
#endif
#endif /* WGL_ARB_buffer_region */
#ifndef WGL_ARB_context_flush_control
#define WGL_ARB_context_flush_control 1
#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
#endif /* WGL_ARB_context_flush_control */
#ifndef WGL_ARB_create_context
#define WGL_ARB_create_context 1
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
#define WGL_CONTEXT_FLAGS_ARB 0x2094
#define ERROR_INVALID_VERSION_ARB 0x2095
typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
#ifdef WGL_WGLEXT_PROTOTYPES
HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
#endif
#endif /* WGL_ARB_create_context */
#ifndef WGL_ARB_create_context_profile
#define WGL_ARB_create_context_profile 1
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define ERROR_INVALID_PROFILE_ARB 0x2096
#endif /* WGL_ARB_create_context_profile */
#ifndef WGL_ARB_create_context_robustness
#define WGL_ARB_create_context_robustness 1
#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
#endif /* WGL_ARB_create_context_robustness */
#ifndef WGL_ARB_extensions_string
#define WGL_ARB_extensions_string 1
typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
#ifdef WGL_WGLEXT_PROTOTYPES
const char *WINAPI wglGetExtensionsStringARB (HDC hdc);
#endif
#endif /* WGL_ARB_extensions_string */
#ifndef WGL_ARB_framebuffer_sRGB
#define WGL_ARB_framebuffer_sRGB 1
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
#endif /* WGL_ARB_framebuffer_sRGB */
#ifndef WGL_ARB_make_current_read
#define WGL_ARB_make_current_read 1
#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
HDC WINAPI wglGetCurrentReadDCARB (void);
#endif
#endif /* WGL_ARB_make_current_read */
#ifndef WGL_ARB_multisample
#define WGL_ARB_multisample 1
#define WGL_SAMPLE_BUFFERS_ARB 0x2041
#define WGL_SAMPLES_ARB 0x2042
#endif /* WGL_ARB_multisample */
#ifndef WGL_ARB_pbuffer
#define WGL_ARB_pbuffer 1
DECLARE_HANDLE(HPBUFFERARB);
#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
#define WGL_PBUFFER_LARGEST_ARB 0x2033
#define WGL_PBUFFER_WIDTH_ARB 0x2034
#define WGL_PBUFFER_HEIGHT_ARB 0x2035
#define WGL_PBUFFER_LOST_ARB 0x2036
typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
#ifdef WGL_WGLEXT_PROTOTYPES
HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
#endif
#endif /* WGL_ARB_pbuffer */
#ifndef WGL_ARB_pixel_format
#define WGL_ARB_pixel_format 1
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
#define WGL_ACCELERATION_ARB 0x2003
#define WGL_NEED_PALETTE_ARB 0x2004
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
#define WGL_SWAP_METHOD_ARB 0x2007
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
#define WGL_TRANSPARENT_ARB 0x200A
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
#define WGL_SHARE_DEPTH_ARB 0x200C
#define WGL_SHARE_STENCIL_ARB 0x200D
#define WGL_SHARE_ACCUM_ARB 0x200E
#define WGL_SUPPORT_GDI_ARB 0x200F
#define WGL_SUPPORT_OPENGL_ARB 0x2010
#define WGL_DOUBLE_BUFFER_ARB 0x2011
#define WGL_STEREO_ARB 0x2012
#define WGL_PIXEL_TYPE_ARB 0x2013
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_RED_BITS_ARB 0x2015
#define WGL_RED_SHIFT_ARB 0x2016
#define WGL_GREEN_BITS_ARB 0x2017
#define WGL_GREEN_SHIFT_ARB 0x2018
#define WGL_BLUE_BITS_ARB 0x2019
#define WGL_BLUE_SHIFT_ARB 0x201A
#define WGL_ALPHA_BITS_ARB 0x201B
#define WGL_ALPHA_SHIFT_ARB 0x201C
#define WGL_ACCUM_BITS_ARB 0x201D
#define WGL_ACCUM_RED_BITS_ARB 0x201E
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
#define WGL_DEPTH_BITS_ARB 0x2022
#define WGL_STENCIL_BITS_ARB 0x2023
#define WGL_AUX_BUFFERS_ARB 0x2024
#define WGL_NO_ACCELERATION_ARB 0x2025
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
#define WGL_FULL_ACCELERATION_ARB 0x2027
#define WGL_SWAP_EXCHANGE_ARB 0x2028
#define WGL_SWAP_COPY_ARB 0x2029
#define WGL_SWAP_UNDEFINED_ARB 0x202A
#define WGL_TYPE_RGBA_ARB 0x202B
#define WGL_TYPE_COLORINDEX_ARB 0x202C
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#endif /* WGL_ARB_pixel_format */
#ifndef WGL_ARB_pixel_format_float
#define WGL_ARB_pixel_format_float 1
#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
#endif /* WGL_ARB_pixel_format_float */
#ifndef WGL_ARB_render_texture
#define WGL_ARB_render_texture 1
#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
#define WGL_TEXTURE_FORMAT_ARB 0x2072
#define WGL_TEXTURE_TARGET_ARB 0x2073
#define WGL_MIPMAP_TEXTURE_ARB 0x2074
#define WGL_TEXTURE_RGB_ARB 0x2075
#define WGL_TEXTURE_RGBA_ARB 0x2076
#define WGL_NO_TEXTURE_ARB 0x2077
#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
#define WGL_TEXTURE_1D_ARB 0x2079
#define WGL_TEXTURE_2D_ARB 0x207A
#define WGL_MIPMAP_LEVEL_ARB 0x207B
#define WGL_CUBE_MAP_FACE_ARB 0x207C
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
#define WGL_FRONT_LEFT_ARB 0x2083
#define WGL_FRONT_RIGHT_ARB 0x2084
#define WGL_BACK_LEFT_ARB 0x2085
#define WGL_BACK_RIGHT_ARB 0x2086
#define WGL_AUX0_ARB 0x2087
#define WGL_AUX1_ARB 0x2088
#define WGL_AUX2_ARB 0x2089
#define WGL_AUX3_ARB 0x208A
#define WGL_AUX4_ARB 0x208B
#define WGL_AUX5_ARB 0x208C
#define WGL_AUX6_ARB 0x208D
#define WGL_AUX7_ARB 0x208E
#define WGL_AUX8_ARB 0x208F
#define WGL_AUX9_ARB 0x2090
typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
#endif
#endif /* WGL_ARB_render_texture */
#ifndef WGL_ARB_robustness_application_isolation
#define WGL_ARB_robustness_application_isolation 1
#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
#endif /* WGL_ARB_robustness_application_isolation */
#ifndef WGL_ARB_robustness_share_group_isolation
#define WGL_ARB_robustness_share_group_isolation 1
#endif /* WGL_ARB_robustness_share_group_isolation */
#ifndef WGL_3DFX_multisample
#define WGL_3DFX_multisample 1
#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
#define WGL_SAMPLES_3DFX 0x2061
#endif /* WGL_3DFX_multisample */
#ifndef WGL_3DL_stereo_control
#define WGL_3DL_stereo_control 1
#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
#endif
#endif /* WGL_3DL_stereo_control */
#ifndef WGL_AMD_gpu_association
#define WGL_AMD_gpu_association 1
#define WGL_GPU_VENDOR_AMD 0x1F00
#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
#define WGL_GPU_RAM_AMD 0x21A3
#define WGL_GPU_CLOCK_AMD 0x21A4
#define WGL_GPU_NUM_PIPES_AMD 0x21A5
#define WGL_GPU_NUM_SIMD_AMD 0x21A6
#define WGL_GPU_NUM_RB_AMD 0x21A7
#define WGL_GPU_NUM_SPI_AMD 0x21A8
typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#ifdef WGL_WGLEXT_PROTOTYPES
UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
#endif
#endif /* WGL_AMD_gpu_association */
#ifndef WGL_ATI_pixel_format_float
#define WGL_ATI_pixel_format_float 1
#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
#endif /* WGL_ATI_pixel_format_float */
#ifndef WGL_EXT_create_context_es2_profile
#define WGL_EXT_create_context_es2_profile 1
#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
#endif /* WGL_EXT_create_context_es2_profile */
#ifndef WGL_EXT_create_context_es_profile
#define WGL_EXT_create_context_es_profile 1
#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
#endif /* WGL_EXT_create_context_es_profile */
#ifndef WGL_EXT_depth_float
#define WGL_EXT_depth_float 1
#define WGL_DEPTH_FLOAT_EXT 0x2040
#endif /* WGL_EXT_depth_float */
#ifndef WGL_EXT_display_color_table
#define WGL_EXT_display_color_table 1
typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
#ifdef WGL_WGLEXT_PROTOTYPES
GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
#endif
#endif /* WGL_EXT_display_color_table */
#ifndef WGL_EXT_extensions_string
#define WGL_EXT_extensions_string 1
typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
#ifdef WGL_WGLEXT_PROTOTYPES
const char *WINAPI wglGetExtensionsStringEXT (void);
#endif
#endif /* WGL_EXT_extensions_string */
#ifndef WGL_EXT_framebuffer_sRGB
#define WGL_EXT_framebuffer_sRGB 1
#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
#endif /* WGL_EXT_framebuffer_sRGB */
#ifndef WGL_EXT_make_current_read
#define WGL_EXT_make_current_read 1
#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
HDC WINAPI wglGetCurrentReadDCEXT (void);
#endif
#endif /* WGL_EXT_make_current_read */
#ifndef WGL_EXT_multisample
#define WGL_EXT_multisample 1
#define WGL_SAMPLE_BUFFERS_EXT 0x2041
#define WGL_SAMPLES_EXT 0x2042
#endif /* WGL_EXT_multisample */
#ifndef WGL_EXT_pbuffer
#define WGL_EXT_pbuffer 1
DECLARE_HANDLE(HPBUFFEREXT);
#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
#define WGL_PBUFFER_LARGEST_EXT 0x2033
#define WGL_PBUFFER_WIDTH_EXT 0x2034
#define WGL_PBUFFER_HEIGHT_EXT 0x2035
typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
#ifdef WGL_WGLEXT_PROTOTYPES
HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
#endif
#endif /* WGL_EXT_pbuffer */
#ifndef WGL_EXT_pixel_format
#define WGL_EXT_pixel_format 1
#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
#define WGL_DRAW_TO_WINDOW_EXT 0x2001
#define WGL_DRAW_TO_BITMAP_EXT 0x2002
#define WGL_ACCELERATION_EXT 0x2003
#define WGL_NEED_PALETTE_EXT 0x2004
#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
#define WGL_SWAP_METHOD_EXT 0x2007
#define WGL_NUMBER_OVERLAYS_EXT 0x2008
#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
#define WGL_TRANSPARENT_EXT 0x200A
#define WGL_TRANSPARENT_VALUE_EXT 0x200B
#define WGL_SHARE_DEPTH_EXT 0x200C
#define WGL_SHARE_STENCIL_EXT 0x200D
#define WGL_SHARE_ACCUM_EXT 0x200E
#define WGL_SUPPORT_GDI_EXT 0x200F
#define WGL_SUPPORT_OPENGL_EXT 0x2010
#define WGL_DOUBLE_BUFFER_EXT 0x2011
#define WGL_STEREO_EXT 0x2012
#define WGL_PIXEL_TYPE_EXT 0x2013
#define WGL_COLOR_BITS_EXT 0x2014
#define WGL_RED_BITS_EXT 0x2015
#define WGL_RED_SHIFT_EXT 0x2016
#define WGL_GREEN_BITS_EXT 0x2017
#define WGL_GREEN_SHIFT_EXT 0x2018
#define WGL_BLUE_BITS_EXT 0x2019
#define WGL_BLUE_SHIFT_EXT 0x201A
#define WGL_ALPHA_BITS_EXT 0x201B
#define WGL_ALPHA_SHIFT_EXT 0x201C
#define WGL_ACCUM_BITS_EXT 0x201D
#define WGL_ACCUM_RED_BITS_EXT 0x201E
#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
#define WGL_DEPTH_BITS_EXT 0x2022
#define WGL_STENCIL_BITS_EXT 0x2023
#define WGL_AUX_BUFFERS_EXT 0x2024
#define WGL_NO_ACCELERATION_EXT 0x2025
#define WGL_GENERIC_ACCELERATION_EXT 0x2026
#define WGL_FULL_ACCELERATION_EXT 0x2027
#define WGL_SWAP_EXCHANGE_EXT 0x2028
#define WGL_SWAP_COPY_EXT 0x2029
#define WGL_SWAP_UNDEFINED_EXT 0x202A
#define WGL_TYPE_RGBA_EXT 0x202B
#define WGL_TYPE_COLORINDEX_EXT 0x202C
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
#endif
#endif /* WGL_EXT_pixel_format */
#ifndef WGL_EXT_pixel_format_packed_float
#define WGL_EXT_pixel_format_packed_float 1
#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
#endif /* WGL_EXT_pixel_format_packed_float */
#ifndef WGL_EXT_swap_control
#define WGL_EXT_swap_control 1
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglSwapIntervalEXT (int interval);
int WINAPI wglGetSwapIntervalEXT (void);
#endif
#endif /* WGL_EXT_swap_control */
#ifndef WGL_EXT_swap_control_tear
#define WGL_EXT_swap_control_tear 1
#endif /* WGL_EXT_swap_control_tear */
#ifndef WGL_I3D_digital_video_control
#define WGL_I3D_digital_video_control 1
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
#endif
#endif /* WGL_I3D_digital_video_control */
#ifndef WGL_I3D_gamma
#define WGL_I3D_gamma 1
#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
#endif
#endif /* WGL_I3D_gamma */
#ifndef WGL_I3D_genlock
#define WGL_I3D_genlock 1
#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
#endif
#endif /* WGL_I3D_genlock */
#ifndef WGL_I3D_image_buffer
#define WGL_I3D_image_buffer 1
#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
#ifdef WGL_WGLEXT_PROTOTYPES
LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
#endif
#endif /* WGL_I3D_image_buffer */
#ifndef WGL_I3D_swap_frame_lock
#define WGL_I3D_swap_frame_lock 1
typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglEnableFrameLockI3D (void);
BOOL WINAPI wglDisableFrameLockI3D (void);
BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
#endif
#endif /* WGL_I3D_swap_frame_lock */
#ifndef WGL_I3D_swap_frame_usage
#define WGL_I3D_swap_frame_usage 1
typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
BOOL WINAPI wglBeginFrameTrackingI3D (void);
BOOL WINAPI wglEndFrameTrackingI3D (void);
BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
#endif
#endif /* WGL_I3D_swap_frame_usage */
#ifndef WGL_NV_DX_interop
#define WGL_NV_DX_interop 1
#define WGL_ACCESS_READ_ONLY_NV 0x00000000
#define WGL_ACCESS_READ_WRITE_NV 0x00000001
#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002
typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
#endif
#endif /* WGL_NV_DX_interop */
#ifndef WGL_NV_DX_interop2
#define WGL_NV_DX_interop2 1
#endif /* WGL_NV_DX_interop2 */
#ifndef WGL_NV_copy_image
#define WGL_NV_copy_image 1
typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
#endif
#endif /* WGL_NV_copy_image */
#ifndef WGL_NV_delay_before_swap
#define WGL_NV_delay_before_swap 1
typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds);
#endif
#endif /* WGL_NV_delay_before_swap */
#ifndef WGL_NV_float_buffer
#define WGL_NV_float_buffer 1
#define WGL_FLOAT_COMPONENTS_NV 0x20B0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
#endif /* WGL_NV_float_buffer */
#ifndef WGL_NV_gpu_affinity
#define WGL_NV_gpu_affinity 1
DECLARE_HANDLE(HGPUNV);
struct _GPU_DEVICE {
DWORD cb;
CHAR DeviceName[32];
CHAR DeviceString[128];
DWORD Flags;
RECT rcVirtualScreen;
};
typedef struct _GPU_DEVICE *PGPU_DEVICE;
#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
BOOL WINAPI wglDeleteDCNV (HDC hdc);
#endif
#endif /* WGL_NV_gpu_affinity */
#ifndef WGL_NV_multisample_coverage
#define WGL_NV_multisample_coverage 1
#define WGL_COVERAGE_SAMPLES_NV 0x2042
#define WGL_COLOR_SAMPLES_NV 0x20B9
#endif /* WGL_NV_multisample_coverage */
#ifndef WGL_NV_present_video
#define WGL_NV_present_video 1
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
#ifdef WGL_WGLEXT_PROTOTYPES
int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
#endif
#endif /* WGL_NV_present_video */
#ifndef WGL_NV_render_depth_texture
#define WGL_NV_render_depth_texture 1
#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
#define WGL_DEPTH_COMPONENT_NV 0x20A7
#endif /* WGL_NV_render_depth_texture */
#ifndef WGL_NV_render_texture_rectangle
#define WGL_NV_render_texture_rectangle 1
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
#endif /* WGL_NV_render_texture_rectangle */
#ifndef WGL_NV_swap_group
#define WGL_NV_swap_group 1
typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
BOOL WINAPI wglResetFrameCountNV (HDC hDC);
#endif
#endif /* WGL_NV_swap_group */
#ifndef WGL_NV_vertex_array_range
#define WGL_NV_vertex_array_range 1
typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
#ifdef WGL_WGLEXT_PROTOTYPES
void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
void WINAPI wglFreeMemoryNV (void *pointer);
#endif
#endif /* WGL_NV_vertex_array_range */
#ifndef WGL_NV_video_capture
#define WGL_NV_video_capture 1
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
#define WGL_UNIQUE_ID_NV 0x20CE
#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
#endif
#endif /* WGL_NV_video_capture */
#ifndef WGL_NV_video_output
#define WGL_NV_video_output 1
DECLARE_HANDLE(HPVIDEODEV);
#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
#define WGL_VIDEO_OUT_FRAME 0x20C8
#define WGL_VIDEO_OUT_FIELD_1 0x20C9
#define WGL_VIDEO_OUT_FIELD_2 0x20CA
#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
#endif
#endif /* WGL_NV_video_output */
#ifndef WGL_OML_sync_control
#define WGL_OML_sync_control 1
typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#ifdef WGL_WGLEXT_PROTOTYPES
BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
#endif
#endif /* WGL_OML_sync_control */
#ifdef __cplusplus
}
#endif
#endif

72
third_party/rust/khronos_api/api/Makefile поставляемый
Просмотреть файл

@ -1,72 +0,0 @@
# Copyright (c) 2013-2014 The Khronos Group Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and/or associated documentation files (the
# "Materials"), to deal in the Materials without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Materials, and to
# permit persons to whom the Materials are furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Materials.
#
# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
# Generator scripts and options
# GENOPTS can be e.g. '-noprotect'
PYFILES = genheaders.py reg.py
GENOPTS =
GENHEADERS = genheaders.py $(GENOPTS)
# Generate all headers for GL / GLES / WGL / GLX / EGL
# Different headers depend on different XML registry files
GLHEADERS = GL/glext.h GL/glcorearb.h \
GLES/gl.h GLES/glext.h \
GLES2/gl2.h GLES2/gl2ext.h \
GLES3/gl3.h
GLXHEADERS = GL/glx.h GL/glxext.h
WGLHEADERS = GL/wgl.h GL/wglext.h
EGLHEADERS = EGL/egl.h EGL/eglext.h
ALLHEADERS = $(GLHEADERS) $(GLXHEADERS) $(WGLHEADERS) $(EGLHEADERS)
default: $(ALLHEADERS)
$(GLHEADERS): gl.xml $(PYFILES)
$(GENHEADERS) $@
$(GLXHEADERS): glx.xml $(PYFILES)
$(GENHEADERS) $@ -registry glx.xml
$(WGLHEADERS): wgl.xml $(PYFILES)
$(GENHEADERS) $@ -registry wgl.xml
# Not finished yet
$(EGLHEADERS): egl.xml $(PYFILES)
$(GENHEADERS) $@ -registry egl.xml
# Generate Relax NG XML schema from Compact schema
registry.rng: registry.rnc
trang registry.rnc registry.rng
# Verify all registry XML files against the schema
validate:
jing -c registry.rnc gl.xml
jing -c registry.rnc glx.xml
jing -c registry.rnc wgl.xml
jing -c registry.rnc egl.xml
clean:
clobber: clean
-rm -f diag.txt dumpReg.txt errwarn.txt

2
third_party/rust/khronos_api/api/README.txt поставляемый
Просмотреть файл

@ -1,2 +0,0 @@
This text document has been replaced by a PDF. See readme.pdf . The PDF
is generated using LaTeX from readme.tex .

578
third_party/rust/khronos_api/api/genheaders.py поставляемый
Просмотреть файл

@ -1,578 +0,0 @@
#!/usr/bin/env python
#
# Copyright (c) 2013-2015 The Khronos Group Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and/or associated documentation files (the
# "Materials"), to deal in the Materials without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Materials, and to
# permit persons to whom the Materials are furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Materials.
#
# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
import sys, time, pdb, string, cProfile
from reg import *
# debug - start header generation in debugger
# dump - dump registry after loading
# profile - enable Python profiling
# protect - whether to use #ifndef protections
# registry <filename> - use specified XML registry instead of gl.xml
# target - string name of target header, or all targets if None
# timeit - time length of registry loading & header generation
# validate - validate return & parameter group tags against <group>
debug = False
dump = False
profile = False
protect = True
target = None
timeit = False
validate= False
# Default input / log files
errFilename = None
diagFilename = 'diag.txt'
regFilename = 'gl.xml'
if __name__ == '__main__':
i = 1
while (i < len(sys.argv)):
arg = sys.argv[i]
i = i + 1
if (arg == '-debug'):
write('Enabling debug (-debug)', file=sys.stderr)
debug = True
elif (arg == '-dump'):
write('Enabling dump (-dump)', file=sys.stderr)
dump = True
elif (arg == '-noprotect'):
write('Disabling inclusion protection in output headers', file=sys.stderr)
protect = False
elif (arg == '-profile'):
write('Enabling profiling (-profile)', file=sys.stderr)
profile = True
elif (arg == '-registry'):
regFilename = sys.argv[i]
i = i+1
write('Using registry ', regFilename, file=sys.stderr)
elif (arg == '-time'):
write('Enabling timing (-time)', file=sys.stderr)
timeit = True
elif (arg == '-validate'):
write('Enabling group validation (-validate)', file=sys.stderr)
validate = True
elif (arg[0:1] == '-'):
write('Unrecognized argument:', arg, file=sys.stderr)
exit(1)
else:
target = arg
write('Using target', target, file=sys.stderr)
# Simple timer functions
startTime = None
def startTimer():
global startTime
startTime = time.clock()
def endTimer(msg):
global startTime
endTime = time.clock()
if (timeit):
write(msg, endTime - startTime)
startTime = None
# Load & parse registry
reg = Registry()
startTimer()
tree = etree.parse(regFilename)
endTimer('Time to make ElementTree =')
startTimer()
reg.loadElementTree(tree)
endTimer('Time to parse ElementTree =')
if (validate):
reg.validateGroups()
if (dump):
write('***************************************')
write('Performing Registry dump to regdump.txt')
write('***************************************')
reg.dumpReg(filehandle = open('regdump.txt','w'))
# Turn a list of strings into a regexp string matching exactly those strings
def makeREstring(list):
return '^(' + '|'.join(list) + ')$'
# These are "mandatory" OpenGL ES 1 extensions, to
# be included in the core GLES/gl.h header.
es1CoreList = [
'GL_OES_read_format',
'GL_OES_compressed_paletted_texture',
'GL_OES_point_size_array',
'GL_OES_point_sprite'
]
# Descriptive names for various regexp patterns used to select
# versions and extensions
allVersions = allExtensions = '.*'
noVersions = noExtensions = None
gl12andLaterPat = '1\.[2-9]|[234]\.[0-9]'
gles2onlyPat = '2\.[0-9]'
gles2and30Pat = '2\.[0-9]|3.0'
gles2and30and31Pat = '2.[0-9]|3.[01]'
es1CorePat = makeREstring(es1CoreList)
# Extensions in old glcorearb.h but not yet tagged accordingly in gl.xml
glCoreARBPat = None
glx13andLaterPat = '1\.[3-9]'
# Copyright text prefixing all headers (list of strings).
prefixStrings = [
'/*',
'** Copyright (c) 2013-2015 The Khronos Group Inc.',
'**',
'** Permission is hereby granted, free of charge, to any person obtaining a',
'** copy of this software and/or associated documentation files (the',
'** "Materials"), to deal in the Materials without restriction, including',
'** without limitation the rights to use, copy, modify, merge, publish,',
'** distribute, sublicense, and/or sell copies of the Materials, and to',
'** permit persons to whom the Materials are furnished to do so, subject to',
'** the following conditions:',
'**',
'** The above copyright notice and this permission notice shall be included',
'** in all copies or substantial portions of the Materials.',
'**',
'** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,',
'** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF',
'** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.',
'** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY',
'** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,',
'** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE',
'** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.',
'*/',
'/*',
'** This header is generated from the Khronos OpenGL / OpenGL ES XML',
'** API Registry. The current version of the Registry, generator scripts',
'** used to make the header, and the header can be found at',
'** http://www.opengl.org/registry/',
'**',
'** Khronos $' + 'Revision$ on $' + 'Date$',
'*/',
''
]
# glext.h / glcorearb.h define calling conventions inline (no GL *platform.h)
glExtPlatformStrings = [
'#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)',
'#ifndef WIN32_LEAN_AND_MEAN',
'#define WIN32_LEAN_AND_MEAN 1',
'#endif',
'#include <windows.h>',
'#endif',
'',
'#ifndef APIENTRY',
'#define APIENTRY',
'#endif',
'#ifndef APIENTRYP',
'#define APIENTRYP APIENTRY *',
'#endif',
'#ifndef GLAPI',
'#define GLAPI extern',
'#endif',
''
]
glCorearbPlatformStrings = glExtPlatformStrings + [
'/* glcorearb.h is for use with OpenGL core profile implementations.',
'** It should should be placed in the same directory as gl.h and',
'** included as <GL/glcorearb.h>.',
'**',
'** glcorearb.h includes only APIs in the latest OpenGL core profile',
'** implementation together with APIs in newer ARB extensions which ',
'** can be supported by the core profile. It does not, and never will',
'** include functionality removed from the core profile, such as',
'** fixed-function vertex and fragment processing.',
'**',
'** Do not #include both <GL/glcorearb.h> and either of <GL/gl.h> or',
'** <GL/glext.h> in the same source file.',
'*/',
''
]
# wglext.h needs Windows include
wglPlatformStrings = [
'#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)',
'#define WIN32_LEAN_AND_MEAN 1',
'#include <windows.h>',
'#endif',
'',
]
# GLES 1/2/3 core .h have separate *platform.h files to define calling conventions
gles1PlatformStrings = [ '#include <GLES/glplatform.h>', '' ]
gles2PlatformStrings = [ '#include <GLES2/gl2platform.h>', '' ]
gles3PlatformStrings = [ '#include <GLES3/gl3platform.h>', '' ]
eglPlatformStrings = [ '#include <EGL/eglplatform.h>', '' ]
# GLES headers have a small addition to calling convention headers for function pointer typedefs
apiEntryPrefixStrings = [
'#ifndef GL_APIENTRYP',
'#define GL_APIENTRYP GL_APIENTRY*',
'#endif',
''
]
# Insert generation date in a comment for headers not having *GLEXT_VERSION macros
genDateCommentString = [
format("/* Generated on date %s */" % time.strftime("%Y%m%d")),
''
]
# GL_GLEXT_VERSION is defined only in glext.h
glextVersionStrings = [
format("#define GL_GLEXT_VERSION %s" % time.strftime("%Y%m%d")),
''
]
# WGL_WGLEXT_VERSION is defined only in wglext.h
wglextVersionStrings = [
format("#define WGL_WGLEXT_VERSION %s" % time.strftime("%Y%m%d")),
''
]
# GLX_GLXEXT_VERSION is defined only in glxext.h
glxextVersionStrings = [
format("#define GLX_GLXEXT_VERSION %s" % time.strftime("%Y%m%d")),
''
]
# EGL_EGLEXT_VERSION is defined only in eglext.h
eglextVersionStrings = [
format("#define EGL_EGLEXT_VERSION %s" % time.strftime("%Y%m%d")),
''
]
# Defaults for generating re-inclusion protection wrappers (or not)
protectFile = protect
protectFeature = protect
protectProto = protect
buildList = [
# GL API 1.2+ + extensions - GL/glext.h
CGeneratorOptions(
filename = 'GL/glext.h',
apiname = 'gl',
profile = 'compatibility',
versions = allVersions,
emitversions = gl12andLaterPat,
defaultExtensions = 'gl', # Default extensions for GL
addExtensions = None,
removeExtensions = None,
prefixText = prefixStrings + glExtPlatformStrings + glextVersionStrings,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto,
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
apicall = 'GLAPI ',
apientry = 'APIENTRY ',
apientryp = 'APIENTRYP '),
# GL core profile + extensions - GL/glcorearb.h
CGeneratorOptions(
filename = 'GL/glcorearb.h',
apiname = 'gl',
profile = 'core',
versions = allVersions,
emitversions = allVersions,
defaultExtensions = 'glcore', # Default extensions for GL core profile (only)
addExtensions = glCoreARBPat,
removeExtensions = None,
prefixText = prefixStrings + glCorearbPlatformStrings,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto,
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
apicall = 'GLAPI ',
apientry = 'APIENTRY ',
apientryp = 'APIENTRYP '),
# GLES 1.x API + mandatory extensions - GLES/gl.h (no function pointers)
CGeneratorOptions(
filename = 'GLES/gl.h',
apiname = 'gles1',
profile = 'common',
versions = allVersions,
emitversions = allVersions,
defaultExtensions = None, # No default extensions
addExtensions = es1CorePat, # Add mandatory ES1 extensions in GLES1/gl.h
removeExtensions = None,
prefixText = prefixStrings + gles1PlatformStrings + genDateCommentString,
genFuncPointers = False,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = False, # Core ES API functions are in the static link libraries
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
apicall = 'GL_API ',
apientry = 'GL_APIENTRY ',
apientryp = 'GL_APIENTRYP '),
# GLES 1.x extensions - GLES/glext.h
CGeneratorOptions(
filename = 'GLES/glext.h',
apiname = 'gles1',
profile = 'common',
versions = allVersions,
emitversions = noVersions,
defaultExtensions = 'gles1', # Default extensions for GLES 1
addExtensions = None,
removeExtensions = es1CorePat, # Remove mandatory ES1 extensions in GLES1/glext.h
prefixText = prefixStrings + apiEntryPrefixStrings + genDateCommentString,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto,
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
apicall = 'GL_API ',
apientry = 'GL_APIENTRY ',
apientryp = 'GL_APIENTRYP '),
# GLES 2.0 API - GLES2/gl2.h (now with function pointers)
CGeneratorOptions(
filename = 'GLES2/gl2.h',
apiname = 'gles2',
profile = 'common',
versions = gles2onlyPat,
emitversions = allVersions,
defaultExtensions = None, # No default extensions
addExtensions = None,
removeExtensions = None,
prefixText = prefixStrings + gles2PlatformStrings + apiEntryPrefixStrings + genDateCommentString,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto, # Core ES API functions are in the static link libraries
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
apicall = 'GL_APICALL ',
apientry = 'GL_APIENTRY ',
apientryp = 'GL_APIENTRYP '),
# GLES 3.1 / 3.0 / 2.0 extensions - GLES2/gl2ext.h
CGeneratorOptions(
filename = 'GLES2/gl2ext.h',
apiname = 'gles2',
profile = 'common',
versions = gles2onlyPat,
emitversions = None,
defaultExtensions = 'gles2', # Default extensions for GLES 2
addExtensions = None,
removeExtensions = None,
prefixText = prefixStrings + apiEntryPrefixStrings + genDateCommentString,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto,
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
apicall = 'GL_APICALL ',
apientry = 'GL_APIENTRY ',
apientryp = 'GL_APIENTRYP '),
# GLES 3.1 API - GLES3/gl31.h (now with function pointers)
CGeneratorOptions(
filename = 'GLES3/gl31.h',
apiname = 'gles2',
profile = 'common',
versions = gles2and30and31Pat,
emitversions = allVersions,
defaultExtensions = None, # No default extensions
addExtensions = None,
removeExtensions = None,
prefixText = prefixStrings + gles3PlatformStrings + apiEntryPrefixStrings + genDateCommentString,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto, # Core ES API functions are in the static link libraries
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
apicall = 'GL_APICALL ',
apientry = 'GL_APIENTRY ',
apientryp = 'GL_APIENTRYP '),
# GLES 3.0 API - GLES3/gl3.h (now with function pointers)
CGeneratorOptions(
filename = 'GLES3/gl3.h',
apiname = 'gles2',
profile = 'common',
versions = gles2and30Pat,
emitversions = allVersions,
defaultExtensions = None, # No default extensions
addExtensions = None,
removeExtensions = None,
prefixText = prefixStrings + gles3PlatformStrings + apiEntryPrefixStrings + genDateCommentString,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto, # Core ES API functions are in the static link libraries
protectProtoStr = 'GL_GLEXT_PROTOTYPES',
apicall = 'GL_APICALL ',
apientry = 'GL_APIENTRY ',
apientryp = 'GL_APIENTRYP '),
# EGL API - EGL/egl.h (no function pointers, yet @@@)
CGeneratorOptions(
filename = 'EGL/egl.h',
apiname = 'egl',
profile = None,
versions = allVersions,
emitversions = allVersions,
defaultExtensions = None, # No default extensions
addExtensions = None,
removeExtensions = None,
prefixText = prefixStrings + eglPlatformStrings + genDateCommentString,
genFuncPointers = False,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = False,
protectProtoStr = 'EGL_EGLEXT_PROTOTYPES',
apicall = 'EGLAPI ',
apientry = 'EGLAPIENTRY ',
apientryp = 'EGLAPIENTRYP '),
# EGL extensions - EGL/eglext.h (no function pointers, yet @@@)
CGeneratorOptions(
filename = 'EGL/eglext.h',
apiname = 'egl',
profile = None,
versions = allVersions,
emitversions = None,
defaultExtensions = 'egl', # Default extensions for EGL
addExtensions = None,
removeExtensions = None,
prefixText = prefixStrings + eglPlatformStrings + eglextVersionStrings,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto,
protectProtoStr = 'EGL_EGLEXT_PROTOTYPES',
apicall = 'EGLAPI ',
apientry = 'EGLAPIENTRY ',
apientryp = 'EGLAPIENTRYP '),
# GLX 1.* API - GL/glx.h
CGeneratorOptions(
filename = 'GL/glx.h',
apiname = 'glx',
profile = None,
versions = allVersions,
emitversions = allVersions,
defaultExtensions = None, # No default extensions
addExtensions = None,
removeExtensions = None,
# add glXPlatformStrings?
prefixText = prefixStrings + genDateCommentString,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto,
protectProtoStr = 'GLX_GLXEXT_PROTOTYPES',
apicall = '',
apientry = '',
apientryp = ' *'),
# GLX 1.3+ API + extensions - GL/glxext.h (no function pointers, yet @@@)
CGeneratorOptions(
filename = 'GL/glxext.h',
apiname = 'glx',
profile = None,
versions = allVersions,
emitversions = glx13andLaterPat,
defaultExtensions = 'glx', # Default extensions for GLX
addExtensions = None,
removeExtensions = None,
# add glXPlatformStrings?
prefixText = prefixStrings + glxextVersionStrings,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto,
protectProtoStr = 'GLX_GLXEXT_PROTOTYPES',
apicall = '',
apientry = '',
apientryp = ' *'),
# WGL API + extensions - GL/wgl.h (no function pointers, yet @@@)
CGeneratorOptions(
filename = 'GL/wgl.h',
apiname = 'wgl',
profile = None,
versions = allVersions,
emitversions = allVersions,
defaultExtensions = 'wgl', # Default extensions for WGL
addExtensions = None,
removeExtensions = None,
prefixText = prefixStrings + wglPlatformStrings + genDateCommentString,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto,
protectProtoStr = 'WGL_WGLEXT_PROTOTYPES',
apicall = '',
apientry = 'WINAPI ',
apientryp = 'WINAPI * '),
# WGL extensions - GL/wglext.h (no function pointers, yet @@@)
CGeneratorOptions(
filename = 'GL/wglext.h',
apiname = 'wgl',
profile = None,
versions = allVersions,
emitversions = None,
defaultExtensions = 'wgl', # Default extensions for WGL
addExtensions = None,
removeExtensions = None,
prefixText = prefixStrings + wglPlatformStrings + wglextVersionStrings,
genFuncPointers = True,
protectFile = protectFile,
protectFeature = protectFeature,
protectProto = protectProto,
protectProtoStr = 'WGL_WGLEXT_PROTOTYPES',
apicall = '',
apientry = 'WINAPI ',
apientryp = 'WINAPI * '),
# End of list
None
]
# create error/warning & diagnostic files
if (errFilename):
errWarn = open(errFilename,'w')
else:
errWarn = sys.stderr
diag = open(diagFilename, 'w')
def genHeaders():
# Loop over targets, building each
generated = 0
for genOpts in buildList:
if (genOpts == None):
break
if (target and target != genOpts.filename):
# write('*** Skipping', genOpts.filename)
continue
write('*** Building', genOpts.filename)
generated = generated + 1
startTimer()
gen = COutputGenerator(errFile=errWarn,
warnFile=errWarn,
diagFile=diag)
reg.setGenerator(gen)
reg.apiGen(genOpts)
write('** Generated', genOpts.filename)
endTimer('Time to generate ' + genOpts.filename + ' =')
if (target and generated == 0):
write('Failed to generate target:', target)
if (debug):
pdb.run('genHeaders()')
elif (profile):
import cProfile, pstats
cProfile.run('genHeaders()', 'profile.txt')
p = pstats.Stats('profile.txt')
p.strip_dirs().sort_stats('time').print_stats(50)
else:
genHeaders()

Двоичные данные
third_party/rust/khronos_api/api/readme.pdf поставляемый

Двоичный файл не отображается.

1002
third_party/rust/khronos_api/api/readme.tex поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

1162
third_party/rust/khronos_api/api/reg.py поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

288
third_party/rust/khronos_api/api/registry.rnc поставляемый
Просмотреть файл

@ -1,288 +0,0 @@
# Copyright (c) 2013 The Khronos Group Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and/or associated documentation files (the
# "Materials"), to deal in the Materials without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Materials, and to
# permit persons to whom the Materials are furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Materials.
#
# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
# Relax NG schema for Khronos Registry XML
# See http://www.opengl.org/registry/
#
# Last modified 2013/06/14
# This definition is subject to change (mostly in the form of additions)
namespace xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
# Toplevel is a <registry> tag.
# May be led by an optional <comment> tag containing e.g. copyrights.
start = element registry {
(
element comment { text } ? |
Types * |
Groups * |
Enums * |
Commands * |
Feature * |
Extensions *
) *
}
# <types> defines a group of types
Types = element types {
Type *
}
# <type> defines a single type. It is usually a C typedef but
# may contain arbitrary C code.
# name - name of this type, if not present in the <name> tag
# api - matches a <feature> api attribute, if present
# requires - name of another type definition required by this one
# type - "group", if present, indicating a group of values in the
# corresponding <enums> definition.
# comment - unused
# <apientry /> - substitutes for an APIENTRY-style macro on output
# <name> - contains typename
Type = element type {
attribute api { text } ? ,
attribute requires { text } ? ,
attribute name { TypeName } ? ,
attribute type { text } ? ,
Comment ? ,
text ,
element apientry { text } ? ,
text ,
element name { TypeName } ? ,
text
}
# <groups> defines a group of enum groups
Groups = element groups {
Group *
}
# <group> defines a single enum group. Enums may
# be in multiple groups.
# name - group name
# comment - unused
# <enum name=""> - members of the group
Group = element group {
Name ,
Comment ? ,
element enum { Name } *
}
# <enums> defines a group of enumerants
# namespace - identifies a numeric namespace
# group - identifies a functional subset of the namespace - same as <group name="">
# start, end - beginning and end of a numeric range in the namespace
# vendor - owner of the numeric range
# type - "bitmask", if present
# comment - unused
Enums = element enums {
attribute namespace { text } ? ,
attribute group { text } ? ,
attribute type { text } ? ,
attribute start { Integer } ? ,
attribute end { Integer } ? ,
Vendor ? ,
Comment ? ,
(Enum | Unused) *
}
# <enum> defines a single enumerant
# value - integer (including hex) value of the enumerant
# api - matches a <feature> api attribute, if present
# type - "u" (unsigned), "ull" (uint64), or integer if not present
# name - enumerant name
# alias - another enumerant this is semantically identical to
# comment - unused
Enum = element enum {
(
attribute value { Integer } &
attribute api { text } ? &
attribute type { TypeSuffix } ? &
attribute name { text } &
attribute alias { text } ? &
Comment ?
)
}
# <unused> defines a range of enumerants not currently being used
# start, end - beginning and end of an unused numeric range
# vendor - unused
# comment - unused
Unused = element unused {
attribute start { Integer } ,
attribute end { Integer } ? ,
Vendor ? ,
Comment ?
}
# <commands> defines a group of commands
# namespace - identifies a function namespace
Commands = element commands {
attribute namespace { text } ? ,
Command *
}
# <command> defines a single command
# <proto> is the C function prototype, including the return type
# <param> are function parameters, in order
# <ptype> is a <type> name, if present
# <name> is the function / parameter name
# The textual contents of <proto> and <param> should be legal C
# for those parts of a function declaration.
# <alias> - denotes function aliasing
# name - name of aliased function
# <vecequiv> - denotes scalar / vector function equivalence
# name - name of corresponding vector form, e.g. (glColor3f -> glColor3fv)
# <glx> - information about GLX protocol
# type - "render", "single", or "vendor" for GLXRender, GLXSingle, GLXVendorPrivate{WithReply}
# opcode - numeric opcode of specified type for this function
# name - if present, protocol name (defaults to command name)
# comment - unused
Command = element command {
Comment ? ,
element proto {
attribute group { text } ? ,
text ,
element ptype { TypeName } ? ,
text ,
element name { text } ,
text
} ,
element param {
attribute group { text } ? ,
attribute len { text } ? ,
text ,
element ptype { TypeName } ? ,
text ,
element name { text } ,
text
} * ,
(
element alias {
Name
} ? &
element vecequiv {
Name
} ? &
element glx {
attribute type { text } ,
attribute opcode { xsd:integer } ,
Name ? ,
Comment ?
} *
)
}
# Each <feature> defines the interface of an API version (e.g. OpenGL 1.2)
# api - API tag (e.g. 'gl', 'gles2', etc. - used internally, not
# neccessarily an actual API name
# name - version name (C preprocessor name, e.g. GL_VERSION_4_2)
# number - version number, e.g. 4.2
# protect - additional #ifdef symbol to place around the feature
# <require> / <remove> contains features to require or remove in
# this version
# profile - only require/remove when generated profile matches
# comment - unused
Feature = element feature {
attribute api { text } ,
Name ,
attribute number { xsd:float } ,
attribute protect { text } ?,
Comment ? ,
(
element require {
ProfileName ? ,
Comment ? ,
InterfaceElement *
} |
element remove {
ProfileName ? ,
Comment ? ,
InterfaceElement *
}
) *
}
Extensions = element extensions {
Extension *
}
# Defines the interface of an API <extension>. Like a <feature>
# tag, but with a slightly different api attribute.
# api - regexp pattern matching one or more API tags, indicating
# which APIs the extension is known to work with. The only
# syntax supported is <name>{|<name>}* and each name must
# exactly match an API being generated (implicit ^$ surrounding).
# In addition, <require> / <remove> tags also support an
# api attribute:
# api - only require/remove these features for the matching API.
# Not a regular expression.
Extension = element extension {
Name ,
attribute protect { text } ?,
attribute supported { StringGroup } ? ,
Comment ? ,
(
element require {
attribute api { text } ? ,
ProfileName ? ,
Comment ? ,
InterfaceElement *
} |
element remove {
attribute api { text } ? ,
ProfileName ? ,
Comment ? ,
InterfaceElement *
}
) *
}
# Contents of a <require> / <remove> tag, defining a group
# of features to require or remove.
# <type> / <enum> / <command> all have attributes
# name - feature name which must match
InterfaceElement =
element type {
Name ,
Comment ?
} |
element enum {
Name ,
Comment ?
} |
element command {
Name ,
Comment ?
}
# Integers are allowed to be either decimal or C-hex (0x[0-9A-F]+), but
# XML Schema types don't seem to support hex notation, so we use this
# as a placeholder.
Integer = text
# TypeName is an argument/return value C type name
TypeName = text
# TypeSuffix is a C numeric type suffix, e.g. 'u' or 'ull'
TypeSuffix = text
# StringGroup is a regular expression with an implicit
# '^(' and ')$' bracketing it.
StringGroup = text
# Repeatedly used attributes
ProfileName = attribute profile { text }
Vendor = attribute vendor { text }
Comment = attribute comment { text }
Name = attribute name { text }

6406
third_party/rust/khronos_api/api/gl.xml → third_party/rust/khronos_api/api/xml/gl.xml поставляемый Executable file → Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

84
third_party/rust/khronos_api/api/glx.xml → third_party/rust/khronos_api/api/xml/glx.xml поставляемый Executable file → Normal file
Просмотреть файл

@ -1,36 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<registry>
<!--
Copyright (c) 2013-2014 The Khronos Group Inc.
<comment>
Copyright (c) 2013-2017 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
http://www.apache.org/licenses/LICENSE-2.0
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-->
<!--
This file, glx.xml, is the GLX API Registry. The older ".spec" file
format has been retired and will no longer be updated with new
extensions and API versions. The canonical version of the registry,
together with documentation, schema, and Python generator scripts used
to generate C header files for GLX, can always be found in the Khronos
Registry at
http://www.opengl.org/registry/
-->
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
------------------------------------------------------------------------
This file, glx.xml, is the GLX API Registry. The canonical version of the
registry, together with documentation, schema, and Python generator scripts
used to generate C header files for GLX, can always be found in the Khronos
Registry at
https://github.com/KhronosGroup/OpenGL-Registry
</comment>
<!-- SECTION: GLX type definitions. Does not include X or GL types. -->
<types>
@ -453,7 +445,9 @@ typedef unsigned __int64 uint64_t;
<enum value="0x20F3" name="GLX_LATE_SWAPS_TEAR_EXT"/>
<enum value="0x20F4" name="GLX_BACK_BUFFER_AGE_EXT"/>
<enum value="0x20F5" name="GLX_STEREO_TREE_EXT"/>
<unused start="0x20F6" end="0x219F"/>
<enum value="0x20F6" name="GLX_VENDOR_NAMES_EXT"/>
<enum value="0x20F7" name="GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV"/>
<unused start="0x20F8" end="0x219F"/>
</enums>
<enums namespace="GLX" start="0x21A0" end="0x21AF" vendor="AMD" comment="Shared with WGL; synchronize create_context enums">
@ -468,6 +462,10 @@ typedef unsigned __int64 uint64_t;
<unused start="0x21A9" end="0x21AF"/>
</enums>
<enums namespace="GLX" start="0x31B3" end="0x31B3" vendor="ARB" comment="Shared with WGL.">
<enum value="0x31B3" name="GLX_CONTEXT_OPENGL_NO_ERROR_ARB"/>
</enums>
<enums namespace="GLX" start="0x8000" end="0x804F" vendor="ARB">
<enum value="0x8000" name="GLX_NONE" comment="Attribute value"/>
<enum value="0x8001" name="GLX_SLOW_CONFIG" comment="CONFIG_CAVEAT attribute value"/>
@ -1073,6 +1071,9 @@ typedef unsigned __int64 uint64_t;
<param><ptype>GLXDrawable</ptype> <name>drawable</name></param>
<param>unsigned long *<name>mask</name></param>
</command>
<command>
<proto>int <name>glXGetSwapIntervalMESA</name></proto>
</command>
<command>
<proto><ptype>Bool</ptype> <name>glXGetSyncValuesOML</name></proto>
<param><ptype>Display</ptype> *<name>dpy</name></param>
@ -1409,6 +1410,10 @@ typedef unsigned __int64 uint64_t;
<param><ptype>int64_t</ptype> <name>divisor</name></param>
<param><ptype>int64_t</ptype> <name>remainder</name></param>
</command>
<command>
<proto>void <name>glXSwapIntervalMESA</name></proto>
<param>unsigned int <name>interval</name></param>
</command>
<command>
<proto>void <name>glXSwapIntervalEXT</name></proto>
<param><ptype>Display</ptype> *<name>dpy</name></param>
@ -1668,6 +1673,11 @@ typedef unsigned __int64 uint64_t;
<command name="glXCreateContextAttribsARB"/>
</require>
</extension>
<extension name="GLX_ARB_create_context_no_error" supported="glx">
<require>
<enum name="GLX_CONTEXT_OPENGL_NO_ERROR_ARB"/>
</require>
</extension>
<extension name="GLX_ARB_create_context_profile" supported="glx">
<require>
<enum name="GLX_CONTEXT_CORE_PROFILE_BIT_ARB"/>
@ -1758,6 +1768,11 @@ typedef unsigned __int64 uint64_t;
<command name="glXFreeContextEXT"/>
</require>
</extension>
<extension name="GLX_EXT_libglvnd" supported="glx">
<require>
<enum name="GLX_VENDOR_NAMES_EXT"/>
</require>
</extension>
<extension name="GLX_EXT_stereo_tree" supported="glx">
<require>
<type name="GLXStereoNotifyEventEXT"/>
@ -1934,6 +1949,11 @@ typedef unsigned __int64 uint64_t;
<command name="glXBindVideoDeviceNV"/>
</require>
</extension>
<extension name="GLX_NV_robustness_video_memory_purge" supported="glx">
<require>
<enum name="GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV"/>
</require>
</extension>
<extension name="GLX_NV_swap_group" supported="glx">
<require>
<command name="glXJoinSwapGroupNV"/>
@ -2157,5 +2177,11 @@ typedef unsigned __int64 uint64_t;
<command name="glXGetTransparentIndexSUN"/>
</require>
</extension>
<extension name="GLX_MESA_swap_control" supported="glx">
<require>
<command name="glXGetSwapIntervalMESA"/>
<command name="glXSwapIntervalMESA"/>
</require>
</extension>
</extensions>
</registry>

72
third_party/rust/khronos_api/api/wgl.xml → third_party/rust/khronos_api/api/xml/wgl.xml поставляемый Executable file → Normal file
Просмотреть файл

@ -1,36 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<registry>
<!--
Copyright (c) 2013-2014 The Khronos Group Inc.
<comment>
Copyright (c) 2013-2017 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
http://www.apache.org/licenses/LICENSE-2.0
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-->
<!--
This file, wgl.xml, is the WGL API Registry. The older ".spec" file
format has been retired and will no longer be updated with new
extensions and API versions. The canonical version of the registry,
together with documentation, schema, and Python generator scripts used
to generate C header files for WGL, can always be found in the Khronos
Registry at
http://www.opengl.org/registry/
-->
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
------------------------------------------------------------------------
This file, wgl.xml, is the WGL API Registry. The older ".spec" file
format has been retired and will no longer be updated with new
extensions and API versions. The canonical version of the registry,
together with documentation, schema, and Python generator scripts used
to generate C header files for WGL, can always be found in the Khronos
Registry at
https://github.com/KhronosGroup/OpenGL-Registry
</comment>
<!-- SECTION: WGL type definitions. Does not include base Windows types. -->
@ -456,6 +450,16 @@
<unused start="0x21C0" end="0x2FFF" comment="Reserved for future use"/>
</enums>
<enums namespace="EGL" start="0x3080" end="0x30AF" vendor="KHR" comment="Values shared with EGL. Do not allocate additional values in this range.">
<enum value="0x3087" name="WGL_COLORSPACE_EXT"/>
<enum value="0x3089" name="WGL_COLORSPACE_SRGB_EXT"/>
<enum value="0x308A" name="WGL_COLORSPACE_LINEAR_EXT"/>
</enums>
<enums namespace="WGL" start="0x31B3" end="0x31B3" vendor="ARB" comment="Shared with GLX.">
<enum value="0x31B3" name="WGL_CONTEXT_OPENGL_NO_ERROR_ARB"/>
</enums>
<enums namespace="GL" start="0x8250" end="0x826F" vendor="ARB" comment="Values shared with GL. Do not allocate additional values in this range.">
<enum value="0x8252" name="WGL_LOSE_CONTEXT_ON_RESET_ARB"/>
<enum value="0x8256" name="WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB"/>
@ -1445,6 +1449,11 @@
<command name="wglCreateContextAttribsARB"/>
</require>
</extension>
<extension name="WGL_ARB_create_context_no_error" supported="wgl">
<require>
<enum name="WGL_CONTEXT_OPENGL_NO_ERROR_ARB"/>
</require>
</extension>
<extension name="WGL_ARB_create_context_profile" supported="wgl">
<require>
<enum name="WGL_CONTEXT_PROFILE_MASK_ARB"/>
@ -1618,6 +1627,13 @@
<enum name="WGL_TYPE_RGBA_FLOAT_ATI"/>
</require>
</extension>
<extension name="WGL_EXT_colorspace" supported="wgl">
<require>
<enum name="WGL_COLORSPACE_EXT"/>
<enum name="WGL_COLORSPACE_SRGB_EXT"/>
<enum name="WGL_COLORSPACE_LINEAR_EXT"/>
</require>
</extension>
<extension name="WGL_EXT_create_context_es_profile" supported="wgl">
<require>
<enum name="WGL_CONTEXT_ES_PROFILE_BIT_EXT"/>

759
third_party/rust/khronos_api/api/egl.xml → third_party/rust/khronos_api/api_egl/api/egl.xml поставляемый Executable file → Normal file

Разница между файлами не показана из-за своего большого размера Загрузить разницу

16
third_party/rust/khronos_api/src/lib.rs поставляемый
Просмотреть файл

@ -14,14 +14,14 @@
//! This crates contains the sources of the official OpenGL repository.
/// The contents of [`gl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/gl.xml)
pub const GL_XML: &'static [u8] = include_bytes!("../api/gl.xml");
/// The contents of [`gl.xml`](https://github.com/KhronosGroup/OpenGL-Registry/blob/master/xml/gl.xml)
pub const GL_XML: &'static [u8] = include_bytes!("../api/xml/gl.xml");
/// The contents of [`egl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/egl.xml)
pub const EGL_XML: &'static [u8] = include_bytes!("../api/egl.xml");
/// The contents of [`egl.xml`](https://github.com/KhronosGroup/EGL-Registry/blob/master/api/egl.xml)
pub const EGL_XML: &'static [u8] = include_bytes!("../api_egl/api/egl.xml");
/// The contents of [`wgl.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/wgl.xml)
pub const WGL_XML: &'static [u8] = include_bytes!("../api/wgl.xml");
/// The contents of [`wgl.xml`](https://github.com/KhronosGroup/OpenGL-Registry/blob/master/xml/wgl.xml)
pub const WGL_XML: &'static [u8] = include_bytes!("../api/xml/wgl.xml");
/// The contents of [`glx.xml`](https://cvs.khronos.org/svn/repos/ogl/trunk/doc/registry/public/api/glx.xml)
pub const GLX_XML: &'static [u8] = include_bytes!("../api/glx.xml");
/// The contents of [`glx.xml`](https://github.com/KhronosGroup/OpenGL-Registry/blob/master/xml/glx.xml)
pub const GLX_XML: &'static [u8] = include_bytes!("../api/xml/glx.xml");

Просмотреть файл

@ -1 +1 @@
{"files":{".travis.yml":"8a46e15f0e861b76f8a600c6b9adf56c7b0de7ce388da6e92d4f34a955536250","Cargo.toml":"0a72336a42a3331b519689596d89ed1ab9f2317d68938918657db8bc2a488736","Changelog.md":"ddc378841a651fc2784e066f51da406bd9ad790e72cb7925851cce1438a28f33","LICENSE":"0dc18d924dc0a5f41172a393012843a5eaaef338e795b3645da9cc3b6068220b","Readme.md":"608c4c6965fa20af9917ec42b72b6b36feece72bfa93467b78222ae9c55fbeb5","design.md":"59eb3e89c9fe3e2c9e7dfd464ddceb56d8bb0fac7459d5b12d3f304487fdfcde","src/analyze.rs":"6fc06790088cc19e2e9c8be9d4d3337fe31f741cf7d5850f4b2dc3522c3b2609","src/attribute.rs":"76ddf747765a461058d6781639161f8b4c10eee630cb0163c8ab205b39f5a673","src/common.rs":"68e13ff6f620681936fb6ca4b7384948729615fea4c9c620551988c874ef3a70","src/escape.rs":"2cd632e3f451e4816b290dc19258189b39f11c58962e09a9587d16f1727e33d7","src/lib.rs":"268e41e85c80214da49af8e4a8a9d171b64b95897be179d18e34b0836434e4c6","src/macros.rs":"8c7f9c18083fceb4af9e27a84d9130888829250c869771cb192eec19941988e0","src/name.rs":"f19eb4cc8c5fb41d84fff9f1b1c3fbb95007ab6c088807272920c022baa8f229","src/namespace.rs":"c3da1668a50bfdf98affdbb8f2126273ebbf73bacde474a5ec5be80f6915957b","src/reader/config.rs":"424c3af8dd6a39ed2af3d1d1e9ecb3ee14b97f1ec42d0fe8821f3ca4c3ade072","src/reader/error.rs":"bf6a889e9464f0b981ad5b761af46b53fed203b917265eaa0c439d5937a313f4","src/reader/events.rs":"4a07a3173f2613f6ea5b7880467152238a20de59dda42c95008d50ef80c9c3ed","src/reader/lexer.rs":"bdec8b9eaa56a0e40d7bf9bf08fc0c664f1fc0d4b79354d9a0c62c78eb5c608f","src/reader/mod.rs":"7418e7da232e164817f01185a4b2306b8b069d9a2a181bbf13daa2d54e2cf0fb","src/reader/parser/inside_cdata.rs":"7217ab332a7e29f8a2282d1bfd4d493465e0d6921e0f9f077634fdcedac331c9","src/reader/parser/inside_closing_tag_name.rs":"595d7888180da8a5ed2003da215be3b8b6521ee0624080b18af4eb3f4a2a6901","src/reader/parser/inside_comment.rs":"1f6b077007422562be7793df0a1d7ace3b2d2afd134e621045cd6650088a438d","src/reader/parser/inside_declaration.rs":"ea00f620e0d2d4fe9024796c80a2b325db2a651fb12467a18ea00f280d83ac48","src/reader/parser/inside_doctype.rs":"c87d1e36aea80ca8443a1a59d5cf2ee32d899c04ccbe38492ce3d02536f8fffd","src/reader/parser/inside_opening_tag.rs":"55c49634886ba41f23ac5f7a8e14f5cb02befb4bf9ea6943b4cc2c31a5569d28","src/reader/parser/inside_processing_instruction.rs":"e9cc8c1f8dd8bb065465659533cf7730d53206a88b06f7385544ccaf54e80368","src/reader/parser/inside_reference.rs":"280ed34b1cad2ebb8534e8cf7455baedb95c0058dcd1f104b528545e7b7d4400","src/reader/parser/mod.rs":"875ea87a59b47dc8d4c07289efc69fe9d19019cd9d0d32a1266955d06f5ef12e","src/reader/parser/outside_tag.rs":"77071f46398a04201e2a0e7ab0ff905165728d6e33e7eb6cc6ba56f772da2947","src/util.rs":"576d7db4550c2c38eb77af6545aebc42dcbe5a81eef190d472202d3ddcd7c97c","src/writer/config.rs":"3aaf615b13862e6daae943d27de05118524bb0d8d9444b1e4f245815696a6fea","src/writer/emitter.rs":"2de4046333ccf8125bdeaea6f23aae4746c8d4962637ad593ea4fd9ed137bd6b","src/writer/events.rs":"42e3ba410dfecc9e54766e278755761fec16e537774d08e0d5f3dfab90d57e31","src/writer/mod.rs":"81ecabbe31eefd8047e3d55bc8ac2703401807cd2683f31b9155f85dfa6ebaa3","tests/documents/sample_1.xml":"79c9ba2d71d70906230905cef127ba8c09ae8701c60357d32cf581dbfc660237","tests/documents/sample_1_full.txt":"efc646390dd6693c4122bb4a7d0c77e31bba7fda0e5767aa1de501bddc64174f","tests/documents/sample_1_short.txt":"83ef8cca29ac8e4b20dc9aea182155ad39d090fb08b76b6abe581801211b10e4","tests/documents/sample_2.xml":"c8350272a8c205e4004fc7e10be1660a0e10d2c9dbf044395d52ad2ca08fa03a","tests/documents/sample_2_full.txt":"21a7b53ddfb8eeaf73d0f6d7a1f96b1af3188129d69f6a5fd4d21e6376f2fb7f","tests/documents/sample_2_short.txt":"b94bc0600a84acf0999775d19c5a7169d24f88c74cc605a1f30b981181bacfeb","tests/documents/sample_3.xml":"a29359438fe9ca025f09d62d4b96f51a89d4be9e634767a5bb447d555c75aef8","tests/documents/sample_3_full.txt":"3522aa83d2b0e942e963d234af0b3426ad3c08141d60ccacc18077c67e2b2194","tests/documents/sample_3_short.txt":"57a8cc41ec6fcebf854126b3c9bb933a1de8be6c5b62372e857906314bb8f13f","tests/documents/sample_4.xml":"7c0ae3ee71a9c94afe1a35480a8c3bf58ffe90b754bccf42f83784971584e9b8","tests/documents/sample_4_full.txt":"f4f2419b336b04af9746ee12ac908a9b82cebca8fc280ad5422d0ab5483ee817","tests/documents/sample_4_short.txt":"39e1b7947fc33276347031e12a0a3f0e5a70eee9e743aba7d5c45b08a454cfae","tests/event_reader.rs":"44810728dd1e4436053d266ed88910d0d48770139c3fc3da95bd7a3ddac22bf9","tests/event_writer.rs":"18b019f7c013064510f72d0f9d42cbe9db296bed0cb7f40c01d4db997f1364bd"},"package":"7ec6c39eaa68382c8e31e35239402c0a9489d4141a8ceb0c716099a0b515b562"}
{"files":{".travis.yml":"8a46e15f0e861b76f8a600c6b9adf56c7b0de7ce388da6e92d4f34a955536250","Cargo.toml":"70a965685fb8ead101d8c75e531d3ff684d68bbdf6b35d3b38bf4bcdac6a5759","Changelog.md":"8fe1afcfc8f2e164e2aa6a10c33be3b4ef7ca003607d57839693468607452843","LICENSE":"0dc18d924dc0a5f41172a393012843a5eaaef338e795b3645da9cc3b6068220b","Readme.md":"79162e348a1dafd1c2723267cd91fe66201b754a0daef7ea14b88491419653f8","design.md":"59eb3e89c9fe3e2c9e7dfd464ddceb56d8bb0fac7459d5b12d3f304487fdfcde","src/analyze.rs":"6fc06790088cc19e2e9c8be9d4d3337fe31f741cf7d5850f4b2dc3522c3b2609","src/attribute.rs":"76ddf747765a461058d6781639161f8b4c10eee630cb0163c8ab205b39f5a673","src/common.rs":"861dca93ca0c6cc7e30cd9f08f486b29dc89d89d361e246ef0947f7060e05ddb","src/escape.rs":"7df467344114064c3bd731c9e70e45c300f7b2704d6edf6e76daf6b32775b780","src/lib.rs":"268e41e85c80214da49af8e4a8a9d171b64b95897be179d18e34b0836434e4c6","src/macros.rs":"8c7f9c18083fceb4af9e27a84d9130888829250c869771cb192eec19941988e0","src/name.rs":"f19eb4cc8c5fb41d84fff9f1b1c3fbb95007ab6c088807272920c022baa8f229","src/namespace.rs":"c3da1668a50bfdf98affdbb8f2126273ebbf73bacde474a5ec5be80f6915957b","src/reader/config.rs":"d63ad011a9bded4031e2cc8a7e417b836bbec7b1d1bf106d771d0b506a2b4525","src/reader/error.rs":"bf6a889e9464f0b981ad5b761af46b53fed203b917265eaa0c439d5937a313f4","src/reader/events.rs":"4a07a3173f2613f6ea5b7880467152238a20de59dda42c95008d50ef80c9c3ed","src/reader/lexer.rs":"79fff053c0df98044144832d030dacf0debf8309ad825e57ceab3142d9db155f","src/reader/mod.rs":"4b7055cb60f736b71dabc91fb99bb1e1bf8429e8bf740f83d5e6e1d64cbe2012","src/reader/parser/inside_cdata.rs":"7217ab332a7e29f8a2282d1bfd4d493465e0d6921e0f9f077634fdcedac331c9","src/reader/parser/inside_closing_tag_name.rs":"595d7888180da8a5ed2003da215be3b8b6521ee0624080b18af4eb3f4a2a6901","src/reader/parser/inside_comment.rs":"1f6b077007422562be7793df0a1d7ace3b2d2afd134e621045cd6650088a438d","src/reader/parser/inside_declaration.rs":"ea00f620e0d2d4fe9024796c80a2b325db2a651fb12467a18ea00f280d83ac48","src/reader/parser/inside_doctype.rs":"c87d1e36aea80ca8443a1a59d5cf2ee32d899c04ccbe38492ce3d02536f8fffd","src/reader/parser/inside_opening_tag.rs":"55c49634886ba41f23ac5f7a8e14f5cb02befb4bf9ea6943b4cc2c31a5569d28","src/reader/parser/inside_processing_instruction.rs":"e9cc8c1f8dd8bb065465659533cf7730d53206a88b06f7385544ccaf54e80368","src/reader/parser/inside_reference.rs":"b87e07f8585fa3329d2527c57a5c8ff3deec889b012ebbef61e9440da54d3b45","src/reader/parser/mod.rs":"fcada7c13000b461ac79ad403b8eb2862e455b963074900227d75f92a250887c","src/reader/parser/outside_tag.rs":"77071f46398a04201e2a0e7ab0ff905165728d6e33e7eb6cc6ba56f772da2947","src/util.rs":"576d7db4550c2c38eb77af6545aebc42dcbe5a81eef190d472202d3ddcd7c97c","src/writer/config.rs":"3aaf615b13862e6daae943d27de05118524bb0d8d9444b1e4f245815696a6fea","src/writer/emitter.rs":"9f6e126ad81f68b58a7535a0d8012dff83ae132d9188bcff832a2b9ce297dea6","src/writer/events.rs":"82db3d1c83144fe1abfa5a841de0593cfe85a1cf7b6563f611ef5dd52bb327d0","src/writer/mod.rs":"81ecabbe31eefd8047e3d55bc8ac2703401807cd2683f31b9155f85dfa6ebaa3","tests/documents/sample_1.xml":"79c9ba2d71d70906230905cef127ba8c09ae8701c60357d32cf581dbfc660237","tests/documents/sample_1_full.txt":"efc646390dd6693c4122bb4a7d0c77e31bba7fda0e5767aa1de501bddc64174f","tests/documents/sample_1_short.txt":"83ef8cca29ac8e4b20dc9aea182155ad39d090fb08b76b6abe581801211b10e4","tests/documents/sample_2.xml":"c8350272a8c205e4004fc7e10be1660a0e10d2c9dbf044395d52ad2ca08fa03a","tests/documents/sample_2_full.txt":"21a7b53ddfb8eeaf73d0f6d7a1f96b1af3188129d69f6a5fd4d21e6376f2fb7f","tests/documents/sample_2_short.txt":"b94bc0600a84acf0999775d19c5a7169d24f88c74cc605a1f30b981181bacfeb","tests/documents/sample_3.xml":"a29359438fe9ca025f09d62d4b96f51a89d4be9e634767a5bb447d555c75aef8","tests/documents/sample_3_full.txt":"3522aa83d2b0e942e963d234af0b3426ad3c08141d60ccacc18077c67e2b2194","tests/documents/sample_3_short.txt":"57a8cc41ec6fcebf854126b3c9bb933a1de8be6c5b62372e857906314bb8f13f","tests/documents/sample_4.xml":"7c0ae3ee71a9c94afe1a35480a8c3bf58ffe90b754bccf42f83784971584e9b8","tests/documents/sample_4_full.txt":"f4f2419b336b04af9746ee12ac908a9b82cebca8fc280ad5422d0ab5483ee817","tests/documents/sample_4_short.txt":"39e1b7947fc33276347031e12a0a3f0e5a70eee9e743aba7d5c45b08a454cfae","tests/documents/sample_5.xml":"356d33417665fee602eb9399a8fb58e9bfaa634bcadfcd97214302bdc32f33c4","tests/documents/sample_5_short.txt":"9b8e3a9e7a71c55ee30ee85d256b06079e2ea8029207efbfb62ca98add4ce585","tests/event_reader.rs":"c4e7c7fe13461502c895c8c2fd3b65ef74432ee41482b8400ea72b0f0be135b9","tests/event_writer.rs":"a0c92666af8f031e0376dfce20f9864c67cd83ec4256a52b8e7c60ed707b8d45","tests/streaming.rs":"1fc96cd6e1cfedddda534c5f07608df169bf3d054c32f4743f256dfc6731f93a"},"package":"3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2"}

23
third_party/rust/xml-rs/Cargo.toml поставляемый
Просмотреть файл

@ -1,13 +1,25 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g. crates.io) dependencies
#
# If you believe there's an error in this file please file an
# issue against the rust-lang/cargo repository. If you're
# editing this file be aware that the upstream Cargo.toml
# will likely look very different (and much more reasonable)
[package]
name = "xml-rs"
version = "0.3.6"
version = "0.7.0"
authors = ["Vladimir Matveev <vladimir.matweev@gmail.com>"]
license = "MIT"
description = "An XML library in pure Rust"
repository = "https://github.com/netvl/xml-rs"
documentation = "http://netvl.github.io/xml-rs/"
readme = "Readme.md"
keywords = ["xml", "parsing", "parser"]
license = "MIT"
repository = "https://github.com/netvl/xml-rs"
[lib]
name = "xml"
@ -16,6 +28,5 @@ path = "src/lib.rs"
[[bin]]
name = "xml-analyze"
path = "src/analyze.rs"
[dependencies]
bitflags = ">=0.5, <0.8"
[dependencies.bitflags]
version = "1.0"

39
third_party/rust/xml-rs/Changelog.md поставляемый
Просмотреть файл

@ -1,3 +1,42 @@
## Version 0.7.0
* Same as 0.6.2, with 0.6.2 being yanked because of the incompatible bump of minimum required version of rustc.
## Version 0.6.2
* Bumped `bitflags` to 1.0.
## Version 0.6.1
* Fixed the writer to escape some special characters when writing attribute values.
## Version 0.6.0
* Changed the target type of extra entities from `char` to `String`. This is an incompatible
change.
## Version 0.5.0
* Added support for ignoring EOF errors in order to read documents from streams incrementally.
* Bumped `bitflags` to 0.9.
## Version 0.4.1
* Added missing `Debug` implementation to `xml::writer::XmlEvent`.
## Version 0.4.0
* Bumped version number, since changes introduced in 0.3.7 break backwards compatibility.
## Version 0.3.8
* Fixed a problem introduced in 0.3.7 with entities in attributes causing parsing errors.
## Version 0.3.7
* Fixed the problem with parsing non-whitespace character entities as whitespace (issue #140).
* Added support for configuring custom entities in the parser configuration.
## Version 0.3.6
* Added an `Error` implementation for `EmitterError`.

2
third_party/rust/xml-rs/Readme.md поставляемый
Просмотреть файл

@ -60,7 +60,7 @@ xml-rs uses [Cargo](http://crates.io), so just add a dependency section in your
```toml
[dependencies]
xml-rs = "0.3"
xml-rs = "0.7"
```
The package exposes a single crate called `xml`:

7
third_party/rust/xml-rs/src/common.rs поставляемый
Просмотреть файл

@ -104,6 +104,13 @@ pub fn is_whitespace_char(c: char) -> bool {
}
}
/// Checks whether the given string is compound only by white space
/// characters (`S`) using the previous is_whitespace_char to check
/// all characters of this string
pub fn is_whitespace_str(s: &str) -> bool {
s.chars().all(is_whitespace_char)
}
/// Checks whether the given character is a name start character (`NameStartChar`)
/// as is defined by XML 1.1 specification, [section 2.3][1].
///

2
third_party/rust/xml-rs/src/escape.rs поставляемый
Просмотреть файл

@ -15,6 +15,8 @@ impl Value {
'"' => Value::Str("&quot;"),
'\'' => Value::Str("&apos;"),
'&' => Value::Str("&amp;"),
'\n' => Value::Str("&#xA;"),
'\r' => Value::Str("&#xD;"),
_ => Value::Char(c)
}
}

51
third_party/rust/xml-rs/src/reader/config.rs поставляемый
Просмотреть файл

@ -1,5 +1,6 @@
//! Contains parser configuration structure.
use std::io::Read;
use std::collections::HashMap;
use reader::EventReader;
@ -53,7 +54,27 @@ pub struct ParserConfig {
/// Multiple sequential `Characters` events are only possible if either
/// `cdata_to_characters` or `ignore_comments` are set. Otherwise character
/// events will always be separated by other events.
pub coalesce_characters: bool
pub coalesce_characters: bool,
/// A map of extra entities recognized by the parser. Default is an empty map.
///
/// By default the XML parser recognizes the entities defined in the XML spec. Sometimes,
/// however, it is convenient to make the parser recognize additional entities which
/// are also not available through the DTD definitions (especially given that at the moment
/// DTD parsing is not supported).
pub extra_entities: HashMap<String, String>,
/// Whether or not the parser should ignore the end of stream. Default is false.
///
/// By default the parser will either error out when it encounters a premature end of
/// stream or complete normally if the end of stream was expected. If you want to continue
/// reading from a stream whose input is supplied progressively, you can set this option to true.
/// In this case the parser will allow you to invoke the next() method even if a supposed end
/// of stream has happened.
///
/// Note that support for this functionality is incomplete; for example, the parser will fail if
/// the premature end of stream happens inside PCDATA. Therefore, use this option at your own risk.
pub ignore_end_of_stream: bool
}
impl ParserConfig {
@ -75,7 +96,9 @@ impl ParserConfig {
whitespace_to_characters: false,
cdata_to_characters: false,
ignore_comments: true,
coalesce_characters: true
coalesce_characters: true,
extra_entities: HashMap::new(),
ignore_end_of_stream: false
}
}
@ -101,6 +124,27 @@ impl ParserConfig {
pub fn create_reader<R: Read>(self, source: R) -> EventReader<R> {
EventReader::new_with_config(source, self)
}
/// Adds a new entity mapping and returns an updated config object.
///
/// This is a convenience method for adding external entities mappings to the XML parser.
/// An example:
///
/// ```rust
/// use xml::reader::ParserConfig;
///
/// let mut source: &[u8] = b"...";
///
/// let reader = ParserConfig::new()
/// .add_entity("nbsp", " ")
/// .add_entity("copy", "©")
/// .add_entity("reg", "®")
/// .create_reader(&mut source);
/// ```
pub fn add_entity<S: Into<String>, T: Into<String>>(mut self, entity: S, value: T) -> ParserConfig {
self.extra_entities.insert(entity.into(), value.into());
self
}
}
impl Default for ParserConfig {
@ -115,5 +159,6 @@ gen_setters! { ParserConfig,
whitespace_to_characters: val bool,
cdata_to_characters: val bool,
ignore_comments: val bool,
coalesce_characters: val bool
coalesce_characters: val bool,
ignore_end_of_stream: val bool
}

4
third_party/rust/xml-rs/src/reader/lexer.rs поставляемый
Просмотреть файл

@ -264,6 +264,10 @@ impl Lexer {
#[inline]
pub fn outside_comment(&mut self) { self.inside_comment = false; }
/// Reset the eof handled flag of the lexer.
#[inline]
pub fn reset_eof_handled(&mut self) { self.eof_handled = false; }
/// Tries to read the next token from the buffer.
///
/// It is possible to pass different instaces of `BufReader` each time

6
third_party/rust/xml-rs/src/reader/mod.rs поставляемый
Просмотреть файл

@ -97,6 +97,10 @@ impl<R: Read> Events<R> {
pub fn into_inner(self) -> EventReader<R> {
self.reader
}
pub fn source(&self) -> &R { &self.reader.source }
pub fn source_mut(&mut self) -> &mut R { &mut self.reader.source }
}
impl<R: Read> Iterator for Events<R> {
@ -104,7 +108,7 @@ impl<R: Read> Iterator for Events<R> {
#[inline]
fn next(&mut self) -> Option<Result<XmlEvent>> {
if self.finished { None }
if self.finished && !self.reader.parser.is_ignoring_end_of_stream() { None }
else {
let ev = self.reader.next();
match ev {

Просмотреть файл

@ -1,6 +1,6 @@
use std::char;
use common::{is_name_start_char, is_name_char};
use common::{is_name_start_char, is_name_char, is_whitespace_str};
use reader::lexer::Token;
@ -20,11 +20,11 @@ impl PullParser {
let name = self.data.take_ref_data();
let name_len = name.len(); // compute once
let c = match &name[..] {
"lt" => Ok('<'),
"gt" => Ok('>'),
"amp" => Ok('&'),
"apos" => Ok('\''),
"quot" => Ok('"'),
"lt" => Ok('<'.to_string()),
"gt" => Ok('>'.to_string()),
"amp" => Ok('&'.to_string()),
"apos" => Ok('\''.to_string()),
"quot" => Ok('"'.to_string()),
"" => Err(self_error!(self; "Encountered empty entity")),
_ if name_len > 2 && name.starts_with("#x") => {
let num_str = &name[2..name_len];
@ -32,7 +32,7 @@ impl PullParser {
Err(self_error!(self; "Null character entity is not allowed"))
} else {
match u32::from_str_radix(num_str, 16).ok().and_then(char::from_u32) {
Some(c) => Ok(c),
Some(c) => Ok(c.to_string()),
None => Err(self_error!(self; "Invalid hexadecimal character number in an entity: {}", name))
}
}
@ -43,16 +43,25 @@ impl PullParser {
Err(self_error!(self; "Null character entity is not allowed"))
} else {
match u32::from_str_radix(num_str, 10).ok().and_then(char::from_u32) {
Some(c) => Ok(c),
Some(c) => Ok(c.to_string()),
None => Err(self_error!(self; "Invalid decimal character number in an entity: {}", name))
}
}
},
_ => Err(self_error!(self; "Unexpected entity: {}", name))
_ => {
if let Some(v) = self.config.extra_entities.get(&name) {
Ok(v.clone())
} else {
Err(self_error!(self; "Unexpected entity: {}", name))
}
}
};
match c {
Ok(c) => {
self.buf.push(c);
self.buf.push_str(&c);
if prev_st == State::OutsideTag && !is_whitespace_str(&c) {
self.inside_whitespace = false;
}
self.into_state_continue(prev_st)
}
Err(e) => Some(e)

Просмотреть файл

@ -120,6 +120,9 @@ impl PullParser {
pop_namespace: false
}
}
/// Checks if this parser ignores the end of stream errors.
pub fn is_ignoring_end_of_stream(&self) -> bool { self.config.ignore_end_of_stream }
}
impl Position for PullParser {
@ -297,7 +300,13 @@ impl PullParser {
self_error!(self; "Unexpected end of stream") // TODO: add expected hint?
}
} else {
self_error!(self; "Unexpected end of stream: still inside the root element")
if self.config.ignore_end_of_stream {
self.final_result = None;
self.lexer.reset_eof_handled();
return self_error!(self; "Unexpected end of stream: still inside the root element");
} else {
self_error!(self; "Unexpected end of stream: still inside the root element")
}
};
self.set_final_result(ev)
}
@ -585,6 +594,19 @@ mod tests {
expect_event!(r, p, Ok(XmlEvent::EndDocument));
}
#[test]
fn issue_140_entity_reference_inside_tag() {
let (mut r, mut p) = test_data!(r#"
<bla>&#9835;</bla>
"#);
expect_event!(r, p, Ok(XmlEvent::StartDocument { .. }));
expect_event!(r, p, Ok(XmlEvent::StartElement { ref name, .. }) => *name == OwnedName::local("bla"));
expect_event!(r, p, Ok(XmlEvent::Characters(ref s)) => s == "\u{266b}");
expect_event!(r, p, Ok(XmlEvent::EndElement { ref name, .. }) => *name == OwnedName::local("bla"));
expect_event!(r, p, Ok(XmlEvent::EndDocument));
}
#[test]
fn opening_tag_in_attribute_value() {
let (mut r, mut p) = test_data!(r#"

20
third_party/rust/xml-rs/src/writer/emitter.rs поставляемый
Просмотреть файл

@ -133,10 +133,10 @@ macro_rules! if_present(
);
bitflags!(
flags IndentFlags: u8 {
const WROTE_NOTHING = 0,
const WROTE_MARKUP = 1,
const WROTE_TEXT = 2
struct IndentFlags: u8 {
const WROTE_NOTHING = 0;
const WROTE_MARKUP = 1;
const WROTE_TEXT = 2;
}
);
@ -149,27 +149,27 @@ impl Emitter {
#[inline]
fn wrote_text(&self) -> bool {
self.indent_stack.last().unwrap().contains(WROTE_TEXT)
self.indent_stack.last().unwrap().contains(IndentFlags::WROTE_TEXT)
}
#[inline]
fn wrote_markup(&self) -> bool {
self.indent_stack.last().unwrap().contains(WROTE_MARKUP)
self.indent_stack.last().unwrap().contains(IndentFlags::WROTE_MARKUP)
}
#[inline]
fn set_wrote_text(&mut self) {
*self.indent_stack.last_mut().unwrap() = WROTE_TEXT;
*self.indent_stack.last_mut().unwrap() = IndentFlags::WROTE_TEXT;
}
#[inline]
fn set_wrote_markup(&mut self) {
*self.indent_stack.last_mut().unwrap() = WROTE_MARKUP;
*self.indent_stack.last_mut().unwrap() = IndentFlags::WROTE_MARKUP;
}
#[inline]
fn reset_state(&mut self) {
*self.indent_stack.last_mut().unwrap() = WROTE_NOTHING;
*self.indent_stack.last_mut().unwrap() = IndentFlags::WROTE_NOTHING;
}
fn write_newline<W: Write>(&mut self, target: &mut W, level: usize) -> Result<()> {
@ -198,7 +198,7 @@ impl Emitter {
fn before_start_element<W: Write>(&mut self, target: &mut W) -> Result<()> {
try!(self.before_markup(target));
self.indent_stack.push(WROTE_NOTHING);
self.indent_stack.push(IndentFlags::WROTE_NOTHING);
Ok(())
}

Просмотреть файл

@ -11,6 +11,7 @@ use namespace::{Namespace, NS_NO_PREFIX};
///
/// Objects of this enum are consumed by `EventWriter`. They correspond to different parts of
/// an XML document.
#[derive(Debug)]
pub enum XmlEvent<'a> {
/// Corresponds to XML document declaration.
///

7
third_party/rust/xml-rs/tests/documents/sample_5.xml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE data SYSTEM "abcd.dtd">
<p>
<a>test&nbsp;&copy;&NotEqualTilde;</a>
</p>

7
third_party/rust/xml-rs/tests/documents/sample_5_short.txt поставляемый Normal file
Просмотреть файл

@ -0,0 +1,7 @@
StartDocument(1.0, utf-8)
StartElement(p)
StartElement(a)
Characters("test ©≂̸")
EndElement(a)
EndElement(p)
EndDocument

18
third_party/rust/xml-rs/tests/event_reader.rs поставляемый
Просмотреть файл

@ -146,6 +146,24 @@ fn sample_4_full() {
}
#[test]
fn sample_5_short() {
test(
include_bytes!("documents/sample_5.xml"),
include_bytes!("documents/sample_5_short.txt"),
ParserConfig::new()
.ignore_comments(true)
.whitespace_to_characters(true)
.cdata_to_characters(true)
.trim_whitespace(true)
.coalesce_characters(true)
.add_entity("nbsp", " ")
.add_entity("copy", "©")
.add_entity("NotEqualTilde", "≂̸"),
false
);
}
#[test]
fn eof_1() {
test(

54
third_party/rust/xml-rs/tests/event_writer.rs поставляемый
Просмотреть файл

@ -166,3 +166,57 @@ fn issue_112_overriding_namepace_prefix() {
r#"<iq xmlns="jabber:client" xmlns:a="urn:A"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind" /><whatever xmlns:a="urn:X" /></iq>"#
)
}
#[test]
fn attribute_escaping() {
use xml::writer::XmlEvent;
let mut b = Vec::new();
{
let mut w = EmitterConfig::new()
.write_document_declaration(false)
.perform_indent(true)
.create_writer(&mut b);
unwrap_all! {
w.write(
XmlEvent::start_element("hello")
.attr("testLt", "<")
.attr("testGt", ">")
);
w.write(XmlEvent::end_element());
w.write(
XmlEvent::start_element("hello")
.attr("testQuot", "\"")
.attr("testApos", "\'")
);
w.write(XmlEvent::end_element());
w.write(
XmlEvent::start_element("hello")
.attr("testAmp", "&")
);
w.write(XmlEvent::end_element());
w.write(
XmlEvent::start_element("hello")
.attr("testNl", "\n")
.attr("testCr", "\r")
);
w.write(XmlEvent::end_element());
w.write(
XmlEvent::start_element("hello")
.attr("testNl", "\\n")
.attr("testCr", "\\r")
);
w.write(XmlEvent::end_element())
}
}
assert_eq!(
str::from_utf8(&b).unwrap(),
"<hello testLt=\"&lt;\" testGt=\"&gt;\" />
<hello testQuot=\"&quot;\" testApos=\"&apos;\" />
<hello testAmp=\"&amp;\" />
<hello testNl=\"&#xA;\" testCr=\"&#xD;\" />
<hello testNl=\"\\n\" testCr=\"\\r\" />"
);
}

101
third_party/rust/xml-rs/tests/streaming.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,101 @@
extern crate xml;
use std::io::{Cursor, Write};
use xml::EventReader;
use xml::reader::ParserConfig;
use xml::reader::XmlEvent;
macro_rules! assert_match {
($actual:expr, $expected:pat) => {
match $actual {
$expected => {},
_ => panic!("assertion failed: `(left matches right)` \
(left: `{:?}`, right: `{}`", $actual, stringify!($expected))
}
};
($actual:expr, $expected:pat if $guard:expr) => {
match $actual {
$expected if $guard => {},
_ => panic!("assertion failed: `(left matches right)` \
(left: `{:?}`, right: `{} if {}`",
$actual, stringify!($expected), stringify!($guard))
}
}
}
fn write_and_reset_position<W>(c: &mut Cursor<W>, data: &[u8]) where Cursor<W>: Write {
let p = c.position();
c.write_all(data).unwrap();
c.set_position(p);
}
#[test]
fn reading_streamed_content() {
let buf = Cursor::new(b"<root>".to_vec());
let reader = EventReader::new(buf);
let mut it = reader.into_iter();
assert_match!(it.next(), Some(Ok(XmlEvent::StartDocument { .. })));
assert_match!(it.next(), Some(Ok(XmlEvent::StartElement { ref name, .. })) if name.local_name == "root");
write_and_reset_position(it.source_mut(), b"<child-1>content</child-1>");
assert_match!(it.next(), Some(Ok(XmlEvent::StartElement { ref name, .. })) if name.local_name == "child-1");
assert_match!(it.next(), Some(Ok(XmlEvent::Characters(ref c))) if c == "content");
assert_match!(it.next(), Some(Ok(XmlEvent::EndElement { ref name })) if name.local_name == "child-1");
write_and_reset_position(it.source_mut(), b"<child-2/>");
assert_match!(it.next(), Some(Ok(XmlEvent::StartElement { ref name, .. })) if name.local_name == "child-2");
assert_match!(it.next(), Some(Ok(XmlEvent::EndElement { ref name })) if name.local_name == "child-2");
write_and_reset_position(it.source_mut(), b"<child-3/>");
assert_match!(it.next(), Some(Ok(XmlEvent::StartElement { ref name, .. })) if name.local_name == "child-3");
assert_match!(it.next(), Some(Ok(XmlEvent::EndElement { ref name })) if name.local_name == "child-3");
// doesn't seem to work because of how tags parsing is done
// write_and_reset_position(it.source_mut(), b"some text");
// assert_match!(it.next(), Some(Ok(XmlEvent::Characters(ref c))) if c == "some text");
write_and_reset_position(it.source_mut(), b"</root>");
assert_match!(it.next(), Some(Ok(XmlEvent::EndElement { ref name })) if name.local_name == "root");
assert_match!(it.next(), Some(Ok(XmlEvent::EndDocument)));
assert_match!(it.next(), None);
}
#[test]
fn reading_streamed_content2() {
let buf = Cursor::new(b"<root>".to_vec());
let mut config = ParserConfig::new();
config.ignore_end_of_stream = true;
let readerb = EventReader::new_with_config(buf, config);
let mut reader = readerb.into_iter();
assert_match!(reader.next(), Some(Ok(XmlEvent::StartDocument { .. })));
assert_match!(reader.next(), Some(Ok(XmlEvent::StartElement { ref name, .. })) if name.local_name == "root");
write_and_reset_position(reader.source_mut(), b"<child-1>content</child-1>");
assert_match!(reader.next(), Some(Ok(XmlEvent::StartElement { ref name, .. })) if name.local_name == "child-1");
assert_match!(reader.next(), Some(Ok(XmlEvent::Characters(ref c))) if c == "content");
assert_match!(reader.next(), Some(Ok(XmlEvent::EndElement { ref name })) if name.local_name == "child-1");
write_and_reset_position(reader.source_mut(), b"<child-2>content</child-2>");
assert_match!(reader.next(), Some(Ok(XmlEvent::StartElement { ref name, .. })) if name.local_name == "child-2");
assert_match!(reader.next(), Some(Ok(XmlEvent::Characters(ref c))) if c == "content");
assert_match!(reader.next(), Some(Ok(XmlEvent::EndElement { ref name })) if name.local_name == "child-2");
assert_match!(reader.next(), Some(Err(_)));
write_and_reset_position(reader.source_mut(), b"<child-3></child-3>");
assert_match!(reader.next(), Some(Ok(XmlEvent::StartElement { ref name, .. })) if name.local_name == "child-3");
write_and_reset_position(reader.source_mut(), b"<child-4 type='get'");
match reader.next() {
None |
Some(Ok(_)) => {
panic!("At this point, parser must not detect something.");
},
Some(Err(_)) => {}
};
write_and_reset_position(reader.source_mut(), b" />");
assert_match!(reader.next(), Some(Ok(XmlEvent::StartElement { ref name, .. })) if name.local_name == "child-4");
}