64 lines
2.5 KiB
C++
64 lines
2.5 KiB
C++
#include "ViewportRenderTargets.h"
|
|
|
|
namespace XCEngine::UI::Editor::App {
|
|
|
|
ViewportResourceReuseQuery BuildViewportRenderTargetsReuseQuery(
|
|
ViewportKind kind,
|
|
const ViewportRenderTargets& targets,
|
|
std::uint32_t requestedWidth,
|
|
std::uint32_t requestedHeight) {
|
|
ViewportResourceReuseQuery query = {};
|
|
query.kind = kind;
|
|
query.width = targets.width;
|
|
query.height = targets.height;
|
|
query.requestedWidth = requestedWidth;
|
|
query.requestedHeight = requestedHeight;
|
|
query.resources.hasColorTexture = targets.colorTexture != nullptr;
|
|
query.resources.hasColorView = targets.colorView != nullptr;
|
|
query.resources.hasDepthTexture = targets.depthTexture != nullptr;
|
|
query.resources.hasDepthView = targets.depthView != nullptr;
|
|
query.resources.hasDepthShaderView = targets.depthShaderView != nullptr;
|
|
query.resources.hasObjectIdTexture = targets.objectIdTexture != nullptr;
|
|
query.resources.hasObjectIdDepthTexture = targets.objectIdDepthTexture != nullptr;
|
|
query.resources.hasObjectIdDepthView = targets.objectIdDepthView != nullptr;
|
|
query.resources.hasObjectIdView = targets.objectIdView != nullptr;
|
|
query.resources.hasObjectIdShaderView = targets.objectIdShaderView != nullptr;
|
|
query.resources.hasSelectionMaskTexture = targets.selectionMaskTexture != nullptr;
|
|
query.resources.hasSelectionMaskView = targets.selectionMaskView != nullptr;
|
|
query.resources.hasSelectionMaskShaderView = targets.selectionMaskShaderView != nullptr;
|
|
query.resources.hasTextureDescriptor = targets.textureHandle.IsValid();
|
|
return query;
|
|
}
|
|
|
|
::XCEngine::Rendering::RenderSurface BuildViewportColorSurface(
|
|
const ViewportRenderTargets& targets) {
|
|
return BuildViewportRenderSurface(
|
|
targets.width,
|
|
targets.height,
|
|
targets.colorView,
|
|
targets.depthView,
|
|
targets.colorState);
|
|
}
|
|
|
|
::XCEngine::Rendering::RenderSurface BuildViewportObjectIdSurface(
|
|
const ViewportRenderTargets& targets) {
|
|
return BuildViewportRenderSurface(
|
|
targets.width,
|
|
targets.height,
|
|
targets.objectIdView,
|
|
targets.objectIdDepthView,
|
|
targets.objectIdState);
|
|
}
|
|
|
|
::XCEngine::Rendering::RenderSurface BuildViewportSelectionMaskSurface(
|
|
const ViewportRenderTargets& targets) {
|
|
return BuildViewportRenderSurface(
|
|
targets.width,
|
|
targets.height,
|
|
targets.selectionMaskView,
|
|
targets.depthView,
|
|
targets.selectionMaskState);
|
|
}
|
|
|
|
} // namespace XCEngine::UI::Editor::App
|