Giter Site home page Giter Site logo

Comments (14)

theWatchmen avatar theWatchmen commented on September 27, 2024 2

@beaumanvienna Thanks for your comment and the help! I'll make a note to add a better failure message if the compiler path is invalid.

@bkolligs We get the swapchain format from the supported formats exposed by the driver, but maybe there is a mismatch with the format we use for the ImGui pass. I'll double check.

Thanks for reporting the issue!

from mastering-graphics-programming-with-vulkan.

theWatchmen avatar theWatchmen commented on September 27, 2024 2

I think I found the problem with at least chapter 2 and 3: we compile the shaders through CMake (rather than at runtime as we do for other chapters). I added a check to make sure the compiler path is valid. For the other chapters, failing to find the compiler executable should already result in an error message.

Still looking into the swapchain format issue :)

from mastering-graphics-programming-with-vulkan.

beaumanvienna avatar beaumanvienna commented on September 27, 2024 1

@bkolligs Hi Ben, I'm running into the same issue on Zorin.

"vkCreateShaderModule: parameter pCreateInfo->codeSize / 4 must be greater than 0."
It didn't compile the shader. When I save the GLSL code you posted above in a file vertex.vert and compile it, it works.
--> Most likely it doesn't find the compiler. I haven't set the bash variables yet. Did you?

export VULKAN_SDK=~/vulkan/1.2.198.1/x86_64
export PATH=$VULKAN_SDK/bin:$PATH
export LD_LIBRARY_PATH=$VULKAN_SDK/lib:$LD_LIBRARY_PATH
export VK_LAYER_PATH=$VULKAN_SDK/etc/vulkan/explicit_layer.d

Check out this line:

char* glsl_compiler_path = temp_string_buffer.append_use_f( "%sglslangValidator", vulkan_binaries_path );

I have on my system:
~/dev/book >>> which glslangValidator
/usr/bin/glslangValidator
^^^
"/usr" should be VULKAN_SDK

see also "gpu_device.cpp", line 615


char* compiler_path = string_buffer.append_use_f( "%s/bin/", vulkan_env );

So with "export VULKAN_SDK=/usr", and
"./build/source/chapter1/Chapter1 ./deps/src/glTF-Sample-Models/2.0/BarramundiFish/glTF/BarramundiFish.gltf",
and a scale of 100, I get

image

On a side note, I also had to change "SDL2::SDL2" to "${SDL2_LIBRARIES}" in the CMakeLists.txt files in all 15 chapters.

from mastering-graphics-programming-with-vulkan.

beaumanvienna avatar beaumanvienna commented on September 27, 2024 1

@beaumanvienna Thanks for your comment and the help! I'll make a note to add a better failure message if the compiler path is invalid.

Thanks for reporting the issue!

You're welcome! Maybe change it to shaderc altogether?
I noticed one more thing, I believe you have the -j4 for MAKEFLAGS still with a space in between the j and the 4. Did you try to fix it in the errata? (see also my edit below, the space is Ok, which renders the errata unnecessary)

https://github.com/PacktPublishing/Mastering-Graphics-Programming-with-Vulkan#linux
and here
https://github.com/PacktPublishing/Mastering-Graphics-Programming-with-Vulkan#errata

EDIT: Wait, it does work with the space in between j and 4. I think you can remove the errata entirely then.

time cmake --build build --target Chapter1 -- -j16 --> 43.25s user 1.96s system 509% cpu 8.880 total
(the linking stages are single thread, hence the CPU usage does not go up 16x)
time cmake --build build --target Chapter1 -- -j 16 --> 42.77s user 1.94s system 499% cpu 8.955 total
time cmake --build build --target Chapter1 -- -j 2 --> 34.04s user 1.56s system 186% cpu 19.128 total

I looked this up in the cmake documentation, the space is allowed

from mastering-graphics-programming-with-vulkan.

theWatchmen avatar theWatchmen commented on September 27, 2024 1

@bkolligs I had a better look at the code for the swapchain and render pass format, and it looks correct. If we fail to find a format we want though I think we don't populate one of the structures correctly. Could you try and apply this patch?

