From 7b9cba7424129bf5a2109c3f9e5abc2057aa2330 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Tue, 21 Apr 2020 11:48:37 +0200 Subject: [PATCH] HLSL: Add parens in unpackUint2x32 for clarity. --- .../frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag | 4 ++-- .../frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag | 4 ++-- spirv_hlsl.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/reference/opt/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag b/reference/opt/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag index 4868646f..c7534f38 100644 --- a/reference/opt/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag +++ b/reference/opt/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag @@ -7,7 +7,7 @@ struct SPIRV_Cross_Output uint64_t SPIRV_Cross_packUint2x32(uint2 value) { - return uint64_t(value.y) << 32 | uint64_t(value.x); + return (uint64_t(value.y) << 32) | uint64_t(value.x); } uint2 SPIRV_Cross_unpackUint2x32(uint64_t value) @@ -15,7 +15,7 @@ uint2 SPIRV_Cross_unpackUint2x32(uint64_t value) uint2 Unpacked; Unpacked.x = uint(value & 0xffffffff); Unpacked.y = uint(value >> 32); - return Unpacked; + return Unpacked; } void frag_main() diff --git a/reference/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag b/reference/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag index 3ed012ca..525a9177 100644 --- a/reference/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag +++ b/reference/shaders-hlsl/asm/frag/pack-and-unpack-uint2.fxconly.nofxc.sm60.asm.frag @@ -7,7 +7,7 @@ struct SPIRV_Cross_Output uint64_t SPIRV_Cross_packUint2x32(uint2 value) { - return uint64_t(value.y) << 32 | uint64_t(value.x); + return (uint64_t(value.y) << 32) | uint64_t(value.x); } uint2 SPIRV_Cross_unpackUint2x32(uint64_t value) @@ -15,7 +15,7 @@ uint2 SPIRV_Cross_unpackUint2x32(uint64_t value) uint2 Unpacked; Unpacked.x = uint(value & 0xffffffff); Unpacked.y = uint(value >> 32); - return Unpacked; + return Unpacked; } void frag_main() diff --git a/spirv_hlsl.cpp b/spirv_hlsl.cpp index 482ef627..74061637 100644 --- a/spirv_hlsl.cpp +++ b/spirv_hlsl.cpp @@ -1507,7 +1507,7 @@ void CompilerHLSL::emit_resources() { statement("uint64_t SPIRV_Cross_packUint2x32(uint2 value)"); begin_scope(); - statement("return uint64_t(value.y) << 32 | uint64_t(value.x);"); + statement("return (uint64_t(value.y) << 32) | uint64_t(value.x);"); end_scope(); statement(""); @@ -1516,7 +1516,7 @@ void CompilerHLSL::emit_resources() statement("uint2 Unpacked;"); statement("Unpacked.x = uint(value & 0xffffffff);"); statement("Unpacked.y = uint(value >> 32);"); - statement("return Unpacked; "); + statement("return Unpacked;"); end_scope(); statement(""); }