Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

RDPipelineSpecializationConstant

繼承: RefCounted < Object

管線特化常數(由 RenderingDevice 使用)。

說明

特化常數可以建立同一著色器的額外版本,但不會導致實際編譯的著色器版本數增加。這樣就能減少著色器的版本數、減少 if 分支,從而提升性能,但與此同時保持著色器能夠在不同場合靈活運用。

這個物件由 RenderingDevice 使用。

屬性

int

constant_id

0

Variant

value


屬性說明

int constant_id = 0 🔗

  • void set_constant_id(value: int)

  • int get_constant_id()

特化常數的識別字。這個值從 0 開始,給定著色器中每一個不同的特化常數都會將其遞增。


Variant value 🔗

特化常數的值。只有 boolintfloat 型別是有效的特化常數。