Merge pull request #1276 from CesiumGS/removed-credit-sources
cesium-native / Quick Checks (push) Waiting to run
Details
cesium-native / Linting (push) Waiting to run
Details
cesium-native / Documentation (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.build_type}} (Debug, windows-2022) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.build_type}} (RelWithDebInfo, windows-2022) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (Debug, clang, macos-13) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (Debug, clang, ubuntu-22.04) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (Debug, gcc, ubuntu-24.04) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (RelWithDebInfo, clang, macos-13) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (RelWithDebInfo, clang, ubuntu-22.04) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (RelWithDebInfo, gcc, ubuntu-24.04) (push) Waiting to run
Details
cesium-native / Emscripten v${{matrix.version}} ${{matrix.memory}}bit memory (32, 3.1.39) (push) Waiting to run
Details
cesium-native / Emscripten v${{matrix.version}} ${{matrix.memory}}bit memory (32, 4.0.13) (push) Waiting to run
Details
cesium-native / Emscripten v${{matrix.version}} ${{matrix.memory}}bit memory (64, 4.0.13) (push) Waiting to run
Details
cesium-native / Quick Checks (push) Waiting to run
Details
cesium-native / Linting (push) Waiting to run
Details
cesium-native / Documentation (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.build_type}} (Debug, windows-2022) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.build_type}} (RelWithDebInfo, windows-2022) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (Debug, clang, macos-13) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (Debug, clang, ubuntu-22.04) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (Debug, gcc, ubuntu-24.04) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (RelWithDebInfo, clang, macos-13) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (RelWithDebInfo, clang, ubuntu-22.04) (push) Waiting to run
Details
cesium-native / ${{matrix.platform}} / ${{matrix.compiler}} / ${{matrix.build_type}} (RelWithDebInfo, gcc, ubuntu-24.04) (push) Waiting to run
Details
cesium-native / Emscripten v${{matrix.version}} ${{matrix.memory}}bit memory (32, 3.1.39) (push) Waiting to run
Details
cesium-native / Emscripten v${{matrix.version}} ${{matrix.memory}}bit memory (32, 4.0.13) (push) Waiting to run
Details
cesium-native / Emscripten v${{matrix.version}} ${{matrix.memory}}bit memory (64, 4.0.13) (push) Waiting to run
Details
Report credits with destroyed source as removed.
This commit is contained in:
commit
5b3b30e0d9
|
|
@ -315,6 +315,11 @@ private:
|
|||
CreditsSnapshot _snapshot;
|
||||
std::vector<int32_t> _referenceCountScratch;
|
||||
|
||||
// These are credits that were shown in the last snapshot but whose
|
||||
// CreditSources have since been destroyed. They need to be reported in
|
||||
// removedCredits in the next snapshot.
|
||||
std::vector<Credit> _shownCreditsDestroyed;
|
||||
|
||||
// Each entry in this vector is an index into _credits that is unused and can
|
||||
// be reused for a new credit.
|
||||
std::vector<size_t> _unusedCreditRecords;
|
||||
|
|
|
|||
|
|
@ -191,7 +191,11 @@ CreditSystem::getSnapshot(CreditFilteringMode filteringMode) noexcept {
|
|||
std::vector<Credit>& currentCredits = this->_snapshot.currentCredits;
|
||||
std::vector<Credit>& removedCredits = this->_snapshot.removedCredits;
|
||||
currentCredits.clear();
|
||||
removedCredits.clear();
|
||||
|
||||
// Any credits that were shown last snapshot and whose sources have since been
|
||||
// destroyed need to be reported in removedCredits.
|
||||
removedCredits = this->_shownCreditsDestroyed;
|
||||
this->_shownCreditsDestroyed.clear();
|
||||
|
||||
std::vector<int32_t>& effectiveReferenceCounts = this->_referenceCountScratch;
|
||||
effectiveReferenceCounts.assign(this->_credits.size(), 0);
|
||||
|
|
@ -290,6 +294,12 @@ void CreditSystem::createCreditSource(CreditSource& creditSource) noexcept {
|
|||
void CreditSystem::destroyCreditSource(CreditSource& creditSource) noexcept {
|
||||
for (CreditRecord& record : this->_credits) {
|
||||
if (record.pSource == &creditSource) {
|
||||
if (record.shownLastSnapshot) {
|
||||
this->_shownCreditsDestroyed.emplace_back(Credit(
|
||||
uint32_t(&record - this->_credits.data()),
|
||||
record.generation));
|
||||
}
|
||||
|
||||
record.pSource = nullptr;
|
||||
++record.generation;
|
||||
this->_unusedCreditRecords.emplace_back(&record - this->_credits.data());
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ TEST_CASE("Test CreditSystem with CreditSources") {
|
|||
}
|
||||
|
||||
SUBCASE("when the source of a credit last frame is destroyed, that credit is "
|
||||
"not reported") {
|
||||
"reported in removedCredits") {
|
||||
std::unique_ptr<CreditSource> pTempSourceA =
|
||||
std::make_unique<CreditSource>(creditSystem);
|
||||
Credit credit0 = creditSystem.createCredit(*pTempSourceA, html0);
|
||||
|
|
@ -257,13 +257,14 @@ TEST_CASE("Test CreditSystem with CreditSources") {
|
|||
// this credit would show up in the `removedCredits`.
|
||||
creditSystem.removeCreditReference(credit0);
|
||||
|
||||
// Destroy the source. Now, the removed credit should no longer be reported
|
||||
// in the next snapshot.
|
||||
// Destroy the source. The removed credit should still be reported in the
|
||||
// next snapshot.
|
||||
pTempSourceA.reset();
|
||||
|
||||
const CreditsSnapshot& snapshot1 = creditSystem.getSnapshot();
|
||||
CHECK(snapshot1.currentCredits.empty());
|
||||
CHECK(snapshot1.removedCredits.empty());
|
||||
CHECK(snapshot1.removedCredits.size() == 1);
|
||||
CHECK(snapshot1.removedCredits[0] == credit0);
|
||||
}
|
||||
|
||||
SUBCASE("CreditSystem may be destroyed before CreditSource") {
|
||||
|
|
|
|||
Loading…
Reference in New Issue