Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QSGVideoMaterial Class Reference
+ Inheritance diagram for QSGVideoMaterial:
+ Collaboration diagram for QSGVideoMaterial:

Public Types

enum  { NVideoFrameSlots = 4 }
 
- Public Types inherited from QSGMaterial
enum  Flag {
  Blending = 0x0001 , RequiresDeterminant = 0x0002 , RequiresFullMatrixExceptTranslate = 0x0004 | RequiresDeterminant , RequiresFullMatrix = 0x0008 | RequiresFullMatrixExceptTranslate ,
  NoBatching = 0x0010 , MultiView2 = 0x10000 , MultiView3 = 0x20000 , MultiView4 = 0x40000
}
 \value Blending Set this flag to true if the material requires blending to be enabled during rendering. More...
 

Public Member Functions

 QSGVideoMaterial (const QVideoFrameFormat &videoFormat)
 
QSGMaterialTypetype () const override
 This function is called by the scene graph to query an identifier that is unique to the QSGMaterialShader instantiated by createShader().
 
QSGMaterialShadercreateShader (QSGRendererInterface::RenderMode) const override
 This function returns a new instance of a the QSGMaterialShader implementation used to render geometry for a specific implementation of QSGMaterial.
 
int compare (const QSGMaterial *other) const override
 Compares this material to other and returns 0 if they are equal; -1 if this material should sort before other and 1 if other should sort before.
 
void updateBlending ()
 
void setCurrentFrame (const QVideoFrame &frame)
 
void setSurfaceFormat (const QRhiSwapChain::Format surfaceFormat)
 
void setHdrInfo (const QRhiSwapChainHdrInfo &hdrInfo)
 
void updateTextures (QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates)
 
- Public Member Functions inherited from QSGMaterial
 QSGMaterial ()
 
virtual ~QSGMaterial ()
 
QSGMaterial::Flags flags () const
 Returns the material's flags.
 
void setFlag (Flags flags, bool on=true)
 Sets the flags flags on this material if on is true; otherwise clears the attribute.
 
int viewCount () const
 

Public Attributes

QVideoFrameFormat m_videoFormat
 
QRhiSwapChain::Format m_surfaceFormat = QRhiSwapChain::SDR
 
float m_opacity = 1.0f
 
QRhiSwapChainHdrInfo m_hdrInfo
 
bool m_texturesDirty = false
 
QVideoFrame m_currentFrame
 
QVideoFrame m_videoFrameSlots [NVideoFrameSlots]
 
std::array< QSGVideoTexture, 3 > m_textures
 
std::unique_ptr< QVideoFrameTexturesm_videoFrameTextures
 

Detailed Description

Definition at line 69 of file qsgvideonode_p.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
NVideoFrameSlots 

Definition at line 126 of file qsgvideonode_p.cpp.

Constructor & Destructor Documentation

◆ QSGVideoMaterial()

QSGVideoMaterial::QSGVideoMaterial ( const QVideoFrameFormat & videoFormat)

Definition at line 198 of file qsgvideonode_p.cpp.

References QSGMaterial::Blending, and QSGMaterial::setFlag().

+ Here is the call graph for this function:

Member Function Documentation

◆ compare()

int QSGVideoMaterial::compare ( const QSGMaterial * other) const
inlineoverridevirtual

Compares this material to other and returns 0 if they are equal; -1 if this material should sort before other and 1 if other should sort before.

The scene graph can reorder geometry nodes to minimize state changes. The compare function is called during the sorting process so that the materials can be sorted to minimize state changes in each call to QSGMaterialShader::updateState().

The this pointer and other is guaranteed to have the same type().

Reimplemented from QSGMaterial.

Definition at line 84 of file qsgvideonode_p.cpp.

References m_textures, and other().

+ Here is the call graph for this function:

◆ createShader()

QSGMaterialShader * QSGVideoMaterial::createShader ( QSGRendererInterface::RenderMode renderMode) const
inlineoverridevirtual

This function returns a new instance of a the QSGMaterialShader implementation used to render geometry for a specific implementation of QSGMaterial.

The function will be called only once for each combination of material type and renderMode and will be cached internally.

For most materials, the renderMode can be ignored. A few materials may need custom handling for specific render modes. For instance if the material implements antialiasing in a way that needs to account for perspective transformations when RenderMode3D is in use.

Implements QSGMaterial.

Definition at line 80 of file qsgvideonode_p.cpp.

References m_hdrInfo, m_surfaceFormat, and m_videoFormat.

