diff --git a/Test/baseResults/spv.debuginfo.bufferref.glsl.frag.out b/Test/baseResults/spv.debuginfo.bufferref.glsl.frag.out index 0ad36a8d..f4628811 100644 --- a/Test/baseResults/spv.debuginfo.bufferref.glsl.frag.out +++ b/Test/baseResults/spv.debuginfo.bufferref.glsl.frag.out @@ -13,7 +13,7 @@ spv.debuginfo.bufferref.glsl.frag MemoryModel PhysicalStorageBuffer64EXT GLSL450 EntryPoint Fragment 14 "main" 76 131 ExecutionMode 14 OriginUpperLeft - 2: String "" + 2: String "spv.debuginfo.bufferref.glsl.frag" 8: String "uint" 16: String "main" 19: String "// OpModuleProcessed auto-map-locations @@ -23,6 +23,34 @@ spv.debuginfo.bufferref.glsl.frag // OpModuleProcessed keep-uncalled // OpModuleProcessed entry-point main #line 1 +#version 450 core +#extension GL_EXT_buffer_reference : enable + +layout(buffer_reference, std430) buffer MeshVertexPositions { + float data[]; +}; + +struct Mesh { + MeshVertexPositions positions; +}; + +layout(set = 0, binding = 0) readonly buffer PerPass_meshes { + Mesh data[]; +} perPass_meshes; + +layout(location = 0) out vec4 out_fragColor; + +layout(location = 0) in flat uint tri_idx0; + +void main() { + Mesh meshData = perPass_meshes.data[tri_idx0]; + + vec3 vertex_pos0 = vec3(meshData.positions.data[3 * tri_idx0], + meshData.positions.data[3 * tri_idx0 + 1], + meshData.positions.data[3 * tri_idx0 + 2]); + + out_fragColor = vec4(vertex_pos0, 1.0); +} " 31: String "Mesh" 34: String "float" diff --git a/Test/baseResults/spv.debuginfo.const_params.glsl.comp.out b/Test/baseResults/spv.debuginfo.const_params.glsl.comp.out index 6d0b52fb..5676d1c8 100644 --- a/Test/baseResults/spv.debuginfo.const_params.glsl.comp.out +++ b/Test/baseResults/spv.debuginfo.const_params.glsl.comp.out @@ -10,7 +10,7 @@ spv.debuginfo.const_params.glsl.comp MemoryModel Logical GLSL450 EntryPoint GLCompute 14 "main" ExecutionMode 14 LocalSize 1 1 1 - 2: String "" + 2: String "spv.debuginfo.const_params.glsl.comp" 8: String "uint" 17: String "float" 35: String "function" @@ -21,6 +21,20 @@ spv.debuginfo.const_params.glsl.comp // OpModuleProcessed keep-uncalled // OpModuleProcessed entry-point main #line 1 +#version 450 + +void function( + const float f, + const vec2 f2, + const vec3 f3, + const vec4 f4) +{ +} + +void main() +{ + function(0, vec2(0), vec3(0), vec4(0)); +} " 43: String "f" 49: String "f2" diff --git a/Test/baseResults/spv.debuginfo.glsl.comp.out b/Test/baseResults/spv.debuginfo.glsl.comp.out index b8cb662e..3ad62497 100644 --- a/Test/baseResults/spv.debuginfo.glsl.comp.out +++ b/Test/baseResults/spv.debuginfo.glsl.comp.out @@ -2,7 +2,7 @@ spv.debuginfo.glsl.comp Validation failed // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 974 +// Id's are bound by 975 Capability Shader Extension "SPV_KHR_non_semantic_info" @@ -11,7 +11,7 @@ Validation failed MemoryModel Logical GLSL450 EntryPoint GLCompute 14 "main" 133 ExecutionMode 14 LocalSize 10 10 1 - 2: String "" + 2: String "spv.debuginfo.glsl.comp" 8: String "uint" 17: String "float" 33: String "springForce" @@ -22,6 +22,183 @@ Validation failed // OpModuleProcessed keep-uncalled // OpModuleProcessed entry-point main #line 1 +/* +The MIT License (MIT) + +Copyright (c) 2022 Sascha Willems + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#version 450 + +struct Particle { + vec4 pos; + vec4 vel; + vec4 uv; + vec4 normal; + float pinned; +}; + +layout(std430, binding = 0) buffer ParticleIn { + Particle particleIn[ ]; +}; + +layout(std430, binding = 1) buffer ParticleOut { + Particle particleOut[ ]; +}; + +// todo: use shared memory to speed up calculation + +layout (local_size_x = 10, local_size_y = 10) in; + +layout (binding = 2) uniform UBO +{ + float deltaT; + float particleMass; + float springStiffness; + float damping; + float restDistH; + float restDistV; + float restDistD; + float sphereRadius; + vec4 spherePos; + vec4 gravity; + ivec2 particleCount; +} params; + +layout (push_constant) uniform PushConsts { + uint calculateNormals; +} pushConsts; + +vec3 springForce(vec3 p0, vec3 p1, float restDist) +{ + vec3 dist = p0 - p1; + return normalize(dist) * params.springStiffness * (length(dist) - restDist); +} + +void main() +{ + uvec3 id = gl_GlobalInvocationID; + + uint index = id.y * params.particleCount.x + id.x; + if (index > params.particleCount.x * params.particleCount.y) + return; + + // Pinned? + if (particleIn[index].pinned == 1.0) { + particleOut[index].pos = particleOut[index].pos; + particleOut[index].vel = vec4(0.0); + return; + } + + // Initial force from gravity + vec3 force = params.gravity.xyz * params.particleMass; + + vec3 pos = particleIn[index].pos.xyz; + vec3 vel = particleIn[index].vel.xyz; + + // Spring forces from neighboring particles + // left + if (id.x > 0) { + force += springForce(particleIn[index-1].pos.xyz, pos, params.restDistH); + } + // right + if (id.x < params.particleCount.x - 1) { + force += springForce(particleIn[index + 1].pos.xyz, pos, params.restDistH); + } + // upper + if (id.y < params.particleCount.y - 1) { + force += springForce(particleIn[index + params.particleCount.x].pos.xyz, pos, params.restDistV); + } + // lower + if (id.y > 0) { + force += springForce(particleIn[index - params.particleCount.x].pos.xyz, pos, params.restDistV); + } + // upper-left + if ((id.x > 0) && (id.y < params.particleCount.y - 1)) { + force += springForce(particleIn[index + params.particleCount.x - 1].pos.xyz, pos, params.restDistD); + } + // lower-left + if ((id.x > 0) && (id.y > 0)) { + force += springForce(particleIn[index - params.particleCount.x - 1].pos.xyz, pos, params.restDistD); + } + // upper-right + if ((id.x < params.particleCount.x - 1) && (id.y < params.particleCount.y - 1)) { + force += springForce(particleIn[index + params.particleCount.x + 1].pos.xyz, pos, params.restDistD); + } + // lower-right + if ((id.x < params.particleCount.x - 1) && (id.y > 0)) { + force += springForce(particleIn[index - params.particleCount.x + 1].pos.xyz, pos, params.restDistD); + } + + force += (-params.damping * vel); + + // Integrate + vec3 f = force * (1.0 / params.particleMass); + particleOut[index].pos = vec4(pos + vel * params.deltaT + 0.5 * f * params.deltaT * params.deltaT, 1.0); + particleOut[index].vel = vec4(vel + f * params.deltaT, 0.0); + + // Sphere collision + vec3 sphereDist = particleOut[index].pos.xyz - params.spherePos.xyz; + if (length(sphereDist) < params.sphereRadius + 0.01) { + // If the particle is inside the sphere, push it to the outer radius + particleOut[index].pos.xyz = params.spherePos.xyz + normalize(sphereDist) * (params.sphereRadius + 0.01); + // Cancel out velocity + particleOut[index].vel = vec4(0.0); + } + + // Normals + if (pushConsts.calculateNormals == 1) { + vec3 normal = vec3(0.0); + vec3 a, b, c; + if (id.y > 0) { + if (id.x > 0) { + a = particleIn[index - 1].pos.xyz - pos; + b = particleIn[index - params.particleCount.x - 1].pos.xyz - pos; + c = particleIn[index - params.particleCount.x].pos.xyz - pos; + normal += cross(a,b) + cross(b,c); + } + if (id.x < params.particleCount.x - 1) { + a = particleIn[index - params.particleCount.x].pos.xyz - pos; + b = particleIn[index - params.particleCount.x + 1].pos.xyz - pos; + c = particleIn[index + 1].pos.xyz - pos; + normal += cross(a,b) + cross(b,c); + } + } + if (id.y < params.particleCount.y - 1) { + if (id.x > 0) { + a = particleIn[index + params.particleCount.x].pos.xyz - pos; + b = particleIn[index + params.particleCount.x - 1].pos.xyz - pos; + c = particleIn[index - 1].pos.xyz - pos; + normal += cross(a,b) + cross(b,c); + } + if (id.x < params.particleCount.x - 1) { + a = particleIn[index + 1].pos.xyz - pos; + b = particleIn[index + params.particleCount.x + 1].pos.xyz - pos; + c = particleIn[index + params.particleCount.x].pos.xyz - pos; + normal += cross(a,b) + cross(b,c); + } + } + particleOut[index].normal = vec4(normalize(normal), 0.0f); + } +} " 43: String "p0" 49: String "p1" @@ -43,19 +220,20 @@ Validation failed 187: String "Particle" 193: String "particleIn" 197: String "ParticleIn" - 217: String "particleOut" - 220: String "ParticleOut" - 248: String "force" - 262: String "pos" - 272: String "vel" - 576: String "f" - 625: String "sphereDist" - 676: String "calculateNormals" - 679: String "PushConsts" - 686: String "pushConsts" - 720: String "a" - 734: String "b" - 751: String "c" + 202: String "" + 218: String "particleOut" + 221: String "ParticleOut" + 249: String "force" + 263: String "pos" + 273: String "vel" + 577: String "f" + 626: String "sphereDist" + 677: String "calculateNormals" + 680: String "PushConsts" + 687: String "pushConsts" + 721: String "a" + 735: String "b" + 752: String "c" Name 14 "main" Name 31 "springForce(vf3;vf3;f1;" Name 28 "p0" @@ -87,45 +265,45 @@ Validation failed Name 191 "ParticleIn" MemberName 191(ParticleIn) 0 "particleIn" Name 200 "" - Name 215 "ParticleOut" - MemberName 215(ParticleOut) 0 "particleOut" - Name 224 "" - Name 246 "force" - Name 260 "pos" - Name 270 "vel" - Name 292 "param" - Name 296 "param" - Name 298 "param" - Name 321 "param" - Name 325 "param" - Name 327 "param" - Name 354 "param" - Name 358 "param" - Name 360 "param" - Name 382 "param" - Name 386 "param" - Name 388 "param" - Name 425 "param" - Name 429 "param" - Name 431 "param" - Name 463 "param" - Name 467 "param" - Name 469 "param" - Name 509 "param" - Name 513 "param" - Name 515 "param" - Name 551 "param" - Name 555 "param" - Name 557 "param" - Name 574 "f" - Name 623 "sphereDist" - Name 674 "PushConsts" - MemberName 674(PushConsts) 0 "calculateNormals" - Name 684 "pushConsts" - Name 696 "normal" - Name 718 "a" - Name 732 "b" - Name 749 "c" + Name 216 "ParticleOut" + MemberName 216(ParticleOut) 0 "particleOut" + Name 225 "" + Name 247 "force" + Name 261 "pos" + Name 271 "vel" + Name 293 "param" + Name 297 "param" + Name 299 "param" + Name 322 "param" + Name 326 "param" + Name 328 "param" + Name 355 "param" + Name 359 "param" + Name 361 "param" + Name 383 "param" + Name 387 "param" + Name 389 "param" + Name 426 "param" + Name 430 "param" + Name 432 "param" + Name 464 "param" + Name 468 "param" + Name 470 "param" + Name 510 "param" + Name 514 "param" + Name 516 "param" + Name 552 "param" + Name 556 "param" + Name 558 "param" + Name 575 "f" + Name 624 "sphereDist" + Name 675 "PushConsts" + MemberName 675(PushConsts) 0 "calculateNormals" + Name 685 "pushConsts" + Name 697 "normal" + Name 719 "a" + Name 733 "b" + Name 750 "c" MemberDecorate 78(UBO) 0 Offset 0 MemberDecorate 78(UBO) 1 Offset 4 MemberDecorate 78(UBO) 2 Offset 8 @@ -151,14 +329,14 @@ Validation failed Decorate 191(ParticleIn) BufferBlock Decorate 200 DescriptorSet 0 Decorate 200 Binding 0 - Decorate 213 ArrayStride 80 - MemberDecorate 215(ParticleOut) 0 Offset 0 - Decorate 215(ParticleOut) BufferBlock - Decorate 224 DescriptorSet 0 - Decorate 224 Binding 1 - MemberDecorate 674(PushConsts) 0 Offset 0 - Decorate 674(PushConsts) Block - Decorate 973 BuiltIn WorkgroupSize + Decorate 214 ArrayStride 80 + MemberDecorate 216(ParticleOut) 0 Offset 0 + Decorate 216(ParticleOut) BufferBlock + Decorate 225 DescriptorSet 0 + Decorate 225 Binding 1 + MemberDecorate 675(PushConsts) 0 Offset 0 + Decorate 675(PushConsts) Block + Decorate 974 BuiltIn WorkgroupSize 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -265,148 +443,148 @@ Validation failed 198: TypePointer Uniform 191(ParticleIn) 199: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 196 41 12 200: 198(ptr) Variable Uniform - 201: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 2 196 35 188 12 38 2 200 82 - 202: 73(int) Constant 0 - 206: 73(int) Constant 4 - 209: 16(float) Constant 1065353216 - 213: TypeRuntimeArray 177(Particle) - 214: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 186 12 -215(ParticleOut): TypeStruct 213 - 218: 7(int) Constant 40 - 216: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 217 214 35 218 195 12 12 13 - 221: 7(int) Constant 82 - 219: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 220 39 35 221 12 38 220 12 13 216 - 222: TypePointer Uniform 215(ParticleOut) - 223: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 219 41 12 - 224: 222(ptr) Variable Uniform - 225: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 2 219 35 221 12 38 2 224 82 - 230: TypePointer Uniform 71(fvec4) - 231: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 72 41 12 - 237: 7(int) Constant 83 - 238: 73(int) Constant 1 - 239: 16(float) Constant 0 - 240: 71(fvec4) ConstantComposite 239 239 239 239 - 243: 7(int) Constant 84 - 249: 7(int) Constant 88 - 247: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 248 20 35 249 12 55 40 - 253: 73(int) Constant 9 - 263: 7(int) Constant 90 - 261: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 262 20 35 263 12 55 40 - 273: 7(int) Constant 91 - 271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 272 20 35 273 12 55 40 - 282: 7(int) Constant 95 - 290: 7(int) Constant 96 - 307: 7(int) Constant 99 - 319: 7(int) Constant 100 - 336: 7(int) Constant 103 - 348: 7(int) Constant 104 - 353: 73(int) Constant 5 - 369: 7(int) Constant 107 - 377: 7(int) Constant 108 - 397: 7(int) Constant 111 - 418: 7(int) Constant 112 - 424: 73(int) Constant 6 - 440: 7(int) Constant 115 - 457: 7(int) Constant 116 - 478: 7(int) Constant 119 - 503: 7(int) Constant 120 - 524: 7(int) Constant 123 - 545: 7(int) Constant 124 - 563: 73(int) Constant 3 - 567: 7(int) Constant 127 - 577: 7(int) Constant 130 - 575: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 576 20 35 577 12 55 40 - 587: 7(int) Constant 131 - 594: 16(float) Constant 1056964608 - 611: 7(int) Constant 132 - 626: 7(int) Constant 135 - 624: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 625 20 35 626 12 55 40 - 633: 73(int) Constant 8 - 640: 7(int) Constant 136 - 642: 73(int) Constant 7 - 645: 16(float) Constant 1008981770 - 653: 7(int) Constant 138 - 672: 7(int) Constant 140 - 674(PushConsts): TypeStruct 7(int) - 677: 7(int) Constant 63 - 675: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 676 9 35 677 22 12 12 13 - 680: 7(int) Constant 144 - 678: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 679 39 35 680 12 38 679 12 13 675 - 681: TypePointer PushConstant 674(PushConsts) - 682: 7(int) Constant 9 - 683: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 678 682 12 - 684(pushConsts): 681(ptr) Variable PushConstant - 685: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 686 678 35 680 12 38 686 684(pushConsts) 82 - 687: TypePointer PushConstant 7(int) - 688: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 682 12 - 698: 7(int) Constant 145 - 697: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 179 20 35 698 12 55 40 - 702: 19(fvec3) ConstantComposite 239 239 239 - 705: 7(int) Constant 147 - 713: 7(int) Constant 148 - 721: 7(int) Constant 149 - 719: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 720 20 35 721 12 55 40 - 735: 7(int) Constant 150 - 733: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 734 20 35 735 12 55 40 - 752: 7(int) Constant 151 - 750: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 751 20 35 752 12 55 40 - 767: 7(int) Constant 152 - 779: 7(int) Constant 154 - 791: 7(int) Constant 155 - 803: 7(int) Constant 156 - 816: 7(int) Constant 157 - 825: 7(int) Constant 158 - 838: 7(int) Constant 161 - 850: 7(int) Constant 162 - 858: 7(int) Constant 163 - 870: 7(int) Constant 164 - 883: 7(int) Constant 165 - 892: 7(int) Constant 166 - 904: 7(int) Constant 168 - 916: 7(int) Constant 169 - 925: 7(int) Constant 170 - 938: 7(int) Constant 171 - 950: 7(int) Constant 172 - 963: 7(int) Constant 175 - 972: 7(int) Constant 10 - 973: 121(ivec3) ConstantComposite 972 972 39 + 201: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 202 196 35 188 12 38 202 200 82 + 203: 73(int) Constant 0 + 207: 73(int) Constant 4 + 210: 16(float) Constant 1065353216 + 214: TypeRuntimeArray 177(Particle) + 215: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 5(DebugTypeArray) 186 12 +216(ParticleOut): TypeStruct 214 + 219: 7(int) Constant 40 + 217: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 218 215 35 219 195 12 12 13 + 222: 7(int) Constant 82 + 220: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 221 39 35 222 12 38 221 12 13 217 + 223: TypePointer Uniform 216(ParticleOut) + 224: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 220 41 12 + 225: 223(ptr) Variable Uniform + 226: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 202 220 35 222 12 38 202 225 82 + 231: TypePointer Uniform 71(fvec4) + 232: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 72 41 12 + 238: 7(int) Constant 83 + 239: 73(int) Constant 1 + 240: 16(float) Constant 0 + 241: 71(fvec4) ConstantComposite 240 240 240 240 + 244: 7(int) Constant 84 + 250: 7(int) Constant 88 + 248: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 249 20 35 250 12 55 40 + 254: 73(int) Constant 9 + 264: 7(int) Constant 90 + 262: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 263 20 35 264 12 55 40 + 274: 7(int) Constant 91 + 272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 273 20 35 274 12 55 40 + 283: 7(int) Constant 95 + 291: 7(int) Constant 96 + 308: 7(int) Constant 99 + 320: 7(int) Constant 100 + 337: 7(int) Constant 103 + 349: 7(int) Constant 104 + 354: 73(int) Constant 5 + 370: 7(int) Constant 107 + 378: 7(int) Constant 108 + 398: 7(int) Constant 111 + 419: 7(int) Constant 112 + 425: 73(int) Constant 6 + 441: 7(int) Constant 115 + 458: 7(int) Constant 116 + 479: 7(int) Constant 119 + 504: 7(int) Constant 120 + 525: 7(int) Constant 123 + 546: 7(int) Constant 124 + 564: 73(int) Constant 3 + 568: 7(int) Constant 127 + 578: 7(int) Constant 130 + 576: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 577 20 35 578 12 55 40 + 588: 7(int) Constant 131 + 595: 16(float) Constant 1056964608 + 612: 7(int) Constant 132 + 627: 7(int) Constant 135 + 625: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 626 20 35 627 12 55 40 + 634: 73(int) Constant 8 + 641: 7(int) Constant 136 + 643: 73(int) Constant 7 + 646: 16(float) Constant 1008981770 + 654: 7(int) Constant 138 + 673: 7(int) Constant 140 + 675(PushConsts): TypeStruct 7(int) + 678: 7(int) Constant 63 + 676: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 11(DebugTypeMember) 677 9 35 678 22 12 12 13 + 681: 7(int) Constant 144 + 679: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 10(DebugTypeComposite) 680 39 35 681 12 38 680 12 13 676 + 682: TypePointer PushConstant 675(PushConsts) + 683: 7(int) Constant 9 + 684: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 679 683 12 + 685(pushConsts): 682(ptr) Variable PushConstant + 686: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 687 679 35 681 12 38 687 685(pushConsts) 82 + 688: TypePointer PushConstant 7(int) + 689: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 9 683 12 + 699: 7(int) Constant 145 + 698: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 179 20 35 699 12 55 40 + 703: 19(fvec3) ConstantComposite 240 240 240 + 706: 7(int) Constant 147 + 714: 7(int) Constant 148 + 722: 7(int) Constant 149 + 720: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 721 20 35 722 12 55 40 + 736: 7(int) Constant 150 + 734: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 735 20 35 736 12 55 40 + 753: 7(int) Constant 151 + 751: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 752 20 35 753 12 55 40 + 768: 7(int) Constant 152 + 780: 7(int) Constant 154 + 792: 7(int) Constant 155 + 804: 7(int) Constant 156 + 817: 7(int) Constant 157 + 826: 7(int) Constant 158 + 839: 7(int) Constant 161 + 851: 7(int) Constant 162 + 859: 7(int) Constant 163 + 871: 7(int) Constant 164 + 884: 7(int) Constant 165 + 893: 7(int) Constant 166 + 905: 7(int) Constant 168 + 917: 7(int) Constant 169 + 926: 7(int) Constant 170 + 939: 7(int) Constant 171 + 951: 7(int) Constant 172 + 964: 7(int) Constant 175 + 973: 7(int) Constant 10 + 974: 121(ivec3) ConstantComposite 973 973 39 14(main): 4 Function None 5 15: Label 125(id): 123(ptr) Variable Function 139(index): 137(ptr) Variable Function - 246(force): 21(ptr) Variable Function - 260(pos): 21(ptr) Variable Function - 270(vel): 21(ptr) Variable Function - 292(param): 21(ptr) Variable Function - 296(param): 21(ptr) Variable Function - 298(param): 24(ptr) Variable Function - 321(param): 21(ptr) Variable Function - 325(param): 21(ptr) Variable Function - 327(param): 24(ptr) Variable Function - 354(param): 21(ptr) Variable Function - 358(param): 21(ptr) Variable Function - 360(param): 24(ptr) Variable Function - 382(param): 21(ptr) Variable Function - 386(param): 21(ptr) Variable Function - 388(param): 24(ptr) Variable Function - 425(param): 21(ptr) Variable Function - 429(param): 21(ptr) Variable Function - 431(param): 24(ptr) Variable Function - 463(param): 21(ptr) Variable Function - 467(param): 21(ptr) Variable Function - 469(param): 24(ptr) Variable Function - 509(param): 21(ptr) Variable Function - 513(param): 21(ptr) Variable Function - 515(param): 24(ptr) Variable Function - 551(param): 21(ptr) Variable Function - 555(param): 21(ptr) Variable Function - 557(param): 24(ptr) Variable Function - 574(f): 21(ptr) Variable Function - 623(sphereDist): 21(ptr) Variable Function - 696(normal): 21(ptr) Variable Function - 718(a): 21(ptr) Variable Function - 732(b): 21(ptr) Variable Function - 749(c): 21(ptr) Variable Function + 247(force): 21(ptr) Variable Function + 261(pos): 21(ptr) Variable Function + 271(vel): 21(ptr) Variable Function + 293(param): 21(ptr) Variable Function + 297(param): 21(ptr) Variable Function + 299(param): 24(ptr) Variable Function + 322(param): 21(ptr) Variable Function + 326(param): 21(ptr) Variable Function + 328(param): 24(ptr) Variable Function + 355(param): 21(ptr) Variable Function + 359(param): 21(ptr) Variable Function + 361(param): 24(ptr) Variable Function + 383(param): 21(ptr) Variable Function + 387(param): 21(ptr) Variable Function + 389(param): 24(ptr) Variable Function + 426(param): 21(ptr) Variable Function + 430(param): 21(ptr) Variable Function + 432(param): 24(ptr) Variable Function + 464(param): 21(ptr) Variable Function + 468(param): 21(ptr) Variable Function + 470(param): 24(ptr) Variable Function + 510(param): 21(ptr) Variable Function + 514(param): 21(ptr) Variable Function + 516(param): 24(ptr) Variable Function + 552(param): 21(ptr) Variable Function + 556(param): 21(ptr) Variable Function + 558(param): 24(ptr) Variable Function + 575(f): 21(ptr) Variable Function + 624(sphereDist): 21(ptr) Variable Function + 697(normal): 21(ptr) Variable Function + 719(a): 21(ptr) Variable Function + 733(b): 21(ptr) Variable Function + 750(c): 21(ptr) Variable Function 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 56 56 12 12 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 55 14(main) @@ -442,753 +620,753 @@ Validation failed 173: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 174 174 12 12 Return 171: Label - 204: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 188 188 12 12 - 203: 7(int) Load 139(index) - 207: 105(ptr) AccessChain 200 202 203 206 - 208: 16(float) Load 207 - 210: 166(bool) FOrdEqual 208 209 - SelectionMerge 212 None - BranchConditional 210 211 212 - 211: Label - 227: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 228: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 221 221 12 12 - 226: 7(int) Load 139(index) - 229: 7(int) Load 139(index) - 232: 230(ptr) AccessChain 224 202 229 202 - 233: 71(fvec4) Load 232 - 234: 230(ptr) AccessChain 224 202 226 202 - Store 234 233 - 236: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 237 237 12 12 - 235: 7(int) Load 139(index) - 241: 230(ptr) AccessChain 224 202 235 238 - Store 241 240 - 242: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 243 243 12 12 + 205: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 206: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 188 188 12 12 + 204: 7(int) Load 139(index) + 208: 105(ptr) AccessChain 200 203 204 207 + 209: 16(float) Load 208 + 211: 166(bool) FOrdEqual 209 210 + SelectionMerge 213 None + BranchConditional 211 212 213 + 212: Label + 228: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 229: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 222 222 12 12 + 227: 7(int) Load 139(index) + 230: 7(int) Load 139(index) + 233: 231(ptr) AccessChain 225 203 230 203 + 234: 71(fvec4) Load 233 + 235: 231(ptr) AccessChain 225 203 227 203 + Store 235 234 + 237: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 238 238 12 12 + 236: 7(int) Load 139(index) + 242: 231(ptr) AccessChain 225 203 236 239 + Store 242 241 + 243: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 244 244 12 12 Return - 212: Label - 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 252: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 249 249 12 12 - 250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 247 246(force) 45 - 254: 230(ptr) AccessChain 101(params) 253 - 255: 71(fvec4) Load 254 - 256: 19(fvec3) VectorShuffle 255 255 0 1 2 - 257: 105(ptr) AccessChain 101(params) 238 - 258: 16(float) Load 257 - 259: 19(fvec3) VectorTimesScalar 256 258 - Store 246(force) 259 - 265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 263 263 12 12 - 264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 261 260(pos) 45 - 266: 7(int) Load 139(index) - 267: 230(ptr) AccessChain 200 202 266 202 - 268: 71(fvec4) Load 267 - 269: 19(fvec3) VectorShuffle 268 268 0 1 2 - Store 260(pos) 269 - 275: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 273 273 12 12 - 274: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 271 270(vel) 45 - 276: 7(int) Load 139(index) - 277: 230(ptr) AccessChain 200 202 276 238 - 278: 71(fvec4) Load 277 - 279: 19(fvec3) VectorShuffle 278 278 0 1 2 - Store 270(vel) 279 - 281: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 282 282 12 12 - 280: 137(ptr) AccessChain 125(id) 12 - 283: 7(int) Load 280 - 284: 166(bool) UGreaterThan 283 12 - SelectionMerge 286 None - BranchConditional 284 285 286 - 285: Label - 288: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 289: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 290 290 12 12 - 287: 7(int) Load 139(index) - 291: 7(int) ISub 287 39 - 293: 230(ptr) AccessChain 200 202 291 202 - 294: 71(fvec4) Load 293 - 295: 19(fvec3) VectorShuffle 294 294 0 1 2 - Store 292(param) 295 - 297: 19(fvec3) Load 260(pos) - Store 296(param) 297 - 299: 105(ptr) AccessChain 101(params) 206 - 300: 16(float) Load 299 - Store 298(param) 300 - 301: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 292(param) 296(param) 298(param) - 302: 19(fvec3) Load 246(force) - 303: 19(fvec3) FAdd 302 301 - Store 246(force) 303 - Branch 286 - 286: Label - 305: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 306: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 307 307 12 12 - 304: 137(ptr) AccessChain 125(id) 12 - 308: 7(int) Load 304 - 309: 148(ptr) AccessChain 101(params) 147 12 - 310: 73(int) Load 309 - 311: 73(int) ISub 310 238 - 312: 7(int) Bitcast 311 - 313: 166(bool) ULessThan 308 312 - SelectionMerge 315 None - BranchConditional 313 314 315 - 314: Label - 317: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 318: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 319 319 12 12 - 316: 7(int) Load 139(index) - 320: 7(int) IAdd 316 39 - 322: 230(ptr) AccessChain 200 202 320 202 - 323: 71(fvec4) Load 322 - 324: 19(fvec3) VectorShuffle 323 323 0 1 2 - Store 321(param) 324 - 326: 19(fvec3) Load 260(pos) - Store 325(param) 326 - 328: 105(ptr) AccessChain 101(params) 206 - 329: 16(float) Load 328 - Store 327(param) 329 - 330: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 321(param) 325(param) 327(param) - 331: 19(fvec3) Load 246(force) - 332: 19(fvec3) FAdd 331 330 - Store 246(force) 332 - Branch 315 - 315: Label - 334: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 335: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 336 336 12 12 - 333: 137(ptr) AccessChain 125(id) 39 - 337: 7(int) Load 333 - 338: 148(ptr) AccessChain 101(params) 147 39 - 339: 73(int) Load 338 - 340: 73(int) ISub 339 238 - 341: 7(int) Bitcast 340 - 342: 166(bool) ULessThan 337 341 - SelectionMerge 344 None - BranchConditional 342 343 344 - 343: Label - 346: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 347: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 348 348 12 12 - 345: 7(int) Load 139(index) - 349: 148(ptr) AccessChain 101(params) 147 12 - 350: 73(int) Load 349 - 351: 7(int) Bitcast 350 - 352: 7(int) IAdd 345 351 - 355: 230(ptr) AccessChain 200 202 352 202 - 356: 71(fvec4) Load 355 - 357: 19(fvec3) VectorShuffle 356 356 0 1 2 - Store 354(param) 357 - 359: 19(fvec3) Load 260(pos) - Store 358(param) 359 - 361: 105(ptr) AccessChain 101(params) 353 - 362: 16(float) Load 361 - Store 360(param) 362 - 363: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 354(param) 358(param) 360(param) - 364: 19(fvec3) Load 246(force) - 365: 19(fvec3) FAdd 364 363 - Store 246(force) 365 - Branch 344 - 344: Label - 367: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 368: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 369 369 12 12 - 366: 137(ptr) AccessChain 125(id) 39 - 370: 7(int) Load 366 - 371: 166(bool) UGreaterThan 370 12 - SelectionMerge 373 None - BranchConditional 371 372 373 - 372: Label - 375: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 376: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 377 377 12 12 - 374: 7(int) Load 139(index) - 378: 148(ptr) AccessChain 101(params) 147 12 - 379: 73(int) Load 378 - 380: 7(int) Bitcast 379 - 381: 7(int) ISub 374 380 - 383: 230(ptr) AccessChain 200 202 381 202 - 384: 71(fvec4) Load 383 - 385: 19(fvec3) VectorShuffle 384 384 0 1 2 - Store 382(param) 385 - 387: 19(fvec3) Load 260(pos) - Store 386(param) 387 - 389: 105(ptr) AccessChain 101(params) 353 - 390: 16(float) Load 389 - Store 388(param) 390 - 391: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 382(param) 386(param) 388(param) - 392: 19(fvec3) Load 246(force) - 393: 19(fvec3) FAdd 392 391 - Store 246(force) 393 - Branch 373 - 373: Label - 395: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 396: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 397 397 12 12 - 394: 137(ptr) AccessChain 125(id) 12 - 398: 7(int) Load 394 - 399: 166(bool) UGreaterThan 398 12 - SelectionMerge 401 None - BranchConditional 399 400 401 - 400: Label - 403: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 404: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 397 397 12 12 - 402: 137(ptr) AccessChain 125(id) 39 - 405: 7(int) Load 402 - 406: 148(ptr) AccessChain 101(params) 147 39 - 407: 73(int) Load 406 - 408: 73(int) ISub 407 238 - 409: 7(int) Bitcast 408 - 410: 166(bool) ULessThan 405 409 - Branch 401 - 401: Label - 412: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 411: 166(bool) Phi 399 373 410 400 - SelectionMerge 414 None - BranchConditional 411 413 414 - 413: Label - 416: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 417: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 418 418 12 12 - 415: 7(int) Load 139(index) - 419: 148(ptr) AccessChain 101(params) 147 12 - 420: 73(int) Load 419 - 421: 7(int) Bitcast 420 - 422: 7(int) IAdd 415 421 - 423: 7(int) ISub 422 39 - 426: 230(ptr) AccessChain 200 202 423 202 - 427: 71(fvec4) Load 426 - 428: 19(fvec3) VectorShuffle 427 427 0 1 2 - Store 425(param) 428 - 430: 19(fvec3) Load 260(pos) - Store 429(param) 430 - 432: 105(ptr) AccessChain 101(params) 424 - 433: 16(float) Load 432 - Store 431(param) 433 - 434: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 425(param) 429(param) 431(param) - 435: 19(fvec3) Load 246(force) - 436: 19(fvec3) FAdd 435 434 - Store 246(force) 436 - Branch 414 - 414: Label - 438: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 439: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 440 440 12 12 - 437: 137(ptr) AccessChain 125(id) 12 - 441: 7(int) Load 437 - 442: 166(bool) UGreaterThan 441 12 - SelectionMerge 444 None - BranchConditional 442 443 444 - 443: Label - 446: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 447: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 440 440 12 12 - 445: 137(ptr) AccessChain 125(id) 39 - 448: 7(int) Load 445 - 449: 166(bool) UGreaterThan 448 12 - Branch 444 - 444: Label - 451: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 450: 166(bool) Phi 442 414 449 443 - SelectionMerge 453 None - BranchConditional 450 452 453 - 452: Label - 455: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 456: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 457 457 12 12 - 454: 7(int) Load 139(index) - 458: 148(ptr) AccessChain 101(params) 147 12 - 459: 73(int) Load 458 - 460: 7(int) Bitcast 459 - 461: 7(int) ISub 454 460 - 462: 7(int) ISub 461 39 - 464: 230(ptr) AccessChain 200 202 462 202 - 465: 71(fvec4) Load 464 - 466: 19(fvec3) VectorShuffle 465 465 0 1 2 - Store 463(param) 466 - 468: 19(fvec3) Load 260(pos) - Store 467(param) 468 - 470: 105(ptr) AccessChain 101(params) 424 - 471: 16(float) Load 470 - Store 469(param) 471 - 472: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 463(param) 467(param) 469(param) - 473: 19(fvec3) Load 246(force) - 474: 19(fvec3) FAdd 473 472 - Store 246(force) 474 - Branch 453 - 453: Label - 476: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 477: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 478 478 12 12 - 475: 137(ptr) AccessChain 125(id) 12 - 479: 7(int) Load 475 - 480: 148(ptr) AccessChain 101(params) 147 12 - 481: 73(int) Load 480 - 482: 73(int) ISub 481 238 - 483: 7(int) Bitcast 482 - 484: 166(bool) ULessThan 479 483 - SelectionMerge 486 None - BranchConditional 484 485 486 - 485: Label - 488: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 489: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 478 478 12 12 - 487: 137(ptr) AccessChain 125(id) 39 - 490: 7(int) Load 487 - 491: 148(ptr) AccessChain 101(params) 147 39 - 492: 73(int) Load 491 - 493: 73(int) ISub 492 238 - 494: 7(int) Bitcast 493 - 495: 166(bool) ULessThan 490 494 - Branch 486 - 486: Label - 497: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 496: 166(bool) Phi 484 453 495 485 - SelectionMerge 499 None - BranchConditional 496 498 499 - 498: Label - 501: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 502: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 503 503 12 12 - 500: 7(int) Load 139(index) - 504: 148(ptr) AccessChain 101(params) 147 12 - 505: 73(int) Load 504 - 506: 7(int) Bitcast 505 - 507: 7(int) IAdd 500 506 - 508: 7(int) IAdd 507 39 - 510: 230(ptr) AccessChain 200 202 508 202 - 511: 71(fvec4) Load 510 - 512: 19(fvec3) VectorShuffle 511 511 0 1 2 - Store 509(param) 512 - 514: 19(fvec3) Load 260(pos) - Store 513(param) 514 - 516: 105(ptr) AccessChain 101(params) 424 - 517: 16(float) Load 516 - Store 515(param) 517 - 518: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 509(param) 513(param) 515(param) - 519: 19(fvec3) Load 246(force) - 520: 19(fvec3) FAdd 519 518 - Store 246(force) 520 - Branch 499 - 499: Label - 522: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 523: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 524 524 12 12 - 521: 137(ptr) AccessChain 125(id) 12 - 525: 7(int) Load 521 - 526: 148(ptr) AccessChain 101(params) 147 12 - 527: 73(int) Load 526 - 528: 73(int) ISub 527 238 - 529: 7(int) Bitcast 528 - 530: 166(bool) ULessThan 525 529 - SelectionMerge 532 None - BranchConditional 530 531 532 - 531: Label - 534: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 535: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 524 524 12 12 - 533: 137(ptr) AccessChain 125(id) 39 - 536: 7(int) Load 533 - 537: 166(bool) UGreaterThan 536 12 - Branch 532 - 532: Label - 539: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 538: 166(bool) Phi 530 499 537 531 - SelectionMerge 541 None - BranchConditional 538 540 541 - 540: Label - 543: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 544: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 545 545 12 12 - 542: 7(int) Load 139(index) - 546: 148(ptr) AccessChain 101(params) 147 12 - 547: 73(int) Load 546 - 548: 7(int) Bitcast 547 - 549: 7(int) ISub 542 548 - 550: 7(int) IAdd 549 39 - 552: 230(ptr) AccessChain 200 202 550 202 - 553: 71(fvec4) Load 552 - 554: 19(fvec3) VectorShuffle 553 553 0 1 2 - Store 551(param) 554 - 556: 19(fvec3) Load 260(pos) - Store 555(param) 556 - 558: 105(ptr) AccessChain 101(params) 424 - 559: 16(float) Load 558 - Store 557(param) 559 - 560: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 551(param) 555(param) 557(param) - 561: 19(fvec3) Load 246(force) - 562: 19(fvec3) FAdd 561 560 - Store 246(force) 562 - Branch 541 - 541: Label - 565: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 566: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 567 567 12 12 - 564: 105(ptr) AccessChain 101(params) 563 - 568: 16(float) Load 564 - 569: 16(float) FNegate 568 - 570: 19(fvec3) Load 270(vel) - 571: 19(fvec3) VectorTimesScalar 570 569 - 572: 19(fvec3) Load 246(force) - 573: 19(fvec3) FAdd 572 571 - Store 246(force) 573 - 579: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 577 577 12 12 - 578: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 575 574(f) 45 - 580: 19(fvec3) Load 246(force) - 581: 105(ptr) AccessChain 101(params) 238 - 582: 16(float) Load 581 - 583: 16(float) FDiv 209 582 - 584: 19(fvec3) VectorTimesScalar 580 583 - Store 574(f) 584 - 586: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 587 587 12 12 - 585: 7(int) Load 139(index) - 588: 19(fvec3) Load 260(pos) - 589: 19(fvec3) Load 270(vel) - 590: 105(ptr) AccessChain 101(params) 202 - 591: 16(float) Load 590 - 592: 19(fvec3) VectorTimesScalar 589 591 - 593: 19(fvec3) FAdd 588 592 - 595: 19(fvec3) Load 574(f) - 596: 19(fvec3) VectorTimesScalar 595 594 - 597: 105(ptr) AccessChain 101(params) 202 - 598: 16(float) Load 597 - 599: 19(fvec3) VectorTimesScalar 596 598 - 600: 105(ptr) AccessChain 101(params) 202 - 601: 16(float) Load 600 - 602: 19(fvec3) VectorTimesScalar 599 601 - 603: 19(fvec3) FAdd 593 602 - 604: 16(float) CompositeExtract 603 0 - 605: 16(float) CompositeExtract 603 1 - 606: 16(float) CompositeExtract 603 2 - 607: 71(fvec4) CompositeConstruct 604 605 606 209 - 608: 230(ptr) AccessChain 224 202 585 202 - Store 608 607 - 610: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 611 611 12 12 - 609: 7(int) Load 139(index) - 612: 19(fvec3) Load 270(vel) - 613: 19(fvec3) Load 574(f) - 614: 105(ptr) AccessChain 101(params) 202 - 615: 16(float) Load 614 - 616: 19(fvec3) VectorTimesScalar 613 615 - 617: 19(fvec3) FAdd 612 616 - 618: 16(float) CompositeExtract 617 0 - 619: 16(float) CompositeExtract 617 1 - 620: 16(float) CompositeExtract 617 2 - 621: 71(fvec4) CompositeConstruct 618 619 620 239 - 622: 230(ptr) AccessChain 224 202 609 238 - Store 622 621 - 628: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 626 626 12 12 - 627: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 624 623(sphereDist) 45 - 629: 7(int) Load 139(index) - 630: 230(ptr) AccessChain 224 202 629 202 - 631: 71(fvec4) Load 630 - 632: 19(fvec3) VectorShuffle 631 631 0 1 2 - 634: 230(ptr) AccessChain 101(params) 633 - 635: 71(fvec4) Load 634 - 636: 19(fvec3) VectorShuffle 635 635 0 1 2 - 637: 19(fvec3) FSub 632 636 - Store 623(sphereDist) 637 - 639: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 640 640 12 12 - 638: 19(fvec3) Load 623(sphereDist) - 641: 16(float) ExtInst 3(GLSL.std.450) 66(Length) 638 - 643: 105(ptr) AccessChain 101(params) 642 - 644: 16(float) Load 643 - 646: 16(float) FAdd 644 645 - 647: 166(bool) FOrdLessThan 641 646 - SelectionMerge 649 None - BranchConditional 647 648 649 - 648: Label - 651: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 652: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 653 653 12 12 - 650: 7(int) Load 139(index) - 654: 230(ptr) AccessChain 101(params) 633 - 655: 71(fvec4) Load 654 - 656: 19(fvec3) VectorShuffle 655 655 0 1 2 - 657: 19(fvec3) Load 623(sphereDist) - 658: 19(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 657 - 659: 105(ptr) AccessChain 101(params) 642 - 660: 16(float) Load 659 - 661: 16(float) FAdd 660 645 - 662: 19(fvec3) VectorTimesScalar 658 661 - 663: 19(fvec3) FAdd 656 662 - 664: 105(ptr) AccessChain 224 202 650 202 12 - 665: 16(float) CompositeExtract 663 0 - Store 664 665 - 666: 105(ptr) AccessChain 224 202 650 202 39 - 667: 16(float) CompositeExtract 663 1 - Store 666 667 - 668: 105(ptr) AccessChain 224 202 650 202 41 - 669: 16(float) CompositeExtract 663 2 - Store 668 669 - 671: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 672 672 12 12 - 670: 7(int) Load 139(index) - 673: 230(ptr) AccessChain 224 202 670 238 - Store 673 240 - Branch 649 - 649: Label - 690: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 691: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 680 680 12 12 - 689: 687(ptr) AccessChain 684(pushConsts) 202 - 692: 7(int) Load 689 - 693: 166(bool) IEqual 692 39 - SelectionMerge 695 None - BranchConditional 693 694 695 - 694: Label - 700: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 701: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 698 698 12 12 - 699: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 697 696(normal) 45 - Store 696(normal) 702 - 704: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 705 705 12 12 - 703: 137(ptr) AccessChain 125(id) 39 - 706: 7(int) Load 703 - 707: 166(bool) UGreaterThan 706 12 - SelectionMerge 709 None - BranchConditional 707 708 709 - 708: Label - 711: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 712: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 713 713 12 12 - 710: 137(ptr) AccessChain 125(id) 12 - 714: 7(int) Load 710 - 715: 166(bool) UGreaterThan 714 12 - SelectionMerge 717 None - BranchConditional 715 716 717 - 716: Label - 723: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 724: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 721 721 12 12 - 722: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 719 718(a) 45 - 725: 7(int) Load 139(index) - 726: 7(int) ISub 725 39 - 727: 230(ptr) AccessChain 200 202 726 202 - 728: 71(fvec4) Load 727 - 729: 19(fvec3) VectorShuffle 728 728 0 1 2 - 730: 19(fvec3) Load 260(pos) - 731: 19(fvec3) FSub 729 730 - Store 718(a) 731 - 737: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 735 735 12 12 - 736: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 733 732(b) 45 - 738: 7(int) Load 139(index) - 739: 148(ptr) AccessChain 101(params) 147 12 - 740: 73(int) Load 739 - 741: 7(int) Bitcast 740 - 742: 7(int) ISub 738 741 - 743: 7(int) ISub 742 39 - 744: 230(ptr) AccessChain 200 202 743 202 - 745: 71(fvec4) Load 744 - 746: 19(fvec3) VectorShuffle 745 745 0 1 2 - 747: 19(fvec3) Load 260(pos) - 748: 19(fvec3) FSub 746 747 - Store 732(b) 748 - 754: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 752 752 12 12 - 753: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 750 749(c) 45 - 755: 7(int) Load 139(index) - 756: 148(ptr) AccessChain 101(params) 147 12 - 757: 73(int) Load 756 - 758: 7(int) Bitcast 757 - 759: 7(int) ISub 755 758 - 760: 230(ptr) AccessChain 200 202 759 202 - 761: 71(fvec4) Load 760 - 762: 19(fvec3) VectorShuffle 761 761 0 1 2 - 763: 19(fvec3) Load 260(pos) - 764: 19(fvec3) FSub 762 763 - Store 749(c) 764 - 766: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 767 767 12 12 - 765: 19(fvec3) Load 718(a) - 768: 19(fvec3) Load 732(b) - 769: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 765 768 - 770: 19(fvec3) Load 732(b) - 771: 19(fvec3) Load 749(c) - 772: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 770 771 - 773: 19(fvec3) FAdd 769 772 - 774: 19(fvec3) Load 696(normal) - 775: 19(fvec3) FAdd 774 773 - Store 696(normal) 775 - Branch 717 - 717: Label - 777: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 778: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 779 779 12 12 - 776: 137(ptr) AccessChain 125(id) 12 - 780: 7(int) Load 776 - 781: 148(ptr) AccessChain 101(params) 147 12 - 782: 73(int) Load 781 - 783: 73(int) ISub 782 238 - 784: 7(int) Bitcast 783 - 785: 166(bool) ULessThan 780 784 - SelectionMerge 787 None - BranchConditional 785 786 787 - 786: Label - 789: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 790: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 791 791 12 12 - 788: 7(int) Load 139(index) - 792: 148(ptr) AccessChain 101(params) 147 12 - 793: 73(int) Load 792 - 794: 7(int) Bitcast 793 - 795: 7(int) ISub 788 794 - 796: 230(ptr) AccessChain 200 202 795 202 - 797: 71(fvec4) Load 796 - 798: 19(fvec3) VectorShuffle 797 797 0 1 2 - 799: 19(fvec3) Load 260(pos) - 800: 19(fvec3) FSub 798 799 - Store 718(a) 800 - 802: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 803 803 12 12 - 801: 7(int) Load 139(index) - 804: 148(ptr) AccessChain 101(params) 147 12 - 805: 73(int) Load 804 - 806: 7(int) Bitcast 805 - 807: 7(int) ISub 801 806 - 808: 7(int) IAdd 807 39 - 809: 230(ptr) AccessChain 200 202 808 202 - 810: 71(fvec4) Load 809 - 811: 19(fvec3) VectorShuffle 810 810 0 1 2 - 812: 19(fvec3) Load 260(pos) - 813: 19(fvec3) FSub 811 812 - Store 732(b) 813 - 815: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 816 816 12 12 - 814: 7(int) Load 139(index) - 817: 7(int) IAdd 814 39 - 818: 230(ptr) AccessChain 200 202 817 202 - 819: 71(fvec4) Load 818 - 820: 19(fvec3) VectorShuffle 819 819 0 1 2 - 821: 19(fvec3) Load 260(pos) - 822: 19(fvec3) FSub 820 821 - Store 749(c) 822 - 824: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 825 825 12 12 - 823: 19(fvec3) Load 718(a) - 826: 19(fvec3) Load 732(b) - 827: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 823 826 - 828: 19(fvec3) Load 732(b) - 829: 19(fvec3) Load 749(c) - 830: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 828 829 - 831: 19(fvec3) FAdd 827 830 - 832: 19(fvec3) Load 696(normal) - 833: 19(fvec3) FAdd 832 831 - Store 696(normal) 833 - Branch 787 - 787: Label - 834: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - Branch 709 - 709: Label - 836: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 837: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 838 838 12 12 - 835: 137(ptr) AccessChain 125(id) 39 - 839: 7(int) Load 835 - 840: 148(ptr) AccessChain 101(params) 147 39 - 841: 73(int) Load 840 - 842: 73(int) ISub 841 238 - 843: 7(int) Bitcast 842 - 844: 166(bool) ULessThan 839 843 - SelectionMerge 846 None - BranchConditional 844 845 846 - 845: Label - 848: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 849: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 850 850 12 12 - 847: 137(ptr) AccessChain 125(id) 12 - 851: 7(int) Load 847 - 852: 166(bool) UGreaterThan 851 12 - SelectionMerge 854 None - BranchConditional 852 853 854 - 853: Label - 856: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 857: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 858 858 12 12 - 855: 7(int) Load 139(index) - 859: 148(ptr) AccessChain 101(params) 147 12 - 860: 73(int) Load 859 - 861: 7(int) Bitcast 860 - 862: 7(int) IAdd 855 861 - 863: 230(ptr) AccessChain 200 202 862 202 - 864: 71(fvec4) Load 863 - 865: 19(fvec3) VectorShuffle 864 864 0 1 2 - 866: 19(fvec3) Load 260(pos) - 867: 19(fvec3) FSub 865 866 - Store 718(a) 867 - 869: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 870 870 12 12 - 868: 7(int) Load 139(index) - 871: 148(ptr) AccessChain 101(params) 147 12 - 872: 73(int) Load 871 - 873: 7(int) Bitcast 872 - 874: 7(int) IAdd 868 873 - 875: 7(int) ISub 874 39 - 876: 230(ptr) AccessChain 200 202 875 202 - 877: 71(fvec4) Load 876 - 878: 19(fvec3) VectorShuffle 877 877 0 1 2 - 879: 19(fvec3) Load 260(pos) - 880: 19(fvec3) FSub 878 879 - Store 732(b) 880 - 882: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 883 883 12 12 - 881: 7(int) Load 139(index) - 884: 7(int) ISub 881 39 - 885: 230(ptr) AccessChain 200 202 884 202 - 886: 71(fvec4) Load 885 - 887: 19(fvec3) VectorShuffle 886 886 0 1 2 - 888: 19(fvec3) Load 260(pos) - 889: 19(fvec3) FSub 887 888 - Store 749(c) 889 - 891: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 892 892 12 12 - 890: 19(fvec3) Load 718(a) - 893: 19(fvec3) Load 732(b) - 894: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 890 893 - 895: 19(fvec3) Load 732(b) - 896: 19(fvec3) Load 749(c) - 897: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 895 896 - 898: 19(fvec3) FAdd 894 897 - 899: 19(fvec3) Load 696(normal) - 900: 19(fvec3) FAdd 899 898 - Store 696(normal) 900 - Branch 854 - 854: Label - 902: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 903: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 904 904 12 12 - 901: 137(ptr) AccessChain 125(id) 12 - 905: 7(int) Load 901 - 906: 148(ptr) AccessChain 101(params) 147 12 - 907: 73(int) Load 906 - 908: 73(int) ISub 907 238 - 909: 7(int) Bitcast 908 - 910: 166(bool) ULessThan 905 909 - SelectionMerge 912 None - BranchConditional 910 911 912 - 911: Label - 914: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 915: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 916 916 12 12 - 913: 7(int) Load 139(index) - 917: 7(int) IAdd 913 39 - 918: 230(ptr) AccessChain 200 202 917 202 - 919: 71(fvec4) Load 918 - 920: 19(fvec3) VectorShuffle 919 919 0 1 2 - 921: 19(fvec3) Load 260(pos) - 922: 19(fvec3) FSub 920 921 - Store 718(a) 922 - 924: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 925 925 12 12 - 923: 7(int) Load 139(index) - 926: 148(ptr) AccessChain 101(params) 147 12 - 927: 73(int) Load 926 - 928: 7(int) Bitcast 927 - 929: 7(int) IAdd 923 928 - 930: 7(int) IAdd 929 39 - 931: 230(ptr) AccessChain 200 202 930 202 - 932: 71(fvec4) Load 931 - 933: 19(fvec3) VectorShuffle 932 932 0 1 2 - 934: 19(fvec3) Load 260(pos) - 935: 19(fvec3) FSub 933 934 - Store 732(b) 935 - 937: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 938 938 12 12 - 936: 7(int) Load 139(index) - 939: 148(ptr) AccessChain 101(params) 147 12 - 940: 73(int) Load 939 - 941: 7(int) Bitcast 940 - 942: 7(int) IAdd 936 941 - 943: 230(ptr) AccessChain 200 202 942 202 - 944: 71(fvec4) Load 943 - 945: 19(fvec3) VectorShuffle 944 944 0 1 2 - 946: 19(fvec3) Load 260(pos) - 947: 19(fvec3) FSub 945 946 - Store 749(c) 947 - 949: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 950 950 12 12 - 948: 19(fvec3) Load 718(a) - 951: 19(fvec3) Load 732(b) - 952: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 948 951 - 953: 19(fvec3) Load 732(b) - 954: 19(fvec3) Load 749(c) - 955: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 953 954 - 956: 19(fvec3) FAdd 952 955 - 957: 19(fvec3) Load 696(normal) - 958: 19(fvec3) FAdd 957 956 - Store 696(normal) 958 - Branch 912 - 912: Label - 959: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - Branch 846 - 846: Label - 961: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 - 962: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 963 963 12 12 - 960: 7(int) Load 139(index) - 964: 19(fvec3) Load 696(normal) - 965: 19(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 964 - 966: 16(float) CompositeExtract 965 0 - 967: 16(float) CompositeExtract 965 1 - 968: 16(float) CompositeExtract 965 2 - 969: 71(fvec4) CompositeConstruct 966 967 968 239 - 970: 230(ptr) AccessChain 224 202 960 563 - Store 970 969 - Branch 695 - 695: Label - 971: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 213: Label + 252: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 253: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 250 250 12 12 + 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 248 247(force) 45 + 255: 231(ptr) AccessChain 101(params) 254 + 256: 71(fvec4) Load 255 + 257: 19(fvec3) VectorShuffle 256 256 0 1 2 + 258: 105(ptr) AccessChain 101(params) 239 + 259: 16(float) Load 258 + 260: 19(fvec3) VectorTimesScalar 257 259 + Store 247(force) 260 + 266: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 264 264 12 12 + 265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 262 261(pos) 45 + 267: 7(int) Load 139(index) + 268: 231(ptr) AccessChain 200 203 267 203 + 269: 71(fvec4) Load 268 + 270: 19(fvec3) VectorShuffle 269 269 0 1 2 + Store 261(pos) 270 + 276: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 274 274 12 12 + 275: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 272 271(vel) 45 + 277: 7(int) Load 139(index) + 278: 231(ptr) AccessChain 200 203 277 239 + 279: 71(fvec4) Load 278 + 280: 19(fvec3) VectorShuffle 279 279 0 1 2 + Store 271(vel) 280 + 282: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 283 283 12 12 + 281: 137(ptr) AccessChain 125(id) 12 + 284: 7(int) Load 281 + 285: 166(bool) UGreaterThan 284 12 + SelectionMerge 287 None + BranchConditional 285 286 287 + 286: Label + 289: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 290: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 291 291 12 12 + 288: 7(int) Load 139(index) + 292: 7(int) ISub 288 39 + 294: 231(ptr) AccessChain 200 203 292 203 + 295: 71(fvec4) Load 294 + 296: 19(fvec3) VectorShuffle 295 295 0 1 2 + Store 293(param) 296 + 298: 19(fvec3) Load 261(pos) + Store 297(param) 298 + 300: 105(ptr) AccessChain 101(params) 207 + 301: 16(float) Load 300 + Store 299(param) 301 + 302: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 293(param) 297(param) 299(param) + 303: 19(fvec3) Load 247(force) + 304: 19(fvec3) FAdd 303 302 + Store 247(force) 304 + Branch 287 + 287: Label + 306: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 307: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 308 308 12 12 + 305: 137(ptr) AccessChain 125(id) 12 + 309: 7(int) Load 305 + 310: 148(ptr) AccessChain 101(params) 147 12 + 311: 73(int) Load 310 + 312: 73(int) ISub 311 239 + 313: 7(int) Bitcast 312 + 314: 166(bool) ULessThan 309 313 + SelectionMerge 316 None + BranchConditional 314 315 316 + 315: Label + 318: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 319: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 320 320 12 12 + 317: 7(int) Load 139(index) + 321: 7(int) IAdd 317 39 + 323: 231(ptr) AccessChain 200 203 321 203 + 324: 71(fvec4) Load 323 + 325: 19(fvec3) VectorShuffle 324 324 0 1 2 + Store 322(param) 325 + 327: 19(fvec3) Load 261(pos) + Store 326(param) 327 + 329: 105(ptr) AccessChain 101(params) 207 + 330: 16(float) Load 329 + Store 328(param) 330 + 331: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 322(param) 326(param) 328(param) + 332: 19(fvec3) Load 247(force) + 333: 19(fvec3) FAdd 332 331 + Store 247(force) 333 + Branch 316 + 316: Label + 335: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 336: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 337 337 12 12 + 334: 137(ptr) AccessChain 125(id) 39 + 338: 7(int) Load 334 + 339: 148(ptr) AccessChain 101(params) 147 39 + 340: 73(int) Load 339 + 341: 73(int) ISub 340 239 + 342: 7(int) Bitcast 341 + 343: 166(bool) ULessThan 338 342 + SelectionMerge 345 None + BranchConditional 343 344 345 + 344: Label + 347: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 349 349 12 12 + 346: 7(int) Load 139(index) + 350: 148(ptr) AccessChain 101(params) 147 12 + 351: 73(int) Load 350 + 352: 7(int) Bitcast 351 + 353: 7(int) IAdd 346 352 + 356: 231(ptr) AccessChain 200 203 353 203 + 357: 71(fvec4) Load 356 + 358: 19(fvec3) VectorShuffle 357 357 0 1 2 + Store 355(param) 358 + 360: 19(fvec3) Load 261(pos) + Store 359(param) 360 + 362: 105(ptr) AccessChain 101(params) 354 + 363: 16(float) Load 362 + Store 361(param) 363 + 364: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 355(param) 359(param) 361(param) + 365: 19(fvec3) Load 247(force) + 366: 19(fvec3) FAdd 365 364 + Store 247(force) 366 + Branch 345 + 345: Label + 368: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 369: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 370 370 12 12 + 367: 137(ptr) AccessChain 125(id) 39 + 371: 7(int) Load 367 + 372: 166(bool) UGreaterThan 371 12 + SelectionMerge 374 None + BranchConditional 372 373 374 + 373: Label + 376: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 377: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 378 378 12 12 + 375: 7(int) Load 139(index) + 379: 148(ptr) AccessChain 101(params) 147 12 + 380: 73(int) Load 379 + 381: 7(int) Bitcast 380 + 382: 7(int) ISub 375 381 + 384: 231(ptr) AccessChain 200 203 382 203 + 385: 71(fvec4) Load 384 + 386: 19(fvec3) VectorShuffle 385 385 0 1 2 + Store 383(param) 386 + 388: 19(fvec3) Load 261(pos) + Store 387(param) 388 + 390: 105(ptr) AccessChain 101(params) 354 + 391: 16(float) Load 390 + Store 389(param) 391 + 392: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 383(param) 387(param) 389(param) + 393: 19(fvec3) Load 247(force) + 394: 19(fvec3) FAdd 393 392 + Store 247(force) 394 + Branch 374 + 374: Label + 396: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 397: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 398 398 12 12 + 395: 137(ptr) AccessChain 125(id) 12 + 399: 7(int) Load 395 + 400: 166(bool) UGreaterThan 399 12 + SelectionMerge 402 None + BranchConditional 400 401 402 + 401: Label + 404: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 405: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 398 398 12 12 + 403: 137(ptr) AccessChain 125(id) 39 + 406: 7(int) Load 403 + 407: 148(ptr) AccessChain 101(params) 147 39 + 408: 73(int) Load 407 + 409: 73(int) ISub 408 239 + 410: 7(int) Bitcast 409 + 411: 166(bool) ULessThan 406 410 + Branch 402 + 402: Label + 413: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 412: 166(bool) Phi 400 374 411 401 + SelectionMerge 415 None + BranchConditional 412 414 415 + 414: Label + 417: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 418: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 419 419 12 12 + 416: 7(int) Load 139(index) + 420: 148(ptr) AccessChain 101(params) 147 12 + 421: 73(int) Load 420 + 422: 7(int) Bitcast 421 + 423: 7(int) IAdd 416 422 + 424: 7(int) ISub 423 39 + 427: 231(ptr) AccessChain 200 203 424 203 + 428: 71(fvec4) Load 427 + 429: 19(fvec3) VectorShuffle 428 428 0 1 2 + Store 426(param) 429 + 431: 19(fvec3) Load 261(pos) + Store 430(param) 431 + 433: 105(ptr) AccessChain 101(params) 425 + 434: 16(float) Load 433 + Store 432(param) 434 + 435: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 426(param) 430(param) 432(param) + 436: 19(fvec3) Load 247(force) + 437: 19(fvec3) FAdd 436 435 + Store 247(force) 437 + Branch 415 + 415: Label + 439: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 440: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 441 441 12 12 + 438: 137(ptr) AccessChain 125(id) 12 + 442: 7(int) Load 438 + 443: 166(bool) UGreaterThan 442 12 + SelectionMerge 445 None + BranchConditional 443 444 445 + 444: Label + 447: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 448: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 441 441 12 12 + 446: 137(ptr) AccessChain 125(id) 39 + 449: 7(int) Load 446 + 450: 166(bool) UGreaterThan 449 12 + Branch 445 + 445: Label + 452: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 451: 166(bool) Phi 443 415 450 444 + SelectionMerge 454 None + BranchConditional 451 453 454 + 453: Label + 456: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 457: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 458 458 12 12 + 455: 7(int) Load 139(index) + 459: 148(ptr) AccessChain 101(params) 147 12 + 460: 73(int) Load 459 + 461: 7(int) Bitcast 460 + 462: 7(int) ISub 455 461 + 463: 7(int) ISub 462 39 + 465: 231(ptr) AccessChain 200 203 463 203 + 466: 71(fvec4) Load 465 + 467: 19(fvec3) VectorShuffle 466 466 0 1 2 + Store 464(param) 467 + 469: 19(fvec3) Load 261(pos) + Store 468(param) 469 + 471: 105(ptr) AccessChain 101(params) 425 + 472: 16(float) Load 471 + Store 470(param) 472 + 473: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 464(param) 468(param) 470(param) + 474: 19(fvec3) Load 247(force) + 475: 19(fvec3) FAdd 474 473 + Store 247(force) 475 + Branch 454 + 454: Label + 477: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 478: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 479 479 12 12 + 476: 137(ptr) AccessChain 125(id) 12 + 480: 7(int) Load 476 + 481: 148(ptr) AccessChain 101(params) 147 12 + 482: 73(int) Load 481 + 483: 73(int) ISub 482 239 + 484: 7(int) Bitcast 483 + 485: 166(bool) ULessThan 480 484 + SelectionMerge 487 None + BranchConditional 485 486 487 + 486: Label + 489: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 490: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 479 479 12 12 + 488: 137(ptr) AccessChain 125(id) 39 + 491: 7(int) Load 488 + 492: 148(ptr) AccessChain 101(params) 147 39 + 493: 73(int) Load 492 + 494: 73(int) ISub 493 239 + 495: 7(int) Bitcast 494 + 496: 166(bool) ULessThan 491 495 + Branch 487 + 487: Label + 498: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 497: 166(bool) Phi 485 454 496 486 + SelectionMerge 500 None + BranchConditional 497 499 500 + 499: Label + 502: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 503: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 504 504 12 12 + 501: 7(int) Load 139(index) + 505: 148(ptr) AccessChain 101(params) 147 12 + 506: 73(int) Load 505 + 507: 7(int) Bitcast 506 + 508: 7(int) IAdd 501 507 + 509: 7(int) IAdd 508 39 + 511: 231(ptr) AccessChain 200 203 509 203 + 512: 71(fvec4) Load 511 + 513: 19(fvec3) VectorShuffle 512 512 0 1 2 + Store 510(param) 513 + 515: 19(fvec3) Load 261(pos) + Store 514(param) 515 + 517: 105(ptr) AccessChain 101(params) 425 + 518: 16(float) Load 517 + Store 516(param) 518 + 519: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 510(param) 514(param) 516(param) + 520: 19(fvec3) Load 247(force) + 521: 19(fvec3) FAdd 520 519 + Store 247(force) 521 + Branch 500 + 500: Label + 523: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 524: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 525 525 12 12 + 522: 137(ptr) AccessChain 125(id) 12 + 526: 7(int) Load 522 + 527: 148(ptr) AccessChain 101(params) 147 12 + 528: 73(int) Load 527 + 529: 73(int) ISub 528 239 + 530: 7(int) Bitcast 529 + 531: 166(bool) ULessThan 526 530 + SelectionMerge 533 None + BranchConditional 531 532 533 + 532: Label + 535: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 536: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 525 525 12 12 + 534: 137(ptr) AccessChain 125(id) 39 + 537: 7(int) Load 534 + 538: 166(bool) UGreaterThan 537 12 + Branch 533 + 533: Label + 540: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 539: 166(bool) Phi 531 500 538 532 + SelectionMerge 542 None + BranchConditional 539 541 542 + 541: Label + 544: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 545: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 546 546 12 12 + 543: 7(int) Load 139(index) + 547: 148(ptr) AccessChain 101(params) 147 12 + 548: 73(int) Load 547 + 549: 7(int) Bitcast 548 + 550: 7(int) ISub 543 549 + 551: 7(int) IAdd 550 39 + 553: 231(ptr) AccessChain 200 203 551 203 + 554: 71(fvec4) Load 553 + 555: 19(fvec3) VectorShuffle 554 554 0 1 2 + Store 552(param) 555 + 557: 19(fvec3) Load 261(pos) + Store 556(param) 557 + 559: 105(ptr) AccessChain 101(params) 425 + 560: 16(float) Load 559 + Store 558(param) 560 + 561: 19(fvec3) FunctionCall 31(springForce(vf3;vf3;f1;) 552(param) 556(param) 558(param) + 562: 19(fvec3) Load 247(force) + 563: 19(fvec3) FAdd 562 561 + Store 247(force) 563 + Branch 542 + 542: Label + 566: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 567: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 568 568 12 12 + 565: 105(ptr) AccessChain 101(params) 564 + 569: 16(float) Load 565 + 570: 16(float) FNegate 569 + 571: 19(fvec3) Load 271(vel) + 572: 19(fvec3) VectorTimesScalar 571 570 + 573: 19(fvec3) Load 247(force) + 574: 19(fvec3) FAdd 573 572 + Store 247(force) 574 + 580: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 578 578 12 12 + 579: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 576 575(f) 45 + 581: 19(fvec3) Load 247(force) + 582: 105(ptr) AccessChain 101(params) 239 + 583: 16(float) Load 582 + 584: 16(float) FDiv 210 583 + 585: 19(fvec3) VectorTimesScalar 581 584 + Store 575(f) 585 + 587: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 588 588 12 12 + 586: 7(int) Load 139(index) + 589: 19(fvec3) Load 261(pos) + 590: 19(fvec3) Load 271(vel) + 591: 105(ptr) AccessChain 101(params) 203 + 592: 16(float) Load 591 + 593: 19(fvec3) VectorTimesScalar 590 592 + 594: 19(fvec3) FAdd 589 593 + 596: 19(fvec3) Load 575(f) + 597: 19(fvec3) VectorTimesScalar 596 595 + 598: 105(ptr) AccessChain 101(params) 203 + 599: 16(float) Load 598 + 600: 19(fvec3) VectorTimesScalar 597 599 + 601: 105(ptr) AccessChain 101(params) 203 + 602: 16(float) Load 601 + 603: 19(fvec3) VectorTimesScalar 600 602 + 604: 19(fvec3) FAdd 594 603 + 605: 16(float) CompositeExtract 604 0 + 606: 16(float) CompositeExtract 604 1 + 607: 16(float) CompositeExtract 604 2 + 608: 71(fvec4) CompositeConstruct 605 606 607 210 + 609: 231(ptr) AccessChain 225 203 586 203 + Store 609 608 + 611: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 612 612 12 12 + 610: 7(int) Load 139(index) + 613: 19(fvec3) Load 271(vel) + 614: 19(fvec3) Load 575(f) + 615: 105(ptr) AccessChain 101(params) 203 + 616: 16(float) Load 615 + 617: 19(fvec3) VectorTimesScalar 614 616 + 618: 19(fvec3) FAdd 613 617 + 619: 16(float) CompositeExtract 618 0 + 620: 16(float) CompositeExtract 618 1 + 621: 16(float) CompositeExtract 618 2 + 622: 71(fvec4) CompositeConstruct 619 620 621 240 + 623: 231(ptr) AccessChain 225 203 610 239 + Store 623 622 + 629: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 627 627 12 12 + 628: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 625 624(sphereDist) 45 + 630: 7(int) Load 139(index) + 631: 231(ptr) AccessChain 225 203 630 203 + 632: 71(fvec4) Load 631 + 633: 19(fvec3) VectorShuffle 632 632 0 1 2 + 635: 231(ptr) AccessChain 101(params) 634 + 636: 71(fvec4) Load 635 + 637: 19(fvec3) VectorShuffle 636 636 0 1 2 + 638: 19(fvec3) FSub 633 637 + Store 624(sphereDist) 638 + 640: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 641 641 12 12 + 639: 19(fvec3) Load 624(sphereDist) + 642: 16(float) ExtInst 3(GLSL.std.450) 66(Length) 639 + 644: 105(ptr) AccessChain 101(params) 643 + 645: 16(float) Load 644 + 647: 16(float) FAdd 645 646 + 648: 166(bool) FOrdLessThan 642 647 + SelectionMerge 650 None + BranchConditional 648 649 650 + 649: Label + 652: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 653: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 654 654 12 12 + 651: 7(int) Load 139(index) + 655: 231(ptr) AccessChain 101(params) 634 + 656: 71(fvec4) Load 655 + 657: 19(fvec3) VectorShuffle 656 656 0 1 2 + 658: 19(fvec3) Load 624(sphereDist) + 659: 19(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 658 + 660: 105(ptr) AccessChain 101(params) 643 + 661: 16(float) Load 660 + 662: 16(float) FAdd 661 646 + 663: 19(fvec3) VectorTimesScalar 659 662 + 664: 19(fvec3) FAdd 657 663 + 665: 105(ptr) AccessChain 225 203 651 203 12 + 666: 16(float) CompositeExtract 664 0 + Store 665 666 + 667: 105(ptr) AccessChain 225 203 651 203 39 + 668: 16(float) CompositeExtract 664 1 + Store 667 668 + 669: 105(ptr) AccessChain 225 203 651 203 41 + 670: 16(float) CompositeExtract 664 2 + Store 669 670 + 672: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 673 673 12 12 + 671: 7(int) Load 139(index) + 674: 231(ptr) AccessChain 225 203 671 239 + Store 674 241 + Branch 650 + 650: Label + 691: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 692: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 681 681 12 12 + 690: 688(ptr) AccessChain 685(pushConsts) 203 + 693: 7(int) Load 690 + 694: 166(bool) IEqual 693 39 + SelectionMerge 696 None + BranchConditional 694 695 696 + 695: Label + 701: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 702: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 699 699 12 12 + 700: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 698 697(normal) 45 + Store 697(normal) 703 + 705: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 706 706 12 12 + 704: 137(ptr) AccessChain 125(id) 39 + 707: 7(int) Load 704 + 708: 166(bool) UGreaterThan 707 12 + SelectionMerge 710 None + BranchConditional 708 709 710 + 709: Label + 712: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 713: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 714 714 12 12 + 711: 137(ptr) AccessChain 125(id) 12 + 715: 7(int) Load 711 + 716: 166(bool) UGreaterThan 715 12 + SelectionMerge 718 None + BranchConditional 716 717 718 + 717: Label + 724: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 725: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 722 722 12 12 + 723: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 720 719(a) 45 + 726: 7(int) Load 139(index) + 727: 7(int) ISub 726 39 + 728: 231(ptr) AccessChain 200 203 727 203 + 729: 71(fvec4) Load 728 + 730: 19(fvec3) VectorShuffle 729 729 0 1 2 + 731: 19(fvec3) Load 261(pos) + 732: 19(fvec3) FSub 730 731 + Store 719(a) 732 + 738: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 736 736 12 12 + 737: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 734 733(b) 45 + 739: 7(int) Load 139(index) + 740: 148(ptr) AccessChain 101(params) 147 12 + 741: 73(int) Load 740 + 742: 7(int) Bitcast 741 + 743: 7(int) ISub 739 742 + 744: 7(int) ISub 743 39 + 745: 231(ptr) AccessChain 200 203 744 203 + 746: 71(fvec4) Load 745 + 747: 19(fvec3) VectorShuffle 746 746 0 1 2 + 748: 19(fvec3) Load 261(pos) + 749: 19(fvec3) FSub 747 748 + Store 733(b) 749 + 755: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 753 753 12 12 + 754: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 751 750(c) 45 + 756: 7(int) Load 139(index) + 757: 148(ptr) AccessChain 101(params) 147 12 + 758: 73(int) Load 757 + 759: 7(int) Bitcast 758 + 760: 7(int) ISub 756 759 + 761: 231(ptr) AccessChain 200 203 760 203 + 762: 71(fvec4) Load 761 + 763: 19(fvec3) VectorShuffle 762 762 0 1 2 + 764: 19(fvec3) Load 261(pos) + 765: 19(fvec3) FSub 763 764 + Store 750(c) 765 + 767: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 768 768 12 12 + 766: 19(fvec3) Load 719(a) + 769: 19(fvec3) Load 733(b) + 770: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 766 769 + 771: 19(fvec3) Load 733(b) + 772: 19(fvec3) Load 750(c) + 773: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 771 772 + 774: 19(fvec3) FAdd 770 773 + 775: 19(fvec3) Load 697(normal) + 776: 19(fvec3) FAdd 775 774 + Store 697(normal) 776 + Branch 718 + 718: Label + 778: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 779: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 780 780 12 12 + 777: 137(ptr) AccessChain 125(id) 12 + 781: 7(int) Load 777 + 782: 148(ptr) AccessChain 101(params) 147 12 + 783: 73(int) Load 782 + 784: 73(int) ISub 783 239 + 785: 7(int) Bitcast 784 + 786: 166(bool) ULessThan 781 785 + SelectionMerge 788 None + BranchConditional 786 787 788 + 787: Label + 790: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 791: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 792 792 12 12 + 789: 7(int) Load 139(index) + 793: 148(ptr) AccessChain 101(params) 147 12 + 794: 73(int) Load 793 + 795: 7(int) Bitcast 794 + 796: 7(int) ISub 789 795 + 797: 231(ptr) AccessChain 200 203 796 203 + 798: 71(fvec4) Load 797 + 799: 19(fvec3) VectorShuffle 798 798 0 1 2 + 800: 19(fvec3) Load 261(pos) + 801: 19(fvec3) FSub 799 800 + Store 719(a) 801 + 803: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 804 804 12 12 + 802: 7(int) Load 139(index) + 805: 148(ptr) AccessChain 101(params) 147 12 + 806: 73(int) Load 805 + 807: 7(int) Bitcast 806 + 808: 7(int) ISub 802 807 + 809: 7(int) IAdd 808 39 + 810: 231(ptr) AccessChain 200 203 809 203 + 811: 71(fvec4) Load 810 + 812: 19(fvec3) VectorShuffle 811 811 0 1 2 + 813: 19(fvec3) Load 261(pos) + 814: 19(fvec3) FSub 812 813 + Store 733(b) 814 + 816: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 817 817 12 12 + 815: 7(int) Load 139(index) + 818: 7(int) IAdd 815 39 + 819: 231(ptr) AccessChain 200 203 818 203 + 820: 71(fvec4) Load 819 + 821: 19(fvec3) VectorShuffle 820 820 0 1 2 + 822: 19(fvec3) Load 261(pos) + 823: 19(fvec3) FSub 821 822 + Store 750(c) 823 + 825: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 826 826 12 12 + 824: 19(fvec3) Load 719(a) + 827: 19(fvec3) Load 733(b) + 828: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 824 827 + 829: 19(fvec3) Load 733(b) + 830: 19(fvec3) Load 750(c) + 831: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 829 830 + 832: 19(fvec3) FAdd 828 831 + 833: 19(fvec3) Load 697(normal) + 834: 19(fvec3) FAdd 833 832 + Store 697(normal) 834 + Branch 788 + 788: Label + 835: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + Branch 710 + 710: Label + 837: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 838: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 839 839 12 12 + 836: 137(ptr) AccessChain 125(id) 39 + 840: 7(int) Load 836 + 841: 148(ptr) AccessChain 101(params) 147 39 + 842: 73(int) Load 841 + 843: 73(int) ISub 842 239 + 844: 7(int) Bitcast 843 + 845: 166(bool) ULessThan 840 844 + SelectionMerge 847 None + BranchConditional 845 846 847 + 846: Label + 849: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 850: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 851 851 12 12 + 848: 137(ptr) AccessChain 125(id) 12 + 852: 7(int) Load 848 + 853: 166(bool) UGreaterThan 852 12 + SelectionMerge 855 None + BranchConditional 853 854 855 + 854: Label + 857: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 858: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 859 859 12 12 + 856: 7(int) Load 139(index) + 860: 148(ptr) AccessChain 101(params) 147 12 + 861: 73(int) Load 860 + 862: 7(int) Bitcast 861 + 863: 7(int) IAdd 856 862 + 864: 231(ptr) AccessChain 200 203 863 203 + 865: 71(fvec4) Load 864 + 866: 19(fvec3) VectorShuffle 865 865 0 1 2 + 867: 19(fvec3) Load 261(pos) + 868: 19(fvec3) FSub 866 867 + Store 719(a) 868 + 870: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 871 871 12 12 + 869: 7(int) Load 139(index) + 872: 148(ptr) AccessChain 101(params) 147 12 + 873: 73(int) Load 872 + 874: 7(int) Bitcast 873 + 875: 7(int) IAdd 869 874 + 876: 7(int) ISub 875 39 + 877: 231(ptr) AccessChain 200 203 876 203 + 878: 71(fvec4) Load 877 + 879: 19(fvec3) VectorShuffle 878 878 0 1 2 + 880: 19(fvec3) Load 261(pos) + 881: 19(fvec3) FSub 879 880 + Store 733(b) 881 + 883: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 884 884 12 12 + 882: 7(int) Load 139(index) + 885: 7(int) ISub 882 39 + 886: 231(ptr) AccessChain 200 203 885 203 + 887: 71(fvec4) Load 886 + 888: 19(fvec3) VectorShuffle 887 887 0 1 2 + 889: 19(fvec3) Load 261(pos) + 890: 19(fvec3) FSub 888 889 + Store 750(c) 890 + 892: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 893 893 12 12 + 891: 19(fvec3) Load 719(a) + 894: 19(fvec3) Load 733(b) + 895: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 891 894 + 896: 19(fvec3) Load 733(b) + 897: 19(fvec3) Load 750(c) + 898: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 896 897 + 899: 19(fvec3) FAdd 895 898 + 900: 19(fvec3) Load 697(normal) + 901: 19(fvec3) FAdd 900 899 + Store 697(normal) 901 + Branch 855 + 855: Label + 903: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 904: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 905 905 12 12 + 902: 137(ptr) AccessChain 125(id) 12 + 906: 7(int) Load 902 + 907: 148(ptr) AccessChain 101(params) 147 12 + 908: 73(int) Load 907 + 909: 73(int) ISub 908 239 + 910: 7(int) Bitcast 909 + 911: 166(bool) ULessThan 906 910 + SelectionMerge 913 None + BranchConditional 911 912 913 + 912: Label + 915: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 916: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 917 917 12 12 + 914: 7(int) Load 139(index) + 918: 7(int) IAdd 914 39 + 919: 231(ptr) AccessChain 200 203 918 203 + 920: 71(fvec4) Load 919 + 921: 19(fvec3) VectorShuffle 920 920 0 1 2 + 922: 19(fvec3) Load 261(pos) + 923: 19(fvec3) FSub 921 922 + Store 719(a) 923 + 925: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 926 926 12 12 + 924: 7(int) Load 139(index) + 927: 148(ptr) AccessChain 101(params) 147 12 + 928: 73(int) Load 927 + 929: 7(int) Bitcast 928 + 930: 7(int) IAdd 924 929 + 931: 7(int) IAdd 930 39 + 932: 231(ptr) AccessChain 200 203 931 203 + 933: 71(fvec4) Load 932 + 934: 19(fvec3) VectorShuffle 933 933 0 1 2 + 935: 19(fvec3) Load 261(pos) + 936: 19(fvec3) FSub 934 935 + Store 733(b) 936 + 938: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 939 939 12 12 + 937: 7(int) Load 139(index) + 940: 148(ptr) AccessChain 101(params) 147 12 + 941: 73(int) Load 940 + 942: 7(int) Bitcast 941 + 943: 7(int) IAdd 937 942 + 944: 231(ptr) AccessChain 200 203 943 203 + 945: 71(fvec4) Load 944 + 946: 19(fvec3) VectorShuffle 945 945 0 1 2 + 947: 19(fvec3) Load 261(pos) + 948: 19(fvec3) FSub 946 947 + Store 750(c) 948 + 950: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 951 951 12 12 + 949: 19(fvec3) Load 719(a) + 952: 19(fvec3) Load 733(b) + 953: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 949 952 + 954: 19(fvec3) Load 733(b) + 955: 19(fvec3) Load 750(c) + 956: 19(fvec3) ExtInst 3(GLSL.std.450) 68(Cross) 954 955 + 957: 19(fvec3) FAdd 953 956 + 958: 19(fvec3) Load 697(normal) + 959: 19(fvec3) FAdd 958 957 + Store 697(normal) 959 + Branch 913 + 913: Label + 960: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + Branch 847 + 847: Label + 962: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 + 963: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 35 964 964 12 12 + 961: 7(int) Load 139(index) + 965: 19(fvec3) Load 697(normal) + 966: 19(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 965 + 967: 16(float) CompositeExtract 966 0 + 968: 16(float) CompositeExtract 966 1 + 969: 16(float) CompositeExtract 966 2 + 970: 71(fvec4) CompositeConstruct 967 968 969 240 + 971: 231(ptr) AccessChain 225 203 961 564 + Store 971 970 + Branch 696 + 696: Label + 972: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 55 Return FunctionEnd 31(springForce(vf3;vf3;f1;): 19(fvec3) Function None 26 diff --git a/Test/baseResults/spv.debuginfo.glsl.frag.out b/Test/baseResults/spv.debuginfo.glsl.frag.out index e747bc13..c2023e59 100644 --- a/Test/baseResults/spv.debuginfo.glsl.frag.out +++ b/Test/baseResults/spv.debuginfo.glsl.frag.out @@ -12,7 +12,7 @@ Validation failed MemoryModel Logical GLSL450 EntryPoint Fragment 14 "main" 493 546 ExecutionMode 14 OriginUpperLeft - 2: String "" + 2: String "spv.debuginfo.glsl.frag" 8: String "uint" 17: String "float" 39: String "textureProj" @@ -23,6 +23,200 @@ Validation failed // OpModuleProcessed keep-uncalled // OpModuleProcessed entry-point main #line 1 +/* +The MIT License (MIT) + +Copyright (c) 2022 Sascha Willems + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#version 450 + +layout (binding = 1) uniform sampler2D samplerposition; +layout (binding = 2) uniform sampler2D samplerNormal; +layout (binding = 3) uniform sampler2D samplerAlbedo; +layout (binding = 5) uniform sampler2DArray samplerShadowMap; + +layout (location = 0) in vec2 inUV; + +layout (location = 0) out vec4 outFragColor; + +#define LIGHT_COUNT 3 +#define SHADOW_FACTOR 0.25 +#define AMBIENT_LIGHT 0.1 +#define USE_PCF + +int global_var = 0; + +struct Light +{ + vec4 position; + vec4 target; + vec4 color; + mat4 viewMatrix; +}; + +layout (binding = 4) uniform UBO +{ + vec4 viewPos; + Light lights[LIGHT_COUNT]; + int useShadows; + int debugDisplayTarget; +} ubo; + +float textureProj(vec4 P, float layer, vec2 offset) +{ + float shadow = 1.0; + vec4 shadowCoord = P / P.w; + shadowCoord.st = shadowCoord.st * 0.5 + 0.5; + + if (shadowCoord.z > -1.0 && shadowCoord.z < 1.0) + { + float dist = texture(samplerShadowMap, vec3(shadowCoord.st + offset, layer)).r; + if (shadowCoord.w > 0.0 && dist < shadowCoord.z) + { + shadow = SHADOW_FACTOR; + } + } + return shadow; +} + +float filterPCF(vec4 sc, float layer) +{ + ivec2 texDim = textureSize(samplerShadowMap, 0).xy; + float scale = 1.5; + float dx = scale * 1.0 / float(texDim.x); + float dy = scale * 1.0 / float(texDim.y); + + float shadowFactor = 0.0; + int count = 0; + int range = 1; + + for (int x = -range; x <= range; x++) + { + for (int y = -range; y <= range; y++) + { + shadowFactor += textureProj(sc, layer, vec2(dx*x, dy*y)); + count++; + } + + } + return shadowFactor / count; +} + +vec3 shadow(vec3 fragcolor, vec3 fragpos) { + for(int i = 0; i < LIGHT_COUNT; ++i) + { + vec4 shadowClip = ubo.lights[i].viewMatrix * vec4(fragpos, 1.0); + + float shadowFactor; + #ifdef USE_PCF + shadowFactor= filterPCF(shadowClip, i); + #else + shadowFactor = textureProj(shadowClip, i, vec2(0.0)); + #endif + + fragcolor *= shadowFactor; + } + return fragcolor; +} + +void main() +{ + // Get G-Buffer values + vec3 fragPos = texture(samplerposition, inUV).rgb; + vec3 normal = texture(samplerNormal, inUV).rgb; + vec4 albedo = texture(samplerAlbedo, inUV); + + // Debug display + if (ubo.debugDisplayTarget > 0) { + switch (ubo.debugDisplayTarget) { + case 1: + outFragColor.rgb = shadow(vec3(1.0), fragPos).rgb; + break; + case 2: + outFragColor.rgb = fragPos; + break; + case 3: + outFragColor.rgb = normal; + break; + case 4: + outFragColor.rgb = albedo.rgb; + break; + case 5: + outFragColor.rgb = albedo.aaa; + break; + } + outFragColor.a = 1.0; + return; + } + + // Ambient part + vec3 fragcolor = albedo.rgb * AMBIENT_LIGHT; + + vec3 N = normalize(normal); + + for(int i = 0; i < LIGHT_COUNT; ++i) + { + // Vector to light + vec3 L = ubo.lights[i].position.xyz - fragPos; + // Distance from light to fragment position + float dist = length(L); + L = normalize(L); + + // Viewer to fragment + vec3 V = ubo.viewPos.xyz - fragPos; + V = normalize(V); + + float lightCosInnerAngle = cos(radians(15.0)); + float lightCosOuterAngle = cos(radians(25.0)); + float lightRange = 100.0; + + // Direction vector from source to target + vec3 dir = normalize(ubo.lights[i].position.xyz - ubo.lights[i].target.xyz); + + // Dual cone spot light with smooth transition between inner and outer angle + float cosDir = dot(L, dir); + float spotEffect = smoothstep(lightCosOuterAngle, lightCosInnerAngle, cosDir); + float heightAttenuation = smoothstep(lightRange, 0.0f, dist); + + // Diffuse lighting + float NdotL = max(0.0, dot(N, L)); + vec3 diff = vec3(NdotL); + + // Specular lighting + vec3 R = reflect(-L, N); + float NdotR = max(0.0, dot(R, V)); + vec3 spec = vec3(pow(NdotR, 16.0) * albedo.a * 2.5); + + fragcolor += vec3((diff + spec) * spotEffect * heightAttenuation) * ubo.lights[i].color.rgb * albedo.rgb; + } + + // Shadow calculations in a separate pass + if (ubo.useShadows > 0) + { + fragcolor = shadow(fragcolor, fragPos); + } + + outFragColor = vec4(fragcolor, 1.0); +} " 47: String "P" 53: String "layer" diff --git a/Test/baseResults/spv.debuginfo.glsl.geom.out b/Test/baseResults/spv.debuginfo.glsl.geom.out index c21571c1..32634ffe 100644 --- a/Test/baseResults/spv.debuginfo.glsl.geom.out +++ b/Test/baseResults/spv.debuginfo.glsl.geom.out @@ -1,7 +1,7 @@ spv.debuginfo.glsl.geom // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 273 +// Id's are bound by 274 Capability Geometry Capability MultiViewport @@ -9,12 +9,12 @@ spv.debuginfo.glsl.geom 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Geometry 14 "main" 64 98 121 130 134 168 208 217 236 249 255 259 + EntryPoint Geometry 14 "main" 64 98 121 130 134 168 208 217 236 250 256 260 ExecutionMode 14 Triangles ExecutionMode 14 Invocations 2 ExecutionMode 14 OutputTriangleStrip ExecutionMode 14 OutputVertices 3 - 2: String "" + 2: String "spv.debuginfo.glsl.geom" 8: String "uint" 16: String "main" 19: String "// OpModuleProcessed auto-map-locations @@ -24,6 +24,75 @@ spv.debuginfo.glsl.geom // OpModuleProcessed keep-uncalled // OpModuleProcessed entry-point main #line 1 +/* +The MIT License (MIT) + +Copyright (c) 2022 Sascha Willems + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#version 450 + +#extension GL_ARB_viewport_array : enable + +layout (triangles, invocations = 2) in; +layout (triangle_strip, max_vertices = 3) out; + +layout (binding = 0) uniform UBO +{ + mat4 projection[2]; + mat4 modelview[2]; + vec4 lightPos; +} ubo; + +layout (location = 0) in vec3 inNormal[]; +layout (location = 1) in vec3 inColor[]; + +layout (location = 0) out vec3 outNormal; +layout (location = 1) out vec3 outColor; +layout (location = 2) out vec3 outViewVec; +layout (location = 3) out vec3 outLightVec; + +void main(void) +{ + for(int i = 0; i < gl_in.length(); i++) + { + outNormal = mat3(ubo.modelview[gl_InvocationID]) * inNormal[i]; + outColor = inColor[i]; + + vec4 pos = gl_in[i].gl_Position; + vec4 worldPos = (ubo.modelview[gl_InvocationID] * pos); + + vec3 lPos = vec3(ubo.modelview[gl_InvocationID] * ubo.lightPos); + outLightVec = lPos - worldPos.xyz; + outViewVec = -worldPos.xyz; + + gl_Position = ubo.projection[gl_InvocationID] * worldPos; + + // Set the viewport index that the vertex will be emitted to + gl_ViewportIndex = gl_InvocationID; + gl_PrimitiveID = gl_PrimitiveIDIn; + EmitVertex(); + } + EndPrimitive(); +} " 29: String "int" 36: String "i" @@ -49,9 +118,10 @@ spv.debuginfo.glsl.geom 191: String "lPos" 210: String "outLightVec" 219: String "outViewVec" - 251: String "gl_ViewportIndex" - 257: String "gl_PrimitiveID" - 261: String "gl_PrimitiveIDIn" + 238: String "" + 252: String "gl_ViewportIndex" + 258: String "gl_PrimitiveID" + 262: String "gl_PrimitiveIDIn" SourceExtension "GL_ARB_viewport_array" Name 14 "main" Name 34 "i" @@ -82,9 +152,9 @@ spv.debuginfo.glsl.geom MemberName 225(gl_PerVertex) 2 "gl_ClipDistance" MemberName 225(gl_PerVertex) 3 "gl_CullDistance" Name 236 "" - Name 249 "gl_ViewportIndex" - Name 255 "gl_PrimitiveID" - Name 259 "gl_PrimitiveIDIn" + Name 250 "gl_ViewportIndex" + Name 256 "gl_PrimitiveID" + Name 260 "gl_PrimitiveIDIn" Decorate 64(outNormal) Location 0 Decorate 74 ArrayStride 64 Decorate 76 ArrayStride 64 @@ -114,9 +184,9 @@ spv.debuginfo.glsl.geom MemberDecorate 225(gl_PerVertex) 2 BuiltIn ClipDistance MemberDecorate 225(gl_PerVertex) 3 BuiltIn CullDistance Decorate 225(gl_PerVertex) Block - Decorate 249(gl_ViewportIndex) BuiltIn ViewportIndex - Decorate 255(gl_PrimitiveID) BuiltIn PrimitiveId - Decorate 259(gl_PrimitiveIDIn) BuiltIn PrimitiveId + Decorate 250(gl_ViewportIndex) BuiltIn ViewportIndex + Decorate 256(gl_PrimitiveID) BuiltIn PrimitiveId + Decorate 260(gl_PrimitiveIDIn) BuiltIn PrimitiveId 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -248,21 +318,21 @@ spv.debuginfo.glsl.geom 234: TypePointer Output 225(gl_PerVertex) 235: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 232 13 12 236: 234(ptr) Variable Output - 237: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 2 232 18 233 12 21 2 236 68 - 244: TypePointer Output 69(fvec4) - 245: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 70 13 12 - 247: TypePointer Output 28(int) - 248: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 13 12 -249(gl_ViewportIndex): 247(ptr) Variable Output - 252: 7(int) Constant 64 - 250: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 251 30 18 252 12 21 251 249(gl_ViewportIndex) 68 -255(gl_PrimitiveID): 247(ptr) Variable Output - 258: 7(int) Constant 65 - 256: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 257 30 18 258 12 21 257 255(gl_PrimitiveID) 68 -259(gl_PrimitiveIDIn): 96(ptr) Variable Input - 260: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 261 30 18 258 12 21 261 259(gl_PrimitiveIDIn) 68 - 265: 7(int) Constant 66 - 272: 7(int) Constant 68 + 237: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 238 232 18 233 12 21 238 236 68 + 245: TypePointer Output 69(fvec4) + 246: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 70 13 12 + 248: TypePointer Output 28(int) + 249: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 30 13 12 +250(gl_ViewportIndex): 248(ptr) Variable Output + 253: 7(int) Constant 64 + 251: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 252 30 18 253 12 21 252 250(gl_ViewportIndex) 68 +256(gl_PrimitiveID): 248(ptr) Variable Output + 259: 7(int) Constant 65 + 257: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 258 30 18 259 12 21 258 256(gl_PrimitiveID) 68 +260(gl_PrimitiveIDIn): 96(ptr) Variable Input + 261: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 262 30 18 259 12 21 262 260(gl_PrimitiveIDIn) 68 + 266: 7(int) Constant 66 + 273: 7(int) Constant 68 14(main): 4 Function None 5 15: Label 34(i): 31(ptr) Variable Function @@ -348,33 +418,33 @@ spv.debuginfo.glsl.geom 223: 60(fvec3) VectorShuffle 221 221 0 1 2 224: 60(fvec3) FNegate 223 Store 217(outViewVec) 224 - 239: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 233 233 12 12 - 238: 28(int) Load 98(gl_InvocationID) - 240: 104(ptr) AccessChain 92(ubo) 41 238 - 241: 71 Load 240 - 242: 69(fvec4) Load 176(worldPos) - 243: 69(fvec4) MatrixTimesVector 241 242 - 246: 244(ptr) AccessChain 236 41 - Store 246 243 - 254: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 252 252 12 12 - 253: 28(int) Load 98(gl_InvocationID) - Store 249(gl_ViewportIndex) 253 - 263: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 258 258 12 12 - 262: 28(int) Load 259(gl_PrimitiveIDIn) - Store 255(gl_PrimitiveID) 262 - 264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 265 265 12 12 + 240: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 233 233 12 12 + 239: 28(int) Load 98(gl_InvocationID) + 241: 104(ptr) AccessChain 92(ubo) 41 239 + 242: 71 Load 241 + 243: 69(fvec4) Load 176(worldPos) + 244: 69(fvec4) MatrixTimesVector 242 243 + 247: 245(ptr) AccessChain 236 41 + Store 247 244 + 255: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 253 253 12 12 + 254: 28(int) Load 98(gl_InvocationID) + Store 250(gl_ViewportIndex) 254 + 264: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 259 259 12 12 + 263: 28(int) Load 260(gl_PrimitiveIDIn) + Store 256(gl_PrimitiveID) 263 + 265: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 266 266 12 12 EmitVertex Branch 45 45: Label - 267: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 37 37 12 12 - 266: 28(int) Load 34(i) - 269: 28(int) IAdd 266 95 - Store 34(i) 269 + 268: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 269: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 37 37 12 12 + 267: 28(int) Load 34(i) + 270: 28(int) IAdd 267 95 + Store 34(i) 270 Branch 42 44: Label - 270: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 272 272 12 12 + 271: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 272: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 273 273 12 12 EndPrimitive Return FunctionEnd diff --git a/Test/baseResults/spv.debuginfo.glsl.tesc.out b/Test/baseResults/spv.debuginfo.glsl.tesc.out index a1aa38b8..8a0308a4 100644 --- a/Test/baseResults/spv.debuginfo.glsl.tesc.out +++ b/Test/baseResults/spv.debuginfo.glsl.tesc.out @@ -10,7 +10,7 @@ spv.debuginfo.glsl.tesc MemoryModel Logical GLSL450 EntryPoint TessellationControl 14 "main" 260 265 294 383 399 516 532 542 557 ExecutionMode 14 OutputVertices 4 - 2: String "" + 2: String "spv.debuginfo.glsl.tesc" 8: String "uint" 17: String "float" 31: String "screenSpaceTessFactor" @@ -21,6 +21,146 @@ spv.debuginfo.glsl.tesc // OpModuleProcessed keep-uncalled // OpModuleProcessed entry-point main #line 1 +/* +The MIT License (MIT) + +Copyright (c) 2022 Sascha Willems + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#version 450 + +layout(set = 0, binding = 0) uniform UBO +{ + mat4 projection; + mat4 modelview; + vec4 lightPos; + vec4 frustumPlanes[6]; + float displacementFactor; + float tessellationFactor; + vec2 viewportDim; + float tessellatedEdgeSize; +} ubo; + +layout(set = 0, binding = 1) uniform sampler2D samplerHeight; + +layout (vertices = 4) out; + +layout (location = 0) in vec3 inNormal[]; +layout (location = 1) in vec2 inUV[]; + +layout (location = 0) out vec3 outNormal[4]; +layout (location = 1) out vec2 outUV[4]; + +// Calculate the tessellation factor based on screen space +// dimensions of the edge +float screenSpaceTessFactor(vec4 p0, vec4 p1) +{ + // Calculate edge mid point + vec4 midPoint = 0.5 * (p0 + p1); + // Sphere radius as distance between the control points + float radius = distance(p0, p1) / 2.0; + + // View space + vec4 v0 = ubo.modelview * midPoint; + + // Project into clip space + vec4 clip0 = (ubo.projection * (v0 - vec4(radius, vec3(0.0)))); + vec4 clip1 = (ubo.projection * (v0 + vec4(radius, vec3(0.0)))); + + // Get normalized device coordinates + clip0 /= clip0.w; + clip1 /= clip1.w; + + // Convert to viewport coordinates + clip0.xy *= ubo.viewportDim; + clip1.xy *= ubo.viewportDim; + + // Return the tessellation factor based on the screen size + // given by the distance of the two edge control points in screen space + // and a reference (min.) tessellation size for the edge set by the application + return clamp(distance(clip0, clip1) / ubo.tessellatedEdgeSize * ubo.tessellationFactor, 1.0, 64.0); +} + +// Checks the current's patch visibility against the frustum using a sphere check +// Sphere radius is given by the patch size +bool frustumCheck() +{ + // Fixed radius (increase if patch size is increased in example) + const float radius = 8.0f; + vec4 pos = gl_in[gl_InvocationID].gl_Position; + pos.y -= textureLod(samplerHeight, inUV[0], 0.0).r * ubo.displacementFactor; + + // Check sphere against frustum planes + for (int i = 0; i < 6; i++) { + if (dot(pos, ubo.frustumPlanes[i]) + radius < 0.0) + { + return false; + } + } + return true; +} + +void main() +{ + if (gl_InvocationID == 0) + { + if (!frustumCheck()) + { + gl_TessLevelInner[0] = 0.0; + gl_TessLevelInner[1] = 0.0; + gl_TessLevelOuter[0] = 0.0; + gl_TessLevelOuter[1] = 0.0; + gl_TessLevelOuter[2] = 0.0; + gl_TessLevelOuter[3] = 0.0; + } + else + { + if (ubo.tessellationFactor > 0.0) + { + gl_TessLevelOuter[0] = screenSpaceTessFactor(gl_in[3].gl_Position, gl_in[0].gl_Position); + gl_TessLevelOuter[1] = screenSpaceTessFactor(gl_in[0].gl_Position, gl_in[1].gl_Position); + gl_TessLevelOuter[2] = screenSpaceTessFactor(gl_in[1].gl_Position, gl_in[2].gl_Position); + gl_TessLevelOuter[3] = screenSpaceTessFactor(gl_in[2].gl_Position, gl_in[3].gl_Position); + gl_TessLevelInner[0] = mix(gl_TessLevelOuter[0], gl_TessLevelOuter[3], 0.5); + gl_TessLevelInner[1] = mix(gl_TessLevelOuter[2], gl_TessLevelOuter[1], 0.5); + } + else + { + // Tessellation factor can be set to zero by example + // to demonstrate a simple passthrough + gl_TessLevelInner[0] = 1.0; + gl_TessLevelInner[1] = 1.0; + gl_TessLevelOuter[0] = 1.0; + gl_TessLevelOuter[1] = 1.0; + gl_TessLevelOuter[2] = 1.0; + gl_TessLevelOuter[3] = 1.0; + } + } + + } + + gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position; + outNormal[gl_InvocationID] = inNormal[gl_InvocationID]; + outUV[gl_InvocationID] = inUV[gl_InvocationID]; +} " 40: String "p0" 46: String "p1" diff --git a/Test/baseResults/spv.debuginfo.glsl.tese.out b/Test/baseResults/spv.debuginfo.glsl.tese.out index e16e274d..a5cb5029 100644 --- a/Test/baseResults/spv.debuginfo.glsl.tese.out +++ b/Test/baseResults/spv.debuginfo.glsl.tese.out @@ -1,18 +1,18 @@ spv.debuginfo.glsl.tese // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 356 +// Id's are bound by 357 Capability Tessellation Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint TessellationEvaluation 14 "main" 47 66 93 116 143 183 300 315 323 336 343 + EntryPoint TessellationEvaluation 14 "main" 47 66 93 116 143 183 300 316 324 337 344 ExecutionMode 14 Quads ExecutionMode 14 SpacingEqual ExecutionMode 14 VertexOrderCw - 2: String "" + 2: String "spv.debuginfo.glsl.tese" 8: String "uint" 16: String "main" 19: String "// OpModuleProcessed auto-map-locations @@ -22,6 +22,84 @@ spv.debuginfo.glsl.tese // OpModuleProcessed keep-uncalled // OpModuleProcessed entry-point main #line 1 +/* +The MIT License (MIT) + +Copyright (c) 2022 Sascha Willems + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#version 450 + +layout (set = 0, binding = 0) uniform UBO +{ + mat4 projection; + mat4 modelview; + vec4 lightPos; + vec4 frustumPlanes[6]; + float displacementFactor; + float tessellationFactor; + vec2 viewportDim; + float tessellatedEdgeSize; +} ubo; + +layout (set = 0, binding = 1) uniform sampler2D displacementMap; + +layout(quads, equal_spacing, cw) in; + +layout (location = 0) in vec3 inNormal[]; +layout (location = 1) in vec2 inUV[]; + +layout (location = 0) out vec3 outNormal; +layout (location = 1) out vec2 outUV; +layout (location = 2) out vec3 outViewVec; +layout (location = 3) out vec3 outLightVec; +layout (location = 4) out vec3 outEyePos; +layout (location = 5) out vec3 outWorldPos; + +void main() +{ + // Interpolate UV coordinates + vec2 uv1 = mix(inUV[0], inUV[1], gl_TessCoord.x); + vec2 uv2 = mix(inUV[3], inUV[2], gl_TessCoord.x); + outUV = mix(uv1, uv2, gl_TessCoord.y); + + vec3 n1 = mix(inNormal[0], inNormal[1], gl_TessCoord.x); + vec3 n2 = mix(inNormal[3], inNormal[2], gl_TessCoord.x); + outNormal = mix(n1, n2, gl_TessCoord.y); + + // Interpolate positions + vec4 pos1 = mix(gl_in[0].gl_Position, gl_in[1].gl_Position, gl_TessCoord.x); + vec4 pos2 = mix(gl_in[3].gl_Position, gl_in[2].gl_Position, gl_TessCoord.x); + vec4 pos = mix(pos1, pos2, gl_TessCoord.y); + // Displace + pos.y -= textureLod(displacementMap, outUV, 0.0).r * ubo.displacementFactor; + // Perspective projection + gl_Position = ubo.projection * ubo.modelview * pos; + + // Calculate vectors for lighting based on tessellated position + outViewVec = -pos.xyz; + outLightVec = normalize(ubo.lightPos.xyz + outViewVec); + outWorldPos = pos.xyz; + outEyePos = vec3(ubo.modelview * pos); +} " 29: String "float" 38: String "uv1" @@ -55,10 +133,11 @@ spv.debuginfo.glsl.tese 266: String "viewportDim" 270: String "UBO" 275: String "ubo" - 317: String "outViewVec" - 325: String "outLightVec" - 338: String "outWorldPos" - 345: String "outEyePos" + 302: String "" + 318: String "outViewVec" + 326: String "outLightVec" + 339: String "outWorldPos" + 346: String "outEyePos" Name 14 "main" Name 36 "uv1" Name 47 "inUV" @@ -95,10 +174,10 @@ spv.debuginfo.glsl.tese MemberName 288(gl_PerVertex) 2 "gl_ClipDistance" MemberName 288(gl_PerVertex) 3 "gl_CullDistance" Name 300 "" - Name 315 "outViewVec" - Name 323 "outLightVec" - Name 336 "outWorldPos" - Name 343 "outEyePos" + Name 316 "outViewVec" + Name 324 "outLightVec" + Name 337 "outWorldPos" + Name 344 "outEyePos" Decorate 47(inUV) Location 1 Decorate 66(gl_TessCoord) BuiltIn TessCoord Decorate 93(outUV) Location 1 @@ -132,10 +211,10 @@ spv.debuginfo.glsl.tese MemberDecorate 288(gl_PerVertex) 2 BuiltIn ClipDistance MemberDecorate 288(gl_PerVertex) 3 BuiltIn CullDistance Decorate 288(gl_PerVertex) Block - Decorate 315(outViewVec) Location 2 - Decorate 323(outLightVec) Location 3 - Decorate 336(outWorldPos) Location 5 - Decorate 343(outEyePos) Location 4 + Decorate 316(outViewVec) Location 2 + Decorate 324(outLightVec) Location 3 + Decorate 337(outWorldPos) Location 5 + Decorate 344(outEyePos) Location 4 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -292,25 +371,25 @@ spv.debuginfo.glsl.tese 298: TypePointer Output 288(gl_PerVertex) 299: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 296 13 12 300: 298(ptr) Variable Output - 301: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 2 296 18 297 12 21 2 300 50 - 302: TypePointer Uniform 243 - 303: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 244 24 12 - 312: TypePointer Output 154(fvec4) - 313: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 13 12 - 315(outViewVec): 141(ptr) Variable Output - 318: 7(int) Constant 74 - 316: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 317 63 18 318 12 21 317 315(outViewVec) 50 -323(outLightVec): 141(ptr) Variable Output - 326: 7(int) Constant 75 - 324: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 325 63 18 326 12 21 325 323(outLightVec) 50 - 327: TypePointer Uniform 154(fvec4) - 328: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 24 12 -336(outWorldPos): 141(ptr) Variable Output - 339: 7(int) Constant 76 - 337: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 338 63 18 339 12 21 338 336(outWorldPos) 50 - 343(outEyePos): 141(ptr) Variable Output - 346: 7(int) Constant 77 - 344: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 345 63 18 346 12 21 345 343(outEyePos) 50 + 301: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 302 296 18 297 12 21 302 300 50 + 303: TypePointer Uniform 243 + 304: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 244 24 12 + 313: TypePointer Output 154(fvec4) + 314: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 13 12 + 316(outViewVec): 141(ptr) Variable Output + 319: 7(int) Constant 74 + 317: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 318 63 18 319 12 21 318 316(outViewVec) 50 +324(outLightVec): 141(ptr) Variable Output + 327: 7(int) Constant 75 + 325: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 326 63 18 327 12 21 326 324(outLightVec) 50 + 328: TypePointer Uniform 154(fvec4) + 329: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 155 24 12 +337(outWorldPos): 141(ptr) Variable Output + 340: 7(int) Constant 76 + 338: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 339 63 18 340 12 21 339 337(outWorldPos) 50 + 344(outEyePos): 141(ptr) Variable Output + 347: 7(int) Constant 77 + 345: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 346 63 18 347 12 21 346 344(outEyePos) 50 14(main): 4 Function None 5 15: Label 36(uv1): 33(ptr) Variable Function @@ -427,42 +506,42 @@ spv.debuginfo.glsl.tese 286: 28(float) FSub 285 281 287: 282(ptr) AccessChain 210(pos) 22 Store 287 286 - 305: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 297 297 12 12 - 304: 302(ptr) AccessChain 273(ubo) 54 - 306: 243 Load 304 - 307: 302(ptr) AccessChain 273(ubo) 59 - 308: 243 Load 307 - 309: 243 MatrixTimesMatrix 306 308 - 310: 154(fvec4) Load 210(pos) - 311: 154(fvec4) MatrixTimesVector 309 310 - 314: 312(ptr) AccessChain 300 54 - Store 314 311 - 320: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 318 318 12 12 - 319: 154(fvec4) Load 210(pos) - 321: 62(fvec3) VectorShuffle 319 319 0 1 2 - 322: 62(fvec3) FNegate 321 - Store 315(outViewVec) 322 - 330: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 326 326 12 12 - 329: 327(ptr) AccessChain 273(ubo) 84 - 331: 154(fvec4) Load 329 - 332: 62(fvec3) VectorShuffle 331 331 0 1 2 - 333: 62(fvec3) Load 315(outViewVec) - 334: 62(fvec3) FAdd 332 333 - 335: 62(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 334 - Store 323(outLightVec) 335 - 341: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 339 339 12 12 - 340: 154(fvec4) Load 210(pos) - 342: 62(fvec3) VectorShuffle 340 340 0 1 2 - Store 336(outWorldPos) 342 - 348: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 346 346 12 12 - 347: 302(ptr) AccessChain 273(ubo) 59 - 349: 243 Load 347 - 350: 154(fvec4) Load 210(pos) - 351: 154(fvec4) MatrixTimesVector 349 350 - 352: 28(float) CompositeExtract 351 0 - 353: 28(float) CompositeExtract 351 1 - 354: 28(float) CompositeExtract 351 2 - 355: 62(fvec3) CompositeConstruct 352 353 354 - Store 343(outEyePos) 355 + 306: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 297 297 12 12 + 305: 303(ptr) AccessChain 273(ubo) 54 + 307: 243 Load 305 + 308: 303(ptr) AccessChain 273(ubo) 59 + 309: 243 Load 308 + 310: 243 MatrixTimesMatrix 307 309 + 311: 154(fvec4) Load 210(pos) + 312: 154(fvec4) MatrixTimesVector 310 311 + 315: 313(ptr) AccessChain 300 54 + Store 315 312 + 321: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 319 319 12 12 + 320: 154(fvec4) Load 210(pos) + 322: 62(fvec3) VectorShuffle 320 320 0 1 2 + 323: 62(fvec3) FNegate 322 + Store 316(outViewVec) 323 + 331: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 327 327 12 12 + 330: 328(ptr) AccessChain 273(ubo) 84 + 332: 154(fvec4) Load 330 + 333: 62(fvec3) VectorShuffle 332 332 0 1 2 + 334: 62(fvec3) Load 316(outViewVec) + 335: 62(fvec3) FAdd 333 334 + 336: 62(fvec3) ExtInst 3(GLSL.std.450) 69(Normalize) 335 + Store 324(outLightVec) 336 + 342: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 340 340 12 12 + 341: 154(fvec4) Load 210(pos) + 343: 62(fvec3) VectorShuffle 341 341 0 1 2 + Store 337(outWorldPos) 343 + 349: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 347 347 12 12 + 348: 303(ptr) AccessChain 273(ubo) 59 + 350: 243 Load 348 + 351: 154(fvec4) Load 210(pos) + 352: 154(fvec4) MatrixTimesVector 350 351 + 353: 28(float) CompositeExtract 352 0 + 354: 28(float) CompositeExtract 352 1 + 355: 28(float) CompositeExtract 352 2 + 356: 62(fvec3) CompositeConstruct 353 354 355 + Store 344(outEyePos) 356 Return FunctionEnd diff --git a/Test/baseResults/spv.debuginfo.glsl.vert.out b/Test/baseResults/spv.debuginfo.glsl.vert.out index 3b7aaeaa..e635c5ef 100644 --- a/Test/baseResults/spv.debuginfo.glsl.vert.out +++ b/Test/baseResults/spv.debuginfo.glsl.vert.out @@ -1,15 +1,15 @@ spv.debuginfo.glsl.vert // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 444 +// Id's are bound by 445 Capability Shader Extension "SPV_KHR_non_semantic_info" 1: ExtInstImport "NonSemantic.Shader.DebugInfo.100" 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 14 "main" 35 42 47 55 65 83 305 323 328 353 370 389 427 436 - 2: String "" + EntryPoint Vertex 14 "main" 35 42 47 55 65 83 305 323 328 353 371 390 428 437 + 2: String "spv.debuginfo.glsl.vert" 8: String "uint" 16: String "main" 19: String "// OpModuleProcessed auto-map-locations @@ -19,6 +19,111 @@ spv.debuginfo.glsl.vert // OpModuleProcessed keep-uncalled // OpModuleProcessed entry-point main #line 1 +/* +The MIT License (MIT) + +Copyright (c) 2022 Sascha Willems + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#version 450 + +// Vertex attributes +layout (location = 0) in vec3 inPos; +layout (location = 1) in vec3 inNormal; +layout (location = 2) in vec2 inUV; +layout (location = 3) in vec3 inColor; + +// Instanced attributes +layout (location = 4) in vec3 instancePos; +layout (location = 5) in vec3 instanceRot; +layout (location = 6) in float instanceScale; +layout (location = 7) in int instanceTexIndex; + +layout (binding = 0) uniform UBO +{ + mat4 projection; + mat4 modelview; + vec4 lightPos; + float locSpeed; + float globSpeed; +} ubo; + +layout (location = 0) out vec3 outNormal; +layout (location = 1) out vec3 outColor; +layout (location = 2) out vec3 outUV; +layout (location = 3) out vec3 outViewVec; +layout (location = 4) out vec3 outLightVec; + +void main() +{ + outColor = inColor; + outUV = vec3(inUV, instanceTexIndex); + + mat3 mx, my, mz; + + // rotate around x + float s = sin(instanceRot.x + ubo.locSpeed); + float c = cos(instanceRot.x + ubo.locSpeed); + + mx[0] = vec3(c, s, 0.0); + mx[1] = vec3(-s, c, 0.0); + mx[2] = vec3(0.0, 0.0, 1.0); + + // rotate around y + s = sin(instanceRot.y + ubo.locSpeed); + c = cos(instanceRot.y + ubo.locSpeed); + + my[0] = vec3(c, 0.0, s); + my[1] = vec3(0.0, 1.0, 0.0); + my[2] = vec3(-s, 0.0, c); + + // rot around z + s = sin(instanceRot.z + ubo.locSpeed); + c = cos(instanceRot.z + ubo.locSpeed); + + mz[0] = vec3(1.0, 0.0, 0.0); + mz[1] = vec3(0.0, c, s); + mz[2] = vec3(0.0, -s, c); + + mat3 rotMat = mz * my * mx; + + mat4 gRotMat; + s = sin(instanceRot.y + ubo.globSpeed); + c = cos(instanceRot.y + ubo.globSpeed); + gRotMat[0] = vec4(c, 0.0, s, 0.0); + gRotMat[1] = vec4(0.0, 1.0, 0.0, 0.0); + gRotMat[2] = vec4(-s, 0.0, c, 0.0); + gRotMat[3] = vec4(0.0, 0.0, 0.0, 1.0); + + vec4 locPos = vec4(inPos.xyz * rotMat, 1.0); + vec4 pos = vec4((locPos.xyz * instanceScale) + instancePos, 1.0); + + gl_Position = ubo.projection * ubo.modelview * gRotMat * pos; + outNormal = mat3(ubo.modelview * gRotMat) * inverse(rotMat) * inNormal; + + pos = ubo.modelview * vec4(inPos.xyz + instancePos, 1.0); + vec3 lPos = mat3(ubo.modelview) * ubo.lightPos.xyz; + outLightVec = lPos - pos.xyz; + outViewVec = -pos.xyz; +} " 29: String "float" 37: String "outColor" @@ -50,11 +155,12 @@ spv.debuginfo.glsl.vert 344: String "gl_PointSize" 346: String "gl_CullDistance" 349: String "gl_PerVertex" - 372: String "outNormal" - 391: String "inNormal" - 408: String "lPos" - 429: String "outLightVec" - 438: String "outViewVec" + 355: String "" + 373: String "outNormal" + 392: String "inNormal" + 409: String "lPos" + 430: String "outLightVec" + 439: String "outViewVec" Name 14 "main" Name 35 "outColor" Name 42 "inColor" @@ -87,11 +193,11 @@ spv.debuginfo.glsl.vert MemberName 339(gl_PerVertex) 2 "gl_ClipDistance" MemberName 339(gl_PerVertex) 3 "gl_CullDistance" Name 353 "" - Name 370 "outNormal" - Name 389 "inNormal" - Name 406 "lPos" - Name 427 "outLightVec" - Name 436 "outViewVec" + Name 371 "outNormal" + Name 390 "inNormal" + Name 407 "lPos" + Name 428 "outLightVec" + Name 437 "outViewVec" Decorate 35(outColor) Location 1 Decorate 42(inColor) Location 3 Decorate 47(outUV) Location 2 @@ -118,10 +224,10 @@ spv.debuginfo.glsl.vert MemberDecorate 339(gl_PerVertex) 2 BuiltIn ClipDistance MemberDecorate 339(gl_PerVertex) 3 BuiltIn CullDistance Decorate 339(gl_PerVertex) Block - Decorate 370(outNormal) Location 0 - Decorate 389(inNormal) Location 1 - Decorate 427(outLightVec) Location 4 - Decorate 436(outViewVec) Location 3 + Decorate 371(outNormal) Location 0 + Decorate 390(inNormal) Location 1 + Decorate 428(outLightVec) Location 4 + Decorate 437(outViewVec) Location 3 4: TypeVoid 5: TypeFunction 4 7: TypeInt 32 0 @@ -272,27 +378,27 @@ spv.debuginfo.glsl.vert 351: TypePointer Output 339(gl_PerVertex) 352: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 348 13 12 353: 351(ptr) Variable Output - 354: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 2 348 18 350 12 21 2 353 39 - 355: TypePointer Uniform 92 - 356: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 93 24 12 - 367: TypePointer Output 90(fvec4) - 368: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 13 12 - 370(outNormal): 33(ptr) Variable Output - 373: 7(int) Constant 99 - 371: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 372 32 18 373 12 21 372 370(outNormal) 39 - 389(inNormal): 40(ptr) Variable Input - 390: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 391 32 18 373 12 21 391 389(inNormal) 39 - 396: 7(int) Constant 101 - 409: 7(int) Constant 102 - 407: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 408 32 18 409 12 17 23 - 421: TypePointer Uniform 90(fvec4) - 422: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 24 12 -427(outLightVec): 33(ptr) Variable Output - 430: 7(int) Constant 103 - 428: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 429 32 18 430 12 21 429 427(outLightVec) 39 - 436(outViewVec): 33(ptr) Variable Output - 439: 7(int) Constant 104 - 437: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 438 32 18 439 12 21 438 436(outViewVec) 39 + 354: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 355 348 18 350 12 21 355 353 39 + 356: TypePointer Uniform 92 + 357: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 93 24 12 + 368: TypePointer Output 90(fvec4) + 369: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 13 12 + 371(outNormal): 33(ptr) Variable Output + 374: 7(int) Constant 99 + 372: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 373 32 18 374 12 21 373 371(outNormal) 39 + 390(inNormal): 40(ptr) Variable Input + 391: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 392 32 18 374 12 21 392 390(inNormal) 39 + 397: 7(int) Constant 101 + 410: 7(int) Constant 102 + 408: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 26(DebugLocalVariable) 409 32 18 410 12 17 23 + 422: TypePointer Uniform 90(fvec4) + 423: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 91 24 12 +428(outLightVec): 33(ptr) Variable Output + 431: 7(int) Constant 103 + 429: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 430 32 18 431 12 21 430 428(outLightVec) 39 + 437(outViewVec): 33(ptr) Variable Output + 440: 7(int) Constant 104 + 438: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 439 32 18 440 12 21 439 437(outViewVec) 39 14(main): 4 Function None 5 15: Label 76(s): 73(ptr) Variable Function @@ -304,7 +410,7 @@ spv.debuginfo.glsl.vert 272(gRotMat): 270(ptr) Variable Function 299(locPos): 281(ptr) Variable Function 315(pos): 281(ptr) Variable Function - 406(lPos): 151(ptr) Variable Function + 407(lPos): 151(ptr) Variable Function 26: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 27: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 20 20 12 12 25: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 101(DebugFunctionDefinition) 17 14(main) @@ -487,74 +593,74 @@ spv.debuginfo.glsl.vert 335: 28(float) CompositeExtract 332 2 336: 90(fvec4) CompositeConstruct 333 334 335 163 Store 315(pos) 336 - 358: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 350 350 12 12 - 357: 355(ptr) AccessChain 114(ubo) 146 - 359: 92 Load 357 - 360: 355(ptr) AccessChain 114(ubo) 154 - 361: 92 Load 360 - 362: 92 MatrixTimesMatrix 359 361 - 363: 92 Load 272(gRotMat) - 364: 92 MatrixTimesMatrix 362 363 - 365: 90(fvec4) Load 315(pos) - 366: 90(fvec4) MatrixTimesVector 364 365 - 369: 367(ptr) AccessChain 353 146 - Store 369 366 - 375: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 373 373 12 12 - 374: 355(ptr) AccessChain 114(ubo) 154 - 376: 92 Load 374 - 377: 92 Load 272(gRotMat) - 378: 92 MatrixTimesMatrix 376 377 - 379: 90(fvec4) CompositeExtract 378 0 - 380: 31(fvec3) VectorShuffle 379 379 0 1 2 - 381: 90(fvec4) CompositeExtract 378 1 - 382: 31(fvec3) VectorShuffle 381 381 0 1 2 - 383: 90(fvec4) CompositeExtract 378 2 - 384: 31(fvec3) VectorShuffle 383 383 0 1 2 - 385: 136 CompositeConstruct 380 382 384 - 386: 136 Load 242(rotMat) - 387: 136 ExtInst 3(GLSL.std.450) 34(MatrixInverse) 386 - 388: 136 MatrixTimesMatrix 385 387 - 392: 31(fvec3) Load 389(inNormal) - 393: 31(fvec3) MatrixTimesVector 388 392 - Store 370(outNormal) 393 - 395: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 396 396 12 12 - 394: 355(ptr) AccessChain 114(ubo) 154 - 397: 92 Load 394 - 398: 31(fvec3) Load 305(inPos) - 399: 31(fvec3) Load 328(instancePos) - 400: 31(fvec3) FAdd 398 399 - 401: 28(float) CompositeExtract 400 0 - 402: 28(float) CompositeExtract 400 1 - 403: 28(float) CompositeExtract 400 2 - 404: 90(fvec4) CompositeConstruct 401 402 403 163 - 405: 90(fvec4) MatrixTimesVector 397 404 - Store 315(pos) 405 - 411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 409 409 12 12 - 410: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 407 406(lPos) 81 - 412: 355(ptr) AccessChain 114(ubo) 154 - 413: 92 Load 412 - 414: 90(fvec4) CompositeExtract 413 0 - 415: 31(fvec3) VectorShuffle 414 414 0 1 2 - 416: 90(fvec4) CompositeExtract 413 1 - 417: 31(fvec3) VectorShuffle 416 416 0 1 2 - 418: 90(fvec4) CompositeExtract 413 2 - 419: 31(fvec3) VectorShuffle 418 418 0 1 2 - 420: 136 CompositeConstruct 415 417 419 - 423: 421(ptr) AccessChain 114(ubo) 162 - 424: 90(fvec4) Load 423 - 425: 31(fvec3) VectorShuffle 424 424 0 1 2 - 426: 31(fvec3) MatrixTimesVector 420 425 - Store 406(lPos) 426 - 432: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 430 430 12 12 - 431: 31(fvec3) Load 406(lPos) - 433: 90(fvec4) Load 315(pos) - 434: 31(fvec3) VectorShuffle 433 433 0 1 2 - 435: 31(fvec3) FSub 431 434 - Store 427(outLightVec) 435 - 441: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 439 439 12 12 - 440: 90(fvec4) Load 315(pos) - 442: 31(fvec3) VectorShuffle 440 440 0 1 2 - 443: 31(fvec3) FNegate 442 - Store 436(outViewVec) 443 + 359: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 350 350 12 12 + 358: 356(ptr) AccessChain 114(ubo) 146 + 360: 92 Load 358 + 361: 356(ptr) AccessChain 114(ubo) 154 + 362: 92 Load 361 + 363: 92 MatrixTimesMatrix 360 362 + 364: 92 Load 272(gRotMat) + 365: 92 MatrixTimesMatrix 363 364 + 366: 90(fvec4) Load 315(pos) + 367: 90(fvec4) MatrixTimesVector 365 366 + 370: 368(ptr) AccessChain 353 146 + Store 370 367 + 376: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 374 374 12 12 + 375: 356(ptr) AccessChain 114(ubo) 154 + 377: 92 Load 375 + 378: 92 Load 272(gRotMat) + 379: 92 MatrixTimesMatrix 377 378 + 380: 90(fvec4) CompositeExtract 379 0 + 381: 31(fvec3) VectorShuffle 380 380 0 1 2 + 382: 90(fvec4) CompositeExtract 379 1 + 383: 31(fvec3) VectorShuffle 382 382 0 1 2 + 384: 90(fvec4) CompositeExtract 379 2 + 385: 31(fvec3) VectorShuffle 384 384 0 1 2 + 386: 136 CompositeConstruct 381 383 385 + 387: 136 Load 242(rotMat) + 388: 136 ExtInst 3(GLSL.std.450) 34(MatrixInverse) 387 + 389: 136 MatrixTimesMatrix 386 388 + 393: 31(fvec3) Load 390(inNormal) + 394: 31(fvec3) MatrixTimesVector 389 393 + Store 371(outNormal) 394 + 396: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 397 397 12 12 + 395: 356(ptr) AccessChain 114(ubo) 154 + 398: 92 Load 395 + 399: 31(fvec3) Load 305(inPos) + 400: 31(fvec3) Load 328(instancePos) + 401: 31(fvec3) FAdd 399 400 + 402: 28(float) CompositeExtract 401 0 + 403: 28(float) CompositeExtract 401 1 + 404: 28(float) CompositeExtract 401 2 + 405: 90(fvec4) CompositeConstruct 402 403 404 163 + 406: 90(fvec4) MatrixTimesVector 398 405 + Store 315(pos) 406 + 412: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 410 410 12 12 + 411: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 28(DebugDeclare) 408 407(lPos) 81 + 413: 356(ptr) AccessChain 114(ubo) 154 + 414: 92 Load 413 + 415: 90(fvec4) CompositeExtract 414 0 + 416: 31(fvec3) VectorShuffle 415 415 0 1 2 + 417: 90(fvec4) CompositeExtract 414 1 + 418: 31(fvec3) VectorShuffle 417 417 0 1 2 + 419: 90(fvec4) CompositeExtract 414 2 + 420: 31(fvec3) VectorShuffle 419 419 0 1 2 + 421: 136 CompositeConstruct 416 418 420 + 424: 422(ptr) AccessChain 114(ubo) 162 + 425: 90(fvec4) Load 424 + 426: 31(fvec3) VectorShuffle 425 425 0 1 2 + 427: 31(fvec3) MatrixTimesVector 421 426 + Store 407(lPos) 427 + 433: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 431 431 12 12 + 432: 31(fvec3) Load 407(lPos) + 434: 90(fvec4) Load 315(pos) + 435: 31(fvec3) VectorShuffle 434 434 0 1 2 + 436: 31(fvec3) FSub 432 435 + Store 428(outLightVec) 436 + 442: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 440 440 12 12 + 441: 90(fvec4) Load 315(pos) + 443: 31(fvec3) VectorShuffle 441 441 0 1 2 + 444: 31(fvec3) FNegate 443 + Store 437(outViewVec) 444 Return FunctionEnd diff --git a/Test/baseResults/spv.debuginfo.rt_types.glsl.rgen.out b/Test/baseResults/spv.debuginfo.rt_types.glsl.rgen.out index 439fa065..140c9b90 100644 --- a/Test/baseResults/spv.debuginfo.rt_types.glsl.rgen.out +++ b/Test/baseResults/spv.debuginfo.rt_types.glsl.rgen.out @@ -1,7 +1,7 @@ spv.debuginfo.rt_types.glsl.rgen // Module Version 10000 // Generated by (magic number): 8000b -// Id's are bound by 122 +// Id's are bound by 123 Capability RayQueryKHR Capability RayTracingNV @@ -12,7 +12,7 @@ spv.debuginfo.rt_types.glsl.rgen 3: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint RayGenerationKHR 14 "main" - 2: String "" + 2: String "spv.debuginfo.rt_types.glsl.rgen" 8: String "uint" 16: String "main" 19: String "// OpModuleProcessed auto-map-locations @@ -22,6 +22,29 @@ spv.debuginfo.rt_types.glsl.rgen // OpModuleProcessed keep-uncalled // OpModuleProcessed entry-point main #line 1 +#version 460 +#extension GL_NV_ray_tracing : enable +#extension GL_EXT_ray_query : enable +layout(binding = 0, set = 0) uniform accelerationStructureEXT acc0; + +layout(shaderRecordNV) buffer block +{ + vec3 dir; + vec3 origin; +}; + +void main() +{ + rayQueryEXT localRayQuery; + uint rayFlags = gl_RayFlagsOpaqueEXT | gl_RayFlagsSkipClosestHitShaderEXT; + float tMin = 0.f; + float tMax = 1000.f; + rayQueryInitializeEXT(localRayQuery, acc0, rayFlags, 0xFF , origin, tMin, dir, tMax); + if (!rayQueryProceedEXT(localRayQuery)) + { + rayQueryTerminateEXT(localRayQuery); + } +} " 33: String "rayFlags" 40: String "float" @@ -35,8 +58,9 @@ spv.debuginfo.rt_types.glsl.rgen 78: String "acc0" 87: String "origin" 90: String "block" - 97: String "int" - 110: String "bool" + 96: String "" + 98: String "int" + 111: String "bool" SourceExtension "GL_EXT_ray_query" SourceExtension "GL_NV_ray_tracing" Name 14 "main" @@ -113,17 +137,17 @@ spv.debuginfo.rt_types.glsl.rgen 92: 7(int) Constant 5343 93: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 89 92 12 94: 91(ptr) Variable ShaderRecordBufferKHR - 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 2 89 18 61 12 21 2 94 69 - 96: TypeInt 32 1 - 98: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 97 10 23 12 - 99: 96(int) Constant 1 - 100: TypePointer ShaderRecordBufferKHR 83(fvec3) - 101: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 84 92 12 - 105: 96(int) Constant 0 - 109: TypeBool - 111: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 110 10 24 12 - 114: 7(int) Constant 19 - 120: 7(int) Constant 21 + 95: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 18(DebugGlobalVariable) 96 89 18 61 12 21 96 94 69 + 97: TypeInt 32 1 + 99: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 98 10 23 12 + 100: 97(int) Constant 1 + 101: TypePointer ShaderRecordBufferKHR 83(fvec3) + 102: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 3(DebugTypePointer) 84 92 12 + 106: 97(int) Constant 0 + 110: TypeBool + 112: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 2(DebugTypeBasic) 111 10 24 12 + 115: 7(int) Constant 19 + 121: 7(int) Constant 21 14(main): 4 Function None 5 15: Label 31(rayFlags): 28(ptr) Variable Function @@ -144,24 +168,24 @@ spv.debuginfo.rt_types.glsl.rgen 80: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 61 61 12 12 79: 70 Load 76(acc0) 81: 7(int) Load 31(rayFlags) - 102: 100(ptr) AccessChain 94 99 - 103: 83(fvec3) Load 102 - 104: 39(float) Load 44(tMin) - 106: 100(ptr) AccessChain 94 105 - 107: 83(fvec3) Load 106 - 108: 39(float) Load 51(tMax) - RayQueryInitializeKHR 66(localRayQuery) 79 81 82 103 104 107 108 - 113: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 114 114 12 12 - 112: 109(bool) RayQueryProceedKHR 66(localRayQuery) - 115: 109(bool) LogicalNot 112 - SelectionMerge 117 None - BranchConditional 115 116 117 - 116: Label - 118: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 - 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 120 120 12 12 + 103: 101(ptr) AccessChain 94 100 + 104: 83(fvec3) Load 103 + 105: 39(float) Load 44(tMin) + 107: 101(ptr) AccessChain 94 106 + 108: 83(fvec3) Load 107 + 109: 39(float) Load 51(tMax) + RayQueryInitializeKHR 66(localRayQuery) 79 81 82 104 105 108 109 + 114: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 115 115 12 12 + 113: 110(bool) RayQueryProceedKHR 66(localRayQuery) + 116: 110(bool) LogicalNot 113 + SelectionMerge 118 None + BranchConditional 116 117 118 + 117: Label + 119: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + 120: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 103(DebugLine) 18 121 121 12 12 RayQueryTerminateKHR 66(localRayQuery) - Branch 117 - 117: Label - 121: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 + Branch 118 + 118: Label + 122: 4 ExtInst 1(NonSemantic.Shader.DebugInfo.100) 23(DebugScope) 17 Return FunctionEnd diff --git a/Test/baseResults/spv.debuginfo.scalar_types.glsl.frag.out b/Test/baseResults/spv.debuginfo.scalar_types.glsl.frag.out index 4262ad03..e914cb66 100644 --- a/Test/baseResults/spv.debuginfo.scalar_types.glsl.frag.out +++ b/Test/baseResults/spv.debuginfo.scalar_types.glsl.frag.out @@ -15,7 +15,7 @@ spv.debuginfo.scalar_types.glsl.frag MemoryModel Logical GLSL450 EntryPoint Fragment 14 "main" ExecutionMode 14 OriginUpperLeft - 2: String "" + 2: String "spv.debuginfo.scalar_types.glsl.frag" 8: String "uint" 16: String "main" 19: String "// OpModuleProcessed auto-map-locations @@ -25,7 +25,61 @@ spv.debuginfo.scalar_types.glsl.frag // OpModuleProcessed keep-uncalled // OpModuleProcessed entry-point main #line 1 -" +/* +The MIT License (MIT) + +Copyright (c) 2023 NVIDIA CORPORATION. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#version 460 + +#extension GL_EXT_shader_explicit_arithmetic_types : require + +bool VAR_bool; +int VAR_int; +uint VAR_uint; +float VAR_float; +double VAR_double; +int8_t VAR_int8_t; +uint8_t VAR_uint8_t; +int16_t VAR_int16_t; +uint16_t VAR_uint16_t; +int64_t VAR_int64_t; +uint64_t VAR_uint64_t; +float16_t VAR_float16_t; + +void main() { + VAR_bool = bool(0); + VAR_int = int(0); + VAR_uint = uint(0); + VAR_float = float(0); + VAR_double = double(0); + VAR_int8_t = int8_t(0); + VAR_uint8_t = uint8_t(0); + VAR_int16_t = int16_t(0); + VAR_uint16_t = uint16_t(0); + VAR_int64_t = int64_t(0); + VAR_uint64_t = uint64_t(0); + VAR_float16_t = float16_t(0); +}" 29: String "bool" 35: String "VAR_bool" 41: String "int" diff --git a/Test/spv.debuginfo.scalar_types.glsl.frag b/Test/spv.debuginfo.scalar_types.glsl.frag index 36595ea7..f385f022 100644 --- a/Test/spv.debuginfo.scalar_types.glsl.frag +++ b/Test/spv.debuginfo.scalar_types.glsl.frag @@ -1,55 +1,55 @@ -/* -The MIT License (MIT) - -Copyright (c) 2023 NVIDIA CORPORATION. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -*/ - -#version 460 - -#extension GL_EXT_shader_explicit_arithmetic_types : require - -bool VAR_bool; -int VAR_int; -uint VAR_uint; -float VAR_float; -double VAR_double; -int8_t VAR_int8_t; -uint8_t VAR_uint8_t; -int16_t VAR_int16_t; -uint16_t VAR_uint16_t; -int64_t VAR_int64_t; -uint64_t VAR_uint64_t; -float16_t VAR_float16_t; - -void main() { - VAR_bool = bool(0); - VAR_int = int(0); - VAR_uint = uint(0); - VAR_float = float(0); - VAR_double = double(0); - VAR_int8_t = int8_t(0); - VAR_uint8_t = uint8_t(0); - VAR_int16_t = int16_t(0); - VAR_uint16_t = uint16_t(0); - VAR_int64_t = int64_t(0); - VAR_uint64_t = uint64_t(0); - VAR_float16_t = float16_t(0); +/* +The MIT License (MIT) + +Copyright (c) 2023 NVIDIA CORPORATION. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + +#version 460 + +#extension GL_EXT_shader_explicit_arithmetic_types : require + +bool VAR_bool; +int VAR_int; +uint VAR_uint; +float VAR_float; +double VAR_double; +int8_t VAR_int8_t; +uint8_t VAR_uint8_t; +int16_t VAR_int16_t; +uint16_t VAR_uint16_t; +int64_t VAR_int64_t; +uint64_t VAR_uint64_t; +float16_t VAR_float16_t; + +void main() { + VAR_bool = bool(0); + VAR_int = int(0); + VAR_uint = uint(0); + VAR_float = float(0); + VAR_double = double(0); + VAR_int8_t = int8_t(0); + VAR_uint8_t = uint8_t(0); + VAR_int16_t = int16_t(0); + VAR_uint16_t = uint16_t(0); + VAR_int64_t = int64_t(0); + VAR_uint64_t = uint64_t(0); + VAR_float16_t = float16_t(0); } \ No newline at end of file diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index 4e1e09fe..e111168a 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -255,7 +255,7 @@ TEST_P(CompileVulkanToNonSemanticShaderDebugInfoTest, FromFile) { loadFileCompileAndCheck(GlobalTestSettings.testRoot, GetParam(), Source::GLSL, Semantics::Vulkan, glslang::EShTargetVulkan_1_0, glslang::EShTargetSpv_1_0, - Target::Spv, true, "", "/baseResults/", false, false, true); + Target::Spv, true, "", "/baseResults/", false, true, true); } // clang-format off