mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
More unification work
This commit is contained in:
parent
c74f5b2189
commit
8ba665e258
@ -87,16 +87,11 @@ GPU_D3D11::GPU_D3D11(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
}
|
||||
|
||||
GPU_D3D11::~GPU_D3D11() {
|
||||
framebufferManagerD3D11_->DestroyAllFBOs();
|
||||
delete framebufferManagerD3D11_;
|
||||
shaderManagerD3D11_->ClearShaders();
|
||||
delete shaderManagerD3D11_;
|
||||
delete textureCacheD3D11_;
|
||||
stockD3D11.Destroy();
|
||||
}
|
||||
|
||||
u32 GPU_D3D11::CheckGPUFeatures() const {
|
||||
u32 features = GPUCommon::CheckGPUFeatures();
|
||||
u32 features = GPUCommonHW::CheckGPUFeatures();
|
||||
|
||||
// Accurate depth is required because the Direct3D API does not support inverse Z.
|
||||
// So we cannot incorrectly use the viewport transform as the depth range on Direct3D.
|
||||
@ -124,11 +119,11 @@ void GPU_D3D11::DeviceLost() {
|
||||
drawEngine_.ClearInputLayoutMap();
|
||||
textureCache_->Clear(false);
|
||||
|
||||
GPUCommon::DeviceLost();
|
||||
GPUCommonHW::DeviceLost();
|
||||
}
|
||||
|
||||
void GPU_D3D11::DeviceRestore() {
|
||||
GPUCommon::DeviceRestore();
|
||||
GPUCommonHW::DeviceRestore();
|
||||
// Nothing needed.
|
||||
}
|
||||
|
||||
@ -139,7 +134,7 @@ void GPU_D3D11::InitClear() {
|
||||
}
|
||||
|
||||
void GPU_D3D11::BeginFrame() {
|
||||
GPUCommon::BeginFrame();
|
||||
GPUCommonHW::BeginFrame();
|
||||
|
||||
textureCache_->StartFrame();
|
||||
drawEngine_.BeginFrame();
|
||||
|
@ -94,7 +94,7 @@ GPU_DX9::GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw)
|
||||
}
|
||||
|
||||
u32 GPU_DX9::CheckGPUFeatures() const {
|
||||
u32 features = GPUCommon::CheckGPUFeatures();
|
||||
u32 features = GPUCommonHW::CheckGPUFeatures();
|
||||
features |= GPU_USE_16BIT_FORMATS;
|
||||
features |= GPU_USE_TEXTURE_LOD_CONTROL;
|
||||
|
||||
@ -105,19 +105,9 @@ u32 GPU_DX9::CheckGPUFeatures() const {
|
||||
return CheckGPUFeaturesLate(features);
|
||||
}
|
||||
|
||||
GPU_DX9::~GPU_DX9() {
|
||||
framebufferManager_->DestroyAllFBOs();
|
||||
delete framebufferManager_;
|
||||
delete textureCache_;
|
||||
shaderManager_->ClearShaders();
|
||||
delete shaderManager_;
|
||||
}
|
||||
|
||||
void GPU_DX9::DeviceLost() {
|
||||
// Simply drop all caches and textures.
|
||||
shaderManager_->ClearShaders();
|
||||
textureCache_->Clear(false);
|
||||
GPUCommon::DeviceLost();
|
||||
GPUCommonHW::DeviceLost();
|
||||
}
|
||||
|
||||
void GPU_DX9::InitClear() {
|
||||
@ -130,14 +120,14 @@ void GPU_DX9::InitClear() {
|
||||
|
||||
void GPU_DX9::ReapplyGfxState() {
|
||||
dxstate.Restore();
|
||||
GPUCommon::ReapplyGfxState();
|
||||
GPUCommonHW::ReapplyGfxState();
|
||||
}
|
||||
|
||||
void GPU_DX9::BeginFrame() {
|
||||
textureCache_->StartFrame();
|
||||
drawEngine_.BeginFrame();
|
||||
|
||||
GPUCommon::BeginFrame();
|
||||
GPUCommonHW::BeginFrame();
|
||||
shaderManagerDX9_->DirtyShader();
|
||||
|
||||
framebufferManager_->BeginFrame();
|
||||
|
@ -33,7 +33,6 @@ class TextureCacheDX9;
|
||||
class GPU_DX9 : public GPUCommonHW {
|
||||
public:
|
||||
GPU_DX9(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
|
||||
~GPU_DX9();
|
||||
|
||||
u32 CheckGPUFeatures() const override;
|
||||
|
||||
|
@ -138,22 +138,14 @@ GPU_GLES::~GPU_GLES() {
|
||||
INFO_LOG(G3D, "Shader cache disabled. Not saving.");
|
||||
}
|
||||
}
|
||||
|
||||
framebufferManager_->DestroyAllFBOs();
|
||||
shaderManager_->ClearShaders();
|
||||
fragmentTestCache_.Clear();
|
||||
|
||||
delete shaderManager_;
|
||||
shaderManager_ = nullptr;
|
||||
delete framebufferManager_;
|
||||
delete textureCache_;
|
||||
}
|
||||
|
||||
// Take the raw GL extension and versioning data and turn into feature flags.
|
||||
// TODO: This should use DrawContext::GetDeviceCaps() more and more, and eventually
|
||||
// this can be shared between all the backends.
|
||||
u32 GPU_GLES::CheckGPUFeatures() const {
|
||||
u32 features = GPUCommon::CheckGPUFeatures();
|
||||
u32 features = GPUCommonHW::CheckGPUFeatures();
|
||||
|
||||
features |= GPU_USE_16BIT_FORMATS;
|
||||
|
||||
@ -246,16 +238,14 @@ void GPU_GLES::DeviceLost() {
|
||||
// FBOs appear to survive? Or no?
|
||||
// TransformDraw has registered as a GfxResourceHolder.
|
||||
CancelReady();
|
||||
shaderManager_->DeviceLost();
|
||||
textureCache_->DeviceLost();
|
||||
fragmentTestCache_.DeviceLost();
|
||||
drawEngine_.DeviceLost();
|
||||
|
||||
GPUCommon::DeviceLost();
|
||||
GPUCommonHW::DeviceLost();
|
||||
}
|
||||
|
||||
void GPU_GLES::DeviceRestore() {
|
||||
GPUCommon::DeviceRestore();
|
||||
GPUCommonHW::DeviceRestore();
|
||||
|
||||
UpdateCmdInfo();
|
||||
UpdateVsyncInterval(true);
|
||||
@ -266,15 +256,11 @@ void GPU_GLES::DeviceRestore() {
|
||||
fragmentTestCache_.DeviceRestore(draw_);
|
||||
}
|
||||
|
||||
void GPU_GLES::Reinitialize() {
|
||||
GPUCommon::Reinitialize();
|
||||
}
|
||||
|
||||
void GPU_GLES::InitClear() {
|
||||
}
|
||||
|
||||
void GPU_GLES::BeginHostFrame() {
|
||||
GPUCommon::BeginHostFrame();
|
||||
GPUCommonHW::BeginHostFrame();
|
||||
drawEngine_.BeginFrame();
|
||||
|
||||
if (gstate_c.useFlagsChanged) {
|
||||
@ -292,11 +278,11 @@ void GPU_GLES::EndHostFrame() {
|
||||
}
|
||||
|
||||
void GPU_GLES::ReapplyGfxState() {
|
||||
GPUCommon::ReapplyGfxState();
|
||||
GPUCommonHW::ReapplyGfxState();
|
||||
}
|
||||
|
||||
void GPU_GLES::BeginFrame() {
|
||||
GPUCommon::BeginFrame();
|
||||
GPUCommonHW::BeginFrame();
|
||||
|
||||
textureCache_->StartFrame();
|
||||
|
||||
|
@ -64,7 +64,6 @@ private:
|
||||
|
||||
void InitClear() override;
|
||||
void BeginFrame() override;
|
||||
void Reinitialize() override;
|
||||
|
||||
FramebufferManagerGLES *framebufferManagerGL_;
|
||||
TextureCacheGLES *textureCacheGL_;
|
||||
|
@ -14,6 +14,20 @@ GPUCommonHW::GPUCommonHW(GraphicsContext *gfxCtx, Draw::DrawContext *draw) : GPU
|
||||
GPUCommonHW::~GPUCommonHW() {
|
||||
// Clear features so they're not visible in system info.
|
||||
gstate_c.SetUseFlags(0);
|
||||
|
||||
// Delete the various common managers.
|
||||
framebufferManager_->DestroyAllFBOs();
|
||||
delete framebufferManager_;
|
||||
delete textureCache_;
|
||||
shaderManager_->ClearShaders();
|
||||
delete shaderManager_;
|
||||
}
|
||||
|
||||
void GPUCommonHW::DeviceLost() {
|
||||
textureCache_->Clear(false);
|
||||
framebufferManager_->DeviceLost();
|
||||
textureCache_->DeviceLost();
|
||||
shaderManager_->DeviceLost();
|
||||
}
|
||||
|
||||
void GPUCommonHW::PreExecuteOp(u32 op, u32 diff) {
|
||||
|
@ -11,6 +11,7 @@ public:
|
||||
|
||||
void CopyDisplayToOutput(bool reallyDirty) override;
|
||||
void DoState(PointerWrap &p) override;
|
||||
void DeviceLost() override;
|
||||
|
||||
protected:
|
||||
void PreExecuteOp(u32 op, u32 diff);
|
||||
|
@ -185,16 +185,15 @@ GPU_Vulkan::~GPU_Vulkan() {
|
||||
SaveCache(shaderCachePath_);
|
||||
// Note: We save the cache in DeviceLost
|
||||
DestroyDeviceObjects();
|
||||
framebufferManagerVulkan_->DestroyAllFBOs();
|
||||
drawEngine_.DeviceLost();
|
||||
delete textureCache_;
|
||||
shaderManager_->ClearShaders();
|
||||
|
||||
delete pipelineManager_;
|
||||
delete shaderManager_;
|
||||
delete framebufferManager_;
|
||||
// other managers are deleted in ~GPUCommonHW.
|
||||
}
|
||||
|
||||
u32 GPU_Vulkan::CheckGPUFeatures() const {
|
||||
uint32_t features = GPUCommon::CheckGPUFeatures();
|
||||
uint32_t features = GPUCommonHW::CheckGPUFeatures();
|
||||
|
||||
VulkanContext *vulkan = (VulkanContext *)draw_->GetNativeObject(Draw::NativeObject::CONTEXT);
|
||||
switch (vulkan->GetPhysicalDeviceProperties().properties.vendorID) {
|
||||
@ -289,7 +288,7 @@ u32 GPU_Vulkan::CheckGPUFeatures() const {
|
||||
}
|
||||
|
||||
void GPU_Vulkan::BeginHostFrame() {
|
||||
GPUCommon::BeginHostFrame();
|
||||
GPUCommonHW::BeginHostFrame();
|
||||
|
||||
drawEngine_.BeginFrame();
|
||||
textureCache_->StartFrame();
|
||||
@ -336,7 +335,7 @@ void GPU_Vulkan::EndHostFrame() {
|
||||
|
||||
drawEngine_.EndFrame();
|
||||
|
||||
GPUCommon::EndHostFrame();
|
||||
GPUCommonHW::EndHostFrame();
|
||||
}
|
||||
|
||||
// Needs to be called on GPU thread, not reporting thread.
|
||||
@ -445,7 +444,7 @@ void GPU_Vulkan::DestroyDeviceObjects() {
|
||||
}
|
||||
|
||||
void GPU_Vulkan::CheckRenderResized() {
|
||||
GPUCommon::CheckRenderResized();
|
||||
GPUCommonHW::CheckRenderResized();
|
||||
if (renderResized_) {
|
||||
pipelineManager_->InvalidateMSAAPipelines();
|
||||
framebufferManager_->ReleasePipelines();
|
||||
@ -463,8 +462,6 @@ void GPU_Vulkan::DeviceLost() {
|
||||
DestroyDeviceObjects();
|
||||
drawEngine_.DeviceLost();
|
||||
pipelineManager_->DeviceLost();
|
||||
textureCacheVulkan_->DeviceLost();
|
||||
shaderManagerVulkan_->DeviceLost();
|
||||
|
||||
GPUCommonHW::DeviceLost();
|
||||
}
|
||||
|
@ -217,7 +217,6 @@ void TextureCacheVulkan::DeviceLost() {
|
||||
Clear(true);
|
||||
|
||||
samplerCache_.DeviceLost();
|
||||
|
||||
if (samplerNearest_)
|
||||
vulkan->Delete().QueueDeleteSampler(samplerNearest_);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user