librashader/librashader-capi/cbindgen.toml
2023-01-26 19:05:48 -05:00

147 lines
4.5 KiB
TOML

language = "C"
cpp_compat = true
include_guard = "__LIBRASHADER_H__"
pragma_once = true
usize_is_size_t = true
documentation_style = "c++"
header = """
/*
librashader.h
SPDX-License-Identifier: MIT
This file is part of the librashader C headers.
Copyright 2022 chyyran
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
"""
after_includes = """
#if defined(_WIN32) && defined(LIBRA_RUNTIME_D3D11)
#include <d3d11.h>
#else
typedef void ID3D11Device;
typedef void ID3D11RenderTargetView;
typedef void ID3D11ShaderResourceView;
#endif
#if defined(LIBRA_RUNTIME_VULKAN)
#include <vulkan\\vulkan.h>
#else
typedef int32_t VkFormat;
typedef uint64_t VkImage;
typedef void* VkPhysicalDevice;
typedef void* VkInstance;
typedef void* VkCommandBuffer;
#endif
"""
[defines]
"feature = runtime-opengl" = "LIBRA_RUNTIME_OPENGL"
"feature = runtime-d3d11" = "LIBRA_RUNTIME_D3D11"
"feature = runtime-vulkan" = "LIBRA_RUNTIME_VULKAN"
[parse]
parse_deps = true
include = ["librashader",
"librashader-presets",
"librashader-preprocess",
"librashader-reflect",
"librashader-runtime-gl",
"librashader-runtime-d3d11",
"librashader-runtime-vk",
]
expand = ["librashader-capi"]
[struct]
[enum]
rename_variants = "ScreamingSnakeCase"
prefix_with_name = true
[export]
include = [
# preset
"PFN_libra_preset_create",
"PFN_libra_preset_free",
"PFN_libra_preset_set_param",
"PFN_libra_preset_get_param",
"PFN_libra_preset_print",
"PFN_libra_preset_get_runtime_params",
"PFN_libra_preset_free_runtime_params",
# error
"PFN_libra_error_errno",
"PFN_libra_error_print",
"PFN_libra_error_free",
"PFN_libra_error_write",
"PFN_libra_error_free_string",
# gl
"PFN_libra_gl_init_context",
"PFN_libra_gl_filter_chain_create",
"PFN_libra_gl_filter_chain_frame",
"PFN_libra_gl_filter_chain_set_param",
"PFN_libra_gl_filter_chain_get_param",
"PFN_libra_gl_filter_chain_set_active_pass_count",
"PFN_libra_gl_filter_chain_get_active_pass_count",
"PFN_libra_gl_filter_chain_free",
# d3d11
"PFN_libra_d3d11_filter_chain_create",
"PFN_libra_d3d11_filter_chain_frame",
"PFN_libra_d3d11_filter_chain_set_param",
"PFN_libra_d3d11_filter_chain_get_param",
"PFN_libra_d3d11_filter_chain_set_active_pass_count",
"PFN_libra_d3d11_filter_chain_get_active_pass_count",
"PFN_libra_d3d11_filter_chain_free",
# vulkan
"PFN_libra_vk_filter_chain_create",
"PFN_libra_vk_filter_chain_frame",
"PFN_libra_vk_filter_chain_set_param",
"PFN_libra_vk_filter_chain_get_param",
"PFN_libra_vk_filter_chain_set_active_pass_count",
"PFN_libra_vk_filter_chain_get_active_pass_count",
"PFN_libra_vk_filter_chain_free",
]
[export.rename]
"LibrashaderError" = "_libra_error"
"ShaderPreset" = "_shader_preset"
"FilterChainGL" = "_filter_chain_gl"
"FilterChainOptionsGL" = "filter_chain_gl_opt_t"
"FrameOptionsGL" = "frame_gl_opt_t"
"FilterChainD3D11" = "_filter_chain_d3d11"
"FilterChainOptionsD3D11" = "filter_chain_d3d11_opt_t"
"FrameOptionsD3D11" = "frame_d3d11_opt_t"
"FilterChainVulkan" = "_filter_chain_vk"
"FilterChainOptionsVulkan" = "filter_chain_vk_opt_t"
"FrameOptionsVulkan" = "frame_vk_opt_t"
# vulkan renames
"PhysicalDevice" = "VkPhysicalDevice"
"Instance" = "VkInstance"
"Device" = "VkDevice"
"CommandBuffer" = "VkCommandBuffer"
"Format" = "VkFormat"
"Image" = "VkImage"
#hack to get proper pointer indirection for COM pointers
"ID3D11Device" = "const ID3D11Device *"
"ID3D11RenderTargetView" = "const ID3D11RenderTargetView *"
"ID3D11ShaderResourceView" = "const ID3D11ShaderResourceView *"