Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

RDPipelineSpecializationConstant

继承: RefCounted < Object

管线特化常量(由 RenderingDevice 使用)。

描述

特化常量可以创建同一着色器的额外版本,但不会导致实际编译的着色器版本数增加。这样就能减少着色器的版本数、减少 if 分支,从而提升性能,但与此同时保持着色器能够在不同场合灵活运用。

这个对象由 RenderingDevice 使用。

属性

int

constant_id

0

Variant

value


属性说明

int constant_id = 0

  • void set_constant_id ( int value )

  • int get_constant_id ( )

特化常量的标识符。这个值从 0 开始,给定着色器中每一个不同的特化常量都会将其递增。


Variant value

特化常量的值。只有 boolintfloat 类型是有效的特化常量。