关键字
Microsoft高级着色器语言(HLSL)将本节中的单词识别为关键字。 关键字是具有特殊含义的预定义保留标识符。 不能将它们用作应用中的标识符。
- AppendStructuredBuffer、asm、asm_fragment
- BlendState、bool、break、Buffer、ByteAddressBuffer
- case、cbuffer、质心、类、column_major、编译、compile_fragment、CompileShader、const、继续、ComputeShader、ConsumeStructuredBuffer
- default、 DepthStencilState、 DepthStencilView, discard, do, double, DomainShader, dword
- 其他,导出,
- false, float, for, fxgroup
- GeometryShader,组共享
- 半,赫尔沙德
- 如果、中的、内联、、InputPatch、int、接口
- 行、lineadj、线性、LineStream
- 矩阵、min16float、min10float、min16int、min12int、min16uint
- namespace, nointerpolation, noperspective, NULL
- 输出,OutputPatch
- packoffset、pass、像素整理、PixelShader、点、PointStream、精确
- RasterizerState、RenderTargetView、 返回、寄存器、row_major、RWBuffer、RWByteAddressBuffer、RWStructuredBuffer、RWTexture1D、RWTexture1DArray、RWTexture2D、RWTexture2DArray、RWTexture3D
- 示例、采样器、SamplerState、SamplerComparisonState、共享、、stateblock、stateblock_state、静态、字符串、结构、开关、StructuredBuffer
- tbuffer、技术、技术 10、技术 11、纹理、Texture1D、Texture1DArray、Texture2D、Texture2DArray、Texture2DMS、Texture2DMSArray、Texture3D、TextureCube、TextureCubeArray、true、 typedef、三角形、三角形、TriangleStream
- uint、统一、无序、无符号
- 向量、顶点、顶点Shader、void、可变
- 时
言论
这些数值类型具有标量、矢量和矩阵关键字扩展:
- float、int、uint、bool
- min10float、min16float
- min12int、min16int
- min16uint
这些数值类型的扩展遵循此模式,该模式使用 float 作为示例:
标量
- 浮
向量
- float1, float2, float3, float4
矩阵
- float1x1、float1x2、float1x3、float1x4 float2x1、float2x2、float2x3、float2x4 float3x1、float3x2、float3x4 float4x1、float4x2、float4x3、float4x4
由于传统原因,HLSL 支持小写 纹理 和 采样器。 相反,对于新应用,我们建议使用 HLSL 的新纹理对象(Texture2D、Texture3D等)和采样器对象(SamplerState 和 SamplerComparisonState)。
出口
使用 导出 标记打包到库中的函数。
下面是一个示例:
export float identity(float x)
{
return x;
}
通过使用 导出 关键字标记 标识 函数,可以将 标识 函数从库中用于以后的链接。 如果没有 导出 标记,则 标识 函数不适用于以后的链接。
编译器忽略非库编译的 导出 关键字。
注意
导出 关键字需要 D3dcompiler_47.dll 或更高版本的 DLL。
相关主题