170 qWarning() <<
"Failed to find shader" << filename;
225 vsIt->shaderVariant = vertexShaderVariant;
226 vsIt->vertexInputLocations.clear();
227 vsIt->qt_order_attrib_location = -1;
234 vsIt->qt_order_attrib_location =
v.location;
236 vsIt->vertexInputLocations.append(
v.location);
240 if (vsIt->vertexInputLocations.contains(vsIt->qt_order_attrib_location)) {
241 qWarning(
"Vertex input clash in rewritten (batchable) vertex shader at input location %d. "
242 "Vertex shaders must avoid using this location.", vsIt->qt_order_attrib_location);
250 const int ubufCount = ubufs.
size();
252 qWarning(
"Multiple uniform blocks found in shader. "
253 "This should be avoided as Qt Quick supports only one.");
255 for (
int i = 0;
i < ubufCount; ++
i) {
275 const int imageSamplersCount = imageSamplers.
size();
276 for (
int i = 0;
i < imageSamplersCount; ++
i) {
286 for (
int dim :
var.arrayDims)
291 qWarning(
"Encountered invalid combined image sampler (%s) binding %d",
303 qWarning(
"No rewriter-inserted attribute found, this should not happen.");
419 if (binding >= 0 && binding < d->MAX_SHADER_RESOURCE_BINDINGS)
420 return d->combinedImageSamplerCount[binding];
753 return float(
static_cast<const QSGRenderer *
>(m_data)->currentOpacity());
QByteArray & fill(char c, qsizetype size=-1)
Sets every byte in the byte array to ch.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
void clear()
Clears the contents of the byte array and makes it null.
iterator find(const Key &key)
Returns an iterator pointing to the item with the key in the hash.
iterator erase(const_iterator it)
iterator end() noexcept
Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item after the last ...
qsizetype size() const noexcept
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
\inmodule QtCore\reentrant
QVarLengthArray< QRhiSampler *, 4 > samplerBindingTable[MAX_SHADER_RESOURCE_BINDINGS]
ShaderStageData * fragmentShader
void clearCachedRendererData()
QRhiShaderResourceBinding::StageFlags combinedImageSamplerBindings[MAX_SHADER_RESOURCE_BINDINGS]
int combinedImageSamplerCount[MAX_SHADER_RESOURCE_BINDINGS]
static const int MAX_SHADER_RESOURCE_BINDINGS
QByteArray masterUniformData
ShaderStageData * vertexShader
QRhiShaderResourceBinding::StageFlags ubufStages
void prepare(QShader::Variant vertexShaderVariant)
QVarLengthArray< QSGTexture *, 4 > textureBindingTable[MAX_SHADER_RESOURCE_BINDINGS]
QHash< QShader::Stage, QString > shaderFileNames
static QShader loadShader(const QString &filename)
Encapsulates the current rendering state during a call to QSGMaterialShader::updateUniformData() and ...
QRect viewportRect() const
Returns the viewport rect of the surface being rendered to.
QRect deviceRect() const
Returns the device rect of the surface being rendered to.
float determinant() const
Returns the modelview determinant to be used for rendering.
float devicePixelRatio() const
Returns the ratio between physical pixels and device-independent pixels to be used for rendering.
QMatrix4x4 modelViewMatrix() const
Returns the model view matrix.
QByteArray * uniformData()
Returns a pointer to the data for the uniform (constant) buffer in the shader.
QMatrix4x4 combinedMatrix() const
Returns the matrix combined of modelview matrix and project matrix.
QMatrix4x4 projectionMatrix() const
Returns the projection matrix.
QRhi * rhi()
Returns the current QRhi.
float opacity() const
\variable QSGMaterialShader::GraphicsPipelineState::blendEnable
QRhiResourceUpdateBatch * resourceUpdateBatch()
Returns a resource update batch to which upload and copy operatoins can be queued.
The QSGMaterialShader class represents a graphics API independent shader program.
void setShader(Stage stage, const QShader &shader)
Sets the shader for the specified stage.
virtual bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
This function is called by the scene graph to get the contents of the shader program's uniform buffer...
virtual bool updateGraphicsPipelineState(RenderState &state, GraphicsPipelineState *ps, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
This function is called by the scene graph to enable the material to provide a custom set of graphics...
void setShaderFileName(Stage stage, const QString &filename)
Sets the filename for the shader for the specified stage.
virtual ~QSGMaterialShader()
int combinedImageSamplerCount(int binding) const
Returns the number of elements in the combined image sampler variable at binding.
virtual void updateSampledImage(RenderState &state, int binding, QSGTexture **texture, QSGMaterial *newMaterial, QSGMaterial *oldMaterial)
This function is called by the scene graph to prepare use of sampled images in the shader,...
QSGMaterialShader()
Constructs a new QSGMaterialShader.
void setFlag(Flags flags, bool on=true)
Sets the flags on this material shader if on is true; otherwise clears the specified flags.
void setFlags(Flags flags)
Sets the flags for this material shader.
The QSGMaterial class encapsulates rendering state for a shader program.
The renderer class is the abstract baseclass used for rendering the QML scene graph.
static QShader fromSerialized(const QByteArray &data)
Creates a new QShader instance from the given data.
Variant
Describes what kind of shader code an entry contains.
Stage
Describes the stage of the graphics pipeline the shader is suitable for.
\macro QT_RESTRICTED_CAST_FROM_ASCII
const void * constData() const
QSet< QString >::iterator it
Combined button and popup list for selecting options.
#define QByteArrayLiteral(str)
GLsizei const GLfloat * v
[13]
GLenum GLenum GLsizei count
GLsizei GLsizei GLuint * shaders
static QShader::Stage toShaderStage(QRhiShaderStage::Type type)
static QShader::Stage toShaderStage(QSGMaterialShader::Stage stage)
static QRhiShaderResourceBinding::StageFlags toSrbStage(QShader::Stage stage)
int qt_order_attrib_location
Describes state changes that the material wants to apply to the currently active graphics pipeline st...