@@ -2121,6 +2121,7 @@ extern "C"
2121
2121
typedef struct SlangReflectionTypeParameter SlangReflectionTypeParameter;
2122
2122
typedef struct SlangReflectionUserAttribute SlangReflectionUserAttribute;
2123
2123
typedef struct SlangReflectionFunction SlangReflectionFunction;
2124
+ typedef struct SlangReflectionGeneric SlangReflectionGeneric;
2124
2125
2125
2126
/*
2126
2127
Type aliases to maintain backward compatibility.
@@ -2469,6 +2470,7 @@ extern "C"
2469
2470
2470
2471
SLANG_API char const * spReflectionType_GetName (SlangReflectionType* type);
2471
2472
SLANG_API SlangResult spReflectionType_GetFullName (SlangReflectionType* type, ISlangBlob** outNameBlob);
2473
+ SLANG_API SlangReflectionGeneric* spReflectionType_GetGenericContainer (SlangReflectionType* type);
2472
2474
2473
2475
// Type Layout Reflection
2474
2476
@@ -2553,6 +2555,7 @@ extern "C"
2553
2555
SLANG_API SlangReflectionUserAttribute* spReflectionVariable_GetUserAttribute (SlangReflectionVariable* var, unsigned int index);
2554
2556
SLANG_API SlangReflectionUserAttribute* spReflectionVariable_FindUserAttributeByName (SlangReflectionVariable* var, SlangSession * globalSession, char const * name);
2555
2557
SLANG_API bool spReflectionVariable_HasDefaultValue (SlangReflectionVariable* inVar);
2558
+ SLANG_API SlangReflectionGeneric* spReflectionVariable_GetGenericContainer (SlangReflectionVariable* var);
2556
2559
2557
2560
// Variable Layout Reflection
2558
2561
@@ -2578,6 +2581,7 @@ extern "C"
2578
2581
SLANG_API unsigned int spReflectionFunction_GetParameterCount (SlangReflectionFunction* func);
2579
2582
SLANG_API SlangReflectionVariable* spReflectionFunction_GetParameter (SlangReflectionFunction* func, unsigned index);
2580
2583
SLANG_API SlangReflectionType* spReflectionFunction_GetResultType (SlangReflectionFunction* func);
2584
+ SLANG_API SlangReflectionGeneric* spReflectionFunction_GetGenericContainer (SlangReflectionFunction* func);
2581
2585
2582
2586
// Abstract Decl Reflection
2583
2587
@@ -2586,8 +2590,26 @@ extern "C"
2586
2590
SLANG_API SlangDeclKind spReflectionDecl_getKind (SlangReflectionDecl* decl);
2587
2591
SLANG_API SlangReflectionFunction* spReflectionDecl_castToFunction (SlangReflectionDecl* decl);
2588
2592
SLANG_API SlangReflectionVariable* spReflectionDecl_castToVariable (SlangReflectionDecl* decl);
2589
- SLANG_API SlangReflectionType* spReflection_getTypeFromDecl (SlangSession* session, SlangReflectionDecl* decl);
2590
-
2593
+ SLANG_API SlangReflectionGeneric* spReflectionDecl_castToGeneric (SlangReflectionDecl* decl);
2594
+ SLANG_API SlangReflectionType* spReflection_getTypeFromDecl (SlangReflectionDecl* decl);
2595
+ SLANG_API SlangReflectionDecl* spReflectionDecl_getParent (SlangReflectionDecl* decl);
2596
+
2597
+ // Generic Reflection
2598
+
2599
+ SLANG_API SlangReflectionDecl* spReflectionGeneric_asDecl (SlangReflectionGeneric* generic);
2600
+ SLANG_API char const * spReflectionGeneric_GetName (SlangReflectionGeneric* generic);
2601
+ SLANG_API unsigned int spReflectionGeneric_GetTypeParameterCount (SlangReflectionGeneric* generic);
2602
+ SLANG_API SlangReflectionVariable* spReflectionGeneric_GetTypeParameter (SlangReflectionGeneric* generic, unsigned index);
2603
+ SLANG_API unsigned int spReflectionGeneric_GetValueParameterCount (SlangReflectionGeneric* generic);
2604
+ SLANG_API SlangReflectionVariable* spReflectionGeneric_GetValueParameter (SlangReflectionGeneric* generic, unsigned index);
2605
+ SLANG_API unsigned int spReflectionGeneric_GetTypeParameterConstraintCount (SlangReflectionGeneric* generic, SlangReflectionVariable* typeParam);
2606
+ SLANG_API SlangReflectionType* spReflectionGeneric_GetTypeParameterConstraintType (SlangReflectionGeneric* generic, SlangReflectionVariable* typeParam, unsigned index);
2607
+ SLANG_API SlangDeclKind spReflectionGeneric_GetInnerKind (SlangReflectionGeneric* generic);
2608
+ SLANG_API SlangReflectionDecl* spReflectionGeneric_GetInnerDecl (SlangReflectionGeneric* generic);
2609
+ SLANG_API SlangReflectionGeneric* spReflectionGeneric_GetOuterGenericContainer (SlangReflectionGeneric* generic);
2610
+ SLANG_API SlangReflectionType* spReflectionGeneric_GetConcreteType (SlangReflectionGeneric* generic, SlangReflectionVariable* typeParam);
2611
+ SLANG_API int64_t spReflectionGeneric_GetConcreteIntVal (SlangReflectionGeneric* generic, SlangReflectionVariable* valueParam);
2612
+
2591
2613
2592
2614
/* * Get the stage that a variable belongs to (if any).
2593
2615
@@ -2678,6 +2700,8 @@ extern "C"
2678
2700
SLANG_API SlangReflectionTypeLayout* spReflection_GetTypeLayout (SlangReflection* reflection, SlangReflectionType* reflectionType, SlangLayoutRules rules);
2679
2701
2680
2702
SLANG_API SlangReflectionFunction* spReflection_FindFunctionByName (SlangReflection* reflection, char const * name);
2703
+ SLANG_API SlangReflectionFunction* spReflection_FindFunctionByNameInType (SlangReflection* reflection, SlangReflectionType* reflType, char const * name);
2704
+ SLANG_API SlangReflectionVariable* spReflection_FindVarByNameInType (SlangReflection* reflection, SlangReflectionType* reflType, char const * name);
2681
2705
2682
2706
SLANG_API SlangUInt spReflection_getEntryPointCount (SlangReflection* reflection);
2683
2707
SLANG_API SlangReflectionEntryPoint* spReflection_getEntryPointByIndex (SlangReflection* reflection, SlangUInt index);
@@ -2735,6 +2759,8 @@ namespace slang
2735
2759
struct TypeReflection ;
2736
2760
struct VariableLayoutReflection ;
2737
2761
struct VariableReflection ;
2762
+ struct FunctionReflection ;
2763
+ struct GenericReflection ;
2738
2764
2739
2765
struct UserAttribute
2740
2766
{
@@ -2913,6 +2939,11 @@ namespace slang
2913
2939
{
2914
2940
return (UserAttribute*)spReflectionType_FindUserAttributeByName ((SlangReflectionType*)this , name);
2915
2941
}
2942
+
2943
+ SlangReflectionGeneric* getGenericContainer ()
2944
+ {
2945
+ return (SlangReflectionGeneric*) spReflectionType_GetGenericContainer ((SlangReflectionType*) this );
2946
+ }
2916
2947
};
2917
2948
2918
2949
enum ParameterCategory : SlangParameterCategoryIntegral
@@ -3360,10 +3391,12 @@ namespace slang
3360
3391
{
3361
3392
return spReflectionVariable_GetUserAttributeCount ((SlangReflectionVariable*)this );
3362
3393
}
3394
+
3363
3395
UserAttribute* getUserAttributeByIndex (unsigned int index)
3364
3396
{
3365
3397
return (UserAttribute*)spReflectionVariable_GetUserAttribute ((SlangReflectionVariable*)this , index );
3366
3398
}
3399
+
3367
3400
UserAttribute* findUserAttributeByName (SlangSession* globalSession, char const * name)
3368
3401
{
3369
3402
return (UserAttribute*)spReflectionVariable_FindUserAttributeByName ((SlangReflectionVariable*)this , globalSession, name);
@@ -3373,6 +3406,11 @@ namespace slang
3373
3406
{
3374
3407
return spReflectionVariable_HasDefaultValue ((SlangReflectionVariable*)this );
3375
3408
}
3409
+
3410
+ GenericReflection* getGenericContainer ()
3411
+ {
3412
+ return (GenericReflection*)spReflectionVariable_GetGenericContainer ((SlangReflectionVariable*)this );
3413
+ }
3376
3414
};
3377
3415
3378
3416
struct VariableLayoutReflection
@@ -3498,6 +3536,81 @@ namespace slang
3498
3536
{
3499
3537
return (Modifier*)spReflectionFunction_FindModifier ((SlangReflectionFunction*)this , (SlangModifierID)id);
3500
3538
}
3539
+
3540
+ GenericReflection* getGenericContainer ()
3541
+ {
3542
+ return (GenericReflection*)spReflectionFunction_GetGenericContainer ((SlangReflectionFunction*)this );
3543
+ }
3544
+ };
3545
+
3546
+ struct GenericReflection
3547
+ {
3548
+
3549
+ DeclReflection* asDecl ()
3550
+ {
3551
+ return (DeclReflection*)spReflectionGeneric_asDecl ((SlangReflectionGeneric*)this );
3552
+ }
3553
+
3554
+ char const * getName ()
3555
+ {
3556
+ return spReflectionGeneric_GetName ((SlangReflectionGeneric*)this );
3557
+ }
3558
+
3559
+ unsigned int getTypeParameterCount ()
3560
+ {
3561
+ return spReflectionGeneric_GetTypeParameterCount ((SlangReflectionGeneric*)this );
3562
+ }
3563
+
3564
+ VariableReflection* getTypeParameter (unsigned index)
3565
+ {
3566
+ return (VariableReflection*)spReflectionGeneric_GetTypeParameter ((SlangReflectionGeneric*)this , index );
3567
+ }
3568
+
3569
+ unsigned int getValueParameterCount ()
3570
+ {
3571
+ return spReflectionGeneric_GetValueParameterCount ((SlangReflectionGeneric*)this );
3572
+ }
3573
+
3574
+ VariableReflection* getValueParameter (unsigned index)
3575
+ {
3576
+ return (VariableReflection*)spReflectionGeneric_GetValueParameter ((SlangReflectionGeneric*)this , index );
3577
+ }
3578
+
3579
+ unsigned int getTypeParameterConstraintCount (VariableReflection* typeParam)
3580
+ {
3581
+ return spReflectionGeneric_GetTypeParameterConstraintCount ((SlangReflectionGeneric*)this , (SlangReflectionVariable*)typeParam);
3582
+ }
3583
+
3584
+ TypeReflection* getTypeParameterConstraintType (VariableReflection* typeParam, unsigned index)
3585
+ {
3586
+ return (TypeReflection*)spReflectionGeneric_GetTypeParameterConstraintType ((SlangReflectionGeneric*)this , (SlangReflectionVariable*)typeParam, index );
3587
+ }
3588
+
3589
+ DeclReflection* getInnerDecl ()
3590
+ {
3591
+ return (DeclReflection*)spReflectionGeneric_GetInnerDecl ((SlangReflectionGeneric*)this );
3592
+ }
3593
+
3594
+ SlangDeclKind getInnerKind ()
3595
+ {
3596
+ return spReflectionGeneric_GetInnerKind ((SlangReflectionGeneric*)this );
3597
+ }
3598
+
3599
+ GenericReflection* getOuterGenericContainer ()
3600
+ {
3601
+ return (GenericReflection*)spReflectionGeneric_GetOuterGenericContainer ((SlangReflectionGeneric*)this );
3602
+ }
3603
+
3604
+ TypeReflection* getConcreteType (VariableReflection* typeParam)
3605
+ {
3606
+ return (TypeReflection*)spReflectionGeneric_GetConcreteType ((SlangReflectionGeneric*)this , (SlangReflectionVariable*)typeParam);
3607
+ }
3608
+
3609
+ int64_t getConcreteIntVal (VariableReflection* valueParam)
3610
+ {
3611
+ return spReflectionGeneric_GetConcreteIntVal ((SlangReflectionGeneric*)this , (SlangReflectionVariable*)valueParam);
3612
+ }
3613
+
3501
3614
};
3502
3615
3503
3616
struct EntryPointReflection
@@ -3672,6 +3785,22 @@ namespace slang
3672
3785
name);
3673
3786
}
3674
3787
3788
+ FunctionReflection* findFunctionByNameInType (TypeReflection* type, const char * name)
3789
+ {
3790
+ return (FunctionReflection*)spReflection_FindFunctionByNameInType (
3791
+ (SlangReflection*) this ,
3792
+ (SlangReflectionType*) type,
3793
+ name);
3794
+ }
3795
+
3796
+ VariableReflection* findVarByNameInType (TypeReflection* type, const char * name)
3797
+ {
3798
+ return (VariableReflection*)spReflection_FindVarByNameInType (
3799
+ (SlangReflection*) this ,
3800
+ (SlangReflectionType*) type,
3801
+ name);
3802
+ }
3803
+
3675
3804
TypeLayoutReflection* getTypeLayout (
3676
3805
TypeReflection* type,
3677
3806
LayoutRules rules = LayoutRules::Default)
@@ -3749,9 +3878,9 @@ namespace slang
3749
3878
return (DeclReflection*)spReflectionDecl_getChild ((SlangReflectionDecl*)this , index );
3750
3879
}
3751
3880
3752
- TypeReflection* getType (SlangSession* session )
3881
+ TypeReflection* getType ()
3753
3882
{
3754
- return (TypeReflection*)spReflection_getTypeFromDecl (session, (SlangReflectionDecl*)this );
3883
+ return (TypeReflection*)spReflection_getTypeFromDecl ((SlangReflectionDecl*)this );
3755
3884
}
3756
3885
3757
3886
VariableReflection* asVariable ()
@@ -3764,6 +3893,16 @@ namespace slang
3764
3893
return (FunctionReflection*)spReflectionDecl_castToFunction ((SlangReflectionDecl*)this );
3765
3894
}
3766
3895
3896
+ GenericReflection* asGeneric ()
3897
+ {
3898
+ return (GenericReflection*)spReflectionDecl_castToGeneric ((SlangReflectionDecl*)this );
3899
+ }
3900
+
3901
+ DeclReflection* getParent ()
3902
+ {
3903
+ return (DeclReflection*)spReflectionDecl_getParent ((SlangReflectionDecl*)this );
3904
+ }
3905
+
3767
3906
template <Kind K>
3768
3907
struct FilteredList
3769
3908
{
0 commit comments