2015-10-10 16:41:19 +02:00
|
|
|
// Copyright (c) 2015- PPSSPP Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "GPU/Common/FramebufferCommon.h"
|
2016-01-05 21:18:43 +01:00
|
|
|
#include "GPU/GPUInterface.h"
|
2015-10-10 16:41:19 +02:00
|
|
|
#include "GPU/Vulkan/VulkanUtil.h"
|
|
|
|
|
2016-01-03 23:09:37 +01:00
|
|
|
// TODO: WTF?
|
|
|
|
enum VulkanFBOColorDepth {
|
|
|
|
VK_FBO_8888,
|
|
|
|
VK_FBO_565,
|
|
|
|
VK_FBO_4444,
|
|
|
|
VK_FBO_5551,
|
|
|
|
};
|
|
|
|
|
2016-01-05 21:18:43 +01:00
|
|
|
class TextureCacheVulkan;
|
2016-01-05 22:55:47 +01:00
|
|
|
class DrawEngineVulkan;
|
|
|
|
class VulkanContext;
|
2016-01-05 21:18:43 +01:00
|
|
|
|
2015-10-10 16:41:19 +02:00
|
|
|
class FramebufferManagerVulkan : public FramebufferManagerCommon {
|
|
|
|
public:
|
2016-01-05 22:55:47 +01:00
|
|
|
FramebufferManagerVulkan(VulkanContext *vulkan) : vulkan_(vulkan) {}
|
2015-10-10 16:41:19 +02:00
|
|
|
// Subsequent commands will be enqueued on this buffer.
|
|
|
|
void SetCmdBuffer(VkCommandBuffer cmd) { cmd_ = cmd; }
|
|
|
|
|
|
|
|
virtual void ClearBuffer(bool keepState = false) override {
|
|
|
|
throw std::logic_error("The method or operation is not implemented.");
|
|
|
|
}
|
2016-01-05 21:18:43 +01:00
|
|
|
void SetTextureCache(TextureCacheVulkan *texCache) { texCache_ = texCache; }
|
2016-01-05 22:55:47 +01:00
|
|
|
void SetDrawEngine(DrawEngineVulkan *drawEngine) { drawEngine_ = drawEngine; }
|
2016-01-03 23:09:37 +01:00
|
|
|
VulkanFramebuffer *GetTempFBO(int width, int height, VulkanFBOColorDepth colorDepth);
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2016-01-05 22:55:47 +01:00
|
|
|
void RebindFramebuffer() override { } // This makes little sense with Vulkan's model.
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2016-01-05 22:55:47 +01:00
|
|
|
bool NotifyStencilUpload(u32 addr, int size, bool skipZero = false) override {
|
|
|
|
return false;
|
2015-10-10 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
2016-01-06 23:08:26 +01:00
|
|
|
void ReadFramebufferToMemory(VirtualFramebuffer *vfb, bool sync, int x, int y, int w, int h) override;
|
|
|
|
void DownloadFramebufferForClut(u32 fb_address, u32 loadBytes) override;
|
|
|
|
|
2015-10-10 16:41:19 +02:00
|
|
|
|
|
|
|
virtual void MakePixelTexture(const u8 *srcPixels, GEBufferFormat srcPixelFormat, int srcStride, int width, int height) override {
|
|
|
|
}
|
|
|
|
|
2016-01-05 22:55:47 +01:00
|
|
|
void DrawPixels(VirtualFramebuffer *vfb, int dstX, int dstY, const u8 *srcPixels, GEBufferFormat srcPixelFormat, int srcStride, int width, int height) override;
|
2015-10-10 16:41:19 +02:00
|
|
|
|
|
|
|
virtual void DrawFramebufferToOutput(const u8 *srcPixels, GEBufferFormat srcPixelFormat, int srcStride, bool applyPostShader) override {
|
|
|
|
throw std::logic_error("The method or operation is not implemented.");
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void DisableState() override {
|
|
|
|
}
|
|
|
|
|
2016-01-05 22:55:47 +01:00
|
|
|
virtual void FlushBeforeCopy() override;
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2016-01-05 22:55:47 +01:00
|
|
|
void DecimateFBOs() override;
|
2015-10-10 16:41:19 +02:00
|
|
|
|
|
|
|
virtual void BlitFramebuffer(VirtualFramebuffer *dst, int dstX, int dstY, VirtualFramebuffer *src, int srcX, int srcY, int w, int h, int bpp) override {
|
|
|
|
throw std::logic_error("The method or operation is not implemented.");
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void DestroyFramebuf(VirtualFramebuffer *vfb) override {
|
|
|
|
throw std::logic_error("The method or operation is not implemented.");
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void ResizeFramebufFBO(VirtualFramebuffer *vfb, u16 w, u16 h, bool force = false) override {
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void NotifyRenderFramebufferCreated(VirtualFramebuffer *vfb) override {
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void NotifyRenderFramebufferSwitched(VirtualFramebuffer *prevVfb, VirtualFramebuffer *vfb, bool isClearingDepth) override {
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void NotifyRenderFramebufferUpdated(VirtualFramebuffer *vfb, bool vfbFormatChanged) override {
|
|
|
|
}
|
|
|
|
|
2016-01-05 21:18:43 +01:00
|
|
|
void DestroyAllFBOs();
|
|
|
|
void Resized();
|
|
|
|
void DeviceLost();
|
|
|
|
|
|
|
|
void CopyDisplayToOutput();
|
|
|
|
void EndFrame();
|
|
|
|
|
|
|
|
std::vector<FramebufferInfo> GetFramebufferList();
|
2015-10-10 16:41:19 +02:00
|
|
|
|
2016-01-06 23:08:26 +01:00
|
|
|
protected:
|
|
|
|
bool CreateDownloadTempBuffer(VirtualFramebuffer *nvfb) override;
|
|
|
|
void UpdateDownloadTempBuffer(VirtualFramebuffer *nvfb) override;
|
|
|
|
|
2015-10-10 16:41:19 +02:00
|
|
|
private:
|
2016-01-05 22:55:47 +01:00
|
|
|
VulkanContext *vulkan_;
|
2015-10-10 16:41:19 +02:00
|
|
|
VkCommandBuffer cmd_;
|
2016-01-05 21:18:43 +01:00
|
|
|
|
|
|
|
TextureCacheVulkan *texCache_;
|
2016-01-05 22:55:47 +01:00
|
|
|
DrawEngineVulkan *drawEngine_;
|
2015-10-10 16:41:19 +02:00
|
|
|
};
|