This avoid having to compile specializations JIT and
use the same API as subprocess compilation.
This bridges the gap between subprocess and threaded
compilation.
Pull Request: https://projects.blender.org/blender/blender/pulls/139702
Compilation constants are constants defined in the create info.
They cannot be changed after the shader is created.
It is a replacement to macros with added type safety.
Reuse most of the logic from Specialization constants.
Pull Request: https://projects.blender.org/blender/blender/pulls/139703
If the compilation subprocess crashes due to an internal driver error,
the end semaphore is never signaled and leaves Blender hanging.
This replaces the `decrement` calls with `try_decrement` and checks
every second if the subprocess is lost.
Additionally, if the issue comes from a broken binary, the crashes will
happen every time a Blender session tries to load it.
So now we store the shader hash in the shared memory before trying to
load the binary. If the subprocess is lost mid compilation, the main
process will delete the broken cached binary.
Pull Request: https://projects.blender.org/blender/blender/pulls/139747
This PR changes loading of implicit vulkan layers. See #139543 where we
detected that there are vulkan layers installed on systems that try to
impersonate other software, but crashes when used in Blender.
This PR will reuse the VkInstance of GHOST_ContextVK when querying for
possible compatible devices. Previously a temporary VkInstance was
created but could trigger an error in the Vulkan loader.
Pull Request: https://projects.blender.org/blender/blender/pulls/139640
This was missing from the initial implementation.
This did not affect any user code path since they were not
checking for completion and only blocking on first `get`.
This allow to easily request async compilation
in a safe way for every static shader.
The get function will always wait if async
compilation has been requested.
Allow adding compilation batches to different priority queues.
Set priorities so static shaders are always compiled first,
then materials, and optimized materials last.
Pull Request: https://projects.blender.org/blender/blender/pulls/139456
This PR adds builtin shaders for drawing points. Using `FLAT_COLOR`,
`SMOOTH_COLOR`, `UNIFORM_COLOR` can lead to undesired behavior
on Metal and Vulkan backends. To ensure future compatibility this PR
adds `POINT_FLAT_COLOR` and `POINT_UNIFORM_COLOR`.
The point size can be set using `gpu.state.point_size_set`.
Pull Request: https://projects.blender.org/blender/blender/pulls/139583
Race condition between the main thread and worker thread. In this case
the worker thread was waiting for a device idle, but the main thread was
waiting on a specific timeline. As long as the timeline didn't pass the
device was locked.
Releaved the race condition to check on queue idle as the timeline event
isn't part of the queue.
On windows drivers could be reset and could lead to other crashes as handles
were not used anymore.
Pull Request: https://projects.blender.org/blender/blender/pulls/139579
In this case a triangle shader was used to render points.
This change entails:
- Using point shaders in this case
- Add support for `GPU_point_size` to update the uniform of the point
shader.
Pull Request: https://projects.blender.org/blender/blender/pulls/139574
The GPU implementation is a bit too complex
to implement for now.
As we are improving shader loading, having the
CPU timings is already helpful.
Note that `Map<size_t, int>` does not compile
on Clang.
This is exposing the `--profile-gpu` option on
all backends as the vulkan backend should follow
shortly.
Pull Request: https://projects.blender.org/blender/blender/pulls/139551
This PR adds a clear on creation for draw region framebuffers, which
fixes issue https://projects.blender.org/blender/blender/issues/139443.
When using the "Lock Interface" option, redrawing is disabled until the
rendering process has finished. When the GPU driver does not initialize
framebuffer textures with zero, this means that visual corruption can
be perceived when resizing the main window while rendering.
This fix makes sure that framebuffer textures are initialized with zero
on all GPU platforms.
Pull Request: https://projects.blender.org/blender/blender/pulls/139445
Implementation of #127106.
This is just a visual representation of the field/single/grid
status of sockets to make the workflow more intuitive. With
a visual representation for volume grid sockets, volume features
should be unblocked for further development. The structure type
will also be used to distinguish list sockets in the interface.
Group input nodes now have a "Structure Type" option instead of
the existing "Single Value Only". Usually the auto option should be
enough, but in some cases where the inferencing cannot (yet) make
a clear determination, it can be helpful to choose a specific type.
The new visualization and the group input structure type option
are hidden behind a new experimental option for now.
Pull Request: https://projects.blender.org/blender/blender/pulls/134811
During rendering when main thread is blocked or all screens are minimized the
garbage collection will not happen resulting in crashes as resources are not freed.
A better solution would be to do garbage collection in a separate thread but that requires a
ref counting system. The specifics of such a system is still unclear.
A possible solution for a Vulkan specific ref counting is to store the ref counts in the
resource tracker. That would only handle images and buffers, but it would solve the most
resource hungry issues.
Pull Request: https://projects.blender.org/blender/blender/pulls/139475
On selected platforms there were some validation errors. It was caused by
platforms that returned a different number of swapchain images then were
requested. In that case the semaphores can get out of sync.
Current mechanism isn't future proof as the max number of images are
statically defined.
For this change the present semaphores is also separated from the frames
to better support out of order swapchain images.
Pull Request: https://projects.blender.org/blender/blender/pulls/139446
GHOST backend didn't use logging. This PR adds an initial ghost.vulkan
logging and improves the reporting of logging in vulkan.
logging can be enabled by `blender --log "gpu.vulkan,ghost.vulkan" --log-level 2`
it shows the optional extensions that are enabled and information about swap chain
events.
Pull Request: https://projects.blender.org/blender/blender/pulls/139437
Unlike OpenGL and Metal, this handle is not shared, but rather Cycles
has to take ownership of it. This required a fair amount of refactoring
to ensure the handle is closed, ownership is properly transferred, and
the handle is recreated once when the pixel buffer is modified.
This patch adds a new Image Coordinates node for the compositor. The
Texture Coordinates and Pixel Coordinates outputs were removed from the
Image Info node and were added to the new node instead. Additionally, a
new Normalized Coordinates output was added.
The Pixel Coordinates output now no longer includes half pixel offsets.
Pull Request: https://projects.blender.org/blender/blender/pulls/138935
Usage of conditional to fix threading and performance delays when
waiting for the submission fence to become valid. The previous
(faulty) implementation didn't work well on WoA devices.
Qualcomm devices don't support external memory, but there an external
memory pool was still being constructed. This PR skips the creation and
asserts when using external memory on those devices.
Pull Request: https://projects.blender.org/blender/blender/pulls/139326
Cleanup and simplification of GPUMaterial and GPUPass compilation.
See #133674 for details/goals.
- Remove the `draw_manage_shader` thread.
Deferred compilation is now handled by the gpu::ShaderCompiler
through the batch compilation API.
Batch management is handled by the `GPUPassCache`.
- Simplify `GPUMaterial` status tracking so it just queries the
`GPUPass` status.
- Split the `GPUPass` and the `GPUCodegen` code.
- Replaced the (broken) `GPU_material_recalc_flag_get` with the new
`GPU_pass_compilation_timestamp`.
- Add the `GPU_pass_cache_wait_for_all` and
`GPU_shader_batch_wait_for_all`, and remove the busy waits from
EEVEE.
- Remove many unused functions, properties, includes...
Pull Request: https://projects.blender.org/blender/blender/pulls/135637