mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
[glsl-out] Fix select order
This commit is contained in:
1 parent
7970330de8
commit
7f74226dd2
2 files changed
+5
-3
No files matched your search
@@ -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, "(")?;
|
||||
|
||||
@@ -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_);
|
||||
|
||||
Reference in new issue
Block a user