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

Updated renderer.rs #68

Closed
wants to merge 2 commits into from
Closed
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
14 changes: 8 additions & 6 deletions src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,26 @@ pub struct Renderer {

impl Renderer {
pub fn new(event_loop: &EventLoop<()>, name: &str, fullscreen: bool, mode: VideoMode) -> Self {
// Why
// Load Vulkan library
let library = VulkanLibrary::new().unwrap();

// Add instance extensions based on needs
// Enable the VK_KHR_portability_enumeration extension
let instance_extensions = InstanceExtensions {
khr_portability_enumeration: true,
..vulkano_win::required_extensions(&library)
};

// Create instance
// Create the Vulkan instance with VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR flag
let instance = Instance::new(
library,
InstanceCreateInfo {
application_version: Version::V1_2,
enabled_extensions: instance_extensions,
enumerate_portability: true,
..Default::default()
},
)
.expect("Failed to create instance");
.expect("Failed to create Vulkan instance");

// Create rendering surface along with window
let window = WindowBuilder::new()
Expand All @@ -81,7 +83,7 @@ impl Renderer {
.with_inner_size(crate::WINDOW_SIZE)
.with_title(name)
.build(event_loop)
.expect("Failed to create vulkan surface & window");
.expect("Failed to create Vulkan surface & window");
let window = Arc::new(window);

let surface = create_surface_from_winit(window.clone(), instance.clone())
Expand All @@ -92,6 +94,7 @@ impl Renderer {
khr_swapchain: true,
..DeviceExtensions::empty()
};

let features = Features {
geometry_shader: true,
..Features::empty()
Expand Down Expand Up @@ -171,7 +174,6 @@ impl Renderer {
window,
}
}

pub fn queue(&self) -> Arc<Queue> {
self.queue.clone()
}
Expand Down
Loading