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/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 )
{
auto d = QQuickItemPrivate::get( item );

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ class QSK_EXPORT QskSceneTexture : public QSGTexture
~QskSceneTexture();
#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* );
const QSGGeometryNode* textureNode() const;
#endif

View File

@ -4,6 +4,7 @@
*****************************************************************************/
#include "QskTextureRenderer.h"
#include "QskQuick.h"
#include <qopenglcontext.h>
#include <qopenglframebufferobject.h>
@ -17,7 +18,6 @@
QSK_QT_PRIVATE_BEGIN
#include <private/qsgplaintexture_p.h>
#include <private/qopenglframebufferobject_p.h>
#include <private/qquickwindow_p.h>
QSK_QT_PRIVATE_END
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
@ -89,7 +89,7 @@ void QskTextureRenderer::setTextureId( QQuickWindow* window,
if ( plainTexture == nullptr )
return;
auto rhi = QQuickWindowPrivate::get( window )->rhi;
auto rhi = qskRenderingHardwareInterface( window );
#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 {
qsbfile=`echo $1 | sed 's/-vulkan//'`
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