Esempio n. 1
0
 public TypeFunction(SpirvTypeBase returnType, params TypeFunctionArgument[] arguments)
 {
     ReturnType = returnType;
     foreach (var argument in arguments)
     {
         Arguments.Add(argument);
     }
 }
Esempio n. 2
0
 public TypeFunction(SpirvTypeBase returnType, IEnumerable <TypeFunctionArgument> arguments)
 {
     ReturnType = returnType;
     if (arguments != null)
     {
         foreach (var argument in arguments)
         {
             Arguments.Add(argument);
         }
     }
 }
Esempio n. 3
0
 public TypePointer(StorageClass storageClass, SpirvTypeBase type)
 {
     StorageClass = storageClass;
     Type         = type;
 }
Esempio n. 4
0
 public void SetUp(OpTypePointer op, SpirvInstructionTreeBuilder treeBuilder)
 {
     StorageClass = op.StorageClass;
     Type         = treeBuilder.ResolveType(op.Type);
     SetUpDecorations(op, treeBuilder);
 }
Esempio n. 5
0
        public static TypeVector ResolveVector(SpirvTypeBase componentType, uint componentCount)
        {
            switch (componentType.TypeCategory)
            {
            case SpirvTypeCategory.Float:
            {
                var sprivFloat = (TypeFloat)componentType;
                switch (sprivFloat.FloatType)
                {
                case FloatType.Float:
                    switch (componentCount)
                    {
                    case 2: return(Vec2);

                    case 3: return(Vec3);

                    case 4: return(Vec4);
                    }
                    break;

                case FloatType.Double:
                    switch (componentCount)
                    {
                    case 2: return(Dvec2);

                    case 3: return(Dvec3);

                    case 4: return(Dvec4);
                    }
                    break;
                }
                break;
            }

            case SpirvTypeCategory.Int:
            {
                var sprivInt = (TypeInt)componentType;
                switch (sprivInt.IntType)
                {
                case IntType.Int:
                    switch (componentCount)
                    {
                    case 2: return(Ivec2);

                    case 3: return(Ivec3);

                    case 4: return(Ivec4);
                    }
                    break;

                case IntType.UInt:
                    switch (componentCount)
                    {
                    case 2: return(Uvec2);

                    case 3: return(Uvec3);

                    case 4: return(Uvec4);
                    }
                    break;
                }
                break;
            }

            case SpirvTypeCategory.Bool:
            {
                switch (componentCount)
                {
                case 2: return(Bvec2);

                case 3: return(Bvec3);

                case 4: return(Bvec4);
                }

                break;
            }
            }

            return(new TypeVector(componentType, componentCount));
        }
Esempio n. 6
0
 public TypeArray(SpirvTypeBase elementType, uint length)
 {
     ElementType = elementType;
     Length      = length;
 }
Esempio n. 7
0
 public void SetUp(OpTypeRuntimeArray op, SpirvInstructionTreeBuilder treeBuilder)
 {
     ElementType = treeBuilder.ResolveType(op.ElementType);
     SetUpDecorations(op, treeBuilder);
 }
 public TypeStructureField(SpirvTypeBase type, string name = null)
 {
     Type = type;
     Name = name;
 }
Esempio n. 9
0
 public void SetUp(OpTypeSampledImage op, SpirvInstructionTreeBuilder treeBuilder)
 {
     ImageType = treeBuilder.ResolveType(op.ImageType);
     SetUpDecorations(op, treeBuilder);
 }
Esempio n. 10
0
 internal TypeVector(SpirvTypeBase componentType, uint componentCount)
 {
     ComponentCount = componentCount;
     ComponentType  = componentType;
     VectorType     = GetType(ComponentType, ComponentCount);
 }
Esempio n. 11
0
        public static VectorType GetType(SpirvTypeBase componentType, uint componentCount)
        {
            switch (componentType.TypeCategory)
            {
            case SpirvTypeCategory.Float:
            {
                var floatType = (TypeFloat)componentType;
                switch (floatType.FloatType)
                {
                case FloatType.Float:
                    switch (componentCount)
                    {
                    case 2:
                        return(VectorType.Vec2);

                    case 3:
                        return(VectorType.Vec3);

                    case 4:
                        return(VectorType.Vec4);
                    }
                    break;

                case FloatType.Double:
                    switch (componentCount)
                    {
                    case 2:
                        return(VectorType.Dvec2);

                    case 3:
                        return(VectorType.Dvec3);

                    case 4:
                        return(VectorType.Dvec4);
                    }
                    break;
                }
                break;
            }

            case SpirvTypeCategory.Int:
            {
                var intType = (TypeInt)componentType;
                switch (intType.IntType)
                {
                case IntType.Int:
                    switch (componentCount)
                    {
                    case 2:
                        return(VectorType.Ivec2);

                    case 3:
                        return(VectorType.Ivec3);

                    case 4:
                        return(VectorType.Ivec4);
                    }
                    break;

                case IntType.UInt:
                    switch (componentCount)
                    {
                    case 2:
                        return(VectorType.Uvec2);

                    case 3:
                        return(VectorType.Uvec3);

                    case 4:
                        return(VectorType.Uvec4);
                    }
                    break;
                }
                break;
            }

            case SpirvTypeCategory.Bool:
            {
                switch (componentCount)
                {
                case 2:
                    return(VectorType.Bvec2);

                case 3:
                    return(VectorType.Bvec3);

                case 4:
                    return(VectorType.Bvec4);
                }

                break;
            }
            }

            return(VectorType.Unknown);
        }
Esempio n. 12
0
 public static TypePointer MakePointer(this SpirvTypeBase type, StorageClass storageClass)
 {
     return(new TypePointer(storageClass, type));
 }