code
stringlengths 38
801k
| repo_path
stringlengths 6
263
|
---|---|
const std = @import("std");
const sdl = @import("sdl");
const gk = @import("gamekit");
const gfx = gk.gfx;
const math = gk.math;
pub const renderer: gk.renderkit.Renderer = .opengl;
var rng = std.rand.DefaultPrng.init(0x12345678);
const total_textures: usize = 8;
const max_sprites_per_batch: usize = 5000;
const total_objects = 10000;
const draws_per_tex_swap = 250;
const use_multi_texture_batcher = false;
const MultiFragUniform = struct {
samplers: [8]c_int = undefined,
};
pub fn range(comptime T: type, at_least: T, less_than: T) T {
if (@typeInfo(T) == .Int) {
return rng.random().intRangeLessThanBiased(T, at_least, less_than);
} else if (@typeInfo(T) == .Float) {
return at_least + rng.random().float(T) * (less_than - at_least);
}
unreachable;
}
pub fn randomColor() u32 {
const r = range(u8, 0, 255);
const g = range(u8, 0, 255);
const b = range(u8, 0, 255);
return (r) | (@as(u32, g) << 8) | (@as(u32, b) << 16) | (@as(u32, 255) << 24);
}
const Thing = struct {
texture: gfx.Texture,
pos: math.Vec2,
vel: math.Vec2,
col: u32,
pub fn init(tex: gfx.Texture) Thing {
return .{
.texture = tex,
.pos = .{
.x = range(f32, 0, 750),
.y = range(f32, 0, 50),
},
.vel = .{
.x = range(f32, -150, 150),
.y = range(f32, 0, 250),
},
.col = randomColor(),
};
}
};
var shader: ?gfx.Shader = undefined;
var batcher: if (use_multi_texture_batcher) gfx.MultiBatcher else gfx.Batcher = undefined;
var textures: []gfx.Texture = undefined;
var things: []Thing = undefined;
pub fn main() !void {
rng.seed(@intCast(u64, std.time.milliTimestamp()));
try gk.run(.{ .init = init, .update = update, .render = render, .shutdown = shutdown, .window = .{ .disable_vsync = true } });
}
fn init() !void {
if (use_multi_texture_batcher and gk.renderkit.current_renderer != .opengl) @panic("only OpenGL is implemented for MultiBatcher shader");
shader = if (use_multi_texture_batcher)
try gfx.Shader.initWithFrag(MultiFragUniform, .{
.vert = @embedFile("assets/shaders/multi_batcher.gl.vs"),
.frag = @embedFile("assets/shaders/multi_batcher.gl.fs"),
})
else
null;
if (use_multi_texture_batcher) {
var uniform = MultiFragUniform{};
for (uniform.samplers) |*val, i| val.* = @intCast(c_int, i);
shader.?.bind();
shader.?.setVertUniform(MultiFragUniform, &uniform);
}
batcher = if (use_multi_texture_batcher) gfx.MultiBatcher.init(std.testing.allocator, max_sprites_per_batch) else gfx.Batcher.init(std.testing.allocator, max_sprites_per_batch);
loadTextures();
makeThings(total_objects);
}
fn shutdown() !void {
std.testing.allocator.free(things);
defer {
for (textures) |tex| tex.deinit();
std.testing.allocator.free(textures);
}
}
fn update() !void {
const size = gk.window.size();
const win_w = @intToFloat(f32, size.w);
const win_h = @intToFloat(f32, size.h);
if (@mod(gk.time.frames(), 500) == 0) std.debug.print("fps: {d}\n", .{gk.time.fps()});
for (things) |*thing| {
thing.pos.x += thing.vel.x * gk.time.rawDeltaTime();
thing.pos.y += thing.vel.y * gk.time.rawDeltaTime();
if (thing.pos.x > win_w) {
thing.vel.x *= -1;
thing.pos.x = win_w;
}
if (thing.pos.x < 0) {
thing.vel.x *= -1;
thing.pos.x = 0;
}
if (thing.pos.y > win_h) {
thing.vel.y *= -1;
thing.pos.y = win_h;
}
if (thing.pos.y < 0) {
thing.vel.y *= -1;
thing.pos.y = 0;
}
}
}
fn render() !void {
gfx.beginPass(.{ .color = math.Color.beige });
if (shader) |*shdr| gfx.setShader(shdr);
batcher.begin();
for (things) |thing| {
batcher.drawTex(thing.pos, thing.col, thing.texture);
}
batcher.end();
gfx.endPass();
}
fn loadTextures() void {
textures = std.testing.allocator.alloc(gfx.Texture, total_textures) catch unreachable;
var buf: [512]u8 = undefined;
for (textures) |_, i| {
var name = std.fmt.bufPrintZ(&buf, "examples/assets/textures/bee-{}.png", .{i + 1}) catch unreachable;
textures[i] = gfx.Texture.initFromFile(std.testing.allocator, name, .nearest) catch unreachable;
}
}
fn makeThings(n: usize) void {
things = std.testing.allocator.alloc(Thing, n) catch unreachable;
var count: usize = 0;
var tid = range(usize, 0, total_textures);
for (things) |*thing| {
count += 1;
if (@mod(count, draws_per_tex_swap) == 0) {
count = 0;
tid = range(usize, 0, total_textures);
}
if (use_multi_texture_batcher) tid = range(usize, 0, total_textures);
thing.* = Thing.init(textures[tid]);
}
} | examples/batcher.zig |
const std = @import("std");
const print = std.debug.print;
const mem = std.mem;
const spi = @import("bus/spi.zig");
const MAX_PAYLOAD_SIZE = 256;
const SPI_BUFFER_SIZE = 128;
const MAX_WAIT = 250;
const SLEEP = std.time.ns_per_ms * 10;
//Registers
const UBX_SYNCH_1: u8 = 0xB5;
const UBX_SYNCH_2: u8 = 0x62;
//The following are UBX Class IDs. Descriptions taken from ZED-F9P Interface Description Document page 32, NEO-M8P Interface Description page 145
const UBX_CLASS_NAV: u8 = 0x01; //Navigation Results Messages: Position, Speed, Time, Acceleration, Heading, DOP, SVs used
const UBX_CLASS_RXM: u8 = 0x02; //Receiver Manager Messages: Satellite Status, RTC Status
const UBX_CLASS_INF: u8 = 0x04; //Information Messages: Printf-Style Messages, with IDs such as Error, Warning, Notice
const UBX_CLASS_ACK: u8 = 0x05; //Ack/Nak Messages: Acknowledge or Reject messages to UBX-CFG input messages
const UBX_CLASS_CFG: u8 = 0x06; //Configuration Input Messages: Configure the receiver.
const UBX_CLASS_UPD: u8 = 0x09; //Firmware Update Messages: Memory/Flash erase/write, Reboot, Flash identification, etc.
const UBX_CLASS_MON: u8 = 0x0A; //Monitoring Messages: Communication Status, CPU Load, Stack Usage, Task Status
const UBX_CLASS_AID: u8 = 0x0B; //(NEO-M8P ONLY!!!) AssistNow Aiding Messages: Ephemeris, Almanac, other A-GPS data input
const UBX_CLASS_TIM: u8 = 0x0D; //Timing Messages: Time Pulse Output, Time Mark Results
const UBX_CLASS_ESF: u8 = 0x10; //(NEO-M8P ONLY!!!) External Sensor Fusion Messages: External Sensor Measurements and Status Information
const UBX_CLASS_MGA: u8 = 0x13; //Multiple GNSS Assistance Messages: Assistance data for various GNSS
const UBX_CLASS_LOG: u8 = 0x21; //Logging Messages: Log creation, deletion, info and retrieval
const UBX_CLASS_SEC: u8 = 0x27; //Security Feature Messages
const UBX_CLASS_HNR: u8 = 0x28; //(NEO-M8P ONLY!!!) High Rate Navigation Results Messages: High rate time, position speed, heading
const UBX_CLASS_NMEA: u8 = 0xF0; //NMEA Strings: standard NMEA strings
//Class: CFG
//The following are used for configuration. Descriptions are from the ZED-F9P Interface Description pg 33-34 and NEO-M9N Interface Description pg 47-48
const UBX_CFG_ANT: u8 = 0x13; //Antenna Control Settings. Used to configure the antenna control settings
const UBX_CFG_BATCH: u8 = 0x93; //Get/set data batching configuration.
const UBX_CFG_CFG: u8 = 0x09; //Clear, Save, and Load Configurations. Used to save current configuration
const UBX_CFG_DAT: u8 = 0x06; //Set User-defined Datum or The currently defined Datum
const UBX_CFG_DGNSS: u8 = 0x70; //DGNSS configuration
const UBX_CFG_ESFALG: u8 = 0x56; //ESF alignment
const UBX_CFG_ESFA: u8 = 0x4C; //ESF accelerometer
const UBX_CFG_ESFG: u8 = 0x4D; //ESF gyro
const UBX_CFG_GEOFENCE: u8 = 0x69; //Geofencing configuration. Used to configure a geofence
const UBX_CFG_GNSS: u8 = 0x3E; //GNSS system configuration
const UBX_CFG_HNR: u8 = 0x5C; //High Navigation Rate
const UBX_CFG_INF: u8 = 0x02; //Depending on packet length, either: poll configuration for one protocol, or information message configuration
const UBX_CFG_ITFM: u8 = 0x39; //Jamming/Interference Monitor configuration
const UBX_CFG_LOGFILTER: u8 = 0x47; //Data Logger Configuration
const UBX_CFG_MS: u8G = 0x01; //Poll a message configuration, or Set Message Rate(s), or Set Message Rate
const UBX_CFG_NAV5: u8 = 0x24; //Navigation Engine Settings. Used to configure the navigation engine including the dynamic model.
const UBX_CFG_NAVX5: u8 = 0x23; //Navigation Engine Expert Settings
const UBX_CFG_NMEA: u8 = 0x17; //Extended NMEA protocol configuration V1
const UBX_CFG_ODO: u8 = 0x1E; //Odometer, Low-speed COG Engine Settings
const UBX_CFG_PM2: u8 = 0x3B; //Extended power management configuration
const UBX_CFG_PMS: u8 = 0x86; //Power mode setup
const UBX_CFG_PRT: u8 = 0x00; //Used to configure port specifics. Polls the configuration for one I/O Port, or Port configuration for UART ports, or Port configuration for USB port, or Port configuration for SPI port, or Port configuration for DDC port
const UBX_CFG_PWR: u8 = 0x57; //Put receiver in a defined power state
const UBX_CFG_RATE: u8 = 0x08; //Navigation/Measurement Rate Settings. Used to set port baud rates.
const UBX_CFG_RINV: u8 = 0x34; //Contents of Remote Inventory
const UBX_CFG_RST: u8 = 0x04; //Reset Receiver / Clear Backup Data Structures. Used to reset device.
const UBX_CFG_RXM: u8 = 0x11; //RXM configuration
const UBX_CFG_SBAS: u8 = 0x16; //SBAS configuration
const UBX_CFG_TMODE3: u8 = 0x71; //Time Mode Settings 3. Used to enable Survey In Mode
const UBX_CFG_TP5: u8 = 0x31; //Time Pulse Parameters
const UBX_CFG_USB: u8 = 0x1B; //USB Configuration
const UBX_CFG_VALDEL: u8 = 0x8C; //Used for config of higher version u-blox modules (ie protocol v27 and above). Deletes values corresponding to provided keys/ provided keys with a transaction
const UBX_CFG_VALGET: u8 = 0x8B; //Used for config of higher version u-blox modules (ie protocol v27 and above). Configuration Items
const UBX_CFG_VALSET: u8 = 0x8A; //Used for config of higher version u-blox modules (ie protocol v27 and above). Sets values corresponding to provided key-value pairs/ provided key-value pairs within a transaction.
//Class: NAV
//The following are used to configure the NAV UBX messages (navigation results messages). Descriptions from UBX messages overview (ZED_F9P Interface Description Document page 35-36)
const UBX_NAV_ATT: u8 = 0x05; //Vehicle "Attitude" Solution
const UBX_NAV_CLOCK: u8 = 0x22; //Clock Solution
const UBX_NAV_DOP: u8 = 0x04; //Dilution of precision
const UBX_NAV_EOE: u8 = 0x61; //End of Epoch
const UBX_NAV_GEOFENCE: u8 = 0x39; //Geofencing status. Used to poll the geofence status
const UBX_NAV_HPPOSECEF: u8 = 0x13; //High Precision Position Solution in ECEF. Used to find our positional accuracy (high precision).
const UBX_NAV_HPPOSLLH: u8 = 0x14; //High Precision Geodetic Position Solution. Used for obtaining lat/long/alt in high precision
const UBX_NAV_ODO: u8 = 0x09; //Odometer Solution
const UBX_NAV_ORB: u8 = 0x34; //GNSS Orbit Database Info
const UBX_NAV_POSECEF: u8 = 0x01; //Position Solution in ECEF
const UBX_NAV_POSLLH: u8 = 0x02; //Geodetic Position Solution
const UBX_NAV_PVT: u8 = 0x07; //All the things! Position, velocity, time, PDOP, height, h/v accuracies, number of satellites. Navigation Position Velocity Time Solution.
const UBX_NAV_RELPOSNED: u8 = 0x3C; //Relative Positioning Information in NED frame
const UBX_NAV_RESETODO: u8 = 0x10; //Reset odometer
const UBX_NAV_SAT: u8 = 0x35; //Satellite Information
const UBX_NAV_SIG: u8 = 0x43; //Signal Information
const UBX_NAV_STATUS: u8 = 0x03; //Receiver Navigation Status
const UBX_NAV_SVIN: u8 = 0x3B; //Survey-in data. Used for checking Survey In status
const UBX_NAV_TIMEBDS: u8 = 0x24; //BDS Time Solution
const UBX_NAV_TIMEGAL: u8 = 0x25; //Galileo Time Solution
const UBX_NAV_TIMEGLO: u8 = 0x23; //GLO Time Solution
const UBX_NAV_TIMEGPS: u8 = 0x20; //GPS Time Solution
const UBX_NAV_TIMELS: u8 = 0x26; //Leap second event information
const UBX_NAV_TIMEUTC: u8 = 0x21; //UTC Time Solution
const UBX_NAV_VELECEF: u8 = 0x11; //Velocity Solution in ECEF
const UBX_NAV_VELNED: u8 = 0x12; //Velocity Solution in NED
//Class: HNR
//The following are used to configure the HNR message rates
const UBX_HNR_ATT: u8 = 0x01; //HNR Attitude
const UBX_HNR_INS: u8 = 0x02; //HNR Vehicle Dynamics
const UBX_HNR_PVT: u8 = 0x00; //HNR PVT
//Class: ESF
// The following constants are used to get External Sensor Measurements and Status
// Information.
const UBX_ESF_MEAS: u8 = 0x02;
const UBX_ESF_RAW: u8 = 0x03;
const UBX_ESF_STATUS: u8 = 0x10;
const UBX_ESF_RESETALG: u8 = 0x13;
const UBX_ESF_ALG: u8 = 0x14;
const UBX_ESF_INS: u8 = 0x15; //36 bytes
//Class: RXM
//The following are used to configure the RXM UBX messages (receiver manager messages). Descriptions from UBX messages overview (ZED_F9P Interface Description Document page 36)
const UBX_RXM_MEASX: u8 = 0x14; //Satellite Measurements for RRLP
const UBX_RXM_PMREQ: u8 = 0x41; //Requests a Power Management task (two differenent packet sizes)
const UBX_RXM_RAWX: u8 = 0x15; //Multi-GNSS Raw Measurement Data
const UBX_RXM_RLM: u8 = 0x59; //Galileo SAR Short-RLM report (two different packet sizes)
const UBX_RXM_RTCM: u8 = 0x32; //RTCM input status
const UBX_RXM_SFRBX: u8 = 0x13; //Boradcast Navigation Data Subframe
//Class: TIM
//The following are used to configure the TIM UBX messages (timing messages). Descriptions from UBX messages overview (ZED_F9P Interface Description Document page 36)
const UBX_TIM_TM2: u8 = 0x03; //Time mark data
const UBX_TIM_TP: u8 = 0x01; //Time Pulse Timedata
const UBX_TIM_VRFY: u8 = 0x06; //Sourced Time Verification
// Class: ACK
const UBX_ACK_NACK: u8 = 0x00;
const UBX_ACK_ACK: u8 = 0x01;
const UBX_ACK_NONE: u8 = 0x02; //Not a real value
const UBX_Packet_Validity = extern enum {
NOT_VALID,
VALID,
NOT_DEFINED,
NOT_ACKNOWLEDGED, // This indicates that we received a NACK
};
const UBX_Status = extern enum {
SUCCESS,
FAIL,
CRC_FAIL,
TIMEOUT,
COMMAND_NACK, // Indicates that the command was unrecognised, invalid or that the module is too busy to respond
OUT_OF_RANGE,
INVALID_ARG,
INVALID_OPERATION,
MEM_ERR,
HW_ERR,
DATA_SENT, // This indicates that a 'set' was successful
DATA_RECEIVED, // This indicates that a 'get' (poll) was successful
I2C_COMM_FAILURE,
DATA_OVERWRITTEN, // This is an error - the data was valid but has been or _is being_ overwritten by another packet
};
const SentenceTypes = extern enum { NONE, NMEA, UBX, RTCM };
const PacketBuffer = extern enum { NONE, CFG, ACK, BUF, AUTO };
const ubxPacket = extern struct {
cls: u8 = 0,
id: u8 = 0,
len: u16 = 0, // Length of the payload. Does not include cls, id, or checksum bytes
counter: u16 = 0, // Keeps track of number of overall bytes received. Some responses are larger than 255 bytes.
starting_spot: u16 = 0, // The counter value needed to go past before we begin recording into payload array
payload: [MAX_PAYLOAD_SIZE]u8 = [_]u8{0} ** MAX_PAYLOAD_SIZE,
checksum_a: u8 = 0, // Given to us from module. Checked against the rolling calculated A/B checksums.
checksum_b: u8 = 0,
valid: UBX_Packet_Validity = UBX_Packet_Validity.NOT_DEFINED, //Goes from NOT_DEFINED to VALID or NOT_VALID when checksum is checked
class_id_match: UBX_Packet_Validity = UBX_Packet_Validity.NOT_DEFINED, // Goes from NOT_DEFINED to VALID or NOT_VALID when the Class and ID match the requestedClass and requestedID
};
const TimeData = struct {
epoch: u32,
year: u16,
month: u8,
day: u8,
hour: u8,
minute: u8,
second: u8,
nanosecond: i32,
valid: u8,
accuracy: u32,
};
const PositionData = struct {
longitude: i32,
latitude: i32,
height_ellipsoid: i32,
height_sea_level: i32,
geometric_dilution: u16,
heading: i32,
heading_accuracy: u32,
// declination: i16,
// declination_accuracy: u16,
};
const VelocityData = struct {
north: i32,
east: i32,
down: i32,
speed: i32,
speed_accuracy: u32,
};
const UBX_NAV_PVT_data = struct {
received_at: i64,
time: TimeData,
position: PositionData,
velocity: VelocityData,
satellite_count: u8,
fix_type: u8,
flags1: u8,
flags2: u8,
flags3: u8,
};
pub const NAV_PVT = struct {
age: i64,
timestamp: [24]u8,
time: TimeData,
longitude: f64,
latitude: f64,
height: f32,
heading: f32,
speed: f32,
velocity: [3]f32,
satellite_count: u8,
fix_type: u8,
flags: [3]u8,
};
pub fn init(handle: spi.SPI) GNSS {
// var payload_ack = [_]u8{0} ** 2;
// var payload_buf = [_]u8{0} ** 2;
// var payload_cfg = [_]u8{0} ** MAX_PAYLOAD_SIZE;
// var payload_auto = [_]u8{0} ** MAX_PAYLOAD_SIZE;
return GNSS{
.handle = handle,
.write_buffer = [_]u8{0} ** SPI_BUFFER_SIZE,
.read_buffer = [_]u8{0xFF} ** SPI_BUFFER_SIZE,
// .payload_ack = &payload_ack,
// .payload_buf = &payload_buf,
// .payload_auto = &payload_auto,
// .payload_cfg = &payload_cfg,
// .packet_ack = ubxPacket{ .payload = &payload_ack },
// .packet_buf = ubxPacket{ .payload = &payload_buf },
// .packet_cfg = ubxPacket{ .payload = &payload_cfg },
// .packet_auto = ubxPacket{ .payload = &payload_auto },
.packet_ack = ubxPacket{},
.packet_buf = ubxPacket{},
.packet_cfg = ubxPacket{},
.packet_auto = ubxPacket{},
};
}
fn calc_checksum(msg: *ubxPacket) void {
msg.checksum_a = msg.cls;
msg.checksum_b = msg.checksum_a;
msg.checksum_a +%= msg.id;
msg.checksum_b +%= msg.checksum_a;
msg.checksum_a +%= @truncate(u8, msg.len);
msg.checksum_b +%= msg.checksum_a;
msg.checksum_a +%= @truncate(u8, msg.len >> 8);
msg.checksum_b +%= msg.checksum_a;
var idx: u8 = 0;
while (idx < msg.len) {
msg.checksum_a +%= msg.payload[idx];
msg.checksum_b +%= msg.checksum_a;
idx += 1;
}
}
fn get_payload_size_nav(id: u8) u16 {
return switch (id) {
UBX_NAV_POSECEF => 20,
UBX_NAV_STATUS => 16,
UBX_NAV_DOP => 18,
UBX_NAV_ATT => 32,
UBX_NAV_PVT => 92,
UBX_NAV_ODO => 20,
UBX_NAV_VELECEF => 20,
UBX_NAV_VELNED => 20,
UBX_NAV_HPPOSECEF => 28,
UBX_NAV_HPPOSLLH => 36,
UBX_NAV_CLOCK => 20,
UBX_NAV_TIMELS => 24,
UBX_NAV_SVIN => 40,
UBX_NAV_RELPOSNED => 64,
else => 0,
};
}
fn get_payload_size_rxm(id: u8) u16 {
return switch (id) {
UBX_RXM_SFRBX => 8 + (4 * 16),
UBX_RXM_RAWX => 16 + (32 * 64),
else => 0,
};
}
fn get_payload_size_cfg(id: u8) u16 {
return switch (id) {
UBX_CFG_RATE => 6,
else => 0,
};
}
fn get_payload_size_tim(id: u8) u16 {
return switch (id) {
UBX_TIM_TM2 => 28,
else => 0,
};
}
const DEF_NUM_SENS = 7;
fn get_payload_size_esf(id: u8) u16 {
return switch (id) {
UBX_ESF_ALG => 16,
UBX_ESF_INS => 36,
UBX_ESF_MEAS => 8 + (4 * DEF_NUM_SENS) + 4,
UBX_ESF_RAW => 4 + (8 * DEF_NUM_SENS),
UBX_ESF_STATUS => 16 + (4 + DEF_NUM_SENS),
else => 0,
};
}
fn get_payload_size_hnr(id: u8) u16 {
return switch (id) {
UBX_HNR_PVT => 72,
UBX_HNR_ATT => 32,
UBX_HNR_INS => 36,
else => 0,
};
}
fn get_payload_size(class: u8, id: u8) u16 {
const size: u16 = switch (class) {
UBX_CLASS_NAV => get_payload_size_nav(id),
UBX_CLASS_RXM => get_payload_size_rxm(id),
UBX_CLASS_CFG => get_payload_size_cfg(id),
UBX_CLASS_TIM => get_payload_size_tim(id),
UBX_CLASS_ESF => get_payload_size_esf(id),
UBX_CLASS_HNR => get_payload_size_hnr(id),
else => 0,
};
return size;
}
fn extract(msg: *ubxPacket, comptime T: type, idx: u8) T {
// return @intCast(u16, msg.payload[idx]) + @intCast(u16, msg.payload[idx + 1] << 8);
return mem.readIntSliceLittle(T, msg.payload[idx .. idx + @divExact(@typeInfo(T).Int.bits, 8)]);
}
fn print_packet(msg: *ubxPacket) void {
print("Packet(cls: {X} id: {X} counter: {} len: {} checksum: ({X} {X}) ", .{ msg.cls, msg.id, msg.counter, msg.len, msg.checksum_a, msg.checksum_b });
print("payload:(", .{});
for (msg.payload[0..msg.len]) |value| {
print("{X} ", .{value});
}
print(") )\n", .{});
}
pub const GNSS = struct {
handle: spi.SPI,
write_buffer: [SPI_BUFFER_SIZE]u8,
read_buffer: [SPI_BUFFER_SIZE]u8,
read_buffer_index: u16 = 0,
message_type: SentenceTypes = SentenceTypes.NONE,
active_buffer: PacketBuffer = PacketBuffer.NONE,
frame_counter: u16 = 0,
cur_checksum_a: u8 = 0,
cur_checksum_b: u8 = 0,
ignore_payload: bool = false,
// payload_ack: [*]u8,
// payload_buf: [*]u8,
// payload_cfg: [*]u8,
// payload_auto: [*]u8,
packet_ack: ubxPacket,
packet_buf: ubxPacket,
packet_cfg: ubxPacket,
packet_auto: ubxPacket,
max_wait: u16 = MAX_WAIT,
cur_wait: u16 = MAX_WAIT,
_last_nav_pvt: ?UBX_NAV_PVT_data = null,
fn send_command(self: *GNSS, packet: *ubxPacket) UBX_Status {
calc_checksum(packet);
self.send_spi_command(packet);
// Only CFG commands have ACKS
if (packet.cls == UBX_CLASS_CFG) {
return self.wait_for_ack(packet, packet.cls, packet.id);
} else {
return self.wait_for_no_ack(packet, packet.cls, packet.id);
}
}
fn send_command_nowait(self: *GNSS, packet: *ubxPacket) UBX_Status {
calc_checksum(packet);
self.send_spi_command(packet);
return UBX_Status.SUCCESS;
}
fn wait_for_no_ack(self: *GNSS, packet: *ubxPacket, requested_class: u8, requested_id: u8) UBX_Status {
// This will go VALID (or NOT_VALID) when we receive a response to the packet we sent
packet.valid = UBX_Packet_Validity.NOT_DEFINED;
self.packet_ack.valid = UBX_Packet_Validity.NOT_DEFINED;
self.packet_buf.valid = UBX_Packet_Validity.NOT_DEFINED;
self.packet_auto.valid = UBX_Packet_Validity.NOT_DEFINED;
// This will go VALID (or NOT_VALID) when we receive a packet that matches the requested class and ID
packet.class_id_match = UBX_Packet_Validity.NOT_DEFINED;
self.packet_ack.class_id_match = UBX_Packet_Validity.NOT_DEFINED;
self.packet_buf.class_id_match = UBX_Packet_Validity.NOT_DEFINED;
self.packet_auto.class_id_match = UBX_Packet_Validity.NOT_DEFINED;
const start_time = std.time.milliTimestamp();
while (std.time.milliTimestamp() - start_time < self.cur_wait) {
// See if new data is available. Process bytes as they come in.
if (self.check_for_data(packet, requested_class, requested_id)) {
// If outgoingUBX->classAndIDmatch is VALID
// and outgoingUBX->valid is _still_ VALID and the class and ID _still_ match
// then we can be confident that the data in outgoingUBX is valid
if ((packet.class_id_match == UBX_Packet_Validity.VALID) and
(packet.valid == UBX_Packet_Validity.VALID) and
(packet.cls == requested_class) and
(packet.id == requested_id))
{
self.cur_wait = self.max_wait;
// We received valid data!
return UBX_Status.DATA_RECEIVED;
}
}
// If the outgoingUBX->classAndIDmatch is VALID
// but the outgoingUBX->cls or ID no longer match then we can be confident that we had
// valid data but it has been or is currently being overwritten by another packet (e.g. PVT).
// If (e.g.) a PVT packet is _being_ received: outgoingUBX->valid will be NOT_DEFINED
// If (e.g.) a PVT packet _has been_ received: outgoingUBX->valid will be VALID (or just possibly NOT_VALID)
// So we cannot use outgoingUBX->valid as part of this check.
// Note: the addition of packetBuf should make this check redundant!
else if ((packet.class_id_match == UBX_Packet_Validity.VALID) and
((packet.cls != requested_class) or (packet.id != requested_id)))
{
self.cur_wait = self.max_wait;
// Data was valid but has been or is being overwritten
return UBX_Status.DATA_OVERWRITTEN;
}
// If outgoingUBX->classAndIDmatch is NOT_DEFINED
// and outgoingUBX->valid is VALID then this must be (e.g.) a PVT packet
else if ((packet.class_id_match == UBX_Packet_Validity.NOT_DEFINED) and
(packet.valid == UBX_Packet_Validity.VALID))
{
self.cur_wait = self.max_wait;
print("wait_for_no_ack : valid but unwanted data\n", .{});
}
// If the outgoingUBX->classAndIDmatch is NOT_VALID then we return CRC failure
else if (packet.class_id_match == UBX_Packet_Validity.NOT_VALID) {
self.cur_wait = self.max_wait;
return UBX_Status.CRC_FAIL;
}
std.time.sleep(SLEEP);
}
self.cur_wait = self.max_wait;
print("TIMEOUT\n", .{});
// Wait has timed out
return UBX_Status.TIMEOUT;
}
fn wait_for_ack(self: *GNSS, packet: *ubxPacket, requested_class: u8, requested_id: u8) UBX_Status {
// This will go VALID (or NOT_VALID) when we receive a response to the packet we sent
packet.valid = UBX_Packet_Validity.NOT_DEFINED;
self.packet_ack.valid = UBX_Packet_Validity.NOT_DEFINED;
self.packet_buf.valid = UBX_Packet_Validity.NOT_DEFINED;
self.packet_auto.valid = UBX_Packet_Validity.NOT_DEFINED;
// This will go VALID (or NOT_VALID) when we receive a packet that matches the requested class and ID
packet.class_id_match = UBX_Packet_Validity.NOT_DEFINED;
self.packet_ack.class_id_match = UBX_Packet_Validity.NOT_DEFINED;
self.packet_buf.class_id_match = UBX_Packet_Validity.NOT_DEFINED;
self.packet_auto.class_id_match = UBX_Packet_Validity.NOT_DEFINED;
const start_time = std.time.milliTimestamp();
while (std.time.milliTimestamp() - start_time < self.cur_wait) {
// print("WAIT {} from {}\n", .{ std.time.milliTimestamp() - start_time, start_time });
// See if new data is available. Process bytes as they come in.
if (self.check_for_data(packet, requested_class, requested_id)) {
// If both the packet.class_id_match and packet_ack.class_id_match are VALID
// and packet.valid is _still_ VALID and the class and ID _still_ match
// then we can be confident that the data in outgoing packet is valid
if ((packet.class_id_match == UBX_Packet_Validity.VALID) and
(self.packet_ack.class_id_match == UBX_Packet_Validity.VALID) and
(packet.valid == UBX_Packet_Validity.VALID) and
(packet.cls == requested_class) and
(packet.id == requested_id))
{
self.cur_wait = self.max_wait;
// We received valid data and a correct ACK!
return UBX_Status.DATA_RECEIVED;
}
// We can be confident that the data packet (if we are going to get one) will always arrive
// before the matching ACK. So if we sent a config packet which only produces an ACK
// then packet.class_id_match will be NOT_DEFINED and the packet_ack.class_id_match will VALID.
// We should not check packet.valid, packet.cls or packet.id
// as these may have been changed by an automatic packet.
else if ((packet.class_id_match == UBX_Packet_Validity.NOT_DEFINED) and
(self.packet_ack.class_id_match == UBX_Packet_Validity.VALID))
{
self.cur_wait = self.max_wait;
// We got an ACK but no data...
return UBX_Status.DATA_SENT;
}
// If both the packet.class_id_match and self.packet_ack.class_id_match are VALID
// but the packet.cls or ID no longer match then we can be confident that we had
// valid data but it has been or is currently being overwritten by an automatic packet (e.g. PVT).
// If (e.g.) a PVT packet is _being_ received: packet.valid will be NOT_DEFINED
// If (e.g.) a PVT packet _has been_ received: packet.valid will be VALID (or just possibly NOT_VALID)
// So we cannot use packet.valid as part of this check.
// Note: the addition of packetBuf should make this check redundant!
else if ((packet.class_id_match == UBX_Packet_Validity.VALID) and
(self.packet_ack.class_id_match == UBX_Packet_Validity.VALID) and
((packet.cls != requested_class) or (packet.id != requested_id)))
{
self.cur_wait = self.max_wait;
// Data was valid but has been or is being overwritten
return UBX_Status.DATA_OVERWRITTEN;
}
// If self.packet_ack.class_id_match is VALID but both packet.valid and packet.class_id_match
// are NOT_VALID then we can be confident we have had a checksum failure on the data packet
else if ((self.packet_ack.class_id_match == UBX_Packet_Validity.VALID) and
(packet.class_id_match == UBX_Packet_Validity.NOT_VALID) and
(packet.valid == UBX_Packet_Validity.NOT_VALID))
{
self.cur_wait = self.max_wait;
// Checksum fail
return UBX_Status.CRC_FAIL;
}
// If our packet was not-acknowledged (NACK) we do not receive a data packet - we only get the NACK.
// So you would expect packet.valid and packet.class_id_match to still be NOT_DEFINED
// But if a full PVT packet arrives afterwards packet.valid could be VALID (or just possibly NOT_VALID)
// but packet.cls and packet.id would not match...
// So I think this is telling us we need a special state for self.packet_ack.class_id_match to tell us
// the packet was definitely NACK'd otherwise we are possibly just guessing...
// Note: the addition of packetBuf changes the logic of this, but we'll leave the code as is for now.
else if (self.packet_ack.class_id_match == UBX_Packet_Validity.NOT_ACKNOWLEDGED) {
self.cur_wait = self.max_wait;
// We received a NACK!
return UBX_Status.COMMAND_NACK;
}
// If the packet.class_id_match is VALID but the packetAck.class_id_match is NOT_VALID
// then the ack probably had a checksum error. We will take a gamble and return DATA_RECEIVED.
// If we were playing safe, we should return FAIL instead
else if ((packet.class_id_match == UBX_Packet_Validity.VALID) and
(self.packet_ack.class_id_match == UBX_Packet_Validity.NOT_VALID) and
(packet.valid == UBX_Packet_Validity.VALID) and
(packet.cls == requested_class) and
(packet.id == requested_id))
{
self.cur_wait = self.max_wait;
// We received valid data and an invalid ACK!
return UBX_Status.DATA_RECEIVED;
}
// If the packet.class_id_match is NOT_VALID and the self.packet_ack.class_id_match is NOT_VALID
// then we return a FAIL. This must be a double checksum failure?
else if ((packet.class_id_match == UBX_Packet_Validity.NOT_VALID) and
(self.packet_ack.class_id_match == UBX_Packet_Validity.NOT_VALID))
{
self.cur_wait = self.max_wait;
// We received invalid data and an invalid ACK!
return UBX_Status.FAIL;
}
// If the packet.class_id_match is VALID and the self.packet_ack.class_id_match is NOT_DEFINED
// then the ACK has not yet been received and we should keep waiting for it
}
std.time.sleep(SLEEP);
}
self.cur_wait = self.max_wait;
print("TIMEOUT\n", .{});
// Wait has timed out
return UBX_Status.TIMEOUT;
}
fn check_for_data(self: *GNSS, packet: *ubxPacket, requested_class: u8, requested_id: u8) bool {
// Process the contents of the SPI buffer if not empty
var idx: u8 = 0;
while (idx < self.read_buffer_index) {
// print("check_for_data : read_buffer {} {} {any}\n", .{ idx, self.read_buffer_index, self.read_buffer });
self.process_byte(self.read_buffer[idx], packet, requested_class, requested_id);
idx += 1;
}
self.read_buffer_index = 0;
while (true) {
if (self.handle.read_byte()) |value| {
if (value == 0xFF and self.message_type == SentenceTypes.NONE) {
// print("check_for_data : read_byte got EOM\n", .{});
break;
}
// print("check_for_data : read_byte got 0x{X}\n", .{value});
self.process_byte(value, packet, requested_class, requested_id);
} else {
// print("check_for_data : read_byte failed\n", .{});
break;
}
}
return true;
}
fn process_byte(self: *GNSS, incoming: u8, packet: *ubxPacket, requested_class: u8, requested_id: u8) void {
if (self.message_type == SentenceTypes.NONE or self.message_type == SentenceTypes.NMEA) {
if (incoming == UBX_SYNCH_1) {
self.message_type = SentenceTypes.UBX;
self.frame_counter = 0;
self.packet_buf.counter = 0;
self.ignore_payload = false;
self.active_buffer = PacketBuffer.BUF;
} else if (incoming == '$') {
print("Start of NMEA packet\n", .{});
self.message_type = SentenceTypes.NMEA;
self.frame_counter = 0;
} else if (incoming == 0xD3) {
print("Start of RTCM packet\n", .{});
self.message_type = SentenceTypes.RTCM;
self.frame_counter = 0;
}
}
if (self.message_type == SentenceTypes.UBX) {
if (self.frame_counter == 0 and incoming != UBX_SYNCH_1) {
// Something went wrong, reset
self.message_type = SentenceTypes.NONE;
} else if (self.frame_counter == 1 and incoming != UBX_SYNCH_2) {
// Something went wrong, reset
self.message_type = SentenceTypes.NONE;
} else if (self.frame_counter == 2) {
// Class
self.packet_buf.cls = incoming;
self.packet_buf.counter = 0;
self.packet_buf.valid = UBX_Packet_Validity.NOT_DEFINED;
self.packet_buf.starting_spot = packet.starting_spot;
self.cur_checksum_a = 0;
self.cur_checksum_b = 0;
} else if (self.frame_counter == 3) {
// ID
self.packet_buf.id = incoming;
// We can now identify the type of response
// If the packet we are receiving is not an ACK then check for a class and ID match
if (self.packet_buf.cls != UBX_CLASS_ACK) {
// This is not an ACK so check for a class and ID match
if ((self.packet_buf.cls == requested_class) and (self.packet_buf.id == requested_id)) {
// This is not an ACK and we have a class and ID match
// So start diverting data into incomingUBX (usually packetCfg)
self.active_buffer = PacketBuffer.CFG;
self.packet_cfg.cls = self.packet_buf.cls;
self.packet_cfg.id = self.packet_buf.id;
self.packet_cfg.counter = self.packet_buf.counter;
self.packet_cfg.checksum_a = 0;
self.packet_cfg.checksum_b = 0;
var idx: u16 = 0;
while (idx < MAX_PAYLOAD_SIZE) {
self.packet_cfg.payload[idx] = 0;
idx += 1;
}
}
// This is not an ACK and we do not have a complete class and ID match
// So let's check if this is an "automatic" message which has its own storage defined
else if (self.check_automatic(self.packet_buf.cls, self.packet_buf.id)) {
// This is not the message we were expecting but it has its own storage and so we should process it anyway.
// We'll try to use packetAuto to buffer the message (so it can't overwrite anything in packetCfg).
// We need to allocate memory for the packetAuto payload (payloadAuto) - and delete it once
// reception is complete.
} else {
// This is not an ACK and we do not have a class and ID match
// so we should keep diverting data into packetBuf and ignore the payload
self.ignore_payload = true;
}
} else {
// This is an ACK so it is to early to do anything with it
// We need to wait until we have received the length and data bytes
// So we should keep diverting data into packetBuf
}
} else if (self.frame_counter == 4) {
// Length LSB
self.packet_buf.len = incoming;
} else if (self.frame_counter == 5) {
self.packet_buf.len += (@intCast(u16, incoming) << 8);
} else if (self.frame_counter == 6) {
// This should be the first byte of the payload unless .len is zero
if (self.packet_buf.len == 0) {
// If length is zero (!) this will be the first byte of the checksum so record it
self.packet_buf.checksum_a = incoming;
} else {
// The length is not zero so record this byte in the payload
self.packet_buf.payload[0] = incoming;
}
} else if (self.frame_counter == 7) {
// This should be the second byte of the payload unless .len is zero or one
if (self.packet_buf.len == 0) {
// If length is zero (!) this will be the second byte of the checksum so record it
self.packet_buf.checksum_b = incoming;
} else if (self.packet_buf.len == 1) {
// The length is one so this is the first byte of the checksum
self.packet_buf.checksum_a = incoming;
} else {
// Length is >= 2 so this must be a payload byte
self.packet_buf.payload[1] = incoming;
}
// Now that we have received two payload bytes, we can check for a matching ACK/NACK
if ((self.active_buffer == PacketBuffer.BUF) // If we are not already processing a data packet
and (self.packet_buf.cls == UBX_CLASS_ACK) // and if this is an ACK/NACK
and (self.packet_buf.payload[0] == requested_class) // and if the class matches
and (self.packet_buf.payload[1] == requested_id)) // and if the ID matches
{
if (self.packet_buf.len == 2) {
// Then this is a matching ACK so copy it into packetAck
self.active_buffer = PacketBuffer.ACK;
self.packet_ack.cls = self.packet_buf.cls;
self.packet_ack.id = self.packet_buf.id;
self.packet_ack.len = self.packet_buf.len;
self.packet_ack.counter = self.packet_buf.counter;
self.packet_ack.payload[0] = self.packet_buf.payload[0];
self.packet_ack.payload[1] = self.packet_buf.payload[1];
} else {
print("process: ACK received with .len != 2 | Class {} ID {} len {}\n", .{ self.packet_buf.payload[0], self.packet_buf.payload[1], self.packet_buf.len });
}
}
}
if (self.active_buffer == PacketBuffer.ACK) {
self.process_ubx_byte(incoming, &self.packet_ack, requested_class, requested_id, "ACK");
} else if (self.active_buffer == PacketBuffer.CFG) {
self.process_ubx_byte(incoming, packet, requested_class, requested_id, "INC");
} else if (self.active_buffer == PacketBuffer.BUF) {
self.process_ubx_byte(incoming, &self.packet_buf, requested_class, requested_id, "BUF");
} else if (self.active_buffer == PacketBuffer.AUTO) {
self.process_ubx_byte(incoming, &self.packet_auto, requested_class, requested_id, "AUTO");
} else {
print("process: Active buffer is NONE, cannot continue\n", .{});
}
self.frame_counter += 1;
}
// else if (self.message_type == SentenceTypes.NMEA) {
// print("process: Got NMEA message\n", .{});
// } else if (self.message_type == SentenceTypes.RTCM) {
// print("process: Got RTCM message\n", .{});
// self.message_type = SentenceTypes.NONE;
// }
}
// Given a character, file it away into the uxb packet structure
// Set valid to VALID or NOT_VALID once sentence is completely received and passes or fails CRC
fn process_ubx_byte(self: *GNSS, incoming: u8, packet: *ubxPacket, requested_class: u8, requested_id: u8, label: []const u8) void {
var max_payload_size: u16 = 0;
if (self.active_buffer == PacketBuffer.CFG) {
max_payload_size = MAX_PAYLOAD_SIZE;
} else if (self.active_buffer == PacketBuffer.AUTO) {
max_payload_size = get_payload_size(packet.cls, packet.id);
} else {
max_payload_size = 2;
}
var overrun: bool = false;
if (packet.counter < packet.len + 4) {
self.add_to_checksum(incoming);
}
if (packet.counter == 0) {
packet.cls = incoming;
} else if (packet.counter == 1) {
packet.id = incoming;
} else if (packet.counter == 2) {
packet.len = incoming;
} else if (packet.counter == 3) {
packet.len += (@intCast(u16, incoming) << 8);
} else if (packet.counter == packet.len + 4) {
packet.checksum_a = incoming;
} else if (packet.counter == packet.len + 5) {
packet.checksum_b = incoming;
self.message_type = SentenceTypes.NONE;
if ((packet.checksum_a == self.cur_checksum_a) and (packet.checksum_b == self.cur_checksum_b)) {
// Flag the packet as valid
packet.valid = UBX_Packet_Validity.VALID;
// Let's check if the class and ID match the requestedClass and requestedID
// Remember - this could be a data packet or an ACK packet
if ((packet.cls == requested_class) and (packet.id == requested_id)) {
packet.class_id_match = UBX_Packet_Validity.VALID;
}
// If this is an ACK then let's check if the class and ID match the requestedClass and requestedID
else if ((packet.cls == UBX_CLASS_ACK) and (packet.id == UBX_ACK_ACK) and (packet.payload[0] == requested_class) and (packet.payload[1] == requested_id)) {
packet.class_id_match = UBX_Packet_Validity.VALID;
print("gnss process_ubx : ACK | Class {} ID {}\n", .{ packet.payload[0], packet.payload[1] });
}
// If this is an NACK then let's check if the class and ID match the requestedClass and requestedID
else if ((packet.cls == UBX_CLASS_ACK) and (packet.id == UBX_ACK_NACK) and (packet.payload[0] == requested_class) and (packet.payload[1] == requested_id)) {
packet.class_id_match = UBX_Packet_Validity.NOT_ACKNOWLEDGED;
print("gnss process_ubx : NACK | Class {} ID {}\n", .{ packet.payload[0], packet.payload[1] });
}
// This is not an ACK and we do not have a complete class and ID match
// So let's check for an "automatic" message arriving
else if (self.check_automatic(packet.cls, packet.id)) {
// This isn't the message we are looking for...
print("gnss process_ubx : automatic | Class {} ID {}\n", .{ packet.cls, packet.id });
}
if (self.ignore_payload == false) {
// We've got a valid packet, now do something with it but only if ignoreThisPayload is false
self.process_packet(packet);
}
} else {
// Checksum failure
packet.valid = UBX_Packet_Validity.NOT_VALID;
packet.class_id_match = UBX_Packet_Validity.NOT_VALID;
print("gnss process_ubx : checksum failed | {} {} vs {} {}\n", .{ packet.checksum_a, packet.checksum_b, self.cur_checksum_a, self.cur_checksum_b });
}
} else {
// Load this byte into the payload array
var starting_spot: u16 = packet.starting_spot;
// If an automatic packet comes in asynchronously, we need to fudge the startingSpot
if (self.check_automatic(packet.cls, packet.id)) {
starting_spot = 0;
}
// Check if this is payload data which should be ignored
if (self.ignore_payload == false) {
if ((packet.counter - 4) >= starting_spot) {
if ((packet.counter - 4 - starting_spot) < max_payload_size) {
packet.payload[packet.counter - 4 - starting_spot] = incoming;
// print("payload[{}] = {X} {X}\n", .{ packet.counter - 4 - starting_spot, incoming, packet.payload[packet.counter - 4 - starting_spot] });
} else {
overrun = true;
}
}
}
}
if (overrun or (packet.counter == max_payload_size + 6) and self.ignore_payload == false) {
self.message_type = SentenceTypes.NONE;
print("gnss process_ubx : overrun | buffer {} size {}\n", .{ self.active_buffer, max_payload_size });
}
// if (incoming < 16) {
// print("0{X} -> {} {s} {}\n", .{ incoming, self.active_buffer, label, packet.valid });
// } else {
// print("{X} -> {} {s} {}\n", .{ incoming, self.active_buffer, label, packet.valid });
// }
// print_packet(packet);
// print("\n", .{});
packet.counter += 1;
}
fn process_packet(self: *GNSS, packet: *ubxPacket) void {
switch (packet.cls) {
UBX_CLASS_ACK => return,
UBX_CLASS_NAV => self.process_nav_packet(packet),
// UBX_CLASS_RXM => self.process_rxm_packet(packet),
UBX_CLASS_CFG => self.process_cfg_packet(packet),
// UBX_CLASS_TIM => self.process_tim_packet(packet),
// UBX_CLASS_ESF => self.process_esf_packet(packet),
// UBX_CLASS_HNR => self.process_hnr_packet(packet),
else => print("gnss process_packet : unknown class {}\n", .{packet.cls}),
}
}
fn process_nav_packet(self: *GNSS, packet: *ubxPacket) void {
switch (packet.id) {
UBX_NAV_PVT => {
if (packet.len == get_payload_size(packet.cls, packet.id)) {
const pvt = UBX_NAV_PVT_data{
.received_at = std.time.milliTimestamp(),
.time = TimeData{
.epoch = extract(packet, u32, 0),
.year = extract(packet, u16, 4),
.month = extract(packet, u8, 6),
.day = extract(packet, u8, 7),
.hour = extract(packet, u8, 8),
.minute = extract(packet, u8, 9),
.second = extract(packet, u8, 10),
.valid = extract(packet, u8, 11),
.accuracy = extract(packet, u32, 12),
.nanosecond = extract(packet, i32, 16),
},
.position = PositionData{
.longitude = extract(packet, i32, 24),
.latitude = extract(packet, i32, 28),
.height_ellipsoid = extract(packet, i32, 32),
.height_sea_level = extract(packet, i32, 36),
.geometric_dilution = extract(packet, u16, 76),
.heading = extract(packet, i32, 64),
.heading_accuracy = extract(packet, u32, 72),
// .declination = extract(packet, i16, 88),
// .declination_accuracy = extract(packet, u16, 90),
},
.velocity = VelocityData{
.north = extract(packet, i32, 48),
.east = extract(packet, i32, 52),
.down = extract(packet, i32, 56),
.speed = extract(packet, i32, 60),
.speed_accuracy = extract(packet, u32, 68),
},
.satellite_count = extract(packet, u8, 23),
.fix_type = extract(packet, u8, 20),
.flags1 = extract(packet, u8, 21),
.flags2 = extract(packet, u8, 22),
.flags3 = extract(packet, u8, 78),
};
self._last_nav_pvt = pvt;
// print("nav_packet TIME {any}\n", .{pvt.time});
// print(" POS {any}\n", .{pvt.position});
// print(" VEL {any}\n", .{pvt.velocity});
// print(" SAT {} FIX {}\n", .{ pvt.satellite_count, pvt.fix_type });
// print(" FLAG {} {} {}\n", .{ pvt.flags1, pvt.flags2, pvt.flags3 });
} else {
print("gnss nav_packet : incorrect length for PVT : {}\n", .{packet.len});
}
},
else => print("gnss process_nav_packet : unknown id {}\n", .{packet.id}),
}
}
fn process_cfg_packet(self: *GNSS, packet: *ubxPacket) void {
if (packet.id == UBX_CFG_RATE and packet.len == 6) {
const measure_rate = extract(packet, u16, 0);
const nav_rate = extract(packet, u16, 2);
const time_ref = extract(packet, u16, 4);
print("gnss cfg_packet : measure rate {} nav rate {} time ref {}\n", .{ measure_rate, nav_rate, time_ref });
}
}
fn send_spi_command(self: *GNSS, packet: *ubxPacket) void {
self.write_buffer[0] = UBX_SYNCH_1;
self.write_buffer[1] = UBX_SYNCH_2;
self.write_buffer[2] = packet.cls;
self.write_buffer[3] = packet.id;
self.write_buffer[4] = @truncate(u8, packet.len);
self.write_buffer[5] = @truncate(u8, packet.len >> 8);
mem.copy(u8, self.write_buffer[6 .. 6 + packet.len], packet.payload[0..packet.len]);
self.write_buffer[6 + packet.len] = packet.checksum_a;
self.write_buffer[7 + packet.len] = packet.checksum_b;
var rv = self.handle.transfer(&self.write_buffer, &self.read_buffer, packet.len + 8);
self.read_buffer_index += packet.len + 8;
// print("send_spi_command pkt : {any}\n", .{self.write_buffer[0 .. 8 + packet.len]});
// print(" rv : {}\n", .{rv});
}
fn add_to_checksum(self: *GNSS, incoming: u8) void {
self.cur_checksum_a +%= incoming;
self.cur_checksum_b +%= self.cur_checksum_a;
}
fn check_automatic(self: *GNSS, requested_class: u8, requested_id: u8) bool {
// TODO : implement this
return false;
}
fn do_is_connected(self: *GNSS) bool {
self.packet_cfg.cls = UBX_CLASS_CFG;
self.packet_cfg.id = UBX_CFG_RATE;
self.packet_cfg.len = 0;
self.packet_cfg.starting_spot = 0;
const value = self.send_command(&self.packet_cfg);
if (value == UBX_Status.DATA_RECEIVED) {
return true;
}
if (value == UBX_Status.DATA_RECEIVED) {
return true;
}
return false;
}
pub fn is_connected(self: *GNSS) bool {
var connected = self.do_is_connected();
if (!connected) {
connected = self.do_is_connected();
}
if (!connected) {
connected = self.do_is_connected();
}
return connected;
}
pub fn set_auto_pvt_rate(self: *GNSS, rate: u8) void {
if (rate > 127) {
rate = 127;
}
self.packet_cfg.cls = UBX_CLASS_CFG;
self.packet_cfg.id = UBX_CFG_MSG;
self.packet_cfg.len = 3;
self.packet_cfg.startingSpot = 0;
self.packet_cfg.payload[0] = UBX_CLASS_NAV;
self.packet_cfg.payload[1] = UBX_NAV_PVT;
self.packet_cfg.payload[2] = rate; // rate relative to navigation freq.
print("gnss set_auto_pvt_rate({})\n", .{rate});
const value = self.send_command(&self.packet_cfg);
if (value == UBX_Status.DATA_SENT) {
print("gnss ack\n", .{});
}
}
pub fn set_auto_pvt(self: *GNSS, value: bool) void {
if (value) {
self.set_auto_pvt_rate(1);
} else {
self.set_auto_pvt_rate(0);
}
}
pub fn set_next_timeout(self: *GNSS, wait: u16) void {
self.cur_wait = wait;
}
pub fn set_timeout(self: *GNSS, wait: u16) void {
self.max_wait = wait;
}
pub fn get_pvt(self: *GNSS) bool {
self.packet_cfg.cls = UBX_CLASS_NAV;
self.packet_cfg.id = UBX_NAV_PVT;
self.packet_cfg.len = 0;
self.packet_cfg.starting_spot = 0;
// print("get_pvt()\n", .{});
const value = self.send_command(&self.packet_cfg);
// print("get_pvt() -> {}\n", .{value});
return (value == UBX_Status.DATA_RECEIVED);
}
pub fn last_nav_pvt_data(self: *GNSS) ?UBX_NAV_PVT_data {
return self._last_nav_pvt;
}
// TODO : cache creation of the NAV_PVT struct, except for the age field --
// that should always be updated when the method is called
pub fn last_nav_pvt(self: *GNSS) ?NAV_PVT {
if (self.last_nav_pvt_data()) |pvt| {
var timestamp: [24]u8 = undefined;
_ = std.fmt.bufPrint(×tamp, "{d:0>4}-{d:0>2}-{d:0>2}T{d:0>2}:{d:0>2}:{d:0>6.3}Z", .{
pvt.time.year,
pvt.time.month,
pvt.time.day,
pvt.time.hour,
pvt.time.minute,
@intToFloat(f64, pvt.time.second) + @intToFloat(f64, pvt.time.nanosecond) * 1e-9,
}) catch unreachable;
return NAV_PVT{
.age = std.time.milliTimestamp() - pvt.received_at,
.timestamp = timestamp,
.time = pvt.time,
.longitude = @intToFloat(f64, pvt.position.longitude) * 1e-7,
.latitude = @intToFloat(f64, pvt.position.latitude) * 1e-7,
.height = @intToFloat(f32, pvt.position.height_sea_level) * 1e-3,
.heading = @intToFloat(f32, pvt.position.heading) * 1e-5,
.speed = @intToFloat(f32, pvt.velocity.speed) * 1e-3,
.velocity = [3]f32{
@intToFloat(f32, pvt.velocity.north) * 1e-3,
@intToFloat(f32, pvt.velocity.east) * 1e-3,
@intToFloat(f32, pvt.velocity.down) * 1e-3,
},
.satellite_count = pvt.satellite_count,
.flags = [_]u8{ pvt.flags1, pvt.flags2, pvt.flags3 },
.fix_type = pvt.fix_type,
};
}
return null;
}
pub fn configure(self: *GNSS) void {
self.packet_cfg.cls = UBX_CLASS_CFG;
self.packet_cfg.id = UBX_CFG_PRT;
self.packet_cfg.len = 1;
self.packet_cfg.starting_spot = 0;
// Get setting for port 4 (e.g. SPI)
self.packet_cfg.payload[0] = 4;
var value = self.send_command(&self.packet_cfg);
print("gnss configure() -> {}\n", .{value});
self.packet_cfg.len = 20;
// Enable only UBX messages (e.g. bit 1 is set)
self.packet_cfg.payload[14] = 1;
value = self.send_command(&self.packet_cfg);
print("gnss configure() -> {}\n", .{value});
}
pub fn set_rate(self: *GNSS, rate: u16) void {
self.packet_cfg.cls = UBX_CLASS_CFG;
self.packet_cfg.id = UBX_CFG_RATE;
self.packet_cfg.len = 0;
self.packet_cfg.starting_spot = 0;
var value = self.send_command(&self.packet_cfg);
self.packet_cfg.len = 6;
self.packet_cfg.payload[0] = @truncate(u8, rate);
self.packet_cfg.payload[1] = @truncate(u8, rate >> 8);
print("gnss set_rate({})\n", .{rate});
value = self.send_command(&self.packet_cfg);
self.packet_cfg.payload[0] = 0;
self.packet_cfg.payload[1] = 0;
// Do read back
self.packet_cfg.len = 0;
value = self.send_command(&self.packet_cfg);
}
}; | src/gnss.zig |
const libssz = @import("./main.zig");
const serialize = libssz.serialize;
const deserialize = libssz.deserialize;
const chunkCount = libssz.chunkCount;
const hashTreeRoot = libssz.hashTreeRoot;
const std = @import("std");
const ArrayList = std.ArrayList;
const expect = std.testing.expect;
const sha256 = std.crypto.hash.sha2.Sha256;
test "serializes uint8" {
var data: u8 = 0x55;
const serialized_data = [_]u8{0x55};
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize(u8, data, &list);
try expect(std.mem.eql(u8, list.items, serialized_data[0..]));
}
test "serializes uint16" {
var data: u16 = 0x5566;
const serialized_data = [_]u8{ 0x66, 0x55 };
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize(u16, data, &list);
try expect(std.mem.eql(u8, list.items, serialized_data[0..]));
}
test "serializes uint32" {
var data: u32 = 0x55667788;
const serialized_data = [_]u8{ 0x88, 0x77, 0x66, 0x55 };
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize(u32, data, &list);
try expect(std.mem.eql(u8, list.items, serialized_data[0..]));
}
test "serializes a int32" {
var data: i32 = -(0x11223344);
const serialized_data = [_]u8{ 0xbc, 0xcc, 0xdd, 0xee };
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize(i32, data, &list);
try expect(std.mem.eql(u8, list.items, serialized_data[0..]));
}
test "serializes bool" {
var data = false;
var serialized_data = [_]u8{0x00};
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize(bool, data, &list);
try expect(std.mem.eql(u8, list.items, serialized_data[0..]));
data = true;
serialized_data = [_]u8{0x01};
var list2 = ArrayList(u8).init(std.testing.allocator);
defer list2.deinit();
try serialize(bool, data, &list2);
try expect(std.mem.eql(u8, list2.items, serialized_data[0..]));
}
test "serializes Bitvector[N] == [N]bool" {
var data7 = [_]bool{ true, false, true, true, false, false, false };
var serialized_data = [_]u8{0b00001101};
var exp = serialized_data[0..serialized_data.len];
var list7 = ArrayList(u8).init(std.testing.allocator);
defer list7.deinit();
try serialize([7]bool, data7, &list7);
try expect(std.mem.eql(u8, list7.items, exp));
var data8 = [_]bool{ true, false, true, true, false, false, false, true };
serialized_data = [_]u8{0b10001101};
exp = serialized_data[0..serialized_data.len];
var list8 = ArrayList(u8).init(std.testing.allocator);
defer list8.deinit();
try serialize([8]bool, data8, &list8);
try expect(std.mem.eql(u8, list8.items, exp));
var data12 = [_]bool{ true, false, true, true, false, false, false, true, false, true, false, true };
var list12 = ArrayList(u8).init(std.testing.allocator);
defer list12.deinit();
try serialize([12]bool, data12, &list12);
try expect(list12.items.len == 2);
try expect(list12.items[0] == 141);
try expect(list12.items[1] == 10);
}
test "serializes string" {
const data = "zig zag";
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize([]const u8, data, &list);
try expect(std.mem.eql(u8, list.items, data));
}
test "serializes an array of shorts" {
const data = [_]u16{ 0xabcd, 0xef01 };
const serialized = [_]u8{ 0xcd, 0xab, 0x01, 0xef };
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize([]const u16, data[0..data.len], &list);
try expect(std.mem.eql(u8, list.items, serialized[0..]));
}
test "serializes an array of structures" {
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
const exp = [_]u8{ 8, 0, 0, 0, 23, 0, 0, 0, 6, 0, 0, 0, 20, 0, 99, 114, 111, 105, 115, 115, 97, 110, 116, 6, 0, 0, 0, 244, 1, 72, 101, 114, 114, 101, 110, 116, 111, 114, 116, 101 };
try serialize(@TypeOf(pastries), pastries, &list);
try expect(std.mem.eql(u8, list.items, exp[0..]));
}
test "serializes a structure without variable fields" {
var data = .{
.uint8 = @as(u8, 1),
.uint32 = @as(u32, 3),
.boolean = true,
};
const serialized_data = [_]u8{ 1, 3, 0, 0, 0, 1 };
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize(@TypeOf(data), data, &list);
try expect(std.mem.eql(u8, list.items, serialized_data[0..]));
}
test "serializes a structure with variable fields" {
// Taken from ssz.cr
const data = .{
.name = "James",
.age = @as(u8, 32),
.company = "DEV Inc.",
};
const serialized_data = [_]u8{ 9, 0, 0, 0, 32, 14, 0, 0, 0, 74, 97, 109, 101, 115, 68, 69, 86, 32, 73, 110, 99, 46 };
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize(@TypeOf(data), data, &list);
try expect(std.mem.eql(u8, list.items, serialized_data[0..]));
}
test "serializes a structure with optional fields" {
const Employee = struct {
name: ?[]const u8,
age: u8,
company: ?[]const u8,
};
const data: Employee = .{
.name = "James",
.age = @as(u8, 32),
.company = null,
};
const serialized_data = [_]u8{ 9, 0, 0, 0, 32, 14, 0, 0, 0, 74, 97, 109, 101, 115 };
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize(@TypeOf(data), data, &list);
try expect(std.mem.eql(u8, list.items, serialized_data[0..]));
}
test "serializes an optional object" {
const null_or_string: ?[]const u8 = null;
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize(@TypeOf(null_or_string), null_or_string, &list);
try expect(list.items.len == 0);
}
test "serializes a union" {
const Payload = union(enum) {
int: u64,
boolean: bool,
};
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
const exp = [_]u8{ 0, 0, 0, 0, 210, 4, 0, 0, 0, 0, 0, 0 };
try serialize(Payload, Payload{ .int = 1234 }, &list);
try expect(std.mem.eql(u8, list.items, exp[0..]));
var list2 = ArrayList(u8).init(std.testing.allocator);
defer list2.deinit();
const exp2 = [_]u8{ 1, 0, 0, 0, 1 };
try serialize(Payload, Payload{ .boolean = true }, &list2);
try expect(std.mem.eql(u8, list2.items, exp2[0..]));
// Make sure that the code won't try to serialize untagged
// payloads.
const UnTaggedPayload = union {
int: u64,
boolean: bool,
};
var list3 = ArrayList(u8).init(std.testing.allocator);
defer list3.deinit();
if (serialize(UnTaggedPayload, UnTaggedPayload{ .boolean = false }, &list3)) {
@panic("didn't catch error");
} else |err| switch (err) {
error.UnionIsNotTagged => {},
else => @panic("invalid error"),
}
}
test "deserializes an u8" {
const payload = [_]u8{0x55};
var i: u8 = 0;
try deserialize(u8, payload[0..payload.len], &i);
try expect(i == 0x55);
}
test "deserializes an u32" {
const payload = [_]u8{ 0x55, 0x66, 0x77, 0x88 };
var i: u32 = 0;
try deserialize(u32, payload[0..payload.len], &i);
try expect(i == 0x88776655);
}
test "deserializes a boolean" {
const payload_false = [_]u8{0};
var b = true;
try deserialize(bool, payload_false[0..1], &b);
try expect(b == false);
const payload_true = [_]u8{1};
try deserialize(bool, payload_true[0..1], &b);
try expect(b == true);
}
test "deserializes a Bitvector[N]" {
const exp = [_]bool{ true, false, true, true, false, false, false };
var out = [_]bool{ false, false, false, false, false, false, false };
const serialized_data = [_]u8{0b00001101};
try deserialize([7]bool, serialized_data[0..1], &out);
comptime var i = 0;
inline while (i < 7) : (i += 1) {
try expect(out[i] == exp[i]);
}
}
test "deserializes an Optional" {
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
var out: ?u32 = undefined;
const exp: ?u32 = 10;
try serialize(?u32, exp, &list);
try deserialize(?u32, list.items, &out);
try expect(out.? == exp.?);
var list2 = ArrayList(u8).init(std.testing.allocator);
defer list2.deinit();
try serialize(?u32, null, &list2);
try deserialize(?u32, list2.items, &out);
try expect(out == null);
}
test "deserializes a string" {
const exp = "croissants";
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize([]const u8, exp, &list);
var got: []const u8 = undefined;
try deserialize([]const u8, list.items, &got);
try expect(std.mem.eql(u8, exp, got));
}
const Pastry = struct {
name: []const u8,
weight: u16,
};
const pastries = [_]Pastry{
Pastry{
.name = "croissant",
.weight = 20,
},
Pastry{
.name = "Herrentorte",
.weight = 500,
},
};
test "deserializes a structure" {
var out = Pastry{ .name = "", .weight = 0 };
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize(Pastry, pastries[0], &list);
try deserialize(Pastry, list.items, &out);
try expect(pastries[0].weight == out.weight);
try expect(std.mem.eql(u8, pastries[0].name, out.name));
}
test "deserializes a Vector[N]" {
var out: [2]Pastry = undefined;
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize([2]Pastry, pastries, &list);
try deserialize(@TypeOf(pastries), list.items, &out);
comptime var i = 0;
inline while (i < pastries.len) : (i += 1) {
try expect(out[i].weight == pastries[i].weight);
try expect(std.mem.eql(u8, pastries[i].name, out[i].name));
}
}
test "deserializes an invalid Vector[N] payload" {
var out: [2]Pastry = undefined;
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
try serialize([2]Pastry, pastries, &list);
if (deserialize(@TypeOf(pastries), list.items[0 .. list.items.len / 2], &out)) {
@panic("missed error");
} else |err| switch (err) {
error.IndexOutOfBounds => {},
else => {
@panic("unexpected error");
},
}
}
test "deserializes an union" {
const Payload = union {
int: u32,
boolean: bool,
};
var p: Payload = undefined;
try deserialize(Payload, ([_]u8{ 1, 0, 0, 0, 1 })[0..], &p);
try expect(p.boolean == true);
try deserialize(Payload, ([_]u8{ 1, 0, 0, 0, 0 })[0..], &p);
try expect(p.boolean == false);
try deserialize(Payload, ([_]u8{ 0, 0, 0, 0, 1, 2, 3, 4 })[0..], &p);
try expect(p.int == 0x04030201);
}
test "serialize/deserialize a u256" {
var list = ArrayList(u8).init(std.testing.allocator);
defer list.deinit();
const data = [_]u8{0xAA} ** 32;
var output: [32]u8 = undefined;
try serialize([32]u8, data, &list);
try deserialize([32]u8, list.items, &output);
try expect(std.mem.eql(u8, data[0..], output[0..]));
}
test "chunk count of basic types" {
try expect(chunkCount(bool) == 1);
try expect(chunkCount(u8) == 1);
try expect(chunkCount(u16) == 1);
try expect(chunkCount(u32) == 1);
try expect(chunkCount(u64) == 1);
}
test "chunk count of Bitvector[N]" {
try expect(chunkCount([7]bool) == 1);
try expect(chunkCount([12]bool) == 1);
try expect(chunkCount([384]bool) == 2);
}
test "chunk count of Vector[B, N]" {
try expect(chunkCount([17]u32) == 3);
}
test "chunk count of a struct" {
try expect(chunkCount(Pastry) == 2);
}
test "chunk count of a Vector[C, N]" {
try expect(chunkCount([2]Pastry) == 2);
}
// used at comptime to generate a bitvector from a byte vector
fn bytesToBits(comptime N: usize, src: [N]u8) [N * 8]bool {
var bitvector: [N * 8]bool = undefined;
for (src) |byte, idx| {
var i = 0;
while (i < 8) : (i += 1) {
bitvector[i + idx * 8] = ((byte >> (7 - i)) & 1) == 1;
}
}
return bitvector;
}
const a_bytes = [_]u8{0xaa} ** 16;
const b_bytes = [_]u8{0xbb} ** 16;
const c_bytes = [_]u8{0xcc} ** 16;
const d_bytes = [_]u8{0xdd} ** 16;
const e_bytes = [_]u8{0xee} ** 16;
const empty_bytes = [_]u8{0} ** 16;
const a_bits = bytesToBits(16, a_bytes);
const b_bits = bytesToBits(16, b_bytes);
const c_bits = bytesToBits(16, c_bytes);
const d_bits = bytesToBits(16, d_bytes);
const e_bits = bytesToBits(16, e_bytes);
test "calculate the root hash of a boolean" {
var expected = [_]u8{1} ++ [_]u8{0} ** 31;
var hashed: [32]u8 = undefined;
try hashTreeRoot(bool, true, &hashed, std.testing.allocator);
try expect(std.mem.eql(u8, hashed[0..], expected[0..]));
expected = [_]u8{0} ** 32;
try hashTreeRoot(bool, false, &hashed, std.testing.allocator);
try expect(std.mem.eql(u8, hashed[0..], expected[0..]));
}
test "calculate root hash of an array of two Bitvector[128]" {
var deserialized: [2][128]bool = [2][128]bool{ a_bits, b_bits };
var hashed: [32]u8 = undefined;
try hashTreeRoot(@TypeOf(deserialized), deserialized, &hashed, std.testing.allocator);
var expected: [32]u8 = undefined;
const expected_preimage = a_bytes ++ empty_bytes ++ b_bytes ++ empty_bytes;
sha256.hash(expected_preimage[0..], &expected, sha256.Options{});
try expect(std.mem.eql(u8, hashed[0..], expected[0..]));
}
test "calculate the root hash of an array of integers" {
var expected = [_]u8{ 0xef, 0xbe, 0xad, 0xde, 0xfe, 0xca, 0xfe, 0xca } ++ [_]u8{0} ** 24;
var hashed: [32]u8 = undefined;
try hashTreeRoot([2]u32, [_]u32{ 0xdeadbeef, 0xcafecafe }, &hashed, std.testing.allocator);
try expect(std.mem.eql(u8, hashed[0..], expected[0..]));
}
test "calculate root hash of an array of three Bitvector[128]" {
var deserialized: [3][128]bool = [3][128]bool{ a_bits, b_bits, c_bits };
var hashed: [32]u8 = undefined;
try hashTreeRoot(@TypeOf(deserialized), deserialized, &hashed, std.testing.allocator);
var left: [32]u8 = undefined;
var expected: [32]u8 = undefined;
const preimg1 = a_bytes ++ empty_bytes ++ b_bytes ++ empty_bytes;
const preimg2 = c_bytes ++ empty_bytes ** 3;
sha256.hash(preimg1[0..], &left, sha256.Options{});
sha256.hash(preimg2[0..], &expected, sha256.Options{});
var digest = sha256.init(sha256.Options{});
digest.update(left[0..]);
digest.update(expected[0..]);
digest.final(&expected);
try expect(std.mem.eql(u8, hashed[0..], expected[0..]));
}
test "calculate the root hash of an array of five Bitvector[128]" {
var deserialized = [5][128]bool{ a_bits, b_bits, c_bits, d_bits, e_bits };
var hashed: [32]u8 = undefined;
try hashTreeRoot(@TypeOf(deserialized), deserialized, &hashed, std.testing.allocator);
var internal_nodes: [64]u8 = undefined;
var left: [32]u8 = undefined;
var expected: [32]u8 = undefined;
const preimg1 = a_bytes ++ empty_bytes ++ b_bytes ++ empty_bytes;
const preimg2 = c_bytes ++ empty_bytes ++ d_bytes ++ empty_bytes;
const preimg3 = e_bytes ++ empty_bytes ** 3;
const preimg4 = empty_bytes ** 4;
sha256.hash(preimg1[0..], &left, sha256.Options{});
sha256.hash(preimg2[0..], internal_nodes[0..32], sha256.Options{});
var digest = sha256.init(sha256.Options{});
digest.update(left[0..]);
digest.update(internal_nodes[0..32]);
digest.final(internal_nodes[0..32]);
sha256.hash(preimg3[0..], &left, sha256.Options{});
sha256.hash(preimg4[0..], internal_nodes[32..], sha256.Options{});
digest = sha256.init(sha256.Options{});
digest.update(left[0..]);
digest.update(internal_nodes[32..]);
digest.final(internal_nodes[32..]);
sha256.hash(internal_nodes[0..], &expected, sha256.Options{});
try expect(std.mem.eql(u8, hashed[0..], expected[0..]));
}
const Fork = struct {
previous_version: [4]u8,
current_version: [4]u8,
epoch: u64,
};
test "calculate the root hash of a structure" {
var hashed: [32]u8 = undefined;
const fork = Fork{
.previous_version = [_]u8{ 0x9c, 0xe2, 0x5d, 0x26 },
.current_version = [_]u8{ 0x36, 0x90, 0x55, 0x93 },
.epoch = 3,
};
var expected: [32]u8 = undefined;
_ = try std.fmt.hexToBytes(expected[0..], "58316a908701d3660123f0b8cb7839abdd961f71d92993d34e4f480fbec687d9");
try hashTreeRoot(Fork, fork, &hashed, std.testing.allocator);
try expect(std.mem.eql(u8, hashed[0..], expected[0..]));
}
test "calculate the root hash of an Optional" {
var hashed: [32]u8 = undefined;
var payload: [64]u8 = undefined;
const v: ?u32 = null;
const u: ?u32 = 0xdeadbeef;
var expected: [32]u8 = undefined;
_ = try std.fmt.hexToBytes(payload[0..], "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
sha256.hash(payload[0..], expected[0..], sha256.Options{});
try hashTreeRoot(?u32, v, &hashed, std.testing.allocator);
try expect(std.mem.eql(u8, hashed[0..], expected[0..]));
_ = try std.fmt.hexToBytes(payload[0..], "efbeadde000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000");
sha256.hash(payload[0..], expected[0..], sha256.Options{});
try hashTreeRoot(?u32, u, &hashed, std.testing.allocator);
try expect(std.mem.eql(u8, hashed[0..], expected[0..]));
}
test "calculate the root hash of an union" {
const Payload = union(enum) {
int: u64,
boolean: bool,
};
var out: [32]u8 = undefined;
var payload: [64]u8 = undefined;
_ = try std.fmt.hexToBytes(payload[0..], "d2040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000");
var exp1: [32]u8 = undefined;
sha256.hash(payload[0..], exp1[0..], sha256.Options{});
try hashTreeRoot(Payload, Payload{ .int = 1234 }, &out, std.testing.allocator);
try expect(std.mem.eql(u8, out[0..], exp1[0..]));
var exp2: [32]u8 = undefined;
_ = try std.fmt.hexToBytes(payload[0..], "01000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000");
sha256.hash(payload[0..], exp2[0..], sha256.Options{});
try hashTreeRoot(Payload, Payload{ .boolean = true }, &out, std.testing.allocator);
try expect(std.mem.eql(u8, out[0..], exp2[0..]));
} | src/tests.zig |
const Dump = @import("json").Dump;
const std = @import("std");
const Allocator = std.mem.Allocator;
const event = std.event;
const io = std.io;
const json = std.json;
const mem = std.mem;
const warn = std.debug.warn;
pub const json_rpc_version = "2.0";
const content_length = "Content-Length";
const default_message_size: usize = 8192;
pub const Error = struct {
code: i64,
message: []const u8,
data: ?json.Value,
pub const Code = enum(i64) {
// UnknownError should be used for all non coded errors.
UnknownError = -32001,
// ParseError is used when invalid JSON was received by the server.
ParseError = -32700,
//InvalidRequest is used when the JSON sent is not a valid Request object.
InvalidRequest = -32600,
// MethodNotFound should be returned by the handler when the method does
// not exist / is not available.
MethodNotFound = -32601,
// InvalidParams should be returned by the handler when method
// parameter(s) were invalid.
InvalidParams = -32602,
// InternalError is not currently returned but defined for completeness.
InternalError = -32603,
//ServerOverloaded is returned when a message was refused due to a
//server being temporarily unable to accept any new messages.
ServerOverloaded = -32000,
};
};
pub const Request = struct {
jsonrpc: []const u8,
method: []const u8,
params: ?json.Value,
id: ?ID,
pub fn init(m: *const json.ObjectMap) !Request {
var req: Request = undefined;
if (m.get("jsonrpc")) |kv| {
req.jsonrpc = kv.value.String;
}
if (m.get("method")) |kv| {
req.method = kv.value.String;
}
if (m.get("params")) |kv| {
req.params = kv.value;
} else {
req.params = null;
}
if (m.get("id")) |kv| {
switch (kv.value) {
.String => |v| {
req.id = ID{ .Name = v };
},
.Integer => |v| {
req.id = ID{ .Number = v };
},
else => return error.WrongIDValue,
}
} else {
req.id = null;
}
return req;
}
};
pub const ID = union(enum) {
Name: []const u8,
Number: i64,
pub fn encode(self: ID, a: *Allocator) json.Value {
switch (self) {
ID.Name => |v| {
return json.Value{ .String = v };
},
ID.Number => |v| {
return json.Value{ .Integer = v };
},
else => unreachable,
}
}
pub fn decode(self: *ID, value: json.Value) !void {
switch (value) {
json.Value.Integer => |v| {
self.* = ID{ .Number = v };
},
json.Value.String => |v| {
self.* = ID{ .Name = v };
},
else => return error.BadValue,
}
}
};
pub const Response = struct {
jsonrpc: []const u8,
result: ?json.Value,
err: ?Error,
id: ?ID,
fn init(req: *Request) Response {
return Response{
.jsonrpc = req.jsonrpc,
.result = null,
.err = null,
.id = req.id,
};
}
pub fn encode(self: *Response, a: *Allocator) !json.Value {
var m = json.ObjectMap.init(a);
_ = try m.put("jsonrpc", json.Value{ .String = json_rpc_version });
if (self.result != null) {
_ = try m.put("result", self.result.?);
}
if (self.err) |*v| {
// _ = try m.put("error", try v.encode(a));
}
if (self.id) |v| {
_ = try m.put("id", v.encode(a));
}
return json.Value{ .Object = m };
}
};
// Context is a rpc call lifecycle object. Contains the rpc request and the
// reponse of serving the request.
pub const Context = struct {
request: *Request,
response: *Response,
arena: std.heap.ArenaAllocator,
// The requestParams might contain a json.Value object. The memory
// allocated on that object is in scope with this tree, so we keep this
// reference here to ensure all memory used in the duration of this
// context is properly freed when destorying the context.
tree: json.ValueTree,
pub fn init(a: *Allocator) !Context {
var self: Context = undefined;
self.arena = std.heap.ArenaAllocator.init(a);
var alloc = &self.arena.allocator;
self.request = try alloc.create(Request);
self.response = try alloc.create(Response);
self.tree = undefined;
return self;
}
pub fn deinit(self: *Context) void {
(&self.tree).deinit();
(&self.arena).deinit();
}
pub fn write(self: *Context, value: ?json.Value) void {
self.response.result = value;
}
pub fn writeError(self: *Context, value: ?Error) void {
self.response.err = value;
}
};
pub const Conn = struct {
a: *Allocator,
handler: *const Handler,
const channel_buffer_size = 10;
const ContextChannel = std.event.Channel(*Context);
pub const Handler = struct {
handleFn: fn (*const Handler, *Context) anyerror!void,
pub fn serve(self: *const Handler, ctx: *Context) anyerror!void {
return self.handleFn(self, ctx);
}
};
pub fn init(
a: *Allocator,
handler: *const Handler,
) Conn {
var conn = Conn{
.a = a,
.handler = handler,
};
return conn;
}
pub fn serve(self: *Conn, loop: *event.Loop, in: var, out: var) anyerror!void {
var context_channel = try ContextChannel.create(loop, 1);
const reader = try async<loop.allocator> read(context_channel, in, self);
const writer = try async<loop.allocator> write(context_channel, out, self);
defer {
cancel reader;
cancel writer;
context_channel.destroy();
}
loop.run();
}
async fn read(
context_channel: *ContextChannel,
in: *std.fs.File.InStream.Stream,
self: *Conn,
) void {
var buffer = std.Buffer.init(self.a, "") catch |err| {
std.debug.warn("{} \n", err);
return;
};
var buf = &buffer;
defer buf.deinit();
var p = &json.Parser.init(self.a, true);
defer p.deinit();
while (true) {
var ctx = self.a.create(Context) catch |err| {
return;
};
ctx.* = Context.init(self.a) catch |err| {
return;
};
buf.resize(0) catch |_| return;
p.reset();
readRequestData(buf, in) catch |err| {
std.debug.warn(" err {} \n", err);
return;
};
std.debug.warn("reading stuff\n");
var v = p.parse(buf.toSlice()) catch |err| {
return;
};
switch (v.root) {
json.Value.Object => |*m| {
var req: Request = undefined;
ctx.tree = v;
ctx.request.* = Request.init(m) catch |err| {
std.debug.warn("{} \n", err);
return;
};
ctx.response.* = Response.init(ctx.request);
},
else => unreachable,
}
// await (async context_channel.put(ctx) catch @panic("out of memory"));
// std.debug.warn("sent to channel {} \n", context_channel.put_count);
}
}
async fn write(
context_channel: *ContextChannel,
out: *std.fs.File.OutStream.Stream,
self: *Conn,
) void {
// while (true) {
// const h = async context_channel.get() catch @panic("out of memory");
// var ctx = await h;
// std.debug.warn("writing\n");
// handleWrite(ctx, out, self) catch |err| {
// std.debug.warn("{} \n", err);
// return;
// };
// }
}
fn handleWrite(
ctx: *Context,
out: *std.fs.File.OutStream.Stream,
self: *Conn,
) !void {
defer {
ctx.deinit();
self.a.destroy(ctx);
}
try self.handler.serve(ctx);
try writeResponseData(ctx, out);
}
pub fn readRequestData(buf: *std.Buffer, stream: var) !void {
var length: usize = 0;
while (true) {
try stream.readUntilDelimiterBuffer(
buf,
'\n',
default_message_size,
);
const line = trimSpace(buf.toSlice());
if (line.len == 0) {
break;
}
const colon = mem.indexOfScalar(u8, line, ':') orelse return error.InvalidHeader;
const name = line[0..colon];
const value = trimSpace(line[colon + 1 ..]);
if (mem.eql(u8, name, content_length)) {
length = try std.fmt.parseInt(usize, value, 10);
}
}
if (length == 0) {
return error.MissingContentLengthHeader;
}
try buf.resize(length);
const n = try stream.read(buf.toSlice());
std.debug.assert(n == length);
}
pub fn writeResponseData(ctx: *Context, stream: var) !void {
var a = &ctx.arena.allocator;
var buf = &try std.Buffer.init(a, "");
var buf_stream = &std.io.BufferOutStream.init(buf).stream;
var dump = &try Dump.init(a);
var v = try ctx.response.encode(a);
try dump.dump(v, buf_stream);
try stream.print("Content-Length: {}\r\n\r\n", buf.len());
try stream.write(buf.toSlice());
}
};
// simple adhoc way for removing starting and trailing whitespace.
fn trimSpace(s: []const u8) []const u8 {
return mem.trim(u8, s, [_]u8{ ' ', '\n', '\r' });
} | src/lsp/jsonrpc2/jsonrpc2.zig |
pub usingnamespace @import("std").c.builtins;
pub const max_align_t = struct_unnamed_1;
pub const enum_channel = extern enum(c_int) {
EBUR128_UNUSED = 0,
EBUR128_LEFT = 1,
EBUR128_Mp030 = 1,
EBUR128_RIGHT = 2,
EBUR128_Mm030 = 2,
EBUR128_CENTER = 3,
EBUR128_Mp000 = 3,
EBUR128_LEFT_SURROUND = 4,
EBUR128_Mp110 = 4,
EBUR128_RIGHT_SURROUND = 5,
EBUR128_Mm110 = 5,
EBUR128_DUAL_MONO = 6,
EBUR128_MpSC = 7,
EBUR128_MmSC = 8,
EBUR128_Mp060 = 9,
EBUR128_Mm060 = 10,
EBUR128_Mp090 = 11,
EBUR128_Mm090 = 12,
EBUR128_Mp135 = 13,
EBUR128_Mm135 = 14,
EBUR128_Mp180 = 15,
EBUR128_Up000 = 16,
EBUR128_Up030 = 17,
EBUR128_Um030 = 18,
EBUR128_Up045 = 19,
EBUR128_Um045 = 20,
EBUR128_Up090 = 21,
EBUR128_Um090 = 22,
EBUR128_Up110 = 23,
EBUR128_Um110 = 24,
EBUR128_Up135 = 25,
EBUR128_Um135 = 26,
EBUR128_Up180 = 27,
EBUR128_Tp000 = 28,
EBUR128_Bp000 = 29,
EBUR128_Bp045 = 30,
EBUR128_Bm045 = 31,
_,
};
pub const EBUR128_UNUSED = @enumToInt(enum_channel.EBUR128_UNUSED);
pub const EBUR128_LEFT = @enumToInt(enum_channel.EBUR128_LEFT);
pub const EBUR128_Mp030 = @enumToInt(enum_channel.EBUR128_Mp030);
pub const EBUR128_RIGHT = @enumToInt(enum_channel.EBUR128_RIGHT);
pub const EBUR128_Mm030 = @enumToInt(enum_channel.EBUR128_Mm030);
pub const EBUR128_CENTER = @enumToInt(enum_channel.EBUR128_CENTER);
pub const EBUR128_Mp000 = @enumToInt(enum_channel.EBUR128_Mp000);
pub const EBUR128_LEFT_SURROUND = @enumToInt(enum_channel.EBUR128_LEFT_SURROUND);
pub const EBUR128_Mp110 = @enumToInt(enum_channel.EBUR128_Mp110);
pub const EBUR128_RIGHT_SURROUND = @enumToInt(enum_channel.EBUR128_RIGHT_SURROUND);
pub const EBUR128_Mm110 = @enumToInt(enum_channel.EBUR128_Mm110);
pub const EBUR128_DUAL_MONO = @enumToInt(enum_channel.EBUR128_DUAL_MONO);
pub const EBUR128_MpSC = @enumToInt(enum_channel.EBUR128_MpSC);
pub const EBUR128_MmSC = @enumToInt(enum_channel.EBUR128_MmSC);
pub const EBUR128_Mp060 = @enumToInt(enum_channel.EBUR128_Mp060);
pub const EBUR128_Mm060 = @enumToInt(enum_channel.EBUR128_Mm060);
pub const EBUR128_Mp090 = @enumToInt(enum_channel.EBUR128_Mp090);
pub const EBUR128_Mm090 = @enumToInt(enum_channel.EBUR128_Mm090);
pub const EBUR128_Mp135 = @enumToInt(enum_channel.EBUR128_Mp135);
pub const EBUR128_Mm135 = @enumToInt(enum_channel.EBUR128_Mm135);
pub const EBUR128_Mp180 = @enumToInt(enum_channel.EBUR128_Mp180);
pub const EBUR128_Up000 = @enumToInt(enum_channel.EBUR128_Up000);
pub const EBUR128_Up030 = @enumToInt(enum_channel.EBUR128_Up030);
pub const EBUR128_Um030 = @enumToInt(enum_channel.EBUR128_Um030);
pub const EBUR128_Up045 = @enumToInt(enum_channel.EBUR128_Up045);
pub const EBUR128_Um045 = @enumToInt(enum_channel.EBUR128_Um045);
pub const EBUR128_Up090 = @enumToInt(enum_channel.EBUR128_Up090);
pub const EBUR128_Um090 = @enumToInt(enum_channel.EBUR128_Um090);
pub const EBUR128_Up110 = @enumToInt(enum_channel.EBUR128_Up110);
pub const EBUR128_Um110 = @enumToInt(enum_channel.EBUR128_Um110);
pub const EBUR128_Up135 = @enumToInt(enum_channel.EBUR128_Up135);
pub const EBUR128_Um135 = @enumToInt(enum_channel.EBUR128_Um135);
pub const EBUR128_Up180 = @enumToInt(enum_channel.EBUR128_Up180);
pub const EBUR128_Tp000 = @enumToInt(enum_channel.EBUR128_Tp000);
pub const EBUR128_Bp000 = @enumToInt(enum_channel.EBUR128_Bp000);
pub const EBUR128_Bp045 = @enumToInt(enum_channel.EBUR128_Bp045);
pub const EBUR128_Bm045 = @enumToInt(enum_channel.EBUR128_Bm045);
pub const enum_error = extern enum(c_int) {
EBUR128_SUCCESS = 0,
EBUR128_ERROR_NOMEM = 1,
EBUR128_ERROR_INVALID_MODE = 2,
EBUR128_ERROR_INVALID_CHANNEL_INDEX = 3,
EBUR128_ERROR_NO_CHANGE = 4,
_,
};
pub const EBUR128_SUCCESS = @enumToInt(enum_error.EBUR128_SUCCESS);
pub const EBUR128_ERROR_NOMEM = @enumToInt(enum_error.EBUR128_ERROR_NOMEM);
pub const EBUR128_ERROR_INVALID_MODE = @enumToInt(enum_error.EBUR128_ERROR_INVALID_MODE);
pub const EBUR128_ERROR_INVALID_CHANNEL_INDEX = @enumToInt(enum_error.EBUR128_ERROR_INVALID_CHANNEL_INDEX);
pub const EBUR128_ERROR_NO_CHANGE = @enumToInt(enum_error.EBUR128_ERROR_NO_CHANGE);
pub const enum_mode = extern enum(c_int) {
EBUR128_MODE_M = 1,
EBUR128_MODE_S = 3,
EBUR128_MODE_I = 5,
EBUR128_MODE_LRA = 11,
EBUR128_MODE_SAMPLE_PEAK = 17,
EBUR128_MODE_TRUE_PEAK = 49,
EBUR128_MODE_HISTOGRAM = 64,
_,
};
pub const EBUR128_MODE_M = @enumToInt(enum_mode.EBUR128_MODE_M);
pub const EBUR128_MODE_S = @enumToInt(enum_mode.EBUR128_MODE_S);
pub const EBUR128_MODE_I = @enumToInt(enum_mode.EBUR128_MODE_I);
pub const EBUR128_MODE_LRA = @enumToInt(enum_mode.EBUR128_MODE_LRA);
pub const EBUR128_MODE_SAMPLE_PEAK = @enumToInt(enum_mode.EBUR128_MODE_SAMPLE_PEAK);
pub const EBUR128_MODE_TRUE_PEAK = @enumToInt(enum_mode.EBUR128_MODE_TRUE_PEAK);
pub const EBUR128_MODE_HISTOGRAM = @enumToInt(enum_mode.EBUR128_MODE_HISTOGRAM);
pub const struct_ebur128_state_internal = opaque {};
const struct_unnamed_2 = extern struct {
mode: c_int,
channels: c_uint,
samplerate: c_ulong,
d: ?*struct_ebur128_state_internal,
};
pub const ebur128_state = struct_unnamed_2;
pub extern fn ebur128_get_version(major: [*c]c_int, minor: [*c]c_int, patch: [*c]c_int) void;
pub extern fn ebur128_init(channels: c_uint, samplerate: c_ulong, mode: c_int) [*c]ebur128_state;
pub extern fn ebur128_destroy(st: [*c][*c]ebur128_state) void;
pub extern fn ebur128_set_channel(st: [*c]ebur128_state, channel_number: c_uint, value: c_int) c_int;
pub extern fn ebur128_change_parameters(st: [*c]ebur128_state, channels: c_uint, samplerate: c_ulong) c_int;
pub extern fn ebur128_set_max_window(st: [*c]ebur128_state, window: c_ulong) c_int;
pub extern fn ebur128_set_max_history(st: [*c]ebur128_state, history: c_ulong) c_int;
pub extern fn ebur128_add_frames_short(st: [*c]ebur128_state, src: [*c]const c_short, frames: usize) c_int;
pub extern fn ebur128_add_frames_int(st: [*c]ebur128_state, src: [*c]const c_int, frames: usize) c_int;
pub extern fn ebur128_add_frames_float(st: [*c]ebur128_state, src: [*c]const f32, frames: usize) c_int;
pub extern fn ebur128_add_frames_double(st: [*c]ebur128_state, src: [*c]const f64, frames: usize) c_int;
pub extern fn ebur128_loudness_global(st: [*c]ebur128_state, out: [*c]f64) c_int;
pub extern fn ebur128_loudness_global_multiple(sts: [*c][*c]ebur128_state, size: usize, out: [*c]f64) c_int;
pub extern fn ebur128_loudness_momentary(st: [*c]ebur128_state, out: [*c]f64) c_int;
pub extern fn ebur128_loudness_shortterm(st: [*c]ebur128_state, out: [*c]f64) c_int;
pub extern fn ebur128_loudness_window(st: [*c]ebur128_state, window: c_ulong, out: [*c]f64) c_int;
pub extern fn ebur128_loudness_range(st: [*c]ebur128_state, out: [*c]f64) c_int;
pub extern fn ebur128_loudness_range_multiple(sts: [*c][*c]ebur128_state, size: usize, out: [*c]f64) c_int;
pub extern fn ebur128_sample_peak(st: [*c]ebur128_state, channel_number: c_uint, out: [*c]f64) c_int;
pub extern fn ebur128_prev_sample_peak(st: [*c]ebur128_state, channel_number: c_uint, out: [*c]f64) c_int;
pub extern fn ebur128_true_peak(st: [*c]ebur128_state, channel_number: c_uint, out: [*c]f64) c_int;
pub extern fn ebur128_prev_true_peak(st: [*c]ebur128_state, channel_number: c_uint, out: [*c]f64) c_int;
pub extern fn ebur128_relative_threshold(st: [*c]ebur128_state, out: [*c]f64) c_int;
pub const EBUR128_VERSION_MAJOR = 1;
pub const EBUR128_VERSION_MINOR = 2;
pub const EBUR128_VERSION_PATCH = 6;
pub const NULL = @import("std").meta.cast(?*c_void, 0);
pub fn offsetof(t: anytype, d: anytype) callconv(.Inline) @TypeOf(__builtin_offsetof(t, d)) {
return __builtin_offsetof(t, d);
}
pub const channel = enum_channel;
pub const @"error" = enum_error;
pub const mode = enum_mode;
pub const ebur128_state_internal = struct_ebur128_state_internal; | src/c.zig |
const x86_64 = @import("../index.zig");
const std = @import("std");
const Portu8 = x86_64.structures.port.Portu8;
const writeU8 = x86_64.instructions.port.writeU8;
const DATA_READY: u8 = 1;
const OUTPUT_READY: u8 = 1 << 5;
pub const COMPort = enum {
COM1,
COM2,
COM3,
COM4,
fn toPort(com_port: COMPort) u16 {
return switch (com_port) {
.COM1 => 0x3F8,
.COM2 => 0x2F8,
.COM3 => 0x3E8,
.COM4 => 0x2E8,
};
}
comptime {
std.testing.refAllDecls(@This());
}
};
pub const BaudRate = enum {
Baud115200,
Baud57600,
Baud38400,
Baud28800,
fn toDivisor(baud_rate: BaudRate) u8 {
return switch (baud_rate) {
.Baud115200 => 1,
.Baud57600 => 2,
.Baud38400 => 3,
.Baud28800 => 4,
};
}
comptime {
std.testing.refAllDecls(@This());
}
};
pub const SerialPort = struct {
z_data_port: Portu8,
z_line_status_port: Portu8,
/// Initalize the serial port at `com_port` with the baud rate `baud_rate`
pub fn init(com_port: COMPort, baud_rate: BaudRate) SerialPort {
const data_port_number = com_port.toPort();
// Disable interrupts
writeU8(data_port_number + 1, 0x00);
// Set Baudrate
writeU8(data_port_number + 3, 0x80);
writeU8(data_port_number, baud_rate.toDivisor());
writeU8(data_port_number + 1, 0x00);
// 8 bits, no parity, one stop bit
writeU8(data_port_number + 3, 0x03);
// Enable FIFO
writeU8(data_port_number + 2, 0xC7);
// Mark data terminal ready
writeU8(data_port_number + 4, 0x0B);
// Enable interupts
writeU8(data_port_number + 1, 0x01);
return .{
.z_data_port = Portu8.init(data_port_number),
.z_line_status_port = Portu8.init(data_port_number + 5),
};
}
fn waitForOutputReady(self: SerialPort) void {
while (self.z_line_status_port.read() & OUTPUT_READY == 0) {
x86_64.instructions.pause();
}
}
fn waitForInputReady(self: SerialPort) void {
while (self.z_line_status_port.read() & DATA_READY == 0) {
x86_64.instructions.pause();
}
}
fn sendByte(self: SerialPort, data: u8) void {
switch (data) {
8, 0x7F => {
self.waitForOutputReady();
self.z_data_port.write(8);
self.waitForOutputReady();
self.z_data_port.write(' ');
self.waitForOutputReady();
self.z_data_port.write(8);
},
else => {
self.waitForOutputReady();
self.z_data_port.write(data);
},
}
}
pub fn readByte(self: SerialPort) u8 {
self.waitForInputReady();
return self.z_data_port.read();
}
pub const Writer = std.io.Writer(SerialPort, error{}, writerImpl);
pub fn writer(self: SerialPort) Writer {
return .{ .context = self };
}
/// The impl function driving the `std.io.Writer`
fn writerImpl(self: SerialPort, bytes: []const u8) error{}!usize {
for (bytes) |char| {
self.sendByte(char);
}
return bytes.len;
}
comptime {
std.testing.refAllDecls(@This());
}
};
comptime {
std.testing.refAllDecls(@This());
} | src/additional/serial_port.zig |
const std = @import("std");
const zfetch = @import("zfetch");
const lib = @import("main.zig");
const model = lib.model;
const parser = lib.parser;
pub const Client = struct {
const Self = @This();
allocator: std.mem.Allocator,
headers: zfetch.Headers,
pub fn init(allocator: std.mem.Allocator) !Client {
var headers = zfetch.Headers.init(allocator);
try headers.appendValue("accept", "*/*");
try headers.appendValue("content-type", "application/json");
try headers.appendValue("user-agent", "Mozilla/5.0 (X11; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0");
try headers.appendValue("origin", "https://music.youtube.com");
return Client{
.allocator = allocator,
.headers = headers,
};
}
pub fn deinit(self: *Self) void {
self.headers.deinit();
}
fn makeRequest(self: *Self, endpoint: []const u8, key: []const u8, value: []const u8) ![]u8 {
const uri = try std.fmt.allocPrint(self.allocator, "https://music.youtube.com/youtubei/v1/{s}?key=<KEY>", .{endpoint});
defer self.allocator.free(uri);
var req = try zfetch.Request.init(self.allocator, uri, null);
defer req.deinit();
const body_fmt =
\\ {{
\\ {s}: "{s}",
\\ context: {{
\\ client: {{
\\ clientName: "WEB_REMIX",
\\ clientVersion: "1.20211122.00.00"
\\ }},
\\ user: {{}}
\\ }}
\\ }}
;
var body = try std.fmt.allocPrint(self.allocator, body_fmt, .{ key, value });
defer self.allocator.free(body);
try req.do(.POST, self.headers, body);
// try stdout.print("status: {d} {s}\n", .{ req.status.code, req.status.reason });
const reader = req.reader();
// read all (maybe in the future zjson will supports passing a reader)
const body_content = try reader.readAllAlloc(self.allocator, std.math.maxInt(usize));
return body_content;
}
pub fn search(self: *Self, query: []const u8) !model.SearchResult {
var res_body = try self.makeRequest("search", "query", query);
defer self.allocator.free(res_body);
const result = try parser.parseSearch(res_body, self.allocator);
return result;
}
};
test "basic add functionality" {
std.testing.refAllDecls(@This());
var client = try Client.init(std.testing.allocator);
defer client.deinit();
const response = try client.search("yaosobi");
for (response.songs.items) |video| {
std.log.warn("{s}", .{video.title});
}
defer response.deinit();
} | src/client.zig |
const std = @import("std");
const mem = std.mem;
const fmt = std.fmt;
const testing = std.testing;
use @import("ip");
test "IpV6Address.segments()" {
testing.expectEqual([8]u16{ 0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff }, IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).segments());
}
test "IpV6Address.octets()" {
const expected = [16]u8{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0xff, 0xff, 0xc0, 0x0a, 0x02, 0xff,
};
const ip = IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff);
testing.expectEqual(expected, ip.octets());
}
test "IpV6Address.fromSlice()" {
var arr = [16]u8{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0xff, 0xff, 0xc0, 0x0a, 0x02, 0xff,
};
const ip = IpV6Address.fromSlice(&arr);
testing.expectEqual([8]u16{ 0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff }, ip.segments());
}
test "IpV6Address.isUnspecified()" {
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0, 0, 0).isUnspecified());
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).isUnspecified() == false);
}
test "IpV6Address.isLoopback()" {
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0, 0, 0x1).isLoopback());
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).isLoopback() == false);
}
test "IpV6Address.isMulticast()" {
testing.expect(IpV6Address.init(0xff00, 0, 0, 0, 0, 0, 0, 0).isMulticast());
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).isMulticast() == false);
}
test "IpV6Address.isDocumentation()" {
testing.expect(IpV6Address.init(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).isDocumentation());
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).isDocumentation() == false);
}
test "IpV6Address.isMulticastLinkLocal()" {
var arr = [_]u8{ 0xff, 0x02, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x02 };
testing.expect(IpV6Address.fromSlice(&arr).isMulticastLinkLocal());
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).isMulticastLinkLocal() == false);
}
test "IpV6Address.isUnicastSiteLocal()" {
testing.expect(IpV6Address.init(0xfec2, 0, 0, 0, 0, 0, 0, 0).isUnicastSiteLocal());
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).isUnicastSiteLocal() == false);
}
test "IpV6Address.isUnicastLinkLocal()" {
testing.expect(IpV6Address.init(0xfe8a, 0, 0, 0, 0, 0, 0, 0).isUnicastLinkLocal());
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).isUnicastLinkLocal() == false);
}
test "IpV6Address.isUniqueLocal()" {
testing.expect(IpV6Address.init(0xfc02, 0, 0, 0, 0, 0, 0, 0).isUniqueLocal());
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).isUniqueLocal() == false);
}
test "IpV6Address.multicastScope()" {
const scope = IpV6Address.init(0xff0e, 0, 0, 0, 0, 0, 0, 0).multicastScope() orelse unreachable;
testing.expect(scope == Ipv6MulticastScope.Global);
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).multicastScope() == null);
}
test "IpV6Address.isGloballyRoutable()" {
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).isGloballyRoutable());
testing.expect(IpV6Address.init(0, 0, 0x1c9, 0, 0, 0xafc8, 0, 0x1).isGloballyRoutable());
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0, 0, 0x1).isGloballyRoutable() == false);
}
test "IpV6Address.isUnicastGlobal()" {
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).isUnicastGlobal());
testing.expect(IpV6Address.init(0x2001, 0xdb8, 0, 0, 0, 0, 0, 0).isUnicastGlobal() == false);
}
test "IpV6Address.toIpv4()" {
const firstAddress = IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff).toIpv4() orelse unreachable;
const secondAddress = IpV6Address.init(0, 0, 0, 0, 0, 0, 0, 1).toIpv4() orelse unreachable;
testing.expect(firstAddress.equals(IpV4Address.init(192, 10, 2, 255)));
testing.expect(secondAddress.equals(IpV4Address.init(0, 0, 0, 1)));
testing.expect(IpV6Address.init(0xff00, 0, 0, 0, 0, 0, 0, 0).toIpv4() == null);
}
test "IpV6Address.equals()" {
testing.expect(IpV6Address.init(0, 0, 0, 0, 0, 0, 0, 1).equals(IpV6Address.Localhost));
}
test "IpV6Address.toHostByteOrder()" {
const addr = IpV6Address.init(0x1020, 0x3040, 0x5060, 0x7080, 0x90A0, 0xB0C0, 0xD0E0, 0xF00D);
const expected: u128 = 0x102030405060708090A0B0C0D0E0F00D;
testing.expectEqual(expected, addr.toHostByteOrder());
}
test "IpV6Address.fromHostByteOrder()" {
const a: u128 = 0x102030405060708090A0B0C0D0E0F00D;
const addr = IpV6Address.fromHostByteOrder(a);
testing.expect(addr.equals(IpV6Address.init(0x1020, 0x3040, 0x5060, 0x7080, 0x90A0, 0xB0C0, 0xD0E0, 0xF00D)));
}
fn testFormatIpv6Address(address: IpV6Address, expected: []const u8) !void {
var buffer: [1024]u8 = undefined;
const buf = buffer[0..];
const result = try fmt.bufPrint(buf, "{}", address);
testing.expectEqualSlices(u8, expected, result);
}
test "IpV6Address.format()" {
try testFormatIpv6Address(IpV6Address.Unspecified, "::");
try testFormatIpv6Address(IpV6Address.Localhost, "::1");
try testFormatIpv6Address(IpV6Address.init(0, 0, 0, 0, 0, 0x00, 0xc00a, 0x2ff), "::192.10.2.255");
try testFormatIpv6Address(IpV6Address.init(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff), "::ffff:192.168.3.11");
try testFormatIpv6Address(IpV6Address.init(0x2001, 0x0db8, 0x85a3, 0x0000, 0x0000, 0x8a2e, 0x0370, 0x7334), "2001:db8:85a3::8a2e:370:7334");
try testFormatIpv6Address(IpV6Address.init(0x2001, 0xdb8, 0x85a3, 0x8d3, 0x1319, 0x8a2e, 0x370, 0x7348), "2001:db8:85a3:8d3:1319:8a2e:370:7348");
try testFormatIpv6Address(IpV6Address.init(0x001, 0, 0, 0, 0, 0, 0, 0), "1::");
var scope_id = "eth2";
var ipWithScopeId = IpV6Address.init(0x2001, 0x0db8, 0x85a3, 0x0000, 0x0000, 0x8a2e, 0x0370, 0x7334);
ipWithScopeId.scope_id = scope_id[0..];
try testFormatIpv6Address(ipWithScopeId, "2001:db8:85a3::8a2e:370:7334%eth2");
}
fn testIpV6ParseAndBack(addr: []const u8, expectedIp: IpV6Address) !void {
const parsed = try IpV6Address.parse(addr);
try testFormatIpv6Address(parsed, addr);
testing.expect(parsed.equals(expectedIp));
}
// test "IpV6Address.parse()" {
// try testIpV6ParseAndBack("::", IpV6Address.Unspecified);
// try testIpV6ParseAndBack("::1", IpV6Address.Localhost);
// try testIpV6ParseAndBack("2001:db8:85a3::8a2e:370:7334", IpV6Address.init(0x2001, 0x0db8, 0x85a3, 0x0000, 0x0000, 0x8a2e, 0x0370, 0x7334));
// try testIpV6ParseAndBack("2001:db8:85a3:8d3:1319:8a2e:370:7348", IpV6Address.init(0x2001, 0xdb8, 0x85a3, 0x8d3, 0x1319, 0x8a2e, 0x370, 0x7348));
// } | test/ipv6.zig |
const clz = @import("count0bits.zig");
const std = @import("std");
const math = std.math;
const builtin = @import("builtin");
// mulv - multiplication oVerflow
// * @panic, if result can not be represented
// * assume usize shows available register size for usage
// - mulvXi_genericFast for generic performance implementation
// * auto-selected, if target can represent result in register
// - mulvXi_genericSmall otherwise or on ReleaseSmall or user-setting
// * otherwise selected
//
// Portable speedup method at cost of higher binary size
// - mulvXi_genericApprox for approximation based on number of leading zeroes
// based on Hacker's Delight, chapter 2–13 Overflow Detection, section Multiplication
// - mulvXi_genericMostlyFast for the approximation with mulvXi_genericSmall as
// slow fallback
// TODO measure binary space
// TODO benchmark mulvXi_genericMostlyFast
// fast approximation
// assume: target architectures can not or does not want to use bigger number ranges
inline fn mulvXi_genericApprox(comptime ST: type, a: ST, b: ST) ST {
@setRuntimeSafety(builtin.is_test);
const clzfn = switch (ST) {
i32 => clz.__clzsi2,
i64 => clz.__clzdi2,
i128 => clz.__clzti2,
else => unreachable,
};
const m: i32 = clzfn(a) + clzfn(~a);
const n: i32 = clzfn(b) + clzfn(~b);
const sum: i32 = m + n;
// 1. no overflow, if s^{S_A+S_B} < 2^{n-1}
// => S_A + S_B < n-1 return a*b;
if (sum >= 34) return a * b;
// 2. guaranteed overflow
if (sum <= 31) return -5;
// 3. S_A + S_B = n => 2^{n-2} <= |P| <= 2^n
// overflow may occur, but magnitude does not exceed 2^n
if (sum == 33) {
if (m ^ n ^ (m ^ n) < 0) return -5;
return a * b;
}
// return overflow in all cases as safe over-approximation
// hardware support is required for accurate and speedy detection,
// see "Integer Multipliers with Overflow Detection by Gok" et al.
// p_n and p_{n-1} are not available without space extension
// and wrapping can not store the necessary information.
return -5;
}
// slower but portable routine
inline fn mulvXi_genericSmall(comptime ST: type, a: ST, b: ST) ST {
@setRuntimeSafety(builtin.is_test);
const min = math.minInt(ST);
var res: ST = a *% b;
// Hacker's Delight section Overflow subsection Multiplication
// case a=-2^{31}, b=-1 problem, because
// on some machines a*b = -2^{31} with overflow
// Then -2^{31}/-1 overflows and any result is possible.
// => check with a<0 and b=-2^{31}
if ((a < 0 and b == min) or (a != 0 and res / a != b))
return -5;
return @truncate(ST, res);
}
// fast approximation with slow path as fallback
inline fn mulvXi_genericMostlyFast(comptime ST: type, a: ST, b: ST) ST {
@setRuntimeSafety(builtin.is_test);
const clzfn = switch (ST) {
i32 => clz.__clzsi2,
i64 => clz.__clzdi2,
i128 => clz.__clzti2,
else => unreachable,
};
const m: i32 = clzfn(a) + clzfn(~a);
const n: i32 = clzfn(b) + clzfn(~b);
const sum: i32 = m + n;
// 1. no overflow, if s^{S_A+S_B} < 2^{n-1}
// => S_A + S_B < n-1 return a*b;
if (sum >= 34) return a * b;
// 2. guaranteed overflow
if (sum <= 31) return -5;
// 3. S_A + S_B = n => 2^{n-2} <= |P| <= 2^n
// overflow may occur, but magnitude does not exceed 2^n
if (sum == 33) {
if (m ^ n ^ (m ^ n) < 0) return -5;
return a * b;
}
// fallback to slow method for case `sum == 32`
// hardware support is required for accurate and speedy detection,
// see "Integer Multipliers with Overflow Detection by Gok" et al.
// p_n and p_{n-1} are not available without space extension
// and wrapping can not store the necessary information.
{
@setCold(true);
const min = math.minInt(ST);
var res: ST = a *% b;
if ((a < 0 and b == min) or (a != 0 and res / a != b))
return -5;
return @truncate(ST, res);
}
}
// assume target can represent 2*bitWidth of a and b in register
inline fn mulvXi_genericFast(comptime ST: type, a: ST, b: ST) ST {
@setRuntimeSafety(builtin.is_test);
const EST = switch (ST) {
i32 => i64,
i64 => i128,
i128 => i256,
else => unreachable,
};
const bitsize: u32 = @bitSizeOf(ST);
const max = math.maxInt(ST); // = 0b0xx..xx to ignore sign bit
var res: ST = @as(EST, a) * @as(EST, b);
//invariant: -2^{bitwidth(ST)} <= res <= 2^{bitwidth(ST)-1}
//=> sign bit is irrelevant in high
const high: ST = @truncate(ST, res >> bitsize);
const low: ST = @truncate(ST, res);
if ((high & max) > 0)
return -5;
//slower: if (res < min or max < res) return -5;
return low;
}
pub fn __mulvsi3(a: i32, b: i32) callconv(.C) i32 {
if (@bitSizeOf(i32) <= usize) {
return mulvXi_genericFast(i32, a, b);
} else {
return mulvXi_genericSmall(i32, a, b);
}
}
pub fn __mulvdi3(a: i64, b: i64) callconv(.C) i64 {
if (@bitSizeOf(i64) <= usize) {
return mulvXi_genericFast(i64, a, b);
} else {
return mulvXi_genericSmall(i64, a, b);
}
}
pub fn __mulvti3(a: i128, b: i128) callconv(.C) i128 {
if (@bitSizeOf(i128) <= usize) {
return mulvXi_genericFast(i128, a, b);
} else {
return mulvXi_genericSmall(i128, a, b);
}
} | src/crt/mulv.zig |
const clap = @import("clap");
const format = @import("format");
const std = @import("std");
const util = @import("util");
const ascii = std.ascii;
const debug = std.debug;
const fmt = std.fmt;
const fs = std.fs;
const heap = std.heap;
const io = std.io;
const math = std.math;
const mem = std.mem;
const os = std.os;
const rand = std.rand;
const testing = std.testing;
const escape = util.escape;
const Program = @This();
allocator: mem.Allocator,
out: []const u8,
pub const main = util.generateMain(Program);
pub const version = "0.0.0";
pub const description =
\\Generates a html web site for games. This is very useful for getting an overview of what is
\\in the game after heavy randomization has been apply.
\\
;
pub const params = &[_]clap.Param(clap.Help){
clap.parseParam("-h, --help Display this help text and exit.") catch unreachable,
clap.parseParam("-v, --version Output version information and exit.") catch unreachable,
clap.parseParam("-o, --output <FILE> The file to output the file to. (default: site.html)") catch unreachable,
};
pub fn init(allocator: mem.Allocator, args: anytype) !Program {
return Program{
.allocator = allocator,
.out = args.option("--output") orelse "site.html",
};
}
pub fn run(
program: *Program,
comptime Reader: type,
comptime Writer: type,
stdio: util.CustomStdIoStreams(Reader, Writer),
) anyerror!void {
var game = Game{ .allocator = program.allocator };
try format.io(program.allocator, stdio.in, stdio.out, &game, useGame);
try stdio.out.context.flush();
// We are now completly done with stdout, so we close it. This gives programs further down the
// pipeline the ability to finish up what they need to do while we generate the site.
stdio.out.context.unbuffered_writer.context.close();
const out_file = try fs.cwd().createFile(program.out, .{
.exclusive = false,
.truncate = false,
});
defer out_file.close();
var writer = std.io.bufferedWriter(out_file.writer());
try generate(writer.writer(), game);
try writer.flush();
try out_file.setEndPos(try out_file.getPos());
}
fn useGame(game: *Game, parsed: format.Game) !void {
const allocator = game.allocator;
switch (parsed) {
.starters => |starter| _ = try game.starters.put(allocator, starter.index, starter.value),
.tms => |tm| _ = try game.tms.put(allocator, tm.index, tm.value),
.hms => |hm| _ = try game.hms.put(allocator, hm.index, hm.value),
.trainers => |trainers| {
const trainer = (try game.trainers.getOrPutValue(allocator, trainers.index, .{})).value_ptr;
switch (trainers.value) {
.name => |str| trainer.name = try escape.default.unescapeAlloc(allocator, str),
.class => |class| trainer.class = class,
.encounter_music => |encounter_music| trainer.encounter_music = encounter_music,
.trainer_picture => |trainer_picture| trainer.trainer_picture = trainer_picture,
.party_type => |party_type| trainer.party_type = party_type,
.party_size => |party_size| trainer.party_size = party_size,
.items => |items| _ = try trainer.items.put(allocator, items.index, items.value),
.party => |party| {
const member = (try trainer.party.getOrPutValue(allocator, party.index, .{})).value_ptr;
switch (party.value) {
.ability => |ability| member.ability = ability,
.level => |level| member.level = level,
.species => |species| member.species = species,
.item => |item| member.item = item,
.moves => |moves| _ = try member.moves.put(allocator, moves.index, moves.value),
}
},
}
},
.moves => |moves| {
const move = (try game.moves.getOrPutValue(allocator, moves.index, .{})).value_ptr;
switch (moves.value) {
.name => |str| move.name = try escape.default.unescapeAlloc(allocator, str),
.description => |str| move.description = try escape.default.unescapeAlloc(allocator, str),
.effect => |effect| move.effect = effect,
.power => |power| move.power = power,
.type => |_type| move.type = _type,
.accuracy => |accuracy| move.accuracy = accuracy,
.pp => |pp| move.pp = pp,
.target => |target| move.target = target,
.priority => |priority| move.priority = priority,
.category => |category| move.category = category,
}
},
.pokemons => |pokemons| {
const pokemon = (try game.pokemons.getOrPutValue(allocator, pokemons.index, .{})).value_ptr;
switch (pokemons.value) {
.name => |str| pokemon.name = try escape.default.unescapeAlloc(allocator, str),
.stats => |stats| format.setField(&pokemon.stats, stats),
.ev_yield => |ev_yield| format.setField(&pokemon.ev_yield, ev_yield),
.catch_rate => |catch_rate| pokemon.catch_rate = catch_rate,
.base_exp_yield => |base_exp_yield| pokemon.base_exp_yield = base_exp_yield,
.gender_ratio => |gender_ratio| pokemon.gender_ratio = gender_ratio,
.egg_cycles => |egg_cycles| pokemon.egg_cycles = egg_cycles,
.base_friendship => |base_friendship| pokemon.base_friendship = base_friendship,
.growth_rate => |growth_rate| pokemon.growth_rate = growth_rate,
.color => |color| pokemon.color = color,
.pokedex_entry => |pokedex_entry| pokemon.pokedex_entry = pokedex_entry,
.abilities => |ability| _ = try pokemon.abilities.put(allocator, ability.index, ability.value),
.egg_groups => |egg_group| _ = try pokemon.egg_groups.put(allocator, egg_group.value, {}),
.hms => |hm| if (hm.value) {
_ = try pokemon.hms.put(allocator, hm.index, {});
},
.tms => |tm| if (tm.value) {
_ = try pokemon.tms.put(allocator, tm.index, {});
},
.types => |_type| _ = try pokemon.types.put(allocator, _type.value, {}),
.items => |item| _ = try pokemon.items.put(allocator, item.index, item.value),
.moves => |moves| {
const move = (try pokemon.moves.getOrPutValue(allocator, moves.index, .{})).value_ptr;
format.setField(move, moves.value);
},
.evos => |evos| {
const evo = (try pokemon.evos.getOrPutValue(allocator, evos.index, .{})).value_ptr;
format.setField(evo, evos.value);
},
}
},
.abilities => |abilities| {
const ability = (try game.abilities.getOrPutValue(allocator, abilities.index, .{})).value_ptr;
switch (abilities.value) {
.name => |str| ability.name = try escape.default.unescapeAlloc(allocator, str),
}
},
.types => |types| {
const _type = (try game.types.getOrPutValue(allocator, types.index, .{})).value_ptr;
switch (types.value) {
.name => |str| _type.name = try escape.default.unescapeAlloc(allocator, str),
}
},
.items => |items| {
const item = (try game.items.getOrPutValue(allocator, items.index, .{})).value_ptr;
switch (items.value) {
.name => |str| item.name = try escape.default.unescapeAlloc(allocator, str),
.description => |str| item.description = try escape.default.unescapeAlloc(allocator, str),
.price => |price| item.price = price,
.battle_effect => |battle_effect| item.battle_effect = battle_effect,
.pocket => |pocket| item.pocket = pocket,
}
},
.pokedex => |pokedex| {
const pokedex_entry = (try game.pokedex.getOrPutValue(allocator, pokedex.index, .{})).value_ptr;
switch (pokedex.value) {
.category => |category| pokedex_entry.category = try escape.default.unescapeAlloc(allocator, category),
.height => |height| pokedex_entry.height = height,
.weight => |weight| pokedex_entry.weight = weight,
}
},
.maps,
.wild_pokemons,
.static_pokemons,
.given_pokemons,
.pokeball_items,
.hidden_hollows,
.text,
.text_delays,
.version,
.game_title,
.gamecode,
.instant_text,
=> return error.DidNotConsumeData,
}
return error.DidNotConsumeData;
}
fn generate(writer: anytype, game: Game) !void {
@setEvalBranchQuota(1000000);
const unknown = "???";
const stat_names = [_][2][]const u8{
.{ "hp", "Hp" },
.{ "attack", "Attack" },
.{ "defense", "Defense" },
.{ "sp_attack", "Sp. Atk" },
.{ "sp_defense", "Sp. Def" },
.{ "speed", "Speed" },
};
try writer.writeAll(
\\<!DOCTYPE html>
\\<html>
\\<head>
\\<title>Wiki</title>
\\<style>
\\
\\* {font-family: Arial, Helvetica, sans-serif;}
\\.type {border-style: solid; border-width: 1px; border-color: black; color: white;}
\\.type_Bug {background-color: #88960e;}
\\.type_Dark {background-color: #3c2d23;}
\\.type_Dragon {background-color: #4e3ba4;}
\\.type_Electric {background-color: #e79302;}
\\.type_Fairy {background-color: #e08ee0;}
\\.type_Fighting {background-color: #5f2311;}
\\.type_Fight {background-color: #5f2311;}
\\.type_Fire {background-color: #c72100;}
\\.type_Flying {background-color: #5d73d4;}
\\.type_Ghost {background-color: #454593;}
\\.type_Grass {background-color: #389a02;}
\\.type_Ground {background-color: #ad8c33;}
\\.type_Ice {background-color: #6dd3f5;}
\\.type_Normal {background-color: #ada594;}
\\.type_Poison {background-color: #6b246e;}
\\.type_Psychic {background-color: #dc3165;}
\\.type_Psychc {background-color: #dc3165;}
\\.type_Rock {background-color: #9e863d;}
\\.type_Steel {background-color: #8e8e9f;}
\\.type_Water {background-color: #0c67c2;}
\\
\\.pokemon_stat {width:100%;}
\\.pokemon_stat_table {width:50%;}
\\.pokemon_stat_hp {background-color: #6ab04c;}
\\.pokemon_stat_attack {background-color: #eb4d4b;}
\\.pokemon_stat_defense {background-color: #f0932b;}
\\.pokemon_stat_sp_attack {background-color:#be2edd;}
\\.pokemon_stat_sp_defense {background-color: #686de0;}
\\.pokemon_stat_speed {background-color: #f9ca24;}
\\.pokemon_stat_total {background-color: #95afc0;}
\\
);
for ([_]void{{}} ** 101) |_, i| {
try writer.print(".pokemon_stat_p{} {{width: {}%;}}\n", .{ i, i });
}
try writer.writeAll(
\\</style>
\\</head>
\\<body>
\\
);
try writer.writeAll(
\\<h1>Starters</h1>
\\<table>
\\
);
for (game.starters.values()) |starter| {
const starter_name = if (game.pokemons.get(starter)) |p| p.name else unknown;
try writer.print("<tr><td><a href=\"#pokemon_{}\">{s}</a></td></tr>", .{
starter,
starter_name,
});
}
try writer.writeAll(
\\</table>
\\<h1>Machines</h1>
\\<table>
\\
);
for (game.tms.keys()) |tm_id, i| {
const tm_move = game.tms.values()[i];
const move_name = humanize(if (game.moves.get(tm_move)) |m| m.name else unknown);
try writer.print("<tr><td>TM{} - <a href=\"#move_{}\">{s}</a></td></tr>\n", .{ tm_id + 1, tm_move, move_name });
}
for (game.hms.keys()) |hm_id, i| {
const hm_move = game.hms.values()[i];
const move_name = humanize(if (game.moves.get(hm_move)) |m| m.name else unknown);
try writer.print("<tr><td>HM{} - <a href=\"#move_{}\">{s}</a></td></tr>\n", .{ hm_id + 1, hm_move, move_name });
}
try writer.writeAll(
\\</table>
\\<h1>Pokedex</h1>
\\<table>
\\
);
for (game.pokedex.keys()) |dex| {
const pokemon = for (game.pokemons.values()) |pokemon, i| {
if (pokemon.pokedex_entry == dex)
break .{ .name = pokemon.name, .species = game.pokemons.keys()[i] };
} else continue;
try writer.print("<tr><td><a href=\"#pokemon_{}\">#{} {s}</a></td></tr>\n", .{ pokemon.species, dex, pokemon.name });
}
try writer.writeAll(
\\</table>
\\<h1>Pokemons</h1>
\\
);
for (game.pokemons.values()) |pokemon, i| {
const species = game.pokemons.keys()[i];
try writer.print("<h2 id=\"pokemon_{}\">#{} {s}</h2>\n", .{ species, species, pokemon.name });
try writer.writeAll(
\\<table>
\\<tr><td>Type:</td><td>
\\
);
for (pokemon.types.keys()) |t, j| {
const type_name = humanize(if (game.types.get(t)) |ty| ty.name else unknown);
if (j != 0)
try writer.writeAll(" ");
try writer.print("<a href=\"#type_{}\" class=\"type type_{}\"><b>{}</b></a>", .{
t,
type_name,
type_name,
});
}
try writer.writeAll(
\\</td>
\\<tr><td>Abilities:</td><td>
\\
);
for (pokemon.abilities.values()) |a, j| {
if (a == 0)
continue;
if (j != 0)
try writer.writeAll(", ");
const ability_name = if (game.abilities.get(a)) |abil| abil.name else unknown;
try writer.print("<a href=\"#ability_{}\">{}</a>", .{ a, humanize(ability_name) });
}
try writer.writeAll(
\\</td>
\\<tr><td>Items:</td><td>
\\
);
for (pokemon.items.values()) |item, j| {
if (j != 0)
try writer.writeAll(", ");
const item_name = if (game.items.get(item)) |it| it.name else unknown;
try writer.print("<a href=\"#item_{}\">{}</a>", .{ item, humanize(item_name) });
}
try writer.writeAll(
\\</td>
\\<tr><td>Egg Groups:</td><td>
\\
);
for (pokemon.egg_groups.keys()) |egg_group, j| {
if (j != 0)
try writer.writeAll(", ");
try writer.print("{}", .{humanize(@tagName(egg_group))});
}
try writer.writeAll("</td>\n");
try printSimpleFields(writer, pokemon, &[_][]const u8{});
try writer.writeAll("</table>\n");
try writer.writeAll(
\\<details><summary><b>Evolutions</b></summary>
\\<table>
\\<tr><th>Evolution</th><th>Method</th></tr>
\\
);
for (pokemon.evos.values()) |evo| {
const target_name = humanize(if (game.pokemons.get(evo.target)) |p| p.name else unknown);
const param_item_name = humanize(if (game.items.get(evo.param)) |item| item.name else unknown);
const param_move_name = humanize(if (game.moves.get(evo.param)) |m| m.name else unknown);
const param_pokemon_name = humanize(if (game.pokemons.get(evo.param)) |p| p.name else unknown);
try writer.print("<tr><td><a href=\"#pokemon_{}\">{}</a></td><td>", .{ evo.target, target_name });
switch (evo.method) {
.friend_ship => try writer.writeAll("Level up with friendship high"),
.friend_ship_during_day => try writer.writeAll("Level up with friendship high during daytime"),
.friend_ship_during_night => try writer.writeAll("Level up with friendship high during night"),
.level_up => try writer.print("Level {}", .{evo.param}),
.trade => try writer.writeAll("Trade"),
.trade_holding_item => try writer.print("Trade holding <a href=\"#item_{}\">{}</a>", .{ evo.param, param_item_name }),
.trade_with_pokemon => try writer.print("Trade for <a href=\"#pokemon_{}\">{}</a>", .{ evo.param, param_pokemon_name }),
.use_item => try writer.print("Using <a href=\"#item_{}\">{}</a>", .{ evo.param, param_item_name }),
.attack_gth_defense => try writer.print("Level {} when Attack > Defense", .{evo.param}),
.attack_eql_defense => try writer.print("Level {} when Attack = Defense", .{evo.param}),
.attack_lth_defense => try writer.print("Level {} when Attack < Defense", .{evo.param}),
.personality_value1 => try writer.print("Level {} when having personallity value type 1", .{evo.param}),
.personality_value2 => try writer.print("Level {} when having personallity value type 2", .{evo.param}),
// TODO: What Pokémon?
.level_up_may_spawn_pokemon => try writer.print("Level {} (May spawn another Pokémon when evolved)", .{evo.param}),
// TODO: What Pokémon? What condition?
.level_up_spawn_if_cond => try writer.print("Level {} (May spawn another Pokémon when evolved if conditions are met)", .{evo.param}),
.beauty => try writer.print("Level up when beauty hits {}", .{evo.param}),
.use_item_on_male => try writer.print("Using <a href=\"#item_{}\">{}</a> on a male", .{ evo.param, param_item_name }),
.use_item_on_female => try writer.print("Using <a href=\"#item_{}\">{}</a> on a female", .{ evo.param, param_item_name }),
.level_up_holding_item_during_daytime => try writer.print("Level up while holding <a href=\"#item_{}\">{}</a> during daytime", .{ evo.param, param_item_name }),
.level_up_holding_item_during_the_night => try writer.print("Level up while holding <a href=\"#item_{}\">{}</a> during night", .{ evo.param, param_item_name }),
.level_up_knowning_move => try writer.print("Level up while knowing <a href=\"#move_{}\">{}</a>", .{ evo.param, param_move_name }),
.level_up_with_other_pokemon_in_party => try writer.print("Level up with <a href=\"#pokemon_{}\">{}</a> in the Party", .{ evo.param, param_pokemon_name }),
.level_up_male => try writer.print("Level {} male", .{evo.param}),
.level_up_female => try writer.print("Level {} female", .{evo.param}),
.level_up_in_special_magnetic_field => try writer.writeAll("Level up in special magnetic field"),
.level_up_near_moss_rock => try writer.writeAll("Level up near moss rock"),
.level_up_near_ice_rock => try writer.writeAll("Level up near ice rock"),
.unknown_0x02,
.unknown_0x03,
.unused,
=> try writer.writeAll("Unknown"),
}
try writer.writeAll("</td></tr>\n");
}
try writer.writeAll(
\\</table></details>
\\<details><summary><b>Stats</b></summary>
\\<table class="pokemon_stat_table">
\\
);
var total_stats: usize = 0;
inline for (stat_names) |stat| {
const value = @field(pokemon.stats, stat[0]);
const percent = @floatToInt(usize, (@intToFloat(f64, value) / 255) * 100);
try writer.print("<tr><td>{s}:</td><td class=\"pokemon_stat\"><div class=\"pokemon_stat_p{} pokemon_stat_{s}\">{}</div></td></tr>\n", .{ stat[1], percent, stat[0], value });
total_stats += value;
}
const percent = @floatToInt(usize, (@intToFloat(f64, total_stats) / 1000) * 100);
try writer.print("<tr><td>Total:</td><td><div class=\"pokemon_stat pokemon_stat_p{} pokemon_stat_total\">{}</div></td></tr>\n", .{ percent, total_stats });
try writer.writeAll(
\\</table></details>
\\<details><summary><b>Ev Yield</b></summary>
\\<table>
\\
);
total_stats = 0;
inline for (stat_names) |stat| {
const value = @field(pokemon.ev_yield, stat[0]);
try writer.print("<tr><td>{s}:</td><td>{}</td></tr>\n", .{ stat[1], value });
total_stats += value;
}
try writer.print("<tr><td>Total:</td><td>{}</td></tr>\n", .{total_stats});
try writer.writeAll(
\\</table></details>
\\<details><summary><b>Learnset</b></summary>
\\<table>
\\
);
for (pokemon.moves.values()) |move| {
const move_name = humanize(if (game.moves.get(move.id)) |m| m.name else unknown);
try writer.print("<tr><td>Lvl {}</td><td><a href=\"#move_{}\">{}</a></td></tr>\n", .{ move.level, move.id, move_name });
}
try writer.writeAll(
\\</table>
\\<table>
\\
);
for (pokemon.tms.keys()) |tm_id| {
const move_id = game.tms.get(tm_id) orelse continue;
const move_name = humanize(if (game.moves.get(move_id)) |m| m.name else unknown);
try writer.print(
"<tr><td>TM{}</td><td><a href=\"#move_{}\">{s}</a></td></tr>\n",
.{ tm_id + 1, move_id, move_name },
);
}
for (pokemon.hms.keys()) |hm_id| {
const move_id = game.hms.get(hm_id) orelse continue;
const move_name = humanize(if (game.moves.get(move_id)) |m| m.name else unknown);
try writer.print(
"<tr><td>TM{}</td><td><a href=\"#move_{}\">{s}</a></td></tr>\n",
.{ hm_id + 1, move_id, move_name },
);
}
try writer.writeAll(
\\</table>
\\</details>
\\
);
}
try writer.writeAll("<h1>Trainers</h1>\n");
for (game.trainers.values()) |trainer, i| {
const trainer_id = game.trainers.keys()[i];
try writer.print("<h2 id=\"trainer_{}\">{}</h2>\n", .{ trainer_id, humanize(trainer.name) });
try writer.writeAll("<table>\n");
try writer.writeAll("<tr><td>Items:</td><td>");
for (trainer.items.values()) |item, j| {
if (j != 0)
try writer.writeAll(", ");
const item_name = if (game.items.get(item)) |it| it.name else unknown;
try writer.print("<a href=\"#item_{}\">{}</a>", .{ item, humanize(item_name) });
}
try writer.writeAll(
\\</td>
\\</table>
\\<h3>Party:</h3>
\\<table>
\\
);
const party = trainer.party.values();
for (party[0..math.min(party.len, trainer.party_size)]) |member| {
const pokemon = game.pokemons.get(member.species);
const pokemon_name = humanize(if (pokemon) |p| p.name else unknown);
const ability_id = if (pokemon) |p| p.abilities.get(member.ability) else null;
const ability_id_print = ability_id orelse 0;
const ability = if (ability_id) |a| game.abilities.get(a) else null;
const ability_name = humanize(if (ability) |a| a.name else unknown);
const item_name = humanize(if (game.items.get(member.item)) |it| it.name else unknown);
try writer.print("<tr><td><a href=\"#pokemon_{}\">{}</a></td>", .{ member.species, pokemon_name });
try writer.print("<td>lvl {}</td>", .{member.level});
try writer.print("<td><a href=\"#ability_{}\">{}</a></td>", .{ ability_id_print, ability_name });
switch (trainer.party_type) {
.item, .both => try writer.print("<td><a href=\"#item_{}\">{}</a></td>", .{
member.item,
item_name,
}),
.moves, .none => try writer.writeAll("<td>----</td>"),
}
switch (trainer.party_type) {
.moves, .both => for (member.moves.values()) |move| {
const move_name = humanize(if (game.moves.get(move)) |m| m.name else unknown);
try writer.print("<td><a href=\"#move_{}\">{}</a></td>", .{ move, move_name });
},
.item, .none => {},
}
try writer.writeAll("</tr>");
}
try writer.writeAll("<table>\n");
}
try writer.writeAll("<h1>Moves</h1>\n");
for (game.moves.values()) |move, i| {
const move_id = game.moves.keys()[i];
const move_name = humanize(move.name);
try writer.print("<h2 id=\"move_{}\">{}</h2>\n", .{ move_id, move_name });
try writer.print("<p>{s}</p>\n", .{move.description});
try writer.writeAll("<table>\n");
const type_name = humanize(if (game.types.get(move.type)) |t| t.name else unknown);
try writer.print(
"<tr><td>Type:</td><td><a href=\"type_{}\" class=\"type type_{}\"><b>{}</b></a></td></tr>\n",
.{ move.type, type_name, type_name },
);
try printSimpleFields(writer, move, &[_][]const u8{"type"});
try writer.writeAll("</table>\n");
}
try writer.writeAll("<h1>Items</h1>\n");
for (game.items.values()) |item, i| {
const item_id = game.items.keys()[i];
const item_name = humanize(item.name);
try writer.print("<h2 id=\"item_{}\">{}</h2>\n", .{ item_id, item_name });
try writer.print("<p>{s}</p>\n", .{item.description});
try writer.writeAll("<table>\n");
try printSimpleFields(writer, item, &[_][]const u8{});
try writer.writeAll("</table>\n");
}
try writer.writeAll(
\\</body>
\\</html>
\\
);
}
pub fn printSimpleFields(writer: anytype, value: anytype, comptime blacklist: []const []const u8) !void {
outer: inline for (@typeInfo(@TypeOf(value)).Struct.fields) |field| {
comptime for (blacklist) |blacklist_item| {
if (mem.eql(u8, field.name, blacklist_item))
continue :outer;
};
switch (@typeInfo(field.field_type)) {
.Int => {
try writer.print(
"<tr><td>{}:</td><td>{}</td></tr>\n",
.{ humanize(field.name), @field(value, field.name) },
);
},
.Enum => {
try writer.print(
"<tr><td>{}:</td><td>{}</td></tr>\n",
.{ humanize(field.name), humanize(@tagName(@field(value, field.name))) },
);
},
else => {},
}
}
}
const HumanizeFormatter = struct {
str: []const u8,
pub fn format(
self: HumanizeFormatter,
comptime f: []const u8,
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
_ = f;
_ = options;
try writeHumanized(writer, self.str);
}
};
fn humanize(str: []const u8) HumanizeFormatter {
return HumanizeFormatter{ .str = str };
}
fn writeHumanized(writer: anytype, str: []const u8) !void {
var first = true;
var it = mem.tokenize(u8, str, "_ ");
while (it.next()) |word| : (first = false) {
if (!first)
try writer.writeAll(" ");
try writer.writeByte(ascii.toUpper(word[0]));
for (word[1..]) |c|
try writer.writeByte(ascii.toLower(c));
}
}
const Map = std.AutoArrayHashMapUnmanaged;
const Game = struct {
allocator: mem.Allocator,
starters: Map(u8, u16) = Map(u8, u16){},
trainers: Map(u16, Trainer) = Map(u16, Trainer){},
moves: Map(u16, Move) = Map(u16, Move){},
pokemons: Map(u16, Pokemon) = Map(u16, Pokemon){},
abilities: Map(u16, Ability) = Map(u16, Ability){},
types: Map(u8, Type) = Map(u8, Type){},
tms: Map(u8, u16) = Map(u8, u16){},
hms: Map(u8, u16) = Map(u8, u16){},
items: Map(u16, Item) = Map(u16, Item){},
pokedex: Map(u16, Pokedex) = Map(u16, Pokedex){},
};
const Trainer = struct {
class: u8 = 0,
encounter_music: u8 = 0,
trainer_picture: u8 = 0,
name: []const u8 = "",
party_type: format.PartyType = .none,
party_size: u8 = 0,
party: Map(u8, PartyMember) = Map(u8, PartyMember){},
items: Map(u8, u16) = Map(u8, u16){},
};
const PartyMember = struct {
ability: u4 = 0,
level: u8 = 0,
species: u16 = 0,
item: u16 = 0,
moves: Map(u8, u16) = Map(u8, u16){},
};
const Move = struct {
name: []const u8 = "",
description: []const u8 = "",
effect: u8 = 0,
power: u8 = 0,
type: u8 = 0,
accuracy: u8 = 0,
pp: u8 = 0,
target: u8 = 0,
priority: u8 = 0,
category: format.Move.Category = .status,
};
pub fn Stats(comptime T: type) type {
return struct {
hp: T = 0,
attack: T = 0,
defense: T = 0,
speed: T = 0,
sp_attack: T = 0,
sp_defense: T = 0,
};
}
const Pokemon = struct {
name: []const u8 = "",
stats: Stats(u8) = Stats(u8){},
ev_yield: Stats(u2) = Stats(u2){},
catch_rate: u8 = 0,
base_exp_yield: u16 = 0,
gender_ratio: u8 = 0,
egg_cycles: u8 = 0,
base_friendship: u8 = 0,
pokedex_entry: u16 = 0,
growth_rate: format.GrowthRate = .medium_fast,
color: format.Color = .blue,
tms: Map(u8, void) = Map(u8, void){},
hms: Map(u8, void) = Map(u8, void){},
types: Map(u8, void) = Map(u8, void){},
abilities: Map(u8, u8) = Map(u8, u8){},
items: Map(u8, u16) = Map(u8, u16){},
egg_groups: Map(format.EggGroup, void) = Map(format.EggGroup, void){},
evos: Map(u8, Evolution) = Map(u8, Evolution){},
moves: Map(u8, LevelUpMove) = Map(u8, LevelUpMove){},
};
const Evolution = struct {
method: format.Evolution.Method = .unused,
param: u16 = 0,
target: u16 = 0,
};
const LevelUpMove = struct {
id: u16 = 0,
level: u16 = 0,
};
const Ability = struct {
name: []const u8 = "",
};
const Type = struct {
name: []const u8 = "",
};
const Item = struct {
name: []const u8 = "",
description: []const u8 = "",
price: u32 = 0,
battle_effect: u8 = 0,
pocket: format.Pocket = .none,
};
const Pokedex = struct {
height: u32 = 0,
weight: u32 = 0,
category: []const u8 = "",
}; | src/other/tm35-generate-site.zig |
pub const PspAudioFormats = extern enum(c_int) {
Stereo = 0,
Mono = 16,
_,
};
pub const PspAudioInputParams = extern struct {
unknown1: c_int,
gain: c_int,
unknown2: c_int,
unknown3: c_int,
unknown4: c_int,
unknown5: c_int,
};
// Allocate and initialize a hardware output channel.
//
// @param channel - Use a value between 0 - 7 to reserve a specific channel.
// Pass PSP_AUDIO_NEXT_CHANNEL to get the first available channel.
// @param samplecount - The number of samples that can be output on the channel per
// output call. It must be a value between ::PSP_AUDIO_SAMPLE_MIN
// and ::PSP_AUDIO_SAMPLE_MAX, and it must be aligned to 64 bytes
// (use the ::PSP_AUDIO_SAMPLE_ALIGN macro to align it).
// @param format - The output format to use for the channel. One of ::PspAudioFormats.
//
// @return The channel number on success, an error code if less than 0.
pub extern fn sceAudioChReserve(channel: c_int, samplecount: c_int, format: c_int) c_int;
// Release a hardware output channel.
//
// @param channel - The channel to release.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioChRelease(channel: c_int) c_int;
// Output audio of the specified channel
//
// @param channel - The channel number.
//
// @param vol - The volume.
//
// @param buf - Pointer to the PCM data to output.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioOutput(channel: c_int, vol: c_int, buf: ?*c_void) c_int;
// Output audio of the specified channel (blocking)
//
// @param channel - The channel number.
//
// @param vol - The volume.
//
// @param buf - Pointer to the PCM data to output.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioOutputBlocking(channel: c_int, vol: c_int, buf: ?*c_void) c_int;
// Output panned audio of the specified channel
//
// @param channel - The channel number.
//
// @param leftvol - The left volume.
//
// @param rightvol - The right volume.
//
// @param buf - Pointer to the PCM data to output.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioOutputPanned(channel: c_int, leftvol: c_int, rightvol: c_int, buf: ?*c_void) c_int;
// Output panned audio of the specified channel (blocking)
//
// @param channel - The channel number.
//
// @param leftvol - The left volume.
//
// @param rightvol - The right volume.
//
// @param buf - Pointer to the PCM data to output.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioOutputPannedBlocking(channel: c_int, leftvol: c_int, rightvol: c_int, buf: ?*c_void) c_int;
// Get count of unplayed samples remaining
//
// @param channel - The channel number.
//
// @return Number of samples to be played, an error if less than 0.
pub extern fn sceAudioGetChannelRestLen(channel: c_int) c_int;
// Get count of unplayed samples remaining
//
// @param channel - The channel number.
//
// @return Number of samples to be played, an error if less than 0.
pub extern fn sceAudioGetChannelRestLength(channel: c_int) c_int;
// Change the output sample count, after it's already been reserved
//
// @param channel - The channel number.
// @param samplecount - The number of samples to output in one output call.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioSetChannelDataLen(channel: c_int, samplecount: c_int) c_int;
// Change the format of a channel
//
// @param channel - The channel number.
//
// @param format - One of ::PspAudioFormats
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioChangeChannelConfig(channel: c_int, format: c_int) c_int;
// Change the volume of a channel
//
// @param channel - The channel number.
//
// @param leftvol - The left volume.
//
// @param rightvol - The right volume.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioChangeChannelVolume(channel: c_int, leftvol: c_int, rightvol: c_int) c_int;
// Reserve the audio output and set the output sample count
//
// @param samplecount - The number of samples to output in one output call (min 17, max 4111).
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioOutput2Reserve(samplecount: c_int) c_int;
// Release the audio output
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioOutput2Release() c_int;
// Change the output sample count, after it's already been reserved
//
// @param samplecount - The number of samples to output in one output call (min 17, max 4111).
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioOutput2ChangeLength(samplecount: c_int) c_int;
// Output audio (blocking)
//
// @param vol - The volume.
//
// @param buf - Pointer to the PCM data.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioOutput2OutputBlocking(vol: c_int, buf: ?*c_void) c_int;
// Get count of unplayed samples remaining
//
// @return Number of samples to be played, an error if less than 0.
pub extern fn sceAudioOutput2GetRestSample() c_int;
// Reserve the audio output
//
// @param samplecount - The number of samples to output in one output call (min 17, max 4111).
//
// @param freq - The frequency. One of 48000, 44100, 32000, 24000, 22050, 16000, 12000, 11050, 8000.
//
// @param channels - Number of channels. Pass 2 (stereo).
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioSRCChReserve(samplecount: c_int, freq: c_int, channels: c_int) c_int;
// Release the audio output
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioSRCChRelease() c_int;
// Output audio
//
// @param vol - The volume.
//
// @param buf - Pointer to the PCM data to output.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioSRCOutputBlocking(vol: c_int, buf: ?*c_void) c_int;
// Init audio input
//
// @param unknown1 - Unknown. Pass 0.
//
// @param gain - Gain.
//
// @param unknown2 - Unknown. Pass 0.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioInputInit(unknown1: c_int, gain: c_int, unknown2: c_int) c_int;
// Init audio input (with extra arguments)
//
// @param params - A pointer to a ::pspAudioInputParams struct.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioInputInitEx(params: [*]PspAudioInputParams) c_int;
// Perform audio input (blocking)
//
// @param samplecount - Number of samples.
//
// @param freq - Either 44100, 22050 or 11025.
//
// @param buf - Pointer to where the audio data will be stored.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioInputBlocking(samplecount: c_int, freq: c_int, buf: ?*c_void) c_int;
// Perform audio input
//
// @param samplecount - Number of samples.
//
// @param freq - Either 44100, 22050 or 11025.
//
// @param buf - Pointer to where the audio data will be stored.
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioInput(samplecount: c_int, freq: c_int, buf: ?*c_void) c_int;
// Get the number of samples that were acquired
//
// @return Number of samples acquired, an error if less than 0.
pub extern fn sceAudioGetInputLength() c_int;
// Wait for non-blocking audio input to complete
//
// @return 0 on success, an error if less than 0.
pub extern fn sceAudioWaitInputEnd() c_int;
// Poll for non-blocking audio input status
//
// @return 0 if input has completed, 1 if not completed or an error if less than 0.
pub extern fn sceAudioPollInputEnd() c_int; | src/psp/sdk/pspaudio.zig |
const std = @import("std");
const bench = @import("root");
pub fn setup(gpa: std.mem.Allocator, options: *bench.Options) !void {
_ = gpa;
_ = options;
}
pub fn run(gpa: std.mem.Allocator, context: void) !void {
_ = context;
// Benchmarks ported from https://github.com/martinus/map_benchmark
randomDistinct(gpa);
}
fn randomDistinct(gpa: std.mem.Allocator) void {
const num_iters = 5_000_000;
const _5distinct = num_iters / 20;
const _25distinct = num_iters / 4;
const _50distinct = num_iters / 2;
var rng = Sfc64.init(123);
var checksum: i32 = 0;
{
var map = std.AutoHashMap(i32, i32).init(gpa);
defer map.deinit();
var i: u32 = 0;
while (i < num_iters) : (i += 1) {
const key = @intCast(i32, rng.random().uintLessThan(u32, _5distinct));
var n = map.getOrPutValue(key, 0) catch unreachable;
n.value_ptr.* += 1;
checksum += n.value_ptr.*;
}
if (checksum != 54992517) @panic("bad checksum");
}
{
var map = std.AutoHashMap(i32, i32).init(gpa);
defer map.deinit();
checksum = 0;
var i: u32 = 0;
while (i < num_iters) : (i += 1) {
const key = @intCast(i32, rng.random().uintLessThan(u32, _25distinct));
var n = map.getOrPutValue(key, 0) catch unreachable;
n.value_ptr.* += 1;
checksum += n.value_ptr.*;
}
if (checksum != 15001972) @panic("bad checksum");
}
{
var map = std.AutoHashMap(i32, i32).init(gpa);
defer map.deinit();
checksum = 0;
var i: u32 = 0;
while (i < num_iters) : (i += 1) {
const key = @intCast(i32, rng.random().uintLessThan(u32, _50distinct));
var n = map.getOrPutValue(key, 0) catch unreachable;
n.value_ptr.* += 1;
checksum += n.value_ptr.*;
}
if (checksum != 10001436) @panic("bad checksum");
}
{
var map = std.AutoHashMap(i32, i32).init(gpa);
defer map.deinit();
checksum = 0;
var i: u32 = 0;
while (i < num_iters) : (i += 1) {
const key = @bitCast(i32, @truncate(u32, rng.next()));
var n = map.getOrPutValue(key, 0) catch unreachable;
n.value_ptr.* += 1;
checksum += n.value_ptr.*;
}
if (checksum != 5002904) @panic("bad checksum");
}
}
// Copy of std.rand.Sfc64 with a public next() function. The random API is
// slower than just calling next() and these benchmarks only require getting
// consecutive u64's.
pub const Sfc64 = struct {
a: u64 = undefined,
b: u64 = undefined,
c: u64 = undefined,
counter: u64 = undefined,
const Random = std.rand.Random;
const math = std.math;
const Rotation = 24;
const RightShift = 11;
const LeftShift = 3;
pub fn init(init_s: u64) Sfc64 {
var x = Sfc64{};
x.seed(init_s);
return x;
}
pub fn random(self: *Sfc64) Random {
return Random.init(self, fill);
}
pub fn next(self: *Sfc64) u64 {
const tmp = self.a +% self.b +% self.counter;
self.counter += 1;
self.a = self.b ^ (self.b >> RightShift);
self.b = self.c +% (self.c << LeftShift);
self.c = math.rotl(u64, self.c, Rotation) +% tmp;
return tmp;
}
fn seed(self: *Sfc64, init_s: u64) void {
self.a = init_s;
self.b = init_s;
self.c = init_s;
self.counter = 1;
var i: u32 = 0;
while (i < 12) : (i += 1) {
_ = self.next();
}
}
pub fn fill(self: *Sfc64, buf: []u8) void {
var i: usize = 0;
const aligned_len = buf.len - (buf.len & 7);
// Complete 8 byte segments.
while (i < aligned_len) : (i += 8) {
var n = self.next();
comptime var j: usize = 0;
inline while (j < 8) : (j += 1) {
buf[i + j] = @truncate(u8, n);
n >>= 8;
}
}
// Remaining. (cuts the stream)
if (i != buf.len) {
var n = self.next();
while (i < buf.len) : (i += 1) {
buf[i] = @truncate(u8, n);
n >>= 8;
}
}
}
}; | benchmarks/std-hash-map/random-distinct.zig |
const std = @import("std");
const stdx = @import("stdx");
const graphics = @import("graphics");
const Color = graphics.Color;
const ui = @import("../ui.zig");
const log = stdx.log.scoped(.text);
const NullId = std.math.maxInt(u32);
pub const Text = struct {
props: struct {
text: ?[]const u8,
font_size: f32 = 20,
font_id: graphics.FontId = NullId,
color: Color = Color.Black,
},
tlo: graphics.TextLayout,
use_layout: bool,
const Self = @This();
pub fn init(self: *Self, c: *ui.InitContext) void {
self.tlo = graphics.TextLayout.init(c.alloc);
self.use_layout = false;
}
pub fn deinit(node: *ui.Node, _: std.mem.Allocator) void {
const self = node.getWidget(Self);
self.tlo.deinit();
}
pub fn build(_: *Self, _: *ui.BuildContext) ui.FrameId {
return ui.NullFrameId;
}
pub fn layout(self: *Self, c: *ui.LayoutContext) ui.LayoutSize {
if (self.props.text != null) {
const font_gid = c.getFontGroupForSingleFontOrDefault(self.props.font_id);
const cstr = c.getSizeConstraint();
if (cstr.width == std.math.inf_f32) {
const m = c.measureText(font_gid, self.props.font_size, self.props.text.?);
self.use_layout = false;
return ui.LayoutSize.init(m.width, m.height);
} else {
// Compute text layout. Perform word wrap.
c.textLayout(font_gid, self.props.font_size, self.props.text.?, cstr.width, &self.tlo);
self.use_layout = true;
return ui.LayoutSize.init(self.tlo.width, self.tlo.height);
}
} else {
return ui.LayoutSize.init(0, 0);
}
}
pub fn render(self: *Self, c: *ui.RenderContext) void {
const g = c.g;
const alo = c.getAbsLayout();
if (self.props.text != null) {
if (self.props.font_id == NullId) {
g.setFont(g.getDefaultFontId(), self.props.font_size);
} else {
g.setFont(self.props.font_id, self.props.font_size);
}
g.setFillColor(self.props.color);
if (self.use_layout) {
var y = alo.y;
for (self.tlo.lines.items) |line| {
const text = self.props.text.?[line.start_idx..line.end_idx];
g.fillText(alo.x, y, text);
y += line.height;
}
} else {
g.fillText(alo.x, alo.y, self.props.text.?);
}
}
}
}; | ui/src/widgets/text.zig |
const expect = std.testing.expect;
const expectEqualSlices = std.testing.expectEqualSlices;
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const FixedHeader = @import("../packet.zig").Packet.FixedHeader;
const QoS = @import("../../qos.zig").QoS;
pub const ReturnCode = union(enum) {
success: QoS,
failure: void,
};
pub const SubAck = struct {
packet_id: u16,
return_codes: []ReturnCode,
pub const ParseError = error{
InvalidReturnCode,
};
pub fn parse(fixed_header: FixedHeader, allocator: *Allocator, inner_reader: anytype) !SubAck {
// Hold this so we can query remaining bytes
var limited_reader = std.io.limitedReader(inner_reader, fixed_header.remaining_length);
const reader = limited_reader.reader();
const packet_id = try reader.readIntBig(u16);
var return_codes = ArrayList(ReturnCode).init(allocator);
errdefer return_codes.deinit();
while (limited_reader.bytes_left > 0) {
const rc_byte = try reader.readByte();
const rc = switch (rc_byte) {
0, 1, 2 => ReturnCode{ .success = @intToEnum(QoS, @intCast(u2, rc_byte)) },
0x80 => ReturnCode{ .failure = {} },
else => return error.InvalidReturnCode,
};
try return_codes.append(rc);
}
return SubAck{
.packet_id = packet_id,
.return_codes = return_codes.toOwnedSlice(),
};
}
pub fn serialize(self: SubAck, writer: anytype) !void {
try writer.writeIntBig(u16, self.packet_id);
for (self.return_codes) |return_code| {
switch (return_code) {
.success => |qos| try writer.writeByte(@enumToInt(qos)),
.failure => try writer.writeByte(0x80),
}
}
}
pub fn serializedLength(self: SubAck) u32 {
return comptime @sizeOf(@TypeOf(self.packet_id)) + @intCast(u32, self.return_codes.len);
}
pub fn fixedHeaderFlags(self: SubAck) u4 {
return 0b0000;
}
pub fn deinit(self: *SubAck, allocator: *Allocator) void {
allocator.free(self.return_codes);
}
};
test "SubAck payload parsing" {
const allocator = std.testing.allocator;
const buffer =
// Packet id == 42
"\x00\x2a" ++
// Success return code with QoS 1
"\x01" ++
// Failure return code
"\x80";
const stream = std.io.fixedBufferStream(buffer).reader();
const PacketType = @import("../packet.zig").PacketType;
const fixed_header = FixedHeader{
.packet_type = PacketType.suback,
.flags = 0,
.remaining_length = @intCast(u32, buffer.len),
};
var suback = try SubAck.parse(fixed_header, allocator, stream);
defer suback.deinit(allocator);
try expect(suback.packet_id == 42);
try expect(suback.return_codes.len == 2);
try expect(suback.return_codes[0] == .success);
try expect(suback.return_codes[0].success == .qos1);
try expect(suback.return_codes[1] == .failure);
}
test "serialize/parse roundtrip" {
const allocator = std.testing.allocator;
var return_codes = ArrayList(ReturnCode).init(allocator);
try return_codes.append(ReturnCode{ .failure = {} });
try return_codes.append(ReturnCode{ .success = .qos0 });
var return_codes_slice = return_codes.toOwnedSlice();
defer allocator.free(return_codes_slice);
const suback = SubAck{
.packet_id = 1234,
.return_codes = return_codes_slice,
};
var buffer = [_]u8{0} ** 100;
var stream = std.io.fixedBufferStream(&buffer);
var writer = stream.writer();
try suback.serialize(writer);
const written = try stream.getPos();
stream.reset();
const reader = stream.reader();
const PacketType = @import("../packet.zig").PacketType;
const fixed_header = FixedHeader{
.packet_type = PacketType.suback,
.flags = 0,
.remaining_length = @intCast(u32, written),
};
var deser_suback = try SubAck.parse(fixed_header, allocator, reader);
defer deser_suback.deinit(allocator);
try expect(suback.packet_id == deser_suback.packet_id);
try expectEqualSlices(ReturnCode, suback.return_codes, deser_suback.return_codes);
} | src/mqtt4/packet/suback.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const print = std.debug.print;
const input = @embedFile("../inputs/day11_sample.txt");
// const input = @embedFile("../inputs/day11.txt");
fn printGrid(grid: anytype) void {
for (grid) |row, y| {
for (row) |spot, x| {
print("{c}", .{spot});
}
}
print("\n", .{});
}
fn occupiedAdjacent(grid: anytype, x: usize, y: usize) usize {
var sum: usize = 0;
var y0: usize = std.math.max(1, y) - 1;
while (y0 < std.math.min(grid.len, y + 2)) : (y0 += 1) {
var x0: usize = std.math.max(1, x) - 1;
while (x0 < std.math.min(grid[y].len, x + 2)) : (x0 += 1) {
if (x == x0 and y == y0) continue;
sum += @boolToInt(grid[y0][x0] == '#' or grid[y0][x0] == 'l');
}
}
return sum;
}
const P = struct { x: usize = 0, y: usize = 0 };
const D = struct { x: i8, y: i8 };
fn inBounds(grid: anytype, p: P) bool {
return p.x >= 0 and p.y >= 0 and p.x < grid[0].len - 1 and p.y < grid.len - 1;
}
fn advance(grid: anytype, pos: *P, dir: D) ?u8 {
pos.x += dir.x;
pos.y += dir.y;
return if (inBounds(grid, pos.*)) grid[pos.y][pos.x] else null;
}
fn visibleOccupied(grid: anytype, p: P) usize {
var sum: usize = 0;
var dirs = [_]D{
.{ .x = 1, .y = 0 },
.{ .x = 1, .y = 1 },
.{ .x = 0, .y = 1 },
.{ .x = -1, .y = 1 },
.{ .x = -1, .y = 0 },
.{ .x = -1, .y = -1 },
.{ .x = 0, .y = -1 },
.{ .x = 1, .y = -1 },
};
for (dirs) |d| {
var p0 = p;
sum += while (advance(grid, &p0, d)) |c| {
if (c == '#') break @as(usize, 1);
if (c == 'L') break @as(usize, 0);
} else 0;
}
return sum;
}
fn fillSeats(grid: anytype) void {
var indexes: [grid.len * grid[0].len][2]usize = undefined;
while (true) {
var z: usize = 0;
print("z\n", .{});
for (grid) |row, y| {
for (row) |spot, x| {
switch (spot) {
// 'L' => {
// if (occupiedAdjacent(grid, x, y) == 0) {
// indexes[z] = .{ x, y };
// z += 1;
// }
// },
// '#' => {
// if (occupiedAdjacent(grid, x, y) > 3) {
// indexes[z] = .{ x, y };
// z += 1;
// }
// },
'L' => {
if (visibleOccupied(grid, .{ .x = x, .y = y }) == 0) {
indexes[z] = .{ x, y };
z += 1;
}
},
'#' => {
if (visibleOccupied(grid, .{ .x = x, .y = y }) > 4) {
indexes[z] = .{ x, y };
z += 1;
}
},
else => continue,
}
}
}
if (z == 0) return;
for (indexes[0..z]) |i| {
const c = &grid[i[1]][i[0]];
c.* = switch (c.*) {
'#' => 'L',
'L' => '#',
else => unreachable,
};
}
}
}
pub fn main() !void {
comptime const cols = std.mem.indexOfScalar(u8, input, '\n').?;
comptime const rows = @floatToInt(usize, @ceil(@intToFloat(f32, input.len) / @intToFloat(f32, cols + 1)));
var grid = @bitCast([rows][cols + 1]u8, @as([input.len]u8, input.*));
fillSeats(&grid);
const filled = std.mem.count(u8, &@bitCast([input.len]u8, grid), "#");
printGrid(grid);
print("filled: {}\n", .{filled});
} | src/day11.zig |
const std = @import("std");
const testing = std.testing;
const allocator = std.testing.allocator;
const StringTable = @import("./strtab.zig").StringTable;
pub const Map = struct {
const Caves = std.ArrayList(usize);
slack: bool,
caves: StringTable,
neighbors: std.AutoHashMap(usize, *Caves),
seen: std.AutoHashMap(usize, bool),
paths: StringTable,
pub fn init(slack: bool) Map {
var self = Map{
.slack = slack,
.caves = StringTable.init(allocator),
.neighbors = std.AutoHashMap(usize, *Caves).init(allocator),
.seen = std.AutoHashMap(usize, bool).init(allocator),
.paths = StringTable.init(allocator),
};
return self;
}
pub fn deinit(self: *Map) void {
self.paths.deinit();
self.seen.deinit();
var it = self.neighbors.iterator();
while (it.next()) |entry| {
var caves = entry.value_ptr.*;
caves.*.deinit();
allocator.destroy(caves);
}
self.neighbors.deinit();
self.caves.deinit();
}
pub fn process_line(self: *Map, data: []const u8) !void {
var pos: usize = 0;
var from: usize = 0;
var it = std.mem.split(u8, data, "-");
while (it.next()) |name| : (pos += 1) {
const id = self.caves.add(name);
if (pos == 0) {
from = id;
continue;
}
if (pos == 1) {
try self.add_path(from, id);
try self.add_path(id, from);
continue;
}
unreachable;
}
}
pub fn count_total_paths(self: *Map) usize {
const start = self.caves.get_pos("start") orelse unreachable;
const end = self.caves.get_pos("end") orelse unreachable;
self.seen.put(start, true) catch unreachable;
var path = Caves.init(allocator);
defer path.deinit();
self.walk_caves(0, start, end, &path);
const count = self.paths.size();
// std.debug.warn("FOUND {} paths\n", .{count});
return count;
}
fn add_path(self: *Map, from: usize, to: usize) !void {
// std.debug.warn("Adding path from {} => {}\n", .{ from, to });
var caves: *Caves = undefined;
var entry = self.neighbors.getEntry(from);
if (entry) |e| {
caves = e.value_ptr.*;
} else {
caves = try allocator.create(Caves);
caves.* = Caves.init(allocator);
try self.neighbors.put(from, caves);
}
try caves.*.append(to);
}
fn cave_is_large(self: Map, cave: usize) bool {
const name = self.caves.get_str(cave) orelse unreachable;
return name[0] >= 'A' and name[0] <= 'Z';
}
fn walk_caves(self: *Map, depth: usize, current: usize, end: usize, path: *Caves) void {
if (current == end) {
self.remember_path(path);
return;
}
var neighbors = self.neighbors.get(current) orelse return;
for (neighbors.items) |n| {
if (self.cave_is_large(n)) {
// cave is large, visit without marking as seen
path.*.append(n) catch unreachable;
defer _ = path.*.pop();
self.walk_caves(depth + 1, n, end, path);
continue;
}
const visited: bool = self.seen.get(n) orelse false;
if (visited) continue;
if (self.slack) {
// not used slack yet; use it and visit without marking as seen
self.slack = false;
defer self.slack = true;
path.*.append(n) catch unreachable;
defer _ = path.*.pop();
self.walk_caves(depth + 1, n, end, path);
}
// visit marking as seen
self.seen.put(n, true) catch unreachable;
defer self.seen.put(n, false) catch unreachable;
path.*.append(n) catch unreachable;
defer _ = path.*.pop();
self.walk_caves(depth + 1, n, end, path);
}
}
fn remember_path(self: *Map, path: *Caves) void {
var buf: [10240]u8 = undefined;
var pos: usize = 0;
for (path.*.items) |c| {
if (pos > 0) {
buf[pos] = ':';
pos += 1;
}
// yeah, the index for each cave ends up reversed in the string, but it is still unique...
var x: usize = c;
while (true) {
const d = @intCast(u8, x % 10);
x /= 10;
buf[pos] = d + '0';
pos += 1;
if (x == 0) break;
}
}
// std.debug.warn("REMEMBERING [{s}]\n", .{buf[0..pos]});
_ = self.paths.add(buf[0..pos]);
}
};
test "sample part a 1" {
const data: []const u8 =
\\start-A
\\start-b
\\A-c
\\A-b
\\b-d
\\A-end
\\b-end
;
var map = Map.init(false);
defer map.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
try map.process_line(line);
}
const total_paths = map.count_total_paths();
try testing.expect(total_paths == 10);
}
test "sample part a 2" {
const data: []const u8 =
\\dc-end
\\HN-start
\\start-kj
\\dc-start
\\dc-HN
\\LN-dc
\\HN-end
\\kj-sa
\\kj-HN
\\kj-dc
;
var map = Map.init(false);
defer map.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
try map.process_line(line);
}
const total_paths = map.count_total_paths();
try testing.expect(total_paths == 19);
}
test "sample part a 3" {
const data: []const u8 =
\\fs-end
\\he-DX
\\fs-he
\\start-DX
\\pj-DX
\\end-zg
\\zg-sl
\\zg-pj
\\pj-he
\\RW-he
\\fs-DX
\\pj-RW
\\zg-RW
\\start-pj
\\he-WI
\\zg-he
\\pj-fs
\\start-RW
;
var map = Map.init(false);
defer map.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
try map.process_line(line);
}
const total_paths = map.count_total_paths();
try testing.expect(total_paths == 226);
}
test "sample part b 1" {
const data: []const u8 =
\\start-A
\\start-b
\\A-c
\\A-b
\\b-d
\\A-end
\\b-end
;
var map = Map.init(true);
defer map.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
try map.process_line(line);
}
const total_paths = map.count_total_paths();
try testing.expect(total_paths == 36);
}
test "sample part b 2" {
const data: []const u8 =
\\dc-end
\\HN-start
\\start-kj
\\dc-start
\\dc-HN
\\LN-dc
\\HN-end
\\kj-sa
\\kj-HN
\\kj-dc
;
var map = Map.init(true);
defer map.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
try map.process_line(line);
}
const total_paths = map.count_total_paths();
try testing.expect(total_paths == 103);
}
test "sample part b 3" {
const data: []const u8 =
\\fs-end
\\he-DX
\\fs-he
\\start-DX
\\pj-DX
\\end-zg
\\zg-sl
\\zg-pj
\\pj-he
\\RW-he
\\fs-DX
\\pj-RW
\\zg-RW
\\start-pj
\\he-WI
\\zg-he
\\pj-fs
\\start-RW
;
var map = Map.init(true);
defer map.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
try map.process_line(line);
}
const total_paths = map.count_total_paths();
try testing.expect(total_paths == 3509);
} | 2021/p12/map.zig |
const math = @import("../math/math.zig");
pub const MovementDirection = enum {
up,
left,
right
};
pub const PlayerListener = struct {
onPositionChanged: fn(listener: *PlayerListener, position: math.Vec3)void,
pub fn notifyPositionChanged(self: *PlayerListener, position: math.Vec3)void {
self.onPositionChanged(self, position);
}
};
pub const Player = struct {
movementFlags: [4]bool,
position: math.Vec3,
listener: *PlayerListener,
pub fn init(startPosition: math.Vec3, listener: *PlayerListener) Player {
return Player {
.movementFlags = .{false, false, false, false},
.position = startPosition,
.listener = listener,
};
}
pub fn fixedUpdate(self: *Player) void {
}
pub fn update(self: *Player, dt: f32) void {
const velocity = calculateVelocityFromFlags(self.movementFlags, dt);
self.position = calculateNewPosition(self.position, velocity);
self.listener.notifyPositionChanged(self.position);
}
pub fn onMovement(self: *Player, direction: MovementDirection) void {
const index = indexFromMovementDirection(direction);
self.movementFlags[index] = true;
}
pub fn onStopMovement(self: *Player, direction: MovementDirection) void {
const index = indexFromMovementDirection(direction);
self.movementFlags[index] = false;
}
fn indexFromMovementDirection(direction: MovementDirection) u32 {
return switch(direction) {
MovementDirection.up => 0,
MovementDirection.left => 2,
MovementDirection.right => 3
};
}
fn calculateVelocityFromFlags(currentFlags: [4]bool, dt: f32) math.Vec3 {
const movingLeft = currentFlags[indexFromMovementDirection(MovementDirection.left)];
const movingRight = currentFlags[indexFromMovementDirection(MovementDirection.right)];
var xMovement: f32 = 0;
if (movingLeft) {
xMovement -= 10;
} if (movingRight) {
xMovement += 10;
}
return math.Vec3{
.x = xMovement * dt,
.y = 0.,
.z = 0.,
};
}
fn calculateNewPosition(position: math.Vec3, velocity: math.Vec3) math.Vec3 {
return math.Vec3{
.x = position.x + velocity.x,
.y = position.y + velocity.y,
.z = position.z + velocity.z,
};
}
}; | src/game/player.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const TailQueue = std.TailQueue(IntType);
const Node = TailQueue.Node;
const input = @embedFile("../inputs/day03.txt");
const IntType = u16;
const int_size = @bitSizeOf(IntType);
var real_length: i32 = 0;
pub fn run(alloc: Allocator, stdout_: anytype) !void {
const parsed = try parseInput(alloc);
defer alloc.free(parsed);
const res1 = part1(parsed);
const res2 = try part2(alloc, parsed);
if (stdout_) |stdout| {
try stdout.print("Part 1: {}\n", .{res1});
try stdout.print("Part 2: {}\n", .{res2});
}
}
fn part1(parsed: []IntType) i32 {
var counters: [int_size]i32 = .{0} ** int_size;
for (parsed) |num| {
var i: usize = 0;
while (i < int_size) : (i += 1) {
if (num & getMask(i) != 0) {
counters[i] += 1;
}
}
}
// I could do epsilon = ~gamma, but i wanted to not mess with bits widths
// and just have a nice round u16, so here we are.
var gamma: IntType = 0;
var epsilon: IntType = 0;
for (counters) |counter, i| {
if (i >= real_length) {
break;
}
const mask = getMask(i);
if (2 * counter > parsed.len) {
gamma |= mask;
} else {
epsilon |= mask;
}
}
return @as(i32, epsilon) * @as(i32, gamma);
}
const BitCriteria = enum {
most_common,
least_common,
};
fn part2(alloc: Allocator, parsed: []IntType) !i32 {
var nodes: []Node = try alloc.alloc(Node, parsed.len);
defer alloc.free(nodes);
for (parsed) |num, i| {
nodes[i].data = num;
}
const oxygen_rate = getRate(nodes, BitCriteria.most_common, 1);
const co2_rate = getRate(nodes, BitCriteria.least_common, 0);
return oxygen_rate * co2_rate;
}
fn getRate(nodes: []Node, criteria: BitCriteria, default: u1) i32 {
var list = TailQueue{};
for (nodes) |*node| {
list.prepend(node);
}
var i: i32 = real_length - 1;
while (list.len > 1 and i >= 0) : (i -= 1) {
const bit = findBitByCriteria(i, &list, criteria) orelse default;
const mask = getMask(i);
var curr = list.first;
while (curr) |node| {
if ((node.data & mask == 0) == (bit == 0)) {
const next = node.next;
list.remove(node);
curr = next;
} else {
curr = node.next;
}
}
}
if (list.len == 0) unreachable;
return list.first.?.data;
}
fn findBitByCriteria(idx: i32, list: *TailQueue, criteria: BitCriteria) ?u1 {
const mask = getMask(idx);
var zero_count: i32 = 0;
var curr = list.first;
while (curr) |node| : (curr = node.next) {
if (node.data & mask == 0) {
zero_count += 1;
}
}
if (2 * zero_count > list.len) {
return switch (criteria) {
.least_common => 1,
.most_common => 0,
};
} else if (2 * zero_count < list.len) {
return switch (criteria) {
.least_common => 0,
.most_common => 1,
};
} else {
return null;
}
}
fn getMask(val: anytype) IntType {
return std.math.shl(IntType, 1, val);
}
fn parseInput(alloc: Allocator) ![]IntType {
var lines = std.mem.tokenize(u8, input, "\r\n");
const length = std.mem.count(u8, input, "\n"); // no. of lines
var output: []IntType = try alloc.alloc(IntType, length);
var i: usize = 0;
while (lines.next()) |line| : (i += 1) {
output[i] = try std.fmt.parseUnsigned(IntType, line, 2);
if (real_length == 0) {
real_length = @intCast(i32, line.len);
}
}
return output;
} | src/day03.zig |
const sf = @import("../sfml.zig");
pub const Time = struct {
const Self = @This();
// Constructors
/// Converts a time from a csfml object
/// For inner workings
pub fn fromCSFML(time: sf.c.sfTime) Self {
return Self{ .us = time.microseconds };
}
/// Converts a time to a csfml object
/// For inner workings
pub fn toCSFML(self: Self) sf.c.sfTime {
return sf.c.sfTime{ .microseconds = self.us };
}
/// Creates a time object from a seconds count
pub fn seconds(s: f32) Time {
return Self{ .us = @floatToInt(i64, s * 1_000) * 1_000 };
}
/// Creates a time object from milliseconds
pub fn milliseconds(ms: i32) Time {
return Self{ .us = @intCast(i64, ms) * 1_000 };
}
/// Creates a time object from microseconds
pub fn microseconds(us: i64) Time {
return Self{ .us = us };
}
// Getters
/// Gets this time measurement as microseconds
pub fn asMicroseconds(self: Time) i64 {
return self.us;
}
/// Gets this time measurement as milliseconds
pub fn asMilliseconds(self: Time) i32 {
return @truncate(i32, @divFloor(self.us, 1_000));
}
/// Gets this time measurement as seconds (as a float)
pub fn asSeconds(self: Time) f32 {
return @intToFloat(f32, @divFloor(self.us, 1_000)) / 1_000;
}
// Misc
/// Sleeps the amount of time specified
pub fn sleep(time: Time) void {
sf.c.sfSleep(time.toCSFML());
}
/// A time of zero
pub const Zero = microseconds(0);
us: i64
};
pub const TimeSpan = struct {
const Self = @This();
// Constructors
/// Construcs a time span
pub fn init(begin: Time, length: Time) Self {
return Self{
.offset = begin,
.length = length,
};
}
/// Converts a timespan from a csfml object
/// For inner workings
pub fn fromCSFML(span: sf.c.sfTimeSpan) Self {
return Self{
.offset = sf.Time.fromCSFML(span.offset),
.length = sf.Time.fromCSFML(span.length),
};
}
/// Converts a timespan to a csfml object
/// For inner workings
pub fn toCSFML(self: Self) sf.c.sfTimeSpan {
return sf.c.sfTimeSpan{
.offset = self.offset.toCSFML(),
.length = self.length.toCSFML(),
};
}
/// The beginning of this span
offset: Time,
/// The length of this time span
length: Time,
};
test "time: conversion" {
const tst = @import("std").testing;
var t = Time.microseconds(5_120_000);
tst.expectEqual(@as(i32, 5_120), t.asMilliseconds());
tst.expectWithinMargin(@as(f32, 5.12), t.asSeconds(), 0.0001);
t = Time.seconds(12);
tst.expectWithinMargin(@as(f32, 12), t.asSeconds(), 0.0001);
} | src/sfml/system/time.zig |
const std = @import("std");
const printf = std.debug.print;
const fs = std.fs;
const os = std.os;
const net = std.net;
const fmt = std.fmt;
const math = std.math;
const Address = std.net.Address;
const ArrayList = std.ArrayList;
const Allocator = std.mem.Allocator;
const dev = @import("./src/dev.zig");
const router = @import("./src/router.zig");
const l3tun = @import("./src/l3tun.zig");
const clap = @import("./extern/zig-clap/clap.zig");
pub const io_mode = .evented;
pub fn main() !void {
@setEvalBranchQuota(5000);
const params = comptime [_]clap.Param(clap.Help){
clap.parseParam("-h, --help Display this help and exit.") catch unreachable,
clap.parseParam("-n, --network <IP4> Network in which the interface will operate.") catch unreachable,
clap.parseParam("-m, --netmask <IP4> Netmask for the interface.") catch unreachable,
clap.parseParam("-a, --address <IP4> Address of this machine.") catch unreachable,
clap.parseParam("-d, --device <NAME> Device name to use for the tunnel.") catch unreachable,
clap.parseParam("-p, --port <PORT> Port number to listen on.") catch unreachable,
clap.parseParam("-c, --connect <IP> Connect to a server, port defined by the p flag.") catch unreachable,
clap.parseParam("<POS>...") catch unreachable,
};
var diag: clap.Diagnostic = undefined;
var args = clap.parse(clap.Help, ¶ms, std.heap.page_allocator, &diag) catch |err| {
diag.report(std.io.getStdErr().outStream(), err) catch {};
return err;
};
defer args.deinit();
if (args.flag("--help")) {
try clap.help(std.io.getStdErr().outStream(), ¶ms);
return;
}
var portArg: u16 = 0;
if (args.option("--port")) |port| {
portArg = try fmt.parseInt(u16, port, 10);
} else {
portArg = 8080;
}
const file = fs.cwd().openFile(
"/dev/net/tun",
.{ .read = true, .write = true },
) catch |err| {
printf("{}\n", .{err});
return;
};
defer file.close();
var deviceArg: []const u8 = undefined;
if (args.option("--device")) |device| {
deviceArg = device;
} else {
deviceArg = "tun0";
}
var fdev = try dev.TunDevice.init(deviceArg, file);
var addressArg: []const u8 = undefined;
if (args.option("--address")) |addr| {
addressArg = addr;
} else {
printf("Address option is missing\n", .{});
return;
}
var netmaskArg: []const u8 = undefined;
if (args.option("--netmask")) |mask| {
netmaskArg = mask;
} else {
printf("Netmask option is missing\n", .{});
return;
}
const netmask = try Address.parseIp(netmaskArg, 0);
const address = try Address.parseIp(addressArg, 0);
const routeInfo = dev.IfConfigInfo{
.address = address.any,
.netmask = netmask.any,
};
try fdev.device().ifcfg(routeInfo);
const allocator = std.heap.page_allocator;
var rt = try router.Router.init(allocator, 10, 100);
defer rt.deinit();
var buf: [65536]u8 = undefined;
var p = l3tun.L3Peer.init(fdev.device().fd(), buf[0..]);
try rt.register(&p.peer, 0);
var listen = async serverListen(allocator, portArg, &rt);
printf("router running\n", .{});
try routerRun(&rt);
try await listen;
}
fn routerRun(r: *router.Router) !void {
while (true) {
printf("router run\n", .{});
r.run() catch |err| {
switch (err) {
error.Interrupted => return err,
else => {},
}
};
}
}
fn serverListen(allocator: *Allocator, port: u16, r: *router.Router) !void {
const sock = try os.socket(os.AF_INET, os.SOCK_STREAM, 0);
defer os.close(sock);
var server = net.StreamServer.init(.{});
defer server.deinit();
const address = try Address.parseIp4("0.0.0.0", port);
try server.listen(address);
var list = ArrayList(l3tun.L3Peer).init(allocator);
defer {
for (list.items) |peer| {
allocator.free(peer.buffer);
}
list.deinit();
}
while (true) {
printf("server listening\n", .{});
const conn = try server.accept();
var p = l3tun.L3Peer.init(conn.file.handle, try allocator.alloc(u8, 65536));
try list.append(p);
try r.register(&p.peer, 0);
}
printf("server exiting\n");
}
const PrintingPeer = struct {
peer: router.Peer,
const Self = @This();
pub fn init(socket_fd: i32) PrintingPeer {
return .{
.peer = .{
.socket = socket_fd,
.handleFn = handle,
.address = net.Address.parseIp4("0.0.0.0", 0) catch unreachable,
},
};
}
fn handle(peer: *router.Peer, map: *router.AddressMap) router.Error!void {
const self = @fieldParentPtr(Self, "peer", peer);
var buf: [1024]u8 = undefined;
const count = os.read(peer.socket, buf[0..]) catch return error.HandlerRead;
printf("Read {} bytes: {}\n", .{ count, buf[0..count] });
}
}; | main.zig |
const std = @import("std");
const fmt = std.fmt;
const hash_map = std.hash_map;
const heap = std.heap;
const mem = std.mem;
const testing = std.testing;
const Metric = @import("metric.zig").Metric;
pub const Counter = @import("Counter.zig");
pub const Gauge = @import("Gauge.zig").Gauge;
pub const Histogram = @import("Histogram.zig").Histogram;
pub const GaugeCallFnType = @import("Gauge.zig").GaugeCallFnType;
pub const GetMetricError = error{
// Returned when trying to add a metric to an already full registry.
TooManyMetrics,
// Returned when the name of name is bigger than the configured max_name_len.
NameTooLong,
OutOfMemory,
};
const RegistryOptions = struct {
max_metrics: comptime_int = 8192,
max_name_len: comptime_int = 1024,
};
pub fn Registry(comptime options: RegistryOptions) type {
return struct {
const Self = @This();
const MetricMap = hash_map.StringHashMapUnmanaged(*Metric);
root_allocator: mem.Allocator,
arena_state: heap.ArenaAllocator,
mutex: std.Thread.Mutex,
metrics: MetricMap,
pub fn create(allocator: mem.Allocator) !*Self {
const self = try allocator.create(Self);
self.* = .{
.root_allocator = allocator,
.arena_state = heap.ArenaAllocator.init(allocator),
.mutex = .{},
.metrics = MetricMap{},
};
return self;
}
pub fn destroy(self: *Self) void {
self.arena_state.deinit();
self.root_allocator.destroy(self);
}
fn nbMetrics(self: *const Self) usize {
return self.metrics.count();
}
pub fn getOrCreateCounter(self: *Self, name: []const u8) GetMetricError!*Counter {
if (self.nbMetrics() >= options.max_metrics) return error.TooManyMetrics;
if (name.len > options.max_name_len) return error.NameTooLong;
var allocator = self.arena_state.allocator();
const duped_name = try allocator.dupe(u8, name);
self.mutex.lock();
defer self.mutex.unlock();
var gop = try self.metrics.getOrPut(allocator, duped_name);
if (!gop.found_existing) {
var real_metric = try Counter.init(allocator);
gop.value_ptr.* = &real_metric.metric;
}
return @fieldParentPtr(Counter, "metric", gop.value_ptr.*);
}
pub fn getOrCreateHistogram(self: *Self, name: []const u8) GetMetricError!*Histogram {
if (self.nbMetrics() >= options.max_metrics) return error.TooManyMetrics;
if (name.len > options.max_name_len) return error.NameTooLong;
var allocator = self.arena_state.allocator();
const duped_name = try allocator.dupe(u8, name);
self.mutex.lock();
defer self.mutex.unlock();
var gop = try self.metrics.getOrPut(allocator, duped_name);
if (!gop.found_existing) {
var real_metric = try Histogram.init(allocator);
gop.value_ptr.* = &real_metric.metric;
}
return @fieldParentPtr(Histogram, "metric", gop.value_ptr.*);
}
pub fn getOrCreateGauge(
self: *Self,
name: []const u8,
state: anytype,
comptime callFn: GaugeCallFnType(@TypeOf(state)),
) GetMetricError!*Gauge(@TypeOf(state)) {
if (self.nbMetrics() >= options.max_metrics) return error.TooManyMetrics;
if (name.len > options.max_name_len) return error.NameTooLong;
var allocator = self.arena_state.allocator();
const duped_name = try allocator.dupe(u8, name);
self.mutex.lock();
defer self.mutex.unlock();
var gop = try self.metrics.getOrPut(allocator, duped_name);
if (!gop.found_existing) {
var real_metric = try Gauge(@TypeOf(state)).init(allocator, callFn, state);
gop.value_ptr.* = &real_metric.metric;
}
return @fieldParentPtr(Gauge(@TypeOf(state)), "metric", gop.value_ptr.*);
}
pub fn write(self: *Self, allocator: mem.Allocator, writer: anytype) !void {
var arena_state = heap.ArenaAllocator.init(allocator);
defer arena_state.deinit();
self.mutex.lock();
defer self.mutex.unlock();
try writeMetrics(arena_state.allocator(), self.metrics, writer);
}
fn writeMetrics(allocator: mem.Allocator, map: MetricMap, writer: anytype) !void {
// Get the keys, sorted
const keys = blk: {
var key_list = try std.ArrayList([]const u8).initCapacity(allocator, map.count());
var key_iter = map.keyIterator();
while (key_iter.next()) |key| {
key_list.appendAssumeCapacity(key.*);
}
break :blk key_list.toOwnedSlice();
};
std.sort.sort([]const u8, keys, {}, stringLessThan);
// Write each metric in key order
for (keys) |key| {
var metric = map.get(key) orelse unreachable;
try metric.write(allocator, writer, key);
}
}
};
}
fn stringLessThan(context: void, lhs: []const u8, rhs: []const u8) bool {
_ = context;
return mem.lessThan(u8, lhs, rhs);
}
test "registry getOrCreateCounter" {
var registry = try Registry(.{}).create(testing.allocator);
defer registry.destroy();
const name = try fmt.allocPrint(testing.allocator, "http_requests{{status=\"{d}\"}}", .{500});
defer testing.allocator.free(name);
var i: usize = 0;
while (i < 10) : (i += 1) {
var counter = try registry.getOrCreateCounter(name);
counter.inc();
}
var counter = try registry.getOrCreateCounter(name);
try testing.expectEqual(@as(u64, 10), counter.get());
}
test "registry write" {
const TestCase = struct {
counter_name: []const u8,
gauge_name: []const u8,
histogram_name: []const u8,
exp: []const u8,
};
const exp1 =
\\http_conn_pool_size 4.000000
\\http_request_size_bucket{vmrange="1.292e+02...1.468e+02"} 1
\\http_request_size_bucket{vmrange="4.642e+02...5.275e+02"} 1
\\http_request_size_bucket{vmrange="1.136e+03...1.292e+03"} 1
\\http_request_size_sum 1870.360000
\\http_request_size_count 3
\\http_requests 2
\\
;
const exp2 =
\\http_conn_pool_size{route="/api/v2/users"} 4.000000
\\http_request_size_bucket{route="/api/v2/users",vmrange="1.292e+02...1.468e+02"} 1
\\http_request_size_bucket{route="/api/v2/users",vmrange="4.642e+02...5.275e+02"} 1
\\http_request_size_bucket{route="/api/v2/users",vmrange="1.136e+03...1.292e+03"} 1
\\http_request_size_sum{route="/api/v2/users"} 1870.360000
\\http_request_size_count{route="/api/v2/users"} 3
\\http_requests{route="/api/v2/users"} 2
\\
;
const test_cases = &[_]TestCase{
.{
.counter_name = "http_requests",
.gauge_name = "http_conn_pool_size",
.histogram_name = "http_request_size",
.exp = exp1,
},
.{
.counter_name = "http_requests{route=\"/api/v2/users\"}",
.gauge_name = "http_conn_pool_size{route=\"/api/v2/users\"}",
.histogram_name = "http_request_size{route=\"/api/v2/users\"}",
.exp = exp2,
},
};
inline for (test_cases) |tc| {
var registry = try Registry(.{}).create(testing.allocator);
defer registry.destroy();
// Add some counters
{
var counter = try registry.getOrCreateCounter(tc.counter_name);
counter.set(2);
}
// Add some gauges
{
_ = try registry.getOrCreateGauge(
tc.gauge_name,
@as(f64, 4.0),
struct {
fn get(s: *f64) f64 {
return s.*;
}
}.get,
);
}
// Add an histogram
{
var histogram = try registry.getOrCreateHistogram(tc.histogram_name);
histogram.update(500.12);
histogram.update(1230.240);
histogram.update(140);
}
// Write to a buffer
{
var buffer = std.ArrayList(u8).init(testing.allocator);
defer buffer.deinit();
try registry.write(testing.allocator, buffer.writer());
try testing.expectEqualStrings(tc.exp, buffer.items);
}
// Write to a file
{
const filename = "prometheus_metrics.txt";
var file = try std.fs.cwd().createFile(filename, .{ .read = true });
defer {
file.close();
std.fs.cwd().deleteFile(filename) catch {};
}
try registry.write(testing.allocator, file.writer());
try file.seekTo(0);
const file_data = try file.readToEndAlloc(testing.allocator, std.math.maxInt(usize));
defer testing.allocator.free(file_data);
try testing.expectEqualStrings(tc.exp, file_data);
}
}
}
test "registry options" {
var registry = try Registry(.{ .max_metrics = 1, .max_name_len = 4 }).create(testing.allocator);
defer registry.destroy();
{
try testing.expectError(error.NameTooLong, registry.getOrCreateCounter("hello"));
_ = try registry.getOrCreateCounter("foo");
}
{
try testing.expectError(error.TooManyMetrics, registry.getOrCreateCounter("bar"));
}
}
test "" {
testing.refAllDecls(@This());
} | src/main.zig |
const struct__iobuf = extern struct {
_ptr: [*c]u8,
_cnt: c_int,
_base: [*c]u8,
_flag: c_int,
_file: c_int,
_charbuf: c_int,
_bufsiz: c_int,
_tmpfname: [*c]u8,
};
const FILE = struct__iobuf;
pub const ImGuiID = c_uint;
pub const ImS8 = i8;
pub const ImGuiTableColumnIdx = ImS8; // cimgui.h:2324:10: warning: struct demoted to opaque type - has bitfield
pub const struct_ImGuiTableColumnSettings = opaque {};
pub const ImGuiTableColumnSettings = struct_ImGuiTableColumnSettings;
pub const ImU32 = c_uint;
pub const struct_ImGuiTableCellData = extern struct {
BgColor: ImU32,
Column: ImGuiTableColumnIdx,
};
pub const ImGuiTableCellData = struct_ImGuiTableCellData;
pub const struct_ImGuiStackLevelInfo = extern struct {
ID: ImGuiID,
QueryFrameCount: ImS8,
QuerySuccess: bool,
Desc: [58]u8,
};
pub const ImGuiStackLevelInfo = struct_ImGuiStackLevelInfo;
pub const struct_ImVector_ImGuiStackLevelInfo = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiStackLevelInfo,
};
pub const ImVector_ImGuiStackLevelInfo = struct_ImVector_ImGuiStackLevelInfo;
pub const struct_ImGuiStackTool = extern struct {
LastActiveFrame: c_int,
StackLevel: c_int,
QueryId: ImGuiID,
Results: ImVector_ImGuiStackLevelInfo,
};
pub const ImGuiStackTool = struct_ImGuiStackTool;
pub const ImGuiViewportFlags = c_int;
pub const struct_ImVec2 = extern struct {
x: f32,
y: f32,
};
pub const ImVec2 = struct_ImVec2;
pub const struct_ImGuiViewport = extern struct {
Flags: ImGuiViewportFlags,
Pos: ImVec2,
Size: ImVec2,
WorkPos: ImVec2,
WorkSize: ImVec2,
};
pub const ImGuiViewport = struct_ImGuiViewport;
pub const struct_ImVec4 = extern struct {
x: f32,
y: f32,
z: f32,
w: f32,
};
pub const ImVec4 = struct_ImVec4;
pub const ImTextureID = ?*anyopaque;
pub const ImDrawCallback = ?fn ([*c]const ImDrawList, [*c]const ImDrawCmd) callconv(.C) void;
pub const struct_ImDrawCmd = extern struct {
ClipRect: ImVec4,
TextureId: ImTextureID,
VtxOffset: c_uint,
IdxOffset: c_uint,
ElemCount: c_uint,
UserCallback: ImDrawCallback,
UserCallbackData: ?*anyopaque,
};
pub const ImDrawCmd = struct_ImDrawCmd;
pub const struct_ImVector_ImDrawCmd = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImDrawCmd,
};
pub const ImVector_ImDrawCmd = struct_ImVector_ImDrawCmd;
pub const ImDrawIdx = c_ushort;
pub const struct_ImVector_ImDrawIdx = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImDrawIdx,
};
pub const ImVector_ImDrawIdx = struct_ImVector_ImDrawIdx;
pub const struct_ImDrawVert = extern struct {
pos: ImVec2,
uv: ImVec2,
col: ImU32,
};
pub const ImDrawVert = struct_ImDrawVert;
pub const struct_ImVector_ImDrawVert = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImDrawVert,
};
pub const ImVector_ImDrawVert = struct_ImVector_ImDrawVert;
pub const ImDrawListFlags = c_int;
pub const struct_ImVector_float = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]f32,
};
pub const ImVector_float = struct_ImVector_float;
pub const ImWchar16 = c_ushort;
pub const ImWchar = ImWchar16;
pub const struct_ImVector_ImWchar = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImWchar,
};
pub const ImVector_ImWchar = struct_ImVector_ImWchar; // cimgui.h:1142:18: warning: struct demoted to opaque type - has bitfield
pub const struct_ImFontGlyph = opaque {};
pub const ImFontGlyph = struct_ImFontGlyph;
pub const struct_ImVector_ImFontGlyph = extern struct {
Size: c_int,
Capacity: c_int,
Data: ?*ImFontGlyph,
};
pub const ImVector_ImFontGlyph = struct_ImVector_ImFontGlyph;
pub const ImFontAtlasFlags = c_int;
pub const struct_ImVector_ImFontPtr = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c][*c]ImFont,
};
pub const ImVector_ImFontPtr = struct_ImVector_ImFontPtr;
pub const struct_ImFontAtlasCustomRect = extern struct {
Width: c_ushort,
Height: c_ushort,
X: c_ushort,
Y: c_ushort,
GlyphID: c_uint,
GlyphAdvanceX: f32,
GlyphOffset: ImVec2,
Font: [*c]ImFont,
};
pub const ImFontAtlasCustomRect = struct_ImFontAtlasCustomRect;
pub const struct_ImVector_ImFontAtlasCustomRect = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImFontAtlasCustomRect,
};
pub const ImVector_ImFontAtlasCustomRect = struct_ImVector_ImFontAtlasCustomRect;
pub const struct_ImFontConfig = extern struct {
FontData: ?*anyopaque,
FontDataSize: c_int,
FontDataOwnedByAtlas: bool,
FontNo: c_int,
SizePixels: f32,
OversampleH: c_int,
OversampleV: c_int,
PixelSnapH: bool,
GlyphExtraSpacing: ImVec2,
GlyphOffset: ImVec2,
GlyphRanges: [*c]const ImWchar,
GlyphMinAdvanceX: f32,
GlyphMaxAdvanceX: f32,
MergeMode: bool,
FontBuilderFlags: c_uint,
RasterizerMultiply: f32,
EllipsisChar: ImWchar,
Name: [40]u8,
DstFont: [*c]ImFont,
};
pub const ImFontConfig = struct_ImFontConfig;
pub const struct_ImVector_ImFontConfig = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImFontConfig,
};
pub const ImVector_ImFontConfig = struct_ImVector_ImFontConfig;
pub const struct_ImFontBuilderIO = extern struct {
FontBuilder_Build: ?fn ([*c]ImFontAtlas) callconv(.C) bool,
};
pub const ImFontBuilderIO = struct_ImFontBuilderIO;
pub const struct_ImFontAtlas = extern struct {
Flags: ImFontAtlasFlags,
TexID: ImTextureID,
TexDesiredWidth: c_int,
TexGlyphPadding: c_int,
Locked: bool,
TexReady: bool,
TexPixelsUseColors: bool,
TexPixelsAlpha8: [*c]u8,
TexPixelsRGBA32: [*c]c_uint,
TexWidth: c_int,
TexHeight: c_int,
TexUvScale: ImVec2,
TexUvWhitePixel: ImVec2,
Fonts: ImVector_ImFontPtr,
CustomRects: ImVector_ImFontAtlasCustomRect,
ConfigData: ImVector_ImFontConfig,
TexUvLines: [64]ImVec4,
FontBuilderIO: [*c]const ImFontBuilderIO,
FontBuilderFlags: c_uint,
PackIdMouseCursors: c_int,
PackIdLines: c_int,
};
pub const ImFontAtlas = struct_ImFontAtlas;
pub const ImU8 = u8;
pub const struct_ImFont = extern struct {
IndexAdvanceX: ImVector_float,
FallbackAdvanceX: f32,
FontSize: f32,
IndexLookup: ImVector_ImWchar,
Glyphs: ImVector_ImFontGlyph,
FallbackGlyph: ?*const ImFontGlyph,
ContainerAtlas: [*c]ImFontAtlas,
ConfigData: [*c]const ImFontConfig,
ConfigDataCount: c_short,
FallbackChar: ImWchar,
EllipsisChar: ImWchar,
DotChar: ImWchar,
DirtyLookupTables: bool,
Scale: f32,
Ascent: f32,
Descent: f32,
MetricsTotalSurface: c_int,
Used4kPagesMap: [2]ImU8,
};
pub const ImFont = struct_ImFont;
pub const struct_ImDrawListSharedData = extern struct {
TexUvWhitePixel: ImVec2,
Font: [*c]ImFont,
FontSize: f32,
CurveTessellationTol: f32,
CircleSegmentMaxError: f32,
ClipRectFullscreen: ImVec4,
InitialFlags: ImDrawListFlags,
ArcFastVtx: [48]ImVec2,
ArcFastRadiusCutoff: f32,
CircleSegmentCounts: [64]ImU8,
TexUvLines: [*c]const ImVec4,
};
pub const ImDrawListSharedData = struct_ImDrawListSharedData;
pub const struct_ImVector_ImVec4 = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImVec4,
};
pub const ImVector_ImVec4 = struct_ImVector_ImVec4;
pub const struct_ImVector_ImTextureID = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImTextureID,
};
pub const ImVector_ImTextureID = struct_ImVector_ImTextureID;
pub const struct_ImVector_ImVec2 = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImVec2,
};
pub const ImVector_ImVec2 = struct_ImVector_ImVec2;
pub const struct_ImDrawCmdHeader = extern struct {
ClipRect: ImVec4,
TextureId: ImTextureID,
VtxOffset: c_uint,
};
pub const ImDrawCmdHeader = struct_ImDrawCmdHeader;
pub const struct_ImDrawChannel = extern struct {
_CmdBuffer: ImVector_ImDrawCmd,
_IdxBuffer: ImVector_ImDrawIdx,
};
pub const ImDrawChannel = struct_ImDrawChannel;
pub const struct_ImVector_ImDrawChannel = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImDrawChannel,
};
pub const ImVector_ImDrawChannel = struct_ImVector_ImDrawChannel;
pub const struct_ImDrawListSplitter = extern struct {
_Current: c_int,
_Count: c_int,
_Channels: ImVector_ImDrawChannel,
};
pub const ImDrawListSplitter = struct_ImDrawListSplitter;
pub const struct_ImDrawList = extern struct {
CmdBuffer: ImVector_ImDrawCmd,
IdxBuffer: ImVector_ImDrawIdx,
VtxBuffer: ImVector_ImDrawVert,
Flags: ImDrawListFlags,
_VtxCurrentIdx: c_uint,
_Data: [*c]const ImDrawListSharedData,
_OwnerName: [*c]const u8,
_VtxWritePtr: [*c]ImDrawVert,
_IdxWritePtr: [*c]ImDrawIdx,
_ClipRectStack: ImVector_ImVec4,
_TextureIdStack: ImVector_ImTextureID,
_Path: ImVector_ImVec2,
_CmdHeader: ImDrawCmdHeader,
_Splitter: ImDrawListSplitter,
_FringeScale: f32,
};
pub const ImDrawList = struct_ImDrawList;
pub const struct_ImDrawData = extern struct {
Valid: bool,
CmdListsCount: c_int,
TotalIdxCount: c_int,
TotalVtxCount: c_int,
CmdLists: [*c][*c]ImDrawList,
DisplayPos: ImVec2,
DisplaySize: ImVec2,
FramebufferScale: ImVec2,
};
pub const ImDrawData = struct_ImDrawData;
pub const struct_ImVector_ImDrawListPtr = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c][*c]ImDrawList,
};
pub const ImVector_ImDrawListPtr = struct_ImVector_ImDrawListPtr;
pub const struct_ImDrawDataBuilder = extern struct {
Layers: [2]ImVector_ImDrawListPtr,
};
pub const ImDrawDataBuilder = struct_ImDrawDataBuilder;
pub const struct_ImGuiViewportP = extern struct {
_ImGuiViewport: ImGuiViewport,
DrawListsLastFrame: [2]c_int,
DrawLists: [2][*c]ImDrawList,
DrawDataP: ImDrawData,
DrawDataBuilder: ImDrawDataBuilder,
WorkOffsetMin: ImVec2,
WorkOffsetMax: ImVec2,
BuildWorkOffsetMin: ImVec2,
BuildWorkOffsetMax: ImVec2,
};
pub const ImGuiViewportP = struct_ImGuiViewportP;
pub const struct_ImGuiPtrOrIndex = extern struct {
Ptr: ?*anyopaque,
Index: c_int,
};
pub const ImGuiPtrOrIndex = struct_ImGuiPtrOrIndex;
pub const struct_ImGuiShrinkWidthItem = extern struct {
Index: c_int,
Width: f32,
};
pub const ImGuiShrinkWidthItem = struct_ImGuiShrinkWidthItem;
pub const ImGuiWindowFlags = c_int;
pub const ImGuiDir = c_int; // cimgui.h:2052:15: warning: struct demoted to opaque type - has bitfield
pub const struct_ImGuiWindow = opaque {};
pub const ImGuiWindow = struct_ImGuiWindow;
pub const ImGuiItemFlags = c_int;
pub const ImGuiItemStatusFlags = c_int;
pub const struct_ImRect = extern struct {
Min: ImVec2,
Max: ImVec2,
};
pub const ImRect = struct_ImRect;
pub const struct_ImGuiLastItemData = extern struct {
ID: ImGuiID,
InFlags: ImGuiItemFlags,
StatusFlags: ImGuiItemStatusFlags,
Rect: ImRect,
NavRect: ImRect,
DisplayRect: ImRect,
};
pub const ImGuiLastItemData = struct_ImGuiLastItemData;
pub const struct_ImGuiStackSizes = extern struct {
SizeOfIDStack: c_short,
SizeOfColorStack: c_short,
SizeOfStyleVarStack: c_short,
SizeOfFontStack: c_short,
SizeOfFocusScopeStack: c_short,
SizeOfGroupStack: c_short,
SizeOfItemFlagsStack: c_short,
SizeOfBeginPopupStack: c_short,
SizeOfDisabledStack: c_short,
};
pub const ImGuiStackSizes = struct_ImGuiStackSizes;
pub const struct_ImGuiWindowStackData = extern struct {
Window: ?*ImGuiWindow,
ParentLastItemDataBackup: ImGuiLastItemData,
StackSizesOnBegin: ImGuiStackSizes,
};
pub const ImGuiWindowStackData = struct_ImGuiWindowStackData;
pub const ImGuiLayoutType = c_int;
pub const struct_ImGuiComboPreviewData = extern struct {
PreviewRect: ImRect,
BackupCursorPos: ImVec2,
BackupCursorMaxPos: ImVec2,
BackupCursorPosPrevLine: ImVec2,
BackupPrevLineTextBaseOffset: f32,
BackupLayout: ImGuiLayoutType,
};
pub const ImGuiComboPreviewData = struct_ImGuiComboPreviewData;
pub const struct_ImGuiDataTypeTempStorage = extern struct {
Data: [8]ImU8,
};
pub const ImGuiDataTypeTempStorage = struct_ImGuiDataTypeTempStorage;
pub const struct_ImVec2ih = extern struct {
x: c_short,
y: c_short,
};
pub const ImVec2ih = struct_ImVec2ih;
pub const struct_ImVec1 = extern struct {
x: f32,
};
pub const ImVec1 = struct_ImVec1;
pub const struct_StbTexteditRow = extern struct {
x0: f32,
x1: f32,
baseline_y_delta: f32,
ymin: f32,
ymax: f32,
num_chars: c_int,
};
pub const StbTexteditRow = struct_StbTexteditRow;
pub const struct_StbUndoRecord = extern struct {
where: c_int,
insert_length: c_int,
delete_length: c_int,
char_storage: c_int,
};
pub const StbUndoRecord = struct_StbUndoRecord;
pub const struct_StbUndoState = extern struct {
undo_rec: [99]StbUndoRecord,
undo_char: [999]ImWchar,
undo_point: c_short,
redo_point: c_short,
undo_char_point: c_int,
redo_char_point: c_int,
};
pub const StbUndoState = struct_StbUndoState;
pub const struct_STB_TexteditState = extern struct {
cursor: c_int,
select_start: c_int,
select_end: c_int,
insert_mode: u8,
row_count_per_page: c_int,
cursor_at_end_of_line: u8,
initialized: u8,
has_preferred_x: u8,
single_line: u8,
padding1: u8,
padding2: u8,
padding3: u8,
preferred_x: f32,
undostate: StbUndoState,
};
pub const STB_TexteditState = struct_STB_TexteditState;
pub const struct_ImGuiWindowSettings = extern struct {
ID: ImGuiID,
Pos: ImVec2ih,
Size: ImVec2ih,
Collapsed: bool,
WantApply: bool,
};
pub const ImGuiWindowSettings = struct_ImGuiWindowSettings;
pub const ImU16 = c_ushort;
pub const struct_ImGuiMenuColumns = extern struct {
TotalWidth: ImU32,
NextTotalWidth: ImU32,
Spacing: ImU16,
OffsetIcon: ImU16,
OffsetLabel: ImU16,
OffsetShortcut: ImU16,
OffsetMark: ImU16,
Widths: [4]ImU16,
};
pub const ImGuiMenuColumns = struct_ImGuiMenuColumns;
pub const struct_ImVector_ImGuiWindowPtr = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]?*ImGuiWindow,
};
pub const ImVector_ImGuiWindowPtr = struct_ImVector_ImGuiWindowPtr;
const union_unnamed_2 = extern union {
val_i: c_int,
val_f: f32,
val_p: ?*anyopaque,
};
pub const struct_ImGuiStoragePair = extern struct {
key: ImGuiID,
unnamed_0: union_unnamed_2,
};
pub const ImGuiStoragePair = struct_ImGuiStoragePair;
pub const struct_ImVector_ImGuiStoragePair = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiStoragePair,
};
pub const ImVector_ImGuiStoragePair = struct_ImVector_ImGuiStoragePair;
pub const struct_ImGuiStorage = extern struct {
Data: ImVector_ImGuiStoragePair,
};
pub const ImGuiStorage = struct_ImGuiStorage;
pub const ImGuiOldColumnFlags = c_int;
pub const struct_ImGuiOldColumnData = extern struct {
OffsetNorm: f32,
OffsetNormBeforeResize: f32,
Flags: ImGuiOldColumnFlags,
ClipRect: ImRect,
};
pub const ImGuiOldColumnData = struct_ImGuiOldColumnData;
pub const struct_ImVector_ImGuiOldColumnData = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiOldColumnData,
};
pub const ImVector_ImGuiOldColumnData = struct_ImVector_ImGuiOldColumnData;
pub const struct_ImGuiOldColumns = extern struct {
ID: ImGuiID,
Flags: ImGuiOldColumnFlags,
IsFirstFrame: bool,
IsBeingResized: bool,
Current: c_int,
Count: c_int,
OffMinX: f32,
OffMaxX: f32,
LineMinY: f32,
LineMaxY: f32,
HostCursorPosY: f32,
HostCursorMaxPosX: f32,
HostInitialClipRect: ImRect,
HostBackupClipRect: ImRect,
HostBackupParentWorkRect: ImRect,
Columns: ImVector_ImGuiOldColumnData,
Splitter: ImDrawListSplitter,
};
pub const ImGuiOldColumns = struct_ImGuiOldColumns;
pub const struct_ImGuiWindowTempData = extern struct {
CursorPos: ImVec2,
CursorPosPrevLine: ImVec2,
CursorStartPos: ImVec2,
CursorMaxPos: ImVec2,
IdealMaxPos: ImVec2,
CurrLineSize: ImVec2,
PrevLineSize: ImVec2,
CurrLineTextBaseOffset: f32,
PrevLineTextBaseOffset: f32,
Indent: ImVec1,
ColumnsOffset: ImVec1,
GroupOffset: ImVec1,
NavLayerCurrent: ImGuiNavLayer,
NavLayersActiveMask: c_short,
NavLayersActiveMaskNext: c_short,
NavFocusScopeIdCurrent: ImGuiID,
NavHideHighlightOneFrame: bool,
NavHasScroll: bool,
MenuBarAppending: bool,
MenuBarOffset: ImVec2,
MenuColumns: ImGuiMenuColumns,
TreeDepth: c_int,
TreeJumpToParentOnPopMask: ImU32,
ChildWindows: ImVector_ImGuiWindowPtr,
StateStorage: [*c]ImGuiStorage,
CurrentColumns: [*c]ImGuiOldColumns,
CurrentTableIdx: c_int,
LayoutType: ImGuiLayoutType,
ParentLayoutType: ImGuiLayoutType,
FocusCounterTabStop: c_int,
ItemWidth: f32,
TextWrapPos: f32,
ItemWidthStack: ImVector_float,
TextWrapPosStack: ImVector_float,
};
pub const ImGuiWindowTempData = struct_ImGuiWindowTempData;
pub const struct_ImGuiTableColumnsSettings = opaque {};
pub const ImGuiTableColumnsSettings = struct_ImGuiTableColumnsSettings;
pub const ImGuiTableFlags = c_int;
pub const struct_ImGuiTableSettings = extern struct {
ID: ImGuiID,
SaveFlags: ImGuiTableFlags,
RefScale: f32,
ColumnsCount: ImGuiTableColumnIdx,
ColumnsCountMax: ImGuiTableColumnIdx,
WantApply: bool,
};
pub const ImGuiTableSettings = struct_ImGuiTableSettings;
pub const struct_ImGuiTableTempData = extern struct {
TableIndex: c_int,
LastTimeActive: f32,
UserOuterSize: ImVec2,
DrawSplitter: ImDrawListSplitter,
HostBackupWorkRect: ImRect,
HostBackupParentWorkRect: ImRect,
HostBackupPrevLineSize: ImVec2,
HostBackupCurrLineSize: ImVec2,
HostBackupCursorMaxPos: ImVec2,
HostBackupColumnsOffset: ImVec1,
HostBackupItemWidth: f32,
HostBackupItemWidthStackSize: c_int,
};
pub const ImGuiTableTempData = struct_ImGuiTableTempData;
pub const ImGuiTableColumnFlags = c_int;
pub const ImS16 = c_short;
pub const ImGuiTableDrawChannelIdx = ImU8; // cimgui.h:2186:10: warning: struct demoted to opaque type - has bitfield
pub const struct_ImGuiTableColumn = opaque {};
pub const ImGuiTableColumn = struct_ImGuiTableColumn;
pub const struct_ImSpan_ImGuiTableColumn = extern struct {
Data: ?*ImGuiTableColumn,
DataEnd: ?*ImGuiTableColumn,
};
pub const ImSpan_ImGuiTableColumn = struct_ImSpan_ImGuiTableColumn;
pub const struct_ImSpan_ImGuiTableColumnIdx = extern struct {
Data: [*c]ImGuiTableColumnIdx,
DataEnd: [*c]ImGuiTableColumnIdx,
};
pub const ImSpan_ImGuiTableColumnIdx = struct_ImSpan_ImGuiTableColumnIdx;
pub const struct_ImSpan_ImGuiTableCellData = extern struct {
Data: [*c]ImGuiTableCellData,
DataEnd: [*c]ImGuiTableCellData,
};
pub const ImSpan_ImGuiTableCellData = struct_ImSpan_ImGuiTableCellData;
pub const ImU64 = u64; // cimgui.h:2222:24: warning: struct demoted to opaque type - has bitfield
pub const struct_ImGuiTable = opaque {};
pub const ImGuiTable = struct_ImGuiTable;
pub const ImGuiTabItemFlags = c_int;
pub const ImS32 = c_int;
pub const struct_ImGuiTabItem = extern struct {
ID: ImGuiID,
Flags: ImGuiTabItemFlags,
LastFrameVisible: c_int,
LastFrameSelected: c_int,
Offset: f32,
Width: f32,
ContentWidth: f32,
NameOffset: ImS32,
BeginOrder: ImS16,
IndexDuringLayout: ImS16,
WantClose: bool,
};
pub const ImGuiTabItem = struct_ImGuiTabItem;
pub const struct_ImVector_ImGuiTabItem = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiTabItem,
};
pub const ImVector_ImGuiTabItem = struct_ImVector_ImGuiTabItem;
pub const ImGuiTabBarFlags = c_int;
pub const struct_ImVector_char = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]u8,
};
pub const ImVector_char = struct_ImVector_char;
pub const struct_ImGuiTextBuffer = extern struct {
Buf: ImVector_char,
};
pub const ImGuiTextBuffer = struct_ImGuiTextBuffer;
pub const struct_ImGuiTabBar = extern struct {
Tabs: ImVector_ImGuiTabItem,
Flags: ImGuiTabBarFlags,
ID: ImGuiID,
SelectedTabId: ImGuiID,
NextSelectedTabId: ImGuiID,
VisibleTabId: ImGuiID,
CurrFrameVisible: c_int,
PrevFrameVisible: c_int,
BarRect: ImRect,
CurrTabsContentsHeight: f32,
PrevTabsContentsHeight: f32,
WidthAllTabs: f32,
WidthAllTabsIdeal: f32,
ScrollingAnim: f32,
ScrollingTarget: f32,
ScrollingTargetDistToVisibility: f32,
ScrollingSpeed: f32,
ScrollingRectMinX: f32,
ScrollingRectMaxX: f32,
ReorderRequestTabId: ImGuiID,
ReorderRequestOffset: ImS16,
BeginCount: ImS8,
WantLayout: bool,
VisibleTabWasSubmitted: bool,
TabsAddedNew: bool,
TabsActiveCount: ImS16,
LastTabItemIdx: ImS16,
ItemSpacingY: f32,
FramePadding: ImVec2,
BackupCursorPos: ImVec2,
TabsNames: ImGuiTextBuffer,
};
pub const ImGuiTabBar = struct_ImGuiTabBar;
pub const ImGuiStyleVar = c_int;
const union_unnamed_3 = extern union {
BackupInt: [2]c_int,
BackupFloat: [2]f32,
};
pub const struct_ImGuiStyleMod = extern struct {
VarIdx: ImGuiStyleVar,
unnamed_0: union_unnamed_3,
};
pub const ImGuiStyleMod = struct_ImGuiStyleMod;
pub const ImGuiConfigFlags = c_int;
pub const ImGuiBackendFlags = c_int;
pub const ImGuiKeyModFlags = c_int;
pub const struct_ImGuiIO = extern struct {
ConfigFlags: ImGuiConfigFlags,
BackendFlags: ImGuiBackendFlags,
DisplaySize: ImVec2,
DeltaTime: f32,
IniSavingRate: f32,
IniFilename: [*c]const u8,
LogFilename: [*c]const u8,
MouseDoubleClickTime: f32,
MouseDoubleClickMaxDist: f32,
MouseDragThreshold: f32,
KeyMap: [22]c_int,
KeyRepeatDelay: f32,
KeyRepeatRate: f32,
UserData: ?*anyopaque,
Fonts: [*c]ImFontAtlas,
FontGlobalScale: f32,
FontAllowUserScaling: bool,
FontDefault: [*c]ImFont,
DisplayFramebufferScale: ImVec2,
MouseDrawCursor: bool,
ConfigMacOSXBehaviors: bool,
ConfigInputTextCursorBlink: bool,
ConfigDragClickToInputText: bool,
ConfigWindowsResizeFromEdges: bool,
ConfigWindowsMoveFromTitleBarOnly: bool,
ConfigMemoryCompactTimer: f32,
BackendPlatformName: [*c]const u8,
BackendRendererName: [*c]const u8,
BackendPlatformUserData: ?*anyopaque,
BackendRendererUserData: ?*anyopaque,
BackendLanguageUserData: ?*anyopaque,
GetClipboardTextFn: ?fn (?*anyopaque) callconv(.C) [*c]const u8,
SetClipboardTextFn: ?fn (?*anyopaque, [*c]const u8) callconv(.C) void,
ClipboardUserData: ?*anyopaque,
ImeSetInputScreenPosFn: ?fn (c_int, c_int) callconv(.C) void,
ImeWindowHandle: ?*anyopaque,
MousePos: ImVec2,
MouseDown: [5]bool,
MouseWheel: f32,
MouseWheelH: f32,
KeyCtrl: bool,
KeyShift: bool,
KeyAlt: bool,
KeySuper: bool,
KeysDown: [512]bool,
NavInputs: [20]f32,
WantCaptureMouse: bool,
WantCaptureKeyboard: bool,
WantTextInput: bool,
WantSetMousePos: bool,
WantSaveIniSettings: bool,
NavActive: bool,
NavVisible: bool,
Framerate: f32,
MetricsRenderVertices: c_int,
MetricsRenderIndices: c_int,
MetricsRenderWindows: c_int,
MetricsActiveWindows: c_int,
MetricsActiveAllocations: c_int,
MouseDelta: ImVec2,
WantCaptureMouseUnlessPopupClose: bool,
KeyMods: ImGuiKeyModFlags,
KeyModsPrev: ImGuiKeyModFlags,
MousePosPrev: ImVec2,
MouseClickedPos: [5]ImVec2,
MouseClickedTime: [5]f64,
MouseClicked: [5]bool,
MouseDoubleClicked: [5]bool,
MouseReleased: [5]bool,
MouseDownOwned: [5]bool,
MouseDownOwnedUnlessPopupClose: [5]bool,
MouseDownWasDoubleClick: [5]bool,
MouseDownDuration: [5]f32,
MouseDownDurationPrev: [5]f32,
MouseDragMaxDistanceAbs: [5]ImVec2,
MouseDragMaxDistanceSqr: [5]f32,
KeysDownDuration: [512]f32,
KeysDownDurationPrev: [512]f32,
NavInputsDownDuration: [20]f32,
NavInputsDownDurationPrev: [20]f32,
PenPressure: f32,
AppFocusLost: bool,
InputQueueSurrogate: ImWchar16,
InputQueueCharacters: ImVector_ImWchar,
};
pub const ImGuiIO = struct_ImGuiIO;
pub const struct_ImGuiStyle = extern struct {
Alpha: f32,
DisabledAlpha: f32,
WindowPadding: ImVec2,
WindowRounding: f32,
WindowBorderSize: f32,
WindowMinSize: ImVec2,
WindowTitleAlign: ImVec2,
WindowMenuButtonPosition: ImGuiDir,
ChildRounding: f32,
ChildBorderSize: f32,
PopupRounding: f32,
PopupBorderSize: f32,
FramePadding: ImVec2,
FrameRounding: f32,
FrameBorderSize: f32,
ItemSpacing: ImVec2,
ItemInnerSpacing: ImVec2,
CellPadding: ImVec2,
TouchExtraPadding: ImVec2,
IndentSpacing: f32,
ColumnsMinSpacing: f32,
ScrollbarSize: f32,
ScrollbarRounding: f32,
GrabMinSize: f32,
GrabRounding: f32,
LogSliderDeadzone: f32,
TabRounding: f32,
TabBorderSize: f32,
TabMinWidthForCloseButton: f32,
ColorButtonPosition: ImGuiDir,
ButtonTextAlign: ImVec2,
SelectableTextAlign: ImVec2,
DisplayWindowPadding: ImVec2,
DisplaySafeAreaPadding: ImVec2,
MouseCursorScale: f32,
AntiAliasedLines: bool,
AntiAliasedLinesUseTex: bool,
AntiAliasedFill: bool,
CurveTessellationTol: f32,
CircleTessellationMaxError: f32,
Colors: [53]ImVec4,
};
pub const ImGuiStyle = struct_ImGuiStyle;
pub const struct_ImVector_ImGuiWindowStackData = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiWindowStackData,
};
pub const ImVector_ImGuiWindowStackData = struct_ImVector_ImGuiWindowStackData;
pub const ImGuiNextItemDataFlags = c_int;
pub const ImGuiCond = c_int;
pub const struct_ImGuiNextItemData = extern struct {
Flags: ImGuiNextItemDataFlags,
Width: f32,
FocusScopeId: ImGuiID,
OpenCond: ImGuiCond,
OpenVal: bool,
};
pub const ImGuiNextItemData = struct_ImGuiNextItemData;
pub const ImGuiNextWindowDataFlags = c_int;
pub const struct_ImGuiSizeCallbackData = extern struct {
UserData: ?*anyopaque,
Pos: ImVec2,
CurrentSize: ImVec2,
DesiredSize: ImVec2,
};
pub const ImGuiSizeCallbackData = struct_ImGuiSizeCallbackData;
pub const ImGuiSizeCallback = ?fn ([*c]ImGuiSizeCallbackData) callconv(.C) void;
pub const struct_ImGuiNextWindowData = extern struct {
Flags: ImGuiNextWindowDataFlags,
PosCond: ImGuiCond,
SizeCond: ImGuiCond,
CollapsedCond: ImGuiCond,
PosVal: ImVec2,
PosPivotVal: ImVec2,
SizeVal: ImVec2,
ContentSizeVal: ImVec2,
ScrollVal: ImVec2,
CollapsedVal: bool,
SizeConstraintRect: ImRect,
SizeCallback: ImGuiSizeCallback,
SizeCallbackUserData: ?*anyopaque,
BgAlphaVal: f32,
MenuBarOffsetMinVal: ImVec2,
};
pub const ImGuiNextWindowData = struct_ImGuiNextWindowData;
pub const ImGuiCol = c_int;
pub const struct_ImGuiColorMod = extern struct {
Col: ImGuiCol,
BackupValue: ImVec4,
};
pub const ImGuiColorMod = struct_ImGuiColorMod;
pub const struct_ImVector_ImGuiColorMod = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiColorMod,
};
pub const ImVector_ImGuiColorMod = struct_ImVector_ImGuiColorMod;
pub const struct_ImVector_ImGuiStyleMod = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiStyleMod,
};
pub const ImVector_ImGuiStyleMod = struct_ImVector_ImGuiStyleMod;
pub const struct_ImVector_ImGuiID = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiID,
};
pub const ImVector_ImGuiID = struct_ImVector_ImGuiID;
pub const struct_ImVector_ImGuiItemFlags = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiItemFlags,
};
pub const ImVector_ImGuiItemFlags = struct_ImVector_ImGuiItemFlags;
pub const struct_ImGuiGroupData = extern struct {
WindowID: ImGuiID,
BackupCursorPos: ImVec2,
BackupCursorMaxPos: ImVec2,
BackupIndent: ImVec1,
BackupGroupOffset: ImVec1,
BackupCurrLineSize: ImVec2,
BackupCurrLineTextBaseOffset: f32,
BackupActiveIdIsAlive: ImGuiID,
BackupActiveIdPreviousFrameIsAlive: bool,
BackupHoveredIdIsAlive: bool,
EmitItem: bool,
};
pub const ImGuiGroupData = struct_ImGuiGroupData;
pub const struct_ImVector_ImGuiGroupData = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiGroupData,
};
pub const ImVector_ImGuiGroupData = struct_ImVector_ImGuiGroupData;
pub const struct_ImGuiPopupData = extern struct {
PopupId: ImGuiID,
Window: ?*ImGuiWindow,
SourceWindow: ?*ImGuiWindow,
OpenFrameCount: c_int,
OpenParentId: ImGuiID,
OpenPopupPos: ImVec2,
OpenMousePos: ImVec2,
};
pub const ImGuiPopupData = struct_ImGuiPopupData;
pub const struct_ImVector_ImGuiPopupData = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiPopupData,
};
pub const ImVector_ImGuiPopupData = struct_ImVector_ImGuiPopupData;
pub const struct_ImVector_ImGuiViewportPPtr = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c][*c]ImGuiViewportP,
};
pub const ImVector_ImGuiViewportPPtr = struct_ImVector_ImGuiViewportPPtr;
pub const ImGuiActivateFlags = c_int;
pub const ImGuiNavMoveFlags = c_int;
pub const ImGuiScrollFlags = c_int;
pub const struct_ImGuiNavItemData = extern struct {
Window: ?*ImGuiWindow,
ID: ImGuiID,
FocusScopeId: ImGuiID,
RectRel: ImRect,
InFlags: ImGuiItemFlags,
DistBox: f32,
DistCenter: f32,
DistAxial: f32,
};
pub const ImGuiNavItemData = struct_ImGuiNavItemData;
pub const ImGuiMouseCursor = c_int;
pub const ImGuiDragDropFlags = c_int;
pub const struct_ImGuiPayload = extern struct {
Data: ?*anyopaque,
DataSize: c_int,
SourceId: ImGuiID,
SourceParentId: ImGuiID,
DataFrameCount: c_int,
DataType: [33]u8,
Preview: bool,
Delivery: bool,
};
pub const ImGuiPayload = struct_ImGuiPayload;
pub const struct_ImVector_unsigned_char = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]u8,
};
pub const ImVector_unsigned_char = struct_ImVector_unsigned_char;
pub const struct_ImVector_ImGuiTable = extern struct {
Size: c_int,
Capacity: c_int,
Data: ?*ImGuiTable,
};
pub const ImVector_ImGuiTable = struct_ImVector_ImGuiTable;
pub const ImPoolIdx = c_int;
pub const struct_ImPool_ImGuiTable = extern struct {
Buf: ImVector_ImGuiTable,
Map: ImGuiStorage,
FreeIdx: ImPoolIdx,
};
pub const ImPool_ImGuiTable = struct_ImPool_ImGuiTable;
pub const struct_ImVector_ImGuiTableTempData = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiTableTempData,
};
pub const ImVector_ImGuiTableTempData = struct_ImVector_ImGuiTableTempData;
pub const struct_ImVector_ImGuiTabBar = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiTabBar,
};
pub const ImVector_ImGuiTabBar = struct_ImVector_ImGuiTabBar;
pub const struct_ImPool_ImGuiTabBar = extern struct {
Buf: ImVector_ImGuiTabBar,
Map: ImGuiStorage,
FreeIdx: ImPoolIdx,
};
pub const ImPool_ImGuiTabBar = struct_ImPool_ImGuiTabBar;
pub const struct_ImVector_ImGuiPtrOrIndex = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiPtrOrIndex,
};
pub const ImVector_ImGuiPtrOrIndex = struct_ImVector_ImGuiPtrOrIndex;
pub const struct_ImVector_ImGuiShrinkWidthItem = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiShrinkWidthItem,
};
pub const ImVector_ImGuiShrinkWidthItem = struct_ImVector_ImGuiShrinkWidthItem;
pub const ImGuiInputTextFlags = c_int;
pub const ImGuiKey = c_int;
pub const struct_ImGuiInputTextCallbackData = extern struct {
EventFlag: ImGuiInputTextFlags,
Flags: ImGuiInputTextFlags,
UserData: ?*anyopaque,
EventChar: ImWchar,
EventKey: ImGuiKey,
Buf: [*c]u8,
BufTextLen: c_int,
BufSize: c_int,
BufDirty: bool,
CursorPos: c_int,
SelectionStart: c_int,
SelectionEnd: c_int,
};
pub const ImGuiInputTextCallbackData = struct_ImGuiInputTextCallbackData;
pub const ImGuiInputTextCallback = ?fn ([*c]ImGuiInputTextCallbackData) callconv(.C) c_int;
pub const struct_ImGuiInputTextState = extern struct {
ID: ImGuiID,
CurLenW: c_int,
CurLenA: c_int,
TextW: ImVector_ImWchar,
TextA: ImVector_char,
InitialTextA: ImVector_char,
TextAIsValid: bool,
BufCapacityA: c_int,
ScrollX: f32,
Stb: STB_TexteditState,
CursorAnim: f32,
CursorFollow: bool,
SelectedAllMouseLock: bool,
Edited: bool,
Flags: ImGuiInputTextFlags,
UserCallback: ImGuiInputTextCallback,
UserCallbackData: ?*anyopaque,
};
pub const ImGuiInputTextState = struct_ImGuiInputTextState;
pub const ImGuiColorEditFlags = c_int;
pub const ImGuiSettingsHandler = struct_ImGuiSettingsHandler;
pub const struct_ImVector_ImGuiSettingsHandler = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiSettingsHandler,
};
pub const ImVector_ImGuiSettingsHandler = struct_ImVector_ImGuiSettingsHandler;
pub const struct_ImVector_ImGuiWindowSettings = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiWindowSettings,
};
pub const ImVector_ImGuiWindowSettings = struct_ImVector_ImGuiWindowSettings;
pub const struct_ImChunkStream_ImGuiWindowSettings = extern struct {
Buf: ImVector_ImGuiWindowSettings,
};
pub const ImChunkStream_ImGuiWindowSettings = struct_ImChunkStream_ImGuiWindowSettings;
pub const struct_ImVector_ImGuiTableSettings = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiTableSettings,
};
pub const ImVector_ImGuiTableSettings = struct_ImVector_ImGuiTableSettings;
pub const struct_ImChunkStream_ImGuiTableSettings = extern struct {
Buf: ImVector_ImGuiTableSettings,
};
pub const ImChunkStream_ImGuiTableSettings = struct_ImChunkStream_ImGuiTableSettings;
pub const ImGuiContextHookCallback = ?fn ([*c]ImGuiContext, [*c]ImGuiContextHook) callconv(.C) void;
pub const struct_ImGuiContextHook = extern struct {
HookId: ImGuiID,
Type: ImGuiContextHookType,
Owner: ImGuiID,
Callback: ImGuiContextHookCallback,
UserData: ?*anyopaque,
};
pub const ImGuiContextHook = struct_ImGuiContextHook;
pub const struct_ImVector_ImGuiContextHook = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiContextHook,
};
pub const ImVector_ImGuiContextHook = struct_ImVector_ImGuiContextHook;
pub const ImFileHandle = [*c]FILE;
pub const struct_ImGuiMetricsConfig = extern struct {
ShowStackTool: bool,
ShowWindowsRects: bool,
ShowWindowsBeginOrder: bool,
ShowTablesRects: bool,
ShowDrawCmdMesh: bool,
ShowDrawCmdBoundingBoxes: bool,
ShowWindowsRectsType: c_int,
ShowTablesRectsType: c_int,
};
pub const ImGuiMetricsConfig = struct_ImGuiMetricsConfig;
pub const struct_ImGuiContext = extern struct {
Initialized: bool,
FontAtlasOwnedByContext: bool,
IO: ImGuiIO,
Style: ImGuiStyle,
Font: [*c]ImFont,
FontSize: f32,
FontBaseSize: f32,
DrawListSharedData: ImDrawListSharedData,
Time: f64,
FrameCount: c_int,
FrameCountEnded: c_int,
FrameCountRendered: c_int,
WithinFrameScope: bool,
WithinFrameScopeWithImplicitWindow: bool,
WithinEndChild: bool,
GcCompactAll: bool,
TestEngineHookItems: bool,
TestEngine: ?*anyopaque,
Windows: ImVector_ImGuiWindowPtr,
WindowsFocusOrder: ImVector_ImGuiWindowPtr,
WindowsTempSortBuffer: ImVector_ImGuiWindowPtr,
CurrentWindowStack: ImVector_ImGuiWindowStackData,
WindowsById: ImGuiStorage,
WindowsActiveCount: c_int,
WindowsHoverPadding: ImVec2,
CurrentWindow: ?*ImGuiWindow,
HoveredWindow: ?*ImGuiWindow,
HoveredWindowUnderMovingWindow: ?*ImGuiWindow,
MovingWindow: ?*ImGuiWindow,
WheelingWindow: ?*ImGuiWindow,
WheelingWindowRefMousePos: ImVec2,
WheelingWindowTimer: f32,
DebugHookIdInfo: ImGuiID,
HoveredId: ImGuiID,
HoveredIdPreviousFrame: ImGuiID,
HoveredIdAllowOverlap: bool,
HoveredIdUsingMouseWheel: bool,
HoveredIdPreviousFrameUsingMouseWheel: bool,
HoveredIdDisabled: bool,
HoveredIdTimer: f32,
HoveredIdNotActiveTimer: f32,
ActiveId: ImGuiID,
ActiveIdIsAlive: ImGuiID,
ActiveIdTimer: f32,
ActiveIdIsJustActivated: bool,
ActiveIdAllowOverlap: bool,
ActiveIdNoClearOnFocusLoss: bool,
ActiveIdHasBeenPressedBefore: bool,
ActiveIdHasBeenEditedBefore: bool,
ActiveIdHasBeenEditedThisFrame: bool,
ActiveIdUsingMouseWheel: bool,
ActiveIdUsingNavDirMask: ImU32,
ActiveIdUsingNavInputMask: ImU32,
ActiveIdUsingKeyInputMask: ImU64,
ActiveIdClickOffset: ImVec2,
ActiveIdWindow: ?*ImGuiWindow,
ActiveIdSource: ImGuiInputSource,
ActiveIdMouseButton: c_int,
ActiveIdPreviousFrame: ImGuiID,
ActiveIdPreviousFrameIsAlive: bool,
ActiveIdPreviousFrameHasBeenEditedBefore: bool,
ActiveIdPreviousFrameWindow: ?*ImGuiWindow,
LastActiveId: ImGuiID,
LastActiveIdTimer: f32,
CurrentItemFlags: ImGuiItemFlags,
NextItemData: ImGuiNextItemData,
LastItemData: ImGuiLastItemData,
NextWindowData: ImGuiNextWindowData,
ColorStack: ImVector_ImGuiColorMod,
StyleVarStack: ImVector_ImGuiStyleMod,
FontStack: ImVector_ImFontPtr,
FocusScopeStack: ImVector_ImGuiID,
ItemFlagsStack: ImVector_ImGuiItemFlags,
GroupStack: ImVector_ImGuiGroupData,
OpenPopupStack: ImVector_ImGuiPopupData,
BeginPopupStack: ImVector_ImGuiPopupData,
Viewports: ImVector_ImGuiViewportPPtr,
NavWindow: ?*ImGuiWindow,
NavId: ImGuiID,
NavFocusScopeId: ImGuiID,
NavActivateId: ImGuiID,
NavActivateDownId: ImGuiID,
NavActivatePressedId: ImGuiID,
NavActivateInputId: ImGuiID,
NavActivateFlags: ImGuiActivateFlags,
NavJustTabbedId: ImGuiID,
NavJustMovedToId: ImGuiID,
NavJustMovedToFocusScopeId: ImGuiID,
NavJustMovedToKeyMods: ImGuiKeyModFlags,
NavNextActivateId: ImGuiID,
NavNextActivateFlags: ImGuiActivateFlags,
NavInputSource: ImGuiInputSource,
NavLayer: ImGuiNavLayer,
NavIdTabCounter: c_int,
NavIdIsAlive: bool,
NavMousePosDirty: bool,
NavDisableHighlight: bool,
NavDisableMouseHover: bool,
NavAnyRequest: bool,
NavInitRequest: bool,
NavInitRequestFromMove: bool,
NavInitResultId: ImGuiID,
NavInitResultRectRel: ImRect,
NavMoveSubmitted: bool,
NavMoveScoringItems: bool,
NavMoveForwardToNextFrame: bool,
NavMoveFlags: ImGuiNavMoveFlags,
NavMoveScrollFlags: ImGuiScrollFlags,
NavMoveKeyMods: ImGuiKeyModFlags,
NavMoveDir: ImGuiDir,
NavMoveDirForDebug: ImGuiDir,
NavMoveClipDir: ImGuiDir,
NavScoringRect: ImRect,
NavScoringDebugCount: c_int,
NavTabbingInputableRemaining: c_int,
NavMoveResultLocal: ImGuiNavItemData,
NavMoveResultLocalVisible: ImGuiNavItemData,
NavMoveResultOther: ImGuiNavItemData,
NavWindowingTarget: ?*ImGuiWindow,
NavWindowingTargetAnim: ?*ImGuiWindow,
NavWindowingListWindow: ?*ImGuiWindow,
NavWindowingTimer: f32,
NavWindowingHighlightAlpha: f32,
NavWindowingToggleLayer: bool,
TabFocusRequestCurrWindow: ?*ImGuiWindow,
TabFocusRequestNextWindow: ?*ImGuiWindow,
TabFocusRequestCurrCounterTabStop: c_int,
TabFocusRequestNextCounterTabStop: c_int,
TabFocusPressed: bool,
DimBgRatio: f32,
MouseCursor: ImGuiMouseCursor,
DragDropActive: bool,
DragDropWithinSource: bool,
DragDropWithinTarget: bool,
DragDropSourceFlags: ImGuiDragDropFlags,
DragDropSourceFrameCount: c_int,
DragDropMouseButton: c_int,
DragDropPayload: ImGuiPayload,
DragDropTargetRect: ImRect,
DragDropTargetId: ImGuiID,
DragDropAcceptFlags: ImGuiDragDropFlags,
DragDropAcceptIdCurrRectSurface: f32,
DragDropAcceptIdCurr: ImGuiID,
DragDropAcceptIdPrev: ImGuiID,
DragDropAcceptFrameCount: c_int,
DragDropHoldJustPressedId: ImGuiID,
DragDropPayloadBufHeap: ImVector_unsigned_char,
DragDropPayloadBufLocal: [16]u8,
CurrentTable: ?*ImGuiTable,
CurrentTableStackIdx: c_int,
Tables: ImPool_ImGuiTable,
TablesTempDataStack: ImVector_ImGuiTableTempData,
TablesLastTimeActive: ImVector_float,
DrawChannelsTempMergeBuffer: ImVector_ImDrawChannel,
CurrentTabBar: [*c]ImGuiTabBar,
TabBars: ImPool_ImGuiTabBar,
CurrentTabBarStack: ImVector_ImGuiPtrOrIndex,
ShrinkWidthBuffer: ImVector_ImGuiShrinkWidthItem,
MouseLastValidPos: ImVec2,
InputTextState: ImGuiInputTextState,
InputTextPasswordFont: ImFont,
TempInputId: ImGuiID,
ColorEditOptions: ImGuiColorEditFlags,
ColorEditLastHue: f32,
ColorEditLastSat: f32,
ColorEditLastColor: ImU32,
ColorPickerRef: ImVec4,
ComboPreviewData: ImGuiComboPreviewData,
SliderCurrentAccum: f32,
SliderCurrentAccumDirty: bool,
DragCurrentAccumDirty: bool,
DragCurrentAccum: f32,
DragSpeedDefaultRatio: f32,
ScrollbarClickDeltaToGrabCenter: f32,
DisabledAlphaBackup: f32,
DisabledStackSize: c_short,
TooltipOverrideCount: c_short,
TooltipSlowDelay: f32,
ClipboardHandlerData: ImVector_char,
MenusIdSubmittedThisFrame: ImVector_ImGuiID,
PlatformImePos: ImVec2,
PlatformImeLastPos: ImVec2,
PlatformLocaleDecimalPoint: u8,
SettingsLoaded: bool,
SettingsDirtyTimer: f32,
SettingsIniData: ImGuiTextBuffer,
SettingsHandlers: ImVector_ImGuiSettingsHandler,
SettingsWindows: ImChunkStream_ImGuiWindowSettings,
SettingsTables: ImChunkStream_ImGuiTableSettings,
Hooks: ImVector_ImGuiContextHook,
HookIdNext: ImGuiID,
LogEnabled: bool,
LogType: ImGuiLogType,
LogFile: ImFileHandle,
LogBuffer: ImGuiTextBuffer,
LogNextPrefix: [*c]const u8,
LogNextSuffix: [*c]const u8,
LogLinePosY: f32,
LogLineFirstItem: bool,
LogDepthRef: c_int,
LogDepthToExpand: c_int,
LogDepthToExpandDefault: c_int,
DebugItemPickerActive: bool,
DebugItemPickerBreakId: ImGuiID,
DebugMetricsConfig: ImGuiMetricsConfig,
DebugStackTool: ImGuiStackTool,
FramerateSecPerFrame: [120]f32,
FramerateSecPerFrameIdx: c_int,
FramerateSecPerFrameCount: c_int,
FramerateSecPerFrameAccum: f32,
WantCaptureMouseNextFrame: c_int,
WantCaptureKeyboardNextFrame: c_int,
WantTextInputNextFrame: c_int,
TempBuffer: [3073]u8,
};
pub const ImGuiContext = struct_ImGuiContext;
pub const struct_ImGuiSettingsHandler = extern struct {
TypeName: [*c]const u8,
TypeHash: ImGuiID,
ClearAllFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler) callconv(.C) void,
ReadInitFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler) callconv(.C) void,
ReadOpenFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler, [*c]const u8) callconv(.C) ?*anyopaque,
ReadLineFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler, ?*anyopaque, [*c]const u8) callconv(.C) void,
ApplyAllFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler) callconv(.C) void,
WriteAllFn: ?fn ([*c]ImGuiContext, [*c]ImGuiSettingsHandler, [*c]ImGuiTextBuffer) callconv(.C) void,
UserData: ?*anyopaque,
};
pub const struct_ImGuiDataTypeInfo = extern struct {
Size: usize,
Name: [*c]const u8,
PrintFmt: [*c]const u8,
ScanFmt: [*c]const u8,
};
pub const ImGuiDataTypeInfo = struct_ImGuiDataTypeInfo;
pub const struct_ImVector_ImU32 = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImU32,
};
pub const ImVector_ImU32 = struct_ImVector_ImU32;
pub const struct_ImBitVector = extern struct {
Storage: ImVector_ImU32,
};
pub const ImBitVector = struct_ImBitVector;
pub const struct_ImGuiTextRange = extern struct {
b: [*c]const u8,
e: [*c]const u8,
};
pub const ImGuiTextRange = struct_ImGuiTextRange;
pub const struct_ImVector_ImGuiTextRange = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiTextRange,
};
pub const ImVector_ImGuiTextRange = struct_ImVector_ImGuiTextRange;
pub const struct_ImGuiTextFilter = extern struct {
InputBuf: [256]u8,
Filters: ImVector_ImGuiTextRange,
CountGrep: c_int,
};
pub const ImGuiTextFilter = struct_ImGuiTextFilter; // cimgui.h:979:24: warning: struct demoted to opaque type - has bitfield
pub const struct_ImGuiTableColumnSortSpecs = opaque {};
pub const ImGuiTableColumnSortSpecs = struct_ImGuiTableColumnSortSpecs;
pub const struct_ImGuiTableSortSpecs = extern struct {
Specs: ?*const ImGuiTableColumnSortSpecs,
SpecsCount: c_int,
SpecsDirty: bool,
};
pub const ImGuiTableSortSpecs = struct_ImGuiTableSortSpecs;
pub const struct_ImGuiOnceUponAFrame = extern struct {
RefFrame: c_int,
};
pub const ImGuiOnceUponAFrame = struct_ImGuiOnceUponAFrame;
pub const struct_ImGuiListClipper = extern struct {
DisplayStart: c_int,
DisplayEnd: c_int,
ItemsCount: c_int,
StepNo: c_int,
ItemsFrozen: c_int,
ItemsHeight: f32,
StartPosY: f32,
};
pub const ImGuiListClipper = struct_ImGuiListClipper;
pub const struct_ImColor = extern struct {
Value: ImVec4,
};
pub const ImColor = struct_ImColor;
pub const struct_ImFontGlyphRangesBuilder = extern struct {
UsedChars: ImVector_ImU32,
};
pub const ImFontGlyphRangesBuilder = struct_ImFontGlyphRangesBuilder;
pub const ImGuiDataType = c_int;
pub const ImGuiNavInput = c_int;
pub const ImGuiMouseButton = c_int;
pub const ImGuiSortDirection = c_int;
pub const ImGuiTableBgTarget = c_int;
pub const ImDrawFlags = c_int;
pub const ImGuiButtonFlags = c_int;
pub const ImGuiComboFlags = c_int;
pub const ImGuiFocusedFlags = c_int;
pub const ImGuiHoveredFlags = c_int;
pub const ImGuiPopupFlags = c_int;
pub const ImGuiSelectableFlags = c_int;
pub const ImGuiSliderFlags = c_int;
pub const ImGuiTableRowFlags = c_int;
pub const ImGuiTreeNodeFlags = c_int;
pub const ImS64 = i64;
pub const ImWchar32 = c_uint;
pub const ImGuiMemAllocFunc = ?fn (usize, ?*anyopaque) callconv(.C) ?*anyopaque;
pub const ImGuiMemFreeFunc = ?fn (?*anyopaque, ?*anyopaque) callconv(.C) void;
pub const ImGuiNavHighlightFlags = c_int;
pub const ImGuiNavDirSourceFlags = c_int;
pub const ImGuiSeparatorFlags = c_int;
pub const ImGuiTextFlags = c_int;
pub const ImGuiTooltipFlags = c_int;
pub const ImGuiErrorLogCallback = ?fn (?*anyopaque, [*c]const u8, ...) callconv(.C) void;
pub extern var GImGui: [*c]ImGuiContext;
pub const struct_ImVector = extern struct {
Size: c_int,
Capacity: c_int,
Data: ?*anyopaque,
};
pub const ImVector = struct_ImVector;
pub const struct_ImVector_ImGuiOldColumns = extern struct {
Size: c_int,
Capacity: c_int,
Data: [*c]ImGuiOldColumns,
};
pub const ImVector_ImGuiOldColumns = struct_ImVector_ImGuiOldColumns;
pub const struct_ImVector_ImGuiTableColumnSortSpecs = extern struct {
Size: c_int,
Capacity: c_int,
Data: ?*ImGuiTableColumnSortSpecs,
};
pub const ImVector_ImGuiTableColumnSortSpecs = struct_ImVector_ImGuiTableColumnSortSpecs;
pub const ImGuiWindowFlags_None: c_int = 0;
pub const ImGuiWindowFlags_NoTitleBar: c_int = 1;
pub const ImGuiWindowFlags_NoResize: c_int = 2;
pub const ImGuiWindowFlags_NoMove: c_int = 4;
pub const ImGuiWindowFlags_NoScrollbar: c_int = 8;
pub const ImGuiWindowFlags_NoScrollWithMouse: c_int = 16;
pub const ImGuiWindowFlags_NoCollapse: c_int = 32;
pub const ImGuiWindowFlags_AlwaysAutoResize: c_int = 64;
pub const ImGuiWindowFlags_NoBackground: c_int = 128;
pub const ImGuiWindowFlags_NoSavedSettings: c_int = 256;
pub const ImGuiWindowFlags_NoMouseInputs: c_int = 512;
pub const ImGuiWindowFlags_MenuBar: c_int = 1024;
pub const ImGuiWindowFlags_HorizontalScrollbar: c_int = 2048;
pub const ImGuiWindowFlags_NoFocusOnAppearing: c_int = 4096;
pub const ImGuiWindowFlags_NoBringToFrontOnFocus: c_int = 8192;
pub const ImGuiWindowFlags_AlwaysVerticalScrollbar: c_int = 16384;
pub const ImGuiWindowFlags_AlwaysHorizontalScrollbar: c_int = 32768;
pub const ImGuiWindowFlags_AlwaysUseWindowPadding: c_int = 65536;
pub const ImGuiWindowFlags_NoNavInputs: c_int = 262144;
pub const ImGuiWindowFlags_NoNavFocus: c_int = 524288;
pub const ImGuiWindowFlags_UnsavedDocument: c_int = 1048576;
pub const ImGuiWindowFlags_NoNav: c_int = 786432;
pub const ImGuiWindowFlags_NoDecoration: c_int = 43;
pub const ImGuiWindowFlags_NoInputs: c_int = 786944;
pub const ImGuiWindowFlags_NavFlattened: c_int = 8388608;
pub const ImGuiWindowFlags_ChildWindow: c_int = 16777216;
pub const ImGuiWindowFlags_Tooltip: c_int = 33554432;
pub const ImGuiWindowFlags_Popup: c_int = 67108864;
pub const ImGuiWindowFlags_Modal: c_int = 134217728;
pub const ImGuiWindowFlags_ChildMenu: c_int = 268435456;
pub const ImGuiWindowFlags_ = c_uint;
pub const ImGuiInputTextFlags_None: c_int = 0;
pub const ImGuiInputTextFlags_CharsDecimal: c_int = 1;
pub const ImGuiInputTextFlags_CharsHexadecimal: c_int = 2;
pub const ImGuiInputTextFlags_CharsUppercase: c_int = 4;
pub const ImGuiInputTextFlags_CharsNoBlank: c_int = 8;
pub const ImGuiInputTextFlags_AutoSelectAll: c_int = 16;
pub const ImGuiInputTextFlags_EnterReturnsTrue: c_int = 32;
pub const ImGuiInputTextFlags_CallbackCompletion: c_int = 64;
pub const ImGuiInputTextFlags_CallbackHistory: c_int = 128;
pub const ImGuiInputTextFlags_CallbackAlways: c_int = 256;
pub const ImGuiInputTextFlags_CallbackCharFilter: c_int = 512;
pub const ImGuiInputTextFlags_AllowTabInput: c_int = 1024;
pub const ImGuiInputTextFlags_CtrlEnterForNewLine: c_int = 2048;
pub const ImGuiInputTextFlags_NoHorizontalScroll: c_int = 4096;
pub const ImGuiInputTextFlags_AlwaysOverwrite: c_int = 8192;
pub const ImGuiInputTextFlags_ReadOnly: c_int = 16384;
pub const ImGuiInputTextFlags_Password: c_int = 32768;
pub const ImGuiInputTextFlags_NoUndoRedo: c_int = 65536;
pub const ImGuiInputTextFlags_CharsScientific: c_int = 131072;
pub const ImGuiInputTextFlags_CallbackResize: c_int = 262144;
pub const ImGuiInputTextFlags_CallbackEdit: c_int = 524288;
pub const ImGuiInputTextFlags_ = c_uint;
pub const ImGuiTreeNodeFlags_None: c_int = 0;
pub const ImGuiTreeNodeFlags_Selected: c_int = 1;
pub const ImGuiTreeNodeFlags_Framed: c_int = 2;
pub const ImGuiTreeNodeFlags_AllowItemOverlap: c_int = 4;
pub const ImGuiTreeNodeFlags_NoTreePushOnOpen: c_int = 8;
pub const ImGuiTreeNodeFlags_NoAutoOpenOnLog: c_int = 16;
pub const ImGuiTreeNodeFlags_DefaultOpen: c_int = 32;
pub const ImGuiTreeNodeFlags_OpenOnDoubleClick: c_int = 64;
pub const ImGuiTreeNodeFlags_OpenOnArrow: c_int = 128;
pub const ImGuiTreeNodeFlags_Leaf: c_int = 256;
pub const ImGuiTreeNodeFlags_Bullet: c_int = 512;
pub const ImGuiTreeNodeFlags_FramePadding: c_int = 1024;
pub const ImGuiTreeNodeFlags_SpanAvailWidth: c_int = 2048;
pub const ImGuiTreeNodeFlags_SpanFullWidth: c_int = 4096;
pub const ImGuiTreeNodeFlags_NavLeftJumpsBackHere: c_int = 8192;
pub const ImGuiTreeNodeFlags_CollapsingHeader: c_int = 26;
pub const ImGuiTreeNodeFlags_ = c_uint;
pub const ImGuiPopupFlags_None: c_int = 0;
pub const ImGuiPopupFlags_MouseButtonLeft: c_int = 0;
pub const ImGuiPopupFlags_MouseButtonRight: c_int = 1;
pub const ImGuiPopupFlags_MouseButtonMiddle: c_int = 2;
pub const ImGuiPopupFlags_MouseButtonMask_: c_int = 31;
pub const ImGuiPopupFlags_MouseButtonDefault_: c_int = 1;
pub const ImGuiPopupFlags_NoOpenOverExistingPopup: c_int = 32;
pub const ImGuiPopupFlags_NoOpenOverItems: c_int = 64;
pub const ImGuiPopupFlags_AnyPopupId: c_int = 128;
pub const ImGuiPopupFlags_AnyPopupLevel: c_int = 256;
pub const ImGuiPopupFlags_AnyPopup: c_int = 384;
pub const ImGuiPopupFlags_ = c_uint;
pub const ImGuiSelectableFlags_None: c_int = 0;
pub const ImGuiSelectableFlags_DontClosePopups: c_int = 1;
pub const ImGuiSelectableFlags_SpanAllColumns: c_int = 2;
pub const ImGuiSelectableFlags_AllowDoubleClick: c_int = 4;
pub const ImGuiSelectableFlags_Disabled: c_int = 8;
pub const ImGuiSelectableFlags_AllowItemOverlap: c_int = 16;
pub const ImGuiSelectableFlags_ = c_uint;
pub const ImGuiComboFlags_None: c_int = 0;
pub const ImGuiComboFlags_PopupAlignLeft: c_int = 1;
pub const ImGuiComboFlags_HeightSmall: c_int = 2;
pub const ImGuiComboFlags_HeightRegular: c_int = 4;
pub const ImGuiComboFlags_HeightLarge: c_int = 8;
pub const ImGuiComboFlags_HeightLargest: c_int = 16;
pub const ImGuiComboFlags_NoArrowButton: c_int = 32;
pub const ImGuiComboFlags_NoPreview: c_int = 64;
pub const ImGuiComboFlags_HeightMask_: c_int = 30;
pub const ImGuiComboFlags_ = c_uint;
pub const ImGuiTabBarFlags_None: c_int = 0;
pub const ImGuiTabBarFlags_Reorderable: c_int = 1;
pub const ImGuiTabBarFlags_AutoSelectNewTabs: c_int = 2;
pub const ImGuiTabBarFlags_TabListPopupButton: c_int = 4;
pub const ImGuiTabBarFlags_NoCloseWithMiddleMouseButton: c_int = 8;
pub const ImGuiTabBarFlags_NoTabListScrollingButtons: c_int = 16;
pub const ImGuiTabBarFlags_NoTooltip: c_int = 32;
pub const ImGuiTabBarFlags_FittingPolicyResizeDown: c_int = 64;
pub const ImGuiTabBarFlags_FittingPolicyScroll: c_int = 128;
pub const ImGuiTabBarFlags_FittingPolicyMask_: c_int = 192;
pub const ImGuiTabBarFlags_FittingPolicyDefault_: c_int = 64;
pub const ImGuiTabBarFlags_ = c_uint;
pub const ImGuiTabItemFlags_None: c_int = 0;
pub const ImGuiTabItemFlags_UnsavedDocument: c_int = 1;
pub const ImGuiTabItemFlags_SetSelected: c_int = 2;
pub const ImGuiTabItemFlags_NoCloseWithMiddleMouseButton: c_int = 4;
pub const ImGuiTabItemFlags_NoPushId: c_int = 8;
pub const ImGuiTabItemFlags_NoTooltip: c_int = 16;
pub const ImGuiTabItemFlags_NoReorder: c_int = 32;
pub const ImGuiTabItemFlags_Leading: c_int = 64;
pub const ImGuiTabItemFlags_Trailing: c_int = 128;
pub const ImGuiTabItemFlags_ = c_uint;
pub const ImGuiTableFlags_None: c_int = 0;
pub const ImGuiTableFlags_Resizable: c_int = 1;
pub const ImGuiTableFlags_Reorderable: c_int = 2;
pub const ImGuiTableFlags_Hideable: c_int = 4;
pub const ImGuiTableFlags_Sortable: c_int = 8;
pub const ImGuiTableFlags_NoSavedSettings: c_int = 16;
pub const ImGuiTableFlags_ContextMenuInBody: c_int = 32;
pub const ImGuiTableFlags_RowBg: c_int = 64;
pub const ImGuiTableFlags_BordersInnerH: c_int = 128;
pub const ImGuiTableFlags_BordersOuterH: c_int = 256;
pub const ImGuiTableFlags_BordersInnerV: c_int = 512;
pub const ImGuiTableFlags_BordersOuterV: c_int = 1024;
pub const ImGuiTableFlags_BordersH: c_int = 384;
pub const ImGuiTableFlags_BordersV: c_int = 1536;
pub const ImGuiTableFlags_BordersInner: c_int = 640;
pub const ImGuiTableFlags_BordersOuter: c_int = 1280;
pub const ImGuiTableFlags_Borders: c_int = 1920;
pub const ImGuiTableFlags_NoBordersInBody: c_int = 2048;
pub const ImGuiTableFlags_NoBordersInBodyUntilResize: c_int = 4096;
pub const ImGuiTableFlags_SizingFixedFit: c_int = 8192;
pub const ImGuiTableFlags_SizingFixedSame: c_int = 16384;
pub const ImGuiTableFlags_SizingStretchProp: c_int = 24576;
pub const ImGuiTableFlags_SizingStretchSame: c_int = 32768;
pub const ImGuiTableFlags_NoHostExtendX: c_int = 65536;
pub const ImGuiTableFlags_NoHostExtendY: c_int = 131072;
pub const ImGuiTableFlags_NoKeepColumnsVisible: c_int = 262144;
pub const ImGuiTableFlags_PreciseWidths: c_int = 524288;
pub const ImGuiTableFlags_NoClip: c_int = 1048576;
pub const ImGuiTableFlags_PadOuterX: c_int = 2097152;
pub const ImGuiTableFlags_NoPadOuterX: c_int = 4194304;
pub const ImGuiTableFlags_NoPadInnerX: c_int = 8388608;
pub const ImGuiTableFlags_ScrollX: c_int = 16777216;
pub const ImGuiTableFlags_ScrollY: c_int = 33554432;
pub const ImGuiTableFlags_SortMulti: c_int = 67108864;
pub const ImGuiTableFlags_SortTristate: c_int = 134217728;
pub const ImGuiTableFlags_SizingMask_: c_int = 57344;
pub const ImGuiTableFlags_ = c_uint;
pub const ImGuiTableColumnFlags_None: c_int = 0;
pub const ImGuiTableColumnFlags_Disabled: c_int = 1;
pub const ImGuiTableColumnFlags_DefaultHide: c_int = 2;
pub const ImGuiTableColumnFlags_DefaultSort: c_int = 4;
pub const ImGuiTableColumnFlags_WidthStretch: c_int = 8;
pub const ImGuiTableColumnFlags_WidthFixed: c_int = 16;
pub const ImGuiTableColumnFlags_NoResize: c_int = 32;
pub const ImGuiTableColumnFlags_NoReorder: c_int = 64;
pub const ImGuiTableColumnFlags_NoHide: c_int = 128;
pub const ImGuiTableColumnFlags_NoClip: c_int = 256;
pub const ImGuiTableColumnFlags_NoSort: c_int = 512;
pub const ImGuiTableColumnFlags_NoSortAscending: c_int = 1024;
pub const ImGuiTableColumnFlags_NoSortDescending: c_int = 2048;
pub const ImGuiTableColumnFlags_NoHeaderLabel: c_int = 4096;
pub const ImGuiTableColumnFlags_NoHeaderWidth: c_int = 8192;
pub const ImGuiTableColumnFlags_PreferSortAscending: c_int = 16384;
pub const ImGuiTableColumnFlags_PreferSortDescending: c_int = 32768;
pub const ImGuiTableColumnFlags_IndentEnable: c_int = 65536;
pub const ImGuiTableColumnFlags_IndentDisable: c_int = 131072;
pub const ImGuiTableColumnFlags_IsEnabled: c_int = 16777216;
pub const ImGuiTableColumnFlags_IsVisible: c_int = 33554432;
pub const ImGuiTableColumnFlags_IsSorted: c_int = 67108864;
pub const ImGuiTableColumnFlags_IsHovered: c_int = 134217728;
pub const ImGuiTableColumnFlags_WidthMask_: c_int = 24;
pub const ImGuiTableColumnFlags_IndentMask_: c_int = 196608;
pub const ImGuiTableColumnFlags_StatusMask_: c_int = 251658240;
pub const ImGuiTableColumnFlags_NoDirectResize_: c_int = 1073741824;
pub const ImGuiTableColumnFlags_ = c_uint;
pub const ImGuiTableRowFlags_None: c_int = 0;
pub const ImGuiTableRowFlags_Headers: c_int = 1;
pub const ImGuiTableRowFlags_ = c_uint;
pub const ImGuiTableBgTarget_None: c_int = 0;
pub const ImGuiTableBgTarget_RowBg0: c_int = 1;
pub const ImGuiTableBgTarget_RowBg1: c_int = 2;
pub const ImGuiTableBgTarget_CellBg: c_int = 3;
pub const ImGuiTableBgTarget_ = c_uint;
pub const ImGuiFocusedFlags_None: c_int = 0;
pub const ImGuiFocusedFlags_ChildWindows: c_int = 1;
pub const ImGuiFocusedFlags_RootWindow: c_int = 2;
pub const ImGuiFocusedFlags_AnyWindow: c_int = 4;
pub const ImGuiFocusedFlags_NoPopupHierarchy: c_int = 8;
pub const ImGuiFocusedFlags_RootAndChildWindows: c_int = 3;
pub const ImGuiFocusedFlags_ = c_uint;
pub const ImGuiHoveredFlags_None: c_int = 0;
pub const ImGuiHoveredFlags_ChildWindows: c_int = 1;
pub const ImGuiHoveredFlags_RootWindow: c_int = 2;
pub const ImGuiHoveredFlags_AnyWindow: c_int = 4;
pub const ImGuiHoveredFlags_NoPopupHierarchy: c_int = 8;
pub const ImGuiHoveredFlags_AllowWhenBlockedByPopup: c_int = 32;
pub const ImGuiHoveredFlags_AllowWhenBlockedByActiveItem: c_int = 128;
pub const ImGuiHoveredFlags_AllowWhenOverlapped: c_int = 256;
pub const ImGuiHoveredFlags_AllowWhenDisabled: c_int = 512;
pub const ImGuiHoveredFlags_RectOnly: c_int = 416;
pub const ImGuiHoveredFlags_RootAndChildWindows: c_int = 3;
pub const ImGuiHoveredFlags_ = c_uint;
pub const ImGuiDragDropFlags_None: c_int = 0;
pub const ImGuiDragDropFlags_SourceNoPreviewTooltip: c_int = 1;
pub const ImGuiDragDropFlags_SourceNoDisableHover: c_int = 2;
pub const ImGuiDragDropFlags_SourceNoHoldToOpenOthers: c_int = 4;
pub const ImGuiDragDropFlags_SourceAllowNullID: c_int = 8;
pub const ImGuiDragDropFlags_SourceExtern: c_int = 16;
pub const ImGuiDragDropFlags_SourceAutoExpirePayload: c_int = 32;
pub const ImGuiDragDropFlags_AcceptBeforeDelivery: c_int = 1024;
pub const ImGuiDragDropFlags_AcceptNoDrawDefaultRect: c_int = 2048;
pub const ImGuiDragDropFlags_AcceptNoPreviewTooltip: c_int = 4096;
pub const ImGuiDragDropFlags_AcceptPeekOnly: c_int = 3072;
pub const ImGuiDragDropFlags_ = c_uint;
pub const ImGuiDataType_S8: c_int = 0;
pub const ImGuiDataType_U8: c_int = 1;
pub const ImGuiDataType_S16: c_int = 2;
pub const ImGuiDataType_U16: c_int = 3;
pub const ImGuiDataType_S32: c_int = 4;
pub const ImGuiDataType_U32: c_int = 5;
pub const ImGuiDataType_S64: c_int = 6;
pub const ImGuiDataType_U64: c_int = 7;
pub const ImGuiDataType_Float: c_int = 8;
pub const ImGuiDataType_Double: c_int = 9;
pub const ImGuiDataType_COUNT: c_int = 10;
pub const ImGuiDataType_ = c_uint;
pub const ImGuiDir_None: c_int = -1;
pub const ImGuiDir_Left: c_int = 0;
pub const ImGuiDir_Right: c_int = 1;
pub const ImGuiDir_Up: c_int = 2;
pub const ImGuiDir_Down: c_int = 3;
pub const ImGuiDir_COUNT: c_int = 4;
pub const ImGuiDir_ = c_int;
pub const ImGuiSortDirection_None: c_int = 0;
pub const ImGuiSortDirection_Ascending: c_int = 1;
pub const ImGuiSortDirection_Descending: c_int = 2;
pub const ImGuiSortDirection_ = c_uint;
pub const ImGuiKey_Tab: c_int = 0;
pub const ImGuiKey_LeftArrow: c_int = 1;
pub const ImGuiKey_RightArrow: c_int = 2;
pub const ImGuiKey_UpArrow: c_int = 3;
pub const ImGuiKey_DownArrow: c_int = 4;
pub const ImGuiKey_PageUp: c_int = 5;
pub const ImGuiKey_PageDown: c_int = 6;
pub const ImGuiKey_Home: c_int = 7;
pub const ImGuiKey_End: c_int = 8;
pub const ImGuiKey_Insert: c_int = 9;
pub const ImGuiKey_Delete: c_int = 10;
pub const ImGuiKey_Backspace: c_int = 11;
pub const ImGuiKey_Space: c_int = 12;
pub const ImGuiKey_Enter: c_int = 13;
pub const ImGuiKey_Escape: c_int = 14;
pub const ImGuiKey_KeyPadEnter: c_int = 15;
pub const ImGuiKey_A: c_int = 16;
pub const ImGuiKey_C: c_int = 17;
pub const ImGuiKey_V: c_int = 18;
pub const ImGuiKey_X: c_int = 19;
pub const ImGuiKey_Y: c_int = 20;
pub const ImGuiKey_Z: c_int = 21;
pub const ImGuiKey_COUNT: c_int = 22;
pub const ImGuiKey_ = c_uint;
pub const ImGuiKeyModFlags_None: c_int = 0;
pub const ImGuiKeyModFlags_Ctrl: c_int = 1;
pub const ImGuiKeyModFlags_Shift: c_int = 2;
pub const ImGuiKeyModFlags_Alt: c_int = 4;
pub const ImGuiKeyModFlags_Super: c_int = 8;
pub const ImGuiKeyModFlags_ = c_uint;
pub const ImGuiNavInput_Activate: c_int = 0;
pub const ImGuiNavInput_Cancel: c_int = 1;
pub const ImGuiNavInput_Input: c_int = 2;
pub const ImGuiNavInput_Menu: c_int = 3;
pub const ImGuiNavInput_DpadLeft: c_int = 4;
pub const ImGuiNavInput_DpadRight: c_int = 5;
pub const ImGuiNavInput_DpadUp: c_int = 6;
pub const ImGuiNavInput_DpadDown: c_int = 7;
pub const ImGuiNavInput_LStickLeft: c_int = 8;
pub const ImGuiNavInput_LStickRight: c_int = 9;
pub const ImGuiNavInput_LStickUp: c_int = 10;
pub const ImGuiNavInput_LStickDown: c_int = 11;
pub const ImGuiNavInput_FocusPrev: c_int = 12;
pub const ImGuiNavInput_FocusNext: c_int = 13;
pub const ImGuiNavInput_TweakSlow: c_int = 14;
pub const ImGuiNavInput_TweakFast: c_int = 15;
pub const ImGuiNavInput_KeyLeft_: c_int = 16;
pub const ImGuiNavInput_KeyRight_: c_int = 17;
pub const ImGuiNavInput_KeyUp_: c_int = 18;
pub const ImGuiNavInput_KeyDown_: c_int = 19;
pub const ImGuiNavInput_COUNT: c_int = 20;
pub const ImGuiNavInput_InternalStart_: c_int = 16;
pub const ImGuiNavInput_ = c_uint;
pub const ImGuiConfigFlags_None: c_int = 0;
pub const ImGuiConfigFlags_NavEnableKeyboard: c_int = 1;
pub const ImGuiConfigFlags_NavEnableGamepad: c_int = 2;
pub const ImGuiConfigFlags_NavEnableSetMousePos: c_int = 4;
pub const ImGuiConfigFlags_NavNoCaptureKeyboard: c_int = 8;
pub const ImGuiConfigFlags_NoMouse: c_int = 16;
pub const ImGuiConfigFlags_NoMouseCursorChange: c_int = 32;
pub const ImGuiConfigFlags_IsSRGB: c_int = 1048576;
pub const ImGuiConfigFlags_IsTouchScreen: c_int = 2097152;
pub const ImGuiConfigFlags_ = c_uint;
pub const ImGuiBackendFlags_None: c_int = 0;
pub const ImGuiBackendFlags_HasGamepad: c_int = 1;
pub const ImGuiBackendFlags_HasMouseCursors: c_int = 2;
pub const ImGuiBackendFlags_HasSetMousePos: c_int = 4;
pub const ImGuiBackendFlags_RendererHasVtxOffset: c_int = 8;
pub const ImGuiBackendFlags_ = c_uint;
pub const ImGuiCol_Text: c_int = 0;
pub const ImGuiCol_TextDisabled: c_int = 1;
pub const ImGuiCol_WindowBg: c_int = 2;
pub const ImGuiCol_ChildBg: c_int = 3;
pub const ImGuiCol_PopupBg: c_int = 4;
pub const ImGuiCol_Border: c_int = 5;
pub const ImGuiCol_BorderShadow: c_int = 6;
pub const ImGuiCol_FrameBg: c_int = 7;
pub const ImGuiCol_FrameBgHovered: c_int = 8;
pub const ImGuiCol_FrameBgActive: c_int = 9;
pub const ImGuiCol_TitleBg: c_int = 10;
pub const ImGuiCol_TitleBgActive: c_int = 11;
pub const ImGuiCol_TitleBgCollapsed: c_int = 12;
pub const ImGuiCol_MenuBarBg: c_int = 13;
pub const ImGuiCol_ScrollbarBg: c_int = 14;
pub const ImGuiCol_ScrollbarGrab: c_int = 15;
pub const ImGuiCol_ScrollbarGrabHovered: c_int = 16;
pub const ImGuiCol_ScrollbarGrabActive: c_int = 17;
pub const ImGuiCol_CheckMark: c_int = 18;
pub const ImGuiCol_SliderGrab: c_int = 19;
pub const ImGuiCol_SliderGrabActive: c_int = 20;
pub const ImGuiCol_Button: c_int = 21;
pub const ImGuiCol_ButtonHovered: c_int = 22;
pub const ImGuiCol_ButtonActive: c_int = 23;
pub const ImGuiCol_Header: c_int = 24;
pub const ImGuiCol_HeaderHovered: c_int = 25;
pub const ImGuiCol_HeaderActive: c_int = 26;
pub const ImGuiCol_Separator: c_int = 27;
pub const ImGuiCol_SeparatorHovered: c_int = 28;
pub const ImGuiCol_SeparatorActive: c_int = 29;
pub const ImGuiCol_ResizeGrip: c_int = 30;
pub const ImGuiCol_ResizeGripHovered: c_int = 31;
pub const ImGuiCol_ResizeGripActive: c_int = 32;
pub const ImGuiCol_Tab: c_int = 33;
pub const ImGuiCol_TabHovered: c_int = 34;
pub const ImGuiCol_TabActive: c_int = 35;
pub const ImGuiCol_TabUnfocused: c_int = 36;
pub const ImGuiCol_TabUnfocusedActive: c_int = 37;
pub const ImGuiCol_PlotLines: c_int = 38;
pub const ImGuiCol_PlotLinesHovered: c_int = 39;
pub const ImGuiCol_PlotHistogram: c_int = 40;
pub const ImGuiCol_PlotHistogramHovered: c_int = 41;
pub const ImGuiCol_TableHeaderBg: c_int = 42;
pub const ImGuiCol_TableBorderStrong: c_int = 43;
pub const ImGuiCol_TableBorderLight: c_int = 44;
pub const ImGuiCol_TableRowBg: c_int = 45;
pub const ImGuiCol_TableRowBgAlt: c_int = 46;
pub const ImGuiCol_TextSelectedBg: c_int = 47;
pub const ImGuiCol_DragDropTarget: c_int = 48;
pub const ImGuiCol_NavHighlight: c_int = 49;
pub const ImGuiCol_NavWindowingHighlight: c_int = 50;
pub const ImGuiCol_NavWindowingDimBg: c_int = 51;
pub const ImGuiCol_ModalWindowDimBg: c_int = 52;
pub const ImGuiCol_COUNT: c_int = 53;
pub const ImGuiCol_ = c_uint;
pub const ImGuiStyleVar_Alpha: c_int = 0;
pub const ImGuiStyleVar_DisabledAlpha: c_int = 1;
pub const ImGuiStyleVar_WindowPadding: c_int = 2;
pub const ImGuiStyleVar_WindowRounding: c_int = 3;
pub const ImGuiStyleVar_WindowBorderSize: c_int = 4;
pub const ImGuiStyleVar_WindowMinSize: c_int = 5;
pub const ImGuiStyleVar_WindowTitleAlign: c_int = 6;
pub const ImGuiStyleVar_ChildRounding: c_int = 7;
pub const ImGuiStyleVar_ChildBorderSize: c_int = 8;
pub const ImGuiStyleVar_PopupRounding: c_int = 9;
pub const ImGuiStyleVar_PopupBorderSize: c_int = 10;
pub const ImGuiStyleVar_FramePadding: c_int = 11;
pub const ImGuiStyleVar_FrameRounding: c_int = 12;
pub const ImGuiStyleVar_FrameBorderSize: c_int = 13;
pub const ImGuiStyleVar_ItemSpacing: c_int = 14;
pub const ImGuiStyleVar_ItemInnerSpacing: c_int = 15;
pub const ImGuiStyleVar_IndentSpacing: c_int = 16;
pub const ImGuiStyleVar_CellPadding: c_int = 17;
pub const ImGuiStyleVar_ScrollbarSize: c_int = 18;
pub const ImGuiStyleVar_ScrollbarRounding: c_int = 19;
pub const ImGuiStyleVar_GrabMinSize: c_int = 20;
pub const ImGuiStyleVar_GrabRounding: c_int = 21;
pub const ImGuiStyleVar_TabRounding: c_int = 22;
pub const ImGuiStyleVar_ButtonTextAlign: c_int = 23;
pub const ImGuiStyleVar_SelectableTextAlign: c_int = 24;
pub const ImGuiStyleVar_COUNT: c_int = 25;
pub const ImGuiStyleVar_ = c_uint;
pub const ImGuiButtonFlags_None: c_int = 0;
pub const ImGuiButtonFlags_MouseButtonLeft: c_int = 1;
pub const ImGuiButtonFlags_MouseButtonRight: c_int = 2;
pub const ImGuiButtonFlags_MouseButtonMiddle: c_int = 4;
pub const ImGuiButtonFlags_MouseButtonMask_: c_int = 7;
pub const ImGuiButtonFlags_MouseButtonDefault_: c_int = 1;
pub const ImGuiButtonFlags_ = c_uint;
pub const ImGuiColorEditFlags_None: c_int = 0;
pub const ImGuiColorEditFlags_NoAlpha: c_int = 2;
pub const ImGuiColorEditFlags_NoPicker: c_int = 4;
pub const ImGuiColorEditFlags_NoOptions: c_int = 8;
pub const ImGuiColorEditFlags_NoSmallPreview: c_int = 16;
pub const ImGuiColorEditFlags_NoInputs: c_int = 32;
pub const ImGuiColorEditFlags_NoTooltip: c_int = 64;
pub const ImGuiColorEditFlags_NoLabel: c_int = 128;
pub const ImGuiColorEditFlags_NoSidePreview: c_int = 256;
pub const ImGuiColorEditFlags_NoDragDrop: c_int = 512;
pub const ImGuiColorEditFlags_NoBorder: c_int = 1024;
pub const ImGuiColorEditFlags_AlphaBar: c_int = 65536;
pub const ImGuiColorEditFlags_AlphaPreview: c_int = 131072;
pub const ImGuiColorEditFlags_AlphaPreviewHalf: c_int = 262144;
pub const ImGuiColorEditFlags_HDR: c_int = 524288;
pub const ImGuiColorEditFlags_DisplayRGB: c_int = 1048576;
pub const ImGuiColorEditFlags_DisplayHSV: c_int = 2097152;
pub const ImGuiColorEditFlags_DisplayHex: c_int = 4194304;
pub const ImGuiColorEditFlags_Uint8: c_int = 8388608;
pub const ImGuiColorEditFlags_Float: c_int = 16777216;
pub const ImGuiColorEditFlags_PickerHueBar: c_int = 33554432;
pub const ImGuiColorEditFlags_PickerHueWheel: c_int = 67108864;
pub const ImGuiColorEditFlags_InputRGB: c_int = 134217728;
pub const ImGuiColorEditFlags_InputHSV: c_int = 268435456;
pub const ImGuiColorEditFlags_DefaultOptions_: c_int = 177209344;
pub const ImGuiColorEditFlags_DisplayMask_: c_int = 7340032;
pub const ImGuiColorEditFlags_DataTypeMask_: c_int = 25165824;
pub const ImGuiColorEditFlags_PickerMask_: c_int = 100663296;
pub const ImGuiColorEditFlags_InputMask_: c_int = 402653184;
pub const ImGuiColorEditFlags_ = c_uint;
pub const ImGuiSliderFlags_None: c_int = 0;
pub const ImGuiSliderFlags_AlwaysClamp: c_int = 16;
pub const ImGuiSliderFlags_Logarithmic: c_int = 32;
pub const ImGuiSliderFlags_NoRoundToFormat: c_int = 64;
pub const ImGuiSliderFlags_NoInput: c_int = 128;
pub const ImGuiSliderFlags_InvalidMask_: c_int = 1879048207;
pub const ImGuiSliderFlags_ = c_uint;
pub const ImGuiMouseButton_Left: c_int = 0;
pub const ImGuiMouseButton_Right: c_int = 1;
pub const ImGuiMouseButton_Middle: c_int = 2;
pub const ImGuiMouseButton_COUNT: c_int = 5;
pub const ImGuiMouseButton_ = c_uint;
pub const ImGuiMouseCursor_None: c_int = -1;
pub const ImGuiMouseCursor_Arrow: c_int = 0;
pub const ImGuiMouseCursor_TextInput: c_int = 1;
pub const ImGuiMouseCursor_ResizeAll: c_int = 2;
pub const ImGuiMouseCursor_ResizeNS: c_int = 3;
pub const ImGuiMouseCursor_ResizeEW: c_int = 4;
pub const ImGuiMouseCursor_ResizeNESW: c_int = 5;
pub const ImGuiMouseCursor_ResizeNWSE: c_int = 6;
pub const ImGuiMouseCursor_Hand: c_int = 7;
pub const ImGuiMouseCursor_NotAllowed: c_int = 8;
pub const ImGuiMouseCursor_COUNT: c_int = 9;
pub const ImGuiMouseCursor_ = c_int;
pub const ImGuiCond_None: c_int = 0;
pub const ImGuiCond_Always: c_int = 1;
pub const ImGuiCond_Once: c_int = 2;
pub const ImGuiCond_FirstUseEver: c_int = 4;
pub const ImGuiCond_Appearing: c_int = 8;
pub const ImGuiCond_ = c_uint;
pub const ImDrawFlags_None: c_int = 0;
pub const ImDrawFlags_Closed: c_int = 1;
pub const ImDrawFlags_RoundCornersTopLeft: c_int = 16;
pub const ImDrawFlags_RoundCornersTopRight: c_int = 32;
pub const ImDrawFlags_RoundCornersBottomLeft: c_int = 64;
pub const ImDrawFlags_RoundCornersBottomRight: c_int = 128;
pub const ImDrawFlags_RoundCornersNone: c_int = 256;
pub const ImDrawFlags_RoundCornersTop: c_int = 48;
pub const ImDrawFlags_RoundCornersBottom: c_int = 192;
pub const ImDrawFlags_RoundCornersLeft: c_int = 80;
pub const ImDrawFlags_RoundCornersRight: c_int = 160;
pub const ImDrawFlags_RoundCornersAll: c_int = 240;
pub const ImDrawFlags_RoundCornersDefault_: c_int = 240;
pub const ImDrawFlags_RoundCornersMask_: c_int = 496;
pub const ImDrawFlags_ = c_uint;
pub const ImDrawListFlags_None: c_int = 0;
pub const ImDrawListFlags_AntiAliasedLines: c_int = 1;
pub const ImDrawListFlags_AntiAliasedLinesUseTex: c_int = 2;
pub const ImDrawListFlags_AntiAliasedFill: c_int = 4;
pub const ImDrawListFlags_AllowVtxOffset: c_int = 8;
pub const ImDrawListFlags_ = c_uint;
pub const ImFontAtlasFlags_None: c_int = 0;
pub const ImFontAtlasFlags_NoPowerOfTwoHeight: c_int = 1;
pub const ImFontAtlasFlags_NoMouseCursors: c_int = 2;
pub const ImFontAtlasFlags_NoBakedLines: c_int = 4;
pub const ImFontAtlasFlags_ = c_uint;
pub const ImGuiViewportFlags_None: c_int = 0;
pub const ImGuiViewportFlags_IsPlatformWindow: c_int = 1;
pub const ImGuiViewportFlags_IsPlatformMonitor: c_int = 2;
pub const ImGuiViewportFlags_OwnedByApp: c_int = 4;
pub const ImGuiViewportFlags_ = c_uint;
pub const ImGuiItemFlags_None: c_int = 0;
pub const ImGuiItemFlags_NoTabStop: c_int = 1;
pub const ImGuiItemFlags_ButtonRepeat: c_int = 2;
pub const ImGuiItemFlags_Disabled: c_int = 4;
pub const ImGuiItemFlags_NoNav: c_int = 8;
pub const ImGuiItemFlags_NoNavDefaultFocus: c_int = 16;
pub const ImGuiItemFlags_SelectableDontClosePopup: c_int = 32;
pub const ImGuiItemFlags_MixedValue: c_int = 64;
pub const ImGuiItemFlags_ReadOnly: c_int = 128;
pub const ImGuiItemFlags_Inputable: c_int = 256;
pub const ImGuiItemFlags_ = c_uint;
pub const ImGuiItemStatusFlags_None: c_int = 0;
pub const ImGuiItemStatusFlags_HoveredRect: c_int = 1;
pub const ImGuiItemStatusFlags_HasDisplayRect: c_int = 2;
pub const ImGuiItemStatusFlags_Edited: c_int = 4;
pub const ImGuiItemStatusFlags_ToggledSelection: c_int = 8;
pub const ImGuiItemStatusFlags_ToggledOpen: c_int = 16;
pub const ImGuiItemStatusFlags_HasDeactivated: c_int = 32;
pub const ImGuiItemStatusFlags_Deactivated: c_int = 64;
pub const ImGuiItemStatusFlags_HoveredWindow: c_int = 128;
pub const ImGuiItemStatusFlags_FocusedByTabbing: c_int = 256;
pub const ImGuiItemStatusFlags_ = c_uint;
pub const ImGuiInputTextFlags_Multiline: c_int = 67108864;
pub const ImGuiInputTextFlags_NoMarkEdited: c_int = 134217728;
pub const ImGuiInputTextFlags_MergedItem: c_int = 268435456;
pub const ImGuiInputTextFlagsPrivate_ = c_uint;
pub const ImGuiButtonFlags_PressedOnClick: c_int = 16;
pub const ImGuiButtonFlags_PressedOnClickRelease: c_int = 32;
pub const ImGuiButtonFlags_PressedOnClickReleaseAnywhere: c_int = 64;
pub const ImGuiButtonFlags_PressedOnRelease: c_int = 128;
pub const ImGuiButtonFlags_PressedOnDoubleClick: c_int = 256;
pub const ImGuiButtonFlags_PressedOnDragDropHold: c_int = 512;
pub const ImGuiButtonFlags_Repeat: c_int = 1024;
pub const ImGuiButtonFlags_FlattenChildren: c_int = 2048;
pub const ImGuiButtonFlags_AllowItemOverlap: c_int = 4096;
pub const ImGuiButtonFlags_DontClosePopups: c_int = 8192;
pub const ImGuiButtonFlags_AlignTextBaseLine: c_int = 32768;
pub const ImGuiButtonFlags_NoKeyModifiers: c_int = 65536;
pub const ImGuiButtonFlags_NoHoldingActiveId: c_int = 131072;
pub const ImGuiButtonFlags_NoNavFocus: c_int = 262144;
pub const ImGuiButtonFlags_NoHoveredOnFocus: c_int = 524288;
pub const ImGuiButtonFlags_PressedOnMask_: c_int = 1008;
pub const ImGuiButtonFlags_PressedOnDefault_: c_int = 32;
pub const ImGuiButtonFlagsPrivate_ = c_uint;
pub const ImGuiComboFlags_CustomPreview: c_int = 1048576;
pub const ImGuiComboFlagsPrivate_ = c_uint;
pub const ImGuiSliderFlags_Vertical: c_int = 1048576;
pub const ImGuiSliderFlags_ReadOnly: c_int = 2097152;
pub const ImGuiSliderFlagsPrivate_ = c_uint;
pub const ImGuiSelectableFlags_NoHoldingActiveID: c_int = 1048576;
pub const ImGuiSelectableFlags_SelectOnNav: c_int = 2097152;
pub const ImGuiSelectableFlags_SelectOnClick: c_int = 4194304;
pub const ImGuiSelectableFlags_SelectOnRelease: c_int = 8388608;
pub const ImGuiSelectableFlags_SpanAvailWidth: c_int = 16777216;
pub const ImGuiSelectableFlags_DrawHoveredWhenHeld: c_int = 33554432;
pub const ImGuiSelectableFlags_SetNavIdOnHover: c_int = 67108864;
pub const ImGuiSelectableFlags_NoPadWithHalfSpacing: c_int = 134217728;
pub const ImGuiSelectableFlagsPrivate_ = c_uint;
pub const ImGuiTreeNodeFlags_ClipLabelForTrailingButton: c_int = 1048576;
pub const ImGuiTreeNodeFlagsPrivate_ = c_uint;
pub const ImGuiSeparatorFlags_None: c_int = 0;
pub const ImGuiSeparatorFlags_Horizontal: c_int = 1;
pub const ImGuiSeparatorFlags_Vertical: c_int = 2;
pub const ImGuiSeparatorFlags_SpanAllColumns: c_int = 4;
pub const ImGuiSeparatorFlags_ = c_uint;
pub const ImGuiTextFlags_None: c_int = 0;
pub const ImGuiTextFlags_NoWidthForLargeClippedText: c_int = 1;
pub const ImGuiTextFlags_ = c_uint;
pub const ImGuiTooltipFlags_None: c_int = 0;
pub const ImGuiTooltipFlags_OverridePreviousTooltip: c_int = 1;
pub const ImGuiTooltipFlags_ = c_uint;
pub const ImGuiLayoutType_Horizontal: c_int = 0;
pub const ImGuiLayoutType_Vertical: c_int = 1;
pub const ImGuiLayoutType_ = c_uint;
pub const ImGuiLogType_None: c_int = 0;
pub const ImGuiLogType_TTY: c_int = 1;
pub const ImGuiLogType_File: c_int = 2;
pub const ImGuiLogType_Buffer: c_int = 3;
pub const ImGuiLogType_Clipboard: c_int = 4;
pub const ImGuiLogType = c_uint;
pub const ImGuiAxis_None: c_int = -1;
pub const ImGuiAxis_X: c_int = 0;
pub const ImGuiAxis_Y: c_int = 1;
pub const ImGuiAxis = c_int;
pub const ImGuiPlotType_Lines: c_int = 0;
pub const ImGuiPlotType_Histogram: c_int = 1;
pub const ImGuiPlotType = c_uint;
pub const ImGuiInputSource_None: c_int = 0;
pub const ImGuiInputSource_Mouse: c_int = 1;
pub const ImGuiInputSource_Keyboard: c_int = 2;
pub const ImGuiInputSource_Gamepad: c_int = 3;
pub const ImGuiInputSource_Nav: c_int = 4;
pub const ImGuiInputSource_Clipboard: c_int = 5;
pub const ImGuiInputSource_COUNT: c_int = 6;
pub const ImGuiInputSource = c_uint;
pub const ImGuiInputReadMode_Down: c_int = 0;
pub const ImGuiInputReadMode_Pressed: c_int = 1;
pub const ImGuiInputReadMode_Released: c_int = 2;
pub const ImGuiInputReadMode_Repeat: c_int = 3;
pub const ImGuiInputReadMode_RepeatSlow: c_int = 4;
pub const ImGuiInputReadMode_RepeatFast: c_int = 5;
pub const ImGuiInputReadMode = c_uint;
pub const ImGuiPopupPositionPolicy_Default: c_int = 0;
pub const ImGuiPopupPositionPolicy_ComboBox: c_int = 1;
pub const ImGuiPopupPositionPolicy_Tooltip: c_int = 2;
pub const ImGuiPopupPositionPolicy = c_uint;
pub const ImGuiDataType_String: c_int = 11;
pub const ImGuiDataType_Pointer: c_int = 12;
pub const ImGuiDataType_ID: c_int = 13;
pub const ImGuiDataTypePrivate_ = c_uint;
pub const ImGuiNextWindowDataFlags_None: c_int = 0;
pub const ImGuiNextWindowDataFlags_HasPos: c_int = 1;
pub const ImGuiNextWindowDataFlags_HasSize: c_int = 2;
pub const ImGuiNextWindowDataFlags_HasContentSize: c_int = 4;
pub const ImGuiNextWindowDataFlags_HasCollapsed: c_int = 8;
pub const ImGuiNextWindowDataFlags_HasSizeConstraint: c_int = 16;
pub const ImGuiNextWindowDataFlags_HasFocus: c_int = 32;
pub const ImGuiNextWindowDataFlags_HasBgAlpha: c_int = 64;
pub const ImGuiNextWindowDataFlags_HasScroll: c_int = 128;
pub const ImGuiNextWindowDataFlags_ = c_uint;
pub const ImGuiNextItemDataFlags_None: c_int = 0;
pub const ImGuiNextItemDataFlags_HasWidth: c_int = 1;
pub const ImGuiNextItemDataFlags_HasOpen: c_int = 2;
pub const ImGuiNextItemDataFlags_ = c_uint;
pub const ImGuiActivateFlags_None: c_int = 0;
pub const ImGuiActivateFlags_PreferInput: c_int = 1;
pub const ImGuiActivateFlags_PreferTweak: c_int = 2;
pub const ImGuiActivateFlags_TryToPreserveState: c_int = 4;
pub const ImGuiActivateFlags_ = c_uint;
pub const ImGuiScrollFlags_None: c_int = 0;
pub const ImGuiScrollFlags_KeepVisibleEdgeX: c_int = 1;
pub const ImGuiScrollFlags_KeepVisibleEdgeY: c_int = 2;
pub const ImGuiScrollFlags_KeepVisibleCenterX: c_int = 4;
pub const ImGuiScrollFlags_KeepVisibleCenterY: c_int = 8;
pub const ImGuiScrollFlags_AlwaysCenterX: c_int = 16;
pub const ImGuiScrollFlags_AlwaysCenterY: c_int = 32;
pub const ImGuiScrollFlags_NoScrollParent: c_int = 64;
pub const ImGuiScrollFlags_MaskX_: c_int = 21;
pub const ImGuiScrollFlags_MaskY_: c_int = 42;
pub const ImGuiScrollFlags_ = c_uint;
pub const ImGuiNavHighlightFlags_None: c_int = 0;
pub const ImGuiNavHighlightFlags_TypeDefault: c_int = 1;
pub const ImGuiNavHighlightFlags_TypeThin: c_int = 2;
pub const ImGuiNavHighlightFlags_AlwaysDraw: c_int = 4;
pub const ImGuiNavHighlightFlags_NoRounding: c_int = 8;
pub const ImGuiNavHighlightFlags_ = c_uint;
pub const ImGuiNavDirSourceFlags_None: c_int = 0;
pub const ImGuiNavDirSourceFlags_Keyboard: c_int = 1;
pub const ImGuiNavDirSourceFlags_PadDPad: c_int = 2;
pub const ImGuiNavDirSourceFlags_PadLStick: c_int = 4;
pub const ImGuiNavDirSourceFlags_ = c_uint;
pub const ImGuiNavMoveFlags_None: c_int = 0;
pub const ImGuiNavMoveFlags_LoopX: c_int = 1;
pub const ImGuiNavMoveFlags_LoopY: c_int = 2;
pub const ImGuiNavMoveFlags_WrapX: c_int = 4;
pub const ImGuiNavMoveFlags_WrapY: c_int = 8;
pub const ImGuiNavMoveFlags_AllowCurrentNavId: c_int = 16;
pub const ImGuiNavMoveFlags_AlsoScoreVisibleSet: c_int = 32;
pub const ImGuiNavMoveFlags_ScrollToEdgeY: c_int = 64;
pub const ImGuiNavMoveFlags_Forwarded: c_int = 128;
pub const ImGuiNavMoveFlags_DebugNoResult: c_int = 256;
pub const ImGuiNavMoveFlags_Tabbing: c_int = 512;
pub const ImGuiNavMoveFlags_Activate: c_int = 1024;
pub const ImGuiNavMoveFlags_DontSetNavHighlight: c_int = 2048;
pub const ImGuiNavMoveFlags_ = c_uint;
pub const ImGuiNavLayer_Main: c_int = 0;
pub const ImGuiNavLayer_Menu: c_int = 1;
pub const ImGuiNavLayer_COUNT: c_int = 2;
pub const ImGuiNavLayer = c_uint;
pub const ImGuiOldColumnFlags_None: c_int = 0;
pub const ImGuiOldColumnFlags_NoBorder: c_int = 1;
pub const ImGuiOldColumnFlags_NoResize: c_int = 2;
pub const ImGuiOldColumnFlags_NoPreserveWidths: c_int = 4;
pub const ImGuiOldColumnFlags_NoForceWithinWindow: c_int = 8;
pub const ImGuiOldColumnFlags_GrowParentContentsSize: c_int = 16;
pub const ImGuiOldColumnFlags_ = c_uint;
pub const ImGuiContextHookType_NewFramePre: c_int = 0;
pub const ImGuiContextHookType_NewFramePost: c_int = 1;
pub const ImGuiContextHookType_EndFramePre: c_int = 2;
pub const ImGuiContextHookType_EndFramePost: c_int = 3;
pub const ImGuiContextHookType_RenderPre: c_int = 4;
pub const ImGuiContextHookType_RenderPost: c_int = 5;
pub const ImGuiContextHookType_Shutdown: c_int = 6;
pub const ImGuiContextHookType_PendingRemoval_: c_int = 7;
pub const ImGuiContextHookType = c_uint;
pub const ImGuiTabBarFlags_DockNode: c_int = 1048576;
pub const ImGuiTabBarFlags_IsFocused: c_int = 2097152;
pub const ImGuiTabBarFlags_SaveSettings: c_int = 4194304;
pub const ImGuiTabBarFlagsPrivate_ = c_uint;
pub const ImGuiTabItemFlags_SectionMask_: c_int = 192;
pub const ImGuiTabItemFlags_NoCloseButton: c_int = 1048576;
pub const ImGuiTabItemFlags_Button: c_int = 2097152;
pub const ImGuiTabItemFlagsPrivate_ = c_uint;
pub extern fn ImVec2_ImVec2_Nil() [*c]ImVec2;
pub extern fn ImVec2_destroy(self: [*c]ImVec2) void;
pub extern fn ImVec2_ImVec2_Float(_x: f32, _y: f32) [*c]ImVec2;
pub extern fn ImVec4_ImVec4_Nil() [*c]ImVec4;
pub extern fn ImVec4_destroy(self: [*c]ImVec4) void;
pub extern fn ImVec4_ImVec4_Float(_x: f32, _y: f32, _z: f32, _w: f32) [*c]ImVec4;
pub extern fn igCreateContext(shared_font_atlas: [*c]ImFontAtlas) [*c]ImGuiContext;
pub extern fn igDestroyContext(ctx: [*c]ImGuiContext) void;
pub extern fn igGetCurrentContext() [*c]ImGuiContext;
pub extern fn igSetCurrentContext(ctx: [*c]ImGuiContext) void;
pub extern fn igGetIO() [*c]ImGuiIO;
pub extern fn igGetStyle() [*c]ImGuiStyle;
pub extern fn igNewFrame() void;
pub extern fn igEndFrame() void;
pub extern fn igRender() void;
pub extern fn igGetDrawData() [*c]ImDrawData;
pub extern fn igShowDemoWindow(p_open: [*c]bool) void;
pub extern fn igShowMetricsWindow(p_open: [*c]bool) void;
pub extern fn igShowStackToolWindow(p_open: [*c]bool) void;
pub extern fn igShowAboutWindow(p_open: [*c]bool) void;
pub extern fn igShowStyleEditor(ref: [*c]ImGuiStyle) void;
pub extern fn igShowStyleSelector(label: [*c]const u8) bool;
pub extern fn igShowFontSelector(label: [*c]const u8) void;
pub extern fn igShowUserGuide() void;
pub extern fn igGetVersion() [*c]const u8;
pub extern fn igStyleColorsDark(dst: [*c]ImGuiStyle) void;
pub extern fn igStyleColorsLight(dst: [*c]ImGuiStyle) void;
pub extern fn igStyleColorsClassic(dst: [*c]ImGuiStyle) void;
pub extern fn igBegin(name: [*c]const u8, p_open: [*c]bool, flags: ImGuiWindowFlags) bool;
pub extern fn igEnd() void;
pub extern fn igBeginChild_Str(str_id: [*c]const u8, size: ImVec2, border: bool, flags: ImGuiWindowFlags) bool;
pub extern fn igBeginChild_ID(id: ImGuiID, size: ImVec2, border: bool, flags: ImGuiWindowFlags) bool;
pub extern fn igEndChild() void;
pub extern fn igIsWindowAppearing() bool;
pub extern fn igIsWindowCollapsed() bool;
pub extern fn igIsWindowFocused(flags: ImGuiFocusedFlags) bool;
pub extern fn igIsWindowHovered(flags: ImGuiHoveredFlags) bool;
pub extern fn igGetWindowDrawList() [*c]ImDrawList;
pub extern fn igGetWindowPos(pOut: [*c]ImVec2) void;
pub extern fn igGetWindowSize(pOut: [*c]ImVec2) void;
pub extern fn igGetWindowWidth() f32;
pub extern fn igGetWindowHeight() f32;
pub extern fn igSetNextWindowPos(pos: ImVec2, cond: ImGuiCond, pivot: ImVec2) void;
pub extern fn igSetNextWindowSize(size: ImVec2, cond: ImGuiCond) void;
pub extern fn igSetNextWindowSizeConstraints(size_min: ImVec2, size_max: ImVec2, custom_callback: ImGuiSizeCallback, custom_callback_data: ?*anyopaque) void;
pub extern fn igSetNextWindowContentSize(size: ImVec2) void;
pub extern fn igSetNextWindowCollapsed(collapsed: bool, cond: ImGuiCond) void;
pub extern fn igSetNextWindowFocus() void;
pub extern fn igSetNextWindowBgAlpha(alpha: f32) void;
pub extern fn igSetWindowPos_Vec2(pos: ImVec2, cond: ImGuiCond) void;
pub extern fn igSetWindowSize_Vec2(size: ImVec2, cond: ImGuiCond) void;
pub extern fn igSetWindowCollapsed_Bool(collapsed: bool, cond: ImGuiCond) void;
pub extern fn igSetWindowFocus_Nil() void;
pub extern fn igSetWindowFontScale(scale: f32) void;
pub extern fn igSetWindowPos_Str(name: [*c]const u8, pos: ImVec2, cond: ImGuiCond) void;
pub extern fn igSetWindowSize_Str(name: [*c]const u8, size: ImVec2, cond: ImGuiCond) void;
pub extern fn igSetWindowCollapsed_Str(name: [*c]const u8, collapsed: bool, cond: ImGuiCond) void;
pub extern fn igSetWindowFocus_Str(name: [*c]const u8) void;
pub extern fn igGetContentRegionAvail(pOut: [*c]ImVec2) void;
pub extern fn igGetContentRegionMax(pOut: [*c]ImVec2) void;
pub extern fn igGetWindowContentRegionMin(pOut: [*c]ImVec2) void;
pub extern fn igGetWindowContentRegionMax(pOut: [*c]ImVec2) void;
pub extern fn igGetScrollX() f32;
pub extern fn igGetScrollY() f32;
pub extern fn igSetScrollX_Float(scroll_x: f32) void;
pub extern fn igSetScrollY_Float(scroll_y: f32) void;
pub extern fn igGetScrollMaxX() f32;
pub extern fn igGetScrollMaxY() f32;
pub extern fn igSetScrollHereX(center_x_ratio: f32) void;
pub extern fn igSetScrollHereY(center_y_ratio: f32) void;
pub extern fn igSetScrollFromPosX_Float(local_x: f32, center_x_ratio: f32) void;
pub extern fn igSetScrollFromPosY_Float(local_y: f32, center_y_ratio: f32) void;
pub extern fn igPushFont(font: [*c]ImFont) void;
pub extern fn igPopFont() void;
pub extern fn igPushStyleColor_U32(idx: ImGuiCol, col: ImU32) void;
pub extern fn igPushStyleColor_Vec4(idx: ImGuiCol, col: ImVec4) void;
pub extern fn igPopStyleColor(count: c_int) void;
pub extern fn igPushStyleVar_Float(idx: ImGuiStyleVar, val: f32) void;
pub extern fn igPushStyleVar_Vec2(idx: ImGuiStyleVar, val: ImVec2) void;
pub extern fn igPopStyleVar(count: c_int) void;
pub extern fn igPushAllowKeyboardFocus(allow_keyboard_focus: bool) void;
pub extern fn igPopAllowKeyboardFocus() void;
pub extern fn igPushButtonRepeat(repeat: bool) void;
pub extern fn igPopButtonRepeat() void;
pub extern fn igPushItemWidth(item_width: f32) void;
pub extern fn igPopItemWidth() void;
pub extern fn igSetNextItemWidth(item_width: f32) void;
pub extern fn igCalcItemWidth() f32;
pub extern fn igPushTextWrapPos(wrap_local_pos_x: f32) void;
pub extern fn igPopTextWrapPos() void;
pub extern fn igGetFont() [*c]ImFont;
pub extern fn igGetFontSize() f32;
pub extern fn igGetFontTexUvWhitePixel(pOut: [*c]ImVec2) void;
pub extern fn igGetColorU32_Col(idx: ImGuiCol, alpha_mul: f32) ImU32;
pub extern fn igGetColorU32_Vec4(col: ImVec4) ImU32;
pub extern fn igGetColorU32_U32(col: ImU32) ImU32;
pub extern fn igGetStyleColorVec4(idx: ImGuiCol) [*c]const ImVec4;
pub extern fn igSeparator() void;
pub extern fn igSameLine(offset_from_start_x: f32, spacing: f32) void;
pub extern fn igNewLine() void;
pub extern fn igSpacing() void;
pub extern fn igDummy(size: ImVec2) void;
pub extern fn igIndent(indent_w: f32) void;
pub extern fn igUnindent(indent_w: f32) void;
pub extern fn igBeginGroup() void;
pub extern fn igEndGroup() void;
pub extern fn igGetCursorPos(pOut: [*c]ImVec2) void;
pub extern fn igGetCursorPosX() f32;
pub extern fn igGetCursorPosY() f32;
pub extern fn igSetCursorPos(local_pos: ImVec2) void;
pub extern fn igSetCursorPosX(local_x: f32) void;
pub extern fn igSetCursorPosY(local_y: f32) void;
pub extern fn igGetCursorStartPos(pOut: [*c]ImVec2) void;
pub extern fn igGetCursorScreenPos(pOut: [*c]ImVec2) void;
pub extern fn igSetCursorScreenPos(pos: ImVec2) void;
pub extern fn igAlignTextToFramePadding() void;
pub extern fn igGetTextLineHeight() f32;
pub extern fn igGetTextLineHeightWithSpacing() f32;
pub extern fn igGetFrameHeight() f32;
pub extern fn igGetFrameHeightWithSpacing() f32;
pub extern fn igPushID_Str(str_id: [*c]const u8) void;
pub extern fn igPushID_StrStr(str_id_begin: [*c]const u8, str_id_end: [*c]const u8) void;
pub extern fn igPushID_Ptr(ptr_id: ?*const anyopaque) void;
pub extern fn igPushID_Int(int_id: c_int) void;
pub extern fn igPopID() void;
pub extern fn igGetID_Str(str_id: [*c]const u8) ImGuiID;
pub extern fn igGetID_StrStr(str_id_begin: [*c]const u8, str_id_end: [*c]const u8) ImGuiID;
pub extern fn igGetID_Ptr(ptr_id: ?*const anyopaque) ImGuiID;
pub extern fn igTextUnformatted(text: [*c]const u8, text_end: [*c]const u8) void;
pub extern fn igText(fmt: [*c]const u8, ...) void;
pub extern fn igTextColored(col: ImVec4, fmt: [*c]const u8, ...) void;
pub extern fn igTextDisabled(fmt: [*c]const u8, ...) void;
pub extern fn igTextWrapped(fmt: [*c]const u8, ...) void;
pub extern fn igLabelText(label: [*c]const u8, fmt: [*c]const u8, ...) void;
pub extern fn igBulletText(fmt: [*c]const u8, ...) void;
pub extern fn igButton(label: [*c]const u8, size: ImVec2) bool;
pub extern fn igSmallButton(label: [*c]const u8) bool;
pub extern fn igInvisibleButton(str_id: [*c]const u8, size: ImVec2, flags: ImGuiButtonFlags) bool;
pub extern fn igArrowButton(str_id: [*c]const u8, dir: ImGuiDir) bool;
pub extern fn igImage(user_texture_id: ImTextureID, size: ImVec2, uv0: ImVec2, uv1: ImVec2, tint_col: ImVec4, border_col: ImVec4) void;
pub extern fn igImageButton(user_texture_id: ImTextureID, size: ImVec2, uv0: ImVec2, uv1: ImVec2, frame_padding: c_int, bg_col: ImVec4, tint_col: ImVec4) bool;
pub extern fn igCheckbox(label: [*c]const u8, v: [*c]bool) bool;
pub extern fn igCheckboxFlags_IntPtr(label: [*c]const u8, flags: [*c]c_int, flags_value: c_int) bool;
pub extern fn igCheckboxFlags_UintPtr(label: [*c]const u8, flags: [*c]c_uint, flags_value: c_uint) bool;
pub extern fn igRadioButton_Bool(label: [*c]const u8, active: bool) bool;
pub extern fn igRadioButton_IntPtr(label: [*c]const u8, v: [*c]c_int, v_button: c_int) bool;
pub extern fn igProgressBar(fraction: f32, size_arg: ImVec2, overlay: [*c]const u8) void;
pub extern fn igBullet() void;
pub extern fn igBeginCombo(label: [*c]const u8, preview_value: [*c]const u8, flags: ImGuiComboFlags) bool;
pub extern fn igEndCombo() void;
pub extern fn igCombo_Str_arr(label: [*c]const u8, current_item: [*c]c_int, items: [*c]const [*c]const u8, items_count: c_int, popup_max_height_in_items: c_int) bool;
pub extern fn igCombo_Str(label: [*c]const u8, current_item: [*c]c_int, items_separated_by_zeros: [*c]const u8, popup_max_height_in_items: c_int) bool;
pub extern fn igCombo_FnBoolPtr(label: [*c]const u8, current_item: [*c]c_int, items_getter: ?fn (?*anyopaque, c_int, [*c][*c]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: c_int, popup_max_height_in_items: c_int) bool;
pub extern fn igDragFloat(label: [*c]const u8, v: [*c]f32, v_speed: f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igDragFloat2(label: [*c]const u8, v: [*c]f32, v_speed: f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igDragFloat3(label: [*c]const u8, v: [*c]f32, v_speed: f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igDragFloat4(label: [*c]const u8, v: [*c]f32, v_speed: f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igDragFloatRange2(label: [*c]const u8, v_current_min: [*c]f32, v_current_max: [*c]f32, v_speed: f32, v_min: f32, v_max: f32, format: [*c]const u8, format_max: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igDragInt(label: [*c]const u8, v: [*c]c_int, v_speed: f32, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igDragInt2(label: [*c]const u8, v: [*c]c_int, v_speed: f32, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igDragInt3(label: [*c]const u8, v: [*c]c_int, v_speed: f32, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igDragInt4(label: [*c]const u8, v: [*c]c_int, v_speed: f32, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igDragIntRange2(label: [*c]const u8, v_current_min: [*c]c_int, v_current_max: [*c]c_int, v_speed: f32, v_min: c_int, v_max: c_int, format: [*c]const u8, format_max: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igDragScalar(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*anyopaque, v_speed: f32, p_min: ?*const anyopaque, p_max: ?*const anyopaque, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igDragScalarN(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*anyopaque, components: c_int, v_speed: f32, p_min: ?*const anyopaque, p_max: ?*const anyopaque, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderFloat(label: [*c]const u8, v: [*c]f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderFloat2(label: [*c]const u8, v: [*c]f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderFloat3(label: [*c]const u8, v: [*c]f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderFloat4(label: [*c]const u8, v: [*c]f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderAngle(label: [*c]const u8, v_rad: [*c]f32, v_degrees_min: f32, v_degrees_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderInt(label: [*c]const u8, v: [*c]c_int, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderInt2(label: [*c]const u8, v: [*c]c_int, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderInt3(label: [*c]const u8, v: [*c]c_int, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderInt4(label: [*c]const u8, v: [*c]c_int, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderScalar(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*anyopaque, p_min: ?*const anyopaque, p_max: ?*const anyopaque, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderScalarN(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*anyopaque, components: c_int, p_min: ?*const anyopaque, p_max: ?*const anyopaque, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igVSliderFloat(label: [*c]const u8, size: ImVec2, v: [*c]f32, v_min: f32, v_max: f32, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igVSliderInt(label: [*c]const u8, size: ImVec2, v: [*c]c_int, v_min: c_int, v_max: c_int, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igVSliderScalar(label: [*c]const u8, size: ImVec2, data_type: ImGuiDataType, p_data: ?*anyopaque, p_min: ?*const anyopaque, p_max: ?*const anyopaque, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igInputText(label: [*c]const u8, buf: [*c]u8, buf_size: usize, flags: ImGuiInputTextFlags, callback: ImGuiInputTextCallback, user_data: ?*anyopaque) bool;
pub extern fn igInputTextMultiline(label: [*c]const u8, buf: [*c]u8, buf_size: usize, size: ImVec2, flags: ImGuiInputTextFlags, callback: ImGuiInputTextCallback, user_data: ?*anyopaque) bool;
pub extern fn igInputTextWithHint(label: [*c]const u8, hint: [*c]const u8, buf: [*c]u8, buf_size: usize, flags: ImGuiInputTextFlags, callback: ImGuiInputTextCallback, user_data: ?*anyopaque) bool;
pub extern fn igInputFloat(label: [*c]const u8, v: [*c]f32, step: f32, step_fast: f32, format: [*c]const u8, flags: ImGuiInputTextFlags) bool;
pub extern fn igInputFloat2(label: [*c]const u8, v: [*c]f32, format: [*c]const u8, flags: ImGuiInputTextFlags) bool;
pub extern fn igInputFloat3(label: [*c]const u8, v: [*c]f32, format: [*c]const u8, flags: ImGuiInputTextFlags) bool;
pub extern fn igInputFloat4(label: [*c]const u8, v: [*c]f32, format: [*c]const u8, flags: ImGuiInputTextFlags) bool;
pub extern fn igInputInt(label: [*c]const u8, v: [*c]c_int, step: c_int, step_fast: c_int, flags: ImGuiInputTextFlags) bool;
pub extern fn igInputInt2(label: [*c]const u8, v: [*c]c_int, flags: ImGuiInputTextFlags) bool;
pub extern fn igInputInt3(label: [*c]const u8, v: [*c]c_int, flags: ImGuiInputTextFlags) bool;
pub extern fn igInputInt4(label: [*c]const u8, v: [*c]c_int, flags: ImGuiInputTextFlags) bool;
pub extern fn igInputDouble(label: [*c]const u8, v: [*c]f64, step: f64, step_fast: f64, format: [*c]const u8, flags: ImGuiInputTextFlags) bool;
pub extern fn igInputScalar(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*anyopaque, p_step: ?*const anyopaque, p_step_fast: ?*const anyopaque, format: [*c]const u8, flags: ImGuiInputTextFlags) bool;
pub extern fn igInputScalarN(label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*anyopaque, components: c_int, p_step: ?*const anyopaque, p_step_fast: ?*const anyopaque, format: [*c]const u8, flags: ImGuiInputTextFlags) bool;
pub extern fn igColorEdit3(label: [*c]const u8, col: [*c]f32, flags: ImGuiColorEditFlags) bool;
pub extern fn igColorEdit4(label: [*c]const u8, col: [*c]f32, flags: ImGuiColorEditFlags) bool;
pub extern fn igColorPicker3(label: [*c]const u8, col: [*c]f32, flags: ImGuiColorEditFlags) bool;
pub extern fn igColorPicker4(label: [*c]const u8, col: [*c]f32, flags: ImGuiColorEditFlags, ref_col: [*c]const f32) bool;
pub extern fn igColorButton(desc_id: [*c]const u8, col: ImVec4, flags: ImGuiColorEditFlags, size: ImVec2) bool;
pub extern fn igSetColorEditOptions(flags: ImGuiColorEditFlags) void;
pub extern fn igTreeNode_Str(label: [*c]const u8) bool;
pub extern fn igTreeNode_StrStr(str_id: [*c]const u8, fmt: [*c]const u8, ...) bool;
pub extern fn igTreeNode_Ptr(ptr_id: ?*const anyopaque, fmt: [*c]const u8, ...) bool;
pub extern fn igTreeNodeEx_Str(label: [*c]const u8, flags: ImGuiTreeNodeFlags) bool;
pub extern fn igTreeNodeEx_StrStr(str_id: [*c]const u8, flags: ImGuiTreeNodeFlags, fmt: [*c]const u8, ...) bool;
pub extern fn igTreeNodeEx_Ptr(ptr_id: ?*const anyopaque, flags: ImGuiTreeNodeFlags, fmt: [*c]const u8, ...) bool;
pub extern fn igTreePush_Str(str_id: [*c]const u8) void;
pub extern fn igTreePush_Ptr(ptr_id: ?*const anyopaque) void;
pub extern fn igTreePop() void;
pub extern fn igGetTreeNodeToLabelSpacing() f32;
pub extern fn igCollapsingHeader_TreeNodeFlags(label: [*c]const u8, flags: ImGuiTreeNodeFlags) bool;
pub extern fn igCollapsingHeader_BoolPtr(label: [*c]const u8, p_visible: [*c]bool, flags: ImGuiTreeNodeFlags) bool;
pub extern fn igSetNextItemOpen(is_open: bool, cond: ImGuiCond) void;
pub extern fn igSelectable_Bool(label: [*c]const u8, selected: bool, flags: ImGuiSelectableFlags, size: ImVec2) bool;
pub extern fn igSelectable_BoolPtr(label: [*c]const u8, p_selected: [*c]bool, flags: ImGuiSelectableFlags, size: ImVec2) bool;
pub extern fn igBeginListBox(label: [*c]const u8, size: ImVec2) bool;
pub extern fn igEndListBox() void;
pub extern fn igListBox_Str_arr(label: [*c]const u8, current_item: [*c]c_int, items: [*c]const [*c]const u8, items_count: c_int, height_in_items: c_int) bool;
pub extern fn igListBox_FnBoolPtr(label: [*c]const u8, current_item: [*c]c_int, items_getter: ?fn (?*anyopaque, c_int, [*c][*c]const u8) callconv(.C) bool, data: ?*anyopaque, items_count: c_int, height_in_items: c_int) bool;
pub extern fn igPlotLines_FloatPtr(label: [*c]const u8, values: [*c]const f32, values_count: c_int, values_offset: c_int, overlay_text: [*c]const u8, scale_min: f32, scale_max: f32, graph_size: ImVec2, stride: c_int) void;
pub extern fn igPlotLines_FnFloatPtr(label: [*c]const u8, values_getter: ?fn (?*anyopaque, c_int) callconv(.C) f32, data: ?*anyopaque, values_count: c_int, values_offset: c_int, overlay_text: [*c]const u8, scale_min: f32, scale_max: f32, graph_size: ImVec2) void;
pub extern fn igPlotHistogram_FloatPtr(label: [*c]const u8, values: [*c]const f32, values_count: c_int, values_offset: c_int, overlay_text: [*c]const u8, scale_min: f32, scale_max: f32, graph_size: ImVec2, stride: c_int) void;
pub extern fn igPlotHistogram_FnFloatPtr(label: [*c]const u8, values_getter: ?fn (?*anyopaque, c_int) callconv(.C) f32, data: ?*anyopaque, values_count: c_int, values_offset: c_int, overlay_text: [*c]const u8, scale_min: f32, scale_max: f32, graph_size: ImVec2) void;
pub extern fn igValue_Bool(prefix: [*c]const u8, b: bool) void;
pub extern fn igValue_Int(prefix: [*c]const u8, v: c_int) void;
pub extern fn igValue_Uint(prefix: [*c]const u8, v: c_uint) void;
pub extern fn igValue_Float(prefix: [*c]const u8, v: f32, float_format: [*c]const u8) void;
pub extern fn igBeginMenuBar() bool;
pub extern fn igEndMenuBar() void;
pub extern fn igBeginMainMenuBar() bool;
pub extern fn igEndMainMenuBar() void;
pub extern fn igBeginMenu(label: [*c]const u8, enabled: bool) bool;
pub extern fn igEndMenu() void;
pub extern fn igMenuItem_Bool(label: [*c]const u8, shortcut: [*c]const u8, selected: bool, enabled: bool) bool;
pub extern fn igMenuItem_BoolPtr(label: [*c]const u8, shortcut: [*c]const u8, p_selected: [*c]bool, enabled: bool) bool;
pub extern fn igBeginTooltip() void;
pub extern fn igEndTooltip() void;
pub extern fn igSetTooltip(fmt: [*c]const u8, ...) void;
pub extern fn igBeginPopup(str_id: [*c]const u8, flags: ImGuiWindowFlags) bool;
pub extern fn igBeginPopupModal(name: [*c]const u8, p_open: [*c]bool, flags: ImGuiWindowFlags) bool;
pub extern fn igEndPopup() void;
pub extern fn igOpenPopup_Str(str_id: [*c]const u8, popup_flags: ImGuiPopupFlags) void;
pub extern fn igOpenPopup_ID(id: ImGuiID, popup_flags: ImGuiPopupFlags) void;
pub extern fn igOpenPopupOnItemClick(str_id: [*c]const u8, popup_flags: ImGuiPopupFlags) void;
pub extern fn igCloseCurrentPopup() void;
pub extern fn igBeginPopupContextItem(str_id: [*c]const u8, popup_flags: ImGuiPopupFlags) bool;
pub extern fn igBeginPopupContextWindow(str_id: [*c]const u8, popup_flags: ImGuiPopupFlags) bool;
pub extern fn igBeginPopupContextVoid(str_id: [*c]const u8, popup_flags: ImGuiPopupFlags) bool;
pub extern fn igIsPopupOpen_Str(str_id: [*c]const u8, flags: ImGuiPopupFlags) bool;
pub extern fn igBeginTable(str_id: [*c]const u8, column: c_int, flags: ImGuiTableFlags, outer_size: ImVec2, inner_width: f32) bool;
pub extern fn igEndTable() void;
pub extern fn igTableNextRow(row_flags: ImGuiTableRowFlags, min_row_height: f32) void;
pub extern fn igTableNextColumn() bool;
pub extern fn igTableSetColumnIndex(column_n: c_int) bool;
pub extern fn igTableSetupColumn(label: [*c]const u8, flags: ImGuiTableColumnFlags, init_width_or_weight: f32, user_id: ImGuiID) void;
pub extern fn igTableSetupScrollFreeze(cols: c_int, rows: c_int) void;
pub extern fn igTableHeadersRow() void;
pub extern fn igTableHeader(label: [*c]const u8) void;
pub extern fn igTableGetSortSpecs() [*c]ImGuiTableSortSpecs;
pub extern fn igTableGetColumnCount() c_int;
pub extern fn igTableGetColumnIndex() c_int;
pub extern fn igTableGetRowIndex() c_int;
pub extern fn igTableGetColumnName_Int(column_n: c_int) [*c]const u8;
pub extern fn igTableGetColumnFlags(column_n: c_int) ImGuiTableColumnFlags;
pub extern fn igTableSetColumnEnabled(column_n: c_int, v: bool) void;
pub extern fn igTableSetBgColor(target: ImGuiTableBgTarget, color: ImU32, column_n: c_int) void;
pub extern fn igColumns(count: c_int, id: [*c]const u8, border: bool) void;
pub extern fn igNextColumn() void;
pub extern fn igGetColumnIndex() c_int;
pub extern fn igGetColumnWidth(column_index: c_int) f32;
pub extern fn igSetColumnWidth(column_index: c_int, width: f32) void;
pub extern fn igGetColumnOffset(column_index: c_int) f32;
pub extern fn igSetColumnOffset(column_index: c_int, offset_x: f32) void;
pub extern fn igGetColumnsCount() c_int;
pub extern fn igBeginTabBar(str_id: [*c]const u8, flags: ImGuiTabBarFlags) bool;
pub extern fn igEndTabBar() void;
pub extern fn igBeginTabItem(label: [*c]const u8, p_open: [*c]bool, flags: ImGuiTabItemFlags) bool;
pub extern fn igEndTabItem() void;
pub extern fn igTabItemButton(label: [*c]const u8, flags: ImGuiTabItemFlags) bool;
pub extern fn igSetTabItemClosed(tab_or_docked_window_label: [*c]const u8) void;
pub extern fn igLogToTTY(auto_open_depth: c_int) void;
pub extern fn igLogToFile(auto_open_depth: c_int, filename: [*c]const u8) void;
pub extern fn igLogToClipboard(auto_open_depth: c_int) void;
pub extern fn igLogFinish() void;
pub extern fn igLogButtons() void;
pub extern fn igBeginDragDropSource(flags: ImGuiDragDropFlags) bool;
pub extern fn igSetDragDropPayload(@"type": [*c]const u8, data: ?*const anyopaque, sz: usize, cond: ImGuiCond) bool;
pub extern fn igEndDragDropSource() void;
pub extern fn igBeginDragDropTarget() bool;
pub extern fn igAcceptDragDropPayload(@"type": [*c]const u8, flags: ImGuiDragDropFlags) [*c]const ImGuiPayload;
pub extern fn igEndDragDropTarget() void;
pub extern fn igGetDragDropPayload() [*c]const ImGuiPayload;
pub extern fn igBeginDisabled(disabled: bool) void;
pub extern fn igEndDisabled() void;
pub extern fn igPushClipRect(clip_rect_min: ImVec2, clip_rect_max: ImVec2, intersect_with_current_clip_rect: bool) void;
pub extern fn igPopClipRect() void;
pub extern fn igSetItemDefaultFocus() void;
pub extern fn igSetKeyboardFocusHere(offset: c_int) void;
pub extern fn igIsItemHovered(flags: ImGuiHoveredFlags) bool;
pub extern fn igIsItemActive() bool;
pub extern fn igIsItemFocused() bool;
pub extern fn igIsItemClicked(mouse_button: ImGuiMouseButton) bool;
pub extern fn igIsItemVisible() bool;
pub extern fn igIsItemEdited() bool;
pub extern fn igIsItemActivated() bool;
pub extern fn igIsItemDeactivated() bool;
pub extern fn igIsItemDeactivatedAfterEdit() bool;
pub extern fn igIsItemToggledOpen() bool;
pub extern fn igIsAnyItemHovered() bool;
pub extern fn igIsAnyItemActive() bool;
pub extern fn igIsAnyItemFocused() bool;
pub extern fn igGetItemRectMin(pOut: [*c]ImVec2) void;
pub extern fn igGetItemRectMax(pOut: [*c]ImVec2) void;
pub extern fn igGetItemRectSize(pOut: [*c]ImVec2) void;
pub extern fn igSetItemAllowOverlap() void;
pub extern fn igGetMainViewport() [*c]ImGuiViewport;
pub extern fn igIsRectVisible_Nil(size: ImVec2) bool;
pub extern fn igIsRectVisible_Vec2(rect_min: ImVec2, rect_max: ImVec2) bool;
pub extern fn igGetTime() f64;
pub extern fn igGetFrameCount() c_int;
pub extern fn igGetBackgroundDrawList_Nil() [*c]ImDrawList;
pub extern fn igGetForegroundDrawList_Nil() [*c]ImDrawList;
pub extern fn igGetDrawListSharedData() [*c]ImDrawListSharedData;
pub extern fn igGetStyleColorName(idx: ImGuiCol) [*c]const u8;
pub extern fn igSetStateStorage(storage: [*c]ImGuiStorage) void;
pub extern fn igGetStateStorage() [*c]ImGuiStorage;
pub extern fn igCalcListClipping(items_count: c_int, items_height: f32, out_items_display_start: [*c]c_int, out_items_display_end: [*c]c_int) void;
pub extern fn igBeginChildFrame(id: ImGuiID, size: ImVec2, flags: ImGuiWindowFlags) bool;
pub extern fn igEndChildFrame() void;
pub extern fn igCalcTextSize(pOut: [*c]ImVec2, text: [*c]const u8, text_end: [*c]const u8, hide_text_after_double_hash: bool, wrap_width: f32) void;
pub extern fn igColorConvertU32ToFloat4(pOut: [*c]ImVec4, in: ImU32) void;
pub extern fn igColorConvertFloat4ToU32(in: ImVec4) ImU32;
pub extern fn igColorConvertRGBtoHSV(r: f32, g: f32, b: f32, out_h: [*c]f32, out_s: [*c]f32, out_v: [*c]f32) void;
pub extern fn igColorConvertHSVtoRGB(h: f32, s: f32, v: f32, out_r: [*c]f32, out_g: [*c]f32, out_b: [*c]f32) void;
pub extern fn igGetKeyIndex(imgui_key: ImGuiKey) c_int;
pub extern fn igIsKeyDown(user_key_index: c_int) bool;
pub extern fn igIsKeyPressed(user_key_index: c_int, repeat: bool) bool;
pub extern fn igIsKeyReleased(user_key_index: c_int) bool;
pub extern fn igGetKeyPressedAmount(key_index: c_int, repeat_delay: f32, rate: f32) c_int;
pub extern fn igCaptureKeyboardFromApp(want_capture_keyboard_value: bool) void;
pub extern fn igIsMouseDown(button: ImGuiMouseButton) bool;
pub extern fn igIsMouseClicked(button: ImGuiMouseButton, repeat: bool) bool;
pub extern fn igIsMouseReleased(button: ImGuiMouseButton) bool;
pub extern fn igIsMouseDoubleClicked(button: ImGuiMouseButton) bool;
pub extern fn igIsMouseHoveringRect(r_min: ImVec2, r_max: ImVec2, clip: bool) bool;
pub extern fn igIsMousePosValid(mouse_pos: [*c]const ImVec2) bool;
pub extern fn igIsAnyMouseDown() bool;
pub extern fn igGetMousePos(pOut: [*c]ImVec2) void;
pub extern fn igGetMousePosOnOpeningCurrentPopup(pOut: [*c]ImVec2) void;
pub extern fn igIsMouseDragging(button: ImGuiMouseButton, lock_threshold: f32) bool;
pub extern fn igGetMouseDragDelta(pOut: [*c]ImVec2, button: ImGuiMouseButton, lock_threshold: f32) void;
pub extern fn igResetMouseDragDelta(button: ImGuiMouseButton) void;
pub extern fn igGetMouseCursor() ImGuiMouseCursor;
pub extern fn igSetMouseCursor(cursor_type: ImGuiMouseCursor) void;
pub extern fn igCaptureMouseFromApp(want_capture_mouse_value: bool) void;
pub extern fn igGetClipboardText() [*c]const u8;
pub extern fn igSetClipboardText(text: [*c]const u8) void;
pub extern fn igLoadIniSettingsFromDisk(ini_filename: [*c]const u8) void;
pub extern fn igLoadIniSettingsFromMemory(ini_data: [*c]const u8, ini_size: usize) void;
pub extern fn igSaveIniSettingsToDisk(ini_filename: [*c]const u8) void;
pub extern fn igSaveIniSettingsToMemory(out_ini_size: [*c]usize) [*c]const u8;
pub extern fn igDebugCheckVersionAndDataLayout(version_str: [*c]const u8, sz_io: usize, sz_style: usize, sz_vec2: usize, sz_vec4: usize, sz_drawvert: usize, sz_drawidx: usize) bool;
pub extern fn igSetAllocatorFunctions(alloc_func: ImGuiMemAllocFunc, free_func: ImGuiMemFreeFunc, user_data: ?*anyopaque) void;
pub extern fn igGetAllocatorFunctions(p_alloc_func: [*c]ImGuiMemAllocFunc, p_free_func: [*c]ImGuiMemFreeFunc, p_user_data: [*c]?*anyopaque) void;
pub extern fn igMemAlloc(size: usize) ?*anyopaque;
pub extern fn igMemFree(ptr: ?*anyopaque) void;
pub extern fn ImGuiStyle_ImGuiStyle() [*c]ImGuiStyle;
pub extern fn ImGuiStyle_destroy(self: [*c]ImGuiStyle) void;
pub extern fn ImGuiStyle_ScaleAllSizes(self: [*c]ImGuiStyle, scale_factor: f32) void;
pub extern fn ImGuiIO_AddInputCharacter(self: [*c]ImGuiIO, c: c_uint) void;
pub extern fn ImGuiIO_AddInputCharacterUTF16(self: [*c]ImGuiIO, c: ImWchar16) void;
pub extern fn ImGuiIO_AddInputCharactersUTF8(self: [*c]ImGuiIO, str: [*c]const u8) void;
pub extern fn ImGuiIO_AddFocusEvent(self: [*c]ImGuiIO, focused: bool) void;
pub extern fn ImGuiIO_ClearInputCharacters(self: [*c]ImGuiIO) void;
pub extern fn ImGuiIO_ClearInputKeys(self: [*c]ImGuiIO) void;
pub extern fn ImGuiIO_ImGuiIO() [*c]ImGuiIO;
pub extern fn ImGuiIO_destroy(self: [*c]ImGuiIO) void;
pub extern fn ImGuiInputTextCallbackData_ImGuiInputTextCallbackData() [*c]ImGuiInputTextCallbackData;
pub extern fn ImGuiInputTextCallbackData_destroy(self: [*c]ImGuiInputTextCallbackData) void;
pub extern fn ImGuiInputTextCallbackData_DeleteChars(self: [*c]ImGuiInputTextCallbackData, pos: c_int, bytes_count: c_int) void;
pub extern fn ImGuiInputTextCallbackData_InsertChars(self: [*c]ImGuiInputTextCallbackData, pos: c_int, text: [*c]const u8, text_end: [*c]const u8) void;
pub extern fn ImGuiInputTextCallbackData_SelectAll(self: [*c]ImGuiInputTextCallbackData) void;
pub extern fn ImGuiInputTextCallbackData_ClearSelection(self: [*c]ImGuiInputTextCallbackData) void;
pub extern fn ImGuiInputTextCallbackData_HasSelection(self: [*c]ImGuiInputTextCallbackData) bool;
pub extern fn ImGuiPayload_ImGuiPayload() [*c]ImGuiPayload;
pub extern fn ImGuiPayload_destroy(self: [*c]ImGuiPayload) void;
pub extern fn ImGuiPayload_Clear(self: [*c]ImGuiPayload) void;
pub extern fn ImGuiPayload_IsDataType(self: [*c]ImGuiPayload, @"type": [*c]const u8) bool;
pub extern fn ImGuiPayload_IsPreview(self: [*c]ImGuiPayload) bool;
pub extern fn ImGuiPayload_IsDelivery(self: [*c]ImGuiPayload) bool;
pub extern fn ImGuiTableColumnSortSpecs_ImGuiTableColumnSortSpecs() ?*ImGuiTableColumnSortSpecs;
pub extern fn ImGuiTableColumnSortSpecs_destroy(self: ?*ImGuiTableColumnSortSpecs) void;
pub extern fn ImGuiTableSortSpecs_ImGuiTableSortSpecs() [*c]ImGuiTableSortSpecs;
pub extern fn ImGuiTableSortSpecs_destroy(self: [*c]ImGuiTableSortSpecs) void;
pub extern fn ImGuiOnceUponAFrame_ImGuiOnceUponAFrame() [*c]ImGuiOnceUponAFrame;
pub extern fn ImGuiOnceUponAFrame_destroy(self: [*c]ImGuiOnceUponAFrame) void;
pub extern fn ImGuiTextFilter_ImGuiTextFilter(default_filter: [*c]const u8) [*c]ImGuiTextFilter;
pub extern fn ImGuiTextFilter_destroy(self: [*c]ImGuiTextFilter) void;
pub extern fn ImGuiTextFilter_Draw(self: [*c]ImGuiTextFilter, label: [*c]const u8, width: f32) bool;
pub extern fn ImGuiTextFilter_PassFilter(self: [*c]ImGuiTextFilter, text: [*c]const u8, text_end: [*c]const u8) bool;
pub extern fn ImGuiTextFilter_Build(self: [*c]ImGuiTextFilter) void;
pub extern fn ImGuiTextFilter_Clear(self: [*c]ImGuiTextFilter) void;
pub extern fn ImGuiTextFilter_IsActive(self: [*c]ImGuiTextFilter) bool;
pub extern fn ImGuiTextRange_ImGuiTextRange_Nil() [*c]ImGuiTextRange;
pub extern fn ImGuiTextRange_destroy(self: [*c]ImGuiTextRange) void;
pub extern fn ImGuiTextRange_ImGuiTextRange_Str(_b: [*c]const u8, _e: [*c]const u8) [*c]ImGuiTextRange;
pub extern fn ImGuiTextRange_empty(self: [*c]ImGuiTextRange) bool;
pub extern fn ImGuiTextRange_split(self: [*c]ImGuiTextRange, separator: u8, out: [*c]ImVector_ImGuiTextRange) void;
pub extern fn ImGuiTextBuffer_ImGuiTextBuffer() [*c]ImGuiTextBuffer;
pub extern fn ImGuiTextBuffer_destroy(self: [*c]ImGuiTextBuffer) void;
pub extern fn ImGuiTextBuffer_begin(self: [*c]ImGuiTextBuffer) [*c]const u8;
pub extern fn ImGuiTextBuffer_end(self: [*c]ImGuiTextBuffer) [*c]const u8;
pub extern fn ImGuiTextBuffer_size(self: [*c]ImGuiTextBuffer) c_int;
pub extern fn ImGuiTextBuffer_empty(self: [*c]ImGuiTextBuffer) bool;
pub extern fn ImGuiTextBuffer_clear(self: [*c]ImGuiTextBuffer) void;
pub extern fn ImGuiTextBuffer_reserve(self: [*c]ImGuiTextBuffer, capacity: c_int) void;
pub extern fn ImGuiTextBuffer_c_str(self: [*c]ImGuiTextBuffer) [*c]const u8;
pub extern fn ImGuiTextBuffer_append(self: [*c]ImGuiTextBuffer, str: [*c]const u8, str_end: [*c]const u8) void;
pub extern fn ImGuiStoragePair_ImGuiStoragePair_Int(_key: ImGuiID, _val_i: c_int) [*c]ImGuiStoragePair;
pub extern fn ImGuiStoragePair_destroy(self: [*c]ImGuiStoragePair) void;
pub extern fn ImGuiStoragePair_ImGuiStoragePair_Float(_key: ImGuiID, _val_f: f32) [*c]ImGuiStoragePair;
pub extern fn ImGuiStoragePair_ImGuiStoragePair_Ptr(_key: ImGuiID, _val_p: ?*anyopaque) [*c]ImGuiStoragePair;
pub extern fn ImGuiStorage_Clear(self: [*c]ImGuiStorage) void;
pub extern fn ImGuiStorage_GetInt(self: [*c]ImGuiStorage, key: ImGuiID, default_val: c_int) c_int;
pub extern fn ImGuiStorage_SetInt(self: [*c]ImGuiStorage, key: ImGuiID, val: c_int) void;
pub extern fn ImGuiStorage_GetBool(self: [*c]ImGuiStorage, key: ImGuiID, default_val: bool) bool;
pub extern fn ImGuiStorage_SetBool(self: [*c]ImGuiStorage, key: ImGuiID, val: bool) void;
pub extern fn ImGuiStorage_GetFloat(self: [*c]ImGuiStorage, key: ImGuiID, default_val: f32) f32;
pub extern fn ImGuiStorage_SetFloat(self: [*c]ImGuiStorage, key: ImGuiID, val: f32) void;
pub extern fn ImGuiStorage_GetVoidPtr(self: [*c]ImGuiStorage, key: ImGuiID) ?*anyopaque;
pub extern fn ImGuiStorage_SetVoidPtr(self: [*c]ImGuiStorage, key: ImGuiID, val: ?*anyopaque) void;
pub extern fn ImGuiStorage_GetIntRef(self: [*c]ImGuiStorage, key: ImGuiID, default_val: c_int) [*c]c_int;
pub extern fn ImGuiStorage_GetBoolRef(self: [*c]ImGuiStorage, key: ImGuiID, default_val: bool) [*c]bool;
pub extern fn ImGuiStorage_GetFloatRef(self: [*c]ImGuiStorage, key: ImGuiID, default_val: f32) [*c]f32;
pub extern fn ImGuiStorage_GetVoidPtrRef(self: [*c]ImGuiStorage, key: ImGuiID, default_val: ?*anyopaque) [*c]?*anyopaque;
pub extern fn ImGuiStorage_SetAllInt(self: [*c]ImGuiStorage, val: c_int) void;
pub extern fn ImGuiStorage_BuildSortByKey(self: [*c]ImGuiStorage) void;
pub extern fn ImGuiListClipper_ImGuiListClipper() [*c]ImGuiListClipper;
pub extern fn ImGuiListClipper_destroy(self: [*c]ImGuiListClipper) void;
pub extern fn ImGuiListClipper_Begin(self: [*c]ImGuiListClipper, items_count: c_int, items_height: f32) void;
pub extern fn ImGuiListClipper_End(self: [*c]ImGuiListClipper) void;
pub extern fn ImGuiListClipper_Step(self: [*c]ImGuiListClipper) bool;
pub extern fn ImColor_ImColor_Nil() [*c]ImColor;
pub extern fn ImColor_destroy(self: [*c]ImColor) void;
pub extern fn ImColor_ImColor_Int(r: c_int, g: c_int, b: c_int, a: c_int) [*c]ImColor;
pub extern fn ImColor_ImColor_U32(rgba: ImU32) [*c]ImColor;
pub extern fn ImColor_ImColor_Float(r: f32, g: f32, b: f32, a: f32) [*c]ImColor;
pub extern fn ImColor_ImColor_Vec4(col: ImVec4) [*c]ImColor;
pub extern fn ImColor_SetHSV(self: [*c]ImColor, h: f32, s: f32, v: f32, a: f32) void;
pub extern fn ImColor_HSV(pOut: [*c]ImColor, h: f32, s: f32, v: f32, a: f32) void;
pub extern fn ImDrawCmd_ImDrawCmd() [*c]ImDrawCmd;
pub extern fn ImDrawCmd_destroy(self: [*c]ImDrawCmd) void;
pub extern fn ImDrawCmd_GetTexID(self: [*c]ImDrawCmd) ImTextureID;
pub extern fn ImDrawListSplitter_ImDrawListSplitter() [*c]ImDrawListSplitter;
pub extern fn ImDrawListSplitter_destroy(self: [*c]ImDrawListSplitter) void;
pub extern fn ImDrawListSplitter_Clear(self: [*c]ImDrawListSplitter) void;
pub extern fn ImDrawListSplitter_ClearFreeMemory(self: [*c]ImDrawListSplitter) void;
pub extern fn ImDrawListSplitter_Split(self: [*c]ImDrawListSplitter, draw_list: [*c]ImDrawList, count: c_int) void;
pub extern fn ImDrawListSplitter_Merge(self: [*c]ImDrawListSplitter, draw_list: [*c]ImDrawList) void;
pub extern fn ImDrawListSplitter_SetCurrentChannel(self: [*c]ImDrawListSplitter, draw_list: [*c]ImDrawList, channel_idx: c_int) void;
pub extern fn ImDrawList_ImDrawList(shared_data: [*c]const ImDrawListSharedData) [*c]ImDrawList;
pub extern fn ImDrawList_destroy(self: [*c]ImDrawList) void;
pub extern fn ImDrawList_PushClipRect(self: [*c]ImDrawList, clip_rect_min: ImVec2, clip_rect_max: ImVec2, intersect_with_current_clip_rect: bool) void;
pub extern fn ImDrawList_PushClipRectFullScreen(self: [*c]ImDrawList) void;
pub extern fn ImDrawList_PopClipRect(self: [*c]ImDrawList) void;
pub extern fn ImDrawList_PushTextureID(self: [*c]ImDrawList, texture_id: ImTextureID) void;
pub extern fn ImDrawList_PopTextureID(self: [*c]ImDrawList) void;
pub extern fn ImDrawList_GetClipRectMin(pOut: [*c]ImVec2, self: [*c]ImDrawList) void;
pub extern fn ImDrawList_GetClipRectMax(pOut: [*c]ImVec2, self: [*c]ImDrawList) void;
pub extern fn ImDrawList_AddLine(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, col: ImU32, thickness: f32) void;
pub extern fn ImDrawList_AddRect(self: [*c]ImDrawList, p_min: ImVec2, p_max: ImVec2, col: ImU32, rounding: f32, flags: ImDrawFlags, thickness: f32) void;
pub extern fn ImDrawList_AddRectFilled(self: [*c]ImDrawList, p_min: ImVec2, p_max: ImVec2, col: ImU32, rounding: f32, flags: ImDrawFlags) void;
pub extern fn ImDrawList_AddRectFilledMultiColor(self: [*c]ImDrawList, p_min: ImVec2, p_max: ImVec2, col_upr_left: ImU32, col_upr_right: ImU32, col_bot_right: ImU32, col_bot_left: ImU32) void;
pub extern fn ImDrawList_AddQuad(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, col: ImU32, thickness: f32) void;
pub extern fn ImDrawList_AddQuadFilled(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, col: ImU32) void;
pub extern fn ImDrawList_AddTriangle(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, col: ImU32, thickness: f32) void;
pub extern fn ImDrawList_AddTriangleFilled(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, col: ImU32) void;
pub extern fn ImDrawList_AddCircle(self: [*c]ImDrawList, center: ImVec2, radius: f32, col: ImU32, num_segments: c_int, thickness: f32) void;
pub extern fn ImDrawList_AddCircleFilled(self: [*c]ImDrawList, center: ImVec2, radius: f32, col: ImU32, num_segments: c_int) void;
pub extern fn ImDrawList_AddNgon(self: [*c]ImDrawList, center: ImVec2, radius: f32, col: ImU32, num_segments: c_int, thickness: f32) void;
pub extern fn ImDrawList_AddNgonFilled(self: [*c]ImDrawList, center: ImVec2, radius: f32, col: ImU32, num_segments: c_int) void;
pub extern fn ImDrawList_AddText_Vec2(self: [*c]ImDrawList, pos: ImVec2, col: ImU32, text_begin: [*c]const u8, text_end: [*c]const u8) void;
pub extern fn ImDrawList_AddText_FontPtr(self: [*c]ImDrawList, font: [*c]const ImFont, font_size: f32, pos: ImVec2, col: ImU32, text_begin: [*c]const u8, text_end: [*c]const u8, wrap_width: f32, cpu_fine_clip_rect: [*c]const ImVec4) void;
pub extern fn ImDrawList_AddPolyline(self: [*c]ImDrawList, points: [*c]const ImVec2, num_points: c_int, col: ImU32, flags: ImDrawFlags, thickness: f32) void;
pub extern fn ImDrawList_AddConvexPolyFilled(self: [*c]ImDrawList, points: [*c]const ImVec2, num_points: c_int, col: ImU32) void;
pub extern fn ImDrawList_AddBezierCubic(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, col: ImU32, thickness: f32, num_segments: c_int) void;
pub extern fn ImDrawList_AddBezierQuadratic(self: [*c]ImDrawList, p1: ImVec2, p2: ImVec2, p3: ImVec2, col: ImU32, thickness: f32, num_segments: c_int) void;
pub extern fn ImDrawList_AddImage(self: [*c]ImDrawList, user_texture_id: ImTextureID, p_min: ImVec2, p_max: ImVec2, uv_min: ImVec2, uv_max: ImVec2, col: ImU32) void;
pub extern fn ImDrawList_AddImageQuad(self: [*c]ImDrawList, user_texture_id: ImTextureID, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, uv1: ImVec2, uv2: ImVec2, uv3: ImVec2, uv4: ImVec2, col: ImU32) void;
pub extern fn ImDrawList_AddImageRounded(self: [*c]ImDrawList, user_texture_id: ImTextureID, p_min: ImVec2, p_max: ImVec2, uv_min: ImVec2, uv_max: ImVec2, col: ImU32, rounding: f32, flags: ImDrawFlags) void;
pub extern fn ImDrawList_PathClear(self: [*c]ImDrawList) void;
pub extern fn ImDrawList_PathLineTo(self: [*c]ImDrawList, pos: ImVec2) void;
pub extern fn ImDrawList_PathLineToMergeDuplicate(self: [*c]ImDrawList, pos: ImVec2) void;
pub extern fn ImDrawList_PathFillConvex(self: [*c]ImDrawList, col: ImU32) void;
pub extern fn ImDrawList_PathStroke(self: [*c]ImDrawList, col: ImU32, flags: ImDrawFlags, thickness: f32) void;
pub extern fn ImDrawList_PathArcTo(self: [*c]ImDrawList, center: ImVec2, radius: f32, a_min: f32, a_max: f32, num_segments: c_int) void;
pub extern fn ImDrawList_PathArcToFast(self: [*c]ImDrawList, center: ImVec2, radius: f32, a_min_of_12: c_int, a_max_of_12: c_int) void;
pub extern fn ImDrawList_PathBezierCubicCurveTo(self: [*c]ImDrawList, p2: ImVec2, p3: ImVec2, p4: ImVec2, num_segments: c_int) void;
pub extern fn ImDrawList_PathBezierQuadraticCurveTo(self: [*c]ImDrawList, p2: ImVec2, p3: ImVec2, num_segments: c_int) void;
pub extern fn ImDrawList_PathRect(self: [*c]ImDrawList, rect_min: ImVec2, rect_max: ImVec2, rounding: f32, flags: ImDrawFlags) void;
pub extern fn ImDrawList_AddCallback(self: [*c]ImDrawList, callback: ImDrawCallback, callback_data: ?*anyopaque) void;
pub extern fn ImDrawList_AddDrawCmd(self: [*c]ImDrawList) void;
pub extern fn ImDrawList_CloneOutput(self: [*c]ImDrawList) [*c]ImDrawList;
pub extern fn ImDrawList_ChannelsSplit(self: [*c]ImDrawList, count: c_int) void;
pub extern fn ImDrawList_ChannelsMerge(self: [*c]ImDrawList) void;
pub extern fn ImDrawList_ChannelsSetCurrent(self: [*c]ImDrawList, n: c_int) void;
pub extern fn ImDrawList_PrimReserve(self: [*c]ImDrawList, idx_count: c_int, vtx_count: c_int) void;
pub extern fn ImDrawList_PrimUnreserve(self: [*c]ImDrawList, idx_count: c_int, vtx_count: c_int) void;
pub extern fn ImDrawList_PrimRect(self: [*c]ImDrawList, a: ImVec2, b: ImVec2, col: ImU32) void;
pub extern fn ImDrawList_PrimRectUV(self: [*c]ImDrawList, a: ImVec2, b: ImVec2, uv_a: ImVec2, uv_b: ImVec2, col: ImU32) void;
pub extern fn ImDrawList_PrimQuadUV(self: [*c]ImDrawList, a: ImVec2, b: ImVec2, c: ImVec2, d: ImVec2, uv_a: ImVec2, uv_b: ImVec2, uv_c: ImVec2, uv_d: ImVec2, col: ImU32) void;
pub extern fn ImDrawList_PrimWriteVtx(self: [*c]ImDrawList, pos: ImVec2, uv: ImVec2, col: ImU32) void;
pub extern fn ImDrawList_PrimWriteIdx(self: [*c]ImDrawList, idx: ImDrawIdx) void;
pub extern fn ImDrawList_PrimVtx(self: [*c]ImDrawList, pos: ImVec2, uv: ImVec2, col: ImU32) void;
pub extern fn ImDrawList__ResetForNewFrame(self: [*c]ImDrawList) void;
pub extern fn ImDrawList__ClearFreeMemory(self: [*c]ImDrawList) void;
pub extern fn ImDrawList__PopUnusedDrawCmd(self: [*c]ImDrawList) void;
pub extern fn ImDrawList__TryMergeDrawCmds(self: [*c]ImDrawList) void;
pub extern fn ImDrawList__OnChangedClipRect(self: [*c]ImDrawList) void;
pub extern fn ImDrawList__OnChangedTextureID(self: [*c]ImDrawList) void;
pub extern fn ImDrawList__OnChangedVtxOffset(self: [*c]ImDrawList) void;
pub extern fn ImDrawList__CalcCircleAutoSegmentCount(self: [*c]ImDrawList, radius: f32) c_int;
pub extern fn ImDrawList__PathArcToFastEx(self: [*c]ImDrawList, center: ImVec2, radius: f32, a_min_sample: c_int, a_max_sample: c_int, a_step: c_int) void;
pub extern fn ImDrawList__PathArcToN(self: [*c]ImDrawList, center: ImVec2, radius: f32, a_min: f32, a_max: f32, num_segments: c_int) void;
pub extern fn ImDrawData_ImDrawData() [*c]ImDrawData;
pub extern fn ImDrawData_destroy(self: [*c]ImDrawData) void;
pub extern fn ImDrawData_Clear(self: [*c]ImDrawData) void;
pub extern fn ImDrawData_DeIndexAllBuffers(self: [*c]ImDrawData) void;
pub extern fn ImDrawData_ScaleClipRects(self: [*c]ImDrawData, fb_scale: ImVec2) void;
pub extern fn ImFontConfig_ImFontConfig() [*c]ImFontConfig;
pub extern fn ImFontConfig_destroy(self: [*c]ImFontConfig) void;
pub extern fn ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder() [*c]ImFontGlyphRangesBuilder;
pub extern fn ImFontGlyphRangesBuilder_destroy(self: [*c]ImFontGlyphRangesBuilder) void;
pub extern fn ImFontGlyphRangesBuilder_Clear(self: [*c]ImFontGlyphRangesBuilder) void;
pub extern fn ImFontGlyphRangesBuilder_GetBit(self: [*c]ImFontGlyphRangesBuilder, n: usize) bool;
pub extern fn ImFontGlyphRangesBuilder_SetBit(self: [*c]ImFontGlyphRangesBuilder, n: usize) void;
pub extern fn ImFontGlyphRangesBuilder_AddChar(self: [*c]ImFontGlyphRangesBuilder, c: ImWchar) void;
pub extern fn ImFontGlyphRangesBuilder_AddText(self: [*c]ImFontGlyphRangesBuilder, text: [*c]const u8, text_end: [*c]const u8) void;
pub extern fn ImFontGlyphRangesBuilder_AddRanges(self: [*c]ImFontGlyphRangesBuilder, ranges: [*c]const ImWchar) void;
pub extern fn ImFontGlyphRangesBuilder_BuildRanges(self: [*c]ImFontGlyphRangesBuilder, out_ranges: [*c]ImVector_ImWchar) void;
pub extern fn ImFontAtlasCustomRect_ImFontAtlasCustomRect() [*c]ImFontAtlasCustomRect;
pub extern fn ImFontAtlasCustomRect_destroy(self: [*c]ImFontAtlasCustomRect) void;
pub extern fn ImFontAtlasCustomRect_IsPacked(self: [*c]ImFontAtlasCustomRect) bool;
pub extern fn ImFontAtlas_ImFontAtlas() [*c]ImFontAtlas;
pub extern fn ImFontAtlas_destroy(self: [*c]ImFontAtlas) void;
pub extern fn ImFontAtlas_AddFont(self: [*c]ImFontAtlas, font_cfg: [*c]const ImFontConfig) [*c]ImFont;
pub extern fn ImFontAtlas_AddFontDefault(self: [*c]ImFontAtlas, font_cfg: [*c]const ImFontConfig) [*c]ImFont;
pub extern fn ImFontAtlas_AddFontFromFileTTF(self: [*c]ImFontAtlas, filename: [*c]const u8, size_pixels: f32, font_cfg: [*c]const ImFontConfig, glyph_ranges: [*c]const ImWchar) [*c]ImFont;
pub extern fn ImFontAtlas_AddFontFromMemoryTTF(self: [*c]ImFontAtlas, font_data: ?*anyopaque, font_size: c_int, size_pixels: f32, font_cfg: [*c]const ImFontConfig, glyph_ranges: [*c]const ImWchar) [*c]ImFont;
pub extern fn ImFontAtlas_AddFontFromMemoryCompressedTTF(self: [*c]ImFontAtlas, compressed_font_data: ?*const anyopaque, compressed_font_size: c_int, size_pixels: f32, font_cfg: [*c]const ImFontConfig, glyph_ranges: [*c]const ImWchar) [*c]ImFont;
pub extern fn ImFontAtlas_AddFontFromMemoryCompressedBase85TTF(self: [*c]ImFontAtlas, compressed_font_data_base85: [*c]const u8, size_pixels: f32, font_cfg: [*c]const ImFontConfig, glyph_ranges: [*c]const ImWchar) [*c]ImFont;
pub extern fn ImFontAtlas_ClearInputData(self: [*c]ImFontAtlas) void;
pub extern fn ImFontAtlas_ClearTexData(self: [*c]ImFontAtlas) void;
pub extern fn ImFontAtlas_ClearFonts(self: [*c]ImFontAtlas) void;
pub extern fn ImFontAtlas_Clear(self: [*c]ImFontAtlas) void;
pub extern fn ImFontAtlas_Build(self: [*c]ImFontAtlas) bool;
pub extern fn ImFontAtlas_GetTexDataAsAlpha8(self: [*c]ImFontAtlas, out_pixels: [*c][*c]u8, out_width: [*c]c_int, out_height: [*c]c_int, out_bytes_per_pixel: [*c]c_int) void;
pub extern fn ImFontAtlas_GetTexDataAsRGBA32(self: [*c]ImFontAtlas, out_pixels: [*c][*c]u8, out_width: [*c]c_int, out_height: [*c]c_int, out_bytes_per_pixel: [*c]c_int) void;
pub extern fn ImFontAtlas_IsBuilt(self: [*c]ImFontAtlas) bool;
pub extern fn ImFontAtlas_SetTexID(self: [*c]ImFontAtlas, id: ImTextureID) void;
pub extern fn ImFontAtlas_GetGlyphRangesDefault(self: [*c]ImFontAtlas) [*c]const ImWchar;
pub extern fn ImFontAtlas_GetGlyphRangesKorean(self: [*c]ImFontAtlas) [*c]const ImWchar;
pub extern fn ImFontAtlas_GetGlyphRangesJapanese(self: [*c]ImFontAtlas) [*c]const ImWchar;
pub extern fn ImFontAtlas_GetGlyphRangesChineseFull(self: [*c]ImFontAtlas) [*c]const ImWchar;
pub extern fn ImFontAtlas_GetGlyphRangesChineseSimplifiedCommon(self: [*c]ImFontAtlas) [*c]const ImWchar;
pub extern fn ImFontAtlas_GetGlyphRangesCyrillic(self: [*c]ImFontAtlas) [*c]const ImWchar;
pub extern fn ImFontAtlas_GetGlyphRangesThai(self: [*c]ImFontAtlas) [*c]const ImWchar;
pub extern fn ImFontAtlas_GetGlyphRangesVietnamese(self: [*c]ImFontAtlas) [*c]const ImWchar;
pub extern fn ImFontAtlas_AddCustomRectRegular(self: [*c]ImFontAtlas, width: c_int, height: c_int) c_int;
pub extern fn ImFontAtlas_AddCustomRectFontGlyph(self: [*c]ImFontAtlas, font: [*c]ImFont, id: ImWchar, width: c_int, height: c_int, advance_x: f32, offset: ImVec2) c_int;
pub extern fn ImFontAtlas_GetCustomRectByIndex(self: [*c]ImFontAtlas, index: c_int) [*c]ImFontAtlasCustomRect;
pub extern fn ImFontAtlas_CalcCustomRectUV(self: [*c]ImFontAtlas, rect: [*c]const ImFontAtlasCustomRect, out_uv_min: [*c]ImVec2, out_uv_max: [*c]ImVec2) void;
pub extern fn ImFontAtlas_GetMouseCursorTexData(self: [*c]ImFontAtlas, cursor: ImGuiMouseCursor, out_offset: [*c]ImVec2, out_size: [*c]ImVec2, out_uv_border: [*c]ImVec2, out_uv_fill: [*c]ImVec2) bool;
pub extern fn ImFont_ImFont() [*c]ImFont;
pub extern fn ImFont_destroy(self: [*c]ImFont) void;
pub extern fn ImFont_FindGlyph(self: [*c]ImFont, c: ImWchar) ?*const ImFontGlyph;
pub extern fn ImFont_FindGlyphNoFallback(self: [*c]ImFont, c: ImWchar) ?*const ImFontGlyph;
pub extern fn ImFont_GetCharAdvance(self: [*c]ImFont, c: ImWchar) f32;
pub extern fn ImFont_IsLoaded(self: [*c]ImFont) bool;
pub extern fn ImFont_GetDebugName(self: [*c]ImFont) [*c]const u8;
pub extern fn ImFont_CalcTextSizeA(pOut: [*c]ImVec2, self: [*c]ImFont, size: f32, max_width: f32, wrap_width: f32, text_begin: [*c]const u8, text_end: [*c]const u8, remaining: [*c][*c]const u8) void;
pub extern fn ImFont_CalcWordWrapPositionA(self: [*c]ImFont, scale: f32, text: [*c]const u8, text_end: [*c]const u8, wrap_width: f32) [*c]const u8;
pub extern fn ImFont_RenderChar(self: [*c]ImFont, draw_list: [*c]ImDrawList, size: f32, pos: ImVec2, col: ImU32, c: ImWchar) void;
pub extern fn ImFont_RenderText(self: [*c]ImFont, draw_list: [*c]ImDrawList, size: f32, pos: ImVec2, col: ImU32, clip_rect: ImVec4, text_begin: [*c]const u8, text_end: [*c]const u8, wrap_width: f32, cpu_fine_clip: bool) void;
pub extern fn ImFont_BuildLookupTable(self: [*c]ImFont) void;
pub extern fn ImFont_ClearOutputData(self: [*c]ImFont) void;
pub extern fn ImFont_GrowIndex(self: [*c]ImFont, new_size: c_int) void;
pub extern fn ImFont_AddGlyph(self: [*c]ImFont, src_cfg: [*c]const ImFontConfig, c: ImWchar, x0: f32, y0: f32, x1: f32, y1: f32, @"u0": f32, v0: f32, @"u1": f32, v1: f32, advance_x: f32) void;
pub extern fn ImFont_AddRemapChar(self: [*c]ImFont, dst: ImWchar, src: ImWchar, overwrite_dst: bool) void;
pub extern fn ImFont_SetGlyphVisible(self: [*c]ImFont, c: ImWchar, visible: bool) void;
pub extern fn ImFont_IsGlyphRangeUnused(self: [*c]ImFont, c_begin: c_uint, c_last: c_uint) bool;
pub extern fn ImGuiViewport_ImGuiViewport() [*c]ImGuiViewport;
pub extern fn ImGuiViewport_destroy(self: [*c]ImGuiViewport) void;
pub extern fn ImGuiViewport_GetCenter(pOut: [*c]ImVec2, self: [*c]ImGuiViewport) void;
pub extern fn ImGuiViewport_GetWorkCenter(pOut: [*c]ImVec2, self: [*c]ImGuiViewport) void;
pub extern fn igImHashData(data: ?*const anyopaque, data_size: usize, seed: ImU32) ImGuiID;
pub extern fn igImHashStr(data: [*c]const u8, data_size: usize, seed: ImU32) ImGuiID;
pub extern fn igImAlphaBlendColors(col_a: ImU32, col_b: ImU32) ImU32;
pub extern fn igImIsPowerOfTwo_Int(v: c_int) bool;
pub extern fn igImIsPowerOfTwo_U64(v: ImU64) bool;
pub extern fn igImUpperPowerOfTwo(v: c_int) c_int;
pub extern fn igImStricmp(str1: [*c]const u8, str2: [*c]const u8) c_int;
pub extern fn igImStrnicmp(str1: [*c]const u8, str2: [*c]const u8, count: usize) c_int;
pub extern fn igImStrncpy(dst: [*c]u8, src: [*c]const u8, count: usize) void;
pub extern fn igImStrdup(str: [*c]const u8) [*c]u8;
pub extern fn igImStrdupcpy(dst: [*c]u8, p_dst_size: [*c]usize, str: [*c]const u8) [*c]u8;
pub extern fn igImStrchrRange(str_begin: [*c]const u8, str_end: [*c]const u8, c: u8) [*c]const u8;
pub extern fn igImStrlenW(str: [*c]const ImWchar) c_int;
pub extern fn igImStreolRange(str: [*c]const u8, str_end: [*c]const u8) [*c]const u8;
pub extern fn igImStrbolW(buf_mid_line: [*c]const ImWchar, buf_begin: [*c]const ImWchar) [*c]const ImWchar;
pub extern fn igImStristr(haystack: [*c]const u8, haystack_end: [*c]const u8, needle: [*c]const u8, needle_end: [*c]const u8) [*c]const u8;
pub extern fn igImStrTrimBlanks(str: [*c]u8) void;
pub extern fn igImStrSkipBlank(str: [*c]const u8) [*c]const u8;
pub extern fn igImFormatString(buf: [*c]u8, buf_size: usize, fmt: [*c]const u8, ...) c_int;
pub extern fn igImParseFormatFindStart(format: [*c]const u8) [*c]const u8;
pub extern fn igImParseFormatFindEnd(format: [*c]const u8) [*c]const u8;
pub extern fn igImParseFormatTrimDecorations(format: [*c]const u8, buf: [*c]u8, buf_size: usize) [*c]const u8;
pub extern fn igImParseFormatPrecision(format: [*c]const u8, default_value: c_int) c_int;
pub extern fn igImCharIsBlankA(c: u8) bool;
pub extern fn igImCharIsBlankW(c: c_uint) bool;
pub extern fn igImTextCharToUtf8(out_buf: [*c]u8, c: c_uint) [*c]const u8;
pub extern fn igImTextStrToUtf8(out_buf: [*c]u8, out_buf_size: c_int, in_text: [*c]const ImWchar, in_text_end: [*c]const ImWchar) c_int;
pub extern fn igImTextCharFromUtf8(out_char: [*c]c_uint, in_text: [*c]const u8, in_text_end: [*c]const u8) c_int;
pub extern fn igImTextStrFromUtf8(out_buf: [*c]ImWchar, out_buf_size: c_int, in_text: [*c]const u8, in_text_end: [*c]const u8, in_remaining: [*c][*c]const u8) c_int;
pub extern fn igImTextCountCharsFromUtf8(in_text: [*c]const u8, in_text_end: [*c]const u8) c_int;
pub extern fn igImTextCountUtf8BytesFromChar(in_text: [*c]const u8, in_text_end: [*c]const u8) c_int;
pub extern fn igImTextCountUtf8BytesFromStr(in_text: [*c]const ImWchar, in_text_end: [*c]const ImWchar) c_int;
pub extern fn igImFileOpen(filename: [*c]const u8, mode: [*c]const u8) ImFileHandle;
pub extern fn igImFileClose(file: ImFileHandle) bool;
pub extern fn igImFileGetSize(file: ImFileHandle) ImU64;
pub extern fn igImFileRead(data: ?*anyopaque, size: ImU64, count: ImU64, file: ImFileHandle) ImU64;
pub extern fn igImFileWrite(data: ?*const anyopaque, size: ImU64, count: ImU64, file: ImFileHandle) ImU64;
pub extern fn igImFileLoadToMemory(filename: [*c]const u8, mode: [*c]const u8, out_file_size: [*c]usize, padding_bytes: c_int) ?*anyopaque;
pub extern fn igImPow_Float(x: f32, y: f32) f32;
pub extern fn igImPow_double(x: f64, y: f64) f64;
pub extern fn igImLog_Float(x: f32) f32;
pub extern fn igImLog_double(x: f64) f64;
pub extern fn igImAbs_Int(x: c_int) c_int;
pub extern fn igImAbs_Float(x: f32) f32;
pub extern fn igImAbs_double(x: f64) f64;
pub extern fn igImSign_Float(x: f32) f32;
pub extern fn igImSign_double(x: f64) f64;
pub extern fn igImRsqrt_Float(x: f32) f32;
pub extern fn igImRsqrt_double(x: f64) f64;
pub extern fn igImMin(pOut: [*c]ImVec2, lhs: ImVec2, rhs: ImVec2) void;
pub extern fn igImMax(pOut: [*c]ImVec2, lhs: ImVec2, rhs: ImVec2) void;
pub extern fn igImClamp(pOut: [*c]ImVec2, v: ImVec2, mn: ImVec2, mx: ImVec2) void;
pub extern fn igImLerp_Vec2Float(pOut: [*c]ImVec2, a: ImVec2, b: ImVec2, t: f32) void;
pub extern fn igImLerp_Vec2Vec2(pOut: [*c]ImVec2, a: ImVec2, b: ImVec2, t: ImVec2) void;
pub extern fn igImLerp_Vec4(pOut: [*c]ImVec4, a: ImVec4, b: ImVec4, t: f32) void;
pub extern fn igImSaturate(f: f32) f32;
pub extern fn igImLengthSqr_Vec2(lhs: ImVec2) f32;
pub extern fn igImLengthSqr_Vec4(lhs: ImVec4) f32;
pub extern fn igImInvLength(lhs: ImVec2, fail_value: f32) f32;
pub extern fn igImFloor_Float(f: f32) f32;
pub extern fn igImFloorSigned(f: f32) f32;
pub extern fn igImFloor_Vec2(pOut: [*c]ImVec2, v: ImVec2) void;
pub extern fn igImModPositive(a: c_int, b: c_int) c_int;
pub extern fn igImDot(a: ImVec2, b: ImVec2) f32;
pub extern fn igImRotate(pOut: [*c]ImVec2, v: ImVec2, cos_a: f32, sin_a: f32) void;
pub extern fn igImLinearSweep(current: f32, target: f32, speed: f32) f32;
pub extern fn igImMul(pOut: [*c]ImVec2, lhs: ImVec2, rhs: ImVec2) void;
pub extern fn igImBezierCubicCalc(pOut: [*c]ImVec2, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, t: f32) void;
pub extern fn igImBezierCubicClosestPoint(pOut: [*c]ImVec2, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, p: ImVec2, num_segments: c_int) void;
pub extern fn igImBezierCubicClosestPointCasteljau(pOut: [*c]ImVec2, p1: ImVec2, p2: ImVec2, p3: ImVec2, p4: ImVec2, p: ImVec2, tess_tol: f32) void;
pub extern fn igImBezierQuadraticCalc(pOut: [*c]ImVec2, p1: ImVec2, p2: ImVec2, p3: ImVec2, t: f32) void;
pub extern fn igImLineClosestPoint(pOut: [*c]ImVec2, a: ImVec2, b: ImVec2, p: ImVec2) void;
pub extern fn igImTriangleContainsPoint(a: ImVec2, b: ImVec2, c: ImVec2, p: ImVec2) bool;
pub extern fn igImTriangleClosestPoint(pOut: [*c]ImVec2, a: ImVec2, b: ImVec2, c: ImVec2, p: ImVec2) void;
pub extern fn igImTriangleBarycentricCoords(a: ImVec2, b: ImVec2, c: ImVec2, p: ImVec2, out_u: [*c]f32, out_v: [*c]f32, out_w: [*c]f32) void;
pub extern fn igImTriangleArea(a: ImVec2, b: ImVec2, c: ImVec2) f32;
pub extern fn igImGetDirQuadrantFromDelta(dx: f32, dy: f32) ImGuiDir;
pub extern fn ImVec1_ImVec1_Nil() [*c]ImVec1;
pub extern fn ImVec1_destroy(self: [*c]ImVec1) void;
pub extern fn ImVec1_ImVec1_Float(_x: f32) [*c]ImVec1;
pub extern fn ImVec2ih_ImVec2ih_Nil() [*c]ImVec2ih;
pub extern fn ImVec2ih_destroy(self: [*c]ImVec2ih) void;
pub extern fn ImVec2ih_ImVec2ih_short(_x: c_short, _y: c_short) [*c]ImVec2ih;
pub extern fn ImVec2ih_ImVec2ih_Vec2(rhs: ImVec2) [*c]ImVec2ih;
pub extern fn ImRect_ImRect_Nil() [*c]ImRect;
pub extern fn ImRect_destroy(self: [*c]ImRect) void;
pub extern fn ImRect_ImRect_Vec2(min: ImVec2, max: ImVec2) [*c]ImRect;
pub extern fn ImRect_ImRect_Vec4(v: ImVec4) [*c]ImRect;
pub extern fn ImRect_ImRect_Float(x1: f32, y1: f32, x2: f32, y2: f32) [*c]ImRect;
pub extern fn ImRect_GetCenter(pOut: [*c]ImVec2, self: [*c]ImRect) void;
pub extern fn ImRect_GetSize(pOut: [*c]ImVec2, self: [*c]ImRect) void;
pub extern fn ImRect_GetWidth(self: [*c]ImRect) f32;
pub extern fn ImRect_GetHeight(self: [*c]ImRect) f32;
pub extern fn ImRect_GetArea(self: [*c]ImRect) f32;
pub extern fn ImRect_GetTL(pOut: [*c]ImVec2, self: [*c]ImRect) void;
pub extern fn ImRect_GetTR(pOut: [*c]ImVec2, self: [*c]ImRect) void;
pub extern fn ImRect_GetBL(pOut: [*c]ImVec2, self: [*c]ImRect) void;
pub extern fn ImRect_GetBR(pOut: [*c]ImVec2, self: [*c]ImRect) void;
pub extern fn ImRect_Contains_Vec2(self: [*c]ImRect, p: ImVec2) bool;
pub extern fn ImRect_Contains_Rect(self: [*c]ImRect, r: ImRect) bool;
pub extern fn ImRect_Overlaps(self: [*c]ImRect, r: ImRect) bool;
pub extern fn ImRect_Add_Vec2(self: [*c]ImRect, p: ImVec2) void;
pub extern fn ImRect_Add_Rect(self: [*c]ImRect, r: ImRect) void;
pub extern fn ImRect_Expand_Float(self: [*c]ImRect, amount: f32) void;
pub extern fn ImRect_Expand_Vec2(self: [*c]ImRect, amount: ImVec2) void;
pub extern fn ImRect_Translate(self: [*c]ImRect, d: ImVec2) void;
pub extern fn ImRect_TranslateX(self: [*c]ImRect, dx: f32) void;
pub extern fn ImRect_TranslateY(self: [*c]ImRect, dy: f32) void;
pub extern fn ImRect_ClipWith(self: [*c]ImRect, r: ImRect) void;
pub extern fn ImRect_ClipWithFull(self: [*c]ImRect, r: ImRect) void;
pub extern fn ImRect_Floor(self: [*c]ImRect) void;
pub extern fn ImRect_IsInverted(self: [*c]ImRect) bool;
pub extern fn ImRect_ToVec4(pOut: [*c]ImVec4, self: [*c]ImRect) void;
pub extern fn igImBitArrayTestBit(arr: [*c]const ImU32, n: c_int) bool;
pub extern fn igImBitArrayClearBit(arr: [*c]ImU32, n: c_int) void;
pub extern fn igImBitArraySetBit(arr: [*c]ImU32, n: c_int) void;
pub extern fn igImBitArraySetBitRange(arr: [*c]ImU32, n: c_int, n2: c_int) void;
pub extern fn ImBitVector_Create(self: [*c]ImBitVector, sz: c_int) void;
pub extern fn ImBitVector_Clear(self: [*c]ImBitVector) void;
pub extern fn ImBitVector_TestBit(self: [*c]ImBitVector, n: c_int) bool;
pub extern fn ImBitVector_SetBit(self: [*c]ImBitVector, n: c_int) void;
pub extern fn ImBitVector_ClearBit(self: [*c]ImBitVector, n: c_int) void;
pub extern fn ImDrawListSharedData_ImDrawListSharedData() [*c]ImDrawListSharedData;
pub extern fn ImDrawListSharedData_destroy(self: [*c]ImDrawListSharedData) void;
pub extern fn ImDrawListSharedData_SetCircleTessellationMaxError(self: [*c]ImDrawListSharedData, max_error: f32) void;
pub extern fn ImDrawDataBuilder_Clear(self: [*c]ImDrawDataBuilder) void;
pub extern fn ImDrawDataBuilder_ClearFreeMemory(self: [*c]ImDrawDataBuilder) void;
pub extern fn ImDrawDataBuilder_GetDrawListCount(self: [*c]ImDrawDataBuilder) c_int;
pub extern fn ImDrawDataBuilder_FlattenIntoSingleLayer(self: [*c]ImDrawDataBuilder) void;
pub extern fn ImGuiStyleMod_ImGuiStyleMod_Int(idx: ImGuiStyleVar, v: c_int) [*c]ImGuiStyleMod;
pub extern fn ImGuiStyleMod_destroy(self: [*c]ImGuiStyleMod) void;
pub extern fn ImGuiStyleMod_ImGuiStyleMod_Float(idx: ImGuiStyleVar, v: f32) [*c]ImGuiStyleMod;
pub extern fn ImGuiStyleMod_ImGuiStyleMod_Vec2(idx: ImGuiStyleVar, v: ImVec2) [*c]ImGuiStyleMod;
pub extern fn ImGuiComboPreviewData_ImGuiComboPreviewData() [*c]ImGuiComboPreviewData;
pub extern fn ImGuiComboPreviewData_destroy(self: [*c]ImGuiComboPreviewData) void;
pub extern fn ImGuiMenuColumns_ImGuiMenuColumns() [*c]ImGuiMenuColumns;
pub extern fn ImGuiMenuColumns_destroy(self: [*c]ImGuiMenuColumns) void;
pub extern fn ImGuiMenuColumns_Update(self: [*c]ImGuiMenuColumns, spacing: f32, window_reappearing: bool) void;
pub extern fn ImGuiMenuColumns_DeclColumns(self: [*c]ImGuiMenuColumns, w_icon: f32, w_label: f32, w_shortcut: f32, w_mark: f32) f32;
pub extern fn ImGuiMenuColumns_CalcNextTotalWidth(self: [*c]ImGuiMenuColumns, update_offsets: bool) void;
pub extern fn ImGuiInputTextState_ImGuiInputTextState() [*c]ImGuiInputTextState;
pub extern fn ImGuiInputTextState_destroy(self: [*c]ImGuiInputTextState) void;
pub extern fn ImGuiInputTextState_ClearText(self: [*c]ImGuiInputTextState) void;
pub extern fn ImGuiInputTextState_ClearFreeMemory(self: [*c]ImGuiInputTextState) void;
pub extern fn ImGuiInputTextState_GetUndoAvailCount(self: [*c]ImGuiInputTextState) c_int;
pub extern fn ImGuiInputTextState_GetRedoAvailCount(self: [*c]ImGuiInputTextState) c_int;
pub extern fn ImGuiInputTextState_OnKeyPressed(self: [*c]ImGuiInputTextState, key: c_int) void;
pub extern fn ImGuiInputTextState_CursorAnimReset(self: [*c]ImGuiInputTextState) void;
pub extern fn ImGuiInputTextState_CursorClamp(self: [*c]ImGuiInputTextState) void;
pub extern fn ImGuiInputTextState_HasSelection(self: [*c]ImGuiInputTextState) bool;
pub extern fn ImGuiInputTextState_ClearSelection(self: [*c]ImGuiInputTextState) void;
pub extern fn ImGuiInputTextState_GetCursorPos(self: [*c]ImGuiInputTextState) c_int;
pub extern fn ImGuiInputTextState_GetSelectionStart(self: [*c]ImGuiInputTextState) c_int;
pub extern fn ImGuiInputTextState_GetSelectionEnd(self: [*c]ImGuiInputTextState) c_int;
pub extern fn ImGuiInputTextState_SelectAll(self: [*c]ImGuiInputTextState) void;
pub extern fn ImGuiPopupData_ImGuiPopupData() [*c]ImGuiPopupData;
pub extern fn ImGuiPopupData_destroy(self: [*c]ImGuiPopupData) void;
pub extern fn ImGuiNextWindowData_ImGuiNextWindowData() [*c]ImGuiNextWindowData;
pub extern fn ImGuiNextWindowData_destroy(self: [*c]ImGuiNextWindowData) void;
pub extern fn ImGuiNextWindowData_ClearFlags(self: [*c]ImGuiNextWindowData) void;
pub extern fn ImGuiNextItemData_ImGuiNextItemData() [*c]ImGuiNextItemData;
pub extern fn ImGuiNextItemData_destroy(self: [*c]ImGuiNextItemData) void;
pub extern fn ImGuiNextItemData_ClearFlags(self: [*c]ImGuiNextItemData) void;
pub extern fn ImGuiLastItemData_ImGuiLastItemData() [*c]ImGuiLastItemData;
pub extern fn ImGuiLastItemData_destroy(self: [*c]ImGuiLastItemData) void;
pub extern fn ImGuiStackSizes_ImGuiStackSizes() [*c]ImGuiStackSizes;
pub extern fn ImGuiStackSizes_destroy(self: [*c]ImGuiStackSizes) void;
pub extern fn ImGuiStackSizes_SetToCurrentState(self: [*c]ImGuiStackSizes) void;
pub extern fn ImGuiStackSizes_CompareWithCurrentState(self: [*c]ImGuiStackSizes) void;
pub extern fn ImGuiPtrOrIndex_ImGuiPtrOrIndex_Ptr(ptr: ?*anyopaque) [*c]ImGuiPtrOrIndex;
pub extern fn ImGuiPtrOrIndex_destroy(self: [*c]ImGuiPtrOrIndex) void;
pub extern fn ImGuiPtrOrIndex_ImGuiPtrOrIndex_Int(index: c_int) [*c]ImGuiPtrOrIndex;
pub extern fn ImGuiNavItemData_ImGuiNavItemData() [*c]ImGuiNavItemData;
pub extern fn ImGuiNavItemData_destroy(self: [*c]ImGuiNavItemData) void;
pub extern fn ImGuiNavItemData_Clear(self: [*c]ImGuiNavItemData) void;
pub extern fn ImGuiOldColumnData_ImGuiOldColumnData() [*c]ImGuiOldColumnData;
pub extern fn ImGuiOldColumnData_destroy(self: [*c]ImGuiOldColumnData) void;
pub extern fn ImGuiOldColumns_ImGuiOldColumns() [*c]ImGuiOldColumns;
pub extern fn ImGuiOldColumns_destroy(self: [*c]ImGuiOldColumns) void;
pub extern fn ImGuiViewportP_ImGuiViewportP() [*c]ImGuiViewportP;
pub extern fn ImGuiViewportP_destroy(self: [*c]ImGuiViewportP) void;
pub extern fn ImGuiViewportP_CalcWorkRectPos(pOut: [*c]ImVec2, self: [*c]ImGuiViewportP, off_min: ImVec2) void;
pub extern fn ImGuiViewportP_CalcWorkRectSize(pOut: [*c]ImVec2, self: [*c]ImGuiViewportP, off_min: ImVec2, off_max: ImVec2) void;
pub extern fn ImGuiViewportP_UpdateWorkRect(self: [*c]ImGuiViewportP) void;
pub extern fn ImGuiViewportP_GetMainRect(pOut: [*c]ImRect, self: [*c]ImGuiViewportP) void;
pub extern fn ImGuiViewportP_GetWorkRect(pOut: [*c]ImRect, self: [*c]ImGuiViewportP) void;
pub extern fn ImGuiViewportP_GetBuildWorkRect(pOut: [*c]ImRect, self: [*c]ImGuiViewportP) void;
pub extern fn ImGuiWindowSettings_ImGuiWindowSettings() [*c]ImGuiWindowSettings;
pub extern fn ImGuiWindowSettings_destroy(self: [*c]ImGuiWindowSettings) void;
pub extern fn ImGuiWindowSettings_GetName(self: [*c]ImGuiWindowSettings) [*c]u8;
pub extern fn ImGuiSettingsHandler_ImGuiSettingsHandler() [*c]ImGuiSettingsHandler;
pub extern fn ImGuiSettingsHandler_destroy(self: [*c]ImGuiSettingsHandler) void;
pub extern fn ImGuiMetricsConfig_ImGuiMetricsConfig() [*c]ImGuiMetricsConfig;
pub extern fn ImGuiMetricsConfig_destroy(self: [*c]ImGuiMetricsConfig) void;
pub extern fn ImGuiStackLevelInfo_ImGuiStackLevelInfo() [*c]ImGuiStackLevelInfo;
pub extern fn ImGuiStackLevelInfo_destroy(self: [*c]ImGuiStackLevelInfo) void;
pub extern fn ImGuiStackTool_ImGuiStackTool() [*c]ImGuiStackTool;
pub extern fn ImGuiStackTool_destroy(self: [*c]ImGuiStackTool) void;
pub extern fn ImGuiContextHook_ImGuiContextHook() [*c]ImGuiContextHook;
pub extern fn ImGuiContextHook_destroy(self: [*c]ImGuiContextHook) void;
pub extern fn ImGuiContext_ImGuiContext(shared_font_atlas: [*c]ImFontAtlas) [*c]ImGuiContext;
pub extern fn ImGuiContext_destroy(self: [*c]ImGuiContext) void;
pub extern fn ImGuiWindow_ImGuiWindow(context: [*c]ImGuiContext, name: [*c]const u8) ?*ImGuiWindow;
pub extern fn ImGuiWindow_destroy(self: ?*ImGuiWindow) void;
pub extern fn ImGuiWindow_GetID_Str(self: ?*ImGuiWindow, str: [*c]const u8, str_end: [*c]const u8) ImGuiID;
pub extern fn ImGuiWindow_GetID_Ptr(self: ?*ImGuiWindow, ptr: ?*const anyopaque) ImGuiID;
pub extern fn ImGuiWindow_GetID_Int(self: ?*ImGuiWindow, n: c_int) ImGuiID;
pub extern fn ImGuiWindow_GetIDNoKeepAlive_Str(self: ?*ImGuiWindow, str: [*c]const u8, str_end: [*c]const u8) ImGuiID;
pub extern fn ImGuiWindow_GetIDNoKeepAlive_Ptr(self: ?*ImGuiWindow, ptr: ?*const anyopaque) ImGuiID;
pub extern fn ImGuiWindow_GetIDNoKeepAlive_Int(self: ?*ImGuiWindow, n: c_int) ImGuiID;
pub extern fn ImGuiWindow_GetIDFromRectangle(self: ?*ImGuiWindow, r_abs: ImRect) ImGuiID;
pub extern fn ImGuiWindow_Rect(pOut: [*c]ImRect, self: ?*ImGuiWindow) void;
pub extern fn ImGuiWindow_CalcFontSize(self: ?*ImGuiWindow) f32;
pub extern fn ImGuiWindow_TitleBarHeight(self: ?*ImGuiWindow) f32;
pub extern fn ImGuiWindow_TitleBarRect(pOut: [*c]ImRect, self: ?*ImGuiWindow) void;
pub extern fn ImGuiWindow_MenuBarHeight(self: ?*ImGuiWindow) f32;
pub extern fn ImGuiWindow_MenuBarRect(pOut: [*c]ImRect, self: ?*ImGuiWindow) void;
pub extern fn ImGuiTabItem_ImGuiTabItem() [*c]ImGuiTabItem;
pub extern fn ImGuiTabItem_destroy(self: [*c]ImGuiTabItem) void;
pub extern fn ImGuiTabBar_ImGuiTabBar() [*c]ImGuiTabBar;
pub extern fn ImGuiTabBar_destroy(self: [*c]ImGuiTabBar) void;
pub extern fn ImGuiTabBar_GetTabOrder(self: [*c]ImGuiTabBar, tab: [*c]const ImGuiTabItem) c_int;
pub extern fn ImGuiTabBar_GetTabName(self: [*c]ImGuiTabBar, tab: [*c]const ImGuiTabItem) [*c]const u8;
pub extern fn ImGuiTableColumn_ImGuiTableColumn() ?*ImGuiTableColumn;
pub extern fn ImGuiTableColumn_destroy(self: ?*ImGuiTableColumn) void;
pub extern fn ImGuiTable_ImGuiTable() ?*ImGuiTable;
pub extern fn ImGuiTable_destroy(self: ?*ImGuiTable) void;
pub extern fn ImGuiTableTempData_ImGuiTableTempData() [*c]ImGuiTableTempData;
pub extern fn ImGuiTableTempData_destroy(self: [*c]ImGuiTableTempData) void;
pub extern fn ImGuiTableColumnSettings_ImGuiTableColumnSettings() ?*ImGuiTableColumnSettings;
pub extern fn ImGuiTableColumnSettings_destroy(self: ?*ImGuiTableColumnSettings) void;
pub extern fn ImGuiTableSettings_ImGuiTableSettings() [*c]ImGuiTableSettings;
pub extern fn ImGuiTableSettings_destroy(self: [*c]ImGuiTableSettings) void;
pub extern fn ImGuiTableSettings_GetColumnSettings(self: [*c]ImGuiTableSettings) ?*ImGuiTableColumnSettings;
pub extern fn igGetCurrentWindowRead() ?*ImGuiWindow;
pub extern fn igGetCurrentWindow() ?*ImGuiWindow;
pub extern fn igFindWindowByID(id: ImGuiID) ?*ImGuiWindow;
pub extern fn igFindWindowByName(name: [*c]const u8) ?*ImGuiWindow;
pub extern fn igUpdateWindowParentAndRootLinks(window: ?*ImGuiWindow, flags: ImGuiWindowFlags, parent_window: ?*ImGuiWindow) void;
pub extern fn igCalcWindowNextAutoFitSize(pOut: [*c]ImVec2, window: ?*ImGuiWindow) void;
pub extern fn igIsWindowChildOf(window: ?*ImGuiWindow, potential_parent: ?*ImGuiWindow, popup_hierarchy: bool) bool;
pub extern fn igIsWindowAbove(potential_above: ?*ImGuiWindow, potential_below: ?*ImGuiWindow) bool;
pub extern fn igIsWindowNavFocusable(window: ?*ImGuiWindow) bool;
pub extern fn igSetWindowPos_WindowPtr(window: ?*ImGuiWindow, pos: ImVec2, cond: ImGuiCond) void;
pub extern fn igSetWindowSize_WindowPtr(window: ?*ImGuiWindow, size: ImVec2, cond: ImGuiCond) void;
pub extern fn igSetWindowCollapsed_WindowPtr(window: ?*ImGuiWindow, collapsed: bool, cond: ImGuiCond) void;
pub extern fn igSetWindowHitTestHole(window: ?*ImGuiWindow, pos: ImVec2, size: ImVec2) void;
pub extern fn igFocusWindow(window: ?*ImGuiWindow) void;
pub extern fn igFocusTopMostWindowUnderOne(under_this_window: ?*ImGuiWindow, ignore_window: ?*ImGuiWindow) void;
pub extern fn igBringWindowToFocusFront(window: ?*ImGuiWindow) void;
pub extern fn igBringWindowToDisplayFront(window: ?*ImGuiWindow) void;
pub extern fn igBringWindowToDisplayBack(window: ?*ImGuiWindow) void;
pub extern fn igSetCurrentFont(font: [*c]ImFont) void;
pub extern fn igGetDefaultFont() [*c]ImFont;
pub extern fn igGetForegroundDrawList_WindowPtr(window: ?*ImGuiWindow) [*c]ImDrawList;
pub extern fn igGetBackgroundDrawList_ViewportPtr(viewport: [*c]ImGuiViewport) [*c]ImDrawList;
pub extern fn igGetForegroundDrawList_ViewportPtr(viewport: [*c]ImGuiViewport) [*c]ImDrawList;
pub extern fn igInitialize(context: [*c]ImGuiContext) void;
pub extern fn igShutdown(context: [*c]ImGuiContext) void;
pub extern fn igUpdateHoveredWindowAndCaptureFlags() void;
pub extern fn igStartMouseMovingWindow(window: ?*ImGuiWindow) void;
pub extern fn igUpdateMouseMovingWindowNewFrame() void;
pub extern fn igUpdateMouseMovingWindowEndFrame() void;
pub extern fn igAddContextHook(context: [*c]ImGuiContext, hook: [*c]const ImGuiContextHook) ImGuiID;
pub extern fn igRemoveContextHook(context: [*c]ImGuiContext, hook_to_remove: ImGuiID) void;
pub extern fn igCallContextHooks(context: [*c]ImGuiContext, @"type": ImGuiContextHookType) void;
pub extern fn igMarkIniSettingsDirty_Nil() void;
pub extern fn igMarkIniSettingsDirty_WindowPtr(window: ?*ImGuiWindow) void;
pub extern fn igClearIniSettings() void;
pub extern fn igCreateNewWindowSettings(name: [*c]const u8) [*c]ImGuiWindowSettings;
pub extern fn igFindWindowSettings(id: ImGuiID) [*c]ImGuiWindowSettings;
pub extern fn igFindOrCreateWindowSettings(name: [*c]const u8) [*c]ImGuiWindowSettings;
pub extern fn igFindSettingsHandler(type_name: [*c]const u8) [*c]ImGuiSettingsHandler;
pub extern fn igSetNextWindowScroll(scroll: ImVec2) void;
pub extern fn igSetScrollX_WindowPtr(window: ?*ImGuiWindow, scroll_x: f32) void;
pub extern fn igSetScrollY_WindowPtr(window: ?*ImGuiWindow, scroll_y: f32) void;
pub extern fn igSetScrollFromPosX_WindowPtr(window: ?*ImGuiWindow, local_x: f32, center_x_ratio: f32) void;
pub extern fn igSetScrollFromPosY_WindowPtr(window: ?*ImGuiWindow, local_y: f32, center_y_ratio: f32) void;
pub extern fn igScrollToItem(flags: ImGuiScrollFlags) void;
pub extern fn igScrollToRect(window: ?*ImGuiWindow, rect: ImRect, flags: ImGuiScrollFlags) void;
pub extern fn igScrollToRectEx(pOut: [*c]ImVec2, window: ?*ImGuiWindow, rect: ImRect, flags: ImGuiScrollFlags) void;
pub extern fn igScrollToBringRectIntoView(window: ?*ImGuiWindow, rect: ImRect) void;
pub extern fn igGetItemID() ImGuiID;
pub extern fn igGetItemStatusFlags() ImGuiItemStatusFlags;
pub extern fn igGetItemFlags() ImGuiItemFlags;
pub extern fn igGetActiveID() ImGuiID;
pub extern fn igGetFocusID() ImGuiID;
pub extern fn igSetActiveID(id: ImGuiID, window: ?*ImGuiWindow) void;
pub extern fn igSetFocusID(id: ImGuiID, window: ?*ImGuiWindow) void;
pub extern fn igClearActiveID() void;
pub extern fn igGetHoveredID() ImGuiID;
pub extern fn igSetHoveredID(id: ImGuiID) void;
pub extern fn igKeepAliveID(id: ImGuiID) void;
pub extern fn igMarkItemEdited(id: ImGuiID) void;
pub extern fn igPushOverrideID(id: ImGuiID) void;
pub extern fn igGetIDWithSeed(str_id_begin: [*c]const u8, str_id_end: [*c]const u8, seed: ImGuiID) ImGuiID;
pub extern fn igItemSize_Vec2(size: ImVec2, text_baseline_y: f32) void;
pub extern fn igItemSize_Rect(bb: ImRect, text_baseline_y: f32) void;
pub extern fn igItemAdd(bb: ImRect, id: ImGuiID, nav_bb: [*c]const ImRect, extra_flags: ImGuiItemFlags) bool;
pub extern fn igItemHoverable(bb: ImRect, id: ImGuiID) bool;
pub extern fn igIsClippedEx(bb: ImRect, id: ImGuiID) bool;
pub extern fn igCalcItemSize(pOut: [*c]ImVec2, size: ImVec2, default_w: f32, default_h: f32) void;
pub extern fn igCalcWrapWidthForPos(pos: ImVec2, wrap_pos_x: f32) f32;
pub extern fn igPushMultiItemsWidths(components: c_int, width_full: f32) void;
pub extern fn igIsItemToggledSelection() bool;
pub extern fn igGetContentRegionMaxAbs(pOut: [*c]ImVec2) void;
pub extern fn igShrinkWidths(items: [*c]ImGuiShrinkWidthItem, count: c_int, width_excess: f32) void;
pub extern fn igPushItemFlag(option: ImGuiItemFlags, enabled: bool) void;
pub extern fn igPopItemFlag() void;
pub extern fn igLogBegin(@"type": ImGuiLogType, auto_open_depth: c_int) void;
pub extern fn igLogToBuffer(auto_open_depth: c_int) void;
pub extern fn igLogRenderedText(ref_pos: [*c]const ImVec2, text: [*c]const u8, text_end: [*c]const u8) void;
pub extern fn igLogSetNextTextDecoration(prefix: [*c]const u8, suffix: [*c]const u8) void;
pub extern fn igBeginChildEx(name: [*c]const u8, id: ImGuiID, size_arg: ImVec2, border: bool, flags: ImGuiWindowFlags) bool;
pub extern fn igOpenPopupEx(id: ImGuiID, popup_flags: ImGuiPopupFlags) void;
pub extern fn igClosePopupToLevel(remaining: c_int, restore_focus_to_window_under_popup: bool) void;
pub extern fn igClosePopupsOverWindow(ref_window: ?*ImGuiWindow, restore_focus_to_window_under_popup: bool) void;
pub extern fn igClosePopupsExceptModals() void;
pub extern fn igIsPopupOpen_ID(id: ImGuiID, popup_flags: ImGuiPopupFlags) bool;
pub extern fn igBeginPopupEx(id: ImGuiID, extra_flags: ImGuiWindowFlags) bool;
pub extern fn igBeginTooltipEx(extra_flags: ImGuiWindowFlags, tooltip_flags: ImGuiTooltipFlags) void;
pub extern fn igGetPopupAllowedExtentRect(pOut: [*c]ImRect, window: ?*ImGuiWindow) void;
pub extern fn igGetTopMostPopupModal() ?*ImGuiWindow;
pub extern fn igFindBestWindowPosForPopup(pOut: [*c]ImVec2, window: ?*ImGuiWindow) void;
pub extern fn igFindBestWindowPosForPopupEx(pOut: [*c]ImVec2, ref_pos: ImVec2, size: ImVec2, last_dir: [*c]ImGuiDir, r_outer: ImRect, r_avoid: ImRect, policy: ImGuiPopupPositionPolicy) void;
pub extern fn igBeginViewportSideBar(name: [*c]const u8, viewport: [*c]ImGuiViewport, dir: ImGuiDir, size: f32, window_flags: ImGuiWindowFlags) bool;
pub extern fn igBeginMenuEx(label: [*c]const u8, icon: [*c]const u8, enabled: bool) bool;
pub extern fn igMenuItemEx(label: [*c]const u8, icon: [*c]const u8, shortcut: [*c]const u8, selected: bool, enabled: bool) bool;
pub extern fn igBeginComboPopup(popup_id: ImGuiID, bb: ImRect, flags: ImGuiComboFlags) bool;
pub extern fn igBeginComboPreview() bool;
pub extern fn igEndComboPreview() void;
pub extern fn igNavInitWindow(window: ?*ImGuiWindow, force_reinit: bool) void;
pub extern fn igNavInitRequestApplyResult() void;
pub extern fn igNavMoveRequestButNoResultYet() bool;
pub extern fn igNavMoveRequestSubmit(move_dir: ImGuiDir, clip_dir: ImGuiDir, move_flags: ImGuiNavMoveFlags, scroll_flags: ImGuiScrollFlags) void;
pub extern fn igNavMoveRequestForward(move_dir: ImGuiDir, clip_dir: ImGuiDir, move_flags: ImGuiNavMoveFlags, scroll_flags: ImGuiScrollFlags) void;
pub extern fn igNavMoveRequestResolveWithLastItem() void;
pub extern fn igNavMoveRequestCancel() void;
pub extern fn igNavMoveRequestApplyResult() void;
pub extern fn igNavMoveRequestTryWrapping(window: ?*ImGuiWindow, move_flags: ImGuiNavMoveFlags) void;
pub extern fn igGetNavInputAmount(n: ImGuiNavInput, mode: ImGuiInputReadMode) f32;
pub extern fn igGetNavInputAmount2d(pOut: [*c]ImVec2, dir_sources: ImGuiNavDirSourceFlags, mode: ImGuiInputReadMode, slow_factor: f32, fast_factor: f32) void;
pub extern fn igCalcTypematicRepeatAmount(t0: f32, t1: f32, repeat_delay: f32, repeat_rate: f32) c_int;
pub extern fn igActivateItem(id: ImGuiID) void;
pub extern fn igSetNavID(id: ImGuiID, nav_layer: ImGuiNavLayer, focus_scope_id: ImGuiID, rect_rel: ImRect) void;
pub extern fn igPushFocusScope(id: ImGuiID) void;
pub extern fn igPopFocusScope() void;
pub extern fn igGetFocusedFocusScope() ImGuiID;
pub extern fn igGetFocusScope() ImGuiID;
pub extern fn igSetItemUsingMouseWheel() void;
pub extern fn igSetActiveIdUsingNavAndKeys() void;
pub extern fn igIsActiveIdUsingNavDir(dir: ImGuiDir) bool;
pub extern fn igIsActiveIdUsingNavInput(input: ImGuiNavInput) bool;
pub extern fn igIsActiveIdUsingKey(key: ImGuiKey) bool;
pub extern fn igIsMouseDragPastThreshold(button: ImGuiMouseButton, lock_threshold: f32) bool;
pub extern fn igIsKeyPressedMap(key: ImGuiKey, repeat: bool) bool;
pub extern fn igIsNavInputDown(n: ImGuiNavInput) bool;
pub extern fn igIsNavInputTest(n: ImGuiNavInput, rm: ImGuiInputReadMode) bool;
pub extern fn igGetMergedKeyModFlags() ImGuiKeyModFlags;
pub extern fn igBeginDragDropTargetCustom(bb: ImRect, id: ImGuiID) bool;
pub extern fn igClearDragDrop() void;
pub extern fn igIsDragDropPayloadBeingAccepted() bool;
pub extern fn igSetWindowClipRectBeforeSetChannel(window: ?*ImGuiWindow, clip_rect: ImRect) void;
pub extern fn igBeginColumns(str_id: [*c]const u8, count: c_int, flags: ImGuiOldColumnFlags) void;
pub extern fn igEndColumns() void;
pub extern fn igPushColumnClipRect(column_index: c_int) void;
pub extern fn igPushColumnsBackground() void;
pub extern fn igPopColumnsBackground() void;
pub extern fn igGetColumnsID(str_id: [*c]const u8, count: c_int) ImGuiID;
pub extern fn igFindOrCreateColumns(window: ?*ImGuiWindow, id: ImGuiID) [*c]ImGuiOldColumns;
pub extern fn igGetColumnOffsetFromNorm(columns: [*c]const ImGuiOldColumns, offset_norm: f32) f32;
pub extern fn igGetColumnNormFromOffset(columns: [*c]const ImGuiOldColumns, offset: f32) f32;
pub extern fn igTableOpenContextMenu(column_n: c_int) void;
pub extern fn igTableSetColumnWidth(column_n: c_int, width: f32) void;
pub extern fn igTableSetColumnSortDirection(column_n: c_int, sort_direction: ImGuiSortDirection, append_to_sort_specs: bool) void;
pub extern fn igTableGetHoveredColumn() c_int;
pub extern fn igTableGetHeaderRowHeight() f32;
pub extern fn igTablePushBackgroundChannel() void;
pub extern fn igTablePopBackgroundChannel() void;
pub extern fn igGetCurrentTable() ?*ImGuiTable;
pub extern fn igTableFindByID(id: ImGuiID) ?*ImGuiTable;
pub extern fn igBeginTableEx(name: [*c]const u8, id: ImGuiID, columns_count: c_int, flags: ImGuiTableFlags, outer_size: ImVec2, inner_width: f32) bool;
pub extern fn igTableBeginInitMemory(table: ?*ImGuiTable, columns_count: c_int) void;
pub extern fn igTableBeginApplyRequests(table: ?*ImGuiTable) void;
pub extern fn igTableSetupDrawChannels(table: ?*ImGuiTable) void;
pub extern fn igTableUpdateLayout(table: ?*ImGuiTable) void;
pub extern fn igTableUpdateBorders(table: ?*ImGuiTable) void;
pub extern fn igTableUpdateColumnsWeightFromWidth(table: ?*ImGuiTable) void;
pub extern fn igTableDrawBorders(table: ?*ImGuiTable) void;
pub extern fn igTableDrawContextMenu(table: ?*ImGuiTable) void;
pub extern fn igTableMergeDrawChannels(table: ?*ImGuiTable) void;
pub extern fn igTableSortSpecsSanitize(table: ?*ImGuiTable) void;
pub extern fn igTableSortSpecsBuild(table: ?*ImGuiTable) void;
pub extern fn igTableGetColumnNextSortDirection(column: ?*ImGuiTableColumn) ImGuiSortDirection;
pub extern fn igTableFixColumnSortDirection(table: ?*ImGuiTable, column: ?*ImGuiTableColumn) void;
pub extern fn igTableGetColumnWidthAuto(table: ?*ImGuiTable, column: ?*ImGuiTableColumn) f32;
pub extern fn igTableBeginRow(table: ?*ImGuiTable) void;
pub extern fn igTableEndRow(table: ?*ImGuiTable) void;
pub extern fn igTableBeginCell(table: ?*ImGuiTable, column_n: c_int) void;
pub extern fn igTableEndCell(table: ?*ImGuiTable) void;
pub extern fn igTableGetCellBgRect(pOut: [*c]ImRect, table: ?*const ImGuiTable, column_n: c_int) void;
pub extern fn igTableGetColumnName_TablePtr(table: ?*const ImGuiTable, column_n: c_int) [*c]const u8;
pub extern fn igTableGetColumnResizeID(table: ?*const ImGuiTable, column_n: c_int, instance_no: c_int) ImGuiID;
pub extern fn igTableGetMaxColumnWidth(table: ?*const ImGuiTable, column_n: c_int) f32;
pub extern fn igTableSetColumnWidthAutoSingle(table: ?*ImGuiTable, column_n: c_int) void;
pub extern fn igTableSetColumnWidthAutoAll(table: ?*ImGuiTable) void;
pub extern fn igTableRemove(table: ?*ImGuiTable) void;
pub extern fn igTableGcCompactTransientBuffers_TablePtr(table: ?*ImGuiTable) void;
pub extern fn igTableGcCompactTransientBuffers_TableTempDataPtr(table: [*c]ImGuiTableTempData) void;
pub extern fn igTableGcCompactSettings() void;
pub extern fn igTableLoadSettings(table: ?*ImGuiTable) void;
pub extern fn igTableSaveSettings(table: ?*ImGuiTable) void;
pub extern fn igTableResetSettings(table: ?*ImGuiTable) void;
pub extern fn igTableGetBoundSettings(table: ?*ImGuiTable) [*c]ImGuiTableSettings;
pub extern fn igTableSettingsInstallHandler(context: [*c]ImGuiContext) void;
pub extern fn igTableSettingsCreate(id: ImGuiID, columns_count: c_int) [*c]ImGuiTableSettings;
pub extern fn igTableSettingsFindByID(id: ImGuiID) [*c]ImGuiTableSettings;
pub extern fn igBeginTabBarEx(tab_bar: [*c]ImGuiTabBar, bb: ImRect, flags: ImGuiTabBarFlags) bool;
pub extern fn igTabBarFindTabByID(tab_bar: [*c]ImGuiTabBar, tab_id: ImGuiID) [*c]ImGuiTabItem;
pub extern fn igTabBarRemoveTab(tab_bar: [*c]ImGuiTabBar, tab_id: ImGuiID) void;
pub extern fn igTabBarCloseTab(tab_bar: [*c]ImGuiTabBar, tab: [*c]ImGuiTabItem) void;
pub extern fn igTabBarQueueReorder(tab_bar: [*c]ImGuiTabBar, tab: [*c]const ImGuiTabItem, offset: c_int) void;
pub extern fn igTabBarQueueReorderFromMousePos(tab_bar: [*c]ImGuiTabBar, tab: [*c]const ImGuiTabItem, mouse_pos: ImVec2) void;
pub extern fn igTabBarProcessReorder(tab_bar: [*c]ImGuiTabBar) bool;
pub extern fn igTabItemEx(tab_bar: [*c]ImGuiTabBar, label: [*c]const u8, p_open: [*c]bool, flags: ImGuiTabItemFlags) bool;
pub extern fn igTabItemCalcSize(pOut: [*c]ImVec2, label: [*c]const u8, has_close_button: bool) void;
pub extern fn igTabItemBackground(draw_list: [*c]ImDrawList, bb: ImRect, flags: ImGuiTabItemFlags, col: ImU32) void;
pub extern fn igTabItemLabelAndCloseButton(draw_list: [*c]ImDrawList, bb: ImRect, flags: ImGuiTabItemFlags, frame_padding: ImVec2, label: [*c]const u8, tab_id: ImGuiID, close_button_id: ImGuiID, is_contents_visible: bool, out_just_closed: [*c]bool, out_text_clipped: [*c]bool) void;
pub extern fn igRenderText(pos: ImVec2, text: [*c]const u8, text_end: [*c]const u8, hide_text_after_hash: bool) void;
pub extern fn igRenderTextWrapped(pos: ImVec2, text: [*c]const u8, text_end: [*c]const u8, wrap_width: f32) void;
pub extern fn igRenderTextClipped(pos_min: ImVec2, pos_max: ImVec2, text: [*c]const u8, text_end: [*c]const u8, text_size_if_known: [*c]const ImVec2, @"align": ImVec2, clip_rect: [*c]const ImRect) void;
pub extern fn igRenderTextClippedEx(draw_list: [*c]ImDrawList, pos_min: ImVec2, pos_max: ImVec2, text: [*c]const u8, text_end: [*c]const u8, text_size_if_known: [*c]const ImVec2, @"align": ImVec2, clip_rect: [*c]const ImRect) void;
pub extern fn igRenderTextEllipsis(draw_list: [*c]ImDrawList, pos_min: ImVec2, pos_max: ImVec2, clip_max_x: f32, ellipsis_max_x: f32, text: [*c]const u8, text_end: [*c]const u8, text_size_if_known: [*c]const ImVec2) void;
pub extern fn igRenderFrame(p_min: ImVec2, p_max: ImVec2, fill_col: ImU32, border: bool, rounding: f32) void;
pub extern fn igRenderFrameBorder(p_min: ImVec2, p_max: ImVec2, rounding: f32) void;
pub extern fn igRenderColorRectWithAlphaCheckerboard(draw_list: [*c]ImDrawList, p_min: ImVec2, p_max: ImVec2, fill_col: ImU32, grid_step: f32, grid_off: ImVec2, rounding: f32, flags: ImDrawFlags) void;
pub extern fn igRenderNavHighlight(bb: ImRect, id: ImGuiID, flags: ImGuiNavHighlightFlags) void;
pub extern fn igFindRenderedTextEnd(text: [*c]const u8, text_end: [*c]const u8) [*c]const u8;
pub extern fn igRenderArrow(draw_list: [*c]ImDrawList, pos: ImVec2, col: ImU32, dir: ImGuiDir, scale: f32) void;
pub extern fn igRenderBullet(draw_list: [*c]ImDrawList, pos: ImVec2, col: ImU32) void;
pub extern fn igRenderCheckMark(draw_list: [*c]ImDrawList, pos: ImVec2, col: ImU32, sz: f32) void;
pub extern fn igRenderMouseCursor(draw_list: [*c]ImDrawList, pos: ImVec2, scale: f32, mouse_cursor: ImGuiMouseCursor, col_fill: ImU32, col_border: ImU32, col_shadow: ImU32) void;
pub extern fn igRenderArrowPointingAt(draw_list: [*c]ImDrawList, pos: ImVec2, half_sz: ImVec2, direction: ImGuiDir, col: ImU32) void;
pub extern fn igRenderRectFilledRangeH(draw_list: [*c]ImDrawList, rect: ImRect, col: ImU32, x_start_norm: f32, x_end_norm: f32, rounding: f32) void;
pub extern fn igRenderRectFilledWithHole(draw_list: [*c]ImDrawList, outer: ImRect, inner: ImRect, col: ImU32, rounding: f32) void;
pub extern fn igTextEx(text: [*c]const u8, text_end: [*c]const u8, flags: ImGuiTextFlags) void;
pub extern fn igButtonEx(label: [*c]const u8, size_arg: ImVec2, flags: ImGuiButtonFlags) bool;
pub extern fn igCloseButton(id: ImGuiID, pos: ImVec2) bool;
pub extern fn igCollapseButton(id: ImGuiID, pos: ImVec2) bool;
pub extern fn igArrowButtonEx(str_id: [*c]const u8, dir: ImGuiDir, size_arg: ImVec2, flags: ImGuiButtonFlags) bool;
pub extern fn igScrollbar(axis: ImGuiAxis) void;
pub extern fn igScrollbarEx(bb: ImRect, id: ImGuiID, axis: ImGuiAxis, p_scroll_v: [*c]ImS64, avail_v: ImS64, contents_v: ImS64, flags: ImDrawFlags) bool;
pub extern fn igImageButtonEx(id: ImGuiID, texture_id: ImTextureID, size: ImVec2, uv0: ImVec2, uv1: ImVec2, padding: ImVec2, bg_col: ImVec4, tint_col: ImVec4) bool;
pub extern fn igGetWindowScrollbarRect(pOut: [*c]ImRect, window: ?*ImGuiWindow, axis: ImGuiAxis) void;
pub extern fn igGetWindowScrollbarID(window: ?*ImGuiWindow, axis: ImGuiAxis) ImGuiID;
pub extern fn igGetWindowResizeCornerID(window: ?*ImGuiWindow, n: c_int) ImGuiID;
pub extern fn igGetWindowResizeBorderID(window: ?*ImGuiWindow, dir: ImGuiDir) ImGuiID;
pub extern fn igSeparatorEx(flags: ImGuiSeparatorFlags) void;
pub extern fn igCheckboxFlags_S64Ptr(label: [*c]const u8, flags: [*c]ImS64, flags_value: ImS64) bool;
pub extern fn igCheckboxFlags_U64Ptr(label: [*c]const u8, flags: [*c]ImU64, flags_value: ImU64) bool;
pub extern fn igButtonBehavior(bb: ImRect, id: ImGuiID, out_hovered: [*c]bool, out_held: [*c]bool, flags: ImGuiButtonFlags) bool;
pub extern fn igDragBehavior(id: ImGuiID, data_type: ImGuiDataType, p_v: ?*anyopaque, v_speed: f32, p_min: ?*const anyopaque, p_max: ?*const anyopaque, format: [*c]const u8, flags: ImGuiSliderFlags) bool;
pub extern fn igSliderBehavior(bb: ImRect, id: ImGuiID, data_type: ImGuiDataType, p_v: ?*anyopaque, p_min: ?*const anyopaque, p_max: ?*const anyopaque, format: [*c]const u8, flags: ImGuiSliderFlags, out_grab_bb: [*c]ImRect) bool;
pub extern fn igSplitterBehavior(bb: ImRect, id: ImGuiID, axis: ImGuiAxis, size1: [*c]f32, size2: [*c]f32, min_size1: f32, min_size2: f32, hover_extend: f32, hover_visibility_delay: f32) bool;
pub extern fn igTreeNodeBehavior(id: ImGuiID, flags: ImGuiTreeNodeFlags, label: [*c]const u8, label_end: [*c]const u8) bool;
pub extern fn igTreeNodeBehaviorIsOpen(id: ImGuiID, flags: ImGuiTreeNodeFlags) bool;
pub extern fn igTreePushOverrideID(id: ImGuiID) void;
pub extern fn igDataTypeGetInfo(data_type: ImGuiDataType) [*c]const ImGuiDataTypeInfo;
pub extern fn igDataTypeFormatString(buf: [*c]u8, buf_size: c_int, data_type: ImGuiDataType, p_data: ?*const anyopaque, format: [*c]const u8) c_int;
pub extern fn igDataTypeApplyOp(data_type: ImGuiDataType, op: c_int, output: ?*anyopaque, arg_1: ?*const anyopaque, arg_2: ?*const anyopaque) void;
pub extern fn igDataTypeApplyOpFromText(buf: [*c]const u8, initial_value_buf: [*c]const u8, data_type: ImGuiDataType, p_data: ?*anyopaque, format: [*c]const u8) bool;
pub extern fn igDataTypeCompare(data_type: ImGuiDataType, arg_1: ?*const anyopaque, arg_2: ?*const anyopaque) c_int;
pub extern fn igDataTypeClamp(data_type: ImGuiDataType, p_data: ?*anyopaque, p_min: ?*const anyopaque, p_max: ?*const anyopaque) bool;
pub extern fn igInputTextEx(label: [*c]const u8, hint: [*c]const u8, buf: [*c]u8, buf_size: c_int, size_arg: ImVec2, flags: ImGuiInputTextFlags, callback: ImGuiInputTextCallback, user_data: ?*anyopaque) bool;
pub extern fn igTempInputText(bb: ImRect, id: ImGuiID, label: [*c]const u8, buf: [*c]u8, buf_size: c_int, flags: ImGuiInputTextFlags) bool;
pub extern fn igTempInputScalar(bb: ImRect, id: ImGuiID, label: [*c]const u8, data_type: ImGuiDataType, p_data: ?*anyopaque, format: [*c]const u8, p_clamp_min: ?*const anyopaque, p_clamp_max: ?*const anyopaque) bool;
pub extern fn igTempInputIsActive(id: ImGuiID) bool;
pub extern fn igGetInputTextState(id: ImGuiID) [*c]ImGuiInputTextState;
pub extern fn igColorTooltip(text: [*c]const u8, col: [*c]const f32, flags: ImGuiColorEditFlags) void;
pub extern fn igColorEditOptionsPopup(col: [*c]const f32, flags: ImGuiColorEditFlags) void;
pub extern fn igColorPickerOptionsPopup(ref_col: [*c]const f32, flags: ImGuiColorEditFlags) void;
pub extern fn igPlotEx(plot_type: ImGuiPlotType, label: [*c]const u8, values_getter: ?fn (?*anyopaque, c_int) callconv(.C) f32, data: ?*anyopaque, values_count: c_int, values_offset: c_int, overlay_text: [*c]const u8, scale_min: f32, scale_max: f32, frame_size: ImVec2) c_int;
pub extern fn igShadeVertsLinearColorGradientKeepAlpha(draw_list: [*c]ImDrawList, vert_start_idx: c_int, vert_end_idx: c_int, gradient_p0: ImVec2, gradient_p1: ImVec2, col0: ImU32, col1: ImU32) void;
pub extern fn igShadeVertsLinearUV(draw_list: [*c]ImDrawList, vert_start_idx: c_int, vert_end_idx: c_int, a: ImVec2, b: ImVec2, uv_a: ImVec2, uv_b: ImVec2, clamp: bool) void;
pub extern fn igGcCompactTransientMiscBuffers() void;
pub extern fn igGcCompactTransientWindowBuffers(window: ?*ImGuiWindow) void;
pub extern fn igGcAwakeTransientWindowBuffers(window: ?*ImGuiWindow) void;
pub extern fn igErrorCheckEndFrameRecover(log_callback: ImGuiErrorLogCallback, user_data: ?*anyopaque) void;
pub extern fn igErrorCheckEndWindowRecover(log_callback: ImGuiErrorLogCallback, user_data: ?*anyopaque) void;
pub extern fn igDebugDrawItemRect(col: ImU32) void;
pub extern fn igDebugStartItemPicker() void;
pub extern fn igShowFontAtlas(atlas: [*c]ImFontAtlas) void;
pub extern fn igDebugHookIdInfo(id: ImGuiID, data_type: ImGuiDataType, data_id: ?*const anyopaque, data_id_end: ?*const anyopaque) void;
pub extern fn igDebugNodeColumns(columns: [*c]ImGuiOldColumns) void;
pub extern fn igDebugNodeDrawList(window: ?*ImGuiWindow, draw_list: [*c]const ImDrawList, label: [*c]const u8) void;
pub extern fn igDebugNodeDrawCmdShowMeshAndBoundingBox(out_draw_list: [*c]ImDrawList, draw_list: [*c]const ImDrawList, draw_cmd: [*c]const ImDrawCmd, show_mesh: bool, show_aabb: bool) void;
pub extern fn igDebugNodeFont(font: [*c]ImFont) void;
pub extern fn igDebugNodeStorage(storage: [*c]ImGuiStorage, label: [*c]const u8) void;
pub extern fn igDebugNodeTabBar(tab_bar: [*c]ImGuiTabBar, label: [*c]const u8) void;
pub extern fn igDebugNodeTable(table: ?*ImGuiTable) void;
pub extern fn igDebugNodeTableSettings(settings: [*c]ImGuiTableSettings) void;
pub extern fn igDebugNodeWindow(window: ?*ImGuiWindow, label: [*c]const u8) void;
pub extern fn igDebugNodeWindowSettings(settings: [*c]ImGuiWindowSettings) void;
pub extern fn igDebugNodeWindowsList(windows: [*c]ImVector_ImGuiWindowPtr, label: [*c]const u8) void;
pub extern fn igDebugNodeViewport(viewport: [*c]ImGuiViewportP) void;
pub extern fn igDebugRenderViewportThumbnail(draw_list: [*c]ImDrawList, viewport: [*c]ImGuiViewportP, bb: ImRect) void;
pub extern fn igImFontAtlasGetBuilderForStbTruetype() [*c]const ImFontBuilderIO;
pub extern fn igImFontAtlasBuildInit(atlas: [*c]ImFontAtlas) void;
pub extern fn igImFontAtlasBuildSetupFont(atlas: [*c]ImFontAtlas, font: [*c]ImFont, font_config: [*c]ImFontConfig, ascent: f32, descent: f32) void;
pub extern fn igImFontAtlasBuildPackCustomRects(atlas: [*c]ImFontAtlas, stbrp_context_opaque: ?*anyopaque) void;
pub extern fn igImFontAtlasBuildFinish(atlas: [*c]ImFontAtlas) void;
pub extern fn igImFontAtlasBuildRender8bppRectFromString(atlas: [*c]ImFontAtlas, x: c_int, y: c_int, w: c_int, h: c_int, in_str: [*c]const u8, in_marker_char: u8, in_marker_pixel_value: u8) void;
pub extern fn igImFontAtlasBuildRender32bppRectFromString(atlas: [*c]ImFontAtlas, x: c_int, y: c_int, w: c_int, h: c_int, in_str: [*c]const u8, in_marker_char: u8, in_marker_pixel_value: c_uint) void;
pub extern fn igImFontAtlasBuildMultiplyCalcLookupTable(out_table: [*c]u8, in_multiply_factor: f32) void;
pub extern fn igImFontAtlasBuildMultiplyRectAlpha8(table: [*c]const u8, pixels: [*c]u8, x: c_int, y: c_int, w: c_int, h: c_int, stride: c_int) void;
pub extern fn igLogText(fmt: [*c]const u8, ...) void;
pub extern fn ImGuiTextBuffer_appendf(buffer: [*c]struct_ImGuiTextBuffer, fmt: [*c]const u8, ...) void;
pub extern fn igGET_FLT_MAX(...) f32;
pub extern fn igGET_FLT_MIN(...) f32;
pub extern fn ImVector_ImWchar_create(...) [*c]ImVector_ImWchar;
pub extern fn ImVector_ImWchar_destroy(self: [*c]ImVector_ImWchar) void;
pub extern fn ImVector_ImWchar_Init(p: [*c]ImVector_ImWchar) void;
pub extern fn ImVector_ImWchar_UnInit(p: [*c]ImVector_ImWchar) void; | src/deps/imgui/c.zig |
const std = @import("std");
const main = @import("main.zig");
const httpclient = @import("httpclient.zig");
const testing = std.testing;
test "integration: passing a well-formed .pi-file against healthy endpoint shall generate a successful result" {
var args = [_][]const u8{
"testdata/integrationtests/standalone/success.pi",
};
main.httpClientProcessEntry = httpclient.processEntry;
var stats = try main.mainInner(testing.allocator, args[0..]);
try testing.expect(stats.num_tests == 1);
try testing.expect(stats.num_fail == 0);
try testing.expect(stats.num_success == 1);
}
test "integration: passing a well-formed .pi-file against non-healthy endpoint shall generate an error result" {
var args = [_][]const u8{
"testdata/integrationtests/standalone/404.pi",
};
main.httpClientProcessEntry = httpclient.processEntry;
var stats = try main.mainInner(testing.allocator, args[0..]);
try testing.expect(stats.num_tests == 1);
try testing.expect(stats.num_fail == 1);
try testing.expect(stats.num_success == 0);
}
test "integration: suite with .env" {
var args = [_][]const u8{
"testdata/integrationtests/suite_with_env",
};
main.httpClientProcessEntry = httpclient.processEntry;
var stats = try main.mainInner(testing.allocator, args[0..]);
try testing.expect(stats.num_tests == 2);
try testing.expect(stats.num_fail == 0);
try testing.expect(stats.num_success == 2);
}
test "integration: requiring -Darg" {
main.httpClientProcessEntry = httpclient.processEntry;
{
var args = [_][]const u8{
"testdata/integrationtests/suite_requiring_-Darg",
};
var stats = try main.mainInner(testing.allocator, args[0..]);
try testing.expect(stats.num_tests == 2);
try testing.expect(stats.num_fail == 2);
try testing.expect(stats.num_success == 0);
}
{
var args = [_][]const u8{
"testdata/integrationtests/suite_requiring_-Darg",
"-DHOSTNAME=michaelodden.com"
};
var stats = try main.mainInner(testing.allocator, args[0..]);
try testing.expect(stats.num_tests == 2);
try testing.expect(stats.num_fail == 0);
try testing.expect(stats.num_success == 2);
}
} | src/integration_test.zig |
const builtin = @import("builtin");
const mem = @import("std").mem;
const zen = if (builtin.os == builtin.Os.zen)
@import("std").os.zen
else
@import("../kernel/x86.zig");
// VRAM buffer address in physical memory.
pub const VRAM_ADDR = 0xB8000;
pub const VRAM_SIZE = 0x8000;
// Screen size.
pub const VGA_WIDTH = 80;
pub const VGA_HEIGHT = 25;
pub const VGA_SIZE = VGA_WIDTH * VGA_HEIGHT;
// Color codes.
pub const Color = enum(u4) {
Black = 0,
Blue = 1,
Green = 2,
Cyan = 3,
Red = 4,
Magenta = 5,
Brown = 6,
LightGrey = 7,
DarkGrey = 8,
LightBlue = 9,
LightGreen = 10,
LightCyan = 11,
LightRed = 12,
LightMagenta = 13,
LightBrown = 14,
White = 15,
};
// Character with attributes.
pub const VGAEntry = packed struct {
char: u8,
foreground: Color,
background: Color,
};
////
// Enable hardware cursor.
//
pub fn enableCursor() void {
zen.outb(0x3D4, 0x0A);
zen.outb(0x3D5, 0x00);
}
////
// Disable hardware cursor.
//
pub fn disableCursor() void {
zen.outb(0x3D4, 0x0A);
zen.outb(0x3D5, 1 << 5);
}
// VGA status.
pub const VGA = struct {
vram: []VGAEntry,
cursor: usize,
foreground: Color,
background: Color,
////
// Initialize the VGA status.
//
// Arguments:
// vram: The address of the VRAM buffer.
//
// Returns:
// A structure holding the VGA status.
//
pub fn init(vram: usize) VGA {
return VGA {
.vram = @intToPtr([*]VGAEntry, vram)[0..0x4000],
.cursor = 0,
.foreground = Color.LightGrey,
.background = Color.Black,
};
}
////
// Clear the screen.
//
pub fn clear(self: *VGA) void {
mem.set(VGAEntry, self.vram[0..VGA_SIZE], self.entry(' '));
self.cursor = 0;
self.updateCursor();
}
////
// Print a character to the screen.
//
// Arguments:
// char: Character to be printed.
//
fn writeChar(self: *VGA, char: u8) void {
if (self.cursor == VGA_WIDTH * VGA_HEIGHT - 1) {
self.scrollDown();
}
switch (char) {
// Newline.
'\n' => {
self.writeChar(' ');
while (self.cursor % VGA_WIDTH != 0)
self.writeChar(' ');
},
// Tab.
'\t' => {
self.writeChar(' ');
while (self.cursor % 4 != 0)
self.writeChar(' ');
},
// Backspace.
// FIXME: hardcoded 8 here is horrible.
8 => {
self.cursor -= 1;
self.writeChar(' ');
self.cursor -= 1;
},
// Any other character.
else => {
self.vram[self.cursor] = self.entry(char);
self.cursor += 1;
},
}
}
////
// Print a string to the screen.
//
// Arguments:
// string: String to be printed.
//
pub fn writeString(self: *VGA, string: []const u8) void {
for (string) |char| {
self.writeChar(char);
}
self.updateCursor();
}
////
// Scroll the screen one line down.
//
fn scrollDown(self: *VGA) void {
const first = VGA_WIDTH; // Index of first line.
const last = VGA_SIZE - VGA_WIDTH; // Index of last line.
// Copy all the screen (apart from the first line) up one line.
mem.copy(VGAEntry, self.vram[0 .. last ], self.vram[first .. VGA_SIZE]);
// Clean the last line.
mem.set( VGAEntry, self.vram[last .. VGA_SIZE], self.entry(' '));
// Bring the cursor back to the beginning of the last line.
self.cursor -= VGA_WIDTH;
}
////
// Update the position of the hardware cursor.
// Use the software cursor as the source of truth.
//
fn updateCursor(self: *const VGA) void {
zen.outb(0x3D4, 0x0F);
zen.outb(0x3D5, @truncate(u8, self.cursor));
zen.outb(0x3D4, 0x0E);
zen.outb(0x3D5, @truncate(u8, self.cursor >> 8));
}
////
// Update the position of the software cursor.
// Use the hardware cursor as the source of truth.
//
pub fn fetchCursor(self: *VGA) void {
var cursor: usize = 0;
zen.outb(0x3D4, 0x0E);
cursor |= usize(zen.inb(0x3D5)) << 8;
zen.outb(0x3D4, 0x0F);
cursor |= zen.inb(0x3D5);
self.cursor = cursor;
}
////
// Build a VGAEntry with current foreground and background.
//
// Arguments:
// char: The character of the entry.
//
// Returns:
// The requested VGAEntry.
//
fn entry(self: *VGA, char: u8) VGAEntry {
return VGAEntry {
.char = char,
.foreground = self.foreground,
.background = self.background,
};
}
}; | lib/tty.zig |
const builtin = @import("builtin");
const std = @import("std.zig");
const os = std.os;
const mem = std.mem;
const base64 = std.base64;
const crypto = std.crypto;
const Allocator = std.mem.Allocator;
const assert = std.debug.assert;
const math = std.math;
const is_darwin = std.Target.current.os.tag.isDarwin();
pub const path = @import("fs/path.zig");
pub const File = @import("fs/file.zig").File;
pub const wasi = @import("fs/wasi.zig");
// TODO audit these APIs with respect to Dir and absolute paths
pub const rename = os.rename;
pub const renameZ = os.renameZ;
pub const renameC = @compileError("deprecated: renamed to renameZ");
pub const renameW = os.renameW;
pub const realpath = os.realpath;
pub const realpathZ = os.realpathZ;
pub const realpathC = @compileError("deprecated: renamed to realpathZ");
pub const realpathW = os.realpathW;
pub const getAppDataDir = @import("fs/get_app_data_dir.zig").getAppDataDir;
pub const GetAppDataDirError = @import("fs/get_app_data_dir.zig").GetAppDataDirError;
pub const Watch = @import("fs/watch.zig").Watch;
/// This represents the maximum size of a UTF-8 encoded file path that the
/// operating system will accept. Paths, including those returned from file
/// system operations, may be longer than this length, but such paths cannot
/// be successfully passed back in other file system operations. However,
/// all path components returned by file system operations are assumed to
/// fit into a UTF-8 encoded array of this length.
/// The byte count includes room for a null sentinel byte.
pub const MAX_PATH_BYTES = switch (builtin.os.tag) {
.linux, .macosx, .ios, .freebsd, .netbsd, .dragonfly => os.PATH_MAX,
// Each UTF-16LE character may be expanded to 3 UTF-8 bytes.
// If it would require 4 UTF-8 bytes, then there would be a surrogate
// pair in the UTF-16LE, and we (over)account 3 bytes for it that way.
// +1 for the null byte at the end, which can be encoded in 1 byte.
.windows => os.windows.PATH_MAX_WIDE * 3 + 1,
// TODO work out what a reasonable value we should use here
.wasi => 4096,
else => @compileError("Unsupported OS"),
};
pub const base64_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
/// Base64 encoder, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem.
pub const base64_encoder = base64.Base64Encoder.init(base64_alphabet, base64.standard_pad_char);
/// Base64 decoder, replacing the standard `+/` with `-_` so that it can be used in a file name on any filesystem.
pub const base64_decoder = base64.Base64Decoder.init(base64_alphabet, base64.standard_pad_char);
/// Whether or not async file system syscalls need a dedicated thread because the operating
/// system does not support non-blocking I/O on the file system.
pub const need_async_thread = std.io.is_async and switch (builtin.os.tag) {
.windows, .other => false,
else => true,
};
/// TODO remove the allocator requirement from this API
pub fn atomicSymLink(allocator: *Allocator, existing_path: []const u8, new_path: []const u8) !void {
if (cwd().symLink(existing_path, new_path, .{})) {
return;
} else |err| switch (err) {
error.PathAlreadyExists => {},
else => return err, // TODO zig should know this set does not include PathAlreadyExists
}
const dirname = path.dirname(new_path) orelse ".";
var rand_buf: [AtomicFile.RANDOM_BYTES]u8 = undefined;
const tmp_path = try allocator.alloc(u8, dirname.len + 1 + base64.Base64Encoder.calcSize(rand_buf.len));
defer allocator.free(tmp_path);
mem.copy(u8, tmp_path[0..], dirname);
tmp_path[dirname.len] = path.sep;
while (true) {
try crypto.randomBytes(rand_buf[0..]);
base64_encoder.encode(tmp_path[dirname.len + 1 ..], &rand_buf);
if (cwd().symLink(existing_path, tmp_path, .{})) {
return rename(tmp_path, new_path);
} else |err| switch (err) {
error.PathAlreadyExists => continue,
else => return err, // TODO zig should know this set does not include PathAlreadyExists
}
}
}
pub const PrevStatus = enum {
stale,
fresh,
};
pub const CopyFileOptions = struct {
/// When this is `null` the mode is copied from the source file.
override_mode: ?File.Mode = null,
};
/// Same as `Dir.updateFile`, except asserts that both `source_path` and `dest_path`
/// are absolute. See `Dir.updateFile` for a function that operates on both
/// absolute and relative paths.
pub fn updateFileAbsolute(
source_path: []const u8,
dest_path: []const u8,
args: CopyFileOptions,
) !PrevStatus {
assert(path.isAbsolute(source_path));
assert(path.isAbsolute(dest_path));
const my_cwd = cwd();
return Dir.updateFile(my_cwd, source_path, my_cwd, dest_path, args);
}
/// Same as `Dir.copyFile`, except asserts that both `source_path` and `dest_path`
/// are absolute. See `Dir.copyFile` for a function that operates on both
/// absolute and relative paths.
pub fn copyFileAbsolute(source_path: []const u8, dest_path: []const u8, args: CopyFileOptions) !void {
assert(path.isAbsolute(source_path));
assert(path.isAbsolute(dest_path));
const my_cwd = cwd();
return Dir.copyFile(my_cwd, source_path, my_cwd, dest_path, args);
}
/// TODO update this API to avoid a getrandom syscall for every operation.
pub const AtomicFile = struct {
file: File,
// TODO either replace this with rand_buf or use []u16 on Windows
tmp_path_buf: [TMP_PATH_LEN:0]u8,
dest_basename: []const u8,
file_open: bool,
file_exists: bool,
close_dir_on_deinit: bool,
dir: Dir,
const InitError = File.OpenError;
const RANDOM_BYTES = 12;
const TMP_PATH_LEN = base64.Base64Encoder.calcSize(RANDOM_BYTES);
/// Note that the `Dir.atomicFile` API may be more handy than this lower-level function.
pub fn init(
dest_basename: []const u8,
mode: File.Mode,
dir: Dir,
close_dir_on_deinit: bool,
) InitError!AtomicFile {
var rand_buf: [RANDOM_BYTES]u8 = undefined;
var tmp_path_buf: [TMP_PATH_LEN:0]u8 = undefined;
// TODO: should be able to use TMP_PATH_LEN here.
tmp_path_buf[base64.Base64Encoder.calcSize(RANDOM_BYTES)] = 0;
while (true) {
try crypto.randomBytes(rand_buf[0..]);
base64_encoder.encode(&tmp_path_buf, &rand_buf);
const file = dir.createFile(
&tmp_path_buf,
.{ .mode = mode, .exclusive = true },
) catch |err| switch (err) {
error.PathAlreadyExists => continue,
else => |e| return e,
};
return AtomicFile{
.file = file,
.tmp_path_buf = tmp_path_buf,
.dest_basename = dest_basename,
.file_open = true,
.file_exists = true,
.close_dir_on_deinit = close_dir_on_deinit,
.dir = dir,
};
}
}
/// always call deinit, even after successful finish()
pub fn deinit(self: *AtomicFile) void {
if (self.file_open) {
self.file.close();
self.file_open = false;
}
if (self.file_exists) {
self.dir.deleteFile(&self.tmp_path_buf) catch {};
self.file_exists = false;
}
if (self.close_dir_on_deinit) {
self.dir.close();
}
self.* = undefined;
}
pub fn finish(self: *AtomicFile) !void {
assert(self.file_exists);
if (self.file_open) {
self.file.close();
self.file_open = false;
}
try os.renameat(self.dir.fd, self.tmp_path_buf[0..], self.dir.fd, self.dest_basename);
self.file_exists = false;
}
};
const default_new_dir_mode = 0o755;
/// Create a new directory, based on an absolute path.
/// Asserts that the path is absolute. See `Dir.makeDir` for a function that operates
/// on both absolute and relative paths.
pub fn makeDirAbsolute(absolute_path: []const u8) !void {
assert(path.isAbsolute(absolute_path));
return os.mkdir(absolute_path, default_new_dir_mode);
}
/// Same as `makeDirAbsolute` except the parameter is a null-terminated UTF8-encoded string.
pub fn makeDirAbsoluteZ(absolute_path_z: [*:0]const u8) !void {
assert(path.isAbsoluteZ(absolute_path_z));
return os.mkdirZ(absolute_path_z, default_new_dir_mode);
}
/// Same as `makeDirAbsolute` except the parameter is a null-terminated WTF-16 encoded string.
pub fn makeDirAbsoluteW(absolute_path_w: [*:0]const u16) !void {
assert(path.isAbsoluteWindowsW(absolute_path_w));
return os.mkdirW(absolute_path_w, default_new_dir_mode);
}
pub const deleteDir = @compileError("deprecated; use dir.deleteDir or deleteDirAbsolute");
pub const deleteDirC = @compileError("deprecated; use dir.deleteDirZ or deleteDirAbsoluteZ");
pub const deleteDirW = @compileError("deprecated; use dir.deleteDirW or deleteDirAbsoluteW");
/// Same as `Dir.deleteDir` except the path is absolute.
pub fn deleteDirAbsolute(dir_path: []const u8) !void {
assert(path.isAbsolute(dir_path));
return os.rmdir(dir_path);
}
/// Same as `deleteDirAbsolute` except the path parameter is null-terminated.
pub fn deleteDirAbsoluteZ(dir_path: [*:0]const u8) !void {
assert(path.isAbsoluteZ(dir_path));
return os.rmdirZ(dir_path);
}
/// Same as `deleteDirAbsolute` except the path parameter is WTF-16 and target OS is assumed Windows.
pub fn deleteDirAbsoluteW(dir_path: [*:0]const u16) !void {
assert(path.isAbsoluteWindowsW(dir_path));
return os.rmdirW(dir_path);
}
pub const Dir = struct {
fd: os.fd_t,
pub const Entry = struct {
name: []const u8,
kind: Kind,
pub const Kind = File.Kind;
};
const IteratorError = error{AccessDenied} || os.UnexpectedError;
pub const Iterator = switch (builtin.os.tag) {
.macosx, .ios, .freebsd, .netbsd, .dragonfly => struct {
dir: Dir,
seek: i64,
buf: [8192]u8, // TODO align(@alignOf(os.dirent)),
index: usize,
end_index: usize,
const Self = @This();
pub const Error = IteratorError;
/// Memory such as file names referenced in this returned entry becomes invalid
/// with subsequent calls to `next`, as well as when this `Dir` is deinitialized.
pub fn next(self: *Self) Error!?Entry {
switch (builtin.os.tag) {
.macosx, .ios => return self.nextDarwin(),
.freebsd, .netbsd, .dragonfly => return self.nextBsd(),
else => @compileError("unimplemented"),
}
}
fn nextDarwin(self: *Self) !?Entry {
start_over: while (true) {
if (self.index >= self.end_index) {
const rc = os.system.__getdirentries64(
self.dir.fd,
&self.buf,
self.buf.len,
&self.seek,
);
if (rc == 0) return null;
if (rc < 0) {
switch (os.errno(rc)) {
os.EBADF => unreachable, // Dir is invalid or was opened without iteration ability
os.EFAULT => unreachable,
os.ENOTDIR => unreachable,
os.EINVAL => unreachable,
else => |err| return os.unexpectedErrno(err),
}
}
self.index = 0;
self.end_index = @intCast(usize, rc);
}
const darwin_entry = @ptrCast(*align(1) os.dirent, &self.buf[self.index]);
const next_index = self.index + darwin_entry.reclen();
self.index = next_index;
const name = @ptrCast([*]u8, &darwin_entry.d_name)[0..darwin_entry.d_namlen];
if (mem.eql(u8, name, ".") or mem.eql(u8, name, "..")) {
continue :start_over;
}
const entry_kind = switch (darwin_entry.d_type) {
os.DT_BLK => Entry.Kind.BlockDevice,
os.DT_CHR => Entry.Kind.CharacterDevice,
os.DT_DIR => Entry.Kind.Directory,
os.DT_FIFO => Entry.Kind.NamedPipe,
os.DT_LNK => Entry.Kind.SymLink,
os.DT_REG => Entry.Kind.File,
os.DT_SOCK => Entry.Kind.UnixDomainSocket,
os.DT_WHT => Entry.Kind.Whiteout,
else => Entry.Kind.Unknown,
};
return Entry{
.name = name,
.kind = entry_kind,
};
}
}
fn nextBsd(self: *Self) !?Entry {
start_over: while (true) {
if (self.index >= self.end_index) {
const rc = if (builtin.os.tag == .netbsd)
os.system.__getdents30(self.dir.fd, &self.buf, self.buf.len)
else
os.system.getdents(self.dir.fd, &self.buf, self.buf.len);
switch (os.errno(rc)) {
0 => {},
os.EBADF => unreachable, // Dir is invalid or was opened without iteration ability
os.EFAULT => unreachable,
os.ENOTDIR => unreachable,
os.EINVAL => unreachable,
else => |err| return os.unexpectedErrno(err),
}
if (rc == 0) return null;
self.index = 0;
self.end_index = @intCast(usize, rc);
}
const freebsd_entry = @ptrCast(*align(1) os.dirent, &self.buf[self.index]);
const next_index = self.index + freebsd_entry.reclen();
self.index = next_index;
const name = @ptrCast([*]u8, &freebsd_entry.d_name)[0..freebsd_entry.d_namlen];
if (mem.eql(u8, name, ".") or mem.eql(u8, name, "..")) {
continue :start_over;
}
const entry_kind = switch (freebsd_entry.d_type) {
os.DT_BLK => Entry.Kind.BlockDevice,
os.DT_CHR => Entry.Kind.CharacterDevice,
os.DT_DIR => Entry.Kind.Directory,
os.DT_FIFO => Entry.Kind.NamedPipe,
os.DT_LNK => Entry.Kind.SymLink,
os.DT_REG => Entry.Kind.File,
os.DT_SOCK => Entry.Kind.UnixDomainSocket,
os.DT_WHT => Entry.Kind.Whiteout,
else => Entry.Kind.Unknown,
};
return Entry{
.name = name,
.kind = entry_kind,
};
}
}
},
.linux => struct {
dir: Dir,
buf: [8192]u8, // TODO align(@alignOf(os.dirent64)),
index: usize,
end_index: usize,
const Self = @This();
pub const Error = IteratorError;
/// Memory such as file names referenced in this returned entry becomes invalid
/// with subsequent calls to `next`, as well as when this `Dir` is deinitialized.
pub fn next(self: *Self) Error!?Entry {
start_over: while (true) {
if (self.index >= self.end_index) {
const rc = os.linux.getdents64(self.dir.fd, &self.buf, self.buf.len);
switch (os.linux.getErrno(rc)) {
0 => {},
os.EBADF => unreachable, // Dir is invalid or was opened without iteration ability
os.EFAULT => unreachable,
os.ENOTDIR => unreachable,
os.EINVAL => unreachable,
else => |err| return os.unexpectedErrno(err),
}
if (rc == 0) return null;
self.index = 0;
self.end_index = rc;
}
const linux_entry = @ptrCast(*align(1) os.dirent64, &self.buf[self.index]);
const next_index = self.index + linux_entry.reclen();
self.index = next_index;
const name = mem.spanZ(@ptrCast([*:0]u8, &linux_entry.d_name));
// skip . and .. entries
if (mem.eql(u8, name, ".") or mem.eql(u8, name, "..")) {
continue :start_over;
}
const entry_kind = switch (linux_entry.d_type) {
os.DT_BLK => Entry.Kind.BlockDevice,
os.DT_CHR => Entry.Kind.CharacterDevice,
os.DT_DIR => Entry.Kind.Directory,
os.DT_FIFO => Entry.Kind.NamedPipe,
os.DT_LNK => Entry.Kind.SymLink,
os.DT_REG => Entry.Kind.File,
os.DT_SOCK => Entry.Kind.UnixDomainSocket,
else => Entry.Kind.Unknown,
};
return Entry{
.name = name,
.kind = entry_kind,
};
}
}
},
.windows => struct {
dir: Dir,
buf: [8192]u8 align(@alignOf(os.windows.FILE_BOTH_DIR_INFORMATION)),
index: usize,
end_index: usize,
first: bool,
name_data: [256]u8,
const Self = @This();
pub const Error = IteratorError;
/// Memory such as file names referenced in this returned entry becomes invalid
/// with subsequent calls to `next`, as well as when this `Dir` is deinitialized.
pub fn next(self: *Self) Error!?Entry {
start_over: while (true) {
const w = os.windows;
if (self.index >= self.end_index) {
var io: w.IO_STATUS_BLOCK = undefined;
const rc = w.ntdll.NtQueryDirectoryFile(
self.dir.fd,
null,
null,
null,
&io,
&self.buf,
self.buf.len,
.FileBothDirectoryInformation,
w.FALSE,
null,
if (self.first) @as(w.BOOLEAN, w.TRUE) else @as(w.BOOLEAN, w.FALSE),
);
self.first = false;
if (io.Information == 0) return null;
self.index = 0;
self.end_index = io.Information;
switch (rc) {
.SUCCESS => {},
.ACCESS_DENIED => return error.AccessDenied, // Double-check that the Dir was opened with iteration ability
else => return w.unexpectedStatus(rc),
}
}
const aligned_ptr = @alignCast(@alignOf(w.FILE_BOTH_DIR_INFORMATION), &self.buf[self.index]);
const dir_info = @ptrCast(*w.FILE_BOTH_DIR_INFORMATION, aligned_ptr);
if (dir_info.NextEntryOffset != 0) {
self.index += dir_info.NextEntryOffset;
} else {
self.index = self.buf.len;
}
const name_utf16le = @ptrCast([*]u16, &dir_info.FileName)[0 .. dir_info.FileNameLength / 2];
if (mem.eql(u16, name_utf16le, &[_]u16{'.'}) or mem.eql(u16, name_utf16le, &[_]u16{ '.', '.' }))
continue;
// Trust that Windows gives us valid UTF-16LE
const name_utf8_len = std.unicode.utf16leToUtf8(self.name_data[0..], name_utf16le) catch unreachable;
const name_utf8 = self.name_data[0..name_utf8_len];
const kind = blk: {
const attrs = dir_info.FileAttributes;
if (attrs & w.FILE_ATTRIBUTE_DIRECTORY != 0) break :blk Entry.Kind.Directory;
if (attrs & w.FILE_ATTRIBUTE_REPARSE_POINT != 0) break :blk Entry.Kind.SymLink;
break :blk Entry.Kind.File;
};
return Entry{
.name = name_utf8,
.kind = kind,
};
}
}
},
.wasi => struct {
dir: Dir,
buf: [8192]u8, // TODO align(@alignOf(os.wasi.dirent_t)),
cookie: u64,
index: usize,
end_index: usize,
const Self = @This();
pub const Error = IteratorError;
/// Memory such as file names referenced in this returned entry becomes invalid
/// with subsequent calls to `next`, as well as when this `Dir` is deinitialized.
pub fn next(self: *Self) Error!?Entry {
const w = os.wasi;
start_over: while (true) {
if (self.index >= self.end_index) {
var bufused: usize = undefined;
switch (w.fd_readdir(self.dir.fd, &self.buf, self.buf.len, self.cookie, &bufused)) {
w.ESUCCESS => {},
w.EBADF => unreachable, // Dir is invalid or was opened without iteration ability
w.EFAULT => unreachable,
w.ENOTDIR => unreachable,
w.EINVAL => unreachable,
w.ENOTCAPABLE => return error.AccessDenied,
else => |err| return os.unexpectedErrno(err),
}
if (bufused == 0) return null;
self.index = 0;
self.end_index = bufused;
}
const entry = @ptrCast(*align(1) w.dirent_t, &self.buf[self.index]);
const entry_size = @sizeOf(w.dirent_t);
const name_index = self.index + entry_size;
const name = mem.span(self.buf[name_index .. name_index + entry.d_namlen]);
const next_index = name_index + entry.d_namlen;
self.index = next_index;
self.cookie = entry.d_next;
// skip . and .. entries
if (mem.eql(u8, name, ".") or mem.eql(u8, name, "..")) {
continue :start_over;
}
const entry_kind = switch (entry.d_type) {
w.FILETYPE_BLOCK_DEVICE => Entry.Kind.BlockDevice,
w.FILETYPE_CHARACTER_DEVICE => Entry.Kind.CharacterDevice,
w.FILETYPE_DIRECTORY => Entry.Kind.Directory,
w.FILETYPE_SYMBOLIC_LINK => Entry.Kind.SymLink,
w.FILETYPE_REGULAR_FILE => Entry.Kind.File,
w.FILETYPE_SOCKET_STREAM, wasi.FILETYPE_SOCKET_DGRAM => Entry.Kind.UnixDomainSocket,
else => Entry.Kind.Unknown,
};
return Entry{
.name = name,
.kind = entry_kind,
};
}
}
},
else => @compileError("unimplemented"),
};
pub fn iterate(self: Dir) Iterator {
switch (builtin.os.tag) {
.macosx, .ios, .freebsd, .netbsd, .dragonfly => return Iterator{
.dir = self,
.seek = 0,
.index = 0,
.end_index = 0,
.buf = undefined,
},
.linux => return Iterator{
.dir = self,
.index = 0,
.end_index = 0,
.buf = undefined,
},
.windows => return Iterator{
.dir = self,
.index = 0,
.end_index = 0,
.first = true,
.buf = undefined,
.name_data = undefined,
},
.wasi => return Iterator{
.dir = self,
.cookie = os.wasi.DIRCOOKIE_START,
.index = 0,
.end_index = 0,
.buf = undefined,
},
else => @compileError("unimplemented"),
}
}
pub const OpenError = error{
FileNotFound,
NotDir,
AccessDenied,
SymLinkLoop,
ProcessFdQuotaExceeded,
NameTooLong,
SystemFdQuotaExceeded,
NoDevice,
SystemResources,
InvalidUtf8,
BadPathName,
DeviceBusy,
} || os.UnexpectedError;
pub fn close(self: *Dir) void {
if (need_async_thread) {
std.event.Loop.instance.?.close(self.fd);
} else {
os.close(self.fd);
}
self.* = undefined;
}
/// Opens a file for reading or writing, without attempting to create a new file.
/// To create a new file, see `createFile`.
/// Call `File.close` to release the resource.
/// Asserts that the path parameter has no null bytes.
pub fn openFile(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.OpenError!File {
if (builtin.os.tag == .windows) {
const path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.openFileW(path_w.span(), flags);
}
if (builtin.os.tag == .wasi) {
return self.openFileWasi(sub_path, flags);
}
const path_c = try os.toPosixPath(sub_path);
return self.openFileZ(&path_c, flags);
}
/// Save as `openFile` but WASI only.
pub fn openFileWasi(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.OpenError!File {
const w = os.wasi;
var fdflags: w.fdflags_t = 0x0;
var base: w.rights_t = 0x0;
if (flags.read) {
base |= w.RIGHT_FD_READ | w.RIGHT_FD_TELL | w.RIGHT_FD_SEEK | w.RIGHT_FD_FILESTAT_GET;
}
if (flags.write) {
fdflags |= w.FDFLAG_APPEND;
base |= w.RIGHT_FD_WRITE |
w.RIGHT_FD_TELL |
w.RIGHT_FD_SEEK |
w.RIGHT_FD_DATASYNC |
w.RIGHT_FD_FDSTAT_SET_FLAGS |
w.RIGHT_FD_SYNC |
w.RIGHT_FD_ALLOCATE |
w.RIGHT_FD_ADVISE |
w.RIGHT_FD_FILESTAT_SET_TIMES |
w.RIGHT_FD_FILESTAT_SET_SIZE;
}
const fd = try os.openatWasi(self.fd, sub_path, 0x0, 0x0, fdflags, base, 0x0);
return File{ .handle = fd };
}
pub const openFileC = @compileError("deprecated: renamed to openFileZ");
/// Same as `openFile` but the path parameter is null-terminated.
pub fn openFileZ(self: Dir, sub_path: [*:0]const u8, flags: File.OpenFlags) File.OpenError!File {
if (builtin.os.tag == .windows) {
const path_w = try os.windows.cStrToPrefixedFileW(sub_path);
return self.openFileW(path_w.span(), flags);
}
// Use the O_ locking flags if the os supports them
// (Or if it's darwin, as darwin's `open` doesn't support the O_SYNC flag)
const has_flock_open_flags = @hasDecl(os, "O_EXLOCK") and !is_darwin;
const nonblocking_lock_flag = if (has_flock_open_flags and flags.lock_nonblocking)
os.O_NONBLOCK | os.O_SYNC
else
@as(u32, 0);
const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) {
.None => @as(u32, 0),
.Shared => os.O_SHLOCK | nonblocking_lock_flag,
.Exclusive => os.O_EXLOCK | nonblocking_lock_flag,
} else 0;
const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
const os_flags = lock_flag | O_LARGEFILE | os.O_CLOEXEC | if (flags.write and flags.read)
@as(u32, os.O_RDWR)
else if (flags.write)
@as(u32, os.O_WRONLY)
else
@as(u32, os.O_RDONLY);
const fd = if (flags.intended_io_mode != .blocking)
try std.event.Loop.instance.?.openatZ(self.fd, sub_path, os_flags, 0)
else
try os.openatZ(self.fd, sub_path, os_flags, 0);
if (!has_flock_open_flags and flags.lock != .None) {
// TODO: integrate async I/O
const lock_nonblocking = if (flags.lock_nonblocking) os.LOCK_NB else @as(i32, 0);
try os.flock(fd, switch (flags.lock) {
.None => unreachable,
.Shared => os.LOCK_SH | lock_nonblocking,
.Exclusive => os.LOCK_EX | lock_nonblocking,
});
}
return File{
.handle = fd,
.capable_io_mode = .blocking,
.intended_io_mode = flags.intended_io_mode,
};
}
/// Same as `openFile` but Windows-only and the path parameter is
/// [WTF-16](https://simonsapin.github.io/wtf-8/#potentially-ill-formed-utf-16) encoded.
pub fn openFileW(self: Dir, sub_path_w: []const u16, flags: File.OpenFlags) File.OpenError!File {
const w = os.windows;
return @as(File, .{
.handle = try os.windows.OpenFile(sub_path_w, .{
.dir = self.fd,
.access_mask = w.SYNCHRONIZE |
(if (flags.read) @as(u32, w.GENERIC_READ) else 0) |
(if (flags.write) @as(u32, w.GENERIC_WRITE) else 0),
.share_access = switch (flags.lock) {
.None => w.FILE_SHARE_WRITE | w.FILE_SHARE_READ | w.FILE_SHARE_DELETE,
.Shared => w.FILE_SHARE_READ | w.FILE_SHARE_DELETE,
.Exclusive => w.FILE_SHARE_DELETE,
},
.share_access_nonblocking = flags.lock_nonblocking,
.creation = w.FILE_OPEN,
.io_mode = flags.intended_io_mode,
}),
.capable_io_mode = std.io.default_mode,
.intended_io_mode = flags.intended_io_mode,
});
}
/// Creates, opens, or overwrites a file with write access.
/// Call `File.close` on the result when done.
/// Asserts that the path parameter has no null bytes.
pub fn createFile(self: Dir, sub_path: []const u8, flags: File.CreateFlags) File.OpenError!File {
if (builtin.os.tag == .windows) {
const path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.createFileW(path_w.span(), flags);
}
if (builtin.os.tag == .wasi) {
return self.createFileWasi(sub_path, flags);
}
const path_c = try os.toPosixPath(sub_path);
return self.createFileZ(&path_c, flags);
}
pub const createFileC = @compileError("deprecated: renamed to createFileZ");
/// Same as `createFile` but WASI only.
pub fn createFileWasi(self: Dir, sub_path: []const u8, flags: File.CreateFlags) File.OpenError!File {
const w = os.wasi;
var oflags = w.O_CREAT;
var base: w.rights_t = w.RIGHT_FD_WRITE |
w.RIGHT_FD_DATASYNC |
w.RIGHT_FD_SEEK |
w.RIGHT_FD_TELL |
w.RIGHT_FD_FDSTAT_SET_FLAGS |
w.RIGHT_FD_SYNC |
w.RIGHT_FD_ALLOCATE |
w.RIGHT_FD_ADVISE |
w.RIGHT_FD_FILESTAT_SET_TIMES |
w.RIGHT_FD_FILESTAT_SET_SIZE |
w.RIGHT_FD_FILESTAT_GET;
if (flags.read) {
base |= w.RIGHT_FD_READ;
}
if (flags.truncate) {
oflags |= w.O_TRUNC;
}
if (flags.exclusive) {
oflags |= w.O_EXCL;
}
const fd = try os.openatWasi(self.fd, sub_path, 0x0, oflags, 0x0, base, 0x0);
return File{ .handle = fd };
}
/// Same as `createFile` but the path parameter is null-terminated.
pub fn createFileZ(self: Dir, sub_path_c: [*:0]const u8, flags: File.CreateFlags) File.OpenError!File {
if (builtin.os.tag == .windows) {
const path_w = try os.windows.cStrToPrefixedFileW(sub_path_c);
return self.createFileW(path_w.span(), flags);
}
// Use the O_ locking flags if the os supports them
// (Or if it's darwin, as darwin's `open` doesn't support the O_SYNC flag)
const has_flock_open_flags = @hasDecl(os, "O_EXLOCK") and !is_darwin;
const nonblocking_lock_flag: u32 = if (has_flock_open_flags and flags.lock_nonblocking)
os.O_NONBLOCK | os.O_SYNC
else
0;
const lock_flag: u32 = if (has_flock_open_flags) switch (flags.lock) {
.None => @as(u32, 0),
.Shared => os.O_SHLOCK,
.Exclusive => os.O_EXLOCK,
} else 0;
const O_LARGEFILE = if (@hasDecl(os, "O_LARGEFILE")) os.O_LARGEFILE else 0;
const os_flags = lock_flag | O_LARGEFILE | os.O_CREAT | os.O_CLOEXEC |
(if (flags.truncate) @as(u32, os.O_TRUNC) else 0) |
(if (flags.read) @as(u32, os.O_RDWR) else os.O_WRONLY) |
(if (flags.exclusive) @as(u32, os.O_EXCL) else 0);
const fd = if (flags.intended_io_mode != .blocking)
try std.event.Loop.instance.?.openatZ(self.fd, sub_path_c, os_flags, flags.mode)
else
try os.openatZ(self.fd, sub_path_c, os_flags, flags.mode);
if (!has_flock_open_flags and flags.lock != .None) {
// TODO: integrate async I/O
const lock_nonblocking = if (flags.lock_nonblocking) os.LOCK_NB else @as(i32, 0);
try os.flock(fd, switch (flags.lock) {
.None => unreachable,
.Shared => os.LOCK_SH | lock_nonblocking,
.Exclusive => os.LOCK_EX | lock_nonblocking,
});
}
return File{
.handle = fd,
.capable_io_mode = .blocking,
.intended_io_mode = flags.intended_io_mode,
};
}
/// Same as `createFile` but Windows-only and the path parameter is
/// [WTF-16](https://simonsapin.github.io/wtf-8/#potentially-ill-formed-utf-16) encoded.
pub fn createFileW(self: Dir, sub_path_w: []const u16, flags: File.CreateFlags) File.OpenError!File {
const w = os.windows;
const read_flag = if (flags.read) @as(u32, w.GENERIC_READ) else 0;
return @as(File, .{
.handle = try os.windows.OpenFile(sub_path_w, .{
.dir = self.fd,
.access_mask = w.SYNCHRONIZE | w.GENERIC_WRITE | read_flag,
.share_access = switch (flags.lock) {
.None => w.FILE_SHARE_WRITE | w.FILE_SHARE_READ | w.FILE_SHARE_DELETE,
.Shared => w.FILE_SHARE_READ | w.FILE_SHARE_DELETE,
.Exclusive => w.FILE_SHARE_DELETE,
},
.share_access_nonblocking = flags.lock_nonblocking,
.creation = if (flags.exclusive)
@as(u32, w.FILE_CREATE)
else if (flags.truncate)
@as(u32, w.FILE_OVERWRITE_IF)
else
@as(u32, w.FILE_OPEN_IF),
.io_mode = flags.intended_io_mode,
}),
.capable_io_mode = std.io.default_mode,
.intended_io_mode = flags.intended_io_mode,
});
}
pub const openRead = @compileError("deprecated in favor of openFile");
pub const openReadC = @compileError("deprecated in favor of openFileZ");
pub const openReadW = @compileError("deprecated in favor of openFileW");
pub fn makeDir(self: Dir, sub_path: []const u8) !void {
try os.mkdirat(self.fd, sub_path, default_new_dir_mode);
}
pub fn makeDirZ(self: Dir, sub_path: [*:0]const u8) !void {
try os.mkdiratZ(self.fd, sub_path, default_new_dir_mode);
}
pub fn makeDirW(self: Dir, sub_path: [*:0]const u16) !void {
try os.mkdiratW(self.fd, sub_path, default_new_dir_mode);
}
/// Calls makeDir recursively to make an entire path. Returns success if the path
/// already exists and is a directory.
/// This function is not atomic, and if it returns an error, the file system may
/// have been modified regardless.
pub fn makePath(self: Dir, sub_path: []const u8) !void {
var end_index: usize = sub_path.len;
while (true) {
self.makeDir(sub_path[0..end_index]) catch |err| switch (err) {
error.PathAlreadyExists => {
// TODO stat the file and return an error if it's not a directory
// this is important because otherwise a dangling symlink
// could cause an infinite loop
if (end_index == sub_path.len) return;
},
error.FileNotFound => {
if (end_index == 0) return err;
// march end_index backward until next path component
while (true) {
end_index -= 1;
if (path.isSep(sub_path[end_index])) break;
}
continue;
},
else => return err,
};
if (end_index == sub_path.len) return;
// march end_index forward until next path component
while (true) {
end_index += 1;
if (end_index == sub_path.len or path.isSep(sub_path[end_index])) break;
}
}
}
/// This function performs `makePath`, followed by `openDir`.
/// If supported by the OS, this operation is atomic. It is not atomic on
/// all operating systems.
pub fn makeOpenPath(self: Dir, sub_path: []const u8, open_dir_options: OpenDirOptions) !Dir {
// TODO improve this implementation on Windows; we can avoid 1 call to NtClose
try self.makePath(sub_path);
return self.openDir(sub_path, open_dir_options);
}
/// This function returns the canonicalized absolute pathname of
/// `pathname` relative to this `Dir`. If `pathname` is absolute, ignores this
/// `Dir` handle and returns the canonicalized absolute pathname of `pathname`
/// argument.
/// This function is not universally supported by all platforms.
/// Currently supported hosts are: Linux, macOS, and Windows.
/// See also `Dir.realpathZ`, `Dir.realpathW`, and `Dir.realpathAlloc`.
pub fn realpath(self: Dir, pathname: []const u8, out_buffer: []u8) ![]u8 {
if (builtin.os.tag == .wasi) {
@compileError("realpath is unsupported in WASI");
}
if (builtin.os.tag == .windows) {
const pathname_w = try os.windows.sliceToPrefixedFileW(pathname);
return self.realpathW(pathname_w.span(), out_buffer);
}
const pathname_c = try os.toPosixPath(pathname);
return self.realpathZ(&pathname_c, out_buffer);
}
/// Same as `Dir.realpath` except `pathname` is null-terminated.
/// See also `Dir.realpath`, `realpathZ`.
pub fn realpathZ(self: Dir, pathname: [*:0]const u8, out_buffer: []u8) ![]u8 {
if (builtin.os.tag == .windows) {
const pathname_w = try os.windows.cStrToPrefixedFileW(pathname);
return self.realpathW(pathname_w.span(), out_buffer);
}
const flags = if (builtin.os.tag == .linux) os.O_PATH | os.O_NONBLOCK | os.O_CLOEXEC else os.O_NONBLOCK | os.O_CLOEXEC;
const fd = os.openatZ(self.fd, pathname, flags, 0) catch |err| switch (err) {
error.FileLocksNotSupported => unreachable,
else => |e| return e,
};
defer os.close(fd);
// Use of MAX_PATH_BYTES here is valid as the realpath function does not
// have a variant that takes an arbitrary-size buffer.
// TODO(#4812): Consider reimplementing realpath or using the POSIX.1-2008
// NULL out parameter (GNU's canonicalize_file_name) to handle overelong
// paths. musl supports passing NULL but restricts the output to PATH_MAX
// anyway.
var buffer: [MAX_PATH_BYTES]u8 = undefined;
const out_path = try os.getFdPath(fd, &buffer);
if (out_path.len > out_buffer.len) {
return error.NameTooLong;
}
mem.copy(u8, out_buffer, out_path);
return out_buffer[0..out_path.len];
}
/// Windows-only. Same as `Dir.realpath` except `pathname` is WTF16 encoded.
/// See also `Dir.realpath`, `realpathW`.
pub fn realpathW(self: Dir, pathname: []const u16, out_buffer: []u8) ![]u8 {
const w = os.windows;
const access_mask = w.GENERIC_READ | w.SYNCHRONIZE;
const share_access = w.FILE_SHARE_READ;
const creation = w.FILE_OPEN;
const h_file = blk: {
const res = w.OpenFile(pathname, .{
.dir = self.fd,
.access_mask = access_mask,
.share_access = share_access,
.creation = creation,
.io_mode = .blocking,
}) catch |err| switch (err) {
error.IsDir => break :blk w.OpenFile(pathname, .{
.dir = self.fd,
.access_mask = access_mask,
.share_access = share_access,
.creation = creation,
.io_mode = .blocking,
.open_dir = true,
}) catch |er| switch (er) {
error.WouldBlock => unreachable,
else => |e2| return e2,
},
error.WouldBlock => unreachable,
else => |e| return e,
};
break :blk res;
};
defer w.CloseHandle(h_file);
// Use of MAX_PATH_BYTES here is valid as the realpath function does not
// have a variant that takes an arbitrary-size buffer.
// TODO(#4812): Consider reimplementing realpath or using the POSIX.1-2008
// NULL out parameter (GNU's canonicalize_file_name) to handle overelong
// paths. musl supports passing NULL but restricts the output to PATH_MAX
// anyway.
var buffer: [MAX_PATH_BYTES]u8 = undefined;
const out_path = try os.getFdPath(h_file, &buffer);
if (out_path.len > out_buffer.len) {
return error.NameTooLong;
}
mem.copy(u8, out_buffer, out_path);
return out_buffer[0..out_path.len];
}
/// Same as `Dir.realpath` except caller must free the returned memory.
/// See also `Dir.realpath`.
pub fn realpathAlloc(self: Dir, allocator: *Allocator, pathname: []const u8) ![]u8 {
// Use of MAX_PATH_BYTES here is valid as the realpath function does not
// have a variant that takes an arbitrary-size buffer.
// TODO(#4812): Consider reimplementing realpath or using the POSIX.1-2008
// NULL out parameter (GNU's canonicalize_file_name) to handle overelong
// paths. musl supports passing NULL but restricts the output to PATH_MAX
// anyway.
var buf: [MAX_PATH_BYTES]u8 = undefined;
return allocator.dupe(u8, try self.realpath(pathname, buf[0..]));
}
/// Changes the current working directory to the open directory handle.
/// This modifies global state and can have surprising effects in multi-
/// threaded applications. Most applications and especially libraries should
/// not call this function as a general rule, however it can have use cases
/// in, for example, implementing a shell, or child process execution.
/// Not all targets support this. For example, WASI does not have the concept
/// of a current working directory.
pub fn setAsCwd(self: Dir) !void {
if (builtin.os.tag == .wasi) {
@compileError("changing cwd is not currently possible in WASI");
}
try os.fchdir(self.fd);
}
pub const OpenDirOptions = struct {
/// `true` means the opened directory can be used as the `Dir` parameter
/// for functions which operate based on an open directory handle. When `false`,
/// such operations are Illegal Behavior.
access_sub_paths: bool = true,
/// `true` means the opened directory can be scanned for the files and sub-directories
/// of the result. It means the `iterate` function can be called.
iterate: bool = false,
/// `true` means it won't dereference the symlinks.
no_follow: bool = false,
};
/// Opens a directory at the given path. The directory is a system resource that remains
/// open until `close` is called on the result.
///
/// Asserts that the path parameter has no null bytes.
pub fn openDir(self: Dir, sub_path: []const u8, args: OpenDirOptions) OpenError!Dir {
if (builtin.os.tag == .windows) {
const sub_path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.openDirW(sub_path_w.span().ptr, args);
} else if (builtin.os.tag == .wasi) {
return self.openDirWasi(sub_path, args);
} else {
const sub_path_c = try os.toPosixPath(sub_path);
return self.openDirZ(&sub_path_c, args);
}
}
pub const openDirC = @compileError("deprecated: renamed to openDirZ");
/// Same as `openDir` except only WASI.
pub fn openDirWasi(self: Dir, sub_path: []const u8, args: OpenDirOptions) OpenError!Dir {
const w = os.wasi;
var base: w.rights_t = w.RIGHT_FD_FILESTAT_GET | w.RIGHT_FD_FDSTAT_SET_FLAGS | w.RIGHT_FD_FILESTAT_SET_TIMES;
if (args.iterate) {
base |= w.RIGHT_FD_READDIR;
}
if (args.access_sub_paths) {
base |= w.RIGHT_PATH_CREATE_DIRECTORY |
w.RIGHT_PATH_CREATE_FILE |
w.RIGHT_PATH_LINK_SOURCE |
w.RIGHT_PATH_LINK_TARGET |
w.RIGHT_PATH_OPEN |
w.RIGHT_PATH_READLINK |
w.RIGHT_PATH_RENAME_SOURCE |
w.RIGHT_PATH_RENAME_TARGET |
w.RIGHT_PATH_FILESTAT_GET |
w.RIGHT_PATH_FILESTAT_SET_SIZE |
w.RIGHT_PATH_FILESTAT_SET_TIMES |
w.RIGHT_PATH_SYMLINK |
w.RIGHT_PATH_REMOVE_DIRECTORY |
w.RIGHT_PATH_UNLINK_FILE;
}
const symlink_flags: w.lookupflags_t = if (args.no_follow) 0x0 else w.LOOKUP_SYMLINK_FOLLOW;
// TODO do we really need all the rights here?
const inheriting: w.rights_t = w.RIGHT_ALL ^ w.RIGHT_SOCK_SHUTDOWN;
const result = os.openatWasi(self.fd, sub_path, symlink_flags, w.O_DIRECTORY, 0x0, base, inheriting);
const fd = result catch |err| switch (err) {
error.FileTooBig => unreachable, // can't happen for directories
error.IsDir => unreachable, // we're providing O_DIRECTORY
error.NoSpaceLeft => unreachable, // not providing O_CREAT
error.PathAlreadyExists => unreachable, // not providing O_CREAT
error.FileLocksNotSupported => unreachable, // locking folders is not supported
else => |e| return e,
};
return Dir{ .fd = fd };
}
/// Same as `openDir` except the parameter is null-terminated.
pub fn openDirZ(self: Dir, sub_path_c: [*:0]const u8, args: OpenDirOptions) OpenError!Dir {
if (builtin.os.tag == .windows) {
const sub_path_w = try os.windows.cStrToPrefixedFileW(sub_path_c);
return self.openDirW(sub_path_w.span().ptr, args);
}
const symlink_flags: u32 = if (args.no_follow) os.O_NOFOLLOW else 0x0;
if (!args.iterate) {
const O_PATH = if (@hasDecl(os, "O_PATH")) os.O_PATH else 0;
return self.openDirFlagsZ(sub_path_c, os.O_DIRECTORY | os.O_RDONLY | os.O_CLOEXEC | O_PATH | symlink_flags);
} else {
return self.openDirFlagsZ(sub_path_c, os.O_DIRECTORY | os.O_RDONLY | os.O_CLOEXEC | symlink_flags);
}
}
/// Same as `openDir` except the path parameter is WTF-16 encoded, NT-prefixed.
/// This function asserts the target OS is Windows.
pub fn openDirW(self: Dir, sub_path_w: [*:0]const u16, args: OpenDirOptions) OpenError!Dir {
const w = os.windows;
// TODO remove some of these flags if args.access_sub_paths is false
const base_flags = w.STANDARD_RIGHTS_READ | w.FILE_READ_ATTRIBUTES | w.FILE_READ_EA |
w.SYNCHRONIZE | w.FILE_TRAVERSE;
const flags: u32 = if (args.iterate) base_flags | w.FILE_LIST_DIRECTORY else base_flags;
return self.openDirAccessMaskW(sub_path_w, flags, args.no_follow);
}
/// `flags` must contain `os.O_DIRECTORY`.
fn openDirFlagsZ(self: Dir, sub_path_c: [*:0]const u8, flags: u32) OpenError!Dir {
const result = if (need_async_thread)
std.event.Loop.instance.?.openatZ(self.fd, sub_path_c, flags, 0)
else
os.openatZ(self.fd, sub_path_c, flags, 0);
const fd = result catch |err| switch (err) {
error.FileTooBig => unreachable, // can't happen for directories
error.IsDir => unreachable, // we're providing O_DIRECTORY
error.NoSpaceLeft => unreachable, // not providing O_CREAT
error.PathAlreadyExists => unreachable, // not providing O_CREAT
error.FileLocksNotSupported => unreachable, // locking folders is not supported
else => |e| return e,
};
return Dir{ .fd = fd };
}
fn openDirAccessMaskW(self: Dir, sub_path_w: [*:0]const u16, access_mask: u32, no_follow: bool) OpenError!Dir {
const w = os.windows;
var result = Dir{
.fd = undefined,
};
const path_len_bytes = @intCast(u16, mem.lenZ(sub_path_w) * 2);
var nt_name = w.UNICODE_STRING{
.Length = path_len_bytes,
.MaximumLength = path_len_bytes,
.Buffer = @intToPtr([*]u16, @ptrToInt(sub_path_w)),
};
var attr = w.OBJECT_ATTRIBUTES{
.Length = @sizeOf(w.OBJECT_ATTRIBUTES),
.RootDirectory = if (path.isAbsoluteWindowsW(sub_path_w)) null else self.fd,
.Attributes = 0, // Note we do not use OBJ_CASE_INSENSITIVE here.
.ObjectName = &nt_name,
.SecurityDescriptor = null,
.SecurityQualityOfService = null,
};
if (sub_path_w[0] == '.' and sub_path_w[1] == 0) {
// Windows does not recognize this, but it does work with empty string.
nt_name.Length = 0;
}
if (sub_path_w[0] == '.' and sub_path_w[1] == '.' and sub_path_w[2] == 0) {
// If you're looking to contribute to zig and fix this, see here for an example of how to
// implement this: https://git.midipix.org/ntapi/tree/src/fs/ntapi_tt_open_physical_parent_directory.c
@panic("TODO opening '..' with a relative directory handle is not yet implemented on Windows");
}
const open_reparse_point: w.DWORD = if (no_follow) w.FILE_OPEN_REPARSE_POINT else 0x0;
var io: w.IO_STATUS_BLOCK = undefined;
const rc = w.ntdll.NtCreateFile(
&result.fd,
access_mask,
&attr,
&io,
null,
0,
w.FILE_SHARE_READ | w.FILE_SHARE_WRITE,
w.FILE_OPEN,
w.FILE_DIRECTORY_FILE | w.FILE_SYNCHRONOUS_IO_NONALERT | w.FILE_OPEN_FOR_BACKUP_INTENT | open_reparse_point,
null,
0,
);
switch (rc) {
.SUCCESS => return result,
.OBJECT_NAME_INVALID => unreachable,
.OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
.OBJECT_PATH_NOT_FOUND => return error.FileNotFound,
.NOT_A_DIRECTORY => return error.NotDir,
.INVALID_PARAMETER => unreachable,
else => return w.unexpectedStatus(rc),
}
}
pub const DeleteFileError = os.UnlinkError;
/// Delete a file name and possibly the file it refers to, based on an open directory handle.
/// Asserts that the path parameter has no null bytes.
pub fn deleteFile(self: Dir, sub_path: []const u8) DeleteFileError!void {
if (builtin.os.tag == .windows) {
const sub_path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.deleteFileW(sub_path_w.span());
} else if (builtin.os.tag == .wasi) {
os.unlinkatWasi(self.fd, sub_path, 0) catch |err| switch (err) {
error.DirNotEmpty => unreachable, // not passing AT_REMOVEDIR
else => |e| return e,
};
} else {
const sub_path_c = try os.toPosixPath(sub_path);
return self.deleteFileZ(&sub_path_c);
}
}
pub const deleteFileC = @compileError("deprecated: renamed to deleteFileZ");
/// Same as `deleteFile` except the parameter is null-terminated.
pub fn deleteFileZ(self: Dir, sub_path_c: [*:0]const u8) DeleteFileError!void {
os.unlinkatZ(self.fd, sub_path_c, 0) catch |err| switch (err) {
error.DirNotEmpty => unreachable, // not passing AT_REMOVEDIR
error.AccessDenied => |e| switch (builtin.os.tag) {
// non-Linux POSIX systems return EPERM when trying to delete a directory, so
// we need to handle that case specifically and translate the error
.macosx, .ios, .freebsd, .netbsd, .dragonfly => {
// Don't follow symlinks to match unlinkat (which acts on symlinks rather than follows them)
const fstat = os.fstatatZ(self.fd, sub_path_c, os.AT_SYMLINK_NOFOLLOW) catch return e;
const is_dir = fstat.mode & os.S_IFMT == os.S_IFDIR;
return if (is_dir) error.IsDir else e;
},
else => return e,
},
else => |e| return e,
};
}
/// Same as `deleteFile` except the parameter is WTF-16 encoded.
pub fn deleteFileW(self: Dir, sub_path_w: []const u16) DeleteFileError!void {
os.unlinkatW(self.fd, sub_path_w, 0) catch |err| switch (err) {
error.DirNotEmpty => unreachable, // not passing AT_REMOVEDIR
else => |e| return e,
};
}
pub const DeleteDirError = error{
DirNotEmpty,
FileNotFound,
AccessDenied,
FileBusy,
FileSystem,
SymLinkLoop,
NameTooLong,
NotDir,
SystemResources,
ReadOnlyFileSystem,
InvalidUtf8,
BadPathName,
Unexpected,
};
/// Returns `error.DirNotEmpty` if the directory is not empty.
/// To delete a directory recursively, see `deleteTree`.
/// Asserts that the path parameter has no null bytes.
pub fn deleteDir(self: Dir, sub_path: []const u8) DeleteDirError!void {
if (builtin.os.tag == .windows) {
const sub_path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.deleteDirW(sub_path_w.span());
} else if (builtin.os.tag == .wasi) {
os.unlinkat(self.fd, sub_path, os.AT_REMOVEDIR) catch |err| switch (err) {
error.IsDir => unreachable, // not possible since we pass AT_REMOVEDIR
else => |e| return e,
};
} else {
const sub_path_c = try os.toPosixPath(sub_path);
return self.deleteDirZ(&sub_path_c);
}
}
/// Same as `deleteDir` except the parameter is null-terminated.
pub fn deleteDirZ(self: Dir, sub_path_c: [*:0]const u8) DeleteDirError!void {
os.unlinkatZ(self.fd, sub_path_c, os.AT_REMOVEDIR) catch |err| switch (err) {
error.IsDir => unreachable, // not possible since we pass AT_REMOVEDIR
else => |e| return e,
};
}
/// Same as `deleteDir` except the parameter is UTF16LE, NT prefixed.
/// This function is Windows-only.
pub fn deleteDirW(self: Dir, sub_path_w: []const u16) DeleteDirError!void {
os.unlinkatW(self.fd, sub_path_w, os.AT_REMOVEDIR) catch |err| switch (err) {
error.IsDir => unreachable, // not possible since we pass AT_REMOVEDIR
else => |e| return e,
};
}
/// Creates a symbolic link named `sym_link_path` which contains the string `target_path`.
/// A symbolic link (also known as a soft link) may point to an existing file or to a nonexistent
/// one; the latter case is known as a dangling link.
/// If `sym_link_path` exists, it will not be overwritten.
pub fn symLink(
self: Dir,
target_path: []const u8,
sym_link_path: []const u8,
flags: SymLinkFlags,
) !void {
if (builtin.os.tag == .wasi) {
return self.symLinkWasi(target_path, sym_link_path, flags);
}
if (builtin.os.tag == .windows) {
const target_path_w = try os.windows.sliceToPrefixedFileW(target_path);
const sym_link_path_w = try os.windows.sliceToPrefixedFileW(sym_link_path);
return self.symLinkW(target_path_w.span(), sym_link_path_w.span(), flags);
}
const target_path_c = try os.toPosixPath(target_path);
const sym_link_path_c = try os.toPosixPath(sym_link_path);
return self.symLinkZ(&target_path_c, &sym_link_path_c, flags);
}
/// WASI-only. Same as `symLink` except targeting WASI.
pub fn symLinkWasi(
self: Dir,
target_path: []const u8,
sym_link_path: []const u8,
flags: SymLinkFlags,
) !void {
return os.symlinkatWasi(target_path, self.fd, sym_link_path);
}
/// Same as `symLink`, except the pathname parameters are null-terminated.
pub fn symLinkZ(
self: Dir,
target_path_c: [*:0]const u8,
sym_link_path_c: [*:0]const u8,
flags: SymLinkFlags,
) !void {
if (builtin.os.tag == .windows) {
const target_path_w = try os.windows.cStrToPrefixedFileW(target_path_c);
const sym_link_path_w = try os.windows.cStrToPrefixedFileW(sym_link_path_c);
return self.symLinkW(target_path_w.span(), sym_link_path_w.span(), flags);
}
return os.symlinkatZ(target_path_c, self.fd, sym_link_path_c);
}
/// Windows-only. Same as `symLink` except the pathname parameters
/// are null-terminated, WTF16 encoded.
pub fn symLinkW(
self: Dir,
target_path_w: []const u16,
sym_link_path_w: []const u16,
flags: SymLinkFlags,
) !void {
return os.windows.CreateSymbolicLink(self.fd, sym_link_path_w, target_path_w, flags.is_directory);
}
/// Read value of a symbolic link.
/// The return value is a slice of `buffer`, from index `0`.
/// Asserts that the path parameter has no null bytes.
pub fn readLink(self: Dir, sub_path: []const u8, buffer: []u8) ![]u8 {
if (builtin.os.tag == .wasi) {
return self.readLinkWasi(sub_path, buffer);
}
if (builtin.os.tag == .windows) {
const sub_path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.readLinkW(sub_path_w.span(), buffer);
}
const sub_path_c = try os.toPosixPath(sub_path);
return self.readLinkZ(&sub_path_c, buffer);
}
pub const readLinkC = @compileError("deprecated: renamed to readLinkZ");
/// WASI-only. Same as `readLink` except targeting WASI.
pub fn readLinkWasi(self: Dir, sub_path: []const u8, buffer: []u8) ![]u8 {
return os.readlinkatWasi(self.fd, sub_path, buffer);
}
/// Same as `readLink`, except the `pathname` parameter is null-terminated.
pub fn readLinkZ(self: Dir, sub_path_c: [*:0]const u8, buffer: []u8) ![]u8 {
if (builtin.os.tag == .windows) {
const sub_path_w = try os.windows.cStrToPrefixedFileW(sub_path_c);
return self.readLinkW(sub_path_w.span(), buffer);
}
return os.readlinkatZ(self.fd, sub_path_c, buffer);
}
/// Windows-only. Same as `readLink` except the pathname parameter
/// is null-terminated, WTF16 encoded.
pub fn readLinkW(self: Dir, sub_path_w: []const u16, buffer: []u8) ![]u8 {
return os.windows.ReadLink(self.fd, sub_path_w, buffer);
}
/// On success, caller owns returned buffer.
/// If the file is larger than `max_bytes`, returns `error.FileTooBig`.
pub fn readFileAlloc(self: Dir, allocator: *mem.Allocator, file_path: []const u8, max_bytes: usize) ![]u8 {
return self.readFileAllocOptions(allocator, file_path, max_bytes, @alignOf(u8), null);
}
/// On success, caller owns returned buffer.
/// If the file is larger than `max_bytes`, returns `error.FileTooBig`.
/// Allows specifying alignment and a sentinel value.
pub fn readFileAllocOptions(
self: Dir,
allocator: *mem.Allocator,
file_path: []const u8,
max_bytes: usize,
comptime alignment: u29,
comptime optional_sentinel: ?u8,
) !(if (optional_sentinel) |s| [:s]align(alignment) u8 else []align(alignment) u8) {
var file = try self.openFile(file_path, .{});
defer file.close();
const stat_size = try file.getEndPos();
return file.readAllAllocOptions(allocator, stat_size, max_bytes, alignment, optional_sentinel);
}
pub const DeleteTreeError = error{
AccessDenied,
FileTooBig,
SymLinkLoop,
ProcessFdQuotaExceeded,
NameTooLong,
SystemFdQuotaExceeded,
NoDevice,
SystemResources,
ReadOnlyFileSystem,
FileSystem,
FileBusy,
DeviceBusy,
/// One of the path components was not a directory.
/// This error is unreachable if `sub_path` does not contain a path separator.
NotDir,
/// On Windows, file paths must be valid Unicode.
InvalidUtf8,
/// On Windows, file paths cannot contain these characters:
/// '/', '*', '?', '"', '<', '>', '|'
BadPathName,
} || os.UnexpectedError;
/// Whether `full_path` describes a symlink, file, or directory, this function
/// removes it. If it cannot be removed because it is a non-empty directory,
/// this function recursively removes its entries and then tries again.
/// This operation is not atomic on most file systems.
pub fn deleteTree(self: Dir, sub_path: []const u8) DeleteTreeError!void {
start_over: while (true) {
var got_access_denied = false;
// First, try deleting the item as a file. This way we don't follow sym links.
if (self.deleteFile(sub_path)) {
return;
} else |err| switch (err) {
error.FileNotFound => return,
error.IsDir => {},
error.AccessDenied => got_access_denied = true,
error.InvalidUtf8,
error.SymLinkLoop,
error.NameTooLong,
error.SystemResources,
error.ReadOnlyFileSystem,
error.NotDir,
error.FileSystem,
error.FileBusy,
error.BadPathName,
error.Unexpected,
=> |e| return e,
}
var dir = self.openDir(sub_path, .{ .iterate = true, .no_follow = true }) catch |err| switch (err) {
error.NotDir => {
if (got_access_denied) {
return error.AccessDenied;
}
continue :start_over;
},
error.FileNotFound => {
// That's fine, we were trying to remove this directory anyway.
continue :start_over;
},
error.AccessDenied,
error.SymLinkLoop,
error.ProcessFdQuotaExceeded,
error.NameTooLong,
error.SystemFdQuotaExceeded,
error.NoDevice,
error.SystemResources,
error.Unexpected,
error.InvalidUtf8,
error.BadPathName,
error.DeviceBusy,
=> |e| return e,
};
var cleanup_dir_parent: ?Dir = null;
defer if (cleanup_dir_parent) |*d| d.close();
var cleanup_dir = true;
defer if (cleanup_dir) dir.close();
// Valid use of MAX_PATH_BYTES because dir_name_buf will only
// ever store a single path component that was returned from the
// filesystem.
var dir_name_buf: [MAX_PATH_BYTES]u8 = undefined;
var dir_name: []const u8 = sub_path;
// Here we must avoid recursion, in order to provide O(1) memory guarantee of this function.
// Go through each entry and if it is not a directory, delete it. If it is a directory,
// open it, and close the original directory. Repeat. Then start the entire operation over.
scan_dir: while (true) {
var dir_it = dir.iterate();
while (try dir_it.next()) |entry| {
if (dir.deleteFile(entry.name)) {
continue;
} else |err| switch (err) {
error.FileNotFound => continue,
// Impossible because we do not pass any path separators.
error.NotDir => unreachable,
error.IsDir => {},
error.AccessDenied => got_access_denied = true,
error.InvalidUtf8,
error.SymLinkLoop,
error.NameTooLong,
error.SystemResources,
error.ReadOnlyFileSystem,
error.FileSystem,
error.FileBusy,
error.BadPathName,
error.Unexpected,
=> |e| return e,
}
const new_dir = dir.openDir(entry.name, .{ .iterate = true, .no_follow = true }) catch |err| switch (err) {
error.NotDir => {
if (got_access_denied) {
return error.AccessDenied;
}
continue :scan_dir;
},
error.FileNotFound => {
// That's fine, we were trying to remove this directory anyway.
continue :scan_dir;
},
error.AccessDenied,
error.SymLinkLoop,
error.ProcessFdQuotaExceeded,
error.NameTooLong,
error.SystemFdQuotaExceeded,
error.NoDevice,
error.SystemResources,
error.Unexpected,
error.InvalidUtf8,
error.BadPathName,
error.DeviceBusy,
=> |e| return e,
};
if (cleanup_dir_parent) |*d| d.close();
cleanup_dir_parent = dir;
dir = new_dir;
mem.copy(u8, &dir_name_buf, entry.name);
dir_name = dir_name_buf[0..entry.name.len];
continue :scan_dir;
}
// Reached the end of the directory entries, which means we successfully deleted all of them.
// Now to remove the directory itself.
dir.close();
cleanup_dir = false;
if (cleanup_dir_parent) |d| {
d.deleteDir(dir_name) catch |err| switch (err) {
// These two things can happen due to file system race conditions.
error.FileNotFound, error.DirNotEmpty => continue :start_over,
else => |e| return e,
};
continue :start_over;
} else {
self.deleteDir(sub_path) catch |err| switch (err) {
error.FileNotFound => return,
error.DirNotEmpty => continue :start_over,
else => |e| return e,
};
return;
}
}
}
}
/// Writes content to the file system, creating a new file if it does not exist, truncating
/// if it already exists.
pub fn writeFile(self: Dir, sub_path: []const u8, data: []const u8) !void {
var file = try self.createFile(sub_path, .{});
defer file.close();
try file.writeAll(data);
}
pub const AccessError = os.AccessError;
/// Test accessing `path`.
/// `path` is UTF8-encoded.
/// Be careful of Time-Of-Check-Time-Of-Use race conditions when using this function.
/// For example, instead of testing if a file exists and then opening it, just
/// open it and handle the error for file not found.
pub fn access(self: Dir, sub_path: []const u8, flags: File.OpenFlags) AccessError!void {
if (builtin.os.tag == .windows) {
const sub_path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.accessW(sub_path_w.span().ptr, flags);
}
const path_c = try os.toPosixPath(sub_path);
return self.accessZ(&path_c, flags);
}
/// Same as `access` except the path parameter is null-terminated.
pub fn accessZ(self: Dir, sub_path: [*:0]const u8, flags: File.OpenFlags) AccessError!void {
if (builtin.os.tag == .windows) {
const sub_path_w = try os.windows.cStrToPrefixedFileW(sub_path);
return self.accessW(sub_path_w.span().ptr, flags);
}
const os_mode = if (flags.write and flags.read)
@as(u32, os.R_OK | os.W_OK)
else if (flags.write)
@as(u32, os.W_OK)
else
@as(u32, os.F_OK);
const result = if (need_async_thread and flags.intended_io_mode != .blocking)
std.event.Loop.instance.?.faccessatZ(self.fd, sub_path, os_mode, 0)
else
os.faccessatZ(self.fd, sub_path, os_mode, 0);
return result;
}
/// Same as `access` except asserts the target OS is Windows and the path parameter is
/// * WTF-16 encoded
/// * null-terminated
/// * NtDll prefixed
/// TODO currently this ignores `flags`.
pub fn accessW(self: Dir, sub_path_w: [*:0]const u16, flags: File.OpenFlags) AccessError!void {
return os.faccessatW(self.fd, sub_path_w, 0, 0);
}
/// Check the file size, mtime, and mode of `source_path` and `dest_path`. If they are equal, does nothing.
/// Otherwise, atomically copies `source_path` to `dest_path`. The destination file gains the mtime,
/// atime, and mode of the source file so that the next call to `updateFile` will not need a copy.
/// Returns the previous status of the file before updating.
/// If any of the directories do not exist for dest_path, they are created.
pub fn updateFile(
source_dir: Dir,
source_path: []const u8,
dest_dir: Dir,
dest_path: []const u8,
options: CopyFileOptions,
) !PrevStatus {
var src_file = try source_dir.openFile(source_path, .{});
defer src_file.close();
const src_stat = try src_file.stat();
const actual_mode = options.override_mode orelse src_stat.mode;
check_dest_stat: {
const dest_stat = blk: {
var dest_file = dest_dir.openFile(dest_path, .{}) catch |err| switch (err) {
error.FileNotFound => break :check_dest_stat,
else => |e| return e,
};
defer dest_file.close();
break :blk try dest_file.stat();
};
if (src_stat.size == dest_stat.size and
src_stat.mtime == dest_stat.mtime and
actual_mode == dest_stat.mode)
{
return PrevStatus.fresh;
}
}
if (path.dirname(dest_path)) |dirname| {
try dest_dir.makePath(dirname);
}
var atomic_file = try dest_dir.atomicFile(dest_path, .{ .mode = actual_mode });
defer atomic_file.deinit();
try atomic_file.file.writeFileAll(src_file, .{ .in_len = src_stat.size });
try atomic_file.file.updateTimes(src_stat.atime, src_stat.mtime);
try atomic_file.finish();
return PrevStatus.stale;
}
/// Guaranteed to be atomic.
/// On Linux, until https://patchwork.kernel.org/patch/9636735/ is merged and readily available,
/// there is a possibility of power loss or application termination leaving temporary files present
/// in the same directory as dest_path.
pub fn copyFile(
source_dir: Dir,
source_path: []const u8,
dest_dir: Dir,
dest_path: []const u8,
options: CopyFileOptions,
) !void {
var in_file = try source_dir.openFile(source_path, .{});
defer in_file.close();
var size: ?u64 = null;
const mode = options.override_mode orelse blk: {
const st = try in_file.stat();
size = st.size;
break :blk st.mode;
};
var atomic_file = try dest_dir.atomicFile(dest_path, .{ .mode = mode });
defer atomic_file.deinit();
try atomic_file.file.writeFileAll(in_file, .{ .in_len = size });
return atomic_file.finish();
}
pub const AtomicFileOptions = struct {
mode: File.Mode = File.default_mode,
};
/// Directly access the `.file` field, and then call `AtomicFile.finish`
/// to atomically replace `dest_path` with contents.
/// Always call `AtomicFile.deinit` to clean up, regardless of whether `AtomicFile.finish` succeeded.
/// `dest_path` must remain valid until `AtomicFile.deinit` is called.
pub fn atomicFile(self: Dir, dest_path: []const u8, options: AtomicFileOptions) !AtomicFile {
if (path.dirname(dest_path)) |dirname| {
const dir = try self.openDir(dirname, .{});
return AtomicFile.init(path.basename(dest_path), options.mode, dir, true);
} else {
return AtomicFile.init(dest_path, options.mode, self, false);
}
}
pub const Stat = File.Stat;
pub const StatError = File.StatError;
pub fn stat(self: Dir) StatError!Stat {
const file: File = .{
.handle = self.fd,
.capable_io_mode = .blocking,
};
return file.stat();
}
};
/// Returns an handle to the current working directory. It is not opened with iteration capability.
/// Closing the returned `Dir` is checked illegal behavior. Iterating over the result is illegal behavior.
/// On POSIX targets, this function is comptime-callable.
pub fn cwd() Dir {
if (builtin.os.tag == .windows) {
return Dir{ .fd = os.windows.peb().ProcessParameters.CurrentDirectory.Handle };
} else if (builtin.os.tag == .wasi) {
@compileError("WASI doesn't have a concept of cwd(); use std.fs.wasi.PreopenList to get available Dir handles instead");
} else {
return Dir{ .fd = os.AT_FDCWD };
}
}
/// Opens a file for reading or writing, without attempting to create a new file, based on an absolute path.
/// Call `File.close` to release the resource.
/// Asserts that the path is absolute. See `Dir.openFile` for a function that
/// operates on both absolute and relative paths.
/// Asserts that the path parameter has no null bytes. See `openFileAbsoluteC` for a function
/// that accepts a null-terminated path.
pub fn openFileAbsolute(absolute_path: []const u8, flags: File.OpenFlags) File.OpenError!File {
assert(path.isAbsolute(absolute_path));
return cwd().openFile(absolute_path, flags);
}
pub const openFileAbsoluteC = @compileError("deprecated: renamed to openFileAbsoluteZ");
/// Same as `openFileAbsolute` but the path parameter is null-terminated.
pub fn openFileAbsoluteZ(absolute_path_c: [*:0]const u8, flags: File.OpenFlags) File.OpenError!File {
assert(path.isAbsoluteZ(absolute_path_c));
return cwd().openFileZ(absolute_path_c, flags);
}
/// Same as `openFileAbsolute` but the path parameter is WTF-16 encoded.
pub fn openFileAbsoluteW(absolute_path_w: []const u16, flags: File.OpenFlags) File.OpenError!File {
assert(path.isAbsoluteWindowsWTF16(absolute_path_w));
return cwd().openFileW(absolute_path_w, flags);
}
/// Creates, opens, or overwrites a file with write access, based on an absolute path.
/// Call `File.close` to release the resource.
/// Asserts that the path is absolute. See `Dir.createFile` for a function that
/// operates on both absolute and relative paths.
/// Asserts that the path parameter has no null bytes. See `createFileAbsoluteC` for a function
/// that accepts a null-terminated path.
pub fn createFileAbsolute(absolute_path: []const u8, flags: File.CreateFlags) File.OpenError!File {
assert(path.isAbsolute(absolute_path));
return cwd().createFile(absolute_path, flags);
}
pub const createFileAbsoluteC = @compileError("deprecated: renamed to createFileAbsoluteZ");
/// Same as `createFileAbsolute` but the path parameter is null-terminated.
pub fn createFileAbsoluteZ(absolute_path_c: [*:0]const u8, flags: File.CreateFlags) File.OpenError!File {
assert(path.isAbsoluteZ(absolute_path_c));
return cwd().createFileZ(absolute_path_c, flags);
}
/// Same as `createFileAbsolute` but the path parameter is WTF-16 encoded.
pub fn createFileAbsoluteW(absolute_path_w: [*:0]const u16, flags: File.CreateFlags) File.OpenError!File {
assert(path.isAbsoluteWindowsW(absolute_path_w));
return cwd().createFileW(absolute_path_w, flags);
}
/// Delete a file name and possibly the file it refers to, based on an absolute path.
/// Asserts that the path is absolute. See `Dir.deleteFile` for a function that
/// operates on both absolute and relative paths.
/// Asserts that the path parameter has no null bytes.
pub fn deleteFileAbsolute(absolute_path: []const u8) Dir.DeleteFileError!void {
assert(path.isAbsolute(absolute_path));
return cwd().deleteFile(absolute_path);
}
pub const deleteFileAbsoluteC = @compileError("deprecated: renamed to deleteFileAbsoluteZ");
/// Same as `deleteFileAbsolute` except the parameter is null-terminated.
pub fn deleteFileAbsoluteZ(absolute_path_c: [*:0]const u8) Dir.DeleteFileError!void {
assert(path.isAbsoluteZ(absolute_path_c));
return cwd().deleteFileZ(absolute_path_c);
}
/// Same as `deleteFileAbsolute` except the parameter is WTF-16 encoded.
pub fn deleteFileAbsoluteW(absolute_path_w: [*:0]const u16) Dir.DeleteFileError!void {
assert(path.isAbsoluteWindowsW(absolute_path_w));
return cwd().deleteFileW(absolute_path_w);
}
/// Removes a symlink, file, or directory.
/// This is equivalent to `Dir.deleteTree` with the base directory.
/// Asserts that the path is absolute. See `Dir.deleteTree` for a function that
/// operates on both absolute and relative paths.
/// Asserts that the path parameter has no null bytes.
pub fn deleteTreeAbsolute(absolute_path: []const u8) !void {
assert(path.isAbsolute(absolute_path));
const dirname = path.dirname(absolute_path) orelse return error{
/// Attempt to remove the root file system path.
/// This error is unreachable if `absolute_path` is relative.
CannotDeleteRootDirectory,
}.CannotDeleteRootDirectory;
var dir = try cwd().openDir(dirname, .{});
defer dir.close();
return dir.deleteTree(path.basename(absolute_path));
}
/// Same as `Dir.readLink`, except it asserts the path is absolute.
pub fn readLinkAbsolute(pathname: []const u8, buffer: *[MAX_PATH_BYTES]u8) ![]u8 {
assert(path.isAbsolute(pathname));
return os.readlink(pathname, buffer);
}
/// Windows-only. Same as `readlinkW`, except the path parameter is null-terminated, WTF16
/// encoded.
pub fn readlinkAbsoluteW(pathname_w: [*:0]const u16, buffer: *[MAX_PATH_BYTES]u8) ![]u8 {
assert(path.isAbsoluteWindowsW(pathname_w));
return os.readlinkW(pathname_w, buffer);
}
/// Same as `readLink`, except the path parameter is null-terminated.
pub fn readLinkAbsoluteZ(pathname_c: [*:0]const u8, buffer: *[MAX_PATH_BYTES]u8) ![]u8 {
assert(path.isAbsoluteZ(pathname_c));
return os.readlinkZ(pathname_c, buffer);
}
pub const readLink = @compileError("deprecated; use Dir.readLink or readLinkAbsolute");
pub const readLinkC = @compileError("deprecated; use Dir.readLinkZ or readLinkAbsoluteZ");
/// Use with `Dir.symLink` and `symLinkAbsolute` to specify whether the symlink
/// will point to a file or a directory. This value is ignored on all hosts
/// except Windows where creating symlinks to different resource types, requires
/// different flags. By default, `symLinkAbsolute` is assumed to point to a file.
pub const SymLinkFlags = struct {
is_directory: bool = false,
};
/// Creates a symbolic link named `sym_link_path` which contains the string `target_path`.
/// A symbolic link (also known as a soft link) may point to an existing file or to a nonexistent
/// one; the latter case is known as a dangling link.
/// If `sym_link_path` exists, it will not be overwritten.
/// See also `symLinkAbsoluteZ` and `symLinkAbsoluteW`.
pub fn symLinkAbsolute(target_path: []const u8, sym_link_path: []const u8, flags: SymLinkFlags) !void {
if (builtin.os.tag == .wasi) {
@compileError("symLinkAbsolute is not supported in WASI; use Dir.symLinkWasi instead");
}
assert(path.isAbsolute(target_path));
assert(path.isAbsolute(sym_link_path));
if (builtin.os.tag == .windows) {
const target_path_w = try os.windows.sliceToPrefixedFileW(target_path);
const sym_link_path_w = try os.windows.sliceToPrefixedFileW(sym_link_path);
return os.windows.CreateSymbolicLink(null, sym_link_path_w.span(), target_path_w.span(), flags.is_directory);
}
return os.symlink(target_path, sym_link_path);
}
/// Windows-only. Same as `symLinkAbsolute` except the parameters are null-terminated, WTF16 encoded.
/// Note that this function will by default try creating a symbolic link to a file. If you would
/// like to create a symbolic link to a directory, specify this with `SymLinkFlags{ .is_directory = true }`.
/// See also `symLinkAbsolute`, `symLinkAbsoluteZ`.
pub fn symLinkAbsoluteW(target_path_w: []const u16, sym_link_path_w: []const u16, flags: SymLinkFlags) !void {
assert(path.isAbsoluteWindowsWTF16(target_path_w));
assert(path.isAbsoluteWindowsWTF16(sym_link_path_w));
return os.windows.CreateSymbolicLink(null, sym_link_path_w, target_path_w, flags.is_directory);
}
/// Same as `symLinkAbsolute` except the parameters are null-terminated pointers.
/// See also `symLinkAbsolute`.
pub fn symLinkAbsoluteZ(target_path_c: [*:0]const u8, sym_link_path_c: [*:0]const u8, flags: SymLinkFlags) !void {
assert(path.isAbsoluteZ(target_path_c));
assert(path.isAbsoluteZ(sym_link_path_c));
if (builtin.os.tag == .windows) {
const target_path_w = try os.windows.cStrToWin32PrefixedFileW(target_path_c);
const sym_link_path_w = try os.windows.cStrToWin32PrefixedFileW(sym_link_path_c);
return os.windows.CreateSymbolicLink(sym_link_path_w.span(), target_path_w.span(), flags.is_directory);
}
return os.symlinkZ(target_path_c, sym_link_path_c);
}
pub const symLink = @compileError("deprecated: use Dir.symLink or symLinkAbsolute");
pub const symLinkC = @compileError("deprecated: use Dir.symLinkZ or symLinkAbsoluteZ");
pub const Walker = struct {
stack: std.ArrayList(StackItem),
name_buffer: std.ArrayList(u8),
pub const Entry = struct {
/// The containing directory. This can be used to operate directly on `basename`
/// rather than `path`, avoiding `error.NameTooLong` for deeply nested paths.
/// The directory remains open until `next` or `deinit` is called.
dir: Dir,
/// TODO make this null terminated for API convenience
basename: []const u8,
path: []const u8,
kind: Dir.Entry.Kind,
};
const StackItem = struct {
dir_it: Dir.Iterator,
dirname_len: usize,
};
/// After each call to this function, and on deinit(), the memory returned
/// from this function becomes invalid. A copy must be made in order to keep
/// a reference to the path.
pub fn next(self: *Walker) !?Entry {
while (true) {
if (self.stack.items.len == 0) return null;
// `top` becomes invalid after appending to `self.stack`.
const top = &self.stack.span()[self.stack.items.len - 1];
const dirname_len = top.dirname_len;
if (try top.dir_it.next()) |base| {
self.name_buffer.shrink(dirname_len);
try self.name_buffer.append(path.sep);
try self.name_buffer.appendSlice(base.name);
if (base.kind == .Directory) {
var new_dir = top.dir_it.dir.openDir(base.name, .{ .iterate = true }) catch |err| switch (err) {
error.NameTooLong => unreachable, // no path sep in base.name
else => |e| return e,
};
{
errdefer new_dir.close();
try self.stack.append(StackItem{
.dir_it = new_dir.iterate(),
.dirname_len = self.name_buffer.items.len,
});
}
}
return Entry{
.dir = top.dir_it.dir,
.basename = self.name_buffer.span()[dirname_len + 1 ..],
.path = self.name_buffer.span(),
.kind = base.kind,
};
} else {
self.stack.pop().dir_it.dir.close();
}
}
}
pub fn deinit(self: *Walker) void {
while (self.stack.popOrNull()) |*item| item.dir_it.dir.close();
self.stack.deinit();
self.name_buffer.deinit();
}
};
/// Recursively iterates over a directory.
/// Must call `Walker.deinit` when done.
/// `dir_path` must not end in a path separator.
/// The order of returned file system entries is undefined.
pub fn walkPath(allocator: *Allocator, dir_path: []const u8) !Walker {
assert(!mem.endsWith(u8, dir_path, path.sep_str));
var dir = try cwd().openDir(dir_path, .{ .iterate = true });
errdefer dir.close();
var name_buffer = std.ArrayList(u8).init(allocator);
errdefer name_buffer.deinit();
try name_buffer.appendSlice(dir_path);
var walker = Walker{
.stack = std.ArrayList(Walker.StackItem).init(allocator),
.name_buffer = name_buffer,
};
try walker.stack.append(Walker.StackItem{
.dir_it = dir.iterate(),
.dirname_len = dir_path.len,
});
return walker;
}
pub const OpenSelfExeError = error{
SharingViolation,
PathAlreadyExists,
FileNotFound,
AccessDenied,
PipeBusy,
NameTooLong,
/// On Windows, file paths must be valid Unicode.
InvalidUtf8,
/// On Windows, file paths cannot contain these characters:
/// '/', '*', '?', '"', '<', '>', '|'
BadPathName,
Unexpected,
} || os.OpenError || SelfExePathError || os.FlockError;
pub fn openSelfExe(flags: File.OpenFlags) OpenSelfExeError!File {
if (builtin.os.tag == .linux) {
return openFileAbsoluteZ("/proc/self/exe", flags);
}
if (builtin.os.tag == .windows) {
const wide_slice = selfExePathW();
const prefixed_path_w = try os.windows.wToPrefixedFileW(wide_slice);
return cwd().openFileW(prefixed_path_w.span(), flags);
}
// Use of MAX_PATH_BYTES here is valid as the resulting path is immediately
// opened with no modification.
var buf: [MAX_PATH_BYTES]u8 = undefined;
const self_exe_path = try selfExePath(&buf);
buf[self_exe_path.len] = 0;
return openFileAbsoluteZ(buf[0..self_exe_path.len :0].ptr, flags);
}
pub const SelfExePathError = os.ReadLinkError || os.SysCtlError;
/// `selfExePath` except allocates the result on the heap.
/// Caller owns returned memory.
pub fn selfExePathAlloc(allocator: *Allocator) ![]u8 {
// Use of MAX_PATH_BYTES here is justified as, at least on one tested Linux
// system, readlink will completely fail to return a result larger than
// PATH_MAX even if given a sufficiently large buffer. This makes it
// fundamentally impossible to get the selfExePath of a program running in
// a very deeply nested directory chain in this way.
// TODO(#4812): Investigate other systems and whether it is possible to get
// this path by trying larger and larger buffers until one succeeds.
var buf: [MAX_PATH_BYTES]u8 = undefined;
return allocator.dupe(u8, try selfExePath(&buf));
}
/// Get the path to the current executable.
/// If you only need the directory, use selfExeDirPath.
/// If you only want an open file handle, use openSelfExe.
/// This function may return an error if the current executable
/// was deleted after spawning.
/// Returned value is a slice of out_buffer.
///
/// On Linux, depends on procfs being mounted. If the currently executing binary has
/// been deleted, the file path looks something like `/a/b/c/exe (deleted)`.
/// TODO make the return type of this a null terminated pointer
pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
if (is_darwin) {
var u32_len: u32 = @intCast(u32, math.min(out_buffer.len, math.maxInt(u32)));
const rc = std.c._NSGetExecutablePath(out_buffer.ptr, &u32_len);
if (rc != 0) return error.NameTooLong;
return mem.spanZ(@ptrCast([*:0]u8, out_buffer));
}
switch (builtin.os.tag) {
.linux => return os.readlinkZ("/proc/self/exe", out_buffer),
.freebsd, .dragonfly => {
var mib = [4]c_int{ os.CTL_KERN, os.KERN_PROC, os.KERN_PROC_PATHNAME, -1 };
var out_len: usize = out_buffer.len;
try os.sysctl(&mib, out_buffer.ptr, &out_len, null, 0);
// TODO could this slice from 0 to out_len instead?
return mem.spanZ(@ptrCast([*:0]u8, out_buffer));
},
.netbsd => {
var mib = [4]c_int{ os.CTL_KERN, os.KERN_PROC_ARGS, -1, os.KERN_PROC_PATHNAME };
var out_len: usize = out_buffer.len;
try os.sysctl(&mib, out_buffer.ptr, &out_len, null, 0);
// TODO could this slice from 0 to out_len instead?
return mem.spanZ(@ptrCast([*:0]u8, out_buffer));
},
.windows => {
const utf16le_slice = selfExePathW();
// Trust that Windows gives us valid UTF-16LE.
const end_index = std.unicode.utf16leToUtf8(out_buffer, utf16le_slice) catch unreachable;
return out_buffer[0..end_index];
},
else => @compileError("std.fs.selfExePath not supported for this target"),
}
}
/// The result is UTF16LE-encoded.
pub fn selfExePathW() [:0]const u16 {
const image_path_name = &os.windows.peb().ProcessParameters.ImagePathName;
return mem.spanZ(@ptrCast([*:0]const u16, image_path_name.Buffer));
}
/// `selfExeDirPath` except allocates the result on the heap.
/// Caller owns returned memory.
pub fn selfExeDirPathAlloc(allocator: *Allocator) ![]u8 {
// Use of MAX_PATH_BYTES here is justified as, at least on one tested Linux
// system, readlink will completely fail to return a result larger than
// PATH_MAX even if given a sufficiently large buffer. This makes it
// fundamentally impossible to get the selfExeDirPath of a program running
// in a very deeply nested directory chain in this way.
// TODO(#4812): Investigate other systems and whether it is possible to get
// this path by trying larger and larger buffers until one succeeds.
var buf: [MAX_PATH_BYTES]u8 = undefined;
return allocator.dupe(u8, try selfExeDirPath(&buf));
}
/// Get the directory path that contains the current executable.
/// Returned value is a slice of out_buffer.
pub fn selfExeDirPath(out_buffer: []u8) SelfExePathError![]const u8 {
const self_exe_path = try selfExePath(out_buffer);
// Assume that the OS APIs return absolute paths, and therefore dirname
// will not return null.
return path.dirname(self_exe_path).?;
}
/// `realpath`, except caller must free the returned memory.
/// See also `Dir.realpath`.
pub fn realpathAlloc(allocator: *Allocator, pathname: []const u8) ![]u8 {
// Use of MAX_PATH_BYTES here is valid as the realpath function does not
// have a variant that takes an arbitrary-size buffer.
// TODO(#4812): Consider reimplementing realpath or using the POSIX.1-2008
// NULL out parameter (GNU's canonicalize_file_name) to handle overelong
// paths. musl supports passing NULL but restricts the output to PATH_MAX
// anyway.
var buf: [MAX_PATH_BYTES]u8 = undefined;
return allocator.dupe(u8, try os.realpath(pathname, &buf));
}
test "" {
if (builtin.os.tag != .wasi) {
_ = makeDirAbsolute;
_ = makeDirAbsoluteZ;
_ = copyFileAbsolute;
_ = updateFileAbsolute;
}
_ = Dir.copyFile;
_ = @import("fs/test.zig");
_ = @import("fs/path.zig");
_ = @import("fs/file.zig");
_ = @import("fs/get_app_data_dir.zig");
_ = @import("fs/watch.zig");
} | lib/std/fs.zig |
const std = @import("std");
const mem = std.mem;
const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const Module = @import("../Module.zig");
const fs = std.fs;
const codegen = @import("../codegen/c.zig");
const link = @import("../link.zig");
const File = link.File;
const C = @This();
pub const base_tag: File.Tag = .c;
base: File,
header: std.ArrayList(u8),
constants: std.ArrayList(u8),
main: std.ArrayList(u8),
called: std.StringHashMap(void),
need_stddef: bool = false,
need_stdint: bool = false,
error_msg: *Module.ErrorMsg = undefined,
pub fn openPath(allocator: *Allocator, dir: fs.Dir, sub_path: []const u8, options: link.Options) !*File {
assert(options.object_format == .c);
const file = try dir.createFile(sub_path, .{ .truncate = true, .read = true, .mode = link.determineMode(options) });
errdefer file.close();
var c_file = try allocator.create(C);
errdefer allocator.destroy(c_file);
c_file.* = C{
.base = .{
.tag = .c,
.options = options,
.file = file,
.allocator = allocator,
},
.main = std.ArrayList(u8).init(allocator),
.header = std.ArrayList(u8).init(allocator),
.constants = std.ArrayList(u8).init(allocator),
.called = std.StringHashMap(void).init(allocator),
};
return &c_file.base;
}
pub fn fail(self: *C, src: usize, comptime format: []const u8, args: anytype) error{ AnalysisFail, OutOfMemory } {
self.error_msg = try Module.ErrorMsg.create(self.base.allocator, src, format, args);
return error.AnalysisFail;
}
pub fn deinit(self: *C) void {
self.main.deinit();
self.header.deinit();
self.constants.deinit();
self.called.deinit();
}
pub fn updateDecl(self: *C, module: *Module, decl: *Module.Decl) !void {
codegen.generate(self, decl) catch |err| {
if (err == error.AnalysisFail) {
try module.failed_decls.put(module.gpa, decl, self.error_msg);
}
return err;
};
}
pub fn flush(self: *C, module: *Module) !void {
const writer = self.base.file.?.writer();
try writer.writeAll(@embedFile("cbe.h"));
var includes = false;
if (self.need_stddef) {
try writer.writeAll("#include <stddef.h>\n");
includes = true;
}
if (self.need_stdint) {
try writer.writeAll("#include <stdint.h>\n");
includes = true;
}
if (includes) {
try writer.writeByte('\n');
}
if (self.header.items.len > 0) {
try writer.print("{}\n", .{self.header.items});
}
if (self.constants.items.len > 0) {
try writer.print("{}\n", .{self.constants.items});
}
if (self.main.items.len > 1) {
const last_two = self.main.items[self.main.items.len - 2 ..];
if (std.mem.eql(u8, last_two, "\n\n")) {
self.main.items.len -= 1;
}
}
try writer.writeAll(self.main.items);
self.base.file.?.close();
self.base.file = null;
} | src-self-hosted/link/C.zig |
const std = @import("../../std.zig");
const math = std.math;
const mem = std.mem;
const BlockVec = [4]u32;
/// A single AES block.
pub const Block = struct {
pub const block_length: usize = 16;
/// Internal representation of a block.
repr: BlockVec align(16),
/// Convert a byte sequence into an internal representation.
pub inline fn fromBytes(bytes: *const [16]u8) Block {
const s0 = mem.readIntBig(u32, bytes[0..4]);
const s1 = mem.readIntBig(u32, bytes[4..8]);
const s2 = mem.readIntBig(u32, bytes[8..12]);
const s3 = mem.readIntBig(u32, bytes[12..16]);
return Block{ .repr = BlockVec{ s0, s1, s2, s3 } };
}
/// Convert the internal representation of a block into a byte sequence.
pub inline fn toBytes(block: Block) [16]u8 {
var bytes: [16]u8 = undefined;
mem.writeIntBig(u32, bytes[0..4], block.repr[0]);
mem.writeIntBig(u32, bytes[4..8], block.repr[1]);
mem.writeIntBig(u32, bytes[8..12], block.repr[2]);
mem.writeIntBig(u32, bytes[12..16], block.repr[3]);
return bytes;
}
/// XOR the block with a byte sequence.
pub inline fn xorBytes(block: Block, bytes: *const [16]u8) [16]u8 {
const block_bytes = block.toBytes();
var x: [16]u8 = undefined;
comptime var i: usize = 0;
inline while (i < 16) : (i += 1) {
x[i] = block_bytes[i] ^ bytes[i];
}
return x;
}
/// Encrypt a block with a round key.
pub inline fn encrypt(block: Block, round_key: Block) Block {
const s0 = block.repr[0];
const s1 = block.repr[1];
const s2 = block.repr[2];
const s3 = block.repr[3];
const t0 = round_key.repr[0] ^ table_encrypt[0][@truncate(u8, s0 >> 24)] ^ table_encrypt[1][@truncate(u8, s1 >> 16)] ^ table_encrypt[2][@truncate(u8, s2 >> 8)] ^ table_encrypt[3][@truncate(u8, s3)];
const t1 = round_key.repr[1] ^ table_encrypt[0][@truncate(u8, s1 >> 24)] ^ table_encrypt[1][@truncate(u8, s2 >> 16)] ^ table_encrypt[2][@truncate(u8, s3 >> 8)] ^ table_encrypt[3][@truncate(u8, s0)];
const t2 = round_key.repr[2] ^ table_encrypt[0][@truncate(u8, s2 >> 24)] ^ table_encrypt[1][@truncate(u8, s3 >> 16)] ^ table_encrypt[2][@truncate(u8, s0 >> 8)] ^ table_encrypt[3][@truncate(u8, s1)];
const t3 = round_key.repr[3] ^ table_encrypt[0][@truncate(u8, s3 >> 24)] ^ table_encrypt[1][@truncate(u8, s0 >> 16)] ^ table_encrypt[2][@truncate(u8, s1 >> 8)] ^ table_encrypt[3][@truncate(u8, s2)];
return Block{ .repr = BlockVec{ t0, t1, t2, t3 } };
}
/// Encrypt a block with the last round key.
pub inline fn encryptLast(block: Block, round_key: Block) Block {
const t0 = block.repr[0];
const t1 = block.repr[1];
const t2 = block.repr[2];
const t3 = block.repr[3];
// Last round uses s-box directly and XORs to produce output.
var s0 = @as(u32, sbox_encrypt[t0 >> 24]) << 24 | @as(u32, sbox_encrypt[t1 >> 16 & 0xff]) << 16 | @as(u32, sbox_encrypt[t2 >> 8 & 0xff]) << 8 | @as(u32, sbox_encrypt[t3 & 0xff]);
var s1 = @as(u32, sbox_encrypt[t1 >> 24]) << 24 | @as(u32, sbox_encrypt[t2 >> 16 & 0xff]) << 16 | @as(u32, sbox_encrypt[t3 >> 8 & 0xff]) << 8 | @as(u32, sbox_encrypt[t0 & 0xff]);
var s2 = @as(u32, sbox_encrypt[t2 >> 24]) << 24 | @as(u32, sbox_encrypt[t3 >> 16 & 0xff]) << 16 | @as(u32, sbox_encrypt[t0 >> 8 & 0xff]) << 8 | @as(u32, sbox_encrypt[t1 & 0xff]);
var s3 = @as(u32, sbox_encrypt[t3 >> 24]) << 24 | @as(u32, sbox_encrypt[t0 >> 16 & 0xff]) << 16 | @as(u32, sbox_encrypt[t1 >> 8 & 0xff]) << 8 | @as(u32, sbox_encrypt[t2 & 0xff]);
s0 ^= round_key.repr[0];
s1 ^= round_key.repr[1];
s2 ^= round_key.repr[2];
s3 ^= round_key.repr[3];
return Block{ .repr = BlockVec{ s0, s1, s2, s3 } };
}
/// Decrypt a block with a round key.
pub inline fn decrypt(block: Block, round_key: Block) Block {
const s0 = block.repr[0];
const s1 = block.repr[1];
const s2 = block.repr[2];
const s3 = block.repr[3];
const t0 = round_key.repr[0] ^ table_decrypt[0][@truncate(u8, s0 >> 24)] ^ table_decrypt[1][@truncate(u8, s3 >> 16)] ^ table_decrypt[2][@truncate(u8, s2 >> 8)] ^ table_decrypt[3][@truncate(u8, s1)];
const t1 = round_key.repr[1] ^ table_decrypt[0][@truncate(u8, s1 >> 24)] ^ table_decrypt[1][@truncate(u8, s0 >> 16)] ^ table_decrypt[2][@truncate(u8, s3 >> 8)] ^ table_decrypt[3][@truncate(u8, s2)];
const t2 = round_key.repr[2] ^ table_decrypt[0][@truncate(u8, s2 >> 24)] ^ table_decrypt[1][@truncate(u8, s1 >> 16)] ^ table_decrypt[2][@truncate(u8, s0 >> 8)] ^ table_decrypt[3][@truncate(u8, s3)];
const t3 = round_key.repr[3] ^ table_decrypt[0][@truncate(u8, s3 >> 24)] ^ table_decrypt[1][@truncate(u8, s2 >> 16)] ^ table_decrypt[2][@truncate(u8, s1 >> 8)] ^ table_decrypt[3][@truncate(u8, s0)];
return Block{ .repr = BlockVec{ t0, t1, t2, t3 } };
}
/// Decrypt a block with the last round key.
pub inline fn decryptLast(block: Block, round_key: Block) Block {
const t0 = block.repr[0];
const t1 = block.repr[1];
const t2 = block.repr[2];
const t3 = block.repr[3];
// Last round uses s-box directly and XORs to produce output.
var s0 = @as(u32, sbox_decrypt[t0 >> 24]) << 24 | @as(u32, sbox_decrypt[t3 >> 16 & 0xff]) << 16 | @as(u32, sbox_decrypt[t2 >> 8 & 0xff]) << 8 | @as(u32, sbox_decrypt[t1 & 0xff]);
var s1 = @as(u32, sbox_decrypt[t1 >> 24]) << 24 | @as(u32, sbox_decrypt[t0 >> 16 & 0xff]) << 16 | @as(u32, sbox_decrypt[t3 >> 8 & 0xff]) << 8 | @as(u32, sbox_decrypt[t2 & 0xff]);
var s2 = @as(u32, sbox_decrypt[t2 >> 24]) << 24 | @as(u32, sbox_decrypt[t1 >> 16 & 0xff]) << 16 | @as(u32, sbox_decrypt[t0 >> 8 & 0xff]) << 8 | @as(u32, sbox_decrypt[t3 & 0xff]);
var s3 = @as(u32, sbox_decrypt[t3 >> 24]) << 24 | @as(u32, sbox_decrypt[t2 >> 16 & 0xff]) << 16 | @as(u32, sbox_decrypt[t1 >> 8 & 0xff]) << 8 | @as(u32, sbox_decrypt[t0 & 0xff]);
s0 ^= round_key.repr[0];
s1 ^= round_key.repr[1];
s2 ^= round_key.repr[2];
s3 ^= round_key.repr[3];
return Block{ .repr = BlockVec{ s0, s1, s2, s3 } };
}
/// Apply the bitwise XOR operation to the content of two blocks.
pub inline fn xorBlocks(block1: Block, block2: Block) Block {
var x: BlockVec = undefined;
comptime var i = 0;
inline while (i < 4) : (i += 1) {
x[i] = block1.repr[i] ^ block2.repr[i];
}
return Block{ .repr = x };
}
/// Apply the bitwise AND operation to the content of two blocks.
pub inline fn andBlocks(block1: Block, block2: Block) Block {
var x: BlockVec = undefined;
comptime var i = 0;
inline while (i < 4) : (i += 1) {
x[i] = block1.repr[i] & block2.repr[i];
}
return Block{ .repr = x };
}
/// Apply the bitwise OR operation to the content of two blocks.
pub inline fn orBlocks(block1: Block, block2: Block) Block {
var x: BlockVec = undefined;
comptime var i = 0;
inline while (i < 4) : (i += 1) {
x[i] = block1.repr[i] | block2.repr[i];
}
return Block{ .repr = x };
}
/// Perform operations on multiple blocks in parallel.
pub const parallel = struct {
/// The recommended number of AES encryption/decryption to perform in parallel for the chosen implementation.
pub const optimal_parallel_blocks = 1;
/// Encrypt multiple blocks in parallel, each their own round key.
pub fn encryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block {
var i = 0;
var out: [count]Block = undefined;
while (i < count) : (i += 1) {
out[i] = blocks[i].encrypt(round_keys[i]);
}
return out;
}
/// Decrypt multiple blocks in parallel, each their own round key.
pub fn decryptParallel(comptime count: usize, blocks: [count]Block, round_keys: [count]Block) [count]Block {
var i = 0;
var out: [count]Block = undefined;
while (i < count) : (i += 1) {
out[i] = blocks[i].decrypt(round_keys[i]);
}
return out;
}
/// Encrypt multiple blocks in parallel with the same round key.
pub fn encryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
var i = 0;
var out: [count]Block = undefined;
while (i < count) : (i += 1) {
out[i] = blocks[i].encrypt(round_key);
}
return out;
}
/// Decrypt multiple blocks in parallel with the same round key.
pub fn decryptWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
var i = 0;
var out: [count]Block = undefined;
while (i < count) : (i += 1) {
out[i] = blocks[i].decrypt(round_key);
}
return out;
}
/// Encrypt multiple blocks in parallel with the same last round key.
pub fn encryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
var i = 0;
var out: [count]Block = undefined;
while (i < count) : (i += 1) {
out[i] = blocks[i].encryptLast(round_key);
}
return out;
}
/// Decrypt multiple blocks in parallel with the same last round key.
pub fn decryptLastWide(comptime count: usize, blocks: [count]Block, round_key: Block) [count]Block {
var i = 0;
var out: [count]Block = undefined;
while (i < count) : (i += 1) {
out[i] = blocks[i].decryptLast(round_key);
}
return out;
}
};
};
fn KeySchedule(comptime Aes: type) type {
std.debug.assert(Aes.rounds == 10 or Aes.rounds == 14);
const key_length = Aes.key_bits / 8;
const rounds = Aes.rounds;
return struct {
const Self = @This();
const words_in_key = key_length / 4;
round_keys: [rounds + 1]Block,
// Key expansion algorithm. See FIPS-197, Figure 11.
fn expandKey(key: [key_length]u8) Self {
const subw = struct {
// Apply sbox_encrypt to each byte in w.
fn func(w: u32) u32 {
return @as(u32, sbox_encrypt[w >> 24]) << 24 | @as(u32, sbox_encrypt[w >> 16 & 0xff]) << 16 | @as(u32, sbox_encrypt[w >> 8 & 0xff]) << 8 | @as(u32, sbox_encrypt[w & 0xff]);
}
}.func;
var round_keys: [rounds + 1]Block = undefined;
comptime var i: usize = 0;
inline while (i < words_in_key) : (i += 1) {
round_keys[i / 4].repr[i % 4] = mem.readIntBig(u32, key[4 * i ..][0..4]);
}
inline while (i < round_keys.len * 4) : (i += 1) {
var t = round_keys[(i - 1) / 4].repr[(i - 1) % 4];
if (i % words_in_key == 0) {
t = subw(std.math.rotl(u32, t, 8)) ^ (@as(u32, powx[i / words_in_key - 1]) << 24);
} else if (words_in_key > 6 and i % words_in_key == 4) {
t = subw(t);
}
round_keys[i / 4].repr[i % 4] = round_keys[(i - words_in_key) / 4].repr[(i - words_in_key) % 4] ^ t;
}
return Self{ .round_keys = round_keys };
}
/// Invert the key schedule.
pub fn invert(key_schedule: Self) Self {
const round_keys = &key_schedule.round_keys;
var inv_round_keys: [rounds + 1]Block = undefined;
const total_words = 4 * round_keys.len;
var i: usize = 0;
while (i < total_words) : (i += 4) {
const ei = total_words - i - 4;
comptime var j: usize = 0;
inline while (j < 4) : (j += 1) {
var x = round_keys[(ei + j) / 4].repr[(ei + j) % 4];
if (i > 0 and i + 4 < total_words) {
x = table_decrypt[0][sbox_encrypt[x >> 24]] ^ table_decrypt[1][sbox_encrypt[x >> 16 & 0xff]] ^ table_decrypt[2][sbox_encrypt[x >> 8 & 0xff]] ^ table_decrypt[3][sbox_encrypt[x & 0xff]];
}
inv_round_keys[(i + j) / 4].repr[(i + j) % 4] = x;
}
}
return Self{ .round_keys = inv_round_keys };
}
};
}
/// A context to perform encryption using the standard AES key schedule.
pub fn AesEncryptCtx(comptime Aes: type) type {
std.debug.assert(Aes.key_bits == 128 or Aes.key_bits == 256);
const rounds = Aes.rounds;
return struct {
const Self = @This();
pub const block = Aes.block;
pub const block_length = block.block_length;
key_schedule: KeySchedule(Aes),
/// Create a new encryption context with the given key.
pub fn init(key: [Aes.key_bits / 8]u8) Self {
const key_schedule = KeySchedule(Aes).expandKey(key);
return Self{
.key_schedule = key_schedule,
};
}
/// Encrypt a single block.
pub fn encrypt(ctx: Self, dst: *[16]u8, src: *const [16]u8) void {
const round_keys = ctx.key_schedule.round_keys;
var t = Block.fromBytes(src).xorBlocks(round_keys[0]);
comptime var i = 1;
inline while (i < rounds) : (i += 1) {
t = t.encrypt(round_keys[i]);
}
t = t.encryptLast(round_keys[rounds]);
dst.* = t.toBytes();
}
/// Encrypt+XOR a single block.
pub fn xor(ctx: Self, dst: *[16]u8, src: *const [16]u8, counter: [16]u8) void {
const round_keys = ctx.key_schedule.round_keys;
var t = Block.fromBytes(&counter).xorBlocks(round_keys[0]);
comptime var i = 1;
inline while (i < rounds) : (i += 1) {
t = t.encrypt(round_keys[i]);
}
t = t.encryptLast(round_keys[rounds]);
dst.* = t.xorBytes(src);
}
/// Encrypt multiple blocks, possibly leveraging parallelization.
pub fn encryptWide(ctx: Self, comptime count: usize, dst: *[16 * count]u8, src: *const [16 * count]u8) void {
var i: usize = 0;
while (i < count) : (i += 1) {
ctx.encrypt(dst[16 * i .. 16 * i + 16][0..16], src[16 * i .. 16 * i + 16][0..16]);
}
}
/// Encrypt+XOR multiple blocks, possibly leveraging parallelization.
pub fn xorWide(ctx: Self, comptime count: usize, dst: *[16 * count]u8, src: *const [16 * count]u8, counters: [16 * count]u8) void {
var i: usize = 0;
while (i < count) : (i += 1) {
ctx.xor(dst[16 * i .. 16 * i + 16][0..16], src[16 * i .. 16 * i + 16][0..16], counters[16 * i .. 16 * i + 16][0..16].*);
}
}
};
}
/// A context to perform decryption using the standard AES key schedule.
pub fn AesDecryptCtx(comptime Aes: type) type {
std.debug.assert(Aes.key_bits == 128 or Aes.key_bits == 256);
const rounds = Aes.rounds;
return struct {
const Self = @This();
pub const block = Aes.block;
pub const block_length = block.block_length;
key_schedule: KeySchedule(Aes),
/// Create a decryption context from an existing encryption context.
pub fn initFromEnc(ctx: AesEncryptCtx(Aes)) Self {
return Self{
.key_schedule = ctx.key_schedule.invert(),
};
}
/// Create a new decryption context with the given key.
pub fn init(key: [Aes.key_bits / 8]u8) Self {
const enc_ctx = AesEncryptCtx(Aes).init(key);
return initFromEnc(enc_ctx);
}
/// Decrypt a single block.
pub fn decrypt(ctx: Self, dst: *[16]u8, src: *const [16]u8) void {
const inv_round_keys = ctx.key_schedule.round_keys;
var t = Block.fromBytes(src).xorBlocks(inv_round_keys[0]);
comptime var i = 1;
inline while (i < rounds) : (i += 1) {
t = t.decrypt(inv_round_keys[i]);
}
t = t.decryptLast(inv_round_keys[rounds]);
dst.* = t.toBytes();
}
/// Decrypt multiple blocks, possibly leveraging parallelization.
pub fn decryptWide(ctx: Self, comptime count: usize, dst: *[16 * count]u8, src: *const [16 * count]u8) void {
var i: usize = 0;
while (i < count) : (i += 1) {
ctx.decrypt(dst[16 * i .. 16 * i + 16][0..16], src[16 * i .. 16 * i + 16][0..16]);
}
}
};
}
/// AES-128 with the standard key schedule.
pub const Aes128 = struct {
pub const key_bits: usize = 128;
pub const rounds = ((key_bits - 64) / 32 + 8);
pub const block = Block;
/// Create a new context for encryption.
pub fn initEnc(key: [key_bits / 8]u8) AesEncryptCtx(Aes128) {
return AesEncryptCtx(Aes128).init(key);
}
/// Create a new context for decryption.
pub fn initDec(key: [key_bits / 8]u8) AesDecryptCtx(Aes128) {
return AesDecryptCtx(Aes128).init(key);
}
};
/// AES-256 with the standard key schedule.
pub const Aes256 = struct {
pub const key_bits: usize = 256;
pub const rounds = ((key_bits - 64) / 32 + 8);
pub const block = Block;
/// Create a new context for encryption.
pub fn initEnc(key: [key_bits / 8]u8) AesEncryptCtx(Aes256) {
return AesEncryptCtx(Aes256).init(key);
}
/// Create a new context for decryption.
pub fn initDec(key: [key_bits / 8]u8) AesDecryptCtx(Aes256) {
return AesDecryptCtx(Aes256).init(key);
}
};
// constants
// Rijndael's irreducible polynomial.
const poly: u9 = 1 << 8 | 1 << 4 | 1 << 3 | 1 << 1 | 1 << 0; // x⁸ + x⁴ + x³ + x + 1
// Powers of x mod poly in GF(2).
const powx = init: {
var array: [16]u8 = undefined;
var value = 1;
for (array) |*power| {
power.* = value;
value = mul(value, 2);
}
break :init array;
};
const sbox_encrypt align(64) = generateSbox(false);
const sbox_decrypt align(64) = generateSbox(true);
const table_encrypt align(64) = generateTable(false);
const table_decrypt align(64) = generateTable(true);
// Generate S-box substitution values.
fn generateSbox(invert: bool) [256]u8 {
@setEvalBranchQuota(10000);
var sbox: [256]u8 = undefined;
var p: u8 = 1;
var q: u8 = 1;
for (sbox) |_| {
p = mul(p, 3);
q = mul(q, 0xf6); // divide by 3
var value: u8 = q ^ 0x63;
value ^= math.rotl(u8, q, 1);
value ^= math.rotl(u8, q, 2);
value ^= math.rotl(u8, q, 3);
value ^= math.rotl(u8, q, 4);
if (invert) {
sbox[value] = p;
} else {
sbox[p] = value;
}
}
if (invert) {
sbox[0x63] = 0x00;
} else {
sbox[0x00] = 0x63;
}
return sbox;
}
// Generate lookup tables.
fn generateTable(invert: bool) [4][256]u32 {
var table: [4][256]u32 = undefined;
for (generateSbox(invert)) |value, index| {
table[0][index] = mul(value, if (invert) 0xb else 0x3);
table[0][index] |= math.shl(u32, mul(value, if (invert) 0xd else 0x1), 8);
table[0][index] |= math.shl(u32, mul(value, if (invert) 0x9 else 0x1), 16);
table[0][index] |= math.shl(u32, mul(value, if (invert) 0xe else 0x2), 24);
table[1][index] = math.rotr(u32, table[0][index], 8);
table[2][index] = math.rotr(u32, table[0][index], 16);
table[3][index] = math.rotr(u32, table[0][index], 24);
}
return table;
}
// Multiply a and b as GF(2) polynomials modulo poly.
fn mul(a: u8, b: u8) u8 {
@setEvalBranchQuota(30000);
var i: u9 = a;
var j: u8 = b;
var k: u8 = 1;
var s: u9 = 0;
while (k < 0x100 and j != 0) : (k <<= 1) {
if (j & k != 0) {
s ^= i;
j ^= k;
}
i <<= 1;
if (i & 0x100 != 0) {
i ^= poly;
}
}
return @truncate(u8, s);
} | lib/std/crypto/aes/soft.zig |
const std = @import("std");
const json = std.json;
// JSON Types
pub const String = []const u8;
pub const Integer = i64;
pub const Float = f64;
pub const Bool = bool;
pub const Array = json.Array;
pub const Object = json.ObjectMap;
// pub const Any = @TypeOf(var);
// Basic structures
pub const DocumentUri = String;
pub const Position = struct {
line: Integer,
character: Integer,
};
pub const Range = struct {
start: Position,
end: Position,
};
pub const Location = struct {
uri: DocumentUri, range: Range
};
/// Id of a request
pub const RequestId = union(enum) {
String: String,
Integer: Integer,
Float: Float,
};
/// Params of a request
pub const RequestParams = void;
pub const NotificationParams = union(enum) {
LogMessageParams: LogMessageParams, PublishDiagnosticsParams: PublishDiagnosticsParams, ShowMessageParams: ShowMessageParams
};
/// Hover response
pub const Hover = struct {
contents: MarkupContent,
};
/// Params of a response (result)
pub const ResponseParams = union(enum) {
CompletionList: CompletionList,
Location: Location,
Hover: Hover,
DocumentSymbols: []DocumentSymbol,
SemanticTokensFull: struct { data: []const u32 },
TextEdits: []TextEdit,
Locations: []Location,
WorkspaceEdit: WorkspaceEdit,
};
/// JSONRPC error
pub const Error = struct {
code: Integer,
message: String,
data: String,
};
/// JSONRPC request
pub const Request = struct {
jsonrpc: String = "2.0", method: String, id: ?RequestId = RequestId{ .Integer = 0 }, params: RequestParams
};
/// JSONRPC notifications
pub const Notification = struct {
jsonrpc: String = "2.0", method: String, params: NotificationParams
};
/// JSONRPC response
pub const Response = struct {
jsonrpc: String = "2.0",
// @"error": ?Error = null,
id: RequestId,
result: ResponseParams,
};
/// Type of a debug message
pub const MessageType = enum(Integer) {
Error = 1,
Warning = 2,
Info = 3,
Log = 4,
pub fn jsonStringify(
value: MessageType,
options: json.StringifyOptions,
out_stream: anytype,
) !void {
try json.stringify(@enumToInt(value), options, out_stream);
}
};
/// Params for a LogMessage Notification (window/logMessage)
pub const LogMessageParams = struct {
type: MessageType, message: String
};
pub const DiagnosticSeverity = enum(Integer) {
Error = 1,
Warning = 2,
Information = 3,
Hint = 4,
pub fn jsonStringify(
value: DiagnosticSeverity,
options: json.StringifyOptions,
out_stream: anytype,
) !void {
try json.stringify(@enumToInt(value), options, out_stream);
}
};
pub const Diagnostic = struct {
range: Range,
severity: DiagnosticSeverity,
code: String,
source: String,
message: String,
};
pub const PublishDiagnosticsParams = struct {
uri: DocumentUri, diagnostics: []Diagnostic
};
pub const TextDocument = struct {
uri: DocumentUri,
// This is a substring of mem starting at 0
text: String,
// This holds the memory that we have actually allocated.
mem: []u8,
};
pub const WorkspaceEdit = struct {
changes: ?std.StringHashMap([]TextEdit),
pub fn jsonStringify(
self: WorkspaceEdit,
options: std.json.StringifyOptions,
writer: anytype,
) @TypeOf(writer).Error!void {
try writer.writeByte('{');
if (self.changes) |changes| {
try writer.writeAll("\"changes\": {");
var it = changes.iterator();
var idx: usize = 0;
while (it.next()) |entry| : (idx += 1) {
if (idx != 0) try writer.writeAll(", ");
try writer.writeByte('"');
try writer.writeAll(entry.key);
try writer.writeAll("\":");
try std.json.stringify(entry.value, options, writer);
}
try writer.writeByte('}');
}
try writer.writeByte('}');
}
};
pub const TextEdit = struct {
range: Range,
newText: String,
};
pub const MarkupKind = enum(u1) {
PlainText = 0, // plaintext
Markdown = 1, // markdown
pub fn jsonStringify(
value: MarkupKind,
options: json.StringifyOptions,
out_stream: anytype,
) !void {
const str = switch (value) {
.PlainText => "plaintext",
.Markdown => "markdown",
};
try json.stringify(str, options, out_stream);
}
};
pub const MarkupContent = struct {
kind: MarkupKind = MarkupKind.Markdown, value: String
};
// pub const TextDocumentIdentifier = struct {
// uri: DocumentUri,
// };
// pub const CompletionTriggerKind = enum(Integer) {
// Invoked = 1,
// TriggerCharacter = 2,
// TriggerForIncompleteCompletions = 3,
// pub fn jsonStringify(
// value: CompletionTriggerKind,
// options: json.StringifyOptions,
// out_stream: var,
// ) !void {
// try json.stringify(@enumToInt(value), options, out_stream);
// }
// };
pub const CompletionList = struct {
isIncomplete: Bool,
items: []const CompletionItem,
};
pub const CompletionItemKind = enum(Integer) {
Text = 1,
Method = 2,
Function = 3,
Constructor = 4,
Field = 5,
Variable = 6,
Class = 7,
Interface = 8,
Module = 9,
Property = 10,
Unit = 11,
Value = 12,
Enum = 13,
Keyword = 14,
Snippet = 15,
Color = 16,
File = 17,
Reference = 18,
Folder = 19,
EnumMember = 20,
Constant = 21,
Struct = 22,
Event = 23,
Operator = 24,
TypeParameter = 25,
pub fn jsonStringify(
value: CompletionItemKind,
options: json.StringifyOptions,
out_stream: anytype,
) !void {
try json.stringify(@enumToInt(value), options, out_stream);
}
};
pub const InsertTextFormat = enum(Integer) {
PlainText = 1,
Snippet = 2,
pub fn jsonStringify(
value: InsertTextFormat,
options: json.StringifyOptions,
out_stream: anytype,
) !void {
try json.stringify(@enumToInt(value), options, out_stream);
}
};
pub const CompletionItem = struct {
label: String,
kind: CompletionItemKind,
textEdit: ?TextEdit = null,
filterText: ?String = null,
insertText: ?String = null,
insertTextFormat: ?InsertTextFormat = InsertTextFormat.PlainText,
detail: ?String = null,
documentation: ?MarkupContent = null,
// filterText: String = .NotDefined,
};
const SymbolKind = enum {
File = 1,
Module = 2,
Namespace = 3,
Package = 4,
Class = 5,
Method = 6,
Property = 7,
Field = 8,
Constructor = 9,
Enum = 10,
Interface = 11,
Function = 12,
Variable = 13,
Constant = 14,
String = 15,
Number = 16,
Boolean = 17,
Array = 18,
Object = 19,
Key = 20,
Null = 21,
EnumMember = 22,
Struct = 23,
Event = 24,
Operator = 25,
TypeParameter = 26,
pub fn jsonStringify(
value: SymbolKind,
options: json.StringifyOptions,
out_stream: anytype,
) !void {
try json.stringify(@enumToInt(value), options, out_stream);
}
};
pub const DocumentSymbol = struct {
name: String,
detail: ?String = null,
kind: SymbolKind,
deprecated: bool = false,
range: Range,
selectionRange: Range,
children: []const DocumentSymbol = &[_]DocumentSymbol{},
};
pub const ShowMessageParams = struct {
type: MessageType,
message: String,
};
pub const WorkspaceFolder = struct {
uri: DocumentUri,
name: String,
}; | src/types.zig |
const std = @import("std");
const mem = std.mem;
const assert = std.debug.assert;
const Allocator = mem.Allocator;
// const ArrayList = std.ArrayList;
const ByteList = std.ArrayListAlignedUnmanaged([]u8, null);
const GlobalAlloc = std.heap.GeneralPurposeAllocator(.{});
// general purpose global allocator for small allocations
var GlobalAllocator: GlobalAlloc = .{};
pub const Alloc = GlobalAllocator.allocator();
pub const Pages = std.heap.page_allocator;
const BumpState = struct {
const Self = @This();
ranges: ByteList,
next_size: usize,
fn init(initial_size: usize) Self {
return .{
.ranges = ByteList{},
.next_size = initial_size,
};
}
fn allocate(bump: *Self, mark: *Mark, alloc: Allocator, len: usize, ptr_align: u29, ret_addr: usize) Allocator.Error![]u8 {
if (mark.range < bump.ranges.items.len) {
const range = bump.ranges.items[mark.range];
const addr = @ptrToInt(range.ptr) + mark.index_in_range;
const adjusted_addr = mem.alignForward(addr, ptr_align);
const adjusted_index = mark.index_in_range + (adjusted_addr - addr);
const new_end_index = adjusted_index + len;
if (new_end_index <= range.len) {
mark.index_in_range = new_end_index;
return range[adjusted_index..new_end_index];
}
}
const size = @maximum(len, bump.next_size);
// Holy crap if you mess up the alignment, boyo the Zig UB detector
// will come for you with an assertion failure 10 frames deep into
// the standard library.
//
// In this case, since we're returning exactly the requested length every
// time, the len_align parameter is 1, so that we can get extra if
// our parent allocator so deigns it, but we don't care about the alignment
// we get from them. We still require pointer alignment, so we can
// safely return the allocation we're given to the caller.
//
// https://github.com/ziglang/zig/blob/master/lib/std/mem/Allocator.zig
const slice = try alloc.rawAlloc(size, ptr_align, 1, ret_addr);
try bump.ranges.append(alloc, slice);
// grow the next arena, but keep it to at most 1GB please
bump.next_size = size * 3 / 2;
bump.next_size = @minimum(1024 * 1024 * 1024, bump.next_size);
mark.range = bump.ranges.items.len - 1;
mark.index_in_range = len;
return slice[0..len];
}
};
pub const Mark = struct {
range: usize,
index_in_range: usize,
pub const ZERO: @This() = .{ .range = 0, .index_in_range = 0 };
};
pub const Bump = struct {
const Self = @This();
bump: BumpState,
mark: Mark,
alloc: Allocator,
pub fn init(initial_size: usize, alloc: Allocator) Self {
return .{
.bump = BumpState.init(initial_size),
.mark = Mark.ZERO,
.alloc = alloc,
};
}
pub fn deinit(self: *Self) void {
for (self.ranges.items) |range| {
self.alloc.free(range);
}
self.ranges.deinit(self.alloc);
}
fn compareLessThan(context: void, left: []u8, right: []u8) bool {
_ = context;
return left.len > right.len;
}
pub fn resetAndKeepLargestArena(self: *Self) void {
const items = self.bump.ranges.items;
if (items.len == 0) {
return;
}
std.sort.insertionSort([]u8, items, {}, compareLessThan);
for (items[1..]) |*range| {
self.alloc.free(range.*);
range.* = &.{};
}
self.bump.ranges.items.len = 1;
self.mark = Mark.ZERO;
}
pub fn allocator(self: *Self) Allocator {
const resize = Allocator.NoResize(Self).noResize;
const free = Allocator.NoOpFree(Self).noOpFree;
return Allocator.init(self, Self.allocate, resize, free);
}
fn allocate(
self: *Self,
len: usize,
ptr_align: u29,
len_align: u29,
ret_addr: usize,
) Allocator.Error![]u8 {
_ = len_align;
return self.bump.allocate(
&self.mark,
self.alloc,
len,
ptr_align,
ret_addr,
);
}
};
pub const Temp = struct {
const Self = @This();
mark: Mark,
previous: ?*Self,
const InitialSize = 1024 * 1024;
threadlocal var top: ?*Temp = null;
threadlocal var bump = BumpState.init(InitialSize);
pub fn init() Self {
var mark = Mark.ZERO;
if (top) |t| {
mark = t.mark;
}
return .{
.mark = mark,
.previous = top,
};
}
pub fn deinit(self: *Self) void {
if (std.debug.runtime_safety) {
if (top) |t| {
assert(t == self or t == self.previous);
}
}
top = self.previous;
// can do some incremental sorting here too at some point
// - <NAME>, Mar 31, 2022 Thu 02:45 EDT
}
pub fn allocator(self: *Self) Allocator {
if (std.debug.runtime_safety) {
if (top) |t| {
assert(t == self or t == self.previous);
}
}
top = self;
const resize = Allocator.NoResize(Self).noResize;
const free = Allocator.NoOpFree(Self).noOpFree;
return Allocator.init(self, Self.allocate, resize, free);
}
fn allocate(
self: *Self,
len: usize,
ptr_align: u29,
len_align: u29,
ret_addr: usize,
) Allocator.Error![]u8 {
_ = len_align;
return bump.allocate(&self.mark, Pages, len, ptr_align, ret_addr);
}
};
pub const Frame = FrameAlloc.allocator;
pub fn clearFrameAllocator() void {
FrameAlloc.mark = Mark.ZERO;
}
const FrameAlloc = struct {
const InitialSize = 2 * 1024 * 1024;
threadlocal var bump = BumpState.init(InitialSize);
threadlocal var mark = Mark.ZERO;
const allocator = Allocator.init(undefined, alloc, resize, free);
const resize = Allocator.NoResize(anyopaque).noResize;
const free = Allocator.NoOpFree(anyopaque).noOpFree;
fn alloc(
_: *anyopaque,
len: usize,
ptr_align: u29,
len_align: u29,
ret_addr: usize,
) Allocator.Error![]u8 {
_ = len_align;
return bump.allocate(&mark, Pages, len, ptr_align, ret_addr);
}
}; | src/liu/allocators.zig |
const std = @import("std");
const freetype = @import("freetype");
const OutlinePrinter = struct {
library: freetype.Library,
face: freetype.Face,
output_file: std.fs.File,
path_stream: std.io.FixedBufferStream([]u8),
xMin: isize,
yMin: isize,
width: isize,
height: isize,
const Self = @This();
pub fn init(file: std.fs.File) freetype.Error!Self {
var lib = try freetype.Library.init();
return Self{
.library = lib,
.face = try lib.newFace("upstream/assets/FiraSans-Regular.ttf", 0),
.output_file = file,
.path_stream = std.io.fixedBufferStream(&std.mem.zeroes([1024 * 10]u8)),
.xMin = 0,
.yMin = 0,
.width = 0,
.height = 0,
};
}
pub fn deinit(self: Self) void {
self.library.deinit();
}
pub fn outlineExists(self: Self) bool {
const outline = self.face.glyph.outline() orelse return false;
if (outline.numContours() <= 0 or outline.numPoints() <= 0)
return false;
outline.check() catch return false;
return true;
}
pub fn flipOutline(self: Self) void {
const multiplier = 65536;
const matrix = freetype.Matrix{
.xx = 1 * multiplier,
.xy = 0 * multiplier,
.yx = 0 * multiplier,
.yy = -1 * multiplier,
};
self.face.glyph.outline().?.transform(matrix);
}
pub fn extractOutline(self: *Self) !void {
try self.path_stream.writer().writeAll("<path d='");
var callbacks = freetype.Outline.OutlineFuncs(*Self){
.move_to = moveToFunction,
.line_to = lineToFunction,
.conic_to = conicToFunction,
.cubic_to = cubicToFunction,
.shift = 0,
.delta = 0,
};
try self.face.glyph.outline().?.decompose(self, callbacks);
try self.path_stream.writer().writeAll("' fill='#000'/>");
}
pub fn computeViewBox(self: *Self) !void {
const boundingBox = try self.face.glyph.outline().?.bbox();
self.xMin = boundingBox.xMin;
self.yMin = boundingBox.yMin;
self.width = boundingBox.xMax - boundingBox.xMin;
self.height = boundingBox.yMax - boundingBox.yMin;
}
pub fn printSVG(self: Self) !void {
try self.output_file.writer().print(
\\<svg xmlns='http://www.w3.org/2000/svg'
\\ xmlns:xlink='http://www.w3.org/1999/xlink'
\\ viewBox='{d} {d} {d} {d}'>
\\ {s}
\\</svg>
, .{ self.xMin, self.yMin, self.width, self.height, self.path_stream.getWritten() });
}
pub fn moveToFunction(self: *Self, to: freetype.Vector) freetype.Error!void {
self.path_stream.writer().print("M {d} {d}\t", .{ to.x, to.y }) catch unreachable;
}
pub fn lineToFunction(self: *Self, to: freetype.Vector) freetype.Error!void {
self.path_stream.writer().print("L {d} {d}\t", .{ to.x, to.y }) catch unreachable;
}
pub fn conicToFunction(self: *Self, control: freetype.Vector, to: freetype.Vector) freetype.Error!void {
self.path_stream.writer().print("Q {d} {d}, {d} {d}\t", .{ control.x, control.y, to.x, to.y }) catch unreachable;
}
pub fn cubicToFunction(self: *Self, control_0: freetype.Vector, control_1: freetype.Vector, to: freetype.Vector) freetype.Error!void {
self.path_stream.writer().print("C {d} {d}, {d} {d}, {d} {d}\t", .{ control_0.x, control_0.y, control_1.x, control_1.y, to.x, to.y }) catch unreachable;
}
pub fn run(self: *Self, symbol: u8) !void {
try self.face.loadChar(symbol, .{ .no_scale = true, .no_bitmap = true });
if (!self.outlineExists())
return error.OutlineDoesntExists;
self.flipOutline();
try self.extractOutline();
try self.computeViewBox();
try self.printSVG();
}
};
pub fn main() !void {
var file = try std.fs.cwd().createFile("out.svg", .{});
defer file.close();
var outline_printer = try OutlinePrinter.init(file);
defer outline_printer.deinit();
try outline_printer.run('a');
} | freetype/examples/glyph-to-svg.zig |
const print = @import("std").debug.print;
// The grue is a nod to Zork.
const TripError = error{ Unreachable, EatenByAGrue };
// Let's start with the Places on the map. Each has a name and a
// distance or difficulty of travel (as judged by the hermit).
//
// Note that we declare the places as mutable (var) because we need to
// assign the paths later. And why is that? Because paths contain
// pointers to places and assigning them now would create a dependency
// loop!
const Place = struct {
name: []const u8,
paths: []const Path = undefined,
};
var a = Place{ .name = "Archer's Point" };
var b = Place{ .name = "Bridge" };
var c = Place{ .name = "Cottage" };
var d = Place{ .name = "Dogwood Grove" };
var e = Place{ .name = "East Pond" };
var f = Place{ .name = "Fox Pond" };
// The hermit's hand-drawn ASCII map
// +---------------------------------------------------+
// | * Archer's Point ~~~~ |
// | ~~~ ~~~~~~~~ |
// | ~~~| |~~~~~~~~~~~~ ~~~~~~~ |
// | Bridge ~~~~~~~~ |
// | ^ ^ ^ |
// | ^ ^ / \ |
// | ^ ^ ^ ^ |_| Cottage |
// | Dogwood Grove |
// | ^ <boat> |
// | ^ ^ ^ ^ ~~~~~~~~~~~~~ ^ ^ |
// | ^ ~~ East Pond ~~~ |
// | ^ ^ ^ ~~~~~~~~~~~~~~ |
// | ~~ ^ |
// | ^ ~~~ <-- short waterfall |
// | ^ ~~~~~ |
// | ~~~~~~~~~~~~~~~~~ |
// | ~~~~ Fox Pond ~~~~~~~ ^ ^ |
// | ^ ~~~~~~~~~~~~~~~ ^ ^ |
// | ~~~~~ |
// +---------------------------------------------------+
//
// We'll be reserving memory in our program based on the number of
// places on the map. Note that we do not have to specify the type of
// this value because we don't actually use it in our program once
// it's compiled! (Don't worry if this doesn't make sense yet.)
const place_count = 6;
// Now let's create all of the paths between sites. A path goes from
// one place to another and has a distance.
const Path = struct {
from: *const Place,
to: *const Place,
dist: u8,
};
// By the way, if the following code seems like a lot of tedious
// manual labor, you're right! One of Zig's killer features is letting
// us write code that runs at compile time to "automate" repetitive
// code (much like macros in other languages), but we haven't learned
// how to do that yet!
const a_paths = [_]Path{
Path{
.from = &a, // from: Archer's Point
.to = &b, // to: Bridge
.dist = 2,
},
};
const b_paths = [_]Path{
Path{
.from = &b, // from: Bridge
.to = &a, // to: Archer's Point
.dist = 2,
},
Path{
.from = &b, // from: Bridge
.to = &d, // to: Dogwood Grove
.dist = 1,
},
};
const c_paths = [_]Path{
Path{
.from = &c, // from: Cottage
.to = &d, // to: Dogwood Grove
.dist = 3,
},
Path{
.from = &c, // from: Cottage
.to = &e, // to: East Pond
.dist = 2,
},
};
const d_paths = [_]Path{
Path{
.from = &d, // from: Dogwood Grove
.to = &b, // to: Bridge
.dist = 1,
},
Path{
.from = &d, // from: Dogwood Grove
.to = &c, // to: Cottage
.dist = 3,
},
Path{
.from = &d, // from: Dogwood Grove
.to = &f, // to: Fox Pond
.dist = 7,
},
};
const e_paths = [_]Path{
Path{
.from = &e, // from: East Pond
.to = &c, // to: Cottage
.dist = 2,
},
Path{
.from = &e, // from: East Pond
.to = &f, // to: Fox Pond
.dist = 1, // (one-way down a short waterfall!)
},
};
const f_paths = [_]Path{
Path{
.from = &f, // from: Fox Pond
.to = &d, // to: Dogwood Grove
.dist = 7,
},
};
// Once we've plotted the best course through the woods, we'll make a
// "trip" out of it. A trip is a series of Places connected by Paths.
// We use a TripItem union to allow both Places and Paths to be in the
// same array.
const TripItem = union(enum) {
place: *const Place,
path: *const Path,
// This is a little helper function to print the two different
// types of item correctly.
fn printMe(self: TripItem) void {
switch (self) {
// Oops! The hermit forgot how to capture the union values
// in a switch statement. Please capture both values as
// 'p' so the print statements work!
.place => |p| print("{s}", .{p.name}),
.path => |p| print("--{}->", .{p.dist}),
}
}
};
// The Hermit's Notebook is where all the magic happens. A notebook
// entry is a Place discovered on the map along with the Path taken to
// get there and the distance to reach it from the start point. If we
// find a better Path to reach a Place (lower distance), we update the
// entry. Entries also serve as a "todo" list which is how we keep
// track of which paths to explore next.
const NotebookEntry = struct {
place: *const Place,
coming_from: ?*const Place,
via_path: ?*const Path,
dist_to_reach: u16,
};
// +------------------------------------------------+
// | ~ Hermit's Notebook ~ |
// +---+----------------+----------------+----------+
// | | Place | From | Distance |
// +---+----------------+----------------+----------+
// | 0 | Archer's Point | null | 0 |
// | 1 | Bridge | Archer's Point | 2 | < next_entry
// | 2 | Dogwood Grove | Bridge | 1 |
// | 3 | | | | < end_of_entries
// | ... |
// +---+----------------+----------------+----------+
//
const HermitsNotebook = struct {
// Remember the array repetition operator `**`? It is no mere
// novelty, it's also a great way to assign multiple items in an
// array without having to list them one by one. Here we use it to
// initialize an array with null values.
entries: [place_count]?NotebookEntry = .{null} ** place_count,
// The next entry keeps track of where we are in our "todo" list.
next_entry: u8 = 0,
// Mark the start of empty space in the notebook.
end_of_entries: u8 = 0,
// We'll often want to find an entry by Place. If one is not
// found, we return null.
fn getEntry(self: *HermitsNotebook, place: *const Place) ?*NotebookEntry {
for (self.entries) |*entry, i| {
if (i >= self.end_of_entries) break;
// Here's where the hermit got stuck. We need to return
// an optional pointer to a NotebookEntry.
//
// What we have with "entry" is the opposite: a pointer to
// an optional NotebookEntry!
//
// To get one from the other, we need to dereference
// "entry" (with .*) and get the non-null value from the
// optional (with .?) and return the address of that. The
// if statement provides some clues about how the
// dereference and optional value "unwrapping" look
// together. Remember that you return the address with the
// "&" operator.
if (place == entry.*.?.place) return &entry.*.?;
// Try to make your answer this long:__________;
}
return null;
}
// The checkNote() method is the beating heart of the magical
// notebook. Given a new note in the form of a NotebookEntry
// struct, we check to see if we already have an entry for the
// note's Place.
//
// If we DON'T, we'll add the entry to the end of the notebook
// along with the Path taken and distance.
//
// If we DO, we check to see if the path is "better" (shorter
// distance) than the one we'd noted before. If it is, we
// overwrite the old entry with the new one.
fn checkNote(self: *HermitsNotebook, note: NotebookEntry) void {
var existing_entry = self.getEntry(note.place);
if (existing_entry == null) {
self.entries[self.end_of_entries] = note;
self.end_of_entries += 1;
} else if (note.dist_to_reach < existing_entry.?.dist_to_reach) {
existing_entry.?.* = note;
}
}
// The next two methods allow us to use the notebook as a "todo"
// list.
fn hasNextEntry(self: *HermitsNotebook) bool {
return self.next_entry < self.end_of_entries;
}
fn getNextEntry(self: *HermitsNotebook) *const NotebookEntry {
defer self.next_entry += 1; // Increment after getting entry
return &self.entries[self.next_entry].?;
}
// After we've completed our search of the map, we'll have
// computed the shortest Path to every Place. To collect the
// complete trip from the start to the destination, we need to
// walk backwards from the destination's notebook entry, following
// the coming_from pointers back to the start. What we end up with
// is an array of TripItems with our trip in reverse order.
//
// We need to take the trip array as a parameter because we want
// the main() function to "own" the array memory. What do you
// suppose could happen if we allocated the array in this
// function's stack frame (the space allocated for a function's
// "local" data) and returned a pointer or slice to it?
//
// Looks like the hermit forgot something in the return value of
// this function. What could that be?
fn getTripTo(self: *HermitsNotebook, trip: []?TripItem, dest: *Place) !void {
// We start at the destination entry.
const destination_entry = self.getEntry(dest);
// This function needs to return an error if the requested
// destination was never reached. (This can't actually happen
// in our map since every Place is reachable by every other
// Place.)
if (destination_entry == null) {
return TripError.Unreachable;
}
// Variables hold the entry we're currently examining and an
// index to keep track of where we're appending trip items.
var current_entry = destination_entry.?;
var i: u8 = 0;
// At the end of each looping, a continue expression increments
// our index. Can you see why we need to increment by two?
while (true) : (i += 2) {
trip[i] = TripItem{ .place = current_entry.place };
// An entry "coming from" nowhere means we've reached the
// start, so we're done.
if (current_entry.coming_from == null) break;
// Otherwise, entries have a path.
trip[i + 1] = TripItem{ .path = current_entry.via_path.? };
// Now we follow the entry we're "coming from". If we
// aren't able to find the entry we're "coming from" by
// Place, something has gone horribly wrong with our
// program! (This really shouldn't ever happen. Have you
// checked for grues?)
// Note: you do not need to fix anything here.
const previous_entry = self.getEntry(current_entry.coming_from.?);
if (previous_entry == null) return TripError.EatenByAGrue;
current_entry = previous_entry.?;
}
}
};
pub fn main() void {
// Here's where the hermit decides where he would like to go. Once
// you get the program working, try some different Places on the
// map!
const start = &a; // Archer's Point
const destination = &f; // Fox Pond
// Store each Path array as a slice in each Place. As mentioned
// above, we needed to delay making these references to avoid
// creating a dependency loop when the compiler is trying to
// figure out how to allocate space for each item.
a.paths = a_paths[0..];
b.paths = b_paths[0..];
c.paths = c_paths[0..];
d.paths = d_paths[0..];
e.paths = e_paths[0..];
f.paths = f_paths[0..];
// Now we create an instance of the notebook and add the first
// "start" entry. Note the null values. Read the comments for the
// checkNote() method above to see how this entry gets added to
// the notebook.
var notebook = HermitsNotebook{};
var working_note = NotebookEntry{
.place = start,
.coming_from = null,
.via_path = null,
.dist_to_reach = 0,
};
notebook.checkNote(working_note);
// Get the next entry from the notebook (the first being the
// "start" entry we just added) until we run out, at which point
// we'll have checked every reachable Place.
while (notebook.hasNextEntry()) {
var place_entry = notebook.getNextEntry();
// For every Path that leads FROM the current Place, create a
// new note (in the form of a NotebookEntry) with the
// destination Place and the total distance from the start to
// reach that place. Again, read the comments for the
// checkNote() method to see how this works.
for (place_entry.place.paths) |*path| {
working_note = NotebookEntry{
.place = path.to,
.coming_from = place_entry.place,
.via_path = path,
.dist_to_reach = place_entry.dist_to_reach + path.dist,
};
notebook.checkNote(working_note);
}
}
// Once the loop above is complete, we've calculated the shortest
// path to every reachable Place! What we need to do now is set
// aside memory for the trip and have the hermit's notebook fill
// in the trip from the destination back to the path. Note that
// this is the first time we've actually used the destination!
var trip = [_]?TripItem{null} ** (place_count * 2);
notebook.getTripTo(trip[0..], destination) catch |err| {
print("Oh no! {}\n", .{err});
return;
};
// Print the trip with a little helper function below.
printTrip(trip[0..]);
}
// Remember that trips will be a series of alternating TripItems
// containing a Place or Path from the destination back to the start.
// The remaining space in the trip array will contain null values, so
// we need to loop through the items in reverse, skipping nulls, until
// we reach the destination at the front of the array.
fn printTrip(trip: []?TripItem) void {
// We convert the usize length to a u8 with @intCast(), a
// builtin function just like @import(). We'll learn about
// these properly in a later exercise.
var i: u8 = @intCast(u8, trip.len);
while (i > 0) {
i -= 1;
if (trip[i] == null) continue;
trip[i].?.printMe();
}
print("\n", .{});
}
// Going deeper:
//
// In computer science terms, our map places are "nodes" or "vertices" and
// the paths are "edges". Together, they form a "weighted, directed
// graph". It is "weighted" because each path has a distance (also
// known as a "cost"). It is "directed" because each path goes FROM
// one place TO another place (undirected graphs allow you to travel
// on an edge in either direction).
//
// Since we append new notebook entries at the end of the list and
// then explore each sequentially from the beginning (like a "todo"
// list), we are treating the notebook as a "First In, First Out"
// (FIFO) queue.
//
// Since we examine all closest paths first before trying further ones
// (thanks to the "todo" queue), we are performing a "Breadth-First
// Search" (BFS).
//
// By tracking "lowest cost" paths, we can also say that we're
// performing a "least-cost search".
//
// Even more specifically, the Hermit's Notebook most closely
// resembles the Shortest Path Faster Algorithm (SPFA), attributed to
// <NAME>. By replacing our simple FIFO queue with a
// "priority queue", we would basically have Dijkstra's algorithm. A
// priority queue retrieves items sorted by "weight" (in our case, it
// would keep the paths with the shortest distance at the front of the
// queue). Dijkstra's algorithm is more efficient because longer paths
// can be eliminated more quickly. (Work it out on paper to see why!) | exercises/058_quiz7.zig |
pub const HP = struct {
val: f64,
off: f64,
};
pub const lookup_table = []HP{
HP{.val=1.000000e+308, .off= -1.097906362944045488e+291 },
HP{.val=1.000000e+307, .off= 1.396894023974354241e+290 },
HP{.val=1.000000e+306, .off= -1.721606459673645508e+289 },
HP{.val=1.000000e+305, .off= 6.074644749446353973e+288 },
HP{.val=1.000000e+304, .off= 6.074644749446353567e+287 },
HP{.val=1.000000e+303, .off= -1.617650767864564452e+284 },
HP{.val=1.000000e+302, .off= -7.629703079084895055e+285 },
HP{.val=1.000000e+301, .off= -5.250476025520442286e+284 },
HP{.val=1.000000e+300, .off= -5.250476025520441956e+283 },
HP{.val=1.000000e+299, .off= -5.250476025520441750e+282 },
HP{.val=1.000000e+298, .off= 4.043379652465702264e+281 },
HP{.val=1.000000e+297, .off= -1.765280146275637946e+280 },
HP{.val=1.000000e+296, .off= 1.865132227937699609e+279 },
HP{.val=1.000000e+295, .off= 1.865132227937699609e+278 },
HP{.val=1.000000e+294, .off= -6.643646774124810287e+277 },
HP{.val=1.000000e+293, .off= 7.537651562646039934e+276 },
HP{.val=1.000000e+292, .off= -1.325659897835741608e+275 },
HP{.val=1.000000e+291, .off= 4.213909764965371606e+274 },
HP{.val=1.000000e+290, .off= -6.172783352786715670e+273 },
HP{.val=1.000000e+289, .off= -6.172783352786715670e+272 },
HP{.val=1.000000e+288, .off= -7.630473539575035471e+270 },
HP{.val=1.000000e+287, .off= -7.525217352494018700e+270 },
HP{.val=1.000000e+286, .off= -3.298861103408696612e+269 },
HP{.val=1.000000e+285, .off= 1.984084207947955778e+268 },
HP{.val=1.000000e+284, .off= -7.921438250845767591e+267 },
HP{.val=1.000000e+283, .off= 4.460464822646386735e+266 },
HP{.val=1.000000e+282, .off= -3.278224598286209647e+265 },
HP{.val=1.000000e+281, .off= -3.278224598286209737e+264 },
HP{.val=1.000000e+280, .off= -3.278224598286209961e+263 },
HP{.val=1.000000e+279, .off= -5.797329227496039232e+262 },
HP{.val=1.000000e+278, .off= 3.649313132040821498e+261 },
HP{.val=1.000000e+277, .off= -2.867878510995372374e+259 },
HP{.val=1.000000e+276, .off= -5.206914080024985409e+259 },
HP{.val=1.000000e+275, .off= 4.018322599210230404e+258 },
HP{.val=1.000000e+274, .off= 7.862171215558236495e+257 },
HP{.val=1.000000e+273, .off= 5.459765830340732821e+256 },
HP{.val=1.000000e+272, .off= -6.552261095746788047e+255 },
HP{.val=1.000000e+271, .off= 4.709014147460262298e+254 },
HP{.val=1.000000e+270, .off= -4.675381888545612729e+253 },
HP{.val=1.000000e+269, .off= -4.675381888545612892e+252 },
HP{.val=1.000000e+268, .off= 2.656177514583977380e+251 },
HP{.val=1.000000e+267, .off= 2.656177514583977190e+250 },
HP{.val=1.000000e+266, .off= -3.071603269111014892e+249 },
HP{.val=1.000000e+265, .off= -6.651466258920385440e+248 },
HP{.val=1.000000e+264, .off= -4.414051890289528972e+247 },
HP{.val=1.000000e+263, .off= -1.617283929500958387e+246 },
HP{.val=1.000000e+262, .off= -1.617283929500958241e+245 },
HP{.val=1.000000e+261, .off= 7.122615947963323868e+244 },
HP{.val=1.000000e+260, .off= -6.533477610574617382e+243 },
HP{.val=1.000000e+259, .off= 7.122615947963323982e+242 },
HP{.val=1.000000e+258, .off= -5.679971763165996225e+241 },
HP{.val=1.000000e+257, .off= -3.012765990014054219e+240 },
HP{.val=1.000000e+256, .off= -3.012765990014054219e+239 },
HP{.val=1.000000e+255, .off= 1.154743030535854616e+238 },
HP{.val=1.000000e+254, .off= 6.364129306223240767e+237 },
HP{.val=1.000000e+253, .off= 6.364129306223241129e+236 },
HP{.val=1.000000e+252, .off= -9.915202805299840595e+235 },
HP{.val=1.000000e+251, .off= -4.827911520448877980e+234 },
HP{.val=1.000000e+250, .off= 7.890316691678530146e+233 },
HP{.val=1.000000e+249, .off= 7.890316691678529484e+232 },
HP{.val=1.000000e+248, .off= -4.529828046727141859e+231 },
HP{.val=1.000000e+247, .off= 4.785280507077111924e+230 },
HP{.val=1.000000e+246, .off= -6.858605185178205305e+229 },
HP{.val=1.000000e+245, .off= -4.432795665958347728e+228 },
HP{.val=1.000000e+244, .off= -7.465057564983169531e+227 },
HP{.val=1.000000e+243, .off= -7.465057564983169741e+226 },
HP{.val=1.000000e+242, .off= -5.096102956370027445e+225 },
HP{.val=1.000000e+241, .off= -5.096102956370026952e+224 },
HP{.val=1.000000e+240, .off= -1.394611380411992474e+223 },
HP{.val=1.000000e+239, .off= 9.188208545617793960e+221 },
HP{.val=1.000000e+238, .off= -4.864759732872650359e+221 },
HP{.val=1.000000e+237, .off= 5.979453868566904629e+220 },
HP{.val=1.000000e+236, .off= -5.316601966265964857e+219 },
HP{.val=1.000000e+235, .off= -5.316601966265964701e+218 },
HP{.val=1.000000e+234, .off= -1.786584517880693123e+217 },
HP{.val=1.000000e+233, .off= 2.625937292600896716e+216 },
HP{.val=1.000000e+232, .off= -5.647541102052084079e+215 },
HP{.val=1.000000e+231, .off= -5.647541102052083888e+214 },
HP{.val=1.000000e+230, .off= -9.956644432600511943e+213 },
HP{.val=1.000000e+229, .off= 8.161138937705571862e+211 },
HP{.val=1.000000e+228, .off= 7.549087847752475275e+211 },
HP{.val=1.000000e+227, .off= -9.283347037202319948e+210 },
HP{.val=1.000000e+226, .off= 3.866992716668613820e+209 },
HP{.val=1.000000e+225, .off= 7.154577655136347262e+208 },
HP{.val=1.000000e+224, .off= 3.045096482051680688e+207 },
HP{.val=1.000000e+223, .off= -4.660180717482069567e+206 },
HP{.val=1.000000e+222, .off= -4.660180717482070101e+205 },
HP{.val=1.000000e+221, .off= -4.660180717482069544e+204 },
HP{.val=1.000000e+220, .off= 3.562757926310489022e+202 },
HP{.val=1.000000e+219, .off= 3.491561111451748149e+202 },
HP{.val=1.000000e+218, .off= -8.265758834125874135e+201 },
HP{.val=1.000000e+217, .off= 3.981449442517482365e+200 },
HP{.val=1.000000e+216, .off= -2.142154695804195936e+199 },
HP{.val=1.000000e+215, .off= 9.339603063548950188e+198 },
HP{.val=1.000000e+214, .off= 4.555537330485139746e+197 },
HP{.val=1.000000e+213, .off= 1.565496247320257804e+196 },
HP{.val=1.000000e+212, .off= 9.040598955232462036e+195 },
HP{.val=1.000000e+211, .off= 4.368659762787334780e+194 },
HP{.val=1.000000e+210, .off= 7.288621758065539072e+193 },
HP{.val=1.000000e+209, .off= -7.311188218325485628e+192 },
HP{.val=1.000000e+208, .off= 1.813693016918905189e+191 },
HP{.val=1.000000e+207, .off= -3.889357755108838992e+190 },
HP{.val=1.000000e+206, .off= -3.889357755108838992e+189 },
HP{.val=1.000000e+205, .off= -1.661603547285501360e+188 },
HP{.val=1.000000e+204, .off= 1.123089212493670643e+187 },
HP{.val=1.000000e+203, .off= 1.123089212493670643e+186 },
HP{.val=1.000000e+202, .off= 9.825254086803583029e+185 },
HP{.val=1.000000e+201, .off= -3.771878529305654999e+184 },
HP{.val=1.000000e+200, .off= 3.026687778748963675e+183 },
HP{.val=1.000000e+199, .off= -9.720624048853446693e+182 },
HP{.val=1.000000e+198, .off= -1.753554156601940139e+181 },
HP{.val=1.000000e+197, .off= 4.885670753607648963e+180 },
HP{.val=1.000000e+196, .off= 4.885670753607648963e+179 },
HP{.val=1.000000e+195, .off= 2.292223523057028076e+178 },
HP{.val=1.000000e+194, .off= 5.534032561245303825e+177 },
HP{.val=1.000000e+193, .off= -6.622751331960730683e+176 },
HP{.val=1.000000e+192, .off= -4.090088020876139692e+175 },
HP{.val=1.000000e+191, .off= -7.255917159731877552e+174 },
HP{.val=1.000000e+190, .off= -7.255917159731877992e+173 },
HP{.val=1.000000e+189, .off= -2.309309130269787104e+172 },
HP{.val=1.000000e+188, .off= -2.309309130269787019e+171 },
HP{.val=1.000000e+187, .off= 9.284303438781988230e+170 },
HP{.val=1.000000e+186, .off= 2.038295583124628364e+169 },
HP{.val=1.000000e+185, .off= 2.038295583124628532e+168 },
HP{.val=1.000000e+184, .off= -1.735666841696912925e+167 },
HP{.val=1.000000e+183, .off= 5.340512704843477241e+166 },
HP{.val=1.000000e+182, .off= -6.453119872723839321e+165 },
HP{.val=1.000000e+181, .off= 8.288920849235306587e+164 },
HP{.val=1.000000e+180, .off= -9.248546019891598293e+162 },
HP{.val=1.000000e+179, .off= 1.954450226518486016e+162 },
HP{.val=1.000000e+178, .off= -5.243811844750628197e+161 },
HP{.val=1.000000e+177, .off= -7.448980502074320639e+159 },
HP{.val=1.000000e+176, .off= -7.448980502074319858e+158 },
HP{.val=1.000000e+175, .off= 6.284654753766312753e+158 },
HP{.val=1.000000e+174, .off= -6.895756753684458388e+157 },
HP{.val=1.000000e+173, .off= -1.403918625579970616e+156 },
HP{.val=1.000000e+172, .off= -8.268716285710580522e+155 },
HP{.val=1.000000e+171, .off= 4.602779327034313170e+154 },
HP{.val=1.000000e+170, .off= -3.441905430931244940e+153 },
HP{.val=1.000000e+169, .off= 6.613950516525702884e+152 },
HP{.val=1.000000e+168, .off= 6.613950516525702652e+151 },
HP{.val=1.000000e+167, .off= -3.860899428741951187e+150 },
HP{.val=1.000000e+166, .off= 5.959272394946474605e+149 },
HP{.val=1.000000e+165, .off= 1.005101065481665103e+149 },
HP{.val=1.000000e+164, .off= -1.783349948587918355e+146 },
HP{.val=1.000000e+163, .off= 6.215006036188360099e+146 },
HP{.val=1.000000e+162, .off= 6.215006036188360099e+145 },
HP{.val=1.000000e+161, .off= -3.774589324822814903e+144 },
HP{.val=1.000000e+160, .off= -6.528407745068226929e+142 },
HP{.val=1.000000e+159, .off= 7.151530601283157561e+142 },
HP{.val=1.000000e+158, .off= 4.712664546348788765e+141 },
HP{.val=1.000000e+157, .off= 1.664081977680827856e+140 },
HP{.val=1.000000e+156, .off= 1.664081977680827750e+139 },
HP{.val=1.000000e+155, .off= -7.176231540910168265e+137 },
HP{.val=1.000000e+154, .off= -3.694754568805822650e+137 },
HP{.val=1.000000e+153, .off= 2.665969958768462622e+134 },
HP{.val=1.000000e+152, .off= -4.625108135904199522e+135 },
HP{.val=1.000000e+151, .off= -1.717753238721771919e+134 },
HP{.val=1.000000e+150, .off= 1.916440382756262433e+133 },
HP{.val=1.000000e+149, .off= -4.897672657515052040e+132 },
HP{.val=1.000000e+148, .off= -4.897672657515052198e+131 },
HP{.val=1.000000e+147, .off= 2.200361759434233991e+130 },
HP{.val=1.000000e+146, .off= 6.636633270027537273e+129 },
HP{.val=1.000000e+145, .off= 1.091293881785907977e+128 },
HP{.val=1.000000e+144, .off= -2.374543235865110597e+127 },
HP{.val=1.000000e+143, .off= -2.374543235865110537e+126 },
HP{.val=1.000000e+142, .off= -5.082228484029969099e+125 },
HP{.val=1.000000e+141, .off= -1.697621923823895943e+124 },
HP{.val=1.000000e+140, .off= -5.928380124081487212e+123 },
HP{.val=1.000000e+139, .off= -3.284156248920492522e+122 },
HP{.val=1.000000e+138, .off= -3.284156248920492706e+121 },
HP{.val=1.000000e+137, .off= -3.284156248920492476e+120 },
HP{.val=1.000000e+136, .off= -5.866406127007401066e+119 },
HP{.val=1.000000e+135, .off= 3.817030915818506056e+118 },
HP{.val=1.000000e+134, .off= 7.851796350329300951e+117 },
HP{.val=1.000000e+133, .off= -2.235117235947686077e+116 },
HP{.val=1.000000e+132, .off= 9.170432597638723691e+114 },
HP{.val=1.000000e+131, .off= 8.797444499042767883e+114 },
HP{.val=1.000000e+130, .off= -5.978307824605161274e+113 },
HP{.val=1.000000e+129, .off= 1.782556435814758516e+111 },
HP{.val=1.000000e+128, .off= -7.517448691651820362e+111 },
HP{.val=1.000000e+127, .off= 4.507089332150205498e+110 },
HP{.val=1.000000e+126, .off= 7.513223838100711695e+109 },
HP{.val=1.000000e+125, .off= 7.513223838100712113e+108 },
HP{.val=1.000000e+124, .off= 5.164681255326878494e+107 },
HP{.val=1.000000e+123, .off= 2.229003026859587122e+106 },
HP{.val=1.000000e+122, .off= -1.440594758724527399e+105 },
HP{.val=1.000000e+121, .off= -3.734093374714598783e+104 },
HP{.val=1.000000e+120, .off= 1.999653165260579757e+103 },
HP{.val=1.000000e+119, .off= 5.583244752745066693e+102 },
HP{.val=1.000000e+118, .off= 3.343500010567262234e+101 },
HP{.val=1.000000e+117, .off= -5.055542772599503556e+100 },
HP{.val=1.000000e+116, .off= -1.555941612946684331e+99 },
HP{.val=1.000000e+115, .off= -1.555941612946684331e+98 },
HP{.val=1.000000e+114, .off= -1.555941612946684293e+97 },
HP{.val=1.000000e+113, .off= -1.555941612946684246e+96 },
HP{.val=1.000000e+112, .off= 6.988006530736955847e+95 },
HP{.val=1.000000e+111, .off= 4.318022735835818244e+94 },
HP{.val=1.000000e+110, .off= -2.356936751417025578e+93 },
HP{.val=1.000000e+109, .off= 1.814912928116001926e+92 },
HP{.val=1.000000e+108, .off= -3.399899171300282744e+91 },
HP{.val=1.000000e+107, .off= 3.118615952970072913e+90 },
HP{.val=1.000000e+106, .off= -9.103599905036843605e+89 },
HP{.val=1.000000e+105, .off= 6.174169917471802325e+88 },
HP{.val=1.000000e+104, .off= -1.915675085734668657e+86 },
HP{.val=1.000000e+103, .off= -1.915675085734668864e+85 },
HP{.val=1.000000e+102, .off= 2.295048673475466221e+85 },
HP{.val=1.000000e+101, .off= 2.295048673475466135e+84 },
HP{.val=1.000000e+100, .off= -1.590289110975991792e+83 },
HP{.val=1.000000e+99, .off= 3.266383119588331155e+82 },
HP{.val=1.000000e+98, .off= 2.309629754856292029e+80 },
HP{.val=1.000000e+97, .off= -7.357587384771124533e+80 },
HP{.val=1.000000e+96, .off= -4.986165397190889509e+79 },
HP{.val=1.000000e+95, .off= -2.021887912715594741e+78 },
HP{.val=1.000000e+94, .off= -2.021887912715594638e+77 },
HP{.val=1.000000e+93, .off= -4.337729697461918675e+76 },
HP{.val=1.000000e+92, .off= -4.337729697461918997e+75 },
HP{.val=1.000000e+91, .off= -7.956232486128049702e+74 },
HP{.val=1.000000e+90, .off= 3.351588728453609882e+73 },
HP{.val=1.000000e+89, .off= 5.246334248081951113e+71 },
HP{.val=1.000000e+88, .off= 4.058327554364963672e+71 },
HP{.val=1.000000e+87, .off= 4.058327554364963918e+70 },
HP{.val=1.000000e+86, .off= -1.463069523067487266e+69 },
HP{.val=1.000000e+85, .off= -1.463069523067487314e+68 },
HP{.val=1.000000e+84, .off= -5.776660989811589441e+67 },
HP{.val=1.000000e+83, .off= -3.080666323096525761e+66 },
HP{.val=1.000000e+82, .off= 3.659320343691134468e+65 },
HP{.val=1.000000e+81, .off= 7.871812010433421235e+64 },
HP{.val=1.000000e+80, .off= -2.660986470836727449e+61 },
HP{.val=1.000000e+79, .off= 3.264399249934044627e+62 },
HP{.val=1.000000e+78, .off= -8.493621433689703070e+60 },
HP{.val=1.000000e+77, .off= 1.721738727445414063e+60 },
HP{.val=1.000000e+76, .off= -4.706013449590547218e+59 },
HP{.val=1.000000e+75, .off= 7.346021882351880518e+58 },
HP{.val=1.000000e+74, .off= 4.835181188197207515e+57 },
HP{.val=1.000000e+73, .off= 1.696630320503867482e+56 },
HP{.val=1.000000e+72, .off= 5.619818905120542959e+55 },
HP{.val=1.000000e+71, .off= -4.188152556421145598e+54 },
HP{.val=1.000000e+70, .off= -7.253143638152923145e+53 },
HP{.val=1.000000e+69, .off= -7.253143638152923145e+52 },
HP{.val=1.000000e+68, .off= 4.719477774861832896e+51 },
HP{.val=1.000000e+67, .off= 1.726322421608144052e+50 },
HP{.val=1.000000e+66, .off= 5.467766613175255107e+49 },
HP{.val=1.000000e+65, .off= 7.909613737163661911e+47 },
HP{.val=1.000000e+64, .off= -2.132041900945439564e+47 },
HP{.val=1.000000e+63, .off= -5.785795994272697265e+46 },
HP{.val=1.000000e+62, .off= -3.502199685943161329e+45 },
HP{.val=1.000000e+61, .off= 5.061286470292598274e+44 },
HP{.val=1.000000e+60, .off= 5.061286470292598472e+43 },
HP{.val=1.000000e+59, .off= 2.831211950439536034e+42 },
HP{.val=1.000000e+58, .off= 5.618805100255863927e+41 },
HP{.val=1.000000e+57, .off= -4.834669211555366251e+40 },
HP{.val=1.000000e+56, .off= -9.190283508143378583e+39 },
HP{.val=1.000000e+55, .off= -1.023506702040855158e+38 },
HP{.val=1.000000e+54, .off= -7.829154040459624616e+37 },
HP{.val=1.000000e+53, .off= 6.779051325638372659e+35 },
HP{.val=1.000000e+52, .off= 6.779051325638372290e+34 },
HP{.val=1.000000e+51, .off= 6.779051325638371598e+33 },
HP{.val=1.000000e+50, .off= -7.629769841091887392e+33 },
HP{.val=1.000000e+49, .off= 5.350972305245182400e+32 },
HP{.val=1.000000e+48, .off= -4.384584304507619764e+31 },
HP{.val=1.000000e+47, .off= -4.384584304507619876e+30 },
HP{.val=1.000000e+46, .off= 6.860180964052978705e+28 },
HP{.val=1.000000e+45, .off= 7.024271097546444878e+28 },
HP{.val=1.000000e+44, .off= -8.821361405306422641e+27 },
HP{.val=1.000000e+43, .off= -1.393721169594140991e+26 },
HP{.val=1.000000e+42, .off= -4.488571267807591679e+25 },
HP{.val=1.000000e+41, .off= -6.200086450407783195e+23 },
HP{.val=1.000000e+40, .off= -3.037860284270036669e+23 },
HP{.val=1.000000e+39, .off= 6.029083362839682141e+22 },
HP{.val=1.000000e+38, .off= 2.251190176543965970e+21 },
HP{.val=1.000000e+37, .off= 4.612373417978788577e+20 },
HP{.val=1.000000e+36, .off= -4.242063737401796198e+19 },
HP{.val=1.000000e+35, .off= 3.136633892082024448e+18 },
HP{.val=1.000000e+34, .off= 5.442476901295718400e+17 },
HP{.val=1.000000e+33, .off= 5.442476901295718400e+16 },
HP{.val=1.000000e+32, .off= -5.366162204393472000e+15 },
HP{.val=1.000000e+31, .off= 3.641037050347520000e+14 },
HP{.val=1.000000e+30, .off= -1.988462483865600000e+13 },
HP{.val=1.000000e+29, .off= 8.566849142784000000e+12 },
HP{.val=1.000000e+28, .off= 4.168802631680000000e+11 },
HP{.val=1.000000e+27, .off= -1.328755507200000000e+10 },
HP{.val=1.000000e+26, .off= -4.764729344000000000e+09 },
HP{.val=1.000000e+25, .off= -9.059696640000000000e+08 },
HP{.val=1.000000e+24, .off= 1.677721600000000000e+07 },
HP{.val=1.000000e+23, .off= 8.388608000000000000e+06 },
HP{.val=1.000000e+22, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+21, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+20, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+19, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+18, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+17, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+16, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+15, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+14, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+13, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+12, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+11, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+10, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+09, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+08, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+07, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+06, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+05, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+04, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+03, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+02, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+01, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e+00, .off= 0.000000000000000000e+00 },
HP{.val=1.000000e-01, .off= -5.551115123125783010e-18 },
HP{.val=1.000000e-02, .off= -2.081668171172168436e-19 },
HP{.val=1.000000e-03, .off= -2.081668171172168557e-20 },
HP{.val=1.000000e-04, .off= -4.792173602385929943e-21 },
HP{.val=1.000000e-05, .off= -8.180305391403130547e-22 },
HP{.val=1.000000e-06, .off= 4.525188817411374069e-23 },
HP{.val=1.000000e-07, .off= 4.525188817411373922e-24 },
HP{.val=1.000000e-08, .off= -2.092256083012847109e-25 },
HP{.val=1.000000e-09, .off= -6.228159145777985254e-26 },
HP{.val=1.000000e-10, .off= -3.643219731549774344e-27 },
HP{.val=1.000000e-11, .off= 6.050303071806019080e-28 },
HP{.val=1.000000e-12, .off= 2.011335237074438524e-29 },
HP{.val=1.000000e-13, .off= -3.037374556340037101e-30 },
HP{.val=1.000000e-14, .off= 1.180690645440101289e-32 },
HP{.val=1.000000e-15, .off= -7.770539987666107583e-32 },
HP{.val=1.000000e-16, .off= 2.090221327596539779e-33 },
HP{.val=1.000000e-17, .off= -7.154242405462192144e-34 },
HP{.val=1.000000e-18, .off= -7.154242405462192572e-35 },
HP{.val=1.000000e-19, .off= 2.475407316473986894e-36 },
HP{.val=1.000000e-20, .off= 5.484672854579042914e-37 },
HP{.val=1.000000e-21, .off= 9.246254777210362522e-38 },
HP{.val=1.000000e-22, .off= -4.859677432657087182e-39 },
HP{.val=1.000000e-23, .off= 3.956530198510069291e-40 },
HP{.val=1.000000e-24, .off= 7.629950044829717753e-41 },
HP{.val=1.000000e-25, .off= -3.849486974919183692e-42 },
HP{.val=1.000000e-26, .off= -3.849486974919184170e-43 },
HP{.val=1.000000e-27, .off= -3.849486974919184070e-44 },
HP{.val=1.000000e-28, .off= 2.876745653839937870e-45 },
HP{.val=1.000000e-29, .off= 5.679342582489572168e-46 },
HP{.val=1.000000e-30, .off= -8.333642060758598930e-47 },
HP{.val=1.000000e-31, .off= -8.333642060758597958e-48 },
HP{.val=1.000000e-32, .off= -5.596730997624190224e-49 },
HP{.val=1.000000e-33, .off= -5.596730997624190604e-50 },
HP{.val=1.000000e-34, .off= 7.232539610818348498e-51 },
HP{.val=1.000000e-35, .off= -7.857545194582380514e-53 },
HP{.val=1.000000e-36, .off= 5.896157255772251528e-53 },
HP{.val=1.000000e-37, .off= -6.632427322784915796e-54 },
HP{.val=1.000000e-38, .off= 3.808059826012723592e-55 },
HP{.val=1.000000e-39, .off= 7.070712060011985131e-56 },
HP{.val=1.000000e-40, .off= 7.070712060011985584e-57 },
HP{.val=1.000000e-41, .off= -5.761291134237854167e-59 },
HP{.val=1.000000e-42, .off= -3.762312935688689794e-59 },
HP{.val=1.000000e-43, .off= -7.745042713519821150e-60 },
HP{.val=1.000000e-44, .off= 4.700987842202462817e-61 },
HP{.val=1.000000e-45, .off= 1.589480203271891964e-62 },
HP{.val=1.000000e-46, .off= -2.299904345391321765e-63 },
HP{.val=1.000000e-47, .off= 2.561826340437695261e-64 },
HP{.val=1.000000e-48, .off= 2.561826340437695345e-65 },
HP{.val=1.000000e-49, .off= 6.360053438741614633e-66 },
HP{.val=1.000000e-50, .off= -7.616223705782342295e-68 },
HP{.val=1.000000e-51, .off= -7.616223705782343324e-69 },
HP{.val=1.000000e-52, .off= -7.616223705782342295e-70 },
HP{.val=1.000000e-53, .off= -3.079876214757872338e-70 },
HP{.val=1.000000e-54, .off= -3.079876214757872821e-71 },
HP{.val=1.000000e-55, .off= 5.423954167728123147e-73 },
HP{.val=1.000000e-56, .off= -3.985444122640543680e-73 },
HP{.val=1.000000e-57, .off= 4.504255013759498850e-74 },
HP{.val=1.000000e-58, .off= -2.570494266573869991e-75 },
HP{.val=1.000000e-59, .off= -2.570494266573869930e-76 },
HP{.val=1.000000e-60, .off= 2.956653608686574324e-77 },
HP{.val=1.000000e-61, .off= -3.952281235388981376e-78 },
HP{.val=1.000000e-62, .off= -3.952281235388981376e-79 },
HP{.val=1.000000e-63, .off= -6.651083908855995172e-80 },
HP{.val=1.000000e-64, .off= 3.469426116645307030e-81 },
HP{.val=1.000000e-65, .off= 7.686305293937516319e-82 },
HP{.val=1.000000e-66, .off= 2.415206322322254927e-83 },
HP{.val=1.000000e-67, .off= 5.709643179581793251e-84 },
HP{.val=1.000000e-68, .off= -6.644495035141475923e-85 },
HP{.val=1.000000e-69, .off= 3.650620143794581913e-86 },
HP{.val=1.000000e-70, .off= 4.333966503770636492e-88 },
HP{.val=1.000000e-71, .off= 8.476455383920859113e-88 },
HP{.val=1.000000e-72, .off= 3.449543675455986564e-89 },
HP{.val=1.000000e-73, .off= 3.077238576654418974e-91 },
HP{.val=1.000000e-74, .off= 4.234998629903623140e-91 },
HP{.val=1.000000e-75, .off= 4.234998629903623412e-92 },
HP{.val=1.000000e-76, .off= 7.303182045714702338e-93 },
HP{.val=1.000000e-77, .off= 7.303182045714701699e-94 },
HP{.val=1.000000e-78, .off= 1.121271649074855759e-96 },
HP{.val=1.000000e-79, .off= 1.121271649074855863e-97 },
HP{.val=1.000000e-80, .off= 3.857468248661243988e-97 },
HP{.val=1.000000e-81, .off= 3.857468248661244248e-98 },
HP{.val=1.000000e-82, .off= 3.857468248661244410e-99 },
HP{.val=1.000000e-83, .off= -3.457651055545315679e-100 },
HP{.val=1.000000e-84, .off= -3.457651055545315933e-101 },
HP{.val=1.000000e-85, .off= 2.257285900866059216e-102 },
HP{.val=1.000000e-86, .off= -8.458220892405268345e-103 },
HP{.val=1.000000e-87, .off= -1.761029146610688867e-104 },
HP{.val=1.000000e-88, .off= 6.610460535632536565e-105 },
HP{.val=1.000000e-89, .off= -3.853901567171494935e-106 },
HP{.val=1.000000e-90, .off= 5.062493089968513723e-108 },
HP{.val=1.000000e-91, .off= -2.218844988608365240e-108 },
HP{.val=1.000000e-92, .off= 1.187522883398155383e-109 },
HP{.val=1.000000e-93, .off= 9.703442563414457296e-110 },
HP{.val=1.000000e-94, .off= 4.380992763404268896e-111 },
HP{.val=1.000000e-95, .off= 1.054461638397900823e-112 },
HP{.val=1.000000e-96, .off= 9.370789450913819736e-113 },
HP{.val=1.000000e-97, .off= -3.623472756142303998e-114 },
HP{.val=1.000000e-98, .off= 6.122223899149788839e-115 },
HP{.val=1.000000e-99, .off= -1.999189980260288281e-116 },
HP{.val=1.000000e-100, .off= -1.999189980260288281e-117 },
HP{.val=1.000000e-101, .off= -5.171617276904849634e-118 },
HP{.val=1.000000e-102, .off= 6.724985085512256320e-119 },
HP{.val=1.000000e-103, .off= 4.246526260008692213e-120 },
HP{.val=1.000000e-104, .off= 7.344599791888147003e-121 },
HP{.val=1.000000e-105, .off= 3.472007877038828407e-122 },
HP{.val=1.000000e-106, .off= 5.892377823819652194e-123 },
HP{.val=1.000000e-107, .off= -1.585470431324073925e-125 },
HP{.val=1.000000e-108, .off= -3.940375084977444795e-125 },
HP{.val=1.000000e-109, .off= 7.869099673288519908e-127 },
HP{.val=1.000000e-110, .off= -5.122196348054018581e-127 },
HP{.val=1.000000e-111, .off= -8.815387795168313713e-128 },
HP{.val=1.000000e-112, .off= 5.034080131510290214e-129 },
HP{.val=1.000000e-113, .off= 2.148774313452247863e-130 },
HP{.val=1.000000e-114, .off= -5.064490231692858416e-131 },
HP{.val=1.000000e-115, .off= -5.064490231692858166e-132 },
HP{.val=1.000000e-116, .off= 5.708726942017560559e-134 },
HP{.val=1.000000e-117, .off= -2.951229134482377772e-134 },
HP{.val=1.000000e-118, .off= 1.451398151372789513e-135 },
HP{.val=1.000000e-119, .off= -1.300243902286690040e-136 },
HP{.val=1.000000e-120, .off= 2.139308664787659449e-137 },
HP{.val=1.000000e-121, .off= 2.139308664787659329e-138 },
HP{.val=1.000000e-122, .off= -5.922142664292847471e-139 },
HP{.val=1.000000e-123, .off= -5.922142664292846912e-140 },
HP{.val=1.000000e-124, .off= 6.673875037395443799e-141 },
HP{.val=1.000000e-125, .off= -1.198636026159737932e-142 },
HP{.val=1.000000e-126, .off= 5.361789860136246995e-143 },
HP{.val=1.000000e-127, .off= -2.838742497733733936e-144 },
HP{.val=1.000000e-128, .off= -5.401408859568103261e-145 },
HP{.val=1.000000e-129, .off= 7.411922949603743011e-146 },
HP{.val=1.000000e-130, .off= -8.604741811861064385e-147 },
HP{.val=1.000000e-131, .off= 1.405673664054439890e-148 },
HP{.val=1.000000e-132, .off= 1.405673664054439933e-149 },
HP{.val=1.000000e-133, .off= -6.414963426504548053e-150 },
HP{.val=1.000000e-134, .off= -3.971014335704864578e-151 },
HP{.val=1.000000e-135, .off= -3.971014335704864748e-152 },
HP{.val=1.000000e-136, .off= -1.523438813303585576e-154 },
HP{.val=1.000000e-137, .off= 2.234325152653707766e-154 },
HP{.val=1.000000e-138, .off= -6.715683724786540160e-155 },
HP{.val=1.000000e-139, .off= -2.986513359186437306e-156 },
HP{.val=1.000000e-140, .off= 1.674949597813692102e-157 },
HP{.val=1.000000e-141, .off= -4.151879098436469092e-158 },
HP{.val=1.000000e-142, .off= -4.151879098436469295e-159 },
HP{.val=1.000000e-143, .off= 4.952540739454407825e-160 },
HP{.val=1.000000e-144, .off= 4.952540739454407667e-161 },
HP{.val=1.000000e-145, .off= 8.508954738630531443e-162 },
HP{.val=1.000000e-146, .off= -2.604839008794855481e-163 },
HP{.val=1.000000e-147, .off= 2.952057864917838382e-164 },
HP{.val=1.000000e-148, .off= 6.425118410988271757e-165 },
HP{.val=1.000000e-149, .off= 2.083792728400229858e-166 },
HP{.val=1.000000e-150, .off= -6.295358232172964237e-168 },
HP{.val=1.000000e-151, .off= 6.153785555826519421e-168 },
HP{.val=1.000000e-152, .off= -6.564942029880634994e-169 },
HP{.val=1.000000e-153, .off= -3.915207116191644540e-170 },
HP{.val=1.000000e-154, .off= 2.709130168030831503e-171 },
HP{.val=1.000000e-155, .off= -1.431080634608215966e-172 },
HP{.val=1.000000e-156, .off= -4.018712386257620994e-173 },
HP{.val=1.000000e-157, .off= 5.684906682427646782e-174 },
HP{.val=1.000000e-158, .off= -6.444617153428937489e-175 },
HP{.val=1.000000e-159, .off= 1.136335243981427681e-176 },
HP{.val=1.000000e-160, .off= 1.136335243981427725e-177 },
HP{.val=1.000000e-161, .off= -2.812077463003137395e-178 },
HP{.val=1.000000e-162, .off= 4.591196362592922204e-179 },
HP{.val=1.000000e-163, .off= 7.675893789924613703e-180 },
HP{.val=1.000000e-164, .off= 3.820022005759999543e-181 },
HP{.val=1.000000e-165, .off= -9.998177244457686588e-183 },
HP{.val=1.000000e-166, .off= -4.012217555824373639e-183 },
HP{.val=1.000000e-167, .off= -2.467177666011174334e-185 },
HP{.val=1.000000e-168, .off= -4.953592503130188139e-185 },
HP{.val=1.000000e-169, .off= -2.011795792799518887e-186 },
HP{.val=1.000000e-170, .off= 1.665450095113817423e-187 },
HP{.val=1.000000e-171, .off= 1.665450095113817487e-188 },
HP{.val=1.000000e-172, .off= -4.080246604750770577e-189 },
HP{.val=1.000000e-173, .off= -4.080246604750770677e-190 },
HP{.val=1.000000e-174, .off= 4.085789420184387951e-192 },
HP{.val=1.000000e-175, .off= 4.085789420184388146e-193 },
HP{.val=1.000000e-176, .off= 4.085789420184388146e-194 },
HP{.val=1.000000e-177, .off= 4.792197640035244894e-194 },
HP{.val=1.000000e-178, .off= 4.792197640035244742e-195 },
HP{.val=1.000000e-179, .off= -2.057206575616014662e-196 },
HP{.val=1.000000e-180, .off= -2.057206575616014662e-197 },
HP{.val=1.000000e-181, .off= -4.732755097354788053e-198 },
HP{.val=1.000000e-182, .off= -4.732755097354787867e-199 },
HP{.val=1.000000e-183, .off= -5.522105321379546765e-201 },
HP{.val=1.000000e-184, .off= -5.777891238658996019e-201 },
HP{.val=1.000000e-185, .off= 7.542096444923057046e-203 },
HP{.val=1.000000e-186, .off= 8.919335748431433483e-203 },
HP{.val=1.000000e-187, .off= -1.287071881492476028e-204 },
HP{.val=1.000000e-188, .off= 5.091932887209967018e-205 },
HP{.val=1.000000e-189, .off= -6.868701054107114024e-206 },
HP{.val=1.000000e-190, .off= -1.885103578558330118e-207 },
HP{.val=1.000000e-191, .off= -1.885103578558330205e-208 },
HP{.val=1.000000e-192, .off= -9.671974634103305058e-209 },
HP{.val=1.000000e-193, .off= -4.805180224387695640e-210 },
HP{.val=1.000000e-194, .off= -1.763433718315439838e-211 },
HP{.val=1.000000e-195, .off= -9.367799983496079132e-212 },
HP{.val=1.000000e-196, .off= -4.615071067758179837e-213 },
HP{.val=1.000000e-197, .off= 1.325840076914194777e-214 },
HP{.val=1.000000e-198, .off= 8.751979007754662425e-215 },
HP{.val=1.000000e-199, .off= 1.789973760091724198e-216 },
HP{.val=1.000000e-200, .off= 1.789973760091724077e-217 },
HP{.val=1.000000e-201, .off= 5.416018159916171171e-218 },
HP{.val=1.000000e-202, .off= -3.649092839644947067e-219 },
HP{.val=1.000000e-203, .off= -3.649092839644947067e-220 },
HP{.val=1.000000e-204, .off= -1.080338554413850956e-222 },
HP{.val=1.000000e-205, .off= -1.080338554413850841e-223 },
HP{.val=1.000000e-206, .off= -2.874486186850417807e-223 },
HP{.val=1.000000e-207, .off= 7.499710055933455072e-224 },
HP{.val=1.000000e-208, .off= -9.790617015372999087e-225 },
HP{.val=1.000000e-209, .off= -4.387389805589732612e-226 },
HP{.val=1.000000e-210, .off= -4.387389805589732612e-227 },
HP{.val=1.000000e-211, .off= -8.608661063232909897e-228 },
HP{.val=1.000000e-212, .off= 4.582811616902018972e-229 },
HP{.val=1.000000e-213, .off= 4.582811616902019155e-230 },
HP{.val=1.000000e-214, .off= 8.705146829444184930e-231 },
HP{.val=1.000000e-215, .off= -4.177150709750081830e-232 },
HP{.val=1.000000e-216, .off= -4.177150709750082366e-233 },
HP{.val=1.000000e-217, .off= -8.202868690748290237e-234 },
HP{.val=1.000000e-218, .off= -3.170721214500530119e-235 },
HP{.val=1.000000e-219, .off= -3.170721214500529857e-236 },
HP{.val=1.000000e-220, .off= 7.606440013180328441e-238 },
HP{.val=1.000000e-221, .off= -1.696459258568569049e-238 },
HP{.val=1.000000e-222, .off= -4.767838333426821244e-239 },
HP{.val=1.000000e-223, .off= 2.910609353718809138e-240 },
HP{.val=1.000000e-224, .off= -1.888420450747209784e-241 },
HP{.val=1.000000e-225, .off= 4.110366804835314035e-242 },
HP{.val=1.000000e-226, .off= 7.859608839574391006e-243 },
HP{.val=1.000000e-227, .off= 5.516332567862468419e-244 },
HP{.val=1.000000e-228, .off= -3.270953451057244613e-245 },
HP{.val=1.000000e-229, .off= -6.932322625607124670e-246 },
HP{.val=1.000000e-230, .off= -4.643966891513449762e-247 },
HP{.val=1.000000e-231, .off= 1.076922443720738305e-248 },
HP{.val=1.000000e-232, .off= -2.498633390800628939e-249 },
HP{.val=1.000000e-233, .off= 4.205533798926934891e-250 },
HP{.val=1.000000e-234, .off= 4.205533798926934891e-251 },
HP{.val=1.000000e-235, .off= 4.205533798926934697e-252 },
HP{.val=1.000000e-236, .off= -4.523850562697497656e-253 },
HP{.val=1.000000e-237, .off= 9.320146633177728298e-255 },
HP{.val=1.000000e-238, .off= 9.320146633177728062e-256 },
HP{.val=1.000000e-239, .off= -7.592774752331086440e-256 },
HP{.val=1.000000e-240, .off= 3.063212017229987840e-257 },
HP{.val=1.000000e-241, .off= 3.063212017229987562e-258 },
HP{.val=1.000000e-242, .off= 3.063212017229987562e-259 },
HP{.val=1.000000e-243, .off= 4.616527473176159842e-261 },
HP{.val=1.000000e-244, .off= 6.965550922098544975e-261 },
HP{.val=1.000000e-245, .off= 6.965550922098544749e-262 },
HP{.val=1.000000e-246, .off= 4.424965697574744679e-263 },
HP{.val=1.000000e-247, .off= -1.926497363734756420e-264 },
HP{.val=1.000000e-248, .off= 2.043167049583681740e-265 },
HP{.val=1.000000e-249, .off= -5.399953725388390154e-266 },
HP{.val=1.000000e-250, .off= -5.399953725388389982e-267 },
HP{.val=1.000000e-251, .off= -1.523328321757102663e-268 },
HP{.val=1.000000e-252, .off= 5.745344310051561161e-269 },
HP{.val=1.000000e-253, .off= -6.369110076296211879e-270 },
HP{.val=1.000000e-254, .off= 8.773957906638504842e-271 },
HP{.val=1.000000e-255, .off= -6.904595826956931908e-273 },
HP{.val=1.000000e-256, .off= 2.267170882721243669e-273 },
HP{.val=1.000000e-257, .off= 2.267170882721243669e-274 },
HP{.val=1.000000e-258, .off= 4.577819683828225398e-275 },
HP{.val=1.000000e-259, .off= -6.975424321706684210e-276 },
HP{.val=1.000000e-260, .off= 3.855741933482293648e-277 },
HP{.val=1.000000e-261, .off= 1.599248963651256552e-278 },
HP{.val=1.000000e-262, .off= -1.221367248637539543e-279 },
HP{.val=1.000000e-263, .off= -1.221367248637539494e-280 },
HP{.val=1.000000e-264, .off= -1.221367248637539647e-281 },
HP{.val=1.000000e-265, .off= 1.533140771175737943e-282 },
HP{.val=1.000000e-266, .off= 1.533140771175737895e-283 },
HP{.val=1.000000e-267, .off= 1.533140771175738074e-284 },
HP{.val=1.000000e-268, .off= 4.223090009274641634e-285 },
HP{.val=1.000000e-269, .off= 4.223090009274641634e-286 },
HP{.val=1.000000e-270, .off= -4.183001359784432924e-287 },
HP{.val=1.000000e-271, .off= 3.697709298708449474e-288 },
HP{.val=1.000000e-272, .off= 6.981338739747150474e-289 },
HP{.val=1.000000e-273, .off= -9.436808465446354751e-290 },
HP{.val=1.000000e-274, .off= 3.389869038611071740e-291 },
HP{.val=1.000000e-275, .off= 6.596538414625427829e-292 },
HP{.val=1.000000e-276, .off= -9.436808465446354618e-293 },
HP{.val=1.000000e-277, .off= 3.089243784609725523e-294 },
HP{.val=1.000000e-278, .off= 6.220756847123745836e-295 },
HP{.val=1.000000e-279, .off= -5.522417137303829470e-296 },
HP{.val=1.000000e-280, .off= 4.263561183052483059e-297 },
HP{.val=1.000000e-281, .off= -1.852675267170212272e-298 },
HP{.val=1.000000e-282, .off= -1.852675267170212378e-299 },
HP{.val=1.000000e-283, .off= 5.314789322934508480e-300 },
HP{.val=1.000000e-284, .off= -3.644541414696392675e-301 },
HP{.val=1.000000e-285, .off= -7.377595888709267777e-302 },
HP{.val=1.000000e-286, .off= -5.044436842451220838e-303 },
HP{.val=1.000000e-287, .off= -2.127988034628661760e-304 },
HP{.val=1.000000e-288, .off= -5.773549044406860911e-305 },
HP{.val=1.000000e-289, .off= -1.216597782184112068e-306 },
HP{.val=1.000000e-290, .off= -6.912786859962547924e-307 },
HP{.val=1.000000e-291, .off= 3.767567660872018813e-308 },
}; | std/fmt/errol/lookup.zig |
const std = @import("std");
const assert = std.debug.assert;
const os = std.os.windows;
const window_name = "generative art experiment 6";
const window_width = 2 * 1024;
const window_height = 2 * 1024;
const State = struct {
image: []f32,
y: u32 = 0,
};
fn update(state: *State) void {
var row: u32 = 0;
while (state.y < window_height and row < 4) : (row += 1) {
var x: u32 = 0;
while (x < window_width) : (x += 1) {
const i = x + state.y * window_width;
state.image[i * 3 + 0] = 1.0;
state.image[i * 3 + 1] = 0.0;
state.image[i * 3 + 2] = 0.0;
}
state.y += 1;
}
}
const osl = struct {
const WS_VISIBLE = 0x10000000;
const VK_ESCAPE = 0x001B;
const RECT = extern struct {
left: os.LONG,
top: os.LONG,
right: os.LONG,
bottom: os.LONG,
};
extern "kernel32" fn AdjustWindowRect(
lpRect: ?*RECT,
dwStyle: os.DWORD,
bMenu: bool,
) callconv(.Stdcall) bool;
extern "user32" fn SetProcessDPIAware() callconv(.Stdcall) bool;
extern "user32" fn SetWindowTextA(
hWnd: ?os.HWND,
lpString: os.LPCSTR,
) callconv(.Stdcall) bool;
extern "user32" fn LoadCursorA(
hInstance: ?os.HINSTANCE,
lpCursorName: os.LPCSTR,
) callconv(.Stdcall) ?os.HCURSOR;
};
fn processWindowMessage(
window: os.HWND,
message: os.UINT,
wparam: os.WPARAM,
lparam: os.LPARAM,
) callconv(.Stdcall) os.LRESULT {
const processed = switch (message) {
os.user32.WM_DESTROY => blk: {
os.user32.PostQuitMessage(0);
break :blk true;
},
os.user32.WM_KEYDOWN => blk: {
if (wparam == osl.VK_ESCAPE) {
os.user32.PostQuitMessage(0);
break :blk true;
}
break :blk false;
},
else => false,
};
return if (processed) null else os.user32.DefWindowProcA(window, message, wparam, lparam);
}
pub fn main() !void {
_ = osl.SetProcessDPIAware();
const winclass = os.user32.WNDCLASSEXA{
.style = 0,
.lpfnWndProc = processWindowMessage,
.cbClsExtra = 0,
.cbWndExtra = 0,
.hInstance = @ptrCast(os.HINSTANCE, os.kernel32.GetModuleHandleA(null)),
.hIcon = null,
.hCursor = osl.LoadCursorA(null, @intToPtr(os.LPCSTR, 32512)),
.hbrBackground = null,
.lpszMenuName = null,
.lpszClassName = window_name,
.hIconSm = null,
};
_ = os.user32.RegisterClassExA(&winclass);
const style = os.user32.WS_OVERLAPPED +
os.user32.WS_SYSMENU +
os.user32.WS_CAPTION +
os.user32.WS_MINIMIZEBOX;
var rect = osl.RECT{ .left = 0, .top = 0, .right = window_width, .bottom = window_height };
_ = osl.AdjustWindowRect(&rect, style, false);
const window = os.user32.CreateWindowExA(
0,
window_name,
window_name,
style + osl.WS_VISIBLE,
-1,
-1,
rect.right - rect.left,
rect.bottom - rect.top,
null,
null,
winclass.hInstance,
null,
);
const hdc = os.user32.GetDC(window);
{
var pfd = std.mem.zeroes(os.gdi32.PIXELFORMATDESCRIPTOR);
pfd.nSize = @sizeOf(os.gdi32.PIXELFORMATDESCRIPTOR);
pfd.nVersion = 1;
pfd.dwFlags = os.user32.PFD_SUPPORT_OPENGL +
os.user32.PFD_DOUBLEBUFFER +
os.user32.PFD_DRAW_TO_WINDOW;
pfd.iPixelType = os.user32.PFD_TYPE_RGBA;
pfd.cColorBits = 24;
const pixel_format = os.gdi32.ChoosePixelFormat(hdc, &pfd);
if (!os.gdi32.SetPixelFormat(hdc, pixel_format, &pfd)) {
std.log.err("Failed to set pixel format.", .{});
return;
}
}
var opengl32_dll = std.DynLib.open("/windows/system32/opengl32.dll") catch unreachable;
const wglCreateContext = opengl32_dll.lookup(
fn (?os.HDC) callconv(.Stdcall) ?os.HGLRC,
"wglCreateContext",
).?;
const wglDeleteContext = opengl32_dll.lookup(
fn (?os.HGLRC) callconv(.Stdcall) bool,
"wglDeleteContext",
).?;
const wglMakeCurrent = opengl32_dll.lookup(
fn (?os.HDC, ?os.HGLRC) callconv(.Stdcall) bool,
"wglMakeCurrent",
).?;
const wglGetProcAddress = opengl32_dll.lookup(
fn (os.LPCSTR) callconv(.Stdcall) ?os.FARPROC,
"wglGetProcAddress",
).?;
const opengl_context = wglCreateContext(hdc);
if (!wglMakeCurrent(hdc, opengl_context)) {
std.log.err("Failed to create OpenGL context.", .{});
return;
}
defer {
_ = wglMakeCurrent(null, null);
_ = wglDeleteContext(opengl_context);
}
const wglSwapIntervalEXT = @ptrCast(
fn (c_int) callconv(.Stdcall) bool,
wglGetProcAddress("wglSwapIntervalEXT").?,
);
_ = wglSwapIntervalEXT(1);
const glDrawPixels = opengl32_dll.lookup(
fn (c_int, c_int, c_uint, c_uint, *const c_void) callconv(.Stdcall) void,
"glDrawPixels",
).?;
const GL_FLOAT = 0x1406;
const GL_RGB = 0x1907;
const image = try std.heap.page_allocator.alloc(f32, window_width * window_height * 3);
defer std.heap.page_allocator.free(image);
std.mem.set(f32, image, 0.0);
var state = State{
.image = image,
};
while (true) {
var message = std.mem.zeroes(os.user32.MSG);
if (os.user32.PeekMessageA(&message, null, 0, 0, os.user32.PM_REMOVE)) {
_ = os.user32.DispatchMessageA(&message);
if (message.message == os.user32.WM_QUIT)
break;
} else {
update(&state);
glDrawPixels(window_width, window_height, GL_RGB, GL_FLOAT, image.ptr);
_ = os.gdi32.SwapBuffers(hdc);
}
}
} | src/main.zig |
const fmath = @import("index.zig");
pub fn fmod(comptime T: type, x: T, y: T) -> T {
switch (T) {
f32 => @inlineCall(fmod32, x, y),
f64 => @inlineCall(fmod64, x, y),
else => @compileError("fmod not implemented for " ++ @typeName(T)),
}
}
fn fmod32(x: f32, y: f32) -> f32 {
var ux = @bitCast(u32, x);
var uy = @bitCast(u32, y);
var ex = i32(ux >> 23) & 0xFF;
var ey = i32(ux >> 23) & 0xFF;
const sx = ux & 0x80000000;
if (uy << 1 == 0 or fmath.isNan(y) or ex == 0xFF) {
return (x * y) / (x * y);
}
if (ux << 1 <= uy << 1) {
if (ux << 1 == uy << 1) {
return 0 * x;
} else {
return x;
}
}
// normalize x and y
if (ex == 0) {
var i = ux << 9;
while (i >> 31 == 0) : (i <<= 1) {
ex -= 1;
}
ux <<= u32(-ex + 1);
} else {
ux &= @maxValue(u32) >> 9;
ux |= 1 << 23;
}
if (ey == 0) {
var i = uy << 9;
while (i >> 31 == 0) : (i <<= 1) {
ey -= 1;
}
uy <<= u32(-ey + 1);
} else {
uy &= @maxValue(u32) >> 9;
uy |= 1 << 23;
}
// x mod y
while (ex > ey) : (ex -= 1) {
const i = ux - uy;
if (i >> 31 == 0) {
if (i == 0) {
return 0 * x;
}
ux = i;
}
ux <<= 1;
}
{
const i = ux - uy;
if (i >> 31 == 0) {
if (i == 0) {
return 0 * x;
}
ux = i;
}
}
while (ux >> 23 == 0) : (ux <<= 1) {
ex -= 1;
}
// scale result up
if (ex > 0) {
ux -= 1 << 23;
ux |= u32(ex) << 23;
} else {
ux >>= u32(-ex + 1);
}
ux |= sx;
@bitCast(f32, ux)
}
fn fmod64(x: f64, y: f64) -> f64 {
var ux = @bitCast(u64, x);
var uy = @bitCast(u64, y);
var ex = i32(ux >> 52) & 0x7FF;
var ey = i32(ux >> 52) & 0x7FF;
const sx = ux >> 63;
if (uy << 1 == 0 or fmath.isNan(y) or ex == 0x7FF) {
return (x * y) / (x * y);
}
if (ux << 1 <= uy << 1) {
if (ux << 1 == uy << 1) {
return 0 * x;
} else {
return x;
}
}
// normalize x and y
if (ex == 0) {
var i = ux << 12;
while (i >> 63 == 0) : (i <<= 1) {
ex -= 1;
}
ux <<= u64(-ex + 1);
} else {
ux &= @maxValue(u64) >> 12;
ux |= 1 << 52;
}
if (ey == 0) {
var i = uy << 12;
while (i >> 63 == 0) : (i <<= 1) {
ey -= 1;
}
uy <<= u64(-ey + 1);
} else {
uy &= @maxValue(u64) >> 12;
uy |= 1 << 52;
}
// x mod y
while (ex > ey) : (ex -= 1) {
const i = ux - uy;
if (i >> 63 == 0) {
if (i == 0) {
return 0 * x;
}
ux = i;
}
ux <<= 1;
}
{
const i = ux - uy;
if (i >> 63 == 0) {
if (i == 0) {
return 0 * x;
}
ux = i;
}
}
while (ux >> 52 == 0) : (ux <<= 1) {
ex -= 1;
}
// scale result up
if (ex > 0) {
ux -= 1 << 52;
ux |= u64(ex) << 52;
} else {
ux >>= u64(-ex + 1);
}
ux |= sx << 63;
@bitCast(f64, ux)
}
// duplicate symbol clash with `fmod` test name
test "fmod_" {
fmath.assert(fmod(f32, 1.3, 2.5) == fmod32(1.3, 2.5));
fmath.assert(fmod(f64, 1.3, 2.5) == fmod64(1.3, 2.5));
}
test "fmod32" {
const epsilon = 0.000001;
fmath.assert(fmath.approxEq(f32, fmod32(5.2, 2.0), 1.2, epsilon));
fmath.assert(fmath.approxEq(f32, fmod32(18.5, 4.2), 1.7, epsilon));
fmath.assert(fmath.approxEq(f32, fmod32(23, 48.34), 23.0, epsilon));
fmath.assert(fmath.approxEq(f32, fmod32(123.340890, 2398.2314), 123.340889, epsilon));
}
test "fmod64" {
const epsilon = 0.000001;
fmath.assert(fmath.approxEq(f64, fmod64(5.2, 2.0), 1.2, epsilon));
fmath.assert(fmath.approxEq(f64, fmod64(18.5, 4.2), 1.7, epsilon));
fmath.assert(fmath.approxEq(f64, fmod64(23, 48.34), 23.0, epsilon));
fmath.assert(fmath.approxEq(f64, fmod64(123.340890, 2398.2314), 123.340889, epsilon));
} | src/fmod.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const ArrayList = std.ArrayList;
const debug = std.debug;
const parse = @import("parse.zig");
const compile = @import("compile.zig");
const exec = @import("exec.zig");
const Parser = parse.Parser;
const Expr = parse.Expr;
const Compiler = compile.Compiler;
const Program = compile.Program;
const Instruction = compile.Instruction;
const InputBytes = @import("input.zig").InputBytes;
pub const Regex = struct {
// Internal allocator
allocator: *Allocator,
// A compiled set of instructions
compiled: Program,
// Capture slots
slots: ArrayList(?usize),
// Original regex string
string: []const u8,
// Compile a regex, possibly returning any error which occurred.
pub fn compile(a: *Allocator, re: []const u8) !Regex {
var p = Parser.init(a);
defer p.deinit();
const expr = try p.parse(re);
var c = Compiler.init(a);
defer c.deinit();
return Regex{
.allocator = a,
.compiled = try c.compile(expr),
.slots = ArrayList(?usize).init(a),
.string = re,
};
}
pub fn deinit(re: *Regex) void {
re.slots.deinit();
re.compiled.deinit();
}
// Does the regex match at the start of the string?
pub fn match(re: *Regex, input_str: []const u8) !bool {
var input_bytes = InputBytes.init(input_str);
return exec.exec(re.allocator, re.compiled, re.compiled.start, &input_bytes.input, &re.slots);
}
// Does the regex match anywhere in the string?
pub fn partialMatch(re: *Regex, input_str: []const u8) !bool {
var input_bytes = InputBytes.init(input_str);
return exec.exec(re.allocator, re.compiled, re.compiled.find_start, &input_bytes.input, &re.slots);
}
// Where in the string does the regex and its capture groups match?
//
// Zero capture is the entire match.
pub fn captures(re: *Regex, input_str: []const u8) !?Captures {
var input_bytes = InputBytes.init(input_str);
const is_match = try exec.exec(re.allocator, re.compiled, re.compiled.find_start, &input_bytes.input, &re.slots);
if (is_match) {
return try Captures.init(input_str, &re.slots);
} else {
return null;
}
}
};
// A pair of bounds used to index into an associated slice.
pub const Span = struct {
lower: usize,
upper: usize,
};
// A set of captures of a Regex on an input slice.
pub const Captures = struct {
const Self = @This();
input: []const u8,
allocator: *Allocator,
slots: []const ?usize,
pub fn init(input: []const u8, slots: *ArrayList(?usize)) !Captures {
return Captures{
.input = input,
.allocator = slots.allocator,
.slots = try slots.allocator.dupe(?usize, slots.span()),
};
}
pub fn deinit(self: *Self) void {
self.allocator.free(self.slots);
}
pub fn len(self: *const Self) usize {
return self.slots.len / 2;
}
// Return the slice of the matching string for the specified capture index.
// If the index did not participate in the capture group null is returned.
pub fn sliceAt(self: *const Self, n: usize) ?[]const u8 {
if (self.boundsAt(n)) |span| {
return self.input[span.lower..span.upper];
}
return null;
}
// Return the substring slices of the input directly.
pub fn boundsAt(self: *const Self, n: usize) ?Span {
const base = 2 * n;
if (base < self.slots.len) {
if (self.slots[base]) |lower| {
const upper = self.slots[base + 1].?;
return Span{
.lower = lower,
.upper = upper,
};
}
}
return null;
}
}; | src/regex.zig |
const cpu = @import("cpu.zig");
const debug = @import("debug.zig");
const Cpu = cpu.Cpu;
pub const Instruction = fn (cpu: *Cpu, halfword: u16) void;
pub const INST_TABLE = [64]Instruction{
// 000000 - 001111
cpu.mov, cpu.add, cpu.sub, cpu.cmp,
cpu.shl, cpu.shr, cpu.jmp, cpu.sar,
cpu.mul, cpu.div, cpu.mulu, cpu.divu,
cpu.orop, cpu.andop, cpu.xor, cpu.not,
// 010000 - 011111
cpu.mov2, cpu.add2, cpu.setf, cpu.cmp2,
cpu.shl2, cpu.shr2, cpu.cli, cpu.sar2,
cpu.trap, cpu.reti, cpu.halt, cpu.illegal,
cpu.ldsr, cpu.stsr, cpu.sei, cpu.bit_string,
// 100000 - 101111
cpu.bcond, cpu.bcond, cpu.bcond, cpu.bcond,
cpu.bcond, cpu.bcond, cpu.bcond, cpu.bcond,
cpu.movea, cpu.addi, cpu.jr, cpu.jal,
cpu.ori, cpu.andi, cpu.xori, cpu.movhi,
// 110000 - 111111
cpu.ldb, cpu.ldh, cpu.illegal, cpu.ldw,
cpu.stb, cpu.sth, cpu.illegal, cpu.stw,
cpu.inb, cpu.inh, cpu.caxi, cpu.inw,
cpu.outb, cpu.outh, cpu.float, cpu.outw,
};
pub const DEBUG_INST_TABLE = [64]Instruction{
// 000000 - 001111
debug.mov, debug.add, debug.sub, debug.cmp,
debug.shl, debug.shr, debug.jmp, debug.sar,
debug.mul, debug.div, debug.mulu, debug.divu,
debug.orop, debug.andop, debug.xor, debug.not,
// 010000 - 011111
debug.mov2, debug.add2, debug.setf, debug.cmp2,
debug.shl2, debug.shr2, debug.cli, debug.sar2,
debug.trap, debug.reti, debug.halt, debug.illegal,
debug.ldsr, debug.stsr, debug.sei, debug.bit_string,
// 100000 - 101111
debug.bcond, debug.bcond, debug.bcond, debug.bcond,
debug.bcond, debug.bcond, debug.bcond, debug.bcond,
debug.movea, debug.addi, debug.jr, debug.jal,
debug.ori, debug.andi, debug.xori, debug.movhi,
// 110000 - 111111
debug.ldb, debug.ldh, debug.illegal, debug.ldw,
debug.stb, debug.sth, debug.illegal, debug.stw,
debug.inb, debug.inh, debug.caxi, debug.inw,
debug.outb, debug.outh, debug.float, debug.outw,
};
// bit string instructions - opcode = 011111
// 00000 sch0bsu search bit 0 upward search upward for a 0
// 00001 sch0bsd search bit 0 downward search downward for a 0
// 00010 sch1bsu search bit 1 upward search upward for a 1
// 00011 sch1bsd search bit 1 downward search downward for a 1
// 00100-00111 == illegal opcode ==
// 01000 orbsu or bit string upward dest = dest or src
// 01001 andbsu and bit string upward dest = dest and src
// 01010 xorbsu exclusive or bit string upward dest = dest xor src
// 01011 movbsu move bit string upward dest = source
// 01100 ornbsu or not bit string upward dest = dest or (not src)
// 01101 andnbsu and not bit string upward dest = dest and (not src)
// 01110 xornbsu exclusive or not bit string upward dest = dest xor (not src)
// 01111 notbsu not bit string upward dest = not src
// 10000-11111 == illegal opcode ==
// floating-point and nintendo instructions - opcode = 111110
// 000000 cmpf.s compare floating short result = reg2 - reg1
// 000001 == illegal opcode ==
// 000010 cvt.ws convert word to floating short reg2 = float reg1
// 000011 cvt.sw convert floating short to word reg2 = convert reg1
// 000100 addf.s add floating short reg2 = reg2 + reg1
// 000101 subf.s subtract floating short reg2 = reg2 - reg1
// 000110 mulf.s multiply floating short reg2 = reg2 * reg1
// 000111 divf.s divide floating short reg2 = reg2 / reg1
// 001000 xb swap low bytes reg2 bytes zyxw = zywx
// 001001 xh swap halfwords reg2 bytes zyxw = xwzy
// 001010 rev reverse bits reg2 = bit_reverse reg1
// 001011 trnc.sw truncate floating short to word reg2 = truncate reg1
// 001100 mpyhw multiply halfword signed reg2 = reg2 * reg1
// 001101-111111 == illegal opcode == | src/cpu/ops.zig |
const std = @import("std");
const assert = std.debug.assert;
const allocator = std.heap.page_allocator;
pub const IntBuf = struct {
data: []i64,
pw: usize,
pr: usize,
pub fn init(size: usize) IntBuf {
var self = IntBuf{
.data = undefined,
.pw = 0,
.pr = 0,
};
self.data = allocator.alloc(i64, size) catch @panic("FUCK\n");
std.mem.set(i64, self.data[0..], 0);
return self;
}
pub fn deinit(self: *IntBuf) void {
_ = self;
// This produces a segfault in
// @memset(non_const_ptr, undefined, bytes_len);
//
// allocator.free(self.data);
}
pub fn empty(self: IntBuf) bool {
return (self.pr >= self.pw);
}
pub fn read(self: IntBuf, pos: usize) ?i64 {
return self.data[pos];
}
pub fn write(self: *IntBuf, pos: usize, value: i64) void {
self.data[pos] = value;
}
pub fn get(self: *IntBuf) ?i64 {
if (self.empty()) {
return null;
}
const value = self.data[self.pr];
self.pr += 1;
if (self.empty()) {
self.clear();
}
return value;
}
pub fn put(self: *IntBuf, value: i64) void {
self.data[self.pw] = value;
self.pw += 1;
}
pub fn clear(self: *IntBuf) void {
self.pr = 0;
self.pw = 0;
}
};
pub const Computer = struct {
rom: IntBuf,
ram: IntBuf,
pc: usize,
inputs: IntBuf,
outputs: IntBuf,
reentrant: bool,
halted: bool,
debug: bool,
base: i64,
const OP = enum(u32) {
ADD = 1,
MUL = 2,
RDSV = 3,
PRINT = 4,
JIT = 5,
JIF = 6,
CLT = 7,
CEQ = 8,
RBO = 9,
HALT = 99,
};
const MODE = enum(u32) {
POSITION = 0,
IMMEDIATE = 1,
RELATIVE = 2,
};
pub fn init(reentrant: bool) Computer {
const mem_size = 10 * 1024;
const io_size = 10 * 1024;
var self = Computer{
.rom = IntBuf.init(mem_size),
.ram = IntBuf.init(mem_size),
.pc = 0,
.inputs = IntBuf.init(io_size),
.outputs = IntBuf.init(io_size),
.reentrant = reentrant,
.halted = false,
.debug = false,
.base = 2,
};
self.clear();
return self;
}
pub fn deinit(self: *Computer) void {
self.outputs.deinit();
self.inputs.deinit();
self.ram.deinit();
self.rom.deinit();
}
pub fn parse(self: *Computer, str: []const u8) void {
var it = std.mem.split(u8, str, ",");
while (it.next()) |what| {
const instr = std.fmt.parseInt(i64, what, 10) catch unreachable;
self.rom.put(instr);
}
self.clear();
}
pub fn get(self: Computer, pos: usize) i64 {
return self.ram.read(pos);
}
pub fn set(self: *Computer, pos: usize, val: i64) void {
self.ram.write(pos, val);
}
pub fn clear(self: *Computer) void {
if (self.debug) std.debug.warn("RESET\n", .{});
self.ram = self.rom;
self.halted = false;
self.pc = 0;
self.inputs.clear();
self.outputs.clear();
}
pub fn enqueueInput(self: *Computer, input: i64) void {
if (self.debug) std.debug.warn("ENQUEUE {}\n", .{input});
self.inputs.put(input);
}
pub fn setReentrant(self: *Computer) void {
self.reentrant = true;
}
pub fn getOutput(self: *Computer) ?i64 {
if (self.outputs.empty()) {
return null;
}
const result = self.outputs.get().?;
return result;
}
pub fn run(self: *Computer) void {
if (!self.reentrant) self.clear();
while (!self.halted) {
var instr: u32 = @intCast(u32, self.ram.read(self.pc + 0).?);
// if (self.debug) std.debug.warn("instr @ {}: {}\n", .{ self.pc, instr});
const op = @intToEnum(OP, instr % 100);
instr /= 100;
const m1 = @intToEnum(MODE, instr % 10);
instr /= 10;
const m2 = @intToEnum(MODE, instr % 10);
instr /= 10;
const m3 = @intToEnum(MODE, instr % 10);
instr /= 10;
switch (op) {
OP.HALT => {
if (self.debug) std.debug.warn("{} | HALT\n", .{self.pc});
self.halted = true;
break;
},
OP.ADD => {
const v1 = self.read_decoded(1, m1);
const v2 = self.read_decoded(2, m2);
if (self.debug) std.debug.warn("{} | ADD: {} + {}\n", .{ self.pc, v1, v2 });
self.write_decoded(3, m3, v1 + v2);
self.pc += 4;
},
OP.MUL => {
const v1 = self.read_decoded(1, m1);
const v2 = self.read_decoded(2, m2);
if (self.debug) std.debug.warn("{} | MUL: {} * {}\n", .{ self.pc, v1, v2 });
self.write_decoded(3, m3, v1 * v2);
self.pc += 4;
},
OP.RDSV => {
if (self.inputs.empty()) {
if (self.debug) std.debug.warn("{} | RDSV: PAUSED\n", .{self.pc});
break;
}
const value = self.inputs.get().?;
if (self.debug) std.debug.warn("{} | RDSV: {}\n", .{ self.pc, value });
self.write_decoded(1, m1, value);
self.pc += 2;
},
OP.PRINT => {
const v1 = self.read_decoded(1, m1);
if (self.debug) std.debug.warn("{} | PRINT: {}\n", .{ self.pc, v1 });
self.outputs.put(v1);
self.pc += 2;
},
OP.JIT => {
const v1 = self.read_decoded(1, m1);
const v2 = self.read_decoded(2, m2);
if (self.debug) std.debug.warn("{} | JIT: {} {}\n", .{ self.pc, v1, v2 });
if (v1 == 0) {
self.pc += 3;
} else {
self.pc = @intCast(usize, v2);
}
},
OP.JIF => {
const v1 = self.read_decoded(1, m1);
const v2 = self.read_decoded(2, m2);
if (self.debug) std.debug.warn("{} | JIF: {} {}\n", .{ self.pc, v1, v2 });
if (v1 == 0) {
self.pc = @intCast(usize, v2);
} else {
self.pc += 3;
}
},
OP.CLT => {
const v1 = self.read_decoded(1, m1);
const v2 = self.read_decoded(2, m2);
if (self.debug) std.debug.warn("{} | CLT: {} LT {}\n", .{ self.pc, v1, v2 });
// tried doing this way, got an error:
//
// const value: i32 = if (v1 < v2) 1 else 0;
// error: cannot store runtime value in type 'comptime_int'
//
var value: i64 = 0;
if (v1 < v2) value = 1;
self.write_decoded(3, m3, value);
self.pc += 4;
},
OP.CEQ => {
const v1 = self.read_decoded(1, m1);
const v2 = self.read_decoded(2, m2);
var value: i64 = 0;
if (v1 == v2) value = 1;
if (self.debug) std.debug.warn("{} | CEQ: {} EQ {} ? {}\n", .{ self.pc, v1, v2, value });
self.write_decoded(3, m3, value);
self.pc += 4;
},
OP.RBO => {
const v1 = self.read_decoded(1, m1);
const base = self.base;
self.base += v1;
if (self.debug) std.debug.warn("{} | RBO: {} + {} => {}\n", .{ self.pc, base, v1, self.base });
self.pc += 2;
},
}
}
}
fn read_decoded(self: Computer, pos: usize, mode: MODE) i64 {
const p = self.ram.read(self.pc + pos).?;
var v: i64 = 0;
switch (mode) {
MODE.POSITION => {
v = self.ram.read(@intCast(usize, p)).?;
// if (self.debug) std.debug.warn("READ_DECODED POSITION {} => {}\n", .{ p, v});
},
MODE.IMMEDIATE => {
v = p;
// if (self.debug) std.debug.warn("READ_DECODED IMMEDIATE => {}\n", .{ v});
},
MODE.RELATIVE => {
const q = p + self.base;
v = self.ram.read(@intCast(usize, q)).?;
// if (self.debug) std.debug.warn("READ_DECODED RELATIVE {} + {} = {} => {}\n", .{ p, self.base, q, v});
},
}
return v;
}
fn write_decoded(self: *Computer, pos: usize, mode: MODE, value: i64) void {
const p = self.ram.read(self.pc + pos).?;
// if (self.debug) std.debug.warn("WRITE_DECODED {} {}: {} => {}\n", .{ self.pc + pos, mode, p, value});
switch (mode) {
MODE.POSITION => self.ram.write(@intCast(usize, p), value),
MODE.IMMEDIATE => unreachable,
MODE.RELATIVE => self.ram.write(@intCast(usize, p + self.base), value),
}
}
}; | 2019/p15/computer.zig |
pub const D3D11_16BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 65535);
pub const D3D11_32BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 4294967295);
pub const D3D11_8BIT_INDEX_STRIP_CUT_VALUE = @as(u32, 255);
pub const D3D11_ARRAY_AXIS_ADDRESS_RANGE_BIT_COUNT = @as(u32, 9);
pub const D3D11_CLIP_OR_CULL_DISTANCE_COUNT = @as(u32, 8);
pub const D3D11_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT = @as(u32, 2);
pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_API_SLOT_COUNT = @as(u32, 14);
pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENTS = @as(u32, 4);
pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_HW_SLOT_COUNT = @as(u32, 15);
pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_PARTIAL_UPDATE_EXTENTS_BYTE_ALIGNMENT = @as(u32, 16);
pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_COUNT = @as(u32, 15);
pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READS_PER_INST = @as(u32, 1);
pub const D3D11_COMMONSHADER_CONSTANT_BUFFER_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_COMMONSHADER_FLOWCONTROL_NESTING_LIMIT = @as(u32, 64);
pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READS_PER_INST = @as(u32, 1);
pub const D3D11_COMMONSHADER_IMMEDIATE_CONSTANT_BUFFER_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_COMMONSHADER_IMMEDIATE_VALUE_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_COUNT = @as(u32, 128);
pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READS_PER_INST = @as(u32, 1);
pub const D3D11_COMMONSHADER_INPUT_RESOURCE_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_COMMONSHADER_INPUT_RESOURCE_SLOT_COUNT = @as(u32, 128);
pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_COUNT = @as(u32, 16);
pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_READS_PER_INST = @as(u32, 1);
pub const D3D11_COMMONSHADER_SAMPLER_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_COMMONSHADER_SAMPLER_SLOT_COUNT = @as(u32, 16);
pub const D3D11_COMMONSHADER_SUBROUTINE_NESTING_LIMIT = @as(u32, 32);
pub const D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_COMMONSHADER_TEMP_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_COMMONSHADER_TEMP_REGISTER_COUNT = @as(u32, 4096);
pub const D3D11_COMMONSHADER_TEMP_REGISTER_READS_PER_INST = @as(u32, 3);
pub const D3D11_COMMONSHADER_TEMP_REGISTER_READ_PORTS = @as(u32, 3);
pub const D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MAX = @as(u32, 10);
pub const D3D11_COMMONSHADER_TEXCOORD_RANGE_REDUCTION_MIN = @as(i32, -10);
pub const D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_NEGATIVE = @as(i32, -8);
pub const D3D11_COMMONSHADER_TEXEL_OFFSET_MAX_POSITIVE = @as(u32, 7);
pub const D3D11_CS_4_X_BUCKET00_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 256);
pub const D3D11_CS_4_X_BUCKET00_MAX_NUM_THREADS_PER_GROUP = @as(u32, 64);
pub const D3D11_CS_4_X_BUCKET01_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 240);
pub const D3D11_CS_4_X_BUCKET01_MAX_NUM_THREADS_PER_GROUP = @as(u32, 68);
pub const D3D11_CS_4_X_BUCKET02_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 224);
pub const D3D11_CS_4_X_BUCKET02_MAX_NUM_THREADS_PER_GROUP = @as(u32, 72);
pub const D3D11_CS_4_X_BUCKET03_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 208);
pub const D3D11_CS_4_X_BUCKET03_MAX_NUM_THREADS_PER_GROUP = @as(u32, 76);
pub const D3D11_CS_4_X_BUCKET04_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 192);
pub const D3D11_CS_4_X_BUCKET04_MAX_NUM_THREADS_PER_GROUP = @as(u32, 84);
pub const D3D11_CS_4_X_BUCKET05_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 176);
pub const D3D11_CS_4_X_BUCKET05_MAX_NUM_THREADS_PER_GROUP = @as(u32, 92);
pub const D3D11_CS_4_X_BUCKET06_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 160);
pub const D3D11_CS_4_X_BUCKET06_MAX_NUM_THREADS_PER_GROUP = @as(u32, 100);
pub const D3D11_CS_4_X_BUCKET07_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 144);
pub const D3D11_CS_4_X_BUCKET07_MAX_NUM_THREADS_PER_GROUP = @as(u32, 112);
pub const D3D11_CS_4_X_BUCKET08_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 128);
pub const D3D11_CS_4_X_BUCKET08_MAX_NUM_THREADS_PER_GROUP = @as(u32, 128);
pub const D3D11_CS_4_X_BUCKET09_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 112);
pub const D3D11_CS_4_X_BUCKET09_MAX_NUM_THREADS_PER_GROUP = @as(u32, 144);
pub const D3D11_CS_4_X_BUCKET10_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 96);
pub const D3D11_CS_4_X_BUCKET10_MAX_NUM_THREADS_PER_GROUP = @as(u32, 168);
pub const D3D11_CS_4_X_BUCKET11_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 80);
pub const D3D11_CS_4_X_BUCKET11_MAX_NUM_THREADS_PER_GROUP = @as(u32, 204);
pub const D3D11_CS_4_X_BUCKET12_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 64);
pub const D3D11_CS_4_X_BUCKET12_MAX_NUM_THREADS_PER_GROUP = @as(u32, 256);
pub const D3D11_CS_4_X_BUCKET13_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 48);
pub const D3D11_CS_4_X_BUCKET13_MAX_NUM_THREADS_PER_GROUP = @as(u32, 340);
pub const D3D11_CS_4_X_BUCKET14_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 32);
pub const D3D11_CS_4_X_BUCKET14_MAX_NUM_THREADS_PER_GROUP = @as(u32, 512);
pub const D3D11_CS_4_X_BUCKET15_MAX_BYTES_TGSM_WRITABLE_PER_THREAD = @as(u32, 16);
pub const D3D11_CS_4_X_BUCKET15_MAX_NUM_THREADS_PER_GROUP = @as(u32, 768);
pub const D3D11_CS_4_X_DISPATCH_MAX_THREAD_GROUPS_IN_Z_DIMENSION = @as(u32, 1);
pub const D3D11_CS_4_X_RAW_UAV_BYTE_ALIGNMENT = @as(u32, 256);
pub const D3D11_CS_4_X_THREAD_GROUP_MAX_THREADS_PER_GROUP = @as(u32, 768);
pub const D3D11_CS_4_X_THREAD_GROUP_MAX_X = @as(u32, 768);
pub const D3D11_CS_4_X_THREAD_GROUP_MAX_Y = @as(u32, 768);
pub const D3D11_CS_4_X_UAV_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION = @as(u32, 65535);
pub const D3D11_CS_TGSM_REGISTER_COUNT = @as(u32, 8192);
pub const D3D11_CS_TGSM_REGISTER_READS_PER_INST = @as(u32, 1);
pub const D3D11_CS_TGSM_RESOURCE_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_CS_TGSM_RESOURCE_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_CS_THREADGROUPID_REGISTER_COMPONENTS = @as(u32, 3);
pub const D3D11_CS_THREADGROUPID_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_CS_THREADIDINGROUPFLATTENED_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_CS_THREADIDINGROUP_REGISTER_COMPONENTS = @as(u32, 3);
pub const D3D11_CS_THREADIDINGROUP_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_CS_THREADID_REGISTER_COMPONENTS = @as(u32, 3);
pub const D3D11_CS_THREADID_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_CS_THREAD_GROUP_MAX_THREADS_PER_GROUP = @as(u32, 1024);
pub const D3D11_CS_THREAD_GROUP_MAX_X = @as(u32, 1024);
pub const D3D11_CS_THREAD_GROUP_MAX_Y = @as(u32, 1024);
pub const D3D11_CS_THREAD_GROUP_MAX_Z = @as(u32, 64);
pub const D3D11_CS_THREAD_GROUP_MIN_X = @as(u32, 1);
pub const D3D11_CS_THREAD_GROUP_MIN_Y = @as(u32, 1);
pub const D3D11_CS_THREAD_GROUP_MIN_Z = @as(u32, 1);
pub const D3D11_CS_THREAD_LOCAL_TEMP_REGISTER_POOL = @as(u32, 16384);
pub const D3D11_DEFAULT_BLEND_FACTOR_ALPHA = @as(f32, 1);
pub const D3D11_DEFAULT_BLEND_FACTOR_BLUE = @as(f32, 1);
pub const D3D11_DEFAULT_BLEND_FACTOR_GREEN = @as(f32, 1);
pub const D3D11_DEFAULT_BLEND_FACTOR_RED = @as(f32, 1);
pub const D3D11_DEFAULT_BORDER_COLOR_COMPONENT = @as(f32, 0);
pub const D3D11_DEFAULT_DEPTH_BIAS = @as(u32, 0);
pub const D3D11_DEFAULT_DEPTH_BIAS_CLAMP = @as(f32, 0);
pub const D3D11_DEFAULT_MAX_ANISOTROPY = @as(u32, 16);
pub const D3D11_DEFAULT_MIP_LOD_BIAS = @as(f32, 0);
pub const D3D11_DEFAULT_RENDER_TARGET_ARRAY_INDEX = @as(u32, 0);
pub const D3D11_DEFAULT_SAMPLE_MASK = @as(u32, 4294967295);
pub const D3D11_DEFAULT_SCISSOR_ENDX = @as(u32, 0);
pub const D3D11_DEFAULT_SCISSOR_ENDY = @as(u32, 0);
pub const D3D11_DEFAULT_SCISSOR_STARTX = @as(u32, 0);
pub const D3D11_DEFAULT_SCISSOR_STARTY = @as(u32, 0);
pub const D3D11_DEFAULT_SLOPE_SCALED_DEPTH_BIAS = @as(f32, 0);
pub const D3D11_DEFAULT_STENCIL_READ_MASK = @as(u32, 255);
pub const D3D11_DEFAULT_STENCIL_REFERENCE = @as(u32, 0);
pub const D3D11_DEFAULT_STENCIL_WRITE_MASK = @as(u32, 255);
pub const D3D11_DEFAULT_VIEWPORT_AND_SCISSORRECT_INDEX = @as(u32, 0);
pub const D3D11_DEFAULT_VIEWPORT_HEIGHT = @as(u32, 0);
pub const D3D11_DEFAULT_VIEWPORT_MAX_DEPTH = @as(f32, 0);
pub const D3D11_DEFAULT_VIEWPORT_MIN_DEPTH = @as(f32, 0);
pub const D3D11_DEFAULT_VIEWPORT_TOPLEFTX = @as(u32, 0);
pub const D3D11_DEFAULT_VIEWPORT_TOPLEFTY = @as(u32, 0);
pub const D3D11_DEFAULT_VIEWPORT_WIDTH = @as(u32, 0);
pub const D3D11_DS_INPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS = @as(u32, 3968);
pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_COUNT = @as(u32, 32);
pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_DS_INPUT_CONTROL_POINT_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENTS = @as(u32, 3);
pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_DS_INPUT_DOMAIN_POINT_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_COUNT = @as(u32, 32);
pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_DS_INPUT_PATCH_CONSTANT_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_DS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_DS_OUTPUT_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_DS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_DS_OUTPUT_REGISTER_COUNT = @as(u32, 32);
pub const D3D11_FLOAT16_FUSED_TOLERANCE_IN_ULP = @as(f64, 6.0e-01);
pub const D3D11_FLOAT32_MAX = @as(f32, 3.4028235e+38);
pub const D3D11_FLOAT32_TO_INTEGER_TOLERANCE_IN_ULP = @as(f32, 6.0e-01);
pub const D3D11_FLOAT_TO_SRGB_EXPONENT_DENOMINATOR = @as(f32, 2.4e+00);
pub const D3D11_FLOAT_TO_SRGB_EXPONENT_NUMERATOR = @as(f32, 1);
pub const D3D11_FLOAT_TO_SRGB_OFFSET = @as(f32, 5.5e-02);
pub const D3D11_FLOAT_TO_SRGB_SCALE_1 = @as(f32, 1.292e+01);
pub const D3D11_FLOAT_TO_SRGB_SCALE_2 = @as(f32, 1.055e+00);
pub const D3D11_FLOAT_TO_SRGB_THRESHOLD = @as(f32, 3.1308e-03);
pub const D3D11_FTOI_INSTRUCTION_MAX_INPUT = @as(f32, 2.1474836e+09);
pub const D3D11_FTOI_INSTRUCTION_MIN_INPUT = @as(f32, -2.1474836e+09);
pub const D3D11_FTOU_INSTRUCTION_MAX_INPUT = @as(f32, 4.2949673e+09);
pub const D3D11_FTOU_INSTRUCTION_MIN_INPUT = @as(f32, 0);
pub const D3D11_GS_INPUT_INSTANCE_ID_READS_PER_INST = @as(u32, 2);
pub const D3D11_GS_INPUT_INSTANCE_ID_READ_PORTS = @as(u32, 1);
pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_GS_INPUT_INSTANCE_ID_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_GS_INPUT_PRIM_CONST_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_GS_INPUT_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_GS_INPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_GS_INPUT_REGISTER_COUNT = @as(u32, 32);
pub const D3D11_GS_INPUT_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_GS_INPUT_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_GS_INPUT_REGISTER_VERTICES = @as(u32, 32);
pub const D3D11_GS_MAX_INSTANCE_COUNT = @as(u32, 32);
pub const D3D11_GS_MAX_OUTPUT_VERTEX_COUNT_ACROSS_INSTANCES = @as(u32, 1024);
pub const D3D11_GS_OUTPUT_ELEMENTS = @as(u32, 32);
pub const D3D11_GS_OUTPUT_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_GS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_GS_OUTPUT_REGISTER_COUNT = @as(u32, 32);
pub const D3D11_HS_CONTROL_POINT_PHASE_INPUT_REGISTER_COUNT = @as(u32, 32);
pub const D3D11_HS_CONTROL_POINT_PHASE_OUTPUT_REGISTER_COUNT = @as(u32, 32);
pub const D3D11_HS_CONTROL_POINT_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_HS_CONTROL_POINT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_HS_CONTROL_POINT_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_HS_CONTROL_POINT_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_HS_FORK_PHASE_INSTANCE_COUNT_UPPER_BOUND = @as(u32, 4294967295);
pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_HS_INPUT_FORK_INSTANCE_ID_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_HS_INPUT_JOIN_INSTANCE_ID_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_HS_INPUT_PRIMITIVE_ID_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_HS_JOIN_PHASE_INSTANCE_COUNT_UPPER_BOUND = @as(u32, 4294967295);
pub const D3D11_HS_MAXTESSFACTOR_LOWER_BOUND = @as(f32, 1);
pub const D3D11_HS_MAXTESSFACTOR_UPPER_BOUND = @as(f32, 64);
pub const D3D11_HS_OUTPUT_CONTROL_POINTS_MAX_TOTAL_SCALARS = @as(u32, 3968);
pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_HS_OUTPUT_CONTROL_POINT_ID_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_COUNT = @as(u32, 32);
pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_HS_OUTPUT_PATCH_CONSTANT_REGISTER_SCALAR_COMPONENTS = @as(u32, 128);
pub const D3D11_IA_DEFAULT_INDEX_BUFFER_OFFSET_IN_BYTES = @as(u32, 0);
pub const D3D11_IA_DEFAULT_PRIMITIVE_TOPOLOGY = @as(u32, 0);
pub const D3D11_IA_DEFAULT_VERTEX_BUFFER_OFFSET_IN_BYTES = @as(u32, 0);
pub const D3D11_IA_INDEX_INPUT_RESOURCE_SLOT_COUNT = @as(u32, 1);
pub const D3D11_IA_INSTANCE_ID_BIT_COUNT = @as(u32, 32);
pub const D3D11_IA_INTEGER_ARITHMETIC_BIT_COUNT = @as(u32, 32);
pub const D3D11_IA_PATCH_MAX_CONTROL_POINT_COUNT = @as(u32, 32);
pub const D3D11_IA_PRIMITIVE_ID_BIT_COUNT = @as(u32, 32);
pub const D3D11_IA_VERTEX_ID_BIT_COUNT = @as(u32, 32);
pub const D3D11_IA_VERTEX_INPUT_RESOURCE_SLOT_COUNT = @as(u32, 32);
pub const D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENTS_COMPONENTS = @as(u32, 128);
pub const D3D11_IA_VERTEX_INPUT_STRUCTURE_ELEMENT_COUNT = @as(u32, 32);
pub const D3D11_INTEGER_DIVIDE_BY_ZERO_QUOTIENT = @as(u32, 4294967295);
pub const D3D11_INTEGER_DIVIDE_BY_ZERO_REMAINDER = @as(u32, 4294967295);
pub const D3D11_KEEP_RENDER_TARGETS_AND_DEPTH_STENCIL = @as(u32, 4294967295);
pub const D3D11_KEEP_UNORDERED_ACCESS_VIEWS = @as(u32, 4294967295);
pub const D3D11_LINEAR_GAMMA = @as(f32, 1);
pub const D3D11_MAJOR_VERSION = @as(u32, 11);
pub const D3D11_MAX_BORDER_COLOR_COMPONENT = @as(f32, 1);
pub const D3D11_MAX_DEPTH = @as(f32, 1);
pub const D3D11_MAX_MAXANISOTROPY = @as(u32, 16);
pub const D3D11_MAX_MULTISAMPLE_SAMPLE_COUNT = @as(u32, 32);
pub const D3D11_MAX_POSITION_VALUE = @as(f32, 3.4028236e+34);
pub const D3D11_MAX_TEXTURE_DIMENSION_2_TO_EXP = @as(u32, 17);
pub const D3D11_MINOR_VERSION = @as(u32, 0);
pub const D3D11_MIN_BORDER_COLOR_COMPONENT = @as(f32, 0);
pub const D3D11_MIN_DEPTH = @as(f32, 0);
pub const D3D11_MIN_MAXANISOTROPY = @as(u32, 0);
pub const D3D11_MIP_LOD_BIAS_MAX = @as(f32, 1.599e+01);
pub const D3D11_MIP_LOD_BIAS_MIN = @as(f32, -16);
pub const D3D11_MIP_LOD_FRACTIONAL_BIT_COUNT = @as(u32, 8);
pub const D3D11_MIP_LOD_RANGE_BIT_COUNT = @as(u32, 8);
pub const D3D11_MULTISAMPLE_ANTIALIAS_LINE_WIDTH = @as(f32, 1.4e+00);
pub const D3D11_NONSAMPLE_FETCH_OUT_OF_RANGE_ACCESS_RESULT = @as(u32, 0);
pub const D3D11_PIXEL_ADDRESS_RANGE_BIT_COUNT = @as(u32, 15);
pub const D3D11_PRE_SCISSOR_PIXEL_ADDRESS_RANGE_BIT_COUNT = @as(u32, 16);
pub const D3D11_PS_CS_UAV_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_PS_CS_UAV_REGISTER_COUNT = @as(u32, 8);
pub const D3D11_PS_CS_UAV_REGISTER_READS_PER_INST = @as(u32, 1);
pub const D3D11_PS_CS_UAV_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_PS_FRONTFACING_DEFAULT_VALUE = @as(u32, 4294967295);
pub const D3D11_PS_FRONTFACING_FALSE_VALUE = @as(u32, 0);
pub const D3D11_PS_FRONTFACING_TRUE_VALUE = @as(u32, 4294967295);
pub const D3D11_PS_INPUT_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_PS_INPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_PS_INPUT_REGISTER_COUNT = @as(u32, 32);
pub const D3D11_PS_INPUT_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_PS_INPUT_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_PS_LEGACY_PIXEL_CENTER_FRACTIONAL_COMPONENT = @as(f32, 0);
pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_PS_OUTPUT_DEPTH_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENTS = @as(u32, 1);
pub const D3D11_PS_OUTPUT_MASK_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_PS_OUTPUT_MASK_REGISTER_COUNT = @as(u32, 1);
pub const D3D11_PS_OUTPUT_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_PS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_PS_OUTPUT_REGISTER_COUNT = @as(u32, 8);
pub const D3D11_PS_PIXEL_CENTER_FRACTIONAL_COMPONENT = @as(f32, 5.0e-01);
pub const D3D11_RAW_UAV_SRV_BYTE_ALIGNMENT = @as(u32, 16);
pub const D3D11_REQ_BLEND_OBJECT_COUNT_PER_DEVICE = @as(u32, 4096);
pub const D3D11_REQ_BUFFER_RESOURCE_TEXEL_COUNT_2_TO_EXP = @as(u32, 27);
pub const D3D11_REQ_CONSTANT_BUFFER_ELEMENT_COUNT = @as(u32, 4096);
pub const D3D11_REQ_DEPTH_STENCIL_OBJECT_COUNT_PER_DEVICE = @as(u32, 4096);
pub const D3D11_REQ_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = @as(u32, 32);
pub const D3D11_REQ_DRAW_VERTEX_COUNT_2_TO_EXP = @as(u32, 32);
pub const D3D11_REQ_FILTERING_HW_ADDRESSABLE_RESOURCE_DIMENSION = @as(u32, 16384);
pub const D3D11_REQ_GS_INVOCATION_32BIT_OUTPUT_COMPONENT_LIMIT = @as(u32, 1024);
pub const D3D11_REQ_IMMEDIATE_CONSTANT_BUFFER_ELEMENT_COUNT = @as(u32, 4096);
pub const D3D11_REQ_MAXANISOTROPY = @as(u32, 16);
pub const D3D11_REQ_MIP_LEVELS = @as(u32, 15);
pub const D3D11_REQ_MULTI_ELEMENT_STRUCTURE_SIZE_IN_BYTES = @as(u32, 2048);
pub const D3D11_REQ_RASTERIZER_OBJECT_COUNT_PER_DEVICE = @as(u32, 4096);
pub const D3D11_REQ_RENDER_TO_BUFFER_WINDOW_WIDTH = @as(u32, 16384);
pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_A_TERM = @as(u32, 128);
pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_B_TERM = @as(f32, 2.5e-01);
pub const D3D11_REQ_RESOURCE_SIZE_IN_MEGABYTES_EXPRESSION_C_TERM = @as(u32, 2048);
pub const D3D11_REQ_RESOURCE_VIEW_COUNT_PER_DEVICE_2_TO_EXP = @as(u32, 20);
pub const D3D11_REQ_SAMPLER_OBJECT_COUNT_PER_DEVICE = @as(u32, 4096);
pub const D3D11_REQ_TEXTURE1D_ARRAY_AXIS_DIMENSION = @as(u32, 2048);
pub const D3D11_REQ_TEXTURE1D_U_DIMENSION = @as(u32, 16384);
pub const D3D11_REQ_TEXTURE2D_ARRAY_AXIS_DIMENSION = @as(u32, 2048);
pub const D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION = @as(u32, 16384);
pub const D3D11_REQ_TEXTURE3D_U_V_OR_W_DIMENSION = @as(u32, 2048);
pub const D3D11_REQ_TEXTURECUBE_DIMENSION = @as(u32, 16384);
pub const D3D11_RESINFO_INSTRUCTION_MISSING_COMPONENT_RETVAL = @as(u32, 0);
pub const D3D11_SHADER_MAJOR_VERSION = @as(u32, 5);
pub const D3D11_SHADER_MAX_INSTANCES = @as(u32, 65535);
pub const D3D11_SHADER_MAX_INTERFACES = @as(u32, 253);
pub const D3D11_SHADER_MAX_INTERFACE_CALL_SITES = @as(u32, 4096);
pub const D3D11_SHADER_MAX_TYPES = @as(u32, 65535);
pub const D3D11_SHADER_MINOR_VERSION = @as(u32, 0);
pub const D3D11_SHIFT_INSTRUCTION_PAD_VALUE = @as(u32, 0);
pub const D3D11_SHIFT_INSTRUCTION_SHIFT_VALUE_BIT_COUNT = @as(u32, 5);
pub const D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT = @as(u32, 8);
pub const D3D11_SO_BUFFER_MAX_STRIDE_IN_BYTES = @as(u32, 2048);
pub const D3D11_SO_BUFFER_MAX_WRITE_WINDOW_IN_BYTES = @as(u32, 512);
pub const D3D11_SO_BUFFER_SLOT_COUNT = @as(u32, 4);
pub const D3D11_SO_DDI_REGISTER_INDEX_DENOTING_GAP = @as(u32, 4294967295);
pub const D3D11_SO_NO_RASTERIZED_STREAM = @as(u32, 4294967295);
pub const D3D11_SO_OUTPUT_COMPONENT_COUNT = @as(u32, 128);
pub const D3D11_SO_STREAM_COUNT = @as(u32, 4);
pub const D3D11_SPEC_DATE_DAY = @as(u32, 16);
pub const D3D11_SPEC_DATE_MONTH = @as(u32, 5);
pub const D3D11_SPEC_DATE_YEAR = @as(u32, 2011);
pub const D3D11_SPEC_VERSION = @as(f64, 1.07e+00);
pub const D3D11_SRGB_GAMMA = @as(f32, 2.2e+00);
pub const D3D11_SRGB_TO_FLOAT_DENOMINATOR_1 = @as(f32, 1.292e+01);
pub const D3D11_SRGB_TO_FLOAT_DENOMINATOR_2 = @as(f32, 1.055e+00);
pub const D3D11_SRGB_TO_FLOAT_EXPONENT = @as(f32, 2.4e+00);
pub const D3D11_SRGB_TO_FLOAT_OFFSET = @as(f32, 5.5e-02);
pub const D3D11_SRGB_TO_FLOAT_THRESHOLD = @as(f32, 4.045e-02);
pub const D3D11_SRGB_TO_FLOAT_TOLERANCE_IN_ULP = @as(f32, 5.0e-01);
pub const D3D11_STANDARD_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_STANDARD_COMPONENT_BIT_COUNT_DOUBLED = @as(u32, 64);
pub const D3D11_STANDARD_MAXIMUM_ELEMENT_ALIGNMENT_BYTE_MULTIPLE = @as(u32, 4);
pub const D3D11_STANDARD_PIXEL_COMPONENT_COUNT = @as(u32, 128);
pub const D3D11_STANDARD_PIXEL_ELEMENT_COUNT = @as(u32, 32);
pub const D3D11_STANDARD_VECTOR_SIZE = @as(u32, 4);
pub const D3D11_STANDARD_VERTEX_ELEMENT_COUNT = @as(u32, 32);
pub const D3D11_STANDARD_VERTEX_TOTAL_COMPONENT_COUNT = @as(u32, 64);
pub const D3D11_SUBPIXEL_FRACTIONAL_BIT_COUNT = @as(u32, 8);
pub const D3D11_SUBTEXEL_FRACTIONAL_BIT_COUNT = @as(u32, 8);
pub const D3D11_TESSELLATOR_MAX_EVEN_TESSELLATION_FACTOR = @as(u32, 64);
pub const D3D11_TESSELLATOR_MAX_ISOLINE_DENSITY_TESSELLATION_FACTOR = @as(u32, 64);
pub const D3D11_TESSELLATOR_MAX_ODD_TESSELLATION_FACTOR = @as(u32, 63);
pub const D3D11_TESSELLATOR_MAX_TESSELLATION_FACTOR = @as(u32, 64);
pub const D3D11_TESSELLATOR_MIN_EVEN_TESSELLATION_FACTOR = @as(u32, 2);
pub const D3D11_TESSELLATOR_MIN_ISOLINE_DENSITY_TESSELLATION_FACTOR = @as(u32, 1);
pub const D3D11_TESSELLATOR_MIN_ODD_TESSELLATION_FACTOR = @as(u32, 1);
pub const D3D11_TEXEL_ADDRESS_RANGE_BIT_COUNT = @as(u32, 16);
pub const D3D11_UNBOUND_MEMORY_ACCESS_RESULT = @as(u32, 0);
pub const D3D11_VIEWPORT_AND_SCISSORRECT_MAX_INDEX = @as(u32, 15);
pub const D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE = @as(u32, 16);
pub const D3D11_VIEWPORT_BOUNDS_MAX = @as(u32, 32767);
pub const D3D11_VIEWPORT_BOUNDS_MIN = @as(i32, -32768);
pub const D3D11_VS_INPUT_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_VS_INPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_VS_INPUT_REGISTER_COUNT = @as(u32, 32);
pub const D3D11_VS_INPUT_REGISTER_READS_PER_INST = @as(u32, 2);
pub const D3D11_VS_INPUT_REGISTER_READ_PORTS = @as(u32, 1);
pub const D3D11_VS_OUTPUT_REGISTER_COMPONENTS = @as(u32, 4);
pub const D3D11_VS_OUTPUT_REGISTER_COMPONENT_BIT_COUNT = @as(u32, 32);
pub const D3D11_VS_OUTPUT_REGISTER_COUNT = @as(u32, 32);
pub const D3D11_WHQL_CONTEXT_COUNT_FOR_RESOURCE_LIMIT = @as(u32, 10);
pub const D3D11_WHQL_DRAWINDEXED_INDEX_COUNT_2_TO_EXP = @as(u32, 25);
pub const D3D11_WHQL_DRAW_VERTEX_COUNT_2_TO_EXP = @as(u32, 25);
pub const D3D11_1_UAV_SLOT_COUNT = @as(u32, 64);
pub const D3D11_2_TILED_RESOURCE_TILE_SIZE_IN_BYTES = @as(u32, 65536);
pub const D3D11_4_VIDEO_DECODER_MAX_HISTOGRAM_COMPONENTS = @as(u32, 4);
pub const D3D11_4_VIDEO_DECODER_HISTOGRAM_OFFSET_ALIGNMENT = @as(u32, 256);
pub const _FACD3D11 = @as(u32, 2172);
pub const D3D11_APPEND_ALIGNED_ELEMENT = @as(u32, 4294967295);
pub const D3D11_FILTER_REDUCTION_TYPE_MASK = @as(u32, 3);
pub const D3D11_FILTER_REDUCTION_TYPE_SHIFT = @as(u32, 7);
pub const D3D11_FILTER_TYPE_MASK = @as(u32, 3);
pub const D3D11_MIN_FILTER_SHIFT = @as(u32, 4);
pub const D3D11_MAG_FILTER_SHIFT = @as(u32, 2);
pub const D3D11_MIP_FILTER_SHIFT = @as(u32, 0);
pub const D3D11_COMPARISON_FILTERING_BIT = @as(u32, 128);
pub const D3D11_ANISOTROPIC_FILTERING_BIT = @as(u32, 64);
pub const D3D11_DECODER_PROFILE_MPEG2_MOCOMP = Guid.initString("e6a9f44b-61b0-4563-9ea4-63d2a3c6fe66");
pub const D3D11_DECODER_PROFILE_MPEG2_IDCT = Guid.initString("bf22ad00-03ea-4690-8077-473346209b7e");
pub const D3D11_DECODER_PROFILE_MPEG2_VLD = Guid.initString("ee27417f-5e28-4e65-beea-1d26b508adc9");
pub const D3D11_DECODER_PROFILE_MPEG1_VLD = Guid.initString("6f3ec719-3735-42cc-8063-65cc3cb36616");
pub const D3D11_DECODER_PROFILE_MPEG2and1_VLD = Guid.initString("86695f12-340e-4f04-9fd3-9253dd327460");
pub const D3D11_DECODER_PROFILE_H264_MOCOMP_NOFGT = Guid.initString("1b81be64-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_H264_MOCOMP_FGT = Guid.initString("1b81be65-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_H264_IDCT_NOFGT = Guid.initString("1b81be66-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_H264_IDCT_FGT = Guid.initString("1b81be67-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_H264_VLD_NOFGT = Guid.initString("1b81be68-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_H264_VLD_FGT = Guid.initString("1b81be69-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_H264_VLD_WITHFMOASO_NOFGT = Guid.initString("d5f04ff9-3418-45d8-9561-32a76aae2ddd");
pub const D3D11_DECODER_PROFILE_H264_VLD_STEREO_PROGRESSIVE_NOFGT = Guid.initString("d79be8da-0cf1-4c81-b82a-69a4e236f43d");
pub const D3D11_DECODER_PROFILE_H264_VLD_STEREO_NOFGT = Guid.initString("f9aaccbb-c2b6-4cfc-8779-5707b1760552");
pub const D3D11_DECODER_PROFILE_H264_VLD_MULTIVIEW_NOFGT = Guid.initString("705b9d82-76cf-49d6-b7e6-ac8872db013c");
pub const D3D11_DECODER_PROFILE_WMV8_POSTPROC = Guid.initString("1b81be80-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_WMV8_MOCOMP = Guid.initString("1b81be81-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_WMV9_POSTPROC = Guid.initString("1b81be90-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_WMV9_MOCOMP = Guid.initString("1b81be91-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_WMV9_IDCT = Guid.initString("1b81be94-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_VC1_POSTPROC = Guid.initString("1b81bea0-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_VC1_MOCOMP = Guid.initString("1b81bea1-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_VC1_IDCT = Guid.initString("1b81bea2-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_VC1_VLD = Guid.initString("1b81bea3-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_VC1_D2010 = Guid.initString("1b81bea4-a0c7-11d3-b984-00c04f2e73c5");
pub const D3D11_DECODER_PROFILE_MPEG4PT2_VLD_SIMPLE = Guid.initString("efd64d74-c9e8-41d7-a5e9-e9b0e39fa319");
pub const D3D11_DECODER_PROFILE_MPEG4PT2_VLD_ADVSIMPLE_NOGMC = Guid.initString("ed418a9f-010d-4eda-9ae3-9a65358d8d2e");
pub const D3D11_DECODER_PROFILE_MPEG4PT2_VLD_ADVSIMPLE_GMC = Guid.initString("ab998b5b-4258-44a9-9feb-94e597a6baae");
pub const D3D11_DECODER_PROFILE_HEVC_VLD_MAIN = Guid.initString("5b11d51b-2f4c-4452-bcc3-09f2a1160cc0");
pub const D3D11_DECODER_PROFILE_HEVC_VLD_MAIN10 = Guid.initString("107af0e0-ef1a-4d19-aba8-67a163073d13");
pub const D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0 = Guid.initString("463707f8-a1d0-4585-876d-83aa6d60b89e");
pub const D3D11_DECODER_PROFILE_VP9_VLD_10BIT_PROFILE2 = Guid.initString("a4c749ef-6ecf-48aa-8448-50a7a1165ff7");
pub const D3D11_DECODER_PROFILE_VP8_VLD = Guid.initString("90b899ea-3a62-4705-88b3-8df04b2744e7");
pub const D3D11_DECODER_PROFILE_AV1_VLD_PROFILE0 = Guid.initString("b8be4ccb-cf53-46ba-8d59-d6b8a6da5d2a");
pub const D3D11_DECODER_PROFILE_AV1_VLD_PROFILE1 = Guid.initString("6936ff0f-45b1-4163-9cc1-646ef6946108");
pub const D3D11_DECODER_PROFILE_AV1_VLD_PROFILE2 = Guid.initString("0c5f2aa1-e541-4089-bb7b-98110a19d7c8");
pub const D3D11_DECODER_PROFILE_AV1_VLD_12BIT_PROFILE2 = Guid.initString("17127009-a00f-4ce1-994e-bf4081f6f3f0");
pub const D3D11_DECODER_PROFILE_AV1_VLD_12BIT_PROFILE2_420 = Guid.initString("2d80bed6-9cac-4835-9e91-327bbc4f9ee8");
pub const D3D11_CRYPTO_TYPE_AES128_CTR = Guid.initString("9b6bd711-4f74-41c9-9e7b-0be2d7d93b4f");
pub const D3D11_DECODER_ENCRYPTION_HW_CENC = Guid.initString("89d6ac4f-09f2-4229-b2cd-37740a6dfd81");
pub const D3D11_DECODER_BITSTREAM_ENCRYPTION_TYPE_CENC = Guid.initString("b0405235-c13d-44f2-9ae5-dd48e08e5b67");
pub const D3D11_DECODER_BITSTREAM_ENCRYPTION_TYPE_CBCS = Guid.initString("422d9319-9d21-4bb7-9371-faf5a82c3e04");
pub const D3D11_KEY_EXCHANGE_HW_PROTECTION = Guid.initString("b1170d8a-628d-4da3-ad3b-82ddb08b4970");
pub const D3D11_AUTHENTICATED_QUERY_PROTECTION = Guid.initString("a84eb584-c495-48aa-b94d-8bd2d6fbce05");
pub const D3D11_AUTHENTICATED_QUERY_CHANNEL_TYPE = Guid.initString("bc1b18a5-b1fb-42ab-bd94-b5828b4bf7be");
pub const D3D11_AUTHENTICATED_QUERY_DEVICE_HANDLE = Guid.initString("ec1c539d-8cff-4e2a-bcc4-f5692f99f480");
pub const D3D11_AUTHENTICATED_QUERY_CRYPTO_SESSION = Guid.initString("2634499e-d018-4d74-ac17-7f724059528d");
pub const D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_COUNT = Guid.initString("0db207b3-9450-46a6-82de-1b96d44f9cf2");
pub const D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS = Guid.initString("649bbadb-f0f4-4639-a15b-24393fc3abac");
pub const D3D11_AUTHENTICATED_QUERY_UNRESTRICTED_PROTECTED_SHARED_RESOURCE_COUNT = Guid.initString("012f0bd6-e662-4474-befd-aa53e5143c6d");
pub const D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_COUNT = Guid.initString("2c042b5e-8c07-46d5-aabe-8f75cbad4c31");
pub const D3D11_AUTHENTICATED_QUERY_OUTPUT_ID = Guid.initString("839ddca3-9b4e-41e4-b053-892bd2a11ee7");
pub const D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ATTRIBUTES = Guid.initString("6214d9d2-432c-4abb-9fce-216eea269e3b");
pub const D3D11_AUTHENTICATED_QUERY_ENCRYPTION_WHEN_ACCESSIBLE_GUID_COUNT = Guid.initString("b30f7066-203c-4b07-93fc-ceaafd61241e");
pub const D3D11_AUTHENTICATED_QUERY_ENCRYPTION_WHEN_ACCESSIBLE_GUID = Guid.initString("f83a5958-e986-4bda-beb0-411f6a7a01b7");
pub const D3D11_AUTHENTICATED_QUERY_CURRENT_ENCRYPTION_WHEN_ACCESSIBLE = Guid.initString("ec1791c7-dad3-4f15-9ec3-faa93d60d4f0");
pub const D3D11_AUTHENTICATED_CONFIGURE_INITIALIZE = Guid.initString("06114bdb-3523-470a-8dca-fbc2845154f0");
pub const D3D11_AUTHENTICATED_CONFIGURE_PROTECTION = Guid.initString("50455658-3f47-4362-bf99-bfdfcde9ed29");
pub const D3D11_AUTHENTICATED_CONFIGURE_CRYPTO_SESSION = Guid.initString("6346cc54-2cfc-4ad4-8224-d15837de7700");
pub const D3D11_AUTHENTICATED_CONFIGURE_SHARED_RESOURCE = Guid.initString("0772d047-1b40-48e8-9ca6-b5f510de9f01");
pub const D3D11_AUTHENTICATED_CONFIGURE_ENCRYPTION_WHEN_ACCESSIBLE = Guid.initString("41fff286-6ae0-4d43-9d55-a46e9efd158a");
pub const D3D11_KEY_EXCHANGE_RSAES_OAEP = Guid.initString("c1949895-d72a-4a1d-8e5d-ed857d171520");
pub const D3D11_SDK_VERSION = @as(u32, 7);
pub const D3D11_PACKED_TILE = @as(u32, 4294967295);
pub const D3D11_SDK_LAYERS_VERSION = @as(u32, 1);
pub const D3D11_DEBUG_FEATURE_FLUSH_PER_RENDER_OP = @as(u32, 1);
pub const D3D11_DEBUG_FEATURE_FINISH_PER_RENDER_OP = @as(u32, 2);
pub const D3D11_DEBUG_FEATURE_PRESENT_PER_RENDER_OP = @as(u32, 4);
pub const D3D11_DEBUG_FEATURE_ALWAYS_DISCARD_OFFERED_RESOURCE = @as(u32, 8);
pub const D3D11_DEBUG_FEATURE_NEVER_DISCARD_OFFERED_RESOURCE = @as(u32, 16);
pub const D3D11_DEBUG_FEATURE_AVOID_BEHAVIOR_CHANGING_DEBUG_AIDS = @as(u32, 64);
pub const D3D11_DEBUG_FEATURE_DISABLE_TILED_RESOURCE_MAPPING_TRACKING_AND_VALIDATION = @as(u32, 128);
pub const DXGI_DEBUG_D3D11 = Guid.initString("4b99317b-ac39-4aa6-bb0b-baa04784798f");
pub const D3D11_INFO_QUEUE_DEFAULT_MESSAGE_COUNT_LIMIT = @as(u32, 1024);
pub const D3D_RETURN_PARAMETER_INDEX = @as(i32, -1);
pub const D3D_SHADER_REQUIRES_DOUBLES = @as(u32, 1);
pub const D3D_SHADER_REQUIRES_EARLY_DEPTH_STENCIL = @as(u32, 2);
pub const D3D_SHADER_REQUIRES_UAVS_AT_EVERY_STAGE = @as(u32, 4);
pub const D3D_SHADER_REQUIRES_64_UAVS = @as(u32, 8);
pub const D3D_SHADER_REQUIRES_MINIMUM_PRECISION = @as(u32, 16);
pub const D3D_SHADER_REQUIRES_11_1_DOUBLE_EXTENSIONS = @as(u32, 32);
pub const D3D_SHADER_REQUIRES_11_1_SHADER_EXTENSIONS = @as(u32, 64);
pub const D3D_SHADER_REQUIRES_LEVEL_9_COMPARISON_FILTERING = @as(u32, 128);
pub const D3D_SHADER_REQUIRES_TILED_RESOURCES = @as(u32, 256);
pub const D3D11_TRACE_COMPONENT_X = @as(u32, 1);
pub const D3D11_TRACE_COMPONENT_Y = @as(u32, 2);
pub const D3D11_TRACE_COMPONENT_Z = @as(u32, 4);
pub const D3D11_TRACE_COMPONENT_W = @as(u32, 8);
pub const D3D11_SHADER_TRACE_FLAG_RECORD_REGISTER_WRITES = @as(u32, 1);
pub const D3D11_SHADER_TRACE_FLAG_RECORD_REGISTER_READS = @as(u32, 2);
pub const D3D11_TRACE_REGISTER_FLAGS_RELATIVE_INDEXING = @as(u32, 1);
pub const D3D11_TRACE_MISC_GS_EMIT = @as(u32, 1);
pub const D3D11_TRACE_MISC_GS_CUT = @as(u32, 2);
pub const D3D11_TRACE_MISC_PS_DISCARD = @as(u32, 4);
pub const D3D11_TRACE_MISC_GS_EMIT_STREAM = @as(u32, 8);
pub const D3D11_TRACE_MISC_GS_CUT_STREAM = @as(u32, 16);
pub const D3D11_TRACE_MISC_HALT = @as(u32, 32);
pub const D3D11_TRACE_MISC_MESSAGE = @as(u32, 64);
pub const D3DX11_FFT_MAX_PRECOMPUTE_BUFFERS = @as(u32, 4);
pub const D3DX11_FFT_MAX_TEMP_BUFFERS = @as(u32, 4);
pub const D3DX11_FFT_MAX_DIMENSIONS = @as(u32, 32);
//--------------------------------------------------------------------------------
// Section: Types (390)
//--------------------------------------------------------------------------------
pub const D3D11_INPUT_CLASSIFICATION = enum(i32) {
VERTEX_DATA = 0,
INSTANCE_DATA = 1,
};
pub const D3D11_INPUT_PER_VERTEX_DATA = D3D11_INPUT_CLASSIFICATION.VERTEX_DATA;
pub const D3D11_INPUT_PER_INSTANCE_DATA = D3D11_INPUT_CLASSIFICATION.INSTANCE_DATA;
pub const D3D11_INPUT_ELEMENT_DESC = extern struct {
SemanticName: ?[*:0]const u8,
SemanticIndex: u32,
Format: DXGI_FORMAT,
InputSlot: u32,
AlignedByteOffset: u32,
InputSlotClass: D3D11_INPUT_CLASSIFICATION,
InstanceDataStepRate: u32,
};
pub const D3D11_FILL_MODE = enum(i32) {
WIREFRAME = 2,
SOLID = 3,
};
pub const D3D11_FILL_WIREFRAME = D3D11_FILL_MODE.WIREFRAME;
pub const D3D11_FILL_SOLID = D3D11_FILL_MODE.SOLID;
pub const D3D11_CULL_MODE = enum(i32) {
NONE = 1,
FRONT = 2,
BACK = 3,
};
pub const D3D11_CULL_NONE = D3D11_CULL_MODE.NONE;
pub const D3D11_CULL_FRONT = D3D11_CULL_MODE.FRONT;
pub const D3D11_CULL_BACK = D3D11_CULL_MODE.BACK;
pub const D3D11_SO_DECLARATION_ENTRY = extern struct {
Stream: u32,
SemanticName: ?[*:0]const u8,
SemanticIndex: u32,
StartComponent: u8,
ComponentCount: u8,
OutputSlot: u8,
};
pub const D3D11_VIEWPORT = extern struct {
TopLeftX: f32,
TopLeftY: f32,
Width: f32,
Height: f32,
MinDepth: f32,
MaxDepth: f32,
};
pub const D3D11_DRAW_INSTANCED_INDIRECT_ARGS = extern struct {
VertexCountPerInstance: u32,
InstanceCount: u32,
StartVertexLocation: u32,
StartInstanceLocation: u32,
};
pub const D3D11_DRAW_INDEXED_INSTANCED_INDIRECT_ARGS = extern struct {
IndexCountPerInstance: u32,
InstanceCount: u32,
StartIndexLocation: u32,
BaseVertexLocation: i32,
StartInstanceLocation: u32,
};
pub const D3D11_RESOURCE_DIMENSION = enum(i32) {
UNKNOWN = 0,
BUFFER = 1,
TEXTURE1D = 2,
TEXTURE2D = 3,
TEXTURE3D = 4,
};
pub const D3D11_RESOURCE_DIMENSION_UNKNOWN = D3D11_RESOURCE_DIMENSION.UNKNOWN;
pub const D3D11_RESOURCE_DIMENSION_BUFFER = D3D11_RESOURCE_DIMENSION.BUFFER;
pub const D3D11_RESOURCE_DIMENSION_TEXTURE1D = D3D11_RESOURCE_DIMENSION.TEXTURE1D;
pub const D3D11_RESOURCE_DIMENSION_TEXTURE2D = D3D11_RESOURCE_DIMENSION.TEXTURE2D;
pub const D3D11_RESOURCE_DIMENSION_TEXTURE3D = D3D11_RESOURCE_DIMENSION.TEXTURE3D;
pub const D3D11_DSV_DIMENSION = enum(i32) {
UNKNOWN = 0,
TEXTURE1D = 1,
TEXTURE1DARRAY = 2,
TEXTURE2D = 3,
TEXTURE2DARRAY = 4,
TEXTURE2DMS = 5,
TEXTURE2DMSARRAY = 6,
};
pub const D3D11_DSV_DIMENSION_UNKNOWN = D3D11_DSV_DIMENSION.UNKNOWN;
pub const D3D11_DSV_DIMENSION_TEXTURE1D = D3D11_DSV_DIMENSION.TEXTURE1D;
pub const D3D11_DSV_DIMENSION_TEXTURE1DARRAY = D3D11_DSV_DIMENSION.TEXTURE1DARRAY;
pub const D3D11_DSV_DIMENSION_TEXTURE2D = D3D11_DSV_DIMENSION.TEXTURE2D;
pub const D3D11_DSV_DIMENSION_TEXTURE2DARRAY = D3D11_DSV_DIMENSION.TEXTURE2DARRAY;
pub const D3D11_DSV_DIMENSION_TEXTURE2DMS = D3D11_DSV_DIMENSION.TEXTURE2DMS;
pub const D3D11_DSV_DIMENSION_TEXTURE2DMSARRAY = D3D11_DSV_DIMENSION.TEXTURE2DMSARRAY;
pub const D3D11_RTV_DIMENSION = enum(i32) {
UNKNOWN = 0,
BUFFER = 1,
TEXTURE1D = 2,
TEXTURE1DARRAY = 3,
TEXTURE2D = 4,
TEXTURE2DARRAY = 5,
TEXTURE2DMS = 6,
TEXTURE2DMSARRAY = 7,
TEXTURE3D = 8,
};
pub const D3D11_RTV_DIMENSION_UNKNOWN = D3D11_RTV_DIMENSION.UNKNOWN;
pub const D3D11_RTV_DIMENSION_BUFFER = D3D11_RTV_DIMENSION.BUFFER;
pub const D3D11_RTV_DIMENSION_TEXTURE1D = D3D11_RTV_DIMENSION.TEXTURE1D;
pub const D3D11_RTV_DIMENSION_TEXTURE1DARRAY = D3D11_RTV_DIMENSION.TEXTURE1DARRAY;
pub const D3D11_RTV_DIMENSION_TEXTURE2D = D3D11_RTV_DIMENSION.TEXTURE2D;
pub const D3D11_RTV_DIMENSION_TEXTURE2DARRAY = D3D11_RTV_DIMENSION.TEXTURE2DARRAY;
pub const D3D11_RTV_DIMENSION_TEXTURE2DMS = D3D11_RTV_DIMENSION.TEXTURE2DMS;
pub const D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY = D3D11_RTV_DIMENSION.TEXTURE2DMSARRAY;
pub const D3D11_RTV_DIMENSION_TEXTURE3D = D3D11_RTV_DIMENSION.TEXTURE3D;
pub const D3D11_UAV_DIMENSION = enum(i32) {
UNKNOWN = 0,
BUFFER = 1,
TEXTURE1D = 2,
TEXTURE1DARRAY = 3,
TEXTURE2D = 4,
TEXTURE2DARRAY = 5,
TEXTURE3D = 8,
};
pub const D3D11_UAV_DIMENSION_UNKNOWN = D3D11_UAV_DIMENSION.UNKNOWN;
pub const D3D11_UAV_DIMENSION_BUFFER = D3D11_UAV_DIMENSION.BUFFER;
pub const D3D11_UAV_DIMENSION_TEXTURE1D = D3D11_UAV_DIMENSION.TEXTURE1D;
pub const D3D11_UAV_DIMENSION_TEXTURE1DARRAY = D3D11_UAV_DIMENSION.TEXTURE1DARRAY;
pub const D3D11_UAV_DIMENSION_TEXTURE2D = D3D11_UAV_DIMENSION.TEXTURE2D;
pub const D3D11_UAV_DIMENSION_TEXTURE2DARRAY = D3D11_UAV_DIMENSION.TEXTURE2DARRAY;
pub const D3D11_UAV_DIMENSION_TEXTURE3D = D3D11_UAV_DIMENSION.TEXTURE3D;
pub const D3D11_USAGE = enum(i32) {
DEFAULT = 0,
IMMUTABLE = 1,
DYNAMIC = 2,
STAGING = 3,
};
pub const D3D11_USAGE_DEFAULT = D3D11_USAGE.DEFAULT;
pub const D3D11_USAGE_IMMUTABLE = D3D11_USAGE.IMMUTABLE;
pub const D3D11_USAGE_DYNAMIC = D3D11_USAGE.DYNAMIC;
pub const D3D11_USAGE_STAGING = D3D11_USAGE.STAGING;
pub const D3D11_BIND_FLAG = enum(u32) {
VERTEX_BUFFER = 1,
INDEX_BUFFER = 2,
CONSTANT_BUFFER = 4,
SHADER_RESOURCE = 8,
STREAM_OUTPUT = 16,
RENDER_TARGET = 32,
DEPTH_STENCIL = 64,
UNORDERED_ACCESS = 128,
DECODER = 512,
VIDEO_ENCODER = 1024,
_,
pub fn initFlags(o: struct {
VERTEX_BUFFER: u1 = 0,
INDEX_BUFFER: u1 = 0,
CONSTANT_BUFFER: u1 = 0,
SHADER_RESOURCE: u1 = 0,
STREAM_OUTPUT: u1 = 0,
RENDER_TARGET: u1 = 0,
DEPTH_STENCIL: u1 = 0,
UNORDERED_ACCESS: u1 = 0,
DECODER: u1 = 0,
VIDEO_ENCODER: u1 = 0,
}) D3D11_BIND_FLAG {
return @intToEnum(D3D11_BIND_FLAG,
(if (o.VERTEX_BUFFER == 1) @enumToInt(D3D11_BIND_FLAG.VERTEX_BUFFER) else 0)
| (if (o.INDEX_BUFFER == 1) @enumToInt(D3D11_BIND_FLAG.INDEX_BUFFER) else 0)
| (if (o.CONSTANT_BUFFER == 1) @enumToInt(D3D11_BIND_FLAG.CONSTANT_BUFFER) else 0)
| (if (o.SHADER_RESOURCE == 1) @enumToInt(D3D11_BIND_FLAG.SHADER_RESOURCE) else 0)
| (if (o.STREAM_OUTPUT == 1) @enumToInt(D3D11_BIND_FLAG.STREAM_OUTPUT) else 0)
| (if (o.RENDER_TARGET == 1) @enumToInt(D3D11_BIND_FLAG.RENDER_TARGET) else 0)
| (if (o.DEPTH_STENCIL == 1) @enumToInt(D3D11_BIND_FLAG.DEPTH_STENCIL) else 0)
| (if (o.UNORDERED_ACCESS == 1) @enumToInt(D3D11_BIND_FLAG.UNORDERED_ACCESS) else 0)
| (if (o.DECODER == 1) @enumToInt(D3D11_BIND_FLAG.DECODER) else 0)
| (if (o.VIDEO_ENCODER == 1) @enumToInt(D3D11_BIND_FLAG.VIDEO_ENCODER) else 0)
);
}
};
pub const D3D11_BIND_VERTEX_BUFFER = D3D11_BIND_FLAG.VERTEX_BUFFER;
pub const D3D11_BIND_INDEX_BUFFER = D3D11_BIND_FLAG.INDEX_BUFFER;
pub const D3D11_BIND_CONSTANT_BUFFER = D3D11_BIND_FLAG.CONSTANT_BUFFER;
pub const D3D11_BIND_SHADER_RESOURCE = D3D11_BIND_FLAG.SHADER_RESOURCE;
pub const D3D11_BIND_STREAM_OUTPUT = D3D11_BIND_FLAG.STREAM_OUTPUT;
pub const D3D11_BIND_RENDER_TARGET = D3D11_BIND_FLAG.RENDER_TARGET;
pub const D3D11_BIND_DEPTH_STENCIL = D3D11_BIND_FLAG.DEPTH_STENCIL;
pub const D3D11_BIND_UNORDERED_ACCESS = D3D11_BIND_FLAG.UNORDERED_ACCESS;
pub const D3D11_BIND_DECODER = D3D11_BIND_FLAG.DECODER;
pub const D3D11_BIND_VIDEO_ENCODER = D3D11_BIND_FLAG.VIDEO_ENCODER;
pub const D3D11_CPU_ACCESS_FLAG = enum(u32) {
WRITE = 65536,
READ = 131072,
_,
pub fn initFlags(o: struct {
WRITE: u1 = 0,
READ: u1 = 0,
}) D3D11_CPU_ACCESS_FLAG {
return @intToEnum(D3D11_CPU_ACCESS_FLAG,
(if (o.WRITE == 1) @enumToInt(D3D11_CPU_ACCESS_FLAG.WRITE) else 0)
| (if (o.READ == 1) @enumToInt(D3D11_CPU_ACCESS_FLAG.READ) else 0)
);
}
};
pub const D3D11_CPU_ACCESS_WRITE = D3D11_CPU_ACCESS_FLAG.WRITE;
pub const D3D11_CPU_ACCESS_READ = D3D11_CPU_ACCESS_FLAG.READ;
pub const D3D11_RESOURCE_MISC_FLAG = enum(u32) {
GENERATE_MIPS = 1,
SHARED = 2,
TEXTURECUBE = 4,
DRAWINDIRECT_ARGS = 16,
BUFFER_ALLOW_RAW_VIEWS = 32,
BUFFER_STRUCTURED = 64,
RESOURCE_CLAMP = 128,
SHARED_KEYEDMUTEX = 256,
GDI_COMPATIBLE = 512,
SHARED_NTHANDLE = 2048,
RESTRICTED_CONTENT = 4096,
RESTRICT_SHARED_RESOURCE = 8192,
RESTRICT_SHARED_RESOURCE_DRIVER = 16384,
GUARDED = 32768,
TILE_POOL = 131072,
TILED = 262144,
HW_PROTECTED = 524288,
SHARED_DISPLAYABLE = 1048576,
SHARED_EXCLUSIVE_WRITER = 2097152,
_,
pub fn initFlags(o: struct {
GENERATE_MIPS: u1 = 0,
SHARED: u1 = 0,
TEXTURECUBE: u1 = 0,
DRAWINDIRECT_ARGS: u1 = 0,
BUFFER_ALLOW_RAW_VIEWS: u1 = 0,
BUFFER_STRUCTURED: u1 = 0,
RESOURCE_CLAMP: u1 = 0,
SHARED_KEYEDMUTEX: u1 = 0,
GDI_COMPATIBLE: u1 = 0,
SHARED_NTHANDLE: u1 = 0,
RESTRICTED_CONTENT: u1 = 0,
RESTRICT_SHARED_RESOURCE: u1 = 0,
RESTRICT_SHARED_RESOURCE_DRIVER: u1 = 0,
GUARDED: u1 = 0,
TILE_POOL: u1 = 0,
TILED: u1 = 0,
HW_PROTECTED: u1 = 0,
SHARED_DISPLAYABLE: u1 = 0,
SHARED_EXCLUSIVE_WRITER: u1 = 0,
}) D3D11_RESOURCE_MISC_FLAG {
return @intToEnum(D3D11_RESOURCE_MISC_FLAG,
(if (o.GENERATE_MIPS == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.GENERATE_MIPS) else 0)
| (if (o.SHARED == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.SHARED) else 0)
| (if (o.TEXTURECUBE == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.TEXTURECUBE) else 0)
| (if (o.DRAWINDIRECT_ARGS == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.DRAWINDIRECT_ARGS) else 0)
| (if (o.BUFFER_ALLOW_RAW_VIEWS == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.BUFFER_ALLOW_RAW_VIEWS) else 0)
| (if (o.BUFFER_STRUCTURED == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.BUFFER_STRUCTURED) else 0)
| (if (o.RESOURCE_CLAMP == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.RESOURCE_CLAMP) else 0)
| (if (o.SHARED_KEYEDMUTEX == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.SHARED_KEYEDMUTEX) else 0)
| (if (o.GDI_COMPATIBLE == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.GDI_COMPATIBLE) else 0)
| (if (o.SHARED_NTHANDLE == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.SHARED_NTHANDLE) else 0)
| (if (o.RESTRICTED_CONTENT == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.RESTRICTED_CONTENT) else 0)
| (if (o.RESTRICT_SHARED_RESOURCE == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.RESTRICT_SHARED_RESOURCE) else 0)
| (if (o.RESTRICT_SHARED_RESOURCE_DRIVER == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.RESTRICT_SHARED_RESOURCE_DRIVER) else 0)
| (if (o.GUARDED == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.GUARDED) else 0)
| (if (o.TILE_POOL == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.TILE_POOL) else 0)
| (if (o.TILED == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.TILED) else 0)
| (if (o.HW_PROTECTED == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.HW_PROTECTED) else 0)
| (if (o.SHARED_DISPLAYABLE == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.SHARED_DISPLAYABLE) else 0)
| (if (o.SHARED_EXCLUSIVE_WRITER == 1) @enumToInt(D3D11_RESOURCE_MISC_FLAG.SHARED_EXCLUSIVE_WRITER) else 0)
);
}
};
pub const D3D11_RESOURCE_MISC_GENERATE_MIPS = D3D11_RESOURCE_MISC_FLAG.GENERATE_MIPS;
pub const D3D11_RESOURCE_MISC_SHARED = D3D11_RESOURCE_MISC_FLAG.SHARED;
pub const D3D11_RESOURCE_MISC_TEXTURECUBE = D3D11_RESOURCE_MISC_FLAG.TEXTURECUBE;
pub const D3D11_RESOURCE_MISC_DRAWINDIRECT_ARGS = D3D11_RESOURCE_MISC_FLAG.DRAWINDIRECT_ARGS;
pub const D3D11_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS = D3D11_RESOURCE_MISC_FLAG.BUFFER_ALLOW_RAW_VIEWS;
pub const D3D11_RESOURCE_MISC_BUFFER_STRUCTURED = D3D11_RESOURCE_MISC_FLAG.BUFFER_STRUCTURED;
pub const D3D11_RESOURCE_MISC_RESOURCE_CLAMP = D3D11_RESOURCE_MISC_FLAG.RESOURCE_CLAMP;
pub const D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX = D3D11_RESOURCE_MISC_FLAG.SHARED_KEYEDMUTEX;
pub const D3D11_RESOURCE_MISC_GDI_COMPATIBLE = D3D11_RESOURCE_MISC_FLAG.GDI_COMPATIBLE;
pub const D3D11_RESOURCE_MISC_SHARED_NTHANDLE = D3D11_RESOURCE_MISC_FLAG.SHARED_NTHANDLE;
pub const D3D11_RESOURCE_MISC_RESTRICTED_CONTENT = D3D11_RESOURCE_MISC_FLAG.RESTRICTED_CONTENT;
pub const D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE = D3D11_RESOURCE_MISC_FLAG.RESTRICT_SHARED_RESOURCE;
pub const D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE_DRIVER = D3D11_RESOURCE_MISC_FLAG.RESTRICT_SHARED_RESOURCE_DRIVER;
pub const D3D11_RESOURCE_MISC_GUARDED = D3D11_RESOURCE_MISC_FLAG.GUARDED;
pub const D3D11_RESOURCE_MISC_TILE_POOL = D3D11_RESOURCE_MISC_FLAG.TILE_POOL;
pub const D3D11_RESOURCE_MISC_TILED = D3D11_RESOURCE_MISC_FLAG.TILED;
pub const D3D11_RESOURCE_MISC_HW_PROTECTED = D3D11_RESOURCE_MISC_FLAG.HW_PROTECTED;
pub const D3D11_RESOURCE_MISC_SHARED_DISPLAYABLE = D3D11_RESOURCE_MISC_FLAG.SHARED_DISPLAYABLE;
pub const D3D11_RESOURCE_MISC_SHARED_EXCLUSIVE_WRITER = D3D11_RESOURCE_MISC_FLAG.SHARED_EXCLUSIVE_WRITER;
pub const D3D11_MAP = enum(i32) {
READ = 1,
WRITE = 2,
READ_WRITE = 3,
WRITE_DISCARD = 4,
WRITE_NO_OVERWRITE = 5,
};
pub const D3D11_MAP_READ = D3D11_MAP.READ;
pub const D3D11_MAP_WRITE = D3D11_MAP.WRITE;
pub const D3D11_MAP_READ_WRITE = D3D11_MAP.READ_WRITE;
pub const D3D11_MAP_WRITE_DISCARD = D3D11_MAP.WRITE_DISCARD;
pub const D3D11_MAP_WRITE_NO_OVERWRITE = D3D11_MAP.WRITE_NO_OVERWRITE;
pub const D3D11_MAP_FLAG = enum(i32) {
T = 1048576,
};
pub const D3D11_MAP_FLAG_DO_NOT_WAIT = D3D11_MAP_FLAG.T;
pub const D3D11_RAISE_FLAG = enum(i32) {
R = 1,
};
pub const D3D11_RAISE_FLAG_DRIVER_INTERNAL_ERROR = D3D11_RAISE_FLAG.R;
pub const D3D11_CLEAR_FLAG = enum(i32) {
DEPTH = 1,
STENCIL = 2,
};
pub const D3D11_CLEAR_DEPTH = D3D11_CLEAR_FLAG.DEPTH;
pub const D3D11_CLEAR_STENCIL = D3D11_CLEAR_FLAG.STENCIL;
pub const D3D11_BOX = extern struct {
left: u32,
top: u32,
front: u32,
right: u32,
bottom: u32,
back: u32,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11DeviceChild_Value = @import("../zig.zig").Guid.initString("1841e5c8-16b0-489b-bcc8-44cfb0d5deae");
pub const IID_ID3D11DeviceChild = &IID_ID3D11DeviceChild_Value;
pub const ID3D11DeviceChild = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetDevice: fn(
self: *const ID3D11DeviceChild,
ppDevice: ?*?*ID3D11Device,
) callconv(@import("std").os.windows.WINAPI) void,
GetPrivateData: fn(
self: *const ID3D11DeviceChild,
guid: ?*const Guid,
pDataSize: ?*u32,
// TODO: what to do with BytesParamIndex 1?
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPrivateData: fn(
self: *const ID3D11DeviceChild,
guid: ?*const Guid,
DataSize: u32,
// TODO: what to do with BytesParamIndex 1?
pData: ?*const anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPrivateDataInterface: fn(
self: *const ID3D11DeviceChild,
guid: ?*const Guid,
pData: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceChild_GetDevice(self: *const T, ppDevice: ?*?*ID3D11Device) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceChild.VTable, self.vtable).GetDevice(@ptrCast(*const ID3D11DeviceChild, self), ppDevice);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceChild_GetPrivateData(self: *const T, guid: ?*const Guid, pDataSize: ?*u32, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11DeviceChild.VTable, self.vtable).GetPrivateData(@ptrCast(*const ID3D11DeviceChild, self), guid, pDataSize, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceChild_SetPrivateData(self: *const T, guid: ?*const Guid, DataSize: u32, pData: ?*const anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11DeviceChild.VTable, self.vtable).SetPrivateData(@ptrCast(*const ID3D11DeviceChild, self), guid, DataSize, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceChild_SetPrivateDataInterface(self: *const T, guid: ?*const Guid, pData: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11DeviceChild.VTable, self.vtable).SetPrivateDataInterface(@ptrCast(*const ID3D11DeviceChild, self), guid, pData);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_COMPARISON_FUNC = enum(i32) {
NEVER = 1,
LESS = 2,
EQUAL = 3,
LESS_EQUAL = 4,
GREATER = 5,
NOT_EQUAL = 6,
GREATER_EQUAL = 7,
ALWAYS = 8,
};
pub const D3D11_COMPARISON_NEVER = D3D11_COMPARISON_FUNC.NEVER;
pub const D3D11_COMPARISON_LESS = D3D11_COMPARISON_FUNC.LESS;
pub const D3D11_COMPARISON_EQUAL = D3D11_COMPARISON_FUNC.EQUAL;
pub const D3D11_COMPARISON_LESS_EQUAL = D3D11_COMPARISON_FUNC.LESS_EQUAL;
pub const D3D11_COMPARISON_GREATER = D3D11_COMPARISON_FUNC.GREATER;
pub const D3D11_COMPARISON_NOT_EQUAL = D3D11_COMPARISON_FUNC.NOT_EQUAL;
pub const D3D11_COMPARISON_GREATER_EQUAL = D3D11_COMPARISON_FUNC.GREATER_EQUAL;
pub const D3D11_COMPARISON_ALWAYS = D3D11_COMPARISON_FUNC.ALWAYS;
pub const D3D11_DEPTH_WRITE_MASK = enum(i32) {
ZERO = 0,
ALL = 1,
};
pub const D3D11_DEPTH_WRITE_MASK_ZERO = D3D11_DEPTH_WRITE_MASK.ZERO;
pub const D3D11_DEPTH_WRITE_MASK_ALL = D3D11_DEPTH_WRITE_MASK.ALL;
pub const D3D11_STENCIL_OP = enum(i32) {
KEEP = 1,
ZERO = 2,
REPLACE = 3,
INCR_SAT = 4,
DECR_SAT = 5,
INVERT = 6,
INCR = 7,
DECR = 8,
};
pub const D3D11_STENCIL_OP_KEEP = D3D11_STENCIL_OP.KEEP;
pub const D3D11_STENCIL_OP_ZERO = D3D11_STENCIL_OP.ZERO;
pub const D3D11_STENCIL_OP_REPLACE = D3D11_STENCIL_OP.REPLACE;
pub const D3D11_STENCIL_OP_INCR_SAT = D3D11_STENCIL_OP.INCR_SAT;
pub const D3D11_STENCIL_OP_DECR_SAT = D3D11_STENCIL_OP.DECR_SAT;
pub const D3D11_STENCIL_OP_INVERT = D3D11_STENCIL_OP.INVERT;
pub const D3D11_STENCIL_OP_INCR = D3D11_STENCIL_OP.INCR;
pub const D3D11_STENCIL_OP_DECR = D3D11_STENCIL_OP.DECR;
pub const D3D11_DEPTH_STENCILOP_DESC = extern struct {
StencilFailOp: D3D11_STENCIL_OP,
StencilDepthFailOp: D3D11_STENCIL_OP,
StencilPassOp: D3D11_STENCIL_OP,
StencilFunc: D3D11_COMPARISON_FUNC,
};
pub const D3D11_DEPTH_STENCIL_DESC = extern struct {
DepthEnable: BOOL,
DepthWriteMask: D3D11_DEPTH_WRITE_MASK,
DepthFunc: D3D11_COMPARISON_FUNC,
StencilEnable: BOOL,
StencilReadMask: u8,
StencilWriteMask: u8,
FrontFace: D3D11_DEPTH_STENCILOP_DESC,
BackFace: D3D11_DEPTH_STENCILOP_DESC,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11DepthStencilState_Value = @import("../zig.zig").Guid.initString("03823efb-8d8f-4e1c-9aa2-f64bb2cbfdf1");
pub const IID_ID3D11DepthStencilState = &IID_ID3D11DepthStencilState_Value;
pub const ID3D11DepthStencilState = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetDesc: fn(
self: *const ID3D11DepthStencilState,
pDesc: ?*D3D11_DEPTH_STENCIL_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DepthStencilState_GetDesc(self: *const T, pDesc: ?*D3D11_DEPTH_STENCIL_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11DepthStencilState.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11DepthStencilState, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_BLEND = enum(i32) {
ZERO = 1,
ONE = 2,
SRC_COLOR = 3,
INV_SRC_COLOR = 4,
SRC_ALPHA = 5,
INV_SRC_ALPHA = 6,
DEST_ALPHA = 7,
INV_DEST_ALPHA = 8,
DEST_COLOR = 9,
INV_DEST_COLOR = 10,
SRC_ALPHA_SAT = 11,
BLEND_FACTOR = 14,
INV_BLEND_FACTOR = 15,
SRC1_COLOR = 16,
INV_SRC1_COLOR = 17,
SRC1_ALPHA = 18,
INV_SRC1_ALPHA = 19,
};
pub const D3D11_BLEND_ZERO = D3D11_BLEND.ZERO;
pub const D3D11_BLEND_ONE = D3D11_BLEND.ONE;
pub const D3D11_BLEND_SRC_COLOR = D3D11_BLEND.SRC_COLOR;
pub const D3D11_BLEND_INV_SRC_COLOR = D3D11_BLEND.INV_SRC_COLOR;
pub const D3D11_BLEND_SRC_ALPHA = D3D11_BLEND.SRC_ALPHA;
pub const D3D11_BLEND_INV_SRC_ALPHA = D3D11_BLEND.INV_SRC_ALPHA;
pub const D3D11_BLEND_DEST_ALPHA = D3D11_BLEND.DEST_ALPHA;
pub const D3D11_BLEND_INV_DEST_ALPHA = D3D11_BLEND.INV_DEST_ALPHA;
pub const D3D11_BLEND_DEST_COLOR = D3D11_BLEND.DEST_COLOR;
pub const D3D11_BLEND_INV_DEST_COLOR = D3D11_BLEND.INV_DEST_COLOR;
pub const D3D11_BLEND_SRC_ALPHA_SAT = D3D11_BLEND.SRC_ALPHA_SAT;
pub const D3D11_BLEND_BLEND_FACTOR = D3D11_BLEND.BLEND_FACTOR;
pub const D3D11_BLEND_INV_BLEND_FACTOR = D3D11_BLEND.INV_BLEND_FACTOR;
pub const D3D11_BLEND_SRC1_COLOR = D3D11_BLEND.SRC1_COLOR;
pub const D3D11_BLEND_INV_SRC1_COLOR = D3D11_BLEND.INV_SRC1_COLOR;
pub const D3D11_BLEND_SRC1_ALPHA = D3D11_BLEND.SRC1_ALPHA;
pub const D3D11_BLEND_INV_SRC1_ALPHA = D3D11_BLEND.INV_SRC1_ALPHA;
pub const D3D11_BLEND_OP = enum(i32) {
ADD = 1,
SUBTRACT = 2,
REV_SUBTRACT = 3,
MIN = 4,
MAX = 5,
};
pub const D3D11_BLEND_OP_ADD = D3D11_BLEND_OP.ADD;
pub const D3D11_BLEND_OP_SUBTRACT = D3D11_BLEND_OP.SUBTRACT;
pub const D3D11_BLEND_OP_REV_SUBTRACT = D3D11_BLEND_OP.REV_SUBTRACT;
pub const D3D11_BLEND_OP_MIN = D3D11_BLEND_OP.MIN;
pub const D3D11_BLEND_OP_MAX = D3D11_BLEND_OP.MAX;
pub const D3D11_COLOR_WRITE_ENABLE = enum(i32) {
RED = 1,
GREEN = 2,
BLUE = 4,
ALPHA = 8,
ALL = 15,
};
pub const D3D11_COLOR_WRITE_ENABLE_RED = D3D11_COLOR_WRITE_ENABLE.RED;
pub const D3D11_COLOR_WRITE_ENABLE_GREEN = D3D11_COLOR_WRITE_ENABLE.GREEN;
pub const D3D11_COLOR_WRITE_ENABLE_BLUE = D3D11_COLOR_WRITE_ENABLE.BLUE;
pub const D3D11_COLOR_WRITE_ENABLE_ALPHA = D3D11_COLOR_WRITE_ENABLE.ALPHA;
pub const D3D11_COLOR_WRITE_ENABLE_ALL = D3D11_COLOR_WRITE_ENABLE.ALL;
pub const D3D11_RENDER_TARGET_BLEND_DESC = extern struct {
BlendEnable: BOOL,
SrcBlend: D3D11_BLEND,
DestBlend: D3D11_BLEND,
BlendOp: D3D11_BLEND_OP,
SrcBlendAlpha: D3D11_BLEND,
DestBlendAlpha: D3D11_BLEND,
BlendOpAlpha: D3D11_BLEND_OP,
RenderTargetWriteMask: u8,
};
pub const D3D11_BLEND_DESC = extern struct {
AlphaToCoverageEnable: BOOL,
IndependentBlendEnable: BOOL,
RenderTarget: [8]D3D11_RENDER_TARGET_BLEND_DESC,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11BlendState_Value = @import("../zig.zig").Guid.initString("75b68faa-347d-4159-8f45-a0640f01cd9a");
pub const IID_ID3D11BlendState = &IID_ID3D11BlendState_Value;
pub const ID3D11BlendState = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetDesc: fn(
self: *const ID3D11BlendState,
pDesc: ?*D3D11_BLEND_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11BlendState_GetDesc(self: *const T, pDesc: ?*D3D11_BLEND_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11BlendState.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11BlendState, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_RASTERIZER_DESC = extern struct {
FillMode: D3D11_FILL_MODE,
CullMode: D3D11_CULL_MODE,
FrontCounterClockwise: BOOL,
DepthBias: i32,
DepthBiasClamp: f32,
SlopeScaledDepthBias: f32,
DepthClipEnable: BOOL,
ScissorEnable: BOOL,
MultisampleEnable: BOOL,
AntialiasedLineEnable: BOOL,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11RasterizerState_Value = @import("../zig.zig").Guid.initString("9bb4ab81-ab1a-4d8f-b506-fc04200b6ee7");
pub const IID_ID3D11RasterizerState = &IID_ID3D11RasterizerState_Value;
pub const ID3D11RasterizerState = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetDesc: fn(
self: *const ID3D11RasterizerState,
pDesc: ?*D3D11_RASTERIZER_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11RasterizerState_GetDesc(self: *const T, pDesc: ?*D3D11_RASTERIZER_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11RasterizerState.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11RasterizerState, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_SUBRESOURCE_DATA = extern struct {
pSysMem: ?*const anyopaque,
SysMemPitch: u32,
SysMemSlicePitch: u32,
};
pub const D3D11_MAPPED_SUBRESOURCE = extern struct {
pData: ?*anyopaque,
RowPitch: u32,
DepthPitch: u32,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11Resource_Value = @import("../zig.zig").Guid.initString("dc8e63f3-d12b-4952-b47b-5e45026a862d");
pub const IID_ID3D11Resource = &IID_ID3D11Resource_Value;
pub const ID3D11Resource = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetType: fn(
self: *const ID3D11Resource,
pResourceDimension: ?*D3D11_RESOURCE_DIMENSION,
) callconv(@import("std").os.windows.WINAPI) void,
SetEvictionPriority: fn(
self: *const ID3D11Resource,
EvictionPriority: u32,
) callconv(@import("std").os.windows.WINAPI) void,
GetEvictionPriority: fn(
self: *const ID3D11Resource,
) callconv(@import("std").os.windows.WINAPI) u32,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Resource_GetType(self: *const T, pResourceDimension: ?*D3D11_RESOURCE_DIMENSION) callconv(.Inline) void {
return @ptrCast(*const ID3D11Resource.VTable, self.vtable).GetType(@ptrCast(*const ID3D11Resource, self), pResourceDimension);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Resource_SetEvictionPriority(self: *const T, EvictionPriority: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11Resource.VTable, self.vtable).SetEvictionPriority(@ptrCast(*const ID3D11Resource, self), EvictionPriority);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Resource_GetEvictionPriority(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11Resource.VTable, self.vtable).GetEvictionPriority(@ptrCast(*const ID3D11Resource, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_BUFFER_DESC = extern struct {
ByteWidth: u32,
Usage: D3D11_USAGE,
BindFlags: u32,
CPUAccessFlags: u32,
MiscFlags: u32,
StructureByteStride: u32,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11Buffer_Value = @import("../zig.zig").Guid.initString("48570b85-d1ee-4fcd-a250-eb350722b037");
pub const IID_ID3D11Buffer = &IID_ID3D11Buffer_Value;
pub const ID3D11Buffer = extern struct {
pub const VTable = extern struct {
base: ID3D11Resource.VTable,
GetDesc: fn(
self: *const ID3D11Buffer,
pDesc: ?*D3D11_BUFFER_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Resource.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Buffer_GetDesc(self: *const T, pDesc: ?*D3D11_BUFFER_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11Buffer.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11Buffer, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_TEXTURE1D_DESC = extern struct {
Width: u32,
MipLevels: u32,
ArraySize: u32,
Format: DXGI_FORMAT,
Usage: D3D11_USAGE,
BindFlags: u32,
CPUAccessFlags: u32,
MiscFlags: u32,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11Texture1D_Value = @import("../zig.zig").Guid.initString("f8fb5c27-c6b3-4f75-a4c8-439af2ef564c");
pub const IID_ID3D11Texture1D = &IID_ID3D11Texture1D_Value;
pub const ID3D11Texture1D = extern struct {
pub const VTable = extern struct {
base: ID3D11Resource.VTable,
GetDesc: fn(
self: *const ID3D11Texture1D,
pDesc: ?*D3D11_TEXTURE1D_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Resource.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Texture1D_GetDesc(self: *const T, pDesc: ?*D3D11_TEXTURE1D_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11Texture1D.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11Texture1D, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_TEXTURE2D_DESC = extern struct {
Width: u32,
Height: u32,
MipLevels: u32,
ArraySize: u32,
Format: DXGI_FORMAT,
SampleDesc: DXGI_SAMPLE_DESC,
Usage: D3D11_USAGE,
BindFlags: D3D11_BIND_FLAG,
CPUAccessFlags: D3D11_CPU_ACCESS_FLAG,
MiscFlags: D3D11_RESOURCE_MISC_FLAG,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11Texture2D_Value = @import("../zig.zig").Guid.initString("6f15aaf2-d208-4e89-9ab4-489535d34f9c");
pub const IID_ID3D11Texture2D = &IID_ID3D11Texture2D_Value;
pub const ID3D11Texture2D = extern struct {
pub const VTable = extern struct {
base: ID3D11Resource.VTable,
GetDesc: fn(
self: *const ID3D11Texture2D,
pDesc: ?*D3D11_TEXTURE2D_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Resource.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Texture2D_GetDesc(self: *const T, pDesc: ?*D3D11_TEXTURE2D_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11Texture2D.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11Texture2D, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_TEXTURE3D_DESC = extern struct {
Width: u32,
Height: u32,
Depth: u32,
MipLevels: u32,
Format: DXGI_FORMAT,
Usage: D3D11_USAGE,
BindFlags: u32,
CPUAccessFlags: u32,
MiscFlags: u32,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11Texture3D_Value = @import("../zig.zig").Guid.initString("037e866e-f56d-4357-a8af-9dabbe6e250e");
pub const IID_ID3D11Texture3D = &IID_ID3D11Texture3D_Value;
pub const ID3D11Texture3D = extern struct {
pub const VTable = extern struct {
base: ID3D11Resource.VTable,
GetDesc: fn(
self: *const ID3D11Texture3D,
pDesc: ?*D3D11_TEXTURE3D_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Resource.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Texture3D_GetDesc(self: *const T, pDesc: ?*D3D11_TEXTURE3D_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11Texture3D.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11Texture3D, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_TEXTURECUBE_FACE = enum(i32) {
POSITIVE_X = 0,
NEGATIVE_X = 1,
POSITIVE_Y = 2,
NEGATIVE_Y = 3,
POSITIVE_Z = 4,
NEGATIVE_Z = 5,
};
pub const D3D11_TEXTURECUBE_FACE_POSITIVE_X = D3D11_TEXTURECUBE_FACE.POSITIVE_X;
pub const D3D11_TEXTURECUBE_FACE_NEGATIVE_X = D3D11_TEXTURECUBE_FACE.NEGATIVE_X;
pub const D3D11_TEXTURECUBE_FACE_POSITIVE_Y = D3D11_TEXTURECUBE_FACE.POSITIVE_Y;
pub const D3D11_TEXTURECUBE_FACE_NEGATIVE_Y = D3D11_TEXTURECUBE_FACE.NEGATIVE_Y;
pub const D3D11_TEXTURECUBE_FACE_POSITIVE_Z = D3D11_TEXTURECUBE_FACE.POSITIVE_Z;
pub const D3D11_TEXTURECUBE_FACE_NEGATIVE_Z = D3D11_TEXTURECUBE_FACE.NEGATIVE_Z;
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11View_Value = @import("../zig.zig").Guid.initString("839d1216-bb2e-412b-b7f4-a9dbebe08ed1");
pub const IID_ID3D11View = &IID_ID3D11View_Value;
pub const ID3D11View = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetResource: fn(
self: *const ID3D11View,
ppResource: ?*?*ID3D11Resource,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11View_GetResource(self: *const T, ppResource: ?*?*ID3D11Resource) callconv(.Inline) void {
return @ptrCast(*const ID3D11View.VTable, self.vtable).GetResource(@ptrCast(*const ID3D11View, self), ppResource);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_BUFFER_SRV = extern struct {
Anonymous1: extern union {
FirstElement: u32,
ElementOffset: u32,
},
Anonymous2: extern union {
NumElements: u32,
ElementWidth: u32,
},
};
pub const D3D11_BUFFEREX_SRV_FLAG = enum(i32) {
W = 1,
};
pub const D3D11_BUFFEREX_SRV_FLAG_RAW = D3D11_BUFFEREX_SRV_FLAG.W;
pub const D3D11_BUFFEREX_SRV = extern struct {
FirstElement: u32,
NumElements: u32,
Flags: u32,
};
pub const D3D11_TEX1D_SRV = extern struct {
MostDetailedMip: u32,
MipLevels: u32,
};
pub const D3D11_TEX1D_ARRAY_SRV = extern struct {
MostDetailedMip: u32,
MipLevels: u32,
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_TEX2D_SRV = extern struct {
MostDetailedMip: u32,
MipLevels: u32,
};
pub const D3D11_TEX2D_ARRAY_SRV = extern struct {
MostDetailedMip: u32,
MipLevels: u32,
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_TEX3D_SRV = extern struct {
MostDetailedMip: u32,
MipLevels: u32,
};
pub const D3D11_TEXCUBE_SRV = extern struct {
MostDetailedMip: u32,
MipLevels: u32,
};
pub const D3D11_TEXCUBE_ARRAY_SRV = extern struct {
MostDetailedMip: u32,
MipLevels: u32,
First2DArrayFace: u32,
NumCubes: u32,
};
pub const D3D11_TEX2DMS_SRV = extern struct {
UnusedField_NothingToDefine: u32,
};
pub const D3D11_TEX2DMS_ARRAY_SRV = extern struct {
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_SHADER_RESOURCE_VIEW_DESC = extern struct {
Format: DXGI_FORMAT,
ViewDimension: D3D_SRV_DIMENSION,
Anonymous: extern union {
Buffer: D3D11_BUFFER_SRV,
Texture1D: D3D11_TEX1D_SRV,
Texture1DArray: D3D11_TEX1D_ARRAY_SRV,
Texture2D: D3D11_TEX2D_SRV,
Texture2DArray: D3D11_TEX2D_ARRAY_SRV,
Texture2DMS: D3D11_TEX2DMS_SRV,
Texture2DMSArray: D3D11_TEX2DMS_ARRAY_SRV,
Texture3D: D3D11_TEX3D_SRV,
TextureCube: D3D11_TEXCUBE_SRV,
TextureCubeArray: D3D11_TEXCUBE_ARRAY_SRV,
BufferEx: D3D11_BUFFEREX_SRV,
},
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11ShaderResourceView_Value = @import("../zig.zig").Guid.initString("b0e06fe0-8192-4e1a-b1ca-36d7414710b2");
pub const IID_ID3D11ShaderResourceView = &IID_ID3D11ShaderResourceView_Value;
pub const ID3D11ShaderResourceView = extern struct {
pub const VTable = extern struct {
base: ID3D11View.VTable,
GetDesc: fn(
self: *const ID3D11ShaderResourceView,
pDesc: ?*D3D11_SHADER_RESOURCE_VIEW_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11View.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderResourceView_GetDesc(self: *const T, pDesc: ?*D3D11_SHADER_RESOURCE_VIEW_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11ShaderResourceView.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11ShaderResourceView, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_BUFFER_RTV = extern struct {
Anonymous1: extern union {
FirstElement: u32,
ElementOffset: u32,
},
Anonymous2: extern union {
NumElements: u32,
ElementWidth: u32,
},
};
pub const D3D11_TEX1D_RTV = extern struct {
MipSlice: u32,
};
pub const D3D11_TEX1D_ARRAY_RTV = extern struct {
MipSlice: u32,
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_TEX2D_RTV = extern struct {
MipSlice: u32,
};
pub const D3D11_TEX2DMS_RTV = extern struct {
UnusedField_NothingToDefine: u32,
};
pub const D3D11_TEX2D_ARRAY_RTV = extern struct {
MipSlice: u32,
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_TEX2DMS_ARRAY_RTV = extern struct {
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_TEX3D_RTV = extern struct {
MipSlice: u32,
FirstWSlice: u32,
WSize: u32,
};
pub const D3D11_RENDER_TARGET_VIEW_DESC = extern struct {
Format: DXGI_FORMAT,
ViewDimension: D3D11_RTV_DIMENSION,
Anonymous: extern union {
Buffer: D3D11_BUFFER_RTV,
Texture1D: D3D11_TEX1D_RTV,
Texture1DArray: D3D11_TEX1D_ARRAY_RTV,
Texture2D: D3D11_TEX2D_RTV,
Texture2DArray: D3D11_TEX2D_ARRAY_RTV,
Texture2DMS: D3D11_TEX2DMS_RTV,
Texture2DMSArray: D3D11_TEX2DMS_ARRAY_RTV,
Texture3D: D3D11_TEX3D_RTV,
},
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11RenderTargetView_Value = @import("../zig.zig").Guid.initString("dfdba067-0b8d-4865-875b-d7b4516cc164");
pub const IID_ID3D11RenderTargetView = &IID_ID3D11RenderTargetView_Value;
pub const ID3D11RenderTargetView = extern struct {
pub const VTable = extern struct {
base: ID3D11View.VTable,
GetDesc: fn(
self: *const ID3D11RenderTargetView,
pDesc: ?*D3D11_RENDER_TARGET_VIEW_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11View.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11RenderTargetView_GetDesc(self: *const T, pDesc: ?*D3D11_RENDER_TARGET_VIEW_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11RenderTargetView.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11RenderTargetView, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_TEX1D_DSV = extern struct {
MipSlice: u32,
};
pub const D3D11_TEX1D_ARRAY_DSV = extern struct {
MipSlice: u32,
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_TEX2D_DSV = extern struct {
MipSlice: u32,
};
pub const D3D11_TEX2D_ARRAY_DSV = extern struct {
MipSlice: u32,
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_TEX2DMS_DSV = extern struct {
UnusedField_NothingToDefine: u32,
};
pub const D3D11_TEX2DMS_ARRAY_DSV = extern struct {
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_DSV_FLAG = enum(i32) {
DEPTH = 1,
STENCIL = 2,
};
pub const D3D11_DSV_READ_ONLY_DEPTH = D3D11_DSV_FLAG.DEPTH;
pub const D3D11_DSV_READ_ONLY_STENCIL = D3D11_DSV_FLAG.STENCIL;
pub const D3D11_DEPTH_STENCIL_VIEW_DESC = extern struct {
Format: DXGI_FORMAT,
ViewDimension: D3D11_DSV_DIMENSION,
Flags: u32,
Anonymous: extern union {
Texture1D: D3D11_TEX1D_DSV,
Texture1DArray: D3D11_TEX1D_ARRAY_DSV,
Texture2D: D3D11_TEX2D_DSV,
Texture2DArray: D3D11_TEX2D_ARRAY_DSV,
Texture2DMS: D3D11_TEX2DMS_DSV,
Texture2DMSArray: D3D11_TEX2DMS_ARRAY_DSV,
},
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11DepthStencilView_Value = @import("../zig.zig").Guid.initString("9fdac92a-1876-48c3-afad-25b94f84a9b6");
pub const IID_ID3D11DepthStencilView = &IID_ID3D11DepthStencilView_Value;
pub const ID3D11DepthStencilView = extern struct {
pub const VTable = extern struct {
base: ID3D11View.VTable,
GetDesc: fn(
self: *const ID3D11DepthStencilView,
pDesc: ?*D3D11_DEPTH_STENCIL_VIEW_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11View.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DepthStencilView_GetDesc(self: *const T, pDesc: ?*D3D11_DEPTH_STENCIL_VIEW_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11DepthStencilView.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11DepthStencilView, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_BUFFER_UAV_FLAG = enum(i32) {
RAW = 1,
APPEND = 2,
COUNTER = 4,
};
pub const D3D11_BUFFER_UAV_FLAG_RAW = D3D11_BUFFER_UAV_FLAG.RAW;
pub const D3D11_BUFFER_UAV_FLAG_APPEND = D3D11_BUFFER_UAV_FLAG.APPEND;
pub const D3D11_BUFFER_UAV_FLAG_COUNTER = D3D11_BUFFER_UAV_FLAG.COUNTER;
pub const D3D11_BUFFER_UAV = extern struct {
FirstElement: u32,
NumElements: u32,
Flags: u32,
};
pub const D3D11_TEX1D_UAV = extern struct {
MipSlice: u32,
};
pub const D3D11_TEX1D_ARRAY_UAV = extern struct {
MipSlice: u32,
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_TEX2D_UAV = extern struct {
MipSlice: u32,
};
pub const D3D11_TEX2D_ARRAY_UAV = extern struct {
MipSlice: u32,
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_TEX3D_UAV = extern struct {
MipSlice: u32,
FirstWSlice: u32,
WSize: u32,
};
pub const D3D11_UNORDERED_ACCESS_VIEW_DESC = extern struct {
Format: DXGI_FORMAT,
ViewDimension: D3D11_UAV_DIMENSION,
Anonymous: extern union {
Buffer: D3D11_BUFFER_UAV,
Texture1D: D3D11_TEX1D_UAV,
Texture1DArray: D3D11_TEX1D_ARRAY_UAV,
Texture2D: D3D11_TEX2D_UAV,
Texture2DArray: D3D11_TEX2D_ARRAY_UAV,
Texture3D: D3D11_TEX3D_UAV,
},
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11UnorderedAccessView_Value = @import("../zig.zig").Guid.initString("28acf509-7f5c-48f6-8611-f316010a6380");
pub const IID_ID3D11UnorderedAccessView = &IID_ID3D11UnorderedAccessView_Value;
pub const ID3D11UnorderedAccessView = extern struct {
pub const VTable = extern struct {
base: ID3D11View.VTable,
GetDesc: fn(
self: *const ID3D11UnorderedAccessView,
pDesc: ?*D3D11_UNORDERED_ACCESS_VIEW_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11View.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11UnorderedAccessView_GetDesc(self: *const T, pDesc: ?*D3D11_UNORDERED_ACCESS_VIEW_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11UnorderedAccessView.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11UnorderedAccessView, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11VertexShader_Value = @import("../zig.zig").Guid.initString("3b301d64-d678-4289-8897-22f8928b72f3");
pub const IID_ID3D11VertexShader = &IID_ID3D11VertexShader_Value;
pub const ID3D11VertexShader = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11HullShader_Value = @import("../zig.zig").Guid.initString("8e5c6061-628a-4c8e-8264-bbe45cb3d5dd");
pub const IID_ID3D11HullShader = &IID_ID3D11HullShader_Value;
pub const ID3D11HullShader = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11DomainShader_Value = @import("../zig.zig").Guid.initString("f582c508-0f36-490c-9977-31eece268cfa");
pub const IID_ID3D11DomainShader = &IID_ID3D11DomainShader_Value;
pub const ID3D11DomainShader = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11GeometryShader_Value = @import("../zig.zig").Guid.initString("38325b96-effb-4022-ba02-2e795b70275c");
pub const IID_ID3D11GeometryShader = &IID_ID3D11GeometryShader_Value;
pub const ID3D11GeometryShader = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11PixelShader_Value = @import("../zig.zig").Guid.initString("ea82e40d-51dc-4f33-93d4-db7c9125ae8c");
pub const IID_ID3D11PixelShader = &IID_ID3D11PixelShader_Value;
pub const ID3D11PixelShader = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11ComputeShader_Value = @import("../zig.zig").Guid.initString("4f5b196e-c2bd-495e-bd01-1fded38e4969");
pub const IID_ID3D11ComputeShader = &IID_ID3D11ComputeShader_Value;
pub const ID3D11ComputeShader = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11InputLayout_Value = @import("../zig.zig").Guid.initString("e4819ddc-4cf0-4025-bd26-5de82a3e07b7");
pub const IID_ID3D11InputLayout = &IID_ID3D11InputLayout_Value;
pub const ID3D11InputLayout = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_FILTER = enum(i32) {
MIN_MAG_MIP_POINT = 0,
MIN_MAG_POINT_MIP_LINEAR = 1,
MIN_POINT_MAG_LINEAR_MIP_POINT = 4,
MIN_POINT_MAG_MIP_LINEAR = 5,
MIN_LINEAR_MAG_MIP_POINT = 16,
MIN_LINEAR_MAG_POINT_MIP_LINEAR = 17,
MIN_MAG_LINEAR_MIP_POINT = 20,
MIN_MAG_MIP_LINEAR = 21,
ANISOTROPIC = 85,
COMPARISON_MIN_MAG_MIP_POINT = 128,
COMPARISON_MIN_MAG_POINT_MIP_LINEAR = 129,
COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = 132,
COMPARISON_MIN_POINT_MAG_MIP_LINEAR = 133,
COMPARISON_MIN_LINEAR_MAG_MIP_POINT = 144,
COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 145,
COMPARISON_MIN_MAG_LINEAR_MIP_POINT = 148,
COMPARISON_MIN_MAG_MIP_LINEAR = 149,
COMPARISON_ANISOTROPIC = 213,
MINIMUM_MIN_MAG_MIP_POINT = 256,
MINIMUM_MIN_MAG_POINT_MIP_LINEAR = 257,
MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 260,
MINIMUM_MIN_POINT_MAG_MIP_LINEAR = 261,
MINIMUM_MIN_LINEAR_MAG_MIP_POINT = 272,
MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 273,
MINIMUM_MIN_MAG_LINEAR_MIP_POINT = 276,
MINIMUM_MIN_MAG_MIP_LINEAR = 277,
MINIMUM_ANISOTROPIC = 341,
MAXIMUM_MIN_MAG_MIP_POINT = 384,
MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = 385,
MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = 388,
MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = 389,
MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = 400,
MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = 401,
MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = 404,
MAXIMUM_MIN_MAG_MIP_LINEAR = 405,
MAXIMUM_ANISOTROPIC = 469,
};
pub const D3D11_FILTER_MIN_MAG_MIP_POINT = D3D11_FILTER.MIN_MAG_MIP_POINT;
pub const D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR = D3D11_FILTER.MIN_MAG_POINT_MIP_LINEAR;
pub const D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT = D3D11_FILTER.MIN_POINT_MAG_LINEAR_MIP_POINT;
pub const D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR = D3D11_FILTER.MIN_POINT_MAG_MIP_LINEAR;
pub const D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT = D3D11_FILTER.MIN_LINEAR_MAG_MIP_POINT;
pub const D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR = D3D11_FILTER.MIN_LINEAR_MAG_POINT_MIP_LINEAR;
pub const D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT = D3D11_FILTER.MIN_MAG_LINEAR_MIP_POINT;
pub const D3D11_FILTER_MIN_MAG_MIP_LINEAR = D3D11_FILTER.MIN_MAG_MIP_LINEAR;
pub const D3D11_FILTER_ANISOTROPIC = D3D11_FILTER.ANISOTROPIC;
pub const D3D11_FILTER_COMPARISON_MIN_MAG_MIP_POINT = D3D11_FILTER.COMPARISON_MIN_MAG_MIP_POINT;
pub const D3D11_FILTER_COMPARISON_MIN_MAG_POINT_MIP_LINEAR = D3D11_FILTER.COMPARISON_MIN_MAG_POINT_MIP_LINEAR;
pub const D3D11_FILTER_COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT = D3D11_FILTER.COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT;
pub const D3D11_FILTER_COMPARISON_MIN_POINT_MAG_MIP_LINEAR = D3D11_FILTER.COMPARISON_MIN_POINT_MAG_MIP_LINEAR;
pub const D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_MIP_POINT = D3D11_FILTER.COMPARISON_MIN_LINEAR_MAG_MIP_POINT;
pub const D3D11_FILTER_COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR = D3D11_FILTER.COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
pub const D3D11_FILTER_COMPARISON_MIN_MAG_LINEAR_MIP_POINT = D3D11_FILTER.COMPARISON_MIN_MAG_LINEAR_MIP_POINT;
pub const D3D11_FILTER_COMPARISON_MIN_MAG_MIP_LINEAR = D3D11_FILTER.COMPARISON_MIN_MAG_MIP_LINEAR;
pub const D3D11_FILTER_COMPARISON_ANISOTROPIC = D3D11_FILTER.COMPARISON_ANISOTROPIC;
pub const D3D11_FILTER_MINIMUM_MIN_MAG_MIP_POINT = D3D11_FILTER.MINIMUM_MIN_MAG_MIP_POINT;
pub const D3D11_FILTER_MINIMUM_MIN_MAG_POINT_MIP_LINEAR = D3D11_FILTER.MINIMUM_MIN_MAG_POINT_MIP_LINEAR;
pub const D3D11_FILTER_MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = D3D11_FILTER.MINIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT;
pub const D3D11_FILTER_MINIMUM_MIN_POINT_MAG_MIP_LINEAR = D3D11_FILTER.MINIMUM_MIN_POINT_MAG_MIP_LINEAR;
pub const D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_MIP_POINT = D3D11_FILTER.MINIMUM_MIN_LINEAR_MAG_MIP_POINT;
pub const D3D11_FILTER_MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = D3D11_FILTER.MINIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
pub const D3D11_FILTER_MINIMUM_MIN_MAG_LINEAR_MIP_POINT = D3D11_FILTER.MINIMUM_MIN_MAG_LINEAR_MIP_POINT;
pub const D3D11_FILTER_MINIMUM_MIN_MAG_MIP_LINEAR = D3D11_FILTER.MINIMUM_MIN_MAG_MIP_LINEAR;
pub const D3D11_FILTER_MINIMUM_ANISOTROPIC = D3D11_FILTER.MINIMUM_ANISOTROPIC;
pub const D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_POINT = D3D11_FILTER.MAXIMUM_MIN_MAG_MIP_POINT;
pub const D3D11_FILTER_MAXIMUM_MIN_MAG_POINT_MIP_LINEAR = D3D11_FILTER.MAXIMUM_MIN_MAG_POINT_MIP_LINEAR;
pub const D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT = D3D11_FILTER.MAXIMUM_MIN_POINT_MAG_LINEAR_MIP_POINT;
pub const D3D11_FILTER_MAXIMUM_MIN_POINT_MAG_MIP_LINEAR = D3D11_FILTER.MAXIMUM_MIN_POINT_MAG_MIP_LINEAR;
pub const D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_MIP_POINT = D3D11_FILTER.MAXIMUM_MIN_LINEAR_MAG_MIP_POINT;
pub const D3D11_FILTER_MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR = D3D11_FILTER.MAXIMUM_MIN_LINEAR_MAG_POINT_MIP_LINEAR;
pub const D3D11_FILTER_MAXIMUM_MIN_MAG_LINEAR_MIP_POINT = D3D11_FILTER.MAXIMUM_MIN_MAG_LINEAR_MIP_POINT;
pub const D3D11_FILTER_MAXIMUM_MIN_MAG_MIP_LINEAR = D3D11_FILTER.MAXIMUM_MIN_MAG_MIP_LINEAR;
pub const D3D11_FILTER_MAXIMUM_ANISOTROPIC = D3D11_FILTER.MAXIMUM_ANISOTROPIC;
pub const D3D11_FILTER_TYPE = enum(i32) {
POINT = 0,
LINEAR = 1,
};
pub const D3D11_FILTER_TYPE_POINT = D3D11_FILTER_TYPE.POINT;
pub const D3D11_FILTER_TYPE_LINEAR = D3D11_FILTER_TYPE.LINEAR;
pub const D3D11_FILTER_REDUCTION_TYPE = enum(i32) {
STANDARD = 0,
COMPARISON = 1,
MINIMUM = 2,
MAXIMUM = 3,
};
pub const D3D11_FILTER_REDUCTION_TYPE_STANDARD = D3D11_FILTER_REDUCTION_TYPE.STANDARD;
pub const D3D11_FILTER_REDUCTION_TYPE_COMPARISON = D3D11_FILTER_REDUCTION_TYPE.COMPARISON;
pub const D3D11_FILTER_REDUCTION_TYPE_MINIMUM = D3D11_FILTER_REDUCTION_TYPE.MINIMUM;
pub const D3D11_FILTER_REDUCTION_TYPE_MAXIMUM = D3D11_FILTER_REDUCTION_TYPE.MAXIMUM;
pub const D3D11_TEXTURE_ADDRESS_MODE = enum(i32) {
WRAP = 1,
MIRROR = 2,
CLAMP = 3,
BORDER = 4,
MIRROR_ONCE = 5,
};
pub const D3D11_TEXTURE_ADDRESS_WRAP = D3D11_TEXTURE_ADDRESS_MODE.WRAP;
pub const D3D11_TEXTURE_ADDRESS_MIRROR = D3D11_TEXTURE_ADDRESS_MODE.MIRROR;
pub const D3D11_TEXTURE_ADDRESS_CLAMP = D3D11_TEXTURE_ADDRESS_MODE.CLAMP;
pub const D3D11_TEXTURE_ADDRESS_BORDER = D3D11_TEXTURE_ADDRESS_MODE.BORDER;
pub const D3D11_TEXTURE_ADDRESS_MIRROR_ONCE = D3D11_TEXTURE_ADDRESS_MODE.MIRROR_ONCE;
pub const D3D11_SAMPLER_DESC = extern struct {
Filter: D3D11_FILTER,
AddressU: D3D11_TEXTURE_ADDRESS_MODE,
AddressV: D3D11_TEXTURE_ADDRESS_MODE,
AddressW: D3D11_TEXTURE_ADDRESS_MODE,
MipLODBias: f32,
MaxAnisotropy: u32,
ComparisonFunc: D3D11_COMPARISON_FUNC,
BorderColor: [4]f32,
MinLOD: f32,
MaxLOD: f32,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11SamplerState_Value = @import("../zig.zig").Guid.initString("da6fea51-564c-4487-9810-f0d0f9b4e3a5");
pub const IID_ID3D11SamplerState = &IID_ID3D11SamplerState_Value;
pub const ID3D11SamplerState = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetDesc: fn(
self: *const ID3D11SamplerState,
pDesc: ?*D3D11_SAMPLER_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11SamplerState_GetDesc(self: *const T, pDesc: ?*D3D11_SAMPLER_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11SamplerState.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11SamplerState, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_FORMAT_SUPPORT = enum(i32) {
BUFFER = 1,
IA_VERTEX_BUFFER = 2,
IA_INDEX_BUFFER = 4,
SO_BUFFER = 8,
TEXTURE1D = 16,
TEXTURE2D = 32,
TEXTURE3D = 64,
TEXTURECUBE = 128,
SHADER_LOAD = 256,
SHADER_SAMPLE = 512,
SHADER_SAMPLE_COMPARISON = 1024,
SHADER_SAMPLE_MONO_TEXT = 2048,
MIP = 4096,
MIP_AUTOGEN = 8192,
RENDER_TARGET = 16384,
BLENDABLE = 32768,
DEPTH_STENCIL = 65536,
CPU_LOCKABLE = 131072,
MULTISAMPLE_RESOLVE = 262144,
DISPLAY = 524288,
CAST_WITHIN_BIT_LAYOUT = 1048576,
MULTISAMPLE_RENDERTARGET = 2097152,
MULTISAMPLE_LOAD = 4194304,
SHADER_GATHER = 8388608,
BACK_BUFFER_CAST = 16777216,
TYPED_UNORDERED_ACCESS_VIEW = 33554432,
SHADER_GATHER_COMPARISON = 67108864,
DECODER_OUTPUT = 134217728,
VIDEO_PROCESSOR_OUTPUT = 268435456,
VIDEO_PROCESSOR_INPUT = 536870912,
VIDEO_ENCODER = 1073741824,
};
pub const D3D11_FORMAT_SUPPORT_BUFFER = D3D11_FORMAT_SUPPORT.BUFFER;
pub const D3D11_FORMAT_SUPPORT_IA_VERTEX_BUFFER = D3D11_FORMAT_SUPPORT.IA_VERTEX_BUFFER;
pub const D3D11_FORMAT_SUPPORT_IA_INDEX_BUFFER = D3D11_FORMAT_SUPPORT.IA_INDEX_BUFFER;
pub const D3D11_FORMAT_SUPPORT_SO_BUFFER = D3D11_FORMAT_SUPPORT.SO_BUFFER;
pub const D3D11_FORMAT_SUPPORT_TEXTURE1D = D3D11_FORMAT_SUPPORT.TEXTURE1D;
pub const D3D11_FORMAT_SUPPORT_TEXTURE2D = D3D11_FORMAT_SUPPORT.TEXTURE2D;
pub const D3D11_FORMAT_SUPPORT_TEXTURE3D = D3D11_FORMAT_SUPPORT.TEXTURE3D;
pub const D3D11_FORMAT_SUPPORT_TEXTURECUBE = D3D11_FORMAT_SUPPORT.TEXTURECUBE;
pub const D3D11_FORMAT_SUPPORT_SHADER_LOAD = D3D11_FORMAT_SUPPORT.SHADER_LOAD;
pub const D3D11_FORMAT_SUPPORT_SHADER_SAMPLE = D3D11_FORMAT_SUPPORT.SHADER_SAMPLE;
pub const D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_COMPARISON = D3D11_FORMAT_SUPPORT.SHADER_SAMPLE_COMPARISON;
pub const D3D11_FORMAT_SUPPORT_SHADER_SAMPLE_MONO_TEXT = D3D11_FORMAT_SUPPORT.SHADER_SAMPLE_MONO_TEXT;
pub const D3D11_FORMAT_SUPPORT_MIP = D3D11_FORMAT_SUPPORT.MIP;
pub const D3D11_FORMAT_SUPPORT_MIP_AUTOGEN = D3D11_FORMAT_SUPPORT.MIP_AUTOGEN;
pub const D3D11_FORMAT_SUPPORT_RENDER_TARGET = D3D11_FORMAT_SUPPORT.RENDER_TARGET;
pub const D3D11_FORMAT_SUPPORT_BLENDABLE = D3D11_FORMAT_SUPPORT.BLENDABLE;
pub const D3D11_FORMAT_SUPPORT_DEPTH_STENCIL = D3D11_FORMAT_SUPPORT.DEPTH_STENCIL;
pub const D3D11_FORMAT_SUPPORT_CPU_LOCKABLE = D3D11_FORMAT_SUPPORT.CPU_LOCKABLE;
pub const D3D11_FORMAT_SUPPORT_MULTISAMPLE_RESOLVE = D3D11_FORMAT_SUPPORT.MULTISAMPLE_RESOLVE;
pub const D3D11_FORMAT_SUPPORT_DISPLAY = D3D11_FORMAT_SUPPORT.DISPLAY;
pub const D3D11_FORMAT_SUPPORT_CAST_WITHIN_BIT_LAYOUT = D3D11_FORMAT_SUPPORT.CAST_WITHIN_BIT_LAYOUT;
pub const D3D11_FORMAT_SUPPORT_MULTISAMPLE_RENDERTARGET = D3D11_FORMAT_SUPPORT.MULTISAMPLE_RENDERTARGET;
pub const D3D11_FORMAT_SUPPORT_MULTISAMPLE_LOAD = D3D11_FORMAT_SUPPORT.MULTISAMPLE_LOAD;
pub const D3D11_FORMAT_SUPPORT_SHADER_GATHER = D3D11_FORMAT_SUPPORT.SHADER_GATHER;
pub const D3D11_FORMAT_SUPPORT_BACK_BUFFER_CAST = D3D11_FORMAT_SUPPORT.BACK_BUFFER_CAST;
pub const D3D11_FORMAT_SUPPORT_TYPED_UNORDERED_ACCESS_VIEW = D3D11_FORMAT_SUPPORT.TYPED_UNORDERED_ACCESS_VIEW;
pub const D3D11_FORMAT_SUPPORT_SHADER_GATHER_COMPARISON = D3D11_FORMAT_SUPPORT.SHADER_GATHER_COMPARISON;
pub const D3D11_FORMAT_SUPPORT_DECODER_OUTPUT = D3D11_FORMAT_SUPPORT.DECODER_OUTPUT;
pub const D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_OUTPUT = D3D11_FORMAT_SUPPORT.VIDEO_PROCESSOR_OUTPUT;
pub const D3D11_FORMAT_SUPPORT_VIDEO_PROCESSOR_INPUT = D3D11_FORMAT_SUPPORT.VIDEO_PROCESSOR_INPUT;
pub const D3D11_FORMAT_SUPPORT_VIDEO_ENCODER = D3D11_FORMAT_SUPPORT.VIDEO_ENCODER;
pub const D3D11_FORMAT_SUPPORT2 = enum(i32) {
UAV_ATOMIC_ADD = 1,
UAV_ATOMIC_BITWISE_OPS = 2,
UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = 4,
UAV_ATOMIC_EXCHANGE = 8,
UAV_ATOMIC_SIGNED_MIN_OR_MAX = 16,
UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = 32,
UAV_TYPED_LOAD = 64,
UAV_TYPED_STORE = 128,
OUTPUT_MERGER_LOGIC_OP = 256,
TILED = 512,
SHAREABLE = 1024,
MULTIPLANE_OVERLAY = 16384,
};
pub const D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_ADD = D3D11_FORMAT_SUPPORT2.UAV_ATOMIC_ADD;
pub const D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_BITWISE_OPS = D3D11_FORMAT_SUPPORT2.UAV_ATOMIC_BITWISE_OPS;
pub const D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE = D3D11_FORMAT_SUPPORT2.UAV_ATOMIC_COMPARE_STORE_OR_COMPARE_EXCHANGE;
pub const D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_EXCHANGE = D3D11_FORMAT_SUPPORT2.UAV_ATOMIC_EXCHANGE;
pub const D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_SIGNED_MIN_OR_MAX = D3D11_FORMAT_SUPPORT2.UAV_ATOMIC_SIGNED_MIN_OR_MAX;
pub const D3D11_FORMAT_SUPPORT2_UAV_ATOMIC_UNSIGNED_MIN_OR_MAX = D3D11_FORMAT_SUPPORT2.UAV_ATOMIC_UNSIGNED_MIN_OR_MAX;
pub const D3D11_FORMAT_SUPPORT2_UAV_TYPED_LOAD = D3D11_FORMAT_SUPPORT2.UAV_TYPED_LOAD;
pub const D3D11_FORMAT_SUPPORT2_UAV_TYPED_STORE = D3D11_FORMAT_SUPPORT2.UAV_TYPED_STORE;
pub const D3D11_FORMAT_SUPPORT2_OUTPUT_MERGER_LOGIC_OP = D3D11_FORMAT_SUPPORT2.OUTPUT_MERGER_LOGIC_OP;
pub const D3D11_FORMAT_SUPPORT2_TILED = D3D11_FORMAT_SUPPORT2.TILED;
pub const D3D11_FORMAT_SUPPORT2_SHAREABLE = D3D11_FORMAT_SUPPORT2.SHAREABLE;
pub const D3D11_FORMAT_SUPPORT2_MULTIPLANE_OVERLAY = D3D11_FORMAT_SUPPORT2.MULTIPLANE_OVERLAY;
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11Asynchronous_Value = @import("../zig.zig").Guid.initString("4b35d0cd-1e15-4258-9c98-1b1333f6dd3b");
pub const IID_ID3D11Asynchronous = &IID_ID3D11Asynchronous_Value;
pub const ID3D11Asynchronous = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetDataSize: fn(
self: *const ID3D11Asynchronous,
) callconv(@import("std").os.windows.WINAPI) u32,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Asynchronous_GetDataSize(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11Asynchronous.VTable, self.vtable).GetDataSize(@ptrCast(*const ID3D11Asynchronous, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_ASYNC_GETDATA_FLAG = enum(i32) {
H = 1,
};
pub const D3D11_ASYNC_GETDATA_DONOTFLUSH = D3D11_ASYNC_GETDATA_FLAG.H;
pub const D3D11_QUERY = enum(i32) {
EVENT = 0,
OCCLUSION = 1,
TIMESTAMP = 2,
TIMESTAMP_DISJOINT = 3,
PIPELINE_STATISTICS = 4,
OCCLUSION_PREDICATE = 5,
SO_STATISTICS = 6,
SO_OVERFLOW_PREDICATE = 7,
SO_STATISTICS_STREAM0 = 8,
SO_OVERFLOW_PREDICATE_STREAM0 = 9,
SO_STATISTICS_STREAM1 = 10,
SO_OVERFLOW_PREDICATE_STREAM1 = 11,
SO_STATISTICS_STREAM2 = 12,
SO_OVERFLOW_PREDICATE_STREAM2 = 13,
SO_STATISTICS_STREAM3 = 14,
SO_OVERFLOW_PREDICATE_STREAM3 = 15,
};
pub const D3D11_QUERY_EVENT = D3D11_QUERY.EVENT;
pub const D3D11_QUERY_OCCLUSION = D3D11_QUERY.OCCLUSION;
pub const D3D11_QUERY_TIMESTAMP = D3D11_QUERY.TIMESTAMP;
pub const D3D11_QUERY_TIMESTAMP_DISJOINT = D3D11_QUERY.TIMESTAMP_DISJOINT;
pub const D3D11_QUERY_PIPELINE_STATISTICS = D3D11_QUERY.PIPELINE_STATISTICS;
pub const D3D11_QUERY_OCCLUSION_PREDICATE = D3D11_QUERY.OCCLUSION_PREDICATE;
pub const D3D11_QUERY_SO_STATISTICS = D3D11_QUERY.SO_STATISTICS;
pub const D3D11_QUERY_SO_OVERFLOW_PREDICATE = D3D11_QUERY.SO_OVERFLOW_PREDICATE;
pub const D3D11_QUERY_SO_STATISTICS_STREAM0 = D3D11_QUERY.SO_STATISTICS_STREAM0;
pub const D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0 = D3D11_QUERY.SO_OVERFLOW_PREDICATE_STREAM0;
pub const D3D11_QUERY_SO_STATISTICS_STREAM1 = D3D11_QUERY.SO_STATISTICS_STREAM1;
pub const D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1 = D3D11_QUERY.SO_OVERFLOW_PREDICATE_STREAM1;
pub const D3D11_QUERY_SO_STATISTICS_STREAM2 = D3D11_QUERY.SO_STATISTICS_STREAM2;
pub const D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2 = D3D11_QUERY.SO_OVERFLOW_PREDICATE_STREAM2;
pub const D3D11_QUERY_SO_STATISTICS_STREAM3 = D3D11_QUERY.SO_STATISTICS_STREAM3;
pub const D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3 = D3D11_QUERY.SO_OVERFLOW_PREDICATE_STREAM3;
pub const D3D11_QUERY_MISC_FLAG = enum(i32) {
T = 1,
};
pub const D3D11_QUERY_MISC_PREDICATEHINT = D3D11_QUERY_MISC_FLAG.T;
pub const D3D11_QUERY_DESC = extern struct {
Query: D3D11_QUERY,
MiscFlags: u32,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11Query_Value = @import("../zig.zig").Guid.initString("d6c00747-87b7-425e-b84d-44d108560afd");
pub const IID_ID3D11Query = &IID_ID3D11Query_Value;
pub const ID3D11Query = extern struct {
pub const VTable = extern struct {
base: ID3D11Asynchronous.VTable,
GetDesc: fn(
self: *const ID3D11Query,
pDesc: ?*D3D11_QUERY_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Asynchronous.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Query_GetDesc(self: *const T, pDesc: ?*D3D11_QUERY_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11Query.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11Query, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11Predicate_Value = @import("../zig.zig").Guid.initString("9eb576dd-9f77-4d86-81aa-8bab5fe490e2");
pub const IID_ID3D11Predicate = &IID_ID3D11Predicate_Value;
pub const ID3D11Predicate = extern struct {
pub const VTable = extern struct {
base: ID3D11Query.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Query.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_QUERY_DATA_TIMESTAMP_DISJOINT = extern struct {
Frequency: u64,
Disjoint: BOOL,
};
pub const D3D11_QUERY_DATA_PIPELINE_STATISTICS = extern struct {
IAVertices: u64,
IAPrimitives: u64,
VSInvocations: u64,
GSInvocations: u64,
GSPrimitives: u64,
CInvocations: u64,
CPrimitives: u64,
PSInvocations: u64,
HSInvocations: u64,
DSInvocations: u64,
CSInvocations: u64,
};
pub const D3D11_QUERY_DATA_SO_STATISTICS = extern struct {
NumPrimitivesWritten: u64,
PrimitivesStorageNeeded: u64,
};
pub const D3D11_COUNTER = enum(i32) {
@"0" = 1073741824,
};
pub const D3D11_COUNTER_DEVICE_DEPENDENT_0 = D3D11_COUNTER.@"0";
pub const D3D11_COUNTER_TYPE = enum(i32) {
FLOAT32 = 0,
UINT16 = 1,
UINT32 = 2,
UINT64 = 3,
};
pub const D3D11_COUNTER_TYPE_FLOAT32 = D3D11_COUNTER_TYPE.FLOAT32;
pub const D3D11_COUNTER_TYPE_UINT16 = D3D11_COUNTER_TYPE.UINT16;
pub const D3D11_COUNTER_TYPE_UINT32 = D3D11_COUNTER_TYPE.UINT32;
pub const D3D11_COUNTER_TYPE_UINT64 = D3D11_COUNTER_TYPE.UINT64;
pub const D3D11_COUNTER_DESC = extern struct {
Counter: D3D11_COUNTER,
MiscFlags: u32,
};
pub const D3D11_COUNTER_INFO = extern struct {
LastDeviceDependentCounter: D3D11_COUNTER,
NumSimultaneousCounters: u32,
NumDetectableParallelUnits: u8,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11Counter_Value = @import("../zig.zig").Guid.initString("6e8c49fb-a371-4770-b440-29086022b741");
pub const IID_ID3D11Counter = &IID_ID3D11Counter_Value;
pub const ID3D11Counter = extern struct {
pub const VTable = extern struct {
base: ID3D11Asynchronous.VTable,
GetDesc: fn(
self: *const ID3D11Counter,
pDesc: ?*D3D11_COUNTER_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Asynchronous.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Counter_GetDesc(self: *const T, pDesc: ?*D3D11_COUNTER_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11Counter.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11Counter, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS = enum(i32) {
STANDARD_MULTISAMPLE_PATTERN = -1,
CENTER_MULTISAMPLE_PATTERN = -2,
};
pub const D3D11_STANDARD_MULTISAMPLE_PATTERN = D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS.STANDARD_MULTISAMPLE_PATTERN;
pub const D3D11_CENTER_MULTISAMPLE_PATTERN = D3D11_STANDARD_MULTISAMPLE_QUALITY_LEVELS.CENTER_MULTISAMPLE_PATTERN;
pub const D3D11_DEVICE_CONTEXT_TYPE = enum(i32) {
IMMEDIATE = 0,
DEFERRED = 1,
};
pub const D3D11_DEVICE_CONTEXT_IMMEDIATE = D3D11_DEVICE_CONTEXT_TYPE.IMMEDIATE;
pub const D3D11_DEVICE_CONTEXT_DEFERRED = D3D11_DEVICE_CONTEXT_TYPE.DEFERRED;
pub const D3D11_CLASS_INSTANCE_DESC = extern struct {
InstanceId: u32,
InstanceIndex: u32,
TypeId: u32,
ConstantBuffer: u32,
BaseConstantBufferOffset: u32,
BaseTexture: u32,
BaseSampler: u32,
Created: BOOL,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11ClassInstance_Value = @import("../zig.zig").Guid.initString("a6cd7faa-b0b7-4a2f-9436-8662a65797cb");
pub const IID_ID3D11ClassInstance = &IID_ID3D11ClassInstance_Value;
pub const ID3D11ClassInstance = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetClassLinkage: fn(
self: *const ID3D11ClassInstance,
ppLinkage: ?*?*ID3D11ClassLinkage,
) callconv(@import("std").os.windows.WINAPI) void,
GetDesc: fn(
self: *const ID3D11ClassInstance,
pDesc: ?*D3D11_CLASS_INSTANCE_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
GetInstanceName: fn(
self: *const ID3D11ClassInstance,
pInstanceName: ?[*:0]u8,
pBufferLength: ?*usize,
) callconv(@import("std").os.windows.WINAPI) void,
GetTypeName: fn(
self: *const ID3D11ClassInstance,
pTypeName: ?[*:0]u8,
pBufferLength: ?*usize,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ClassInstance_GetClassLinkage(self: *const T, ppLinkage: ?*?*ID3D11ClassLinkage) callconv(.Inline) void {
return @ptrCast(*const ID3D11ClassInstance.VTable, self.vtable).GetClassLinkage(@ptrCast(*const ID3D11ClassInstance, self), ppLinkage);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ClassInstance_GetDesc(self: *const T, pDesc: ?*D3D11_CLASS_INSTANCE_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11ClassInstance.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11ClassInstance, self), pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ClassInstance_GetInstanceName(self: *const T, pInstanceName: ?[*:0]u8, pBufferLength: ?*usize) callconv(.Inline) void {
return @ptrCast(*const ID3D11ClassInstance.VTable, self.vtable).GetInstanceName(@ptrCast(*const ID3D11ClassInstance, self), pInstanceName, pBufferLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ClassInstance_GetTypeName(self: *const T, pTypeName: ?[*:0]u8, pBufferLength: ?*usize) callconv(.Inline) void {
return @ptrCast(*const ID3D11ClassInstance.VTable, self.vtable).GetTypeName(@ptrCast(*const ID3D11ClassInstance, self), pTypeName, pBufferLength);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11ClassLinkage_Value = @import("../zig.zig").Guid.initString("ddf57cba-9543-46e4-a12b-f207a0fe7fed");
pub const IID_ID3D11ClassLinkage = &IID_ID3D11ClassLinkage_Value;
pub const ID3D11ClassLinkage = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetClassInstance: fn(
self: *const ID3D11ClassLinkage,
pClassInstanceName: ?[*:0]const u8,
InstanceIndex: u32,
ppInstance: ?*?*ID3D11ClassInstance,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateClassInstance: fn(
self: *const ID3D11ClassLinkage,
pClassTypeName: ?[*:0]const u8,
ConstantBufferOffset: u32,
ConstantVectorOffset: u32,
TextureOffset: u32,
SamplerOffset: u32,
ppInstance: ?*?*ID3D11ClassInstance,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ClassLinkage_GetClassInstance(self: *const T, pClassInstanceName: ?[*:0]const u8, InstanceIndex: u32, ppInstance: ?*?*ID3D11ClassInstance) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ClassLinkage.VTable, self.vtable).GetClassInstance(@ptrCast(*const ID3D11ClassLinkage, self), pClassInstanceName, InstanceIndex, ppInstance);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ClassLinkage_CreateClassInstance(self: *const T, pClassTypeName: ?[*:0]const u8, ConstantBufferOffset: u32, ConstantVectorOffset: u32, TextureOffset: u32, SamplerOffset: u32, ppInstance: ?*?*ID3D11ClassInstance) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ClassLinkage.VTable, self.vtable).CreateClassInstance(@ptrCast(*const ID3D11ClassLinkage, self), pClassTypeName, ConstantBufferOffset, ConstantVectorOffset, TextureOffset, SamplerOffset, ppInstance);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11CommandList_Value = @import("../zig.zig").Guid.initString("a24bc4d1-769e-43f7-8013-98ff566c18e2");
pub const IID_ID3D11CommandList = &IID_ID3D11CommandList_Value;
pub const ID3D11CommandList = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetContextFlags: fn(
self: *const ID3D11CommandList,
) callconv(@import("std").os.windows.WINAPI) u32,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11CommandList_GetContextFlags(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11CommandList.VTable, self.vtable).GetContextFlags(@ptrCast(*const ID3D11CommandList, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_FEATURE = enum(i32) {
THREADING = 0,
DOUBLES = 1,
FORMAT_SUPPORT = 2,
FORMAT_SUPPORT2 = 3,
D3D10_X_HARDWARE_OPTIONS = 4,
D3D11_OPTIONS = 5,
ARCHITECTURE_INFO = 6,
D3D9_OPTIONS = 7,
SHADER_MIN_PRECISION_SUPPORT = 8,
D3D9_SHADOW_SUPPORT = 9,
D3D11_OPTIONS1 = 10,
D3D9_SIMPLE_INSTANCING_SUPPORT = 11,
MARKER_SUPPORT = 12,
D3D9_OPTIONS1 = 13,
D3D11_OPTIONS2 = 14,
D3D11_OPTIONS3 = 15,
GPU_VIRTUAL_ADDRESS_SUPPORT = 16,
D3D11_OPTIONS4 = 17,
SHADER_CACHE = 18,
D3D11_OPTIONS5 = 19,
DISPLAYABLE = 20,
};
pub const D3D11_FEATURE_THREADING = D3D11_FEATURE.THREADING;
pub const D3D11_FEATURE_DOUBLES = D3D11_FEATURE.DOUBLES;
pub const D3D11_FEATURE_FORMAT_SUPPORT = D3D11_FEATURE.FORMAT_SUPPORT;
pub const D3D11_FEATURE_FORMAT_SUPPORT2 = D3D11_FEATURE.FORMAT_SUPPORT2;
pub const D3D11_FEATURE_D3D10_X_HARDWARE_OPTIONS = D3D11_FEATURE.D3D10_X_HARDWARE_OPTIONS;
pub const D3D11_FEATURE_D3D11_OPTIONS = D3D11_FEATURE.D3D11_OPTIONS;
pub const D3D11_FEATURE_ARCHITECTURE_INFO = D3D11_FEATURE.ARCHITECTURE_INFO;
pub const D3D11_FEATURE_D3D9_OPTIONS = D3D11_FEATURE.D3D9_OPTIONS;
pub const D3D11_FEATURE_SHADER_MIN_PRECISION_SUPPORT = D3D11_FEATURE.SHADER_MIN_PRECISION_SUPPORT;
pub const D3D11_FEATURE_D3D9_SHADOW_SUPPORT = D3D11_FEATURE.D3D9_SHADOW_SUPPORT;
pub const D3D11_FEATURE_D3D11_OPTIONS1 = D3D11_FEATURE.D3D11_OPTIONS1;
pub const D3D11_FEATURE_D3D9_SIMPLE_INSTANCING_SUPPORT = D3D11_FEATURE.D3D9_SIMPLE_INSTANCING_SUPPORT;
pub const D3D11_FEATURE_MARKER_SUPPORT = D3D11_FEATURE.MARKER_SUPPORT;
pub const D3D11_FEATURE_D3D9_OPTIONS1 = D3D11_FEATURE.D3D9_OPTIONS1;
pub const D3D11_FEATURE_D3D11_OPTIONS2 = D3D11_FEATURE.D3D11_OPTIONS2;
pub const D3D11_FEATURE_D3D11_OPTIONS3 = D3D11_FEATURE.D3D11_OPTIONS3;
pub const D3D11_FEATURE_GPU_VIRTUAL_ADDRESS_SUPPORT = D3D11_FEATURE.GPU_VIRTUAL_ADDRESS_SUPPORT;
pub const D3D11_FEATURE_D3D11_OPTIONS4 = D3D11_FEATURE.D3D11_OPTIONS4;
pub const D3D11_FEATURE_SHADER_CACHE = D3D11_FEATURE.SHADER_CACHE;
pub const D3D11_FEATURE_D3D11_OPTIONS5 = D3D11_FEATURE.D3D11_OPTIONS5;
pub const D3D11_FEATURE_DISPLAYABLE = D3D11_FEATURE.DISPLAYABLE;
pub const D3D11_FEATURE_DATA_THREADING = extern struct {
DriverConcurrentCreates: BOOL,
DriverCommandLists: BOOL,
};
pub const D3D11_FEATURE_DATA_DOUBLES = extern struct {
DoublePrecisionFloatShaderOps: BOOL,
};
pub const D3D11_FEATURE_DATA_FORMAT_SUPPORT = extern struct {
InFormat: DXGI_FORMAT,
OutFormatSupport: u32,
};
pub const D3D11_FEATURE_DATA_FORMAT_SUPPORT2 = extern struct {
InFormat: DXGI_FORMAT,
OutFormatSupport2: u32,
};
pub const D3D11_FEATURE_DATA_D3D10_X_HARDWARE_OPTIONS = extern struct {
ComputeShaders_Plus_RawAndStructuredBuffers_Via_Shader_4_x: BOOL,
};
pub const D3D11_FEATURE_DATA_D3D11_OPTIONS = extern struct {
OutputMergerLogicOp: BOOL,
UAVOnlyRenderingForcedSampleCount: BOOL,
DiscardAPIsSeenByDriver: BOOL,
FlagsForUpdateAndCopySeenByDriver: BOOL,
ClearView: BOOL,
CopyWithOverlap: BOOL,
ConstantBufferPartialUpdate: BOOL,
ConstantBufferOffsetting: BOOL,
MapNoOverwriteOnDynamicConstantBuffer: BOOL,
MapNoOverwriteOnDynamicBufferSRV: BOOL,
MultisampleRTVWithForcedSampleCountOne: BOOL,
SAD4ShaderInstructions: BOOL,
ExtendedDoublesShaderInstructions: BOOL,
ExtendedResourceSharing: BOOL,
};
pub const D3D11_FEATURE_DATA_ARCHITECTURE_INFO = extern struct {
TileBasedDeferredRenderer: BOOL,
};
pub const D3D11_FEATURE_DATA_D3D9_OPTIONS = extern struct {
FullNonPow2TextureSupport: BOOL,
};
pub const D3D11_FEATURE_DATA_D3D9_SHADOW_SUPPORT = extern struct {
SupportsDepthAsTextureWithLessEqualComparisonFilter: BOOL,
};
pub const D3D11_SHADER_MIN_PRECISION_SUPPORT = enum(i32) {
@"0_BIT" = 1,
@"6_BIT" = 2,
};
pub const D3D11_SHADER_MIN_PRECISION_10_BIT = D3D11_SHADER_MIN_PRECISION_SUPPORT.@"0_BIT";
pub const D3D11_SHADER_MIN_PRECISION_16_BIT = D3D11_SHADER_MIN_PRECISION_SUPPORT.@"6_BIT";
pub const D3D11_FEATURE_DATA_SHADER_MIN_PRECISION_SUPPORT = extern struct {
PixelShaderMinPrecision: u32,
AllOtherShaderStagesMinPrecision: u32,
};
pub const D3D11_TILED_RESOURCES_TIER = enum(i32) {
NOT_SUPPORTED = 0,
TIER_1 = 1,
TIER_2 = 2,
TIER_3 = 3,
};
pub const D3D11_TILED_RESOURCES_NOT_SUPPORTED = D3D11_TILED_RESOURCES_TIER.NOT_SUPPORTED;
pub const D3D11_TILED_RESOURCES_TIER_1 = D3D11_TILED_RESOURCES_TIER.TIER_1;
pub const D3D11_TILED_RESOURCES_TIER_2 = D3D11_TILED_RESOURCES_TIER.TIER_2;
pub const D3D11_TILED_RESOURCES_TIER_3 = D3D11_TILED_RESOURCES_TIER.TIER_3;
pub const D3D11_FEATURE_DATA_D3D11_OPTIONS1 = extern struct {
TiledResourcesTier: D3D11_TILED_RESOURCES_TIER,
MinMaxFiltering: BOOL,
ClearViewAlsoSupportsDepthOnlyFormats: BOOL,
MapOnDefaultBuffers: BOOL,
};
pub const D3D11_FEATURE_DATA_D3D9_SIMPLE_INSTANCING_SUPPORT = extern struct {
SimpleInstancingSupported: BOOL,
};
pub const D3D11_FEATURE_DATA_MARKER_SUPPORT = extern struct {
Profile: BOOL,
};
pub const D3D11_FEATURE_DATA_D3D9_OPTIONS1 = extern struct {
FullNonPow2TextureSupported: BOOL,
DepthAsTextureWithLessEqualComparisonFilterSupported: BOOL,
SimpleInstancingSupported: BOOL,
TextureCubeFaceRenderTargetWithNonCubeDepthStencilSupported: BOOL,
};
pub const D3D11_CONSERVATIVE_RASTERIZATION_TIER = enum(i32) {
NOT_SUPPORTED = 0,
TIER_1 = 1,
TIER_2 = 2,
TIER_3 = 3,
};
pub const D3D11_CONSERVATIVE_RASTERIZATION_NOT_SUPPORTED = D3D11_CONSERVATIVE_RASTERIZATION_TIER.NOT_SUPPORTED;
pub const D3D11_CONSERVATIVE_RASTERIZATION_TIER_1 = D3D11_CONSERVATIVE_RASTERIZATION_TIER.TIER_1;
pub const D3D11_CONSERVATIVE_RASTERIZATION_TIER_2 = D3D11_CONSERVATIVE_RASTERIZATION_TIER.TIER_2;
pub const D3D11_CONSERVATIVE_RASTERIZATION_TIER_3 = D3D11_CONSERVATIVE_RASTERIZATION_TIER.TIER_3;
pub const D3D11_FEATURE_DATA_D3D11_OPTIONS2 = extern struct {
PSSpecifiedStencilRefSupported: BOOL,
TypedUAVLoadAdditionalFormats: BOOL,
ROVsSupported: BOOL,
ConservativeRasterizationTier: D3D11_CONSERVATIVE_RASTERIZATION_TIER,
TiledResourcesTier: D3D11_TILED_RESOURCES_TIER,
MapOnDefaultTextures: BOOL,
StandardSwizzle: BOOL,
UnifiedMemoryArchitecture: BOOL,
};
pub const D3D11_FEATURE_DATA_D3D11_OPTIONS3 = extern struct {
VPAndRTArrayIndexFromAnyShaderFeedingRasterizer: BOOL,
};
pub const D3D11_FEATURE_DATA_GPU_VIRTUAL_ADDRESS_SUPPORT = extern struct {
MaxGPUVirtualAddressBitsPerResource: u32,
MaxGPUVirtualAddressBitsPerProcess: u32,
};
pub const D3D11_SHADER_CACHE_SUPPORT_FLAGS = enum(i32) {
NONE = 0,
AUTOMATIC_INPROC_CACHE = 1,
AUTOMATIC_DISK_CACHE = 2,
};
pub const D3D11_SHADER_CACHE_SUPPORT_NONE = D3D11_SHADER_CACHE_SUPPORT_FLAGS.NONE;
pub const D3D11_SHADER_CACHE_SUPPORT_AUTOMATIC_INPROC_CACHE = D3D11_SHADER_CACHE_SUPPORT_FLAGS.AUTOMATIC_INPROC_CACHE;
pub const D3D11_SHADER_CACHE_SUPPORT_AUTOMATIC_DISK_CACHE = D3D11_SHADER_CACHE_SUPPORT_FLAGS.AUTOMATIC_DISK_CACHE;
pub const D3D11_FEATURE_DATA_SHADER_CACHE = extern struct {
SupportFlags: u32,
};
pub const D3D11_SHARED_RESOURCE_TIER = enum(i32) {
@"0" = 0,
@"1" = 1,
@"2" = 2,
@"3" = 3,
};
pub const D3D11_SHARED_RESOURCE_TIER_0 = D3D11_SHARED_RESOURCE_TIER.@"0";
pub const D3D11_SHARED_RESOURCE_TIER_1 = D3D11_SHARED_RESOURCE_TIER.@"1";
pub const D3D11_SHARED_RESOURCE_TIER_2 = D3D11_SHARED_RESOURCE_TIER.@"2";
pub const D3D11_SHARED_RESOURCE_TIER_3 = D3D11_SHARED_RESOURCE_TIER.@"3";
pub const D3D11_FEATURE_DATA_DISPLAYABLE = extern struct {
DisplayableTexture: BOOL,
SharedResourceTier: D3D11_SHARED_RESOURCE_TIER,
};
pub const D3D11_FEATURE_DATA_D3D11_OPTIONS5 = extern struct {
SharedResourceTier: D3D11_SHARED_RESOURCE_TIER,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11DeviceContext_Value = @import("../zig.zig").Guid.initString("c0bfa96c-e089-44fb-8eaf-26f8796190da");
pub const IID_ID3D11DeviceContext = &IID_ID3D11DeviceContext_Value;
pub const ID3D11DeviceContext = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
VSSetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
PSSetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
PSSetShader: fn(
self: *const ID3D11DeviceContext,
pPixelShader: ?*ID3D11PixelShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
NumClassInstances: u32,
) callconv(@import("std").os.windows.WINAPI) void,
PSSetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
VSSetShader: fn(
self: *const ID3D11DeviceContext,
pVertexShader: ?*ID3D11VertexShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
NumClassInstances: u32,
) callconv(@import("std").os.windows.WINAPI) void,
DrawIndexed: fn(
self: *const ID3D11DeviceContext,
IndexCount: u32,
StartIndexLocation: u32,
BaseVertexLocation: i32,
) callconv(@import("std").os.windows.WINAPI) void,
Draw: fn(
self: *const ID3D11DeviceContext,
VertexCount: u32,
StartVertexLocation: u32,
) callconv(@import("std").os.windows.WINAPI) void,
Map: fn(
self: *const ID3D11DeviceContext,
pResource: ?*ID3D11Resource,
Subresource: u32,
MapType: D3D11_MAP,
MapFlags: u32,
pMappedResource: ?*D3D11_MAPPED_SUBRESOURCE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Unmap: fn(
self: *const ID3D11DeviceContext,
pResource: ?*ID3D11Resource,
Subresource: u32,
) callconv(@import("std").os.windows.WINAPI) void,
PSSetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
IASetInputLayout: fn(
self: *const ID3D11DeviceContext,
pInputLayout: ?*ID3D11InputLayout,
) callconv(@import("std").os.windows.WINAPI) void,
IASetVertexBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppVertexBuffers: ?[*]?*ID3D11Buffer,
pStrides: ?[*]const u32,
pOffsets: ?[*]const u32,
) callconv(@import("std").os.windows.WINAPI) void,
IASetIndexBuffer: fn(
self: *const ID3D11DeviceContext,
pIndexBuffer: ?*ID3D11Buffer,
Format: DXGI_FORMAT,
Offset: u32,
) callconv(@import("std").os.windows.WINAPI) void,
DrawIndexedInstanced: fn(
self: *const ID3D11DeviceContext,
IndexCountPerInstance: u32,
InstanceCount: u32,
StartIndexLocation: u32,
BaseVertexLocation: i32,
StartInstanceLocation: u32,
) callconv(@import("std").os.windows.WINAPI) void,
DrawInstanced: fn(
self: *const ID3D11DeviceContext,
VertexCountPerInstance: u32,
InstanceCount: u32,
StartVertexLocation: u32,
StartInstanceLocation: u32,
) callconv(@import("std").os.windows.WINAPI) void,
GSSetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
GSSetShader: fn(
self: *const ID3D11DeviceContext,
pShader: ?*ID3D11GeometryShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
NumClassInstances: u32,
) callconv(@import("std").os.windows.WINAPI) void,
IASetPrimitiveTopology: fn(
self: *const ID3D11DeviceContext,
Topology: D3D_PRIMITIVE_TOPOLOGY,
) callconv(@import("std").os.windows.WINAPI) void,
VSSetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
VSSetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
Begin: fn(
self: *const ID3D11DeviceContext,
pAsync: ?*ID3D11Asynchronous,
) callconv(@import("std").os.windows.WINAPI) void,
End: fn(
self: *const ID3D11DeviceContext,
pAsync: ?*ID3D11Asynchronous,
) callconv(@import("std").os.windows.WINAPI) void,
GetData: fn(
self: *const ID3D11DeviceContext,
pAsync: ?*ID3D11Asynchronous,
// TODO: what to do with BytesParamIndex 2?
pData: ?*anyopaque,
DataSize: u32,
GetDataFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPredication: fn(
self: *const ID3D11DeviceContext,
pPredicate: ?*ID3D11Predicate,
PredicateValue: BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
GSSetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
GSSetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
OMSetRenderTargets: fn(
self: *const ID3D11DeviceContext,
NumViews: u32,
ppRenderTargetViews: ?[*]?*ID3D11RenderTargetView,
pDepthStencilView: ?*ID3D11DepthStencilView,
) callconv(@import("std").os.windows.WINAPI) void,
OMSetRenderTargetsAndUnorderedAccessViews: fn(
self: *const ID3D11DeviceContext,
NumRTVs: u32,
ppRenderTargetViews: ?[*]?*ID3D11RenderTargetView,
pDepthStencilView: ?*ID3D11DepthStencilView,
UAVStartSlot: u32,
NumUAVs: u32,
ppUnorderedAccessViews: ?[*]?*ID3D11UnorderedAccessView,
pUAVInitialCounts: ?[*]const u32,
) callconv(@import("std").os.windows.WINAPI) void,
OMSetBlendState: fn(
self: *const ID3D11DeviceContext,
pBlendState: ?*ID3D11BlendState,
BlendFactor: ?*const f32,
SampleMask: u32,
) callconv(@import("std").os.windows.WINAPI) void,
OMSetDepthStencilState: fn(
self: *const ID3D11DeviceContext,
pDepthStencilState: ?*ID3D11DepthStencilState,
StencilRef: u32,
) callconv(@import("std").os.windows.WINAPI) void,
SOSetTargets: fn(
self: *const ID3D11DeviceContext,
NumBuffers: u32,
ppSOTargets: ?[*]?*ID3D11Buffer,
pOffsets: ?[*]const u32,
) callconv(@import("std").os.windows.WINAPI) void,
DrawAuto: fn(
self: *const ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) void,
DrawIndexedInstancedIndirect: fn(
self: *const ID3D11DeviceContext,
pBufferForArgs: ?*ID3D11Buffer,
AlignedByteOffsetForArgs: u32,
) callconv(@import("std").os.windows.WINAPI) void,
DrawInstancedIndirect: fn(
self: *const ID3D11DeviceContext,
pBufferForArgs: ?*ID3D11Buffer,
AlignedByteOffsetForArgs: u32,
) callconv(@import("std").os.windows.WINAPI) void,
Dispatch: fn(
self: *const ID3D11DeviceContext,
ThreadGroupCountX: u32,
ThreadGroupCountY: u32,
ThreadGroupCountZ: u32,
) callconv(@import("std").os.windows.WINAPI) void,
DispatchIndirect: fn(
self: *const ID3D11DeviceContext,
pBufferForArgs: ?*ID3D11Buffer,
AlignedByteOffsetForArgs: u32,
) callconv(@import("std").os.windows.WINAPI) void,
RSSetState: fn(
self: *const ID3D11DeviceContext,
pRasterizerState: ?*ID3D11RasterizerState,
) callconv(@import("std").os.windows.WINAPI) void,
RSSetViewports: fn(
self: *const ID3D11DeviceContext,
NumViewports: u32,
pViewports: ?[*]const D3D11_VIEWPORT,
) callconv(@import("std").os.windows.WINAPI) void,
RSSetScissorRects: fn(
self: *const ID3D11DeviceContext,
NumRects: u32,
pRects: ?[*]const RECT,
) callconv(@import("std").os.windows.WINAPI) void,
CopySubresourceRegion: fn(
self: *const ID3D11DeviceContext,
pDstResource: ?*ID3D11Resource,
DstSubresource: u32,
DstX: u32,
DstY: u32,
DstZ: u32,
pSrcResource: ?*ID3D11Resource,
SrcSubresource: u32,
pSrcBox: ?*const D3D11_BOX,
) callconv(@import("std").os.windows.WINAPI) void,
CopyResource: fn(
self: *const ID3D11DeviceContext,
pDstResource: ?*ID3D11Resource,
pSrcResource: ?*ID3D11Resource,
) callconv(@import("std").os.windows.WINAPI) void,
UpdateSubresource: fn(
self: *const ID3D11DeviceContext,
pDstResource: ?*ID3D11Resource,
DstSubresource: u32,
pDstBox: ?*const D3D11_BOX,
pSrcData: ?*const anyopaque,
SrcRowPitch: u32,
SrcDepthPitch: u32,
) callconv(@import("std").os.windows.WINAPI) void,
CopyStructureCount: fn(
self: *const ID3D11DeviceContext,
pDstBuffer: ?*ID3D11Buffer,
DstAlignedByteOffset: u32,
pSrcView: ?*ID3D11UnorderedAccessView,
) callconv(@import("std").os.windows.WINAPI) void,
ClearRenderTargetView: fn(
self: *const ID3D11DeviceContext,
pRenderTargetView: ?*ID3D11RenderTargetView,
ColorRGBA: ?*const f32,
) callconv(@import("std").os.windows.WINAPI) void,
ClearUnorderedAccessViewUint: fn(
self: *const ID3D11DeviceContext,
pUnorderedAccessView: ?*ID3D11UnorderedAccessView,
Values: ?*const u32,
) callconv(@import("std").os.windows.WINAPI) void,
ClearUnorderedAccessViewFloat: fn(
self: *const ID3D11DeviceContext,
pUnorderedAccessView: ?*ID3D11UnorderedAccessView,
Values: ?*const f32,
) callconv(@import("std").os.windows.WINAPI) void,
ClearDepthStencilView: fn(
self: *const ID3D11DeviceContext,
pDepthStencilView: ?*ID3D11DepthStencilView,
ClearFlags: u32,
Depth: f32,
Stencil: u8,
) callconv(@import("std").os.windows.WINAPI) void,
GenerateMips: fn(
self: *const ID3D11DeviceContext,
pShaderResourceView: ?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
SetResourceMinLOD: fn(
self: *const ID3D11DeviceContext,
pResource: ?*ID3D11Resource,
MinLOD: f32,
) callconv(@import("std").os.windows.WINAPI) void,
GetResourceMinLOD: fn(
self: *const ID3D11DeviceContext,
pResource: ?*ID3D11Resource,
) callconv(@import("std").os.windows.WINAPI) f32,
ResolveSubresource: fn(
self: *const ID3D11DeviceContext,
pDstResource: ?*ID3D11Resource,
DstSubresource: u32,
pSrcResource: ?*ID3D11Resource,
SrcSubresource: u32,
Format: DXGI_FORMAT,
) callconv(@import("std").os.windows.WINAPI) void,
ExecuteCommandList: fn(
self: *const ID3D11DeviceContext,
pCommandList: ?*ID3D11CommandList,
RestoreContextState: BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
HSSetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
HSSetShader: fn(
self: *const ID3D11DeviceContext,
pHullShader: ?*ID3D11HullShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
NumClassInstances: u32,
) callconv(@import("std").os.windows.WINAPI) void,
HSSetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
HSSetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
DSSetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
DSSetShader: fn(
self: *const ID3D11DeviceContext,
pDomainShader: ?*ID3D11DomainShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
NumClassInstances: u32,
) callconv(@import("std").os.windows.WINAPI) void,
DSSetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
DSSetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
CSSetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
CSSetUnorderedAccessViews: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumUAVs: u32,
ppUnorderedAccessViews: ?[*]?*ID3D11UnorderedAccessView,
pUAVInitialCounts: ?[*]const u32,
) callconv(@import("std").os.windows.WINAPI) void,
CSSetShader: fn(
self: *const ID3D11DeviceContext,
pComputeShader: ?*ID3D11ComputeShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
NumClassInstances: u32,
) callconv(@import("std").os.windows.WINAPI) void,
CSSetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
CSSetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
VSGetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
PSGetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
PSGetShader: fn(
self: *const ID3D11DeviceContext,
ppPixelShader: ?*?*ID3D11PixelShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
pNumClassInstances: ?*u32,
) callconv(@import("std").os.windows.WINAPI) void,
PSGetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
VSGetShader: fn(
self: *const ID3D11DeviceContext,
ppVertexShader: ?*?*ID3D11VertexShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
pNumClassInstances: ?*u32,
) callconv(@import("std").os.windows.WINAPI) void,
PSGetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
IAGetInputLayout: fn(
self: *const ID3D11DeviceContext,
ppInputLayout: ?*?*ID3D11InputLayout,
) callconv(@import("std").os.windows.WINAPI) void,
IAGetVertexBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppVertexBuffers: ?[*]?*ID3D11Buffer,
pStrides: ?[*]u32,
pOffsets: ?[*]u32,
) callconv(@import("std").os.windows.WINAPI) void,
IAGetIndexBuffer: fn(
self: *const ID3D11DeviceContext,
pIndexBuffer: ?*?*ID3D11Buffer,
Format: ?*DXGI_FORMAT,
Offset: ?*u32,
) callconv(@import("std").os.windows.WINAPI) void,
GSGetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
GSGetShader: fn(
self: *const ID3D11DeviceContext,
ppGeometryShader: ?*?*ID3D11GeometryShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
pNumClassInstances: ?*u32,
) callconv(@import("std").os.windows.WINAPI) void,
IAGetPrimitiveTopology: fn(
self: *const ID3D11DeviceContext,
pTopology: ?*D3D_PRIMITIVE_TOPOLOGY,
) callconv(@import("std").os.windows.WINAPI) void,
VSGetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
VSGetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
GetPredication: fn(
self: *const ID3D11DeviceContext,
ppPredicate: ?*?*ID3D11Predicate,
pPredicateValue: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
GSGetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
GSGetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
OMGetRenderTargets: fn(
self: *const ID3D11DeviceContext,
NumViews: u32,
ppRenderTargetViews: ?[*]?*ID3D11RenderTargetView,
ppDepthStencilView: ?*?*ID3D11DepthStencilView,
) callconv(@import("std").os.windows.WINAPI) void,
OMGetRenderTargetsAndUnorderedAccessViews: fn(
self: *const ID3D11DeviceContext,
NumRTVs: u32,
ppRenderTargetViews: ?[*]?*ID3D11RenderTargetView,
ppDepthStencilView: ?*?*ID3D11DepthStencilView,
UAVStartSlot: u32,
NumUAVs: u32,
ppUnorderedAccessViews: ?[*]?*ID3D11UnorderedAccessView,
) callconv(@import("std").os.windows.WINAPI) void,
OMGetBlendState: fn(
self: *const ID3D11DeviceContext,
ppBlendState: ?*?*ID3D11BlendState,
BlendFactor: ?*f32,
pSampleMask: ?*u32,
) callconv(@import("std").os.windows.WINAPI) void,
OMGetDepthStencilState: fn(
self: *const ID3D11DeviceContext,
ppDepthStencilState: ?*?*ID3D11DepthStencilState,
pStencilRef: ?*u32,
) callconv(@import("std").os.windows.WINAPI) void,
SOGetTargets: fn(
self: *const ID3D11DeviceContext,
NumBuffers: u32,
ppSOTargets: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
RSGetState: fn(
self: *const ID3D11DeviceContext,
ppRasterizerState: ?*?*ID3D11RasterizerState,
) callconv(@import("std").os.windows.WINAPI) void,
RSGetViewports: fn(
self: *const ID3D11DeviceContext,
pNumViewports: ?*u32,
pViewports: ?[*]D3D11_VIEWPORT,
) callconv(@import("std").os.windows.WINAPI) void,
RSGetScissorRects: fn(
self: *const ID3D11DeviceContext,
pNumRects: ?*u32,
pRects: ?[*]RECT,
) callconv(@import("std").os.windows.WINAPI) void,
HSGetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
HSGetShader: fn(
self: *const ID3D11DeviceContext,
ppHullShader: ?*?*ID3D11HullShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
pNumClassInstances: ?*u32,
) callconv(@import("std").os.windows.WINAPI) void,
HSGetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
HSGetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
DSGetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
DSGetShader: fn(
self: *const ID3D11DeviceContext,
ppDomainShader: ?*?*ID3D11DomainShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
pNumClassInstances: ?*u32,
) callconv(@import("std").os.windows.WINAPI) void,
DSGetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
DSGetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
CSGetShaderResources: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumViews: u32,
ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) void,
CSGetUnorderedAccessViews: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumUAVs: u32,
ppUnorderedAccessViews: ?[*]?*ID3D11UnorderedAccessView,
) callconv(@import("std").os.windows.WINAPI) void,
CSGetShader: fn(
self: *const ID3D11DeviceContext,
ppComputeShader: ?*?*ID3D11ComputeShader,
ppClassInstances: ?[*]?*ID3D11ClassInstance,
pNumClassInstances: ?*u32,
) callconv(@import("std").os.windows.WINAPI) void,
CSGetSamplers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumSamplers: u32,
ppSamplers: ?[*]?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) void,
CSGetConstantBuffers: fn(
self: *const ID3D11DeviceContext,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) void,
ClearState: fn(
self: *const ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) void,
Flush: fn(
self: *const ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) void,
GetType: fn(
self: *const ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) D3D11_DEVICE_CONTEXT_TYPE,
GetContextFlags: fn(
self: *const ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) u32,
FinishCommandList: fn(
self: *const ID3D11DeviceContext,
RestoreDeferredContextState: BOOL,
ppCommandList: ?*?*ID3D11CommandList,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_VSSetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).VSSetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_PSSetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).PSSetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_PSSetShader(self: *const T, pPixelShader: ?*ID3D11PixelShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, NumClassInstances: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).PSSetShader(@ptrCast(*const ID3D11DeviceContext, self), pPixelShader, ppClassInstances, NumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_PSSetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).PSSetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_VSSetShader(self: *const T, pVertexShader: ?*ID3D11VertexShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, NumClassInstances: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).VSSetShader(@ptrCast(*const ID3D11DeviceContext, self), pVertexShader, ppClassInstances, NumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DrawIndexed(self: *const T, IndexCount: u32, StartIndexLocation: u32, BaseVertexLocation: i32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DrawIndexed(@ptrCast(*const ID3D11DeviceContext, self), IndexCount, StartIndexLocation, BaseVertexLocation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_Draw(self: *const T, VertexCount: u32, StartVertexLocation: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).Draw(@ptrCast(*const ID3D11DeviceContext, self), VertexCount, StartVertexLocation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_Map(self: *const T, pResource: ?*ID3D11Resource, Subresource: u32, MapType: D3D11_MAP, MapFlags: u32, pMappedResource: ?*D3D11_MAPPED_SUBRESOURCE) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).Map(@ptrCast(*const ID3D11DeviceContext, self), pResource, Subresource, MapType, MapFlags, pMappedResource);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_Unmap(self: *const T, pResource: ?*ID3D11Resource, Subresource: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).Unmap(@ptrCast(*const ID3D11DeviceContext, self), pResource, Subresource);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_PSSetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).PSSetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_IASetInputLayout(self: *const T, pInputLayout: ?*ID3D11InputLayout) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).IASetInputLayout(@ptrCast(*const ID3D11DeviceContext, self), pInputLayout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_IASetVertexBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppVertexBuffers: ?[*]?*ID3D11Buffer, pStrides: ?[*]const u32, pOffsets: ?[*]const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).IASetVertexBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppVertexBuffers, pStrides, pOffsets);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_IASetIndexBuffer(self: *const T, pIndexBuffer: ?*ID3D11Buffer, Format: DXGI_FORMAT, Offset: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).IASetIndexBuffer(@ptrCast(*const ID3D11DeviceContext, self), pIndexBuffer, Format, Offset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DrawIndexedInstanced(self: *const T, IndexCountPerInstance: u32, InstanceCount: u32, StartIndexLocation: u32, BaseVertexLocation: i32, StartInstanceLocation: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DrawIndexedInstanced(@ptrCast(*const ID3D11DeviceContext, self), IndexCountPerInstance, InstanceCount, StartIndexLocation, BaseVertexLocation, StartInstanceLocation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DrawInstanced(self: *const T, VertexCountPerInstance: u32, InstanceCount: u32, StartVertexLocation: u32, StartInstanceLocation: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DrawInstanced(@ptrCast(*const ID3D11DeviceContext, self), VertexCountPerInstance, InstanceCount, StartVertexLocation, StartInstanceLocation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GSSetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GSSetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GSSetShader(self: *const T, pShader: ?*ID3D11GeometryShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, NumClassInstances: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GSSetShader(@ptrCast(*const ID3D11DeviceContext, self), pShader, ppClassInstances, NumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_IASetPrimitiveTopology(self: *const T, Topology: D3D_PRIMITIVE_TOPOLOGY) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).IASetPrimitiveTopology(@ptrCast(*const ID3D11DeviceContext, self), Topology);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_VSSetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).VSSetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_VSSetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).VSSetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_Begin(self: *const T, pAsync: ?*ID3D11Asynchronous) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).Begin(@ptrCast(*const ID3D11DeviceContext, self), pAsync);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_End(self: *const T, pAsync: ?*ID3D11Asynchronous) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).End(@ptrCast(*const ID3D11DeviceContext, self), pAsync);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GetData(self: *const T, pAsync: ?*ID3D11Asynchronous, pData: ?*anyopaque, DataSize: u32, GetDataFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GetData(@ptrCast(*const ID3D11DeviceContext, self), pAsync, pData, DataSize, GetDataFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_SetPredication(self: *const T, pPredicate: ?*ID3D11Predicate, PredicateValue: BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).SetPredication(@ptrCast(*const ID3D11DeviceContext, self), pPredicate, PredicateValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GSSetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GSSetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GSSetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GSSetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_OMSetRenderTargets(self: *const T, NumViews: u32, ppRenderTargetViews: ?[*]?*ID3D11RenderTargetView, pDepthStencilView: ?*ID3D11DepthStencilView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).OMSetRenderTargets(@ptrCast(*const ID3D11DeviceContext, self), NumViews, ppRenderTargetViews, pDepthStencilView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_OMSetRenderTargetsAndUnorderedAccessViews(self: *const T, NumRTVs: u32, ppRenderTargetViews: ?[*]?*ID3D11RenderTargetView, pDepthStencilView: ?*ID3D11DepthStencilView, UAVStartSlot: u32, NumUAVs: u32, ppUnorderedAccessViews: ?[*]?*ID3D11UnorderedAccessView, pUAVInitialCounts: ?[*]const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).OMSetRenderTargetsAndUnorderedAccessViews(@ptrCast(*const ID3D11DeviceContext, self), NumRTVs, ppRenderTargetViews, pDepthStencilView, UAVStartSlot, NumUAVs, ppUnorderedAccessViews, pUAVInitialCounts);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_OMSetBlendState(self: *const T, pBlendState: ?*ID3D11BlendState, BlendFactor: ?*const f32, SampleMask: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).OMSetBlendState(@ptrCast(*const ID3D11DeviceContext, self), pBlendState, BlendFactor, SampleMask);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_OMSetDepthStencilState(self: *const T, pDepthStencilState: ?*ID3D11DepthStencilState, StencilRef: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).OMSetDepthStencilState(@ptrCast(*const ID3D11DeviceContext, self), pDepthStencilState, StencilRef);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_SOSetTargets(self: *const T, NumBuffers: u32, ppSOTargets: ?[*]?*ID3D11Buffer, pOffsets: ?[*]const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).SOSetTargets(@ptrCast(*const ID3D11DeviceContext, self), NumBuffers, ppSOTargets, pOffsets);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DrawAuto(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DrawAuto(@ptrCast(*const ID3D11DeviceContext, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DrawIndexedInstancedIndirect(self: *const T, pBufferForArgs: ?*ID3D11Buffer, AlignedByteOffsetForArgs: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DrawIndexedInstancedIndirect(@ptrCast(*const ID3D11DeviceContext, self), pBufferForArgs, AlignedByteOffsetForArgs);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DrawInstancedIndirect(self: *const T, pBufferForArgs: ?*ID3D11Buffer, AlignedByteOffsetForArgs: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DrawInstancedIndirect(@ptrCast(*const ID3D11DeviceContext, self), pBufferForArgs, AlignedByteOffsetForArgs);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_Dispatch(self: *const T, ThreadGroupCountX: u32, ThreadGroupCountY: u32, ThreadGroupCountZ: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).Dispatch(@ptrCast(*const ID3D11DeviceContext, self), ThreadGroupCountX, ThreadGroupCountY, ThreadGroupCountZ);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DispatchIndirect(self: *const T, pBufferForArgs: ?*ID3D11Buffer, AlignedByteOffsetForArgs: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DispatchIndirect(@ptrCast(*const ID3D11DeviceContext, self), pBufferForArgs, AlignedByteOffsetForArgs);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_RSSetState(self: *const T, pRasterizerState: ?*ID3D11RasterizerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).RSSetState(@ptrCast(*const ID3D11DeviceContext, self), pRasterizerState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_RSSetViewports(self: *const T, NumViewports: u32, pViewports: ?[*]const D3D11_VIEWPORT) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).RSSetViewports(@ptrCast(*const ID3D11DeviceContext, self), NumViewports, pViewports);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_RSSetScissorRects(self: *const T, NumRects: u32, pRects: ?[*]const RECT) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).RSSetScissorRects(@ptrCast(*const ID3D11DeviceContext, self), NumRects, pRects);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CopySubresourceRegion(self: *const T, pDstResource: ?*ID3D11Resource, DstSubresource: u32, DstX: u32, DstY: u32, DstZ: u32, pSrcResource: ?*ID3D11Resource, SrcSubresource: u32, pSrcBox: ?*const D3D11_BOX) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CopySubresourceRegion(@ptrCast(*const ID3D11DeviceContext, self), pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, pSrcBox);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CopyResource(self: *const T, pDstResource: ?*ID3D11Resource, pSrcResource: ?*ID3D11Resource) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CopyResource(@ptrCast(*const ID3D11DeviceContext, self), pDstResource, pSrcResource);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_UpdateSubresource(self: *const T, pDstResource: ?*ID3D11Resource, DstSubresource: u32, pDstBox: ?*const D3D11_BOX, pSrcData: ?*const anyopaque, SrcRowPitch: u32, SrcDepthPitch: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).UpdateSubresource(@ptrCast(*const ID3D11DeviceContext, self), pDstResource, DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CopyStructureCount(self: *const T, pDstBuffer: ?*ID3D11Buffer, DstAlignedByteOffset: u32, pSrcView: ?*ID3D11UnorderedAccessView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CopyStructureCount(@ptrCast(*const ID3D11DeviceContext, self), pDstBuffer, DstAlignedByteOffset, pSrcView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_ClearRenderTargetView(self: *const T, pRenderTargetView: ?*ID3D11RenderTargetView, ColorRGBA: ?*const f32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).ClearRenderTargetView(@ptrCast(*const ID3D11DeviceContext, self), pRenderTargetView, ColorRGBA);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_ClearUnorderedAccessViewUint(self: *const T, pUnorderedAccessView: ?*ID3D11UnorderedAccessView, Values: ?*const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).ClearUnorderedAccessViewUint(@ptrCast(*const ID3D11DeviceContext, self), pUnorderedAccessView, Values);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_ClearUnorderedAccessViewFloat(self: *const T, pUnorderedAccessView: ?*ID3D11UnorderedAccessView, Values: ?*const f32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).ClearUnorderedAccessViewFloat(@ptrCast(*const ID3D11DeviceContext, self), pUnorderedAccessView, Values);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_ClearDepthStencilView(self: *const T, pDepthStencilView: ?*ID3D11DepthStencilView, ClearFlags: u32, Depth: f32, Stencil: u8) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).ClearDepthStencilView(@ptrCast(*const ID3D11DeviceContext, self), pDepthStencilView, ClearFlags, Depth, Stencil);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GenerateMips(self: *const T, pShaderResourceView: ?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GenerateMips(@ptrCast(*const ID3D11DeviceContext, self), pShaderResourceView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_SetResourceMinLOD(self: *const T, pResource: ?*ID3D11Resource, MinLOD: f32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).SetResourceMinLOD(@ptrCast(*const ID3D11DeviceContext, self), pResource, MinLOD);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GetResourceMinLOD(self: *const T, pResource: ?*ID3D11Resource) callconv(.Inline) f32 {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GetResourceMinLOD(@ptrCast(*const ID3D11DeviceContext, self), pResource);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_ResolveSubresource(self: *const T, pDstResource: ?*ID3D11Resource, DstSubresource: u32, pSrcResource: ?*ID3D11Resource, SrcSubresource: u32, Format: DXGI_FORMAT) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).ResolveSubresource(@ptrCast(*const ID3D11DeviceContext, self), pDstResource, DstSubresource, pSrcResource, SrcSubresource, Format);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_ExecuteCommandList(self: *const T, pCommandList: ?*ID3D11CommandList, RestoreContextState: BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).ExecuteCommandList(@ptrCast(*const ID3D11DeviceContext, self), pCommandList, RestoreContextState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_HSSetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).HSSetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_HSSetShader(self: *const T, pHullShader: ?*ID3D11HullShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, NumClassInstances: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).HSSetShader(@ptrCast(*const ID3D11DeviceContext, self), pHullShader, ppClassInstances, NumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_HSSetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).HSSetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_HSSetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).HSSetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DSSetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DSSetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DSSetShader(self: *const T, pDomainShader: ?*ID3D11DomainShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, NumClassInstances: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DSSetShader(@ptrCast(*const ID3D11DeviceContext, self), pDomainShader, ppClassInstances, NumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DSSetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DSSetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DSSetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DSSetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CSSetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CSSetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CSSetUnorderedAccessViews(self: *const T, StartSlot: u32, NumUAVs: u32, ppUnorderedAccessViews: ?[*]?*ID3D11UnorderedAccessView, pUAVInitialCounts: ?[*]const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CSSetUnorderedAccessViews(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumUAVs, ppUnorderedAccessViews, pUAVInitialCounts);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CSSetShader(self: *const T, pComputeShader: ?*ID3D11ComputeShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, NumClassInstances: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CSSetShader(@ptrCast(*const ID3D11DeviceContext, self), pComputeShader, ppClassInstances, NumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CSSetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CSSetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CSSetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CSSetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_VSGetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).VSGetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_PSGetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).PSGetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_PSGetShader(self: *const T, ppPixelShader: ?*?*ID3D11PixelShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, pNumClassInstances: ?*u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).PSGetShader(@ptrCast(*const ID3D11DeviceContext, self), ppPixelShader, ppClassInstances, pNumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_PSGetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).PSGetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_VSGetShader(self: *const T, ppVertexShader: ?*?*ID3D11VertexShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, pNumClassInstances: ?*u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).VSGetShader(@ptrCast(*const ID3D11DeviceContext, self), ppVertexShader, ppClassInstances, pNumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_PSGetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).PSGetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_IAGetInputLayout(self: *const T, ppInputLayout: ?*?*ID3D11InputLayout) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).IAGetInputLayout(@ptrCast(*const ID3D11DeviceContext, self), ppInputLayout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_IAGetVertexBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppVertexBuffers: ?[*]?*ID3D11Buffer, pStrides: ?[*]u32, pOffsets: ?[*]u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).IAGetVertexBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppVertexBuffers, pStrides, pOffsets);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_IAGetIndexBuffer(self: *const T, pIndexBuffer: ?*?*ID3D11Buffer, Format: ?*DXGI_FORMAT, Offset: ?*u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).IAGetIndexBuffer(@ptrCast(*const ID3D11DeviceContext, self), pIndexBuffer, Format, Offset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GSGetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GSGetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GSGetShader(self: *const T, ppGeometryShader: ?*?*ID3D11GeometryShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, pNumClassInstances: ?*u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GSGetShader(@ptrCast(*const ID3D11DeviceContext, self), ppGeometryShader, ppClassInstances, pNumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_IAGetPrimitiveTopology(self: *const T, pTopology: ?*D3D_PRIMITIVE_TOPOLOGY) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).IAGetPrimitiveTopology(@ptrCast(*const ID3D11DeviceContext, self), pTopology);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_VSGetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).VSGetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_VSGetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).VSGetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GetPredication(self: *const T, ppPredicate: ?*?*ID3D11Predicate, pPredicateValue: ?*BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GetPredication(@ptrCast(*const ID3D11DeviceContext, self), ppPredicate, pPredicateValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GSGetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GSGetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GSGetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GSGetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_OMGetRenderTargets(self: *const T, NumViews: u32, ppRenderTargetViews: ?[*]?*ID3D11RenderTargetView, ppDepthStencilView: ?*?*ID3D11DepthStencilView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).OMGetRenderTargets(@ptrCast(*const ID3D11DeviceContext, self), NumViews, ppRenderTargetViews, ppDepthStencilView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_OMGetRenderTargetsAndUnorderedAccessViews(self: *const T, NumRTVs: u32, ppRenderTargetViews: ?[*]?*ID3D11RenderTargetView, ppDepthStencilView: ?*?*ID3D11DepthStencilView, UAVStartSlot: u32, NumUAVs: u32, ppUnorderedAccessViews: ?[*]?*ID3D11UnorderedAccessView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).OMGetRenderTargetsAndUnorderedAccessViews(@ptrCast(*const ID3D11DeviceContext, self), NumRTVs, ppRenderTargetViews, ppDepthStencilView, UAVStartSlot, NumUAVs, ppUnorderedAccessViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_OMGetBlendState(self: *const T, ppBlendState: ?*?*ID3D11BlendState, BlendFactor: ?*f32, pSampleMask: ?*u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).OMGetBlendState(@ptrCast(*const ID3D11DeviceContext, self), ppBlendState, BlendFactor, pSampleMask);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_OMGetDepthStencilState(self: *const T, ppDepthStencilState: ?*?*ID3D11DepthStencilState, pStencilRef: ?*u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).OMGetDepthStencilState(@ptrCast(*const ID3D11DeviceContext, self), ppDepthStencilState, pStencilRef);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_SOGetTargets(self: *const T, NumBuffers: u32, ppSOTargets: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).SOGetTargets(@ptrCast(*const ID3D11DeviceContext, self), NumBuffers, ppSOTargets);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_RSGetState(self: *const T, ppRasterizerState: ?*?*ID3D11RasterizerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).RSGetState(@ptrCast(*const ID3D11DeviceContext, self), ppRasterizerState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_RSGetViewports(self: *const T, pNumViewports: ?*u32, pViewports: ?[*]D3D11_VIEWPORT) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).RSGetViewports(@ptrCast(*const ID3D11DeviceContext, self), pNumViewports, pViewports);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_RSGetScissorRects(self: *const T, pNumRects: ?*u32, pRects: ?[*]RECT) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).RSGetScissorRects(@ptrCast(*const ID3D11DeviceContext, self), pNumRects, pRects);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_HSGetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).HSGetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_HSGetShader(self: *const T, ppHullShader: ?*?*ID3D11HullShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, pNumClassInstances: ?*u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).HSGetShader(@ptrCast(*const ID3D11DeviceContext, self), ppHullShader, ppClassInstances, pNumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_HSGetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).HSGetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_HSGetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).HSGetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DSGetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DSGetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DSGetShader(self: *const T, ppDomainShader: ?*?*ID3D11DomainShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, pNumClassInstances: ?*u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DSGetShader(@ptrCast(*const ID3D11DeviceContext, self), ppDomainShader, ppClassInstances, pNumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DSGetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DSGetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_DSGetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).DSGetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CSGetShaderResources(self: *const T, StartSlot: u32, NumViews: u32, ppShaderResourceViews: ?[*]?*ID3D11ShaderResourceView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CSGetShaderResources(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumViews, ppShaderResourceViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CSGetUnorderedAccessViews(self: *const T, StartSlot: u32, NumUAVs: u32, ppUnorderedAccessViews: ?[*]?*ID3D11UnorderedAccessView) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CSGetUnorderedAccessViews(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumUAVs, ppUnorderedAccessViews);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CSGetShader(self: *const T, ppComputeShader: ?*?*ID3D11ComputeShader, ppClassInstances: ?[*]?*ID3D11ClassInstance, pNumClassInstances: ?*u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CSGetShader(@ptrCast(*const ID3D11DeviceContext, self), ppComputeShader, ppClassInstances, pNumClassInstances);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CSGetSamplers(self: *const T, StartSlot: u32, NumSamplers: u32, ppSamplers: ?[*]?*ID3D11SamplerState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CSGetSamplers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumSamplers, ppSamplers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_CSGetConstantBuffers(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).CSGetConstantBuffers(@ptrCast(*const ID3D11DeviceContext, self), StartSlot, NumBuffers, ppConstantBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_ClearState(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).ClearState(@ptrCast(*const ID3D11DeviceContext, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_Flush(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).Flush(@ptrCast(*const ID3D11DeviceContext, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GetType(self: *const T) callconv(.Inline) D3D11_DEVICE_CONTEXT_TYPE {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GetType(@ptrCast(*const ID3D11DeviceContext, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_GetContextFlags(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).GetContextFlags(@ptrCast(*const ID3D11DeviceContext, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext_FinishCommandList(self: *const T, RestoreDeferredContextState: BOOL, ppCommandList: ?*?*ID3D11CommandList) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11DeviceContext.VTable, self.vtable).FinishCommandList(@ptrCast(*const ID3D11DeviceContext, self), RestoreDeferredContextState, ppCommandList);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const CD3D11_VIDEO_DEFAULT = extern struct {
placeholder: usize, // TODO: why is this type empty?
};
pub const D3D11_VIDEO_DECODER_DESC = extern struct {
Guid: Guid,
SampleWidth: u32,
SampleHeight: u32,
OutputFormat: DXGI_FORMAT,
};
pub const D3D11_VIDEO_DECODER_CONFIG = extern struct {
guidConfigBitstreamEncryption: Guid,
guidConfigMBcontrolEncryption: Guid,
guidConfigResidDiffEncryption: Guid,
ConfigBitstreamRaw: u32,
ConfigMBcontrolRasterOrder: u32,
ConfigResidDiffHost: u32,
ConfigSpatialResid8: u32,
ConfigResid8Subtraction: u32,
ConfigSpatialHost8or9Clipping: u32,
ConfigSpatialResidInterleaved: u32,
ConfigIntraResidUnsigned: u32,
ConfigResidDiffAccelerator: u32,
ConfigHostInverseScan: u32,
ConfigSpecificIDCT: u32,
Config4GroupedCoefs: u32,
ConfigMinRenderTargetBuffCount: u16,
ConfigDecoderSpecific: u16,
};
pub const D3D11_VIDEO_DECODER_BUFFER_TYPE = enum(i32) {
PICTURE_PARAMETERS = 0,
MACROBLOCK_CONTROL = 1,
RESIDUAL_DIFFERENCE = 2,
DEBLOCKING_CONTROL = 3,
INVERSE_QUANTIZATION_MATRIX = 4,
SLICE_CONTROL = 5,
BITSTREAM = 6,
MOTION_VECTOR = 7,
FILM_GRAIN = 8,
};
pub const D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS = D3D11_VIDEO_DECODER_BUFFER_TYPE.PICTURE_PARAMETERS;
pub const D3D11_VIDEO_DECODER_BUFFER_MACROBLOCK_CONTROL = D3D11_VIDEO_DECODER_BUFFER_TYPE.MACROBLOCK_CONTROL;
pub const D3D11_VIDEO_DECODER_BUFFER_RESIDUAL_DIFFERENCE = D3D11_VIDEO_DECODER_BUFFER_TYPE.RESIDUAL_DIFFERENCE;
pub const D3D11_VIDEO_DECODER_BUFFER_DEBLOCKING_CONTROL = D3D11_VIDEO_DECODER_BUFFER_TYPE.DEBLOCKING_CONTROL;
pub const D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX = D3D11_VIDEO_DECODER_BUFFER_TYPE.INVERSE_QUANTIZATION_MATRIX;
pub const D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL = D3D11_VIDEO_DECODER_BUFFER_TYPE.SLICE_CONTROL;
pub const D3D11_VIDEO_DECODER_BUFFER_BITSTREAM = D3D11_VIDEO_DECODER_BUFFER_TYPE.BITSTREAM;
pub const D3D11_VIDEO_DECODER_BUFFER_MOTION_VECTOR = D3D11_VIDEO_DECODER_BUFFER_TYPE.MOTION_VECTOR;
pub const D3D11_VIDEO_DECODER_BUFFER_FILM_GRAIN = D3D11_VIDEO_DECODER_BUFFER_TYPE.FILM_GRAIN;
pub const D3D11_AES_CTR_IV = extern struct {
IV: u64,
Count: u64,
};
pub const D3D11_ENCRYPTED_BLOCK_INFO = extern struct {
NumEncryptedBytesAtBeginning: u32,
NumBytesInSkipPattern: u32,
NumBytesInEncryptPattern: u32,
};
pub const D3D11_VIDEO_DECODER_BUFFER_DESC = extern struct {
BufferType: D3D11_VIDEO_DECODER_BUFFER_TYPE,
BufferIndex: u32,
DataOffset: u32,
DataSize: u32,
FirstMBaddress: u32,
NumMBsInBuffer: u32,
Width: u32,
Height: u32,
Stride: u32,
ReservedBits: u32,
pIV: ?*anyopaque,
IVSize: u32,
PartialEncryption: BOOL,
EncryptedBlockInfo: D3D11_ENCRYPTED_BLOCK_INFO,
};
pub const D3D11_VIDEO_DECODER_EXTENSION = extern struct {
Function: u32,
pPrivateInputData: ?*anyopaque,
PrivateInputDataSize: u32,
pPrivateOutputData: ?*anyopaque,
PrivateOutputDataSize: u32,
ResourceCount: u32,
ppResourceList: ?*?*ID3D11Resource,
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11VideoDecoder_Value = @import("../zig.zig").Guid.initString("3c9c5b51-995d-48d1-9b8d-fa5caeded65c");
pub const IID_ID3D11VideoDecoder = &IID_ID3D11VideoDecoder_Value;
pub const ID3D11VideoDecoder = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetCreationParameters: fn(
self: *const ID3D11VideoDecoder,
pVideoDesc: ?*D3D11_VIDEO_DECODER_DESC,
pConfig: ?*D3D11_VIDEO_DECODER_CONFIG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDriverHandle: fn(
self: *const ID3D11VideoDecoder,
pDriverHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDecoder_GetCreationParameters(self: *const T, pVideoDesc: ?*D3D11_VIDEO_DECODER_DESC, pConfig: ?*D3D11_VIDEO_DECODER_CONFIG) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDecoder.VTable, self.vtable).GetCreationParameters(@ptrCast(*const ID3D11VideoDecoder, self), pVideoDesc, pConfig);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDecoder_GetDriverHandle(self: *const T, pDriverHandle: ?*?HANDLE) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDecoder.VTable, self.vtable).GetDriverHandle(@ptrCast(*const ID3D11VideoDecoder, self), pDriverHandle);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT = enum(i32) {
INPUT = 1,
OUTPUT = 2,
};
pub const D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_INPUT = D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT.INPUT;
pub const D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT_OUTPUT = D3D11_VIDEO_PROCESSOR_FORMAT_SUPPORT.OUTPUT;
pub const D3D11_VIDEO_PROCESSOR_DEVICE_CAPS = enum(i32) {
LINEAR_SPACE = 1,
xvYCC = 2,
RGB_RANGE_CONVERSION = 4,
YCbCr_MATRIX_CONVERSION = 8,
NOMINAL_RANGE = 16,
};
pub const D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_LINEAR_SPACE = D3D11_VIDEO_PROCESSOR_DEVICE_CAPS.LINEAR_SPACE;
pub const D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_xvYCC = D3D11_VIDEO_PROCESSOR_DEVICE_CAPS.xvYCC;
pub const D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_RGB_RANGE_CONVERSION = D3D11_VIDEO_PROCESSOR_DEVICE_CAPS.RGB_RANGE_CONVERSION;
pub const D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_YCbCr_MATRIX_CONVERSION = D3D11_VIDEO_PROCESSOR_DEVICE_CAPS.YCbCr_MATRIX_CONVERSION;
pub const D3D11_VIDEO_PROCESSOR_DEVICE_CAPS_NOMINAL_RANGE = D3D11_VIDEO_PROCESSOR_DEVICE_CAPS.NOMINAL_RANGE;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS = enum(i32) {
ALPHA_FILL = 1,
CONSTRICTION = 2,
LUMA_KEY = 4,
ALPHA_PALETTE = 8,
LEGACY = 16,
STEREO = 32,
ROTATION = 64,
ALPHA_STREAM = 128,
PIXEL_ASPECT_RATIO = 256,
MIRROR = 512,
SHADER_USAGE = 1024,
METADATA_HDR10 = 2048,
};
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_FILL = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.ALPHA_FILL;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_CONSTRICTION = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.CONSTRICTION;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LUMA_KEY = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.LUMA_KEY;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_PALETTE = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.ALPHA_PALETTE;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_LEGACY = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.LEGACY;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_STEREO = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.STEREO;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ROTATION = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.ROTATION;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_ALPHA_STREAM = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.ALPHA_STREAM;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_PIXEL_ASPECT_RATIO = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.PIXEL_ASPECT_RATIO;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_MIRROR = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.MIRROR;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_SHADER_USAGE = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.SHADER_USAGE;
pub const D3D11_VIDEO_PROCESSOR_FEATURE_CAPS_METADATA_HDR10 = D3D11_VIDEO_PROCESSOR_FEATURE_CAPS.METADATA_HDR10;
pub const D3D11_VIDEO_PROCESSOR_FILTER_CAPS = enum(i32) {
BRIGHTNESS = 1,
CONTRAST = 2,
HUE = 4,
SATURATION = 8,
NOISE_REDUCTION = 16,
EDGE_ENHANCEMENT = 32,
ANAMORPHIC_SCALING = 64,
STEREO_ADJUSTMENT = 128,
};
pub const D3D11_VIDEO_PROCESSOR_FILTER_CAPS_BRIGHTNESS = D3D11_VIDEO_PROCESSOR_FILTER_CAPS.BRIGHTNESS;
pub const D3D11_VIDEO_PROCESSOR_FILTER_CAPS_CONTRAST = D3D11_VIDEO_PROCESSOR_FILTER_CAPS.CONTRAST;
pub const D3D11_VIDEO_PROCESSOR_FILTER_CAPS_HUE = D3D11_VIDEO_PROCESSOR_FILTER_CAPS.HUE;
pub const D3D11_VIDEO_PROCESSOR_FILTER_CAPS_SATURATION = D3D11_VIDEO_PROCESSOR_FILTER_CAPS.SATURATION;
pub const D3D11_VIDEO_PROCESSOR_FILTER_CAPS_NOISE_REDUCTION = D3D11_VIDEO_PROCESSOR_FILTER_CAPS.NOISE_REDUCTION;
pub const D3D11_VIDEO_PROCESSOR_FILTER_CAPS_EDGE_ENHANCEMENT = D3D11_VIDEO_PROCESSOR_FILTER_CAPS.EDGE_ENHANCEMENT;
pub const D3D11_VIDEO_PROCESSOR_FILTER_CAPS_ANAMORPHIC_SCALING = D3D11_VIDEO_PROCESSOR_FILTER_CAPS.ANAMORPHIC_SCALING;
pub const D3D11_VIDEO_PROCESSOR_FILTER_CAPS_STEREO_ADJUSTMENT = D3D11_VIDEO_PROCESSOR_FILTER_CAPS.STEREO_ADJUSTMENT;
pub const D3D11_VIDEO_PROCESSOR_FORMAT_CAPS = enum(i32) {
RGB_INTERLACED = 1,
RGB_PROCAMP = 2,
RGB_LUMA_KEY = 4,
PALETTE_INTERLACED = 8,
};
pub const D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_INTERLACED = D3D11_VIDEO_PROCESSOR_FORMAT_CAPS.RGB_INTERLACED;
pub const D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_PROCAMP = D3D11_VIDEO_PROCESSOR_FORMAT_CAPS.RGB_PROCAMP;
pub const D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_RGB_LUMA_KEY = D3D11_VIDEO_PROCESSOR_FORMAT_CAPS.RGB_LUMA_KEY;
pub const D3D11_VIDEO_PROCESSOR_FORMAT_CAPS_PALETTE_INTERLACED = D3D11_VIDEO_PROCESSOR_FORMAT_CAPS.PALETTE_INTERLACED;
pub const D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS = enum(i32) {
DENOISE = 1,
DERINGING = 2,
EDGE_ENHANCEMENT = 4,
COLOR_CORRECTION = 8,
FLESH_TONE_MAPPING = 16,
IMAGE_STABILIZATION = 32,
SUPER_RESOLUTION = 64,
ANAMORPHIC_SCALING = 128,
};
pub const D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DENOISE = D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS.DENOISE;
pub const D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_DERINGING = D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS.DERINGING;
pub const D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_EDGE_ENHANCEMENT = D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS.EDGE_ENHANCEMENT;
pub const D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_COLOR_CORRECTION = D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS.COLOR_CORRECTION;
pub const D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_FLESH_TONE_MAPPING = D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS.FLESH_TONE_MAPPING;
pub const D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_IMAGE_STABILIZATION = D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS.IMAGE_STABILIZATION;
pub const D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_SUPER_RESOLUTION = D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS.SUPER_RESOLUTION;
pub const D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS_ANAMORPHIC_SCALING = D3D11_VIDEO_PROCESSOR_AUTO_STREAM_CAPS.ANAMORPHIC_SCALING;
pub const D3D11_VIDEO_PROCESSOR_STEREO_CAPS = enum(i32) {
MONO_OFFSET = 1,
ROW_INTERLEAVED = 2,
COLUMN_INTERLEAVED = 4,
CHECKERBOARD = 8,
FLIP_MODE = 16,
};
pub const D3D11_VIDEO_PROCESSOR_STEREO_CAPS_MONO_OFFSET = D3D11_VIDEO_PROCESSOR_STEREO_CAPS.MONO_OFFSET;
pub const D3D11_VIDEO_PROCESSOR_STEREO_CAPS_ROW_INTERLEAVED = D3D11_VIDEO_PROCESSOR_STEREO_CAPS.ROW_INTERLEAVED;
pub const D3D11_VIDEO_PROCESSOR_STEREO_CAPS_COLUMN_INTERLEAVED = D3D11_VIDEO_PROCESSOR_STEREO_CAPS.COLUMN_INTERLEAVED;
pub const D3D11_VIDEO_PROCESSOR_STEREO_CAPS_CHECKERBOARD = D3D11_VIDEO_PROCESSOR_STEREO_CAPS.CHECKERBOARD;
pub const D3D11_VIDEO_PROCESSOR_STEREO_CAPS_FLIP_MODE = D3D11_VIDEO_PROCESSOR_STEREO_CAPS.FLIP_MODE;
pub const D3D11_VIDEO_PROCESSOR_CAPS = extern struct {
DeviceCaps: u32,
FeatureCaps: u32,
FilterCaps: u32,
InputFormatCaps: u32,
AutoStreamCaps: u32,
StereoCaps: u32,
RateConversionCapsCount: u32,
MaxInputStreams: u32,
MaxStreamStates: u32,
};
pub const D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS = enum(i32) {
DEINTERLACE_BLEND = 1,
DEINTERLACE_BOB = 2,
DEINTERLACE_ADAPTIVE = 4,
DEINTERLACE_MOTION_COMPENSATION = 8,
INVERSE_TELECINE = 16,
FRAME_RATE_CONVERSION = 32,
};
pub const D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BLEND = D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS.DEINTERLACE_BLEND;
pub const D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_BOB = D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS.DEINTERLACE_BOB;
pub const D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_ADAPTIVE = D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS.DEINTERLACE_ADAPTIVE;
pub const D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_DEINTERLACE_MOTION_COMPENSATION = D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS.DEINTERLACE_MOTION_COMPENSATION;
pub const D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_INVERSE_TELECINE = D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS.INVERSE_TELECINE;
pub const D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS_FRAME_RATE_CONVERSION = D3D11_VIDEO_PROCESSOR_PROCESSOR_CAPS.FRAME_RATE_CONVERSION;
pub const D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS = enum(i32) {
@"32" = 1,
@"22" = 2,
@"2224" = 4,
@"2332" = 8,
@"32322" = 16,
@"55" = 32,
@"64" = 64,
@"87" = 128,
@"222222222223" = 256,
OTHER = -2147483648,
};
pub const D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32 = D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS.@"32";
pub const D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_22 = D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS.@"22";
pub const D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2224 = D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS.@"2224";
pub const D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_2332 = D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS.@"2332";
pub const D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_32322 = D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS.@"32322";
pub const D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_55 = D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS.@"55";
pub const D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_64 = D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS.@"64";
pub const D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_87 = D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS.@"87";
pub const D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_222222222223 = D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS.@"222222222223";
pub const D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS_OTHER = D3D11_VIDEO_PROCESSOR_ITELECINE_CAPS.OTHER;
pub const D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS = extern struct {
PastFrames: u32,
FutureFrames: u32,
ProcessorCaps: u32,
ITelecineCaps: u32,
CustomRateCount: u32,
};
pub const D3D11_CONTENT_PROTECTION_CAPS = enum(i32) {
SOFTWARE = 1,
HARDWARE = 2,
PROTECTION_ALWAYS_ON = 4,
PARTIAL_DECRYPTION = 8,
CONTENT_KEY = 16,
FRESHEN_SESSION_KEY = 32,
ENCRYPTED_READ_BACK = 64,
ENCRYPTED_READ_BACK_KEY = 128,
SEQUENTIAL_CTR_IV = 256,
ENCRYPT_SLICEDATA_ONLY = 512,
DECRYPTION_BLT = 1024,
HARDWARE_PROTECT_UNCOMPRESSED = 2048,
HARDWARE_PROTECTED_MEMORY_PAGEABLE = 4096,
HARDWARE_TEARDOWN = 8192,
HARDWARE_DRM_COMMUNICATION = 16384,
HARDWARE_DRM_COMMUNICATION_MULTI_THREADED = 32768,
};
pub const D3D11_CONTENT_PROTECTION_CAPS_SOFTWARE = D3D11_CONTENT_PROTECTION_CAPS.SOFTWARE;
pub const D3D11_CONTENT_PROTECTION_CAPS_HARDWARE = D3D11_CONTENT_PROTECTION_CAPS.HARDWARE;
pub const D3D11_CONTENT_PROTECTION_CAPS_PROTECTION_ALWAYS_ON = D3D11_CONTENT_PROTECTION_CAPS.PROTECTION_ALWAYS_ON;
pub const D3D11_CONTENT_PROTECTION_CAPS_PARTIAL_DECRYPTION = D3D11_CONTENT_PROTECTION_CAPS.PARTIAL_DECRYPTION;
pub const D3D11_CONTENT_PROTECTION_CAPS_CONTENT_KEY = D3D11_CONTENT_PROTECTION_CAPS.CONTENT_KEY;
pub const D3D11_CONTENT_PROTECTION_CAPS_FRESHEN_SESSION_KEY = D3D11_CONTENT_PROTECTION_CAPS.FRESHEN_SESSION_KEY;
pub const D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK = D3D11_CONTENT_PROTECTION_CAPS.ENCRYPTED_READ_BACK;
pub const D3D11_CONTENT_PROTECTION_CAPS_ENCRYPTED_READ_BACK_KEY = D3D11_CONTENT_PROTECTION_CAPS.ENCRYPTED_READ_BACK_KEY;
pub const D3D11_CONTENT_PROTECTION_CAPS_SEQUENTIAL_CTR_IV = D3D11_CONTENT_PROTECTION_CAPS.SEQUENTIAL_CTR_IV;
pub const D3D11_CONTENT_PROTECTION_CAPS_ENCRYPT_SLICEDATA_ONLY = D3D11_CONTENT_PROTECTION_CAPS.ENCRYPT_SLICEDATA_ONLY;
pub const D3D11_CONTENT_PROTECTION_CAPS_DECRYPTION_BLT = D3D11_CONTENT_PROTECTION_CAPS.DECRYPTION_BLT;
pub const D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECT_UNCOMPRESSED = D3D11_CONTENT_PROTECTION_CAPS.HARDWARE_PROTECT_UNCOMPRESSED;
pub const D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_PROTECTED_MEMORY_PAGEABLE = D3D11_CONTENT_PROTECTION_CAPS.HARDWARE_PROTECTED_MEMORY_PAGEABLE;
pub const D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_TEARDOWN = D3D11_CONTENT_PROTECTION_CAPS.HARDWARE_TEARDOWN;
pub const D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_DRM_COMMUNICATION = D3D11_CONTENT_PROTECTION_CAPS.HARDWARE_DRM_COMMUNICATION;
pub const D3D11_CONTENT_PROTECTION_CAPS_HARDWARE_DRM_COMMUNICATION_MULTI_THREADED = D3D11_CONTENT_PROTECTION_CAPS.HARDWARE_DRM_COMMUNICATION_MULTI_THREADED;
pub const D3D11_VIDEO_CONTENT_PROTECTION_CAPS = extern struct {
Caps: u32,
KeyExchangeTypeCount: u32,
BlockAlignmentSize: u32,
ProtectedMemorySize: u64,
};
pub const D3D11_VIDEO_PROCESSOR_CUSTOM_RATE = extern struct {
CustomRate: DXGI_RATIONAL,
OutputFrames: u32,
InputInterlaced: BOOL,
InputFramesOrFields: u32,
};
pub const D3D11_VIDEO_PROCESSOR_FILTER = enum(i32) {
BRIGHTNESS = 0,
CONTRAST = 1,
HUE = 2,
SATURATION = 3,
NOISE_REDUCTION = 4,
EDGE_ENHANCEMENT = 5,
ANAMORPHIC_SCALING = 6,
STEREO_ADJUSTMENT = 7,
};
pub const D3D11_VIDEO_PROCESSOR_FILTER_BRIGHTNESS = D3D11_VIDEO_PROCESSOR_FILTER.BRIGHTNESS;
pub const D3D11_VIDEO_PROCESSOR_FILTER_CONTRAST = D3D11_VIDEO_PROCESSOR_FILTER.CONTRAST;
pub const D3D11_VIDEO_PROCESSOR_FILTER_HUE = D3D11_VIDEO_PROCESSOR_FILTER.HUE;
pub const D3D11_VIDEO_PROCESSOR_FILTER_SATURATION = D3D11_VIDEO_PROCESSOR_FILTER.SATURATION;
pub const D3D11_VIDEO_PROCESSOR_FILTER_NOISE_REDUCTION = D3D11_VIDEO_PROCESSOR_FILTER.NOISE_REDUCTION;
pub const D3D11_VIDEO_PROCESSOR_FILTER_EDGE_ENHANCEMENT = D3D11_VIDEO_PROCESSOR_FILTER.EDGE_ENHANCEMENT;
pub const D3D11_VIDEO_PROCESSOR_FILTER_ANAMORPHIC_SCALING = D3D11_VIDEO_PROCESSOR_FILTER.ANAMORPHIC_SCALING;
pub const D3D11_VIDEO_PROCESSOR_FILTER_STEREO_ADJUSTMENT = D3D11_VIDEO_PROCESSOR_FILTER.STEREO_ADJUSTMENT;
pub const D3D11_VIDEO_PROCESSOR_FILTER_RANGE = extern struct {
Minimum: i32,
Maximum: i32,
Default: i32,
Multiplier: f32,
};
pub const D3D11_VIDEO_FRAME_FORMAT = enum(i32) {
PROGRESSIVE = 0,
INTERLACED_TOP_FIELD_FIRST = 1,
INTERLACED_BOTTOM_FIELD_FIRST = 2,
};
pub const D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE = D3D11_VIDEO_FRAME_FORMAT.PROGRESSIVE;
pub const D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = D3D11_VIDEO_FRAME_FORMAT.INTERLACED_TOP_FIELD_FIRST;
pub const D3D11_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = D3D11_VIDEO_FRAME_FORMAT.INTERLACED_BOTTOM_FIELD_FIRST;
pub const D3D11_VIDEO_USAGE = enum(i32) {
PLAYBACK_NORMAL = 0,
OPTIMAL_SPEED = 1,
OPTIMAL_QUALITY = 2,
};
pub const D3D11_VIDEO_USAGE_PLAYBACK_NORMAL = D3D11_VIDEO_USAGE.PLAYBACK_NORMAL;
pub const D3D11_VIDEO_USAGE_OPTIMAL_SPEED = D3D11_VIDEO_USAGE.OPTIMAL_SPEED;
pub const D3D11_VIDEO_USAGE_OPTIMAL_QUALITY = D3D11_VIDEO_USAGE.OPTIMAL_QUALITY;
pub const D3D11_VIDEO_PROCESSOR_CONTENT_DESC = extern struct {
InputFrameFormat: D3D11_VIDEO_FRAME_FORMAT,
InputFrameRate: DXGI_RATIONAL,
InputWidth: u32,
InputHeight: u32,
OutputFrameRate: DXGI_RATIONAL,
OutputWidth: u32,
OutputHeight: u32,
Usage: D3D11_VIDEO_USAGE,
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11VideoProcessorEnumerator_Value = @import("../zig.zig").Guid.initString("31627037-53ab-4200-9061-05faa9ab45f9");
pub const IID_ID3D11VideoProcessorEnumerator = &IID_ID3D11VideoProcessorEnumerator_Value;
pub const ID3D11VideoProcessorEnumerator = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetVideoProcessorContentDesc: fn(
self: *const ID3D11VideoProcessorEnumerator,
pContentDesc: ?*D3D11_VIDEO_PROCESSOR_CONTENT_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CheckVideoProcessorFormat: fn(
self: *const ID3D11VideoProcessorEnumerator,
Format: DXGI_FORMAT,
pFlags: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVideoProcessorCaps: fn(
self: *const ID3D11VideoProcessorEnumerator,
pCaps: ?*D3D11_VIDEO_PROCESSOR_CAPS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVideoProcessorRateConversionCaps: fn(
self: *const ID3D11VideoProcessorEnumerator,
TypeIndex: u32,
pCaps: ?*D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVideoProcessorCustomRate: fn(
self: *const ID3D11VideoProcessorEnumerator,
TypeIndex: u32,
CustomRateIndex: u32,
pRate: ?*D3D11_VIDEO_PROCESSOR_CUSTOM_RATE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVideoProcessorFilterRange: fn(
self: *const ID3D11VideoProcessorEnumerator,
Filter: D3D11_VIDEO_PROCESSOR_FILTER,
pRange: ?*D3D11_VIDEO_PROCESSOR_FILTER_RANGE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoProcessorEnumerator_GetVideoProcessorContentDesc(self: *const T, pContentDesc: ?*D3D11_VIDEO_PROCESSOR_CONTENT_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoProcessorEnumerator.VTable, self.vtable).GetVideoProcessorContentDesc(@ptrCast(*const ID3D11VideoProcessorEnumerator, self), pContentDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoProcessorEnumerator_CheckVideoProcessorFormat(self: *const T, Format: DXGI_FORMAT, pFlags: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoProcessorEnumerator.VTable, self.vtable).CheckVideoProcessorFormat(@ptrCast(*const ID3D11VideoProcessorEnumerator, self), Format, pFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoProcessorEnumerator_GetVideoProcessorCaps(self: *const T, pCaps: ?*D3D11_VIDEO_PROCESSOR_CAPS) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoProcessorEnumerator.VTable, self.vtable).GetVideoProcessorCaps(@ptrCast(*const ID3D11VideoProcessorEnumerator, self), pCaps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoProcessorEnumerator_GetVideoProcessorRateConversionCaps(self: *const T, TypeIndex: u32, pCaps: ?*D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoProcessorEnumerator.VTable, self.vtable).GetVideoProcessorRateConversionCaps(@ptrCast(*const ID3D11VideoProcessorEnumerator, self), TypeIndex, pCaps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoProcessorEnumerator_GetVideoProcessorCustomRate(self: *const T, TypeIndex: u32, CustomRateIndex: u32, pRate: ?*D3D11_VIDEO_PROCESSOR_CUSTOM_RATE) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoProcessorEnumerator.VTable, self.vtable).GetVideoProcessorCustomRate(@ptrCast(*const ID3D11VideoProcessorEnumerator, self), TypeIndex, CustomRateIndex, pRate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoProcessorEnumerator_GetVideoProcessorFilterRange(self: *const T, Filter: D3D11_VIDEO_PROCESSOR_FILTER, pRange: ?*D3D11_VIDEO_PROCESSOR_FILTER_RANGE) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoProcessorEnumerator.VTable, self.vtable).GetVideoProcessorFilterRange(@ptrCast(*const ID3D11VideoProcessorEnumerator, self), Filter, pRange);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_VIDEO_COLOR_RGBA = extern struct {
R: f32,
G: f32,
B: f32,
A: f32,
};
pub const D3D11_VIDEO_COLOR_YCbCrA = extern struct {
Y: f32,
Cb: f32,
Cr: f32,
A: f32,
};
pub const D3D11_VIDEO_COLOR = extern struct {
Anonymous: extern union {
YCbCr: D3D11_VIDEO_COLOR_YCbCrA,
RGBA: D3D11_VIDEO_COLOR_RGBA,
},
};
pub const D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE = enum(i32) {
UNDEFINED = 0,
@"16_235" = 1,
@"0_255" = 2,
};
pub const D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_UNDEFINED = D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE.UNDEFINED;
pub const D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_16_235 = D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE.@"16_235";
pub const D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE_0_255 = D3D11_VIDEO_PROCESSOR_NOMINAL_RANGE.@"0_255";
pub const D3D11_VIDEO_PROCESSOR_COLOR_SPACE = extern struct {
_bitfield: u32,
};
pub const D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE = enum(i32) {
OPAQUE = 0,
BACKGROUND = 1,
DESTINATION = 2,
SOURCE_STREAM = 3,
};
pub const D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_OPAQUE = D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE.OPAQUE;
pub const D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_BACKGROUND = D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE.BACKGROUND;
pub const D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_DESTINATION = D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE.DESTINATION;
pub const D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE_SOURCE_STREAM = D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE.SOURCE_STREAM;
pub const D3D11_VIDEO_PROCESSOR_OUTPUT_RATE = enum(i32) {
NORMAL = 0,
HALF = 1,
CUSTOM = 2,
};
pub const D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_NORMAL = D3D11_VIDEO_PROCESSOR_OUTPUT_RATE.NORMAL;
pub const D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_HALF = D3D11_VIDEO_PROCESSOR_OUTPUT_RATE.HALF;
pub const D3D11_VIDEO_PROCESSOR_OUTPUT_RATE_CUSTOM = D3D11_VIDEO_PROCESSOR_OUTPUT_RATE.CUSTOM;
pub const D3D11_VIDEO_PROCESSOR_STEREO_FORMAT = enum(i32) {
MONO = 0,
HORIZONTAL = 1,
VERTICAL = 2,
SEPARATE = 3,
MONO_OFFSET = 4,
ROW_INTERLEAVED = 5,
COLUMN_INTERLEAVED = 6,
CHECKERBOARD = 7,
};
pub const D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO = D3D11_VIDEO_PROCESSOR_STEREO_FORMAT.MONO;
pub const D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_HORIZONTAL = D3D11_VIDEO_PROCESSOR_STEREO_FORMAT.HORIZONTAL;
pub const D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_VERTICAL = D3D11_VIDEO_PROCESSOR_STEREO_FORMAT.VERTICAL;
pub const D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_SEPARATE = D3D11_VIDEO_PROCESSOR_STEREO_FORMAT.SEPARATE;
pub const D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_MONO_OFFSET = D3D11_VIDEO_PROCESSOR_STEREO_FORMAT.MONO_OFFSET;
pub const D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_ROW_INTERLEAVED = D3D11_VIDEO_PROCESSOR_STEREO_FORMAT.ROW_INTERLEAVED;
pub const D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_COLUMN_INTERLEAVED = D3D11_VIDEO_PROCESSOR_STEREO_FORMAT.COLUMN_INTERLEAVED;
pub const D3D11_VIDEO_PROCESSOR_STEREO_FORMAT_CHECKERBOARD = D3D11_VIDEO_PROCESSOR_STEREO_FORMAT.CHECKERBOARD;
pub const D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE = enum(i32) {
NONE = 0,
FRAME0 = 1,
FRAME1 = 2,
};
pub const D3D11_VIDEO_PROCESSOR_STEREO_FLIP_NONE = D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE.NONE;
pub const D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME0 = D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE.FRAME0;
pub const D3D11_VIDEO_PROCESSOR_STEREO_FLIP_FRAME1 = D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE.FRAME1;
pub const D3D11_VIDEO_PROCESSOR_ROTATION = enum(i32) {
IDENTITY = 0,
@"90" = 1,
@"180" = 2,
@"270" = 3,
};
pub const D3D11_VIDEO_PROCESSOR_ROTATION_IDENTITY = D3D11_VIDEO_PROCESSOR_ROTATION.IDENTITY;
pub const D3D11_VIDEO_PROCESSOR_ROTATION_90 = D3D11_VIDEO_PROCESSOR_ROTATION.@"90";
pub const D3D11_VIDEO_PROCESSOR_ROTATION_180 = D3D11_VIDEO_PROCESSOR_ROTATION.@"180";
pub const D3D11_VIDEO_PROCESSOR_ROTATION_270 = D3D11_VIDEO_PROCESSOR_ROTATION.@"270";
pub const D3D11_VIDEO_PROCESSOR_STREAM = extern struct {
Enable: BOOL,
OutputIndex: u32,
InputFrameOrField: u32,
PastFrames: u32,
FutureFrames: u32,
ppPastSurfaces: ?*?*ID3D11VideoProcessorInputView,
pInputSurface: ?*ID3D11VideoProcessorInputView,
ppFutureSurfaces: ?*?*ID3D11VideoProcessorInputView,
ppPastSurfacesRight: ?*?*ID3D11VideoProcessorInputView,
pInputSurfaceRight: ?*ID3D11VideoProcessorInputView,
ppFutureSurfacesRight: ?*?*ID3D11VideoProcessorInputView,
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11VideoProcessor_Value = @import("../zig.zig").Guid.initString("1d7b0652-185f-41c6-85ce-0c5be3d4ae6c");
pub const IID_ID3D11VideoProcessor = &IID_ID3D11VideoProcessor_Value;
pub const ID3D11VideoProcessor = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetContentDesc: fn(
self: *const ID3D11VideoProcessor,
pDesc: ?*D3D11_VIDEO_PROCESSOR_CONTENT_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
GetRateConversionCaps: fn(
self: *const ID3D11VideoProcessor,
pCaps: ?*D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoProcessor_GetContentDesc(self: *const T, pDesc: ?*D3D11_VIDEO_PROCESSOR_CONTENT_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoProcessor.VTable, self.vtable).GetContentDesc(@ptrCast(*const ID3D11VideoProcessor, self), pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoProcessor_GetRateConversionCaps(self: *const T, pCaps: ?*D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoProcessor.VTable, self.vtable).GetRateConversionCaps(@ptrCast(*const ID3D11VideoProcessor, self), pCaps);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_OMAC = extern struct {
Omac: [16]u8,
};
pub const D3D11_AUTHENTICATED_CHANNEL_TYPE = enum(i32) {
@"3D11" = 1,
RIVER_SOFTWARE = 2,
RIVER_HARDWARE = 3,
};
pub const D3D11_AUTHENTICATED_CHANNEL_D3D11 = D3D11_AUTHENTICATED_CHANNEL_TYPE.@"3D11";
pub const D3D11_AUTHENTICATED_CHANNEL_DRIVER_SOFTWARE = D3D11_AUTHENTICATED_CHANNEL_TYPE.RIVER_SOFTWARE;
pub const D3D11_AUTHENTICATED_CHANNEL_DRIVER_HARDWARE = D3D11_AUTHENTICATED_CHANNEL_TYPE.RIVER_HARDWARE;
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11AuthenticatedChannel_Value = @import("../zig.zig").Guid.initString("3015a308-dcbd-47aa-a747-192486d14d4a");
pub const IID_ID3D11AuthenticatedChannel = &IID_ID3D11AuthenticatedChannel_Value;
pub const ID3D11AuthenticatedChannel = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetCertificateSize: fn(
self: *const ID3D11AuthenticatedChannel,
pCertificateSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCertificate: fn(
self: *const ID3D11AuthenticatedChannel,
CertificateSize: u32,
// TODO: what to do with BytesParamIndex 0?
pCertificate: ?*u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetChannelHandle: fn(
self: *const ID3D11AuthenticatedChannel,
pChannelHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11AuthenticatedChannel_GetCertificateSize(self: *const T, pCertificateSize: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11AuthenticatedChannel.VTable, self.vtable).GetCertificateSize(@ptrCast(*const ID3D11AuthenticatedChannel, self), pCertificateSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11AuthenticatedChannel_GetCertificate(self: *const T, CertificateSize: u32, pCertificate: ?*u8) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11AuthenticatedChannel.VTable, self.vtable).GetCertificate(@ptrCast(*const ID3D11AuthenticatedChannel, self), CertificateSize, pCertificate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11AuthenticatedChannel_GetChannelHandle(self: *const T, pChannelHandle: ?*?HANDLE) callconv(.Inline) void {
return @ptrCast(*const ID3D11AuthenticatedChannel.VTable, self.vtable).GetChannelHandle(@ptrCast(*const ID3D11AuthenticatedChannel, self), pChannelHandle);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_AUTHENTICATED_QUERY_INPUT = extern struct {
QueryType: Guid,
hChannel: ?HANDLE,
SequenceNumber: u32,
};
pub const D3D11_AUTHENTICATED_QUERY_OUTPUT = extern struct {
omac: D3D11_OMAC,
QueryType: Guid,
hChannel: ?HANDLE,
SequenceNumber: u32,
ReturnCode: HRESULT,
};
pub const D3D11_AUTHENTICATED_PROTECTION_FLAGS = extern union {
Flags: extern struct {
_bitfield: u32,
},
Value: u32,
};
pub const D3D11_AUTHENTICATED_QUERY_PROTECTION_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
ProtectionFlags: D3D11_AUTHENTICATED_PROTECTION_FLAGS,
};
pub const D3D11_AUTHENTICATED_QUERY_CHANNEL_TYPE_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
ChannelType: D3D11_AUTHENTICATED_CHANNEL_TYPE,
};
pub const D3D11_AUTHENTICATED_QUERY_DEVICE_HANDLE_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
DeviceHandle: ?HANDLE,
};
pub const D3D11_AUTHENTICATED_QUERY_CRYPTO_SESSION_INPUT = extern struct {
Input: D3D11_AUTHENTICATED_QUERY_INPUT,
DecoderHandle: ?HANDLE,
};
pub const D3D11_AUTHENTICATED_QUERY_CRYPTO_SESSION_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
DecoderHandle: ?HANDLE,
CryptoSessionHandle: ?HANDLE,
DeviceHandle: ?HANDLE,
};
pub const D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_COUNT_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
RestrictedSharedResourceProcessCount: u32,
};
pub const D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_INPUT = extern struct {
Input: D3D11_AUTHENTICATED_QUERY_INPUT,
ProcessIndex: u32,
};
pub const D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE = enum(i32) {
UNKNOWN = 0,
DWM = 1,
HANDLE = 2,
};
pub const D3D11_PROCESSIDTYPE_UNKNOWN = D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE.UNKNOWN;
pub const D3D11_PROCESSIDTYPE_DWM = D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE.DWM;
pub const D3D11_PROCESSIDTYPE_HANDLE = D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE.HANDLE;
pub const D3D11_AUTHENTICATED_QUERY_RESTRICTED_SHARED_RESOURCE_PROCESS_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
ProcessIndex: u32,
ProcessIdentifier: D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE,
ProcessHandle: ?HANDLE,
};
pub const D3D11_AUTHENTICATED_QUERY_UNRESTRICTED_PROTECTED_SHARED_RESOURCE_COUNT_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
UnrestrictedProtectedSharedResourceCount: u32,
};
pub const D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_COUNT_INPUT = extern struct {
Input: D3D11_AUTHENTICATED_QUERY_INPUT,
DeviceHandle: ?HANDLE,
CryptoSessionHandle: ?HANDLE,
};
pub const D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_COUNT_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
DeviceHandle: ?HANDLE,
CryptoSessionHandle: ?HANDLE,
OutputIDCount: u32,
};
pub const D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_INPUT = extern struct {
Input: D3D11_AUTHENTICATED_QUERY_INPUT,
DeviceHandle: ?HANDLE,
CryptoSessionHandle: ?HANDLE,
OutputIDIndex: u32,
};
pub const D3D11_AUTHENTICATED_QUERY_OUTPUT_ID_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
DeviceHandle: ?HANDLE,
CryptoSessionHandle: ?HANDLE,
OutputIDIndex: u32,
OutputID: u64,
};
pub const D3D11_BUS_TYPE = enum(i32) {
TYPE_OTHER = 0,
TYPE_PCI = 1,
TYPE_PCIX = 2,
TYPE_PCIEXPRESS = 3,
TYPE_AGP = 4,
IMPL_MODIFIER_INSIDE_OF_CHIPSET = 65536,
IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = 131072,
IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = 196608,
IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR = 262144,
IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = 327680,
IMPL_MODIFIER_NON_STANDARD = -2147483648,
};
pub const D3D11_BUS_TYPE_OTHER = D3D11_BUS_TYPE.TYPE_OTHER;
pub const D3D11_BUS_TYPE_PCI = D3D11_BUS_TYPE.TYPE_PCI;
pub const D3D11_BUS_TYPE_PCIX = D3D11_BUS_TYPE.TYPE_PCIX;
pub const D3D11_BUS_TYPE_PCIEXPRESS = D3D11_BUS_TYPE.TYPE_PCIEXPRESS;
pub const D3D11_BUS_TYPE_AGP = D3D11_BUS_TYPE.TYPE_AGP;
pub const D3D11_BUS_IMPL_MODIFIER_INSIDE_OF_CHIPSET = D3D11_BUS_TYPE.IMPL_MODIFIER_INSIDE_OF_CHIPSET;
pub const D3D11_BUS_IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP = D3D11_BUS_TYPE.IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP;
pub const D3D11_BUS_IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET = D3D11_BUS_TYPE.IMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET;
pub const D3D11_BUS_IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR = D3D11_BUS_TYPE.IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR;
pub const D3D11_BUS_IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE = D3D11_BUS_TYPE.IMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE;
pub const D3D11_BUS_IMPL_MODIFIER_NON_STANDARD = D3D11_BUS_TYPE.IMPL_MODIFIER_NON_STANDARD;
pub const D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
BusType: D3D11_BUS_TYPE,
AccessibleInContiguousBlocks: BOOL,
AccessibleInNonContiguousBlocks: BOOL,
};
pub const D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_COUNT_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
EncryptionGuidCount: u32,
};
pub const D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_INPUT = extern struct {
Input: D3D11_AUTHENTICATED_QUERY_INPUT,
EncryptionGuidIndex: u32,
};
pub const D3D11_AUTHENTICATED_QUERY_ACCESSIBILITY_ENCRYPTION_GUID_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
EncryptionGuidIndex: u32,
EncryptionGuid: Guid,
};
pub const D3D11_AUTHENTICATED_QUERY_CURRENT_ACCESSIBILITY_ENCRYPTION_OUTPUT = extern struct {
Output: D3D11_AUTHENTICATED_QUERY_OUTPUT,
EncryptionGuid: Guid,
};
pub const D3D11_AUTHENTICATED_CONFIGURE_INPUT = extern struct {
omac: D3D11_OMAC,
ConfigureType: Guid,
hChannel: ?HANDLE,
SequenceNumber: u32,
};
pub const D3D11_AUTHENTICATED_CONFIGURE_OUTPUT = extern struct {
omac: D3D11_OMAC,
ConfigureType: Guid,
hChannel: ?HANDLE,
SequenceNumber: u32,
ReturnCode: HRESULT,
};
pub const D3D11_AUTHENTICATED_CONFIGURE_INITIALIZE_INPUT = extern struct {
Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT,
StartSequenceQuery: u32,
StartSequenceConfigure: u32,
};
pub const D3D11_AUTHENTICATED_CONFIGURE_PROTECTION_INPUT = extern struct {
Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT,
Protections: D3D11_AUTHENTICATED_PROTECTION_FLAGS,
};
pub const D3D11_AUTHENTICATED_CONFIGURE_CRYPTO_SESSION_INPUT = extern struct {
Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT,
DecoderHandle: ?HANDLE,
CryptoSessionHandle: ?HANDLE,
DeviceHandle: ?HANDLE,
};
pub const D3D11_AUTHENTICATED_CONFIGURE_SHARED_RESOURCE_INPUT = extern struct {
Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT,
ProcessType: D3D11_AUTHENTICATED_PROCESS_IDENTIFIER_TYPE,
ProcessHandle: ?HANDLE,
AllowAccess: BOOL,
};
pub const D3D11_AUTHENTICATED_CONFIGURE_ACCESSIBLE_ENCRYPTION_INPUT = extern struct {
Parameters: D3D11_AUTHENTICATED_CONFIGURE_INPUT,
EncryptionGuid: Guid,
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11CryptoSession_Value = @import("../zig.zig").Guid.initString("9b32f9ad-bdcc-40a6-a39d-d5c865845720");
pub const IID_ID3D11CryptoSession = &IID_ID3D11CryptoSession_Value;
pub const ID3D11CryptoSession = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetCryptoType: fn(
self: *const ID3D11CryptoSession,
pCryptoType: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) void,
GetDecoderProfile: fn(
self: *const ID3D11CryptoSession,
pDecoderProfile: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) void,
GetCertificateSize: fn(
self: *const ID3D11CryptoSession,
pCertificateSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCertificate: fn(
self: *const ID3D11CryptoSession,
CertificateSize: u32,
// TODO: what to do with BytesParamIndex 0?
pCertificate: ?*u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCryptoSessionHandle: fn(
self: *const ID3D11CryptoSession,
pCryptoSessionHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11CryptoSession_GetCryptoType(self: *const T, pCryptoType: ?*Guid) callconv(.Inline) void {
return @ptrCast(*const ID3D11CryptoSession.VTable, self.vtable).GetCryptoType(@ptrCast(*const ID3D11CryptoSession, self), pCryptoType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11CryptoSession_GetDecoderProfile(self: *const T, pDecoderProfile: ?*Guid) callconv(.Inline) void {
return @ptrCast(*const ID3D11CryptoSession.VTable, self.vtable).GetDecoderProfile(@ptrCast(*const ID3D11CryptoSession, self), pDecoderProfile);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11CryptoSession_GetCertificateSize(self: *const T, pCertificateSize: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11CryptoSession.VTable, self.vtable).GetCertificateSize(@ptrCast(*const ID3D11CryptoSession, self), pCertificateSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11CryptoSession_GetCertificate(self: *const T, CertificateSize: u32, pCertificate: ?*u8) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11CryptoSession.VTable, self.vtable).GetCertificate(@ptrCast(*const ID3D11CryptoSession, self), CertificateSize, pCertificate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11CryptoSession_GetCryptoSessionHandle(self: *const T, pCryptoSessionHandle: ?*?HANDLE) callconv(.Inline) void {
return @ptrCast(*const ID3D11CryptoSession.VTable, self.vtable).GetCryptoSessionHandle(@ptrCast(*const ID3D11CryptoSession, self), pCryptoSessionHandle);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_VDOV_DIMENSION = enum(i32) {
UNKNOWN = 0,
TEXTURE2D = 1,
};
pub const D3D11_VDOV_DIMENSION_UNKNOWN = D3D11_VDOV_DIMENSION.UNKNOWN;
pub const D3D11_VDOV_DIMENSION_TEXTURE2D = D3D11_VDOV_DIMENSION.TEXTURE2D;
pub const D3D11_TEX2D_VDOV = extern struct {
ArraySlice: u32,
};
pub const D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC = extern struct {
DecodeProfile: Guid,
ViewDimension: D3D11_VDOV_DIMENSION,
Anonymous: extern union {
Texture2D: D3D11_TEX2D_VDOV,
},
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11VideoDecoderOutputView_Value = @import("../zig.zig").Guid.initString("c2931aea-2a85-4f20-860f-fba1fd256e18");
pub const IID_ID3D11VideoDecoderOutputView = &IID_ID3D11VideoDecoderOutputView_Value;
pub const ID3D11VideoDecoderOutputView = extern struct {
pub const VTable = extern struct {
base: ID3D11View.VTable,
GetDesc: fn(
self: *const ID3D11VideoDecoderOutputView,
pDesc: ?*D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11View.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDecoderOutputView_GetDesc(self: *const T, pDesc: ?*D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoDecoderOutputView.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11VideoDecoderOutputView, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_VPIV_DIMENSION = enum(i32) {
UNKNOWN = 0,
TEXTURE2D = 1,
};
pub const D3D11_VPIV_DIMENSION_UNKNOWN = D3D11_VPIV_DIMENSION.UNKNOWN;
pub const D3D11_VPIV_DIMENSION_TEXTURE2D = D3D11_VPIV_DIMENSION.TEXTURE2D;
pub const D3D11_TEX2D_VPIV = extern struct {
MipSlice: u32,
ArraySlice: u32,
};
pub const D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC = extern struct {
FourCC: u32,
ViewDimension: D3D11_VPIV_DIMENSION,
Anonymous: extern union {
Texture2D: D3D11_TEX2D_VPIV,
},
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11VideoProcessorInputView_Value = @import("../zig.zig").Guid.initString("11ec5a5f-51dc-4945-ab34-6e8c21300ea5");
pub const IID_ID3D11VideoProcessorInputView = &IID_ID3D11VideoProcessorInputView_Value;
pub const ID3D11VideoProcessorInputView = extern struct {
pub const VTable = extern struct {
base: ID3D11View.VTable,
GetDesc: fn(
self: *const ID3D11VideoProcessorInputView,
pDesc: ?*D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11View.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoProcessorInputView_GetDesc(self: *const T, pDesc: ?*D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoProcessorInputView.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11VideoProcessorInputView, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_VPOV_DIMENSION = enum(i32) {
UNKNOWN = 0,
TEXTURE2D = 1,
TEXTURE2DARRAY = 2,
};
pub const D3D11_VPOV_DIMENSION_UNKNOWN = D3D11_VPOV_DIMENSION.UNKNOWN;
pub const D3D11_VPOV_DIMENSION_TEXTURE2D = D3D11_VPOV_DIMENSION.TEXTURE2D;
pub const D3D11_VPOV_DIMENSION_TEXTURE2DARRAY = D3D11_VPOV_DIMENSION.TEXTURE2DARRAY;
pub const D3D11_TEX2D_VPOV = extern struct {
MipSlice: u32,
};
pub const D3D11_TEX2D_ARRAY_VPOV = extern struct {
MipSlice: u32,
FirstArraySlice: u32,
ArraySize: u32,
};
pub const D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC = extern struct {
ViewDimension: D3D11_VPOV_DIMENSION,
Anonymous: extern union {
Texture2D: D3D11_TEX2D_VPOV,
Texture2DArray: D3D11_TEX2D_ARRAY_VPOV,
},
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11VideoProcessorOutputView_Value = @import("../zig.zig").Guid.initString("a048285e-25a9-4527-bd93-d68b68c44254");
pub const IID_ID3D11VideoProcessorOutputView = &IID_ID3D11VideoProcessorOutputView_Value;
pub const ID3D11VideoProcessorOutputView = extern struct {
pub const VTable = extern struct {
base: ID3D11View.VTable,
GetDesc: fn(
self: *const ID3D11VideoProcessorOutputView,
pDesc: ?*D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11View.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoProcessorOutputView_GetDesc(self: *const T, pDesc: ?*D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoProcessorOutputView.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11VideoProcessorOutputView, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11VideoContext_Value = @import("../zig.zig").Guid.initString("61f21c45-3c0e-4a74-9cea-67100d9ad5e4");
pub const IID_ID3D11VideoContext = &IID_ID3D11VideoContext_Value;
pub const ID3D11VideoContext = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
GetDecoderBuffer: fn(
self: *const ID3D11VideoContext,
pDecoder: ?*ID3D11VideoDecoder,
Type: D3D11_VIDEO_DECODER_BUFFER_TYPE,
pBufferSize: ?*u32,
ppBuffer: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReleaseDecoderBuffer: fn(
self: *const ID3D11VideoContext,
pDecoder: ?*ID3D11VideoDecoder,
Type: D3D11_VIDEO_DECODER_BUFFER_TYPE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DecoderBeginFrame: fn(
self: *const ID3D11VideoContext,
pDecoder: ?*ID3D11VideoDecoder,
pView: ?*ID3D11VideoDecoderOutputView,
ContentKeySize: u32,
// TODO: what to do with BytesParamIndex 2?
pContentKey: ?*const anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DecoderEndFrame: fn(
self: *const ID3D11VideoContext,
pDecoder: ?*ID3D11VideoDecoder,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SubmitDecoderBuffers: fn(
self: *const ID3D11VideoContext,
pDecoder: ?*ID3D11VideoDecoder,
NumBuffers: u32,
pBufferDesc: [*]const D3D11_VIDEO_DECODER_BUFFER_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DecoderExtension: fn(
self: *const ID3D11VideoContext,
pDecoder: ?*ID3D11VideoDecoder,
pExtensionData: ?*const D3D11_VIDEO_DECODER_EXTENSION,
) callconv(@import("std").os.windows.WINAPI) i32,
VideoProcessorSetOutputTargetRect: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
Enable: BOOL,
pRect: ?*const RECT,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetOutputBackgroundColor: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
YCbCr: BOOL,
pColor: ?*const D3D11_VIDEO_COLOR,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetOutputColorSpace: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
pColorSpace: ?*const D3D11_VIDEO_PROCESSOR_COLOR_SPACE,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetOutputAlphaFillMode: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
AlphaFillMode: D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE,
StreamIndex: u32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetOutputConstriction: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
Enable: BOOL,
Size: SIZE,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetOutputStereoMode: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
Enable: BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetOutputExtension: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
pExtensionGuid: ?*const Guid,
DataSize: u32,
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i32,
VideoProcessorGetOutputTargetRect: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
Enabled: ?*BOOL,
pRect: ?*RECT,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetOutputBackgroundColor: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
pYCbCr: ?*BOOL,
pColor: ?*D3D11_VIDEO_COLOR,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetOutputColorSpace: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
pColorSpace: ?*D3D11_VIDEO_PROCESSOR_COLOR_SPACE,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetOutputAlphaFillMode: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
pAlphaFillMode: ?*D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE,
pStreamIndex: ?*u32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetOutputConstriction: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
pEnabled: ?*BOOL,
pSize: ?*SIZE,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetOutputStereoMode: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
pEnabled: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetOutputExtension: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
pExtensionGuid: ?*const Guid,
DataSize: u32,
// TODO: what to do with BytesParamIndex 2?
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i32,
VideoProcessorSetStreamFrameFormat: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
FrameFormat: D3D11_VIDEO_FRAME_FORMAT,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamColorSpace: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pColorSpace: ?*const D3D11_VIDEO_PROCESSOR_COLOR_SPACE,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamOutputRate: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
OutputRate: D3D11_VIDEO_PROCESSOR_OUTPUT_RATE,
RepeatFrame: BOOL,
pCustomRate: ?*const DXGI_RATIONAL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamSourceRect: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Enable: BOOL,
pRect: ?*const RECT,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamDestRect: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Enable: BOOL,
pRect: ?*const RECT,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamAlpha: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Enable: BOOL,
Alpha: f32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamPalette: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Count: u32,
pEntries: ?[*]const u32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamPixelAspectRatio: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Enable: BOOL,
pSourceAspectRatio: ?*const DXGI_RATIONAL,
pDestinationAspectRatio: ?*const DXGI_RATIONAL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamLumaKey: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Enable: BOOL,
Lower: f32,
Upper: f32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamStereoFormat: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Enable: BOOL,
Format: D3D11_VIDEO_PROCESSOR_STEREO_FORMAT,
LeftViewFrame0: BOOL,
BaseViewFrame0: BOOL,
FlipMode: D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE,
MonoOffset: i32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamAutoProcessingMode: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Enable: BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamFilter: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Filter: D3D11_VIDEO_PROCESSOR_FILTER,
Enable: BOOL,
Level: i32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamExtension: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pExtensionGuid: ?*const Guid,
DataSize: u32,
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i32,
VideoProcessorGetStreamFrameFormat: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pFrameFormat: ?*D3D11_VIDEO_FRAME_FORMAT,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamColorSpace: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pColorSpace: ?*D3D11_VIDEO_PROCESSOR_COLOR_SPACE,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamOutputRate: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pOutputRate: ?*D3D11_VIDEO_PROCESSOR_OUTPUT_RATE,
pRepeatFrame: ?*BOOL,
pCustomRate: ?*DXGI_RATIONAL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamSourceRect: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pEnabled: ?*BOOL,
pRect: ?*RECT,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamDestRect: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pEnabled: ?*BOOL,
pRect: ?*RECT,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamAlpha: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pEnabled: ?*BOOL,
pAlpha: ?*f32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamPalette: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Count: u32,
pEntries: [*]u32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamPixelAspectRatio: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pEnabled: ?*BOOL,
pSourceAspectRatio: ?*DXGI_RATIONAL,
pDestinationAspectRatio: ?*DXGI_RATIONAL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamLumaKey: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pEnabled: ?*BOOL,
pLower: ?*f32,
pUpper: ?*f32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamStereoFormat: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pEnable: ?*BOOL,
pFormat: ?*D3D11_VIDEO_PROCESSOR_STEREO_FORMAT,
pLeftViewFrame0: ?*BOOL,
pBaseViewFrame0: ?*BOOL,
pFlipMode: ?*D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE,
MonoOffset: ?*i32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamAutoProcessingMode: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pEnabled: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamFilter: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Filter: D3D11_VIDEO_PROCESSOR_FILTER,
pEnabled: ?*BOOL,
pLevel: ?*i32,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamExtension: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pExtensionGuid: ?*const Guid,
DataSize: u32,
// TODO: what to do with BytesParamIndex 3?
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) i32,
VideoProcessorBlt: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
pView: ?*ID3D11VideoProcessorOutputView,
OutputFrame: u32,
StreamCount: u32,
pStreams: [*]const D3D11_VIDEO_PROCESSOR_STREAM,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
NegotiateCryptoSessionKeyExchange: fn(
self: *const ID3D11VideoContext,
pCryptoSession: ?*ID3D11CryptoSession,
DataSize: u32,
// TODO: what to do with BytesParamIndex 1?
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EncryptionBlt: fn(
self: *const ID3D11VideoContext,
pCryptoSession: ?*ID3D11CryptoSession,
pSrcSurface: ?*ID3D11Texture2D,
pDstSurface: ?*ID3D11Texture2D,
IVSize: u32,
// TODO: what to do with BytesParamIndex 3?
pIV: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) void,
DecryptionBlt: fn(
self: *const ID3D11VideoContext,
pCryptoSession: ?*ID3D11CryptoSession,
pSrcSurface: ?*ID3D11Texture2D,
pDstSurface: ?*ID3D11Texture2D,
pEncryptedBlockInfo: ?*D3D11_ENCRYPTED_BLOCK_INFO,
ContentKeySize: u32,
// TODO: what to do with BytesParamIndex 4?
pContentKey: ?*const anyopaque,
IVSize: u32,
// TODO: what to do with BytesParamIndex 6?
pIV: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) void,
StartSessionKeyRefresh: fn(
self: *const ID3D11VideoContext,
pCryptoSession: ?*ID3D11CryptoSession,
RandomNumberSize: u32,
// TODO: what to do with BytesParamIndex 1?
pRandomNumber: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) void,
FinishSessionKeyRefresh: fn(
self: *const ID3D11VideoContext,
pCryptoSession: ?*ID3D11CryptoSession,
) callconv(@import("std").os.windows.WINAPI) void,
GetEncryptionBltKey: fn(
self: *const ID3D11VideoContext,
pCryptoSession: ?*ID3D11CryptoSession,
KeySize: u32,
// TODO: what to do with BytesParamIndex 1?
pReadbackKey: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
NegotiateAuthenticatedChannelKeyExchange: fn(
self: *const ID3D11VideoContext,
pChannel: ?*ID3D11AuthenticatedChannel,
DataSize: u32,
// TODO: what to do with BytesParamIndex 1?
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
QueryAuthenticatedChannel: fn(
self: *const ID3D11VideoContext,
pChannel: ?*ID3D11AuthenticatedChannel,
InputSize: u32,
// TODO: what to do with BytesParamIndex 1?
pInput: ?*const anyopaque,
OutputSize: u32,
// TODO: what to do with BytesParamIndex 3?
pOutput: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ConfigureAuthenticatedChannel: fn(
self: *const ID3D11VideoContext,
pChannel: ?*ID3D11AuthenticatedChannel,
InputSize: u32,
// TODO: what to do with BytesParamIndex 1?
pInput: ?*const anyopaque,
pOutput: ?*D3D11_AUTHENTICATED_CONFIGURE_OUTPUT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
VideoProcessorSetStreamRotation: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Enable: BOOL,
Rotation: D3D11_VIDEO_PROCESSOR_ROTATION,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamRotation: fn(
self: *const ID3D11VideoContext,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pEnable: ?*BOOL,
pRotation: ?*D3D11_VIDEO_PROCESSOR_ROTATION,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_GetDecoderBuffer(self: *const T, pDecoder: ?*ID3D11VideoDecoder, Type: D3D11_VIDEO_DECODER_BUFFER_TYPE, pBufferSize: ?*u32, ppBuffer: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).GetDecoderBuffer(@ptrCast(*const ID3D11VideoContext, self), pDecoder, Type, pBufferSize, ppBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_ReleaseDecoderBuffer(self: *const T, pDecoder: ?*ID3D11VideoDecoder, Type: D3D11_VIDEO_DECODER_BUFFER_TYPE) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).ReleaseDecoderBuffer(@ptrCast(*const ID3D11VideoContext, self), pDecoder, Type);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_DecoderBeginFrame(self: *const T, pDecoder: ?*ID3D11VideoDecoder, pView: ?*ID3D11VideoDecoderOutputView, ContentKeySize: u32, pContentKey: ?*const anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).DecoderBeginFrame(@ptrCast(*const ID3D11VideoContext, self), pDecoder, pView, ContentKeySize, pContentKey);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_DecoderEndFrame(self: *const T, pDecoder: ?*ID3D11VideoDecoder) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).DecoderEndFrame(@ptrCast(*const ID3D11VideoContext, self), pDecoder);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_SubmitDecoderBuffers(self: *const T, pDecoder: ?*ID3D11VideoDecoder, NumBuffers: u32, pBufferDesc: [*]const D3D11_VIDEO_DECODER_BUFFER_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).SubmitDecoderBuffers(@ptrCast(*const ID3D11VideoContext, self), pDecoder, NumBuffers, pBufferDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_DecoderExtension(self: *const T, pDecoder: ?*ID3D11VideoDecoder, pExtensionData: ?*const D3D11_VIDEO_DECODER_EXTENSION) callconv(.Inline) i32 {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).DecoderExtension(@ptrCast(*const ID3D11VideoContext, self), pDecoder, pExtensionData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetOutputTargetRect(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, Enable: BOOL, pRect: ?*const RECT) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetOutputTargetRect(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, Enable, pRect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetOutputBackgroundColor(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, YCbCr: BOOL, pColor: ?*const D3D11_VIDEO_COLOR) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetOutputBackgroundColor(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, YCbCr, pColor);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetOutputColorSpace(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pColorSpace: ?*const D3D11_VIDEO_PROCESSOR_COLOR_SPACE) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetOutputColorSpace(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, pColorSpace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetOutputAlphaFillMode(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, AlphaFillMode: D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE, StreamIndex: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetOutputAlphaFillMode(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, AlphaFillMode, StreamIndex);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetOutputConstriction(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, Enable: BOOL, Size: SIZE) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetOutputConstriction(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, Enable, Size);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetOutputStereoMode(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, Enable: BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetOutputStereoMode(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, Enable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetOutputExtension(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pExtensionGuid: ?*const Guid, DataSize: u32, pData: ?*anyopaque) callconv(.Inline) i32 {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetOutputExtension(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, pExtensionGuid, DataSize, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetOutputTargetRect(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, Enabled: ?*BOOL, pRect: ?*RECT) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetOutputTargetRect(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, Enabled, pRect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetOutputBackgroundColor(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pYCbCr: ?*BOOL, pColor: ?*D3D11_VIDEO_COLOR) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetOutputBackgroundColor(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, pYCbCr, pColor);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetOutputColorSpace(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pColorSpace: ?*D3D11_VIDEO_PROCESSOR_COLOR_SPACE) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetOutputColorSpace(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, pColorSpace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetOutputAlphaFillMode(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pAlphaFillMode: ?*D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE, pStreamIndex: ?*u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetOutputAlphaFillMode(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, pAlphaFillMode, pStreamIndex);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetOutputConstriction(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pEnabled: ?*BOOL, pSize: ?*SIZE) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetOutputConstriction(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, pEnabled, pSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetOutputStereoMode(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pEnabled: ?*BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetOutputStereoMode(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, pEnabled);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetOutputExtension(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pExtensionGuid: ?*const Guid, DataSize: u32, pData: ?*anyopaque) callconv(.Inline) i32 {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetOutputExtension(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, pExtensionGuid, DataSize, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamFrameFormat(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, FrameFormat: D3D11_VIDEO_FRAME_FORMAT) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamFrameFormat(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, FrameFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamColorSpace(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pColorSpace: ?*const D3D11_VIDEO_PROCESSOR_COLOR_SPACE) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamColorSpace(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pColorSpace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamOutputRate(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, OutputRate: D3D11_VIDEO_PROCESSOR_OUTPUT_RATE, RepeatFrame: BOOL, pCustomRate: ?*const DXGI_RATIONAL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamOutputRate(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, OutputRate, RepeatFrame, pCustomRate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamSourceRect(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Enable: BOOL, pRect: ?*const RECT) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamSourceRect(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Enable, pRect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamDestRect(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Enable: BOOL, pRect: ?*const RECT) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamDestRect(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Enable, pRect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamAlpha(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Enable: BOOL, Alpha: f32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamAlpha(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Enable, Alpha);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamPalette(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Count: u32, pEntries: ?[*]const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamPalette(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Count, pEntries);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamPixelAspectRatio(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Enable: BOOL, pSourceAspectRatio: ?*const DXGI_RATIONAL, pDestinationAspectRatio: ?*const DXGI_RATIONAL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamPixelAspectRatio(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Enable, pSourceAspectRatio, pDestinationAspectRatio);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamLumaKey(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Enable: BOOL, Lower: f32, Upper: f32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamLumaKey(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Enable, Lower, Upper);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamStereoFormat(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Enable: BOOL, Format: D3D11_VIDEO_PROCESSOR_STEREO_FORMAT, LeftViewFrame0: BOOL, BaseViewFrame0: BOOL, FlipMode: D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE, MonoOffset: i32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamStereoFormat(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Enable, Format, LeftViewFrame0, BaseViewFrame0, FlipMode, MonoOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamAutoProcessingMode(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Enable: BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamAutoProcessingMode(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Enable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamFilter(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Filter: D3D11_VIDEO_PROCESSOR_FILTER, Enable: BOOL, Level: i32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamFilter(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Filter, Enable, Level);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamExtension(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pExtensionGuid: ?*const Guid, DataSize: u32, pData: ?*anyopaque) callconv(.Inline) i32 {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamExtension(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pExtensionGuid, DataSize, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamFrameFormat(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pFrameFormat: ?*D3D11_VIDEO_FRAME_FORMAT) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamFrameFormat(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pFrameFormat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamColorSpace(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pColorSpace: ?*D3D11_VIDEO_PROCESSOR_COLOR_SPACE) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamColorSpace(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pColorSpace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamOutputRate(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pOutputRate: ?*D3D11_VIDEO_PROCESSOR_OUTPUT_RATE, pRepeatFrame: ?*BOOL, pCustomRate: ?*DXGI_RATIONAL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamOutputRate(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pOutputRate, pRepeatFrame, pCustomRate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamSourceRect(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pEnabled: ?*BOOL, pRect: ?*RECT) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamSourceRect(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pEnabled, pRect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamDestRect(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pEnabled: ?*BOOL, pRect: ?*RECT) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamDestRect(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pEnabled, pRect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamAlpha(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pEnabled: ?*BOOL, pAlpha: ?*f32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamAlpha(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pEnabled, pAlpha);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamPalette(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Count: u32, pEntries: [*]u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamPalette(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Count, pEntries);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamPixelAspectRatio(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pEnabled: ?*BOOL, pSourceAspectRatio: ?*DXGI_RATIONAL, pDestinationAspectRatio: ?*DXGI_RATIONAL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamPixelAspectRatio(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pEnabled, pSourceAspectRatio, pDestinationAspectRatio);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamLumaKey(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pEnabled: ?*BOOL, pLower: ?*f32, pUpper: ?*f32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamLumaKey(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pEnabled, pLower, pUpper);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamStereoFormat(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pEnable: ?*BOOL, pFormat: ?*D3D11_VIDEO_PROCESSOR_STEREO_FORMAT, pLeftViewFrame0: ?*BOOL, pBaseViewFrame0: ?*BOOL, pFlipMode: ?*D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE, MonoOffset: ?*i32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamStereoFormat(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pEnable, pFormat, pLeftViewFrame0, pBaseViewFrame0, pFlipMode, MonoOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamAutoProcessingMode(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pEnabled: ?*BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamAutoProcessingMode(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pEnabled);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamFilter(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Filter: D3D11_VIDEO_PROCESSOR_FILTER, pEnabled: ?*BOOL, pLevel: ?*i32) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamFilter(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Filter, pEnabled, pLevel);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamExtension(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pExtensionGuid: ?*const Guid, DataSize: u32, pData: ?*anyopaque) callconv(.Inline) i32 {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamExtension(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pExtensionGuid, DataSize, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorBlt(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pView: ?*ID3D11VideoProcessorOutputView, OutputFrame: u32, StreamCount: u32, pStreams: [*]const D3D11_VIDEO_PROCESSOR_STREAM) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorBlt(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, pView, OutputFrame, StreamCount, pStreams);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_NegotiateCryptoSessionKeyExchange(self: *const T, pCryptoSession: ?*ID3D11CryptoSession, DataSize: u32, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).NegotiateCryptoSessionKeyExchange(@ptrCast(*const ID3D11VideoContext, self), pCryptoSession, DataSize, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_EncryptionBlt(self: *const T, pCryptoSession: ?*ID3D11CryptoSession, pSrcSurface: ?*ID3D11Texture2D, pDstSurface: ?*ID3D11Texture2D, IVSize: u32, pIV: ?*anyopaque) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).EncryptionBlt(@ptrCast(*const ID3D11VideoContext, self), pCryptoSession, pSrcSurface, pDstSurface, IVSize, pIV);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_DecryptionBlt(self: *const T, pCryptoSession: ?*ID3D11CryptoSession, pSrcSurface: ?*ID3D11Texture2D, pDstSurface: ?*ID3D11Texture2D, pEncryptedBlockInfo: ?*D3D11_ENCRYPTED_BLOCK_INFO, ContentKeySize: u32, pContentKey: ?*const anyopaque, IVSize: u32, pIV: ?*anyopaque) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).DecryptionBlt(@ptrCast(*const ID3D11VideoContext, self), pCryptoSession, pSrcSurface, pDstSurface, pEncryptedBlockInfo, ContentKeySize, pContentKey, IVSize, pIV);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_StartSessionKeyRefresh(self: *const T, pCryptoSession: ?*ID3D11CryptoSession, RandomNumberSize: u32, pRandomNumber: ?*anyopaque) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).StartSessionKeyRefresh(@ptrCast(*const ID3D11VideoContext, self), pCryptoSession, RandomNumberSize, pRandomNumber);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_FinishSessionKeyRefresh(self: *const T, pCryptoSession: ?*ID3D11CryptoSession) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).FinishSessionKeyRefresh(@ptrCast(*const ID3D11VideoContext, self), pCryptoSession);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_GetEncryptionBltKey(self: *const T, pCryptoSession: ?*ID3D11CryptoSession, KeySize: u32, pReadbackKey: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).GetEncryptionBltKey(@ptrCast(*const ID3D11VideoContext, self), pCryptoSession, KeySize, pReadbackKey);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_NegotiateAuthenticatedChannelKeyExchange(self: *const T, pChannel: ?*ID3D11AuthenticatedChannel, DataSize: u32, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).NegotiateAuthenticatedChannelKeyExchange(@ptrCast(*const ID3D11VideoContext, self), pChannel, DataSize, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_QueryAuthenticatedChannel(self: *const T, pChannel: ?*ID3D11AuthenticatedChannel, InputSize: u32, pInput: ?*const anyopaque, OutputSize: u32, pOutput: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).QueryAuthenticatedChannel(@ptrCast(*const ID3D11VideoContext, self), pChannel, InputSize, pInput, OutputSize, pOutput);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_ConfigureAuthenticatedChannel(self: *const T, pChannel: ?*ID3D11AuthenticatedChannel, InputSize: u32, pInput: ?*const anyopaque, pOutput: ?*D3D11_AUTHENTICATED_CONFIGURE_OUTPUT) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).ConfigureAuthenticatedChannel(@ptrCast(*const ID3D11VideoContext, self), pChannel, InputSize, pInput, pOutput);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorSetStreamRotation(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Enable: BOOL, Rotation: D3D11_VIDEO_PROCESSOR_ROTATION) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorSetStreamRotation(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, Enable, Rotation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext_VideoProcessorGetStreamRotation(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pEnable: ?*BOOL, pRotation: ?*D3D11_VIDEO_PROCESSOR_ROTATION) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext.VTable, self.vtable).VideoProcessorGetStreamRotation(@ptrCast(*const ID3D11VideoContext, self), pVideoProcessor, StreamIndex, pEnable, pRotation);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11VideoDevice_Value = @import("../zig.zig").Guid.initString("10ec4d5b-975a-4689-b9e4-d0aac30fe333");
pub const IID_ID3D11VideoDevice = &IID_ID3D11VideoDevice_Value;
pub const ID3D11VideoDevice = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateVideoDecoder: fn(
self: *const ID3D11VideoDevice,
pVideoDesc: ?*const D3D11_VIDEO_DECODER_DESC,
pConfig: ?*const D3D11_VIDEO_DECODER_CONFIG,
ppDecoder: ?*?*ID3D11VideoDecoder,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateVideoProcessor: fn(
self: *const ID3D11VideoDevice,
pEnum: ?*ID3D11VideoProcessorEnumerator,
RateConversionIndex: u32,
ppVideoProcessor: ?*?*ID3D11VideoProcessor,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateAuthenticatedChannel: fn(
self: *const ID3D11VideoDevice,
ChannelType: D3D11_AUTHENTICATED_CHANNEL_TYPE,
ppAuthenticatedChannel: ?*?*ID3D11AuthenticatedChannel,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateCryptoSession: fn(
self: *const ID3D11VideoDevice,
pCryptoType: ?*const Guid,
pDecoderProfile: ?*const Guid,
pKeyExchangeType: ?*const Guid,
ppCryptoSession: ?*?*ID3D11CryptoSession,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateVideoDecoderOutputView: fn(
self: *const ID3D11VideoDevice,
pResource: ?*ID3D11Resource,
pDesc: ?*const D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC,
ppVDOVView: ?*?*ID3D11VideoDecoderOutputView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateVideoProcessorInputView: fn(
self: *const ID3D11VideoDevice,
pResource: ?*ID3D11Resource,
pEnum: ?*ID3D11VideoProcessorEnumerator,
pDesc: ?*const D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC,
ppVPIView: ?*?*ID3D11VideoProcessorInputView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateVideoProcessorOutputView: fn(
self: *const ID3D11VideoDevice,
pResource: ?*ID3D11Resource,
pEnum: ?*ID3D11VideoProcessorEnumerator,
pDesc: ?*const D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC,
ppVPOView: ?*?*ID3D11VideoProcessorOutputView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateVideoProcessorEnumerator: fn(
self: *const ID3D11VideoDevice,
pDesc: ?*const D3D11_VIDEO_PROCESSOR_CONTENT_DESC,
ppEnum: ?*?*ID3D11VideoProcessorEnumerator,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVideoDecoderProfileCount: fn(
self: *const ID3D11VideoDevice,
) callconv(@import("std").os.windows.WINAPI) u32,
GetVideoDecoderProfile: fn(
self: *const ID3D11VideoDevice,
Index: u32,
pDecoderProfile: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CheckVideoDecoderFormat: fn(
self: *const ID3D11VideoDevice,
pDecoderProfile: ?*const Guid,
Format: DXGI_FORMAT,
pSupported: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVideoDecoderConfigCount: fn(
self: *const ID3D11VideoDevice,
pDesc: ?*const D3D11_VIDEO_DECODER_DESC,
pCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVideoDecoderConfig: fn(
self: *const ID3D11VideoDevice,
pDesc: ?*const D3D11_VIDEO_DECODER_DESC,
Index: u32,
pConfig: ?*D3D11_VIDEO_DECODER_CONFIG,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetContentProtectionCaps: fn(
self: *const ID3D11VideoDevice,
pCryptoType: ?*const Guid,
pDecoderProfile: ?*const Guid,
pCaps: ?*D3D11_VIDEO_CONTENT_PROTECTION_CAPS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CheckCryptoKeyExchange: fn(
self: *const ID3D11VideoDevice,
pCryptoType: ?*const Guid,
pDecoderProfile: ?*const Guid,
Index: u32,
pKeyExchangeType: ?*Guid,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPrivateData: fn(
self: *const ID3D11VideoDevice,
guid: ?*const Guid,
DataSize: u32,
// TODO: what to do with BytesParamIndex 1?
pData: ?*const anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPrivateDataInterface: fn(
self: *const ID3D11VideoDevice,
guid: ?*const Guid,
pData: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_CreateVideoDecoder(self: *const T, pVideoDesc: ?*const D3D11_VIDEO_DECODER_DESC, pConfig: ?*const D3D11_VIDEO_DECODER_CONFIG, ppDecoder: ?*?*ID3D11VideoDecoder) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).CreateVideoDecoder(@ptrCast(*const ID3D11VideoDevice, self), pVideoDesc, pConfig, ppDecoder);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_CreateVideoProcessor(self: *const T, pEnum: ?*ID3D11VideoProcessorEnumerator, RateConversionIndex: u32, ppVideoProcessor: ?*?*ID3D11VideoProcessor) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).CreateVideoProcessor(@ptrCast(*const ID3D11VideoDevice, self), pEnum, RateConversionIndex, ppVideoProcessor);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_CreateAuthenticatedChannel(self: *const T, ChannelType: D3D11_AUTHENTICATED_CHANNEL_TYPE, ppAuthenticatedChannel: ?*?*ID3D11AuthenticatedChannel) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).CreateAuthenticatedChannel(@ptrCast(*const ID3D11VideoDevice, self), ChannelType, ppAuthenticatedChannel);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_CreateCryptoSession(self: *const T, pCryptoType: ?*const Guid, pDecoderProfile: ?*const Guid, pKeyExchangeType: ?*const Guid, ppCryptoSession: ?*?*ID3D11CryptoSession) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).CreateCryptoSession(@ptrCast(*const ID3D11VideoDevice, self), pCryptoType, pDecoderProfile, pKeyExchangeType, ppCryptoSession);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_CreateVideoDecoderOutputView(self: *const T, pResource: ?*ID3D11Resource, pDesc: ?*const D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC, ppVDOVView: ?*?*ID3D11VideoDecoderOutputView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).CreateVideoDecoderOutputView(@ptrCast(*const ID3D11VideoDevice, self), pResource, pDesc, ppVDOVView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_CreateVideoProcessorInputView(self: *const T, pResource: ?*ID3D11Resource, pEnum: ?*ID3D11VideoProcessorEnumerator, pDesc: ?*const D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC, ppVPIView: ?*?*ID3D11VideoProcessorInputView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).CreateVideoProcessorInputView(@ptrCast(*const ID3D11VideoDevice, self), pResource, pEnum, pDesc, ppVPIView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_CreateVideoProcessorOutputView(self: *const T, pResource: ?*ID3D11Resource, pEnum: ?*ID3D11VideoProcessorEnumerator, pDesc: ?*const D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC, ppVPOView: ?*?*ID3D11VideoProcessorOutputView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).CreateVideoProcessorOutputView(@ptrCast(*const ID3D11VideoDevice, self), pResource, pEnum, pDesc, ppVPOView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_CreateVideoProcessorEnumerator(self: *const T, pDesc: ?*const D3D11_VIDEO_PROCESSOR_CONTENT_DESC, ppEnum: ?*?*ID3D11VideoProcessorEnumerator) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).CreateVideoProcessorEnumerator(@ptrCast(*const ID3D11VideoDevice, self), pDesc, ppEnum);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_GetVideoDecoderProfileCount(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).GetVideoDecoderProfileCount(@ptrCast(*const ID3D11VideoDevice, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_GetVideoDecoderProfile(self: *const T, Index: u32, pDecoderProfile: ?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).GetVideoDecoderProfile(@ptrCast(*const ID3D11VideoDevice, self), Index, pDecoderProfile);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_CheckVideoDecoderFormat(self: *const T, pDecoderProfile: ?*const Guid, Format: DXGI_FORMAT, pSupported: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).CheckVideoDecoderFormat(@ptrCast(*const ID3D11VideoDevice, self), pDecoderProfile, Format, pSupported);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_GetVideoDecoderConfigCount(self: *const T, pDesc: ?*const D3D11_VIDEO_DECODER_DESC, pCount: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).GetVideoDecoderConfigCount(@ptrCast(*const ID3D11VideoDevice, self), pDesc, pCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_GetVideoDecoderConfig(self: *const T, pDesc: ?*const D3D11_VIDEO_DECODER_DESC, Index: u32, pConfig: ?*D3D11_VIDEO_DECODER_CONFIG) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).GetVideoDecoderConfig(@ptrCast(*const ID3D11VideoDevice, self), pDesc, Index, pConfig);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_GetContentProtectionCaps(self: *const T, pCryptoType: ?*const Guid, pDecoderProfile: ?*const Guid, pCaps: ?*D3D11_VIDEO_CONTENT_PROTECTION_CAPS) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).GetContentProtectionCaps(@ptrCast(*const ID3D11VideoDevice, self), pCryptoType, pDecoderProfile, pCaps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_CheckCryptoKeyExchange(self: *const T, pCryptoType: ?*const Guid, pDecoderProfile: ?*const Guid, Index: u32, pKeyExchangeType: ?*Guid) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).CheckCryptoKeyExchange(@ptrCast(*const ID3D11VideoDevice, self), pCryptoType, pDecoderProfile, Index, pKeyExchangeType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_SetPrivateData(self: *const T, guid: ?*const Guid, DataSize: u32, pData: ?*const anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).SetPrivateData(@ptrCast(*const ID3D11VideoDevice, self), guid, DataSize, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice_SetPrivateDataInterface(self: *const T, guid: ?*const Guid, pData: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice.VTable, self.vtable).SetPrivateDataInterface(@ptrCast(*const ID3D11VideoDevice, self), guid, pData);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11Device_Value = @import("../zig.zig").Guid.initString("db6f6ddb-ac77-4e88-8253-819df9bbf140");
pub const IID_ID3D11Device = &IID_ID3D11Device_Value;
pub const ID3D11Device = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateBuffer: fn(
self: *const ID3D11Device,
pDesc: ?*const D3D11_BUFFER_DESC,
pInitialData: ?*const D3D11_SUBRESOURCE_DATA,
ppBuffer: ?*?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTexture1D: fn(
self: *const ID3D11Device,
pDesc: ?*const D3D11_TEXTURE1D_DESC,
pInitialData: ?*const D3D11_SUBRESOURCE_DATA,
ppTexture1D: ?*?*ID3D11Texture1D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTexture2D: fn(
self: *const ID3D11Device,
pDesc: ?*const D3D11_TEXTURE2D_DESC,
pInitialData: ?*const D3D11_SUBRESOURCE_DATA,
ppTexture2D: ?*?*ID3D11Texture2D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTexture3D: fn(
self: *const ID3D11Device,
pDesc: ?*const D3D11_TEXTURE3D_DESC,
pInitialData: ?*const D3D11_SUBRESOURCE_DATA,
ppTexture3D: ?*?*ID3D11Texture3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateShaderResourceView: fn(
self: *const ID3D11Device,
pResource: ?*ID3D11Resource,
pDesc: ?*const D3D11_SHADER_RESOURCE_VIEW_DESC,
ppSRView: ?*?*ID3D11ShaderResourceView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateUnorderedAccessView: fn(
self: *const ID3D11Device,
pResource: ?*ID3D11Resource,
pDesc: ?*const D3D11_UNORDERED_ACCESS_VIEW_DESC,
ppUAView: ?*?*ID3D11UnorderedAccessView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRenderTargetView: fn(
self: *const ID3D11Device,
pResource: ?*ID3D11Resource,
pDesc: ?*const D3D11_RENDER_TARGET_VIEW_DESC,
ppRTView: ?*?*ID3D11RenderTargetView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateDepthStencilView: fn(
self: *const ID3D11Device,
pResource: ?*ID3D11Resource,
pDesc: ?*const D3D11_DEPTH_STENCIL_VIEW_DESC,
ppDepthStencilView: ?*?*ID3D11DepthStencilView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateInputLayout: fn(
self: *const ID3D11Device,
pInputElementDescs: [*]const D3D11_INPUT_ELEMENT_DESC,
NumElements: u32,
pShaderBytecodeWithInputSignature: [*]const u8,
BytecodeLength: usize,
ppInputLayout: ?*?*ID3D11InputLayout,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateVertexShader: fn(
self: *const ID3D11Device,
pShaderBytecode: [*]const u8,
BytecodeLength: usize,
pClassLinkage: ?*ID3D11ClassLinkage,
ppVertexShader: ?*?*ID3D11VertexShader,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateGeometryShader: fn(
self: *const ID3D11Device,
pShaderBytecode: [*]const u8,
BytecodeLength: usize,
pClassLinkage: ?*ID3D11ClassLinkage,
ppGeometryShader: ?*?*ID3D11GeometryShader,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateGeometryShaderWithStreamOutput: fn(
self: *const ID3D11Device,
pShaderBytecode: [*]const u8,
BytecodeLength: usize,
pSODeclaration: ?[*]const D3D11_SO_DECLARATION_ENTRY,
NumEntries: u32,
pBufferStrides: ?[*]const u32,
NumStrides: u32,
RasterizedStream: u32,
pClassLinkage: ?*ID3D11ClassLinkage,
ppGeometryShader: ?*?*ID3D11GeometryShader,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreatePixelShader: fn(
self: *const ID3D11Device,
pShaderBytecode: [*]const u8,
BytecodeLength: usize,
pClassLinkage: ?*ID3D11ClassLinkage,
ppPixelShader: ?*?*ID3D11PixelShader,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateHullShader: fn(
self: *const ID3D11Device,
pShaderBytecode: [*]const u8,
BytecodeLength: usize,
pClassLinkage: ?*ID3D11ClassLinkage,
ppHullShader: ?*?*ID3D11HullShader,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateDomainShader: fn(
self: *const ID3D11Device,
pShaderBytecode: [*]const u8,
BytecodeLength: usize,
pClassLinkage: ?*ID3D11ClassLinkage,
ppDomainShader: ?*?*ID3D11DomainShader,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateComputeShader: fn(
self: *const ID3D11Device,
pShaderBytecode: [*]const u8,
BytecodeLength: usize,
pClassLinkage: ?*ID3D11ClassLinkage,
ppComputeShader: ?*?*ID3D11ComputeShader,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateClassLinkage: fn(
self: *const ID3D11Device,
ppLinkage: ?*?*ID3D11ClassLinkage,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateBlendState: fn(
self: *const ID3D11Device,
pBlendStateDesc: ?*const D3D11_BLEND_DESC,
ppBlendState: ?*?*ID3D11BlendState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateDepthStencilState: fn(
self: *const ID3D11Device,
pDepthStencilDesc: ?*const D3D11_DEPTH_STENCIL_DESC,
ppDepthStencilState: ?*?*ID3D11DepthStencilState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRasterizerState: fn(
self: *const ID3D11Device,
pRasterizerDesc: ?*const D3D11_RASTERIZER_DESC,
ppRasterizerState: ?*?*ID3D11RasterizerState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSamplerState: fn(
self: *const ID3D11Device,
pSamplerDesc: ?*const D3D11_SAMPLER_DESC,
ppSamplerState: ?*?*ID3D11SamplerState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateQuery: fn(
self: *const ID3D11Device,
pQueryDesc: ?*const D3D11_QUERY_DESC,
ppQuery: ?*?*ID3D11Query,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreatePredicate: fn(
self: *const ID3D11Device,
pPredicateDesc: ?*const D3D11_QUERY_DESC,
ppPredicate: ?*?*ID3D11Predicate,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateCounter: fn(
self: *const ID3D11Device,
pCounterDesc: ?*const D3D11_COUNTER_DESC,
ppCounter: ?*?*ID3D11Counter,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateDeferredContext: fn(
self: *const ID3D11Device,
ContextFlags: u32,
ppDeferredContext: ?*?*ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OpenSharedResource: fn(
self: *const ID3D11Device,
hResource: ?HANDLE,
ReturnedInterface: ?*const Guid,
ppResource: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CheckFormatSupport: fn(
self: *const ID3D11Device,
Format: DXGI_FORMAT,
pFormatSupport: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CheckMultisampleQualityLevels: fn(
self: *const ID3D11Device,
Format: DXGI_FORMAT,
SampleCount: u32,
pNumQualityLevels: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CheckCounterInfo: fn(
self: *const ID3D11Device,
pCounterInfo: ?*D3D11_COUNTER_INFO,
) callconv(@import("std").os.windows.WINAPI) void,
CheckCounter: fn(
self: *const ID3D11Device,
pDesc: ?*const D3D11_COUNTER_DESC,
pType: ?*D3D11_COUNTER_TYPE,
pActiveCounters: ?*u32,
szName: ?[*:0]u8,
pNameLength: ?*u32,
szUnits: ?[*:0]u8,
pUnitsLength: ?*u32,
szDescription: ?[*:0]u8,
pDescriptionLength: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CheckFeatureSupport: fn(
self: *const ID3D11Device,
Feature: D3D11_FEATURE,
// TODO: what to do with BytesParamIndex 2?
pFeatureSupportData: ?*anyopaque,
FeatureSupportDataSize: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPrivateData: fn(
self: *const ID3D11Device,
guid: ?*const Guid,
pDataSize: ?*u32,
// TODO: what to do with BytesParamIndex 1?
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPrivateData: fn(
self: *const ID3D11Device,
guid: ?*const Guid,
DataSize: u32,
// TODO: what to do with BytesParamIndex 1?
pData: ?*const anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetPrivateDataInterface: fn(
self: *const ID3D11Device,
guid: ?*const Guid,
pData: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFeatureLevel: fn(
self: *const ID3D11Device,
) callconv(@import("std").os.windows.WINAPI) D3D_FEATURE_LEVEL,
GetCreationFlags: fn(
self: *const ID3D11Device,
) callconv(@import("std").os.windows.WINAPI) u32,
GetDeviceRemovedReason: fn(
self: *const ID3D11Device,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetImmediateContext: fn(
self: *const ID3D11Device,
ppImmediateContext: ?*?*ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) void,
SetExceptionMode: fn(
self: *const ID3D11Device,
RaiseFlags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetExceptionMode: fn(
self: *const ID3D11Device,
) callconv(@import("std").os.windows.WINAPI) u32,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateBuffer(self: *const T, pDesc: ?*const D3D11_BUFFER_DESC, pInitialData: ?*const D3D11_SUBRESOURCE_DATA, ppBuffer: ?*?*ID3D11Buffer) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateBuffer(@ptrCast(*const ID3D11Device, self), pDesc, pInitialData, ppBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateTexture1D(self: *const T, pDesc: ?*const D3D11_TEXTURE1D_DESC, pInitialData: ?*const D3D11_SUBRESOURCE_DATA, ppTexture1D: ?*?*ID3D11Texture1D) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateTexture1D(@ptrCast(*const ID3D11Device, self), pDesc, pInitialData, ppTexture1D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateTexture2D(self: *const T, pDesc: ?*const D3D11_TEXTURE2D_DESC, pInitialData: ?*const D3D11_SUBRESOURCE_DATA, ppTexture2D: ?*?*ID3D11Texture2D) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateTexture2D(@ptrCast(*const ID3D11Device, self), pDesc, pInitialData, ppTexture2D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateTexture3D(self: *const T, pDesc: ?*const D3D11_TEXTURE3D_DESC, pInitialData: ?*const D3D11_SUBRESOURCE_DATA, ppTexture3D: ?*?*ID3D11Texture3D) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateTexture3D(@ptrCast(*const ID3D11Device, self), pDesc, pInitialData, ppTexture3D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateShaderResourceView(self: *const T, pResource: ?*ID3D11Resource, pDesc: ?*const D3D11_SHADER_RESOURCE_VIEW_DESC, ppSRView: ?*?*ID3D11ShaderResourceView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateShaderResourceView(@ptrCast(*const ID3D11Device, self), pResource, pDesc, ppSRView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateUnorderedAccessView(self: *const T, pResource: ?*ID3D11Resource, pDesc: ?*const D3D11_UNORDERED_ACCESS_VIEW_DESC, ppUAView: ?*?*ID3D11UnorderedAccessView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateUnorderedAccessView(@ptrCast(*const ID3D11Device, self), pResource, pDesc, ppUAView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateRenderTargetView(self: *const T, pResource: ?*ID3D11Resource, pDesc: ?*const D3D11_RENDER_TARGET_VIEW_DESC, ppRTView: ?*?*ID3D11RenderTargetView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateRenderTargetView(@ptrCast(*const ID3D11Device, self), pResource, pDesc, ppRTView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateDepthStencilView(self: *const T, pResource: ?*ID3D11Resource, pDesc: ?*const D3D11_DEPTH_STENCIL_VIEW_DESC, ppDepthStencilView: ?*?*ID3D11DepthStencilView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateDepthStencilView(@ptrCast(*const ID3D11Device, self), pResource, pDesc, ppDepthStencilView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateInputLayout(self: *const T, pInputElementDescs: [*]const D3D11_INPUT_ELEMENT_DESC, NumElements: u32, pShaderBytecodeWithInputSignature: [*]const u8, BytecodeLength: usize, ppInputLayout: ?*?*ID3D11InputLayout) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateInputLayout(@ptrCast(*const ID3D11Device, self), pInputElementDescs, NumElements, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateVertexShader(self: *const T, pShaderBytecode: [*]const u8, BytecodeLength: usize, pClassLinkage: ?*ID3D11ClassLinkage, ppVertexShader: ?*?*ID3D11VertexShader) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateVertexShader(@ptrCast(*const ID3D11Device, self), pShaderBytecode, BytecodeLength, pClassLinkage, ppVertexShader);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateGeometryShader(self: *const T, pShaderBytecode: [*]const u8, BytecodeLength: usize, pClassLinkage: ?*ID3D11ClassLinkage, ppGeometryShader: ?*?*ID3D11GeometryShader) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateGeometryShader(@ptrCast(*const ID3D11Device, self), pShaderBytecode, BytecodeLength, pClassLinkage, ppGeometryShader);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateGeometryShaderWithStreamOutput(self: *const T, pShaderBytecode: [*]const u8, BytecodeLength: usize, pSODeclaration: ?[*]const D3D11_SO_DECLARATION_ENTRY, NumEntries: u32, pBufferStrides: ?[*]const u32, NumStrides: u32, RasterizedStream: u32, pClassLinkage: ?*ID3D11ClassLinkage, ppGeometryShader: ?*?*ID3D11GeometryShader) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateGeometryShaderWithStreamOutput(@ptrCast(*const ID3D11Device, self), pShaderBytecode, BytecodeLength, pSODeclaration, NumEntries, pBufferStrides, NumStrides, RasterizedStream, pClassLinkage, ppGeometryShader);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreatePixelShader(self: *const T, pShaderBytecode: [*]const u8, BytecodeLength: usize, pClassLinkage: ?*ID3D11ClassLinkage, ppPixelShader: ?*?*ID3D11PixelShader) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreatePixelShader(@ptrCast(*const ID3D11Device, self), pShaderBytecode, BytecodeLength, pClassLinkage, ppPixelShader);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateHullShader(self: *const T, pShaderBytecode: [*]const u8, BytecodeLength: usize, pClassLinkage: ?*ID3D11ClassLinkage, ppHullShader: ?*?*ID3D11HullShader) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateHullShader(@ptrCast(*const ID3D11Device, self), pShaderBytecode, BytecodeLength, pClassLinkage, ppHullShader);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateDomainShader(self: *const T, pShaderBytecode: [*]const u8, BytecodeLength: usize, pClassLinkage: ?*ID3D11ClassLinkage, ppDomainShader: ?*?*ID3D11DomainShader) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateDomainShader(@ptrCast(*const ID3D11Device, self), pShaderBytecode, BytecodeLength, pClassLinkage, ppDomainShader);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateComputeShader(self: *const T, pShaderBytecode: [*]const u8, BytecodeLength: usize, pClassLinkage: ?*ID3D11ClassLinkage, ppComputeShader: ?*?*ID3D11ComputeShader) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateComputeShader(@ptrCast(*const ID3D11Device, self), pShaderBytecode, BytecodeLength, pClassLinkage, ppComputeShader);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateClassLinkage(self: *const T, ppLinkage: ?*?*ID3D11ClassLinkage) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateClassLinkage(@ptrCast(*const ID3D11Device, self), ppLinkage);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateBlendState(self: *const T, pBlendStateDesc: ?*const D3D11_BLEND_DESC, ppBlendState: ?*?*ID3D11BlendState) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateBlendState(@ptrCast(*const ID3D11Device, self), pBlendStateDesc, ppBlendState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateDepthStencilState(self: *const T, pDepthStencilDesc: ?*const D3D11_DEPTH_STENCIL_DESC, ppDepthStencilState: ?*?*ID3D11DepthStencilState) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateDepthStencilState(@ptrCast(*const ID3D11Device, self), pDepthStencilDesc, ppDepthStencilState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateRasterizerState(self: *const T, pRasterizerDesc: ?*const D3D11_RASTERIZER_DESC, ppRasterizerState: ?*?*ID3D11RasterizerState) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateRasterizerState(@ptrCast(*const ID3D11Device, self), pRasterizerDesc, ppRasterizerState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateSamplerState(self: *const T, pSamplerDesc: ?*const D3D11_SAMPLER_DESC, ppSamplerState: ?*?*ID3D11SamplerState) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateSamplerState(@ptrCast(*const ID3D11Device, self), pSamplerDesc, ppSamplerState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateQuery(self: *const T, pQueryDesc: ?*const D3D11_QUERY_DESC, ppQuery: ?*?*ID3D11Query) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateQuery(@ptrCast(*const ID3D11Device, self), pQueryDesc, ppQuery);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreatePredicate(self: *const T, pPredicateDesc: ?*const D3D11_QUERY_DESC, ppPredicate: ?*?*ID3D11Predicate) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreatePredicate(@ptrCast(*const ID3D11Device, self), pPredicateDesc, ppPredicate);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateCounter(self: *const T, pCounterDesc: ?*const D3D11_COUNTER_DESC, ppCounter: ?*?*ID3D11Counter) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateCounter(@ptrCast(*const ID3D11Device, self), pCounterDesc, ppCounter);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CreateDeferredContext(self: *const T, ContextFlags: u32, ppDeferredContext: ?*?*ID3D11DeviceContext) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CreateDeferredContext(@ptrCast(*const ID3D11Device, self), ContextFlags, ppDeferredContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_OpenSharedResource(self: *const T, hResource: ?HANDLE, ReturnedInterface: ?*const Guid, ppResource: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).OpenSharedResource(@ptrCast(*const ID3D11Device, self), hResource, ReturnedInterface, ppResource);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CheckFormatSupport(self: *const T, Format: DXGI_FORMAT, pFormatSupport: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CheckFormatSupport(@ptrCast(*const ID3D11Device, self), Format, pFormatSupport);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CheckMultisampleQualityLevels(self: *const T, Format: DXGI_FORMAT, SampleCount: u32, pNumQualityLevels: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CheckMultisampleQualityLevels(@ptrCast(*const ID3D11Device, self), Format, SampleCount, pNumQualityLevels);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CheckCounterInfo(self: *const T, pCounterInfo: ?*D3D11_COUNTER_INFO) callconv(.Inline) void {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CheckCounterInfo(@ptrCast(*const ID3D11Device, self), pCounterInfo);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CheckCounter(self: *const T, pDesc: ?*const D3D11_COUNTER_DESC, pType: ?*D3D11_COUNTER_TYPE, pActiveCounters: ?*u32, szName: ?[*:0]u8, pNameLength: ?*u32, szUnits: ?[*:0]u8, pUnitsLength: ?*u32, szDescription: ?[*:0]u8, pDescriptionLength: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CheckCounter(@ptrCast(*const ID3D11Device, self), pDesc, pType, pActiveCounters, szName, pNameLength, szUnits, pUnitsLength, szDescription, pDescriptionLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_CheckFeatureSupport(self: *const T, Feature: D3D11_FEATURE, pFeatureSupportData: ?*anyopaque, FeatureSupportDataSize: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).CheckFeatureSupport(@ptrCast(*const ID3D11Device, self), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_GetPrivateData(self: *const T, guid: ?*const Guid, pDataSize: ?*u32, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).GetPrivateData(@ptrCast(*const ID3D11Device, self), guid, pDataSize, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_SetPrivateData(self: *const T, guid: ?*const Guid, DataSize: u32, pData: ?*const anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).SetPrivateData(@ptrCast(*const ID3D11Device, self), guid, DataSize, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_SetPrivateDataInterface(self: *const T, guid: ?*const Guid, pData: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).SetPrivateDataInterface(@ptrCast(*const ID3D11Device, self), guid, pData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_GetFeatureLevel(self: *const T) callconv(.Inline) D3D_FEATURE_LEVEL {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).GetFeatureLevel(@ptrCast(*const ID3D11Device, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_GetCreationFlags(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).GetCreationFlags(@ptrCast(*const ID3D11Device, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_GetDeviceRemovedReason(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).GetDeviceRemovedReason(@ptrCast(*const ID3D11Device, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_GetImmediateContext(self: *const T, ppImmediateContext: ?*?*ID3D11DeviceContext) callconv(.Inline) void {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).GetImmediateContext(@ptrCast(*const ID3D11Device, self), ppImmediateContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_SetExceptionMode(self: *const T, RaiseFlags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).SetExceptionMode(@ptrCast(*const ID3D11Device, self), RaiseFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device_GetExceptionMode(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11Device.VTable, self.vtable).GetExceptionMode(@ptrCast(*const ID3D11Device, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_CREATE_DEVICE_FLAG = enum(u32) {
SINGLETHREADED = 1,
DEBUG = 2,
SWITCH_TO_REF = 4,
PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = 8,
BGRA_SUPPORT = 32,
DEBUGGABLE = 64,
PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY = 128,
DISABLE_GPU_TIMEOUT = 256,
VIDEO_SUPPORT = 2048,
_,
pub fn initFlags(o: struct {
SINGLETHREADED: u1 = 0,
DEBUG: u1 = 0,
SWITCH_TO_REF: u1 = 0,
PREVENT_INTERNAL_THREADING_OPTIMIZATIONS: u1 = 0,
BGRA_SUPPORT: u1 = 0,
DEBUGGABLE: u1 = 0,
PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY: u1 = 0,
DISABLE_GPU_TIMEOUT: u1 = 0,
VIDEO_SUPPORT: u1 = 0,
}) D3D11_CREATE_DEVICE_FLAG {
return @intToEnum(D3D11_CREATE_DEVICE_FLAG,
(if (o.SINGLETHREADED == 1) @enumToInt(D3D11_CREATE_DEVICE_FLAG.SINGLETHREADED) else 0)
| (if (o.DEBUG == 1) @enumToInt(D3D11_CREATE_DEVICE_FLAG.DEBUG) else 0)
| (if (o.SWITCH_TO_REF == 1) @enumToInt(D3D11_CREATE_DEVICE_FLAG.SWITCH_TO_REF) else 0)
| (if (o.PREVENT_INTERNAL_THREADING_OPTIMIZATIONS == 1) @enumToInt(D3D11_CREATE_DEVICE_FLAG.PREVENT_INTERNAL_THREADING_OPTIMIZATIONS) else 0)
| (if (o.BGRA_SUPPORT == 1) @enumToInt(D3D11_CREATE_DEVICE_FLAG.BGRA_SUPPORT) else 0)
| (if (o.DEBUGGABLE == 1) @enumToInt(D3D11_CREATE_DEVICE_FLAG.DEBUGGABLE) else 0)
| (if (o.PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY == 1) @enumToInt(D3D11_CREATE_DEVICE_FLAG.PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY) else 0)
| (if (o.DISABLE_GPU_TIMEOUT == 1) @enumToInt(D3D11_CREATE_DEVICE_FLAG.DISABLE_GPU_TIMEOUT) else 0)
| (if (o.VIDEO_SUPPORT == 1) @enumToInt(D3D11_CREATE_DEVICE_FLAG.VIDEO_SUPPORT) else 0)
);
}
};
pub const D3D11_CREATE_DEVICE_SINGLETHREADED = D3D11_CREATE_DEVICE_FLAG.SINGLETHREADED;
pub const D3D11_CREATE_DEVICE_DEBUG = D3D11_CREATE_DEVICE_FLAG.DEBUG;
pub const D3D11_CREATE_DEVICE_SWITCH_TO_REF = D3D11_CREATE_DEVICE_FLAG.SWITCH_TO_REF;
pub const D3D11_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS = D3D11_CREATE_DEVICE_FLAG.PREVENT_INTERNAL_THREADING_OPTIMIZATIONS;
pub const D3D11_CREATE_DEVICE_BGRA_SUPPORT = D3D11_CREATE_DEVICE_FLAG.BGRA_SUPPORT;
pub const D3D11_CREATE_DEVICE_DEBUGGABLE = D3D11_CREATE_DEVICE_FLAG.DEBUGGABLE;
pub const D3D11_CREATE_DEVICE_PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY = D3D11_CREATE_DEVICE_FLAG.PREVENT_ALTERING_LAYER_SETTINGS_FROM_REGISTRY;
pub const D3D11_CREATE_DEVICE_DISABLE_GPU_TIMEOUT = D3D11_CREATE_DEVICE_FLAG.DISABLE_GPU_TIMEOUT;
pub const D3D11_CREATE_DEVICE_VIDEO_SUPPORT = D3D11_CREATE_DEVICE_FLAG.VIDEO_SUPPORT;
pub const D3D11_RLDO_FLAGS = enum(i32) {
SUMMARY = 1,
DETAIL = 2,
IGNORE_INTERNAL = 4,
};
pub const D3D11_RLDO_SUMMARY = D3D11_RLDO_FLAGS.SUMMARY;
pub const D3D11_RLDO_DETAIL = D3D11_RLDO_FLAGS.DETAIL;
pub const D3D11_RLDO_IGNORE_INTERNAL = D3D11_RLDO_FLAGS.IGNORE_INTERNAL;
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11Debug_Value = @import("../zig.zig").Guid.initString("79cf2233-7536-4948-9d36-1e4692dc5760");
pub const IID_ID3D11Debug = &IID_ID3D11Debug_Value;
pub const ID3D11Debug = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetFeatureMask: fn(
self: *const ID3D11Debug,
Mask: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFeatureMask: fn(
self: *const ID3D11Debug,
) callconv(@import("std").os.windows.WINAPI) u32,
SetPresentPerRenderOpDelay: fn(
self: *const ID3D11Debug,
Milliseconds: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPresentPerRenderOpDelay: fn(
self: *const ID3D11Debug,
) callconv(@import("std").os.windows.WINAPI) u32,
SetSwapChain: fn(
self: *const ID3D11Debug,
pSwapChain: ?*IDXGISwapChain,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSwapChain: fn(
self: *const ID3D11Debug,
ppSwapChain: ?*?*IDXGISwapChain,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ValidateContext: fn(
self: *const ID3D11Debug,
pContext: ?*ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ReportLiveDeviceObjects: fn(
self: *const ID3D11Debug,
Flags: D3D11_RLDO_FLAGS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ValidateContextForDispatch: fn(
self: *const ID3D11Debug,
pContext: ?*ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Debug_SetFeatureMask(self: *const T, Mask: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Debug.VTable, self.vtable).SetFeatureMask(@ptrCast(*const ID3D11Debug, self), Mask);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Debug_GetFeatureMask(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11Debug.VTable, self.vtable).GetFeatureMask(@ptrCast(*const ID3D11Debug, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Debug_SetPresentPerRenderOpDelay(self: *const T, Milliseconds: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Debug.VTable, self.vtable).SetPresentPerRenderOpDelay(@ptrCast(*const ID3D11Debug, self), Milliseconds);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Debug_GetPresentPerRenderOpDelay(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11Debug.VTable, self.vtable).GetPresentPerRenderOpDelay(@ptrCast(*const ID3D11Debug, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Debug_SetSwapChain(self: *const T, pSwapChain: ?*IDXGISwapChain) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Debug.VTable, self.vtable).SetSwapChain(@ptrCast(*const ID3D11Debug, self), pSwapChain);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Debug_GetSwapChain(self: *const T, ppSwapChain: ?*?*IDXGISwapChain) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Debug.VTable, self.vtable).GetSwapChain(@ptrCast(*const ID3D11Debug, self), ppSwapChain);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Debug_ValidateContext(self: *const T, pContext: ?*ID3D11DeviceContext) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Debug.VTable, self.vtable).ValidateContext(@ptrCast(*const ID3D11Debug, self), pContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Debug_ReportLiveDeviceObjects(self: *const T, Flags: D3D11_RLDO_FLAGS) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Debug.VTable, self.vtable).ReportLiveDeviceObjects(@ptrCast(*const ID3D11Debug, self), Flags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Debug_ValidateContextForDispatch(self: *const T, pContext: ?*ID3D11DeviceContext) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Debug.VTable, self.vtable).ValidateContextForDispatch(@ptrCast(*const ID3D11Debug, self), pContext);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11SwitchToRef_Value = @import("../zig.zig").Guid.initString("1ef337e3-58e7-4f83-a692-db221f5ed47e");
pub const IID_ID3D11SwitchToRef = &IID_ID3D11SwitchToRef_Value;
pub const ID3D11SwitchToRef = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetUseRef: fn(
self: *const ID3D11SwitchToRef,
UseRef: BOOL,
) callconv(@import("std").os.windows.WINAPI) BOOL,
GetUseRef: fn(
self: *const ID3D11SwitchToRef,
) callconv(@import("std").os.windows.WINAPI) BOOL,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11SwitchToRef_SetUseRef(self: *const T, UseRef: BOOL) callconv(.Inline) BOOL {
return @ptrCast(*const ID3D11SwitchToRef.VTable, self.vtable).SetUseRef(@ptrCast(*const ID3D11SwitchToRef, self), UseRef);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11SwitchToRef_GetUseRef(self: *const T) callconv(.Inline) BOOL {
return @ptrCast(*const ID3D11SwitchToRef.VTable, self.vtable).GetUseRef(@ptrCast(*const ID3D11SwitchToRef, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_SHADER_TRACKING_RESOURCE_TYPE = enum(i32) {
NONE = 0,
UAV_DEVICEMEMORY = 1,
NON_UAV_DEVICEMEMORY = 2,
ALL_DEVICEMEMORY = 3,
GROUPSHARED_MEMORY = 4,
ALL_SHARED_MEMORY = 5,
GROUPSHARED_NON_UAV = 6,
ALL = 7,
};
pub const D3D11_SHADER_TRACKING_RESOURCE_TYPE_NONE = D3D11_SHADER_TRACKING_RESOURCE_TYPE.NONE;
pub const D3D11_SHADER_TRACKING_RESOURCE_TYPE_UAV_DEVICEMEMORY = D3D11_SHADER_TRACKING_RESOURCE_TYPE.UAV_DEVICEMEMORY;
pub const D3D11_SHADER_TRACKING_RESOURCE_TYPE_NON_UAV_DEVICEMEMORY = D3D11_SHADER_TRACKING_RESOURCE_TYPE.NON_UAV_DEVICEMEMORY;
pub const D3D11_SHADER_TRACKING_RESOURCE_TYPE_ALL_DEVICEMEMORY = D3D11_SHADER_TRACKING_RESOURCE_TYPE.ALL_DEVICEMEMORY;
pub const D3D11_SHADER_TRACKING_RESOURCE_TYPE_GROUPSHARED_MEMORY = D3D11_SHADER_TRACKING_RESOURCE_TYPE.GROUPSHARED_MEMORY;
pub const D3D11_SHADER_TRACKING_RESOURCE_TYPE_ALL_SHARED_MEMORY = D3D11_SHADER_TRACKING_RESOURCE_TYPE.ALL_SHARED_MEMORY;
pub const D3D11_SHADER_TRACKING_RESOURCE_TYPE_GROUPSHARED_NON_UAV = D3D11_SHADER_TRACKING_RESOURCE_TYPE.GROUPSHARED_NON_UAV;
pub const D3D11_SHADER_TRACKING_RESOURCE_TYPE_ALL = D3D11_SHADER_TRACKING_RESOURCE_TYPE.ALL;
pub const D3D11_SHADER_TRACKING_OPTIONS = enum(i32) {
IGNORE = 0,
TRACK_UNINITIALIZED = 1,
TRACK_RAW = 2,
TRACK_WAR = 4,
TRACK_WAW = 8,
ALLOW_SAME = 16,
TRACK_ATOMIC_CONSISTENCY = 32,
TRACK_RAW_ACROSS_THREADGROUPS = 64,
TRACK_WAR_ACROSS_THREADGROUPS = 128,
TRACK_WAW_ACROSS_THREADGROUPS = 256,
TRACK_ATOMIC_CONSISTENCY_ACROSS_THREADGROUPS = 512,
UAV_SPECIFIC_FLAGS = 960,
ALL_HAZARDS = 1006,
ALL_HAZARDS_ALLOWING_SAME = 1022,
ALL_OPTIONS = 1023,
};
pub const D3D11_SHADER_TRACKING_OPTION_IGNORE = D3D11_SHADER_TRACKING_OPTIONS.IGNORE;
pub const D3D11_SHADER_TRACKING_OPTION_TRACK_UNINITIALIZED = D3D11_SHADER_TRACKING_OPTIONS.TRACK_UNINITIALIZED;
pub const D3D11_SHADER_TRACKING_OPTION_TRACK_RAW = D3D11_SHADER_TRACKING_OPTIONS.TRACK_RAW;
pub const D3D11_SHADER_TRACKING_OPTION_TRACK_WAR = D3D11_SHADER_TRACKING_OPTIONS.TRACK_WAR;
pub const D3D11_SHADER_TRACKING_OPTION_TRACK_WAW = D3D11_SHADER_TRACKING_OPTIONS.TRACK_WAW;
pub const D3D11_SHADER_TRACKING_OPTION_ALLOW_SAME = D3D11_SHADER_TRACKING_OPTIONS.ALLOW_SAME;
pub const D3D11_SHADER_TRACKING_OPTION_TRACK_ATOMIC_CONSISTENCY = D3D11_SHADER_TRACKING_OPTIONS.TRACK_ATOMIC_CONSISTENCY;
pub const D3D11_SHADER_TRACKING_OPTION_TRACK_RAW_ACROSS_THREADGROUPS = D3D11_SHADER_TRACKING_OPTIONS.TRACK_RAW_ACROSS_THREADGROUPS;
pub const D3D11_SHADER_TRACKING_OPTION_TRACK_WAR_ACROSS_THREADGROUPS = D3D11_SHADER_TRACKING_OPTIONS.TRACK_WAR_ACROSS_THREADGROUPS;
pub const D3D11_SHADER_TRACKING_OPTION_TRACK_WAW_ACROSS_THREADGROUPS = D3D11_SHADER_TRACKING_OPTIONS.TRACK_WAW_ACROSS_THREADGROUPS;
pub const D3D11_SHADER_TRACKING_OPTION_TRACK_ATOMIC_CONSISTENCY_ACROSS_THREADGROUPS = D3D11_SHADER_TRACKING_OPTIONS.TRACK_ATOMIC_CONSISTENCY_ACROSS_THREADGROUPS;
pub const D3D11_SHADER_TRACKING_OPTION_UAV_SPECIFIC_FLAGS = D3D11_SHADER_TRACKING_OPTIONS.UAV_SPECIFIC_FLAGS;
pub const D3D11_SHADER_TRACKING_OPTION_ALL_HAZARDS = D3D11_SHADER_TRACKING_OPTIONS.ALL_HAZARDS;
pub const D3D11_SHADER_TRACKING_OPTION_ALL_HAZARDS_ALLOWING_SAME = D3D11_SHADER_TRACKING_OPTIONS.ALL_HAZARDS_ALLOWING_SAME;
pub const D3D11_SHADER_TRACKING_OPTION_ALL_OPTIONS = D3D11_SHADER_TRACKING_OPTIONS.ALL_OPTIONS;
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11TracingDevice_Value = @import("../zig.zig").Guid.initString("1911c771-1587-413e-a7e0-fb26c3de0268");
pub const IID_ID3D11TracingDevice = &IID_ID3D11TracingDevice_Value;
pub const ID3D11TracingDevice = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetShaderTrackingOptionsByType: fn(
self: *const ID3D11TracingDevice,
ResourceTypeFlags: u32,
Options: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetShaderTrackingOptions: fn(
self: *const ID3D11TracingDevice,
pShader: ?*IUnknown,
Options: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11TracingDevice_SetShaderTrackingOptionsByType(self: *const T, ResourceTypeFlags: u32, Options: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11TracingDevice.VTable, self.vtable).SetShaderTrackingOptionsByType(@ptrCast(*const ID3D11TracingDevice, self), ResourceTypeFlags, Options);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11TracingDevice_SetShaderTrackingOptions(self: *const T, pShader: ?*IUnknown, Options: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11TracingDevice.VTable, self.vtable).SetShaderTrackingOptions(@ptrCast(*const ID3D11TracingDevice, self), pShader, Options);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11RefTrackingOptions_Value = @import("../zig.zig").Guid.initString("193dacdf-0db2-4c05-a55c-ef06cac56fd9");
pub const IID_ID3D11RefTrackingOptions = &IID_ID3D11RefTrackingOptions_Value;
pub const ID3D11RefTrackingOptions = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetTrackingOptions: fn(
self: *const ID3D11RefTrackingOptions,
uOptions: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11RefTrackingOptions_SetTrackingOptions(self: *const T, uOptions: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11RefTrackingOptions.VTable, self.vtable).SetTrackingOptions(@ptrCast(*const ID3D11RefTrackingOptions, self), uOptions);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11RefDefaultTrackingOptions_Value = @import("../zig.zig").Guid.initString("03916615-c644-418c-9bf4-75db5be63ca0");
pub const IID_ID3D11RefDefaultTrackingOptions = &IID_ID3D11RefDefaultTrackingOptions_Value;
pub const ID3D11RefDefaultTrackingOptions = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetTrackingOptions: fn(
self: *const ID3D11RefDefaultTrackingOptions,
ResourceTypeFlags: u32,
Options: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11RefDefaultTrackingOptions_SetTrackingOptions(self: *const T, ResourceTypeFlags: u32, Options: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11RefDefaultTrackingOptions.VTable, self.vtable).SetTrackingOptions(@ptrCast(*const ID3D11RefDefaultTrackingOptions, self), ResourceTypeFlags, Options);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_MESSAGE_CATEGORY = enum(i32) {
APPLICATION_DEFINED = 0,
MISCELLANEOUS = 1,
INITIALIZATION = 2,
CLEANUP = 3,
COMPILATION = 4,
STATE_CREATION = 5,
STATE_SETTING = 6,
STATE_GETTING = 7,
RESOURCE_MANIPULATION = 8,
EXECUTION = 9,
SHADER = 10,
};
pub const D3D11_MESSAGE_CATEGORY_APPLICATION_DEFINED = D3D11_MESSAGE_CATEGORY.APPLICATION_DEFINED;
pub const D3D11_MESSAGE_CATEGORY_MISCELLANEOUS = D3D11_MESSAGE_CATEGORY.MISCELLANEOUS;
pub const D3D11_MESSAGE_CATEGORY_INITIALIZATION = D3D11_MESSAGE_CATEGORY.INITIALIZATION;
pub const D3D11_MESSAGE_CATEGORY_CLEANUP = D3D11_MESSAGE_CATEGORY.CLEANUP;
pub const D3D11_MESSAGE_CATEGORY_COMPILATION = D3D11_MESSAGE_CATEGORY.COMPILATION;
pub const D3D11_MESSAGE_CATEGORY_STATE_CREATION = D3D11_MESSAGE_CATEGORY.STATE_CREATION;
pub const D3D11_MESSAGE_CATEGORY_STATE_SETTING = D3D11_MESSAGE_CATEGORY.STATE_SETTING;
pub const D3D11_MESSAGE_CATEGORY_STATE_GETTING = D3D11_MESSAGE_CATEGORY.STATE_GETTING;
pub const D3D11_MESSAGE_CATEGORY_RESOURCE_MANIPULATION = D3D11_MESSAGE_CATEGORY.RESOURCE_MANIPULATION;
pub const D3D11_MESSAGE_CATEGORY_EXECUTION = D3D11_MESSAGE_CATEGORY.EXECUTION;
pub const D3D11_MESSAGE_CATEGORY_SHADER = D3D11_MESSAGE_CATEGORY.SHADER;
pub const D3D11_MESSAGE_SEVERITY = enum(i32) {
CORRUPTION = 0,
ERROR = 1,
WARNING = 2,
INFO = 3,
MESSAGE = 4,
};
pub const D3D11_MESSAGE_SEVERITY_CORRUPTION = D3D11_MESSAGE_SEVERITY.CORRUPTION;
pub const D3D11_MESSAGE_SEVERITY_ERROR = D3D11_MESSAGE_SEVERITY.ERROR;
pub const D3D11_MESSAGE_SEVERITY_WARNING = D3D11_MESSAGE_SEVERITY.WARNING;
pub const D3D11_MESSAGE_SEVERITY_INFO = D3D11_MESSAGE_SEVERITY.INFO;
pub const D3D11_MESSAGE_SEVERITY_MESSAGE = D3D11_MESSAGE_SEVERITY.MESSAGE;
pub const D3D11_MESSAGE_ID = enum(i32) {
UNKNOWN = 0,
DEVICE_IASETVERTEXBUFFERS_HAZARD = 1,
DEVICE_IASETINDEXBUFFER_HAZARD = 2,
DEVICE_VSSETSHADERRESOURCES_HAZARD = 3,
DEVICE_VSSETCONSTANTBUFFERS_HAZARD = 4,
DEVICE_GSSETSHADERRESOURCES_HAZARD = 5,
DEVICE_GSSETCONSTANTBUFFERS_HAZARD = 6,
DEVICE_PSSETSHADERRESOURCES_HAZARD = 7,
DEVICE_PSSETCONSTANTBUFFERS_HAZARD = 8,
DEVICE_OMSETRENDERTARGETS_HAZARD = 9,
DEVICE_SOSETTARGETS_HAZARD = 10,
STRING_FROM_APPLICATION = 11,
CORRUPTED_THIS = 12,
CORRUPTED_PARAMETER1 = 13,
CORRUPTED_PARAMETER2 = 14,
CORRUPTED_PARAMETER3 = 15,
CORRUPTED_PARAMETER4 = 16,
CORRUPTED_PARAMETER5 = 17,
CORRUPTED_PARAMETER6 = 18,
CORRUPTED_PARAMETER7 = 19,
CORRUPTED_PARAMETER8 = 20,
CORRUPTED_PARAMETER9 = 21,
CORRUPTED_PARAMETER10 = 22,
CORRUPTED_PARAMETER11 = 23,
CORRUPTED_PARAMETER12 = 24,
CORRUPTED_PARAMETER13 = 25,
CORRUPTED_PARAMETER14 = 26,
CORRUPTED_PARAMETER15 = 27,
CORRUPTED_MULTITHREADING = 28,
MESSAGE_REPORTING_OUTOFMEMORY = 29,
IASETINPUTLAYOUT_UNBINDDELETINGOBJECT = 30,
IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT = 31,
IASETINDEXBUFFER_UNBINDDELETINGOBJECT = 32,
VSSETSHADER_UNBINDDELETINGOBJECT = 33,
VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 34,
VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 35,
VSSETSAMPLERS_UNBINDDELETINGOBJECT = 36,
GSSETSHADER_UNBINDDELETINGOBJECT = 37,
GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 38,
GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 39,
GSSETSAMPLERS_UNBINDDELETINGOBJECT = 40,
SOSETTARGETS_UNBINDDELETINGOBJECT = 41,
PSSETSHADER_UNBINDDELETINGOBJECT = 42,
PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 43,
PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 44,
PSSETSAMPLERS_UNBINDDELETINGOBJECT = 45,
RSSETSTATE_UNBINDDELETINGOBJECT = 46,
OMSETBLENDSTATE_UNBINDDELETINGOBJECT = 47,
OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT = 48,
OMSETRENDERTARGETS_UNBINDDELETINGOBJECT = 49,
SETPREDICATION_UNBINDDELETINGOBJECT = 50,
GETPRIVATEDATA_MOREDATA = 51,
SETPRIVATEDATA_INVALIDFREEDATA = 52,
SETPRIVATEDATA_INVALIDIUNKNOWN = 53,
SETPRIVATEDATA_INVALIDFLAGS = 54,
SETPRIVATEDATA_CHANGINGPARAMS = 55,
SETPRIVATEDATA_OUTOFMEMORY = 56,
CREATEBUFFER_UNRECOGNIZEDFORMAT = 57,
CREATEBUFFER_INVALIDSAMPLES = 58,
CREATEBUFFER_UNRECOGNIZEDUSAGE = 59,
CREATEBUFFER_UNRECOGNIZEDBINDFLAGS = 60,
CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS = 61,
CREATEBUFFER_UNRECOGNIZEDMISCFLAGS = 62,
CREATEBUFFER_INVALIDCPUACCESSFLAGS = 63,
CREATEBUFFER_INVALIDBINDFLAGS = 64,
CREATEBUFFER_INVALIDINITIALDATA = 65,
CREATEBUFFER_INVALIDDIMENSIONS = 66,
CREATEBUFFER_INVALIDMIPLEVELS = 67,
CREATEBUFFER_INVALIDMISCFLAGS = 68,
CREATEBUFFER_INVALIDARG_RETURN = 69,
CREATEBUFFER_OUTOFMEMORY_RETURN = 70,
CREATEBUFFER_NULLDESC = 71,
CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS = 72,
CREATEBUFFER_LARGEALLOCATION = 73,
CREATETEXTURE1D_UNRECOGNIZEDFORMAT = 74,
CREATETEXTURE1D_UNSUPPORTEDFORMAT = 75,
CREATETEXTURE1D_INVALIDSAMPLES = 76,
CREATETEXTURE1D_UNRECOGNIZEDUSAGE = 77,
CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS = 78,
CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS = 79,
CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS = 80,
CREATETEXTURE1D_INVALIDCPUACCESSFLAGS = 81,
CREATETEXTURE1D_INVALIDBINDFLAGS = 82,
CREATETEXTURE1D_INVALIDINITIALDATA = 83,
CREATETEXTURE1D_INVALIDDIMENSIONS = 84,
CREATETEXTURE1D_INVALIDMIPLEVELS = 85,
CREATETEXTURE1D_INVALIDMISCFLAGS = 86,
CREATETEXTURE1D_INVALIDARG_RETURN = 87,
CREATETEXTURE1D_OUTOFMEMORY_RETURN = 88,
CREATETEXTURE1D_NULLDESC = 89,
CREATETEXTURE1D_LARGEALLOCATION = 90,
CREATETEXTURE2D_UNRECOGNIZEDFORMAT = 91,
CREATETEXTURE2D_UNSUPPORTEDFORMAT = 92,
CREATETEXTURE2D_INVALIDSAMPLES = 93,
CREATETEXTURE2D_UNRECOGNIZEDUSAGE = 94,
CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS = 95,
CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS = 96,
CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS = 97,
CREATETEXTURE2D_INVALIDCPUACCESSFLAGS = 98,
CREATETEXTURE2D_INVALIDBINDFLAGS = 99,
CREATETEXTURE2D_INVALIDINITIALDATA = 100,
CREATETEXTURE2D_INVALIDDIMENSIONS = 101,
CREATETEXTURE2D_INVALIDMIPLEVELS = 102,
CREATETEXTURE2D_INVALIDMISCFLAGS = 103,
CREATETEXTURE2D_INVALIDARG_RETURN = 104,
CREATETEXTURE2D_OUTOFMEMORY_RETURN = 105,
CREATETEXTURE2D_NULLDESC = 106,
CREATETEXTURE2D_LARGEALLOCATION = 107,
CREATETEXTURE3D_UNRECOGNIZEDFORMAT = 108,
CREATETEXTURE3D_UNSUPPORTEDFORMAT = 109,
CREATETEXTURE3D_INVALIDSAMPLES = 110,
CREATETEXTURE3D_UNRECOGNIZEDUSAGE = 111,
CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS = 112,
CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS = 113,
CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS = 114,
CREATETEXTURE3D_INVALIDCPUACCESSFLAGS = 115,
CREATETEXTURE3D_INVALIDBINDFLAGS = 116,
CREATETEXTURE3D_INVALIDINITIALDATA = 117,
CREATETEXTURE3D_INVALIDDIMENSIONS = 118,
CREATETEXTURE3D_INVALIDMIPLEVELS = 119,
CREATETEXTURE3D_INVALIDMISCFLAGS = 120,
CREATETEXTURE3D_INVALIDARG_RETURN = 121,
CREATETEXTURE3D_OUTOFMEMORY_RETURN = 122,
CREATETEXTURE3D_NULLDESC = 123,
CREATETEXTURE3D_LARGEALLOCATION = 124,
CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = 125,
CREATESHADERRESOURCEVIEW_INVALIDDESC = 126,
CREATESHADERRESOURCEVIEW_INVALIDFORMAT = 127,
CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = 128,
CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = 129,
CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS = 130,
CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = 131,
CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = 132,
CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = 133,
CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = 134,
CREATERENDERTARGETVIEW_INVALIDDESC = 135,
CREATERENDERTARGETVIEW_INVALIDFORMAT = 136,
CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = 137,
CREATERENDERTARGETVIEW_INVALIDRESOURCE = 138,
CREATERENDERTARGETVIEW_TOOMANYOBJECTS = 139,
CREATERENDERTARGETVIEW_INVALIDARG_RETURN = 140,
CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = 141,
CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = 142,
CREATEDEPTHSTENCILVIEW_INVALIDDESC = 143,
CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = 144,
CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = 145,
CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = 146,
CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS = 147,
CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = 148,
CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = 149,
CREATEINPUTLAYOUT_OUTOFMEMORY = 150,
CREATEINPUTLAYOUT_TOOMANYELEMENTS = 151,
CREATEINPUTLAYOUT_INVALIDFORMAT = 152,
CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = 153,
CREATEINPUTLAYOUT_INVALIDSLOT = 154,
CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = 155,
CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = 156,
CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = 157,
CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = 158,
CREATEINPUTLAYOUT_INVALIDALIGNMENT = 159,
CREATEINPUTLAYOUT_DUPLICATESEMANTIC = 160,
CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = 161,
CREATEINPUTLAYOUT_NULLSEMANTIC = 162,
CREATEINPUTLAYOUT_MISSINGELEMENT = 163,
CREATEINPUTLAYOUT_NULLDESC = 164,
CREATEVERTEXSHADER_OUTOFMEMORY = 165,
CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = 166,
CREATEVERTEXSHADER_INVALIDSHADERTYPE = 167,
CREATEGEOMETRYSHADER_OUTOFMEMORY = 168,
CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = 169,
CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = 170,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = 171,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = 172,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = 173,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = 174,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = 175,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = 176,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = 177,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = 178,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = 179,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = 180,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = 181,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = 182,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = 183,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = 184,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = 185,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = 186,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = 187,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = 188,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = 189,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = 190,
CREATEPIXELSHADER_OUTOFMEMORY = 191,
CREATEPIXELSHADER_INVALIDSHADERBYTECODE = 192,
CREATEPIXELSHADER_INVALIDSHADERTYPE = 193,
CREATERASTERIZERSTATE_INVALIDFILLMODE = 194,
CREATERASTERIZERSTATE_INVALIDCULLMODE = 195,
CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = 196,
CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = 197,
CREATERASTERIZERSTATE_TOOMANYOBJECTS = 198,
CREATERASTERIZERSTATE_NULLDESC = 199,
CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = 200,
CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = 201,
CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = 202,
CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = 203,
CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = 204,
CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = 205,
CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = 206,
CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = 207,
CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = 208,
CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = 209,
CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS = 210,
CREATEDEPTHSTENCILSTATE_NULLDESC = 211,
CREATEBLENDSTATE_INVALIDSRCBLEND = 212,
CREATEBLENDSTATE_INVALIDDESTBLEND = 213,
CREATEBLENDSTATE_INVALIDBLENDOP = 214,
CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = 215,
CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = 216,
CREATEBLENDSTATE_INVALIDBLENDOPALPHA = 217,
CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = 218,
CREATEBLENDSTATE_TOOMANYOBJECTS = 219,
CREATEBLENDSTATE_NULLDESC = 220,
CREATESAMPLERSTATE_INVALIDFILTER = 221,
CREATESAMPLERSTATE_INVALIDADDRESSU = 222,
CREATESAMPLERSTATE_INVALIDADDRESSV = 223,
CREATESAMPLERSTATE_INVALIDADDRESSW = 224,
CREATESAMPLERSTATE_INVALIDMIPLODBIAS = 225,
CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = 226,
CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = 227,
CREATESAMPLERSTATE_INVALIDMINLOD = 228,
CREATESAMPLERSTATE_INVALIDMAXLOD = 229,
CREATESAMPLERSTATE_TOOMANYOBJECTS = 230,
CREATESAMPLERSTATE_NULLDESC = 231,
CREATEQUERYORPREDICATE_INVALIDQUERY = 232,
CREATEQUERYORPREDICATE_INVALIDMISCFLAGS = 233,
CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG = 234,
CREATEQUERYORPREDICATE_NULLDESC = 235,
DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = 236,
DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = 237,
IASETVERTEXBUFFERS_INVALIDBUFFER = 238,
DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE = 239,
DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY = 240,
IASETINDEXBUFFER_INVALIDBUFFER = 241,
DEVICE_IASETINDEXBUFFER_FORMAT_INVALID = 242,
DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE = 243,
DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED = 244,
DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY = 245,
VSSETCONSTANTBUFFERS_INVALIDBUFFER = 246,
DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 247,
DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY = 248,
DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY = 249,
GSSETCONSTANTBUFFERS_INVALIDBUFFER = 250,
DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 251,
DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY = 252,
SOSETTARGETS_INVALIDBUFFER = 253,
DEVICE_SOSETTARGETS_OFFSET_UNALIGNED = 254,
DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY = 255,
PSSETCONSTANTBUFFERS_INVALIDBUFFER = 256,
DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 257,
DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY = 258,
DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = 259,
DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = 260,
CLEARRENDERTARGETVIEW_DENORMFLUSH = 261,
CLEARDEPTHSTENCILVIEW_DENORMFLUSH = 262,
CLEARDEPTHSTENCILVIEW_INVALID = 263,
DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY = 264,
DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY = 265,
DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 266,
DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY = 267,
DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY = 268,
DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 269,
DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY = 270,
DEVICE_SOGETTARGETS_BUFFERS_EMPTY = 271,
DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY = 272,
DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 273,
DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY = 274,
DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY = 275,
DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY = 276,
DEVICE_GENERATEMIPS_RESOURCE_INVALID = 277,
COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE = 278,
COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE = 279,
COPYSUBRESOURCEREGION_INVALIDSOURCEBOX = 280,
COPYSUBRESOURCEREGION_INVALIDSOURCE = 281,
COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE = 282,
COPYSUBRESOURCEREGION_INVALIDSOURCESTATE = 283,
COPYRESOURCE_INVALIDSOURCE = 284,
COPYRESOURCE_INVALIDDESTINATIONSTATE = 285,
COPYRESOURCE_INVALIDSOURCESTATE = 286,
UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = 287,
UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = 288,
UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = 289,
DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = 290,
DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = 291,
DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = 292,
DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = 293,
DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = 294,
BUFFER_MAP_INVALIDMAPTYPE = 295,
BUFFER_MAP_INVALIDFLAGS = 296,
BUFFER_MAP_ALREADYMAPPED = 297,
BUFFER_MAP_DEVICEREMOVED_RETURN = 298,
BUFFER_UNMAP_NOTMAPPED = 299,
TEXTURE1D_MAP_INVALIDMAPTYPE = 300,
TEXTURE1D_MAP_INVALIDSUBRESOURCE = 301,
TEXTURE1D_MAP_INVALIDFLAGS = 302,
TEXTURE1D_MAP_ALREADYMAPPED = 303,
TEXTURE1D_MAP_DEVICEREMOVED_RETURN = 304,
TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = 305,
TEXTURE1D_UNMAP_NOTMAPPED = 306,
TEXTURE2D_MAP_INVALIDMAPTYPE = 307,
TEXTURE2D_MAP_INVALIDSUBRESOURCE = 308,
TEXTURE2D_MAP_INVALIDFLAGS = 309,
TEXTURE2D_MAP_ALREADYMAPPED = 310,
TEXTURE2D_MAP_DEVICEREMOVED_RETURN = 311,
TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = 312,
TEXTURE2D_UNMAP_NOTMAPPED = 313,
TEXTURE3D_MAP_INVALIDMAPTYPE = 314,
TEXTURE3D_MAP_INVALIDSUBRESOURCE = 315,
TEXTURE3D_MAP_INVALIDFLAGS = 316,
TEXTURE3D_MAP_ALREADYMAPPED = 317,
TEXTURE3D_MAP_DEVICEREMOVED_RETURN = 318,
TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = 319,
TEXTURE3D_UNMAP_NOTMAPPED = 320,
CHECKFORMATSUPPORT_FORMAT_DEPRECATED = 321,
CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = 322,
SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = 323,
SETEXCEPTIONMODE_INVALIDARG_RETURN = 324,
SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = 325,
REF_SIMULATING_INFINITELY_FAST_HARDWARE = 326,
REF_THREADING_MODE = 327,
REF_UMDRIVER_EXCEPTION = 328,
REF_KMDRIVER_EXCEPTION = 329,
REF_HARDWARE_EXCEPTION = 330,
REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = 331,
REF_PROBLEM_PARSING_SHADER = 332,
REF_OUT_OF_MEMORY = 333,
REF_INFO = 334,
DEVICE_DRAW_VERTEXPOS_OVERFLOW = 335,
DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = 336,
DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = 337,
DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = 338,
DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = 339,
DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = 340,
DEVICE_DRAW_VERTEX_SHADER_NOT_SET = 341,
DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = 342,
DEVICE_SHADER_LINKAGE_REGISTERINDEX = 343,
DEVICE_SHADER_LINKAGE_COMPONENTTYPE = 344,
DEVICE_SHADER_LINKAGE_REGISTERMASK = 345,
DEVICE_SHADER_LINKAGE_SYSTEMVALUE = 346,
DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = 347,
DEVICE_DRAW_VERTEX_BUFFER_NOT_SET = 348,
DEVICE_DRAW_INPUTLAYOUT_NOT_SET = 349,
DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET = 350,
DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL = 351,
DEVICE_DRAW_SAMPLER_NOT_SET = 352,
DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET = 353,
DEVICE_DRAW_VIEW_DIMENSION_MISMATCH = 354,
DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = 355,
DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL = 356,
DEVICE_DRAW_INDEX_BUFFER_NOT_SET = 357,
DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID = 358,
DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL = 359,
DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = 360,
DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = 361,
DEVICE_DRAW_POSITION_NOT_PRESENT = 362,
DEVICE_DRAW_OUTPUT_STREAM_NOT_SET = 363,
DEVICE_DRAW_BOUND_RESOURCE_MAPPED = 364,
DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY = 365,
DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED = 366,
DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED = 367,
DEVICE_DRAW_INDEX_OFFSET_UNALIGNED = 368,
DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = 369,
DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = 370,
DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = 371,
DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = 372,
DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = 373,
DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = 374,
DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = 375,
DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = 376,
DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = 377,
DEVICE_REMOVAL_PROCESS_AT_FAULT = 378,
DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = 379,
DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = 380,
DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = 381,
DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = 382,
DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = 383,
DEVICE_DRAW_VIEWPORT_NOT_SET = 384,
CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = 385,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = 386,
DEVICE_RSSETVIEWPORTS_DENORMFLUSH = 387,
OMSETRENDERTARGETS_INVALIDVIEW = 388,
DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = 389,
DEVICE_DRAW_SAMPLER_MISMATCH = 390,
CREATEINPUTLAYOUT_TYPE_MISMATCH = 391,
BLENDSTATE_GETDESC_LEGACY = 392,
SHADERRESOURCEVIEW_GETDESC_LEGACY = 393,
CREATEQUERY_OUTOFMEMORY_RETURN = 394,
CREATEPREDICATE_OUTOFMEMORY_RETURN = 395,
CREATECOUNTER_OUTOFRANGE_COUNTER = 396,
CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED = 397,
CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = 398,
CREATECOUNTER_OUTOFMEMORY_RETURN = 399,
CREATECOUNTER_NONEXCLUSIVE_RETURN = 400,
CREATECOUNTER_NULLDESC = 401,
CHECKCOUNTER_OUTOFRANGE_COUNTER = 402,
CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = 403,
SETPREDICATION_INVALID_PREDICATE_STATE = 404,
QUERY_BEGIN_UNSUPPORTED = 405,
PREDICATE_BEGIN_DURING_PREDICATION = 406,
QUERY_BEGIN_DUPLICATE = 407,
QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS = 408,
PREDICATE_END_DURING_PREDICATION = 409,
QUERY_END_ABANDONING_PREVIOUS_RESULTS = 410,
QUERY_END_WITHOUT_BEGIN = 411,
QUERY_GETDATA_INVALID_DATASIZE = 412,
QUERY_GETDATA_INVALID_FLAGS = 413,
QUERY_GETDATA_INVALID_CALL = 414,
DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = 415,
DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = 416,
DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = 417,
DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE = 418,
DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE = 419,
CREATEINPUTLAYOUT_EMPTY_LAYOUT = 420,
DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH = 421,
LIVE_OBJECT_SUMMARY = 422,
LIVE_BUFFER = 423,
LIVE_TEXTURE1D = 424,
LIVE_TEXTURE2D = 425,
LIVE_TEXTURE3D = 426,
LIVE_SHADERRESOURCEVIEW = 427,
LIVE_RENDERTARGETVIEW = 428,
LIVE_DEPTHSTENCILVIEW = 429,
LIVE_VERTEXSHADER = 430,
LIVE_GEOMETRYSHADER = 431,
LIVE_PIXELSHADER = 432,
LIVE_INPUTLAYOUT = 433,
LIVE_SAMPLER = 434,
LIVE_BLENDSTATE = 435,
LIVE_DEPTHSTENCILSTATE = 436,
LIVE_RASTERIZERSTATE = 437,
LIVE_QUERY = 438,
LIVE_PREDICATE = 439,
LIVE_COUNTER = 440,
LIVE_DEVICE = 441,
LIVE_SWAPCHAIN = 442,
D3D10_MESSAGES_END = 443,
D3D10L9_MESSAGES_START = 1048576,
CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED = 1048577,
CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED = 1048578,
CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT = 1048579,
CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY = 1048580,
CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE = 1048581,
VSSETSAMPLERS_NOT_SUPPORTED = 1048582,
VSSETSAMPLERS_TOO_MANY_SAMPLERS = 1048583,
PSSETSAMPLERS_TOO_MANY_SAMPLERS = 1048584,
CREATERESOURCE_NO_ARRAYS = 1048585,
CREATERESOURCE_NO_VB_AND_IB_BIND = 1048586,
CREATERESOURCE_NO_TEXTURE_1D = 1048587,
CREATERESOURCE_DIMENSION_OUT_OF_RANGE = 1048588,
CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE = 1048589,
OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS = 1048590,
OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS = 1048591,
IASETVERTEXBUFFERS_BAD_BUFFER_INDEX = 1048592,
DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS = 1048593,
DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED = 1048594,
DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS = 1048595,
COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY = 1048596,
COPYRESOURCE_NO_TEXTURE_3D_READBACK = 1048597,
COPYRESOURCE_NO_TEXTURE_ONLY_READBACK = 1048598,
CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT = 1048599,
CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE = 1048600,
CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE = 1048601,
DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE = 1048602,
CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD = 1048603,
CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL = 1048604,
CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX = 1048605,
CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO = 1048606,
CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES = 1048607,
CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET = 1048608,
CREATERESOURCE_NO_DWORD_INDEX_BUFFER = 1048609,
CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE = 1048610,
CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE = 1048611,
CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE = 1048612,
CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS = 1048613,
CREATERESOURCE_NO_STREAM_OUT = 1048614,
CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS = 1048615,
CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES = 1048616,
CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED = 1048617,
VSSHADERRESOURCES_NOT_SUPPORTED = 1048618,
GEOMETRY_SHADER_NOT_SUPPORTED = 1048619,
STREAM_OUT_NOT_SUPPORTED = 1048620,
TEXT_FILTER_NOT_SUPPORTED = 1048621,
CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND = 1048622,
CREATEBLENDSTATE_NO_MRT_BLEND = 1048623,
CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED = 1048624,
CREATESAMPLERSTATE_NO_MIRRORONCE = 1048625,
DRAWINSTANCED_NOT_SUPPORTED = 1048626,
DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3 = 1048627,
DRAWINDEXED_POINTLIST_UNSUPPORTED = 1048628,
SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO = 1048629,
CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION = 1048630,
CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED = 1048631,
DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR = 1048632,
SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA = 1048633,
CREATERESOURCE_NON_POW_2_MIPMAP = 1048634,
CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED = 1048635,
OMSETRENDERTARGETS_NO_SRGB_MRT = 1048636,
COPYRESOURCE_NO_3D_MISMATCHED_UPDATES = 1048637,
D3D10L9_MESSAGES_END = 1048638,
D3D11_MESSAGES_START = 2097152,
CREATEDEPTHSTENCILVIEW_INVALIDFLAGS = 2097153,
CREATEVERTEXSHADER_INVALIDCLASSLINKAGE = 2097154,
CREATEGEOMETRYSHADER_INVALIDCLASSLINKAGE = 2097155,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTREAMS = 2097156,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAMTORASTERIZER = 2097157,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTREAMS = 2097158,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCLASSLINKAGE = 2097159,
CREATEPIXELSHADER_INVALIDCLASSLINKAGE = 2097160,
CREATEDEFERREDCONTEXT_INVALID_COMMANDLISTFLAGS = 2097161,
CREATEDEFERREDCONTEXT_SINGLETHREADED = 2097162,
CREATEDEFERREDCONTEXT_INVALIDARG_RETURN = 2097163,
CREATEDEFERREDCONTEXT_INVALID_CALL_RETURN = 2097164,
CREATEDEFERREDCONTEXT_OUTOFMEMORY_RETURN = 2097165,
FINISHDISPLAYLIST_ONIMMEDIATECONTEXT = 2097166,
FINISHDISPLAYLIST_OUTOFMEMORY_RETURN = 2097167,
FINISHDISPLAYLIST_INVALID_CALL_RETURN = 2097168,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAM = 2097169,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDENTRIES = 2097170,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTRIDES = 2097171,
CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTRIDES = 2097172,
DEVICE_HSSETSHADERRESOURCES_HAZARD = 2097173,
DEVICE_HSSETCONSTANTBUFFERS_HAZARD = 2097174,
HSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 2097175,
HSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 2097176,
CREATEHULLSHADER_INVALIDCALL = 2097177,
CREATEHULLSHADER_OUTOFMEMORY = 2097178,
CREATEHULLSHADER_INVALIDSHADERBYTECODE = 2097179,
CREATEHULLSHADER_INVALIDSHADERTYPE = 2097180,
CREATEHULLSHADER_INVALIDCLASSLINKAGE = 2097181,
DEVICE_HSSETSHADERRESOURCES_VIEWS_EMPTY = 2097182,
HSSETCONSTANTBUFFERS_INVALIDBUFFER = 2097183,
DEVICE_HSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097184,
DEVICE_HSSETSAMPLERS_SAMPLERS_EMPTY = 2097185,
DEVICE_HSGETSHADERRESOURCES_VIEWS_EMPTY = 2097186,
DEVICE_HSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097187,
DEVICE_HSGETSAMPLERS_SAMPLERS_EMPTY = 2097188,
DEVICE_DSSETSHADERRESOURCES_HAZARD = 2097189,
DEVICE_DSSETCONSTANTBUFFERS_HAZARD = 2097190,
DSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 2097191,
DSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 2097192,
CREATEDOMAINSHADER_INVALIDCALL = 2097193,
CREATEDOMAINSHADER_OUTOFMEMORY = 2097194,
CREATEDOMAINSHADER_INVALIDSHADERBYTECODE = 2097195,
CREATEDOMAINSHADER_INVALIDSHADERTYPE = 2097196,
CREATEDOMAINSHADER_INVALIDCLASSLINKAGE = 2097197,
DEVICE_DSSETSHADERRESOURCES_VIEWS_EMPTY = 2097198,
DSSETCONSTANTBUFFERS_INVALIDBUFFER = 2097199,
DEVICE_DSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097200,
DEVICE_DSSETSAMPLERS_SAMPLERS_EMPTY = 2097201,
DEVICE_DSGETSHADERRESOURCES_VIEWS_EMPTY = 2097202,
DEVICE_DSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097203,
DEVICE_DSGETSAMPLERS_SAMPLERS_EMPTY = 2097204,
DEVICE_DRAW_HS_XOR_DS_MISMATCH = 2097205,
DEFERRED_CONTEXT_REMOVAL_PROCESS_AT_FAULT = 2097206,
DEVICE_DRAWINDIRECT_INVALID_ARG_BUFFER = 2097207,
DEVICE_DRAWINDIRECT_OFFSET_UNALIGNED = 2097208,
DEVICE_DRAWINDIRECT_OFFSET_OVERFLOW = 2097209,
RESOURCE_MAP_INVALIDMAPTYPE = 2097210,
RESOURCE_MAP_INVALIDSUBRESOURCE = 2097211,
RESOURCE_MAP_INVALIDFLAGS = 2097212,
RESOURCE_MAP_ALREADYMAPPED = 2097213,
RESOURCE_MAP_DEVICEREMOVED_RETURN = 2097214,
RESOURCE_MAP_OUTOFMEMORY_RETURN = 2097215,
RESOURCE_MAP_WITHOUT_INITIAL_DISCARD = 2097216,
RESOURCE_UNMAP_INVALIDSUBRESOURCE = 2097217,
RESOURCE_UNMAP_NOTMAPPED = 2097218,
DEVICE_DRAW_RASTERIZING_CONTROL_POINTS = 2097219,
DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNSUPPORTED = 2097220,
DEVICE_DRAW_HS_DS_SIGNATURE_MISMATCH = 2097221,
DEVICE_DRAW_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH = 2097222,
DEVICE_DRAW_HS_DS_CONTROL_POINT_COUNT_MISMATCH = 2097223,
DEVICE_DRAW_HS_DS_TESSELLATOR_DOMAIN_MISMATCH = 2097224,
CREATE_CONTEXT = 2097225,
LIVE_CONTEXT = 2097226,
DESTROY_CONTEXT = 2097227,
CREATE_BUFFER = 2097228,
LIVE_BUFFER_WIN7 = 2097229,
DESTROY_BUFFER = 2097230,
CREATE_TEXTURE1D = 2097231,
LIVE_TEXTURE1D_WIN7 = 2097232,
DESTROY_TEXTURE1D = 2097233,
CREATE_TEXTURE2D = 2097234,
LIVE_TEXTURE2D_WIN7 = 2097235,
DESTROY_TEXTURE2D = 2097236,
CREATE_TEXTURE3D = 2097237,
LIVE_TEXTURE3D_WIN7 = 2097238,
DESTROY_TEXTURE3D = 2097239,
CREATE_SHADERRESOURCEVIEW = 2097240,
LIVE_SHADERRESOURCEVIEW_WIN7 = 2097241,
DESTROY_SHADERRESOURCEVIEW = 2097242,
CREATE_RENDERTARGETVIEW = 2097243,
LIVE_RENDERTARGETVIEW_WIN7 = 2097244,
DESTROY_RENDERTARGETVIEW = 2097245,
CREATE_DEPTHSTENCILVIEW = 2097246,
LIVE_DEPTHSTENCILVIEW_WIN7 = 2097247,
DESTROY_DEPTHSTENCILVIEW = 2097248,
CREATE_VERTEXSHADER = 2097249,
LIVE_VERTEXSHADER_WIN7 = 2097250,
DESTROY_VERTEXSHADER = 2097251,
CREATE_HULLSHADER = 2097252,
LIVE_HULLSHADER = 2097253,
DESTROY_HULLSHADER = 2097254,
CREATE_DOMAINSHADER = 2097255,
LIVE_DOMAINSHADER = 2097256,
DESTROY_DOMAINSHADER = 2097257,
CREATE_GEOMETRYSHADER = 2097258,
LIVE_GEOMETRYSHADER_WIN7 = 2097259,
DESTROY_GEOMETRYSHADER = 2097260,
CREATE_PIXELSHADER = 2097261,
LIVE_PIXELSHADER_WIN7 = 2097262,
DESTROY_PIXELSHADER = 2097263,
CREATE_INPUTLAYOUT = 2097264,
LIVE_INPUTLAYOUT_WIN7 = 2097265,
DESTROY_INPUTLAYOUT = 2097266,
CREATE_SAMPLER = 2097267,
LIVE_SAMPLER_WIN7 = 2097268,
DESTROY_SAMPLER = 2097269,
CREATE_BLENDSTATE = 2097270,
LIVE_BLENDSTATE_WIN7 = 2097271,
DESTROY_BLENDSTATE = 2097272,
CREATE_DEPTHSTENCILSTATE = 2097273,
LIVE_DEPTHSTENCILSTATE_WIN7 = 2097274,
DESTROY_DEPTHSTENCILSTATE = 2097275,
CREATE_RASTERIZERSTATE = 2097276,
LIVE_RASTERIZERSTATE_WIN7 = 2097277,
DESTROY_RASTERIZERSTATE = 2097278,
CREATE_QUERY = 2097279,
LIVE_QUERY_WIN7 = 2097280,
DESTROY_QUERY = 2097281,
CREATE_PREDICATE = 2097282,
LIVE_PREDICATE_WIN7 = 2097283,
DESTROY_PREDICATE = 2097284,
CREATE_COUNTER = 2097285,
DESTROY_COUNTER = 2097286,
CREATE_COMMANDLIST = 2097287,
LIVE_COMMANDLIST = 2097288,
DESTROY_COMMANDLIST = 2097289,
CREATE_CLASSINSTANCE = 2097290,
LIVE_CLASSINSTANCE = 2097291,
DESTROY_CLASSINSTANCE = 2097292,
CREATE_CLASSLINKAGE = 2097293,
LIVE_CLASSLINKAGE = 2097294,
DESTROY_CLASSLINKAGE = 2097295,
LIVE_DEVICE_WIN7 = 2097296,
LIVE_OBJECT_SUMMARY_WIN7 = 2097297,
CREATE_COMPUTESHADER = 2097298,
LIVE_COMPUTESHADER = 2097299,
DESTROY_COMPUTESHADER = 2097300,
CREATE_UNORDEREDACCESSVIEW = 2097301,
LIVE_UNORDEREDACCESSVIEW = 2097302,
DESTROY_UNORDEREDACCESSVIEW = 2097303,
DEVICE_SETSHADER_INTERFACES_FEATURELEVEL = 2097304,
DEVICE_SETSHADER_INTERFACE_COUNT_MISMATCH = 2097305,
DEVICE_SETSHADER_INVALID_INSTANCE = 2097306,
DEVICE_SETSHADER_INVALID_INSTANCE_INDEX = 2097307,
DEVICE_SETSHADER_INVALID_INSTANCE_TYPE = 2097308,
DEVICE_SETSHADER_INVALID_INSTANCE_DATA = 2097309,
DEVICE_SETSHADER_UNBOUND_INSTANCE_DATA = 2097310,
DEVICE_SETSHADER_INSTANCE_DATA_BINDINGS = 2097311,
DEVICE_CREATESHADER_CLASSLINKAGE_FULL = 2097312,
DEVICE_CHECKFEATURESUPPORT_UNRECOGNIZED_FEATURE = 2097313,
DEVICE_CHECKFEATURESUPPORT_MISMATCHED_DATA_SIZE = 2097314,
DEVICE_CHECKFEATURESUPPORT_INVALIDARG_RETURN = 2097315,
DEVICE_CSSETSHADERRESOURCES_HAZARD = 2097316,
DEVICE_CSSETCONSTANTBUFFERS_HAZARD = 2097317,
CSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = 2097318,
CSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = 2097319,
CREATECOMPUTESHADER_INVALIDCALL = 2097320,
CREATECOMPUTESHADER_OUTOFMEMORY = 2097321,
CREATECOMPUTESHADER_INVALIDSHADERBYTECODE = 2097322,
CREATECOMPUTESHADER_INVALIDSHADERTYPE = 2097323,
CREATECOMPUTESHADER_INVALIDCLASSLINKAGE = 2097324,
DEVICE_CSSETSHADERRESOURCES_VIEWS_EMPTY = 2097325,
CSSETCONSTANTBUFFERS_INVALIDBUFFER = 2097326,
DEVICE_CSSETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097327,
DEVICE_CSSETSAMPLERS_SAMPLERS_EMPTY = 2097328,
DEVICE_CSGETSHADERRESOURCES_VIEWS_EMPTY = 2097329,
DEVICE_CSGETCONSTANTBUFFERS_BUFFERS_EMPTY = 2097330,
DEVICE_CSGETSAMPLERS_SAMPLERS_EMPTY = 2097331,
DEVICE_CREATEVERTEXSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097332,
DEVICE_CREATEHULLSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097333,
DEVICE_CREATEDOMAINSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097334,
DEVICE_CREATEGEOMETRYSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097335,
DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEFLOATOPSNOTSUPPORTED = 2097336,
DEVICE_CREATEPIXELSHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097337,
DEVICE_CREATECOMPUTESHADER_DOUBLEFLOATOPSNOTSUPPORTED = 2097338,
CREATEBUFFER_INVALIDSTRUCTURESTRIDE = 2097339,
CREATESHADERRESOURCEVIEW_INVALIDFLAGS = 2097340,
CREATEUNORDEREDACCESSVIEW_INVALIDRESOURCE = 2097341,
CREATEUNORDEREDACCESSVIEW_INVALIDDESC = 2097342,
CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT = 2097343,
CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS = 2097344,
CREATEUNORDEREDACCESSVIEW_UNRECOGNIZEDFORMAT = 2097345,
DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_HAZARD = 2097346,
DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_OVERLAPPING_OLD_SLOTS = 2097347,
DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NO_OP = 2097348,
CSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT = 2097349,
PSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT = 2097350,
CREATEUNORDEREDACCESSVIEW_INVALIDARG_RETURN = 2097351,
CREATEUNORDEREDACCESSVIEW_OUTOFMEMORY_RETURN = 2097352,
CREATEUNORDEREDACCESSVIEW_TOOMANYOBJECTS = 2097353,
DEVICE_CSSETUNORDEREDACCESSVIEWS_HAZARD = 2097354,
CLEARUNORDEREDACCESSVIEW_DENORMFLUSH = 2097355,
DEVICE_CSSETUNORDEREDACCESSS_VIEWS_EMPTY = 2097356,
DEVICE_CSGETUNORDEREDACCESSS_VIEWS_EMPTY = 2097357,
CREATEUNORDEREDACCESSVIEW_INVALIDFLAGS = 2097358,
CREATESHADERRESESOURCEVIEW_TOOMANYOBJECTS = 2097359,
DEVICE_DISPATCHINDIRECT_INVALID_ARG_BUFFER = 2097360,
DEVICE_DISPATCHINDIRECT_OFFSET_UNALIGNED = 2097361,
DEVICE_DISPATCHINDIRECT_OFFSET_OVERFLOW = 2097362,
DEVICE_SETRESOURCEMINLOD_INVALIDCONTEXT = 2097363,
DEVICE_SETRESOURCEMINLOD_INVALIDRESOURCE = 2097364,
DEVICE_SETRESOURCEMINLOD_INVALIDMINLOD = 2097365,
DEVICE_GETRESOURCEMINLOD_INVALIDCONTEXT = 2097366,
DEVICE_GETRESOURCEMINLOD_INVALIDRESOURCE = 2097367,
OMSETDEPTHSTENCIL_UNBINDDELETINGOBJECT = 2097368,
CLEARDEPTHSTENCILVIEW_DEPTH_READONLY = 2097369,
CLEARDEPTHSTENCILVIEW_STENCIL_READONLY = 2097370,
CHECKFEATURESUPPORT_FORMAT_DEPRECATED = 2097371,
DEVICE_UNORDEREDACCESSVIEW_RETURN_TYPE_MISMATCH = 2097372,
DEVICE_UNORDEREDACCESSVIEW_NOT_SET = 2097373,
DEVICE_DRAW_UNORDEREDACCESSVIEW_RENDERTARGETVIEW_OVERLAP = 2097374,
DEVICE_UNORDEREDACCESSVIEW_DIMENSION_MISMATCH = 2097375,
DEVICE_UNORDEREDACCESSVIEW_APPEND_UNSUPPORTED = 2097376,
DEVICE_UNORDEREDACCESSVIEW_ATOMICS_UNSUPPORTED = 2097377,
DEVICE_UNORDEREDACCESSVIEW_STRUCTURE_STRIDE_MISMATCH = 2097378,
DEVICE_UNORDEREDACCESSVIEW_BUFFER_TYPE_MISMATCH = 2097379,
DEVICE_UNORDEREDACCESSVIEW_RAW_UNSUPPORTED = 2097380,
DEVICE_UNORDEREDACCESSVIEW_FORMAT_LD_UNSUPPORTED = 2097381,
DEVICE_UNORDEREDACCESSVIEW_FORMAT_STORE_UNSUPPORTED = 2097382,
DEVICE_UNORDEREDACCESSVIEW_ATOMIC_ADD_UNSUPPORTED = 2097383,
DEVICE_UNORDEREDACCESSVIEW_ATOMIC_BITWISE_OPS_UNSUPPORTED = 2097384,
DEVICE_UNORDEREDACCESSVIEW_ATOMIC_CMPSTORE_CMPEXCHANGE_UNSUPPORTED = 2097385,
DEVICE_UNORDEREDACCESSVIEW_ATOMIC_EXCHANGE_UNSUPPORTED = 2097386,
DEVICE_UNORDEREDACCESSVIEW_ATOMIC_SIGNED_MINMAX_UNSUPPORTED = 2097387,
DEVICE_UNORDEREDACCESSVIEW_ATOMIC_UNSIGNED_MINMAX_UNSUPPORTED = 2097388,
DEVICE_DISPATCH_BOUND_RESOURCE_MAPPED = 2097389,
DEVICE_DISPATCH_THREADGROUPCOUNT_OVERFLOW = 2097390,
DEVICE_DISPATCH_THREADGROUPCOUNT_ZERO = 2097391,
DEVICE_SHADERRESOURCEVIEW_STRUCTURE_STRIDE_MISMATCH = 2097392,
DEVICE_SHADERRESOURCEVIEW_BUFFER_TYPE_MISMATCH = 2097393,
DEVICE_SHADERRESOURCEVIEW_RAW_UNSUPPORTED = 2097394,
DEVICE_DISPATCH_UNSUPPORTED = 2097395,
DEVICE_DISPATCHINDIRECT_UNSUPPORTED = 2097396,
COPYSTRUCTURECOUNT_INVALIDOFFSET = 2097397,
COPYSTRUCTURECOUNT_LARGEOFFSET = 2097398,
COPYSTRUCTURECOUNT_INVALIDDESTINATIONSTATE = 2097399,
COPYSTRUCTURECOUNT_INVALIDSOURCESTATE = 2097400,
CHECKFORMATSUPPORT_FORMAT_NOT_SUPPORTED = 2097401,
DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDVIEW = 2097402,
DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDOFFSET = 2097403,
DEVICE_CSSETUNORDEREDACCESSVIEWS_TOOMANYVIEWS = 2097404,
CLEARUNORDEREDACCESSVIEWFLOAT_INVALIDFORMAT = 2097405,
DEVICE_UNORDEREDACCESSVIEW_COUNTER_UNSUPPORTED = 2097406,
REF_WARNING = 2097407,
DEVICE_DRAW_PIXEL_SHADER_WITHOUT_RTV_OR_DSV = 2097408,
SHADER_ABORT = 2097409,
SHADER_MESSAGE = 2097410,
SHADER_ERROR = 2097411,
OFFERRESOURCES_INVALIDRESOURCE = 2097412,
HSSETSAMPLERS_UNBINDDELETINGOBJECT = 2097413,
DSSETSAMPLERS_UNBINDDELETINGOBJECT = 2097414,
CSSETSAMPLERS_UNBINDDELETINGOBJECT = 2097415,
HSSETSHADER_UNBINDDELETINGOBJECT = 2097416,
DSSETSHADER_UNBINDDELETINGOBJECT = 2097417,
CSSETSHADER_UNBINDDELETINGOBJECT = 2097418,
ENQUEUESETEVENT_INVALIDARG_RETURN = 2097419,
ENQUEUESETEVENT_OUTOFMEMORY_RETURN = 2097420,
ENQUEUESETEVENT_ACCESSDENIED_RETURN = 2097421,
DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NUMUAVS_INVALIDRANGE = 2097422,
USE_OF_ZERO_REFCOUNT_OBJECT = 2097423,
D3D11_MESSAGES_END = 2097424,
D3D11_1_MESSAGES_START = 3145728,
CREATE_VIDEODECODER = 3145729,
CREATE_VIDEOPROCESSORENUM = 3145730,
CREATE_VIDEOPROCESSOR = 3145731,
CREATE_DECODEROUTPUTVIEW = 3145732,
CREATE_PROCESSORINPUTVIEW = 3145733,
CREATE_PROCESSOROUTPUTVIEW = 3145734,
CREATE_DEVICECONTEXTSTATE = 3145735,
LIVE_VIDEODECODER = 3145736,
LIVE_VIDEOPROCESSORENUM = 3145737,
LIVE_VIDEOPROCESSOR = 3145738,
LIVE_DECODEROUTPUTVIEW = 3145739,
LIVE_PROCESSORINPUTVIEW = 3145740,
LIVE_PROCESSOROUTPUTVIEW = 3145741,
LIVE_DEVICECONTEXTSTATE = 3145742,
DESTROY_VIDEODECODER = 3145743,
DESTROY_VIDEOPROCESSORENUM = 3145744,
DESTROY_VIDEOPROCESSOR = 3145745,
DESTROY_DECODEROUTPUTVIEW = 3145746,
DESTROY_PROCESSORINPUTVIEW = 3145747,
DESTROY_PROCESSOROUTPUTVIEW = 3145748,
DESTROY_DEVICECONTEXTSTATE = 3145749,
CREATEDEVICECONTEXTSTATE_INVALIDFLAGS = 3145750,
CREATEDEVICECONTEXTSTATE_INVALIDFEATURELEVEL = 3145751,
CREATEDEVICECONTEXTSTATE_FEATURELEVELS_NOT_SUPPORTED = 3145752,
CREATEDEVICECONTEXTSTATE_INVALIDREFIID = 3145753,
DEVICE_DISCARDVIEW_INVALIDVIEW = 3145754,
COPYSUBRESOURCEREGION1_INVALIDCOPYFLAGS = 3145755,
UPDATESUBRESOURCE1_INVALIDCOPYFLAGS = 3145756,
CREATERASTERIZERSTATE_INVALIDFORCEDSAMPLECOUNT = 3145757,
CREATEVIDEODECODER_OUTOFMEMORY_RETURN = 3145758,
CREATEVIDEODECODER_NULLPARAM = 3145759,
CREATEVIDEODECODER_INVALIDFORMAT = 3145760,
CREATEVIDEODECODER_ZEROWIDTHHEIGHT = 3145761,
CREATEVIDEODECODER_DRIVER_INVALIDBUFFERSIZE = 3145762,
CREATEVIDEODECODER_DRIVER_INVALIDBUFFERUSAGE = 3145763,
GETVIDEODECODERPROFILECOUNT_OUTOFMEMORY = 3145764,
GETVIDEODECODERPROFILE_NULLPARAM = 3145765,
GETVIDEODECODERPROFILE_INVALIDINDEX = 3145766,
GETVIDEODECODERPROFILE_OUTOFMEMORY_RETURN = 3145767,
CHECKVIDEODECODERFORMAT_NULLPARAM = 3145768,
CHECKVIDEODECODERFORMAT_OUTOFMEMORY_RETURN = 3145769,
GETVIDEODECODERCONFIGCOUNT_NULLPARAM = 3145770,
GETVIDEODECODERCONFIGCOUNT_OUTOFMEMORY_RETURN = 3145771,
GETVIDEODECODERCONFIG_NULLPARAM = 3145772,
GETVIDEODECODERCONFIG_INVALIDINDEX = 3145773,
GETVIDEODECODERCONFIG_OUTOFMEMORY_RETURN = 3145774,
GETDECODERCREATIONPARAMS_NULLPARAM = 3145775,
GETDECODERDRIVERHANDLE_NULLPARAM = 3145776,
GETDECODERBUFFER_NULLPARAM = 3145777,
GETDECODERBUFFER_INVALIDBUFFER = 3145778,
GETDECODERBUFFER_INVALIDTYPE = 3145779,
GETDECODERBUFFER_LOCKED = 3145780,
RELEASEDECODERBUFFER_NULLPARAM = 3145781,
RELEASEDECODERBUFFER_INVALIDTYPE = 3145782,
RELEASEDECODERBUFFER_NOTLOCKED = 3145783,
DECODERBEGINFRAME_NULLPARAM = 3145784,
DECODERBEGINFRAME_HAZARD = 3145785,
DECODERENDFRAME_NULLPARAM = 3145786,
SUBMITDECODERBUFFERS_NULLPARAM = 3145787,
SUBMITDECODERBUFFERS_INVALIDTYPE = 3145788,
DECODEREXTENSION_NULLPARAM = 3145789,
DECODEREXTENSION_INVALIDRESOURCE = 3145790,
CREATEVIDEOPROCESSORENUMERATOR_OUTOFMEMORY_RETURN = 3145791,
CREATEVIDEOPROCESSORENUMERATOR_NULLPARAM = 3145792,
CREATEVIDEOPROCESSORENUMERATOR_INVALIDFRAMEFORMAT = 3145793,
CREATEVIDEOPROCESSORENUMERATOR_INVALIDUSAGE = 3145794,
CREATEVIDEOPROCESSORENUMERATOR_INVALIDINPUTFRAMERATE = 3145795,
CREATEVIDEOPROCESSORENUMERATOR_INVALIDOUTPUTFRAMERATE = 3145796,
CREATEVIDEOPROCESSORENUMERATOR_INVALIDWIDTHHEIGHT = 3145797,
GETVIDEOPROCESSORCONTENTDESC_NULLPARAM = 3145798,
CHECKVIDEOPROCESSORFORMAT_NULLPARAM = 3145799,
GETVIDEOPROCESSORCAPS_NULLPARAM = 3145800,
GETVIDEOPROCESSORRATECONVERSIONCAPS_NULLPARAM = 3145801,
GETVIDEOPROCESSORRATECONVERSIONCAPS_INVALIDINDEX = 3145802,
GETVIDEOPROCESSORCUSTOMRATE_NULLPARAM = 3145803,
GETVIDEOPROCESSORCUSTOMRATE_INVALIDINDEX = 3145804,
GETVIDEOPROCESSORFILTERRANGE_NULLPARAM = 3145805,
GETVIDEOPROCESSORFILTERRANGE_UNSUPPORTED = 3145806,
CREATEVIDEOPROCESSOR_OUTOFMEMORY_RETURN = 3145807,
CREATEVIDEOPROCESSOR_NULLPARAM = 3145808,
VIDEOPROCESSORSETOUTPUTTARGETRECT_NULLPARAM = 3145809,
VIDEOPROCESSORSETOUTPUTBACKGROUNDCOLOR_NULLPARAM = 3145810,
VIDEOPROCESSORSETOUTPUTBACKGROUNDCOLOR_INVALIDALPHA = 3145811,
VIDEOPROCESSORSETOUTPUTCOLORSPACE_NULLPARAM = 3145812,
VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_NULLPARAM = 3145813,
VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_UNSUPPORTED = 3145814,
VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_INVALIDSTREAM = 3145815,
VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_INVALIDFILLMODE = 3145816,
VIDEOPROCESSORSETOUTPUTCONSTRICTION_NULLPARAM = 3145817,
VIDEOPROCESSORSETOUTPUTSTEREOMODE_NULLPARAM = 3145818,
VIDEOPROCESSORSETOUTPUTSTEREOMODE_UNSUPPORTED = 3145819,
VIDEOPROCESSORSETOUTPUTEXTENSION_NULLPARAM = 3145820,
VIDEOPROCESSORGETOUTPUTTARGETRECT_NULLPARAM = 3145821,
VIDEOPROCESSORGETOUTPUTBACKGROUNDCOLOR_NULLPARAM = 3145822,
VIDEOPROCESSORGETOUTPUTCOLORSPACE_NULLPARAM = 3145823,
VIDEOPROCESSORGETOUTPUTALPHAFILLMODE_NULLPARAM = 3145824,
VIDEOPROCESSORGETOUTPUTCONSTRICTION_NULLPARAM = 3145825,
VIDEOPROCESSORSETOUTPUTCONSTRICTION_UNSUPPORTED = 3145826,
VIDEOPROCESSORSETOUTPUTCONSTRICTION_INVALIDSIZE = 3145827,
VIDEOPROCESSORGETOUTPUTSTEREOMODE_NULLPARAM = 3145828,
VIDEOPROCESSORGETOUTPUTEXTENSION_NULLPARAM = 3145829,
VIDEOPROCESSORSETSTREAMFRAMEFORMAT_NULLPARAM = 3145830,
VIDEOPROCESSORSETSTREAMFRAMEFORMAT_INVALIDFORMAT = 3145831,
VIDEOPROCESSORSETSTREAMFRAMEFORMAT_INVALIDSTREAM = 3145832,
VIDEOPROCESSORSETSTREAMCOLORSPACE_NULLPARAM = 3145833,
VIDEOPROCESSORSETSTREAMCOLORSPACE_INVALIDSTREAM = 3145834,
VIDEOPROCESSORSETSTREAMOUTPUTRATE_NULLPARAM = 3145835,
VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDRATE = 3145836,
VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDFLAG = 3145837,
VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDSTREAM = 3145838,
VIDEOPROCESSORSETSTREAMSOURCERECT_NULLPARAM = 3145839,
VIDEOPROCESSORSETSTREAMSOURCERECT_INVALIDSTREAM = 3145840,
VIDEOPROCESSORSETSTREAMSOURCERECT_INVALIDRECT = 3145841,
VIDEOPROCESSORSETSTREAMDESTRECT_NULLPARAM = 3145842,
VIDEOPROCESSORSETSTREAMDESTRECT_INVALIDSTREAM = 3145843,
VIDEOPROCESSORSETSTREAMDESTRECT_INVALIDRECT = 3145844,
VIDEOPROCESSORSETSTREAMALPHA_NULLPARAM = 3145845,
VIDEOPROCESSORSETSTREAMALPHA_INVALIDSTREAM = 3145846,
VIDEOPROCESSORSETSTREAMALPHA_INVALIDALPHA = 3145847,
VIDEOPROCESSORSETSTREAMPALETTE_NULLPARAM = 3145848,
VIDEOPROCESSORSETSTREAMPALETTE_INVALIDSTREAM = 3145849,
VIDEOPROCESSORSETSTREAMPALETTE_INVALIDCOUNT = 3145850,
VIDEOPROCESSORSETSTREAMPALETTE_INVALIDALPHA = 3145851,
VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_NULLPARAM = 3145852,
VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_INVALIDSTREAM = 3145853,
VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_INVALIDRATIO = 3145854,
VIDEOPROCESSORSETSTREAMLUMAKEY_NULLPARAM = 3145855,
VIDEOPROCESSORSETSTREAMLUMAKEY_INVALIDSTREAM = 3145856,
VIDEOPROCESSORSETSTREAMLUMAKEY_INVALIDRANGE = 3145857,
VIDEOPROCESSORSETSTREAMLUMAKEY_UNSUPPORTED = 3145858,
VIDEOPROCESSORSETSTREAMSTEREOFORMAT_NULLPARAM = 3145859,
VIDEOPROCESSORSETSTREAMSTEREOFORMAT_INVALIDSTREAM = 3145860,
VIDEOPROCESSORSETSTREAMSTEREOFORMAT_UNSUPPORTED = 3145861,
VIDEOPROCESSORSETSTREAMSTEREOFORMAT_FLIPUNSUPPORTED = 3145862,
VIDEOPROCESSORSETSTREAMSTEREOFORMAT_MONOOFFSETUNSUPPORTED = 3145863,
VIDEOPROCESSORSETSTREAMSTEREOFORMAT_FORMATUNSUPPORTED = 3145864,
VIDEOPROCESSORSETSTREAMSTEREOFORMAT_INVALIDFORMAT = 3145865,
VIDEOPROCESSORSETSTREAMAUTOPROCESSINGMODE_NULLPARAM = 3145866,
VIDEOPROCESSORSETSTREAMAUTOPROCESSINGMODE_INVALIDSTREAM = 3145867,
VIDEOPROCESSORSETSTREAMFILTER_NULLPARAM = 3145868,
VIDEOPROCESSORSETSTREAMFILTER_INVALIDSTREAM = 3145869,
VIDEOPROCESSORSETSTREAMFILTER_INVALIDFILTER = 3145870,
VIDEOPROCESSORSETSTREAMFILTER_UNSUPPORTED = 3145871,
VIDEOPROCESSORSETSTREAMFILTER_INVALIDLEVEL = 3145872,
VIDEOPROCESSORSETSTREAMEXTENSION_NULLPARAM = 3145873,
VIDEOPROCESSORSETSTREAMEXTENSION_INVALIDSTREAM = 3145874,
VIDEOPROCESSORGETSTREAMFRAMEFORMAT_NULLPARAM = 3145875,
VIDEOPROCESSORGETSTREAMCOLORSPACE_NULLPARAM = 3145876,
VIDEOPROCESSORGETSTREAMOUTPUTRATE_NULLPARAM = 3145877,
VIDEOPROCESSORGETSTREAMSOURCERECT_NULLPARAM = 3145878,
VIDEOPROCESSORGETSTREAMDESTRECT_NULLPARAM = 3145879,
VIDEOPROCESSORGETSTREAMALPHA_NULLPARAM = 3145880,
VIDEOPROCESSORGETSTREAMPALETTE_NULLPARAM = 3145881,
VIDEOPROCESSORGETSTREAMPIXELASPECTRATIO_NULLPARAM = 3145882,
VIDEOPROCESSORGETSTREAMLUMAKEY_NULLPARAM = 3145883,
VIDEOPROCESSORGETSTREAMSTEREOFORMAT_NULLPARAM = 3145884,
VIDEOPROCESSORGETSTREAMAUTOPROCESSINGMODE_NULLPARAM = 3145885,
VIDEOPROCESSORGETSTREAMFILTER_NULLPARAM = 3145886,
VIDEOPROCESSORGETSTREAMEXTENSION_NULLPARAM = 3145887,
VIDEOPROCESSORGETSTREAMEXTENSION_INVALIDSTREAM = 3145888,
VIDEOPROCESSORBLT_NULLPARAM = 3145889,
VIDEOPROCESSORBLT_INVALIDSTREAMCOUNT = 3145890,
VIDEOPROCESSORBLT_TARGETRECT = 3145891,
VIDEOPROCESSORBLT_INVALIDOUTPUT = 3145892,
VIDEOPROCESSORBLT_INVALIDPASTFRAMES = 3145893,
VIDEOPROCESSORBLT_INVALIDFUTUREFRAMES = 3145894,
VIDEOPROCESSORBLT_INVALIDSOURCERECT = 3145895,
VIDEOPROCESSORBLT_INVALIDDESTRECT = 3145896,
VIDEOPROCESSORBLT_INVALIDINPUTRESOURCE = 3145897,
VIDEOPROCESSORBLT_INVALIDARRAYSIZE = 3145898,
VIDEOPROCESSORBLT_INVALIDARRAY = 3145899,
VIDEOPROCESSORBLT_RIGHTEXPECTED = 3145900,
VIDEOPROCESSORBLT_RIGHTNOTEXPECTED = 3145901,
VIDEOPROCESSORBLT_STEREONOTENABLED = 3145902,
VIDEOPROCESSORBLT_INVALIDRIGHTRESOURCE = 3145903,
VIDEOPROCESSORBLT_NOSTEREOSTREAMS = 3145904,
VIDEOPROCESSORBLT_INPUTHAZARD = 3145905,
VIDEOPROCESSORBLT_OUTPUTHAZARD = 3145906,
CREATEVIDEODECODEROUTPUTVIEW_OUTOFMEMORY_RETURN = 3145907,
CREATEVIDEODECODEROUTPUTVIEW_NULLPARAM = 3145908,
CREATEVIDEODECODEROUTPUTVIEW_INVALIDTYPE = 3145909,
CREATEVIDEODECODEROUTPUTVIEW_INVALIDBIND = 3145910,
CREATEVIDEODECODEROUTPUTVIEW_UNSUPPORTEDFORMAT = 3145911,
CREATEVIDEODECODEROUTPUTVIEW_INVALIDMIP = 3145912,
CREATEVIDEODECODEROUTPUTVIEW_UNSUPPORTEMIP = 3145913,
CREATEVIDEODECODEROUTPUTVIEW_INVALIDARRAYSIZE = 3145914,
CREATEVIDEODECODEROUTPUTVIEW_INVALIDARRAY = 3145915,
CREATEVIDEODECODEROUTPUTVIEW_INVALIDDIMENSION = 3145916,
CREATEVIDEOPROCESSORINPUTVIEW_OUTOFMEMORY_RETURN = 3145917,
CREATEVIDEOPROCESSORINPUTVIEW_NULLPARAM = 3145918,
CREATEVIDEOPROCESSORINPUTVIEW_INVALIDTYPE = 3145919,
CREATEVIDEOPROCESSORINPUTVIEW_INVALIDBIND = 3145920,
CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMISC = 3145921,
CREATEVIDEOPROCESSORINPUTVIEW_INVALIDUSAGE = 3145922,
CREATEVIDEOPROCESSORINPUTVIEW_INVALIDFORMAT = 3145923,
CREATEVIDEOPROCESSORINPUTVIEW_INVALIDFOURCC = 3145924,
CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMIP = 3145925,
CREATEVIDEOPROCESSORINPUTVIEW_UNSUPPORTEDMIP = 3145926,
CREATEVIDEOPROCESSORINPUTVIEW_INVALIDARRAYSIZE = 3145927,
CREATEVIDEOPROCESSORINPUTVIEW_INVALIDARRAY = 3145928,
CREATEVIDEOPROCESSORINPUTVIEW_INVALIDDIMENSION = 3145929,
CREATEVIDEOPROCESSOROUTPUTVIEW_OUTOFMEMORY_RETURN = 3145930,
CREATEVIDEOPROCESSOROUTPUTVIEW_NULLPARAM = 3145931,
CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDTYPE = 3145932,
CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDBIND = 3145933,
CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDFORMAT = 3145934,
CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDMIP = 3145935,
CREATEVIDEOPROCESSOROUTPUTVIEW_UNSUPPORTEDMIP = 3145936,
CREATEVIDEOPROCESSOROUTPUTVIEW_UNSUPPORTEDARRAY = 3145937,
CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDARRAY = 3145938,
CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDDIMENSION = 3145939,
DEVICE_DRAW_INVALID_USE_OF_FORCED_SAMPLE_COUNT = 3145940,
CREATEBLENDSTATE_INVALIDLOGICOPS = 3145941,
CREATESHADERRESOURCEVIEW_INVALIDDARRAYWITHDECODER = 3145942,
CREATEUNORDEREDACCESSVIEW_INVALIDDARRAYWITHDECODER = 3145943,
CREATERENDERTARGETVIEW_INVALIDDARRAYWITHDECODER = 3145944,
DEVICE_LOCKEDOUT_INTERFACE = 3145945,
REF_WARNING_ATOMIC_INCONSISTENT = 3145946,
REF_WARNING_READING_UNINITIALIZED_RESOURCE = 3145947,
REF_WARNING_RAW_HAZARD = 3145948,
REF_WARNING_WAR_HAZARD = 3145949,
REF_WARNING_WAW_HAZARD = 3145950,
CREATECRYPTOSESSION_NULLPARAM = 3145951,
CREATECRYPTOSESSION_OUTOFMEMORY_RETURN = 3145952,
GETCRYPTOTYPE_NULLPARAM = 3145953,
GETDECODERPROFILE_NULLPARAM = 3145954,
GETCRYPTOSESSIONCERTIFICATESIZE_NULLPARAM = 3145955,
GETCRYPTOSESSIONCERTIFICATE_NULLPARAM = 3145956,
GETCRYPTOSESSIONCERTIFICATE_WRONGSIZE = 3145957,
GETCRYPTOSESSIONHANDLE_WRONGSIZE = 3145958,
NEGOTIATECRPYTOSESSIONKEYEXCHANGE_NULLPARAM = 3145959,
ENCRYPTIONBLT_UNSUPPORTED = 3145960,
ENCRYPTIONBLT_NULLPARAM = 3145961,
ENCRYPTIONBLT_SRC_WRONGDEVICE = 3145962,
ENCRYPTIONBLT_DST_WRONGDEVICE = 3145963,
ENCRYPTIONBLT_FORMAT_MISMATCH = 3145964,
ENCRYPTIONBLT_SIZE_MISMATCH = 3145965,
ENCRYPTIONBLT_SRC_MULTISAMPLED = 3145966,
ENCRYPTIONBLT_DST_NOT_STAGING = 3145967,
ENCRYPTIONBLT_SRC_MAPPED = 3145968,
ENCRYPTIONBLT_DST_MAPPED = 3145969,
ENCRYPTIONBLT_SRC_OFFERED = 3145970,
ENCRYPTIONBLT_DST_OFFERED = 3145971,
ENCRYPTIONBLT_SRC_CONTENT_UNDEFINED = 3145972,
DECRYPTIONBLT_UNSUPPORTED = 3145973,
DECRYPTIONBLT_NULLPARAM = 3145974,
DECRYPTIONBLT_SRC_WRONGDEVICE = 3145975,
DECRYPTIONBLT_DST_WRONGDEVICE = 3145976,
DECRYPTIONBLT_FORMAT_MISMATCH = 3145977,
DECRYPTIONBLT_SIZE_MISMATCH = 3145978,
DECRYPTIONBLT_DST_MULTISAMPLED = 3145979,
DECRYPTIONBLT_SRC_NOT_STAGING = 3145980,
DECRYPTIONBLT_DST_NOT_RENDER_TARGET = 3145981,
DECRYPTIONBLT_SRC_MAPPED = 3145982,
DECRYPTIONBLT_DST_MAPPED = 3145983,
DECRYPTIONBLT_SRC_OFFERED = 3145984,
DECRYPTIONBLT_DST_OFFERED = 3145985,
DECRYPTIONBLT_SRC_CONTENT_UNDEFINED = 3145986,
STARTSESSIONKEYREFRESH_NULLPARAM = 3145987,
STARTSESSIONKEYREFRESH_INVALIDSIZE = 3145988,
FINISHSESSIONKEYREFRESH_NULLPARAM = 3145989,
GETENCRYPTIONBLTKEY_NULLPARAM = 3145990,
GETENCRYPTIONBLTKEY_INVALIDSIZE = 3145991,
GETCONTENTPROTECTIONCAPS_NULLPARAM = 3145992,
CHECKCRYPTOKEYEXCHANGE_NULLPARAM = 3145993,
CHECKCRYPTOKEYEXCHANGE_INVALIDINDEX = 3145994,
CREATEAUTHENTICATEDCHANNEL_NULLPARAM = 3145995,
CREATEAUTHENTICATEDCHANNEL_UNSUPPORTED = 3145996,
CREATEAUTHENTICATEDCHANNEL_INVALIDTYPE = 3145997,
CREATEAUTHENTICATEDCHANNEL_OUTOFMEMORY_RETURN = 3145998,
GETAUTHENTICATEDCHANNELCERTIFICATESIZE_INVALIDCHANNEL = 3145999,
GETAUTHENTICATEDCHANNELCERTIFICATESIZE_NULLPARAM = 3146000,
GETAUTHENTICATEDCHANNELCERTIFICATE_INVALIDCHANNEL = 3146001,
GETAUTHENTICATEDCHANNELCERTIFICATE_NULLPARAM = 3146002,
GETAUTHENTICATEDCHANNELCERTIFICATE_WRONGSIZE = 3146003,
NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_INVALIDCHANNEL = 3146004,
NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_NULLPARAM = 3146005,
QUERYAUTHENTICATEDCHANNEL_NULLPARAM = 3146006,
QUERYAUTHENTICATEDCHANNEL_WRONGCHANNEL = 3146007,
QUERYAUTHENTICATEDCHANNEL_UNSUPPORTEDQUERY = 3146008,
QUERYAUTHENTICATEDCHANNEL_WRONGSIZE = 3146009,
QUERYAUTHENTICATEDCHANNEL_INVALIDPROCESSINDEX = 3146010,
CONFIGUREAUTHENTICATEDCHANNEL_NULLPARAM = 3146011,
CONFIGUREAUTHENTICATEDCHANNEL_WRONGCHANNEL = 3146012,
CONFIGUREAUTHENTICATEDCHANNEL_UNSUPPORTEDCONFIGURE = 3146013,
CONFIGUREAUTHENTICATEDCHANNEL_WRONGSIZE = 3146014,
CONFIGUREAUTHENTICATEDCHANNEL_INVALIDPROCESSIDTYPE = 3146015,
VSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146016,
DSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146017,
HSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146018,
GSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146019,
PSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146020,
CSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = 3146021,
NEGOTIATECRPYTOSESSIONKEYEXCHANGE_INVALIDSIZE = 3146022,
NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_INVALIDSIZE = 3146023,
OFFERRESOURCES_INVALIDPRIORITY = 3146024,
GETCRYPTOSESSIONHANDLE_OUTOFMEMORY = 3146025,
ACQUIREHANDLEFORCAPTURE_NULLPARAM = 3146026,
ACQUIREHANDLEFORCAPTURE_INVALIDTYPE = 3146027,
ACQUIREHANDLEFORCAPTURE_INVALIDBIND = 3146028,
ACQUIREHANDLEFORCAPTURE_INVALIDARRAY = 3146029,
VIDEOPROCESSORSETSTREAMROTATION_NULLPARAM = 3146030,
VIDEOPROCESSORSETSTREAMROTATION_INVALIDSTREAM = 3146031,
VIDEOPROCESSORSETSTREAMROTATION_INVALID = 3146032,
VIDEOPROCESSORSETSTREAMROTATION_UNSUPPORTED = 3146033,
VIDEOPROCESSORGETSTREAMROTATION_NULLPARAM = 3146034,
DEVICE_CLEARVIEW_INVALIDVIEW = 3146035,
DEVICE_CREATEVERTEXSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146036,
DEVICE_CREATEVERTEXSHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146037,
DEVICE_CREATEHULLSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146038,
DEVICE_CREATEHULLSHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146039,
DEVICE_CREATEDOMAINSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146040,
DEVICE_CREATEDOMAINSHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146041,
DEVICE_CREATEGEOMETRYSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146042,
DEVICE_CREATEGEOMETRYSHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146043,
DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEEXTENSIONSNOTSUPPORTED = 3146044,
DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_SHADEREXTENSIONSNOTSUPPORTED = 3146045,
DEVICE_CREATEPIXELSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146046,
DEVICE_CREATEPIXELSHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146047,
DEVICE_CREATECOMPUTESHADER_DOUBLEEXTENSIONSNOTSUPPORTED = 3146048,
DEVICE_CREATECOMPUTESHADER_SHADEREXTENSIONSNOTSUPPORTED = 3146049,
DEVICE_SHADER_LINKAGE_MINPRECISION = 3146050,
VIDEOPROCESSORSETSTREAMALPHA_UNSUPPORTED = 3146051,
VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_UNSUPPORTED = 3146052,
DEVICE_CREATEVERTEXSHADER_UAVSNOTSUPPORTED = 3146053,
DEVICE_CREATEHULLSHADER_UAVSNOTSUPPORTED = 3146054,
DEVICE_CREATEDOMAINSHADER_UAVSNOTSUPPORTED = 3146055,
DEVICE_CREATEGEOMETRYSHADER_UAVSNOTSUPPORTED = 3146056,
DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UAVSNOTSUPPORTED = 3146057,
DEVICE_CREATEPIXELSHADER_UAVSNOTSUPPORTED = 3146058,
DEVICE_CREATECOMPUTESHADER_UAVSNOTSUPPORTED = 3146059,
DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_INVALIDOFFSET = 3146060,
DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_TOOMANYVIEWS = 3146061,
DEVICE_CLEARVIEW_NOTSUPPORTED = 3146062,
SWAPDEVICECONTEXTSTATE_NOTSUPPORTED = 3146063,
UPDATESUBRESOURCE_PREFERUPDATESUBRESOURCE1 = 3146064,
GETDC_INACCESSIBLE = 3146065,
DEVICE_CLEARVIEW_INVALIDRECT = 3146066,
DEVICE_DRAW_SAMPLE_MASK_IGNORED_ON_FL9 = 3146067,
DEVICE_OPEN_SHARED_RESOURCE1_NOT_SUPPORTED = 3146068,
DEVICE_OPEN_SHARED_RESOURCE_BY_NAME_NOT_SUPPORTED = 3146069,
ENQUEUESETEVENT_NOT_SUPPORTED = 3146070,
OFFERRELEASE_NOT_SUPPORTED = 3146071,
OFFERRESOURCES_INACCESSIBLE = 3146072,
CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMSAA = 3146073,
CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDMSAA = 3146074,
DEVICE_CLEARVIEW_INVALIDSOURCERECT = 3146075,
DEVICE_CLEARVIEW_EMPTYRECT = 3146076,
UPDATESUBRESOURCE_EMPTYDESTBOX = 3146077,
COPYSUBRESOURCEREGION_EMPTYSOURCEBOX = 3146078,
DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_LOGIC_OPS = 3146079,
DEVICE_DRAW_DEPTHSTENCILVIEW_NOT_SET = 3146080,
DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET = 3146081,
DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = 3146082,
DEVICE_UNORDEREDACCESSVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = 3146083,
GETDATAFORNEWHARDWAREKEY_NULLPARAM = 3146084,
CHECKCRYPTOSESSIONSTATUS_NULLPARAM = 3146085,
GETCRYPTOSESSIONPRIVATEDATASIZE_NULLPARAM = 3146086,
GETVIDEODECODERCAPS_NULLPARAM = 3146087,
GETVIDEODECODERCAPS_ZEROWIDTHHEIGHT = 3146088,
CHECKVIDEODECODERDOWNSAMPLING_NULLPARAM = 3146089,
CHECKVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = 3146090,
CHECKVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = 3146091,
VIDEODECODERENABLEDOWNSAMPLING_NULLPARAM = 3146092,
VIDEODECODERENABLEDOWNSAMPLING_UNSUPPORTED = 3146093,
VIDEODECODERUPDATEDOWNSAMPLING_NULLPARAM = 3146094,
VIDEODECODERUPDATEDOWNSAMPLING_UNSUPPORTED = 3146095,
CHECKVIDEOPROCESSORFORMATCONVERSION_NULLPARAM = 3146096,
VIDEOPROCESSORSETOUTPUTCOLORSPACE1_NULLPARAM = 3146097,
VIDEOPROCESSORGETOUTPUTCOLORSPACE1_NULLPARAM = 3146098,
VIDEOPROCESSORSETSTREAMCOLORSPACE1_NULLPARAM = 3146099,
VIDEOPROCESSORSETSTREAMCOLORSPACE1_INVALIDSTREAM = 3146100,
VIDEOPROCESSORSETSTREAMMIRROR_NULLPARAM = 3146101,
VIDEOPROCESSORSETSTREAMMIRROR_INVALIDSTREAM = 3146102,
VIDEOPROCESSORSETSTREAMMIRROR_UNSUPPORTED = 3146103,
VIDEOPROCESSORGETSTREAMCOLORSPACE1_NULLPARAM = 3146104,
VIDEOPROCESSORGETSTREAMMIRROR_NULLPARAM = 3146105,
RECOMMENDVIDEODECODERDOWNSAMPLING_NULLPARAM = 3146106,
RECOMMENDVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = 3146107,
RECOMMENDVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = 3146108,
VIDEOPROCESSORSETOUTPUTSHADERUSAGE_NULLPARAM = 3146109,
VIDEOPROCESSORGETOUTPUTSHADERUSAGE_NULLPARAM = 3146110,
VIDEOPROCESSORGETBEHAVIORHINTS_NULLPARAM = 3146111,
VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSTREAMCOUNT = 3146112,
VIDEOPROCESSORGETBEHAVIORHINTS_TARGETRECT = 3146113,
VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSOURCERECT = 3146114,
VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDDESTRECT = 3146115,
GETCRYPTOSESSIONPRIVATEDATASIZE_INVALID_KEY_EXCHANGE_TYPE = 3146116,
D3D11_1_MESSAGES_END = 3146117,
D3D11_2_MESSAGES_START = 3146118,
CREATEBUFFER_INVALIDUSAGE = 3146119,
CREATETEXTURE1D_INVALIDUSAGE = 3146120,
CREATETEXTURE2D_INVALIDUSAGE = 3146121,
CREATEINPUTLAYOUT_LEVEL9_STEPRATE_NOT_1 = 3146122,
CREATEINPUTLAYOUT_LEVEL9_INSTANCING_NOT_SUPPORTED = 3146123,
UPDATETILEMAPPINGS_INVALID_PARAMETER = 3146124,
COPYTILEMAPPINGS_INVALID_PARAMETER = 3146125,
COPYTILES_INVALID_PARAMETER = 3146126,
UPDATETILES_INVALID_PARAMETER = 3146127,
RESIZETILEPOOL_INVALID_PARAMETER = 3146128,
TILEDRESOURCEBARRIER_INVALID_PARAMETER = 3146129,
NULL_TILE_MAPPING_ACCESS_WARNING = 3146130,
NULL_TILE_MAPPING_ACCESS_ERROR = 3146131,
DIRTY_TILE_MAPPING_ACCESS = 3146132,
DUPLICATE_TILE_MAPPINGS_IN_COVERED_AREA = 3146133,
TILE_MAPPINGS_IN_COVERED_AREA_DUPLICATED_OUTSIDE = 3146134,
TILE_MAPPINGS_SHARED_BETWEEN_INCOMPATIBLE_RESOURCES = 3146135,
TILE_MAPPINGS_SHARED_BETWEEN_INPUT_AND_OUTPUT = 3146136,
CHECKMULTISAMPLEQUALITYLEVELS_INVALIDFLAGS = 3146137,
GETRESOURCETILING_NONTILED_RESOURCE = 3146138,
RESIZETILEPOOL_SHRINK_WITH_MAPPINGS_STILL_DEFINED_PAST_END = 3146139,
NEED_TO_CALL_TILEDRESOURCEBARRIER = 3146140,
CREATEDEVICE_INVALIDARGS = 3146141,
CREATEDEVICE_WARNING = 3146142,
CLEARUNORDEREDACCESSVIEWUINT_HAZARD = 3146143,
CLEARUNORDEREDACCESSVIEWFLOAT_HAZARD = 3146144,
TILED_RESOURCE_TIER_1_BUFFER_TEXTURE_MISMATCH = 3146145,
CREATE_CRYPTOSESSION = 3146146,
CREATE_AUTHENTICATEDCHANNEL = 3146147,
LIVE_CRYPTOSESSION = 3146148,
LIVE_AUTHENTICATEDCHANNEL = 3146149,
DESTROY_CRYPTOSESSION = 3146150,
DESTROY_AUTHENTICATEDCHANNEL = 3146151,
D3D11_2_MESSAGES_END = 3146152,
D3D11_3_MESSAGES_START = 3146153,
CREATERASTERIZERSTATE_INVALID_CONSERVATIVERASTERMODE = 3146154,
DEVICE_DRAW_INVALID_SYSTEMVALUE = 3146155,
CREATEQUERYORPREDICATE_INVALIDCONTEXTTYPE = 3146156,
CREATEQUERYORPREDICATE_DECODENOTSUPPORTED = 3146157,
CREATEQUERYORPREDICATE_ENCODENOTSUPPORTED = 3146158,
CREATESHADERRESOURCEVIEW_INVALIDPLANEINDEX = 3146159,
CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANEINDEX = 3146160,
CREATESHADERRESOURCEVIEW_AMBIGUOUSVIDEOPLANEINDEX = 3146161,
CREATERENDERTARGETVIEW_INVALIDPLANEINDEX = 3146162,
CREATERENDERTARGETVIEW_INVALIDVIDEOPLANEINDEX = 3146163,
CREATERENDERTARGETVIEW_AMBIGUOUSVIDEOPLANEINDEX = 3146164,
CREATEUNORDEREDACCESSVIEW_INVALIDPLANEINDEX = 3146165,
CREATEUNORDEREDACCESSVIEW_INVALIDVIDEOPLANEINDEX = 3146166,
CREATEUNORDEREDACCESSVIEW_AMBIGUOUSVIDEOPLANEINDEX = 3146167,
JPEGDECODE_INVALIDSCANDATAOFFSET = 3146168,
JPEGDECODE_NOTSUPPORTED = 3146169,
JPEGDECODE_DIMENSIONSTOOLARGE = 3146170,
JPEGDECODE_INVALIDCOMPONENTS = 3146171,
JPEGDECODE_DESTINATIONNOT2D = 3146172,
JPEGDECODE_TILEDRESOURCESUNSUPPORTED = 3146173,
JPEGDECODE_GUARDRECTSUNSUPPORTED = 3146174,
JPEGDECODE_FORMATUNSUPPORTED = 3146175,
JPEGDECODE_INVALIDSUBRESOURCE = 3146176,
JPEGDECODE_INVALIDMIPLEVEL = 3146177,
JPEGDECODE_EMPTYDESTBOX = 3146178,
JPEGDECODE_DESTBOXNOT2D = 3146179,
JPEGDECODE_DESTBOXNOTSUB = 3146180,
JPEGDECODE_DESTBOXESINTERSECT = 3146181,
JPEGDECODE_XSUBSAMPLEMISMATCH = 3146182,
JPEGDECODE_YSUBSAMPLEMISMATCH = 3146183,
JPEGDECODE_XSUBSAMPLEODD = 3146184,
JPEGDECODE_YSUBSAMPLEODD = 3146185,
JPEGDECODE_OUTPUTDIMENSIONSTOOLARGE = 3146186,
JPEGDECODE_NONPOW2SCALEUNSUPPORTED = 3146187,
JPEGDECODE_FRACTIONALDOWNSCALETOLARGE = 3146188,
JPEGDECODE_CHROMASIZEMISMATCH = 3146189,
JPEGDECODE_LUMACHROMASIZEMISMATCH = 3146190,
JPEGDECODE_INVALIDNUMDESTINATIONS = 3146191,
JPEGDECODE_SUBBOXUNSUPPORTED = 3146192,
JPEGDECODE_1DESTUNSUPPORTEDFORMAT = 3146193,
JPEGDECODE_3DESTUNSUPPORTEDFORMAT = 3146194,
JPEGDECODE_SCALEUNSUPPORTED = 3146195,
JPEGDECODE_INVALIDSOURCESIZE = 3146196,
JPEGDECODE_INVALIDCOPYFLAGS = 3146197,
JPEGDECODE_HAZARD = 3146198,
JPEGDECODE_UNSUPPORTEDSRCBUFFERUSAGE = 3146199,
JPEGDECODE_UNSUPPORTEDSRCBUFFERMISCFLAGS = 3146200,
JPEGDECODE_UNSUPPORTEDDSTTEXTUREUSAGE = 3146201,
JPEGDECODE_BACKBUFFERNOTSUPPORTED = 3146202,
JPEGDECODE_UNSUPPRTEDCOPYFLAGS = 3146203,
JPEGENCODE_NOTSUPPORTED = 3146204,
JPEGENCODE_INVALIDSCANDATAOFFSET = 3146205,
JPEGENCODE_INVALIDCOMPONENTS = 3146206,
JPEGENCODE_SOURCENOT2D = 3146207,
JPEGENCODE_TILEDRESOURCESUNSUPPORTED = 3146208,
JPEGENCODE_GUARDRECTSUNSUPPORTED = 3146209,
JPEGENCODE_XSUBSAMPLEMISMATCH = 3146210,
JPEGENCODE_YSUBSAMPLEMISMATCH = 3146211,
JPEGENCODE_FORMATUNSUPPORTED = 3146212,
JPEGENCODE_INVALIDSUBRESOURCE = 3146213,
JPEGENCODE_INVALIDMIPLEVEL = 3146214,
JPEGENCODE_DIMENSIONSTOOLARGE = 3146215,
JPEGENCODE_HAZARD = 3146216,
JPEGENCODE_UNSUPPORTEDDSTBUFFERUSAGE = 3146217,
JPEGENCODE_UNSUPPORTEDDSTBUFFERMISCFLAGS = 3146218,
JPEGENCODE_UNSUPPORTEDSRCTEXTUREUSAGE = 3146219,
JPEGENCODE_BACKBUFFERNOTSUPPORTED = 3146220,
CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTTYPEFORQUERY = 3146221,
FLUSH1_INVALIDCONTEXTTYPE = 3146222,
DEVICE_SETHARDWAREPROTECTION_INVALIDCONTEXT = 3146223,
VIDEOPROCESSORSETOUTPUTHDRMETADATA_NULLPARAM = 3146224,
VIDEOPROCESSORSETOUTPUTHDRMETADATA_INVALIDSIZE = 3146225,
VIDEOPROCESSORGETOUTPUTHDRMETADATA_NULLPARAM = 3146226,
VIDEOPROCESSORGETOUTPUTHDRMETADATA_INVALIDSIZE = 3146227,
VIDEOPROCESSORSETSTREAMHDRMETADATA_NULLPARAM = 3146228,
VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSTREAM = 3146229,
VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSIZE = 3146230,
VIDEOPROCESSORGETSTREAMHDRMETADATA_NULLPARAM = 3146231,
VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSTREAM = 3146232,
VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSIZE = 3146233,
VIDEOPROCESSORGETSTREAMFRAMEFORMAT_INVALIDSTREAM = 3146234,
VIDEOPROCESSORGETSTREAMCOLORSPACE_INVALIDSTREAM = 3146235,
VIDEOPROCESSORGETSTREAMOUTPUTRATE_INVALIDSTREAM = 3146236,
VIDEOPROCESSORGETSTREAMSOURCERECT_INVALIDSTREAM = 3146237,
VIDEOPROCESSORGETSTREAMDESTRECT_INVALIDSTREAM = 3146238,
VIDEOPROCESSORGETSTREAMALPHA_INVALIDSTREAM = 3146239,
VIDEOPROCESSORGETSTREAMPALETTE_INVALIDSTREAM = 3146240,
VIDEOPROCESSORGETSTREAMPIXELASPECTRATIO_INVALIDSTREAM = 3146241,
VIDEOPROCESSORGETSTREAMLUMAKEY_INVALIDSTREAM = 3146242,
VIDEOPROCESSORGETSTREAMSTEREOFORMAT_INVALIDSTREAM = 3146243,
VIDEOPROCESSORGETSTREAMAUTOPROCESSINGMODE_INVALIDSTREAM = 3146244,
VIDEOPROCESSORGETSTREAMFILTER_INVALIDSTREAM = 3146245,
VIDEOPROCESSORGETSTREAMROTATION_INVALIDSTREAM = 3146246,
VIDEOPROCESSORGETSTREAMCOLORSPACE1_INVALIDSTREAM = 3146247,
VIDEOPROCESSORGETSTREAMMIRROR_INVALIDSTREAM = 3146248,
CREATE_FENCE = 3146249,
LIVE_FENCE = 3146250,
DESTROY_FENCE = 3146251,
CREATE_SYNCHRONIZEDCHANNEL = 3146252,
LIVE_SYNCHRONIZEDCHANNEL = 3146253,
DESTROY_SYNCHRONIZEDCHANNEL = 3146254,
CREATEFENCE_INVALIDFLAGS = 3146255,
D3D11_3_MESSAGES_END = 3146256,
D3D11_5_MESSAGES_START = 3146257,
NEGOTIATECRYPTOSESSIONKEYEXCHANGEMT_INVALIDKEYEXCHANGETYPE = 3146258,
NEGOTIATECRYPTOSESSIONKEYEXCHANGEMT_NOT_SUPPORTED = 3146259,
DECODERBEGINFRAME_INVALID_HISTOGRAM_COMPONENT_COUNT = 3146260,
DECODERBEGINFRAME_INVALID_HISTOGRAM_COMPONENT = 3146261,
DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_SIZE = 3146262,
DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_USAGE = 3146263,
DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_MISC_FLAGS = 3146264,
DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_OFFSET = 3146265,
CREATE_TRACKEDWORKLOAD = 3146266,
LIVE_TRACKEDWORKLOAD = 3146267,
DESTROY_TRACKEDWORKLOAD = 3146268,
CREATE_TRACKED_WORKLOAD_NULLPARAM = 3146269,
CREATE_TRACKED_WORKLOAD_INVALID_MAX_INSTANCES = 3146270,
CREATE_TRACKED_WORKLOAD_INVALID_DEADLINE_TYPE = 3146271,
CREATE_TRACKED_WORKLOAD_INVALID_ENGINE_TYPE = 3146272,
MULTIPLE_TRACKED_WORKLOADS = 3146273,
MULTIPLE_TRACKED_WORKLOAD_PAIRS = 3146274,
INCOMPLETE_TRACKED_WORKLOAD_PAIR = 3146275,
OUT_OF_ORDER_TRACKED_WORKLOAD_PAIR = 3146276,
CANNOT_ADD_TRACKED_WORKLOAD = 3146277,
TRACKED_WORKLOAD_NOT_SUPPORTED = 3146278,
TRACKED_WORKLOAD_ENGINE_TYPE_NOT_FOUND = 3146279,
NO_TRACKED_WORKLOAD_SLOT_AVAILABLE = 3146280,
END_TRACKED_WORKLOAD_INVALID_ARG = 3146281,
TRACKED_WORKLOAD_DISJOINT_FAILURE = 3146282,
D3D11_5_MESSAGES_END = 3146283,
};
pub const D3D11_MESSAGE_ID_UNKNOWN = D3D11_MESSAGE_ID.UNKNOWN;
pub const D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_HAZARD = D3D11_MESSAGE_ID.DEVICE_IASETVERTEXBUFFERS_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_HAZARD = D3D11_MESSAGE_ID.DEVICE_IASETINDEXBUFFER_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_HAZARD = D3D11_MESSAGE_ID.DEVICE_VSSETSHADERRESOURCES_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_HAZARD = D3D11_MESSAGE_ID.DEVICE_VSSETCONSTANTBUFFERS_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_HAZARD = D3D11_MESSAGE_ID.DEVICE_GSSETSHADERRESOURCES_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_HAZARD = D3D11_MESSAGE_ID.DEVICE_GSSETCONSTANTBUFFERS_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_HAZARD = D3D11_MESSAGE_ID.DEVICE_PSSETSHADERRESOURCES_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_HAZARD = D3D11_MESSAGE_ID.DEVICE_PSSETCONSTANTBUFFERS_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETS_HAZARD = D3D11_MESSAGE_ID.DEVICE_OMSETRENDERTARGETS_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_SOSETTARGETS_HAZARD = D3D11_MESSAGE_ID.DEVICE_SOSETTARGETS_HAZARD;
pub const D3D11_MESSAGE_ID_STRING_FROM_APPLICATION = D3D11_MESSAGE_ID.STRING_FROM_APPLICATION;
pub const D3D11_MESSAGE_ID_CORRUPTED_THIS = D3D11_MESSAGE_ID.CORRUPTED_THIS;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER1 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER1;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER2 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER2;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER3 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER3;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER4 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER4;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER5 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER5;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER6 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER6;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER7 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER7;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER8 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER8;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER9 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER9;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER10 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER10;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER11 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER11;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER12 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER12;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER13 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER13;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER14 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER14;
pub const D3D11_MESSAGE_ID_CORRUPTED_PARAMETER15 = D3D11_MESSAGE_ID.CORRUPTED_PARAMETER15;
pub const D3D11_MESSAGE_ID_CORRUPTED_MULTITHREADING = D3D11_MESSAGE_ID.CORRUPTED_MULTITHREADING;
pub const D3D11_MESSAGE_ID_MESSAGE_REPORTING_OUTOFMEMORY = D3D11_MESSAGE_ID.MESSAGE_REPORTING_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_IASETINPUTLAYOUT_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.IASETINPUTLAYOUT_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.IASETVERTEXBUFFERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_IASETINDEXBUFFER_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.IASETINDEXBUFFER_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_VSSETSHADER_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.VSSETSHADER_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.VSSETSHADERRESOURCES_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.VSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_VSSETSAMPLERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.VSSETSAMPLERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_GSSETSHADER_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.GSSETSHADER_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.GSSETSHADERRESOURCES_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.GSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_GSSETSAMPLERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.GSSETSAMPLERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_SOSETTARGETS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.SOSETTARGETS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_PSSETSHADER_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.PSSETSHADER_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.PSSETSHADERRESOURCES_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.PSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_PSSETSAMPLERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.PSSETSAMPLERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_RSSETSTATE_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.RSSETSTATE_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_OMSETBLENDSTATE_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.OMSETBLENDSTATE_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.OMSETDEPTHSTENCILSTATE_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_OMSETRENDERTARGETS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.OMSETRENDERTARGETS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_SETPREDICATION_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.SETPREDICATION_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_GETPRIVATEDATA_MOREDATA = D3D11_MESSAGE_ID.GETPRIVATEDATA_MOREDATA;
pub const D3D11_MESSAGE_ID_SETPRIVATEDATA_INVALIDFREEDATA = D3D11_MESSAGE_ID.SETPRIVATEDATA_INVALIDFREEDATA;
pub const D3D11_MESSAGE_ID_SETPRIVATEDATA_INVALIDIUNKNOWN = D3D11_MESSAGE_ID.SETPRIVATEDATA_INVALIDIUNKNOWN;
pub const D3D11_MESSAGE_ID_SETPRIVATEDATA_INVALIDFLAGS = D3D11_MESSAGE_ID.SETPRIVATEDATA_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_SETPRIVATEDATA_CHANGINGPARAMS = D3D11_MESSAGE_ID.SETPRIVATEDATA_CHANGINGPARAMS;
pub const D3D11_MESSAGE_ID_SETPRIVATEDATA_OUTOFMEMORY = D3D11_MESSAGE_ID.SETPRIVATEDATA_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDFORMAT = D3D11_MESSAGE_ID.CREATEBUFFER_UNRECOGNIZEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDSAMPLES = D3D11_MESSAGE_ID.CREATEBUFFER_INVALIDSAMPLES;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDUSAGE = D3D11_MESSAGE_ID.CREATEBUFFER_UNRECOGNIZEDUSAGE;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDBINDFLAGS = D3D11_MESSAGE_ID.CREATEBUFFER_UNRECOGNIZEDBINDFLAGS;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS = D3D11_MESSAGE_ID.CREATEBUFFER_UNRECOGNIZEDCPUACCESSFLAGS;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_UNRECOGNIZEDMISCFLAGS = D3D11_MESSAGE_ID.CREATEBUFFER_UNRECOGNIZEDMISCFLAGS;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDCPUACCESSFLAGS = D3D11_MESSAGE_ID.CREATEBUFFER_INVALIDCPUACCESSFLAGS;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDBINDFLAGS = D3D11_MESSAGE_ID.CREATEBUFFER_INVALIDBINDFLAGS;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDINITIALDATA = D3D11_MESSAGE_ID.CREATEBUFFER_INVALIDINITIALDATA;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDDIMENSIONS = D3D11_MESSAGE_ID.CREATEBUFFER_INVALIDDIMENSIONS;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDMIPLEVELS = D3D11_MESSAGE_ID.CREATEBUFFER_INVALIDMIPLEVELS;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDMISCFLAGS = D3D11_MESSAGE_ID.CREATEBUFFER_INVALIDMISCFLAGS;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDARG_RETURN = D3D11_MESSAGE_ID.CREATEBUFFER_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEBUFFER_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_NULLDESC = D3D11_MESSAGE_ID.CREATEBUFFER_NULLDESC;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS = D3D11_MESSAGE_ID.CREATEBUFFER_INVALIDCONSTANTBUFFERBINDINGS;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_LARGEALLOCATION = D3D11_MESSAGE_ID.CREATEBUFFER_LARGEALLOCATION;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDFORMAT = D3D11_MESSAGE_ID.CREATETEXTURE1D_UNRECOGNIZEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_UNSUPPORTEDFORMAT = D3D11_MESSAGE_ID.CREATETEXTURE1D_UNSUPPORTEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDSAMPLES = D3D11_MESSAGE_ID.CREATETEXTURE1D_INVALIDSAMPLES;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDUSAGE = D3D11_MESSAGE_ID.CREATETEXTURE1D_UNRECOGNIZEDUSAGE;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE1D_UNRECOGNIZEDBINDFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE1D_UNRECOGNIZEDCPUACCESSFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE1D_UNRECOGNIZEDMISCFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDCPUACCESSFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE1D_INVALIDCPUACCESSFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDBINDFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE1D_INVALIDBINDFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDINITIALDATA = D3D11_MESSAGE_ID.CREATETEXTURE1D_INVALIDINITIALDATA;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDDIMENSIONS = D3D11_MESSAGE_ID.CREATETEXTURE1D_INVALIDDIMENSIONS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDMIPLEVELS = D3D11_MESSAGE_ID.CREATETEXTURE1D_INVALIDMIPLEVELS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDMISCFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE1D_INVALIDMISCFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDARG_RETURN = D3D11_MESSAGE_ID.CREATETEXTURE1D_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATETEXTURE1D_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_NULLDESC = D3D11_MESSAGE_ID.CREATETEXTURE1D_NULLDESC;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_LARGEALLOCATION = D3D11_MESSAGE_ID.CREATETEXTURE1D_LARGEALLOCATION;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDFORMAT = D3D11_MESSAGE_ID.CREATETEXTURE2D_UNRECOGNIZEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_UNSUPPORTEDFORMAT = D3D11_MESSAGE_ID.CREATETEXTURE2D_UNSUPPORTEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDSAMPLES = D3D11_MESSAGE_ID.CREATETEXTURE2D_INVALIDSAMPLES;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDUSAGE = D3D11_MESSAGE_ID.CREATETEXTURE2D_UNRECOGNIZEDUSAGE;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE2D_UNRECOGNIZEDBINDFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE2D_UNRECOGNIZEDCPUACCESSFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE2D_UNRECOGNIZEDMISCFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDCPUACCESSFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE2D_INVALIDCPUACCESSFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDBINDFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE2D_INVALIDBINDFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDINITIALDATA = D3D11_MESSAGE_ID.CREATETEXTURE2D_INVALIDINITIALDATA;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDDIMENSIONS = D3D11_MESSAGE_ID.CREATETEXTURE2D_INVALIDDIMENSIONS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDMIPLEVELS = D3D11_MESSAGE_ID.CREATETEXTURE2D_INVALIDMIPLEVELS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDMISCFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE2D_INVALIDMISCFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDARG_RETURN = D3D11_MESSAGE_ID.CREATETEXTURE2D_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATETEXTURE2D_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_NULLDESC = D3D11_MESSAGE_ID.CREATETEXTURE2D_NULLDESC;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_LARGEALLOCATION = D3D11_MESSAGE_ID.CREATETEXTURE2D_LARGEALLOCATION;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDFORMAT = D3D11_MESSAGE_ID.CREATETEXTURE3D_UNRECOGNIZEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_UNSUPPORTEDFORMAT = D3D11_MESSAGE_ID.CREATETEXTURE3D_UNSUPPORTEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDSAMPLES = D3D11_MESSAGE_ID.CREATETEXTURE3D_INVALIDSAMPLES;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDUSAGE = D3D11_MESSAGE_ID.CREATETEXTURE3D_UNRECOGNIZEDUSAGE;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE3D_UNRECOGNIZEDBINDFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE3D_UNRECOGNIZEDCPUACCESSFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE3D_UNRECOGNIZEDMISCFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDCPUACCESSFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE3D_INVALIDCPUACCESSFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDBINDFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE3D_INVALIDBINDFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDINITIALDATA = D3D11_MESSAGE_ID.CREATETEXTURE3D_INVALIDINITIALDATA;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDDIMENSIONS = D3D11_MESSAGE_ID.CREATETEXTURE3D_INVALIDDIMENSIONS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDMIPLEVELS = D3D11_MESSAGE_ID.CREATETEXTURE3D_INVALIDMIPLEVELS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDMISCFLAGS = D3D11_MESSAGE_ID.CREATETEXTURE3D_INVALIDMISCFLAGS;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_INVALIDARG_RETURN = D3D11_MESSAGE_ID.CREATETEXTURE3D_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATETEXTURE3D_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_NULLDESC = D3D11_MESSAGE_ID.CREATETEXTURE3D_NULLDESC;
pub const D3D11_MESSAGE_ID_CREATETEXTURE3D_LARGEALLOCATION = D3D11_MESSAGE_ID.CREATETEXTURE3D_LARGEALLOCATION;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_UNRECOGNIZEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDESC = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDDESC;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFORMAT = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDFORMAT;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDRESOURCE = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDRESOURCE;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_TOOMANYOBJECTS;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_UNRECOGNIZEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_UNSUPPORTEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDESC = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDDESC;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDFORMAT = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDFORMAT;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDIMENSIONS = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDDIMENSIONS;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDRESOURCE = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDRESOURCE;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_TOOMANYOBJECTS = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_TOOMANYOBJECTS;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDARG_RETURN = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_UNRECOGNIZEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDESC = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_INVALIDDESC;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFORMAT = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_INVALIDFORMAT;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_INVALIDDIMENSIONS;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_INVALIDRESOURCE;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_TOOMANYOBJECTS;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_OUTOFMEMORY = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_TOOMANYELEMENTS = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_TOOMANYELEMENTS;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDFORMAT = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDFORMAT;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_INCOMPATIBLEFORMAT;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOT = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDSLOT;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDINPUTSLOTCLASS;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_STEPRATESLOTCLASSMISMATCH;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDSLOTCLASSCHANGE;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDSTEPRATECHANGE;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_INVALIDALIGNMENT = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_INVALIDALIGNMENT;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_DUPLICATESEMANTIC = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_DUPLICATESEMANTIC;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_UNPARSEABLEINPUTSIGNATURE;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_NULLSEMANTIC = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_NULLSEMANTIC;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_MISSINGELEMENT = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_MISSINGELEMENT;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_NULLDESC = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_NULLDESC;
pub const D3D11_MESSAGE_ID_CREATEVERTEXSHADER_OUTOFMEMORY = D3D11_MESSAGE_ID.CREATEVERTEXSHADER_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERBYTECODE = D3D11_MESSAGE_ID.CREATEVERTEXSHADER_INVALIDSHADERBYTECODE;
pub const D3D11_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDSHADERTYPE = D3D11_MESSAGE_ID.CREATEVERTEXSHADER_INVALIDSHADERTYPE;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_OUTOFMEMORY = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADER_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADER_INVALIDSHADERBYTECODE;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDSHADERTYPE = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADER_INVALIDSHADERTYPE;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERBYTECODE;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSHADERTYPE;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMENTRIES;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSTREAMSTRIDEUNUSED;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDDECL;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_EXPECTEDDECL;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_OUTPUTSLOT0EXPECTED;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSLOT;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_ONLYONEELEMENTPERSLOT;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCOMPONENTCOUNT;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTARTCOMPONENTANDCOMPONENTCOUNT;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDGAPDEFINITION;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_REPEATEDOUTPUT;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDOUTPUTSTREAMSTRIDE;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGSEMANTIC;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MASKMISMATCH;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_CANTHAVEONLYGAPS;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DECLTOOCOMPLEX;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_MISSINGOUTPUTSIGNATURE;
pub const D3D11_MESSAGE_ID_CREATEPIXELSHADER_OUTOFMEMORY = D3D11_MESSAGE_ID.CREATEPIXELSHADER_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERBYTECODE = D3D11_MESSAGE_ID.CREATEPIXELSHADER_INVALIDSHADERBYTECODE;
pub const D3D11_MESSAGE_ID_CREATEPIXELSHADER_INVALIDSHADERTYPE = D3D11_MESSAGE_ID.CREATEPIXELSHADER_INVALIDSHADERTYPE;
pub const D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFILLMODE = D3D11_MESSAGE_ID.CREATERASTERIZERSTATE_INVALIDFILLMODE;
pub const D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDCULLMODE = D3D11_MESSAGE_ID.CREATERASTERIZERSTATE_INVALIDCULLMODE;
pub const D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP = D3D11_MESSAGE_ID.CREATERASTERIZERSTATE_INVALIDDEPTHBIASCLAMP;
pub const D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS = D3D11_MESSAGE_ID.CREATERASTERIZERSTATE_INVALIDSLOPESCALEDDEPTHBIAS;
pub const D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_TOOMANYOBJECTS = D3D11_MESSAGE_ID.CREATERASTERIZERSTATE_TOOMANYOBJECTS;
pub const D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_NULLDESC = D3D11_MESSAGE_ID.CREATERASTERIZERSTATE_NULLDESC;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDDEPTHWRITEMASK;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDDEPTHFUNC;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFAILOP;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILZFAILOP;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILPASSOP;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDFRONTFACESTENCILFUNC;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFAILOP;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILZFAILOP;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILPASSOP;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_INVALIDBACKFACESTENCILFUNC;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_TOOMANYOBJECTS;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_NULLDESC = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_NULLDESC;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLEND = D3D11_MESSAGE_ID.CREATEBLENDSTATE_INVALIDSRCBLEND;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLEND = D3D11_MESSAGE_ID.CREATEBLENDSTATE_INVALIDDESTBLEND;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOP = D3D11_MESSAGE_ID.CREATEBLENDSTATE_INVALIDBLENDOP;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDSRCBLENDALPHA = D3D11_MESSAGE_ID.CREATEBLENDSTATE_INVALIDSRCBLENDALPHA;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDDESTBLENDALPHA = D3D11_MESSAGE_ID.CREATEBLENDSTATE_INVALIDDESTBLENDALPHA;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDBLENDOPALPHA = D3D11_MESSAGE_ID.CREATEBLENDSTATE_INVALIDBLENDOPALPHA;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK = D3D11_MESSAGE_ID.CREATEBLENDSTATE_INVALIDRENDERTARGETWRITEMASK;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_TOOMANYOBJECTS = D3D11_MESSAGE_ID.CREATEBLENDSTATE_TOOMANYOBJECTS;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_NULLDESC = D3D11_MESSAGE_ID.CREATEBLENDSTATE_NULLDESC;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDFILTER = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDFILTER;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSU = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDADDRESSU;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSV = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDADDRESSV;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDADDRESSW = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDADDRESSW;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMIPLODBIAS = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDMIPLODBIAS;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXANISOTROPY = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDMAXANISOTROPY;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDCOMPARISONFUNC;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMINLOD = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDMINLOD;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_INVALIDMAXLOD = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_INVALIDMAXLOD;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_TOOMANYOBJECTS = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_TOOMANYOBJECTS;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_NULLDESC = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_NULLDESC;
pub const D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDQUERY = D3D11_MESSAGE_ID.CREATEQUERYORPREDICATE_INVALIDQUERY;
pub const D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDMISCFLAGS = D3D11_MESSAGE_ID.CREATEQUERYORPREDICATE_INVALIDMISCFLAGS;
pub const D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG = D3D11_MESSAGE_ID.CREATEQUERYORPREDICATE_UNEXPECTEDMISCFLAG;
pub const D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_NULLDESC = D3D11_MESSAGE_ID.CREATEQUERYORPREDICATE_NULLDESC;
pub const D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED = D3D11_MESSAGE_ID.DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNRECOGNIZED;
pub const D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED = D3D11_MESSAGE_ID.DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNDEFINED;
pub const D3D11_MESSAGE_ID_IASETVERTEXBUFFERS_INVALIDBUFFER = D3D11_MESSAGE_ID.IASETVERTEXBUFFERS_INVALIDBUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE = D3D11_MESSAGE_ID.DEVICE_IASETVERTEXBUFFERS_OFFSET_TOO_LARGE;
pub const D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_IASETVERTEXBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_IASETINDEXBUFFER_INVALIDBUFFER = D3D11_MESSAGE_ID.IASETINDEXBUFFER_INVALIDBUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_FORMAT_INVALID = D3D11_MESSAGE_ID.DEVICE_IASETINDEXBUFFER_FORMAT_INVALID;
pub const D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE = D3D11_MESSAGE_ID.DEVICE_IASETINDEXBUFFER_OFFSET_TOO_LARGE;
pub const D3D11_MESSAGE_ID_DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED = D3D11_MESSAGE_ID.DEVICE_IASETINDEXBUFFER_OFFSET_UNALIGNED;
pub const D3D11_MESSAGE_ID_DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_VSSETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_VSSETCONSTANTBUFFERS_INVALIDBUFFER = D3D11_MESSAGE_ID.VSSETCONSTANTBUFFERS_INVALIDBUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_VSSETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_VSSETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_GSSETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_GSSETCONSTANTBUFFERS_INVALIDBUFFER = D3D11_MESSAGE_ID.GSSETCONSTANTBUFFERS_INVALIDBUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_GSSETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_GSSETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_SOSETTARGETS_INVALIDBUFFER = D3D11_MESSAGE_ID.SOSETTARGETS_INVALIDBUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_SOSETTARGETS_OFFSET_UNALIGNED = D3D11_MESSAGE_ID.DEVICE_SOSETTARGETS_OFFSET_UNALIGNED;
pub const D3D11_MESSAGE_ID_DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_PSSETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_PSSETCONSTANTBUFFERS_INVALIDBUFFER = D3D11_MESSAGE_ID.PSSETCONSTANTBUFFERS_INVALIDBUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_PSSETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_PSSETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT = D3D11_MESSAGE_ID.DEVICE_RSSETVIEWPORTS_INVALIDVIEWPORT;
pub const D3D11_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR = D3D11_MESSAGE_ID.DEVICE_RSSETSCISSORRECTS_INVALIDSCISSOR;
pub const D3D11_MESSAGE_ID_CLEARRENDERTARGETVIEW_DENORMFLUSH = D3D11_MESSAGE_ID.CLEARRENDERTARGETVIEW_DENORMFLUSH;
pub const D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DENORMFLUSH = D3D11_MESSAGE_ID.CLEARDEPTHSTENCILVIEW_DENORMFLUSH;
pub const D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_INVALID = D3D11_MESSAGE_ID.CLEARDEPTHSTENCILVIEW_INVALID;
pub const D3D11_MESSAGE_ID_DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_IAGETVERTEXBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_VSGETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_VSGETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_VSGETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_GSGETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_GSGETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_GSGETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_SOGETTARGETS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_SOGETTARGETS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_PSGETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_PSGETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_PSGETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY = D3D11_MESSAGE_ID.DEVICE_RSGETVIEWPORTS_VIEWPORTS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY = D3D11_MESSAGE_ID.DEVICE_RSGETSCISSORRECTS_RECTS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_GENERATEMIPS_RESOURCE_INVALID = D3D11_MESSAGE_ID.DEVICE_GENERATEMIPS_RESOURCE_INVALID;
pub const D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE = D3D11_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDDESTINATIONSUBRESOURCE;
pub const D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE = D3D11_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDSOURCESUBRESOURCE;
pub const D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCEBOX = D3D11_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDSOURCEBOX;
pub const D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCE = D3D11_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDSOURCE;
pub const D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE = D3D11_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDDESTINATIONSTATE;
pub const D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_INVALIDSOURCESTATE = D3D11_MESSAGE_ID.COPYSUBRESOURCEREGION_INVALIDSOURCESTATE;
pub const D3D11_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCE = D3D11_MESSAGE_ID.COPYRESOURCE_INVALIDSOURCE;
pub const D3D11_MESSAGE_ID_COPYRESOURCE_INVALIDDESTINATIONSTATE = D3D11_MESSAGE_ID.COPYRESOURCE_INVALIDDESTINATIONSTATE;
pub const D3D11_MESSAGE_ID_COPYRESOURCE_INVALIDSOURCESTATE = D3D11_MESSAGE_ID.COPYRESOURCE_INVALIDSOURCESTATE;
pub const D3D11_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE = D3D11_MESSAGE_ID.UPDATESUBRESOURCE_INVALIDDESTINATIONSUBRESOURCE;
pub const D3D11_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONBOX = D3D11_MESSAGE_ID.UPDATESUBRESOURCE_INVALIDDESTINATIONBOX;
pub const D3D11_MESSAGE_ID_UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE = D3D11_MESSAGE_ID.UPDATESUBRESOURCE_INVALIDDESTINATIONSTATE;
pub const D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID = D3D11_MESSAGE_ID.DEVICE_RESOLVESUBRESOURCE_DESTINATION_INVALID;
pub const D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID = D3D11_MESSAGE_ID.DEVICE_RESOLVESUBRESOURCE_DESTINATION_SUBRESOURCE_INVALID;
pub const D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID = D3D11_MESSAGE_ID.DEVICE_RESOLVESUBRESOURCE_SOURCE_INVALID;
pub const D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID = D3D11_MESSAGE_ID.DEVICE_RESOLVESUBRESOURCE_SOURCE_SUBRESOURCE_INVALID;
pub const D3D11_MESSAGE_ID_DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID = D3D11_MESSAGE_ID.DEVICE_RESOLVESUBRESOURCE_FORMAT_INVALID;
pub const D3D11_MESSAGE_ID_BUFFER_MAP_INVALIDMAPTYPE = D3D11_MESSAGE_ID.BUFFER_MAP_INVALIDMAPTYPE;
pub const D3D11_MESSAGE_ID_BUFFER_MAP_INVALIDFLAGS = D3D11_MESSAGE_ID.BUFFER_MAP_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_BUFFER_MAP_ALREADYMAPPED = D3D11_MESSAGE_ID.BUFFER_MAP_ALREADYMAPPED;
pub const D3D11_MESSAGE_ID_BUFFER_MAP_DEVICEREMOVED_RETURN = D3D11_MESSAGE_ID.BUFFER_MAP_DEVICEREMOVED_RETURN;
pub const D3D11_MESSAGE_ID_BUFFER_UNMAP_NOTMAPPED = D3D11_MESSAGE_ID.BUFFER_UNMAP_NOTMAPPED;
pub const D3D11_MESSAGE_ID_TEXTURE1D_MAP_INVALIDMAPTYPE = D3D11_MESSAGE_ID.TEXTURE1D_MAP_INVALIDMAPTYPE;
pub const D3D11_MESSAGE_ID_TEXTURE1D_MAP_INVALIDSUBRESOURCE = D3D11_MESSAGE_ID.TEXTURE1D_MAP_INVALIDSUBRESOURCE;
pub const D3D11_MESSAGE_ID_TEXTURE1D_MAP_INVALIDFLAGS = D3D11_MESSAGE_ID.TEXTURE1D_MAP_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_TEXTURE1D_MAP_ALREADYMAPPED = D3D11_MESSAGE_ID.TEXTURE1D_MAP_ALREADYMAPPED;
pub const D3D11_MESSAGE_ID_TEXTURE1D_MAP_DEVICEREMOVED_RETURN = D3D11_MESSAGE_ID.TEXTURE1D_MAP_DEVICEREMOVED_RETURN;
pub const D3D11_MESSAGE_ID_TEXTURE1D_UNMAP_INVALIDSUBRESOURCE = D3D11_MESSAGE_ID.TEXTURE1D_UNMAP_INVALIDSUBRESOURCE;
pub const D3D11_MESSAGE_ID_TEXTURE1D_UNMAP_NOTMAPPED = D3D11_MESSAGE_ID.TEXTURE1D_UNMAP_NOTMAPPED;
pub const D3D11_MESSAGE_ID_TEXTURE2D_MAP_INVALIDMAPTYPE = D3D11_MESSAGE_ID.TEXTURE2D_MAP_INVALIDMAPTYPE;
pub const D3D11_MESSAGE_ID_TEXTURE2D_MAP_INVALIDSUBRESOURCE = D3D11_MESSAGE_ID.TEXTURE2D_MAP_INVALIDSUBRESOURCE;
pub const D3D11_MESSAGE_ID_TEXTURE2D_MAP_INVALIDFLAGS = D3D11_MESSAGE_ID.TEXTURE2D_MAP_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_TEXTURE2D_MAP_ALREADYMAPPED = D3D11_MESSAGE_ID.TEXTURE2D_MAP_ALREADYMAPPED;
pub const D3D11_MESSAGE_ID_TEXTURE2D_MAP_DEVICEREMOVED_RETURN = D3D11_MESSAGE_ID.TEXTURE2D_MAP_DEVICEREMOVED_RETURN;
pub const D3D11_MESSAGE_ID_TEXTURE2D_UNMAP_INVALIDSUBRESOURCE = D3D11_MESSAGE_ID.TEXTURE2D_UNMAP_INVALIDSUBRESOURCE;
pub const D3D11_MESSAGE_ID_TEXTURE2D_UNMAP_NOTMAPPED = D3D11_MESSAGE_ID.TEXTURE2D_UNMAP_NOTMAPPED;
pub const D3D11_MESSAGE_ID_TEXTURE3D_MAP_INVALIDMAPTYPE = D3D11_MESSAGE_ID.TEXTURE3D_MAP_INVALIDMAPTYPE;
pub const D3D11_MESSAGE_ID_TEXTURE3D_MAP_INVALIDSUBRESOURCE = D3D11_MESSAGE_ID.TEXTURE3D_MAP_INVALIDSUBRESOURCE;
pub const D3D11_MESSAGE_ID_TEXTURE3D_MAP_INVALIDFLAGS = D3D11_MESSAGE_ID.TEXTURE3D_MAP_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_TEXTURE3D_MAP_ALREADYMAPPED = D3D11_MESSAGE_ID.TEXTURE3D_MAP_ALREADYMAPPED;
pub const D3D11_MESSAGE_ID_TEXTURE3D_MAP_DEVICEREMOVED_RETURN = D3D11_MESSAGE_ID.TEXTURE3D_MAP_DEVICEREMOVED_RETURN;
pub const D3D11_MESSAGE_ID_TEXTURE3D_UNMAP_INVALIDSUBRESOURCE = D3D11_MESSAGE_ID.TEXTURE3D_UNMAP_INVALIDSUBRESOURCE;
pub const D3D11_MESSAGE_ID_TEXTURE3D_UNMAP_NOTMAPPED = D3D11_MESSAGE_ID.TEXTURE3D_UNMAP_NOTMAPPED;
pub const D3D11_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_DEPRECATED = D3D11_MESSAGE_ID.CHECKFORMATSUPPORT_FORMAT_DEPRECATED;
pub const D3D11_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED = D3D11_MESSAGE_ID.CHECKMULTISAMPLEQUALITYLEVELS_FORMAT_DEPRECATED;
pub const D3D11_MESSAGE_ID_SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS = D3D11_MESSAGE_ID.SETEXCEPTIONMODE_UNRECOGNIZEDFLAGS;
pub const D3D11_MESSAGE_ID_SETEXCEPTIONMODE_INVALIDARG_RETURN = D3D11_MESSAGE_ID.SETEXCEPTIONMODE_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_SETEXCEPTIONMODE_DEVICEREMOVED_RETURN = D3D11_MESSAGE_ID.SETEXCEPTIONMODE_DEVICEREMOVED_RETURN;
pub const D3D11_MESSAGE_ID_REF_SIMULATING_INFINITELY_FAST_HARDWARE = D3D11_MESSAGE_ID.REF_SIMULATING_INFINITELY_FAST_HARDWARE;
pub const D3D11_MESSAGE_ID_REF_THREADING_MODE = D3D11_MESSAGE_ID.REF_THREADING_MODE;
pub const D3D11_MESSAGE_ID_REF_UMDRIVER_EXCEPTION = D3D11_MESSAGE_ID.REF_UMDRIVER_EXCEPTION;
pub const D3D11_MESSAGE_ID_REF_KMDRIVER_EXCEPTION = D3D11_MESSAGE_ID.REF_KMDRIVER_EXCEPTION;
pub const D3D11_MESSAGE_ID_REF_HARDWARE_EXCEPTION = D3D11_MESSAGE_ID.REF_HARDWARE_EXCEPTION;
pub const D3D11_MESSAGE_ID_REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE = D3D11_MESSAGE_ID.REF_ACCESSING_INDEXABLE_TEMP_OUT_OF_RANGE;
pub const D3D11_MESSAGE_ID_REF_PROBLEM_PARSING_SHADER = D3D11_MESSAGE_ID.REF_PROBLEM_PARSING_SHADER;
pub const D3D11_MESSAGE_ID_REF_OUT_OF_MEMORY = D3D11_MESSAGE_ID.REF_OUT_OF_MEMORY;
pub const D3D11_MESSAGE_ID_REF_INFO = D3D11_MESSAGE_ID.REF_INFO;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEXPOS_OVERFLOW = D3D11_MESSAGE_ID.DEVICE_DRAW_VERTEXPOS_OVERFLOW;
pub const D3D11_MESSAGE_ID_DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW = D3D11_MESSAGE_ID.DEVICE_DRAWINDEXED_INDEXPOS_OVERFLOW;
pub const D3D11_MESSAGE_ID_DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW = D3D11_MESSAGE_ID.DEVICE_DRAWINSTANCED_VERTEXPOS_OVERFLOW;
pub const D3D11_MESSAGE_ID_DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW = D3D11_MESSAGE_ID.DEVICE_DRAWINSTANCED_INSTANCEPOS_OVERFLOW;
pub const D3D11_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW = D3D11_MESSAGE_ID.DEVICE_DRAWINDEXEDINSTANCED_INSTANCEPOS_OVERFLOW;
pub const D3D11_MESSAGE_ID_DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW = D3D11_MESSAGE_ID.DEVICE_DRAWINDEXEDINSTANCED_INDEXPOS_OVERFLOW;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_SHADER_NOT_SET = D3D11_MESSAGE_ID.DEVICE_DRAW_VERTEX_SHADER_NOT_SET;
pub const D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND = D3D11_MESSAGE_ID.DEVICE_SHADER_LINKAGE_SEMANTICNAME_NOT_FOUND;
pub const D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERINDEX = D3D11_MESSAGE_ID.DEVICE_SHADER_LINKAGE_REGISTERINDEX;
pub const D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_COMPONENTTYPE = D3D11_MESSAGE_ID.DEVICE_SHADER_LINKAGE_COMPONENTTYPE;
pub const D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_REGISTERMASK = D3D11_MESSAGE_ID.DEVICE_SHADER_LINKAGE_REGISTERMASK;
pub const D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_SYSTEMVALUE = D3D11_MESSAGE_ID.DEVICE_SHADER_LINKAGE_SYSTEMVALUE;
pub const D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS = D3D11_MESSAGE_ID.DEVICE_SHADER_LINKAGE_NEVERWRITTEN_ALWAYSREADS;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_NOT_SET = D3D11_MESSAGE_ID.DEVICE_DRAW_VERTEX_BUFFER_NOT_SET;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_INPUTLAYOUT_NOT_SET = D3D11_MESSAGE_ID.DEVICE_DRAW_INPUTLAYOUT_NOT_SET;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET = D3D11_MESSAGE_ID.DEVICE_DRAW_CONSTANT_BUFFER_NOT_SET;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL = D3D11_MESSAGE_ID.DEVICE_DRAW_CONSTANT_BUFFER_TOO_SMALL;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_SAMPLER_NOT_SET = D3D11_MESSAGE_ID.DEVICE_DRAW_SAMPLER_NOT_SET;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET = D3D11_MESSAGE_ID.DEVICE_DRAW_SHADERRESOURCEVIEW_NOT_SET;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_VIEW_DIMENSION_MISMATCH = D3D11_MESSAGE_ID.DEVICE_DRAW_VIEW_DIMENSION_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL = D3D11_MESSAGE_ID.DEVICE_DRAW_VERTEX_BUFFER_STRIDE_TOO_SMALL;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL = D3D11_MESSAGE_ID.DEVICE_DRAW_VERTEX_BUFFER_TOO_SMALL;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_NOT_SET = D3D11_MESSAGE_ID.DEVICE_DRAW_INDEX_BUFFER_NOT_SET;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID = D3D11_MESSAGE_ID.DEVICE_DRAW_INDEX_BUFFER_FORMAT_INVALID;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL = D3D11_MESSAGE_ID.DEVICE_DRAW_INDEX_BUFFER_TOO_SMALL;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH = D3D11_MESSAGE_ID.DEVICE_DRAW_GS_INPUT_PRIMITIVE_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH = D3D11_MESSAGE_ID.DEVICE_DRAW_RESOURCE_RETURN_TYPE_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_POSITION_NOT_PRESENT = D3D11_MESSAGE_ID.DEVICE_DRAW_POSITION_NOT_PRESENT;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_NOT_SET = D3D11_MESSAGE_ID.DEVICE_DRAW_OUTPUT_STREAM_NOT_SET;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_BOUND_RESOURCE_MAPPED = D3D11_MESSAGE_ID.DEVICE_DRAW_BOUND_RESOURCE_MAPPED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY = D3D11_MESSAGE_ID.DEVICE_DRAW_INVALID_PRIMITIVETOPOLOGY;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED = D3D11_MESSAGE_ID.DEVICE_DRAW_VERTEX_OFFSET_UNALIGNED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED = D3D11_MESSAGE_ID.DEVICE_DRAW_VERTEX_STRIDE_UNALIGNED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_INDEX_OFFSET_UNALIGNED = D3D11_MESSAGE_ID.DEVICE_DRAW_INDEX_OFFSET_UNALIGNED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED = D3D11_MESSAGE_ID.DEVICE_DRAW_OUTPUT_STREAM_OFFSET_UNALIGNED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_DRAW_RESOURCE_FORMAT_LD_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_DRAW_RESOURCE_FORMAT_SAMPLE_C_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_DRAW_RESOURCE_MULTISAMPLE_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE = D3D11_MESSAGE_ID.DEVICE_DRAW_SO_TARGETS_BOUND_WITHOUT_SOURCE;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER = D3D11_MESSAGE_ID.DEVICE_DRAW_SO_STRIDE_LARGER_THAN_BUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING = D3D11_MESSAGE_ID.DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_BLENDING;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0 = D3D11_MESSAGE_ID.DEVICE_DRAW_OM_DUAL_SOURCE_BLENDING_CAN_ONLY_HAVE_RENDER_TARGET_0;
pub const D3D11_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_AT_FAULT = D3D11_MESSAGE_ID.DEVICE_REMOVAL_PROCESS_AT_FAULT;
pub const D3D11_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT = D3D11_MESSAGE_ID.DEVICE_REMOVAL_PROCESS_POSSIBLY_AT_FAULT;
pub const D3D11_MESSAGE_ID_DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT = D3D11_MESSAGE_ID.DEVICE_REMOVAL_PROCESS_NOT_AT_FAULT;
pub const D3D11_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN = D3D11_MESSAGE_ID.DEVICE_OPEN_SHARED_RESOURCE_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.DEVICE_OPEN_SHARED_RESOURCE_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN = D3D11_MESSAGE_ID.DEVICE_OPEN_SHARED_RESOURCE_BADINTERFACE_RETURN;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_VIEWPORT_NOT_SET = D3D11_MESSAGE_ID.DEVICE_DRAW_VIEWPORT_NOT_SET;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_TRAILING_DIGIT_IN_SEMANTIC;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_TRAILING_DIGIT_IN_SEMANTIC;
pub const D3D11_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_DENORMFLUSH = D3D11_MESSAGE_ID.DEVICE_RSSETVIEWPORTS_DENORMFLUSH;
pub const D3D11_MESSAGE_ID_OMSETRENDERTARGETS_INVALIDVIEW = D3D11_MESSAGE_ID.OMSETRENDERTARGETS_INVALIDVIEW;
pub const D3D11_MESSAGE_ID_DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS = D3D11_MESSAGE_ID.DEVICE_SETTEXTFILTERSIZE_INVALIDDIMENSIONS;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_SAMPLER_MISMATCH = D3D11_MESSAGE_ID.DEVICE_DRAW_SAMPLER_MISMATCH;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_TYPE_MISMATCH = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_TYPE_MISMATCH;
pub const D3D11_MESSAGE_ID_BLENDSTATE_GETDESC_LEGACY = D3D11_MESSAGE_ID.BLENDSTATE_GETDESC_LEGACY;
pub const D3D11_MESSAGE_ID_SHADERRESOURCEVIEW_GETDESC_LEGACY = D3D11_MESSAGE_ID.SHADERRESOURCEVIEW_GETDESC_LEGACY;
pub const D3D11_MESSAGE_ID_CREATEQUERY_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEQUERY_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATEPREDICATE_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEPREDICATE_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATECOUNTER_OUTOFRANGE_COUNTER = D3D11_MESSAGE_ID.CREATECOUNTER_OUTOFRANGE_COUNTER;
pub const D3D11_MESSAGE_ID_CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED = D3D11_MESSAGE_ID.CREATECOUNTER_SIMULTANEOUS_ACTIVE_COUNTERS_EXHAUSTED;
pub const D3D11_MESSAGE_ID_CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = D3D11_MESSAGE_ID.CREATECOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER;
pub const D3D11_MESSAGE_ID_CREATECOUNTER_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATECOUNTER_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATECOUNTER_NONEXCLUSIVE_RETURN = D3D11_MESSAGE_ID.CREATECOUNTER_NONEXCLUSIVE_RETURN;
pub const D3D11_MESSAGE_ID_CREATECOUNTER_NULLDESC = D3D11_MESSAGE_ID.CREATECOUNTER_NULLDESC;
pub const D3D11_MESSAGE_ID_CHECKCOUNTER_OUTOFRANGE_COUNTER = D3D11_MESSAGE_ID.CHECKCOUNTER_OUTOFRANGE_COUNTER;
pub const D3D11_MESSAGE_ID_CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER = D3D11_MESSAGE_ID.CHECKCOUNTER_UNSUPPORTED_WELLKNOWN_COUNTER;
pub const D3D11_MESSAGE_ID_SETPREDICATION_INVALID_PREDICATE_STATE = D3D11_MESSAGE_ID.SETPREDICATION_INVALID_PREDICATE_STATE;
pub const D3D11_MESSAGE_ID_QUERY_BEGIN_UNSUPPORTED = D3D11_MESSAGE_ID.QUERY_BEGIN_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_PREDICATE_BEGIN_DURING_PREDICATION = D3D11_MESSAGE_ID.PREDICATE_BEGIN_DURING_PREDICATION;
pub const D3D11_MESSAGE_ID_QUERY_BEGIN_DUPLICATE = D3D11_MESSAGE_ID.QUERY_BEGIN_DUPLICATE;
pub const D3D11_MESSAGE_ID_QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS = D3D11_MESSAGE_ID.QUERY_BEGIN_ABANDONING_PREVIOUS_RESULTS;
pub const D3D11_MESSAGE_ID_PREDICATE_END_DURING_PREDICATION = D3D11_MESSAGE_ID.PREDICATE_END_DURING_PREDICATION;
pub const D3D11_MESSAGE_ID_QUERY_END_ABANDONING_PREVIOUS_RESULTS = D3D11_MESSAGE_ID.QUERY_END_ABANDONING_PREVIOUS_RESULTS;
pub const D3D11_MESSAGE_ID_QUERY_END_WITHOUT_BEGIN = D3D11_MESSAGE_ID.QUERY_END_WITHOUT_BEGIN;
pub const D3D11_MESSAGE_ID_QUERY_GETDATA_INVALID_DATASIZE = D3D11_MESSAGE_ID.QUERY_GETDATA_INVALID_DATASIZE;
pub const D3D11_MESSAGE_ID_QUERY_GETDATA_INVALID_FLAGS = D3D11_MESSAGE_ID.QUERY_GETDATA_INVALID_FLAGS;
pub const D3D11_MESSAGE_ID_QUERY_GETDATA_INVALID_CALL = D3D11_MESSAGE_ID.QUERY_GETDATA_INVALID_CALL;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH = D3D11_MESSAGE_ID.DEVICE_DRAW_PS_OUTPUT_TYPE_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_DRAW_RESOURCE_FORMAT_GATHER_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN = D3D11_MESSAGE_ID.DEVICE_DRAW_INVALID_USE_OF_CENTER_MULTISAMPLE_PATTERN;
pub const D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE = D3D11_MESSAGE_ID.DEVICE_IASETVERTEXBUFFERS_STRIDE_TOO_LARGE;
pub const D3D11_MESSAGE_ID_DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE = D3D11_MESSAGE_ID.DEVICE_IASETVERTEXBUFFERS_INVALIDRANGE;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_EMPTY_LAYOUT = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_EMPTY_LAYOUT;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH = D3D11_MESSAGE_ID.DEVICE_DRAW_RESOURCE_SAMPLE_COUNT_MISMATCH;
pub const D3D11_MESSAGE_ID_LIVE_OBJECT_SUMMARY = D3D11_MESSAGE_ID.LIVE_OBJECT_SUMMARY;
pub const D3D11_MESSAGE_ID_LIVE_BUFFER = D3D11_MESSAGE_ID.LIVE_BUFFER;
pub const D3D11_MESSAGE_ID_LIVE_TEXTURE1D = D3D11_MESSAGE_ID.LIVE_TEXTURE1D;
pub const D3D11_MESSAGE_ID_LIVE_TEXTURE2D = D3D11_MESSAGE_ID.LIVE_TEXTURE2D;
pub const D3D11_MESSAGE_ID_LIVE_TEXTURE3D = D3D11_MESSAGE_ID.LIVE_TEXTURE3D;
pub const D3D11_MESSAGE_ID_LIVE_SHADERRESOURCEVIEW = D3D11_MESSAGE_ID.LIVE_SHADERRESOURCEVIEW;
pub const D3D11_MESSAGE_ID_LIVE_RENDERTARGETVIEW = D3D11_MESSAGE_ID.LIVE_RENDERTARGETVIEW;
pub const D3D11_MESSAGE_ID_LIVE_DEPTHSTENCILVIEW = D3D11_MESSAGE_ID.LIVE_DEPTHSTENCILVIEW;
pub const D3D11_MESSAGE_ID_LIVE_VERTEXSHADER = D3D11_MESSAGE_ID.LIVE_VERTEXSHADER;
pub const D3D11_MESSAGE_ID_LIVE_GEOMETRYSHADER = D3D11_MESSAGE_ID.LIVE_GEOMETRYSHADER;
pub const D3D11_MESSAGE_ID_LIVE_PIXELSHADER = D3D11_MESSAGE_ID.LIVE_PIXELSHADER;
pub const D3D11_MESSAGE_ID_LIVE_INPUTLAYOUT = D3D11_MESSAGE_ID.LIVE_INPUTLAYOUT;
pub const D3D11_MESSAGE_ID_LIVE_SAMPLER = D3D11_MESSAGE_ID.LIVE_SAMPLER;
pub const D3D11_MESSAGE_ID_LIVE_BLENDSTATE = D3D11_MESSAGE_ID.LIVE_BLENDSTATE;
pub const D3D11_MESSAGE_ID_LIVE_DEPTHSTENCILSTATE = D3D11_MESSAGE_ID.LIVE_DEPTHSTENCILSTATE;
pub const D3D11_MESSAGE_ID_LIVE_RASTERIZERSTATE = D3D11_MESSAGE_ID.LIVE_RASTERIZERSTATE;
pub const D3D11_MESSAGE_ID_LIVE_QUERY = D3D11_MESSAGE_ID.LIVE_QUERY;
pub const D3D11_MESSAGE_ID_LIVE_PREDICATE = D3D11_MESSAGE_ID.LIVE_PREDICATE;
pub const D3D11_MESSAGE_ID_LIVE_COUNTER = D3D11_MESSAGE_ID.LIVE_COUNTER;
pub const D3D11_MESSAGE_ID_LIVE_DEVICE = D3D11_MESSAGE_ID.LIVE_DEVICE;
pub const D3D11_MESSAGE_ID_LIVE_SWAPCHAIN = D3D11_MESSAGE_ID.LIVE_SWAPCHAIN;
pub const D3D11_MESSAGE_ID_D3D10_MESSAGES_END = D3D11_MESSAGE_ID.D3D10_MESSAGES_END;
pub const D3D11_MESSAGE_ID_D3D10L9_MESSAGES_START = D3D11_MESSAGE_ID.D3D10L9_MESSAGES_START;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILSTATE_STENCIL_NO_TWO_SIDED;
pub const D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED = D3D11_MESSAGE_ID.CREATERASTERIZERSTATE_DepthBiasClamp_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_NO_COMPARISON_SUPPORT;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_EXCESSIVE_ANISOTROPY;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_BORDER_OUT_OF_RANGE;
pub const D3D11_MESSAGE_ID_VSSETSAMPLERS_NOT_SUPPORTED = D3D11_MESSAGE_ID.VSSETSAMPLERS_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_VSSETSAMPLERS_TOO_MANY_SAMPLERS = D3D11_MESSAGE_ID.VSSETSAMPLERS_TOO_MANY_SAMPLERS;
pub const D3D11_MESSAGE_ID_PSSETSAMPLERS_TOO_MANY_SAMPLERS = D3D11_MESSAGE_ID.PSSETSAMPLERS_TOO_MANY_SAMPLERS;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_NO_ARRAYS = D3D11_MESSAGE_ID.CREATERESOURCE_NO_ARRAYS;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_NO_VB_AND_IB_BIND = D3D11_MESSAGE_ID.CREATERESOURCE_NO_VB_AND_IB_BIND;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_NO_TEXTURE_1D = D3D11_MESSAGE_ID.CREATERESOURCE_NO_TEXTURE_1D;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_DIMENSION_OUT_OF_RANGE = D3D11_MESSAGE_ID.CREATERESOURCE_DIMENSION_OUT_OF_RANGE;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE = D3D11_MESSAGE_ID.CREATERESOURCE_NOT_BINDABLE_AS_SHADER_RESOURCE;
pub const D3D11_MESSAGE_ID_OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS = D3D11_MESSAGE_ID.OMSETRENDERTARGETS_TOO_MANY_RENDER_TARGETS;
pub const D3D11_MESSAGE_ID_OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS = D3D11_MESSAGE_ID.OMSETRENDERTARGETS_NO_DIFFERING_BIT_DEPTHS;
pub const D3D11_MESSAGE_ID_IASETVERTEXBUFFERS_BAD_BUFFER_INDEX = D3D11_MESSAGE_ID.IASETVERTEXBUFFERS_BAD_BUFFER_INDEX;
pub const D3D11_MESSAGE_ID_DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS = D3D11_MESSAGE_ID.DEVICE_RSSETVIEWPORTS_TOO_MANY_VIEWPORTS;
pub const D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_IASETPRIMITIVETOPOLOGY_ADJACENCY_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS = D3D11_MESSAGE_ID.DEVICE_RSSETSCISSORRECTS_TOO_MANY_SCISSORS;
pub const D3D11_MESSAGE_ID_COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY = D3D11_MESSAGE_ID.COPYRESOURCE_ONLY_TEXTURE_2D_WITHIN_GPU_MEMORY;
pub const D3D11_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_3D_READBACK = D3D11_MESSAGE_ID.COPYRESOURCE_NO_TEXTURE_3D_READBACK;
pub const D3D11_MESSAGE_ID_COPYRESOURCE_NO_TEXTURE_ONLY_READBACK = D3D11_MESSAGE_ID.COPYRESOURCE_NO_TEXTURE_ONLY_READBACK;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_UNSUPPORTED_FORMAT;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE = D3D11_MESSAGE_ID.CREATEBLENDSTATE_NO_ALPHA_TO_COVERAGE;
pub const D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE = D3D11_MESSAGE_ID.CREATERASTERIZERSTATE_DepthClipEnable_MUST_BE_TRUE;
pub const D3D11_MESSAGE_ID_DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE = D3D11_MESSAGE_ID.DRAWINDEXED_STARTINDEXLOCATION_MUST_BE_POSITIVE;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_MUST_USE_LOWEST_LOD;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_MINLOD_MUST_NOT_BE_FRACTIONAL;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_MAXLOD_MUST_BE_FLT_MAX;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_FIRSTARRAYSLICE_MUST_BE_ZERO;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_CUBES_MUST_HAVE_6_SIDES;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET = D3D11_MESSAGE_ID.CREATERESOURCE_NOT_BINDABLE_AS_RENDER_TARGET;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_NO_DWORD_INDEX_BUFFER = D3D11_MESSAGE_ID.CREATERESOURCE_NO_DWORD_INDEX_BUFFER;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE = D3D11_MESSAGE_ID.CREATERESOURCE_MSAA_PRECLUDES_SHADER_RESOURCE;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE = D3D11_MESSAGE_ID.CREATERESOURCE_PRESENTATION_PRECLUDES_SHADER_RESOURCE;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE = D3D11_MESSAGE_ID.CREATEBLENDSTATE_NO_INDEPENDENT_BLEND_ENABLE;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS = D3D11_MESSAGE_ID.CREATEBLENDSTATE_NO_INDEPENDENT_WRITE_MASKS;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_NO_STREAM_OUT = D3D11_MESSAGE_ID.CREATERESOURCE_NO_STREAM_OUT;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS = D3D11_MESSAGE_ID.CREATERESOURCE_ONLY_VB_IB_FOR_BUFFERS;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES = D3D11_MESSAGE_ID.CREATERESOURCE_NO_AUTOGEN_FOR_VOLUMES;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED = D3D11_MESSAGE_ID.CREATERESOURCE_DXGI_FORMAT_R8G8B8A8_CANNOT_BE_SHARED;
pub const D3D11_MESSAGE_ID_VSSHADERRESOURCES_NOT_SUPPORTED = D3D11_MESSAGE_ID.VSSHADERRESOURCES_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_GEOMETRY_SHADER_NOT_SUPPORTED = D3D11_MESSAGE_ID.GEOMETRY_SHADER_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_STREAM_OUT_NOT_SUPPORTED = D3D11_MESSAGE_ID.STREAM_OUT_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_TEXT_FILTER_NOT_SUPPORTED = D3D11_MESSAGE_ID.TEXT_FILTER_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND = D3D11_MESSAGE_ID.CREATEBLENDSTATE_NO_SEPARATE_ALPHA_BLEND;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_NO_MRT_BLEND = D3D11_MESSAGE_ID.CREATEBLENDSTATE_NO_MRT_BLEND;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED = D3D11_MESSAGE_ID.CREATEBLENDSTATE_OPERATION_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_NO_MIRRORONCE = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_NO_MIRRORONCE;
pub const D3D11_MESSAGE_ID_DRAWINSTANCED_NOT_SUPPORTED = D3D11_MESSAGE_ID.DRAWINSTANCED_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3 = D3D11_MESSAGE_ID.DRAWINDEXEDINSTANCED_NOT_SUPPORTED_BELOW_9_3;
pub const D3D11_MESSAGE_ID_DRAWINDEXED_POINTLIST_UNSUPPORTED = D3D11_MESSAGE_ID.DRAWINDEXED_POINTLIST_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO = D3D11_MESSAGE_ID.SETBLENDSTATE_SAMPLE_MASK_CANNOT_BE_ZERO;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION = D3D11_MESSAGE_ID.CREATERESOURCE_DIMENSION_EXCEEDS_FEATURE_LEVEL_DEFINITION;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED = D3D11_MESSAGE_ID.CREATERESOURCE_ONLY_SINGLE_MIP_LEVEL_DEPTH_STENCIL_SUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR = D3D11_MESSAGE_ID.DEVICE_RSSETSCISSORRECTS_NEGATIVESCISSOR;
pub const D3D11_MESSAGE_ID_SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA = D3D11_MESSAGE_ID.SLOT_ZERO_MUST_BE_D3D10_INPUT_PER_VERTEX_DATA;
pub const D3D11_MESSAGE_ID_CREATERESOURCE_NON_POW_2_MIPMAP = D3D11_MESSAGE_ID.CREATERESOURCE_NON_POW_2_MIPMAP;
pub const D3D11_MESSAGE_ID_CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED = D3D11_MESSAGE_ID.CREATESAMPLERSTATE_BORDER_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_OMSETRENDERTARGETS_NO_SRGB_MRT = D3D11_MESSAGE_ID.OMSETRENDERTARGETS_NO_SRGB_MRT;
pub const D3D11_MESSAGE_ID_COPYRESOURCE_NO_3D_MISMATCHED_UPDATES = D3D11_MESSAGE_ID.COPYRESOURCE_NO_3D_MISMATCHED_UPDATES;
pub const D3D11_MESSAGE_ID_D3D10L9_MESSAGES_END = D3D11_MESSAGE_ID.D3D10L9_MESSAGES_END;
pub const D3D11_MESSAGE_ID_D3D11_MESSAGES_START = D3D11_MESSAGE_ID.D3D11_MESSAGES_START;
pub const D3D11_MESSAGE_ID_CREATEDEPTHSTENCILVIEW_INVALIDFLAGS = D3D11_MESSAGE_ID.CREATEDEPTHSTENCILVIEW_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_CREATEVERTEXSHADER_INVALIDCLASSLINKAGE = D3D11_MESSAGE_ID.CREATEVERTEXSHADER_INVALIDCLASSLINKAGE;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADER_INVALIDCLASSLINKAGE = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADER_INVALIDCLASSLINKAGE;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTREAMS = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTREAMS;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAMTORASTERIZER = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAMTORASTERIZER;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTREAMS = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTREAMS;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCLASSLINKAGE = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDCLASSLINKAGE;
pub const D3D11_MESSAGE_ID_CREATEPIXELSHADER_INVALIDCLASSLINKAGE = D3D11_MESSAGE_ID.CREATEPIXELSHADER_INVALIDCLASSLINKAGE;
pub const D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_INVALID_COMMANDLISTFLAGS = D3D11_MESSAGE_ID.CREATEDEFERREDCONTEXT_INVALID_COMMANDLISTFLAGS;
pub const D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_SINGLETHREADED = D3D11_MESSAGE_ID.CREATEDEFERREDCONTEXT_SINGLETHREADED;
pub const D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_INVALIDARG_RETURN = D3D11_MESSAGE_ID.CREATEDEFERREDCONTEXT_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_INVALID_CALL_RETURN = D3D11_MESSAGE_ID.CREATEDEFERREDCONTEXT_INVALID_CALL_RETURN;
pub const D3D11_MESSAGE_ID_CREATEDEFERREDCONTEXT_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEDEFERREDCONTEXT_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_FINISHDISPLAYLIST_ONIMMEDIATECONTEXT = D3D11_MESSAGE_ID.FINISHDISPLAYLIST_ONIMMEDIATECONTEXT;
pub const D3D11_MESSAGE_ID_FINISHDISPLAYLIST_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.FINISHDISPLAYLIST_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_FINISHDISPLAYLIST_INVALID_CALL_RETURN = D3D11_MESSAGE_ID.FINISHDISPLAYLIST_INVALID_CALL_RETURN;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAM = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDENTRIES = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDENTRIES;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTRIDES = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UNEXPECTEDSTRIDES;
pub const D3D11_MESSAGE_ID_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTRIDES = D3D11_MESSAGE_ID.CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_INVALIDNUMSTRIDES;
pub const D3D11_MESSAGE_ID_DEVICE_HSSETSHADERRESOURCES_HAZARD = D3D11_MESSAGE_ID.DEVICE_HSSETSHADERRESOURCES_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_HSSETCONSTANTBUFFERS_HAZARD = D3D11_MESSAGE_ID.DEVICE_HSSETCONSTANTBUFFERS_HAZARD;
pub const D3D11_MESSAGE_ID_HSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.HSSETSHADERRESOURCES_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_HSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.HSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDCALL = D3D11_MESSAGE_ID.CREATEHULLSHADER_INVALIDCALL;
pub const D3D11_MESSAGE_ID_CREATEHULLSHADER_OUTOFMEMORY = D3D11_MESSAGE_ID.CREATEHULLSHADER_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERBYTECODE = D3D11_MESSAGE_ID.CREATEHULLSHADER_INVALIDSHADERBYTECODE;
pub const D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDSHADERTYPE = D3D11_MESSAGE_ID.CREATEHULLSHADER_INVALIDSHADERTYPE;
pub const D3D11_MESSAGE_ID_CREATEHULLSHADER_INVALIDCLASSLINKAGE = D3D11_MESSAGE_ID.CREATEHULLSHADER_INVALIDCLASSLINKAGE;
pub const D3D11_MESSAGE_ID_DEVICE_HSSETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_HSSETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_HSSETCONSTANTBUFFERS_INVALIDBUFFER = D3D11_MESSAGE_ID.HSSETCONSTANTBUFFERS_INVALIDBUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_HSSETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_HSSETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_HSSETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_HSSETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_HSGETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_HSGETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_HSGETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_HSGETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_HSGETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_HSGETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_DSSETSHADERRESOURCES_HAZARD = D3D11_MESSAGE_ID.DEVICE_DSSETSHADERRESOURCES_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_DSSETCONSTANTBUFFERS_HAZARD = D3D11_MESSAGE_ID.DEVICE_DSSETCONSTANTBUFFERS_HAZARD;
pub const D3D11_MESSAGE_ID_DSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.DSSETSHADERRESOURCES_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_DSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.DSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCALL = D3D11_MESSAGE_ID.CREATEDOMAINSHADER_INVALIDCALL;
pub const D3D11_MESSAGE_ID_CREATEDOMAINSHADER_OUTOFMEMORY = D3D11_MESSAGE_ID.CREATEDOMAINSHADER_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERBYTECODE = D3D11_MESSAGE_ID.CREATEDOMAINSHADER_INVALIDSHADERBYTECODE;
pub const D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDSHADERTYPE = D3D11_MESSAGE_ID.CREATEDOMAINSHADER_INVALIDSHADERTYPE;
pub const D3D11_MESSAGE_ID_CREATEDOMAINSHADER_INVALIDCLASSLINKAGE = D3D11_MESSAGE_ID.CREATEDOMAINSHADER_INVALIDCLASSLINKAGE;
pub const D3D11_MESSAGE_ID_DEVICE_DSSETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_DSSETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_DSSETCONSTANTBUFFERS_INVALIDBUFFER = D3D11_MESSAGE_ID.DSSETCONSTANTBUFFERS_INVALIDBUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_DSSETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_DSSETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_DSSETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_DSSETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_DSGETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_DSGETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_DSGETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_DSGETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_DSGETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_DSGETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_HS_XOR_DS_MISMATCH = D3D11_MESSAGE_ID.DEVICE_DRAW_HS_XOR_DS_MISMATCH;
pub const D3D11_MESSAGE_ID_DEFERRED_CONTEXT_REMOVAL_PROCESS_AT_FAULT = D3D11_MESSAGE_ID.DEFERRED_CONTEXT_REMOVAL_PROCESS_AT_FAULT;
pub const D3D11_MESSAGE_ID_DEVICE_DRAWINDIRECT_INVALID_ARG_BUFFER = D3D11_MESSAGE_ID.DEVICE_DRAWINDIRECT_INVALID_ARG_BUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_UNALIGNED = D3D11_MESSAGE_ID.DEVICE_DRAWINDIRECT_OFFSET_UNALIGNED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAWINDIRECT_OFFSET_OVERFLOW = D3D11_MESSAGE_ID.DEVICE_DRAWINDIRECT_OFFSET_OVERFLOW;
pub const D3D11_MESSAGE_ID_RESOURCE_MAP_INVALIDMAPTYPE = D3D11_MESSAGE_ID.RESOURCE_MAP_INVALIDMAPTYPE;
pub const D3D11_MESSAGE_ID_RESOURCE_MAP_INVALIDSUBRESOURCE = D3D11_MESSAGE_ID.RESOURCE_MAP_INVALIDSUBRESOURCE;
pub const D3D11_MESSAGE_ID_RESOURCE_MAP_INVALIDFLAGS = D3D11_MESSAGE_ID.RESOURCE_MAP_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_RESOURCE_MAP_ALREADYMAPPED = D3D11_MESSAGE_ID.RESOURCE_MAP_ALREADYMAPPED;
pub const D3D11_MESSAGE_ID_RESOURCE_MAP_DEVICEREMOVED_RETURN = D3D11_MESSAGE_ID.RESOURCE_MAP_DEVICEREMOVED_RETURN;
pub const D3D11_MESSAGE_ID_RESOURCE_MAP_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.RESOURCE_MAP_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_RESOURCE_MAP_WITHOUT_INITIAL_DISCARD = D3D11_MESSAGE_ID.RESOURCE_MAP_WITHOUT_INITIAL_DISCARD;
pub const D3D11_MESSAGE_ID_RESOURCE_UNMAP_INVALIDSUBRESOURCE = D3D11_MESSAGE_ID.RESOURCE_UNMAP_INVALIDSUBRESOURCE;
pub const D3D11_MESSAGE_ID_RESOURCE_UNMAP_NOTMAPPED = D3D11_MESSAGE_ID.RESOURCE_UNMAP_NOTMAPPED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_RASTERIZING_CONTROL_POINTS = D3D11_MESSAGE_ID.DEVICE_DRAW_RASTERIZING_CONTROL_POINTS;
pub const D3D11_MESSAGE_ID_DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_IASETPRIMITIVETOPOLOGY_TOPOLOGY_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_HS_DS_SIGNATURE_MISMATCH = D3D11_MESSAGE_ID.DEVICE_DRAW_HS_DS_SIGNATURE_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH = D3D11_MESSAGE_ID.DEVICE_DRAW_HULL_SHADER_INPUT_TOPOLOGY_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_HS_DS_CONTROL_POINT_COUNT_MISMATCH = D3D11_MESSAGE_ID.DEVICE_DRAW_HS_DS_CONTROL_POINT_COUNT_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_HS_DS_TESSELLATOR_DOMAIN_MISMATCH = D3D11_MESSAGE_ID.DEVICE_DRAW_HS_DS_TESSELLATOR_DOMAIN_MISMATCH;
pub const D3D11_MESSAGE_ID_CREATE_CONTEXT = D3D11_MESSAGE_ID.CREATE_CONTEXT;
pub const D3D11_MESSAGE_ID_LIVE_CONTEXT = D3D11_MESSAGE_ID.LIVE_CONTEXT;
pub const D3D11_MESSAGE_ID_DESTROY_CONTEXT = D3D11_MESSAGE_ID.DESTROY_CONTEXT;
pub const D3D11_MESSAGE_ID_CREATE_BUFFER = D3D11_MESSAGE_ID.CREATE_BUFFER;
pub const D3D11_MESSAGE_ID_LIVE_BUFFER_WIN7 = D3D11_MESSAGE_ID.LIVE_BUFFER_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_BUFFER = D3D11_MESSAGE_ID.DESTROY_BUFFER;
pub const D3D11_MESSAGE_ID_CREATE_TEXTURE1D = D3D11_MESSAGE_ID.CREATE_TEXTURE1D;
pub const D3D11_MESSAGE_ID_LIVE_TEXTURE1D_WIN7 = D3D11_MESSAGE_ID.LIVE_TEXTURE1D_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_TEXTURE1D = D3D11_MESSAGE_ID.DESTROY_TEXTURE1D;
pub const D3D11_MESSAGE_ID_CREATE_TEXTURE2D = D3D11_MESSAGE_ID.CREATE_TEXTURE2D;
pub const D3D11_MESSAGE_ID_LIVE_TEXTURE2D_WIN7 = D3D11_MESSAGE_ID.LIVE_TEXTURE2D_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_TEXTURE2D = D3D11_MESSAGE_ID.DESTROY_TEXTURE2D;
pub const D3D11_MESSAGE_ID_CREATE_TEXTURE3D = D3D11_MESSAGE_ID.CREATE_TEXTURE3D;
pub const D3D11_MESSAGE_ID_LIVE_TEXTURE3D_WIN7 = D3D11_MESSAGE_ID.LIVE_TEXTURE3D_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_TEXTURE3D = D3D11_MESSAGE_ID.DESTROY_TEXTURE3D;
pub const D3D11_MESSAGE_ID_CREATE_SHADERRESOURCEVIEW = D3D11_MESSAGE_ID.CREATE_SHADERRESOURCEVIEW;
pub const D3D11_MESSAGE_ID_LIVE_SHADERRESOURCEVIEW_WIN7 = D3D11_MESSAGE_ID.LIVE_SHADERRESOURCEVIEW_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_SHADERRESOURCEVIEW = D3D11_MESSAGE_ID.DESTROY_SHADERRESOURCEVIEW;
pub const D3D11_MESSAGE_ID_CREATE_RENDERTARGETVIEW = D3D11_MESSAGE_ID.CREATE_RENDERTARGETVIEW;
pub const D3D11_MESSAGE_ID_LIVE_RENDERTARGETVIEW_WIN7 = D3D11_MESSAGE_ID.LIVE_RENDERTARGETVIEW_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_RENDERTARGETVIEW = D3D11_MESSAGE_ID.DESTROY_RENDERTARGETVIEW;
pub const D3D11_MESSAGE_ID_CREATE_DEPTHSTENCILVIEW = D3D11_MESSAGE_ID.CREATE_DEPTHSTENCILVIEW;
pub const D3D11_MESSAGE_ID_LIVE_DEPTHSTENCILVIEW_WIN7 = D3D11_MESSAGE_ID.LIVE_DEPTHSTENCILVIEW_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_DEPTHSTENCILVIEW = D3D11_MESSAGE_ID.DESTROY_DEPTHSTENCILVIEW;
pub const D3D11_MESSAGE_ID_CREATE_VERTEXSHADER = D3D11_MESSAGE_ID.CREATE_VERTEXSHADER;
pub const D3D11_MESSAGE_ID_LIVE_VERTEXSHADER_WIN7 = D3D11_MESSAGE_ID.LIVE_VERTEXSHADER_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_VERTEXSHADER = D3D11_MESSAGE_ID.DESTROY_VERTEXSHADER;
pub const D3D11_MESSAGE_ID_CREATE_HULLSHADER = D3D11_MESSAGE_ID.CREATE_HULLSHADER;
pub const D3D11_MESSAGE_ID_LIVE_HULLSHADER = D3D11_MESSAGE_ID.LIVE_HULLSHADER;
pub const D3D11_MESSAGE_ID_DESTROY_HULLSHADER = D3D11_MESSAGE_ID.DESTROY_HULLSHADER;
pub const D3D11_MESSAGE_ID_CREATE_DOMAINSHADER = D3D11_MESSAGE_ID.CREATE_DOMAINSHADER;
pub const D3D11_MESSAGE_ID_LIVE_DOMAINSHADER = D3D11_MESSAGE_ID.LIVE_DOMAINSHADER;
pub const D3D11_MESSAGE_ID_DESTROY_DOMAINSHADER = D3D11_MESSAGE_ID.DESTROY_DOMAINSHADER;
pub const D3D11_MESSAGE_ID_CREATE_GEOMETRYSHADER = D3D11_MESSAGE_ID.CREATE_GEOMETRYSHADER;
pub const D3D11_MESSAGE_ID_LIVE_GEOMETRYSHADER_WIN7 = D3D11_MESSAGE_ID.LIVE_GEOMETRYSHADER_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_GEOMETRYSHADER = D3D11_MESSAGE_ID.DESTROY_GEOMETRYSHADER;
pub const D3D11_MESSAGE_ID_CREATE_PIXELSHADER = D3D11_MESSAGE_ID.CREATE_PIXELSHADER;
pub const D3D11_MESSAGE_ID_LIVE_PIXELSHADER_WIN7 = D3D11_MESSAGE_ID.LIVE_PIXELSHADER_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_PIXELSHADER = D3D11_MESSAGE_ID.DESTROY_PIXELSHADER;
pub const D3D11_MESSAGE_ID_CREATE_INPUTLAYOUT = D3D11_MESSAGE_ID.CREATE_INPUTLAYOUT;
pub const D3D11_MESSAGE_ID_LIVE_INPUTLAYOUT_WIN7 = D3D11_MESSAGE_ID.LIVE_INPUTLAYOUT_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_INPUTLAYOUT = D3D11_MESSAGE_ID.DESTROY_INPUTLAYOUT;
pub const D3D11_MESSAGE_ID_CREATE_SAMPLER = D3D11_MESSAGE_ID.CREATE_SAMPLER;
pub const D3D11_MESSAGE_ID_LIVE_SAMPLER_WIN7 = D3D11_MESSAGE_ID.LIVE_SAMPLER_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_SAMPLER = D3D11_MESSAGE_ID.DESTROY_SAMPLER;
pub const D3D11_MESSAGE_ID_CREATE_BLENDSTATE = D3D11_MESSAGE_ID.CREATE_BLENDSTATE;
pub const D3D11_MESSAGE_ID_LIVE_BLENDSTATE_WIN7 = D3D11_MESSAGE_ID.LIVE_BLENDSTATE_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_BLENDSTATE = D3D11_MESSAGE_ID.DESTROY_BLENDSTATE;
pub const D3D11_MESSAGE_ID_CREATE_DEPTHSTENCILSTATE = D3D11_MESSAGE_ID.CREATE_DEPTHSTENCILSTATE;
pub const D3D11_MESSAGE_ID_LIVE_DEPTHSTENCILSTATE_WIN7 = D3D11_MESSAGE_ID.LIVE_DEPTHSTENCILSTATE_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_DEPTHSTENCILSTATE = D3D11_MESSAGE_ID.DESTROY_DEPTHSTENCILSTATE;
pub const D3D11_MESSAGE_ID_CREATE_RASTERIZERSTATE = D3D11_MESSAGE_ID.CREATE_RASTERIZERSTATE;
pub const D3D11_MESSAGE_ID_LIVE_RASTERIZERSTATE_WIN7 = D3D11_MESSAGE_ID.LIVE_RASTERIZERSTATE_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_RASTERIZERSTATE = D3D11_MESSAGE_ID.DESTROY_RASTERIZERSTATE;
pub const D3D11_MESSAGE_ID_CREATE_QUERY = D3D11_MESSAGE_ID.CREATE_QUERY;
pub const D3D11_MESSAGE_ID_LIVE_QUERY_WIN7 = D3D11_MESSAGE_ID.LIVE_QUERY_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_QUERY = D3D11_MESSAGE_ID.DESTROY_QUERY;
pub const D3D11_MESSAGE_ID_CREATE_PREDICATE = D3D11_MESSAGE_ID.CREATE_PREDICATE;
pub const D3D11_MESSAGE_ID_LIVE_PREDICATE_WIN7 = D3D11_MESSAGE_ID.LIVE_PREDICATE_WIN7;
pub const D3D11_MESSAGE_ID_DESTROY_PREDICATE = D3D11_MESSAGE_ID.DESTROY_PREDICATE;
pub const D3D11_MESSAGE_ID_CREATE_COUNTER = D3D11_MESSAGE_ID.CREATE_COUNTER;
pub const D3D11_MESSAGE_ID_DESTROY_COUNTER = D3D11_MESSAGE_ID.DESTROY_COUNTER;
pub const D3D11_MESSAGE_ID_CREATE_COMMANDLIST = D3D11_MESSAGE_ID.CREATE_COMMANDLIST;
pub const D3D11_MESSAGE_ID_LIVE_COMMANDLIST = D3D11_MESSAGE_ID.LIVE_COMMANDLIST;
pub const D3D11_MESSAGE_ID_DESTROY_COMMANDLIST = D3D11_MESSAGE_ID.DESTROY_COMMANDLIST;
pub const D3D11_MESSAGE_ID_CREATE_CLASSINSTANCE = D3D11_MESSAGE_ID.CREATE_CLASSINSTANCE;
pub const D3D11_MESSAGE_ID_LIVE_CLASSINSTANCE = D3D11_MESSAGE_ID.LIVE_CLASSINSTANCE;
pub const D3D11_MESSAGE_ID_DESTROY_CLASSINSTANCE = D3D11_MESSAGE_ID.DESTROY_CLASSINSTANCE;
pub const D3D11_MESSAGE_ID_CREATE_CLASSLINKAGE = D3D11_MESSAGE_ID.CREATE_CLASSLINKAGE;
pub const D3D11_MESSAGE_ID_LIVE_CLASSLINKAGE = D3D11_MESSAGE_ID.LIVE_CLASSLINKAGE;
pub const D3D11_MESSAGE_ID_DESTROY_CLASSLINKAGE = D3D11_MESSAGE_ID.DESTROY_CLASSLINKAGE;
pub const D3D11_MESSAGE_ID_LIVE_DEVICE_WIN7 = D3D11_MESSAGE_ID.LIVE_DEVICE_WIN7;
pub const D3D11_MESSAGE_ID_LIVE_OBJECT_SUMMARY_WIN7 = D3D11_MESSAGE_ID.LIVE_OBJECT_SUMMARY_WIN7;
pub const D3D11_MESSAGE_ID_CREATE_COMPUTESHADER = D3D11_MESSAGE_ID.CREATE_COMPUTESHADER;
pub const D3D11_MESSAGE_ID_LIVE_COMPUTESHADER = D3D11_MESSAGE_ID.LIVE_COMPUTESHADER;
pub const D3D11_MESSAGE_ID_DESTROY_COMPUTESHADER = D3D11_MESSAGE_ID.DESTROY_COMPUTESHADER;
pub const D3D11_MESSAGE_ID_CREATE_UNORDEREDACCESSVIEW = D3D11_MESSAGE_ID.CREATE_UNORDEREDACCESSVIEW;
pub const D3D11_MESSAGE_ID_LIVE_UNORDEREDACCESSVIEW = D3D11_MESSAGE_ID.LIVE_UNORDEREDACCESSVIEW;
pub const D3D11_MESSAGE_ID_DESTROY_UNORDEREDACCESSVIEW = D3D11_MESSAGE_ID.DESTROY_UNORDEREDACCESSVIEW;
pub const D3D11_MESSAGE_ID_DEVICE_SETSHADER_INTERFACES_FEATURELEVEL = D3D11_MESSAGE_ID.DEVICE_SETSHADER_INTERFACES_FEATURELEVEL;
pub const D3D11_MESSAGE_ID_DEVICE_SETSHADER_INTERFACE_COUNT_MISMATCH = D3D11_MESSAGE_ID.DEVICE_SETSHADER_INTERFACE_COUNT_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE = D3D11_MESSAGE_ID.DEVICE_SETSHADER_INVALID_INSTANCE;
pub const D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE_INDEX = D3D11_MESSAGE_ID.DEVICE_SETSHADER_INVALID_INSTANCE_INDEX;
pub const D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE_TYPE = D3D11_MESSAGE_ID.DEVICE_SETSHADER_INVALID_INSTANCE_TYPE;
pub const D3D11_MESSAGE_ID_DEVICE_SETSHADER_INVALID_INSTANCE_DATA = D3D11_MESSAGE_ID.DEVICE_SETSHADER_INVALID_INSTANCE_DATA;
pub const D3D11_MESSAGE_ID_DEVICE_SETSHADER_UNBOUND_INSTANCE_DATA = D3D11_MESSAGE_ID.DEVICE_SETSHADER_UNBOUND_INSTANCE_DATA;
pub const D3D11_MESSAGE_ID_DEVICE_SETSHADER_INSTANCE_DATA_BINDINGS = D3D11_MESSAGE_ID.DEVICE_SETSHADER_INSTANCE_DATA_BINDINGS;
pub const D3D11_MESSAGE_ID_DEVICE_CREATESHADER_CLASSLINKAGE_FULL = D3D11_MESSAGE_ID.DEVICE_CREATESHADER_CLASSLINKAGE_FULL;
pub const D3D11_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_UNRECOGNIZED_FEATURE = D3D11_MESSAGE_ID.DEVICE_CHECKFEATURESUPPORT_UNRECOGNIZED_FEATURE;
pub const D3D11_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_MISMATCHED_DATA_SIZE = D3D11_MESSAGE_ID.DEVICE_CHECKFEATURESUPPORT_MISMATCHED_DATA_SIZE;
pub const D3D11_MESSAGE_ID_DEVICE_CHECKFEATURESUPPORT_INVALIDARG_RETURN = D3D11_MESSAGE_ID.DEVICE_CHECKFEATURESUPPORT_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_DEVICE_CSSETSHADERRESOURCES_HAZARD = D3D11_MESSAGE_ID.DEVICE_CSSETSHADERRESOURCES_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_CSSETCONSTANTBUFFERS_HAZARD = D3D11_MESSAGE_ID.DEVICE_CSSETCONSTANTBUFFERS_HAZARD;
pub const D3D11_MESSAGE_ID_CSSETSHADERRESOURCES_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.CSSETSHADERRESOURCES_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_CSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.CSSETCONSTANTBUFFERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCALL = D3D11_MESSAGE_ID.CREATECOMPUTESHADER_INVALIDCALL;
pub const D3D11_MESSAGE_ID_CREATECOMPUTESHADER_OUTOFMEMORY = D3D11_MESSAGE_ID.CREATECOMPUTESHADER_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDSHADERBYTECODE = D3D11_MESSAGE_ID.CREATECOMPUTESHADER_INVALIDSHADERBYTECODE;
pub const D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDSHADERTYPE = D3D11_MESSAGE_ID.CREATECOMPUTESHADER_INVALIDSHADERTYPE;
pub const D3D11_MESSAGE_ID_CREATECOMPUTESHADER_INVALIDCLASSLINKAGE = D3D11_MESSAGE_ID.CREATECOMPUTESHADER_INVALIDCLASSLINKAGE;
pub const D3D11_MESSAGE_ID_DEVICE_CSSETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_CSSETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_CSSETCONSTANTBUFFERS_INVALIDBUFFER = D3D11_MESSAGE_ID.CSSETCONSTANTBUFFERS_INVALIDBUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_CSSETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_CSSETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_CSSETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_CSSETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_CSGETSHADERRESOURCES_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_CSGETSHADERRESOURCES_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_CSGETCONSTANTBUFFERS_BUFFERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_CSGETCONSTANTBUFFERS_BUFFERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_CSGETSAMPLERS_SAMPLERS_EMPTY = D3D11_MESSAGE_ID.DEVICE_CSGETSAMPLERS_SAMPLERS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEFLOATOPSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEVERTEXSHADER_DOUBLEFLOATOPSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEFLOATOPSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEHULLSHADER_DOUBLEFLOATOPSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEFLOATOPSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEDOMAINSHADER_DOUBLEFLOATOPSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEFLOATOPSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEGEOMETRYSHADER_DOUBLEFLOATOPSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEFLOATOPSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEFLOATOPSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEFLOATOPSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEPIXELSHADER_DOUBLEFLOATOPSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEFLOATOPSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATECOMPUTESHADER_DOUBLEFLOATOPSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDSTRUCTURESTRIDE = D3D11_MESSAGE_ID.CREATEBUFFER_INVALIDSTRUCTURESTRIDE;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDFLAGS = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDRESOURCE = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_INVALIDRESOURCE;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDESC = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_INVALIDDESC;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_INVALIDFORMAT;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_INVALIDDIMENSIONS;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_UNRECOGNIZEDFORMAT = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_UNRECOGNIZEDFORMAT;
pub const D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_HAZARD = D3D11_MESSAGE_ID.DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_HAZARD;
pub const D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_OVERLAPPING_OLD_SLOTS = D3D11_MESSAGE_ID.DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_OVERLAPPING_OLD_SLOTS;
pub const D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NO_OP = D3D11_MESSAGE_ID.DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NO_OP;
pub const D3D11_MESSAGE_ID_CSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.CSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_PSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.PSSETUNORDEREDACCESSVIEWS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDARG_RETURN = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_TOOMANYOBJECTS = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_TOOMANYOBJECTS;
pub const D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_HAZARD = D3D11_MESSAGE_ID.DEVICE_CSSETUNORDEREDACCESSVIEWS_HAZARD;
pub const D3D11_MESSAGE_ID_CLEARUNORDEREDACCESSVIEW_DENORMFLUSH = D3D11_MESSAGE_ID.CLEARUNORDEREDACCESSVIEW_DENORMFLUSH;
pub const D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSS_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_CSSETUNORDEREDACCESSS_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_DEVICE_CSGETUNORDEREDACCESSS_VIEWS_EMPTY = D3D11_MESSAGE_ID.DEVICE_CSGETUNORDEREDACCESSS_VIEWS_EMPTY;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDFLAGS = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_CREATESHADERRESESOURCEVIEW_TOOMANYOBJECTS = D3D11_MESSAGE_ID.CREATESHADERRESESOURCEVIEW_TOOMANYOBJECTS;
pub const D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_INVALID_ARG_BUFFER = D3D11_MESSAGE_ID.DEVICE_DISPATCHINDIRECT_INVALID_ARG_BUFFER;
pub const D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_UNALIGNED = D3D11_MESSAGE_ID.DEVICE_DISPATCHINDIRECT_OFFSET_UNALIGNED;
pub const D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_OFFSET_OVERFLOW = D3D11_MESSAGE_ID.DEVICE_DISPATCHINDIRECT_OFFSET_OVERFLOW;
pub const D3D11_MESSAGE_ID_DEVICE_SETRESOURCEMINLOD_INVALIDCONTEXT = D3D11_MESSAGE_ID.DEVICE_SETRESOURCEMINLOD_INVALIDCONTEXT;
pub const D3D11_MESSAGE_ID_DEVICE_SETRESOURCEMINLOD_INVALIDRESOURCE = D3D11_MESSAGE_ID.DEVICE_SETRESOURCEMINLOD_INVALIDRESOURCE;
pub const D3D11_MESSAGE_ID_DEVICE_SETRESOURCEMINLOD_INVALIDMINLOD = D3D11_MESSAGE_ID.DEVICE_SETRESOURCEMINLOD_INVALIDMINLOD;
pub const D3D11_MESSAGE_ID_DEVICE_GETRESOURCEMINLOD_INVALIDCONTEXT = D3D11_MESSAGE_ID.DEVICE_GETRESOURCEMINLOD_INVALIDCONTEXT;
pub const D3D11_MESSAGE_ID_DEVICE_GETRESOURCEMINLOD_INVALIDRESOURCE = D3D11_MESSAGE_ID.DEVICE_GETRESOURCEMINLOD_INVALIDRESOURCE;
pub const D3D11_MESSAGE_ID_OMSETDEPTHSTENCIL_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.OMSETDEPTHSTENCIL_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_DEPTH_READONLY = D3D11_MESSAGE_ID.CLEARDEPTHSTENCILVIEW_DEPTH_READONLY;
pub const D3D11_MESSAGE_ID_CLEARDEPTHSTENCILVIEW_STENCIL_READONLY = D3D11_MESSAGE_ID.CLEARDEPTHSTENCILVIEW_STENCIL_READONLY;
pub const D3D11_MESSAGE_ID_CHECKFEATURESUPPORT_FORMAT_DEPRECATED = D3D11_MESSAGE_ID.CHECKFEATURESUPPORT_FORMAT_DEPRECATED;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RETURN_TYPE_MISMATCH = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_RETURN_TYPE_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_NOT_SET = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_NOT_SET;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_UNORDEREDACCESSVIEW_RENDERTARGETVIEW_OVERLAP = D3D11_MESSAGE_ID.DEVICE_DRAW_UNORDEREDACCESSVIEW_RENDERTARGETVIEW_OVERLAP;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_DIMENSION_MISMATCH = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_DIMENSION_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_APPEND_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_APPEND_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMICS_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_ATOMICS_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_STRUCTURE_STRIDE_MISMATCH = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_STRUCTURE_STRIDE_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_BUFFER_TYPE_MISMATCH = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_BUFFER_TYPE_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_RAW_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_RAW_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_LD_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_FORMAT_LD_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_FORMAT_STORE_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_FORMAT_STORE_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_ADD_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_ATOMIC_ADD_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_BITWISE_OPS_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_ATOMIC_BITWISE_OPS_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_CMPSTORE_CMPEXCHANGE_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_ATOMIC_CMPSTORE_CMPEXCHANGE_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_EXCHANGE_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_ATOMIC_EXCHANGE_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_SIGNED_MINMAX_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_ATOMIC_SIGNED_MINMAX_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_ATOMIC_UNSIGNED_MINMAX_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_ATOMIC_UNSIGNED_MINMAX_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_DISPATCH_BOUND_RESOURCE_MAPPED = D3D11_MESSAGE_ID.DEVICE_DISPATCH_BOUND_RESOURCE_MAPPED;
pub const D3D11_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_OVERFLOW = D3D11_MESSAGE_ID.DEVICE_DISPATCH_THREADGROUPCOUNT_OVERFLOW;
pub const D3D11_MESSAGE_ID_DEVICE_DISPATCH_THREADGROUPCOUNT_ZERO = D3D11_MESSAGE_ID.DEVICE_DISPATCH_THREADGROUPCOUNT_ZERO;
pub const D3D11_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_STRUCTURE_STRIDE_MISMATCH = D3D11_MESSAGE_ID.DEVICE_SHADERRESOURCEVIEW_STRUCTURE_STRIDE_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_BUFFER_TYPE_MISMATCH = D3D11_MESSAGE_ID.DEVICE_SHADERRESOURCEVIEW_BUFFER_TYPE_MISMATCH;
pub const D3D11_MESSAGE_ID_DEVICE_SHADERRESOURCEVIEW_RAW_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_SHADERRESOURCEVIEW_RAW_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_DISPATCH_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_DISPATCH_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_DISPATCHINDIRECT_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_DISPATCHINDIRECT_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDOFFSET = D3D11_MESSAGE_ID.COPYSTRUCTURECOUNT_INVALIDOFFSET;
pub const D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_LARGEOFFSET = D3D11_MESSAGE_ID.COPYSTRUCTURECOUNT_LARGEOFFSET;
pub const D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDDESTINATIONSTATE = D3D11_MESSAGE_ID.COPYSTRUCTURECOUNT_INVALIDDESTINATIONSTATE;
pub const D3D11_MESSAGE_ID_COPYSTRUCTURECOUNT_INVALIDSOURCESTATE = D3D11_MESSAGE_ID.COPYSTRUCTURECOUNT_INVALIDSOURCESTATE;
pub const D3D11_MESSAGE_ID_CHECKFORMATSUPPORT_FORMAT_NOT_SUPPORTED = D3D11_MESSAGE_ID.CHECKFORMATSUPPORT_FORMAT_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDVIEW = D3D11_MESSAGE_ID.DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDVIEW;
pub const D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDOFFSET = D3D11_MESSAGE_ID.DEVICE_CSSETUNORDEREDACCESSVIEWS_INVALIDOFFSET;
pub const D3D11_MESSAGE_ID_DEVICE_CSSETUNORDEREDACCESSVIEWS_TOOMANYVIEWS = D3D11_MESSAGE_ID.DEVICE_CSSETUNORDEREDACCESSVIEWS_TOOMANYVIEWS;
pub const D3D11_MESSAGE_ID_CLEARUNORDEREDACCESSVIEWFLOAT_INVALIDFORMAT = D3D11_MESSAGE_ID.CLEARUNORDEREDACCESSVIEWFLOAT_INVALIDFORMAT;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_COUNTER_UNSUPPORTED = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_COUNTER_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_REF_WARNING = D3D11_MESSAGE_ID.REF_WARNING;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_PIXEL_SHADER_WITHOUT_RTV_OR_DSV = D3D11_MESSAGE_ID.DEVICE_DRAW_PIXEL_SHADER_WITHOUT_RTV_OR_DSV;
pub const D3D11_MESSAGE_ID_SHADER_ABORT = D3D11_MESSAGE_ID.SHADER_ABORT;
pub const D3D11_MESSAGE_ID_SHADER_MESSAGE = D3D11_MESSAGE_ID.SHADER_MESSAGE;
pub const D3D11_MESSAGE_ID_SHADER_ERROR = D3D11_MESSAGE_ID.SHADER_ERROR;
pub const D3D11_MESSAGE_ID_OFFERRESOURCES_INVALIDRESOURCE = D3D11_MESSAGE_ID.OFFERRESOURCES_INVALIDRESOURCE;
pub const D3D11_MESSAGE_ID_HSSETSAMPLERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.HSSETSAMPLERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_DSSETSAMPLERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.DSSETSAMPLERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_CSSETSAMPLERS_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.CSSETSAMPLERS_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_HSSETSHADER_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.HSSETSHADER_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_DSSETSHADER_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.DSSETSHADER_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_CSSETSHADER_UNBINDDELETINGOBJECT = D3D11_MESSAGE_ID.CSSETSHADER_UNBINDDELETINGOBJECT;
pub const D3D11_MESSAGE_ID_ENQUEUESETEVENT_INVALIDARG_RETURN = D3D11_MESSAGE_ID.ENQUEUESETEVENT_INVALIDARG_RETURN;
pub const D3D11_MESSAGE_ID_ENQUEUESETEVENT_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.ENQUEUESETEVENT_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_ENQUEUESETEVENT_ACCESSDENIED_RETURN = D3D11_MESSAGE_ID.ENQUEUESETEVENT_ACCESSDENIED_RETURN;
pub const D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NUMUAVS_INVALIDRANGE = D3D11_MESSAGE_ID.DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_NUMUAVS_INVALIDRANGE;
pub const D3D11_MESSAGE_ID_USE_OF_ZERO_REFCOUNT_OBJECT = D3D11_MESSAGE_ID.USE_OF_ZERO_REFCOUNT_OBJECT;
pub const D3D11_MESSAGE_ID_D3D11_MESSAGES_END = D3D11_MESSAGE_ID.D3D11_MESSAGES_END;
pub const D3D11_MESSAGE_ID_D3D11_1_MESSAGES_START = D3D11_MESSAGE_ID.D3D11_1_MESSAGES_START;
pub const D3D11_MESSAGE_ID_CREATE_VIDEODECODER = D3D11_MESSAGE_ID.CREATE_VIDEODECODER;
pub const D3D11_MESSAGE_ID_CREATE_VIDEOPROCESSORENUM = D3D11_MESSAGE_ID.CREATE_VIDEOPROCESSORENUM;
pub const D3D11_MESSAGE_ID_CREATE_VIDEOPROCESSOR = D3D11_MESSAGE_ID.CREATE_VIDEOPROCESSOR;
pub const D3D11_MESSAGE_ID_CREATE_DECODEROUTPUTVIEW = D3D11_MESSAGE_ID.CREATE_DECODEROUTPUTVIEW;
pub const D3D11_MESSAGE_ID_CREATE_PROCESSORINPUTVIEW = D3D11_MESSAGE_ID.CREATE_PROCESSORINPUTVIEW;
pub const D3D11_MESSAGE_ID_CREATE_PROCESSOROUTPUTVIEW = D3D11_MESSAGE_ID.CREATE_PROCESSOROUTPUTVIEW;
pub const D3D11_MESSAGE_ID_CREATE_DEVICECONTEXTSTATE = D3D11_MESSAGE_ID.CREATE_DEVICECONTEXTSTATE;
pub const D3D11_MESSAGE_ID_LIVE_VIDEODECODER = D3D11_MESSAGE_ID.LIVE_VIDEODECODER;
pub const D3D11_MESSAGE_ID_LIVE_VIDEOPROCESSORENUM = D3D11_MESSAGE_ID.LIVE_VIDEOPROCESSORENUM;
pub const D3D11_MESSAGE_ID_LIVE_VIDEOPROCESSOR = D3D11_MESSAGE_ID.LIVE_VIDEOPROCESSOR;
pub const D3D11_MESSAGE_ID_LIVE_DECODEROUTPUTVIEW = D3D11_MESSAGE_ID.LIVE_DECODEROUTPUTVIEW;
pub const D3D11_MESSAGE_ID_LIVE_PROCESSORINPUTVIEW = D3D11_MESSAGE_ID.LIVE_PROCESSORINPUTVIEW;
pub const D3D11_MESSAGE_ID_LIVE_PROCESSOROUTPUTVIEW = D3D11_MESSAGE_ID.LIVE_PROCESSOROUTPUTVIEW;
pub const D3D11_MESSAGE_ID_LIVE_DEVICECONTEXTSTATE = D3D11_MESSAGE_ID.LIVE_DEVICECONTEXTSTATE;
pub const D3D11_MESSAGE_ID_DESTROY_VIDEODECODER = D3D11_MESSAGE_ID.DESTROY_VIDEODECODER;
pub const D3D11_MESSAGE_ID_DESTROY_VIDEOPROCESSORENUM = D3D11_MESSAGE_ID.DESTROY_VIDEOPROCESSORENUM;
pub const D3D11_MESSAGE_ID_DESTROY_VIDEOPROCESSOR = D3D11_MESSAGE_ID.DESTROY_VIDEOPROCESSOR;
pub const D3D11_MESSAGE_ID_DESTROY_DECODEROUTPUTVIEW = D3D11_MESSAGE_ID.DESTROY_DECODEROUTPUTVIEW;
pub const D3D11_MESSAGE_ID_DESTROY_PROCESSORINPUTVIEW = D3D11_MESSAGE_ID.DESTROY_PROCESSORINPUTVIEW;
pub const D3D11_MESSAGE_ID_DESTROY_PROCESSOROUTPUTVIEW = D3D11_MESSAGE_ID.DESTROY_PROCESSOROUTPUTVIEW;
pub const D3D11_MESSAGE_ID_DESTROY_DEVICECONTEXTSTATE = D3D11_MESSAGE_ID.DESTROY_DEVICECONTEXTSTATE;
pub const D3D11_MESSAGE_ID_CREATEDEVICECONTEXTSTATE_INVALIDFLAGS = D3D11_MESSAGE_ID.CREATEDEVICECONTEXTSTATE_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_CREATEDEVICECONTEXTSTATE_INVALIDFEATURELEVEL = D3D11_MESSAGE_ID.CREATEDEVICECONTEXTSTATE_INVALIDFEATURELEVEL;
pub const D3D11_MESSAGE_ID_CREATEDEVICECONTEXTSTATE_FEATURELEVELS_NOT_SUPPORTED = D3D11_MESSAGE_ID.CREATEDEVICECONTEXTSTATE_FEATURELEVELS_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_CREATEDEVICECONTEXTSTATE_INVALIDREFIID = D3D11_MESSAGE_ID.CREATEDEVICECONTEXTSTATE_INVALIDREFIID;
pub const D3D11_MESSAGE_ID_DEVICE_DISCARDVIEW_INVALIDVIEW = D3D11_MESSAGE_ID.DEVICE_DISCARDVIEW_INVALIDVIEW;
pub const D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION1_INVALIDCOPYFLAGS = D3D11_MESSAGE_ID.COPYSUBRESOURCEREGION1_INVALIDCOPYFLAGS;
pub const D3D11_MESSAGE_ID_UPDATESUBRESOURCE1_INVALIDCOPYFLAGS = D3D11_MESSAGE_ID.UPDATESUBRESOURCE1_INVALIDCOPYFLAGS;
pub const D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALIDFORCEDSAMPLECOUNT = D3D11_MESSAGE_ID.CREATERASTERIZERSTATE_INVALIDFORCEDSAMPLECOUNT;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODER_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEVIDEODECODER_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODER_NULLPARAM = D3D11_MESSAGE_ID.CREATEVIDEODECODER_NULLPARAM;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODER_INVALIDFORMAT = D3D11_MESSAGE_ID.CREATEVIDEODECODER_INVALIDFORMAT;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODER_ZEROWIDTHHEIGHT = D3D11_MESSAGE_ID.CREATEVIDEODECODER_ZEROWIDTHHEIGHT;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODER_DRIVER_INVALIDBUFFERSIZE = D3D11_MESSAGE_ID.CREATEVIDEODECODER_DRIVER_INVALIDBUFFERSIZE;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODER_DRIVER_INVALIDBUFFERUSAGE = D3D11_MESSAGE_ID.CREATEVIDEODECODER_DRIVER_INVALIDBUFFERUSAGE;
pub const D3D11_MESSAGE_ID_GETVIDEODECODERPROFILECOUNT_OUTOFMEMORY = D3D11_MESSAGE_ID.GETVIDEODECODERPROFILECOUNT_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_GETVIDEODECODERPROFILE_NULLPARAM = D3D11_MESSAGE_ID.GETVIDEODECODERPROFILE_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETVIDEODECODERPROFILE_INVALIDINDEX = D3D11_MESSAGE_ID.GETVIDEODECODERPROFILE_INVALIDINDEX;
pub const D3D11_MESSAGE_ID_GETVIDEODECODERPROFILE_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.GETVIDEODECODERPROFILE_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CHECKVIDEODECODERFORMAT_NULLPARAM = D3D11_MESSAGE_ID.CHECKVIDEODECODERFORMAT_NULLPARAM;
pub const D3D11_MESSAGE_ID_CHECKVIDEODECODERFORMAT_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CHECKVIDEODECODERFORMAT_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_GETVIDEODECODERCONFIGCOUNT_NULLPARAM = D3D11_MESSAGE_ID.GETVIDEODECODERCONFIGCOUNT_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETVIDEODECODERCONFIGCOUNT_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.GETVIDEODECODERCONFIGCOUNT_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_GETVIDEODECODERCONFIG_NULLPARAM = D3D11_MESSAGE_ID.GETVIDEODECODERCONFIG_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETVIDEODECODERCONFIG_INVALIDINDEX = D3D11_MESSAGE_ID.GETVIDEODECODERCONFIG_INVALIDINDEX;
pub const D3D11_MESSAGE_ID_GETVIDEODECODERCONFIG_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.GETVIDEODECODERCONFIG_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_GETDECODERCREATIONPARAMS_NULLPARAM = D3D11_MESSAGE_ID.GETDECODERCREATIONPARAMS_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETDECODERDRIVERHANDLE_NULLPARAM = D3D11_MESSAGE_ID.GETDECODERDRIVERHANDLE_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETDECODERBUFFER_NULLPARAM = D3D11_MESSAGE_ID.GETDECODERBUFFER_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETDECODERBUFFER_INVALIDBUFFER = D3D11_MESSAGE_ID.GETDECODERBUFFER_INVALIDBUFFER;
pub const D3D11_MESSAGE_ID_GETDECODERBUFFER_INVALIDTYPE = D3D11_MESSAGE_ID.GETDECODERBUFFER_INVALIDTYPE;
pub const D3D11_MESSAGE_ID_GETDECODERBUFFER_LOCKED = D3D11_MESSAGE_ID.GETDECODERBUFFER_LOCKED;
pub const D3D11_MESSAGE_ID_RELEASEDECODERBUFFER_NULLPARAM = D3D11_MESSAGE_ID.RELEASEDECODERBUFFER_NULLPARAM;
pub const D3D11_MESSAGE_ID_RELEASEDECODERBUFFER_INVALIDTYPE = D3D11_MESSAGE_ID.RELEASEDECODERBUFFER_INVALIDTYPE;
pub const D3D11_MESSAGE_ID_RELEASEDECODERBUFFER_NOTLOCKED = D3D11_MESSAGE_ID.RELEASEDECODERBUFFER_NOTLOCKED;
pub const D3D11_MESSAGE_ID_DECODERBEGINFRAME_NULLPARAM = D3D11_MESSAGE_ID.DECODERBEGINFRAME_NULLPARAM;
pub const D3D11_MESSAGE_ID_DECODERBEGINFRAME_HAZARD = D3D11_MESSAGE_ID.DECODERBEGINFRAME_HAZARD;
pub const D3D11_MESSAGE_ID_DECODERENDFRAME_NULLPARAM = D3D11_MESSAGE_ID.DECODERENDFRAME_NULLPARAM;
pub const D3D11_MESSAGE_ID_SUBMITDECODERBUFFERS_NULLPARAM = D3D11_MESSAGE_ID.SUBMITDECODERBUFFERS_NULLPARAM;
pub const D3D11_MESSAGE_ID_SUBMITDECODERBUFFERS_INVALIDTYPE = D3D11_MESSAGE_ID.SUBMITDECODERBUFFERS_INVALIDTYPE;
pub const D3D11_MESSAGE_ID_DECODEREXTENSION_NULLPARAM = D3D11_MESSAGE_ID.DECODEREXTENSION_NULLPARAM;
pub const D3D11_MESSAGE_ID_DECODEREXTENSION_INVALIDRESOURCE = D3D11_MESSAGE_ID.DECODEREXTENSION_INVALIDRESOURCE;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORENUMERATOR_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORENUMERATOR_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORENUMERATOR_NULLPARAM = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORENUMERATOR_NULLPARAM;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORENUMERATOR_INVALIDFRAMEFORMAT = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORENUMERATOR_INVALIDFRAMEFORMAT;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORENUMERATOR_INVALIDUSAGE = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORENUMERATOR_INVALIDUSAGE;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORENUMERATOR_INVALIDINPUTFRAMERATE = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORENUMERATOR_INVALIDINPUTFRAMERATE;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORENUMERATOR_INVALIDOUTPUTFRAMERATE = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORENUMERATOR_INVALIDOUTPUTFRAMERATE;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORENUMERATOR_INVALIDWIDTHHEIGHT = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORENUMERATOR_INVALIDWIDTHHEIGHT;
pub const D3D11_MESSAGE_ID_GETVIDEOPROCESSORCONTENTDESC_NULLPARAM = D3D11_MESSAGE_ID.GETVIDEOPROCESSORCONTENTDESC_NULLPARAM;
pub const D3D11_MESSAGE_ID_CHECKVIDEOPROCESSORFORMAT_NULLPARAM = D3D11_MESSAGE_ID.CHECKVIDEOPROCESSORFORMAT_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETVIDEOPROCESSORCAPS_NULLPARAM = D3D11_MESSAGE_ID.GETVIDEOPROCESSORCAPS_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETVIDEOPROCESSORRATECONVERSIONCAPS_NULLPARAM = D3D11_MESSAGE_ID.GETVIDEOPROCESSORRATECONVERSIONCAPS_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETVIDEOPROCESSORRATECONVERSIONCAPS_INVALIDINDEX = D3D11_MESSAGE_ID.GETVIDEOPROCESSORRATECONVERSIONCAPS_INVALIDINDEX;
pub const D3D11_MESSAGE_ID_GETVIDEOPROCESSORCUSTOMRATE_NULLPARAM = D3D11_MESSAGE_ID.GETVIDEOPROCESSORCUSTOMRATE_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETVIDEOPROCESSORCUSTOMRATE_INVALIDINDEX = D3D11_MESSAGE_ID.GETVIDEOPROCESSORCUSTOMRATE_INVALIDINDEX;
pub const D3D11_MESSAGE_ID_GETVIDEOPROCESSORFILTERRANGE_NULLPARAM = D3D11_MESSAGE_ID.GETVIDEOPROCESSORFILTERRANGE_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETVIDEOPROCESSORFILTERRANGE_UNSUPPORTED = D3D11_MESSAGE_ID.GETVIDEOPROCESSORFILTERRANGE_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOR_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOR_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOR_NULLPARAM = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOR_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTTARGETRECT_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTTARGETRECT_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTBACKGROUNDCOLOR_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTBACKGROUNDCOLOR_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTBACKGROUNDCOLOR_INVALIDALPHA = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTBACKGROUNDCOLOR_INVALIDALPHA;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTCOLORSPACE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTCOLORSPACE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_INVALIDFILLMODE = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTALPHAFILLMODE_INVALIDFILLMODE;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTCONSTRICTION_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTCONSTRICTION_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTSTEREOMODE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTSTEREOMODE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTSTEREOMODE_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTSTEREOMODE_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTEXTENSION_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTEXTENSION_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTTARGETRECT_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETOUTPUTTARGETRECT_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTBACKGROUNDCOLOR_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETOUTPUTBACKGROUNDCOLOR_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTCOLORSPACE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETOUTPUTCOLORSPACE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTALPHAFILLMODE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETOUTPUTALPHAFILLMODE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTCONSTRICTION_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETOUTPUTCONSTRICTION_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTCONSTRICTION_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTCONSTRICTION_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTCONSTRICTION_INVALIDSIZE = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTCONSTRICTION_INVALIDSIZE;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTSTEREOMODE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETOUTPUTSTEREOMODE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTEXTENSION_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETOUTPUTEXTENSION_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMFRAMEFORMAT_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMFRAMEFORMAT_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMFRAMEFORMAT_INVALIDFORMAT = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMFRAMEFORMAT_INVALIDFORMAT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMFRAMEFORMAT_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMFRAMEFORMAT_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMCOLORSPACE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMCOLORSPACE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMCOLORSPACE_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMCOLORSPACE_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMOUTPUTRATE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMOUTPUTRATE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDRATE = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDRATE;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDFLAG = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDFLAG;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMOUTPUTRATE_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMSOURCERECT_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMSOURCERECT_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMSOURCERECT_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMSOURCERECT_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMSOURCERECT_INVALIDRECT = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMSOURCERECT_INVALIDRECT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMDESTRECT_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMDESTRECT_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMDESTRECT_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMDESTRECT_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMDESTRECT_INVALIDRECT = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMDESTRECT_INVALIDRECT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMALPHA_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMALPHA_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMALPHA_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMALPHA_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMALPHA_INVALIDALPHA = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMALPHA_INVALIDALPHA;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMPALETTE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMPALETTE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMPALETTE_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMPALETTE_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMPALETTE_INVALIDCOUNT = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMPALETTE_INVALIDCOUNT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMPALETTE_INVALIDALPHA = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMPALETTE_INVALIDALPHA;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_INVALIDRATIO = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_INVALIDRATIO;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMLUMAKEY_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMLUMAKEY_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMLUMAKEY_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMLUMAKEY_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMLUMAKEY_INVALIDRANGE = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMLUMAKEY_INVALIDRANGE;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMLUMAKEY_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMLUMAKEY_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMSTEREOFORMAT_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMSTEREOFORMAT_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMSTEREOFORMAT_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMSTEREOFORMAT_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMSTEREOFORMAT_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMSTEREOFORMAT_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMSTEREOFORMAT_FLIPUNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMSTEREOFORMAT_FLIPUNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMSTEREOFORMAT_MONOOFFSETUNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMSTEREOFORMAT_MONOOFFSETUNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMSTEREOFORMAT_FORMATUNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMSTEREOFORMAT_FORMATUNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMSTEREOFORMAT_INVALIDFORMAT = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMSTEREOFORMAT_INVALIDFORMAT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMAUTOPROCESSINGMODE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMAUTOPROCESSINGMODE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMAUTOPROCESSINGMODE_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMAUTOPROCESSINGMODE_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMFILTER_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMFILTER_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMFILTER_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMFILTER_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMFILTER_INVALIDFILTER = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMFILTER_INVALIDFILTER;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMFILTER_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMFILTER_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMFILTER_INVALIDLEVEL = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMFILTER_INVALIDLEVEL;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMEXTENSION_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMEXTENSION_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMEXTENSION_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMEXTENSION_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMFRAMEFORMAT_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMFRAMEFORMAT_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMCOLORSPACE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMCOLORSPACE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMOUTPUTRATE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMOUTPUTRATE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMSOURCERECT_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMSOURCERECT_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMDESTRECT_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMDESTRECT_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMALPHA_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMALPHA_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMPALETTE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMPALETTE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMPIXELASPECTRATIO_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMPIXELASPECTRATIO_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMLUMAKEY_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMLUMAKEY_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMSTEREOFORMAT_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMSTEREOFORMAT_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMAUTOPROCESSINGMODE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMAUTOPROCESSINGMODE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMFILTER_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMFILTER_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMEXTENSION_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMEXTENSION_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMEXTENSION_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMEXTENSION_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_INVALIDSTREAMCOUNT = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_INVALIDSTREAMCOUNT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_TARGETRECT = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_TARGETRECT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_INVALIDOUTPUT = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_INVALIDOUTPUT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_INVALIDPASTFRAMES = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_INVALIDPASTFRAMES;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_INVALIDFUTUREFRAMES = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_INVALIDFUTUREFRAMES;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_INVALIDSOURCERECT = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_INVALIDSOURCERECT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_INVALIDDESTRECT = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_INVALIDDESTRECT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_INVALIDINPUTRESOURCE = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_INVALIDINPUTRESOURCE;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_INVALIDARRAYSIZE = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_INVALIDARRAYSIZE;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_INVALIDARRAY = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_INVALIDARRAY;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_RIGHTEXPECTED = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_RIGHTEXPECTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_RIGHTNOTEXPECTED = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_RIGHTNOTEXPECTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_STEREONOTENABLED = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_STEREONOTENABLED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_INVALIDRIGHTRESOURCE = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_INVALIDRIGHTRESOURCE;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_NOSTEREOSTREAMS = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_NOSTEREOSTREAMS;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_INPUTHAZARD = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_INPUTHAZARD;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORBLT_OUTPUTHAZARD = D3D11_MESSAGE_ID.VIDEOPROCESSORBLT_OUTPUTHAZARD;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODEROUTPUTVIEW_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEVIDEODECODEROUTPUTVIEW_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODEROUTPUTVIEW_NULLPARAM = D3D11_MESSAGE_ID.CREATEVIDEODECODEROUTPUTVIEW_NULLPARAM;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODEROUTPUTVIEW_INVALIDTYPE = D3D11_MESSAGE_ID.CREATEVIDEODECODEROUTPUTVIEW_INVALIDTYPE;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODEROUTPUTVIEW_INVALIDBIND = D3D11_MESSAGE_ID.CREATEVIDEODECODEROUTPUTVIEW_INVALIDBIND;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODEROUTPUTVIEW_UNSUPPORTEDFORMAT = D3D11_MESSAGE_ID.CREATEVIDEODECODEROUTPUTVIEW_UNSUPPORTEDFORMAT;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODEROUTPUTVIEW_INVALIDMIP = D3D11_MESSAGE_ID.CREATEVIDEODECODEROUTPUTVIEW_INVALIDMIP;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODEROUTPUTVIEW_UNSUPPORTEMIP = D3D11_MESSAGE_ID.CREATEVIDEODECODEROUTPUTVIEW_UNSUPPORTEMIP;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODEROUTPUTVIEW_INVALIDARRAYSIZE = D3D11_MESSAGE_ID.CREATEVIDEODECODEROUTPUTVIEW_INVALIDARRAYSIZE;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODEROUTPUTVIEW_INVALIDARRAY = D3D11_MESSAGE_ID.CREATEVIDEODECODEROUTPUTVIEW_INVALIDARRAY;
pub const D3D11_MESSAGE_ID_CREATEVIDEODECODEROUTPUTVIEW_INVALIDDIMENSION = D3D11_MESSAGE_ID.CREATEVIDEODECODEROUTPUTVIEW_INVALIDDIMENSION;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_NULLPARAM = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_NULLPARAM;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDTYPE = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_INVALIDTYPE;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDBIND = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_INVALIDBIND;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMISC = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMISC;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDUSAGE = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_INVALIDUSAGE;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDFORMAT = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_INVALIDFORMAT;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDFOURCC = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_INVALIDFOURCC;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMIP = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMIP;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_UNSUPPORTEDMIP = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_UNSUPPORTEDMIP;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDARRAYSIZE = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_INVALIDARRAYSIZE;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDARRAY = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_INVALIDARRAY;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDDIMENSION = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_INVALIDDIMENSION;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOROUTPUTVIEW_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_NULLPARAM = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOROUTPUTVIEW_NULLPARAM;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDTYPE = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDTYPE;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDBIND = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDBIND;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDFORMAT = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDFORMAT;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDMIP = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDMIP;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_UNSUPPORTEDMIP = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOROUTPUTVIEW_UNSUPPORTEDMIP;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_UNSUPPORTEDARRAY = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOROUTPUTVIEW_UNSUPPORTEDARRAY;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDARRAY = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDARRAY;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDDIMENSION = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDDIMENSION;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_INVALID_USE_OF_FORCED_SAMPLE_COUNT = D3D11_MESSAGE_ID.DEVICE_DRAW_INVALID_USE_OF_FORCED_SAMPLE_COUNT;
pub const D3D11_MESSAGE_ID_CREATEBLENDSTATE_INVALIDLOGICOPS = D3D11_MESSAGE_ID.CREATEBLENDSTATE_INVALIDLOGICOPS;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDDARRAYWITHDECODER = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDDARRAYWITHDECODER;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDDARRAYWITHDECODER = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_INVALIDDARRAYWITHDECODER;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDDARRAYWITHDECODER = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDDARRAYWITHDECODER;
pub const D3D11_MESSAGE_ID_DEVICE_LOCKEDOUT_INTERFACE = D3D11_MESSAGE_ID.DEVICE_LOCKEDOUT_INTERFACE;
pub const D3D11_MESSAGE_ID_REF_WARNING_ATOMIC_INCONSISTENT = D3D11_MESSAGE_ID.REF_WARNING_ATOMIC_INCONSISTENT;
pub const D3D11_MESSAGE_ID_REF_WARNING_READING_UNINITIALIZED_RESOURCE = D3D11_MESSAGE_ID.REF_WARNING_READING_UNINITIALIZED_RESOURCE;
pub const D3D11_MESSAGE_ID_REF_WARNING_RAW_HAZARD = D3D11_MESSAGE_ID.REF_WARNING_RAW_HAZARD;
pub const D3D11_MESSAGE_ID_REF_WARNING_WAR_HAZARD = D3D11_MESSAGE_ID.REF_WARNING_WAR_HAZARD;
pub const D3D11_MESSAGE_ID_REF_WARNING_WAW_HAZARD = D3D11_MESSAGE_ID.REF_WARNING_WAW_HAZARD;
pub const D3D11_MESSAGE_ID_CREATECRYPTOSESSION_NULLPARAM = D3D11_MESSAGE_ID.CREATECRYPTOSESSION_NULLPARAM;
pub const D3D11_MESSAGE_ID_CREATECRYPTOSESSION_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATECRYPTOSESSION_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_GETCRYPTOTYPE_NULLPARAM = D3D11_MESSAGE_ID.GETCRYPTOTYPE_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETDECODERPROFILE_NULLPARAM = D3D11_MESSAGE_ID.GETDECODERPROFILE_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETCRYPTOSESSIONCERTIFICATESIZE_NULLPARAM = D3D11_MESSAGE_ID.GETCRYPTOSESSIONCERTIFICATESIZE_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETCRYPTOSESSIONCERTIFICATE_NULLPARAM = D3D11_MESSAGE_ID.GETCRYPTOSESSIONCERTIFICATE_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETCRYPTOSESSIONCERTIFICATE_WRONGSIZE = D3D11_MESSAGE_ID.GETCRYPTOSESSIONCERTIFICATE_WRONGSIZE;
pub const D3D11_MESSAGE_ID_GETCRYPTOSESSIONHANDLE_WRONGSIZE = D3D11_MESSAGE_ID.GETCRYPTOSESSIONHANDLE_WRONGSIZE;
pub const D3D11_MESSAGE_ID_NEGOTIATECRPYTOSESSIONKEYEXCHANGE_NULLPARAM = D3D11_MESSAGE_ID.NEGOTIATECRPYTOSESSIONKEYEXCHANGE_NULLPARAM;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_UNSUPPORTED = D3D11_MESSAGE_ID.ENCRYPTIONBLT_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_NULLPARAM = D3D11_MESSAGE_ID.ENCRYPTIONBLT_NULLPARAM;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_SRC_WRONGDEVICE = D3D11_MESSAGE_ID.ENCRYPTIONBLT_SRC_WRONGDEVICE;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_DST_WRONGDEVICE = D3D11_MESSAGE_ID.ENCRYPTIONBLT_DST_WRONGDEVICE;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_FORMAT_MISMATCH = D3D11_MESSAGE_ID.ENCRYPTIONBLT_FORMAT_MISMATCH;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_SIZE_MISMATCH = D3D11_MESSAGE_ID.ENCRYPTIONBLT_SIZE_MISMATCH;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_SRC_MULTISAMPLED = D3D11_MESSAGE_ID.ENCRYPTIONBLT_SRC_MULTISAMPLED;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_DST_NOT_STAGING = D3D11_MESSAGE_ID.ENCRYPTIONBLT_DST_NOT_STAGING;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_SRC_MAPPED = D3D11_MESSAGE_ID.ENCRYPTIONBLT_SRC_MAPPED;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_DST_MAPPED = D3D11_MESSAGE_ID.ENCRYPTIONBLT_DST_MAPPED;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_SRC_OFFERED = D3D11_MESSAGE_ID.ENCRYPTIONBLT_SRC_OFFERED;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_DST_OFFERED = D3D11_MESSAGE_ID.ENCRYPTIONBLT_DST_OFFERED;
pub const D3D11_MESSAGE_ID_ENCRYPTIONBLT_SRC_CONTENT_UNDEFINED = D3D11_MESSAGE_ID.ENCRYPTIONBLT_SRC_CONTENT_UNDEFINED;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_UNSUPPORTED = D3D11_MESSAGE_ID.DECRYPTIONBLT_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_NULLPARAM = D3D11_MESSAGE_ID.DECRYPTIONBLT_NULLPARAM;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_SRC_WRONGDEVICE = D3D11_MESSAGE_ID.DECRYPTIONBLT_SRC_WRONGDEVICE;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_DST_WRONGDEVICE = D3D11_MESSAGE_ID.DECRYPTIONBLT_DST_WRONGDEVICE;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_FORMAT_MISMATCH = D3D11_MESSAGE_ID.DECRYPTIONBLT_FORMAT_MISMATCH;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_SIZE_MISMATCH = D3D11_MESSAGE_ID.DECRYPTIONBLT_SIZE_MISMATCH;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_DST_MULTISAMPLED = D3D11_MESSAGE_ID.DECRYPTIONBLT_DST_MULTISAMPLED;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_SRC_NOT_STAGING = D3D11_MESSAGE_ID.DECRYPTIONBLT_SRC_NOT_STAGING;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_DST_NOT_RENDER_TARGET = D3D11_MESSAGE_ID.DECRYPTIONBLT_DST_NOT_RENDER_TARGET;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_SRC_MAPPED = D3D11_MESSAGE_ID.DECRYPTIONBLT_SRC_MAPPED;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_DST_MAPPED = D3D11_MESSAGE_ID.DECRYPTIONBLT_DST_MAPPED;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_SRC_OFFERED = D3D11_MESSAGE_ID.DECRYPTIONBLT_SRC_OFFERED;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_DST_OFFERED = D3D11_MESSAGE_ID.DECRYPTIONBLT_DST_OFFERED;
pub const D3D11_MESSAGE_ID_DECRYPTIONBLT_SRC_CONTENT_UNDEFINED = D3D11_MESSAGE_ID.DECRYPTIONBLT_SRC_CONTENT_UNDEFINED;
pub const D3D11_MESSAGE_ID_STARTSESSIONKEYREFRESH_NULLPARAM = D3D11_MESSAGE_ID.STARTSESSIONKEYREFRESH_NULLPARAM;
pub const D3D11_MESSAGE_ID_STARTSESSIONKEYREFRESH_INVALIDSIZE = D3D11_MESSAGE_ID.STARTSESSIONKEYREFRESH_INVALIDSIZE;
pub const D3D11_MESSAGE_ID_FINISHSESSIONKEYREFRESH_NULLPARAM = D3D11_MESSAGE_ID.FINISHSESSIONKEYREFRESH_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETENCRYPTIONBLTKEY_NULLPARAM = D3D11_MESSAGE_ID.GETENCRYPTIONBLTKEY_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETENCRYPTIONBLTKEY_INVALIDSIZE = D3D11_MESSAGE_ID.GETENCRYPTIONBLTKEY_INVALIDSIZE;
pub const D3D11_MESSAGE_ID_GETCONTENTPROTECTIONCAPS_NULLPARAM = D3D11_MESSAGE_ID.GETCONTENTPROTECTIONCAPS_NULLPARAM;
pub const D3D11_MESSAGE_ID_CHECKCRYPTOKEYEXCHANGE_NULLPARAM = D3D11_MESSAGE_ID.CHECKCRYPTOKEYEXCHANGE_NULLPARAM;
pub const D3D11_MESSAGE_ID_CHECKCRYPTOKEYEXCHANGE_INVALIDINDEX = D3D11_MESSAGE_ID.CHECKCRYPTOKEYEXCHANGE_INVALIDINDEX;
pub const D3D11_MESSAGE_ID_CREATEAUTHENTICATEDCHANNEL_NULLPARAM = D3D11_MESSAGE_ID.CREATEAUTHENTICATEDCHANNEL_NULLPARAM;
pub const D3D11_MESSAGE_ID_CREATEAUTHENTICATEDCHANNEL_UNSUPPORTED = D3D11_MESSAGE_ID.CREATEAUTHENTICATEDCHANNEL_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_CREATEAUTHENTICATEDCHANNEL_INVALIDTYPE = D3D11_MESSAGE_ID.CREATEAUTHENTICATEDCHANNEL_INVALIDTYPE;
pub const D3D11_MESSAGE_ID_CREATEAUTHENTICATEDCHANNEL_OUTOFMEMORY_RETURN = D3D11_MESSAGE_ID.CREATEAUTHENTICATEDCHANNEL_OUTOFMEMORY_RETURN;
pub const D3D11_MESSAGE_ID_GETAUTHENTICATEDCHANNELCERTIFICATESIZE_INVALIDCHANNEL = D3D11_MESSAGE_ID.GETAUTHENTICATEDCHANNELCERTIFICATESIZE_INVALIDCHANNEL;
pub const D3D11_MESSAGE_ID_GETAUTHENTICATEDCHANNELCERTIFICATESIZE_NULLPARAM = D3D11_MESSAGE_ID.GETAUTHENTICATEDCHANNELCERTIFICATESIZE_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETAUTHENTICATEDCHANNELCERTIFICATE_INVALIDCHANNEL = D3D11_MESSAGE_ID.GETAUTHENTICATEDCHANNELCERTIFICATE_INVALIDCHANNEL;
pub const D3D11_MESSAGE_ID_GETAUTHENTICATEDCHANNELCERTIFICATE_NULLPARAM = D3D11_MESSAGE_ID.GETAUTHENTICATEDCHANNELCERTIFICATE_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETAUTHENTICATEDCHANNELCERTIFICATE_WRONGSIZE = D3D11_MESSAGE_ID.GETAUTHENTICATEDCHANNELCERTIFICATE_WRONGSIZE;
pub const D3D11_MESSAGE_ID_NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_INVALIDCHANNEL = D3D11_MESSAGE_ID.NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_INVALIDCHANNEL;
pub const D3D11_MESSAGE_ID_NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_NULLPARAM = D3D11_MESSAGE_ID.NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_NULLPARAM;
pub const D3D11_MESSAGE_ID_QUERYAUTHENTICATEDCHANNEL_NULLPARAM = D3D11_MESSAGE_ID.QUERYAUTHENTICATEDCHANNEL_NULLPARAM;
pub const D3D11_MESSAGE_ID_QUERYAUTHENTICATEDCHANNEL_WRONGCHANNEL = D3D11_MESSAGE_ID.QUERYAUTHENTICATEDCHANNEL_WRONGCHANNEL;
pub const D3D11_MESSAGE_ID_QUERYAUTHENTICATEDCHANNEL_UNSUPPORTEDQUERY = D3D11_MESSAGE_ID.QUERYAUTHENTICATEDCHANNEL_UNSUPPORTEDQUERY;
pub const D3D11_MESSAGE_ID_QUERYAUTHENTICATEDCHANNEL_WRONGSIZE = D3D11_MESSAGE_ID.QUERYAUTHENTICATEDCHANNEL_WRONGSIZE;
pub const D3D11_MESSAGE_ID_QUERYAUTHENTICATEDCHANNEL_INVALIDPROCESSINDEX = D3D11_MESSAGE_ID.QUERYAUTHENTICATEDCHANNEL_INVALIDPROCESSINDEX;
pub const D3D11_MESSAGE_ID_CONFIGUREAUTHENTICATEDCHANNEL_NULLPARAM = D3D11_MESSAGE_ID.CONFIGUREAUTHENTICATEDCHANNEL_NULLPARAM;
pub const D3D11_MESSAGE_ID_CONFIGUREAUTHENTICATEDCHANNEL_WRONGCHANNEL = D3D11_MESSAGE_ID.CONFIGUREAUTHENTICATEDCHANNEL_WRONGCHANNEL;
pub const D3D11_MESSAGE_ID_CONFIGUREAUTHENTICATEDCHANNEL_UNSUPPORTEDCONFIGURE = D3D11_MESSAGE_ID.CONFIGUREAUTHENTICATEDCHANNEL_UNSUPPORTEDCONFIGURE;
pub const D3D11_MESSAGE_ID_CONFIGUREAUTHENTICATEDCHANNEL_WRONGSIZE = D3D11_MESSAGE_ID.CONFIGUREAUTHENTICATEDCHANNEL_WRONGSIZE;
pub const D3D11_MESSAGE_ID_CONFIGUREAUTHENTICATEDCHANNEL_INVALIDPROCESSIDTYPE = D3D11_MESSAGE_ID.CONFIGUREAUTHENTICATEDCHANNEL_INVALIDPROCESSIDTYPE;
pub const D3D11_MESSAGE_ID_VSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = D3D11_MESSAGE_ID.VSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT;
pub const D3D11_MESSAGE_ID_DSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = D3D11_MESSAGE_ID.DSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT;
pub const D3D11_MESSAGE_ID_HSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = D3D11_MESSAGE_ID.HSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT;
pub const D3D11_MESSAGE_ID_GSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = D3D11_MESSAGE_ID.GSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT;
pub const D3D11_MESSAGE_ID_PSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = D3D11_MESSAGE_ID.PSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT;
pub const D3D11_MESSAGE_ID_CSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT = D3D11_MESSAGE_ID.CSSETCONSTANTBUFFERS_INVALIDBUFFEROFFSETORCOUNT;
pub const D3D11_MESSAGE_ID_NEGOTIATECRPYTOSESSIONKEYEXCHANGE_INVALIDSIZE = D3D11_MESSAGE_ID.NEGOTIATECRPYTOSESSIONKEYEXCHANGE_INVALIDSIZE;
pub const D3D11_MESSAGE_ID_NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_INVALIDSIZE = D3D11_MESSAGE_ID.NEGOTIATEAUTHENTICATEDCHANNELKEYEXCHANGE_INVALIDSIZE;
pub const D3D11_MESSAGE_ID_OFFERRESOURCES_INVALIDPRIORITY = D3D11_MESSAGE_ID.OFFERRESOURCES_INVALIDPRIORITY;
pub const D3D11_MESSAGE_ID_GETCRYPTOSESSIONHANDLE_OUTOFMEMORY = D3D11_MESSAGE_ID.GETCRYPTOSESSIONHANDLE_OUTOFMEMORY;
pub const D3D11_MESSAGE_ID_ACQUIREHANDLEFORCAPTURE_NULLPARAM = D3D11_MESSAGE_ID.ACQUIREHANDLEFORCAPTURE_NULLPARAM;
pub const D3D11_MESSAGE_ID_ACQUIREHANDLEFORCAPTURE_INVALIDTYPE = D3D11_MESSAGE_ID.ACQUIREHANDLEFORCAPTURE_INVALIDTYPE;
pub const D3D11_MESSAGE_ID_ACQUIREHANDLEFORCAPTURE_INVALIDBIND = D3D11_MESSAGE_ID.ACQUIREHANDLEFORCAPTURE_INVALIDBIND;
pub const D3D11_MESSAGE_ID_ACQUIREHANDLEFORCAPTURE_INVALIDARRAY = D3D11_MESSAGE_ID.ACQUIREHANDLEFORCAPTURE_INVALIDARRAY;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMROTATION_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMROTATION_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMROTATION_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMROTATION_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMROTATION_INVALID = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMROTATION_INVALID;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMROTATION_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMROTATION_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMROTATION_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMROTATION_NULLPARAM;
pub const D3D11_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDVIEW = D3D11_MESSAGE_ID.DEVICE_CLEARVIEW_INVALIDVIEW;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEVERTEXSHADER_DOUBLEEXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_SHADEREXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEVERTEXSHADER_SHADEREXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEHULLSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEHULLSHADER_DOUBLEEXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEHULLSHADER_SHADEREXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEHULLSHADER_SHADEREXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEDOMAINSHADER_DOUBLEEXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_SHADEREXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEDOMAINSHADER_SHADEREXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEGEOMETRYSHADER_DOUBLEEXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_SHADEREXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEGEOMETRYSHADER_SHADEREXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEEXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_DOUBLEEXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_SHADEREXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_SHADEREXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_DOUBLEEXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEPIXELSHADER_DOUBLEEXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_SHADEREXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEPIXELSHADER_SHADEREXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_DOUBLEEXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATECOMPUTESHADER_DOUBLEEXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_SHADEREXTENSIONSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATECOMPUTESHADER_SHADEREXTENSIONSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_SHADER_LINKAGE_MINPRECISION = D3D11_MESSAGE_ID.DEVICE_SHADER_LINKAGE_MINPRECISION;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMALPHA_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMALPHA_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMPIXELASPECTRATIO_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEVERTEXSHADER_UAVSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEVERTEXSHADER_UAVSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEHULLSHADER_UAVSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEHULLSHADER_UAVSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEDOMAINSHADER_UAVSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEDOMAINSHADER_UAVSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADER_UAVSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEGEOMETRYSHADER_UAVSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UAVSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEGEOMETRYSHADERWITHSTREAMOUTPUT_UAVSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATEPIXELSHADER_UAVSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATEPIXELSHADER_UAVSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_CREATECOMPUTESHADER_UAVSNOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CREATECOMPUTESHADER_UAVSNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_INVALIDOFFSET = D3D11_MESSAGE_ID.DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_INVALIDOFFSET;
pub const D3D11_MESSAGE_ID_DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_TOOMANYVIEWS = D3D11_MESSAGE_ID.DEVICE_OMSETRENDERTARGETSANDUNORDEREDACCESSVIEWS_TOOMANYVIEWS;
pub const D3D11_MESSAGE_ID_DEVICE_CLEARVIEW_NOTSUPPORTED = D3D11_MESSAGE_ID.DEVICE_CLEARVIEW_NOTSUPPORTED;
pub const D3D11_MESSAGE_ID_SWAPDEVICECONTEXTSTATE_NOTSUPPORTED = D3D11_MESSAGE_ID.SWAPDEVICECONTEXTSTATE_NOTSUPPORTED;
pub const D3D11_MESSAGE_ID_UPDATESUBRESOURCE_PREFERUPDATESUBRESOURCE1 = D3D11_MESSAGE_ID.UPDATESUBRESOURCE_PREFERUPDATESUBRESOURCE1;
pub const D3D11_MESSAGE_ID_GETDC_INACCESSIBLE = D3D11_MESSAGE_ID.GETDC_INACCESSIBLE;
pub const D3D11_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDRECT = D3D11_MESSAGE_ID.DEVICE_CLEARVIEW_INVALIDRECT;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_SAMPLE_MASK_IGNORED_ON_FL9 = D3D11_MESSAGE_ID.DEVICE_DRAW_SAMPLE_MASK_IGNORED_ON_FL9;
pub const D3D11_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE1_NOT_SUPPORTED = D3D11_MESSAGE_ID.DEVICE_OPEN_SHARED_RESOURCE1_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_DEVICE_OPEN_SHARED_RESOURCE_BY_NAME_NOT_SUPPORTED = D3D11_MESSAGE_ID.DEVICE_OPEN_SHARED_RESOURCE_BY_NAME_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_ENQUEUESETEVENT_NOT_SUPPORTED = D3D11_MESSAGE_ID.ENQUEUESETEVENT_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_OFFERRELEASE_NOT_SUPPORTED = D3D11_MESSAGE_ID.OFFERRELEASE_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_OFFERRESOURCES_INACCESSIBLE = D3D11_MESSAGE_ID.OFFERRESOURCES_INACCESSIBLE;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMSAA = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSORINPUTVIEW_INVALIDMSAA;
pub const D3D11_MESSAGE_ID_CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDMSAA = D3D11_MESSAGE_ID.CREATEVIDEOPROCESSOROUTPUTVIEW_INVALIDMSAA;
pub const D3D11_MESSAGE_ID_DEVICE_CLEARVIEW_INVALIDSOURCERECT = D3D11_MESSAGE_ID.DEVICE_CLEARVIEW_INVALIDSOURCERECT;
pub const D3D11_MESSAGE_ID_DEVICE_CLEARVIEW_EMPTYRECT = D3D11_MESSAGE_ID.DEVICE_CLEARVIEW_EMPTYRECT;
pub const D3D11_MESSAGE_ID_UPDATESUBRESOURCE_EMPTYDESTBOX = D3D11_MESSAGE_ID.UPDATESUBRESOURCE_EMPTYDESTBOX;
pub const D3D11_MESSAGE_ID_COPYSUBRESOURCEREGION_EMPTYSOURCEBOX = D3D11_MESSAGE_ID.COPYSUBRESOURCEREGION_EMPTYSOURCEBOX;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_LOGIC_OPS = D3D11_MESSAGE_ID.DEVICE_DRAW_OM_RENDER_TARGET_DOES_NOT_SUPPORT_LOGIC_OPS;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_DEPTHSTENCILVIEW_NOT_SET = D3D11_MESSAGE_ID.DEVICE_DRAW_DEPTHSTENCILVIEW_NOT_SET;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET = D3D11_MESSAGE_ID.DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = D3D11_MESSAGE_ID.DEVICE_DRAW_RENDERTARGETVIEW_NOT_SET_DUE_TO_FLIP_PRESENT;
pub const D3D11_MESSAGE_ID_DEVICE_UNORDEREDACCESSVIEW_NOT_SET_DUE_TO_FLIP_PRESENT = D3D11_MESSAGE_ID.DEVICE_UNORDEREDACCESSVIEW_NOT_SET_DUE_TO_FLIP_PRESENT;
pub const D3D11_MESSAGE_ID_GETDATAFORNEWHARDWAREKEY_NULLPARAM = D3D11_MESSAGE_ID.GETDATAFORNEWHARDWAREKEY_NULLPARAM;
pub const D3D11_MESSAGE_ID_CHECKCRYPTOSESSIONSTATUS_NULLPARAM = D3D11_MESSAGE_ID.CHECKCRYPTOSESSIONSTATUS_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETCRYPTOSESSIONPRIVATEDATASIZE_NULLPARAM = D3D11_MESSAGE_ID.GETCRYPTOSESSIONPRIVATEDATASIZE_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETVIDEODECODERCAPS_NULLPARAM = D3D11_MESSAGE_ID.GETVIDEODECODERCAPS_NULLPARAM;
pub const D3D11_MESSAGE_ID_GETVIDEODECODERCAPS_ZEROWIDTHHEIGHT = D3D11_MESSAGE_ID.GETVIDEODECODERCAPS_ZEROWIDTHHEIGHT;
pub const D3D11_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_NULLPARAM = D3D11_MESSAGE_ID.CHECKVIDEODECODERDOWNSAMPLING_NULLPARAM;
pub const D3D11_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = D3D11_MESSAGE_ID.CHECKVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE;
pub const D3D11_MESSAGE_ID_CHECKVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = D3D11_MESSAGE_ID.CHECKVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT;
pub const D3D11_MESSAGE_ID_VIDEODECODERENABLEDOWNSAMPLING_NULLPARAM = D3D11_MESSAGE_ID.VIDEODECODERENABLEDOWNSAMPLING_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEODECODERENABLEDOWNSAMPLING_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEODECODERENABLEDOWNSAMPLING_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEODECODERUPDATEDOWNSAMPLING_NULLPARAM = D3D11_MESSAGE_ID.VIDEODECODERUPDATEDOWNSAMPLING_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEODECODERUPDATEDOWNSAMPLING_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEODECODERUPDATEDOWNSAMPLING_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_CHECKVIDEOPROCESSORFORMATCONVERSION_NULLPARAM = D3D11_MESSAGE_ID.CHECKVIDEOPROCESSORFORMATCONVERSION_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTCOLORSPACE1_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTCOLORSPACE1_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTCOLORSPACE1_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETOUTPUTCOLORSPACE1_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMCOLORSPACE1_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMCOLORSPACE1_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMCOLORSPACE1_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMCOLORSPACE1_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMMIRROR_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMMIRROR_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMMIRROR_UNSUPPORTED = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMMIRROR_UNSUPPORTED;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMCOLORSPACE1_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMCOLORSPACE1_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMMIRROR_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMMIRROR_NULLPARAM;
pub const D3D11_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_NULLPARAM = D3D11_MESSAGE_ID.RECOMMENDVIDEODECODERDOWNSAMPLING_NULLPARAM;
pub const D3D11_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE = D3D11_MESSAGE_ID.RECOMMENDVIDEODECODERDOWNSAMPLING_INVALIDCOLORSPACE;
pub const D3D11_MESSAGE_ID_RECOMMENDVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT = D3D11_MESSAGE_ID.RECOMMENDVIDEODECODERDOWNSAMPLING_ZEROWIDTHHEIGHT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTSHADERUSAGE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTSHADERUSAGE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTSHADERUSAGE_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETOUTPUTSHADERUSAGE_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETBEHAVIORHINTS_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSTREAMCOUNT = D3D11_MESSAGE_ID.VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSTREAMCOUNT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_TARGETRECT = D3D11_MESSAGE_ID.VIDEOPROCESSORGETBEHAVIORHINTS_TARGETRECT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSOURCERECT = D3D11_MESSAGE_ID.VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDSOURCERECT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDDESTRECT = D3D11_MESSAGE_ID.VIDEOPROCESSORGETBEHAVIORHINTS_INVALIDDESTRECT;
pub const D3D11_MESSAGE_ID_GETCRYPTOSESSIONPRIVATEDATASIZE_INVALID_KEY_EXCHANGE_TYPE = D3D11_MESSAGE_ID.GETCRYPTOSESSIONPRIVATEDATASIZE_INVALID_KEY_EXCHANGE_TYPE;
pub const D3D11_MESSAGE_ID_D3D11_1_MESSAGES_END = D3D11_MESSAGE_ID.D3D11_1_MESSAGES_END;
pub const D3D11_MESSAGE_ID_D3D11_2_MESSAGES_START = D3D11_MESSAGE_ID.D3D11_2_MESSAGES_START;
pub const D3D11_MESSAGE_ID_CREATEBUFFER_INVALIDUSAGE = D3D11_MESSAGE_ID.CREATEBUFFER_INVALIDUSAGE;
pub const D3D11_MESSAGE_ID_CREATETEXTURE1D_INVALIDUSAGE = D3D11_MESSAGE_ID.CREATETEXTURE1D_INVALIDUSAGE;
pub const D3D11_MESSAGE_ID_CREATETEXTURE2D_INVALIDUSAGE = D3D11_MESSAGE_ID.CREATETEXTURE2D_INVALIDUSAGE;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_LEVEL9_STEPRATE_NOT_1 = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_LEVEL9_STEPRATE_NOT_1;
pub const D3D11_MESSAGE_ID_CREATEINPUTLAYOUT_LEVEL9_INSTANCING_NOT_SUPPORTED = D3D11_MESSAGE_ID.CREATEINPUTLAYOUT_LEVEL9_INSTANCING_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_UPDATETILEMAPPINGS_INVALID_PARAMETER = D3D11_MESSAGE_ID.UPDATETILEMAPPINGS_INVALID_PARAMETER;
pub const D3D11_MESSAGE_ID_COPYTILEMAPPINGS_INVALID_PARAMETER = D3D11_MESSAGE_ID.COPYTILEMAPPINGS_INVALID_PARAMETER;
pub const D3D11_MESSAGE_ID_COPYTILES_INVALID_PARAMETER = D3D11_MESSAGE_ID.COPYTILES_INVALID_PARAMETER;
pub const D3D11_MESSAGE_ID_UPDATETILES_INVALID_PARAMETER = D3D11_MESSAGE_ID.UPDATETILES_INVALID_PARAMETER;
pub const D3D11_MESSAGE_ID_RESIZETILEPOOL_INVALID_PARAMETER = D3D11_MESSAGE_ID.RESIZETILEPOOL_INVALID_PARAMETER;
pub const D3D11_MESSAGE_ID_TILEDRESOURCEBARRIER_INVALID_PARAMETER = D3D11_MESSAGE_ID.TILEDRESOURCEBARRIER_INVALID_PARAMETER;
pub const D3D11_MESSAGE_ID_NULL_TILE_MAPPING_ACCESS_WARNING = D3D11_MESSAGE_ID.NULL_TILE_MAPPING_ACCESS_WARNING;
pub const D3D11_MESSAGE_ID_NULL_TILE_MAPPING_ACCESS_ERROR = D3D11_MESSAGE_ID.NULL_TILE_MAPPING_ACCESS_ERROR;
pub const D3D11_MESSAGE_ID_DIRTY_TILE_MAPPING_ACCESS = D3D11_MESSAGE_ID.DIRTY_TILE_MAPPING_ACCESS;
pub const D3D11_MESSAGE_ID_DUPLICATE_TILE_MAPPINGS_IN_COVERED_AREA = D3D11_MESSAGE_ID.DUPLICATE_TILE_MAPPINGS_IN_COVERED_AREA;
pub const D3D11_MESSAGE_ID_TILE_MAPPINGS_IN_COVERED_AREA_DUPLICATED_OUTSIDE = D3D11_MESSAGE_ID.TILE_MAPPINGS_IN_COVERED_AREA_DUPLICATED_OUTSIDE;
pub const D3D11_MESSAGE_ID_TILE_MAPPINGS_SHARED_BETWEEN_INCOMPATIBLE_RESOURCES = D3D11_MESSAGE_ID.TILE_MAPPINGS_SHARED_BETWEEN_INCOMPATIBLE_RESOURCES;
pub const D3D11_MESSAGE_ID_TILE_MAPPINGS_SHARED_BETWEEN_INPUT_AND_OUTPUT = D3D11_MESSAGE_ID.TILE_MAPPINGS_SHARED_BETWEEN_INPUT_AND_OUTPUT;
pub const D3D11_MESSAGE_ID_CHECKMULTISAMPLEQUALITYLEVELS_INVALIDFLAGS = D3D11_MESSAGE_ID.CHECKMULTISAMPLEQUALITYLEVELS_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_GETRESOURCETILING_NONTILED_RESOURCE = D3D11_MESSAGE_ID.GETRESOURCETILING_NONTILED_RESOURCE;
pub const D3D11_MESSAGE_ID_RESIZETILEPOOL_SHRINK_WITH_MAPPINGS_STILL_DEFINED_PAST_END = D3D11_MESSAGE_ID.RESIZETILEPOOL_SHRINK_WITH_MAPPINGS_STILL_DEFINED_PAST_END;
pub const D3D11_MESSAGE_ID_NEED_TO_CALL_TILEDRESOURCEBARRIER = D3D11_MESSAGE_ID.NEED_TO_CALL_TILEDRESOURCEBARRIER;
pub const D3D11_MESSAGE_ID_CREATEDEVICE_INVALIDARGS = D3D11_MESSAGE_ID.CREATEDEVICE_INVALIDARGS;
pub const D3D11_MESSAGE_ID_CREATEDEVICE_WARNING = D3D11_MESSAGE_ID.CREATEDEVICE_WARNING;
pub const D3D11_MESSAGE_ID_CLEARUNORDEREDACCESSVIEWUINT_HAZARD = D3D11_MESSAGE_ID.CLEARUNORDEREDACCESSVIEWUINT_HAZARD;
pub const D3D11_MESSAGE_ID_CLEARUNORDEREDACCESSVIEWFLOAT_HAZARD = D3D11_MESSAGE_ID.CLEARUNORDEREDACCESSVIEWFLOAT_HAZARD;
pub const D3D11_MESSAGE_ID_TILED_RESOURCE_TIER_1_BUFFER_TEXTURE_MISMATCH = D3D11_MESSAGE_ID.TILED_RESOURCE_TIER_1_BUFFER_TEXTURE_MISMATCH;
pub const D3D11_MESSAGE_ID_CREATE_CRYPTOSESSION = D3D11_MESSAGE_ID.CREATE_CRYPTOSESSION;
pub const D3D11_MESSAGE_ID_CREATE_AUTHENTICATEDCHANNEL = D3D11_MESSAGE_ID.CREATE_AUTHENTICATEDCHANNEL;
pub const D3D11_MESSAGE_ID_LIVE_CRYPTOSESSION = D3D11_MESSAGE_ID.LIVE_CRYPTOSESSION;
pub const D3D11_MESSAGE_ID_LIVE_AUTHENTICATEDCHANNEL = D3D11_MESSAGE_ID.LIVE_AUTHENTICATEDCHANNEL;
pub const D3D11_MESSAGE_ID_DESTROY_CRYPTOSESSION = D3D11_MESSAGE_ID.DESTROY_CRYPTOSESSION;
pub const D3D11_MESSAGE_ID_DESTROY_AUTHENTICATEDCHANNEL = D3D11_MESSAGE_ID.DESTROY_AUTHENTICATEDCHANNEL;
pub const D3D11_MESSAGE_ID_D3D11_2_MESSAGES_END = D3D11_MESSAGE_ID.D3D11_2_MESSAGES_END;
pub const D3D11_MESSAGE_ID_D3D11_3_MESSAGES_START = D3D11_MESSAGE_ID.D3D11_3_MESSAGES_START;
pub const D3D11_MESSAGE_ID_CREATERASTERIZERSTATE_INVALID_CONSERVATIVERASTERMODE = D3D11_MESSAGE_ID.CREATERASTERIZERSTATE_INVALID_CONSERVATIVERASTERMODE;
pub const D3D11_MESSAGE_ID_DEVICE_DRAW_INVALID_SYSTEMVALUE = D3D11_MESSAGE_ID.DEVICE_DRAW_INVALID_SYSTEMVALUE;
pub const D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_INVALIDCONTEXTTYPE = D3D11_MESSAGE_ID.CREATEQUERYORPREDICATE_INVALIDCONTEXTTYPE;
pub const D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_DECODENOTSUPPORTED = D3D11_MESSAGE_ID.CREATEQUERYORPREDICATE_DECODENOTSUPPORTED;
pub const D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_ENCODENOTSUPPORTED = D3D11_MESSAGE_ID.CREATEQUERYORPREDICATE_ENCODENOTSUPPORTED;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDPLANEINDEX = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDPLANEINDEX;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANEINDEX = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_INVALIDVIDEOPLANEINDEX;
pub const D3D11_MESSAGE_ID_CREATESHADERRESOURCEVIEW_AMBIGUOUSVIDEOPLANEINDEX = D3D11_MESSAGE_ID.CREATESHADERRESOURCEVIEW_AMBIGUOUSVIDEOPLANEINDEX;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDPLANEINDEX = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDPLANEINDEX;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_INVALIDVIDEOPLANEINDEX = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_INVALIDVIDEOPLANEINDEX;
pub const D3D11_MESSAGE_ID_CREATERENDERTARGETVIEW_AMBIGUOUSVIDEOPLANEINDEX = D3D11_MESSAGE_ID.CREATERENDERTARGETVIEW_AMBIGUOUSVIDEOPLANEINDEX;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDPLANEINDEX = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_INVALIDPLANEINDEX;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_INVALIDVIDEOPLANEINDEX = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_INVALIDVIDEOPLANEINDEX;
pub const D3D11_MESSAGE_ID_CREATEUNORDEREDACCESSVIEW_AMBIGUOUSVIDEOPLANEINDEX = D3D11_MESSAGE_ID.CREATEUNORDEREDACCESSVIEW_AMBIGUOUSVIDEOPLANEINDEX;
pub const D3D11_MESSAGE_ID_JPEGDECODE_INVALIDSCANDATAOFFSET = D3D11_MESSAGE_ID.JPEGDECODE_INVALIDSCANDATAOFFSET;
pub const D3D11_MESSAGE_ID_JPEGDECODE_NOTSUPPORTED = D3D11_MESSAGE_ID.JPEGDECODE_NOTSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGDECODE_DIMENSIONSTOOLARGE = D3D11_MESSAGE_ID.JPEGDECODE_DIMENSIONSTOOLARGE;
pub const D3D11_MESSAGE_ID_JPEGDECODE_INVALIDCOMPONENTS = D3D11_MESSAGE_ID.JPEGDECODE_INVALIDCOMPONENTS;
pub const D3D11_MESSAGE_ID_JPEGDECODE_DESTINATIONNOT2D = D3D11_MESSAGE_ID.JPEGDECODE_DESTINATIONNOT2D;
pub const D3D11_MESSAGE_ID_JPEGDECODE_TILEDRESOURCESUNSUPPORTED = D3D11_MESSAGE_ID.JPEGDECODE_TILEDRESOURCESUNSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGDECODE_GUARDRECTSUNSUPPORTED = D3D11_MESSAGE_ID.JPEGDECODE_GUARDRECTSUNSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGDECODE_FORMATUNSUPPORTED = D3D11_MESSAGE_ID.JPEGDECODE_FORMATUNSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGDECODE_INVALIDSUBRESOURCE = D3D11_MESSAGE_ID.JPEGDECODE_INVALIDSUBRESOURCE;
pub const D3D11_MESSAGE_ID_JPEGDECODE_INVALIDMIPLEVEL = D3D11_MESSAGE_ID.JPEGDECODE_INVALIDMIPLEVEL;
pub const D3D11_MESSAGE_ID_JPEGDECODE_EMPTYDESTBOX = D3D11_MESSAGE_ID.JPEGDECODE_EMPTYDESTBOX;
pub const D3D11_MESSAGE_ID_JPEGDECODE_DESTBOXNOT2D = D3D11_MESSAGE_ID.JPEGDECODE_DESTBOXNOT2D;
pub const D3D11_MESSAGE_ID_JPEGDECODE_DESTBOXNOTSUB = D3D11_MESSAGE_ID.JPEGDECODE_DESTBOXNOTSUB;
pub const D3D11_MESSAGE_ID_JPEGDECODE_DESTBOXESINTERSECT = D3D11_MESSAGE_ID.JPEGDECODE_DESTBOXESINTERSECT;
pub const D3D11_MESSAGE_ID_JPEGDECODE_XSUBSAMPLEMISMATCH = D3D11_MESSAGE_ID.JPEGDECODE_XSUBSAMPLEMISMATCH;
pub const D3D11_MESSAGE_ID_JPEGDECODE_YSUBSAMPLEMISMATCH = D3D11_MESSAGE_ID.JPEGDECODE_YSUBSAMPLEMISMATCH;
pub const D3D11_MESSAGE_ID_JPEGDECODE_XSUBSAMPLEODD = D3D11_MESSAGE_ID.JPEGDECODE_XSUBSAMPLEODD;
pub const D3D11_MESSAGE_ID_JPEGDECODE_YSUBSAMPLEODD = D3D11_MESSAGE_ID.JPEGDECODE_YSUBSAMPLEODD;
pub const D3D11_MESSAGE_ID_JPEGDECODE_OUTPUTDIMENSIONSTOOLARGE = D3D11_MESSAGE_ID.JPEGDECODE_OUTPUTDIMENSIONSTOOLARGE;
pub const D3D11_MESSAGE_ID_JPEGDECODE_NONPOW2SCALEUNSUPPORTED = D3D11_MESSAGE_ID.JPEGDECODE_NONPOW2SCALEUNSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGDECODE_FRACTIONALDOWNSCALETOLARGE = D3D11_MESSAGE_ID.JPEGDECODE_FRACTIONALDOWNSCALETOLARGE;
pub const D3D11_MESSAGE_ID_JPEGDECODE_CHROMASIZEMISMATCH = D3D11_MESSAGE_ID.JPEGDECODE_CHROMASIZEMISMATCH;
pub const D3D11_MESSAGE_ID_JPEGDECODE_LUMACHROMASIZEMISMATCH = D3D11_MESSAGE_ID.JPEGDECODE_LUMACHROMASIZEMISMATCH;
pub const D3D11_MESSAGE_ID_JPEGDECODE_INVALIDNUMDESTINATIONS = D3D11_MESSAGE_ID.JPEGDECODE_INVALIDNUMDESTINATIONS;
pub const D3D11_MESSAGE_ID_JPEGDECODE_SUBBOXUNSUPPORTED = D3D11_MESSAGE_ID.JPEGDECODE_SUBBOXUNSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGDECODE_1DESTUNSUPPORTEDFORMAT = D3D11_MESSAGE_ID.JPEGDECODE_1DESTUNSUPPORTEDFORMAT;
pub const D3D11_MESSAGE_ID_JPEGDECODE_3DESTUNSUPPORTEDFORMAT = D3D11_MESSAGE_ID.JPEGDECODE_3DESTUNSUPPORTEDFORMAT;
pub const D3D11_MESSAGE_ID_JPEGDECODE_SCALEUNSUPPORTED = D3D11_MESSAGE_ID.JPEGDECODE_SCALEUNSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGDECODE_INVALIDSOURCESIZE = D3D11_MESSAGE_ID.JPEGDECODE_INVALIDSOURCESIZE;
pub const D3D11_MESSAGE_ID_JPEGDECODE_INVALIDCOPYFLAGS = D3D11_MESSAGE_ID.JPEGDECODE_INVALIDCOPYFLAGS;
pub const D3D11_MESSAGE_ID_JPEGDECODE_HAZARD = D3D11_MESSAGE_ID.JPEGDECODE_HAZARD;
pub const D3D11_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDSRCBUFFERUSAGE = D3D11_MESSAGE_ID.JPEGDECODE_UNSUPPORTEDSRCBUFFERUSAGE;
pub const D3D11_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDSRCBUFFERMISCFLAGS = D3D11_MESSAGE_ID.JPEGDECODE_UNSUPPORTEDSRCBUFFERMISCFLAGS;
pub const D3D11_MESSAGE_ID_JPEGDECODE_UNSUPPORTEDDSTTEXTUREUSAGE = D3D11_MESSAGE_ID.JPEGDECODE_UNSUPPORTEDDSTTEXTUREUSAGE;
pub const D3D11_MESSAGE_ID_JPEGDECODE_BACKBUFFERNOTSUPPORTED = D3D11_MESSAGE_ID.JPEGDECODE_BACKBUFFERNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGDECODE_UNSUPPRTEDCOPYFLAGS = D3D11_MESSAGE_ID.JPEGDECODE_UNSUPPRTEDCOPYFLAGS;
pub const D3D11_MESSAGE_ID_JPEGENCODE_NOTSUPPORTED = D3D11_MESSAGE_ID.JPEGENCODE_NOTSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGENCODE_INVALIDSCANDATAOFFSET = D3D11_MESSAGE_ID.JPEGENCODE_INVALIDSCANDATAOFFSET;
pub const D3D11_MESSAGE_ID_JPEGENCODE_INVALIDCOMPONENTS = D3D11_MESSAGE_ID.JPEGENCODE_INVALIDCOMPONENTS;
pub const D3D11_MESSAGE_ID_JPEGENCODE_SOURCENOT2D = D3D11_MESSAGE_ID.JPEGENCODE_SOURCENOT2D;
pub const D3D11_MESSAGE_ID_JPEGENCODE_TILEDRESOURCESUNSUPPORTED = D3D11_MESSAGE_ID.JPEGENCODE_TILEDRESOURCESUNSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGENCODE_GUARDRECTSUNSUPPORTED = D3D11_MESSAGE_ID.JPEGENCODE_GUARDRECTSUNSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGENCODE_XSUBSAMPLEMISMATCH = D3D11_MESSAGE_ID.JPEGENCODE_XSUBSAMPLEMISMATCH;
pub const D3D11_MESSAGE_ID_JPEGENCODE_YSUBSAMPLEMISMATCH = D3D11_MESSAGE_ID.JPEGENCODE_YSUBSAMPLEMISMATCH;
pub const D3D11_MESSAGE_ID_JPEGENCODE_FORMATUNSUPPORTED = D3D11_MESSAGE_ID.JPEGENCODE_FORMATUNSUPPORTED;
pub const D3D11_MESSAGE_ID_JPEGENCODE_INVALIDSUBRESOURCE = D3D11_MESSAGE_ID.JPEGENCODE_INVALIDSUBRESOURCE;
pub const D3D11_MESSAGE_ID_JPEGENCODE_INVALIDMIPLEVEL = D3D11_MESSAGE_ID.JPEGENCODE_INVALIDMIPLEVEL;
pub const D3D11_MESSAGE_ID_JPEGENCODE_DIMENSIONSTOOLARGE = D3D11_MESSAGE_ID.JPEGENCODE_DIMENSIONSTOOLARGE;
pub const D3D11_MESSAGE_ID_JPEGENCODE_HAZARD = D3D11_MESSAGE_ID.JPEGENCODE_HAZARD;
pub const D3D11_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDDSTBUFFERUSAGE = D3D11_MESSAGE_ID.JPEGENCODE_UNSUPPORTEDDSTBUFFERUSAGE;
pub const D3D11_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDDSTBUFFERMISCFLAGS = D3D11_MESSAGE_ID.JPEGENCODE_UNSUPPORTEDDSTBUFFERMISCFLAGS;
pub const D3D11_MESSAGE_ID_JPEGENCODE_UNSUPPORTEDSRCTEXTUREUSAGE = D3D11_MESSAGE_ID.JPEGENCODE_UNSUPPORTEDSRCTEXTUREUSAGE;
pub const D3D11_MESSAGE_ID_JPEGENCODE_BACKBUFFERNOTSUPPORTED = D3D11_MESSAGE_ID.JPEGENCODE_BACKBUFFERNOTSUPPORTED;
pub const D3D11_MESSAGE_ID_CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTTYPEFORQUERY = D3D11_MESSAGE_ID.CREATEQUERYORPREDICATE_UNSUPPORTEDCONTEXTTTYPEFORQUERY;
pub const D3D11_MESSAGE_ID_FLUSH1_INVALIDCONTEXTTYPE = D3D11_MESSAGE_ID.FLUSH1_INVALIDCONTEXTTYPE;
pub const D3D11_MESSAGE_ID_DEVICE_SETHARDWAREPROTECTION_INVALIDCONTEXT = D3D11_MESSAGE_ID.DEVICE_SETHARDWAREPROTECTION_INVALIDCONTEXT;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTHDRMETADATA_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTHDRMETADATA_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETOUTPUTHDRMETADATA_INVALIDSIZE = D3D11_MESSAGE_ID.VIDEOPROCESSORSETOUTPUTHDRMETADATA_INVALIDSIZE;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTHDRMETADATA_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETOUTPUTHDRMETADATA_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETOUTPUTHDRMETADATA_INVALIDSIZE = D3D11_MESSAGE_ID.VIDEOPROCESSORGETOUTPUTHDRMETADATA_INVALIDSIZE;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMHDRMETADATA_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMHDRMETADATA_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSIZE = D3D11_MESSAGE_ID.VIDEOPROCESSORSETSTREAMHDRMETADATA_INVALIDSIZE;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMHDRMETADATA_NULLPARAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMHDRMETADATA_NULLPARAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSIZE = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMHDRMETADATA_INVALIDSIZE;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMFRAMEFORMAT_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMFRAMEFORMAT_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMCOLORSPACE_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMCOLORSPACE_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMOUTPUTRATE_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMOUTPUTRATE_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMSOURCERECT_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMSOURCERECT_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMDESTRECT_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMDESTRECT_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMALPHA_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMALPHA_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMPALETTE_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMPALETTE_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMPIXELASPECTRATIO_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMPIXELASPECTRATIO_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMLUMAKEY_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMLUMAKEY_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMSTEREOFORMAT_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMSTEREOFORMAT_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMAUTOPROCESSINGMODE_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMAUTOPROCESSINGMODE_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMFILTER_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMFILTER_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMROTATION_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMROTATION_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMCOLORSPACE1_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMCOLORSPACE1_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_VIDEOPROCESSORGETSTREAMMIRROR_INVALIDSTREAM = D3D11_MESSAGE_ID.VIDEOPROCESSORGETSTREAMMIRROR_INVALIDSTREAM;
pub const D3D11_MESSAGE_ID_CREATE_FENCE = D3D11_MESSAGE_ID.CREATE_FENCE;
pub const D3D11_MESSAGE_ID_LIVE_FENCE = D3D11_MESSAGE_ID.LIVE_FENCE;
pub const D3D11_MESSAGE_ID_DESTROY_FENCE = D3D11_MESSAGE_ID.DESTROY_FENCE;
pub const D3D11_MESSAGE_ID_CREATE_SYNCHRONIZEDCHANNEL = D3D11_MESSAGE_ID.CREATE_SYNCHRONIZEDCHANNEL;
pub const D3D11_MESSAGE_ID_LIVE_SYNCHRONIZEDCHANNEL = D3D11_MESSAGE_ID.LIVE_SYNCHRONIZEDCHANNEL;
pub const D3D11_MESSAGE_ID_DESTROY_SYNCHRONIZEDCHANNEL = D3D11_MESSAGE_ID.DESTROY_SYNCHRONIZEDCHANNEL;
pub const D3D11_MESSAGE_ID_CREATEFENCE_INVALIDFLAGS = D3D11_MESSAGE_ID.CREATEFENCE_INVALIDFLAGS;
pub const D3D11_MESSAGE_ID_D3D11_3_MESSAGES_END = D3D11_MESSAGE_ID.D3D11_3_MESSAGES_END;
pub const D3D11_MESSAGE_ID_D3D11_5_MESSAGES_START = D3D11_MESSAGE_ID.D3D11_5_MESSAGES_START;
pub const D3D11_MESSAGE_ID_NEGOTIATECRYPTOSESSIONKEYEXCHANGEMT_INVALIDKEYEXCHANGETYPE = D3D11_MESSAGE_ID.NEGOTIATECRYPTOSESSIONKEYEXCHANGEMT_INVALIDKEYEXCHANGETYPE;
pub const D3D11_MESSAGE_ID_NEGOTIATECRYPTOSESSIONKEYEXCHANGEMT_NOT_SUPPORTED = D3D11_MESSAGE_ID.NEGOTIATECRYPTOSESSIONKEYEXCHANGEMT_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_DECODERBEGINFRAME_INVALID_HISTOGRAM_COMPONENT_COUNT = D3D11_MESSAGE_ID.DECODERBEGINFRAME_INVALID_HISTOGRAM_COMPONENT_COUNT;
pub const D3D11_MESSAGE_ID_DECODERBEGINFRAME_INVALID_HISTOGRAM_COMPONENT = D3D11_MESSAGE_ID.DECODERBEGINFRAME_INVALID_HISTOGRAM_COMPONENT;
pub const D3D11_MESSAGE_ID_DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_SIZE = D3D11_MESSAGE_ID.DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_SIZE;
pub const D3D11_MESSAGE_ID_DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_USAGE = D3D11_MESSAGE_ID.DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_USAGE;
pub const D3D11_MESSAGE_ID_DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_MISC_FLAGS = D3D11_MESSAGE_ID.DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_MISC_FLAGS;
pub const D3D11_MESSAGE_ID_DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_OFFSET = D3D11_MESSAGE_ID.DECODERBEGINFRAME_INVALID_HISTOGRAM_BUFFER_OFFSET;
pub const D3D11_MESSAGE_ID_CREATE_TRACKEDWORKLOAD = D3D11_MESSAGE_ID.CREATE_TRACKEDWORKLOAD;
pub const D3D11_MESSAGE_ID_LIVE_TRACKEDWORKLOAD = D3D11_MESSAGE_ID.LIVE_TRACKEDWORKLOAD;
pub const D3D11_MESSAGE_ID_DESTROY_TRACKEDWORKLOAD = D3D11_MESSAGE_ID.DESTROY_TRACKEDWORKLOAD;
pub const D3D11_MESSAGE_ID_CREATE_TRACKED_WORKLOAD_NULLPARAM = D3D11_MESSAGE_ID.CREATE_TRACKED_WORKLOAD_NULLPARAM;
pub const D3D11_MESSAGE_ID_CREATE_TRACKED_WORKLOAD_INVALID_MAX_INSTANCES = D3D11_MESSAGE_ID.CREATE_TRACKED_WORKLOAD_INVALID_MAX_INSTANCES;
pub const D3D11_MESSAGE_ID_CREATE_TRACKED_WORKLOAD_INVALID_DEADLINE_TYPE = D3D11_MESSAGE_ID.CREATE_TRACKED_WORKLOAD_INVALID_DEADLINE_TYPE;
pub const D3D11_MESSAGE_ID_CREATE_TRACKED_WORKLOAD_INVALID_ENGINE_TYPE = D3D11_MESSAGE_ID.CREATE_TRACKED_WORKLOAD_INVALID_ENGINE_TYPE;
pub const D3D11_MESSAGE_ID_MULTIPLE_TRACKED_WORKLOADS = D3D11_MESSAGE_ID.MULTIPLE_TRACKED_WORKLOADS;
pub const D3D11_MESSAGE_ID_MULTIPLE_TRACKED_WORKLOAD_PAIRS = D3D11_MESSAGE_ID.MULTIPLE_TRACKED_WORKLOAD_PAIRS;
pub const D3D11_MESSAGE_ID_INCOMPLETE_TRACKED_WORKLOAD_PAIR = D3D11_MESSAGE_ID.INCOMPLETE_TRACKED_WORKLOAD_PAIR;
pub const D3D11_MESSAGE_ID_OUT_OF_ORDER_TRACKED_WORKLOAD_PAIR = D3D11_MESSAGE_ID.OUT_OF_ORDER_TRACKED_WORKLOAD_PAIR;
pub const D3D11_MESSAGE_ID_CANNOT_ADD_TRACKED_WORKLOAD = D3D11_MESSAGE_ID.CANNOT_ADD_TRACKED_WORKLOAD;
pub const D3D11_MESSAGE_ID_TRACKED_WORKLOAD_NOT_SUPPORTED = D3D11_MESSAGE_ID.TRACKED_WORKLOAD_NOT_SUPPORTED;
pub const D3D11_MESSAGE_ID_TRACKED_WORKLOAD_ENGINE_TYPE_NOT_FOUND = D3D11_MESSAGE_ID.TRACKED_WORKLOAD_ENGINE_TYPE_NOT_FOUND;
pub const D3D11_MESSAGE_ID_NO_TRACKED_WORKLOAD_SLOT_AVAILABLE = D3D11_MESSAGE_ID.NO_TRACKED_WORKLOAD_SLOT_AVAILABLE;
pub const D3D11_MESSAGE_ID_END_TRACKED_WORKLOAD_INVALID_ARG = D3D11_MESSAGE_ID.END_TRACKED_WORKLOAD_INVALID_ARG;
pub const D3D11_MESSAGE_ID_TRACKED_WORKLOAD_DISJOINT_FAILURE = D3D11_MESSAGE_ID.TRACKED_WORKLOAD_DISJOINT_FAILURE;
pub const D3D11_MESSAGE_ID_D3D11_5_MESSAGES_END = D3D11_MESSAGE_ID.D3D11_5_MESSAGES_END;
pub const D3D11_MESSAGE = extern struct {
Category: D3D11_MESSAGE_CATEGORY,
Severity: D3D11_MESSAGE_SEVERITY,
ID: D3D11_MESSAGE_ID,
pDescription: ?*const u8,
DescriptionByteLength: usize,
};
pub const D3D11_INFO_QUEUE_FILTER_DESC = extern struct {
NumCategories: u32,
pCategoryList: ?*D3D11_MESSAGE_CATEGORY,
NumSeverities: u32,
pSeverityList: ?*D3D11_MESSAGE_SEVERITY,
NumIDs: u32,
pIDList: ?*D3D11_MESSAGE_ID,
};
pub const D3D11_INFO_QUEUE_FILTER = extern struct {
AllowList: D3D11_INFO_QUEUE_FILTER_DESC,
DenyList: D3D11_INFO_QUEUE_FILTER_DESC,
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11InfoQueue_Value = @import("../zig.zig").Guid.initString("6543dbb6-1b48-42f5-ab82-e97ec74326f6");
pub const IID_ID3D11InfoQueue = &IID_ID3D11InfoQueue_Value;
pub const ID3D11InfoQueue = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetMessageCountLimit: fn(
self: *const ID3D11InfoQueue,
MessageCountLimit: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ClearStoredMessages: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) void,
GetMessage: fn(
self: *const ID3D11InfoQueue,
MessageIndex: u64,
// TODO: what to do with BytesParamIndex 2?
pMessage: ?*D3D11_MESSAGE,
pMessageByteLength: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetNumMessagesAllowedByStorageFilter: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) u64,
GetNumMessagesDeniedByStorageFilter: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) u64,
GetNumStoredMessages: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) u64,
GetNumStoredMessagesAllowedByRetrievalFilter: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) u64,
GetNumMessagesDiscardedByMessageCountLimit: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) u64,
GetMessageCountLimit: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) u64,
AddStorageFilterEntries: fn(
self: *const ID3D11InfoQueue,
pFilter: ?*D3D11_INFO_QUEUE_FILTER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStorageFilter: fn(
self: *const ID3D11InfoQueue,
// TODO: what to do with BytesParamIndex 1?
pFilter: ?*D3D11_INFO_QUEUE_FILTER,
pFilterByteLength: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ClearStorageFilter: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) void,
PushEmptyStorageFilter: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PushCopyOfStorageFilter: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PushStorageFilter: fn(
self: *const ID3D11InfoQueue,
pFilter: ?*D3D11_INFO_QUEUE_FILTER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PopStorageFilter: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) void,
GetStorageFilterStackSize: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) u32,
AddRetrievalFilterEntries: fn(
self: *const ID3D11InfoQueue,
pFilter: ?*D3D11_INFO_QUEUE_FILTER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetRetrievalFilter: fn(
self: *const ID3D11InfoQueue,
// TODO: what to do with BytesParamIndex 1?
pFilter: ?*D3D11_INFO_QUEUE_FILTER,
pFilterByteLength: ?*usize,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ClearRetrievalFilter: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) void,
PushEmptyRetrievalFilter: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PushCopyOfRetrievalFilter: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PushRetrievalFilter: fn(
self: *const ID3D11InfoQueue,
pFilter: ?*D3D11_INFO_QUEUE_FILTER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PopRetrievalFilter: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) void,
GetRetrievalFilterStackSize: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) u32,
AddMessage: fn(
self: *const ID3D11InfoQueue,
Category: D3D11_MESSAGE_CATEGORY,
Severity: D3D11_MESSAGE_SEVERITY,
ID: D3D11_MESSAGE_ID,
pDescription: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddApplicationMessage: fn(
self: *const ID3D11InfoQueue,
Severity: D3D11_MESSAGE_SEVERITY,
pDescription: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBreakOnCategory: fn(
self: *const ID3D11InfoQueue,
Category: D3D11_MESSAGE_CATEGORY,
bEnable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBreakOnSeverity: fn(
self: *const ID3D11InfoQueue,
Severity: D3D11_MESSAGE_SEVERITY,
bEnable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBreakOnID: fn(
self: *const ID3D11InfoQueue,
ID: D3D11_MESSAGE_ID,
bEnable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetBreakOnCategory: fn(
self: *const ID3D11InfoQueue,
Category: D3D11_MESSAGE_CATEGORY,
) callconv(@import("std").os.windows.WINAPI) BOOL,
GetBreakOnSeverity: fn(
self: *const ID3D11InfoQueue,
Severity: D3D11_MESSAGE_SEVERITY,
) callconv(@import("std").os.windows.WINAPI) BOOL,
GetBreakOnID: fn(
self: *const ID3D11InfoQueue,
ID: D3D11_MESSAGE_ID,
) callconv(@import("std").os.windows.WINAPI) BOOL,
SetMuteDebugOutput: fn(
self: *const ID3D11InfoQueue,
bMute: BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
GetMuteDebugOutput: fn(
self: *const ID3D11InfoQueue,
) callconv(@import("std").os.windows.WINAPI) BOOL,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_SetMessageCountLimit(self: *const T, MessageCountLimit: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).SetMessageCountLimit(@ptrCast(*const ID3D11InfoQueue, self), MessageCountLimit);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_ClearStoredMessages(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).ClearStoredMessages(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetMessage(self: *const T, MessageIndex: u64, pMessage: ?*D3D11_MESSAGE, pMessageByteLength: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetMessage(@ptrCast(*const ID3D11InfoQueue, self), MessageIndex, pMessage, pMessageByteLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetNumMessagesAllowedByStorageFilter(self: *const T) callconv(.Inline) u64 {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetNumMessagesAllowedByStorageFilter(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetNumMessagesDeniedByStorageFilter(self: *const T) callconv(.Inline) u64 {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetNumMessagesDeniedByStorageFilter(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetNumStoredMessages(self: *const T) callconv(.Inline) u64 {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetNumStoredMessages(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetNumStoredMessagesAllowedByRetrievalFilter(self: *const T) callconv(.Inline) u64 {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetNumStoredMessagesAllowedByRetrievalFilter(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetNumMessagesDiscardedByMessageCountLimit(self: *const T) callconv(.Inline) u64 {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetNumMessagesDiscardedByMessageCountLimit(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetMessageCountLimit(self: *const T) callconv(.Inline) u64 {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetMessageCountLimit(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_AddStorageFilterEntries(self: *const T, pFilter: ?*D3D11_INFO_QUEUE_FILTER) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).AddStorageFilterEntries(@ptrCast(*const ID3D11InfoQueue, self), pFilter);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetStorageFilter(self: *const T, pFilter: ?*D3D11_INFO_QUEUE_FILTER, pFilterByteLength: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetStorageFilter(@ptrCast(*const ID3D11InfoQueue, self), pFilter, pFilterByteLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_ClearStorageFilter(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).ClearStorageFilter(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_PushEmptyStorageFilter(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).PushEmptyStorageFilter(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_PushCopyOfStorageFilter(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).PushCopyOfStorageFilter(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_PushStorageFilter(self: *const T, pFilter: ?*D3D11_INFO_QUEUE_FILTER) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).PushStorageFilter(@ptrCast(*const ID3D11InfoQueue, self), pFilter);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_PopStorageFilter(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).PopStorageFilter(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetStorageFilterStackSize(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetStorageFilterStackSize(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_AddRetrievalFilterEntries(self: *const T, pFilter: ?*D3D11_INFO_QUEUE_FILTER) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).AddRetrievalFilterEntries(@ptrCast(*const ID3D11InfoQueue, self), pFilter);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetRetrievalFilter(self: *const T, pFilter: ?*D3D11_INFO_QUEUE_FILTER, pFilterByteLength: ?*usize) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetRetrievalFilter(@ptrCast(*const ID3D11InfoQueue, self), pFilter, pFilterByteLength);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_ClearRetrievalFilter(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).ClearRetrievalFilter(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_PushEmptyRetrievalFilter(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).PushEmptyRetrievalFilter(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_PushCopyOfRetrievalFilter(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).PushCopyOfRetrievalFilter(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_PushRetrievalFilter(self: *const T, pFilter: ?*D3D11_INFO_QUEUE_FILTER) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).PushRetrievalFilter(@ptrCast(*const ID3D11InfoQueue, self), pFilter);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_PopRetrievalFilter(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).PopRetrievalFilter(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetRetrievalFilterStackSize(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetRetrievalFilterStackSize(@ptrCast(*const ID3D11InfoQueue, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_AddMessage(self: *const T, Category: D3D11_MESSAGE_CATEGORY, Severity: D3D11_MESSAGE_SEVERITY, ID: D3D11_MESSAGE_ID, pDescription: ?[*:0]const u8) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).AddMessage(@ptrCast(*const ID3D11InfoQueue, self), Category, Severity, ID, pDescription);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_AddApplicationMessage(self: *const T, Severity: D3D11_MESSAGE_SEVERITY, pDescription: ?[*:0]const u8) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).AddApplicationMessage(@ptrCast(*const ID3D11InfoQueue, self), Severity, pDescription);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_SetBreakOnCategory(self: *const T, Category: D3D11_MESSAGE_CATEGORY, bEnable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).SetBreakOnCategory(@ptrCast(*const ID3D11InfoQueue, self), Category, bEnable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_SetBreakOnSeverity(self: *const T, Severity: D3D11_MESSAGE_SEVERITY, bEnable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).SetBreakOnSeverity(@ptrCast(*const ID3D11InfoQueue, self), Severity, bEnable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_SetBreakOnID(self: *const T, ID: D3D11_MESSAGE_ID, bEnable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).SetBreakOnID(@ptrCast(*const ID3D11InfoQueue, self), ID, bEnable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetBreakOnCategory(self: *const T, Category: D3D11_MESSAGE_CATEGORY) callconv(.Inline) BOOL {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetBreakOnCategory(@ptrCast(*const ID3D11InfoQueue, self), Category);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetBreakOnSeverity(self: *const T, Severity: D3D11_MESSAGE_SEVERITY) callconv(.Inline) BOOL {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetBreakOnSeverity(@ptrCast(*const ID3D11InfoQueue, self), Severity);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetBreakOnID(self: *const T, ID: D3D11_MESSAGE_ID) callconv(.Inline) BOOL {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetBreakOnID(@ptrCast(*const ID3D11InfoQueue, self), ID);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_SetMuteDebugOutput(self: *const T, bMute: BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).SetMuteDebugOutput(@ptrCast(*const ID3D11InfoQueue, self), bMute);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11InfoQueue_GetMuteDebugOutput(self: *const T) callconv(.Inline) BOOL {
return @ptrCast(*const ID3D11InfoQueue.VTable, self.vtable).GetMuteDebugOutput(@ptrCast(*const ID3D11InfoQueue, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const PFN_D3D11_CREATE_DEVICE = fn(
param0: ?*IDXGIAdapter,
param1: D3D_DRIVER_TYPE,
param2: ?HINSTANCE,
param3: u32,
param4: ?[*]const D3D_FEATURE_LEVEL,
FeatureLevels: u32,
param6: u32,
param7: ?*?*ID3D11Device,
param8: ?*D3D_FEATURE_LEVEL,
param9: ?*?*ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub const PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN = fn(
param0: ?*IDXGIAdapter,
param1: D3D_DRIVER_TYPE,
param2: ?HINSTANCE,
param3: u32,
param4: ?[*]const D3D_FEATURE_LEVEL,
FeatureLevels: u32,
param6: u32,
param7: ?*const DXGI_SWAP_CHAIN_DESC,
param8: ?*?*IDXGISwapChain,
param9: ?*?*ID3D11Device,
param10: ?*D3D_FEATURE_LEVEL,
param11: ?*?*ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub const D3D11_COPY_FLAGS = enum(i32) {
NO_OVERWRITE = 1,
DISCARD = 2,
};
pub const D3D11_COPY_NO_OVERWRITE = D3D11_COPY_FLAGS.NO_OVERWRITE;
pub const D3D11_COPY_DISCARD = D3D11_COPY_FLAGS.DISCARD;
pub const D3D11_LOGIC_OP = enum(i32) {
CLEAR = 0,
SET = 1,
COPY = 2,
COPY_INVERTED = 3,
NOOP = 4,
INVERT = 5,
AND = 6,
NAND = 7,
OR = 8,
NOR = 9,
XOR = 10,
EQUIV = 11,
AND_REVERSE = 12,
AND_INVERTED = 13,
OR_REVERSE = 14,
OR_INVERTED = 15,
};
pub const D3D11_LOGIC_OP_CLEAR = D3D11_LOGIC_OP.CLEAR;
pub const D3D11_LOGIC_OP_SET = D3D11_LOGIC_OP.SET;
pub const D3D11_LOGIC_OP_COPY = D3D11_LOGIC_OP.COPY;
pub const D3D11_LOGIC_OP_COPY_INVERTED = D3D11_LOGIC_OP.COPY_INVERTED;
pub const D3D11_LOGIC_OP_NOOP = D3D11_LOGIC_OP.NOOP;
pub const D3D11_LOGIC_OP_INVERT = D3D11_LOGIC_OP.INVERT;
pub const D3D11_LOGIC_OP_AND = D3D11_LOGIC_OP.AND;
pub const D3D11_LOGIC_OP_NAND = D3D11_LOGIC_OP.NAND;
pub const D3D11_LOGIC_OP_OR = D3D11_LOGIC_OP.OR;
pub const D3D11_LOGIC_OP_NOR = D3D11_LOGIC_OP.NOR;
pub const D3D11_LOGIC_OP_XOR = D3D11_LOGIC_OP.XOR;
pub const D3D11_LOGIC_OP_EQUIV = D3D11_LOGIC_OP.EQUIV;
pub const D3D11_LOGIC_OP_AND_REVERSE = D3D11_LOGIC_OP.AND_REVERSE;
pub const D3D11_LOGIC_OP_AND_INVERTED = D3D11_LOGIC_OP.AND_INVERTED;
pub const D3D11_LOGIC_OP_OR_REVERSE = D3D11_LOGIC_OP.OR_REVERSE;
pub const D3D11_LOGIC_OP_OR_INVERTED = D3D11_LOGIC_OP.OR_INVERTED;
pub const D3D11_RENDER_TARGET_BLEND_DESC1 = extern struct {
BlendEnable: BOOL,
LogicOpEnable: BOOL,
SrcBlend: D3D11_BLEND,
DestBlend: D3D11_BLEND,
BlendOp: D3D11_BLEND_OP,
SrcBlendAlpha: D3D11_BLEND,
DestBlendAlpha: D3D11_BLEND,
BlendOpAlpha: D3D11_BLEND_OP,
LogicOp: D3D11_LOGIC_OP,
RenderTargetWriteMask: u8,
};
pub const D3D11_BLEND_DESC1 = extern struct {
AlphaToCoverageEnable: BOOL,
IndependentBlendEnable: BOOL,
RenderTarget: [8]D3D11_RENDER_TARGET_BLEND_DESC1,
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11BlendState1_Value = @import("../zig.zig").Guid.initString("cc86fabe-da55-401d-85e7-e3c9de2877e9");
pub const IID_ID3D11BlendState1 = &IID_ID3D11BlendState1_Value;
pub const ID3D11BlendState1 = extern struct {
pub const VTable = extern struct {
base: ID3D11BlendState.VTable,
GetDesc1: fn(
self: *const ID3D11BlendState1,
pDesc: ?*D3D11_BLEND_DESC1,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11BlendState.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11BlendState1_GetDesc1(self: *const T, pDesc: ?*D3D11_BLEND_DESC1) callconv(.Inline) void {
return @ptrCast(*const ID3D11BlendState1.VTable, self.vtable).GetDesc1(@ptrCast(*const ID3D11BlendState1, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_RASTERIZER_DESC1 = extern struct {
FillMode: D3D11_FILL_MODE,
CullMode: D3D11_CULL_MODE,
FrontCounterClockwise: BOOL,
DepthBias: i32,
DepthBiasClamp: f32,
SlopeScaledDepthBias: f32,
DepthClipEnable: BOOL,
ScissorEnable: BOOL,
MultisampleEnable: BOOL,
AntialiasedLineEnable: BOOL,
ForcedSampleCount: u32,
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11RasterizerState1_Value = @import("../zig.zig").Guid.initString("1217d7a6-5039-418c-b042-9cbe256afd6e");
pub const IID_ID3D11RasterizerState1 = &IID_ID3D11RasterizerState1_Value;
pub const ID3D11RasterizerState1 = extern struct {
pub const VTable = extern struct {
base: ID3D11RasterizerState.VTable,
GetDesc1: fn(
self: *const ID3D11RasterizerState1,
pDesc: ?*D3D11_RASTERIZER_DESC1,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11RasterizerState.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11RasterizerState1_GetDesc1(self: *const T, pDesc: ?*D3D11_RASTERIZER_DESC1) callconv(.Inline) void {
return @ptrCast(*const ID3D11RasterizerState1.VTable, self.vtable).GetDesc1(@ptrCast(*const ID3D11RasterizerState1, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_1_CREATE_DEVICE_CONTEXT_STATE_FLAG = enum(i32) {
D = 1,
};
pub const D3D11_1_CREATE_DEVICE_CONTEXT_STATE_SINGLETHREADED = D3D11_1_CREATE_DEVICE_CONTEXT_STATE_FLAG.D;
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3DDeviceContextState_Value = @import("../zig.zig").Guid.initString("5c1e0d8a-7c23-48f9-8c59-a92958ceff11");
pub const IID_ID3DDeviceContextState = &IID_ID3DDeviceContextState_Value;
pub const ID3DDeviceContextState = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11DeviceContext1_Value = @import("../zig.zig").Guid.initString("bb2c6faa-b5fb-4082-8e6b-388b8cfa90e1");
pub const IID_ID3D11DeviceContext1 = &IID_ID3D11DeviceContext1_Value;
pub const ID3D11DeviceContext1 = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceContext.VTable,
CopySubresourceRegion1: fn(
self: *const ID3D11DeviceContext1,
pDstResource: ?*ID3D11Resource,
DstSubresource: u32,
DstX: u32,
DstY: u32,
DstZ: u32,
pSrcResource: ?*ID3D11Resource,
SrcSubresource: u32,
pSrcBox: ?*const D3D11_BOX,
CopyFlags: u32,
) callconv(@import("std").os.windows.WINAPI) void,
UpdateSubresource1: fn(
self: *const ID3D11DeviceContext1,
pDstResource: ?*ID3D11Resource,
DstSubresource: u32,
pDstBox: ?*const D3D11_BOX,
pSrcData: ?*const anyopaque,
SrcRowPitch: u32,
SrcDepthPitch: u32,
CopyFlags: u32,
) callconv(@import("std").os.windows.WINAPI) void,
DiscardResource: fn(
self: *const ID3D11DeviceContext1,
pResource: ?*ID3D11Resource,
) callconv(@import("std").os.windows.WINAPI) void,
DiscardView: fn(
self: *const ID3D11DeviceContext1,
pResourceView: ?*ID3D11View,
) callconv(@import("std").os.windows.WINAPI) void,
VSSetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]const u32,
pNumConstants: ?[*]const u32,
) callconv(@import("std").os.windows.WINAPI) void,
HSSetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]const u32,
pNumConstants: ?[*]const u32,
) callconv(@import("std").os.windows.WINAPI) void,
DSSetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]const u32,
pNumConstants: ?[*]const u32,
) callconv(@import("std").os.windows.WINAPI) void,
GSSetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]const u32,
pNumConstants: ?[*]const u32,
) callconv(@import("std").os.windows.WINAPI) void,
PSSetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]const u32,
pNumConstants: ?[*]const u32,
) callconv(@import("std").os.windows.WINAPI) void,
CSSetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]const u32,
pNumConstants: ?[*]const u32,
) callconv(@import("std").os.windows.WINAPI) void,
VSGetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]u32,
pNumConstants: ?[*]u32,
) callconv(@import("std").os.windows.WINAPI) void,
HSGetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]u32,
pNumConstants: ?[*]u32,
) callconv(@import("std").os.windows.WINAPI) void,
DSGetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]u32,
pNumConstants: ?[*]u32,
) callconv(@import("std").os.windows.WINAPI) void,
GSGetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]u32,
pNumConstants: ?[*]u32,
) callconv(@import("std").os.windows.WINAPI) void,
PSGetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]u32,
pNumConstants: ?[*]u32,
) callconv(@import("std").os.windows.WINAPI) void,
CSGetConstantBuffers1: fn(
self: *const ID3D11DeviceContext1,
StartSlot: u32,
NumBuffers: u32,
ppConstantBuffers: ?[*]?*ID3D11Buffer,
pFirstConstant: ?[*]u32,
pNumConstants: ?[*]u32,
) callconv(@import("std").os.windows.WINAPI) void,
SwapDeviceContextState: fn(
self: *const ID3D11DeviceContext1,
pState: ?*ID3DDeviceContextState,
ppPreviousState: ?*?*ID3DDeviceContextState,
) callconv(@import("std").os.windows.WINAPI) void,
ClearView: fn(
self: *const ID3D11DeviceContext1,
pView: ?*ID3D11View,
Color: ?*const f32,
pRect: ?[*]const RECT,
NumRects: u32,
) callconv(@import("std").os.windows.WINAPI) void,
DiscardView1: fn(
self: *const ID3D11DeviceContext1,
pResourceView: ?*ID3D11View,
pRects: ?[*]const RECT,
NumRects: u32,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceContext.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_CopySubresourceRegion1(self: *const T, pDstResource: ?*ID3D11Resource, DstSubresource: u32, DstX: u32, DstY: u32, DstZ: u32, pSrcResource: ?*ID3D11Resource, SrcSubresource: u32, pSrcBox: ?*const D3D11_BOX, CopyFlags: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).CopySubresourceRegion1(@ptrCast(*const ID3D11DeviceContext1, self), pDstResource, DstSubresource, DstX, DstY, DstZ, pSrcResource, SrcSubresource, pSrcBox, CopyFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_UpdateSubresource1(self: *const T, pDstResource: ?*ID3D11Resource, DstSubresource: u32, pDstBox: ?*const D3D11_BOX, pSrcData: ?*const anyopaque, SrcRowPitch: u32, SrcDepthPitch: u32, CopyFlags: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).UpdateSubresource1(@ptrCast(*const ID3D11DeviceContext1, self), pDstResource, DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch, CopyFlags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_DiscardResource(self: *const T, pResource: ?*ID3D11Resource) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).DiscardResource(@ptrCast(*const ID3D11DeviceContext1, self), pResource);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_DiscardView(self: *const T, pResourceView: ?*ID3D11View) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).DiscardView(@ptrCast(*const ID3D11DeviceContext1, self), pResourceView);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_VSSetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]const u32, pNumConstants: ?[*]const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).VSSetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_HSSetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]const u32, pNumConstants: ?[*]const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).HSSetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_DSSetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]const u32, pNumConstants: ?[*]const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).DSSetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_GSSetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]const u32, pNumConstants: ?[*]const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).GSSetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_PSSetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]const u32, pNumConstants: ?[*]const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).PSSetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_CSSetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]const u32, pNumConstants: ?[*]const u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).CSSetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_VSGetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]u32, pNumConstants: ?[*]u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).VSGetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_HSGetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]u32, pNumConstants: ?[*]u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).HSGetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_DSGetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]u32, pNumConstants: ?[*]u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).DSGetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_GSGetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]u32, pNumConstants: ?[*]u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).GSGetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_PSGetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]u32, pNumConstants: ?[*]u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).PSGetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_CSGetConstantBuffers1(self: *const T, StartSlot: u32, NumBuffers: u32, ppConstantBuffers: ?[*]?*ID3D11Buffer, pFirstConstant: ?[*]u32, pNumConstants: ?[*]u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).CSGetConstantBuffers1(@ptrCast(*const ID3D11DeviceContext1, self), StartSlot, NumBuffers, ppConstantBuffers, pFirstConstant, pNumConstants);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_SwapDeviceContextState(self: *const T, pState: ?*ID3DDeviceContextState, ppPreviousState: ?*?*ID3DDeviceContextState) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).SwapDeviceContextState(@ptrCast(*const ID3D11DeviceContext1, self), pState, ppPreviousState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_ClearView(self: *const T, pView: ?*ID3D11View, Color: ?*const f32, pRect: ?[*]const RECT, NumRects: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).ClearView(@ptrCast(*const ID3D11DeviceContext1, self), pView, Color, pRect, NumRects);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext1_DiscardView1(self: *const T, pResourceView: ?*ID3D11View, pRects: ?[*]const RECT, NumRects: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext1.VTable, self.vtable).DiscardView1(@ptrCast(*const ID3D11DeviceContext1, self), pResourceView, pRects, NumRects);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_VIDEO_DECODER_SUB_SAMPLE_MAPPING_BLOCK = extern struct {
ClearSize: u32,
EncryptedSize: u32,
};
pub const D3D11_VIDEO_DECODER_BUFFER_DESC1 = extern struct {
BufferType: D3D11_VIDEO_DECODER_BUFFER_TYPE,
DataOffset: u32,
DataSize: u32,
pIV: ?*anyopaque,
IVSize: u32,
pSubSampleMappingBlock: ?*D3D11_VIDEO_DECODER_SUB_SAMPLE_MAPPING_BLOCK,
SubSampleMappingCount: u32,
};
pub const D3D11_VIDEO_DECODER_BEGIN_FRAME_CRYPTO_SESSION = extern struct {
pCryptoSession: ?*ID3D11CryptoSession,
BlobSize: u32,
pBlob: ?*anyopaque,
pKeyInfoId: ?*Guid,
PrivateDataSize: u32,
pPrivateData: ?*anyopaque,
};
pub const D3D11_VIDEO_DECODER_CAPS = enum(i32) {
DOWNSAMPLE = 1,
NON_REAL_TIME = 2,
DOWNSAMPLE_DYNAMIC = 4,
DOWNSAMPLE_REQUIRED = 8,
UNSUPPORTED = 16,
};
pub const D3D11_VIDEO_DECODER_CAPS_DOWNSAMPLE = D3D11_VIDEO_DECODER_CAPS.DOWNSAMPLE;
pub const D3D11_VIDEO_DECODER_CAPS_NON_REAL_TIME = D3D11_VIDEO_DECODER_CAPS.NON_REAL_TIME;
pub const D3D11_VIDEO_DECODER_CAPS_DOWNSAMPLE_DYNAMIC = D3D11_VIDEO_DECODER_CAPS.DOWNSAMPLE_DYNAMIC;
pub const D3D11_VIDEO_DECODER_CAPS_DOWNSAMPLE_REQUIRED = D3D11_VIDEO_DECODER_CAPS.DOWNSAMPLE_REQUIRED;
pub const D3D11_VIDEO_DECODER_CAPS_UNSUPPORTED = D3D11_VIDEO_DECODER_CAPS.UNSUPPORTED;
pub const D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINTS = enum(i32) {
MULTIPLANE_OVERLAY_ROTATION = 1,
MULTIPLANE_OVERLAY_RESIZE = 2,
MULTIPLANE_OVERLAY_COLOR_SPACE_CONVERSION = 4,
TRIPLE_BUFFER_OUTPUT = 8,
};
pub const D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_MULTIPLANE_OVERLAY_ROTATION = D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINTS.MULTIPLANE_OVERLAY_ROTATION;
pub const D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_MULTIPLANE_OVERLAY_RESIZE = D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINTS.MULTIPLANE_OVERLAY_RESIZE;
pub const D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_MULTIPLANE_OVERLAY_COLOR_SPACE_CONVERSION = D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINTS.MULTIPLANE_OVERLAY_COLOR_SPACE_CONVERSION;
pub const D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINT_TRIPLE_BUFFER_OUTPUT = D3D11_VIDEO_PROCESSOR_BEHAVIOR_HINTS.TRIPLE_BUFFER_OUTPUT;
pub const D3D11_VIDEO_PROCESSOR_STREAM_BEHAVIOR_HINT = extern struct {
Enable: BOOL,
Width: u32,
Height: u32,
Format: DXGI_FORMAT,
};
pub const D3D11_CRYPTO_SESSION_STATUS = enum(i32) {
OK = 0,
KEY_LOST = 1,
KEY_AND_CONTENT_LOST = 2,
};
pub const D3D11_CRYPTO_SESSION_STATUS_OK = D3D11_CRYPTO_SESSION_STATUS.OK;
pub const D3D11_CRYPTO_SESSION_STATUS_KEY_LOST = D3D11_CRYPTO_SESSION_STATUS.KEY_LOST;
pub const D3D11_CRYPTO_SESSION_STATUS_KEY_AND_CONTENT_LOST = D3D11_CRYPTO_SESSION_STATUS.KEY_AND_CONTENT_LOST;
pub const D3D11_KEY_EXCHANGE_HW_PROTECTION_INPUT_DATA = extern struct {
PrivateDataSize: u32,
HWProtectionDataSize: u32,
pbInput: [4]u8,
};
pub const D3D11_KEY_EXCHANGE_HW_PROTECTION_OUTPUT_DATA = extern struct {
PrivateDataSize: u32,
MaxHWProtectionDataSize: u32,
HWProtectionDataSize: u32,
TransportTime: u64,
ExecutionTime: u64,
pbOutput: [4]u8,
};
pub const D3D11_KEY_EXCHANGE_HW_PROTECTION_DATA = extern struct {
HWProtectionFunctionID: u32,
pInputData: ?*D3D11_KEY_EXCHANGE_HW_PROTECTION_INPUT_DATA,
pOutputData: ?*D3D11_KEY_EXCHANGE_HW_PROTECTION_OUTPUT_DATA,
Status: HRESULT,
};
pub const D3D11_VIDEO_SAMPLE_DESC = extern struct {
Width: u32,
Height: u32,
Format: DXGI_FORMAT,
ColorSpace: DXGI_COLOR_SPACE_TYPE,
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11VideoContext1_Value = @import("../zig.zig").Guid.initString("a7f026da-a5f8-4487-a564-15e34357651e");
pub const IID_ID3D11VideoContext1 = &IID_ID3D11VideoContext1_Value;
pub const ID3D11VideoContext1 = extern struct {
pub const VTable = extern struct {
base: ID3D11VideoContext.VTable,
SubmitDecoderBuffers1: fn(
self: *const ID3D11VideoContext1,
pDecoder: ?*ID3D11VideoDecoder,
NumBuffers: u32,
pBufferDesc: [*]const D3D11_VIDEO_DECODER_BUFFER_DESC1,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetDataForNewHardwareKey: fn(
self: *const ID3D11VideoContext1,
pCryptoSession: ?*ID3D11CryptoSession,
PrivateInputSize: u32,
pPrivatInputData: [*]const u8,
pPrivateOutputData: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CheckCryptoSessionStatus: fn(
self: *const ID3D11VideoContext1,
pCryptoSession: ?*ID3D11CryptoSession,
pStatus: ?*D3D11_CRYPTO_SESSION_STATUS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DecoderEnableDownsampling: fn(
self: *const ID3D11VideoContext1,
pDecoder: ?*ID3D11VideoDecoder,
InputColorSpace: DXGI_COLOR_SPACE_TYPE,
pOutputDesc: ?*const D3D11_VIDEO_SAMPLE_DESC,
ReferenceFrameCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DecoderUpdateDownsampling: fn(
self: *const ID3D11VideoContext1,
pDecoder: ?*ID3D11VideoDecoder,
pOutputDesc: ?*const D3D11_VIDEO_SAMPLE_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
VideoProcessorSetOutputColorSpace1: fn(
self: *const ID3D11VideoContext1,
pVideoProcessor: ?*ID3D11VideoProcessor,
ColorSpace: DXGI_COLOR_SPACE_TYPE,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetOutputShaderUsage: fn(
self: *const ID3D11VideoContext1,
pVideoProcessor: ?*ID3D11VideoProcessor,
ShaderUsage: BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetOutputColorSpace1: fn(
self: *const ID3D11VideoContext1,
pVideoProcessor: ?*ID3D11VideoProcessor,
pColorSpace: ?*DXGI_COLOR_SPACE_TYPE,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetOutputShaderUsage: fn(
self: *const ID3D11VideoContext1,
pVideoProcessor: ?*ID3D11VideoProcessor,
pShaderUsage: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamColorSpace1: fn(
self: *const ID3D11VideoContext1,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
ColorSpace: DXGI_COLOR_SPACE_TYPE,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamMirror: fn(
self: *const ID3D11VideoContext1,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Enable: BOOL,
FlipHorizontal: BOOL,
FlipVertical: BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamColorSpace1: fn(
self: *const ID3D11VideoContext1,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pColorSpace: ?*DXGI_COLOR_SPACE_TYPE,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamMirror: fn(
self: *const ID3D11VideoContext1,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pEnable: ?*BOOL,
pFlipHorizontal: ?*BOOL,
pFlipVertical: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetBehaviorHints: fn(
self: *const ID3D11VideoContext1,
pVideoProcessor: ?*ID3D11VideoProcessor,
OutputWidth: u32,
OutputHeight: u32,
OutputFormat: DXGI_FORMAT,
StreamCount: u32,
pStreams: [*]const D3D11_VIDEO_PROCESSOR_STREAM_BEHAVIOR_HINT,
pBehaviorHints: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11VideoContext.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_SubmitDecoderBuffers1(self: *const T, pDecoder: ?*ID3D11VideoDecoder, NumBuffers: u32, pBufferDesc: [*]const D3D11_VIDEO_DECODER_BUFFER_DESC1) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).SubmitDecoderBuffers1(@ptrCast(*const ID3D11VideoContext1, self), pDecoder, NumBuffers, pBufferDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_GetDataForNewHardwareKey(self: *const T, pCryptoSession: ?*ID3D11CryptoSession, PrivateInputSize: u32, pPrivatInputData: [*]const u8, pPrivateOutputData: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).GetDataForNewHardwareKey(@ptrCast(*const ID3D11VideoContext1, self), pCryptoSession, PrivateInputSize, pPrivatInputData, pPrivateOutputData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_CheckCryptoSessionStatus(self: *const T, pCryptoSession: ?*ID3D11CryptoSession, pStatus: ?*D3D11_CRYPTO_SESSION_STATUS) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).CheckCryptoSessionStatus(@ptrCast(*const ID3D11VideoContext1, self), pCryptoSession, pStatus);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_DecoderEnableDownsampling(self: *const T, pDecoder: ?*ID3D11VideoDecoder, InputColorSpace: DXGI_COLOR_SPACE_TYPE, pOutputDesc: ?*const D3D11_VIDEO_SAMPLE_DESC, ReferenceFrameCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).DecoderEnableDownsampling(@ptrCast(*const ID3D11VideoContext1, self), pDecoder, InputColorSpace, pOutputDesc, ReferenceFrameCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_DecoderUpdateDownsampling(self: *const T, pDecoder: ?*ID3D11VideoDecoder, pOutputDesc: ?*const D3D11_VIDEO_SAMPLE_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).DecoderUpdateDownsampling(@ptrCast(*const ID3D11VideoContext1, self), pDecoder, pOutputDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_VideoProcessorSetOutputColorSpace1(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, ColorSpace: DXGI_COLOR_SPACE_TYPE) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).VideoProcessorSetOutputColorSpace1(@ptrCast(*const ID3D11VideoContext1, self), pVideoProcessor, ColorSpace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_VideoProcessorSetOutputShaderUsage(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, ShaderUsage: BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).VideoProcessorSetOutputShaderUsage(@ptrCast(*const ID3D11VideoContext1, self), pVideoProcessor, ShaderUsage);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_VideoProcessorGetOutputColorSpace1(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pColorSpace: ?*DXGI_COLOR_SPACE_TYPE) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).VideoProcessorGetOutputColorSpace1(@ptrCast(*const ID3D11VideoContext1, self), pVideoProcessor, pColorSpace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_VideoProcessorGetOutputShaderUsage(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pShaderUsage: ?*BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).VideoProcessorGetOutputShaderUsage(@ptrCast(*const ID3D11VideoContext1, self), pVideoProcessor, pShaderUsage);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_VideoProcessorSetStreamColorSpace1(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, ColorSpace: DXGI_COLOR_SPACE_TYPE) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).VideoProcessorSetStreamColorSpace1(@ptrCast(*const ID3D11VideoContext1, self), pVideoProcessor, StreamIndex, ColorSpace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_VideoProcessorSetStreamMirror(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Enable: BOOL, FlipHorizontal: BOOL, FlipVertical: BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).VideoProcessorSetStreamMirror(@ptrCast(*const ID3D11VideoContext1, self), pVideoProcessor, StreamIndex, Enable, FlipHorizontal, FlipVertical);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_VideoProcessorGetStreamColorSpace1(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pColorSpace: ?*DXGI_COLOR_SPACE_TYPE) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).VideoProcessorGetStreamColorSpace1(@ptrCast(*const ID3D11VideoContext1, self), pVideoProcessor, StreamIndex, pColorSpace);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_VideoProcessorGetStreamMirror(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pEnable: ?*BOOL, pFlipHorizontal: ?*BOOL, pFlipVertical: ?*BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).VideoProcessorGetStreamMirror(@ptrCast(*const ID3D11VideoContext1, self), pVideoProcessor, StreamIndex, pEnable, pFlipHorizontal, pFlipVertical);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext1_VideoProcessorGetBehaviorHints(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, OutputWidth: u32, OutputHeight: u32, OutputFormat: DXGI_FORMAT, StreamCount: u32, pStreams: [*]const D3D11_VIDEO_PROCESSOR_STREAM_BEHAVIOR_HINT, pBehaviorHints: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext1.VTable, self.vtable).VideoProcessorGetBehaviorHints(@ptrCast(*const ID3D11VideoContext1, self), pVideoProcessor, OutputWidth, OutputHeight, OutputFormat, StreamCount, pStreams, pBehaviorHints);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11VideoDevice1_Value = @import("../zig.zig").Guid.initString("29da1d51-1321-4454-804b-f5fc9f861f0f");
pub const IID_ID3D11VideoDevice1 = &IID_ID3D11VideoDevice1_Value;
pub const ID3D11VideoDevice1 = extern struct {
pub const VTable = extern struct {
base: ID3D11VideoDevice.VTable,
GetCryptoSessionPrivateDataSize: fn(
self: *const ID3D11VideoDevice1,
pCryptoType: ?*const Guid,
pDecoderProfile: ?*const Guid,
pKeyExchangeType: ?*const Guid,
pPrivateInputSize: ?*u32,
pPrivateOutputSize: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVideoDecoderCaps: fn(
self: *const ID3D11VideoDevice1,
pDecoderProfile: ?*const Guid,
SampleWidth: u32,
SampleHeight: u32,
pFrameRate: ?*const DXGI_RATIONAL,
BitRate: u32,
pCryptoType: ?*const Guid,
pDecoderCaps: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CheckVideoDecoderDownsampling: fn(
self: *const ID3D11VideoDevice1,
pInputDesc: ?*const D3D11_VIDEO_DECODER_DESC,
InputColorSpace: DXGI_COLOR_SPACE_TYPE,
pInputConfig: ?*const D3D11_VIDEO_DECODER_CONFIG,
pFrameRate: ?*const DXGI_RATIONAL,
pOutputDesc: ?*const D3D11_VIDEO_SAMPLE_DESC,
pSupported: ?*BOOL,
pRealTimeHint: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RecommendVideoDecoderDownsampleParameters: fn(
self: *const ID3D11VideoDevice1,
pInputDesc: ?*const D3D11_VIDEO_DECODER_DESC,
InputColorSpace: DXGI_COLOR_SPACE_TYPE,
pInputConfig: ?*const D3D11_VIDEO_DECODER_CONFIG,
pFrameRate: ?*const DXGI_RATIONAL,
pRecommendedOutputDesc: ?*D3D11_VIDEO_SAMPLE_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11VideoDevice.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice1_GetCryptoSessionPrivateDataSize(self: *const T, pCryptoType: ?*const Guid, pDecoderProfile: ?*const Guid, pKeyExchangeType: ?*const Guid, pPrivateInputSize: ?*u32, pPrivateOutputSize: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice1.VTable, self.vtable).GetCryptoSessionPrivateDataSize(@ptrCast(*const ID3D11VideoDevice1, self), pCryptoType, pDecoderProfile, pKeyExchangeType, pPrivateInputSize, pPrivateOutputSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice1_GetVideoDecoderCaps(self: *const T, pDecoderProfile: ?*const Guid, SampleWidth: u32, SampleHeight: u32, pFrameRate: ?*const DXGI_RATIONAL, BitRate: u32, pCryptoType: ?*const Guid, pDecoderCaps: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice1.VTable, self.vtable).GetVideoDecoderCaps(@ptrCast(*const ID3D11VideoDevice1, self), pDecoderProfile, SampleWidth, SampleHeight, pFrameRate, BitRate, pCryptoType, pDecoderCaps);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice1_CheckVideoDecoderDownsampling(self: *const T, pInputDesc: ?*const D3D11_VIDEO_DECODER_DESC, InputColorSpace: DXGI_COLOR_SPACE_TYPE, pInputConfig: ?*const D3D11_VIDEO_DECODER_CONFIG, pFrameRate: ?*const DXGI_RATIONAL, pOutputDesc: ?*const D3D11_VIDEO_SAMPLE_DESC, pSupported: ?*BOOL, pRealTimeHint: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice1.VTable, self.vtable).CheckVideoDecoderDownsampling(@ptrCast(*const ID3D11VideoDevice1, self), pInputDesc, InputColorSpace, pInputConfig, pFrameRate, pOutputDesc, pSupported, pRealTimeHint);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice1_RecommendVideoDecoderDownsampleParameters(self: *const T, pInputDesc: ?*const D3D11_VIDEO_DECODER_DESC, InputColorSpace: DXGI_COLOR_SPACE_TYPE, pInputConfig: ?*const D3D11_VIDEO_DECODER_CONFIG, pFrameRate: ?*const DXGI_RATIONAL, pRecommendedOutputDesc: ?*D3D11_VIDEO_SAMPLE_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice1.VTable, self.vtable).RecommendVideoDecoderDownsampleParameters(@ptrCast(*const ID3D11VideoDevice1, self), pInputDesc, InputColorSpace, pInputConfig, pFrameRate, pRecommendedOutputDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11VideoProcessorEnumerator1_Value = @import("../zig.zig").Guid.initString("465217f2-5568-43cf-b5b9-f61d54531ca1");
pub const IID_ID3D11VideoProcessorEnumerator1 = &IID_ID3D11VideoProcessorEnumerator1_Value;
pub const ID3D11VideoProcessorEnumerator1 = extern struct {
pub const VTable = extern struct {
base: ID3D11VideoProcessorEnumerator.VTable,
CheckVideoProcessorFormatConversion: fn(
self: *const ID3D11VideoProcessorEnumerator1,
InputFormat: DXGI_FORMAT,
InputColorSpace: DXGI_COLOR_SPACE_TYPE,
OutputFormat: DXGI_FORMAT,
OutputColorSpace: DXGI_COLOR_SPACE_TYPE,
pSupported: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11VideoProcessorEnumerator.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoProcessorEnumerator1_CheckVideoProcessorFormatConversion(self: *const T, InputFormat: DXGI_FORMAT, InputColorSpace: DXGI_COLOR_SPACE_TYPE, OutputFormat: DXGI_FORMAT, OutputColorSpace: DXGI_COLOR_SPACE_TYPE, pSupported: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoProcessorEnumerator1.VTable, self.vtable).CheckVideoProcessorFormatConversion(@ptrCast(*const ID3D11VideoProcessorEnumerator1, self), InputFormat, InputColorSpace, OutputFormat, OutputColorSpace, pSupported);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11Device1_Value = @import("../zig.zig").Guid.initString("a04bfb29-08ef-43d6-a49c-a9bdbdcbe686");
pub const IID_ID3D11Device1 = &IID_ID3D11Device1_Value;
pub const ID3D11Device1 = extern struct {
pub const VTable = extern struct {
base: ID3D11Device.VTable,
GetImmediateContext1: fn(
self: *const ID3D11Device1,
ppImmediateContext: ?*?*ID3D11DeviceContext1,
) callconv(@import("std").os.windows.WINAPI) void,
CreateDeferredContext1: fn(
self: *const ID3D11Device1,
ContextFlags: u32,
ppDeferredContext: ?*?*ID3D11DeviceContext1,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateBlendState1: fn(
self: *const ID3D11Device1,
pBlendStateDesc: ?*const D3D11_BLEND_DESC1,
ppBlendState: ?*?*ID3D11BlendState1,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRasterizerState1: fn(
self: *const ID3D11Device1,
pRasterizerDesc: ?*const D3D11_RASTERIZER_DESC1,
ppRasterizerState: ?*?*ID3D11RasterizerState1,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateDeviceContextState: fn(
self: *const ID3D11Device1,
Flags: u32,
pFeatureLevels: [*]const D3D_FEATURE_LEVEL,
FeatureLevels: u32,
SDKVersion: u32,
EmulatedInterface: ?*const Guid,
pChosenFeatureLevel: ?*D3D_FEATURE_LEVEL,
ppContextState: ?*?*ID3DDeviceContextState,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OpenSharedResource1: fn(
self: *const ID3D11Device1,
hResource: ?HANDLE,
returnedInterface: ?*const Guid,
ppResource: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
OpenSharedResourceByName: fn(
self: *const ID3D11Device1,
lpName: ?[*:0]const u16,
dwDesiredAccess: u32,
returnedInterface: ?*const Guid,
ppResource: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Device.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device1_GetImmediateContext1(self: *const T, ppImmediateContext: ?*?*ID3D11DeviceContext1) callconv(.Inline) void {
return @ptrCast(*const ID3D11Device1.VTable, self.vtable).GetImmediateContext1(@ptrCast(*const ID3D11Device1, self), ppImmediateContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device1_CreateDeferredContext1(self: *const T, ContextFlags: u32, ppDeferredContext: ?*?*ID3D11DeviceContext1) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device1.VTable, self.vtable).CreateDeferredContext1(@ptrCast(*const ID3D11Device1, self), ContextFlags, ppDeferredContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device1_CreateBlendState1(self: *const T, pBlendStateDesc: ?*const D3D11_BLEND_DESC1, ppBlendState: ?*?*ID3D11BlendState1) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device1.VTable, self.vtable).CreateBlendState1(@ptrCast(*const ID3D11Device1, self), pBlendStateDesc, ppBlendState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device1_CreateRasterizerState1(self: *const T, pRasterizerDesc: ?*const D3D11_RASTERIZER_DESC1, ppRasterizerState: ?*?*ID3D11RasterizerState1) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device1.VTable, self.vtable).CreateRasterizerState1(@ptrCast(*const ID3D11Device1, self), pRasterizerDesc, ppRasterizerState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device1_CreateDeviceContextState(self: *const T, Flags: u32, pFeatureLevels: [*]const D3D_FEATURE_LEVEL, FeatureLevels: u32, SDKVersion: u32, EmulatedInterface: ?*const Guid, pChosenFeatureLevel: ?*D3D_FEATURE_LEVEL, ppContextState: ?*?*ID3DDeviceContextState) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device1.VTable, self.vtable).CreateDeviceContextState(@ptrCast(*const ID3D11Device1, self), Flags, pFeatureLevels, FeatureLevels, SDKVersion, EmulatedInterface, pChosenFeatureLevel, ppContextState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device1_OpenSharedResource1(self: *const T, hResource: ?HANDLE, returnedInterface: ?*const Guid, ppResource: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device1.VTable, self.vtable).OpenSharedResource1(@ptrCast(*const ID3D11Device1, self), hResource, returnedInterface, ppResource);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device1_OpenSharedResourceByName(self: *const T, lpName: ?[*:0]const u16, dwDesiredAccess: u32, returnedInterface: ?*const Guid, ppResource: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device1.VTable, self.vtable).OpenSharedResourceByName(@ptrCast(*const ID3D11Device1, self), lpName, dwDesiredAccess, returnedInterface, ppResource);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3DUserDefinedAnnotation_Value = @import("../zig.zig").Guid.initString("b2daad8b-03d4-4dbf-95eb-32ab4b63d0ab");
pub const IID_ID3DUserDefinedAnnotation = &IID_ID3DUserDefinedAnnotation_Value;
pub const ID3DUserDefinedAnnotation = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
BeginEvent: fn(
self: *const ID3DUserDefinedAnnotation,
Name: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) i32,
EndEvent: fn(
self: *const ID3DUserDefinedAnnotation,
) callconv(@import("std").os.windows.WINAPI) i32,
SetMarker: fn(
self: *const ID3DUserDefinedAnnotation,
Name: ?[*:0]const u16,
) callconv(@import("std").os.windows.WINAPI) void,
GetStatus: fn(
self: *const ID3DUserDefinedAnnotation,
) callconv(@import("std").os.windows.WINAPI) BOOL,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DUserDefinedAnnotation_BeginEvent(self: *const T, Name: ?[*:0]const u16) callconv(.Inline) i32 {
return @ptrCast(*const ID3DUserDefinedAnnotation.VTable, self.vtable).BeginEvent(@ptrCast(*const ID3DUserDefinedAnnotation, self), Name);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DUserDefinedAnnotation_EndEvent(self: *const T) callconv(.Inline) i32 {
return @ptrCast(*const ID3DUserDefinedAnnotation.VTable, self.vtable).EndEvent(@ptrCast(*const ID3DUserDefinedAnnotation, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DUserDefinedAnnotation_SetMarker(self: *const T, Name: ?[*:0]const u16) callconv(.Inline) void {
return @ptrCast(*const ID3DUserDefinedAnnotation.VTable, self.vtable).SetMarker(@ptrCast(*const ID3DUserDefinedAnnotation, self), Name);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DUserDefinedAnnotation_GetStatus(self: *const T) callconv(.Inline) BOOL {
return @ptrCast(*const ID3DUserDefinedAnnotation.VTable, self.vtable).GetStatus(@ptrCast(*const ID3DUserDefinedAnnotation, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_TILED_RESOURCE_COORDINATE = extern struct {
X: u32,
Y: u32,
Z: u32,
Subresource: u32,
};
pub const D3D11_TILE_REGION_SIZE = extern struct {
NumTiles: u32,
bUseBox: BOOL,
Width: u32,
Height: u16,
Depth: u16,
};
pub const D3D11_TILE_MAPPING_FLAG = enum(i32) {
E = 1,
};
pub const D3D11_TILE_MAPPING_NO_OVERWRITE = D3D11_TILE_MAPPING_FLAG.E;
pub const D3D11_TILE_RANGE_FLAG = enum(i32) {
NULL = 1,
SKIP = 2,
REUSE_SINGLE_TILE = 4,
};
pub const D3D11_TILE_RANGE_NULL = D3D11_TILE_RANGE_FLAG.NULL;
pub const D3D11_TILE_RANGE_SKIP = D3D11_TILE_RANGE_FLAG.SKIP;
pub const D3D11_TILE_RANGE_REUSE_SINGLE_TILE = D3D11_TILE_RANGE_FLAG.REUSE_SINGLE_TILE;
pub const D3D11_SUBRESOURCE_TILING = extern struct {
WidthInTiles: u32,
HeightInTiles: u16,
DepthInTiles: u16,
StartTileIndexInOverallResource: u32,
};
pub const D3D11_TILE_SHAPE = extern struct {
WidthInTexels: u32,
HeightInTexels: u32,
DepthInTexels: u32,
};
pub const D3D11_PACKED_MIP_DESC = extern struct {
NumStandardMips: u8,
NumPackedMips: u8,
NumTilesForPackedMips: u32,
StartTileIndexInOverallResource: u32,
};
pub const D3D11_CHECK_MULTISAMPLE_QUALITY_LEVELS_FLAG = enum(i32) {
E = 1,
};
pub const D3D11_CHECK_MULTISAMPLE_QUALITY_LEVELS_TILED_RESOURCE = D3D11_CHECK_MULTISAMPLE_QUALITY_LEVELS_FLAG.E;
pub const D3D11_TILE_COPY_FLAG = enum(i32) {
NO_OVERWRITE = 1,
LINEAR_BUFFER_TO_SWIZZLED_TILED_RESOURCE = 2,
SWIZZLED_TILED_RESOURCE_TO_LINEAR_BUFFER = 4,
};
pub const D3D11_TILE_COPY_NO_OVERWRITE = D3D11_TILE_COPY_FLAG.NO_OVERWRITE;
pub const D3D11_TILE_COPY_LINEAR_BUFFER_TO_SWIZZLED_TILED_RESOURCE = D3D11_TILE_COPY_FLAG.LINEAR_BUFFER_TO_SWIZZLED_TILED_RESOURCE;
pub const D3D11_TILE_COPY_SWIZZLED_TILED_RESOURCE_TO_LINEAR_BUFFER = D3D11_TILE_COPY_FLAG.SWIZZLED_TILED_RESOURCE_TO_LINEAR_BUFFER;
// TODO: this type is limited to platform 'windows8.1'
const IID_ID3D11DeviceContext2_Value = @import("../zig.zig").Guid.initString("420d5b32-b90c-4da4-bef0-359f6a24a83a");
pub const IID_ID3D11DeviceContext2 = &IID_ID3D11DeviceContext2_Value;
pub const ID3D11DeviceContext2 = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceContext1.VTable,
UpdateTileMappings: fn(
self: *const ID3D11DeviceContext2,
pTiledResource: ?*ID3D11Resource,
NumTiledResourceRegions: u32,
pTiledResourceRegionStartCoordinates: ?[*]const D3D11_TILED_RESOURCE_COORDINATE,
pTiledResourceRegionSizes: ?[*]const D3D11_TILE_REGION_SIZE,
pTilePool: ?*ID3D11Buffer,
NumRanges: u32,
pRangeFlags: ?[*]const u32,
pTilePoolStartOffsets: ?[*]const u32,
pRangeTileCounts: ?[*]const u32,
Flags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CopyTileMappings: fn(
self: *const ID3D11DeviceContext2,
pDestTiledResource: ?*ID3D11Resource,
pDestRegionStartCoordinate: ?*const D3D11_TILED_RESOURCE_COORDINATE,
pSourceTiledResource: ?*ID3D11Resource,
pSourceRegionStartCoordinate: ?*const D3D11_TILED_RESOURCE_COORDINATE,
pTileRegionSize: ?*const D3D11_TILE_REGION_SIZE,
Flags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CopyTiles: fn(
self: *const ID3D11DeviceContext2,
pTiledResource: ?*ID3D11Resource,
pTileRegionStartCoordinate: ?*const D3D11_TILED_RESOURCE_COORDINATE,
pTileRegionSize: ?*const D3D11_TILE_REGION_SIZE,
pBuffer: ?*ID3D11Buffer,
BufferStartOffsetInBytes: u64,
Flags: u32,
) callconv(@import("std").os.windows.WINAPI) void,
UpdateTiles: fn(
self: *const ID3D11DeviceContext2,
pDestTiledResource: ?*ID3D11Resource,
pDestTileRegionStartCoordinate: ?*const D3D11_TILED_RESOURCE_COORDINATE,
pDestTileRegionSize: ?*const D3D11_TILE_REGION_SIZE,
pSourceTileData: ?*const anyopaque,
Flags: u32,
) callconv(@import("std").os.windows.WINAPI) void,
ResizeTilePool: fn(
self: *const ID3D11DeviceContext2,
pTilePool: ?*ID3D11Buffer,
NewSizeInBytes: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
TiledResourceBarrier: fn(
self: *const ID3D11DeviceContext2,
pTiledResourceOrViewAccessBeforeBarrier: ?*ID3D11DeviceChild,
pTiledResourceOrViewAccessAfterBarrier: ?*ID3D11DeviceChild,
) callconv(@import("std").os.windows.WINAPI) void,
IsAnnotationEnabled: fn(
self: *const ID3D11DeviceContext2,
) callconv(@import("std").os.windows.WINAPI) BOOL,
SetMarkerInt: fn(
self: *const ID3D11DeviceContext2,
pLabel: ?[*:0]const u16,
Data: i32,
) callconv(@import("std").os.windows.WINAPI) void,
BeginEventInt: fn(
self: *const ID3D11DeviceContext2,
pLabel: ?[*:0]const u16,
Data: i32,
) callconv(@import("std").os.windows.WINAPI) void,
EndEvent: fn(
self: *const ID3D11DeviceContext2,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceContext1.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext2_UpdateTileMappings(self: *const T, pTiledResource: ?*ID3D11Resource, NumTiledResourceRegions: u32, pTiledResourceRegionStartCoordinates: ?[*]const D3D11_TILED_RESOURCE_COORDINATE, pTiledResourceRegionSizes: ?[*]const D3D11_TILE_REGION_SIZE, pTilePool: ?*ID3D11Buffer, NumRanges: u32, pRangeFlags: ?[*]const u32, pTilePoolStartOffsets: ?[*]const u32, pRangeTileCounts: ?[*]const u32, Flags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11DeviceContext2.VTable, self.vtable).UpdateTileMappings(@ptrCast(*const ID3D11DeviceContext2, self), pTiledResource, NumTiledResourceRegions, pTiledResourceRegionStartCoordinates, pTiledResourceRegionSizes, pTilePool, NumRanges, pRangeFlags, pTilePoolStartOffsets, pRangeTileCounts, Flags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext2_CopyTileMappings(self: *const T, pDestTiledResource: ?*ID3D11Resource, pDestRegionStartCoordinate: ?*const D3D11_TILED_RESOURCE_COORDINATE, pSourceTiledResource: ?*ID3D11Resource, pSourceRegionStartCoordinate: ?*const D3D11_TILED_RESOURCE_COORDINATE, pTileRegionSize: ?*const D3D11_TILE_REGION_SIZE, Flags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11DeviceContext2.VTable, self.vtable).CopyTileMappings(@ptrCast(*const ID3D11DeviceContext2, self), pDestTiledResource, pDestRegionStartCoordinate, pSourceTiledResource, pSourceRegionStartCoordinate, pTileRegionSize, Flags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext2_CopyTiles(self: *const T, pTiledResource: ?*ID3D11Resource, pTileRegionStartCoordinate: ?*const D3D11_TILED_RESOURCE_COORDINATE, pTileRegionSize: ?*const D3D11_TILE_REGION_SIZE, pBuffer: ?*ID3D11Buffer, BufferStartOffsetInBytes: u64, Flags: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext2.VTable, self.vtable).CopyTiles(@ptrCast(*const ID3D11DeviceContext2, self), pTiledResource, pTileRegionStartCoordinate, pTileRegionSize, pBuffer, BufferStartOffsetInBytes, Flags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext2_UpdateTiles(self: *const T, pDestTiledResource: ?*ID3D11Resource, pDestTileRegionStartCoordinate: ?*const D3D11_TILED_RESOURCE_COORDINATE, pDestTileRegionSize: ?*const D3D11_TILE_REGION_SIZE, pSourceTileData: ?*const anyopaque, Flags: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext2.VTable, self.vtable).UpdateTiles(@ptrCast(*const ID3D11DeviceContext2, self), pDestTiledResource, pDestTileRegionStartCoordinate, pDestTileRegionSize, pSourceTileData, Flags);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext2_ResizeTilePool(self: *const T, pTilePool: ?*ID3D11Buffer, NewSizeInBytes: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11DeviceContext2.VTable, self.vtable).ResizeTilePool(@ptrCast(*const ID3D11DeviceContext2, self), pTilePool, NewSizeInBytes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext2_TiledResourceBarrier(self: *const T, pTiledResourceOrViewAccessBeforeBarrier: ?*ID3D11DeviceChild, pTiledResourceOrViewAccessAfterBarrier: ?*ID3D11DeviceChild) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext2.VTable, self.vtable).TiledResourceBarrier(@ptrCast(*const ID3D11DeviceContext2, self), pTiledResourceOrViewAccessBeforeBarrier, pTiledResourceOrViewAccessAfterBarrier);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext2_IsAnnotationEnabled(self: *const T) callconv(.Inline) BOOL {
return @ptrCast(*const ID3D11DeviceContext2.VTable, self.vtable).IsAnnotationEnabled(@ptrCast(*const ID3D11DeviceContext2, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext2_SetMarkerInt(self: *const T, pLabel: ?[*:0]const u16, Data: i32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext2.VTable, self.vtable).SetMarkerInt(@ptrCast(*const ID3D11DeviceContext2, self), pLabel, Data);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext2_BeginEventInt(self: *const T, pLabel: ?[*:0]const u16, Data: i32) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext2.VTable, self.vtable).BeginEventInt(@ptrCast(*const ID3D11DeviceContext2, self), pLabel, Data);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext2_EndEvent(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext2.VTable, self.vtable).EndEvent(@ptrCast(*const ID3D11DeviceContext2, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.1'
const IID_ID3D11Device2_Value = @import("../zig.zig").Guid.initString("9d06dffa-d1e5-4d07-83a8-1bb123f2f841");
pub const IID_ID3D11Device2 = &IID_ID3D11Device2_Value;
pub const ID3D11Device2 = extern struct {
pub const VTable = extern struct {
base: ID3D11Device1.VTable,
GetImmediateContext2: fn(
self: *const ID3D11Device2,
ppImmediateContext: ?*?*ID3D11DeviceContext2,
) callconv(@import("std").os.windows.WINAPI) void,
CreateDeferredContext2: fn(
self: *const ID3D11Device2,
ContextFlags: u32,
ppDeferredContext: ?*?*ID3D11DeviceContext2,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetResourceTiling: fn(
self: *const ID3D11Device2,
pTiledResource: ?*ID3D11Resource,
pNumTilesForEntireResource: ?*u32,
pPackedMipDesc: ?*D3D11_PACKED_MIP_DESC,
pStandardTileShapeForNonPackedMips: ?*D3D11_TILE_SHAPE,
pNumSubresourceTilings: ?*u32,
FirstSubresourceTilingToGet: u32,
pSubresourceTilingsForNonPackedMips: [*]D3D11_SUBRESOURCE_TILING,
) callconv(@import("std").os.windows.WINAPI) void,
CheckMultisampleQualityLevels1: fn(
self: *const ID3D11Device2,
Format: DXGI_FORMAT,
SampleCount: u32,
Flags: u32,
pNumQualityLevels: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Device1.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device2_GetImmediateContext2(self: *const T, ppImmediateContext: ?*?*ID3D11DeviceContext2) callconv(.Inline) void {
return @ptrCast(*const ID3D11Device2.VTable, self.vtable).GetImmediateContext2(@ptrCast(*const ID3D11Device2, self), ppImmediateContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device2_CreateDeferredContext2(self: *const T, ContextFlags: u32, ppDeferredContext: ?*?*ID3D11DeviceContext2) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device2.VTable, self.vtable).CreateDeferredContext2(@ptrCast(*const ID3D11Device2, self), ContextFlags, ppDeferredContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device2_GetResourceTiling(self: *const T, pTiledResource: ?*ID3D11Resource, pNumTilesForEntireResource: ?*u32, pPackedMipDesc: ?*D3D11_PACKED_MIP_DESC, pStandardTileShapeForNonPackedMips: ?*D3D11_TILE_SHAPE, pNumSubresourceTilings: ?*u32, FirstSubresourceTilingToGet: u32, pSubresourceTilingsForNonPackedMips: [*]D3D11_SUBRESOURCE_TILING) callconv(.Inline) void {
return @ptrCast(*const ID3D11Device2.VTable, self.vtable).GetResourceTiling(@ptrCast(*const ID3D11Device2, self), pTiledResource, pNumTilesForEntireResource, pPackedMipDesc, pStandardTileShapeForNonPackedMips, pNumSubresourceTilings, FirstSubresourceTilingToGet, pSubresourceTilingsForNonPackedMips);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device2_CheckMultisampleQualityLevels1(self: *const T, Format: DXGI_FORMAT, SampleCount: u32, Flags: u32, pNumQualityLevels: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device2.VTable, self.vtable).CheckMultisampleQualityLevels1(@ptrCast(*const ID3D11Device2, self), Format, SampleCount, Flags, pNumQualityLevels);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_CONTEXT_TYPE = enum(i32) {
ALL = 0,
@"3D" = 1,
COMPUTE = 2,
COPY = 3,
VIDEO = 4,
};
pub const D3D11_CONTEXT_TYPE_ALL = D3D11_CONTEXT_TYPE.ALL;
pub const D3D11_CONTEXT_TYPE_3D = D3D11_CONTEXT_TYPE.@"3D";
pub const D3D11_CONTEXT_TYPE_COMPUTE = D3D11_CONTEXT_TYPE.COMPUTE;
pub const D3D11_CONTEXT_TYPE_COPY = D3D11_CONTEXT_TYPE.COPY;
pub const D3D11_CONTEXT_TYPE_VIDEO = D3D11_CONTEXT_TYPE.VIDEO;
pub const D3D11_TEXTURE_LAYOUT = enum(i32) {
UNDEFINED = 0,
ROW_MAJOR = 1,
@"64K_STANDARD_SWIZZLE" = 2,
};
pub const D3D11_TEXTURE_LAYOUT_UNDEFINED = D3D11_TEXTURE_LAYOUT.UNDEFINED;
pub const D3D11_TEXTURE_LAYOUT_ROW_MAJOR = D3D11_TEXTURE_LAYOUT.ROW_MAJOR;
pub const D3D11_TEXTURE_LAYOUT_64K_STANDARD_SWIZZLE = D3D11_TEXTURE_LAYOUT.@"64K_STANDARD_SWIZZLE";
pub const D3D11_TEXTURE2D_DESC1 = extern struct {
Width: u32,
Height: u32,
MipLevels: u32,
ArraySize: u32,
Format: DXGI_FORMAT,
SampleDesc: DXGI_SAMPLE_DESC,
Usage: D3D11_USAGE,
BindFlags: u32,
CPUAccessFlags: u32,
MiscFlags: u32,
TextureLayout: D3D11_TEXTURE_LAYOUT,
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11Texture2D1_Value = @import("../zig.zig").Guid.initString("51218251-1e33-4617-9ccb-4d3a4367e7bb");
pub const IID_ID3D11Texture2D1 = &IID_ID3D11Texture2D1_Value;
pub const ID3D11Texture2D1 = extern struct {
pub const VTable = extern struct {
base: ID3D11Texture2D.VTable,
GetDesc1: fn(
self: *const ID3D11Texture2D1,
pDesc: ?*D3D11_TEXTURE2D_DESC1,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Texture2D.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Texture2D1_GetDesc1(self: *const T, pDesc: ?*D3D11_TEXTURE2D_DESC1) callconv(.Inline) void {
return @ptrCast(*const ID3D11Texture2D1.VTable, self.vtable).GetDesc1(@ptrCast(*const ID3D11Texture2D1, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_TEXTURE3D_DESC1 = extern struct {
Width: u32,
Height: u32,
Depth: u32,
MipLevels: u32,
Format: DXGI_FORMAT,
Usage: D3D11_USAGE,
BindFlags: u32,
CPUAccessFlags: u32,
MiscFlags: u32,
TextureLayout: D3D11_TEXTURE_LAYOUT,
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11Texture3D1_Value = @import("../zig.zig").Guid.initString("0c711683-2853-4846-9bb0-f3e60639e46a");
pub const IID_ID3D11Texture3D1 = &IID_ID3D11Texture3D1_Value;
pub const ID3D11Texture3D1 = extern struct {
pub const VTable = extern struct {
base: ID3D11Texture3D.VTable,
GetDesc1: fn(
self: *const ID3D11Texture3D1,
pDesc: ?*D3D11_TEXTURE3D_DESC1,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Texture3D.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Texture3D1_GetDesc1(self: *const T, pDesc: ?*D3D11_TEXTURE3D_DESC1) callconv(.Inline) void {
return @ptrCast(*const ID3D11Texture3D1.VTable, self.vtable).GetDesc1(@ptrCast(*const ID3D11Texture3D1, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_CONSERVATIVE_RASTERIZATION_MODE = enum(i32) {
FF = 0,
N = 1,
};
pub const D3D11_CONSERVATIVE_RASTERIZATION_MODE_OFF = D3D11_CONSERVATIVE_RASTERIZATION_MODE.FF;
pub const D3D11_CONSERVATIVE_RASTERIZATION_MODE_ON = D3D11_CONSERVATIVE_RASTERIZATION_MODE.N;
pub const D3D11_RASTERIZER_DESC2 = extern struct {
FillMode: D3D11_FILL_MODE,
CullMode: D3D11_CULL_MODE,
FrontCounterClockwise: BOOL,
DepthBias: i32,
DepthBiasClamp: f32,
SlopeScaledDepthBias: f32,
DepthClipEnable: BOOL,
ScissorEnable: BOOL,
MultisampleEnable: BOOL,
AntialiasedLineEnable: BOOL,
ForcedSampleCount: u32,
ConservativeRaster: D3D11_CONSERVATIVE_RASTERIZATION_MODE,
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11RasterizerState2_Value = @import("../zig.zig").Guid.initString("6fbd02fb-209f-46c4-b059-2ed15586a6ac");
pub const IID_ID3D11RasterizerState2 = &IID_ID3D11RasterizerState2_Value;
pub const ID3D11RasterizerState2 = extern struct {
pub const VTable = extern struct {
base: ID3D11RasterizerState1.VTable,
GetDesc2: fn(
self: *const ID3D11RasterizerState2,
pDesc: ?*D3D11_RASTERIZER_DESC2,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11RasterizerState1.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11RasterizerState2_GetDesc2(self: *const T, pDesc: ?*D3D11_RASTERIZER_DESC2) callconv(.Inline) void {
return @ptrCast(*const ID3D11RasterizerState2.VTable, self.vtable).GetDesc2(@ptrCast(*const ID3D11RasterizerState2, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_TEX2D_SRV1 = extern struct {
MostDetailedMip: u32,
MipLevels: u32,
PlaneSlice: u32,
};
pub const D3D11_TEX2D_ARRAY_SRV1 = extern struct {
MostDetailedMip: u32,
MipLevels: u32,
FirstArraySlice: u32,
ArraySize: u32,
PlaneSlice: u32,
};
pub const D3D11_SHADER_RESOURCE_VIEW_DESC1 = extern struct {
Format: DXGI_FORMAT,
ViewDimension: D3D_SRV_DIMENSION,
Anonymous: extern union {
Buffer: D3D11_BUFFER_SRV,
Texture1D: D3D11_TEX1D_SRV,
Texture1DArray: D3D11_TEX1D_ARRAY_SRV,
Texture2D: D3D11_TEX2D_SRV1,
Texture2DArray: D3D11_TEX2D_ARRAY_SRV1,
Texture2DMS: D3D11_TEX2DMS_SRV,
Texture2DMSArray: D3D11_TEX2DMS_ARRAY_SRV,
Texture3D: D3D11_TEX3D_SRV,
TextureCube: D3D11_TEXCUBE_SRV,
TextureCubeArray: D3D11_TEXCUBE_ARRAY_SRV,
BufferEx: D3D11_BUFFEREX_SRV,
},
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11ShaderResourceView1_Value = @import("../zig.zig").Guid.initString("91308b87-9040-411d-8c67-c39253ce3802");
pub const IID_ID3D11ShaderResourceView1 = &IID_ID3D11ShaderResourceView1_Value;
pub const ID3D11ShaderResourceView1 = extern struct {
pub const VTable = extern struct {
base: ID3D11ShaderResourceView.VTable,
GetDesc1: fn(
self: *const ID3D11ShaderResourceView1,
pDesc1: ?*D3D11_SHADER_RESOURCE_VIEW_DESC1,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11ShaderResourceView.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderResourceView1_GetDesc1(self: *const T, pDesc1: ?*D3D11_SHADER_RESOURCE_VIEW_DESC1) callconv(.Inline) void {
return @ptrCast(*const ID3D11ShaderResourceView1.VTable, self.vtable).GetDesc1(@ptrCast(*const ID3D11ShaderResourceView1, self), pDesc1);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_TEX2D_RTV1 = extern struct {
MipSlice: u32,
PlaneSlice: u32,
};
pub const D3D11_TEX2D_ARRAY_RTV1 = extern struct {
MipSlice: u32,
FirstArraySlice: u32,
ArraySize: u32,
PlaneSlice: u32,
};
pub const D3D11_RENDER_TARGET_VIEW_DESC1 = extern struct {
Format: DXGI_FORMAT,
ViewDimension: D3D11_RTV_DIMENSION,
Anonymous: extern union {
Buffer: D3D11_BUFFER_RTV,
Texture1D: D3D11_TEX1D_RTV,
Texture1DArray: D3D11_TEX1D_ARRAY_RTV,
Texture2D: D3D11_TEX2D_RTV1,
Texture2DArray: D3D11_TEX2D_ARRAY_RTV1,
Texture2DMS: D3D11_TEX2DMS_RTV,
Texture2DMSArray: D3D11_TEX2DMS_ARRAY_RTV,
Texture3D: D3D11_TEX3D_RTV,
},
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11RenderTargetView1_Value = @import("../zig.zig").Guid.initString("ffbe2e23-f011-418a-ac56-5ceed7c5b94b");
pub const IID_ID3D11RenderTargetView1 = &IID_ID3D11RenderTargetView1_Value;
pub const ID3D11RenderTargetView1 = extern struct {
pub const VTable = extern struct {
base: ID3D11RenderTargetView.VTable,
GetDesc1: fn(
self: *const ID3D11RenderTargetView1,
pDesc1: ?*D3D11_RENDER_TARGET_VIEW_DESC1,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11RenderTargetView.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11RenderTargetView1_GetDesc1(self: *const T, pDesc1: ?*D3D11_RENDER_TARGET_VIEW_DESC1) callconv(.Inline) void {
return @ptrCast(*const ID3D11RenderTargetView1.VTable, self.vtable).GetDesc1(@ptrCast(*const ID3D11RenderTargetView1, self), pDesc1);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_TEX2D_UAV1 = extern struct {
MipSlice: u32,
PlaneSlice: u32,
};
pub const D3D11_TEX2D_ARRAY_UAV1 = extern struct {
MipSlice: u32,
FirstArraySlice: u32,
ArraySize: u32,
PlaneSlice: u32,
};
pub const D3D11_UNORDERED_ACCESS_VIEW_DESC1 = extern struct {
Format: DXGI_FORMAT,
ViewDimension: D3D11_UAV_DIMENSION,
Anonymous: extern union {
Buffer: D3D11_BUFFER_UAV,
Texture1D: D3D11_TEX1D_UAV,
Texture1DArray: D3D11_TEX1D_ARRAY_UAV,
Texture2D: D3D11_TEX2D_UAV1,
Texture2DArray: D3D11_TEX2D_ARRAY_UAV1,
Texture3D: D3D11_TEX3D_UAV,
},
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11UnorderedAccessView1_Value = @import("../zig.zig").Guid.initString("7b3b6153-a886-4544-ab37-6537c8500403");
pub const IID_ID3D11UnorderedAccessView1 = &IID_ID3D11UnorderedAccessView1_Value;
pub const ID3D11UnorderedAccessView1 = extern struct {
pub const VTable = extern struct {
base: ID3D11UnorderedAccessView.VTable,
GetDesc1: fn(
self: *const ID3D11UnorderedAccessView1,
pDesc1: ?*D3D11_UNORDERED_ACCESS_VIEW_DESC1,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11UnorderedAccessView.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11UnorderedAccessView1_GetDesc1(self: *const T, pDesc1: ?*D3D11_UNORDERED_ACCESS_VIEW_DESC1) callconv(.Inline) void {
return @ptrCast(*const ID3D11UnorderedAccessView1.VTable, self.vtable).GetDesc1(@ptrCast(*const ID3D11UnorderedAccessView1, self), pDesc1);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_QUERY_DESC1 = extern struct {
Query: D3D11_QUERY,
MiscFlags: u32,
ContextType: D3D11_CONTEXT_TYPE,
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11Query1_Value = @import("../zig.zig").Guid.initString("631b4766-36dc-461d-8db6-c47e13e60916");
pub const IID_ID3D11Query1 = &IID_ID3D11Query1_Value;
pub const ID3D11Query1 = extern struct {
pub const VTable = extern struct {
base: ID3D11Query.VTable,
GetDesc1: fn(
self: *const ID3D11Query1,
pDesc1: ?*D3D11_QUERY_DESC1,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Query.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Query1_GetDesc1(self: *const T, pDesc1: ?*D3D11_QUERY_DESC1) callconv(.Inline) void {
return @ptrCast(*const ID3D11Query1.VTable, self.vtable).GetDesc1(@ptrCast(*const ID3D11Query1, self), pDesc1);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_FENCE_FLAG = enum(u32) {
NONE = 0,
SHARED = 2,
SHARED_CROSS_ADAPTER = 4,
NON_MONITORED = 8,
_,
pub fn initFlags(o: struct {
NONE: u1 = 0,
SHARED: u1 = 0,
SHARED_CROSS_ADAPTER: u1 = 0,
NON_MONITORED: u1 = 0,
}) D3D11_FENCE_FLAG {
return @intToEnum(D3D11_FENCE_FLAG,
(if (o.NONE == 1) @enumToInt(D3D11_FENCE_FLAG.NONE) else 0)
| (if (o.SHARED == 1) @enumToInt(D3D11_FENCE_FLAG.SHARED) else 0)
| (if (o.SHARED_CROSS_ADAPTER == 1) @enumToInt(D3D11_FENCE_FLAG.SHARED_CROSS_ADAPTER) else 0)
| (if (o.NON_MONITORED == 1) @enumToInt(D3D11_FENCE_FLAG.NON_MONITORED) else 0)
);
}
};
pub const D3D11_FENCE_FLAG_NONE = D3D11_FENCE_FLAG.NONE;
pub const D3D11_FENCE_FLAG_SHARED = D3D11_FENCE_FLAG.SHARED;
pub const D3D11_FENCE_FLAG_SHARED_CROSS_ADAPTER = D3D11_FENCE_FLAG.SHARED_CROSS_ADAPTER;
pub const D3D11_FENCE_FLAG_NON_MONITORED = D3D11_FENCE_FLAG.NON_MONITORED;
const IID_ID3D11DeviceContext3_Value = @import("../zig.zig").Guid.initString("b4e3c01d-e79e-4637-91b2-510e9f4c9b8f");
pub const IID_ID3D11DeviceContext3 = &IID_ID3D11DeviceContext3_Value;
pub const ID3D11DeviceContext3 = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceContext2.VTable,
Flush1: fn(
self: *const ID3D11DeviceContext3,
ContextType: D3D11_CONTEXT_TYPE,
hEvent: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) void,
SetHardwareProtectionState: fn(
self: *const ID3D11DeviceContext3,
HwProtectionEnable: BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
GetHardwareProtectionState: fn(
self: *const ID3D11DeviceContext3,
pHwProtectionEnable: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceContext2.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext3_Flush1(self: *const T, ContextType: D3D11_CONTEXT_TYPE, hEvent: ?HANDLE) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext3.VTable, self.vtable).Flush1(@ptrCast(*const ID3D11DeviceContext3, self), ContextType, hEvent);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext3_SetHardwareProtectionState(self: *const T, HwProtectionEnable: BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext3.VTable, self.vtable).SetHardwareProtectionState(@ptrCast(*const ID3D11DeviceContext3, self), HwProtectionEnable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext3_GetHardwareProtectionState(self: *const T, pHwProtectionEnable: ?*BOOL) callconv(.Inline) void {
return @ptrCast(*const ID3D11DeviceContext3.VTable, self.vtable).GetHardwareProtectionState(@ptrCast(*const ID3D11DeviceContext3, self), pHwProtectionEnable);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11Fence_Value = @import("../zig.zig").Guid.initString("affde9d1-1df7-4bb7-8a34-0f46251dab80");
pub const IID_ID3D11Fence = &IID_ID3D11Fence_Value;
pub const ID3D11Fence = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceChild.VTable,
CreateSharedHandle: fn(
self: *const ID3D11Fence,
pAttributes: ?*const SECURITY_ATTRIBUTES,
dwAccess: u32,
lpName: ?[*:0]const u16,
pHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetCompletedValue: fn(
self: *const ID3D11Fence,
) callconv(@import("std").os.windows.WINAPI) u64,
SetEventOnCompletion: fn(
self: *const ID3D11Fence,
Value: u64,
hEvent: ?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceChild.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Fence_CreateSharedHandle(self: *const T, pAttributes: ?*const SECURITY_ATTRIBUTES, dwAccess: u32, lpName: ?[*:0]const u16, pHandle: ?*?HANDLE) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Fence.VTable, self.vtable).CreateSharedHandle(@ptrCast(*const ID3D11Fence, self), pAttributes, dwAccess, lpName, pHandle);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Fence_GetCompletedValue(self: *const T) callconv(.Inline) u64 {
return @ptrCast(*const ID3D11Fence.VTable, self.vtable).GetCompletedValue(@ptrCast(*const ID3D11Fence, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Fence_SetEventOnCompletion(self: *const T, Value: u64, hEvent: ?HANDLE) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Fence.VTable, self.vtable).SetEventOnCompletion(@ptrCast(*const ID3D11Fence, self), Value, hEvent);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11DeviceContext4_Value = @import("../zig.zig").Guid.initString("917600da-f58c-4c33-98d8-3e15b390fa24");
pub const IID_ID3D11DeviceContext4 = &IID_ID3D11DeviceContext4_Value;
pub const ID3D11DeviceContext4 = extern struct {
pub const VTable = extern struct {
base: ID3D11DeviceContext3.VTable,
Signal: fn(
self: *const ID3D11DeviceContext4,
pFence: ?*ID3D11Fence,
Value: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Wait: fn(
self: *const ID3D11DeviceContext4,
pFence: ?*ID3D11Fence,
Value: u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11DeviceContext3.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext4_Signal(self: *const T, pFence: ?*ID3D11Fence, Value: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11DeviceContext4.VTable, self.vtable).Signal(@ptrCast(*const ID3D11DeviceContext4, self), pFence, Value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11DeviceContext4_Wait(self: *const T, pFence: ?*ID3D11Fence, Value: u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11DeviceContext4.VTable, self.vtable).Wait(@ptrCast(*const ID3D11DeviceContext4, self), pFence, Value);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11Device3_Value = @import("../zig.zig").Guid.initString("a05c8c37-d2c6-4732-b3a0-9ce0b0dc9ae6");
pub const IID_ID3D11Device3 = &IID_ID3D11Device3_Value;
pub const ID3D11Device3 = extern struct {
pub const VTable = extern struct {
base: ID3D11Device2.VTable,
CreateTexture2D1: fn(
self: *const ID3D11Device3,
pDesc1: ?*const D3D11_TEXTURE2D_DESC1,
pInitialData: ?*const D3D11_SUBRESOURCE_DATA,
ppTexture2D: ?*?*ID3D11Texture2D1,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTexture3D1: fn(
self: *const ID3D11Device3,
pDesc1: ?*const D3D11_TEXTURE3D_DESC1,
pInitialData: ?*const D3D11_SUBRESOURCE_DATA,
ppTexture3D: ?*?*ID3D11Texture3D1,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRasterizerState2: fn(
self: *const ID3D11Device3,
pRasterizerDesc: ?*const D3D11_RASTERIZER_DESC2,
ppRasterizerState: ?*?*ID3D11RasterizerState2,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateShaderResourceView1: fn(
self: *const ID3D11Device3,
pResource: ?*ID3D11Resource,
pDesc1: ?*const D3D11_SHADER_RESOURCE_VIEW_DESC1,
ppSRView1: ?*?*ID3D11ShaderResourceView1,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateUnorderedAccessView1: fn(
self: *const ID3D11Device3,
pResource: ?*ID3D11Resource,
pDesc1: ?*const D3D11_UNORDERED_ACCESS_VIEW_DESC1,
ppUAView1: ?*?*ID3D11UnorderedAccessView1,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRenderTargetView1: fn(
self: *const ID3D11Device3,
pResource: ?*ID3D11Resource,
pDesc1: ?*const D3D11_RENDER_TARGET_VIEW_DESC1,
ppRTView1: ?*?*ID3D11RenderTargetView1,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateQuery1: fn(
self: *const ID3D11Device3,
pQueryDesc1: ?*const D3D11_QUERY_DESC1,
ppQuery1: ?*?*ID3D11Query1,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetImmediateContext3: fn(
self: *const ID3D11Device3,
ppImmediateContext: ?*?*ID3D11DeviceContext3,
) callconv(@import("std").os.windows.WINAPI) void,
CreateDeferredContext3: fn(
self: *const ID3D11Device3,
ContextFlags: u32,
ppDeferredContext: ?*?*ID3D11DeviceContext3,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WriteToSubresource: fn(
self: *const ID3D11Device3,
pDstResource: ?*ID3D11Resource,
DstSubresource: u32,
pDstBox: ?*const D3D11_BOX,
pSrcData: ?*const anyopaque,
SrcRowPitch: u32,
SrcDepthPitch: u32,
) callconv(@import("std").os.windows.WINAPI) void,
ReadFromSubresource: fn(
self: *const ID3D11Device3,
pDstData: ?*anyopaque,
DstRowPitch: u32,
DstDepthPitch: u32,
pSrcResource: ?*ID3D11Resource,
SrcSubresource: u32,
pSrcBox: ?*const D3D11_BOX,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Device2.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device3_CreateTexture2D1(self: *const T, pDesc1: ?*const D3D11_TEXTURE2D_DESC1, pInitialData: ?*const D3D11_SUBRESOURCE_DATA, ppTexture2D: ?*?*ID3D11Texture2D1) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device3.VTable, self.vtable).CreateTexture2D1(@ptrCast(*const ID3D11Device3, self), pDesc1, pInitialData, ppTexture2D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device3_CreateTexture3D1(self: *const T, pDesc1: ?*const D3D11_TEXTURE3D_DESC1, pInitialData: ?*const D3D11_SUBRESOURCE_DATA, ppTexture3D: ?*?*ID3D11Texture3D1) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device3.VTable, self.vtable).CreateTexture3D1(@ptrCast(*const ID3D11Device3, self), pDesc1, pInitialData, ppTexture3D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device3_CreateRasterizerState2(self: *const T, pRasterizerDesc: ?*const D3D11_RASTERIZER_DESC2, ppRasterizerState: ?*?*ID3D11RasterizerState2) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device3.VTable, self.vtable).CreateRasterizerState2(@ptrCast(*const ID3D11Device3, self), pRasterizerDesc, ppRasterizerState);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device3_CreateShaderResourceView1(self: *const T, pResource: ?*ID3D11Resource, pDesc1: ?*const D3D11_SHADER_RESOURCE_VIEW_DESC1, ppSRView1: ?*?*ID3D11ShaderResourceView1) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device3.VTable, self.vtable).CreateShaderResourceView1(@ptrCast(*const ID3D11Device3, self), pResource, pDesc1, ppSRView1);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device3_CreateUnorderedAccessView1(self: *const T, pResource: ?*ID3D11Resource, pDesc1: ?*const D3D11_UNORDERED_ACCESS_VIEW_DESC1, ppUAView1: ?*?*ID3D11UnorderedAccessView1) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device3.VTable, self.vtable).CreateUnorderedAccessView1(@ptrCast(*const ID3D11Device3, self), pResource, pDesc1, ppUAView1);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device3_CreateRenderTargetView1(self: *const T, pResource: ?*ID3D11Resource, pDesc1: ?*const D3D11_RENDER_TARGET_VIEW_DESC1, ppRTView1: ?*?*ID3D11RenderTargetView1) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device3.VTable, self.vtable).CreateRenderTargetView1(@ptrCast(*const ID3D11Device3, self), pResource, pDesc1, ppRTView1);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device3_CreateQuery1(self: *const T, pQueryDesc1: ?*const D3D11_QUERY_DESC1, ppQuery1: ?*?*ID3D11Query1) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device3.VTable, self.vtable).CreateQuery1(@ptrCast(*const ID3D11Device3, self), pQueryDesc1, ppQuery1);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device3_GetImmediateContext3(self: *const T, ppImmediateContext: ?*?*ID3D11DeviceContext3) callconv(.Inline) void {
return @ptrCast(*const ID3D11Device3.VTable, self.vtable).GetImmediateContext3(@ptrCast(*const ID3D11Device3, self), ppImmediateContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device3_CreateDeferredContext3(self: *const T, ContextFlags: u32, ppDeferredContext: ?*?*ID3D11DeviceContext3) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device3.VTable, self.vtable).CreateDeferredContext3(@ptrCast(*const ID3D11Device3, self), ContextFlags, ppDeferredContext);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device3_WriteToSubresource(self: *const T, pDstResource: ?*ID3D11Resource, DstSubresource: u32, pDstBox: ?*const D3D11_BOX, pSrcData: ?*const anyopaque, SrcRowPitch: u32, SrcDepthPitch: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11Device3.VTable, self.vtable).WriteToSubresource(@ptrCast(*const ID3D11Device3, self), pDstResource, DstSubresource, pDstBox, pSrcData, SrcRowPitch, SrcDepthPitch);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device3_ReadFromSubresource(self: *const T, pDstData: ?*anyopaque, DstRowPitch: u32, DstDepthPitch: u32, pSrcResource: ?*ID3D11Resource, SrcSubresource: u32, pSrcBox: ?*const D3D11_BOX) callconv(.Inline) void {
return @ptrCast(*const ID3D11Device3.VTable, self.vtable).ReadFromSubresource(@ptrCast(*const ID3D11Device3, self), pDstData, DstRowPitch, DstDepthPitch, pSrcResource, SrcSubresource, pSrcBox);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11Device4_Value = @import("../zig.zig").Guid.initString("8992ab71-02e6-4b8d-ba48-b056dcda42c4");
pub const IID_ID3D11Device4 = &IID_ID3D11Device4_Value;
pub const ID3D11Device4 = extern struct {
pub const VTable = extern struct {
base: ID3D11Device3.VTable,
RegisterDeviceRemovedEvent: fn(
self: *const ID3D11Device4,
hEvent: ?HANDLE,
pdwCookie: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UnregisterDeviceRemoved: fn(
self: *const ID3D11Device4,
dwCookie: u32,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Device3.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device4_RegisterDeviceRemovedEvent(self: *const T, hEvent: ?HANDLE, pdwCookie: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device4.VTable, self.vtable).RegisterDeviceRemovedEvent(@ptrCast(*const ID3D11Device4, self), hEvent, pdwCookie);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device4_UnregisterDeviceRemoved(self: *const T, dwCookie: u32) callconv(.Inline) void {
return @ptrCast(*const ID3D11Device4.VTable, self.vtable).UnregisterDeviceRemoved(@ptrCast(*const ID3D11Device4, self), dwCookie);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11Device5_Value = @import("../zig.zig").Guid.initString("8ffde202-a0e7-45df-9e01-e837801b5ea0");
pub const IID_ID3D11Device5 = &IID_ID3D11Device5_Value;
pub const ID3D11Device5 = extern struct {
pub const VTable = extern struct {
base: ID3D11Device4.VTable,
OpenSharedFence: fn(
self: *const ID3D11Device5,
hFence: ?HANDLE,
ReturnedInterface: ?*const Guid,
ppFence: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateFence: fn(
self: *const ID3D11Device5,
InitialValue: u64,
Flags: D3D11_FENCE_FLAG,
ReturnedInterface: ?*const Guid,
ppFence: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11Device4.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device5_OpenSharedFence(self: *const T, hFence: ?HANDLE, ReturnedInterface: ?*const Guid, ppFence: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device5.VTable, self.vtable).OpenSharedFence(@ptrCast(*const ID3D11Device5, self), hFence, ReturnedInterface, ppFence);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Device5_CreateFence(self: *const T, InitialValue: u64, Flags: D3D11_FENCE_FLAG, ReturnedInterface: ?*const Guid, ppFence: ?*?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Device5.VTable, self.vtable).CreateFence(@ptrCast(*const ID3D11Device5, self), InitialValue, Flags, ReturnedInterface, ppFence);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11Multithread_Value = @import("../zig.zig").Guid.initString("9b7e4e00-342c-4106-a19f-4f2704f689f0");
pub const IID_ID3D11Multithread = &IID_ID3D11Multithread_Value;
pub const ID3D11Multithread = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Enter: fn(
self: *const ID3D11Multithread,
) callconv(@import("std").os.windows.WINAPI) void,
Leave: fn(
self: *const ID3D11Multithread,
) callconv(@import("std").os.windows.WINAPI) void,
SetMultithreadProtected: fn(
self: *const ID3D11Multithread,
bMTProtect: BOOL,
) callconv(@import("std").os.windows.WINAPI) BOOL,
GetMultithreadProtected: fn(
self: *const ID3D11Multithread,
) callconv(@import("std").os.windows.WINAPI) BOOL,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Multithread_Enter(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11Multithread.VTable, self.vtable).Enter(@ptrCast(*const ID3D11Multithread, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Multithread_Leave(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11Multithread.VTable, self.vtable).Leave(@ptrCast(*const ID3D11Multithread, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Multithread_SetMultithreadProtected(self: *const T, bMTProtect: BOOL) callconv(.Inline) BOOL {
return @ptrCast(*const ID3D11Multithread.VTable, self.vtable).SetMultithreadProtected(@ptrCast(*const ID3D11Multithread, self), bMTProtect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Multithread_GetMultithreadProtected(self: *const T) callconv(.Inline) BOOL {
return @ptrCast(*const ID3D11Multithread.VTable, self.vtable).GetMultithreadProtected(@ptrCast(*const ID3D11Multithread, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows10.0.10240'
const IID_ID3D11VideoContext2_Value = @import("../zig.zig").Guid.initString("c4e7374c-6243-4d1b-ae87-52b4f740e261");
pub const IID_ID3D11VideoContext2 = &IID_ID3D11VideoContext2_Value;
pub const ID3D11VideoContext2 = extern struct {
pub const VTable = extern struct {
base: ID3D11VideoContext1.VTable,
VideoProcessorSetOutputHDRMetaData: fn(
self: *const ID3D11VideoContext2,
pVideoProcessor: ?*ID3D11VideoProcessor,
Type: DXGI_HDR_METADATA_TYPE,
Size: u32,
// TODO: what to do with BytesParamIndex 2?
pHDRMetaData: ?*const anyopaque,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetOutputHDRMetaData: fn(
self: *const ID3D11VideoContext2,
pVideoProcessor: ?*ID3D11VideoProcessor,
pType: ?*DXGI_HDR_METADATA_TYPE,
Size: u32,
// TODO: what to do with BytesParamIndex 2?
pMetaData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorSetStreamHDRMetaData: fn(
self: *const ID3D11VideoContext2,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
Type: DXGI_HDR_METADATA_TYPE,
Size: u32,
// TODO: what to do with BytesParamIndex 3?
pHDRMetaData: ?*const anyopaque,
) callconv(@import("std").os.windows.WINAPI) void,
VideoProcessorGetStreamHDRMetaData: fn(
self: *const ID3D11VideoContext2,
pVideoProcessor: ?*ID3D11VideoProcessor,
StreamIndex: u32,
pType: ?*DXGI_HDR_METADATA_TYPE,
Size: u32,
// TODO: what to do with BytesParamIndex 3?
pMetaData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) void,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11VideoContext1.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext2_VideoProcessorSetOutputHDRMetaData(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, Type: DXGI_HDR_METADATA_TYPE, Size: u32, pHDRMetaData: ?*const anyopaque) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext2.VTable, self.vtable).VideoProcessorSetOutputHDRMetaData(@ptrCast(*const ID3D11VideoContext2, self), pVideoProcessor, Type, Size, pHDRMetaData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext2_VideoProcessorGetOutputHDRMetaData(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, pType: ?*DXGI_HDR_METADATA_TYPE, Size: u32, pMetaData: ?*anyopaque) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext2.VTable, self.vtable).VideoProcessorGetOutputHDRMetaData(@ptrCast(*const ID3D11VideoContext2, self), pVideoProcessor, pType, Size, pMetaData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext2_VideoProcessorSetStreamHDRMetaData(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, Type: DXGI_HDR_METADATA_TYPE, Size: u32, pHDRMetaData: ?*const anyopaque) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext2.VTable, self.vtable).VideoProcessorSetStreamHDRMetaData(@ptrCast(*const ID3D11VideoContext2, self), pVideoProcessor, StreamIndex, Type, Size, pHDRMetaData);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext2_VideoProcessorGetStreamHDRMetaData(self: *const T, pVideoProcessor: ?*ID3D11VideoProcessor, StreamIndex: u32, pType: ?*DXGI_HDR_METADATA_TYPE, Size: u32, pMetaData: ?*anyopaque) callconv(.Inline) void {
return @ptrCast(*const ID3D11VideoContext2.VTable, self.vtable).VideoProcessorGetStreamHDRMetaData(@ptrCast(*const ID3D11VideoContext2, self), pVideoProcessor, StreamIndex, pType, Size, pMetaData);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_FEATURE_VIDEO = enum(i32) {
M = 0,
};
pub const D3D11_FEATURE_VIDEO_DECODER_HISTOGRAM = D3D11_FEATURE_VIDEO.M;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT = enum(i32) {
Y = 0,
U = 1,
V = 2,
// R = 0, this enum value conflicts with Y
// G = 1, this enum value conflicts with U
// B = 2, this enum value conflicts with V
A = 3,
};
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_Y = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT.Y;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_U = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT.U;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_V = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT.V;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_R = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT.Y;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_G = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT.U;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_B = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT.V;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_A = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT.A;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS = enum(u32) {
NONE = 0,
Y = 1,
U = 2,
V = 4,
// R = 1, this enum value conflicts with Y
// G = 2, this enum value conflicts with U
// B = 4, this enum value conflicts with V
A = 8,
_,
pub fn initFlags(o: struct {
NONE: u1 = 0,
Y: u1 = 0,
U: u1 = 0,
V: u1 = 0,
A: u1 = 0,
}) D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS {
return @intToEnum(D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS,
(if (o.NONE == 1) @enumToInt(D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.NONE) else 0)
| (if (o.Y == 1) @enumToInt(D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.Y) else 0)
| (if (o.U == 1) @enumToInt(D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.U) else 0)
| (if (o.V == 1) @enumToInt(D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.V) else 0)
| (if (o.A == 1) @enumToInt(D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.A) else 0)
);
}
};
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_NONE = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.NONE;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_Y = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.Y;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_U = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.U;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_V = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.V;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_R = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.Y;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_G = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.U;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_B = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.V;
pub const D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAG_A = D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS.A;
pub const D3D11_FEATURE_DATA_VIDEO_DECODER_HISTOGRAM = extern struct {
DecoderDesc: D3D11_VIDEO_DECODER_DESC,
Components: D3D11_VIDEO_DECODER_HISTOGRAM_COMPONENT_FLAGS,
BinCount: u32,
CounterBitDepth: u32,
};
pub const D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAGS = enum(u32) {
E = 0,
_,
pub fn initFlags(o: struct {
E: u1 = 0,
}) D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAGS {
return @intToEnum(D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAGS,
(if (o.E == 1) @enumToInt(D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAGS.E) else 0)
);
}
};
pub const D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAG_NONE = D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAGS.E;
const IID_ID3D11VideoDevice2_Value = @import("../zig.zig").Guid.initString("59c0cb01-35f0-4a70-8f67-87905c906a53");
pub const IID_ID3D11VideoDevice2 = &IID_ID3D11VideoDevice2_Value;
pub const ID3D11VideoDevice2 = extern struct {
pub const VTable = extern struct {
base: ID3D11VideoDevice1.VTable,
CheckFeatureSupport: fn(
self: *const ID3D11VideoDevice2,
Feature: D3D11_FEATURE_VIDEO,
// TODO: what to do with BytesParamIndex 2?
pFeatureSupportData: ?*anyopaque,
FeatureSupportDataSize: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
NegotiateCryptoSessionKeyExchangeMT: fn(
self: *const ID3D11VideoDevice2,
pCryptoSession: ?*ID3D11CryptoSession,
flags: D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAGS,
DataSize: u32,
// TODO: what to do with BytesParamIndex 2?
pData: ?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11VideoDevice1.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice2_CheckFeatureSupport(self: *const T, Feature: D3D11_FEATURE_VIDEO, pFeatureSupportData: ?*anyopaque, FeatureSupportDataSize: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice2.VTable, self.vtable).CheckFeatureSupport(@ptrCast(*const ID3D11VideoDevice2, self), Feature, pFeatureSupportData, FeatureSupportDataSize);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoDevice2_NegotiateCryptoSessionKeyExchangeMT(self: *const T, pCryptoSession: ?*ID3D11CryptoSession, flags: D3D11_CRYPTO_SESSION_KEY_EXCHANGE_FLAGS, DataSize: u32, pData: ?*anyopaque) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoDevice2.VTable, self.vtable).NegotiateCryptoSessionKeyExchangeMT(@ptrCast(*const ID3D11VideoDevice2, self), pCryptoSession, flags, DataSize, pData);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_VIDEO_DECODER_BUFFER_DESC2 = extern struct {
BufferType: D3D11_VIDEO_DECODER_BUFFER_TYPE,
DataOffset: u32,
DataSize: u32,
pIV: ?*anyopaque,
IVSize: u32,
pSubSampleMappingBlock: ?*D3D11_VIDEO_DECODER_SUB_SAMPLE_MAPPING_BLOCK,
SubSampleMappingCount: u32,
cBlocksStripeEncrypted: u32,
cBlocksStripeClear: u32,
};
const IID_ID3D11VideoContext3_Value = @import("../zig.zig").Guid.initString("a9e2faa0-cb39-418f-a0b7-d8aad4de672e");
pub const IID_ID3D11VideoContext3 = &IID_ID3D11VideoContext3_Value;
pub const ID3D11VideoContext3 = extern struct {
pub const VTable = extern struct {
base: ID3D11VideoContext2.VTable,
DecoderBeginFrame1: fn(
self: *const ID3D11VideoContext3,
pDecoder: ?*ID3D11VideoDecoder,
pView: ?*ID3D11VideoDecoderOutputView,
ContentKeySize: u32,
// TODO: what to do with BytesParamIndex 2?
pContentKey: ?*const anyopaque,
NumComponentHistograms: u32,
pHistogramOffsets: ?[*]const u32,
ppHistogramBuffers: ?[*]?*ID3D11Buffer,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SubmitDecoderBuffers2: fn(
self: *const ID3D11VideoContext3,
pDecoder: ?*ID3D11VideoDecoder,
NumBuffers: u32,
pBufferDesc: [*]const D3D11_VIDEO_DECODER_BUFFER_DESC2,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace ID3D11VideoContext2.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext3_DecoderBeginFrame1(self: *const T, pDecoder: ?*ID3D11VideoDecoder, pView: ?*ID3D11VideoDecoderOutputView, ContentKeySize: u32, pContentKey: ?*const anyopaque, NumComponentHistograms: u32, pHistogramOffsets: ?[*]const u32, ppHistogramBuffers: ?[*]?*ID3D11Buffer) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext3.VTable, self.vtable).DecoderBeginFrame1(@ptrCast(*const ID3D11VideoContext3, self), pDecoder, pView, ContentKeySize, pContentKey, NumComponentHistograms, pHistogramOffsets, ppHistogramBuffers);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11VideoContext3_SubmitDecoderBuffers2(self: *const T, pDecoder: ?*ID3D11VideoDecoder, NumBuffers: u32, pBufferDesc: [*]const D3D11_VIDEO_DECODER_BUFFER_DESC2) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11VideoContext3.VTable, self.vtable).SubmitDecoderBuffers2(@ptrCast(*const ID3D11VideoContext3, self), pDecoder, NumBuffers, pBufferDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_FEATURE_DATA_D3D11_OPTIONS4 = extern struct {
ExtendedNV12SharedTextureSupported: BOOL,
};
pub const D3D11_SHADER_VERSION_TYPE = enum(i32) {
PIXEL_SHADER = 0,
VERTEX_SHADER = 1,
GEOMETRY_SHADER = 2,
HULL_SHADER = 3,
DOMAIN_SHADER = 4,
COMPUTE_SHADER = 5,
RESERVED0 = 65520,
};
pub const D3D11_SHVER_PIXEL_SHADER = D3D11_SHADER_VERSION_TYPE.PIXEL_SHADER;
pub const D3D11_SHVER_VERTEX_SHADER = D3D11_SHADER_VERSION_TYPE.VERTEX_SHADER;
pub const D3D11_SHVER_GEOMETRY_SHADER = D3D11_SHADER_VERSION_TYPE.GEOMETRY_SHADER;
pub const D3D11_SHVER_HULL_SHADER = D3D11_SHADER_VERSION_TYPE.HULL_SHADER;
pub const D3D11_SHVER_DOMAIN_SHADER = D3D11_SHADER_VERSION_TYPE.DOMAIN_SHADER;
pub const D3D11_SHVER_COMPUTE_SHADER = D3D11_SHADER_VERSION_TYPE.COMPUTE_SHADER;
pub const D3D11_SHVER_RESERVED0 = D3D11_SHADER_VERSION_TYPE.RESERVED0;
pub const D3D11_SIGNATURE_PARAMETER_DESC = extern struct {
SemanticName: ?[*:0]const u8,
SemanticIndex: u32,
Register: u32,
SystemValueType: D3D_NAME,
ComponentType: D3D_REGISTER_COMPONENT_TYPE,
Mask: u8,
ReadWriteMask: u8,
Stream: u32,
MinPrecision: D3D_MIN_PRECISION,
};
pub const D3D11_SHADER_BUFFER_DESC = extern struct {
Name: ?[*:0]const u8,
Type: D3D_CBUFFER_TYPE,
Variables: u32,
Size: u32,
uFlags: u32,
};
pub const D3D11_SHADER_VARIABLE_DESC = extern struct {
Name: ?[*:0]const u8,
StartOffset: u32,
Size: u32,
uFlags: u32,
DefaultValue: ?*anyopaque,
StartTexture: u32,
TextureSize: u32,
StartSampler: u32,
SamplerSize: u32,
};
pub const D3D11_SHADER_TYPE_DESC = extern struct {
Class: D3D_SHADER_VARIABLE_CLASS,
Type: D3D_SHADER_VARIABLE_TYPE,
Rows: u32,
Columns: u32,
Elements: u32,
Members: u32,
Offset: u32,
Name: ?[*:0]const u8,
};
pub const D3D11_SHADER_DESC = extern struct {
Version: u32,
Creator: ?[*:0]const u8,
Flags: u32,
ConstantBuffers: u32,
BoundResources: u32,
InputParameters: u32,
OutputParameters: u32,
InstructionCount: u32,
TempRegisterCount: u32,
TempArrayCount: u32,
DefCount: u32,
DclCount: u32,
TextureNormalInstructions: u32,
TextureLoadInstructions: u32,
TextureCompInstructions: u32,
TextureBiasInstructions: u32,
TextureGradientInstructions: u32,
FloatInstructionCount: u32,
IntInstructionCount: u32,
UintInstructionCount: u32,
StaticFlowControlCount: u32,
DynamicFlowControlCount: u32,
MacroInstructionCount: u32,
ArrayInstructionCount: u32,
CutInstructionCount: u32,
EmitInstructionCount: u32,
GSOutputTopology: D3D_PRIMITIVE_TOPOLOGY,
GSMaxOutputVertexCount: u32,
InputPrimitive: D3D_PRIMITIVE,
PatchConstantParameters: u32,
cGSInstanceCount: u32,
cControlPoints: u32,
HSOutputPrimitive: D3D_TESSELLATOR_OUTPUT_PRIMITIVE,
HSPartitioning: D3D_TESSELLATOR_PARTITIONING,
TessellatorDomain: D3D_TESSELLATOR_DOMAIN,
cBarrierInstructions: u32,
cInterlockedInstructions: u32,
cTextureStoreInstructions: u32,
};
pub const D3D11_SHADER_INPUT_BIND_DESC = extern struct {
Name: ?[*:0]const u8,
Type: D3D_SHADER_INPUT_TYPE,
BindPoint: u32,
BindCount: u32,
uFlags: u32,
ReturnType: D3D_RESOURCE_RETURN_TYPE,
Dimension: D3D_SRV_DIMENSION,
NumSamples: u32,
};
pub const D3D11_LIBRARY_DESC = extern struct {
Creator: ?[*:0]const u8,
Flags: u32,
FunctionCount: u32,
};
pub const D3D11_FUNCTION_DESC = extern struct {
Version: u32,
Creator: ?[*:0]const u8,
Flags: u32,
ConstantBuffers: u32,
BoundResources: u32,
InstructionCount: u32,
TempRegisterCount: u32,
TempArrayCount: u32,
DefCount: u32,
DclCount: u32,
TextureNormalInstructions: u32,
TextureLoadInstructions: u32,
TextureCompInstructions: u32,
TextureBiasInstructions: u32,
TextureGradientInstructions: u32,
FloatInstructionCount: u32,
IntInstructionCount: u32,
UintInstructionCount: u32,
StaticFlowControlCount: u32,
DynamicFlowControlCount: u32,
MacroInstructionCount: u32,
ArrayInstructionCount: u32,
MovInstructionCount: u32,
MovcInstructionCount: u32,
ConversionInstructionCount: u32,
BitwiseInstructionCount: u32,
MinFeatureLevel: D3D_FEATURE_LEVEL,
RequiredFeatureFlags: u64,
Name: ?[*:0]const u8,
FunctionParameterCount: i32,
HasReturn: BOOL,
Has10Level9VertexShader: BOOL,
Has10Level9PixelShader: BOOL,
};
pub const D3D11_PARAMETER_DESC = extern struct {
Name: ?[*:0]const u8,
SemanticName: ?[*:0]const u8,
Type: D3D_SHADER_VARIABLE_TYPE,
Class: D3D_SHADER_VARIABLE_CLASS,
Rows: u32,
Columns: u32,
InterpolationMode: D3D_INTERPOLATION_MODE,
Flags: D3D_PARAMETER_FLAGS,
FirstInRegister: u32,
FirstInComponent: u32,
FirstOutRegister: u32,
FirstOutComponent: u32,
};
const IID_ID3D11ShaderReflectionType_Value = @import("../zig.zig").Guid.initString("6e6ffa6a-9bae-4613-a51e-91652d508c21");
pub const IID_ID3D11ShaderReflectionType = &IID_ID3D11ShaderReflectionType_Value;
pub const ID3D11ShaderReflectionType = extern struct {
pub const VTable = extern struct {
GetDesc: fn(
self: *const ID3D11ShaderReflectionType,
pDesc: ?*D3D11_SHADER_TYPE_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMemberTypeByIndex: fn(
self: *const ID3D11ShaderReflectionType,
Index: u32,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionType,
GetMemberTypeByName: fn(
self: *const ID3D11ShaderReflectionType,
Name: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionType,
GetMemberTypeName: fn(
self: *const ID3D11ShaderReflectionType,
Index: u32,
) callconv(@import("std").os.windows.WINAPI) ?PSTR,
IsEqual: fn(
self: *const ID3D11ShaderReflectionType,
pType: ?*ID3D11ShaderReflectionType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetSubType: fn(
self: *const ID3D11ShaderReflectionType,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionType,
GetBaseClass: fn(
self: *const ID3D11ShaderReflectionType,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionType,
GetNumInterfaces: fn(
self: *const ID3D11ShaderReflectionType,
) callconv(@import("std").os.windows.WINAPI) u32,
GetInterfaceByIndex: fn(
self: *const ID3D11ShaderReflectionType,
uIndex: u32,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionType,
IsOfType: fn(
self: *const ID3D11ShaderReflectionType,
pType: ?*ID3D11ShaderReflectionType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ImplementsInterface: fn(
self: *const ID3D11ShaderReflectionType,
pBase: ?*ID3D11ShaderReflectionType,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionType_GetDesc(self: *const T, pDesc: ?*D3D11_SHADER_TYPE_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflectionType.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11ShaderReflectionType, self), pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionType_GetMemberTypeByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D11ShaderReflectionType {
return @ptrCast(*const ID3D11ShaderReflectionType.VTable, self.vtable).GetMemberTypeByIndex(@ptrCast(*const ID3D11ShaderReflectionType, self), Index);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionType_GetMemberTypeByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D11ShaderReflectionType {
return @ptrCast(*const ID3D11ShaderReflectionType.VTable, self.vtable).GetMemberTypeByName(@ptrCast(*const ID3D11ShaderReflectionType, self), Name);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionType_GetMemberTypeName(self: *const T, Index: u32) callconv(.Inline) ?PSTR {
return @ptrCast(*const ID3D11ShaderReflectionType.VTable, self.vtable).GetMemberTypeName(@ptrCast(*const ID3D11ShaderReflectionType, self), Index);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionType_IsEqual(self: *const T, pType: ?*ID3D11ShaderReflectionType) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflectionType.VTable, self.vtable).IsEqual(@ptrCast(*const ID3D11ShaderReflectionType, self), pType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionType_GetSubType(self: *const T) callconv(.Inline) ?*ID3D11ShaderReflectionType {
return @ptrCast(*const ID3D11ShaderReflectionType.VTable, self.vtable).GetSubType(@ptrCast(*const ID3D11ShaderReflectionType, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionType_GetBaseClass(self: *const T) callconv(.Inline) ?*ID3D11ShaderReflectionType {
return @ptrCast(*const ID3D11ShaderReflectionType.VTable, self.vtable).GetBaseClass(@ptrCast(*const ID3D11ShaderReflectionType, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionType_GetNumInterfaces(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11ShaderReflectionType.VTable, self.vtable).GetNumInterfaces(@ptrCast(*const ID3D11ShaderReflectionType, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionType_GetInterfaceByIndex(self: *const T, uIndex: u32) callconv(.Inline) ?*ID3D11ShaderReflectionType {
return @ptrCast(*const ID3D11ShaderReflectionType.VTable, self.vtable).GetInterfaceByIndex(@ptrCast(*const ID3D11ShaderReflectionType, self), uIndex);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionType_IsOfType(self: *const T, pType: ?*ID3D11ShaderReflectionType) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflectionType.VTable, self.vtable).IsOfType(@ptrCast(*const ID3D11ShaderReflectionType, self), pType);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionType_ImplementsInterface(self: *const T, pBase: ?*ID3D11ShaderReflectionType) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflectionType.VTable, self.vtable).ImplementsInterface(@ptrCast(*const ID3D11ShaderReflectionType, self), pBase);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11ShaderReflectionVariable_Value = @import("../zig.zig").Guid.initString("51f23923-f3e5-4bd1-91cb-606177d8db4c");
pub const IID_ID3D11ShaderReflectionVariable = &IID_ID3D11ShaderReflectionVariable_Value;
pub const ID3D11ShaderReflectionVariable = extern struct {
pub const VTable = extern struct {
GetDesc: fn(
self: *const ID3D11ShaderReflectionVariable,
pDesc: ?*D3D11_SHADER_VARIABLE_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetType: fn(
self: *const ID3D11ShaderReflectionVariable,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionType,
GetBuffer: fn(
self: *const ID3D11ShaderReflectionVariable,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionConstantBuffer,
GetInterfaceSlot: fn(
self: *const ID3D11ShaderReflectionVariable,
uArrayIndex: u32,
) callconv(@import("std").os.windows.WINAPI) u32,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionVariable_GetDesc(self: *const T, pDesc: ?*D3D11_SHADER_VARIABLE_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflectionVariable.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11ShaderReflectionVariable, self), pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionVariable_GetType(self: *const T) callconv(.Inline) ?*ID3D11ShaderReflectionType {
return @ptrCast(*const ID3D11ShaderReflectionVariable.VTable, self.vtable).GetType(@ptrCast(*const ID3D11ShaderReflectionVariable, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionVariable_GetBuffer(self: *const T) callconv(.Inline) ?*ID3D11ShaderReflectionConstantBuffer {
return @ptrCast(*const ID3D11ShaderReflectionVariable.VTable, self.vtable).GetBuffer(@ptrCast(*const ID3D11ShaderReflectionVariable, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionVariable_GetInterfaceSlot(self: *const T, uArrayIndex: u32) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11ShaderReflectionVariable.VTable, self.vtable).GetInterfaceSlot(@ptrCast(*const ID3D11ShaderReflectionVariable, self), uArrayIndex);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11ShaderReflectionConstantBuffer_Value = @import("../zig.zig").Guid.initString("eb62d63d-93dd-4318-8ae8-c6f83ad371b8");
pub const IID_ID3D11ShaderReflectionConstantBuffer = &IID_ID3D11ShaderReflectionConstantBuffer_Value;
pub const ID3D11ShaderReflectionConstantBuffer = extern struct {
pub const VTable = extern struct {
GetDesc: fn(
self: *const ID3D11ShaderReflectionConstantBuffer,
pDesc: ?*D3D11_SHADER_BUFFER_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVariableByIndex: fn(
self: *const ID3D11ShaderReflectionConstantBuffer,
Index: u32,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionVariable,
GetVariableByName: fn(
self: *const ID3D11ShaderReflectionConstantBuffer,
Name: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionVariable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionConstantBuffer_GetDesc(self: *const T, pDesc: ?*D3D11_SHADER_BUFFER_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflectionConstantBuffer.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11ShaderReflectionConstantBuffer, self), pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionConstantBuffer_GetVariableByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D11ShaderReflectionVariable {
return @ptrCast(*const ID3D11ShaderReflectionConstantBuffer.VTable, self.vtable).GetVariableByIndex(@ptrCast(*const ID3D11ShaderReflectionConstantBuffer, self), Index);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflectionConstantBuffer_GetVariableByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D11ShaderReflectionVariable {
return @ptrCast(*const ID3D11ShaderReflectionConstantBuffer.VTable, self.vtable).GetVariableByName(@ptrCast(*const ID3D11ShaderReflectionConstantBuffer, self), Name);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows6.1'
const IID_ID3D11ShaderReflection_Value = @import("../zig.zig").Guid.initString("8d536ca1-0cca-4956-a837-786963755584");
pub const IID_ID3D11ShaderReflection = &IID_ID3D11ShaderReflection_Value;
pub const ID3D11ShaderReflection = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetDesc: fn(
self: *const ID3D11ShaderReflection,
pDesc: ?*D3D11_SHADER_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetConstantBufferByIndex: fn(
self: *const ID3D11ShaderReflection,
Index: u32,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionConstantBuffer,
GetConstantBufferByName: fn(
self: *const ID3D11ShaderReflection,
Name: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionConstantBuffer,
GetResourceBindingDesc: fn(
self: *const ID3D11ShaderReflection,
ResourceIndex: u32,
pDesc: ?*D3D11_SHADER_INPUT_BIND_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetInputParameterDesc: fn(
self: *const ID3D11ShaderReflection,
ParameterIndex: u32,
pDesc: ?*D3D11_SIGNATURE_PARAMETER_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetOutputParameterDesc: fn(
self: *const ID3D11ShaderReflection,
ParameterIndex: u32,
pDesc: ?*D3D11_SIGNATURE_PARAMETER_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetPatchConstantParameterDesc: fn(
self: *const ID3D11ShaderReflection,
ParameterIndex: u32,
pDesc: ?*D3D11_SIGNATURE_PARAMETER_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVariableByName: fn(
self: *const ID3D11ShaderReflection,
Name: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionVariable,
GetResourceBindingDescByName: fn(
self: *const ID3D11ShaderReflection,
Name: ?[*:0]const u8,
pDesc: ?*D3D11_SHADER_INPUT_BIND_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetMovInstructionCount: fn(
self: *const ID3D11ShaderReflection,
) callconv(@import("std").os.windows.WINAPI) u32,
GetMovcInstructionCount: fn(
self: *const ID3D11ShaderReflection,
) callconv(@import("std").os.windows.WINAPI) u32,
GetConversionInstructionCount: fn(
self: *const ID3D11ShaderReflection,
) callconv(@import("std").os.windows.WINAPI) u32,
GetBitwiseInstructionCount: fn(
self: *const ID3D11ShaderReflection,
) callconv(@import("std").os.windows.WINAPI) u32,
GetGSInputPrimitive: fn(
self: *const ID3D11ShaderReflection,
) callconv(@import("std").os.windows.WINAPI) D3D_PRIMITIVE,
IsSampleFrequencyShader: fn(
self: *const ID3D11ShaderReflection,
) callconv(@import("std").os.windows.WINAPI) BOOL,
GetNumInterfaceSlots: fn(
self: *const ID3D11ShaderReflection,
) callconv(@import("std").os.windows.WINAPI) u32,
GetMinFeatureLevel: fn(
self: *const ID3D11ShaderReflection,
pLevel: ?*D3D_FEATURE_LEVEL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetThreadGroupSize: fn(
self: *const ID3D11ShaderReflection,
pSizeX: ?*u32,
pSizeY: ?*u32,
pSizeZ: ?*u32,
) callconv(@import("std").os.windows.WINAPI) u32,
GetRequiresFlags: fn(
self: *const ID3D11ShaderReflection,
) callconv(@import("std").os.windows.WINAPI) u64,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetDesc(self: *const T, pDesc: ?*D3D11_SHADER_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11ShaderReflection, self), pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetConstantBufferByIndex(self: *const T, Index: u32) callconv(.Inline) ?*ID3D11ShaderReflectionConstantBuffer {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetConstantBufferByIndex(@ptrCast(*const ID3D11ShaderReflection, self), Index);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetConstantBufferByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D11ShaderReflectionConstantBuffer {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetConstantBufferByName(@ptrCast(*const ID3D11ShaderReflection, self), Name);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetResourceBindingDesc(self: *const T, ResourceIndex: u32, pDesc: ?*D3D11_SHADER_INPUT_BIND_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetResourceBindingDesc(@ptrCast(*const ID3D11ShaderReflection, self), ResourceIndex, pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetInputParameterDesc(self: *const T, ParameterIndex: u32, pDesc: ?*D3D11_SIGNATURE_PARAMETER_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetInputParameterDesc(@ptrCast(*const ID3D11ShaderReflection, self), ParameterIndex, pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetOutputParameterDesc(self: *const T, ParameterIndex: u32, pDesc: ?*D3D11_SIGNATURE_PARAMETER_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetOutputParameterDesc(@ptrCast(*const ID3D11ShaderReflection, self), ParameterIndex, pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetPatchConstantParameterDesc(self: *const T, ParameterIndex: u32, pDesc: ?*D3D11_SIGNATURE_PARAMETER_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetPatchConstantParameterDesc(@ptrCast(*const ID3D11ShaderReflection, self), ParameterIndex, pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetVariableByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D11ShaderReflectionVariable {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetVariableByName(@ptrCast(*const ID3D11ShaderReflection, self), Name);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetResourceBindingDescByName(self: *const T, Name: ?[*:0]const u8, pDesc: ?*D3D11_SHADER_INPUT_BIND_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetResourceBindingDescByName(@ptrCast(*const ID3D11ShaderReflection, self), Name, pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetMovInstructionCount(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetMovInstructionCount(@ptrCast(*const ID3D11ShaderReflection, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetMovcInstructionCount(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetMovcInstructionCount(@ptrCast(*const ID3D11ShaderReflection, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetConversionInstructionCount(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetConversionInstructionCount(@ptrCast(*const ID3D11ShaderReflection, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetBitwiseInstructionCount(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetBitwiseInstructionCount(@ptrCast(*const ID3D11ShaderReflection, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetGSInputPrimitive(self: *const T) callconv(.Inline) D3D_PRIMITIVE {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetGSInputPrimitive(@ptrCast(*const ID3D11ShaderReflection, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_IsSampleFrequencyShader(self: *const T) callconv(.Inline) BOOL {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).IsSampleFrequencyShader(@ptrCast(*const ID3D11ShaderReflection, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetNumInterfaceSlots(self: *const T) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetNumInterfaceSlots(@ptrCast(*const ID3D11ShaderReflection, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetMinFeatureLevel(self: *const T, pLevel: ?*D3D_FEATURE_LEVEL) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetMinFeatureLevel(@ptrCast(*const ID3D11ShaderReflection, self), pLevel);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetThreadGroupSize(self: *const T, pSizeX: ?*u32, pSizeY: ?*u32, pSizeZ: ?*u32) callconv(.Inline) u32 {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetThreadGroupSize(@ptrCast(*const ID3D11ShaderReflection, self), pSizeX, pSizeY, pSizeZ);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderReflection_GetRequiresFlags(self: *const T) callconv(.Inline) u64 {
return @ptrCast(*const ID3D11ShaderReflection.VTable, self.vtable).GetRequiresFlags(@ptrCast(*const ID3D11ShaderReflection, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11LibraryReflection_Value = @import("../zig.zig").Guid.initString("54384f1b-5b3e-4bb7-ae01-60ba3097cbb6");
pub const IID_ID3D11LibraryReflection = &IID_ID3D11LibraryReflection_Value;
pub const ID3D11LibraryReflection = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
GetDesc: fn(
self: *const ID3D11LibraryReflection,
pDesc: ?*D3D11_LIBRARY_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFunctionByIndex: fn(
self: *const ID3D11LibraryReflection,
FunctionIndex: i32,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11FunctionReflection,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11LibraryReflection_GetDesc(self: *const T, pDesc: ?*D3D11_LIBRARY_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11LibraryReflection.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11LibraryReflection, self), pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11LibraryReflection_GetFunctionByIndex(self: *const T, FunctionIndex: i32) callconv(.Inline) ?*ID3D11FunctionReflection {
return @ptrCast(*const ID3D11LibraryReflection.VTable, self.vtable).GetFunctionByIndex(@ptrCast(*const ID3D11LibraryReflection, self), FunctionIndex);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11FunctionReflection_Value = @import("../zig.zig").Guid.initString("207bcecb-d683-4a06-a8a3-9b149b9f73a4");
pub const IID_ID3D11FunctionReflection = &IID_ID3D11FunctionReflection_Value;
pub const ID3D11FunctionReflection = extern struct {
pub const VTable = extern struct {
GetDesc: fn(
self: *const ID3D11FunctionReflection,
pDesc: ?*D3D11_FUNCTION_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetConstantBufferByIndex: fn(
self: *const ID3D11FunctionReflection,
BufferIndex: u32,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionConstantBuffer,
GetConstantBufferByName: fn(
self: *const ID3D11FunctionReflection,
Name: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionConstantBuffer,
GetResourceBindingDesc: fn(
self: *const ID3D11FunctionReflection,
ResourceIndex: u32,
pDesc: ?*D3D11_SHADER_INPUT_BIND_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetVariableByName: fn(
self: *const ID3D11FunctionReflection,
Name: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11ShaderReflectionVariable,
GetResourceBindingDescByName: fn(
self: *const ID3D11FunctionReflection,
Name: ?[*:0]const u8,
pDesc: ?*D3D11_SHADER_INPUT_BIND_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFunctionParameter: fn(
self: *const ID3D11FunctionReflection,
ParameterIndex: i32,
) callconv(@import("std").os.windows.WINAPI) ?*ID3D11FunctionParameterReflection,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionReflection_GetDesc(self: *const T, pDesc: ?*D3D11_FUNCTION_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionReflection.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11FunctionReflection, self), pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionReflection_GetConstantBufferByIndex(self: *const T, BufferIndex: u32) callconv(.Inline) ?*ID3D11ShaderReflectionConstantBuffer {
return @ptrCast(*const ID3D11FunctionReflection.VTable, self.vtable).GetConstantBufferByIndex(@ptrCast(*const ID3D11FunctionReflection, self), BufferIndex);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionReflection_GetConstantBufferByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D11ShaderReflectionConstantBuffer {
return @ptrCast(*const ID3D11FunctionReflection.VTable, self.vtable).GetConstantBufferByName(@ptrCast(*const ID3D11FunctionReflection, self), Name);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionReflection_GetResourceBindingDesc(self: *const T, ResourceIndex: u32, pDesc: ?*D3D11_SHADER_INPUT_BIND_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionReflection.VTable, self.vtable).GetResourceBindingDesc(@ptrCast(*const ID3D11FunctionReflection, self), ResourceIndex, pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionReflection_GetVariableByName(self: *const T, Name: ?[*:0]const u8) callconv(.Inline) ?*ID3D11ShaderReflectionVariable {
return @ptrCast(*const ID3D11FunctionReflection.VTable, self.vtable).GetVariableByName(@ptrCast(*const ID3D11FunctionReflection, self), Name);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionReflection_GetResourceBindingDescByName(self: *const T, Name: ?[*:0]const u8, pDesc: ?*D3D11_SHADER_INPUT_BIND_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionReflection.VTable, self.vtable).GetResourceBindingDescByName(@ptrCast(*const ID3D11FunctionReflection, self), Name, pDesc);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionReflection_GetFunctionParameter(self: *const T, ParameterIndex: i32) callconv(.Inline) ?*ID3D11FunctionParameterReflection {
return @ptrCast(*const ID3D11FunctionReflection.VTable, self.vtable).GetFunctionParameter(@ptrCast(*const ID3D11FunctionReflection, self), ParameterIndex);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11FunctionParameterReflection_Value = @import("../zig.zig").Guid.initString("42757488-334f-47fe-982e-1a65d08cc462");
pub const IID_ID3D11FunctionParameterReflection = &IID_ID3D11FunctionParameterReflection_Value;
pub const ID3D11FunctionParameterReflection = extern struct {
pub const VTable = extern struct {
GetDesc: fn(
self: *const ID3D11FunctionParameterReflection,
pDesc: ?*D3D11_PARAMETER_DESC,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionParameterReflection_GetDesc(self: *const T, pDesc: ?*D3D11_PARAMETER_DESC) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionParameterReflection.VTable, self.vtable).GetDesc(@ptrCast(*const ID3D11FunctionParameterReflection, self), pDesc);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11ModuleInstance_Value = @import("../zig.zig").Guid.initString("469e07f7-045a-48d5-aa12-68a478cdf75d");
pub const IID_ID3D11ModuleInstance = &IID_ID3D11ModuleInstance_Value;
pub const ID3D11ModuleInstance = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
BindConstantBuffer: fn(
self: *const ID3D11ModuleInstance,
uSrcSlot: u32,
uDstSlot: u32,
cbDstOffset: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindConstantBufferByName: fn(
self: *const ID3D11ModuleInstance,
pName: ?[*:0]const u8,
uDstSlot: u32,
cbDstOffset: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindResource: fn(
self: *const ID3D11ModuleInstance,
uSrcSlot: u32,
uDstSlot: u32,
uCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindResourceByName: fn(
self: *const ID3D11ModuleInstance,
pName: ?[*:0]const u8,
uDstSlot: u32,
uCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindSampler: fn(
self: *const ID3D11ModuleInstance,
uSrcSlot: u32,
uDstSlot: u32,
uCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindSamplerByName: fn(
self: *const ID3D11ModuleInstance,
pName: ?[*:0]const u8,
uDstSlot: u32,
uCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindUnorderedAccessView: fn(
self: *const ID3D11ModuleInstance,
uSrcSlot: u32,
uDstSlot: u32,
uCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindUnorderedAccessViewByName: fn(
self: *const ID3D11ModuleInstance,
pName: ?[*:0]const u8,
uDstSlot: u32,
uCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindResourceAsUnorderedAccessView: fn(
self: *const ID3D11ModuleInstance,
uSrcSrvSlot: u32,
uDstUavSlot: u32,
uCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
BindResourceAsUnorderedAccessViewByName: fn(
self: *const ID3D11ModuleInstance,
pSrvName: ?[*:0]const u8,
uDstUavSlot: u32,
uCount: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ModuleInstance_BindConstantBuffer(self: *const T, uSrcSlot: u32, uDstSlot: u32, cbDstOffset: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ModuleInstance.VTable, self.vtable).BindConstantBuffer(@ptrCast(*const ID3D11ModuleInstance, self), uSrcSlot, uDstSlot, cbDstOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ModuleInstance_BindConstantBufferByName(self: *const T, pName: ?[*:0]const u8, uDstSlot: u32, cbDstOffset: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ModuleInstance.VTable, self.vtable).BindConstantBufferByName(@ptrCast(*const ID3D11ModuleInstance, self), pName, uDstSlot, cbDstOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ModuleInstance_BindResource(self: *const T, uSrcSlot: u32, uDstSlot: u32, uCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ModuleInstance.VTable, self.vtable).BindResource(@ptrCast(*const ID3D11ModuleInstance, self), uSrcSlot, uDstSlot, uCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ModuleInstance_BindResourceByName(self: *const T, pName: ?[*:0]const u8, uDstSlot: u32, uCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ModuleInstance.VTable, self.vtable).BindResourceByName(@ptrCast(*const ID3D11ModuleInstance, self), pName, uDstSlot, uCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ModuleInstance_BindSampler(self: *const T, uSrcSlot: u32, uDstSlot: u32, uCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ModuleInstance.VTable, self.vtable).BindSampler(@ptrCast(*const ID3D11ModuleInstance, self), uSrcSlot, uDstSlot, uCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ModuleInstance_BindSamplerByName(self: *const T, pName: ?[*:0]const u8, uDstSlot: u32, uCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ModuleInstance.VTable, self.vtable).BindSamplerByName(@ptrCast(*const ID3D11ModuleInstance, self), pName, uDstSlot, uCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ModuleInstance_BindUnorderedAccessView(self: *const T, uSrcSlot: u32, uDstSlot: u32, uCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ModuleInstance.VTable, self.vtable).BindUnorderedAccessView(@ptrCast(*const ID3D11ModuleInstance, self), uSrcSlot, uDstSlot, uCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ModuleInstance_BindUnorderedAccessViewByName(self: *const T, pName: ?[*:0]const u8, uDstSlot: u32, uCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ModuleInstance.VTable, self.vtable).BindUnorderedAccessViewByName(@ptrCast(*const ID3D11ModuleInstance, self), pName, uDstSlot, uCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ModuleInstance_BindResourceAsUnorderedAccessView(self: *const T, uSrcSrvSlot: u32, uDstUavSlot: u32, uCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ModuleInstance.VTable, self.vtable).BindResourceAsUnorderedAccessView(@ptrCast(*const ID3D11ModuleInstance, self), uSrcSrvSlot, uDstUavSlot, uCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ModuleInstance_BindResourceAsUnorderedAccessViewByName(self: *const T, pSrvName: ?[*:0]const u8, uDstUavSlot: u32, uCount: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ModuleInstance.VTable, self.vtable).BindResourceAsUnorderedAccessViewByName(@ptrCast(*const ID3D11ModuleInstance, self), pSrvName, uDstUavSlot, uCount);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11Module_Value = @import("../zig.zig").Guid.initString("cac701ee-80fc-4122-8242-10b39c8cec34");
pub const IID_ID3D11Module = &IID_ID3D11Module_Value;
pub const ID3D11Module = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateInstance: fn(
self: *const ID3D11Module,
pNamespace: ?[*:0]const u8,
ppModuleInstance: ?*?*ID3D11ModuleInstance,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Module_CreateInstance(self: *const T, pNamespace: ?[*:0]const u8, ppModuleInstance: ?*?*ID3D11ModuleInstance) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Module.VTable, self.vtable).CreateInstance(@ptrCast(*const ID3D11Module, self), pNamespace, ppModuleInstance);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11Linker_Value = @import("../zig.zig").Guid.initString("59a6cd0e-e10d-4c1f-88c0-63aba1daf30e");
pub const IID_ID3D11Linker = &IID_ID3D11Linker_Value;
pub const ID3D11Linker = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Link: fn(
self: *const ID3D11Linker,
pEntry: ?*ID3D11ModuleInstance,
pEntryName: ?[*:0]const u8,
pTargetName: ?[*:0]const u8,
uFlags: u32,
ppShaderBlob: ?*?*ID3DBlob,
ppErrorBuffer: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
UseLibrary: fn(
self: *const ID3D11Linker,
pLibraryMI: ?*ID3D11ModuleInstance,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddClipPlaneFromCBuffer: fn(
self: *const ID3D11Linker,
uCBufferSlot: u32,
uCBufferEntry: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Linker_Link(self: *const T, pEntry: ?*ID3D11ModuleInstance, pEntryName: ?[*:0]const u8, pTargetName: ?[*:0]const u8, uFlags: u32, ppShaderBlob: ?*?*ID3DBlob, ppErrorBuffer: ?*?*ID3DBlob) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Linker.VTable, self.vtable).Link(@ptrCast(*const ID3D11Linker, self), pEntry, pEntryName, pTargetName, uFlags, ppShaderBlob, ppErrorBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Linker_UseLibrary(self: *const T, pLibraryMI: ?*ID3D11ModuleInstance) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Linker.VTable, self.vtable).UseLibrary(@ptrCast(*const ID3D11Linker, self), pLibraryMI);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11Linker_AddClipPlaneFromCBuffer(self: *const T, uCBufferSlot: u32, uCBufferEntry: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11Linker.VTable, self.vtable).AddClipPlaneFromCBuffer(@ptrCast(*const ID3D11Linker, self), uCBufferSlot, uCBufferEntry);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11LinkingNode_Value = @import("../zig.zig").Guid.initString("d80dd70c-8d2f-4751-94a1-03c79b3556db");
pub const IID_ID3D11LinkingNode = &IID_ID3D11LinkingNode_Value;
pub const ID3D11LinkingNode = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3D11FunctionLinkingGraph_Value = @import("../zig.zig").Guid.initString("54133220-1ce8-43d3-8236-9855c5ceecff");
pub const IID_ID3D11FunctionLinkingGraph = &IID_ID3D11FunctionLinkingGraph_Value;
pub const ID3D11FunctionLinkingGraph = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateModuleInstance: fn(
self: *const ID3D11FunctionLinkingGraph,
ppModuleInstance: ?*?*ID3D11ModuleInstance,
ppErrorBuffer: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetInputSignature: fn(
self: *const ID3D11FunctionLinkingGraph,
pInputParameters: [*]const D3D11_PARAMETER_DESC,
cInputParameters: u32,
ppInputNode: ?*?*ID3D11LinkingNode,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOutputSignature: fn(
self: *const ID3D11FunctionLinkingGraph,
pOutputParameters: [*]const D3D11_PARAMETER_DESC,
cOutputParameters: u32,
ppOutputNode: ?*?*ID3D11LinkingNode,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CallFunction: fn(
self: *const ID3D11FunctionLinkingGraph,
pModuleInstanceNamespace: ?[*:0]const u8,
pModuleWithFunctionPrototype: ?*ID3D11Module,
pFunctionName: ?[*:0]const u8,
ppCallNode: ?*?*ID3D11LinkingNode,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PassValue: fn(
self: *const ID3D11FunctionLinkingGraph,
pSrcNode: ?*ID3D11LinkingNode,
SrcParameterIndex: i32,
pDstNode: ?*ID3D11LinkingNode,
DstParameterIndex: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PassValueWithSwizzle: fn(
self: *const ID3D11FunctionLinkingGraph,
pSrcNode: ?*ID3D11LinkingNode,
SrcParameterIndex: i32,
pSrcSwizzle: ?[*:0]const u8,
pDstNode: ?*ID3D11LinkingNode,
DstParameterIndex: i32,
pDstSwizzle: ?[*:0]const u8,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetLastError: fn(
self: *const ID3D11FunctionLinkingGraph,
ppErrorBuffer: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GenerateHlsl: fn(
self: *const ID3D11FunctionLinkingGraph,
uFlags: u32,
ppBuffer: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionLinkingGraph_CreateModuleInstance(self: *const T, ppModuleInstance: ?*?*ID3D11ModuleInstance, ppErrorBuffer: ?*?*ID3DBlob) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionLinkingGraph.VTable, self.vtable).CreateModuleInstance(@ptrCast(*const ID3D11FunctionLinkingGraph, self), ppModuleInstance, ppErrorBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionLinkingGraph_SetInputSignature(self: *const T, pInputParameters: [*]const D3D11_PARAMETER_DESC, cInputParameters: u32, ppInputNode: ?*?*ID3D11LinkingNode) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionLinkingGraph.VTable, self.vtable).SetInputSignature(@ptrCast(*const ID3D11FunctionLinkingGraph, self), pInputParameters, cInputParameters, ppInputNode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionLinkingGraph_SetOutputSignature(self: *const T, pOutputParameters: [*]const D3D11_PARAMETER_DESC, cOutputParameters: u32, ppOutputNode: ?*?*ID3D11LinkingNode) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionLinkingGraph.VTable, self.vtable).SetOutputSignature(@ptrCast(*const ID3D11FunctionLinkingGraph, self), pOutputParameters, cOutputParameters, ppOutputNode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionLinkingGraph_CallFunction(self: *const T, pModuleInstanceNamespace: ?[*:0]const u8, pModuleWithFunctionPrototype: ?*ID3D11Module, pFunctionName: ?[*:0]const u8, ppCallNode: ?*?*ID3D11LinkingNode) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionLinkingGraph.VTable, self.vtable).CallFunction(@ptrCast(*const ID3D11FunctionLinkingGraph, self), pModuleInstanceNamespace, pModuleWithFunctionPrototype, pFunctionName, ppCallNode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionLinkingGraph_PassValue(self: *const T, pSrcNode: ?*ID3D11LinkingNode, SrcParameterIndex: i32, pDstNode: ?*ID3D11LinkingNode, DstParameterIndex: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionLinkingGraph.VTable, self.vtable).PassValue(@ptrCast(*const ID3D11FunctionLinkingGraph, self), pSrcNode, SrcParameterIndex, pDstNode, DstParameterIndex);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionLinkingGraph_PassValueWithSwizzle(self: *const T, pSrcNode: ?*ID3D11LinkingNode, SrcParameterIndex: i32, pSrcSwizzle: ?[*:0]const u8, pDstNode: ?*ID3D11LinkingNode, DstParameterIndex: i32, pDstSwizzle: ?[*:0]const u8) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionLinkingGraph.VTable, self.vtable).PassValueWithSwizzle(@ptrCast(*const ID3D11FunctionLinkingGraph, self), pSrcNode, SrcParameterIndex, pSrcSwizzle, pDstNode, DstParameterIndex, pDstSwizzle);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionLinkingGraph_GetLastError(self: *const T, ppErrorBuffer: ?*?*ID3DBlob) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionLinkingGraph.VTable, self.vtable).GetLastError(@ptrCast(*const ID3D11FunctionLinkingGraph, self), ppErrorBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11FunctionLinkingGraph_GenerateHlsl(self: *const T, uFlags: u32, ppBuffer: ?*?*ID3DBlob) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11FunctionLinkingGraph.VTable, self.vtable).GenerateHlsl(@ptrCast(*const ID3D11FunctionLinkingGraph, self), uFlags, ppBuffer);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3D11_SHADER_TYPE = enum(i32) {
VERTEX_SHADER = 1,
HULL_SHADER = 2,
DOMAIN_SHADER = 3,
GEOMETRY_SHADER = 4,
PIXEL_SHADER = 5,
COMPUTE_SHADER = 6,
};
pub const D3D11_VERTEX_SHADER = D3D11_SHADER_TYPE.VERTEX_SHADER;
pub const D3D11_HULL_SHADER = D3D11_SHADER_TYPE.HULL_SHADER;
pub const D3D11_DOMAIN_SHADER = D3D11_SHADER_TYPE.DOMAIN_SHADER;
pub const D3D11_GEOMETRY_SHADER = D3D11_SHADER_TYPE.GEOMETRY_SHADER;
pub const D3D11_PIXEL_SHADER = D3D11_SHADER_TYPE.PIXEL_SHADER;
pub const D3D11_COMPUTE_SHADER = D3D11_SHADER_TYPE.COMPUTE_SHADER;
pub const D3D11_VERTEX_SHADER_TRACE_DESC = extern struct {
Invocation: u64,
};
pub const D3D11_HULL_SHADER_TRACE_DESC = extern struct {
Invocation: u64,
};
pub const D3D11_DOMAIN_SHADER_TRACE_DESC = extern struct {
Invocation: u64,
};
pub const D3D11_GEOMETRY_SHADER_TRACE_DESC = extern struct {
Invocation: u64,
};
pub const D3D11_PIXEL_SHADER_TRACE_DESC = extern struct {
Invocation: u64,
X: i32,
Y: i32,
SampleMask: u64,
};
pub const D3D11_COMPUTE_SHADER_TRACE_DESC = extern struct {
Invocation: u64,
ThreadIDInGroup: [3]u32,
ThreadGroupID: [3]u32,
};
pub const D3D11_SHADER_TRACE_DESC = extern struct {
Type: D3D11_SHADER_TYPE,
Flags: u32,
Anonymous: extern union {
VertexShaderTraceDesc: D3D11_VERTEX_SHADER_TRACE_DESC,
HullShaderTraceDesc: D3D11_HULL_SHADER_TRACE_DESC,
DomainShaderTraceDesc: D3D11_DOMAIN_SHADER_TRACE_DESC,
GeometryShaderTraceDesc: D3D11_GEOMETRY_SHADER_TRACE_DESC,
PixelShaderTraceDesc: D3D11_PIXEL_SHADER_TRACE_DESC,
ComputeShaderTraceDesc: D3D11_COMPUTE_SHADER_TRACE_DESC,
},
};
pub const D3D11_TRACE_GS_INPUT_PRIMITIVE = enum(i32) {
UNDEFINED = 0,
POINT = 1,
LINE = 2,
TRIANGLE = 3,
LINE_ADJ = 6,
TRIANGLE_ADJ = 7,
};
pub const D3D11_TRACE_GS_INPUT_PRIMITIVE_UNDEFINED = D3D11_TRACE_GS_INPUT_PRIMITIVE.UNDEFINED;
pub const D3D11_TRACE_GS_INPUT_PRIMITIVE_POINT = D3D11_TRACE_GS_INPUT_PRIMITIVE.POINT;
pub const D3D11_TRACE_GS_INPUT_PRIMITIVE_LINE = D3D11_TRACE_GS_INPUT_PRIMITIVE.LINE;
pub const D3D11_TRACE_GS_INPUT_PRIMITIVE_TRIANGLE = D3D11_TRACE_GS_INPUT_PRIMITIVE.TRIANGLE;
pub const D3D11_TRACE_GS_INPUT_PRIMITIVE_LINE_ADJ = D3D11_TRACE_GS_INPUT_PRIMITIVE.LINE_ADJ;
pub const D3D11_TRACE_GS_INPUT_PRIMITIVE_TRIANGLE_ADJ = D3D11_TRACE_GS_INPUT_PRIMITIVE.TRIANGLE_ADJ;
pub const D3D11_TRACE_STATS = extern struct {
TraceDesc: D3D11_SHADER_TRACE_DESC,
NumInvocationsInStamp: u8,
TargetStampIndex: u8,
NumTraceSteps: u32,
InputMask: [32]u8,
OutputMask: [32]u8,
NumTemps: u16,
MaxIndexableTempIndex: u16,
IndexableTempSize: [4096]u16,
ImmediateConstantBufferSize: u16,
PixelPosition: [8]u32,
PixelCoverageMask: [4]u64,
PixelDiscardedMask: [4]u64,
PixelCoverageMaskAfterShader: [4]u64,
PixelCoverageMaskAfterA2CSampleMask: [4]u64,
PixelCoverageMaskAfterA2CSampleMaskDepth: [4]u64,
PixelCoverageMaskAfterA2CSampleMaskDepthStencil: [4]u64,
PSOutputsDepth: BOOL,
PSOutputsMask: BOOL,
GSInputPrimitive: D3D11_TRACE_GS_INPUT_PRIMITIVE,
GSInputsPrimitiveID: BOOL,
HSOutputPatchConstantMask: [32]u8,
DSInputPatchConstantMask: [32]u8,
};
pub const D3D11_TRACE_VALUE = extern struct {
Bits: [4]u32,
ValidMask: u8,
};
pub const D3D11_TRACE_REGISTER_TYPE = enum(i32) {
OUTPUT_NULL_REGISTER = 0,
INPUT_REGISTER = 1,
INPUT_PRIMITIVE_ID_REGISTER = 2,
IMMEDIATE_CONSTANT_BUFFER = 3,
TEMP_REGISTER = 4,
INDEXABLE_TEMP_REGISTER = 5,
OUTPUT_REGISTER = 6,
OUTPUT_DEPTH_REGISTER = 7,
CONSTANT_BUFFER = 8,
IMMEDIATE32 = 9,
SAMPLER = 10,
RESOURCE = 11,
RASTERIZER = 12,
OUTPUT_COVERAGE_MASK = 13,
STREAM = 14,
THIS_POINTER = 15,
OUTPUT_CONTROL_POINT_ID_REGISTER = 16,
INPUT_FORK_INSTANCE_ID_REGISTER = 17,
INPUT_JOIN_INSTANCE_ID_REGISTER = 18,
INPUT_CONTROL_POINT_REGISTER = 19,
OUTPUT_CONTROL_POINT_REGISTER = 20,
INPUT_PATCH_CONSTANT_REGISTER = 21,
INPUT_DOMAIN_POINT_REGISTER = 22,
UNORDERED_ACCESS_VIEW = 23,
THREAD_GROUP_SHARED_MEMORY = 24,
INPUT_THREAD_ID_REGISTER = 25,
INPUT_THREAD_GROUP_ID_REGISTER = 26,
INPUT_THREAD_ID_IN_GROUP_REGISTER = 27,
INPUT_COVERAGE_MASK_REGISTER = 28,
INPUT_THREAD_ID_IN_GROUP_FLATTENED_REGISTER = 29,
INPUT_GS_INSTANCE_ID_REGISTER = 30,
OUTPUT_DEPTH_GREATER_EQUAL_REGISTER = 31,
OUTPUT_DEPTH_LESS_EQUAL_REGISTER = 32,
IMMEDIATE64 = 33,
INPUT_CYCLE_COUNTER_REGISTER = 34,
INTERFACE_POINTER = 35,
};
pub const D3D11_TRACE_OUTPUT_NULL_REGISTER = D3D11_TRACE_REGISTER_TYPE.OUTPUT_NULL_REGISTER;
pub const D3D11_TRACE_INPUT_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_REGISTER;
pub const D3D11_TRACE_INPUT_PRIMITIVE_ID_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_PRIMITIVE_ID_REGISTER;
pub const D3D11_TRACE_IMMEDIATE_CONSTANT_BUFFER = D3D11_TRACE_REGISTER_TYPE.IMMEDIATE_CONSTANT_BUFFER;
pub const D3D11_TRACE_TEMP_REGISTER = D3D11_TRACE_REGISTER_TYPE.TEMP_REGISTER;
pub const D3D11_TRACE_INDEXABLE_TEMP_REGISTER = D3D11_TRACE_REGISTER_TYPE.INDEXABLE_TEMP_REGISTER;
pub const D3D11_TRACE_OUTPUT_REGISTER = D3D11_TRACE_REGISTER_TYPE.OUTPUT_REGISTER;
pub const D3D11_TRACE_OUTPUT_DEPTH_REGISTER = D3D11_TRACE_REGISTER_TYPE.OUTPUT_DEPTH_REGISTER;
pub const D3D11_TRACE_CONSTANT_BUFFER = D3D11_TRACE_REGISTER_TYPE.CONSTANT_BUFFER;
pub const D3D11_TRACE_IMMEDIATE32 = D3D11_TRACE_REGISTER_TYPE.IMMEDIATE32;
pub const D3D11_TRACE_SAMPLER = D3D11_TRACE_REGISTER_TYPE.SAMPLER;
pub const D3D11_TRACE_RESOURCE = D3D11_TRACE_REGISTER_TYPE.RESOURCE;
pub const D3D11_TRACE_RASTERIZER = D3D11_TRACE_REGISTER_TYPE.RASTERIZER;
pub const D3D11_TRACE_OUTPUT_COVERAGE_MASK = D3D11_TRACE_REGISTER_TYPE.OUTPUT_COVERAGE_MASK;
pub const D3D11_TRACE_STREAM = D3D11_TRACE_REGISTER_TYPE.STREAM;
pub const D3D11_TRACE_THIS_POINTER = D3D11_TRACE_REGISTER_TYPE.THIS_POINTER;
pub const D3D11_TRACE_OUTPUT_CONTROL_POINT_ID_REGISTER = D3D11_TRACE_REGISTER_TYPE.OUTPUT_CONTROL_POINT_ID_REGISTER;
pub const D3D11_TRACE_INPUT_FORK_INSTANCE_ID_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_FORK_INSTANCE_ID_REGISTER;
pub const D3D11_TRACE_INPUT_JOIN_INSTANCE_ID_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_JOIN_INSTANCE_ID_REGISTER;
pub const D3D11_TRACE_INPUT_CONTROL_POINT_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_CONTROL_POINT_REGISTER;
pub const D3D11_TRACE_OUTPUT_CONTROL_POINT_REGISTER = D3D11_TRACE_REGISTER_TYPE.OUTPUT_CONTROL_POINT_REGISTER;
pub const D3D11_TRACE_INPUT_PATCH_CONSTANT_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_PATCH_CONSTANT_REGISTER;
pub const D3D11_TRACE_INPUT_DOMAIN_POINT_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_DOMAIN_POINT_REGISTER;
pub const D3D11_TRACE_UNORDERED_ACCESS_VIEW = D3D11_TRACE_REGISTER_TYPE.UNORDERED_ACCESS_VIEW;
pub const D3D11_TRACE_THREAD_GROUP_SHARED_MEMORY = D3D11_TRACE_REGISTER_TYPE.THREAD_GROUP_SHARED_MEMORY;
pub const D3D11_TRACE_INPUT_THREAD_ID_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_THREAD_ID_REGISTER;
pub const D3D11_TRACE_INPUT_THREAD_GROUP_ID_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_THREAD_GROUP_ID_REGISTER;
pub const D3D11_TRACE_INPUT_THREAD_ID_IN_GROUP_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_THREAD_ID_IN_GROUP_REGISTER;
pub const D3D11_TRACE_INPUT_COVERAGE_MASK_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_COVERAGE_MASK_REGISTER;
pub const D3D11_TRACE_INPUT_THREAD_ID_IN_GROUP_FLATTENED_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_THREAD_ID_IN_GROUP_FLATTENED_REGISTER;
pub const D3D11_TRACE_INPUT_GS_INSTANCE_ID_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_GS_INSTANCE_ID_REGISTER;
pub const D3D11_TRACE_OUTPUT_DEPTH_GREATER_EQUAL_REGISTER = D3D11_TRACE_REGISTER_TYPE.OUTPUT_DEPTH_GREATER_EQUAL_REGISTER;
pub const D3D11_TRACE_OUTPUT_DEPTH_LESS_EQUAL_REGISTER = D3D11_TRACE_REGISTER_TYPE.OUTPUT_DEPTH_LESS_EQUAL_REGISTER;
pub const D3D11_TRACE_IMMEDIATE64 = D3D11_TRACE_REGISTER_TYPE.IMMEDIATE64;
pub const D3D11_TRACE_INPUT_CYCLE_COUNTER_REGISTER = D3D11_TRACE_REGISTER_TYPE.INPUT_CYCLE_COUNTER_REGISTER;
pub const D3D11_TRACE_INTERFACE_POINTER = D3D11_TRACE_REGISTER_TYPE.INTERFACE_POINTER;
pub const D3D11_TRACE_REGISTER = extern struct {
RegType: D3D11_TRACE_REGISTER_TYPE,
Anonymous: extern union {
Index1D: u16,
Index2D: [2]u16,
},
OperandIndex: u8,
Flags: u8,
};
pub const D3D11_TRACE_STEP = extern struct {
ID: u32,
InstructionActive: BOOL,
NumRegistersWritten: u8,
NumRegistersRead: u8,
MiscOperations: u16,
OpcodeType: u32,
CurrentGlobalCycle: u64,
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11ShaderTrace_Value = @import("../zig.zig").Guid.initString("36b013e6-2811-4845-baa7-d623fe0df104");
pub const IID_ID3D11ShaderTrace = &IID_ID3D11ShaderTrace_Value;
pub const ID3D11ShaderTrace = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
TraceReady: fn(
self: *const ID3D11ShaderTrace,
pTestCount: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ResetTrace: fn(
self: *const ID3D11ShaderTrace,
) callconv(@import("std").os.windows.WINAPI) void,
GetTraceStats: fn(
self: *const ID3D11ShaderTrace,
pTraceStats: ?*D3D11_TRACE_STATS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
PSSelectStamp: fn(
self: *const ID3D11ShaderTrace,
stampIndex: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetInitialRegisterContents: fn(
self: *const ID3D11ShaderTrace,
pRegister: ?*D3D11_TRACE_REGISTER,
pValue: ?*D3D11_TRACE_VALUE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetStep: fn(
self: *const ID3D11ShaderTrace,
stepIndex: u32,
pTraceStep: ?*D3D11_TRACE_STEP,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetWrittenRegister: fn(
self: *const ID3D11ShaderTrace,
stepIndex: u32,
writtenRegisterIndex: u32,
pRegister: ?*D3D11_TRACE_REGISTER,
pValue: ?*D3D11_TRACE_VALUE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetReadRegister: fn(
self: *const ID3D11ShaderTrace,
stepIndex: u32,
readRegisterIndex: u32,
pRegister: ?*D3D11_TRACE_REGISTER,
pValue: ?*D3D11_TRACE_VALUE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderTrace_TraceReady(self: *const T, pTestCount: ?*u64) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderTrace.VTable, self.vtable).TraceReady(@ptrCast(*const ID3D11ShaderTrace, self), pTestCount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderTrace_ResetTrace(self: *const T) callconv(.Inline) void {
return @ptrCast(*const ID3D11ShaderTrace.VTable, self.vtable).ResetTrace(@ptrCast(*const ID3D11ShaderTrace, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderTrace_GetTraceStats(self: *const T, pTraceStats: ?*D3D11_TRACE_STATS) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderTrace.VTable, self.vtable).GetTraceStats(@ptrCast(*const ID3D11ShaderTrace, self), pTraceStats);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderTrace_PSSelectStamp(self: *const T, stampIndex: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderTrace.VTable, self.vtable).PSSelectStamp(@ptrCast(*const ID3D11ShaderTrace, self), stampIndex);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderTrace_GetInitialRegisterContents(self: *const T, pRegister: ?*D3D11_TRACE_REGISTER, pValue: ?*D3D11_TRACE_VALUE) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderTrace.VTable, self.vtable).GetInitialRegisterContents(@ptrCast(*const ID3D11ShaderTrace, self), pRegister, pValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderTrace_GetStep(self: *const T, stepIndex: u32, pTraceStep: ?*D3D11_TRACE_STEP) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderTrace.VTable, self.vtable).GetStep(@ptrCast(*const ID3D11ShaderTrace, self), stepIndex, pTraceStep);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderTrace_GetWrittenRegister(self: *const T, stepIndex: u32, writtenRegisterIndex: u32, pRegister: ?*D3D11_TRACE_REGISTER, pValue: ?*D3D11_TRACE_VALUE) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderTrace.VTable, self.vtable).GetWrittenRegister(@ptrCast(*const ID3D11ShaderTrace, self), stepIndex, writtenRegisterIndex, pRegister, pValue);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderTrace_GetReadRegister(self: *const T, stepIndex: u32, readRegisterIndex: u32, pRegister: ?*D3D11_TRACE_REGISTER, pValue: ?*D3D11_TRACE_VALUE) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderTrace.VTable, self.vtable).GetReadRegister(@ptrCast(*const ID3D11ShaderTrace, self), stepIndex, readRegisterIndex, pRegister, pValue);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_ID3D11ShaderTraceFactory_Value = @import("../zig.zig").Guid.initString("1fbad429-66ab-41cc-9617-667ac10e4459");
pub const IID_ID3D11ShaderTraceFactory = &IID_ID3D11ShaderTraceFactory_Value;
pub const ID3D11ShaderTraceFactory = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateShaderTrace: fn(
self: *const ID3D11ShaderTraceFactory,
pShader: ?*IUnknown,
pTraceDesc: ?*D3D11_SHADER_TRACE_DESC,
ppShaderTrace: ?*?*ID3D11ShaderTrace,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3D11ShaderTraceFactory_CreateShaderTrace(self: *const T, pShader: ?*IUnknown, pTraceDesc: ?*D3D11_SHADER_TRACE_DESC, ppShaderTrace: ?*?*ID3D11ShaderTrace) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3D11ShaderTraceFactory.VTable, self.vtable).CreateShaderTrace(@ptrCast(*const ID3D11ShaderTraceFactory, self), pShader, pTraceDesc, ppShaderTrace);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3DX11_SCAN_DATA_TYPE = enum(i32) {
FLOAT = 1,
INT = 2,
UINT = 3,
};
pub const D3DX11_SCAN_DATA_TYPE_FLOAT = D3DX11_SCAN_DATA_TYPE.FLOAT;
pub const D3DX11_SCAN_DATA_TYPE_INT = D3DX11_SCAN_DATA_TYPE.INT;
pub const D3DX11_SCAN_DATA_TYPE_UINT = D3DX11_SCAN_DATA_TYPE.UINT;
pub const D3DX11_SCAN_OPCODE = enum(i32) {
ADD = 1,
MIN = 2,
MAX = 3,
MUL = 4,
AND = 5,
OR = 6,
XOR = 7,
};
pub const D3DX11_SCAN_OPCODE_ADD = D3DX11_SCAN_OPCODE.ADD;
pub const D3DX11_SCAN_OPCODE_MIN = D3DX11_SCAN_OPCODE.MIN;
pub const D3DX11_SCAN_OPCODE_MAX = D3DX11_SCAN_OPCODE.MAX;
pub const D3DX11_SCAN_OPCODE_MUL = D3DX11_SCAN_OPCODE.MUL;
pub const D3DX11_SCAN_OPCODE_AND = D3DX11_SCAN_OPCODE.AND;
pub const D3DX11_SCAN_OPCODE_OR = D3DX11_SCAN_OPCODE.OR;
pub const D3DX11_SCAN_OPCODE_XOR = D3DX11_SCAN_OPCODE.XOR;
pub const D3DX11_SCAN_DIRECTION = enum(i32) {
FORWARD = 1,
BACKWARD = 2,
};
pub const D3DX11_SCAN_DIRECTION_FORWARD = D3DX11_SCAN_DIRECTION.FORWARD;
pub const D3DX11_SCAN_DIRECTION_BACKWARD = D3DX11_SCAN_DIRECTION.BACKWARD;
const IID_ID3DX11Scan_Value = @import("../zig.zig").Guid.initString("5089b68f-e71d-4d38-be8e-f363b95a9405");
pub const IID_ID3DX11Scan = &IID_ID3DX11Scan_Value;
pub const ID3DX11Scan = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetScanDirection: fn(
self: *const ID3DX11Scan,
Direction: D3DX11_SCAN_DIRECTION,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Scan: fn(
self: *const ID3DX11Scan,
ElementType: D3DX11_SCAN_DATA_TYPE,
OpCode: D3DX11_SCAN_OPCODE,
ElementScanSize: u32,
pSrc: ?*ID3D11UnorderedAccessView,
pDst: ?*ID3D11UnorderedAccessView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Multiscan: fn(
self: *const ID3DX11Scan,
ElementType: D3DX11_SCAN_DATA_TYPE,
OpCode: D3DX11_SCAN_OPCODE,
ElementScanSize: u32,
ElementScanPitch: u32,
ScanCount: u32,
pSrc: ?*ID3D11UnorderedAccessView,
pDst: ?*ID3D11UnorderedAccessView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11Scan_SetScanDirection(self: *const T, Direction: D3DX11_SCAN_DIRECTION) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DX11Scan.VTable, self.vtable).SetScanDirection(@ptrCast(*const ID3DX11Scan, self), Direction);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11Scan_Scan(self: *const T, ElementType: D3DX11_SCAN_DATA_TYPE, OpCode: D3DX11_SCAN_OPCODE, ElementScanSize: u32, pSrc: ?*ID3D11UnorderedAccessView, pDst: ?*ID3D11UnorderedAccessView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DX11Scan.VTable, self.vtable).Scan(@ptrCast(*const ID3DX11Scan, self), ElementType, OpCode, ElementScanSize, pSrc, pDst);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11Scan_Multiscan(self: *const T, ElementType: D3DX11_SCAN_DATA_TYPE, OpCode: D3DX11_SCAN_OPCODE, ElementScanSize: u32, ElementScanPitch: u32, ScanCount: u32, pSrc: ?*ID3D11UnorderedAccessView, pDst: ?*ID3D11UnorderedAccessView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DX11Scan.VTable, self.vtable).Multiscan(@ptrCast(*const ID3DX11Scan, self), ElementType, OpCode, ElementScanSize, ElementScanPitch, ScanCount, pSrc, pDst);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3DX11SegmentedScan_Value = @import("../zig.zig").Guid.initString("a915128c-d954-4c79-bfe1-64db923194d6");
pub const IID_ID3DX11SegmentedScan = &IID_ID3DX11SegmentedScan_Value;
pub const ID3DX11SegmentedScan = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetScanDirection: fn(
self: *const ID3DX11SegmentedScan,
Direction: D3DX11_SCAN_DIRECTION,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SegScan: fn(
self: *const ID3DX11SegmentedScan,
ElementType: D3DX11_SCAN_DATA_TYPE,
OpCode: D3DX11_SCAN_OPCODE,
ElementScanSize: u32,
pSrc: ?*ID3D11UnorderedAccessView,
pSrcElementFlags: ?*ID3D11UnorderedAccessView,
pDst: ?*ID3D11UnorderedAccessView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11SegmentedScan_SetScanDirection(self: *const T, Direction: D3DX11_SCAN_DIRECTION) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DX11SegmentedScan.VTable, self.vtable).SetScanDirection(@ptrCast(*const ID3DX11SegmentedScan, self), Direction);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11SegmentedScan_SegScan(self: *const T, ElementType: D3DX11_SCAN_DATA_TYPE, OpCode: D3DX11_SCAN_OPCODE, ElementScanSize: u32, pSrc: ?*ID3D11UnorderedAccessView, pSrcElementFlags: ?*ID3D11UnorderedAccessView, pDst: ?*ID3D11UnorderedAccessView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DX11SegmentedScan.VTable, self.vtable).SegScan(@ptrCast(*const ID3DX11SegmentedScan, self), ElementType, OpCode, ElementScanSize, pSrc, pSrcElementFlags, pDst);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_ID3DX11FFT_Value = @import("../zig.zig").Guid.initString("b3f7a938-4c93-4310-a675-b30d6de50553");
pub const IID_ID3DX11FFT = &IID_ID3DX11FFT_Value;
pub const ID3DX11FFT = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetForwardScale: fn(
self: *const ID3DX11FFT,
ForwardScale: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetForwardScale: fn(
self: *const ID3DX11FFT,
) callconv(@import("std").os.windows.WINAPI) f32,
SetInverseScale: fn(
self: *const ID3DX11FFT,
InverseScale: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetInverseScale: fn(
self: *const ID3DX11FFT,
) callconv(@import("std").os.windows.WINAPI) f32,
AttachBuffersAndPrecompute: fn(
self: *const ID3DX11FFT,
NumTempBuffers: u32,
ppTempBuffers: [*]?*ID3D11UnorderedAccessView,
NumPrecomputeBuffers: u32,
ppPrecomputeBufferSizes: [*]?*ID3D11UnorderedAccessView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ForwardTransform: fn(
self: *const ID3DX11FFT,
pInputBuffer: ?*ID3D11UnorderedAccessView,
ppOutputBuffer: ?*?*ID3D11UnorderedAccessView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
InverseTransform: fn(
self: *const ID3DX11FFT,
pInputBuffer: ?*ID3D11UnorderedAccessView,
ppOutputBuffer: ?*?*ID3D11UnorderedAccessView,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11FFT_SetForwardScale(self: *const T, ForwardScale: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DX11FFT.VTable, self.vtable).SetForwardScale(@ptrCast(*const ID3DX11FFT, self), ForwardScale);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11FFT_GetForwardScale(self: *const T) callconv(.Inline) f32 {
return @ptrCast(*const ID3DX11FFT.VTable, self.vtable).GetForwardScale(@ptrCast(*const ID3DX11FFT, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11FFT_SetInverseScale(self: *const T, InverseScale: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DX11FFT.VTable, self.vtable).SetInverseScale(@ptrCast(*const ID3DX11FFT, self), InverseScale);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11FFT_GetInverseScale(self: *const T) callconv(.Inline) f32 {
return @ptrCast(*const ID3DX11FFT.VTable, self.vtable).GetInverseScale(@ptrCast(*const ID3DX11FFT, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11FFT_AttachBuffersAndPrecompute(self: *const T, NumTempBuffers: u32, ppTempBuffers: [*]?*ID3D11UnorderedAccessView, NumPrecomputeBuffers: u32, ppPrecomputeBufferSizes: [*]?*ID3D11UnorderedAccessView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DX11FFT.VTable, self.vtable).AttachBuffersAndPrecompute(@ptrCast(*const ID3DX11FFT, self), NumTempBuffers, ppTempBuffers, NumPrecomputeBuffers, ppPrecomputeBufferSizes);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11FFT_ForwardTransform(self: *const T, pInputBuffer: ?*ID3D11UnorderedAccessView, ppOutputBuffer: ?*?*ID3D11UnorderedAccessView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DX11FFT.VTable, self.vtable).ForwardTransform(@ptrCast(*const ID3DX11FFT, self), pInputBuffer, ppOutputBuffer);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn ID3DX11FFT_InverseTransform(self: *const T, pInputBuffer: ?*ID3D11UnorderedAccessView, ppOutputBuffer: ?*?*ID3D11UnorderedAccessView) callconv(.Inline) HRESULT {
return @ptrCast(*const ID3DX11FFT.VTable, self.vtable).InverseTransform(@ptrCast(*const ID3DX11FFT, self), pInputBuffer, ppOutputBuffer);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const D3DX11_FFT_DATA_TYPE = enum(i32) {
REAL = 0,
COMPLEX = 1,
};
pub const D3DX11_FFT_DATA_TYPE_REAL = D3DX11_FFT_DATA_TYPE.REAL;
pub const D3DX11_FFT_DATA_TYPE_COMPLEX = D3DX11_FFT_DATA_TYPE.COMPLEX;
pub const D3DX11_FFT_DIM_MASK = enum(i32) {
@"1D" = 1,
@"2D" = 3,
@"3D" = 7,
};
pub const D3DX11_FFT_DIM_MASK_1D = D3DX11_FFT_DIM_MASK.@"1D";
pub const D3DX11_FFT_DIM_MASK_2D = D3DX11_FFT_DIM_MASK.@"2D";
pub const D3DX11_FFT_DIM_MASK_3D = D3DX11_FFT_DIM_MASK.@"3D";
pub const D3DX11_FFT_DESC = extern struct {
NumDimensions: u32,
ElementLengths: [32]u32,
DimensionMask: u32,
Type: D3DX11_FFT_DATA_TYPE,
};
pub const D3DX11_FFT_BUFFER_INFO = extern struct {
NumTempBufferSizes: u32,
TempBufferFloatSizes: [4]u32,
NumPrecomputeBufferSizes: u32,
PrecomputeBufferFloatSizes: [4]u32,
};
pub const D3DX11_FFT_CREATE_FLAG = enum(i32) {
S = 1,
};
pub const D3DX11_FFT_CREATE_FLAG_NO_PRECOMPUTE_BUFFERS = D3DX11_FFT_CREATE_FLAG.S;
//--------------------------------------------------------------------------------
// Section: Functions (12)
//--------------------------------------------------------------------------------
pub extern "d3d11" fn D3D11CreateDevice(
pAdapter: ?*IDXGIAdapter,
DriverType: D3D_DRIVER_TYPE,
Software: ?HINSTANCE,
Flags: D3D11_CREATE_DEVICE_FLAG,
pFeatureLevels: ?[*]const D3D_FEATURE_LEVEL,
FeatureLevels: u32,
SDKVersion: u32,
ppDevice: ?*?*ID3D11Device,
pFeatureLevel: ?*D3D_FEATURE_LEVEL,
ppImmediateContext: ?*?*ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "d3d11" fn D3D11CreateDeviceAndSwapChain(
pAdapter: ?*IDXGIAdapter,
DriverType: D3D_DRIVER_TYPE,
Software: ?HINSTANCE,
Flags: D3D11_CREATE_DEVICE_FLAG,
pFeatureLevels: ?[*]const D3D_FEATURE_LEVEL,
FeatureLevels: u32,
SDKVersion: u32,
pSwapChainDesc: ?*const DXGI_SWAP_CHAIN_DESC,
ppSwapChain: ?*?*IDXGISwapChain,
ppDevice: ?*?*ID3D11Device,
pFeatureLevel: ?*D3D_FEATURE_LEVEL,
ppImmediateContext: ?*?*ID3D11DeviceContext,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "D3DCOMPILER_47" fn D3DDisassemble11Trace(
// TODO: what to do with BytesParamIndex 1?
pSrcData: ?*const anyopaque,
SrcDataSize: usize,
pTrace: ?*ID3D11ShaderTrace,
StartStep: u32,
NumSteps: u32,
Flags: u32,
ppDisassembly: ?*?*ID3DBlob,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "d3dcsx" fn D3DX11CreateScan(
pDeviceContext: ?*ID3D11DeviceContext,
MaxElementScanSize: u32,
MaxScanCount: u32,
ppScan: ?*?*ID3DX11Scan,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "d3dcsx" fn D3DX11CreateSegmentedScan(
pDeviceContext: ?*ID3D11DeviceContext,
MaxElementScanSize: u32,
ppScan: ?*?*ID3DX11SegmentedScan,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "d3dcsx" fn D3DX11CreateFFT(
pDeviceContext: ?*ID3D11DeviceContext,
pDesc: ?*const D3DX11_FFT_DESC,
Flags: u32,
pBufferInfo: ?*D3DX11_FFT_BUFFER_INFO,
ppFFT: ?*?*ID3DX11FFT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "d3dcsx" fn D3DX11CreateFFT1DReal(
pDeviceContext: ?*ID3D11DeviceContext,
X: u32,
Flags: u32,
pBufferInfo: ?*D3DX11_FFT_BUFFER_INFO,
ppFFT: ?*?*ID3DX11FFT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "d3dcsx" fn D3DX11CreateFFT1DComplex(
pDeviceContext: ?*ID3D11DeviceContext,
X: u32,
Flags: u32,
pBufferInfo: ?*D3DX11_FFT_BUFFER_INFO,
ppFFT: ?*?*ID3DX11FFT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "d3dcsx" fn D3DX11CreateFFT2DReal(
pDeviceContext: ?*ID3D11DeviceContext,
X: u32,
Y: u32,
Flags: u32,
pBufferInfo: ?*D3DX11_FFT_BUFFER_INFO,
ppFFT: ?*?*ID3DX11FFT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "d3dcsx" fn D3DX11CreateFFT2DComplex(
pDeviceContext: ?*ID3D11DeviceContext,
X: u32,
Y: u32,
Flags: u32,
pBufferInfo: ?*D3DX11_FFT_BUFFER_INFO,
ppFFT: ?*?*ID3DX11FFT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "d3dcsx" fn D3DX11CreateFFT3DReal(
pDeviceContext: ?*ID3D11DeviceContext,
X: u32,
Y: u32,
Z: u32,
Flags: u32,
pBufferInfo: ?*D3DX11_FFT_BUFFER_INFO,
ppFFT: ?*?*ID3DX11FFT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "d3dcsx" fn D3DX11CreateFFT3DComplex(
pDeviceContext: ?*ID3D11DeviceContext,
X: u32,
Y: u32,
Z: u32,
Flags: u32,
pBufferInfo: ?*D3DX11_FFT_BUFFER_INFO,
ppFFT: ?*?*ID3DX11FFT,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
//--------------------------------------------------------------------------------
// Section: Unicode Aliases (0)
//--------------------------------------------------------------------------------
const thismodule = @This();
pub usingnamespace switch (@import("../zig.zig").unicode_mode) {
.ansi => struct {
},
.wide => struct {
},
.unspecified => if (@import("builtin").is_test) struct {
} else struct {
},
};
//--------------------------------------------------------------------------------
// Section: Imports (38)
//--------------------------------------------------------------------------------
const Guid = @import("../zig.zig").Guid;
const BOOL = @import("../foundation.zig").BOOL;
const D3D_CBUFFER_TYPE = @import("../graphics/direct3d.zig").D3D_CBUFFER_TYPE;
const D3D_DRIVER_TYPE = @import("../graphics/direct3d.zig").D3D_DRIVER_TYPE;
const D3D_FEATURE_LEVEL = @import("../graphics/direct3d.zig").D3D_FEATURE_LEVEL;
const D3D_INTERPOLATION_MODE = @import("../graphics/direct3d.zig").D3D_INTERPOLATION_MODE;
const D3D_MIN_PRECISION = @import("../graphics/direct3d.zig").D3D_MIN_PRECISION;
const D3D_NAME = @import("../graphics/direct3d.zig").D3D_NAME;
const D3D_PARAMETER_FLAGS = @import("../graphics/direct3d.zig").D3D_PARAMETER_FLAGS;
const D3D_PRIMITIVE = @import("../graphics/direct3d.zig").D3D_PRIMITIVE;
const D3D_PRIMITIVE_TOPOLOGY = @import("../graphics/direct3d.zig").D3D_PRIMITIVE_TOPOLOGY;
const D3D_REGISTER_COMPONENT_TYPE = @import("../graphics/direct3d.zig").D3D_REGISTER_COMPONENT_TYPE;
const D3D_RESOURCE_RETURN_TYPE = @import("../graphics/direct3d.zig").D3D_RESOURCE_RETURN_TYPE;
const D3D_SHADER_INPUT_TYPE = @import("../graphics/direct3d.zig").D3D_SHADER_INPUT_TYPE;
const D3D_SHADER_VARIABLE_CLASS = @import("../graphics/direct3d.zig").D3D_SHADER_VARIABLE_CLASS;
const D3D_SHADER_VARIABLE_TYPE = @import("../graphics/direct3d.zig").D3D_SHADER_VARIABLE_TYPE;
const D3D_SRV_DIMENSION = @import("../graphics/direct3d.zig").D3D_SRV_DIMENSION;
const D3D_TESSELLATOR_DOMAIN = @import("../graphics/direct3d.zig").D3D_TESSELLATOR_DOMAIN;
const D3D_TESSELLATOR_OUTPUT_PRIMITIVE = @import("../graphics/direct3d.zig").D3D_TESSELLATOR_OUTPUT_PRIMITIVE;
const D3D_TESSELLATOR_PARTITIONING = @import("../graphics/direct3d.zig").D3D_TESSELLATOR_PARTITIONING;
const DXGI_COLOR_SPACE_TYPE = @import("../graphics/dxgi/common.zig").DXGI_COLOR_SPACE_TYPE;
const DXGI_FORMAT = @import("../graphics/dxgi/common.zig").DXGI_FORMAT;
const DXGI_HDR_METADATA_TYPE = @import("../graphics/dxgi.zig").DXGI_HDR_METADATA_TYPE;
const DXGI_RATIONAL = @import("../graphics/dxgi/common.zig").DXGI_RATIONAL;
const DXGI_SAMPLE_DESC = @import("../graphics/dxgi/common.zig").DXGI_SAMPLE_DESC;
const DXGI_SWAP_CHAIN_DESC = @import("../graphics/dxgi.zig").DXGI_SWAP_CHAIN_DESC;
const HANDLE = @import("../foundation.zig").HANDLE;
const HINSTANCE = @import("../foundation.zig").HINSTANCE;
const HRESULT = @import("../foundation.zig").HRESULT;
const ID3DBlob = @import("../graphics/direct3d.zig").ID3DBlob;
const IDXGIAdapter = @import("../graphics/dxgi.zig").IDXGIAdapter;
const IDXGISwapChain = @import("../graphics/dxgi.zig").IDXGISwapChain;
const IUnknown = @import("../system/com.zig").IUnknown;
const PSTR = @import("../foundation.zig").PSTR;
const PWSTR = @import("../foundation.zig").PWSTR;
const RECT = @import("../foundation.zig").RECT;
const SECURITY_ATTRIBUTES = @import("../security.zig").SECURITY_ATTRIBUTES;
const SIZE = @import("../foundation.zig").SIZE;
test {
// The following '_ = <FuncPtrType>' lines are a workaround for https://github.com/ziglang/zig/issues/4476
if (@hasDecl(@This(), "PFN_D3D11_CREATE_DEVICE")) { _ = PFN_D3D11_CREATE_DEVICE; }
if (@hasDecl(@This(), "PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN")) { _ = PFN_D3D11_CREATE_DEVICE_AND_SWAP_CHAIN; }
@setEvalBranchQuota(
@import("std").meta.declarations(@This()).len * 3
);
// reference all the pub declarations
if (!@import("builtin").is_test) return;
inline for (@import("std").meta.declarations(@This())) |decl| {
if (decl.is_pub) {
_ = decl;
}
}
} | win32/graphics/direct3d11.zig |
const std = @import("std");
const arm_cmse = @import("../drivers/arm_cmse.zig");
const arm_m = @import("../drivers/arm_m.zig");
const an505 = @import("../drivers/an505.zig");
extern var __nsc_start: usize;
extern var __nsc_end: usize;
export fn main() void {
// Enable SecureFault, UsageFault, BusFault, and MemManage for ease of
// debugging. (Without this, they all escalate to HardFault)
arm_m.scb.regShcsr().* =
arm_m.Scb.SHCSR_MEMFAULTENA |
arm_m.Scb.SHCSR_BUSFAULTENA |
arm_m.Scb.SHCSR_USGFAULTENA |
arm_m.Scb.SHCSR_SECUREFAULTENA;
// Enable Non-Secure BusFault, HardFault, and NMI.
// Prioritize Secure exceptions.
arm_m.scb.regAircr().* =
(arm_m.scb.regAircr().* & ~arm_m.Scb.AIRCR_VECTKEY_MASK) |
arm_m.Scb.AIRCR_BFHFNMINS | arm_m.Scb.AIRCR_PRIS |
arm_m.Scb.AIRCR_VECTKEY_MAGIC;
// :( <https://github.com/ziglang/zig/issues/504>
an505.uart0.configure(25e6, 115200);
an505.uart0.print("(Hit ^A X to quit QEMU)\r\n");
an505.uart0.print("The Secure code is running!\r\n");
// Configure SysTick
// -----------------------------------------------------------------------
arm_m.sys_tick.regRvr().* = 1000 * 100; // fire every 100 milliseconds
arm_m.sys_tick.regCsr().* = arm_m.SysTick.CSR_ENABLE |
arm_m.SysTick.CSR_TICKINT;
// Configure SAU
// -----------------------------------------------------------------------
const Region = arm_cmse.SauRegion;
// AN505 ZBT SRAM (SSRAM1) Non-Secure alias
arm_cmse.sau.setRegion(0, Region{ .start = 0x00200000, .end = 0x00400000 });
// AN505 ZBT SRAM (SSRAM3) Non-Secure alias
arm_cmse.sau.setRegion(1, Region{ .start = 0x28200000, .end = 0x28400000 });
// The Non-Secure callable region
arm_cmse.sau.setRegion(2, Region{
.start = @ptrToInt(&__nsc_start),
.end = @ptrToInt(&__nsc_end),
.nsc = true,
});
// Configure MPCs and IDAU
// -----------------------------------------------------------------------
// Enable Non-Secure access to SSRAM1 (`0x[01]0200000`)
// for the range `[0x200000, 0x3fffff]`.
an505.ssram1_mpc.setEnableBusError(true);
an505.ssram1_mpc.assignRangeToNonSecure(0x200000, 0x400000);
// Enable Non-Secure access to SSRAM3 (`0x[23]8200000`)
// for the range `[0, 0x1fffff]`.
// - It seems that the range SSRAM3's MPC encompasses actually starts at
// `0x[23]8000000`.
// - We actually use only the first `0x4000` bytes. However the hardware
// block size is larger than that and the rounding behavior of
// `tz_mpc.zig` is unspecified, so specify the larger range.
an505.ssram3_mpc.setEnableBusError(true);
an505.ssram3_mpc.assignRangeToNonSecure(0x200000, 0x400000);
// Configure IDAU to enable Non-Secure Callable regions
// for the code memory `[0x10000000, 0x1dffffff]`
an505.spcb.regNsccfg().* |= an505.Spcb.NSCCFG_CODENSC;
// Enable SAU
// -----------------------------------------------------------------------
arm_cmse.sau.regCtrl().* |= arm_cmse.Sau.CTRL_ENABLE;
// Boot the Non-Secure code
// -----------------------------------------------------------------------
// Configure the Non-Secure exception vector table
arm_m.scb_ns.regVtor().* = 0x00200000;
an505.uart0.print("Booting the Non-Secure code...\r\n");
// Call Non-Secure code's entry point
const ns_entry = @intToPtr(*volatile fn () void, 0x00200004).*;
_ = arm_cmse.nonSecureCall(ns_entry, 0, 0, 0, 0);
an505.uart0.print("Non-Secure reset handler returned unexpectedly!\r\n");
while (true) {}
}
/// The Non-Secure-callable function that outputs zero or more bytes to the
/// debug output.
extern fn nsDebugOutput(count: usize, ptr: usize, r2: usize, r32: usize) usize {
const bytes = arm_cmse.checkSlice(u8, ptr, count, arm_cmse.CheckOptions{}) catch |err| {
an505.uart0.print("warning: pointer security check failed: {}\r\n", err);
an505.uart0.print(" count = {}, ptr = 0x{x}\r\n", count, ptr);
return 0;
};
// Even if the permission check has succeeded, it's still unsafe to treat
// Non-Secure pointers as normal pointers (this is why `bytes` is
// `[]volatile u8`), so we can't use `writeSlice` here.
for (bytes) |byte| {
an505.uart0.write(byte);
}
return 0;
}
comptime {
arm_cmse.exportNonSecureCallable("debugOutput", nsDebugOutput);
}
var counter: u8 = 0;
extern fn handleSysTick() void {
counter +%= 1;
an505.uart0.print("\r{}", "|\\-/"[counter % 4 ..][0..1]);
}
/// Not a function, actually, but suppresses type error
extern fn _main_stack_top() void;
/// But this is really a function!
extern fn handleReset() void;
/// Create an "unhandled exception" handler.
fn unhandled(comptime name: []const u8) extern fn () void {
const ns = struct {
extern fn handler() void {
return unhandledInner(name);
}
};
return ns.handler;
}
fn unhandledInner(name: []const u8) void {
an505.uart0.print("caught an unhandled exception, system halted: {}\r\n", name);
while (true) {}
}
export const exception_vectors linksection(".isr_vector") = [_]extern fn () void{
_main_stack_top,
handleReset,
unhandled("NMI"), // NMI
unhandled("HardFault"), // HardFault
unhandled("MemManage"), // MemManage
unhandled("BusFault"), // BusFault
unhandled("UsageFault"), // UsageFault
unhandled("SecureFault"), // SecureFault
unhandled("Reserved 1"), // Reserved 1
unhandled("Reserved 2"), // Reserved 2
unhandled("Reserved 3"), // Reserved 3
unhandled("SVCall"), // SVCall
unhandled("DebugMonitor"), // DebugMonitor
unhandled("Reserved 4"), // Reserved 4
unhandled("PendSV"), // PendSV
handleSysTick, // SysTick
unhandled("External interrupt 0"), // External interrupt 0
unhandled("External interrupt 1"), // External interrupt 1
unhandled("External interrupt 2"), // External interrupt 2
unhandled("External interrupt 3"), // External interrupt 3
unhandled("External interrupt 4"), // External interrupt 4
unhandled("External interrupt 5"), // External interrupt 5
unhandled("External interrupt 6"), // External interrupt 6
unhandled("External interrupt 7"), // External interrupt 7
unhandled("External interrupt 8"), // External interrupt 8
}; | src/secure/main.zig |
const std = @import("std");
const Allocator = std.mem.Allocator;
const nitori = @import("nitori");
const communication = nitori.communication;
const Channel = communication.Channel;
const EventChannel = communication.EventChannel;
const ChunkIterMut = nitori.chunks.ChunkIterMut;
const Timer = nitori.timer.Timer;
//;
const audio_graph = @import("audio_graph.zig");
usingnamespace audio_graph;
const module = @import("module.zig");
const Module = module.Module;
const c = @import("c.zig");
//;
fn callback(
input: ?*const c_void,
output: ?*c_void,
frame_ct: c_ulong,
time_info: [*c]const c.PaStreamCallbackTimeInfo,
status_flags: c.PaStreamCallbackFlags,
userdata: ?*c_void,
) callconv(.C) c_int {
var out_ptr = @ptrCast([*]f32, @alignCast(@alignOf(f32), output));
var out_slice = out_ptr[0 .. frame_ct * 2];
var sys = @ptrCast(*System, @alignCast(@alignOf(System), userdata));
var f_ctx = Module.FrameContext{
.now = sys.tm.now(),
};
var c_ctx = Module.ComputeContext{
.sample_rate = sys.settings.sample_rate,
.frame_len = out_slice.len,
.inputs = undefined,
.output = undefined,
};
sys.graph.frame(f_ctx) catch |err| {
// TODO do something with send error
unreachable;
};
var chunks = ChunkIterMut(f32).init(out_slice, audio_graph.max_callback_len);
while (chunks.next()) |chunk| {
c_ctx.frame_len = chunk.len;
sys.graph.compute(c_ctx, chunk);
}
return 0;
}
// TODO theres probably a way to use a single event channel
// might have to be mpmc? idk
// for just doing swaps idk
pub const System = struct {
const Self = @This();
pub const InitError = error{
CouldntInitPortAudio,
CouldntInitStream,
} || Allocator.Error || Timer.Error;
pub const Settings = struct {
allocator: *Allocator,
device_number: u8,
channel_size: usize = 50,
suggested_latency: f32 = 1.,
sample_rate: u32 = 44100,
};
settings: Settings,
stream: *c.PaStream,
graph: AudioGraph,
controller: Controller,
channel: Channel(AudioGraphBase),
event_channel: EventChannel(AudioGraphBase),
tm: Timer,
// TODO
// return name and id in a struct
pub fn queryDeviceNames(allocator: *Allocator) void {}
pub fn init(self: *Self, settings: Settings) InitError!void {
const allocator = settings.allocator;
self.settings = settings;
self.channel = try Channel(AudioGraphBase).init(allocator, settings.channel_size);
self.event_channel = try EventChannel(AudioGraphBase).init(allocator, settings.channel_size);
self.graph = AudioGraph.init(allocator, &self.channel, &self.event_channel);
self.controller = Controller.init(allocator, &self.channel, &self.event_channel);
self.tm = try Timer.start();
var err = c.Pa_Initialize();
if (err != c.paNoError) {
return InitError.CouldntInitPortAudio;
}
errdefer {
_ = c.Pa_Terminate();
}
var stream: ?*c.PaStream = null;
var output_params = c.PaStreamParameters{
.channelCount = 2,
.device = settings.device_number,
.hostApiSpecificStreamInfo = null,
.sampleFormat = c.paFloat32,
.suggestedLatency = settings.suggested_latency,
};
err = c.Pa_OpenStream(
&stream,
null,
&output_params,
@intToFloat(f32, settings.sample_rate),
c.paFramesPerBufferUnspecified,
c.paNoFlag,
callback,
self,
);
if (err != c.paNoError) {
return error.CouldntInitStream;
}
errdefer c.Pa_closeStream(stream);
_ = c.Pa_StartStream(stream);
self.stream = stream.?;
}
pub fn deinit(self: *Self) void {
// TODO stop stream
// TODO check err
_ = c.Pa_CloseStream(self.stream);
_ = c.Pa_Terminate();
self.controller.deinit();
self.graph.deinit();
self.event_channel.deinit();
self.channel.deinit();
}
}; | src/system.zig |
const std = @import("std");
usingnamespace @import("shared.zig");
var tag_collection: std.StringHashMap(void) = undefined;
var allocator: *std.mem.Allocator = undefined;
var string_arena: *std.mem.Allocator = undefined;
pub fn main() !u8 {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
allocator = &gpa.allocator;
var string_arena_impl = std.heap.ArenaAllocator.init(allocator);
defer string_arena_impl.deinit();
string_arena = &string_arena_impl.allocator;
tag_collection = std.StringHashMap(void).init(allocator);
defer tag_collection.deinit();
try loadTags();
try readPackage();
return 0;
}
fn readPackage() !void {
const stdin = std.io.getStdIn().reader();
const stdout = std.io.getStdOut().writer();
var pkg = PackageDescription{
.author = undefined,
.tags = undefined,
.git = undefined,
.root_file = undefined,
.description = undefined,
};
var file: std.fs.File = undefined;
var path: []u8 = undefined;
while (true) {
try stdout.writeAll("name: ");
var name = try stdin.readUntilDelimiterAlloc(allocator, '\n', 512);
defer allocator.free(name);
path = try std.mem.concat(allocator, u8, &[_][]const u8{
"packages/",
name,
".json",
});
file = std.fs.cwd().createFile(path, .{
.truncate = true,
.exclusive = true,
}) catch |err| switch (err) {
error.PathAlreadyExists => {
allocator.free(path);
try stdout.writeAll("A package with this name already exists!\n");
continue;
},
else => |e| {
allocator.free(path);
return e;
},
};
break;
}
defer allocator.free(path);
errdefer {
std.fs.cwd().deleteFile(path) catch |e| std.debug.panic("Failed to delete file {}!", .{path});
}
defer file.close();
try stdout.writeAll("author: ");
pkg.author = try stdin.readUntilDelimiterAlloc(allocator, '\n', 512);
defer allocator.free(pkg.author);
try stdout.writeAll("description: ");
pkg.description = try stdin.readUntilDelimiterAlloc(allocator, '\n', 512);
defer allocator.free(pkg.description);
try stdout.writeAll("git: ");
pkg.git = try stdin.readUntilDelimiterAlloc(allocator, '\n', 512);
defer allocator.free(pkg.git);
try stdout.writeAll("source: ");
pkg.root_file = try stdin.readUntilDelimiterAlloc(allocator, '\n', 512);
defer allocator.free(pkg.root_file);
var tags = std.ArrayList([]const u8).init(allocator);
defer {
for (tags.items) |tag| {
allocator.free(tag);
}
tags.deinit();
}
while (true) {
try stdout.writeAll("tags: ");
const tag_string = try stdin.readUntilDelimiterAlloc(allocator, '\n', 512);
defer allocator.free(tag_string);
var bad = false;
var iterator = std.mem.split(tag_string, ",");
while (iterator.next()) |part| {
const tag = std.mem.trim(u8, part, " \t\r\n");
if (tag.len == 0)
continue;
if (tag_collection.get(tag) == null) {
try stdout.print("Tag '{}' does not exist!\n", .{tag});
bad = true;
}
}
if (bad) continue;
iterator = std.mem.split(tag_string, ",");
while (iterator.next()) |part| {
const tag = std.mem.trim(u8, part, " \t\r\n");
if (tag.len == 0)
continue;
const str = try allocator.dupe(u8, tag);
errdefer allocator.free(str);
try tags.append(str);
}
break;
}
pkg.tags = tags.items;
try std.json.stringify(pkg, .{
.whitespace = .{
.indent = .{ .Space = 2 },
.separator = true,
},
.string = .{
.String = .{},
},
}, file.writer());
}
fn freePackage(pkg: *PackageDescription) void {
for (pkg.tags.items) |tag| {
allocator.free(tag);
}
allocator.free(pkg.author);
allocator.free(pkg.tags);
allocator.free(pkg.git);
allocator.free(pkg.root_file);
allocator.free(pkg.description);
}
fn loadTags() !void {
const stderr_file = std.io.getStdErr();
const stderr = stderr_file.writer();
var directory = try std.fs.cwd().openDir("tags", .{ .iterate = true, .no_follow = true });
defer directory.close();
var iterator = directory.iterate();
while (try iterator.next()) |entry| {
if (entry.kind != .File)
continue;
if (std.mem.endsWith(u8, entry.name, ".json")) {
var file = try directory.openFile(entry.name, .{ .read = true, .write = false });
defer file.close();
const name = entry.name[0 .. entry.name.len - 5];
try tag_collection.put(try string_arena.dupe(u8, name), {}); // file names ought to be unique
} else {
try stderr.print("{}/{} is not a json file!\n", .{ "tags", entry.name });
}
}
} | tools/adder.zig |
const sf = struct {
pub usingnamespace @import("../sfml.zig");
pub usingnamespace sf.system;
pub usingnamespace sf.graphics;
};
const RenderTexture = @This();
// Constructor/destructor
/// Inits a render texture with a size (use createWithDepthBuffer if you want a depth buffer)
pub fn create(size: sf.Vector2u) !RenderTexture {
var rtex = sf.c.sfRenderTexture_create(size.x, size.y, 0); //0 means no depth buffer
if (rtex) |t| {
return RenderTexture{ ._ptr = t };
} else return sf.Error.nullptrUnknownReason;
}
/// Inits a render texture with a size, it will have a depth buffer
pub fn createWithDepthBuffer(size: sf.Vector2u) !RenderTexture {
var rtex = sf.c.sfRenderTexture_create(size.x, size.y, 1);
if (rtex) |t| {
return .{ ._ptr = t };
} else return sf.Error.nullptrUnknownReason;
}
/// Destroys this render texture
pub fn destroy(self: *RenderTexture) void {
sf.c.sfRenderTexture_destroy(self._ptr);
}
// Drawing functions
/// Clears the drawing target with a color
pub fn clear(self: *RenderTexture, color: sf.Color) void {
sf.c.sfRenderTexture_clear(self._ptr, color._toCSFML());
}
/// Updates the texture with what has been drawn on the render area
pub fn display(self: *RenderTexture) void {
sf.c.sfRenderTexture_display(self._ptr);
}
/// Draw something on the texture (won't be visible until display is called)
/// Object must have a sfDraw function (look at CircleShape for reference)
/// You can pass a render state or null for default
pub fn draw(self: *RenderTexture, to_draw: anytype, states: ?sf.RenderStates) void {
const T = @TypeOf(to_draw);
if (comptime @import("std").meta.trait.hasFn("sfDraw")(T)) {
// Inline call of object's draw function
if (states) |s| {
var cstates = s._toCSFML();
@call(.{ .modifier = .always_inline }, T.sfDraw, .{ to_draw, self.*, &cstates });
} else
@call(.{ .modifier = .always_inline }, T.sfDraw, .{ to_draw, self.*, null });
// to_draw.sfDraw(self, states);
} else @compileError("You must provide a drawable object (struct with \"sfDraw\" method).");
}
/// Gets a const reference to the target texture (the reference doesn't change)
pub fn getTexture(self: RenderTexture) sf.Texture {
const tex = sf.c.sfRenderTexture_getTexture(self._ptr);
return sf.Texture{ ._const_ptr = tex.? };
}
// Texture related stuff
/// Generates a mipmap for the current texture data, returns true if the operation succeeded
pub fn generateMipmap(self: *RenderTexture) bool {
return sf.c.sfRenderTexture_generateMipmap(self._ptr) != 0;
}
/// Tells whether or not the texture is to be smoothed
pub fn isSmooth(self: RenderTexture) bool {
return sf.c.sfRenderTexture_isSmooth(self._ptr) != 0;
}
/// Enables or disables texture smoothing
pub fn setSmooth(self: *RenderTexture, smooth: bool) void {
sf.c.sfRenderTexture_setSmooth(self._ptr, @boolToInt(smooth));
}
/// Tells whether or not the texture should repeat when rendering outside its bounds
pub fn isRepeated(self: RenderTexture) bool {
return sf.c.sfRenderTexture_isRepeated(self._ptr) != 0;
}
/// Enables or disables texture repeating
pub fn setRepeated(self: *RenderTexture, repeated: bool) void {
sf.c.sfRenderTexture_setRepeated(self._ptr, @boolToInt(repeated));
}
/// Gets the size of this window
pub fn getSize(self: RenderTexture) sf.Vector2u {
return sf.Vector2u._fromCSFML(sf.c.sfRenderTexture_getSize(self._ptr));
}
// Target related stuff
/// Gets the current view of the target
/// Unlike in SFML, you don't get a const pointer but a copy
pub fn getView(self: RenderTexture) sf.View {
return sf.View._fromCSFML(sf.c.sfRenderTexture_getView(self._ptr).?);
}
/// Gets the default view of this target
/// Unlike in SFML, you don't get a const pointer but a copy
pub fn getDefaultView(self: RenderTexture) sf.View {
return sf.View._fromCSFML(sf.c.sfRenderTexture_getDefaultView(self._ptr).?);
}
/// Sets the view of this target
pub fn setView(self: *RenderTexture, view: sf.View) void {
var cview = view._toCSFML();
defer sf.c.sfView_destroy(cview);
sf.c.sfRenderTexture_setView(self._ptr, cview);
}
/// Gets the viewport of this target
pub fn getViewport(self: RenderTexture, view: sf.View) sf.IntRect {
return sf.IntRect._fromCSFML(sf.c.sfRenderTexture_getViewPort(self._ptr, view._ptr));
}
/// Convert a point from target coordinates to world coordinates, using the current view (or the specified view)
pub fn mapPixelToCoords(self: RenderTexture, pixel: sf.Vector2i, view: ?sf.View) sf.Vector2f {
if (view) |v| {
var cview = v._toCSFML();
defer sf.c.sfView_destroy(cview);
return sf.Vector2f._fromCSFML(sf.c.sfRenderTexture_mapPixelToCoords(self._ptr, pixel._toCSFML(), cview));
} else return sf.Vector2f._fromCSFML(sf.c.sfRenderTexture_mapPixelToCoords(self._ptr, pixel._toCSFML(), null));
}
/// Convert a point from world coordinates to target coordinates, using the current view (or the specified view)
pub fn mapCoordsToPixel(self: RenderTexture, coords: sf.Vector2f, view: ?sf.View) sf.Vector2i {
if (view) |v| {
var cview = v._toCSFML();
defer sf.c.sfView_destroy(cview);
return sf.Vector2i._fromCSFML(sf.c.sfRenderTexture_mapCoordsToPixel(self._ptr, coords._toCSFML(), cview));
} else return sf.Vector2i._fromCSFML(sf.c.sfRenderTexture_mapCoordsToPixel(self._ptr, coords._toCSFML(), null));
}
/// Pointer to the csfml structure
_ptr: *sf.c.sfRenderTexture,
test "rendertexture tests" {
const tst = @import("std").testing;
var rentex = try RenderTexture.create(.{ .x = 10, .y = 10 });
defer rentex.destroy();
rentex.setRepeated(true);
rentex.setSmooth(true);
rentex.clear(sf.Color.Red);
{
var rect = try sf.RectangleShape.create(.{ .x = 5, .y = 5 });
defer rect.destroy();
rect.setFillColor(sf.Color.Blue);
rentex.draw(rect, null);
}
rentex.display();
_ = rentex.generateMipmap();
try tst.expect(rentex.isRepeated());
try tst.expect(rentex.isSmooth());
const tex = rentex.getTexture();
try tst.expectEqual(sf.Vector2u{ .x = 10, .y = 10 }, tex.getSize());
try tst.expectEqual(sf.Vector2u{ .x = 10, .y = 10 }, rentex.getSize());
var img = tex.copyToImage();
defer img.destroy();
try tst.expectEqual(sf.Color.Blue, img.getPixel(.{ .x = 1, .y = 1 }));
try tst.expectEqual(sf.Color.Red, img.getPixel(.{ .x = 6, .y = 3 }));
} | src/sfml/graphics/RenderTexture.zig |
usingnamespace @import("root").preamble;
pub fn Bitset(num_bits: usize) type {
const num_bytes = libalign.alignUp(usize, 8, num_bits) / 8;
return struct {
pub fn set(self: *@This(), idx: usize) void {
data[idx / 8] |= (@as(u8, 1) << @intCast(u3, idx % 8));
}
pub fn unset(self: *@This(), idx: usize) void {
data[idx / 8] &= ~(@as(u8, 1) << @intCast(u3, idx % 8));
}
pub fn isSet(self: *const @This(), idx: usize) bool {
return (data[idx / 8] >> @intCast(u3, idx % 8)) == 1;
}
pub fn size(self: *const @This()) usize {
return num_bits;
}
var data = [_]u8{0} ** num_bytes;
};
}
const DynamicBitset = struct {
len: usize,
data: [*]u8,
pub fn sizeNeeded(len: usize) usize {
return libalign.alignUp(usize, 8, len) / 8;
}
pub fn init(len: usize, data: []u8) DynamicBitset {
std.debug.assert(data.len >= DynamicBitset.sizeNeeded(len));
for (data) |*cell| {
cell.* = 0;
}
return DynamicBitset{ .len = len, .data = data.ptr };
}
pub fn set(self: *@This(), idx: usize) void {
std.debug.assert(idx < self.len);
self.data[idx / 8] |= (@as(u8, 1) << @intCast(u3, idx % 8));
}
pub fn unset(self: *@This(), idx: usize) void {
std.debug.assert(idx < self.len);
self.data[idx / 8] &= ~(@as(u8, 1) << @intCast(u3, idx % 8));
}
pub fn isSet(self: *const @This(), idx: is_setusize) bool {
std.debug.assert(idx < self.len);
return (self.data[idx / 8] >> @intCast(u3, idx % 8)) == 1;
}
};
test "bitset" {
var bs: Bitset(8) = .{};
std.testing.expect(!bs.isSet(0));
bs.set(0);
std.testing.expect(bs.isSet(0));
bs.unset(0);
std.testing.expect(!bs.isSet(0));
}
test "dynamic bitset" {
var mem: [2]u8 = undefined;
var bs = DynamicBitset.init(16, &mem);
std.testing.expect(!bs.isSet(0));
bs.set(0);
std.testing.expect(bs.isSet(0));
bs.set(13);
bs.unset(0);
std.testing.expect(!bs.isSet(0));
std.testing.expect(bs.isSet(13));
} | lib/util/bitset.zig |
const std = @import("std");
const testing = std.testing;
pub const Tokenizer = struct {
arena: std.heap.ArenaAllocator,
index: usize,
bytes: []const u8,
error_text: []const u8,
state: State,
pub fn init(allocator: *std.mem.Allocator, bytes: []const u8) Tokenizer {
return Tokenizer{
.arena = std.heap.ArenaAllocator.init(allocator),
.index = 0,
.bytes = bytes,
.error_text = "",
.state = State{ .lhs = {} },
};
}
pub fn deinit(self: *Tokenizer) void {
self.arena.deinit();
}
pub fn next(self: *Tokenizer) Error!?Token {
while (self.index < self.bytes.len) {
const char = self.bytes[self.index];
while (true) {
switch (self.state) {
.lhs => switch (char) {
'\t', '\n', '\r', ' ' => {
// silently ignore whitespace
break; // advance
},
else => {
self.state = State{ .target = try std.ArrayListSentineled(u8, 0).initSize(&self.arena.allocator, 0) };
},
},
.target => |*target| switch (char) {
'\t', '\n', '\r', ' ' => {
return self.errorIllegalChar(self.index, char, "invalid target", .{});
},
'$' => {
self.state = State{ .target_dollar_sign = target.* };
break; // advance
},
'\\' => {
self.state = State{ .target_reverse_solidus = target.* };
break; // advance
},
':' => {
self.state = State{ .target_colon = target.* };
break; // advance
},
else => {
try target.append(char);
break; // advance
},
},
.target_reverse_solidus => |*target| switch (char) {
'\t', '\n', '\r' => {
return self.errorIllegalChar(self.index, char, "bad target escape", .{});
},
' ', '#', '\\' => {
try target.append(char);
self.state = State{ .target = target.* };
break; // advance
},
'$' => {
try target.appendSlice(self.bytes[self.index - 1 .. self.index]);
self.state = State{ .target_dollar_sign = target.* };
break; // advance
},
else => {
try target.appendSlice(self.bytes[self.index - 1 .. self.index + 1]);
self.state = State{ .target = target.* };
break; // advance
},
},
.target_dollar_sign => |*target| switch (char) {
'$' => {
try target.append(char);
self.state = State{ .target = target.* };
break; // advance
},
else => {
return self.errorIllegalChar(self.index, char, "expecting '$'", .{});
},
},
.target_colon => |*target| switch (char) {
'\n', '\r' => {
const bytes = target.span();
if (bytes.len != 0) {
self.state = State{ .lhs = {} };
return Token{ .id = .target, .bytes = bytes };
}
// silently ignore null target
self.state = State{ .lhs = {} };
continue;
},
'\\' => {
self.state = State{ .target_colon_reverse_solidus = target.* };
break; // advance
},
else => {
const bytes = target.span();
if (bytes.len != 0) {
self.state = State{ .rhs = {} };
return Token{ .id = .target, .bytes = bytes };
}
// silently ignore null target
self.state = State{ .lhs = {} };
continue;
},
},
.target_colon_reverse_solidus => |*target| switch (char) {
'\n', '\r' => {
const bytes = target.span();
if (bytes.len != 0) {
self.state = State{ .lhs = {} };
return Token{ .id = .target, .bytes = bytes };
}
// silently ignore null target
self.state = State{ .lhs = {} };
continue;
},
else => {
try target.appendSlice(self.bytes[self.index - 2 .. self.index + 1]);
self.state = State{ .target = target.* };
break;
},
},
.rhs => switch (char) {
'\t', ' ' => {
// silently ignore horizontal whitespace
break; // advance
},
'\n', '\r' => {
self.state = State{ .lhs = {} };
continue;
},
'\\' => {
self.state = State{ .rhs_continuation = {} };
break; // advance
},
'"' => {
self.state = State{ .prereq_quote = try std.ArrayListSentineled(u8, 0).initSize(&self.arena.allocator, 0) };
break; // advance
},
else => {
self.state = State{ .prereq = try std.ArrayListSentineled(u8, 0).initSize(&self.arena.allocator, 0) };
},
},
.rhs_continuation => switch (char) {
'\n' => {
self.state = State{ .rhs = {} };
break; // advance
},
'\r' => {
self.state = State{ .rhs_continuation_linefeed = {} };
break; // advance
},
else => {
return self.errorIllegalChar(self.index, char, "continuation expecting end-of-line", .{});
},
},
.rhs_continuation_linefeed => switch (char) {
'\n' => {
self.state = State{ .rhs = {} };
break; // advance
},
else => {
return self.errorIllegalChar(self.index, char, "continuation expecting end-of-line", .{});
},
},
.prereq_quote => |*prereq| switch (char) {
'"' => {
const bytes = prereq.span();
self.index += 1;
self.state = State{ .rhs = {} };
return Token{ .id = .prereq, .bytes = bytes };
},
else => {
try prereq.append(char);
break; // advance
},
},
.prereq => |*prereq| switch (char) {
'\t', ' ' => {
const bytes = prereq.span();
self.state = State{ .rhs = {} };
return Token{ .id = .prereq, .bytes = bytes };
},
'\n', '\r' => {
const bytes = prereq.span();
self.state = State{ .lhs = {} };
return Token{ .id = .prereq, .bytes = bytes };
},
'\\' => {
self.state = State{ .prereq_continuation = prereq.* };
break; // advance
},
else => {
try prereq.append(char);
break; // advance
},
},
.prereq_continuation => |*prereq| switch (char) {
'\n' => {
const bytes = prereq.span();
self.index += 1;
self.state = State{ .rhs = {} };
return Token{ .id = .prereq, .bytes = bytes };
},
'\r' => {
self.state = State{ .prereq_continuation_linefeed = prereq.* };
break; // advance
},
else => {
// not continuation
try prereq.appendSlice(self.bytes[self.index - 1 .. self.index + 1]);
self.state = State{ .prereq = prereq.* };
break; // advance
},
},
.prereq_continuation_linefeed => |prereq| switch (char) {
'\n' => {
const bytes = prereq.span();
self.index += 1;
self.state = State{ .rhs = {} };
return Token{ .id = .prereq, .bytes = bytes };
},
else => {
return self.errorIllegalChar(self.index, char, "continuation expecting end-of-line", .{});
},
},
}
}
self.index += 1;
}
// eof, handle maybe incomplete token
if (self.index == 0) return null;
const idx = self.index - 1;
switch (self.state) {
.lhs,
.rhs,
.rhs_continuation,
.rhs_continuation_linefeed,
=> {},
.target => |target| {
return self.errorPosition(idx, target.span(), "incomplete target", .{});
},
.target_reverse_solidus,
.target_dollar_sign,
=> {
const index = self.index - 1;
return self.errorIllegalChar(idx, self.bytes[idx], "incomplete escape", .{});
},
.target_colon => |target| {
const bytes = target.span();
if (bytes.len != 0) {
self.index += 1;
self.state = State{ .rhs = {} };
return Token{ .id = .target, .bytes = bytes };
}
// silently ignore null target
self.state = State{ .lhs = {} };
},
.target_colon_reverse_solidus => |target| {
const bytes = target.span();
if (bytes.len != 0) {
self.index += 1;
self.state = State{ .rhs = {} };
return Token{ .id = .target, .bytes = bytes };
}
// silently ignore null target
self.state = State{ .lhs = {} };
},
.prereq_quote => |prereq| {
return self.errorPosition(idx, prereq.span(), "incomplete quoted prerequisite", .{});
},
.prereq => |prereq| {
const bytes = prereq.span();
self.state = State{ .lhs = {} };
return Token{ .id = .prereq, .bytes = bytes };
},
.prereq_continuation => |prereq| {
const bytes = prereq.span();
self.state = State{ .lhs = {} };
return Token{ .id = .prereq, .bytes = bytes };
},
.prereq_continuation_linefeed => |prereq| {
const bytes = prereq.span();
self.state = State{ .lhs = {} };
return Token{ .id = .prereq, .bytes = bytes };
},
}
return null;
}
fn errorf(self: *Tokenizer, comptime fmt: []const u8, args: var) Error {
self.error_text = try std.fmt.allocPrintZ(&self.arena.allocator, fmt, args);
return Error.InvalidInput;
}
fn errorPosition(self: *Tokenizer, position: usize, bytes: []const u8, comptime fmt: []const u8, args: var) Error {
var buffer = try std.ArrayListSentineled(u8, 0).initSize(&self.arena.allocator, 0);
try buffer.outStream().print(fmt, args);
try buffer.appendSlice(" '");
var out = makeOutput(std.ArrayListSentineled(u8, 0).appendSlice, &buffer);
try printCharValues(&out, bytes);
try buffer.appendSlice("'");
try buffer.outStream().print(" at position {}", .{position - (bytes.len - 1)});
self.error_text = buffer.span();
return Error.InvalidInput;
}
fn errorIllegalChar(self: *Tokenizer, position: usize, char: u8, comptime fmt: []const u8, args: var) Error {
var buffer = try std.ArrayListSentineled(u8, 0).initSize(&self.arena.allocator, 0);
try buffer.appendSlice("illegal char ");
try printUnderstandableChar(&buffer, char);
try buffer.outStream().print(" at position {}", .{position});
if (fmt.len != 0) try buffer.outStream().print(": " ++ fmt, args);
self.error_text = buffer.span();
return Error.InvalidInput;
}
const Error = error{
OutOfMemory,
InvalidInput,
};
const State = union(enum) {
lhs: void,
target: std.ArrayListSentineled(u8, 0),
target_reverse_solidus: std.ArrayListSentineled(u8, 0),
target_dollar_sign: std.ArrayListSentineled(u8, 0),
target_colon: std.ArrayListSentineled(u8, 0),
target_colon_reverse_solidus: std.ArrayListSentineled(u8, 0),
rhs: void,
rhs_continuation: void,
rhs_continuation_linefeed: void,
prereq_quote: std.ArrayListSentineled(u8, 0),
prereq: std.ArrayListSentineled(u8, 0),
prereq_continuation: std.ArrayListSentineled(u8, 0),
prereq_continuation_linefeed: std.ArrayListSentineled(u8, 0),
};
const Token = struct {
id: ID,
bytes: []const u8,
const ID = enum {
target,
prereq,
};
};
};
test "empty file" {
try depTokenizer("", "");
}
test "empty whitespace" {
try depTokenizer("\n", "");
try depTokenizer("\r", "");
try depTokenizer("\r\n", "");
try depTokenizer(" ", "");
}
test "empty colon" {
try depTokenizer(":", "");
try depTokenizer("\n:", "");
try depTokenizer("\r:", "");
try depTokenizer("\r\n:", "");
try depTokenizer(" :", "");
}
test "empty target" {
try depTokenizer("foo.o:", "target = {foo.o}");
try depTokenizer(
\\foo.o:
\\bar.o:
\\abcd.o:
,
\\target = {foo.o}
\\target = {bar.o}
\\target = {abcd.o}
);
}
test "whitespace empty target" {
try depTokenizer("\nfoo.o:", "target = {foo.o}");
try depTokenizer("\rfoo.o:", "target = {foo.o}");
try depTokenizer("\r\nfoo.o:", "target = {foo.o}");
try depTokenizer(" foo.o:", "target = {foo.o}");
}
test "escape empty target" {
try depTokenizer("\\ foo.o:", "target = { foo.o}");
try depTokenizer("\\#foo.o:", "target = {#foo.o}");
try depTokenizer("\\\\foo.o:", "target = {\\foo.o}");
try depTokenizer("$$foo.o:", "target = {$foo.o}");
}
test "empty target linefeeds" {
try depTokenizer("\n", "");
try depTokenizer("\r\n", "");
const expect = "target = {foo.o}";
try depTokenizer(
\\foo.o:
, expect);
try depTokenizer(
\\foo.o:
\\
, expect);
try depTokenizer(
\\foo.o:
, expect);
try depTokenizer(
\\foo.o:
\\
, expect);
}
test "empty target linefeeds + continuations" {
const expect = "target = {foo.o}";
try depTokenizer(
\\foo.o:\
, expect);
try depTokenizer(
\\foo.o:\
\\
, expect);
try depTokenizer(
\\foo.o:\
, expect);
try depTokenizer(
\\foo.o:\
\\
, expect);
}
test "empty target linefeeds + hspace + continuations" {
const expect = "target = {foo.o}";
try depTokenizer(
\\foo.o: \
, expect);
try depTokenizer(
\\foo.o: \
\\
, expect);
try depTokenizer(
\\foo.o: \
, expect);
try depTokenizer(
\\foo.o: \
\\
, expect);
}
test "prereq" {
const expect =
\\target = {foo.o}
\\prereq = {foo.c}
;
try depTokenizer("foo.o: foo.c", expect);
try depTokenizer(
\\foo.o: \
\\foo.c
, expect);
try depTokenizer(
\\foo.o: \
\\ foo.c
, expect);
try depTokenizer(
\\foo.o: \
\\ foo.c
, expect);
}
test "prereq continuation" {
const expect =
\\target = {foo.o}
\\prereq = {foo.h}
\\prereq = {bar.h}
;
try depTokenizer(
\\foo.o: foo.h\
\\bar.h
, expect);
try depTokenizer(
\\foo.o: foo.h\
\\bar.h
, expect);
}
test "multiple prereqs" {
const expect =
\\target = {foo.o}
\\prereq = {foo.c}
\\prereq = {foo.h}
\\prereq = {bar.h}
;
try depTokenizer("foo.o: foo.c foo.h bar.h", expect);
try depTokenizer(
\\foo.o: \
\\foo.c foo.h bar.h
, expect);
try depTokenizer(
\\foo.o: foo.c foo.h bar.h\
, expect);
try depTokenizer(
\\foo.o: foo.c foo.h bar.h\
\\
, expect);
try depTokenizer(
\\foo.o: \
\\foo.c \
\\ foo.h\
\\bar.h
\\
, expect);
try depTokenizer(
\\foo.o: \
\\foo.c \
\\ foo.h\
\\bar.h\
\\
, expect);
try depTokenizer(
\\foo.o: \
\\foo.c \
\\ foo.h\
\\bar.h\
, expect);
}
test "multiple targets and prereqs" {
try depTokenizer(
\\foo.o: foo.c
\\bar.o: bar.c a.h b.h c.h
\\abc.o: abc.c \
\\ one.h two.h \
\\ three.h four.h
,
\\target = {foo.o}
\\prereq = {foo.c}
\\target = {bar.o}
\\prereq = {bar.c}
\\prereq = {a.h}
\\prereq = {b.h}
\\prereq = {c.h}
\\target = {abc.o}
\\prereq = {abc.c}
\\prereq = {one.h}
\\prereq = {two.h}
\\prereq = {three.h}
\\prereq = {four.h}
);
try depTokenizer(
\\ascii.o: ascii.c
\\base64.o: base64.c stdio.h
\\elf.o: elf.c a.h b.h c.h
\\macho.o: \
\\ macho.c\
\\ a.h b.h c.h
,
\\target = {ascii.o}
\\prereq = {ascii.c}
\\target = {base64.o}
\\prereq = {base64.c}
\\prereq = {stdio.h}
\\target = {elf.o}
\\prereq = {elf.c}
\\prereq = {a.h}
\\prereq = {b.h}
\\prereq = {c.h}
\\target = {macho.o}
\\prereq = {macho.c}
\\prereq = {a.h}
\\prereq = {b.h}
\\prereq = {c.h}
);
try depTokenizer(
\\a$$scii.o: ascii.c
\\\\base64.o: "\base64.c" "s t#dio.h"
\\e\\lf.o: "e\lf.c" "a.h$$" "$$b.h c.h$$"
\\macho.o: \
\\ "macho!.c" \
\\ a.h b.h c.h
,
\\target = {a$scii.o}
\\prereq = {ascii.c}
\\target = {\base64.o}
\\prereq = {\base64.c}
\\prereq = {s t#dio.h}
\\target = {e\lf.o}
\\prereq = {e\lf.c}
\\prereq = {a.h$$}
\\prereq = {$$b.h c.h$$}
\\target = {macho.o}
\\prereq = {macho!.c}
\\prereq = {a.h}
\\prereq = {b.h}
\\prereq = {c.h}
);
}
test "windows quoted prereqs" {
try depTokenizer(
\\c:\foo.o: "C:\Program Files (x86)\Microsoft Visual Studio\foo.c"
\\c:\foo2.o: "C:\Program Files (x86)\Microsoft Visual Studio\foo2.c" \
\\ "C:\Program Files (x86)\Microsoft Visual Studio\foo1.h" \
\\ "C:\Program Files (x86)\Microsoft Visual Studio\foo2.h"
,
\\target = {c:\foo.o}
\\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\foo.c}
\\target = {c:\foo2.o}
\\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\foo2.c}
\\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\foo1.h}
\\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\foo2.h}
);
}
test "windows mixed prereqs" {
try depTokenizer(
\\cimport.o: \
\\ C:\msys64\home\anon\project\zig\master\zig-cache\o\qhvhbUo7GU5iKyQ5mpA8TcQpncCYaQu0wwvr3ybiSTj_Dtqi1Nmcb70kfODJ2Qlg\cimport.h \
\\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\stdio.h" \
\\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt.h" \
\\ "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vcruntime.h" \
\\ "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\sal.h" \
\\ "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\concurrencysal.h" \
\\ C:\msys64\opt\zig\lib\zig\include\vadefs.h \
\\ "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vadefs.h" \
\\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_wstdio.h" \
\\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_stdio_config.h" \
\\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\string.h" \
\\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_memory.h" \
\\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_memcpy_s.h" \
\\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\errno.h" \
\\ "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vcruntime_string.h" \
\\ "C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_wstring.h"
,
\\target = {cimport.o}
\\prereq = {C:\msys64\home\anon\project\zig\master\zig-cache\o\qhvhbUo7GU5iKyQ5mpA8TcQpncCYaQu0wwvr3ybiSTj_Dtqi1Nmcb70kfODJ2Qlg\cimport.h}
\\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\stdio.h}
\\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt.h}
\\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vcruntime.h}
\\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\sal.h}
\\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\concurrencysal.h}
\\prereq = {C:\msys64\opt\zig\lib\zig\include\vadefs.h}
\\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vadefs.h}
\\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_wstdio.h}
\\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_stdio_config.h}
\\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\string.h}
\\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_memory.h}
\\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_memcpy_s.h}
\\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\errno.h}
\\prereq = {C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.21.27702\lib\x64\\..\..\include\vcruntime_string.h}
\\prereq = {C:\Program Files (x86)\Windows Kits\10\\Include\10.0.17763.0\ucrt\corecrt_wstring.h}
);
}
test "funky targets" {
try depTokenizer(
\\C:\Users\anon\foo.o:
\\C:\Users\anon\foo\ .o:
\\C:\Users\anon\foo\#.o:
\\C:\Users\anon\foo$$.o:
\\C:\Users\anon\\\ foo.o:
\\C:\Users\anon\\#foo.o:
\\C:\Users\anon\$$foo.o:
\\C:\Users\anon\\\ \ \ \ \ foo.o:
,
\\target = {C:\Users\anon\foo.o}
\\target = {C:\Users\anon\foo .o}
\\target = {C:\Users\anon\foo#.o}
\\target = {C:\Users\anon\foo$.o}
\\target = {C:\Users\anon\ foo.o}
\\target = {C:\Users\anon\#foo.o}
\\target = {C:\Users\anon\$foo.o}
\\target = {C:\Users\anon\ foo.o}
);
}
test "error incomplete escape - reverse_solidus" {
try depTokenizer("\\",
\\ERROR: illegal char '\' at position 0: incomplete escape
);
try depTokenizer("\t\\",
\\ERROR: illegal char '\' at position 1: incomplete escape
);
try depTokenizer("\n\\",
\\ERROR: illegal char '\' at position 1: incomplete escape
);
try depTokenizer("\r\\",
\\ERROR: illegal char '\' at position 1: incomplete escape
);
try depTokenizer("\r\n\\",
\\ERROR: illegal char '\' at position 2: incomplete escape
);
try depTokenizer(" \\",
\\ERROR: illegal char '\' at position 1: incomplete escape
);
}
test "error incomplete escape - dollar_sign" {
try depTokenizer("$",
\\ERROR: illegal char '$' at position 0: incomplete escape
);
try depTokenizer("\t$",
\\ERROR: illegal char '$' at position 1: incomplete escape
);
try depTokenizer("\n$",
\\ERROR: illegal char '$' at position 1: incomplete escape
);
try depTokenizer("\r$",
\\ERROR: illegal char '$' at position 1: incomplete escape
);
try depTokenizer("\r\n$",
\\ERROR: illegal char '$' at position 2: incomplete escape
);
try depTokenizer(" $",
\\ERROR: illegal char '$' at position 1: incomplete escape
);
}
test "error incomplete target" {
try depTokenizer("foo.o",
\\ERROR: incomplete target 'foo.o' at position 0
);
try depTokenizer("\tfoo.o",
\\ERROR: incomplete target 'foo.o' at position 1
);
try depTokenizer("\nfoo.o",
\\ERROR: incomplete target 'foo.o' at position 1
);
try depTokenizer("\rfoo.o",
\\ERROR: incomplete target 'foo.o' at position 1
);
try depTokenizer("\r\nfoo.o",
\\ERROR: incomplete target 'foo.o' at position 2
);
try depTokenizer(" foo.o",
\\ERROR: incomplete target 'foo.o' at position 1
);
try depTokenizer("\\ foo.o",
\\ERROR: incomplete target ' foo.o' at position 1
);
try depTokenizer("\\#foo.o",
\\ERROR: incomplete target '#foo.o' at position 1
);
try depTokenizer("\\\\foo.o",
\\ERROR: incomplete target '\foo.o' at position 1
);
try depTokenizer("$$foo.o",
\\ERROR: incomplete target '$foo.o' at position 1
);
}
test "error illegal char at position - bad target escape" {
try depTokenizer("\\\t",
\\ERROR: illegal char \x09 at position 1: bad target escape
);
try depTokenizer("\\\n",
\\ERROR: illegal char \x0A at position 1: bad target escape
);
try depTokenizer("\\\r",
\\ERROR: illegal char \x0D at position 1: bad target escape
);
try depTokenizer("\\\r\n",
\\ERROR: illegal char \x0D at position 1: bad target escape
);
}
test "error illegal char at position - execting dollar_sign" {
try depTokenizer("$\t",
\\ERROR: illegal char \x09 at position 1: expecting '$'
);
try depTokenizer("$\n",
\\ERROR: illegal char \x0A at position 1: expecting '$'
);
try depTokenizer("$\r",
\\ERROR: illegal char \x0D at position 1: expecting '$'
);
try depTokenizer("$\r\n",
\\ERROR: illegal char \x0D at position 1: expecting '$'
);
}
test "error illegal char at position - invalid target" {
try depTokenizer("foo\t.o",
\\ERROR: illegal char \x09 at position 3: invalid target
);
try depTokenizer("foo\n.o",
\\ERROR: illegal char \x0A at position 3: invalid target
);
try depTokenizer("foo\r.o",
\\ERROR: illegal char \x0D at position 3: invalid target
);
try depTokenizer("foo\r\n.o",
\\ERROR: illegal char \x0D at position 3: invalid target
);
}
test "error target - continuation expecting end-of-line" {
try depTokenizer("foo.o: \\\t",
\\target = {foo.o}
\\ERROR: illegal char \x09 at position 8: continuation expecting end-of-line
);
try depTokenizer("foo.o: \\ ",
\\target = {foo.o}
\\ERROR: illegal char \x20 at position 8: continuation expecting end-of-line
);
try depTokenizer("foo.o: \\x",
\\target = {foo.o}
\\ERROR: illegal char 'x' at position 8: continuation expecting end-of-line
);
try depTokenizer("foo.o: \\\x0dx",
\\target = {foo.o}
\\ERROR: illegal char 'x' at position 9: continuation expecting end-of-line
);
}
test "error prereq - continuation expecting end-of-line" {
try depTokenizer("foo.o: foo.h\\\x0dx",
\\target = {foo.o}
\\ERROR: illegal char 'x' at position 14: continuation expecting end-of-line
);
}
// - tokenize input, emit textual representation, and compare to expect
fn depTokenizer(input: []const u8, expect: []const u8) !void {
var arena_allocator = std.heap.ArenaAllocator.init(std.heap.page_allocator);
const arena = &arena_allocator.allocator;
defer arena_allocator.deinit();
var it = Tokenizer.init(arena, input);
var buffer = try std.ArrayListSentineled(u8, 0).initSize(arena, 0);
var i: usize = 0;
while (true) {
const r = it.next() catch |err| {
switch (err) {
Tokenizer.Error.InvalidInput => {
if (i != 0) try buffer.appendSlice("\n");
try buffer.appendSlice("ERROR: ");
try buffer.appendSlice(it.error_text);
},
else => return err,
}
break;
};
const token = r orelse break;
if (i != 0) try buffer.appendSlice("\n");
try buffer.appendSlice(@tagName(token.id));
try buffer.appendSlice(" = {");
for (token.bytes) |b| {
try buffer.append(printable_char_tab[b]);
}
try buffer.appendSlice("}");
i += 1;
}
const got: []const u8 = buffer.span();
if (std.mem.eql(u8, expect, got)) {
testing.expect(true);
return;
}
var out = makeOutput(std.fs.File.write, try std.io.getStdErr());
try out.write("\n");
try printSection(&out, "<<<< input", input);
try printSection(&out, "==== expect", expect);
try printSection(&out, ">>>> got", got);
try printRuler(&out);
testing.expect(false);
}
fn printSection(out: var, label: []const u8, bytes: []const u8) !void {
try printLabel(out, label, bytes);
try hexDump(out, bytes);
try printRuler(out);
try out.write(bytes);
try out.write("\n");
}
fn printLabel(out: var, label: []const u8, bytes: []const u8) !void {
var buf: [80]u8 = undefined;
var text = try std.fmt.bufPrint(buf[0..], "{} {} bytes ", .{ label, bytes.len });
try out.write(text);
var i: usize = text.len;
const end = 79;
while (i < 79) : (i += 1) {
try out.write([_]u8{label[0]});
}
try out.write("\n");
}
fn printRuler(out: var) !void {
var i: usize = 0;
const end = 79;
while (i < 79) : (i += 1) {
try out.write("-");
}
try out.write("\n");
}
fn hexDump(out: var, bytes: []const u8) !void {
const n16 = bytes.len >> 4;
var line: usize = 0;
var offset: usize = 0;
while (line < n16) : (line += 1) {
try hexDump16(out, offset, bytes[offset .. offset + 16]);
offset += 16;
}
const n = bytes.len & 0x0f;
if (n > 0) {
try printDecValue(out, offset, 8);
try out.write(":");
try out.write(" ");
var end1 = std.math.min(offset + n, offset + 8);
for (bytes[offset..end1]) |b| {
try out.write(" ");
try printHexValue(out, b, 2);
}
var end2 = offset + n;
if (end2 > end1) {
try out.write(" ");
for (bytes[end1..end2]) |b| {
try out.write(" ");
try printHexValue(out, b, 2);
}
}
const short = 16 - n;
var i: usize = 0;
while (i < short) : (i += 1) {
try out.write(" ");
}
if (end2 > end1) {
try out.write(" |");
} else {
try out.write(" |");
}
try printCharValues(out, bytes[offset..end2]);
try out.write("|\n");
offset += n;
}
try printDecValue(out, offset, 8);
try out.write(":");
try out.write("\n");
}
fn hexDump16(out: var, offset: usize, bytes: []const u8) !void {
try printDecValue(out, offset, 8);
try out.write(":");
try out.write(" ");
for (bytes[0..8]) |b| {
try out.write(" ");
try printHexValue(out, b, 2);
}
try out.write(" ");
for (bytes[8..16]) |b| {
try out.write(" ");
try printHexValue(out, b, 2);
}
try out.write(" |");
try printCharValues(out, bytes);
try out.write("|\n");
}
fn printDecValue(out: var, value: u64, width: u8) !void {
var buffer: [20]u8 = undefined;
const len = std.fmt.formatIntBuf(buffer[0..], value, 10, false, width);
try out.write(buffer[0..len]);
}
fn printHexValue(out: var, value: u64, width: u8) !void {
var buffer: [16]u8 = undefined;
const len = std.fmt.formatIntBuf(buffer[0..], value, 16, false, width);
try out.write(buffer[0..len]);
}
fn printCharValues(out: var, bytes: []const u8) !void {
for (bytes) |b| {
try out.write(&[_]u8{printable_char_tab[b]});
}
}
fn printUnderstandableChar(buffer: *std.ArrayListSentineled(u8, 0), char: u8) !void {
if (!std.ascii.isPrint(char) or char == ' ') {
try buffer.outStream().print("\\x{X:2}", .{char});
} else {
try buffer.appendSlice("'");
try buffer.append(printable_char_tab[char]);
try buffer.appendSlice("'");
}
}
// zig fmt: off
const printable_char_tab: []const u8 =
"................................ !\"#$%&'()*+,-./0123456789:;<=>?" ++
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~." ++
"................................................................" ++
"................................................................";
// zig fmt: on
comptime {
std.debug.assert(printable_char_tab.len == 256);
}
// Make an output var that wraps a context and output function.
// output: must be a function that takes a `self` idiom parameter
// and a bytes parameter
// context: must be that self
fn makeOutput(comptime output: var, context: var) Output(output, @TypeOf(context)) {
return Output(output, @TypeOf(context)){
.context = context,
};
}
fn Output(comptime output_func: var, comptime Context: type) type {
return struct {
context: Context,
pub const output = output_func;
fn write(self: @This(), bytes: []const u8) !void {
try output_func(self.context, bytes);
}
};
} | src-self-hosted/dep_tokenizer.zig |
const std = @import("std");
const builtin = @import("builtin");
const zinput = @import("zinput");
const known_folders = @import("known-folders");
fn print(comptime fmt: []const u8, args: anytype) void {
const stdout = std.io.getStdOut().writer();
stdout.print(fmt, args) catch @panic("Could not write to stdout");
}
fn write(text: []const u8) void {
const stdout = std.io.getStdOut().writer();
stdout.writeAll(text) catch @panic("Could not write to stdout");
}
pub fn wizard(allocator: *std.mem.Allocator) !void {
@setEvalBranchQuota(2500);
write(
\\Welcome to the ZLS configuration wizard!
\\ *
\\ |\
\\ /* \
\\ | *\
\\ _/_*___|_ x
\\ | @ @ /
\\ @ \ /
\\ \__-/ /
\\
\\
);
var local_path = known_folders.getPath(allocator, .local_configuration) catch null;
var global_path = known_folders.getPath(allocator, .global_configuration) catch null;
defer if (local_path) |d| allocator.free(d);
defer if (global_path) |d| allocator.free(d);
if (global_path == null and local_path == null) {
write("Could not open a global or local config directory.\n");
return;
}
var config_path: []const u8 = undefined;
if (try zinput.askBool("Should this configuration be system-wide?")) {
if (global_path) |p| {
config_path = p;
} else {
write("Could not find a global config directory.\n");
return;
}
} else {
if (local_path) |p| {
config_path = p;
} else {
write("Could not find a local config directory.\n");
return;
}
}
var dir = std.fs.cwd().openDir(config_path, .{}) catch |err| {
print("Could not open {s}: {}.\n", .{ config_path, err });
return;
};
defer dir.close();
var file = dir.createFile("zls.json", .{}) catch |err| {
print("Could not create {s}/zls.json: {}.\n", .{ config_path, err });
return;
};
defer file.close();
const out = file.writer();
var zig_exe_path = try findZig(allocator);
defer if (zig_exe_path) |p| allocator.free(p);
if (zig_exe_path) |path| {
print("Found zig executable '{s}' in PATH.\n", .{path});
} else {
write("Could not find 'zig' in PATH\n");
zig_exe_path = try zinput.askString(allocator, if (builtin.os.tag == .windows)
\\What is the path to the 'zig' executable you would like to use?
\\Note that due to a bug in zig (https://github.com/ziglang/zig/issues/6044),
\\your zig directory cannot contain the '/' character.
else
"What is the path to the 'zig' executable you would like to use?", std.fs.MAX_PATH_BYTES);
}
const editor = try zinput.askSelectOne("Which code editor do you use?", enum { VSCode, Sublime, Kate, Neovim, Vim8, Emacs, Doom, Other });
const snippets = try zinput.askBool("Do you want to enable snippets?");
const style = try zinput.askBool("Do you want to enable style warnings?");
const semantic_tokens = try zinput.askBool("Do you want to enable semantic highlighting?");
const operator_completions = try zinput.askBool("Do you want to enable .* and .? completions?");
const include_at_in_builtins = switch (editor) {
.Sublime => true,
.VSCode, .Kate, .Neovim, .Vim8, .Emacs, .Doom => false,
else => try zinput.askBool("Should the @ sign be included in completions of builtin functions?\nChange this later if `@inc` completes to `include` or `@@include`"),
};
const max_detail_length: usize = switch (editor) {
.Sublime => 256,
else => 1024 * 1024,
};
std.debug.warn("Writing config to {s}/zls.json ... ", .{config_path});
try std.json.stringify(.{
.zig_exe_path = zig_exe_path,
.enable_snippets = snippets,
.warn_style = style,
.enable_semantic_tokens = semantic_tokens,
.operator_completions = operator_completions,
.include_at_in_builtins = include_at_in_builtins,
.max_detail_length = max_detail_length,
}, .{}, out);
write("successful.\n\n\n\n");
// Keep synced with README.md
switch (editor) {
.VSCode => {
write(
\\To use ZLS in Visual Studio Code, install the 'ZLS for VSCode' extension from
\\'https://github.com/zigtools/zls-vscode/releases' or via the extensions menu.
\\Then, open VSCode's 'settings.json' file, and add:
\\
\\"zigLanguageClient.path": "[command_or_path_to_zls]"
);
},
.Sublime => {
write(
\\To use ZLS in Sublime, install the `LSP` package from
\\https://github.com/sublimelsp/LSP/releases or via Package Control.
\\Then, add the following snippet to LSP's user settings:
\\
\\For Sublime Text 3:
\\
\\{
\\ "clients": {
\\ "zig": {
\\ "command": ["zls"],
\\ "enabled": true,
\\ "languageId": "zig",
\\ "scopes": ["source.zig"],
\\ "syntaxes": ["Packages/Zig Language/Syntaxes/Zig.tmLanguage"]
\\ }
\\ }
\\}
\\
\\For Sublime Text 4:
\\
\\{
\\ "clients": {
\\ "zig": {
\\ "command": ["zls"],
\\ "enabled": true,
\\ "selector": "source.zig"
\\ }
\\ }
\\}
);
},
.Kate => {
write(
\\To use ZLS in Kate, enable `LSP client` plugin in Kate settings.
\\Then, add the following snippet to `LSP client's` user settings:
\\(or paste it in `LSP client's` GUI settings)
\\
\\{
\\ "servers": {
\\ "zig": {
\\ "command": ["zls"],
\\ "url": "https://github.com/zigtools/zls",
\\ "highlightingModeRegex": "^Zig$"
\\ }
\\ }
\\}
);
},
.Neovim, .Vim8 => {
write(
\\To use ZLS in Neovim/Vim8, we recommend using CoC engine.
\\You can get it from https://github.com/neoclide/coc.nvim.
\\Then, simply issue cmd from Neovim/Vim8 `:CocConfig`, and add this to your CoC config:
\\
\\{
\\ "languageserver": {
\\ "zls" : {
\\ "command": "command_or_path_to_zls",
\\ "filetypes": ["zig"]
\\ }
\\ }
\\}
);
},
.Emacs => {
write(
\\To use ZLS in Emacs, install lsp-mode (https://github.com/emacs-lsp/lsp-mode) from melpa.
\\Zig mode (https://github.com/ziglang/zig-mode) is also useful!
\\Then, add the following to your emacs config:
\\
\\(require 'lsp-mode)
\\(setq lsp-zig-zls-executable "<path to zls>")
);
},
.Doom => {
write(
\\To use ZLS in Doom Emacs, enable the lsp module
\\And install the `zig-mode` (https://github.com/ziglang/zig-mode)
\\package by adding `(package! zig-mode)` to your packages.el file.
\\
\\(use-package! zig-mode
\\ :hook ((zig-mode . lsp-deferred))
\\ :custom (zig-format-on-save nil)
\\ :config
\\ (after! lsp-mode
\\ (add-to-list 'lsp-language-id-configuration '(zig-mode . "zig"))
\\ (lsp-register-client
\\ (make-lsp-client
\\ :new-connection (lsp-stdio-connection "<path to zls>")
\\ :major-modes '(zig-mode)
\\ :server-id 'zls))))
);
},
.Other => {
write(
\\We might not *officially* support your editor, but you can definitely still use ZLS!
\\Simply configure your editor for use with language servers and point it to the ZLS executable!
);
},
}
write("\n\nThank you for choosing ZLS!\n");
}
pub fn findZig(allocator: *std.mem.Allocator) !?[]const u8 {
const env_path = std.process.getEnvVarOwned(allocator, "PATH") catch |err| switch (err) {
error.EnvironmentVariableNotFound => {
return null;
},
else => return err,
};
defer allocator.free(env_path);
const exe_extension = builtin.target.exeFileExt();
const zig_exe = try std.fmt.allocPrint(allocator, "zig{s}", .{exe_extension});
defer allocator.free(zig_exe);
var it = std.mem.tokenize(u8, env_path, &[_]u8{std.fs.path.delimiter});
while (it.next()) |path| {
if (builtin.os.tag == .windows) {
if (std.mem.indexOfScalar(u8, path, '/') != null) continue;
}
const full_path = try std.fs.path.join(allocator, &[_][]const u8{ path, zig_exe });
defer allocator.free(full_path);
if (!std.fs.path.isAbsolute(full_path)) continue;
const file = std.fs.openFileAbsolute(full_path, .{}) catch continue;
defer file.close();
const stat = file.stat() catch continue;
if (stat.kind == .Directory) continue;
return try allocator.dupe(u8, full_path);
}
return null;
} | src/setup.zig |
const std = @import("std");
/// A discontiguous list made of blocks of contiguous elements.
///
/// Each block takes a single allocation from the underlying allocator
/// and is doubly-linked to the blocks next to it.
///
/// When the current block is full, an attempt will be made to expand it
/// in place before creating a new block.
///
/// This list is very memory efficient at the cost of making random access O(n)
/// where n is the number of "blocks". However iteration through the list
/// is still O(1).
///
pub fn BlockList(comptime T: type, comptime options: struct {
getAllocElementLen: fn () usize = defaultGetAllocElementLen,
}) type {
return struct {
const BlockQueue = std.TailQueue(struct {
alloc_len: usize,
element_count: usize,
});
const BlockNode = BlockQueue.Node;
const elements_offset = @sizeOf(BlockNode) + alignPadding(BlockNode, T);
allocator: *std.mem.Allocator,
block_queue: BlockQueue = .{},
pub fn deinit(self: *@This()) void {
var it = self.block_queue.last;
while (it) |block_node| {
it = block_node.prev; // do before calling free
self.allocator.free(getAllocSlice(block_node));
}
}
fn getAllocSlice(block_node: *BlockNode) []u8 {
return @ptrCast([*]u8, block_node)[0 .. block_node.data.alloc_len];
}
fn getElementPtr(block_node: *BlockNode) [*]T {
return @intToPtr([*]T, @ptrToInt(block_node) + elements_offset);
}
fn getElementSlice(block_node: *BlockNode) []T {
const ptr = getElementPtr(block_node);
const byte_len = block_node.data.alloc_len - elements_offset;
return ptr[0.. (@divTrunc(byte_len, @sizeOf(T))) ];
}
fn allocBlock(self: *@This(), first_element: T) !void {
const alloc_element_len = options.getAllocElementLen();
std.debug.assert(alloc_element_len > 0);
const alloc_len = elements_offset + (alloc_element_len * @sizeOf(T));
const block_mem = @alignCast(
@alignOf(BlockNode),
try self.allocator.allocFn(
self.allocator,
alloc_len,
@alignOf(BlockNode),
1,
@returnAddress()
)
);
//errdefer allocator.free(block_mem);
const block_node = @ptrCast(*BlockNode, block_mem);
block_node.* = BlockNode { .data = .{
.alloc_len = block_mem.len,
.element_count = 1,
}};
const elements = getElementSlice(block_node);
std.debug.assert(elements.len >= alloc_element_len);
elements[0] = first_element;
self.block_queue.append(block_node);
}
pub fn isEmpty(self: @This()) bool {
return self.block_queue.len == 0;
}
pub fn append(self: *@This(), element: T) !void {
if (self.block_queue.last) |last| {
const elements = getElementSlice(last);
if (last.data.element_count < elements.len) {
elements.ptr[last.data.element_count] = element;
last.data.element_count += 1;
return;
}
// TODO: try to realloc the block!
// this could minimize overhead by reducing allocation count
}
try self.allocBlock(element);
}
pub fn iterator(self: *const @This()) Iterator {
return Iterator.init(self.block_queue.first);
}
pub const Iterator = struct {
block_node: ?*BlockNode,
index: usize = 0,
pub fn init(first_block_node: ?*BlockNode) Iterator {
var result = Iterator { .block_node = first_block_node };
result.toNextNode();
return result;
}
fn toNextNode(it: *Iterator) void {
while (true) {
const block_node = it.block_node orelse return;
if (it.index < block_node.data.element_count) {
return;
}
it.block_node = block_node.next;
it.index = 0;
}
}
pub fn front(it: *Iterator) ?T {
if (it.block_node) |block_node| {
std.debug.assert(it.index < block_node.data.element_count);
return getElementSlice(block_node)[it.index];
}
return null;
}
pub fn next(it: *Iterator) ?T {
if (it.block_node) |block_node| {
std.debug.assert(it.index < block_node.data.element_count);
var result = getElementSlice(block_node)[it.index];
it.index += 1;
if (it.index >= block_node.data.element_count) {
it.block_node = block_node.next;
it.index = 0;
it.toNextNode();
}
return result;
}
return null;
}
};
};
}
test {
{
var b = BlockList(usize, .{}) { .allocator = std.testing.allocator };
defer b.deinit();
{
var i: usize = 0;
while (i < 100) : (i += 1) {
try b.append(i);
}
}
{
var i: usize = 0;
var it = b.iterator();
i = 0;
while (i < 100) : (i += 1) {
try std.testing.expectEqual(i, it.front().?);
try std.testing.expectEqual(i, it.next().?);
}
try std.testing.expectEqual(@as(?usize, null), it.front());
try std.testing.expectEqual(@as(?usize, null), it.next());
}
}
}
pub fn defaultGetAllocElementLen() usize {
return 300;
}
// The amount of padding needed to align `NextType` if it appears after `FirstType`
fn alignPadding(comptime FirstType: type, comptime NextType: type) usize {
if (@alignOf(FirstType) > @sizeOf(FirstType)) {
@compileError("not sure what to do in this case, see https://github.com/ziglang/zig/issues/9588");
}
if (@alignOf(NextType) <= @alignOf(FirstType)) {
comptime {
// sanity check
std.debug.assert(@alignOf(FirstType) % @alignOf(NextType) == 0);
}
return 0;
}
return @alignOf(NextType) - @alignOf(FirstType);
} | src/block_list.zig |
const std = @import("std");
const print = std.debug.print;
const data = @embedFile("../data/day17.txt");
pub fn main() !void {
var timer = try std.time.Timer.start();
print("🎁 Max Height: {}\n", .{try highestY(data)});
print("Day 17 - part 01 took {:15}ns\n", .{timer.lap()});
timer.reset();
print("🎁 Total velocities: {}\n", .{try totalVelocities(data)});
print("Day 17 - part 02 took {:15}ns\n", .{timer.lap()});
print("❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️❄️\n", .{});
}
fn highestY(input : []const u8) !i32 {
const startSkip = "target area: x=";
const removePrefix = input[startSkip.len..input.len];
var iterator = std.mem.tokenize(removePrefix, ".,y= \r\n");
var xLo = try std.fmt.parseInt(i32, iterator.next().?, 10);
var xHi = try std.fmt.parseInt(i32, iterator.next().?, 10);
var yLo = try std.fmt.parseInt(i32, iterator.next().?, 10);
var yHi = try std.fmt.parseInt(i32, iterator.next().?, 10);
var bestMaxHeight : i32 = std.math.minInt(i32);
const maxXVelocityWeWillConsider : i32 = xHi + 1;
const maxYVelocityWeWillConsider : i32 = 200;
var yStartVel : i32 = 0;
while (yStartVel < maxYVelocityWeWillConsider) : (yStartVel += 1) {
var xStartVel : i32 = 0;
while (xStartVel < maxXVelocityWeWillConsider) : (xStartVel += 1) {
var xPos : i32 = 0;
var yPos : i32 = 0;
var xVel = xStartVel;
var yVel = yStartVel;
var maxHeight : i32 = std.math.minInt(i32);
while (true) {
// The probe's x position increases by its x velocity.
xPos += xVel;
// The probe's y position increases by its y velocity.
yPos += yVel;
maxHeight = std.math.max(maxHeight, yPos);
// Due to drag, the probe's x velocity changes by 1 toward the value 0;
// that is, it decreases by 1 if it is greater than 0, increases by 1 if
// it is less than 0, or does not change if it is already 0.
if (xVel > 0) {
xVel -= 1;
} else if (xVel < 0) {
xVel += 1;
}
// Due to gravity, the probe's y velocity decreases by 1.
yVel -= 1;
// Detect if we've overshot the target area.
if ((xPos > xHi) or (yPos < yLo)) {
break;
}
// We now detect whether our position was in the target.
if ((xPos >= xLo) and
(xPos <= xHi) and
(yPos >= yLo) and
(yPos <= yHi)) {
bestMaxHeight = std.math.max(bestMaxHeight, maxHeight);
break;
}
}
}
}
return bestMaxHeight;
}
fn totalVelocities(input : []const u8) !u32 {
const startSkip = "target area: x=";
const removePrefix = input[startSkip.len..input.len];
var iterator = std.mem.tokenize(removePrefix, ".,y= \r\n");
var xLo = try std.fmt.parseInt(i32, iterator.next().?, 10);
var xHi = try std.fmt.parseInt(i32, iterator.next().?, 10);
var yLo = try std.fmt.parseInt(i32, iterator.next().?, 10);
var yHi = try std.fmt.parseInt(i32, iterator.next().?, 10);
var total : u32 = 0;
const maxXVelocityWeWillConsider : i32 = xHi + 1;
const maxYVelocityWeWillConsider : i32 = 200;
var yStartVel : i32 = -maxYVelocityWeWillConsider;
while (yStartVel < maxYVelocityWeWillConsider) : (yStartVel += 1) {
var xStartVel : i32 = 0;
while (xStartVel < maxXVelocityWeWillConsider) : (xStartVel += 1) {
var xPos : i32 = 0;
var yPos : i32 = 0;
var xVel = xStartVel;
var yVel = yStartVel;
while (true) {
// The probe's x position increases by its x velocity.
xPos += xVel;
// The probe's y position increases by its y velocity.
yPos += yVel;
// Due to drag, the probe's x velocity changes by 1 toward the value 0;
// that is, it decreases by 1 if it is greater than 0, increases by 1 if
// it is less than 0, or does not change if it is already 0.
if (xVel > 0) {
xVel -= 1;
} else if (xVel < 0) {
xVel += 1;
}
// Due to gravity, the probe's y velocity decreases by 1.
yVel -= 1;
// Detect if we've overshot the target area.
if ((xPos > xHi) or (yPos < yLo)) {
break;
}
// We now detect whether our position was in the target.
if ((xPos >= xLo) and
(xPos <= xHi) and
(yPos >= yLo) and
(yPos <= yHi)) {
total += 1;
break;
}
}
}
}
return total;
}
test "example_part1" {
const input = "target area: x=20..30, y=-10..-5";
var result = try highestY(input);
try std.testing.expect(result == 45);
}
test "example_part2" {
const input = "target area: x=20..30, y=-10..-5";
var result = try totalVelocities(input);
try std.testing.expect(result == 112);
} | src/day17.zig |
const std = @import("std");
const assert = std.debug.assert;
const wren = @import("./wren.zig");
const Vm = @import("./vm.zig").Vm;
const Configuration = @import("./vm.zig").Configuration;
const ErrorType = @import("./vm.zig").ErrorType;
const WrenError = @import("./error.zig").WrenError;
const EmptyUserData = struct {};
const testing = std.testing;
/// Handle for method call receivers. Pretty much just a fancy wrapper around wrenGetVariable/WrenHandle.
pub const Receiver = struct {
const Self = @This();
vm: *Vm,
module: []const u8,
handle: *wren.Handle,
pub fn init(vm: *Vm, module: []const u8, name: []const u8) Self {
const slot_index = 0;
vm.ensureSlots(1);
vm.getVariable(module, name, slot_index);
const handle = vm.getSlot(*wren.Handle, 0);
return Self{ .vm = vm, .module = module, .handle = handle };
}
pub fn deinit(self: Self) void {
wren.releaseHandle(self.vm.vm, self.handle);
}
pub fn setSlot(self: Self, slot_index: u32) void {
self.vm.setSlotHandle(0, self.handle);
}
};
fn printError(vm: *Vm, error_type: ErrorType, module: ?[]const u8, line: ?u32, message: []const u8) void {
std.debug.print("error_type={}, module={}, line={}, message={}\n", .{ error_type, module, line, message });
}
fn print(vm: *Vm, msg: []const u8) void {
std.debug.print("{}", .{msg});
}
test "can create receiver" {
var config = Configuration{};
config.errorFn = printError;
config.writeFn = print;
var vm: Vm = undefined;
try config.newVmInPlace(EmptyUserData, &vm, null);
try vm.interpret("test",
\\class Foo {
\\}
);
_ = vm.makeReceiver("test", "Foo");
}
/// Handle for methods of any kind. Even free-standing functions in wren are just calling `call()` on a function object.
pub const CallHandle = struct {
const Self = @This();
vm: *Vm,
handle: *wren.Handle,
pub fn init(vm: *Vm, method: []const u8) Self {
const slot_index = 0;
vm.ensureSlots(1);
const handle = wren.makeCallHandle(vm.vm, @ptrCast([*c]const u8, method));
assert(handle != null);
return Self{
.vm = vm,
.handle = @ptrCast(*wren.Handle, handle),
};
}
pub fn deinit(self: Self) void {
wren.releaseHandle(self.vm.vm, self.handle);
}
pub fn call(self: Self) !void {
const res = wren.call(self.vm.vm, self.handle);
if (res == .WREN_RESULT_COMPILE_ERROR) {
return WrenError.CompileError;
}
if (res == .WREN_RESULT_RUNTIME_ERROR) {
return WrenError.RuntimeError;
}
}
};
pub fn Method(comptime Ret: anytype, comptime Args: anytype) type {
if (@typeInfo(@TypeOf(Args)) != .Struct or (@typeInfo(@TypeOf(Args)) == .Struct and !@typeInfo(@TypeOf(Args)).Struct.is_tuple)) {
@compileError("call argument types must be passed as a tuple");
}
return struct {
const Self = @This();
receiver: Receiver,
call_handle: CallHandle,
pub fn init(receiver: Receiver, call_handle: CallHandle) Self {
return Self{ .receiver = receiver, .call_handle = call_handle };
}
pub fn call(self: Self, args: anytype) !Ret {
if (@typeInfo(@TypeOf(args)) != .Struct or (@typeInfo(@TypeOf(args)) == .Struct and !@typeInfo(@TypeOf(args)).Struct.is_tuple)) {
@compileError("call arguments must be passed as a tuple");
}
assert(args.len == Args.len);
const vm = self.receiver.vm;
vm.ensureSlots(Args.len + 1);
self.receiver.setSlot(0);
comptime var slot_index: u32 = 1;
inline for (Args) |Arg| {
vm.setSlot(slot_index, args[slot_index - 1]);
slot_index += 1;
}
try self.call_handle.call();
if (Ret != void) {
return vm.getSlot(Ret, 0);
}
}
};
}
test "call a free function" {
var config = Configuration{};
config.errorFn = printError;
config.writeFn = print;
var vm: Vm = undefined;
try config.newVmInPlace(EmptyUserData, &vm, null);
defer vm.deinit();
try vm.interpret("test",
\\var add = Fn.new { |a, b|
\\ return a + b
\\}
);
const receiver = vm.makeReceiver("test", "add");
defer receiver.deinit();
const call_handle = vm.makeCallHandle("call(_,_)");
defer call_handle.deinit();
const method = Method(i32, .{ i32, i32 }).init(receiver, call_handle);
testing.expectEqual(@as(i32, 42), try method.call(.{ 23, 19 }));
}
test "call a static method" {
var config = Configuration{};
config.errorFn = printError;
config.writeFn = print;
var vm: Vm = undefined;
try config.newVmInPlace(EmptyUserData, &vm, null);
defer vm.deinit();
try vm.interpret("test",
\\class Foo {
\\ static test() {
\\ return "hello"
\\ }
\\}
);
const receiver = vm.makeReceiver("test", "Foo");
defer receiver.deinit();
const call_handle = vm.makeCallHandle("test()");
defer call_handle.deinit();
const method = Method([]const u8, .{}).init(receiver, call_handle);
testing.expectEqualStrings("hello", try method.call(.{}));
}
test "call an instance method" {
var config = Configuration{};
config.errorFn = printError;
config.writeFn = print;
var vm: Vm = undefined;
try config.newVmInPlace(EmptyUserData, &vm, null);
defer vm.deinit();
try vm.interpret("test",
\\class Multiplier {
\\ construct new(n) {
\\ _n = n
\\ }
\\ n=(n) {
\\ _n = n
\\ }
\\ *(m) {
\\ return _n * m
\\ }
\\ formatted(m) {
\\ return "%(_n) * %(m) = %(this * m)"
\\ }
\\}
\\
\\var mult = Multiplier.new(3)
);
const receiver = vm.makeReceiver("test", "mult");
defer receiver.deinit();
const op_times_sig = vm.makeCallHandle("*(_)");
defer op_times_sig.deinit();
const op_times = Method(i32, .{i32}).init(receiver, op_times_sig);
testing.expectEqual(@as(i32, 9), try op_times.call(.{3}));
const setter_sig = vm.makeCallHandle("n=(_)");
defer setter_sig.deinit();
const setter = Method(void, .{i32}).init(receiver, setter_sig);
try setter.call(.{5});
const formatted_sig = vm.makeCallHandle("formatted(_)");
defer formatted_sig.deinit();
const formatted = Method([]const u8, .{f32}).init(receiver, formatted_sig);
testing.expectEqualStrings("5 * 1.1 = 5.5", try formatted.call(.{1.1}));
}
test "non-comptime identifiers" {
var config = Configuration{};
config.errorFn = printError;
config.writeFn = print;
var vm: Vm = undefined;
try config.newVmInPlace(EmptyUserData, &vm, null);
defer vm.deinit();
try vm.interpret("test",
\\class Foo {
\\ static test() {
\\ return "hello"
\\ }
\\}
);
var identifier: [4]u8 = [_]u8{ 'F', 'o', 'o', 0 };
var id = identifier[0..];
const receiver = vm.makeReceiver("test", id);
defer receiver.deinit();
var signature = "test()";
var sig = signature[0..];
const call_handle = vm.makeCallHandle(sig);
defer call_handle.deinit();
const method = Method([]const u8, .{}).init(receiver, call_handle);
testing.expectEqualStrings("hello", try method.call(.{}));
} | src/zapata/call.zig |
usingnamespace @import("psptypes.zig");
pub const SceKernelLMOption = extern struct {
size: SceSize,
mpidtext: SceUID,
mpiddata: SceUID,
flags: c_uint,
position: u8,
access: u8,
creserved: [2]u8,
};
pub const SceKernelSMOption = extern struct {
size: SceSize,
mpidstack: SceUID,
stacksize: SceSize,
priority: c_int,
attribute: c_uint,
};
pub const SceKernelModuleInfo = extern struct {
size: SceSize,
nsegment: u8,
reserved: [3]u8,
segmentaddr: [4]c_int,
segmentsize: [4]c_int,
entry_addr: c_uint,
gp_value: c_uint,
text_addr: c_uint,
text_size: c_uint,
data_size: c_uint,
bss_size: c_uint,
attribute: c_ushort,
version: [2]u8,
name: [28]u8,
};
pub const PSP_MEMORY_PARTITION_KERNEL = 1;
pub const PSP_MEMORY_PARTITION_USER = 2;
// Load a module.
// @note This function restricts where it can load from (such as from flash0)
// unless you call it in kernel mode. It also must be called from a thread.
//
// @param path - The path to the module to load.
// @param flags - Unused, always 0 .
// @param option - Pointer to a mod_param_t structure. Can be NULL.
//
// @return The UID of the loaded module on success, otherwise one of ::PspKernelErrorCodes.
pub extern fn sceKernelLoadModule(path: []const u8, flags: c_int, option: *SceKernelLMOption) SceUID;
// Load a module from MS.
// @note This function restricts what it can load, e.g. it wont load plain executables.
//
// @param path - The path to the module to load.
// @param flags - Unused, set to 0.
// @param option - Pointer to a mod_param_t structure. Can be NULL.
//
// @return The UID of the loaded module on success, otherwise one of ::PspKernelErrorCodes.
pub extern fn sceKernelLoadModuleMs(path: []const u8, flags: c_int, option: *SceKernelLMOption) SceUID;
// Load a module from the given file UID.
//
// @param fid - The module's file UID.
// @param flags - Unused, always 0.
// @param option - Pointer to an optional ::SceKernelLMOption structure.
//
// @return The UID of the loaded module on success, otherwise one of ::PspKernelErrorCodes.
pub extern fn sceKernelLoadModuleByID(fid: SceUID, flags: c_int, option: *SceKernelLMOption) SceUID;
// Load a module from a buffer using the USB/WLAN API.
//
// Can only be called from kernel mode, or from a thread that has attributes of 0xa0000000.
//
// @param bufsize - Size (in bytes) of the buffer pointed to by buf.
// @param buf - Pointer to a buffer containing the module to load. The buffer must reside at an
// address that is a multiple to 64 bytes.
// @param flags - Unused, always 0.
// @param option - Pointer to an optional ::SceKernelLMOption structure.
//
// @return The UID of the loaded module on success, otherwise one of ::PspKernelErrorCodes.
pub extern fn sceKernelLoadModuleBufferUsbWlan(bufsize: SceSize, buf: ?*c_void, flags: c_int, option: *SceKernelLMOption) SceUID;
// Start a loaded module.
//
// @param modid - The ID of the module returned from LoadModule.
// @param argsize - Length of the args.
// @param argp - A pointer to the arguments to the module.
// @param status - Returns the status of the start.
// @param option - Pointer to an optional ::SceKernelSMOption structure.
//
// @return ??? on success, otherwise one of ::PspKernelErrorCodes.
pub extern fn sceKernelStartModule(modid: SceUID, argsize: SceSize, argp: ?*c_void, status: *c_int, option: *SceKernelSMOption) c_int;
// Stop a running module.
//
// @param modid - The UID of the module to stop.
// @param argsize - The length of the arguments pointed to by argp.
// @param argp - Pointer to arguments to pass to the module's module_stop() routine.
// @param status - Return value of the module's module_stop() routine.
// @param option - Pointer to an optional ::SceKernelSMOption structure.
//
// @return ??? on success, otherwise one of ::PspKernelErrorCodes.
pub extern fn sceKernelStopModule(modid: SceUID, argsize: SceSize, argp: ?*c_void, status: *c_int, option: *SceKernelSMOption) c_int;
// Unload a stopped module.
//
// @param modid - The UID of the module to unload.
//
// @return ??? on success, otherwise one of ::PspKernelErrorCodes.
pub extern fn sceKernelUnloadModule(modid: SceUID) c_int;
// Stop and unload the current module.
//
// @param unknown - Unknown (I've seen 1 passed).
// @param argsize - Size (in bytes) of the arguments that will be passed to module_stop().
// @param argp - Pointer to arguments that will be passed to module_stop().
//
// @return ??? on success, otherwise one of ::PspKernelErrorCodes.
pub extern fn sceKernelSelfStopUnloadModule(unknown: c_int, argsize: SceSize, argp: ?*c_void) c_int;
// Stop and unload the current module.
//
// @param argsize - Size (in bytes) of the arguments that will be passed to module_stop().
// @param argp - Poitner to arguments that will be passed to module_stop().
// @param status - Return value from module_stop().
// @param option - Pointer to an optional ::SceKernelSMOption structure.
//
// @return ??? on success, otherwise one of ::PspKernelErrorCodes.
pub extern fn sceKernelStopUnloadSelfModule(argsize: SceSize, argp: ?*c_void, status: *c_int, option: *SceKernelSMOption) c_int;
// Query the information about a loaded module from its UID.
// @note This fails on v1.0 firmware (and even it worked has a limited structure)
// so if you want to be compatible with both 1.5 and 1.0 (and you are running in
// kernel mode) then call this function first then ::pspSdkQueryModuleInfoV1
// if it fails, or make separate v1 and v1.5+ builds.
//
// @param modid - The UID of the loaded module.
// @param info - Pointer to a ::SceKernelModuleInfo structure.
//
// @return 0 on success, otherwise one of ::PspKernelErrorCodes.
pub extern fn sceKernelQueryModuleInfo(modid: SceUID, info: *SceKernelModuleInfo) c_int;
// Get a list of module IDs. NOTE: This is only available on 1.5 firmware
// and above. For V1 use ::pspSdkGetModuleIdList.
//
// @param readbuf - Buffer to store the module list.
// @param readbufsize - Number of elements in the readbuffer.
// @param idcount - Returns the number of module ids
//
// @return >= 0 on success
pub extern fn sceKernelGetModuleIdList(readbuf: *SceUID, readbufsize: c_int, idcount: *c_int) c_int;
// Get the ID of the module occupying the address
//
// @param moduleAddr - A pointer to the module
//
// @return >= 0 on success, otherwise one of ::PspKernelErrorCodes
pub extern fn sceKernelGetModuleIdByAddress(moduleAddr: ?*c_void) c_int; | src/psp/sdk/pspmodulemgr.zig |
const std = @import("std");
const mem = std.mem;
const fmt = std.fmt;
const unicode = std.unicode;
const testing = std.testing;
const nfd_check = @import("../ziglyph.zig").derived_normalization_props;
iter: usize,
entries: std.ArrayList(Entry),
implicits: std.ArrayList(Implicit),
const AllKeysFile = @This();
pub const Entry = struct {
key: Key,
value: Elements,
// Calculates the difference of each optional integral value in this entry.
pub fn diff(self: Entry, other: Entry) Entry {
// Determine difference in key values.
var d: Entry = undefined;
d.key.len = self.key.len -% other.key.len;
for (self.key.items) |k, i| {
d.key.items[i] = k -% other.key.items[i];
}
// Determine difference in element values.
for (self.value.items) |e, i| {
d.value.len = self.value.len -% other.value.len;
d.value.items[i] = Element{
.l1 = e.l1 -% other.value.items[i].l1,
.l2 = e.l2 -% other.value.items[i].l2,
.l3 = e.l3 -% other.value.items[i].l3,
};
}
return d;
}
};
pub const Element = struct {
l1: u16,
l2: u16,
l3: u16,
};
pub const Elements = struct {
len: u5,
items: [18]Element,
fn allItemsEql(self: Elements, other: Elements) bool {
for (self.items) |a, i| {
const b = other.items[i];
if (a.l1 != b.l1 or a.l2 != b.l2 or a.l3 != b.l3) {
return false;
}
}
return true;
}
fn maxBitSize(self: Elements) u6 {
var bit_size: u6 = 0;
for (self.items) |v| {
var max_value = @as(usize, 1) << bit_size;
while (v.l1 >= max_value or v.l2 >= max_value or v.l3 >= max_value) {
bit_size += 1;
max_value = @as(usize, 1) << bit_size;
}
}
return bit_size;
}
};
pub const Key = struct {
len: u2,
items: [3]u21,
fn maxBitSize(self: Key) u6 {
var bit_size: u6 = 0;
for (self.items) |v| {
while (v >= @as(usize, 1) << bit_size) {
bit_size += 1;
}
}
return bit_size;
}
};
pub const Implicit = struct {
base: u21,
start: u21,
end: u21,
};
pub fn deinit(self: *AllKeysFile) void {
self.entries.deinit();
self.implicits.deinit();
}
pub fn next(self: *AllKeysFile) ?Entry {
if (self.iter >= self.entries.items.len) return null;
const entry = self.entries.items[self.iter];
self.iter += 1;
return entry;
}
pub fn parseFile(allocator: mem.Allocator, filename: []const u8) !AllKeysFile {
var in_file = try std.fs.cwd().openFile(filename, .{});
defer in_file.close();
return parse(allocator, in_file.reader());
}
pub fn parse(allocator: mem.Allocator, reader: anytype) !AllKeysFile {
var buf_reader = std.io.bufferedReader(reader);
var input_stream = buf_reader.reader();
var buf: [1024]u8 = undefined;
var entries = std.ArrayList(Entry).init(allocator);
var implicits = std.ArrayList(Implicit).init(allocator);
lines: while (try input_stream.readUntilDelimiterOrEof(&buf, '\n')) |line| {
// Skip empty or comment.
if (line.len == 0 or line[0] == '#' or mem.startsWith(u8, line, "@version")) continue;
var raw = mem.trim(u8, line, " ");
if (mem.indexOf(u8, line, "#")) |octo| {
raw = mem.trimRight(u8, line[0..octo], " ");
}
if (mem.startsWith(u8, raw, "@implicitweights")) {
raw = raw[17..]; // 17 == length of "@implicitweights "
const semi = mem.indexOf(u8, raw, ";").?;
const ch_range = raw[0..semi];
const base = mem.trim(u8, raw[semi + 1 ..], " ");
const dots = mem.indexOf(u8, ch_range, "..").?;
const range_start = ch_range[0..dots];
const range_end = ch_range[dots + 2 ..];
try implicits.append(.{
.base = try fmt.parseInt(u21, base, 16),
.start = try fmt.parseInt(u21, range_start, 16),
.end = try fmt.parseInt(u21, range_end, 16),
});
continue; // next line.
}
const semi = mem.indexOf(u8, raw, ";").?;
const cp_strs = mem.trim(u8, raw[0..semi], " ");
var cp_strs_iter = mem.split(u8, cp_strs, " ");
var key: Key = std.mem.zeroes(Key);
while (cp_strs_iter.next()) |cp_str| {
const cp = try fmt.parseInt(u21, cp_str, 16);
if (!nfd_check.isNfd(cp)) continue :lines; // Skip non-NFD.
key.items[key.len] = cp;
key.len += 1;
}
const ce_strs = mem.trim(u8, raw[semi + 1 ..], " ");
var ce_strs_iter = mem.split(u8, ce_strs[1 .. ce_strs.len - 1], "]["); // no ^[. or ^[* or ]$
var elements: Elements = std.mem.zeroes(Elements);
while (ce_strs_iter.next()) |ce_str| {
const just_levels = ce_str[1..];
var w_strs_iter = mem.split(u8, just_levels, ".");
elements.items[elements.len] = Element{
.l1 = try fmt.parseInt(u16, w_strs_iter.next().?, 16),
.l2 = try fmt.parseInt(u16, w_strs_iter.next().?, 16),
.l3 = try fmt.parseInt(u16, w_strs_iter.next().?, 16),
};
elements.len += 1;
}
try entries.append(Entry{ .key = key, .value = elements });
}
return AllKeysFile{ .iter = 0, .entries = entries, .implicits = implicits };
}
// A UDDC opcode for an allkeys file.
const Opcode = enum(u3) {
// Sets an incrementor for the key register, incrementing the key by this much on each emission.
// 10690 instances, 13,480.5 bytes
inc_key,
// Sets an incrementor for the value register, incrementing the value by this much on each emission.
// 7668 instances, 62,970 bytes
inc_value,
// Emits a single value.
// 31001 instances, 15,500.5 bytes
emit_1,
emit_2,
emit_4,
emit_8,
emit_32,
// Denotes the end of the opcode stream. This is so that we don't need to encode the total
// number of opcodes in the stream up front (note also the file is bit packed: there may be
// a few remaining zero bits at the end as padding so we need an EOF opcode rather than say
// catching the actual file read EOF.)
eof,
};
pub fn compressToFile(self: *AllKeysFile, filename: []const u8) !void {
var out_file = try std.fs.cwd().createFile(filename, .{});
defer out_file.close();
return self.compressTo(out_file.writer());
}
pub fn compressTo(self: *AllKeysFile, writer: anytype) !void {
var buf_writer = std.io.bufferedWriter(writer);
var out = std.io.bitWriter(.Little, buf_writer.writer());
// Implicits
std.debug.assert(self.implicits.items.len == 4); // we don't encode a length for implicits.
for (self.implicits.items) |implicit| {
try out.writeBits(implicit.base, @bitSizeOf(@TypeOf(implicit.base)));
try out.writeBits(implicit.start, @bitSizeOf(@TypeOf(implicit.start)));
try out.writeBits(implicit.end, @bitSizeOf(@TypeOf(implicit.end)));
}
// For the UDDC registers, we want one register to represent each possible value in a single
// entry; we will emit opcodes to modify these registers into the desired form to produce a
// real entry.
var registers = std.mem.zeroes(Entry);
var incrementor = std.mem.zeroes(Entry);
var emissions: usize = 0;
comptime var flush_emissions = struct {
fn flush_emissions(pending: *usize, _out: anytype) !void {
while (pending.* >= 32) : (pending.* -= 32) try _out.writeBits(@enumToInt(Opcode.emit_32), @bitSizeOf(Opcode));
while (pending.* >= 8) : (pending.* -= 8) try _out.writeBits(@enumToInt(Opcode.emit_8), @bitSizeOf(Opcode));
while (pending.* >= 4) : (pending.* -= 4) try _out.writeBits(@enumToInt(Opcode.emit_4), @bitSizeOf(Opcode));
while (pending.* >= 2) : (pending.* -= 2) try _out.writeBits(@enumToInt(Opcode.emit_2), @bitSizeOf(Opcode));
while (pending.* >= 1) : (pending.* -= 1) try _out.writeBits(@enumToInt(Opcode.emit_1), @bitSizeOf(Opcode));
}
}.flush_emissions;
while (self.next()) |entry| {
// Determine what has changed between this entry and the current registers' state.
const diff = entry.diff(registers);
// If you want to analyze the difference between entries, uncomment the following:
//std.debug.print("diff.key={any: <7}\n", .{diff.key});
//std.debug.print("diff.value={any: <5}\n", .{diff.value});
//registers = entry;
//continue;
if (diff.key.len != 0 or !std.mem.eql(u21, diff.key.items[0..], incrementor.key.items[0..])) {
try flush_emissions(&emissions, &out);
const max_bit_size = diff.key.maxBitSize();
try out.writeBits(@enumToInt(Opcode.inc_key), @bitSizeOf(Opcode));
try out.writeBits(entry.key.len, 2);
var diff_key_len: u2 = 0;
for (diff.key.items) |kv, i| {
if (kv != 0) diff_key_len = @intCast(u2, i + 1);
}
try out.writeBits(diff_key_len, 2);
try out.writeBits(max_bit_size, 6);
for (diff.key.items[0..diff_key_len]) |kv| try out.writeBits(kv, max_bit_size);
incrementor.key = diff.key;
}
if (diff.value.len != 0 or !diff.value.allItemsEql(incrementor.value)) {
try flush_emissions(&emissions, &out);
const max_bit_size = diff.value.maxBitSize();
try out.writeBits(@enumToInt(Opcode.inc_value), @bitSizeOf(Opcode));
try out.writeBits(entry.value.len, 5);
var diff_value_len: u5 = 0;
for (diff.value.items) |ev, i| {
if (ev.l1 != 0 or ev.l2 != 0 or ev.l3 != 0) diff_value_len = @intCast(u5, i + 1);
}
try out.writeBits(diff_value_len, 5);
try out.writeBits(max_bit_size, 6);
for (diff.value.items[0..diff_value_len]) |ev| {
try out.writeBits(ev.l1, max_bit_size);
try out.writeBits(ev.l2, max_bit_size);
try out.writeBits(ev.l3, max_bit_size);
}
incrementor.value = diff.value;
}
emissions += 1;
registers = entry;
}
try flush_emissions(&emissions, &out);
try out.writeBits(@enumToInt(Opcode.eof), @bitSizeOf(Opcode));
try out.flushBits();
try buf_writer.flush();
}
pub fn decompressFile(allocator: mem.Allocator, filename: []const u8) !AllKeysFile {
var in_file = try std.fs.cwd().openFile(filename, .{});
defer in_file.close();
return decompress(allocator, in_file.reader());
}
pub fn decompress(allocator: mem.Allocator, reader: anytype) !AllKeysFile {
var buf_reader = std.io.bufferedReader(reader);
var in = std.io.bitReader(.Little, buf_reader.reader());
var entries = std.ArrayList(Entry).init(allocator);
var implicits = std.ArrayList(Implicit).init(allocator);
// Implicits
{
var i: usize = 0;
while (i < 4) : (i += 1) {
var implicit: Implicit = undefined;
implicit.base = try in.readBitsNoEof(u21, 21);
implicit.start = try in.readBitsNoEof(u21, 21);
implicit.end = try in.readBitsNoEof(u21, 21);
try implicits.append(implicit);
}
}
// For the UDDC registers, we want one register to represent each possible value in a single
// entry; each opcode we read will modify these registers so we can emit a value.
var registers = std.mem.zeroes(Entry);
var incrementor = std.mem.zeroes(Entry);
while (true) {
// Read a single operation.
var op = @intToEnum(Opcode, try in.readBitsNoEof(std.meta.Tag(Opcode), @bitSizeOf(Opcode)));
// If you want to inspect the # of different ops in a stream, uncomment this:
//std.debug.print("{}\n", .{op});
switch (op) {
.inc_key => {
registers.key.len = try in.readBitsNoEof(u2, 2);
var inc_key_len = try in.readBitsNoEof(u2, 2);
const max_bit_size = try in.readBitsNoEof(u6, 6);
var j: usize = 0;
while (j < inc_key_len) : (j += 1) {
incrementor.key.items[j] = try in.readBitsNoEof(u21, max_bit_size);
}
while (j < 3) : (j += 1) incrementor.key.items[j] = 0;
},
.inc_value => {
registers.value.len = try in.readBitsNoEof(u5, 5);
const inc_value_len = try in.readBitsNoEof(u5, 5);
const max_bit_size = try in.readBitsNoEof(u6, 6);
var j: usize = 0;
while (j < inc_value_len) : (j += 1) {
var ev: Element = undefined;
ev.l1 = try in.readBitsNoEof(u16, max_bit_size);
ev.l2 = try in.readBitsNoEof(u16, max_bit_size);
ev.l3 = try in.readBitsNoEof(u16, max_bit_size);
incrementor.value.items[j] = ev;
}
while (j < 18) : (j += 1) incrementor.value.items[j] = std.mem.zeroes(Element);
},
.emit_1, .emit_2, .emit_4, .emit_8, .emit_32 => {
var emissions: usize = switch (op) {
.emit_1 => 1,
.emit_2 => 2,
.emit_4 => 4,
.emit_8 => 8,
.emit_32 => 32,
else => unreachable,
};
var j: usize = 0;
while (j < emissions) : (j += 1) {
for (incrementor.key.items) |k, i| registers.key.items[i] +%= k;
for (incrementor.value.items) |v, i| {
registers.value.items[i].l1 +%= v.l1;
registers.value.items[i].l2 +%= v.l2;
registers.value.items[i].l3 +%= v.l3;
}
try entries.append(registers);
}
},
.eof => break,
}
}
return AllKeysFile{ .iter = 0, .entries = entries, .implicits = implicits };
}
test "parse" {
const allocator = testing.allocator;
var file = try parseFile(allocator, "src/data/uca/allkeys.txt");
defer file.deinit();
while (file.next()) |entry| {
_ = entry;
}
}
test "compression_is_lossless" {
const allocator = testing.allocator;
// Compress allkeys.txt -> allkeys.bin
var file = try parseFile(allocator, "src/data/uca/allkeys.txt");
defer file.deinit();
try file.compressToFile("src/data/uca/allkeys.bin");
// Reset the raw file iterator.
file.iter = 0;
// Decompress the file.
var decompressed = try decompressFile(allocator, "src/data/uca/allkeys.bin");
defer decompressed.deinit();
try testing.expectEqualSlices(Implicit, file.implicits.items, decompressed.implicits.items);
while (file.next()) |expected| {
var actual = decompressed.next().?;
//std.debug.print("{}\n{}\n\n", .{expected, actual});
try testing.expectEqual(expected, actual);
}
} | src/collator/AllKeysFile.zig |
const std = @import("std");
const stdx = @import("stdx");
const ds = stdx.ds;
const log = std.log.scoped(.tasks);
const server = @import("server.zig");
const TaskResult = @import("work_queue.zig").TaskResult;
/// Task that invokes a function with allocated args.
pub fn ClosureTask(comptime func: anytype) type {
const Fn = @TypeOf(func);
const Args = std.meta.ArgsTuple(Fn);
const ArgFields = std.meta.fields(Args);
const ReturnType = stdx.meta.FnReturn(Fn);
return struct {
const Self = @This();
// Allocator that owns the individual args, not res.
alloc: std.mem.Allocator,
args: Args,
res: ReturnType = undefined,
pub fn deinit(self: *Self) void {
inline for (ArgFields) |field| {
if (field.field_type == []const u8) {
self.alloc.free(@field(self.args, field.name));
}
}
deinitResult(self.res);
}
pub fn process(self: *Self) !TaskResult {
if (@typeInfo(ReturnType) == .ErrorUnion) {
self.res = try @call(.{ .modifier = .always_inline }, func, self.args);
} else {
self.res = @call(.{ .modifier = .always_inline }, func, self.args);
}
return TaskResult.Success;
}
};
}
// TODO: Should this be the same as gen.freeNativeValue ?
fn deinitResult(res: anytype) void {
const Result = @TypeOf(res);
switch (Result) {
ds.Box([]const u8) => res.deinit(),
else => {
if (@typeInfo(Result) == .Optional) {
if (res) |_res| {
deinitResult(_res);
}
} else if (@typeInfo(Result) == .ErrorUnion) {
if (res) |payload| {
deinitResult(payload);
} else |_| {}
} else if (comptime std.meta.trait.isContainer(Result)) {
if (@hasDecl(Result, "ManagedSlice")) {
res.deinit();
} else if (@hasDecl(Result, "ManagedStruct")) {
res.deinit();
}
}
},
}
}
pub const ReadFileTask = struct {
const Self = @This();
alloc: std.mem.Allocator,
path: []const u8,
res: ?[]const u8 = null,
pub fn deinit(self: *Self) void {
self.alloc.free(self.path);
if (self.res) |res| {
self.alloc.free(res);
}
}
pub fn process(self: *Self) !TaskResult {
self.res = std.fs.cwd().readFileAlloc(self.alloc, self.path, 1e12) catch |err| switch (err) {
// Whitelist errors to silence.
error.FileNotFound => null,
else => unreachable,
};
return TaskResult.Success;
}
}; | runtime/tasks.zig |
const std = @import("std");
const DocumentStore = @import("document_store.zig");
const analysis = @import("analysis.zig");
const types = @import("types.zig");
const offsets = @import("offsets.zig");
const log = std.log.scoped(.references);
const ast = std.zig.ast;
fn tokenReference(
handle: *DocumentStore.Handle,
tok: ast.TokenIndex,
encoding: offsets.Encoding,
context: anytype,
comptime handler: anytype,
) !void {
const loc = offsets.tokenRelativeLocation(handle.tree, 0, tok, encoding) catch return;
try handler(context, types.Location{
.uri = handle.uri(),
.range = .{
.start = .{
.line = @intCast(types.Integer, loc.line),
.character = @intCast(types.Integer, loc.column),
},
.end = .{
.line = @intCast(types.Integer, loc.line),
.character = @intCast(types.Integer, loc.column + offsets.tokenLength(handle.tree, tok, encoding)),
},
},
});
}
pub fn labelReferences(
arena: *std.heap.ArenaAllocator,
decl: analysis.DeclWithHandle,
encoding: offsets.Encoding,
include_decl: bool,
context: anytype,
comptime handler: anytype,
) !void {
std.debug.assert(decl.decl.* == .label_decl);
const handle = decl.handle;
// Find while / for / block from label -> iterate over children nodes, find break and continues, change their labels if they match.
// This case can be implemented just by scanning tokens.
const first_tok = decl.decl.label_decl.firstToken();
const last_tok = decl.decl.label_decl.lastToken();
if (include_decl) {
// The first token is always going to be the label
try tokenReference(handle, first_tok, encoding, context, handler);
}
var curr_tok = first_tok + 1;
while (curr_tok < last_tok - 2) : (curr_tok += 1) {
const curr_id = handle.tree.token_ids[curr_tok];
if ((curr_id == .Keyword_break or curr_id == .Keyword_continue) and handle.tree.token_ids[curr_tok + 1] == .Colon and
handle.tree.token_ids[curr_tok + 2] == .Identifier)
{
if (std.mem.eql(u8, handle.tree.tokenSlice(curr_tok + 2), handle.tree.tokenSlice(first_tok))) {
try tokenReference(handle, first_tok, encoding, context, handler);
}
}
}
}
fn symbolReferencesInternal(
arena: *std.heap.ArenaAllocator,
store: *DocumentStore,
node_handle: analysis.NodeWithHandle,
decl: analysis.DeclWithHandle,
encoding: offsets.Encoding,
context: anytype,
comptime handler: anytype,
) error{OutOfMemory}!void {
const node = node_handle.node;
const handle = node_handle.handle;
switch (node.tag) {
.ContainerDecl, .Root, .Block => {
var idx: usize = 0;
while (node.iterate(idx)) |child| : (idx += 1) {
try symbolReferencesInternal(arena, store, .{ .node = child, .handle = handle }, decl, encoding, context, handler);
}
},
.VarDecl => {
const var_decl = node.cast(ast.Node.VarDecl).?;
if (var_decl.getTypeNode()) |type_node| {
try symbolReferencesInternal(arena, store, .{ .node = type_node, .handle = handle }, decl, encoding, context, handler);
}
if (var_decl.getInitNode()) |init_node| {
try symbolReferencesInternal(arena, store, .{ .node = init_node, .handle = handle }, decl, encoding, context, handler);
}
},
.Use => {
const use = node.cast(ast.Node.Use).?;
try symbolReferencesInternal(arena, store, .{ .node = use.expr, .handle = handle }, decl, encoding, context, handler);
},
.ContainerField => {
const field = node.cast(ast.Node.ContainerField).?;
if (field.type_expr) |type_node| {
try symbolReferencesInternal(arena, store, .{ .node = type_node, .handle = handle }, decl, encoding, context, handler);
}
if (field.value_expr) |init_node| {
try symbolReferencesInternal(arena, store, .{ .node = init_node, .handle = handle }, decl, encoding, context, handler);
}
},
.Identifier => {
if (try analysis.lookupSymbolGlobal(store, arena, handle, handle.tree.getNodeSource(node), handle.tree.token_locs[node.firstToken()].start)) |child| {
if (std.meta.eql(decl, child)) {
try tokenReference(handle, node.firstToken(), encoding, context, handler);
}
}
},
.FnProto => {
const fn_proto = node.cast(ast.Node.FnProto).?;
for (fn_proto.paramsConst()) |param| {
switch (param.param_type) {
.type_expr => |type_node| {
try symbolReferencesInternal(arena, store, .{ .node = type_node, .handle = handle }, decl, encoding, context, handler);
},
else => {},
}
}
switch (fn_proto.return_type) {
.Explicit, .InferErrorSet => |type_node| {
try symbolReferencesInternal(arena, store, .{ .node = type_node, .handle = handle }, decl, encoding, context, handler);
},
else => {},
}
if (fn_proto.getAlignExpr()) |align_expr| {
try symbolReferencesInternal(arena, store, .{ .node = align_expr, .handle = handle }, decl, encoding, context, handler);
}
if (fn_proto.getSectionExpr()) |section_expr| {
try symbolReferencesInternal(arena, store, .{ .node = section_expr, .handle = handle }, decl, encoding, context, handler);
}
if (fn_proto.getCallconvExpr()) |callconv_expr| {
try symbolReferencesInternal(arena, store, .{ .node = callconv_expr, .handle = handle }, decl, encoding, context, handler);
}
if (fn_proto.getBodyNode()) |body| {
try symbolReferencesInternal(arena, store, .{ .node = body, .handle = handle }, decl, encoding, context, handler);
}
},
.AnyFrameType => {
const anyframe_type = node.cast(ast.Node.AnyFrameType).?;
if (anyframe_type.result) |result| {
try symbolReferencesInternal(arena, store, .{ .node = result.return_type, .handle = handle }, decl, encoding, context, handler);
}
},
.Defer => {
const defer_node = node.cast(ast.Node.Defer).?;
try symbolReferencesInternal(arena, store, .{ .node = defer_node.expr, .handle = handle }, decl, encoding, context, handler);
},
.Comptime => {
const comptime_node = node.cast(ast.Node.Comptime).?;
try symbolReferencesInternal(arena, store, .{ .node = comptime_node.expr, .handle = handle }, decl, encoding, context, handler);
},
.Nosuspend => {
const nosuspend_node = node.cast(ast.Node.Nosuspend).?;
try symbolReferencesInternal(arena, store, .{ .node = nosuspend_node.expr, .handle = handle }, decl, encoding, context, handler);
},
.Switch => {
// TODO When renaming a union(enum) field, also rename switch items that refer to it.
const switch_node = node.cast(ast.Node.Switch).?;
try symbolReferencesInternal(arena, store, .{ .node = switch_node.expr, .handle = handle }, decl, encoding, context, handler);
for (switch_node.casesConst()) |case| {
if (case.*.cast(ast.Node.SwitchCase)) |case_node| {
try symbolReferencesInternal(arena, store, .{ .node = case_node.expr, .handle = handle }, decl, encoding, context, handler);
}
}
},
.While => {
const while_node = node.cast(ast.Node.While).?;
try symbolReferencesInternal(arena, store, .{ .node = while_node.condition, .handle = handle }, decl, encoding, context, handler);
if (while_node.continue_expr) |cont_expr| {
try symbolReferencesInternal(arena, store, .{ .node = cont_expr, .handle = handle }, decl, encoding, context, handler);
}
try symbolReferencesInternal(arena, store, .{ .node = while_node.body, .handle = handle }, decl, encoding, context, handler);
if (while_node.@"else") |else_node| {
try symbolReferencesInternal(arena, store, .{ .node = else_node.body, .handle = handle }, decl, encoding, context, handler);
}
},
.For => {
const for_node = node.cast(ast.Node.For).?;
try symbolReferencesInternal(arena, store, .{ .node = for_node.array_expr, .handle = handle }, decl, encoding, context, handler);
try symbolReferencesInternal(arena, store, .{ .node = for_node.body, .handle = handle }, decl, encoding, context, handler);
if (for_node.@"else") |else_node| {
try symbolReferencesInternal(arena, store, .{ .node = else_node.body, .handle = handle }, decl, encoding, context, handler);
}
},
.If => {
const if_node = node.cast(ast.Node.If).?;
try symbolReferencesInternal(arena, store, .{ .node = if_node.condition, .handle = handle }, decl, encoding, context, handler);
try symbolReferencesInternal(arena, store, .{ .node = if_node.body, .handle = handle }, decl, encoding, context, handler);
if (if_node.@"else") |else_node| {
try symbolReferencesInternal(arena, store, .{ .node = else_node.body, .handle = handle }, decl, encoding, context, handler);
}
},
.ArrayType => {
const info = node.castTag(.ArrayType).?;
try symbolReferencesInternal(arena, store, .{ .node = info.len_expr, .handle = handle }, decl, encoding, context, handler);
try symbolReferencesInternal(arena, store, .{ .node = info.rhs, .handle = handle }, decl, encoding, context, handler);
},
.ArrayTypeSentinel => {
const info = node.castTag(.ArrayTypeSentinel).?;
try symbolReferencesInternal(arena, store, .{ .node = info.len_expr, .handle = handle }, decl, encoding, context, handler);
try symbolReferencesInternal(arena, store, .{ .node = info.sentinel, .handle = handle }, decl, encoding, context, handler);
try symbolReferencesInternal(arena, store, .{ .node = info.rhs, .handle = handle }, decl, encoding, context, handler);
},
.PtrType, .SliceType => {
const info = switch (node.tag) {
.PtrType => node.castTag(.PtrType).?.ptr_info,
.SliceType => node.castTag(.SliceType).?.ptr_info,
else => unreachable,
};
if (info.align_info) |align_info| {
try symbolReferencesInternal(arena, store, .{ .node = align_info.node, .handle = handle }, decl, encoding, context, handler);
if (align_info.bit_range) |range| {
try symbolReferencesInternal(arena, store, .{ .node = range.start, .handle = handle }, decl, encoding, context, handler);
try symbolReferencesInternal(arena, store, .{ .node = range.end, .handle = handle }, decl, encoding, context, handler);
}
}
if (info.sentinel) |sentinel| {
try symbolReferencesInternal(arena, store, .{ .node = sentinel, .handle = handle }, decl, encoding, context, handler);
}
switch (node.tag) {
.PtrType => try symbolReferencesInternal(arena, store, .{ .node = node.castTag(.PtrType).?.rhs, .handle = handle }, decl, encoding, context, handler),
.SliceType => try symbolReferencesInternal(arena, store, .{ .node = node.castTag(.SliceType).?.rhs, .handle = handle }, decl, encoding, context, handler),
else => unreachable,
}
},
.AddressOf, .Await, .BitNot, .BoolNot, .OptionalType, .Negation, .NegationWrap, .Resume, .Try => {
const prefix_op = node.cast(ast.Node.SimplePrefixOp).?;
try symbolReferencesInternal(arena, store, .{ .node = prefix_op.rhs, .handle = handle }, decl, encoding, context, handler);
},
.FieldInitializer => {
// TODO Rename field initializer names when needed
const field_init = node.cast(ast.Node.FieldInitializer).?;
try symbolReferencesInternal(arena, store, .{ .node = field_init.expr, .handle = handle }, decl, encoding, context, handler);
},
.ArrayInitializer => {
const array_init = node.cast(ast.Node.ArrayInitializer).?;
try symbolReferencesInternal(arena, store, .{ .node = array_init.lhs, .handle = handle }, decl, encoding, context, handler);
for (array_init.listConst()) |child| {
try symbolReferencesInternal(arena, store, .{ .node = child, .handle = handle }, decl, encoding, context, handler);
}
},
.ArrayInitializerDot => {
const array_init = node.cast(ast.Node.ArrayInitializerDot).?;
for (array_init.listConst()) |child| {
try symbolReferencesInternal(arena, store, .{ .node = child, .handle = handle }, decl, encoding, context, handler);
}
},
.StructInitializer => {
// TODO Rename field initializer names when needed
const struct_init = node.cast(ast.Node.StructInitializer).?;
try symbolReferencesInternal(arena, store, .{ .node = struct_init.lhs, .handle = handle }, decl, encoding, context, handler);
for (struct_init.listConst()) |child| {
try symbolReferencesInternal(arena, store, .{ .node = child, .handle = handle }, decl, encoding, context, handler);
}
},
.StructInitializerDot => {
const struct_init = node.cast(ast.Node.StructInitializerDot).?;
for (struct_init.listConst()) |child| {
try symbolReferencesInternal(arena, store, .{ .node = child, .handle = handle }, decl, encoding, context, handler);
}
},
.Call => {
const call = node.cast(ast.Node.Call).?;
try symbolReferencesInternal(arena, store, .{ .node = call.lhs, .handle = handle }, decl, encoding, context, handler);
for (call.paramsConst()) |param| {
try symbolReferencesInternal(arena, store, .{ .node = param, .handle = handle }, decl, encoding, context, handler);
}
},
.Slice => {
const slice = node.castTag(.Slice).?;
try symbolReferencesInternal(arena, store, .{ .node = slice.lhs, .handle = handle }, decl, encoding, context, handler);
try symbolReferencesInternal(arena, store, .{ .node = slice.start, .handle = handle }, decl, encoding, context, handler);
if (slice.end) |end| {
try symbolReferencesInternal(arena, store, .{ .node = end, .handle = handle }, decl, encoding, context, handler);
}
if (slice.sentinel) |sentinel| {
try symbolReferencesInternal(arena, store, .{ .node = sentinel, .handle = handle }, decl, encoding, context, handler);
}
},
.ArrayAccess => {
const arr_acc = node.castTag(.ArrayAccess).?;
try symbolReferencesInternal(arena, store, .{ .node = arr_acc.lhs, .handle = handle }, decl, encoding, context, handler);
try symbolReferencesInternal(arena, store, .{ .node = arr_acc.index_expr, .handle = handle }, decl, encoding, context, handler);
},
.Deref, .UnwrapOptional => {
const suffix = node.cast(ast.Node.SimpleSuffixOp).?;
try symbolReferencesInternal(arena, store, .{ .node = suffix.lhs, .handle = handle }, decl, encoding, context, handler);
},
.GroupedExpression => {
const grouped = node.cast(ast.Node.GroupedExpression).?;
try symbolReferencesInternal(arena, store, .{ .node = grouped.expr, .handle = handle }, decl, encoding, context, handler);
},
.Return, .Break, .Continue => {
const cfe = node.cast(ast.Node.ControlFlowExpression).?;
if (cfe.getRHS()) |rhs| {
try symbolReferencesInternal(arena, store, .{ .node = rhs, .handle = handle }, decl, encoding, context, handler);
}
},
.Suspend => {
const suspend_node = node.cast(ast.Node.Suspend).?;
if (suspend_node.body) |body| {
try symbolReferencesInternal(arena, store, .{ .node = body, .handle = handle }, decl, encoding, context, handler);
}
},
.BuiltinCall => {
const builtin_call = node.cast(ast.Node.BuiltinCall).?;
for (builtin_call.paramsConst()) |param| {
try symbolReferencesInternal(arena, store, .{ .node = param, .handle = handle }, decl, encoding, context, handler);
}
},
// TODO Inline asm expr
.TestDecl => {
const test_decl = node.cast(ast.Node.TestDecl).?;
try symbolReferencesInternal(arena, store, .{ .node = test_decl.body_node, .handle = handle }, decl, encoding, context, handler);
},
.Period => {
const infix_op = node.cast(ast.Node.SimpleInfixOp).?;
try symbolReferencesInternal(arena, store, .{ .node = infix_op.lhs, .handle = handle }, decl, encoding, context, handler);
const rhs_str = analysis.nodeToString(handle.tree, infix_op.rhs) orelse return;
var bound_type_params = analysis.BoundTypeParams.init(&arena.allocator);
const left_type = try analysis.resolveFieldAccessLhsType(
store,
arena,
(try analysis.resolveTypeOfNodeInternal(store, arena, .{
.node = infix_op.lhs,
.handle = handle,
}, &bound_type_params)) orelse return,
&bound_type_params,
);
const left_type_node = switch (left_type.type.data) {
.other => |n| n,
else => return,
};
if (try analysis.lookupSymbolContainer(
store,
arena,
.{ .node = left_type_node, .handle = left_type.handle },
rhs_str,
!left_type.type.is_type_val,
)) |child| {
if (std.meta.eql(child, decl)) {
try tokenReference(handle, infix_op.rhs.firstToken(), encoding, context, handler);
}
}
},
.Add, .AddWrap, .ArrayCat, .ArrayMult, .Assign, .AssignBitAnd, .AssignBitOr, .AssignBitShiftLeft, .AssignBitShiftRight, .AssignBitXor, .AssignDiv, .AssignSub, .AssignSubWrap, .AssignMod, .AssignAdd, .AssignAddWrap, .AssignMul, .AssignMulWrap, .BangEqual, .BitAnd, .BitOr, .BitShiftLeft, .BitShiftRight, .BitXor, .BoolOr, .Div, .EqualEqual, .ErrorUnion, .GreaterOrEqual, .GreaterThan, .LessOrEqual, .LessThan, .MergeErrorSets, .Mod, .Mul, .MulWrap, .Range, .Sub, .SubWrap, .OrElse => {
const infix_op = node.cast(ast.Node.SimpleInfixOp).?;
try symbolReferencesInternal(arena, store, .{ .node = infix_op.lhs, .handle = handle }, decl, encoding, context, handler);
try symbolReferencesInternal(arena, store, .{ .node = infix_op.rhs, .handle = handle }, decl, encoding, context, handler);
},
else => {},
}
}
pub fn symbolReferences(
arena: *std.heap.ArenaAllocator,
store: *DocumentStore,
decl_handle: analysis.DeclWithHandle,
encoding: offsets.Encoding,
include_decl: bool,
context: anytype,
comptime handler: anytype,
) !void {
std.debug.assert(decl_handle.decl.* != .label_decl);
const curr_handle = decl_handle.handle;
switch (decl_handle.decl.*) {
.ast_node => |decl_node| {
var handles = std.ArrayList(*DocumentStore.Handle).init(&arena.allocator);
var handle_it = store.handles.iterator();
while (handle_it.next()) |entry| {
try handles.append(entry.value);
}
for (handles.items) |handle| {
if (include_decl and handle == curr_handle) {
try tokenReference(curr_handle, decl_handle.nameToken(), encoding, context, handler);
}
try symbolReferencesInternal(arena, store, .{ .node = &handle.tree.root_node.base, .handle = handle }, decl_handle, encoding, context, handler);
}
},
.param_decl => |param| {
// Rename the param tok.
if (include_decl) {
try tokenReference(curr_handle, decl_handle.nameToken(), encoding, context, handler);
}
const fn_node = loop: for (curr_handle.document_scope.scopes) |scope| {
switch (scope.data) {
.function => |proto| {
const fn_proto = proto.cast(std.zig.ast.Node.FnProto).?;
for (fn_proto.paramsConst()) |*candidate| {
if (candidate == param)
break :loop fn_proto;
}
},
else => {},
}
} else {
log.warn("Could not find param decl's function", .{});
return;
};
if (fn_node.getBodyNode()) |body| {
try symbolReferencesInternal(arena, store, .{ .node = body, .handle = curr_handle }, decl_handle, encoding, context, handler);
}
},
.pointer_payload, .array_payload, .switch_payload => {
if (include_decl) {
try tokenReference(curr_handle, decl_handle.nameToken(), encoding, context, handler);
}
try symbolReferencesInternal(arena, store, .{ .node = &curr_handle.tree.root_node.base, .handle = curr_handle }, decl_handle, encoding, context, handler);
},
.label_decl => unreachable,
}
} | src/references.zig |
const std = @import("std");
const ascii = std.ascii;
const fmt = std.fmt;
const heap = std.heap;
const io = std.io;
const log = std.log;
const mem = std.mem;
const process = std.process;
const niceware = @import("niceware.zig");
const usage =
\\Usage: niceware <command> [argument]
\\
\\Commands:
\\ from-bytes Convert bytes into a passphrase
\\ to-bytes Convert passphrase into bytes
\\ generate Generate a random passphrase
\\
\\General Options:
\\ -h, --help Print this message
\\
;
const usage_from_bytes =
\\Usage: niceware from-bytes [byte-string]
\\
\\Arguments:
\\ [byte-string] A hex string (example: 7a40bcb12c870b52)
\\
\\General Options:
\\ -h, --help Print this message
\\
;
const usage_to_bytes =
\\Usage: niceware to-bytes [passphrase]
\\
\\Arguments:
\\ [passphrase] A passphrase (example: <PASSWORD>)
\\
\\General Options:
\\ -h, --help Print this message
\\
;
const usage_generate =
\\Usage: niceware generate [size]
\\
\\Arguments:
\\ [size] Amount of bytes to use (default: 8)
\\
\\General Options:
\\ -h, --help Print this message
\\
;
// Determines if [what] is help, -h or --help.
fn isHelp(what: []const u8) bool {
return mem.eql(u8, what, "help") or mem.eql(u8, what, "-h") or mem.eql(u8, what, "--help");
}
// Determines if the string contains only digits (base 10).
fn isStringNumeric(s: []const u8) bool {
for (s) |c| {
// if any character is a non-digit, then it's not all digits
if (!ascii.isDigit(c)) return false;
}
return true;
}
test "isStringNumeric" {
std.testing.expect(isStringNumeric("123"));
std.testing.expect(isStringNumeric("0123"));
}
test "!isStringNumeric" {
std.testing.expect(isStringNumeric("+123"));
std.testing.expect(isStringNumeric("numeric"));
}
fn generate(ally: *mem.Allocator, writer: anytype, args: [][]const u8) !void {
if (args.len == 0) {
const passphrase = try niceware.generatePassphraseAlloc(ally, 8);
// first line is the bytes
const bytes = try niceware.passphraseToBytesAlloc(ally, passphrase);
try writer.print("{s}\n", .{fmt.fmtSliceHexLower(bytes)});
// second line is the passphrase
const joined = try mem.join(ally, " ", passphrase);
try writer.print("{s}\n", .{joined});
} else if (args.len == 1) {
const cmd = args[0];
if (isHelp(cmd)) {
try writer.writeAll(usage_generate);
} else if (isStringNumeric(cmd)) {
if (fmt.parseUnsigned(u11, cmd, 0)) |size| {
if (niceware.generatePassphraseAlloc(ally, size)) |passphrase| {
// first line is the bytes
const bytes = try niceware.passphraseToBytesAlloc(ally, passphrase);
try writer.print("{s}\n", .{fmt.fmtSliceHexLower(bytes)});
// second line is the passphrase
const joined = try mem.join(ally, " ", passphrase);
try writer.print("{s}\n", .{joined});
} else |err| switch (err) {
error.SizeTooLarge,
error.SizeTooSmall,
=> log.err("expected a number between {} and {}, got {}", .{
niceware.min_password_size,
niceware.max_password_size,
size,
}),
error.OddSize => log.err("expected an even number, got: {}", .{size}),
else => log.err("{}", .{err}),
}
} else |_| {
log.err("invalid number: {s}", .{cmd});
}
} else {
log.err("{s}", .{usage_generate});
log.err("unknown command: {s}", .{cmd});
}
} else {
try writer.writeAll(usage_generate);
}
}
fn toBytes(ally: *mem.Allocator, writer: anytype, args: [][]const u8) !void {
if (args.len >= 1) {
const cmd = args[0];
if (isHelp(cmd)) {
try writer.writeAll(usage_to_bytes);
} else {
if (niceware.passphraseToBytesAlloc(ally, args)) |bytes| {
try writer.print("{s}\n", .{fmt.fmtSliceHexLower(bytes)});
} else |err| switch (err) {
error.WordNotFound => {
if (niceware.getWordNotFound()) |word| {
log.err("invalid word entered: {s}", .{word});
} else {
log.err("invalid word entered", .{});
}
},
else => log.err("{}", .{err}),
}
}
} else {
try writer.writeAll(usage_to_bytes);
}
}
fn fromBytes(ally: *mem.Allocator, writer: anytype, args: [][]const u8) !void {
if (args.len == 1) {
const cmd = args[0];
if (isHelp(cmd)) {
try writer.writeAll(usage_from_bytes);
} else {
const size = cmd.len;
if (size == 0) {
log.err("input looks empty to me: {s}", .{cmd});
} else if (size % 2 != 0) {
log.err("input must be an even length, {} is not an even number", .{size});
} else {
var buf = try ally.alloc(u8, size / 2);
if (fmt.hexToBytes(buf, cmd)) |bytes| {
if (niceware.bytesToPassphraseAlloc(ally, bytes)) |passphrase| {
const joined = try mem.join(ally, " ", passphrase);
try writer.print("{s}\n", .{joined});
} else |err| switch (err) {
error.SizeTooSmall,
error.SizeTooLarge,
=> log.err("", .{}),
error.OddSize => log.err("", .{}),
else => log.err("{}", .{err}),
}
} else |_| {
log.err("unable to convert into passphrase: {s} (is this a valid hex string?)", .{cmd});
}
}
}
} else {
try writer.writeAll(usage_from_bytes);
}
}
pub fn main() anyerror!void {
var arena = heap.ArenaAllocator.init(heap.page_allocator);
defer arena.deinit();
const ally = &arena.allocator;
const stdout = io.getStdOut().writer();
const args = try process.argsAlloc(ally);
if (args.len <= 1) {
try stdout.writeAll(usage);
return;
}
const cmd = args[1];
const cmd_args = args[2..];
if (mem.eql(u8, cmd, "from-bytes")) {
try fromBytes(ally, stdout, cmd_args);
} else if (mem.eql(u8, cmd, "to-bytes")) {
try toBytes(ally, stdout, cmd_args);
} else if (mem.eql(u8, cmd, "generate")) {
try generate(ally, stdout, cmd_args);
} else if (isHelp(cmd)) {
try stdout.writeAll(usage);
} else {
try stdout.writeAll(usage);
log.err("unknown command: {s}", .{cmd});
}
} | src/main.zig |
const std = @import("std");
const warn = std.debug.warn;
const Ram = @import("ram.zig").Ram;
const Opcode = @import("opcode.zig").Opcode;
const OpcodeEnum = @import("enum.zig").OpcodeEnum;
const AddressingModeEnum = @import("enum.zig").AddressingModeEnum;
const IrqTypeEnum = @import("enum.zig").IrqTypeEnum;
pub const Cpu = struct {
program_counter: u16,
reg_a: u8,
reg_x: u8,
reg_y: u8,
f_carry: u8,
f_zero: u8,
f_interrupt_disable: u8,
f_interrupt_disable_temp: u8,
f_decimal: u8,
f_break: u8,
f_break_temp: u8,
f_unused: u8,
f_overflow: u8,
f_negative: u8,
interrupt_requested: bool,
interrupt_request_type: IrqTypeEnum,
cycles: u64,
ram: Ram,
pub fn init() Cpu {
var cpu = Cpu{
.program_counter = 0xC000,
.cycles = 0,
.reg_a = 0x00,
.reg_x = 0x00,
.reg_y = 0x00,
.f_carry = (0x24 >> 0) & 1,
.f_zero = (0x24 >> 1) & 1,
.f_interrupt_disable = (0x24 >> 2) & 1,
.f_interrupt_disable_temp = (0x24 >> 2) & 1,
.f_decimal = (0x24 >> 3) & 1,
.f_break = (0x24 >> 4) & 1,
.f_break_temp = (0x24 >> 4) & 1,
.f_unused = 0x01,
.f_overflow = (0x24 >> 6) & 1,
.f_negative = (0x24 >> 7) & 1,
.ram = Ram.init(),
.interrupt_requested = false,
.interrupt_request_type = IrqTypeEnum.IrqNone,
};
return cpu;
}
pub fn get_next_opcode_index(self: *Cpu) u8 {
return self.ram.read_8(self.program_counter);
}
pub fn request_interrupt(self: *Cpu, interrupt_request_type: IrqTypeEnum) void {
if (self.interrupt_requested and interrupt_request_type == IrqTypeEnum.IrqNormal) {
return;
}
self.interrupt_requested = true;
self.interrupt_request_type = interrupt_request_type;
}
pub fn set_status_flags(self: *Cpu, value: u8) void {
self.f_carry = (value >> 0) & 1;
self.f_zero = (value >> 1) & 1;
self.f_interrupt_disable = (value >> 2) & 1;
self.f_decimal = (value >> 3) & 1;
self.f_break = (value >> 4) & 1;
self.f_unused = 1;
self.f_overflow = (value >> 6) & 1;
self.f_negative = (value >> 7) & 1;
}
pub fn get_status_flags(self: *Cpu) u8 {
return self.f_carry |
(self.f_zero << 1) |
(self.f_interrupt_disable << 2) |
(self.f_decimal << 3) |
(self.f_break << 4) |
(1 << 5) |
(self.f_overflow << 6) |
(self.f_negative << 7);
}
fn update_zero_flag(self: *Cpu, value: u8) void {
if (value == 0x00) {
self.f_zero = 0x01;
} else {
self.f_zero = 0x00;
}
}
fn update_negative_flag(self: *Cpu, value: u8) void {
if ((value & 0x80) != 0x00) {
self.f_negative = 0x01;
} else {
self.f_negative = 0x00;
}
}
fn check_for_page_cross(self: *Cpu, address1: u16, address2: u16) bool {
return ((address1 & 0xFF00) != (address2 & 0xFF00));
}
pub fn resolve_address(self: *Cpu, addressing_mode: AddressingModeEnum) u16 {
var address: u16 = undefined;
switch (addressing_mode) {
AddressingModeEnum.Absolute => {
address = self.ram.read_16(self.program_counter);
},
AddressingModeEnum.AbsoluteX => {
address = self.ram.read_16(self.program_counter);
if (self.check_for_page_cross(address, address + self.reg_x)) {
self.cycles += 1;
}
address += self.reg_x;
},
AddressingModeEnum.AbsoluteY => {
address = self.ram.read_16(self.program_counter);
if (self.check_for_page_cross(address, address + self.reg_y)) {
self.cycles += 1;
}
address += self.reg_y;
},
AddressingModeEnum.Accumulator => {
address = self.reg_a;
},
AddressingModeEnum.Immediate => {
address = self.program_counter;
},
AddressingModeEnum.Implicit => {},
AddressingModeEnum.Indirect => {
var highByte: u16 = self.ram.read_8(self.program_counter);
var lowByte: u16 = self.ram.read_8(self.program_counter + 1);
address = (lowByte << 8) | highByte;
if (self.check_for_page_cross(address, address + 1)) {
lowByte = ((address << 8) + 1);
highByte = address & 0xFF00;
address = (lowByte << 8) | highByte;
} else {
address = self.ram.read_16(address);
}
},
AddressingModeEnum.IndirectX => {
var temp: u8 = self.ram.read_8(self.program_counter) +% self.reg_x;
address = temp;
if (self.check_for_page_cross(address, address + 1)) {
address = self.ram.read_16_with_bug(address);
} else {
address = self.ram.read_16(address);
}
},
AddressingModeEnum.IndirectY => {
address = self.ram.read_8(self.program_counter);
if (self.check_for_page_cross(address, address + 1)) {
address = self.ram.read_16_with_bug(address);
} else {
address = self.ram.read_16(address);
}
if (self.check_for_page_cross(address, address + self.reg_y)) {
self.cycles += 1;
}
address += self.reg_y;
},
AddressingModeEnum.Relative => {
var offset: u8 = self.ram.read_8(self.program_counter);
address = self.program_counter + offset;
if (offset >= 0x80) {
address -= 0x0100;
}
},
AddressingModeEnum.ZeroPage => {
address = self.ram.read_8(self.program_counter);
},
AddressingModeEnum.ZeroPageX => {
address = self.ram.read_8(self.program_counter) +% self.reg_x;
},
AddressingModeEnum.ZeroPageY => {
address = self.ram.read_8(self.program_counter) +% self.reg_y;
},
}
return address;
}
pub fn execute_instruction(self: *Cpu, opcode: Opcode, address: u16) void {
self.cycles += opcode.cycles;
var overflow: bool = @addWithOverflow(u16, self.program_counter, opcode.size, &self.program_counter);
switch (opcode.name) {
OpcodeEnum.AAC => _aac(self, address),
OpcodeEnum.AAX => _aax(self, address),
OpcodeEnum.ADC => _adc(self, address),
OpcodeEnum.AND => _and(self, address),
OpcodeEnum.ARR => _arr(self, address),
OpcodeEnum.ASL => if (opcode.addressing_mode == AddressingModeEnum.Accumulator) {
_asl_a(self);
} else {
_asl(self, address);
},
OpcodeEnum.ASR => _asr(self, address),
OpcodeEnum.ATX => _atx(self, address),
OpcodeEnum.AXA => _axa(self, address),
OpcodeEnum.AXS => _axs(self, address),
OpcodeEnum.BCC => _bcc(self, address),
OpcodeEnum.BCS => _bcs(self, address),
OpcodeEnum.BEQ => _beq(self, address),
OpcodeEnum.BIT => _bit(self, address),
OpcodeEnum.BMI => _bmi(self, address),
OpcodeEnum.BNE => _bne(self, address),
OpcodeEnum.BPL => _bpl(self, address),
OpcodeEnum.BRK => _brk(self, address),
OpcodeEnum.BVC => _bvc(self, address),
OpcodeEnum.BVS => _bvs(self, address),
OpcodeEnum.CLC => _clc(self, address),
OpcodeEnum.CLD => _cld(self, address),
OpcodeEnum.CLI => _cli(self, address),
OpcodeEnum.CLV => _clv(self, address),
OpcodeEnum.CMP => _cmp(self, address),
OpcodeEnum.CPX => _cpx(self, address),
OpcodeEnum.CPY => _cpy(self, address),
OpcodeEnum.DCP => _dcp(self, address),
OpcodeEnum.DEC => _dec(self, address),
OpcodeEnum.DEX => _dex(self, address),
OpcodeEnum.DEY => _dey(self, address),
OpcodeEnum.DOP => _dop(self, address),
OpcodeEnum.EOR => _eor(self, address),
OpcodeEnum.INC => _inc(self, address),
OpcodeEnum.INX => _inx(self, address),
OpcodeEnum.INY => _iny(self, address),
OpcodeEnum.ISC => _isc(self, address),
OpcodeEnum.JMP => _jmp(self, address),
OpcodeEnum.JSR => _jsr(self, address),
OpcodeEnum.KIL => _kil(self, address),
OpcodeEnum.LAR => _lar(self, address),
OpcodeEnum.LAX => _lax(self, address),
OpcodeEnum.LDA => _lda(self, address),
OpcodeEnum.LDX => _ldx(self, address),
OpcodeEnum.LDY => _ldy(self, address),
OpcodeEnum.LSR => if (opcode.addressing_mode == AddressingModeEnum.Accumulator) {
_lsr_a(self);
} else {
_lsr(self, address);
},
OpcodeEnum.NOP => _nop(self, address),
OpcodeEnum.ORA => _ora(self, address),
OpcodeEnum.PHA => _pha(self, address),
OpcodeEnum.PHP => _php(self, address),
OpcodeEnum.PLA => _pla(self, address),
OpcodeEnum.PLP => _plp(self, address),
OpcodeEnum.RLA => _rla(self, address),
OpcodeEnum.ROL => if (opcode.addressing_mode == AddressingModeEnum.Accumulator) {
_rol_a(self, address);
} else {
_rol(self, address);
},
OpcodeEnum.ROR => if (opcode.addressing_mode == AddressingModeEnum.Accumulator) {
_ror_a(self, address);
} else {
_ror(self, address);
},
OpcodeEnum.RRA => _rra(self, address),
OpcodeEnum.RTI => _rti(self, address),
OpcodeEnum.RTS => _rts(self, address),
OpcodeEnum.SBC => _sbc(self, address),
OpcodeEnum.SEC => _sec(self, address),
OpcodeEnum.SED => _sed(self, address),
OpcodeEnum.SEI => _sei(self, address),
OpcodeEnum.SLO => _slo(self, address),
OpcodeEnum.SRE => _sre(self, address),
OpcodeEnum.STA => _sta(self, address),
OpcodeEnum.STX => _stx(self, address),
OpcodeEnum.STY => _sty(self, address),
OpcodeEnum.SXA => _sxa(self, address),
OpcodeEnum.SYA => _sya(self, address),
OpcodeEnum.TAX => _tax(self, address),
OpcodeEnum.TAY => _tay(self, address),
OpcodeEnum.TOP => _top(self, address),
OpcodeEnum.TSX => _tsx(self, address),
OpcodeEnum.TXA => _txa(self, address),
OpcodeEnum.TXS => _txs(self, address),
OpcodeEnum.TYA => _tya(self, address),
OpcodeEnum.XAA => _xaa(self, address),
OpcodeEnum.XAS => _xas(self, address),
}
}
fn _aac(self: *Cpu, address: u16) void {
var value: u8 = undefined;
value = self.ram.read_8(address) & self.reg_a;
self.update_negative_flag(value);
self.update_zero_flag(value);
if (self.f_negative == 0x01) {
self.f_carry = 0x01;
}
}
fn _aax(self: *Cpu, address: u16) void {
var value: u8 = undefined;
value = self.reg_x & self.reg_a;
self.ram.write(address, value);
}
fn _adc(self: *Cpu, address: u16) void {
var value: u8 = undefined;
var overflow: bool = undefined;
var already_set_overflow: bool = false;
overflow = @addWithOverflow(u8, self.reg_a, self.f_carry, &self.reg_a);
if (overflow) {
self.f_carry = 0x01;
already_set_overflow = true;
}
overflow = @addWithOverflow(u8, self.ram.read_8(address), self.reg_a, &value);
self.reg_a = value;
if (!already_set_overflow) {
if (overflow) {
self.f_carry = 0x01;
} else {
self.f_carry = 0x00;
}
}
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _and(self: *Cpu, address: u16) void {
self.reg_a = self.reg_a & self.ram.read_8(address);
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _arr(self: *Cpu, address: u16) void {
// TODO
}
fn _asl(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
self.f_carry = (value >> 7) & 1;
value = value << 1;
self.update_zero_flag(value);
self.update_negative_flag(value);
self.ram.write(address, value);
}
fn _asl_a(self: *Cpu) void {
self.f_carry = (self.reg_a >> 7) & 1;
self.reg_a = self.reg_a << 1;
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _asr(self: *Cpu, address: u16) void {
// TODO
}
fn _atx(self: *Cpu, address: u16) void {
var value: u8 = self.reg_a | 0xEE;
value &= self.ram.read_8(address);
self.reg_a = value;
self.reg_x = value;
self.update_zero_flag(value);
self.update_negative_flag(value);
}
fn _axa(self: *Cpu, address: u16) void {
// TODO
}
fn _axs(self: *Cpu, address: u16) void {
// TODO
}
fn _bcc(self: *Cpu, address: u16) void {
if (self.f_carry == 0x00) {
if (self.check_for_page_cross(address, address + 1)) {
self.cycles += 2;
} else {
self.cycles += 1;
}
self.program_counter = address;
}
}
fn _bcs(self: *Cpu, address: u16) void {
if (self.f_carry == 0x01) {
if (self.check_for_page_cross(address, address + 1)) {
self.cycles += 2;
} else {
self.cycles += 1;
}
self.program_counter = address;
}
}
fn _beq(self: *Cpu, address: u16) void {
if (self.f_zero == 0x01) {
if (self.check_for_page_cross(address, address + 1)) {
self.cycles += 2;
} else {
self.cycles += 1;
}
self.program_counter = address;
}
}
fn _bit(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
self.update_zero_flag(value & self.reg_a);
self.f_overflow = (value >> 6) & 1;
self.f_negative = (value >> 7) & 1;
}
fn _bmi(self: *Cpu, address: u16) void {
if (self.f_negative == 0x01) {
if (self.check_for_page_cross(address, address + 1)) {
self.cycles += 2;
} else {
self.cycles += 1;
}
self.program_counter = address;
}
}
fn _bne(self: *Cpu, address: u16) void {
if (self.f_zero == 0x00) {
if (self.check_for_page_cross(address, address + 1)) {
self.cycles += 2;
} else {
self.cycles += 1;
}
self.program_counter = address;
}
}
fn _bpl(self: *Cpu, address: u16) void {
if (self.f_negative == 0x00) {
if (self.check_for_page_cross(address, address + 1)) {
self.cycles += 2;
} else {
self.cycles += 1;
}
self.program_counter = address;
}
}
fn _brk(self: *Cpu, address: u16) void {
// Forced interrupt
}
fn _bvc(self: *Cpu, address: u16) void {
if (self.f_overflow == 0x00) {
if (self.check_for_page_cross(address, address + 1)) {
self.cycles += 2;
} else {
self.cycles += 1;
}
self.program_counter = address;
}
}
fn _bvs(self: *Cpu, address: u16) void {
if (self.f_overflow == 0x01) {
if (self.check_for_page_cross(address, address + 1)) {
self.cycles += 2;
} else {
self.cycles += 1;
}
self.program_counter = address;
}
}
fn _clc(self: *Cpu, address: u16) void {
self.f_carry = 0x00;
}
fn _cld(self: *Cpu, address: u16) void {
self.f_decimal = 0x00;
}
fn _cli(self: *Cpu, address: u16) void {
self.f_interrupt_disable = 0x00;
}
fn _clv(self: *Cpu, address: u16) void {
self.f_overflow = 0x00;
}
fn _cmp(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
value = self.reg_a -% value;
if (value < 0x80) {
self.f_carry = 0x00;
} else {
self.f_carry = 0x01;
}
self.update_zero_flag(value);
self.update_negative_flag(value);
}
fn _cpx(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
value = self.reg_x -% value;
if (value < 0x80) {
self.f_carry = 0x00;
} else {
self.f_carry = 0x01;
}
self.update_zero_flag(value);
self.update_negative_flag(value);
}
fn _cpy(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
value = self.reg_y -% value;
if (value < 0x80) {
self.f_carry = 0x00;
} else {
self.f_carry = 0x01;
}
self.update_zero_flag(value);
self.update_negative_flag(value);
}
fn _dcp(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
value -%= 1;
self.ram.write(address, value);
value = self.reg_a - value;
if (value < 0x80) {
self.f_carry = 0x00;
} else {
self.f_carry = 0x01;
}
self.update_zero_flag(value);
self.update_negative_flag(value);
}
fn _dec(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
value -%= 1;
self.ram.write(address, value);
self.update_zero_flag(value);
self.update_negative_flag(value);
}
fn _dex(self: *Cpu, address: u16) void {
self.reg_x -%= 1;
self.update_zero_flag(self.reg_x);
self.update_negative_flag(self.reg_x);
}
fn _dey(self: *Cpu, address: u16) void {
self.reg_y -%= 1;
self.update_zero_flag(self.reg_y);
self.update_negative_flag(self.reg_y);
}
fn _dop(self: *Cpu, address: u16) void {
// TODO
}
fn _eor(self: *Cpu, address: u16) void {
self.reg_a ^= self.ram.read_8(address);
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _inc(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
value +%= 1;
self.ram.write(address, value);
self.update_zero_flag(value);
self.update_negative_flag(value);
}
fn _inx(self: *Cpu, address: u16) void {
self.reg_x +%= 1;
self.update_zero_flag(self.reg_x);
self.update_negative_flag(self.reg_x);
}
fn _iny(self: *Cpu, address: u16) void {
self.reg_y +%= 1;
self.update_zero_flag(self.reg_y);
self.update_negative_flag(self.reg_y);
}
fn _isc(self: *Cpu, address: u16) void {
// TODO
}
fn _jmp(self: *Cpu, address: u16) void {
self.program_counter = address;
}
fn _jsr(self: *Cpu, address: u16) void {
var value: u16 = self.program_counter;
var lowByte = @intCast(u8, (value >> 8) & 0xFF);
var highByte = @intCast(u8, value & 0xFF);
self.ram.push_to_stack(lowByte);
self.ram.push_to_stack(highByte);
self.program_counter = address;
}
fn _kil(self: *Cpu, address: u16) void {
// TODO
}
fn _lar(self: *Cpu, address: u16) void {
// TODO
}
fn _lax(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
self.reg_a = value;
self.reg_x = value;
self.update_zero_flag(value);
self.update_negative_flag(value);
}
fn _lda(self: *Cpu, address: u16) void {
self.reg_a = self.ram.read_8(address);
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _ldx(self: *Cpu, address: u16) void {
self.reg_x = self.ram.read_8(address);
self.update_zero_flag(self.reg_x);
self.update_negative_flag(self.reg_x);
}
fn _ldy(self: *Cpu, address: u16) void {
self.reg_y = self.ram.read_8(address);
self.update_zero_flag(self.reg_y);
self.update_negative_flag(self.reg_y);
}
fn _lsr_a(self: *Cpu) void {
self.f_carry = self.reg_a & 1;
self.reg_a = self.reg_a >> 1;
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _lsr(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
self.f_carry = value & 1;
value = value >> 1;
self.update_zero_flag(value);
self.update_negative_flag(value);
self.ram.write(address, value);
}
fn _nop(self: *Cpu, address: u16) void {
// TODO
}
fn _ora(self: *Cpu, address: u16) void {
self.reg_a |= self.ram.read_8(address);
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _pha(self: *Cpu, address: u16) void {
self.ram.push_to_stack(self.reg_a);
}
fn _php(self: *Cpu, address: u16) void {
var value: u8 = self.ram.pop_from_stack() ^ 0x10;
self.ram.push_to_stack(value);
}
fn _pla(self: *Cpu, address: u16) void {
self.reg_a = self.ram.pop_from_stack();
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _plp(self: *Cpu, address: u16) void {
self.set_status_flags(self.ram.pop_from_stack());
}
fn _rla(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
var old_carry = self.f_carry;
self.f_carry = ((value >> 7) & 1);
value = value << 1;
value |= (old_carry & 1);
self.update_zero_flag(value);
self.update_negative_flag(value);
self.ram.write(address, value);
self.reg_a &= value;
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _rol(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
var old_carry = self.f_carry;
self.f_carry = (value >> 7) & 1;
value = value << 1;
value |= (old_carry & 1);
self.ram.write(address, value);
self.update_zero_flag(value);
self.update_negative_flag(value);
}
fn _rol_a(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
var old_carry = self.f_carry;
self.f_carry = (value >> 7) & 1;
value = value << 1;
value |= (old_carry & 1);
self.reg_a = value;
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _ror(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
var old_carry = self.f_carry;
self.f_carry = value & 1;
value = value >> 1;
value |= ((old_carry & 1) << 7);
self.ram.write(address, value);
self.update_zero_flag(value);
self.update_negative_flag(value);
}
fn _ror_a(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
var old_carry = self.f_carry;
self.f_carry = value & 1;
value = value >> 1;
value |= ((old_carry & 1) << 7);
self.reg_a = value;
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _rra(self: *Cpu, address: u16) void {
// TODO
}
fn _rti(self: *Cpu, address: u16) void {
self.set_status_flags(self.ram.pop_from_stack());
self.program_counter = @intCast(u16, self.ram.pop_from_stack()) | (@intCast(u16, self.ram.pop_from_stack()) << 8);
}
fn _rts(self: *Cpu, address: u16) void {
self.program_counter = @intCast(u16, self.ram.pop_from_stack()) | (@intCast(u16, self.ram.pop_from_stack()) << 8);
}
fn _sbc(self: *Cpu, address: u16) void {
var value: u8 = undefined;
var overflow: bool = undefined;
var already_set_overflow: bool = false;
overflow = @subWithOverflow(u8, self.reg_a, self.f_carry, &self.reg_a);
if (overflow) {
self.f_carry = 0x01;
already_set_overflow = true;
}
overflow = @subWithOverflow(u8, self.reg_a, self.ram.read_8(address), &value);
self.reg_a = value;
if (!already_set_overflow) {
if (overflow) {
self.f_carry = 0x01;
} else {
self.f_carry = 0x00;
}
}
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _sec(self: *Cpu, address: u16) void {
self.f_carry = 0x01;
}
fn _sed(self: *Cpu, address: u16) void {
self.f_decimal = 0x01;
}
fn _sei(self: *Cpu, address: u16) void {
self.f_interrupt_disable = 0x01;
}
fn _slo(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
self.f_carry = (value >> 7) & 1;
self.update_zero_flag(value);
self.update_negative_flag(value);
value = value << 1;
self.ram.write(address, value);
self.reg_a |= value;
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _sre(self: *Cpu, address: u16) void {
var value: u8 = self.ram.read_8(address);
self.f_carry = (value >> 0) & 1;
self.update_zero_flag(value);
self.update_negative_flag(value);
value = value >> 1;
self.ram.write(address, value);
self.reg_a ^= value;
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _sta(self: *Cpu, address: u16) void {
self.ram.write(address, self.reg_a);
}
fn _stx(self: *Cpu, address: u16) void {
self.ram.write(address, self.reg_x);
}
fn _sty(self: *Cpu, address: u16) void {
self.ram.write(address, self.reg_y);
}
fn _sxa(self: *Cpu, address: u16) void {
// TODO
}
fn _sya(self: *Cpu, address: u16) void {
// TODO
}
fn _tay(self: *Cpu, address: u16) void {
// TODO
}
fn _tax(self: *Cpu, address: u16) void {
self.reg_x = self.reg_a;
self.update_zero_flag(self.reg_x);
self.update_negative_flag(self.reg_x);
}
fn _top(self: *Cpu, address: u16) void {
// TODO
}
fn _tsx(self: *Cpu, address: u16) void {
self.reg_x = self.ram.stack_pointer;
self.update_zero_flag(self.reg_x);
self.update_negative_flag(self.reg_x);
}
fn _txa(self: *Cpu, address: u16) void {
self.reg_a = self.reg_x;
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _txs(self: *Cpu, address: u16) void {
self.ram.stack_pointer = self.reg_x;
}
fn _tya(self: *Cpu, address: u16) void {
self.reg_a = self.reg_y;
self.update_zero_flag(self.reg_a);
self.update_negative_flag(self.reg_a);
}
fn _xaa(self: *Cpu, address: u16) void {
// TODO
}
fn _xas(self: *Cpu, address: u16) void {
// TODO
}
}; | src/cpu.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = true;
const assert = std.debug.assert;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
fn abs(a: i32) u32 {
return if (a > 0) @intCast(u32, a) else @intCast(u32, -a);
}
const Map = tools.Map(u48, 1000, 1000, true);
const Vec2 = tools.Vec2;
fn sum(grid: *const Map, p: Vec2) u48 {
var s: u48 = 0;
var y: i32 = -1;
while (y <= 1) : (y += 1) {
var x: i32 = -1;
while (x <= 1) : (x += 1) {
s += grid.get(Vec2{ .x = p.x + x, .y = p.y + y }) orelse 0;
}
}
return s;
}
pub fn main() anyerror!void {
const stdout = std.io.getStdOut().writer();
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
//const limit = 1 * 1024 * 1024 * 1024;
//const text = try std.fs.cwd().readFileAlloc(allocator, "day2.txt", limit);
//defer allocator.free(text);
var grid = Map{ .default_tile = 0 };
std.mem.set(u48, &grid.map, 0);
var p = Vec2{ .x = 0, .y = 0 };
var num: u48 = 1;
grid.set(p, 1);
var size: i32 = 1;
p.x += 1;
const req: u48 = 325489;
var ans1: ?Vec2 = null;
var ans2: ?u48 = null;
while (num < 500000) {
while (p.y > -size) : (p.y -= 1) {
num += 1;
if (num == req) ans1 = p;
if (ans2 == null) {
const s = sum(&grid, p);
grid.set(p, s);
if (s >= req) ans2 = s;
}
}
while (p.x > -size) : (p.x -= 1) {
num += 1;
if (num == req) ans1 = p;
if (ans2 == null) {
const s = sum(&grid, p);
grid.set(p, s);
if (s >= req) ans2 = s;
}
}
while (p.y < size) : (p.y += 1) {
num += 1;
if (num == req) ans1 = p;
if (ans2 == null) {
const s = sum(&grid, p);
grid.set(p, s);
if (s >= req) ans2 = s;
}
}
while (p.x <= size) : (p.x += 1) {
num += 1;
if (num == req) ans1 = p;
if (ans2 == null) {
const s = sum(&grid, p);
grid.set(p, s);
if (s >= req) ans2 = s;
}
}
size += 1;
}
var buf: [5000]u8 = undefined;
trace("map=\n{}\n", .{grid.printToBuf(p, null, &buf)});
try stdout.print("ans={}, dist={}, ans2={}\n\n", .{ ans1, abs(ans1.?.x) + abs(ans1.?.y), ans2 });
} | 2017/day3.zig |
const sf = @import("sfml");
pub fn main() !void {
inline for ([3]type{ sf.Vector2f, sf.Vector2i, sf.Vector2u }) |T| {
var vecf = T{ .x = 0, .y = 0 };
var c = vecf.toCSFML();
vecf = T.fromCSFML(c);
_ = vecf.add(vecf);
_ = vecf.substract(vecf);
_ = vecf.scale(1);
}
{
var vecf = sf.Vector3f{ .x = 0, .y = 0, .z = 0 };
var c = vecf.toCSFML();
vecf = sf.Vector3f.fromCSFML(c);
}
{
var col = sf.Color.fromRGB(0, 0, 0);
col = sf.Color.fromRGBA(0, 0, 0, 0);
col = sf.Color.fromInteger(0);
col = sf.Color.fromHSVA(0, 0, 0, 0);
var c = col.toCSFML();
col = sf.Color.fromCSFML(c);
_ = col.toInteger();
col = sf.Color.Black;
col = sf.Color.White;
col = sf.Color.Red;
col = sf.Color.Green;
col = sf.Color.Blue;
col = sf.Color.Yellow;
col = sf.Color.Magenta;
col = sf.Color.Cyan;
col = sf.Color.Transparent;
}
{
var clk = try sf.Clock.init();
defer clk.deinit();
_ = clk.restart();
_ = clk.getElapsedTime();
}
{
var tm = sf.Time.seconds(0);
tm = sf.Time.milliseconds(0);
tm = sf.Time.microseconds(0);
var c = tm.toCSFML();
tm = sf.Time.fromCSFML(c);
_ = tm.asSeconds();
_ = tm.asMilliseconds();
_ = tm.asMicroseconds();
sf.Time.sleep(sf.Time.Zero);
}
{
var ts = sf.TimeSpan.init(sf.Time.Zero, sf.Time.seconds(1));
var c = ts.toCSFML();
ts = sf.TimeSpan.fromCSFML(c);
}
{
_ = sf.Keyboard.isKeyPressed(.A);
}
{
_ = sf.Mouse.isButtonPressed(.Left);
_ = sf.Mouse.getPosition(null);
sf.Mouse.setPosition(.{.x = 3, .y = 3}, null);
}
{
var evt: sf.Event = undefined;
evt.resized = .{.size = .{.x = 3, .y = 3}};
_ = sf.Event.getEventCount();
}
{
var mus = try sf.Music.initFromFile("");
defer mus.deinit();
mus.play();
mus.pause();
mus.stop();
_ = mus.getDuration();
_ = mus.getPlayingOffset();
_ = mus.getLoopPoints();
_ = mus.getLoop();
_ = mus.getPitch();
_ = mus.getVolume();
mus.setVolume(1);
mus.setPitch(1);
mus.setLoop(true);
mus.setLoopPoints(sf.TimeSpan.init(sf.Time.Zero, sf.Time.seconds(1)));
mus.setPlayingOffset(sf.Time.Zero);
}
{
var win = try sf.RenderWindow.init(.{.x = 0, .y = 0}, 0, "");
defer win.deinit();
defer win.close();
_ = win.pollEvent();
_ = win.isOpen();
win.clear(sf.Color.Black);
win.draw(@as(sf.CircleShape, undefined), null);
win.display();
_ = win.getView();
_ = win.getDefaultView();
_ = win.getSize();
_ = win.getPosition();
win.setView(@as(sf.View, undefined));
win.setSize(.{ .x = 0, .y = 0 });
win.setPosition(.{ .x = 0, .y = 0 });
win.setTitle("");
win.setFramerateLimit(0);
win.setVerticalSyncEnabled(true);
_ = win.mapPixelToCoords(.{ .x = 0, .y = 0 }, null);
_ = win.mapCoordsToPixel(.{ .x = 0, .y = 0 }, null);
}
{
var tex = try sf.Texture.init(.{ .x = 10, .y = 10});
tex = try sf.Texture.initFromFile("");
tex = try sf.Texture.initFromImage(@as(sf.Image, undefined), null);
defer tex.deinit();
_ = tex.get();
tex.makeConst();
_ = try tex.copy();
_ = tex.getSize();
_ = tex.getPixelCount();
_ = try tex.updateFromPixels(@as([]const sf.Color, undefined), null);
_ = tex.updateFromImage(@as(sf.Image, undefined), null);
_ = tex.updateFromTexture(@as(sf.Texture, undefined), null);
_ = tex.isSmooth();
_ = tex.isRepeated();
_ = tex.isSrgb();
_ = tex.swap(@as(sf.Texture, undefined));
tex.setSmooth(true);
tex.setSrgb(true);
tex.setRepeated(true);
}
{
var img = try sf.Image.init(.{ .x = 10, .y = 10}, sf.Color.Red);
img = try sf.Image.initFromFile("");
img = try sf.Image.initFromPixels(.{ .x = 10, .y = 10}, @as([]const sf.Color, undefined));
defer img.deinit();
//var fct = sf.Image.getPixel;
img.setPixel(.{ .x = 1, .y = 1}, sf.Color.Blue);
_ = img.getSize();
}
} | src/sfml/doc_generation.zig |
const wlr = @import("../wlroots.zig");
const std = @import("std");
const os = std.os;
const wayland = @import("wayland");
const wl = wayland.server.wl;
const pixman = @import("pixman");
pub const SceneNode = extern struct {
pub const Type = enum(c_int) {
root,
tree,
surface,
rect,
buffer,
};
pub const State = extern struct {
link: wl.list.Link,
children: wl.list.Head(SceneNode.State, "link"),
enabled: bool,
x: c_int,
y: c_int,
};
type: Type,
parent: ?*SceneNode,
state: State,
events: extern struct {
destroy: wl.Signal(void),
},
data: usize,
extern fn wlr_scene_node_at(node: *SceneNode, lx: f64, ly: f64, nx: *f64, ny: *f64) ?*SceneNode;
pub const at = wlr_scene_node_at;
extern fn wlr_scene_node_coords(node: *SceneNode, lx: *c_int, ly: *c_int) bool;
pub const coords = wlr_scene_node_coords;
extern fn wlr_scene_node_destroy(node: *SceneNode) void;
pub const destroy = wlr_scene_node_destroy;
extern fn wlr_scene_node_for_each_surface(
node: *SceneNode,
iterator: fn (surface: *wlr.Surface, sx: c_int, sy: c_int, data: ?*anyopaque) callconv(.C) void,
user_data: ?*anyopaque,
) void;
pub inline fn forEachSurface(
node: *SceneNode,
comptime T: type,
iterator: fn (surface: *wlr.Surface, sx: c_int, sy: c_int, data: T) callconv(.C) void,
data: T,
) void {
wlr_scene_node_for_each_surface(
node,
@ptrCast(fn (surface: *wlr.Surface, sx: c_int, sy: c_int, data: ?*anyopaque) callconv(.C) void, iterator),
data,
);
}
extern fn wlr_scene_node_lower_to_bottom(node: *SceneNode) void;
pub const lowerToBottom = wlr_scene_node_lower_to_bottom;
extern fn wlr_scene_node_place_above(node: *SceneNode, sibling: *SceneNode) void;
pub const placeAbove = wlr_scene_node_place_above;
extern fn wlr_scene_node_place_below(node: *SceneNode, sibling: *SceneNode) void;
pub const placeBelow = wlr_scene_node_place_below;
extern fn wlr_scene_node_raise_to_top(node: *SceneNode) void;
pub const raiseToTop = wlr_scene_node_raise_to_top;
extern fn wlr_scene_node_reparent(node: *SceneNode, new_parent: *SceneNode) void;
pub const reparent = wlr_scene_node_reparent;
extern fn wlr_scene_node_set_enabled(node: *SceneNode, enabled: bool) void;
pub const setEnabled = wlr_scene_node_set_enabled;
extern fn wlr_scene_node_set_position(node: *SceneNode, x: c_int, y: c_int) void;
pub const setPosition = wlr_scene_node_set_position;
extern fn wlr_scene_tree_create(parent: *SceneNode) ?*SceneTree;
pub fn createSceneTree(parent: *SceneNode) !*SceneTree {
return wlr_scene_tree_create(parent) orelse error.OutOfMemory;
}
extern fn wlr_scene_surface_create(parent: *SceneNode, surface: *wlr.Surface) ?*SceneSurface;
pub fn createSceneSurface(parent: *SceneNode, surface: *wlr.Surface) !*SceneSurface {
return wlr_scene_surface_create(parent, surface) orelse error.OutOfMemory;
}
extern fn wlr_scene_rect_create(parent: *SceneNode, width: c_int, height: c_int, color: *const [4]f32) ?*SceneRect;
pub fn createSceneRect(parent: *SceneNode, width: c_int, height: c_int, color: *const [4]f32) !*SceneRect {
return wlr_scene_rect_create(parent, width, height, color) orelse error.OutOfMemory;
}
extern fn wlr_scene_buffer_create(parent: *SceneNode, buffer: *wlr.Buffer) ?*SceneBuffer;
pub fn createSceneBuffer(parent: *SceneNode, buffer: *wlr.Buffer) !*SceneBuffer {
return wlr_scene_buffer_create(parent, buffer) orelse error.OutOfMemory;
}
extern fn wlr_scene_subsurface_tree_create(parent: *SceneNode, surface: *wlr.Surface) ?*SceneNode;
pub fn createSceneSubsurfaceTree(parent: *SceneNode, surface: *wlr.Surface) !*SceneNode {
return wlr_scene_subsurface_tree_create(parent, surface) orelse error.OutOfMemory;
}
extern fn wlr_scene_xdg_surface_create(parent: *SceneNode, xdg_surface: *wlr.XdgSurface) ?*SceneNode;
pub fn createSceneXdgSurface(parent: *SceneNode, xdg_surface: *wlr.XdgSurface) !*SceneNode {
return wlr_scene_xdg_surface_create(parent, xdg_surface) orelse error.OutOfMemory;
}
};
pub const Scene = extern struct {
node: SceneNode,
outputs: wl.list.Head(SceneOutput, "link"),
// private state
presentation: ?*wlr.Presentation,
presentation_destroy: wl.Listener(void),
extern fn wlr_scene_create() ?*Scene;
pub fn create() !*Scene {
return wlr_scene_create() orelse error.OutOfMemory;
}
extern fn wlr_scene_attach_output_layout(scene: *Scene, output_layout: *wlr.OutputLayout) bool;
pub fn attachOutputLayout(scene: *Scene, output_layout: *wlr.OutputLayout) !void {
if (!wlr_scene_attach_output_layout(scene, output_layout)) return error.OutOfMemory;
}
extern fn wlr_scene_get_scene_output(scene: *Scene, output: *wlr.Output) ?*SceneOutput;
pub const getSceneOutput = wlr_scene_get_scene_output;
extern fn wlr_scene_render_output(scene: *Scene, output: *wlr.Output, lx: c_int, ly: c_int, damage: ?*pixman.Region32) void;
pub const renderOutput = wlr_scene_render_output;
extern fn wlr_scene_set_presentation(scene: *Scene, presentation: *wlr.Presentation) void;
pub const setPresentation = wlr_scene_set_presentation;
extern fn wlr_scene_output_create(scene: *Scene, output: *wlr.Output) ?*SceneOutput;
pub fn createSceneOutput(scene: *Scene, output: *wlr.Output) !*SceneOutput {
return wlr_scene_output_create(scene, output) orelse error.OutOfMemory;
}
};
pub const SceneTree = extern struct {
node: SceneNode,
};
pub const SceneSurface = extern struct {
node: SceneNode,
surface: *wlr.Surface,
primary_output: ?*wlr.Output,
// private state
prev_width: c_int,
prev_height: c_int,
surface_destroy: wl.Listener(void),
surface_commit: wl.Listener(void),
extern fn wlr_scene_surface_from_node(node: *SceneNode) *SceneSurface;
pub const fromNode = wlr_scene_surface_from_node;
};
pub const SceneRect = extern struct {
node: SceneNode,
width: c_int,
height: c_int,
color: [4]f32,
extern fn wlr_scene_rect_set_color(rect: *SceneRect, color: *const [4]f32) void;
pub const setColor = wlr_scene_rect_set_color;
extern fn wlr_scene_rect_set_size(rect: *SceneRect, width: c_int, height: c_int) void;
pub const setSize = wlr_scene_rect_set_size;
};
pub const SceneBuffer = extern struct {
node: SceneNode,
buffer: *wlr.Buffer,
// private state
texture: ?*wlr.Texture,
src_box: wlr.FBox,
dst_width: c_int,
dst_height: c_int,
transform: wl.Output.Transform,
extern fn wlr_scene_buffer_set_dest_size(scene_buffer: *SceneBuffer, width: c_int, height: c_int) void;
pub const setDestSize = wlr_scene_buffer_set_dest_size;
extern fn wlr_scene_buffer_set_source_box(scene_buffer: *SceneBuffer, box: *const wlr.FBox) void;
pub const setSourceBox = wlr_scene_buffer_set_source_box;
extern fn wlr_scene_buffer_set_transform(scene_buffer: *SceneBuffer, transform: wl.Output.Transform) void;
pub const setTransform = wlr_scene_buffer_set_transform;
};
pub const SceneOutput = extern struct {
output: *wlr.Output,
/// Scene.outputs
link: wl.list.Link,
scene: *Scene,
addon: wlr.Addon,
damage: *wlr.OutputDamage,
x: c_int,
y: c_int,
// private state
prev_scanout: bool,
extern fn wlr_scene_output_commit(scene_output: *SceneOutput) bool;
pub const commit = wlr_scene_output_commit;
extern fn wlr_scene_output_destroy(scene_output: *SceneOutput) void;
pub const destroy = wlr_scene_output_destroy;
extern fn wlr_scene_output_for_each_surface(
scene_output: *SceneOutput,
iterator: fn (surface: *wlr.Surface, sx: c_int, sy: c_int, data: ?*anyopaque) callconv(.C) void,
user_data: ?*anyopaque,
) void;
pub inline fn forEachSurface(
scene_output: *SceneOutput,
comptime T: type,
iterator: fn (surface: *wlr.Surface, sx: c_int, sy: c_int, data: T) callconv(.C) void,
data: T,
) void {
wlr_scene_output_for_each_surface(
scene_output,
@ptrCast(fn (surface: *wlr.Surface, sx: c_int, sy: c_int, data: ?*anyopaque) callconv(.C) void, iterator),
data,
);
}
extern fn wlr_scene_output_send_frame_done(scene_output: *SceneOutput, now: *os.timespec) void;
pub const sendFrameDone = wlr_scene_output_send_frame_done;
extern fn wlr_scene_output_set_position(scene_output: *SceneOutput, lx: c_int, ly: c_int) void;
pub const setPosition = wlr_scene_output_set_position;
}; | src/types/scene.zig |
const std = @import("std");
const math = std.math;
const assert = std.debug.assert;
const warn = std.debug.warn;
const Allocator = std.mem.Allocator;
pub const max_num_lit = 286;
pub const max_bits_limit = 16;
const max_i32 = math.maxInt(i32);
pub var fixed_literal_encoding = &Huffman.generateFixedLiteralEncoding();
pub var fixed_offset_encoding = &Huffman.generateFixedOffsetEncoding();
pub const Huffman = struct {
codes: [max_num_lit]Code,
codes_len: usize,
freq_cache: [max_num_lit]LitaralNode,
bit_count: [17]i32,
/// sorted by literal
lns: LiteralList,
///sorted by freq
lfs: LiteralList,
pub const Code = struct {
code: u16,
len: u16,
};
pub const LitaralNode = struct {
literal: u16,
freq: i32,
pub fn max() LitaralNode {
return LitaralNode{
.literal = math.maxInt(u16),
.freq = math.maxInt(i32),
};
}
pub const SortBy = enum {
Literal,
Freq,
};
fn sort(ls: []LitaralNode, by: SortBy) void {
switch (by) {
.Literal => {
std.sort.sort(LitaralNode, ls, sortByLiteralFn);
},
.Freq => {
std.sort.sort(LitaralNode, ls, sortByFreqFn);
},
}
}
fn sortByLiteralFn(lhs: LitaralNode, rhs: LitaralNode) bool {
return lhs.literal < rhs.literal;
}
fn sortByFreqFn(lhs: LitaralNode, rhs: LitaralNode) bool {
if (lhs.freq == rhs.freq) {
return lhs.literal < rhs.literal;
}
return lhs.freq < rhs.freq;
}
};
pub const LiteralList = std.ArrayList(LitaralNode);
const LevelInfo = struct {
level: i32,
last_freq: i32,
next_char_freq: i32,
next_pair_freq: i32,
needed: i32,
};
pub fn init(size: usize) Huffman {
assert(size <= max_num_lit);
var h: Huffman = undefined;
h.codes_len = size;
return h;
}
pub fn initAlloc(allocator: *Allocator, size: usize) Huffman {
var h = init(size);
h.lhs = LiteralList.init(a);
h.rhs = LiteralList.init(a);
return h;
}
pub fn generateFixedLiteralEncoding() Huffman {
var h = init(max_num_lit);
var codes = h.codes[0..h.codes_len];
var ch: u16 = 0;
while (ch < max_num_lit) : (ch += 1) {
var bits: u16 = 0;
var size: u16 = 0;
if (ch < 144) {
// size 8, 000110000 .. 10111111
bits = ch + 48;
size = 8;
} else if (ch < 256) {
// size 9, 110010000 .. 111111111
bits = ch + 400 - 144;
size = 9;
} else if (ch < 280) {
// size 7, 0000000 .. 0010111
bits = ch - 256;
size = 7;
} else {
// size 8, 11000000 .. 11000111
bits = ch + 192 - 280;
size = 8;
}
codes[@intCast(usize, ch)] = Code{
.code = reverseBits(bits, size),
.len = size,
};
}
return h;
}
pub fn generateFixedOffsetEncoding() Huffman {
var h = init(30);
var codes = h.codes[0..h.codes_len];
var i: usize = 0;
while (i < h.codes_len) : (i += 1) {
codes[i] = Code{
.code = reverseBits(@intCast(u16, i), 5),
.len = 5,
};
}
return h;
}
pub fn bitLength(self: *Huffman, freq: []i32) isize {
var total: isize = 0;
for (freq) |f, i| {
if (f != 0) {
total += @intCast(isize, f) + @intCast(isize, h.codes[i].len);
}
}
return total;
}
pub fn bitCounts(self: *Huffman, list: LitaralNode, max_bits_arg: i32) []i32 {
var amx_bits = max_bits_arg;
assert(max_bits <= max_bits_limit);
const n = @intCast(i32, list.len);
var last_node = n + 1;
if (max_bits > n - 1) {
max_bits = n - 1;
}
var levels: [max_bits_limit]LevelInfo = undefined;
var leaf_counts: [max_bits_limit][max_bits_limit]i32 = undefined;
var level: i32 = 0;
while (level <= max_bits) : (level += 1) {
levels[@intCast(usize, level)] = LevelInfo{
.level = level,
.last_freq = list[1].freq,
.next_char_freq = list[2].freq,
.next_pair_freq = list[0].freq + list[1].freq,
};
leaf_counts[level][level] = 2;
if (level == 1) {
levels[@intCast(usize, level)].next_pair_freq = max_i32;
}
}
levels[max_bits].needed = 2 * n - 4;
level = max_bits;
while (true) {
var l = &levels[@intCast(usize, level)];
if (l.next_pair_freq == max_i32 and l.next_char_freq == max_i32) {
l.needed = 0;
levels[@intCast(usize, level + 1)].next_pair_freq = max_i32;
level += 1;
continue;
}
const prev_freq = l.last_freq;
if (l.next_char_freq < l.next_pair_freq) {
const nx = leaf_counts[level][level] + 1;
l.last_freq = l.next_char_freq;
leaf_counts[level][level] = nx;
l.next_char_freq = if (nx == last_node) LitaralNode.max().freq else list[nx].freq;
} else {
l.last_freq = l.next_pair_freq;
mem.copy(i32, leaf_counts[level][0..level], leaf_counts[level - 1][0..level]);
levels[l.level - 1].needed = 2;
l.needed -= 1;
if (l.needed == 0) {
if (l.level == max_bits) {
break;
}
levels[l.level + 1].next_pair_freq = prev_freq + l.last_freq;
level += 1;
} else {
while (level - 1 >= 0 and levels[level - 1].needed > 0) : (level -= 1) {}
}
}
}
if (leaf_counts[max_bits][max_bits] != n) {
@panic("leaf_counts[max_bits][max_bits] != n");
}
var bit_count = self.bit_count[0 .. max_bits + 1];
var bits = 1;
const counts = leaf_counts[max_bits];
level = max_bits;
while (level > 0) : (level -= 1) {
bit_count[bits] = counts[level] - counts[level - 1];
bits += 1;
}
return bit_count;
}
/// Look at the leaves and assign them a bit count and an encoding as specified
/// in RFC 1951 3.2.2
pub fn assignEncodingAndSize(
self: *Huffman,
bit_count: []const i32,
list: []LitaralNode,
) !void {
var ls = list;
var code: u16 = 0;
for (bit_count) |bits, n| {
code = math.shl(u16, code, 1);
if (n == 0 or bits == 0) {
continue;
}
// The literals list[len(list)-bits] .. list[len(list)-bits]
// are encoded using "bits" bits, and get the values
// code, code + 1, .... The code values are
// assigned in literal order (not frequency order).
var chunk = ls[ls.len - @intCast(usize, bits) ..];
LitaralNode.sort(chunk, .Literal);
try self.lhs.append(chunk);
for (chunk) |node| {
self.codes[@intCast(usize, node.literal)] = Code{
.code = reverseBits(code, @intCast(u16, n)),
.len = @intCast(u16, n),
};
}
ls = ls[0 .. ls.len - @intCast(usize, bits)];
}
}
pub fn generate(
self: *Huffman,
freq: []const i32,
max_bits: i32,
) !void {
var list = self.freq_cache[0 .. freq.len + 1];
var count: usize = 0;
for (freq) |f, i| {
if (f != 0) {
list[count] = LitaralNode{
.literal = @intCast(u16, i),
.freq = f,
};
count += 1;
} else {
ls[count] = LitaralNode{
.literal = 0,
.freq = 0,
};
self.codes[i].len = 0;
}
}
ls[freq.len] = LitaralNode{
.literal = 0,
.freq = 0,
};
ls = ls[0..count];
if (count <= 2) {
for (ls) |node, i| {
// Handle the small cases here, because they are awkward for the general case code. With
// two or fewer literals, everything has bit length 1.
var x = &self.codes[@intCast(usize, node.literal)];
x.code = @intCast(u16, i);
x.len = 1;
}
return;
}
LitaralNode.sort(ls, .Freq);
try self.lfs.append(ls);
const bit_counts = try self.bitCounts(ls, max_bits);
try self.assignEncodingAndSize(bit_count, ls);
}
};
fn reverseBits(number: u16, bit_length: u16) u16 {
return @bitReverse(u16, math.shl(u16, number, 16 - bit_length));
} | src/compress/flate/huffman.zig |
const std = @import("std");
const zlib = std.compress.zlib;
const Allocator = std.mem.Allocator;
const ArrayListUnmanaged = std.ArrayListUnmanaged;
const File = std.fs.File;
const Reader = File.Reader;
pub const AsepriteImportError = error{
InvalidFile,
InvalidFrameHeader,
};
pub const ChunkType = enum(u16) {
OldPaletteA = 0x0004,
OldPaletteB = 0x0011,
Layer = 0x2004,
Cel = 0x2005,
CelExtra = 0x2006,
ColorProfile = 0x2007,
Mask = 0x2016,
Path = 0x2017,
Tags = 0x2018,
Palette = 0x2019,
UserData = 0x2020,
Slices = 0x2022,
Tileset = 0x2023,
_,
};
pub const ColorDepth = enum(u16) {
indexed = 8,
grayscale = 16,
rgba = 32,
};
pub const PaletteFlags = packed struct {
has_name: bool,
padding: u15 = 0,
};
pub const RGBA = struct {
r: u8,
g: u8,
b: u8,
a: u8,
pub fn deserializeOld(reader: Reader) !RGBA {
return RGBA{
.r = try reader.readIntLittle(u8),
.g = try reader.readIntLittle(u8),
.b = try reader.readIntLittle(u8),
.a = 255,
};
}
pub fn deserializeNew(reader: Reader) !RGBA {
return RGBA{
.r = try reader.readIntLittle(u8),
.g = try reader.readIntLittle(u8),
.b = try reader.readIntLittle(u8),
.a = try reader.readIntLittle(u8),
};
}
pub fn format(self: RGBA, comptime fmt: []const u8, options: std.fmt.FormatOptions, stream: anytype) !void {
_ = fmt;
_ = options;
try stream.print("RGBA({d:>3}, {d:>3}, {d:>3}, {d:>3})", .{ self.r, self.g, self.b, self.a });
}
};
pub const Palette = struct {
colors: []RGBA,
/// index for transparent color in indexed sprites
transparent_index: u8,
names: [][]const u8,
pub fn deserializeOld(prev_pal: Palette, reader: Reader) !Palette {
var pal = prev_pal;
const packets = try reader.readIntLittle(u16);
var skip: usize = 0;
var i: u16 = 0;
while (i < packets) : (i += 1) {
skip += try reader.readIntLittle(u8);
const size: u16 = val: {
const s = try reader.readIntLittle(u8);
break :val if (s == 0) @as(u16, 256) else s;
};
for (pal.colors[skip .. skip + size]) |*entry, j| {
entry.* = try RGBA.deserializeOld(reader);
pal.names[skip + j] = "";
}
}
return pal;
}
pub fn deserializeNew(prev_pal: Palette, allocator: Allocator, reader: Reader) !Palette {
var pal = prev_pal;
const size = try reader.readIntLittle(u32);
if (pal.colors.len != size) {
pal.colors = try allocator.realloc(pal.colors, size);
pal.names = try allocator.realloc(pal.names, size);
}
const from = try reader.readIntLittle(u32);
const to = try reader.readIntLittle(u32);
try reader.skipBytes(8, .{});
for (pal.colors[from .. to + 1]) |*entry, i| {
const flags = try reader.readStruct(PaletteFlags);
entry.* = try RGBA.deserializeNew(reader);
if (flags.has_name)
pal.names[from + i] = try readSlice(u8, u16, allocator, reader)
else
pal.names[from + i] = "";
}
return pal;
}
};
pub const LayerFlags = packed struct {
visible: bool,
editable: bool,
lock_movement: bool,
background: bool,
prefer_linked_cels: bool,
collapsed: bool,
reference: bool,
padding: u9 = 0,
};
pub const LayerType = enum(u16) {
normal,
group,
tilemap,
};
pub const LayerBlendMode = enum(u16) {
normal,
multiply,
screen,
overlay,
darken,
lighten,
color_dodge,
color_burn,
hard_light,
soft_light,
difference,
exclusion,
hue,
saturation,
color,
luminosity,
addition,
subtract,
divide,
};
pub const Layer = struct {
flags: LayerFlags,
type: LayerType,
child_level: u16,
blend_mode: LayerBlendMode,
opacity: u8,
name: []const u8,
user_data: UserData,
pub fn deserialize(allocator: Allocator, reader: Reader) !Layer {
var result: Layer = undefined;
result.flags = try reader.readStruct(LayerFlags);
result.type = try reader.readEnum(LayerType, .Little);
result.child_level = try reader.readIntLittle(u16);
try reader.skipBytes(4, .{});
result.blend_mode = try reader.readEnum(LayerBlendMode, .Little);
result.opacity = try reader.readIntLittle(u8);
try reader.skipBytes(3, .{});
result.name = try readSlice(u8, u16, allocator, reader);
result.user_data = UserData{ .text = "", .color = [4]u8{ 0, 0, 0, 0 } };
return result;
}
};
pub const ImageCel = struct {
width: u16,
height: u16,
pixels: []u8,
pub fn deserialize(
color_depth: ColorDepth,
compressed: bool,
allocator: Allocator,
reader: Reader,
) !ImageCel {
var result: ImageCel = undefined;
result.width = try reader.readIntLittle(u16);
result.height = try reader.readIntLittle(u16);
const size = @intCast(usize, result.width) *
@intCast(usize, result.height) *
@intCast(usize, @enumToInt(color_depth) / 8);
result.pixels = try allocator.alloc(u8, size);
errdefer allocator.free(result.pixels);
if (compressed) {
var zlib_stream = try zlib.zlibStream(allocator, reader);
defer zlib_stream.deinit();
_ = try zlib_stream.reader().readAll(result.pixels);
} else {
try reader.readNoEof(result.pixels);
}
return result;
}
};
pub const LinkedCel = struct {
frame: u16,
pub fn deserialize(reader: Reader) !LinkedCel {
return LinkedCel{ .frame = try reader.readIntLittle(u16) };
}
};
pub const CelType = enum(u16) {
raw_image,
linked,
compressed_image,
compressed_tilemap,
};
pub const CelData = union(CelType) {
raw_image: ImageCel,
linked: LinkedCel,
compressed_image: ImageCel,
compressed_tilemap: void,
};
pub const Cel = struct {
layer: u16,
x: i16,
y: i16,
opacity: u8,
data: CelData,
extra: CelExtra,
user_data: UserData,
pub fn deserialize(color_depth: ColorDepth, allocator: Allocator, reader: Reader) !Cel {
var result: Cel = undefined;
result.layer = try reader.readIntLittle(u16);
result.x = try reader.readIntLittle(i16);
result.y = try reader.readIntLittle(i16);
result.opacity = try reader.readIntLittle(u8);
const cel_type = try reader.readEnum(CelType, .Little);
try reader.skipBytes(7, .{});
result.data = switch (cel_type) {
.raw_image => CelData{
.raw_image = try ImageCel.deserialize(color_depth, false, allocator, reader),
},
.linked => CelData{
.linked = try LinkedCel.deserialize(reader),
},
.compressed_image => CelData{
.compressed_image = try ImageCel.deserialize(color_depth, true, allocator, reader),
},
.compressed_tilemap => CelData{
.compressed_tilemap = void{},
},
};
result.extra = CelExtra{ .x = 0, .y = 0, .width = 0, .height = 0 };
result.user_data = UserData{ .text = "", .color = [4]u8{ 0, 0, 0, 0 } };
return result;
}
};
pub const CelExtraFlags = packed struct {
precise_bounds: bool,
padding: u31 = 0,
};
/// This contains values stored in fixed point numbers stored in u32's, do not try to use these values directly
pub const CelExtra = struct {
x: u32,
y: u32,
width: u32,
height: u32,
pub fn isEmpty(self: CelExtra) bool {
return @bitCast(u128, self) == 0;
}
pub fn deserialize(reader: Reader) !CelExtra {
const flags = try reader.readStruct(CelExtraFlags);
if (flags.precise_bounds) {
return CelExtra{
.x = try reader.readIntLittle(u32),
.y = try reader.readIntLittle(u32),
.width = try reader.readIntLittle(u32),
.height = try reader.readIntLittle(u32),
};
} else {
return CelExtra{
.x = 0,
.y = 0,
.width = 0,
.height = 0,
};
}
}
};
pub const ColorProfileType = enum(u16) {
none,
srgb,
icc,
};
pub const ColorProfileFlags = packed struct {
special_fixed_gamma: bool,
padding: u15 = 0,
};
pub const ColorProfile = struct {
type: ColorProfileType,
flags: ColorProfileFlags,
/// this is a fixed point value stored in a u32, do not try to use it directly
gamma: u32,
icc_data: []const u8,
pub fn deserialize(allocator: Allocator, reader: Reader) !ColorProfile {
var result: ColorProfile = undefined;
result.type = try reader.readEnum(ColorProfileType, .Little);
result.flags = try reader.readStruct(ColorProfileFlags);
result.gamma = try reader.readIntLittle(u32);
try reader.skipBytes(8, .{});
// zig fmt: off
result.icc_data = if (result.type == .icc)
try readSlice(u8, u32, allocator, reader)
else
&[0]u8{};
// zig fmt: on
return result;
}
};
pub const AnimationDirection = enum(u8) {
forward,
reverse,
pingpong,
};
pub const Tag = struct {
from: u16,
to: u16,
direction: AnimationDirection,
color: [3]u8,
name: []const u8,
pub fn deserialize(allocator: Allocator, reader: Reader) !Tag {
var result: Tag = undefined;
result.from = try reader.readIntLittle(u16);
result.to = try reader.readIntLittle(u16);
result.direction = try reader.readEnum(AnimationDirection, .Little);
try reader.skipBytes(8, .{});
result.color = try reader.readBytesNoEof(3);
try reader.skipBytes(1, .{});
result.name = try readSlice(u8, u16, allocator, reader);
return result;
}
pub fn deserializeAll(allocator: Allocator, reader: Reader) ![]Tag {
const len = try reader.readIntLittle(u16);
try reader.skipBytes(8, .{});
const result = try allocator.alloc(Tag, len);
errdefer allocator.free(result);
for (result) |*tag| {
tag.* = try Tag.deserialize(allocator, reader);
}
return result;
}
};
pub const UserDataFlags = packed struct {
has_text: bool,
has_color: bool,
padding: u14 = 0,
};
pub const UserData = struct {
text: []const u8,
color: [4]u8,
pub const empty = UserData{ .text = "", .color = [4]u8{ 0, 0, 0, 0 } };
pub fn isEmpty(user_data: UserData) bool {
return user_data.text.len == 0 and @bitCast(u32, user_data.color) == 0;
}
pub fn deserialize(allocator: Allocator, reader: Reader) !UserData {
var result: UserData = undefined;
const flags = try reader.readStruct(UserDataFlags);
// zig fmt: off
result.text = if (flags.has_text)
try readSlice(u8, u16, allocator, reader)
else
"";
result.color = if (flags.has_color)
try reader.readBytesNoEof(4)
else
[4]u8{ 0, 0, 0, 0 };
// zig fmt: on
return result;
}
};
const UserDataChunks = union(enum) {
Layer: *Layer,
Cel: *Cel,
Slice: *Slice,
pub fn new(pointer: anytype) UserDataChunks {
const name = @typeName(@typeInfo(@TypeOf(pointer)).Pointer.child);
return @unionInit(UserDataChunks, name, pointer);
}
pub fn setUserData(self: UserDataChunks, user_data: UserData) void {
switch (self) {
.Layer => |p| p.*.user_data = user_data,
.Cel => |p| p.*.user_data = user_data,
.Slice => |p| p.*.user_data = user_data,
}
}
};
pub const SliceFlags = packed struct {
nine_patch: bool,
has_pivot: bool,
padding: u30 = 0,
};
pub const SliceKey = struct {
frame: u32,
x: i32,
y: i32,
width: u32,
height: u32,
center: struct {
x: i32,
y: i32,
width: u32,
height: u32,
},
pivot: struct {
x: i32,
y: i32,
},
pub fn deserialize(flags: SliceFlags, reader: Reader) !SliceKey {
var result: SliceKey = undefined;
result.frame = try reader.readIntLittle(u32);
result.x = try reader.readIntLittle(i32);
result.y = try reader.readIntLittle(i32);
result.width = try reader.readIntLittle(u32);
result.height = try reader.readIntLittle(u32);
result.center = if (flags.nine_patch) .{
.x = try reader.readIntLittle(i32),
.y = try reader.readIntLittle(i32),
.width = try reader.readIntLittle(u32),
.height = try reader.readIntLittle(u32),
} else .{
.x = 0,
.y = 0,
.width = 0,
.height = 0,
};
result.pivot = if (flags.has_pivot) .{
.x = try reader.readIntLittle(i32),
.y = try reader.readIntLittle(i32),
} else .{
.x = 0,
.y = 0,
};
return result;
}
};
pub const Slice = struct {
flags: SliceFlags,
name: []const u8,
keys: []SliceKey,
user_data: UserData,
pub fn deserialize(allocator: Allocator, reader: Reader) !Slice {
var result: Slice = undefined;
const key_len = try reader.readIntLittle(u32);
result.flags = try reader.readStruct(SliceFlags);
try reader.skipBytes(4, .{});
result.name = try readSlice(u8, u16, allocator, reader);
errdefer allocator.free(result.name);
result.keys = try allocator.alloc(SliceKey, key_len);
errdefer allocator.free(result.keys);
for (result.keys) |*key| {
key.* = try SliceKey.deserialize(result.flags, reader);
}
result.user_data = UserData{ .text = "", .color = [4]u8{ 0, 0, 0, 0 } };
return result;
}
};
pub const Frame = struct {
/// frame duration in miliseconds
duration: u16,
/// images contained within the frame
cels: []Cel,
pub const magic: u16 = 0xF1FA;
};
pub const FileHeaderFlags = packed struct {
layer_with_opacity: bool,
padding: u31 = 0,
};
pub const AsepriteImport = struct {
width: u16,
height: u16,
color_depth: ColorDepth,
flags: FileHeaderFlags,
pixel_width: u8,
pixel_height: u8,
grid_x: i16,
grid_y: i16,
/// zero if no grid
grid_width: u16,
/// zero if no grid
grid_height: u16,
palette: Palette,
color_profile: ColorProfile,
layers: []Layer,
slices: []Slice,
tags: []Tag,
frames: []Frame,
pub const magic: u16 = 0xA5E0;
pub fn deserialize(allocator: Allocator, reader: Reader) !AsepriteImport {
var result: AsepriteImport = undefined;
try reader.skipBytes(4, .{});
if (magic != try reader.readIntLittle(u16)) {
return error.InvalidFile;
}
const frame_count = try reader.readIntLittle(u16);
result.width = try reader.readIntLittle(u16);
result.height = try reader.readIntLittle(u16);
result.color_depth = try reader.readEnum(ColorDepth, .Little);
result.flags = try reader.readStruct(FileHeaderFlags);
try reader.skipBytes(10, .{});
const transparent_index = try reader.readIntLittle(u8);
try reader.skipBytes(3, .{});
var color_count = try reader.readIntLittle(u16);
result.pixel_width = try reader.readIntLittle(u8);
result.pixel_height = try reader.readIntLittle(u8);
result.grid_x = try reader.readIntLittle(i16);
result.grid_y = try reader.readIntLittle(i16);
result.grid_width = try reader.readIntLittle(u16);
result.grid_height = try reader.readIntLittle(u16);
if (color_count == 0)
color_count = 256;
if (result.pixel_width == 0 or result.pixel_height == 0) {
result.pixel_width = 1;
result.pixel_height = 1;
}
try reader.skipBytes(84, .{});
result.palette = Palette{
.colors = try allocator.alloc(RGBA, color_count),
.transparent_index = transparent_index,
.names = try allocator.alloc([]const u8, color_count),
};
errdefer {
allocator.free(result.palette.colors);
allocator.free(result.palette.names);
}
result.slices = &.{};
result.tags = &.{};
result.frames = try allocator.alloc(Frame, frame_count);
errdefer allocator.free(result.frames);
var layers = try ArrayListUnmanaged(Layer).initCapacity(allocator, 1);
errdefer layers.deinit(allocator);
var slices = try ArrayListUnmanaged(Slice).initCapacity(allocator, 0);
errdefer slices.deinit(allocator);
var using_new_palette = false;
var last_with_user_data: ?UserDataChunks = null;
for (result.frames) |*frame| {
var cels = try ArrayListUnmanaged(Cel).initCapacity(allocator, 0);
errdefer cels.deinit(allocator);
var last_cel: ?*Cel = null;
try reader.skipBytes(4, .{});
if (Frame.magic != try reader.readIntLittle(u16)) {
return error.InvalidFrameHeader;
}
const old_chunks = try reader.readIntLittle(u16);
frame.duration = try reader.readIntLittle(u16);
try reader.skipBytes(2, .{});
const new_chunks = try reader.readIntLittle(u32);
const chunks = if (old_chunks == 0xFFFF and old_chunks < new_chunks)
new_chunks
else
old_chunks;
var i: u32 = 0;
while (i < chunks) : (i += 1) {
const chunk_start = try reader.context.getPos();
const chunk_size = try reader.readIntLittle(u32);
const chunk_end = chunk_start + chunk_size;
const chunk_type = try reader.readEnum(ChunkType, .Little);
switch (chunk_type) {
.OldPaletteA, .OldPaletteB => {
if (!using_new_palette)
result.palette = try Palette.deserializeOld(result.palette, reader);
},
.Layer => {
try layers.append(allocator, try Layer.deserialize(allocator, reader));
last_with_user_data = UserDataChunks.new(&layers.items[layers.items.len - 1]);
},
.Cel => {
try cels.append(
allocator,
try Cel.deserialize(
result.color_depth,
allocator,
reader,
),
);
last_cel = &cels.items[cels.items.len - 1];
last_with_user_data = UserDataChunks.new(last_cel.?);
},
.CelExtra => {
const extra = try CelExtra.deserialize(reader);
if (last_cel) |c| {
c.extra = extra;
last_cel = null;
} else {
std.log.err("{s}\n", .{"Found extra cel chunk without cel to attach it to!"});
}
},
.ColorProfile => {
result.color_profile = try ColorProfile.deserialize(allocator, reader);
},
.Tags => {
result.tags = try Tag.deserializeAll(allocator, reader);
},
.Palette => {
using_new_palette = true;
result.palette = try Palette.deserializeNew(
result.palette,
allocator,
reader,
);
},
.UserData => {
const user_data = try UserData.deserialize(allocator, reader);
if (last_with_user_data) |chunk| {
chunk.setUserData(user_data);
last_with_user_data = null;
} else {
std.log.err("{s}\n", .{"Found user data chunk without chunk to attach it to!"});
}
},
.Slices => {
try slices.append(allocator, try Slice.deserialize(allocator, reader));
last_with_user_data = UserDataChunks.new(&slices.items[slices.items.len - 1]);
},
else => std.log.err("{s}: {x}\n", .{ "Unsupported chunk type", chunk_type }),
}
try reader.context.seekTo(chunk_end);
}
frame.cels = cels.toOwnedSlice(allocator);
errdefer allocator.free(frame.cels);
}
result.layers = layers.toOwnedSlice(allocator);
result.slices = slices.toOwnedSlice(allocator);
return result;
}
pub fn free(self: AsepriteImport, allocator: Allocator) void {
allocator.free(self.palette.colors);
for (self.palette.names) |name| {
if (name.len > 0)
allocator.free(name);
}
allocator.free(self.palette.names);
allocator.free(self.color_profile.icc_data);
for (self.layers) |layer| {
allocator.free(layer.name);
allocator.free(layer.user_data.text);
}
allocator.free(self.layers);
for (self.slices) |slice| {
allocator.free(slice.name);
allocator.free(slice.keys);
allocator.free(slice.user_data.text);
}
allocator.free(self.slices);
for (self.tags) |tag| {
allocator.free(tag.name);
}
allocator.free(self.tags);
for (self.frames) |frame| {
for (frame.cels) |cel| {
allocator.free(cel.user_data.text);
switch (cel.data) {
.raw_image => |raw| allocator.free(raw.pixels),
.compressed_image => |compressed| allocator.free(compressed.pixels),
else => {},
}
}
allocator.free(frame.cels);
}
allocator.free(self.frames);
}
};
fn readSlice(comptime SliceT: type, comptime LenT: type, allocator: Allocator, reader: Reader) ![]SliceT {
const len = (try reader.readIntLittle(LenT)) * @sizeOf(SliceT);
var bytes = try allocator.alloc(u8, len);
errdefer allocator.free(bytes);
try reader.readNoEof(bytes);
return std.mem.bytesAsSlice(SliceT, bytes);
}
pub fn import(allocator: Allocator, reader: Reader) !AsepriteImport {
return AsepriteImport.deserialize(allocator, reader);
} | tatl.zig |
const std = @import("std");
const c = @cImport({
@cInclude("bitfield-workaround.h");
@cInclude("aws/common/allocator.h");
@cInclude("aws/common/error.h");
@cInclude("aws/common/string.h");
@cInclude("aws/auth/auth.h");
@cInclude("aws/auth/credentials.h");
@cInclude("aws/auth/signable.h");
@cInclude("aws/auth/signing_config.h");
@cInclude("aws/auth/signing_result.h");
@cInclude("aws/auth/signing.h");
@cInclude("aws/http/connection.h");
@cInclude("aws/http/request_response.h");
@cInclude("aws/io/channel_bootstrap.h");
@cInclude("aws/io/tls_channel_handler.h");
@cInclude("aws/io/event_loop.h");
@cInclude("aws/io/socket.h");
@cInclude("aws/io/stream.h");
});
const CN_NORTH_1_HASH = std.hash_map.hashString("cn-north-1");
const CN_NORTHWEST_1_HASH = std.hash_map.hashString("cn-northwest-1");
const US_ISO_EAST_1_HASH = std.hash_map.hashString("us-iso-east-1");
const US_ISOB_EAST_1_HASH = std.hash_map.hashString("us-isob-east-1");
const httplog = std.log.scoped(.awshttp);
// Variables that can be re-used globally
var reference_count: u32 = 0;
var c_allocator: ?*c.aws_allocator = null;
var c_logger: c.aws_logger = .{
.vtable = null,
.allocator = null,
.p_impl = null,
};
// tls stuff initialized on demand, then destroyed in cDeinit
var tls_ctx_options: ?*c.aws_tls_ctx_options = null;
var tls_ctx: ?*c.aws_tls_ctx = null;
pub const AwsError = error{
AddHeaderError,
AlpnError,
CredentialsError,
HttpClientConnectError,
HttpRequestError,
SignableError,
SigningInitiationError,
TlsError,
RequestCreateError,
SetupConnectionError,
StatusCodeError,
SetRequestMethodError,
SetRequestPathError,
};
pub const Options = struct {
region: []const u8 = "aws-global",
dualstack: bool = false,
sigv4_service_name: ?[]const u8 = null,
};
const SigningOptions = struct {
region: []const u8 = "aws-global",
service: []const u8,
};
pub const HttpRequest = struct {
path: []const u8 = "/",
query: []const u8 = "",
body: []const u8 = "",
method: []const u8 = "POST",
content_type: []const u8 = "application/json", // Can we get away with this?
headers: []Header = &[_]Header{},
};
pub const HttpResult = struct {
response_code: u16, // actually 3 digits can fit in u10
body: []const u8,
headers: []Header,
allocator: std.mem.Allocator,
pub fn deinit(self: HttpResult) void {
self.allocator.free(self.body);
for (self.headers) |h| {
self.allocator.free(h.name);
self.allocator.free(h.value);
}
self.allocator.free(self.headers);
httplog.debug("http result deinit complete", .{});
return;
}
};
pub const Header = struct {
name: []const u8,
value: []const u8,
};
const EndPoint = struct {
uri: []const u8,
host: []const u8,
scheme: []const u8,
port: u16,
allocator: std.mem.Allocator,
fn deinit(self: EndPoint) void {
self.allocator.free(self.uri);
}
};
fn cInit(_: std.mem.Allocator) void {
// TODO: what happens if we actually get an allocator?
httplog.debug("auth init", .{});
c_allocator = c.aws_default_allocator();
// TODO: Grab logging level from environment
// See levels here:
// https://github.com/awslabs/aws-c-common/blob/ce964ca459759e685547e8aa95cada50fd078eeb/include/aws/common/logging.h#L13-L19
// We set this to FATAL mostly because we're handling errors for the most
// part here in zig-land. We would therefore set up for something like
// AWS_LL_WARN, but the auth library is bubbling up an AWS_LL_ERROR
// level message about not being able to open an aws config file. This
// could be an error, but we don't need to panic people if configuration
// is done via environment variables
var logger_options = c.aws_logger_standard_options{
// .level = .AWS_LL_WARN,
// .level = .AWS_LL_INFO,
// .level = .AWS_LL_DEBUG,
// .level = .AWS_LL_TRACE,
.level = 1, //.AWS_LL_FATAL, // https://github.com/awslabs/aws-c-common/blob/057746b2e094f4b7a31743d8ba5a9fd0155f69f3/include/aws/common/logging.h#L33
.file = c.get_std_err(),
.filename = null,
};
const rc = c.aws_logger_init_standard(&c_logger, c_allocator, &logger_options);
if (rc != c.AWS_OP_SUCCESS) {
std.debug.panic("Could not configure logging: {s}", .{c.aws_error_debug_str(c.aws_last_error())});
}
c.aws_logger_set(&c_logger);
// auth could use http library, so we'll init http, then auth
// TODO: determine deallocation of ca_path
c.aws_http_library_init(c_allocator);
c.aws_auth_library_init(c_allocator);
}
fn cDeinit() void { // probably the wrong name
if (tls_ctx) |ctx| {
httplog.debug("tls_ctx deinit start", .{});
c.aws_tls_ctx_release(ctx);
httplog.debug("tls_ctx deinit end", .{});
}
if (tls_ctx_options != null) {
// See:
// https://github.com/awslabs/aws-c-io/blob/6c7bae503961545c5e99c6c836c4b37749cfc4ad/source/tls_channel_handler.c#L25
//
// The way this structure is constructed (setupTls/makeRequest), the only
// thing we need to clean up here is the alpn_list, which is set by
// aws_tls_ctx_options_set_alpn_list to a constant value. My guess here
// is that memory is not allocated - the pointer is looking at the program data.
// So the pointer is non-zero, but cannot be deallocated, and we segfault
httplog.debug("tls_ctx_options deinit unnecessary - skipping", .{});
// log.debug("tls_ctx_options deinit start. alpn_list: {*}", .{opts.alpn_list});
// c.aws_string_destroy(opts.alpn_list);
// c.aws_tls_ctx_options_clean_up(opts);
// log.debug("tls_ctx_options deinit end", .{});
}
c.aws_http_library_clean_up();
httplog.debug("auth clean up start", .{});
c.aws_auth_library_clean_up();
httplog.debug("auth clean up complete", .{});
}
pub const AwsHttp = struct {
allocator: std.mem.Allocator,
bootstrap: *c.aws_client_bootstrap,
resolver: *c.aws_host_resolver,
eventLoopGroup: *c.aws_event_loop_group,
credentialsProvider: *c.aws_credentials_provider,
const Self = @This();
pub fn init(allocator: std.mem.Allocator) Self {
if (reference_count == 0) cInit(allocator);
reference_count += 1;
httplog.debug("auth ref count: {}", .{reference_count});
// TODO; determine appropriate lifetime for the bootstrap and credentials'
// provider
// Mostly stolen from aws_c_auth/credentials_tests.c
const el_group = c.aws_event_loop_group_new_default(c_allocator, 1, null);
var resolver_options = c.aws_host_resolver_default_options{
.el_group = el_group,
.max_entries = 8,
.shutdown_options = null, // not set in test
.system_clock_override_fn = null, // not set in test
};
const resolver = c.aws_host_resolver_new_default(c_allocator, &resolver_options);
const bootstrap_options = c.aws_client_bootstrap_options{
.host_resolver = resolver,
.on_shutdown_complete = null, // was set in test
.host_resolution_config = null,
.user_data = null,
.event_loop_group = el_group,
};
const bootstrap = c.aws_client_bootstrap_new(c_allocator, &bootstrap_options);
const provider_chain_options = c.aws_credentials_provider_chain_default_options{
.bootstrap = bootstrap,
.shutdown_options = c.aws_credentials_provider_shutdown_options{
.shutdown_callback = null, // was set on test
.shutdown_user_data = null,
},
};
return .{
.allocator = allocator,
.bootstrap = bootstrap,
.resolver = resolver,
.eventLoopGroup = el_group,
.credentialsProvider = c.aws_credentials_provider_new_chain_default(c_allocator, &provider_chain_options),
};
}
pub fn deinit(self: *AwsHttp) void {
if (reference_count > 0)
reference_count -= 1;
httplog.debug("deinit: auth ref count: {}", .{reference_count});
c.aws_credentials_provider_release(self.credentialsProvider);
// TODO: Wait for provider shutdown? https://github.com/awslabs/aws-c-auth/blob/c394e30808816a8edaab712e77f79f480c911d3a/tests/credentials_tests.c#L197
c.aws_client_bootstrap_release(self.bootstrap);
c.aws_host_resolver_release(self.resolver);
c.aws_event_loop_group_release(self.eventLoopGroup);
if (reference_count == 0) {
cDeinit();
httplog.debug("Deinit complete", .{});
}
}
/// callApi allows the calling of AWS APIs through a higher-level interface.
/// It will calculate the appropriate endpoint and action parameters for the
/// service called, and will set up the signing options. The return
/// value is simply a raw HttpResult
pub fn callApi(self: Self, service: []const u8, request: HttpRequest, options: Options) !HttpResult {
const endpoint = try regionSubDomain(self.allocator, service, options.region, options.dualstack);
defer endpoint.deinit();
httplog.debug("Calling endpoint {s}", .{endpoint.uri});
const signing_options: SigningOptions = .{
.region = options.region,
.service = if (options.sigv4_service_name) |name| name else service,
};
return try self.makeRequest(endpoint, request, signing_options);
}
/// makeRequest is a low level http/https function that can be used inside
/// or outside the context of AWS services. To use it outside AWS, simply
/// pass a null value in for signing_options.
///
/// Otherwise, it will simply take a URL endpoint (without path information),
/// HTTP method (e.g. GET, POST, etc.), and request body.
///
/// At the moment this does not allow the controlling of headers
/// This is likely to change. Current headers are:
///
/// Accept: application/json
/// User-Agent: zig-aws 1.0, Powered by the AWS Common Runtime.
/// Content-Type: application/x-www-form-urlencoded
/// Content-Length: (length of body)
///
/// Return value is an HttpResult, which will need the caller to deinit().
/// HttpResult currently contains the body only. The addition of Headers
/// and return code would be a relatively minor change
pub fn makeRequest(self: Self, endpoint: EndPoint, request: HttpRequest, signing_options: ?SigningOptions) !HttpResult {
// Since we're going to pass these into C-land, we need to make sure
// our inputs have sentinals
const method_z = try self.allocator.dupeZ(u8, request.method);
defer self.allocator.free(method_z);
// Path contains both path and query
const path_z = try std.fmt.allocPrintZ(self.allocator, "{s}{s}", .{ request.path, request.query });
defer self.allocator.free(path_z);
const body_z = try self.allocator.dupeZ(u8, request.body);
defer self.allocator.free(body_z);
httplog.debug("Path: {s}", .{path_z});
httplog.debug("Method: {s}", .{request.method});
httplog.debug("body length: {d}", .{request.body.len});
httplog.debug("Body\n====\n{s}\n====", .{request.body});
// TODO: Try to re-encapsulate this
// var http_request = try createRequest(method, path, body);
// TODO: Likely this should be encapsulated more
var http_request = c.aws_http_message_new_request(c_allocator);
defer c.aws_http_message_release(http_request);
if (c.aws_http_message_set_request_method(http_request, c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, method_z))) != c.AWS_OP_SUCCESS)
return AwsError.SetRequestMethodError;
if (c.aws_http_message_set_request_path(http_request, c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, path_z))) != c.AWS_OP_SUCCESS)
return AwsError.SetRequestPathError;
const body_cursor = c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, body_z));
const request_body = c.aws_input_stream_new_from_cursor(c_allocator, &body_cursor);
defer c.aws_input_stream_destroy(request_body);
if (request.body.len > 0)
c.aws_http_message_set_body_stream(http_request, request_body);
// End CreateRequest. This should return a struct with a deinit function that can do
// destroys, etc
var context = RequestContext{
.allocator = self.allocator,
};
defer context.deinit();
var tls_connection_options: ?*c.aws_tls_connection_options = null;
const host = try self.allocator.dupeZ(u8, endpoint.host);
defer self.allocator.free(host);
try self.addHeaders(http_request.?, host, request.body, request.content_type, request.headers);
if (std.mem.eql(u8, endpoint.scheme, "https")) {
// TODO: Figure out why this needs to be inline vs function call
// tls_connection_options = try self.setupTls(host);
if (tls_ctx_options == null) {
httplog.debug("Setting up tls options", .{});
// Language change - translate_c no longer translates c enums
// to zig enums as there were too many edge cases:
// https://github.com/ziglang/zig/issues/2115#issuecomment-827968279
var opts: c.aws_tls_ctx_options = .{
.allocator = c_allocator,
.minimum_tls_version = 128, // @intToEnum(c.aws_tls_versions, c.AWS_IO_TLS_VER_SYS_DEFAULTS), // https://github.com/awslabs/aws-c-io/blob/6c7bae503961545c5e99c6c836c4b37749cfc4ad/include/aws/io/tls_channel_handler.h#L21
.cipher_pref = 0, // @intToEnum(c.aws_tls_cipher_pref, c.AWS_IO_TLS_CIPHER_PREF_SYSTEM_DEFAULT), // https://github.com/awslabs/aws-c-io/blob/6c7bae503961545c5e99c6c836c4b37749cfc4ad/include/aws/io/tls_channel_handler.h#L25
.ca_file = c.aws_byte_buf_from_c_str(""),
.ca_path = c.aws_string_new_from_c_str(c_allocator, ""),
.alpn_list = null,
.certificate = c.aws_byte_buf_from_c_str(""),
.private_key = c.aws_byte_buf_from_c_str(""),
.max_fragment_size = 0,
.verify_peer = true,
};
tls_ctx_options = &opts;
c.aws_tls_ctx_options_init_default_client(tls_ctx_options.?, c_allocator);
// h2;http/1.1
if (c.aws_tls_ctx_options_set_alpn_list(tls_ctx_options, "http/1.1") != c.AWS_OP_SUCCESS) {
httplog.err("Failed to load alpn list with error {s}.", .{c.aws_error_debug_str(c.aws_last_error())});
return AwsError.AlpnError;
}
tls_ctx = c.aws_tls_client_ctx_new(c_allocator, tls_ctx_options.?);
if (tls_ctx == null) {
std.debug.panic("Failed to initialize TLS context with error {s}.", .{c.aws_error_debug_str(c.aws_last_error())});
}
httplog.debug("tls options setup applied", .{});
}
var conn_opts = c.aws_tls_connection_options{
.alpn_list = null,
.server_name = null,
.on_negotiation_result = null,
.on_data_read = null,
.on_error = null,
.user_data = null,
.ctx = null,
.advertise_alpn_message = false,
.timeout_ms = 0,
};
tls_connection_options = &conn_opts;
c.aws_tls_connection_options_init_from_ctx(tls_connection_options, tls_ctx);
var host_var = host;
var host_cur = c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, host_var));
if (c.aws_tls_connection_options_set_server_name(tls_connection_options, c_allocator, &host_cur) != c.AWS_OP_SUCCESS) {
httplog.err("Failed to set servername with error {s}.", .{c.aws_error_debug_str(c.aws_last_error())});
return AwsError.TlsError;
}
}
if (signing_options) |opts| try self.signRequest(http_request.?, opts);
const socket_options = c.aws_socket_options{
.type = 0, // @intToEnum(c.aws_socket_type, c.AWS_SOCKET_STREAM), // https://github.com/awslabs/aws-c-io/blob/6c7bae503961545c5e99c6c836c4b37749cfc4ad/include/aws/io/socket.h#L24
.domain = 0, // @intToEnum(c.aws_socket_domain, c.AWS_SOCKET_IPV4), // https://github.com/awslabs/aws-c-io/blob/6c7bae503961545c5e99c6c836c4b37749cfc4ad/include/aws/io/socket.h#L12
.connect_timeout_ms = 3000, // TODO: change hardcoded 3s value
.keep_alive_timeout_sec = 0,
.keepalive = false,
.keep_alive_interval_sec = 0,
// If set, sets the number of keep alive probes allowed to fail before the connection is considered
// lost. If zero OS defaults are used. On Windows, this option is meaningless until Windows 10 1703.
.keep_alive_max_failed_probes = 0,
};
const http_client_options = c.aws_http_client_connection_options{
.self_size = @sizeOf(c.aws_http_client_connection_options),
.socket_options = &socket_options,
.allocator = c_allocator,
.port = endpoint.port,
.host_name = c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, host)),
.bootstrap = self.bootstrap,
.initial_window_size = c.SIZE_MAX,
.tls_options = tls_connection_options,
.user_data = &context,
.proxy_options = null,
.monitoring_options = null,
.http1_options = null,
.http2_options = null,
.manual_window_management = false,
.on_setup = connectionSetupCallback,
.on_shutdown = connectionShutdownCallback,
};
if (c.aws_http_client_connect(&http_client_options) != c.AWS_OP_SUCCESS) {
httplog.err("HTTP client connect failed with {s}.", .{c.aws_error_debug_str(c.aws_last_error())});
return AwsError.HttpClientConnectError;
}
// TODO: Timeout
// Wait for connection to setup
while (!context.connection_complete.load(.SeqCst)) {
std.time.sleep(1 * std.time.ns_per_ms);
}
if (context.return_error) |e| return e;
const request_options = c.aws_http_make_request_options{
.self_size = @sizeOf(c.aws_http_make_request_options),
.on_response_headers = incomingHeadersCallback,
.on_response_header_block_done = null,
.on_response_body = incomingBodyCallback,
.on_complete = requestCompleteCallback,
.user_data = @ptrCast(*anyopaque, &context),
.request = http_request,
};
const stream = c.aws_http_connection_make_request(context.connection, &request_options);
if (stream == null) {
httplog.err("failed to create request.", .{});
return AwsError.RequestCreateError;
}
if (c.aws_http_stream_activate(stream) != c.AWS_OP_SUCCESS) {
httplog.err("HTTP request failed with {s}.", .{c.aws_error_debug_str(c.aws_last_error())});
return AwsError.HttpRequestError;
}
// TODO: Timeout
while (!context.request_complete.load(.SeqCst)) {
std.time.sleep(1 * std.time.ns_per_ms);
}
httplog.debug("request_complete. Response code {d}", .{context.response_code.?});
httplog.debug("headers:", .{});
for (context.headers.?.items) |h| {
httplog.debug(" {s}: {s}", .{ h.name, h.value });
}
httplog.debug("raw response body:\n{s}", .{context.body});
// Connection will stay alive until stream completes
c.aws_http_connection_release(context.connection);
context.connection = null;
if (tls_connection_options) |opts| {
c.aws_tls_connection_options_clean_up(opts);
}
var final_body: []const u8 = "";
if (context.body) |b| {
final_body = b;
}
// Headers would need to be allocated/copied into HttpResult similar
// to RequestContext, so we'll leave this as a later excercise
// if it becomes necessary
const rc = HttpResult{
.response_code = context.response_code.?,
.body = final_body,
.headers = context.headers.?.toOwnedSlice(),
.allocator = self.allocator,
};
return rc;
}
// TODO: Re-encapsulate or delete this function. It is not currently
// used and will not be touched by the compiler
fn createRequest(method: []const u8, path: []const u8, body: []const u8) !*c.aws_http_message {
// TODO: Likely this should be encapsulated more
var http_request = c.aws_http_message_new_request(c_allocator);
if (c.aws_http_message_set_request_method(http_request, c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, method))) != c.AWS_OP_SUCCESS)
return AwsError.SetRequestMethodError;
if (c.aws_http_message_set_request_path(http_request, c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, path))) != c.AWS_OP_SUCCESS)
return AwsError.SetRequestPathError;
const body_cursor = c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, body));
const request_body = c.aws_input_stream_new_from_cursor(c_allocator, &body_cursor);
defer c.aws_input_stream_destroy(request_body);
c.aws_http_message_set_body_stream(http_request, request_body);
return http_request.?;
}
// TODO: Re-encapsulate or delete this function. It is not currently
// used and will not be touched by the compiler
fn setupTls(_: Self, host: []const u8) !*c.aws_tls_connection_options {
if (tls_ctx_options == null) {
httplog.debug("Setting up tls options", .{});
var opts: c.aws_tls_ctx_options = .{
.allocator = c_allocator,
.minimum_tls_version = 128, // @intToEnum(c.aws_tls_versions, c.AWS_IO_TLS_VER_SYS_DEFAULTS), // https://github.com/awslabs/aws-c-io/blob/6c7bae503961545c5e99c6c836c4b37749cfc4ad/include/aws/io/tls_channel_handler.h#L21
.cipher_pref = 0, // @intToEnum(c.aws_tls_cipher_pref, c.AWS_IO_TLS_CIPHER_PREF_SYSTEM_DEFAULT), // https://github.com/awslabs/aws-c-io/blob/6c7bae503961545c5e99c6c836c4b37749cfc4ad/include/aws/io/tls_channel_handler.h#L25
.ca_file = c.aws_byte_buf_from_c_str(""),
.ca_path = c.aws_string_new_from_c_str(c_allocator, ""),
.alpn_list = null,
.certificate = c.aws_byte_buf_from_c_str(""),
.private_key = c.aws_byte_buf_from_c_str(""),
.max_fragment_size = 0,
.verify_peer = true,
};
tls_ctx_options = &opts;
c.aws_tls_ctx_options_init_default_client(tls_ctx_options.?, c_allocator);
// h2;http/1.1
if (c.aws_tls_ctx_options_set_alpn_list(tls_ctx_options, "http/1.1") != c.AWS_OP_SUCCESS) {
httplog.alert("Failed to load alpn list with error {s}.", .{c.aws_error_debug_str(c.aws_last_error())});
return AwsError.AlpnError;
}
tls_ctx = c.aws_tls_client_ctx_new(c_allocator, tls_ctx_options.?);
if (tls_ctx == null) {
std.debug.panic("Failed to initialize TLS context with error {s}.", .{c.aws_error_debug_str(c.aws_last_error())});
}
httplog.debug("tls options setup applied", .{});
}
var tls_connection_options = c.aws_tls_connection_options{
.alpn_list = null,
.server_name = null,
.on_negotiation_result = null,
.on_data_read = null,
.on_error = null,
.user_data = null,
.ctx = null,
.advertise_alpn_message = false,
.timeout_ms = 0,
};
c.aws_tls_connection_options_init_from_ctx(&tls_connection_options, tls_ctx);
var host_var = host;
var host_cur = c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, host_var));
if (c.aws_tls_connection_options_set_server_name(&tls_connection_options, c_allocator, &host_cur) != c.AWS_OP_SUCCESS) {
httplog.alert("Failed to set servername with error {s}.", .{c.aws_error_debug_str(c.aws_last_error())});
return AwsError.TlsError;
}
return &tls_connection_options;
// if (app_ctx.uri.port) {
// port = app_ctx.uri.port;
// }
}
fn signRequest(self: Self, http_request: *c.aws_http_message, options: SigningOptions) !void {
const creds = try self.getCredentials();
defer c.aws_credentials_release(creds);
// print the access key. Creds are an opaque C type, so we
// use aws_credentials_get_access_key_id. That gets us an aws_byte_cursor,
// from which we create a new aws_string with the contents. We need
// to convert to c_str with aws_string_c_str
const access_key = c.aws_string_new_from_cursor(c_allocator, &c.aws_credentials_get_access_key_id(creds));
defer c.aws_mem_release(c_allocator, access_key);
// defer c_allocator.*.mem_release.?(c_allocator, access_key);
httplog.debug("Signing with access key: {s}", .{c.aws_string_c_str(access_key)});
const signable = c.aws_signable_new_http_request(c_allocator, http_request);
if (signable == null) {
httplog.warn("Could not create signable request", .{});
return AwsError.SignableError;
}
defer c.aws_signable_destroy(signable);
const signing_region = try std.fmt.allocPrintZ(self.allocator, "{s}", .{options.region});
defer self.allocator.free(signing_region);
const signing_service = try std.fmt.allocPrintZ(self.allocator, "{s}", .{options.service});
defer self.allocator.free(signing_service);
const temp_signing_config = c.bitfield_workaround_aws_signing_config_aws{
.algorithm = 0, // .AWS_SIGNING_ALGORITHM_V4, // https://github.com/awslabs/aws-c-auth/blob/ace1311f8ef6ea890b26dd376031bed2721648eb/include/aws/auth/signing_config.h#L38
.config_type = 1, // .AWS_SIGNING_CONFIG_AWS, // https://github.com/awslabs/aws-c-auth/blob/ace1311f8ef6ea890b26dd376031bed2721648eb/include/aws/auth/signing_config.h#L24
.signature_type = 0, // .AWS_ST_HTTP_REQUEST_HEADERS, // https://github.com/awslabs/aws-c-auth/blob/ace1311f8ef6ea890b26dd376031bed2721648eb/include/aws/auth/signing_config.h#L49
.region = c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, signing_region)),
.service = c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, signing_service)),
.should_sign_header = null,
.should_sign_header_ud = null,
// TODO: S3 does not double uri encode. Also not sure why normalizing
// the path here is a flag - seems like it should always do this?
.flags = c.bitfield_workaround_aws_signing_config_aws_flags{
.use_double_uri_encode = 1,
.should_normalize_uri_path = 1,
.omit_session_token = 1,
},
.signed_body_value = c.aws_byte_cursor_from_c_str(""),
.signed_body_header = 1, // .AWS_SBHT_X_AMZ_CONTENT_SHA256, //or 0 = AWS_SBHT_NONE // https://github.com/awslabs/aws-c-auth/blob/ace1311f8ef6ea890b26dd376031bed2721648eb/include/aws/auth/signing_config.h#L131
.credentials = creds,
.credentials_provider = self.credentialsProvider,
.expiration_in_seconds = 0,
};
var signing_config = c.new_aws_signing_config(c_allocator, &temp_signing_config);
defer c.aws_mem_release(c_allocator, signing_config);
var signing_result = AwsAsyncCallbackResult(c.aws_http_message){ .result = http_request };
var sign_result_request = AsyncResult(AwsAsyncCallbackResult(c.aws_http_message)){ .result = &signing_result };
if (c.aws_sign_request_aws(c_allocator, signable, fullCast([*c]const c.aws_signing_config_base, signing_config), signComplete, &sign_result_request) != c.AWS_OP_SUCCESS) {
const error_code = c.aws_last_error();
httplog.err("Could not initiate signing request: {s}:{s}", .{ c.aws_error_name(error_code), c.aws_error_str(error_code) });
return AwsError.SigningInitiationError;
}
// Wait for callback. Note that execution, including real work of signing
// the http request, will continue in signComplete (below),
// then continue beyond this line
waitOnCallback(c.aws_http_message, &sign_result_request);
if (sign_result_request.result.error_code != c.AWS_ERROR_SUCCESS) {
return AwsError.SignableError;
}
}
/// It's my theory that the aws event loop has a trigger to corrupt the
/// signing result after this call completes. So the technique of assigning
/// now, using later will not work
fn signComplete(result: ?*c.aws_signing_result, error_code: c_int, user_data: ?*anyopaque) callconv(.C) void {
var async_result = userDataTo(AsyncResult(AwsAsyncCallbackResult(c.aws_http_message)), user_data);
var http_request = async_result.result.result;
async_result.sync.store(true, .SeqCst);
async_result.count += 1;
async_result.result.error_code = error_code;
if (result != null) {
if (c.aws_apply_signing_result_to_http_request(http_request, c_allocator, result) != c.AWS_OP_SUCCESS) {
httplog.err("Could not apply signing request to http request: {s}", .{c.aws_error_debug_str(c.aws_last_error())});
}
httplog.debug("signing result applied", .{});
} else {
httplog.err("Did not receive signing result: {s}", .{c.aws_error_debug_str(c.aws_last_error())});
}
async_result.sync.store(false, .SeqCst);
}
fn addHeaders(self: Self, request: *c.aws_http_message, host: []const u8, body: []const u8, content_type: []const u8, additional_headers: []Header) !void {
const accept_header = c.aws_http_header{
.name = c.aws_byte_cursor_from_c_str("Accept"),
.value = c.aws_byte_cursor_from_c_str("application/json"),
.compression = 0, // .AWS_HTTP_HEADER_COMPRESSION_USE_CACHE, // https://github.com/awslabs/aws-c-http/blob/ec42882310900f2b414b279fc24636ba4653f285/include/aws/http/request_response.h#L37
};
if (c.aws_http_message_add_header(request, accept_header) != c.AWS_OP_SUCCESS)
return AwsError.AddHeaderError;
const host_header = c.aws_http_header{
.name = c.aws_byte_cursor_from_c_str("Host"),
.value = c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, host)),
.compression = 0, // .AWS_HTTP_HEADER_COMPRESSION_USE_CACHE,
};
if (c.aws_http_message_add_header(request, host_header) != c.AWS_OP_SUCCESS)
return AwsError.AddHeaderError;
const user_agent_header = c.aws_http_header{
.name = c.aws_byte_cursor_from_c_str("User-Agent"),
.value = c.aws_byte_cursor_from_c_str("zig-aws 1.0, Powered by the AWS Common Runtime."),
.compression = 0, // .AWS_HTTP_HEADER_COMPRESSION_USE_CACHE,
};
if (c.aws_http_message_add_header(request, user_agent_header) != c.AWS_OP_SUCCESS)
return AwsError.AddHeaderError;
// AWS does not seem to care about Accept-Encoding
// Accept-Encoding: identity
// Content-Type: application/x-www-form-urlencoded
// const accept_encoding_header = c.aws_http_header{
// .name = c.aws_byte_cursor_from_c_str("Accept-Encoding"),
// .value = c.aws_byte_cursor_from_c_str("identity"),
// .compression = 0, //.AWS_HTTP_HEADER_COMPRESSION_USE_CACHE,
// };
// if (c.aws_http_message_add_header(request, accept_encoding_header) != c.AWS_OP_SUCCESS)
// return AwsError.AddHeaderError;
// AWS *does* seem to care about Content-Type. I don't think this header
// will hold for all APIs
const c_type = try std.fmt.allocPrintZ(self.allocator, "{s}", .{content_type});
defer self.allocator.free(c_type);
const content_type_header = c.aws_http_header{
.name = c.aws_byte_cursor_from_c_str("Content-Type"),
.value = c.aws_byte_cursor_from_c_str(c_type),
.compression = 0, // .AWS_HTTP_HEADER_COMPRESSION_USE_CACHE,
};
if (c.aws_http_message_add_header(request, content_type_header) != c.AWS_OP_SUCCESS)
return AwsError.AddHeaderError;
for (additional_headers) |h| {
const name = try std.fmt.allocPrintZ(self.allocator, "{s}", .{h.name});
defer self.allocator.free(name);
const value = try std.fmt.allocPrintZ(self.allocator, "{s}", .{h.value});
defer self.allocator.free(value);
const c_header = c.aws_http_header{
.name = c.aws_byte_cursor_from_c_str(name),
.value = c.aws_byte_cursor_from_c_str(value),
.compression = 0, // .AWS_HTTP_HEADER_COMPRESSION_USE_CACHE,
};
if (c.aws_http_message_add_header(request, c_header) != c.AWS_OP_SUCCESS)
return AwsError.AddHeaderError;
}
if (body.len > 0) {
const len = try std.fmt.allocPrintZ(self.allocator, "{d}", .{body.len});
// This defer seems to work ok, but I'm a bit concerned about why
defer self.allocator.free(len);
const content_length_header = c.aws_http_header{
.name = c.aws_byte_cursor_from_c_str("Content-Length"),
.value = c.aws_byte_cursor_from_c_str(@ptrCast([*c]const u8, len)),
.compression = 0, // .AWS_HTTP_HEADER_COMPRESSION_USE_CACHE,
};
if (c.aws_http_message_add_header(request, content_length_header) != c.AWS_OP_SUCCESS)
return AwsError.AddHeaderError;
}
}
fn connectionSetupCallback(connection: ?*c.aws_http_connection, error_code: c_int, user_data: ?*anyopaque) callconv(.C) void {
httplog.debug("connection setup callback start", .{});
var context = userDataTo(RequestContext, user_data);
if (error_code != c.AWS_OP_SUCCESS) {
httplog.err("Failed to setup connection: {s}.", .{c.aws_error_debug_str(c.aws_last_error())});
context.return_error = AwsError.SetupConnectionError;
}
context.connection = connection;
context.connection_complete.store(true, .SeqCst);
httplog.debug("connection setup callback end", .{});
}
fn connectionShutdownCallback(connection: ?*c.aws_http_connection, error_code: c_int, _: ?*anyopaque) callconv(.C) void {
// ^^ error_code ^^ user_data
httplog.debug("connection shutdown callback start ({*}). error_code: {d}", .{ connection, error_code });
httplog.debug("connection shutdown callback end", .{});
}
fn incomingHeadersCallback(stream: ?*c.aws_http_stream, _: c.aws_http_header_block, headers: [*c]const c.aws_http_header, num_headers: usize, user_data: ?*anyopaque) callconv(.C) c_int {
var context = userDataTo(RequestContext, user_data);
if (context.response_code == null) {
var status: c_int = 0;
if (c.aws_http_stream_get_incoming_response_status(stream, &status) == c.AWS_OP_SUCCESS) {
context.response_code = @intCast(u16, status); // RFC says this is a 3 digit number, so c_int is silly
httplog.debug("response status code from callback: {d}", .{status});
} else {
httplog.err("could not get status code", .{});
context.return_error = AwsError.StatusCodeError;
}
}
for (headers[0..num_headers]) |header| {
const name = header.name.ptr[0..header.name.len];
const value = header.value.ptr[0..header.value.len];
httplog.debug("header from callback: {s}: {s}", .{ name, value });
context.addHeader(name, value) catch
httplog.err("could not append header to request context", .{});
}
return c.AWS_OP_SUCCESS;
}
fn incomingBodyCallback(_: ?*c.aws_http_stream, data: [*c]const c.aws_byte_cursor, user_data: ?*anyopaque) callconv(.C) c_int {
var context = userDataTo(RequestContext, user_data);
httplog.debug("inbound body, len {d}", .{data.*.len});
const array = @ptrCast(*const []u8, &data.*.ptr).*;
// Need this to be a slice because it does not necessarily have a \0 sentinal
const body_chunk = array[0..data.*.len];
context.appendToBody(body_chunk) catch
httplog.err("could not append to body!", .{});
return c.AWS_OP_SUCCESS;
}
fn requestCompleteCallback(stream: ?*c.aws_http_stream, _: c_int, user_data: ?*anyopaque) callconv(.C) void {
// ^^ error_code
var context = userDataTo(RequestContext, user_data);
context.request_complete.store(true, .SeqCst);
c.aws_http_stream_release(stream);
httplog.debug("request complete", .{});
}
fn getCredentials(self: Self) !*c.aws_credentials {
var credential_result = AwsAsyncCallbackResult(c.aws_credentials){};
var callback_results = AsyncResult(AwsAsyncCallbackResult(c.aws_credentials)){ .result = &credential_result };
const callback = awsAsyncCallbackResult(c.aws_credentials, "got credentials", assignCredentialsOnCallback);
// const get_async_result =
_ = c.aws_credentials_provider_get_credentials(self.credentialsProvider, callback, &callback_results);
// TODO: do we care about the return value from get_creds?
waitOnCallback(c.aws_credentials, &callback_results);
if (credential_result.error_code != c.AWS_ERROR_SUCCESS) {
httplog.err("Could not acquire credentials: {s}:{s}", .{ c.aws_error_name(credential_result.error_code), c.aws_error_str(credential_result.error_code) });
return AwsError.CredentialsError;
}
return credential_result.result orelse unreachable;
}
// Generic wait on callback function
fn waitOnCallback(comptime T: type, results: *AsyncResult(AwsAsyncCallbackResult(T))) void {
var done = false;
while (!done) {
// TODO: Timeout
// More context: https://github.com/ziglang/zig/blob/119fc318a753f57b55809e9256e823accba6b56a/lib/std/crypto/benchmark.zig#L45-L54
// var timer = try std.time.Timer.start();
// const start = timer.lap();
// while (offset < bytes) : (offset += block.len) {
// do work
//
// h.update(block[0..]);
// }
// mem.doNotOptimizeAway(&h);
// const end = timer.read();
//
// const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s;
while (results.sync.load(.SeqCst)) {
std.time.sleep(1 * std.time.ns_per_ms);
}
done = results.count >= results.requiredCount;
// TODO: Timeout
std.time.sleep(1 * std.time.ns_per_ms);
}
}
// Generic function that generates a type-specific funtion for callback use
fn awsAsyncCallback(comptime T: type, comptime message: []const u8) (fn (result: ?*T, error_code: c_int, user_data: ?*anyopaque) callconv(.C) void) {
const inner = struct {
fn func(userData: *AsyncResult(AwsAsyncCallbackResult(T)), apiData: ?*T) void {
userData.result.result = apiData;
}
};
return awsAsyncCallbackResult(T, message, inner.func);
}
// used by awsAsyncCallbackResult to cast our generic userdata void *
// into a type known to zig
fn userDataTo(comptime T: type, userData: ?*anyopaque) *T {
return @ptrCast(*T, @alignCast(@alignOf(T), userData));
}
// generic callback ability. Takes a function for the actual assignment
// If you need a standard assignment, use awsAsyncCallback instead
fn awsAsyncCallbackResult(comptime T: type, comptime message: []const u8, comptime resultAssignment: (fn (user: *AsyncResult(AwsAsyncCallbackResult(T)), apiData: ?*T) void)) (fn (result: ?*T, error_code: c_int, user_data: ?*anyopaque) callconv(.C) void) {
const inner = struct {
fn innerfunc(result: ?*T, error_code: c_int, user_data: ?*anyopaque) callconv(.C) void {
httplog.debug(message, .{});
var asyncResult = userDataTo(AsyncResult(AwsAsyncCallbackResult(T)), user_data);
asyncResult.sync.store(true, .SeqCst);
asyncResult.count += 1;
asyncResult.result.error_code = error_code;
resultAssignment(asyncResult, result);
// asyncResult.result.result = result;
asyncResult.sync.store(false, .SeqCst);
}
};
return inner.innerfunc;
}
fn assignCredentialsOnCallback(asyncResult: *AsyncResult(AwsAsyncCallbackResult(c.aws_credentials)), credentials: ?*c.aws_credentials) void {
if (asyncResult.result.result) |result| {
c.aws_credentials_release(result);
}
asyncResult.result.result = credentials;
if (credentials) |cred| {
c.aws_credentials_acquire(cred);
}
}
};
fn AsyncResult(comptime T: type) type {
return struct {
result: *T,
requiredCount: u32 = 1,
sync: std.atomic.Atomic(bool) = std.atomic.Atomic(bool).init(false),
count: u8 = 0,
};
}
fn AwsAsyncCallbackResult(comptime T: type) type {
return struct {
result: ?*T = null,
error_code: i32 = c.AWS_ERROR_SUCCESS,
};
}
fn fullCast(comptime T: type, val: anytype) T {
return @ptrCast(T, @alignCast(@alignOf(T), val));
}
fn regionSubDomain(allocator: std.mem.Allocator, service: []const u8, region: []const u8, useDualStack: bool) !EndPoint {
const environment_override = std.os.getenv("AWS_ENDPOINT_URL");
if (environment_override) |override| {
const uri = try allocator.dupeZ(u8, override);
return endPointFromUri(allocator, uri);
}
// Fallback to us-east-1 if global endpoint does not exist.
const realregion = if (std.mem.eql(u8, region, "aws-global")) "us-east-1" else region;
const dualstack = if (useDualStack) ".dualstack" else "";
const domain = switch (std.hash_map.hashString(region)) {
US_ISO_EAST_1_HASH => "c2s.ic.gov",
CN_NORTH_1_HASH, CN_NORTHWEST_1_HASH => "amazonaws.com.cn",
US_ISOB_EAST_1_HASH => "sc2s.sgov.gov",
else => "amazonaws.com",
};
const uri = try std.fmt.allocPrintZ(allocator, "https://{s}{s}.{s}.{s}", .{ service, dualstack, realregion, domain });
const host = uri["https://".len..];
httplog.debug("host: {s}, scheme: {s}, port: {}", .{ host, "https", 443 });
return EndPoint{
.uri = uri,
.host = host,
.scheme = "https",
.port = 443,
.allocator = allocator,
};
}
/// creates an endpoint from a uri string.
///
/// allocator: Will be used only to construct the EndPoint struct
/// uri: string constructed in such a way that deallocation is needed
fn endPointFromUri(allocator: std.mem.Allocator, uri: []const u8) !EndPoint {
var scheme: []const u8 = "";
var host: []const u8 = "";
var port: u16 = 443;
var host_start: usize = 0;
var host_end: usize = 0;
for (uri) |ch, i| {
switch (ch) {
':' => {
if (!std.mem.eql(u8, scheme, "")) {
// here to end is port - this is likely a bug if ipv6 address used
const rest_of_uri = uri[i + 1 ..];
port = try std.fmt.parseUnsigned(u16, rest_of_uri, 10);
host_end = i;
}
},
'/' => {
if (host_start == 0) {
host_start = i + 2;
scheme = uri[0 .. i - 1];
if (std.mem.eql(u8, scheme, "http")) {
port = 80;
} else {
port = 443;
}
}
},
else => continue,
}
}
if (host_end == 0) {
host_end = uri.len;
}
host = uri[host_start..host_end];
httplog.debug("host: {s}, scheme: {s}, port: {}", .{ host, scheme, port });
return EndPoint{
.uri = uri,
.host = host,
.scheme = scheme,
.allocator = allocator,
.port = port,
};
}
const RequestContext = struct {
connection: ?*c.aws_http_connection = null,
connection_complete: std.atomic.Atomic(bool) = std.atomic.Atomic(bool).init(false),
request_complete: std.atomic.Atomic(bool) = std.atomic.Atomic(bool).init(false),
return_error: ?AwsError = null,
allocator: std.mem.Allocator,
body: ?[]const u8 = null,
response_code: ?u16 = null,
headers: ?std.ArrayList(Header) = null,
const Self = @This();
pub fn deinit(self: Self) void {
// We're going to leave it to the caller to free the body
// if (self.body) |b| self.allocator.free(b);
if (self.headers) |hs| {
for (hs.items) |h| {
// deallocate the copied values
self.allocator.free(h.name);
self.allocator.free(h.value);
}
// deallocate the structure itself
hs.deinit();
}
}
pub fn appendToBody(self: *Self, fragment: []const u8) !void {
var orig_body: []const u8 = "";
if (self.body) |b| {
orig_body = try self.allocator.dupe(u8, b);
self.allocator.free(b);
self.body = null;
}
defer self.allocator.free(orig_body);
self.body = try std.fmt.allocPrint(self.allocator, "{s}{s}", .{ orig_body, fragment });
}
pub fn addHeader(self: *Self, name: []const u8, value: []const u8) !void {
if (self.headers == null)
self.headers = std.ArrayList(Header).init(self.allocator);
const name_copy = try self.allocator.dupeZ(u8, name);
const value_copy = try self.allocator.dupeZ(u8, value);
try self.headers.?.append(.{
.name = name_copy,
.value = value_copy,
});
}
}; | src/awshttp.zig |
const std = @import("std");
const pkmn = @import("pkmn");
pub fn main() !void {
// Set up required to be able to parse command line arguments
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
const args = try std.process.argsAlloc(allocator);
defer std.process.argsFree(allocator, args);
// Expect that we have been given a decimal seed as our only argument
const err = std.io.getStdErr().writer();
if (args.len != 2) {
try err.print("Usage: {s} <seed>\n", .{args[0]});
std.process.exit(1);
}
const seed = std.fmt.parseUnsigned(u64, args[2], 10) catch {
try err.print("Invalid seed: {s}\n", .{args[1]});
try err.print("Usage: {s} <seed>\n", .{args[0]});
std.process.exit(1);
};
// Use Zig's system PRNG (pkmn.PRNG is another option with a slightly different API)
var random = std.rand.DefaultPrng.init(seed).random();
// Preallocate a small buffer for the choice options throughout the battle
var options: [pkmn.OPTIONS_SIZE]pkmn.Choice = undefined;
// pkmn.gen1.Battle can be tedious to initialize - the helper constructor used here
// fills in missing fields with intelligent defaults to cut down on boilerplate.
var battle = pkmn.gen1.helpers.Battle.init(
random.int(u64),
&.{
.{ .species = .Bulbasaur, .moves = &.{ .SleepPowder, .SwordsDance, .RazorLeaf, .BodySlam } },
.{ .species = .Charmander, .moves = &.{ .FireBlast, .FireSpin, .Slash, .Counter } },
.{ .species = .Squirtle, .moves = &.{ .Surf, .Blizzard, .BodySlam, .Rest } },
.{ .species = .Pikachu, .moves = &.{ .Thunderbolt, .ThunderWave, .Surf, .SeismicToss } },
.{ .species = .Rattata, .moves = &.{ .SuperFang, .BodySlam, .Blizzard, .Thunderbolt } },
.{ .species = .Pidgey, .moves = &.{ .DoubleEdge, .QuickAttack, .WingAttack, .MirrorMove } },
},
&.{
.{ .species = .Tauros, .moves = &.{ .BodySlam, .HyperBeam, .Blizzard, .Earthquake } },
.{ .species = .Chansey, .moves = &.{ .Reflect, .SeismicToss, .SoftBoiled, .ThunderWave } },
.{ .species = .Snorlax, .moves = &.{ .BodySlam, .Reflect, .Rest, .IceBeam } },
.{ .species = .Exeggutor, .moves = &.{ .SleepPowder, .Psychic, .Explosion, .DoubleEdge } },
.{ .species = .Starmie, .moves = &.{ .Recover, .ThunderWave, .Blizzard, .Thunderbolt } },
.{ .species = .Alakazam, .moves = &.{ .Psychic, .SeismicToss, .ThunderWave, .Recover } },
},
);
// Preallocate a buffer for the log and create a Log handler which will write to it.
// pkmn.LOG_SIZE is guaranteed to be large enough for a single update. This will only be used if
// -Dtrace is enabled - simply setting the log to null will also disable it, regardless of what
// -Dtrace is set to.
var buf: [pkmn.LOG_SIZE]u8 = undefined;
var log = pkmn.protocol.FixedLog{ .writer = std.io.fixedBufferStream(&buf).writer() };
var c1 = pkmn.Choice{};
var c2 = pkmn.Choice{};
var result = try battle.update(c1, c2, log);
while (result.type == .None) : (result = try battle.update(c1, c2, log)) {
// Here we would do something with the log data in buffer if -Dtrace were enabled
_ = buf;
// battle.choices determines what the possible options are - the simplest way to
// choose an option here is to just use the system PRNG to pick one at random
c1 = options[random.uintLessThan(u8, battle.choices(.P1, result.p1, &options))];
c2 = options[random.uintLessThan(u8, battle.choices(.P2, result.p2, &options))];
}
// The result is from the perspective of P1
const msg = switch (result.type) {
.Win => "won by Player A",
.Lose => "won by Player B",
.Tie => "ended in a tie",
.Error => "encountered an error",
else => unreachable,
};
const out = std.io.getStdOut().writer();
try out.print("Battle {s} after {d} turns", .{ msg, battle.turn });
} | src/examples/zig/example.zig |
const std = @import("std");
const os = std.os;
const linux = std.os.linux;
const LinearFifo = std.fifo.LinearFifo;
const LinearFifoBufferType = std.fifo.LinearFifoBufferType;
const FdBuffer = LinearFifo(i32, LinearFifoBufferType{ .Static = MAX_FDS });
pub const MAX_FDS = 28;
pub fn recvMsg(fd: i32, buffer: []u8, fds: *FdBuffer) !usize {
var iov: linux.iovec = undefined;
iov.iov_base = @ptrCast([*]u8, &buffer[0]);
iov.iov_len = buffer.len;
var control: [cmsg_space(MAX_FDS*@sizeOf(i32))]u8 = undefined;
var msg = linux.msghdr{
.msg_name = null,
.msg_namelen = 0,
.msg_iov = @ptrCast([*]std.os.iovec, &iov),
.msg_iovlen = 1,
.msg_control = &control[0],
.msg_controllen = control.len,
.msg_flags = 0,
.__pad1 = 0,
.__pad2 = 0,
};
var rc: usize = 0;
while (true) {
rc = linux.recvmsg(fd, @ptrCast(*std.x.os.Socket.Message, &msg), linux.MSG_DONTWAIT | linux.MSG_CMSG_CLOEXEC);
switch (linux.getErrno(rc)) {
0 => break,
linux.EINTR => continue,
linux.EINVAL => unreachable,
linux.EFAULT => unreachable,
linux.EAGAIN => if (std.event.Loop.instance) |loop| {
loop.waitUntilFdReadable(fd);
continue;
} else {
return error.WouldBlock;
},
linux.EBADF => unreachable, // Always a race condition.
linux.EIO => return error.InputOutput,
linux.EISDIR => return error.IsDir,
linux.ENOBUFS => return error.SystemResources,
linux.ENOMEM => return error.SystemResources,
linux.ECONNRESET => return error.ConnectionResetByPeer,
else => |err| return error.Unexpected,
}
}
// TOOD: we should not assume a single CMSG
var maybe_cmsg = cmsg_firsthdr(&msg);
if (maybe_cmsg) |cmsg| {
if (cmsg.cmsg_type == SCM_RIGHTS and cmsg.cmsg_level == linux.SOL_SOCKET) {
var data: []i32 = undefined;
data.ptr = @ptrCast([*]i32, @alignCast(@alignOf(i32), cmsg_data(cmsg)));
data.len = (cmsg.cmsg_len - cmsg_len(0))/@sizeOf(i32);
var writable = try fds.writableWithSize(data.len);
std.mem.copy(i32, writable, data);
fds.update(data.len);
}
}
return @intCast(usize, rc);
}
pub fn sendMsg(fd: i32, buffer: []u8, fds: *FdBuffer) !usize {
var iov: linux.iovec_const = undefined;
iov.iov_base = @ptrCast([*]u8, &buffer[0]);
iov.iov_len = buffer.len;
var control: [cmsg_space(MAX_FDS*@sizeOf(i32))]u8 = undefined;
var msg_hdr: *cmsghdr = @ptrCast(*cmsghdr, @alignCast(@alignOf(cmsghdr), &control[0]));
// Copy fds from `fds` to control
var incoming_slice = fds.readableSlice(0);
msg_hdr.cmsg_len = cmsg_len(@sizeOf(i32) * incoming_slice.len);
msg_hdr.cmsg_type = SCM_RIGHTS;
msg_hdr.cmsg_level = linux.SOL_SOCKET;
var fds_ptr: []i32 = undefined;
fds_ptr.len = MAX_FDS;
fds_ptr.ptr = @ptrCast([*]i32, @alignCast(@alignOf(i32), cmsg_data(msg_hdr)));
std.mem.copy(i32, fds_ptr, incoming_slice);
fds.discard(incoming_slice.len);
var msg = linux.msghdr_const{
.msg_name = null,
.msg_namelen = 0,
.msg_iov = @ptrCast([*]std.os.iovec_const, &iov),
.msg_iovlen = 1,
.msg_control = if (incoming_slice.len == 0) null else msg_hdr, // we'll need to change this when send file descriptor
.msg_controllen = if (incoming_slice.len == 0) 0 else @truncate(u32, msg_hdr.cmsg_len), // we'll need to change this when we send file desricptor
.msg_flags = 0,
.__pad1 = 0,
.__pad2 = 0,
};
return try os.sendmsg(fd, msg, linux.MSG_NOSIGNAL);
}
// Probably not portable stuff is below
const SCM_RIGHTS = 0x01;
pub const cmsghdr = extern struct {
// cmsg_len: linux.socklen_t does not work as this struct has align 4 (msghdr align 8 which upsets firsthdr)
// go has this value a u64 for amd64 linux
cmsg_len: u64,
cmsg_level: c_int,
cmsg_type: c_int,
};
// New implementation
fn cmsg_align(size: usize) usize {
return (size + @sizeOf(usize) - 1) & ~(@intCast(usize, @sizeOf(usize) -1));
}
fn cmsg_len(size: usize) usize {
return cmsg_align(@sizeOf(cmsghdr)) + size;
}
fn cmsg_space(size: usize) usize {
return cmsg_align(size) + cmsg_align(@sizeOf(cmsghdr));
}
fn cmsg_data(cmsg: *cmsghdr) *u8 {
// currently only written for x86_64 linux...compatibility coming later
// in the case of x86_64 linux the header is 16 bytes which is itself
// align(4) and therefore there is no padding between header and data
return @intToPtr(*u8, @ptrToInt(cmsg) + @sizeOf(cmsghdr));
}
fn cmsg_firsthdr(msg: *linux.msghdr) ?*cmsghdr {
if (msg.msg_controllen < @sizeOf(cmsghdr)) {
return null;
}
return @ptrCast(*cmsghdr, @alignCast(@alignOf(cmsghdr), @alignCast(@alignOf(linux.msghdr), msg).msg_control));
} | src/wl/txrx.zig |
const std = @import("std");
const prot = @import("../protocols.zig");
const compositor = @import("../compositor.zig");
const Context = @import("../client.zig").Context;
const Object = @import("../client.zig").Object;
const Window = @import("../window.zig").Window;
const XdgConfiguration = @import("../window.zig").XdgConfiguration;
const Move = @import("../move.zig").Move;
const Resize = @import("../resize.zig").Resize;
fn set_parent(context: *Context, xdg_toplevel: Object, parent: ?Object) anyerror!void {
const window = @intToPtr(*Window, xdg_toplevel.container);
window.parent = if (parent) |p| @intToPtr(*Window, p.container) else null;
}
fn set_title(context: *Context, xdg_toplevel: Object, title: []u8) anyerror!void {
const window = @intToPtr(*Window, xdg_toplevel.container);
const len = std.math.min(window.title.len, title.len);
std.mem.copy(u8, window.title[0..len], title[0..len]);
// std.debug.warn("window: {}\n", .{window.title});
}
fn set_app_id(context: *Context, xdg_toplevel: Object, app_id: []u8) anyerror!void {
const window = @intToPtr(*Window, xdg_toplevel.container);
const len = std.math.min(window.app_id.len, app_id.len);
std.mem.copy(u8, window.app_id[0..len], app_id[0..len]);
}
fn set_max_size(context: *Context, xdg_toplevel: Object, width: i32, height: i32) anyerror!void {
const pending = @intToPtr(*Window, xdg_toplevel.container).pending();
if (width <= 0) {
pending.max_width = null;
} else {
pending.max_width = width;
}
if (height <= 0) {
pending.max_height = null;
} else {
pending.max_height = height;
}
}
fn set_min_size(context: *Context, xdg_toplevel: Object, width: i32, height: i32) anyerror!void {
const pending = @intToPtr(*Window, xdg_toplevel.container).pending();
if (width <= 0) {
pending.min_width = null;
} else {
pending.min_width = width;
}
if (height <= 0) {
pending.min_height = null;
} else {
pending.min_height = height;
}
}
fn destroy(context: *Context, xdg_toplevel: Object) anyerror!void {
const window = @intToPtr(*Window, xdg_toplevel.container);
window.xdg_toplevel_id = null;
try prot.wl_display_send_delete_id(context.client.wl_display, xdg_toplevel.id);
try context.unregister(xdg_toplevel);
}
pub fn init() void {
prot.XDG_TOPLEVEL = prot.xdg_toplevel_interface{
.destroy = destroy,
.set_parent = set_parent,
.set_title = set_title,
.set_app_id = set_app_id,
.show_window_menu = show_window_menu,
.move = move,
.resize = resize,
.set_max_size = set_max_size,
.set_min_size = set_min_size,
.set_maximized = set_maximized,
.unset_maximized = unset_maximized,
.set_fullscreen = set_fullscreen,
.unset_fullscreen = unset_fullscreen,
.set_minimized = set_minimized,
};
}
fn show_window_menu(context: *Context, object: Object, seat: Object, serial: u32, x: i32, y: i32) anyerror!void {
return error.DebugFunctionNotImplemented;
}
// TODO: Moving should be delegated to the current view's mode
fn move(context: *Context, xdg_toplevel: Object, seat: Object, serial: u32) anyerror!void {
const window = @intToPtr(*Window, xdg_toplevel.container);
if (window.maximized == null) {
compositor.COMPOSITOR.move = Move{
.window = window,
.window_x = window.current().x,
.window_y = window.current().y,
.pointer_x = compositor.COMPOSITOR.pointer_x,
.pointer_y = compositor.COMPOSITOR.pointer_y,
};
}
}
fn resize(context: *Context, xdg_toplevel: Object, seat: Object, serial: u32, edges: u32) anyerror!void {
const window = @intToPtr(*Window, xdg_toplevel.container);
compositor.COMPOSITOR.resize = Resize{
.window = window,
.window_x = window.current().x,
.window_y = window.current().y,
.pointer_x = compositor.COMPOSITOR.pointer_x,
.pointer_y = compositor.COMPOSITOR.pointer_y,
.width = (if (window.window_geometry) |wg| wg.width else window.width),
.height = (if (window.window_geometry) |wg| wg.height else window.height),
.direction = edges,
};
}
fn set_maximized(context: *Context, xdg_toplevel: Object) anyerror!void {
const window = @intToPtr(*Window, xdg_toplevel.container);
if (window.view == null or window.view.?.output == null or window.xdg_surface_id == null) {
return;
}
if (window.client.context.get(window.xdg_surface_id.?)) |xdg_surface| {
const serial = window.client.nextSerial();
try window.xdg_configurations.writeItem(XdgConfiguration{
.serial = serial,
.operation = .Maximize,
});
var states: [2]u32 = [_]u32{
@enumToInt(prot.xdg_toplevel_state.maximized),
@enumToInt(prot.xdg_toplevel_state.activated),
};
try prot.xdg_toplevel_send_configure(xdg_toplevel, window.view.?.output.?.getWidth(), window.view.?.output.?.getHeight(), &states);
try prot.xdg_surface_send_configure(xdg_surface, serial);
}
}
fn unset_maximized(context: *Context, xdg_toplevel: Object) anyerror!void {
const window = @intToPtr(*Window, xdg_toplevel.container);
if (window.view == null or window.view.?.output == null or window.xdg_surface_id == null) {
return;
}
if (window.client.context.get(window.xdg_surface_id.?)) |xdg_surface| {
const serial = window.client.nextSerial();
try window.xdg_configurations.writeItem(XdgConfiguration{
.serial = serial,
.operation = .Unmaximize,
});
var states: [1]u32 = [_]u32{
@enumToInt(prot.xdg_toplevel_state.activated),
};
if (window.maximized) |maximized| {
try prot.xdg_toplevel_send_configure(xdg_toplevel, maximized.width, maximized.height, &states);
} else {
try prot.xdg_toplevel_send_configure(xdg_toplevel, window.width, window.height, &states);
}
try prot.xdg_surface_send_configure(xdg_surface, serial);
}
}
fn set_fullscreen(context: *Context, object: Object, output: ?Object) anyerror!void {
return error.DebugFunctionNotImplemented;
}
fn unset_fullscreen(context: *Context, object: Object) anyerror!void {
return error.DebugFunctionNotImplemented;
}
fn set_minimized(context: *Context, object: Object) anyerror!void {
return error.DebugFunctionNotImplemented;
} | src/implementations/xdg_toplevel.zig |
pub const layout: []const u8 =
\\layout(push_constant) uniform PushConstants {
\\ layout(offset = 16) vec3 eye;
\\ layout(offset = 32) vec3 up;
\\ layout(offset = 48) vec3 forward;
\\} pushConstants;
\\layout (location = 0) in vec2 inUV;
\\layout (location = 0) out vec4 outColor;
\\
;
pub const shader_header: []const u8 =
\\#define MAP_EPS .001
\\float dot2(in vec2 v) { return dot(v,v); }
\\float dot2(in vec3 v) { return dot(v,v); }
\\float ndot(in vec2 a, in vec2 b) { return a.x * b.x - a.y * b.y; }
\\float det(in vec2 a, in vec2 b) { return a.x * b.y - b.x * a.y; }
\\
;
pub const map_header: []const u8 =
\\float map(in vec3 p) {
\\ vec3 cpin, cpout;
\\ vec3 cdin, cdout;
\\
;
pub const map_footer: []const u8 =
\\}
\\
;
pub const shadow_map_header: []const u8 =
\\float shadowMap(in vec3 p) {
\\ vec3 cpin, cpout;
\\ vec3 cdin, cdout;
;
pub const shadow_map_footer: []const u8 =
\\}
\\
;
pub const mat_to_color_header: []const u8 =
\\vec3 matToColor(in float m, in vec3 l, in vec3 n, in vec3 v) {
\\ vec3 res;
\\
;
pub const mat_to_color_footer: []const u8 =
\\ res = vec3(1.,0.,1.);
\\ return res;
\\}
\\
;
pub const mat_map_header: []const u8 =
\\vec3 matMap(in vec3 p, in vec3 l, in vec3 n, in vec3 v) {
\\ vec3 cpin, cpout;
\\ float cdin, cdout;
\\
;
pub const mat_map_footer: []const u8 =
\\ return matToColor(0.,l,n,v);
\\}
\\
;
pub const shader_normal_and_shadows =
\\vec3 calcNormal(in vec3 pos) {
\\ const float ep = .0001;
\\ vec2 e = vec2(1.,-1.)*.5773;
\\ return normalize(e.xyy * shadowMap(pos + e.xyy*ep) +
\\ e.yyx * shadowMap(pos + e.yyx*ep) +
\\ e.yxy * shadowMap(pos + e.yxy*ep) +
\\ e.xxx * shadowMap(pos + e.xxx*ep));
\\}
// http://iquilezles.org/www/articles/rmshadows/rmshadows.htm
\\float calcSoftShadows(in vec3 ro, in vec3 rd, in float mint, in float maxt) {
\\ float res = 1.;
\\ float t = mint;
\\ for (int i = 0; i < ENVIRONMENT_SHADOW_STEPS; i++) {
\\ float h = shadowMap(ro + rd * t);
\\ float s = clamp(8.*h/t,0.,1.);
\\ t += h;
\\ res = min(res, s*s*(3.-2.*s));
\\ if (res < .005 || t > maxt) break;
\\ }
\\ return res;
\\}
\\
;
pub const shader_main =
\\void main() {
\\ vec2 ip = 2 * inUV - 1.;
\\
\\ vec3 tot = vec3(0.);
\\
\\#if (CAMERA_PROJECTION == 0)
\\ float scale = CAMERA_FOV;
\\#else
\\ float scale = 1.0;
\\#endif
\\
\\ vec3 right = cross(pushConstants.up, pushConstants.forward);
\\ vec3 offset = right * ip.x * scale;
\\ offset += pushConstants.up * ip.y * scale;
\\
\\#if (CAMERA_PROJECTION == 0)
\\ vec3 ro = pushConstants.eye;
\\ vec3 rd = pushConstants.forward + offset;
\\ rd = normalize(rd);
\\#else
\\ vec3 ro = pushConstants.eye + offset;
\\ vec3 rd = pushConstants.forward;
\\#endif
\\
\\ float t = CAMERA_NEAR;
\\ for (int i = 0; i < CAMERA_STEPS; i++) {
\\ vec3 p = ro + t * rd;
\\ float h = map(p);
\\ if (abs(h) < MAP_EPS || t > CAMERA_FAR) break;
\\ t += h;
\\ }
\\
\\ vec3 col = ENVIRONMENT_BACKGROUND_COLOR;
\\ if (t <= CAMERA_FAR) {
\\ vec3 pos = ro + t * rd;
\\ vec3 nor = calcNormal(pos);
\\ vec3 lig = normalize(ENVIRONMENT_LIGHT_DIR);
\\ vec3 hal = normalize(lig - rd);
\\
\\ col = matMap(pos, lig, nor, rd);
\\
\\ float dif = clamp(dot(nor, lig), 0., 1.);
\\ dif *= calcSoftShadows(pos, lig, .02, 5.5);
\\
\\ col *= dif;
\\ }
\\#ifdef DISCARD_ENVIRONMENT
\\ else discard;
\\#endif
\\ tot += col;
\\
\\ outColor = vec4(tot, 1.);
\\}
\\
; | src/sdf/shader_templates.zig |
usingnamespace @import("std").builtin;
/// Deprecated
pub const arch = Target.current.cpu.arch;
/// Deprecated
pub const endian = Target.current.cpu.arch.endian();
/// Zig version. When writing code that supports multiple versions of Zig, prefer
/// feature detection (i.e. with `@hasDecl` or `@hasField`) over version checks.
pub const zig_version = try @import("std").SemanticVersion.parse("0.8.0-dev.1119+2d447b57c");
pub const output_mode = OutputMode.Exe;
pub const link_mode = LinkMode.Dynamic;
pub const is_test = true;
pub const single_threaded = false;
pub const abi = Abi.gnu;
pub const cpu: Cpu = Cpu{
.arch = .x86_64,
.model = &Target.x86.cpu.znver1,
.features = Target.x86.featureSet(&[_]Target.x86.Feature{
.@"64bit",
.@"adx",
.@"aes",
.@"avx",
.@"avx2",
.@"bmi",
.@"bmi2",
.@"branchfusion",
.@"clflushopt",
.@"clzero",
.@"cmov",
.@"cx16",
.@"cx8",
.@"f16c",
.@"fast_15bytenop",
.@"fast_bextr",
.@"fast_lzcnt",
.@"fast_scalar_shift_masks",
.@"fma",
.@"fsgsbase",
.@"fxsr",
.@"lzcnt",
.@"mmx",
.@"movbe",
.@"mwaitx",
.@"nopl",
.@"pclmul",
.@"popcnt",
.@"prfchw",
.@"rdrnd",
.@"rdseed",
.@"sahf",
.@"sha",
.@"slow_shld",
.@"sse",
.@"sse2",
.@"sse3",
.@"sse4_1",
.@"sse4_2",
.@"sse4a",
.@"ssse3",
.@"vzeroupper",
.@"x87",
.@"xsave",
.@"xsavec",
.@"xsaveopt",
.@"xsaves",
}),
};
pub const os = Os{
.tag = .freebsd,
.version_range = .{ .semver = .{
.min = .{
.major = 0,
.minor = 0,
.patch = 0,
},
.max = .{
.major = 0,
.minor = 0,
.patch = 0,
},
}},
};
pub const object_format = ObjectFormat.elf;
pub const mode = Mode.Debug;
pub const link_libc = true;
pub const link_libcpp = false;
pub const have_error_return_tracing = true;
pub const valgrind_support = false;
pub const position_independent_code = true;
pub const position_independent_executable = false;
pub const strip_debug_info = false;
pub const code_model = CodeModel.default;
pub var test_functions: []TestFn = undefined; // overwritten later
pub const test_io_mode = .blocking; | zig/zig-cache/o/751a3ea851d83239eddb7cfe69e8766e/builtin.zig |
const std = @import("std");
//const concepts = @import("concepts.zig");
//TODO: maybe remove because we don't need that
//const hasFn = std.meta.trait.hasFn;
/// A helper metafunction to identify if some generic type satisfies the interface / trait
/// for a picking strategy.
/// This is a crutch, because I cannot get any semantics from that function
/// See this issue for a better handling of interfaces / traits
/// https://github.com/ziglang/zig/issues/1268
//pub const hasPickingStrategyTrait = std.meta.trait.multiTrait(.{hasFn("pick")});
// //TODO correct this to include Self thing
// pub const isPickingStrategy = concepts.hasFn(fn(Game)?usize, "pick");
// fn static_assert(comptime ok : bool, comptime message : []const u8) void{
// if(!ok) {
// @compileError("static assertion failed: " ++ message);
// }
// }
pub const GameError = error{
/// a picking strat did an illegal move (i.e. take more than one piece of fruit per pick)
IllegalPickingStrategy,
/// the game state is illegal, i.e. both won and lost
IllegalGameState,
/// fruit index for picking is out of bounds
FruitIndexOutOfBounds,
/// tried to pick empty tree
EmptyTreePick,
};
/// number of trees with fruit (same as on dice)
pub const TREE_COUNT: usize = 4;
/// the number of raven cards needed for the player to lose the game
pub const RAVEN_COMPLETE_COUNT = 9;
/// initial number of fruit on each tree
pub const INITIAL_FRUIT_COUNT = 10;
pub const Game = struct {
fruit_count: [TREE_COUNT]usize,
raven_count: usize,
turn_count: usize,
/// a new fresh game with full fruit an no ravens
pub fn new() @This() {
return @This(){
.fruit_count = [_]usize{INITIAL_FRUIT_COUNT} ** TREE_COUNT, // see https://ziglearn.org/chapter-1/#comptime (and then search for ++ and ** operators)
.raven_count = 0,
.turn_count = 0,
};
}
/// the total number of fruit left in the game
pub fn totalFruitCount(self: @This()) usize {
var total: usize = 0;
for (self.fruit_count) |count| {
total += count;
}
return total;
}
/// check if the game is won (i.e. fruit count is zero)
/// ATTN: if the game is not played according to the rules,
/// then isWon() and isLost() can both be true
pub fn isWon(self: @This()) bool {
return self.totalFruitCount() == 0;
}
/// check if the game is lost (i.e. raven is complete)
/// ATTN: if the game is not played according to the rules,
/// then isWon() and isLost() can both be true
pub fn isLost(self: @This()) bool {
return self.raven_count >= RAVEN_COMPLETE_COUNT;
}
/// pick a piece of fruit, but do not modify the turn count
pub fn pickOne(self: *Game, index: usize) !void {
if (index < TREE_COUNT) {
if (self.fruit_count[index] > 0) {
self.fruit_count[index] -= 1;
} else {
return GameError.EmptyTreePick;
}
} else {
return GameError.FruitIndexOutOfBounds;
}
}
};
const expectEqual = std.testing.expectEqual;
const expectError = std.testing.expectError;
const expect = std.testing.expect;
const DiceResult = dice.DiceResult;
test "Game.new" {
const new_game = Game.new();
try expectEqual(Game{.fruit_count = [_]usize{10} ** TREE_COUNT, .raven_count = 0, .turn_count = 0}, new_game);
try expect(new_game.totalFruitCount() == INITIAL_FRUIT_COUNT*TREE_COUNT);
}
test "Game.isWon and Game.isLost" {
try expect(!Game.new().isWon());
try expect(!Game.new().isLost());
try expect((Game{.fruit_count = [_]usize{0} ** TREE_COUNT, .raven_count = RAVEN_COMPLETE_COUNT-1, .turn_count = 0}).isWon());
try expect(!(Game{.fruit_count = [_]usize{1} ** TREE_COUNT, .raven_count = RAVEN_COMPLETE_COUNT, .turn_count = 0}).isWon());
try expect((Game{.fruit_count = [_]usize{1} ** TREE_COUNT, .raven_count = RAVEN_COMPLETE_COUNT, .turn_count = 0}).isLost());
}
test "Game.pickOne" {
var game = Game.new();
try game.pickOne(1);
try expect(game.totalFruitCount() == INITIAL_FRUIT_COUNT*TREE_COUNT-1);
try expect(game.fruit_count[1] == INITIAL_FRUIT_COUNT-1);
std.mem.set(usize, &game.fruit_count, 0);
try expectError(error.EmptyTreePick, game.pickOne(0));
} | src/game.zig |
const std = @import("std");
const tools = @import("tools");
const with_trace = true;
const assert = std.debug.assert;
fn trace(comptime fmt: []const u8, args: anytype) void {
if (with_trace) std.debug.print(fmt, args);
}
const Arg = union(enum) {
reg: u5,
imm: i64,
};
pub fn match_insn(comptime pattern: []const u8, text: []const u8) ?[2]Arg {
if (tools.match_pattern(pattern, text)) |vals| {
var count: usize = 0;
var values: [2]Arg = undefined;
for (values) |*v, i| {
switch (vals[i]) {
.imm => |imm| v.* = .{ .imm = imm },
.name => |name| v.* = .{ .reg = @intCast(u5, name[0] - 'a') },
}
}
return values;
}
return null;
}
pub fn yolo() u32 {
var b: u64 = 108400;
const c: u64 = 125400;
var h: u32 = 0;
lbl1: while (b <= c) : (b += 17) {
//if (b % 2 == 0 or b % 3 == 0 or b % 5 == 0 or b % 7 == 0 or b % 11 == 0) {
// h += 1;
// continue :lbl1;
//}
var d: u64 = 2;
while (d < b) : (d += 1) {
if (b % d == 0) {
h += 1;
continue :lbl1;
}
//var e: u64 = d;
//while (e < b) : (e += 1) {
// if (d * e == b) {
// trace("b={} h++={}\n", .{ b, h });
// h += 1;
// continue :lbl1;
// } else if (d * e > b) {
// break;}
//}
}
//trace("b={} h skip\n", .{b});
}
return h;
}
pub fn main() anyerror!void {
const stdout = std.io.getStdOut().writer();
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const allocator = arena.allocator();
try stdout.print("yolo = {}\n", .{yolo()});
const limit = 1 * 1024 * 1024 * 1024;
const text = try std.fs.cwd().readFileAlloc(allocator, "day23.txt", limit);
defer allocator.free(text);
const Opcode = enum {
set,
add,
sub,
mul,
mod,
jgz,
jnz,
};
const Insn = struct {
opcode: Opcode,
arg: [2]Arg,
};
var program: [500]Insn = undefined;
var program_len: usize = 0;
var it = std.mem.tokenize(u8, text, "\n");
while (it.next()) |line| {
if (match_insn("set {} {}", line)) |vals| {
program[program_len].opcode = .set;
program[program_len].arg[0] = vals[0];
program[program_len].arg[1] = vals[1];
program_len += 1;
} else if (match_insn("add {} {}", line)) |vals| {
program[program_len].opcode = .add;
program[program_len].arg[0] = vals[0];
program[program_len].arg[1] = vals[1];
program_len += 1;
} else if (match_insn("sub {} {}", line)) |vals| {
program[program_len].opcode = .sub;
program[program_len].arg[0] = vals[0];
program[program_len].arg[1] = vals[1];
program_len += 1;
} else if (match_insn("mul {} {}", line)) |vals| {
program[program_len].opcode = .mul;
program[program_len].arg[0] = vals[0];
program[program_len].arg[1] = vals[1];
program_len += 1;
} else if (match_insn("mod {} {}", line)) |vals| {
program[program_len].opcode = .mod;
program[program_len].arg[0] = vals[0];
program[program_len].arg[1] = vals[1];
program_len += 1;
} else if (match_insn("jgz {} {}", line)) |vals| {
program[program_len].opcode = .jgz;
program[program_len].arg[0] = vals[0];
program[program_len].arg[1] = vals[1];
program_len += 1;
} else if (match_insn("jnz {} {}", line)) |vals| {
program[program_len].opcode = .jnz;
program[program_len].arg[0] = vals[0];
program[program_len].arg[1] = vals[1];
program_len += 1;
} else if (match_insn("snd {}", line)) |vals| {
program[program_len].opcode = .set;
program[program_len].arg[0] = Arg{ .reg = 31 };
program[program_len].arg[1] = vals[0];
program_len += 1;
} else if (match_insn("rcv {}", line)) |vals| {
program[program_len].opcode = .set;
program[program_len].arg[0] = vals[0];
program[program_len].arg[1] = Arg{ .reg = 31 };
program_len += 1;
} else {
trace("skipping {}\n", .{line});
}
}
const Computer = struct {
pc: usize,
regs: [32]i64,
rcv_queue: [256]i64,
rcv_len: usize,
send_count: usize,
};
//var cpus = [_]Computer{
// Computer{ .pc = 0, .regs = [1]i64{0} ** 32, .rcv_queue = undefined, .rcv_len = 0, .send_count = 0 },
// Computer{ .pc = 0, .regs = [1]i64{0} ** 32, .rcv_queue = undefined, .rcv_len = 0, .send_count = 0 },
//};
//cpus[0].regs['p' - 'a'] = 0;
//cpus[1].regs['p' - 'a'] = 1;
var c = Computer{ .pc = 0, .regs = [1]i64{0} ** 32, .rcv_queue = undefined, .rcv_len = 0, .send_count = 0 };
c.regs[0] = 1;
var muls: u32 = 0;
run: while (c.pc < program_len) {
const insn = &program[c.pc];
switch (insn.opcode) {
.set => {
//const is_input = (insn.arg[1] == .reg and insn.arg[1].reg == 31);
//const is_output = (insn.arg[0] == .reg and insn.arg[0].reg == 31);
//if (is_input) {
// if (c.rcv_len == 0) {
// trace("{}: rcv <- stalled\n", .{icpu});
//
// break :run; // stall
// }
// trace("{}: rcv <- {}\n", .{ icpu, c.rcv_queue[0] });
//
// c.regs[insn.arg[0].reg] = c.rcv_queue[0];
// std.mem.copy(i64, c.rcv_queue[0 .. c.rcv_len - 1], c.rcv_queue[1..c.rcv_len]);
// c.rcv_len -= 1;
//} else if (is_output) {
// other.rcv_queue[other.rcv_len] = switch (insn.arg[1]) {
// .imm => |imm| imm,
// .reg => |reg| c.regs[reg],
// };
// trace("{}: snd -> {}\n", .{ icpu, other.rcv_queue[other.rcv_len] });
// other.rcv_len += 1;
// c.send_count += 1;
//} else
{
c.regs[insn.arg[0].reg] = switch (insn.arg[1]) {
.imm => |imm| imm,
.reg => |reg| c.regs[reg],
};
}
},
.add => {
c.regs[insn.arg[0].reg] += switch (insn.arg[1]) {
.imm => |imm| imm,
.reg => |reg| c.regs[reg],
};
},
.sub => {
c.regs[insn.arg[0].reg] -= switch (insn.arg[1]) {
.imm => |imm| imm,
.reg => |reg| c.regs[reg],
};
},
.mul => {
muls += 1;
c.regs[insn.arg[0].reg] *= switch (insn.arg[1]) {
.imm => |imm| imm,
.reg => |reg| c.regs[reg],
};
},
.mod => {
c.regs[insn.arg[0].reg] =
@mod(c.regs[insn.arg[0].reg], switch (insn.arg[1]) {
.imm => |imm| imm,
.reg => |reg| c.regs[reg],
});
},
.jgz => {
const val = switch (insn.arg[0]) {
.imm => |imm| imm,
.reg => |reg| c.regs[reg],
};
const ofs = switch (insn.arg[1]) {
.imm => |imm| imm,
.reg => |reg| c.regs[reg],
};
if (val > 0) {
c.pc = @intCast(usize, @intCast(i32, c.pc) + ofs);
continue; // skip c.pc + 1...
}
},
.jnz => {
const val = switch (insn.arg[0]) {
.imm => |imm| imm,
.reg => |reg| c.regs[reg],
};
const ofs = switch (insn.arg[1]) {
.imm => |imm| imm,
.reg => |reg| c.regs[reg],
};
if (val != 0) {
c.pc = @intCast(usize, @intCast(i32, c.pc) + ofs);
continue; // skip c.pc + 1...
}
},
}
c.pc += 1;
}
try stdout.print("muls = {}\ncpu = {}, reg'h'={}\n", .{ muls, c, c.regs['h' - 'a'] });
} | 2017/day23.zig |
const std = @import("std");
const expect = std.testing.expect;
fn Node(comptime T: type) type {
return struct {
value: T,
parent: ?*Node(T) = null,
left: ?*Node(T) = null,
right: ?*Node(T) = null,
};
}
/// References: Introduction to algorithms / <NAME>...[et al.]. -3rd ed.
fn Tree(comptime T: type) type {
return struct {
root: ?*Node(T) = null,
//Exercise: why does the worst case performance of binary search trees
//`O(n)` differ from binary search on sorted arrays `O(log n)`?
pub fn search(node: ?*Node(T), value: T) ?*Node(T) {
if (node == null or node.?.value == value) {
return node;
}
if (value < node.?.value) {
return search(node.?.left, value);
} else {
return search(node.?.right, value);
}
}
//Based on the insertions can you see how this data structure relates
//to sorting? Hint: try outputting the resulting tree
pub fn insert(self: *Tree(T), z: *Node(T)) void {
var y: ?*Node(T) = null;
var x = self.root;
while (x) |node| {
y = node;
if (z.value < node.value) {
x = node.left;
} else {
x = node.right;
}
}
z.parent = y;
if (y == null) {
self.root = z;
} else if (z.value < y.?.value) {
y.?.left = z;
} else {
y.?.right = z;
}
}
};
}
pub fn main() !void {}
test "search empty tree" {
var tree = Tree(i32){};
var result = Tree(i32).search(tree.root, 3);
try expect(result == null);
}
test "search an existing element" {
var tree = Tree(i32){};
var node = Node(i32){ .value = 3 };
tree.insert(&node);
var result = Tree(i32).search(tree.root, 3);
try expect(result.? == &node);
}
test "search non-existent element" {
var tree = Tree(i32){};
var node = Node(i32){ .value = 3 };
tree.insert(&node);
var result = Tree(i32).search(tree.root, 4);
try expect(result == null);
}
test "search for an element with multiple nodes" {
var tree = Tree(i32){};
const values = [_]i32{ 15, 18, 17, 6, 7, 20, 3, 13, 2, 4, 9 };
for (values) |v| {
var node = Node(i32){ .value = v };
tree.insert(&node);
}
var result = Tree(i32).search(tree.root, 9);
try expect(result.?.value == 9);
} | search_trees/binary_search_tree.zig |
const std = @import("std");
const builtin = @import("builtin");
pub const Node = struct {
next: ?*Node,
};
/// Multi producer single consumer unbounded atomic queue.
/// Consumer is responsible for managing memory for nodes.
pub fn MPSCUnboundedQueue(comptime T: type, comptime member_name: []const u8) type {
return struct {
/// Head of the queue
head: *Node,
/// Tail of the queue
tail: *Node,
/// Dummy node
dummy: Node,
/// Convert reference to T to reference to atomic queue node
fn ref_to_node(ref: *T) *Node {
return &@field(ref, member_name);
}
/// Convert reference to atomic queue node to reference to T
fn node_to_ref(node: *Node) *T {
return @fieldParentPtr(T, member_name, node);
}
/// Convert nullable reference to T to mullable reference to atomic queue node
fn ref_to_node_opt(ref: *T) *Node {
return if (ref) |ref_nonnull| ref_to_node(ref_nonnull) else null;
}
/// Convert mullable reference to atomic queue node to nullable reference to T
fn node_to_ref_opt(node: *Node) *T {
return if (node) |node_nonnull| node_to_ref(node_nonnull) else null;
}
/// Create lock-free queue
pub fn init(self: *@This()) void {
self.head = &self.dummy;
self.tail = self.head;
self.head.next = null;
}
/// Enqueue element by reference to the node
pub fn enqueue_impl(self: *@This(), node: *Node) void {
// We don't want this to be reordered (as otherwise next may be not null). Use .Release
@atomicStore(?*Node, &node.next, null, .Release);
const prev = @atomicRmw(*Node, &self.head, .Xchg, node, .AcqRel);
@atomicStore(?*Node, &prev.next, node, .Release);
}
/// Enqueue element
pub fn enqueue(self: *@This(), elem: *T) void {
self.enqueue_impl(ref_to_node(elem));
}
/// Try to dequeue
pub fn dequeue(self: *@This()) ?*T {
// Consumer thread will also have consistent
// view of tail, as its the one
// that reads it / writes to it
var tail = self.tail;
// Load next with acquire, as we don't want that to be reordered
var next = @atomicLoad(?*Node, &tail.next, .Acquire);
// Make sure that queue tail is not pointing at dummy element
if (tail == &self.dummy) {
if (next) |next_nonnull| {
// Skip dummy element. At this point,
// there is not a single pointer to dummy
self.tail = next_nonnull;
tail = next_nonnull;
next = @atomicLoad(?*Node, &tail.next, .Acquire);
} else {
// No nodes in the queue =(
// (at least they were not visible to us)
return null;
}
}
if (next) |next_nonnull| {
// Tail exists (and not dummy), and next exists
// Tail can be returned without worrying
// about updates (they may only take place for the next node)
self.tail = next_nonnull;
return node_to_ref(tail);
}
// Tail exists, but next has not existed (it may now as code is lock free)
// Check if head points to the same element as tail
// (there is actually only one element)
var head = @atomicLoad(*Node, &self.head, .Acquire);
// If tail != head, update is going on, as head was not linked with
// next pointer
// Condvar should pick up push event
if (tail != head) {
return null;
}
// Dummy node is not referenced by anything
// and we have only one node left
// Reinsert it as a marker for as to know
// Where current queue ends
self.enqueue_impl(&self.dummy);
next = @atomicLoad(?*Node, &tail.next, .Acquire);
if (next) |next_nonnull| {
self.tail = next_nonnull;
return node_to_ref(tail);
}
return null;
}
};
}
test "insertion tests" {
const TestNode = struct {
hook: Node = undefined,
val: u64,
};
var queue: MPSCUnboundedQueue(TestNode, "hook") = undefined;
queue.init();
var elems = [_]TestNode{
.{ .val = 1 },
.{ .val = 2 },
.{ .val = 3 },
};
queue.enqueue(&elems[0]);
queue.enqueue(&elems[1]);
queue.enqueue(&elems[2]);
std.testing.expect(queue.dequeue() == &elems[0]);
std.testing.expect(queue.dequeue() == &elems[1]);
std.testing.expect(queue.dequeue() == &elems[2]);
std.testing.expect(queue.dequeue() == null);
} | src/lib/atomic_queue.zig |
const std = @import("std");
usingnamespace @import("kiragine").kira.log;
const engine = @import("kiragine");
fn draw() !void {
engine.clearScreen(0.1, 0.1, 0.1, 1.0);
// Push the pixel batch, it can't be mixed with any other
try engine.pushBatch2D(engine.Renderer2DBatchTag.pixels);
// Draw pixels
var i: u32 = 0;
while (i < 10) : (i += 1) {
try engine.drawPixel(.{ .x = 630 + @intToFloat(f32, i), .y = 100 + @intToFloat(f32, i * i) }, engine.Colour.rgba(240, 30, 30, 255));
try engine.drawPixel(.{ .x = 630 - @intToFloat(f32, i), .y = 100 + @intToFloat(f32, i * i) }, engine.Colour.rgba(240, 240, 240, 255));
}
// Pops the current batch
try engine.popBatch2D();
// Push the line batch, it can't be mixed with any other
try engine.pushBatch2D(engine.Renderer2DBatchTag.lines);
// Draw line
try engine.drawLine(.{ .x = 400, .y = 400 }, .{ .x = 400, .y = 500 }, engine.Colour.rgba(255, 255, 255, 255));
// Pops the current batch
try engine.popBatch2D();
// Push the triangle batch, it can be mixed with quad batch
try engine.pushBatch2D(engine.Renderer2DBatchTag.triangles);
// or
// try engine.pushBatch2D(engine.Renderer2DBatchTag.quads);
const triangle = [3]engine.Vec2f{
.{ .x = 100, .y = 100 },
.{ .x = 125, .y = 75 },
.{ .x = 150, .y = 100 },
};
// Draw triangle
try engine.drawTriangle(triangle[0], triangle[1], triangle[2], engine.Colour.rgba(70, 200, 30, 255));
// Draw rectangle
try engine.drawRectangle(.{ .x = 300, .y = 300, .width = 32, .height = 32 }, engine.Colour.rgba(200, 70, 30, 255));
// Draw rectangle rotated
const origin = engine.Vec2f{ .x = 16, .y = 16 };
const rot = engine.kira.math.deg2radf(45);
try engine.drawRectangleRotated(.{ .x = 500, .y = 300, .width = 32, .height = 32 }, origin, rot, engine.Colour.rgba(30, 70, 200, 255));
// Draws a circle
try engine.drawCircle(.{ .x = 700, .y = 500 }, 30, engine.Colour.rgba(200, 200, 200, 255));
// Pops the current batch
try engine.popBatch2D();
}
fn setShaderAttribs() void {
const stride = @sizeOf(engine.Vertex2DNoTexture);
engine.kira.gl.shaderProgramSetVertexAttribArray(0, true);
engine.kira.gl.shaderProgramSetVertexAttribArray(1, true);
engine.kira.gl.shaderProgramSetVertexAttribPointer(0, 2, f32, false, stride, @intToPtr(?*const c_void, @byteOffsetOf(engine.Vertex2DNoTexture, "position")));
engine.kira.gl.shaderProgramSetVertexAttribPointer(1, 4, f32, false, stride, @intToPtr(?*const c_void, @byteOffsetOf(engine.Vertex2DNoTexture, "colour")));
}
const vertex_shader =
\\#version 330 core
\\layout (location = 0) in vec2 aPos;
\\layout (location = 1) in vec4 aColour;
\\
\\out vec4 ourColour;
\\uniform mat4 MVP;
\\
\\void main() {
\\ gl_Position = MVP * vec4(aPos.xy, 0.0, 1.0);
\\ ourColour = aColour;
\\}
;
const fragment_shader =
\\#version 330 core
\\
\\out vec4 final;
\\in vec4 ourColour;
\\
\\void main() {
\\ final = vec4(1.0, 1.0, 1.0, 1.0); // Everything is white
\\}
;
const windowWidth = 1024;
const windowHeight = 768;
const title = "Custom batch";
const targetfps = 60;
pub fn main() !void {
const callbacks = engine.Callbacks{
.draw = draw,
};
try engine.init(callbacks, windowWidth, windowHeight, title, targetfps, std.heap.page_allocator);
var batch: engine.Batch2DQuadNoTexture = undefined;
var shader = try engine.kira.gl.shaderProgramCreate(std.heap.page_allocator, vertex_shader, fragment_shader);
try batch.create(shader, setShaderAttribs);
try engine.open();
// Enables the non-textured custom batch,
// everything should be white, if not there is a problem with custom batch and shader
try engine.enableCustomBatch2D(engine.Batch2DQuadNoTexture, &batch, shader);
try engine.update();
// Disables the non-textured custom batch
engine.disableCustomBatch2D(engine.Batch2DQuadNoTexture);
batch.destroy();
engine.kira.gl.shaderProgramDelete(shader);
try engine.deinit();
} | examples/custombatch.zig |
const std = @import("std");
const bitjuggle = @import("bitjuggle");
const PrivilegeLevel = @import("types.zig").PrivilegeLevel;
const IntegerRegister = @import("types.zig").IntegerRegister;
const ExceptionCode = @import("types.zig").ExceptionCode;
const ContextStatus = @import("types.zig").ContextStatus;
const VectorMode = @import("types.zig").VectorMode;
const AddressTranslationMode = @import("types.zig").AddressTranslationMode;
pub const Csr = enum(u12) {
/// Supervisor address translation and protection
satp = 0x180,
/// Supervisor trap handler base address
stvec = 0x105,
/// Supervisor exception program counter
sepc = 0x141,
/// Supervisor trap cause
scause = 0x142,
/// Supervisor bad address or instruction
stval = 0x143,
/// Hardware thread ID
mhartid = 0xF14,
/// Machine status register
mstatus = 0x300,
/// Machine trap-handler base address
mtvec = 0x305,
/// Machine exception delegation register
medeleg = 0x302,
/// Machine interrupt delegation register
mideleg = 0x303,
/// Machine interrupt-enable register
mie = 0x304,
/// Machine exception program counter
mepc = 0x341,
/// Machine trap cause
mcause = 0x342,
/// Machine bad address or instruction
mtval = 0x343,
/// Machine interrupt pending
mip = 0x344,
/// Physical memory protection configuration
pmpcfg0 = 0x3A0,
pmpcfg2 = 0x3A2,
pmpcfg4 = 0x3A4,
pmpcfg6 = 0x3A6,
pmpcfg8 = 0x3A8,
pmpcfg10 = 0x3AA,
pmpcfg12 = 0x3AC,
pmpcfg14 = 0x3AE,
/// Physical memory protection address register
pmpaddr0 = 0x3B0,
pmpaddr1 = 0x3B1,
pmpaddr2 = 0x3B2,
pmpaddr3 = 0x3B3,
pmpaddr4 = 0x3B4,
pmpaddr5 = 0x3B5,
pmpaddr6 = 0x3B6,
pmpaddr7 = 0x3B7,
pmpaddr8 = 0x3B8,
pmpaddr9 = 0x3B9,
pmpaddr10 = 0x3BA,
pmpaddr11 = 0x3BB,
pmpaddr12 = 0x3BC,
pmpaddr13 = 0x3BD,
pmpaddr14 = 0x3BE,
pmpaddr15 = 0x3BF,
pmpaddr16 = 0x3C0,
pmpaddr17 = 0x3C1,
pmpaddr18 = 0x3C2,
pmpaddr19 = 0x3C3,
pmpaddr20 = 0x3C4,
pmpaddr21 = 0x3C5,
pmpaddr22 = 0x3C6,
pmpaddr23 = 0x3C7,
pmpaddr24 = 0x3C8,
pmpaddr25 = 0x3C9,
pmpaddr26 = 0x3CA,
pmpaddr27 = 0x3CB,
pmpaddr28 = 0x3CC,
pmpaddr29 = 0x3CD,
pmpaddr30 = 0x3CE,
pmpaddr31 = 0x3CF,
pmpaddr32 = 0x3D0,
pmpaddr33 = 0x3D1,
pmpaddr34 = 0x3D2,
pmpaddr35 = 0x3D3,
pmpaddr36 = 0x3D4,
pmpaddr37 = 0x3D5,
pmpaddr38 = 0x3D6,
pmpaddr39 = 0x3D7,
pmpaddr40 = 0x3D8,
pmpaddr41 = 0x3D9,
pmpaddr42 = 0x3DA,
pmpaddr43 = 0x3DB,
pmpaddr44 = 0x3DC,
pmpaddr45 = 0x3DD,
pmpaddr46 = 0x3DE,
pmpaddr47 = 0x3DF,
pmpaddr48 = 0x3E0,
pmpaddr49 = 0x3E1,
pmpaddr50 = 0x3E2,
pmpaddr51 = 0x3E3,
pmpaddr52 = 0x3E4,
pmpaddr53 = 0x3E5,
pmpaddr54 = 0x3E6,
pmpaddr55 = 0x3E7,
pmpaddr56 = 0x3E8,
pmpaddr57 = 0x3E9,
pmpaddr58 = 0x3EA,
pmpaddr59 = 0x3EB,
pmpaddr60 = 0x3EC,
pmpaddr61 = 0x3ED,
pmpaddr62 = 0x3EE,
pmpaddr63 = 0x3EF,
pub fn getCsr(value: u12) !Csr {
return std.meta.intToEnum(Csr, value) catch {
std.log.emerg("invalid csr 0x{X}", .{value});
return error.InvalidCsr;
};
}
pub fn canRead(self: Csr, privilege_level: PrivilegeLevel) bool {
const csr_value = @enumToInt(self);
const lowest_privilege_level = bitjuggle.getBits(csr_value, 8, 2);
if (@enumToInt(privilege_level) < lowest_privilege_level) return false;
return true;
}
pub fn canWrite(self: Csr, privilege_level: PrivilegeLevel) bool {
const csr_value = @enumToInt(self);
const lowest_privilege_level = bitjuggle.getBits(csr_value, 8, 2);
if (@enumToInt(privilege_level) < lowest_privilege_level) return false;
return bitjuggle.getBits(csr_value, 10, 2) != @as(u12, 0b11);
}
};
pub const Mstatus = extern union {
/// supervisor interrupts enabled
sie: bitjuggle.Bitfield(u64, 1, 1),
/// machine interrupts enabled
mie: bitjuggle.Bitfield(u64, 3, 1),
/// supervisor interrupts enabled - prior
spie: bitjuggle.Bitfield(u64, 5, 1),
// user endian
ube: bitjuggle.Bitfield(u64, 6, 1),
/// machine interrupts enabled - prior
mpie: bitjuggle.Bitfield(u64, 7, 1),
/// supervisor previous privilege level
spp: bitjuggle.Bitfield(u64, 8, 1),
/// machine previous privilege level
mpp: bitjuggle.Bitfield(u64, 11, 2),
/// floating point state
fs: bitjuggle.Bitfield(u64, 13, 2),
/// extension state
xs: bitjuggle.Bitfield(u64, 15, 2),
/// modify privilege of loads and stores
mprv: bitjuggle.Bitfield(u64, 17, 1),
/// supervisor user memory access
sum: bitjuggle.Bitfield(u64, 18, 1),
/// make executable readable
mxr: bitjuggle.Bitfield(u64, 19, 1),
/// trap virtual memory
tvm: bitjuggle.Bitfield(u64, 20, 1),
/// timeout wait
tw: bitjuggle.Bitfield(u64, 21, 1),
/// trap sret
tsr: bitjuggle.Bitfield(u64, 22, 1),
/// user X-LEN
uxl: bitjuggle.Bitfield(u64, 32, 2),
/// supervisor X-LEN
sxl: bitjuggle.Bitfield(u64, 34, 2),
// supervisor endian
sbe: bitjuggle.Bitfield(u64, 36, 1),
// machine endian
mbe: bitjuggle.Bitfield(u64, 37, 1),
/// state dirty
sd: bitjuggle.Bitfield(u64, 63, 1),
backing: u64,
pub const unmodifiable_mask: u64 = blk: {
var unmodifiable = Mstatus{ .backing = 0 };
unmodifiable.ube.write(1);
unmodifiable.uxl.write(std.math.maxInt(u2));
unmodifiable.sxl.write(std.math.maxInt(u2));
unmodifiable.sbe.write(1);
unmodifiable.mbe.write(1);
break :blk unmodifiable.backing;
};
pub const modifiable_mask = ~unmodifiable_mask;
pub const initial_state: Mstatus = blk: {
var initial = Mstatus{ .backing = 0 };
initial.mpp.write(@enumToInt(PrivilegeLevel.Machine));
initial.spp.write(@enumToInt(PrivilegeLevel.Supervisor));
initial.fs.write(@enumToInt(ContextStatus.Initial));
initial.xs.write(@enumToInt(ContextStatus.Initial));
initial.uxl.write(2);
initial.sxl.write(2);
break :blk initial;
};
};
pub const MCause = extern union {
code: bitjuggle.Bitfield(u64, 0, 63),
interrupt: bitjuggle.Bitfield(u64, 63, 1),
backing: u64,
};
pub const Mtvec = extern union {
mode: bitjuggle.Bitfield(u64, 0, 2),
base: bitjuggle.Bitfield(u64, 2, 62),
backing: u64,
};
pub const Stvec = extern union {
mode: bitjuggle.Bitfield(u64, 0, 2),
base: bitjuggle.Bitfield(u64, 2, 62),
backing: u64,
};
pub const SCause = extern union {
code: bitjuggle.Bitfield(u64, 0, 63),
interrupt: bitjuggle.Bitfield(u64, 63, 1),
backing: u64,
};
pub const Satp = extern union {
ppn: bitjuggle.Bitfield(u64, 0, 44),
asid: bitjuggle.Bitfield(u64, 44, 16),
mode: bitjuggle.Bitfield(u64, 60, 4),
backing: u64,
};
comptime {
std.testing.refAllDecls(@This());
} | lib/csr.zig |
const std = @import("std");
const log = std.log;
const cuda = @import("cudaz");
const cu = cuda.cu;
const ARRAY_SIZE = 100;
pub fn main() anyerror!void {
var general_purpose_allocator = std.heap.GeneralPurposeAllocator(.{}){};
const alloc = general_purpose_allocator.allocator();
const args = try std.process.argsAlloc(alloc);
defer std.process.argsFree(alloc, args);
var stream = try cuda.Stream.init(0);
defer stream.deinit();
// Instructions: This program is needed for the next quiz
// uncomment increment_naive to measure speed and accuracy
// of non-atomic increments or uncomment increment_atomic to
// measure speed and accuracy of atomic icrements
time_kernel(alloc, &stream, "increment_naive", 1e6, 1000, 1e6);
time_kernel(alloc, &stream, "increment_atomic", 1e6, 1000, 1e6);
time_kernel(alloc, &stream, "increment_naive", 1e6, 1000, 100);
time_kernel(alloc, &stream, "increment_atomic", 1e6, 1000, 100);
time_kernel(alloc, &stream, "increment_atomic", 1e7, 1000, 100);
}
fn time_kernel(
alloc: std.mem.Allocator,
stream: *cuda.Stream,
comptime kernel_name: [:0]const u8,
num_threads: u32,
block_width: u32,
comptime array_size: u32,
) void {
_time_kernel(alloc, stream, kernel_name, num_threads, block_width, array_size) catch |err| {
log.err("Failed to run kernel {s}: {}", .{ kernel_name, err });
};
}
fn _time_kernel(
alloc: std.mem.Allocator,
stream: *cuda.Stream,
comptime kernel_name: [:0]const u8,
num_threads: u32,
block_width: u32,
comptime array_size: u32,
) !void {
const kernel = try cuda.Function(kernel_name).init();
// declare and allocate memory
const h_array = try alloc.alloc(i32, array_size);
defer alloc.free(h_array);
var d_array = try cuda.alloc(i32, array_size);
defer cuda.free(d_array);
try cuda.memset(i32, d_array, 0);
log.info("*** Will benchmark kernel {s} ***", .{kernel_name});
log.info("{} total threads in {} blocks writing into {} array elements", .{ num_threads, num_threads / block_width, array_size });
var timer = cuda.GpuTimer.start(stream);
try kernel.launch(
stream,
cuda.Grid.init1D(num_threads, block_width),
.{ d_array.ptr, array_size },
);
timer.stop();
// copy back the array of sums from GPU and print
try cuda.memcpyDtoH(i32, h_array, d_array);
log.info("array: {any}", .{h_array[0..std.math.min(h_array.len, 100)]});
log.info("time elapsed: {d:.4} ms", .{timer.elapsed()});
} | CS344/src/lesson2.zig |
const c = @import("c.zig");
const nk = @import("../nuklear.zig");
const std = @import("std");
const mem = std.mem;
const testing = std.testing;
const Str = @This();
c: c.struct_nk_str,
pub fn init(allocator: *mem.Allocator, size: usize) Str {
var res: Str = undefined;
c.nk_str_init(&res.c, &nk.allocator(allocator), size);
return res;
}
pub fn initFixed(bytes: []u8) Str {
var res: Str = undefined;
c.nk_str_init_fixed(&res.c, @ptrCast(*c_void, bytes.ptr), bytes.len);
return res;
}
pub fn clear(str: *Str) void {
return c.nk_str_clear(&str.c);
}
pub fn free(str: *Str) void {
return c.nk_str_free(&str.c);
}
pub fn appendStrChar(str: *Str, t: []const u8) usize {
const res = c.nk_str_append_str_char(&str.c, nk.slice(t));
return @intCast(usize, res);
}
pub fn appendStrRunes(str: *Str, runes: []const nk.Rune) c_int {
return c.nk_str_append_str_runes(&str.c, runes.ptr, runes.len);
}
pub fn insertAtChar(str: *Str, pos: c_int, t: []const u8) c_int {
return c.nk_str_insert_at_char(&str.c, pos, nk.slice(t));
}
pub fn insertAtRune(str: *Str, pos: c_int, t: []const u8) c_int {
return c.nk_str_insert_at_rune(&str.c, pos, nk.slice(t));
}
pub fn insertTextRunes(str: *Str, pos: c_int, a: [*c]const nk.Rune, u: c_int) c_int {
return c.nk_str_insert_text_runes(&str.c, pos, a, u);
}
pub fn insertStrRunes(str: *Str, pos: c_int, a: [*c]const nk.Rune) c_int {
return c.nk_str_insert_str_runes(&str.c, pos, a);
}
pub fn removeChars(str: *Str, n: usize) void {
return c.nk_str_remove_chars(&str.c, @intCast(c_int, n));
}
pub fn removeRunes(str: *Str, n: usize) void {
return c.nk_str_remove_runes(&str.c, @intCast(c_int, n));
}
pub fn deleteChars(str: *Str, pos: usize, n: usize) void {
return c.nk_str_delete_chars(&str.c, @intCast(c_int, pos), @intCast(c_int, n));
}
pub fn deleteRunes(str: *Str, pos: usize, n: usize) void {
return c.nk_str_delete_runes(&str.c, @intCast(c_int, pos), @intCast(c_int, n));
}
pub fn atChar(str: *Str, pos: usize) *u8 {
return c.nk_str_at_char(&str.c, @intCast(c_int, pos));
}
pub const RuneAtResult = struct {
unicode: nk.Rune,
slice: []u8,
};
pub fn atRune(str: *Str, pos: usize) RuneAtResult {
var unicode: nk.Rune = undefined;
var l: c_int = undefined;
const ptr = c.nk_str_at_rune(&str.c, @intCast(c_int, pos), &unicode, &l);
return .{ .unicode = unicode, .slice = ptr[0..@intCast(usize, l)] };
}
pub fn runeAt(str: Str, pos: c_int) nk.Rune {
return c.nk_str_rune_at(&str.c, pos);
}
pub fn atCharConst(str: Str, pos: c_int) *const u8 {
return c.nk_str_at_char_const(&str.c, pos);
}
pub fn atConst(str: Str, pos: c_int, unicode: [*c]nk.Rune) []const u8 {
const res = c.nk_str_at_const(&str.c, pos, unicode);
return res.ptr[0..res.len];
}
pub fn get(str: *Str) []u8 {
return nk.discardConst(str.getConst());
}
pub fn getConst(str: Str) []const u8 {
const res = c.nk_str_get_const(&str.c);
return res.ptr[0..res.len];
}
pub fn len(str: *Str) c_int {
return c.nk_str_len(&str.c);
}
test {
testing.refAllDecls(@This());
} | src/Str.zig |
const std = @import("std");
const assert = std.debug.assert;
const os = std.os;
const linux = os.linux;
const IO_Uring = linux.IO_Uring;
const io_uring_cqe = linux.io_uring_cqe;
const io_uring_sqe = linux.io_uring_sqe;
const log = std.log.scoped(.io);
const config = @import("../config.zig");
const FIFO = @import("../fifo.zig").FIFO;
const buffer_limit = @import("../io.zig").buffer_limit;
pub const IO = struct {
ring: IO_Uring,
/// Operations not yet submitted to the kernel and waiting on available space in the
/// submission queue.
unqueued: FIFO(Completion) = .{},
/// Completions that are ready to have their callbacks run.
completed: FIFO(Completion) = .{},
pub fn init(entries: u12, flags: u32) !IO {
return IO{ .ring = try IO_Uring.init(entries, flags) };
}
pub fn deinit(self: *IO) void {
self.ring.deinit();
}
/// Pass all queued submissions to the kernel and peek for completions.
pub fn tick(self: *IO) !void {
// We assume that all timeouts submitted by `run_for_ns()` will be reaped by `run_for_ns()`
// and that `tick()` and `run_for_ns()` cannot be run concurrently.
// Therefore `timeouts` here will never be decremented and `etime` will always be false.
var timeouts: usize = 0;
var etime = false;
try self.flush(0, &timeouts, &etime);
assert(etime == false);
// Flush any SQEs that were queued while running completion callbacks in `flush()`:
// This is an optimization to avoid delaying submissions until the next tick.
// At the same time, we do not flush any ready CQEs since SQEs may complete synchronously.
// We guard against an io_uring_enter() syscall if we know we do not have any queued SQEs.
// We cannot use `self.ring.sq_ready()` here since this counts flushed and unflushed SQEs.
const queued = self.ring.sq.sqe_tail -% self.ring.sq.sqe_head;
if (queued > 0) {
try self.flush_submissions(0, &timeouts, &etime);
assert(etime == false);
}
}
/// Pass all queued submissions to the kernel and run for `nanoseconds`.
/// The `nanoseconds` argument is a u63 to allow coercion to the i64 used
/// in the kernel_timespec struct.
pub fn run_for_ns(self: *IO, nanoseconds: u63) !void {
// We must use the same clock source used by io_uring (CLOCK_MONOTONIC) since we specify the
// timeout below as an absolute value. Otherwise, we may deadlock if the clock sources are
// dramatically different. Any kernel that supports io_uring will support CLOCK_MONOTONIC.
var current_ts: os.timespec = undefined;
os.clock_gettime(os.CLOCK.MONOTONIC, ¤t_ts) catch unreachable;
// The absolute CLOCK_MONOTONIC time after which we may return from this function:
const timeout_ts: os.linux.kernel_timespec = .{
.tv_sec = current_ts.tv_sec,
.tv_nsec = current_ts.tv_nsec + nanoseconds,
};
var timeouts: usize = 0;
var etime = false;
while (!etime) {
const timeout_sqe = self.ring.get_sqe() catch blk: {
// The submission queue is full, so flush submissions to make space:
try self.flush_submissions(0, &timeouts, &etime);
break :blk self.ring.get_sqe() catch unreachable;
};
// Submit an absolute timeout that will be canceled if any other SQE completes first:
linux.io_uring_prep_timeout(timeout_sqe, &timeout_ts, 1, os.linux.IORING_TIMEOUT_ABS);
timeout_sqe.user_data = 0;
timeouts += 1;
// The amount of time this call will block is bounded by the timeout we just submitted:
try self.flush(1, &timeouts, &etime);
}
// Reap any remaining timeouts, which reference the timespec in the current stack frame.
// The busy loop here is required to avoid a potential deadlock, as the kernel determines
// when the timeouts are pushed to the completion queue, not us.
while (timeouts > 0) _ = try self.flush_completions(0, &timeouts, &etime);
}
fn flush(self: *IO, wait_nr: u32, timeouts: *usize, etime: *bool) !void {
// Flush any queued SQEs and reuse the same syscall to wait for completions if required:
try self.flush_submissions(wait_nr, timeouts, etime);
// We can now just peek for any CQEs without waiting and without another syscall:
try self.flush_completions(0, timeouts, etime);
// Run completions only after all completions have been flushed:
// Loop on a copy of the linked list, having reset the list first, so that any synchronous
// append on running a completion is executed only the next time round the event loop,
// without creating an infinite loop.
{
var copy = self.completed;
self.completed = .{};
while (copy.pop()) |completion| completion.complete();
}
// Again, loop on a copy of the list to avoid an infinite loop:
{
var copy = self.unqueued;
self.unqueued = .{};
while (copy.pop()) |completion| self.enqueue(completion);
}
}
fn flush_completions(self: *IO, wait_nr: u32, timeouts: *usize, etime: *bool) !void {
var cqes: [256]io_uring_cqe = undefined;
var wait_remaining = wait_nr;
while (true) {
// Guard against waiting indefinitely (if there are too few requests inflight),
// especially if this is not the first time round the loop:
const completed = self.ring.copy_cqes(&cqes, wait_remaining) catch |err| switch (err) {
error.SignalInterrupt => continue,
else => return err,
};
if (completed > wait_remaining) wait_remaining = 0 else wait_remaining -= completed;
for (cqes[0..completed]) |cqe| {
if (cqe.user_data == 0) {
timeouts.* -= 1;
// We are only done if the timeout submitted was completed due to time, not if
// it was completed due to the completion of an event, in which case `cqe.res`
// would be 0. It is possible for multiple timeout operations to complete at the
// same time if the nanoseconds value passed to `run_for_ns()` is very short.
if (-cqe.res == @enumToInt(os.E.TIME)) etime.* = true;
continue;
}
const completion = @intToPtr(*Completion, @intCast(usize, cqe.user_data));
completion.result = cqe.res;
// We do not run the completion here (instead appending to a linked list) to avoid:
// * recursion through `flush_submissions()` and `flush_completions()`,
// * unbounded stack usage, and
// * confusing stack traces.
self.completed.push(completion);
}
if (completed < cqes.len) break;
}
}
fn flush_submissions(self: *IO, wait_nr: u32, timeouts: *usize, etime: *bool) !void {
while (true) {
_ = self.ring.submit_and_wait(wait_nr) catch |err| switch (err) {
error.SignalInterrupt => continue,
// Wait for some completions and then try again:
// See https://github.com/axboe/liburing/issues/281 re: error.SystemResources.
// Be careful also that copy_cqes() will flush before entering to wait (it does):
// https://github.com/axboe/liburing/commit/35c199c48dfd54ad46b96e386882e7ac341314c5
error.CompletionQueueOvercommitted, error.SystemResources => {
try self.flush_completions(1, timeouts, etime);
continue;
},
else => return err,
};
break;
}
}
fn enqueue(self: *IO, completion: *Completion) void {
const sqe = self.ring.get_sqe() catch |err| switch (err) {
error.SubmissionQueueFull => {
self.unqueued.push(completion);
return;
},
};
completion.prep(sqe);
}
/// This struct holds the data needed for a single io_uring operation
pub const Completion = struct {
io: *IO,
result: i32 = undefined,
next: ?*Completion = null,
operation: Operation,
context: ?*anyopaque,
callback: fn (context: ?*anyopaque, completion: *Completion, result: *const anyopaque) void,
fn prep(completion: *Completion, sqe: *io_uring_sqe) void {
switch (completion.operation) {
.accept => |*op| {
linux.io_uring_prep_accept(
sqe,
op.socket,
&op.address,
&op.address_size,
os.SOCK.CLOEXEC,
);
},
.close => |op| {
linux.io_uring_prep_close(sqe, op.fd);
},
.connect => |*op| {
linux.io_uring_prep_connect(
sqe,
op.socket,
&op.address.any,
op.address.getOsSockLen(),
);
},
.read => |op| {
linux.io_uring_prep_read(
sqe,
op.fd,
op.buffer[0..buffer_limit(op.buffer.len)],
op.offset,
);
},
.recv => |op| {
linux.io_uring_prep_recv(sqe, op.socket, op.buffer, os.MSG.NOSIGNAL);
},
.send => |op| {
linux.io_uring_prep_send(sqe, op.socket, op.buffer, os.MSG.NOSIGNAL);
},
.timeout => |*op| {
linux.io_uring_prep_timeout(sqe, &op.timespec, 0, 0);
},
.write => |op| {
linux.io_uring_prep_write(
sqe,
op.fd,
op.buffer[0..buffer_limit(op.buffer.len)],
op.offset,
);
},
}
sqe.user_data = @ptrToInt(completion);
}
fn complete(completion: *Completion) void {
switch (completion.operation) {
.accept => {
const result = blk: {
if (completion.result < 0) {
const err = switch (@intToEnum(os.E, -completion.result)) {
.INTR => {
completion.io.enqueue(completion);
return;
},
.AGAIN => error.WouldBlock,
.BADF => error.FileDescriptorInvalid,
.CONNABORTED => error.ConnectionAborted,
.FAULT => unreachable,
.INVAL => error.SocketNotListening,
.MFILE => error.ProcessFdQuotaExceeded,
.NFILE => error.SystemFdQuotaExceeded,
.NOBUFS => error.SystemResources,
.NOMEM => error.SystemResources,
.NOTSOCK => error.FileDescriptorNotASocket,
.OPNOTSUPP => error.OperationNotSupported,
.PERM => error.PermissionDenied,
.PROTO => error.ProtocolFailure,
else => |errno| os.unexpectedErrno(errno),
};
break :blk err;
} else {
break :blk @intCast(os.socket_t, completion.result);
}
};
completion.callback(completion.context, completion, &result);
},
.close => {
const result = blk: {
if (completion.result < 0) {
const err = switch (@intToEnum(os.E, -completion.result)) {
.INTR => {}, // A success, see https://github.com/ziglang/zig/issues/2425
.BADF => error.FileDescriptorInvalid,
.DQUOT => error.DiskQuota,
.IO => error.InputOutput,
.NOSPC => error.NoSpaceLeft,
else => |errno| os.unexpectedErrno(errno),
};
break :blk err;
} else {
assert(completion.result == 0);
}
};
completion.callback(completion.context, completion, &result);
},
.connect => {
const result = blk: {
if (completion.result < 0) {
const err = switch (@intToEnum(os.E, -completion.result)) {
.INTR => {
completion.io.enqueue(completion);
return;
},
.ACCES => error.AccessDenied,
.ADDRINUSE => error.AddressInUse,
.ADDRNOTAVAIL => error.AddressNotAvailable,
.AFNOSUPPORT => error.AddressFamilyNotSupported,
.AGAIN, .INPROGRESS => error.WouldBlock,
.ALREADY => error.OpenAlreadyInProgress,
.BADF => error.FileDescriptorInvalid,
.CONNREFUSED => error.ConnectionRefused,
.CONNRESET => error.ConnectionResetByPeer,
.FAULT => unreachable,
.ISCONN => error.AlreadyConnected,
.NETUNREACH => error.NetworkUnreachable,
.NOENT => error.FileNotFound,
.NOTSOCK => error.FileDescriptorNotASocket,
.PERM => error.PermissionDenied,
.PROTOTYPE => error.ProtocolNotSupported,
.TIMEDOUT => error.ConnectionTimedOut,
else => |errno| os.unexpectedErrno(errno),
};
break :blk err;
} else {
assert(completion.result == 0);
}
};
completion.callback(completion.context, completion, &result);
},
.read => {
const result = blk: {
if (completion.result < 0) {
const err = switch (@intToEnum(os.E, -completion.result)) {
.INTR => {
completion.io.enqueue(completion);
return;
},
.AGAIN => error.WouldBlock,
.BADF => error.NotOpenForReading,
.CONNRESET => error.ConnectionResetByPeer,
.FAULT => unreachable,
.INVAL => error.Alignment,
.IO => error.InputOutput,
.ISDIR => error.IsDir,
.NOBUFS => error.SystemResources,
.NOMEM => error.SystemResources,
.NXIO => error.Unseekable,
.OVERFLOW => error.Unseekable,
.SPIPE => error.Unseekable,
else => |errno| os.unexpectedErrno(errno),
};
break :blk err;
} else {
break :blk @intCast(usize, completion.result);
}
};
completion.callback(completion.context, completion, &result);
},
.recv => {
const result = blk: {
if (completion.result < 0) {
const err = switch (@intToEnum(os.E, -completion.result)) {
.INTR => {
completion.io.enqueue(completion);
return;
},
.AGAIN => error.WouldBlock,
.BADF => error.FileDescriptorInvalid,
.CONNREFUSED => error.ConnectionRefused,
.FAULT => unreachable,
.INVAL => unreachable,
.NOMEM => error.SystemResources,
.NOTCONN => error.SocketNotConnected,
.NOTSOCK => error.FileDescriptorNotASocket,
.CONNRESET => error.ConnectionResetByPeer,
else => |errno| os.unexpectedErrno(errno),
};
break :blk err;
} else {
break :blk @intCast(usize, completion.result);
}
};
completion.callback(completion.context, completion, &result);
},
.send => {
const result = blk: {
if (completion.result < 0) {
const err = switch (@intToEnum(os.E, -completion.result)) {
.INTR => {
completion.io.enqueue(completion);
return;
},
.ACCES => error.AccessDenied,
.AGAIN => error.WouldBlock,
.ALREADY => error.FastOpenAlreadyInProgress,
.AFNOSUPPORT => error.AddressFamilyNotSupported,
.BADF => error.FileDescriptorInvalid,
.CONNRESET => error.ConnectionResetByPeer,
.DESTADDRREQ => unreachable,
.FAULT => unreachable,
.INVAL => unreachable,
.ISCONN => unreachable,
.MSGSIZE => error.MessageTooBig,
.NOBUFS => error.SystemResources,
.NOMEM => error.SystemResources,
.NOTCONN => error.SocketNotConnected,
.NOTSOCK => error.FileDescriptorNotASocket,
.OPNOTSUPP => error.OperationNotSupported,
.PIPE => error.BrokenPipe,
else => |errno| os.unexpectedErrno(errno),
};
break :blk err;
} else {
break :blk @intCast(usize, completion.result);
}
};
completion.callback(completion.context, completion, &result);
},
.timeout => {
assert(completion.result < 0);
const result = switch (@intToEnum(os.E, -completion.result)) {
.INTR => {
completion.io.enqueue(completion);
return;
},
.CANCELED => error.Canceled,
.TIME => {}, // A success.
else => |errno| os.unexpectedErrno(errno),
};
completion.callback(completion.context, completion, &result);
},
.write => {
const result = blk: {
if (completion.result < 0) {
const err = switch (@intToEnum(os.E, -completion.result)) {
.INTR => {
completion.io.enqueue(completion);
return;
},
.AGAIN => error.WouldBlock,
.BADF => error.NotOpenForWriting,
.DESTADDRREQ => error.NotConnected,
.DQUOT => error.DiskQuota,
.FAULT => unreachable,
.FBIG => error.FileTooBig,
.INVAL => error.Alignment,
.IO => error.InputOutput,
.NOSPC => error.NoSpaceLeft,
.NXIO => error.Unseekable,
.OVERFLOW => error.Unseekable,
.PERM => error.AccessDenied,
.PIPE => error.BrokenPipe,
.SPIPE => error.Unseekable,
else => |errno| os.unexpectedErrno(errno),
};
break :blk err;
} else {
break :blk @intCast(usize, completion.result);
}
};
completion.callback(completion.context, completion, &result);
},
}
}
};
/// This union encodes the set of operations supported as well as their arguments.
const Operation = union(enum) {
accept: struct {
socket: os.socket_t,
address: os.sockaddr = undefined,
address_size: os.socklen_t = @sizeOf(os.sockaddr),
},
close: struct {
fd: os.fd_t,
},
connect: struct {
socket: os.socket_t,
address: std.net.Address,
},
read: struct {
fd: os.fd_t,
buffer: []u8,
offset: u64,
},
recv: struct {
socket: os.socket_t,
buffer: []u8,
},
send: struct {
socket: os.socket_t,
buffer: []const u8,
},
timeout: struct {
timespec: os.linux.kernel_timespec,
},
write: struct {
fd: os.fd_t,
buffer: []const u8,
offset: u64,
},
};
pub const AcceptError = error{
WouldBlock,
FileDescriptorInvalid,
ConnectionAborted,
SocketNotListening,
ProcessFdQuotaExceeded,
SystemFdQuotaExceeded,
SystemResources,
FileDescriptorNotASocket,
OperationNotSupported,
PermissionDenied,
ProtocolFailure,
} || os.UnexpectedError;
pub fn accept(
self: *IO,
comptime Context: type,
context: Context,
comptime callback: fn (
context: Context,
completion: *Completion,
result: AcceptError!os.socket_t,
) void,
completion: *Completion,
socket: os.socket_t,
) void {
completion.* = .{
.io = self,
.context = context,
.callback = struct {
fn wrapper(ctx: ?*anyopaque, comp: *Completion, res: *const anyopaque) void {
callback(
@intToPtr(Context, @ptrToInt(ctx)),
comp,
@intToPtr(*const AcceptError!os.socket_t, @ptrToInt(res)).*,
);
}
}.wrapper,
.operation = .{
.accept = .{
.socket = socket,
.address = undefined,
.address_size = @sizeOf(os.sockaddr),
},
},
};
self.enqueue(completion);
}
pub const CloseError = error{
FileDescriptorInvalid,
DiskQuota,
InputOutput,
NoSpaceLeft,
} || os.UnexpectedError;
pub fn close(
self: *IO,
comptime Context: type,
context: Context,
comptime callback: fn (
context: Context,
completion: *Completion,
result: CloseError!void,
) void,
completion: *Completion,
fd: os.fd_t,
) void {
completion.* = .{
.io = self,
.context = context,
.callback = struct {
fn wrapper(ctx: ?*anyopaque, comp: *Completion, res: *const anyopaque) void {
callback(
@intToPtr(Context, @ptrToInt(ctx)),
comp,
@intToPtr(*const CloseError!void, @ptrToInt(res)).*,
);
}
}.wrapper,
.operation = .{
.close = .{ .fd = fd },
},
};
self.enqueue(completion);
}
pub const ConnectError = error{
AccessDenied,
AddressInUse,
AddressNotAvailable,
AddressFamilyNotSupported,
WouldBlock,
OpenAlreadyInProgress,
FileDescriptorInvalid,
ConnectionRefused,
AlreadyConnected,
NetworkUnreachable,
FileNotFound,
FileDescriptorNotASocket,
PermissionDenied,
ProtocolNotSupported,
ConnectionTimedOut,
} || os.UnexpectedError;
pub fn connect(
self: *IO,
comptime Context: type,
context: Context,
comptime callback: fn (
context: Context,
completion: *Completion,
result: ConnectError!void,
) void,
completion: *Completion,
socket: os.socket_t,
address: std.net.Address,
) void {
completion.* = .{
.io = self,
.context = context,
.callback = struct {
fn wrapper(ctx: ?*anyopaque, comp: *Completion, res: *const anyopaque) void {
callback(
@intToPtr(Context, @ptrToInt(ctx)),
comp,
@intToPtr(*const ConnectError!void, @ptrToInt(res)).*,
);
}
}.wrapper,
.operation = .{
.connect = .{
.socket = socket,
.address = address,
},
},
};
self.enqueue(completion);
}
pub const ReadError = error{
WouldBlock,
NotOpenForReading,
ConnectionResetByPeer,
Alignment,
InputOutput,
IsDir,
SystemResources,
Unseekable,
} || os.UnexpectedError;
pub fn read(
self: *IO,
comptime Context: type,
context: Context,
comptime callback: fn (
context: Context,
completion: *Completion,
result: ReadError!usize,
) void,
completion: *Completion,
fd: os.fd_t,
buffer: []u8,
offset: u64,
) void {
completion.* = .{
.io = self,
.context = context,
.callback = struct {
fn wrapper(ctx: ?*anyopaque, comp: *Completion, res: *const anyopaque) void {
callback(
@intToPtr(Context, @ptrToInt(ctx)),
comp,
@intToPtr(*const ReadError!usize, @ptrToInt(res)).*,
);
}
}.wrapper,
.operation = .{
.read = .{
.fd = fd,
.buffer = buffer,
.offset = offset,
},
},
};
self.enqueue(completion);
}
pub const RecvError = error{
WouldBlock,
FileDescriptorInvalid,
ConnectionRefused,
SystemResources,
SocketNotConnected,
FileDescriptorNotASocket,
} || os.UnexpectedError;
pub fn recv(
self: *IO,
comptime Context: type,
context: Context,
comptime callback: fn (
context: Context,
completion: *Completion,
result: RecvError!usize,
) void,
completion: *Completion,
socket: os.socket_t,
buffer: []u8,
) void {
completion.* = .{
.io = self,
.context = context,
.callback = struct {
fn wrapper(ctx: ?*anyopaque, comp: *Completion, res: *const anyopaque) void {
callback(
@intToPtr(Context, @ptrToInt(ctx)),
comp,
@intToPtr(*const RecvError!usize, @ptrToInt(res)).*,
);
}
}.wrapper,
.operation = .{
.recv = .{
.socket = socket,
.buffer = buffer,
},
},
};
self.enqueue(completion);
}
pub const SendError = error{
AccessDenied,
WouldBlock,
FastOpenAlreadyInProgress,
AddressFamilyNotSupported,
FileDescriptorInvalid,
ConnectionResetByPeer,
MessageTooBig,
SystemResources,
SocketNotConnected,
FileDescriptorNotASocket,
OperationNotSupported,
BrokenPipe,
} || os.UnexpectedError;
pub fn send(
self: *IO,
comptime Context: type,
context: Context,
comptime callback: fn (
context: Context,
completion: *Completion,
result: SendError!usize,
) void,
completion: *Completion,
socket: os.socket_t,
buffer: []const u8,
) void {
completion.* = .{
.io = self,
.context = context,
.callback = struct {
fn wrapper(ctx: ?*anyopaque, comp: *Completion, res: *const anyopaque) void {
callback(
@intToPtr(Context, @ptrToInt(ctx)),
comp,
@intToPtr(*const SendError!usize, @ptrToInt(res)).*,
);
}
}.wrapper,
.operation = .{
.send = .{
.socket = socket,
.buffer = buffer,
},
},
};
self.enqueue(completion);
}
pub const TimeoutError = error{Canceled} || os.UnexpectedError;
pub fn timeout(
self: *IO,
comptime Context: type,
context: Context,
comptime callback: fn (
context: Context,
completion: *Completion,
result: TimeoutError!void,
) void,
completion: *Completion,
nanoseconds: u63,
) void {
completion.* = .{
.io = self,
.context = context,
.callback = struct {
fn wrapper(ctx: ?*anyopaque, comp: *Completion, res: *const anyopaque) void {
callback(
@intToPtr(Context, @ptrToInt(ctx)),
comp,
@intToPtr(*const TimeoutError!void, @ptrToInt(res)).*,
);
}
}.wrapper,
.operation = .{
.timeout = .{
.timespec = .{ .tv_sec = 0, .tv_nsec = nanoseconds },
},
},
};
self.enqueue(completion);
}
pub const WriteError = error{
WouldBlock,
NotOpenForWriting,
NotConnected,
DiskQuota,
FileTooBig,
Alignment,
InputOutput,
NoSpaceLeft,
Unseekable,
AccessDenied,
BrokenPipe,
} || os.UnexpectedError;
pub fn write(
self: *IO,
comptime Context: type,
context: Context,
comptime callback: fn (
context: Context,
completion: *Completion,
result: WriteError!usize,
) void,
completion: *Completion,
fd: os.fd_t,
buffer: []const u8,
offset: u64,
) void {
_ = callback;
completion.* = .{
.io = self,
.context = context,
.callback = struct {
fn wrapper(ctx: ?*anyopaque, comp: *Completion, res: *const anyopaque) void {
callback(
@intToPtr(Context, @ptrToInt(ctx)),
comp,
@intToPtr(*const WriteError!usize, @ptrToInt(res)).*,
);
}
}.wrapper,
.operation = .{
.write = .{
.fd = fd,
.buffer = buffer,
.offset = offset,
},
},
};
self.enqueue(completion);
}
pub const INVALID_SOCKET = -1;
/// Creates a socket that can be used for async operations with the IO instance.
pub fn open_socket(self: *IO, family: u32, sock_type: u32, protocol: u32) !os.socket_t {
_ = self;
return os.socket(family, sock_type, protocol);
}
/// Opens a directory with read only access.
pub fn open_dir(dir_path: [:0]const u8) !os.fd_t {
return os.openZ(dir_path, os.O.CLOEXEC | os.O.RDONLY, 0);
}
/// Opens or creates a journal file:
/// - For reading and writing.
/// - For Direct I/O (if possible in development mode, but required in production mode).
/// - Obtains an advisory exclusive lock to the file descriptor.
/// - Allocates the file contiguously on disk if this is supported by the file system.
/// - Ensures that the file data (and file inode in the parent directory) is durable on disk.
/// The caller is responsible for ensuring that the parent directory inode is durable.
/// - Verifies that the file size matches the expected file size before returning.
pub fn open_file(
self: *IO,
dir_fd: os.fd_t,
relative_path: [:0]const u8,
size: u64,
must_create: bool,
) !os.fd_t {
_ = self;
assert(relative_path.len > 0);
assert(size >= config.sector_size);
assert(size % config.sector_size == 0);
// TODO Use O_EXCL when opening as a block device to obtain a mandatory exclusive lock.
// This is much stronger than an advisory exclusive lock, and is required on some platforms.
var flags: u32 = os.O.CLOEXEC | os.O.RDWR | os.O.DSYNC;
var mode: os.mode_t = 0;
// TODO Document this and investigate whether this is in fact correct to set here.
if (@hasDecl(os.O, "LARGEFILE")) flags |= os.O.LARGEFILE;
var direct_io_supported = false;
if (config.direct_io) {
direct_io_supported = try fs_supports_direct_io(dir_fd);
if (direct_io_supported) {
flags |= os.O.DIRECT;
} else if (config.deployment_environment == .development) {
log.warn("file system does not support Direct I/O", .{});
} else {
// We require Direct I/O for safety to handle fsync failure correctly, and therefore
// panic in production if it is not supported.
@panic("file system does not support Direct I/O");
}
}
if (must_create) {
log.info("creating \"{s}\"...", .{relative_path});
flags |= os.O.CREAT;
flags |= os.O.EXCL;
mode = 0o666;
} else {
log.info("opening \"{s}\"...", .{relative_path});
}
// This is critical as we rely on O_DSYNC for fsync() whenever we write to the file:
assert((flags & os.O.DSYNC) > 0);
// Be careful with openat(2): "If pathname is absolute, then dirfd is ignored." (man page)
assert(!std.fs.path.isAbsolute(relative_path));
const fd = try os.openatZ(dir_fd, relative_path, flags, mode);
// TODO Return a proper error message when the path exists or does not exist (init/start).
errdefer os.close(fd);
// TODO Check that the file is actually a file.
// Obtain an advisory exclusive lock that works only if all processes actually use flock().
// LOCK_NB means that we want to fail the lock without waiting if another process has it.
os.flock(fd, os.LOCK.EX | os.LOCK.NB) catch |err| switch (err) {
error.WouldBlock => @panic("another process holds the data file lock"),
else => return err,
};
// Ask the file system to allocate contiguous sectors for the file (if possible):
// If the file system does not support `fallocate()`, then this could mean more seeks or a
// panic if we run out of disk space (ENOSPC).
if (must_create) {
log.info("allocating {}...", .{std.fmt.fmtIntSizeBin(size)});
fs_allocate(fd, size) catch |err| switch (err) {
error.OperationNotSupported => {
log.warn("file system does not support fallocate(), an ENOSPC will panic", .{});
log.info("allocating by writing to the last sector of the file instead...", .{});
const sector_size = config.sector_size;
const sector: [sector_size]u8 align(sector_size) = [_]u8{0} ** sector_size;
// Handle partial writes where the physical sector is less than a logical sector:
const write_offset = size - sector.len;
var written: usize = 0;
while (written < sector.len) {
written += try os.pwrite(fd, sector[written..], write_offset + written);
}
},
else => |e| return e,
};
}
// The best fsync strategy is always to fsync before reading because this prevents us from
// making decisions on data that was never durably written by a previously crashed process.
// We therefore always fsync when we open the path, also to wait for any pending O_DSYNC.
// Thanks to <NAME> from FoundationDB for diving into our source and pointing this out.
try os.fsync(fd);
// We fsync the parent directory to ensure that the file inode is durably written.
// The caller is responsible for the parent directory inode stored under the grandparent.
// We always do this when opening because we don't know if this was done before crashing.
try os.fsync(dir_fd);
const stat = try os.fstat(fd);
if (stat.size != size) @panic("data file inode size was truncated or corrupted");
return fd;
}
/// Detects whether the underlying file system for a given directory fd supports Direct I/O.
/// Not all Linux file systems support `O_DIRECT`, e.g. a shared macOS volume.
fn fs_supports_direct_io(dir_fd: std.os.fd_t) !bool {
if (!@hasDecl(std.os, "O_DIRECT")) return false;
const path = "fs_supports_direct_io";
const dir = std.fs.Dir{ .fd = dir_fd };
const fd = try os.openatZ(dir_fd, path, os.O.CLOEXEC | os.O.CREAT | os.O.TRUNC, 0o666);
defer os.close(fd);
defer dir.deleteFile(path) catch {};
while (true) {
const res = os.system.openat(dir_fd, path, os.O.CLOEXEC | os.O.RDONLY | os.O.DIRECT, 0);
switch (os.linux.getErrno(res)) {
0 => {
os.close(@intCast(os.fd_t, res));
return true;
},
os.linux.EINTR => continue,
os.linux.EINVAL => return false,
else => |err| return os.unexpectedErrno(err),
}
}
}
/// Allocates a file contiguously using fallocate() if supported.
/// Alternatively, writes to the last sector so that at least the file size is correct.
fn fs_allocate(fd: os.fd_t, size: u64) !void {
const mode: i32 = 0;
const offset: i64 = 0;
const length = @intCast(i64, size);
while (true) {
const rc = os.linux.fallocate(fd, mode, offset, length);
switch (os.linux.getErrno(rc)) {
.SUCCESS => return,
.BADF => return error.FileDescriptorInvalid,
.FBIG => return error.FileTooBig,
.INTR => continue,
.INVAL => return error.ArgumentsInvalid,
.IO => return error.InputOutput,
.NODEV => return error.NoDevice,
.NOSPC => return error.NoSpaceLeft,
.NOSYS => return error.SystemOutdated,
.OPNOTSUPP => return error.OperationNotSupported,
.PERM => return error.PermissionDenied,
.SPIPE => return error.Unseekable,
.TXTBSY => return error.FileBusy,
else => |errno| return os.unexpectedErrno(errno),
}
}
}
}; | src/io/linux.zig |
const std = @import("../std.zig");
const builtin = @import("builtin");
const mem = std.mem;
const debug = std.debug;
const testing = std.testing;
const warn = debug.warn;
const meta = @import("../meta.zig");
//This is necessary if we want to return generic functions directly because of how the
// the type erasure works. see: #1375
fn traitFnWorkaround(comptime T: type) bool {
return false;
}
pub const TraitFn = @TypeOf(traitFnWorkaround);
///
//////Trait generators
//Need TraitList because compiler can't do varargs at comptime yet
pub const TraitList = []const TraitFn;
pub fn multiTrait(comptime traits: TraitList) TraitFn {
const Closure = struct {
pub fn trait(comptime T: type) bool {
inline for (traits) |t|
if (!t(T)) return false;
return true;
}
};
return Closure.trait;
}
test "std.meta.trait.multiTrait" {
const Vector2 = struct {
const MyType = @This();
x: u8,
y: u8,
pub fn add(self: MyType, other: MyType) MyType {
return MyType{
.x = self.x + other.x,
.y = self.y + other.y,
};
}
};
const isVector = multiTrait(&[_]TraitFn{
hasFn("add"),
hasField("x"),
hasField("y"),
});
testing.expect(isVector(Vector2));
testing.expect(!isVector(u8));
}
///
pub fn hasFn(comptime name: []const u8) TraitFn {
const Closure = struct {
pub fn trait(comptime T: type) bool {
if (!comptime isContainer(T)) return false;
if (!comptime @hasDecl(T, name)) return false;
const DeclType = @TypeOf(@field(T, name));
const decl_type_id = @typeId(DeclType);
return decl_type_id == builtin.TypeId.Fn;
}
};
return Closure.trait;
}
test "std.meta.trait.hasFn" {
const TestStruct = struct {
pub fn useless() void {}
};
testing.expect(hasFn("useless")(TestStruct));
testing.expect(!hasFn("append")(TestStruct));
testing.expect(!hasFn("useless")(u8));
}
///
pub fn hasField(comptime name: []const u8) TraitFn {
const Closure = struct {
pub fn trait(comptime T: type) bool {
const info = @typeInfo(T);
const fields = switch (info) {
builtin.TypeId.Struct => |s| s.fields,
builtin.TypeId.Union => |u| u.fields,
builtin.TypeId.Enum => |e| e.fields,
else => return false,
};
inline for (fields) |field| {
if (mem.eql(u8, field.name, name)) return true;
}
return false;
}
};
return Closure.trait;
}
test "std.meta.trait.hasField" {
const TestStruct = struct {
value: u32,
};
testing.expect(hasField("value")(TestStruct));
testing.expect(!hasField("value")(*TestStruct));
testing.expect(!hasField("x")(TestStruct));
testing.expect(!hasField("x")(**TestStruct));
testing.expect(!hasField("value")(u8));
}
///
pub fn is(comptime id: builtin.TypeId) TraitFn {
const Closure = struct {
pub fn trait(comptime T: type) bool {
return id == @typeId(T);
}
};
return Closure.trait;
}
test "std.meta.trait.is" {
testing.expect(is(builtin.TypeId.Int)(u8));
testing.expect(!is(builtin.TypeId.Int)(f32));
testing.expect(is(builtin.TypeId.Pointer)(*u8));
testing.expect(is(builtin.TypeId.Void)(void));
testing.expect(!is(builtin.TypeId.Optional)(anyerror));
}
///
pub fn isPtrTo(comptime id: builtin.TypeId) TraitFn {
const Closure = struct {
pub fn trait(comptime T: type) bool {
if (!comptime isSingleItemPtr(T)) return false;
return id == @typeId(meta.Child(T));
}
};
return Closure.trait;
}
test "std.meta.trait.isPtrTo" {
testing.expect(!isPtrTo(builtin.TypeId.Struct)(struct {}));
testing.expect(isPtrTo(builtin.TypeId.Struct)(*struct {}));
testing.expect(!isPtrTo(builtin.TypeId.Struct)(**struct {}));
}
///////////Strait trait Fns
//@TODO:
// Somewhat limited since we can't apply this logic to normal variables, fields, or
// Fns yet. Should be isExternType?
pub fn isExtern(comptime T: type) bool {
const Extern = builtin.TypeInfo.ContainerLayout.Extern;
const info = @typeInfo(T);
return switch (info) {
builtin.TypeId.Struct => |s| s.layout == Extern,
builtin.TypeId.Union => |u| u.layout == Extern,
builtin.TypeId.Enum => |e| e.layout == Extern,
else => false,
};
}
test "std.meta.trait.isExtern" {
const TestExStruct = extern struct {};
const TestStruct = struct {};
testing.expect(isExtern(TestExStruct));
testing.expect(!isExtern(TestStruct));
testing.expect(!isExtern(u8));
}
///
pub fn isPacked(comptime T: type) bool {
const Packed = builtin.TypeInfo.ContainerLayout.Packed;
const info = @typeInfo(T);
return switch (info) {
builtin.TypeId.Struct => |s| s.layout == Packed,
builtin.TypeId.Union => |u| u.layout == Packed,
builtin.TypeId.Enum => |e| e.layout == Packed,
else => false,
};
}
test "std.meta.trait.isPacked" {
const TestPStruct = packed struct {};
const TestStruct = struct {};
testing.expect(isPacked(TestPStruct));
testing.expect(!isPacked(TestStruct));
testing.expect(!isPacked(u8));
}
///
pub fn isUnsignedInt(comptime T: type) bool {
return switch (@typeId(T)) {
builtin.TypeId.Int => !@typeInfo(T).Int.is_signed,
else => false,
};
}
test "isUnsignedInt" {
testing.expect(isUnsignedInt(u32) == true);
testing.expect(isUnsignedInt(comptime_int) == false);
testing.expect(isUnsignedInt(i64) == false);
testing.expect(isUnsignedInt(f64) == false);
}
///
pub fn isSignedInt(comptime T: type) bool {
return switch (@typeId(T)) {
builtin.TypeId.ComptimeInt => true,
builtin.TypeId.Int => @typeInfo(T).Int.is_signed,
else => false,
};
}
test "isSignedInt" {
testing.expect(isSignedInt(u32) == false);
testing.expect(isSignedInt(comptime_int) == true);
testing.expect(isSignedInt(i64) == true);
testing.expect(isSignedInt(f64) == false);
}
///
pub fn isSingleItemPtr(comptime T: type) bool {
if (comptime is(builtin.TypeId.Pointer)(T)) {
const info = @typeInfo(T);
return info.Pointer.size == builtin.TypeInfo.Pointer.Size.One;
}
return false;
}
test "std.meta.trait.isSingleItemPtr" {
const array = [_]u8{0} ** 10;
testing.expect(isSingleItemPtr(@TypeOf(&array[0])));
testing.expect(!isSingleItemPtr(@TypeOf(array)));
testing.expect(!isSingleItemPtr(@TypeOf(array[0..1])));
}
///
pub fn isManyItemPtr(comptime T: type) bool {
if (comptime is(builtin.TypeId.Pointer)(T)) {
const info = @typeInfo(T);
return info.Pointer.size == builtin.TypeInfo.Pointer.Size.Many;
}
return false;
}
test "std.meta.trait.isManyItemPtr" {
const array = [_]u8{0} ** 10;
const mip = @ptrCast([*]const u8, &array[0]);
testing.expect(isManyItemPtr(@TypeOf(mip)));
testing.expect(!isManyItemPtr(@TypeOf(array)));
testing.expect(!isManyItemPtr(@TypeOf(array[0..1])));
}
///
pub fn isSlice(comptime T: type) bool {
if (comptime is(builtin.TypeId.Pointer)(T)) {
const info = @typeInfo(T);
return info.Pointer.size == builtin.TypeInfo.Pointer.Size.Slice;
}
return false;
}
test "std.meta.trait.isSlice" {
const array = [_]u8{0} ** 10;
testing.expect(isSlice(@TypeOf(array[0..])));
testing.expect(!isSlice(@TypeOf(array)));
testing.expect(!isSlice(@TypeOf(&array[0])));
}
///
pub fn isIndexable(comptime T: type) bool {
if (comptime is(builtin.TypeId.Pointer)(T)) {
const info = @typeInfo(T);
if (info.Pointer.size == builtin.TypeInfo.Pointer.Size.One) {
if (comptime is(builtin.TypeId.Array)(meta.Child(T))) return true;
return false;
}
return true;
}
return comptime is(builtin.TypeId.Array)(T);
}
test "std.meta.trait.isIndexable" {
const array = [_]u8{0} ** 10;
const slice = array[0..];
testing.expect(isIndexable(@TypeOf(array)));
testing.expect(isIndexable(@TypeOf(&array)));
testing.expect(isIndexable(@TypeOf(slice)));
testing.expect(!isIndexable(meta.Child(@TypeOf(slice))));
}
///
pub fn isNumber(comptime T: type) bool {
return switch (@typeId(T)) {
builtin.TypeId.Int, builtin.TypeId.Float, builtin.TypeId.ComptimeInt, builtin.TypeId.ComptimeFloat => true,
else => false,
};
}
test "std.meta.trait.isNumber" {
const NotANumber = struct {
number: u8,
};
testing.expect(isNumber(u32));
testing.expect(isNumber(f32));
testing.expect(isNumber(u64));
testing.expect(isNumber(@TypeOf(102)));
testing.expect(isNumber(@TypeOf(102.123)));
testing.expect(!isNumber([]u8));
testing.expect(!isNumber(NotANumber));
}
pub fn isConstPtr(comptime T: type) bool {
if (!comptime is(builtin.TypeId.Pointer)(T)) return false;
const info = @typeInfo(T);
return info.Pointer.is_const;
}
test "std.meta.trait.isConstPtr" {
var t = @as(u8, 0);
const c = @as(u8, 0);
testing.expect(isConstPtr(*const @TypeOf(t)));
testing.expect(isConstPtr(@TypeOf(&c)));
testing.expect(!isConstPtr(*@TypeOf(t)));
testing.expect(!isConstPtr(@TypeOf(6)));
}
pub fn isContainer(comptime T: type) bool {
const info = @typeInfo(T);
return switch (info) {
builtin.TypeId.Struct => true,
builtin.TypeId.Union => true,
builtin.TypeId.Enum => true,
else => false,
};
}
test "std.meta.trait.isContainer" {
const TestStruct = struct {};
const TestUnion = union {
a: void,
};
const TestEnum = enum {
A,
B,
};
testing.expect(isContainer(TestStruct));
testing.expect(isContainer(TestUnion));
testing.expect(isContainer(TestEnum));
testing.expect(!isContainer(u8));
} | lib/std/meta/trait.zig |
const std = @import("std.zig");
const builtin = @import("builtin");
const os = std.os;
const assert = std.debug.assert;
const windows = os.windows;
const testing = std.testing;
const SpinLock = std.SpinLock;
const ResetEvent = std.ResetEvent;
/// Lock may be held only once. If the same thread tries to acquire
/// the same mutex twice, it deadlocks. This type supports static
/// initialization and is at most `@sizeOf(usize)` in size. When an
/// application is built in single threaded release mode, all the
/// functions are no-ops. In single threaded debug mode, there is
/// deadlock detection.
///
/// Example usage:
/// var m = Mutex.init();
/// defer m.deinit();
///
/// const lock = m.acquire();
/// defer lock.release();
/// ... critical code
///
/// Non-blocking:
/// if (m.tryAcquire) |lock| {
/// defer lock.release();
/// // ... critical section
/// } else {
/// // ... lock not acquired
/// }
pub const Mutex = if (builtin.single_threaded)
struct {
lock: @TypeOf(lock_init),
const lock_init = if (std.debug.runtime_safety) false else {};
pub const Held = struct {
mutex: *Mutex,
pub fn release(self: Held) void {
if (std.debug.runtime_safety) {
self.mutex.lock = false;
}
}
};
/// Create a new mutex in unlocked state.
pub fn init() Mutex {
return Mutex{ .lock = lock_init };
}
/// Free a mutex created with init. Calling this while the
/// mutex is held is illegal behavior.
pub fn deinit(self: *Mutex) void {
self.* = undefined;
}
/// Try to acquire the mutex without blocking. Returns null if
/// the mutex is unavailable. Otherwise returns Held. Call
/// release on Held.
pub fn tryAcquire(self: *Mutex) ?Held {
if (std.debug.runtime_safety) {
if (self.lock) return null;
self.lock = true;
}
return Held{ .mutex = self };
}
/// Acquire the mutex. Will deadlock if the mutex is already
/// held by the calling thread.
pub fn acquire(self: *Mutex) Held {
return self.tryAcquire() orelse @panic("deadlock detected");
}
}
else if (builtin.os == .windows)
// https://locklessinc.com/articles/keyed_events/
extern union {
locked: u8,
waiters: u32,
const WAKE = 1 << 8;
const WAIT = 1 << 9;
pub fn init() Mutex {
return Mutex{ .waiters = 0 };
}
pub fn deinit(self: *Mutex) void {
self.* = undefined;
}
pub fn tryAcquire(self: *Mutex) ?Held {
if (@atomicRmw(u8, &self.locked, .Xchg, 1, .Acquire) != 0)
return null;
return Held{ .mutex = self };
}
pub fn acquire(self: *Mutex) Held {
return self.tryAcquire() orelse self.acquireSlow();
}
fn acquireSpinning(self: *Mutex) Held {
@setCold(true);
while (true) : (SpinLock.yield()) {
return self.tryAcquire() orelse continue;
}
}
fn acquireSlow(self: *Mutex) Held {
// try to use NT keyed events for blocking, falling back to spinlock if unavailable
@setCold(true);
const handle = ResetEvent.OsEvent.Futex.getEventHandle() orelse return self.acquireSpinning();
const key = @ptrCast(*const c_void, &self.waiters);
while (true) : (SpinLock.loopHint(1)) {
const waiters = @atomicLoad(u32, &self.waiters, .Monotonic);
// try and take lock if unlocked
if ((waiters & 1) == 0) {
if (@atomicRmw(u8, &self.locked, .Xchg, 1, .Acquire) == 0) {
return Held{ .mutex = self };
}
// otherwise, try and update the waiting count.
// then unset the WAKE bit so that another unlocker can wake up a thread.
} else if (@cmpxchgWeak(u32, &self.waiters, waiters, (waiters + WAIT) | 1, .Monotonic, .Monotonic) == null) {
const rc = windows.ntdll.NtWaitForKeyedEvent(handle, key, windows.FALSE, null);
assert(rc == 0);
_ = @atomicRmw(u32, &self.waiters, .Sub, WAKE, .Monotonic);
}
}
}
pub const Held = struct {
mutex: *Mutex,
pub fn release(self: Held) void {
// unlock without a rmw/cmpxchg instruction
@atomicStore(u8, @ptrCast(*u8, &self.mutex.locked), 0, .Release);
const handle = ResetEvent.OsEvent.Futex.getEventHandle() orelse return;
const key = @ptrCast(*const c_void, &self.mutex.waiters);
while (true) : (SpinLock.loopHint(1)) {
const waiters = @atomicLoad(u32, &self.mutex.waiters, .Monotonic);
// no one is waiting
if (waiters < WAIT) return;
// someone grabbed the lock and will do the wake instead
if (waiters & 1 != 0) return;
// someone else is currently waking up
if (waiters & WAKE != 0) return;
// try to decrease the waiter count & set the WAKE bit meaning a thread is waking up
if (@cmpxchgWeak(u32, &self.mutex.waiters, waiters, waiters - WAIT + WAKE, .Release, .Monotonic) == null) {
const rc = windows.ntdll.NtReleaseKeyedEvent(handle, key, windows.FALSE, null);
assert(rc == 0);
return;
}
}
}
};
}
else if (builtin.link_libc or builtin.os == .linux)
// stack-based version of https://github.com/Amanieu/parking_lot/blob/master/core/src/word_lock.rs
struct {
state: usize,
/// number of times to spin trying to acquire the lock.
/// https://webkit.org/blog/6161/locking-in-webkit/
const SPIN_COUNT = 40;
const MUTEX_LOCK: usize = 1 << 0;
const QUEUE_LOCK: usize = 1 << 1;
const QUEUE_MASK: usize = ~(MUTEX_LOCK | QUEUE_LOCK);
const Node = struct {
next: ?*Node,
event: ResetEvent,
};
pub fn init() Mutex {
return Mutex{ .state = 0 };
}
pub fn deinit(self: *Mutex) void {
self.* = undefined;
}
pub fn tryAcquire(self: *Mutex) ?Held {
if (@cmpxchgWeak(usize, &self.state, 0, MUTEX_LOCK, .Acquire, .Monotonic) != null)
return null;
return Held{ .mutex = self };
}
pub fn acquire(self: *Mutex) Held {
return self.tryAcquire() orelse {
self.acquireSlow();
return Held{ .mutex = self };
};
}
fn acquireSlow(self: *Mutex) void {
// inlining the fast path and hiding *Slow()
// calls behind a @setCold(true) appears to
// improve performance in release builds.
@setCold(true);
while (true) {
// try and spin for a bit to acquire the mutex if theres currently no queue
var spin_count: u32 = SPIN_COUNT;
var state = @atomicLoad(usize, &self.state, .Monotonic);
while (spin_count != 0) : (spin_count -= 1) {
if (state & MUTEX_LOCK == 0) {
_ = @cmpxchgWeak(usize, &self.state, state, state | MUTEX_LOCK, .Acquire, .Monotonic) orelse return;
} else if (state & QUEUE_MASK == 0) {
break;
}
SpinLock.yield();
state = @atomicLoad(usize, &self.state, .Monotonic);
}
// create the ResetEvent node on the stack
// (faster than threadlocal on platforms like OSX)
var node: Node = undefined;
node.event = ResetEvent.init();
defer node.event.deinit();
// we've spun too long, try and add our node to the LIFO queue.
// if the mutex becomes available in the process, try and grab it instead.
while (true) {
if (state & MUTEX_LOCK == 0) {
_ = @cmpxchgWeak(usize, &self.state, state, state | MUTEX_LOCK, .Acquire, .Monotonic) orelse return;
} else {
node.next = @intToPtr(?*Node, state & QUEUE_MASK);
const new_state = @ptrToInt(&node) | (state & ~QUEUE_MASK);
_ = @cmpxchgWeak(usize, &self.state, state, new_state, .Release, .Monotonic) orelse {
node.event.wait();
break;
};
}
SpinLock.yield();
state = @atomicLoad(usize, &self.state, .Monotonic);
}
}
}
/// Returned when the lock is acquired. Call release to
/// release.
pub const Held = struct {
mutex: *Mutex,
/// Release the held lock.
pub fn release(self: Held) void {
// first, remove the lock bit so another possibly parallel acquire() can succeed.
// use .Sub since it can be usually compiled down more efficiency
// (`lock sub` on x86) vs .And ~MUTEX_LOCK (`lock cmpxchg` loop on x86)
const state = @atomicRmw(usize, &self.mutex.state, .Sub, MUTEX_LOCK, .Release);
// if the LIFO queue isnt locked and it has a node, try and wake up the node.
if ((state & QUEUE_LOCK) == 0 and (state & QUEUE_MASK) != 0)
self.mutex.releaseSlow();
}
};
fn releaseSlow(self: *Mutex) void {
@setCold(true);
// try and lock the LFIO queue to pop a node off,
// stopping altogether if its already locked or the queue is empty
var state = @atomicLoad(usize, &self.state, .Monotonic);
while (true) : (SpinLock.loopHint(1)) {
if (state & QUEUE_LOCK != 0 or state & QUEUE_MASK == 0)
return;
state = @cmpxchgWeak(usize, &self.state, state, state | QUEUE_LOCK, .Acquire, .Monotonic) orelse break;
}
// acquired the QUEUE_LOCK, try and pop a node to wake it.
// if the mutex is locked, then unset QUEUE_LOCK and let
// the thread who holds the mutex do the wake-up on unlock()
while (true) : (SpinLock.loopHint(1)) {
if ((state & MUTEX_LOCK) != 0) {
state = @cmpxchgWeak(usize, &self.state, state, state & ~QUEUE_LOCK, .Release, .Acquire) orelse return;
} else {
const node = @intToPtr(*Node, state & QUEUE_MASK);
const new_state = @ptrToInt(node.next);
state = @cmpxchgWeak(usize, &self.state, state, new_state, .Release, .Acquire) orelse {
node.event.set();
return;
};
}
}
}
}
// for platforms without a known OS blocking
// primitive, default to SpinLock for correctness
else SpinLock;
const TestContext = struct {
mutex: *Mutex,
data: i128,
const incr_count = 10000;
};
test "std.Mutex" {
var plenty_of_memory = try std.heap.page_allocator.alloc(u8, 300 * 1024);
defer std.heap.page_allocator.free(plenty_of_memory);
var fixed_buffer_allocator = std.heap.ThreadSafeFixedBufferAllocator.init(plenty_of_memory);
var a = &fixed_buffer_allocator.allocator;
var mutex = Mutex.init();
defer mutex.deinit();
var context = TestContext{
.mutex = &mutex,
.data = 0,
};
if (builtin.single_threaded) {
worker(&context);
testing.expect(context.data == TestContext.incr_count);
} else {
const thread_count = 10;
var threads: [thread_count]*std.Thread = undefined;
for (threads) |*t| {
t.* = try std.Thread.spawn(&context, worker);
}
for (threads) |t|
t.wait();
testing.expect(context.data == thread_count * TestContext.incr_count);
}
}
fn worker(ctx: *TestContext) void {
var i: usize = 0;
while (i != TestContext.incr_count) : (i += 1) {
const held = ctx.mutex.acquire();
defer held.release();
ctx.data += 1;
}
} | lib/std/mutex.zig |
const std = @import("std");
const fs = std.fs;
const io = std.io;
const mem = std.mem;
const Allocator = mem.Allocator;
const Target = std.Target;
const assert = std.debug.assert;
const introspect = @import("introspect.zig");
// TODO this is hard-coded until self-hosted gains this information canonically
const available_libcs = [_][]const u8{
"aarch64_be-linux-gnu",
"aarch64_be-linux-musl",
"aarch64_be-windows-gnu",
"aarch64-linux-gnu",
"aarch64-linux-musl",
"aarch64-windows-gnu",
"armeb-linux-gnueabi",
"armeb-linux-gnueabihf",
"armeb-linux-musleabi",
"armeb-linux-musleabihf",
"armeb-windows-gnu",
"arm-linux-gnueabi",
"arm-linux-gnueabihf",
"arm-linux-musleabi",
"arm-linux-musleabihf",
"arm-windows-gnu",
"i386-linux-gnu",
"i386-linux-musl",
"i386-windows-gnu",
"mips64el-linux-gnuabi64",
"mips64el-linux-gnuabin32",
"mips64el-linux-musl",
"mips64-linux-gnuabi64",
"mips64-linux-gnuabin32",
"mips64-linux-musl",
"mipsel-linux-gnu",
"mipsel-linux-musl",
"mips-linux-gnu",
"mips-linux-musl",
"powerpc64le-linux-gnu",
"powerpc64le-linux-musl",
"powerpc64-linux-gnu",
"powerpc64-linux-musl",
"powerpc-linux-gnu",
"powerpc-linux-musl",
"riscv64-linux-gnu",
"riscv64-linux-musl",
"s390x-linux-gnu",
"s390x-linux-musl",
"sparc-linux-gnu",
"sparcv9-linux-gnu",
"wasm32-freestanding-musl",
"x86_64-linux-gnu",
"x86_64-linux-gnux32",
"x86_64-linux-musl",
"x86_64-windows-gnu",
};
pub fn cmdTargets(
allocator: *Allocator,
args: []const []const u8,
/// Output stream
stdout: anytype,
native_target: Target,
) !void {
const available_glibcs = blk: {
const zig_lib_dir = introspect.resolveZigLibDir(allocator) catch |err| {
std.debug.print("unable to find zig installation directory: {}\n", .{@errorName(err)});
std.process.exit(1);
};
defer allocator.free(zig_lib_dir);
var dir = try std.fs.cwd().openDir(zig_lib_dir, .{});
defer dir.close();
const vers_txt = try dir.readFileAlloc(allocator, "libc" ++ std.fs.path.sep_str ++ "glibc" ++ std.fs.path.sep_str ++ "vers.txt", 10 * 1024);
defer allocator.free(vers_txt);
var list = std.ArrayList(std.builtin.Version).init(allocator);
defer list.deinit();
var it = mem.tokenize(vers_txt, "\r\n");
while (it.next()) |line| {
const prefix = "GLIBC_";
assert(mem.startsWith(u8, line, prefix));
const adjusted_line = line[prefix.len..];
const ver = try std.builtin.Version.parse(adjusted_line);
try list.append(ver);
}
break :blk list.toOwnedSlice();
};
defer allocator.free(available_glibcs);
var bos = io.bufferedOutStream(stdout);
const bos_stream = bos.outStream();
var jws = std.json.WriteStream(@TypeOf(bos_stream), 6).init(bos_stream);
try jws.beginObject();
try jws.objectField("arch");
try jws.beginArray();
{
inline for (@typeInfo(Target.Cpu.Arch).Enum.fields) |field| {
try jws.arrayElem();
try jws.emitString(field.name);
}
}
try jws.endArray();
try jws.objectField("os");
try jws.beginArray();
inline for (@typeInfo(Target.Os.Tag).Enum.fields) |field| {
try jws.arrayElem();
try jws.emitString(field.name);
}
try jws.endArray();
try jws.objectField("abi");
try jws.beginArray();
inline for (@typeInfo(Target.Abi).Enum.fields) |field| {
try jws.arrayElem();
try jws.emitString(field.name);
}
try jws.endArray();
try jws.objectField("libc");
try jws.beginArray();
for (available_libcs) |libc| {
try jws.arrayElem();
try jws.emitString(libc);
}
try jws.endArray();
try jws.objectField("glibc");
try jws.beginArray();
for (available_glibcs) |glibc| {
try jws.arrayElem();
const tmp = try std.fmt.allocPrint(allocator, "{}", .{glibc});
defer allocator.free(tmp);
try jws.emitString(tmp);
}
try jws.endArray();
try jws.objectField("cpus");
try jws.beginObject();
inline for (@typeInfo(Target.Cpu.Arch).Enum.fields) |field| {
try jws.objectField(field.name);
try jws.beginObject();
const arch = @field(Target.Cpu.Arch, field.name);
for (arch.allCpuModels()) |model| {
try jws.objectField(model.name);
try jws.beginArray();
for (arch.allFeaturesList()) |feature, i| {
if (model.features.isEnabled(@intCast(u8, i))) {
try jws.arrayElem();
try jws.emitString(feature.name);
}
}
try jws.endArray();
}
try jws.endObject();
}
try jws.endObject();
try jws.objectField("cpuFeatures");
try jws.beginObject();
inline for (@typeInfo(Target.Cpu.Arch).Enum.fields) |field| {
try jws.objectField(field.name);
try jws.beginArray();
const arch = @field(Target.Cpu.Arch, field.name);
for (arch.allFeaturesList()) |feature| {
try jws.arrayElem();
try jws.emitString(feature.name);
}
try jws.endArray();
}
try jws.endObject();
try jws.objectField("native");
try jws.beginObject();
{
const triple = try native_target.zigTriple(allocator);
defer allocator.free(triple);
try jws.objectField("triple");
try jws.emitString(triple);
}
{
try jws.objectField("cpu");
try jws.beginObject();
try jws.objectField("arch");
try jws.emitString(@tagName(native_target.cpu.arch));
try jws.objectField("name");
const cpu = native_target.cpu;
try jws.emitString(cpu.model.name);
{
try jws.objectField("features");
try jws.beginArray();
for (native_target.cpu.arch.allFeaturesList()) |feature, i_usize| {
const index = @intCast(Target.Cpu.Feature.Set.Index, i_usize);
if (cpu.features.isEnabled(index)) {
try jws.arrayElem();
try jws.emitString(feature.name);
}
}
try jws.endArray();
}
try jws.endObject();
}
try jws.objectField("os");
try jws.emitString(@tagName(native_target.os.tag));
try jws.objectField("abi");
try jws.emitString(@tagName(native_target.abi));
// TODO implement native glibc version detection in self-hosted
try jws.endObject();
try jws.endObject();
try bos_stream.writeByte('\n');
return bos.flush();
} | src-self-hosted/print_targets.zig |
const Dwarf = @This();
const std = @import("std");
const builtin = @import("builtin");
const assert = std.debug.assert;
const fs = std.fs;
const leb128 = std.leb;
const log = std.log.scoped(.dwarf);
const mem = std.mem;
const link = @import("../link.zig");
const trace = @import("../tracy.zig").trace;
const Allocator = mem.Allocator;
const DW = std.dwarf;
const File = link.File;
const LinkBlock = File.LinkBlock;
const LinkFn = File.LinkFn;
const Module = @import("../Module.zig");
const Value = @import("../value.zig").Value;
const Type = @import("../type.zig").Type;
allocator: Allocator,
tag: File.Tag,
ptr_width: PtrWidth,
target: std.Target,
/// A list of `File.LinkFn` whose Line Number Programs have surplus capacity.
/// This is the same concept as `text_block_free_list`; see those doc comments.
dbg_line_fn_free_list: std.AutoHashMapUnmanaged(*SrcFn, void) = .{},
dbg_line_fn_first: ?*SrcFn = null,
dbg_line_fn_last: ?*SrcFn = null,
/// A list of `TextBlock` whose corresponding .debug_info tags have surplus capacity. /// This is the same concept as `text_block_free_list`; see those doc comments.
dbg_info_decl_free_list: std.AutoHashMapUnmanaged(*DebugInfoAtom, void) = .{},
dbg_info_decl_first: ?*DebugInfoAtom = null,
dbg_info_decl_last: ?*DebugInfoAtom = null,
abbrev_table_offset: ?u64 = null,
/// Table of debug symbol names.
strtab: std.ArrayListUnmanaged(u8) = .{},
pub const DebugInfoAtom = struct {
/// Previous/next linked list pointers.
/// This is the linked list node for this Decl's corresponding .debug_info tag.
prev: ?*DebugInfoAtom,
next: ?*DebugInfoAtom,
/// Offset into .debug_info pointing to the tag for this Decl.
off: u32,
/// Size of the .debug_info tag for this Decl, not including padding.
len: u32,
};
pub const SrcFn = struct {
/// Offset from the beginning of the Debug Line Program header that contains this function.
off: u32,
/// Size of the line number program component belonging to this function, not
/// including padding.
len: u32,
/// Points to the previous and next neighbors, based on the offset from .debug_line.
/// This can be used to find, for example, the capacity of this `SrcFn`.
prev: ?*SrcFn,
next: ?*SrcFn,
pub const empty: SrcFn = .{
.off = 0,
.len = 0,
.prev = null,
.next = null,
};
};
pub const PtrWidth = enum { p32, p64 };
pub const abbrev_compile_unit = 1;
pub const abbrev_subprogram = 2;
pub const abbrev_subprogram_retvoid = 3;
pub const abbrev_base_type = 4;
pub const abbrev_ptr_type = 5;
pub const abbrev_struct_type = 6;
pub const abbrev_struct_member = 7;
pub const abbrev_pad1 = 8;
pub const abbrev_parameter = 9;
/// The reloc offset for the virtual address of a function in its Line Number Program.
/// Size is a virtual address integer.
const dbg_line_vaddr_reloc_index = 3;
/// The reloc offset for the virtual address of a function in its .debug_info TAG.subprogram.
/// Size is a virtual address integer.
const dbg_info_low_pc_reloc_index = 1;
const min_nop_size = 2;
/// When allocating, the ideal_capacity is calculated by
/// actual_capacity + (actual_capacity / ideal_factor)
const ideal_factor = 3;
pub fn init(allocator: Allocator, tag: File.Tag, target: std.Target) Dwarf {
const ptr_width: PtrWidth = switch (target.cpu.arch.ptrBitWidth()) {
0...32 => .p32,
33...64 => .p64,
else => unreachable,
};
return Dwarf{
.allocator = allocator,
.tag = tag,
.ptr_width = ptr_width,
.target = target,
};
}
pub fn deinit(self: *Dwarf) void {
const gpa = self.allocator;
self.dbg_line_fn_free_list.deinit(gpa);
self.dbg_info_decl_free_list.deinit(gpa);
self.strtab.deinit(gpa);
}
pub const DeclDebugBuffers = struct {
dbg_line_buffer: std.ArrayList(u8),
dbg_info_buffer: std.ArrayList(u8),
dbg_info_type_relocs: File.DbgInfoTypeRelocsTable,
};
pub fn initDeclDebugInfo(self: *Dwarf, decl: *Module.Decl) !DeclDebugBuffers {
const tracy = trace(@src());
defer tracy.end();
const decl_name = try decl.getFullyQualifiedName(self.allocator);
defer self.allocator.free(decl_name);
log.debug("initDeclDebugInfo {s}{*}", .{ decl_name, decl });
const gpa = self.allocator;
var dbg_line_buffer = std.ArrayList(u8).init(gpa);
var dbg_info_buffer = std.ArrayList(u8).init(gpa);
var dbg_info_type_relocs: File.DbgInfoTypeRelocsTable = .{};
assert(decl.has_tv);
switch (decl.ty.zigTypeTag()) {
.Fn => {
// For functions we need to add a prologue to the debug line program.
try dbg_line_buffer.ensureTotalCapacity(26);
const func = decl.val.castTag(.function).?.data;
log.debug("decl.src_line={d}, func.lbrace_line={d}, func.rbrace_line={d}", .{
decl.src_line,
func.lbrace_line,
func.rbrace_line,
});
const line = @intCast(u28, decl.src_line + func.lbrace_line);
const ptr_width_bytes = self.ptrWidthBytes();
dbg_line_buffer.appendSliceAssumeCapacity(&[_]u8{
DW.LNS.extended_op,
ptr_width_bytes + 1,
DW.LNE.set_address,
});
// This is the "relocatable" vaddr, corresponding to `code_buffer` index `0`.
assert(dbg_line_vaddr_reloc_index == dbg_line_buffer.items.len);
dbg_line_buffer.items.len += ptr_width_bytes;
dbg_line_buffer.appendAssumeCapacity(DW.LNS.advance_line);
// This is the "relocatable" relative line offset from the previous function's end curly
// to this function's begin curly.
assert(self.getRelocDbgLineOff() == dbg_line_buffer.items.len);
// Here we use a ULEB128-fixed-4 to make sure this field can be overwritten later.
leb128.writeUnsignedFixed(4, dbg_line_buffer.addManyAsArrayAssumeCapacity(4), line);
dbg_line_buffer.appendAssumeCapacity(DW.LNS.set_file);
assert(self.getRelocDbgFileIndex() == dbg_line_buffer.items.len);
// Once we support more than one source file, this will have the ability to be more
// than one possible value.
const file_index = 1;
leb128.writeUnsignedFixed(4, dbg_line_buffer.addManyAsArrayAssumeCapacity(4), file_index);
// Emit a line for the begin curly with prologue_end=false. The codegen will
// do the work of setting prologue_end=true and epilogue_begin=true.
dbg_line_buffer.appendAssumeCapacity(DW.LNS.copy);
// .debug_info subprogram
const decl_name_with_null = decl_name[0 .. decl_name.len + 1];
try dbg_info_buffer.ensureUnusedCapacity(25 + decl_name_with_null.len);
const fn_ret_type = decl.ty.fnReturnType();
const fn_ret_has_bits = fn_ret_type.hasRuntimeBits();
if (fn_ret_has_bits) {
dbg_info_buffer.appendAssumeCapacity(abbrev_subprogram);
} else {
dbg_info_buffer.appendAssumeCapacity(abbrev_subprogram_retvoid);
}
// These get overwritten after generating the machine code. These values are
// "relocations" and have to be in this fixed place so that functions can be
// moved in virtual address space.
assert(dbg_info_low_pc_reloc_index == dbg_info_buffer.items.len);
dbg_info_buffer.items.len += ptr_width_bytes; // DW.AT.low_pc, DW.FORM.addr
assert(self.getRelocDbgInfoSubprogramHighPC() == dbg_info_buffer.items.len);
dbg_info_buffer.items.len += 4; // DW.AT.high_pc, DW.FORM.data4
if (fn_ret_has_bits) {
const gop = try dbg_info_type_relocs.getOrPut(gpa, fn_ret_type);
if (!gop.found_existing) {
gop.value_ptr.* = .{
.off = undefined,
.relocs = .{},
};
}
try gop.value_ptr.relocs.append(gpa, @intCast(u32, dbg_info_buffer.items.len));
dbg_info_buffer.items.len += 4; // DW.AT.type, DW.FORM.ref4
}
dbg_info_buffer.appendSliceAssumeCapacity(decl_name_with_null); // DW.AT.name, DW.FORM.string
},
else => {
// TODO implement .debug_info for global variables
},
}
return DeclDebugBuffers{
.dbg_info_buffer = dbg_info_buffer,
.dbg_line_buffer = dbg_line_buffer,
.dbg_info_type_relocs = dbg_info_type_relocs,
};
}
pub fn commitDeclDebugInfo(
self: *Dwarf,
file: *File,
module: *Module,
decl: *Module.Decl,
sym_addr: u64,
sym_size: u64,
debug_buffers: *DeclDebugBuffers,
) !void {
const tracy = trace(@src());
defer tracy.end();
const gpa = self.allocator;
var dbg_line_buffer = &debug_buffers.dbg_line_buffer;
var dbg_info_buffer = &debug_buffers.dbg_info_buffer;
var dbg_info_type_relocs = &debug_buffers.dbg_info_type_relocs;
const target_endian = self.target.cpu.arch.endian();
assert(decl.has_tv);
switch (decl.ty.zigTypeTag()) {
.Fn => {
// Since the Decl is a function, we need to update the .debug_line program.
// Perform the relocations based on vaddr.
switch (self.ptr_width) {
.p32 => {
{
const ptr = dbg_line_buffer.items[dbg_line_vaddr_reloc_index..][0..4];
mem.writeInt(u32, ptr, @intCast(u32, sym_addr), target_endian);
}
{
const ptr = dbg_info_buffer.items[dbg_info_low_pc_reloc_index..][0..4];
mem.writeInt(u32, ptr, @intCast(u32, sym_addr), target_endian);
}
},
.p64 => {
{
const ptr = dbg_line_buffer.items[dbg_line_vaddr_reloc_index..][0..8];
mem.writeInt(u64, ptr, sym_addr, target_endian);
}
{
const ptr = dbg_info_buffer.items[dbg_info_low_pc_reloc_index..][0..8];
mem.writeInt(u64, ptr, sym_addr, target_endian);
}
},
}
{
const ptr = dbg_info_buffer.items[self.getRelocDbgInfoSubprogramHighPC()..][0..4];
mem.writeInt(u32, ptr, @intCast(u32, sym_size), target_endian);
}
try dbg_line_buffer.appendSlice(&[_]u8{ DW.LNS.extended_op, 1, DW.LNE.end_sequence });
// Now we have the full contents and may allocate a region to store it.
// This logic is nearly identical to the logic below in `updateDeclDebugInfo` for
// `TextBlock` and the .debug_info. If you are editing this logic, you
// probably need to edit that logic too.
const src_fn = switch (self.tag) {
.elf => &decl.fn_link.elf,
.macho => &decl.fn_link.macho,
else => unreachable, // TODO
};
src_fn.len = @intCast(u32, dbg_line_buffer.items.len);
if (self.dbg_line_fn_last) |last| blk: {
if (src_fn == last) break :blk;
if (src_fn.next) |next| {
// Update existing function - non-last item.
if (src_fn.off + src_fn.len + min_nop_size > next.off) {
// It grew too big, so we move it to a new location.
if (src_fn.prev) |prev| {
self.dbg_line_fn_free_list.put(gpa, prev, {}) catch {};
prev.next = src_fn.next;
}
next.prev = src_fn.prev;
src_fn.next = null;
// Populate where it used to be with NOPs.
switch (self.tag) {
.elf => {
const elf_file = file.cast(File.Elf).?;
const debug_line_sect = &elf_file.sections.items[elf_file.debug_line_section_index.?];
const file_pos = debug_line_sect.sh_offset + src_fn.off;
try pwriteDbgLineNops(elf_file.base.file.?, file_pos, 0, &[0]u8{}, src_fn.len);
},
.macho => {
const macho_file = file.cast(File.MachO).?;
const d_sym = &macho_file.d_sym.?;
const dwarf_segment = &d_sym.load_commands.items[d_sym.dwarf_segment_cmd_index.?].segment;
const debug_line_sect = &dwarf_segment.sections.items[d_sym.debug_line_section_index.?];
const file_pos = debug_line_sect.offset + src_fn.off;
try pwriteDbgLineNops(d_sym.file, file_pos, 0, &[0]u8{}, src_fn.len);
},
else => unreachable,
}
// TODO Look at the free list before appending at the end.
src_fn.prev = last;
last.next = src_fn;
self.dbg_line_fn_last = src_fn;
src_fn.off = last.off + padToIdeal(last.len);
}
} else if (src_fn.prev == null) {
// Append new function.
// TODO Look at the free list before appending at the end.
src_fn.prev = last;
last.next = src_fn;
self.dbg_line_fn_last = src_fn;
src_fn.off = last.off + padToIdeal(last.len);
}
} else {
// This is the first function of the Line Number Program.
self.dbg_line_fn_first = src_fn;
self.dbg_line_fn_last = src_fn;
src_fn.off = padToIdeal(self.dbgLineNeededHeaderBytes(module));
}
const last_src_fn = self.dbg_line_fn_last.?;
const needed_size = last_src_fn.off + last_src_fn.len;
const prev_padding_size: u32 = if (src_fn.prev) |prev| src_fn.off - (prev.off + prev.len) else 0;
const next_padding_size: u32 = if (src_fn.next) |next| next.off - (src_fn.off + src_fn.len) else 0;
// We only have support for one compilation unit so far, so the offsets are directly
// from the .debug_line section.
switch (self.tag) {
.elf => {
const elf_file = file.cast(File.Elf).?;
const debug_line_sect = &elf_file.sections.items[elf_file.debug_line_section_index.?];
if (needed_size != debug_line_sect.sh_size) {
if (needed_size > elf_file.allocatedSize(debug_line_sect.sh_offset)) {
const new_offset = elf_file.findFreeSpace(needed_size, 1);
const existing_size = last_src_fn.off;
log.debug("moving .debug_line section: {d} bytes from 0x{x} to 0x{x}", .{
existing_size,
debug_line_sect.sh_offset,
new_offset,
});
const amt = try elf_file.base.file.?.copyRangeAll(
debug_line_sect.sh_offset,
elf_file.base.file.?,
new_offset,
existing_size,
);
if (amt != existing_size) return error.InputOutput;
debug_line_sect.sh_offset = new_offset;
}
debug_line_sect.sh_size = needed_size;
elf_file.shdr_table_dirty = true; // TODO look into making only the one section dirty
elf_file.debug_line_header_dirty = true;
}
const file_pos = debug_line_sect.sh_offset + src_fn.off;
try pwriteDbgLineNops(
elf_file.base.file.?,
file_pos,
prev_padding_size,
dbg_line_buffer.items,
next_padding_size,
);
},
.macho => {
const macho_file = file.cast(File.MachO).?;
const d_sym = &macho_file.d_sym.?;
const dwarf_segment = &d_sym.load_commands.items[d_sym.dwarf_segment_cmd_index.?].segment;
const debug_line_sect = &dwarf_segment.sections.items[d_sym.debug_line_section_index.?];
if (needed_size != debug_line_sect.size) {
if (needed_size > d_sym.allocatedSize(debug_line_sect.offset)) {
const new_offset = d_sym.findFreeSpace(needed_size, 1);
const existing_size = last_src_fn.off;
log.debug("moving __debug_line section: {} bytes from 0x{x} to 0x{x}", .{
existing_size,
debug_line_sect.offset,
new_offset,
});
try File.MachO.copyRangeAllOverlappingAlloc(
gpa,
d_sym.file,
debug_line_sect.offset,
new_offset,
existing_size,
);
debug_line_sect.offset = @intCast(u32, new_offset);
debug_line_sect.addr = dwarf_segment.inner.vmaddr + new_offset - dwarf_segment.inner.fileoff;
}
debug_line_sect.size = needed_size;
d_sym.load_commands_dirty = true; // TODO look into making only the one section dirty
d_sym.debug_line_header_dirty = true;
}
const file_pos = debug_line_sect.offset + src_fn.off;
try pwriteDbgLineNops(
d_sym.file,
file_pos,
prev_padding_size,
dbg_line_buffer.items,
next_padding_size,
);
},
else => unreachable,
}
// .debug_info - End the TAG.subprogram children.
try dbg_info_buffer.append(0);
},
else => {},
}
if (dbg_info_buffer.items.len == 0)
return;
// We need this for the duration of this function only so that for composite
// types such as []const u32, if the type *u32 is non-existent, we create
// it synthetically and store the backing bytes in this arena. After we are
// done with the relocations, we can safely deinit the entire memory slab.
// TODO currently, we do not store the relocations for future use, however,
// if that is the case, we should move memory management to a higher scope,
// such as linker scope, or whatnot.
var dbg_type_arena = std.heap.ArenaAllocator.init(gpa);
defer dbg_type_arena.deinit();
{
// Now we emit the .debug_info types of the Decl. These will count towards the size of
// the buffer, so we have to do it before computing the offset, and we can't perform the actual
// relocations yet.
var it: usize = 0;
while (it < dbg_info_type_relocs.count()) : (it += 1) {
const ty = dbg_info_type_relocs.keys()[it];
const value_ptr = dbg_info_type_relocs.getPtr(ty).?;
value_ptr.off = @intCast(u32, dbg_info_buffer.items.len);
try self.addDbgInfoType(dbg_type_arena.allocator(), ty, dbg_info_buffer, dbg_info_type_relocs);
}
}
const atom = switch (self.tag) {
.elf => &decl.link.elf.dbg_info_atom,
.macho => &decl.link.macho.dbg_info_atom,
else => unreachable,
};
try self.updateDeclDebugInfoAllocation(file, atom, @intCast(u32, dbg_info_buffer.items.len));
{
// Now that we have the offset assigned we can finally perform type relocations.
for (dbg_info_type_relocs.values()) |value| {
for (value.relocs.items) |off| {
mem.writeIntLittle(
u32,
dbg_info_buffer.items[off..][0..4],
atom.off + value.off,
);
}
}
}
try self.writeDeclDebugInfo(file, atom, dbg_info_buffer.items);
}
fn updateDeclDebugInfoAllocation(self: *Dwarf, file: *File, atom: *DebugInfoAtom, len: u32) !void {
const tracy = trace(@src());
defer tracy.end();
// This logic is nearly identical to the logic above in `updateDecl` for
// `SrcFn` and the line number programs. If you are editing this logic, you
// probably need to edit that logic too.
const gpa = self.allocator;
atom.len = len;
if (self.dbg_info_decl_last) |last| blk: {
if (atom == last) break :blk;
if (atom.next) |next| {
// Update existing Decl - non-last item.
if (atom.off + atom.len + min_nop_size > next.off) {
// It grew too big, so we move it to a new location.
if (atom.prev) |prev| {
self.dbg_info_decl_free_list.put(gpa, prev, {}) catch {};
prev.next = atom.next;
}
next.prev = atom.prev;
atom.next = null;
// Populate where it used to be with NOPs.
switch (self.tag) {
.elf => {
const elf_file = file.cast(File.Elf).?;
const debug_info_sect = &elf_file.sections.items[elf_file.debug_info_section_index.?];
const file_pos = debug_info_sect.sh_offset + atom.off;
try pwriteDbgInfoNops(elf_file.base.file.?, file_pos, 0, &[0]u8{}, atom.len, false);
},
.macho => {
const macho_file = file.cast(File.MachO).?;
const d_sym = &macho_file.d_sym.?;
const dwarf_segment = &d_sym.load_commands.items[d_sym.dwarf_segment_cmd_index.?].segment;
const debug_info_sect = &dwarf_segment.sections.items[d_sym.debug_info_section_index.?];
const file_pos = debug_info_sect.offset + atom.off;
try pwriteDbgInfoNops(d_sym.file, file_pos, 0, &[0]u8{}, atom.len, false);
},
else => unreachable,
}
// TODO Look at the free list before appending at the end.
atom.prev = last;
last.next = atom;
self.dbg_info_decl_last = atom;
atom.off = last.off + padToIdeal(last.len);
}
} else if (atom.prev == null) {
// Append new Decl.
// TODO Look at the free list before appending at the end.
atom.prev = last;
last.next = atom;
self.dbg_info_decl_last = atom;
atom.off = last.off + padToIdeal(last.len);
}
} else {
// This is the first Decl of the .debug_info
self.dbg_info_decl_first = atom;
self.dbg_info_decl_last = atom;
atom.off = @intCast(u32, padToIdeal(self.dbgInfoHeaderBytes()));
}
}
fn writeDeclDebugInfo(self: *Dwarf, file: *File, atom: *DebugInfoAtom, dbg_info_buf: []const u8) !void {
const tracy = trace(@src());
defer tracy.end();
// This logic is nearly identical to the logic above in `updateDecl` for
// `SrcFn` and the line number programs. If you are editing this logic, you
// probably need to edit that logic too.
const gpa = self.allocator;
const last_decl = self.dbg_info_decl_last.?;
// +1 for a trailing zero to end the children of the decl tag.
const needed_size = last_decl.off + last_decl.len + 1;
const prev_padding_size: u32 = if (atom.prev) |prev| atom.off - (prev.off + prev.len) else 0;
const next_padding_size: u32 = if (atom.next) |next| next.off - (atom.off + atom.len) else 0;
// To end the children of the decl tag.
const trailing_zero = atom.next == null;
// We only have support for one compilation unit so far, so the offsets are directly
// from the .debug_info section.
switch (self.tag) {
.elf => {
const elf_file = file.cast(File.Elf).?;
const debug_info_sect = &elf_file.sections.items[elf_file.debug_info_section_index.?];
if (needed_size != debug_info_sect.sh_size) {
if (needed_size > elf_file.allocatedSize(debug_info_sect.sh_offset)) {
const new_offset = elf_file.findFreeSpace(needed_size, 1);
const existing_size = last_decl.off;
log.debug("moving .debug_info section: {d} bytes from 0x{x} to 0x{x}", .{
existing_size,
debug_info_sect.sh_offset,
new_offset,
});
const amt = try elf_file.base.file.?.copyRangeAll(
debug_info_sect.sh_offset,
elf_file.base.file.?,
new_offset,
existing_size,
);
if (amt != existing_size) return error.InputOutput;
debug_info_sect.sh_offset = new_offset;
}
debug_info_sect.sh_size = needed_size;
elf_file.shdr_table_dirty = true; // TODO look into making only the one section dirty
elf_file.debug_info_header_dirty = true;
}
const file_pos = debug_info_sect.sh_offset + atom.off;
try pwriteDbgInfoNops(
elf_file.base.file.?,
file_pos,
prev_padding_size,
dbg_info_buf,
next_padding_size,
trailing_zero,
);
},
.macho => {
const macho_file = file.cast(File.MachO).?;
const d_sym = &macho_file.d_sym.?;
const dwarf_segment = &d_sym.load_commands.items[d_sym.dwarf_segment_cmd_index.?].segment;
const debug_info_sect = &dwarf_segment.sections.items[d_sym.debug_info_section_index.?];
if (needed_size != debug_info_sect.size) {
if (needed_size > d_sym.allocatedSize(debug_info_sect.offset)) {
const new_offset = d_sym.findFreeSpace(needed_size, 1);
const existing_size = last_decl.off;
log.debug("moving __debug_info section: {} bytes from 0x{x} to 0x{x}", .{
existing_size,
debug_info_sect.offset,
new_offset,
});
try File.MachO.copyRangeAllOverlappingAlloc(
gpa,
d_sym.file,
debug_info_sect.offset,
new_offset,
existing_size,
);
debug_info_sect.offset = @intCast(u32, new_offset);
debug_info_sect.addr = dwarf_segment.inner.vmaddr + new_offset - dwarf_segment.inner.fileoff;
}
debug_info_sect.size = needed_size;
d_sym.load_commands_dirty = true; // TODO look into making only the one section dirty
d_sym.debug_line_header_dirty = true;
}
const file_pos = debug_info_sect.offset + atom.off;
try pwriteDbgInfoNops(
d_sym.file,
file_pos,
prev_padding_size,
dbg_info_buf,
next_padding_size,
trailing_zero,
);
},
else => unreachable,
}
}
pub fn updateDeclLineNumber(self: *Dwarf, file: *File, decl: *const Module.Decl) !void {
const tracy = trace(@src());
defer tracy.end();
const func = decl.val.castTag(.function).?.data;
log.debug("decl.src_line={d}, func.lbrace_line={d}, func.rbrace_line={d}", .{
decl.src_line,
func.lbrace_line,
func.rbrace_line,
});
const line = @intCast(u28, decl.src_line + func.lbrace_line);
var data: [4]u8 = undefined;
leb128.writeUnsignedFixed(4, &data, line);
switch (self.tag) {
.elf => {
const elf_file = file.cast(File.Elf).?;
const shdr = elf_file.sections.items[elf_file.debug_line_section_index.?];
const file_pos = shdr.sh_offset + decl.fn_link.elf.off + self.getRelocDbgLineOff();
try elf_file.base.file.?.pwriteAll(&data, file_pos);
},
.macho => {
const macho_file = file.cast(File.MachO).?;
const d_sym = macho_file.d_sym.?;
const dwarf_seg = d_sym.load_commands.items[d_sym.dwarf_segment_cmd_index.?].segment;
const sect = dwarf_seg.sections.items[d_sym.debug_line_section_index.?];
const file_pos = sect.offset + decl.fn_link.macho.off + self.getRelocDbgLineOff();
try d_sym.file.pwriteAll(&data, file_pos);
},
else => unreachable,
}
}
pub fn freeAtom(self: *Dwarf, atom: *DebugInfoAtom) void {
if (self.dbg_info_decl_first == atom) {
self.dbg_info_decl_first = atom.next;
}
if (self.dbg_info_decl_last == atom) {
// TODO shrink the .debug_info section size here
self.dbg_info_decl_last = atom.prev;
}
if (atom.prev) |prev| {
prev.next = atom.next;
// TODO the free list logic like we do for text blocks above
} else {
atom.prev = null;
}
if (atom.next) |next| {
next.prev = atom.prev;
} else {
atom.next = null;
}
}
pub fn freeDecl(self: *Dwarf, decl: *Module.Decl) void {
// TODO make this logic match freeTextBlock. Maybe abstract the logic out since the same thing
// is desired for both.
const gpa = self.allocator;
const fn_link = switch (self.tag) {
.elf => &decl.fn_link.elf,
.macho => &decl.fn_link.macho,
else => unreachable,
};
_ = self.dbg_line_fn_free_list.remove(fn_link);
if (fn_link.prev) |prev| {
self.dbg_line_fn_free_list.put(gpa, prev, {}) catch {};
prev.next = fn_link.next;
if (fn_link.next) |next| {
next.prev = prev;
} else {
self.dbg_line_fn_last = prev;
}
} else if (fn_link.next) |next| {
self.dbg_line_fn_first = next;
next.prev = null;
}
if (self.dbg_line_fn_first == fn_link) {
self.dbg_line_fn_first = fn_link.next;
}
if (self.dbg_line_fn_last == fn_link) {
self.dbg_line_fn_last = fn_link.prev;
}
}
/// Asserts the type has codegen bits.
fn addDbgInfoType(
self: *Dwarf,
arena: Allocator,
ty: Type,
dbg_info_buffer: *std.ArrayList(u8),
dbg_info_type_relocs: *File.DbgInfoTypeRelocsTable,
) error{OutOfMemory}!void {
const target = self.target;
var relocs = std.ArrayList(struct { ty: Type, reloc: u32 }).init(arena);
switch (ty.zigTypeTag()) {
.NoReturn => unreachable,
.Void => {
try dbg_info_buffer.append(abbrev_pad1);
},
.Bool => {
try dbg_info_buffer.appendSlice(&[_]u8{
abbrev_base_type,
DW.ATE.boolean, // DW.AT.encoding , DW.FORM.data1
1, // DW.AT.byte_size, DW.FORM.data1
'b', 'o', 'o', 'l', 0, // DW.AT.name, DW.FORM.string
});
},
.Int => {
const info = ty.intInfo(target);
try dbg_info_buffer.ensureUnusedCapacity(12);
dbg_info_buffer.appendAssumeCapacity(abbrev_base_type);
// DW.AT.encoding, DW.FORM.data1
dbg_info_buffer.appendAssumeCapacity(switch (info.signedness) {
.signed => DW.ATE.signed,
.unsigned => DW.ATE.unsigned,
});
// DW.AT.byte_size, DW.FORM.data1
dbg_info_buffer.appendAssumeCapacity(@intCast(u8, ty.abiSize(target)));
// DW.AT.name, DW.FORM.string
try dbg_info_buffer.writer().print("{}\x00", .{ty});
},
.Optional => {
if (ty.isPtrLikeOptional()) {
try dbg_info_buffer.ensureUnusedCapacity(12);
dbg_info_buffer.appendAssumeCapacity(abbrev_base_type);
// DW.AT.encoding, DW.FORM.data1
dbg_info_buffer.appendAssumeCapacity(DW.ATE.address);
// DW.AT.byte_size, DW.FORM.data1
dbg_info_buffer.appendAssumeCapacity(@intCast(u8, ty.abiSize(target)));
// DW.AT.name, DW.FORM.string
try dbg_info_buffer.writer().print("{}\x00", .{ty});
} else {
// Non-pointer optionals are structs: struct { .maybe = *, .val = * }
var buf = try arena.create(Type.Payload.ElemType);
const payload_ty = ty.optionalChild(buf);
// DW.AT.structure_type
try dbg_info_buffer.append(abbrev_struct_type);
// DW.AT.byte_size, DW.FORM.sdata
const abi_size = ty.abiSize(target);
try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size);
// DW.AT.name, DW.FORM.string
try dbg_info_buffer.writer().print("{}\x00", .{ty});
// DW.AT.member
try dbg_info_buffer.ensureUnusedCapacity(7);
dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member);
// DW.AT.name, DW.FORM.string
dbg_info_buffer.appendSliceAssumeCapacity("maybe");
dbg_info_buffer.appendAssumeCapacity(0);
// DW.AT.type, DW.FORM.ref4
var index = dbg_info_buffer.items.len;
try dbg_info_buffer.resize(index + 4);
try relocs.append(.{ .ty = Type.bool, .reloc = @intCast(u32, index) });
// DW.AT.data_member_location, DW.FORM.sdata
try dbg_info_buffer.ensureUnusedCapacity(6);
dbg_info_buffer.appendAssumeCapacity(0);
// DW.AT.member
dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member);
// DW.AT.name, DW.FORM.string
dbg_info_buffer.appendSliceAssumeCapacity("val");
dbg_info_buffer.appendAssumeCapacity(0);
// DW.AT.type, DW.FORM.ref4
index = dbg_info_buffer.items.len;
try dbg_info_buffer.resize(index + 4);
try relocs.append(.{ .ty = payload_ty, .reloc = @intCast(u32, index) });
// DW.AT.data_member_location, DW.FORM.sdata
const offset = abi_size - payload_ty.abiSize(target);
try leb128.writeULEB128(dbg_info_buffer.writer(), offset);
// DW.AT.structure_type delimit children
try dbg_info_buffer.append(0);
}
},
.Pointer => {
if (ty.isSlice()) {
// Slices are structs: struct { .ptr = *, .len = N }
// DW.AT.structure_type
try dbg_info_buffer.ensureUnusedCapacity(2);
dbg_info_buffer.appendAssumeCapacity(abbrev_struct_type);
// DW.AT.byte_size, DW.FORM.sdata
dbg_info_buffer.appendAssumeCapacity(@sizeOf(usize) * 2);
// DW.AT.name, DW.FORM.string
try dbg_info_buffer.writer().print("{}\x00", .{ty});
// DW.AT.member
try dbg_info_buffer.ensureUnusedCapacity(5);
dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member);
// DW.AT.name, DW.FORM.string
dbg_info_buffer.appendSliceAssumeCapacity("ptr");
dbg_info_buffer.appendAssumeCapacity(0);
// DW.AT.type, DW.FORM.ref4
var index = dbg_info_buffer.items.len;
try dbg_info_buffer.resize(index + 4);
var buf = try arena.create(Type.SlicePtrFieldTypeBuffer);
const ptr_ty = ty.slicePtrFieldType(buf);
try relocs.append(.{ .ty = ptr_ty, .reloc = @intCast(u32, index) });
// DW.AT.data_member_location, DW.FORM.sdata
try dbg_info_buffer.ensureUnusedCapacity(6);
dbg_info_buffer.appendAssumeCapacity(0);
// DW.AT.member
dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member);
// DW.AT.name, DW.FORM.string
dbg_info_buffer.appendSliceAssumeCapacity("len");
dbg_info_buffer.appendAssumeCapacity(0);
// DW.AT.type, DW.FORM.ref4
index = dbg_info_buffer.items.len;
try dbg_info_buffer.resize(index + 4);
try relocs.append(.{ .ty = Type.initTag(.usize), .reloc = @intCast(u32, index) });
// DW.AT.data_member_location, DW.FORM.sdata
try dbg_info_buffer.ensureUnusedCapacity(2);
dbg_info_buffer.appendAssumeCapacity(@sizeOf(usize));
// DW.AT.structure_type delimit children
dbg_info_buffer.appendAssumeCapacity(0);
} else {
try dbg_info_buffer.ensureUnusedCapacity(5);
dbg_info_buffer.appendAssumeCapacity(abbrev_ptr_type);
// DW.AT.type, DW.FORM.ref4
const index = dbg_info_buffer.items.len;
try dbg_info_buffer.resize(index + 4);
try relocs.append(.{ .ty = ty.childType(), .reloc = @intCast(u32, index) });
}
},
.Struct => blk: {
// try dbg_info_buffer.ensureUnusedCapacity(23);
// DW.AT.structure_type
try dbg_info_buffer.append(abbrev_struct_type);
// DW.AT.byte_size, DW.FORM.sdata
const abi_size = ty.abiSize(target);
try leb128.writeULEB128(dbg_info_buffer.writer(), abi_size);
// DW.AT.name, DW.FORM.string
const struct_name = try ty.nameAlloc(arena);
try dbg_info_buffer.ensureUnusedCapacity(struct_name.len + 1);
dbg_info_buffer.appendSliceAssumeCapacity(struct_name);
dbg_info_buffer.appendAssumeCapacity(0);
const struct_obj = ty.castTag(.@"struct").?.data;
if (struct_obj.layout == .Packed) {
log.debug("TODO implement .debug_info for packed structs", .{});
break :blk;
}
const fields = ty.structFields();
for (fields.keys()) |field_name, field_index| {
const field = fields.get(field_name).?;
// DW.AT.member
try dbg_info_buffer.ensureUnusedCapacity(field_name.len + 2);
dbg_info_buffer.appendAssumeCapacity(abbrev_struct_member);
// DW.AT.name, DW.FORM.string
dbg_info_buffer.appendSliceAssumeCapacity(field_name);
dbg_info_buffer.appendAssumeCapacity(0);
// DW.AT.type, DW.FORM.ref4
var index = dbg_info_buffer.items.len;
try dbg_info_buffer.resize(index + 4);
try relocs.append(.{ .ty = field.ty, .reloc = @intCast(u32, index) });
// DW.AT.data_member_location, DW.FORM.sdata
const field_off = ty.structFieldOffset(field_index, target);
try leb128.writeULEB128(dbg_info_buffer.writer(), field_off);
}
// DW.AT.structure_type delimit children
try dbg_info_buffer.append(0);
},
else => {
log.debug("TODO implement .debug_info for type '{}'", .{ty});
try dbg_info_buffer.append(abbrev_pad1);
},
}
for (relocs.items) |rel| {
const gop = try dbg_info_type_relocs.getOrPut(self.allocator, rel.ty);
if (!gop.found_existing) {
gop.value_ptr.* = .{
.off = undefined,
.relocs = .{},
};
}
try gop.value_ptr.relocs.append(self.allocator, rel.reloc);
}
}
pub fn writeDbgAbbrev(self: *Dwarf, file: *File) !void {
// These are LEB encoded but since the values are all less than 127
// we can simply append these bytes.
const abbrev_buf = [_]u8{
abbrev_compile_unit, DW.TAG.compile_unit, DW.CHILDREN.yes, // header
DW.AT.stmt_list, DW.FORM.sec_offset, DW.AT.low_pc,
DW.FORM.addr, DW.AT.high_pc, DW.FORM.addr,
DW.AT.name, DW.FORM.strp, DW.AT.comp_dir,
DW.FORM.strp, DW.AT.producer, DW.FORM.strp,
DW.AT.language, DW.FORM.data2, 0,
0, // table sentinel
abbrev_subprogram,
DW.TAG.subprogram,
DW.CHILDREN.yes, // header
DW.AT.low_pc,
DW.FORM.addr,
DW.AT.high_pc,
DW.FORM.data4,
DW.AT.type,
DW.FORM.ref4,
DW.AT.name,
DW.FORM.string,
0, 0, // table sentinel
abbrev_subprogram_retvoid,
DW.TAG.subprogram, DW.CHILDREN.yes, // header
DW.AT.low_pc, DW.FORM.addr,
DW.AT.high_pc, DW.FORM.data4,
DW.AT.name, DW.FORM.string,
0,
0, // table sentinel
abbrev_base_type,
DW.TAG.base_type,
DW.CHILDREN.no, // header
DW.AT.encoding,
DW.FORM.data1,
DW.AT.byte_size,
DW.FORM.data1,
DW.AT.name,
DW.FORM.string,
0,
0, // table sentinel
abbrev_ptr_type,
DW.TAG.pointer_type,
DW.CHILDREN.no, // header
DW.AT.type,
DW.FORM.ref4,
0,
0, // table sentinel
abbrev_struct_type,
DW.TAG.structure_type,
DW.CHILDREN.yes, // header
DW.AT.byte_size,
DW.FORM.sdata,
DW.AT.name,
DW.FORM.string,
0,
0, // table sentinel
abbrev_struct_member,
DW.TAG.member,
DW.CHILDREN.no, // header
DW.AT.name,
DW.FORM.string,
DW.AT.type,
DW.FORM.ref4,
DW.AT.data_member_location,
DW.FORM.sdata,
0,
0, // table sentinel
abbrev_pad1,
DW.TAG.unspecified_type,
DW.CHILDREN.no, // header
0,
0, // table sentinel
abbrev_parameter,
DW.TAG.formal_parameter, DW.CHILDREN.no, // header
DW.AT.location, DW.FORM.exprloc,
DW.AT.type, DW.FORM.ref4,
DW.AT.name, DW.FORM.string,
0,
0, // table sentinel
0,
0,
0, // section sentinel
};
const abbrev_offset = 0;
self.abbrev_table_offset = abbrev_offset;
const needed_size = abbrev_buf.len;
switch (self.tag) {
.elf => {
const elf_file = file.cast(File.Elf).?;
const debug_abbrev_sect = &elf_file.sections.items[elf_file.debug_abbrev_section_index.?];
const allocated_size = elf_file.allocatedSize(debug_abbrev_sect.sh_offset);
if (needed_size > allocated_size) {
debug_abbrev_sect.sh_size = 0; // free the space
debug_abbrev_sect.sh_offset = elf_file.findFreeSpace(needed_size, 1);
}
debug_abbrev_sect.sh_size = needed_size;
log.debug(".debug_abbrev start=0x{x} end=0x{x}", .{
debug_abbrev_sect.sh_offset,
debug_abbrev_sect.sh_offset + needed_size,
});
const file_pos = debug_abbrev_sect.sh_offset + abbrev_offset;
try elf_file.base.file.?.pwriteAll(&abbrev_buf, file_pos);
},
.macho => {
const macho_file = file.cast(File.MachO).?;
const d_sym = &macho_file.d_sym.?;
const dwarf_segment = &d_sym.load_commands.items[d_sym.dwarf_segment_cmd_index.?].segment;
const debug_abbrev_sect = &dwarf_segment.sections.items[d_sym.debug_abbrev_section_index.?];
const allocated_size = d_sym.allocatedSize(debug_abbrev_sect.offset);
if (needed_size > allocated_size) {
debug_abbrev_sect.size = 0; // free the space
const offset = d_sym.findFreeSpace(needed_size, 1);
debug_abbrev_sect.offset = @intCast(u32, offset);
debug_abbrev_sect.addr = dwarf_segment.inner.vmaddr + offset - dwarf_segment.inner.fileoff;
}
debug_abbrev_sect.size = needed_size;
log.debug("__debug_abbrev start=0x{x} end=0x{x}", .{
debug_abbrev_sect.offset,
debug_abbrev_sect.offset + needed_size,
});
const file_pos = debug_abbrev_sect.offset + abbrev_offset;
try d_sym.file.pwriteAll(&abbrev_buf, file_pos);
},
else => unreachable,
}
}
fn dbgInfoHeaderBytes(self: *Dwarf) usize {
_ = self;
return 120;
}
pub fn writeDbgInfoHeader(self: *Dwarf, file: *File, module: *Module, low_pc: u64, high_pc: u64) !void {
// If this value is null it means there is an error in the module;
// leave debug_info_header_dirty=true.
const first_dbg_info_off = self.getDebugInfoOff() orelse return;
// We have a function to compute the upper bound size, because it's needed
// for determining where to put the offset of the first `LinkBlock`.
const needed_bytes = self.dbgInfoHeaderBytes();
var di_buf = try std.ArrayList(u8).initCapacity(self.allocator, needed_bytes);
defer di_buf.deinit();
const target_endian = self.target.cpu.arch.endian();
const init_len_size: usize = if (self.tag == .macho)
4
else switch (self.ptr_width) {
.p32 => @as(usize, 4),
.p64 => 12,
};
// initial length - length of the .debug_info contribution for this compilation unit,
// not including the initial length itself.
// We have to come back and write it later after we know the size.
const after_init_len = di_buf.items.len + init_len_size;
// +1 for the final 0 that ends the compilation unit children.
const dbg_info_end = self.getDebugInfoEnd().? + 1;
const init_len = dbg_info_end - after_init_len;
if (self.tag == .macho) {
mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), @intCast(u32, init_len));
} else switch (self.ptr_width) {
.p32 => {
mem.writeInt(u32, di_buf.addManyAsArrayAssumeCapacity(4), @intCast(u32, init_len), target_endian);
},
.p64 => {
di_buf.appendNTimesAssumeCapacity(0xff, 4);
mem.writeInt(u64, di_buf.addManyAsArrayAssumeCapacity(8), init_len, target_endian);
},
}
mem.writeInt(u16, di_buf.addManyAsArrayAssumeCapacity(2), 4, target_endian); // DWARF version
const abbrev_offset = self.abbrev_table_offset.?;
if (self.tag == .macho) {
mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), @intCast(u32, abbrev_offset));
di_buf.appendAssumeCapacity(8); // address size
} else switch (self.ptr_width) {
.p32 => {
mem.writeInt(u32, di_buf.addManyAsArrayAssumeCapacity(4), @intCast(u32, abbrev_offset), target_endian);
di_buf.appendAssumeCapacity(4); // address size
},
.p64 => {
mem.writeInt(u64, di_buf.addManyAsArrayAssumeCapacity(8), abbrev_offset, target_endian);
di_buf.appendAssumeCapacity(8); // address size
},
}
// Write the form for the compile unit, which must match the abbrev table above.
const name_strp = try self.makeString(module.root_pkg.root_src_path);
const comp_dir_strp = try self.makeString(module.root_pkg.root_src_directory.path orelse ".");
const producer_strp = try self.makeString(link.producer_string);
di_buf.appendAssumeCapacity(abbrev_compile_unit);
if (self.tag == .macho) {
mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), 0); // DW.AT.stmt_list, DW.FORM.sec_offset
mem.writeIntLittle(u64, di_buf.addManyAsArrayAssumeCapacity(8), low_pc);
mem.writeIntLittle(u64, di_buf.addManyAsArrayAssumeCapacity(8), high_pc);
mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), @intCast(u32, name_strp));
mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), @intCast(u32, comp_dir_strp));
mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), @intCast(u32, producer_strp));
} else {
self.writeAddrAssumeCapacity(&di_buf, 0); // DW.AT.stmt_list, DW.FORM.sec_offset
self.writeAddrAssumeCapacity(&di_buf, low_pc);
self.writeAddrAssumeCapacity(&di_buf, high_pc);
self.writeAddrAssumeCapacity(&di_buf, name_strp);
self.writeAddrAssumeCapacity(&di_buf, comp_dir_strp);
self.writeAddrAssumeCapacity(&di_buf, producer_strp);
}
// We are still waiting on dwarf-std.org to assign DW_LANG_Zig a number:
// http://dwarfstd.org/ShowIssue.php?issue=171115.1
// Until then we say it is C99.
mem.writeInt(u16, di_buf.addManyAsArrayAssumeCapacity(2), DW.LANG.C99, target_endian);
if (di_buf.items.len > first_dbg_info_off) {
// Move the first N decls to the end to make more padding for the header.
@panic("TODO: handle .debug_info header exceeding its padding");
}
const jmp_amt = first_dbg_info_off - di_buf.items.len;
switch (self.tag) {
.elf => {
const elf_file = file.cast(File.Elf).?;
const debug_info_sect = elf_file.sections.items[elf_file.debug_info_section_index.?];
const file_pos = debug_info_sect.sh_offset;
try pwriteDbgInfoNops(elf_file.base.file.?, file_pos, 0, di_buf.items, jmp_amt, false);
},
.macho => {
const macho_file = file.cast(File.MachO).?;
const d_sym = &macho_file.d_sym.?;
const dwarf_seg = d_sym.load_commands.items[d_sym.dwarf_segment_cmd_index.?].segment;
const debug_info_sect = dwarf_seg.sections.items[d_sym.debug_info_section_index.?];
const file_pos = debug_info_sect.offset;
try pwriteDbgInfoNops(d_sym.file, file_pos, 0, di_buf.items, jmp_amt, false);
},
else => unreachable,
}
}
fn writeAddrAssumeCapacity(self: *Dwarf, buf: *std.ArrayList(u8), addr: u64) void {
const target_endian = self.target.cpu.arch.endian();
switch (self.ptr_width) {
.p32 => mem.writeInt(u32, buf.addManyAsArrayAssumeCapacity(4), @intCast(u32, addr), target_endian),
.p64 => mem.writeInt(u64, buf.addManyAsArrayAssumeCapacity(8), addr, target_endian),
}
}
/// Writes to the file a buffer, prefixed and suffixed by the specified number of
/// bytes of NOPs. Asserts each padding size is at least `min_nop_size` and total padding bytes
/// are less than 1044480 bytes (if this limit is ever reached, this function can be
/// improved to make more than one pwritev call, or the limit can be raised by a fixed
/// amount by increasing the length of `vecs`).
fn pwriteDbgLineNops(
file: fs.File,
offset: u64,
prev_padding_size: usize,
buf: []const u8,
next_padding_size: usize,
) !void {
const tracy = trace(@src());
defer tracy.end();
const page_of_nops = [1]u8{DW.LNS.negate_stmt} ** 4096;
const three_byte_nop = [3]u8{ DW.LNS.advance_pc, 0b1000_0000, 0 };
var vecs: [512]std.os.iovec_const = undefined;
var vec_index: usize = 0;
{
var padding_left = prev_padding_size;
if (padding_left % 2 != 0) {
vecs[vec_index] = .{
.iov_base = &three_byte_nop,
.iov_len = three_byte_nop.len,
};
vec_index += 1;
padding_left -= three_byte_nop.len;
}
while (padding_left > page_of_nops.len) {
vecs[vec_index] = .{
.iov_base = &page_of_nops,
.iov_len = page_of_nops.len,
};
vec_index += 1;
padding_left -= page_of_nops.len;
}
if (padding_left > 0) {
vecs[vec_index] = .{
.iov_base = &page_of_nops,
.iov_len = padding_left,
};
vec_index += 1;
}
}
vecs[vec_index] = .{
.iov_base = buf.ptr,
.iov_len = buf.len,
};
vec_index += 1;
{
var padding_left = next_padding_size;
if (padding_left % 2 != 0) {
vecs[vec_index] = .{
.iov_base = &three_byte_nop,
.iov_len = three_byte_nop.len,
};
vec_index += 1;
padding_left -= three_byte_nop.len;
}
while (padding_left > page_of_nops.len) {
vecs[vec_index] = .{
.iov_base = &page_of_nops,
.iov_len = page_of_nops.len,
};
vec_index += 1;
padding_left -= page_of_nops.len;
}
if (padding_left > 0) {
vecs[vec_index] = .{
.iov_base = &page_of_nops,
.iov_len = padding_left,
};
vec_index += 1;
}
}
try file.pwritevAll(vecs[0..vec_index], offset - prev_padding_size);
}
/// Writes to the file a buffer, prefixed and suffixed by the specified number of
/// bytes of padding.
fn pwriteDbgInfoNops(
file: fs.File,
offset: u64,
prev_padding_size: usize,
buf: []const u8,
next_padding_size: usize,
trailing_zero: bool,
) !void {
const tracy = trace(@src());
defer tracy.end();
const page_of_nops = [1]u8{abbrev_pad1} ** 4096;
var vecs: [32]std.os.iovec_const = undefined;
var vec_index: usize = 0;
{
var padding_left = prev_padding_size;
while (padding_left > page_of_nops.len) {
vecs[vec_index] = .{
.iov_base = &page_of_nops,
.iov_len = page_of_nops.len,
};
vec_index += 1;
padding_left -= page_of_nops.len;
}
if (padding_left > 0) {
vecs[vec_index] = .{
.iov_base = &page_of_nops,
.iov_len = padding_left,
};
vec_index += 1;
}
}
vecs[vec_index] = .{
.iov_base = buf.ptr,
.iov_len = buf.len,
};
vec_index += 1;
{
var padding_left = next_padding_size;
while (padding_left > page_of_nops.len) {
vecs[vec_index] = .{
.iov_base = &page_of_nops,
.iov_len = page_of_nops.len,
};
vec_index += 1;
padding_left -= page_of_nops.len;
}
if (padding_left > 0) {
vecs[vec_index] = .{
.iov_base = &page_of_nops,
.iov_len = padding_left,
};
vec_index += 1;
}
}
if (trailing_zero) {
var zbuf = [1]u8{0};
vecs[vec_index] = .{
.iov_base = &zbuf,
.iov_len = zbuf.len,
};
vec_index += 1;
}
try file.pwritevAll(vecs[0..vec_index], offset - prev_padding_size);
}
pub fn writeDbgAranges(self: *Dwarf, file: *File, addr: u64, size: u64) !void {
const target_endian = self.target.cpu.arch.endian();
const init_len_size: usize = if (self.tag == .macho)
4
else switch (self.ptr_width) {
.p32 => @as(usize, 4),
.p64 => 12,
};
const ptr_width_bytes: u8 = self.ptrWidthBytes();
// Enough for all the data without resizing. When support for more compilation units
// is added, the size of this section will become more variable.
var di_buf = try std.ArrayList(u8).initCapacity(self.allocator, 100);
defer di_buf.deinit();
// initial length - length of the .debug_aranges contribution for this compilation unit,
// not including the initial length itself.
// We have to come back and write it later after we know the size.
const init_len_index = di_buf.items.len;
di_buf.items.len += init_len_size;
const after_init_len = di_buf.items.len;
mem.writeInt(u16, di_buf.addManyAsArrayAssumeCapacity(2), 2, target_endian); // version
// When more than one compilation unit is supported, this will be the offset to it.
// For now it is always at offset 0 in .debug_info.
if (self.tag == .macho) {
mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), 0); // __debug_info offset
} else {
self.writeAddrAssumeCapacity(&di_buf, 0); // .debug_info offset
}
di_buf.appendAssumeCapacity(ptr_width_bytes); // address_size
di_buf.appendAssumeCapacity(0); // segment_selector_size
const end_header_offset = di_buf.items.len;
const begin_entries_offset = mem.alignForward(end_header_offset, ptr_width_bytes * 2);
di_buf.appendNTimesAssumeCapacity(0, begin_entries_offset - end_header_offset);
// Currently only one compilation unit is supported, so the address range is simply
// identical to the main program header virtual address and memory size.
self.writeAddrAssumeCapacity(&di_buf, addr);
self.writeAddrAssumeCapacity(&di_buf, size);
// Sentinel.
self.writeAddrAssumeCapacity(&di_buf, 0);
self.writeAddrAssumeCapacity(&di_buf, 0);
// Go back and populate the initial length.
const init_len = di_buf.items.len - after_init_len;
if (self.tag == .macho) {
mem.writeIntLittle(u32, di_buf.items[init_len_index..][0..4], @intCast(u32, init_len));
} else switch (self.ptr_width) {
.p32 => {
mem.writeInt(u32, di_buf.items[init_len_index..][0..4], @intCast(u32, init_len), target_endian);
},
.p64 => {
// initial length - length of the .debug_aranges contribution for this compilation unit,
// not including the initial length itself.
di_buf.items[init_len_index..][0..4].* = [_]u8{ 0xff, 0xff, 0xff, 0xff };
mem.writeInt(u64, di_buf.items[init_len_index + 4 ..][0..8], init_len, target_endian);
},
}
const needed_size = di_buf.items.len;
switch (self.tag) {
.elf => {
const elf_file = file.cast(File.Elf).?;
const debug_aranges_sect = &elf_file.sections.items[elf_file.debug_aranges_section_index.?];
const allocated_size = elf_file.allocatedSize(debug_aranges_sect.sh_offset);
if (needed_size > allocated_size) {
debug_aranges_sect.sh_size = 0; // free the space
debug_aranges_sect.sh_offset = elf_file.findFreeSpace(needed_size, 16);
}
debug_aranges_sect.sh_size = needed_size;
log.debug(".debug_aranges start=0x{x} end=0x{x}", .{
debug_aranges_sect.sh_offset,
debug_aranges_sect.sh_offset + needed_size,
});
const file_pos = debug_aranges_sect.sh_offset;
try elf_file.base.file.?.pwriteAll(di_buf.items, file_pos);
},
.macho => {
const macho_file = file.cast(File.MachO).?;
const d_sym = &macho_file.d_sym.?;
const dwarf_seg = &d_sym.load_commands.items[d_sym.dwarf_segment_cmd_index.?].segment;
const debug_aranges_sect = &dwarf_seg.sections.items[d_sym.debug_aranges_section_index.?];
const allocated_size = d_sym.allocatedSize(debug_aranges_sect.offset);
if (needed_size > allocated_size) {
debug_aranges_sect.size = 0; // free the space
const new_offset = d_sym.findFreeSpace(needed_size, 16);
debug_aranges_sect.addr = dwarf_seg.inner.vmaddr + new_offset - dwarf_seg.inner.fileoff;
debug_aranges_sect.offset = @intCast(u32, new_offset);
}
debug_aranges_sect.size = needed_size;
log.debug("__debug_aranges start=0x{x} end=0x{x}", .{
debug_aranges_sect.offset,
debug_aranges_sect.offset + needed_size,
});
const file_pos = debug_aranges_sect.offset;
try d_sym.file.pwriteAll(di_buf.items, file_pos);
},
else => unreachable,
}
}
pub fn writeDbgLineHeader(self: *Dwarf, file: *File, module: *Module) !void {
const ptr_width_bytes: u8 = self.ptrWidthBytes();
const target_endian = self.target.cpu.arch.endian();
const init_len_size: usize = if (self.tag == .macho)
4
else switch (self.ptr_width) {
.p32 => @as(usize, 4),
.p64 => 12,
};
const dbg_line_prg_off = self.getDebugLineProgramOff() orelse return;
const dbg_line_prg_end = self.getDebugLineProgramEnd().?;
assert(dbg_line_prg_end != 0);
// The size of this header is variable, depending on the number of directories,
// files, and padding. We have a function to compute the upper bound size, however,
// because it's needed for determining where to put the offset of the first `SrcFn`.
const needed_bytes = self.dbgLineNeededHeaderBytes(module);
var di_buf = try std.ArrayList(u8).initCapacity(self.allocator, needed_bytes);
defer di_buf.deinit();
// initial length - length of the .debug_line contribution for this compilation unit,
// not including the initial length itself.
const after_init_len = di_buf.items.len + init_len_size;
const init_len = dbg_line_prg_end - after_init_len;
if (self.tag == .macho) {
mem.writeIntLittle(u32, di_buf.addManyAsArrayAssumeCapacity(4), @intCast(u32, init_len));
} else switch (self.ptr_width) {
.p32 => {
mem.writeInt(u32, di_buf.addManyAsArrayAssumeCapacity(4), @intCast(u32, init_len), target_endian);
},
.p64 => {
di_buf.appendNTimesAssumeCapacity(0xff, 4);
mem.writeInt(u64, di_buf.addManyAsArrayAssumeCapacity(8), init_len, target_endian);
},
}
mem.writeInt(u16, di_buf.addManyAsArrayAssumeCapacity(2), 4, target_endian); // version
// Empirically, debug info consumers do not respect this field, or otherwise
// consider it to be an error when it does not point exactly to the end of the header.
// Therefore we rely on the NOP jump at the beginning of the Line Number Program for
// padding rather than this field.
const before_header_len = di_buf.items.len;
di_buf.items.len += if (self.tag == .macho) @sizeOf(u32) else ptr_width_bytes; // We will come back and write this.
const after_header_len = di_buf.items.len;
const opcode_base = DW.LNS.set_isa + 1;
di_buf.appendSliceAssumeCapacity(&[_]u8{
1, // minimum_instruction_length
1, // maximum_operations_per_instruction
1, // default_is_stmt
1, // line_base (signed)
1, // line_range
opcode_base,
// Standard opcode lengths. The number of items here is based on `opcode_base`.
// The value is the number of LEB128 operands the instruction takes.
0, // `DW.LNS.copy`
1, // `DW.LNS.advance_pc`
1, // `DW.LNS.advance_line`
1, // `DW.LNS.set_file`
1, // `DW.LNS.set_column`
0, // `DW.LNS.negate_stmt`
0, // `DW.LNS.set_basic_block`
0, // `DW.LNS.const_add_pc`
1, // `DW.LNS.fixed_advance_pc`
0, // `DW.LNS.set_prologue_end`
0, // `DW.LNS.set_epilogue_begin`
1, // `DW.LNS.set_isa`
0, // include_directories (none except the compilation unit cwd)
});
// file_names[0]
di_buf.appendSliceAssumeCapacity(module.root_pkg.root_src_path); // relative path name
di_buf.appendSliceAssumeCapacity(&[_]u8{
0, // null byte for the relative path name
0, // directory_index
0, // mtime (TODO supply this)
0, // file size bytes (TODO supply this)
0, // file_names sentinel
});
const header_len = di_buf.items.len - after_header_len;
if (self.tag == .macho) {
mem.writeIntLittle(u32, di_buf.items[before_header_len..][0..4], @intCast(u32, header_len));
} else switch (self.ptr_width) {
.p32 => {
mem.writeInt(u32, di_buf.items[before_header_len..][0..4], @intCast(u32, header_len), target_endian);
},
.p64 => {
mem.writeInt(u64, di_buf.items[before_header_len..][0..8], header_len, target_endian);
},
}
// We use NOPs because consumers empirically do not respect the header length field.
if (di_buf.items.len > dbg_line_prg_off) {
// Move the first N files to the end to make more padding for the header.
@panic("TODO: handle .debug_line header exceeding its padding");
}
const jmp_amt = dbg_line_prg_off - di_buf.items.len;
switch (self.tag) {
.elf => {
const elf_file = file.cast(File.Elf).?;
const debug_line_sect = elf_file.sections.items[elf_file.debug_line_section_index.?];
const file_pos = debug_line_sect.sh_offset;
try pwriteDbgLineNops(elf_file.base.file.?, file_pos, 0, di_buf.items, jmp_amt);
},
.macho => {
const macho_file = file.cast(File.MachO).?;
const d_sym = &macho_file.d_sym.?;
const dwarf_seg = d_sym.load_commands.items[d_sym.dwarf_segment_cmd_index.?].segment;
const debug_line_sect = dwarf_seg.sections.items[d_sym.debug_line_section_index.?];
const file_pos = debug_line_sect.offset;
try pwriteDbgLineNops(d_sym.file, file_pos, 0, di_buf.items, jmp_amt);
},
else => unreachable,
}
}
fn getDebugInfoOff(self: Dwarf) ?u32 {
const first = self.dbg_info_decl_first orelse return null;
return first.off;
}
fn getDebugInfoEnd(self: Dwarf) ?u32 {
const last = self.dbg_info_decl_last orelse return null;
return last.off + last.len;
}
fn getDebugLineProgramOff(self: Dwarf) ?u32 {
const first = self.dbg_line_fn_first orelse return null;
return first.off;
}
fn getDebugLineProgramEnd(self: Dwarf) ?u32 {
const last = self.dbg_line_fn_last orelse return null;
return last.off + last.len;
}
/// Always 4 or 8 depending on whether this is 32-bit or 64-bit format.
fn ptrWidthBytes(self: Dwarf) u8 {
return switch (self.ptr_width) {
.p32 => 4,
.p64 => 8,
};
}
fn dbgLineNeededHeaderBytes(self: Dwarf, module: *Module) u32 {
_ = self;
const directory_entry_format_count = 1;
const file_name_entry_format_count = 1;
const directory_count = 1;
const file_name_count = 1;
const root_src_dir_path_len = if (module.root_pkg.root_src_directory.path) |p| p.len else 1; // "."
return @intCast(u32, 53 + directory_entry_format_count * 2 + file_name_entry_format_count * 2 +
directory_count * 8 + file_name_count * 8 +
// These are encoded as DW.FORM.string rather than DW.FORM.strp as we would like
// because of a workaround for readelf and gdb failing to understand DWARFv5 correctly.
root_src_dir_path_len +
module.root_pkg.root_src_path.len);
}
/// The reloc offset for the line offset of a function from the previous function's line.
/// It's a fixed-size 4-byte ULEB128.
fn getRelocDbgLineOff(self: Dwarf) usize {
return dbg_line_vaddr_reloc_index + self.ptrWidthBytes() + 1;
}
fn getRelocDbgFileIndex(self: Dwarf) usize {
return self.getRelocDbgLineOff() + 5;
}
fn getRelocDbgInfoSubprogramHighPC(self: Dwarf) u32 {
return dbg_info_low_pc_reloc_index + self.ptrWidthBytes();
}
/// TODO Improve this to use a table.
fn makeString(self: *Dwarf, bytes: []const u8) !u32 {
try self.strtab.ensureUnusedCapacity(self.allocator, bytes.len + 1);
const result = self.strtab.items.len;
self.strtab.appendSliceAssumeCapacity(bytes);
self.strtab.appendAssumeCapacity(0);
return @intCast(u32, result);
}
fn padToIdeal(actual_size: anytype) @TypeOf(actual_size) {
// TODO https://github.com/ziglang/zig/issues/1284
return std.math.add(@TypeOf(actual_size), actual_size, actual_size / ideal_factor) catch
std.math.maxInt(@TypeOf(actual_size));
} | src/link/Dwarf.zig |
const std = @import("../../../std.zig");
const linux = std.os.linux;
const socklen_t = linux.socklen_t;
const iovec = linux.iovec;
const iovec_const = linux.iovec_const;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const pid_t = linux.pid_t;
pub const SYS = extern enum(usize) {
pub const Linux = 4000;
syscall = Linux + 0,
exit = Linux + 1,
fork = Linux + 2,
read = Linux + 3,
write = Linux + 4,
open = Linux + 5,
close = Linux + 6,
waitpid = Linux + 7,
creat = Linux + 8,
link = Linux + 9,
unlink = Linux + 10,
execve = Linux + 11,
chdir = Linux + 12,
time = Linux + 13,
mknod = Linux + 14,
chmod = Linux + 15,
lchown = Linux + 16,
@"break" = Linux + 17,
unused18 = Linux + 18,
lseek = Linux + 19,
getpid = Linux + 20,
mount = Linux + 21,
umount = Linux + 22,
setuid = Linux + 23,
getuid = Linux + 24,
stime = Linux + 25,
ptrace = Linux + 26,
alarm = Linux + 27,
unused28 = Linux + 28,
pause = Linux + 29,
utime = Linux + 30,
stty = Linux + 31,
gtty = Linux + 32,
access = Linux + 33,
nice = Linux + 34,
ftime = Linux + 35,
sync = Linux + 36,
kill = Linux + 37,
rename = Linux + 38,
mkdir = Linux + 39,
rmdir = Linux + 40,
dup = Linux + 41,
pipe = Linux + 42,
times = Linux + 43,
prof = Linux + 44,
brk = Linux + 45,
setgid = Linux + 46,
getgid = Linux + 47,
signal = Linux + 48,
geteuid = Linux + 49,
getegid = Linux + 50,
acct = Linux + 51,
umount2 = Linux + 52,
lock = Linux + 53,
ioctl = Linux + 54,
fcntl = Linux + 55,
mpx = Linux + 56,
setpgid = Linux + 57,
ulimit = Linux + 58,
unused59 = Linux + 59,
umask = Linux + 60,
chroot = Linux + 61,
ustat = Linux + 62,
dup2 = Linux + 63,
getppid = Linux + 64,
getpgrp = Linux + 65,
setsid = Linux + 66,
sigaction = Linux + 67,
sgetmask = Linux + 68,
ssetmask = Linux + 69,
setreuid = Linux + 70,
setregid = Linux + 71,
sigsuspend = Linux + 72,
sigpending = Linux + 73,
sethostname = Linux + 74,
setrlimit = Linux + 75,
getrlimit = Linux + 76,
getrusage = Linux + 77,
gettimeofday = Linux + 78,
settimeofday = Linux + 79,
getgroups = Linux + 80,
setgroups = Linux + 81,
reserved82 = Linux + 82,
symlink = Linux + 83,
unused84 = Linux + 84,
readlink = Linux + 85,
uselib = Linux + 86,
swapon = Linux + 87,
reboot = Linux + 88,
readdir = Linux + 89,
mmap = Linux + 90,
munmap = Linux + 91,
truncate = Linux + 92,
ftruncate = Linux + 93,
fchmod = Linux + 94,
fchown = Linux + 95,
getpriority = Linux + 96,
setpriority = Linux + 97,
profil = Linux + 98,
statfs = Linux + 99,
fstatfs = Linux + 100,
ioperm = Linux + 101,
socketcall = Linux + 102,
syslog = Linux + 103,
setitimer = Linux + 104,
getitimer = Linux + 105,
stat = Linux + 106,
lstat = Linux + 107,
fstat = Linux + 108,
unused109 = Linux + 109,
iopl = Linux + 110,
vhangup = Linux + 111,
idle = Linux + 112,
vm86 = Linux + 113,
wait4 = Linux + 114,
swapoff = Linux + 115,
sysinfo = Linux + 116,
ipc = Linux + 117,
fsync = Linux + 118,
sigreturn = Linux + 119,
clone = Linux + 120,
setdomainname = Linux + 121,
uname = Linux + 122,
modify_ldt = Linux + 123,
adjtimex = Linux + 124,
mprotect = Linux + 125,
sigprocmask = Linux + 126,
create_module = Linux + 127,
init_module = Linux + 128,
delete_module = Linux + 129,
get_kernel_syms = Linux + 130,
quotactl = Linux + 131,
getpgid = Linux + 132,
fchdir = Linux + 133,
bdflush = Linux + 134,
sysfs = Linux + 135,
personality = Linux + 136,
afs_syscall = Linux + 137,
setfsuid = Linux + 138,
setfsgid = Linux + 139,
_llseek = Linux + 140,
getdents = Linux + 141,
_newselect = Linux + 142,
flock = Linux + 143,
msync = Linux + 144,
readv = Linux + 145,
writev = Linux + 146,
cacheflush = Linux + 147,
cachectl = Linux + 148,
sysmips = Linux + 149,
unused150 = Linux + 150,
getsid = Linux + 151,
fdatasync = Linux + 152,
_sysctl = Linux + 153,
mlock = Linux + 154,
munlock = Linux + 155,
mlockall = Linux + 156,
munlockall = Linux + 157,
sched_setparam = Linux + 158,
sched_getparam = Linux + 159,
sched_setscheduler = Linux + 160,
sched_getscheduler = Linux + 161,
sched_yield = Linux + 162,
sched_get_priority_max = Linux + 163,
sched_get_priority_min = Linux + 164,
sched_rr_get_interval = Linux + 165,
nanosleep = Linux + 166,
mremap = Linux + 167,
accept = Linux + 168,
bind = Linux + 169,
connect = Linux + 170,
getpeername = Linux + 171,
getsockname = Linux + 172,
getsockopt = Linux + 173,
listen = Linux + 174,
recv = Linux + 175,
recvfrom = Linux + 176,
recvmsg = Linux + 177,
send = Linux + 178,
sendmsg = Linux + 179,
sendto = Linux + 180,
setsockopt = Linux + 181,
shutdown = Linux + 182,
socket = Linux + 183,
socketpair = Linux + 184,
setresuid = Linux + 185,
getresuid = Linux + 186,
query_module = Linux + 187,
poll = Linux + 188,
nfsservctl = Linux + 189,
setresgid = Linux + 190,
getresgid = Linux + 191,
prctl = Linux + 192,
rt_sigreturn = Linux + 193,
rt_sigaction = Linux + 194,
rt_sigprocmask = Linux + 195,
rt_sigpending = Linux + 196,
rt_sigtimedwait = Linux + 197,
rt_sigqueueinfo = Linux + 198,
rt_sigsuspend = Linux + 199,
pread64 = Linux + 200,
pwrite64 = Linux + 201,
chown = Linux + 202,
getcwd = Linux + 203,
capget = Linux + 204,
capset = Linux + 205,
sigaltstack = Linux + 206,
sendfile = Linux + 207,
getpmsg = Linux + 208,
putpmsg = Linux + 209,
mmap2 = Linux + 210,
truncate64 = Linux + 211,
ftruncate64 = Linux + 212,
stat64 = Linux + 213,
lstat64 = Linux + 214,
fstat64 = Linux + 215,
pivot_root = Linux + 216,
mincore = Linux + 217,
madvise = Linux + 218,
getdents64 = Linux + 219,
fcntl64 = Linux + 220,
reserved221 = Linux + 221,
gettid = Linux + 222,
readahead = Linux + 223,
setxattr = Linux + 224,
lsetxattr = Linux + 225,
fsetxattr = Linux + 226,
getxattr = Linux + 227,
lgetxattr = Linux + 228,
fgetxattr = Linux + 229,
listxattr = Linux + 230,
llistxattr = Linux + 231,
flistxattr = Linux + 232,
removexattr = Linux + 233,
lremovexattr = Linux + 234,
fremovexattr = Linux + 235,
tkill = Linux + 236,
sendfile64 = Linux + 237,
futex = Linux + 238,
sched_setaffinity = Linux + 239,
sched_getaffinity = Linux + 240,
io_setup = Linux + 241,
io_destroy = Linux + 242,
io_getevents = Linux + 243,
io_submit = Linux + 244,
io_cancel = Linux + 245,
exit_group = Linux + 246,
lookup_dcookie = Linux + 247,
epoll_create = Linux + 248,
epoll_ctl = Linux + 249,
epoll_wait = Linux + 250,
remap_file_pages = Linux + 251,
set_tid_address = Linux + 252,
restart_syscall = Linux + 253,
fadvise64 = Linux + 254,
statfs64 = Linux + 255,
fstatfs64 = Linux + 256,
timer_create = Linux + 257,
timer_settime = Linux + 258,
timer_gettime = Linux + 259,
timer_getoverrun = Linux + 260,
timer_delete = Linux + 261,
clock_settime = Linux + 262,
clock_gettime = Linux + 263,
clock_getres = Linux + 264,
clock_nanosleep = Linux + 265,
tgkill = Linux + 266,
utimes = Linux + 267,
mbind = Linux + 268,
get_mempolicy = Linux + 269,
set_mempolicy = Linux + 270,
mq_open = Linux + 271,
mq_unlink = Linux + 272,
mq_timedsend = Linux + 273,
mq_timedreceive = Linux + 274,
mq_notify = Linux + 275,
mq_getsetattr = Linux + 276,
vserver = Linux + 277,
waitid = Linux + 278,
add_key = Linux + 280,
request_key = Linux + 281,
keyctl = Linux + 282,
set_thread_area = Linux + 283,
inotify_init = Linux + 284,
inotify_add_watch = Linux + 285,
inotify_rm_watch = Linux + 286,
migrate_pages = Linux + 287,
openat = Linux + 288,
mkdirat = Linux + 289,
mknodat = Linux + 290,
fchownat = Linux + 291,
futimesat = Linux + 292,
fstatat64 = Linux + 293,
unlinkat = Linux + 294,
renameat = Linux + 295,
linkat = Linux + 296,
symlinkat = Linux + 297,
readlinkat = Linux + 298,
fchmodat = Linux + 299,
faccessat = Linux + 300,
pselect6 = Linux + 301,
ppoll = Linux + 302,
unshare = Linux + 303,
splice = Linux + 304,
sync_file_range = Linux + 305,
tee = Linux + 306,
vmsplice = Linux + 307,
move_pages = Linux + 308,
set_robust_list = Linux + 309,
get_robust_list = Linux + 310,
kexec_load = Linux + 311,
getcpu = Linux + 312,
epoll_pwait = Linux + 313,
ioprio_set = Linux + 314,
ioprio_get = Linux + 315,
utimensat = Linux + 316,
signalfd = Linux + 317,
timerfd = Linux + 318,
eventfd = Linux + 319,
fallocate = Linux + 320,
timerfd_create = Linux + 321,
timerfd_gettime = Linux + 322,
timerfd_settime = Linux + 323,
signalfd4 = Linux + 324,
eventfd2 = Linux + 325,
epoll_create1 = Linux + 326,
dup3 = Linux + 327,
pipe2 = Linux + 328,
inotify_init1 = Linux + 329,
preadv = Linux + 330,
pwritev = Linux + 331,
rt_tgsigqueueinfo = Linux + 332,
perf_event_open = Linux + 333,
accept4 = Linux + 334,
recvmmsg = Linux + 335,
fanotify_init = Linux + 336,
fanotify_mark = Linux + 337,
prlimit64 = Linux + 338,
name_to_handle_at = Linux + 339,
open_by_handle_at = Linux + 340,
clock_adjtime = Linux + 341,
syncfs = Linux + 342,
sendmmsg = Linux + 343,
setns = Linux + 344,
process_vm_readv = Linux + 345,
process_vm_writev = Linux + 346,
kcmp = Linux + 347,
finit_module = Linux + 348,
sched_setattr = Linux + 349,
sched_getattr = Linux + 350,
renameat2 = Linux + 351,
seccomp = Linux + 352,
getrandom = Linux + 353,
memfd_create = Linux + 354,
bpf = Linux + 355,
execveat = Linux + 356,
userfaultfd = Linux + 357,
membarrier = Linux + 358,
mlock2 = Linux + 359,
copy_file_range = Linux + 360,
preadv2 = Linux + 361,
pwritev2 = Linux + 362,
pkey_mprotect = Linux + 363,
pkey_alloc = Linux + 364,
pkey_free = Linux + 365,
statx = Linux + 366,
rseq = Linux + 367,
io_pgetevents = Linux + 368,
semget = Linux + 393,
semctl = Linux + 394,
shmget = Linux + 395,
shmctl = Linux + 396,
shmat = Linux + 397,
shmdt = Linux + 398,
msgget = Linux + 399,
msgsnd = Linux + 400,
msgrcv = Linux + 401,
msgctl = Linux + 402,
clock_gettime64 = Linux + 403,
clock_settime64 = Linux + 404,
clock_adjtime64 = Linux + 405,
clock_getres_time64 = Linux + 406,
clock_nanosleep_time64 = Linux + 407,
timer_gettime64 = Linux + 408,
timer_settime64 = Linux + 409,
timerfd_gettime64 = Linux + 410,
timerfd_settime64 = Linux + 411,
utimensat_time64 = Linux + 412,
pselect6_time64 = Linux + 413,
ppoll_time64 = Linux + 414,
io_pgetevents_time64 = Linux + 416,
recvmmsg_time64 = Linux + 417,
mq_timedsend_time64 = Linux + 418,
mq_timedreceive_time64 = Linux + 419,
semtimedop_time64 = Linux + 420,
rt_sigtimedwait_time64 = Linux + 421,
futex_time64 = Linux + 422,
sched_rr_get_interval_time64 = Linux + 423,
pidfd_send_signal = Linux + 424,
io_uring_setup = Linux + 425,
io_uring_enter = Linux + 426,
io_uring_register = Linux + 427,
open_tree = Linux + 428,
move_mount = Linux + 429,
fsopen = Linux + 430,
fsconfig = Linux + 431,
fsmount = Linux + 432,
fspick = Linux + 433,
pidfd_open = Linux + 434,
clone3 = Linux + 435,
close_range = Linux + 436,
openat2 = Linux + 437,
pidfd_getfd = Linux + 438,
faccessat2 = Linux + 439,
process_madvise = Linux + 440,
_,
};
pub const O_CREAT = 0o0400;
pub const O_EXCL = 0o02000;
pub const O_NOCTTY = 0o04000;
pub const O_TRUNC = 0o01000;
pub const O_APPEND = 0o0010;
pub const O_NONBLOCK = 0o0200;
pub const O_DSYNC = 0o0020;
pub const O_SYNC = 0o040020;
pub const O_RSYNC = 0o040020;
pub const O_DIRECTORY = 0o0200000;
pub const O_NOFOLLOW = 0o0400000;
pub const O_CLOEXEC = 0o02000000;
pub const O_ASYNC = 0o010000;
pub const O_DIRECT = 0o0100000;
pub const O_LARGEFILE = 0o020000;
pub const O_NOATIME = 0o01000000;
pub const O_PATH = 0o010000000;
pub const O_TMPFILE = 0o020200000;
pub const O_NDELAY = O_NONBLOCK;
pub const F_DUPFD = 0;
pub const F_GETFD = 1;
pub const F_SETFD = 2;
pub const F_GETFL = 3;
pub const F_SETFL = 4;
pub const F_SETOWN = 24;
pub const F_GETOWN = 23;
pub const F_SETSIG = 10;
pub const F_GETSIG = 11;
pub const F_GETLK = 33;
pub const F_SETLK = 34;
pub const F_SETLKW = 35;
pub const F_RDLCK = 0;
pub const F_WRLCK = 1;
pub const F_UNLCK = 2;
pub const LOCK_SH = 1;
pub const LOCK_EX = 2;
pub const LOCK_UN = 8;
pub const LOCK_NB = 4;
pub const F_SETOWN_EX = 15;
pub const F_GETOWN_EX = 16;
pub const F_GETOWNER_UIDS = 17;
pub const MMAP2_UNIT = 4096;
pub const MAP_NORESERVE = 0x0400;
pub const MAP_GROWSDOWN = 0x1000;
pub const MAP_DENYWRITE = 0x2000;
pub const MAP_EXECUTABLE = 0x4000;
pub const MAP_LOCKED = 0x8000;
pub const MAP_32BIT = 0x40;
pub const SO_DEBUG = 1;
pub const SO_REUSEADDR = 0x0004;
pub const SO_KEEPALIVE = 0x0008;
pub const SO_DONTROUTE = 0x0010;
pub const SO_BROADCAST = 0x0020;
pub const SO_LINGER = 0x0080;
pub const SO_OOBINLINE = 0x0100;
pub const SO_REUSEPORT = 0x0200;
pub const SO_SNDBUF = 0x1001;
pub const SO_RCVBUF = 0x1002;
pub const SO_SNDLOWAT = 0x1003;
pub const SO_RCVLOWAT = 0x1004;
pub const SO_RCVTIMEO = 0x1006;
pub const SO_SNDTIMEO = 0x1005;
pub const SO_ERROR = 0x1007;
pub const SO_TYPE = 0x1008;
pub const SO_ACCEPTCONN = 0x1009;
pub const SO_PROTOCOL = 0x1028;
pub const SO_DOMAIN = 0x1029;
pub const SO_NO_CHECK = 11;
pub const SO_PRIORITY = 12;
pub const SO_BSDCOMPAT = 14;
pub const SO_PASSCRED = 17;
pub const SO_PEERCRED = 18;
pub const SO_PEERSEC = 30;
pub const SO_SNDBUFFORCE = 31;
pub const SO_RCVBUFFORCE = 33;
pub const VDSO_CGT_SYM = "__kernel_clock_gettime";
pub const VDSO_CGT_VER = "LINUX_2.6.39";
pub const Flock = extern struct {
l_type: i16,
l_whence: i16,
__pad0: [4]u8,
l_start: off_t,
l_len: off_t,
l_pid: pid_t,
__unused: [4]u8,
};
pub const blksize_t = i32;
pub const nlink_t = u32;
pub const time_t = i32;
pub const mode_t = u32;
pub const off_t = i64;
pub const ino_t = u64;
pub const dev_t = u64;
pub const blkcnt_t = i64;
// The `stat` definition used by the Linux kernel.
pub const kernel_stat = extern struct {
dev: u32,
__pad0: [3]u32, // Reserved for st_dev expansion
ino: ino_t,
mode: mode_t,
nlink: nlink_t,
uid: uid_t,
gid: gid_t,
rdev: u32,
__pad1: [3]u32,
size: off_t,
atim: timespec,
mtim: timespec,
ctim: timespec,
blksize: blksize_t,
__pad3: u32,
blocks: blkcnt_t,
__pad4: [14]usize,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
pub const libc_stat = extern struct {
dev: dev_t,
__pad0: [2]u32,
ino: ino_t,
mode: mode_t,
nlink: nlink_t,
uid: uid_t,
gid: gid_t,
rdev: dev_t,
__pad1: [2]u32,
size: off_t,
atim: timespec,
mtim: timespec,
ctim: timespec,
blksize: blksize_t,
__pad3: u32,
blocks: blkcnt_t,
__pad4: [14]u32,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
pub const timespec = extern struct {
tv_sec: isize,
tv_nsec: isize,
};
pub const timeval = extern struct {
tv_sec: isize,
tv_usec: isize,
};
pub const timezone = extern struct {
tz_minuteswest: i32,
tz_dsttime: i32,
};
pub const Elf_Symndx = u32; | lib/std/os/bits/linux/mips.zig |
const builtin = @import("builtin");
const std = @import("std");
// fmodq - floating modulo large, returns the remainder of division for f128 types
// Logic and flow heavily inspired by MUSL fmodl for 113 mantissa digits
pub fn fmodq(a: f128, b: f128) callconv(.C) f128 {
@setRuntimeSafety(builtin.is_test);
var amod = a;
var bmod = b;
const aPtr_u64 = @ptrCast([*]u64, &amod);
const bPtr_u64 = @ptrCast([*]u64, &bmod);
const aPtr_u16 = @ptrCast([*]u16, &amod);
const bPtr_u16 = @ptrCast([*]u16, &bmod);
const exp_and_sign_index = comptime switch (builtin.target.cpu.arch.endian()) {
.Little => 7,
.Big => 0,
};
const low_index = comptime switch (builtin.target.cpu.arch.endian()) {
.Little => 0,
.Big => 1,
};
const high_index = comptime switch (builtin.target.cpu.arch.endian()) {
.Little => 1,
.Big => 0,
};
const signA = aPtr_u16[exp_and_sign_index] & 0x8000;
var expA = @intCast(i32, (aPtr_u16[exp_and_sign_index] & 0x7fff));
var expB = bPtr_u16[exp_and_sign_index] & 0x7fff;
// There are 3 cases where the answer is undefined, check for:
// - fmodq(val, 0)
// - fmodq(val, NaN)
// - fmodq(inf, val)
// The sign on checked values does not matter.
// Doing (a * b) / (a * b) procudes undefined results
// because the three cases always produce undefined calculations:
// - 0 / 0
// - val * NaN
// - inf / inf
if (b == 0 or std.math.isNan(b) or expA == 0x7fff) {
return (a * b) / (a * b);
}
// Remove the sign from both
aPtr_u16[exp_and_sign_index] = @bitCast(u16, @intCast(i16, expA));
bPtr_u16[exp_and_sign_index] = @bitCast(u16, @intCast(i16, expB));
if (amod <= bmod) {
if (amod == bmod) {
return 0 * a;
}
return a;
}
if (expA == 0) {
amod *= 0x1p120;
expA = aPtr_u16[exp_and_sign_index] -% 120;
}
if (expB == 0) {
bmod *= 0x1p120;
expB = bPtr_u16[exp_and_sign_index] -% 120;
}
// OR in extra non-stored mantissa digit
var highA: u64 = (aPtr_u64[high_index] & (std.math.maxInt(u64) >> 16)) | 1 << 48;
var highB: u64 = (bPtr_u64[high_index] & (std.math.maxInt(u64) >> 16)) | 1 << 48;
var lowA: u64 = aPtr_u64[low_index];
var lowB: u64 = bPtr_u64[low_index];
while (expA > expB) : (expA -= 1) {
var high = highA -% highB;
var low = lowA -% lowB;
if (lowA < lowB) {
high = highA -% 1;
}
if (high >> 63 == 0) {
if ((high | low) == 0) {
return 0 * a;
}
highA = 2 *% high + (low >> 63);
lowA = 2 *% low;
} else {
highA = 2 *% highA + (lowA >> 63);
lowA = 2 *% lowA;
}
}
var high = highA -% highB;
var low = lowA -% lowB;
if (lowA < lowB) {
high -= 1;
}
if (high >> 63 == 0) {
if ((high | low) == 0) {
return 0 * a;
}
highA = high;
lowA = low;
}
while (highA >> 48 == 0) {
highA = 2 *% highA + (lowA >> 63);
lowA = 2 *% lowA;
expA = expA - 1;
}
// Overwrite the current amod with the values in highA and lowA
aPtr_u64[high_index] = highA;
aPtr_u64[low_index] = lowA;
// Combine the exponent with the sign, normalize if happend to be denormalized
if (expA <= 0) {
aPtr_u16[exp_and_sign_index] = @truncate(u16, @bitCast(u32, (expA +% 120))) | signA;
amod *= 0x1p-120;
} else {
aPtr_u16[exp_and_sign_index] = @truncate(u16, @bitCast(u32, expA)) | signA;
}
return amod;
}
test {
_ = @import("floatfmodq_test.zig");
} | lib/std/special/compiler_rt/floatfmodq.zig |
const std = @import("std");
const math = std.math;
const meta = std.meta;
const Optimized = std.builtin.FloatMode.Optimized;
// PRIVATE UTILITIES:
// helper function for constants to work with both vectors and scalars
inline fn splat(comptime t: type, val: anytype) t {
@setFloatMode(Optimized);
comptime if (@typeInfo(t) == .Vector) {
return @splat(@typeInfo(t).Vector.len, @as(@typeInfo(t).Vector.child, val));
} else {
return val;
};
}
// WARNING: might not be applicable to all functions
// d/dx σ(x) = σ(x) * (1 − σ(x))
// z = σ(x)
fn usualDerivZ(z: anytype) @TypeOf(z) {
@setFloatMode(Optimized);
const t = @TypeOf(z);
return z * (splat(t, 1) - z);
}
// PUBLIC UTILITIES:
// // chooses available derivation function if both x and y is known
// inline pub deriv_xy(fn_struct : type, x : anytype, y : anytype) @TypeOf(x) {
// const ti = @typeInfo(fn_struct);
// @compileError("todo: implement!");
// }
// FUNCTIONS:
// binary
pub const bin = struct {
pub fn f(x: anytype) @TypeOf(x) {
@setFloatMode(Optimized);
return math.clamped(x, 0, 1);
}
pub fn deriv(x: anytype) @TypeOf(x) {
@setFloatMode(Optimized);
@compileError("This function is not continuously differentiable!");
}
};
pub const sigmoid = struct {
// σ(x) = 1 / (1 + e^−x)
pub fn f(x: anytype) @TypeOf(x) {
@setFloatMode(Optimized);
const t = @TypeOf(x);
return splat(t, 1) / (splat(t, 1) + @exp(-x));
}
// (e^x) / (e^x + 1)^2
pub fn deriv(x: anytype) @TypeOf(x) {
@setFloatMode(Optimized);
const t = @TypeOf(x);
const exp = @exp(-x);
const exp_p1 = (splat(t, 1) + exp);
return exp / (exp_p1 * exp_p1);
}
// https://math.stackexchange.com/questions/78575/derivative-of-sigmoid-function-sigma-x-frac11e-x/1225116#1225116
// d/dx σ(x) = σ(x) * (1 − σ(x))
// z = σ(x)
pub const derivZ = usualDerivZ;
};
pub const softmax = struct {
const Self = @This();
// Unstable:
// σ(x) = e^x / Σ(e^x)
// pub fn f(x: anytype) @TypeOf(x) {
// @setFloatMode(Optimized);
// const t = @TypeOf(x);
// comptime if (@typeInfo(t) != .Vector) @compileError("softmax accepts only Vectors");
// const exp = @exp(x);
// const exp_sum = @reduce(.Add, exp);
// return exp / splat(t, exp_sum);
// }
pub fn f(x: anytype) @TypeOf(x) {
const t = @TypeOf(x);
const e = @exp(x - splat(t, @reduce(.Max, x)));
return e / splat(t, @reduce(.Add, e));
}
// from: https://themaverickmeerkat.com/2019-10-23-Softmax/
// 𝝏σ(x) / 𝝏x = -σ(x) * σ(y)
// z = σ(x)
pub const derivZ = usualDerivZ;
// from: https://themaverickmeerkat.com/2019-10-23-Softmax/
// 𝝏σ(x) / 𝝏y = -σ(x) * σ(y)
// z = σ(x)
pub fn derivZY(z: anytype, y: anytype) @TypeOf(z) {
@setFloatMode(Optimized);
return -z * Self.f(y);
}
};
pub const relu = struct {
pub fn f(x: anytype) @TypeOf(x) {
@setFloatMode(Optimized);
return @maximum(splat(@TypeOf(x), 0), x);
}
// =1 when >0 or 0 otherwise
pub fn deriv(x: anytype) @TypeOf(x) {
@setFloatMode(Optimized);
const t = @TypeOf(x);
return @maximum(splat(t, 0), @minimum(splat(t, 1), @ceil(x)));
}
pub const derivZ = deriv; // special case for relu - not applicable to other fn
};
pub const relu_leaky = struct {
const coef = 0.1;
pub fn f(x: anytype) @TypeOf(x) {
@setFloatMode(Optimized);
return @maximum(x, x * splat(@TypeOf(x), coef));
}
// =1 when >0 or 0 otherwise
pub fn deriv(x: anytype) @TypeOf(x) {
@setFloatMode(Optimized);
const t = @TypeOf(x);
return @maximum(splat(t, coef), @minimum(splat(t, 1), @ceil(x)));
}
pub const derivZ = deriv; // special case for relu - not applicable to other fn
};
pub const relu6 = struct {
const max = 6;
pub fn f(x: anytype) @TypeOf(x) {
@setFloatMode(Optimized);
const t = @TypeOf(x);
return @maximum(splat(t, 0), @minimum(x, splat(t, max)));
}
pub fn deriv(x: anytype) @TypeOf(x) {
@setFloatMode(Optimized);
const t = @TypeOf(x);
const div = 1.0 / @as(comptime_float, max);
const nc = @ceil(splat(t, div) * x);
const cut = @minimum(splat(t, 1), nc) - @maximum(splat(t, 0), nc);
return @maximum(splat(t, 0), cut);
}
pub const derivZ = deriv; // special case for relu - not applicable to other fn
};
pub const none = struct {
pub fn f(x: anytype) @TypeOf(x) {
return x;
}
pub fn deriv(x: anytype) @TypeOf(x) {
return splat(@TypeOf(x), 1);
}
pub fn derivZ(z: anytype) @TypeOf(z) {
return splat(@TypeOf(z), 1);
}
};
// Error funcs
pub const absErr = struct {
// answer = correct answer, predicted = output from nnet
pub fn f(answer: anytype, predicted: anytype) @TypeOf(answer) {
@setFloatMode(Optimized);
return (answer - predicted);
}
pub fn deriv(answer: anytype, predicted: anytype) @TypeOf(answer) {
@setFloatMode(Optimized);
return (answer - predicted);
}
};
pub const squaredErr = struct {
// answer = correct answer, predicted = output from nnet
pub fn f(answer: anytype, predicted: anytype) @TypeOf(answer) {
@setFloatMode(Optimized);
return (answer - predicted) * (answer - predicted);
}
pub fn deriv(answer: anytype, predicted: anytype) @TypeOf(answer) {
@setFloatMode(Optimized);
return splat(@TypeOf(answer), 2) * (answer - predicted);
}
};
pub const logLoss = struct {
// answer = correct answer, predicted = output from nnet
pub fn f(answer: anytype, predicted: anytype) @TypeOf(answer) {
@setFloatMode(Optimized);
const t = @TypeOf(answer);
const ti = @typeInfo(t);
const p = @minimum(@maximum(predicted, splat(t, 0.00001)), splat(t, 0.99999));
const one = @log(p) * answer;
const zero = @log(splat(t, 1) - p) * (splat(t, 1) - answer);
const avg = splat(t, 1.0 / @intToFloat(ti.Vector.child, ti.Vector.len));
return (one + zero) * -avg;
}
pub fn deriv(answer: anytype, predicted: anytype) @TypeOf(answer) {
@setFloatMode(Optimized);
const t = @TypeOf(answer);
const ti = @typeInfo(t);
const p = @minimum(@maximum(predicted, splat(t, 0.00001)), splat(t, 0.99999));
const one = (splat(t, 1) / p) * answer;
const zero = (splat(t, -1) / (splat(t, 1) - p)) * (splat(t, 1) - answer);
const avg = splat(t, 1.0 / @intToFloat(ti.Vector.child, ti.Vector.len));
return (one + zero) * avg;
}
//pub const derivZ = usualDerivZ;
}; | src/fn_deriv.zig |
pub const COMPOSITIONOBJECT_READ = @as(i32, 1);
pub const COMPOSITIONOBJECT_WRITE = @as(i32, 2);
pub const DCOMPOSITION_MAX_WAITFORCOMPOSITORCLOCK_OBJECTS = @as(u32, 32);
pub const COMPOSITION_STATS_MAX_TARGETS = @as(u32, 256);
//--------------------------------------------------------------------------------
// Section: Types (58)
//--------------------------------------------------------------------------------
pub const DCOMPOSITION_BITMAP_INTERPOLATION_MODE = enum(i32) {
NEAREST_NEIGHBOR = 0,
LINEAR = 1,
INHERIT = -1,
};
pub const DCOMPOSITION_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR = DCOMPOSITION_BITMAP_INTERPOLATION_MODE.NEAREST_NEIGHBOR;
pub const DCOMPOSITION_BITMAP_INTERPOLATION_MODE_LINEAR = DCOMPOSITION_BITMAP_INTERPOLATION_MODE.LINEAR;
pub const DCOMPOSITION_BITMAP_INTERPOLATION_MODE_INHERIT = DCOMPOSITION_BITMAP_INTERPOLATION_MODE.INHERIT;
pub const DCOMPOSITION_BORDER_MODE = enum(i32) {
SOFT = 0,
HARD = 1,
INHERIT = -1,
};
pub const DCOMPOSITION_BORDER_MODE_SOFT = DCOMPOSITION_BORDER_MODE.SOFT;
pub const DCOMPOSITION_BORDER_MODE_HARD = DCOMPOSITION_BORDER_MODE.HARD;
pub const DCOMPOSITION_BORDER_MODE_INHERIT = DCOMPOSITION_BORDER_MODE.INHERIT;
pub const DCOMPOSITION_COMPOSITE_MODE = enum(i32) {
SOURCE_OVER = 0,
DESTINATION_INVERT = 1,
MIN_BLEND = 2,
INHERIT = -1,
};
pub const DCOMPOSITION_COMPOSITE_MODE_SOURCE_OVER = DCOMPOSITION_COMPOSITE_MODE.SOURCE_OVER;
pub const DCOMPOSITION_COMPOSITE_MODE_DESTINATION_INVERT = DCOMPOSITION_COMPOSITE_MODE.DESTINATION_INVERT;
pub const DCOMPOSITION_COMPOSITE_MODE_MIN_BLEND = DCOMPOSITION_COMPOSITE_MODE.MIN_BLEND;
pub const DCOMPOSITION_COMPOSITE_MODE_INHERIT = DCOMPOSITION_COMPOSITE_MODE.INHERIT;
pub const DCOMPOSITION_BACKFACE_VISIBILITY = enum(i32) {
VISIBLE = 0,
HIDDEN = 1,
INHERIT = -1,
};
pub const DCOMPOSITION_BACKFACE_VISIBILITY_VISIBLE = DCOMPOSITION_BACKFACE_VISIBILITY.VISIBLE;
pub const DCOMPOSITION_BACKFACE_VISIBILITY_HIDDEN = DCOMPOSITION_BACKFACE_VISIBILITY.HIDDEN;
pub const DCOMPOSITION_BACKFACE_VISIBILITY_INHERIT = DCOMPOSITION_BACKFACE_VISIBILITY.INHERIT;
pub const DCOMPOSITION_OPACITY_MODE = enum(i32) {
LAYER = 0,
MULTIPLY = 1,
INHERIT = -1,
};
pub const DCOMPOSITION_OPACITY_MODE_LAYER = DCOMPOSITION_OPACITY_MODE.LAYER;
pub const DCOMPOSITION_OPACITY_MODE_MULTIPLY = DCOMPOSITION_OPACITY_MODE.MULTIPLY;
pub const DCOMPOSITION_OPACITY_MODE_INHERIT = DCOMPOSITION_OPACITY_MODE.INHERIT;
pub const DCOMPOSITION_DEPTH_MODE = enum(i32) {
TREE = 0,
SPATIAL = 1,
SORTED = 3,
INHERIT = -1,
};
pub const DCOMPOSITION_DEPTH_MODE_TREE = DCOMPOSITION_DEPTH_MODE.TREE;
pub const DCOMPOSITION_DEPTH_MODE_SPATIAL = DCOMPOSITION_DEPTH_MODE.SPATIAL;
pub const DCOMPOSITION_DEPTH_MODE_SORTED = DCOMPOSITION_DEPTH_MODE.SORTED;
pub const DCOMPOSITION_DEPTH_MODE_INHERIT = DCOMPOSITION_DEPTH_MODE.INHERIT;
pub const DCOMPOSITION_FRAME_STATISTICS = extern struct {
lastFrameTime: LARGE_INTEGER,
currentCompositionRate: DXGI_RATIONAL,
currentTime: LARGE_INTEGER,
timeFrequency: LARGE_INTEGER,
nextEstimatedFrameTime: LARGE_INTEGER,
};
pub const COMPOSITION_FRAME_ID_TYPE = enum(i32) {
REATED = 0,
ONFIRMED = 1,
OMPLETED = 2,
};
pub const COMPOSITION_FRAME_ID_CREATED = COMPOSITION_FRAME_ID_TYPE.REATED;
pub const COMPOSITION_FRAME_ID_CONFIRMED = COMPOSITION_FRAME_ID_TYPE.ONFIRMED;
pub const COMPOSITION_FRAME_ID_COMPLETED = COMPOSITION_FRAME_ID_TYPE.OMPLETED;
pub const COMPOSITION_FRAME_STATS = extern struct {
startTime: u64,
targetTime: u64,
framePeriod: u64,
};
pub const COMPOSITION_TARGET_ID = extern struct {
displayAdapterLuid: LUID,
renderAdapterLuid: LUID,
vidPnSourceId: u32,
vidPnTargetId: u32,
uniqueId: u32,
};
pub const COMPOSITION_STATS = extern struct {
presentCount: u32,
refreshCount: u32,
virtualRefreshCount: u32,
time: u64,
};
pub const COMPOSITION_TARGET_STATS = extern struct {
outstandingPresents: u32,
presentTime: u64,
vblankDuration: u64,
presentedStats: COMPOSITION_STATS,
completedStats: COMPOSITION_STATS,
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionAnimation_Value = Guid.initString("cbfd91d9-51b2-45e4-b3de-d19ccfb863c5");
pub const IID_IDCompositionAnimation = &IID_IDCompositionAnimation_Value;
pub const IDCompositionAnimation = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Reset: fn(
self: *const IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAbsoluteBeginTime: fn(
self: *const IDCompositionAnimation,
beginTime: LARGE_INTEGER,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddCubic: fn(
self: *const IDCompositionAnimation,
beginOffset: f64,
constantCoefficient: f32,
linearCoefficient: f32,
quadraticCoefficient: f32,
cubicCoefficient: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddSinusoidal: fn(
self: *const IDCompositionAnimation,
beginOffset: f64,
bias: f32,
amplitude: f32,
frequency: f32,
phase: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddRepeat: fn(
self: *const IDCompositionAnimation,
beginOffset: f64,
durationToRepeat: f64,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
End: fn(
self: *const IDCompositionAnimation,
endOffset: f64,
endValue: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAnimation_Reset(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAnimation.VTable, self.vtable).Reset(@ptrCast(*const IDCompositionAnimation, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAnimation_SetAbsoluteBeginTime(self: *const T, beginTime: LARGE_INTEGER) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAnimation.VTable, self.vtable).SetAbsoluteBeginTime(@ptrCast(*const IDCompositionAnimation, self), beginTime);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAnimation_AddCubic(self: *const T, beginOffset: f64, constantCoefficient: f32, linearCoefficient: f32, quadraticCoefficient: f32, cubicCoefficient: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAnimation.VTable, self.vtable).AddCubic(@ptrCast(*const IDCompositionAnimation, self), beginOffset, constantCoefficient, linearCoefficient, quadraticCoefficient, cubicCoefficient);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAnimation_AddSinusoidal(self: *const T, beginOffset: f64, bias: f32, amplitude: f32, frequency: f32, phase: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAnimation.VTable, self.vtable).AddSinusoidal(@ptrCast(*const IDCompositionAnimation, self), beginOffset, bias, amplitude, frequency, phase);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAnimation_AddRepeat(self: *const T, beginOffset: f64, durationToRepeat: f64) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAnimation.VTable, self.vtable).AddRepeat(@ptrCast(*const IDCompositionAnimation, self), beginOffset, durationToRepeat);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAnimation_End(self: *const T, endOffset: f64, endValue: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAnimation.VTable, self.vtable).End(@ptrCast(*const IDCompositionAnimation, self), endOffset, endValue);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionDevice_Value = Guid.initString("c37ea93a-e7aa-450d-b16f-9746cb0407f3");
pub const IID_IDCompositionDevice = &IID_IDCompositionDevice_Value;
pub const IDCompositionDevice = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Commit: fn(
self: *const IDCompositionDevice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WaitForCommitCompletion: fn(
self: *const IDCompositionDevice,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFrameStatistics: fn(
self: *const IDCompositionDevice,
statistics: ?*DCOMPOSITION_FRAME_STATISTICS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTargetForHwnd: fn(
self: *const IDCompositionDevice,
hwnd: ?HWND,
topmost: BOOL,
target: ?*?*IDCompositionTarget,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateVisual: fn(
self: *const IDCompositionDevice,
visual: ?*?*IDCompositionVisual,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSurface: fn(
self: *const IDCompositionDevice,
width: u32,
height: u32,
pixelFormat: DXGI_FORMAT,
alphaMode: DXGI_ALPHA_MODE,
surface: ?*?*IDCompositionSurface,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateVirtualSurface: fn(
self: *const IDCompositionDevice,
initialWidth: u32,
initialHeight: u32,
pixelFormat: DXGI_FORMAT,
alphaMode: DXGI_ALPHA_MODE,
virtualSurface: ?*?*IDCompositionVirtualSurface,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSurfaceFromHandle: fn(
self: *const IDCompositionDevice,
handle: ?HANDLE,
surface: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSurfaceFromHwnd: fn(
self: *const IDCompositionDevice,
hwnd: ?HWND,
surface: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTranslateTransform: fn(
self: *const IDCompositionDevice,
translateTransform: ?*?*IDCompositionTranslateTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateScaleTransform: fn(
self: *const IDCompositionDevice,
scaleTransform: ?*?*IDCompositionScaleTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRotateTransform: fn(
self: *const IDCompositionDevice,
rotateTransform: ?*?*IDCompositionRotateTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSkewTransform: fn(
self: *const IDCompositionDevice,
skewTransform: ?*?*IDCompositionSkewTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateMatrixTransform: fn(
self: *const IDCompositionDevice,
matrixTransform: ?*?*IDCompositionMatrixTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTransformGroup: fn(
self: *const IDCompositionDevice,
transforms: [*]?*IDCompositionTransform,
elements: u32,
transformGroup: ?*?*IDCompositionTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTranslateTransform3D: fn(
self: *const IDCompositionDevice,
translateTransform3D: ?*?*IDCompositionTranslateTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateScaleTransform3D: fn(
self: *const IDCompositionDevice,
scaleTransform3D: ?*?*IDCompositionScaleTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRotateTransform3D: fn(
self: *const IDCompositionDevice,
rotateTransform3D: ?*?*IDCompositionRotateTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateMatrixTransform3D: fn(
self: *const IDCompositionDevice,
matrixTransform3D: ?*?*IDCompositionMatrixTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTransform3DGroup: fn(
self: *const IDCompositionDevice,
transforms3D: [*]?*IDCompositionTransform3D,
elements: u32,
transform3DGroup: ?*?*IDCompositionTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateEffectGroup: fn(
self: *const IDCompositionDevice,
effectGroup: ?*?*IDCompositionEffectGroup,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRectangleClip: fn(
self: *const IDCompositionDevice,
clip: ?*?*IDCompositionRectangleClip,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateAnimation: fn(
self: *const IDCompositionDevice,
animation: ?*?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CheckDeviceState: fn(
self: *const IDCompositionDevice,
pfValid: ?*BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_Commit(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).Commit(@ptrCast(*const IDCompositionDevice, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_WaitForCommitCompletion(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).WaitForCommitCompletion(@ptrCast(*const IDCompositionDevice, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_GetFrameStatistics(self: *const T, statistics: ?*DCOMPOSITION_FRAME_STATISTICS) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).GetFrameStatistics(@ptrCast(*const IDCompositionDevice, self), statistics);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateTargetForHwnd(self: *const T, hwnd: ?HWND, topmost: BOOL, target: ?*?*IDCompositionTarget) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateTargetForHwnd(@ptrCast(*const IDCompositionDevice, self), hwnd, topmost, target);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateVisual(self: *const T, visual: ?*?*IDCompositionVisual) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateVisual(@ptrCast(*const IDCompositionDevice, self), visual);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateSurface(self: *const T, width: u32, height: u32, pixelFormat: DXGI_FORMAT, alphaMode: DXGI_ALPHA_MODE, surface: ?*?*IDCompositionSurface) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateSurface(@ptrCast(*const IDCompositionDevice, self), width, height, pixelFormat, alphaMode, surface);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateVirtualSurface(self: *const T, initialWidth: u32, initialHeight: u32, pixelFormat: DXGI_FORMAT, alphaMode: DXGI_ALPHA_MODE, virtualSurface: ?*?*IDCompositionVirtualSurface) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateVirtualSurface(@ptrCast(*const IDCompositionDevice, self), initialWidth, initialHeight, pixelFormat, alphaMode, virtualSurface);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateSurfaceFromHandle(self: *const T, handle: ?HANDLE, surface: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateSurfaceFromHandle(@ptrCast(*const IDCompositionDevice, self), handle, surface);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateSurfaceFromHwnd(self: *const T, hwnd: ?HWND, surface: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateSurfaceFromHwnd(@ptrCast(*const IDCompositionDevice, self), hwnd, surface);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateTranslateTransform(self: *const T, translateTransform: ?*?*IDCompositionTranslateTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateTranslateTransform(@ptrCast(*const IDCompositionDevice, self), translateTransform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateScaleTransform(self: *const T, scaleTransform: ?*?*IDCompositionScaleTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateScaleTransform(@ptrCast(*const IDCompositionDevice, self), scaleTransform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateRotateTransform(self: *const T, rotateTransform: ?*?*IDCompositionRotateTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateRotateTransform(@ptrCast(*const IDCompositionDevice, self), rotateTransform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateSkewTransform(self: *const T, skewTransform: ?*?*IDCompositionSkewTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateSkewTransform(@ptrCast(*const IDCompositionDevice, self), skewTransform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateMatrixTransform(self: *const T, matrixTransform: ?*?*IDCompositionMatrixTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateMatrixTransform(@ptrCast(*const IDCompositionDevice, self), matrixTransform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateTransformGroup(self: *const T, transforms: [*]?*IDCompositionTransform, elements: u32, transformGroup: ?*?*IDCompositionTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateTransformGroup(@ptrCast(*const IDCompositionDevice, self), transforms, elements, transformGroup);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateTranslateTransform3D(self: *const T, translateTransform3D: ?*?*IDCompositionTranslateTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateTranslateTransform3D(@ptrCast(*const IDCompositionDevice, self), translateTransform3D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateScaleTransform3D(self: *const T, scaleTransform3D: ?*?*IDCompositionScaleTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateScaleTransform3D(@ptrCast(*const IDCompositionDevice, self), scaleTransform3D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateRotateTransform3D(self: *const T, rotateTransform3D: ?*?*IDCompositionRotateTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateRotateTransform3D(@ptrCast(*const IDCompositionDevice, self), rotateTransform3D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateMatrixTransform3D(self: *const T, matrixTransform3D: ?*?*IDCompositionMatrixTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateMatrixTransform3D(@ptrCast(*const IDCompositionDevice, self), matrixTransform3D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateTransform3DGroup(self: *const T, transforms3D: [*]?*IDCompositionTransform3D, elements: u32, transform3DGroup: ?*?*IDCompositionTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateTransform3DGroup(@ptrCast(*const IDCompositionDevice, self), transforms3D, elements, transform3DGroup);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateEffectGroup(self: *const T, effectGroup: ?*?*IDCompositionEffectGroup) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateEffectGroup(@ptrCast(*const IDCompositionDevice, self), effectGroup);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateRectangleClip(self: *const T, clip: ?*?*IDCompositionRectangleClip) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateRectangleClip(@ptrCast(*const IDCompositionDevice, self), clip);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CreateAnimation(self: *const T, animation: ?*?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CreateAnimation(@ptrCast(*const IDCompositionDevice, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice_CheckDeviceState(self: *const T, pfValid: ?*BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice.VTable, self.vtable).CheckDeviceState(@ptrCast(*const IDCompositionDevice, self), pfValid);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionTarget_Value = Guid.initString("eacdd04c-117e-4e17-88f4-d1b12b0e3d89");
pub const IID_IDCompositionTarget = &IID_IDCompositionTarget_Value;
pub const IDCompositionTarget = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetRoot: fn(
self: *const IDCompositionTarget,
visual: ?*IDCompositionVisual,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTarget_SetRoot(self: *const T, visual: ?*IDCompositionVisual) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTarget.VTable, self.vtable).SetRoot(@ptrCast(*const IDCompositionTarget, self), visual);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionVisual_Value = Guid.initString("4d93059d-097b-4651-9a60-f0f25116e2f3");
pub const IID_IDCompositionVisual = &IID_IDCompositionVisual_Value;
pub const IDCompositionVisual = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
SetOffsetX: fn(
self: *const IDCompositionVisual,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetX1: fn(
self: *const IDCompositionVisual,
offsetX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetY: fn(
self: *const IDCompositionVisual,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetY1: fn(
self: *const IDCompositionVisual,
offsetY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTransform: fn(
self: *const IDCompositionVisual,
transform: ?*IDCompositionTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTransform1: fn(
self: *const IDCompositionVisual,
matrix: ?*const D2D_MATRIX_3X2_F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTransformParent: fn(
self: *const IDCompositionVisual,
visual: ?*IDCompositionVisual,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetEffect: fn(
self: *const IDCompositionVisual,
effect: ?*IDCompositionEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBitmapInterpolationMode: fn(
self: *const IDCompositionVisual,
interpolationMode: DCOMPOSITION_BITMAP_INTERPOLATION_MODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBorderMode: fn(
self: *const IDCompositionVisual,
borderMode: DCOMPOSITION_BORDER_MODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetClip: fn(
self: *const IDCompositionVisual,
clip: ?*IDCompositionClip,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetClip1: fn(
self: *const IDCompositionVisual,
rect: ?*const D2D_RECT_F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetContent: fn(
self: *const IDCompositionVisual,
content: ?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddVisual: fn(
self: *const IDCompositionVisual,
visual: ?*IDCompositionVisual,
insertAbove: BOOL,
referenceVisual: ?*IDCompositionVisual,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemoveVisual: fn(
self: *const IDCompositionVisual,
visual: ?*IDCompositionVisual,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemoveAllVisuals: fn(
self: *const IDCompositionVisual,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCompositeMode: fn(
self: *const IDCompositionVisual,
compositeMode: DCOMPOSITION_COMPOSITE_MODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetOffsetX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetOffsetX(@ptrCast(*const IDCompositionVisual, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetOffsetX1(self: *const T, offsetX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetOffsetX(@ptrCast(*const IDCompositionVisual, self), offsetX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetOffsetY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetOffsetY(@ptrCast(*const IDCompositionVisual, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetOffsetY1(self: *const T, offsetY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetOffsetY(@ptrCast(*const IDCompositionVisual, self), offsetY);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetTransform(self: *const T, transform: ?*IDCompositionTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetTransform(@ptrCast(*const IDCompositionVisual, self), transform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetTransform1(self: *const T, matrix: ?*const D2D_MATRIX_3X2_F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetTransform(@ptrCast(*const IDCompositionVisual, self), matrix);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetTransformParent(self: *const T, visual: ?*IDCompositionVisual) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetTransformParent(@ptrCast(*const IDCompositionVisual, self), visual);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetEffect(self: *const T, effect: ?*IDCompositionEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetEffect(@ptrCast(*const IDCompositionVisual, self), effect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetBitmapInterpolationMode(self: *const T, interpolationMode: DCOMPOSITION_BITMAP_INTERPOLATION_MODE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetBitmapInterpolationMode(@ptrCast(*const IDCompositionVisual, self), interpolationMode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetBorderMode(self: *const T, borderMode: DCOMPOSITION_BORDER_MODE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetBorderMode(@ptrCast(*const IDCompositionVisual, self), borderMode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetClip(self: *const T, clip: ?*IDCompositionClip) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetClip(@ptrCast(*const IDCompositionVisual, self), clip);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetClip1(self: *const T, rect: ?*const D2D_RECT_F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetClip(@ptrCast(*const IDCompositionVisual, self), rect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetContent(self: *const T, content: ?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetContent(@ptrCast(*const IDCompositionVisual, self), content);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_AddVisual(self: *const T, visual: ?*IDCompositionVisual, insertAbove: BOOL, referenceVisual: ?*IDCompositionVisual) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).AddVisual(@ptrCast(*const IDCompositionVisual, self), visual, insertAbove, referenceVisual);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_RemoveVisual(self: *const T, visual: ?*IDCompositionVisual) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).RemoveVisual(@ptrCast(*const IDCompositionVisual, self), visual);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_RemoveAllVisuals(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).RemoveAllVisuals(@ptrCast(*const IDCompositionVisual, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual_SetCompositeMode(self: *const T, compositeMode: DCOMPOSITION_COMPOSITE_MODE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual.VTable, self.vtable).SetCompositeMode(@ptrCast(*const IDCompositionVisual, self), compositeMode);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionEffect_Value = Guid.initString("ec81b08f-bfcb-4e8d-b193-a915587999e8");
pub const IID_IDCompositionEffect = &IID_IDCompositionEffect_Value;
pub const IDCompositionEffect = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionTransform3D_Value = Guid.initString("71185722-246b-41f2-aad1-0443f7f4bfc2");
pub const IID_IDCompositionTransform3D = &IID_IDCompositionTransform3D_Value;
pub const IDCompositionTransform3D = extern struct {
pub const VTable = extern struct {
base: IDCompositionEffect.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionEffect.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionTransform_Value = Guid.initString("fd55faa7-37e0-4c20-95d2-9be45bc33f55");
pub const IID_IDCompositionTransform = &IID_IDCompositionTransform_Value;
pub const IDCompositionTransform = extern struct {
pub const VTable = extern struct {
base: IDCompositionTransform3D.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionTransform3D.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionTranslateTransform_Value = Guid.initString("06791122-c6f0-417d-8323-269e987f5954");
pub const IID_IDCompositionTranslateTransform = &IID_IDCompositionTranslateTransform_Value;
pub const IDCompositionTranslateTransform = extern struct {
pub const VTable = extern struct {
base: IDCompositionTransform.VTable,
SetOffsetX: fn(
self: *const IDCompositionTranslateTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetX1: fn(
self: *const IDCompositionTranslateTransform,
offsetX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetY: fn(
self: *const IDCompositionTranslateTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetY1: fn(
self: *const IDCompositionTranslateTransform,
offsetY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionTransform.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTranslateTransform_SetOffsetX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTranslateTransform.VTable, self.vtable).SetOffsetX(@ptrCast(*const IDCompositionTranslateTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTranslateTransform_SetOffsetX1(self: *const T, offsetX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTranslateTransform.VTable, self.vtable).SetOffsetX(@ptrCast(*const IDCompositionTranslateTransform, self), offsetX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTranslateTransform_SetOffsetY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTranslateTransform.VTable, self.vtable).SetOffsetY(@ptrCast(*const IDCompositionTranslateTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTranslateTransform_SetOffsetY1(self: *const T, offsetY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTranslateTransform.VTable, self.vtable).SetOffsetY(@ptrCast(*const IDCompositionTranslateTransform, self), offsetY);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionScaleTransform_Value = Guid.initString("71fde914-40ef-45ef-bd51-68b037c339f9");
pub const IID_IDCompositionScaleTransform = &IID_IDCompositionScaleTransform_Value;
pub const IDCompositionScaleTransform = extern struct {
pub const VTable = extern struct {
base: IDCompositionTransform.VTable,
SetScaleX: fn(
self: *const IDCompositionScaleTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetScaleX1: fn(
self: *const IDCompositionScaleTransform,
scaleX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetScaleY: fn(
self: *const IDCompositionScaleTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetScaleY1: fn(
self: *const IDCompositionScaleTransform,
scaleY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterX: fn(
self: *const IDCompositionScaleTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterX1: fn(
self: *const IDCompositionScaleTransform,
centerX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterY: fn(
self: *const IDCompositionScaleTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterY1: fn(
self: *const IDCompositionScaleTransform,
centerY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionTransform.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform_SetScaleX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform.VTable, self.vtable).SetScaleX(@ptrCast(*const IDCompositionScaleTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform_SetScaleX1(self: *const T, scaleX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform.VTable, self.vtable).SetScaleX(@ptrCast(*const IDCompositionScaleTransform, self), scaleX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform_SetScaleY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform.VTable, self.vtable).SetScaleY(@ptrCast(*const IDCompositionScaleTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform_SetScaleY1(self: *const T, scaleY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform.VTable, self.vtable).SetScaleY(@ptrCast(*const IDCompositionScaleTransform, self), scaleY);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform_SetCenterX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform.VTable, self.vtable).SetCenterX(@ptrCast(*const IDCompositionScaleTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform_SetCenterX1(self: *const T, centerX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform.VTable, self.vtable).SetCenterX(@ptrCast(*const IDCompositionScaleTransform, self), centerX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform_SetCenterY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform.VTable, self.vtable).SetCenterY(@ptrCast(*const IDCompositionScaleTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform_SetCenterY1(self: *const T, centerY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform.VTable, self.vtable).SetCenterY(@ptrCast(*const IDCompositionScaleTransform, self), centerY);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionRotateTransform_Value = Guid.initString("641ed83c-ae96-46c5-90dc-32774cc5c6d5");
pub const IID_IDCompositionRotateTransform = &IID_IDCompositionRotateTransform_Value;
pub const IDCompositionRotateTransform = extern struct {
pub const VTable = extern struct {
base: IDCompositionTransform.VTable,
SetAngle: fn(
self: *const IDCompositionRotateTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAngle1: fn(
self: *const IDCompositionRotateTransform,
angle: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterX: fn(
self: *const IDCompositionRotateTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterX1: fn(
self: *const IDCompositionRotateTransform,
centerX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterY: fn(
self: *const IDCompositionRotateTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterY1: fn(
self: *const IDCompositionRotateTransform,
centerY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionTransform.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform_SetAngle(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform.VTable, self.vtable).SetAngle(@ptrCast(*const IDCompositionRotateTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform_SetAngle1(self: *const T, angle: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform.VTable, self.vtable).SetAngle(@ptrCast(*const IDCompositionRotateTransform, self), angle);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform_SetCenterX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform.VTable, self.vtable).SetCenterX(@ptrCast(*const IDCompositionRotateTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform_SetCenterX1(self: *const T, centerX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform.VTable, self.vtable).SetCenterX(@ptrCast(*const IDCompositionRotateTransform, self), centerX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform_SetCenterY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform.VTable, self.vtable).SetCenterY(@ptrCast(*const IDCompositionRotateTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform_SetCenterY1(self: *const T, centerY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform.VTable, self.vtable).SetCenterY(@ptrCast(*const IDCompositionRotateTransform, self), centerY);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionSkewTransform_Value = Guid.initString("e57aa735-dcdb-4c72-9c61-0591f58889ee");
pub const IID_IDCompositionSkewTransform = &IID_IDCompositionSkewTransform_Value;
pub const IDCompositionSkewTransform = extern struct {
pub const VTable = extern struct {
base: IDCompositionTransform.VTable,
SetAngleX: fn(
self: *const IDCompositionSkewTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAngleX1: fn(
self: *const IDCompositionSkewTransform,
angleX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAngleY: fn(
self: *const IDCompositionSkewTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAngleY1: fn(
self: *const IDCompositionSkewTransform,
angleY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterX: fn(
self: *const IDCompositionSkewTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterX1: fn(
self: *const IDCompositionSkewTransform,
centerX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterY: fn(
self: *const IDCompositionSkewTransform,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterY1: fn(
self: *const IDCompositionSkewTransform,
centerY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionTransform.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSkewTransform_SetAngleX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSkewTransform.VTable, self.vtable).SetAngleX(@ptrCast(*const IDCompositionSkewTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSkewTransform_SetAngleX1(self: *const T, angleX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSkewTransform.VTable, self.vtable).SetAngleX(@ptrCast(*const IDCompositionSkewTransform, self), angleX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSkewTransform_SetAngleY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSkewTransform.VTable, self.vtable).SetAngleY(@ptrCast(*const IDCompositionSkewTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSkewTransform_SetAngleY1(self: *const T, angleY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSkewTransform.VTable, self.vtable).SetAngleY(@ptrCast(*const IDCompositionSkewTransform, self), angleY);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSkewTransform_SetCenterX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSkewTransform.VTable, self.vtable).SetCenterX(@ptrCast(*const IDCompositionSkewTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSkewTransform_SetCenterX1(self: *const T, centerX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSkewTransform.VTable, self.vtable).SetCenterX(@ptrCast(*const IDCompositionSkewTransform, self), centerX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSkewTransform_SetCenterY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSkewTransform.VTable, self.vtable).SetCenterY(@ptrCast(*const IDCompositionSkewTransform, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSkewTransform_SetCenterY1(self: *const T, centerY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSkewTransform.VTable, self.vtable).SetCenterY(@ptrCast(*const IDCompositionSkewTransform, self), centerY);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionMatrixTransform_Value = Guid.initString("16cdff07-c503-419c-83f2-0965c7af1fa6");
pub const IID_IDCompositionMatrixTransform = &IID_IDCompositionMatrixTransform_Value;
pub const IDCompositionMatrixTransform = extern struct {
pub const VTable = extern struct {
base: IDCompositionTransform.VTable,
SetMatrix: fn(
self: *const IDCompositionMatrixTransform,
matrix: ?*const D2D_MATRIX_3X2_F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMatrixElement: fn(
self: *const IDCompositionMatrixTransform,
row: i32,
column: i32,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMatrixElement1: fn(
self: *const IDCompositionMatrixTransform,
row: i32,
column: i32,
value: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionTransform.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionMatrixTransform_SetMatrix(self: *const T, matrix: ?*const D2D_MATRIX_3X2_F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionMatrixTransform.VTable, self.vtable).SetMatrix(@ptrCast(*const IDCompositionMatrixTransform, self), matrix);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionMatrixTransform_SetMatrixElement(self: *const T, row: i32, column: i32, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionMatrixTransform.VTable, self.vtable).SetMatrixElement(@ptrCast(*const IDCompositionMatrixTransform, self), row, column, animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionMatrixTransform_SetMatrixElement1(self: *const T, row: i32, column: i32, value: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionMatrixTransform.VTable, self.vtable).SetMatrixElement(@ptrCast(*const IDCompositionMatrixTransform, self), row, column, value);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionEffectGroup_Value = Guid.initString("a7929a74-e6b2-4bd6-8b95-4040119ca34d");
pub const IID_IDCompositionEffectGroup = &IID_IDCompositionEffectGroup_Value;
pub const IDCompositionEffectGroup = extern struct {
pub const VTable = extern struct {
base: IDCompositionEffect.VTable,
SetOpacity: fn(
self: *const IDCompositionEffectGroup,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOpacity1: fn(
self: *const IDCompositionEffectGroup,
opacity: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTransform3D: fn(
self: *const IDCompositionEffectGroup,
transform3D: ?*IDCompositionTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionEffectGroup_SetOpacity(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionEffectGroup.VTable, self.vtable).SetOpacity(@ptrCast(*const IDCompositionEffectGroup, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionEffectGroup_SetOpacity1(self: *const T, opacity: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionEffectGroup.VTable, self.vtable).SetOpacity(@ptrCast(*const IDCompositionEffectGroup, self), opacity);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionEffectGroup_SetTransform3D(self: *const T, transform3D: ?*IDCompositionTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionEffectGroup.VTable, self.vtable).SetTransform3D(@ptrCast(*const IDCompositionEffectGroup, self), transform3D);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionTranslateTransform3D_Value = Guid.initString("91636d4b-9ba1-4532-aaf7-e3344994d788");
pub const IID_IDCompositionTranslateTransform3D = &IID_IDCompositionTranslateTransform3D_Value;
pub const IDCompositionTranslateTransform3D = extern struct {
pub const VTable = extern struct {
base: IDCompositionTransform3D.VTable,
SetOffsetX: fn(
self: *const IDCompositionTranslateTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetX1: fn(
self: *const IDCompositionTranslateTransform3D,
offsetX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetY: fn(
self: *const IDCompositionTranslateTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetY1: fn(
self: *const IDCompositionTranslateTransform3D,
offsetY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetZ: fn(
self: *const IDCompositionTranslateTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetZ1: fn(
self: *const IDCompositionTranslateTransform3D,
offsetZ: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionTransform3D.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTranslateTransform3D_SetOffsetX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTranslateTransform3D.VTable, self.vtable).SetOffsetX(@ptrCast(*const IDCompositionTranslateTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTranslateTransform3D_SetOffsetX1(self: *const T, offsetX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTranslateTransform3D.VTable, self.vtable).SetOffsetX(@ptrCast(*const IDCompositionTranslateTransform3D, self), offsetX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTranslateTransform3D_SetOffsetY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTranslateTransform3D.VTable, self.vtable).SetOffsetY(@ptrCast(*const IDCompositionTranslateTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTranslateTransform3D_SetOffsetY1(self: *const T, offsetY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTranslateTransform3D.VTable, self.vtable).SetOffsetY(@ptrCast(*const IDCompositionTranslateTransform3D, self), offsetY);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTranslateTransform3D_SetOffsetZ(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTranslateTransform3D.VTable, self.vtable).SetOffsetZ(@ptrCast(*const IDCompositionTranslateTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTranslateTransform3D_SetOffsetZ1(self: *const T, offsetZ: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTranslateTransform3D.VTable, self.vtable).SetOffsetZ(@ptrCast(*const IDCompositionTranslateTransform3D, self), offsetZ);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionScaleTransform3D_Value = Guid.initString("2a9e9ead-364b-4b15-a7c4-a1997f78b389");
pub const IID_IDCompositionScaleTransform3D = &IID_IDCompositionScaleTransform3D_Value;
pub const IDCompositionScaleTransform3D = extern struct {
pub const VTable = extern struct {
base: IDCompositionTransform3D.VTable,
SetScaleX: fn(
self: *const IDCompositionScaleTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetScaleX1: fn(
self: *const IDCompositionScaleTransform3D,
scaleX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetScaleY: fn(
self: *const IDCompositionScaleTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetScaleY1: fn(
self: *const IDCompositionScaleTransform3D,
scaleY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetScaleZ: fn(
self: *const IDCompositionScaleTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetScaleZ1: fn(
self: *const IDCompositionScaleTransform3D,
scaleZ: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterX: fn(
self: *const IDCompositionScaleTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterX1: fn(
self: *const IDCompositionScaleTransform3D,
centerX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterY: fn(
self: *const IDCompositionScaleTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterY1: fn(
self: *const IDCompositionScaleTransform3D,
centerY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterZ: fn(
self: *const IDCompositionScaleTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterZ1: fn(
self: *const IDCompositionScaleTransform3D,
centerZ: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionTransform3D.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetScaleX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetScaleX(@ptrCast(*const IDCompositionScaleTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetScaleX1(self: *const T, scaleX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetScaleX(@ptrCast(*const IDCompositionScaleTransform3D, self), scaleX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetScaleY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetScaleY(@ptrCast(*const IDCompositionScaleTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetScaleY1(self: *const T, scaleY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetScaleY(@ptrCast(*const IDCompositionScaleTransform3D, self), scaleY);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetScaleZ(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetScaleZ(@ptrCast(*const IDCompositionScaleTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetScaleZ1(self: *const T, scaleZ: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetScaleZ(@ptrCast(*const IDCompositionScaleTransform3D, self), scaleZ);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetCenterX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetCenterX(@ptrCast(*const IDCompositionScaleTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetCenterX1(self: *const T, centerX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetCenterX(@ptrCast(*const IDCompositionScaleTransform3D, self), centerX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetCenterY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetCenterY(@ptrCast(*const IDCompositionScaleTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetCenterY1(self: *const T, centerY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetCenterY(@ptrCast(*const IDCompositionScaleTransform3D, self), centerY);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetCenterZ(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetCenterZ(@ptrCast(*const IDCompositionScaleTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionScaleTransform3D_SetCenterZ1(self: *const T, centerZ: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionScaleTransform3D.VTable, self.vtable).SetCenterZ(@ptrCast(*const IDCompositionScaleTransform3D, self), centerZ);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionRotateTransform3D_Value = Guid.initString("d8f5b23f-d429-4a91-b55a-d2f45fd75b18");
pub const IID_IDCompositionRotateTransform3D = &IID_IDCompositionRotateTransform3D_Value;
pub const IDCompositionRotateTransform3D = extern struct {
pub const VTable = extern struct {
base: IDCompositionTransform3D.VTable,
SetAngle: fn(
self: *const IDCompositionRotateTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAngle1: fn(
self: *const IDCompositionRotateTransform3D,
angle: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAxisX: fn(
self: *const IDCompositionRotateTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAxisX1: fn(
self: *const IDCompositionRotateTransform3D,
axisX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAxisY: fn(
self: *const IDCompositionRotateTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAxisY1: fn(
self: *const IDCompositionRotateTransform3D,
axisY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAxisZ: fn(
self: *const IDCompositionRotateTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAxisZ1: fn(
self: *const IDCompositionRotateTransform3D,
axisZ: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterX: fn(
self: *const IDCompositionRotateTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterX1: fn(
self: *const IDCompositionRotateTransform3D,
centerX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterY: fn(
self: *const IDCompositionRotateTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterY1: fn(
self: *const IDCompositionRotateTransform3D,
centerY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterZ: fn(
self: *const IDCompositionRotateTransform3D,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCenterZ1: fn(
self: *const IDCompositionRotateTransform3D,
centerZ: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionTransform3D.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetAngle(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetAngle(@ptrCast(*const IDCompositionRotateTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetAngle1(self: *const T, angle: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetAngle(@ptrCast(*const IDCompositionRotateTransform3D, self), angle);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetAxisX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetAxisX(@ptrCast(*const IDCompositionRotateTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetAxisX1(self: *const T, axisX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetAxisX(@ptrCast(*const IDCompositionRotateTransform3D, self), axisX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetAxisY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetAxisY(@ptrCast(*const IDCompositionRotateTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetAxisY1(self: *const T, axisY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetAxisY(@ptrCast(*const IDCompositionRotateTransform3D, self), axisY);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetAxisZ(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetAxisZ(@ptrCast(*const IDCompositionRotateTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetAxisZ1(self: *const T, axisZ: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetAxisZ(@ptrCast(*const IDCompositionRotateTransform3D, self), axisZ);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetCenterX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetCenterX(@ptrCast(*const IDCompositionRotateTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetCenterX1(self: *const T, centerX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetCenterX(@ptrCast(*const IDCompositionRotateTransform3D, self), centerX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetCenterY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetCenterY(@ptrCast(*const IDCompositionRotateTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetCenterY1(self: *const T, centerY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetCenterY(@ptrCast(*const IDCompositionRotateTransform3D, self), centerY);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetCenterZ(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetCenterZ(@ptrCast(*const IDCompositionRotateTransform3D, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRotateTransform3D_SetCenterZ1(self: *const T, centerZ: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRotateTransform3D.VTable, self.vtable).SetCenterZ(@ptrCast(*const IDCompositionRotateTransform3D, self), centerZ);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionMatrixTransform3D_Value = Guid.initString("4b3363f0-643b-41b7-b6e0-ccf22d34467c");
pub const IID_IDCompositionMatrixTransform3D = &IID_IDCompositionMatrixTransform3D_Value;
pub const IDCompositionMatrixTransform3D = extern struct {
pub const VTable = extern struct {
base: IDCompositionTransform3D.VTable,
SetMatrix: fn(
self: *const IDCompositionMatrixTransform3D,
matrix: ?*const D3DMATRIX,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMatrixElement: fn(
self: *const IDCompositionMatrixTransform3D,
row: i32,
column: i32,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMatrixElement1: fn(
self: *const IDCompositionMatrixTransform3D,
row: i32,
column: i32,
value: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionTransform3D.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionMatrixTransform3D_SetMatrix(self: *const T, matrix: ?*const D3DMATRIX) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionMatrixTransform3D.VTable, self.vtable).SetMatrix(@ptrCast(*const IDCompositionMatrixTransform3D, self), matrix);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionMatrixTransform3D_SetMatrixElement(self: *const T, row: i32, column: i32, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionMatrixTransform3D.VTable, self.vtable).SetMatrixElement(@ptrCast(*const IDCompositionMatrixTransform3D, self), row, column, animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionMatrixTransform3D_SetMatrixElement1(self: *const T, row: i32, column: i32, value: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionMatrixTransform3D.VTable, self.vtable).SetMatrixElement(@ptrCast(*const IDCompositionMatrixTransform3D, self), row, column, value);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionClip_Value = Guid.initString("64ac3703-9d3f-45ec-a109-7cac0e7a13a7");
pub const IID_IDCompositionClip = &IID_IDCompositionClip_Value;
pub const IDCompositionClip = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionRectangleClip_Value = Guid.initString("9842ad7d-d9cf-4908-aed7-48b51da5e7c2");
pub const IID_IDCompositionRectangleClip = &IID_IDCompositionRectangleClip_Value;
pub const IDCompositionRectangleClip = extern struct {
pub const VTable = extern struct {
base: IDCompositionClip.VTable,
SetLeft: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetLeft1: fn(
self: *const IDCompositionRectangleClip,
left: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTop: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTop1: fn(
self: *const IDCompositionRectangleClip,
top: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRight: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRight1: fn(
self: *const IDCompositionRectangleClip,
right: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBottom: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBottom1: fn(
self: *const IDCompositionRectangleClip,
bottom: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTopLeftRadiusX: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTopLeftRadiusX1: fn(
self: *const IDCompositionRectangleClip,
radius: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTopLeftRadiusY: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTopLeftRadiusY1: fn(
self: *const IDCompositionRectangleClip,
radius: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTopRightRadiusX: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTopRightRadiusX1: fn(
self: *const IDCompositionRectangleClip,
radius: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTopRightRadiusY: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTopRightRadiusY1: fn(
self: *const IDCompositionRectangleClip,
radius: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBottomLeftRadiusX: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBottomLeftRadiusX1: fn(
self: *const IDCompositionRectangleClip,
radius: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBottomLeftRadiusY: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBottomLeftRadiusY1: fn(
self: *const IDCompositionRectangleClip,
radius: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBottomRightRadiusX: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBottomRightRadiusX1: fn(
self: *const IDCompositionRectangleClip,
radius: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBottomRightRadiusY: fn(
self: *const IDCompositionRectangleClip,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBottomRightRadiusY1: fn(
self: *const IDCompositionRectangleClip,
radius: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionClip.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetLeft(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetLeft(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetLeft1(self: *const T, left: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetLeft(@ptrCast(*const IDCompositionRectangleClip, self), left);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetTop(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetTop(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetTop1(self: *const T, top: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetTop(@ptrCast(*const IDCompositionRectangleClip, self), top);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetRight(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetRight(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetRight1(self: *const T, right: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetRight(@ptrCast(*const IDCompositionRectangleClip, self), right);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetBottom(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetBottom(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetBottom1(self: *const T, bottom: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetBottom(@ptrCast(*const IDCompositionRectangleClip, self), bottom);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetTopLeftRadiusX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetTopLeftRadiusX(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetTopLeftRadiusX1(self: *const T, radius: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetTopLeftRadiusX(@ptrCast(*const IDCompositionRectangleClip, self), radius);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetTopLeftRadiusY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetTopLeftRadiusY(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetTopLeftRadiusY1(self: *const T, radius: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetTopLeftRadiusY(@ptrCast(*const IDCompositionRectangleClip, self), radius);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetTopRightRadiusX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetTopRightRadiusX(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetTopRightRadiusX1(self: *const T, radius: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetTopRightRadiusX(@ptrCast(*const IDCompositionRectangleClip, self), radius);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetTopRightRadiusY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetTopRightRadiusY(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetTopRightRadiusY1(self: *const T, radius: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetTopRightRadiusY(@ptrCast(*const IDCompositionRectangleClip, self), radius);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetBottomLeftRadiusX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetBottomLeftRadiusX(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetBottomLeftRadiusX1(self: *const T, radius: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetBottomLeftRadiusX(@ptrCast(*const IDCompositionRectangleClip, self), radius);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetBottomLeftRadiusY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetBottomLeftRadiusY(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetBottomLeftRadiusY1(self: *const T, radius: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetBottomLeftRadiusY(@ptrCast(*const IDCompositionRectangleClip, self), radius);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetBottomRightRadiusX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetBottomRightRadiusX(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetBottomRightRadiusX1(self: *const T, radius: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetBottomRightRadiusX(@ptrCast(*const IDCompositionRectangleClip, self), radius);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetBottomRightRadiusY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetBottomRightRadiusY(@ptrCast(*const IDCompositionRectangleClip, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionRectangleClip_SetBottomRightRadiusY1(self: *const T, radius: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionRectangleClip.VTable, self.vtable).SetBottomRightRadiusY(@ptrCast(*const IDCompositionRectangleClip, self), radius);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionSurface_Value = Guid.initString("bb8a4953-2c99-4f5a-96f5-4819027fa3ac");
pub const IID_IDCompositionSurface = &IID_IDCompositionSurface_Value;
pub const IDCompositionSurface = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
BeginDraw: fn(
self: *const IDCompositionSurface,
updateRect: ?*const RECT,
iid: ?*const Guid,
updateObject: ?*?*anyopaque,
updateOffset: ?*POINT,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EndDraw: fn(
self: *const IDCompositionSurface,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SuspendDraw: fn(
self: *const IDCompositionSurface,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
ResumeDraw: fn(
self: *const IDCompositionSurface,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Scroll: fn(
self: *const IDCompositionSurface,
scrollRect: ?*const RECT,
clipRect: ?*const RECT,
offsetX: i32,
offsetY: i32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSurface_BeginDraw(self: *const T, updateRect: ?*const RECT, iid: ?*const Guid, updateObject: ?*?*anyopaque, updateOffset: ?*POINT) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSurface.VTable, self.vtable).BeginDraw(@ptrCast(*const IDCompositionSurface, self), updateRect, iid, updateObject, updateOffset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSurface_EndDraw(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSurface.VTable, self.vtable).EndDraw(@ptrCast(*const IDCompositionSurface, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSurface_SuspendDraw(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSurface.VTable, self.vtable).SuspendDraw(@ptrCast(*const IDCompositionSurface, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSurface_ResumeDraw(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSurface.VTable, self.vtable).ResumeDraw(@ptrCast(*const IDCompositionSurface, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSurface_Scroll(self: *const T, scrollRect: ?*const RECT, clipRect: ?*const RECT, offsetX: i32, offsetY: i32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSurface.VTable, self.vtable).Scroll(@ptrCast(*const IDCompositionSurface, self), scrollRect, clipRect, offsetX, offsetY);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionVirtualSurface_Value = Guid.initString("ae471c51-5f53-4a24-8d3e-d0c39c30b3f0");
pub const IID_IDCompositionVirtualSurface = &IID_IDCompositionVirtualSurface_Value;
pub const IDCompositionVirtualSurface = extern struct {
pub const VTable = extern struct {
base: IDCompositionSurface.VTable,
Resize: fn(
self: *const IDCompositionVirtualSurface,
width: u32,
height: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
Trim: fn(
self: *const IDCompositionVirtualSurface,
rectangles: ?[*]const RECT,
count: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionSurface.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVirtualSurface_Resize(self: *const T, width: u32, height: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVirtualSurface.VTable, self.vtable).Resize(@ptrCast(*const IDCompositionVirtualSurface, self), width, height);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVirtualSurface_Trim(self: *const T, rectangles: ?[*]const RECT, count: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVirtualSurface.VTable, self.vtable).Trim(@ptrCast(*const IDCompositionVirtualSurface, self), rectangles, count);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.1'
const IID_IDCompositionDevice2_Value = Guid.initString("75f6468d-1b8e-447c-9bc6-75fea80b5b25");
pub const IID_IDCompositionDevice2 = &IID_IDCompositionDevice2_Value;
pub const IDCompositionDevice2 = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
Commit: fn(
self: *const IDCompositionDevice2,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
WaitForCommitCompletion: fn(
self: *const IDCompositionDevice2,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
GetFrameStatistics: fn(
self: *const IDCompositionDevice2,
statistics: ?*DCOMPOSITION_FRAME_STATISTICS,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateVisual: fn(
self: *const IDCompositionDevice2,
visual: ?*?*IDCompositionVisual2,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSurfaceFactory: fn(
self: *const IDCompositionDevice2,
renderingDevice: ?*IUnknown,
surfaceFactory: ?*?*IDCompositionSurfaceFactory,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSurface: fn(
self: *const IDCompositionDevice2,
width: u32,
height: u32,
pixelFormat: DXGI_FORMAT,
alphaMode: DXGI_ALPHA_MODE,
surface: ?*?*IDCompositionSurface,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateVirtualSurface: fn(
self: *const IDCompositionDevice2,
initialWidth: u32,
initialHeight: u32,
pixelFormat: DXGI_FORMAT,
alphaMode: DXGI_ALPHA_MODE,
virtualSurface: ?*?*IDCompositionVirtualSurface,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTranslateTransform: fn(
self: *const IDCompositionDevice2,
translateTransform: ?*?*IDCompositionTranslateTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateScaleTransform: fn(
self: *const IDCompositionDevice2,
scaleTransform: ?*?*IDCompositionScaleTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRotateTransform: fn(
self: *const IDCompositionDevice2,
rotateTransform: ?*?*IDCompositionRotateTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSkewTransform: fn(
self: *const IDCompositionDevice2,
skewTransform: ?*?*IDCompositionSkewTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateMatrixTransform: fn(
self: *const IDCompositionDevice2,
matrixTransform: ?*?*IDCompositionMatrixTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTransformGroup: fn(
self: *const IDCompositionDevice2,
transforms: [*]?*IDCompositionTransform,
elements: u32,
transformGroup: ?*?*IDCompositionTransform,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTranslateTransform3D: fn(
self: *const IDCompositionDevice2,
translateTransform3D: ?*?*IDCompositionTranslateTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateScaleTransform3D: fn(
self: *const IDCompositionDevice2,
scaleTransform3D: ?*?*IDCompositionScaleTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRotateTransform3D: fn(
self: *const IDCompositionDevice2,
rotateTransform3D: ?*?*IDCompositionRotateTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateMatrixTransform3D: fn(
self: *const IDCompositionDevice2,
matrixTransform3D: ?*?*IDCompositionMatrixTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTransform3DGroup: fn(
self: *const IDCompositionDevice2,
transforms3D: [*]?*IDCompositionTransform3D,
elements: u32,
transform3DGroup: ?*?*IDCompositionTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateEffectGroup: fn(
self: *const IDCompositionDevice2,
effectGroup: ?*?*IDCompositionEffectGroup,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateRectangleClip: fn(
self: *const IDCompositionDevice2,
clip: ?*?*IDCompositionRectangleClip,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateAnimation: fn(
self: *const IDCompositionDevice2,
animation: ?*?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_Commit(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).Commit(@ptrCast(*const IDCompositionDevice2, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_WaitForCommitCompletion(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).WaitForCommitCompletion(@ptrCast(*const IDCompositionDevice2, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_GetFrameStatistics(self: *const T, statistics: ?*DCOMPOSITION_FRAME_STATISTICS) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).GetFrameStatistics(@ptrCast(*const IDCompositionDevice2, self), statistics);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateVisual(self: *const T, visual: ?*?*IDCompositionVisual2) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateVisual(@ptrCast(*const IDCompositionDevice2, self), visual);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateSurfaceFactory(self: *const T, renderingDevice: ?*IUnknown, surfaceFactory: ?*?*IDCompositionSurfaceFactory) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateSurfaceFactory(@ptrCast(*const IDCompositionDevice2, self), renderingDevice, surfaceFactory);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateSurface(self: *const T, width: u32, height: u32, pixelFormat: DXGI_FORMAT, alphaMode: DXGI_ALPHA_MODE, surface: ?*?*IDCompositionSurface) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateSurface(@ptrCast(*const IDCompositionDevice2, self), width, height, pixelFormat, alphaMode, surface);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateVirtualSurface(self: *const T, initialWidth: u32, initialHeight: u32, pixelFormat: DXGI_FORMAT, alphaMode: DXGI_ALPHA_MODE, virtualSurface: ?*?*IDCompositionVirtualSurface) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateVirtualSurface(@ptrCast(*const IDCompositionDevice2, self), initialWidth, initialHeight, pixelFormat, alphaMode, virtualSurface);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateTranslateTransform(self: *const T, translateTransform: ?*?*IDCompositionTranslateTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateTranslateTransform(@ptrCast(*const IDCompositionDevice2, self), translateTransform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateScaleTransform(self: *const T, scaleTransform: ?*?*IDCompositionScaleTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateScaleTransform(@ptrCast(*const IDCompositionDevice2, self), scaleTransform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateRotateTransform(self: *const T, rotateTransform: ?*?*IDCompositionRotateTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateRotateTransform(@ptrCast(*const IDCompositionDevice2, self), rotateTransform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateSkewTransform(self: *const T, skewTransform: ?*?*IDCompositionSkewTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateSkewTransform(@ptrCast(*const IDCompositionDevice2, self), skewTransform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateMatrixTransform(self: *const T, matrixTransform: ?*?*IDCompositionMatrixTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateMatrixTransform(@ptrCast(*const IDCompositionDevice2, self), matrixTransform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateTransformGroup(self: *const T, transforms: [*]?*IDCompositionTransform, elements: u32, transformGroup: ?*?*IDCompositionTransform) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateTransformGroup(@ptrCast(*const IDCompositionDevice2, self), transforms, elements, transformGroup);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateTranslateTransform3D(self: *const T, translateTransform3D: ?*?*IDCompositionTranslateTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateTranslateTransform3D(@ptrCast(*const IDCompositionDevice2, self), translateTransform3D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateScaleTransform3D(self: *const T, scaleTransform3D: ?*?*IDCompositionScaleTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateScaleTransform3D(@ptrCast(*const IDCompositionDevice2, self), scaleTransform3D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateRotateTransform3D(self: *const T, rotateTransform3D: ?*?*IDCompositionRotateTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateRotateTransform3D(@ptrCast(*const IDCompositionDevice2, self), rotateTransform3D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateMatrixTransform3D(self: *const T, matrixTransform3D: ?*?*IDCompositionMatrixTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateMatrixTransform3D(@ptrCast(*const IDCompositionDevice2, self), matrixTransform3D);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateTransform3DGroup(self: *const T, transforms3D: [*]?*IDCompositionTransform3D, elements: u32, transform3DGroup: ?*?*IDCompositionTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateTransform3DGroup(@ptrCast(*const IDCompositionDevice2, self), transforms3D, elements, transform3DGroup);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateEffectGroup(self: *const T, effectGroup: ?*?*IDCompositionEffectGroup) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateEffectGroup(@ptrCast(*const IDCompositionDevice2, self), effectGroup);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateRectangleClip(self: *const T, clip: ?*?*IDCompositionRectangleClip) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateRectangleClip(@ptrCast(*const IDCompositionDevice2, self), clip);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice2_CreateAnimation(self: *const T, animation: ?*?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice2.VTable, self.vtable).CreateAnimation(@ptrCast(*const IDCompositionDevice2, self), animation);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.1'
const IID_IDCompositionDesktopDevice_Value = Guid.initString("5f4633fe-1e08-4cb8-8c75-ce24333f5602");
pub const IID_IDCompositionDesktopDevice = &IID_IDCompositionDesktopDevice_Value;
pub const IDCompositionDesktopDevice = extern struct {
pub const VTable = extern struct {
base: IDCompositionDevice2.VTable,
CreateTargetForHwnd: fn(
self: *const IDCompositionDesktopDevice,
hwnd: ?HWND,
topmost: BOOL,
target: ?*?*IDCompositionTarget,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSurfaceFromHandle: fn(
self: *const IDCompositionDesktopDevice,
handle: ?HANDLE,
surface: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSurfaceFromHwnd: fn(
self: *const IDCompositionDesktopDevice,
hwnd: ?HWND,
surface: ?*?*IUnknown,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionDevice2.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDesktopDevice_CreateTargetForHwnd(self: *const T, hwnd: ?HWND, topmost: BOOL, target: ?*?*IDCompositionTarget) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDesktopDevice.VTable, self.vtable).CreateTargetForHwnd(@ptrCast(*const IDCompositionDesktopDevice, self), hwnd, topmost, target);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDesktopDevice_CreateSurfaceFromHandle(self: *const T, handle: ?HANDLE, surface: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDesktopDevice.VTable, self.vtable).CreateSurfaceFromHandle(@ptrCast(*const IDCompositionDesktopDevice, self), handle, surface);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDesktopDevice_CreateSurfaceFromHwnd(self: *const T, hwnd: ?HWND, surface: ?*?*IUnknown) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDesktopDevice.VTable, self.vtable).CreateSurfaceFromHwnd(@ptrCast(*const IDCompositionDesktopDevice, self), hwnd, surface);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionDeviceDebug_Value = Guid.initString("a1a3c64a-224f-4a81-9773-4f03a89d3c6c");
pub const IID_IDCompositionDeviceDebug = &IID_IDCompositionDeviceDebug_Value;
pub const IDCompositionDeviceDebug = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
EnableDebugCounters: fn(
self: *const IDCompositionDeviceDebug,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DisableDebugCounters: fn(
self: *const IDCompositionDeviceDebug,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDeviceDebug_EnableDebugCounters(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDeviceDebug.VTable, self.vtable).EnableDebugCounters(@ptrCast(*const IDCompositionDeviceDebug, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDeviceDebug_DisableDebugCounters(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDeviceDebug.VTable, self.vtable).DisableDebugCounters(@ptrCast(*const IDCompositionDeviceDebug, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.1'
const IID_IDCompositionSurfaceFactory_Value = Guid.initString("e334bc12-3937-4e02-85eb-fcf4eb30d2c8");
pub const IID_IDCompositionSurfaceFactory = &IID_IDCompositionSurfaceFactory_Value;
pub const IDCompositionSurfaceFactory = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateSurface: fn(
self: *const IDCompositionSurfaceFactory,
width: u32,
height: u32,
pixelFormat: DXGI_FORMAT,
alphaMode: DXGI_ALPHA_MODE,
surface: ?*?*IDCompositionSurface,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateVirtualSurface: fn(
self: *const IDCompositionSurfaceFactory,
initialWidth: u32,
initialHeight: u32,
pixelFormat: DXGI_FORMAT,
alphaMode: DXGI_ALPHA_MODE,
virtualSurface: ?*?*IDCompositionVirtualSurface,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSurfaceFactory_CreateSurface(self: *const T, width: u32, height: u32, pixelFormat: DXGI_FORMAT, alphaMode: DXGI_ALPHA_MODE, surface: ?*?*IDCompositionSurface) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSurfaceFactory.VTable, self.vtable).CreateSurface(@ptrCast(*const IDCompositionSurfaceFactory, self), width, height, pixelFormat, alphaMode, surface);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSurfaceFactory_CreateVirtualSurface(self: *const T, initialWidth: u32, initialHeight: u32, pixelFormat: DXGI_FORMAT, alphaMode: DXGI_ALPHA_MODE, virtualSurface: ?*?*IDCompositionVirtualSurface) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSurfaceFactory.VTable, self.vtable).CreateVirtualSurface(@ptrCast(*const IDCompositionSurfaceFactory, self), initialWidth, initialHeight, pixelFormat, alphaMode, virtualSurface);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.1'
const IID_IDCompositionVisual2_Value = Guid.initString("e8de1639-4331-4b26-bc5f-6a321d347a85");
pub const IID_IDCompositionVisual2 = &IID_IDCompositionVisual2_Value;
pub const IDCompositionVisual2 = extern struct {
pub const VTable = extern struct {
base: IDCompositionVisual.VTable,
SetOpacityMode: fn(
self: *const IDCompositionVisual2,
mode: DCOMPOSITION_OPACITY_MODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBackFaceVisibility: fn(
self: *const IDCompositionVisual2,
visibility: DCOMPOSITION_BACKFACE_VISIBILITY,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionVisual.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual2_SetOpacityMode(self: *const T, mode: DCOMPOSITION_OPACITY_MODE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual2.VTable, self.vtable).SetOpacityMode(@ptrCast(*const IDCompositionVisual2, self), mode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual2_SetBackFaceVisibility(self: *const T, visibility: DCOMPOSITION_BACKFACE_VISIBILITY) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual2.VTable, self.vtable).SetBackFaceVisibility(@ptrCast(*const IDCompositionVisual2, self), visibility);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.1'
const IID_IDCompositionVisualDebug_Value = Guid.initString("fed2b808-5eb4-43a0-aea3-35f65280f91b");
pub const IID_IDCompositionVisualDebug = &IID_IDCompositionVisualDebug_Value;
pub const IDCompositionVisualDebug = extern struct {
pub const VTable = extern struct {
base: IDCompositionVisual2.VTable,
EnableHeatMap: fn(
self: *const IDCompositionVisualDebug,
color: ?*const D2D1_COLOR_F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DisableHeatMap: fn(
self: *const IDCompositionVisualDebug,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
EnableRedrawRegions: fn(
self: *const IDCompositionVisualDebug,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
DisableRedrawRegions: fn(
self: *const IDCompositionVisualDebug,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionVisual2.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisualDebug_EnableHeatMap(self: *const T, color: ?*const D2D1_COLOR_F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisualDebug.VTable, self.vtable).EnableHeatMap(@ptrCast(*const IDCompositionVisualDebug, self), color);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisualDebug_DisableHeatMap(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisualDebug.VTable, self.vtable).DisableHeatMap(@ptrCast(*const IDCompositionVisualDebug, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisualDebug_EnableRedrawRegions(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisualDebug.VTable, self.vtable).EnableRedrawRegions(@ptrCast(*const IDCompositionVisualDebug, self));
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisualDebug_DisableRedrawRegions(self: *const T) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisualDebug.VTable, self.vtable).DisableRedrawRegions(@ptrCast(*const IDCompositionVisualDebug, self));
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.1'
const IID_IDCompositionVisual3_Value = Guid.initString("2775f462-b6c1-4015-b0be-b3e7d6a4976d");
pub const IID_IDCompositionVisual3 = &IID_IDCompositionVisual3_Value;
pub const IDCompositionVisual3 = extern struct {
pub const VTable = extern struct {
base: IDCompositionVisualDebug.VTable,
SetDepthMode: fn(
self: *const IDCompositionVisual3,
mode: DCOMPOSITION_DEPTH_MODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetZ: fn(
self: *const IDCompositionVisual3,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOffsetZ1: fn(
self: *const IDCompositionVisual3,
offsetZ: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOpacity: fn(
self: *const IDCompositionVisual3,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetOpacity1: fn(
self: *const IDCompositionVisual3,
opacity: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTransform: fn(
self: *const IDCompositionVisual3,
transform: ?*IDCompositionTransform3D,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTransform1: fn(
self: *const IDCompositionVisual3,
matrix: ?*const D2D_MATRIX_4X4_F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetVisible: fn(
self: *const IDCompositionVisual3,
visible: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionVisualDebug.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual3_SetDepthMode(self: *const T, mode: DCOMPOSITION_DEPTH_MODE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual3.VTable, self.vtable).SetDepthMode(@ptrCast(*const IDCompositionVisual3, self), mode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual3_SetOffsetZ(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual3.VTable, self.vtable).SetOffsetZ(@ptrCast(*const IDCompositionVisual3, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual3_SetOffsetZ1(self: *const T, offsetZ: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual3.VTable, self.vtable).SetOffsetZ(@ptrCast(*const IDCompositionVisual3, self), offsetZ);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual3_SetOpacity(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual3.VTable, self.vtable).SetOpacity(@ptrCast(*const IDCompositionVisual3, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual3_SetOpacity1(self: *const T, opacity: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual3.VTable, self.vtable).SetOpacity(@ptrCast(*const IDCompositionVisual3, self), opacity);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual3_SetTransform(self: *const T, transform: ?*IDCompositionTransform3D) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual3.VTable, self.vtable).SetTransform(@ptrCast(*const IDCompositionVisual3, self), transform);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual3_SetTransform1(self: *const T, matrix: ?*const D2D_MATRIX_4X4_F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual3.VTable, self.vtable).SetTransform(@ptrCast(*const IDCompositionVisual3, self), matrix);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionVisual3_SetVisible(self: *const T, visible: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionVisual3.VTable, self.vtable).SetVisible(@ptrCast(*const IDCompositionVisual3, self), visible);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.1'
const IID_IDCompositionDevice3_Value = Guid.initString("0987cb06-f916-48bf-8d35-ce7641781bd9");
pub const IID_IDCompositionDevice3 = &IID_IDCompositionDevice3_Value;
pub const IDCompositionDevice3 = extern struct {
pub const VTable = extern struct {
base: IDCompositionDevice2.VTable,
CreateGaussianBlurEffect: fn(
self: *const IDCompositionDevice3,
gaussianBlurEffect: ?*?*IDCompositionGaussianBlurEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateBrightnessEffect: fn(
self: *const IDCompositionDevice3,
brightnessEffect: ?*?*IDCompositionBrightnessEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateColorMatrixEffect: fn(
self: *const IDCompositionDevice3,
colorMatrixEffect: ?*?*IDCompositionColorMatrixEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateShadowEffect: fn(
self: *const IDCompositionDevice3,
shadowEffect: ?*?*IDCompositionShadowEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateHueRotationEffect: fn(
self: *const IDCompositionDevice3,
hueRotationEffect: ?*?*IDCompositionHueRotationEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateSaturationEffect: fn(
self: *const IDCompositionDevice3,
saturationEffect: ?*?*IDCompositionSaturationEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTurbulenceEffect: fn(
self: *const IDCompositionDevice3,
turbulenceEffect: ?*?*IDCompositionTurbulenceEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateLinearTransferEffect: fn(
self: *const IDCompositionDevice3,
linearTransferEffect: ?*?*IDCompositionLinearTransferEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateTableTransferEffect: fn(
self: *const IDCompositionDevice3,
tableTransferEffect: ?*?*IDCompositionTableTransferEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateCompositeEffect: fn(
self: *const IDCompositionDevice3,
compositeEffect: ?*?*IDCompositionCompositeEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateBlendEffect: fn(
self: *const IDCompositionDevice3,
blendEffect: ?*?*IDCompositionBlendEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateArithmeticCompositeEffect: fn(
self: *const IDCompositionDevice3,
arithmeticCompositeEffect: ?*?*IDCompositionArithmeticCompositeEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateAffineTransform2DEffect: fn(
self: *const IDCompositionDevice3,
affineTransform2dEffect: ?*?*IDCompositionAffineTransform2DEffect,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionDevice2.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateGaussianBlurEffect(self: *const T, gaussianBlurEffect: ?*?*IDCompositionGaussianBlurEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateGaussianBlurEffect(@ptrCast(*const IDCompositionDevice3, self), gaussianBlurEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateBrightnessEffect(self: *const T, brightnessEffect: ?*?*IDCompositionBrightnessEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateBrightnessEffect(@ptrCast(*const IDCompositionDevice3, self), brightnessEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateColorMatrixEffect(self: *const T, colorMatrixEffect: ?*?*IDCompositionColorMatrixEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateColorMatrixEffect(@ptrCast(*const IDCompositionDevice3, self), colorMatrixEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateShadowEffect(self: *const T, shadowEffect: ?*?*IDCompositionShadowEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateShadowEffect(@ptrCast(*const IDCompositionDevice3, self), shadowEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateHueRotationEffect(self: *const T, hueRotationEffect: ?*?*IDCompositionHueRotationEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateHueRotationEffect(@ptrCast(*const IDCompositionDevice3, self), hueRotationEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateSaturationEffect(self: *const T, saturationEffect: ?*?*IDCompositionSaturationEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateSaturationEffect(@ptrCast(*const IDCompositionDevice3, self), saturationEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateTurbulenceEffect(self: *const T, turbulenceEffect: ?*?*IDCompositionTurbulenceEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateTurbulenceEffect(@ptrCast(*const IDCompositionDevice3, self), turbulenceEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateLinearTransferEffect(self: *const T, linearTransferEffect: ?*?*IDCompositionLinearTransferEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateLinearTransferEffect(@ptrCast(*const IDCompositionDevice3, self), linearTransferEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateTableTransferEffect(self: *const T, tableTransferEffect: ?*?*IDCompositionTableTransferEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateTableTransferEffect(@ptrCast(*const IDCompositionDevice3, self), tableTransferEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateCompositeEffect(self: *const T, compositeEffect: ?*?*IDCompositionCompositeEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateCompositeEffect(@ptrCast(*const IDCompositionDevice3, self), compositeEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateBlendEffect(self: *const T, blendEffect: ?*?*IDCompositionBlendEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateBlendEffect(@ptrCast(*const IDCompositionDevice3, self), blendEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateArithmeticCompositeEffect(self: *const T, arithmeticCompositeEffect: ?*?*IDCompositionArithmeticCompositeEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateArithmeticCompositeEffect(@ptrCast(*const IDCompositionDevice3, self), arithmeticCompositeEffect);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDevice3_CreateAffineTransform2DEffect(self: *const T, affineTransform2dEffect: ?*?*IDCompositionAffineTransform2DEffect) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDevice3.VTable, self.vtable).CreateAffineTransform2DEffect(@ptrCast(*const IDCompositionDevice3, self), affineTransform2dEffect);
}
};}
pub usingnamespace MethodMixin(@This());
};
// TODO: this type is limited to platform 'windows8.0'
const IID_IDCompositionFilterEffect_Value = Guid.initString("30c421d5-8cb2-4e9f-b133-37be270d4ac2");
pub const IID_IDCompositionFilterEffect = &IID_IDCompositionFilterEffect_Value;
pub const IDCompositionFilterEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionEffect.VTable,
SetInput: fn(
self: *const IDCompositionFilterEffect,
index: u32,
input: ?*IUnknown,
flags: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionFilterEffect_SetInput(self: *const T, index: u32, input: ?*IUnknown, flags: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionFilterEffect.VTable, self.vtable).SetInput(@ptrCast(*const IDCompositionFilterEffect, self), index, input, flags);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionGaussianBlurEffect_Value = Guid.initString("45d4d0b7-1bd4-454e-8894-2bfa68443033");
pub const IID_IDCompositionGaussianBlurEffect = &IID_IDCompositionGaussianBlurEffect_Value;
pub const IDCompositionGaussianBlurEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetStandardDeviation: fn(
self: *const IDCompositionGaussianBlurEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetStandardDeviation1: fn(
self: *const IDCompositionGaussianBlurEffect,
amount: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBorderMode: fn(
self: *const IDCompositionGaussianBlurEffect,
mode: D2D1_BORDER_MODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionGaussianBlurEffect_SetStandardDeviation(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionGaussianBlurEffect.VTable, self.vtable).SetStandardDeviation(@ptrCast(*const IDCompositionGaussianBlurEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionGaussianBlurEffect_SetStandardDeviation1(self: *const T, amount: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionGaussianBlurEffect.VTable, self.vtable).SetStandardDeviation(@ptrCast(*const IDCompositionGaussianBlurEffect, self), amount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionGaussianBlurEffect_SetBorderMode(self: *const T, mode: D2D1_BORDER_MODE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionGaussianBlurEffect.VTable, self.vtable).SetBorderMode(@ptrCast(*const IDCompositionGaussianBlurEffect, self), mode);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionBrightnessEffect_Value = Guid.initString("6027496e-cb3a-49ab-934f-d798da4f7da6");
pub const IID_IDCompositionBrightnessEffect = &IID_IDCompositionBrightnessEffect_Value;
pub const IDCompositionBrightnessEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetWhitePoint: fn(
self: *const IDCompositionBrightnessEffect,
whitePoint: ?*const D2D_VECTOR_2F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlackPoint: fn(
self: *const IDCompositionBrightnessEffect,
blackPoint: ?*const D2D_VECTOR_2F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetWhitePointX: fn(
self: *const IDCompositionBrightnessEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetWhitePointX1: fn(
self: *const IDCompositionBrightnessEffect,
whitePointX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetWhitePointY: fn(
self: *const IDCompositionBrightnessEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetWhitePointY1: fn(
self: *const IDCompositionBrightnessEffect,
whitePointY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlackPointX: fn(
self: *const IDCompositionBrightnessEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlackPointX1: fn(
self: *const IDCompositionBrightnessEffect,
blackPointX: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlackPointY: fn(
self: *const IDCompositionBrightnessEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlackPointY1: fn(
self: *const IDCompositionBrightnessEffect,
blackPointY: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionBrightnessEffect_SetWhitePoint(self: *const T, whitePoint: ?*const D2D_VECTOR_2F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionBrightnessEffect.VTable, self.vtable).SetWhitePoint(@ptrCast(*const IDCompositionBrightnessEffect, self), whitePoint);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionBrightnessEffect_SetBlackPoint(self: *const T, blackPoint: ?*const D2D_VECTOR_2F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionBrightnessEffect.VTable, self.vtable).SetBlackPoint(@ptrCast(*const IDCompositionBrightnessEffect, self), blackPoint);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionBrightnessEffect_SetWhitePointX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionBrightnessEffect.VTable, self.vtable).SetWhitePointX(@ptrCast(*const IDCompositionBrightnessEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionBrightnessEffect_SetWhitePointX1(self: *const T, whitePointX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionBrightnessEffect.VTable, self.vtable).SetWhitePointX(@ptrCast(*const IDCompositionBrightnessEffect, self), whitePointX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionBrightnessEffect_SetWhitePointY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionBrightnessEffect.VTable, self.vtable).SetWhitePointY(@ptrCast(*const IDCompositionBrightnessEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionBrightnessEffect_SetWhitePointY1(self: *const T, whitePointY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionBrightnessEffect.VTable, self.vtable).SetWhitePointY(@ptrCast(*const IDCompositionBrightnessEffect, self), whitePointY);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionBrightnessEffect_SetBlackPointX(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionBrightnessEffect.VTable, self.vtable).SetBlackPointX(@ptrCast(*const IDCompositionBrightnessEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionBrightnessEffect_SetBlackPointX1(self: *const T, blackPointX: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionBrightnessEffect.VTable, self.vtable).SetBlackPointX(@ptrCast(*const IDCompositionBrightnessEffect, self), blackPointX);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionBrightnessEffect_SetBlackPointY(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionBrightnessEffect.VTable, self.vtable).SetBlackPointY(@ptrCast(*const IDCompositionBrightnessEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionBrightnessEffect_SetBlackPointY1(self: *const T, blackPointY: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionBrightnessEffect.VTable, self.vtable).SetBlackPointY(@ptrCast(*const IDCompositionBrightnessEffect, self), blackPointY);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionColorMatrixEffect_Value = Guid.initString("c1170a22-3ce2-4966-90d4-55408bfc84c4");
pub const IID_IDCompositionColorMatrixEffect = &IID_IDCompositionColorMatrixEffect_Value;
pub const IDCompositionColorMatrixEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetMatrix: fn(
self: *const IDCompositionColorMatrixEffect,
matrix: ?*const D2D_MATRIX_5X4_F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMatrixElement: fn(
self: *const IDCompositionColorMatrixEffect,
row: i32,
column: i32,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetMatrixElement1: fn(
self: *const IDCompositionColorMatrixEffect,
row: i32,
column: i32,
value: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlphaMode: fn(
self: *const IDCompositionColorMatrixEffect,
mode: D2D1_COLORMATRIX_ALPHA_MODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetClampOutput: fn(
self: *const IDCompositionColorMatrixEffect,
clamp: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionColorMatrixEffect_SetMatrix(self: *const T, matrix: ?*const D2D_MATRIX_5X4_F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionColorMatrixEffect.VTable, self.vtable).SetMatrix(@ptrCast(*const IDCompositionColorMatrixEffect, self), matrix);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionColorMatrixEffect_SetMatrixElement(self: *const T, row: i32, column: i32, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionColorMatrixEffect.VTable, self.vtable).SetMatrixElement(@ptrCast(*const IDCompositionColorMatrixEffect, self), row, column, animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionColorMatrixEffect_SetMatrixElement1(self: *const T, row: i32, column: i32, value: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionColorMatrixEffect.VTable, self.vtable).SetMatrixElement(@ptrCast(*const IDCompositionColorMatrixEffect, self), row, column, value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionColorMatrixEffect_SetAlphaMode(self: *const T, mode: D2D1_COLORMATRIX_ALPHA_MODE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionColorMatrixEffect.VTable, self.vtable).SetAlphaMode(@ptrCast(*const IDCompositionColorMatrixEffect, self), mode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionColorMatrixEffect_SetClampOutput(self: *const T, clamp: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionColorMatrixEffect.VTable, self.vtable).SetClampOutput(@ptrCast(*const IDCompositionColorMatrixEffect, self), clamp);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionShadowEffect_Value = Guid.initString("4ad18ac0-cfd2-4c2f-bb62-96e54fdb6879");
pub const IID_IDCompositionShadowEffect = &IID_IDCompositionShadowEffect_Value;
pub const IDCompositionShadowEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetStandardDeviation: fn(
self: *const IDCompositionShadowEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetStandardDeviation1: fn(
self: *const IDCompositionShadowEffect,
amount: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetColor: fn(
self: *const IDCompositionShadowEffect,
color: ?*const D2D_VECTOR_4F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRed: fn(
self: *const IDCompositionShadowEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRed1: fn(
self: *const IDCompositionShadowEffect,
amount: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGreen: fn(
self: *const IDCompositionShadowEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGreen1: fn(
self: *const IDCompositionShadowEffect,
amount: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlue: fn(
self: *const IDCompositionShadowEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlue1: fn(
self: *const IDCompositionShadowEffect,
amount: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlpha: fn(
self: *const IDCompositionShadowEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlpha1: fn(
self: *const IDCompositionShadowEffect,
amount: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionShadowEffect_SetStandardDeviation(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionShadowEffect.VTable, self.vtable).SetStandardDeviation(@ptrCast(*const IDCompositionShadowEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionShadowEffect_SetStandardDeviation1(self: *const T, amount: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionShadowEffect.VTable, self.vtable).SetStandardDeviation(@ptrCast(*const IDCompositionShadowEffect, self), amount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionShadowEffect_SetColor(self: *const T, color: ?*const D2D_VECTOR_4F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionShadowEffect.VTable, self.vtable).SetColor(@ptrCast(*const IDCompositionShadowEffect, self), color);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionShadowEffect_SetRed(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionShadowEffect.VTable, self.vtable).SetRed(@ptrCast(*const IDCompositionShadowEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionShadowEffect_SetRed1(self: *const T, amount: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionShadowEffect.VTable, self.vtable).SetRed(@ptrCast(*const IDCompositionShadowEffect, self), amount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionShadowEffect_SetGreen(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionShadowEffect.VTable, self.vtable).SetGreen(@ptrCast(*const IDCompositionShadowEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionShadowEffect_SetGreen1(self: *const T, amount: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionShadowEffect.VTable, self.vtable).SetGreen(@ptrCast(*const IDCompositionShadowEffect, self), amount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionShadowEffect_SetBlue(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionShadowEffect.VTable, self.vtable).SetBlue(@ptrCast(*const IDCompositionShadowEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionShadowEffect_SetBlue1(self: *const T, amount: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionShadowEffect.VTable, self.vtable).SetBlue(@ptrCast(*const IDCompositionShadowEffect, self), amount);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionShadowEffect_SetAlpha(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionShadowEffect.VTable, self.vtable).SetAlpha(@ptrCast(*const IDCompositionShadowEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionShadowEffect_SetAlpha1(self: *const T, amount: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionShadowEffect.VTable, self.vtable).SetAlpha(@ptrCast(*const IDCompositionShadowEffect, self), amount);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionHueRotationEffect_Value = Guid.initString("6db9f920-0770-4781-b0c6-381912f9d167");
pub const IID_IDCompositionHueRotationEffect = &IID_IDCompositionHueRotationEffect_Value;
pub const IDCompositionHueRotationEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetAngle: fn(
self: *const IDCompositionHueRotationEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAngle1: fn(
self: *const IDCompositionHueRotationEffect,
amountDegrees: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionHueRotationEffect_SetAngle(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionHueRotationEffect.VTable, self.vtable).SetAngle(@ptrCast(*const IDCompositionHueRotationEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionHueRotationEffect_SetAngle1(self: *const T, amountDegrees: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionHueRotationEffect.VTable, self.vtable).SetAngle(@ptrCast(*const IDCompositionHueRotationEffect, self), amountDegrees);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionSaturationEffect_Value = Guid.initString("a08debda-3258-4fa4-9f16-9174d3fe93b1");
pub const IID_IDCompositionSaturationEffect = &IID_IDCompositionSaturationEffect_Value;
pub const IDCompositionSaturationEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetSaturation: fn(
self: *const IDCompositionSaturationEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSaturation1: fn(
self: *const IDCompositionSaturationEffect,
ratio: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSaturationEffect_SetSaturation(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSaturationEffect.VTable, self.vtable).SetSaturation(@ptrCast(*const IDCompositionSaturationEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionSaturationEffect_SetSaturation1(self: *const T, ratio: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionSaturationEffect.VTable, self.vtable).SetSaturation(@ptrCast(*const IDCompositionSaturationEffect, self), ratio);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionTurbulenceEffect_Value = Guid.initString("a6a55bda-c09c-49f3-9193-a41922c89715");
pub const IID_IDCompositionTurbulenceEffect = &IID_IDCompositionTurbulenceEffect_Value;
pub const IDCompositionTurbulenceEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetOffset: fn(
self: *const IDCompositionTurbulenceEffect,
offset: ?*const D2D_VECTOR_2F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBaseFrequency: fn(
self: *const IDCompositionTurbulenceEffect,
frequency: ?*const D2D_VECTOR_2F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSize: fn(
self: *const IDCompositionTurbulenceEffect,
size: ?*const D2D_VECTOR_2F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetNumOctaves: fn(
self: *const IDCompositionTurbulenceEffect,
numOctaves: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSeed: fn(
self: *const IDCompositionTurbulenceEffect,
seed: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetNoise: fn(
self: *const IDCompositionTurbulenceEffect,
noise: D2D1_TURBULENCE_NOISE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetStitchable: fn(
self: *const IDCompositionTurbulenceEffect,
stitchable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTurbulenceEffect_SetOffset(self: *const T, offset: ?*const D2D_VECTOR_2F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTurbulenceEffect.VTable, self.vtable).SetOffset(@ptrCast(*const IDCompositionTurbulenceEffect, self), offset);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTurbulenceEffect_SetBaseFrequency(self: *const T, frequency: ?*const D2D_VECTOR_2F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTurbulenceEffect.VTable, self.vtable).SetBaseFrequency(@ptrCast(*const IDCompositionTurbulenceEffect, self), frequency);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTurbulenceEffect_SetSize(self: *const T, size: ?*const D2D_VECTOR_2F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTurbulenceEffect.VTable, self.vtable).SetSize(@ptrCast(*const IDCompositionTurbulenceEffect, self), size);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTurbulenceEffect_SetNumOctaves(self: *const T, numOctaves: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTurbulenceEffect.VTable, self.vtable).SetNumOctaves(@ptrCast(*const IDCompositionTurbulenceEffect, self), numOctaves);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTurbulenceEffect_SetSeed(self: *const T, seed: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTurbulenceEffect.VTable, self.vtable).SetSeed(@ptrCast(*const IDCompositionTurbulenceEffect, self), seed);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTurbulenceEffect_SetNoise(self: *const T, noise: D2D1_TURBULENCE_NOISE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTurbulenceEffect.VTable, self.vtable).SetNoise(@ptrCast(*const IDCompositionTurbulenceEffect, self), noise);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTurbulenceEffect_SetStitchable(self: *const T, stitchable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTurbulenceEffect.VTable, self.vtable).SetStitchable(@ptrCast(*const IDCompositionTurbulenceEffect, self), stitchable);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionLinearTransferEffect_Value = Guid.initString("4305ee5b-c4a0-4c88-9385-67124e017683");
pub const IID_IDCompositionLinearTransferEffect = &IID_IDCompositionLinearTransferEffect_Value;
pub const IDCompositionLinearTransferEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetRedYIntercept: fn(
self: *const IDCompositionLinearTransferEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRedYIntercept1: fn(
self: *const IDCompositionLinearTransferEffect,
redYIntercept: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRedSlope: fn(
self: *const IDCompositionLinearTransferEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRedSlope1: fn(
self: *const IDCompositionLinearTransferEffect,
redSlope: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRedDisable: fn(
self: *const IDCompositionLinearTransferEffect,
redDisable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGreenYIntercept: fn(
self: *const IDCompositionLinearTransferEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGreenYIntercept1: fn(
self: *const IDCompositionLinearTransferEffect,
greenYIntercept: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGreenSlope: fn(
self: *const IDCompositionLinearTransferEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGreenSlope1: fn(
self: *const IDCompositionLinearTransferEffect,
greenSlope: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGreenDisable: fn(
self: *const IDCompositionLinearTransferEffect,
greenDisable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlueYIntercept: fn(
self: *const IDCompositionLinearTransferEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlueYIntercept1: fn(
self: *const IDCompositionLinearTransferEffect,
blueYIntercept: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlueSlope: fn(
self: *const IDCompositionLinearTransferEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlueSlope1: fn(
self: *const IDCompositionLinearTransferEffect,
blueSlope: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlueDisable: fn(
self: *const IDCompositionLinearTransferEffect,
blueDisable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlphaYIntercept: fn(
self: *const IDCompositionLinearTransferEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlphaYIntercept1: fn(
self: *const IDCompositionLinearTransferEffect,
alphaYIntercept: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlphaSlope: fn(
self: *const IDCompositionLinearTransferEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlphaSlope1: fn(
self: *const IDCompositionLinearTransferEffect,
alphaSlope: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlphaDisable: fn(
self: *const IDCompositionLinearTransferEffect,
alphaDisable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetClampOutput: fn(
self: *const IDCompositionLinearTransferEffect,
clampOutput: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetRedYIntercept(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetRedYIntercept(@ptrCast(*const IDCompositionLinearTransferEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetRedYIntercept1(self: *const T, redYIntercept: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetRedYIntercept(@ptrCast(*const IDCompositionLinearTransferEffect, self), redYIntercept);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetRedSlope(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetRedSlope(@ptrCast(*const IDCompositionLinearTransferEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetRedSlope1(self: *const T, redSlope: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetRedSlope(@ptrCast(*const IDCompositionLinearTransferEffect, self), redSlope);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetRedDisable(self: *const T, redDisable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetRedDisable(@ptrCast(*const IDCompositionLinearTransferEffect, self), redDisable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetGreenYIntercept(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetGreenYIntercept(@ptrCast(*const IDCompositionLinearTransferEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetGreenYIntercept1(self: *const T, greenYIntercept: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetGreenYIntercept(@ptrCast(*const IDCompositionLinearTransferEffect, self), greenYIntercept);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetGreenSlope(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetGreenSlope(@ptrCast(*const IDCompositionLinearTransferEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetGreenSlope1(self: *const T, greenSlope: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetGreenSlope(@ptrCast(*const IDCompositionLinearTransferEffect, self), greenSlope);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetGreenDisable(self: *const T, greenDisable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetGreenDisable(@ptrCast(*const IDCompositionLinearTransferEffect, self), greenDisable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetBlueYIntercept(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetBlueYIntercept(@ptrCast(*const IDCompositionLinearTransferEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetBlueYIntercept1(self: *const T, blueYIntercept: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetBlueYIntercept(@ptrCast(*const IDCompositionLinearTransferEffect, self), blueYIntercept);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetBlueSlope(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetBlueSlope(@ptrCast(*const IDCompositionLinearTransferEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetBlueSlope1(self: *const T, blueSlope: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetBlueSlope(@ptrCast(*const IDCompositionLinearTransferEffect, self), blueSlope);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetBlueDisable(self: *const T, blueDisable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetBlueDisable(@ptrCast(*const IDCompositionLinearTransferEffect, self), blueDisable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetAlphaYIntercept(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetAlphaYIntercept(@ptrCast(*const IDCompositionLinearTransferEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetAlphaYIntercept1(self: *const T, alphaYIntercept: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetAlphaYIntercept(@ptrCast(*const IDCompositionLinearTransferEffect, self), alphaYIntercept);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetAlphaSlope(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetAlphaSlope(@ptrCast(*const IDCompositionLinearTransferEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetAlphaSlope1(self: *const T, alphaSlope: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetAlphaSlope(@ptrCast(*const IDCompositionLinearTransferEffect, self), alphaSlope);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetAlphaDisable(self: *const T, alphaDisable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetAlphaDisable(@ptrCast(*const IDCompositionLinearTransferEffect, self), alphaDisable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionLinearTransferEffect_SetClampOutput(self: *const T, clampOutput: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionLinearTransferEffect.VTable, self.vtable).SetClampOutput(@ptrCast(*const IDCompositionLinearTransferEffect, self), clampOutput);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionTableTransferEffect_Value = Guid.initString("9b7e82e2-69c5-4eb4-a5f5-a7033f5132cd");
pub const IID_IDCompositionTableTransferEffect = &IID_IDCompositionTableTransferEffect_Value;
pub const IDCompositionTableTransferEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetRedTable: fn(
self: *const IDCompositionTableTransferEffect,
tableValues: [*]const f32,
count: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGreenTable: fn(
self: *const IDCompositionTableTransferEffect,
tableValues: [*]const f32,
count: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlueTable: fn(
self: *const IDCompositionTableTransferEffect,
tableValues: [*]const f32,
count: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlphaTable: fn(
self: *const IDCompositionTableTransferEffect,
tableValues: [*]const f32,
count: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRedDisable: fn(
self: *const IDCompositionTableTransferEffect,
redDisable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGreenDisable: fn(
self: *const IDCompositionTableTransferEffect,
greenDisable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlueDisable: fn(
self: *const IDCompositionTableTransferEffect,
blueDisable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlphaDisable: fn(
self: *const IDCompositionTableTransferEffect,
alphaDisable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetClampOutput: fn(
self: *const IDCompositionTableTransferEffect,
clampOutput: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRedTableValue: fn(
self: *const IDCompositionTableTransferEffect,
index: u32,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetRedTableValue1: fn(
self: *const IDCompositionTableTransferEffect,
index: u32,
value: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGreenTableValue: fn(
self: *const IDCompositionTableTransferEffect,
index: u32,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetGreenTableValue1: fn(
self: *const IDCompositionTableTransferEffect,
index: u32,
value: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlueTableValue: fn(
self: *const IDCompositionTableTransferEffect,
index: u32,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBlueTableValue1: fn(
self: *const IDCompositionTableTransferEffect,
index: u32,
value: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlphaTableValue: fn(
self: *const IDCompositionTableTransferEffect,
index: u32,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetAlphaTableValue1: fn(
self: *const IDCompositionTableTransferEffect,
index: u32,
value: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetRedTable(self: *const T, tableValues: [*]const f32, count: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetRedTable(@ptrCast(*const IDCompositionTableTransferEffect, self), tableValues, count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetGreenTable(self: *const T, tableValues: [*]const f32, count: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetGreenTable(@ptrCast(*const IDCompositionTableTransferEffect, self), tableValues, count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetBlueTable(self: *const T, tableValues: [*]const f32, count: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetBlueTable(@ptrCast(*const IDCompositionTableTransferEffect, self), tableValues, count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetAlphaTable(self: *const T, tableValues: [*]const f32, count: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetAlphaTable(@ptrCast(*const IDCompositionTableTransferEffect, self), tableValues, count);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetRedDisable(self: *const T, redDisable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetRedDisable(@ptrCast(*const IDCompositionTableTransferEffect, self), redDisable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetGreenDisable(self: *const T, greenDisable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetGreenDisable(@ptrCast(*const IDCompositionTableTransferEffect, self), greenDisable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetBlueDisable(self: *const T, blueDisable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetBlueDisable(@ptrCast(*const IDCompositionTableTransferEffect, self), blueDisable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetAlphaDisable(self: *const T, alphaDisable: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetAlphaDisable(@ptrCast(*const IDCompositionTableTransferEffect, self), alphaDisable);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetClampOutput(self: *const T, clampOutput: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetClampOutput(@ptrCast(*const IDCompositionTableTransferEffect, self), clampOutput);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetRedTableValue(self: *const T, index: u32, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetRedTableValue(@ptrCast(*const IDCompositionTableTransferEffect, self), index, animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetRedTableValue1(self: *const T, index: u32, value: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetRedTableValue(@ptrCast(*const IDCompositionTableTransferEffect, self), index, value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetGreenTableValue(self: *const T, index: u32, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetGreenTableValue(@ptrCast(*const IDCompositionTableTransferEffect, self), index, animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetGreenTableValue1(self: *const T, index: u32, value: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetGreenTableValue(@ptrCast(*const IDCompositionTableTransferEffect, self), index, value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetBlueTableValue(self: *const T, index: u32, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetBlueTableValue(@ptrCast(*const IDCompositionTableTransferEffect, self), index, animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetBlueTableValue1(self: *const T, index: u32, value: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetBlueTableValue(@ptrCast(*const IDCompositionTableTransferEffect, self), index, value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetAlphaTableValue(self: *const T, index: u32, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetAlphaTableValue(@ptrCast(*const IDCompositionTableTransferEffect, self), index, animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionTableTransferEffect_SetAlphaTableValue1(self: *const T, index: u32, value: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionTableTransferEffect.VTable, self.vtable).SetAlphaTableValue(@ptrCast(*const IDCompositionTableTransferEffect, self), index, value);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionCompositeEffect_Value = Guid.initString("576616c0-a231-494d-a38d-00fd5ec4db46");
pub const IID_IDCompositionCompositeEffect = &IID_IDCompositionCompositeEffect_Value;
pub const IDCompositionCompositeEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetMode: fn(
self: *const IDCompositionCompositeEffect,
mode: D2D1_COMPOSITE_MODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionCompositeEffect_SetMode(self: *const T, mode: D2D1_COMPOSITE_MODE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionCompositeEffect.VTable, self.vtable).SetMode(@ptrCast(*const IDCompositionCompositeEffect, self), mode);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionBlendEffect_Value = Guid.initString("33ecdc0a-578a-4a11-9c14-0cb90517f9c5");
pub const IID_IDCompositionBlendEffect = &IID_IDCompositionBlendEffect_Value;
pub const IDCompositionBlendEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetMode: fn(
self: *const IDCompositionBlendEffect,
mode: D2D1_BLEND_MODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionBlendEffect_SetMode(self: *const T, mode: D2D1_BLEND_MODE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionBlendEffect.VTable, self.vtable).SetMode(@ptrCast(*const IDCompositionBlendEffect, self), mode);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionArithmeticCompositeEffect_Value = Guid.initString("3b67dfa8-e3dd-4e61-b640-46c2f3d739dc");
pub const IID_IDCompositionArithmeticCompositeEffect = &IID_IDCompositionArithmeticCompositeEffect_Value;
pub const IDCompositionArithmeticCompositeEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetCoefficients: fn(
self: *const IDCompositionArithmeticCompositeEffect,
coefficients: ?*const D2D_VECTOR_4F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetClampOutput: fn(
self: *const IDCompositionArithmeticCompositeEffect,
clampoutput: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCoefficient1: fn(
self: *const IDCompositionArithmeticCompositeEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCoefficient11: fn(
self: *const IDCompositionArithmeticCompositeEffect,
Coeffcient1: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCoefficient2: fn(
self: *const IDCompositionArithmeticCompositeEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCoefficient21: fn(
self: *const IDCompositionArithmeticCompositeEffect,
Coefficient2: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCoefficient3: fn(
self: *const IDCompositionArithmeticCompositeEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCoefficient31: fn(
self: *const IDCompositionArithmeticCompositeEffect,
Coefficient3: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCoefficient4: fn(
self: *const IDCompositionArithmeticCompositeEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetCoefficient41: fn(
self: *const IDCompositionArithmeticCompositeEffect,
Coefficient4: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionArithmeticCompositeEffect_SetCoefficients(self: *const T, coefficients: ?*const D2D_VECTOR_4F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionArithmeticCompositeEffect.VTable, self.vtable).SetCoefficients(@ptrCast(*const IDCompositionArithmeticCompositeEffect, self), coefficients);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionArithmeticCompositeEffect_SetClampOutput(self: *const T, clampoutput: BOOL) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionArithmeticCompositeEffect.VTable, self.vtable).SetClampOutput(@ptrCast(*const IDCompositionArithmeticCompositeEffect, self), clampoutput);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionArithmeticCompositeEffect_SetCoefficient1(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionArithmeticCompositeEffect.VTable, self.vtable).SetCoefficient1(@ptrCast(*const IDCompositionArithmeticCompositeEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionArithmeticCompositeEffect_SetCoefficient11(self: *const T, Coeffcient1: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionArithmeticCompositeEffect.VTable, self.vtable).SetCoefficient1(@ptrCast(*const IDCompositionArithmeticCompositeEffect, self), Coeffcient1);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionArithmeticCompositeEffect_SetCoefficient2(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionArithmeticCompositeEffect.VTable, self.vtable).SetCoefficient2(@ptrCast(*const IDCompositionArithmeticCompositeEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionArithmeticCompositeEffect_SetCoefficient21(self: *const T, Coefficient2: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionArithmeticCompositeEffect.VTable, self.vtable).SetCoefficient2(@ptrCast(*const IDCompositionArithmeticCompositeEffect, self), Coefficient2);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionArithmeticCompositeEffect_SetCoefficient3(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionArithmeticCompositeEffect.VTable, self.vtable).SetCoefficient3(@ptrCast(*const IDCompositionArithmeticCompositeEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionArithmeticCompositeEffect_SetCoefficient31(self: *const T, Coefficient3: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionArithmeticCompositeEffect.VTable, self.vtable).SetCoefficient3(@ptrCast(*const IDCompositionArithmeticCompositeEffect, self), Coefficient3);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionArithmeticCompositeEffect_SetCoefficient4(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionArithmeticCompositeEffect.VTable, self.vtable).SetCoefficient4(@ptrCast(*const IDCompositionArithmeticCompositeEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionArithmeticCompositeEffect_SetCoefficient41(self: *const T, Coefficient4: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionArithmeticCompositeEffect.VTable, self.vtable).SetCoefficient4(@ptrCast(*const IDCompositionArithmeticCompositeEffect, self), Coefficient4);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionAffineTransform2DEffect_Value = Guid.initString("0b74b9e8-cdd6-492f-bbbc-5ed32157026d");
pub const IID_IDCompositionAffineTransform2DEffect = &IID_IDCompositionAffineTransform2DEffect_Value;
pub const IDCompositionAffineTransform2DEffect = extern struct {
pub const VTable = extern struct {
base: IDCompositionFilterEffect.VTable,
SetInterpolationMode: fn(
self: *const IDCompositionAffineTransform2DEffect,
interpolationMode: D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetBorderMode: fn(
self: *const IDCompositionAffineTransform2DEffect,
borderMode: D2D1_BORDER_MODE,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTransformMatrix: fn(
self: *const IDCompositionAffineTransform2DEffect,
transformMatrix: ?*const D2D_MATRIX_3X2_F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTransformMatrixElement: fn(
self: *const IDCompositionAffineTransform2DEffect,
row: i32,
column: i32,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetTransformMatrixElement1: fn(
self: *const IDCompositionAffineTransform2DEffect,
row: i32,
column: i32,
value: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSharpness: fn(
self: *const IDCompositionAffineTransform2DEffect,
animation: ?*IDCompositionAnimation,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
SetSharpness1: fn(
self: *const IDCompositionAffineTransform2DEffect,
sharpness: f32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IDCompositionFilterEffect.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAffineTransform2DEffect_SetInterpolationMode(self: *const T, interpolationMode: D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAffineTransform2DEffect.VTable, self.vtable).SetInterpolationMode(@ptrCast(*const IDCompositionAffineTransform2DEffect, self), interpolationMode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAffineTransform2DEffect_SetBorderMode(self: *const T, borderMode: D2D1_BORDER_MODE) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAffineTransform2DEffect.VTable, self.vtable).SetBorderMode(@ptrCast(*const IDCompositionAffineTransform2DEffect, self), borderMode);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAffineTransform2DEffect_SetTransformMatrix(self: *const T, transformMatrix: ?*const D2D_MATRIX_3X2_F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAffineTransform2DEffect.VTable, self.vtable).SetTransformMatrix(@ptrCast(*const IDCompositionAffineTransform2DEffect, self), transformMatrix);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAffineTransform2DEffect_SetTransformMatrixElement(self: *const T, row: i32, column: i32, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAffineTransform2DEffect.VTable, self.vtable).SetTransformMatrixElement(@ptrCast(*const IDCompositionAffineTransform2DEffect, self), row, column, animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAffineTransform2DEffect_SetTransformMatrixElement1(self: *const T, row: i32, column: i32, value: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAffineTransform2DEffect.VTable, self.vtable).SetTransformMatrixElement(@ptrCast(*const IDCompositionAffineTransform2DEffect, self), row, column, value);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAffineTransform2DEffect_SetSharpness(self: *const T, animation: ?*IDCompositionAnimation) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAffineTransform2DEffect.VTable, self.vtable).SetSharpness(@ptrCast(*const IDCompositionAffineTransform2DEffect, self), animation);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionAffineTransform2DEffect_SetSharpness1(self: *const T, sharpness: f32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionAffineTransform2DEffect.VTable, self.vtable).SetSharpness(@ptrCast(*const IDCompositionAffineTransform2DEffect, self), sharpness);
}
};}
pub usingnamespace MethodMixin(@This());
};
pub const DCompositionInkTrailPoint = extern struct {
x: f32,
y: f32,
radius: f32,
};
const IID_IDCompositionDelegatedInkTrail_Value = Guid.initString("c2448e9b-547d-4057-8cf5-8144ede1c2da");
pub const IID_IDCompositionDelegatedInkTrail = &IID_IDCompositionDelegatedInkTrail_Value;
pub const IDCompositionDelegatedInkTrail = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
AddTrailPoints: fn(
self: *const IDCompositionDelegatedInkTrail,
inkPoints: [*]const DCompositionInkTrailPoint,
inkPointsCount: u32,
generationId: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
AddTrailPointsWithPrediction: fn(
self: *const IDCompositionDelegatedInkTrail,
inkPoints: [*]const DCompositionInkTrailPoint,
inkPointsCount: u32,
predictedInkPoints: [*]const DCompositionInkTrailPoint,
predictedInkPointsCount: u32,
generationId: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
RemoveTrailPoints: fn(
self: *const IDCompositionDelegatedInkTrail,
generationId: u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
StartNewTrail: fn(
self: *const IDCompositionDelegatedInkTrail,
color: ?*const D2D1_COLOR_F,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDelegatedInkTrail_AddTrailPoints(self: *const T, inkPoints: [*]const DCompositionInkTrailPoint, inkPointsCount: u32, generationId: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDelegatedInkTrail.VTable, self.vtable).AddTrailPoints(@ptrCast(*const IDCompositionDelegatedInkTrail, self), inkPoints, inkPointsCount, generationId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDelegatedInkTrail_AddTrailPointsWithPrediction(self: *const T, inkPoints: [*]const DCompositionInkTrailPoint, inkPointsCount: u32, predictedInkPoints: [*]const DCompositionInkTrailPoint, predictedInkPointsCount: u32, generationId: ?*u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDelegatedInkTrail.VTable, self.vtable).AddTrailPointsWithPrediction(@ptrCast(*const IDCompositionDelegatedInkTrail, self), inkPoints, inkPointsCount, predictedInkPoints, predictedInkPointsCount, generationId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDelegatedInkTrail_RemoveTrailPoints(self: *const T, generationId: u32) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDelegatedInkTrail.VTable, self.vtable).RemoveTrailPoints(@ptrCast(*const IDCompositionDelegatedInkTrail, self), generationId);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionDelegatedInkTrail_StartNewTrail(self: *const T, color: ?*const D2D1_COLOR_F) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionDelegatedInkTrail.VTable, self.vtable).StartNewTrail(@ptrCast(*const IDCompositionDelegatedInkTrail, self), color);
}
};}
pub usingnamespace MethodMixin(@This());
};
const IID_IDCompositionInkTrailDevice_Value = Guid.initString("df0c7cec-cdeb-4d4a-b91c-721bf22f4e6c");
pub const IID_IDCompositionInkTrailDevice = &IID_IDCompositionInkTrailDevice_Value;
pub const IDCompositionInkTrailDevice = extern struct {
pub const VTable = extern struct {
base: IUnknown.VTable,
CreateDelegatedInkTrail: fn(
self: *const IDCompositionInkTrailDevice,
inkTrail: ?*?*IDCompositionDelegatedInkTrail,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
CreateDelegatedInkTrailForSwapChain: fn(
self: *const IDCompositionInkTrailDevice,
swapChain: ?*IUnknown,
inkTrail: ?*?*IDCompositionDelegatedInkTrail,
) callconv(@import("std").os.windows.WINAPI) HRESULT,
};
vtable: *const VTable,
pub fn MethodMixin(comptime T: type) type { return struct {
pub usingnamespace IUnknown.MethodMixin(T);
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionInkTrailDevice_CreateDelegatedInkTrail(self: *const T, inkTrail: ?*?*IDCompositionDelegatedInkTrail) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionInkTrailDevice.VTable, self.vtable).CreateDelegatedInkTrail(@ptrCast(*const IDCompositionInkTrailDevice, self), inkTrail);
}
// NOTE: method is namespaced with interface name to avoid conflicts for now
pub fn IDCompositionInkTrailDevice_CreateDelegatedInkTrailForSwapChain(self: *const T, swapChain: ?*IUnknown, inkTrail: ?*?*IDCompositionDelegatedInkTrail) callconv(.Inline) HRESULT {
return @ptrCast(*const IDCompositionInkTrailDevice.VTable, self.vtable).CreateDelegatedInkTrailForSwapChain(@ptrCast(*const IDCompositionInkTrailDevice, self), swapChain, inkTrail);
}
};}
pub usingnamespace MethodMixin(@This());
};
//--------------------------------------------------------------------------------
// Section: Functions (11)
//--------------------------------------------------------------------------------
// TODO: this type is limited to platform 'windows8.0'
pub extern "dcomp" fn DCompositionCreateDevice(
dxgiDevice: ?*IDXGIDevice,
iid: ?*const Guid,
dcompositionDevice: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.1'
pub extern "dcomp" fn DCompositionCreateDevice2(
renderingDevice: ?*IUnknown,
iid: ?*const Guid,
dcompositionDevice: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "dcomp" fn DCompositionCreateDevice3(
renderingDevice: ?*IUnknown,
iid: ?*const Guid,
dcompositionDevice: ?*?*anyopaque,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
// TODO: this type is limited to platform 'windows8.0'
pub extern "dcomp" fn DCompositionCreateSurfaceHandle(
desiredAccess: u32,
securityAttributes: ?*SECURITY_ATTRIBUTES,
surfaceHandle: ?*?HANDLE,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "dcomp" fn DCompositionAttachMouseWheelToHwnd(
visual: ?*IDCompositionVisual,
hwnd: ?HWND,
enable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "dcomp" fn DCompositionAttachMouseDragToHwnd(
visual: ?*IDCompositionVisual,
hwnd: ?HWND,
enable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "dcomp" fn DCompositionGetFrameId(
frameIdType: COMPOSITION_FRAME_ID_TYPE,
frameId: ?*u64,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "dcomp" fn DCompositionGetStatistics(
frameId: u64,
frameStats: ?*COMPOSITION_FRAME_STATS,
targetIdCount: u32,
targetIds: ?*COMPOSITION_TARGET_ID,
actualTargetIdCount: ?*u32,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "dcomp" fn DCompositionGetTargetStatistics(
frameId: u64,
targetId: ?*const COMPOSITION_TARGET_ID,
targetStats: ?*COMPOSITION_TARGET_STATS,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "dcomp" fn DCompositionBoostCompositorClock(
enable: BOOL,
) callconv(@import("std").os.windows.WINAPI) HRESULT;
pub extern "dcomp" fn DCompositionWaitForCompositorClock(
count: u32,
handles: ?[*]const ?HANDLE,
timeoutInMs: u32,
) callconv(@import("std").os.windows.WINAPI) u32;
//--------------------------------------------------------------------------------
// Section: Unicode Aliases (0)
//--------------------------------------------------------------------------------
const thismodule = @This();
pub usingnamespace switch (@import("../zig.zig").unicode_mode) {
.ansi => struct {
},
.wide => struct {
},
.unspecified => if (@import("builtin").is_test) struct {
} else struct {
},
};
//--------------------------------------------------------------------------------
// Section: Imports (29)
//--------------------------------------------------------------------------------
const Guid = @import("../zig.zig").Guid;
const BOOL = @import("../foundation.zig").BOOL;
const D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE = @import("../graphics.zig").D2D1_2DAFFINETRANSFORM_INTERPOLATION_MODE;
const D2D1_BLEND_MODE = @import("../graphics/direct2d/common.zig").D2D1_BLEND_MODE;
const D2D1_BORDER_MODE = @import("../graphics/direct2d/common.zig").D2D1_BORDER_MODE;
const D2D1_COLOR_F = @import("../graphics/direct2d/common.zig").D2D1_COLOR_F;
const D2D1_COLORMATRIX_ALPHA_MODE = @import("../graphics/direct2d/common.zig").D2D1_COLORMATRIX_ALPHA_MODE;
const D2D1_COMPOSITE_MODE = @import("../graphics/direct2d/common.zig").D2D1_COMPOSITE_MODE;
const D2D1_TURBULENCE_NOISE = @import("../graphics/direct2d/common.zig").D2D1_TURBULENCE_NOISE;
const D2D_MATRIX_3X2_F = @import("../graphics/direct2d/common.zig").D2D_MATRIX_3X2_F;
const D2D_MATRIX_4X4_F = @import("../graphics/direct2d/common.zig").D2D_MATRIX_4X4_F;
const D2D_MATRIX_5X4_F = @import("../graphics/direct2d/common.zig").D2D_MATRIX_5X4_F;
const D2D_RECT_F = @import("../graphics/direct2d/common.zig").D2D_RECT_F;
const D2D_VECTOR_2F = @import("../graphics/direct2d/common.zig").D2D_VECTOR_2F;
const D2D_VECTOR_4F = @import("../graphics/direct2d/common.zig").D2D_VECTOR_4F;
const D3DMATRIX = @import("../graphics/direct3d.zig").D3DMATRIX;
const DXGI_ALPHA_MODE = @import("../graphics/dxgi/common.zig").DXGI_ALPHA_MODE;
const DXGI_FORMAT = @import("../graphics/dxgi/common.zig").DXGI_FORMAT;
const DXGI_RATIONAL = @import("../graphics/dxgi/common.zig").DXGI_RATIONAL;
const HANDLE = @import("../foundation.zig").HANDLE;
const HRESULT = @import("../foundation.zig").HRESULT;
const HWND = @import("../foundation.zig").HWND;
const IDXGIDevice = @import("../graphics/dxgi.zig").IDXGIDevice;
const IUnknown = @import("../system/com.zig").IUnknown;
const LARGE_INTEGER = @import("../foundation.zig").LARGE_INTEGER;
const LUID = @import("../foundation.zig").LUID;
const POINT = @import("../foundation.zig").POINT;
const RECT = @import("../foundation.zig").RECT;
const SECURITY_ATTRIBUTES = @import("../security.zig").SECURITY_ATTRIBUTES;
test {
@setEvalBranchQuota(
@import("std").meta.declarations(@This()).len * 3
);
// reference all the pub declarations
if (!@import("builtin").is_test) return;
inline for (@import("std").meta.declarations(@This())) |decl| {
if (decl.is_pub) {
_ = decl;
}
}
} | win32/graphics/direct_composition.zig |
const std = @import("std");
const testing = std.testing;
pub const Map = struct {
pub const Navigation = enum {
Direction,
Waypoint,
};
// +---------------->
// | y-- X
// | N
// | ^
// | W < X > E
// | x-- v x++
// | S
// | y++
// v Y
pub const Dir = enum(u8) {
E = 0,
N = 1,
W = 2,
S = 3,
pub fn turn(direction: Dir, quarters: u8) Dir {
return @intToEnum(Dir, (@enumToInt(direction) + quarters) % 4);
}
};
const Pos = struct {
x: isize,
y: isize,
};
navigation: Navigation,
direction: Dir,
ship: Pos,
waypoint: Pos,
pub fn init(navigation: Navigation) Map {
var self = Map{
.navigation = navigation,
.direction = Dir.E,
.ship = .{ .x = 0, .y = 0 },
.waypoint = .{ .x = 10, .y = -1 },
};
return self;
}
pub fn deinit(self: *Map) void {
_ = self;
}
pub fn run_action(self: *Map, line: []const u8) void {
const action = line[0];
const amount = std.fmt.parseInt(isize, line[1..], 10) catch unreachable;
switch (self.navigation) {
Navigation.Waypoint => self.move_by_waypoint(action, amount),
Navigation.Direction => self.move_by_direction(action, amount),
}
}
pub fn manhattan_distance(self: Map) usize {
const absx = @intCast(usize, (std.math.absInt(self.ship.x) catch unreachable));
const absy = @intCast(usize, (std.math.absInt(self.ship.y) catch unreachable));
return absx + absy;
}
fn move_by_direction(self: *Map, action: u8, amount: isize) void {
switch (action) {
'N' => self.navigate_ship(Dir.N, amount),
'S' => self.navigate_ship(Dir.S, amount),
'E' => self.navigate_ship(Dir.E, amount),
'W' => self.navigate_ship(Dir.W, amount),
'L' => self.rotate_ship(amount),
'R' => self.rotate_ship(360 - amount),
'F' => self.navigate_ship(self.direction, amount),
else => @panic("action by direction"),
}
}
fn move_by_waypoint(self: *Map, action: u8, amount: isize) void {
switch (action) {
'N' => self.move_waypoint(0, -amount),
'S' => self.move_waypoint(0, amount),
'E' => self.move_waypoint(amount, 0),
'W' => self.move_waypoint(-amount, 0),
'L' => self.rotate_waypoint(amount),
'R' => self.rotate_waypoint(360 - amount),
'F' => self.move_ship(self.waypoint.x * amount, self.waypoint.y * amount),
else => @panic("action by waypoint"),
}
}
fn navigate_ship(self: *Map, direction: Dir, amount: isize) void {
switch (direction) {
.E => self.move_ship(amount, 0),
.N => self.move_ship(0, -amount),
.W => self.move_ship(-amount, 0),
.S => self.move_ship(0, amount),
}
}
fn move_ship(self: *Map, dx: isize, dy: isize) void {
self.ship.x += dx;
self.ship.y += dy;
}
fn rotate_ship(self: *Map, degrees: isize) void {
self.direction = switch (degrees) {
90 => Dir.turn(self.direction, 1),
180 => Dir.turn(self.direction, 2),
270 => Dir.turn(self.direction, 3),
else => @panic("rotate ship"),
};
}
fn move_waypoint(self: *Map, dx: isize, dy: isize) void {
self.waypoint.x += dx;
self.waypoint.y += dy;
}
fn rotate_waypoint(self: *Map, degrees: isize) void {
switch (degrees) {
90 => self.set_waypoint(self.waypoint.y, -self.waypoint.x),
180 => self.set_waypoint(-self.waypoint.x, -self.waypoint.y),
270 => self.set_waypoint(-self.waypoint.y, self.waypoint.x),
else => @panic("rotate waypoint"),
}
}
fn set_waypoint(self: *Map, x: isize, y: isize) void {
self.waypoint.x = x;
self.waypoint.y = y;
}
};
test "sample direction" {
const data: []const u8 =
\\F10
\\N3
\\F7
\\R90
\\F11
;
var map = Map.init(Map.Navigation.Direction);
defer map.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
map.run_action(line);
}
const distance = map.manhattan_distance();
try testing.expect(distance == 25);
}
test "sample waypoint" {
const data: []const u8 =
\\F10
\\N3
\\F7
\\R90
\\F11
;
var map = Map.init(Map.Navigation.Waypoint);
defer map.deinit();
var it = std.mem.split(u8, data, "\n");
while (it.next()) |line| {
map.run_action(line);
}
const distance = map.manhattan_distance();
try testing.expect(distance == 286);
} | 2020/p12/map.zig |
const std = @import("std");
const allocator = std.heap.c_allocator;
const c = @import("c_imports.zig").c;
const Config = @import("config.zig").Config;
const EditorHighlight = @import("defines.zig").EditorHighlight;
const TAB_STOP = @import("defines.zig").TAB_STOP;
const SyntaxFlags = @import("syntax.zig").SyntaxFlags;
pub const Row = struct {
config: *Config,
idx: usize, // my own index within the file
chars: []u8,
renderedChars: []u8,
hl: []EditorHighlight, // highlight
hl_open_comment: bool,
pub fn init(cfg: *Config) !*Row {
var foo: []Row = try allocator.alloc(Row, 1);
var result = @ptrCast(*Row, foo.ptr);
result.config = cfg;
result.idx = 0;
result.chars = try allocator.alloc(u8, 1);
result.renderedChars = try allocator.alloc(u8, 1);
result.hl = try allocator.alloc(EditorHighlight, 1);
result.hl_open_comment = false;
return result;
}
pub fn initFromString(cfg: *Config, s: *[]const u8) !*Row {
var foo: []Row = try allocator.alloc(Row, 1);
var result = @ptrCast(*Row, foo.ptr);
result.config = cfg;
result.chars = (try allocator.alloc(u8, s.len))[0..s.len];
for (s.*) |ch, idx| {
result.chars[idx] = ch;
}
result.renderedChars = try allocator.alloc(u8, 1);
result.hl = try allocator.alloc(EditorHighlight, 1);
return result;
}
pub fn deinit(self: *Row) void {
allocator.free(self.chars);
allocator.free(self.renderedChars);
allocator.free(self.hl);
}
// Render `self.chars` into `self.renderedChars`.
pub fn render(self: *Row) !void {
allocator.free(self.renderedChars);
var numTabs: usize = 0; // number of tabs in self.chars
for (self.chars) |ch| {
if (ch == '\t') numTabs += 1;
}
self.renderedChars = try allocator.alloc(u8, self.chars.len + numTabs * (TAB_STOP - 1));
var idx_rchars: usize = 0; // index into self.renderedChars
for (self.chars) |ch| {
if (ch == '\t') {
self.renderedChars[idx_rchars] = ' ';
idx_rchars += 1;
while (idx_rchars % TAB_STOP != 0) {
self.renderedChars[idx_rchars] = ' ';
idx_rchars += 1;
}
} else {
self.renderedChars[idx_rchars] = ch;
idx_rchars += 1;
}
}
try self.updateSyntax();
}
pub fn updateSyntax(self: *Row) anyerror!void {
self.hl = try allocator.realloc(self.hl, self.renderedChars.len);
std.mem.set(EditorHighlight, self.hl, EditorHighlight.Normal);
const syn = self.config.syntax orelse return;
const keywords = syn.keywords;
const scs = syn.singlelineCommentStart;
const mcs = syn.multilineCommentStart;
const mce = syn.multilineCommentEnd;
// Whether the last character was a separator. Initialized to true
// because BoL is considered to be a separator.
var prev_sep = true;
var in_string: u8 = 0; // the quote char if inside strings
var in_comment = self.idx > 0 and
self.config.rows.at(self.idx - 1).hl_open_comment;
var i: usize = 0;
while (i < self.renderedChars.len) {
const ch = self.renderedChars[i];
const prev_hl: EditorHighlight =
if (i > 0) self.hl[i - 1] else .Normal;
// single-line comment
if (scs.len > 0 and in_string == 0 and !in_comment) {
if (std.mem.startsWith(u8, self.renderedChars[i..], scs)) {
std.mem.set(EditorHighlight, self.hl[i..], .Comment);
break;
}
}
// multi-line comment
if (mcs.len > 0 and mce.len > 0 and in_string == 0) {
if (in_comment) {
self.hl[i] = .MLComment;
if (std.mem.startsWith(u8, self.renderedChars[i..], mce)) {
std.mem.set(EditorHighlight, self.hl[i .. i + mce.len], .MLComment);
i += mce.len;
in_comment = false;
prev_sep = true;
continue;
} else {
i += 1;
continue;
}
} else if (std.mem.startsWith(u8, self.renderedChars[i..], mcs)) {
std.mem.set(EditorHighlight, self.hl[i .. i + mcs.len], .MLComment);
i += mcs.len;
in_comment = true;
continue;
}
}
// strings
if (syn.flags & @enumToInt(SyntaxFlags.HighlightStrings) > 0) {
if (in_string > 0) {
self.hl[i] = .String;
if (ch == '\\' and i + 1 < self.renderedChars.len) {
self.hl[i + 1] = .String;
i += 2;
continue;
}
if (ch == in_string)
in_string = 0;
i += 1;
prev_sep = true;
continue;
} else {
if (ch == '"' or ch == '\'') {
in_string = ch;
self.hl[i] = .String;
i += 1;
continue;
}
}
}
// numbers
if (syn.flags & @enumToInt(SyntaxFlags.HighlightNumbers) > 0) {
if ((std.ascii.isDigit(ch) and
(prev_sep or prev_hl == .Number)) or
(ch == '.' and prev_hl == .Number))
{
self.hl[i] = .Number;
i += 1;
prev_sep = false;
continue;
}
}
// keywords
if (prev_sep) {
for (keywords) |kw| {
var klen = kw.len;
const kw2 = kw[klen - 1] == '|';
if (kw2) klen -= 1;
if (std.mem.startsWith(u8, self.renderedChars[i..], kw[0..klen]) and
(i + klen == self.renderedChars.len or
is_separator(self.renderedChars[i + klen])))
{
std.mem.set(EditorHighlight, self.hl[i .. i + klen], if (kw2) EditorHighlight.Keyword2 else EditorHighlight.Keyword1);
i += klen;
break;
}
} else {
prev_sep = false;
continue;
}
}
prev_sep = is_separator(@intCast(u8, ch));
i += 1;
}
const changed = self.hl_open_comment != in_comment;
self.hl_open_comment = in_comment;
if (changed and self.idx + 1 < self.config.numRows) {
try self.config.rows.at(self.idx + 1).updateSyntax();
}
}
pub fn len(self: *Row) u16 {
return @intCast(u16, self.chars.len);
}
// `editorRowCxToRx` in BYOTE.
//
// char_index: index into self.chars
// Returns the corresponding screen column.
pub fn screenColumn(self: *Row, char_index: usize) u16 {
var result: u16 = 0;
var idx: u16 = 0; // index into self.chars
while (idx < char_index) : (idx += 1) {
if (self.chars[idx] == '\t') {
result += (TAB_STOP - 1) - (result % TAB_STOP);
}
result += 1;
}
return result;
}
// `editorRowRxToCx` in BYOTE.
//
// scrCol: screen column
// Returns the index into self.chars corresponding to `scrCol`
pub fn screenColToCharsIndex(self: *Row, scrCol: usize) u16 {
var idx: u16 = 0; // index into self.renderedChars
var result: u16 = 0;
while (result < self.chars.len) : (result += 1) {
if (self.chars[result] == '\t') {
idx += (TAB_STOP - 1) - (idx % TAB_STOP);
}
idx += 1;
if (idx > scrCol)
return result;
}
return result;
}
pub fn insertChar(self: *Row, insert_at: usize, ch: u8) !void {
const at = std.math.min(insert_at, self.chars.len);
self.chars = try allocator.realloc(self.chars, self.chars.len + 1);
std.mem.copyBackwards(u8, self.chars[at + 1 .. self.chars.len], self.chars[at .. self.chars.len - 1]);
self.chars[at] = ch;
try self.render();
}
pub fn appendString(self: *Row, s: []u8) !void {
const oldLen = self.len();
self.chars = try allocator.realloc(self.chars, oldLen + s.len);
for (s) |ch, idx| {
self.chars[oldLen + idx] = ch;
}
try self.render();
}
pub fn delChar(self: *Row, at: usize) !void {
if (at > self.len()) return;
std.mem.copy(u8, self.chars[at .. self.chars.len - 1], self.chars[at + 1 .. self.chars.len]);
self.chars = self.chars[0 .. self.chars.len - 1];
try self.render();
}
pub fn find(self: *Row, needle: []u8, screenCol: usize) ?usize {
if (screenCol >= self.renderedChars.len)
return null;
return std.mem.indexOfPos(u8, self.renderedChars, screenCol, needle);
}
};
fn is_separator(ch: u8) bool {
return std.ascii.isSpace(ch) or
ch == 0 or
std.mem.indexOfScalar(u8, ",.()+-/*=~%<>[];", ch) != null;
}
// eof | .save/texteditor/buffer.zig |
const std = @import("std");
const builtin = std.builtin;
const debug = std.debug;
const heap = std.heap;
const mem = std.mem;
const process = std.process;
const testing = std.testing;
/// An example of what methods should be implemented on an arg iterator.
pub const ExampleArgIterator = struct {
const Error = error{};
pub fn next(iter: *ExampleArgIterator) Error!?[]const u8 {
return "2";
}
};
/// An argument iterator which iterates over a slice of arguments.
/// This implementation does not allocate.
pub const SliceIterator = struct {
const Error = error{};
args: []const []const u8,
index: usize = 0,
pub fn next(iter: *SliceIterator) Error!?[]const u8 {
if (iter.args.len <= iter.index)
return null;
defer iter.index += 1;
return iter.args[iter.index];
}
};
test "SliceIterator" {
const args = &[_][]const u8{ "A", "BB", "CCC" };
var iter = SliceIterator{ .args = args };
for (args) |a| {
const b = try iter.next();
debug.assert(mem.eql(u8, a, b.?));
}
}
/// An argument iterator which wraps the ArgIterator in ::std.
/// On windows, this iterator allocates.
pub const OsIterator = struct {
const Error = process.ArgIterator.NextError;
arena: heap.ArenaAllocator,
args: process.ArgIterator,
/// The executable path (this is the first argument passed to the program)
/// TODO: Is it the right choice for this to be null? Maybe `init` should
/// return an error when we have no exe.
exe_arg: ?[:0]const u8,
pub fn init(allocator: *mem.Allocator) Error!OsIterator {
var res = OsIterator{
.arena = heap.ArenaAllocator.init(allocator),
.args = process.args(),
.exe_arg = undefined,
};
res.exe_arg = try res.next();
return res;
}
pub fn deinit(iter: *OsIterator) void {
iter.arena.deinit();
}
pub fn next(iter: *OsIterator) Error!?[:0]const u8 {
if (builtin.os.tag == .windows) {
return try iter.args.next(&iter.arena.allocator) orelse return null;
} else {
return iter.args.nextPosix();
}
}
};
/// An argument iterator that takes a string and parses it into arguments, simulating
/// how shells split arguments.
pub const ShellIterator = struct {
const Error = error{
DanglingEscape,
QuoteNotClosed,
} || mem.Allocator.Error;
arena: heap.ArenaAllocator,
str: []const u8,
pub fn init(allocator: *mem.Allocator, str: []const u8) ShellIterator {
return .{
.arena = heap.ArenaAllocator.init(allocator),
.str = str,
};
}
pub fn deinit(iter: *ShellIterator) void {
iter.arena.deinit();
}
pub fn next(iter: *ShellIterator) Error!?[]const u8 {
// Whenever possible, this iterator will return slices into `str` instead of
// allocating. Sometimes this is not possible, for example, escaped characters
// have be be unescape, so we need to allocate in this case.
var list = std.ArrayList(u8).init(&iter.arena.allocator);
var start: usize = 0;
var state: enum {
skip_whitespace,
no_quote,
no_quote_escape,
single_quote,
double_quote,
double_quote_escape,
after_quote,
} = .skip_whitespace;
for (iter.str) |c, i| {
switch (state) {
// The state that skips the initial whitespace.
.skip_whitespace => switch (c) {
' ', '\t', '\n' => {},
'\'' => {
start = i + 1;
state = .single_quote;
},
'"' => {
start = i + 1;
state = .double_quote;
},
'\\' => {
start = i + 1;
state = .no_quote_escape;
},
else => {
start = i;
state = .no_quote;
},
},
// The state that parses the none quoted part of a argument.
.no_quote => switch (c) {
// We're done parsing a none quoted argument when we hit a
// whitespace.
' ', '\t', '\n' => {
defer iter.str = iter.str[i..];
return iter.result(start, i, &list);
},
// Slicing is not possible if a quote starts while parsing none
// quoted args.
// Example:
// ab'cd' -> abcd
'\'' => {
try list.appendSlice(iter.str[start..i]);
start = i + 1;
state = .single_quote;
},
'"' => {
try list.appendSlice(iter.str[start..i]);
start = i + 1;
state = .double_quote;
},
// Slicing is not possible if we need to escape a character.
// Example:
// ab\"d -> ab"d
'\\' => {
try list.appendSlice(iter.str[start..i]);
start = i + 1;
state = .no_quote_escape;
},
else => {},
},
// We're in this state after having parsed the quoted part of an
// argument. This state works mostly the same as .no_quote, but
// is aware, that the last character seen was a quote, which should
// not be part of the argument. This is why you will see `i - 1` here
// instead of just `i` when `iter.str` is sliced.
.after_quote => switch (c) {
' ', '\t', '\n' => {
defer iter.str = iter.str[i..];
return iter.result(start, i - 1, &list);
},
'\'' => {
try list.appendSlice(iter.str[start .. i - 1]);
start = i + 1;
state = .single_quote;
},
'"' => {
try list.appendSlice(iter.str[start .. i - 1]);
start = i + 1;
state = .double_quote;
},
'\\' => {
try list.appendSlice(iter.str[start .. i - 1]);
start = i + 1;
state = .no_quote_escape;
},
else => {
try list.appendSlice(iter.str[start .. i - 1]);
start = i;
state = .no_quote;
},
},
// The states that parse the quoted part of arguments. The only differnece
// between single and double quoted arguments is that single quoted
// arguments ignore escape sequences, while double quoted arguments
// does escaping.
.single_quote => switch (c) {
'\'' => state = .after_quote,
else => {},
},
.double_quote => switch (c) {
'"' => state = .after_quote,
'\\' => {
try list.appendSlice(iter.str[start..i]);
start = i + 1;
state = .double_quote_escape;
},
else => {},
},
// The state we end up when after the escape character (`\`). All these
// states do is transition back into the previous state.
// TODO: Are there any escape sequences that does transform the second
// character into something else? For example, in Zig, `\n` is
// transformed into the line feed ascii character.
.no_quote_escape => switch (c) {
else => state = .no_quote,
},
.double_quote_escape => switch (c) {
else => state = .double_quote,
},
}
}
defer iter.str = iter.str[iter.str.len..];
switch (state) {
.skip_whitespace => return null,
.no_quote => return iter.result(start, iter.str.len, &list),
.after_quote => return iter.result(start, iter.str.len - 1, &list),
.no_quote_escape => return Error.DanglingEscape,
.single_quote,
.double_quote,
.double_quote_escape,
=> return Error.QuoteNotClosed,
}
}
fn result(iter: *ShellIterator, start: usize, end: usize, list: *std.ArrayList(u8)) Error!?[]const u8 {
const res = iter.str[start..end];
// If we already have something in `list` that means that we could not
// parse the argument without allocation. We therefor need to just append
// the rest we have to the list and return that.
if (list.items.len != 0) {
try list.appendSlice(res);
return list.toOwnedSlice();
}
return res;
}
};
fn testShellIteratorOk(str: []const u8, allocations: usize, expect: []const []const u8) void {
var allocator = testing.FailingAllocator.init(testing.allocator, allocations);
var it = ShellIterator.init(&allocator.allocator, str);
defer it.deinit();
for (expect) |e| {
if (it.next()) |actual| {
testing.expect(actual != null);
testing.expectEqualStrings(e, actual.?);
} else |err| testing.expectEqual(@as(anyerror![]const u8, e), err);
}
if (it.next()) |actual| {
testing.expectEqual(@as(?[]const u8, null), actual);
testing.expectEqual(allocations, allocator.allocations);
} else |err| testing.expectEqual(@as(anyerror!void, {}), err);
}
fn testShellIteratorErr(str: []const u8, expect: anyerror) void {
var it = ShellIterator.init(testing.allocator, str);
defer it.deinit();
while (it.next() catch |err| {
testing.expectError(expect, @as(anyerror!void, err));
return;
}) |_| {}
testing.expectError(expect, @as(anyerror!void, {}));
}
test "ShellIterator" {
testShellIteratorOk("a", 0, &[_][]const u8{"a"});
testShellIteratorOk("'a'", 0, &[_][]const u8{"a"});
testShellIteratorOk("\"a\"", 0, &[_][]const u8{"a"});
testShellIteratorOk("a b", 0, &[_][]const u8{ "a", "b" });
testShellIteratorOk("'a' b", 0, &[_][]const u8{ "a", "b" });
testShellIteratorOk("\"a\" b", 0, &[_][]const u8{ "a", "b" });
testShellIteratorOk("a 'b'", 0, &[_][]const u8{ "a", "b" });
testShellIteratorOk("a \"b\"", 0, &[_][]const u8{ "a", "b" });
testShellIteratorOk("'a b'", 0, &[_][]const u8{"a b"});
testShellIteratorOk("\"a b\"", 0, &[_][]const u8{"a b"});
testShellIteratorOk("\"a\"\"b\"", 1, &[_][]const u8{"ab"});
testShellIteratorOk("'a''b'", 1, &[_][]const u8{"ab"});
testShellIteratorOk("'a'b", 1, &[_][]const u8{"ab"});
testShellIteratorOk("a'b'", 1, &[_][]const u8{"ab"});
testShellIteratorOk("a\\ b", 1, &[_][]const u8{"a b"});
testShellIteratorOk("\"a\\ b\"", 1, &[_][]const u8{"a b"});
testShellIteratorOk("'a\\ b'", 0, &[_][]const u8{"a\\ b"});
testShellIteratorOk(" a b ", 0, &[_][]const u8{ "a", "b" });
testShellIteratorOk("\\ \\ ", 0, &[_][]const u8{ " ", " " });
testShellIteratorOk(
\\printf 'run\nuninstall\n'
, 0, &[_][]const u8{ "printf", "run\\nuninstall\\n" });
testShellIteratorOk(
\\setsid -f steam "steam://$action/$id"
, 0, &[_][]const u8{ "setsid", "-f", "steam", "steam://$action/$id" });
testShellIteratorOk(
\\xargs -I% rg --no-heading --no-line-number --only-matching
\\ --case-sensitive --multiline --text --byte-offset '(?-u)%' $@
\\
, 0, &[_][]const u8{
"xargs", "-I%", "rg", "--no-heading",
"--no-line-number", "--only-matching", "--case-sensitive", "--multiline",
"--text", "--byte-offset", "(?-u)%", "$@",
});
testShellIteratorErr("'a", error.QuoteNotClosed);
testShellIteratorErr("'a\\", error.QuoteNotClosed);
testShellIteratorErr("\"a", error.QuoteNotClosed);
testShellIteratorErr("\"a\\", error.QuoteNotClosed);
testShellIteratorErr("a\\", error.DanglingEscape);
} | zig-clap/clap/args.zig |
const std = @import("std");
const time = std.time;
const Timer = time.Timer;
const smaz = @import("main.zig");
const examples = @import("examples.zig").examples;
const KiB = 1024;
const MiB = 1024 * KiB;
inline fn compress() !usize {
const iterations = 10000;
var i: usize = 0;
while (i < iterations) : (i += 1) {
for (examples) |str| {
var compress_reader = std.io.fixedBufferStream(str);
var compress_writer = std.io.null_writer;
try smaz.compress(compress_reader.reader(), compress_writer);
}
}
var sum: usize = 0;
for (examples) |str| sum += str.len;
return sum * iterations;
}
inline fn decompress() !usize {
var compress_buffers = [_][1024]u8{undefined} ** examples.len;
var compressed = [_][]const u8{&[_]u8{}} ** examples.len;
for (examples) |str, i| {
var compress_reader = std.io.fixedBufferStream(str);
var compress_writer = std.io.fixedBufferStream(&compress_buffers[i]);
try smaz.compress(compress_reader.reader(), compress_writer.writer());
compressed[i] = compress_writer.getWritten();
}
const iterations = 10000;
var i: usize = 0;
while (i < iterations) : (i += 1) {
for (compressed) |str| {
var decompress_reader = std.io.fixedBufferStream(str);
var decompress_writer = std.io.null_writer;
try smaz.decompress(decompress_reader.reader(), decompress_writer);
}
}
var sum: usize = 0;
for (compressed) |str| sum += str.len;
return sum * iterations;
}
fn benchmark(comptime f: fn () anyerror!usize) !u64 {
var timer = try Timer.start();
const start = timer.lap();
const bytes = try f();
const end = timer.read();
const elapsed_s = @intToFloat(f64, end - start) / time.ns_per_s;
const throughput = @floatToInt(u64, @intToFloat(f64, bytes) / elapsed_s);
std.debug.print("bytes: {}\n", .{bytes});
return throughput;
}
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
const throughput_compression = try benchmark(compress);
const throughput_decompression = try benchmark(decompress);
try stdout.print("compression throughput: {} MiB/s\n", .{throughput_compression / MiB});
try stdout.print("decompression throughput: {} MiB/s\n", .{throughput_decompression / MiB});
} | src/benchmark.zig |
const std = @import("std");
const Blake3 = std.crypto.Blake3;
const b64 = std.base64.standard_encoder;
const fnv = std.hash.Fnv1a_64;
const TagMap = std.AutoHashMap([]const u8, std.SegmentedList([]const u8, 2));
const TagType = enum { topic, author, medium, license, isbn, doi, language };
// required tags for a successful parse
const Required = struct {
language: bool,
medium: bool,
topic: bool,
};
comptime {
for (std.meta.fields(Required)) |field| {
if (!@hasField(TagType, field.name)) {
@compileError("required field doesn't exist");
}
}
}
const Token = union(enum) {
TagType: struct { len: usize, tag: TagType },
Tag: usize,
Title: usize,
Description: usize,
Hash: usize,
Link: usize,
pub fn slice(self: Token, text: []const u8, index: usize) []const u8 {
switch (self) {
.Tag, .Title, .Hash, .Link => |x| return text[1 + index - x .. index],
.Description => |x| return text[1 + index - x .. index - 1],
.TagType => |x| return text[1 + index - x.len .. index],
}
}
};
const StreamingParser = struct {
count: usize,
state: State,
hash: fnv,
required: Required,
const State = enum {
LinkEnd,
TagType,
Tag,
TagEnd,
Title,
Desc,
DescCont,
Hash,
HashEnd,
Link,
};
pub fn init() StreamingParser {
var p: StreamingParser = undefined;
p.reset();
return p;
}
pub fn reset(self: *StreamingParser) void {
self.count = 0;
self.state = .LinkEnd;
self.hash = fnv.init();
inline for (std.meta.fields(Required)) |field| {
@field(self.required, field.name) = false;
}
}
fn getTag(self: *StreamingParser, hash: u64) !TagType {
inline for (std.meta.fields(TagType)) |field| {
if (hash == comptime fnv.hash(field.name)) {
if (@hasField(Required, field.name)) {
@field(self.required, field.name) = true;
}
return comptime @intToEnum(TagType, field.value);
}
}
return error.InvalidTag;
}
pub fn feed(self: *StreamingParser, c: u8) !?Token {
self.count += 1;
switch (self.state) {
.LinkEnd => switch (c) {
'#' => {
self.count = 0;
self.state = .TagType;
},
else => return error.InvalidSection,
},
.TagType => switch (c) {
'\n' => return error.MissingTagBody,
':' => {
const token = Token{
.TagType = .{
.len = self.count,
.tag = try getTag(self, self.hash.final()),
},
};
self.hash = fnv.init();
self.state = .Tag;
self.count = 0;
return token;
},
else => {
self.hash.update(([1]u8{c})[0..]);
},
},
.Tag => switch (c) {
'\n' => {
const token = Token{ .Tag = self.count };
self.state = .TagEnd;
return token;
},
else => {},
},
.TagEnd => switch (c) {
'#' => {
self.count = 0;
self.state = .TagType;
},
else => {
self.count = 1;
self.state = .Title;
},
},
.Title => switch (c) {
'\n' => {
const token = Token{ .Title = self.count };
self.count = 0;
self.state = .Desc;
return token;
},
else => {},
},
.Desc => switch (c) {
'\n' => self.state = .DescCont,
else => {},
},
.DescCont => switch (c) {
'^' => {
const token = Token{ .Description = self.count };
self.count = 0;
self.state = .Hash;
return token;
},
'@' => return error.InvalidSection,
'#' => return error.InvalidSection,
else => self.state = .Desc,
},
.Hash => switch (c) {
'\n' => {
self.state = .HashEnd;
return Token{ .Hash = self.count };
},
else => {},
},
.HashEnd => switch (c) {
'@' => {
self.count = 0;
self.state = .Link;
},
else => return error.InvalidSection,
},
.Link => switch (c) {
'\n' => {
inline for (std.meta.fields(Required)) |field| {
defer @field(self.required, field.name) = false;
if (!@field(self.required, field.name)) {
return error.MissingRequiredField;
}
}
self.state = .LinkEnd;
return Token{ .Link = self.count };
},
else => {},
},
}
return null;
}
};
const TokenStream = struct {
sp: StreamingParser,
text: []const u8,
index: usize,
pub fn init(text: []const u8) TokenStream {
var p: TokenParser = undefined;
p.reset();
p.text = text;
return p;
}
pub fn reset(self: *StreamingParser) void {
self.sp = StreamingParser.init();
self.index = 0;
}
pub fn next(self: *StreamingParser) !?Token {}
};
test "" {
const resources = @embedFile("../res");
var p = StreamingParser.init();
var line: usize = 0;
for (resources) |byte, i| {
if (byte == '\n') line += 1;
if (p.feed(byte) catch |e| {
switch (e) {
error.MissingRequiredField => std.debug.print("missing required on line {}\n", .{line}),
else => {},
}
return e;
}) |item| {}
}
}
fn html(title: []const u8, desc: []const u8, link: []const u8, out_stream: anytype) void {
out_stream.writeAll("<div class=\"resource\">");
out_stream.writeAll(" <div class=\"resource-title\">");
out_stream.writeAll("</div");
}
fn markdown(title: []const u8, desc: []const u8, link: []const u8, out_stream: anytype) void {
out_stream.writeAll("[");
out_stream.writeAll(title);
out_stream.writeAll("](");
out_stream.writeAll(link);
out_stream.writeAll(")\n> ");
out_stream.writeAll(desc);
out_stream.writeAll("\n");
} | src/main.zig |
pub const uart_mmio_32 = @import("uart_mmio_32.zig");
pub const status_uart_mmio_32 = @import("status_uart_mmio_32.zig");
const sabaton = @import("root").sabaton;
const fmt = @import("std").fmt;
pub const putchar = sabaton.platform.io.putchar;
const Printer = struct {
pub fn writeAll(self: *const Printer, str: []const u8) !void {
print_str(str);
}
pub fn print(self: *const Printer, comptime format: []const u8, args: anytype) !void {
log(format, args);
}
pub fn writeByteNTimes(self: *const Printer, val: u8, num: usize) !void {
var i: usize = 0;
while (i < num) : (i += 1) {
putchar(val);
}
}
pub const Error = anyerror;
};
usingnamespace if (sabaton.debug) struct {
pub fn log(comptime format: []const u8, args: anytype) void {
var printer = Printer{};
fmt.format(printer, format, args) catch unreachable;
}
} else struct {
pub fn log(comptime format: []const u8, args: anytype) void {
@compileError("Log called!");
}
};
pub fn print_chars(ptr: [*]const u8, num: usize) void {
var i: usize = 0;
while (i < num) : (i += 1) {
putchar(ptr[i]);
}
}
fn wrapped_print_hex(num: u64, nibbles: isize) void {
var i: isize = nibbles - 1;
while (i >= 0) : (i -= 1) {
putchar("0123456789ABCDEF"[(num >> @intCast(u6, i * 4)) & 0xF]);
}
}
pub fn print_hex(num: anytype) void {
switch (@typeInfo(@TypeOf(num))) {
else => @compileError("Unknown print_hex type!"),
.Int => @call(.{ .modifier = .never_inline }, wrapped_print_hex, .{ num, (@bitSizeOf(@TypeOf(num)) + 3) / 4 }),
.Pointer => @call(.{ .modifier = .always_inline }, print_hex, .{@ptrToInt(num)}),
.ComptimeInt => @call(.{ .modifier = .always_inline }, print_hex, .{@as(usize, num)}),
}
}
pub fn log_hex(str: [*:0]const u8, val: anytype) void {
puts(str);
print_hex(val);
putchar('\n');
}
fn wrapped_puts(str_c: [*:0]const u8) void {
var str = str_c;
while (str[0] != 0) : (str += 1)
@call(.{ .modifier = .never_inline }, putchar, .{str[0]});
}
pub fn puts(str_c: [*:0]const u8) void {
@call(.{ .modifier = .never_inline }, wrapped_puts, .{str_c});
}
fn wrapped_print_str(str: []const u8) void {
for (str) |c|
putchar(c);
}
pub fn print_str(str: []const u8) void {
@call(.{ .modifier = .never_inline }, wrapped_print_str, .{str});
} | src/io/io.zig |
const std = @import("std");
const Builder = std.build.Builder;
const LibExeObjStep = std.build.LibExeObjStep;
const builtin = @import("builtin");
const CrossTarget = std.zig.CrossTarget;
const panic = std.debug.panic;
const stdout = std.io.getStdOut().outStream();
pub fn build(b: *Builder) !void {
const teensy = b.option(bool, "teensy", "Build for teensy 3.2") orelse true;
const firmware = b.addExecutable("firmware", "src/zrt.zig");
firmware.addBuildOption(bool, "teensy3_2", teensy);
if (teensy) {
try teensyBuild(b, firmware);
} else {
panic("Target not supported", .{});
}
b.default_step.dependOn(&firmware.step);
}
fn teensyBuild(b: *Builder, firmware: *LibExeObjStep) !void {
try stdout.print("Building for teensy 3.2\n", .{});
const target = CrossTarget{
.cpu_arch = .thumb,
.os_tag = .freestanding,
.cpu_model = .{ .explicit = &std.Target.arm.cpu.cortex_m4 },
};
firmware.setTarget(target);
firmware.setLinkerScriptPath("src/teensy3_2/link/mk20dx256.ld");
firmware.setOutputDir("zig-cache");
firmware.setBuildMode(builtin.Mode.ReleaseSmall);
const cflags = [_][]const u8{
"-Isrc/c/ARM_CM4F",
"-Isrc/c/include",
};
const c_files = [_][]const u8{
"src/c/src/zig_interface.c",
"src/c/ARM_CM4F/port.c",
};
for (c_files) |c_file| {
firmware.addCSourceFile(c_file, &cflags);
}
firmware.addIncludeDir("include");
const hex = b.step("hex", "Convert to hex");
const upload = b.step("upload", "Upload");
const dis = b.step("dis", "Disassemble");
var objcopy_args = generateHexArguments(b, firmware.getOutputPath());
const create_hex = b.addSystemCommand(objcopy_args.items);
create_hex.step.dependOn(&firmware.step);
hex.dependOn(&create_hex.step);
var disassemble_args = generateDissasembleArguments(b, firmware.getOutputPath());
const run_disassemble = b.addSystemCommand(disassemble_args.items);
run_disassemble.step.dependOn(&firmware.step);
dis.dependOn(&run_disassemble.step);
var teensy_upload_args = generateTeensyUploadArguments(b);
const teensy_upload = b.addSystemCommand(teensy_upload_args.items);
teensy_upload.step.dependOn(&create_hex.step);
upload.dependOn(&teensy_upload.step);
b.default_step.dependOn(hex);
}
fn generateHexArguments(b: *Builder, firmwarePath: []const u8) std.ArrayList([]const u8) {
var objcopy_args = std.ArrayList([]const u8).init(b.allocator);
objcopy_args.appendSlice(&[_][]const u8{
"llvm-objcopy-9",
"-O",
"ihex",
"-R",
".eeprom",
"-B",
"arm",
firmwarePath,
"output.hex",
}) catch {
unreachable;
};
return objcopy_args;
}
fn generateQemuArguments(b: *Builder, comptime arch: []const u8, machine: []const u8, firmwarePath: []const u8) std.ArrayList([]const u8) {
var qemu_args = std.ArrayList([]const u8).init(b.allocator);
qemu_args.appendSlice(&[_][]const u8{
"qemu-system-" ++ arch,
"-kernel",
firmwarePath,
"-M",
machine,
"-serial",
"stdio",
"-display",
"none",
}) catch {
unreachable;
};
return qemu_args;
}
fn generateQemuDebugArguments(b: *Builder, comptime arch: []const u8, machine: []const u8, firmwarePath: []const u8) std.ArrayList([] const u8) {
var qemu_args = std.ArrayList([]const u8).init(b.allocator);
qemu_args.appendSlice(&[_][]const u8{
"qemu-system-" ++ arch,
"-kernel",
firmwarePath,
"-M",
machine,
"-serial",
"stdio",
"-display",
"none",
"-s",
"-S",
}) catch {
unreachable;
};
return qemu_args;
}
fn generateTeensyUploadArguments(b: *Builder) std.ArrayList([]const u8) {
var teensy_upload_args = std.ArrayList([]const u8).init(b.allocator);
teensy_upload_args.appendSlice(&[_][]const u8{
"sudo",
"./uploader",
"--mcu=mk20dx256",
"-w",
"output.hex",
}) catch {
unreachable;
};
return teensy_upload_args;
}
fn generateDissasembleArguments(b: *Builder, firmwarePath: []const u8) std.ArrayList([]const u8) {
var objdump_args = std.ArrayList([]const u8).init(b.allocator);
objdump_args.appendSlice(&[_][]const u8{
"llvm-objdump-9",
"-d",
firmwarePath,
}) catch {
unreachable;
};
return objdump_args;
} | build.zig |
const std = @import("std");
const assert = std.debug.assert;
const math = std.math;
const mem = std.mem;
const bs = @import("./bitstream.zig");
const bits_utils = @import("./bits.zig");
const UINT8_MAX = math.maxInt(u8);
const UINT16_MAX = math.maxInt(u16);
const CHAR_BIT = 8;
const MIN_CODE_SIZE = 9;
const MAX_CODE_SIZE = 13;
const MAX_CODE = ((@as(u16, 1) << MAX_CODE_SIZE) - 1);
const INVALID_CODE = UINT16_MAX;
const CONTROL_CODE = 256;
const INC_CODE_SIZE = 1;
const PARTIAL_CLEAR = 2;
const HASH_BITS = (MAX_CODE_SIZE + 1); // For a load factor of 0.5.
const HASHTAB_SIZE = (@as(u16, 1) << HASH_BITS);
const UNKNOWN_LEN = UINT16_MAX;
pub const unshrnk_stat_t: type = enum {
HWUNSHRINK_OK, // Unshrink was successful.
HWUNSHRINK_FULL, // Not enough room in the output buffer.
HWUNSHRINK_ERR, // Error in the input data.
};
// Hash table where the keys are (prefix_code, ext_byte) pairs, and the values
// are the corresponding code. If prefix_code is INVALID_CODE it means the hash
// table slot is empty.
const hashtab_t: type = struct {
prefix_code: u16,
ext_byte: u8,
code: u16,
};
fn hashtab_init(table: [*]hashtab_t) void {
var i: usize = 0;
while (i < HASHTAB_SIZE) : (i += 1) {
table[i].prefix_code = INVALID_CODE;
}
}
fn hash(code: u16, byte: u8) u32 {
const Static = struct {
const HASH_MUL: u32 = @as(u32, 2654435761); // 2654435761U
};
// Knuth's multiplicative hash.
var mult: u32 = undefined;
_ = @mulWithOverflow(u32, (@intCast(u32, byte) << 16) | code, Static.HASH_MUL, &mult);
return (mult) >> (32 - HASH_BITS);
}
// Return the code corresponding to a prefix code and extension byte if it
// exists in the table, or INVALID_CODE otherwise.
fn hashtab_find(
table: [*]const hashtab_t,
prefix_code: u16,
ext_byte: u8,
) u16 {
var i: usize = hash(prefix_code, ext_byte);
assert(prefix_code != INVALID_CODE);
while (true) {
// Scan until we find the key or an empty slot.
assert(i < HASHTAB_SIZE);
if (table[i].prefix_code == prefix_code and
table[i].ext_byte == ext_byte)
{
return table[i].code;
}
if (table[i].prefix_code == INVALID_CODE) {
return INVALID_CODE;
}
i = (i + 1) % HASHTAB_SIZE;
assert(i != hash(prefix_code, ext_byte));
}
}
fn hashtab_insert(
table: [*]hashtab_t,
prefix_code: u16,
ext_byte: u8,
code: u16,
) void {
var i: usize = hash(prefix_code, ext_byte);
assert(prefix_code != INVALID_CODE);
assert(code != INVALID_CODE);
assert(hashtab_find(table, prefix_code, ext_byte) == INVALID_CODE);
while (true) {
// Scan until we find an empty slot.
assert(i < HASHTAB_SIZE);
if (table[i].prefix_code == INVALID_CODE) {
break;
}
i = (i + 1) % HASHTAB_SIZE;
assert(i != hash(prefix_code, ext_byte));
}
assert(i < HASHTAB_SIZE);
table[i].code = code;
table[i].prefix_code = prefix_code;
table[i].ext_byte = ext_byte;
assert(hashtab_find(table, prefix_code, ext_byte) == code);
}
const code_queue_t: type = struct {
next_idx: u16,
codes: [MAX_CODE - CONTROL_CODE + 1]u16,
};
fn code_queue_init(q: *code_queue_t) void {
var code_queue_size: usize = 0;
var code: u16 = 0;
code_queue_size = 0;
code = CONTROL_CODE + 1;
while (code <= MAX_CODE) : (code += 1) {
q.codes[code_queue_size] = code;
code_queue_size += 1;
}
assert(code_queue_size < q.codes.len);
q.codes[code_queue_size] = INVALID_CODE; // End-of-queue marker.
q.next_idx = 0;
}
// Return the next code in the queue, or INVALID_CODE if the queue is empty.
fn code_queue_next(q: *const code_queue_t) u16 {
assert(q.next_idx < q.codes.len);
return q.codes[q.next_idx];
}
// Return and remove the next code from the queue, or return INVALID_CODE if
// the queue is empty.
fn code_queue_remove_next(q: *code_queue_t) u16 {
var code: u16 = code_queue_next(q);
if (code != INVALID_CODE) {
q.next_idx += 1;
}
return code;
}
// Write a code to the output bitstream, increasing the code size if necessary.
// Returns true on success.
fn write_code(os: *bs.ostream_t, code: u16, code_size: *usize) bool {
assert(code <= MAX_CODE);
while (code > (@as(u16, 1) << @intCast(u4, code_size.*)) - 1) {
// Increase the code size.
assert(code_size.* < MAX_CODE_SIZE);
if (!bs.ostream_write(os, CONTROL_CODE, code_size.*) or
!bs.ostream_write(os, INC_CODE_SIZE, code_size.*))
{
return false;
}
code_size.* += 1;
}
return bs.ostream_write(os, code, code_size.*);
}
fn shrink_partial_clear(hashtab: [*]hashtab_t, queue: *code_queue_t) void {
var is_prefix: [MAX_CODE + 1]bool = [_]bool{false} ** (MAX_CODE + 1);
var new_hashtab: [HASHTAB_SIZE]hashtab_t = undefined;
var i: usize = 0;
var code_queue_size: usize = 0;
// Scan for codes that have been used as a prefix.
i = 0;
while (i < HASHTAB_SIZE) : (i += 1) {
if (hashtab[i].prefix_code != INVALID_CODE) {
is_prefix[hashtab[i].prefix_code] = true;
}
}
// Build a new hash table with only the "prefix codes".
hashtab_init(&new_hashtab);
i = 0;
while (i < HASHTAB_SIZE) : (i += 1) {
if (hashtab[i].prefix_code == INVALID_CODE or
!is_prefix[hashtab[i].code])
{
continue;
}
hashtab_insert(
&new_hashtab,
hashtab[i].prefix_code,
hashtab[i].ext_byte,
hashtab[i].code,
);
}
mem.copy(hashtab_t, hashtab[0..new_hashtab.len], new_hashtab[0..new_hashtab.len]);
// Populate the queue with the "non-prefix" codes.
code_queue_size = 0;
i = CONTROL_CODE + 1;
while (i <= MAX_CODE) : (i += 1) {
if (!is_prefix[i]) {
queue.codes[code_queue_size] = @intCast(u16, i);
code_queue_size += 1;
}
}
queue.codes[code_queue_size] = INVALID_CODE; // End-of-queue marker.
queue.next_idx = 0;
}
// Compress (shrink) the data in src into dst. The number of bytes output, at
// most dst_cap, is stored in *dst_used. Returns false if there is not enough
// room in dst.
pub fn hwshrink(
src: [*]const u8,
src_len: usize,
dst: [*]u8,
dst_cap: usize,
dst_used: *usize,
) bool {
var table: [HASHTAB_SIZE]hashtab_t = undefined;
var queue: code_queue_t = undefined;
var os: bs.ostream_t = undefined;
var code_size: usize = 0;
var i: usize = 0;
var ext_byte: u8 = 0;
var curr_code: u16 = 0;
var next_code: u16 = 0;
var new_code: u16 = 0;
hashtab_init(&table);
code_queue_init(&queue);
bs.ostream_init(&os, dst, dst_cap);
code_size = MIN_CODE_SIZE;
if (src_len == 0) {
dst_used.* = 0;
return true;
}
curr_code = src[0];
i = 1;
while (i < src_len) : (i += 1) {
ext_byte = src[i];
// Search for a code with the current prefix + byte.
next_code = hashtab_find(&table, curr_code, ext_byte);
if (next_code != INVALID_CODE) {
curr_code = next_code;
continue;
}
// Write out the current code.
if (!write_code(&os, curr_code, &code_size)) {
return false;
}
// Assign a new code to the current prefix + byte.
new_code = code_queue_remove_next(&queue);
if (new_code == INVALID_CODE) {
// Try freeing up codes by partial clearing.
shrink_partial_clear(&table, &queue);
if (!bs.ostream_write(&os, CONTROL_CODE, code_size) or
!bs.ostream_write(&os, PARTIAL_CLEAR, code_size))
{
return false;
}
new_code = code_queue_remove_next(&queue);
}
if (new_code != INVALID_CODE) {
hashtab_insert(&table, curr_code, ext_byte, new_code);
}
// Reset the parser starting at the byte.
curr_code = ext_byte;
}
// Write out the last code.
if (!write_code(&os, curr_code, &code_size)) {
return false;
}
dst_used.* = bs.ostream_bytes_written(&os);
return true;
}
const codetab_t: type = struct {
prefix_code: u16, // INVALID_CODE means the entry is invalid.
ext_byte: u8,
len: u16,
last_dst_pos: usize,
};
fn codetab_init(codetab: [*]codetab_t) void {
var i: usize = 0;
// Codes for literal bytes. Set a phony prefix_code so they're valid.
i = 0;
while (i <= UINT8_MAX) : (i += 1) {
codetab[i].prefix_code = @intCast(u16, i);
codetab[i].ext_byte = @intCast(u8, i);
codetab[i].len = 1;
}
while (i <= MAX_CODE) : (i += 1) {
codetab[i].prefix_code = INVALID_CODE;
}
}
fn unshrink_partial_clear(codetab: [*]codetab_t, queue: *code_queue_t) void {
var is_prefix: [MAX_CODE + 1]bool = [_]bool{false} ** (MAX_CODE + 1);
var i: usize = 0;
var code_queue_size: usize = 0;
// Scan for codes that have been used as a prefix.
i = CONTROL_CODE + 1;
while (i <= MAX_CODE) : (i += 1) {
if (codetab[i].prefix_code != INVALID_CODE) {
is_prefix[codetab[i].prefix_code] = true;
}
}
// Clear "non-prefix" codes in the table; populate the code queue.
code_queue_size = 0;
i = CONTROL_CODE + 1;
while (i <= MAX_CODE) : (i += 1) {
if (!is_prefix[i]) {
codetab[i].prefix_code = INVALID_CODE;
queue.codes[code_queue_size] = @intCast(u16, i);
code_queue_size += 1;
}
}
queue.codes[code_queue_size] = INVALID_CODE; // End-of-queue marker.
queue.next_idx = 0;
}
// Read the next code from the input stream and return it in next_code. Returns
// false if the end of the stream is reached. If the stream contains invalid
// data, next_code is set to INVALID_CODE but the return value is still true.
fn read_code(
is: *bs.istream_t,
code_size: *usize,
codetab: [*]codetab_t,
queue: *code_queue_t,
next_code: *u16,
) bool {
var code: u16 = 0;
var control_code: u16 = 0;
assert(@sizeOf(u16) * CHAR_BIT >= code_size.*);
code = @intCast(u16, bits_utils.lsb(bs.istream_bits(is), @intCast(u6, code_size.*)));
if (!bs.istream_advance(is, code_size.*)) {
return false;
}
// Handle regular codes (the common case).
if (code != CONTROL_CODE) {
next_code.* = code;
return true;
}
// Handle control codes.
control_code = @intCast(u16, bits_utils.lsb(bs.istream_bits(is), @intCast(u6, code_size.*)));
if (!bs.istream_advance(is, code_size.*)) {
next_code.* = INVALID_CODE;
return true;
}
if (control_code == INC_CODE_SIZE and code_size.* < MAX_CODE_SIZE) {
code_size.* += 1;
return read_code(is, code_size, codetab, queue, next_code);
}
if (control_code == PARTIAL_CLEAR) {
unshrink_partial_clear(codetab, queue);
return read_code(is, code_size, codetab, queue, next_code);
}
next_code.* = INVALID_CODE;
return true;
}
// Copy len bytes from dst[prev_pos] to dst[dst_pos].
fn copy_from_prev_pos(
dst: [*]u8,
dst_cap: usize,
prev_pos: usize,
dst_pos: usize,
len: usize,
) void {
var i: usize = 0;
var tmp: [8]u8 = [1]u8{0} ** 8;
assert(dst_pos < dst_cap);
assert(prev_pos < dst_pos);
assert(len > 0);
assert(len <= dst_cap - dst_pos);
if (bits_utils.round_up(len, 8) > dst_cap - dst_pos) {
// Not enough room in dst for the sloppy copy below.
mem.copy(u8, dst[dst_pos .. dst_pos + len], dst[prev_pos .. prev_pos + len]);
return;
}
if (prev_pos + len > dst_pos) {
// Benign one-byte overlap possible in the KwKwK case.
assert(prev_pos + len == dst_pos + 1);
assert(dst[prev_pos] == dst[prev_pos + len - 1]);
}
i = 0;
while (i < len) : (i += 8) {
// Sloppy copy: 64 bits at a time; a few extra don't matter.
// we need a tmp buffer since (dst_pos + i) can be after (prev_pos + i);
mem.copy(u8, tmp[0..], dst[prev_pos + i .. prev_pos + i + 8]);
mem.copy(u8, dst[dst_pos + i .. dst_pos + i + 8], tmp[0..]);
}
}
// Output the string represented by a code into dst at dst_pos. Returns
// HWUNSHRINK_OK on success, and also updates *first_byte and *len with the
// first byte and length of the output string, respectively.
fn output_code(
code: u16,
dst: [*]u8,
dst_pos: usize,
dst_cap: usize,
prev_code: u16,
codetab: [*]codetab_t,
queue: *code_queue_t,
first_byte: *u8,
len: *usize,
) unshrnk_stat_t {
var prefix_code: u16 = 0;
assert(code <= MAX_CODE and code != CONTROL_CODE);
assert(dst_pos < dst_cap);
if (code <= UINT8_MAX) {
// Output literal byte.
first_byte.* = @intCast(u8, code);
len.* = 1;
dst[dst_pos] = @intCast(u8, code);
return unshrnk_stat_t.HWUNSHRINK_OK;
}
if (codetab[code].prefix_code == INVALID_CODE or
codetab[code].prefix_code == code)
{
// Reject invalid codes. Self-referential codes may exist in
// the table but cannot be used.
return unshrnk_stat_t.HWUNSHRINK_ERR;
}
if (codetab[code].len != UNKNOWN_LEN) {
// Output string with known length (the common case).
if (dst_cap - dst_pos < codetab[code].len) {
return unshrnk_stat_t.HWUNSHRINK_FULL;
}
copy_from_prev_pos(dst, dst_cap, codetab[code].last_dst_pos, dst_pos, codetab[code].len);
first_byte.* = dst[dst_pos];
len.* = codetab[code].len;
return unshrnk_stat_t.HWUNSHRINK_OK;
}
// Output a string of unknown length. This happens when the prefix
// was invalid (due to partial clearing) when the code was inserted into
// the table. The prefix can then become valid when it's added to the
// table at a later point.
assert(codetab[code].len == UNKNOWN_LEN);
prefix_code = codetab[code].prefix_code;
assert(prefix_code > CONTROL_CODE);
if (prefix_code == code_queue_next(queue)) {
// The prefix code hasn't been added yet, but we were just
// about to: the KwKwK case. Add the previous string extended
// with its first byte.
assert(codetab[prev_code].prefix_code != INVALID_CODE);
codetab[prefix_code].prefix_code = prev_code;
codetab[prefix_code].ext_byte = first_byte.*;
codetab[prefix_code].len = codetab[prev_code].len + 1;
codetab[prefix_code].last_dst_pos = codetab[prev_code].last_dst_pos;
dst[dst_pos] = first_byte.*;
} else if (codetab[prefix_code].prefix_code == INVALID_CODE) {
// The prefix code is still invalid.
return unshrnk_stat_t.HWUNSHRINK_ERR;
}
// Output the prefix string, then the extension byte.
len.* = codetab[prefix_code].len + 1;
if (dst_cap - dst_pos < len.*) {
return unshrnk_stat_t.HWUNSHRINK_FULL;
}
copy_from_prev_pos(dst, dst_cap, codetab[prefix_code].last_dst_pos, dst_pos, codetab[prefix_code].len);
dst[dst_pos + len.* - 1] = codetab[code].ext_byte;
first_byte.* = dst[dst_pos];
// Update the code table now that the string has a length and pos.
assert(prev_code != code);
codetab[code].len = @intCast(u16, len.*);
codetab[code].last_dst_pos = dst_pos;
return unshrnk_stat_t.HWUNSHRINK_OK;
}
// Decompress (unshrink) the data in src. The number of input bytes used, at
// most src_len, is stored in *src_used on success. Output is written to dst.
// The number of bytes written, at most dst_cap, is stored in *dst_used on
// success.
pub fn hwunshrink(
src: [*]const u8,
src_len: usize,
src_used: *usize,
dst: [*]u8,
dst_cap: usize,
dst_used: *usize,
) unshrnk_stat_t {
var codetab: [MAX_CODE + 1]codetab_t = undefined;
var queue: code_queue_t = undefined;
var is: bs.istream_t = undefined;
var code_size: usize = 0;
var dst_pos: usize = 0;
var i: usize = 0;
var len: usize = 0;
var curr_code: u16 = 0;
var prev_code: u16 = 0;
var new_code: u16 = 0;
var c: u16 = 0;
var first_byte: u8 = 0;
var s: unshrnk_stat_t = undefined;
codetab_init(&codetab);
code_queue_init(&queue);
bs.istream_init(&is, src, src_len);
code_size = MIN_CODE_SIZE;
dst_pos = 0;
// Handle the first code separately since there is no previous code.
if (!read_code(&is, &code_size, &codetab, &queue, &curr_code)) {
src_used.* = bs.istream_bytes_read(&is);
dst_used.* = 0;
return unshrnk_stat_t.HWUNSHRINK_OK;
}
assert(curr_code != CONTROL_CODE);
if (curr_code > UINT8_MAX) {
return unshrnk_stat_t.HWUNSHRINK_ERR; // The first code must be a literal.
}
if (dst_pos == dst_cap) {
return unshrnk_stat_t.HWUNSHRINK_FULL;
}
first_byte = @intCast(u8, curr_code);
dst[dst_pos] = @intCast(u8, curr_code);
codetab[curr_code].last_dst_pos = dst_pos;
dst_pos += 1;
prev_code = curr_code;
while (read_code(&is, &code_size, &codetab, &queue, &curr_code)) {
if (curr_code == INVALID_CODE) {
return unshrnk_stat_t.HWUNSHRINK_ERR;
}
if (dst_pos == dst_cap) {
return unshrnk_stat_t.HWUNSHRINK_FULL;
}
// Handle KwKwK: next code used before being added.
if (curr_code == code_queue_next(&queue)) {
if (codetab[prev_code].prefix_code == INVALID_CODE) {
// The previous code is no longer valid.
return unshrnk_stat_t.HWUNSHRINK_ERR;
}
// Extend the previous code with its first byte.
assert(curr_code != prev_code);
codetab[curr_code].prefix_code = prev_code;
codetab[curr_code].ext_byte = first_byte;
codetab[curr_code].len = codetab[prev_code].len + 1;
codetab[curr_code].last_dst_pos =
codetab[prev_code].last_dst_pos;
assert(dst_pos < dst_cap);
dst[dst_pos] = first_byte;
}
// Output the string represented by the current code.
s = output_code(curr_code, dst, dst_pos, dst_cap, prev_code, &codetab, &queue, &first_byte, &len);
if (s != unshrnk_stat_t.HWUNSHRINK_OK) {
return s;
}
// Verify that the output matches walking the prefixes.
c = curr_code;
i = 0;
while (i < len) : (i += 1) {
assert(codetab[c].len == len - i);
assert(codetab[c].ext_byte == dst[dst_pos + len - i - 1]);
c = codetab[c].prefix_code;
}
// Add a new code to the string table if there's room.
// The string is the previous code's string extended with
// the first byte of the current code's string.
new_code = code_queue_remove_next(&queue);
if (new_code != INVALID_CODE) {
assert(codetab[prev_code].last_dst_pos < dst_pos);
codetab[new_code].prefix_code = prev_code;
codetab[new_code].ext_byte = first_byte;
codetab[new_code].len = codetab[prev_code].len + 1;
codetab[new_code].last_dst_pos =
codetab[prev_code].last_dst_pos;
if (codetab[prev_code].prefix_code == INVALID_CODE) {
// prev_code was invalidated in a partial
// clearing. Until that code is re-used, the
// string represented by new_code is
// indeterminate.
codetab[new_code].len = UNKNOWN_LEN;
}
// If prev_code was invalidated in a partial clearing,
// it's possible that new_code==prev_code, in which
// case it will never be used or cleared.
}
codetab[curr_code].last_dst_pos = dst_pos;
dst_pos += len;
prev_code = curr_code;
}
src_used.* = bs.istream_bytes_read(&is);
dst_used.* = dst_pos;
return unshrnk_stat_t.HWUNSHRINK_OK;
} | src/shrink.zig |
const std = @import("std");
const c = @import("c.zig");
const utils = @import("utils.zig");
pub const Vector = extern struct {
x: c_long,
y: c_long,
};
pub const Matrix = extern struct {
xx: c_long,
xy: c_long,
yx: c_long,
yy: c_long,
};
pub const BBox = extern struct {
xMin: c_long,
yMin: c_long,
xMax: c_long,
yMax: c_long,
};
pub const RenderMode = enum(u3) {
normal = c.FT_RENDER_MODE_NORMAL,
light = c.FT_RENDER_MODE_LIGHT,
mono = c.FT_RENDER_MODE_MONO,
lcd = c.FT_RENDER_MODE_LCD,
lcd_v = c.FT_RENDER_MODE_LCD_V,
sdf = c.FT_RENDER_MODE_SDF,
};
pub const OpenFlags = packed struct {
memory: bool = false,
stream: bool = false,
path: bool = false,
driver: bool = false,
params: bool = false,
pub const Flag = enum(u5) {
memory = c.FT_OPEN_MEMORY,
stream = c.FT_OPEN_STREAM,
path = c.FT_OPEN_PATHNAME,
driver = c.FT_OPEN_DRIVER,
params = c.FT_OPEN_PARAMS,
};
pub fn toBitFields(flags: OpenFlags) u5 {
return utils.structToBitFields(u5, Flag, flags);
}
};
pub const OpenArgs = struct {
flags: OpenFlags,
data: union(enum) {
memory: []const u8,
path: []const u8,
stream: c.FT_Stream,
driver: c.FT_Module,
params: []const c.FT_Parameter,
},
pub fn toCInterface(self: OpenArgs) c.FT_Open_Args {
var oa = std.mem.zeroes(c.FT_Open_Args);
oa.flags = self.flags.toBitFields();
switch (self.data) {
.memory => |d| {
oa.memory_base = d.ptr;
oa.memory_size = @truncate(u31, d.len);
},
.path => |*d| oa.pathname = @intToPtr(*u8, @ptrToInt(d.ptr)),
.stream => |d| oa.stream = d,
.driver => |d| oa.driver = d,
.params => |*d| {
oa.params = @intToPtr(*c.FT_Parameter, @ptrToInt(d.ptr));
oa.num_params = @intCast(u31, d.len);
},
}
return oa;
}
}; | freetype/src/types.zig |
const std = @import("std");
const string = []const u8;
const range = @import("range").range;
const input = @embedFile("../input/day13.txt");
const Point = struct {
x: u32,
y: u32,
};
const Fold = struct {
axis: Axis,
cardinal: u32,
const Axis = enum { x, y };
};
const Grid = [][]u1;
pub fn main() !void {
//
// part 1
{
var iter = std.mem.split(u8, input, "\n");
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const alloc = &arena.allocator;
var all_points = std.ArrayList(Point).init(alloc);
defer all_points.deinit();
var all_folds = std.ArrayList(Fold).init(alloc);
defer all_folds.deinit();
// parse input to collect all points and folds
while (iter.next()) |line| {
if (line.len == 0) continue;
if (std.mem.startsWith(u8, line, "fold along")) {
const axis = std.meta.stringToEnum(Fold.Axis, line[11..][0..1]).?;
const cardinal = try std.fmt.parseUnsigned(u32, line[13..], 10);
try all_folds.append(Fold{ .axis = axis, .cardinal = cardinal });
continue;
}
const index = std.mem.indexOfScalar(u8, line, ',').?;
const x = try std.fmt.parseUnsigned(u32, line[0..index], 10);
const y = try std.fmt.parseUnsigned(u32, line[index + 1 ..], 10);
try all_points.append(Point{ .x = x, .y = y });
}
// setup initial grid
var max_x: u32 = 0;
var max_y: u32 = 0;
for (all_points.items) |item| {
if (item.x > max_x) max_x = item.x;
if (item.y > max_y) max_y = item.y;
}
var grid = try makeGrid(alloc, max_x + 1, max_y + 1);
// set our points
for (all_points.items) |item| {
grid[item.y][item.x] = 1;
}
// perform first fold
grid = try doFold(alloc, grid, all_folds.items[0]);
// find visible dots
const count = dotCount(grid);
std.debug.print("{d}\n", .{count});
}
// part 2
{
var iter = std.mem.split(u8, input, "\n");
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
const alloc = &arena.allocator;
var all_points = std.ArrayList(Point).init(alloc);
defer all_points.deinit();
var all_folds = std.ArrayList(Fold).init(alloc);
defer all_folds.deinit();
// parse input to collect all points and folds
while (iter.next()) |line| {
if (line.len == 0) continue;
if (std.mem.startsWith(u8, line, "fold along")) {
const axis = std.meta.stringToEnum(Fold.Axis, line[11..][0..1]).?;
const cardinal = try std.fmt.parseUnsigned(u32, line[13..], 10);
try all_folds.append(Fold{ .axis = axis, .cardinal = cardinal });
continue;
}
const index = std.mem.indexOfScalar(u8, line, ',').?;
const x = try std.fmt.parseUnsigned(u32, line[0..index], 10);
const y = try std.fmt.parseUnsigned(u32, line[index + 1 ..], 10);
try all_points.append(Point{ .x = x, .y = y });
}
// setup initial grid
var max_x: u32 = 0;
var max_y: u32 = 0;
for (all_points.items) |item| {
if (item.x > max_x) max_x = item.x;
if (item.y > max_y) max_y = item.y;
}
var grid = try makeGrid(alloc, max_x + 1, max_y + 1);
// set our points
for (all_points.items) |item| {
grid[item.y][item.x] = 1;
}
// do all folds
for (all_folds.items) |item| {
grid = try doFold(alloc, grid, item);
}
// captcha of letters
printGrid(grid);
}
}
fn makeGrid(alloc: *std.mem.Allocator, width: usize, depth: usize) !Grid {
var list1 = std.ArrayList([]u1).init(alloc);
defer list1.deinit();
for (range(depth)) |_| {
var list2 = std.ArrayList(u1).init(alloc);
defer list2.deinit();
for (range(width)) |_| {
try list2.append(0);
}
try list1.append(list2.toOwnedSlice());
}
return list1.toOwnedSlice();
}
fn doFold(alloc: *std.mem.Allocator, grid: Grid, fold: Fold) !Grid {
switch (fold.axis) {
.x => {
const w = fold.cardinal;
const h = grid.len;
var new_grid = try makeGrid(alloc, w, h);
// copy elements left of fold
for (range(h)) |_, y| {
for (range(w)) |_, x| {
new_grid[y][x] = grid[y][x];
}
}
// copy elements right of fold
for (range(h)) |_, y| {
for (range(grid[0].len - fold.cardinal)) |_, x| {
if (x == 0) continue;
new_grid[y][fold.cardinal - x] |= grid[y][fold.cardinal + x];
}
}
return new_grid;
},
.y => {
const w = grid[0].len;
const h = fold.cardinal;
var new_grid = try makeGrid(alloc, w, h);
// copy elements above fold
for (range(h)) |_, y| {
for (range(w)) |_, x| {
new_grid[y][x] = grid[y][x];
}
}
// copy elements below fold
for (range(grid.len - fold.cardinal)) |_, y| {
if (y == 0) continue;
for (range(w)) |_, x| {
new_grid[fold.cardinal - y][x] |= grid[fold.cardinal + y][x];
}
}
return new_grid;
},
}
}
fn dotCount(grid: Grid) u32 {
var count: u32 = 0;
for (grid) |_, y| {
for (grid[y]) |_, x| {
count += grid[y][x];
}
}
return count;
}
fn printGrid(grid: Grid) void {
for (range(grid.len)) |_, y| {
for (range(grid[0].len)) |_, x| {
const char: u8 = if (grid[y][x] == 1) '#' else '.';
std.debug.print("{c}", .{char});
}
std.debug.print("\n", .{});
}
std.debug.print("\n", .{});
} | src/day13.zig |
const std = @import("std");
const io = std.io;
const File = std.fs.File;
const ArrayList = std.ArrayList;
const Bf = struct {
const TAPE_LEN = 30000;
stdin: File,
stdout: File,
pc: usize,
tape: [TAPE_LEN]u8,
ptr: usize, // undefined behaviour if ptr is outside the bounds of tape
stack: ArrayList(usize),
braces: [TAPE_LEN]usize,
pub fn init(allocator: *std.mem.Allocator) Bf {
return Bf{
.pc = 0,
.tape = [_]u8{0} ** TAPE_LEN,
.ptr = 0,
.stack = ArrayList(usize).init(allocator),
.braces = [_]usize{0} ** TAPE_LEN,
.stdin = io.getStdIn() catch unreachable,
.stdout = io.getStdOut() catch unreachable,
};
}
pub fn deinit(self: *Bf) void {
self.stack.deinit();
}
pub fn run(self: *Bf, rom: []const u8) !void {
self.pc = 0;
// match the braces first
while (true) {
const instruction = rom[self.pc];
if (instruction == '[') {
try self.stack.append(self.pc);
} else if (instruction == ']') {
if (self.stack.popOrNull()) |open| {
self.braces[self.pc] = open;
self.braces[open] = self.pc;
} else {
std.debug.warn("unmatched ']' at byte {}", self.pc);
return;
}
}
self.pc += 1;
if (self.pc == rom.len) {
if (self.stack.popOrNull()) |open| {
std.debug.warn("unmatched '[' at byte {}", open);
return;
}
break;
}
}
// now execute
self.pc = 0;
while (self.pc != rom.len) : (self.pc += 1) try self.execute(rom[self.pc]);
}
fn execute(self: *Bf, instruction: u8) !void {
switch (instruction) {
'>' => self.ptr +%= 1,
'<' => self.ptr -%= 1,
'+' => self.tape[self.ptr] +%= 1,
'-' => self.tape[self.ptr] -%= 1,
'.' => {
const ch = if (self.tape[self.ptr] == 10) '\n' else self.tape[self.ptr];
try self.stdout.write([_]u8{ch});
},
',' => {
var buf = [_]u8{0};
_ = try self.stdin.read(buf[0..]);
self.tape[self.ptr] = if (buf[0] == '\n') 10 else buf[0];
},
'[' => {
if (self.tape[self.ptr] == 0) self.pc = self.braces[self.pc];
},
']' => {
if (self.tape[self.ptr] != 0) self.pc = self.braces[self.pc];
},
else => {}, // it's a comment
}
}
};
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.direct_allocator);
defer arena.deinit();
const allocator = &arena.allocator;
const args = try std.process.argsAlloc(allocator);
defer std.process.argsFree(allocator, args);
if (args.len < 2) {
std.debug.warn("no file input\n");
std.os.exit(1);
}
const rom = try io.readFileAlloc(allocator, args[1]);
defer allocator.free(rom);
var bf = Bf.init(allocator);
defer bf.deinit();
try bf.run(rom);
} | bf.zig |
const std = @import("std");
const mem = std.mem;
const assert = std.debug.assert;
const target = 2020;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{ .safety = true, .enable_memory_limit = true }){};
const allocator = &gpa.allocator;
defer {
const bytesUsed = gpa.total_requested_bytes;
const info = gpa.deinit();
std.log.info("\n\t[*] Leaked: {}\n\t[*] Bytes leaked: {}", .{ info, bytesUsed });
}
var list = try parse_file_args(allocator);
defer list.deinit();
var numbers = list.items;
var solution1: u32 = 0;
for (numbers) |num1, x| {
for (numbers[x..]) |num2| {
if (num1 + num2 == target) {
solution1 = num1 * num2;
std.log.info("The solution for part 1 is {} from numbers {} and {}.",
.{solution1, num1, num2});
break;
}
}
}
var solution2: u32 = 0;
for (numbers) |num1, x| {
for (numbers[x..]) |num2, y| {
for (numbers[y..]) |num3| {
if (num1 + num2 + num3 == target) {
solution2 = num1 * num2 * num3;
std.log.info("The solution for part 2 is {} from numbers {}, {} and {}.",
.{solution2, num1, num2, num3});
break;
}
}
}
}
}
/// Parses the file from the arguments into an ArrayList
/// Needs to be freed by the caller
fn parse_file_args(allocator: *mem.Allocator) !std.ArrayList(u32) {
// Parse input file location
var args = try std.process.argsAlloc(allocator);
defer std.process.argsFree(allocator, args);
// Default is read = true, write = false
const input_file = try std.fs.cwd().openFile(args[1], .{});
defer input_file.close();
var input = try input_file.readToEndAlloc(allocator, 1000000);
defer allocator.free(input);
//std.log.info("Input contents:\n{}\n", .{input});
var list = std.ArrayList(u32).init(allocator);
var split = mem.split(input, "\n");
while (split.next()) |line| {
//std.log.info("Line: {}", .{line});
const num = std.fmt.parseInt(u32, line, 10) catch |err| {
if (err == error.InvalidCharacter) {
break;
}
return err;
};
try list.append(num);
}
return list;
} | src/day01.zig |
const std = @import("std");
const tools = @import("tools");
const Planet = struct {
parent: []const u8,
childs: u32 = 0,
};
const Hash = std.StringHashMap(Planet);
pub fn run(input: []const u8, allocator: std.mem.Allocator) ![2][]const u8 {
var table = Hash.init(allocator);
defer table.deinit();
try table.ensureTotalCapacity(@intCast(u32, input.len) / 7);
_ = try table.put("COM", Planet{ .parent = "" });
{
var it = std.mem.split(u8, input, "\n");
while (it.next()) |line| {
const l = std.mem.trim(u8, line, &std.ascii.spaces);
if (l.len == 0) continue;
const sep = std.mem.indexOf(u8, l, ")");
if (sep) |s| {
const parent = l[0..s];
const cur = l[s + 1 ..];
const entry = table.get(cur);
if (entry) |_| {
return error.UnsupportedInput; // duplicate entry..
}
_ = try table.put(cur, Planet{ .parent = parent });
} else {
std.debug.print("while reading '{s}'\n", .{line});
return error.UnsupportedInput;
}
}
}
const solution1 = sol: {
var total: usize = 0;
var it = table.iterator();
while (it.next()) |planet| {
var parent = planet.value_ptr.parent;
while (parent.len > 0) {
total += 1;
parent = (table.get(parent) orelse unreachable).parent;
}
}
break :sol total;
};
const PlanetList = std.ArrayList([]const u8);
var santaToCOM = PlanetList.init(allocator);
defer santaToCOM.deinit();
try santaToCOM.ensureTotalCapacity(table.count());
{
const santa = table.get("SAN").?;
var cur = santa.parent;
while (cur.len > 0) {
try santaToCOM.append(cur);
cur = table.get(cur).?.parent;
}
}
const solution2 = sol: {
const me = table.get("YOU").?;
var steps: u32 = 0;
var cur = me.parent;
while (cur.len > 0) {
const index = blk: {
var i: u32 = 0;
for (santaToCOM.items) |planet| {
if (std.mem.eql(u8, planet, cur))
break :blk i;
i += 1;
}
break :blk null;
};
if (index) |i| {
break :sol (i + steps);
} else {
steps += 1;
cur = table.get(cur).?.parent;
}
}
break :sol null;
};
return [_][]const u8{
try std.fmt.allocPrint(allocator, "{}", .{solution1}),
try std.fmt.allocPrint(allocator, "{}", .{solution2}),
};
}
pub const main = tools.defaultMain("2019/day06.txt", run); | 2019/day06.zig |
const std = @import("std");
const debug = std.debug;
const fmt = std.fmt;
const mem = std.mem;
pub fn main() !void {
var result = try solitary_rect(input_03);
debug.assert(result == 412);
debug.warn("03-2: {}\n", result);
}
fn solitary_rect(input: []const []const u8) !usize {
var allocator = std.heap.DirectAllocator.init().allocator;
var rects = std.ArrayList(Rect).init(&allocator);
defer rects.deinit();
var max = V2 { .x = 0, .y = 0 };
for (input) |claim_string| {
var r = Rect.from_claim(try Claim.parse(claim_string));
try rects.append(r);
if (r.se.x > max.x) max.x = r.se.x;
if (r.se.y > max.y) max.y = r.se.y;
}
//V2.print(max);
var squares = try allocator.alloc(u32, ((max.x + 1) * (max.y + 1)));
defer allocator.free(squares);
for (squares) |*s| {
s.* = 0;
}
var rect_it = rects.iterator();
while (rect_it.next()) |next| {
const rect_squares = try Rect.covered_squares(next, &allocator);
for (rect_squares) |s| {
squares[(s.x + ((max.x) * s.y))] += 1;
}
}
rect_it.reset();
//buf_print_2d(squares, max.x + 1);
var total_count: u64 = 0;
for (squares) |count| {
if (count > 1) {
total_count += 1;
}
}
var the_one: usize = 0;
outer: while (rect_it.next()) |next| {
const rect_squares = try Rect.covered_squares(next, &allocator);
//Rect.print(next);
for (rect_squares) |s| {
if (!(squares[(s.x + ((max.x) * s.y))] == 1)) {
continue :outer;
}
}
the_one = rect_it.count;
}
rect_it.reset();
return the_one;
}
fn buf_print_2d(buf: []u32, stride: u32) void {
for (buf) |val, i| {
if (i % stride == 0) {
debug.warn("\n");
}
debug.warn("{} ", val);
}
debug.warn("\n");
}
const Claim = struct {
id: u32,
offset_left: u32,
offset_top: u32,
width: u32,
height: u32,
pub fn print(c: Claim) void {
debug.warn("id: {}\n", c.id);
debug.warn("offset_left: {}\n", c.offset_left);
debug.warn("offset_top: {}\n", c.offset_top);
debug.warn("width: {}\n", c.width);
debug.warn("height: {}\n", c.height);
}
pub fn parse(s: []const u8) !Claim {
var c = Claim {
.id = 0,
.offset_left = 0,
.offset_top = 0,
.width = 0,
.height = 0,
};
// Harrowing tale: I did these in the wrong order at first and it took
// me forever to track down! Yes, my tests were also wrong.
var pos: usize = 0;
consume(s, &pos, "#");
c.id = try get_int(s, &pos);
consume(s, &pos, " @ ");
c.offset_left = try get_int(s, &pos);
consume(s, &pos, ",");
c.offset_top = try get_int(s, &pos);
consume(s, &pos, ": ");
c.width = try get_int(s, &pos);
consume(s, &pos, "x");
c.height = try get_int(s, &pos);
return c;
}
fn consume(s: []const u8, pos: *usize, consume_me: []const u8) void {
for (consume_me) |c| {
debug.assert(s[pos.*] == c);
pos.* += 1;
}
}
fn get_int(s: []const u8, pos: *usize) !u32 {
var initial_pos = pos.*;
debug.assert(is_digit(s[initial_pos]));
var encountered_non_digit = false;
for (s[initial_pos..]) |c, i| {
if (!is_digit(c)) {
encountered_non_digit = true;
pos.* += i;
break;
}
}
if (encountered_non_digit) {
return try fmt.parseInt(u32, s[initial_pos..pos.*], 10);
} else {
return try fmt.parseInt(u32, s[initial_pos..], 10);
}
}
fn is_digit(char: u8) bool {
if (char >= '0' and char <= '9') {
return true;
}
return false;
}
};
test "parse claim" {
const claim1 = try Claim.parse("#1 @ 1,3: 4x4");
debug.assert(claim1.id == 1);
debug.assert(claim1.offset_left == 1);
debug.assert(claim1.offset_top == 3);
debug.assert(claim1.width == 4);
debug.assert(claim1.height == 4);
const claim2 = try Claim.parse("#2 @ 3,1: 4x4");
debug.assert(claim2.id == 2);
debug.assert(claim2.offset_left == 3);
debug.assert(claim2.offset_top == 1);
debug.assert(claim2.width == 4);
debug.assert(claim2.height == 4);
const claim3 = try Claim.parse("#3 @ 5,5: 2x2");
debug.assert(claim3.id == 3);
debug.assert(claim3.offset_left == 5);
debug.assert(claim3.offset_top == 5);
debug.assert(claim3.width == 2);
debug.assert(claim3.height == 2);
const claim4 = try Claim.parse("#1391 @ 256,801: 23x10");
debug.assert(claim4.id == 1391);
debug.assert(claim4.offset_left == 256);
debug.assert(claim4.offset_top == 801);
debug.assert(claim4.width == 23);
debug.assert(claim4.height == 10);
}
const V2 = struct {
x: u32,
y: u32,
pub fn init(_x: u32, _y: u32) V2 {
return V2 {
.x = _x,
.y = _y,
};
}
pub fn equal(self: V2, other: V2) bool {
return (self.x == other.x and self.y == other.y);
}
pub fn print(v: V2) void {
debug.warn("({}, {})\n", v.x, v.y);
}
};
const Rect = struct {
nw: V2,
se: V2,
pub fn init(nwx: u32, nwy: u32, sex: u32, sey: u32) Rect {
debug.assert(nwx <= sex);
debug.assert(nwy <= sey);
return Rect {
.nw = V2.init(nwx, nwy),
.se = V2.init(sex, sey),
};
}
pub fn from_claim(c: Claim) Rect {
return Rect {
.nw = V2 { .x = c.offset_left, .y = c.offset_top },
.se = V2 { .x = c.offset_left + c.width - 1, .y = c.offset_top + c.height - 1},
};
}
pub fn print(r: Rect) void {
debug.warn("({}, {}), ({}, {})\n", r.nw.x, r.nw.y, r.se.x, r.se.y);
}
pub fn covered_squares(r: Rect, a: *mem.Allocator) ![]V2 {
//Rect.print(r);
var squares = try a.alloc(V2, (((r.se.x - r.nw.x) + 1) * ((r.se.y - r.nw.y) + 1)));
var x = r.nw.x;
var z: usize = 0;
while (x <= r.se.x) {
var y = r.nw.y;
while (y <= r.se.y) {
debug.assert(z < squares.len);
squares[z] = V2.init(x, y);
//V2.print(squares[z]);
y += 1;
z += 1;
}
x += 1;
}
return squares;
}
};
test "rect from claim" {
const c = Claim {
.id = 123,
.offset_left = 3,
.offset_top = 2,
.width = 5,
.height = 4,
};
const r = Rect.from_claim(c);
debug.assert(V2.equal(r.nw, V2 { .x = 3, .y = 2}));
debug.assert(V2.equal(r.se, V2 { .x = 7, .y = 5}));
}
const input_03 = []const []const u8 {
"#1 @ 669,271: 17x11",
"#2 @ 153,186: 20x26",
"#3 @ 186,838: 28x11",
"#4 @ 119,248: 18x13",
"#5 @ 57,843: 14x11",
"#6 @ 868,833: 18x20",
"#7 @ 225,38: 26x20",
"#8 @ 208,673: 29x22",
"#9 @ 25,877: 23x13",
"#10 @ 406,555: 11x25",
"#11 @ 567,243: 29x14",
"#12 @ 369,930: 21x14",
"#13 @ 692,175: 21x12",
"#14 @ 662,511: 24x10",
"#15 @ 860,645: 27x26",
"#16 @ 959,534: 28x12",
"#17 @ 453,236: 27x25",
"#18 @ 299,300: 16x19",
"#19 @ 233,190: 12x14",
"#20 @ 306,190: 29x16",
"#21 @ 896,206: 13x24",
"#22 @ 96,944: 23x25",
"#23 @ 194,475: 22x21",
"#24 @ 712,414: 20x12",
"#25 @ 146,332: 22x22",
"#26 @ 407,579: 15x12",
"#27 @ 790,662: 20x21",
"#28 @ 372,130: 10x23",
"#29 @ 871,601: 22x25",
"#30 @ 546,853: 28x29",
"#31 @ 921,667: 24x23",
"#32 @ 117,257: 21x26",
"#33 @ 72,855: 13x29",
"#34 @ 370,67: 18x19",
"#35 @ 860,777: 15x21",
"#36 @ 450,249: 17x14",
"#37 @ 764,208: 7x3",
"#38 @ 127,910: 13x15",
"#39 @ 447,467: 25x27",
"#40 @ 386,294: 19x11",
"#41 @ 504,771: 28x10",
"#42 @ 237,783: 27x19",
"#43 @ 98,544: 25x28",
"#44 @ 456,777: 12x20",
"#45 @ 252,488: 28x21",
"#46 @ 859,864: 22x12",
"#47 @ 581,5: 18x10",
"#48 @ 716,165: 19x28",
"#49 @ 408,803: 23x24",
"#50 @ 438,954: 18x16",
"#51 @ 746,834: 10x27",
"#52 @ 791,699: 18x13",
"#53 @ 323,392: 27x18",
"#54 @ 131,384: 28x15",
"#55 @ 233,697: 11x28",
"#56 @ 265,31: 15x23",
"#57 @ 954,467: 19x27",
"#58 @ 195,471: 23x15",
"#59 @ 625,769: 7x6",
"#60 @ 440,701: 11x13",
"#61 @ 243,406: 13x25",
"#62 @ 500,928: 21x18",
"#63 @ 444,246: 28x28",
"#64 @ 668,568: 10x18",
"#65 @ 27,456: 29x13",
"#66 @ 182,673: 26x21",
"#67 @ 213,661: 24x26",
"#68 @ 409,0: 23x12",
"#69 @ 688,177: 27x19",
"#70 @ 935,912: 22x17",
"#71 @ 444,739: 20x29",
"#72 @ 781,367: 15x13",
"#73 @ 890,432: 29x21",
"#74 @ 668,611: 21x13",
"#75 @ 39,144: 19x25",
"#76 @ 524,774: 21x11",
"#77 @ 905,957: 21x17",
"#78 @ 936,359: 10x24",
"#79 @ 922,315: 26x28",
"#80 @ 107,355: 11x28",
"#81 @ 519,641: 12x25",
"#82 @ 760,337: 18x21",
"#83 @ 357,329: 27x18",
"#84 @ 847,317: 14x12",
"#85 @ 902,505: 15x23",
"#86 @ 964,559: 10x21",
"#87 @ 126,257: 19x12",
"#88 @ 883,780: 12x28",
"#89 @ 621,934: 10x4",
"#90 @ 861,874: 24x11",
"#91 @ 409,111: 21x22",
"#92 @ 784,929: 17x26",
"#93 @ 133,387: 3x7",
"#94 @ 609,545: 14x14",
"#95 @ 383,93: 11x26",
"#96 @ 878,383: 22x15",
"#97 @ 555,423: 23x17",
"#98 @ 580,900: 29x25",
"#99 @ 440,496: 22x16",
"#100 @ 973,526: 16x10",
"#101 @ 675,245: 19x14",
"#102 @ 588,216: 22x14",
"#103 @ 687,775: 12x11",
"#104 @ 973,762: 12x7",
"#105 @ 653,948: 16x21",
"#106 @ 464,973: 15x16",
"#107 @ 832,289: 27x16",
"#108 @ 194,224: 26x11",
"#109 @ 46,327: 18x23",
"#110 @ 635,662: 19x17",
"#111 @ 41,853: 19x21",
"#112 @ 351,298: 14x29",
"#113 @ 57,34: 21x14",
"#114 @ 549,958: 23x17",
"#115 @ 136,515: 15x20",
"#116 @ 365,965: 10x29",
"#117 @ 52,58: 16x28",
"#118 @ 622,25: 19x17",
"#119 @ 716,284: 17x29",
"#120 @ 131,111: 26x12",
"#121 @ 576,919: 19x21",
"#122 @ 963,748: 11x29",
"#123 @ 742,842: 22x18",
"#124 @ 654,124: 3x6",
"#125 @ 174,913: 22x13",
"#126 @ 433,680: 10x24",
"#127 @ 206,547: 11x14",
"#128 @ 876,908: 26x15",
"#129 @ 285,775: 4x6",
"#130 @ 203,478: 22x20",
"#131 @ 732,394: 11x26",
"#132 @ 315,757: 10x27",
"#133 @ 17,520: 25x18",
"#134 @ 277,445: 14x13",
"#135 @ 638,648: 16x18",
"#136 @ 542,34: 27x13",
"#137 @ 175,547: 10x25",
"#138 @ 78,159: 20x16",
"#139 @ 456,312: 25x16",
"#140 @ 886,385: 21x16",
"#141 @ 39,91: 13x22",
"#142 @ 150,517: 12x13",
"#143 @ 730,185: 17x18",
"#144 @ 770,76: 13x16",
"#145 @ 769,367: 13x17",
"#146 @ 548,82: 22x18",
"#147 @ 669,813: 15x16",
"#148 @ 523,718: 27x10",
"#149 @ 786,361: 14x25",
"#150 @ 168,641: 24x22",
"#151 @ 274,324: 24x22",
"#152 @ 88,729: 24x21",
"#153 @ 4,579: 20x22",
"#154 @ 494,942: 23x17",
"#155 @ 215,527: 28x14",
"#156 @ 117,536: 24x18",
"#157 @ 916,64: 28x28",
"#158 @ 502,106: 13x23",
"#159 @ 244,713: 13x23",
"#160 @ 628,438: 20x23",
"#161 @ 978,893: 19x16",
"#162 @ 646,750: 25x10",
"#163 @ 628,596: 22x17",
"#164 @ 280,808: 29x13",
"#165 @ 487,906: 11x21",
"#166 @ 880,283: 11x27",
"#167 @ 644,921: 21x23",
"#168 @ 488,925: 29x15",
"#169 @ 409,804: 10x10",
"#170 @ 656,787: 27x29",
"#171 @ 132,498: 18x28",
"#172 @ 658,213: 17x24",
"#173 @ 607,917: 13x20",
"#174 @ 646,962: 10x14",
"#175 @ 536,277: 22x10",
"#176 @ 335,634: 16x16",
"#177 @ 176,535: 20x22",
"#178 @ 76,843: 14x25",
"#179 @ 759,869: 27x20",
"#180 @ 589,729: 17x29",
"#181 @ 348,514: 18x16",
"#182 @ 900,747: 13x26",
"#183 @ 149,958: 3x6",
"#184 @ 316,77: 20x26",
"#185 @ 464,544: 24x22",
"#186 @ 44,515: 29x24",
"#187 @ 948,659: 15x17",
"#188 @ 505,83: 28x26",
"#189 @ 340,480: 21x14",
"#190 @ 491,950: 19x18",
"#191 @ 62,245: 26x23",
"#192 @ 384,657: 18x22",
"#193 @ 787,954: 18x18",
"#194 @ 934,581: 22x14",
"#195 @ 48,236: 22x22",
"#196 @ 822,675: 11x26",
"#197 @ 817,821: 15x16",
"#198 @ 823,700: 11x20",
"#199 @ 665,390: 20x25",
"#200 @ 252,972: 28x21",
"#201 @ 224,541: 21x19",
"#202 @ 159,326: 10x27",
"#203 @ 27,386: 10x28",
"#204 @ 587,119: 25x18",
"#205 @ 969,628: 23x27",
"#206 @ 940,34: 18x21",
"#207 @ 153,5: 25x12",
"#208 @ 784,55: 17x13",
"#209 @ 816,806: 17x18",
"#210 @ 228,231: 12x24",
"#211 @ 124,379: 14x20",
"#212 @ 894,961: 25x24",
"#213 @ 125,425: 15x29",
"#214 @ 759,155: 20x22",
"#215 @ 606,966: 16x20",
"#216 @ 417,18: 12x19",
"#217 @ 901,455: 20x22",
"#218 @ 369,304: 28x13",
"#219 @ 939,56: 24x20",
"#220 @ 542,288: 27x29",
"#221 @ 213,279: 16x22",
"#222 @ 927,150: 13x27",
"#223 @ 571,964: 22x19",
"#224 @ 230,644: 25x21",
"#225 @ 338,411: 20x14",
"#226 @ 348,3: 19x11",
"#227 @ 498,914: 29x26",
"#228 @ 641,974: 27x13",
"#229 @ 463,258: 26x26",
"#230 @ 926,281: 11x26",
"#231 @ 573,449: 11x29",
"#232 @ 606,861: 19x20",
"#233 @ 394,871: 17x18",
"#234 @ 407,785: 27x20",
"#235 @ 681,447: 21x16",
"#236 @ 471,808: 19x27",
"#237 @ 794,294: 17x23",
"#238 @ 446,935: 16x15",
"#239 @ 156,589: 17x24",
"#240 @ 353,489: 19x17",
"#241 @ 291,171: 28x25",
"#242 @ 935,484: 27x17",
"#243 @ 230,116: 14x27",
"#244 @ 946,740: 26x16",
"#245 @ 894,245: 13x29",
"#246 @ 13,414: 12x18",
"#247 @ 282,667: 28x16",
"#248 @ 84,245: 28x29",
"#249 @ 6,77: 21x15",
"#250 @ 68,23: 19x19",
"#251 @ 216,542: 22x13",
"#252 @ 19,448: 19x19",
"#253 @ 50,870: 12x27",
"#254 @ 133,607: 14x19",
"#255 @ 658,927: 18x13",
"#256 @ 253,447: 23x23",
"#257 @ 938,137: 12x21",
"#258 @ 74,347: 19x16",
"#259 @ 789,87: 11x11",
"#260 @ 116,168: 10x20",
"#261 @ 351,34: 23x17",
"#262 @ 312,171: 22x10",
"#263 @ 419,176: 27x13",
"#264 @ 340,616: 14x23",
"#265 @ 316,195: 11x22",
"#266 @ 152,381: 12x11",
"#267 @ 950,599: 18x19",
"#268 @ 648,954: 27x16",
"#269 @ 215,319: 11x10",
"#270 @ 630,382: 26x20",
"#271 @ 594,513: 20x25",
"#272 @ 174,311: 11x28",
"#273 @ 391,183: 22x10",
"#274 @ 195,824: 21x27",
"#275 @ 675,426: 23x23",
"#276 @ 739,219: 24x18",
"#277 @ 619,932: 15x12",
"#278 @ 433,583: 16x26",
"#279 @ 35,192: 23x19",
"#280 @ 930,177: 28x28",
"#281 @ 825,327: 17x23",
"#282 @ 807,145: 25x14",
"#283 @ 529,796: 10x21",
"#284 @ 289,265: 15x29",
"#285 @ 647,974: 17x19",
"#286 @ 901,313: 22x18",
"#287 @ 135,499: 10x29",
"#288 @ 826,38: 10x27",
"#289 @ 335,205: 13x28",
"#290 @ 72,541: 19x22",
"#291 @ 762,546: 14x10",
"#292 @ 183,32: 28x27",
"#293 @ 194,158: 17x23",
"#294 @ 855,66: 25x26",
"#295 @ 937,460: 11x9",
"#296 @ 332,524: 28x26",
"#297 @ 629,760: 24x15",
"#298 @ 183,836: 24x12",
"#299 @ 373,121: 21x12",
"#300 @ 859,53: 27x28",
"#301 @ 735,903: 27x21",
"#302 @ 666,397: 16x28",
"#303 @ 586,105: 24x20",
"#304 @ 246,298: 19x11",
"#305 @ 578,882: 18x22",
"#306 @ 180,450: 26x19",
"#307 @ 228,292: 23x18",
"#308 @ 350,492: 17x10",
"#309 @ 894,358: 20x26",
"#310 @ 864,147: 27x16",
"#311 @ 193,399: 18x29",
"#312 @ 685,443: 16x24",
"#313 @ 56,690: 29x18",
"#314 @ 540,502: 16x14",
"#315 @ 292,249: 28x28",
"#316 @ 25,612: 20x15",
"#317 @ 640,451: 12x17",
"#318 @ 466,981: 27x11",
"#319 @ 874,876: 17x29",
"#320 @ 870,532: 11x16",
"#321 @ 866,870: 22x23",
"#322 @ 946,2: 23x15",
"#323 @ 538,553: 11x29",
"#324 @ 937,963: 24x12",
"#325 @ 745,818: 21x24",
"#326 @ 851,574: 20x16",
"#327 @ 333,852: 12x19",
"#328 @ 448,585: 13x28",
"#329 @ 155,822: 12x29",
"#330 @ 948,586: 12x24",
"#331 @ 286,665: 29x10",
"#332 @ 965,4: 16x13",
"#333 @ 283,847: 3x7",
"#334 @ 967,350: 17x12",
"#335 @ 801,863: 11x19",
"#336 @ 928,63: 20x22",
"#337 @ 66,274: 14x22",
"#338 @ 849,572: 25x27",
"#339 @ 279,381: 23x25",
"#340 @ 603,741: 24x21",
"#341 @ 637,357: 17x29",
"#342 @ 422,200: 14x19",
"#343 @ 728,306: 15x14",
"#344 @ 232,312: 14x18",
"#345 @ 539,490: 27x25",
"#346 @ 841,664: 26x24",
"#347 @ 711,527: 12x24",
"#348 @ 269,189: 23x16",
"#349 @ 42,276: 11x12",
"#350 @ 245,784: 22x25",
"#351 @ 732,899: 27x17",
"#352 @ 820,295: 22x26",
"#353 @ 200,842: 12x16",
"#354 @ 22,140: 24x24",
"#355 @ 573,849: 25x25",
"#356 @ 653,58: 23x25",
"#357 @ 590,224: 10x27",
"#358 @ 535,577: 10x11",
"#359 @ 856,203: 18x22",
"#360 @ 344,901: 14x21",
"#361 @ 308,921: 25x13",
"#362 @ 74,452: 17x15",
"#363 @ 878,645: 26x19",
"#364 @ 518,321: 13x13",
"#365 @ 531,25: 10x21",
"#366 @ 751,321: 29x14",
"#367 @ 120,430: 10x16",
"#368 @ 88,457: 16x11",
"#369 @ 679,882: 21x14",
"#370 @ 650,227: 28x26",
"#371 @ 578,688: 11x14",
"#372 @ 342,643: 12x20",
"#373 @ 41,151: 10x12",
"#374 @ 842,283: 27x24",
"#375 @ 718,224: 25x23",
"#376 @ 23,472: 17x22",
"#377 @ 930,358: 19x27",
"#378 @ 274,438: 21x11",
"#379 @ 329,25: 26x10",
"#380 @ 716,417: 18x12",
"#381 @ 158,693: 13x24",
"#382 @ 345,398: 13x13",
"#383 @ 861,793: 28x25",
"#384 @ 176,940: 14x28",
"#385 @ 536,664: 27x16",
"#386 @ 884,932: 21x29",
"#387 @ 942,567: 24x13",
"#388 @ 568,869: 12x12",
"#389 @ 451,307: 10x15",
"#390 @ 883,876: 13x11",
"#391 @ 198,509: 12x18",
"#392 @ 695,961: 17x18",
"#393 @ 245,809: 20x23",
"#394 @ 587,495: 16x23",
"#395 @ 902,947: 17x15",
"#396 @ 822,551: 22x26",
"#397 @ 645,540: 22x15",
"#398 @ 955,93: 27x16",
"#399 @ 940,155: 29x12",
"#400 @ 841,570: 25x10",
"#401 @ 326,524: 14x13",
"#402 @ 395,114: 25x15",
"#403 @ 498,490: 13x21",
"#404 @ 823,217: 20x25",
"#405 @ 720,139: 27x27",
"#406 @ 526,788: 13x10",
"#407 @ 394,509: 12x21",
"#408 @ 923,814: 15x19",
"#409 @ 819,525: 12x28",
"#410 @ 755,659: 27x27",
"#411 @ 84,668: 18x25",
"#412 @ 789,497: 23x21",
"#413 @ 959,589: 10x15",
"#414 @ 146,362: 15x12",
"#415 @ 378,679: 27x19",
"#416 @ 718,489: 19x10",
"#417 @ 264,339: 19x10",
"#418 @ 61,758: 27x17",
"#419 @ 191,691: 22x28",
"#420 @ 159,280: 18x25",
"#421 @ 805,288: 11x28",
"#422 @ 43,54: 16x17",
"#423 @ 146,954: 20x15",
"#424 @ 917,607: 19x12",
"#425 @ 551,962: 16x22",
"#426 @ 125,44: 27x22",
"#427 @ 330,225: 29x11",
"#428 @ 602,527: 12x26",
"#429 @ 733,209: 10x20",
"#430 @ 557,860: 20x28",
"#431 @ 804,345: 18x12",
"#432 @ 731,157: 17x29",
"#433 @ 617,641: 19x14",
"#434 @ 714,490: 11x25",
"#435 @ 821,519: 14x11",
"#436 @ 864,135: 16x13",
"#437 @ 619,898: 27x29",
"#438 @ 16,969: 24x23",
"#439 @ 521,727: 12x13",
"#440 @ 247,829: 12x25",
"#441 @ 569,205: 26x29",
"#442 @ 322,139: 15x26",
"#443 @ 722,402: 23x11",
"#444 @ 955,194: 25x14",
"#445 @ 924,875: 16x19",
"#446 @ 447,349: 16x24",
"#447 @ 877,87: 17x24",
"#448 @ 129,40: 26x23",
"#449 @ 172,262: 21x25",
"#450 @ 563,476: 16x18",
"#451 @ 693,377: 24x18",
"#452 @ 595,813: 23x13",
"#453 @ 111,421: 25x12",
"#454 @ 275,254: 23x23",
"#455 @ 170,72: 26x21",
"#456 @ 16,680: 23x15",
"#457 @ 720,172: 17x20",
"#458 @ 734,414: 21x16",
"#459 @ 888,157: 23x27",
"#460 @ 674,225: 21x12",
"#461 @ 485,30: 25x16",
"#462 @ 177,542: 20x23",
"#463 @ 394,524: 18x17",
"#464 @ 225,55: 17x23",
"#465 @ 848,258: 6x24",
"#466 @ 868,840: 20x10",
"#467 @ 914,613: 25x10",
"#468 @ 961,71: 24x27",
"#469 @ 41,144: 12x22",
"#470 @ 949,913: 18x14",
"#471 @ 808,772: 14x10",
"#472 @ 844,665: 24x27",
"#473 @ 128,378: 27x13",
"#474 @ 761,382: 11x13",
"#475 @ 19,431: 14x24",
"#476 @ 623,766: 13x16",
"#477 @ 244,703: 10x19",
"#478 @ 464,613: 21x12",
"#479 @ 731,344: 12x14",
"#480 @ 216,31: 21x13",
"#481 @ 332,84: 10x14",
"#482 @ 378,37: 25x14",
"#483 @ 615,521: 22x10",
"#484 @ 464,427: 10x22",
"#485 @ 287,320: 23x13",
"#486 @ 736,123: 10x22",
"#487 @ 779,652: 16x23",
"#488 @ 371,973: 25x14",
"#489 @ 213,503: 20x27",
"#490 @ 231,912: 17x25",
"#491 @ 487,62: 14x19",
"#492 @ 128,539: 18x22",
"#493 @ 246,972: 21x10",
"#494 @ 889,385: 21x10",
"#495 @ 827,697: 16x12",
"#496 @ 760,65: 15x12",
"#497 @ 630,622: 19x21",
"#498 @ 503,416: 11x28",
"#499 @ 268,241: 23x18",
"#500 @ 25,457: 19x27",
"#501 @ 81,828: 19x25",
"#502 @ 797,25: 10x19",
"#503 @ 717,69: 22x27",
"#504 @ 701,606: 12x28",
"#505 @ 227,544: 29x23",
"#506 @ 65,150: 25x16",
"#507 @ 728,174: 16x25",
"#508 @ 49,287: 21x14",
"#509 @ 222,256: 10x23",
"#510 @ 870,736: 11x13",
"#511 @ 448,256: 23x22",
"#512 @ 499,950: 14x25",
"#513 @ 591,674: 17x15",
"#514 @ 977,915: 14x23",
"#515 @ 948,463: 19x18",
"#516 @ 847,398: 18x18",
"#517 @ 136,539: 20x11",
"#518 @ 129,377: 11x25",
"#519 @ 416,621: 22x10",
"#520 @ 651,744: 10x26",
"#521 @ 12,413: 11x18",
"#522 @ 966,164: 21x19",
"#523 @ 508,313: 29x24",
"#524 @ 938,915: 16x11",
"#525 @ 768,902: 29x16",
"#526 @ 225,297: 21x18",
"#527 @ 224,24: 17x15",
"#528 @ 598,169: 13x22",
"#529 @ 832,544: 18x16",
"#530 @ 187,602: 22x14",
"#531 @ 734,409: 15x25",
"#532 @ 838,29: 29x18",
"#533 @ 186,499: 18x12",
"#534 @ 780,104: 26x18",
"#535 @ 769,39: 12x28",
"#536 @ 347,640: 15x19",
"#537 @ 30,605: 28x13",
"#538 @ 670,492: 16x21",
"#539 @ 398,778: 15x9",
"#540 @ 226,484: 18x26",
"#541 @ 743,616: 21x15",
"#542 @ 123,810: 15x21",
"#543 @ 863,969: 29x29",
"#544 @ 316,56: 22x22",
"#545 @ 771,383: 10x16",
"#546 @ 786,161: 11x10",
"#547 @ 925,11: 20x24",
"#548 @ 848,586: 22x25",
"#549 @ 251,638: 14x17",
"#550 @ 51,688: 17x10",
"#551 @ 366,32: 27x29",
"#552 @ 571,533: 20x15",
"#553 @ 27,613: 17x16",
"#554 @ 387,664: 11x23",
"#555 @ 358,837: 17x15",
"#556 @ 309,305: 20x20",
"#557 @ 136,62: 13x29",
"#558 @ 373,921: 25x12",
"#559 @ 228,262: 24x24",
"#560 @ 951,141: 10x23",
"#561 @ 281,776: 13x20",
"#562 @ 94,715: 19x15",
"#563 @ 485,624: 25x25",
"#564 @ 724,126: 17x29",
"#565 @ 668,870: 16x16",
"#566 @ 30,677: 20x29",
"#567 @ 63,203: 22x11",
"#568 @ 608,794: 22x29",
"#569 @ 322,289: 18x12",
"#570 @ 69,640: 24x10",
"#571 @ 61,228: 28x20",
"#572 @ 613,779: 20x19",
"#573 @ 711,540: 12x11",
"#574 @ 295,590: 14x29",
"#575 @ 383,199: 28x13",
"#576 @ 171,152: 11x13",
"#577 @ 18,35: 21x16",
"#578 @ 742,314: 28x25",
"#579 @ 942,703: 28x29",
"#580 @ 348,407: 23x17",
"#581 @ 580,914: 20x18",
"#582 @ 570,911: 18x16",
"#583 @ 935,589: 23x14",
"#584 @ 966,904: 21x13",
"#585 @ 70,712: 11x13",
"#586 @ 58,686: 13x18",
"#587 @ 954,516: 24x24",
"#588 @ 339,136: 22x29",
"#589 @ 757,367: 11x23",
"#590 @ 103,138: 20x13",
"#591 @ 498,159: 14x18",
"#592 @ 191,414: 11x29",
"#593 @ 754,780: 26x18",
"#594 @ 962,296: 29x23",
"#595 @ 815,100: 24x29",
"#596 @ 949,147: 19x18",
"#597 @ 949,158: 13x4",
"#598 @ 31,550: 26x27",
"#599 @ 810,658: 19x23",
"#600 @ 222,933: 17x21",
"#601 @ 704,115: 10x27",
"#602 @ 927,457: 26x18",
"#603 @ 751,345: 10x20",
"#604 @ 306,601: 24x11",
"#605 @ 641,759: 21x24",
"#606 @ 233,485: 15x11",
"#607 @ 18,90: 24x16",
"#608 @ 77,355: 11x12",
"#609 @ 792,343: 18x26",
"#610 @ 482,622: 13x19",
"#611 @ 69,844: 16x15",
"#612 @ 639,953: 15x23",
"#613 @ 848,567: 12x28",
"#614 @ 791,87: 27x29",
"#615 @ 261,261: 23x12",
"#616 @ 745,813: 13x24",
"#617 @ 518,45: 16x28",
"#618 @ 483,266: 27x24",
"#619 @ 971,353: 26x20",
"#620 @ 835,59: 12x29",
"#621 @ 679,439: 10x14",
"#622 @ 36,378: 21x20",
"#623 @ 408,781: 28x28",
"#624 @ 305,165: 26x22",
"#625 @ 788,648: 14x10",
"#626 @ 875,304: 26x16",
"#627 @ 122,817: 21x20",
"#628 @ 134,834: 23x27",
"#629 @ 494,489: 13x18",
"#630 @ 695,383: 18x3",
"#631 @ 540,460: 22x25",
"#632 @ 5,613: 25x29",
"#633 @ 405,950: 19x22",
"#634 @ 261,494: 20x19",
"#635 @ 26,733: 20x10",
"#636 @ 664,916: 23x10",
"#637 @ 963,622: 19x14",
"#638 @ 434,627: 10x18",
"#639 @ 246,800: 21x27",
"#640 @ 794,776: 13x13",
"#641 @ 715,119: 27x12",
"#642 @ 680,100: 19x23",
"#643 @ 277,766: 19x15",
"#644 @ 803,812: 15x14",
"#645 @ 636,537: 29x29",
"#646 @ 398,128: 13x18",
"#647 @ 299,170: 25x28",
"#648 @ 461,515: 14x10",
"#649 @ 386,233: 24x10",
"#650 @ 251,100: 11x18",
"#651 @ 37,975: 23x24",
"#652 @ 538,310: 25x18",
"#653 @ 596,682: 19x28",
"#654 @ 746,338: 20x12",
"#655 @ 917,703: 25x22",
"#656 @ 895,749: 16x16",
"#657 @ 38,396: 26x28",
"#658 @ 518,278: 19x22",
"#659 @ 463,620: 15x25",
"#660 @ 691,923: 14x17",
"#661 @ 53,798: 21x22",
"#662 @ 566,968: 13x24",
"#663 @ 905,620: 23x11",
"#664 @ 359,526: 19x23",
"#665 @ 672,236: 19x13",
"#666 @ 189,602: 29x17",
"#667 @ 740,830: 28x17",
"#668 @ 902,221: 13x13",
"#669 @ 68,418: 24x17",
"#670 @ 109,137: 23x14",
"#671 @ 950,484: 11x22",
"#672 @ 957,797: 22x24",
"#673 @ 2,403: 12x25",
"#674 @ 382,76: 11x14",
"#675 @ 171,728: 13x14",
"#676 @ 180,533: 18x26",
"#677 @ 756,891: 20x27",
"#678 @ 805,277: 17x22",
"#679 @ 41,737: 12x15",
"#680 @ 552,772: 22x22",
"#681 @ 863,488: 25x13",
"#682 @ 139,906: 28x13",
"#683 @ 864,865: 22x16",
"#684 @ 863,465: 16x23",
"#685 @ 468,11: 13x14",
"#686 @ 414,252: 29x21",
"#687 @ 433,238: 12x23",
"#688 @ 664,520: 16x22",
"#689 @ 415,229: 21x23",
"#690 @ 11,781: 19x27",
"#691 @ 598,823: 10x27",
"#692 @ 188,940: 17x15",
"#693 @ 984,678: 11x23",
"#694 @ 539,972: 15x14",
"#695 @ 660,763: 17x29",
"#696 @ 969,204: 23x13",
"#697 @ 118,686: 22x13",
"#698 @ 810,679: 12x16",
"#699 @ 275,42: 14x22",
"#700 @ 568,309: 16x16",
"#701 @ 777,892: 28x20",
"#702 @ 411,197: 16x15",
"#703 @ 894,479: 10x23",
"#704 @ 823,691: 23x26",
"#705 @ 494,838: 23x27",
"#706 @ 663,909: 26x24",
"#707 @ 159,51: 21x29",
"#708 @ 913,253: 22x23",
"#709 @ 320,606: 11x14",
"#710 @ 678,594: 21x19",
"#711 @ 816,812: 22x10",
"#712 @ 562,32: 26x14",
"#713 @ 281,221: 10x28",
"#714 @ 562,467: 27x11",
"#715 @ 876,745: 18x14",
"#716 @ 326,185: 15x28",
"#717 @ 567,632: 15x26",
"#718 @ 929,280: 20x22",
"#719 @ 375,275: 29x15",
"#720 @ 877,976: 15x16",
"#721 @ 9,552: 24x10",
"#722 @ 673,821: 18x25",
"#723 @ 877,374: 23x10",
"#724 @ 319,941: 27x11",
"#725 @ 667,274: 17x28",
"#726 @ 102,430: 28x14",
"#727 @ 960,174: 26x16",
"#728 @ 628,22: 14x21",
"#729 @ 346,747: 13x24",
"#730 @ 329,154: 15x24",
"#731 @ 209,74: 26x18",
"#732 @ 602,621: 20x29",
"#733 @ 927,251: 20x18",
"#734 @ 213,864: 21x22",
"#735 @ 876,485: 25x29",
"#736 @ 383,455: 25x12",
"#737 @ 487,100: 17x13",
"#738 @ 878,479: 16x17",
"#739 @ 317,49: 29x20",
"#740 @ 945,388: 22x12",
"#741 @ 149,89: 18x10",
"#742 @ 181,658: 15x10",
"#743 @ 667,225: 12x14",
"#744 @ 249,542: 18x17",
"#745 @ 18,571: 12x17",
"#746 @ 49,412: 17x17",
"#747 @ 405,28: 18x14",
"#748 @ 121,263: 18x17",
"#749 @ 415,2: 16x12",
"#750 @ 189,51: 11x12",
"#751 @ 836,371: 26x29",
"#752 @ 700,44: 14x11",
"#753 @ 443,713: 28x10",
"#754 @ 570,544: 15x13",
"#755 @ 652,397: 21x23",
"#756 @ 767,88: 24x24",
"#757 @ 396,774: 21x22",
"#758 @ 515,452: 26x13",
"#759 @ 920,590: 27x23",
"#760 @ 180,490: 18x19",
"#761 @ 875,637: 10x28",
"#762 @ 966,498: 20x22",
"#763 @ 486,428: 12x20",
"#764 @ 445,317: 17x19",
"#765 @ 400,779: 26x28",
"#766 @ 455,932: 22x10",
"#767 @ 218,861: 18x28",
"#768 @ 419,329: 16x27",
"#769 @ 728,220: 23x10",
"#770 @ 597,221: 17x14",
"#771 @ 317,764: 14x18",
"#772 @ 182,627: 12x17",
"#773 @ 842,285: 22x19",
"#774 @ 805,673: 16x25",
"#775 @ 651,122: 10x12",
"#776 @ 243,264: 20x26",
"#777 @ 572,628: 14x21",
"#778 @ 942,558: 15x13",
"#779 @ 187,13: 12x23",
"#780 @ 316,45: 16x24",
"#781 @ 29,144: 18x23",
"#782 @ 568,674: 24x19",
"#783 @ 480,2: 24x13",
"#784 @ 789,895: 25x22",
"#785 @ 494,537: 13x23",
"#786 @ 159,659: 10x10",
"#787 @ 323,63: 22x22",
"#788 @ 655,472: 10x22",
"#789 @ 781,39: 15x18",
"#790 @ 621,602: 22x21",
"#791 @ 957,169: 12x25",
"#792 @ 203,699: 23x11",
"#793 @ 908,815: 27x25",
"#794 @ 420,803: 27x29",
"#795 @ 966,281: 25x28",
"#796 @ 423,266: 11x23",
"#797 @ 168,460: 28x16",
"#798 @ 522,951: 20x26",
"#799 @ 272,490: 16x15",
"#800 @ 359,271: 22x13",
"#801 @ 193,581: 12x16",
"#802 @ 978,532: 21x25",
"#803 @ 585,355: 3x7",
"#804 @ 449,225: 10x26",
"#805 @ 831,411: 12x23",
"#806 @ 280,452: 27x25",
"#807 @ 963,771: 18x26",
"#808 @ 681,121: 24x16",
"#809 @ 440,770: 20x20",
"#810 @ 984,898: 13x24",
"#811 @ 333,928: 27x28",
"#812 @ 179,140: 14x29",
"#813 @ 933,476: 16x23",
"#814 @ 5,967: 11x11",
"#815 @ 277,794: 11x26",
"#816 @ 925,445: 16x27",
"#817 @ 582,212: 22x18",
"#818 @ 451,98: 15x4",
"#819 @ 451,429: 21x17",
"#820 @ 670,217: 11x29",
"#821 @ 847,209: 17x21",
"#822 @ 3,432: 25x29",
"#823 @ 659,462: 24x23",
"#824 @ 590,884: 11x10",
"#825 @ 182,838: 28x20",
"#826 @ 39,615: 26x14",
"#827 @ 310,7: 23x23",
"#828 @ 394,678: 24x28",
"#829 @ 740,859: 19x11",
"#830 @ 236,704: 21x16",
"#831 @ 495,419: 16x12",
"#832 @ 271,489: 13x18",
"#833 @ 869,618: 21x15",
"#834 @ 437,248: 16x29",
"#835 @ 284,424: 10x29",
"#836 @ 203,224: 20x15",
"#837 @ 469,947: 29x21",
"#838 @ 971,751: 28x26",
"#839 @ 646,357: 19x27",
"#840 @ 767,885: 11x25",
"#841 @ 293,168: 13x18",
"#842 @ 745,53: 25x25",
"#843 @ 65,273: 10x13",
"#844 @ 883,380: 19x18",
"#845 @ 107,919: 25x24",
"#846 @ 923,447: 10x15",
"#847 @ 62,549: 24x19",
"#848 @ 574,795: 15x10",
"#849 @ 439,696: 13x20",
"#850 @ 329,497: 29x26",
"#851 @ 471,700: 14x28",
"#852 @ 908,253: 11x14",
"#853 @ 509,89: 16x8",
"#854 @ 483,548: 15x21",
"#855 @ 887,615: 21x13",
"#856 @ 177,909: 10x12",
"#857 @ 577,700: 25x27",
"#858 @ 144,31: 10x22",
"#859 @ 399,864: 18x10",
"#860 @ 33,157: 13x20",
"#861 @ 447,480: 16x24",
"#862 @ 239,528: 29x20",
"#863 @ 485,337: 17x10",
"#864 @ 180,480: 12x24",
"#865 @ 26,460: 21x15",
"#866 @ 31,865: 22x16",
"#867 @ 313,79: 25x17",
"#868 @ 647,386: 13x13",
"#869 @ 396,309: 18x16",
"#870 @ 696,196: 4x8",
"#871 @ 906,615: 10x25",
"#872 @ 658,53: 22x27",
"#873 @ 112,332: 15x23",
"#874 @ 704,404: 29x13",
"#875 @ 777,320: 15x11",
"#876 @ 36,729: 14x18",
"#877 @ 357,816: 26x27",
"#878 @ 694,184: 18x24",
"#879 @ 91,126: 14x17",
"#880 @ 333,121: 16x27",
"#881 @ 81,394: 21x16",
"#882 @ 174,1: 19x19",
"#883 @ 440,733: 17x13",
"#884 @ 98,960: 14x11",
"#885 @ 327,0: 19x12",
"#886 @ 907,354: 16x21",
"#887 @ 905,849: 24x10",
"#888 @ 544,971: 12x18",
"#889 @ 729,597: 21x29",
"#890 @ 228,138: 11x24",
"#891 @ 784,701: 25x12",
"#892 @ 596,219: 10x20",
"#893 @ 760,204: 18x11",
"#894 @ 902,150: 29x13",
"#895 @ 25,321: 17x10",
"#896 @ 904,959: 16x23",
"#897 @ 940,600: 10x18",
"#898 @ 24,81: 12x20",
"#899 @ 416,171: 25x16",
"#900 @ 681,235: 10x22",
"#901 @ 959,345: 16x28",
"#902 @ 776,871: 17x11",
"#903 @ 888,273: 15x17",
"#904 @ 746,797: 22x29",
"#905 @ 326,273: 28x29",
"#906 @ 111,71: 26x15",
"#907 @ 660,156: 10x14",
"#908 @ 23,280: 16x19",
"#909 @ 126,860: 11x13",
"#910 @ 134,521: 17x11",
"#911 @ 733,152: 15x26",
"#912 @ 955,623: 25x16",
"#913 @ 802,815: 25x23",
"#914 @ 577,464: 14x15",
"#915 @ 503,824: 14x20",
"#916 @ 648,756: 19x29",
"#917 @ 923,966: 24x17",
"#918 @ 524,72: 15x19",
"#919 @ 403,89: 14x26",
"#920 @ 605,459: 13x10",
"#921 @ 96,453: 27x13",
"#922 @ 869,776: 25x18",
"#923 @ 921,528: 22x22",
"#924 @ 682,896: 16x28",
"#925 @ 858,224: 15x18",
"#926 @ 121,615: 17x16",
"#927 @ 848,303: 10x21",
"#928 @ 17,513: 19x10",
"#929 @ 83,256: 22x15",
"#930 @ 793,750: 24x21",
"#931 @ 924,196: 17x27",
"#932 @ 605,482: 27x23",
"#933 @ 532,785: 22x11",
"#934 @ 522,972: 11x26",
"#935 @ 706,972: 12x26",
"#936 @ 160,367: 16x27",
"#937 @ 304,664: 12x15",
"#938 @ 407,273: 19x10",
"#939 @ 9,180: 14x14",
"#940 @ 181,685: 23x14",
"#941 @ 26,812: 14x10",
"#942 @ 412,252: 10x18",
"#943 @ 50,339: 23x11",
"#944 @ 336,909: 28x18",
"#945 @ 829,277: 16x22",
"#946 @ 607,22: 12x19",
"#947 @ 412,871: 27x21",
"#948 @ 865,28: 12x18",
"#949 @ 104,449: 22x27",
"#950 @ 714,78: 11x22",
"#951 @ 550,492: 27x20",
"#952 @ 5,972: 24x18",
"#953 @ 491,907: 13x21",
"#954 @ 75,19: 24x29",
"#955 @ 114,550: 26x19",
"#956 @ 608,527: 25x21",
"#957 @ 714,551: 20x25",
"#958 @ 593,545: 22x20",
"#959 @ 603,1: 16x29",
"#960 @ 621,155: 27x19",
"#961 @ 353,330: 18x14",
"#962 @ 911,103: 24x14",
"#963 @ 695,42: 22x16",
"#964 @ 416,247: 28x14",
"#965 @ 911,266: 21x12",
"#966 @ 632,523: 21x20",
"#967 @ 840,256: 25x29",
"#968 @ 542,34: 11x10",
"#969 @ 721,807: 17x17",
"#970 @ 559,226: 27x16",
"#971 @ 510,661: 27x12",
"#972 @ 645,734: 14x18",
"#973 @ 755,665: 16x17",
"#974 @ 229,484: 22x17",
"#975 @ 654,80: 29x15",
"#976 @ 946,395: 23x20",
"#977 @ 274,771: 23x23",
"#978 @ 954,510: 24x13",
"#979 @ 162,259: 28x29",
"#980 @ 822,624: 19x13",
"#981 @ 182,503: 28x17",
"#982 @ 427,774: 11x11",
"#983 @ 486,271: 14x27",
"#984 @ 126,553: 14x12",
"#985 @ 406,262: 27x16",
"#986 @ 926,955: 15x10",
"#987 @ 670,262: 18x12",
"#988 @ 45,49: 23x29",
"#989 @ 533,311: 15x14",
"#990 @ 504,33: 12x24",
"#991 @ 346,299: 13x25",
"#992 @ 565,478: 17x18",
"#993 @ 840,391: 14x24",
"#994 @ 416,950: 13x23",
"#995 @ 212,668: 14x16",
"#996 @ 515,958: 13x15",
"#997 @ 397,583: 29x24",
"#998 @ 404,606: 24x21",
"#999 @ 438,983: 27x16",
"#1000 @ 0,159: 28x15",
"#1001 @ 860,823: 21x28",
"#1002 @ 411,818: 21x21",
"#1003 @ 958,36: 19x14",
"#1004 @ 918,443: 22x23",
"#1005 @ 972,79: 19x25",
"#1006 @ 825,314: 28x14",
"#1007 @ 239,478: 14x27",
"#1008 @ 411,261: 13x27",
"#1009 @ 34,48: 26x16",
"#1010 @ 258,373: 19x11",
"#1011 @ 862,222: 28x11",
"#1012 @ 718,224: 23x26",
"#1013 @ 908,962: 27x27",
"#1014 @ 554,479: 29x24",
"#1015 @ 570,785: 13x27",
"#1016 @ 752,172: 18x29",
"#1017 @ 276,346: 15x15",
"#1018 @ 744,134: 25x23",
"#1019 @ 653,424: 25x14",
"#1020 @ 177,168: 24x18",
"#1021 @ 958,558: 11x11",
"#1022 @ 819,49: 23x15",
"#1023 @ 356,611: 22x21",
"#1024 @ 318,90: 16x11",
"#1025 @ 486,421: 13x22",
"#1026 @ 152,685: 27x22",
"#1027 @ 925,527: 23x10",
"#1028 @ 601,696: 17x20",
"#1029 @ 106,265: 29x20",
"#1030 @ 955,925: 19x26",
"#1031 @ 957,165: 22x28",
"#1032 @ 549,977: 26x19",
"#1033 @ 415,182: 29x11",
"#1034 @ 134,587: 29x16",
"#1035 @ 456,975: 14x13",
"#1036 @ 143,493: 22x25",
"#1037 @ 250,800: 19x12",
"#1038 @ 179,553: 10x14",
"#1039 @ 721,965: 12x23",
"#1040 @ 52,639: 27x21",
"#1041 @ 668,233: 15x19",
"#1042 @ 859,801: 11x26",
"#1043 @ 873,599: 29x22",
"#1044 @ 62,504: 13x14",
"#1045 @ 140,609: 28x22",
"#1046 @ 534,301: 19x20",
"#1047 @ 426,949: 14x21",
"#1048 @ 18,146: 23x18",
"#1049 @ 659,550: 19x19",
"#1050 @ 755,817: 12x21",
"#1051 @ 182,322: 12x18",
"#1052 @ 194,591: 18x12",
"#1053 @ 807,306: 28x21",
"#1054 @ 521,780: 17x27",
"#1055 @ 97,938: 18x26",
"#1056 @ 946,40: 29x28",
"#1057 @ 639,169: 24x23",
"#1058 @ 142,573: 11x22",
"#1059 @ 89,45: 13x25",
"#1060 @ 655,35: 10x28",
"#1061 @ 392,274: 28x24",
"#1062 @ 382,325: 11x26",
"#1063 @ 521,744: 21x28",
"#1064 @ 499,780: 29x14",
"#1065 @ 162,819: 28x22",
"#1066 @ 17,93: 19x21",
"#1067 @ 506,931: 13x18",
"#1068 @ 283,495: 21x11",
"#1069 @ 400,459: 10x15",
"#1070 @ 574,640: 28x19",
"#1071 @ 236,233: 23x10",
"#1072 @ 513,632: 16x29",
"#1073 @ 816,147: 14x25",
"#1074 @ 870,221: 10x24",
"#1075 @ 918,323: 15x22",
"#1076 @ 158,894: 11x15",
"#1077 @ 854,144: 15x15",
"#1078 @ 336,901: 19x25",
"#1079 @ 580,497: 26x29",
"#1080 @ 523,81: 18x10",
"#1081 @ 54,685: 22x20",
"#1082 @ 318,232: 11x19",
"#1083 @ 363,319: 29x20",
"#1084 @ 335,1: 19x26",
"#1085 @ 888,455: 21x12",
"#1086 @ 700,164: 28x25",
"#1087 @ 959,786: 20x16",
"#1088 @ 764,545: 21x14",
"#1089 @ 927,599: 13x22",
"#1090 @ 122,505: 26x20",
"#1091 @ 595,227: 11x17",
"#1092 @ 802,43: 10x20",
"#1093 @ 97,250: 29x23",
"#1094 @ 536,506: 17x26",
"#1095 @ 951,713: 11x14",
"#1096 @ 577,651: 12x12",
"#1097 @ 409,266: 13x22",
"#1098 @ 945,504: 11x24",
"#1099 @ 806,810: 20x14",
"#1100 @ 896,560: 19x12",
"#1101 @ 76,251: 22x27",
"#1102 @ 118,430: 25x16",
"#1103 @ 873,114: 21x14",
"#1104 @ 920,956: 22x29",
"#1105 @ 723,397: 25x26",
"#1106 @ 183,572: 26x19",
"#1107 @ 705,96: 29x21",
"#1108 @ 413,287: 17x23",
"#1109 @ 405,625: 23x20",
"#1110 @ 622,870: 13x11",
"#1111 @ 575,628: 27x28",
"#1112 @ 492,54: 17x12",
"#1113 @ 64,418: 27x19",
"#1114 @ 551,423: 15x24",
"#1115 @ 589,198: 15x23",
"#1116 @ 828,570: 24x23",
"#1117 @ 863,189: 22x15",
"#1118 @ 190,588: 11x10",
"#1119 @ 309,617: 13x28",
"#1120 @ 916,856: 12x25",
"#1121 @ 333,760: 23x17",
"#1122 @ 68,751: 27x10",
"#1123 @ 763,394: 17x23",
"#1124 @ 39,613: 26x15",
"#1125 @ 404,397: 25x12",
"#1126 @ 393,313: 16x22",
"#1127 @ 615,467: 16x23",
"#1128 @ 78,142: 20x29",
"#1129 @ 259,86: 25x18",
"#1130 @ 444,938: 28x23",
"#1131 @ 934,167: 27x14",
"#1132 @ 145,183: 13x28",
"#1133 @ 557,871: 20x12",
"#1134 @ 106,414: 20x11",
"#1135 @ 101,923: 10x18",
"#1136 @ 579,10: 25x21",
"#1137 @ 146,111: 26x14",
"#1138 @ 2,178: 26x26",
"#1139 @ 810,628: 13x24",
"#1140 @ 860,516: 20x15",
"#1141 @ 218,692: 12x21",
"#1142 @ 850,671: 26x10",
"#1143 @ 766,152: 21x21",
"#1144 @ 147,463: 26x26",
"#1145 @ 328,159: 17x21",
"#1146 @ 853,207: 21x17",
"#1147 @ 583,396: 24x26",
"#1148 @ 191,621: 14x22",
"#1149 @ 527,300: 17x16",
"#1150 @ 390,113: 23x18",
"#1151 @ 103,83: 13x17",
"#1152 @ 747,225: 20x23",
"#1153 @ 574,652: 25x13",
"#1154 @ 509,91: 15x11",
"#1155 @ 200,715: 14x21",
"#1156 @ 479,176: 22x12",
"#1157 @ 761,298: 22x26",
"#1158 @ 50,879: 25x25",
"#1159 @ 34,806: 23x10",
"#1160 @ 901,634: 25x22",
"#1161 @ 488,52: 28x17",
"#1162 @ 220,651: 14x23",
"#1163 @ 311,243: 26x20",
"#1164 @ 866,219: 23x29",
"#1165 @ 223,316: 19x26",
"#1166 @ 322,915: 13x21",
"#1167 @ 881,640: 14x29",
"#1168 @ 685,164: 22x22",
"#1169 @ 824,36: 18x18",
"#1170 @ 468,939: 13x20",
"#1171 @ 208,495: 22x24",
"#1172 @ 629,152: 18x10",
"#1173 @ 804,129: 26x28",
"#1174 @ 283,232: 17x24",
"#1175 @ 217,765: 19x13",
"#1176 @ 638,225: 20x21",
"#1177 @ 598,585: 27x26",
"#1178 @ 920,698: 10x18",
"#1179 @ 798,772: 16x23",
"#1180 @ 130,101: 16x24",
"#1181 @ 852,42: 14x26",
"#1182 @ 400,200: 13x18",
"#1183 @ 346,894: 18x11",
"#1184 @ 555,86: 21x23",
"#1185 @ 789,116: 13x25",
"#1186 @ 357,39: 5x8",
"#1187 @ 95,378: 22x29",
"#1188 @ 271,312: 20x21",
"#1189 @ 448,95: 22x12",
"#1190 @ 797,879: 14x18",
"#1191 @ 261,373: 19x28",
"#1192 @ 881,192: 29x13",
"#1193 @ 863,23: 17x26",
"#1194 @ 421,114: 10x26",
"#1195 @ 971,793: 20x27",
"#1196 @ 45,788: 12x29",
"#1197 @ 947,583: 29x18",
"#1198 @ 594,565: 22x29",
"#1199 @ 642,272: 28x13",
"#1200 @ 759,65: 27x26",
"#1201 @ 957,77: 26x27",
"#1202 @ 24,801: 22x21",
"#1203 @ 432,317: 11x20",
"#1204 @ 644,238: 17x20",
"#1205 @ 753,351: 4x7",
"#1206 @ 849,217: 14x18",
"#1207 @ 942,657: 12x26",
"#1208 @ 454,723: 18x24",
"#1209 @ 81,461: 18x11",
"#1210 @ 851,869: 11x10",
"#1211 @ 66,591: 14x17",
"#1212 @ 740,174: 15x19",
"#1213 @ 394,286: 14x28",
"#1214 @ 466,464: 20x19",
"#1215 @ 858,372: 24x16",
"#1216 @ 340,4: 12x18",
"#1217 @ 607,154: 12x29",
"#1218 @ 589,474: 23x28",
"#1219 @ 583,27: 19x23",
"#1220 @ 831,223: 20x25",
"#1221 @ 259,850: 14x26",
"#1222 @ 116,172: 27x26",
"#1223 @ 963,342: 26x17",
"#1224 @ 367,333: 11x11",
"#1225 @ 637,887: 16x17",
"#1226 @ 262,258: 27x11",
"#1227 @ 493,568: 17x29",
"#1228 @ 675,524: 17x16",
"#1229 @ 740,834: 25x14",
"#1230 @ 866,525: 14x13",
"#1231 @ 593,736: 16x25",
"#1232 @ 618,153: 15x18",
"#1233 @ 286,296: 26x24",
"#1234 @ 923,849: 27x14",
"#1235 @ 839,66: 20x25",
"#1236 @ 584,488: 14x15",
"#1237 @ 414,168: 26x18",
"#1238 @ 42,27: 20x26",
"#1239 @ 943,740: 15x19",
"#1240 @ 108,336: 28x29",
"#1241 @ 677,222: 19x16",
"#1242 @ 912,816: 19x13",
"#1243 @ 40,371: 11x13",
"#1244 @ 595,895: 26x26",
"#1245 @ 232,418: 24x17",
"#1246 @ 902,609: 26x18",
"#1247 @ 67,25: 21x17",
"#1248 @ 737,354: 13x25",
"#1249 @ 843,355: 28x19",
"#1250 @ 59,665: 22x29",
"#1251 @ 369,255: 14x17",
"#1252 @ 775,750: 23x23",
"#1253 @ 329,838: 14x16",
"#1254 @ 591,983: 24x15",
"#1255 @ 918,380: 12x19",
"#1256 @ 499,94: 13x18",
"#1257 @ 269,224: 22x29",
"#1258 @ 918,324: 21x15",
"#1259 @ 213,201: 21x22",
"#1260 @ 411,634: 26x14",
"#1261 @ 875,547: 27x16",
"#1262 @ 706,973: 23x23",
"#1263 @ 568,846: 15x15",
"#1264 @ 64,620: 15x21",
"#1265 @ 612,143: 10x17",
"#1266 @ 446,537: 24x17",
"#1267 @ 472,742: 24x12",
"#1268 @ 76,715: 25x15",
"#1269 @ 666,603: 20x23",
"#1270 @ 708,808: 14x16",
"#1271 @ 228,828: 23x17",
"#1272 @ 159,664: 20x24",
"#1273 @ 508,616: 28x13",
"#1274 @ 971,175: 15x19",
"#1275 @ 914,494: 22x23",
"#1276 @ 145,105: 15x11",
"#1277 @ 292,661: 13x21",
"#1278 @ 805,777: 18x22",
"#1279 @ 14,403: 23x23",
"#1280 @ 451,252: 26x22",
"#1281 @ 931,155: 23x15",
"#1282 @ 851,873: 18x16",
"#1283 @ 141,259: 24x13",
"#1284 @ 489,604: 22x19",
"#1285 @ 672,613: 21x28",
"#1286 @ 677,761: 15x25",
"#1287 @ 25,740: 23x11",
"#1288 @ 383,181: 20x22",
"#1289 @ 55,213: 10x19",
"#1290 @ 468,799: 17x24",
"#1291 @ 265,865: 25x12",
"#1292 @ 200,507: 11x17",
"#1293 @ 718,774: 13x15",
"#1294 @ 869,93: 13x27",
"#1295 @ 1,296: 21x22",
"#1296 @ 903,570: 12x28",
"#1297 @ 386,233: 27x22",
"#1298 @ 427,233: 23x18",
"#1299 @ 902,452: 17x15",
"#1300 @ 893,625: 21x19",
"#1301 @ 620,734: 17x13",
"#1302 @ 372,298: 28x19",
"#1303 @ 794,115: 27x15",
"#1304 @ 845,467: 28x10",
"#1305 @ 474,31: 23x10",
"#1306 @ 47,32: 12x18",
"#1307 @ 671,564: 14x28",
"#1308 @ 146,495: 26x24",
"#1309 @ 795,808: 23x28",
"#1310 @ 740,118: 13x11",
"#1311 @ 209,22: 19x19",
"#1312 @ 215,762: 16x11",
"#1313 @ 121,449: 29x27",
"#1314 @ 233,313: 28x25",
"#1315 @ 197,41: 29x16",
"#1316 @ 492,590: 24x29",
"#1317 @ 246,467: 26x23",
"#1318 @ 608,550: 12x25",
"#1319 @ 869,860: 19x21",
"#1320 @ 274,834: 22x27",
"#1321 @ 833,61: 28x22",
"#1322 @ 904,91: 27x18",
"#1323 @ 921,373: 14x17",
"#1324 @ 868,218: 18x19",
"#1325 @ 646,51: 14x22",
"#1326 @ 930,825: 20x11",
"#1327 @ 336,292: 14x13",
"#1328 @ 164,438: 16x29",
"#1329 @ 351,585: 23x28",
"#1330 @ 788,141: 18x27",
"#1331 @ 739,386: 28x22",
"#1332 @ 460,504: 16x16",
"#1333 @ 956,176: 18x24",
"#1334 @ 418,876: 11x5",
"#1335 @ 92,36: 26x14",
"#1336 @ 810,826: 12x5",
"#1337 @ 958,729: 15x20",
"#1338 @ 643,609: 26x10",
"#1339 @ 486,324: 10x18",
"#1340 @ 884,869: 11x26",
"#1341 @ 1,297: 28x24",
"#1342 @ 939,522: 11x27",
"#1343 @ 401,385: 10x23",
"#1344 @ 582,351: 10x17",
"#1345 @ 109,566: 16x14",
"#1346 @ 135,840: 29x17",
"#1347 @ 30,34: 17x17",
"#1348 @ 730,782: 24x23",
"#1349 @ 977,696: 11x18",
"#1350 @ 967,632: 27x20",
"#1351 @ 854,61: 21x25",
"#1352 @ 946,175: 14x26",
"#1353 @ 6,99: 20x16",
"#1354 @ 898,59: 26x11",
"#1355 @ 107,424: 18x29",
"#1356 @ 166,740: 27x10",
"#1357 @ 654,70: 10x28",
"#1358 @ 787,281: 10x18",
"#1359 @ 102,354: 13x23",
"#1360 @ 489,731: 10x12",
"#1361 @ 918,682: 24x24",
"#1362 @ 632,529: 25x14",
"#1363 @ 877,236: 17x23",
"#1364 @ 383,119: 20x26",
"#1365 @ 866,918: 23x26",
"#1366 @ 909,723: 11x22",
"#1367 @ 598,502: 14x29",
"#1368 @ 70,579: 24x23",
"#1369 @ 176,456: 19x14",
"#1370 @ 311,280: 28x21",
"#1371 @ 588,401: 14x26",
"#1372 @ 148,77: 12x13",
"#1373 @ 194,527: 22x21",
"#1374 @ 552,234: 22x11",
"#1375 @ 367,324: 16x13",
"#1376 @ 450,358: 25x15",
"#1377 @ 71,615: 17x21",
"#1378 @ 793,87: 26x17",
"#1379 @ 894,450: 17x16",
"#1380 @ 708,629: 17x14",
"#1381 @ 919,335: 14x29",
"#1382 @ 563,243: 22x10",
"#1383 @ 504,783: 22x18",
"#1384 @ 726,515: 13x18",
"#1385 @ 909,722: 17x11",
"#1386 @ 276,490: 18x18",
"#1387 @ 98,560: 14x28",
"#1388 @ 23,274: 10x24",
"#1389 @ 32,323: 15x20",
"#1390 @ 778,886: 26x18",
"#1391 @ 256,801: 23x10",
"#1392 @ 916,500: 10x13",
"#1393 @ 856,667: 7x18",
"#1394 @ 103,682: 24x17",
"#1395 @ 727,567: 17x25",
"#1396 @ 52,176: 19x21",
"#1397 @ 453,308: 19x24",
"#1398 @ 238,370: 21x18",
"#1399 @ 724,519: 23x10",
}; | 2018/day_03_2.zig |
const std = @import("std");
const builtin = std.builtin;
const math = std.math;
const mem = std.mem;
const meta = std.meta;
const testing = std.testing;
const debug = std.debug;
const TypeInfo = builtin.TypeInfo;
const sort = std.sort.sort;
const RecursiveField = @import("recursive_field.zig").RecursiveField;
/// A dynamic (tagged union) value of a type that could be a recursive field of
/// T.
pub fn DynRecFieldValue(comptime T: type) type {
comptime var fields = RecursiveField.of(T);
sort(RecursiveField, fields, {}, RecursiveField.lessThan);
comptime var collapsed_fields: [fields.len]RecursiveField = undefined;
var write = 0;
for (fields) |field, i| {
if (i == 0 or field.field_type != fields[i - 1].field_type) {
collapsed_fields[write] = field;
write += 1;
}
}
const num_types = if (fields.len == 0) 0 else write;
var _tag_fields: [num_types]TypeInfo.EnumField = undefined;
var _union_fields: [num_types]TypeInfo.UnionField = undefined;
var _types: [num_types]type = undefined;
for (collapsed_fields) |field, i| {
if (i >= num_types) break;
const type_name = @typeName(field.field_type); // TODO: mangle this better
_tag_fields[i] = TypeInfo.EnumField{
.name = type_name,
.value = i,
};
_union_fields[i] = TypeInfo.UnionField{
.name = type_name,
.field_type = field.field_type,
.alignment = @alignOf(field.field_type),
};
_types[i] = field.field_type;
}
const tag_fields = &_tag_fields;
const union_fields = &_union_fields;
const __types = _types;
const TagType = @Type(.{ .Enum = .{
.layout = .Auto,
.tag_type = math.IntFittingRange(0, num_types - 1),
.fields = tag_fields,
.decls = &[0]TypeInfo.Declaration{},
.is_exhaustive = true,
} });
const UnionType = @Type(.{ .Union = .{
.layout = .Extern,
.tag_type = null,
.fields = union_fields,
.decls = &[0]TypeInfo.Declaration{},
} });
return struct {
tag: TagType,
value: UnionType,
const Self = @This();
/// All of the types represented.
pub const types = __types;
/// A tag enum for each type.
pub const DynType = TagType;
/// Creates a value given a type and the value of that type.
pub fn of(comptime Type: type, val: Type) Self {
comptime var tag = dynType(Type) orelse @compileError("Type is not a tag of union");
var value: UnionType = undefined;
@ptrCast(*Type, &value).* = val;
return .{ .tag = tag, .value = value };
}
/// Returns the `DynType` that represents the type `T`, or null if `T`
/// is not represented.
pub fn dynType(comptime Ty: type) ?DynType {
for (types) |ty, i| {
if (ty == Ty) return @intToEnum(TagType, tag_fields[i].value);
}
return null;
}
/// Compares two `DynRecFieldValue`s for equality.
pub fn eq(self: Self, other: Self) bool {
if (self.tag != other.tag) return false;
inline for (union_fields) |field| {
if (mem.eql(u8, @tagName(self.tag), field.name)) {
var self_val = @field(self.value, field.name);
var other_val = @field(other.value, field.name);
return meta.eql(self_val, other_val);
}
}
unreachable;
}
/// Creates a `DynRecFieldValue` of the given zero-sized type.
///
/// Passing a non-zero sized type to this function is safety-checked
/// illegal behavior.
pub fn fromZst(dyn_type: TagType) Self {
debug.assert(size_table[@enumToInt(dyn_type)] == 0);
return .{ .tag = dyn_type, .value = undefined };
}
/// Creates a `DynRecFieldValue` of the given type. Bitpacked data is
/// supported. `data` must point to the byte containing the start of the
/// value, and `bit_offset` must be the bit offset within that byte of
/// the start of the value.
pub fn fromRaw(dyn_type: TagType, data: [*]const u8, bit_offset: u3) Self {
var out: Self = .{ .tag = dyn_type, .value = undefined };
copyAndBitshiftDown(data, mem.asBytes(&out.value)[0..byteSize(dyn_type)], bit_offset);
return out;
}
/// Writes the value held to a bit-aligned location. `data` must point
/// to the byte containing the start of the location to be written, and
/// `bit_offset` the bit offset within that byte.
pub fn writeRaw(self: Self, out: [*]u8, bit_offset: u3) void {
copyAndBitshiftUp(
mem.asBytes(&self.value)[0 .. byteSize(self.tag) + 1],
out,
bit_offset,
);
}
const size_table = tbl: {
var table: [math.maxInt(meta.TagType(DynType)) + 1]usize = undefined;
for (types) |ty| {
table[@enumToInt(dynType(ty).?)] = @sizeOf(ty);
}
break :tbl table;
};
/// Returns the size of the given type, according to the rules of
/// `@sizeOf`.
pub fn byteSize(dyn_type: DynType) usize {
return size_table[@enumToInt(dyn_type)];
}
};
}
fn copyAndBitshiftDown(source: [*]const u8, dest: []u8, bit_offset: u3) void {
for (dest) |*out, i| {
var int = mem.readIntLittle(u16, @ptrCast(*const [2]u8, &source[i]));
out.* = @truncate(u8, int >> bit_offset);
}
}
fn copyAndBitshiftUp(source: []const u8, dest: [*]u8, bit_offset: u3) void {
if (source.len == 0) unreachable;
var last_byte = dest[0];
for (source) |byte, i| {
var two: u16 = @as(u16, last_byte) | (@as(u16, byte) << 8);
two <<= bit_offset;
dest[i] = @intCast(u8, two >> 8);
last_byte = byte;
}
}
test "bitshift copies roundtrip" {
var r = std.rand.DefaultPrng.init(0x64a963238f776912);
var data: [16]u8 = undefined;
r.random.bytes(&data);
var shifted: [17]u8 = undefined;
copyAndBitshiftUp(mem.asBytes(&data), &shifted, 3);
var roundtrip: [16]u8 = undefined;
copyAndBitshiftDown(&shifted, mem.asBytes(&roundtrip), 3);
try testing.expectEqual(data, roundtrip);
} | src/dyn_rec_field_value.zig |
const std = @import("std");
const os = std.os;
const io = std.io;
const mem = std.mem;
const warn = std.debug.warn;
const assert = std.debug.assert;
const math = std.math;
const proto = @import("protocol.zig");
const builtin = @import("builtin");
const json = @import("./zson/src/main.zig");
pub const ReadError = os.File.ReadError || error{BadInput};
pub const InStream = io.InStream(ReadError);
const default_message_size: usize = 8192;
// content_length is the header key which stoares the length of the message
// content.
const content_length = "Content-Length";
/// Reader defines method for reading rpc messages.
pub const Reader = struct {
allocator: *mem.Allocator,
pub fn init(a: *mem.Allocator) Reader {
return Reader{ .allocator = a };
}
/// readStream decodes a rpc message from stream. stream must implement the
/// io.Instream interface.
///
/// This reads one byte at a time from the stream. No verification of the
/// message is done , meaning we don't check if the content has the same
/// length as Content-Length header.
///
/// Convenient for streaming purposes where input can be streamed and decoded
/// as it flows.
pub fn readStream(self: *Reader, stream: var) !proto.Message {
var list = std.ArrayList(u8).init(self.allocator);
defer list.deinit();
var header: proto.Header = undefined;
var message: proto.Message = undefined;
var crlf = []u8{0} ** 2;
var in_header = true;
var end_content_length = false;
var balanced: usize = 0;
while (true) {
const ch = try stream.readByte();
switch (ch) {
'\r' => {
if (in_header) {
crlf[0] = '\r';
}
},
'\n' => {
if (in_header) {
if (crlf[0] != '\r') {
return error.BadInput;
}
// we have reached delimiter now
crlf[1] = crlf[1] + 1;
crlf[0] = 0;
if (end_content_length) {
const s = list.toSlice();
const v = try std.fmt.parseInt(u64, s, 10);
header.content_length = v;
end_content_length = false;
// clear the buffer, we don't want the content body
// to be messed up.
try list.resize(0);
}
}
},
'{' => {
if (crlf[1] == 0) {
// we are not supposed to encounter message body before
// any headers.
return error.BadInput;
}
// remove in_header state the content body begins here. It is
// better to add the check here so we can have flexibility
// for changes which might add more headers.
if (in_header) in_header = false;
try list.append(ch);
balanced += 1;
},
':' => {
if (in_header) {
const h = list.toOwnedSlice();
if (mem.eql(u8, h, content_length)) {
end_content_length = true;
} else {
return error.BadInput;
}
} else {
try list.append(ch);
}
},
'}' => {
try list.append(ch);
balanced -= 1;
const v = list.toSlice();
if (balanced == 0) {
// we are at the end otf the top level json object. We
// parse the body too json values.
//
const buf = list.toOwnedSlice();
var p = json.Parser.init(self.allocator, true);
var value = try p.parse(buf);
message.header = header;
message.content = value;
return message;
}
},
else => {
// skip spaces in the header section to avoid trimming
// spaces before reading values.
if (in_header and ch == ' ') continue;
try list.append(ch);
},
}
}
}
}; | src/rpc.zig |
const std = @import("std.zig");
const mem = std.mem;
const builtin = std.builtin;
/// TODO Nearly all the functions in this namespace would be
/// better off if https://github.com/ziglang/zig/issues/425
/// was solved.
pub const Target = union(enum) {
Native: void,
Cross: Cross,
pub const Os = enum {
freestanding,
ananas,
cloudabi,
dragonfly,
freebsd,
fuchsia,
ios,
kfreebsd,
linux,
lv2,
macosx,
netbsd,
openbsd,
solaris,
windows,
haiku,
minix,
rtems,
nacl,
cnk,
aix,
cuda,
nvcl,
amdhsa,
ps4,
elfiamcu,
tvos,
watchos,
mesa3d,
contiki,
amdpal,
hermit,
hurd,
wasi,
emscripten,
uefi,
other,
pub fn parse(text: []const u8) !Os {
const info = @typeInfo(Os);
inline for (info.Enum.fields) |field| {
if (mem.eql(u8, text, field.name)) {
return @field(Os, field.name);
}
}
return error.UnknownOperatingSystem;
}
};
pub const aarch64 = @import("target/aarch64.zig");
pub const amdgpu = @import("target/amdgpu.zig");
pub const arm = @import("target/arm.zig");
pub const avr = @import("target/avr.zig");
pub const bpf = @import("target/bpf.zig");
pub const hexagon = @import("target/hexagon.zig");
pub const mips = @import("target/mips.zig");
pub const msp430 = @import("target/msp430.zig");
pub const nvptx = @import("target/nvptx.zig");
pub const powerpc = @import("target/powerpc.zig");
pub const riscv = @import("target/riscv.zig");
pub const sparc = @import("target/sparc.zig");
pub const systemz = @import("target/systemz.zig");
pub const wasm = @import("target/wasm.zig");
pub const x86 = @import("target/x86.zig");
pub const Abi = enum {
none,
gnu,
gnuabin32,
gnuabi64,
gnueabi,
gnueabihf,
gnux32,
code16,
eabi,
eabihf,
elfv1,
elfv2,
android,
musl,
musleabi,
musleabihf,
msvc,
itanium,
cygnus,
coreclr,
simulator,
macabi,
pub fn default(arch: Cpu.Arch, target_os: Os) Abi {
switch (arch) {
.wasm32, .wasm64 => return .musl,
else => {},
}
switch (target_os) {
.freestanding,
.ananas,
.cloudabi,
.dragonfly,
.lv2,
.solaris,
.haiku,
.minix,
.rtems,
.nacl,
.cnk,
.aix,
.cuda,
.nvcl,
.amdhsa,
.ps4,
.elfiamcu,
.mesa3d,
.contiki,
.amdpal,
.hermit,
.other,
=> return .eabi,
.openbsd,
.macosx,
.freebsd,
.ios,
.tvos,
.watchos,
.fuchsia,
.kfreebsd,
.netbsd,
.hurd,
=> return .gnu,
.windows,
.uefi,
=> return .msvc,
.linux,
.wasi,
.emscripten,
=> return .musl,
}
}
pub fn parse(text: []const u8) !Abi {
const info = @typeInfo(Abi);
inline for (info.Enum.fields) |field| {
if (mem.eql(u8, text, field.name)) {
return @field(Abi, field.name);
}
}
return error.UnknownApplicationBinaryInterface;
}
};
pub const ObjectFormat = enum {
unknown,
coff,
elf,
macho,
wasm,
};
pub const SubSystem = enum {
Console,
Windows,
Posix,
Native,
EfiApplication,
EfiBootServiceDriver,
EfiRom,
EfiRuntimeDriver,
};
pub const Cross = struct {
cpu: Cpu,
os: Os,
abi: Abi,
};
pub const Cpu = struct {
/// Architecture
arch: Arch,
/// The CPU model to target. It has a set of features
/// which are overridden with the `features` field.
model: *const Model,
/// An explicit list of the entire CPU feature set. It may differ from the specific CPU model's features.
features: Feature.Set,
pub const Feature = struct {
/// The bit index into `Set`. Has a default value of `undefined` because the canonical
/// structures are populated via comptime logic.
index: Set.Index = undefined,
/// Has a default value of `undefined` because the canonical
/// structures are populated via comptime logic.
name: []const u8 = undefined,
/// If this corresponds to an LLVM-recognized feature, this will be populated;
/// otherwise null.
llvm_name: ?[:0]const u8,
/// Human-friendly UTF-8 text.
description: []const u8,
/// Sparse `Set` of features this depends on.
dependencies: Set,
/// A bit set of all the features.
pub const Set = struct {
ints: [usize_count]usize,
pub const needed_bit_count = 154;
pub const byte_count = (needed_bit_count + 7) / 8;
pub const usize_count = (byte_count + (@sizeOf(usize) - 1)) / @sizeOf(usize);
pub const Index = std.math.Log2Int(std.meta.IntType(false, usize_count * @bitSizeOf(usize)));
pub const ShiftInt = std.math.Log2Int(usize);
pub const empty = Set{ .ints = [1]usize{0} ** usize_count };
pub fn empty_workaround() Set {
return Set{ .ints = [1]usize{0} ** usize_count };
}
pub fn isEnabled(set: Set, arch_feature_index: Index) bool {
const usize_index = arch_feature_index / @bitSizeOf(usize);
const bit_index = @intCast(ShiftInt, arch_feature_index % @bitSizeOf(usize));
return (set.ints[usize_index] & (@as(usize, 1) << bit_index)) != 0;
}
/// Adds the specified feature but not its dependencies.
pub fn addFeature(set: *Set, arch_feature_index: Index) void {
const usize_index = arch_feature_index / @bitSizeOf(usize);
const bit_index = @intCast(ShiftInt, arch_feature_index % @bitSizeOf(usize));
set.ints[usize_index] |= @as(usize, 1) << bit_index;
}
/// Adds the specified feature set but not its dependencies.
pub fn addFeatureSet(set: *Set, other_set: Set) void {
set.ints = @as(@Vector(usize_count, usize), set.ints) |
@as(@Vector(usize_count, usize), other_set.ints);
}
/// Removes the specified feature but not its dependents.
pub fn removeFeature(set: *Set, arch_feature_index: Index) void {
const usize_index = arch_feature_index / @bitSizeOf(usize);
const bit_index = @intCast(ShiftInt, arch_feature_index % @bitSizeOf(usize));
set.ints[usize_index] &= ~(@as(usize, 1) << bit_index);
}
pub fn populateDependencies(set: *Set, all_features_list: []const Cpu.Feature) void {
@setEvalBranchQuota(1000000);
var old = set.ints;
while (true) {
for (all_features_list) |feature, index_usize| {
const index = @intCast(Index, index_usize);
if (set.isEnabled(index)) {
set.addFeatureSet(feature.dependencies);
}
}
const nothing_changed = mem.eql(usize, &old, &set.ints);
if (nothing_changed) return;
old = set.ints;
}
}
pub fn asBytes(set: *const Set) *const [byte_count]u8 {
return @ptrCast(*const [byte_count]u8, &set.ints);
}
pub fn eql(set: Set, other: Set) bool {
return mem.eql(usize, &set.ints, &other.ints);
}
};
pub fn feature_set_fns(comptime F: type) type {
return struct {
/// Populates only the feature bits specified.
pub fn featureSet(features: []const F) Set {
var x = Set.empty_workaround(); // TODO remove empty_workaround
for (features) |feature| {
x.addFeature(@enumToInt(feature));
}
return x;
}
pub fn featureSetHas(set: Set, feature: F) bool {
return set.isEnabled(@enumToInt(feature));
}
};
}
};
pub const Arch = enum {
arm,
armeb,
aarch64,
aarch64_be,
aarch64_32,
arc,
avr,
bpfel,
bpfeb,
hexagon,
mips,
mipsel,
mips64,
mips64el,
msp430,
powerpc,
powerpc64,
powerpc64le,
r600,
amdgcn,
riscv32,
riscv64,
sparc,
sparcv9,
sparcel,
s390x,
tce,
tcele,
thumb,
thumbeb,
i386,
x86_64,
xcore,
nvptx,
nvptx64,
le32,
le64,
amdil,
amdil64,
hsail,
hsail64,
spir,
spir64,
kalimba,
shave,
lanai,
wasm32,
wasm64,
renderscript32,
renderscript64,
pub fn isARM(arch: Arch) bool {
return switch (arch) {
.arm, .armeb => true,
else => false,
};
}
pub fn isThumb(arch: Arch) bool {
return switch (arch) {
.thumb, .thumbeb => true,
else => false,
};
}
pub fn isWasm(arch: Arch) bool {
return switch (arch) {
.wasm32, .wasm64 => true,
else => false,
};
}
pub fn isRISCV(arch: Arch) bool {
return switch (arch) {
.riscv32, .riscv64 => true,
else => false,
};
}
pub fn isMIPS(arch: Arch) bool {
return switch (arch) {
.mips, .mipsel, .mips64, .mips64el => true,
else => false,
};
}
pub fn parseCpuModel(arch: Arch, cpu_name: []const u8) !*const Cpu.Model {
for (arch.allCpuModels()) |cpu| {
if (mem.eql(u8, cpu_name, cpu.name)) {
return cpu;
}
}
return error.UnknownCpu;
}
pub fn toElfMachine(arch: Arch) std.elf.EM {
return switch (arch) {
.avr => ._AVR,
.msp430 => ._MSP430,
.arc => ._ARC,
.arm => ._ARM,
.armeb => ._ARM,
.hexagon => ._HEXAGON,
.le32 => ._NONE,
.mips => ._MIPS,
.mipsel => ._MIPS_RS3_LE,
.powerpc => ._PPC,
.r600 => ._NONE,
.riscv32 => ._RISCV,
.sparc => ._SPARC,
.sparcel => ._SPARC,
.tce => ._NONE,
.tcele => ._NONE,
.thumb => ._ARM,
.thumbeb => ._ARM,
.i386 => ._386,
.xcore => ._XCORE,
.nvptx => ._NONE,
.amdil => ._NONE,
.hsail => ._NONE,
.spir => ._NONE,
.kalimba => ._CSR_KALIMBA,
.shave => ._NONE,
.lanai => ._LANAI,
.wasm32 => ._NONE,
.renderscript32 => ._NONE,
.aarch64_32 => ._AARCH64,
.aarch64 => ._AARCH64,
.aarch64_be => ._AARCH64,
.mips64 => ._MIPS,
.mips64el => ._MIPS_RS3_LE,
.powerpc64 => ._PPC64,
.powerpc64le => ._PPC64,
.riscv64 => ._RISCV,
.x86_64 => ._X86_64,
.nvptx64 => ._NONE,
.le64 => ._NONE,
.amdil64 => ._NONE,
.hsail64 => ._NONE,
.spir64 => ._NONE,
.wasm64 => ._NONE,
.renderscript64 => ._NONE,
.amdgcn => ._NONE,
.bpfel => ._BPF,
.bpfeb => ._BPF,
.sparcv9 => ._SPARCV9,
.s390x => ._S390,
};
}
pub fn endian(arch: Arch) builtin.Endian {
return switch (arch) {
.avr,
.arm,
.aarch64_32,
.aarch64,
.amdgcn,
.amdil,
.amdil64,
.bpfel,
.hexagon,
.hsail,
.hsail64,
.kalimba,
.le32,
.le64,
.mipsel,
.mips64el,
.msp430,
.nvptx,
.nvptx64,
.sparcel,
.tcele,
.powerpc64le,
.r600,
.riscv32,
.riscv64,
.i386,
.x86_64,
.wasm32,
.wasm64,
.xcore,
.thumb,
.spir,
.spir64,
.renderscript32,
.renderscript64,
.shave,
=> .Little,
.arc,
.armeb,
.aarch64_be,
.bpfeb,
.mips,
.mips64,
.powerpc,
.powerpc64,
.thumbeb,
.sparc,
.sparcv9,
.tce,
.lanai,
.s390x,
=> .Big,
};
}
/// Returns a name that matches the lib/std/target/* directory name.
pub fn genericName(arch: Arch) []const u8 {
return switch (arch) {
.arm, .armeb, .thumb, .thumbeb => "arm",
.aarch64, .aarch64_be, .aarch64_32 => "aarch64",
.avr => "avr",
.bpfel, .bpfeb => "bpf",
.hexagon => "hexagon",
.mips, .mipsel, .mips64, .mips64el => "mips",
.msp430 => "msp430",
.powerpc, .powerpc64, .powerpc64le => "powerpc",
.amdgcn => "amdgpu",
.riscv32, .riscv64 => "riscv",
.sparc, .sparcv9, .sparcel => "sparc",
.s390x => "systemz",
.i386, .x86_64 => "x86",
.nvptx, .nvptx64 => "nvptx",
.wasm32, .wasm64 => "wasm",
else => @tagName(arch),
};
}
/// All CPU features Zig is aware of, sorted lexicographically by name.
pub fn allFeaturesList(arch: Arch) []const Cpu.Feature {
return switch (arch) {
.arm, .armeb, .thumb, .thumbeb => &arm.all_features,
.aarch64, .aarch64_be, .aarch64_32 => &aarch64.all_features,
.avr => &avr.all_features,
.bpfel, .bpfeb => &bpf.all_features,
.hexagon => &hexagon.all_features,
.mips, .mipsel, .mips64, .mips64el => &mips.all_features,
.msp430 => &msp430.all_features,
.powerpc, .powerpc64, .powerpc64le => &powerpc.all_features,
.amdgcn => &amdgpu.all_features,
.riscv32, .riscv64 => &riscv.all_features,
.sparc, .sparcv9, .sparcel => &sparc.all_features,
.s390x => &systemz.all_features,
.i386, .x86_64 => &x86.all_features,
.nvptx, .nvptx64 => &nvptx.all_features,
.wasm32, .wasm64 => &wasm.all_features,
else => &[0]Cpu.Feature{},
};
}
/// All processors Zig is aware of, sorted lexicographically by name.
pub fn allCpuModels(arch: Arch) []const *const Cpu.Model {
return switch (arch) {
.arm, .armeb, .thumb, .thumbeb => arm.all_cpus,
.aarch64, .aarch64_be, .aarch64_32 => aarch64.all_cpus,
.avr => avr.all_cpus,
.bpfel, .bpfeb => bpf.all_cpus,
.hexagon => hexagon.all_cpus,
.mips, .mipsel, .mips64, .mips64el => mips.all_cpus,
.msp430 => msp430.all_cpus,
.powerpc, .powerpc64, .powerpc64le => powerpc.all_cpus,
.amdgcn => amdgpu.all_cpus,
.riscv32, .riscv64 => riscv.all_cpus,
.sparc, .sparcv9, .sparcel => sparc.all_cpus,
.s390x => systemz.all_cpus,
.i386, .x86_64 => x86.all_cpus,
.nvptx, .nvptx64 => nvptx.all_cpus,
.wasm32, .wasm64 => wasm.all_cpus,
else => &[0]*const Model{},
};
}
pub fn parse(text: []const u8) !Arch {
const info = @typeInfo(Arch);
inline for (info.Enum.fields) |field| {
if (mem.eql(u8, text, field.name)) {
return @as(Arch, @field(Arch, field.name));
}
}
return error.UnknownArchitecture;
}
};
pub const Model = struct {
name: []const u8,
llvm_name: ?[:0]const u8,
features: Feature.Set,
pub fn toCpu(model: *const Model, arch: Arch) Cpu {
var features = model.features;
features.populateDependencies(arch.allFeaturesList());
return .{
.arch = arch,
.model = model,
.features = features,
};
}
};
/// The "default" set of CPU features for cross-compiling. A conservative set
/// of features that is expected to be supported on most available hardware.
pub fn baseline(arch: Arch) Cpu {
const S = struct {
const generic_model = Model{
.name = "generic",
.llvm_name = null,
.features = Cpu.Feature.Set.empty,
};
};
const model = switch (arch) {
.arm, .armeb, .thumb, .thumbeb => &arm.cpu.baseline,
.aarch64, .aarch64_be, .aarch64_32 => &aarch64.cpu.generic,
.avr => &avr.cpu.avr1,
.bpfel, .bpfeb => &bpf.cpu.generic,
.hexagon => &hexagon.cpu.generic,
.mips, .mipsel => &mips.cpu.mips32,
.mips64, .mips64el => &mips.cpu.mips64,
.msp430 => &msp430.cpu.generic,
.powerpc, .powerpc64, .powerpc64le => &powerpc.cpu.generic,
.amdgcn => &amdgpu.cpu.generic,
.riscv32 => &riscv.cpu.baseline_rv32,
.riscv64 => &riscv.cpu.baseline_rv64,
.sparc, .sparcv9, .sparcel => &sparc.cpu.generic,
.s390x => &systemz.cpu.generic,
.i386 => &x86.cpu.pentium4,
.x86_64 => &x86.cpu.x86_64,
.nvptx, .nvptx64 => &nvptx.cpu.sm_20,
.wasm32, .wasm64 => &wasm.cpu.generic,
else => &S.generic_model,
};
return model.toCpu(arch);
}
};
pub const current = Target{
.Cross = Cross{
.cpu = builtin.cpu,
.os = builtin.os,
.abi = builtin.abi,
},
};
pub const stack_align = 16;
pub fn zigTriple(self: Target, allocator: *mem.Allocator) ![]u8 {
return std.fmt.allocPrint(allocator, "{}-{}-{}", .{
@tagName(self.getArch()),
@tagName(self.getOs()),
@tagName(self.getAbi()),
});
}
/// Returned slice must be freed by the caller.
pub fn vcpkgTriplet(allocator: *mem.Allocator, target: Target, linkage: std.build.VcpkgLinkage) ![]const u8 {
const arch = switch (target.getArch()) {
.i386 => "x86",
.x86_64 => "x64",
.arm,
.armeb,
.thumb,
.thumbeb,
.aarch64_32,
=> "arm",
.aarch64,
.aarch64_be,
=> "arm64",
else => return error.VcpkgNoSuchArchitecture,
};
const os = switch (target.getOs()) {
.windows => "windows",
.linux => "linux",
.macosx => "macos",
else => return error.VcpkgNoSuchOs,
};
if (linkage == .Static) {
return try mem.join(allocator, "-", &[_][]const u8{ arch, os, "static" });
} else {
return try mem.join(allocator, "-", &[_][]const u8{ arch, os });
}
}
pub fn allocDescription(self: Target, allocator: *mem.Allocator) ![]u8 {
// TODO is there anything else worthy of the description that is not
// already captured in the triple?
return self.zigTriple(allocator);
}
pub fn zigTripleNoSubArch(self: Target, allocator: *mem.Allocator) ![]u8 {
return std.fmt.allocPrint(allocator, "{}-{}-{}", .{
@tagName(self.getArch()),
@tagName(self.getOs()),
@tagName(self.getAbi()),
});
}
pub fn linuxTriple(self: Target, allocator: *mem.Allocator) ![]u8 {
return std.fmt.allocPrint(allocator, "{}-{}-{}", .{
@tagName(self.getArch()),
@tagName(self.getOs()),
@tagName(self.getAbi()),
});
}
pub const ParseOptions = struct {
/// This is sometimes called a "triple". It looks roughly like this:
/// riscv64-linux-gnu
/// The fields are, respectively:
/// * CPU Architecture
/// * Operating System
/// * C ABI (optional)
arch_os_abi: []const u8,
/// Looks like "name+a+b-c-d+e", where "name" is a CPU Model name, "a", "b", and "e"
/// are examples of CPU features to add to the set, and "c" and "d" are examples of CPU features
/// to remove from the set.
cpu_features: []const u8 = "baseline",
/// If this is provided, the function will populate some information about parsing failures,
/// so that user-friendly error messages can be delivered.
diagnostics: ?*Diagnostics = null,
pub const Diagnostics = struct {
/// If the architecture was determined, this will be populated.
arch: ?Cpu.Arch = null,
/// If the OS was determined, this will be populated.
os: ?Os = null,
/// If the ABI was determined, this will be populated.
abi: ?Abi = null,
/// If the CPU name was determined, this will be populated.
cpu_name: ?[]const u8 = null,
/// If error.UnknownCpuFeature is returned, this will be populated.
unknown_feature_name: ?[]const u8 = null,
};
};
pub fn parse(args: ParseOptions) !Target {
var dummy_diags: ParseOptions.Diagnostics = undefined;
var diags = args.diagnostics orelse &dummy_diags;
var it = mem.separate(args.arch_os_abi, "-");
const arch_name = it.next() orelse return error.MissingArchitecture;
const arch = try Cpu.Arch.parse(arch_name);
diags.arch = arch;
const os_name = it.next() orelse return error.MissingOperatingSystem;
const os = try Os.parse(os_name);
diags.os = os;
const abi_name = it.next();
const abi = if (abi_name) |n| try Abi.parse(n) else Abi.default(arch, os);
diags.abi = abi;
if (it.next() != null) return error.UnexpectedExtraField;
const all_features = arch.allFeaturesList();
var index: usize = 0;
while (index < args.cpu_features.len and
args.cpu_features[index] != '+' and
args.cpu_features[index] != '-')
{
index += 1;
}
const cpu_name = args.cpu_features[0..index];
diags.cpu_name = cpu_name;
const cpu: Cpu = if (mem.eql(u8, cpu_name, "baseline")) Cpu.baseline(arch) else blk: {
const cpu_model = try arch.parseCpuModel(cpu_name);
var set = cpu_model.features;
while (index < args.cpu_features.len) {
const op = args.cpu_features[index];
index += 1;
const start = index;
while (index < args.cpu_features.len and
args.cpu_features[index] != '+' and
args.cpu_features[index] != '-')
{
index += 1;
}
const feature_name = args.cpu_features[start..index];
for (all_features) |feature, feat_index_usize| {
const feat_index = @intCast(Cpu.Feature.Set.Index, feat_index_usize);
if (mem.eql(u8, feature_name, feature.name)) {
switch (op) {
'+' => set.addFeature(feat_index),
'-' => set.removeFeature(feat_index),
else => unreachable,
}
break;
}
} else {
diags.unknown_feature_name = feature_name;
return error.UnknownCpuFeature;
}
}
set.populateDependencies(all_features);
break :blk .{
.arch = arch,
.model = cpu_model,
.features = set,
};
};
var cross = Cross{
.cpu = cpu,
.os = os,
.abi = abi,
};
return Target{ .Cross = cross };
}
pub fn oFileExt(self: Target) []const u8 {
return switch (self.getAbi()) {
.msvc => ".obj",
else => ".o",
};
}
pub fn exeFileExt(self: Target) []const u8 {
if (self.isWindows()) {
return ".exe";
} else if (self.isUefi()) {
return ".efi";
} else if (self.isWasm()) {
return ".wasm";
} else {
return "";
}
}
pub fn staticLibSuffix(self: Target) []const u8 {
if (self.isWasm()) {
return ".wasm";
}
switch (self.getAbi()) {
.msvc => return ".lib",
else => return ".a",
}
}
pub fn dynamicLibSuffix(self: Target) []const u8 {
if (self.isDarwin()) {
return ".dylib";
}
switch (self.getOs()) {
.windows => return ".dll",
else => return ".so",
}
}
pub fn libPrefix(self: Target) []const u8 {
if (self.isWasm()) {
return "";
}
switch (self.getAbi()) {
.msvc => return "",
else => return "lib",
}
}
pub fn getOs(self: Target) Os {
return switch (self) {
.Native => builtin.os,
.Cross => |t| t.os,
};
}
pub fn getCpu(self: Target) Cpu {
return switch (self) {
.Native => builtin.cpu,
.Cross => |cross| cross.cpu,
};
}
pub fn getArch(self: Target) Cpu.Arch {
return self.getCpu().arch;
}
pub fn getAbi(self: Target) Abi {
switch (self) {
.Native => return builtin.abi,
.Cross => |t| return t.abi,
}
}
pub fn getObjectFormat(self: Target) ObjectFormat {
switch (self) {
.Native => return @import("builtin").object_format,
.Cross => blk: {
if (self.isWindows() or self.isUefi()) {
return .coff;
} else if (self.isDarwin()) {
return .macho;
}
if (self.isWasm()) {
return .wasm;
}
return .elf;
},
}
}
pub fn isMinGW(self: Target) bool {
return self.isWindows() and self.isGnu();
}
pub fn isGnu(self: Target) bool {
return switch (self.getAbi()) {
.gnu, .gnuabin32, .gnuabi64, .gnueabi, .gnueabihf, .gnux32 => true,
else => false,
};
}
pub fn isMusl(self: Target) bool {
return switch (self.getAbi()) {
.musl, .musleabi, .musleabihf => true,
else => false,
};
}
pub fn isDarwin(self: Target) bool {
return switch (self.getOs()) {
.ios, .macosx, .watchos, .tvos => true,
else => false,
};
}
pub fn isWindows(self: Target) bool {
return switch (self.getOs()) {
.windows => true,
else => false,
};
}
pub fn isLinux(self: Target) bool {
return switch (self.getOs()) {
.linux => true,
else => false,
};
}
pub fn isAndroid(self: Target) bool {
return switch (self.getAbi()) {
.android => true,
else => false,
};
}
pub fn isDragonFlyBSD(self: Target) bool {
return switch (self.getOs()) {
.dragonfly => true,
else => false,
};
}
pub fn isUefi(self: Target) bool {
return switch (self.getOs()) {
.uefi => true,
else => false,
};
}
pub fn isWasm(self: Target) bool {
return switch (self.getArch()) {
.wasm32, .wasm64 => true,
else => false,
};
}
pub fn isFreeBSD(self: Target) bool {
return switch (self.getOs()) {
.freebsd => true,
else => false,
};
}
pub fn isNetBSD(self: Target) bool {
return switch (self.getOs()) {
.netbsd => true,
else => false,
};
}
pub fn wantSharedLibSymLinks(self: Target) bool {
return !self.isWindows();
}
pub fn osRequiresLibC(self: Target) bool {
return self.isDarwin() or self.isFreeBSD() or self.isNetBSD();
}
pub fn getArchPtrBitWidth(self: Target) u32 {
switch (self.getArch()) {
.avr,
.msp430,
=> return 16,
.arc,
.arm,
.armeb,
.hexagon,
.le32,
.mips,
.mipsel,
.powerpc,
.r600,
.riscv32,
.sparc,
.sparcel,
.tce,
.tcele,
.thumb,
.thumbeb,
.i386,
.xcore,
.nvptx,
.amdil,
.hsail,
.spir,
.kalimba,
.shave,
.lanai,
.wasm32,
.renderscript32,
.aarch64_32,
=> return 32,
.aarch64,
.aarch64_be,
.mips64,
.mips64el,
.powerpc64,
.powerpc64le,
.riscv64,
.x86_64,
.nvptx64,
.le64,
.amdil64,
.hsail64,
.spir64,
.wasm64,
.renderscript64,
.amdgcn,
.bpfel,
.bpfeb,
.sparcv9,
.s390x,
=> return 64,
}
}
pub fn supportsNewStackCall(self: Target) bool {
return !self.isWasm();
}
pub const Executor = union(enum) {
native,
qemu: []const u8,
wine: []const u8,
wasmtime: []const u8,
unavailable,
};
pub fn getExternalExecutor(self: Target) Executor {
if (@as(@TagType(Target), self) == .Native) return .native;
// If the target OS matches the host OS, we can use QEMU to emulate a foreign architecture.
if (self.getOs() == builtin.os) {
return switch (self.getArch()) {
.aarch64 => Executor{ .qemu = "qemu-aarch64" },
.aarch64_be => Executor{ .qemu = "qemu-aarch64_be" },
.arm => Executor{ .qemu = "qemu-arm" },
.armeb => Executor{ .qemu = "qemu-armeb" },
.i386 => Executor{ .qemu = "qemu-i386" },
.mips => Executor{ .qemu = "qemu-mips" },
.mipsel => Executor{ .qemu = "qemu-mipsel" },
.mips64 => Executor{ .qemu = "qemu-mips64" },
.mips64el => Executor{ .qemu = "qemu-mips64el" },
.powerpc => Executor{ .qemu = "qemu-ppc" },
.powerpc64 => Executor{ .qemu = "qemu-ppc64" },
.powerpc64le => Executor{ .qemu = "qemu-ppc64le" },
.riscv32 => Executor{ .qemu = "qemu-riscv32" },
.riscv64 => Executor{ .qemu = "qemu-riscv64" },
.s390x => Executor{ .qemu = "qemu-s390x" },
.sparc => Executor{ .qemu = "qemu-sparc" },
.x86_64 => Executor{ .qemu = "qemu-x86_64" },
else => return .unavailable,
};
}
if (self.isWindows()) {
switch (self.getArchPtrBitWidth()) {
32 => return Executor{ .wine = "wine" },
64 => return Executor{ .wine = "wine64" },
else => return .unavailable,
}
}
if (self.getOs() == .wasi) {
switch (self.getArchPtrBitWidth()) {
32 => return Executor{ .wasmtime = "wasmtime" },
else => return .unavailable,
}
}
return .unavailable;
}
pub const FloatAbi = enum {
hard,
soft,
soft_fp,
};
pub fn getFloatAbi(self: Target) FloatAbi {
return switch (self.getAbi()) {
.gnueabihf,
.eabihf,
.musleabihf,
=> .hard,
else => .soft,
};
}
pub fn hasDynamicLinker(self: Target) bool {
switch (self.getArch()) {
.wasm32,
.wasm64,
=> return false,
else => {},
}
switch (self.getOs()) {
.freestanding,
.ios,
.tvos,
.watchos,
.macosx,
.uefi,
.windows,
.emscripten,
.other,
=> return false,
else => return true,
}
}
/// Caller owns returned memory.
pub fn getStandardDynamicLinkerPath(
self: Target,
allocator: *mem.Allocator,
) error{
OutOfMemory,
UnknownDynamicLinkerPath,
TargetHasNoDynamicLinker,
}![:0]u8 {
const a = allocator;
if (self.isAndroid()) {
return mem.dupeZ(a, u8, if (self.getArchPtrBitWidth() == 64)
"/system/bin/linker64"
else
"/system/bin/linker");
}
if (self.isMusl()) {
var result = try std.Buffer.init(allocator, "/lib/ld-musl-");
defer result.deinit();
var is_arm = false;
switch (self.getArch()) {
.arm, .thumb => {
try result.append("arm");
is_arm = true;
},
.armeb, .thumbeb => {
try result.append("armeb");
is_arm = true;
},
else => |arch| try result.append(@tagName(arch)),
}
if (is_arm and self.getFloatAbi() == .hard) {
try result.append("hf");
}
try result.append(".so.1");
return result.toOwnedSlice();
}
switch (self.getOs()) {
.freebsd => return mem.dupeZ(a, u8, "/libexec/ld-elf.so.1"),
.netbsd => return mem.dupeZ(a, u8, "/libexec/ld.elf_so"),
.dragonfly => return mem.dupeZ(a, u8, "/libexec/ld-elf.so.2"),
.linux => switch (self.getArch()) {
.i386,
.sparc,
.sparcel,
=> return mem.dupeZ(a, u8, "/lib/ld-linux.so.2"),
.aarch64 => return mem.dupeZ(a, u8, "/lib/ld-linux-aarch64.so.1"),
.aarch64_be => return mem.dupeZ(a, u8, "/lib/ld-linux-aarch64_be.so.1"),
.aarch64_32 => return mem.dupeZ(a, u8, "/lib/ld-linux-aarch64_32.so.1"),
.arm,
.armeb,
.thumb,
.thumbeb,
=> return mem.dupeZ(a, u8, switch (self.getFloatAbi()) {
.hard => "/lib/ld-linux-armhf.so.3",
else => "/lib/ld-linux.so.3",
}),
.mips,
.mipsel,
.mips64,
.mips64el,
=> return error.UnknownDynamicLinkerPath,
.powerpc => return mem.dupeZ(a, u8, "/lib/ld.so.1"),
.powerpc64, .powerpc64le => return mem.dupeZ(a, u8, "/lib64/ld64.so.2"),
.s390x => return mem.dupeZ(a, u8, "/lib64/ld64.so.1"),
.sparcv9 => return mem.dupeZ(a, u8, "/lib64/ld-linux.so.2"),
.x86_64 => return mem.dupeZ(a, u8, switch (self.getAbi()) {
.gnux32 => "/libx32/ld-linux-x32.so.2",
else => "/lib64/ld-linux-x86-64.so.2",
}),
.riscv32 => return mem.dupeZ(a, u8, "/lib/ld-linux-riscv32-ilp32.so.1"),
.riscv64 => return mem.dupeZ(a, u8, "/lib/ld-linux-riscv64-lp64.so.1"),
.wasm32,
.wasm64,
=> return error.TargetHasNoDynamicLinker,
.arc,
.avr,
.bpfel,
.bpfeb,
.hexagon,
.msp430,
.r600,
.amdgcn,
.tce,
.tcele,
.xcore,
.nvptx,
.nvptx64,
.le32,
.le64,
.amdil,
.amdil64,
.hsail,
.hsail64,
.spir,
.spir64,
.kalimba,
.shave,
.lanai,
.renderscript32,
.renderscript64,
=> return error.UnknownDynamicLinkerPath,
},
.freestanding,
.ios,
.tvos,
.watchos,
.macosx,
.uefi,
.windows,
.emscripten,
.other,
=> return error.TargetHasNoDynamicLinker,
else => return error.UnknownDynamicLinkerPath,
}
}
};
test "Target.parse" {
{
const target = (try Target.parse(.{
.arch_os_abi = "x86_64-linux-gnu",
.cpu_features = "x86_64-sse-sse2-avx-cx8",
})).Cross;
std.testing.expect(target.os == .linux);
std.testing.expect(target.abi == .gnu);
std.testing.expect(target.cpu.arch == .x86_64);
std.testing.expect(!Target.x86.featureSetHas(target.cpu.features, .sse));
std.testing.expect(!Target.x86.featureSetHas(target.cpu.features, .avx));
std.testing.expect(!Target.x86.featureSetHas(target.cpu.features, .cx8));
std.testing.expect(Target.x86.featureSetHas(target.cpu.features, .cmov));
std.testing.expect(Target.x86.featureSetHas(target.cpu.features, .fxsr));
}
{
const target = (try Target.parse(.{
.arch_os_abi = "arm-linux-musleabihf",
.cpu_features = "generic+v8a",
})).Cross;
std.testing.expect(target.os == .linux);
std.testing.expect(target.abi == .musleabihf);
std.testing.expect(target.cpu.arch == .arm);
std.testing.expect(target.cpu.model == &Target.arm.cpu.generic);
std.testing.expect(Target.arm.featureSetHas(target.cpu.features, .v8a));
}
} | lib/std/target.zig |
const std = @import("../index.zig");
const os = std.os;
const expect = std.testing.expect;
const io = std.io;
const mem = std.mem;
const a = std.debug.global_allocator;
const builtin = @import("builtin");
const AtomicRmwOp = builtin.AtomicRmwOp;
const AtomicOrder = builtin.AtomicOrder;
test "makePath, put some files in it, deleteTree" {
try os.makePath(a, "os_test_tmp" ++ os.path.sep_str ++ "b" ++ os.path.sep_str ++ "c");
try io.writeFile("os_test_tmp" ++ os.path.sep_str ++ "b" ++ os.path.sep_str ++ "c" ++ os.path.sep_str ++ "file.txt", "nonsense");
try io.writeFile("os_test_tmp" ++ os.path.sep_str ++ "b" ++ os.path.sep_str ++ "file2.txt", "blah");
try os.deleteTree(a, "os_test_tmp");
if (os.Dir.open(a, "os_test_tmp")) |dir| {
@panic("expected error");
} else |err| {
expect(err == error.FileNotFound);
}
}
test "access file" {
try os.makePath(a, "os_test_tmp");
if (os.File.access("os_test_tmp" ++ os.path.sep_str ++ "file.txt")) |ok| {
@panic("expected error");
} else |err| {
expect(err == error.FileNotFound);
}
try io.writeFile("os_test_tmp" ++ os.path.sep_str ++ "file.txt", "");
try os.File.access("os_test_tmp" ++ os.path.sep_str ++ "file.txt");
try os.deleteTree(a, "os_test_tmp");
}
fn testThreadIdFn(thread_id: *os.Thread.Id) void {
thread_id.* = os.Thread.getCurrentId();
}
test "std.os.Thread.getCurrentId" {
if (builtin.single_threaded) return error.SkipZigTest;
var thread_current_id: os.Thread.Id = undefined;
const thread = try os.spawnThread(&thread_current_id, testThreadIdFn);
const thread_id = thread.handle();
thread.wait();
switch (builtin.os) {
builtin.Os.windows => expect(os.Thread.getCurrentId() != thread_current_id),
else => {
expect(thread_current_id == thread_id);
},
}
}
test "spawn threads" {
if (builtin.single_threaded) return error.SkipZigTest;
var shared_ctx: i32 = 1;
const thread1 = try std.os.spawnThread({}, start1);
const thread2 = try std.os.spawnThread(&shared_ctx, start2);
const thread3 = try std.os.spawnThread(&shared_ctx, start2);
const thread4 = try std.os.spawnThread(&shared_ctx, start2);
thread1.wait();
thread2.wait();
thread3.wait();
thread4.wait();
expect(shared_ctx == 4);
}
fn start1(ctx: void) u8 {
return 0;
}
fn start2(ctx: *i32) u8 {
_ = @atomicRmw(i32, ctx, AtomicRmwOp.Add, 1, AtomicOrder.SeqCst);
return 0;
}
test "cpu count" {
const cpu_count = try std.os.cpuCount(a);
expect(cpu_count >= 1);
}
test "AtomicFile" {
var buffer: [1024]u8 = undefined;
const allocator = &std.heap.FixedBufferAllocator.init(buffer[0..]).allocator;
const test_out_file = "tmp_atomic_file_test_dest.txt";
const test_content =
\\ hello!
\\ this is a test file
;
{
var af = try os.AtomicFile.init(test_out_file, os.File.default_mode);
defer af.deinit();
try af.file.write(test_content);
try af.finish();
}
const content = try io.readFileAlloc(allocator, test_out_file);
expect(mem.eql(u8, content, test_content));
try os.deleteFile(test_out_file);
}
test "thread local storage" {
if (builtin.single_threaded) return error.SkipZigTest;
const thread1 = try std.os.spawnThread({}, testTls);
const thread2 = try std.os.spawnThread({}, testTls);
testTls({});
thread1.wait();
thread2.wait();
}
threadlocal var x: i32 = 1234;
fn testTls(context: void) void {
if (x != 1234) @panic("bad start value");
x += 1;
if (x != 1235) @panic("bad end value");
} | std/os/test.zig |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.