mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-10-29 21:41:36 +00:00
Target C for header generation
This commit is contained in:
parent
105a71d19a
commit
d94d45cd80
@ -1,54 +1,51 @@
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
enum class PowerPreference {
|
||||
typedef enum {
|
||||
Default = 0,
|
||||
LowPower = 1,
|
||||
HighPerformance = 2,
|
||||
};
|
||||
} PowerPreference;
|
||||
|
||||
struct ShaderModuleDescriptor;
|
||||
typedef struct ShaderModuleDescriptor ShaderModuleDescriptor;
|
||||
|
||||
using Id = uint32_t;
|
||||
typedef uint32_t Id;
|
||||
|
||||
using DeviceId = Id;
|
||||
typedef Id DeviceId;
|
||||
|
||||
using AdapterId = Id;
|
||||
typedef Id AdapterId;
|
||||
|
||||
struct Extensions {
|
||||
typedef struct {
|
||||
bool anisotropic_filtering;
|
||||
};
|
||||
} Extensions;
|
||||
|
||||
struct DeviceDescriptor {
|
||||
typedef struct {
|
||||
Extensions extensions;
|
||||
};
|
||||
} DeviceDescriptor;
|
||||
|
||||
using ComputePassId = Id;
|
||||
typedef Id ComputePassId;
|
||||
|
||||
using RenderPassId = Id;
|
||||
typedef Id RenderPassId;
|
||||
|
||||
using CommandBufferId = Id;
|
||||
typedef Id CommandBufferId;
|
||||
|
||||
using InstanceId = Id;
|
||||
typedef Id InstanceId;
|
||||
|
||||
using ShaderModuleId = Id;
|
||||
typedef Id ShaderModuleId;
|
||||
|
||||
struct AdapterDescriptor {
|
||||
typedef struct {
|
||||
PowerPreference power_preference;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
} AdapterDescriptor;
|
||||
|
||||
DeviceId adapter_create_device(AdapterId adapter_id, DeviceDescriptor desc);
|
||||
|
||||
ComputePassId command_buffer_begin_compute_pass();
|
||||
ComputePassId command_buffer_begin_compute_pass(void);
|
||||
|
||||
RenderPassId command_buffer_begin_render_pass(CommandBufferId command_buffer);
|
||||
|
||||
InstanceId create_instance();
|
||||
InstanceId create_instance(void);
|
||||
|
||||
ShaderModuleId device_create_shader_module(DeviceId device_id, ShaderModuleDescriptor desc);
|
||||
|
||||
AdapterId instance_get_adapter(InstanceId instance_id, AdapterDescriptor desc);
|
||||
|
||||
} // extern "C"
|
||||
|
@ -8,6 +8,7 @@ fn main() {
|
||||
|
||||
cbindgen::Builder::new()
|
||||
.with_crate(crate_dir)
|
||||
.with_language(cbindgen::Language::C)
|
||||
.generate()
|
||||
.expect("Unable to generate bindings")
|
||||
.write_to_file("bindings.h");
|
||||
|
Loading…
Reference in New Issue
Block a user