mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
tint: Fix MSL generation of '&' and '|' with booleans
The bitwise-and and bitwise-or binary operators on booleans result in an integer. Explicitly cast this back to a boolean. Fixed: tint:1540 Fixed: tint:1541 Change-Id: I395176f291e6080c88b8cff18e14ed6cd1234074 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/90501 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
35f0fcaac0
commit
e6b6777c8e
@@ -0,0 +1,6 @@
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn f() {
|
||||
let a = true;
|
||||
let b = false;
|
||||
let r : bool = a & b;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#version 310 es
|
||||
|
||||
void f() {
|
||||
bool r = bool(uint(true) & uint(false));
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
[numthreads(1, 1, 1)]
|
||||
void f() {
|
||||
const bool r = (true & false);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
kernel void f() {
|
||||
bool const a = true;
|
||||
bool const b = false;
|
||||
bool const r = bool(a & b);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 9
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint GLCompute %f "f"
|
||||
OpExecutionMode %f LocalSize 1 1 1
|
||||
OpName %f "f"
|
||||
%void = OpTypeVoid
|
||||
%1 = OpTypeFunction %void
|
||||
%bool = OpTypeBool
|
||||
%true = OpConstantTrue %bool
|
||||
%false = OpConstantFalse %bool
|
||||
%f = OpFunction %void None %1
|
||||
%4 = OpLabel
|
||||
%8 = OpLogicalAnd %bool %true %false
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -0,0 +1,6 @@
|
||||
@stage(compute) @workgroup_size(1)
|
||||
fn f() {
|
||||
let a = true;
|
||||
let b = false;
|
||||
let r : bool = (a & b);
|
||||
}
|
||||
Reference in New Issue
Block a user