载入中...
搜索中...
未找到
ArtifactProvider.cpp
浏览该文件的文档.
25bool readString(const eve::Value::Object& object, const char* name, std::string& output, bool allowEmpty = false) {
96 if (!integer || *integer < 0 || static_cast<std::uint64_t>(*integer) > std::numeric_limits<T>::max())
104std::uint64_t hashStreams(std::span<const float> positions, std::span<const float> normals, std::span<const float> uvs,
125const eve::artifact::PartView* selectedMesh(const eve::artifact::PublicationView& publication) noexcept {
128 if (part.kind == eve::artifact::PartKind::MeshData && (part.role == "mesh" || mesh == nullptr)) mesh = ∂
154void GraphicsArtifactProvider::uploadIfAvailable(Graphics* graphics, RuntimeResource& runtime) noexcept {
175 backend.value().indexCount != descriptor.indices.size() || backend.value().vertexStride == 0u ||
202 GraphicsArtifactStage(GraphicsArtifactProvider& owner, GraphicsArtifactResource resource, Mesh* uploadedMesh)
235eve::Result<std::unique_ptr<eve::artifact::PreparedPublication>> GraphicsArtifactProvider::prepare(
239 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact prepare failure was injected"));
241 return eve::Result<std::unique_ptr<eve::artifact::PreparedPublication>>::failure(eve::Diagnostic::error(
245 eve::Diagnostic::error(eve::DiagnosticCode::Conflict, "graphics artifact identity is already published"));
248 return eve::Result<std::unique_ptr<eve::artifact::PreparedPublication>>::failure(eve::Diagnostic::error(
249 eve::DiagnosticCode::PreconditionViolation, "graphics publication requires a complete mesh leaf"));
252 return eve::Result<std::unique_ptr<eve::artifact::PreparedPublication>>::failure(eve::Diagnostic::error(
256 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact handle index exhausted"));
273 std::make_unique<GraphicsArtifactStage>(*this, std::move(runtime.descriptor), runtime.uploadedMesh));
282 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact prepare allocation failed"));
307const GraphicsArtifactResource* GraphicsArtifactProvider::find(eve::PersistentId id) const noexcept {
318std::optional<GraphicsArtifactDescriptor> GraphicsArtifactProvider::descriptor(eve::PersistentId id) const {
385 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact snapshot allocation failed"));
399 const auto* resources = encodedResources ? encodedResources->getIf<eve::Value::Array>() : nullptr;
400 if (!object || !providerName || *providerName != "graphics.resource-provider" || !hasSupportedVersion(*object) ||
403 eve::Diagnostic::error(eve::DiagnosticCode::UnknownVersion, "invalid graphics artifact provider state"));
429 if (!item || !readString(*item, "artifactId", idText) || !readString(*item, "buildKey", buildKey) ||
472 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={})
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
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.cpp:19
const T * getIf() const noexcept
Return a typed pointer, or nullptr when the kind differs.
Definition Value.h:209
Value * find(const std::string &key) noexcept
Return an object member, or nullptr when absent.
Definition Value.cpp:244
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:175
static std::optional< Id128 > parse(std::string_view text) noexcept
Parses canonical UUID text.
Definition Identity.h:150
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:389
eve::Result< eve::Value > snapshotState() const override
Export resource identity, build keys, handles and CPU descriptors.
Definition ArtifactProvider.cpp:357
void bindGraphics(Graphics *graphics) noexcept
Bind a live Graphics resource factory without transferring ownership.
Definition ArtifactProvider.cpp:343
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:307
void clear() noexcept
Remove all resources and reset the local handle allocator.
Definition ArtifactProvider.cpp:336
std::optional< GraphicsArtifactDescriptor > descriptor(eve::PersistentId id) const
Return the backend-neutral descriptor for one resource.
Definition ArtifactProvider.cpp:318
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:235
bool isGpuResident(eve::PersistentId id) const noexcept
Return whether a resource was backed by the live Graphics upload boundary.
Definition ArtifactProvider.cpp:331
std::uint64_t checksum(eve::PersistentId id) const noexcept
Return a deterministic checksum of one resource's CPU descriptor.
Definition ArtifactProvider.cpp:313
void detachGraphics(Graphics *graphics) noexcept
Detach the expected backend and release its provider-owned meshes.
Definition ArtifactProvider.cpp:351
GraphicsArtifactStage(GraphicsArtifactProvider &owner, GraphicsArtifactResource resource, Mesh *uploadedMesh)
Definition ArtifactProvider.cpp:202
void commit() noexcept override
Make the prepared mutation observable; the operation cannot fail.
Definition ArtifactProvider.cpp:205
~GraphicsArtifactStage() override
Definition ArtifactProvider.cpp:204
void rollback() noexcept override
Discard the prepared mutation; idempotent and non-throwing.
Definition ArtifactProvider.cpp:210
Definition Graphics.h:134
virtual bool releaseMesh(Mesh *mesh)
Eagerly releases a mesh created by this Graphics.
Definition Graphics.h:935
virtual std::string getBackendName() const =0
Renderer backend id used by sibling modules (e.g. Gpgpu).
virtual Mesh * newMeshFromArrays(const float *posXYZ, const float *nrmXYZ, const float *uvST, int vertexCount, const uint32_t *indices, int indexCount)=0
Upload a triangle mesh from packed CPU arrays. Owned by Graphics. posXYZ required (vertexCount*3)....
virtual eve::Result< MeshBackendDescriptor > describeMesh(Mesh *mesh) const
Describe a live mesh created by this Graphics backend.
Definition Graphics.h:863
static std::optional< GraphicsArtifactDescriptor > describe(const eve::artifact::PublicationView &publication)
Describe the selected mesh part, or return empty for invalid input.
Definition ArtifactProvider.cpp:221
Graphics-owned CPU resource provider for generated mesh artifacts.
@ MeshData
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
void detachSceneVisibilityProvider(Graphics *graphics) noexcept
Revoke the matching provider before Graphics destruction.
Definition SceneVisibilityProvider.cpp:109
void detachGraphicsArtifactProvider(Graphics *graphics) noexcept
Detach a Graphics instance before its derived backend is destroyed.
Definition ArtifactProvider.cpp:490
void registerSceneVisibilityProvider(Graphics *graphics)
Bind and register the owner-thread native visibility provider during Graphics startup.
Definition SceneVisibilityProvider.cpp:105
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:484
GraphicsArtifactProvider & graphicsArtifactProvider() noexcept
Return the process-owned graphics artifact provider singleton.
Definition ArtifactProvider.cpp:479
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:21
bool hasSupportedVersion(const eve::Value::Object &object) noexcept
Definition ArtifactProvider.cpp:44
Result< bool > readBool(const Value::Object &object, std::string_view name)
Reads a required boolean.
Definition WorldSnapshotParsing.cpp:75
@ InvalidArgument
@ UnknownVersion
@ PreconditionViolation
@ Failed
@ ParseError
@ Conflict
@ Applied
Result< bool > readBoolValue(const Value &value)
Read a Bool without coercing integers, strings or other kinds.
Definition Value.cpp:50
Result< json::UnsignedIntegerScan > scanUnsignedStringMember(const Value::Object &object, std::string_view name)
Scan a required nonempty decimal-string field using from_chars semantics.
Definition Value.cpp:104
Result< std::string > readStringMember(const Value::Object &object, std::string_view name)
Read a required string field, including an empty string, as an owning value.
Definition Value.cpp:25
Definition Container.h:602
Borrowed immutable view of one generated leaf.
Definition ArtifactPublication.h:61
std::span< const float > positions
Definition ArtifactPublication.h:68
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
Queryable backend-neutral mesh resource owned by the graphics module.
Definition ArtifactProvider.h:45