diff --git a/include/spirv/unified1/spirv.hpp b/include/spirv/unified1/spirv.hpp index fc6b9f7a1..f0db55692 100644 --- a/include/spirv/unified1/spirv.hpp +++ b/include/spirv/unified1/spirv.hpp @@ -4871,6 +4871,7 @@ inline const char* OpToString(Op value) { #endif /* SPV_ENABLE_UTILITY_CODE */ +#ifndef __HLSL_VERSION // Overload bitwise operators for mask bit combining inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } @@ -4929,6 +4930,7 @@ inline RawAccessChainOperandsMask operator|(RawAccessChainOperandsMask a, RawAcc inline RawAccessChainOperandsMask operator&(RawAccessChainOperandsMask a, RawAccessChainOperandsMask b) { return RawAccessChainOperandsMask(unsigned(a) & unsigned(b)); } inline RawAccessChainOperandsMask operator^(RawAccessChainOperandsMask a, RawAccessChainOperandsMask b) { return RawAccessChainOperandsMask(unsigned(a) ^ unsigned(b)); } inline RawAccessChainOperandsMask operator~(RawAccessChainOperandsMask a) { return RawAccessChainOperandsMask(~unsigned(a)); } +#endif } // end namespace spv diff --git a/include/spirv/unified1/spirv.hpp11 b/include/spirv/unified1/spirv.hpp11 index b79fab5f6..8489a6911 100644 --- a/include/spirv/unified1/spirv.hpp11 +++ b/include/spirv/unified1/spirv.hpp11 @@ -4871,6 +4871,7 @@ inline const char* OpToString(Op value) { #endif /* SPV_ENABLE_UTILITY_CODE */ +#ifndef __HLSL_VERSION // Overload bitwise operators for mask bit combining constexpr ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); } @@ -4929,6 +4930,7 @@ constexpr RawAccessChainOperandsMask operator|(RawAccessChainOperandsMask a, Raw constexpr RawAccessChainOperandsMask operator&(RawAccessChainOperandsMask a, RawAccessChainOperandsMask b) { return RawAccessChainOperandsMask(unsigned(a) & unsigned(b)); } constexpr RawAccessChainOperandsMask operator^(RawAccessChainOperandsMask a, RawAccessChainOperandsMask b) { return RawAccessChainOperandsMask(unsigned(a) ^ unsigned(b)); } constexpr RawAccessChainOperandsMask operator~(RawAccessChainOperandsMask a) { return RawAccessChainOperandsMask(~unsigned(a)); } +#endif } // end namespace spv diff --git a/tools/buildHeaders/header.cpp b/tools/buildHeaders/header.cpp index a5570971b..90b62f9fc 100644 --- a/tools/buildHeaders/header.cpp +++ b/tools/buildHeaders/header.cpp @@ -633,6 +633,7 @@ IN THE MATERIALS. void printMaskOperators(std::ostream& out, const std::string& specifiers) const { const Json::Value& enums = spvRoot["spv"]["enum"]; + out << "#ifndef __HLSL_VERSION\n"; out << "// Overload bitwise operators for mask bit combining\n\n"; for (auto opClass = enums.begin(); opClass != enums.end(); ++opClass) { @@ -656,6 +657,7 @@ IN THE MATERIALS. typeName << "(~unsigned(a)); }\n"; } } + out << "#endif\n"; } private: void printPrologue(std::ostream& out) const override {