Introduction
The new OpenCL code for evaluating textures and materials is finished. Its major feature is to not require dynamic kernel compilation anymore. So there is just one kernel compilation for each render engine and that is it.
For v2.4
The code is available on "for_v2.4" branch and will be included in v2.4 related releases.
Compile once
The OpenCL is now compiled once (for each render engine and for each new release) and cached. However it is a lot code to compile, it takes about 90secs with NVIDIA drivers and a AMD 3900x CPU. AMD GPU driver is likely to take more.
The most logic step would be compile the kernels at installation time. It is easy to do, it is just one LuxCore API call (KernelCacheFill()) however I have the impression Blender doesn't call anything after having installed a new plugin
It may be done the first time you run the Blender with the plugin enabled
The situation requires to be extra-careful because it will give the feeling at first-time users that everything is just frozen the moment they do the very first rendering: there must be some big informational note about what is going on.
RTPATHOCL
Thanks to this change, for the first time, it should be viable to use GPU rendering for view-port interactive rendering/editing.
P.S. can someone test this stuff with AMD GPUs. I don't have anymore an AMD GPU installed in my main PC.
New OpenCL textures and materials evaluation code
Re: New OpenCL textures and materials evaluation code
Supernice!!
fantastic!!!
Eager to test it!!!!!
fantastic!!!
Eager to test it!!!!!
Re: New OpenCL textures and materials evaluation code
that is Glory days ! Well done Dade
Re: New OpenCL textures and materials evaluation code
A long-time dream comes true. Thanks Dade!
The register() function of the addon is called, so we can run code, however it is also called whenever Blender is started (not only after the installation).
Is there a way to check if the call to KernelCacheFill() is necessary?
I think Cycles (and some other engines, like VRayRT) compile the OpenCL kernels during the start of the first render. We could do the same (it is also a place where we can show messages about it, I don't think that's possible during register()).
There is no special handler.
The register() function of the addon is called, so we can run code, however it is also called whenever Blender is started (not only after the installation).
Is there a way to check if the call to KernelCacheFill() is necessary?
I think Cycles (and some other engines, like VRayRT) compile the OpenCL kernels during the start of the first render. We could do the same (it is also a place where we can show messages about it, I don't think that's possible during register()).
- alpistinho
- Developer
- Posts: 198
- Joined: Thu Jul 05, 2018 11:38 pm
- Location: Rio de Janeiro
Re: New OpenCL textures and materials evaluation code
Sounds great =)
I have a RX 580 + Ryzen 3600 and can test on Windows (I and Linux OpenCL drivers share a mutual hate for each other).
Will compile it as soon as a stop in front of the computer
I have a RX 580 + Ryzen 3600 and can test on Windows (I and Linux OpenCL drivers share a mutual hate for each other).
Will compile it as soon as a stop in front of the computer
Re: New OpenCL textures and materials evaluation code
Wow this is going to be awesome!
Yesterday I was having a kernel compilation that lasted 15 minutes! I hope this solves everything I'm eager to test it!!!!
Yesterday I was having a kernel compilation that lasted 15 minutes! I hope this solves everything I'm eager to test it!!!!
Re: New OpenCL textures and materials evaluation code
Great news!!!!
Actualy sorry for my google translate english :)
Re: New OpenCL textures and materials evaluation code
Regarding the moment of kernel compile... Why not put a button in settings called "Compile Kernel" with a warning explaining that Blender will be frozen for some minutes.
After that if someone has not compiled the kernel and enable OpenCl a message could appear saying "Please compile kernel, Blender will froze for some minutes" and inside the message the same button to compile it.
That will give the user the consciousness that something is happening and that if Blender froze is normal and they have to wait, and at the same time the power to decide if they want to wait or not.
What do you think?
After that if someone has not compiled the kernel and enable OpenCl a message could appear saying "Please compile kernel, Blender will froze for some minutes" and inside the message the same button to compile it.
That will give the user the consciousness that something is happening and that if Blender froze is normal and they have to wait, and at the same time the power to decide if they want to wait or not.
What do you think?
Re: New OpenCL textures and materials evaluation code
I could add a dedicated function (however calling KernelCacheFill() when the cache is already filled takes no time).
This is exactly how it works now however I'm a bit worried that a new user will not notice the little label "Compile OpenCL kernel" and it will assume everything is frozen.
Re: New OpenCL textures and materials evaluation code
I wouldn't worry about first time compilation... just have addon give a message about the kernel compilation and that's it
it is how blender optix/rtx cycles does it, and also how vray rt does it. Each update of the renderer/plugin triggers this "first time run compilation". I think people should be used to this already
it is how blender optix/rtx cycles does it, and also how vray rt does it. Each update of the renderer/plugin triggers this "first time run compilation". I think people should be used to this already