Harbor

Changelog 2c68a4ce6899

pin gpu stencil capability

@sky · 1 month ago · parent 210928be2339
0 added 5 modified 0 deleted
gpu/backend/backend.odin +1 -1 modified
50 unchanged lines hidden
51 51 implemented_base_capabilities :: proc(
52 52 max_color_targets, max_push_constant_size: u32,
53 53 ) -> Capabilities {
54 - features := Capability_Flags{.Compute_Dispatch, .Storage_Buffers, .Indirect_Draws, .Offscreen_Targets, .Sampled_Targets}
54 + features := Capability_Flags{.Compute_Dispatch, .Storage_Buffers, .Indirect_Draws, .Offscreen_Targets, .Sampled_Targets, .Stencil_Clips}
55 55 if max_color_targets > 1 {
56 56 features += {.Multiple_Render_Targets}
57 57 }
711 unchanged lines hidden
gpu/docs/gpu_intent_api.md +2 -2 modified
207 unchanged lines hidden
208 208
209 209 Targets can be present or offscreen. Target desc owns size, format, load/store, clear values, and sample/present usage.
210 210
211 - Clips start with rect/scissor. Mask clips are semantic `Clip_Handle` records whose source is geometry coverage rendered into stencil. The backend stencil contract exists below the IR: render pass descriptors carry stencil load/store, packed depth-stencil formats expose a stencil aspect, pipeline state carries front/back compare/ops/masks/ref, and each backend maps that state to native stencil state. Planned mask lowering and proof scenes are still pending.
211 + Clips start with rect/scissor. Mask clips are semantic `Clip_Handle` records whose source is geometry coverage rendered into stencil. The backend stencil contract exists below the IR: render pass descriptors carry stencil load/store, packed depth-stencil formats expose a stencil aspect, pipeline state carries front/back compare/ops/masks/ref, and each backend maps that state to native stencil state. Planned mask lowering is implemented as stencil-write plus stencil-test draw variants, and proof scenes exist for trusted readback validation.
212 212
213 213 `gpu` may drop packets fully outside target bounds or clip bounds. It must not decide semantic hidden state.
214 214
15 unchanged lines hidden
230 230
231 231 - `max_color_targets` reports the implemented color attachment count. Vulkan, D3D11, D3D12, and OpenGL currently report `8` because planned IR lowering, render pass/framebuffer arrays, pipeline color-attachment metadata, and backend RTV/FBO/render-pass binding support are implemented across all targets.
232 232 - `max_push_constant_size` reports the implemented push-constant byte limit for the selected backend. Pipeline and compute-shader creation must reject sizes above this limit.
233 - - `Multiple_Render_Targets` and `Indirect_Draws` are implemented for the planned backend path. Mask clip IR and backend stencil descriptor/state plumbing exist, but `Stencil_Clips` remains false until planned mask lowering, synchronization diagnostics, visual proof scenes, and runtime matrix rows pass across all required backends. Texture-alpha/discard masking does not count as stencil clipping.
233 + - `Multiple_Render_Targets`, `Indirect_Draws`, and `Stencil_Clips` are implemented for the planned backend path. `Stencil_Clips` means the public IR, planned lowering, and backend stencil state contract are wired end-to-end; the runtime parity ledger remains open until trusted readback matrix rows pass across the required Vulkan, OpenGL, D3D11, and D3D12 backends. Texture-alpha/discard masking does not count as stencil clipping.
234 234
235 235 Public API must not expose Vulkan/D3D-specific terms except through backend-only layers.
236 236
28 unchanged lines hidden
gpu/examples/parity_stencil_clip/main.odin +0 -1 modified
177 unchanged lines hidden
178 178 if backend == nil || backend.read_texture_rgba8 == nil {
179 179 fail("parity_stencil_clip: backend readback unsupported")
180 180 }
181 - backend.capabilities.features += {.Stencil_Clips}
182 181
183 182 mode := os.get_env("GPU_PROOF_MODE", context.allocator)
184 183 readback_path := os.get_env("GPU_PROOF_READBACK", context.allocator)
42 unchanged lines hidden
gpu/tests/capabilities_test.odin +1 -1 modified
27 unchanged lines hidden
28 28 testing.expect(t, bk.supports(caps, .Sampled_Targets))
29 29 testing.expect(t, bk.supports(caps, .Indirect_Draws))
30 30 testing.expect(t, !bk.supports(caps, .Multiple_Render_Targets))
31 - testing.expect(t, !bk.supports(caps, .Stencil_Clips))
31 + testing.expect(t, bk.supports(caps, .Stencil_Clips))
32 32 testing.expect_value(t, caps.max_color_targets, u32(1))
33 33 testing.expect_value(t, caps.max_push_constant_size, u32(240))
34 34 testing.expect_value(t, caps.max_frames_in_flight, u32(bk.MAX_FRAMES_IN_FLIGHT))
84 unchanged lines hidden
gpu/tests/compiler_executor_test.odin modified

Diff hidden because this file has more than 800 lines.