Implementing garbage collector, tables, renderer and virtual machine.

This commit is contained in:
paladin 2026-08-16 12:06:30 +01:00
parent eba41e4330
commit 35cf269781
10 changed files with 683 additions and 1327 deletions

View file

@ -1,12 +0,0 @@
local two
do
local one
if something then
local three
print(something)
end
local four
if something2 then
end
end

View file

@ -1,19 +1,35 @@
// Vertex shader
@group(1) @binding(0)
var<uniform> view: mat4x4<f32>;
struct VertexInput {
@location(0) position: vec3<f32>,
@location(1) tex_coords: vec2<f32>,
}
struct VertexOutput {
@builtin(position) clip_position: vec4<f32>,
};
@location(0) tex_coords: vec2<f32>,
}
@vertex
fn vs_main(
@builtin(vertex_index) in_vertex_index: u32,
model: VertexInput,
) -> VertexOutput {
var out: VertexOutput;
let x = f32(1 - i32(in_vertex_index)) * 0.5;
let y = f32(i32(in_vertex_index & 1u) * 2 - 1) * 0.5;
out.clip_position = vec4<f32>(x, y, 0.0, 1.0);
out.tex_coords = model.tex_coords;
out.clip_position = view * vec4<f32>(model.position, 1.0);
return out;
}
// Fragment shader
@group(0) @binding(0)
var t_diffuse: texture_2d<f32>;
@group(0) @binding(1)
var s_diffuse: sampler;
@fragment
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
return vec4<f32>(0.3, 0.2, 0.1, 1.0);
return textureSample(t_diffuse, s_diffuse, in.tex_coords);
}