Jump to content
  • Advertisement
Sign in to follow this  
Hassanbasil

Vulkan Allow sloppiness in pipeline

This topic is 749 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

 

I've been porting my Direct3D code to Vulkan for a while now, and I found a few things rather annoying with Vulkan. What I'm trying to do is to use a single pipeline (single vertex shader) to allow rendering both animated and non-animated objects. I use two vertex buffers, one for pos/uv/norm/tang attributes and one for per-vertex animation data. The problem is that, when I make the pipeline to match my shader (which expects the second buffer to fill in some bound attributes), it crashes the driver if I don't bind the second buffer. So I tried to bind the same first vertex shader twice (data is irrelevant since I'm telling the shader not to use it via a UBO). Binding a dummy buffer works, but turns out it is very expensive (when rendering 5k+ objects, I get 50%+ performance loss). Is making two pipelines my only option? Is there a way to make it a bit more sloppy and allow incomplete input? I'm no expert in those things - but it seems like Vulkan could really just ignore filling in the attributes, since it already knows the stride of the entire vertex.

 

 

Thanks and regards,

Hasan Al-Jawaheri

 

Share this post


Link to post
Share on other sites
Advertisement
The whole point of Vulkan and D3D12 is that they don't fix any of your errors, so your code must always be perfectly correct.
In older APIs, the runtime /driver will always fix up sloppy code to avoid crashing the GPU, but now that's your job.

Share this post


Link to post
Share on other sites

Is making two pipelines my only option?

 

I just know enough to agree building all those pipelines is annoying, but 2 things:

 

I think you can serialize them to disk somehow, so those billion lines of setup code don't need to be in your shipping product.

You can make utility code to shrink the ammont of setup code (but personally i've had not much success with this yet...)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!