I hereby claim:
- I am porky11 on github.
- I am p11c (https://keybase.io/p11c) on keybase.
- I have a public key ASBrGtYp5LVvVFnoqp4tDM_62JBR73iSum8dBEYlXBEMMQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
A direct conversion of this vulkan example to C
| using import ..pijul.utils.va | |
| #inline va-pos (val args...) | |
| va-lifold none | |
| inline "#hidden" (i key arg result) | |
| dump i key arg result | |
| static-if (not (none? result)) result | |
| elseif (arg == val) i | |
| else result | |
| args... |
| import .glfw | |
| fn start-glfw () | |
| if ((glfw.init) == 0) | |
| return; | |
| defer glfw.terminate | |
| let window = | |
| glfw.createWindow 640 480 "Hello World" null null | |
| if (window == null) |
| inline value-to-number-maker (number-type) | |
| fn (value) | |
| match ('typeof value) | |
| case i8 | |
| number-type | |
| value as i8 | |
| case i16 | |
| number-type | |
| value as i16 | |
| case i32 |
| #version 450 | |
| layout(location = 0) in vec2 v_TexCoord; | |
| layout(location = 0) out vec4 o_Target; | |
| layout(set = 0, binding = 1) uniform texture2D t_Color; | |
| layout(set = 0, binding = 2) uniform sampler s_Color; | |
| void main() { | |
| o_Target = texture(sampler2D(t_Color, s_Color), v_TexCoord); | |
| } |
| #version 460 | |
| layout(local_size_x = 4, local_size_y = 4, local_size_z = 4) in; | |
| struct Sphere { | |
| vec4 center; | |
| }; | |
| layout(binding = 1, std140) uniform Camera { | |
| vec4 pos; | |
| vec4 dir; |
| local layout-bindings = | |
| arrayof wgpu.BindGroupLayoutBinding | |
| typeinit | |
| binding = 0 | |
| visibility = wgpu.ShaderStage.COMPUTE | |
| ty = wgpu.BindingType.StorageTexture | |
| let size = 0x10 | |
| let texture = |
| inline va-type@ (T args...) | |
| va-lfold none | |
| inline "#hidden" (key value) | |
| static-if ((typeof value) <= T) | |
| return value | |
| args... | |
| inline va-type@... (T args...) | |
| va-rfold none | |
| inline (key value result...) |
| using import struct | |
| inline Slice (T) | |
| struct ("[" .. (tostring T) .. "]") | |
| first : (mutable pointer T) | |
| size : usize | |
| inline __countof (self) | |
| self.size | |
| fn slice (array start end) |