Rm unsued files
This commit is contained in:
parent
488d2392ce
commit
4d7b1b7b8d
12 changed files with 55 additions and 977 deletions
|
@ -1,24 +0,0 @@
|
|||
use vk_loader as vk;
|
||||
use glfw::*;
|
||||
use std::mem;
|
||||
use instance::Instance;
|
||||
use std::ptr;
|
||||
use std::os::raw::c_void;
|
||||
|
||||
pub fn find_memorytype_index(memory_req: &vk::MemoryRequirements,
|
||||
memory_prop: &vk::PhysicalDeviceMemoryProperties,
|
||||
flags: vk::MemoryPropertyFlags)
|
||||
-> Option<u32> {
|
||||
let mut memory_type_bits = memory_req.memoryTypeBits;
|
||||
for (index, ref memory_type) in memory_prop.memoryTypes.iter().enumerate() {
|
||||
if (memory_type.propertyFlags & flags) == flags {
|
||||
return Some(index as u32);
|
||||
}
|
||||
memory_type_bits = memory_type_bits >> 1;
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
struct HostBuffer {
|
||||
memory_type: vk::MemoryType,
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
use device;
|
||||
use vk_loader as vk;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::convert::From;
|
||||
|
||||
pub enum CommandPoolFlags {
|
||||
Transient,
|
||||
Reset,
|
||||
}
|
||||
|
||||
enum CommandBufferLevel {
|
||||
Primary,
|
||||
Secondary,
|
||||
}
|
||||
|
||||
pub struct CommandPool {
|
||||
pub device: device::Device,
|
||||
pub pool: vk::CommandPool,
|
||||
}
|
||||
|
||||
impl Drop for CommandPool {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
self.device
|
||||
.inner
|
||||
.dp
|
||||
.DestroyCommandPool(self.device.inner.device, self.pool, ptr::null());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct CommandBuffer<'r> {
|
||||
pub pool: &'r CommandPool,
|
||||
pub buffer: vk::CommandBuffer,
|
||||
}
|
||||
|
||||
impl<'r> CommandBuffer<'r> {
|
||||
pub fn begin(&self, cu: CommandBufferUsage) {
|
||||
let create_info = vk::CommandBufferBeginInfo {
|
||||
sType: vk::STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO,
|
||||
pNext: ptr::null(),
|
||||
flags: cu.bits(),
|
||||
pInheritanceInfo: ptr::null(),
|
||||
};
|
||||
unsafe {
|
||||
self.pool.device.inner.dp.BeginCommandBuffer(self.buffer, &create_info);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn end(&self){
|
||||
unsafe{
|
||||
self.pool.device.inner.dp.EndCommandBuffer(self.buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl CommandPool {
|
||||
pub fn allocate_commandbuffer(&self) -> CommandBuffer {
|
||||
let create_info = vk::CommandBufferAllocateInfo {
|
||||
sType: vk::STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO,
|
||||
commandPool: self.pool,
|
||||
level: vk::COMMAND_BUFFER_LEVEL_PRIMARY,
|
||||
commandBufferCount: 1,
|
||||
pNext: ptr::null(),
|
||||
};
|
||||
|
||||
unsafe {
|
||||
let mut command_buffer = mem::uninitialized();
|
||||
self.device.inner.dp.AllocateCommandBuffers(self.device.inner.device,
|
||||
&create_info,
|
||||
&mut command_buffer);
|
||||
let cb = CommandBuffer {
|
||||
pool: self,
|
||||
buffer: command_buffer,
|
||||
};
|
||||
|
||||
cb
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
pub flags CommandBufferUsage: u32{
|
||||
const ONE_TIME_SUBMIT = vk::COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT,
|
||||
const RENDER_PASS_CONTINUE = vk::COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT,
|
||||
const SIMULTANEOUS_USE = vk::COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT
|
||||
}
|
||||
}
|
|
@ -136,6 +136,53 @@ impl<'r> Device<'r> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn cmd_bind_index_buffer(&self,
|
||||
command_buffer: vk::CommandBuffer,
|
||||
buffer: vk::Buffer,
|
||||
offset: vk::DeviceSize,
|
||||
index_type: vk::IndexType) {
|
||||
unsafe {
|
||||
self.device_fn.cmd_bind_index_buffer(command_buffer, buffer, offset, index_type);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cmd_draw_indexed(&self,
|
||||
command_buffer: vk::CommandBuffer,
|
||||
index_count: vk::uint32_t,
|
||||
instance_count: vk::uint32_t,
|
||||
first_index: vk::uint32_t,
|
||||
vertex_offset: vk::int32_t,
|
||||
first_instance: vk::uint32_t) {
|
||||
|
||||
unsafe {
|
||||
self.device_fn.cmd_draw_indexed(command_buffer,
|
||||
index_count,
|
||||
instance_count,
|
||||
first_index,
|
||||
vertex_offset,
|
||||
first_instance);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cmd_bind_descriptor_sets(&self,
|
||||
command_buffer: vk::CommandBuffer,
|
||||
pipeline_bind_point: vk::PipelineBindPoint,
|
||||
layout: vk::PipelineLayout,
|
||||
first_set: vk::uint32_t,
|
||||
descriptor_sets: &[vk::DescriptorSet],
|
||||
dynamic_offsets: &[vk::uint32_t]) {
|
||||
unsafe {
|
||||
self.device_fn.cmd_bind_descriptor_sets(command_buffer,
|
||||
pipeline_bind_point,
|
||||
layout,
|
||||
first_set,
|
||||
descriptor_sets.len() as u32,
|
||||
descriptor_sets.as_ptr(),
|
||||
dynamic_offsets.len() as u32,
|
||||
dynamic_offsets.as_ptr())
|
||||
}
|
||||
}
|
||||
|
||||
pub fn cmd_begin_render_pass(&self,
|
||||
command_buffer: vk::CommandBuffer,
|
||||
create_info: &vk::RenderPassBeginInfo,
|
||||
|
@ -628,6 +675,7 @@ impl<'r> Device<'r> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn bind_image_memory(&self,
|
||||
image: vk::Image,
|
||||
device_memory: vk::DeviceMemory,
|
||||
|
|
|
@ -23,7 +23,7 @@ fn get_path() -> &'static Path {
|
|||
|
||||
pub struct Entry {
|
||||
lib: DynamicLibrary,
|
||||
static_fn: vk::Static,
|
||||
static_fn: vk::StaticFn,
|
||||
entry_fn: vk::EntryFn,
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ impl Entry {
|
|||
pub fn load_vulkan_path(path: &Path) -> Result<Entry, LoadingError> {
|
||||
let lib = try!(DynamicLibrary::open(Some(path))
|
||||
.map_err(|err| LoadingError::LibraryLoadFailure(err)));
|
||||
let static_fn = try!(vk::Static::load(|name| unsafe {
|
||||
let static_fn = try!(vk::StaticFn::load(|name| unsafe {
|
||||
let name = name.to_str().unwrap();
|
||||
let f = match lib.symbol(name) {
|
||||
Ok(s) => s,
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
use vk_loader as vk;
|
||||
use std::ffi::{CString, CStr};
|
||||
macro_rules! extensions {
|
||||
($struct_name: ident, $struct_name_prop: ident, $($name: ident => $str_name: expr,)*) => {
|
||||
#[derive(Debug)]
|
||||
pub struct $struct_name {
|
||||
$(
|
||||
pub $name: bool,
|
||||
)+
|
||||
}
|
||||
impl $struct_name {
|
||||
pub fn empty() -> $struct_name {
|
||||
$struct_name{
|
||||
$(
|
||||
$name: false,
|
||||
)+
|
||||
}
|
||||
}
|
||||
pub fn extension_list(&self) -> Vec<CString>{
|
||||
let mut vec = Vec::new();
|
||||
$(
|
||||
if self.$name{
|
||||
vec.push(CString::new($str_name).unwrap());
|
||||
}
|
||||
)+
|
||||
vec
|
||||
}
|
||||
|
||||
pub fn subset_of(&self, other: &$struct_name) -> bool{
|
||||
$(!self.$name | other.$name)&&+
|
||||
}
|
||||
}
|
||||
pub struct $struct_name_prop {
|
||||
pub ext_props: Vec<vk::ExtensionProperties>
|
||||
}
|
||||
|
||||
impl From<$struct_name_prop> for $struct_name{
|
||||
fn from(ep: $struct_name_prop) -> $struct_name{
|
||||
let mut ext = $struct_name::empty();
|
||||
for ext_prop in ep.ext_props.iter() {
|
||||
let name = unsafe{
|
||||
CStr::from_ptr(ext_prop.extensionName.as_ptr()).to_str().unwrap()
|
||||
};
|
||||
$(
|
||||
if name == $str_name {
|
||||
ext.$name = true;
|
||||
}
|
||||
)+
|
||||
}
|
||||
ext
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extensions!{
|
||||
InstanceExtension,
|
||||
InstanceExtensionProperties,
|
||||
khr_surface => "VK_KHR_surface",
|
||||
khr_display => "VK_KHR_display",
|
||||
khr_xlib_surface => "VK_KHR_xlib_surface",
|
||||
khr_xcb_surface => "VK_KHR_xcb_surface",
|
||||
khr_wayland_surface => "VK_KHR_wayland_surface",
|
||||
khr_mir_surface => "VK_KHR_mir_surface",
|
||||
khr_android_surface => "VK_KHR_android_surface",
|
||||
khr_win32_surface => "VK_KHR_win32_surface",
|
||||
khr_ext_debug_report => "VK_EXT_debug_report",
|
||||
}
|
||||
|
||||
extensions! {
|
||||
DeviceExtension,
|
||||
DeviceExtensionProperties,
|
||||
khr_swapchain => "VK_KHR_swapchain",
|
||||
khr_display_swapchain => "VK_KHR_display_swapchain",
|
||||
}
|
|
@ -1,171 +0,0 @@
|
|||
#![allow(dead_code)]
|
||||
use vk_loader as vk;
|
||||
use std::fmt;
|
||||
macro_rules! c_enum{
|
||||
($struct_name: ident, ($($from_type: tt)*), $($name: ident => $vk: ident,)+) => {
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct $struct_name{
|
||||
$(
|
||||
pub $name: bool,
|
||||
)+
|
||||
}
|
||||
impl $struct_name{
|
||||
pub fn empty() -> $struct_name{
|
||||
$struct_name{
|
||||
$(
|
||||
$name: false,
|
||||
)+
|
||||
}
|
||||
}
|
||||
pub fn subset(&self, other: &Self) -> bool{
|
||||
$((!self.$name | other.$name))&&+
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Probably just impl From with a cast?
|
||||
impl From<$($from_type)*> for $struct_name{
|
||||
fn from(features: $($from_type)*) -> $struct_name {
|
||||
$struct_name{
|
||||
$(
|
||||
$name: features.$vk != 0,
|
||||
)+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<$struct_name> for $($from_type)* {
|
||||
fn from(features: $struct_name) -> $($from_type)* {
|
||||
$($from_type)*{
|
||||
$(
|
||||
$vk: features.$name as u32,
|
||||
)+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for $struct_name {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{
|
||||
$(
|
||||
if self.$name {
|
||||
try!(writeln!(f, "{},", stringify!($name)));
|
||||
}
|
||||
)+
|
||||
writeln!(f, "")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
macro_rules! features{
|
||||
($struct_name: ident, ($($from_type: tt)*), $($name: ident => $vk: ident,)+) => {
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct $struct_name{
|
||||
$(
|
||||
pub $name: bool,
|
||||
)+
|
||||
}
|
||||
impl $struct_name{
|
||||
pub fn empty() -> $struct_name{
|
||||
$struct_name{
|
||||
$(
|
||||
$name: false,
|
||||
)+
|
||||
}
|
||||
}
|
||||
pub fn subset(&self, other: &Self) -> bool{
|
||||
$((!self.$name | other.$name))&&+
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Probably just impl From with a cast?
|
||||
impl From<$($from_type)*> for $struct_name{
|
||||
fn from(features: $($from_type)*) -> $struct_name {
|
||||
$struct_name{
|
||||
$(
|
||||
$name: features.$vk != 0,
|
||||
)+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<$struct_name> for $($from_type)* {
|
||||
fn from(features: $struct_name) -> $($from_type)* {
|
||||
$($from_type)*{
|
||||
$(
|
||||
$vk: features.$name as u32,
|
||||
)+
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for $struct_name {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{
|
||||
$(
|
||||
if self.$name {
|
||||
try!(writeln!(f, "{},", stringify!($name)));
|
||||
}
|
||||
)+
|
||||
writeln!(f, "")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
features!{
|
||||
Features,
|
||||
(vk::PhysicalDeviceFeatures),
|
||||
robust_buffer_access => robustBufferAccess,
|
||||
full_draw_index_uint32 => fullDrawIndexUint32,
|
||||
image_cube_array => imageCubeArray,
|
||||
independent_blend => independentBlend,
|
||||
geometry_shader => geometryShader,
|
||||
tessellation_shader => tessellationShader,
|
||||
sample_rate_shading => sampleRateShading,
|
||||
dual_src_blend => dualSrcBlend,
|
||||
logic_op => logicOp,
|
||||
multi_draw_indirect => multiDrawIndirect,
|
||||
draw_indirect_first_instance => drawIndirectFirstInstance,
|
||||
depth_clamp => depthClamp,
|
||||
depth_bias_clamp => depthBiasClamp,
|
||||
fill_mode_non_solid => fillModeNonSolid,
|
||||
depth_bounds => depthBounds,
|
||||
wide_lines => wideLines,
|
||||
large_points => largePoints,
|
||||
alpha_to_one => alphaToOne,
|
||||
multi_viewport => multiViewport,
|
||||
sampler_anisotropy => samplerAnisotropy,
|
||||
texture_compression_etc2 => textureCompressionETC2,
|
||||
texture_compression_astc_ldr => textureCompressionASTC_LDR,
|
||||
texture_compression_bc => textureCompressionBC,
|
||||
occlusion_query_precise => occlusionQueryPrecise,
|
||||
pipeline_statistics_query => pipelineStatisticsQuery,
|
||||
vertex_pipeline_stores_and_atomics => vertexPipelineStoresAndAtomics,
|
||||
fragment_stores_and_atomics => fragmentStoresAndAtomics,
|
||||
shader_tessellation_and_geometry_point_size => shaderTessellationAndGeometryPointSize,
|
||||
shader_image_gather_extended => shaderImageGatherExtended,
|
||||
shader_storage_image_extended_formats => shaderStorageImageExtendedFormats,
|
||||
shader_storage_image_multisample => shaderStorageImageMultisample,
|
||||
shader_storage_image_read_without_format => shaderStorageImageReadWithoutFormat,
|
||||
shader_storage_image_write_without_format => shaderStorageImageWriteWithoutFormat,
|
||||
shader_uniform_buffer_array_dynamic_indexing => shaderUniformBufferArrayDynamicIndexing,
|
||||
shader_sampled_image_array_dynamic_indexing => shaderSampledImageArrayDynamicIndexing,
|
||||
shader_storage_buffer_array_dynamic_indexing => shaderStorageBufferArrayDynamicIndexing,
|
||||
shader_storage_image_array_dynamic_indexing => shaderStorageImageArrayDynamicIndexing,
|
||||
shader_clip_distance => shaderClipDistance,
|
||||
shader_cull_distance => shaderCullDistance,
|
||||
shaderf3264 => shaderf3264,
|
||||
shader_int64 => shaderInt64,
|
||||
shader_int16 => shaderInt16,
|
||||
shader_resource_residency => shaderResourceResidency,
|
||||
shader_resource_min_lod => shaderResourceMinLod,
|
||||
sparse_binding => sparseBinding,
|
||||
sparse_residency_buffer => sparseResidencyBuffer,
|
||||
sparse_residency_image_2d => sparseResidencyImage2D,
|
||||
sparse_residency_image_3d => sparseResidencyImage3D,
|
||||
sparse_residency2_samples => sparseResidency2Samples,
|
||||
sparse_residency4_samples => sparseResidency4Samples,
|
||||
sparse_residency8_samples => sparseResidency8Samples,
|
||||
sparse_residency16_samples => sparseResidency16Samples,
|
||||
sparse_residency_aliased => sparseResidencyAliased,
|
||||
variable_multisample_rate => variableMultisampleRate,
|
||||
inherited_queries => inheritedQueries,
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
use vk_loader as vk;
|
||||
|
||||
use std::mem;
|
||||
use device::Device;
|
||||
use std::ops::Drop;
|
||||
use std::ptr;
|
||||
|
||||
pub struct Fence {
|
||||
pub device: Device,
|
||||
pub handle: vk::Fence,
|
||||
}
|
||||
impl Drop for Fence {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
self.device.dp().DestroyFence(self.device.handle(), self.handle, ptr::null());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Fence {}
|
|
@ -5,13 +5,6 @@ extern crate vk_loader;
|
|||
extern crate vk_loader2;
|
||||
extern crate glfw;
|
||||
|
||||
//pub mod load;
|
||||
//pub mod extensions;
|
||||
//pub mod surface;
|
||||
pub mod instance;
|
||||
//pub mod feature;
|
||||
pub mod device;
|
||||
pub mod entry;
|
||||
//pub mod commandpool;
|
||||
//pub mod fence;
|
||||
//pub mod buffer;
|
||||
|
|
|
@ -1,89 +0,0 @@
|
|||
// Copyright (c) 2016 The vulkano developers
|
||||
// Licensed under the Apache License, Version 2.0
|
||||
// <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT
|
||||
// license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
|
||||
// at your option. All files in the project carrying such
|
||||
// notice may not be copied, modified, or distributed except
|
||||
// according to those terms.
|
||||
|
||||
use std::error;
|
||||
use std::fmt;
|
||||
use std::mem;
|
||||
use std::path::Path;
|
||||
use std::ptr;
|
||||
|
||||
use shared_library;
|
||||
use vk_loader2 as vk;
|
||||
|
||||
/// Returns the collection of static functions from the Vulkan loader, or an error if failed to
|
||||
/// open the loader.
|
||||
// pub fn static_functions() -> Result<&'static vk::Static, LoadingError> {
|
||||
// VK_STATIC.as_ref().map_err(|err| err.clone())
|
||||
// }
|
||||
|
||||
pub fn static_fn() -> Result<vk::Static, String> {
|
||||
let r = match *VK_LIB {
|
||||
Ok(ref lib) => {
|
||||
vk::Static::load(|name| unsafe {
|
||||
let name = name.to_str().unwrap();
|
||||
match lib.symbol(name) {
|
||||
Ok(s) => s,
|
||||
Err(_) => ptr::null(),
|
||||
}
|
||||
})
|
||||
}
|
||||
Err(ref err) => return Err("Foo".to_string()),
|
||||
};
|
||||
Ok(r.unwrap())
|
||||
}
|
||||
pub fn entry_fn(static_fn: &vk::Static) -> vk::EntryFn {
|
||||
let entry = vk::EntryFn::load(|name| unsafe {
|
||||
mem::transmute(static_fn.get_instance_proc_addr(ptr::null_mut(), name.as_ptr()))
|
||||
});
|
||||
entry.unwrap()
|
||||
}
|
||||
|
||||
/// // Returns the collection of Vulkan entry points from the Vulkan loader, or an error if failed to
|
||||
/// // open the loader.
|
||||
/// pub fn entry_points() -> Result<&'static vk::EntryPoints, LoadingError> {
|
||||
/// VK_ENTRY.as_ref().map_err(|err| err.clone())
|
||||
/// }
|
||||
///
|
||||
/// // Error that can happen when loading the Vulkan loader.
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum LoadingError {
|
||||
/// Failed to load the Vulkan shared library.
|
||||
LibraryLoadFailure(String), /* TODO: meh for error type, but this needs changes in shared_library */
|
||||
|
||||
/// One of the entry points required to be supported by the Vulkan implementation is missing.
|
||||
MissingEntryPoint(String),
|
||||
}
|
||||
|
||||
impl error::Error for LoadingError {
|
||||
#[inline]
|
||||
fn description(&self) -> &str {
|
||||
match *self {
|
||||
LoadingError::LibraryLoadFailure(_) => "failed to load the Vulkan shared library",
|
||||
LoadingError::MissingEntryPoint(_) => {
|
||||
"one of the entry points required to be supported by the Vulkan implementation \
|
||||
is missing"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// #[inline]
|
||||
// fn cause(&self) -> Option<&error::Error> {
|
||||
// match *self {
|
||||
// LoadingError::LibraryLoadFailure(ref err) => Some(err),
|
||||
// _ => None
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
impl fmt::Display for LoadingError {
|
||||
#[inline]
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
|
||||
write!(fmt, "{}", error::Error::description(self))
|
||||
}
|
||||
}
|
|
@ -1,488 +0,0 @@
|
|||
use vk_loader as vk;
|
||||
use glfw::*;
|
||||
use std::mem;
|
||||
use instance::Instance;
|
||||
use std::ptr;
|
||||
use std::os::raw::c_void;
|
||||
pub trait VulkanSurface {
|
||||
fn create_surface(&self, inst: &Instance) -> vk::SurfaceKHR;
|
||||
}
|
||||
|
||||
impl VulkanSurface for Window {
|
||||
fn create_surface(&self, inst: &Instance) -> vk::SurfaceKHR {
|
||||
unsafe {
|
||||
let x11_display = self.glfw.get_x11_display();
|
||||
let x11_window = self.get_x11_window();
|
||||
let mut surface: vk::SurfaceKHR = mem::uninitialized();
|
||||
let create_info = vk::XlibSurfaceCreateInfoKHR {
|
||||
sType: vk::STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR,
|
||||
pNext: ptr::null(),
|
||||
flags: 0,
|
||||
window: x11_window as *mut c_void,
|
||||
dpy: x11_display as *mut c_void,
|
||||
};
|
||||
inst.inner.ip.CreateXlibSurfaceKHR(inst.inner.instance, &create_info, ptr::null(), &mut surface);
|
||||
surface
|
||||
}
|
||||
}
|
||||
}
|
||||
struct SurfaceCapabilities {
|
||||
}
|
||||
pub struct SurfaceFormat {
|
||||
pub format: Format,
|
||||
pub color_space: ColorSpace,
|
||||
}
|
||||
|
||||
pub struct Surface {
|
||||
pub instance: Instance,
|
||||
pub handle: vk::SurfaceKHR,
|
||||
}
|
||||
|
||||
impl Drop for Surface {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
self.instance.inner.ip.DestroySurfaceKHR(self.instance.inner.instance, self.handle, ptr::null());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum Format {
|
||||
FormatUndefined,
|
||||
FormatR4g4UnormPack8,
|
||||
FormatR4g4b4a4UnormPack16,
|
||||
FormatB4g4r4a4UnormPack16,
|
||||
FormatR5g6b5UnormPack16,
|
||||
FormatB5g6r5UnormPack16,
|
||||
FormatR5g5b5a1UnormPack16,
|
||||
FormatB5g5r5a1UnormPack16,
|
||||
FormatA1r5g5b5UnormPack16,
|
||||
FormatR8Unorm,
|
||||
FormatR8Snorm,
|
||||
FormatR8Uscaled,
|
||||
FormatR8Sscaled,
|
||||
FormatR8Uint,
|
||||
FormatR8Sint,
|
||||
FormatR8Srgb,
|
||||
FormatR8G8Unorm,
|
||||
FormatR8G8Snorm,
|
||||
FormatR8G8Uscaled,
|
||||
FormatR8G8Sscaled,
|
||||
FormatR8G8Uint,
|
||||
FormatR8G8Sint,
|
||||
FormatR8G8Srgb,
|
||||
FormatR8G8B8Unorm,
|
||||
FormatR8G8B8Snorm,
|
||||
FormatR8G8B8Uscaled,
|
||||
FormatR8G8B8Sscaled,
|
||||
FormatR8G8B8Uint,
|
||||
FormatR8G8B8Sint,
|
||||
FormatR8G8B8Srgb,
|
||||
FormatB8G8r8Unorm,
|
||||
FormatB8G8r8Snorm,
|
||||
FormatB8G8r8Uscaled,
|
||||
FormatB8G8r8Sscaled,
|
||||
FormatB8G8r8Uint,
|
||||
FormatB8G8r8Sint,
|
||||
FormatB8G8r8Srgb,
|
||||
FormatR8G8b8a8Unorm,
|
||||
FormatR8G8b8a8Snorm,
|
||||
FormatR8G8b8a8Uscaled,
|
||||
FormatR8G8b8a8Sscaled,
|
||||
FormatR8G8b8a8Uint,
|
||||
FormatR8G8b8a8Sint,
|
||||
FormatR8G8b8a8Srgb,
|
||||
FormatB8G8r8a8Unorm,
|
||||
FormatB8G8r8a8Snorm,
|
||||
FormatB8G8r8a8Uscaled,
|
||||
FormatB8G8r8a8Sscaled,
|
||||
FormatB8G8r8a8Uint,
|
||||
FormatB8G8r8a8Sint,
|
||||
FormatB8G8r8a8Srgb,
|
||||
FormatA8b8g8r8UnormPack32,
|
||||
FormatA8b8g8r8SnormPack32,
|
||||
FormatA8b8g8r8UscaledPack32,
|
||||
FormatA8b8g8r8SscaledPack32,
|
||||
FormatA8b8g8r8UintPack32,
|
||||
FormatA8b8g8r8SintPack32,
|
||||
FormatA8b8g8r8SrgbPack32,
|
||||
FormatA2r10g10b10UnormPack32,
|
||||
FormatA2r10g10b10SnormPack32,
|
||||
FormatA2r10g10b10UscaledPack32,
|
||||
FormatA2r10g10b10SscaledPack32,
|
||||
FormatA2r10g10b10UintPack32,
|
||||
FormatA2r10g10b10SintPack32,
|
||||
FormatA2b10g10r10UnormPack32,
|
||||
FormatA2b10g10r10SnormPack32,
|
||||
FormatA2b10g10r10UscaledPack32,
|
||||
FormatA2b10g10r10SscaledPack32,
|
||||
FormatA2b10g10r10UintPack32,
|
||||
FormatA2b10g10r10SintPack32,
|
||||
FormatR16Unorm,
|
||||
FormatR16Snorm,
|
||||
FormatR16Uscaled,
|
||||
FormatR16Sscaled,
|
||||
FormatR16Uint,
|
||||
FormatR16Sint,
|
||||
FormatR16Sfloat,
|
||||
FormatR16g16Unorm,
|
||||
FormatR16g16Snorm,
|
||||
FormatR16g16Uscaled,
|
||||
FormatR16g16Sscaled,
|
||||
FormatR16g16Uint,
|
||||
FormatR16g16Sint,
|
||||
FormatR16g16Sfloat,
|
||||
FormatR16g16b16Unorm,
|
||||
FormatR16g16b16Snorm,
|
||||
FormatR16g16b16Uscaled,
|
||||
FormatR16g16b16Sscaled,
|
||||
FormatR16g16b16Uint,
|
||||
FormatR16g16b16Sint,
|
||||
FormatR16g16b16Sfloat,
|
||||
FormatR16g16b16a16Unorm,
|
||||
FormatR16g16b16a16Snorm,
|
||||
FormatR16g16b16a16Uscaled,
|
||||
FormatR16g16b16a16Sscaled,
|
||||
FormatR16g16b16a16Uint,
|
||||
FormatR16g16b16a16Sint,
|
||||
FormatR16g16b16a16Sfloat,
|
||||
FormatR32Uint,
|
||||
FormatR32Sint,
|
||||
FormatR32Sfloat,
|
||||
FormatR32g32Uint,
|
||||
FormatR32g32Sint,
|
||||
FormatR32g32Sfloat,
|
||||
FormatR32g32b32Uint,
|
||||
FormatR32g32b32Sint,
|
||||
FormatR32g32b32Sfloat,
|
||||
FormatR32g32b32a32Uint,
|
||||
FormatR32g32b32a32Sint,
|
||||
FormatR32g32b32a32Sfloat,
|
||||
FormatR64Uint,
|
||||
FormatR64Sint,
|
||||
FormatR64Sfloat,
|
||||
FormatR64g64Uint,
|
||||
FormatR64g64Sint,
|
||||
FormatR64g64Sfloat,
|
||||
FormatR64g64b64Uint,
|
||||
FormatR64g64b64Sint,
|
||||
FormatR64g64b64Sfloat,
|
||||
FormatR64g64b64a64Uint,
|
||||
FormatR64g64b64a64Sint,
|
||||
FormatR64g64b64a64Sfloat,
|
||||
FormatB10g11r11UfloatPack32,
|
||||
FormatE5b9g9r9UfloatPack32,
|
||||
FormatD16Unorm,
|
||||
FormatX8D24UnormPack32,
|
||||
FormatD32Sfloat,
|
||||
FormatS8Uint,
|
||||
FormatD16UnormS8Uint,
|
||||
FormatD24UnormS8Uint,
|
||||
FormatD32SfloatS8Uint,
|
||||
FormatBc1RgbUnormBlock,
|
||||
FormatBc1RgbSrgbBlock,
|
||||
FormatBc1RgbaUnormBlock,
|
||||
FormatBc1RgbaSrgbBlock,
|
||||
FormatBc2UnormBlock,
|
||||
FormatBc2SrgbBlock,
|
||||
FormatBc3UnormBlock,
|
||||
FormatBc3SrgbBlock,
|
||||
FormatBc4UnormBlock,
|
||||
FormatBc4SnormBlock,
|
||||
FormatBc5UnormBlock,
|
||||
FormatBc5SnormBlock,
|
||||
FormatBc6hUfloatBlock,
|
||||
FormatBc6hSfloatBlock,
|
||||
FormatBc7UnormBlock,
|
||||
FormatBc7SrgbBlock,
|
||||
FormatEtc2R8G8B8UnormBlock,
|
||||
FormatEtc2R8G8B8SrgbBlock,
|
||||
FormatEtc2R8G8B8a1UnormBlock,
|
||||
FormatEtc2R8G8B8a1SrgbBlock,
|
||||
FormatEtc2R8G8B8a8UnormBlock,
|
||||
FormatEtc2R8G8B8a8SrgbBlock,
|
||||
FormatEacR11UnormBlock,
|
||||
FormatEacR11SnormBlock,
|
||||
FormatEacR11g11UnormBlock,
|
||||
FormatEacR11g11SnormBlock,
|
||||
FormatAstc4x4UnormBlock,
|
||||
FormatAstc4x4SrgbBlock,
|
||||
FormatAstc5x4UnormBlock,
|
||||
FormatAstc5x4SrgbBlock,
|
||||
FormatAstc5x5UnormBlock,
|
||||
FormatAstc5x5SrgbBlock,
|
||||
FormatAstc6x5UnormBlock,
|
||||
FormatAstc6x5SrgbBlock,
|
||||
FormatAstc6x6UnormBlock,
|
||||
FormatAstc6x6SrgbBlock,
|
||||
FormatAstc8x5UnormBlock,
|
||||
FormatAstc8x5SrgbBlock,
|
||||
FormatAstc8x6UnormBlock,
|
||||
FormatAstc8x6SrgbBlock,
|
||||
FormatAstc8x8UnormBlock,
|
||||
FormatAstc8x8SrgbBlock,
|
||||
FormatAstc10x5UnormBlock,
|
||||
FormatAstc10x5SrgbBlock,
|
||||
FormatAstc10x6UnormBlock,
|
||||
FormatAstc10x6SrgbBlock,
|
||||
FormatAstc10x8UnormBlock,
|
||||
FormatAstc10x8SrgbBlock,
|
||||
FormatAstc10x10UnormBlock,
|
||||
FormatAstc10x10SrgbBlock,
|
||||
FormatAstc12x10UnormBlock,
|
||||
FormatAstc12x10SrgbBlock,
|
||||
FormatAstc12x12UnormBlock,
|
||||
FormatAstc12x12SrgbBlock,
|
||||
}
|
||||
|
||||
pub enum SurfaceTransformFlags {
|
||||
}
|
||||
macro_rules! c_enum {
|
||||
(
|
||||
$name:ident, $base_ty:ty,
|
||||
$($var_name:ident = $var_value: path),+
|
||||
) => {
|
||||
impl $name {
|
||||
pub fn from_number(val: $base_ty) -> Option<$name>{
|
||||
match val {
|
||||
$(
|
||||
$var_value => Some($name::$var_name),
|
||||
)+
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
pub fn to_number(self) -> $base_ty{
|
||||
match self {
|
||||
$(
|
||||
$name::$var_name => $var_value,
|
||||
)+
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum ColorSpace {
|
||||
SrgbNonlinear,
|
||||
}
|
||||
|
||||
c_enum!{
|
||||
ColorSpace, u32,
|
||||
SrgbNonlinear = vk::COLOR_SPACE_SRGB_NONLINEAR_KHR
|
||||
}
|
||||
|
||||
c_enum!{
|
||||
Format, u32,
|
||||
FormatUndefined = vk::FORMAT_UNDEFINED,
|
||||
FormatR4g4UnormPack8 = vk::FORMAT_R4G4_UNORM_PACK8,
|
||||
FormatR4g4b4a4UnormPack16 = vk::FORMAT_R4G4B4A4_UNORM_PACK16,
|
||||
FormatB4g4r4a4UnormPack16 = vk::FORMAT_B4G4R4A4_UNORM_PACK16,
|
||||
FormatR5g6b5UnormPack16 = vk::FORMAT_R5G6B5_UNORM_PACK16,
|
||||
FormatB5g6r5UnormPack16 = vk::FORMAT_B5G6R5_UNORM_PACK16,
|
||||
FormatR5g5b5a1UnormPack16 = vk::FORMAT_R5G5B5A1_UNORM_PACK16,
|
||||
FormatB5g5r5a1UnormPack16 = vk::FORMAT_B5G5R5A1_UNORM_PACK16,
|
||||
FormatA1r5g5b5UnormPack16 = vk::FORMAT_A1R5G5B5_UNORM_PACK16,
|
||||
FormatR8Unorm = vk::FORMAT_R8_UNORM,
|
||||
FormatR8Snorm = vk::FORMAT_R8_SNORM,
|
||||
FormatR8Uscaled = vk::FORMAT_R8_USCALED,
|
||||
FormatR8Sscaled = vk::FORMAT_R8_SSCALED,
|
||||
FormatR8Uint = vk::FORMAT_R8_UINT,
|
||||
FormatR8Sint = vk::FORMAT_R8_SINT,
|
||||
FormatR8Srgb = vk::FORMAT_R8_SRGB,
|
||||
FormatR8G8Unorm = vk::FORMAT_R8G8_UNORM,
|
||||
FormatR8G8Snorm = vk::FORMAT_R8G8_SNORM,
|
||||
FormatR8G8Uscaled = vk::FORMAT_R8G8_USCALED,
|
||||
FormatR8G8Sscaled = vk::FORMAT_R8G8_SSCALED,
|
||||
FormatR8G8Uint = vk::FORMAT_R8G8_UINT,
|
||||
FormatR8G8Sint = vk::FORMAT_R8G8_SINT,
|
||||
FormatR8G8Srgb = vk::FORMAT_R8G8_SRGB,
|
||||
FormatR8G8B8Unorm = vk::FORMAT_R8G8B8_UNORM,
|
||||
FormatR8G8B8Snorm = vk::FORMAT_R8G8B8_SNORM,
|
||||
FormatR8G8B8Uscaled = vk::FORMAT_R8G8B8_USCALED,
|
||||
FormatR8G8B8Sscaled = vk::FORMAT_R8G8B8_SSCALED,
|
||||
FormatR8G8B8Uint = vk::FORMAT_R8G8B8_UINT,
|
||||
FormatR8G8B8Sint = vk::FORMAT_R8G8B8_SINT,
|
||||
FormatR8G8B8Srgb = vk::FORMAT_R8G8B8_SRGB,
|
||||
FormatB8G8r8Unorm = vk::FORMAT_B8G8R8_UNORM,
|
||||
FormatB8G8r8Snorm = vk::FORMAT_B8G8R8_SNORM,
|
||||
FormatB8G8r8Uscaled = vk::FORMAT_B8G8R8_USCALED,
|
||||
FormatB8G8r8Sscaled = vk::FORMAT_B8G8R8_SSCALED,
|
||||
FormatB8G8r8Uint = vk::FORMAT_B8G8R8_UINT,
|
||||
FormatB8G8r8Sint = vk::FORMAT_B8G8R8_SINT,
|
||||
FormatB8G8r8Srgb = vk::FORMAT_B8G8R8_SRGB,
|
||||
FormatR8G8b8a8Unorm = vk::FORMAT_R8G8B8A8_UNORM,
|
||||
FormatR8G8b8a8Snorm = vk::FORMAT_R8G8B8A8_SNORM,
|
||||
FormatR8G8b8a8Uscaled = vk::FORMAT_R8G8B8A8_USCALED,
|
||||
FormatR8G8b8a8Sscaled = vk::FORMAT_R8G8B8A8_SSCALED,
|
||||
FormatR8G8b8a8Uint = vk::FORMAT_R8G8B8A8_UINT,
|
||||
FormatR8G8b8a8Sint = vk::FORMAT_R8G8B8A8_SINT,
|
||||
FormatR8G8b8a8Srgb = vk::FORMAT_R8G8B8A8_SRGB,
|
||||
FormatB8G8r8a8Unorm = vk::FORMAT_B8G8R8A8_UNORM,
|
||||
FormatB8G8r8a8Snorm = vk::FORMAT_B8G8R8A8_SNORM,
|
||||
FormatB8G8r8a8Uscaled = vk::FORMAT_B8G8R8A8_USCALED,
|
||||
FormatB8G8r8a8Sscaled = vk::FORMAT_B8G8R8A8_SSCALED,
|
||||
FormatB8G8r8a8Uint = vk::FORMAT_B8G8R8A8_UINT,
|
||||
FormatB8G8r8a8Sint = vk::FORMAT_B8G8R8A8_SINT,
|
||||
FormatB8G8r8a8Srgb = vk::FORMAT_B8G8R8A8_SRGB,
|
||||
FormatA8b8g8r8UnormPack32 = vk::FORMAT_A8B8G8R8_UNORM_PACK32,
|
||||
FormatA8b8g8r8SnormPack32 = vk::FORMAT_A8B8G8R8_SNORM_PACK32,
|
||||
FormatA8b8g8r8UscaledPack32 = vk::FORMAT_A8B8G8R8_USCALED_PACK32,
|
||||
FormatA8b8g8r8SscaledPack32 = vk::FORMAT_A8B8G8R8_SSCALED_PACK32,
|
||||
FormatA8b8g8r8UintPack32 = vk::FORMAT_A8B8G8R8_UINT_PACK32,
|
||||
FormatA8b8g8r8SintPack32 = vk::FORMAT_A8B8G8R8_SINT_PACK32,
|
||||
FormatA8b8g8r8SrgbPack32 = vk::FORMAT_A8B8G8R8_SRGB_PACK32,
|
||||
FormatA2r10g10b10UnormPack32 = vk::FORMAT_A2R10G10B10_UNORM_PACK32,
|
||||
FormatA2r10g10b10SnormPack32 = vk::FORMAT_A2R10G10B10_SNORM_PACK32,
|
||||
FormatA2r10g10b10UscaledPack32 = vk::FORMAT_A2R10G10B10_USCALED_PACK32,
|
||||
FormatA2r10g10b10SscaledPack32 = vk::FORMAT_A2R10G10B10_SSCALED_PACK32,
|
||||
FormatA2r10g10b10UintPack32 = vk::FORMAT_A2R10G10B10_UINT_PACK32,
|
||||
FormatA2r10g10b10SintPack32 = vk::FORMAT_A2R10G10B10_SINT_PACK32,
|
||||
FormatA2b10g10r10UnormPack32 = vk::FORMAT_A2B10G10R10_UNORM_PACK32,
|
||||
FormatA2b10g10r10SnormPack32 = vk::FORMAT_A2B10G10R10_SNORM_PACK32,
|
||||
FormatA2b10g10r10UscaledPack32 = vk::FORMAT_A2B10G10R10_USCALED_PACK32,
|
||||
FormatA2b10g10r10SscaledPack32 = vk::FORMAT_A2B10G10R10_SSCALED_PACK32,
|
||||
FormatA2b10g10r10UintPack32 = vk::FORMAT_A2B10G10R10_UINT_PACK32,
|
||||
FormatA2b10g10r10SintPack32 = vk::FORMAT_A2B10G10R10_SINT_PACK32,
|
||||
FormatR16Unorm = vk::FORMAT_R16_UNORM,
|
||||
FormatR16Snorm = vk::FORMAT_R16_SNORM,
|
||||
FormatR16Uscaled = vk::FORMAT_R16_USCALED,
|
||||
FormatR16Sscaled = vk::FORMAT_R16_SSCALED,
|
||||
FormatR16Uint = vk::FORMAT_R16_UINT,
|
||||
FormatR16Sint = vk::FORMAT_R16_SINT,
|
||||
FormatR16Sfloat = vk::FORMAT_R16_SFLOAT,
|
||||
FormatR16g16Unorm = vk::FORMAT_R16G16_UNORM,
|
||||
FormatR16g16Snorm = vk::FORMAT_R16G16_SNORM,
|
||||
FormatR16g16Uscaled = vk::FORMAT_R16G16_USCALED,
|
||||
FormatR16g16Sscaled = vk::FORMAT_R16G16_SSCALED,
|
||||
FormatR16g16Uint = vk::FORMAT_R16G16_UINT,
|
||||
FormatR16g16Sint = vk::FORMAT_R16G16_SINT,
|
||||
FormatR16g16Sfloat = vk::FORMAT_R16G16_SFLOAT,
|
||||
FormatR16g16b16Unorm = vk::FORMAT_R16G16B16_UNORM,
|
||||
FormatR16g16b16Snorm = vk::FORMAT_R16G16B16_SNORM,
|
||||
FormatR16g16b16Uscaled = vk::FORMAT_R16G16B16_USCALED,
|
||||
FormatR16g16b16Sscaled = vk::FORMAT_R16G16B16_SSCALED,
|
||||
FormatR16g16b16Uint = vk::FORMAT_R16G16B16_UINT,
|
||||
FormatR16g16b16Sint = vk::FORMAT_R16G16B16_SINT,
|
||||
FormatR16g16b16Sfloat = vk::FORMAT_R16G16B16_SFLOAT,
|
||||
FormatR16g16b16a16Unorm = vk::FORMAT_R16G16B16A16_UNORM,
|
||||
FormatR16g16b16a16Snorm = vk::FORMAT_R16G16B16A16_SNORM,
|
||||
FormatR16g16b16a16Uscaled = vk::FORMAT_R16G16B16A16_USCALED,
|
||||
FormatR16g16b16a16Sscaled = vk::FORMAT_R16G16B16A16_SSCALED,
|
||||
FormatR16g16b16a16Uint = vk::FORMAT_R16G16B16A16_UINT,
|
||||
FormatR16g16b16a16Sint = vk::FORMAT_R16G16B16A16_SINT,
|
||||
FormatR16g16b16a16Sfloat = vk::FORMAT_R16G16B16A16_SFLOAT,
|
||||
FormatR32Uint = vk::FORMAT_R32_UINT,
|
||||
FormatR32Sint = vk::FORMAT_R32_SINT,
|
||||
FormatR32Sfloat = vk::FORMAT_R32_SFLOAT,
|
||||
FormatR32g32Uint = vk::FORMAT_R32G32_UINT,
|
||||
FormatR32g32Sint = vk::FORMAT_R32G32_SINT,
|
||||
FormatR32g32Sfloat = vk::FORMAT_R32G32_SFLOAT,
|
||||
FormatR32g32b32Uint = vk::FORMAT_R32G32B32_UINT,
|
||||
FormatR32g32b32Sint = vk::FORMAT_R32G32B32_SINT,
|
||||
FormatR32g32b32Sfloat = vk::FORMAT_R32G32B32_SFLOAT,
|
||||
FormatR32g32b32a32Uint = vk::FORMAT_R32G32B32A32_UINT,
|
||||
FormatR32g32b32a32Sint = vk::FORMAT_R32G32B32A32_SINT,
|
||||
FormatR32g32b32a32Sfloat = vk::FORMAT_R32G32B32A32_SFLOAT,
|
||||
FormatR64Uint = vk::FORMAT_R64_UINT,
|
||||
FormatR64Sint = vk::FORMAT_R64_SINT,
|
||||
FormatR64Sfloat = vk::FORMAT_R64_SFLOAT,
|
||||
FormatR64g64Uint = vk::FORMAT_R64G64_UINT,
|
||||
FormatR64g64Sint = vk::FORMAT_R64G64_SINT,
|
||||
FormatR64g64Sfloat = vk::FORMAT_R64G64_SFLOAT,
|
||||
FormatR64g64b64Uint = vk::FORMAT_R64G64B64_UINT,
|
||||
FormatR64g64b64Sint = vk::FORMAT_R64G64B64_SINT,
|
||||
FormatR64g64b64Sfloat = vk::FORMAT_R64G64B64_SFLOAT,
|
||||
FormatR64g64b64a64Uint = vk::FORMAT_R64G64B64A64_UINT,
|
||||
FormatR64g64b64a64Sint = vk::FORMAT_R64G64B64A64_SINT,
|
||||
FormatR64g64b64a64Sfloat = vk::FORMAT_R64G64B64A64_SFLOAT,
|
||||
FormatB10g11r11UfloatPack32 = vk::FORMAT_B10G11R11_UFLOAT_PACK32,
|
||||
FormatE5b9g9r9UfloatPack32 = vk::FORMAT_E5B9G9R9_UFLOAT_PACK32,
|
||||
FormatD16Unorm = vk::FORMAT_D16_UNORM,
|
||||
FormatX8D24UnormPack32 = vk::FORMAT_X8_D24_UNORM_PACK32,
|
||||
FormatD32Sfloat = vk::FORMAT_D32_SFLOAT,
|
||||
FormatS8Uint = vk::FORMAT_S8_UINT,
|
||||
FormatD16UnormS8Uint = vk::FORMAT_D16_UNORM_S8_UINT,
|
||||
FormatD24UnormS8Uint = vk::FORMAT_D24_UNORM_S8_UINT,
|
||||
FormatD32SfloatS8Uint = vk::FORMAT_D32_SFLOAT_S8_UINT,
|
||||
FormatBc1RgbUnormBlock = vk::FORMAT_BC1_RGB_UNORM_BLOCK,
|
||||
FormatBc1RgbSrgbBlock = vk::FORMAT_BC1_RGB_SRGB_BLOCK,
|
||||
FormatBc1RgbaUnormBlock = vk::FORMAT_BC1_RGBA_UNORM_BLOCK,
|
||||
FormatBc1RgbaSrgbBlock = vk::FORMAT_BC1_RGBA_SRGB_BLOCK,
|
||||
FormatBc2UnormBlock = vk::FORMAT_BC2_UNORM_BLOCK,
|
||||
FormatBc2SrgbBlock = vk::FORMAT_BC2_SRGB_BLOCK,
|
||||
FormatBc3UnormBlock = vk::FORMAT_BC3_UNORM_BLOCK,
|
||||
FormatBc3SrgbBlock = vk::FORMAT_BC3_SRGB_BLOCK,
|
||||
FormatBc4UnormBlock = vk::FORMAT_BC4_UNORM_BLOCK,
|
||||
FormatBc4SnormBlock = vk::FORMAT_BC4_SNORM_BLOCK,
|
||||
FormatBc5UnormBlock = vk::FORMAT_BC5_UNORM_BLOCK,
|
||||
FormatBc5SnormBlock = vk::FORMAT_BC5_SNORM_BLOCK,
|
||||
FormatBc6hUfloatBlock = vk::FORMAT_BC6H_UFLOAT_BLOCK,
|
||||
FormatBc6hSfloatBlock = vk::FORMAT_BC6H_SFLOAT_BLOCK,
|
||||
FormatBc7UnormBlock = vk::FORMAT_BC7_UNORM_BLOCK,
|
||||
FormatBc7SrgbBlock = vk::FORMAT_BC7_SRGB_BLOCK,
|
||||
FormatEtc2R8G8B8UnormBlock = vk::FORMAT_ETC2_R8G8B8_UNORM_BLOCK,
|
||||
FormatEtc2R8G8B8SrgbBlock = vk::FORMAT_ETC2_R8G8B8_SRGB_BLOCK,
|
||||
FormatEtc2R8G8B8a1UnormBlock = vk::FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK,
|
||||
FormatEtc2R8G8B8a1SrgbBlock = vk::FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK,
|
||||
FormatEtc2R8G8B8a8UnormBlock = vk::FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK,
|
||||
FormatEtc2R8G8B8a8SrgbBlock = vk::FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK,
|
||||
FormatEacR11UnormBlock = vk::FORMAT_EAC_R11_UNORM_BLOCK,
|
||||
FormatEacR11SnormBlock = vk::FORMAT_EAC_R11_SNORM_BLOCK,
|
||||
FormatEacR11g11UnormBlock = vk::FORMAT_EAC_R11G11_UNORM_BLOCK,
|
||||
FormatEacR11g11SnormBlock = vk::FORMAT_EAC_R11G11_SNORM_BLOCK,
|
||||
FormatAstc4x4UnormBlock = vk::FORMAT_ASTC_4x4_UNORM_BLOCK,
|
||||
FormatAstc4x4SrgbBlock = vk::FORMAT_ASTC_4x4_SRGB_BLOCK,
|
||||
FormatAstc5x4UnormBlock = vk::FORMAT_ASTC_5x4_UNORM_BLOCK,
|
||||
FormatAstc5x4SrgbBlock = vk::FORMAT_ASTC_5x4_SRGB_BLOCK,
|
||||
FormatAstc5x5UnormBlock = vk::FORMAT_ASTC_5x5_UNORM_BLOCK,
|
||||
FormatAstc5x5SrgbBlock = vk::FORMAT_ASTC_5x5_SRGB_BLOCK,
|
||||
FormatAstc6x5UnormBlock = vk::FORMAT_ASTC_6x5_UNORM_BLOCK,
|
||||
FormatAstc6x5SrgbBlock = vk::FORMAT_ASTC_6x5_SRGB_BLOCK,
|
||||
FormatAstc6x6UnormBlock = vk::FORMAT_ASTC_6x6_UNORM_BLOCK,
|
||||
FormatAstc6x6SrgbBlock = vk::FORMAT_ASTC_6x6_SRGB_BLOCK,
|
||||
FormatAstc8x5UnormBlock = vk::FORMAT_ASTC_8x5_UNORM_BLOCK,
|
||||
FormatAstc8x5SrgbBlock = vk::FORMAT_ASTC_8x5_SRGB_BLOCK,
|
||||
FormatAstc8x6UnormBlock = vk::FORMAT_ASTC_8x6_UNORM_BLOCK,
|
||||
FormatAstc8x6SrgbBlock = vk::FORMAT_ASTC_8x6_SRGB_BLOCK,
|
||||
FormatAstc8x8UnormBlock = vk::FORMAT_ASTC_8x8_UNORM_BLOCK,
|
||||
FormatAstc8x8SrgbBlock = vk::FORMAT_ASTC_8x8_SRGB_BLOCK,
|
||||
FormatAstc10x5UnormBlock = vk::FORMAT_ASTC_10x5_UNORM_BLOCK,
|
||||
FormatAstc10x5SrgbBlock = vk::FORMAT_ASTC_10x5_SRGB_BLOCK,
|
||||
FormatAstc10x6UnormBlock = vk::FORMAT_ASTC_10x6_UNORM_BLOCK,
|
||||
FormatAstc10x6SrgbBlock = vk::FORMAT_ASTC_10x6_SRGB_BLOCK,
|
||||
FormatAstc10x8UnormBlock = vk::FORMAT_ASTC_10x8_UNORM_BLOCK,
|
||||
FormatAstc10x8SrgbBlock = vk::FORMAT_ASTC_10x8_SRGB_BLOCK,
|
||||
FormatAstc10x10UnormBlock = vk::FORMAT_ASTC_10x10_UNORM_BLOCK,
|
||||
FormatAstc10x10SrgbBlock = vk::FORMAT_ASTC_10x10_SRGB_BLOCK,
|
||||
FormatAstc12x10UnormBlock = vk::FORMAT_ASTC_12x10_UNORM_BLOCK,
|
||||
FormatAstc12x10SrgbBlock = vk::FORMAT_ASTC_12x10_SRGB_BLOCK,
|
||||
FormatAstc12x12UnormBlock = vk::FORMAT_ASTC_12x12_UNORM_BLOCK,
|
||||
FormatAstc12x12SrgbBlock = vk::FORMAT_ASTC_12x12_SRGB_BLOCK
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum SurfaceTransform {
|
||||
IdentityBit,
|
||||
Rotate90Bit,
|
||||
Rotate180Bit,
|
||||
Rotate270Bit,
|
||||
HorizontalMirrorBit,
|
||||
HorizontalMirrorRotate90Bit,
|
||||
HorizontalMirrorRotate180Bit,
|
||||
HorizontalMirrorRotate270Bit,
|
||||
InheritBit,
|
||||
}
|
||||
|
||||
c_enum!{
|
||||
SurfaceTransform, u32,
|
||||
IdentityBit = vk::SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
|
||||
Rotate90Bit = vk::SURFACE_TRANSFORM_ROTATE_90_BIT_KHR,
|
||||
Rotate180Bit = vk::SURFACE_TRANSFORM_ROTATE_180_BIT_KHR,
|
||||
Rotate270Bit = vk::SURFACE_TRANSFORM_ROTATE_270_BIT_KHR,
|
||||
HorizontalMirrorBit = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR,
|
||||
HorizontalMirrorRotate90Bit = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR,
|
||||
HorizontalMirrorRotate180Bit = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR,
|
||||
HorizontalMirrorRotate270Bit = vk::SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR,
|
||||
InheritBit = vk::SURFACE_TRANSFORM_INHERIT_BIT_KHR
|
||||
}
|
|
@ -239,7 +239,6 @@ fn main() {
|
|||
present_mode: present_mode,
|
||||
clipped: 1,
|
||||
old_swapchain: vk::SwapchainKHR::null(),
|
||||
// FIX ME: What is this?
|
||||
image_array_layers: 1,
|
||||
p_queue_family_indices: ptr::null(),
|
||||
queue_family_index_count: 0,
|
||||
|
|
|
@ -3663,13 +3663,8 @@ macro_rules! vk_functions {
|
|||
let s = $struct_name {
|
||||
$(
|
||||
$name: unsafe {
|
||||
extern "system" fn $name($(_: $param),*) { panic!("function pointer `{}` not loaded", stringify!($name)) }
|
||||
let cname = CString::new($raw_name).unwrap();
|
||||
let val = f(&cname);
|
||||
// if val.is_null() { mem::transmute($name as *const ()) } else { mem::transmute(val) }
|
||||
// if val.is_null(){
|
||||
// return ::std::result::Result::Err($raw_name.to_string());
|
||||
// }
|
||||
mem::transmute(val)
|
||||
},
|
||||
)+
|
||||
|
@ -3680,7 +3675,7 @@ macro_rules! vk_functions {
|
|||
#[inline]
|
||||
pub unsafe fn $name(&self $(, $param_name: $param)*) -> $ret {
|
||||
let fp = self.$name;
|
||||
assert!(!(self.$name as *const c_void).is_null(), "{} not loaded!.", stringify!($raw_name));
|
||||
debug_assert!(!(self.$name as *const c_void).is_null(), "{} not loaded!.", stringify!($raw_name));
|
||||
fp($($param_name),*)
|
||||
}
|
||||
)+
|
||||
|
@ -3711,15 +3706,14 @@ pub mod cmds {
|
|||
#[allow(unused_imports)]
|
||||
use super::libc_reexports::*;
|
||||
vk_functions!{
|
||||
Static,
|
||||
StaticFn,
|
||||
"vkGetInstanceProcAddr", get_instance_proc_addr(
|
||||
instance: Instance,
|
||||
p_name: *const c_char,
|
||||
) -> PFN_vkVoidFunction;
|
||||
|
||||
}
|
||||
|
||||
vk_functions!{
|
||||
vk_functions!{
|
||||
EntryFn,
|
||||
"vkCreateInstance", create_instance(
|
||||
p_create_info: *const InstanceCreateInfo,
|
||||
|
@ -3739,7 +3733,7 @@ pub mod cmds {
|
|||
) -> Result;
|
||||
}
|
||||
|
||||
vk_functions!{
|
||||
vk_functions!{
|
||||
InstanceFn,
|
||||
|
||||
"vkDestroyInstance", destroy_instance(
|
||||
|
@ -4016,7 +4010,7 @@ pub mod cmds {
|
|||
) -> ();
|
||||
}
|
||||
|
||||
vk_functions!{
|
||||
vk_functions!{
|
||||
DeviceFn,
|
||||
"vkDestroyDevice", destroy_device(
|
||||
device: Device,
|
||||
|
|
Loading…
Add table
Reference in a new issue