diff options
Diffstat (limited to 'examples/quick/scenegraph')
28 files changed, 160 insertions, 442 deletions
diff --git a/examples/quick/scenegraph/.prev_CMakeLists.txt b/examples/quick/scenegraph/.prev_CMakeLists.txt deleted file mode 100644 index a0619410b0..0000000000 --- a/examples/quick/scenegraph/.prev_CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -# Generated from scenegraph.pro. - -add_subdirectory(customgeometry) -add_subdirectory(custommaterial) -add_subdirectory(graph) -add_subdirectory(threadedanimation) -add_subdirectory(twotextureproviders) -if(QT_FEATURE_opengl OR QT_FEATURE_opengles2 OR QT_FEATURE_opengles3) - add_subdirectory(fboitem) - add_subdirectory(openglunderqml) -endif() -if(IOS OR MACOS) - add_subdirectory(metalunderqml) - add_subdirectory(metaltextureimport) -endif() -if(WIN32) - add_subdirectory(d3d11underqml) -endif() -if(QT_FEATURE_vulkan) - add_subdirectory(vulkanunderqml) - add_subdirectory(vulkantextureimport) -endif() diff --git a/examples/quick/scenegraph/customgeometry/.prev_CMakeLists.txt b/examples/quick/scenegraph/customgeometry/.prev_CMakeLists.txt deleted file mode 100644 index 28613e67a3..0000000000 --- a/examples/quick/scenegraph/customgeometry/.prev_CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -# Generated from customgeometry.pro. - -cmake_minimum_required(VERSION 3.14) -project(customgeometry LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/customgeometry") - -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Quick) - -qt_add_executable(customgeometry - beziercurve.cpp beziercurve.h - main.cpp -) -set_target_properties(customgeometry PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) -target_link_libraries(customgeometry PUBLIC - Qt::Core - Qt::Gui - Qt::Quick -) - - -# Resources: -set(customgeometry_resource_files - "main.qml" -) - -qt6_add_resources(customgeometry "customgeometry" - PREFIX - "/scenegraph/customgeometry" - FILES - ${customgeometry_resource_files} -) - -install(TARGETS customgeometry - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) - -set_target_properties(customgeometry PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI CustomGeometry -) - -qt6_qml_type_registration(customgeometry) diff --git a/examples/quick/scenegraph/customgeometry/CMakeLists.txt b/examples/quick/scenegraph/customgeometry/CMakeLists.txt index 0e54c00d24..4e3d13d08a 100644 --- a/examples/quick/scenegraph/customgeometry/CMakeLists.txt +++ b/examples/quick/scenegraph/customgeometry/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from customgeometry.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(customgeometry_declarative LANGUAGES CXX) # special case set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -33,17 +33,12 @@ target_link_libraries(customgeometry_declarative PUBLIC # special case Qt::Quick ) - -# Resources: -set(customgeometry_resource_files - "main.qml" -) - -qt6_add_resources(customgeometry_declarative "customgeometry" # special case - PREFIX - "/scenegraph/customgeometry" - FILES - ${customgeometry_resource_files} +qt_add_qml_module(customgeometry_declarative + URI CustomGeometry + VERSION 1.0 + QML_FILES main.qml + RESOURCE_PREFIX /scenegraph/customgeometry + NO_RESOURCE_TARGET_PATH ) install(TARGETS customgeometry_declarative # special case @@ -51,10 +46,3 @@ install(TARGETS customgeometry_declarative # special case BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(customgeometry_declarative PROPERTIES # special case - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI CustomGeometry -) - -qt6_qml_type_registration(customgeometry_declarative) # special case diff --git a/examples/quick/scenegraph/custommaterial/.prev_CMakeLists.txt b/examples/quick/scenegraph/custommaterial/.prev_CMakeLists.txt deleted file mode 100644 index 6acf1a858b..0000000000 --- a/examples/quick/scenegraph/custommaterial/.prev_CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ -# Generated from custommaterial.pro. - -cmake_minimum_required(VERSION 3.14) -project(custommaterial LANGUAGES CXX) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/scenegraph/custommaterial") - -find_package(Qt6 COMPONENTS Core) -find_package(Qt6 COMPONENTS Gui) -find_package(Qt6 COMPONENTS Qml) -find_package(Qt6 COMPONENTS Quick) - -qt_add_executable(custommaterial - customitem.cpp customitem.h - main.cpp -) -set_target_properties(custommaterial PROPERTIES - WIN32_EXECUTABLE TRUE - MACOSX_BUNDLE TRUE -) -target_link_libraries(custommaterial PUBLIC - Qt::Core - Qt::Gui - Qt::Qml - Qt::Quick -) - - -# Resources: -set(custommaterial_resource_files - "main.qml" - "shaders/mandelbrot.frag.qsb" - "shaders/mandelbrot.vert.qsb" -) - -qt6_add_resources(custommaterial "custommaterial" - PREFIX - "/scenegraph/custommaterial" - FILES - ${custommaterial_resource_files} -) - -install(TARGETS custommaterial - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) - -set_target_properties(custommaterial PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI ExampleCustomMaterial -) - -qt6_qml_type_registration(custommaterial) diff --git a/examples/quick/scenegraph/custommaterial/CMakeLists.txt b/examples/quick/scenegraph/custommaterial/CMakeLists.txt index 46cb238af8..cbf6b0b5c7 100644 --- a/examples/quick/scenegraph/custommaterial/CMakeLists.txt +++ b/examples/quick/scenegraph/custommaterial/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from custommaterial.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(custommaterial_declarative LANGUAGES CXX) # special case set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -19,6 +19,7 @@ find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Qml) find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS ShaderTools) qt_add_executable(custommaterial_declarative # special case customitem.cpp customitem.h @@ -35,19 +36,24 @@ target_link_libraries(custommaterial_declarative PUBLIC # special case Qt::Quick ) - -# Resources: -set(custommaterial_resource_files - "main.qml" - "shaders/mandelbrot.frag.qsb" - "shaders/mandelbrot.vert.qsb" +qt_add_qml_module(custommaterial_declarative + URI ExampleCustomMaterial + VERSION 1.0 + QML_FILES + main.qml + RESOURCE_PREFIX /scenegraph/custommaterial + NO_RESOURCE_TARGET_PATH ) -qt6_add_resources(custommaterial_declarative "custommaterial" # special case +qt6_add_shaders(custommaterial_declarative "shaders" + BATCHABLE + PRECOMPILE + OPTIMIZED PREFIX "/scenegraph/custommaterial" FILES - ${custommaterial_resource_files} + "shaders/mandelbrot.vert" + "shaders/mandelbrot.frag" ) install(TARGETS custommaterial_declarative # special case @@ -55,10 +61,3 @@ install(TARGETS custommaterial_declarative # special case BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(custommaterial_declarative PROPERTIES # special case - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI ExampleCustomMaterial -) - -qt6_qml_type_registration(custommaterial_declarative) # special case diff --git a/examples/quick/scenegraph/d3d11underqml/CMakeLists.txt b/examples/quick/scenegraph/d3d11underqml/CMakeLists.txt index b443ffb29f..74e077a7a5 100644 --- a/examples/quick/scenegraph/d3d11underqml/CMakeLists.txt +++ b/examples/quick/scenegraph/d3d11underqml/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from d3d11underqml.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(d3d11underqml LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -37,19 +37,16 @@ target_link_libraries(d3d11underqml PUBLIC d3dcompiler ) - -# Resources: -set(d3d11underqml_resource_files - "main.qml" - "squircle.frag" - "squircle.vert" -) - -qt6_add_resources(d3d11underqml "d3d11underqml" - PREFIX - "/scenegraph/d3d11underqml" - FILES - ${d3d11underqml_resource_files} +qt_add_qml_module(d3d11underqml + URI D3D11UnderQML + VERSION 1.0 + QML_FILES + main.qml + RESOURCES + squircle.frag + squircle.vert + RESOURCE_PREFIX /scenegraph/d3d11underqml + NO_RESOURCE_TARGET_PATH ) install(TARGETS d3d11underqml @@ -57,10 +54,3 @@ install(TARGETS d3d11underqml BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(d3d11underqml PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI D3D11UnderQML -) - -qt6_qml_type_registration(d3d11underqml) diff --git a/examples/quick/scenegraph/d3d11underqml/d3d11squircle.cpp b/examples/quick/scenegraph/d3d11underqml/d3d11squircle.cpp index 9acfbfff23..ef46c6361d 100644 --- a/examples/quick/scenegraph/d3d11underqml/d3d11squircle.cpp +++ b/examples/quick/scenegraph/d3d11underqml/d3d11squircle.cpp @@ -210,7 +210,7 @@ void SquircleRenderer::frameStart() QSGRendererInterface *rif = m_window->rendererInterface(); // We are not prepared for anything other than running with the RHI and its D3D11 backend. - Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::Direct3D11Rhi); + Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::Direct3D11); m_device = reinterpret_cast<ID3D11Device *>(rif->getResource(m_window, QSGRendererInterface::DeviceResource)); Q_ASSERT(m_device); diff --git a/examples/quick/scenegraph/d3d11underqml/main.cpp b/examples/quick/scenegraph/d3d11underqml/main.cpp index f2a224c1a2..c225fe9df7 100644 --- a/examples/quick/scenegraph/d3d11underqml/main.cpp +++ b/examples/quick/scenegraph/d3d11underqml/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); - QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11Rhi); + QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); diff --git a/examples/quick/scenegraph/fboitem/CMakeLists.txt b/examples/quick/scenegraph/fboitem/CMakeLists.txt index a9c460b228..45c939b0d8 100644 --- a/examples/quick/scenegraph/fboitem/CMakeLists.txt +++ b/examples/quick/scenegraph/fboitem/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from fboitem.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(fboitem LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -40,18 +40,13 @@ target_link_libraries(fboitem PUBLIC Qt::Quick ) - -# Resources: -set(fboitem_resource_files - "main.qml" - "shaders/checker.frag.qsb" -) - -qt6_add_resources(fboitem "fboitem" - PREFIX - "/scenegraph/fboitem" - FILES - ${fboitem_resource_files} +qt_add_qml_module(fboitem + URI SceneGraphRendering + VERSION 1.0 + QML_FILES main.qml + RESOURCES shaders/checker.frag.qsb + RESOURCE_PREFIX /scenegraph/fboitem + NO_RESOURCE_TARGET_PATH ) install(TARGETS fboitem @@ -59,10 +54,3 @@ install(TARGETS fboitem BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(fboitem PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI SceneGraphRendering -) - -qt6_qml_type_registration(fboitem) diff --git a/examples/quick/scenegraph/fboitem/main.cpp b/examples/quick/scenegraph/fboitem/main.cpp index 61510cdb93..f7fea90f6c 100644 --- a/examples/quick/scenegraph/fboitem/main.cpp +++ b/examples/quick/scenegraph/fboitem/main.cpp @@ -58,7 +58,7 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); - QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi); + QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); diff --git a/examples/quick/scenegraph/graph/CMakeLists.txt b/examples/quick/scenegraph/graph/CMakeLists.txt index 6066a58499..93d0e6d61a 100644 --- a/examples/quick/scenegraph/graph/CMakeLists.txt +++ b/examples/quick/scenegraph/graph/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from graph.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(graph LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -29,6 +29,9 @@ qt_add_executable(graph set_target_properties(graph PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE + + # Prevent name clash with build subdirectory on case-insensitive file systems + OUTPUT_NAME graphapp ) target_link_libraries(graph PUBLIC Qt::Core @@ -36,21 +39,18 @@ target_link_libraries(graph PUBLIC Qt::Quick ) - -# Resources: -set(graph_resource_files - "main.qml" - "shaders/line.frag.qsb" - "shaders/line.vert.qsb" - "shaders/noisy.frag.qsb" - "shaders/noisy.vert.qsb" -) - -qt6_add_resources(graph "graph" - PREFIX - "/scenegraph/graph" - FILES - ${graph_resource_files} +qt_add_qml_module(graph + URI Graph + VERSION 1.0 + QML_FILES + main.qml + RESOURCES + shaders/line.frag.qsb + shaders/line.vert.qsb + shaders/noisy.frag.qsb + shaders/noisy.vert.qsb + RESOURCE_PREFIX /scenegraph/graph + NO_RESOURCE_TARGET_PATH ) install(TARGETS graph @@ -58,10 +58,3 @@ install(TARGETS graph BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(graph PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI Graph -) - -qt6_qml_type_registration(graph) diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp index f8b72bfe67..b9a9b6b1ae 100644 --- a/examples/quick/scenegraph/graph/noisynode.cpp +++ b/examples/quick/scenegraph/graph/noisynode.cpp @@ -151,6 +151,7 @@ void NoisyShader::updateSampledImage(RenderState &state, int binding, QSGTexture Q_UNUSED(binding); NoisyMaterial *mat = static_cast<NoisyMaterial *>(newMaterial); + mat->state.texture->commitTextureOperations(state.rhi(), state.resourceUpdateBatch()); *texture = mat->state.texture; } diff --git a/examples/quick/scenegraph/metaltextureimport/CMakeLists.txt b/examples/quick/scenegraph/metaltextureimport/CMakeLists.txt index d01ee2a3df..eb3740f6ef 100644 --- a/examples/quick/scenegraph/metaltextureimport/CMakeLists.txt +++ b/examples/quick/scenegraph/metaltextureimport/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from metaltextureimport.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(metaltextureimport LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -27,6 +27,9 @@ qt_add_executable(metaltextureimport set_target_properties(metaltextureimport PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE + + # Prevent name clash with build subdirectory on case-insensitive file systems + OUTPUT_NAME metaltextureimportapp ) target_link_libraries(metaltextureimport PUBLIC "-framework Metal" @@ -36,36 +39,26 @@ target_link_libraries(metaltextureimport PUBLIC Qt::Quick ) - -# Resources: -set(metaltextureimport_resource_files - "main.qml" - "squircle.frag" - "squircle.vert" -) - -qt6_add_resources(metaltextureimport "metaltextureimport" - PREFIX - "/scenegraph/metaltextureimport" - FILES - ${metaltextureimport_resource_files} -) - if(MACOS) target_link_libraries(metaltextureimport PUBLIC "-framework AppKit" ) endif() +qt_add_qml_module(metaltextureimport + URI MetalTextureImport + VERSION 1.0 + QML_FILES + main.qml + RESOURCES + squircle.frag + squircle.vert + RESOURCE_PREFIX /scenegraph/metaltextureimport + NO_RESOURCE_TARGET_PATH +) + install(TARGETS metaltextureimport RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(metaltextureimport PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI MetalTextureImport -) - -qt6_qml_type_registration(metaltextureimport) diff --git a/examples/quick/scenegraph/metaltextureimport/main.cpp b/examples/quick/scenegraph/metaltextureimport/main.cpp index 2abc1c5671..9fb9d9ba12 100644 --- a/examples/quick/scenegraph/metaltextureimport/main.cpp +++ b/examples/quick/scenegraph/metaltextureimport/main.cpp @@ -54,7 +54,7 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); - QQuickWindow::setGraphicsApi(QSGRendererInterface::MetalRhi); + QQuickWindow::setGraphicsApi(QSGRendererInterface::Metal); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); diff --git a/examples/quick/scenegraph/metalunderqml/CMakeLists.txt b/examples/quick/scenegraph/metalunderqml/CMakeLists.txt index 1cbff4c7f5..752a5aa578 100644 --- a/examples/quick/scenegraph/metalunderqml/CMakeLists.txt +++ b/examples/quick/scenegraph/metalunderqml/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from metalunderqml.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(metalunderqml LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -36,36 +36,26 @@ target_link_libraries(metalunderqml PUBLIC Qt::Quick ) - -# Resources: -set(metalunderqml_resource_files - "main.qml" - "squircle.frag" - "squircle.vert" -) - -qt6_add_resources(metalunderqml "metalunderqml" - PREFIX - "/scenegraph/metalunderqml" - FILES - ${metalunderqml_resource_files} -) - if(MACOS) target_link_libraries(metalunderqml PUBLIC "-framework AppKit" ) endif() +qt_add_qml_module(metalunderqml + URI MetalUnderQML + VERSION 1.0 + QML_FILES + main.qml + RESOURCES + squircle.frag + squircle.vert + RESOURCE_PREFIX /scenegraph/metalunderqml + NO_RESOURCE_TARGET_PATH + ) + install(TARGETS metalunderqml RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(metalunderqml PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI MetalUnderQML -) - -qt6_qml_type_registration(metalunderqml) diff --git a/examples/quick/scenegraph/metalunderqml/main.cpp b/examples/quick/scenegraph/metalunderqml/main.cpp index 4a657a6bf4..220bed14f8 100644 --- a/examples/quick/scenegraph/metalunderqml/main.cpp +++ b/examples/quick/scenegraph/metalunderqml/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); - QQuickWindow::setGraphicsApi(QSGRendererInterface::MetalRhi); + QQuickWindow::setGraphicsApi(QSGRendererInterface::Metal); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); diff --git a/examples/quick/scenegraph/metalunderqml/metalsquircle.mm b/examples/quick/scenegraph/metalunderqml/metalsquircle.mm index 4acedcab02..edac29665c 100644 --- a/examples/quick/scenegraph/metalunderqml/metalsquircle.mm +++ b/examples/quick/scenegraph/metalunderqml/metalsquircle.mm @@ -205,7 +205,7 @@ void SquircleRenderer::frameStart() QSGRendererInterface *rif = m_window->rendererInterface(); // We are not prepared for anything other than running with the RHI and its Metal backend. - Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::MetalRhi); + Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::Metal); m_device = (id<MTLDevice>) rif->getResource(m_window, QSGRendererInterface::DeviceResource); Q_ASSERT(m_device); diff --git a/examples/quick/scenegraph/openglunderqml/CMakeLists.txt b/examples/quick/scenegraph/openglunderqml/CMakeLists.txt index 0772c05259..a99c5d84d1 100644 --- a/examples/quick/scenegraph/openglunderqml/CMakeLists.txt +++ b/examples/quick/scenegraph/openglunderqml/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from openglunderqml.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(openglunderqml LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -27,6 +27,9 @@ qt_add_executable(openglunderqml set_target_properties(openglunderqml PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE + + # Prevent name clash with build subdirectory on case-insensitive file systems + OUTPUT_NAME openglunderqmlapp ) target_link_libraries(openglunderqml PUBLIC Qt::Core @@ -35,17 +38,12 @@ target_link_libraries(openglunderqml PUBLIC Qt::Quick ) - -# Resources: -set(openglunderqml_resource_files - "main.qml" -) - -qt6_add_resources(openglunderqml "openglunderqml" - PREFIX - "/scenegraph/openglunderqml" - FILES - ${openglunderqml_resource_files} +qt_add_qml_module(openglunderqml + URI OpenGLUnderQML + VERSION 1.0 + QML_FILES main.qml + RESOURCE_PREFIX /scenegraph/openglunderqml + NO_RESOURCE_TARGET_PATH ) install(TARGETS openglunderqml @@ -53,10 +51,3 @@ install(TARGETS openglunderqml BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(openglunderqml PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI OpenGLUnderQML -) - -qt6_qml_type_registration(openglunderqml) diff --git a/examples/quick/scenegraph/openglunderqml/main.cpp b/examples/quick/scenegraph/openglunderqml/main.cpp index d92cbb2d80..5df329c425 100644 --- a/examples/quick/scenegraph/openglunderqml/main.cpp +++ b/examples/quick/scenegraph/openglunderqml/main.cpp @@ -59,7 +59,7 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); - QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi); + QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp index d80309cbfb..2e224e77b0 100644 --- a/examples/quick/scenegraph/openglunderqml/squircle.cpp +++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp @@ -137,7 +137,7 @@ void SquircleRenderer::init() { if (!m_program) { QSGRendererInterface *rif = m_window->rendererInterface(); - Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::OpenGL || rif->graphicsApi() == QSGRendererInterface::OpenGLRhi); + Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::OpenGL); initializeOpenGLFunctions(); diff --git a/examples/quick/scenegraph/threadedanimation/CMakeLists.txt b/examples/quick/scenegraph/threadedanimation/CMakeLists.txt index de00297e69..328b41bc9e 100644 --- a/examples/quick/scenegraph/threadedanimation/CMakeLists.txt +++ b/examples/quick/scenegraph/threadedanimation/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from threadedanimation.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(threadedanimation LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -35,18 +35,13 @@ target_link_libraries(threadedanimation PUBLIC Qt::Quick ) - -# Resources: -set(threadedanimation_resource_files - "main.qml" - "spinner.png" -) - -qt6_add_resources(threadedanimation "threadedanimation" - PREFIX - "/scenegraph/threadedanimation" - FILES - ${threadedanimation_resource_files} +qt_add_qml_module(threadedanimation + URI Spinner + VERSION 1.0 + QML_FILES main.qml + RESOURCES spinner.png + RESOURCE_PREFIX /scenegraph/threadedanimation + NO_RESOURCE_TARGET_PATH ) install(TARGETS threadedanimation @@ -54,10 +49,3 @@ install(TARGETS threadedanimation BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(threadedanimation PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI Spinner -) - -qt6_qml_type_registration(threadedanimation) diff --git a/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt b/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt index 5515a14b23..b33809f8a8 100644 --- a/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt +++ b/examples/quick/scenegraph/twotextureproviders/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from twotextureproviders.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(twotextureproviders LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -19,6 +19,7 @@ find_package(Qt6 COMPONENTS Core) find_package(Qt6 COMPONENTS Gui) find_package(Qt6 COMPONENTS Qml) find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS ShaderTools) qt_add_executable(twotextureproviders main.cpp @@ -35,20 +36,25 @@ target_link_libraries(twotextureproviders PUBLIC Qt::Quick ) - -# Resources: -set(twotextureproviders_resource_files - "main.qml" - "shaders/checker.frag.qsb" - "shaders/xorblender.frag.qsb" - "shaders/xorblender.vert.qsb" +qt_add_qml_module(twotextureproviders + URI SceneGraphRendering + VERSION 1.0 + QML_FILES + main.qml + RESOURCE_PREFIX /scenegraph/twotextureproviders + NO_RESOURCE_TARGET_PATH ) -qt6_add_resources(twotextureproviders "twotextureproviders" +qt6_add_shaders(twotextureproviders "shaders" + BATCHABLE + PRECOMPILE + OPTIMIZED PREFIX "/scenegraph/twotextureproviders" FILES - ${twotextureproviders_resource_files} + "shaders/xorblender.vert" + "shaders/xorblender.frag" + "shaders/checker.frag" ) install(TARGETS twotextureproviders @@ -56,10 +62,3 @@ install(TARGETS twotextureproviders BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(twotextureproviders PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI SceneGraphRendering -) - -qt6_qml_type_registration(twotextureproviders) diff --git a/examples/quick/scenegraph/twotextureproviders/shaders/compile.bat b/examples/quick/scenegraph/twotextureproviders/shaders/compile.bat deleted file mode 100644 index 99e0ff2a91..0000000000 --- a/examples/quick/scenegraph/twotextureproviders/shaders/compile.bat +++ /dev/null @@ -1,42 +0,0 @@ -::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -:: -:: Copyright (C) 2020 The Qt Company Ltd. -:: Contact: https://www.qt.io/licensing/ -:: -:: This file is part of the QtQuick module of the Qt Toolkit. -:: -:: $QT_BEGIN_LICENSE:LGPL$ -:: Commercial License Usage -:: Licensees holding valid commercial Qt licenses may use this file in -:: accordance with the commercial license agreement provided with the -:: Software or, alternatively, in accordance with the terms contained in -:: a written agreement between you and The Qt Company. For licensing terms -:: and conditions see https://www.qt.io/terms-conditions. For further -:: information use the contact form at https://www.qt.io/contact-us. -:: -:: GNU Lesser General Public License Usage -:: Alternatively, this file may be used under the terms of the GNU Lesser -:: General Public License version 3 as published by the Free Software -:: Foundation and appearing in the file LICENSE.LGPL3 included in the -:: packaging of this file. Please review the following information to -:: ensure the GNU Lesser General Public License version 3 requirements -:: will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -:: -:: GNU General Public License Usage -:: Alternatively, this file may be used under the terms of the GNU -:: General Public License version 2.0 or (at your option) the GNU General -:: Public license version 3 or any later version approved by the KDE Free -:: Qt Foundation. The licenses are as published by the Free Software -:: Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -:: included in the packaging of this file. Please review the following -:: information to ensure the GNU General Public License requirements will -:: be met: https://www.gnu.org/licenses/gpl-2.0.html and -:: https://www.gnu.org/licenses/gpl-3.0.html. -:: -:: $QT_END_LICENSE$ -:: -::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: - -qsb --glsl "100es,120,150" --hlsl 50 --msl 12 -c -O -o checker.frag.qsb checker.frag -qsb -b --glsl "100es,120,150" --hlsl 50 --msl 12 -c -O -o xorblender.vert.qsb xorblender.vert -qsb --glsl "100es,120,150" --hlsl 50 --msl 12 -c -O -o xorblender.frag.qsb xorblender.frag diff --git a/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt b/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt index b26aedf6ee..5f58bd78c3 100644 --- a/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt +++ b/examples/quick/scenegraph/vulkantextureimport/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from vulkantextureimport.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(vulkantextureimport LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -27,6 +27,9 @@ qt_add_executable(vulkantextureimport set_target_properties(vulkantextureimport PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE + + # Prevent name clash with build subdirectory on case-insensitive file systems + OUTPUT_NAME vulkantextureimportapp ) target_link_libraries(vulkantextureimport PUBLIC Qt::Core @@ -35,19 +38,16 @@ target_link_libraries(vulkantextureimport PUBLIC Qt::Quick ) - -# Resources: -set(vulkantextureimport_resource_files - "main.qml" - "squircle.frag.spv" - "squircle.vert.spv" -) - -qt6_add_resources(vulkantextureimport "vulkantextureimport" - PREFIX - "/scenegraph/vulkantextureimport" - FILES - ${vulkantextureimport_resource_files} +qt_add_qml_module(vulkantextureimport + URI VulkanTextureImport + VERSION 1.0 + QML_FILES + main.qml + RESOURCES + squircle.frag.spv + squircle.vert.spv + RESOURCE_PREFIX /scenegraph/vulkantextureimport + NO_RESOURCE_TARGET_PATH ) install(TARGETS vulkantextureimport @@ -55,10 +55,3 @@ install(TARGETS vulkantextureimport BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(vulkantextureimport PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI VulkanTextureImport -) - -qt6_qml_type_registration(vulkantextureimport) diff --git a/examples/quick/scenegraph/vulkantextureimport/main.cpp b/examples/quick/scenegraph/vulkantextureimport/main.cpp index d2eb5184dc..290eccdc42 100644 --- a/examples/quick/scenegraph/vulkantextureimport/main.cpp +++ b/examples/quick/scenegraph/vulkantextureimport/main.cpp @@ -55,7 +55,7 @@ int main(int argc, char **argv) { QGuiApplication app(argc, argv); - QQuickWindow::setGraphicsApi(QSGRendererInterface::VulkanRhi); + QQuickWindow::setGraphicsApi(QSGRendererInterface::Vulkan); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); diff --git a/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt b/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt index 96741c6e86..6921427d1b 100644 --- a/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt +++ b/examples/quick/scenegraph/vulkanunderqml/CMakeLists.txt @@ -1,6 +1,6 @@ # Generated from vulkanunderqml.pro. -cmake_minimum_required(VERSION 3.14) +cmake_minimum_required(VERSION 3.16) project(vulkanunderqml LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -27,6 +27,9 @@ qt_add_executable(vulkanunderqml set_target_properties(vulkanunderqml PROPERTIES WIN32_EXECUTABLE TRUE MACOSX_BUNDLE TRUE + + # Prevent name clash with build subdirectory on case-insensitive file systems + OUTPUT_NAME vulkanunderqmlapp ) target_link_libraries(vulkanunderqml PUBLIC Qt::Core @@ -35,19 +38,16 @@ target_link_libraries(vulkanunderqml PUBLIC Qt::Quick ) - -# Resources: -set(vulkanunderqml_resource_files - "main.qml" - "squircle.frag.spv" - "squircle.vert.spv" -) - -qt6_add_resources(vulkanunderqml "vulkanunderqml" - PREFIX - "/scenegraph/vulkanunderqml" - FILES - ${vulkanunderqml_resource_files} +qt_add_qml_module(vulkanunderqml + URI VulkanUnderQML + VERSION 1.0 + QML_FILES + main.qml + RESOURCES + squircle.frag.spv + squircle.vert.spv + RESOURCE_PREFIX /scenegraph/vulkanunderqml + NO_RESOURCE_TARGET_PATH ) install(TARGETS vulkanunderqml @@ -55,10 +55,3 @@ install(TARGETS vulkanunderqml BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" ) - -set_target_properties(vulkanunderqml PROPERTIES - QT_QML_MODULE_VERSION 1.0 - QT_QML_MODULE_URI VulkanUnderQML -) - -qt6_qml_type_registration(vulkanunderqml) diff --git a/examples/quick/scenegraph/vulkanunderqml/main.cpp b/examples/quick/scenegraph/vulkanunderqml/main.cpp index e4a3f36ca7..112332f4fd 100644 --- a/examples/quick/scenegraph/vulkanunderqml/main.cpp +++ b/examples/quick/scenegraph/vulkanunderqml/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char **argv) QGuiApplication app(argc, argv); // This example needs Vulkan. It will not run otherwise. - QQuickWindow::setGraphicsApi(QSGRendererInterface::VulkanRhi); + QQuickWindow::setGraphicsApi(QSGRendererInterface::Vulkan); QQuickView view; view.setResizeMode(QQuickView::SizeRootObjectToView); diff --git a/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp b/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp index 5942b49843..f272570d03 100644 --- a/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp +++ b/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp @@ -205,7 +205,7 @@ void SquircleRenderer::frameStart() QSGRendererInterface *rif = m_window->rendererInterface(); // We are not prepared for anything other than running with the RHI and its Vulkan backend. - Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::VulkanRhi); + Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::Vulkan); if (m_vert.isEmpty()) prepareShader(VertexStage); |