Minor cleanup

This commit is contained in:
Henrik Rydgård 2018-03-02 12:10:32 +01:00
parent 38bf10baaa
commit d3665a8482
3 changed files with 9 additions and 21 deletions

View File

@ -50,18 +50,6 @@ DrawEngineCommon::~DrawEngineCommon() {
});
}
void DrawEngineCommon::SetupVertexDecoder(u32 vertType) {
// As the decoder depends on the UVGenMode when we use UV prescale, we simply mash it
// into the top of the verttype where there are unused bits.
const u32 vertTypeID = (vertType & 0xFFFFFF) | (gstate.getUVGenMode() << 24);
// If vtype has changed, setup the vertex decoder.
if (vertTypeID != lastVType_) {
dec_ = GetVertexDecoder(vertTypeID);
lastVType_ = vertTypeID;
}
}
VertexDecoder *DrawEngineCommon::GetVertexDecoder(u32 vtype) {
VertexDecoder *dec = decoderMap_.Get(vtype);
if (dec)
@ -682,7 +670,14 @@ void DrawEngineCommon::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim,
prevPrim_ = prim;
}
SetupVertexDecoder(vertType);
// As the decoder depends on the UVGenMode when we use UV prescale, we simply mash it
// into the top of the verttype where there are unused bits.
const u32 vertTypeID = (vertType & 0xFFFFFF) | (gstate.getUVGenMode() << 24);
// If vtype has changed, setup the vertex decoder.
if (vertTypeID != lastVType_) {
dec_ = GetVertexDecoder(vertTypeID);
lastVType_ = vertTypeID;
}
*bytesRead = vertexCount * dec_->VertexSize();
if ((vertexCount < 2 && prim > 0) || (vertexCount < 3 && prim > 2 && prim != GE_PRIM_RECTANGLES))

View File

@ -74,8 +74,6 @@ public:
virtual void Resized();
void SetupVertexDecoder(u32 vertType);
bool IsCodePtrVertexDecoder(const u8 *ptr) const {
return decJitCache_->IsInSpace(ptr);
}

View File

@ -1491,8 +1491,7 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) {
framebufferManager_->SetRenderFrameBuffer(gstate_c.IsDirty(DIRTY_FRAMEBUF), gstate_c.skipDrawReason);
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
drawEngineCommon_->SetupVertexDecoder(gstate.vertType); // Do we still need to do this?
// Rough estimate, not sure what's correct.
// Rough estimate, not sure what's correct.
cyclesExecuted += EstimatePerVertexCost() * count;
return;
}
@ -1560,10 +1559,6 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) {
}
GEPrimitiveType newPrim = static_cast<GEPrimitiveType>((data >> 16) & 7);
// Can be more lenient later.
if (newPrim != prim) {
goto bail;
}
// TODO: more efficient updating of verts/inds
verts = Memory::GetPointerUnchecked(gstate_c.vertexAddr);
inds = 0;