diff --git a/naga/src/proc/mod.rs b/naga/src/proc/mod.rs index ddb42a2c52..6dc677ff23 100644 --- a/naga/src/proc/mod.rs +++ b/naga/src/proc/mod.rs @@ -216,8 +216,8 @@ impl crate::Literal { (value, crate::ScalarKind::Sint, 4) => Some(Self::I32(value as _)), (value, crate::ScalarKind::Uint, 8) => Some(Self::U64(value as _)), (value, crate::ScalarKind::Sint, 8) => Some(Self::I64(value as _)), - (1, crate::ScalarKind::Bool, 4) => Some(Self::Bool(true)), - (0, crate::ScalarKind::Bool, 4) => Some(Self::Bool(false)), + (1, crate::ScalarKind::Bool, crate::BOOL_WIDTH) => Some(Self::Bool(true)), + (0, crate::ScalarKind::Bool, crate::BOOL_WIDTH) => Some(Self::Bool(false)), _ => None, } } diff --git a/naga/tests/out/glsl/constructors.main.Compute.glsl b/naga/tests/out/glsl/constructors.main.Compute.glsl index 4b4b0e71a4..c28401d0b4 100644 --- a/naga/tests/out/glsl/constructors.main.Compute.glsl +++ b/naga/tests/out/glsl/constructors.main.Compute.glsl @@ -31,7 +31,6 @@ void main() { uvec2 cit0_ = uvec2(0u); mat2x2 cit1_ = mat2x2(vec2(0.0), vec2(0.0)); int cit2_[4] = int[4](0, 1, 2, 3); - bool ic0_ = bool(false); uvec2 ic4_ = uvec2(0u, 0u); mat2x3 ic5_ = mat2x3(vec3(0.0, 0.0, 0.0), vec3(0.0, 0.0, 0.0)); } diff --git a/naga/tests/out/hlsl/constructors.hlsl b/naga/tests/out/hlsl/constructors.hlsl index 232494fa21..39f3137605 100644 --- a/naga/tests/out/hlsl/constructors.hlsl +++ b/naga/tests/out/hlsl/constructors.hlsl @@ -49,7 +49,6 @@ void main() uint2 cit0_ = (0u).xx; float2x2 cit1_ = float2x2((0.0).xx, (0.0).xx); int cit2_[4] = Constructarray4_int_(0, 1, 2, 3); - bool ic0_ = bool((bool)0); uint2 ic4_ = uint2(0u, 0u); float2x3 ic5_ = float2x3(float3(0.0, 0.0, 0.0), float3(0.0, 0.0, 0.0)); } diff --git a/naga/tests/out/msl/constructors.msl b/naga/tests/out/msl/constructors.msl index b29e2468b0..6733568a92 100644 --- a/naga/tests/out/msl/constructors.msl +++ b/naga/tests/out/msl/constructors.msl @@ -39,7 +39,6 @@ kernel void main_( metal::uint2 cit0_ = metal::uint2(0u); metal::float2x2 cit1_ = metal::float2x2(metal::float2(0.0), metal::float2(0.0)); type_11 cit2_ = type_11 {0, 1, 2, 3}; - bool ic0_ = static_cast(bool {}); metal::uint2 ic4_ = metal::uint2(0u, 0u); metal::float2x3 ic5_ = metal::float2x3(metal::float3(0.0, 0.0, 0.0), metal::float3(0.0, 0.0, 0.0)); } diff --git a/naga/tests/out/spv/constructors.spvasm b/naga/tests/out/spv/constructors.spvasm index 1a481aa95e..615a31dc1b 100644 --- a/naga/tests/out/spv/constructors.spvasm +++ b/naga/tests/out/spv/constructors.spvasm @@ -67,17 +67,18 @@ OpDecorate %17 ArrayStride 4 %56 = OpConstantComposite %14 %55 %55 %57 = OpConstantComposite %9 %21 %21 %58 = OpConstantComposite %8 %57 %57 -%59 = OpConstantComposite %14 %55 %55 -%60 = OpConstantComposite %7 %21 %21 %21 -%61 = OpConstantComposite %20 %60 %60 -%62 = OpConstantNull %20 -%64 = OpTypePointer Function %6 -%65 = OpConstantNull %6 +%59 = OpConstantFalse %13 +%60 = OpConstantComposite %14 %55 %55 +%61 = OpConstantComposite %7 %21 %21 %21 +%62 = OpConstantComposite %20 %61 %61 +%63 = OpConstantNull %20 +%65 = OpTypePointer Function %6 +%66 = OpConstantNull %6 %44 = OpFunction %2 None %45 %43 = OpLabel -%63 = OpVariable %64 Function %65 -OpBranch %66 -%66 = OpLabel -OpStore %63 %47 +%64 = OpVariable %65 Function %66 +OpBranch %67 +%67 = OpLabel +OpStore %64 %47 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/wgsl/constructors.wgsl b/naga/tests/out/wgsl/constructors.wgsl index a8f62dfecd..0e5eec734a 100644 --- a/naga/tests/out/wgsl/constructors.wgsl +++ b/naga/tests/out/wgsl/constructors.wgsl @@ -26,7 +26,6 @@ fn main() { let cit0_ = vec2(0u); let cit1_ = mat2x2(vec2(0f), vec2(0f)); let cit2_ = array(0i, 1i, 2i, 3i); - let ic0_ = bool(bool()); let ic4_ = vec2(0u, 0u); let ic5_ = mat2x3(vec3(0f, 0f, 0f), vec3(0f, 0f, 0f)); }