载入中...
搜索中...
未找到
ArtifactProvider.cpp
浏览该文件的文档.
2#include "common/ValueRead.h"
3
4#include "common/Capability.h"
5#include "graphics/Graphics.h"
7
8#include <algorithm>
9#include <charconv>
10#include <cmath>
11#include <limits>
12#include <memory>
13#include <type_traits>
14#include <unordered_set>
15#include <utility>
16
17namespace eve::graphics {
18namespace {
19
20const eve::Value* member(const eve::Value::Object& object, const char* name) noexcept {
21 const auto found = object.find(name);
22 return found == object.end() ? nullptr : &found->second;
23}
24
25bool readString(const eve::Value::Object& object, const char* name, std::string& output, bool allowEmpty = false) {
26 auto text = eve::readStringMember(object, name);
27 if (!text || (!allowEmpty && text.value().empty())) return false;
28 output = std::move(text.value());
29 return true;
30}
31
32bool readU64(const eve::Value::Object& object, const char* name, std::uint64_t& output) {
33 auto parsed = eve::scanUnsignedStringMember(object, name);
34 if (!parsed) return false;
35 output = parsed.value().value;
36 return parsed.value().consumed == parsed.value().size;
37}
38
39bool readBool(const eve::Value::Object& object, const char* name, bool& output) {
40 const auto* value = member(object, name);
41 if (!value) return false;
42 auto parsed = eve::readBoolValue(*value);
43 if (!parsed) return false;
44 output = parsed.value();
45 return true;
46}
47
48bool readOptionalBool(const eve::Value::Object& object, const char* name, bool& output) {
49 const auto* value = member(object, name);
50 if (!value) return true;
51 return readBool(object, name, output);
52}
53
54bool hasSupportedVersion(const eve::Value::Object& object) noexcept {
55 const auto* encoded = member(object, "version");
56 const auto* version = encoded ? encoded->getIf<std::int64_t>() : nullptr;
57 return version && (*version == 1 || *version == 2);
58}
59
60eve::Value floatArray(const std::vector<float>& values) {
61 eve::Value::Array encoded;
62 encoded.reserve(values.size());
63 for (const float value : values) encoded.emplace_back(value);
64 return eve::Value(std::move(encoded));
65}
66
67eve::Value uintArray(const std::vector<std::uint32_t>& values) {
68 eve::Value::Array encoded;
69 encoded.reserve(values.size());
70 for (const auto value : values) encoded.emplace_back(std::int64_t(value));
71 return eve::Value(std::move(encoded));
72}
73
74template <class T>
75bool readNumericArray(const eve::Value* encoded, std::vector<T>& output) {
76 const auto* array = encoded ? encoded->getIf<eve::Value::Array>() : nullptr;
77 if (!array) return false;
78 output.clear();
79 output.reserve(array->size());
80 for (const eve::Value& value : *array) {
81 if constexpr (std::is_same_v<T, float>) {
82 if (const auto* number = value.getIf<double>()) {
83 if (!std::isfinite(*number) || *number < -std::numeric_limits<float>::max() ||
84 *number > std::numeric_limits<float>::max())
85 return false;
86 output.push_back(static_cast<float>(*number));
87 } else if (const auto* integer = value.getIf<std::int64_t>()) {
88 const float converted = static_cast<float>(*integer);
89 if (!std::isfinite(converted)) return false;
90 output.push_back(converted);
91 } else {
92 return false;
93 }
94 } else {
95 const auto* integer = value.getIf<std::int64_t>();
96 if (!integer || *integer < 0 || static_cast<std::uint64_t>(*integer) > std::numeric_limits<T>::max())
97 return false;
98 output.push_back(static_cast<T>(*integer));
99 }
100 }
101 return true;
102}
103
104std::uint64_t hashStreams(std::span<const float> positions, std::span<const float> normals, std::span<const float> uvs,
105 std::span<const std::uint32_t> indices) noexcept {
106 std::uint64_t hash = 14695981039346656037ull;
107 const auto mix = [&hash](const auto* data, std::size_t count) {
108 const auto* bytes = reinterpret_cast<const std::uint8_t*>(data);
109 for (std::size_t i = 0; i < count * sizeof(*data); ++i) {
110 hash ^= bytes[i];
111 hash *= 1099511628211ull;
112 }
113 };
114 mix(positions.data(), positions.size());
115 mix(normals.data(), normals.size());
116 mix(uvs.data(), uvs.size());
117 mix(indices.data(), indices.size());
118 return hash;
119}
120
121std::uint64_t hashDescriptor(const GraphicsArtifactResource& resource) noexcept {
122 return hashStreams(resource.positions, resource.normals, resource.uvs, resource.indices);
123}
124
125const eve::artifact::PartView* selectedMesh(const eve::artifact::PublicationView& publication) noexcept {
126 const eve::artifact::PartView* mesh = nullptr;
127 for (const auto& part : publication.parts) {
128 if (part.kind == eve::artifact::PartKind::MeshData && (part.role == "mesh" || mesh == nullptr)) mesh = &part;
129 }
130 return mesh;
131}
132
133bool validMeshView(const eve::artifact::PartView& mesh) noexcept {
134 if (mesh.positions.empty() || mesh.positions.size() % 3u != 0u || mesh.indices.empty() ||
135 mesh.indices.size() % 3u != 0u)
136 return false;
137 const std::size_t vertices = mesh.positions.size() / 3u;
138 if ((!mesh.normals.empty() && mesh.normals.size() != mesh.positions.size()) ||
139 (!mesh.uvs.empty() && mesh.uvs.size() != vertices * 2u))
140 return false;
141 for (const float value : mesh.positions)
142 if (!std::isfinite(value)) return false;
143 for (const float value : mesh.normals)
144 if (!std::isfinite(value)) return false;
145 for (const float value : mesh.uvs)
146 if (!std::isfinite(value)) return false;
147 for (const auto index : mesh.indices)
148 if (index >= vertices) return false;
149 return true;
150}
151
152} // namespace
153
154void GraphicsArtifactProvider::uploadIfAvailable(Graphics* graphics, RuntimeResource& runtime) noexcept {
155 auto& descriptor = runtime.descriptor;
156 runtime.uploadedMesh = nullptr;
157 if (!graphics) {
158 descriptor.backendName = "cpu";
159 descriptor.uploadState = "not-attempted";
160 descriptor.gpuResident = false;
161 return;
162 }
163 descriptor.gpuResident = false;
164 descriptor.uploadState = "cpu-fallback";
165 try {
166 descriptor.backendName = graphics->getBackendName();
167 runtime.uploadedMesh = graphics->newMeshFromArrays(
168 descriptor.positions.data(), descriptor.normals.empty() ? nullptr : descriptor.normals.data(),
169 descriptor.uvs.empty() ? nullptr : descriptor.uvs.data(),
170 static_cast<int>(descriptor.positions.size() / 3u), descriptor.indices.data(),
171 static_cast<int>(descriptor.indices.size()));
172 if (runtime.uploadedMesh) {
173 const auto backend = graphics->describeMesh(runtime.uploadedMesh);
174 if (!backend.ok() || backend.value().vertexCount != descriptor.positions.size() / 3u ||
175 backend.value().indexCount != descriptor.indices.size() || backend.value().vertexStride == 0u ||
176 (backend.value().indexElementSize != 2u && backend.value().indexElementSize != 4u)) {
177 (void)graphics->releaseMesh(runtime.uploadedMesh);
178 runtime.uploadedMesh = nullptr;
179 descriptor.uploadState = "cpu-fallback";
180 descriptor.gpuResident = false;
181 return;
182 }
183 descriptor.backendVertexStride = backend.value().vertexStride;
184 descriptor.backendIndexElementSize = backend.value().indexElementSize;
185 descriptor.uploadState = "uploaded";
186 descriptor.gpuResident = true;
187 }
188 } catch (...) {
189 if (runtime.uploadedMesh) {
190 try {
191 (void)graphics->releaseMesh(runtime.uploadedMesh);
192 } catch (...) {
193 }
194 }
195 runtime.uploadedMesh = nullptr;
196 descriptor.uploadState = "cpu-fallback";
197 }
198}
199
201public:
203 : owner_(&owner), resource_{std::move(resource), uploadedMesh} {}
205 void commit() noexcept override {
206 if (!owner_) return;
207 owner_->commit(std::move(resource_));
208 owner_ = nullptr;
209 }
210 void rollback() noexcept override {
211 if (owner_) owner_->release(resource_);
212 owner_ = nullptr;
213 resource_ = {};
214 }
215
216private:
217 GraphicsArtifactProvider* owner_ = nullptr;
218 GraphicsArtifactProvider::RuntimeResource resource_;
219};
220
221std::optional<GraphicsArtifactDescriptor> WebGpuArtifactDescriptorAdapter::describe(
222 const eve::artifact::PublicationView& publication) {
223 const auto* mesh = selectedMesh(publication);
224 if (!mesh || !validMeshView(*mesh)) return std::nullopt;
226 result.id = mesh->id;
227 result.buildKey = std::string(mesh->buildKey);
228 result.role = std::string(mesh->role);
229 result.vertexCount = mesh->positions.size() / 3u;
230 result.indexCount = mesh->indices.size();
231 result.checksum = hashStreams(mesh->positions, mesh->normals, mesh->uvs, mesh->indices);
232 return result;
233}
234
236 const eve::artifact::PublicationView& publication) {
237 if (failPrepare_)
239 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact prepare failure was injected"));
240 if (publication.id.isNil() || publication.buildKey.empty())
242 eve::DiagnosticCode::InvalidArgument, "graphics publication requires identity and build key"));
243 if (find(publication.id) != nullptr)
245 eve::Diagnostic::error(eve::DiagnosticCode::Conflict, "graphics artifact identity is already published"));
246 const auto* mesh = selectedMesh(publication);
247 if (!mesh || !validMeshView(*mesh))
249 eve::DiagnosticCode::PreconditionViolation, "graphics publication requires a complete mesh leaf"));
250 if (mesh->positions.size() / 3u > static_cast<std::size_t>(std::numeric_limits<int>::max()) ||
251 mesh->indices.size() > static_cast<std::size_t>(std::numeric_limits<int>::max()))
253 eve::DiagnosticCode::InvalidArgument, "graphics mesh exceeds backend integer limits"));
254 if (nextIndex_ == GraphicsArtifactHandle::invalidIndex)
256 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact handle index exhausted"));
257
259 resource.id = publication.id;
260 resource.buildKey = std::string(publication.buildKey);
261 resource.handle = GraphicsArtifactHandle(nextIndex_, 1);
262 resource.role = std::string(mesh->role);
263 RuntimeResource runtime;
264 runtime.descriptor = std::move(resource);
265 try {
266 runtime.descriptor.positions.assign(mesh->positions.begin(), mesh->positions.end());
267 runtime.descriptor.normals.assign(mesh->normals.begin(), mesh->normals.end());
268 runtime.descriptor.uvs.assign(mesh->uvs.begin(), mesh->uvs.end());
269 runtime.descriptor.indices.assign(mesh->indices.begin(), mesh->indices.end());
270 uploadIfAvailable(graphics_, runtime);
271 resources_.reserve(resources_.size() + 1);
273 std::make_unique<GraphicsArtifactStage>(*this, std::move(runtime.descriptor), runtime.uploadedMesh));
274 } catch (...) {
275 if (runtime.uploadedMesh && graphics_) {
276 try {
277 (void)graphics_->releaseMesh(runtime.uploadedMesh);
278 } catch (...) {
279 }
280 }
282 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact prepare allocation failed"));
283 }
284}
285
286void GraphicsArtifactProvider::commit(RuntimeResource resource) noexcept {
287 resources_.push_back(std::move(resource));
288 ++nextIndex_;
289}
290
291void GraphicsArtifactProvider::release(RuntimeResource& resource) noexcept {
292 if (resource.uploadedMesh && graphics_) {
293 try {
294 (void)graphics_->releaseMesh(resource.uploadedMesh);
295 } catch (...) {
296 }
297 }
298 if (resource.uploadedMesh) {
299 resource.descriptor.gpuResident = false;
300 resource.descriptor.uploadState = "detached";
301 resource.descriptor.backendVertexStride = 0;
302 resource.descriptor.backendIndexElementSize = 0;
303 resource.uploadedMesh = nullptr;
304 }
305}
306
308 const auto found = std::find_if(resources_.begin(), resources_.end(),
309 [id](const auto& resource) { return resource.descriptor.id == id; });
310 return found == resources_.end() ? nullptr : &found->descriptor;
311}
312
314 const auto* resource = find(id);
315 return resource ? hashDescriptor(*resource) : 0;
316}
317
318std::optional<GraphicsArtifactDescriptor> GraphicsArtifactProvider::descriptor(eve::PersistentId id) const {
319 const auto* resource = find(id);
320 if (!resource) return std::nullopt;
322 resource->buildKey,
323 resource->role,
324 resource->positions.size() / 3u,
325 resource->indices.size(),
326 hashDescriptor(*resource),
327 resource->backendVertexStride,
328 resource->backendIndexElementSize};
329}
330
332 const auto* resource = find(id);
333 return resource && resource->gpuResident;
334}
335
337 for (auto& resource : resources_) release(resource);
338 resources_.clear();
339 nextIndex_ = 0;
340 failPrepare_ = false;
341}
342
344 if (graphics_ == graphics) return;
345 if (graphics_) {
346 for (auto& resource : resources_) release(resource);
347 }
348 graphics_ = graphics;
349}
350
352 if (graphics_ != graphics) return;
353 for (auto& resource : resources_) release(resource);
354 graphics_ = nullptr;
355}
356
358 try {
360 resources.reserve(resources_.size());
361 for (const auto& runtime : resources_) {
362 const auto& resource = runtime.descriptor;
364 item.emplace("artifactId", eve::Value(resource.id.format()));
365 item.emplace("buildKey", eve::Value(resource.buildKey));
366 item.emplace("handle", eve::Value(std::to_string(resource.handle.packed())));
367 item.emplace("role", eve::Value(resource.role));
368 item.emplace("positions", floatArray(resource.positions));
369 item.emplace("normals", floatArray(resource.normals));
370 item.emplace("uvs", floatArray(resource.uvs));
371 item.emplace("indices", uintArray(resource.indices));
372 item.emplace("backend", eve::Value(resource.backendName));
373 item.emplace("uploadState", eve::Value(resource.uploadState));
374 item.emplace("gpuResident", eve::Value(resource.gpuResident));
375 resources.emplace_back(std::move(item));
376 }
378 state.emplace("provider", eve::Value("graphics.resource-provider"));
379 state.emplace("version", eve::Value(std::int64_t(2)));
380 state.emplace("unknownFields", eve::Value("ignore"));
381 state.emplace("resources", eve::Value(std::move(resources)));
383 } catch (...) {
385 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact snapshot allocation failed"));
386 }
387}
388
390 if (!resources_.empty())
392 eve::DiagnosticCode::Conflict, "graphics artifact restore requires an empty registry"));
393 const auto* object = state.getIf<eve::Value::Object>();
394 const auto* provider = object ? member(*object, "provider") : nullptr;
395 const auto* providerName = provider ? provider->getIf<std::string>() : nullptr;
396 const auto* versionValue = object ? member(*object, "version") : nullptr;
397 const auto* version = versionValue ? versionValue->getIf<std::int64_t>() : nullptr;
398 const auto* encodedResources = object ? member(*object, "resources") : nullptr;
399 const auto* resources = encodedResources ? encodedResources->getIf<eve::Value::Array>() : nullptr;
400 if (!object || !providerName || *providerName != "graphics.resource-provider" || !hasSupportedVersion(*object) ||
401 !version || !resources)
403 eve::Diagnostic::error(eve::DiagnosticCode::UnknownVersion, "invalid graphics artifact provider state"));
404
405 std::vector<RuntimeResource> candidate;
406 std::unordered_set<eve::PersistentId> identities;
407 std::uint32_t next = 0;
408 const auto cleanup = [&]() noexcept {
409 for (auto& resource : candidate) release(resource);
410 candidate.clear();
411 };
412 const auto fail = [&](eve::Diagnostic diagnostic) -> eve::Result<void> {
413 cleanup();
414 return eve::Result<void>::failure(std::move(diagnostic));
415 };
416 try {
417 candidate.reserve(resources->size());
418 for (const eve::Value& encoded : *resources) {
419 const auto* item = encoded.getIf<eve::Value::Object>();
420 std::string idText;
421 std::string buildKey;
422 std::string role;
423 std::string backend;
424 std::string uploadState;
425 std::uint64_t packed = 0;
426 bool gpuResident = false;
427 RuntimeResource runtime;
428 auto& resource = runtime.descriptor;
429 if (!item || !readString(*item, "artifactId", idText) || !readString(*item, "buildKey", buildKey) ||
430 !readString(*item, "role", role) || !readU64(*item, "handle", packed) ||
431 !readNumericArray(member(*item, "positions"), resource.positions) ||
432 !readNumericArray(member(*item, "normals"), resource.normals) ||
433 !readNumericArray(member(*item, "uvs"), resource.uvs) ||
434 !readNumericArray(member(*item, "indices"), resource.indices))
435 return fail(
436 eve::Diagnostic::error(eve::DiagnosticCode::ParseError, "invalid graphics artifact resource"));
437 const auto parsedId = eve::PersistentId::parse(idText);
439 if (!parsedId || parsedId->isNil() || resource.handle.isInvalid() || role.empty() ||
440 !identities.emplace(*parsedId).second || resource.positions.empty() ||
441 resource.positions.size() % 3u != 0u || resource.indices.empty() ||
442 resource.indices.size() % 3u != 0u ||
443 (!resource.normals.empty() && resource.normals.size() != resource.positions.size()) ||
444 (!resource.uvs.empty() && resource.uvs.size() != resource.positions.size() / 3u * 2u))
446 "invalid graphics artifact streams or identity"));
447 for (const auto index : resource.indices)
448 if (index >= resource.positions.size() / 3u)
449 return fail(
450 eve::Diagnostic::error(eve::DiagnosticCode::ParseError, "invalid graphics artifact index"));
451 if (*version >= 2) {
452 if (!readString(*item, "backend", backend) || !readString(*item, "uploadState", uploadState) ||
453 !readBool(*item, "gpuResident", gpuResident))
454 return fail(
455 eve::Diagnostic::error(eve::DiagnosticCode::ParseError, "invalid graphics upload state"));
456 }
457 resource.id = *parsedId;
458 resource.buildKey = std::move(buildKey);
459 resource.role = std::move(role);
460 if (*version >= 2) {
461 resource.backendName = std::move(backend);
462 resource.uploadState = std::move(uploadState);
463 resource.gpuResident = gpuResident;
464 }
465 uploadIfAvailable(graphics_, runtime);
466 next = std::max(next, resource.handle.index() + 1u);
467 candidate.push_back(std::move(runtime));
468 }
469 } catch (...) {
470 cleanup();
472 eve::Diagnostic::error(eve::DiagnosticCode::Failed, "graphics artifact restore allocation failed"));
473 }
474 resources_.swap(candidate);
475 nextIndex_ = next;
477}
478
483
487 eve::cap::provide<eve::artifact::IGraphicsArtifactAdapter>(&graphicsArtifactProvider());
488}
489
494
495} // namespace eve::graphics
std::vector< eve::artifact::PartView > parts
std::string output
std::string descriptor
std::string name
Definition ECS.cpp:154
float u
Definition Grass.cpp:233
std::vector< std::uint32_t > indices
std::vector< float > normals
std::vector< float > positions
std::string id
Poco::JSON::Object::Ptr result
std::uint64_t bytes
std::shared_ptr< OceanGpuSpectrum > owner
OceanMeshSettings mesh
OceanRenderBackend backend
std::vector< std::weak_ptr< DeviceBytes > > resources
Definition OnnxGpgpu.cpp:55
std::set< std::string > values
std::set< std::string > identities
Object::Ptr value
std::string hash
double number
bool found
Graphics * graphics
std::string text
std::string resource
int count
std::array< double, 2 > vertices[3]
float size
Definition TreeMesh.cpp:158
float(ui::Theme::* member)[4]
uint32_t index
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.
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
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.
static constexpr index_type invalidIndex
Reserved index value shared by all invalid handles.
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
std::map< std::string, Value > Object
Definition Value.h:34
std::vector< Value > Array
Definition Value.h:33
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.
Id128 public API.
Definition Identity.h:111
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.
eve::Result< void > restoreState(const eve::Value &state) override
Replace resources from validated backend-neutral CPU descriptors.
eve::Result< eve::Value > snapshotState() const override
Export resource identity, build keys, handles and CPU descriptors.
void bindGraphics(Graphics *graphics) noexcept
Bind a live Graphics resource factory without transferring ownership.
const GraphicsArtifactResource * find(eve::PersistentId id) const noexcept
Find a committed resource; the pointer is borrowed. @ownership Borrowed from this provider; callers m...
void clear() noexcept
Remove all resources and reset the local handle allocator.
std::optional< GraphicsArtifactDescriptor > descriptor(eve::PersistentId id) const
Return the backend-neutral descriptor for one resource.
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.
bool isGpuResident(eve::PersistentId id) const noexcept
Return whether a resource was backed by the live Graphics upload boundary.
std::uint64_t checksum(eve::PersistentId id) const noexcept
Return a deterministic checksum of one resource's CPU descriptor.
void detachGraphics(Graphics *graphics) noexcept
Detach the expected backend and release its provider-owned meshes.
GraphicsArtifactStage(GraphicsArtifactProvider &owner, GraphicsArtifactResource resource, Mesh *uploadedMesh)
void commit() noexcept override
Make the prepared mutation observable; the operation cannot fail.
void rollback() noexcept override
Discard the prepared mutation; idempotent and non-throwing.
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
GPU mesh handle (+ optional CPU morph targets).
Definition Mesh.h:26
static std::optional< GraphicsArtifactDescriptor > describe(const eve::artifact::PublicationView &publication)
Describe the selected mesh part, or return empty for invalid input.
Graphics-owned CPU resource provider for generated mesh artifacts.
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
void detachSceneVisibilityProvider(Graphics *graphics) noexcept
Revoke the matching provider before Graphics destruction.
void detachGraphicsArtifactProvider(Graphics *graphics) noexcept
Detach a Graphics instance before its derived backend is destroyed.
void registerSceneVisibilityProvider(Graphics *graphics)
Bind and register the owner-thread native visibility provider during Graphics startup.
eve::RuntimeHandle< GraphicsArtifactHandleTag > GraphicsArtifactHandle
Generation-qualified handle for a graphics artifact resource.
void registerGraphicsArtifactProvider(Graphics *graphics)
Register the graphics provider in the common capability registry.
GraphicsArtifactProvider & graphicsArtifactProvider() noexcept
Return the process-owned graphics artifact provider singleton.
bool readU64(const eve::Value::Object &object, const char *name, std::uint64_t &output)
bool readString(const eve::Value::Object &object, const char *name, std::string &output)
bool hasSupportedVersion(const eve::Value::Object &object) noexcept
Result< bool > readBool(const Value::Object &object, std::string_view name)
Reads a required boolean.
int64_t integer(const RuntimeTensor &v, size_t i=0)
Integer.
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
Borrowed immutable view of one generated leaf.
std::span< const float > positions
Borrowed immutable view of one complete generated publication.
Backend-neutral mesh descriptor shared by Vulkan and WebGPU adapters.
Queryable backend-neutral mesh resource owned by the graphics module.