build: fix missing symbols on linux

This commit is contained in:
chyyran 2023-01-14 18:56:31 -05:00
parent 6152e987c6
commit e320e093e2
12 changed files with 22 additions and 15 deletions

View file

@ -36,10 +36,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#if defined(_WIN32) && defined(LIBRA_RUNTIME_D3D11)
#include <d3d11.h>
#else
typedef void ID3D11Device;typedef void ID3D11RenderTargetView;typedef void ID3D1ShaderResourceView;
typedef void ID3D11Device;typedef void ID3D11RenderTargetView;typedef void ID3D11ShaderResourceView;
#endif
#if defined(LIBRA_RUNTIME_VULKAN)
#include <vulkan\vulkan.h>
#include <vulkan/vulkan.h>
#endif
/// Error codes for librashader error types.

View file

@ -27,9 +27,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define __LIBRASHADER_LD_H__
#pragma once
#define LIBRA_RUNTIME_OPENGL
#define LIBRA_RUNTIME_D3D11
#define LIBRA_RUNTIME_VULKAN
#if defined(_WIN32)
#define LIBRA_RUNTIME_D3D11
#endif
#if defined(_WIN32)
#include <windows.h>
#define _LIBRASHADER_ASSIGN(HMOD, INSTANCE, NAME) \
@ -52,7 +55,7 @@ typedef HMODULE _LIBRASHADER_IMPL_HANDLE;
} \
}
typedef void* _LIBRASHADER_IMPL_HANDLE;
#define _LIBRASHADER_LOAD dlopen(L"librashader.so", RTLD_LAZY)
#define _LIBRASHADER_LOAD dlopen("librashader.so", RTLD_LAZY)
#endif
#include "librashader.h"
@ -440,7 +443,7 @@ typedef struct libra_instance_t {
PFN_libra_gl_filter_chain_set_param gl_filter_chain_set_param;
#endif
#if defined(LIBRA_RUNTIME_VULKAN)
#if defined(LIBRA_RUNTIME_D3D11)
/// Create the filter chain given the shader preset.
///
/// The shader preset is immediately invalidated and must be recreated after
@ -712,7 +715,7 @@ libra_instance_t librashader_load_instance() {
#endif
#if defined(LIBRA_RUNTIME_D3D11)
#if defined(_WIN32) && defined(LIBRA_RUNTIME_D3D11)
_LIBRASHADER_ASSIGN(librashader, instance,
d3d11_filter_chain_create);
_LIBRASHADER_ASSIGN(librashader, instance,

View file

@ -28,7 +28,7 @@ gl = { version = "0.14.0", optional = true }
rustc-hash = "1.1.0"
ash = { version = "0.37.2+1.3.238", optional = true }
[dependencies.windows]
[target.'cfg(windows)'.dependencies.windows]
version = "0.43.0"
features = [
"Win32_Foundation",

View file

@ -4,7 +4,7 @@ include_guard = "__LIBRASHADER_H__"
pragma_once = true
usize_is_size_t = true
documentation_style = "c++"
after_includes = "#if defined(_WIN32) && defined(LIBRA_RUNTIME_D3D11)\n#include <d3d11.h>\n#else\ntypedef void ID3D11Device;typedef void ID3D11RenderTargetView;typedef void ID3D1ShaderResourceView;\n#endif\n#if defined(LIBRA_RUNTIME_VULKAN)\n#include <vulkan\\vulkan.h>\n#endif"
after_includes = "#if defined(_WIN32) && defined(LIBRA_RUNTIME_D3D11)\n#include <d3d11.h>\n#else\ntypedef void ID3D11Device;typedef void ID3D11RenderTargetView;typedef void ID3D11ShaderResourceView;\n#endif\n#if defined(LIBRA_RUNTIME_VULKAN)\n#include <vulkan\\vulkan.h>\n#endif"
[defines]
"feature = runtime-opengl" = "LIBRA_RUNTIME_OPENGL"

View file

@ -14,7 +14,7 @@ pub type libra_error_t = Option<NonNull<LibrashaderError>>;
pub type libra_gl_filter_chain_t = Option<NonNull<librashader::runtime::gl::capi::FilterChainGL>>;
/// A handle to a Direct3D11 filter chain.
#[cfg(feature = "runtime-d3d11")]
#[cfg(all(target_os = "windows", feature = "runtime-d3d11"))]
pub type libra_d3d11_filter_chain_t =
Option<NonNull<librashader::runtime::d3d11::capi::FilterChainD3D11>>;

View file

@ -28,7 +28,7 @@ pub enum LibrashaderError {
#[cfg(feature = "runtime-opengl")]
#[error("There was an error in the OpenGL filter chain.")]
OpenGlFilterError(#[from] librashader::runtime::gl::error::FilterChainError),
#[cfg(feature = "runtime-d3d11")]
#[cfg(all(target_os = "windows", feature = "runtime-d3d11"))]
#[error("There was an error in the D3D11 filter chain.")]
D3D11FilterError(#[from] librashader::runtime::d3d11::error::FilterChainError),
#[cfg(feature = "runtime-vulkan")]
@ -180,7 +180,7 @@ impl LibrashaderError {
}
#[cfg(feature = "runtime-opengl")]
LibrashaderError::OpenGlFilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR,
#[cfg(feature = "runtime-d3d11")]
#[cfg(all(target_os = "windows", feature = "runtime-d3d11"))]
LibrashaderError::D3D11FilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR,
#[cfg(feature = "runtime-vulkan")]
LibrashaderError::VulkanFilterError(_) => LIBRA_ERRNO::RUNTIME_ERROR,

View file

@ -2,7 +2,7 @@
#[cfg(feature = "runtime-opengl")]
pub mod gl;
#[cfg(feature = "runtime-d3d11")]
#[cfg(all(target_os = "windows", feature = "runtime-d3d11"))]
pub mod d3d11;
#[cfg(feature = "runtime-vulkan")]

View file

@ -23,7 +23,7 @@ spirv_cross = "0.23.1"
rustc-hash = "1.1.0"
bytemuck = "1.12.3"
[dependencies.windows]
[target.'cfg(windows)'.dependencies.windows]
version = "0.43.0"
features = [
"Win32_Foundation",

View file

@ -1,5 +1,6 @@
#![feature(type_alias_impl_trait)]
#![feature(let_chains)]
#![cfg(target_os = "windows")]
#[cfg(test)]
mod hello_triangle;

View file

@ -25,7 +25,7 @@ librashader-runtime-vk = { path = "../librashader-runtime-vk", version = "0.1.0-
ash = { version = "0.37.1+1.3.235", optional = true }
[dependencies.windows]
[target.'cfg(windows)'.dependencies.windows]
version = "0.43.0"
features = [
"Win32_Graphics_Direct3D11",

View file

@ -122,7 +122,7 @@ pub mod runtime {
}
}
#[cfg(feature = "d3d11")]
#[cfg(all(target_os = "windows", feature = "d3d11"))]
/// Shader runtime for Direct3D 11.
pub mod d3d11 {
pub use librashader_runtime_d3d11::{

View file

@ -16,6 +16,9 @@ int main()
"gameboy-player-crt-royale.slangp",
&preset);
instance.preset_print(&preset);
std::cout << "printed\n";
libra_preset_param_list_t parameters;
error = instance.preset_get_runtime_params(&preset, &parameters);