Skip to content

Commit 78a51af

Browse files
committed
Merge branch 'LogicSchemaUpdate1.3' into 'release/v1.3'
[REMIX-4865] [REMIX-4839] Prevent component connections with invalid resolved types See merge request lightspeedrtx/dxvk-remix-nv!1860
2 parents be6eb09 + 6237657 commit 78a51af

File tree

89 files changed

+634
-1509
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+634
-1509
lines changed

src/dxvk/rtx_render/graph/rtx_graph_ogn_writer.cpp

Lines changed: 131 additions & 138 deletions
Large diffs are not rendered by default.
Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,23 @@
11
# GENERATED FILE - DO NOT EDIT
22
# This file is a stub for OmniGraph editor compatibility, and is not used by the Remix Runtime.
3-
from __future__ import annotations
4-
5-
from typing import TYPE_CHECKING
6-
73
import omni.graph.core as og
84

9-
if TYPE_CHECKING:
10-
from lightspeed.trex.logic.ogn.ogn.AddDatabase import AddDatabase
5+
from lightspeed.trex.logic.ogn._impl.type_resolution import resolve_types, standard_compute, standard_initialize
116

127

138
class Add:
14-
@staticmethod
15-
def compute(_db: AddDatabase):
16-
return True
9+
# fmt: off
10+
VALID_COMBINATIONS = [
11+
{"inputs:a": og.Type(og.BaseDataType.FLOAT), "inputs:b": og.Type(og.BaseDataType.FLOAT), "outputs:sum": og.Type(og.BaseDataType.FLOAT)},
12+
{"inputs:a": og.Type(og.BaseDataType.FLOAT, 2), "inputs:b": og.Type(og.BaseDataType.FLOAT, 2), "outputs:sum": og.Type(og.BaseDataType.FLOAT, 2)},
13+
{"inputs:a": og.Type(og.BaseDataType.FLOAT, 3), "inputs:b": og.Type(og.BaseDataType.FLOAT, 3), "outputs:sum": og.Type(og.BaseDataType.FLOAT, 3)},
14+
{"inputs:a": og.Type(og.BaseDataType.FLOAT, 4), "inputs:b": og.Type(og.BaseDataType.FLOAT, 4), "outputs:sum": og.Type(og.BaseDataType.FLOAT, 4)},
15+
]
16+
# fmt: on
17+
18+
compute = standard_compute
19+
initialize = standard_initialize
1720

1821
@staticmethod
1922
def on_connection_type_resolve(node) -> None:
20-
"""Resolve flexible types based on connected attribute types."""
21-
# Valid type combinations for this component:
22-
# Combination 1: a=float, b=float, sum=float
23-
# Combination 2: a=float[2], b=float[2], sum=float[2]
24-
# Combination 3: a=float[3], b=float[3], sum=float[3]
25-
# Combination 4: a=float[4], b=float[4], sum=float[4]
26-
27-
# Get attributes
28-
input_a = node.get_attribute("inputs:a")
29-
input_b = node.get_attribute("inputs:b")
30-
output_sum = node.get_attribute("outputs:sum")
31-
32-
# Get current types of connected attributes
33-
type_a = input_a.get_resolved_type()
34-
type_b = input_b.get_resolved_type()
35-
36-
# Check all valid type combinations and resolve output types
37-
if (type_a == og.Type(og.BaseDataType.FLOAT) and
38-
type_b == og.Type(og.BaseDataType.FLOAT)):
39-
output_sum.set_resolved_type(og.Type(og.BaseDataType.FLOAT))
40-
elif (type_a == og.Type(og.BaseDataType.FLOAT, 2) and
41-
type_b == og.Type(og.BaseDataType.FLOAT, 2)):
42-
output_sum.set_resolved_type(og.Type(og.BaseDataType.FLOAT, 2))
43-
elif (type_a == og.Type(og.BaseDataType.FLOAT, 3) and
44-
type_b == og.Type(og.BaseDataType.FLOAT, 3)):
45-
output_sum.set_resolved_type(og.Type(og.BaseDataType.FLOAT, 3))
46-
elif (type_a == og.Type(og.BaseDataType.FLOAT, 4) and
47-
type_b == og.Type(og.BaseDataType.FLOAT, 4)):
48-
output_sum.set_resolved_type(og.Type(og.BaseDataType.FLOAT, 4))
23+
resolve_types(node, Add.VALID_COMBINATIONS)
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
# GENERATED FILE - DO NOT EDIT
22
# This file is a stub for OmniGraph editor compatibility, and is not used by the Remix Runtime.
3-
from __future__ import annotations
4-
5-
from typing import TYPE_CHECKING
6-
7-
import omni.graph.core as og
8-
9-
if TYPE_CHECKING:
10-
from lightspeed.trex.logic.ogn.ogn.AngleToMeshDatabase import AngleToMeshDatabase
3+
from lightspeed.trex.logic.ogn._impl.type_resolution import resolve_types, standard_compute, standard_initialize
114

125

