コード例 #1
0
ファイル: TypeFunction.cs プロジェクト: gleblebedev/Toe.SPIRV
 public TypeFunction(SpirvTypeBase returnType, params TypeFunctionArgument[] arguments)
 {
     ReturnType = returnType;
     foreach (var argument in arguments)
     {
         Arguments.Add(argument);
     }
 }
コード例 #2
0
ファイル: TypeFunction.cs プロジェクト: gleblebedev/Toe.SPIRV
 public TypeFunction(SpirvTypeBase returnType, IEnumerable <TypeFunctionArgument> arguments)
 {
     ReturnType = returnType;
     if (arguments != null)
     {
         foreach (var argument in arguments)
         {
             Arguments.Add(argument);
         }
     }
 }
コード例 #3
0
 public TypePointer(StorageClass storageClass, SpirvTypeBase type)
 {
     StorageClass = storageClass;
     Type         = type;
 }
コード例 #4
0
ファイル: TypePointer.cs プロジェクト: gleblebedev/Toe.SPIRV
 public void SetUp(OpTypePointer op, SpirvInstructionTreeBuilder treeBuilder)
 {
     StorageClass = op.StorageClass;
     Type         = treeBuilder.ResolveType(op.Type);
     SetUpDecorations(op, treeBuilder);
 }
コード例 #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));
        }
コード例 #6
0
 public TypeArray(SpirvTypeBase elementType, uint length)
 {
     ElementType = elementType;
     Length      = length;
 }
コード例 #7
0
 public void SetUp(OpTypeRuntimeArray op, SpirvInstructionTreeBuilder treeBuilder)
 {
     ElementType = treeBuilder.ResolveType(op.ElementType);
     SetUpDecorations(op, treeBuilder);
 }
コード例 #8
0
 public TypeStructureField(SpirvTypeBase type, string name = null)
 {
     Type = type;
     Name = name;
 }
コード例 #9
0
 public void SetUp(OpTypeSampledImage op, SpirvInstructionTreeBuilder treeBuilder)
 {
     ImageType = treeBuilder.ResolveType(op.ImageType);
     SetUpDecorations(op, treeBuilder);
 }
コード例 #10
0
 internal TypeVector(SpirvTypeBase componentType, uint componentCount)
 {
     ComponentCount = componentCount;
     ComponentType  = componentType;
     VectorType     = GetType(ComponentType, ComponentCount);
 }
コード例 #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);
        }
コード例 #12
0
 public static TypePointer MakePointer(this SpirvTypeBase type, StorageClass storageClass)
 {
     return(new TypePointer(storageClass, type));
 }