working POC

This commit is contained in:
2026-01-11 23:40:50 +01:00
parent 10da5ee648
commit 39a8eb63bc
12 changed files with 301 additions and 198 deletions

View File

@@ -19,7 +19,7 @@ pub fn main() !void {
try rt.callEntryPoint(allocator, try rt.getEntryPointByName("main"));
var output: [4]f32 = undefined;
try rt.readOutput(f32, output[0..output.len], try rt.getResultByName("color"));
std.log.info("Result: Vec4[{d}, {d}, {d}, {d}]", .{ output[0], output[1], output[2], output[3] });
std.log.info("Output: Vec4[{d}, {d}, {d}, {d}]", .{ output[0], output[1], output[2], output[3] });
}
std.log.info("Successfully executed", .{});
}

View File

@@ -10,6 +10,6 @@ struct FragOut
fn main() -> FragOut
{
let output: FragOut;
output.color = vec4[f32](1.0, 1.0, 1.0, 1.0);
output.color = vec4[f32](4.0, 3.0, 2.0, 1.0);
return output;
}

Binary file not shown.

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.0
; Generator: SirLynix Nazara ShaderLang Compiler; 4226
; Bound: 20
; Bound: 23
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -24,17 +24,20 @@
%_ptr_Function_FragOut = OpTypePointer Function %FragOut
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%float_4 = OpConstant %float 4
%float_3 = OpConstant %float 3
%float_2 = OpConstant %float 2
%float_1 = OpConstant %float 1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%color = OpVariable %_ptr_Output_v4float Output
%main = OpFunction %void None %2
%13 = OpLabel
%14 = OpVariable %_ptr_Function_FragOut Function
%15 = OpCompositeConstruct %v4float %float_1 %float_1 %float_1 %float_1
%16 = OpAccessChain %_ptr_Function_v4float %14 %int_0
OpStore %16 %15
%18 = OpLoad %FragOut %14
%19 = OpCompositeExtract %v4float %18 0
OpStore %color %19
%16 = OpLabel
%17 = OpVariable %_ptr_Function_FragOut Function
%18 = OpCompositeConstruct %v4float %float_4 %float_3 %float_2 %float_1
%19 = OpAccessChain %_ptr_Function_v4float %17 %int_0
OpStore %19 %18
%21 = OpLoad %FragOut %17
%22 = OpCompositeExtract %v4float %21 0
OpStore %color %22
OpReturn
OpFunctionEnd