Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use clamp to edge on vulkan and enable portability features #164

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions crates/yakui-vulkan/examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,23 @@ impl VulkanTest {
.engine_version(0)
.api_version(vk::make_api_version(0, 1, 3, 0));

let extension_names =
#[allow(unused_mut)]
let mut extension_names =
ash_window::enumerate_required_extensions(window.display_handle().unwrap().as_raw())
.unwrap()
.to_vec();

#[cfg(target_os = "macos")]
extension_names.push(ash::khr::portability_enumeration::NAME.as_ptr());

let create_flags = if cfg!(target_os = "macos") {
vk::InstanceCreateFlags::ENUMERATE_PORTABILITY_KHR
} else {
vk::InstanceCreateFlags::default()
};

let create_info = vk::InstanceCreateInfo::default()
.flags(create_flags)
.application_info(&appinfo)
.enabled_extension_names(&extension_names);

Expand Down Expand Up @@ -337,7 +348,13 @@ impl VulkanTest {
.expect("Couldn't find suitable device.")
};
let queue_family_index = queue_family_index as u32;
let device_extension_names_raw = [ash::khr::swapchain::NAME.as_ptr()];

#[allow(unused_mut)]
let mut device_exts = vec![ash::khr::swapchain::NAME.as_ptr()];

#[cfg(target_os = "macos")]
device_exts.push(ash::khr::portability_subset::NAME.as_ptr());

let priorities = [1.0];

let queue_info = vk::DeviceQueueCreateInfo::default()
Expand All @@ -350,7 +367,7 @@ impl VulkanTest {

let device_create_info = vk::DeviceCreateInfo::default()
.queue_create_infos(std::slice::from_ref(&queue_info))
.enabled_extension_names(&device_extension_names_raw)
.enabled_extension_names(&device_exts)
.push_next(&mut descriptor_indexing_features);

let device = unsafe {
Expand Down
4 changes: 2 additions & 2 deletions crates/yakui-vulkan/src/vulkan_texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl VulkanTexture {
memory: vk::DeviceMemory,
view: vk::ImageView,
) -> Self {
let address_mode = vk::SamplerAddressMode::REPEAT;
let address_mode = vk::SamplerAddressMode::CLAMP_TO_EDGE;
kanerogers marked this conversation as resolved.
Show resolved Hide resolved
let filter = vk::Filter::LINEAR;
let sampler = unsafe {
vulkan_context
Expand Down Expand Up @@ -100,7 +100,7 @@ impl VulkanTexture {
mag_filter,
} = create_info;

let address_mode = vk::SamplerAddressMode::REPEAT;
let address_mode = vk::SamplerAddressMode::CLAMP_TO_EDGE;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be in the previous commit?

let (image, memory) = unsafe { vulkan_context.create_image(resolution, format) };
unsafe {
queue.push(vulkan_context, image, resolution, image_data.as_ref());
Expand Down
Loading