◆ setCurrentFrame()

void QSGVideoMaterial::setCurrentFrame ( const QVideoFrame & frame)
inline

Definition at line 101 of file qsgvideonode_p.cpp.

References frame, m_currentFrame, and m_texturesDirty.

Referenced by QSGVideoNode::setCurrentFrame().

+ Here is the caller graph for this function:

◆ setHdrInfo()

void QSGVideoMaterial::setHdrInfo ( const QRhiSwapChainHdrInfo & hdrInfo)
inline

Definition at line 111 of file qsgvideonode_p.cpp.

References m_hdrInfo.

Referenced by QSGVideoNode::setHdrInfo().

+ Here is the caller graph for this function:

◆ setSurfaceFormat()

void QSGVideoMaterial::setSurfaceFormat ( const QRhiSwapChain::Format surfaceFormat)
inline

Definition at line 106 of file qsgvideonode_p.cpp.

References m_surfaceFormat.

Referenced by QSGVideoNode::setSurfaceFormat().

+ Here is the caller graph for this function:

◆ type()

QSGMaterialType * QSGVideoMaterial::type ( ) const
inlineoverridevirtual

This function is called by the scene graph to query an identifier that is unique to the QSGMaterialShader instantiated by createShader().

For many materials, the typical approach will be to return a pointer to a static, and so globally available, QSGMaterialType instance. The QSGMaterialType is an opaque object. Its purpose is only to serve as a type-safe, simple way to generate unique material identifiers.

QSGMaterialType *type() const override
{
return &type;
}
GLenum type
The QSGMaterialType class is used as a unique type token in combination with QSGMaterial.

Implements QSGMaterial.

Definition at line 74 of file qsgvideonode_p.cpp.

References QRhiSwapChain::HDRExtendedDisplayP3Linear, m_surfaceFormat, m_videoFormat, QVideoFrameFormat::NPixelFormats, and QVideoFrameFormat::pixelFormat().

+ Here is the call graph for this function:

◆ updateBlending()

void QSGVideoMaterial::updateBlending ( )
inline

Definition at line 96 of file qsgvideonode_p.cpp.

References QSGMaterial::Blending, m_opacity, qFuzzyCompare(), and QSGMaterial::setFlag().

+ Here is the call graph for this function:

◆ updateTextures()

void QSGVideoMaterial::updateTextures ( QRhi * rhi,
QRhiResourceUpdateBatch * resourceUpdates )

Definition at line 132 of file qsgvideonode_p.cpp.

References QVideoTextureHelper::createTextures(), QRhi::currentFrameSlot(), QRhi::FramesInFlight, m_currentFrame, m_textures, m_texturesDirty, m_videoFrameSlots, m_videoFrameTextures, NVideoFrameSlots, Q_ASSERT, and QRhi::resourceLimit().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_currentFrame

QVideoFrame QSGVideoMaterial::m_currentFrame

◆ m_hdrInfo

QRhiSwapChainHdrInfo QSGVideoMaterial::m_hdrInfo

Definition at line 121 of file qsgvideonode_p.cpp.

Referenced by createShader(), and setHdrInfo().

◆ m_opacity

float QSGVideoMaterial::m_opacity = 1.0f

◆ m_surfaceFormat

QRhiSwapChain::Format QSGVideoMaterial::m_surfaceFormat = QRhiSwapChain::SDR

Definition at line 119 of file qsgvideonode_p.cpp.

Referenced by createShader(), setSurfaceFormat(), and type().

◆ m_textures

std::array<QSGVideoTexture, 3> QSGVideoMaterial::m_textures

◆ m_texturesDirty

bool QSGVideoMaterial::m_texturesDirty = false

Definition at line 123 of file qsgvideonode_p.cpp.

Referenced by setCurrentFrame(), and updateTextures().

◆ m_videoFormat

QVideoFrameFormat QSGVideoMaterial::m_videoFormat

Definition at line 118 of file qsgvideonode_p.cpp.

Referenced by createShader(), and type().

◆ m_videoFrameSlots

QVideoFrame QSGVideoMaterial::m_videoFrameSlots[NVideoFrameSlots]

Definition at line 127 of file qsgvideonode_p.cpp.

Referenced by updateTextures().

◆ m_videoFrameTextures

std::unique_ptr<QVideoFrameTextures> QSGVideoMaterial::m_videoFrameTextures

Definition at line 129 of file qsgvideonode_p.cpp.

Referenced by updateTextures().


The documentation for this class was generated from the following file: