载入中...
搜索中...
未找到
ArtifactProvider.cpp
浏览该文件的文档.
23bool readString(const eve::Value::Object& object, const char* name, std::string& output, bool allowEmpty = false) {
94 if (!integer || *integer < 0 || static_cast<std::uint64_t>(*integer) > std::numeric_limits<T>::max())
102std::uint64_t hashStreams(std::span<const float> positions, std::span<const float> normals, std::span<const float> uvs,
123const eve::artifact::PartView* selectedMesh(const eve::artifact::PublicationView& publication) noexcept {
126 if (part.kind == eve::artifact::PartKind::MeshData && (part.role == "mesh" || mesh == nullptr)) mesh = ∂
152void GraphicsArtifactProvider::uploadIfAvailable(Graphics* graphics, RuntimeResource& runtime) noexcept {
200 GraphicsArtifactStage(GraphicsArtifactProvider& owner, GraphicsArtifactResource resource, Mesh* uploadedMesh)
233eve::Result<std::unique_ptr<eve::artifact::PreparedPublication>> GraphicsArtifactProvider::prepare(
237 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact prepare failure was injected"));
239 return eve::Result<std::unique_ptr<eve::artifact::PreparedPublication>>::failure(eve::Diagnostic::error(
243 eve::Diagnostic::error(eve::DiagnosticCode::Conflict, "graphics artifact identity is already published"));
246 return eve::Result<std::unique_ptr<eve::artifact::PreparedPublication>>::failure(eve::Diagnostic::error(
247 eve::DiagnosticCode::PreconditionViolation, "graphics publication requires a complete mesh leaf"));
250 return eve::Result<std::unique_ptr<eve::artifact::PreparedPublication>>::failure(eve::Diagnostic::error(
254 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact handle index exhausted"));
271 std::make_unique<GraphicsArtifactStage>(*this, std::move(runtime.descriptor), runtime.uploadedMesh));
280 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact prepare allocation failed"));
305const GraphicsArtifactResource* GraphicsArtifactProvider::find(eve::PersistentId id) const noexcept {
316std::optional<GraphicsArtifactDescriptor> GraphicsArtifactProvider::descriptor(eve::PersistentId id) const {
383 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact snapshot allocation failed"));
397 const auto* resources = encodedResources ? encodedResources->getIf<eve::Value::Array>() : nullptr;
398 if (!object || !providerName || *providerName != "graphics.resource-provider" || !hasSupportedVersion(*object) ||
401 eve::Diagnostic::error(eve::DiagnosticCode::UnknownVersion, "invalid graphics artifact provider state"));
427 if (!item || !readString(*item, "artifactId", idText) || !readString(*item, "buildKey", buildKey) ||
470 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact restore allocation failed"));
A structured explanation of a failed, degraded, or noteworthy result.
Definition Diagnostic.h:94
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
static constexpr RuntimeHandle fromPacked(std::uint64_t value) noexcept
Reconstructs a handle from an explicit packed boundary value.
Definition RuntimeHandle.h:190
static constexpr index_type invalidIndex
Reserved index value shared by all invalid handles.
Definition RuntimeHandle.h:124
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
const T * getIf() const noexcept
Return a typed pointer, or nullptr when the kind differs.
Definition Value.h:180
Value * find(const std::string &key) noexcept
Return an object member, or nullptr when absent.
Definition Value.cpp:124
A prepared consumer mutation with a non-throwing visibility boundary.
Definition ArtifactPublication.h:102
constexpr bool isNil() const noexcept
Returns whether this value is the all-zero nil ID.
Definition Identity.h:176
static std::optional< Id128 > parse(std::string_view text) noexcept
Parses canonical UUID text.
Definition Identity.h:151
Real graphics-module provider for generated mesh publication.
Definition ArtifactProvider.h:87
eve::Result< void > restoreState(const eve::Value &state) override
Replace resources from validated backend-neutral CPU descriptors.
Definition ArtifactProvider.cpp:387
eve::Result< eve::Value > snapshotState() const override
Export resource identity, build keys, handles and CPU descriptors.
Definition ArtifactProvider.cpp:355
void bindGraphics(Graphics *graphics) noexcept
Bind a live Graphics resource factory without transferring ownership.
Definition ArtifactProvider.cpp:341
const GraphicsArtifactResource * find(eve::PersistentId id) const noexcept
Find a committed resource; the pointer is borrowed. @ownership Borrowed from this provider; callers m...
Definition ArtifactProvider.cpp:305
void clear() noexcept
Remove all resources and reset the local handle allocator.
Definition ArtifactProvider.cpp:334
std::optional< GraphicsArtifactDescriptor > descriptor(eve::PersistentId id) const
Return the backend-neutral descriptor for one resource.
Definition ArtifactProvider.cpp:316
eve::Result< std::unique_ptr< eve::artifact::PreparedPublication > > prepare(const eve::artifact::PublicationView &publication) override
Stage and copy the mesh leaf from a generated publication.
Definition ArtifactProvider.cpp:233
bool isGpuResident(eve::PersistentId id) const noexcept
Return whether a resource was backed by the live Graphics upload boundary.
Definition ArtifactProvider.cpp:329
std::uint64_t checksum(eve::PersistentId id) const noexcept
Return a deterministic checksum of one resource's CPU descriptor.
Definition ArtifactProvider.cpp:311
void detachGraphics(Graphics *graphics) noexcept
Detach the expected backend and release its provider-owned meshes.
Definition ArtifactProvider.cpp:349
GraphicsArtifactStage(GraphicsArtifactProvider &owner, GraphicsArtifactResource resource, Mesh *uploadedMesh)
Definition ArtifactProvider.cpp:200
void commit() noexcept override
Make the prepared mutation observable; the operation cannot fail.
Definition ArtifactProvider.cpp:203
~GraphicsArtifactStage() override
Definition ArtifactProvider.cpp:202
void rollback() noexcept override
Discard the prepared mutation; idempotent and non-throwing.
Definition ArtifactProvider.cpp:208
Definition Graphics.h:125
virtual bool releaseMesh(Mesh *mesh)
Eagerly releases a mesh created by this Graphics.
Definition Graphics.h:927
static std::optional< GraphicsArtifactDescriptor > describe(const eve::artifact::PublicationView &publication)
Describe the selected mesh part, or return empty for invalid input.
Definition ArtifactProvider.cpp:219
Graphics-owned CPU resource provider for generated mesh artifacts.
@ MeshData
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
void detachGraphicsArtifactProvider(Graphics *graphics) noexcept
Detach a Graphics instance before its derived backend is destroyed.
Definition ArtifactProvider.cpp:487
eve::RuntimeHandle< GraphicsArtifactHandleTag > GraphicsArtifactHandle
Generation-qualified handle for a graphics artifact resource.
Definition ArtifactProvider.h:25
void registerGraphicsArtifactProvider(Graphics *graphics)
Register the graphics provider in the common capability registry.
Definition ArtifactProvider.cpp:482
GraphicsArtifactProvider & graphicsArtifactProvider() noexcept
Return the process-owned graphics artifact provider singleton.
Definition ArtifactProvider.cpp:477
bool readU64(const eve::Value::Object &object, const char *name, std::uint64_t &output)
Definition ArtifactProvider.cpp:28
bool readString(const eve::Value::Object &object, const char *name, std::string &output)
Definition ArtifactProvider.cpp:20
bool hasSupportedVersion(const eve::Value::Object &object) noexcept
Definition ArtifactProvider.cpp:45
bool readOptionalBool(const EditorValue &value, const char *name, bool &output)
Definition RoadNetworkEditTarget.cpp:44
@ InvalidArgument
@ UnknownVersion
@ PreconditionViolation
@ Failed
@ ParseError
@ Conflict
@ Applied
Definition Container.h:602
Borrowed immutable view of one generated leaf.
Definition ArtifactPublication.h:61
Borrowed immutable view of one complete generated publication.
Definition ArtifactPublication.h:85
std::string_view buildKey
Definition ArtifactPublication.h:88
Backend-neutral mesh descriptor shared by Vulkan and WebGPU adapters.
Definition ArtifactProvider.h:28
std::string buildKey
Definition ArtifactProvider.h:30
std::size_t indexCount
Definition ArtifactProvider.h:33
std::uint64_t checksum
Definition ArtifactProvider.h:34
std::size_t vertexCount
Definition ArtifactProvider.h:32
Queryable backend-neutral mesh resource owned by the graphics module.
Definition ArtifactProvider.h:45