Exemple #1
0
        private void GetTextureValueAndScalarType(PredefinedObjectTypeSyntax node, out TypeSymbol valueType, out ScalarType scalarType)
        {
            if (node.TemplateArgumentList != null)
            {
                var valueTypeSyntax = (TypeSyntax)node.TemplateArgumentList.Arguments[0];
                valueType = Bind(valueTypeSyntax, x => BindType(x, null)).TypeSymbol;
                switch (valueTypeSyntax.Kind)
                {
                case SyntaxKind.PredefinedScalarType:
                    scalarType = TypeFacts.GetScalarType((ScalarTypeSyntax)valueTypeSyntax);
                    break;

                case SyntaxKind.PredefinedVectorType:
                    scalarType = TypeFacts.GetVectorType(((VectorTypeSyntax)valueTypeSyntax).TypeToken.Kind).Item1;
                    break;

                case SyntaxKind.PredefinedGenericVectorType:
                    scalarType = TypeFacts.GetScalarType(((GenericVectorTypeSyntax)valueTypeSyntax).ScalarType);
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            else
            {
                valueType  = IntrinsicTypes.Float4;
                scalarType = ScalarType.Float;
            }
        }
Exemple #2
0
        private void GetTextureValueAndScalarType(PredefinedObjectTypeSyntax node, out TypeSymbol valueType, out ScalarType scalarType)
        {
            if (node.TemplateArgumentList != null)
            {
                var valueTypeSyntax = (TypeSyntax)node.TemplateArgumentList.Arguments[0];
                if (valueTypeSyntax is ModifiedTypeSyntax modifiedType)
                {
                    valueTypeSyntax = modifiedType.Type;
                }
                valueType = Bind(valueTypeSyntax, x => BindType(x, null)).TypeSymbol;
                switch (valueTypeSyntax.Kind)
                {
                case SyntaxKind.PredefinedScalarType:
                    scalarType = TypeFacts.GetScalarType((ScalarTypeSyntax)valueTypeSyntax);
                    break;

                case SyntaxKind.PredefinedVectorType:
                    scalarType = TypeFacts.GetVectorType(((VectorTypeSyntax)valueTypeSyntax).TypeToken.Kind).Item1;
                    break;

                case SyntaxKind.PredefinedGenericVectorType:
                    scalarType = TypeFacts.GetScalarType(((GenericVectorTypeSyntax)valueTypeSyntax).ScalarType);
                    break;

                default:
                    Diagnostics.ReportInvalidType(valueTypeSyntax);
                    scalarType = ScalarType.Float;
                    break;
                }
            }
            else
            {
                valueType  = IntrinsicTypes.Float4;
                scalarType = ScalarType.Float;
            }
        }
Exemple #3
0
        private IntrinsicObjectTypeSymbol BindObjectType(PredefinedObjectTypeSyntax node)
        {
            if (node.ObjectTypeToken.ContextualKind == SyntaxKind.ConstantBufferKeyword)
            {
                var valueTypeSyntax = (TypeSyntax)node.TemplateArgumentList.Arguments[0];
                var valueType       = Bind(valueTypeSyntax, x => BindType(x, null));
                return(IntrinsicTypes.CreateConstantBufferType(valueType.TypeSymbol));
            }

            var predefinedObjectType = SyntaxFacts.GetPredefinedObjectType(node.ObjectTypeToken.Kind);

            switch (predefinedObjectType)
            {
            case PredefinedObjectType.Buffer:
            case PredefinedObjectType.Texture1D:
            case PredefinedObjectType.Texture1DArray:
            case PredefinedObjectType.Texture2D:
            case PredefinedObjectType.Texture2DArray:
            case PredefinedObjectType.Texture3D:
            case PredefinedObjectType.TextureCube:
            case PredefinedObjectType.TextureCubeArray:
            case PredefinedObjectType.Texture2DMS:
            case PredefinedObjectType.Texture2DMSArray:
            {
                TypeSymbol valueType;
                ScalarType scalarType;
                GetTextureValueAndScalarType(node, out valueType, out scalarType);
                return(IntrinsicTypes.CreateTextureType(predefinedObjectType, valueType, scalarType));
            }

            case PredefinedObjectType.RWBuffer:
            case PredefinedObjectType.RasterizerOrderedBuffer:
            case PredefinedObjectType.RWTexture1D:
            case PredefinedObjectType.RWTexture1DArray:
            case PredefinedObjectType.RWTexture2D:
            case PredefinedObjectType.RWTexture2DArray:
            case PredefinedObjectType.RWTexture3D:
            case PredefinedObjectType.RasterizerOrderedTexture1D:
            case PredefinedObjectType.RasterizerOrderedTexture1DArray:
            case PredefinedObjectType.RasterizerOrderedTexture2D:
            case PredefinedObjectType.RasterizerOrderedTexture2DArray:
            case PredefinedObjectType.RasterizerOrderedTexture3D:
            {
                TypeSymbol valueType;
                ScalarType scalarType;
                GetTextureValueAndScalarType(node, out valueType, out scalarType);
                return(IntrinsicTypes.CreateRWTextureType(predefinedObjectType, valueType, scalarType));
            }

            case PredefinedObjectType.AppendStructuredBuffer:
            case PredefinedObjectType.ConsumeStructuredBuffer:
            case PredefinedObjectType.StructuredBuffer:
            case PredefinedObjectType.RWStructuredBuffer:
            case PredefinedObjectType.RasterizerOrderedStructuredBuffer:
            case PredefinedObjectType.InputPatch:
            case PredefinedObjectType.OutputPatch:
            case PredefinedObjectType.PointStream:
            case PredefinedObjectType.LineStream:
            case PredefinedObjectType.TriangleStream:
            {
                var valueTypeSyntax = (TypeSyntax)node.TemplateArgumentList.Arguments[0];
                var valueType       = Bind(valueTypeSyntax, x => BindType(x, null)).TypeSymbol;
                switch (predefinedObjectType)
                {
                case PredefinedObjectType.AppendStructuredBuffer:
                    return(IntrinsicTypes.CreateAppendStructuredBufferType(valueType));

                case PredefinedObjectType.ConsumeStructuredBuffer:
                    return(IntrinsicTypes.CreateConsumeStructuredBufferType(valueType));

                case PredefinedObjectType.StructuredBuffer:
                    return(IntrinsicTypes.CreateStructuredBufferType(valueType));

                case PredefinedObjectType.RWStructuredBuffer:
                    return(IntrinsicTypes.CreateRWStructuredBufferType(valueType));

                case PredefinedObjectType.RasterizerOrderedStructuredBuffer:
                    return(IntrinsicTypes.CreateRasterizerOrderedStructuredBufferType(valueType));

                case PredefinedObjectType.InputPatch:
                    return(IntrinsicTypes.CreateInputPatchType(valueType));

                case PredefinedObjectType.OutputPatch:
                    return(IntrinsicTypes.CreateOutputPatchType(valueType));

                case PredefinedObjectType.PointStream:
                case PredefinedObjectType.LineStream:
                case PredefinedObjectType.TriangleStream:
                    return(IntrinsicTypes.CreateStreamOutputType(predefinedObjectType, valueType));

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            case PredefinedObjectType.ByteAddressBuffer:
                return(IntrinsicTypes.ByteAddressBuffer);

            case PredefinedObjectType.BlendState:
                return(IntrinsicTypes.BlendState);

            case PredefinedObjectType.DepthStencilState:
                return(IntrinsicTypes.DepthStencilState);

            case PredefinedObjectType.RasterizerState:
                return(IntrinsicTypes.RasterizerState);

            case PredefinedObjectType.RasterizerOrderedByteAddressBuffer:
                return(IntrinsicTypes.RasterizerOrderedByteAddressBuffer);

            case PredefinedObjectType.RWByteAddressBuffer:
                return(IntrinsicTypes.RWByteAddressBuffer);

            case PredefinedObjectType.Sampler:
                return(IntrinsicTypes.Sampler);

            case PredefinedObjectType.Sampler1D:
                return(IntrinsicTypes.Sampler1D);

            case PredefinedObjectType.Sampler2D:
                return(IntrinsicTypes.Sampler2D);

            case PredefinedObjectType.Sampler3D:
                return(IntrinsicTypes.Sampler3D);

            case PredefinedObjectType.SamplerCube:
                return(IntrinsicTypes.SamplerCube);

            case PredefinedObjectType.SamplerState:
                return(IntrinsicTypes.SamplerState);

            case PredefinedObjectType.SamplerComparisonState:
                return(IntrinsicTypes.SamplerComparisonState);

            case PredefinedObjectType.Texture:
                return(IntrinsicTypes.LegacyTexture);

            case PredefinedObjectType.GeometryShader:
                return(IntrinsicTypes.GeometryShader);

            case PredefinedObjectType.PixelShader:
                return(IntrinsicTypes.PixelShader);

            case PredefinedObjectType.VertexShader:
                return(IntrinsicTypes.VertexShader);

            default:
                throw new InvalidOperationException(predefinedObjectType.ToString());
            }
        }
Exemple #4
0
 private void GetTextureValueAndScalarType(PredefinedObjectTypeSyntax node, out TypeSymbol valueType, out ScalarType scalarType)
 {
     if (node.TemplateArgumentList != null)
     {
         var valueTypeSyntax = (TypeSyntax) node.TemplateArgumentList.Arguments[0];
         valueType = Bind(valueTypeSyntax, x => BindType(x, null)).TypeSymbol;
         switch (valueTypeSyntax.Kind)
         {
             case SyntaxKind.PredefinedScalarType:
                 scalarType = TypeFacts.GetScalarType((ScalarTypeSyntax) valueTypeSyntax);
                 break;
             case SyntaxKind.PredefinedVectorType:
                 scalarType = TypeFacts.GetVectorType(((VectorTypeSyntax) valueTypeSyntax).TypeToken.Kind).Item1;
                 break;
             case SyntaxKind.PredefinedGenericVectorType:
                 scalarType = TypeFacts.GetScalarType(((GenericVectorTypeSyntax) valueTypeSyntax).ScalarType);
                 break;
             default:
                 throw new ArgumentOutOfRangeException();
         }
     }
     else
     {
         valueType = IntrinsicTypes.Float4;
         scalarType = ScalarType.Float;
     }
 }
Exemple #5
0
        private TypeSymbol ResolveIntrinsicObjectType(PredefinedObjectTypeSyntax type, ISymbolTable symbolTable, Symbol contextSymbol)
        {
            var predefinedObjectType = SyntaxFacts.GetPredefinedObjectType(type.ObjectTypeToken.Kind);

            switch (predefinedObjectType)
            {
            case PredefinedObjectType.Buffer:
            case PredefinedObjectType.Texture1D:
            case PredefinedObjectType.Texture1DArray:
            case PredefinedObjectType.Texture2D:
            case PredefinedObjectType.Texture2DArray:
            case PredefinedObjectType.Texture3D:
            case PredefinedObjectType.TextureCube:
            case PredefinedObjectType.TextureCubeArray:
            case PredefinedObjectType.Texture2DMS:
            case PredefinedObjectType.Texture2DMSArray:
            {
                TypeSymbol valueType;
                ScalarType scalarType;
                if (type.TemplateArgumentList != null)
                {
                    var valueTypeSyntax = type.TemplateArgumentList.Arguments[0];
                    valueType = ResolveIntrinsicType((PredefinedTypeSyntax)valueTypeSyntax, symbolTable, contextSymbol);
                    switch (valueTypeSyntax.Kind)
                    {
                    case SyntaxKind.PredefinedScalarType:
                        scalarType = SyntaxFacts.GetScalarType(((ScalarTypeSyntax)valueTypeSyntax).TypeTokens.Select(x => x.Kind).ToArray());
                        break;

                    case SyntaxKind.PredefinedVectorType:
                        scalarType = SyntaxFacts.GetVectorType(((VectorTypeSyntax)valueTypeSyntax).TypeToken.Kind).Item1;
                        break;

                    case SyntaxKind.PredefinedGenericVectorType:
                        scalarType = SyntaxFacts.GetScalarType(((GenericVectorTypeSyntax)valueTypeSyntax).ScalarType.TypeTokens.Select(x => x.Kind).ToArray());
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }
                else
                {
                    valueType  = IntrinsicTypes.Float4;
                    scalarType = ScalarType.Float;
                }
                return(IntrinsicTypes.CreateTextureType(predefinedObjectType, valueType, scalarType));
            }

            case PredefinedObjectType.RWBuffer:
            case PredefinedObjectType.RWTexture1D:
            case PredefinedObjectType.RWTexture1DArray:
            case PredefinedObjectType.RWTexture2D:
            case PredefinedObjectType.RWTexture2DArray:
            case PredefinedObjectType.RWTexture3D:
                throw new NotImplementedException();

            case PredefinedObjectType.AppendStructuredBuffer:
            case PredefinedObjectType.ConsumeStructuredBuffer:
            case PredefinedObjectType.StructuredBuffer:
            {
                var valueTypeSyntax = (TypeSyntax)type.TemplateArgumentList.Arguments[0];
                var valueType       = ResolveType(valueTypeSyntax, symbolTable, contextSymbol);
                switch (predefinedObjectType)
                {
                case PredefinedObjectType.AppendStructuredBuffer:
                    return(IntrinsicTypes.CreateAppendStructuredBufferType(valueType));

                case PredefinedObjectType.ConsumeStructuredBuffer:
                    return(IntrinsicTypes.CreateConsumeStructuredBufferType(valueType));

                case PredefinedObjectType.StructuredBuffer:
                    return(IntrinsicTypes.CreateStructuredBufferType(valueType));

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }

            case PredefinedObjectType.ByteAddressBuffer:
                return(IntrinsicTypes.CreateByteAddressBufferType());

            case PredefinedObjectType.RWByteAddressBuffer:
            case PredefinedObjectType.RWStructuredBuffer:
            case PredefinedObjectType.InputPatch:
            case PredefinedObjectType.OutputPatch:
            case PredefinedObjectType.PointStream:
            case PredefinedObjectType.LineStream:
            case PredefinedObjectType.TriangleStream:
                throw new NotImplementedException();

            case PredefinedObjectType.Sampler:
            case PredefinedObjectType.SamplerState:
                return(IntrinsicTypes.SamplerState);

            case PredefinedObjectType.SamplerComparisonState:
                return(IntrinsicTypes.SamplerComparisonState);

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemple #6
0
        private IntrinsicObjectTypeSymbol BindObjectType(PredefinedObjectTypeSyntax node)
        {
            if (node.ObjectTypeToken.ContextualKind == SyntaxKind.ConstantBufferKeyword)
            {
                var valueTypeSyntax = (TypeSyntax) node.TemplateArgumentList.Arguments[0];
                var valueType = Bind(valueTypeSyntax, x => BindType(x, null));
                return IntrinsicTypes.CreateConstantBufferType(valueType.TypeSymbol);
            }

            var predefinedObjectType = SyntaxFacts.GetPredefinedObjectType(node.ObjectTypeToken.Kind);
            switch (predefinedObjectType)
            {
                case PredefinedObjectType.Buffer:
                case PredefinedObjectType.Texture1D:
                case PredefinedObjectType.Texture1DArray:
                case PredefinedObjectType.Texture2D:
                case PredefinedObjectType.Texture2DArray:
                case PredefinedObjectType.Texture3D:
                case PredefinedObjectType.TextureCube:
                case PredefinedObjectType.TextureCubeArray:
                case PredefinedObjectType.Texture2DMS:
                case PredefinedObjectType.Texture2DMSArray:
                    {
                        TypeSymbol valueType;
                        ScalarType scalarType;
                        GetTextureValueAndScalarType(node, out valueType, out scalarType);
                        return IntrinsicTypes.CreateTextureType(predefinedObjectType, valueType, scalarType);
                    }
                case PredefinedObjectType.RWBuffer:
                case PredefinedObjectType.RasterizerOrderedBuffer:
                case PredefinedObjectType.RWTexture1D:
                case PredefinedObjectType.RWTexture1DArray:
                case PredefinedObjectType.RWTexture2D:
                case PredefinedObjectType.RWTexture2DArray:
                case PredefinedObjectType.RWTexture3D:
                case PredefinedObjectType.RasterizerOrderedTexture1D:
                case PredefinedObjectType.RasterizerOrderedTexture1DArray:
                case PredefinedObjectType.RasterizerOrderedTexture2D:
                case PredefinedObjectType.RasterizerOrderedTexture2DArray:
                case PredefinedObjectType.RasterizerOrderedTexture3D:
                    {
                        TypeSymbol valueType;
                        ScalarType scalarType;
                        GetTextureValueAndScalarType(node, out valueType, out scalarType);
                        return IntrinsicTypes.CreateRWTextureType(predefinedObjectType, valueType, scalarType);
                    }
                case PredefinedObjectType.AppendStructuredBuffer:
                case PredefinedObjectType.ConsumeStructuredBuffer:
                case PredefinedObjectType.StructuredBuffer:
                case PredefinedObjectType.RWStructuredBuffer:
                case PredefinedObjectType.RasterizerOrderedStructuredBuffer:
                case PredefinedObjectType.InputPatch:
                case PredefinedObjectType.OutputPatch:
                case PredefinedObjectType.PointStream:
                case PredefinedObjectType.LineStream:
                case PredefinedObjectType.TriangleStream:
                    {
                        var valueTypeSyntax = (TypeSyntax) node.TemplateArgumentList.Arguments[0];
                        var valueType = Bind(valueTypeSyntax, x => BindType(x, null)).TypeSymbol;
                        switch (predefinedObjectType)
                        {
                            case PredefinedObjectType.AppendStructuredBuffer:
                                return IntrinsicTypes.CreateAppendStructuredBufferType(valueType);
                            case PredefinedObjectType.ConsumeStructuredBuffer:
                                return IntrinsicTypes.CreateConsumeStructuredBufferType(valueType);
                            case PredefinedObjectType.StructuredBuffer:
                                return IntrinsicTypes.CreateStructuredBufferType(valueType);
                            case PredefinedObjectType.RWStructuredBuffer:
                                return IntrinsicTypes.CreateRWStructuredBufferType(valueType);
                            case PredefinedObjectType.RasterizerOrderedStructuredBuffer:
                                return IntrinsicTypes.CreateRasterizerOrderedStructuredBufferType(valueType);
                            case PredefinedObjectType.InputPatch:
                                return IntrinsicTypes.CreateInputPatchType(valueType);
                            case PredefinedObjectType.OutputPatch:
                                return IntrinsicTypes.CreateOutputPatchType(valueType);
                            case PredefinedObjectType.PointStream:
                            case PredefinedObjectType.LineStream:
                            case PredefinedObjectType.TriangleStream:
                                return IntrinsicTypes.CreateStreamOutputType(predefinedObjectType, valueType);
                            default:
                                throw new ArgumentOutOfRangeException();
                        }
                    }
                case PredefinedObjectType.ByteAddressBuffer:
                    return IntrinsicTypes.ByteAddressBuffer;
                case PredefinedObjectType.BlendState:
                    return IntrinsicTypes.BlendState;
                case PredefinedObjectType.DepthStencilState:
                    return IntrinsicTypes.DepthStencilState;
                case PredefinedObjectType.RasterizerState:
                    return IntrinsicTypes.RasterizerState;
                case PredefinedObjectType.RasterizerOrderedByteAddressBuffer:
                    return IntrinsicTypes.RasterizerOrderedByteAddressBuffer;
                case PredefinedObjectType.RWByteAddressBuffer:
                    return IntrinsicTypes.RWByteAddressBuffer;
                case PredefinedObjectType.Sampler:
                    return IntrinsicTypes.Sampler;
                case PredefinedObjectType.Sampler1D:
                    return IntrinsicTypes.Sampler1D;
                case PredefinedObjectType.Sampler2D:
                    return IntrinsicTypes.Sampler2D;
                case PredefinedObjectType.Sampler3D:
                    return IntrinsicTypes.Sampler3D;
                case PredefinedObjectType.SamplerCube:
                    return IntrinsicTypes.SamplerCube;
                case PredefinedObjectType.SamplerState:
                    return IntrinsicTypes.SamplerState;
                case PredefinedObjectType.SamplerComparisonState:
                    return IntrinsicTypes.SamplerComparisonState;
                case PredefinedObjectType.Texture:
                    return IntrinsicTypes.LegacyTexture;
                case PredefinedObjectType.GeometryShader:
                    return IntrinsicTypes.GeometryShader;
                case PredefinedObjectType.PixelShader:
                    return IntrinsicTypes.PixelShader;
                case PredefinedObjectType.VertexShader:
                    return IntrinsicTypes.VertexShader;
                default:
                    throw new InvalidOperationException(predefinedObjectType.ToString());
            }
        }
Exemple #7
0
 private TypeSymbol ResolveIntrinsicObjectType(PredefinedObjectTypeSyntax type, ISymbolTable symbolTable, Symbol contextSymbol)
 {
     var predefinedObjectType = SyntaxFacts.GetPredefinedObjectType(type.ObjectTypeToken.Kind);
     switch (predefinedObjectType)
     {
         case PredefinedObjectType.Buffer:
         case PredefinedObjectType.Texture1D:
         case PredefinedObjectType.Texture1DArray:
         case PredefinedObjectType.Texture2D:
         case PredefinedObjectType.Texture2DArray:
         case PredefinedObjectType.Texture3D:
         case PredefinedObjectType.TextureCube:
         case PredefinedObjectType.TextureCubeArray:
         case PredefinedObjectType.Texture2DMS:
         case PredefinedObjectType.Texture2DMSArray:
         {
             TypeSymbol valueType;
             ScalarType scalarType;
             if (type.TemplateArgumentList != null)
             {
                 var valueTypeSyntax = type.TemplateArgumentList.Arguments[0];
                 valueType = ResolveIntrinsicType((PredefinedTypeSyntax) valueTypeSyntax, symbolTable, contextSymbol);
                 switch (valueTypeSyntax.Kind)
                 {
                     case SyntaxKind.PredefinedScalarType:
                         scalarType = SyntaxFacts.GetScalarType(((ScalarTypeSyntax) valueTypeSyntax).TypeTokens.Select(x => x.Kind).ToArray());
                         break;
                     case SyntaxKind.PredefinedVectorType:
                         scalarType = SyntaxFacts.GetVectorType(((VectorTypeSyntax) valueTypeSyntax).TypeToken.Kind).Item1;
                         break;
                     case SyntaxKind.PredefinedGenericVectorType:
                         scalarType = SyntaxFacts.GetScalarType(((GenericVectorTypeSyntax) valueTypeSyntax).ScalarType.TypeTokens.Select(x => x.Kind).ToArray());
                         break;
                     default:
                         throw new ArgumentOutOfRangeException();
                 }
             }
             else
             {
                 valueType = IntrinsicTypes.Float4;
                 scalarType = ScalarType.Float;
             }
             return IntrinsicTypes.CreateTextureType(predefinedObjectType, valueType, scalarType);
         }
         case PredefinedObjectType.RWBuffer:
         case PredefinedObjectType.RWTexture1D:
         case PredefinedObjectType.RWTexture1DArray:
         case PredefinedObjectType.RWTexture2D:
         case PredefinedObjectType.RWTexture2DArray:
         case PredefinedObjectType.RWTexture3D:
             throw new NotImplementedException();
         case PredefinedObjectType.AppendStructuredBuffer:
         case PredefinedObjectType.ConsumeStructuredBuffer:
         case PredefinedObjectType.StructuredBuffer:
         {
             var valueTypeSyntax = (TypeSyntax) type.TemplateArgumentList.Arguments[0];
             var valueType = ResolveType(valueTypeSyntax, symbolTable, contextSymbol);
             switch (predefinedObjectType)
             {
                 case PredefinedObjectType.AppendStructuredBuffer:
                     return IntrinsicTypes.CreateAppendStructuredBufferType(valueType);
                 case PredefinedObjectType.ConsumeStructuredBuffer:
                     return IntrinsicTypes.CreateConsumeStructuredBufferType(valueType);
                 case PredefinedObjectType.StructuredBuffer:
                     return IntrinsicTypes.CreateStructuredBufferType(valueType);
                 default:
                     throw new ArgumentOutOfRangeException();
             }
         }
         case PredefinedObjectType.ByteAddressBuffer:
             return IntrinsicTypes.CreateByteAddressBufferType();
         case PredefinedObjectType.RWByteAddressBuffer:
         case PredefinedObjectType.RWStructuredBuffer:
         case PredefinedObjectType.InputPatch:
         case PredefinedObjectType.OutputPatch:
         case PredefinedObjectType.PointStream:
         case PredefinedObjectType.LineStream:
         case PredefinedObjectType.TriangleStream:
             throw new NotImplementedException();
         case PredefinedObjectType.Sampler:
         case PredefinedObjectType.SamplerState:
             return IntrinsicTypes.SamplerState;
         case PredefinedObjectType.SamplerComparisonState:
             return IntrinsicTypes.SamplerComparisonState;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
 public virtual void VisitPredefinedObjectType(PredefinedObjectTypeSyntax node)
 {
     DefaultVisit(node);
 }
 public virtual void VisitPredefinedObjectType(PredefinedObjectTypeSyntax node)
 {
     DefaultVisit(node);
 }
        public static void SetType(TypeSyntax typeSyntax)
        {
            if (!IsGroupOpen())
            {
                return;
            }

            if (typeSyntax.Kind == SyntaxKind.PredefinedScalarType)
            {
                _activeVar.IsScalar = true;

                ScalarTypeSyntax stSyntax = (ScalarTypeSyntax)typeSyntax;
                if (stSyntax.TypeTokens.Count == 2)
                {
                    _activeVar.DataType = GetDataType(stSyntax.TypeTokens[1].ValueText);
                    if (_activeVar.DataType == DataType.Int && stSyntax.TypeTokens[0].ValueText.Equals("unsigned"))
                    {
                        _activeVar.DataType = DataType.Uint;
                    }
                }
                else if (stSyntax.TypeTokens.Count == 1)
                {
                    _activeVar.DataType = GetDataType(stSyntax.TypeTokens[0].ValueText);
                }
                else
                {
                    _varValid = false;
                }
            }
            else if (typeSyntax.Kind == SyntaxKind.PredefinedVectorType)
            {
                _activeVar.IsVector = true;

                VectorTypeSyntax vtSyntax    = (VectorTypeSyntax)typeSyntax;
                string           syntaxToken = vtSyntax.TypeToken.ValueText;
                _activeVar.DataType = GetDataType(syntaxToken);
                ParseVectorColumns(syntaxToken);
            }
            else if (typeSyntax.Kind == SyntaxKind.PredefinedMatrixType)
            {
                _activeVar.IsMatrix = true;

                MatrixTypeSyntax mtSyntax    = (MatrixTypeSyntax)typeSyntax;
                string           syntaxToken = mtSyntax.TypeToken.ValueText;
                _activeVar.DataType = GetDataType(syntaxToken);
                ParseMatrixDimensions(syntaxToken);
            }
            else if (typeSyntax.Kind == SyntaxKind.PredefinedObjectType)
            {
                PredefinedObjectTypeSyntax otSyntax = (PredefinedObjectTypeSyntax)typeSyntax;
                if (otSyntax.ObjectTypeToken.Kind == SyntaxKind.Texture2DKeyword)
                {
                    _activeVar.IsTexture = true;
                    _activeVar.DataType  = DataType.Texture;
                }
                else
                {
                    _varValid = false;
                }
            }
            else
            {
                _varValid = false;
            }
        }