diff --git a/source/chapter2/graphics/gpu_device.cpp b/source/chapter2/graphics/gpu_device.cpp
index 21e79d1..64e0e80 100644
--- a/source/chapter2/graphics/gpu_device.cpp
+++ b/source/chapter2/graphics/gpu_device.cpp
@@ -506,7 +506,6 @@ void GpuDevice::init( const DeviceCreation& creation ) {
         for ( u32 j = 0; j < supported_count; j++ ) {
             if ( supported_formats[ j ].format == surface_image_formats[ i ] && supported_formats[ j ].colorSpace == surface_color_space ) {
                 vulkan_surface_format = supported_formats[ j ];
-                swapchain_output.color( surface_image_formats[ j ] );
                 format_found = true;
                 break;
             }
@@ -523,6 +522,8 @@ void GpuDevice::init( const DeviceCreation& creation ) {
     }
     rfree( supported_formats, allocator );
 
+    swapchain_output.color( vulkan_surface_format.format );
+
     set_present_mode( present_mode );
 
     //////// Create swapchain

If you haven't done this before, copy this text into a file called (say) a.patch in the root folder of this repo, then run git apply a.patch. If you still get the validation error, could you check which formats are being used here and here?

@beaumanvienna The errata is to fix the typo for chapter1 -> Chapter1, not the cmake flags :)

from mastering-graphics-programming-with-vulkan.

beaumanvienna avatar beaumanvienna commented on September 27, 2024 1

I got your book in the meantime :-) Thank you, Sir! On a side note: https://www.youtube.com/@beaumanvienna6844
I just finished skeletal animation with gltf and multiple animations, a new video is in the making ...

from mastering-graphics-programming-with-vulkan.

bkolligs avatar bkolligs commented on September 27, 2024

I am on Ubuntu 22. What version of Vulkan are you using @beaumanvienna ? I am using version 1.3.261. I am getting Imgui render pass issues now, despite the window opening.

 MessageID: VUID-vkCmdDrawIndexed-renderPass-02684 -1934215230
