Ensure stuff run on every prim are inlined.
These both get a ton of calls and show up on profiles.
This commit is contained in:
parent
466a5418d2
commit
e7639f666c
4 changed files with 42 additions and 34 deletions
|
@ -660,7 +660,7 @@ void FramebufferManager::DestroyFramebuf(VirtualFramebuffer *v) {
|
|||
delete v;
|
||||
}
|
||||
|
||||
void FramebufferManager::SetRenderFrameBuffer() {
|
||||
void FramebufferManager::DoSetRenderFrameBuffer() {
|
||||
if (!gstate_c.framebufChanged && currentRenderVfb_) {
|
||||
currentRenderVfb_->last_frame_render = gpuStats.numFlips;
|
||||
currentRenderVfb_->dirtyAfterDisplay = true;
|
||||
|
|
|
@ -135,7 +135,18 @@ public:
|
|||
void Resized();
|
||||
void DeviceLost();
|
||||
void CopyDisplayToOutput();
|
||||
void SetRenderFrameBuffer(); // Uses parameters computed from gstate
|
||||
void DoSetRenderFrameBuffer(); // Uses parameters computed from gstate
|
||||
void SetRenderFrameBuffer() {
|
||||
// Inlining this part since it's so frequent.
|
||||
if (!gstate_c.framebufChanged && currentRenderVfb_) {
|
||||
currentRenderVfb_->last_frame_render = gpuStats.numFlips;
|
||||
currentRenderVfb_->dirtyAfterDisplay = true;
|
||||
if (!gstate_c.skipDrawReason)
|
||||
currentRenderVfb_->reallyDirtyAfterDisplay = true;
|
||||
return;
|
||||
}
|
||||
DoSetRenderFrameBuffer();
|
||||
}
|
||||
void UpdateFromMemory(u32 addr, int size, bool safe);
|
||||
void SetLineWidth();
|
||||
|
||||
|
|
|
@ -267,35 +267,6 @@ void TransformDrawEngine::SetupVertexDecoder(u32 vertType) {
|
|||
}
|
||||
}
|
||||
|
||||
int TransformDrawEngine::EstimatePerVertexCost() {
|
||||
// TODO: This is transform cost, also account for rasterization cost somehow... although it probably
|
||||
// runs in parallel with transform.
|
||||
|
||||
// Also, this is all pure guesswork. If we can find a way to do measurements, that would be great.
|
||||
|
||||
// GTA wants a low value to run smooth, GoW wants a high value (otherwise it thinks things
|
||||
// went too fast and starts doing all the work over again).
|
||||
|
||||
int cost = 20;
|
||||
if (gstate.isLightingEnabled()) {
|
||||
cost += 10;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (gstate.isLightChanEnabled(i))
|
||||
cost += 10;
|
||||
}
|
||||
}
|
||||
|
||||
if (gstate.getUVGenMode() != GE_TEXMAP_TEXTURE_COORDS) {
|
||||
cost += 20;
|
||||
}
|
||||
if (dec_ && dec_->morphcount > 1) {
|
||||
cost += 5 * dec_->morphcount;
|
||||
}
|
||||
|
||||
return cost;
|
||||
}
|
||||
|
||||
void TransformDrawEngine::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim, int vertexCount, u32 vertType, int *bytesRead) {
|
||||
if (vertexCount == 0)
|
||||
return; // we ignore zero-sized draw calls.
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "GPU/Common/GPUDebugInterface.h"
|
||||
#include "GPU/Common/IndexGenerator.h"
|
||||
#include "GPU/GLES/VertexDecoder.h"
|
||||
#include "gfx/gl_common.h"
|
||||
#include "gfx/gl_lost_manager.h"
|
||||
|
||||
|
@ -28,8 +29,6 @@ class LinkedShader;
|
|||
class ShaderManager;
|
||||
class TextureCache;
|
||||
class FramebufferManager;
|
||||
class VertexDecoder;
|
||||
class VertexDecoderJitCache;
|
||||
struct TransformedVertex;
|
||||
|
||||
struct DecVtxFormat;
|
||||
|
@ -127,7 +126,34 @@ public:
|
|||
void SetupVertexDecoder(u32 vertType);
|
||||
|
||||
// This requires a SetupVertexDecoder call first.
|
||||
int EstimatePerVertexCost();
|
||||
int EstimatePerVertexCost() {
|
||||
// TODO: This is transform cost, also account for rasterization cost somehow... although it probably
|
||||
// runs in parallel with transform.
|
||||
|
||||
// Also, this is all pure guesswork. If we can find a way to do measurements, that would be great.
|
||||
|
||||
// GTA wants a low value to run smooth, GoW wants a high value (otherwise it thinks things
|
||||
// went too fast and starts doing all the work over again).
|
||||
|
||||
int cost = 20;
|
||||
if (gstate.isLightingEnabled()) {
|
||||
cost += 10;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (gstate.isLightChanEnabled(i))
|
||||
cost += 10;
|
||||
}
|
||||
}
|
||||
|
||||
if (gstate.getUVGenMode() != GE_TEXMAP_TEXTURE_COORDS) {
|
||||
cost += 20;
|
||||
}
|
||||
if (dec_ && dec_->morphcount > 1) {
|
||||
cost += 5 * dec_->morphcount;
|
||||
}
|
||||
|
||||
return cost;
|
||||
}
|
||||
|
||||
// So that this can be inlined
|
||||
void Flush() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue