Up to date

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

RDShaderSPIRV

继承: Resource < RefCounted < Object

SPIR-V 中间表示,是 RDShaderFile 的一部分(由 RenderingDevice 使用)。

描述

RDShaderSPIRV 代表 RDShaderFile 不同着色器阶段的 SPIR-V 代码,以及可能的编译错误消息。SPIR-V 是一种低阶着色器中间表示。这种中间表示无法直接用于 GPU 渲染,但可以被编译为 GPU 能够理解的二进制着色器。与编译后的着色器不同,SPIR-V 可以在不同 GPU 型号以及驱动版本之间移植。

这个对象由 RenderingDevice 使用。

属性

PackedByteArray

bytecode_compute

PackedByteArray()

PackedByteArray

bytecode_fragment

PackedByteArray()

PackedByteArray

bytecode_tesselation_control

PackedByteArray()

PackedByteArray

bytecode_tesselation_evaluation

PackedByteArray()

PackedByteArray

bytecode_vertex

PackedByteArray()

String

compile_error_compute

""

String

compile_error_fragment

""

String

compile_error_tesselation_control

""

String

compile_error_tesselation_evaluation

""

String

compile_error_vertex

""

方法

PackedByteArray

get_stage_bytecode ( ShaderStage stage ) const

String

get_stage_compile_error ( ShaderStage stage ) const

void

set_stage_bytecode ( ShaderStage stage, PackedByteArray bytecode )

void

set_stage_compile_error ( ShaderStage stage, String compile_error )


属性说明

PackedByteArray bytecode_compute = PackedByteArray()

计算着色器阶段的 SPIR-V 字节码。


PackedByteArray bytecode_fragment = PackedByteArray()

片段着色器阶段的 SPIR-V 字节码。


PackedByteArray bytecode_tesselation_control = PackedByteArray()

曲面细分控制着色器阶段的 SPIR-V 字节码。


PackedByteArray bytecode_tesselation_evaluation = PackedByteArray()

曲面细分求值着色器阶段的 SPIR-V 字节码。


PackedByteArray bytecode_vertex = PackedByteArray()

顶点着色器阶段的 SPIR-V 字节码。


String compile_error_compute = ""

计算着色器阶段的编译错误信息(由 SPIR-V 编译器和 Godot 设置)。如果为空,则着色器成功编译。


String compile_error_fragment = ""

片段着色器阶段的编译错误信息(由 SPIR-V 编译器和 Godot 设置)。如果为空,则着色器成功编译。


String compile_error_tesselation_control = ""

曲面细分控制着色器阶段的编译错误信息(由 SPIR-V 编译器和 Godot 设置)。如果为空,则着色器成功编译。


String compile_error_tesselation_evaluation = ""

曲面细分求值着色器阶段的编译错误信息(由 SPIR-V 编译器和 Godot 设置)。如果为空,则着色器成功编译。


String compile_error_vertex = ""

顶点着色器阶段的编译错误信息(由 SPIR-V 编译器和 Godot 设置)。如果为空,则着色器成功编译。


方法说明

PackedByteArray get_stage_bytecode ( ShaderStage stage ) const

等价于获取 bytecode_computebytecode_fragmentbytecode_tesselation_controlbytecode_tesselation_evaluationbytecode_vertex 的其中之一。


String get_stage_compile_error ( ShaderStage stage ) const

返回给定着色器阶段 stage 的编译错误消息。等价于获取 compile_error_computecompile_error_fragmentcompile_error_tesselation_controlcompile_error_tesselation_evaluationcompile_error_vertex 的其中之一。


void set_stage_bytecode ( ShaderStage stage, PackedByteArray bytecode )

设置给定着色器阶段 stage 的 SPIR-V 字节码 bytecode。等价于设置 bytecode_computebytecode_fragmentbytecode_tesselation_controlbytecode_tesselation_evaluationbytecode_vertex 的其中之一。


void set_stage_compile_error ( ShaderStage stage, String compile_error )

设置给定着色器阶段 stage 的编译错误消息。等价于设置 compile_error_computecompile_error_fragmentcompile_error_tesselation_controlcompile_error_tesselation_evaluationcompile_error_vertex 的其中之一。