136
class AngleToMesh:
14-
@staticmethod
15-
def compute(_db: AngleToMeshDatabase):
16-
return True
7+
compute = standard_compute
8+
initialize = standard_initialize
179

1810
@staticmethod
1911
def on_connection_type_resolve(node) -> None:
20-
"""Resolve flexible types based on connected attribute types."""
21-
# Valid type combinations for this component:
22-
# Combination 1: angleDegrees=float, angleRadians=float, direction=float[3], directionToCentroid=float[3], target=target, worldPosition=float[3]
12+
resolve_types(node, [])
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
# GENERATED FILE - DO NOT EDIT
22
# This file is a stub for OmniGraph editor compatibility, and is not used by the Remix Runtime.
3-
from __future__ import annotations
4-
5-
from typing import TYPE_CHECKING
6-
7-
import omni.graph.core as og
8-
9-
if TYPE_CHECKING:
10-
from lightspeed.trex.logic.ogn.ogn.BetweenDatabase import BetweenDatabase
3+
from lightspeed.trex.logic.ogn._impl.type_resolution import resolve_types, standard_compute, standard_initialize
114

125

136
class Between:
14-
@staticmethod
15-
def compute(_db: BetweenDatabase):
16-
return True
7+
compute = standard_compute
8+
initialize = standard_initialize
179

1810
@staticmethod
1911
def on_connection_type_resolve(node) -> None:
20-
"""Resolve flexible types based on connected attribute types."""
21-
# Valid type combinations for this component:
22-
# Combination 1: maxValue=float, minValue=float, result=bool, value=float
12+
resolve_types(node, [])
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
# GENERATED FILE - DO NOT EDIT
22
# This file is a stub for OmniGraph editor compatibility, and is not used by the Remix Runtime.
3-
from __future__ import annotations
4-
5-
from typing import TYPE_CHECKING
6-
7-
import omni.graph.core as og
8-
9-
if TYPE_CHECKING:
10-
from lightspeed.trex.logic.ogn.ogn.BoolAndDatabase import BoolAndDatabase
3+
from lightspeed.trex.logic.ogn._impl.type_resolution import resolve_types, standard_compute, standard_initialize
114

125

136
class BoolAnd:
14-
@staticmethod
15-
def compute(_db: BoolAndDatabase):
16-
return True
7+
compute = standard_compute
8+
initialize = standard_initialize
179

1810
@staticmethod
1911
def on_connection_type_resolve(node) -> None:
20-
"""Resolve flexible types based on connected attribute types."""
21-
# Valid type combinations for this component:
22-
# Combination 1: a=bool, b=bool, result=bool
12+
resolve_types(node, [])
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
# GENERATED FILE - DO NOT EDIT
22
# This file is a stub for OmniGraph editor compatibility, and is not used by the Remix Runtime.
3-
from __future__ import annotations
4-
5-
from typing import TYPE_CHECKING
6-
7-
import omni.graph.core as og
8-
9-
if TYPE_CHECKING:
10-
from lightspeed.trex.logic.ogn.ogn.BoolNotDatabase import BoolNotDatabase
3+
from lightspeed.trex.logic.ogn._impl.type_resolution import resolve_types, standard_compute, standard_initialize
114

125

136
class BoolNot:
14-
@staticmethod
15-
def compute(_db: BoolNotDatabase):
16-
return True
7+
compute = standard_compute
8+
initialize = standard_initialize
179

1810
@staticmethod
1911
def on_connection_type_resolve(node) -> None:
20-
"""Resolve flexible types based on connected attribute types."""
21-
# Valid type combinations for this component:
22-
# Combination 1: input=bool, result=bool
12+
resolve_types(node, [])
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
# GENERATED FILE - DO NOT EDIT
22
# This file is a stub for OmniGraph editor compatibility, and is not used by the Remix Runtime.
3-
from __future__ import annotations
4-
5-
from typing import TYPE_CHECKING
6-
7-
import omni.graph.core as og
8-
9-
if TYPE_CHECKING:
10-
from lightspeed.trex.logic.ogn.ogn.BoolOrDatabase import BoolOrDatabase
3+
from lightspeed.trex.logic.ogn._impl.type_resolution import resolve_types, standard_compute, standard_initialize
114

125

136
class BoolOr:
14-
@staticmethod
15-
def compute(_db: BoolOrDatabase):
16-
return True
7+
compute = standard_compute
8+
initialize = standard_initialize
179

1810
@staticmethod
1911
def on_connection_type_resolve(node) -> None:
20-
"""Resolve flexible types based on connected attribute types."""
21-
# Valid type combinations for this component:
22-
# Combination 1: a=bool, b=bool, result=bool
12+
resolve_types(node, [])
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
# GENERATED FILE - DO NOT EDIT
22
# This file is a stub for OmniGraph editor compatibility, and is not used by the Remix Runtime.
3-
from __future__ import annotations
4-
5-
from typing import TYPE_CHECKING
6-
7-
import omni.graph.core as og
8-
9-
if TYPE_CHECKING:
10-
from lightspeed.trex.logic.ogn.ogn.CameraDatabase import CameraDatabase
3+
from lightspeed.trex.logic.ogn._impl.type_resolution import resolve_types, standard_compute, standard_initialize
114

