Skip to content

Commit 35988be

Browse files
committed
pipeline2 attempt 4
1 parent 300a979 commit 35988be

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sources/libengine/graphics/renderPipeline.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ namespace cage
114114
{
115115
// opaque first, translucent last; translucent is ordered back-to-front, opaque is ordered front-to-back
116116
// reduce switching shaders, then depth test/writes and other states, then meshes
117+
117118
bool translucent = false; // transparent or fade
118119
sint32 renderLayer = 0;
119120
Real depth1;
@@ -122,6 +123,8 @@ namespace cage
122123
void *pointer = nullptr; // mesh or font
123124
bool skeletal = false;
124125
Real depth2;
126+
127+
auto operator<=>(const OrderData &) const = default;
125128
};
126129
#pragma pack(pop)
127130
static_assert(sizeof(OrderData) == 22 + sizeof(void *));
@@ -826,7 +829,7 @@ namespace cage
826829
return;
827830
RenderData rd;
828831
rd.model = modelTransform(e) * Mat4(Vec3(rt.layout.size * Vec2(-0.5, 0.5), 0));
829-
rd.color = Vec4(colorGammaToLinear(tc.color) * tc.intensity, 1); // todo opacitY
832+
rd.color = Vec4(colorGammaToLinear(tc.color) * tc.intensity, 1); // todo opacity
830833
rd.orderData.translucent = true;
831834
rd.orderData.renderLayer = tc.renderLayer;
832835
rd.orderData.pointer = +rt.font;
@@ -901,7 +904,7 @@ namespace cage
901904
{
902905
ProfilingScope profiling("sort");
903906
static_assert(std::is_trivially_copyable_v<OrderData>);
904-
std::sort(renderData.begin(), renderData.end(), [](const RenderData &a, const RenderData &b) -> bool { return detail::memcmp(&a.orderData, &b.orderData, sizeof(a.orderData)) < 0; });
907+
std::sort(renderData.begin(), renderData.end(), [](const RenderData &a, const RenderData &b) -> bool { return a.orderData < b.orderData; });
905908
}
906909
}
907910

0 commit comments

Comments
 (0)