Blender Vulkan - Status report

Thanks for the clarification - I was indeed in error, and I should have said Open CL. Apologies for the confusion. @LazyDodo - thanks for the correction. I obviously need to do more homework :slight_smile:

OpenCL was a cycles backend, what is being discussed here is a vulkan backend for the UI/EEVEE/WorkBench engines, having support there will not add any vulkan support to cycles.

1 Like

So - In short, I won’t be able to use my Iris-Xe to accelerate Cycles renders at all.
Bummer.

Not by the work being talked about here indeed.

1 Like

Last half year more time was spent on the Vulkan project then originally anticipated. I will outline the approach we followed, what the current state is and known future quirks and bottlenecks.

Approach

Past milestones

  1. being able to cross compile shaders between OpenGL, Metal and Vulkan. [Goal reached December 2022]

  2. being able to run compute shaders test cases. [Goal reached February 2023]

  3. memory and buffer management [Goal reached March 2023]

  4. being able to start Blender (no viewport) [Goal reached May 2023]

  5. Most of workbench working [Goal reached May 2023]

Current milestones

  1. Make sure that other renderengines are able to draw something. Might still have many artifacts, but at least you would be able to see something.
  • Workbench-next, Eevee-next, Overlay-next, Grease Pencil, Cycles Viewport, Image engine

Future milestones

After everything can be seen, more time will be spent on adding support for ‘all’ platforms and improving the performance.

Current development is mostly done on discrete GPUs. On a weekly basis I switch between NVIDIA, AMD and Intel GPUs, to make sure that we don’t implement something that cannot be done on another brand of GPUs. This is mostly done on Linux. Of course the Blender community is sending in patches when something is not working on Windows. There are many configurations not working and they should be checked how we can get them fixed.

Vulkan can deliver excellent performance in a gaming pipeline, Blender isn’t a game and therefore isn’t (and cannot) be organized in a similar way as games. For now the performance is only around 5-10% of what I expect the final version will be. Mostly because I have been very conservative when sending commands to the GPU. When commands are schedule the backend will wait until that command is send to the GPU, then it waits until the GPU has finished the command, before scheduling of the next command can start. Vulkan can speed up when sending in multiple commands in a single go, and add barriers between commands that write to a resource, where the resource is being read by another command.

Until now we didn’t implement any performance improvements as most documentation on the internet is about gaming pipelines where developers have more control overthe full pipeline. We have to find our own path how to solve this. This path is getting clearer with each commit we make. Current idea is to have a custom command encoding that will send the commands and barriers at certain moments.

Potential Risks

Timeline

The initial plan is to have a usable experimental backend that can be downloaded and used to collect feedback at the end of 2023. Depending on initial feedback it might even be available in an official release. This means that we would not recommend to use it as the default backend yet.

There are still a lot of tasks that needs to be implemented in the upcoming period; however I have been asked to help with Eevee-next and that might shift the planning 1 or 2 months and that adds pressure to the original planning. It is currently unclear what the impact of this priority change has on the Vulkan Project.

Supporting data types

During the course of the project there has been quite a few gotchas. One of them are if a GPU support a certain data type (GPU_RGB16) and usage (Framebuffer attachment), it can be that the platform would return an error that that the combination isn’t supported. In order to continue we sometimes need to reconfigure those buffers so we don’t need to transform the content of the buffer all the time.

Inside Blender we have more control over the actual buffer data and can update the original data or even phase out problematic data types, but this isn’t always possible. Blender Python API allows add-on developers still to create those buffers. The vulkan backend currently detects invalid usages and tries to transform the data to a compatible format when uploading the data to the GPU.

It is unclear if during the project we will need to implement more work-arounds to ensure that ‘most’ used data-type/usage combinations would be working from an add-on developer point of view.

Final note

A huge thanks to the community developers for lending a hand, providing patches and sharing knowledge. The implementation has been changed based on what we have heard back from you!

During the Blender Conference I will also share more information about the project and go more into the details of Vulkan.

63 Likes

Last week a big milestone has been reached. The vulkan backend has been enabled
as an experimental
option. It will be available in alpha builds on Linux and Windows.

This option is highly experimental and enabled to get some insight
on platform support. Don’t expect a fully working Blender
yet. Also don’t expect it to have usable performance.

