[glsl-out] Fix select order

This commit is contained in:
João Capucho authored and Dzmitry Malyshau committed 2021-09-08 17:09:51 -04:00
1 parent 7970330de8
commit 7f74226dd2
2 files changed
+5 -3

No files matched your search

+4 -2
View File
@@ -2160,11 +2160,13 @@ impl<'a, W: Write> Writer<'a, W> {
// TODO: Boolean mix on desktop required GL_EXT_shader_integer_mix
if vec_select {
// Glsl defines that for mix when the condition is a boolean the first element
// is picked if condition is false and the second if condition is true
write!(self.out, "mix(")?;
self.write_expr(accept, ctx)?;
write!(self.out, ", ")?;
self.write_expr(reject, ctx)?;
write!(self.out, ", ")?;
self.write_expr(accept, ctx)?;
write!(self.out, ", ")?;
self.write_expr(condition, ctx)?;
} else {
write!(self.out, "(")?;
+1 -1
View File
@@ -14,7 +14,7 @@ struct Foo {
vec4 builtins() {
int s1_ = (true ? 1 : 0);
vec4 s2_ = (true ? vec4(1.0, 1.0, 1.0, 1.0) : vec4(0.0, 0.0, 0.0, 0.0));
vec4 s3_ = mix(vec4(0.0, 0.0, 0.0, 0.0), vec4(1.0, 1.0, 1.0, 1.0), bvec4(false, false, false, false));
vec4 s3_ = mix(vec4(1.0, 1.0, 1.0, 1.0), vec4(0.0, 0.0, 0.0, 0.0), bvec4(false, false, false, false));
vec4 m1_ = mix(vec4(0.0, 0.0, 0.0, 0.0), vec4(1.0, 1.0, 1.0, 1.0), vec4(0.5, 0.5, 0.5, 0.5));
vec4 m2_ = mix(vec4(0.0, 0.0, 0.0, 0.0), vec4(1.0, 1.0, 1.0, 1.0), 0.1);
return (((vec4(ivec4(s1_)) + s2_) + m1_) + m2_);