Skip to content

Commit

Permalink
build: fix cbindgen not finding ctypes
Browse files Browse the repository at this point in the history
* removes capi internal interface from librashader crate
* adds missing noop impls in header
* fix build on rustc < 1.74
  • Loading branch information
chyyran committed Feb 9, 2024
1 parent 8f89b3e commit 104874c
Show file tree
Hide file tree
Showing 23 changed files with 589 additions and 1,714 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 7 additions & 20 deletions include/librashader.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,38 +107,25 @@ enum LIBRA_PRESET_CTX_RUNTIME
typedef uint32_t LIBRA_PRESET_CTX_RUNTIME;
#endif // __cplusplus

/// A Direct3D 11 filter chain.
/// Opaque struct for a Direct3D 11 filter chain.
typedef struct _filter_chain_d3d11 _filter_chain_d3d11;

/// A Direct3D 12 filter chain.
/// Opaque struct for a Direct3D 12 filter chain.
typedef struct _filter_chain_d3d12 _filter_chain_d3d12;

/// An OpenGL filter chain.
/// Opaque struct for an OpenGL filter chain.
typedef struct _filter_chain_gl _filter_chain_gl;

/// A Vulkan filter chain.
/// Opaque struct for a Vulkan filter chain.
typedef struct _filter_chain_vk _filter_chain_vk;

/// The error type for librashader.
/// The error type for librashader C API.
typedef struct _libra_error _libra_error;

/// A shader preset including all specified parameters, textures, and paths to
/// specified shaders.
///
/// A shader preset can be used to create a filter chain runtime instance, or
/// reflected to get parameter metadata.
/// Opaque struct for a shader preset.
typedef struct _shader_preset _shader_preset;

/// A preset wildcard context.
///
/// Any items added after will have higher priority
/// when passed to the shader preset parser.
///
/// When passed to the preset parser, the preset parser
/// will automatically add inferred items at lowest priority.
///
/// Any items added by the user will override the automatically
/// inferred items.
/// Opaque struct for a preset context.
typedef struct _preset_ctx _preset_ctx;

/// A handle to a librashader error object.
Expand Down
23 changes: 23 additions & 0 deletions include/librashader_ld.h
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,30 @@ libra_instance_t __librashader_make_null_instance() {
.instance_abi_version = __librashader__noop_instance_abi_version,
.instance_api_version = __librashader__noop_instance_api_version,

.preset_ctx_create = __librashader__noop_preset_ctx_create,
.preset_ctx_free = __librashader__noop_preset_ctx_free,
.preset_ctx_set_core_name =
__librashader__noop_preset_ctx_set_core_name,
.preset_ctx_set_content_dir =
__librashader__noop_preset_ctx_set_content_dir,
.preset_ctx_set_param = __librashader__noop_preset_ctx_set_param,
.preset_ctx_set_runtime = __librashader__noop_preset_ctx_set_runtime,
.preset_ctx_set_core_rotation =
__librashader__noop_preset_ctx_set_core_rotation,
.preset_ctx_set_user_rotation =
__librashader__noop_preset_ctx_set_user_rotation,
.preset_ctx_set_screen_orientation =
__librashader__noop_preset_ctx_set_screen_orientation,
.preset_ctx_set_allow_rotation =
__librashader__noop_preset_ctx_set_allow_rotation,
.preset_ctx_set_view_aspect_orientation =
__librashader__noop_preset_ctx_set_view_aspect_orientation,
.preset_ctx_set_core_aspect_orientation =
__librashader__noop_preset_ctx_set_core_aspect_orientation,

.preset_create = __librashader__noop_preset_create,
.preset_create_with_context =
__librashader__noop_preset_create_with_context,
.preset_free = __librashader__noop_preset_free,
.preset_set_param = __librashader__noop_preset_set_param,
.preset_get_param = __librashader__noop_preset_get_param,
Expand Down
2 changes: 1 addition & 1 deletion librashader-capi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ runtime-d3d12 = ["windows", "librashader/runtime-d3d12", "windows/Win32_Graphics
runtime-vulkan = ["ash", "librashader/runtime-vk"]

[dependencies]
librashader = { path = "../librashader", version = "0.2.0-beta.8", features = ["internal"] }
librashader = { path = "../librashader", version = "0.2.0-beta.8" }
thiserror = "1.0.37"
paste = "1.0.9"
gl = { version = "0.14.0", optional = true }
Expand Down
13 changes: 1 addition & 12 deletions librashader-capi/cbindgen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,7 @@ typedef void D3D12_CPU_DESCRIPTOR_HANDLE;

[parse]
parse_deps = true
include = ["librashader",
"librashader-presets",
"librashader-preprocess",
"librashader-reflect",
"librashader-runtime-gl",
"librashader-runtime-vk",
"librashader-runtime-d3d11",
"librashader-runtime-d3d12",
]
include = ["librashader"]
expand = ["librashader-capi"]

[struct]
Expand Down Expand Up @@ -161,8 +153,6 @@ include = [
"PFN_libra_d3d12_filter_chain_set_active_pass_count",
"PFN_libra_d3d12_filter_chain_get_active_pass_count",
"PFN_libra_d3d12_filter_chain_free",

"WildcardPresetContext"
]

exclude = ["Option_ID3D11DeviceContext"]
Expand All @@ -173,7 +163,6 @@ exclude = ["Option_ID3D11DeviceContext"]

# I don't know why its literally just WildcardContext??
"WildcardContext" = "_preset_ctx"
"WildcardPresetContext" = "_aaaa_preset_ctx"

"FilterChainGL" = "_filter_chain_gl"
"FilterChainVulkan" = "_filter_chain_vk"
Expand Down
Loading

0 comments on commit 104874c

Please sign in to comment.