mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
d3d12: Fix a potential race condition.
This commit is contained in:
parent
153f1cc50a
commit
30b804e0bc
@ -23,6 +23,8 @@ void data_cache::protect_data(u64 key, u32 start, size_t size)
|
|||||||
|
|
||||||
bool data_cache::invalidate_address(u32 addr)
|
bool data_cache::invalidate_address(u32 addr)
|
||||||
{
|
{
|
||||||
|
// In case 2 threads write to texture memory
|
||||||
|
std::lock_guard<std::mutex> lock(m_mut);
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
auto It = m_protected_ranges.begin(), E = m_protected_ranges.end();
|
auto It = m_protected_ranges.begin(), E = m_protected_ranges.end();
|
||||||
for (; It != E;)
|
for (; It != E;)
|
||||||
@ -33,7 +35,6 @@ bool data_cache::invalidate_address(u32 addr)
|
|||||||
u32 protectedRangeStart = std::get<1>(protectedTexture), protectedRangeSize = std::get<2>(protectedTexture);
|
u32 protectedRangeStart = std::get<1>(protectedTexture), protectedRangeSize = std::get<2>(protectedTexture);
|
||||||
if (addr >= protectedRangeStart && addr <= protectedRangeSize + protectedRangeStart)
|
if (addr >= protectedRangeStart && addr <= protectedRangeSize + protectedRangeStart)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(m_mut);
|
|
||||||
u64 texadrr = std::get<0>(protectedTexture);
|
u64 texadrr = std::get<0>(protectedTexture);
|
||||||
m_address_to_data[texadrr].first.m_is_dirty = true;
|
m_address_to_data[texadrr].first.m_is_dirty = true;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user