Centralize "Resized()"

This commit is contained in:
Henrik Rydgard 2016-12-21 18:13:58 +01:00
parent 7e46a153c0
commit e15cba0e1b
9 changed files with 15 additions and 28 deletions

View file

@ -236,6 +236,8 @@ public:
void SetRenderSize(VirtualFramebuffer *vfb);
void SetSafeSize(u16 w, u16 h);
virtual void Resized() = 0;
protected:
void UpdateSize();

View file

@ -394,7 +394,7 @@ static const CommandTableEntry commandTable[] = {
GPU_DX9::CommandInfo GPU_DX9::cmdInfo_[256];
GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx)
: resized_(false), gfxCtx_(gfxCtx) {
: gfxCtx_(gfxCtx) {
lastVsync_ = g_Config.bVSync ? 1 : 0;
dxstate.SetVSyncInterval(g_Config.bVSync);
@ -2023,11 +2023,6 @@ void GPU_DX9::ClearCacheNextFrame() {
textureCache_.ClearNextFrame();
}
void GPU_DX9::Resized() {
resized_ = true;
framebufferManagerDX9_->Resized();
}
void GPU_DX9::ClearShaderCache() {
shaderManager_->ClearCache(true);
}

View file

@ -37,6 +37,7 @@ class GPU_DX9 : public GPUCommon {
public:
GPU_DX9(GraphicsContext *gfxCtx);
~GPU_DX9();
void CheckGPUFeatures();
void InitClear() override;
void PreExecuteOp(u32 op, u32 diff) override;
@ -61,8 +62,6 @@ public:
void DumpNextFrame() override;
void DoState(PointerWrap &p) override;
// Called by the window system if the window size changed. This will be reflected in PSPCoreParam.pixel*.
void Resized() override;
void ClearShaderCache() override;
bool DecodeTexture(u8 *dest, const GPUgstate &state) override {
return textureCache_.DecodeTexture(dest, state);
@ -182,7 +181,6 @@ private:
static CommandInfo cmdInfo_[256];
bool resized_;
int lastVsync_;
std::string reportingPrimaryInfo_;

View file

@ -397,7 +397,7 @@ static const CommandTableEntry commandTable[] = {
GPU_GLES::CommandInfo GPU_GLES::cmdInfo_[256];
GPU_GLES::GPU_GLES(GraphicsContext *ctx)
: resized_(false), gfxCtx_(ctx) {
: gfxCtx_(ctx) {
UpdateVsyncInterval(true);
CheckGPUFeatures();
@ -2284,11 +2284,6 @@ void GPU_GLES::ClearCacheNextFrame() {
textureCacheGL_->ClearNextFrame();
}
void GPU_GLES::Resized() {
resized_ = true;
framebufferManagerGL_->Resized();
}
void GPU_GLES::ClearShaderCache() {
shaderManager_->ClearCache(true);
}

View file

@ -65,8 +65,6 @@ public:
void DumpNextFrame() override;
void DoState(PointerWrap &p) override;
// Called by the window system if the window size changed. This will be reflected in PSPCoreParam.pixel*.
void Resized() override;
void ClearShaderCache() override;
void CleanupBeforeUI() override;
bool DecodeTexture(u8 *dest, const GPUgstate &state) override {
@ -190,7 +188,6 @@ private:
FragmentTestCache fragmentTestCache_;
ShaderManager *shaderManager_;
bool resized_;
int lastVsync_;
std::string reportingPrimaryInfo_;

View file

@ -26,7 +26,8 @@
GPUCommon::GPUCommon() :
dumpNextFrame_(false),
dumpThisFrame_(false),
framebufferManager_(nullptr)
framebufferManager_(nullptr),
resized_(false)
{
// This assert failed on GCC x86 32-bit (but not MSVC 32-bit!) before adding the
// "padding" field at the end. This is important for save state compatibility.
@ -98,6 +99,11 @@ bool GPUCommon::BusyDrawing() {
return false;
}
void GPUCommon::Resized() {
resized_ = true;
framebufferManager_->Resized();
}
u32 GPUCommon::DrawSync(int mode) {
if (ThreadEnabled()) {
// Sync first, because the CPU is usually faster than the emulated GPU.

View file

@ -34,6 +34,8 @@ public:
interruptsEnabled_ = enable;
}
void Resized() override;
void ExecuteOp(u32 op, u32 diff) override;
void PreExecuteOp(u32 op, u32 diff) override;
bool InterpretList(DisplayList &list) override;
@ -200,6 +202,7 @@ protected:
bool dumpNextFrame_;
bool dumpThisFrame_;
bool interruptsEnabled_;
bool resized_;
private:
// For CPU/GPU sync.

View file

@ -393,7 +393,6 @@ static const CommandTableEntry commandTable[] = {
GPU_Vulkan::GPU_Vulkan(GraphicsContext *ctx)
: vulkan_((VulkanContext *)ctx->GetAPIContext()),
drawEngine_(vulkan_),
resized_(false),
gfxCtx_(ctx) {
UpdateVsyncInterval(true);
CheckGPUFeatures();
@ -2135,11 +2134,6 @@ void GPU_Vulkan::ClearCacheNextFrame() {
textureCacheVulkan_->ClearNextFrame();
}
void GPU_Vulkan::Resized() {
resized_ = true;
framebufferManagerVulkan_->Resized();
}
void GPU_Vulkan::ClearShaderCache() {
// TODO
}

View file

@ -67,8 +67,6 @@ public:
void DumpNextFrame() override;
void DoState(PointerWrap &p) override;
// Called by the window system if the window size changed. This will be reflected in PSPCoreParam.pixel*.
void Resized() override;
void ClearShaderCache() override;
bool DecodeTexture(u8 *dest, const GPUgstate &state) override {
return false;
@ -188,7 +186,6 @@ private:
// Manages state and pipeline objects
PipelineManagerVulkan *pipelineManager_;
bool resized_;
int lastVsync_;
VkCommandBuffer curCmd_;