diff options
author | James Farrell <jamesfarrell@google.com> | 2023-01-19 20:23:21 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-01-19 20:23:38 +0000 |
commit | 12f5c853ee9e06ba6565006d8d36ee261a140d91 (patch) | |
tree | c8ac54510931ab3549d323a0056bed2dd7d8237f /source/opt/desc_sroa_util.cpp | |
parent | d75f78543eeb24bd8441f2f07f34d273613c64fa (diff) | |
download | spirv-tools-ndk-r27-release.tar.gz |
Revert "Merge commit '0e6fbba7762c0' into update-shaderc"ndk-r27-rc1ndk-r26dndk-r26cndk-r26bndk-r26-rc1ndk-r26-beta1ndk-r26ndk-r27-releasendk-r26-releasemaster-ndk
Revert submission 2388945-update-shaderc
Reason for revert: Breaks NDK build on darwin.
Reverted changes: /q/submissionid:2388945-update-shaderc
Change-Id: I6c9b1918c98bcc3a68bbfabd40d4310e26337c24
Diffstat (limited to 'source/opt/desc_sroa_util.cpp')
-rw-r--r-- | source/opt/desc_sroa_util.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/source/opt/desc_sroa_util.cpp b/source/opt/desc_sroa_util.cpp index dba3de9c..1954e2cc 100644 --- a/source/opt/desc_sroa_util.cpp +++ b/source/opt/desc_sroa_util.cpp @@ -17,11 +17,12 @@ namespace spvtools { namespace opt { namespace { -constexpr uint32_t kOpAccessChainInOperandIndexes = 1; + +const uint32_t kOpAccessChainInOperandIndexes = 1; // Returns the length of array type |type|. uint32_t GetLengthOfArrayType(IRContext* context, Instruction* type) { - assert(type->opcode() == spv::Op::OpTypeArray && "type must be array"); + assert(type->opcode() == SpvOpTypeArray && "type must be array"); uint32_t length_id = type->GetSingleWordInOperand(1); const analysis::Constant* length_const = context->get_constant_mgr()->FindDeclaredConstant(length_id); @@ -34,20 +35,20 @@ uint32_t GetLengthOfArrayType(IRContext* context, Instruction* type) { namespace descsroautil { bool IsDescriptorArray(IRContext* context, Instruction* var) { - if (var->opcode() != spv::Op::OpVariable) { + if (var->opcode() != SpvOpVariable) { return false; } uint32_t ptr_type_id = var->type_id(); Instruction* ptr_type_inst = context->get_def_use_mgr()->GetDef(ptr_type_id); - if (ptr_type_inst->opcode() != spv::Op::OpTypePointer) { + if (ptr_type_inst->opcode() != SpvOpTypePointer) { return false; } uint32_t var_type_id = ptr_type_inst->GetSingleWordInOperand(1); Instruction* var_type_inst = context->get_def_use_mgr()->GetDef(var_type_id); - if (var_type_inst->opcode() != spv::Op::OpTypeArray && - var_type_inst->opcode() != spv::Op::OpTypeStruct) { + if (var_type_inst->opcode() != SpvOpTypeArray && + var_type_inst->opcode() != SpvOpTypeStruct) { return false; } @@ -58,23 +59,23 @@ bool IsDescriptorArray(IRContext* context, Instruction* var) { } if (!context->get_decoration_mgr()->HasDecoration( - var->result_id(), uint32_t(spv::Decoration::DescriptorSet))) { + var->result_id(), SpvDecorationDescriptorSet)) { return false; } - return context->get_decoration_mgr()->HasDecoration( - var->result_id(), uint32_t(spv::Decoration::Binding)); + return context->get_decoration_mgr()->HasDecoration(var->result_id(), + SpvDecorationBinding); } bool IsTypeOfStructuredBuffer(IRContext* context, const Instruction* type) { - if (type->opcode() != spv::Op::OpTypeStruct) { + if (type->opcode() != SpvOpTypeStruct) { return false; } // All buffers have offset decorations for members of their structure types. // This is how we distinguish it from a structure of descriptors. - return context->get_decoration_mgr()->HasDecoration( - type->result_id(), uint32_t(spv::Decoration::Offset)); + return context->get_decoration_mgr()->HasDecoration(type->result_id(), + SpvDecorationOffset); } const analysis::Constant* GetAccessChainIndexAsConst( @@ -98,15 +99,15 @@ uint32_t GetNumberOfElementsForArrayOrStruct(IRContext* context, Instruction* var) { uint32_t ptr_type_id = var->type_id(); Instruction* ptr_type_inst = context->get_def_use_mgr()->GetDef(ptr_type_id); - assert(ptr_type_inst->opcode() == spv::Op::OpTypePointer && + assert(ptr_type_inst->opcode() == SpvOpTypePointer && "Variable should be a pointer to an array or structure."); uint32_t pointee_type_id = ptr_type_inst->GetSingleWordInOperand(1); Instruction* pointee_type_inst = context->get_def_use_mgr()->GetDef(pointee_type_id); - if (pointee_type_inst->opcode() == spv::Op::OpTypeArray) { + if (pointee_type_inst->opcode() == SpvOpTypeArray) { return GetLengthOfArrayType(context, pointee_type_inst); } - assert(pointee_type_inst->opcode() == spv::Op::OpTypeStruct && + assert(pointee_type_inst->opcode() == SpvOpTypeStruct && "Variable should be a pointer to an array or structure."); return pointee_type_inst->NumInOperands(); } |