From bc2eae2ecd7ac709d9502f309eee0ec6332b5c14 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 19 Jan 2021 11:41:47 -0800 Subject: [PATCH] fix filament_test on aarch64 mac don't use slog from a static variable, because it might not have been constructed yet, due to static initialized order. For some reason, this happens on aarch64 macs, but this was actually a real problem. --- filament/test/filament_framegraph_test.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/filament/test/filament_framegraph_test.cpp b/filament/test/filament_framegraph_test.cpp index 603bbbeeba..137a97572e 100644 --- a/filament/test/filament_framegraph_test.cpp +++ b/filament/test/filament_framegraph_test.cpp @@ -27,10 +27,13 @@ using namespace filament; using namespace backend; -static CircularBuffer buffer(8192); -static Backend gBackend = Backend::NOOP; -static DefaultPlatform* platform = DefaultPlatform::create(&gBackend); -static CommandStream driverApi(*platform->createDriver(nullptr), buffer); +class FrameGraphTest : public testing::Test { +protected: + CircularBuffer buffer = CircularBuffer{ 8192 }; + Backend gBackend = Backend::NOOP; + DefaultPlatform* platform = DefaultPlatform::create(&gBackend); + CommandStream driverApi = CommandStream{ *platform->createDriver(nullptr), buffer }; +}; class MockResourceAllocator : public ResourceAllocatorInterface { uint32_t handle = 0; @@ -74,7 +77,7 @@ private: int GenericResource::state = 0; -TEST(FrameGraphTest, SimpleRenderPass) { +TEST_F(FrameGraphTest, SimpleRenderPass) { ResourceAllocator resourceAllocator(driverApi); FrameGraph fg(resourceAllocator); @@ -128,7 +131,7 @@ TEST(FrameGraphTest, SimpleRenderPass) { resourceAllocator.terminate(); } -TEST(FrameGraphTest, SimpleRenderPass2) { +TEST_F(FrameGraphTest, SimpleRenderPass2) { ResourceAllocator resourceAllocator(driverApi); FrameGraph fg(resourceAllocator); @@ -176,7 +179,7 @@ TEST(FrameGraphTest, SimpleRenderPass2) { resourceAllocator.terminate(); } -TEST(FrameGraphTest, ScenarioDepthPrePass) { +TEST_F(FrameGraphTest, ScenarioDepthPrePass) { ResourceAllocator resourceAllocator(driverApi); FrameGraph fg(resourceAllocator); @@ -252,7 +255,7 @@ TEST(FrameGraphTest, ScenarioDepthPrePass) { resourceAllocator.terminate(); } -TEST(FrameGraphTest, SimplePassCulling) { +TEST_F(FrameGraphTest, SimplePassCulling) { ResourceAllocator resourceAllocator(driverApi); FrameGraph fg(resourceAllocator); @@ -356,7 +359,7 @@ TEST(FrameGraphTest, SimplePassCulling) { resourceAllocator.terminate(); } -TEST(FrameGraphTest, MoveGenericResource) { +TEST_F(FrameGraphTest, MoveGenericResource) { // This checks that: // - two passes writing in the same resource, that is replaced (moved) by // another resource, end-up both using the 'replacing' resource.