Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qssgrendercommands_p.h
Go to the documentation of this file.
1// Copyright (C) 2008-2012 NVIDIA Corporation.
2// Copyright (C) 2019 The Qt Company Ltd.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
4
5#ifndef QSSG_RENDER_COMMANDS_H
6#define QSSG_RENDER_COMMANDS_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuick3DUtils/private/qssgrenderbasetypes_p.h>
20#include <QtQuick3DRuntimeRender/private/qssgrendershadercache_p.h>
21
22#include <QDebug>
23#include <QVariant>
24
26
27struct QSSGRenderEffect;
28
29enum class CommandType
30{
31 Unknown = 0,
38 Render,
40};
41
43{
45 QSSGCommand(CommandType inType) : m_type(inType) {}
46 const char *typeAsString() const;
47 QString debugString() const;
48 void addDebug(QDebug &stream) const;
49};
50
52{
53 None = 0,
54 SceneLifetime = 1,
55};
56
57struct QSSGAllocateBufferFlags : public QFlags<AllocateBufferFlagValues>
58{
59 QSSGAllocateBufferFlags(quint32 inValues) : QFlags(inValues) {}
62 // If isSceneLifetime is unset the buffer is assumed to be frame lifetime and will be
63 // released after this render operation.
65};
66
68{
73 float m_sizeMultiplier = 1.0f;
80 float inMultiplier,
83 , m_name(inName)
84 , m_format(inFormat)
85 , m_filterOp(inFilterOp)
86 , m_texCoordOp(inCoordOp)
87 , m_sizeMultiplier(inMultiplier)
88 , m_bufferFlags(inFlags)
89 {
90 }
91 void addDebug(QDebug &stream) const {
92 stream << "name:" << m_name << "format:" << m_format.toString() << "size multiplier:" << m_sizeMultiplier << "filter:" << QSSGBaseTypeHelpers::toString(m_filterOp) << "tiling:" << QSSGBaseTypeHelpers::toString(m_texCoordOp) << "sceneLifetime:" << m_bufferFlags.isSceneLifetime();
93 }
94};
95
97{
99
102 {
103 }
104 void addDebug(QDebug &stream) const {
105 stream << "format" << m_outputFormat.toString();
106 }
107};
108
110{
112 QSSGBindBuffer(const QByteArray &inBufName)
114 {
115 }
116 void addDebug(QDebug &stream) const {
117 stream << "name:" << m_bufferName;
118 }
119};
120
122{
123 QByteArray m_shaderPathKey; // something like "prefix>vertex_filename>fragment_filename:source_sha:y_up_in_fbo[:tonemapping]"
124 QSSGBindShader(const QByteArray &inShaderPathKey)
126 m_shaderPathKey(inShaderPathKey)
127 {
128 }
130 void addDebug(QDebug &stream) const {
131 stream << "key:" << m_shaderPathKey << "effect:";
132 }
133};
134
135// The value sits immediately after the 'this' object
136// in memory.
137// If propertyName is not valid then we attempt to apply all of the effect property values
138// to the shader, ignoring ones that don't match up.
140{
141 // Name of value to apply in shader
143 // type of value
145 // offset in the effect data section of value.
147 QSSGApplyInstanceValue(const QByteArray &inName, QSSGRenderShaderDataType inValueType, quint32 inValueOffset)
148 : QSSGCommand(CommandType::ApplyInstanceValue), m_propertyName(inName), m_valueType(inValueType), m_valueOffset(inValueOffset)
149 {
150 }
151 // Default will attempt to apply all effect values to the currently bound shader
154 {
155 }
156 void addDebug(QDebug &stream) const {
157 stream << "name:" << m_propertyName << "type:" << int(m_valueType) << "offset:" << m_valueOffset ;
158 }
159};
160
162{
165 explicit QSSGApplyValue(const QByteArray &inName)
167 {
168 }
169 // Default will attempt to apply all effect values to the currently bound shader
171 void addDebug(QDebug &stream) const {
172 stream << "name:" << m_propertyName << "value:" << m_value;
173 }
174};
175
177{
180
181 QSSGApplyBufferValue(const QByteArray &bufferName, const QByteArray &shaderSampler)
182 : QSSGCommand(CommandType::ApplyBufferValue), m_bufferName(bufferName), m_samplerName(shaderSampler)
183 {
184 }
185 void addDebug(QDebug &stream) const {
186 stream << "name:" << m_bufferName << "sampler:" << m_samplerName;
187 }
188};
189
190struct QSSGRender : public QSSGCommand
191{
193
196 {
197 }
198 void addDebug(QDebug &stream) const {
199 stream << "(no parameters)";
200 }
201};
202
204
205#endif
\inmodule QtCore
Definition qbytearray.h:57
\inmodule QtCore
constexpr QFlags operator&(int mask) const noexcept
Definition qflags.h:112
constexpr QFlags & setFlag(AllocateBufferFlagValues flag, bool on=true) noexcept
Definition qflags.h:130
static const char * toString(QSSGRenderTextureCubeFace value)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:127
\inmodule QtCore
Definition qvariant.h:64
Combined button and popup list for selecting options.
EGLStreamKHR stream
QSSGRenderTextureCoordOp
QSSGRenderShaderDataType
QSSGRenderTextureFilterOp
AllocateBufferFlagValues
unsigned int quint32
Definition qtypes.h:45
QSSGAllocateBufferFlags(quint32 inValues)
void setSceneLifetime(bool inValue)
QSSGRenderTextureFormat m_format
QSSGAllocateBuffer(const QByteArray &inName, QSSGRenderTextureFormat inFormat, QSSGRenderTextureFilterOp inFilterOp, QSSGRenderTextureCoordOp inCoordOp, float inMultiplier, QSSGAllocateBufferFlags inFlags)
void addDebug(QDebug &stream) const
QSSGRenderTextureFilterOp m_filterOp
QSSGRenderTextureCoordOp m_texCoordOp
QSSGAllocateBufferFlags m_bufferFlags
void addDebug(QDebug &stream) const
QSSGApplyBufferValue(const QByteArray &bufferName, const QByteArray &shaderSampler)
QSSGRenderShaderDataType m_valueType
void addDebug(QDebug &stream) const
QSSGApplyInstanceValue(const QByteArray &inName, QSSGRenderShaderDataType inValueType, quint32 inValueOffset)
QSSGApplyValue(const QByteArray &inName)
void addDebug(QDebug &stream) const
void addDebug(QDebug &stream) const
QSSGBindBuffer(const QByteArray &inBufName)
void addDebug(QDebug &stream) const
QSSGBindShader(const QByteArray &inShaderPathKey)
QSSGRenderTextureFormat m_outputFormat
void addDebug(QDebug &stream) const
QSSGBindTarget(QSSGRenderTextureFormat inFormat=QSSGRenderTextureFormat::RGBA8)
const char * typeAsString() const
void addDebug(QDebug &stream) const
QString debugString() const
QSSGCommand(CommandType inType)
const char * toString() const
void addDebug(QDebug &stream) const
QSSGRender(const QSSGRender &)