Move scene viewport shaders into editor resources
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user