10#include "evan/EvanPlatform.hpp"
24 enum class BlendMode {
34 enum class OpaqueSortMode {
48 enum class ColorAttachmentMode {
56 SwapchainImageAttachment
75 [[nodiscard]]
inline ColorAttachmentMode
76 desktopColorAttachmentMode(VkSampleCountFlagBits msaaSamples)
noexcept
78 return msaaSamples == VK_SAMPLE_COUNT_1_BIT
79 ? ColorAttachmentMode::DirectToSwapchain
80 : ColorAttachmentMode::ResolveToSwapchain;
91 constexpr uint32_t kOpaqueDepthBucketCount = 32;
102 constexpr float kUnknownDepth = std::numeric_limits<float>::max();
120 [[nodiscard]]
inline uint32_t
121 opaqueDepthBucket(
float depth,
float nearest,
float span,
122 uint32_t bucketCount)
noexcept
131 if (!(span > 0.0f) || !(depth >= nearest) || depth == kUnknownDepth) {
135 const float normalized = (depth - nearest) / span;
138 if (!(normalized < 1.0f)) {
139 return bucketCount - 1;
142 return static_cast<uint32_t
>(normalized
143 *
static_cast<float>(bucketCount));
163 BlendMode blendMode = BlendMode::Opaque;
190 if (
lhs.blendMode !=
rhs.blendMode) {
191 return static_cast<int>(
lhs.blendMode)
192 <
static_cast<int>(
rhs.blendMode);
195 if (lhs.blendMode == BlendMode::Alpha) {
199 if (lhs.depth != rhs.depth) {
200 return lhs.depth > rhs.depth;
202 }
else if (lhs.depthBucket != rhs.depthBucket) {
206 return lhs.depthBucket < rhs.depthBucket;
209 if (lhs.pipelineKey != rhs.pipelineKey) {
210 return lhs.pipelineKey < rhs.pipelineKey;
212 if (lhs.materialID != rhs.materialID) {
213 return lhs.materialID < rhs.materialID;
215 if (lhs.vertexBuffer != rhs.vertexBuffer) {
216 return lhs.vertexBuffer < rhs.vertexBuffer;
218 if (lhs.indexBuffer != rhs.indexBuffer) {
219 return lhs.indexBuffer < rhs.indexBuffer;
221 return lhs.sequence < rhs.sequence;
Key that decides in which order a frame's draws are recorded.
Application-facing rendering configuration.
VkSampleCountFlagBits msaaSamples
Multisample anti-aliasing sample count.
OpaqueSortMode opaqueSort
Ordering strategy for the opaque draws of a frame.
Small result wrapper used by helpers that must return both a status and a value (e....