diff --git a/MIGRATION-ABI2.md b/MIGRATION-ABI2.md index f9cb0ee..c255977 100644 --- a/MIGRATION-ABI2.md +++ b/MIGRATION-ABI2.md @@ -34,7 +34,7 @@ The following changes are applicable if `LIBRA_RUNTIME_VULKAN` is defined. * The `image` and `out` parameters of `libra_vk_filter_chain_frame` has changed from `libra_source_image_vk_t` and `libra_output_image_vk_t`, to `libra_image_vk_t`. * In `libra_vk_filter_chain_frame`, the position of the `viewport` parameter has moved to after the `out` parameter, and its type has changed from `libra_viewport_t` to `libra_viewport_t *`, which is allowed to be `NULL`. See [`libra_viewport_t` changes](#libra_viewport_t-changes) for more details. -* The `chain` parameter of `libra_vk_filter_chain_get_param` has been made `const` [^1]. +* The `chain` parameter of `libra_vk_filter_chain_get_param` has been made `const`. * It is always thread safe to call `libra_vk_filter_chain_set_param` from any thread [^1]. ## `LIBRA_RUNTIME_OPENGL` changes @@ -49,7 +49,7 @@ The following changes are applicable if `LIBRA_RUNTIME_METAL` is defined. * The `fbo` field previously in `libra_output_image_gl_t` is no longer necessary. librashader will now internally manage a framebuffer object to write to the provided texture. * In `libra_gl_filter_chain_frame`, the position of the `viewport` parameter has moved to after the `out` parameter, and its type has changed from `libra_viewport_t` to `libra_viewport_t *`, which is allowed to be `NULL`. See [`libra_viewport_t` changes](#libra_viewport_t-changes) for more details. -* The `chain` parameter of `libra_gl_filter_chain_get_param` has been made `const` [^1]. +* The `chain` parameter of `libra_gl_filter_chain_get_param` has been made `const`. * It is always thread safe to call `libra_gl_filter_chain_set_param` from any thread [^1]. ## `LIBRA_RUNTIME_D3D11` changes @@ -60,7 +60,7 @@ The following changes are applicable if `LIBRA_RUNTIME_D3D11` is defined. * The `libra_source_image_d3d11_t` struct has been removed. * In `libra_d3d11_filter_chain_frame`, the position of the `viewport` parameter has moved to after the `out` parameter, and its type has changed from `libra_viewport_t` to `libra_viewport_t *`, which is allowed to be `NULL`. See [`libra_viewport_t` changes](#libra_viewport_t-changes) for more details. -* The `chain` parameter of `libra_d3d11_filter_chain_get_param` has been made `const` [^1]. +* The `chain` parameter of `libra_d3d11_filter_chain_get_param` has been made `const`. * It is always thread safe to call `libra_d3d11_filter_chain_set_param` from any thread [^1]. ## `LIBRA_RUNTIME_D3D12` changes @@ -71,7 +71,7 @@ The following changes are applicable if `LIBRA_RUNTIME_D3D12` is defined. * You should now pass what was previously `.width` and `.height` of `libra_viewport_t` to these new fields in `libra_output_image_d3d12_t`. * In `libra_d3d12_filter_chain_frame`, the position of the `viewport` parameter has moved to after the `out` parameter, and its type has changed from `libra_viewport_t` to `libra_viewport_t *`, which is allowed to be `NULL`. See [`libra_viewport_t` changes](#libra_viewport_t-changes) for more details. -* The `chain` parameter of `libra_d3d12_filter_chain_get_param` has been made `const` [^1]. +* The `chain` parameter of `libra_d3d12_filter_chain_get_param` has been made `const`. * It is always thread safe to call `libra_d3d12_filter_chain_set_param` from any thread [^1]. ## `LIBRA_RUNTIME_D3D9` changes @@ -79,7 +79,7 @@ The following changes are applicable if `LIBRA_RUNTIME_D3D9` is defined. * In `libra_d3d9_filter_chain_frame`, the position of the `viewport` parameter has moved to after the `out` parameter, and its type has changed from `libra_viewport_t` to `libra_viewport_t *`, which is allowed to be `NULL`. See [`libra_viewport_t` changes](#libra_viewport_t-changes) for more details. -* The `chain` parameter of `libra_d3d9_filter_chain_get_param` has been made `const` [^1]. +* The `chain` parameter of `libra_d3d9_filter_chain_get_param` has been made `const`. * It is always thread safe to call `libra_d3d9_filter_chain_set_param` from any thread [^1]. ## `LIBRA_RUNTIME_METAL` changes @@ -87,7 +87,7 @@ The following changes are applicable if `LIBRA_RUNTIME_METAL` is defined. * In `libra_mtl_filter_chain_frame`, the position of the `viewport` parameter has moved to after the `out` parameter, and its type has changed from `libra_viewport_t` to `libra_viewport_t *`, which is allowed to be `NULL`. See [`libra_viewport_t` changes](#libra_viewport_t-changes) for more details. -* The `chain` parameter of `libra_mtl_filter_chain_get_param` has been made `const` [^1]. +* The `chain` parameter of `libra_mtl_filter_chain_get_param` has been made `const`. * It is always thread safe to call `libra_mtl_filter_chain_set_param` from any thread [^1]. ## `libra_viewport_t` changes diff --git a/include/librashader.h b/include/librashader.h index 2c1c6c8..9bfcc5d 100644 --- a/include/librashader.h +++ b/include/librashader.h @@ -515,7 +515,7 @@ typedef libra_error_t (*PFN_libra_preset_set_param)(libra_shader_preset_t *prese /// Function pointer definition for ///libra_preset_get_param -typedef libra_error_t (*PFN_libra_preset_get_param)(libra_shader_preset_t *preset, +typedef libra_error_t (*PFN_libra_preset_get_param)(const libra_shader_preset_t *preset, const char *name, float *value); @@ -525,7 +525,7 @@ typedef libra_error_t (*PFN_libra_preset_print)(libra_shader_preset_t *preset); /// Function pointer definition for ///libra_preset_get_runtime_params -typedef libra_error_t (*PFN_libra_preset_get_runtime_params)(libra_shader_preset_t *preset, +typedef libra_error_t (*PFN_libra_preset_get_runtime_params)(const libra_shader_preset_t *preset, struct libra_preset_param_list_t *out); /// Function pointer definition for @@ -659,7 +659,7 @@ typedef libra_error_t (*PFN_libra_gl_filter_chain_set_active_pass_count)(libra_g #if defined(LIBRA_RUNTIME_OPENGL) /// Function pointer definition for ///libra_gl_filter_chain_get_active_pass_count -typedef libra_error_t (*PFN_libra_gl_filter_chain_get_active_pass_count)(libra_gl_filter_chain_t *chain, +typedef libra_error_t (*PFN_libra_gl_filter_chain_get_active_pass_count)(const libra_gl_filter_chain_t *chain, uint32_t *out); #endif @@ -1125,7 +1125,9 @@ libra_error_t libra_preset_set_param(libra_shader_preset_t *preset, const char * /// - `preset` must be null or a valid and aligned pointer to a shader preset. /// - `name` must be null or a valid and aligned pointer to a string. /// - `value` may be a pointer to a uninitialized `float`. -libra_error_t libra_preset_get_param(libra_shader_preset_t *preset, const char *name, float *value); +libra_error_t libra_preset_get_param(const libra_shader_preset_t *preset, + const char *name, + float *value); /// Pretty print the shader preset. /// @@ -1143,7 +1145,7 @@ libra_error_t libra_preset_print(libra_shader_preset_t *preset); /// cause undefined behaviour when later freed. /// - It is safe to call `libra_preset_get_runtime_params` multiple times, however /// the output struct must only be freed once per call. -libra_error_t libra_preset_get_runtime_params(libra_shader_preset_t *preset, +libra_error_t libra_preset_get_runtime_params(const libra_shader_preset_t *preset, struct libra_preset_param_list_t *out); /// Free the runtime parameters. @@ -1261,7 +1263,7 @@ libra_error_t libra_gl_filter_chain_set_active_pass_count(libra_gl_filter_chain_ /// /// ## Safety /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_gl_filter_chain_t`. -libra_error_t libra_gl_filter_chain_get_active_pass_count(libra_gl_filter_chain_t *chain, +libra_error_t libra_gl_filter_chain_get_active_pass_count(const libra_gl_filter_chain_t *chain, uint32_t *out); #endif diff --git a/include/librashader_ld.h b/include/librashader_ld.h index 7f22622..a55bf19 100644 --- a/include/librashader_ld.h +++ b/include/librashader_ld.h @@ -178,7 +178,7 @@ libra_error_t __librashader__noop_preset_set_param( } libra_error_t __librashader__noop_preset_get_param( - libra_shader_preset_t *preset, const char *name, float *value) { + const libra_shader_preset_t *preset, const char *name, float *value) { return NULL; } @@ -186,7 +186,7 @@ libra_error_t __librashader__noop_preset_print(libra_shader_preset_t *preset) { return NULL; } libra_error_t __librashader__noop_preset_get_runtime_params( - libra_shader_preset_t *preset, struct libra_preset_param_list_t *out) { + const libra_shader_preset_t *preset, struct libra_preset_param_list_t *out) { return NULL; } libra_error_t __librashader__noop_preset_free_runtime_params( @@ -221,7 +221,7 @@ libra_error_t __librashader__noop_gl_filter_chain_set_param( } libra_error_t __librashader__noop_gl_filter_chain_get_param( - libra_gl_filter_chain_t *chain, const char *param_name, float *out) { + const libra_gl_filter_chain_t *chain, const char *param_name, float *out) { return NULL; } @@ -231,7 +231,7 @@ libra_error_t __librashader__noop_gl_filter_chain_set_active_pass_count( } libra_error_t __librashader__noop_gl_filter_chain_get_active_pass_count( - libra_gl_filter_chain_t *chain, uint32_t *out) { + const libra_gl_filter_chain_t *chain, uint32_t *out) { return NULL; } #endif @@ -271,7 +271,7 @@ libra_error_t __librashader__noop_vk_filter_chain_set_param( } libra_error_t __librashader__noop_vk_filter_chain_get_param( - libra_vk_filter_chain_t *chain, const char *param_name, float *out) { + const libra_vk_filter_chain_t *chain, const char *param_name, float *out) { return NULL; } @@ -281,7 +281,7 @@ libra_error_t __librashader__noop_vk_filter_chain_set_active_pass_count( } libra_error_t __librashader__noop_vk_filter_chain_get_active_pass_count( - libra_vk_filter_chain_t *chain, uint32_t *out) { + const libra_vk_filter_chain_t *chain, uint32_t *out) { return NULL; } #endif @@ -323,7 +323,7 @@ libra_error_t __librashader__noop_d3d11_filter_chain_set_param( } libra_error_t __librashader__noop_d3d11_filter_chain_get_param( - libra_d3d11_filter_chain_t *chain, const char *param_name, float *out) { + const libra_d3d11_filter_chain_t *chain, const char *param_name, float *out) { return NULL; } @@ -333,7 +333,7 @@ libra_error_t __librashader__noop_d3d11_filter_chain_set_active_pass_count( } libra_error_t __librashader__noop_d3d11_filter_chain_get_active_pass_count( - libra_d3d11_filter_chain_t *chain, uint32_t *out) { + const libra_d3d11_filter_chain_t *chain, uint32_t *out) { return NULL; } #endif @@ -375,7 +375,7 @@ libra_error_t __librashader__noop_d3d12_filter_chain_set_param( } libra_error_t __librashader__noop_d3d12_filter_chain_get_param( - libra_d3d12_filter_chain_t *chain, const char *param_name, float *out) { + const libra_d3d12_filter_chain_t *chain, const char *param_name, float *out) { return NULL; } @@ -385,7 +385,7 @@ libra_error_t __librashader__noop_d3d12_filter_chain_set_active_pass_count( } libra_error_t __librashader__noop_d3d12_filter_chain_get_active_pass_count( - libra_d3d12_filter_chain_t *chain, uint32_t *out) { + const libra_d3d12_filter_chain_t *chain, uint32_t *out) { return NULL; } #endif @@ -418,7 +418,7 @@ libra_error_t __librashader__noop_d3d9_filter_chain_set_param( } libra_error_t __librashader__noop_d3d9_filter_chain_get_param( - libra_d3d9_filter_chain_t *chain, const char *param_name, float *out) { + const libra_d3d9_filter_chain_t *chain, const char *param_name, float *out) { return NULL; } @@ -428,7 +428,7 @@ libra_error_t __librashader__noop_d3d9_filter_chain_set_active_pass_count( } libra_error_t __librashader__noop_d3d9_filter_chain_get_active_pass_count( - libra_d3d9_filter_chain_t *chain, uint32_t *out) { + const libra_d3d9_filter_chain_t *chain, uint32_t *out) { return NULL; } #endif @@ -470,7 +470,7 @@ libra_error_t __librashader__noop_mtl_filter_chain_set_param( } libra_error_t __librashader__noop_mtl_filter_chain_get_param( - libra_mtl_filter_chain_t *chain, const char *param_name, float *out) { + const libra_mtl_filter_chain_t *chain, const char *param_name, float *out) { return NULL; } @@ -480,7 +480,7 @@ libra_error_t __librashader__noop_mtl_filter_chain_set_active_pass_count( } libra_error_t __librashader__noop_mtl_filter_chain_get_active_pass_count( - libra_mtl_filter_chain_t *chain, uint32_t *out) { + const libra_mtl_filter_chain_t *chain, uint32_t *out) { return NULL; } #endif diff --git a/librashader-capi/src/presets.rs b/librashader-capi/src/presets.rs index 8bafff4..b21ea76 100644 --- a/librashader-capi/src/presets.rs +++ b/librashader-capi/src/presets.rs @@ -157,7 +157,7 @@ extern_fn! { /// - `name` must be null or a valid and aligned pointer to a string. /// - `value` may be a pointer to a uninitialized `float`. fn libra_preset_get_param( - preset: *mut libra_shader_preset_t, + preset: *const libra_shader_preset_t, name: *const c_char, value: *mut MaybeUninit ) |name, preset| { @@ -195,7 +195,7 @@ extern_fn! { /// - It is safe to call `libra_preset_get_runtime_params` multiple times, however /// the output struct must only be freed once per call. fn libra_preset_get_runtime_params( - preset: *mut libra_shader_preset_t, + preset: *const libra_shader_preset_t, out: *mut MaybeUninit ) |preset| { assert_some_ptr!(preset); diff --git a/librashader-capi/src/runtime/d3d11/filter_chain.rs b/librashader-capi/src/runtime/d3d11/filter_chain.rs index d6c3be3..579f8aa 100644 --- a/librashader-capi/src/runtime/d3d11/filter_chain.rs +++ b/librashader-capi/src/runtime/d3d11/filter_chain.rs @@ -298,7 +298,7 @@ extern_fn! { /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_d3d11_filter_chain_t`. /// - `param_name` must be either null or a null terminated string. fn libra_d3d11_filter_chain_get_param( - chain: *mut libra_d3d11_filter_chain_t, + chain: *const libra_d3d11_filter_chain_t, param_name: *const c_char, out: *mut MaybeUninit ) |chain| { @@ -337,7 +337,7 @@ extern_fn! { /// ## Safety /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_d3d11_filter_chain_t`. fn libra_d3d11_filter_chain_get_active_pass_count( - chain: *mut libra_d3d11_filter_chain_t, + chain: *const libra_d3d11_filter_chain_t, out: *mut MaybeUninit ) |chain| { assert_some_ptr!(chain); diff --git a/librashader-capi/src/runtime/d3d12/filter_chain.rs b/librashader-capi/src/runtime/d3d12/filter_chain.rs index 4f2194a..80ab7c8 100644 --- a/librashader-capi/src/runtime/d3d12/filter_chain.rs +++ b/librashader-capi/src/runtime/d3d12/filter_chain.rs @@ -335,7 +335,7 @@ extern_fn! { /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_d3d12_filter_chain_t`. /// - `param_name` must be either null or a null terminated string. fn libra_d3d12_filter_chain_get_param( - chain: *mut libra_d3d12_filter_chain_t, + chain: *const libra_d3d12_filter_chain_t, param_name: *const c_char, out: *mut MaybeUninit ) |chain| { @@ -374,7 +374,7 @@ extern_fn! { /// ## Safety /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_d3d12_filter_chain_t`. fn libra_d3d12_filter_chain_get_active_pass_count( - chain: *mut libra_d3d12_filter_chain_t, + chain: *const libra_d3d12_filter_chain_t, out: *mut MaybeUninit ) |chain| { assert_some_ptr!(chain); diff --git a/librashader-capi/src/runtime/d3d9/filter_chain.rs b/librashader-capi/src/runtime/d3d9/filter_chain.rs index 47db2db..90a3e36 100644 --- a/librashader-capi/src/runtime/d3d9/filter_chain.rs +++ b/librashader-capi/src/runtime/d3d9/filter_chain.rs @@ -217,7 +217,7 @@ extern_fn! { /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_d3d9_filter_chain_t`. /// - `param_name` must be either null or a null terminated string. fn libra_d3d9_filter_chain_get_param( - chain: *mut libra_d3d9_filter_chain_t, + chain: *const libra_d3d9_filter_chain_t, param_name: *const c_char, out: *mut MaybeUninit ) |chain| { @@ -256,7 +256,7 @@ extern_fn! { /// ## Safety /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_d3d9_filter_chain_t`. fn libra_d3d9_filter_chain_get_active_pass_count( - chain: *mut libra_d3d9_filter_chain_t, + chain: *const libra_d3d9_filter_chain_t, out: *mut MaybeUninit ) |chain| { assert_some_ptr!(chain); diff --git a/librashader-capi/src/runtime/gl/filter_chain.rs b/librashader-capi/src/runtime/gl/filter_chain.rs index 3a729ef..0e9eb36 100644 --- a/librashader-capi/src/runtime/gl/filter_chain.rs +++ b/librashader-capi/src/runtime/gl/filter_chain.rs @@ -255,7 +255,7 @@ extern_fn! { /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_gl_filter_chain_t`. /// - `param_name` must be either null or a null terminated string. fn libra_gl_filter_chain_get_param( - chain: *mut libra_gl_filter_chain_t, + chain: *const libra_gl_filter_chain_t, param_name: *const c_char, out: *mut MaybeUninit ) |chain| { @@ -294,10 +294,10 @@ extern_fn! { /// ## Safety /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_gl_filter_chain_t`. fn libra_gl_filter_chain_get_active_pass_count( - chain: *mut libra_gl_filter_chain_t, + chain: *const libra_gl_filter_chain_t, out: *mut MaybeUninit - ) mut |chain| { - assert_some_ptr!(mut chain); + ) |chain| { + assert_some_ptr!(chain); let value = chain.parameters().passes_enabled(); unsafe { out.write(MaybeUninit::new(value as u32)) diff --git a/librashader-capi/src/runtime/mtl/filter_chain.rs b/librashader-capi/src/runtime/mtl/filter_chain.rs index a54c664..24d7759 100644 --- a/librashader-capi/src/runtime/mtl/filter_chain.rs +++ b/librashader-capi/src/runtime/mtl/filter_chain.rs @@ -276,7 +276,7 @@ extern_fn! { /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_mtl_filter_chain_t`. /// - `param_name` must be either null or a null terminated string. fn libra_mtl_filter_chain_get_param( - chain: *mut libra_mtl_filter_chain_t, + chain: *const libra_mtl_filter_chain_t, param_name: *const c_char, out: *mut MaybeUninit ) |chain| { @@ -315,7 +315,7 @@ extern_fn! { /// ## Safety /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_mtl_filter_chain_t`. fn libra_mtl_filter_chain_get_active_pass_count( - chain: *mut libra_mtl_filter_chain_t, + chain: *const libra_mtl_filter_chain_t, out: *mut MaybeUninit ) |chain| { assert_some_ptr!(chain); diff --git a/librashader-capi/src/runtime/vk/filter_chain.rs b/librashader-capi/src/runtime/vk/filter_chain.rs index 5ddb0c2..f809fb0 100644 --- a/librashader-capi/src/runtime/vk/filter_chain.rs +++ b/librashader-capi/src/runtime/vk/filter_chain.rs @@ -357,7 +357,7 @@ extern_fn! { /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_vk_filter_chain_t`. /// - `param_name` must be either null or a null terminated string. fn libra_vk_filter_chain_get_param( - chain: *mut libra_vk_filter_chain_t, + chain: *const libra_vk_filter_chain_t, param_name: *const c_char, out: *mut MaybeUninit ) |chain| { @@ -396,7 +396,7 @@ extern_fn! { /// ## Safety /// - `chain` must be either null or a valid and aligned pointer to an initialized `libra_vk_filter_chain_t`. fn libra_vk_filter_chain_get_active_pass_count( - chain: *mut libra_vk_filter_chain_t, + chain: *const libra_vk_filter_chain_t, out: *mut MaybeUninit ) |chain| { assert_some_ptr!(chain);