What is known to not work?

  • OCIO textures are not supported on Intel and AMD GPUs. sRGB/Standard is supported
    on those platforms.
  • AMD Polaris based GPUs on Linux will generate a crash when drawing the 3d cursor as it
    doesn’t support the needed vertex format. Comment out DRW_draw_cursor in DRW_draw_region_info.
  • The colors in the node editor and sequencer are of as sRGB viewports aren’t detected correctly.
  • The image / UV editor isn’t working as many texture formats haven’t been tested yet. Some
    tweaks are also needed to do correct depth testing.
  • 3D Viewport is known to be flickering. Sometimes workbench doesn’t display anything.
  • 3D Viewport wireframe will crash as it uses a framebuffer with gaps between color attachments,
    which isn’t supported yet. (#113141 - Vulkan: Support for Framebuffer with Missing Attachments - blender - Blender Projects)
  • Rotate the view widget is partially drawn due to incompatible depth clipping.
  • GPU Selection isn’t working. It is expected to be solved when Overlay-Next will become the
    default engine. For now disable GPU depth picking in the preferences.
  • Cycles/EEVEE are known to not work with Vulkan yet. Cycles requires Vulkan Pixel Buffer.
    Cuda ↔ Vulkan interop might require a different approach than OpenGL as Vulkan doesn’t allow
    importing memory from a Cuda context. EEVEE uses features that aren’t available yet in the backend
  • Workbench is working, except Workbench shadows.
  • EEVEE-Next basics are working. Shadows, lights are known to be not working. Materials/Shading
    works on a single object. Changes are expected in EEVEE-Next that will break Vulkan compatibility
    in the near future.
  • Systems with multiple GPUs is not working.
  • Wayland support is in review and should land before this PR (#113007 - Vulkan: Wayland Windowing - blender - Blender Projects)
  • OpenXR hasn’t been modified and is expected to fail.
  • The backend is very strict when mis-using the GPU module. In debug builds it may crash
    on asserts.
  • Older drivers/GPUs might not have all the features that we require. The workarounds
    for the missing features still need to be implemented.

A word about performance

In the project planning we focus first on stability and platform support. The performance of Vulkan is
around 20% of what we want to achieve. The reason is that each command sent to the
GPU is done one at a time. The implementation even waits until we have feedback that the GPU
is idle again.

Geometry is currently stored in System RAM. The GPU will read and cache the data when
accessing geometry. This slows down when using objects with much geometry.
Some performance features like MDI (Multi-Draw-Indirect) hasn’t been implemented and
falls back to Single Draw Indirect.

Why enable it is an experimental option?

  • Ensures that new features are being tested with Vulkan
  • Ensure that building with Vulkan is possible on supported platforms
  • Give feedback from developers if Vulkan can run on their system or that
    there are special cases that we are not aware of. Main development
    environment has been Linux/X11 with occasionally testing using Windows.
  • Validate Add-ons that use the gpu module.
  • Possible to enable GLSL validation on the buildbot. (Needs more work).
  • Does it compile on all machines or does it require more changes to cmake
    config.

How can the backend be enabled?

Currently the Vulkan backend can be enabled per Blender session by starting
with the command line argument --gpu-backend vulkan. In the future, after
the backend is proven to work, we will add a user preference to switch between
OpenGL and Vulkan.

How can you help?

  • Download the latest alpha build or compile it your self. The windows build seems to be not available at this time on the buildbot.
  • Start blender with blender --factory-startup --gpu-backend vulkan.
  • Does it start? Great! You can click around but expect missing features and drawing artifacts.
  • It crashes on startup? No so great report a bug! I am open to fix crashes on startup.
  • It shows a message that the GPU isn’t capable of running Blender, but I have a Vulkan 1.2 capable system? get in contact with me at Blender Chat We will keep track of platforms that should be supported and find out if more workarounds are needed.
27 Likes

Quick question: Is it expected that blender 3D viewport will run faster (More FPS, less lag, etc.), when Vulkan is fully implemented?

That depends on other stuff. GPU drawing isn’t the main bottleneck in animation playback. So there might not be a noticeable speed increase there. Improved performance isn’t the reason why we switch to Vulkan, but there might (and are) areas where we could make our drawing code more Vulkan compliant and it might improve the performance a bit. Although that will be done by regular development, and not part of this project.

The goal of the Vulkan backend is to be at least on par with OpenGL performance. Which would already by a huge achievement.

2 Likes

Hi @Jeroen-Bakker, where can I read about what the benefits of Vulkan are over OpenGL. I’d like to know why this change is being made, and what its usefulness will be in the future.

See first message in this post for the initial reasoning. As for future developments. OpenGL standard isn’t developed anymore so there is no future there :slight_smile: modern GPU features like Hardware ray tracing, mesh shaders and others would therefore not be accessible when using OpenGL, but would on Vulkan. This list of GPU features are growing with each driver update.

And yes perhaps those features will enable additional performance. But requires a different project.

The vulkan project builds the road, but other projects would be building the cars and trucks that drive over the road.

17 Likes

Question:

In Eevee until a few versions of Blender ago, there was a limit of (Unique) textures of 24, beyond which the material became Pink, I knew this limit, now it seems to no longer exist, or at least not at 24.

The same happened in Macintosh, where the maximum number of textures was even lower (But I don’t remember the exact number)

Can you understand the new limit? I suppose that even on the Macintosh this limit was raised with the introduction of Vulkan.

It would be great to get clarification if you can.

Thank you very much for the work you do :blush:

As I remember this patch (found the patch) for the Mac versions of Blender the increase in textures number happened a little after the Apple devs came on board. The change happened with a patch to Blender and a patch to MacOS itself (11.1 and newer). I’m pretty sure users had to upgrade to the latest version of MacOS at the time along with the latest version of Blender to notice the changes.
But yes it was solved for Mac devices.

Edit: Found the older patch. Blender Archive - developer.blender.org

vulkan is much much better with stuff like threading, and resource management.

in openGL you could not cache a shader so there is no ‘pop’ the first time its seen,
this happens by default in vulkan,

Hi, I have a question with vulkan backend how you can permit to blender give large scene or huge amount
(complex scene) of gemetry ? i want understand the process

  • Stock the geometry directly in a temps folder ?
  • Accelerate the viewport by GPU ?
  • many other things ?

Because actually when you are close to 15 - 20 millions of tris blender crash of the perf are divided by 5 - 6x and before that the performance are closely degraded more geometry you have. So i’m curious to understand this beautiful things ! i know Meshlets Vulkan can be take a part of the cake !

Vulkan backend are for entirely blender software not for only one render engine ? Because as i can understand at the beginning is only for eevee-next and later he come entirely everywhere in blender ?

Vulkan does NOT cache shaders it has the option to cache pipelines, but don’t expect to much from that. Many games precompile shaders to an intermediate format in order to reduce loading times. Backend compilation is often done when installing a game. Blender isn’t a game, users and add-ons can actually change the GLSL code. We also want to keep the flexibility of debugging shaders and other aspects that you don’t expect to do in games.

It is still to early to discuss how the actual backend will evolve. Our first goal is to make sure we are feature complete, before we start with getting the performance on the same level as OpenGL. When that is completed and the backend is mature enough the plan is to remove OpenGL. When that is done new development projects need to start in order to find out how to actually handle large geometry. There are millions ways to do that, which one we will chose depends on many factors.

In Blender it is not possible to mix and mingle OpenGL calls with Vulkan calls. When you you start blender the full UI is drawn using one or the other.

In the short term Vulkan backend development is in a lower pace. The reason is that we need more development effort stabilizing EEVEE. Community patches will be reviewed and developments that would directly benefit EEVEE stabilization will still be done.

8 Likes

Thank you Jeroen ! It’s ok for me i understand completly in long terms when vulkan gonna be stabilized, blender run only on vulkan backend ! Exited to see this “Many things” for have a real complex and huge geometry inside the viewport ! Good luck ! :slight_smile:

1 Like

Will the switch to vulkan allow AMD linux users to use cycles with the gpu without having to deal with AMD ROCm drivers ?

3 Likes

No, this is unrelated.

1 Like

From the current update in Oct, the team wants to know about user experiences. Is this the place to report my experience?

2 Likes

Will the Vulkan backend break the current viewport drawing API (the gpu) module calls?