Skip to content

Commit

Permalink
graphics: expose Context's features in public api
Browse files Browse the repository at this point in the history
  • Loading branch information
not-fl3 committed Sep 3, 2023
1 parent 50ef9e5 commit 16541e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
12 changes: 4 additions & 8 deletions src/graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,17 +541,10 @@ impl Default for PassAction {
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct RenderPass(usize);

impl RenderPass {
// pub fn texture(&self, ctx: &mut Gl) -> Texture {
// let render_pass = &mut ctx.passes[self.0];

// render_pass.texture
// }
}

pub const MAX_VERTEX_ATTRIBUTES: usize = 16;
pub const MAX_SHADERSTAGE_IMAGES: usize = 12;

#[derive(Clone, Debug)]
pub struct Features {
pub instancing: bool,
}
Expand Down Expand Up @@ -1044,6 +1037,9 @@ pub struct ContextInfo {
/// miniquad will take a guess based on GL_VERSION_STRING, current platform and implementation details.
/// Would be all false on metal.
pub glsl_support: GlslSupport,
/// List of platform-dependent features that miniquad failed to make cross-platforms
/// and therefore they might be missing.
pub features: Features,
}

pub trait RenderingBackend {
Expand Down
1 change: 1 addition & 0 deletions src/graphics/gl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ impl RenderingBackend for GlContext {
backend: Backend::OpenGl,
gl_version_string,
glsl_support,
features: self.features.clone(),
}
}
fn new_shader(
Expand Down
10 changes: 6 additions & 4 deletions src/graphics/metal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,12 @@ impl MetalContext {

impl RenderingBackend for MetalContext {
fn info(&self) -> ContextInfo {
backend: Backend::Metal,
gl_version_string: Default::default(),
glsl_support: Default::default(),

ContextInfo {
backend: Backend::Metal,
gl_version_string: Default::default(),
glsl_support: Default::default(),
features: Features { instancing: true },
}
}
fn buffer_size(&mut self, buffer: BufferId) -> usize {
let buffer = &self.buffers[buffer.0];
Expand Down

0 comments on commit 16541e1

Please sign in to comment.