Files
XCEngine/new_editor/app/Rendering/Viewport/ViewportRenderTargetInternal.h

59 lines
1.9 KiB
C++

#pragma once
#include "ViewportTypes.h"
#include <XCEngine/RHI/RHIEnums.h>
#include <XCEngine/RHI/RHIResourceView.h>
#include <XCEngine/RHI/RHITypes.h>
#include <XCEngine/Rendering/RenderSurface.h>
#include <cstdint>
namespace XCEngine::UI::Editor::App {
struct ViewportResourcePresence {
bool hasColorTexture = false;
bool hasColorView = false;
bool hasDepthTexture = false;
bool hasDepthView = false;
bool hasDepthShaderView = false;
bool hasObjectIdTexture = false;
bool hasObjectIdDepthTexture = false;
bool hasObjectIdDepthView = false;
bool hasObjectIdView = false;
bool hasObjectIdShaderView = false;
bool hasSelectionMaskTexture = false;
bool hasSelectionMaskView = false;
bool hasSelectionMaskShaderView = false;
bool hasTextureDescriptor = false;
};
struct ViewportResourceReuseQuery {
ViewportKind kind = ViewportKind::Scene;
std::uint32_t width = 0;
std::uint32_t height = 0;
std::uint32_t requestedWidth = 0;
std::uint32_t requestedHeight = 0;
ViewportResourcePresence resources = {};
};
bool ViewportRequiresObjectIdResources(ViewportKind kind);
std::uint32_t ClampViewportPixelCoordinate(float value, std::uint32_t extent);
bool CanReuseViewportResources(const ViewportResourceReuseQuery& query);
::XCEngine::RHI::TextureDesc BuildViewportTextureDesc(
std::uint32_t width,
std::uint32_t height,
::XCEngine::RHI::Format format);
::XCEngine::RHI::ResourceViewDesc BuildViewportTextureViewDesc(
::XCEngine::RHI::Format format);
::XCEngine::Rendering::RenderSurface BuildViewportRenderSurface(
std::uint32_t width,
std::uint32_t height,
::XCEngine::RHI::RHIResourceView* colorView,
::XCEngine::RHI::RHIResourceView* depthView,
::XCEngine::RHI::ResourceStates colorStateBefore,
::XCEngine::RHI::ResourceStates colorStateAfter =
::XCEngine::RHI::ResourceStates::PixelShaderResource);
} // namespace XCEngine::UI::Editor::App