[glsl-new] Add float consts (#119)

This commit is contained in:
Pelle Johnsen 2020-08-05 15:45:42 +02:00 committed by GitHub
parent 747535906f
commit 745ef6a6d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 3 deletions

View File

@ -163,10 +163,28 @@ pomelo! {
} }
} }
// primary_expression ::= UintConstant; // primary_expression ::= UintConstant;
// primary_expression ::= FloatConstant; primary_expression ::= FloatConstant(f) {
let ty = extra.types.fetch_or_append(Type {
name: None,
inner: TypeInner::Scalar {
kind: ScalarKind::Float,
width: 4,
}
});
let ch = extra.constants.fetch_or_append(Constant {
name: None,
specialization: None,
ty,
inner: ConstantInner::Float(f.1 as f64)
});
ExpressionRule {
expression: extra.context.expressions.append(Expression::Constant(ch)),
statements: vec![],
}
}
// primary_expression ::= BoolConstant; // primary_expression ::= BoolConstant;
// primary_expression ::= DoubleConstant; // primary_expression ::= DoubleConstant;
// primary_expression ::= LeftParen expression RightParen; primary_expression ::= LeftParen expression(e) RightParen {e}
postfix_expression ::= primary_expression; postfix_expression ::= primary_expression;
postfix_expression ::= postfix_expression LeftBracket integer_expression RightBracket { postfix_expression ::= postfix_expression LeftBracket integer_expression RightBracket {

View File

@ -1,5 +1,5 @@
#version 450 core #version 450 core
void main() { void main() {
gl_Position = vec4(1); gl_Position = vec4(1.0);
} }