Permalink
Browse files

Get rid of GPUCommon's "Internal" functions.

  • Loading branch information...
hrydgard committed Nov 5, 2017
1 parent bb68906 commit 8c69be9bfa98c7c12418e7e5d40231630a764c47
View
@@ -286,7 +286,7 @@ void GPU_D3D11::DeviceRestore() {
// Nothing needed.
}
void GPU_D3D11::InitClearInternal() {
void GPU_D3D11::InitClear() {
bool useNonBufferedRendering = g_Config.iRenderingMode == FB_NON_BUFFERED_MODE;
if (useNonBufferedRendering) {
// device_->Clear(0, NULL, D3DCLEAR_STENCIL | D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.f, 0);
@@ -305,8 +305,8 @@ void GPU_D3D11::BeginHostFrame() {
}
}
void GPU_D3D11::ReapplyGfxStateInternal() {
GPUCommon::ReapplyGfxStateInternal();
void GPU_D3D11::ReapplyGfxState() {
GPUCommon::ReapplyGfxState();
// TODO: Dirty our caches for depth states etc
}
@@ -316,8 +316,8 @@ void GPU_D3D11::EndHostFrame() {
draw_->BindPipeline(nullptr);
}
void GPU_D3D11::BeginFrameInternal() {
GPUCommon::BeginFrameInternal();
void GPU_D3D11::BeginFrame() {
GPUCommon::BeginFrame();
textureCacheD3D11_->StartFrame();
drawEngine_.BeginFrame();
@@ -357,7 +357,7 @@ bool GPU_D3D11::FramebufferReallyDirty() {
return true;
}
void GPU_D3D11::CopyDisplayToOutputInternal() {
void GPU_D3D11::CopyDisplayToOutput() {
float blendColor[4]{};
context_->OMSetBlendState(stockD3D11.blendStateDisabledWithColorMask[0xF], blendColor, 0xFFFFFFFF);
View
@@ -40,7 +40,7 @@ class GPU_D3D11 : public GPUCommon {
void PreExecuteOp(u32 op, u32 diff) override;
void ExecuteOp(u32 op, u32 diff) override;
void ReapplyGfxStateInternal() override;
void ReapplyGfxState() override;
void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override;
void GetStats(char *buffer, size_t bufsize) override;
void ClearCacheNextFrame() override;
@@ -96,9 +96,9 @@ class GPU_D3D11 : public GPUCommon {
void CheckFlushOp(int cmd, u32 diff);
void BuildReportingInfo();
void InitClearInternal() override;
void BeginFrameInternal() override;
void CopyDisplayToOutputInternal() override;
void InitClear() override;
void BeginFrame() override;
void CopyDisplayToOutput() override;
ID3D11Device *device_;
ID3D11DeviceContext *context_;
View
@@ -251,7 +251,7 @@ void GPU_DX9::DeviceRestore() {
// Nothing needed.
}
void GPU_DX9::InitClearInternal() {
void GPU_DX9::InitClear() {
bool useNonBufferedRendering = g_Config.iRenderingMode == FB_NON_BUFFERED_MODE;
if (useNonBufferedRendering) {
dxstate.depthWrite.set(true);
@@ -272,12 +272,12 @@ void GPU_DX9::BeginHostFrame() {
}
}
void GPU_DX9::ReapplyGfxStateInternal() {
void GPU_DX9::ReapplyGfxState() {
dxstate.Restore();
GPUCommon::ReapplyGfxStateInternal();
GPUCommon::ReapplyGfxState();
}
void GPU_DX9::BeginFrameInternal() {
void GPU_DX9::BeginFrame() {
// Turn off vsync when unthrottled
int desiredVSyncInterval = g_Config.bVSync ? 1 : 0;
if ((PSP_CoreParameter().unthrottle) || (PSP_CoreParameter().fpsLimit == 1))
@@ -292,7 +292,7 @@ void GPU_DX9::BeginFrameInternal() {
depalShaderCache_.Decimate();
// fragmentTestCache_.Decimate();
GPUCommon::BeginFrameInternal();
GPUCommon::BeginFrame();
shaderManagerDX9_->DirtyShader();
framebufferManager_->BeginFrame();
@@ -323,7 +323,7 @@ bool GPU_DX9::FramebufferReallyDirty() {
return true;
}
void GPU_DX9::CopyDisplayToOutputInternal() {
void GPU_DX9::CopyDisplayToOutput() {
dxstate.depthWrite.set(true);
dxstate.colorMask.set(true, true, true, true);
View
@@ -41,7 +41,7 @@ class GPU_DX9 : public GPUCommon {
void PreExecuteOp(u32 op, u32 diff) override;
void ExecuteOp(u32 op, u32 diff) override;
void ReapplyGfxStateInternal() override;
void ReapplyGfxState() override;
void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override;
void GetStats(char *buffer, size_t bufsize) override;
void ClearCacheNextFrame() override;
@@ -96,9 +96,9 @@ class GPU_DX9 : public GPUCommon {
void CheckFlushOp(int cmd, u32 diff);
void BuildReportingInfo();
void InitClearInternal() override;
void BeginFrameInternal() override;
void CopyDisplayToOutputInternal() override;
void InitClear() override;
void BeginFrame() override;
void CopyDisplayToOutput() override;
LPDIRECT3DDEVICE9 device_;
LPDIRECT3DDEVICE9EX deviceEx_;
View
@@ -401,13 +401,14 @@ void GPU_GLES::DeviceRestore() {
UpdateVsyncInterval(true);
}
void GPU_GLES::ReinitializeInternal() {
void GPU_GLES::Reinitialize() {
GPUCommon::Reinitialize();
textureCacheGL_->Clear(true);
depalShaderCache_.Clear();
framebufferManagerGL_->DestroyAllFBOs();
}
void GPU_GLES::InitClearInternal() {
void GPU_GLES::InitClear() {
bool useNonBufferedRendering = g_Config.iRenderingMode == FB_NON_BUFFERED_MODE;
if (useNonBufferedRendering) {
glstate.depthWrite.set(GL_TRUE);
@@ -467,13 +468,13 @@ void GPU_GLES::UpdateCmdInfo() {
}
}
void GPU_GLES::ReapplyGfxStateInternal() {
void GPU_GLES::ReapplyGfxState() {
drawEngine_.RestoreVAO();
glstate.Restore();
GPUCommon::ReapplyGfxStateInternal();
GPUCommon::ReapplyGfxState();
}
void GPU_GLES::BeginFrameInternal() {
void GPU_GLES::BeginFrame() {
UpdateVsyncInterval(resized_);
resized_ = false;
@@ -483,7 +484,7 @@ void GPU_GLES::BeginFrameInternal() {
depalShaderCache_.Decimate();
fragmentTestCache_.Decimate();
GPUCommon::BeginFrameInternal();
GPUCommon::BeginFrame();
// Save the cache from time to time. TODO: How often?
if (!shaderCachePath_.empty() && (gpuStats.numFlips & 1023) == 0) {
@@ -523,7 +524,7 @@ bool GPU_GLES::FramebufferReallyDirty() {
return true;
}
void GPU_GLES::CopyDisplayToOutputInternal() {
void GPU_GLES::CopyDisplayToOutput() {
// Flush anything left over.
framebufferManagerGL_->RebindFramebuffer();
drawEngine_.Flush();
View
@@ -41,7 +41,7 @@ class GPU_GLES : public GPUCommon {
void PreExecuteOp(u32 op, u32 diff) override;
void ExecuteOp(u32 op, u32 diff) override;
void ReapplyGfxStateInternal() override;
void ReapplyGfxState() override;
void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override;
void GetStats(char *buffer, size_t bufsize) override;
@@ -95,10 +95,10 @@ class GPU_GLES : public GPUCommon {
void CheckFlushOp(int cmd, u32 diff);
void BuildReportingInfo();
void InitClearInternal() override;
void BeginFrameInternal() override;
void CopyDisplayToOutputInternal() override;
void ReinitializeInternal() override;
void InitClear() override;
void BeginFrame() override;
void CopyDisplayToOutput() override;
void Reinitialize() override;
inline void UpdateVsyncInterval(bool force);
void UpdateCmdInfo();
View
@@ -381,14 +381,6 @@ void GPUCommon::EndHostFrame() {
}
void GPUCommon::InitClear() {
InitClearInternal();
}
void GPUCommon::CopyDisplayToOutput() {
CopyDisplayToOutputInternal();
}
void GPUCommon::Reinitialize() {
memset(dls, 0, sizeof(dls));
for (int i = 0; i < DisplayListMaxCount; ++i) {
@@ -404,7 +396,6 @@ void GPUCommon::Reinitialize() {
timeSpentStepping_ = 0.0;
interruptsEnabled_ = true;
curTickEst_ = 0;
ReinitializeInternal();
}
int GPUCommon::EstimatePerVertexCost() {
@@ -927,10 +918,6 @@ bool GPUCommon::InterpretList(DisplayList &list) {
}
void GPUCommon::BeginFrame() {
BeginFrameInternal();
}
void GPUCommon::BeginFrameInternal() {
if (dumpNextFrame_) {
NOTICE_LOG(G3D, "DUMPING THIS FRAME");
dumpThisFrame_ = true;
@@ -994,10 +981,6 @@ void GPUCommon::UpdatePC(u32 currentPC, u32 newPC) {
}
void GPUCommon::ReapplyGfxState() {
ReapplyGfxStateInternal();
}
void GPUCommon::ReapplyGfxStateInternal() {
// The commands are embedded in the command memory so we can just reexecute the words. Convenient.
// To be safe we pass 0xFFFFFFFF as the diff.
@@ -1037,12 +1020,7 @@ int GPUCommon::GetNextListIndex() {
}
}
bool GPUCommon::ProcessDLQueue() {
ProcessDLQueueInternal();
return true;
}
void GPUCommon::ProcessDLQueueInternal() {
void GPUCommon::ProcessDLQueue() {
startingTicks = CoreTiming::GetTicks();
cyclesExecuted = 0;
curTickEst_ = std::max(busyTicks, startingTicks + cyclesExecuted);
@@ -1326,7 +1304,7 @@ void GPUCommon::Execute_End(u32 op, u32 diff) {
__GeTriggerSync(GPU_SYNC_LIST, currentList->id, currentList->waitTicks);
if (currentList->started && currentList->context.IsValid()) {
gstate.Restore(currentList->context);
ReapplyGfxStateInternal();
ReapplyGfxState();
}
}
break;
@@ -2231,27 +2209,17 @@ void GPUCommon::DoBlockTransfer(u32 skipDrawReason) {
cyclesExecuted += ((height * width * bpp) * 16) / 10;
}
void GPUCommon::PerformMemoryCopyInternal(u32 dest, u32 src, int size) {
if (!framebufferManager_->NotifyFramebufferCopy(src, dest, size, false, gstate_c.skipDrawReason)) {
// We use a little hack for Download/Upload using a VRAM mirror.
// Since they're identical we don't need to copy.
if (!Memory::IsVRAMAddress(dest) || (dest ^ 0x00400000) != src) {
Memory::Memcpy(dest, src, size);
}
}
InvalidateCache(dest, size, GPU_INVALIDATE_HINT);
}
void GPUCommon::PerformMemorySetInternal(u32 dest, u8 v, int size) {
if (!framebufferManager_->NotifyFramebufferCopy(dest, dest, size, true, gstate_c.skipDrawReason)) {
InvalidateCache(dest, size, GPU_INVALIDATE_HINT);
}
}
bool GPUCommon::PerformMemoryCopy(u32 dest, u32 src, int size) {
// Track stray copies of a framebuffer in RAM. MotoGP does this.
if (framebufferManager_->MayIntersectFramebuffer(src) || framebufferManager_->MayIntersectFramebuffer(dest)) {
PerformMemoryCopyInternal(dest, src, size);
if (!framebufferManager_->NotifyFramebufferCopy(src, dest, size, false, gstate_c.skipDrawReason)) {
// We use a little hack for Download/Upload using a VRAM mirror.
// Since they're identical we don't need to copy.
if (!Memory::IsVRAMAddress(dest) || (dest ^ 0x00400000) != src) {
Memory::Memcpy(dest, src, size);
}
}
InvalidateCache(dest, size, GPU_INVALIDATE_HINT);
return true;
}
@@ -2264,7 +2232,9 @@ bool GPUCommon::PerformMemorySet(u32 dest, u8 v, int size) {
// This may indicate a memset, usually to 0, of a framebuffer.
if (framebufferManager_->MayIntersectFramebuffer(dest)) {
Memory::Memset(dest, v, size);
PerformMemorySetInternal(dest, v, size);
if (!framebufferManager_->NotifyFramebufferCopy(dest, dest, size, true, gstate_c.skipDrawReason)) {
InvalidateCache(dest, size, GPU_INVALIDATE_HINT);
}
return true;
}
@@ -2294,10 +2264,6 @@ bool GPUCommon::PerformMemoryUpload(u32 dest, int size) {
}
void GPUCommon::InvalidateCache(u32 addr, int size, GPUInvalidationType type) {
InvalidateCacheInternal(addr, size, type);
}
void GPUCommon::InvalidateCacheInternal(u32 addr, int size, GPUInvalidationType type) {
if (size > 0)
textureCache_->Invalidate(addr, size, type);
else
@@ -2322,16 +2288,12 @@ void GPUCommon::NotifyVideoUpload(u32 addr, int size, int width, int format) {
bool GPUCommon::PerformStencilUpload(u32 dest, int size) {
if (framebufferManager_->MayIntersectFramebuffer(dest)) {
PerformStencilUploadInternal(dest, size);
framebufferManager_->NotifyStencilUpload(dest, size);
return true;
}
return false;
}
void GPUCommon::PerformStencilUploadInternal(u32 dest, int size) {
framebufferManager_->NotifyStencilUpload(dest, size);
}
bool GPUCommon::GetCurrentFramebuffer(GPUDebugBuffer &buffer, GPUDebugFramebufferType type, int maxRes) {
u32 fb_address = type == GPU_DBG_FRAMEBUF_RENDER ? gstate.getFrameBufRawAddress() : framebufferManager_->DisplayFramebufAddr();
int fb_stride = type == GPU_DBG_FRAMEBUF_RENDER ? gstate.FrameBufStride() : framebufferManager_->DisplayFramebufStride();
Oops, something went wrong.

0 comments on commit 8c69be9

Please sign in to comment.