-
v3.104.0-rc1
v3.104.0-rc1 This is a major release, introducing many new features and modifications. Most importantly, libplacebo now interoperates well with FFmpeg's libav* abstractions. This is primarily exposed via a new set of helpers, <libplacebo/utils/libav.h>, implemented as a single header library. In addition to this, a number of other supporting changes have been made to the API, most notably the unification of `pl_image` and `pl_render_target` into a single `pl_frame` concept, similar in spirit to AVFrame. As such, libplacebo now supports **rendering to planar targets**, including subsampled YCbCr. Besides the libav* compatibility changes, this release also brings with it a new feature for custom shaders: buffer blocks, and persistent storage. This can be used by third parties to implement stateful shaders (e.g. motion interpolation or temporal deinterlacing), or be leveraged to speed up some shaders by combining multiple passes into one. Finally, various import/export procedures have been expanded, including the ability to import host pointers and real-world DMABUFs. Additions: - add `pl_memory_qualifiers`, plus a corresponding `pl_shader_desc.memory`, to allow attaching GLSL memory qualifiers (coherent, volatile etc.) to shader descriptors - add functions `pl_dispatch_save` and `pl_dispatch_load` to allow saving/restoring the contents of an entire `pl_dispatch`'s cache - add functions `pl_renderer_save` and `pl_renderer_load` to allow saving/restoring the contents of an entire `pl_renderer`'s cache - add `pl_vulkan_swapchain_params.prefer_hdr`, which will cause the surface format selection logic to try HDR output formats first - add `pl_buf_copy` to copy from one buffer to another - add `pl_get_detected_peak`, to read back the result of peak detection - add `pl_primaries_superset` to test if one set of primaries is fully enclosed by another - add `pl_color_map_params.gamut_clipping`, which will colorimetrically clip any out-of-gamut colors by desaturating them towards neutral gray until they're in-gamut, rather than clipping per channel as before - add `PL_GPU_CAP_SUBGROUPS` and `pl_gpu_limits.subgroup_size`, to expose GLSL subgroup functionality via the `pl_gpu` interface - add `pl_gpu_is_failed`, to query at a high level whether the `pl_gpu` is in some internal failure state. GPUs in this state should be recreated, using the appropriate mechanism - add `pl_shader_custom`, to allow injecting arbitrary custom GLSL code into a `pl_shader`. - add `pl_buf_params.import_handle` to allow importing buffers - add `PL_HANDLE_HOST_POTR`, to allow importing arbitrary host pointers - add `pl_pass_run_params.vertex_buf`, to allow drawing vertex data directly from a `pl_buf`, guarded by `pl_gpu_limits.max_vbo_size` - add `_COUNT` members to all public enums, for consistency - add `pl_shared_mem.drm_format_mod`, to allow communicating DRM format modifiers when importing/exporting textures - add support for importing DMABUFs via EGL, via the new fields `pl_opengl_params.egl_display/context` - add `pl_fmt.fourcc` to facilitate mapping between `pl_fmt` and DRM - add the missing `pl_var_*` helpers, for consistency - add `pl_plane_data_align` to help with aligning `pl_plane_data` structs to byte boundaries - add support for STORAGE textures in user shaders, which can be used to persist data across separate invocations of the shader - add support for BUFFER blocks in user shaders, which can be used to create UBOs or SSBOs for use inside shaders, the latter of which can also persist across frames and be used to store persistent state - add PL_COLOR_PRIM_EBU_3213 and PL_COLOR_PRIM_FILM_C - add a new header <libplacebo/utils/libav.h>, containing a variety of helper functions for interoperating between libav* and libplacebo - add `demos/plplay.c` to serve as a demonstration of how to make a trivial playback loop with libavcodec and libplacebo - add `pl_sample_src.component_mask` to allow sampling an arbitrary subset of the available components from a plane - add `pl_frame_is_cropped` and `pl_frame_clear` to assist in properly clearing frames before rendering to them - add `pl_tex_poll` to assist in interoperating with some external APIs - add `pl_render_params.blend_params` to allow blending the final output Changes: - remove `pl_image.signature` and `pl_render_params.skip_redraw_caching` - change vulkan surface format selection to prioritize formats by 'score', preferring higher depth integer formats - `pl_fmt` may now have PL_FMT_CAP_STORABLE even when `glsl_format` is NULL, in which case formatless image storage must be used - `pl_buf_read` no longer requires `buf_offset` be a multiple of 4 - `pl_buf_*` commands are now synchronized internally: - `pl_buf_write` and `pl_buf_read` now block while the buffer is in use Note: for this reason, `pl_buf_write` should not be used in loops - `pl_tex_upload/download` may now be called on in-use buffers - allow `pl_dispatch_compute` on shaders with outputs, including the ability to automatically determine the number of work groups based on the shader output resolution - remove `pl_buf_params.type`, and the concept of buffer types in general. `pl_buf` is now a generic catch-all for any type of buffer, with individual capabilities in `pl_buf_params` determinig what type of shader operations it can be used for - relax the alignment requirements on `pl_tex_transfer_params` - change `pl_opengl_wrap_params` to allow directly importing framebuffers in addition to textures - rename `pl_color_levels` members for clarity - make `pl_opengl` ignore software rasterizers by default, unless the new field `pl_opengl_params.allow_software` is set - add `pl_av1_grain_params.luma_comp` to allow drawing the luma component from a channel with nonzero index - `pl_renderer` now supports rendering to planar targets, including subsampled targets - `pl_image` and `pl_render_target` have been removed and unified into a single `pl_frame` concept - remove `pl_tex_params.sample_mode/address_mode` and move them to `pl_desc_binding` instead, to decouple them from texture creation - refactor the signature of `pl_tex_blit` Fixes and performance improvements: - fix an oversight where `pl_buf_destroy` delayed some buffer destructions unnecessarily - fix a limitation where `pl_tex_destroy` sometimes delayed destroying textures unnecessarily - improve the performance of `pl_dispatch`'s code for assembling UBOs - improve the performance of `pl_shader_av1_grain` by switching from SSBOs to texture LUTs, also improving compatibility with older GL - improve the performance of `pl_shader_detect_peak` on GPUs with access to subgroups operations - fix an issue where reinitializing shader state objects with different settings sometimes resulted in undefined behaviour - fix some GLSL backwards compatibility issues - slightly cut down on unnecessary image layout transitions - add some miscellaneous debug print-outs, and improve the legibility of some existing log messages - fix an issue where freeing buffer variables from shader descriptors could result in use-after-free - add support for vulkan memory imports requiring dedication allocations - slightly improve, and fix, the vulkan memory placement logic - significantly improve the performance of `pl_tex_download` by importing the target host pointer directly - improve the performance of small LUTs, especially for the non-compute polar fallback path - prevent `pl_renderer` from unneccessarily applying a 3DLUT when both the input and output frames have the same ICC profile - fix the behaviour of partially specified `pl_bit_encoding` structs - fix the component ordering on some odd packed vulkan formats - fix an issue where `pl_plane_data_from_mask` broke for high bit depths - make `pl_renderer` consult the dither bit depth from the texture precision, if absent from `pl_bit_encoding` - fix the behaviour of `pl_renderer` when sampling from textures with swapped component orders - fix the implementation of PL_COLOR_SYSTEM_BT_2100_HLG - fix some issues relating to missing includes - enforce legality of image usage parameters on `pl_vulkan_wrap` - fix an undesired shader double-compilation when using orthogonal scalers with subsampled chroma planes - fix an issue where application of a 3DLUT cleared the alpha channel - add a missing extension to `pl_vulkan_recommended_extensions` - fix the plane alignment code for oddly sized subsampled chroma - fix the poor precision of `pl_shader_dither` for high bit depths - fix several possible overflows in the BT.2390 shader - fix a bug where using a polar sampler to draw a scaled overlay onto a non-storable target neglected to disable compute shaders - fix a bug where the renderer could sometimes alias when downscaling, in particular if both the upsampler and downsampler are set to bicubic - improve performance of scalers by avoiding bilinear filtering
-
v2.72.2
v2.72.2 This hotfix release fixes an additional glslang linking/build issue that was missed in v2.72.1. Bug fixes: - fix linking issue with some installations of glslang >= 11.0.0
-
v2.72.1
v2.72.1 This release backports a number of bug fixes from master affecting the v2.72.0 release, most notably extending the range of supported glslang versions, as well as fixing the 3DLUT/ICC generation code. Bug fixes: - compatibility with glslang >= 8.13.3743 - compatibility with new glslang semantic versioning scheme - fix broken shaders on some versions of GLES by defaulting to 32-bit precision for floating point math - fix the vulkan API version passed to shaderc - fix the extension check for glInvalidateTexImage - fix pl_tex_create on older GLES versions - fix OpenGL logging thread safety - fix undefined memcmp() in pl_shader_av1_grain - fix pl_render_target.repr being ignored by pl_render_image - fix 3DLUT generation code (generated corrupt LUTs in all cases) - fix symbol visibility on some versions of GCC - fix potential overflow in BT.2390 shader - properly restrict pl_shader_sample_polar to GLSL >= 130 - fix vulkan function loading of promoted core functions Other changes: - tiny performance gain in 3DLUT generation - pl_opengl_create now logs GL_EXTENSIONS - log some additional VkResult enum members - improve several vulkan log messages by using friendly names of enums - add a copy of the config.h variables to the libplacebo.pc file
-
v2.72.0
v2.72.0 This is a major release with several key additions, most notably being the support for custom, mpv-style "user shaders" (.hook), giving us access to a large variety of pre-existing user shaders such as RAVU, FSRCNNX, Anime4K, SSimSuperRes, KrigBilateral, NNEDI3, and more. In addition to this, major additions include a completely refactored and fixed AV1 grain generation shader, support for Vulkan versions higher than 1.0, support for GPU-based timers, and improved interop APIs for both Vulkan and OpenGL, and new and improved aspect ratio handling. Finally, this release also brings with it a major change to the way HDR and SDR content are mapped between each other, including a new tone-mapping function based on the industry-standard ITU-R BT.2390 EETF. Additions: - add `pl_swapchain_hdr_metadata`, to set HDR metadata on supported swapchains (currently only vulkan with `VK_EXT_hdr_metadata`) - add support for vulkan versions higher than 1.0, communicated via the new fields `api_version` and `max_api_version` - add support for GPU-assisted validation and best practices layers, via the new field `pl_vk_inst_params.debug_extra` - add helper functions for working with `pl_rect`s, including new aspect ratio handling helpers (`pl_rect2df_aspect_*`) - add field `pl_vulkan_params.device_uuid` to allow choosing the vulkan device by its UUID - add function `pl_vulkan_hold_raw`, to hold images without actually transitioning its layout and access mode - add function `pl_vulkan_import`, to allow directly re-using an existing VkDevice rather than creating a new one; this requires communicating metadata about how the device was created - add field `pl_vulkan_params.features` to allow loading optional extra device features at device creation time - add support for mpv-style custom user shaders (.hook), using the set of functions in `<libplacebo/shaders/custom.h>` - add `pl_render_high_quality_params`, enabling debanding and EWA scaling - add `pl_timer` GPU resource type and associated API functions, allowing the GPU execution time of shaders and texture transfer operations to be measured directly - add `PL_SHADER_SIG_SAMPLER`, allowing generated sampling shaders to directly accept the sampler to use as function parameters - add `pl_image_set_chroma_location` to automatically apply the correct chroma location to any subsampled planes - add `PL_TONE_MAPPING_BT_2390`, a tone mapping function based on the EETF from ITU-R Report BT.2390 (and make it the default) - add `pl_peak_detect_params.overshoot_margin` to help combat clipping on certain types of rapid scene fade-ins - add `pl_sampler_type` to allow encoding non-standard sampler types such as sampler2DRect, and also generalize samplers to allow e.g. usampler2D or isampler3D - add `pl_opengl_wrap` and `pl_opengl_unwrap`, to allow directly mapping between OpenGL textures and the `pl_tex` abstraction Changes: - deprecate `pl_image.width/height`, which are now inferred automatically from the actual planes - `pl_vulkan_wrap` now takes a `pl_vulkan_wrap_params` struct instead of directly accepting its parameters, including new fields `sample_mode` and `address_mode` to configure the created sampler - change `pl_dispatch_compute` to allow optionally passing in a simulated framebuffer width/height, which will be used to translate vertex attributes (if any) - undefine disabled `config.h` features, instead of defining them as 0 - remove debanding from `pl_render_default_params` - refactor HDR<->SDR mapping; PL_COLOR_REF_WHITE has been removed and replaced by PL_COLOR_SDR_WHITE (203 cd/m^2) and PL_COLOR_SDR_WHITE_HLG (75% HLG), respectively - completely refactor pl_shader_av1_grain`, which now samples directly from the passed texture rather than requiring the color be pre-sampled - `pl_render_image` now infers the image primaries based on resolution, rather than always hard-coding `PL_COLOR_SPACE_UNKNOWN` as BT.709 - change `pl_render_target.dst_rect` from `pl_rect2d` to `pl_rect2df`, allowing more accurate aspect ratio handling, and correctly compensate for subpixel scaling ratios - require `python3-mako` as a dependency of the `vulkan` feature - `pl_chroma_location_offset` now treats `PL_CHROMA_UNKNOWN` as `PL_CHROMA_LEFT`, the de-facto standard chroma location - the default value of `pl_color_map_params.tone_mapping_algo` is now `PL_TONE_MAPPING_BT_2390` Fixes and performance improvements: - fix shader generation when the GLSL version is explicitly overridden - properly mark some shader failures (`pl_shader_is_failed`) - fix texture invalidation on OpenGL - correctly respect `pl_swapchain_frame.flipped` in `pl_render_target_from_swapchain` - correctly validate descriptor uniqueness in `pl_pass_create` - skip redundant matrix multiplication in `pl_shader_encode_color` wherever possible - work around driver bugs w.r.t out-of-order buffer offsets by sorting all buffer variables by offset - fix edge cases in vulkan swapchain usage flag checks - fix excessive CPU usage in `pl_tex_download` - reduce the number of unnecessary GPU flushes caused by `pl_buf_poll` - fix issue where blending did not work on some drivers (e.g. nvidia) - make the framebuffer discard check more aggressive - fix computation of anti-aliased resizable orthogonal filters, e.g. when downscaling using `pl_filter_lanczos` - fix external image memory barriers for exclusive mode images - fix failure path of `pl_swapchain_submit_frame` - fix various GLSL compatibility issues with av1 grain generation - reduce maximum vulkan memory allocation slab size to conform to AMD recommendations - fix build error when lcms is not available - fix double-application of texture scale for e.g. 10-bit content when using separable scalers - fix a multitude of bugs affecting av1 grain generation, especially for chroma planes - fix segfault on vulkan device oom - fix invalid shader generation on some platforms - fix a multitude of bugs, edge cases and subtle off-by-ones related to chroma scaling and plane alignment - add fallback code for edge case w.r.t chroma scaling and gpu resource exhaustion - correctly load VK_KHR_swapchain in all circumstances that require accessing its functions - minimize fbo usage inside `pl_renderer`, by re-using unused fbos - tweak the work group size for polar scaling to perform better on modern GPUs (tested on RDNA) - transparently upgrade fragment shaders to compute shaders on environments with async compute - pick a more reasonable size for the dummy gpu's `max_group_threads` - forbid 10-bit linear transfer functions from vulkan swapchains - fix segfault when re-executing previously failed shaders - fix swapchain creation errors on GLES 2 - explicitly mark all shader resources as non-aliased - correctly specify shader storage buffers as coherent for shaders that require them - fix various memory barrier synchronization issues for opengl
-
v2.72.0-rc2
v2.72.0-rc2 This is a major release with several key additions, most notably being the support for custom, mpv-style "user shaders" (.hook), giving us access to a large variety of pre-existing user shaders such as RAVU, FSRCNNX, Anime4K, SSimSuperRes, KrigBilateral, NNEDI3, and more. In addition to this, major additions include a completely refactored and fixed AV1 grain generation shader, support for Vulkan versions higher than 1.0, support for GPU-based timers, and improved interop APIs for both Vulkan and OpenGL, and new and improved aspect ratio handling. Finally, this release also brings with it a major change to the way HDR and SDR content are mapped between each other, including a new tone-mapping function based on the industry-standard ITU-R BT.2390 EETF. Additions: - add `pl_swapchain_hdr_metadata`, to set HDR metadata on supported swapchains (currently only vulkan with `VK_EXT_hdr_metadata`) - add support for vulkan versions higher than 1.0, communicated via the new fields `api_version` and `max_api_version` - add support for GPU-assisted validation and best practices layers, via the new field `pl_vk_inst_params.debug_extra` - add helper functions for working with `pl_rect`s, including new aspect ratio handling helpers (`pl_rect2df_aspect_*`) - add field `pl_vulkan_params.device_uuid` to allow choosing the vulkan device by its UUID - add function `pl_vulkan_hold_raw`, to hold images without actually transitioning its layout and access mode - add function `pl_vulkan_import`, to allow directly re-using an existing VkDevice rather than creating a new one; this requires communicating metadata about how the device was created - add field `pl_vulkan_params.features` to allow loading optional extra device features at device creation time - add support for mpv-style custom user shaders (.hook), using the set of functions in `<libplacebo/shaders/custom.h>` - add `pl_render_high_quality_params`, enabling debanding and EWA scaling - add `pl_timer` GPU resource type and associated API functions, allowing the GPU execution time of shaders and texture transfer operations to be measured directly - add `PL_SHADER_SIG_SAMPLER`, allowing generated sampling shaders to directly accept the sampler to use as function parameters - add `pl_image_set_chroma_location` to automatically apply the correct chroma location to any subsampled planes - add `PL_TONE_MAPPING_BT_2390`, a tone mapping function based on the EETF from ITU-R Report BT.2390 (and make it the default) - add `pl_peak_detect_params.overshoot_margin` to help combat clipping on certain types of rapid scene fade-ins - add `pl_sampler_type` to allow encoding non-standard sampler types such as sampler2DRect, and also generalize samplers to allow e.g. usampler2D or isampler3D - add `pl_opengl_wrap` and `pl_opengl_unwrap`, to allow directly mapping between OpenGL textures and the `pl_tex` abstraction Changes: - deprecate `pl_image.width/height`, which are now inferred automatically from the actual planes - `pl_vulkan_wrap` now takes a `pl_vulkan_wrap_params` struct instead of directly accepting its parameters, including new fields `sample_mode` and `address_mode` to configure the created sampler - change `pl_dispatch_compute` to allow optionally passing in a simulated framebuffer width/height, which will be used to translate vertex attributes (if any) - undefine disabled `config.h` features, instead of defining them as 0 - remove debanding from `pl_render_default_params` - refactor HDR<->SDR mapping; PL_COLOR_REF_WHITE has been removed and replaced by PL_COLOR_SDR_WHITE (203 cd/m^2) and PL_COLOR_SDR_WHITE_HLG (75% HLG), respectively - completely refactor pl_shader_av1_grain`, which now samples directly from the passed texture rather than requiring the color be pre-sampled - `pl_render_image` now infers the image primaries based on resolution, rather than always hard-coding `PL_COLOR_SPACE_UNKNOWN` as BT.709 - change `pl_render_target.dst_rect` from `pl_rect2d` to `pl_rect2df`, allowing more accurate aspect ratio handling, and correctly compensate for subpixel scaling ratios - require `python3-mako` as a dependency of the `vulkan` feature - `pl_chroma_location_offset` now treats `PL_CHROMA_UNKNOWN` as `PL_CHROMA_LEFT`, the de-facto standard chroma location - the default value of `pl_color_map_params.tone_mapping_algo` is now `PL_TONE_MAPPING_BT_2390` Fixes and performance improvements: - fix shader generation when the GLSL version is explicitly overridden - properly mark some shader failures (`pl_shader_is_failed`) - fix texture invalidation on OpenGL - correctly respect `pl_swapchain_frame.flipped` in `pl_render_target_from_swapchain` - correctly validate descriptor uniqueness in `pl_pass_create` - skip redundant matrix multiplication in `pl_shader_encode_color` wherever possible - work around driver bugs w.r.t out-of-order buffer offsets by sorting all buffer variables by offset - fix edge cases in vulkan swapchain usage flag checks - fix excessive CPU usage in `pl_tex_download` - reduce the number of unnecessary GPU flushes caused by `pl_buf_poll` - fix issue where blending did not work on some drivers (e.g. nvidia) - make the framebuffer discard check more aggressive - fix computation of anti-aliased resizable orthogonal filters, e.g. when downscaling using `pl_filter_lanczos` - fix external image memory barriers for exclusive mode images - fix failure path of `pl_swapchain_submit_frame` - fix various GLSL compatibility issues with av1 grain generation - reduce maximum vulkan memory allocation slab size to conform to AMD recommendations - fix build error when lcms is not available - fix double-application of texture scale for e.g. 10-bit content when using separable scalers - fix a multitude of bugs affecting av1 grain generation, especially for chroma planes - fix segfault on vulkan device oom - fix invalid shader generation on some platforms - fix a multitude of bugs, edge cases and subtle off-by-ones related to chroma scaling and plane alignment - add fallback code for edge case w.r.t chroma scaling and gpu resource exhaustion - correctly load VK_KHR_swapchain in all circumstances that require accessing its functions - minimize fbo usage inside `pl_renderer`, by re-using unused fbos - tweak the work group size for polar scaling to perform better on modern GPUs (tested on RDNA) - transparently upgrade fragment shaders to compute shaders on environments with async compute - pick a more reasonable size for the dummy gpu's `max_group_threads` - forbid 10-bit linear transfer functions from vulkan swapchains - fix segfault when re-executing previously failed shaders - fix swapchain creation errors on GLES 2 - explicitly mark all shader resources as non-aliased - correctly specify shader storage buffers as coherent for shaders that require them - fix various memory barrier synchronization issues for opengl
-
v2.72.0-rc1
v2.72.0-rc1 This is a major release with several key additions, most notably being the support for custom, mpv-style "user shaders" (.hook), giving us access to a large variety of pre-existing user shaders such as RAVU, FSRCNNX, Anime4K, SSimSuperRes, KrigBilateral, NNEDI3, and more. In addition to this, major additions include a completely refactored and fixed AV1 grain generation shader, support for Vulkan versions higher than 1.0, support for GPU-based timers, and improved interop APIs for both Vulkan and OpenGL, and new and improved aspect ratio handling. Finally, this release also brings with it a major change to the way HDR and SDR content are mapped between each other, including a new tone-mapping function based on the industry-standard ITU-R BT.2390 EETF. Additions: - add `pl_swapchain_hdr_metadata`, to set HDR metadata on supported swapchains (currently only vulkan with `VK_EXT_hdr_metadata`) - add support for vulkan versions higher than 1.0, communicated via the new fields `api_version` and `max_api_version` - add support for GPU-assisted validation and best practices layers, via the new field `pl_vk_inst_params.debug_extra` - add helper functions for working with `pl_rect`s, including new aspect ratio handling helpers (`pl_rect2df_aspect_*`) - add field `pl_vulkan_params.device_uuid` to allow choosing the vulkan device by its UUID - add function `pl_vulkan_hold_raw`, to hold images without actually transitioning its layout and access mode - add function `pl_vulkan_import`, to allow directly re-using an existing VkDevice rather than creating a new one; this requires communicating metadata about how the device was created - add field `pl_vulkan_params.features` to allow loading optional extra device features at device creation time - add support for mpv-style custom user shaders (.hook), using the set of functions in `<libplacebo/shaders/custom.h>` - add `pl_render_high_quality_params`, enabling debanding and EWA scaling - add `pl_timer` GPU resource type and associated API functions, allowing the GPU execution time of shaders and texture transfer operations to be measured directly - add `PL_SHADER_SIG_SAMPLER`, allowing generated sampling shaders to directly accept the sampler to use as function parameters - add `pl_image_set_chroma_location` to automatically apply the correct chroma location to any subsampled planes - add `PL_TONE_MAPPING_BT_2390`, a tone mapping function based on the EETF from ITU-R Report BT.2390 (and make it the default) - add `pl_peak_detect_params.overshoot_margin` to help combat clipping on certain types of rapid scene fade-ins - add `pl_sampler_type` to allow encoding non-standard sampler types such as sampler2DRect, and also generalize samplers to allow e.g. usampler2D or isampler3D - add `pl_opengl_wrap` and `pl_opengl_unwrap`, to allow directly mapping between OpenGL textures and the `pl_tex` abstraction Changes: - deprecate `pl_image.width/height`, which are now inferred automatically from the actual planes - `pl_vulkan_wrap` now takes a `pl_vulkan_wrap_params` struct instead of directly accepting its parameters, including new fields `sample_mode` and `address_mode` to configure the created sampler - change `pl_dispatch_compute` to allow optionally passing in a simulated framebuffer width/height, which will be used to translate vertex attributes (if any) - undefine disabled `config.h` features, instead of defining them as 0 - remove debanding from `pl_render_default_params` - refactor HDR<->SDR mapping; PL_COLOR_REF_WHITE has been removed and replaced by PL_COLOR_SDR_WHITE (203 cd/m^2) and PL_COLOR_SDR_WHITE_HLG (75% HLG), respectively - completely refactor pl_shader_av1_grain`, which now samples directly from the passed texture rather than requiring the color be pre-sampled - `pl_render_image` now infers the image primaries based on resolution, rather than always hard-coding `PL_COLOR_SPACE_UNKNOWN` as BT.709 - change `pl_render_target.dst_rect` from `pl_rect2d` to `pl_rect2df`, allowing more accurate aspect ratio handling, and correctly compensate for subpixel scaling ratios - require `python3-mako` as a dependency of the `vulkan` feature - `pl_chroma_location_offset` now treats `PL_CHROMA_UNKNOWN` as `PL_CHROMA_LEFT`, the de-facto standard chroma location - the default value of `pl_color_map_params.tone_mapping_algo` is now `PL_TONE_MAPPING_BT_2390` Fixes and performance improvements: - fix shader generation when the GLSL version is explicitly overridden - properly mark some shader failures (`pl_shader_is_failed`) - fix texture invalidation on OpenGL - correctly respect `pl_swapchain_frame.flipped` in `pl_render_target_from_swapchain` - correctly validate descriptor uniqueness in `pl_pass_create` - skip redundant matrix multiplication in `pl_shader_encode_color` wherever possible - work around driver bugs w.r.t out-of-order buffer offsets by sorting all buffer variables by offset - fix edge cases in vulkan swapchain usage flag checks - fix excessive CPU usage in `pl_tex_download` - reduce the number of unnecessary GPU flushes caused by `pl_buf_poll` - fix issue where blending did not work on some drivers (e.g. nvidia) - make the framebuffer discard check more aggressive - fix computation of anti-aliased resizable orthogonal filters, e.g. when downscaling using `pl_filter_lanczos` - fix external image memory barriers for exclusive mode images - fix failure path of `pl_swapchain_submit_frame` - fix various GLSL compatibility issues with av1 grain generation - reduce maximum vulkan memory allocation slab size to conform to AMD recommendations - fix build error when lcms is not available - fix double-application of texture scale for e.g. 10-bit content when using separable scalers - fix a multitude of bugs affecting av1 grain generation, especially for chroma planes - fix segfault on vulkan device oom - fix invalid shader generation on some platforms - fix a multitude of bugs, edge cases and subtle off-by-ones related to chroma scaling and plane alignment - add fallback code for edge case w.r.t chroma scaling and gpu resource exhaustion - correctly load VK_KHR_swapchain in all circumstances that require accessing its functions - minimize fbo usage inside `pl_renderer`, by re-using unused fbos - tweak the work group size for polar scaling to perform better on modern GPUs (tested on RDNA) - transparently upgrade fragment shaders to compute shaders on environments with async compute - pick a more reasonable size for the dummy gpu's `max_group_threads` - forbid 10-bit linear transfer functions from vulkan swapchains - fix segfault when re-executing previously failed shaders
-
v2.43.1
v2.43.1 This release backports a number of bug fixes from master affecting the v2.43.0 release, and also slightly extends the range of backwards compatibility with respect to vulkan-headers versions. (This change is not on master, so this can be seen as a compatibility release) Bug fixes: - fix GLSL version checks when overriding GLSL versions with `pl_shader_params.glsl` - fix minor order-of-operations issue in AV1 grain synthesis - fix glInvalidate* backwards compatibility issue - fix compilation with older vulkan-headers (e.g. ubuntu 18.04) - fix a bug where pl_shader_encode_color sometimes uploaded and applied an identity matrix unnecessarily - work around upstream issues with MSL shader compilation by ensuring all buffer elements are sorted by offset - fix hypothetical edge case with swapchain image usages forbidden by the swapchain image format - fix an issue where blending overlays caused the rest of the image to be discarded Other changes: - log the vulkan surface selection choices - log the overall library version on initialization - add a few more pl_gpu validation checks - significantly reduce the CPU consumpation of blocking texture downloads
-
v2.43.0
v2.43.0 The major highlight of this release is the introduction of a new OpenGL backend, documented in <libplacebo/opengl.h>, which is also the reason for the major version bump. Apart from the addition of OpenGL support, this release brings with it a large number of fixes for backwards compatibility with older versions of GLSL and GLES, allowing libplacebo to be used to generate legal shaders for virtually any GLSL version in existence. Supporting these changes, the test framework has been expanded considerably to allow for automated testing of older OpenGL context versions and older GLSL versions. Additions: - add `pl_gpu.pci`, containing the PCI address of the underlying GPU - add `pl_image.av1_grain`, allowing `pl_renderer` to add AV1 grain - add `pl_opengl` backend (see <libplacebo/opengl.h>) - add `pl_color_levels_guess`, to infer color levels from pl_color_repr - `pl_shader_encode_color` now handles non-linear color systems - add `pl_render_params.force_dither`, to force use of the dither code - add `pl_render_params.disable_fbos`, to forcibly disable FBOs - add `pl_vk_inst_params.layers`, to allow loading extra vulkan layers - add a way to restrict the maximum GLSL version provided by the various `pl_gpu` backends, for testing purposes Changes: - load all vulkan function pointers indirectly, using a user-provided `vkGetInstanceProcAddr` function - vulkan can now be built without linking against libvulkan.so - refactor av1 grain data struct, splitting it up into "grain metadata" and "shader params" - `pl_swapchain_resize` now recreates suboptimal swapchains even if the size does not change - `pl_tex_blit` now requires the new cap `PL_GPU_CAP_BLITTABLE_1D_3D` for 1D/3D textures - `pl_tex_params.host_readable` now requires the new cap `PL_FMT_CAP_HOST_READABLE` on the chosen format - `pl_vk_inst_create` will now automatically load any layers needed for extensions specified by the user Fixes and performance improvements: - make `pl_color_adjustment.gamma` actually do something - fix av1 grain shader for separated planes - fix memory corruption in `pl_vulkan_swapchain_suboptimal` - fix access mask on API writes to read-writable vulkan buffers - fix some instances of undefined behavior in av1 grain synthesis - fix av1 grain scale for PL_COLOR_LEVELS_UNKNOWN - fix use of local #include for config.h in installed headers - fix various incorrect literals for compatibility with older GLSL - fix potential type error in XYZ input handling - fix numerous backwards compatibility issues for older GLSL and GLES versions, across the board - quench some meson warnings, as well as some compiler warnings
-
v1.29.1
v1.29.1 This is a minor bug fix follow-up, to address one major and two minor issues with the v1.29.0 release. Fixes: - fix a segfault in the test framework on platforms without vulkan - fix error message spam when rendering to minimized/hidden windows - hackily fix compilation on certain glslang versions
-
v1.29.0
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.0
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.0
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.0
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-rc4
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-rc3
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-rc2
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-rc1
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.0
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.0
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.1
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