-
v1.29.00ba467b5 · ·
v1.29.0 The key highlights of this release are the change of `pl_gpu` API semantics to use explicit erroring instead of implicit undefined behavior, and several important bug fixes related to swapchain resizing (in particular, handling of suboptimal swapchains); as well as other minor utility changes, bug fixes and performance improvements. The new `pl_gpu` API allows clients to duplicate less code related to checking parameters and capabilities, as long as they're fine with the resulting error messages they might receive. In particular, libplacebo no longer aborts on invalid parameters - which helped during initial development, but is now suffocating clients more than it's helping. Additions: - add a new field `pl_fmt.internal_size`, which can differ from `texel_size` for emulated formats - add 16f / 64f texture formats with host-emulated 32f representation - expose a `pl_vulkan_choose_device` helper function - add a mechanism for allowing the user to explicitly resize suboptimal swapchains rather than having libplacebo take care of it Changes: - make `pl_gpu` log and error gracefully on `illegal` parameters rather than doing undefined behavior (i.e. aborting) - creating a `host_mapped` buffer now requires PL_GPU_CAP_MAPPED_BUFFERS - drop `priv` fields from public structs Fixes and performance improvements: - make libplacebo slightly less log spammy in general - skip the creation/use of semaphores for single-queue usage - fix several bugs related to swapchain recreation and image acquisition - fix creation of non-renderable but storable vulkan textures - fix several bugs related to emulated texture downloads - fix `pl_fmt` capabilities for some emulated formats - fix stride/alignment of std430 vectors/matrices - use push constants more aggressively, whenever possible - slightly improve accurate of BT.2100 matrices - fix overzealous rotation of vulkan queues - fix dangling validation layer suppression in rare cases - fix possible swapchain deadlock on VK_SUBOPTIMAL_KHR - handle VK_SUBOPTIMAL_KHR more gracefully / efficiently
-
v1.21.0aec4a92b · ·
v1.21.0 This is a minor / house-keeping release, mostly to get some important fixes into distros while also getting support for iGPUs requiring non-coherent memory into a "stable" release. Additions: - `shaders.h` API users can now override the GLSL version - add support for vulkan platforms with non-coherent memory (e.g. iGPUs) Changes: - default GLSL version is now 130 unless otherwise specified - signature of `pl_shader_alloc` now uses a params struct - PL_FIX_VER / PL_VERSION are no longer header constants - the renderer will now automatically adjust deband grain scale for HDR Fixes and performance improvements: - on GLSL < 130, shaders now correctly use `texture2D` etc. - fix a bug where async transfer was never actually used, due to incorrect alignment checks - fixed some issues that could lead to symbol conflicts - don't require large vertex buffers be host-visible (usually impossible) - correctly detect swapchain image feature flags - turned a few 1ms busy loops into infinite waits - fix compilation on some platforms that require SPIRV-Tools - fix vkCreateEvent error spam on MoltenVK - bump queued command limit from 64 to 1024
-
v1.18.0717e49c5 · ·
v1.18.0 The major changes of this release include a new and completely overhauled HDR tone mapping algorithm, support for importing backing memory for textures and buffers (such as via dmabuf fds), as well as a swapchain resizing API that, among other benefits, allows libplacebo to function properly on Wayland. There is also now support for generating CPU-backed "dummy resources" for things like lookup tables or convolution kernels, for users who prefer managing their own GPU resources. This allows `pl_shader`-level API users to access the full host of libplacebo shaders without being restricted the lack of a `pl_gpu`. Additions: - `pl_color_space` now has a `sig_scale` field, which allows modifying the signal range without affecting the transfer function's shape. (Effectively, by "stretching" it). This can be useful when dealing with HDR material encoded in a non-HDR curve such as linear light. - Add support for importing handles (including `pl_sync` objects and `pl_shared_mem`). Currently, only memory can be imported. - Add partial support for dmabuf fd interop. Currently does not support dma layout modifiers, so the usefulness of this feature is limited. - Allow importing external memory when creating textures. - Add a way to overexpose HDR material to bring its brightness up to more easily viewable levels. - Add `pl_var_int` to go alongside the other `gpu.h` helpers. - Add a way to create CPU-backed "dummy" instances of `pl_gpu`. These are not capable of compiling or executing any shaders, so they're only useful for users who want to generate and compile their own shaders. All GPU resources (textures, buffers) are backed by `malloc`. - Add a new field to `pl_tex/buf_params` allowing users to attach arbitrary references (void*) that libplacebo will ignore. - Add a function for changing the `pl_context_params` after creation. - Add a new API function for dealing with swapchain resize events. This function can be used to both query and update the swapchain size, based on the usage. Not all platforms support all operations. - Add new demo/skeleton based on GLFW. Changes: - Remove the `hdr_simulation` field from `pl_color_map_params`. Use `signal_scale` on the target color space instead. - Subdivide handle capabilities based on object type (texture vs buffer). - Completely redesign the HDR tone mapping algorithm. Most members of `pl_tone_mapping_params` have been updated, in particular the options related to desaturation and peak detection. - Split up the HDR peak detection API into a "detection" and "application" stage, which can run independently. This avoids the one-frame delay inherent with the previous API, and thus allows tone mapping to be frame perfect. - Remove superfluous field from `pl_shader_reset` left behind from a previous version of the API. Fixes and performance improvements: - Correctly apply the OOTF before performing linear colorspace operations on scene-referred content. - Avoid clipping when tone-mapping out of gamut content by tone mapping before gamut mapping. - Correctly reset the peak detection buffer state when running `pl_renderer_flush_cache`. - Correctly use the image's original color space as the reference space when the content is prelinearized by the renderer. Fixes some cases where libplacebo could end up defaulting `PL_COLOR_TRC_AUTO` to a suboptimal curve. - Correctly track the lifetime and ownership of individual vulkan buffer objects. Fixes some synchronization issues when attempting to use the same buffer from multiple different queue families. - Fix integer overflow on implementations with very large texture size limits. - Fix building against static libshaderc.
-
v1.7.0c3edb463 · ·
v1.7.0 This release marks the first major release of libplacebo, in tune with the release of VLC 4, which will be the first major project using it. Apart from API stability going forwards, this release brings with it a new AV1 film grain shader, better interoperability between libplacebo and external APIs like CUDA (via shared buffers and shared textures), and ICtCp support. While not strictly part of libplacebo, one of the highlights since the previous release includes the existence of a new example file `demos/video-filtering.c` which illustrates how one would use libplacebo to do GPU-based image filtering in something like FFmpeg or mpv. This release also marks our move from GitHub to VideoLAN's GitLab. May they provide a home for us for a long time going forwards. Additions: - Add a new function `pl_gpu_finish` which blocks until all oustanding rendering on this `pl_gpu` is finished. - Add new functions `pl_tex_recreate` and `pl_buf_recreate`, which work like `pl_tex/buf_create` but take a pointer to an existing tex/buf that will get destroyed + recreated only when necessary. - Add a new function `pl_shader_is_failed` which will return true if a given shader is in a "failed" state. Shaders will be marked as failed on any internal/usage error, rather than them being silently ignored. - Add a new enum `pl_channel` to clarify and encode friendly names for the often-referenced "canonical channel order". - Add a new header `libplacebo/shaders/av1.h` which currently contains a function `pl_shader_av1_grain` for applying AV1 film grain on the GPU. - Add a new concept of an "exportable" object (buffers and textures). Exportable objects can be exported using a handle and imported into other foreign APIs such as CUDA. The new functions `pl_buf_export` and `pl_tex_export` must be used to correctly synchronize access to the object. This also adds new fields `uuid` and `handle_caps` to `pl_gpu`. - Supporting the previous feature, add a new field `memory_type` to `pl_buf_params` which can be used to influence what type of memory to allocate a buffer from. Currently only works for texture transfer buffers, since allocating uniform/storage buffers from non-VRAM makes little sense. - Add a new synchronization primitive wrapper, `pl_sync`, which wraps a semaphore pair and must be used to synchronize access to textures with external, asynchronous APIs. - Implement the ITU-R BT.2100 ICtCp color system. Since the libplacebo color systems are not strictly tied to any particular transfer function, we must explicitly mark which flavor of ICtCp is meant. - Add a new field `instance_params` which can be used to influence the parameters used when `pl_vulkan_create` ends up creating an internal instance. - Add a new function `pl_vulkan_unwrap` which allows users to unwrap a vulkan-baed `pl_tex` to expose the internal VkImage, allowing simultaneous use (via `pl_vulkan_hold/release`) similar to wrapped external images. - Add new generic helper functions `pl_std430_layout` and `pl_std140_layout` which replace the old `pl_buf_uniform_layout`, `pl_buf_storage_layout` and `pl_push_constant_layout`. Changes: - Empty device names ("") can now be passed to `pl_vulkan_create`. They will be treated as if NULL was passed. - The `out_plane` parameter of `pl_upload_plane` is now optional. - Clarify/Relax the restrictions on `pl_buf` usage and polling. Users are technically free to use `pl_buf` for multiple simultaneous libplacebo operations. Buffer polling is only needed for accesses by the host. - `pl_vulkan_hold` now returns a bool indicating success. - `pl_buffer_var` has been moved from gpu.h's `pl_desc` to shaders.h's `pl_shader_desc`. Describing the individual variables of a descriptor binding had zero practical application. - `pl_buf_uniform_layout`, `pl_buf_storage_layout` and `pl_push_constant_layout` are now macros for `pl_std140_layout` and `pl_std430_layout` (respectively). This changed the signature to drop the `pl_gpu` parameter. - The `buf_offset` parameter to `pl_tex_transfer` no longer needs to be strictly aligned to a multiple of 4. The minimum alignment is now 1, however users are strongly recommended to stick to the multiple-of-4 alignment (or ideally `align_tex_xfer_offset`) for performance reasons. - The chromatic adaptation method in `pl_get_color_mapping_matrix` has been adjusted. We now use an LMS model derived from CIECAM97's revised linear Bradford matrix, rather than the non-linear matrix that was being used previously (incorrectly so, due to the lack of the required nonlinearity). - The order of fields in `pl_rect3d` has been changed for consistency with the other rect types. Fixes and performance improvements: - Meson 0.47 is correctly marked as the minimum required version. - Fix compilation on clang. - Fix compilation on glslang git master. - Fix compilation with older shaderc versions. - Fix compilation on some platforms. - Fix std140/std430 packing errors for vec3. - Skip unnecessary flush in pl_buf_poll noop cases. - Fix variable collision in sh_prng. - Don't leak glslang internal symbols on supported platforms. - Fix an issue where `pl_pass_run` was stricter than intended about compatibility with between `target` and `target_dummy`. - Fix an issue where `pl_dispatch` could sometimes try dispatching shaders with an incompatible target. - Fix an error in the heuristic for choosing the optimal image layout for vulkan render passes. - Improved debugging messages in several places. - Slightly speed up lookups from texture LUTs. - Fix the addressing of shader LUTs in some hypothetical cases. - Correctly flush the contents of host-readable buffers after modifications made by the GPU. - Fix synchronization on `pl_buf_write` with non-mapped buffers. - Fix undefined behavior when using push descriptors. - Fix build issues on Android arm32. - Slightly speed up some texture recreate operations by invalidating re-used textures. - Fix an issue when trying to update large (>64k) VRAM-resident buffers. - Fix two address calculation bugs in `pl_tex_blit`. - Fix an over-read bug when the size of the vertex data changed for otherwise identical passes. - Fix a misalignment that could theoretically happen with some combinations of (odd) texel sizes and device alignment requirements. - Fix UB when creating "useless" images (without any usage flags). - Fix a vulkan device memory leak when destroying large textures. - Speed up compilation by skipping glslang when shaderc is available. - Fix an alignment issue that could happen sometimes with `pl_buf_write` for odd write sizes. - Fix an alignment bug when uploading partial textures when async transfer is enabled on some devices. - Fix crash in `pl_color_primaries_is_wide_gamut` on DISPLAY_P3. - Fix an error when re-using shader objects between polar and non-polar samplers. This is now safe to do.
-
v1.7.0-rc45a0dd8c2 · ·
v1.7.0-rc4 This release marks the first major release of libplacebo, in tune with the release of VLC 4, which will be the first major project using it. Apart from API stability going forwards, this release brings with it a new AV1 film grain shader, better interoperability between libplacebo and external APIs like CUDA (via shared buffers and shared textures), and ICtCp support. While not strictly part of libplacebo, one of the highlights since the previous release includes the existence of a new example file `demos/video-filtering.c` which illustrates how one would use libplacebo to do GPU-based image filtering in something like FFmpeg or mpv. This release also marks our move from GitHub to VideoLAN's GitLab. May they provide a home for us for a long time going forwards. Additions: - Add a new function `pl_gpu_finish` which blocks until all oustanding rendering on this `pl_gpu` is finished. - Add new functions `pl_tex_recreate` and `pl_buf_recreate`, which work like `pl_tex/buf_create` but take a pointer to an existing tex/buf that will get destroyed + recreated only when necessary. - Add a new function `pl_shader_is_failed` which will return true if a given shader is in a "failed" state. Shaders will be marked as failed on any internal/usage error, rather than them being silently ignored. - Add a new enum `pl_channel` to clarify and encode friendly names for the often-referenced "canonical channel order". - Add a new header `libplacebo/shaders/av1.h` which currently contains a function `pl_shader_av1_grain` for applying AV1 film grain on the GPU. - Add a new concept of an "exportable" object (buffers and textures). Exportable objects can be exported using a handle and imported into other foreign APIs such as CUDA. The new functions `pl_buf_export` and `pl_tex_export` must be used to correctly synchronize access to the object. This also adds new fields `uuid` and `handle_caps` to `pl_gpu`. - Supporting the previous feature, add a new field `memory_type` to `pl_buf_params` which can be used to influence what type of memory to allocate a buffer from. Currently only works for texture transfer buffers, since allocating uniform/storage buffers from non-VRAM makes little sense. - Add a new synchronization primitive wrapper, `pl_sync`, which wraps a semaphore pair and must be used to synchronize access to textures with external, asynchronous APIs. - Implement the ITU-R BT.2100 ICtCp color system. Since the libplacebo color systems are not strictly tied to any particular transfer function, we must explicitly mark which flavor of ICtCp is meant. - Add a new field `instance_params` which can be used to influence the parameters used when `pl_vulkan_create` ends up creating an internal instance. - Add a new function `pl_vulkan_unwrap` which allows users to unwrap a vulkan-baed `pl_tex` to expose the internal VkImage, allowing simultaneous use (via `pl_vulkan_hold/release`) similar to wrapped external images. - Add new generic helper functions `pl_std430_layout` and `pl_std140_layout` which replace the old `pl_buf_uniform_layout`, `pl_buf_storage_layout` and `pl_push_constant_layout`. Changes: - Empty device names ("") can now be passed to `pl_vulkan_create`. They will be treated as if NULL was passed. - The `out_plane` parameter of `pl_upload_plane` is now optional. - Clarify/Relax the restrictions on `pl_buf` usage and polling. Users are technically free to use `pl_buf` for multiple simultaneous libplacebo operations. Buffer polling is only needed for accesses by the host. - `pl_vulkan_hold` now returns a bool indicating success. - `pl_buffer_var` has been moved from gpu.h's `pl_desc` to shaders.h's `pl_shader_desc`. Describing the individual variables of a descriptor binding had zero practical application. - `pl_buf_uniform_layout`, `pl_buf_storage_layout` and `pl_push_constant_layout` are now macros for `pl_std140_layout` and `pl_std430_layout` (respectively). This changed the signature to drop the `pl_gpu` parameter. - The `buf_offset` parameter to `pl_tex_transfer` no longer needs to be strictly aligned to a multiple of 4. The minimum alignment is now 1, however users are strongly recommended to stick to the multiple-of-4 alignment (or ideally `align_tex_xfer_offset`) for performance reasons. - The chromatic adaptation method in `pl_get_color_mapping_matrix` has been adjusted. We now use an LMS model derived from CIECAM97's revised linear Bradford matrix, rather than the non-linear matrix that was being used previously (incorrectly so, due to the lack of the required nonlinearity). - The order of fields in `pl_rect3d` has been changed for consistency with the other rect types. Fixes and performance improvements: - Meson 0.47 is correctly marked as the minimum required version. - Fix compilation on clang. - Fix compilation on glslang git master. - Fix compilation with older shaderc versions. - Fix compilation on some platforms. - Fix std140/std430 packing errors for vec3. - Skip unnecessary flush in pl_buf_poll noop cases. - Fix variable collision in sh_prng. - Don't leak glslang internal symbols on supported platforms. - Fix an issue where `pl_pass_run` was stricter than intended about compatibility with between `target` and `target_dummy`. - Fix an issue where `pl_dispatch` could sometimes try dispatching shaders with an incompatible target. - Fix an error in the heuristic for choosing the optimal image layout for vulkan render passes. - Improved debugging messages in several places. - Slightly speed up lookups from texture LUTs. - Fix the addressing of shader LUTs in some hypothetical cases. - Correctly flush the contents of host-readable buffers after modifications made by the GPU. - Fix synchronization on `pl_buf_write` with non-mapped buffers. - Fix undefined behavior when using push descriptors. - Fix build issues on Android arm32. - Slightly speed up some texture recreate operations by invalidating re-used textures. - Fix an issue when trying to update large (>64k) VRAM-resident buffers. - Fix two address calculation bugs in `pl_tex_blit`. - Fix an over-read bug when the size of the vertex data changed for otherwise identical passes. - Fix a misalignment that could theoretically happen with some combinations of (odd) texel sizes and device alignment requirements. - Fix UB when creating "useless" images (without any usage flags). - Fix a vulkan device memory leak when destroying large textures. - Speed up compilation by skipping glslang when shaderc is available. - Fix an alignment issue that could happen sometimes with `pl_buf_write` for odd write sizes. - Fix an alignment bug when uploading partial textures when async transfer is enabled on some devices. - Fix crash in `pl_color_primaries_is_wide_gamut` on DISPLAY_P3. - Fix an error when re-using shader objects between polar and non-polar samplers. This is now safe to do.
-
v1.7.0-rc3a3e1c43d · ·
v1.7.0-rc3 This release marks the first major release of libplacebo, in tune with the release of VLC 4, which will be the first major project using it. Apart from API stability going forwards, this release brings with it a new AV1 film grain shader, better interoperability between libplacebo and external APIs like CUDA (via shared buffers and shared textures), and ICtCp support. While not strictly part of libplacebo, one of the highlights since the previous release includes the existence of a new example file `demos/video-filtering.c` which illustrates how one would use libplacebo to do GPU-based image filtering in something like FFmpeg or mpv. This release also marks our move from GitHub to VideoLAN's GitLab. May they provide a home for us for a long time going forwards. Additions: - Add a new function `pl_gpu_finish` which blocks until all oustanding rendering on this `pl_gpu` is finished. - Add new functions `pl_tex_recreate` and `pl_buf_recreate`, which work like `pl_tex/buf_create` but take a pointer to an existing tex/buf that will get destroyed + recreated only when necessary. - Add a new function `pl_shader_is_failed` which will return true if a given shader is in a "failed" state. Shaders will be marked as failed on any internal/usage error, rather than them being silently ignored. - Add a new enum `pl_channel` to clarify and encode friendly names for the often-referenced "canonical channel order". - Add a new header `libplacebo/shaders/av1.h` which currently contains a function `pl_shader_av1_grain` for applying AV1 film grain on the GPU. - Add a new concept of an "exportable" object (buffers and textures). Exportable objects can be exported using a handle and imported into other foreign APIs such as CUDA. The new functions `pl_buf_export` and `pl_tex_export` must be used to correctly synchronize access to the object. This also adds new fields `uuid` and `handle_caps` to `pl_gpu`. - Supporting the previous feature, add a new field `memory_type` to `pl_buf_params` which can be used to influence what type of memory to allocate a buffer from. Currently only works for texture transfer buffers, since allocating uniform/storage buffers from non-VRAM makes little sense. - Add a new synchronization primitive wrapper, `pl_sync`, which wraps a semaphore pair and must be used to synchronize access to textures with external, asynchronous APIs. - Implement the ITU-R BT.2100 ICtCp color system. Since the libplacebo color systems are not strictly tied to any particular transfer function, we must explicitly mark which flavor of ICtCp is meant. - Add a new field `instance_params` which can be used to influence the parameters used when `pl_vulkan_create` ends up creating an internal instance. - Add a new function `pl_vulkan_unwrap` which allows users to unwrap a vulkan-baed `pl_tex` to expose the internal VkImage, allowing simultaneous use (via `pl_vulkan_hold/release`) similar to wrapped external images. - Add new generic helper functions `pl_std430_layout` and `pl_std140_layout` which replace the old `pl_buf_uniform_layout`, `pl_buf_storage_layout` and `pl_push_constant_layout`. Changes: - Empty device names ("") can now be passed to `pl_vulkan_create`. They will be treated as if NULL was passed. - The `out_plane` parameter of `pl_upload_plane` is now optional. - Clarify/Relax the restrictions on `pl_buf` usage and polling. Users are technically free to use `pl_buf` for multiple simultaneous libplacebo operations. Buffer polling is only needed for accesses by the host. - `pl_vulkan_hold` now returns a bool indicating success. - `pl_buffer_var` has been moved from gpu.h's `pl_desc` to shaders.h's `pl_shader_desc`. Describing the individual variables of a descriptor binding had zero practical application. - `pl_buf_uniform_layout`, `pl_buf_storage_layout` and `pl_push_constant_layout` are now macros for `pl_std140_layout` and `pl_std430_layout` (respectively). This changed the signature to drop the `pl_gpu` parameter. - The `buf_offset` parameter to `pl_tex_transfer` no longer needs to be strictly aligned to a multiple of 4. The minimum alignment is now 1, however users are strongly recommended to stick to the multiple-of-4 alignment (or ideally `align_tex_xfer_offset`) for performance reasons. - The chromatic adaptation method in `pl_get_color_mapping_matrix` has been adjusted. We now use an LMS model derived from CIECAM97's revised linear Bradford matrix, rather than the non-linear matrix that was being used previously (incorrectly so, due to the lack of the required nonlinearity). - The order of fields in `pl_rect3d` has been changed for consistency with the other rect types. Fixes and performance improvements: - Meson 0.47 is correctly marked as the minimum required version. - Fix compilation on clang. - Fix compilation on glslang git master. - Fix compilation with older shaderc versions. - Fix compilation on some platforms. - Fix std140/std430 packing errors for vec3. - Skip unnecessary flush in pl_buf_poll noop cases. - Fix variable collision in sh_prng. - Don't leak glslang internal symbols on supported platforms. - Fix an issue where `pl_pass_run` was stricter than intended about compatibility with between `target` and `target_dummy`. - Fix an issue where `pl_dispatch` could sometimes try dispatching shaders with an incompatible target. - Fix an error in the heuristic for choosing the optimal image layout for vulkan render passes. - Improved debugging messages in several places. - Slightly speed up lookups from texture LUTs. - Fix the addressing of shader LUTs in some hypothetical cases. - Correctly flush the contents of host-readable buffers after modifications made by the GPU. - Fix synchronization on `pl_buf_write` with non-mapped buffers. - Fix undefined behavior when using push descriptors. - Fix build issues on Android arm32. - Slightly speed up some texture recreate operations by invalidating re-used textures. - Fix an issue when trying to update large (>64k) VRAM-resident buffers. - Fix two address calculation bugs in `pl_tex_blit`. - Fix an over-read bug when the size of the vertex data changed for otherwise identical passes. - Fix a misalignment that could theoretically happen with some combinations of (odd) texel sizes and device alignment requirements. - Fix UB when creating "useless" images (without any usage flags). - Fix a vulkan device memory leak when destroying large textures. - Speed up compilation by skipping glslang when shaderc is available. - Fix an alignment issue that could happen sometimes with `pl_buf_write` for odd write sizes. - Fix an alignment bug when uploading partial textures when async transfer is enabled on some devices. - Fix crash in `pl_color_primaries_is_wide_gamut` on DISPLAY_P3. - Fix an error when re-using shader objects between polar and non-polar samplers. This is now safe to do.
-
v1.7.0-rc268b02d38 · ·
v1.7.0-rc2 This release marks the first major release of libplacebo, in tune with the release of VLC 4, which will be the first major project using it. Apart from API stability going forwards, this release brings with it a new AV1 film grain shader, better interoperability between libplacebo and external APIs like CUDA (via shared buffers and shared textures), and ICtCp support. While not strictly part of libplacebo, one of the highlights since the previous release includes the existence of a new example file `demos/video-filtering.c` which illustrates how one would use libplacebo to do GPU-based image filtering in something like FFmpeg or mpv. Additions: - Add a new function `pl_gpu_finish` which blocks until all oustanding rendering on this `pl_gpu` is finished. - Add new functions `pl_tex_recreate` and `pl_buf_recreate`, which work like `pl_tex/buf_create` but take a pointer to an existing tex/buf that will get destroyed + recreated only when necessary. - Add a new function `pl_shader_is_failed` which will return true if a given shader is in a "failed" state. Shaders will be marked as failed on any internal/usage error, rather than them being silently ignored. - Add a new enum `pl_channel` to clarify and encode friendly names for the often-referenced "canonical channel order". - Add a new header `libplacebo/shaders/av1.h` which currently contains a function `pl_shader_av1_grain` for applying AV1 film grain on the GPU. - Add a new concept of an "exportable" object (buffers and textures). Exportable objects can be exported using a handle (currently only supporting fds on POSIX-style platforms) and imported into other foreign APIs such as CUDA. The new functions `pl_buf_export` and `pl_tex_export` must be used to correctly synchronize access to the object. This also adds new fields `uuid` and `handle_caps` to `pl_gpu`. - Supporting the previous feature, add a new field `memory_type` to `pl_buf_params` which can be used to influence what type of memory to allocate a buffer from. Currently only works for texture transfer buffers, since allocating uniform/storage buffers from non-VRAM makes little sense. - Add a new synchronization primitive wrapper, `pl_sync`, which wraps a semaphore pair and must be used to synchronize access to textures with external, asynchronous APIs. - Implement the ITU-R BT.2100 ICtCp color system. Since the libplacebo color systems are not strictly tied to any particular transfer function, we must explicitly mark which flavor of ICtCp is meant. - Add a new field `instance_params` which can be used to influence the parameters used when `pl_vulkan_create` ends up creating an internal instance. - Add a new function `pl_vulkan_unwrap` which allows users to unwrap a vulkan-baed `pl_tex` to expose the internal VkImage, allowing simultaneous use (via `pl_vulkan_hold/release`) similar to wrapped external images. - Add new generic helper functions `pl_std430_layout` and `pl_std140_layout` which replace the old `pl_buf_uniform_layout`, `pl_buf_storage_layout` and `pl_push_constant_layout`. Changes: - Empty device names ("") can now be passed to `pl_vulkan_create`. They will be treated as if NULL was passed. - The `out_plane` parameter of `pl_upload_plane` is now optional. - Clarify/Relax the restrictions on `pl_buf` usage and polling. Users are technically free to use `pl_buf` for multiple simultaneous libplacebo operations. Buffer polling is only needed for accesses by the host. - `pl_vulkan_hold` now returns a bool indicating success. - `pl_buffer_var` has been moved from gpu.h's `pl_desc` to shaders.h's `pl_shader_desc`. Describing the individual variables of a descriptor binding had zero practical application. - `pl_buf_uniform_layout`, `pl_buf_storage_layout` and `pl_push_constant_layout` are now macros for `pl_std140_layout` and `pl_std430_layout` (respectively). This changed the signature to drop the `pl_gpu` parameter. Fixes and performance improvements: - Meson 0.47 is correctly marked as the minimum required version. - Fix compilation on clang. - Fix compilation on glslang git master. - Fix compilation with older shaderc versions. - Fix compilation on some platforms. - Fix std140/std430 packing errors for vec3. - Skip unnecessary flush in pl_buf_poll noop cases. - Fix variable collision in sh_prng. - Don't leak glslang internal symbols on supported platforms. - Fix an issue where `pl_pass_run` was stricter than intended about compatibility with between `target` and `target_dummy`. - Fix an issue where `pl_dispatch` could sometimes try dispatching shaders with an incompatible target. - Fix an error in the heuristic for choosing the optimal image layout for vulkan render passes. - Improved debugging messages in several places. - Slightly speed up lookups from texture LUTs. - Fix the addressing of shader LUTs in some hypothetical cases. - Correctly flush the contents of host-readable buffers after modifications made by the GPU. - Fix synchronization on `pl_buf_write` with non-mapped buffers. - Fix undefined behavior when using push descriptors. - Fix build issues on Android arm32. - Slightly speed up some texture recreate operations by invalidating re-used textures. - Fix an issue when trying to update large (>64k) VRAM-resident buffers. - Fix two address calculation bugs in `pl_tex_blit`. - Fix an over-read bug when the size of the vertex data changed for otherwise identical passes. - Fix a misalignment that could theoretically happen with some combinations of (odd) texel sizes and device alignment requirements. - Fix UB when creating "useless" images (without any usage flags). - Fix a vulkan device memory leak when destroying large textures. - Speed up compilation by skipping glslang when shaderc is available.
-
v1.7.0-rc1126e4d44 · ·
v1.7.0-rc1 This release marks the first major release of libplacebo, in tune with the release of VLC 4, which will be the first major project using it. Apart from API stability going forwards, this release brings with it a new AV1 film grain shader, better interoperability between libplacebo and external APIs like CUDA (via shared buffers and shared textures), and ICtCp support. While not strictly part of libplacebo, one of the highlights since the previous release includes the existence of a new example file `demos/video-filtering.c` which illustrates how one would use libplacebo to do GPU-based image filtering in something like FFmpeg or mpv. Additions: - Add a new function `pl_gpu_finish` which blocks until all oustanding rendering on this `pl_gpu` is finished. - Add new functions `pl_tex_recreate` and `pl_buf_recreate`, which work like `pl_tex/buf_create` but take a pointer to an existing tex/buf that will get destroyed + recreated only when necessary. - Add a new function `pl_shader_is_failed` which will return true if a given shader is in a "failed" state. Shaders will be marked as failed on any internal/usage error, rather than them being silently ignored. - Add a new enum `pl_channel` to clarify and encode friendly names for the often-referenced "canonical channel order". - Add a new header `libplacebo/shaders/av1.h` which currently contains a function `pl_shader_av1_grain` for applying AV1 film grain on the GPU. - Add a new concept of an "exportable" buffer. Exportable buffers can be exported using a handle (e.g. fd) and imported into other foreign APIs such as CUDA. The new function `pl_buf_export` must be used to correctly synchronize access to the buffer. - Supporting the previous feature, add a new field `memory_type` to `pl_buf_params` which can be used to influence what type of memory to allocate a buffer from. Currently only works for texture transfer buffers, since allocating uniform/storage buffers from non-VRAM makes little sense. - Implement the ITU-R BT.2100 ICtCp color system. Since the libplacebo color systems are not strictly tied to any particular transfer function, we must explicitly mark which flavor of ICtCp is meant. - Add a new field `instance_params` which can be used to influence the parameters used when `pl_vulkan_create` ends up creating an internal instance. - Add a new function `pl_vulkan_unwrap` which allows users to unwrap a vulkan-baed `pl_tex` to expose the internal VkImage, allowing simultaneous use (via `pl_vulkan_hold/release`) similar to wrapped external images. Changes: - Empty device names ("") can now be passed to `pl_vulkan_create`. They will be treated as if NULL was passed. - The `out_plane` parameter of `pl_upload_plane` is now optional. - Clarify/Relax the restrictions on `pl_buf` usage and polling. Users are technically free to use `pl_buf` for multiple simultaneous libplacebo operations. Buffer polling is only needed for accesses by the host. - `pl_vulkan_hold` now returns a bool indicating success. Fixes and performance improvements: - Meson 0.47 is correctly marked as the minimum required version. - Fix compilation on clang. - Fix compilation on glslang git master. - Fix std140/std430 packing errors for vec3. - Skip unnecessary flush in pl_buf_poll noop cases. - Fix variable collision in sh_prng. - Don't leak glslang internal symbols on supported platforms. - Fix an issue where `pl_pass_run` was stricter than intended about compatibility with between `target` and `target_dummy`. - Fix an issue where `pl_dispatch` could sometimes try dispatching shaders with an incompatible target. - Fix an error in the heuristic for choosing the optimal image layout for vulkan render passes. - Improved debugging messages in several places. - Slightly speed up lookups from texture LUTs. - Fix the addressing of shader LUTs in some hypothetical cases. - Correctly flush the contents of host-readable buffers after modifications made by the GPU. - Fix synchronization on `pl_buf_write` with non-mapped buffers. - Fix undefined behavior when using push descriptors. - Fix build issues on Android arm32. - Slightly speed up some texture recreate operations by invalidating re-used textures. - Fix an issue when trying to update large (>64k) VRAM-resident buffers. - Fix two address calculation bugs in `pl_tex_blit`.
-
v0.6.0352da3c7 · ·
v0.6.0 This release brings with it a number of minor fixes and changes, as well as a new feature for simulating, and partially counteracting, various forms of color blindness. For more information see the new `pl_cone_params` structure and `pl_get_cone_matrix` function. Additions: - libplacebo can now be built against glslang directly instead of only via shaderc. Using the latter is still preferred as it allows us to get better diagnostics, but this should make it easier to port to platforms like android. - VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR is now supported, and gets treated as PL_ALPHA_UNKNOWN. - Add a new feature for simulating various forms of color blindness (based on the LMS color model). Changes: - The build system now uses meson's built in tristate option syntax instead of doing it by hand. This requires using -Dfeature=enabled|disabled|auto instead of the old =true|false. - Setting pl_render_params.upscaler/downscaler to NULL no longer allows automatically choosing bicubic, since this breaks various other optimizations that are only possible when using the built-in GPU sampling. This now only chooses bilinear/nearest depending on the texture/hardware capabilities. - The public API of pl_shader_alloc was changed: the `uint8_t ident` field was removed. This makes no real sense to expose publicly, since users had no legitimate use for it other than setting it to `0`. Fixes and performance improvements: - The pl_dither_params.lut_size now gets correctly defaulted to 6. - Fixed some use-after-scope bugs in the renderer. - Fixed colorspace selection when using user-specified swapchain formats. - Fixed a build issue on platforms without VK_EXT_swapchain_colorspace - Peak detection is now correctly disabled if the buffer size is set to 0. (Before, it would default back to 63 in that case) - Fix the out-of-gamut warning feature. This previously stopped working for out-of-range tone mapped values.
-
v0.5.0b94421ac · ·
v0.5.0 This release brings with it greatly improved support for HDR (including HDR-in-SDR emulation, native HDR passthrough and improvements to the HDR->SDR tone mapping algorithm), as well as support for ICC profiles and external VkImage interop (needed for e.g. hardware decoding). Additions: - Add support for treating an SDR curve as an HDR curve by overriding/providing the true target peak. This essentially allows you to calibrate a true HDR device to a typical SDR curve and use it to display HDR media, at the cost of bit precision - Add more values to enum pl_chroma_location - Add a scale factor to struct pl_sample_src, which is useful for e.g. debanding on bit-shifted inputs - Add a new function to infer/guess unknown pl_color_space fields - Add support for 3DLUTs / ICC profiles (via LittleCMS), including support for assigning ICC profiles to the `pl_render_image` and `pl_render_target` structs - Allow enabling optional extra vulkan device/instance extensions, as well as listing what extensions were actually loaded - Add an API for VkImage interop with user code, e.g. to wrap mapped hardware decoding planes into `pl_tex`, plus all synchronization code and extra metadata necessary to make this interop safe - Implement support for native HDR output on supported platforms Changes: - Separate the texture from the plane data struct in `pl_upload_plane` - Swapchain FBOs are now guaranteed to be blittable (e.g. pl_tex_clear) - Tone mapping is no longer done for desaturation steps. Users wanting high quality desaturation should use ICC profiles - Change the types of various fields in struct pl_gpu_limits - Slightly relax the sizing requirements of pl_tex_transfer - Change the default value for pl_tex_transfer_params.stride_w/h. Instead of defaulting to the image size, they now default to the rect to be transferred - Texture transfer buffer offsets must (now) be aligned to the texel size, in addition to being a multiple of 4 - Change the API of `pl_color_space_equal` to be consistent with the rest of the colorspace APIs - Allow the `pl_upload_plane` helpers to upload from buffers as well - Switch the type of mapped buffer pointers from char* to uint8_t* - Rename DCI_P3 to Display_P3, and add DCI_P3 (using the actual DCI white point) Fixes and performance improvements: - Fix some compatibility issues with GLSL 120 - Prevent desaturation from exploding when tone mapping to HDR, or when tone mapping a very bright HDR scene to SDR - Implement the fully parametrized BT.2100 (HLG) OOTF in both directions, based on the tagged/inferred signal peak - Fix an issue preventing the out-of-gamut feature from working correctly on HDR displays - Fix a segfault that occurs when instance creation fails - Fix an issue where `peak_detect_frames` was sometimes too low - Allow debanding to take care of implicit bilinear sampling in cases where no other scaler is requested, thus avoiding an unnecessary FBO indirection - Only run the debanding algorithm on the parts of the image we will actually be displaying. This is relevant when cropping - Fix an issue where PL_TONE_MAPPINg_MOBIUS could fail in certain (unrealistic) scenarios involving HDR-in-SDR emulation - Fix an issue where vulkan could sometimes modify commands after submitting them, when recreating vertex buffers - Make an effort to reuse the same vertex buffer when the contents don't change from the previous invocation - Fix the glslang locale work-arounds on windows - Fix an issue where trying to upload from a too-large texel buffer results in an assertion failure rather than a clean error - Fix an issue where the usage of VkEvents prevented libplacebo from working on platforms where they were unsupported (e.g. MoltenVK) - Support and use vulkan push descriptors where supported. This avoids having to maintain, update and synchronize descriptor sets - Correctly disable signal linearization on low-bit depth FBOs - Prevent a crash on the (pathological) case of a shader with no descriptors - Fix a bug in the size limit calculations for 2D/3D LUTs - Use optimization level "performance" instead of "size" for shader compilation - Fix an abort() when trying to render to a non-storable FBO when using a final pass that requires compute shaders (e.g. HDR peak detection)
-
v0.2.1b17e51cf · ·
v0.2.1 This is a bugfix release, intended to backport a number of easy and/or critical fixes onto v0.2.0, since this is effectively the current 'LTS' due to its use in VLC 3.0. Despite the included fixes, it's still not recommended to make use of `pl_renderer` in this release. v0.4.0 is the first release where that feature could be considered officially supported. For a full list of backported changes, see the git log. But aside from cosmetics, comment fixes, here are the most noteworthy changes: Fixes: - Fix some typos in shaders that lead to miscompilation - Work around the lack of mix(vecN, vecN, bvecN) on GLSL 120 - Avoid the use of platform-dependent locale-invariant printf() calls for shader generation. Instead, use a custom implementation - Work around libshaderc locale dependence (currently only relevant when using vulkan) - Fix various errors with anamorphic content handling - Fix various errors when using vulkan - Add some more sanitization to RA calls, and fix some of the existing ones
-
v0.4.06c336a1d · ·
v0.4.0 This release brings with it a major performance change to the renderer's scaling pipeline, support for vulkan format emulation, improvements to the HDR peak detection algorithm as well as greatly improved support for compute shader-based rasterization. In addition to the above features, this release renames the `RA` abstraction to `pl_gpu`, and normalizes the `ra_` prefix to `pl_` in order to match the rest of the API as well as prevent potential future symbol conflicts with mpv's internal copy of RA. Additions: - Add `pl_shader_encode_color`, which is an inversion of `pl_shader_decode_color` (NOTE: Some features, such as inverse constant luminance or XYZ encoding, are not currently supported) - Add API for overlay images. This can be used to directly overlay arbitrary planes (e.g. subtitles, or menu items) on top of the rendered image or the target FBO. Each plane is allowed to have its own color space/repr and format. See `struct pl_overlay` for more details - Add various predefined `pl_color_repr` values - Add scene change detection functionality to the HDR peak detection algorithm in `pl_shader_color_map`. The new algorithm is designed to allow using larger peak detection buffers without the associated risk of eye-adaptation-like effects - Add support for texel buffers (uniform and storage) in the pl_buf API. These can be used to storage raw texels in buffer format, much like 1D textures, but with the usual buffer-related functionality - Add support for vulkan format emulation, which allows users to directly upload and download e.g. rgb8 or rgb32f textures, even though these are not typically supported by GPUs. The format emulation uses compute shaders and texel storage buffers to fix the data representation on-GPU, and is significantly faster than doing the same with on-CPU software conversion routines - Add a `pl_dispatch_compute` function, which behaves like `pl_dispatch_finish` but without the FBO output, blending and rasterization simulation logic. This is useful when dispatching pure-compute shaders. (Note: Not currently very useful for API users since there are no pure-compute shaders as part of the public API) Changes: - Rename the `ra_` series of abstractions to `pl_` for consistency. The old `struct ra` was renamed to `struct pl_gpu` - The dispatch logic for compute shaders will now correctly simulate the dispatch rect, by manually translating coordinates in the shader. - Disallow using compute shader scaling for flipped source rects. API users who relied on this behavior are encouraged to instead flip the coordinates of the resulting `pl_dispatch_finish` call - Have the renderer infer `src_rect` and `dst_rect` when not given - Have the renderer encode colors to the `target.repr` before outputting to screen. This includes, for example, conversion to YUV and dithering to the target representation's bit depth (where known) - Add a `pl_blend_params` struct to `pl_dispatch_finish`, which can be used to enable blending (including compute shaders) including when using compute shaders. - Subsampled planes must now be an integer multiple (or inverse thereof) of the reference size. If this is not the case, the renderer will assume the planes are cropped or expanded. This is needed to correctly render e.g. 4:2:0 subsampled JPEGs with odd sizes - Require that all uses of `pl_image` with the same `signature` point to the same data, to allow safe cache purging - Allow dispatching debanding and bicubic shaders at any size - `pl_plane_find_fmt` may now be called with `out_map=NULL` - Change the `pl_color_map_default_params` in response to the new scene detection feature. The default buffer size has been increased from 21 to 64, which leads to a much more stable image that flickers less Fixes and performance improvements: - Fix typo that lead to incorrect anamorphic rendering - Fix various rendering issues when using a flipped src_rect - Fix a double-free that could happen as a result of rendering failing in an unexpected way. - Fix handling of alpha values in `pl_shader_decode_color` - Correctly set the queue family index for vulkan buffer barriers - Work around a locale dependence in libshaderc by calling uselocale/XXX before calling into shaderc functions - Remove POSIX dependence in the test suite - Remove non-portable ffsll call - Fix demos/sdl2.c building on windows - Fix an issue where trying to polar sample multiple planes could result in a variable conflict - Fix inverted plane shift offset calculation - Respect the debanding settings in the renderer - Sanitize `pl_pass_run_params.scissors` and silently drop no-ops - Avoid dependence on exact float equality in the renderer's upscaling/downscaling checks - Fix an off-by-one in the HDR peak computation code which lead to subtly too-dark output - Correctly check for and enable required vulkan device features - Switch to a custom implementation of locale-invariant printf, to avoid depending on broken platform-dependent versions - Overhaul the renderer's scaling pipeline. The new code is significantly faster when rendering cropped images, and also fixes an issue where src_rect was not applied when FBOs are unavailable - Minor performance tweaks here and there - Cap the sizes of various buffer pools and command queues in order to avoid OOM scenarios in infinite loops that don't contain enough forward dependencies to force command flushing - Correctly check for and catch buffer access overflow - Don't segfault when `pl_buf_create` fails - Don't segfault when running a compute shader without viewport/scissors - Fix a 32-bit integer overflow that could occurr when using HDR peak detection on 4K content with large values of `peak_detect_frames` - Fix an off-by-one in the generation of literal LUTs such as the type used by the dithering code when textures are unavailable, which led to these shaders miscompiling - Various fixes for building on 32-bit systems - Fix an uninitialized value in the renderer
-
v0.3.044589895 · ·
v0.3.0 This update brings with it some major changes to the renderer, support for swapchains, separated sampling, sigmoidization and more. It also includes, for the first time, a graphical demo capable of rendering to the screen - as well as a benchmark. Additions: - Add a new type (ra_swapchain) encapsulating the concept of a presentable surface (e.g. graphical window) which can be presented to the display, as well as an implementation for vulkan swapchains - Add a simple benchmark suite - Add a new helper utils/upload.h for simplifying the process of picking a compatible texture format and uploading raw texture data - Add a helper function to setup a pl_render_target from a swapchain - Add a graphical demo based on SDL2 (compiled with vulkan support) - Add support for separated (orthogonal) scaling, and make the renderer use it - Add support for using the optimized GPU-native sampling methods for nearest/bilinear/bicubic where possible - Add support for sigmoidization/unsigmoidization shaders - Make the renderer use linearization/sigmoidization where appropriate Changes: - Require vulkan >= v1.0.24, rather than the old >= 1.0.50 - Split up vulkan instance and device creation into separate helpers. This is needed to satisfy the typical VkInstance -> VkSurface -> VkDevice dependency dance required to create a renderable swapchain. - Change the API of pl_dispatch_finish/abort to make it clear that they consume and take over ownership of the pl_shader - Have the renderer also #include most of its API dependencies, to cut down the amount of #include spam needed to use it - Rename pl_sample_polar_params and generalize it to include separated (orthogonal) scaling as well - Various API changes to pl_render_params Fixes: - Allow running the build script without `git` installed - Fix an invalid bounds check on ra_tex_blit causing it to fail for 1D/2D textures - Use global #include paths for all public headers, rather than relative - Fix the src_rect calculation in the renderer, thus fixing an issue where anamorphic scaling produced the wrong result - Fix a typo in the renderer, causing it to skip some planes - Fix a memory leak caused by implicit deallocation of pl_shader - Fix a bug in the renderer causing the image to stop updating after the first frame after a resize - Fixes a bug where the color mapping / tone mapping shaders sometimes got (accidentally) triggered when the source colorspace is unknown - Fix a bug where compute shaders were incorrectly dispatched after a resize of the dispatch target - Fix a bug where the polar compute shader read from uninitialized memory when performing anamorphic scaling - Various other bug fixes and performance tweaks
-
v0.2.03b5fd083 · ·
v0.2.0 Additions: - Add a public "renderer" API. This is currently very WIP, and not ready for stable usage yet. Both the API and the implementation are in flux, but the general goal is to make it easier to use libplcaebo to just render some data in the optimal way. - Add pl_deband_default_params - Expand shader system to support shader merging. This is not directly publicly useful yet, but it's used internally in the renderer. - Allow dispatching to sub-rects of the render target - Expand the scaling API to allow disabling antialiasing - Add high quality dithering algorithms (blue noise, arbitrary size bayer matrix). This uses a new, genearlized shader LUT mechanism which allows the LUT to manifest itself either as a texture, a uniform float[] or as an in-line constant array depending on environment/hardware capabilities. As such, this can be used to enable dithering even without the use of a RA. Changes: - Minor RA API changes here and there (e.g. signed -> unsigned stride) Fixes: - Improved check logic for various shaders - More descriptive variable names in some of the generated shaders - Fix overflow when dithering to bit depths greater than 32 - Fix the RA format finding logic in some cases - Make the scalers correctly support flipped scaling rects - Fix some incorrect vulkan texture barriers - Fix some locale issues on BSD - GLSL 120 compat fix with the dithering algorithm - Fix vulkan command polling logic to avoid blocking for longer than intended
-
v0.1.07eb7a054 · ·
Release v0.1.0 This represents the initial release, mostly so we can get VLC with basic libplacebo support out of the way. As of v0.1, libplacebo only supports vulkan, and only exposes the low-level interfaces (dispatch, shader, ra). So as of now, libplacebo is only useful either as a GLSL shader generator (shaders.h), or as an offline tool for processing images (dispatch.h + vulkan). There is currently no high-level image/video rendering interface, and no support for OpenGL whatsoever. OpenGL support is planned for v0.2, and the addition of a high level renderer is planend for v0.3.