mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-08 22:05:37 +00:00
Fix a few bugs in our CompressionJobList's
This commit is contained in:
parent
ae2324153d
commit
7c3b3d8144
|
@ -126,9 +126,6 @@ struct CompressionJobList {
|
||||||
const CompressionJob *GetJob(uint32 idx) const;
|
const CompressionJob *GetJob(uint32 idx) const;
|
||||||
uint32 *GetFinishedFlag(uint32 idx) const;
|
uint32 *GetFinishedFlag(uint32 idx) const;
|
||||||
|
|
||||||
ALIGN(32) uint32 m_CurrentBlockIndex;
|
|
||||||
ALIGN(32) uint32 m_CurrentJobIndex;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CompressionJob *m_Jobs;
|
CompressionJob *m_Jobs;
|
||||||
uint32 m_NumJobs;
|
uint32 m_NumJobs;
|
||||||
|
@ -137,6 +134,10 @@ struct CompressionJobList {
|
||||||
struct FinishedFlag{
|
struct FinishedFlag{
|
||||||
ALIGN(32) uint32 m_flag;
|
ALIGN(32) uint32 m_flag;
|
||||||
} *m_FinishedFlags;
|
} *m_FinishedFlags;
|
||||||
|
|
||||||
|
public:
|
||||||
|
ALIGN(32) uint32 m_CurrentJobIndex;
|
||||||
|
ALIGN(32) uint32 m_CurrentBlockIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __COMPRESSION_JOBS_H__
|
#endif // __COMPRESSION_JOBS_H__
|
||||||
|
|
|
@ -53,6 +53,8 @@
|
||||||
CompressionJobList::CompressionJobList(const uint32 nJobs)
|
CompressionJobList::CompressionJobList(const uint32 nJobs)
|
||||||
: m_NumJobs(0)
|
: m_NumJobs(0)
|
||||||
, m_TotalNumJobs(nJobs)
|
, m_TotalNumJobs(nJobs)
|
||||||
|
, m_CurrentJobIndex(0)
|
||||||
|
, m_CurrentBlockIndex(0)
|
||||||
{
|
{
|
||||||
m_FinishedFlags = new FinishedFlag[nJobs];
|
m_FinishedFlags = new FinishedFlag[nJobs];
|
||||||
memset(m_FinishedFlags, 0, nJobs * sizeof(m_FinishedFlags[0]));
|
memset(m_FinishedFlags, 0, nJobs * sizeof(m_FinishedFlags[0]));
|
||||||
|
@ -69,6 +71,8 @@ CompressionJobList::~CompressionJobList() {
|
||||||
CompressionJobList::CompressionJobList(const CompressionJobList &other)
|
CompressionJobList::CompressionJobList(const CompressionJobList &other)
|
||||||
: m_NumJobs(other.m_NumJobs)
|
: m_NumJobs(other.m_NumJobs)
|
||||||
, m_TotalNumJobs(other.m_TotalNumJobs)
|
, m_TotalNumJobs(other.m_TotalNumJobs)
|
||||||
|
, m_CurrentJobIndex(other.m_CurrentJobIndex)
|
||||||
|
, m_CurrentBlockIndex(other.m_CurrentBlockIndex)
|
||||||
{
|
{
|
||||||
uint32 arraySz = m_TotalNumJobs * sizeof(m_Jobs[0]);
|
uint32 arraySz = m_TotalNumJobs * sizeof(m_Jobs[0]);
|
||||||
m_Jobs = (CompressionJob *)malloc(arraySz);
|
m_Jobs = (CompressionJob *)malloc(arraySz);
|
||||||
|
@ -82,6 +86,8 @@ CompressionJobList &CompressionJobList::operator =(const CompressionJobList &oth
|
||||||
assert(m_TotalNumJobs == other.m_TotalNumJobs);
|
assert(m_TotalNumJobs == other.m_TotalNumJobs);
|
||||||
|
|
||||||
m_NumJobs = other.m_NumJobs;
|
m_NumJobs = other.m_NumJobs;
|
||||||
|
m_CurrentJobIndex = other.m_CurrentJobIndex;
|
||||||
|
m_CurrentBlockIndex = other.m_CurrentBlockIndex;
|
||||||
|
|
||||||
// Get rid of old variables...
|
// Get rid of old variables...
|
||||||
free(m_Jobs);
|
free(m_Jobs);
|
||||||
|
@ -108,7 +114,7 @@ bool CompressionJobList::AddJob(const CompressionJob &cj) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const CompressionJob *CompressionJobList::GetJob(uint32 idx) const {
|
const CompressionJob *CompressionJobList::GetJob(uint32 idx) const {
|
||||||
if(idx <= m_NumJobs) {
|
if(idx >= m_NumJobs) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,9 +122,9 @@ const CompressionJob *CompressionJobList::GetJob(uint32 idx) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 *CompressionJobList::GetFinishedFlag(uint32 idx) const {
|
uint32 *CompressionJobList::GetFinishedFlag(uint32 idx) const {
|
||||||
if(idx <= m_NumJobs) {
|
if(idx >= m_NumJobs) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return &(m_FinishedFlags[idx].m_flag);
|
return &(m_FinishedFlags[idx].m_flag);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue