Skip to content

Rewrite of the graphics and present queue index determination#93

Closed
asuessenbach wants to merge 1 commit intoKhronosGroup:mainfrom
asuessenbach:05_window_surface
Closed

Rewrite of the graphics and present queue index determination#93
asuessenbach wants to merge 1 commit intoKhronosGroup:mainfrom
asuessenbach:05_window_surface

Conversation

@asuessenbach
Copy link
Copy Markdown
Contributor

I think, this code better shows the logic followed here, to determine the two queue indices.

If it looks good, I can again carry that over to all the other chapters.

@gpx1000
Copy link
Copy Markdown
Contributor

gpx1000 commented Jul 9, 2025 via email

@SaschaWillems
Copy link
Copy Markdown
Collaborator

Code change looks good, but does the tutorial support different graphics and present queue family indices? If not, what will happen on configurations where both differ? Does the tutorial account for that (e.g. sync)?

@asuessenbach
Copy link
Copy Markdown
Contributor Author

but does the tutorial support different graphics and present queue family indices?

Don't know. I just reformulated what was already there: if there's no queue that supports both graphics and present, determine separate queues.
If the tutorial does not support separate queues, we should skip the second part.

@asuessenbach
Copy link
Copy Markdown
Contributor Author

Any idea on how to resolve the windows build?
Cannot find path 'C:\VulkanSDK' because it does not exist.??

@gpx1000
Copy link
Copy Markdown
Contributor

gpx1000 commented Jul 11, 2025

I'm trying to figure it out right now. Maybe we need to merge the latest from master? Just a guess, I'm actively looking at it to see if there's a solution for what went wrong.

@gpx1000
Copy link
Copy Markdown
Contributor

gpx1000 commented Jul 15, 2025

If you can merge the latest from master, it should hopefully clear up the CI windows build.

@asuessenbach
Copy link
Copy Markdown
Contributor Author

asuessenbach commented Jul 16, 2025

If you can merge the latest from master, it should hopefully clear up the CI windows build.

I'd be happy to do so.
Unfortunately, I have some issue to rebase from main:
In attachments/CMake (https://github.com/KhronosGroup/Vulkan-Tutorial/tree/main/attachments/CMake), there are two files named FindTinyGLTF.cmake and Findtinygltf.cmake.
Now Windows is by default case insensitive.
That is, I'm ending up with just FindTinyGLTF.cmake on my disk, and git constantly complains about Findtinygltf.cmake being changed.

Do you actually need both of those files? Or could you remove one of them?

@gpx1000
Copy link
Copy Markdown
Contributor

gpx1000 commented Jul 16, 2025

Not sure when that got changed. you only need one of them. On platforms that are case sensitive it must match what's called by find_program* In this case find_package (TinyGLTF REQUIRED) So, should nuke tinygltf. I'm making a PR for you right now.

@gpx1000
Copy link
Copy Markdown
Contributor

gpx1000 commented Jul 20, 2025

Okay, go ahead and grab the latest, All CI is now working in Main.

@asuessenbach
Copy link
Copy Markdown
Contributor Author

Ok, the issue with the Findtinygltf.cmake is gone.

But I still can't get a solution out of CMake.
First I had this error:

CMake Error at CMake/Findtinygltf.cmake:80 (file):
  file failed to create symbolic link
  'C:/git/Vulkan-Tutorial/attachments/build/VS2022_64/_deps/tinygltf-src/nlohmann/json.hpp':
  A required privilege is not held by the client.

Which I could resolve by allowing Authenticated Users to create symbolic links. But I doubt that you should require that from any Tutorial user.

Next I have this error:

CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find KTX (missing: KTX_INCLUDE_DIR KTX_LIBRARY)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  CMake/FindKTX.cmake:55 (find_package_handle_standard_args)
  C:/git/vcpkg/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
  CMakeLists.txt:15 (find_package)

And I don't know how to resolve that.
Any hint would be very much appreciated.

@SaschaWillems
Copy link
Copy Markdown
Collaborator

On windows you have to use the vcpkg toolchain, which feels a bit odd. E.g. I haven't found out how to do that with the cmake-gui.

Easiest way is running install_dependencies_windows.bat to install all dependencies via vcpkg and the run cmake at command line with the location where you installed/downloaded vcpkg, e.g.:

cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=V:\github\vcpkg\scripts\buildsystems\vcpkg.cmake

@asuessenbach
Copy link
Copy Markdown
Contributor Author

Even running scripts\install_dependencies_windows.bat is failing:

C:\git\Vulkan-Tutorial>scripts\install_dependencies_windows.bat
Installing dependencies for Vulkan Tutorial...
Enabling binary caching for vcpkg...
Installing all dependencies...
Detecting compiler hash for triplet x64-windows...
Compiler found: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe
The following packages will be built and installed:
    ktx:x64-windows@4.3.2
    nlohmann-json:x64-windows@3.11.3#1
    stb:x64-windows@2024-07-29#1
    tinygltf:x64-windows@2.9.3
    tinyobjloader:x64-windows@2.0.0rc13
Restored 0 package(s) from C:\Users\ASUESS~1\AppData\Local\Temp\vcpkg-cache in 276 us. Use --debug to see more details.
Installing 1/5 ktx:x64-windows@4.3.2...
Building ktx:x64-windows@4.3.2...
-- Using cached KhronosGroup-KTX-Software-v4.3.2.tar.gz.
-- Cleaning sources at C:/git/vcpkg/buildtrees/ktx/src/v4.3.2-8d9e3937e6.clean. Use --editable to skip cleaning for the packages you specify.
-- Extracting source C:/git/vcpkg/downloads/KhronosGroup-KTX-Software-v4.3.2.tar.gz
-- Applying patch 0001-Use-vcpkg-zstd.patch
-- Applying patch 0002-Fix-versioning.patch
-- Applying patch 0003-mkversion.patch
-- Applying patch 0004-quirks.patch
-- Applying patch 0005-no-vendored-libs.patch
-- Applying patch 0006-fix-ios-install.patch
-- Using source at C:/git/vcpkg/buildtrees/ktx/src/v4.3.2-8d9e3937e6.clean
-- Downloading https://mirror.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst;https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst;https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst;https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst;https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst;https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst -> util-linux-2.35.2-3-x86_64.pkg.tar.zst...
[DEBUG] To include the environment variables in debug output, pass --debug-env
[DEBUG] Trying to load bundleconfig from C:\git\vcpkg\vcpkg-bundle.json
[DEBUG] Failed to open: C:\git\vcpkg\vcpkg-bundle.json
[DEBUG] Bundle config: readonly=false, usegitregistry=false, embeddedsha=nullopt, deployment=Git, vsversion=nullopt
[DEBUG] Metrics enabled.
[DEBUG] Feature flag 'binarycaching' unset
[DEBUG] Feature flag 'compilertracking' unset
[DEBUG] Feature flag 'registries' unset
[DEBUG] Feature flag 'versions' unset
[DEBUG] Feature flag 'dependencygraph' unset
error: Missing util-linux-2.35.2-3-x86_64.pkg.tar.zst and downloads are blocked by x-block-origin.
error: https://mirror.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst: failed: status code 404
error: https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst: failed: status code 404
error: https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst: failed: status code 404
error: https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst: failed: status code 404
error: https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst: failed: status code 404
error: https://repo.msys2.org/msys/x86_64/util-linux-2.35.2-3-x86_64.pkg.tar.zst: failed: status code 404
[DEBUG] D:\a\_work\1\s\src\vcpkg\base\downloads.cpp(1030):
[DEBUG] Time in subprocesses: 0us
[DEBUG] Time in parsing JSON: 9us
[DEBUG] Time in JSON reader: 0us
[DEBUG] Time in filesystem: 3110us
[DEBUG] Time in loading ports: 0us
[DEBUG] Exiting after 499 ms (480263us)

CMake Error at scripts/cmake/vcpkg_download_distfile.cmake:32 (message):

      Failed to download file with error: 1
      If you are using a proxy, please check your proxy setting. Possible causes are:

      1. You are actually using an HTTP proxy, but setting HTTPS_PROXY variable
         to `https://address:port`. This is not correct, because `https://` prefix
         claims the proxy is an HTTPS proxy, while your proxy (v2ray, shadowsocksr
         , etc..) is an HTTP proxy. Try setting `http://address:port` to both
         HTTP_PROXY and HTTPS_PROXY instead.

      2. If you are using Windows, vcpkg will automatically use your Windows IE Proxy Settings
         set by your proxy software. See https://github.com/microsoft/vcpkg-tool/pull/77
         The value set by your proxy might be wrong, or have same `https://` prefix issue.

      3. Your proxy's remote server is out of service.

      If you've tried directly download the link, and believe this is not a temporary
      download server failure, please submit an issue at https://github.com/Microsoft/vcpkg/issues
      to report this upstream download server failure.


Call Stack (most recent call first):
  scripts/cmake/vcpkg_download_distfile.cmake:270 (z_vcpkg_download_distfile_show_proxy_and_fail)
  scripts/cmake/vcpkg_acquire_msys.cmake:25 (vcpkg_download_distfile)
  scripts/cmake/vcpkg_acquire_msys.cmake:124 (z_vcpkg_acquire_msys_download_package)
  scripts/cmake/vcpkg_acquire_msys.cmake:212 (z_vcpkg_acquire_msys_download_packages)
  ports/ktx/portfile.cmake:19 (vcpkg_acquire_msys)
  scripts/ports.cmake:192 (include)


error: building ktx:x64-windows failed with: BUILD_FAILED
See https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli for more information.
Elapsed time to handle ktx:x64-windows: 5.3 s
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+ktx
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[ktx]+Build+error+on+x64-windows&body=Copy+issue+body+from+C%3A%2Finstalled%2Fvcpkg%2Fissue_body.md
You can also submit an issue by running (GitHub CLI must be installed):
  gh issue create -R microsoft/vcpkg --title "[ktx] Build failure on x64-windows" --body-file C:/installed/vcpkg/issue_body.md

Don't forget to install the Vulkan SDK from https://vulkan.lunarg.com/

All dependencies have been installed successfully!
You can now use CMake to build your Vulkan project.

Example CMake command:
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=[path\to\vcpkg]\scripts\buildsystems\vcpkg.cmake
cmake --build build

Does that tell you anything?

@gpx1000
Copy link
Copy Markdown
Contributor

gpx1000 commented Jul 21, 2025

It looks like vcpkg is unhappy about not being able to resolve where a repository lives. This is the first time I've really tried to use vcpkg in a non-toy setting; so, not sure about the best way to solve this. Basically, I know vcpkg is the microsoft blessed method of providing the packagaing service other more "modern" OSes get out of the box ;-) (Yep, I'm more into Linux than Windows).

@asuessenbach
Copy link
Copy Markdown
Contributor Author

Ok, pulling and bootstrapping vcpkg again resolved the issue with install_dependencies_windows.bat. That batch now runs successfully.

But I still can't generate a VS solution, something seems to be wrong with KTX:

C:\git\Vulkan-Tutorial\attachments>cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=C:\git\vcpkg\scripts\buildsystems\vcpkg.cmake
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- vulkan_libraryC:/VulkanSDK/1.4.304.0/Lib/vulkan-1.libsearchpathsC:\VulkanSDK\1.4.304.0/libC:\VulkanSDK\1.4.304.0/bin
-- nlohmann_json not found, fetching from GitHub...
CMake Deprecation Warning at build/_deps/nlohmann_json-src/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- Using the multi-header code from C:/git/Vulkan-Tutorial/attachments/build/_deps/nlohmann_json-src/include/
-- tinygltf not found, fetching from GitHub...
CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find KTX (missing: KTX_LIBRARY)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:603 (_FPHSA_FAILURE_MESSAGE)
  CMake/FindKTX.cmake:55 (find_package_handle_standard_args)
  C:/git/vcpkg/scripts/buildsystems/vcpkg.cmake:896 (_find_package)
  CMakeLists.txt:15 (find_package)


-- Configuring incomplete, errors occurred!

Or is there something with nlohmann_json or tinygltf, which are never found and always fetched again from GitHub.?
Any idea how to figure out the actual problem?

@SaschaWillems
Copy link
Copy Markdown
Collaborator

SaschaWillems commented Jul 22, 2025

I initially had the exact same issue. For whatever reason the build did pick up a wrong version of those libraries I had installed earlier on. Make sure to clean the CMake cache.

If that doesn't help, remove any manual installation of those libs (e.g. via the Vulkan SDK) and do clean vcpkg setup to get rid of those errors. cache.

@asuessenbach
Copy link
Copy Markdown
Contributor Author

Make sure to clean the CMake cache.

That didn't help

remove any manual installation of those libs

The only ktx installation I can find is the one in Vulkan-Samples/third_party. Could that be the culprit?

@gpx1000
Copy link
Copy Markdown
Contributor

gpx1000 commented Jul 22, 2025

I think we're getting into the fetch_content world of cmake not being helpful; usually it just works great. But every once in a while, things like this happen. It's one of the reasons I'm more of a fan of git submodules when working in projects like this.
Well as we are already here with fetch_content, let's see if we can't get it to work for you. Make sure to delete your build folder so cmake realizes it needs to do the configuration step again. Then, make sure to run the config step:
mkdir build && cd build
cmake ..

That should take a bit, you should see ktx, gltf or any other package the package manager vcpkg can't find populate and build in a temporary folder under build. When that step completes, go ahead and open the project and build.

usually that makes fetch_content behave. If this proves to be a headache, I might start moving the project to git submodules so everyone has the same thing and maybe only use vcpkg in windows for the simpler, more standard packages.

@asuessenbach
Copy link
Copy Markdown
Contributor Author

asuessenbach commented Jul 22, 2025

you should see ktx, gltf or any other package the package manager vcpkg can't find populate and build in a temporary folder under build

In attachments\build\_deps I see six subfolders: nlohmann_json-build, nlohmann_json-src, nlohmann_json-subbuild, tinygltf-build, tinygltf-src, and tinygltf-subbuild. No KTX whatsoever.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants