QShaderCode Class

包含着色器的源代码或二进制代码以及附加元数据。更多

头文件: #include <QShaderCode>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Qt 6.6

公共函数

QShaderCode()
QShaderCode(const QByteArray &code, const QByteArray &entry = QByteArray())
QByteArray entryPoint() const
void setEntryPoint(const QByteArray &entry)
void setShader(const QByteArray &code)
QByteArray shader() const
size_t qHash(const QShaderCode &key, size_t seed = 0)
bool operator!=(const QShaderCode &lhs, const QShaderCode &rhs)
bool operator==(const QShaderCode &lhs, const QShaderCode &rhs)

详细说明

QShader 获取 QShaderCode 实例后,如果shader() 为空,则表示未找到请求键的着色器代码。

注: 这是一个 RHI API,具有有限的兼容性保证,详情请参见QShader

成员函数文档

[constexpr noexcept] QShaderCode::QShaderCode()

QShaderCode::QShaderCode(const QByteArray &code, const QByteArray &entry = QByteArray())

使用指定的着色器源codeentry 点名称构建新的 QShaderCode。

QByteArray QShaderCode::entryPoint() const

返回入口点名称。

另请参见 setEntryPoint()。

void QShaderCode::setEntryPoint(const QByteArray &entry)

设置entry 点名称。

另请参见 entryPoint().

void QShaderCode::setShader(const QByteArray &code)

设置着色器源或字节code

另请参阅 shader() 。

QByteArray QShaderCode::shader() const

返回着色器源代码或字节码。

另请参阅 setShader().

相关非会员

[noexcept] size_t qHash(const QShaderCode &key, size_t seed = 0)

返回key 的哈希值,使用seed 作为计算的种子。

[noexcept] bool operator!=(const QShaderCode &lhs, const QShaderCode &rhs)

如果两个QShaderCode 对象lhsrhs 中的值相等,则返回false ;否则返回true

[noexcept] bool operator==(const QShaderCode &lhs, const QShaderCode &rhs)

如果两个QShaderCode 对象lhsrhs 相等,则返回true

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.