diff options
| author | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2024-04-16 11:59:33 +0200 |
|---|---|---|
| committer | Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> | 2024-04-18 15:35:04 +0200 |
| commit | 4194ab757e01909c8a7249fa184e6941eb1db7c5 (patch) | |
| tree | 675554a72060d79e4bc56d61130356b64383a064 | |
| parent | 83a93d243dbc1ef6679ee8ac3a35184a6edc43d9 (diff) | |
Tooling: Add pyside6-qsb
- Analogous to the qsb tool in Qt
- Add pyside6-qsb tool to the documentation
- Update developer documentation
Pick-to: 6.7 6.6 6.5
Task-number: PYSIDE-2629
Change-Id: I93058ebb2864491e951f4f828d703d8893fbcbe7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
| -rw-r--r-- | build_scripts/__init__.py | 3 | ||||
| -rw-r--r-- | build_scripts/wheel_files.py | 1 | ||||
| -rw-r--r-- | sources/pyside-tools/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | sources/pyside-tools/pyside_tool.py | 4 | ||||
| -rw-r--r-- | sources/pyside6/doc/developer/add_tool.rst | 6 | ||||
| -rw-r--r-- | sources/pyside6/doc/tools/index.rst | 13 | ||||
| -rw-r--r-- | sources/pyside6/doc/tools/pyside6-qsb.rst | 39 |
7 files changed, 65 insertions, 4 deletions
diff --git a/build_scripts/__init__.py b/build_scripts/__init__.py index de28b82b6..789f9028c 100644 --- a/build_scripts/__init__.py +++ b/build_scripts/__init__.py @@ -17,7 +17,8 @@ PYSIDE_UNIX_BIN_TOOLS = ["lupdate", "lrelease", "qmllint", "qmlformat", - "qmlls"] + "qmlls", + "qsb",] # tools that are bundled as .app in macOS, but are normal executables in Linux and Windows PYSIDE_UNIX_BUNDLED_TOOLS = ["assistant", diff --git a/build_scripts/wheel_files.py b/build_scripts/wheel_files.py index 0d3072773..6476b1609 100644 --- a/build_scripts/wheel_files.py +++ b/build_scripts/wheel_files.py @@ -774,6 +774,7 @@ def module_QtQuick3D() -> ModuleData: data.qtlib.extend(_qtlib) data.metatypes.extend(_metatypes) data.extra_files.append("Qt/plugins/assetimporters/libassimp*") + data.extra_files.append("qsb*") return data diff --git a/sources/pyside-tools/CMakeLists.txt b/sources/pyside-tools/CMakeLists.txt index d8a353300..4f9d04354 100644 --- a/sources/pyside-tools/CMakeLists.txt +++ b/sources/pyside-tools/CMakeLists.txt @@ -44,7 +44,8 @@ else() "${TOOLS_PATH}/lupdate${CMAKE_EXECUTABLE_SUFFIX}" "${TOOLS_PATH}/qmllint${CMAKE_EXECUTABLE_SUFFIX}" "${TOOLS_PATH}/qmlformat${CMAKE_EXECUTABLE_SUFFIX}" - "${TOOLS_PATH}/qmlls${CMAKE_EXECUTABLE_SUFFIX}") + "${TOOLS_PATH}/qmlls${CMAKE_EXECUTABLE_SUFFIX}" + "${TOOLS_PATH}/qsb${CMAKE_EXECUTABLE_SUFFIX}") if (APPLE) list(APPEND directories "${TOOLS_PATH}/Assistant.app" diff --git a/sources/pyside-tools/pyside_tool.py b/sources/pyside-tools/pyside_tool.py index 7daacc22d..64682e24d 100644 --- a/sources/pyside-tools/pyside_tool.py +++ b/sources/pyside-tools/pyside_tool.py @@ -227,5 +227,9 @@ def android_deploy(): pyside_script_wrapper("android_deploy.py") +def qsb(): + qt_tool_wrapper("qsb", sys.argv[1:]) + + if __name__ == "__main__": main() diff --git a/sources/pyside6/doc/developer/add_tool.rst b/sources/pyside6/doc/developer/add_tool.rst index a894226c5..732e6b915 100644 --- a/sources/pyside6/doc/developer/add_tool.rst +++ b/sources/pyside6/doc/developer/add_tool.rst @@ -44,6 +44,8 @@ Add a Qt tool wrapper - Add the tool in ``sources/pyside-tools/pyside_tool.py``. - Add the tool in ``build_scripts/__init__.py`` to create the setuptools entry points i.e. this enable using the tool from the console as "pyside6-<tool_name>" -- Add an entry to ``sources/pyside6/doc/gettingstarted/package_details.rst``. +- Add an entry to ``sources/pyside6/doc/tools/index.rst`` and the detailed + documentation to ``sources/pyside6/doc/tools/<tool_name>.rst``. - Include the necessary Qt binaries explicitly on ``build_scripts/wheel_files.py`` -- Build with ``--standalone``, verify it is working. +- Add the necessary files to ``build_scripts/wheel_files.py``. +- Build with ``--standalone``, verify it is working. Also, check if the wheel bundles the tool. diff --git a/sources/pyside6/doc/tools/index.rst b/sources/pyside6/doc/tools/index.rst index dd51da65e..b82e3fd71 100644 --- a/sources/pyside6/doc/tools/index.rst +++ b/sources/pyside6/doc/tools/index.rst @@ -176,3 +176,16 @@ Deployment to deploy PySide6 application as an Android app targeting different Android platforms - aarch64, armv7a, i686, x86_64. + +Shader Tools +~~~~~~~~~~~~ + +.. grid:: 2 + :gutter: 3 3 4 5 + + .. grid-item-card:: ``pyside6-qsb`` + :link: pyside6-qsb + :link-type: ref + + a command line tool provided by the Qt Shader Tools module to + generate and inspect .qsb files. diff --git a/sources/pyside6/doc/tools/pyside6-qsb.rst b/sources/pyside6/doc/tools/pyside6-qsb.rst new file mode 100644 index 000000000..f6f1847d4 --- /dev/null +++ b/sources/pyside6/doc/tools/pyside6-qsb.rst @@ -0,0 +1,39 @@ +.. _pyside6-qsb: + +pyside6-qsb +=========== + +``pyside6-qsb`` is a tool that wraps the `qsb <QSB Manual>`_ tool. qsb is a +command line tool provided by the `Qt Shader Tools`_ module. It integrates +third-party libraries such as `glslang`_ and `SPIRV-Cross`_, optionally invokes +external tools, such as ``fxc`` or ``spirv-opt``, and generates .qsb files. +Additionally, it can be used to inspect the contents of a .qsb package. + +For more information on how to use this tool, read Qt's documentation +here: `QSB Manual`_. + +Usage +----- + +To create a qsb file from a shader file, e.g., ``shader.frag``, use the +following command: + +.. code-block:: bash + + pyside6-qsb -o shader.frag.qsb shader.frag + +To inspect the file produced, i.e., ``shader.frag.qsb``, use the following +command: + +.. code-block:: bash + + pyside6-qsb -d shader.frag.qsb + +This will print the reflection metadata (in JSON form) and the included shaders. + +For other modes of operation, refer to the `QSB Manual`_. + +.. _`glslang`: https://github.com/KhronosGroup/glslang +.. _`spirv-cross`: https://github.com/KhronosGroup/SPIRV-Cross +.. _`QSB Manual`: https://doc.qt.io/qt-6/qtshadertools-qsb.html +.. _`Qt Shader Tools`: https://doc.qt.io/qt-6/qtshadertools-index.html |
