Skip to content

Update From Dev#79

Open
bluesky013 wants to merge 38 commits intomainfrom
dev
Open

Update From Dev#79
bluesky013 wants to merge 38 commits intomainfrom
dev

Conversation

@bluesky013
Copy link
Copy Markdown
Owner

No description provided.

@bluesky013 bluesky013 self-assigned this Mar 23, 2026
Copilot AI review requested due to automatic review settings March 23, 2026 17:58
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines 21 to +55
@@ -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)};
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +173 to +180
// 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;
}
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@@ -1,4 +1,4 @@
//
//
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +185 to +192
globalConfig.maxWidth = 2048;
globalConfig.maxHeight = 2048;

// Limit resolution to global max
{
ImageResizer resizer(ImageResizer::Payload{image, globalConfig.maxWidth, globalConfig.maxHeight});
resizer.DoWork();
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
Comment on lines +10 to 11
static const char* TAG = "MaterialBuilder";

Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TAG is set to "MaterialBuilder" in MeshBuilder.cpp, which makes logs misleading. Please rename it to something accurate (e.g., "MeshBuilder").

Copilot uses AI. Check for mistakes.
Comment on lines +260 to 261
LOG_I(TAG, "Build Imasge Success. %s", request.assetInfo->path.path.GetStr().c_str());
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log message has a typo (Build Imasge Success). Please correct to "Build Image Success" to keep logs searchable/consistent.

Copilot uses AI. Check for mistakes.
Comment on lines 36 to 40
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);
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +99 to +101
auto bin = file->ReadBin();
IStreamArchivePtr archive = new IMemoryArchive(bin);

Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +138 to +142
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());
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +36
rhi::TransferTaskHandle Queue::ReadImage(const rhi::ImagePtr& image, rhi::ReadCallBack&& callback)
{
return CreateTask([]() {

});
}
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants