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

glsl-in: inject samplerCubeArray builtins on use #1736

Merged
merged 1 commit into from
Feb 19, 2022
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
22 changes: 17 additions & 5 deletions src/front/glsl/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,26 @@ pub struct Overload {
pub void: bool,
}

bitflags::bitflags! {
/// Tracks the variations of the builtin already generated, this is needed because some
/// builtins overloads can't be generated unless explicitly used, since they might cause
/// uneeded capabilities to be requested
#[derive(Default)]
pub struct BuiltinVariations: u32 {
/// Request the standard overloads
const STANDARD = 1 << 0;
/// Request overloads that use the double type
const DOUBLE = 1 << 1;
/// Request overloads that use samplerCubeArray(Shadow)
const CUBE_TEXTURES_ARRAY = 1 << 2;
}
}

#[derive(Debug, Default)]
pub struct FunctionDeclaration {
pub overloads: Vec<Overload>,
/// Whether or not this function has the name of a builtin.
pub builtin: bool,
/// If [`builtin`](Self::builtin) is true, this field indicates whether
/// this function already has double overloads added or not. Otherwise, it is unused.
pub double: bool,
/// Tracks the builtin overload variations that were already generated
pub variations: BuiltinVariations,
}

#[derive(Debug)]
Expand Down
Loading