125

136
class Camera:
14-
@staticmethod
15-
def compute(_db: CameraDatabase):
16-
return True
7+
compute = standard_compute
8+
initialize = standard_initialize
179

1810
@staticmethod
1911
def on_connection_type_resolve(node) -> None:
20-
"""Resolve flexible types based on connected attribute types."""
21-
# Valid type combinations for this component:
22-
# Combination 1: aspectRatio=float, farPlane=float, forward=float[3], fovDegrees=float, fovRadians=float, nearPlane=float, position=float[3], right=float[3], up=float[3]
12+
resolve_types(node, [])
Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
# GENERATED FILE - DO NOT EDIT
22
# This file is a stub for OmniGraph editor compatibility, and is not used by the Remix Runtime.
3-
from __future__ import annotations
4-
5-
from typing import TYPE_CHECKING
6-
7-
import omni.graph.core as og
8-
9-
if TYPE_CHECKING:
10-
from lightspeed.trex.logic.ogn.ogn.CeilDatabase import CeilDatabase
3+
from lightspeed.trex.logic.ogn._impl.type_resolution import resolve_types, standard_compute, standard_initialize
114

125

136
class Ceil:
14-
@staticmethod
15-
def compute(_db: CeilDatabase):
16-
return True
7+
compute = standard_compute
8+
initialize = standard_initialize
179

1810
@staticmethod
1911
def on_connection_type_resolve(node) -> None:
20-
"""Resolve flexible types based on connected attribute types."""
21-
# Valid type combinations for this component:
22-
# Combination 1: input=float, result=float
12+
resolve_types(node, [])
Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,23 @@
11
# GENERATED FILE - DO NOT EDIT
22
# This file is a stub for OmniGraph editor compatibility, and is not used by the Remix Runtime.
3-
from __future__ import annotations
4-
5-
from typing import TYPE_CHECKING
6-
73
import omni.graph.core as og
84

9-
if TYPE_CHECKING:
10-
from lightspeed.trex.logic.ogn.ogn.ClampDatabase import ClampDatabase
5+
from lightspeed.trex.logic.ogn._impl.type_resolution import resolve_types, standard_compute, standard_initialize
116

127

138
class Clamp:
14-
@staticmethod
15-
def compute(_db: ClampDatabase):
16-
return True
9+
# fmt: off
10+
VALID_COMBINATIONS = [
11+
{"inputs:value": og.Type(og.BaseDataType.FLOAT), "outputs:result": og.Type(og.BaseDataType.FLOAT)},
12+
{"inputs:value": og.Type(og.BaseDataType.FLOAT, 2), "outputs:result": og.Type(og.BaseDataType.FLOAT, 2)},
13+
{"inputs:value": og.Type(og.BaseDataType.FLOAT, 3), "outputs:result": og.Type(og.BaseDataType.FLOAT, 3)},
14+
{"inputs:value": og.Type(og.BaseDataType.FLOAT, 4), "outputs:result": og.Type(og.BaseDataType.FLOAT, 4)},
15+
]
16+
# fmt: on
17+
18+
compute = standard_compute
19+
initialize = standard_initialize
1720

1821
@staticmethod
1922
def on_connection_type_resolve(node) -> None:
20-
"""Resolve flexible types based on connected attribute types."""
21-
# Valid type combinations for this component:
22-
# Combination 1: maxValue=float, minValue=float, result=float, value=float
23-
# Combination 2: maxValue=float, minValue=float, result=float[2], value=float[2]
24-
# Combination 3: maxValue=float, minValue=float, result=float[3], value=float[3]
25-
# Combination 4: maxValue=float, minValue=float, result=float[4], value=float[4]
26-
27-
# Get attributes
28-
input_value = node.get_attribute("inputs:value")
29-
output_result = node.get_attribute("outputs:result")
30-
31-
# Get current types of connected attributes
32-
type_value = input_value.get_resolved_type()
33-
34-
# Check all valid type combinations and resolve output types
35-
if (type_value == og.Type(og.BaseDataType.FLOAT)):
36-
output_result.set_resolved_type(og.Type(og.BaseDataType.FLOAT))
37-
elif (type_value == og.Type(og.BaseDataType.FLOAT, 2)):
38-
output_result.set_resolved_type(og.Type(og.BaseDataType.FLOAT, 2))
39-
elif (type_value == og.Type(og.BaseDataType.FLOAT, 3)):
40-
output_result.set_resolved_type(og.Type(og.BaseDataType.FLOAT, 3))
41-
elif (type_value == og.Type(og.BaseDataType.FLOAT, 4)):
42-
output_result.set_resolved_type(og.Type(og.BaseDataType.FLOAT, 4))
23+
resolve_types(node, Clamp.VALID_COMBINATIONS)

0 commit comments

Comments
 (0)