229 lines
7.4 KiB
TOML
229 lines
7.4 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>
|
|
#endif
|
|
#if defined(_WIN32) && defined(LIBRA_RUNTIME_D3D12)
|
|
#include <d3d12.h>
|
|
#endif
|
|
#if defined(_WIN32) && defined(LIBRA_RUNTIME_D3D9)
|
|
#include <D3D9.h>
|
|
#endif
|
|
#if defined(__APPLE__) && defined(LIBRA_RUNTIME_METAL) && defined(__OBJC__)
|
|
#import <Metal/Metal.h>
|
|
#endif
|
|
#if defined(LIBRA_RUNTIME_VULKAN)
|
|
#include <vulkan/vulkan.h>
|
|
#endif
|
|
"""
|
|
|
|
[defines]
|
|
"feature = runtime-opengl" = "LIBRA_RUNTIME_OPENGL"
|
|
"feature = runtime-vulkan" = "LIBRA_RUNTIME_VULKAN"
|
|
"feature = runtime-d3d11" = "LIBRA_RUNTIME_D3D11"
|
|
"feature = runtime-d3d12" = "LIBRA_RUNTIME_D3D12"
|
|
"feature = runtime-d3d9" = "LIBRA_RUNTIME_D3D9"
|
|
"feature = runtime-metal" = "LIBRA_RUNTIME_METAL"
|
|
"feature = __cbindgen_internal_objc" = "__OBJC__"
|
|
|
|
"target_os = windows" = "_WIN32"
|
|
"target_vendor = apple" = "__APPLE__"
|
|
|
|
[parse]
|
|
parse_deps = false
|
|
include = ["librashader"]
|
|
|
|
[parse.expand]
|
|
crates = ["librashader-capi"]
|
|
features = ["__cbindgen_internal"]
|
|
|
|
[struct]
|
|
|
|
[enum]
|
|
rename_variants = "ScreamingSnakeCase"
|
|
prefix_with_name = true
|
|
|
|
[export]
|
|
include = [
|
|
# instance
|
|
"PFN_libra_instance_abi_version",
|
|
"PFN_libra_instance_api_version",
|
|
|
|
# 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",
|
|
"PFN_libra_preset_create_with_context",
|
|
|
|
"PFN_libra_preset_ctx_create",
|
|
"PFN_libra_preset_ctx_free",
|
|
"PFN_libra_preset_ctx_set_core_name",
|
|
"PFN_libra_preset_ctx_set_content_dir",
|
|
"PFN_libra_preset_ctx_set_param",
|
|
"PFN_libra_preset_ctx_set_core_rotation",
|
|
"PFN_libra_preset_ctx_set_user_rotation",
|
|
"PFN_libra_preset_ctx_set_screen_orientation",
|
|
"PFN_libra_preset_ctx_set_allow_rotation",
|
|
"PFN_libra_preset_ctx_set_view_aspect_orientation",
|
|
"PFN_libra_preset_ctx_set_core_aspect_orientation",
|
|
"PFN_libra_preset_ctx_set_runtime",
|
|
|
|
# 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",
|
|
|
|
# vulkan
|
|
"PFN_libra_vk_filter_chain_create",
|
|
"PFN_libra_vk_filter_chain_create_deferred",
|
|
"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",
|
|
|
|
# d3d11
|
|
"PFN_libra_d3d11_filter_chain_create",
|
|
"PFN_libra_d3d11_filter_chain_create_deferred",
|
|
"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",
|
|
|
|
# d3d11
|
|
"PFN_libra_d3d9_filter_chain_create",
|
|
"PFN_libra_d3d9_filter_chain_frame",
|
|
"PFN_libra_d3d9_filter_chain_set_param",
|
|
"PFN_libra_d3d9_filter_chain_get_param",
|
|
"PFN_libra_d3d9_filter_chain_set_active_pass_count",
|
|
"PFN_libra_d3d9_filter_chain_get_active_pass_count",
|
|
"PFN_libra_d3d9_filter_chain_free",
|
|
|
|
# d3d12
|
|
"PFN_libra_d3d12_filter_chain_create",
|
|
"PFN_libra_d3d12_filter_chain_create_deferred",
|
|
"PFN_libra_d3d12_filter_chain_frame",
|
|
"PFN_libra_d3d12_filter_chain_set_param",
|
|
"PFN_libra_d3d12_filter_chain_get_param",
|
|
"PFN_libra_d3d12_filter_chain_set_active_pass_count",
|
|
"PFN_libra_d3d12_filter_chain_get_active_pass_count",
|
|
"PFN_libra_d3d12_filter_chain_free",
|
|
|
|
# metal
|
|
"PFN_libra_mtl_filter_chain_create",
|
|
"PFN_libra_mtl_filter_chain_create_deferred",
|
|
"PFN_libra_mtl_filter_chain_frame",
|
|
"PFN_libra_mtl_filter_chain_set_param",
|
|
"PFN_libra_mtl_filter_chain_get_param",
|
|
"PFN_libra_mtl_filter_chain_set_active_pass_count",
|
|
"PFN_libra_mtl_filter_chain_get_active_pass_count",
|
|
"PFN_libra_mtl_filter_chain_free",
|
|
]
|
|
|
|
exclude = [
|
|
"Option_ID3D11DeviceContext",
|
|
"Option_PFN_vkGetInstanceProcAddr",
|
|
"PMTLCommandQueue",
|
|
"PMTLCommandBuffer",
|
|
"PMTLTexture"
|
|
]
|
|
|
|
[export.rename]
|
|
"LibrashaderError" = "_libra_error"
|
|
"ShaderPreset" = "_shader_preset"
|
|
|
|
"WildcardContext" = "_preset_ctx"
|
|
|
|
"FilterChainGL" = "_filter_chain_gl"
|
|
"FilterChainVulkan" = "_filter_chain_vk"
|
|
"FilterChainD3D11" = "_filter_chain_d3d11"
|
|
"FilterChainD3D12" = "_filter_chain_d3d12"
|
|
"FilterChainD3D9" = "_filter_chain_d3d9"
|
|
"FilterChainMetal" = "_filter_chain_mtl"
|
|
|
|
# vulkan renames
|
|
"PhysicalDevice" = "VkPhysicalDevice"
|
|
"Instance" = "VkInstance"
|
|
"Device" = "VkDevice"
|
|
"CommandBuffer" = "VkCommandBuffer"
|
|
"Format" = "VkFormat"
|
|
"Image" = "VkImage"
|
|
"Queue" = "VkQueue"
|
|
|
|
# hack to get proper pointer indirection for COM pointers
|
|
# we don't need one for ID3D11DeviceContext.
|
|
"ID3D11Device" = "ID3D11Device *"
|
|
"ID3D11DeviceContext" = "ID3D11DeviceContext *"
|
|
"ID3D11RenderTargetView" = "ID3D11RenderTargetView *"
|
|
"ID3D11ShaderResourceView" = "ID3D11ShaderResourceView *"
|
|
|
|
# hack to get proper pointer indirection for COM pointers
|
|
"IDirect3DDevice9" = "IDirect3DDevice9 *"
|
|
"IDirect3DSurface9" = "IDirect3DSurface9 *"
|
|
"IDirect3DTexture9" = "IDirect3DTexture9 *"
|
|
|
|
# hack to force cbindgen to not generate option type for nullable ID3D11DeviceContext.
|
|
"Option_ID3D11DeviceContext" = "ID3D11DeviceContext *"
|
|
|
|
# hack to force cbindgen to not generate option type for nullable PFN_vkGetInstanceProcAddr.
|
|
"Option_PFN_vkGetInstanceProcAddr" = "PFN_vkGetInstanceProcAddr"
|
|
|
|
# hack to get proper pointer indirection for COM pointers
|
|
"ID3D12Device" = "ID3D12Device *"
|
|
"ID3D12Resource" = "ID3D12Resource *"
|
|
"ID3D12GraphicsCommandList" = "ID3D12GraphicsCommandList *"
|
|
|
|
"PMTLCommandQueue" = "id<MTLCommandQueue>"
|
|
"PMTLCommandBuffer" = "id<MTLCommandBuffer>"
|
|
"PMTLTexture" = "id<MTLTexture>" |