Skip to content

Commit

Permalink
Added support for SPV_KHR_shader_ballot.
Browse files Browse the repository at this point in the history
  • Loading branch information
DragonJoker committed Oct 4, 2023
1 parent fbfa1f3 commit d4b86ef
Show file tree
Hide file tree
Showing 16 changed files with 1,398 additions and 1 deletion.
34 changes: 34 additions & 0 deletions include/ShaderAST/Expr/EnumIntrinsic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,6 +1349,40 @@ namespace ast::expr
eSubgroupQuadSwapDiagonal3D,
eSubgroupQuadSwapDiagonal4D,

//Shader Invocation Group Functions
eReadInvocation1F,
eReadInvocation2F,
eReadInvocation3F,
eReadInvocation4F,
eReadInvocation1I,
eReadInvocation2I,
eReadInvocation3I,
eReadInvocation4I,
eReadInvocation1U,
eReadInvocation2U,
eReadInvocation3U,
eReadInvocation4U,
eReadInvocation1D,
eReadInvocation2D,
eReadInvocation3D,
eReadInvocation4D,
eReadFirstInvocation1F,
eReadFirstInvocation2F,
eReadFirstInvocation3F,
eReadFirstInvocation4F,
eReadFirstInvocation1I,
eReadFirstInvocation2I,
eReadFirstInvocation3I,
eReadFirstInvocation4I,
eReadFirstInvocation1U,
eReadFirstInvocation2U,
eReadFirstInvocation3U,
eReadFirstInvocation4U,
eReadFirstInvocation1D,
eReadFirstInvocation2D,
eReadFirstInvocation3D,
eReadFirstInvocation4D,

// Boundaries,
eCount,
eInvalid = ~( 0u ),
Expand Down
130 changes: 130 additions & 0 deletions include/ShaderAST/Expr/GetIntrinsicName.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5267,6 +5267,136 @@ namespace ast::expr
result = "SUBGROUPQUADSWAPDIAGONAL4D";
break;


//Shader Invocation Group Functions
case Intrinsic::eReadInvocation1F:
result = "READINVOCATION1F";
break;

case Intrinsic::eReadInvocation2F:
result = "READINVOCATION2F";
break;

case Intrinsic::eReadInvocation3F:
result = "READINVOCATION3F";
break;

case Intrinsic::eReadInvocation4F:
result = "READINVOCATION4F";
break;

case Intrinsic::eReadInvocation1I:
result = "READINVOCATION1I";
break;

case Intrinsic::eReadInvocation2I:
result = "READINVOCATION2I";
break;

case Intrinsic::eReadInvocation3I:
result = "READINVOCATION3I";
break;

case Intrinsic::eReadInvocation4I:
result = "READINVOCATION4I";
break;

case Intrinsic::eReadInvocation1U:
result = "READINVOCATION1U";
break;

case Intrinsic::eReadInvocation2U:
result = "READINVOCATION2U";
break;

case Intrinsic::eReadInvocation3U:
result = "READINVOCATION3U";
break;

case Intrinsic::eReadInvocation4U:
result = "READINVOCATION4U";
break;

case Intrinsic::eReadInvocation1D:
result = "READINVOCATION1D";
break;

case Intrinsic::eReadInvocation2D:
result = "READINVOCATION2D";
break;

case Intrinsic::eReadInvocation3D:
result = "READINVOCATION3D";
break;

case Intrinsic::eReadInvocation4D:
result = "READINVOCATION4D";
break;

case Intrinsic::eReadFirstInvocation1F:
result = "READFIRSTINVOCATION1F";
break;

case Intrinsic::eReadFirstInvocation2F:
result = "READFIRSTINVOCATION2F";
break;

case Intrinsic::eReadFirstInvocation3F:
result = "READFIRSTINVOCATION3F";
break;

case Intrinsic::eReadFirstInvocation4F:
result = "READFIRSTINVOCATION4F";
break;

case Intrinsic::eReadFirstInvocation1I:
result = "READFIRSTINVOCATION1I";
break;

