载入中...
搜索中...
未找到
ShaderAsset.cpp
浏览该文件的文档.
11Result<std::vector<std::uint32_t>> stage(const Value& value, std::uint32_t model, const ShaderAssetLimits& limits) {
15 Diagnostic::error(DiagnosticCode::InvalidArgument, "Shader stage size is invalid", {}, {}, "asset.shader"));
19 if (!word.isInt64() || word.asInt() < 0 || word.asInt() > std::numeric_limits<std::uint32_t>::max())
21 Diagnostic::error(DiagnosticCode::InvalidArgument, "Shader stage requires unsigned 32-bit words", {},
25 if (words[0] != 0x07230203 || words[1] < 0x00010000 || words[1] > 0x00010600 || (words[1] & 0xff) != 0 ||
28 Diagnostic::error(DiagnosticCode::InvalidArgument, "Unsupported SPIR-V header", {}, {}, "asset.shader"));
41 if (main || words[cursor + 1] != model || words[cursor + 2] == 0 || words[cursor + 2] >= words[3])
62 for (const auto name : {"schema", "schemaVersion", "interface", "format", "vertex", "fragment", "parameters"})
73 DiagnosticCode::InvalidArgument, "Unsupported shader format/interface", {}, {}, "asset.shader"));
80 Diagnostic::error(DiagnosticCode::InvalidArgument, "Unsupported shader interface", {}, {}, "asset.shader"));
89 if (!object || object->size() != 2 || !object->contains("name") || !object->contains("default") ||
92 Diagnostic::error(DiagnosticCode::InvalidArgument, "Invalid parameter fields", {}, {}, "asset.shader"));
95 if (name.empty() || name.size() > 128 || name.find('\0') != std::string::npos || !names.insert(name).second ||
104 Diagnostic::error(DiagnosticCode::InvalidArgument, "Non-numeric default", {}, {}, "asset.shader"));
129 Diagnostic::error(DiagnosticCode::Unsupported, "eve.shader/1 requires Vulkan", {}, {}, "asset.shader"));
132 if (payload.value().chunks.size() != 1 || payload.value().chunks.front().kind != EvpackChunkKind::Definition)
Typed capability-aware runtime access to admitted packs.
JSON-free versioned runtime metadata codec.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Immutable reader retaining an admitted pack by shared ownership.
Definition EvpackResourceReader.h:29
Result< RuntimeAssetPayload > read(const AssetRef &asset, std::string_view expectedType, const EvpackCapabilities &capabilities, std::uint64_t maximumDecodedBytes) const
Resolve, type-check, variant-select and decode a canonical runtime asset.
Definition EvpackRegistry.cpp:257
Definition AssetCooker.cpp:19
Result< ShaderAsset > loadShaderAsset(const EvpackResourceReader &reader, const AssetRef &asset, const EvpackCapabilities &capabilities)
Read and decode one capability-selected eve.shader/1 from an admitted runtime package.
Definition ShaderAsset.cpp:125
Result< Value > decodeRuntimeDefinition(std::span< const std::uint8_t > bytes, const RuntimeDefinitionLimits &limits)
Decode a bounded EVDEF\0\1 metadata tree without a JSON parser.
Definition RuntimeDefinition.cpp:246
Result< ShaderAsset > decodeShaderAsset(const Value &definition, const ShaderAssetLimits &limits)
Decode strict eve.shader/1 metadata with SPIR-V 1.0 through 1.6 stages.
Definition ShaderAsset.cpp:56
@ Definition
@ InvalidArgument
@ UnknownVersion
@ Unsupported
Actual runtime device capabilities used for variant selection.
Definition Evpack.h:92
Structural and allocation limits for untrusted EVDEF metadata.
Definition RuntimeDefinition.h:17
std::uint64_t maximumBytes
Definition RuntimeDefinition.h:18
Admission bounds checked before copying stage words.
Definition ShaderAsset.h:34
One sequential float/vector push-constant parameter, owned by the definition.
Definition ShaderAsset.h:20
Owning CPU program snapshot; decoding does not prove GPU/descriptor compatibility.
Definition ShaderAsset.h:26