Move scene viewport shaders into editor resources

This commit is contained in:
2026-04-03 15:43:21 +08:00
parent f1981dd523
commit 24a200e126
22 changed files with 248 additions and 137 deletions

View File

@@ -6,7 +6,6 @@
#include "Rendering/Detail/ShaderVariantUtils.h"
#include "RHI/RHICommandList.h"
#include "RHI/RHIDevice.h"
#include "Resources/BuiltinResources.h"
#include <algorithm>
#include <utility>
@@ -86,10 +85,24 @@ RHI::GraphicsPipelineDesc CreatePipelineDesc(
} // namespace
BuiltinObjectIdOutlinePass::BuiltinObjectIdOutlinePass() {
BuiltinObjectIdOutlinePass::BuiltinObjectIdOutlinePass(Containers::String shaderPath)
: m_shaderPath(std::move(shaderPath)) {
ResetState();
}
void BuiltinObjectIdOutlinePass::SetShaderPath(const Containers::String& shaderPath) {
if (m_shaderPath == shaderPath) {
return;
}
DestroyResources();
m_shaderPath = shaderPath;
}
const Containers::String& BuiltinObjectIdOutlinePass::GetShaderPath() const {
return m_shaderPath;
}
void BuiltinObjectIdOutlinePass::Shutdown() {
DestroyResources();
}
@@ -197,12 +210,19 @@ bool BuiltinObjectIdOutlinePass::CreateResources(const RenderContext& renderCont
return false;
}
if (m_shaderPath.Empty()) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinObjectIdOutlinePass requires an injected shader path before resource creation");
return false;
}
Resources::ResourceHandle<Resources::Shader> shader = Resources::ResourceManager::Get().Load<Resources::Shader>(
Resources::GetBuiltinObjectIdOutlineShaderPath());
m_shaderPath);
if (!shader.IsValid()) {
Debug::Logger::Get().Error(
Debug::LogCategory::Rendering,
"BuiltinObjectIdOutlinePass failed to load builtin object-id-outline shader resource");
"BuiltinObjectIdOutlinePass failed to load configured object-id-outline shader resource");
ResetState();
return false;
}