294 }
else if (
other.d) {
434 ds << int(dd->
stage);
442 ds <<
shader.entryPoint();
450 for (
auto mapIt =
map.
cbegin(), mapItEnd =
map.
cend(); mapIt != mapItEnd; ++mapIt) {
452 ds << mapIt.value().first;
453 ds << mapIt.value().second;
462 for (
auto listIt =
list.
cbegin(), listItEnd =
list.
cend(); listIt != listItEnd; ++listIt) {
463 ds << listIt->combinedSamplerName;
464 ds << listIt->textureBinding;
465 ds << listIt->samplerBinding;
474 ds << int(
it->extraBufferBindings.
size());
475 for (
auto mapIt =
it->extraBufferBindings.
cbegin(), mapItEnd =
it->extraBufferBindings.
cend();
476 mapIt != mapItEnd; ++mapIt)
496 ver.
setFlags(QShaderVersion::Flags(intVal));
525 d->qsbVersion = intVal;
536 qWarning(
"Attempted to deserialize QShader with unknown version %d.",
d->qsbVersion);
545 qWarning(
"Can no longer load QShaderDescription from CBOR.");
548 qWarning(
"Can no longer load QShaderDescription from binary JSON.");
573 for (
int b = 0;
b < mapSize; ++
b) {
576 int firstNativeBinding;
577 ds >> firstNativeBinding;
578 int secondNativeBinding;
579 ds >> secondNativeBinding;
580 map.
insert(binding, { firstNativeBinding, secondNativeBinding });
582 d->bindings.insert(k,
map);
594 for (
int b = 0;
b < listSize; ++
b) {
596 ds >> combinedSamplerName;
598 ds >> textureBinding;
600 ds >> samplerBinding;
601 list.
append({ combinedSamplerName, textureBinding, samplerBinding });
603 d->combinedImageMap.insert(k,
list);
617 for (
int b = 0;
b < mapSize; ++
b) {
621 extraBufferBindings.
insert(k,
v);
623 d->nativeShaderInfoMap.insert(k, {
flags, extraBufferBindings });
638 : m_version(
v), m_flags(
f)
671 : m_shader(code), m_entryPoint(
entry)
707 m_sourceVersion(sver),
708 m_sourceVariant(svar)
751 if (!lhs.d || !rhs.d)
752 return lhs.d == rhs.d;
754 return lhs.d->stage == rhs.d->stage
755 && lhs.d->shaders == rhs.d->shaders
756 && lhs.d->bindings == rhs.d->bindings;
778 if (!
s.d->shaders.isEmpty()) {
794 return lhs.version() == rhs.version() && lhs.flags() == rhs.flags();
813 if (lhs.version() < rhs.version())
816 if (lhs.version() == rhs.version())
817 return int(lhs.flags()) < int(rhs.flags());
838 return lhs.source() == rhs.source() && lhs.sourceVersion() == rhs.sourceVersion()
839 && lhs.sourceVariant() == rhs.sourceVariant();
851 if (
int(lhs.source()) <
int(rhs.source()))
854 if (
int(lhs.source()) ==
int(rhs.source())) {
855 if (lhs.sourceVersion() < rhs.sourceVersion())
857 if (lhs.sourceVersion() == rhs.sourceVersion()) {
858 if (
int(lhs.sourceVariant()) <
int(rhs.sourceVariant()))
884 k.sourceVersion().version(),
885 k.sourceVersion().flags(),
896 return lhs.shader() == rhs.shader() && lhs.entryPoint() == rhs.entryPoint();
918#ifndef QT_NO_DEBUG_STREAM
925 dbg.nospace() <<
"QShader("
926 <<
"stage=" <<
d->stage
927 <<
" shaders=" <<
d->shaders.keys()
928 <<
" desc.isValid=" <<
d->desc.isValid()
931 dbg.nospace() <<
"QShader()";
940 dbg.nospace() <<
"ShaderKey(" << k.
source()
949 dbg.nospace() <<
"Version(" <<
v.version() <<
" " <<
v.flags() <<
")";
\inmodule QtCore \reentrant
\inmodule QtCore\reentrant
void setVersion(int)
Sets the version number of the data serialization format to v, a value of the \l Version enum.
qsizetype size() const noexcept
const_iterator cend() const noexcept
void append(parameter_type t)
const_iterator cbegin() const noexcept
iterator insert(const Key &key, const T &value)
T value(const Key &key, const T &defaultValue=T()) const
iterator erase(const_iterator it)
const_iterator cend() const
const_iterator cbegin() const
const_iterator constFind(const Key &key) const
QList< Key > keys() const
iterator find(const Key &key)
const_iterator cend() const noexcept
const_iterator cbegin() const noexcept
bool operator==(const QShaderCode &lhs, const QShaderCode &rhs) noexcept
Returns true if the two QShaderCode objects lhs and rhs are equal.
void serialize(QDataStream *stream, int version) const
Serializes this QShaderDescription to stream.
static QShaderDescription deserialize(QDataStream *stream, int version)
size_t qHash(const QShaderKey &k, size_t seed) noexcept
Returns the hash value for k, using seed to seed the calculation.
void setSource(QShader::Source s)
Sets the shader type s.
void setSourceVariant(QShader::Variant svar)
Sets the type of variant to use to svar.
void setSourceVersion(const QShaderVersion &sver)
Sets the shading language version sver.
QShader::Source source() const
QShaderVersion sourceVersion() const
QShader::Variant sourceVariant() const
bool operator==(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
Returns true if the two QShaderKey objects lhs and rhs are equal.
bool operator<(const QShaderKey &lhs, const QShaderKey &rhs) noexcept
bool operator<(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept
void setVersion(int v)
Sets the shading language version to v.
void setFlags(Flags f)
Sets the flags f.
bool operator==(const QShaderVersion &lhs, const QShaderVersion &rhs) noexcept
Returns true if the two QShaderVersion objects lhs and rhs are equal.
SerializedFormatVersion
Describes the desired output format when serializing the QShader.
SeparateToCombinedImageSamplerMappingList separateToCombinedImageSamplerMappingList(const QShaderKey &key) const
\variable QShader::SeparateToCombinedImageSamplerMapping::combinedSamplerName
void removeResourceBindingMap(const QShaderKey &key)
Removes the native resource binding map for key.
void setNativeShaderInfo(const QShaderKey &key, const NativeShaderInfo &info)
Stores the given native shader info associated with key.
QShaderCode shader(const QShaderKey &key) const
QList< QShaderKey > availableShaders() const
void setSeparateToCombinedImageSamplerMappingList(const QShaderKey &key, const SeparateToCombinedImageSamplerMappingList &list)
Stores the given combined image sampler mapping list associated with key.
NativeResourceBindingMap nativeResourceBindingMap(const QShaderKey &key) const
QShader & operator=(const QShader &other)
Assigns other to this object.
static QShader fromSerialized(const QByteArray &data)
Creates a new QShader instance from the given data.
friend struct QShaderPrivate
void removeShader(const QShaderKey &key)
Removes the source or binary shader code for a given key.
NativeShaderInfo nativeShaderInfo(const QShaderKey &key) const
\variable QShader::NativeShaderInfo::flags
void removeNativeShaderInfo(const QShaderKey &key)
Removes the native shader information for key.
QShader()
Constructs a new, empty (and thus invalid) QShader instance.
Variant
Describes what kind of shader code an entry contains.
void setShader(const QShaderKey &key, const QShaderCode &shader)
Stores the source or binary shader code for a given shader version specified by key.
void setResourceBindingMap(const QShaderKey &key, const NativeResourceBindingMap &map)
Stores the given native resource binding map associated with key.
void removeSeparateToCombinedImageSamplerMappingList(const QShaderKey &key)
Removes the combined image sampler mapping list for key.
Source
Describes what kind of shader code an entry contains.
QShaderDescription description() const
void setDescription(const QShaderDescription &desc)
Sets the reflection metadata to desc.
Stage
Describes the stage of the graphics pipeline the shader is suitable for.
void setStage(Stage stage)
Sets the pipeline stage.
QByteArray serialized(SerializedFormatVersion version=SerializedFormatVersion::Latest) const
QHash< int, QWidget * > hash
[35multi]
QMap< QString, QString > map
[6]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
QT_WARNING_POP void qAtomicAssign(T *&d, T *x)
This is a helper for the assignment operators of implicitly shared classes.
void qAtomicDetach(T *&d)
This is a helper for the detach method of implicitly shared classes.
QByteArray qCompress(const uchar *data, qsizetype nbytes, int compressionLevel)
Q_CORE_EXPORT QByteArray qUncompress(const uchar *data, qsizetype nbytes)
size_t qHash(const QFileSystemWatcherPathKey &key, size_t seed=0)
constexpr QtPrivate::QHashMultiReturnType< T... > qHashMulti(size_t seed, const T &... args) noexcept(std::conjunction_v< QtPrivate::QNothrowHashable< T >... >)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLenum GLenum GLsizei count
GLenum GLuint GLenum GLsizei const GLchar * buf
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
static void readShaderKey(QDataStream *ds, QShaderKey *k)
QDebug operator<<(QDebug dbg, const QShader &bs)
static void writeShaderKey(QDataStream *ds, const QShaderKey &k)
QFileInfo info(fileName)
[8]
QMap< QShaderKey, QShader::SeparateToCombinedImageSamplerMappingList > combinedImageMap
static const int QSB_VERSION_WITH_CBOR
static const int QSB_VERSION_WITH_BINARY_JSON
QMap< QShaderKey, QShader::NativeResourceBindingMap > bindings
static const int QSB_VERSION_WITHOUT_INPUT_OUTPUT_INTERFACE_BLOCKS
static const int QSB_VERSION_WITHOUT_BINDINGS
static const int QSB_VERSION_WITHOUT_VAR_ARRAYDIMS
static const int QSB_VERSION_WITHOUT_EXTENDED_STORAGE_BUFFER_INFO
static int qtQsbVersion(QShader::SerializedFormatVersion qtVersion)
QMap< QShaderKey, QShaderCode > shaders
QMap< QShaderKey, QShader::NativeShaderInfo > nativeShaderInfoMap
static const int QSB_VERSION_WITHOUT_NATIVE_SHADER_INFO
static QShaderPrivate * get(QShader *s)
static const int QSB_VERSION_WITHOUT_SEPARATE_IMAGES_AND_SAMPLERS
static const int QSB_VERSION