From 13378ad1ac1360eace1bc529a8c5ffd1fc7f915c Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Fri, 5 Jul 2019 10:25:18 +0200 Subject: [PATCH] Add simple test for extended debug operations. --- .../extended-debug-extinst.invalid.asm.comp | 18 +++++ .../extended-debug-extinst.invalid.asm.comp | 18 +++++ .../extended-debug-extinst.invalid.asm.comp | 67 +++++++++++++++++++ spirv_parser.cpp | 1 + 4 files changed, 104 insertions(+) create mode 100644 reference/opt/shaders/asm/extended-debug-extinst.invalid.asm.comp create mode 100644 reference/shaders/asm/extended-debug-extinst.invalid.asm.comp create mode 100644 shaders/asm/extended-debug-extinst.invalid.asm.comp diff --git a/reference/opt/shaders/asm/extended-debug-extinst.invalid.asm.comp b/reference/opt/shaders/asm/extended-debug-extinst.invalid.asm.comp new file mode 100644 index 00000000..7755593f --- /dev/null +++ b/reference/opt/shaders/asm/extended-debug-extinst.invalid.asm.comp @@ -0,0 +1,18 @@ +#version 430 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _8_9 +{ + float _m0[]; +} _9; + +layout(binding = 1, std430) buffer _8_10 +{ + float _m0[]; +} _10; + +void main() +{ + _10._m0[gl_GlobalInvocationID.x] = -_9._m0[gl_GlobalInvocationID.x]; +} + diff --git a/reference/shaders/asm/extended-debug-extinst.invalid.asm.comp b/reference/shaders/asm/extended-debug-extinst.invalid.asm.comp new file mode 100644 index 00000000..7755593f --- /dev/null +++ b/reference/shaders/asm/extended-debug-extinst.invalid.asm.comp @@ -0,0 +1,18 @@ +#version 430 +layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; + +layout(binding = 0, std430) buffer _8_9 +{ + float _m0[]; +} _9; + +layout(binding = 1, std430) buffer _8_10 +{ + float _m0[]; +} _10; + +void main() +{ + _10._m0[gl_GlobalInvocationID.x] = -_9._m0[gl_GlobalInvocationID.x]; +} + diff --git a/shaders/asm/extended-debug-extinst.invalid.asm.comp b/shaders/asm/extended-debug-extinst.invalid.asm.comp new file mode 100644 index 00000000..5b6a189a --- /dev/null +++ b/shaders/asm/extended-debug-extinst.invalid.asm.comp @@ -0,0 +1,67 @@ +; SPIR-V +; Version: 1.3 +; Generator: Khronos SPIR-V Tools Assembler; 0 +; Bound: 37 +; Schema: 0 + OpCapability Shader + %1 = OpExtInstImport "DebugInfo" + OpMemoryModel Logical GLSL450 + OpEntryPoint GLCompute %2 "main" %3 + OpExecutionMode %2 LocalSize 1 1 1 + %4 = OpString "negateInputs.comp" + %5 = OpString "negateInputs" + %6 = OpString "main" + %7 = OpString "" + OpSource GLSL 430 + OpName %2 "main" + OpName %3 "gl_GlobalInvocationID" + OpDecorate %3 BuiltIn GlobalInvocationId + OpDecorate %8 BufferBlock + OpDecorate %9 DescriptorSet 0 + OpDecorate %9 Binding 0 + OpDecorate %10 DescriptorSet 0 + OpDecorate %10 Binding 1 + OpDecorate %11 ArrayStride 4 + OpMemberDecorate %8 0 Offset 0 + OpLine %4 0 0 + %12 = OpTypeBool + %13 = OpTypeVoid + %14 = OpTypeFunction %13 + %15 = OpTypeInt 32 0 + %16 = OpTypeInt 32 1 + %17 = OpTypeFloat 32 + %18 = OpTypeVector %15 3 + %19 = OpTypeVector %17 3 + %20 = OpTypePointer Input %18 + %21 = OpTypePointer Uniform %16 + %22 = OpTypePointer Uniform %17 + %23 = OpTypeRuntimeArray %16 + %11 = OpTypeRuntimeArray %17 + %8 = OpTypeStruct %11 + %24 = OpTypePointer Uniform %8 + %9 = OpVariable %24 Uniform + %10 = OpVariable %24 Uniform + OpLine %4 0 1 + OpLine %5 1 0 + OpLine %4 1000 100000 + %3 = OpVariable %20 Input + %25 = OpConstant %16 0 + OpNoLine + OpLine %4 1 1 + %26 = OpExtInst %13 %1 DebugInfoNone + %27 = OpExtInst %13 %1 DebugTypeFunction %13 + %28 = OpExtInst %13 %1 DebugFunction %6 %27 %4 1 1 %4 %7 FlagIsDefinition|FlagPrototyped|FlagIsOptimized 1 %26 %26 + %2 = OpFunction %13 None %14 + %29 = OpLabel + %30 = OpExtInst %13 %1 DebugScope %28 + OpLine %4 1 1 + %31 = OpLoad %18 %3 + %32 = OpCompositeExtract %15 %31 0 + %33 = OpAccessChain %22 %9 %25 %32 + %34 = OpLoad %17 %33 + %35 = OpFNegate %17 %34 + %36 = OpAccessChain %22 %10 %25 %32 + OpStore %36 %35 + OpNoLine + OpReturn + OpFunctionEnd diff --git a/spirv_parser.cpp b/spirv_parser.cpp index 84304f6d..a271eadf 100644 --- a/spirv_parser.cpp +++ b/spirv_parser.cpp @@ -1071,6 +1071,7 @@ void Parser::parse(const Instruction &instruction) // OpNoLine might come at global scope. if (current_block) current_block->ops.push_back(instruction); + break; } // Actual opcodes.