capi: expose disable_cache option to capi

This commit is contained in:
chyyran 2023-02-15 03:13:13 -05:00 committed by Ronny Chan
parent e7645a5592
commit 83422de1f7
6 changed files with 35 additions and 5 deletions

View file

@ -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

View file

@ -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

View file

@ -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];
}
}

View file

@ -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];
}
}

View file

@ -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];
}
}

View file

@ -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];
}
}