Relax validation rule for DebugGlobalVariable variable (#6382)

Allow DebugGlobalVariable variable to be OpConstantXXX variants instead
of only OpConstant
diff --git a/source/val/validate_extensions.cpp b/source/val/validate_extensions.cpp
index b26d817..45a721c 100644
--- a/source/val/validate_extensions.cpp
+++ b/source/val/validate_extensions.cpp
@@ -13,6 +13,7 @@
 // limitations under the License.
 
 // Validates correctness of extension SPIR-V instructions.
+#include <algorithm>
 #include <cstdlib>
 #include <sstream>
 #include <string>
@@ -3753,12 +3754,26 @@
                 },
                 inst, 12)) {
           auto* operand = _.FindDef(inst->word(12));
-          if (operand->opcode() != spv::Op::OpVariable &&
-              operand->opcode() != spv::Op::OpConstant) {
+          std::initializer_list<spv::Op> allowed_opcodes = {
+              spv::Op::OpVariable,
+              spv::Op::OpConstantTrue,
+              spv::Op::OpConstantFalse,
+              spv::Op::OpConstant,
+              spv::Op::OpConstantComposite,
+              spv::Op::OpConstantSampler,
+              spv::Op::OpConstantNull,
+              spv::Op::OpSpecConstantTrue,
+              spv::Op::OpSpecConstantFalse,
+              spv::Op::OpSpecConstant,
+              spv::Op::OpSpecConstantComposite,
+              spv::Op::OpSpecConstantOp};
+          if (std::find(allowed_opcodes.begin(), allowed_opcodes.end(),
+                        operand->opcode()) == allowed_opcodes.end()) {
             return _.diag(SPV_ERROR_INVALID_DATA, inst)
                    << GetExtInstName(_, inst) << ": "
                    << "expected operand Variable must be a result id of "
-                      "OpVariable or OpConstant or DebugInfoNone";
+                      "OpVariable, OpConstant variant, OpSpecConstant variant "
+                      "or DebugInfoNone";
           }
         }
         if (num_words == 15) {