summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-21 23:52:56 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-21 23:52:56 +0100
commitab5b46dbe58ae0401c24ead55a2627b9a577fc1a (patch)
tree8c2d20920186a636f33c471bd1bfa515ea9de2af /test
parentSwitch to render trees in bulk through foliage asset rendering (diff)
downloadilt-ab5b46dbe58ae0401c24ead55a2627b9a577fc1a.tar.bz2
ilt-ab5b46dbe58ae0401c24ead55a2627b9a577fc1a.tar.xz
ilt-ab5b46dbe58ae0401c24ead55a2627b9a577fc1a.zip
Instances buffer data needs to be unmapped before use
Here we change quite a bit to support mapping and unmapping the buffer as required. The instance/free referencing is still broken though. We add several instances of tree in the render.
Diffstat (limited to 'test')
-rw-r--r--test/Jamfile.jam2
-rw-r--r--test/test-assetFactory.cpp5
-rw-r--r--test/test-instancing.cpp15
3 files changed, 15 insertions, 7 deletions
diff --git a/test/Jamfile.jam b/test/Jamfile.jam
index 9cdcef4..1ce73b7 100644
--- a/test/Jamfile.jam
+++ b/test/Jamfile.jam
@@ -53,7 +53,7 @@ run test-text.cpp ;
run test-enumDetails.cpp ;
run test-render.cpp : -- : test-assetFactory : <library>test ;
run test-glContextBhvr.cpp ;
-run test-assetFactory.cpp : -- : [ sequence.insertion-sort [ glob-tree $(res) : *.* ] fixtures/rgb.txt ] : <library>test ;
+run test-assetFactory.cpp : -- : [ sequence.insertion-sort [ glob-tree $(res) : *.* ] fixtures/rgb.txt test-instancing ] : <library>test ;
run perf-assetFactory.cpp : -- : test-assetFactory : <library>benchmark <library>test ;
run perf-persistence.cpp : -- : test-persistence : <library>benchmark <library>test ;
run test-worker.cpp ;
diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp
index 817654b..82a1825 100644
--- a/test/test-assetFactory.cpp
+++ b/test/test-assetFactory.cpp
@@ -107,7 +107,10 @@ BOOST_AUTO_TEST_CASE(foliage, *boost::unit_test::timeout(5))
auto tree_01_1_f = std::dynamic_pointer_cast<Foliage>(tree_01_1);
BOOST_REQUIRE(tree_01_1_f);
- auto plant = std::make_shared<Plant>(tree_01_1_f, Location {{-2, 2, 0}, {}});
+ auto plant1 = std::make_shared<Plant>(tree_01_1_f, Location {{-2, 2, 0}, {0, 0, 0}});
+ auto plant2 = std::make_shared<Plant>(tree_01_1_f, Location {{3, -4, 0}, {0, 1, 0}});
+ auto plant3 = std::make_shared<Plant>(tree_01_1_f, Location {{-2, -4, 0}, {0, 2, 0}});
+ auto plant4 = std::make_shared<Plant>(tree_01_1_f, Location {{3, 2, 0}, {0, 3, 0}});
objects.objects.push_back(tree_01_1_f);
render(5);
diff --git a/test/test-instancing.cpp b/test/test-instancing.cpp
index 7191567..2eb3647 100644
--- a/test/test-instancing.cpp
+++ b/test/test-instancing.cpp
@@ -15,16 +15,21 @@ BOOST_FIXTURE_TEST_SUITE(i, InstanceVertices<int>)
BOOST_AUTO_TEST_CASE(createDestroy)
{
- BOOST_REQUIRE(data.data());
+ BOOST_CHECK(!data);
+ map();
+ BOOST_REQUIRE(data);
BOOST_CHECK_EQUAL(0, next);
BOOST_CHECK(unused.empty());
+ unmap();
+ BOOST_CHECK(!data);
}
BOOST_AUTO_TEST_CASE(storeRetreive)
{ // Read write raw buffer, not normally allowed
- std::vector<int> test(data.size());
- std::copy(test.begin(), test.end(), data.begin());
- BOOST_CHECK_EQUAL_COLLECTIONS(test.begin(), test.end(), data.begin(), data.end());
+ std::vector<int> test(capacity);
+ map();
+ std::copy(test.begin(), test.end(), data);
+ BOOST_CHECK_EQUAL_COLLECTIONS(test.begin(), test.end(), data, data + capacity);
}
BOOST_AUTO_TEST_CASE(acquireRelease)
@@ -69,7 +74,7 @@ BOOST_AUTO_TEST_CASE(resize)
proxies.push_back(acquire(n));
expected.emplace_back(n);
}
- BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(), expected.end(), data.begin(), data.begin() + COUNT);
+ BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(), expected.end(), data, data + COUNT);
BOOST_CHECK_EQUAL_COLLECTIONS(expected.begin(), expected.end(), proxies.begin(), proxies.end());
}