Skip to content

Commit 048bc30

Browse files
committed
Add debug/log
1 parent 6f6b10d commit 048bc30

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

extensions/2.0/Khronos/KHR_interactivity/Specification.adoc

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3883,6 +3883,100 @@ When the `in` input flow is activated:
38833883
2. Send the custom event.
38843884
3. Activate the `out` output flow.
38853885

3886+
=== Debug Nodes
3887+
3888+
==== Debug Output Nodes
3889+
3890+
===== Log
3891+
3892+
[cols="1h,1,2"]
3893+
|===
3894+
| Operation | `debug/log` | Output a debug message
3895+
.2+| Configuration
3896+
| `int severity` | Message severity
3897+
| `string message` | Message template
3898+
| Input flow sockets
3899+
| `in` | The entry flow into this node
3900+
| Input value sockets
3901+
| `<any> <parameter>` | Zero or more message template parameters to be evaluated at runtime; input value socket ids correspond to the message substrings wrapped with curly brackets (`{}`)
3902+
| Output flow sockets
3903+
| `out` | The flow to be activated after the message was logged
3904+
|===
3905+
3906+
[CAUTION]
3907+
====
3908+
The configuration of this node affects its value sockets.
3909+
====
3910+
3911+
This node builds a debug message from the specified template string and input socket values as described below and outputs the message to the user in an implementation-defined manner.
3912+
3913+
The `severity` configuration value is intended for filtering messages based on the implementation configuration. The `message` configuration value contains the debug message template string that defines the user-facing text message and input value socket ids (if any).
3914+
3915+
The value socket ids are substrings of the `message` value wrapped with curly brackets (`{}`); they are extracted as described below. Literal curly brackets present in the message template string **MUST** be doubled.
3916+
3917+
The type `any` represents any value socket type including custom types. This nodes implies that all value types have implementation-defined string representations.
3918+
3919+
In the default configuration, the `severity` configuration value is zero, the `message` configuration string is empty, and the node has no input value sockets.
3920+
3921+
If the `severity` configuration property is not provided by the behavior graph, if it is not a literal number, or if its value is not exactly representable as a 32-bit signed integer, the default configuration **MUST** be used.
3922+
3923+
[TIP]
3924+
.Implementation Tip
3925+
====
3926+
The integer representation check is implementable in ECMAScript via the following expression:
3927+
[source,js]
3928+
----
3929+
s === (s | 0)
3930+
----
3931+
====
3932+
3933+
If the `message` configuration property is not provided by the behavior graph, if it is not a literal string, or if its value is not syntactically valid as described below, the default configuration **MUST** be used.
3934+
3935+
The following procedure outputs input value socket id locations within the `message` configuration string and returns whether the string is syntactically valid:
3936+
3937+
1. Let _state_ be a temporary integer variable initialized to zero. During the procedure execution, its value will always be one of 0, 1, 2, or 3.
3938+
2. Let _paramStart_ be a temporary integer variable initialized to unspecified value.
3939+
3. Let `M[i]` be the character (Unicode code point) of the `message` configuration string at the position `i` (zero-based).
3940+
4. For `i` from zero (inclusive) to the `message` length (exclusive), do:
3941+
.. If `M[i]` is `"{"` (without quotes):
3942+
... If _state_ is 0, set _state_ to 1;
3943+
... else if _state_ is 1, set _state_ to 0;
3944+
... else (if _state_ is 2 or 3) return false.
3945+
.. Else if `M[i]` is `"}"` (without quotes):
3946+
... If _state_ is 0, set _state_ to 3;
3947+
... else if _state_ is 3, set _state_ to 0;
3948+
... else if _state_ is 2,
3949+
.... output the (_paramStart_, `i`) tuple as the inclusive range defining the template parameter location in the `message` string;
3950+
.... set _state_ to 0;
3951+
... else (if _state_ is 1) return false.
3952+
.. Else if `M[i]` is neither `"{"` nor `"}"` (without quotes):
3953+
... If _state_ is 1,
3954+
.... set _paramStart_ to `i - 1`;
3955+
.... set _state_ to 2;
3956+
... else if _state_ is 3, return false.
3957+
5. If _state_ is not 0, return false.
3958+
6. Return true.
3959+
3960+
If the procedure above returns false, the `message` configuration string is invalid and the default configuration is used. If the procedure above returns true, node's input value socket ids match the substrings identified by the template parameter locations with curly brackets removed.
3961+
3962+
Extra input value sockets with ids not present in the output of the procedure above do not affect the node's operation and validation but they still **MUST** have valid types and value sources.
3963+
3964+
This node has no internal state.
3965+
3966+
When the `in` input flow is activated:
3967+
3968+
1. Evaluate all input values.
3969+
2. Generate the effective message string as follows.
3970+
.. Let _M_ be a copy of the `message` configuration value.
3971+
.. For each element of the template parameter array taken in the descending order of parameter substring locations:
3972+
... Convert the corresponding input socket value to its string representation.
3973+
... If the string representation of the input socket value contains curly brackets, they **MUST** be doubled.
3974+
... Update _M_ by replacing the template parameter substring, as identified by the template parameter location, with the string representation of the corresponding input value socket. Note that the same template parameter **MAY** appear at multiple locations.
3975+
.. Update _M_ by replacing all occurrences of the `"{{"` substring in it with `"{"` (without quotes).
3976+
.. Update _M_ by replacing all occurrences of the `"}}"` substring in it with `"}"` (without quotes).
3977+
3. Output _M_ as the effective message string.
3978+
4. Activate the `out` output flow.
3979+
38863980
== Extending glTF Object Model
38873981

38883982
This Specification defines additional glTF Object Model pointers for use with `pointer/*` nodes.

0 commit comments

Comments
 (0)