diff --git a/README.md b/README.md index 873351c..c8e3f7d 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ This will output a `librashader.dll` or `librashader.so` in the target folder. P As the recommended way of integrating `librashader` is by the `librashader_ld` single header library, ABI stability is important to ensure that updates to librashader do not break existing consumers. -As of `0.1.0-rc.3`, the C ABI should be mostly stable. We reserve the right to make breaking changes before a numbered +As of `0.1.0-rc.4`, the C ABI should be mostly stable. We reserve the right to make breaking changes before a numbered release without following semantic versioning. Linking statically against `librashader.h` is possible, but is not officially supported. You will need to ensure diff --git a/include/librashader.h b/include/librashader.h index 91897a7..afd3235 100644 --- a/include/librashader.h +++ b/include/librashader.h @@ -150,9 +150,14 @@ typedef struct filter_chain_gl_opt_t { /// The GLSL version. Should be at least `330`. uint16_t glsl_version; /// Whether or not to use the Direct State Access APIs. Only available on OpenGL 4.5+. + /// Using the shader cache requires this option, so this option will implicitly + /// disables the shader cache if false. bool use_dsa; /// Whether or not to explicitly disable mipmap generation regardless of shader preset settings. bool force_no_mipmaps; + /// Disable the shader object cache. Shaders will be + /// recompiled rather than loaded from the cache. + bool disable_cache; } filter_chain_gl_opt_t; #endif @@ -241,6 +246,9 @@ typedef struct filter_chain_vk_opt_t { /// Use explicit render pass objects It is recommended if possible to use dynamic rendering, /// because render-pass mode will create new framebuffers per pass. bool use_render_pass; + /// Disable the shader object cache. Shaders will be + /// recompiled rather than loaded from the cache. + bool disable_cache; } filter_chain_vk_opt_t; #endif @@ -294,6 +302,9 @@ typedef struct filter_chain_d3d11_opt_t { /// Whether or not to explicitly disable mipmap /// generation regardless of shader preset settings. bool force_no_mipmaps; + /// Disable the shader object cache. Shaders will be + /// recompiled rather than loaded from the cache. + bool disable_cache; } filter_chain_d3d11_opt_t; #endif @@ -338,6 +349,9 @@ typedef struct filter_chain_d3d12_opt_t { /// generation for intermediate passes regardless /// of shader preset settings. bool force_no_mipmaps; + /// Disable the shader object cache. Shaders will be + /// recompiled rather than loaded from the cache. + bool disable_cache; } filter_chain_d3d12_opt_t; #endif @@ -727,6 +741,7 @@ typedef libra_error_t (*PFN_libra_d3d12_filter_chain_free)(libra_d3d12_filter_ch /// valid to load a librashader C API instance for any ABI /// version not equal to LIBRASHADER_CURRENT_ABI. /// ## ABI Versions +/// - ABI version 0: null instance (unloaded) /// - ABI version 1: 0.1.0 #define LIBRASHADER_CURRENT_ABI 1 diff --git a/librashader-capi/src/runtime/d3d11/filter_chain.rs b/librashader-capi/src/runtime/d3d11/filter_chain.rs index 73eb4fb..dab6401 100644 --- a/librashader-capi/src/runtime/d3d11/filter_chain.rs +++ b/librashader-capi/src/runtime/d3d11/filter_chain.rs @@ -52,11 +52,14 @@ pub struct filter_chain_d3d11_opt_t { /// Whether or not to explicitly disable mipmap /// generation regardless of shader preset settings. pub force_no_mipmaps: bool, + /// Disable the shader object cache. Shaders will be + /// recompiled rather than loaded from the cache. + pub disable_cache: bool, } config_struct! { impl FilterChainOptionsD3D11 => filter_chain_d3d11_opt_t { - 0 => [force_no_mipmaps]; + 0 => [force_no_mipmaps, disable_cache]; } } diff --git a/librashader-capi/src/runtime/d3d12/filter_chain.rs b/librashader-capi/src/runtime/d3d12/filter_chain.rs index b958283..6d80bde 100644 --- a/librashader-capi/src/runtime/d3d12/filter_chain.rs +++ b/librashader-capi/src/runtime/d3d12/filter_chain.rs @@ -77,11 +77,15 @@ pub struct filter_chain_d3d12_opt_t { /// generation for intermediate passes regardless /// of shader preset settings. pub force_no_mipmaps: bool, + + /// Disable the shader object cache. Shaders will be + /// recompiled rather than loaded from the cache. + pub disable_cache: bool, } config_struct! { impl FilterChainOptionsD3D12 => filter_chain_d3d12_opt_t { - 0 => [force_hlsl_pipeline, force_no_mipmaps]; + 0 => [force_hlsl_pipeline, force_no_mipmaps, disable_cache]; } } diff --git a/librashader-capi/src/runtime/gl/filter_chain.rs b/librashader-capi/src/runtime/gl/filter_chain.rs index 8cd525f..35fdae7 100644 --- a/librashader-capi/src/runtime/gl/filter_chain.rs +++ b/librashader-capi/src/runtime/gl/filter_chain.rs @@ -81,14 +81,19 @@ pub struct filter_chain_gl_opt_t { /// The GLSL version. Should be at least `330`. pub glsl_version: u16, /// Whether or not to use the Direct State Access APIs. Only available on OpenGL 4.5+. + /// Using the shader cache requires this option, so this option will implicitly + /// disables the shader cache if false. pub use_dsa: bool, /// Whether or not to explicitly disable mipmap generation regardless of shader preset settings. pub force_no_mipmaps: bool, + /// Disable the shader object cache. Shaders will be + /// recompiled rather than loaded from the cache. + pub disable_cache: bool, } config_struct! { impl FilterChainOptionsGL => filter_chain_gl_opt_t { - 0 => [glsl_version, use_dsa, force_no_mipmaps]; + 0 => [glsl_version, use_dsa, force_no_mipmaps, disable_cache]; } } diff --git a/librashader-capi/src/runtime/vk/filter_chain.rs b/librashader-capi/src/runtime/vk/filter_chain.rs index 23abebe..d326781 100644 --- a/librashader-capi/src/runtime/vk/filter_chain.rs +++ b/librashader-capi/src/runtime/vk/filter_chain.rs @@ -114,11 +114,14 @@ pub struct filter_chain_vk_opt_t { /// Use explicit render pass objects It is recommended if possible to use dynamic rendering, /// because render-pass mode will create new framebuffers per pass. pub use_render_pass: bool, + /// Disable the shader object cache. Shaders will be + /// recompiled rather than loaded from the cache. + pub disable_cache: bool, } config_struct! { impl FilterChainOptionsVulkan => filter_chain_vk_opt_t { - 0 => [frames_in_flight, force_no_mipmaps, use_render_pass]; + 0 => [frames_in_flight, force_no_mipmaps, use_render_pass, disable_cache]; } }