Skip to content

Commit 037e697

Browse files
authored
Merge pull request #4235 from oharboe/blender-3d-viewer
bazel: enable Blender 3D-viewer targets on every supported-PDK design
2 parents 2f6e9c9 + d74966a commit 037e697

5 files changed

Lines changed: 65 additions & 160 deletions

File tree

MODULE.bazel

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,22 @@ git_override(
3636
bazel_dep(name = "bazel-orfs", dev_dependency = True)
3737
bazel_dep(name = "bazel-orfs-verilog", dev_dependency = True)
3838

39-
BAZEL_ORFS_COMMIT = "ce6efd96dfe39a9c4ef244f8712386f071545d77"
39+
BAZEL_ORFS_COMMIT = "3a5ddd7eb48c363717e65903ae4573d528327fd3"
4040

4141
BAZEL_ORFS_REMOTE = "https://github.com/The-OpenROAD-Project/bazel-orfs.git"
4242

4343
# To bump version, run: bazelisk run @bazel-orfs//:bump
44+
#
45+
# `patches =` keeps small bazel-orfs fixes vendored in this repo while
46+
# we iterate, instead of round-tripping every change through a
47+
# bazel-orfs PR + pin bump. When a patch lands upstream, drop the
48+
# entry here and bump BAZEL_ORFS_COMMIT.
4449
git_override(
4550
module_name = "bazel-orfs",
4651
commit = BAZEL_ORFS_COMMIT,
4752
patch_strip = 1,
4853
patches = [
49-
# Adds orfs_design(user_sources=[VAR,...]) / orfs_flow(user_sources={...})
50-
# so design-private SOURCE_VARS path hooks (e.g. SDC_FILE_EXTRA in
51-
# flow/designs/asap7/mock-cpu) bypass the variables.yaml validator
52-
# without polluting the ORFS-wide variable schema. Drop once upstream
53-
# bazel-orfs lands the user_sources= API.
54-
"//bazel:0001-orfs_design-add-user_sources.patch",
54+
"//patches/bazel-orfs:0001-render_gds-monkey-patch-PDK_CONFIGS-not-gdsii_use_custom_config.patch",
5555
],
5656
remote = BAZEL_ORFS_REMOTE,
5757
)

bazel/0001-orfs_design-add-user_sources.patch

Lines changed: 0 additions & 153 deletions
This file was deleted.

flow/designs/design.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def design(config = "config.mk", user_arguments = [], user_sources = [], local_a
7474
user_arguments = user_arguments,
7575
user_sources = user_sources,
7676
local_arguments = local_arguments,
77+
blender = True,
7778
)
7879

7980
def files(group, extra_srcs = None):
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From 0010e181efa28210dbf7839e6e6131139cc705bd Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?=C3=98yvind=20Harboe?= <oyvind@ascenium.com>
3+
Date: Mon, 18 May 2026 00:06:14 +0200
4+
Subject: [PATCH] render_gds: monkey-patch PDK_CONFIGS instead of
5+
gdsii_use_custom_config
6+
7+
The addon's gdsii_use_custom_config=True branch in import_gdsii skips
8+
initialising pdk_info and addon_dir, both of which are still used a
9+
few lines later to resolve color_path -- so any non-default
10+
layerstack YAML trips UnboundLocalError inside the addon.
11+
12+
Patch the addon's PDK_CONFIGS dict at runtime instead, pointing the
13+
selected PDK's config_path entry at our trimmed YAML. The else
14+
branch then fires normally, pdk_info is set, color_path resolves,
15+
and Path's absolute-RHS semantic makes addon_dir / Path(abs_path)
16+
evaluate to the absolute path.
17+
---
18+
tools/blendergds/render_gds.py | 12 ++++++++++--
19+
1 file changed, 10 insertions(+), 2 deletions(-)
20+
21+
diff --git a/tools/blendergds/render_gds.py b/tools/blendergds/render_gds.py
22+
index cbe116c..b53da1e 100644
23+
--- a/tools/blendergds/render_gds.py
24+
+++ b/tools/blendergds/render_gds.py
25+
@@ -289,11 +289,19 @@ def main():
26+
# in seconds rather than 5-7 minutes + 16 GB RSS. No-op for
27+
# PDKs without a preset and for designs whose full stack is
28+
# already small enough.
29+
+ # We can't go through the addon's `gdsii_use_custom_config = True`
30+
+ # path: that branch in `import_gdsii` skips initialising
31+
+ # `pdk_info` and `addon_dir`, both of which are still used
32+
+ # afterwards to resolve `color_path` -- so a custom YAML trips
33+
+ # `UnboundLocalError: pdk_info` inside the addon. Instead,
34+
+ # monkey-patch PDK_CONFIGS[pdk]['config_path'] to point at the
35+
+ # trimmed YAML (absolute path -- `addon_dir / Path("/abs")`
36+
+ # evaluates to the absolute path in pathlib, so the else branch
37+
+ # in the addon picks it up correctly).
38+
trimmed = _trim_layerstack(addon, addon_root, args.pdk, tmp)
39+
if trimmed is not None:
40+
yaml_path, kept_layers, missing = trimmed
41+
- bpy.context.scene.gdsii_use_custom_config = True
42+
- bpy.context.scene.gdsii_config_path = str(yaml_path)
43+
+ addon.PDK_CONFIGS.setdefault(args.pdk, {})["config_path"] = str(yaml_path)
44+
_log_phase(
45+
"layerstack-trimmed",
46+
extra=(
47+
--
48+
2.51.0
49+

patches/bazel-orfs/BUILD.bazel

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"""Vendored patches applied on top of the bazel-orfs git_override pin.
2+
3+
These are small fixes we keep here to reduce churn while iterating;
4+
when they land upstream, drop the entry from MODULE.bazel and bump
5+
BAZEL_ORFS_COMMIT instead.
6+
"""
7+
8+
exports_files(glob(["*.patch"]))

0 commit comments

Comments
 (0)