forked from gfx-rs/wgpu
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
140 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
**/*.rs.bk | ||
#Cargo.lock | ||
.vscode | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
all: hello_world_c | ||
|
||
CC=gcc | ||
CFLAGS=-I. | ||
DEPS=./../wgpu-bindings/wgpu.h | ||
OUTDIR=./build | ||
LINK_ARGS=-L ./../target/debug -lwgpu_native | ||
|
||
%.o: %.c $(DEPS) | ||
$(CC) $(LINK_ARGS) -c -o $(OUTDIR)/$@ $< $(CFLAGS) | ||
|
||
hello_world_c: hello_triangle_c/main.c | ||
mkdir -p $(OUTDIR) | ||
$(CC) $(LINK_ARGS) -o $(OUTDIR)/$@ $^ $(CFLAGS) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <stdio.h> | ||
#include "./../../wgpu-bindings/wgpu.h" | ||
|
||
int main() | ||
{ | ||
WGPUInstanceId instance = wgpu_create_instance(); | ||
WGPUAdapterDescriptor adapter_desc = { | ||
.power_preference = WGPUPowerPreference_LowPower, | ||
}; | ||
WGPUAdapterId adapter = wgpu_instance_get_adapter(instance, adapter_desc); | ||
WGPUDeviceDescriptor device_desc = { | ||
.extensions = { | ||
.anisotropic_filtering = false, | ||
}, | ||
}; | ||
WGPUDeviceId device = wgpu_adapter_create_device(adapter, device_desc); | ||
/*WGPUShaderModuleDescriptor vs_desc = { | ||
.code = "", | ||
}; | ||
WGPUShaderModuleId _vs = wgpu_device_create_shader_module(device, vs_desc); | ||
*/ | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
extern crate wgpu_native; | ||
use wgpu_native::*; | ||
|
||
fn main() { | ||
let instance = wgpu_create_instance(); | ||
let adapter = wgpu_instance_get_adapter( | ||
instance, | ||
AdapterDescriptor { | ||
power_preference: PowerPreference::LowPower, | ||
}, | ||
); | ||
let device = wgpu_adapter_create_device( | ||
adapter, | ||
DeviceDescriptor { | ||
extensions: Extensions { | ||
anisotropic_filtering: false, | ||
}, | ||
}, | ||
); | ||
let _vs = wgpu_device_create_shader_module( | ||
device, | ||
ShaderModuleDescriptor { | ||
code: include_bytes!("./../data/hello_triangle.vert.spv"), | ||
}, | ||
); | ||
let _fs = wgpu_device_create_shader_module( | ||
device, | ||
ShaderModuleDescriptor { | ||
code: include_bytes!("./../data/hello_triangle.frag.spv"), | ||
}, | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#include <stdint.h> | ||
#include <stdlib.h> | ||
#include <stdbool.h> | ||
|
||
typedef enum { | ||
WGPUPowerPreference_Default = 0, | ||
WGPUPowerPreference_LowPower = 1, | ||
WGPUPowerPreference_HighPerformance = 2, | ||
} WGPUPowerPreference; | ||
|
||
typedef struct WGPUShaderModuleDescriptor WGPUShaderModuleDescriptor; | ||
|
||
typedef uint32_t WGPUId; | ||
|
||
typedef WGPUId WGPUDeviceId; | ||
|
||
typedef WGPUId WGPUAdapterId; | ||
|
||
typedef struct { | ||
bool anisotropic_filtering; | ||
} WGPUExtensions; | ||
|
||
typedef struct { | ||
WGPUExtensions extensions; | ||
} WGPUDeviceDescriptor; | ||
|
||
typedef WGPUId WGPUComputePassId; | ||
|
||
typedef WGPUId WGPURenderPassId; | ||
|
||
typedef WGPUId WGPUCommandBufferId; | ||
|
||
typedef WGPUId WGPUInstanceId; | ||
|
||
typedef WGPUId WGPUShaderModuleId; | ||
|
||
typedef struct { | ||
WGPUPowerPreference power_preference; | ||
} WGPUAdapterDescriptor; | ||
|
||
WGPUDeviceId wgpu_adapter_create_device(WGPUAdapterId adapter_id, WGPUDeviceDescriptor desc); | ||
|
||
WGPUComputePassId wgpu_command_buffer_begin_compute_pass(void); | ||
|
||
WGPURenderPassId wgpu_command_buffer_begin_render_pass(WGPUCommandBufferId command_buffer); | ||
|
||
WGPUInstanceId wgpu_create_instance(void); | ||
|
||
WGPUShaderModuleId wgpu_device_create_shader_module(WGPUDeviceId device_id, | ||
WGPUShaderModuleDescriptor desc); | ||
|
||
WGPUAdapterId wgpu_instance_get_adapter(WGPUInstanceId instance_id, WGPUAdapterDescriptor desc); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters