63 QSGRenderer(QSGRenderContext *context);
64 virtual ~QSGRenderer();
67 QMatrix4x4 currentProjectionMatrix(
int index)
const {
return m_current_projection_matrix[index]; }
68 QMatrix4x4 currentModelViewMatrix()
const {
return m_current_model_view_matrix; }
69 QMatrix4x4 currentCombinedMatrix(
int index)
const {
return m_current_projection_matrix[index] * m_current_model_view_matrix; }
70 qreal currentOpacity()
const {
return m_current_opacity; }
71 qreal determinant()
const {
return m_current_determinant; }
73 void setDevicePixelRatio(qreal ratio) { m_device_pixel_ratio = ratio; }
74 qreal devicePixelRatio()
const {
return m_device_pixel_ratio; }
75 QSGRenderContext *context()
const {
return m_context; }
77 bool isMirrored()
const;
78 void renderScene() override;
79 void prepareSceneInline() override;
80 void renderSceneInline() override;
81 void nodeChanged(QSGNode *node, QSGNode::DirtyState state) override;
83 QSGNodeUpdater *nodeUpdater()
const;
84 void setNodeUpdater(QSGNodeUpdater *updater);
85 inline QSGMaterialShader::RenderState state(QSGMaterialShader::RenderState::DirtyStates dirty)
const;
86 virtual void setVisualizationMode(
const QByteArray &) { }
87 virtual bool hasVisualizationModeWithContinuousUpdate()
const {
return false; }
88 virtual void releaseCachedResources() { }
90 void clearChangedFlag() { m_changed_emitted =
false; }
93 QByteArray *currentUniformData()
const {
return m_current_uniform_data; }
94 QRhiResourceUpdateBatch *currentResourceUpdateBatch()
const {
return m_current_resource_update_batch; }
95 QRhi *currentRhi()
const {
return m_rhi; }
97 void setRenderTarget(
const QSGRenderTarget &rt) { m_rt = rt; }
98 const QSGRenderTarget &renderTarget()
const {
return m_rt; }
100 void setRenderPassRecordingCallbacks(QSGRenderContext::RenderPassCallback start,
101 QSGRenderContext::RenderPassCallback end,
104 m_renderPassRecordingCallbacks.start = start;
105 m_renderPassRecordingCallbacks.end = end;
106 m_renderPassRecordingCallbacks.userData = userData;
110 virtual void render() = 0;
112 virtual void prepareInline();
113 virtual void renderInline();
115 virtual void preprocess();
117 void addNodesToPreprocess(QSGNode *node);
118 void removeNodesToPreprocess(QSGNode *node);
120 QVarLengthArray<QMatrix4x4, 1> m_current_projection_matrix;
121 QVarLengthArray<QMatrix4x4, 1> m_current_projection_matrix_native_ndc;
122 QMatrix4x4 m_current_model_view_matrix;
123 qreal m_current_opacity;
124 qreal m_current_determinant;
125 qreal m_device_pixel_ratio;
127 QSGRenderContext *m_context;
129 QByteArray *m_current_uniform_data;
130 QRhiResourceUpdateBatch *m_current_resource_update_batch;
132 QSGRenderTarget m_rt;
134 QSGRenderContext::RenderPassCallback start =
nullptr;
135 QSGRenderContext::RenderPassCallback end =
nullptr;
136 void *userData =
nullptr;
137 } m_renderPassRecordingCallbacks;
140 QSGNodeUpdater *m_node_updater;
142 QSet<QSGNode *> m_nodes_to_preprocess;
143 QSet<QSGNode *> m_nodes_dont_preprocess;
145 uint m_changed_emitted : 1;
146 uint m_is_rendering : 1;
147 uint m_is_preprocessing : 1;