case Intrinsic::eReadFirstInvocation2I:
result = "READFIRSTINVOCATION2I";
break;

case Intrinsic::eReadFirstInvocation3I:
result = "READFIRSTINVOCATION3I";
break;

case Intrinsic::eReadFirstInvocation4I:
result = "READFIRSTINVOCATION4I";
break;

case Intrinsic::eReadFirstInvocation1U:
result = "READFIRSTINVOCATION1U";
break;

case Intrinsic::eReadFirstInvocation2U:
result = "READFIRSTINVOCATION2U";
break;

case Intrinsic::eReadFirstInvocation3U:
result = "READFIRSTINVOCATION3U";
break;

case Intrinsic::eReadFirstInvocation4U:
result = "READFIRSTINVOCATION4U";
break;

case Intrinsic::eReadFirstInvocation1D:
result = "READFIRSTINVOCATION1D";
break;

case Intrinsic::eReadFirstInvocation2D:
result = "READFIRSTINVOCATION2D";
break;

case Intrinsic::eReadFirstInvocation3D:
result = "READFIRSTINVOCATION3D";
break;

case Intrinsic::eReadFirstInvocation4D:
result = "READFIRSTINVOCATION4D";
break;

default:
throw std::runtime_error{ "Unsupported Intrinsic type." };
}
Expand Down
34 changes: 34 additions & 0 deletions include/ShaderAST/Expr/Intrinsic.enum
Original file line number Diff line number Diff line change
Expand Up @@ -1337,4 +1337,38 @@ ASTIntrDecl( Intrinsic )
ASTIntrValue( type::Kind::eVec2D, ASTIntrName( subgroupQuadSwapDiagonal, SubgroupQuadSwapDiagonal, 2, D ), ASTIntrParams( ASTIntrParam( type::Kind::eVec2D, value ) ) )
ASTIntrValue( type::Kind::eVec3D, ASTIntrName( subgroupQuadSwapDiagonal, SubgroupQuadSwapDiagonal, 3, D ), ASTIntrParams( ASTIntrParam( type::Kind::eVec3D, value ) ) )
ASTIntrValue( type::Kind::eVec4D, ASTIntrName( subgroupQuadSwapDiagonal, SubgroupQuadSwapDiagonal, 4, D ), ASTIntrParams( ASTIntrParam( type::Kind::eVec4D, value ) ) )

//Shader Invocation Group Functions
ASTIntrValue( type::Kind::eFloat, ASTIntrName( readInvocation, ReadInvocation, 1, F ), ASTIntrParams( ASTIntrParam( type::Kind::eFloat, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec2F, ASTIntrName( readInvocation, ReadInvocation, 2, F ), ASTIntrParams( ASTIntrParam( type::Kind::eVec2F, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec3F, ASTIntrName( readInvocation, ReadInvocation, 3, F ), ASTIntrParams( ASTIntrParam( type::Kind::eVec3F, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec4F, ASTIntrName( readInvocation, ReadInvocation, 4, F ), ASTIntrParams( ASTIntrParam( type::Kind::eVec4F, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eInt32, ASTIntrName( readInvocation, ReadInvocation, 1, I ), ASTIntrParams( ASTIntrParam( type::Kind::eInt32, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec2I32, ASTIntrName( readInvocation, ReadInvocation, 2, I ), ASTIntrParams( ASTIntrParam( type::Kind::eVec2I32, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec3I32, ASTIntrName( readInvocation, ReadInvocation, 3, I ), ASTIntrParams( ASTIntrParam( type::Kind::eVec3I32, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec4I32, ASTIntrName( readInvocation, ReadInvocation, 4, I ), ASTIntrParams( ASTIntrParam( type::Kind::eVec4I32, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eUInt32, ASTIntrName( readInvocation, ReadInvocation, 1, U ), ASTIntrParams( ASTIntrParam( type::Kind::eUInt32, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec2U32, ASTIntrName( readInvocation, ReadInvocation, 2, U ), ASTIntrParams( ASTIntrParam( type::Kind::eVec2U32, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec3U32, ASTIntrName( readInvocation, ReadInvocation, 3, U ), ASTIntrParams( ASTIntrParam( type::Kind::eVec3U32, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec4U32, ASTIntrName( readInvocation, ReadInvocation, 4, U ), ASTIntrParams( ASTIntrParam( type::Kind::eVec4U32, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eDouble, ASTIntrName( readInvocation, ReadInvocation, 1, D ), ASTIntrParams( ASTIntrParam( type::Kind::eDouble, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec2D, ASTIntrName( readInvocation, ReadInvocation, 2, D ), ASTIntrParams( ASTIntrParam( type::Kind::eVec2D, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec3D, ASTIntrName( readInvocation, ReadInvocation, 3, D ), ASTIntrParams( ASTIntrParam( type::Kind::eVec3D, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eVec4D, ASTIntrName( readInvocation, ReadInvocation, 4, D ), ASTIntrParams( ASTIntrParam( type::Kind::eVec4D, value ), ASTIntrParam( type::Kind::eUInt, invocationIndex ) ) )
ASTIntrValue( type::Kind::eFloat, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 1, F ), ASTIntrParams( ASTIntrParam( type::Kind::eFloat, value ) ) )
ASTIntrValue( type::Kind::eVec2F, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 2, F ), ASTIntrParams( ASTIntrParam( type::Kind::eVec2F, value ) ) )
ASTIntrValue( type::Kind::eVec3F, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 3, F ), ASTIntrParams( ASTIntrParam( type::Kind::eVec3F, value ) ) )
ASTIntrValue( type::Kind::eVec4F, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 4, F ), ASTIntrParams( ASTIntrParam( type::Kind::eVec4F, value ) ) )
ASTIntrValue( type::Kind::eInt32, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 1, I ), ASTIntrParams( ASTIntrParam( type::Kind::eInt32, value ) ) )
ASTIntrValue( type::Kind::eVec2I32, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 2, I ), ASTIntrParams( ASTIntrParam( type::Kind::eVec2I32, value ) ) )
ASTIntrValue( type::Kind::eVec3I32, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 3, I ), ASTIntrParams( ASTIntrParam( type::Kind::eVec3I32, value ) ) )
ASTIntrValue( type::Kind::eVec4I32, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 4, I ), ASTIntrParams( ASTIntrParam( type::Kind::eVec4I32, value ) ) )
ASTIntrValue( type::Kind::eUInt32, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 1, U ), ASTIntrParams( ASTIntrParam( type::Kind::eUInt32, value ) ) )
ASTIntrValue( type::Kind::eVec2U32, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 2, U ), ASTIntrParams( ASTIntrParam( type::Kind::eVec2U32, value ) ) )
ASTIntrValue( type::Kind::eVec3U32, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 3, U ), ASTIntrParams( ASTIntrParam( type::Kind::eVec3U32, value ) ) )
ASTIntrValue( type::Kind::eVec4U32, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 4, U ), ASTIntrParams( ASTIntrParam( type::Kind::eVec4U32, value ) ) )
ASTIntrValue( type::Kind::eDouble, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 1, D ), ASTIntrParams( ASTIntrParam( type::Kind::eDouble, value ) ) )
ASTIntrValue( type::Kind::eVec2D, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 2, D ), ASTIntrParams( ASTIntrParam( type::Kind::eVec2D, value ) ) )
ASTIntrValue( type::Kind::eVec3D, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 3, D ), ASTIntrParams( ASTIntrParam( type::Kind::eVec3D, value ) ) )
ASTIntrValue( type::Kind::eVec4D, ASTIntrName( readFirstInvocation, ReadFirstInvocation, 4, D ), ASTIntrParams( ASTIntrParam( type::Kind::eVec4D, value ) ) )
ASTIntrEnd
Loading

0 comments on commit d4b86ef

Please sign in to comment.