跳转到正文

Options 与条件 ​

行为与约束 ​

option 的 id/type/default/impact 是权威定义;name/description 只用于展示。类型为 boolean、integer、number、string,default 与 override 必须同类型并满足 min/max 或 allowed。JSON boolean 不是整数;字符串枚举值区分大小写。范围和 allowed 的支持组合见完整 Schema,不把省略的 min/max 推断成零。

impact 为 uniform、program、pipeline、resources,声明改动会影响哪一层重建。它不是“永远免重编译”的承诺:数据、defines、资源及活动分支依赖仍需验证。UI 不能再次定义类型、硬范围、默认值或 impact。

Pass 的 enabled 是显式开关;enabledWhen、资源 binding/semantic/service 条件等使用 option 加 equals 或 oneOf。每个条件值先通过被引用 option 的类型及范围校验,条件数组共同约束活动性。设置 UI 使用不同的 equals/notEquals/in 条件合同,不应混写。

离线图需要指定与目标运行一致的 options/capabilities。关闭 Pass 后检查活动的 Program、Resource、Service 与前后依赖闭包,不能只看声明节点仍在图中就断言它仍分配。未满足依赖或非法条件在加载/解析阶段失败;不会靠执行时跳过来掩盖错误。

自动生成的 v5 结构 ​

必需性只针对所展示的对象/分支。Schema 没写 default 不表示运行时没有默认值。完整定义保留条件规则;Loader 另行解析 ID、所有权、预算及设备约束。

option · v5 ​

字段 / 分支本对象必需性结构约束
allowedoptional heretype="array"; minItems=1; uniqueItems=true; items=#/$defs/optionScalar
defaultrequired$ref="#/$defs/optionScalar"
descriptionoptional heretype="string"
idrequired$ref="#/$defs/identifier"
impactrequiredtype="array"; uniqueItems=true
maxoptional heretype="number"
minoptional heretype="number"
nameoptional heretype="string"
typerequiredenum=["boolean","integer","number","string"]
完整结构规则: #/$defs/option
json
{
  "additionalProperties": false,
  "allOf": [
    {
      "if": {
        "properties": {
          "type": {
            "const": "boolean"
          }
        },
        "required": [
          "type"
        ]
      },
      "then": {
        "properties": {
          "allowed": {
            "items": {
              "type": "boolean"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
          },
          "default": {
            "type": "boolean"
          },
          "max": {
            "not": {}
          },
          "min": {
            "not": {}
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "integer"
          }
        },
        "required": [
          "type"
        ]
      },
      "then": {
        "properties": {
          "allowed": {
            "items": {
              "type": "integer"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
          },
          "default": {
            "type": "integer"
          },
          "max": {
            "type": "integer"
          },
          "min": {
            "type": "integer"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "number"
          }
        },
        "required": [
          "type"
        ]
      },
      "then": {
        "properties": {
          "allowed": {
            "items": {
              "type": "number"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
          },
          "default": {
            "type": "number"
          },
          "max": {
            "type": "number"
          },
          "min": {
            "type": "number"
          }
        }
      }
    },
    {
      "if": {
        "properties": {
          "type": {
            "const": "string"
          }
        },
        "required": [
          "type"
        ]
      },
      "then": {
        "properties": {
          "allowed": {
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "type": "array",
            "uniqueItems": true
          },
          "default": {
            "type": "string"
          },
          "max": {
            "not": {}
          },
          "min": {
            "not": {}
          }
        }
      }
    },
    {
      "not": {
        "required": [
          "allowed",
          "min"
        ]
      }
    },
    {
      "not": {
        "required": [
          "allowed",
          "max"
        ]
      }
    },
    {
      "oneOf": [
        {
          "required": [
            "min",
            "max"
          ]
        },
        {
          "not": {
            "anyOf": [
              {
                "required": [
                  "min"
                ]
              },
              {
                "required": [
                  "max"
                ]
              }
            ]
          }
        }
      ]
    }
  ],
  "properties": {
    "allowed": {
      "items": {
        "$ref": "#/$defs/optionScalar"
      },
      "minItems": 1,
      "type": "array",
      "uniqueItems": true
    },
    "default": {
      "$ref": "#/$defs/optionScalar"
    },
    "description": {
      "type": "string"
    },
    "id": {
      "$ref": "#/$defs/identifier"
    },
    "impact": {
      "items": {
        "enum": [
          "uniform",
          "program",
          "pipeline",
          "resources"
        ]
      },
      "type": "array",
      "uniqueItems": true
    },
    "max": {
      "type": "number"
    },
    "min": {
      "type": "number"
    },
    "name": {
      "type": "string"
    },
    "type": {
      "enum": [
        "boolean",
        "integer",
        "number",
        "string"
      ]
    }
  },
  "required": [
    "id",
    "type",
    "default",
    "impact"
  ],
  "type": "object"
}

optionScalar · v5 ​

type=["boolean","integer","number","string"]

完整结构规则: #/$defs/optionScalar
json
{
  "type": [
    "boolean",
    "integer",
    "number",
    "string"
  ]
}

condition · v5 ​

字段 / 分支本对象必需性结构约束
equalsoptional here$ref="#/$defs/optionScalar"
oneOfoptional heretype="array"; minItems=1; uniqueItems=true; items=#/$defs/optionScalar
optionrequired$ref="#/$defs/identifier"
完整结构规则: #/$defs/condition
json
{
  "additionalProperties": false,
  "allOf": [
    {
      "oneOf": [
        {
          "required": [
            "equals"
          ]
        },
        {
          "required": [
            "oneOf"
          ]
        }
      ]
    }
  ],
  "properties": {
    "equals": {
      "$ref": "#/$defs/optionScalar"
    },
    "oneOf": {
      "items": {
        "$ref": "#/$defs/optionScalar"
      },
      "minItems": 1,
      "type": "array",
      "uniqueItems": true
    },
    "option": {
      "$ref": "#/$defs/identifier"
    }
  },
  "required": [
    "option"
  ],
  "type": "object"
}

完整示例 ​

来源与机器记录 ​

字段归属清单 · Schema v5 · Catalog v2 · Completion v2

schema-v3 · schema-v4 · schema-v5 · completion-v1 · completion-v2 · temporal · settings-guide ·

ShaderPackManifestLoader.cs

作者文档 · Manifest v5 / Scene ABI v2