Merge pull request #114 from GabrielMajeri/fix-version-macros
Use Rust integral types
This commit is contained in:
commit
f679197d0f
|
@ -12,7 +12,6 @@ documentation = "https://docs.rs/ash"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
shared_library = "0.1.5"
|
shared_library = "0.1.5"
|
||||||
lazy_static = "0.2.1"
|
lazy_static = "0.2.1"
|
||||||
libc = "0.2.26"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
|
@ -1,30 +1,31 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
use vk;
|
use vk;
|
||||||
|
use std::os::raw::c_void;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
pub trait VkAllocation {
|
pub trait VkAllocation {
|
||||||
unsafe extern "system" fn allocation(
|
unsafe extern "system" fn allocation(
|
||||||
*mut (),
|
*mut (),
|
||||||
vk::size_t,
|
usize,
|
||||||
vk::size_t,
|
usize,
|
||||||
vk::SystemAllocationScope,
|
vk::SystemAllocationScope,
|
||||||
) -> *mut ();
|
) -> *mut ();
|
||||||
unsafe extern "system" fn reallocation(
|
unsafe extern "system" fn reallocation(
|
||||||
*mut vk::c_void,
|
*mut c_void,
|
||||||
*mut vk::c_void,
|
*mut c_void,
|
||||||
vk::size_t,
|
usize,
|
||||||
vk::size_t,
|
usize,
|
||||||
vk::SystemAllocationScope,
|
vk::SystemAllocationScope,
|
||||||
) -> *mut vk::c_void;
|
) -> *mut c_void;
|
||||||
unsafe extern "system" fn free(*mut vk::c_void, *mut vk::c_void);
|
unsafe extern "system" fn free(*mut c_void, *mut c_void);
|
||||||
unsafe extern "system" fn internal_allocation(
|
unsafe extern "system" fn internal_allocation(
|
||||||
*mut vk::c_void,
|
*mut c_void,
|
||||||
vk::size_t,
|
usize,
|
||||||
vk::InternalAllocationType,
|
vk::InternalAllocationType,
|
||||||
vk::SystemAllocationScope,
|
vk::SystemAllocationScope,
|
||||||
);
|
);
|
||||||
unsafe extern "system" fn internal_free(
|
unsafe extern "system" fn internal_free(
|
||||||
*mut vk::c_void,
|
*mut c_void,
|
||||||
vk::size_t,
|
usize,
|
||||||
vk::InternalAllocationType,
|
vk::InternalAllocationType,
|
||||||
vk::SystemAllocationScope,
|
vk::SystemAllocationScope,
|
||||||
);
|
);
|
||||||
|
@ -47,33 +48,33 @@ pub struct TestAlloc;
|
||||||
impl VkAllocation for TestAlloc {
|
impl VkAllocation for TestAlloc {
|
||||||
unsafe extern "system" fn allocation(
|
unsafe extern "system" fn allocation(
|
||||||
_: *mut (),
|
_: *mut (),
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::SystemAllocationScope,
|
_: vk::SystemAllocationScope,
|
||||||
) -> *mut () {
|
) -> *mut () {
|
||||||
ptr::null_mut()
|
ptr::null_mut()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "system" fn reallocation(
|
unsafe extern "system" fn reallocation(
|
||||||
_: *mut vk::c_void,
|
_: *mut c_void,
|
||||||
_: *mut vk::c_void,
|
_: *mut c_void,
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::SystemAllocationScope,
|
_: vk::SystemAllocationScope,
|
||||||
) -> *mut vk::c_void {
|
) -> *mut c_void {
|
||||||
ptr::null_mut()
|
ptr::null_mut()
|
||||||
}
|
}
|
||||||
unsafe extern "system" fn free(_: *mut vk::c_void, _: *mut vk::c_void) {}
|
unsafe extern "system" fn free(_: *mut c_void, _: *mut c_void) {}
|
||||||
unsafe extern "system" fn internal_allocation(
|
unsafe extern "system" fn internal_allocation(
|
||||||
_: *mut vk::c_void,
|
_: *mut c_void,
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::InternalAllocationType,
|
_: vk::InternalAllocationType,
|
||||||
_: vk::SystemAllocationScope,
|
_: vk::SystemAllocationScope,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
unsafe extern "system" fn internal_free(
|
unsafe extern "system" fn internal_free(
|
||||||
_: *mut vk::c_void,
|
_: *mut c_void,
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::InternalAllocationType,
|
_: vk::InternalAllocationType,
|
||||||
_: vk::SystemAllocationScope,
|
_: vk::SystemAllocationScope,
|
||||||
) {
|
) {
|
||||||
|
@ -82,33 +83,33 @@ impl VkAllocation for TestAlloc {
|
||||||
impl VkAllocation for DefaultAllocatorCallback {
|
impl VkAllocation for DefaultAllocatorCallback {
|
||||||
unsafe extern "system" fn allocation(
|
unsafe extern "system" fn allocation(
|
||||||
_: *mut (),
|
_: *mut (),
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::SystemAllocationScope,
|
_: vk::SystemAllocationScope,
|
||||||
) -> *mut () {
|
) -> *mut () {
|
||||||
ptr::null_mut()
|
ptr::null_mut()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe extern "system" fn reallocation(
|
unsafe extern "system" fn reallocation(
|
||||||
_: *mut vk::c_void,
|
_: *mut c_void,
|
||||||
_: *mut vk::c_void,
|
_: *mut c_void,
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::SystemAllocationScope,
|
_: vk::SystemAllocationScope,
|
||||||
) -> *mut vk::c_void {
|
) -> *mut c_void {
|
||||||
ptr::null_mut()
|
ptr::null_mut()
|
||||||
}
|
}
|
||||||
unsafe extern "system" fn free(_: *mut vk::c_void, _: *mut vk::c_void) {}
|
unsafe extern "system" fn free(_: *mut c_void, _: *mut c_void) {}
|
||||||
unsafe extern "system" fn internal_allocation(
|
unsafe extern "system" fn internal_allocation(
|
||||||
_: *mut vk::c_void,
|
_: *mut c_void,
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::InternalAllocationType,
|
_: vk::InternalAllocationType,
|
||||||
_: vk::SystemAllocationScope,
|
_: vk::SystemAllocationScope,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
unsafe extern "system" fn internal_free(
|
unsafe extern "system" fn internal_free(
|
||||||
_: *mut vk::c_void,
|
_: *mut c_void,
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::InternalAllocationType,
|
_: vk::InternalAllocationType,
|
||||||
_: vk::SystemAllocationScope,
|
_: vk::SystemAllocationScope,
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
use prelude::*;
|
use prelude::*;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::os::raw::c_void;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use version::{FunctionPointers, V1_0, V1_1};
|
use version::{FunctionPointers, V1_0, V1_1};
|
||||||
use vk;
|
use vk;
|
||||||
|
@ -36,9 +37,9 @@ pub trait DeviceV1_1: DeviceV1_0 {
|
||||||
|
|
||||||
unsafe fn get_device_group_peer_memory_features(
|
unsafe fn get_device_group_peer_memory_features(
|
||||||
&self,
|
&self,
|
||||||
heap_index: vk::uint32_t,
|
heap_index: u32,
|
||||||
local_device_index: vk::uint32_t,
|
local_device_index: u32,
|
||||||
remote_device_index: vk::uint32_t,
|
remote_device_index: u32,
|
||||||
) -> vk::PeerMemoryFeatureFlags {
|
) -> vk::PeerMemoryFeatureFlags {
|
||||||
let mut peer_memory_features = mem::uninitialized();
|
let mut peer_memory_features = mem::uninitialized();
|
||||||
self.fp_v1_1().get_device_group_peer_memory_features(
|
self.fp_v1_1().get_device_group_peer_memory_features(
|
||||||
|
@ -54,7 +55,7 @@ pub trait DeviceV1_1: DeviceV1_0 {
|
||||||
unsafe fn cmd_set_device_mask(
|
unsafe fn cmd_set_device_mask(
|
||||||
&self,
|
&self,
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
device_mask: vk::uint32_t,
|
device_mask: u32,
|
||||||
) {
|
) {
|
||||||
self.fp_v1_1()
|
self.fp_v1_1()
|
||||||
.cmd_set_device_mask(command_buffer, device_mask);
|
.cmd_set_device_mask(command_buffer, device_mask);
|
||||||
|
@ -63,12 +64,12 @@ pub trait DeviceV1_1: DeviceV1_0 {
|
||||||
unsafe fn cmd_dispatch_base(
|
unsafe fn cmd_dispatch_base(
|
||||||
&self,
|
&self,
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
base_group_x: vk::uint32_t,
|
base_group_x: u32,
|
||||||
base_group_y: vk::uint32_t,
|
base_group_y: u32,
|
||||||
base_group_z: vk::uint32_t,
|
base_group_z: u32,
|
||||||
group_count_x: vk::uint32_t,
|
group_count_x: u32,
|
||||||
group_count_y: vk::uint32_t,
|
group_count_y: u32,
|
||||||
group_count_z: vk::uint32_t,
|
group_count_z: u32,
|
||||||
) {
|
) {
|
||||||
self.fp_v1_1().cmd_dispatch_base(
|
self.fp_v1_1().cmd_dispatch_base(
|
||||||
command_buffer,
|
command_buffer,
|
||||||
|
@ -202,7 +203,7 @@ pub trait DeviceV1_1: DeviceV1_0 {
|
||||||
&self,
|
&self,
|
||||||
descriptor_set: vk::DescriptorSet,
|
descriptor_set: vk::DescriptorSet,
|
||||||
descriptor_update_template: vk::DescriptorUpdateTemplate,
|
descriptor_update_template: vk::DescriptorUpdateTemplate,
|
||||||
data: *const vk::c_void,
|
data: *const c_void,
|
||||||
) {
|
) {
|
||||||
self.fp_v1_1().update_descriptor_set_with_template(
|
self.fp_v1_1().update_descriptor_set_with_template(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
|
@ -261,7 +262,7 @@ pub trait DeviceV1_0 {
|
||||||
self.fp_v1_0().free_command_buffers(
|
self.fp_v1_0().free_command_buffers(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
command_pool,
|
command_pool,
|
||||||
command_buffers.len() as vk::uint32_t,
|
command_buffers.len() as u32,
|
||||||
command_buffers.as_ptr(),
|
command_buffers.as_ptr(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -521,7 +522,7 @@ pub trait DeviceV1_0 {
|
||||||
buffer: vk::Buffer,
|
buffer: vk::Buffer,
|
||||||
offset: vk::DeviceSize,
|
offset: vk::DeviceSize,
|
||||||
size: vk::DeviceSize,
|
size: vk::DeviceSize,
|
||||||
data: vk::uint32_t,
|
data: u32,
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0()
|
self.fp_v1_0()
|
||||||
.cmd_fill_buffer(command_buffer, buffer, offset, size, data);
|
.cmd_fill_buffer(command_buffer, buffer, offset, size, data);
|
||||||
|
@ -572,7 +573,7 @@ pub trait DeviceV1_0 {
|
||||||
src_image,
|
src_image,
|
||||||
src_image_layout,
|
src_image_layout,
|
||||||
dst_buffer,
|
dst_buffer,
|
||||||
regions.len() as vk::uint32_t,
|
regions.len() as u32,
|
||||||
regions.as_ptr(),
|
regions.as_ptr(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -722,7 +723,7 @@ pub trait DeviceV1_0 {
|
||||||
unsafe fn reset_fences(&self, fences: &[vk::Fence]) -> VkResult<()> {
|
unsafe fn reset_fences(&self, fences: &[vk::Fence]) -> VkResult<()> {
|
||||||
let err_code = self.fp_v1_0().reset_fences(
|
let err_code = self.fp_v1_0().reset_fences(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
fences.len() as vk::uint32_t,
|
fences.len() as u32,
|
||||||
fences.as_ptr(),
|
fences.as_ptr(),
|
||||||
);
|
);
|
||||||
match err_code {
|
match err_code {
|
||||||
|
@ -755,7 +756,7 @@ pub trait DeviceV1_0 {
|
||||||
image,
|
image,
|
||||||
image_layout,
|
image_layout,
|
||||||
clear_color_value,
|
clear_color_value,
|
||||||
ranges.len() as vk::uint32_t,
|
ranges.len() as u32,
|
||||||
ranges.as_ptr(),
|
ranges.as_ptr(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -773,7 +774,7 @@ pub trait DeviceV1_0 {
|
||||||
image,
|
image,
|
||||||
image_layout,
|
image_layout,
|
||||||
clear_depth_stencil_value,
|
clear_depth_stencil_value,
|
||||||
ranges.len() as vk::uint32_t,
|
ranges.len() as u32,
|
||||||
ranges.as_ptr(),
|
ranges.as_ptr(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -786,9 +787,9 @@ pub trait DeviceV1_0 {
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0().cmd_clear_attachments(
|
self.fp_v1_0().cmd_clear_attachments(
|
||||||
command_buffer,
|
command_buffer,
|
||||||
attachments.len() as vk::uint32_t,
|
attachments.len() as u32,
|
||||||
attachments.as_ptr(),
|
attachments.as_ptr(),
|
||||||
rects.len() as vk::uint32_t,
|
rects.len() as u32,
|
||||||
rects.as_ptr(),
|
rects.as_ptr(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -796,11 +797,11 @@ pub trait DeviceV1_0 {
|
||||||
unsafe fn cmd_draw_indexed(
|
unsafe fn cmd_draw_indexed(
|
||||||
&self,
|
&self,
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
index_count: vk::uint32_t,
|
index_count: u32,
|
||||||
instance_count: vk::uint32_t,
|
instance_count: u32,
|
||||||
first_index: vk::uint32_t,
|
first_index: u32,
|
||||||
vertex_offset: vk::int32_t,
|
vertex_offset: i32,
|
||||||
first_instance: vk::uint32_t,
|
first_instance: u32,
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0().cmd_draw_indexed(
|
self.fp_v1_0().cmd_draw_indexed(
|
||||||
command_buffer,
|
command_buffer,
|
||||||
|
@ -817,8 +818,8 @@ pub trait DeviceV1_0 {
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
buffer: vk::Buffer,
|
buffer: vk::Buffer,
|
||||||
offset: vk::DeviceSize,
|
offset: vk::DeviceSize,
|
||||||
draw_count: vk::uint32_t,
|
draw_count: u32,
|
||||||
stride: vk::uint32_t,
|
stride: u32,
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0().cmd_draw_indexed_indirect(
|
self.fp_v1_0().cmd_draw_indexed_indirect(
|
||||||
command_buffer,
|
command_buffer,
|
||||||
|
@ -836,7 +837,7 @@ pub trait DeviceV1_0 {
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0().cmd_execute_commands(
|
self.fp_v1_0().cmd_execute_commands(
|
||||||
primary_command_buffer,
|
primary_command_buffer,
|
||||||
secondary_command_buffers.len() as vk::uint32_t,
|
secondary_command_buffers.len() as u32,
|
||||||
secondary_command_buffers.as_ptr(),
|
secondary_command_buffers.as_ptr(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -846,18 +847,18 @@ pub trait DeviceV1_0 {
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
pipeline_bind_point: vk::PipelineBindPoint,
|
pipeline_bind_point: vk::PipelineBindPoint,
|
||||||
layout: vk::PipelineLayout,
|
layout: vk::PipelineLayout,
|
||||||
first_set: vk::uint32_t,
|
first_set: u32,
|
||||||
descriptor_sets: &[vk::DescriptorSet],
|
descriptor_sets: &[vk::DescriptorSet],
|
||||||
dynamic_offsets: &[vk::uint32_t],
|
dynamic_offsets: &[u32],
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0().cmd_bind_descriptor_sets(
|
self.fp_v1_0().cmd_bind_descriptor_sets(
|
||||||
command_buffer,
|
command_buffer,
|
||||||
pipeline_bind_point,
|
pipeline_bind_point,
|
||||||
layout,
|
layout,
|
||||||
first_set,
|
first_set,
|
||||||
descriptor_sets.len() as vk::uint32_t,
|
descriptor_sets.len() as u32,
|
||||||
descriptor_sets.as_ptr(),
|
descriptor_sets.as_ptr(),
|
||||||
dynamic_offsets.len() as vk::uint32_t,
|
dynamic_offsets.len() as u32,
|
||||||
dynamic_offsets.as_ptr(),
|
dynamic_offsets.as_ptr(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -866,8 +867,8 @@ pub trait DeviceV1_0 {
|
||||||
&self,
|
&self,
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
query_pool: vk::QueryPool,
|
query_pool: vk::QueryPool,
|
||||||
first_query: vk::uint32_t,
|
first_query: u32,
|
||||||
query_count: vk::uint32_t,
|
query_count: u32,
|
||||||
dst_buffer: vk::Buffer,
|
dst_buffer: vk::Buffer,
|
||||||
dst_offset: vk::DeviceSize,
|
dst_offset: vk::DeviceSize,
|
||||||
stride: vk::DeviceSize,
|
stride: vk::DeviceSize,
|
||||||
|
@ -890,7 +891,7 @@ pub trait DeviceV1_0 {
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
layout: vk::PipelineLayout,
|
layout: vk::PipelineLayout,
|
||||||
stage_flags: vk::ShaderStageFlags,
|
stage_flags: vk::ShaderStageFlags,
|
||||||
offset: vk::uint32_t,
|
offset: u32,
|
||||||
constants: &[u8],
|
constants: &[u8],
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0().cmd_push_constants(
|
self.fp_v1_0().cmd_push_constants(
|
||||||
|
@ -934,13 +935,13 @@ pub trait DeviceV1_0 {
|
||||||
unsafe fn cmd_set_scissor(
|
unsafe fn cmd_set_scissor(
|
||||||
&self,
|
&self,
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
first_scissor: vk::uint32_t,
|
first_scissor: u32,
|
||||||
scissors: &[vk::Rect2D],
|
scissors: &[vk::Rect2D],
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0().cmd_set_scissor(
|
self.fp_v1_0().cmd_set_scissor(
|
||||||
command_buffer,
|
command_buffer,
|
||||||
first_scissor,
|
first_scissor,
|
||||||
scissors.len() as vk::uint32_t,
|
scissors.len() as u32,
|
||||||
scissors.as_ptr(),
|
scissors.as_ptr(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -953,7 +954,7 @@ pub trait DeviceV1_0 {
|
||||||
unsafe fn cmd_bind_vertex_buffers(
|
unsafe fn cmd_bind_vertex_buffers(
|
||||||
&self,
|
&self,
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
first_binding: vk::uint32_t,
|
first_binding: u32,
|
||||||
buffers: &[vk::Buffer],
|
buffers: &[vk::Buffer],
|
||||||
offsets: &[vk::DeviceSize],
|
offsets: &[vk::DeviceSize],
|
||||||
) {
|
) {
|
||||||
|
@ -961,7 +962,7 @@ pub trait DeviceV1_0 {
|
||||||
self.fp_v1_0().cmd_bind_vertex_buffers(
|
self.fp_v1_0().cmd_bind_vertex_buffers(
|
||||||
command_buffer,
|
command_buffer,
|
||||||
first_binding,
|
first_binding,
|
||||||
buffers.len() as vk::uint32_t,
|
buffers.len() as u32,
|
||||||
buffers.as_ptr(),
|
buffers.as_ptr(),
|
||||||
offsets.as_ptr(),
|
offsets.as_ptr(),
|
||||||
);
|
);
|
||||||
|
@ -974,10 +975,10 @@ pub trait DeviceV1_0 {
|
||||||
unsafe fn cmd_draw(
|
unsafe fn cmd_draw(
|
||||||
&self,
|
&self,
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
vertex_count: vk::uint32_t,
|
vertex_count: u32,
|
||||||
instance_count: vk::uint32_t,
|
instance_count: u32,
|
||||||
first_vertex: vk::uint32_t,
|
first_vertex: u32,
|
||||||
first_instance: vk::uint32_t,
|
first_instance: u32,
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0().cmd_draw(
|
self.fp_v1_0().cmd_draw(
|
||||||
command_buffer,
|
command_buffer,
|
||||||
|
@ -993,8 +994,8 @@ pub trait DeviceV1_0 {
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
buffer: vk::Buffer,
|
buffer: vk::Buffer,
|
||||||
offset: vk::DeviceSize,
|
offset: vk::DeviceSize,
|
||||||
draw_count: vk::uint32_t,
|
draw_count: u32,
|
||||||
stride: vk::uint32_t,
|
stride: u32,
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0()
|
self.fp_v1_0()
|
||||||
.cmd_draw_indirect(command_buffer, buffer, offset, draw_count, stride);
|
.cmd_draw_indirect(command_buffer, buffer, offset, draw_count, stride);
|
||||||
|
@ -1003,9 +1004,9 @@ pub trait DeviceV1_0 {
|
||||||
unsafe fn cmd_dispatch(
|
unsafe fn cmd_dispatch(
|
||||||
&self,
|
&self,
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
group_count_x: vk::uint32_t,
|
group_count_x: u32,
|
||||||
group_count_y: vk::uint32_t,
|
group_count_y: u32,
|
||||||
group_count_z: vk::uint32_t,
|
group_count_z: u32,
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0()
|
self.fp_v1_0()
|
||||||
.cmd_dispatch(command_buffer, group_count_x, group_count_y, group_count_z);
|
.cmd_dispatch(command_buffer, group_count_x, group_count_y, group_count_z);
|
||||||
|
@ -1024,13 +1025,13 @@ pub trait DeviceV1_0 {
|
||||||
unsafe fn cmd_set_viewport(
|
unsafe fn cmd_set_viewport(
|
||||||
&self,
|
&self,
|
||||||
command_buffer: vk::CommandBuffer,
|
command_buffer: vk::CommandBuffer,
|
||||||
first_viewport: vk::uint32_t,
|
first_viewport: u32,
|
||||||
viewports: &[vk::Viewport],
|
viewports: &[vk::Viewport],
|
||||||
) {
|
) {
|
||||||
self.fp_v1_0().cmd_set_viewport(
|
self.fp_v1_0().cmd_set_viewport(
|
||||||
command_buffer,
|
command_buffer,
|
||||||
first_viewport,
|
first_viewport,
|
||||||
viewports.len() as vk::uint32_t,
|
viewports.len() as u32,
|
||||||
viewports.as_ptr(),
|
viewports.as_ptr(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1098,8 +1099,8 @@ pub trait DeviceV1_0 {
|
||||||
unsafe fn get_query_pool_results<T>(
|
unsafe fn get_query_pool_results<T>(
|
||||||
&self,
|
&self,
|
||||||
query_pool: vk::QueryPool,
|
query_pool: vk::QueryPool,
|
||||||
first_query: vk::uint32_t,
|
first_query: u32,
|
||||||
query_count: vk::uint32_t,
|
query_count: u32,
|
||||||
data: &mut [T],
|
data: &mut [T],
|
||||||
flags: vk::QueryResultFlags,
|
flags: vk::QueryResultFlags,
|
||||||
) -> VkResult<()> {
|
) -> VkResult<()> {
|
||||||
|
@ -1201,7 +1202,7 @@ pub trait DeviceV1_0 {
|
||||||
let err_code = self.fp_v1_0().create_graphics_pipelines(
|
let err_code = self.fp_v1_0().create_graphics_pipelines(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
pipeline_cache,
|
pipeline_cache,
|
||||||
create_infos.len() as vk::uint32_t,
|
create_infos.len() as u32,
|
||||||
create_infos.as_ptr(),
|
create_infos.as_ptr(),
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
pipelines.as_mut_ptr(),
|
pipelines.as_mut_ptr(),
|
||||||
|
@ -1223,7 +1224,7 @@ pub trait DeviceV1_0 {
|
||||||
let err_code = self.fp_v1_0().create_compute_pipelines(
|
let err_code = self.fp_v1_0().create_compute_pipelines(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
pipeline_cache,
|
pipeline_cache,
|
||||||
create_infos.len() as vk::uint32_t,
|
create_infos.len() as u32,
|
||||||
create_infos.as_ptr(),
|
create_infos.as_ptr(),
|
||||||
allocation_callbacks.as_raw_ptr(),
|
allocation_callbacks.as_raw_ptr(),
|
||||||
pipelines.as_mut_ptr(),
|
pipelines.as_mut_ptr(),
|
||||||
|
@ -1296,8 +1297,8 @@ pub trait DeviceV1_0 {
|
||||||
offset: vk::DeviceSize,
|
offset: vk::DeviceSize,
|
||||||
size: vk::DeviceSize,
|
size: vk::DeviceSize,
|
||||||
flags: vk::MemoryMapFlags,
|
flags: vk::MemoryMapFlags,
|
||||||
) -> VkResult<*mut vk::c_void> {
|
) -> VkResult<*mut c_void> {
|
||||||
let mut data: *mut vk::c_void = mem::uninitialized();
|
let mut data: *mut c_void = mem::uninitialized();
|
||||||
let err_code =
|
let err_code =
|
||||||
self.fp_v1_0()
|
self.fp_v1_0()
|
||||||
.map_memory(self.handle(), memory, offset, size, flags, &mut data);
|
.map_memory(self.handle(), memory, offset, size, flags, &mut data);
|
||||||
|
@ -1317,7 +1318,7 @@ pub trait DeviceV1_0 {
|
||||||
) -> VkResult<()> {
|
) -> VkResult<()> {
|
||||||
let err_code = self.fp_v1_0().invalidate_mapped_memory_ranges(
|
let err_code = self.fp_v1_0().invalidate_mapped_memory_ranges(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
ranges.len() as vk::uint32_t,
|
ranges.len() as u32,
|
||||||
ranges.as_ptr(),
|
ranges.as_ptr(),
|
||||||
);
|
);
|
||||||
match err_code {
|
match err_code {
|
||||||
|
@ -1329,7 +1330,7 @@ pub trait DeviceV1_0 {
|
||||||
unsafe fn flush_mapped_memory_ranges(&self, ranges: &[vk::MappedMemoryRange]) -> VkResult<()> {
|
unsafe fn flush_mapped_memory_ranges(&self, ranges: &[vk::MappedMemoryRange]) -> VkResult<()> {
|
||||||
let err_code = self.fp_v1_0().flush_mapped_memory_ranges(
|
let err_code = self.fp_v1_0().flush_mapped_memory_ranges(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
ranges.len() as vk::uint32_t,
|
ranges.len() as u32,
|
||||||
ranges.as_ptr(),
|
ranges.as_ptr(),
|
||||||
);
|
);
|
||||||
match err_code {
|
match err_code {
|
||||||
|
@ -1358,8 +1359,8 @@ pub trait DeviceV1_0 {
|
||||||
|
|
||||||
unsafe fn get_device_queue(
|
unsafe fn get_device_queue(
|
||||||
&self,
|
&self,
|
||||||
queue_family_index: vk::uint32_t,
|
queue_family_index: u32,
|
||||||
queue_index: vk::uint32_t,
|
queue_index: u32,
|
||||||
) -> vk::Queue {
|
) -> vk::Queue {
|
||||||
let mut queue = mem::uninitialized();
|
let mut queue = mem::uninitialized();
|
||||||
self.fp_v1_0()
|
self.fp_v1_0()
|
||||||
|
@ -1382,11 +1383,11 @@ pub trait DeviceV1_0 {
|
||||||
src_stage_mask,
|
src_stage_mask,
|
||||||
dst_stage_mask,
|
dst_stage_mask,
|
||||||
dependency_flags,
|
dependency_flags,
|
||||||
memory_barriers.len() as vk::uint32_t,
|
memory_barriers.len() as u32,
|
||||||
memory_barriers.as_ptr(),
|
memory_barriers.as_ptr(),
|
||||||
buffer_memory_barriers.len() as vk::uint32_t,
|
buffer_memory_barriers.len() as u32,
|
||||||
buffer_memory_barriers.as_ptr(),
|
buffer_memory_barriers.as_ptr(),
|
||||||
image_memory_barriers.len() as vk::uint32_t,
|
image_memory_barriers.len() as u32,
|
||||||
image_memory_barriers.as_ptr(),
|
image_memory_barriers.as_ptr(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1435,13 +1436,13 @@ pub trait DeviceV1_0 {
|
||||||
&self,
|
&self,
|
||||||
fences: &[vk::Fence],
|
fences: &[vk::Fence],
|
||||||
wait_all: bool,
|
wait_all: bool,
|
||||||
timeout: vk::uint64_t,
|
timeout: u64,
|
||||||
) -> VkResult<()> {
|
) -> VkResult<()> {
|
||||||
let err_code = self.fp_v1_0().wait_for_fences(
|
let err_code = self.fp_v1_0().wait_for_fences(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
fences.len() as vk::uint32_t,
|
fences.len() as u32,
|
||||||
fences.as_ptr(),
|
fences.as_ptr(),
|
||||||
wait_all as vk::uint32_t,
|
wait_all as u32,
|
||||||
timeout,
|
timeout,
|
||||||
);
|
);
|
||||||
match err_code {
|
match err_code {
|
||||||
|
@ -1474,7 +1475,7 @@ pub trait DeviceV1_0 {
|
||||||
) -> VkResult<()> {
|
) -> VkResult<()> {
|
||||||
let err_code = self.fp_v1_0().queue_submit(
|
let err_code = self.fp_v1_0().queue_submit(
|
||||||
queue,
|
queue,
|
||||||
submits.len() as vk::uint32_t,
|
submits.len() as u32,
|
||||||
submits.as_ptr(),
|
submits.as_ptr(),
|
||||||
fence,
|
fence,
|
||||||
);
|
);
|
||||||
|
@ -1536,13 +1537,13 @@ pub trait DeviceV1_0 {
|
||||||
&self,
|
&self,
|
||||||
create_info: &vk::CommandBufferAllocateInfo,
|
create_info: &vk::CommandBufferAllocateInfo,
|
||||||
) -> VkResult<Vec<vk::CommandBuffer>> {
|
) -> VkResult<Vec<vk::CommandBuffer>> {
|
||||||
let mut buffers = Vec::with_capacity(create_info.command_buffer_count as vk::size_t);
|
let mut buffers = Vec::with_capacity(create_info.command_buffer_count as usize);
|
||||||
let err_code = self.fp_v1_0().allocate_command_buffers(
|
let err_code = self.fp_v1_0().allocate_command_buffers(
|
||||||
self.handle(),
|
self.handle(),
|
||||||
create_info,
|
create_info,
|
||||||
buffers.as_mut_ptr(),
|
buffers.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
buffers.set_len(create_info.command_buffer_count as vk::size_t);
|
buffers.set_len(create_info.command_buffer_count as usize);
|
||||||
match err_code {
|
match err_code {
|
||||||
vk::Result::SUCCESS => Ok(buffers),
|
vk::Result::SUCCESS => Ok(buffers),
|
||||||
_ => Err(err_code),
|
_ => Err(err_code),
|
||||||
|
|
|
@ -4,6 +4,7 @@ use shared_library::dynamic_library::DynamicLibrary;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::os::raw::c_char;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use version::{EntryLoader, FunctionPointers, InstanceLoader, V1_0, V1_1};
|
use version::{EntryLoader, FunctionPointers, InstanceLoader, V1_0, V1_1};
|
||||||
|
@ -134,7 +135,7 @@ pub trait EntryV1_0 {
|
||||||
fn get_instance_proc_addr(
|
fn get_instance_proc_addr(
|
||||||
&self,
|
&self,
|
||||||
instance: vk::Instance,
|
instance: vk::Instance,
|
||||||
p_name: *const vk::c_char,
|
p_name: *const c_char,
|
||||||
) -> vk::PFN_vkVoidFunction {
|
) -> vk::PFN_vkVoidFunction {
|
||||||
unsafe { self.static_fn().get_instance_proc_addr(instance, p_name) }
|
unsafe { self.static_fn().get_instance_proc_addr(instance, p_name) }
|
||||||
}
|
}
|
||||||
|
@ -191,7 +192,7 @@ impl<V: FunctionPointers> Entry<V> {
|
||||||
pub trait EntryV1_1: EntryV1_0 {
|
pub trait EntryV1_1: EntryV1_0 {
|
||||||
fn fp_v1_1(&self) -> &vk::EntryFnV1_1;
|
fn fp_v1_1(&self) -> &vk::EntryFnV1_1;
|
||||||
|
|
||||||
fn enumerate_instance_version(&self) -> VkResult<vk::uint32_t> {
|
fn enumerate_instance_version(&self) -> VkResult<u32> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut api_version = 0;
|
let mut api_version = 0;
|
||||||
let err_code = self.fp_v1_1().enumerate_instance_version(&mut api_version);
|
let err_code = self.fp_v1_1().enumerate_instance_version(&mut api_version);
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl Surface {
|
||||||
pub fn get_physical_device_surface_support_khr(
|
pub fn get_physical_device_surface_support_khr(
|
||||||
&self,
|
&self,
|
||||||
physical_device: vk::PhysicalDevice,
|
physical_device: vk::PhysicalDevice,
|
||||||
queue_index: vk::uint32_t,
|
queue_index: u32,
|
||||||
surface: vk::SurfaceKHR,
|
surface: vk::SurfaceKHR,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
|
@ -46,10 +46,10 @@ impl Swapchain {
|
||||||
pub unsafe fn acquire_next_image_khr(
|
pub unsafe fn acquire_next_image_khr(
|
||||||
&self,
|
&self,
|
||||||
swapchain: vk::SwapchainKHR,
|
swapchain: vk::SwapchainKHR,
|
||||||
timeout: vk::uint64_t,
|
timeout: u64,
|
||||||
semaphore: vk::Semaphore,
|
semaphore: vk::Semaphore,
|
||||||
fence: vk::Fence,
|
fence: vk::Fence,
|
||||||
) -> VkResult<vk::uint32_t> {
|
) -> VkResult<u32> {
|
||||||
let mut index = mem::uninitialized();
|
let mut index = mem::uninitialized();
|
||||||
let err_code = self.swapchain_fn.acquire_next_image_khr(
|
let err_code = self.swapchain_fn.acquire_next_image_khr(
|
||||||
self.handle,
|
self.handle,
|
||||||
|
@ -108,14 +108,14 @@ impl Swapchain {
|
||||||
ptr::null_mut(),
|
ptr::null_mut(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut v = Vec::with_capacity(count as vk::size_t);
|
let mut v = Vec::with_capacity(count as usize);
|
||||||
let err_code = self.swapchain_fn.get_swapchain_images_khr(
|
let err_code = self.swapchain_fn.get_swapchain_images_khr(
|
||||||
self.handle,
|
self.handle,
|
||||||
swapchain,
|
swapchain,
|
||||||
&mut count,
|
&mut count,
|
||||||
v.as_mut_ptr(),
|
v.as_mut_ptr(),
|
||||||
);
|
);
|
||||||
v.set_len(count as vk::size_t);
|
v.set_len(count as usize);
|
||||||
match err_code {
|
match err_code {
|
||||||
vk::Result::SUCCESS => Ok(v),
|
vk::Result::SUCCESS => Ok(v),
|
||||||
_ => Err(err_code),
|
_ => Err(err_code),
|
||||||
|
|
|
@ -4,6 +4,7 @@ use prelude::*;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::os::raw::c_char;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use version::DeviceLoader;
|
use version::DeviceLoader;
|
||||||
use version::{FunctionPointers, V1_0, V1_1};
|
use version::{FunctionPointers, V1_0, V1_1};
|
||||||
|
@ -293,7 +294,7 @@ pub trait InstanceV1_0 {
|
||||||
fn get_device_proc_addr(
|
fn get_device_proc_addr(
|
||||||
&self,
|
&self,
|
||||||
device: vk::Device,
|
device: vk::Device,
|
||||||
p_name: *const vk::c_char,
|
p_name: *const c_char,
|
||||||
) -> vk::PFN_vkVoidFunction {
|
) -> vk::PFN_vkVoidFunction {
|
||||||
unsafe { self.fp_v1_0().get_device_proc_addr(device, p_name) }
|
unsafe { self.fp_v1_0().get_device_proc_addr(device, p_name) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate lazy_static;
|
extern crate lazy_static;
|
||||||
extern crate libc;
|
|
||||||
extern crate shared_library;
|
extern crate shared_library;
|
||||||
pub use device::Device;
|
pub use device::Device;
|
||||||
pub use entry::{Entry, InstanceError, LoadingError};
|
pub use entry::{Entry, InstanceError, LoadingError};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use std::iter::Iterator;
|
use std::iter::Iterator;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::mem::size_of;
|
use std::mem::size_of;
|
||||||
|
use std::os::raw::c_void;
|
||||||
use vk;
|
use vk;
|
||||||
|
|
||||||
/// `Align` handles dynamic alignment. The is useful for dynamic uniform buffers where
|
/// `Align` handles dynamic alignment. The is useful for dynamic uniform buffers where
|
||||||
|
@ -12,7 +13,7 @@ use vk;
|
||||||
/// an additional allocation and with the correct alignment.
|
/// an additional allocation and with the correct alignment.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Align<T> {
|
pub struct Align<T> {
|
||||||
ptr: *mut vk::c_void,
|
ptr: *mut c_void,
|
||||||
elem_size: vk::DeviceSize,
|
elem_size: vk::DeviceSize,
|
||||||
size: vk::DeviceSize,
|
size: vk::DeviceSize,
|
||||||
_m: PhantomData<T>,
|
_m: PhantomData<T>,
|
||||||
|
@ -46,7 +47,7 @@ fn calc_padding(adr: vk::DeviceSize, align: vk::DeviceSize) -> vk::DeviceSize {
|
||||||
|
|
||||||
impl<T> Align<T> {
|
impl<T> Align<T> {
|
||||||
pub unsafe fn new(
|
pub unsafe fn new(
|
||||||
ptr: *mut vk::c_void,
|
ptr: *mut c_void,
|
||||||
alignment: vk::DeviceSize,
|
alignment: vk::DeviceSize,
|
||||||
size: vk::DeviceSize,
|
size: vk::DeviceSize,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
|
5215
ash/src/vk.rs
5215
ash/src/vk.rs
File diff suppressed because it is too large
Load diff
|
@ -8,6 +8,7 @@ use std::ffi::CString;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::Read;
|
use std::io::Read;
|
||||||
use std::mem::{self, align_of};
|
use std::mem::{self, align_of};
|
||||||
|
use std::os::raw::c_void;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
|
@ -152,7 +153,7 @@ fn main() {
|
||||||
.device
|
.device
|
||||||
.allocate_memory(&index_allocate_info, None)
|
.allocate_memory(&index_allocate_info, None)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let index_ptr: *mut vk::c_void = base
|
let index_ptr: *mut c_void = base
|
||||||
.device
|
.device
|
||||||
.map_memory(
|
.map_memory(
|
||||||
index_buffer_memory,
|
index_buffer_memory,
|
||||||
|
|
|
@ -18,6 +18,7 @@ use std::cell::RefCell;
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::ffi::{CStr, CString};
|
use std::ffi::{CStr, CString};
|
||||||
use std::ops::Drop;
|
use std::ops::Drop;
|
||||||
|
use std::os::raw::{c_char, c_void};
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
|
|
||||||
// Simple offset_of macro akin to C++ offsetof
|
// Simple offset_of macro akin to C++ offsetof
|
||||||
|
@ -121,13 +122,13 @@ unsafe fn create_surface<E: EntryV1_0, I: InstanceV1_0>(
|
||||||
use winit::os::windows::WindowExt;
|
use winit::os::windows::WindowExt;
|
||||||
|
|
||||||
let hwnd = window.get_hwnd() as HWND;
|
let hwnd = window.get_hwnd() as HWND;
|
||||||
let hinstance = GetWindow(hwnd, 0) as *const vk::c_void;
|
let hinstance = GetWindow(hwnd, 0) as *const c_void;
|
||||||
let win32_create_info = vk::Win32SurfaceCreateInfoKHR {
|
let win32_create_info = vk::Win32SurfaceCreateInfoKHR {
|
||||||
s_type: vk::StructureType::WIN32_SURFACE_CREATE_INFO_KHR,
|
s_type: vk::StructureType::WIN32_SURFACE_CREATE_INFO_KHR,
|
||||||
p_next: ptr::null(),
|
p_next: ptr::null(),
|
||||||
flags: Default::default(),
|
flags: Default::default(),
|
||||||
hinstance: hinstance,
|
hinstance: hinstance,
|
||||||
hwnd: hwnd as *const vk::c_void,
|
hwnd: hwnd as *const c_void,
|
||||||
};
|
};
|
||||||
let win32_surface_loader =
|
let win32_surface_loader =
|
||||||
Win32Surface::new(entry, instance).expect("Unable to load win32 surface");
|
Win32Surface::new(entry, instance).expect("Unable to load win32 surface");
|
||||||
|
@ -155,12 +156,12 @@ fn extension_names() -> Vec<*const i8> {
|
||||||
unsafe extern "system" fn vulkan_debug_callback(
|
unsafe extern "system" fn vulkan_debug_callback(
|
||||||
_: vk::DebugReportFlagsEXT,
|
_: vk::DebugReportFlagsEXT,
|
||||||
_: vk::DebugReportObjectTypeEXT,
|
_: vk::DebugReportObjectTypeEXT,
|
||||||
_: vk::uint64_t,
|
_: u64,
|
||||||
_: vk::size_t,
|
_: usize,
|
||||||
_: vk::int32_t,
|
_: i32,
|
||||||
_: *const vk::c_char,
|
_: *const c_char,
|
||||||
p_message: *const vk::c_char,
|
p_message: *const c_char,
|
||||||
_: *mut vk::c_void,
|
_: *mut c_void,
|
||||||
) -> u32 {
|
) -> u32 {
|
||||||
println!("{:?}", CStr::from_ptr(p_message));
|
println!("{:?}", CStr::from_ptr(p_message));
|
||||||
1
|
1
|
||||||
|
|
|
@ -123,7 +123,7 @@ pub fn handle_nondispatchable_macro() -> Tokens {
|
||||||
($name: ident, $ty: ident) => {
|
($name: ident, $ty: ident) => {
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Default)]
|
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash, Default)]
|
||||||
pub struct $name(uint64_t);
|
pub struct $name(u64);
|
||||||
|
|
||||||
impl Handle for $name {
|
impl Handle for $name {
|
||||||
const TYPE: ObjectType = ObjectType::$ty;
|
const TYPE: ObjectType = ObjectType::$ty;
|
||||||
|
@ -163,21 +163,21 @@ pub fn vk_version_macros() -> Tokens {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! vk_version_major {
|
macro_rules! vk_version_major {
|
||||||
($major:expr) => {
|
($major:expr) => {
|
||||||
($major as uint32_t) >> 22
|
($major as u32) >> 22
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! vk_version_minor {
|
macro_rules! vk_version_minor {
|
||||||
($minor:expr) => {
|
($minor:expr) => {
|
||||||
(($minor as uint32_t) >> 12) & 0x3ff
|
(($minor as u32) >> 12) & 0x3ff
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! vk_version_patch {
|
macro_rules! vk_version_patch {
|
||||||
($minor:expr) => {
|
($minor:expr) => {
|
||||||
($minor as uint32_t) & 0xfff
|
($minor as u32) & 0xfff
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,8 +349,7 @@ pub fn platform_specific_types() -> Tokens {
|
||||||
pub type wl_surface = *const c_void;
|
pub type wl_surface = *const c_void;
|
||||||
pub type HANDLE = *mut c_void;
|
pub type HANDLE = *mut c_void;
|
||||||
pub type DWORD = c_ulong;
|
pub type DWORD = c_ulong;
|
||||||
pub type WCHAR = wchar_t;
|
pub type LPCWSTR = *const u16;
|
||||||
pub type LPCWSTR = *const WCHAR;
|
|
||||||
|
|
||||||
// FIXME: Platform specific types that should come from a library
|
// FIXME: Platform specific types that should come from a library
|
||||||
// typedefs are only here so that the code compiles for now
|
// typedefs are only here so that the code compiles for now
|
||||||
|
@ -595,6 +594,15 @@ impl ToTokens for vkxml::ReferenceType {
|
||||||
}
|
}
|
||||||
fn name_to_tokens(type_name: &str) -> Ident {
|
fn name_to_tokens(type_name: &str) -> Ident {
|
||||||
let new_name = match type_name {
|
let new_name = match type_name {
|
||||||
|
"uint8_t" => "u8",
|
||||||
|
"uint16_t" => "u16",
|
||||||
|
"uint32_t" => "u32",
|
||||||
|
"uint64_t" => "u64",
|
||||||
|
"int8_t" => "i8",
|
||||||
|
"int16_t" => "i16",
|
||||||
|
"int32_t" => "i32",
|
||||||
|
"int64_t" => "i64",
|
||||||
|
"size_t" => "usize",
|
||||||
"int" => "c_int",
|
"int" => "c_int",
|
||||||
"void" => "c_void",
|
"void" => "c_void",
|
||||||
"char" => "c_char",
|
"char" => "c_char",
|
||||||
|
@ -1678,8 +1686,7 @@ pub fn write_source_code(path: &Path) {
|
||||||
let platform_specific_types = platform_specific_types();
|
let platform_specific_types = platform_specific_types();
|
||||||
let source_code = quote!{
|
let source_code = quote!{
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
#[doc(hidden)]
|
use std::os::raw::*;
|
||||||
pub use libc::*;
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub use self::extensions::*;
|
pub use self::extensions::*;
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
|
Loading…
Reference in a new issue