Message: Validation Error: [ VUID-vkCmdDrawIndexed-renderPass-02684 ] Object 0: handle = 0xcb1c7c000000001b, name = Swapchain, type = VK_OBJECT_TYPE_RENDER_PASS; Object 1: handle = 0x2e2cd000000002b, name = Pipeline_ImGui, type = VK_OBJECT_TYPE_RENDER_PASS; | MessageID = 0x8cb637c2 | vkCmdDrawIndexed: RenderPasses incompatible between active render pass w/ VkRenderPass 0xcb1c7c000000001b[Swapchain] and pipeline state object w/ VkRenderPass 0x2e2cd000000002b[Pipeline_ImGui] Attachment 0 is not compatible with 0: They have different formats.. The Vulkan spec states: The current render pass must be compatible with the renderPass member of the VkGraphicsPipelineCreateInfo structure specified when creating the VkPipeline bound to VK_PIPELINE_BIND_POINT_GRAPHICS (https://vulkan.lunarg.com/doc/view/1.3.261.0/linux/1.3-extensions/vkspec.html#VUID-vkCmdDrawIndexed-renderPass-02684)

 MessageID: VUID-vkCmdDrawIndexed-renderPass-02684 -1934215230
Message: Validation Error: [ VUID-vkCmdDrawIndexed-renderPass-02684 ] Object 0: handle = 0xcb1c7c000000001b, name = Swapchain, type = VK_OBJECT_TYPE_RENDER_PASS; Object 1: handle = 0x2e2cd000000002b, name = Pipeline_ImGui, type = VK_OBJECT_TYPE_RENDER_PASS; | MessageID = 0x8cb637c2 | vkCmdDrawIndexed: RenderPasses incompatible between active render pass w/ VkRenderPass 0xcb1c7c000000001b[Swapchain] and pipeline state object w/ VkRenderPass 0x2e2cd000000002b[Pipeline_ImGui] Attachment 0 is not compatible with 0: They have different formats.. The Vulkan spec states: The current render pass must be compatible with the renderPass member of the VkGraphicsPipelineCreateInfo structure specified when creating the VkPipeline bound to VK_PIPELINE_BIND_POINT_GRAPHICS (https://vulkan.lunarg.com/doc/view/1.3.261.0/linux/1.3-extensions/vkspec.html#VUID-vkCmdDrawIndexed-renderPass-02684)

 MessageID: VUID-vkCmdDrawIndexed-renderPass-02684 -1934215230
Message: Validation Error: [ VUID-vkCmdDrawIndexed-renderPass-02684 ] Object 0: handle = 0xcb1c7c000000001b, name = Swapchain, type = VK_OBJECT_TYPE_RENDER_PASS; Object 1: handle = 0x2e2cd000000002b, name = Pipeline_ImGui, type = VK_OBJECT_TYPE_RENDER_PASS; | MessageID = 0x8cb637c2 | vkCmdDrawIndexed: RenderPasses incompatible between active render pass w/ VkRenderPass 0xcb1c7c000000001b[Swapchain] and pipeline state object w/ VkRenderPass 0x2e2cd000000002b[Pipeline_ImGui] Attachment 0 is not compatible with 0: They have different formats.. The Vulkan spec states: The current render pass must be compatible with the renderPass member of the VkGraphicsPipelineCreateInfo structure specified when creating the VkPipeline bound to VK_PIPELINE_BIND_POINT_GRAPHICS (https://vulkan.lunarg.com/doc/view/1.3.261.0/linux/1.3-extensions/vkspec.html#VUID-vkCmdDrawIndexed-renderPass-02684)

 MessageID: VUID-vkCmdDrawIndexed-renderPass-02684 -1934215230
Message: Validation Error: [ VUID-vkCmdDrawIndexed-renderPass-02684 ] Object 0: handle = 0xcb1c7c000000001b, name = Swapchain, type = VK_OBJECT_TYPE_RENDER_PASS; Object 1: handle = 0x2e2cd000000002b, name = Pipeline_ImGui, type = VK_OBJECT_TYPE_RENDER_PASS; | MessageID = 0x8cb637c2 | vkCmdDrawIndexed: RenderPasses incompatible between active render pass w/ VkRenderPass 0xcb1c7c000000001b[Swapchain] and pipeline state object w/ VkRenderPass 0x2e2cd000000002b[Pipeline_ImGui] Attachment 0 is not compatible with 0: They have different formats.. The Vulkan spec states: The current render pass must be compatible with the renderPass member of the VkGraphicsPipelineCreateInfo structure specified when creating the VkPipeline bound to VK_PIPELINE_BIND_POINT_GRAPHICS (https://vulkan.lunarg.com/doc/view/1.3.261.0/linux/1.3-extensions/vkspec.html#VUID-vkCmdDrawIndexed-renderPass-02684)

from mastering-graphics-programming-with-vulkan.

bkolligs avatar bkolligs commented on September 27, 2024

Tried using Vulkan 1.2.198 instead and I get the same render pass error

from mastering-graphics-programming-with-vulkan.

bkolligs avatar bkolligs commented on September 27, 2024

Despite the render pass error, it still renders the geometry so I'll close this.

from mastering-graphics-programming-with-vulkan.

bkolligs avatar bkolligs commented on September 27, 2024

I will reopen so you can track the swap chain issue

from mastering-graphics-programming-with-vulkan.

charlie-ht avatar charlie-ht commented on September 27, 2024

@theWatchmen I can confirm your patch fixes,

 MessageID: VUID-vkCmdDrawIndexed-renderPass-02684 -1934215230
Message: Validation Error: [ VUID-vkCmdDrawIndexed-renderPass-02684 ] Object 0: handle = 0x1c000000001c, name = Swapchain, type = VK_OBJECT_TYPE_RENDER_PASS; Object 1: handle = 0x2c000000002c, name = Pipeline_ImGui, type = VK_OBJECT_TYPE_RENDER_PASS; | MessageID = 0x8cb637c2 | vkCmdDrawIndexed: RenderPasses incompatible between active render pass w/ VkRenderPass 0x1c000000001c[Swapchain] and pipeline state object w/ VkRenderPass 0x2c000000002c[Pipeline_ImGui] Attachment 0 is not compatible with 0: They have different formats.. The Vulkan spec states: The current render pass must be compatible with the renderPass member of the VkGraphicsPipelineCreateInfo structure specified when creating the VkPipeline bound to VK_PIPELINE_BIND_POINT_GRAPHICS (https://vulkan.lunarg.com/doc/view/1.3.261.1/linux/1.3-extensions/vkspec.html#VUID-vkCmdDrawIndexed-renderPass-02684)

when running the Sponza model.

I needed this for chapter 1 too (not got to chapter 2 yet). I tested with an AMD Radeon RX 6600, using SDK 1.3.261.1

from mastering-graphics-programming-with-vulkan.

bkolligs avatar bkolligs commented on September 27, 2024

@theWatchmen after applying the patch I am able to run chapter 1! Thanks.

from mastering-graphics-programming-with-vulkan.

theWatchmen avatar theWatchmen commented on September 27, 2024

I have now applied the fix to all chapters :) I'll leave this open for a few days just in case.

from mastering-graphics-programming-with-vulkan.

theWatchmen avatar theWatchmen commented on September 27, 2024

Closing this as it should be solved.

from mastering-graphics-programming-with-vulkan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.