Formalize fullscreen render request contract
This commit is contained in:
@@ -109,6 +109,20 @@ inline bool HasValidColorTarget(const RenderSurface& surface) {
|
||||
surface.GetRenderAreaHeight() > 0;
|
||||
}
|
||||
|
||||
inline bool HasValidSurfaceSampleDescription(const RenderSurface& surface) {
|
||||
const uint32_t sampleCount = surface.GetSampleCount();
|
||||
const uint32_t sampleQuality = surface.GetSampleQuality();
|
||||
return sampleCount > 0u &&
|
||||
(sampleCount > 1u || sampleQuality == 0u);
|
||||
}
|
||||
|
||||
inline bool HasValidSingleSampleColorSource(const RenderSurface& surface) {
|
||||
return HasValidColorTarget(surface) &&
|
||||
HasValidSurfaceSampleDescription(surface) &&
|
||||
surface.GetSampleCount() == 1u &&
|
||||
surface.GetSampleQuality() == 0u;
|
||||
}
|
||||
|
||||
struct DirectionalShadowRenderPlan {
|
||||
bool enabled = false;
|
||||
Math::Vector3 lightDirection = Math::Vector3::Back();
|
||||
@@ -149,6 +163,7 @@ struct ObjectIdRenderRequest {
|
||||
struct FullscreenPassRenderRequest {
|
||||
RenderSurface sourceSurface;
|
||||
RHI::RHIResourceView* sourceColorView = nullptr;
|
||||
RHI::ResourceStates sourceColorState = RHI::ResourceStates::Common;
|
||||
RenderSurface destinationSurface;
|
||||
RenderPassSequence* passes = nullptr;
|
||||
|
||||
@@ -165,10 +180,15 @@ struct FullscreenPassRenderRequest {
|
||||
}
|
||||
|
||||
bool IsValid() const {
|
||||
const bool sourceStateIsUsable =
|
||||
sourceSurface.IsAutoTransitionEnabled() ||
|
||||
sourceColorState == RHI::ResourceStates::PixelShaderResource;
|
||||
return passes != nullptr &&
|
||||
HasValidColorTarget(sourceSurface) &&
|
||||
HasValidSingleSampleColorSource(sourceSurface) &&
|
||||
sourceColorView != nullptr &&
|
||||
HasValidColorTarget(destinationSurface);
|
||||
sourceStateIsUsable &&
|
||||
HasValidColorTarget(destinationSurface) &&
|
||||
HasValidSurfaceSampleDescription(destinationSurface);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -322,6 +342,17 @@ struct CameraRenderRequest {
|
||||
}
|
||||
}
|
||||
|
||||
RHI::ResourceStates GetSourceColorState(CameraFrameStage stage) const {
|
||||
switch (stage) {
|
||||
case CameraFrameStage::PostProcess:
|
||||
return postProcess.IsRequested() ? postProcess.sourceColorState : RHI::ResourceStates::Common;
|
||||
case CameraFrameStage::FinalOutput:
|
||||
return finalOutput.IsRequested() ? finalOutput.sourceColorState : RHI::ResourceStates::Common;
|
||||
default:
|
||||
return RHI::ResourceStates::Common;
|
||||
}
|
||||
}
|
||||
|
||||
bool RequiresIntermediateSceneColor() const {
|
||||
return postProcess.IsRequested() || finalOutput.IsRequested();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user