LanguageEnglish
  • C#

ShaderPrecisionModel

enumeration

Description

Options for the shader precision model.

This enumeration allows you to change two things: the default sampler precision and the definition of half.

The default sampler precision is only relevant to samplers that don't explicitly declare a precision. For example, sampler2D uses the default precision, but sampler2D_float uses full precision regardless of the default precision.

Regarding the shader type half, it is defined as either float or min16float (see SL-DataTypesAndPrecision). For the purpose of uploading data to buffers, including constant buffers, the size and alignment is 4 bytes in both cases.

Properties

PlatformDefaultUse the target platform defaults. The default sampler precision is half precision on mobile targets and full precision elsewhere. Also, shader type half is defined as min16float on mobile targets and float elsewhere.
UnifiedUse full sampler precision by default, and explicitly declare when you want to use lower precision. Refer to SL-DataTypesAndPrecision for more information. In addition, half is defined as min16float on all platforms. This sets BuiltinShaderDefine.UNITY_UNIFIED_SHADER_PRECISION_MODEL when Unity compiles shaders.

对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961