Skip to content

Commit

Permalink
supoort of experimental Qt5/RHI dropped ( use Qt6 for RHI ). Building
Browse files Browse the repository at this point in the history
the qsb files from the makefiles. See #356
  • Loading branch information
uwerat committed Jan 8, 2024
1 parent f9c08c3 commit 81cecb6
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 27 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ It might support all versions Qt >= 5.15, but you can rely on:
- current long term supported ( LTS ) version of Qt ( at the moment Qt 6.5.x )
- current version of Qt

On debian bullseye these packages need to be installed for Qt5: `build-essential
qtbase5-dev qtbase5-private-dev qtdeclarative5-dev qtdeclarative5-private-dev libqt5svg5-dev`.
For Qt6 you need the corresponding ones.
On Debian these packages need to be installed for Qt6: `build-essential cmake
qtbase6-dev qtbase6-private-dev qtdeclarative6-dev qtdeclarative6-private-dev libqt6svg-dev qt6-shadertools`
For Qt5 you need: `build-essential cmake
qtbase5-dev qtbase5-private-dev qtdeclarative5-dev qtdeclarative5-private-dev libqt5svg-dev`.


> Optional: When enabling the `hunspell` feature the following package needs to be installed: `libhunspell-dev`
Expand Down
5 changes: 5 additions & 0 deletions cmake/QskFindMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ macro(qsk_setup_Qt)
endif()
find_package(QT "5.15" NAMES ${QSK_QT_VERSION} REQUIRED COMPONENTS Quick)

if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6)
# we need the qsb tool for Qt6
find_package(Qt6 REQUIRED COMPONENTS ShaderTools)
endif()

if ( QT_FOUND )

# Would like to have a status message about where the Qt installation
Expand Down
47 changes: 46 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,9 @@ list(APPEND SOURCES
nodes/QskVertex.cpp
)

qt_add_resources(SOURCES nodes/shaders.qrc)
if (QT_VERSION_MAJOR VERSION_LESS 6)
qt_add_resources(SOURCES nodes/shaders.qrc)
endif()

list(APPEND HEADERS
controls/QskAbstractButton.h
Expand Down Expand Up @@ -473,6 +475,49 @@ if(BUILD_QSKDLL)
set_target_properties(${target} PROPERTIES DEFINE_SYMBOL QSK_MAKEDLL)
endif()

if (QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6)

qt6_add_shaders(${target} "qskshaders"

BATCHABLE
PRECOMPILE

#OPTIMIZED
QUIET

PREFIX
"/qskinny/shaders"

FILES
nodes/shaders/arcshadow-vulkan.vert
nodes/shaders/arcshadow-vulkan.frag
nodes/shaders/boxshadow-vulkan.vert
nodes/shaders/boxshadow-vulkan.frag
nodes/shaders/crisplines-vulkan.vert
nodes/shaders/crisplines-vulkan.frag
nodes/shaders/gradientconic-vulkan.vert
nodes/shaders/gradientconic-vulkan.frag
nodes/shaders/gradientlinear-vulkan.vert
nodes/shaders/gradientlinear-vulkan.frag
nodes/shaders/gradientradial-vulkan.vert
nodes/shaders/gradientradial-vulkan.frag

OUTPUTS
arcshadow.vert.qsb
arcshadow.frag.qsb
boxshadow.vert.qsb
boxshadow.frag.qsb
crisplines.vert.qsb
crisplines.frag.qsb
gradientconic.vert.qsb
gradientconic.frag.qsb
gradientlinear.vert.qsb
gradientlinear.frag.qsb
gradientradial.vert.qsb
gradientradial.frag.qsb
)
endif()

target_include_directories(${target} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/common>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/controls>
Expand Down
14 changes: 14 additions & 0 deletions src/controls/QskWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,20 @@ void QskWindow::keyReleaseEvent( QKeyEvent* event )

void QskWindow::exposeEvent( QExposeEvent* event )
{
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
if ( qskRenderingHardwareInterface( this ) )
{
/*
Actually our code supports Qt5 RHI ( f9c08c34fb2cc64546bbe6ce9d359f416e934961 ),
but Qt5 does not come with the qsb tool out of the box. Then we run into
problems with compiling the shader code from the makefiles.
But why should anyone use the experimental Qt5 RHI implementations
instead of using Qt6 ...
*/
qFatal( "the experimental Qt5 RHI implementation is not supported:\n"
"\tuse Qt6 or run the default OpenGL backend." );
}
#endif
ensureFocus( Qt::OtherFocusReason );
layoutItems();

Expand Down
14 changes: 1 addition & 13 deletions src/nodes/shaders.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,21 @@
<RCC version="1.0">
<qresource prefix="/qskinny/">

<file>shaders/arcshadow.frag</file>
<file>shaders/arcshadow.vert</file>
<file>shaders/arcshadow.frag.qsb</file>
<file>shaders/arcshadow.vert.qsb</file>
<file>shaders/arcshadow.frag</file>

<file>shaders/boxshadow.vert.qsb</file>
<file>shaders/boxshadow.frag.qsb</file>
<file>shaders/boxshadow.vert</file>
<file>shaders/boxshadow.frag</file>

<file>shaders/gradientconic.vert.qsb</file>
<file>shaders/gradientconic.frag.qsb</file>
<file>shaders/gradientconic.vert</file>
<file>shaders/gradientconic.frag</file>

<file>shaders/gradientradial.vert.qsb</file>
<file>shaders/gradientradial.frag.qsb</file>
<file>shaders/gradientradial.vert</file>
<file>shaders/gradientradial.frag</file>

<file>shaders/gradientlinear.vert.qsb</file>
<file>shaders/gradientlinear.frag.qsb</file>
<file>shaders/gradientlinear.vert</file>
<file>shaders/gradientlinear.frag</file>

<file>shaders/crisplines.vert.qsb</file>
<file>shaders/crisplines.frag.qsb</file>
<file>shaders/crisplines.vert</file>

</qresource>
Expand Down
Binary file removed src/nodes/shaders/arcshadow.frag.qsb
Binary file not shown.
Binary file removed src/nodes/shaders/arcshadow.vert.qsb
Binary file not shown.
10 changes: 0 additions & 10 deletions src/nodes/shaders/arcshadow2qsb.sh

This file was deleted.

Binary file removed src/nodes/shaders/boxshadow.frag.qsb
Binary file not shown.
Binary file removed src/nodes/shaders/boxshadow.vert.qsb
Binary file not shown.
Binary file removed src/nodes/shaders/crisplines.frag.qsb
Binary file not shown.
Binary file removed src/nodes/shaders/crisplines.vert.qsb
Binary file not shown.
Binary file removed src/nodes/shaders/gradientconic.frag.qsb
Binary file not shown.
Binary file removed src/nodes/shaders/gradientconic.vert.qsb
Binary file not shown.
Binary file removed src/nodes/shaders/gradientlinear.frag.qsb
Binary file not shown.
Binary file removed src/nodes/shaders/gradientlinear.vert.qsb
Binary file not shown.
Binary file removed src/nodes/shaders/gradientradial.frag.qsb
Binary file not shown.
Binary file removed src/nodes/shaders/gradientradial.vert.qsb
Binary file not shown.

0 comments on commit 81cecb6

Please sign in to comment.