chore: checkpoint current workspace changes

This commit is contained in:
2026-04-11 22:14:02 +08:00
parent 3e55f8c204
commit 8848cfd958
227 changed files with 34027 additions and 6711 deletions

View File

@@ -1,6 +1,7 @@
#include "Passes/SceneViewportEditorOverlayPass.h"
#include "Viewport/SceneViewportMath.h"
#include "Rendering/Internal/RenderSurfacePipelineUtils.h"
#include <XCEngine/RHI/RHIBuffer.h>
#include <XCEngine/RHI/RHICommandList.h>
@@ -187,14 +188,16 @@ private:
RHI::GraphicsPipelineDesc BuildLinePipelineDesc(
RHI::RHIPipelineLayout* pipelineLayout,
const Rendering::RenderSurface& surface,
bool depthTestEnabled) {
RHI::GraphicsPipelineDesc pipelineDesc = {};
pipelineDesc.pipelineLayout = pipelineLayout;
pipelineDesc.topologyType = static_cast<uint32_t>(RHI::PrimitiveTopologyType::Line);
pipelineDesc.renderTargetCount = 1;
pipelineDesc.renderTargetFormats[0] = static_cast<uint32_t>(RHI::Format::R8G8B8A8_UNorm);
pipelineDesc.depthStencilFormat = static_cast<uint32_t>(RHI::Format::D24_UNorm_S8_UInt);
pipelineDesc.sampleCount = 1;
::XCEngine::Rendering::Internal::ApplySingleColorAttachmentPropertiesToGraphicsPipelineDesc(
surface,
pipelineDesc);
pipelineDesc.depthStencilFormat =
static_cast<uint32_t>(::XCEngine::Rendering::Internal::ResolveSurfaceDepthFormat(surface));
pipelineDesc.inputLayout.elements = {
{ "POSITION", 0, static_cast<uint32_t>(RHI::Format::R32G32B32_Float), 0, 0, 0, 0 },
@@ -238,14 +241,16 @@ RHI::GraphicsPipelineDesc BuildLinePipelineDesc(
RHI::GraphicsPipelineDesc BuildSpritePipelineDesc(
RHI::RHIPipelineLayout* pipelineLayout,
const Rendering::RenderSurface& surface,
bool depthTestEnabled) {
RHI::GraphicsPipelineDesc pipelineDesc = {};
pipelineDesc.pipelineLayout = pipelineLayout;
pipelineDesc.topologyType = static_cast<uint32_t>(RHI::PrimitiveTopologyType::Triangle);
pipelineDesc.renderTargetCount = 1;
pipelineDesc.renderTargetFormats[0] = static_cast<uint32_t>(RHI::Format::R8G8B8A8_UNorm);
pipelineDesc.depthStencilFormat = static_cast<uint32_t>(RHI::Format::D24_UNorm_S8_UInt);
pipelineDesc.sampleCount = 1;
::XCEngine::Rendering::Internal::ApplySingleColorAttachmentPropertiesToGraphicsPipelineDesc(
surface,
pipelineDesc);
pipelineDesc.depthStencilFormat =
static_cast<uint32_t>(::XCEngine::Rendering::Internal::ResolveSurfaceDepthFormat(surface));
pipelineDesc.inputLayout.elements = {
{ "POSITION", 0, static_cast<uint32_t>(RHI::Format::R32G32B32_Float), 0, 0, 0, 0 },
@@ -292,14 +297,16 @@ RHI::GraphicsPipelineDesc BuildSpritePipelineDesc(
RHI::GraphicsPipelineDesc BuildScreenTrianglePipelineDesc(
RHI::RHIPipelineLayout* pipelineLayout,
const Rendering::RenderSurface& surface,
bool depthTestEnabled) {
RHI::GraphicsPipelineDesc pipelineDesc = {};
pipelineDesc.pipelineLayout = pipelineLayout;
pipelineDesc.topologyType = static_cast<uint32_t>(RHI::PrimitiveTopologyType::Triangle);
pipelineDesc.renderTargetCount = 1;
pipelineDesc.renderTargetFormats[0] = static_cast<uint32_t>(RHI::Format::R8G8B8A8_UNorm);
pipelineDesc.depthStencilFormat = static_cast<uint32_t>(RHI::Format::D24_UNorm_S8_UInt);
pipelineDesc.sampleCount = 1;
::XCEngine::Rendering::Internal::ApplySingleColorAttachmentPropertiesToGraphicsPipelineDesc(
surface,
pipelineDesc);
pipelineDesc.depthStencilFormat =
static_cast<uint32_t>(::XCEngine::Rendering::Internal::ResolveSurfaceDepthFormat(surface));
pipelineDesc.inputLayout.elements = {
{ "POSITION", 0, static_cast<uint32_t>(RHI::Format::R32G32_Float), 0, 0, 0, 0 },
@@ -382,7 +389,20 @@ bool SceneViewportEditorOverlayPassRenderer::Render(
return true;
}
if (!EnsureInitialized(renderContext)) {
const std::vector<RHI::RHIResourceView*>& colorAttachments = surface.GetColorAttachments();
if (!::XCEngine::Rendering::Internal::HasSingleColorAttachment(surface) ||
colorAttachments.empty() ||
colorAttachments[0] == nullptr ||
surface.GetDepthAttachment() == nullptr) {
return false;
}
const Math::RectInt renderArea = surface.GetRenderArea();
if (renderArea.width <= 0 || renderArea.height <= 0) {
return false;
}
if (!EnsureInitialized(renderContext, surface)) {
return false;
}
@@ -451,41 +471,43 @@ bool SceneViewportEditorOverlayPassRenderer::Render(
OverlayConstants constants = {};
constants.viewProjection = BuildSceneViewportViewProjectionMatrix(
frameData.overlay,
static_cast<float>(surface.GetWidth()),
static_cast<float>(surface.GetHeight())).Transpose();
static_cast<float>(renderArea.width),
static_cast<float>(renderArea.height)).Transpose();
constants.viewportSizeAndInvSize = Math::Vector4(
static_cast<float>(surface.GetWidth()),
static_cast<float>(surface.GetHeight()),
surface.GetWidth() > 0u ? 1.0f / static_cast<float>(surface.GetWidth()) : 0.0f,
surface.GetHeight() > 0u ? 1.0f / static_cast<float>(surface.GetHeight()) : 0.0f);
static_cast<float>(renderArea.width),
static_cast<float>(renderArea.height),
renderArea.width > 0 ? 1.0f / static_cast<float>(renderArea.width) : 0.0f,
renderArea.height > 0 ? 1.0f / static_cast<float>(renderArea.height) : 0.0f);
m_constantSet->WriteConstant(0, &constants, sizeof(constants));
RHI::RHICommandList* commandList = renderContext.commandList;
const std::vector<RHI::RHIResourceView*>& colorAttachments = surface.GetColorAttachments();
if (colorAttachments.empty() || colorAttachments[0] == nullptr) {
return false;
}
RHI::RHIResourceView* renderTarget = colorAttachments[0];
commandList->TransitionBarrier(
renderTarget,
surface.GetColorStateAfter(),
RHI::ResourceStates::RenderTarget);
commandList->SetRenderTargets(1, &renderTarget, surface.GetDepthAttachment());
RHI::RHIResourceView* depthAttachment = surface.GetDepthAttachment();
if (surface.IsAutoTransitionEnabled()) {
commandList->TransitionBarrier(
renderTarget,
surface.GetColorStateAfter(),
RHI::ResourceStates::RenderTarget);
commandList->TransitionBarrier(
depthAttachment,
surface.GetDepthStateAfter(),
RHI::ResourceStates::DepthWrite);
}
commandList->SetRenderTargets(1, &renderTarget, depthAttachment);
const RHI::Viewport viewport = {
0.0f,
0.0f,
static_cast<float>(surface.GetWidth()),
static_cast<float>(surface.GetHeight()),
static_cast<float>(renderArea.x),
static_cast<float>(renderArea.y),
static_cast<float>(renderArea.width),
static_cast<float>(renderArea.height),
0.0f,
1.0f
};
const RHI::Rect scissorRect = {
0,
0,
static_cast<int32_t>(surface.GetWidth()),
static_cast<int32_t>(surface.GetHeight())
renderArea.x,
renderArea.y,
renderArea.x + renderArea.width,
renderArea.y + renderArea.height
};
commandList->SetViewport(viewport);
commandList->SetScissorRect(scissorRect);
@@ -540,15 +562,30 @@ bool SceneViewportEditorOverlayPassRenderer::Render(
}
}
commandList->TransitionBarrier(
renderTarget,
RHI::ResourceStates::RenderTarget,
surface.GetColorStateAfter());
commandList->EndRenderPass();
if (surface.IsAutoTransitionEnabled()) {
commandList->TransitionBarrier(
renderTarget,
RHI::ResourceStates::RenderTarget,
surface.GetColorStateAfter());
commandList->TransitionBarrier(
depthAttachment,
RHI::ResourceStates::DepthWrite,
surface.GetDepthStateAfter());
}
return true;
}
bool SceneViewportEditorOverlayPassRenderer::EnsureInitialized(
const Rendering::RenderContext& renderContext) {
const Rendering::RenderContext& renderContext,
const Rendering::RenderSurface& surface) {
const RHI::Format renderTargetFormat =
::XCEngine::Rendering::Internal::ResolveSurfaceColorFormat(surface, 0u);
const RHI::Format depthStencilFormat =
::XCEngine::Rendering::Internal::ResolveSurfaceDepthFormat(surface);
const uint32_t renderTargetSampleCount =
::XCEngine::Rendering::Internal::ResolveSurfaceSampleCount(surface);
if (m_device == renderContext.device &&
m_backendType == renderContext.backendType &&
m_linePipelineLayout != nullptr &&
@@ -564,22 +601,35 @@ bool SceneViewportEditorOverlayPassRenderer::EnsureInitialized(
m_samplerPool != nullptr &&
m_constantSet != nullptr &&
m_samplerSet != nullptr &&
m_sampler != nullptr) {
m_sampler != nullptr &&
m_renderTargetFormat == renderTargetFormat &&
m_depthStencilFormat == depthStencilFormat &&
m_renderTargetSampleCount == renderTargetSampleCount) {
return true;
}
DestroyResources();
return CreateResources(renderContext);
return CreateResources(renderContext, surface);
}
bool SceneViewportEditorOverlayPassRenderer::CreateResources(
const Rendering::RenderContext& renderContext) {
if (!renderContext.IsValid() || renderContext.backendType != RHI::RHIType::D3D12) {
const Rendering::RenderContext& renderContext,
const Rendering::RenderSurface& surface) {
if (!renderContext.IsValid()) {
return false;
}
if (!::XCEngine::Rendering::Internal::HasSingleColorAttachment(surface) ||
::XCEngine::Rendering::Internal::ResolveSurfaceColorFormat(surface, 0u) == RHI::Format::Unknown ||
::XCEngine::Rendering::Internal::ResolveSurfaceDepthFormat(surface) == RHI::Format::Unknown) {
return false;
}
m_device = renderContext.device;
m_backendType = renderContext.backendType;
m_renderTargetFormat = ::XCEngine::Rendering::Internal::ResolveSurfaceColorFormat(surface, 0u);
m_depthStencilFormat = ::XCEngine::Rendering::Internal::ResolveSurfaceDepthFormat(surface);
m_renderTargetSampleCount = ::XCEngine::Rendering::Internal::ResolveSurfaceSampleCount(surface);
RHI::DescriptorSetLayoutBinding constantBinding = {};
constantBinding.binding = 0;
@@ -691,7 +741,7 @@ bool SceneViewportEditorOverlayPassRenderer::CreateResources(
m_samplerSet->UpdateSampler(0, m_sampler);
const RHI::GraphicsPipelineDesc depthTestedLineDesc =
BuildLinePipelineDesc(m_linePipelineLayout, true);
BuildLinePipelineDesc(m_linePipelineLayout, surface, true);
m_depthTestedLinePipelineState = m_device->CreatePipelineState(depthTestedLineDesc);
if (m_depthTestedLinePipelineState == nullptr || !m_depthTestedLinePipelineState->IsValid()) {
DestroyResources();
@@ -699,7 +749,7 @@ bool SceneViewportEditorOverlayPassRenderer::CreateResources(
}
const RHI::GraphicsPipelineDesc alwaysOnTopLineDesc =
BuildLinePipelineDesc(m_linePipelineLayout, false);
BuildLinePipelineDesc(m_linePipelineLayout, surface, false);
m_alwaysOnTopLinePipelineState = m_device->CreatePipelineState(alwaysOnTopLineDesc);
if (m_alwaysOnTopLinePipelineState == nullptr || !m_alwaysOnTopLinePipelineState->IsValid()) {
DestroyResources();
@@ -707,7 +757,7 @@ bool SceneViewportEditorOverlayPassRenderer::CreateResources(
}
const RHI::GraphicsPipelineDesc depthTestedScreenTriangleDesc =
BuildScreenTrianglePipelineDesc(m_linePipelineLayout, true);
BuildScreenTrianglePipelineDesc(m_linePipelineLayout, surface, true);
m_depthTestedScreenTrianglePipelineState = m_device->CreatePipelineState(depthTestedScreenTriangleDesc);
if (m_depthTestedScreenTrianglePipelineState == nullptr ||
!m_depthTestedScreenTrianglePipelineState->IsValid()) {
@@ -716,7 +766,7 @@ bool SceneViewportEditorOverlayPassRenderer::CreateResources(
}
const RHI::GraphicsPipelineDesc alwaysOnTopScreenTriangleDesc =
BuildScreenTrianglePipelineDesc(m_linePipelineLayout, false);
BuildScreenTrianglePipelineDesc(m_linePipelineLayout, surface, false);
m_alwaysOnTopScreenTrianglePipelineState = m_device->CreatePipelineState(alwaysOnTopScreenTriangleDesc);
if (m_alwaysOnTopScreenTrianglePipelineState == nullptr ||
!m_alwaysOnTopScreenTrianglePipelineState->IsValid()) {
@@ -725,7 +775,7 @@ bool SceneViewportEditorOverlayPassRenderer::CreateResources(
}
const RHI::GraphicsPipelineDesc depthTestedSpriteDesc =
BuildSpritePipelineDesc(m_spritePipelineLayout, true);
BuildSpritePipelineDesc(m_spritePipelineLayout, surface, true);
m_depthTestedSpritePipelineState = m_device->CreatePipelineState(depthTestedSpriteDesc);
if (m_depthTestedSpritePipelineState == nullptr || !m_depthTestedSpritePipelineState->IsValid()) {
DestroyResources();
@@ -733,7 +783,7 @@ bool SceneViewportEditorOverlayPassRenderer::CreateResources(
}
const RHI::GraphicsPipelineDesc alwaysOnTopSpriteDesc =
BuildSpritePipelineDesc(m_spritePipelineLayout, false);
BuildSpritePipelineDesc(m_spritePipelineLayout, surface, false);
m_alwaysOnTopSpritePipelineState = m_device->CreatePipelineState(alwaysOnTopSpriteDesc);
if (m_alwaysOnTopSpritePipelineState == nullptr || !m_alwaysOnTopSpritePipelineState->IsValid()) {
DestroyResources();
@@ -986,6 +1036,9 @@ void SceneViewportEditorOverlayPassRenderer::DestroyResources() {
m_lineVertexBufferCapacity = 0u;
m_screenTriangleVertexBufferCapacity = 0u;
m_spriteVertexBufferCapacity = 0u;
m_renderTargetFormat = RHI::Format::Unknown;
m_depthStencilFormat = RHI::Format::Unknown;
m_renderTargetSampleCount = 1u;
m_device = nullptr;
m_backendType = RHI::RHIType::D3D12;
}

View File

@@ -3,6 +3,7 @@
#include "Viewport/SceneViewportEditorOverlayData.h"
#include "Viewport/SceneViewportOverlaySpriteResources.h"
#include <XCEngine/RHI/RHIEnums.h>
#include <XCEngine/Rendering/RenderContext.h>
#include <XCEngine/Rendering/RenderPass.h>
#include <XCEngine/Rendering/RenderSurface.h>
@@ -39,8 +40,12 @@ public:
const SceneViewportOverlayFrameData& frameData);
private:
bool EnsureInitialized(const Rendering::RenderContext& renderContext);
bool CreateResources(const Rendering::RenderContext& renderContext);
bool EnsureInitialized(
const Rendering::RenderContext& renderContext,
const Rendering::RenderSurface& surface);
bool CreateResources(
const Rendering::RenderContext& renderContext,
const Rendering::RenderSurface& surface);
bool EnsureLineBufferCapacity(size_t requiredVertexCount);
bool EnsureScreenTriangleBufferCapacity(size_t requiredVertexCount);
bool EnsureSpriteBufferCapacity(size_t requiredVertexCount);
@@ -72,6 +77,9 @@ private:
uint64_t m_lineVertexBufferCapacity = 0;
uint64_t m_screenTriangleVertexBufferCapacity = 0;
uint64_t m_spriteVertexBufferCapacity = 0;
RHI::Format m_renderTargetFormat = RHI::Format::Unknown;
RHI::Format m_depthStencilFormat = RHI::Format::Unknown;
uint32_t m_renderTargetSampleCount = 1u;
SceneViewportOverlaySpriteResourceCache m_overlaySpriteResources = {};
};

View File

@@ -76,8 +76,12 @@ bool SceneViewportSelectionOutlinePassRenderer::Render(
return m_outlinePass.Render(
renderContext,
surface,
targets.selectionMaskShaderView,
targets.depthShaderView,
{
targets.selectionMaskShaderView,
targets.selectionMaskState,
targets.depthShaderView,
surface.GetDepthStateAfter()
},
ToBuiltinSceneViewportSelectionOutlineStyle(style));
}

View File

@@ -106,7 +106,7 @@ inline SceneViewportTransformGizmoHandleBuildInputs BuildSceneViewportTransformG
return inputs;
}
namespace Detail {
namespace Internal {
inline constexpr int kSceneViewportHandlePrioritySceneIcon = 100;
inline constexpr int kSceneViewportHandlePriorityRotateAxis = 311;
@@ -554,21 +554,21 @@ inline void AppendScaleGizmoScreenTriangles(
}
}
} // namespace Detail
} // namespace Internal
inline void AppendTransformGizmoHandleRecords(
SceneViewportOverlayFrameData& frameData,
const SceneViewportTransformGizmoHandleBuildInputs& inputs) {
if (inputs.moveGizmo != nullptr) {
Detail::AppendMoveGizmoHandleRecords(frameData, *inputs.moveGizmo, inputs.moveEntityId);
Internal::AppendMoveGizmoHandleRecords(frameData, *inputs.moveGizmo, inputs.moveEntityId);
}
if (inputs.rotateGizmo != nullptr) {
Detail::AppendRotateGizmoHandleRecords(frameData, *inputs.rotateGizmo, inputs.rotateEntityId);
Internal::AppendRotateGizmoHandleRecords(frameData, *inputs.rotateGizmo, inputs.rotateEntityId);
}
if (inputs.scaleGizmo != nullptr) {
Detail::AppendScaleGizmoHandleRecords(frameData, *inputs.scaleGizmo, inputs.scaleEntityId);
Internal::AppendScaleGizmoHandleRecords(frameData, *inputs.scaleGizmo, inputs.scaleEntityId);
}
}
@@ -576,15 +576,15 @@ inline void AppendTransformGizmoScreenTriangles(
SceneViewportOverlayFrameData& frameData,
const SceneViewportTransformGizmoHandleBuildInputs& inputs) {
if (inputs.moveGizmo != nullptr) {
Detail::AppendMoveGizmoScreenTriangles(frameData, *inputs.moveGizmo);
Internal::AppendMoveGizmoScreenTriangles(frameData, *inputs.moveGizmo);
}
if (inputs.rotateGizmo != nullptr) {
Detail::AppendRotateGizmoScreenTriangles(frameData, *inputs.rotateGizmo);
Internal::AppendRotateGizmoScreenTriangles(frameData, *inputs.rotateGizmo);
}
if (inputs.scaleGizmo != nullptr) {
Detail::AppendScaleGizmoScreenTriangles(frameData, *inputs.scaleGizmo);
Internal::AppendScaleGizmoScreenTriangles(frameData, *inputs.scaleGizmo);
}
}

View File

@@ -9,7 +9,7 @@
namespace XCEngine {
namespace Editor {
namespace Detail {
namespace Internal {
inline bool IsPointInsideSceneViewportScreenRect(
const Math::Vector2& point,
@@ -144,7 +144,7 @@ inline bool TryBuildSceneViewportOverlayHandleHitMetrics(
}
}
} // namespace Detail
} // namespace Internal
inline SceneViewportOverlayHandleHitResult HitTestSceneViewportOverlayHandles(
const SceneViewportOverlayFrameData& frameData,
@@ -156,7 +156,7 @@ inline SceneViewportOverlayHandleHitResult HitTestSceneViewportOverlayHandles(
for (const SceneViewportOverlayHandleRecord& handleRecord : frameData.handleRecords) {
float distanceSq = 0.0f;
float depth = 0.0f;
if (!Detail::TryBuildSceneViewportOverlayHandleHitMetrics(
if (!Internal::TryBuildSceneViewportOverlayHandleHitMetrics(
frameData,
viewportSize,
handleRecord,

View File

@@ -153,7 +153,7 @@ void AppendHandleRecord(
handleRecord.handleId = handleId;
handleRecord.entityId = entityId;
handleRecord.shape = SceneViewportOverlayHandleShape::WorldRect;
handleRecord.priority = Detail::kSceneViewportHandlePrioritySceneIcon;
handleRecord.priority = Internal::kSceneViewportHandlePrioritySceneIcon;
handleRecord.worldPosition = worldPosition;
handleRecord.sizePixels = sizePixels;
handleRecord.sortDepth = sortDepth;

View File

@@ -7,7 +7,7 @@
namespace XCEngine {
namespace Editor {
namespace Detail {
namespace Internal {
inline Containers::String NormalizeSceneViewportResourcePath(const std::filesystem::path& path) {
return Containers::String(path.lexically_normal().generic_string().c_str());
@@ -29,10 +29,10 @@ inline Containers::String BuildSceneViewportEditorResourcePath(const std::filesy
relativePath);
}
} // namespace Detail
} // namespace Internal
inline Containers::String GetSceneViewportInfiniteGridShaderPath() {
return Detail::BuildSceneViewportEditorResourcePath(
return Internal::BuildSceneViewportEditorResourcePath(
std::filesystem::path("shaders") /
"scene-viewport" /
"infinite-grid" /
@@ -40,22 +40,22 @@ inline Containers::String GetSceneViewportInfiniteGridShaderPath() {
}
inline Containers::String GetSceneViewportCameraGizmoIconPath() {
return Detail::BuildSceneViewportEditorResourcePath(
return Internal::BuildSceneViewportEditorResourcePath(
std::filesystem::path("Icons") / "camera_gizmo.png");
}
inline Containers::String GetSceneViewportDirectionalLightGizmoIconPath() {
return Detail::BuildSceneViewportEditorResourcePath(
return Internal::BuildSceneViewportEditorResourcePath(
std::filesystem::path("Icons") / "directional_light_gizmo.png");
}
inline Containers::String GetSceneViewportPointLightGizmoIconPath() {
return Detail::BuildSceneViewportEditorResourcePath(
return Internal::BuildSceneViewportEditorResourcePath(
std::filesystem::path("Icons") / "point_light_gizmo.png");
}
inline Containers::String GetSceneViewportSpotLightGizmoIconPath() {
return Detail::BuildSceneViewportEditorResourcePath(
return Internal::BuildSceneViewportEditorResourcePath(
std::filesystem::path("Icons") / "spot_light_gizmo.png");
}

View File

@@ -91,7 +91,7 @@ inline Rendering::RenderSurface BuildViewportSelectionMaskSurface(const Viewport
targets.selectionMaskState);
}
namespace Detail {
namespace Internal {
template <typename ResourceType>
inline void ShutdownAndDelete(ResourceType*& resource) {
@@ -232,7 +232,7 @@ inline bool CreateViewportTextureDescriptor(
return true;
}
} // namespace Detail
} // namespace Internal
inline void DestroyViewportRenderTargets(
UI::ImGuiBackendBridge* backend,
@@ -241,19 +241,19 @@ inline void DestroyViewportRenderTargets(
backend->FreeTextureDescriptor(targets.imguiCpuHandle, targets.imguiGpuHandle);
}
Detail::ShutdownAndDelete(targets.objectIdView);
Detail::ShutdownAndDelete(targets.objectIdShaderView);
Detail::ShutdownAndDelete(targets.objectIdDepthView);
Detail::ShutdownAndDelete(targets.objectIdDepthTexture);
Detail::ShutdownAndDelete(targets.objectIdTexture);
Detail::ShutdownAndDelete(targets.selectionMaskView);
Detail::ShutdownAndDelete(targets.selectionMaskShaderView);
Detail::ShutdownAndDelete(targets.selectionMaskTexture);
Detail::ShutdownAndDelete(targets.depthShaderView);
Detail::ShutdownAndDelete(targets.depthView);
Detail::ShutdownAndDelete(targets.depthTexture);
Detail::ShutdownAndDelete(targets.colorView);
Detail::ShutdownAndDelete(targets.colorTexture);
Internal::ShutdownAndDelete(targets.objectIdView);
Internal::ShutdownAndDelete(targets.objectIdShaderView);
Internal::ShutdownAndDelete(targets.objectIdDepthView);
Internal::ShutdownAndDelete(targets.objectIdDepthTexture);
Internal::ShutdownAndDelete(targets.objectIdTexture);
Internal::ShutdownAndDelete(targets.selectionMaskView);
Internal::ShutdownAndDelete(targets.selectionMaskShaderView);
Internal::ShutdownAndDelete(targets.selectionMaskTexture);
Internal::ShutdownAndDelete(targets.depthShaderView);
Internal::ShutdownAndDelete(targets.depthView);
Internal::ShutdownAndDelete(targets.depthTexture);
Internal::ShutdownAndDelete(targets.colorView);
Internal::ShutdownAndDelete(targets.colorTexture);
targets.width = 0;
targets.height = 0;
@@ -281,12 +281,12 @@ inline bool CreateViewportRenderTargets(
targets.width = width;
targets.height = height;
if (!Detail::CreateViewportColorResources(device, targets) ||
!Detail::CreateViewportDepthResources(device, targets) ||
if (!Internal::CreateViewportColorResources(device, targets) ||
!Internal::CreateViewportDepthResources(device, targets) ||
(ViewportRequiresObjectIdResources(kind) &&
(!Detail::CreateViewportObjectIdResources(device, targets) ||
!Detail::CreateViewportSelectionMaskResources(device, targets))) ||
!Detail::CreateViewportTextureDescriptor(backend, device, targets)) {
(!Internal::CreateViewportObjectIdResources(device, targets) ||
!Internal::CreateViewportSelectionMaskResources(device, targets))) ||
!Internal::CreateViewportTextureDescriptor(backend, device, targets)) {
DestroyViewportRenderTargets(backend, targets);
return false;
}