Merge branch 'master' into features/effectnode

This commit is contained in:
Uwe Rathmann 2023-12-22 13:54:46 +01:00
commit e1069d9292
17 changed files with 46 additions and 28 deletions

View File

@ -19,6 +19,14 @@ QSK_QT_PRIVATE_END
#include <qpa/qplatforminputcontext.h> #include <qpa/qplatforminputcontext.h>
#include <qpa/qplatformintegration.h> #include <qpa/qplatformintegration.h>
QRhi* qskRenderingHardwareInterface( const QQuickWindow* window )
{
if ( auto w = const_cast< QQuickWindow* >( window ) )
return QQuickWindowPrivate::get( w )->rhi;
return nullptr;
}
QRectF qskItemRect( const QQuickItem* item ) QRectF qskItemRect( const QQuickItem* item )
{ {
auto d = QQuickItemPrivate::get( item ); auto d = QQuickItemPrivate::get( item );

View File

@ -18,14 +18,16 @@ class QSGNode;
class QSGTransformNode; class QSGTransformNode;
class QSGRootNode; class QSGRootNode;
class QRectF; class QRectF;
class QRhi;
template< typename T > class QList; template< typename T > class QList;
/* /*
Exporting methods from QQuickItemPrivate, that should be part Exporting useful methods from QQuickItemPrivate/QQuickWindowPrivate
of QQuickItem.
*/ */
QSK_EXPORT QRhi* qskRenderingHardwareInterface( const QQuickWindow* );
QSK_EXPORT bool qskIsItemInDestructor( const QQuickItem* ); QSK_EXPORT bool qskIsItemInDestructor( const QQuickItem* );
QSK_EXPORT bool qskIsItemComplete( const QQuickItem* ); QSK_EXPORT bool qskIsItemComplete( const QQuickItem* );
QSK_EXPORT bool qskIsAncestorOf( const QQuickItem* item, const QQuickItem* child ); QSK_EXPORT bool qskIsAncestorOf( const QQuickItem* item, const QQuickItem* child );

View File

@ -22,7 +22,7 @@
#endif #endif
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) #if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
#include <QSGMaterialRhiShader> #include <qsgmaterialrhishader.h>
using RhiShader = QSGMaterialRhiShader; using RhiShader = QSGMaterialRhiShader;
#else #else
using RhiShader = QSGMaterialShader; using RhiShader = QSGMaterialShader;

View File

@ -19,8 +19,8 @@ QSK_QT_PRIVATE_BEGIN
QSK_QT_PRIVATE_END QSK_QT_PRIVATE_END
/* /*
With Qt 5.15 Rhi can optionally be enbled by setting "export QSG_RHI=1" With Qt 5.15 Rhi can optionally be enbled by setting "export QSG_RHI=1".
and we need to have a native QOpenGL implementation and one using So we need to have a native QOpenGL implementation and one using
the Rhi abstraction layer. For Qt6 we can rely on Rhi. the Rhi abstraction layer. For Qt6 we can rely on Rhi.
Once Qt5 support has been dropped we can eliminate this #ifdef jungle Once Qt5 support has been dropped we can eliminate this #ifdef jungle
*/ */
@ -202,34 +202,41 @@ namespace
void Renderer::createTarget( const QSize& size ) void Renderer::createTarget( const QSize& size )
{ {
if ( const auto rhi = context()->rhi() ) ==== BASE ====
{ const auto rhi = context()->rhi();
==== BASE ====
==== BASE ====
auto flags = QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource; auto flags = QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource;
==== BASE ====
==== BASE ====
m_rhiTexture = rhi->newTexture( QRhiTexture::RGBA8, size, 1, flags ); m_rhiTexture = rhi->newTexture( QRhiTexture::RGBA8, size, 1, flags );
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
m_rhiTexture->build();
#else
m_rhiTexture->create(); m_rhiTexture->create();
#endif ==== BASE ====
==== BASE ====
QRhiColorAttachment color0( m_rhiTexture ); QRhiColorAttachment color0( m_rhiTexture );
auto target = rhi->newTextureRenderTarget( { color0 } ); auto target = rhi->newTextureRenderTarget( { color0 } );
==== BASE ====
==== BASE ====
target->setRenderPassDescriptor( target->setRenderPassDescriptor(
target->newCompatibleRenderPassDescriptor() ); target->newCompatibleRenderPassDescriptor() );
==== BASE ====
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 ) ==== BASE ====
target->build();
#else
target->create(); target->create();
#endif ==== BASE ====
m_rt.rt = target;
m_rt.rpDesc = target->renderPassDescriptor();
auto defaultContext = qobject_cast< QSGDefaultRenderContext* >( context() ); auto defaultContext = qobject_cast< QSGDefaultRenderContext* >( context() );
m_rt.cb = defaultContext->currentFrameCommandBuffer(); m_rt.cb = defaultContext->currentFrameCommandBuffer();
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
setRenderTarget( m_rt.rt );
setCommandBuffer( m_rt.cb );
setRenderPassDescriptor( m_rt.rpDesc );
#endif
} }
else else
{ {

View File

@ -27,7 +27,7 @@ class QSK_EXPORT QskSceneTexture : public QSGTexture
~QskSceneTexture(); ~QskSceneTexture();
#if 1 #if 1
// to avoid recursive update, need to find a better solution // to avoid recursive update - need to find a better solution TODO
void setTextureNode( const QSGGeometryNode* ); void setTextureNode( const QSGGeometryNode* );
const QSGGeometryNode* textureNode() const; const QSGGeometryNode* textureNode() const;
#endif #endif

View File

@ -4,6 +4,7 @@
*****************************************************************************/ *****************************************************************************/
#include "QskTextureRenderer.h" #include "QskTextureRenderer.h"
#include "QskQuick.h"
#include <qopenglcontext.h> #include <qopenglcontext.h>
#include <qopenglframebufferobject.h> #include <qopenglframebufferobject.h>
@ -17,7 +18,6 @@
QSK_QT_PRIVATE_BEGIN QSK_QT_PRIVATE_BEGIN
#include <private/qsgplaintexture_p.h> #include <private/qsgplaintexture_p.h>
#include <private/qopenglframebufferobject_p.h> #include <private/qopenglframebufferobject_p.h>
#include <private/qquickwindow_p.h>
QSK_QT_PRIVATE_END QSK_QT_PRIVATE_END
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 ) #if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
@ -89,7 +89,7 @@ void QskTextureRenderer::setTextureId( QQuickWindow* window,
if ( plainTexture == nullptr ) if ( plainTexture == nullptr )
return; return;
auto rhi = QQuickWindowPrivate::get( window )->rhi; auto rhi = qskRenderingHardwareInterface( window );
#if QT_VERSION >= QT_VERSION_CHECK( 6, 4, 0 ) #if QT_VERSION >= QT_VERSION_CHECK( 6, 4, 0 )

Binary file not shown.

Binary file not shown.

View File

@ -3,6 +3,7 @@
function qsbcompile { function qsbcompile {
qsbfile=`echo $1 | sed 's/-vulkan//'` qsbfile=`echo $1 | sed 's/-vulkan//'`
qsb --glsl 100es,120,150 --hlsl 50 --msl 12 -b -o ${qsbfile}.qsb $1 qsb --glsl 100es,120,150 --hlsl 50 --msl 12 -b -o ${qsbfile}.qsb $1
# qsb --qt6 -b -o ${qsbfile}.qsb $1
} }
qsbcompile boxshadow-vulkan.vert qsbcompile boxshadow-vulkan.vert