Simplify the vertex cache ID handling
This commit is contained in:
parent
1f4142e0e2
commit
186b0f105c
6 changed files with 13 additions and 24 deletions
|
@ -821,15 +821,6 @@ void DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti
|
|||
if ((vertexCount < 2 && prim > 0) || (vertexCount < 3 && prim > GE_PRIM_LINE_STRIP && prim != GE_PRIM_RECTANGLES))
|
||||
return;
|
||||
|
||||
if (g_Config.bVertexCache) {
|
||||
u32 dhash = dcid_;
|
||||
dhash = __rotl(dhash ^ (u32)(uintptr_t)verts, 13);
|
||||
dhash = __rotl(dhash ^ (u32)(uintptr_t)inds, 19);
|
||||
dhash = __rotl(dhash ^ (u32)vertTypeID, 7);
|
||||
dhash = __rotl(dhash ^ (u32)vertexCount, 11);
|
||||
dcid_ = lowbias32_r(dhash ^ (u32)prim);
|
||||
}
|
||||
|
||||
DeferredDrawCall &dc = drawCalls_[numDrawCalls_];
|
||||
dc.verts = verts;
|
||||
dc.inds = inds;
|
||||
|
|
|
@ -218,7 +218,6 @@ protected:
|
|||
|
||||
int decimationCounter_ = 0;
|
||||
int decodeCounter_ = 0;
|
||||
u32 dcid_ = 0;
|
||||
|
||||
// Vertex collector state
|
||||
IndexGenerator indexGen;
|
||||
|
|
|
@ -363,12 +363,13 @@ void DrawEngineD3D11::DoFlush() {
|
|||
useCache = false;
|
||||
|
||||
if (useCache) {
|
||||
u32 id = dcid_ ^ gstate.getUVGenMode(); // This can have an effect on which UV decoder we need to use! And hence what the decoded data will look like. See #9263
|
||||
// getUVGenMode can have an effect on which UV decoder we need to use! And hence what the decoded data will look like. See #9263
|
||||
u32 dcid = (u32)XXH3_64bits(&drawCalls_, sizeof(DeferredDrawCall) * numDrawCalls_) ^ gstate.getUVGenMode();
|
||||
|
||||
VertexArrayInfoD3D11 *vai = vai_.Get(id);
|
||||
VertexArrayInfoD3D11 *vai = vai_.Get(dcid);
|
||||
if (!vai) {
|
||||
vai = new VertexArrayInfoD3D11();
|
||||
vai_.Insert(id, vai);
|
||||
vai_.Insert(dcid, vai);
|
||||
}
|
||||
|
||||
switch (vai->status) {
|
||||
|
@ -724,7 +725,6 @@ rotateVBO:
|
|||
numDrawCalls_ = 0;
|
||||
vertexCountInDrawCalls_ = 0;
|
||||
decodeCounter_ = 0;
|
||||
dcid_ = 0;
|
||||
gstate_c.vertexFullAlpha = true;
|
||||
framebufferManager_->SetColorUpdated(gstate_c.skipDrawReason);
|
||||
|
||||
|
|
|
@ -345,11 +345,12 @@ void DrawEngineDX9::DoFlush() {
|
|||
useCache = false;
|
||||
|
||||
if (useCache) {
|
||||
u32 id = dcid_ ^ gstate.getUVGenMode(); // This can have an effect on which UV decoder we need to use! And hence what the decoded data will look like. See #9263
|
||||
VertexArrayInfoDX9 *vai = vai_.Get(id);
|
||||
// getUVGenMode can have an effect on which UV decoder we need to use! And hence what the decoded data will look like. See #9263
|
||||
u32 dcid = (u32)XXH3_64bits(&drawCalls_, sizeof(DeferredDrawCall) * numDrawCalls_) ^ gstate.getUVGenMode();
|
||||
VertexArrayInfoDX9 *vai = vai_.Get(dcid);
|
||||
if (!vai) {
|
||||
vai = new VertexArrayInfoDX9();
|
||||
vai_.Insert(id, vai);
|
||||
vai_.Insert(dcid, vai);
|
||||
}
|
||||
|
||||
switch (vai->status) {
|
||||
|
@ -666,7 +667,6 @@ rotateVBO:
|
|||
numDrawCalls_ = 0;
|
||||
vertexCountInDrawCalls_ = 0;
|
||||
decodeCounter_ = 0;
|
||||
dcid_ = 0;
|
||||
gstate_c.vertexFullAlpha = true;
|
||||
framebufferManager_->SetColorUpdated(gstate_c.skipDrawReason);
|
||||
|
||||
|
|
|
@ -248,7 +248,6 @@ void DrawEngineGLES::DoFlush() {
|
|||
numDrawCalls_ = 0;
|
||||
vertexCountInDrawCalls_ = 0;
|
||||
decodeCounter_ = 0;
|
||||
dcid_ = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -483,7 +482,6 @@ bail:
|
|||
numDrawCalls_ = 0;
|
||||
vertexCountInDrawCalls_ = 0;
|
||||
decodeCounter_ = 0;
|
||||
dcid_ = 0;
|
||||
gstate_c.vertexFullAlpha = true;
|
||||
framebufferManager_->SetColorUpdated(gstate_c.skipDrawReason);
|
||||
|
||||
|
|
|
@ -597,12 +597,14 @@ void DrawEngineVulkan::DoFlush() {
|
|||
}
|
||||
|
||||
if (useCache) {
|
||||
// getUVGenMode can have an effect on which UV decoder we need to use! And hence what the decoded data will look like. See #9263
|
||||
u32 dcid = (u32)XXH3_64bits(&drawCalls_, sizeof(DeferredDrawCall) * numDrawCalls_) ^ gstate.getUVGenMode();
|
||||
|
||||
PROFILE_THIS_SCOPE("vcache");
|
||||
u32 id = dcid_ ^ gstate.getUVGenMode(); // This can have an effect on which UV decoder we need to use! And hence what the decoded data will look like. See #9263
|
||||
VertexArrayInfoVulkan *vai = vai_.Get(id);
|
||||
VertexArrayInfoVulkan *vai = vai_.Get(dcid);
|
||||
if (!vai) {
|
||||
vai = new VertexArrayInfoVulkan();
|
||||
vai_.Insert(id, vai);
|
||||
vai_.Insert(dcid, vai);
|
||||
}
|
||||
|
||||
switch (vai->status) {
|
||||
|
@ -1011,7 +1013,6 @@ void DrawEngineVulkan::DoFlush() {
|
|||
numDrawCalls_ = 0;
|
||||
vertexCountInDrawCalls_ = 0;
|
||||
decodeCounter_ = 0;
|
||||
dcid_ = 0;
|
||||
gstate_c.vertexFullAlpha = true;
|
||||
framebufferManager_->SetColorUpdated(gstate_c.skipDrawReason);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue