triangle ..

This commit is contained in:
maik klein 2016-12-05 15:38:23 +01:00
parent e806a380df
commit 1bd464ea4c
13 changed files with 363 additions and 555 deletions

View file

@ -183,6 +183,82 @@ impl Device {
} }
} }
pub fn destroy_render_pass(&self, renderpass: vk::RenderPass) {
unsafe {
self.device_fn.destroy_render_pass(self.handle, renderpass, ptr::null());
}
}
pub fn destroy_framebuffer(&self, framebuffer: vk::Framebuffer) {
unsafe {
self.device_fn.destroy_framebuffer(self.handle, framebuffer, ptr::null());
}
}
pub fn destroy_buffer(&self, buffer: vk::Buffer) {
unsafe {
self.device_fn.destroy_buffer(self.handle, buffer, ptr::null());
}
}
pub fn destroy_shader_module(&self, shader: vk::ShaderModule) {
unsafe {
self.device_fn.destroy_shader_module(self.handle, shader, ptr::null());
}
}
pub fn create_buffer(&self, create_info: &vk::BufferCreateInfo) -> VkResult<vk::Buffer> {
unsafe {
let mut buffer = mem::uninitialized();
let err_code = self.device_fn
.create_buffer(self.handle, create_info, ptr::null(), &mut buffer);
match err_code {
vk::Result::Success => Ok(buffer),
_ => Err(err_code),
}
}
}
pub fn map_memory<T>(&self,
memory: vk::DeviceMemory,
offset: vk::DeviceSize,
size: vk::DeviceSize,
flags: vk::MemoryMapFlags)
-> VkResult<&mut [T]> {
unsafe {
let mut data: *mut () = mem::uninitialized();
let err_code = self.device_fn
.map_memory(self.handle, memory, offset, size, flags, &mut data);
let x: *mut T = data as *mut T;
match err_code {
vk::Result::Success => {
Ok(::std::slice::from_raw_parts_mut(x, size as usize / mem::size_of::<T>()))
}
_ => Err(err_code),
}
}
}
pub fn unmap_memory(&self, memory: vk::DeviceMemory) {
unsafe {
self.device_fn.unmap_memory(self.handle, memory);
}
}
pub fn create_framebuffer(&self,
create_info: &vk::FramebufferCreateInfo)
-> VkResult<vk::Framebuffer> {
unsafe {
let mut framebuffer = mem::uninitialized();
let err_code = self.device_fn
.create_framebuffer(self.handle, create_info, ptr::null(), &mut framebuffer);
match err_code {
vk::Result::Success => Ok(framebuffer),
_ => Err(err_code),
}
}
}
pub fn get_device_queue(&self, queue_family_index: u32, queue_index: u32) -> vk::Queue { pub fn get_device_queue(&self, queue_family_index: u32, queue_index: u32) -> vk::Queue {
unsafe { unsafe {
let mut queue = mem::uninitialized(); let mut queue = mem::uninitialized();
@ -197,25 +273,37 @@ impl Device {
src_stage_mask: vk::PipelineStageFlags, src_stage_mask: vk::PipelineStageFlags,
dst_stage_mask: vk::PipelineStageFlags, dst_stage_mask: vk::PipelineStageFlags,
dependency_flags: vk::DependencyFlags, dependency_flags: vk::DependencyFlags,
memory_barrier_count: u32, memory_barriers: &[vk::MemoryBarrier],
p_memory_barriers: *const vk::MemoryBarrier, buffer_memory_barriers: &[vk::BufferMemoryBarrier],
buffer_memory_barrier_count: u32, image_memory_barriers: &[vk::ImageMemoryBarrier]) {
p_buffer_memory_barriers: *const vk::BufferMemoryBarrier,
image_memory_barrier_count: u32,
p_image_memory_barriers: *const vk::ImageMemoryBarrier) {
unsafe { unsafe {
self.device_fn.cmd_pipeline_barrier(command_buffer, self.device_fn.cmd_pipeline_barrier(command_buffer,
src_stage_mask, src_stage_mask,
dst_stage_mask, dst_stage_mask,
dependency_flags, dependency_flags,
memory_barrier_count, memory_barriers.len() as u32,
p_memory_barriers, memory_barriers.as_ptr(),
buffer_memory_barrier_count, buffer_memory_barriers.len() as u32,
p_buffer_memory_barriers, buffer_memory_barriers.as_ptr(),
image_memory_barrier_count, image_memory_barriers.len() as u32,
p_image_memory_barriers); image_memory_barriers.as_ptr());
} }
} }
pub fn create_render_pass(&self,
create_info: &vk::RenderPassCreateInfo)
-> VkResult<vk::RenderPass> {
unsafe {
let mut renderpass = mem::uninitialized();
let err_code = self.device_fn
.create_render_pass(self.handle, create_info, ptr::null(), &mut renderpass);
match err_code {
vk::Result::Success => Ok(renderpass),
_ => Err(err_code),
}
}
}
pub fn begin_command_buffer(&self, pub fn begin_command_buffer(&self,
command_buffer: vk::CommandBuffer, command_buffer: vk::CommandBuffer,
create_info: &vk::CommandBufferBeginInfo) create_info: &vk::CommandBufferBeginInfo)
@ -241,6 +329,24 @@ impl Device {
} }
} }
pub fn wait_for_fences(&self,
fences: &[vk::Fence],
wait_all: bool,
timeout: u64)
-> VkResult<()> {
unsafe {
let err_code = self.device_fn
.wait_for_fences(self.handle,
fences.len() as u32,
fences.as_ptr(),
wait_all as u32,
timeout);
match err_code {
vk::Result::Success => Ok(()),
_ => Err(err_code),
}
}
}
pub fn queue_submit(&self, pub fn queue_submit(&self,
queue: vk::Queue, queue: vk::Queue,
submit_count: u32, submit_count: u32,
@ -355,6 +461,15 @@ impl Device {
} }
} }
pub fn get_buffer_memory_requirements(&self, buffer: vk::Buffer) -> vk::MemoryRequirements {
unsafe {
let mut mem_req = mem::uninitialized();
self.device_fn
.get_buffer_memory_requirements(self.handle, buffer, &mut mem_req);
mem_req
}
}
pub fn allocate_memory(&self, pub fn allocate_memory(&self,
create_info: &vk::MemoryAllocateInfo) create_info: &vk::MemoryAllocateInfo)
-> VkResult<vk::DeviceMemory> { -> VkResult<vk::DeviceMemory> {
@ -369,6 +484,20 @@ impl Device {
} }
} }
pub fn create_shader_module(&self,
create_info: &vk::ShaderModuleCreateInfo)
-> VkResult<vk::ShaderModule> {
unsafe {
let mut shader = mem::uninitialized();
let err_code = self.device_fn
.create_shader_module(self.handle, create_info, ptr::null(), &mut shader);
match err_code {
vk::Result::Success => Ok(shader),
_ => Err(err_code),
}
}
}
pub fn create_fence(&self, create_info: &vk::FenceCreateInfo) -> VkResult<vk::Fence> { pub fn create_fence(&self, create_info: &vk::FenceCreateInfo) -> VkResult<vk::Fence> {
unsafe { unsafe {
let mut fence = mem::uninitialized(); let mut fence = mem::uninitialized();
@ -381,6 +510,20 @@ impl Device {
} }
} }
pub fn bind_buffer_memory(&self,
buffer: vk::Buffer,
device_memory: vk::DeviceMemory,
offset: vk::DeviceSize)
-> VkResult<()> {
unsafe {
let err_code = self.device_fn
.bind_buffer_memory(self.handle, buffer, device_memory, offset);
match err_code {
vk::Result::Success => Ok(()),
_ => Err(err_code),
}
}
}
pub fn bind_image_memory(&self, pub fn bind_image_memory(&self,
image: vk::Image, image: vk::Image,
device_memory: vk::DeviceMemory, device_memory: vk::DeviceMemory,

View file

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View file

@ -1,3 +0,0 @@
<component name="CopyrightManager">
<settings default="" />
</component>

View file

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Cargo &lt;examples&gt;" level="project" />
<orderEntry type="library" name="Rust &lt;examples&gt;" level="project" />
</component>
</module>

View file

@ -1,29 +0,0 @@
<component name="libraryTable">
<library name="Cargo &lt;examples&gt;">
<CLASSES>
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-0.7.0" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/log-0.3.6" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/num-iter-0.1.32" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/num-rational-0.1.32" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.15" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/shared_library-0.1.5" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/glfw-0.9.1" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/nom-1.2.4" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/glfw-sys-3.2.0" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/num-complex-0.1.33" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/num-bigint-0.1.33" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/enum_primitive-0.1.0" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/num-integer-0.1.32" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/semver-0.2.3" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/gcc-0.3.32" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/lazy_static-0.2.1" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.19" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/num-0.1.34" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/num-traits-0.1.34" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.17" />
<root url="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/rand-0.3.14" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View file

@ -1,13 +0,0 @@
<component name="libraryTable">
<library name="Rust &lt;examples&gt;">
<CLASSES>
<root url="file://$USER_HOME$/src/rust/src/libstd" />
<root url="file://$USER_HOME$/src/rust/src/libcore" />
<root url="file://$USER_HOME$/src/rust/src/libcollections" />
<root url="file://$USER_HOME$/src/rust/src/liballoc" />
<root url="file://$USER_HOME$/src/rust/src/librustc_unicode" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_3" default="true" assert-keyword="false" jdk-15="false" />
<component name="RustProjectSettings">
<option name="toolchainHomeDirectory" value="$USER_HOME$/.cargo/bin" />
</component>
</project>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/examples.iml" filepath="$PROJECT_DIR$/.idea/examples.iml" />
</modules>
</component>
</project>

View file

@ -1,427 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="3a672c76-e910-4d20-96de-22a0609c096d" name="Default" comment="" />
<ignored path="examples.iws" />
<ignored path=".idea/workspace.xml" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="examples" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="main.rs" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="37">
<caret line="7" column="22" selection-start-line="7" selection-start-column="22" selection-end-line="7" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="GradleLocalSettings">
<option name="externalProjectsViewState">
<projects_view />
</option>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/main.rs" />
</list>
</option>
</component>
<component name="MavenImportPreferences">
<option name="generalSettings">
<MavenGeneralSettings>
<option name="mavenHome" value="Bundled (Maven 3)" />
</MavenGeneralSettings>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="y" value="-16" />
<option name="width" value="1920" />
<option name="height" value="1096" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes />
</component>
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$USER_HOME$/src/rust/src" />
<property name="SearchEverywhereHistoryKey" value="mai&#9;FILE&#9;file:///home/maik/projects/ashlib/examples/src/main.rs&#10;ma&#9;FILE&#9;file:///home/maik/projects/ashlib/examples/src/main.rs" />
<property name="org.rust.alreadyTriedToolchainAutoDiscovery" value="true" />
<property name="org.rust.alreadyTriedLibraryAutoDiscovery" value="true" />
<property name="settings.editor.selected.configurable" value="reference.settingsdialog.IDE.editor.colors.Font" />
<property name="settings.editor.splitter.proportion" value="0.2" />
</component>
<component name="RunManager">
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
<module name="" />
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
<option name="PROGRAM_PARAMETERS" />
<method />
</configuration>
<configuration default="true" type="AndroidRunConfigurationType" factoryName="Android Application">
<module name="" />
<option name="DEPLOY" value="true" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="PREFERRED_AVD" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="DEBUGGER_TYPE" value="Java" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<Java />
<Profilers>
<option name="GAPID_DISABLE_PCS" value="false" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<method />
</configuration>
<configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests">
<module name="" />
<option name="TESTING_TYPE" value="0" />
<option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
<option name="METHOD_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="PACKAGE_NAME" value="" />
<option name="EXTRA_OPTIONS" value="" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="PREFERRED_AVD" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="DEBUGGER_TYPE" value="Java" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<Java />
<Profilers>
<option name="GAPID_DISABLE_PCS" value="false" />
</Profilers>
<method />
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<module />
<method />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method />
</configuration>
<configuration default="true" type="CargoCommandRunConfiguration" factoryName="Cargo Command" show_console_on_std_err="false" show_console_on_std_out="false">
<option name="additionalArguments" value="" />
<option name="command" value="run" />
<option name="environmentVariables">
<map />
</option>
<option name="printBacktrace" value="false" />
<module name="examples" />
<method />
</configuration>
<configuration default="true" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list />
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<method />
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="true" type="JUnitTestDiscovery" factoryName="JUnit Test Discovery" changeList="All">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="true" type="JarApplication" factoryName="JAR Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<envs />
<method />
</configuration>
<configuration default="true" type="Java Scratch" factoryName="Java Scratch">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="SCRATCH_FILE_ID" value="0" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="" />
<envs />
<method />
</configuration>
<configuration default="true" type="JetRunConfigurationType" factoryName="Kotlin">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="examples" />
<envs />
<method />
</configuration>
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType" factoryName="Kotlin script">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="filePath" />
<option name="vmParameters" />
<option name="alternativeJrePath" />
<option name="programParameters" />
<option name="passParentEnvs" value="true" />
<option name="workingDirectory" />
<option name="isAlternativeJrePathEnabled" value="false" />
<envs />
<method />
</configuration>
<configuration default="true" type="Remote" factoryName="Remote">
<option name="USE_SOCKET_TRANSPORT" value="true" />
<option name="SERVER_MODE" value="false" />
<option name="SHMEM_ADDRESS" value="javadebug" />
<option name="HOST" value="localhost" />
<option name="PORT" value="5005" />
<method />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" value="-ea" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" value="$MODULE_DIR$" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
</configuration>
<configuration default="true" type="TestNGTestDiscovery" factoryName="TestNG Test Discovery" changeList="All">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
</configuration>
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="3a672c76-e910-4d20-96de-22a0609c096d" name="Default" comment="" />
<created>1471360642395</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1471360642395</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="0" y="-16" width="1920" height="1096" extended-state="0" />
<editor active="false" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32969216" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$USER_HOME$/.cargo/registry/src/github.com-1ecc6299db9ec823/glfw-0.9.1/src/lib.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="325">
<caret line="423" column="7" selection-start-line="423" selection-start-column="7" selection-end-line="423" selection-end-column="7" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main.rs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="37">
<caret line="7" column="22" selection-start-line="7" selection-start-column="22" selection-end-line="7" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
</component>
</project>

BIN
examples/frag.spv Normal file

Binary file not shown.

View file

@ -11,6 +11,8 @@ use std::ptr;
use std::ffi::{CStr, CString}; use std::ffi::{CStr, CString};
use std::mem; use std::mem;
use std::path::Path; use std::path::Path;
use std::fs::File;
use std::io::Read;
use std::os::raw::c_void; use std::os::raw::c_void;
macro_rules! printlndb{ macro_rules! printlndb{
($arg: tt) => { ($arg: tt) => {
@ -36,6 +38,13 @@ pub fn find_memorytype_index(memory_req: &vk::MemoryRequirements,
} }
None None
} }
#[derive(Clone, Debug, Copy)]
struct Vertex {
x: f32,
y: f32,
z: f32,
w: f32,
}
fn main() { fn main() {
let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap(); let mut glfw = glfw::init(glfw::FAIL_ON_ERRORS).unwrap();
@ -207,7 +216,7 @@ fn main() {
composite_alpha: vk::COMPOSITE_ALPHA_OPAQUE_BIT_KHR, composite_alpha: vk::COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
present_mode: present_mode, present_mode: present_mode,
clipped: 1, clipped: 1,
old_swapchain: unsafe { mem::transmute(0u64) }, old_swapchain: vk::SwapchainKHR::null(),
// FIX ME: What is this? // FIX ME: What is this?
image_array_layers: 1, image_array_layers: 1,
p_queue_family_indices: ptr::null(), p_queue_family_indices: ptr::null(),
@ -262,7 +271,7 @@ fn main() {
}) })
.collect(); .collect();
let device_memory_properties = instance.get_physical_device_memory_properties(pdevice); let device_memory_properties = instance.get_physical_device_memory_properties(pdevice);
let image_create_info = vk::ImageCreateInfo { let depth_image_create_info = vk::ImageCreateInfo {
s_type: vk::StructureType::ImageCreateInfo, s_type: vk::StructureType::ImageCreateInfo,
p_next: ptr::null(), p_next: ptr::null(),
flags: vk::IMAGE_CREATE_SPARSE_BINDING_BIT, flags: vk::IMAGE_CREATE_SPARSE_BINDING_BIT,
@ -283,7 +292,7 @@ fn main() {
p_queue_family_indices: ptr::null(), p_queue_family_indices: ptr::null(),
initial_layout: vk::ImageLayout::Undefined, initial_layout: vk::ImageLayout::Undefined,
}; };
let depth_image = device.create_image(&image_create_info).unwrap(); let depth_image = device.create_image(&depth_image_create_info).unwrap();
let depth_image_memory_req = device.get_image_memory_requirements(depth_image); let depth_image_memory_req = device.get_image_memory_requirements(depth_image);
let depth_image_memory_index = find_memorytype_index(&depth_image_memory_req, let depth_image_memory_index = find_memorytype_index(&depth_image_memory_req,
&device_memory_properties, &device_memory_properties,
@ -311,7 +320,7 @@ fn main() {
s_type: vk::StructureType::ImageMemoryBarrier, s_type: vk::StructureType::ImageMemoryBarrier,
p_next: ptr::null(), p_next: ptr::null(),
// TODO Is this correct? // TODO Is this correct?
src_access_mask: vk::ACCESS_HOST_WRITE_BIT, src_access_mask: vk::AccessFlags::empty(),
dst_access_mask: vk::ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | dst_access_mask: vk::ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
vk::ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT, vk::ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,
old_layout: vk::ImageLayout::Undefined, old_layout: vk::ImageLayout::Undefined,
@ -331,17 +340,14 @@ fn main() {
vk::PIPELINE_STAGE_TOP_OF_PIPE_BIT, vk::PIPELINE_STAGE_TOP_OF_PIPE_BIT,
vk::PIPELINE_STAGE_TOP_OF_PIPE_BIT, vk::PIPELINE_STAGE_TOP_OF_PIPE_BIT,
vk::DEPENDENCY_BY_REGION_BIT, vk::DEPENDENCY_BY_REGION_BIT,
0, &[],
ptr::null(), &[],
0, &[layout_transition_barrier]);
ptr::null(),
1,
&layout_transition_barrier);
let wait_stage_mask = [vk::PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT]; let wait_stage_mask = [vk::PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT];
let fence_create_info = vk::FenceCreateInfo { let fence_create_info = vk::FenceCreateInfo {
s_type: vk::StructureType::FenceCreateInfo, s_type: vk::StructureType::FenceCreateInfo,
p_next: ptr::null(), p_next: ptr::null(),
flags: vk::FENCE_CREATE_SIGNALED_BIT, flags: vk::FenceCreateFlags::empty(),
}; };
let submit_fence = device.create_fence(&fence_create_info).unwrap(); let submit_fence = device.create_fence(&fence_create_info).unwrap();
let submit_info = vk::SubmitInfo { let submit_info = vk::SubmitInfo {
@ -355,9 +361,193 @@ fn main() {
command_buffer_count: 1, command_buffer_count: 1,
p_command_buffers: &setup_command_buffer, p_command_buffers: &setup_command_buffer,
}; };
device.queue_submit(present_queue, 1, &submit_info, submit_fence);
device.destroy_fence(submit_fence);
device.end_command_buffer(setup_command_buffer).unwrap(); device.end_command_buffer(setup_command_buffer).unwrap();
device.queue_submit(present_queue, 1, &submit_info, submit_fence).unwrap();
device.wait_for_fences(&[submit_fence], true, std::u64::MAX).unwrap();
let depth_image_view_info = vk::ImageViewCreateInfo {
s_type: vk::StructureType::ImageViewCreateInfo,
p_next: ptr::null(),
flags: 0,
view_type: vk::ImageViewType::Type2d,
format: depth_image_create_info.format,
components: vk::ComponentMapping {
r: vk::ComponentSwizzle::Identity,
g: vk::ComponentSwizzle::Identity,
b: vk::ComponentSwizzle::Identity,
a: vk::ComponentSwizzle::Identity,
},
subresource_range: vk::ImageSubresourceRange {
aspect_mask: vk::IMAGE_ASPECT_DEPTH_BIT,
base_mip_level: 0,
level_count: 1,
base_array_layer: 0,
layer_count: 1,
},
image: depth_image,
};
let depth_image_view = device.create_image_view(&depth_image_view_info).unwrap();
let renderpass_attachments = [vk::AttachmentDescription {
format: surface_format.format,
flags: vk::AttachmentDescriptionFlags::empty(),
samples: vk::SAMPLE_COUNT_1_BIT,
load_op: vk::AttachmentLoadOp::Clear,
store_op: vk::AttachmentStoreOp::Store,
stencil_load_op: vk::AttachmentLoadOp::DontCare,
stencil_store_op: vk::AttachmentStoreOp::DontCare,
initial_layout: vk::ImageLayout::ColorAttachmentOptimal,
final_layout: vk::ImageLayout::ColorAttachmentOptimal,
},
vk::AttachmentDescription {
format: depth_image_create_info.format,
flags: vk::AttachmentDescriptionFlags::empty(),
samples: vk::SAMPLE_COUNT_1_BIT,
load_op: vk::AttachmentLoadOp::Clear,
store_op: vk::AttachmentStoreOp::DontCare,
stencil_load_op: vk::AttachmentLoadOp::DontCare,
stencil_store_op: vk::AttachmentStoreOp::DontCare,
initial_layout:
vk::ImageLayout::DepthStencilAttachmentOptimal,
final_layout: vk::ImageLayout::DepthStencilAttachmentOptimal,
}];
let color_attachment_ref = vk::AttachmentReference {
attachment: 0,
layout: vk::ImageLayout::ColorAttachmentOptimal,
};
let depth_attachment_ref = vk::AttachmentReference {
attachment: 1,
layout: vk::ImageLayout::DepthStencilAttachmentOptimal,
};
let subpass = vk::SubpassDescription {
color_attachment_count: 1,
p_color_attachments: &color_attachment_ref,
p_depth_stencil_attachment: &depth_attachment_ref,
// TODO: Why is there no wrapper?
flags: 0,
pipeline_bind_point: vk::PipelineBindPoint::Graphics,
input_attachment_count: 0,
p_input_attachments: ptr::null(),
p_resolve_attachments: ptr::null(),
preserve_attachment_count: 0,
p_preserve_attachments: ptr::null(),
};
let renderpass_create_info = vk::RenderPassCreateInfo {
s_type: vk::StructureType::RenderPassCreateInfo,
flags: 0,
p_next: ptr::null(),
attachment_count: renderpass_attachments.len() as u32,
p_attachments: renderpass_attachments.as_ptr(),
subpass_count: 1,
p_subpasses: &subpass,
dependency_count: 0,
p_dependencies: ptr::null(),
};
let renderpass = device.create_render_pass(&renderpass_create_info).unwrap();
let framebuffers: Vec<vk::Framebuffer> = present_image_views.iter()
.map(|&present_image_view| {
let framebuffer_attachments = [present_image_view, depth_image_view];
let frame_buffer_create_info = vk::FramebufferCreateInfo {
s_type: vk::StructureType::FramebufferCreateInfo,
p_next: ptr::null(),
flags: 0,
render_pass: renderpass,
attachment_count: framebuffer_attachments.len() as u32,
p_attachments: framebuffer_attachments.as_ptr(),
width: surface_resoultion.width,
height: surface_resoultion.height,
layers: 1,
};
device.create_framebuffer(&frame_buffer_create_info).unwrap()
})
.collect();
let vertex_input_buffer_info = vk::BufferCreateInfo {
s_type: vk::StructureType::BufferCreateInfo,
p_next: ptr::null(),
flags: vk::BufferCreateFlags::empty(),
size: 3 * std::mem::size_of::<Vertex>() as u64,
usage: vk::BUFFER_USAGE_VERTEX_BUFFER_BIT,
sharing_mode: vk::SharingMode::Exclusive,
queue_family_index_count: 0,
p_queue_family_indices: ptr::null(),
};
let vertex_input_buffer = device.create_buffer(&vertex_input_buffer_info).unwrap();
let vertex_input_buffer_memory_req = device.get_buffer_memory_requirements(vertex_input_buffer);
let vertex_input_buffer_memory_index =
find_memorytype_index(&vertex_input_buffer_memory_req,
&device_memory_properties,
vk::MEMORY_PROPERTY_HOST_VISIBLE_BIT)
.expect("Unable to find suitable memorytype for the vertex buffer.");
let vertex_buffer_allocate_info = vk::MemoryAllocateInfo {
s_type: vk::StructureType::MemoryAllocateInfo,
p_next: ptr::null(),
allocation_size: vertex_input_buffer_memory_req.size,
memory_type_index: vertex_input_buffer_memory_index,
};
let vertex_input_buffer_memory = device.allocate_memory(&vertex_buffer_allocate_info).unwrap();
let slice = device.map_memory::<Vertex>(vertex_input_buffer_memory,
0,
vertex_input_buffer_info.size,
0)
.unwrap();
let vertices = [Vertex {
x: -1.0,
y: 1.0,
z: 0.0,
w: 1.0,
},
Vertex {
x: 1.0,
y: 1.0,
z: 0.0,
w: 1.0,
},
Vertex {
x: 0.0,
y: -1.0,
z: 0.0,
w: 1.0,
}];
slice.copy_from_slice(&vertices);
printlndb!((slice));
device.unmap_memory(vertex_input_buffer_memory);
device.bind_buffer_memory(vertex_input_buffer, vertex_input_buffer_memory, 0).unwrap();
let vertex_spv_file = File::open(Path::new("vert.spv")).expect("Could not find vert.spv.");
let frag_spv_file = File::open(Path::new("frag.spv")).expect("Could not find frag.spv.");
let vertex_bytes: Vec<u8> = vertex_spv_file.bytes().filter_map(|byte| byte.ok()).collect();
let vertex_shader_info = vk::ShaderModuleCreateInfo {
s_type: vk::StructureType::ShaderModuleCreateInfo,
p_next: ptr::null(),
flags: 0,
code_size: vertex_bytes.len(),
p_code: vertex_bytes.as_ptr() as *const u32,
};
let frag_bytes: Vec<u8> = frag_spv_file.bytes().filter_map(|byte| byte.ok()).collect();
let frag_shader_info = vk::ShaderModuleCreateInfo {
s_type: vk::StructureType::ShaderModuleCreateInfo,
p_next: ptr::null(),
flags: 0,
code_size: frag_bytes.len(),
p_code: frag_bytes.as_ptr() as *const u32,
};
let vertex_shader_module = device.create_shader_module(&vertex_shader_info)
.expect("Vertex shader module error");
let frag_shader_module = device.create_shader_module(&frag_shader_info)
.expect("Fragment shader module error");
device.destroy_shader_module(vertex_shader_module);
device.destroy_shader_module(frag_shader_module);
device.free_memory(vertex_input_buffer_memory);
device.destroy_buffer(vertex_input_buffer);
for framebuffer in framebuffers {
device.destroy_framebuffer(framebuffer);
}
device.destroy_render_pass(renderpass);
device.destroy_image_view(depth_image_view);
device.destroy_fence(submit_fence);
device.free_memory(depth_image_memory); device.free_memory(depth_image_memory);
device.destroy_image(depth_image); device.destroy_image(depth_image);
for image_view in present_image_views { for image_view in present_image_views {

BIN
examples/vert.spv Normal file

Binary file not shown.

View file

@ -14,6 +14,11 @@ macro_rules! handle_nondispatchable {
#[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash)] #[derive(Eq, PartialEq, Ord, PartialOrd, Clone, Copy, Hash)]
pub struct $name (uint64_t); pub struct $name (uint64_t);
impl $name{
pub fn null() -> $name{
$name(0)
}
}
impl fmt::Pointer for $name { impl fmt::Pointer for $name {
fn fmt(&self, f: &mut fmt::Formatter) -> ::std::result::Result<(), fmt::Error> { fn fmt(&self, f: &mut fmt::Formatter) -> ::std::result::Result<(), fmt::Error> {
write!(f, "0x{:x}", self.0) write!(f, "0x{:x}", self.0)