Generate vector constructions more efficiently when sizes match

When two vectors are the same size, there is no need to extract the
components and construct a new vector.
This commit is contained in:
Arcady Goldmints-Orlov 2024-06-21 14:07:50 -04:00 committed by arcady-lunarg
parent 2d8b71fc63
commit 33d517470e
13 changed files with 1777 additions and 1867 deletions

View file

@ -2,7 +2,7 @@ spv.floatFetch.frag
Validation failed
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 3503
// Id's are bound by 3500
Capability Shader
Capability ImageGatherExtended
@ -24,7 +24,7 @@ Validation failed
Extension "SPV_AMD_texture_gather_bias_lod"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 127 138 150 197 283 371 866 873 880 2603 3494 3502
EntryPoint Fragment 4 "main" 127 138 150 197 283 371 866 873 880 2603 3491 3499
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_AMD_texture_gather_bias_lod"
@ -184,12 +184,12 @@ Validation failed
Name 3318 "subpass"
Name 3324 "subpassMS"
Name 3330 "result"
Name 3415 "param"
Name 3494 "fragColor"
Name 3497 "tBuffer"
Name 3499 "t2DMS"
Name 3501 "t2DMSArray"
Name 3502 "bias"
Name 3412 "param"
Name 3491 "fragColor"
Name 3494 "tBuffer"
Name 3496 "t2DMS"
Name 3498 "t2DMSArray"
Name 3499 "bias"
Decorate 124(s1D) DescriptorSet 0
Decorate 124(s1D) Binding 0
Decorate 127(c1) Location 0
@ -284,14 +284,14 @@ Validation failed
Decorate 3324(subpassMS) DescriptorSet 3
Decorate 3324(subpassMS) Binding 1
Decorate 3324(subpassMS) InputAttachmentIndex 0
Decorate 3494(fragColor) Location 0
Decorate 3497(tBuffer) DescriptorSet 2
Decorate 3497(tBuffer) Binding 8
Decorate 3499(t2DMS) DescriptorSet 2
Decorate 3499(t2DMS) Binding 9
Decorate 3501(t2DMSArray) DescriptorSet 2
Decorate 3501(t2DMSArray) Binding 10
Decorate 3502(bias) Location 6
Decorate 3491(fragColor) Location 0
Decorate 3494(tBuffer) DescriptorSet 2
Decorate 3494(tBuffer) Binding 8
Decorate 3496(t2DMS) DescriptorSet 2
Decorate 3496(t2DMS) Binding 9
Decorate 3498(t2DMSArray) DescriptorSet 2
Decorate 3498(t2DMSArray) Binding 10
Decorate 3499(bias) Location 6
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -486,19 +486,19 @@ Validation failed
3322: TypeImage 6(float) SubpassData multi-sampled nonsampled format:Unknown
3323: TypePointer UniformConstant 3322
3324(subpassMS): 3323(ptr) Variable UniformConstant
3493: TypePointer Output 7(fvec4)
3494(fragColor): 3493(ptr) Variable Output
3496: TypePointer UniformConstant 770
3497(tBuffer): 3496(ptr) Variable UniformConstant
3498: TypePointer UniformConstant 781
3499(t2DMS): 3498(ptr) Variable UniformConstant
3500: TypePointer UniformConstant 792
3501(t2DMSArray): 3500(ptr) Variable UniformConstant
3502(bias): 126(ptr) Variable Input
3490: TypePointer Output 7(fvec4)
3491(fragColor): 3490(ptr) Variable Output
3493: TypePointer UniformConstant 770
3494(tBuffer): 3493(ptr) Variable UniformConstant
3495: TypePointer UniformConstant 781
3496(t2DMS): 3495(ptr) Variable UniformConstant
3497: TypePointer UniformConstant 792
3498(t2DMSArray): 3497(ptr) Variable UniformConstant
3499(bias): 126(ptr) Variable Input
4(main): 2 Function None 3
5: Label
3330(result): 63(ptr) Variable Function
3415(param): 63(ptr) Variable Function
3412(param): 63(ptr) Variable Function
Store 3330(result) 120
3331: 7(fvec4) FunctionCall 9(testTexture()
3332: 7(fvec4) Load 3330(result)
@ -578,141 +578,138 @@ Validation failed
3388: 7(fvec4) FAdd 3387 3386
Store 3330(result) 3388
3389: 52(fvec2) FunctionCall 54(testTextureQueryLod()
3390: 6(float) CompositeExtract 3389 0
3391: 6(float) CompositeExtract 3389 1
3392: 52(fvec2) CompositeConstruct 3390 3391
3393: 7(fvec4) Load 3330(result)
3394: 52(fvec2) VectorShuffle 3393 3393 0 1
3395: 52(fvec2) FAdd 3394 3392
3396: 174(ptr) AccessChain 3330(result) 173
3397: 6(float) CompositeExtract 3395 0
Store 3396 3397
3398: 174(ptr) AccessChain 3330(result) 1447
3399: 6(float) CompositeExtract 3395 1
Store 3398 3399
3400: 47(int) FunctionCall 57(testTextureQueryLevels()
3401: 6(float) ConvertSToF 3400
3390: 7(fvec4) Load 3330(result)
3391: 52(fvec2) VectorShuffle 3390 3390 0 1
3392: 52(fvec2) FAdd 3391 3389
3393: 174(ptr) AccessChain 3330(result) 173
3394: 6(float) CompositeExtract 3392 0
Store 3393 3394
3395: 174(ptr) AccessChain 3330(result) 1447
3396: 6(float) CompositeExtract 3392 1
Store 3395 3396
3397: 47(int) FunctionCall 57(testTextureQueryLevels()
3398: 6(float) ConvertSToF 3397
3399: 174(ptr) AccessChain 3330(result) 173
3400: 6(float) Load 3399
3401: 6(float) FAdd 3400 3398
3402: 174(ptr) AccessChain 3330(result) 173
3403: 6(float) Load 3402
3404: 6(float) FAdd 3403 3401
Store 3402 3401
3403: 47(int) FunctionCall 59(testTextureSamples()
3404: 6(float) ConvertSToF 3403
3405: 174(ptr) AccessChain 3330(result) 173
Store 3405 3404
3406: 47(int) FunctionCall 59(testTextureSamples()
3407: 6(float) ConvertSToF 3406
3406: 6(float) Load 3405
3407: 6(float) FAdd 3406 3404
3408: 174(ptr) AccessChain 3330(result) 173
3409: 6(float) Load 3408
3410: 6(float) FAdd 3409 3407
3411: 174(ptr) AccessChain 3330(result) 173
Store 3411 3410
3412: 7(fvec4) FunctionCall 61(testImageLoad()
Store 3408 3407
3409: 7(fvec4) FunctionCall 61(testImageLoad()
3410: 7(fvec4) Load 3330(result)
3411: 7(fvec4) FAdd 3410 3409
Store 3330(result) 3411
3413: 7(fvec4) Load 3330(result)
3414: 7(fvec4) FAdd 3413 3412
Store 3330(result) 3414
Store 3412(param) 3413
3414: 2 FunctionCall 66(testImageStore(vf4;) 3412(param)
3415: 7(fvec4) FunctionCall 68(testSparseTexture()
3416: 7(fvec4) Load 3330(result)
Store 3415(param) 3416
3417: 2 FunctionCall 66(testImageStore(vf4;) 3415(param)
3418: 7(fvec4) FunctionCall 68(testSparseTexture()
3417: 7(fvec4) FAdd 3416 3415
Store 3330(result) 3417
3418: 7(fvec4) FunctionCall 70(testSparseTextureLod()
3419: 7(fvec4) Load 3330(result)
3420: 7(fvec4) FAdd 3419 3418
Store 3330(result) 3420
3421: 7(fvec4) FunctionCall 70(testSparseTextureLod()
3421: 7(fvec4) FunctionCall 72(testSparseTextureOffset()
3422: 7(fvec4) Load 3330(result)
3423: 7(fvec4) FAdd 3422 3421
Store 3330(result) 3423
3424: 7(fvec4) FunctionCall 72(testSparseTextureOffset()
3424: 7(fvec4) FunctionCall 74(testSparseTextureLodOffset()
3425: 7(fvec4) Load 3330(result)
3426: 7(fvec4) FAdd 3425 3424
Store 3330(result) 3426
3427: 7(fvec4) FunctionCall 74(testSparseTextureLodOffset()
3427: 7(fvec4) FunctionCall 76(testSparseTextureGrad()
3428: 7(fvec4) Load 3330(result)
3429: 7(fvec4) FAdd 3428 3427
Store 3330(result) 3429
3430: 7(fvec4) FunctionCall 76(testSparseTextureGrad()
3430: 7(fvec4) FunctionCall 78(testSparseTextureGradOffset()
3431: 7(fvec4) Load 3330(result)
3432: 7(fvec4) FAdd 3431 3430
Store 3330(result) 3432
3433: 7(fvec4) FunctionCall 78(testSparseTextureGradOffset()
3433: 7(fvec4) FunctionCall 80(testSparseTexelFetch()
3434: 7(fvec4) Load 3330(result)
3435: 7(fvec4) FAdd 3434 3433
Store 3330(result) 3435
3436: 7(fvec4) FunctionCall 80(testSparseTexelFetch()
3436: 7(fvec4) FunctionCall 82(testSparseTexelFetchOffset()
3437: 7(fvec4) Load 3330(result)
3438: 7(fvec4) FAdd 3437 3436
Store 3330(result) 3438
3439: 7(fvec4) FunctionCall 82(testSparseTexelFetchOffset()
3439: 7(fvec4) FunctionCall 84(testSparseTextureGather()
3440: 7(fvec4) Load 3330(result)
3441: 7(fvec4) FAdd 3440 3439
Store 3330(result) 3441
3442: 7(fvec4) FunctionCall 84(testSparseTextureGather()
3442: 7(fvec4) FunctionCall 86(testSparseTextureGatherOffset()
3443: 7(fvec4) Load 3330(result)
3444: 7(fvec4) FAdd 3443 3442
Store 3330(result) 3444
3445: 7(fvec4) FunctionCall 86(testSparseTextureGatherOffset()
3445: 7(fvec4) FunctionCall 88(testSparseTextureGatherOffsets()
3446: 7(fvec4) Load 3330(result)
3447: 7(fvec4) FAdd 3446 3445
Store 3330(result) 3447
3448: 7(fvec4) FunctionCall 88(testSparseTextureGatherOffsets()
3448: 7(fvec4) FunctionCall 90(testSparseTextureGatherLod()
3449: 7(fvec4) Load 3330(result)
3450: 7(fvec4) FAdd 3449 3448
Store 3330(result) 3450
3451: 7(fvec4) FunctionCall 90(testSparseTextureGatherLod()
3451: 7(fvec4) FunctionCall 92(testSparseTextureGatherLodOffset()
3452: 7(fvec4) Load 3330(result)
3453: 7(fvec4) FAdd 3452 3451
Store 3330(result) 3453
3454: 7(fvec4) FunctionCall 92(testSparseTextureGatherLodOffset()
3454: 7(fvec4) FunctionCall 94(testSparseTextureGatherLodOffsets()
3455: 7(fvec4) Load 3330(result)
3456: 7(fvec4) FAdd 3455 3454
Store 3330(result) 3456
3457: 7(fvec4) FunctionCall 94(testSparseTextureGatherLodOffsets()
3457: 7(fvec4) FunctionCall 96(testSparseImageLoad()
3458: 7(fvec4) Load 3330(result)
3459: 7(fvec4) FAdd 3458 3457
Store 3330(result) 3459
3460: 7(fvec4) FunctionCall 96(testSparseImageLoad()
3460: 7(fvec4) FunctionCall 98(testSparseTextureClamp()
3461: 7(fvec4) Load 3330(result)
3462: 7(fvec4) FAdd 3461 3460
Store 3330(result) 3462
3463: 7(fvec4) FunctionCall 98(testSparseTextureClamp()
3463: 7(fvec4) FunctionCall 100(testTextureClamp()
3464: 7(fvec4) Load 3330(result)
3465: 7(fvec4) FAdd 3464 3463
Store 3330(result) 3465
3466: 7(fvec4) FunctionCall 100(testTextureClamp()
3466: 7(fvec4) FunctionCall 102(testSparseTextureOffsetClamp()
3467: 7(fvec4) Load 3330(result)
3468: 7(fvec4) FAdd 3467 3466
Store 3330(result) 3468
3469: 7(fvec4) FunctionCall 102(testSparseTextureOffsetClamp()
3469: 7(fvec4) FunctionCall 104(testTextureOffsetClamp()
3470: 7(fvec4) Load 3330(result)
3471: 7(fvec4) FAdd 3470 3469
Store 3330(result) 3471
3472: 7(fvec4) FunctionCall 104(testTextureOffsetClamp()
3472: 7(fvec4) FunctionCall 76(testSparseTextureGrad()
3473: 7(fvec4) Load 3330(result)
3474: 7(fvec4) FAdd 3473 3472
Store 3330(result) 3474
3475: 7(fvec4) FunctionCall 76(testSparseTextureGrad()
3475: 7(fvec4) FunctionCall 27(testTextureGrad()
3476: 7(fvec4) Load 3330(result)
3477: 7(fvec4) FAdd 3476 3475
Store 3330(result) 3477
3478: 7(fvec4) FunctionCall 27(testTextureGrad()
3478: 7(fvec4) FunctionCall 110(testSparseTextureGradOffsetClamp()
3479: 7(fvec4) Load 3330(result)
3480: 7(fvec4) FAdd 3479 3478
Store 3330(result) 3480
3481: 7(fvec4) FunctionCall 110(testSparseTextureGradOffsetClamp()
3481: 7(fvec4) FunctionCall 112(testTextureGradOffsetClamp()
3482: 7(fvec4) Load 3330(result)
3483: 7(fvec4) FAdd 3482 3481
Store 3330(result) 3483
3484: 7(fvec4) FunctionCall 112(testTextureGradOffsetClamp()
3484: 7(fvec4) FunctionCall 114(testCombinedTextureSampler()
3485: 7(fvec4) Load 3330(result)
3486: 7(fvec4) FAdd 3485 3484
Store 3330(result) 3486
3487: 7(fvec4) FunctionCall 114(testCombinedTextureSampler()
3487: 7(fvec4) FunctionCall 116(testSubpassLoad()
3488: 7(fvec4) Load 3330(result)
3489: 7(fvec4) FAdd 3488 3487
Store 3330(result) 3489
3490: 7(fvec4) FunctionCall 116(testSubpassLoad()
3491: 7(fvec4) Load 3330(result)
3492: 7(fvec4) FAdd 3491 3490
Store 3330(result) 3492
3495: 7(fvec4) Load 3330(result)
Store 3494(fragColor) 3495
3492: 7(fvec4) Load 3330(result)
Store 3491(fragColor) 3492
Return
FunctionEnd
9(testTexture(): 7(fvec4) Function None 8