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.int8.frag
// Module Version 10300
// Generated by (magic number): 8000a
// Id's are bound by 518
// Id's are bound by 530
Capability Shader
Capability Float16
@ -66,35 +66,35 @@ spv.int8.frag
Name 437 "u32"
Name 440 "u8v4"
Name 452 "bv"
Name 513 "Block"
MemberName 513(Block) 0 "i8"
MemberName 513(Block) 1 "i8v2"
MemberName 513(Block) 2 "i8v3"
MemberName 513(Block) 3 "i8v4"
MemberName 513(Block) 4 "u8"
MemberName 513(Block) 5 "u8v2"
MemberName 513(Block) 6 "u8v3"
MemberName 513(Block) 7 "u8v4"
Name 515 "block"
Name 516 "si8"
Name 517 "su8"
Name 525 "Block"
MemberName 525(Block) 0 "i8"
MemberName 525(Block) 1 "i8v2"
MemberName 525(Block) 2 "i8v3"
MemberName 525(Block) 3 "i8v4"
MemberName 525(Block) 4 "u8"
MemberName 525(Block) 5 "u8v2"
MemberName 525(Block) 6 "u8v3"
MemberName 525(Block) 7 "u8v4"
Name 527 "block"
Name 528 "si8"
Name 529 "su8"
MemberDecorate 24(Uniforms) 0 Offset 0
Decorate 24(Uniforms) Block
Decorate 26 DescriptorSet 0
Decorate 26 Binding 0
MemberDecorate 513(Block) 0 Offset 0
MemberDecorate 513(Block) 1 Offset 2
MemberDecorate 513(Block) 2 Offset 4
MemberDecorate 513(Block) 3 Offset 8
MemberDecorate 513(Block) 4 Offset 12
MemberDecorate 513(Block) 5 Offset 14
MemberDecorate 513(Block) 6 Offset 16
MemberDecorate 513(Block) 7 Offset 20
Decorate 513(Block) Block
Decorate 515(block) DescriptorSet 0
Decorate 515(block) Binding 1
Decorate 516(si8) SpecId 100
Decorate 517(su8) SpecId 101
MemberDecorate 525(Block) 0 Offset 0
MemberDecorate 525(Block) 1 Offset 2
MemberDecorate 525(Block) 2 Offset 4
MemberDecorate 525(Block) 3 Offset 8
MemberDecorate 525(Block) 4 Offset 12
MemberDecorate 525(Block) 5 Offset 14
MemberDecorate 525(Block) 6 Offset 16
MemberDecorate 525(Block) 7 Offset 20
Decorate 525(Block) Block
Decorate 527(block) DescriptorSet 0
Decorate 527(block) Binding 1
Decorate 528(si8) SpecId 100
Decorate 529(su8) SpecId 101
2: TypeVoid
3: TypeFunction 2
14: TypeInt 8 1
@ -184,11 +184,11 @@ spv.int8.frag
438: TypeVector 36(int8_t) 4
439: TypePointer Function 438(i8vec4)
451: TypePointer Function 420(bvec3)
513(Block): TypeStruct 14(int8_t) 52(i8vec2) 194(i8vec3) 427(i8vec4) 36(int8_t) 49(i8vec2) 190(i8vec3) 438(i8vec4)
514: TypePointer Uniform 513(Block)
515(block): 514(ptr) Variable Uniform
516(si8): 14(int8_t) SpecConstant 4294967286
517(su8): 36(int8_t) SpecConstant 20
525(Block): TypeStruct 14(int8_t) 52(i8vec2) 194(i8vec3) 427(i8vec4) 36(int8_t) 49(i8vec2) 190(i8vec3) 438(i8vec4)
526: TypePointer Uniform 525(Block)
527(block): 526(ptr) Variable Uniform
528(si8): 14(int8_t) SpecConstant 4294967286
529(su8): 36(int8_t) SpecConstant 20
4(main): 2 Function None 3
5: Label
Return
@ -670,68 +670,86 @@ spv.int8.frag
458: 14(int8_t) Load 341(i8)
459: 52(i8vec2) CompositeConstruct 458 458
460: 172(bvec2) SLessThan 457 459
461: 420(bvec3) Load 452(bv)
462: 420(bvec3) VectorShuffle 461 460 3 4 2
Store 452(bv) 462
463: 190(i8vec3) Load 351(u8v)
464: 36(int8_t) Load 353(u8)
465: 190(i8vec3) CompositeConstruct 464 464 464
466: 420(bvec3) ULessThanEqual 463 465
Store 452(bv) 466
467: 52(i8vec2) Load 338(i8v)
468: 14(int8_t) Load 341(i8)
469: 52(i8vec2) CompositeConstruct 468 468
470: 172(bvec2) SLessThanEqual 467 469
471: 420(bvec3) Load 452(bv)
472: 420(bvec3) VectorShuffle 471 470 3 4 2
Store 452(bv) 472
473: 190(i8vec3) Load 351(u8v)
474: 36(int8_t) Load 353(u8)
475: 190(i8vec3) CompositeConstruct 474 474 474
476: 420(bvec3) UGreaterThan 473 475
Store 452(bv) 476
477: 52(i8vec2) Load 338(i8v)
478: 14(int8_t) Load 341(i8)
479: 52(i8vec2) CompositeConstruct 478 478
480: 172(bvec2) SGreaterThan 477 479
481: 420(bvec3) Load 452(bv)
482: 420(bvec3) VectorShuffle 481 480 3 4 2
Store 452(bv) 482
483: 190(i8vec3) Load 351(u8v)
484: 36(int8_t) Load 353(u8)
485: 190(i8vec3) CompositeConstruct 484 484 484
486: 420(bvec3) UGreaterThanEqual 483 485
Store 452(bv) 486
487: 52(i8vec2) Load 338(i8v)
488: 14(int8_t) Load 341(i8)
489: 52(i8vec2) CompositeConstruct 488 488
490: 172(bvec2) SGreaterThanEqual 487 489
491: 420(bvec3) Load 452(bv)
492: 420(bvec3) VectorShuffle 491 490 3 4 2
461: 275(ptr) AccessChain 452(bv) 277
462: 171(bool) CompositeExtract 460 0
Store 461 462
463: 275(ptr) AccessChain 452(bv) 261
464: 171(bool) CompositeExtract 460 1
Store 463 464
465: 190(i8vec3) Load 351(u8v)
466: 36(int8_t) Load 353(u8)
467: 190(i8vec3) CompositeConstruct 466 466 466
468: 420(bvec3) ULessThanEqual 465 467
Store 452(bv) 468
469: 52(i8vec2) Load 338(i8v)
470: 14(int8_t) Load 341(i8)
471: 52(i8vec2) CompositeConstruct 470 470
472: 172(bvec2) SLessThanEqual 469 471
473: 275(ptr) AccessChain 452(bv) 277
474: 171(bool) CompositeExtract 472 0
Store 473 474
475: 275(ptr) AccessChain 452(bv) 261
476: 171(bool) CompositeExtract 472 1
Store 475 476
477: 190(i8vec3) Load 351(u8v)
478: 36(int8_t) Load 353(u8)
479: 190(i8vec3) CompositeConstruct 478 478 478
480: 420(bvec3) UGreaterThan 477 479
Store 452(bv) 480
481: 52(i8vec2) Load 338(i8v)
482: 14(int8_t) Load 341(i8)
483: 52(i8vec2) CompositeConstruct 482 482
484: 172(bvec2) SGreaterThan 481 483
485: 275(ptr) AccessChain 452(bv) 277
486: 171(bool) CompositeExtract 484 0
Store 485 486
487: 275(ptr) AccessChain 452(bv) 261
488: 171(bool) CompositeExtract 484 1
Store 487 488
489: 190(i8vec3) Load 351(u8v)
490: 36(int8_t) Load 353(u8)
491: 190(i8vec3) CompositeConstruct 490 490 490
492: 420(bvec3) UGreaterThanEqual 489 491
Store 452(bv) 492
493: 190(i8vec3) Load 351(u8v)
494: 36(int8_t) Load 353(u8)
495: 190(i8vec3) CompositeConstruct 494 494 494
496: 420(bvec3) IEqual 493 495
Store 452(bv) 496
497: 52(i8vec2) Load 338(i8v)
498: 14(int8_t) Load 341(i8)
499: 52(i8vec2) CompositeConstruct 498 498
500: 172(bvec2) IEqual 497 499
501: 420(bvec3) Load 452(bv)
502: 420(bvec3) VectorShuffle 501 500 3 4 2
Store 452(bv) 502
503: 190(i8vec3) Load 351(u8v)
504: 36(int8_t) Load 353(u8)
505: 190(i8vec3) CompositeConstruct 504 504 504
506: 420(bvec3) INotEqual 503 505
Store 452(bv) 506
507: 52(i8vec2) Load 338(i8v)
508: 14(int8_t) Load 341(i8)
509: 52(i8vec2) CompositeConstruct 508 508
510: 172(bvec2) INotEqual 507 509
511: 420(bvec3) Load 452(bv)
512: 420(bvec3) VectorShuffle 511 510 3 4 2
Store 452(bv) 512
493: 52(i8vec2) Load 338(i8v)
494: 14(int8_t) Load 341(i8)
495: 52(i8vec2) CompositeConstruct 494 494
496: 172(bvec2) SGreaterThanEqual 493 495
497: 275(ptr) AccessChain 452(bv) 277
498: 171(bool) CompositeExtract 496 0
Store 497 498
499: 275(ptr) AccessChain 452(bv) 261
500: 171(bool) CompositeExtract 496 1
Store 499 500
501: 190(i8vec3) Load 351(u8v)
502: 36(int8_t) Load 353(u8)
503: 190(i8vec3) CompositeConstruct 502 502 502
504: 420(bvec3) IEqual 501 503
Store 452(bv) 504
505: 52(i8vec2) Load 338(i8v)
506: 14(int8_t) Load 341(i8)
507: 52(i8vec2) CompositeConstruct 506 506
508: 172(bvec2) IEqual 505 507
509: 275(ptr) AccessChain 452(bv) 277
510: 171(bool) CompositeExtract 508 0
Store 509 510
511: 275(ptr) AccessChain 452(bv) 261
512: 171(bool) CompositeExtract 508 1
Store 511 512
513: 190(i8vec3) Load 351(u8v)
514: 36(int8_t) Load 353(u8)
515: 190(i8vec3) CompositeConstruct 514 514 514
516: 420(bvec3) INotEqual 513 515
Store 452(bv) 516
517: 52(i8vec2) Load 338(i8v)
518: 14(int8_t) Load 341(i8)
519: 52(i8vec2) CompositeConstruct 518 518
520: 172(bvec2) INotEqual 517 519
521: 275(ptr) AccessChain 452(bv) 277
522: 171(bool) CompositeExtract 520 0
Store 521 522
523: 275(ptr) AccessChain 452(bv) 261
524: 171(bool) CompositeExtract 520 1
Store 523 524
Return
FunctionEnd