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()); } }