mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 06:44:14 +00:00
Bindings update with the new cbindgen 0.6.7
This commit is contained in:
parent
6b9be3c08e
commit
9aa5977c22
6
Cargo.lock
generated
6
Cargo.lock
generated
@ -82,7 +82,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cbindgen"
|
||||
version = "0.6.6"
|
||||
version = "0.6.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1033,7 +1033,7 @@ dependencies = [
|
||||
name = "wgpu-bindings"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"cbindgen 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cbindgen 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1140,7 +1140,7 @@ dependencies = [
|
||||
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
||||
"checksum block 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
|
||||
"checksum byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "90492c5858dd7d2e78691cfb89f90d273a2800fc11d98f60786e5d87e2f83781"
|
||||
"checksum cbindgen 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "660a462ad3acdc79f83dcc84161d9e87f01cb29754b7ab5196785e1f0c11f714"
|
||||
"checksum cbindgen 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "cafae60cd9e63287b58380b61a06a221cfdabc504db112dab0e32f21e5ce9014"
|
||||
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
|
||||
"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3"
|
||||
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <stdio.h>
|
||||
#include "./../../wgpu-bindings/wgpu.h"
|
||||
|
||||
#define STAGES_LENGTH (2)
|
||||
#define BLEND_STATE_LENGTH (1)
|
||||
#define FORMATS_LENGTH (1)
|
||||
#define STAGES_LENGTH (2)
|
||||
#define BLEND_STATES_LENGTH (1)
|
||||
#define ATTACHMENTS_LENGTH (1)
|
||||
|
||||
WGPUByteArray read_file(const char *name)
|
||||
{
|
||||
@ -86,7 +86,7 @@ int main()
|
||||
.write_mask = 0,
|
||||
};
|
||||
WGPUBlendStateId blend_state_0 = wgpu_device_create_blend_state(device, &blend_state_0_desc);
|
||||
WGPUBlendStateId blend_state[BLEND_STATE_LENGTH] = { blend_state_0 };
|
||||
WGPUBlendStateId blend_state[BLEND_STATES_LENGTH] = { blend_state_0 };
|
||||
|
||||
WGPUStencilStateFaceDescriptor stencil_state_front = {
|
||||
.compare = WGPUCompareFunction_Never,
|
||||
@ -110,22 +110,27 @@ int main()
|
||||
};
|
||||
WGPUDepthStencilStateId depth_stencil_state = wgpu_device_create_depth_stencil_state(device, &depth_stencil_state_desc);
|
||||
|
||||
WGPUTextureFormat formats[FORMATS_LENGTH] = { WGPUTextureFormat_R8g8b8a8Unorm };
|
||||
WGPUAttachmentStateDescriptor attachment_state_desc = {
|
||||
.formats = formats,
|
||||
.formats_length = FORMATS_LENGTH,
|
||||
WGPUAttachment attachments[ATTACHMENTS_LENGTH] = {
|
||||
{
|
||||
.format = WGPUTextureFormat_R8g8b8a8Unorm,
|
||||
.samples = 1,
|
||||
},
|
||||
};
|
||||
WGPUAttachmentsState attachment_state = {
|
||||
.color_attachments = attachments,
|
||||
.color_attachments_length = ATTACHMENTS_LENGTH,
|
||||
.depth_stencil_attachment = NULL,
|
||||
};
|
||||
WGPUAttachmentStateId attachment_state = wgpu_device_create_attachment_state(device, &attachment_state_desc);
|
||||
|
||||
WGPURenderPipelineDescriptor render_pipeline_desc = {
|
||||
.layout = layout,
|
||||
.stages = stages,
|
||||
.stages_length = STAGES_LENGTH,
|
||||
.primitive_topology = WGPUPrimitiveTopology_TriangleList,
|
||||
.attachments_state = attachment_state,
|
||||
.blend_states = blend_state,
|
||||
.blend_states_length = BLEND_STATE_LENGTH,
|
||||
.blend_states_length = BLEND_STATES_LENGTH,
|
||||
.depth_stencil_state = depth_stencil_state,
|
||||
.attachment_state = attachment_state,
|
||||
};
|
||||
|
||||
WGPURenderPipelineId render_pipeline = wgpu_device_create_render_pipeline(device, &render_pipeline_desc);
|
||||
|
@ -10,4 +10,4 @@ authors = [
|
||||
default = []
|
||||
|
||||
[dependencies]
|
||||
cbindgen = "0.6.6"
|
||||
cbindgen = "0.6.7"
|
||||
|
@ -8,26 +8,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define WGPUColorWriteFlags_ALL 15
|
||||
|
||||
#define WGPUColorWriteFlags_ALPHA 8
|
||||
|
||||
#define WGPUColorWriteFlags_BLUE 4
|
||||
|
||||
#define WGPUColorWriteFlags_GREEN 2
|
||||
|
||||
#define WGPUColorWriteFlags_NONE 0
|
||||
|
||||
#define WGPUColorWriteFlags_RED 1
|
||||
|
||||
#define WGPUShaderStageFlags_COMPUTE 4
|
||||
|
||||
#define WGPUShaderStageFlags_FRAGMENT 2
|
||||
|
||||
#define WGPUShaderStageFlags_NONE 0
|
||||
|
||||
#define WGPUShaderStageFlags_VERTEX 1
|
||||
|
||||
typedef enum {
|
||||
WGPUBindingType_UniformBuffer = 0,
|
||||
WGPUBindingType_Sampler = 1,
|
||||
@ -114,7 +94,16 @@ typedef enum {
|
||||
WGPUTextureFormat_D32FloatS8Uint = 3,
|
||||
} WGPUTextureFormat;
|
||||
|
||||
typedef struct WGPURenderPassDescriptor_WGPUTextureViewId WGPURenderPassDescriptor_WGPUTextureViewId;
|
||||
typedef enum {
|
||||
WGPUTextureViewDimension_D1,
|
||||
WGPUTextureViewDimension_D2,
|
||||
WGPUTextureViewDimension_D2Array,
|
||||
WGPUTextureViewDimension_Cube,
|
||||
WGPUTextureViewDimension_CubeArray,
|
||||
WGPUTextureViewDimension_D3,
|
||||
} WGPUTextureViewDimension;
|
||||
|
||||
typedef struct WGPURenderPassDescriptor_TextureViewId WGPURenderPassDescriptor_TextureViewId;
|
||||
|
||||
typedef WGPUId WGPUDeviceId;
|
||||
|
||||
@ -136,13 +125,6 @@ typedef WGPUId WGPURenderPassId;
|
||||
|
||||
typedef WGPUId WGPUInstanceId;
|
||||
|
||||
typedef WGPUId WGPUAttachmentStateId;
|
||||
|
||||
typedef struct {
|
||||
const WGPUTextureFormat *formats;
|
||||
uintptr_t formats_length;
|
||||
} WGPUAttachmentStateDescriptor;
|
||||
|
||||
typedef WGPUId WGPUBindGroupLayoutId;
|
||||
|
||||
typedef uint32_t WGPUShaderStageFlags;
|
||||
@ -214,15 +196,26 @@ typedef struct {
|
||||
const char *entry_point;
|
||||
} WGPUPipelineStageDescriptor;
|
||||
|
||||
typedef struct {
|
||||
WGPUTextureFormat format;
|
||||
uint32_t samples;
|
||||
} WGPUAttachment;
|
||||
|
||||
typedef struct {
|
||||
const WGPUAttachment *color_attachments;
|
||||
uintptr_t color_attachments_length;
|
||||
const WGPUAttachment *depth_stencil_attachment;
|
||||
} WGPUAttachmentsState;
|
||||
|
||||
typedef struct {
|
||||
WGPUPipelineLayoutId layout;
|
||||
const WGPUPipelineStageDescriptor *stages;
|
||||
uintptr_t stages_length;
|
||||
WGPUPrimitiveTopology primitive_topology;
|
||||
WGPUAttachmentsState attachments_state;
|
||||
const WGPUBlendStateId *blend_states;
|
||||
uintptr_t blend_states_length;
|
||||
WGPUDepthStencilStateId depth_stencil_state;
|
||||
WGPUAttachmentStateId attachment_state;
|
||||
} WGPURenderPipelineDescriptor;
|
||||
|
||||
typedef struct {
|
||||
@ -258,45 +251,91 @@ typedef struct {
|
||||
WGPUPowerPreference power_preference;
|
||||
} WGPUAdapterDescriptor;
|
||||
|
||||
#define WGPUBLACK (Color){ .r = 0, .g = 0, .b = 0, .a = 1 }
|
||||
typedef WGPUId WGPUTextureViewId;
|
||||
|
||||
#define WGPUBLUE (Color){ .r = 0, .g = 0, .b = 1, .a = 1 }
|
||||
typedef uint32_t WGPUTextureAspectFlags;
|
||||
|
||||
#define WGPUEXTEND (TrackPermit){ .bits = 1 }
|
||||
typedef struct {
|
||||
WGPUTextureFormat format;
|
||||
WGPUTextureViewDimension dimension;
|
||||
WGPUTextureAspectFlags aspect;
|
||||
uint32_t base_mip_level;
|
||||
uint32_t level_count;
|
||||
uint32_t base_array_layer;
|
||||
uint32_t array_count;
|
||||
} WGPUTextureViewDescriptor;
|
||||
|
||||
#define WGPUGREEN (Color){ .r = 0, .g = 1, .b = 0, .a = 1 }
|
||||
#define WGPUBufferUsageFlags_INDEX (BufferUsageFlags){ .bits = 16 }
|
||||
|
||||
#define WGPUINDEX (BufferUsageFlags){ .bits = 16 }
|
||||
#define WGPUBufferUsageFlags_MAP_READ (BufferUsageFlags){ .bits = 1 }
|
||||
|
||||
#define WGPUMAP_READ (BufferUsageFlags){ .bits = 1 }
|
||||
#define WGPUBufferUsageFlags_MAP_WRITE (BufferUsageFlags){ .bits = 2 }
|
||||
|
||||
#define WGPUMAP_WRITE (BufferUsageFlags){ .bits = 2 }
|
||||
#define WGPUBufferUsageFlags_NONE (BufferUsageFlags){ .bits = 0 }
|
||||
|
||||
#define WGPUNONE (BufferUsageFlags){ .bits = 0 }
|
||||
#define WGPUBufferUsageFlags_STORAGE (BufferUsageFlags){ .bits = 128 }
|
||||
|
||||
#define WGPUOUTPUT_ATTACHMENT (TextureUsageFlags){ .bits = 16 }
|
||||
#define WGPUBufferUsageFlags_TRANSFER_DST (BufferUsageFlags){ .bits = 8 }
|
||||
|
||||
#define WGPUPRESENT (TextureUsageFlags){ .bits = 32 }
|
||||
#define WGPUBufferUsageFlags_TRANSFER_SRC (BufferUsageFlags){ .bits = 4 }
|
||||
|
||||
#define WGPURED (Color){ .r = 1, .g = 0, .b = 0, .a = 1 }
|
||||
#define WGPUBufferUsageFlags_UNIFORM (BufferUsageFlags){ .bits = 64 }
|
||||
|
||||
#define WGPUREPLACE (TrackPermit){ .bits = 2 }
|
||||
#define WGPUBufferUsageFlags_VERTEX (BufferUsageFlags){ .bits = 32 }
|
||||
|
||||
#define WGPUSAMPLED (TextureUsageFlags){ .bits = 4 }
|
||||
#define WGPUColorWriteFlags_ALL (ColorWriteFlags){ .bits = 15 }
|
||||
|
||||
#define WGPUSTORAGE (BufferUsageFlags){ .bits = 128 }
|
||||
#define WGPUColorWriteFlags_ALPHA (ColorWriteFlags){ .bits = 8 }
|
||||
|
||||
#define WGPUTRANSFER_DST (BufferUsageFlags){ .bits = 8 }
|
||||
#define WGPUColorWriteFlags_BLUE (ColorWriteFlags){ .bits = 4 }
|
||||
|
||||
#define WGPUTRANSFER_SRC (BufferUsageFlags){ .bits = 4 }
|
||||
#define WGPUColorWriteFlags_COLOR (ColorWriteFlags){ .bits = 7 }
|
||||
|
||||
#define WGPUTRANSPARENT (Color){ .r = 0, .g = 0, .b = 0, .a = 0 }
|
||||
#define WGPUColorWriteFlags_GREEN (ColorWriteFlags){ .bits = 2 }
|
||||
|
||||
#define WGPUUNIFORM (BufferUsageFlags){ .bits = 64 }
|
||||
#define WGPUColorWriteFlags_RED (ColorWriteFlags){ .bits = 1 }
|
||||
|
||||
#define WGPUVERTEX (BufferUsageFlags){ .bits = 32 }
|
||||
#define WGPUColor_BLACK (Color){ .r = 0, .g = 0, .b = 0, .a = 1 }
|
||||
|
||||
#define WGPUWHITE (Color){ .r = 1, .g = 1, .b = 1, .a = 1 }
|
||||
#define WGPUColor_BLUE (Color){ .r = 0, .g = 0, .b = 1, .a = 1 }
|
||||
|
||||
#define WGPUColor_GREEN (Color){ .r = 0, .g = 1, .b = 0, .a = 1 }
|
||||
|
||||
#define WGPUColor_RED (Color){ .r = 1, .g = 0, .b = 0, .a = 1 }
|
||||
|
||||
#define WGPUColor_TRANSPARENT (Color){ .r = 0, .g = 0, .b = 0, .a = 0 }
|
||||
|
||||
#define WGPUColor_WHITE (Color){ .r = 1, .g = 1, .b = 1, .a = 1 }
|
||||
|
||||
#define WGPUShaderStageFlags_COMPUTE (ShaderStageFlags){ .bits = 4 }
|
||||
|
||||
#define WGPUShaderStageFlags_FRAGMENT (ShaderStageFlags){ .bits = 2 }
|
||||
|
||||
#define WGPUShaderStageFlags_VERTEX (ShaderStageFlags){ .bits = 1 }
|
||||
|
||||
#define WGPUTextureAspectFlags_COLOR (TextureAspectFlags){ .bits = 1 }
|
||||
|
||||
#define WGPUTextureAspectFlags_DEPTH (TextureAspectFlags){ .bits = 2 }
|
||||
|
||||
#define WGPUTextureAspectFlags_STENCIL (TextureAspectFlags){ .bits = 4 }
|
||||
|
||||
#define WGPUTextureUsageFlags_NONE (TextureUsageFlags){ .bits = 0 }
|
||||
|
||||
#define WGPUTextureUsageFlags_OUTPUT_ATTACHMENT (TextureUsageFlags){ .bits = 16 }
|
||||
|
||||
#define WGPUTextureUsageFlags_PRESENT (TextureUsageFlags){ .bits = 32 }
|
||||
|
||||
#define WGPUTextureUsageFlags_SAMPLED (TextureUsageFlags){ .bits = 4 }
|
||||
|
||||
#define WGPUTextureUsageFlags_STORAGE (TextureUsageFlags){ .bits = 8 }
|
||||
|
||||
#define WGPUTextureUsageFlags_TRANSFER_DST (TextureUsageFlags){ .bits = 2 }
|
||||
|
||||
#define WGPUTextureUsageFlags_TRANSFER_SRC (TextureUsageFlags){ .bits = 1 }
|
||||
|
||||
#define WGPUTrackPermit_EXTEND (TrackPermit){ .bits = 1 }
|
||||
|
||||
#define WGPUTrackPermit_REPLACE (TrackPermit){ .bits = 2 }
|
||||
|
||||
WGPUDeviceId wgpu_adapter_create_device(WGPUAdapterId adapter_id,
|
||||
const WGPUDeviceDescriptor *_desc);
|
||||
@ -304,15 +343,12 @@ WGPUDeviceId wgpu_adapter_create_device(WGPUAdapterId adapter_id,
|
||||
WGPUComputePassId wgpu_command_buffer_begin_compute_pass(WGPUCommandBufferId command_buffer_id);
|
||||
|
||||
WGPURenderPassId wgpu_command_buffer_begin_render_pass(WGPUCommandBufferId command_buffer_id,
|
||||
WGPURenderPassDescriptor_WGPUTextureViewId desc);
|
||||
WGPURenderPassDescriptor_TextureViewId desc);
|
||||
|
||||
WGPUCommandBufferId wgpu_compute_pass_end_pass(WGPUComputePassId pass_id);
|
||||
|
||||
WGPUInstanceId wgpu_create_instance(void);
|
||||
|
||||
WGPUAttachmentStateId wgpu_device_create_attachment_state(WGPUDeviceId device_id,
|
||||
const WGPUAttachmentStateDescriptor *desc);
|
||||
|
||||
WGPUBindGroupLayoutId wgpu_device_create_bind_group_layout(WGPUDeviceId device_id,
|
||||
const WGPUBindGroupLayoutDescriptor *desc);
|
||||
|
||||
@ -346,3 +382,8 @@ void wgpu_queue_submit(WGPUQueueId queue_id,
|
||||
uintptr_t command_buffer_count);
|
||||
|
||||
WGPUCommandBufferId wgpu_render_pass_end_pass(WGPURenderPassId pass_id);
|
||||
|
||||
WGPUTextureViewId wgpu_texture_create_default_texture_view(WGPUTextureId texture_id);
|
||||
|
||||
WGPUTextureViewId wgpu_texture_create_texture_view(WGPUTextureId texture_id,
|
||||
const WGPUTextureViewDescriptor *desc);
|
||||
|
Loading…
Reference in New Issue
Block a user