Conversation
- Add header-only CmdParser (core/cmdline/CmdParser.h) with default value support - Remove cxxopts third-party dependency from CMake and thirdparty.json - Update all 10 source files to use sky::CmdOptions/CmdValue/CmdParseResult
There was a problem hiding this comment.
Pull request overview
This PR looks like a broad “engine integration/update” touching tools, plugin build configuration, shader/render pipeline behavior (including reverse-Z + pipeline variant keys), asset/build pipeline, and third-party/CMake helpers.
Changes:
- Replace some third-party usages (PerlinNoise, cxxopts, crc32c) with in-engine equivalents and simplify third-party CMake via helper functions.
- Introduce JSON-driven plugin configuration/switches and apply dependencies via
plugin.json. - Extend render pipeline variant handling (pass options, pipeline keys) and start integrating reverse-Z depth behavior.
Reviewed changes
Copilot reviewed 234 out of 235 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| engine/framework/src/asset/AssetManager.cpp | Switch asset loading to memory-backed archive; adds error logging in async load path. |
| engine/test/render/StaticMeshTest.cpp | Updates static mesh test types/asserts; minor formatting change at end. |
| engine/render/backend/metal/src/Queue.mm | Adds ReadImage override (currently stubbed). |
| engine/render/shader/src/ShaderVariant.cpp | Fixes shader variant bit packing and adds PipelineVariantSetter. |
| engine/render/adaptor/src/pipeline/ForwardMSAAPass.cpp | Uses DepthSettings for depth clear; adds pass pipeline key list. |
| engine/render/backend/vulkan/src/DescriptorSet.cpp | Adjust descriptor update handling for samplers and binding lookup. |
| engine/render/core/include/render/RenderDepthSettings.h | Adds centralized depth helper utilities for reverse-Z. |
| engine/test/core/TreeTest.cpp | File header modified (now includes BOM). |
| engine/render/builder/render/src/ImageBuilder.cpp | Adds resizing step + logging; changes width/height assignment. |
| engine/render/builder/render/src/MeshBuilder.cpp | Adds logging/includes; alters dependency build behavior (commented build requests). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -48,7 +51,8 @@ namespace sky { | |||
| Attachment{rdg::RasterAttachment{fwdColor, rhi::LoadOp::DONT_CARE, rhi::StoreOp::STORE}, rhi::ClearValue(0.f, 0.f, 0.f, 0.f)}); | |||
|
|
|||
| depthStencil = | |||
| Attachment{rdg::RasterAttachment{fwdMSAADepthStencil, rhi::LoadOp::CLEAR, rhi::StoreOp::DONT_CARE}, rhi::ClearValue(1.f, 0)}; | |||
| Attachment{rdg::RasterAttachment{fwdMSAADepthStencil, rhi::LoadOp::CLEAR, rhi::StoreOp::DONT_CARE}, | |||
| DepthSettings::DepthStencilClear(reverseZ)}; | |||
There was a problem hiding this comment.
reverseZ is hard-coded to true here, but other passes (e.g. DepthPass) are using non-reverse-Z clear values. This will make the depth clear/compare conventions inconsistent across passes and can break depth testing. Please derive reverseZ from the active SceneView (or a pipeline-wide setting) and use that consistently.
| // Find the VkWriteDescriptorSet entry for this binding | ||
| VkDescriptorType descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; | ||
| for (const auto &entry : writeEntries) { | ||
| if (entry.dstBinding == binding) { | ||
| descriptorType = entry.descriptorType; | ||
| break; | ||
| } | ||
| } |
There was a problem hiding this comment.
If binding is not present in writeEntries, this code silently falls back to VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, which can select the wrong image layout. Consider asserting when the binding isn't found (or query the descriptor type from the layout directly) so incorrect bindings fail loudly.
| @@ -1,4 +1,4 @@ | |||
| // | |||
| // | |||
There was a problem hiding this comment.
This file now begins with a UTF-8 BOM character before // (shows up as //). Please remove the BOM to avoid potential compiler/tooling issues and noisy diffs across platforms.
| globalConfig.maxWidth = 2048; | ||
| globalConfig.maxHeight = 2048; | ||
|
|
||
| // Limit resolution to global max | ||
| { | ||
| ImageResizer resizer(ImageResizer::Payload{image, globalConfig.maxWidth, globalConfig.maxHeight}); | ||
| resizer.DoWork(); | ||
| } |
There was a problem hiding this comment.
globalConfig.maxWidth/maxHeight are hard-coded here (2048×2048), which overrides any configuration set via SetGlobalConfig() and makes the resize behavior non-configurable. Prefer using the existing globalConfig values as provided by the caller (and only apply defaults if they are unset).
| static const char* TAG = "MaterialBuilder"; | ||
|
|
There was a problem hiding this comment.
TAG is set to "MaterialBuilder" in MeshBuilder.cpp, which makes logs misleading. Please rename it to something accurate (e.g., "MeshBuilder").
| LOG_I(TAG, "Build Imasge Success. %s", request.assetInfo->path.path.GetStr().c_str()); | ||
| } |
There was a problem hiding this comment.
Log message has a typo (Build Imasge Success). Please correct to "Build Image Success" to keep logs searchable/consistent.
| const auto& matData = asset->Data(); | ||
| for (auto& mat : matData.materials) { | ||
| AssetBuilderManager::Get()->BuildRequest(mat, request.target); | ||
| for (const auto& mat : matData.materials) { | ||
| // AssetBuilderManager::Get()->BuildRequest(mat, request.target); | ||
| asset->AddDependencies(mat); | ||
| } |
There was a problem hiding this comment.
The dependency build requests are commented out (BuildRequest(...)) but the assets are still added as dependencies. If this is intentional, please remove the commented-out calls or replace them with a clear flag/strategy (e.g., build dependencies in a separate stage) to avoid leaving dead code in the hot path.
| auto bin = file->ReadBin(); | ||
| IStreamArchivePtr archive = new IMemoryArchive(bin); | ||
|
|
There was a problem hiding this comment.
file->ReadBin() can fail and return a null BinaryDataPtr; IMemoryArchive(bin) immediately dereferences bin in its constructor. Add a null/size check after ReadBin() and return an error (or fall back to ReadAsArchive()) if the file read fails.
| if (!asset) | ||
| { | ||
| auto sourceAsset = AssetDataBase::Get()->FindAsset(uuid); | ||
| LOG_E(TAG, "Asset %s : %s not found in database. Maybe deleted?", uuid.ToString().c_str(), sourceAsset->path.path.GetStr().c_str()); | ||
| } |
There was a problem hiding this comment.
This error log dereferences sourceAsset without checking it for null (FindAsset(uuid) can return nullptr). If asset is missing, this can crash before the subsequent SKY_ASSERT(asset). Guard sourceAsset (and/or log only uuid) to avoid null deref in the failure path.
| rhi::TransferTaskHandle Queue::ReadImage(const rhi::ImagePtr& image, rhi::ReadCallBack&& callback) | ||
| { | ||
| return CreateTask([]() { | ||
|
|
||
| }); | ||
| } |
There was a problem hiding this comment.
Queue::ReadImage currently creates an empty task and never performs a readback or invokes the callback. If this API is expected to work on Metal, implement the readback and call callback (including error signaling); otherwise consider returning a failed task or explicitly asserting/marking as unsupported to avoid silent no-ops.
No description provided.