ld: start writing librashader_ld
This commit is contained in:
parent
fa68b20c19
commit
7e34b991e5
|
@ -33,7 +33,7 @@ librashader provides both a Rust API under the `librashader` crate, and a C API.
|
||||||
|
|
||||||
The librashader C API is best used by linking statically with `librashader_ld`, which implements a loader that dynamically
|
The librashader C API is best used by linking statically with `librashader_ld`, which implements a loader that dynamically
|
||||||
loads the librashader (`librashader.so` or `librashader.dll`) implementation in the search path. You may also link against
|
loads the librashader (`librashader.so` or `librashader.dll`) implementation in the search path. You may also link against
|
||||||
`librashader_capi` directly with [`librashader.h`](https://github.com/SnowflakePowered/librashader/blob/master/librashader-capi/librashader.h).
|
`librashader_capi` directly with [`librashader.h`](https://github.com/SnowflakePowered/librashader/blob/master/include/librashader.h).
|
||||||
|
|
||||||
The C API currently does not expose the [shader reflection API](https://docs.rs/librashader/latest/librashader/reflect/index.html). Work
|
The C API currently does not expose the [shader reflection API](https://docs.rs/librashader/latest/librashader/reflect/index.html). Work
|
||||||
is in progress to expose this to C. In the meanwhile, if you wish to implement a custom runtime for librashader, it will have to be done
|
is in progress to expose this to C. In the meanwhile, if you wish to implement a custom runtime for librashader, it will have to be done
|
||||||
|
@ -56,7 +56,7 @@ works best.
|
||||||
* `libra_d3d11_*`
|
* `libra_d3d11_*`
|
||||||
* `libra_d3d12_*`
|
* `libra_d3d12_*`
|
||||||
|
|
||||||
If you do not mind linking against `librashader_capi` directly, [`librashader.h`](https://github.com/SnowflakePowered/librashader/blob/master/librashader-capi/librashader.h)
|
If you do not mind linking against `librashader_capi` directly, [`librashader.h`](https://github.com/SnowflakePowered/librashader/blob/master/include/librashader.h)
|
||||||
is unlikely to break API stability.
|
is unlikely to break API stability.
|
||||||
|
|
||||||
## Compatibility
|
## Compatibility
|
||||||
|
|
16
include/librashader_ld.h
Normal file
16
include/librashader_ld.h
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#ifndef __LIBRASHADER_LD_H__
|
||||||
|
#define __LIBRASHADER_LD_H__
|
||||||
|
#pragma once
|
||||||
|
#include "librashader.h"
|
||||||
|
|
||||||
|
#if defined(_WIN32)
|
||||||
|
#include <libloaderapi.h>
|
||||||
|
#elif defined(__linux__)
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct libra_instance_t {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -30,7 +30,7 @@
|
||||||
//!
|
//!
|
||||||
//! ## C API
|
//! ## C API
|
||||||
//! For documentation on the librashader C API, see [librashader_capi](https://docs.rs/librashader-capi/latest/librashader_capi/),
|
//! For documentation on the librashader C API, see [librashader_capi](https://docs.rs/librashader-capi/latest/librashader_capi/),
|
||||||
//! or [`librashader.h`](https://github.com/SnowflakePowered/librashader/blob/master/librashader-capi/librashader.h).
|
//! or [`librashader.h`](https://github.com/SnowflakePowered/librashader/blob/master/include/librashader.h).
|
||||||
|
|
||||||
#[cfg(feature = "presets")]
|
#[cfg(feature = "presets")]
|
||||||
/// Parsing and usage of shader presets.
|
/// Parsing and usage of shader presets.
|
||||||
|
|
|
@ -13,7 +13,7 @@ typedef PFN_vkVoidFunction(*PFN_vkGetInstanceProcAddr)(VkInstance instance, cons
|
||||||
#define LIBRA_RUNTIME_OPENGL
|
#define LIBRA_RUNTIME_OPENGL
|
||||||
#define LIBRA_RUNTIME_VULKAN
|
#define LIBRA_RUNTIME_VULKAN
|
||||||
|
|
||||||
#include "../../../../librashader-capi/librashader.h"
|
#include "../../../../include/librashader.h"
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::cout << "Hello World!\n";
|
std::cout << "Hello World!\n";
|
||||||
|
|
Loading…
Reference in a new issue