Skip to content

Commit

Permalink
Micro-optimization: Don't need to check drawcalls for 0. Extract shar…
Browse files Browse the repository at this point in the history
…ed expression. Yes I checked assembly.
  • Loading branch information
hrydgard committed Oct 1, 2023
1 parent 52ad0d0 commit a2fe906
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion GPU/GPUCommon.cpp
Expand Up @@ -1944,7 +1944,7 @@ bool GPUCommon::DescribeCodePtr(const u8 *ptr, std::string &name) {

void GPUCommon::UpdateUVScaleOffset() {
#ifdef _M_SSE
__m128i values = _mm_slli_epi32(_mm_load_si128((const __m128i *) & gstate.texscaleu), 8);
__m128i values = _mm_slli_epi32(_mm_load_si128((const __m128i *)&gstate.texscaleu), 8);
_mm_storeu_si128((__m128i *)&gstate_c.uv, values);
#elif PPSSPP_ARCH(ARM_NEON)
const uint32x4_t values = vshlq_n_u32(vld1q_u32((const u32 *)&gstate.texscaleu), 8);
Expand Down
12 changes: 3 additions & 9 deletions GPU/GPUCommonHW.cpp
Expand Up @@ -949,8 +949,6 @@ void GPUCommonHW::Execute_Prim(u32 op, u32 diff) {
}

u32 count = op & 0xFFFF;
if (count == 0)
return;

// Must check this after SetRenderFrameBuffer so we know SKIPDRAW_NON_DISPLAYED_FB.
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
Expand Down Expand Up @@ -1017,11 +1015,6 @@ void GPUCommonHW::Execute_Prim(u32 op, u32 diff) {
case GE_CMD_PRIM:
{
u32 count = data & 0xFFFF;
if (count == 0) {
// Ignore.
break;
}

GEPrimitiveType newPrim = static_cast<GEPrimitiveType>((data >> 16) & 7);
SetDrawType(DRAW_PRIM, newPrim);
// TODO: more efficient updating of verts/inds
Expand Down Expand Up @@ -1151,8 +1144,9 @@ void GPUCommonHW::Execute_Prim(u32 op, u32 diff) {
}
}

gpuStats.vertexGPUCycles += vertexCost_ * totalVertCount;
cyclesExecuted += vertexCost_ * totalVertCount;
int cycles = vertexCost_ * totalVertCount;
gpuStats.vertexGPUCycles += cycles;
cyclesExecuted += cycles;
}

void GPUCommonHW::Execute_Bezier(u32 op, u32 diff) {
Expand Down

0 comments on commit a2fe906

Please sign in to comment.