载入中...
搜索中...
未找到
ShaderAsset.cpp
浏览该文件的文档.
9Result<std::vector<std::uint32_t>> stage(const Value& value, std::uint32_t model, const ShaderAssetLimits& limits) {
13 Diagnostic::error(DiagnosticCode::InvalidArgument, "Shader stage size is invalid", {}, {}, "asset.shader"));
17 if (!word.isInt64() || word.asInt() < 0 || word.asInt() > std::numeric_limits<std::uint32_t>::max())
19 Diagnostic::error(DiagnosticCode::InvalidArgument, "Shader stage requires unsigned 32-bit words", {},
23 if (words[0] != 0x07230203 || words[1] < 0x00010000 || words[1] > 0x00010600 || (words[1] & 0xff) != 0 ||
26 Diagnostic::error(DiagnosticCode::InvalidArgument, "Unsupported SPIR-V header", {}, {}, "asset.shader"));
39 if (main || words[cursor + 1] != model || words[cursor + 2] == 0 || words[cursor + 2] >= words[3])
60 for (const auto name : {"schema", "schemaVersion", "interface", "format", "vertex", "fragment", "parameters"})
71 DiagnosticCode::InvalidArgument, "Unsupported shader format/interface", {}, {}, "asset.shader"));
78 Diagnostic::error(DiagnosticCode::InvalidArgument, "Unsupported shader interface", {}, {}, "asset.shader"));
87 if (!object || object->size() != 2 || !object->contains("name") || !object->contains("default") ||
90 Diagnostic::error(DiagnosticCode::InvalidArgument, "Invalid parameter fields", {}, {}, "asset.shader"));
93 if (name.empty() || name.size() > 128 || name.find('\0') != std::string::npos || !names.insert(name).second ||
102 Diagnostic::error(DiagnosticCode::InvalidArgument, "Non-numeric default", {}, {}, "asset.shader"));
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={}, DiagnosticDetails details={}, std::string source={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.h:125
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
Definition AssetCooker.cpp:17
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:54
@ InvalidArgument
@ UnknownVersion
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
std::vector< ShaderAssetParameter > parameters
Definition ShaderAsset.h:30