Skip to content

Commit

Permalink
create a surface as test for Vulkan support
Browse files Browse the repository at this point in the history
  • Loading branch information
samizdatco committed Aug 8, 2022
1 parent 9f35d19 commit 68bef1b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/gpu/vulkan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::os::raw;
use ash::{Entry, Instance, vk};
use ash::vk::Handle;
use skia_safe::gpu::{self, DirectContext, SurfaceOrigin};
use skia_safe::{ImageInfo, Budgeted, Surface};
use skia_safe::{ImageInfo, ISize, Budgeted, Surface, ColorSpace};

use std::sync::{Arc, Mutex};
use skulpin::{CoordinateSystem, Renderer, RendererBuilder};
Expand Down Expand Up @@ -39,7 +39,9 @@ impl VulkanEngine {

pub fn supported() -> bool {
Self::init();
VK_CONTEXT.with(|cell| cell.borrow().is_some() )
VK_CONTEXT.with(|cell| cell.borrow().is_some()) && Self::surface(
&ImageInfo::new_n32_premul(ISize::new(100, 100), Some(ColorSpace::new_srgb()))
).is_some()
}

fn new() -> Result<Self, String> {
Expand Down

0 comments on commit 68bef1b

Please sign in to comment.