mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Use BOOL_WIDTH everywhere
This commit is contained in:
committed by
Dzmitry Malyshau
parent
dd823a4b84
commit
2045a4a7be
@@ -5,12 +5,13 @@ pomelo! {
|
||||
%include {
|
||||
use super::super::{error::ErrorKind, token::*, ast::*};
|
||||
use crate::{
|
||||
BOOL_WIDTH,
|
||||
Arena, BinaryOperator, Binding, Block, Constant,
|
||||
ConstantInner, Expression,
|
||||
Function, GlobalVariable, Handle, Interpolation,
|
||||
LocalVariable, ScalarValue, ScalarKind,
|
||||
Statement, StorageAccess, StorageClass, StructMember,
|
||||
SwitchCase, Type, TypeInner, UnaryOperator, FunctionArgument
|
||||
SwitchCase, Type, TypeInner, UnaryOperator, FunctionArgument,
|
||||
};
|
||||
use pp_rs::token::PreprocessorError;
|
||||
}
|
||||
@@ -212,7 +213,7 @@ pomelo! {
|
||||
name: None,
|
||||
specialization: None,
|
||||
inner: ConstantInner::Scalar {
|
||||
width: 1,
|
||||
width: BOOL_WIDTH,
|
||||
value: ScalarValue::Bool(b.1)
|
||||
},
|
||||
});
|
||||
|
||||
@@ -32,3 +32,13 @@ impl Emitter {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
impl super::ConstantInner {
|
||||
fn boolean(value: bool) -> Self {
|
||||
Self::Scalar {
|
||||
width: super::BOOL_WIDTH,
|
||||
value: super::ScalarValue::Bool(value),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2000,7 +2000,7 @@ impl<I: Iterator<Item = u32>> Parser<I> {
|
||||
let id = self.next()?;
|
||||
let inner = crate::TypeInner::Scalar {
|
||||
kind: crate::ScalarKind::Bool,
|
||||
width: 1,
|
||||
width: crate::BOOL_WIDTH,
|
||||
};
|
||||
self.lookup_type.insert(
|
||||
id,
|
||||
@@ -2608,10 +2608,7 @@ impl<I: Iterator<Item = u32>> Parser<I> {
|
||||
handle: module.constants.append(crate::Constant {
|
||||
name: self.future_decor.remove(&id).and_then(|dec| dec.name),
|
||||
specialization: None, //TODO
|
||||
inner: crate::ConstantInner::Scalar {
|
||||
width: 1,
|
||||
value: crate::ScalarValue::Bool(value),
|
||||
},
|
||||
inner: crate::ConstantInner::boolean(value),
|
||||
}),
|
||||
type_id,
|
||||
},
|
||||
|
||||
@@ -907,14 +907,8 @@ impl Parser {
|
||||
) -> Result<Handle<crate::Constant>, Error<'a>> {
|
||||
self.scopes.push(Scope::ConstantExpr);
|
||||
let inner = match first_token_span {
|
||||
(Token::Word("true"), _) => crate::ConstantInner::Scalar {
|
||||
width: 1,
|
||||
value: crate::ScalarValue::Bool(true),
|
||||
},
|
||||
(Token::Word("false"), _) => crate::ConstantInner::Scalar {
|
||||
width: 1,
|
||||
value: crate::ScalarValue::Bool(false),
|
||||
},
|
||||
(Token::Word("true"), _) => crate::ConstantInner::boolean(true),
|
||||
(Token::Word("false"), _) => crate::ConstantInner::boolean(false),
|
||||
(
|
||||
Token::Number {
|
||||
ref value,
|
||||
@@ -1516,7 +1510,7 @@ impl Parser {
|
||||
},
|
||||
"bool" => crate::TypeInner::Scalar {
|
||||
kind: crate::ScalarKind::Bool,
|
||||
width: 1,
|
||||
width: crate::BOOL_WIDTH,
|
||||
},
|
||||
"vec2" => {
|
||||
let (kind, width) = lexer.next_scalar_generic()?;
|
||||
|
||||
@@ -346,7 +346,7 @@ impl crate::GlobalVariable {
|
||||
}),
|
||||
Bi::FrontFacing => Some(Ti::Scalar {
|
||||
kind: Sk::Bool,
|
||||
width: 1,
|
||||
width: crate::BOOL_WIDTH,
|
||||
}),
|
||||
Bi::GlobalInvocationId
|
||||
| Bi::LocalInvocationId
|
||||
|
||||
Reference in New Issue
Block a user