diff --git a/.gitignore b/.gitignore index c1f2a30f5c..89bb59012d 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ data/patterns_design.txt data/route_points.dat data/bookmarks/ data/bookmarks_backup/ +data/vulkan_shaders/debug/* # Compiled Python *.pyc diff --git a/android/assets/vulkan_shaders b/android/assets/vulkan_shaders new file mode 120000 index 0000000000..99474fc892 --- /dev/null +++ b/android/assets/vulkan_shaders @@ -0,0 +1 @@ +../../data/vulkan_shaders \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index c72b82bdea..ac7d8855a2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -455,7 +455,7 @@ android { // We don't compress these extensions in assets/ because our random FileReader can't read zip-compressed files from apk. // TODO: Load all minor files via separate call to ReadAsString which can correctly handle compressed files in zip containers. aaptOptions { - noCompress 'txt', 'bin', 'html', 'png', 'json', 'mwm', 'ttf', 'sdf', 'ui', 'config', 'csv' + noCompress 'txt', 'bin', 'html', 'png', 'json', 'mwm', 'ttf', 'sdf', 'ui', 'config', 'csv', 'spv' ignoreAssetsPattern "!.svn:!.git:!.DS_Store:!*.scc:.*:_*:!CVS:!thumbs.db:!picasa.ini:!*~" } diff --git a/data/vulkan_shaders/Accuracy.frag.spv b/data/vulkan_shaders/Accuracy.frag.spv new file mode 100644 index 0000000000..e89368439d Binary files /dev/null and b/data/vulkan_shaders/Accuracy.frag.spv differ diff --git a/data/vulkan_shaders/Accuracy.vert.spv b/data/vulkan_shaders/Accuracy.vert.spv new file mode 100644 index 0000000000..cc29eb9c3e Binary files /dev/null and b/data/vulkan_shaders/Accuracy.vert.spv differ diff --git a/data/vulkan_shaders/Area.frag.spv b/data/vulkan_shaders/Area.frag.spv new file mode 100644 index 0000000000..0d8d45f868 Binary files /dev/null and b/data/vulkan_shaders/Area.frag.spv differ diff --git a/data/vulkan_shaders/Area.vert.spv b/data/vulkan_shaders/Area.vert.spv new file mode 100644 index 0000000000..e9de55a3b7 Binary files /dev/null and b/data/vulkan_shaders/Area.vert.spv differ diff --git a/data/vulkan_shaders/Area3d.frag.spv b/data/vulkan_shaders/Area3d.frag.spv new file mode 100644 index 0000000000..5b6204f156 Binary files /dev/null and b/data/vulkan_shaders/Area3d.frag.spv differ diff --git a/data/vulkan_shaders/Area3d.vert.spv b/data/vulkan_shaders/Area3d.vert.spv new file mode 100644 index 0000000000..ebf8efb03e Binary files /dev/null and b/data/vulkan_shaders/Area3d.vert.spv differ diff --git a/data/vulkan_shaders/Area3dOutline.frag.spv b/data/vulkan_shaders/Area3dOutline.frag.spv new file mode 100644 index 0000000000..0d8d45f868 Binary files /dev/null and b/data/vulkan_shaders/Area3dOutline.frag.spv differ diff --git a/data/vulkan_shaders/Area3dOutline.vert.spv b/data/vulkan_shaders/Area3dOutline.vert.spv new file mode 100644 index 0000000000..52ca5f80e7 Binary files /dev/null and b/data/vulkan_shaders/Area3dOutline.vert.spv differ diff --git a/data/vulkan_shaders/AreaOutline.frag.spv b/data/vulkan_shaders/AreaOutline.frag.spv new file mode 100644 index 0000000000..0d8d45f868 Binary files /dev/null and b/data/vulkan_shaders/AreaOutline.frag.spv differ diff --git a/data/vulkan_shaders/AreaOutline.vert.spv b/data/vulkan_shaders/AreaOutline.vert.spv new file mode 100644 index 0000000000..e9de55a3b7 Binary files /dev/null and b/data/vulkan_shaders/AreaOutline.vert.spv differ diff --git a/data/vulkan_shaders/Arrow3d.frag.spv b/data/vulkan_shaders/Arrow3d.frag.spv new file mode 100644 index 0000000000..09c2398824 Binary files /dev/null and b/data/vulkan_shaders/Arrow3d.frag.spv differ diff --git a/data/vulkan_shaders/Arrow3d.vert.spv b/data/vulkan_shaders/Arrow3d.vert.spv new file mode 100644 index 0000000000..40b973242b Binary files /dev/null and b/data/vulkan_shaders/Arrow3d.vert.spv differ diff --git a/data/vulkan_shaders/Arrow3dOutline.frag.spv b/data/vulkan_shaders/Arrow3dOutline.frag.spv new file mode 100644 index 0000000000..cc851f1e70 Binary files /dev/null and b/data/vulkan_shaders/Arrow3dOutline.frag.spv differ diff --git a/data/vulkan_shaders/Arrow3dOutline.vert.spv b/data/vulkan_shaders/Arrow3dOutline.vert.spv new file mode 100644 index 0000000000..5a6101ae10 Binary files /dev/null and b/data/vulkan_shaders/Arrow3dOutline.vert.spv differ diff --git a/data/vulkan_shaders/Arrow3dShadow.frag.spv b/data/vulkan_shaders/Arrow3dShadow.frag.spv new file mode 100644 index 0000000000..5a90e8e4aa Binary files /dev/null and b/data/vulkan_shaders/Arrow3dShadow.frag.spv differ diff --git a/data/vulkan_shaders/Arrow3dShadow.vert.spv b/data/vulkan_shaders/Arrow3dShadow.vert.spv new file mode 100644 index 0000000000..5a6101ae10 Binary files /dev/null and b/data/vulkan_shaders/Arrow3dShadow.vert.spv differ diff --git a/data/vulkan_shaders/Bookmark.frag.spv b/data/vulkan_shaders/Bookmark.frag.spv new file mode 100644 index 0000000000..04b6cfc60f Binary files /dev/null and b/data/vulkan_shaders/Bookmark.frag.spv differ diff --git a/data/vulkan_shaders/Bookmark.vert.spv b/data/vulkan_shaders/Bookmark.vert.spv new file mode 100644 index 0000000000..879cd6dc10 Binary files /dev/null and b/data/vulkan_shaders/Bookmark.vert.spv differ diff --git a/data/vulkan_shaders/BookmarkAboveText.frag.spv b/data/vulkan_shaders/BookmarkAboveText.frag.spv new file mode 100644 index 0000000000..04b6cfc60f Binary files /dev/null and b/data/vulkan_shaders/BookmarkAboveText.frag.spv differ diff --git a/data/vulkan_shaders/BookmarkAboveText.vert.spv b/data/vulkan_shaders/BookmarkAboveText.vert.spv new file mode 100644 index 0000000000..879cd6dc10 Binary files /dev/null and b/data/vulkan_shaders/BookmarkAboveText.vert.spv differ diff --git a/data/vulkan_shaders/BookmarkAboveTextBillboard.frag.spv b/data/vulkan_shaders/BookmarkAboveTextBillboard.frag.spv new file mode 100644 index 0000000000..04b6cfc60f Binary files /dev/null and b/data/vulkan_shaders/BookmarkAboveTextBillboard.frag.spv differ diff --git a/data/vulkan_shaders/BookmarkAboveTextBillboard.vert.spv b/data/vulkan_shaders/BookmarkAboveTextBillboard.vert.spv new file mode 100644 index 0000000000..5791c01c05 Binary files /dev/null and b/data/vulkan_shaders/BookmarkAboveTextBillboard.vert.spv differ diff --git a/data/vulkan_shaders/BookmarkAnim.frag.spv b/data/vulkan_shaders/BookmarkAnim.frag.spv new file mode 100644 index 0000000000..04b6cfc60f Binary files /dev/null and b/data/vulkan_shaders/BookmarkAnim.frag.spv differ diff --git a/data/vulkan_shaders/BookmarkAnim.vert.spv b/data/vulkan_shaders/BookmarkAnim.vert.spv new file mode 100644 index 0000000000..879cd6dc10 Binary files /dev/null and b/data/vulkan_shaders/BookmarkAnim.vert.spv differ diff --git a/data/vulkan_shaders/BookmarkAnimAboveText.frag.spv b/data/vulkan_shaders/BookmarkAnimAboveText.frag.spv new file mode 100644 index 0000000000..04b6cfc60f Binary files /dev/null and b/data/vulkan_shaders/BookmarkAnimAboveText.frag.spv differ diff --git a/data/vulkan_shaders/BookmarkAnimAboveText.vert.spv b/data/vulkan_shaders/BookmarkAnimAboveText.vert.spv new file mode 100644 index 0000000000..879cd6dc10 Binary files /dev/null and b/data/vulkan_shaders/BookmarkAnimAboveText.vert.spv differ diff --git a/data/vulkan_shaders/BookmarkAnimAboveTextBillboard.frag.spv b/data/vulkan_shaders/BookmarkAnimAboveTextBillboard.frag.spv new file mode 100644 index 0000000000..04b6cfc60f Binary files /dev/null and b/data/vulkan_shaders/BookmarkAnimAboveTextBillboard.frag.spv differ diff --git a/data/vulkan_shaders/BookmarkAnimAboveTextBillboard.vert.spv b/data/vulkan_shaders/BookmarkAnimAboveTextBillboard.vert.spv new file mode 100644 index 0000000000..5791c01c05 Binary files /dev/null and b/data/vulkan_shaders/BookmarkAnimAboveTextBillboard.vert.spv differ diff --git a/data/vulkan_shaders/BookmarkAnimBillboard.frag.spv b/data/vulkan_shaders/BookmarkAnimBillboard.frag.spv new file mode 100644 index 0000000000..04b6cfc60f Binary files /dev/null and b/data/vulkan_shaders/BookmarkAnimBillboard.frag.spv differ diff --git a/data/vulkan_shaders/BookmarkAnimBillboard.vert.spv b/data/vulkan_shaders/BookmarkAnimBillboard.vert.spv new file mode 100644 index 0000000000..5791c01c05 Binary files /dev/null and b/data/vulkan_shaders/BookmarkAnimBillboard.vert.spv differ diff --git a/data/vulkan_shaders/BookmarkBillboard.frag.spv b/data/vulkan_shaders/BookmarkBillboard.frag.spv new file mode 100644 index 0000000000..04b6cfc60f Binary files /dev/null and b/data/vulkan_shaders/BookmarkBillboard.frag.spv differ diff --git a/data/vulkan_shaders/BookmarkBillboard.vert.spv b/data/vulkan_shaders/BookmarkBillboard.vert.spv new file mode 100644 index 0000000000..5791c01c05 Binary files /dev/null and b/data/vulkan_shaders/BookmarkBillboard.vert.spv differ diff --git a/data/vulkan_shaders/CapJoin.frag.spv b/data/vulkan_shaders/CapJoin.frag.spv new file mode 100644 index 0000000000..cc3a878929 Binary files /dev/null and b/data/vulkan_shaders/CapJoin.frag.spv differ diff --git a/data/vulkan_shaders/CapJoin.vert.spv b/data/vulkan_shaders/CapJoin.vert.spv new file mode 100644 index 0000000000..374a75c4d2 Binary files /dev/null and b/data/vulkan_shaders/CapJoin.vert.spv differ diff --git a/data/vulkan_shaders/CirclePoint.frag.spv b/data/vulkan_shaders/CirclePoint.frag.spv new file mode 100644 index 0000000000..595b94cffc Binary files /dev/null and b/data/vulkan_shaders/CirclePoint.frag.spv differ diff --git a/data/vulkan_shaders/CirclePoint.vert.spv b/data/vulkan_shaders/CirclePoint.vert.spv new file mode 100644 index 0000000000..99560206c8 Binary files /dev/null and b/data/vulkan_shaders/CirclePoint.vert.spv differ diff --git a/data/vulkan_shaders/ColoredSymbol.frag.spv b/data/vulkan_shaders/ColoredSymbol.frag.spv new file mode 100644 index 0000000000..9ddcd29ab6 Binary files /dev/null and b/data/vulkan_shaders/ColoredSymbol.frag.spv differ diff --git a/data/vulkan_shaders/ColoredSymbol.vert.spv b/data/vulkan_shaders/ColoredSymbol.vert.spv new file mode 100644 index 0000000000..5c668c18aa Binary files /dev/null and b/data/vulkan_shaders/ColoredSymbol.vert.spv differ diff --git a/data/vulkan_shaders/ColoredSymbolBillboard.frag.spv b/data/vulkan_shaders/ColoredSymbolBillboard.frag.spv new file mode 100644 index 0000000000..9ddcd29ab6 Binary files /dev/null and b/data/vulkan_shaders/ColoredSymbolBillboard.frag.spv differ diff --git a/data/vulkan_shaders/ColoredSymbolBillboard.vert.spv b/data/vulkan_shaders/ColoredSymbolBillboard.vert.spv new file mode 100644 index 0000000000..5ffa225ab8 Binary files /dev/null and b/data/vulkan_shaders/ColoredSymbolBillboard.vert.spv differ diff --git a/data/vulkan_shaders/DashedLine.frag.spv b/data/vulkan_shaders/DashedLine.frag.spv new file mode 100644 index 0000000000..a0a135ec1b Binary files /dev/null and b/data/vulkan_shaders/DashedLine.frag.spv differ diff --git a/data/vulkan_shaders/DashedLine.vert.spv b/data/vulkan_shaders/DashedLine.vert.spv new file mode 100644 index 0000000000..9558df43ff Binary files /dev/null and b/data/vulkan_shaders/DashedLine.vert.spv differ diff --git a/data/vulkan_shaders/DebugRect.frag.spv b/data/vulkan_shaders/DebugRect.frag.spv new file mode 100644 index 0000000000..306ef6b22b Binary files /dev/null and b/data/vulkan_shaders/DebugRect.frag.spv differ diff --git a/data/vulkan_shaders/DebugRect.vert.spv b/data/vulkan_shaders/DebugRect.vert.spv new file mode 100644 index 0000000000..e1824debce Binary files /dev/null and b/data/vulkan_shaders/DebugRect.vert.spv differ diff --git a/data/vulkan_shaders/HatchingArea.frag.spv b/data/vulkan_shaders/HatchingArea.frag.spv new file mode 100644 index 0000000000..f3a1c2d834 Binary files /dev/null and b/data/vulkan_shaders/HatchingArea.frag.spv differ diff --git a/data/vulkan_shaders/HatchingArea.vert.spv b/data/vulkan_shaders/HatchingArea.vert.spv new file mode 100644 index 0000000000..94e222ebcc Binary files /dev/null and b/data/vulkan_shaders/HatchingArea.vert.spv differ diff --git a/data/vulkan_shaders/Line.frag.spv b/data/vulkan_shaders/Line.frag.spv new file mode 100644 index 0000000000..5f8be764b1 Binary files /dev/null and b/data/vulkan_shaders/Line.frag.spv differ diff --git a/data/vulkan_shaders/Line.vert.spv b/data/vulkan_shaders/Line.vert.spv new file mode 100644 index 0000000000..813e75b21e Binary files /dev/null and b/data/vulkan_shaders/Line.vert.spv differ diff --git a/data/vulkan_shaders/MaskedTexturing.frag.spv b/data/vulkan_shaders/MaskedTexturing.frag.spv new file mode 100644 index 0000000000..97fe88490c Binary files /dev/null and b/data/vulkan_shaders/MaskedTexturing.frag.spv differ diff --git a/data/vulkan_shaders/MaskedTexturing.vert.spv b/data/vulkan_shaders/MaskedTexturing.vert.spv new file mode 100644 index 0000000000..7a4639bcd3 Binary files /dev/null and b/data/vulkan_shaders/MaskedTexturing.vert.spv differ diff --git a/data/vulkan_shaders/MaskedTexturingBillboard.frag.spv b/data/vulkan_shaders/MaskedTexturingBillboard.frag.spv new file mode 100644 index 0000000000..97fe88490c Binary files /dev/null and b/data/vulkan_shaders/MaskedTexturingBillboard.frag.spv differ diff --git a/data/vulkan_shaders/MaskedTexturingBillboard.vert.spv b/data/vulkan_shaders/MaskedTexturingBillboard.vert.spv new file mode 100644 index 0000000000..227847d542 Binary files /dev/null and b/data/vulkan_shaders/MaskedTexturingBillboard.vert.spv differ diff --git a/data/vulkan_shaders/MyPosition.frag.spv b/data/vulkan_shaders/MyPosition.frag.spv new file mode 100644 index 0000000000..e89368439d Binary files /dev/null and b/data/vulkan_shaders/MyPosition.frag.spv differ diff --git a/data/vulkan_shaders/MyPosition.vert.spv b/data/vulkan_shaders/MyPosition.vert.spv new file mode 100644 index 0000000000..46d27af922 Binary files /dev/null and b/data/vulkan_shaders/MyPosition.vert.spv differ diff --git a/data/vulkan_shaders/PathSymbol.frag.spv b/data/vulkan_shaders/PathSymbol.frag.spv new file mode 100644 index 0000000000..8415d1742c Binary files /dev/null and b/data/vulkan_shaders/PathSymbol.frag.spv differ diff --git a/data/vulkan_shaders/PathSymbol.vert.spv b/data/vulkan_shaders/PathSymbol.vert.spv new file mode 100644 index 0000000000..d350be32dc Binary files /dev/null and b/data/vulkan_shaders/PathSymbol.vert.spv differ diff --git a/data/vulkan_shaders/Route.frag.spv b/data/vulkan_shaders/Route.frag.spv new file mode 100644 index 0000000000..a93b1a4e90 Binary files /dev/null and b/data/vulkan_shaders/Route.frag.spv differ diff --git a/data/vulkan_shaders/Route.vert.spv b/data/vulkan_shaders/Route.vert.spv new file mode 100644 index 0000000000..f93b5cf644 Binary files /dev/null and b/data/vulkan_shaders/Route.vert.spv differ diff --git a/data/vulkan_shaders/RouteArrow.frag.spv b/data/vulkan_shaders/RouteArrow.frag.spv new file mode 100644 index 0000000000..032c9cb476 Binary files /dev/null and b/data/vulkan_shaders/RouteArrow.frag.spv differ diff --git a/data/vulkan_shaders/RouteArrow.vert.spv b/data/vulkan_shaders/RouteArrow.vert.spv new file mode 100644 index 0000000000..391df7ae5e Binary files /dev/null and b/data/vulkan_shaders/RouteArrow.vert.spv differ diff --git a/data/vulkan_shaders/RouteDash.frag.spv b/data/vulkan_shaders/RouteDash.frag.spv new file mode 100644 index 0000000000..41974773db Binary files /dev/null and b/data/vulkan_shaders/RouteDash.frag.spv differ diff --git a/data/vulkan_shaders/RouteDash.vert.spv b/data/vulkan_shaders/RouteDash.vert.spv new file mode 100644 index 0000000000..f93b5cf644 Binary files /dev/null and b/data/vulkan_shaders/RouteDash.vert.spv differ diff --git a/data/vulkan_shaders/RouteMarker.frag.spv b/data/vulkan_shaders/RouteMarker.frag.spv new file mode 100644 index 0000000000..2f152960d8 Binary files /dev/null and b/data/vulkan_shaders/RouteMarker.frag.spv differ diff --git a/data/vulkan_shaders/RouteMarker.vert.spv b/data/vulkan_shaders/RouteMarker.vert.spv new file mode 100644 index 0000000000..bc6fb5a241 Binary files /dev/null and b/data/vulkan_shaders/RouteMarker.vert.spv differ diff --git a/data/vulkan_shaders/Ruler.frag.spv b/data/vulkan_shaders/Ruler.frag.spv new file mode 100644 index 0000000000..c435286b49 Binary files /dev/null and b/data/vulkan_shaders/Ruler.frag.spv differ diff --git a/data/vulkan_shaders/Ruler.vert.spv b/data/vulkan_shaders/Ruler.vert.spv new file mode 100644 index 0000000000..f7b7a05a52 Binary files /dev/null and b/data/vulkan_shaders/Ruler.vert.spv differ diff --git a/data/vulkan_shaders/ScreenQuad.frag.spv b/data/vulkan_shaders/ScreenQuad.frag.spv new file mode 100644 index 0000000000..62c5d12d3d Binary files /dev/null and b/data/vulkan_shaders/ScreenQuad.frag.spv differ diff --git a/data/vulkan_shaders/ScreenQuad.vert.spv b/data/vulkan_shaders/ScreenQuad.vert.spv new file mode 100644 index 0000000000..889b7cd0e6 Binary files /dev/null and b/data/vulkan_shaders/ScreenQuad.vert.spv differ diff --git a/data/vulkan_shaders/SmaaBlendingWeight.frag.spv b/data/vulkan_shaders/SmaaBlendingWeight.frag.spv new file mode 100644 index 0000000000..099c1e0694 Binary files /dev/null and b/data/vulkan_shaders/SmaaBlendingWeight.frag.spv differ diff --git a/data/vulkan_shaders/SmaaBlendingWeight.vert.spv b/data/vulkan_shaders/SmaaBlendingWeight.vert.spv new file mode 100644 index 0000000000..92ac3c160e Binary files /dev/null and b/data/vulkan_shaders/SmaaBlendingWeight.vert.spv differ diff --git a/data/vulkan_shaders/SmaaEdges.frag.spv b/data/vulkan_shaders/SmaaEdges.frag.spv new file mode 100644 index 0000000000..a86581df85 Binary files /dev/null and b/data/vulkan_shaders/SmaaEdges.frag.spv differ diff --git a/data/vulkan_shaders/SmaaEdges.vert.spv b/data/vulkan_shaders/SmaaEdges.vert.spv new file mode 100644 index 0000000000..33c729765a Binary files /dev/null and b/data/vulkan_shaders/SmaaEdges.vert.spv differ diff --git a/data/vulkan_shaders/SmaaFinal.frag.spv b/data/vulkan_shaders/SmaaFinal.frag.spv new file mode 100644 index 0000000000..611ac6afe2 Binary files /dev/null and b/data/vulkan_shaders/SmaaFinal.frag.spv differ diff --git a/data/vulkan_shaders/SmaaFinal.vert.spv b/data/vulkan_shaders/SmaaFinal.vert.spv new file mode 100644 index 0000000000..647b32485b Binary files /dev/null and b/data/vulkan_shaders/SmaaFinal.vert.spv differ diff --git a/data/vulkan_shaders/Text.frag.spv b/data/vulkan_shaders/Text.frag.spv new file mode 100644 index 0000000000..ad76ab7f33 Binary files /dev/null and b/data/vulkan_shaders/Text.frag.spv differ diff --git a/data/vulkan_shaders/Text.vert.spv b/data/vulkan_shaders/Text.vert.spv new file mode 100644 index 0000000000..ee9bcab201 Binary files /dev/null and b/data/vulkan_shaders/Text.vert.spv differ diff --git a/data/vulkan_shaders/TextBillboard.frag.spv b/data/vulkan_shaders/TextBillboard.frag.spv new file mode 100644 index 0000000000..ad76ab7f33 Binary files /dev/null and b/data/vulkan_shaders/TextBillboard.frag.spv differ diff --git a/data/vulkan_shaders/TextBillboard.vert.spv b/data/vulkan_shaders/TextBillboard.vert.spv new file mode 100644 index 0000000000..46100dfdc4 Binary files /dev/null and b/data/vulkan_shaders/TextBillboard.vert.spv differ diff --git a/data/vulkan_shaders/TextFixed.frag.spv b/data/vulkan_shaders/TextFixed.frag.spv new file mode 100644 index 0000000000..eb52418e05 Binary files /dev/null and b/data/vulkan_shaders/TextFixed.frag.spv differ diff --git a/data/vulkan_shaders/TextFixed.vert.spv b/data/vulkan_shaders/TextFixed.vert.spv new file mode 100644 index 0000000000..ee9bcab201 Binary files /dev/null and b/data/vulkan_shaders/TextFixed.vert.spv differ diff --git a/data/vulkan_shaders/TextFixedBillboard.frag.spv b/data/vulkan_shaders/TextFixedBillboard.frag.spv new file mode 100644 index 0000000000..eb52418e05 Binary files /dev/null and b/data/vulkan_shaders/TextFixedBillboard.frag.spv differ diff --git a/data/vulkan_shaders/TextFixedBillboard.vert.spv b/data/vulkan_shaders/TextFixedBillboard.vert.spv new file mode 100644 index 0000000000..46100dfdc4 Binary files /dev/null and b/data/vulkan_shaders/TextFixedBillboard.vert.spv differ diff --git a/data/vulkan_shaders/TextOutlined.frag.spv b/data/vulkan_shaders/TextOutlined.frag.spv new file mode 100644 index 0000000000..ad76ab7f33 Binary files /dev/null and b/data/vulkan_shaders/TextOutlined.frag.spv differ diff --git a/data/vulkan_shaders/TextOutlined.vert.spv b/data/vulkan_shaders/TextOutlined.vert.spv new file mode 100644 index 0000000000..98e6d5dd3d Binary files /dev/null and b/data/vulkan_shaders/TextOutlined.vert.spv differ diff --git a/data/vulkan_shaders/TextOutlinedBillboard.frag.spv b/data/vulkan_shaders/TextOutlinedBillboard.frag.spv new file mode 100644 index 0000000000..ad76ab7f33 Binary files /dev/null and b/data/vulkan_shaders/TextOutlinedBillboard.frag.spv differ diff --git a/data/vulkan_shaders/TextOutlinedBillboard.vert.spv b/data/vulkan_shaders/TextOutlinedBillboard.vert.spv new file mode 100644 index 0000000000..01310f66d4 Binary files /dev/null and b/data/vulkan_shaders/TextOutlinedBillboard.vert.spv differ diff --git a/data/vulkan_shaders/TextOutlinedGui.frag.spv b/data/vulkan_shaders/TextOutlinedGui.frag.spv new file mode 100644 index 0000000000..eac257a5cc Binary files /dev/null and b/data/vulkan_shaders/TextOutlinedGui.frag.spv differ diff --git a/data/vulkan_shaders/TextOutlinedGui.vert.spv b/data/vulkan_shaders/TextOutlinedGui.vert.spv new file mode 100644 index 0000000000..0c427d0e3b Binary files /dev/null and b/data/vulkan_shaders/TextOutlinedGui.vert.spv differ diff --git a/data/vulkan_shaders/TextStaticOutlinedGui.frag.spv b/data/vulkan_shaders/TextStaticOutlinedGui.frag.spv new file mode 100644 index 0000000000..eac257a5cc Binary files /dev/null and b/data/vulkan_shaders/TextStaticOutlinedGui.frag.spv differ diff --git a/data/vulkan_shaders/TextStaticOutlinedGui.vert.spv b/data/vulkan_shaders/TextStaticOutlinedGui.vert.spv new file mode 100644 index 0000000000..0c427d0e3b Binary files /dev/null and b/data/vulkan_shaders/TextStaticOutlinedGui.vert.spv differ diff --git a/data/vulkan_shaders/Texturing.frag.spv b/data/vulkan_shaders/Texturing.frag.spv new file mode 100644 index 0000000000..8415d1742c Binary files /dev/null and b/data/vulkan_shaders/Texturing.frag.spv differ diff --git a/data/vulkan_shaders/Texturing.vert.spv b/data/vulkan_shaders/Texturing.vert.spv new file mode 100644 index 0000000000..1642f969c4 Binary files /dev/null and b/data/vulkan_shaders/Texturing.vert.spv differ diff --git a/data/vulkan_shaders/TexturingBillboard.frag.spv b/data/vulkan_shaders/TexturingBillboard.frag.spv new file mode 100644 index 0000000000..8415d1742c Binary files /dev/null and b/data/vulkan_shaders/TexturingBillboard.frag.spv differ diff --git a/data/vulkan_shaders/TexturingBillboard.vert.spv b/data/vulkan_shaders/TexturingBillboard.vert.spv new file mode 100644 index 0000000000..c101527a76 Binary files /dev/null and b/data/vulkan_shaders/TexturingBillboard.vert.spv differ diff --git a/data/vulkan_shaders/TexturingGui.frag.spv b/data/vulkan_shaders/TexturingGui.frag.spv new file mode 100644 index 0000000000..c435286b49 Binary files /dev/null and b/data/vulkan_shaders/TexturingGui.frag.spv differ diff --git a/data/vulkan_shaders/TexturingGui.vert.spv b/data/vulkan_shaders/TexturingGui.vert.spv new file mode 100644 index 0000000000..b4ae0bf757 Binary files /dev/null and b/data/vulkan_shaders/TexturingGui.vert.spv differ diff --git a/data/vulkan_shaders/Traffic.frag.spv b/data/vulkan_shaders/Traffic.frag.spv new file mode 100644 index 0000000000..57b99a13d0 Binary files /dev/null and b/data/vulkan_shaders/Traffic.frag.spv differ diff --git a/data/vulkan_shaders/Traffic.vert.spv b/data/vulkan_shaders/Traffic.vert.spv new file mode 100644 index 0000000000..33f0b25ed0 Binary files /dev/null and b/data/vulkan_shaders/Traffic.vert.spv differ diff --git a/data/vulkan_shaders/TrafficCircle.frag.spv b/data/vulkan_shaders/TrafficCircle.frag.spv new file mode 100644 index 0000000000..b06b7e9f34 Binary files /dev/null and b/data/vulkan_shaders/TrafficCircle.frag.spv differ diff --git a/data/vulkan_shaders/TrafficCircle.vert.spv b/data/vulkan_shaders/TrafficCircle.vert.spv new file mode 100644 index 0000000000..f72ca1041d Binary files /dev/null and b/data/vulkan_shaders/TrafficCircle.vert.spv differ diff --git a/data/vulkan_shaders/TrafficLine.frag.spv b/data/vulkan_shaders/TrafficLine.frag.spv new file mode 100644 index 0000000000..79606bb3cc Binary files /dev/null and b/data/vulkan_shaders/TrafficLine.frag.spv differ diff --git a/data/vulkan_shaders/TrafficLine.vert.spv b/data/vulkan_shaders/TrafficLine.vert.spv new file mode 100644 index 0000000000..646d0b686a Binary files /dev/null and b/data/vulkan_shaders/TrafficLine.vert.spv differ diff --git a/data/vulkan_shaders/Transit.frag.spv b/data/vulkan_shaders/Transit.frag.spv new file mode 100644 index 0000000000..30ce030e5c Binary files /dev/null and b/data/vulkan_shaders/Transit.frag.spv differ diff --git a/data/vulkan_shaders/Transit.vert.spv b/data/vulkan_shaders/Transit.vert.spv new file mode 100644 index 0000000000..2f62ea8bd3 Binary files /dev/null and b/data/vulkan_shaders/Transit.vert.spv differ diff --git a/data/vulkan_shaders/TransitCircle.frag.spv b/data/vulkan_shaders/TransitCircle.frag.spv new file mode 100644 index 0000000000..c0d8bbde04 Binary files /dev/null and b/data/vulkan_shaders/TransitCircle.frag.spv differ diff --git a/data/vulkan_shaders/TransitCircle.vert.spv b/data/vulkan_shaders/TransitCircle.vert.spv new file mode 100644 index 0000000000..d0eaa9d816 Binary files /dev/null and b/data/vulkan_shaders/TransitCircle.vert.spv differ diff --git a/data/vulkan_shaders/TransitMarker.frag.spv b/data/vulkan_shaders/TransitMarker.frag.spv new file mode 100644 index 0000000000..468307de0d Binary files /dev/null and b/data/vulkan_shaders/TransitMarker.frag.spv differ diff --git a/data/vulkan_shaders/TransitMarker.vert.spv b/data/vulkan_shaders/TransitMarker.vert.spv new file mode 100644 index 0000000000..fb8164b7b5 Binary files /dev/null and b/data/vulkan_shaders/TransitMarker.vert.spv differ diff --git a/shaders/GL/circle.vsh.glsl b/shaders/GL/circle.vsh.glsl index e4007d2426..1191464057 100644 --- a/shaders/GL/circle.vsh.glsl +++ b/shaders/GL/circle.vsh.glsl @@ -6,7 +6,6 @@ uniform mat4 u_modelView; uniform mat4 u_projection; uniform mat4 u_pivotTransform; -varying vec3 v_radius; #ifdef ENABLE_VTF uniform sampler2D u_colorTex; varying LOW_P vec4 v_color; @@ -14,6 +13,8 @@ varying LOW_P vec4 v_color; varying vec2 v_colorTexCoords; #endif +varying vec3 v_radius; + void main() { vec4 p = vec4(a_position, 1) * u_modelView; diff --git a/shaders/GL/dashed_line.fsh.glsl b/shaders/GL/dashed_line.fsh.glsl index 742ef26de4..23bba7a8e1 100644 --- a/shaders/GL/dashed_line.fsh.glsl +++ b/shaders/GL/dashed_line.fsh.glsl @@ -1,6 +1,6 @@ varying vec2 v_colorTexCoord; -varying vec2 v_halfLength; varying vec2 v_maskTexCoord; +varying vec2 v_halfLength; uniform sampler2D u_colorTex; uniform sampler2D u_maskTex; diff --git a/shaders/GL/line.fsh.glsl b/shaders/GL/line.fsh.glsl index ea7f8cd24f..bef8c8a382 100644 --- a/shaders/GL/line.fsh.glsl +++ b/shaders/GL/line.fsh.glsl @@ -1,5 +1,3 @@ -varying vec2 v_halfLength; - uniform float u_opacity; #ifdef ENABLE_VTF varying LOW_P vec4 v_color; @@ -8,6 +6,8 @@ uniform sampler2D u_colorTex; varying vec2 v_colorTexCoord; #endif +varying vec2 v_halfLength; + const float aaPixelsCount = 2.5; void main() diff --git a/shaders/GL/smaa_blending_weight.fsh.glsl b/shaders/GL/smaa_blending_weight.fsh.glsl index 284fe0a48d..3fccfd2d71 100644 --- a/shaders/GL/smaa_blending_weight.fsh.glsl +++ b/shaders/GL/smaa_blending_weight.fsh.glsl @@ -140,7 +140,8 @@ void main() // We want the distances to be in pixel units (doing this here allow to // better interleave arithmetic and memory accesses). - d = abs(SMAARound(u_framebufferMetrics.zz * d - v_coords.zz)); + vec2 zz = u_framebufferMetrics.zz; + d = abs(SMAARound(zz * d - v_coords.zz)); // SMAAArea below needs a sqrt, as the areas texture is compressed // quadratically. @@ -172,7 +173,8 @@ void main() d.y = coords.z; // We want the distances to be in pixel units. - d = abs(SMAARound(u_framebufferMetrics.ww * d - v_coords.ww)); + vec2 ww = u_framebufferMetrics.ww; + d = abs(SMAARound(ww * d - v_coords.ww)); // SMAAArea below needs a sqrt, as the areas texture is compressed // quadratically. diff --git a/shaders/GL/text.fsh.glsl b/shaders/GL/text.fsh.glsl index 9db0e41948..b97e06f23d 100755 --- a/shaders/GL/text.fsh.glsl +++ b/shaders/GL/text.fsh.glsl @@ -1,5 +1,3 @@ -varying vec2 v_maskTexCoord; - #ifdef ENABLE_VTF varying LOW_P vec4 v_color; #else @@ -7,6 +5,8 @@ varying vec2 v_colorTexCoord; uniform sampler2D u_colorTex; #endif +varying vec2 v_maskTexCoord; + uniform sampler2D u_maskTex; uniform float u_opacity; uniform vec2 u_contrastGamma; diff --git a/shaders/GL/text_fixed.fsh.glsl b/shaders/GL/text_fixed.fsh.glsl index 681884c07f..af835b43b5 100755 --- a/shaders/GL/text_fixed.fsh.glsl +++ b/shaders/GL/text_fixed.fsh.glsl @@ -1,5 +1,3 @@ -varying vec2 v_maskTexCoord; - #ifdef ENABLE_VTF varying LOW_P vec4 v_color; #else @@ -7,6 +5,8 @@ varying vec2 v_colorTexCoord; uniform sampler2D u_colorTex; #endif +varying vec2 v_maskTexCoord; + uniform sampler2D u_maskTex; uniform float u_opacity; uniform vec2 u_contrastGamma; diff --git a/shaders/program_params.hpp b/shaders/program_params.hpp index 2e70898d55..781b5ae655 100644 --- a/shaders/program_params.hpp +++ b/shaders/program_params.hpp @@ -46,11 +46,7 @@ private: } \ } -#if defined(OMIM_METAL_AVAILABLE) #define ALIGNMENT __attribute__ ((aligned(16))) -#else -#define ALIGNMENT -#endif struct MapProgramParams { diff --git a/shaders/vulkan_shaders_preprocessor.py b/shaders/vulkan_shaders_preprocessor.py new file mode 100644 index 0000000000..df95e08dd0 --- /dev/null +++ b/shaders/vulkan_shaders_preprocessor.py @@ -0,0 +1,441 @@ +import os +import re +import sys +from subprocess import Popen, PIPE +from shutil import copyfile + +VERTEX_SHADER_EXT = '.vsh.glsl' +FRAG_SHADER_EXT = '.fsh.glsl' +VERTEX_SHADER_EXT_OUT = '.vert' +FRAG_SHADER_EXT_OUT = '.frag' + +SHADERS_LIB_COMMON_PATTERN = '// Common' +SHADERS_LIB_VS_PATTERN = '// VS' +SHADERS_LIB_FS_PATTERN = '// FS' +SHADERS_LIB_COMMON_INDEX = 0 +SHADERS_LIB_VS_INDEX = 1 +SHADERS_LIB_FS_INDEX = 2 + +IN = 'in' +OUT = 'out' +UNIFORMS = 'uniforms' +SAMPLERS = 'samplers' + +debug_output = False + + +# Read index file which contains program to shaders bindings. +def read_index_file(file_path, programs_order): + gpu_programs = dict() + with open(file_path, 'r') as f: + index = 0 + for line in f: + line_parts = line.strip().split() + if len(line_parts) != 3: + print('Incorrect GPU program definition : ' + line) + exit(1) + + if line_parts[0] != programs_order[index]: + print('Incorrect GPU program order or name : ' + line) + exit(1) + + vertex_shader = next(f for f in line_parts if f.endswith(VERTEX_SHADER_EXT)) + fragment_shader = next(f for f in line_parts if f.endswith(FRAG_SHADER_EXT)) + + if not vertex_shader: + print('Vertex shader not found in GPU program definition : ' + line) + exit(1) + + if not fragment_shader: + print('Fragment shader not found in GPU program definition : ' + line) + exit(1) + + if line_parts[0] in gpu_programs.keys(): + print('More than one definition of %s gpu program' % line_parts[0]) + exit(1) + + gpu_programs[index] = (vertex_shader, fragment_shader, line_parts[0]) + index += 1 + + gpu_programs_cache = dict() + for v in gpu_programs.values(): + gpu_programs_cache[v[2]] = (v[0], v[1]) + + return gpu_programs_cache + + +# Read hpp-file with programs enumeration. +def read_programs_file(file_path): + gpu_programs = [] + with open(file_path, 'r') as f: + found = False + for line in f: + if not found and line.find('enum class Program') >= 0: + found = True + continue + if found and line.find('}') >= 0: + break + if found and line.find('{') == -1: + line_parts = re.split(',|=', line) + name = line_parts[0].strip() + if name and name != 'ProgramsCount': + gpu_programs.append(name) + + return gpu_programs + + +def drop_variable_initialization(line): + equal_found = line.find('=') + if equal_found: + return line[:equal_found - 1] + return line.replace(';', '') + + +def get_program_param(line): + glsl_found = line.find('glsl::') + if glsl_found >= 0: + return drop_variable_initialization(line[glsl_found + 6:].replace('m_', 'u_')) + if line.find('float ') >= 0 or line.find('int ') >= 0: + return drop_variable_initialization(line.lstrip().replace('m_', 'u_')) + return None + + +def get_program(line): + program_found = line.find('Program::') + if program_found >= 0: + return line[program_found + 9:].replace(',', '').replace(')', '').replace('\n', '') + return None + + +# Read hpp-file with program parameters declaration. +def read_program_params_file(file_path): + program_params = [] + programs = [] + result = dict() + with open(file_path, 'r') as f: + block_found = False + for line in f: + if line.find('struct') >= 0 and line.find('ProgramParams') >= 0: + block_found = True + program_params = [] + programs = [] + continue + if block_found and line.find('}') >= 0: + block_found = False + for p in programs: + result[p] = program_params + continue + if block_found: + param = get_program_param(line) + if param: + program_params.append(param.split(' ')) + program = get_program(line) + if program: + programs.append(program) + return result + + +# Read GLSL-file with common shader functions. +def read_shaders_lib_file(file_path): + shaders_library = ['', '', ''] + with open(file_path, 'r') as f: + shaders_lib_content = f.read() + if len(shaders_lib_content) == 0: + return shaders_library + + common_index = shaders_lib_content.find(SHADERS_LIB_COMMON_PATTERN) + if common_index < 0: + print('Common functions block is not found in ' + file_path) + exit(1) + vs_index = shaders_lib_content.find(SHADERS_LIB_VS_PATTERN) + if vs_index < 0: + print('Vertex shaders functions block is not found in ' + file_path) + exit(1) + fs_index = shaders_lib_content.find(SHADERS_LIB_FS_PATTERN) + if fs_index < 0: + print('Vertex shaders functions block is not found in ' + file_path) + exit(1) + if not (common_index < vs_index < fs_index): + print('Order of functions block is incorrect in ' + file_path) + exit(1) + + shaders_library[SHADERS_LIB_COMMON_INDEX] = shaders_lib_content[common_index:vs_index - 1] + shaders_library[SHADERS_LIB_VS_INDEX] = shaders_lib_content[vs_index:fs_index - 1] + shaders_library[SHADERS_LIB_FS_INDEX] = shaders_lib_content[fs_index:] + + return shaders_library + + +def get_shaders_lib_content(shader_file, shaders_library): + lib_content = shaders_library[SHADERS_LIB_COMMON_INDEX] + if shader_file.find(VERTEX_SHADER_EXT) >= 0: + lib_content += shaders_library[SHADERS_LIB_VS_INDEX] + elif shader_file.find(FRAG_SHADER_EXT) >= 0: + lib_content += shaders_library[SHADERS_LIB_FS_INDEX] + return lib_content + + +def get_shader_line(line, layout_counters, is_fragment_shader): + if line.lstrip().startswith('//') or line == '\n' or len(line) == 0: + return None + + output_line = line.rstrip() + + if output_line.find('uniform ') >= 0: + if output_line.find('sampler') >= 0: + layout_counters[SAMPLERS][1].append(output_line) + else: + layout_counters[UNIFORMS] += 1 + return None + + if output_line.find('attribute ') >= 0: + location = layout_counters[IN] + layout_counters[IN] += 1 + output_line = output_line.replace('attribute', 'layout (location = {0}) in'.format(location)) + + if output_line.find('varying ') >= 0: + if is_fragment_shader: + location = layout_counters[IN] + layout_counters[IN] += 1 + output_line = output_line.replace('varying', 'layout (location = {0}) in'.format(location)) + else: + location = layout_counters[OUT] + layout_counters[OUT] += 1 + output_line = output_line.replace('varying', 'layout (location = {0}) out'.format(location)) + output_line = output_line.replace('texture2D', 'texture') + output_line = output_line.replace('gl_FragColor', 'v_FragColor') + return output_line + + +def get_size_by_type(type): + if type == 'float' or type == 'int': + return 1 + if type == 'vec2': + return 2 + if type == 'vec3': + return 3 + if type == 'vec4': + return 4 + if type == 'mat4': + return 16 + print('Type is not supported' + type) + exit(1) + + +def get_subscript(offset, param): + symbols = ['x', 'y', 'z', 'w'] + subscript = '' + for i in range(0, get_size_by_type(param[0])): + subscript += symbols[offset + i] + return subscript + + +def write_uniform_block(output_file, program_params): + groups = dict() + c = 0 + group_index = 0 + group_params = [] + for p in program_params: + sz = get_size_by_type(p[0]) + if sz % 4 == 0: + groups[(p[0], p[1])] = [p] + else: + if c + sz < 4: + group_params.append(p) + c += sz + elif c + sz == 4: + group_params.append(p) + groups[('vec4', 'u_grouped{0}'.format(group_index))] = group_params + group_index += 1 + group_params = [] + c = 0 + else: + print('Must be possible to unite sequential variables to vec4') + exit(1) + if c != 0: + groups[('vec4', 'u_grouped{0}'.format(group_index))] = group_params + + output_file.write('layout (binding = 0) uniform UBO\n') + output_file.write('{\n') + for g in groups.keys(): + output_file.write(' {0} {1};\n'.format(g[0], g[1])) + output_file.write('} uniforms;\n') + for k in groups.keys(): + name = k[1] + params = groups[k] + offset = 0 + if len(params) == 1 and get_size_by_type(params[0][0]) % 4 == 0: + output_file.write('#define {0} uniforms.{1}\n'.format(params[0][1], name)) + continue + for param in params: + output_file.write('#define {0} uniforms.{1}.{2}\n'.format(param[1], name, get_subscript(offset, param))) + offset += get_size_by_type(param[0]) + + +def get_size_of_attributes_block(lines_before_main): + for i, line in reversed(list(enumerate(lines_before_main))): + if line.find('layout (location') >= 0: + return i + 1 + return len(lines_before_main) + + +def generate_spirv_compatible_glsl_shader(output_file, shader_file, shader_dir, shaders_library, + program_params, layout_counters): + output_file.write('#version 310 es\n') + output_file.write('precision highp float;\n') + output_file.write('#define LOW_P lowp\n') + output_file.write('#define MEDIUM_P mediump\n') + output_file.write('#define HIGH_P highp\n') + output_file.write('#define VULKAN_MODE\n') + is_fragment_shader = shader_file.find(FRAG_SHADER_EXT) >= 0 + lib_content = get_shaders_lib_content(shader_file, shaders_library) + conditional_started = False + conditional_skip = False + lines_before_main = [] + main_found = False + for line in open(os.path.join(shader_dir, shader_file)): + # Remove some useless conditional compilation. + if conditional_started and line.lstrip().startswith('#else'): + conditional_skip = True + continue + if conditional_started and line.lstrip().startswith('#endif'): + conditional_skip = False + conditional_started = False + continue + if conditional_skip: + continue + if line.lstrip().startswith('#ifdef ENABLE_VTF') or line.lstrip().startswith('#ifdef GLES3'): + conditional_started = True + continue + + if line.lstrip().startswith('void main'): + main_found = True + + # Write attributes. + sz = get_size_of_attributes_block(lines_before_main) + for i in range(0, sz): + output_file.write('%s\n' % lines_before_main[i]) + + if is_fragment_shader: + output_file.write('layout (location = 0) out vec4 v_FragColor;\n') + + # Write uniforms block. + write_uniform_block(output_file, program_params) + + # Write samplers. + samplers_offset = layout_counters[SAMPLERS][0] + if layout_counters[UNIFORMS] > 0 and samplers_offset == 0: + samplers_offset = 1 + for idx, s in enumerate(layout_counters[SAMPLERS][1]): + output_file.write('layout (binding = {0}) {1}\n'.format(samplers_offset + idx, s)) + layout_counters[SAMPLERS][0] = samplers_offset + len(layout_counters[SAMPLERS][1]) + layout_counters[SAMPLERS][1] = [] + + # Write shaders library. + for lib_line in lib_content.splitlines(): + shader_line = get_shader_line(lib_line, layout_counters, is_fragment_shader) + if shader_line: + output_file.write('%s\n' % shader_line) + + # Write rest lines. + for i in range(sz, len(lines_before_main)): + output_file.write('%s\n' % lines_before_main[i]) + + shader_line = get_shader_line(line, layout_counters, is_fragment_shader) + if not shader_line: + continue + + if main_found: + output_file.write('%s\n' % shader_line) + else: + lines_before_main.append(shader_line) + layout_counters[IN] = 0 + layout_counters[OUT] = 0 + layout_counters[UNIFORMS] = 0 + + +# Execute external program. +def execute_external(options): + p = Popen(options, stdin=PIPE, stdout=PIPE, stderr=PIPE) + output, err = p.communicate() + rc = p.returncode + if rc != 0: + for line in err.split(b'\n'): + print(line.decode('utf-8')) + + +# Generate SPIR-V shader from GLSL source. +def generate_shader(shader, shader_dir, generation_dir, shaders_library, program_name, program_params, + layout_counters, output_name, glslc_path): + output_path = os.path.join(generation_dir, output_name) + with open(output_path, 'w') as file: + generate_spirv_compatible_glsl_shader(file, shader, shader_dir, shaders_library, + program_params, layout_counters) + try: + execute_external([glslc_path, '-c', output_path, '-o', output_path + '.spv', '-std=310es', '--target-env=vulkan']) + if debug_output: + debug_dir = os.path.join(generation_dir, 'debug', program_name) + debug_path = os.path.join(debug_dir, output_name) + if not os.path.exists(debug_dir): + os.makedirs(debug_dir) + execute_external([glslc_path, '-S', output_path, '-o', debug_path + '.spv.txt', '-std=310es','--target-env=vulkan']) + os.rename(output_path, debug_path) + else: + os.remove(output_path) + except: + print('Could not generate SPIR-V for the shader {0}. Most likely glslc from Android NDK is not found.'.format(shader)) + os.remove(output_path) + exit(1) + + +# Check if varying are in the same order in vertex and fragment shaders. +def check_varying_consistency(vs_file_name, fs_file_name): + vs_varyings = [] + for line in open(vs_file_name): + line = line.lstrip().rstrip() + if line.startswith('varying '): + vs_varyings.append(line) + fs_varyings = [] + for line in open(fs_file_name): + line = line.lstrip().rstrip() + if line.startswith('varying '): + fs_varyings.append(line) + return vs_varyings == fs_varyings + + +if __name__ == '__main__': + if len(sys.argv) < 7: + print('Usage : ' + sys.argv[0] + ' [--debug]') + exit(1) + + shader_dir = sys.argv[1] + index_file_name = sys.argv[2] + programs_file_name = sys.argv[3] + program_params_file_name = sys.argv[4] + shaders_lib_file = sys.argv[5] + generation_dir = sys.argv[6] + glslc_path = sys.argv[7] + + if len(sys.argv) >= 9: + debug_output = (sys.argv[8] == '--debug') + + shaders = [file for file in os.listdir(shader_dir) if + os.path.isfile(os.path.join(shader_dir, file)) and ( + file.endswith(VERTEX_SHADER_EXT) or file.endswith(FRAG_SHADER_EXT))] + + programs_order = read_programs_file(os.path.join(shader_dir, '..', programs_file_name)) + program_params = read_program_params_file(os.path.join(shader_dir, '..', program_params_file_name)) + gpu_programs_cache = read_index_file(os.path.join(shader_dir, index_file_name), programs_order) + shaders_library = read_shaders_lib_file(os.path.join(shader_dir, shaders_lib_file)) + for (k, v) in gpu_programs_cache.items(): + if not k in program_params: + print('Program params were not found for the shader ' + k) + exit(1) + if not check_varying_consistency(os.path.join(shader_dir, v[0]), os.path.join(shader_dir, v[1])): + print('Varyings must be in the same order in VS and FS. Shaders: {0}, {1} / Program: {2}.'.format(v[0], v[1], k)) + exit(1) + layout_counters = {IN: 0, OUT: 0, UNIFORMS: 0, SAMPLERS: [0, list()]} + generate_shader(v[0], shader_dir, generation_dir, shaders_library, k, program_params[k], layout_counters, + k + VERTEX_SHADER_EXT_OUT, glslc_path) + generate_shader(v[1], shader_dir, generation_dir, shaders_library, k, program_params[k], layout_counters, + k + FRAG_SHADER_EXT_OUT, glslc_path) diff --git a/tools/unix/generate_vulkan_shaders.sh b/tools/unix/generate_vulkan_shaders.sh new file mode 100755 index 0000000000..4e3ff7d0ab --- /dev/null +++ b/tools/unix/generate_vulkan_shaders.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e -u + +# Prevent python from generating compiled *.pyc files +export PYTHONDONTWRITEBYTECODE=1 + +DEBUG="${1:-empty}" + +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized + +source "$MY_PATH/../autobuild/ndk_helper.sh" +export NDK_ROOT=$(GetNdkRoot) || ( echo "Can't read NDK root path from android/local.properties"; exit 1 ) +GLSLC_PATH="$NDK_ROOT/shader-tools/darwin-x86_64/glslc" + +OMIM_PATH="${OMIM_PATH:-$(cd "$(dirname "$0")/../.."; pwd)}" +SHADERS_GENERATOR="$OMIM_PATH/shaders/vulkan_shaders_preprocessor.py" + +python "$SHADERS_GENERATOR" "$OMIM_PATH/shaders/GL" shader_index.txt programs.hpp program_params.hpp shaders_lib.glsl "$OMIM_PATH/data/vulkan_shaders" "$GLSLC_PATH" "$DEBUG"