Generate separate stores for partially swizzled memory stores

Full vector and fully specified vector swizzle stores are not affected by this change, only partial swizzles ie swizzles with fewer components than the vector being stored to.

Previously the vector being stored to loaded and any components not specified in the swizzle were used to create a full store to the vector.

While this change generates more SPIR-V instructions, it is necessary for correctness.

Fixes #2518.
This commit is contained in:
Jeremy Hayes 2021-07-16 15:07:16 -06:00
parent 9158061398
commit 6d5b40f051
50 changed files with 31343 additions and 26594 deletions

View file

@ -1,7 +1,7 @@
spv.vulkan110.int16.frag
// Module Version 10300
// Generated by (magic number): 8000a
// Id's are bound by 523
// Id's are bound by 535
Capability Shader
Capability Float16
@ -65,35 +65,35 @@ spv.vulkan110.int16.frag
Name 442 "u64"
Name 445 "u16v4"
Name 457 "bv"
Name 518 "Block"
MemberName 518(Block) 0 "i16"
MemberName 518(Block) 1 "i16v2"
MemberName 518(Block) 2 "i16v3"
MemberName 518(Block) 3 "i16v4"
MemberName 518(Block) 4 "u16"
MemberName 518(Block) 5 "u16v2"
MemberName 518(Block) 6 "u16v3"
MemberName 518(Block) 7 "u16v4"
Name 520 "block"
Name 521 "si16"
Name 522 "su16"
Name 530 "Block"
MemberName 530(Block) 0 "i16"
MemberName 530(Block) 1 "i16v2"
MemberName 530(Block) 2 "i16v3"
MemberName 530(Block) 3 "i16v4"
MemberName 530(Block) 4 "u16"
MemberName 530(Block) 5 "u16v2"
MemberName 530(Block) 6 "u16v3"
MemberName 530(Block) 7 "u16v4"
Name 532 "block"
Name 533 "si16"
Name 534 "su16"
MemberDecorate 24(Uniforms) 0 Offset 0
Decorate 24(Uniforms) Block
Decorate 26 DescriptorSet 0
Decorate 26 Binding 0
MemberDecorate 518(Block) 0 Offset 0
MemberDecorate 518(Block) 1 Offset 4
MemberDecorate 518(Block) 2 Offset 8
MemberDecorate 518(Block) 3 Offset 16
MemberDecorate 518(Block) 4 Offset 24
MemberDecorate 518(Block) 5 Offset 28
MemberDecorate 518(Block) 6 Offset 32
MemberDecorate 518(Block) 7 Offset 40
Decorate 518(Block) Block
Decorate 520(block) DescriptorSet 0
Decorate 520(block) Binding 1
Decorate 521(si16) SpecId 100
Decorate 522(su16) SpecId 101
MemberDecorate 530(Block) 0 Offset 0
MemberDecorate 530(Block) 1 Offset 4
MemberDecorate 530(Block) 2 Offset 8
MemberDecorate 530(Block) 3 Offset 16
MemberDecorate 530(Block) 4 Offset 24
MemberDecorate 530(Block) 5 Offset 28
MemberDecorate 530(Block) 6 Offset 32
MemberDecorate 530(Block) 7 Offset 40
Decorate 530(Block) Block
Decorate 532(block) DescriptorSet 0
Decorate 532(block) Binding 1
Decorate 533(si16) SpecId 100
Decorate 534(su16) SpecId 101
2: TypeVoid
3: TypeFunction 2
14: TypeInt 16 1
@ -185,11 +185,11 @@ spv.vulkan110.int16.frag
443: TypeVector 36(int16_t) 4
444: TypePointer Function 443(i16vec4)
456: TypePointer Function 425(bvec3)
518(Block): TypeStruct 14(int16_t) 52(i16vec2) 197(i16vec3) 432(i16vec4) 36(int16_t) 57(i16vec2) 193(i16vec3) 443(i16vec4)
519: TypePointer Uniform 518(Block)
520(block): 519(ptr) Variable Uniform
521(si16): 14(int16_t) SpecConstant 4294967286
522(su16): 36(int16_t) SpecConstant 20
530(Block): TypeStruct 14(int16_t) 52(i16vec2) 197(i16vec3) 432(i16vec4) 36(int16_t) 57(i16vec2) 193(i16vec3) 443(i16vec4)
531: TypePointer Uniform 530(Block)
532(block): 531(ptr) Variable Uniform
533(si16): 14(int16_t) SpecConstant 4294967286
534(su16): 36(int16_t) SpecConstant 20
4(main): 2 Function None 3
5: Label
Return
@ -674,68 +674,86 @@ spv.vulkan110.int16.frag
463: 14(int16_t) Load 346(i16)
464: 52(i16vec2) CompositeConstruct 463 463
465: 174(bvec2) SLessThan 462 464
466: 425(bvec3) Load 457(bv)
467: 425(bvec3) VectorShuffle 466 465 3 4 2
Store 457(bv) 467
468:193(i16vec3) Load 356(u16v)
469: 36(int16_t) Load 358(u16)
470:193(i16vec3) CompositeConstruct 469 469 469
471: 425(bvec3) ULessThanEqual 468 470
Store 457(bv) 471
472: 52(i16vec2) Load 343(i16v)
473: 14(int16_t) Load 346(i16)
474: 52(i16vec2) CompositeConstruct 473 473
475: 174(bvec2) SLessThanEqual 472 474
476: 425(bvec3) Load 457(bv)
477: 425(bvec3) VectorShuffle 476 475 3 4 2
Store 457(bv) 477
478:193(i16vec3) Load 356(u16v)
479: 36(int16_t) Load 358(u16)
480:193(i16vec3) CompositeConstruct 479 479 479
481: 425(bvec3) UGreaterThan 478 480
Store 457(bv) 481
482: 52(i16vec2) Load 343(i16v)
483: 14(int16_t) Load 346(i16)
484: 52(i16vec2) CompositeConstruct 483 483
485: 174(bvec2) SGreaterThan 482 484
486: 425(bvec3) Load 457(bv)
487: 425(bvec3) VectorShuffle 486 485 3 4 2
Store 457(bv) 487
488:193(i16vec3) Load 356(u16v)
489: 36(int16_t) Load 358(u16)
490:193(i16vec3) CompositeConstruct 489 489 489
491: 425(bvec3) UGreaterThanEqual 488 490
Store 457(bv) 491
492: 52(i16vec2) Load 343(i16v)
493: 14(int16_t) Load 346(i16)
494: 52(i16vec2) CompositeConstruct 493 493
495: 174(bvec2) SGreaterThanEqual 492 494
496: 425(bvec3) Load 457(bv)
497: 425(bvec3) VectorShuffle 496 495 3 4 2
466: 280(ptr) AccessChain 457(bv) 282
467: 173(bool) CompositeExtract 465 0
Store 466 467
468: 280(ptr) AccessChain 457(bv) 264
469: 173(bool) CompositeExtract 465 1
Store 468 469
470:193(i16vec3) Load 356(u16v)
471: 36(int16_t) Load 358(u16)
472:193(i16vec3) CompositeConstruct 471 471 471
473: 425(bvec3) ULessThanEqual 470 472
Store 457(bv) 473
474: 52(i16vec2) Load 343(i16v)
475: 14(int16_t) Load 346(i16)
476: 52(i16vec2) CompositeConstruct 475 475
477: 174(bvec2) SLessThanEqual 474 476
478: 280(ptr) AccessChain 457(bv) 282
479: 173(bool) CompositeExtract 477 0
Store 478 479
480: 280(ptr) AccessChain 457(bv) 264
481: 173(bool) CompositeExtract 477 1
Store 480 481
482:193(i16vec3) Load 356(u16v)
483: 36(int16_t) Load 358(u16)
484:193(i16vec3) CompositeConstruct 483 483 483
485: 425(bvec3) UGreaterThan 482 484
Store 457(bv) 485
486: 52(i16vec2) Load 343(i16v)
487: 14(int16_t) Load 346(i16)
488: 52(i16vec2) CompositeConstruct 487 487
489: 174(bvec2) SGreaterThan 486 488
490: 280(ptr) AccessChain 457(bv) 282
491: 173(bool) CompositeExtract 489 0
Store 490 491
492: 280(ptr) AccessChain 457(bv) 264
493: 173(bool) CompositeExtract 489 1
Store 492 493
494:193(i16vec3) Load 356(u16v)
495: 36(int16_t) Load 358(u16)
496:193(i16vec3) CompositeConstruct 495 495 495
497: 425(bvec3) UGreaterThanEqual 494 496
Store 457(bv) 497
498:193(i16vec3) Load 356(u16v)
499: 36(int16_t) Load 358(u16)
500:193(i16vec3) CompositeConstruct 499 499 499
501: 425(bvec3) IEqual 498 500
Store 457(bv) 501
502: 52(i16vec2) Load 343(i16v)
503: 14(int16_t) Load 346(i16)
504: 52(i16vec2) CompositeConstruct 503 503
505: 174(bvec2) IEqual 502 504
506: 425(bvec3) Load 457(bv)
507: 425(bvec3) VectorShuffle 506 505 3 4 2
Store 457(bv) 507
508:193(i16vec3) Load 356(u16v)
509: 36(int16_t) Load 358(u16)
510:193(i16vec3) CompositeConstruct 509 509 509
511: 425(bvec3) INotEqual 508 510
Store 457(bv) 511
512: 52(i16vec2) Load 343(i16v)
513: 14(int16_t) Load 346(i16)
514: 52(i16vec2) CompositeConstruct 513 513
515: 174(bvec2) INotEqual 512 514
516: 425(bvec3) Load 457(bv)
517: 425(bvec3) VectorShuffle 516 515 3 4 2
Store 457(bv) 517
498: 52(i16vec2) Load 343(i16v)
499: 14(int16_t) Load 346(i16)
500: 52(i16vec2) CompositeConstruct 499 499
501: 174(bvec2) SGreaterThanEqual 498 500
502: 280(ptr) AccessChain 457(bv) 282
503: 173(bool) CompositeExtract 501 0
Store 502 503
504: 280(ptr) AccessChain 457(bv) 264
505: 173(bool) CompositeExtract 501 1
Store 504 505
506:193(i16vec3) Load 356(u16v)
507: 36(int16_t) Load 358(u16)
508:193(i16vec3) CompositeConstruct 507 507 507
509: 425(bvec3) IEqual 506 508
Store 457(bv) 509
510: 52(i16vec2) Load 343(i16v)
511: 14(int16_t) Load 346(i16)
512: 52(i16vec2) CompositeConstruct 511 511
513: 174(bvec2) IEqual 510 512
514: 280(ptr) AccessChain 457(bv) 282
515: 173(bool) CompositeExtract 513 0
Store 514 515
516: 280(ptr) AccessChain 457(bv) 264
517: 173(bool) CompositeExtract 513 1
Store 516 517
518:193(i16vec3) Load 356(u16v)
519: 36(int16_t) Load 358(u16)
520:193(i16vec3) CompositeConstruct 519 519 519
521: 425(bvec3) INotEqual 518 520
Store 457(bv) 521
522: 52(i16vec2) Load 343(i16v)
523: 14(int16_t) Load 346(i16)
524: 52(i16vec2) CompositeConstruct 523 523
525: 174(bvec2) INotEqual 522 524
526: 280(ptr) AccessChain 457(bv) 282
527: 173(bool) CompositeExtract 525 0
Store 526 527
528: 280(ptr) AccessChain 457(bv) 264
529: 173(bool) CompositeExtract 525 1
Store 528 529
Return
FunctionEnd