Skip to content

Commit

Permalink
[dxvk] Optimized resource tracking
Browse files Browse the repository at this point in the history
Putting all resources that are used by a command list
into a vector instead of a hash set is more efficient.
  • Loading branch information
doitsujin committed Dec 20, 2017
1 parent d2b676b commit 70e5314
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build-win64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exe_wrapper = 'wine'
c_args = ['-Og', '-ggdb']
c_link_args = ['-static', '-static-libgcc']

cpp_args = ['-Og', '-gstabs']
cpp_args = ['-Og', '-gdwarf']
cpp_link_args = ['-static', '-static-libgcc', '-static-libstdc++']

[host_machine]
Expand Down
6 changes: 0 additions & 6 deletions src/dxvk/dxvk_lifetime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ namespace dxvk {
DxvkLifetimeTracker::~DxvkLifetimeTracker() { }


void DxvkLifetimeTracker::trackResource(const Rc<DxvkResource>& rc) {
if (m_resources.insert(rc).second)
rc->acquire();
}


void DxvkLifetimeTracker::reset() {
for (auto i = m_resources.cbegin(); i != m_resources.cend(); i++)
(*i)->release();
Expand Down
10 changes: 6 additions & 4 deletions src/dxvk/dxvk_lifetime.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <unordered_set>
#include <vector>

#include "dxvk_resource.h"

Expand All @@ -25,8 +25,10 @@ namespace dxvk {
* \brief Adds a resource to track
* \param [in] rc The resource to track
*/
void trackResource(
const Rc<DxvkResource>& rc);
void trackResource(const Rc<DxvkResource>& rc) {
m_resources.push_back(rc);
rc->acquire();
}

/**
* \brief Resets the command list
Expand All @@ -38,7 +40,7 @@ namespace dxvk {

private:

std::unordered_set<Rc<DxvkResource>, RcHash<DxvkResource>> m_resources;
std::vector<Rc<DxvkResource>> m_resources;

};

Expand Down

0 comments on commit 70e5314

Please sign in to comment.