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