mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-23 15:23:33 +00:00
[glsl-in] Fix mix ordering for boolean selector
The mix builtin is defined with the inverse order for it's arguments compared to the IR when the selector is a boolean vector.
This commit is contained in:
parent
a1395ddb99
commit
2ff7dcb417
@ -730,10 +730,19 @@ impl Program {
|
||||
.resolve_type(ctx, selector, selector_meta)?
|
||||
.scalar_kind()
|
||||
{
|
||||
// When the selector is a boolean vector the result is
|
||||
// calculated per component, for each component of the
|
||||
// selector if it's false the respective component from the
|
||||
// first argument is selected, if it's true the respective
|
||||
// component from the second argument is selected
|
||||
//
|
||||
// Note(jcapucho): yes, it's inverted in comparison with the
|
||||
// IR and SPIR-V and yes I spent a full debugging a shader
|
||||
// because of this weird behavior
|
||||
Some(ScalarKind::Bool) => Expression::Select {
|
||||
condition: selector,
|
||||
accept: arg,
|
||||
reject: arg1,
|
||||
accept: arg1,
|
||||
reject: arg,
|
||||
},
|
||||
_ => Expression::Math {
|
||||
fun: MathFunction::Mix,
|
||||
|
Loading…
Reference in New Issue
Block a user