Add support for 64bit integer types and 64bit integer vector types to bitCount() builtin.

Fixes #2630
This commit is contained in:
Panagiotis Christopoulos Charitos 2021-05-03 14:26:11 +02:00
parent 56b17b2f2d
commit 6113723e40
3 changed files with 95 additions and 63 deletions

View File

@ -2,7 +2,7 @@ spv.int64.frag
Validation failed
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 489
// Id's are bound by 499
Capability Shader
Capability Float64
@ -47,45 +47,45 @@ Validation failed
Name 392 "iv"
Name 397 "uv"
Name 401 "bv"
Name 462 "Block"
MemberName 462(Block) 0 "i64v"
MemberName 462(Block) 1 "u64"
Name 464 "block"
Name 465 "si64"
Name 466 "su64"
Name 467 "si"
Name 468 "su"
Name 469 "sb"
Name 470 "su64inc"
Name 471 "i64_to_b"
Name 472 "u64_to_b"
Name 473 "b_to_i64"
Name 474 "b_to_u64"
Name 475 "i64_to_i"
Name 476 "i_to_i64"
Name 477 "u64_to_u"
Name 478 "u_to_u64"
Name 479 "u64_to_i64"
Name 480 "i64_to_u64"
Name 482 "u64_to_i"
Name 484 "i_to_u64"
Name 486 "i64_to_u"
Name 488 "u_to_i64"
Name 472 "Block"
MemberName 472(Block) 0 "i64v"
MemberName 472(Block) 1 "u64"
Name 474 "block"
Name 475 "si64"
Name 476 "su64"
Name 477 "si"
Name 478 "su"
Name 479 "sb"
Name 480 "su64inc"
Name 481 "i64_to_b"
Name 482 "u64_to_b"
Name 483 "b_to_i64"
Name 484 "b_to_u64"
Name 485 "i64_to_i"
Name 486 "i_to_i64"
Name 487 "u64_to_u"
Name 488 "u_to_u64"
Name 489 "u64_to_i64"
Name 490 "i64_to_u64"
Name 492 "u64_to_i"
Name 494 "i_to_u64"
Name 496 "i64_to_u"
Name 498 "u_to_i64"
MemberDecorate 28(Uniforms) 0 Offset 0
Decorate 28(Uniforms) Block
Decorate 30 DescriptorSet 0
Decorate 30 Binding 0
MemberDecorate 462(Block) 0 Offset 0
MemberDecorate 462(Block) 1 Offset 24
Decorate 462(Block) Block
Decorate 464(block) DescriptorSet 0
Decorate 464(block) Binding 1
Decorate 465(si64) SpecId 100
Decorate 466(su64) SpecId 101
Decorate 467(si) SpecId 102
Decorate 468(su) SpecId 103
Decorate 469(sb) SpecId 104
Decorate 470(su64inc) SpecId 105
MemberDecorate 472(Block) 0 Offset 0
MemberDecorate 472(Block) 1 Offset 24
Decorate 472(Block) Block
Decorate 474(block) DescriptorSet 0
Decorate 474(block) Binding 1
Decorate 475(si64) SpecId 100
Decorate 476(su64) SpecId 101
Decorate 477(si) SpecId 102
Decorate 478(su) SpecId 103
Decorate 479(sb) SpecId 104
Decorate 480(su64inc) SpecId 105
2: TypeVoid
3: TypeFunction 2
14: TypeInt 64 0
@ -166,33 +166,33 @@ Validation failed
390: 74(ivec2) ConstantComposite 388 389
395: 81(ivec2) ConstantComposite 217 22
400: TypePointer Function 368(bvec3)
462(Block): TypeStruct 136(i64vec3) 14(int64_t)
463: TypePointer Uniform 462(Block)
464(block): 463(ptr) Variable Uniform
465(si64): 18(int64_t) SpecConstant 4294967286 4294967295
466(su64): 14(int64_t) SpecConstant 20 0
467(si): 31(int) SpecConstant 4294967291
468(su): 21(int) SpecConstant 4
469(sb): 55(bool) SpecConstantTrue
470(su64inc): 14(int64_t) SpecConstantOp 128 466(su64) 70
471(i64_to_b): 55(bool) SpecConstantOp 171 465(si64) 69
472(u64_to_b): 55(bool) SpecConstantOp 171 466(su64) 69
473(b_to_i64): 18(int64_t) SpecConstantOp 169 469(sb) 61 60
474(b_to_u64): 14(int64_t) SpecConstantOp 169 469(sb) 70 69
475(i64_to_i): 31(int) SpecConstantOp 114 465(si64)
476(i_to_i64): 18(int64_t) SpecConstantOp 114 467(si)
477(u64_to_u): 21(int) SpecConstantOp 113 466(su64)
478(u_to_u64): 14(int64_t) SpecConstantOp 113 468(su)
479(u64_to_i64): 18(int64_t) SpecConstantOp 128 466(su64) 69
480(i64_to_u64): 14(int64_t) SpecConstantOp 128 465(si64) 69
481: 21(int) SpecConstantOp 113 466(su64)
482(u64_to_i): 31(int) SpecConstantOp 128 481 227
483: 18(int64_t) SpecConstantOp 114 467(si)
484(i_to_u64): 14(int64_t) SpecConstantOp 128 483 69
485: 31(int) SpecConstantOp 114 465(si64)
486(i64_to_u): 21(int) SpecConstantOp 128 485 227
487: 14(int64_t) SpecConstantOp 113 468(su)
488(u_to_i64): 18(int64_t) SpecConstantOp 128 487 69
472(Block): TypeStruct 136(i64vec3) 14(int64_t)
473: TypePointer Uniform 472(Block)
474(block): 473(ptr) Variable Uniform
475(si64): 18(int64_t) SpecConstant 4294967286 4294967295
476(su64): 14(int64_t) SpecConstant 20 0
477(si): 31(int) SpecConstant 4294967291
478(su): 21(int) SpecConstant 4
479(sb): 55(bool) SpecConstantTrue
480(su64inc): 14(int64_t) SpecConstantOp 128 476(su64) 70
481(i64_to_b): 55(bool) SpecConstantOp 171 475(si64) 69
482(u64_to_b): 55(bool) SpecConstantOp 171 476(su64) 69
483(b_to_i64): 18(int64_t) SpecConstantOp 169 479(sb) 61 60
484(b_to_u64): 14(int64_t) SpecConstantOp 169 479(sb) 70 69
485(i64_to_i): 31(int) SpecConstantOp 114 475(si64)
486(i_to_i64): 18(int64_t) SpecConstantOp 114 477(si)
487(u64_to_u): 21(int) SpecConstantOp 113 476(su64)
488(u_to_u64): 14(int64_t) SpecConstantOp 113 478(su)
489(u64_to_i64): 18(int64_t) SpecConstantOp 128 476(su64) 69
490(i64_to_u64): 14(int64_t) SpecConstantOp 128 475(si64) 69
491: 21(int) SpecConstantOp 113 476(su64)
492(u64_to_i): 31(int) SpecConstantOp 128 491 227
493: 18(int64_t) SpecConstantOp 114 477(si)
494(i_to_u64): 14(int64_t) SpecConstantOp 128 493 69
495: 31(int) SpecConstantOp 114 475(si64)
496(i64_to_u): 21(int) SpecConstantOp 128 495 227
497: 14(int64_t) SpecConstantOp 113 478(su)
498(u_to_i64): 18(int64_t) SpecConstantOp 128 497 69
4(main): 2 Function None 3
5: Label
Store 16(u64Max) 17
@ -681,5 +681,19 @@ Validation failed
460: 368(bvec3) Load 401(bv)
461: 368(bvec3) VectorShuffle 460 459 3 4 2
Store 401(bv) 461
462: 14(int64_t) Load 301(u64)
463: 18(int64_t) ExtInst 1(GLSL.std.450) 73(FindILsb) 462
Store 289(i64) 463
464: 14(int64_t) Load 301(u64)
465: 65(i64vec2) CompositeConstruct 464 464
466: 52(i64vec2) ExtInst 1(GLSL.std.450) 73(FindILsb) 465
Store 286(i64v) 466
467: 14(int64_t) Load 301(u64)
468: 18(int64_t) BitCount 467
Store 289(i64) 468
469: 14(int64_t) Load 301(u64)
470: 65(i64vec2) CompositeConstruct 469 469
471: 52(i64vec2) BitCount 470
Store 286(i64v) 471
Return
FunctionEnd

View File

@ -228,6 +228,14 @@ void builtinFuncs()
// notEqual()
bv = notEqual(u64v, u64vec3(u64));
bv.xy = notEqual(i64v, i64vec2(i64));
// findLSB()
i64 = findLSB(u64);
i64v = findLSB(u64vec2(u64));
// bitCount()
i64 = bitCount(u64);
i64v = bitCount(u64vec2(u64));
}
// Type conversion for specialization constant

View File

@ -1261,6 +1261,16 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"bvec3 notEqual(u64vec3, u64vec3);"
"bvec4 notEqual(u64vec4, u64vec4);"
"int64_t bitCount(int64_t);"
"i64vec2 bitCount(i64vec2);"
"i64vec3 bitCount(i64vec3);"
"i64vec4 bitCount(i64vec4);"
"int64_t bitCount(uint64_t);"
"i64vec2 bitCount(u64vec2);"
"i64vec3 bitCount(u64vec3);"
"i64vec4 bitCount(u64vec4);"
"int64_t findLSB(int64_t);"
"i64vec2 findLSB(i64vec2);"
"i64vec3 findLSB(i64vec3);"