Logical Render Pipelines and Command Packets
JaCoCo Coverage #### Project Overview No changes detected, that affect the code coverage. * Line Coverage: 61.06% (17124/28043) * Branch Coverage: 51.92% (6584/12681) * Lines of Code: 28043 * Cyclomatic Complexity: 11219 #### Quality Gates Summary Output truncated.
Test / Build skipped: 15, passed: 594
Intrepid/Prometeu/Studio/pipeline/head This commit looks good

This commit is contained in:
2026-05-25 19:34:19 +01:00
parent 81437b1fc3
commit 3f99e90ac8
29 changed files with 195 additions and 194 deletions
@@ -1,18 +1,18 @@
declare host LowComposer {
[Host(module = "composer", name = "set_camera", version = 1)]
[Capability(name = "gfx")]
[Capability(name = "composer")]
fn set_camera(x: int, y: int) -> void;
[Host(module = "composer", name = "bind_scene", version = 1)]
[Capability(name = "gfx")]
[Capability(name = "composer")]
fn bind_scene(scene_bank_id: int) -> int;
[Host(module = "composer", name = "unbind_scene", version = 1)]
[Capability(name = "gfx")]
[Capability(name = "composer")]
fn unbind_scene() -> int;
[Host(module = "composer", name = "emit_sprite", version = 1)]
[Capability(name = "gfx")]
[Capability(name = "composer")]
fn emit_sprite(
glyph_id: int,
palette_id: int,
@@ -1,32 +1,32 @@
import { Color } from @core:color;
declare host LowGfx {
[Host(module = "gfx", name = "clear", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "clear", version = 1)]
[Capability(name = "gfx2d")]
fn clear(color: Color) -> void;
[Host(module = "gfx", name = "fill_rect", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "fill_rect", version = 1)]
[Capability(name = "gfx2d")]
fn fill_rect(x: int, y: int, w: int, h: int, color: Color) -> void;
[Host(module = "gfx", name = "draw_line", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_line", version = 1)]
[Capability(name = "gfx2d")]
fn draw_line(x1: int, y1: int, x2: int, y2: int, color: Color) -> void;
[Host(module = "gfx", name = "draw_circle", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_circle", version = 1)]
[Capability(name = "gfx2d")]
fn draw_circle(x: int, y: int, r: int, color: Color) -> void;
[Host(module = "gfx", name = "draw_disc", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_disc", version = 1)]
[Capability(name = "gfx2d")]
fn draw_disc(x: int, y: int, r: int, border_color: Color, fill_color: Color) -> void;
[Host(module = "gfx", name = "draw_square", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_square", version = 1)]
[Capability(name = "gfx2d")]
fn draw_square(x: int, y: int, w: int, h: int, border_color: Color, fill_color: Color) -> void;
[Host(module = "gfx", name = "draw_text", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_text", version = 1)]
[Capability(name = "gfx2d")]
fn draw_text(x: int, y: int, message: str, color: Color) -> void;
}
@@ -131,7 +131,7 @@ class PbsDiagnosticsContractTest {
void shouldTagHostAdmissionDiagnosticsWithHostAdmissionPhase() {
final var source = """
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
fn draw_pixel(x: int, y: int) -> void;
}
""";
@@ -441,8 +441,8 @@ class PbsFrontendCompilerTest {
) {
}
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw_pixel(x: int, y: int, color: Color) -> void;
}
[BuiltinConst(target = "Color", name = "white", version = 1)]
@@ -459,7 +459,7 @@ class PbsFrontendCompilerTest {
assertEquals(1, fileBackend.reservedMetadata().builtinTypeSurfaces().size());
assertEquals(1, fileBackend.reservedMetadata().builtinConstSurfaces().size());
assertEquals(1, fileBackend.reservedMetadata().requiredCapabilities().size());
assertEquals("gfx", fileBackend.reservedMetadata().requiredCapabilities().getFirst());
assertEquals("gfx2d", fileBackend.reservedMetadata().requiredCapabilities().getFirst());
assertEquals("Color", fileBackend.reservedMetadata().builtinTypeSurfaces().getFirst().canonicalTypeName());
assertEquals(1, fileBackend.reservedMetadata().builtinTypeSurfaces().getFirst().fields().size());
}
@@ -671,7 +671,7 @@ class PbsFrontendCompilerTest {
void shouldRejectHostBindingWithoutCapabilityAtHostAdmission() {
final var source = """
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
fn draw_pixel(x: int, y: int) -> void;
}
""";
@@ -693,8 +693,8 @@ class PbsFrontendCompilerTest {
void shouldRejectHostBindingCapabilityNotDeclaredInStrictContext() {
final var source = """
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw_pixel(x: int, y: int) -> void;
}
""";
@@ -719,7 +719,7 @@ class PbsFrontendCompilerTest {
void shouldRejectUnknownHostCapabilityAtHostAdmission() {
final var source = """
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "video")]
fn draw_pixel(x: int, y: int) -> void;
}
@@ -740,7 +740,7 @@ class PbsFrontendCompilerTest {
void shouldRejectMalformedHostCapabilityMetadataAtHostAdmission() {
final var source = """
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(version = 1)]
fn draw_pixel(x: int, y: int) -> void;
}
@@ -51,8 +51,8 @@ class PbsGateUSdkInterfaceConformanceTest {
}
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw_pixel(x: int, y: int, color: Color) -> void;
}
""";
@@ -114,7 +114,7 @@ class PbsGateUSdkInterfaceConformanceTest {
&& t.intrinsics().stream().anyMatch(i -> i.canonicalName().equals("input.button.hold"))));
assertTrue(positive.irBackend().getReservedMetadata().hostMethodBindings().stream()
.anyMatch(h -> h.ownerName().equals("LowGfx")
&& h.abiModule().equals("gfx")
&& h.abiModule().equals("gfx2d")
&& h.abiMethod().equals("clear")
&& h.abiVersion() == 1));
assertTrue(positive.irBackend().getReservedMetadata().hostMethodBindings().stream()
@@ -254,8 +254,8 @@ class PbsGateUSdkInterfaceConformanceTest {
}
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw_pixel(x: int, y: int, color: Color) -> void;
}
""";
@@ -319,8 +319,8 @@ class PbsGateUSdkInterfaceConformanceTest {
}
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw_pixel(x: int, y: int, color: Color) -> void;
}
@@ -364,7 +364,7 @@ class PbsGateUSdkInterfaceConformanceTest {
void gateU_shouldEmitHostAdmissionDiagnosticForMissingCapabilityMetadata() {
final var source = """
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
fn draw_pixel(x: int, y: int) -> void;
}
""";
@@ -223,8 +223,8 @@ class PbsModuleVisibilityTest {
final var sourceAst = parseSource(
"""
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw_pixel(x: int, y: int) -> void;
}
""",
@@ -136,8 +136,8 @@ class PbsParserTest {
@Test
void shouldRejectAttributesInOrdinarySourceAndRecover() {
final var source = """
[Host(module = "gfx", name = "draw", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw", version = 1)]
[Capability(name = "gfx2d")]
fn run() -> int { return 1; }
declare struct Point(x: int,);
""";
@@ -305,8 +305,8 @@ class PbsParserTest {
fn pack() -> int;
}
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw(x: int, y: int, color: Color) -> void;
}
[BuiltinConst(target = "Color", name = "white", version = 1)]
@@ -343,8 +343,8 @@ class PbsParserTest {
void shouldRecoverFromMalformedReservedDeclarationsInInterfaceModuleMode() {
final var source = """
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw(x: int, y: int) -> void;
unexpected_token
}
@@ -23,8 +23,8 @@ class PbsInterfaceModuleSemanticsTest {
}
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw_pixel(x: int, y: int, c: Color) -> void;
}
@@ -51,8 +51,8 @@ class PbsInterfaceModuleSemanticsTest {
}
declare contract Api {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn run() -> void;
}
@@ -104,15 +104,15 @@ class InterfaceModuleLoaderTest {
"""
declare host LowComposer {
[Host(module = "composer", name = "bind_scene", version = 1)]
[Capability(name = "gfx")]
[Capability(name = "composer")]
fn bind_scene(scene_bank_id: int) -> int;
[Host(module = "composer", name = "unbind_scene", version = 1)]
[Capability(name = "gfx")]
[Capability(name = "composer")]
fn unbind_scene() -> int;
[Host(module = "composer", name = "emit_sprite", version = 1)]
[Capability(name = "gfx")]
[Capability(name = "composer")]
fn emit_sprite(
glyph_id: int,
palette_id: int,
@@ -647,8 +647,8 @@ class PBSFrontendPhaseServiceTest {
fn pack() -> int;
}
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw(x: int, y: int, color: Color) -> void;
}
""");
@@ -721,8 +721,8 @@ class PBSFrontendPhaseServiceTest {
"gfx.pbs",
"""
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw(x: int, y: int) -> void;
}
"""))),
@@ -1328,8 +1328,8 @@ class PBSFrontendPhaseServiceTest {
"main.pbs",
"""
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Capability(name = "gfx")]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "gfx2d")]
fn draw_pixel(x: int, y: int) -> void;
}
"""))),
@@ -1547,7 +1547,7 @@ class PBSFrontendPhaseServiceTest {
"main.pbs",
"""
declare host Gfx {
[Host(module = "gfx", name = "draw_pixel", version = 1)]
[Host(module = "gfx2d", name = "draw_pixel", version = 1)]
[Capability(name = "unknown_capability")]
fn draw_pixel(x: int, y: int) -> void;
}
@@ -2013,7 +2013,7 @@ class PBSFrontendPhaseServiceTest {
"gfx.pbs",
"""
declare host Gfx {
[Host(module = "gfx", name = "clear", version = 1)]
[Host(module = "gfx2d", name = "clear", version = 1)]
fn clear() -> void;
}
"""))),
@@ -2079,7 +2079,7 @@ class PBSFrontendPhaseServiceTest {
"gfx.pbs",
"""
declare host Gfx {
[Host(module = "gfx", name = "clear", version = 1)]
[Host(module = "gfx2d", name = "clear", version = 1)]
[InitAllowed]
fn clear() -> void;
}
@@ -59,7 +59,7 @@ class GoldenArtifactsTest {
new IRBackendExecutableFunction.Instruction(
IRBackendExecutableFunction.InstructionKind.CALL_HOST,
"",
new IRBackendExecutableFunction.HostCallMetadata("gfx", "draw_pixel", 1, 0, 0),
new IRBackendExecutableFunction.HostCallMetadata("gfx2d", "draw_pixel", 1, 0, 0),
null,
Span.none()),
new IRBackendExecutableFunction.Instruction(
@@ -53,7 +53,7 @@ class BytecodeLinkPrecheckServiceTest {
codeHostcall(3),
null,
ReadOnlyList.empty(),
ReadOnlyList.from(new BytecodeModule.SyscallDecl("gfx", "draw_pixel", 1, 0, 0)));
ReadOnlyList.from(new BytecodeModule.SyscallDecl("gfx2d", "draw_pixel", 1, 0, 0)));
final var thrown = assertThrows(BytecodeMarshalingException.class, () -> service.validate(module));
assertEquals(BytecodeMarshalingErrorCode.MARSHAL_VERIFY_PRECHECK_HOSTCALL_INDEX_INVALID, thrown.code());
@@ -226,7 +226,7 @@ class IRVMValidatorTest {
1,
ReadOnlyList.from(
BytecodeEmitter.Operation.hostcall(
new BytecodeModule.SyscallDecl("gfx", "draw_pixel", 1, 1, 0),
new BytecodeModule.SyscallDecl("gfx2d", "draw_pixel", 1, 1, 0),
1,
0),
BytecodeEmitter.Operation.ret()))));
@@ -211,7 +211,7 @@ class LowerToIRVMServiceTest {
.entryPointModuleId(new ModuleId(0))
.executableFunctions(ReadOnlyList.from(
fn("main", "app", 10, ReadOnlyList.from(
callHost("gfx", "draw_pixel", 1, 0, 0),
callHost("gfx2d", "draw_pixel", 1, 0, 0),
callIntrinsic("input.pad", 1, 0),
ret()))))
.intrinsicPool(ReadOnlyList.from(new IntrinsicReference("input.pad", 1)))
@@ -29,7 +29,7 @@ class OptimizeIRVMEquivalenceHarnessTest {
.entryPointModuleId(new p.studio.compiler.source.identifiers.ModuleId(0))
.executableFunctions(ReadOnlyList.from(
fn("main", 1, ReadOnlyList.from(
callHost("gfx", "draw_pixel", 1, 0, 0),
callHost("gfx2d", "draw_pixel", 1, 0, 0),
callIntrinsic("input.pad", 1, 0, 0, 0),
ret()))))
.intrinsicPool(ReadOnlyList.from(new IntrinsicReference("input.pad", 1)))
@@ -45,7 +45,7 @@ class BackendGateIIntegrationTest {
void gateI_validHostcallPath() {
final var module = emitFromBackend(backendWithSingleFunction(
fn("main", ReadOnlyList.from(
callHost("gfx", "draw_pixel", 1, 0, 0),
callHost("gfx2d", "draw_pixel", 1, 0, 0),
ret()))));
final var check = compatibilityAdapter.check(module);
@@ -65,7 +65,7 @@ class BackendGateIIntegrationTest {
codeHostcall(1),
null,
ReadOnlyList.empty(),
ReadOnlyList.from(new BytecodeModule.SyscallDecl("gfx", "draw_pixel", 1, 1, 0)));
ReadOnlyList.from(new BytecodeModule.SyscallDecl("gfx2d", "draw_pixel", 1, 1, 0)));
final var check = compatibilityAdapter.check(module);
assertEquals(CompatibilityError.HOSTCALL_INDEX_OUT_OF_BOUNDS, check.error());
@@ -80,7 +80,7 @@ class BackendGateIIntegrationTest {
codeRet(),
null,
ReadOnlyList.empty(),
ReadOnlyList.from(new BytecodeModule.SyscallDecl("gfx", "draw_pixel", 1, 1, 0)));
ReadOnlyList.from(new BytecodeModule.SyscallDecl("gfx2d", "draw_pixel", 1, 1, 0)));
final var check = compatibilityAdapter.check(module);
assertEquals(CompatibilityError.UNUSED_SYSC_DECL, check.error());
@@ -116,7 +116,7 @@ class BackendGateIIntegrationTest {
1,
ReadOnlyList.from(
BytecodeEmitter.Operation.hostcall(
new BytecodeModule.SyscallDecl("gfx", "draw_pixel", 1, 2, 0),
new BytecodeModule.SyscallDecl("gfx2d", "draw_pixel", 1, 2, 0),
1,
0),
BytecodeEmitter.Operation.ret()))))));
@@ -128,12 +128,12 @@ class BackendGateIIntegrationTest {
void gateI_rejectMissingCapability() {
final var module = emitFromBackend(backendWithSingleFunction(
fn("main", ReadOnlyList.from(
callHost("gfx", "draw_pixel", 1, 0, 0),
callHost("gfx2d", "draw_pixel", 1, 0, 0),
ret()))));
final var caps = Set.of("input");
final var required = new HashMap<String, String>();
required.put("gfx::draw_pixel::1", "gfx");
required.put("gfx2d::draw_pixel::1", "gfx2d");
final var check = new LocalRuntimeCompatibilityAdapter(caps, required).check(module);
assertEquals(CompatibilityError.MISSING_CAPABILITY, check.error());
}
@@ -15,7 +15,7 @@ final class LocalRuntimeCompatibilityAdapter implements RuntimeCompatibilityAdap
private final String runtimeLine;
LocalRuntimeCompatibilityAdapter() {
this(Set.of("gfx", "input", "audio", "system"), Map.of(), "runtime-local-sim-v1");
this(Set.of("gfx2d", "composer", "input", "audio", "system"), Map.of(), "runtime-local-sim-v1");
}
LocalRuntimeCompatibilityAdapter(
@@ -1 +1 @@
504253000000000004000000000000000000000000000000000000000000000001000000500000001400000002000000640000000e00000003000000720000004400000005000000b60000001b00000001000000000000000e000000000000000000020071000000000072000020000051000300000000000000010000000000000000000000060000000100000000000000000000000c0000000100000000000000000000000100000000000000040000006d61696e0100000003006766780a00647261775f706978656c010000000000
504253000000000004000000000000000000000000000000000000000000000001000000500000001400000002000000640000000e00000003000000720000004400000005000000b60000001d00000001000000000000000e000000000000000000020071000000000072000020000051000300000000000000010000000000000000000000060000000100000000000000000000000c0000000100000000000000000000000100000000000000040000006d61696e01000000050067667832640a00647261775f706978656c010000000000
@@ -14,7 +14,8 @@ public record HostAdmissionContext(
private static final ReadOnlyList<String> DEFAULT_KNOWN_CAPABILITIES = ReadOnlyList.wrap(List.of(
"system",
"gfx",
"gfx2d",
"composer",
"input",
"audio",
"fs",