This commit is contained in:
Alan Baker 2019-03-18 15:14:41 -04:00
Родитель da5a780ff9
Коммит 9244e6ff62
3 изменённых файлов: 5 добавлений и 53 удалений

Просмотреть файл

@ -21,8 +21,7 @@ set -e
set -x
BUILD_ROOT=$PWD
SRC=/usr/local/google/home/sarahmashay/Desktop/SPIRV/spirv2
SRC=$PWD/github/SPIRV-Tools
# Get clang-format-5.0.0.
# Once kokoro upgrades the Ubuntu VMs, we can use 'apt-get install clang-format'
@ -31,10 +30,10 @@ tar xf clang-llvm.tar.xz
export PATH=$PWD/clang+llvm-5.0.0-linux-x86_64-ubuntu14.04/bin:$PATH
cd $SRC
# git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers
# git clone --depth=1 https://github.com/google/googletest external/googletest
# git clone --depth=1 https://github.com/google/effcee external/effcee
# git clone --depth=1 https://github.com/google/re2 external/re2
git clone --depth=1 https://github.com/KhronosGroup/SPIRV-Headers external/spirv-headers
git clone --depth=1 https://github.com/google/googletest external/googletest
git clone --depth=1 https://github.com/google/effcee external/effcee
git clone --depth=1 https://github.com/google/re2 external/re2
curl -L http://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format-diff.py -o utils/clang-format-diff.py;
echo $(date): Check formatting...

Просмотреть файл

@ -1181,21 +1181,6 @@ spv_result_t ValidateArrayLength(ValidationState_t& state,
<< state.getIdName(inst->id()) << "' must be an OpTypeRuntimeArray.";
}
const bool uses_variable_pointers =
state.features().variable_pointers ||
state.features().variable_pointers_storage_buffer;
if (!pointer_type ||
((state.addressing_model() == SpvAddressingModelLogical) &&
((!uses_variable_pointers &&
!spvOpcodeReturnsLogicalPointer(pointer->opcode())) ||
(uses_variable_pointers &&
spvOpcodeReturnsLogicalVariablePointer(pointer->opcode()))))) {
return state.diag(SPV_ERROR_INVALID_ID, inst)
<< "A variable pointer with the Logical addressing model cannot"
<< "be an operand to an OpArrayLength instruction";
}
// The array member must the the index of the last element (the run time
// array).
if (inst->GetOperandAs<uint32_t>(3) != num_of_members - 1) {

Просмотреть файл

@ -2129,38 +2129,6 @@ OpFunctionEnd
EXPECT_EQ(SPV_SUCCESS, ValidateInstructions());
}
TEST_F(ValidateIdWithMessage, OpVariablePointerAsOpArrayLengthOperandBad) {
const std::string spirv = R"(
OpCapability Shader
OpCapability Linkage
OpCapability VariablePointersStorageBuffer
OpExtension "SPV_KHR_variable_pointers"
OpMemoryModel Logical GLSL450
OpDecorate %block Block
OpMemberDecorate %block 0 Offset 0
%void = OpTypeVoid
%int = OpTypeInt 32 0
%run_arr = OpTypeRuntimeArray %int
%block = OpTypeStruct %run_arr
%ptr_ssbo_block = OpTypePointer StorageBuffer %block
%null = OpConstantNull %ptr_ssbo_block
%voidfn = OpTypeFunction %void
%func = OpFunction %void None %voidfn
%entry = OpLabel
%length = OpArrayLength %int %null 0
OpReturn
OpFunctionEnd
)";
CompileSuccessfully(spirv);
EXPECT_EQ(SPV_ERROR_INVALID_ID, ValidateInstructions());
EXPECT_THAT(
getDiagnosticString(),
HasSubstr("A variable pointer with the Logical addressing model cannot"
"be an operand to an OpArrayLength instruction"));
}
TEST_F(ValidateIdWithMessage, OpVariablePointerNoVariablePointersBad) {
const std::string spirv = R"(
OpCapability Shader