HLSL Keywords (HLSL 关键字)

本文详细介绍了Microsoft High Level Shader Language (HLSL) 中的关键字及其使用方法,包括预定义标识符、数据类型、控制结构等,并强调了新旧纹理对象与采样器的推荐使用方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Keywords

The Microsoft High Level Shader Language (HLSL) recognizes the words in this section as keywords. Keywords are predefined reserved identifiers that have special meanings. You can't use them as identifiers in your app.

AppendStructuredBuffer, asm, asm_fragment
BlendState, boolbreakBufferByteAddressBuffer
case, cbuffercentroidclasscolumn_majorcompilecompile_fragmentCompileShader, const, continue, ComputeShader, ConsumeStructuredBuffer
default, DepthStencilState, DepthStencilView, discarddodoubleDomainShader, dword
elseexportextern
false, floatfor, fxgroup
GeometryShadergroupshared
halfHullshader
ifininlineinoutInputPatchintinterface
line, lineadjlinearLineStream
matrixmin16floatmin10floatmin16intmin12intmin16uint
namespace, nointerpolationnoperspective, NULL
outOutputPatch
packoffset, pass, pixelfragmentPixelShaderpointPointStreamprecise
RasterizerState, RenderTargetView, returnregisterrow_majorRWBufferRWByteAddressBuffer,RWStructuredBufferRWTexture1DRWTexture1DArrayRWTexture2DRWTexture2DArrayRWTexture3D
samplesampler, SamplerState, SamplerComparisonStatesharedsnorm, stateblock, stateblock_state, static,stringstructswitchStructuredBuffer
tbuffer, technique, technique10technique11textureTexture1DTexture1DArrayTexture2D,Texture2DArrayTexture2DMSTexture2DMSArrayTexture3DTextureCubeTextureCubeArray, true,typedeftriangle, triangleadjTriangleStream
uintuniformunorm, unsigned
vectorvertexfragmentVertexShader, void, volatile
while

 

 Remarks

These numeric types have scalar, vector, and matrix keyword expansions:

  • float, int, uint, bool
  • min10float, min16float
  • min12int, min16int
  • min16uint

The expansions of these numeric types follow this pattern, which uses float as an example:

  • Scalar

    float
  • Vector

    float1, float2, float3, float4
  • Matrix

    float1x1, float1x2, float1x3, float1x4

    float2x1, float2x2, float2x3, float2x4

    float3x1, float3x2, float3x3, float3x4

    float4x1, float4x2, float4x3, float4x4

HLSL supports lower-case texture and sampler for legacy reasons. Instead, for your new apps, we recommend that you use HLSL's new texture objects (Texture2DTexture3D, and so on) and sampler objects (SamplerState and SamplerComparisonState).

export

Use export to mark functions that you package into a library.

Here is an example:

export float identity(float x)
{
    return x;
}

By marking the identity function with the export keyword, you make the identity function available from a library for later linking. Without the export marking, the identity function isn't available for later linking.

The compiler ignores the export keyword for non-library compilation.

Note  The  export keyword requires the D3dcompiler_47.dll or a later version of the DLL.

Related topics

Appendix (DirectX HLSL)

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值