Reaches the first clear

This commit is contained in:
Henrik Rydgard 2016-01-05 22:55:47 +01:00
parent 4063f7e0db
commit 3701e2eca3
6 changed files with 38 additions and 40 deletions

View File

@ -60,9 +60,7 @@ bool GPU_Init(GraphicsContext *ctx) {
#endif
break;
case GPU_VULKAN:
{
SetGPU(new GPU_Vulkan(ctx));
}
break;
}

View File

@ -73,7 +73,6 @@ DrawEngineVulkan::DrawEngineVulkan(VulkanContext *vulkan)
numDrawCalls(0),
vertexCountInDrawCalls(0),
decodeCounter_(0),
dcid_(0),
fboTexNeedBind_(false),
fboTexBound_(false),
curFrame_(0) {
@ -231,18 +230,6 @@ void DrawEngineVulkan::SubmitPrim(void *verts, void *inds, GEPrimitiveType prim,
dc.prim = prim;
dc.vertexCount = vertexCount;
u32 dhash = dcid_;
dhash ^= (u32)(uintptr_t)verts;
dhash = __rotl(dhash, 13);
dhash ^= (u32)(uintptr_t)inds;
dhash = __rotl(dhash, 13);
dhash ^= (u32)vertType;
dhash = __rotl(dhash, 13);
dhash ^= (u32)vertexCount;
dhash = __rotl(dhash, 13);
dhash ^= (u32)prim;
dcid_ = dhash;
if (inds) {
GetIndexBounds(inds, vertexCount, vertType, &dc.indexLowerBound, &dc.indexUpperBound);
} else {
@ -553,7 +540,6 @@ void DrawEngineVulkan::DoFlush(VkCommandBuffer cmd) {
numDrawCalls = 0;
vertexCountInDrawCalls = 0;
decodeCounter_ = 0;
dcid_ = 0;
prevPrim_ = GE_PRIM_INVALID;
gstate_c.vertexFullAlpha = true;
framebufferManager_->SetColorUpdated(gstate_c.skipDrawReason);

View File

@ -207,7 +207,6 @@ private:
int vertexCountInDrawCalls;
int decodeCounter_;
u32 dcid_;
bool fboTexNeedBind_;
bool fboTexBound_;

View File

@ -18,7 +18,10 @@
#pragma once
#include "GPU/GPUInterface.h"
#include "GPU/GPUState.h"
#include "GPU/Vulkan/FramebufferVulkan.h"
#include "GPU/Vulkan/DrawEngineVulkan.h"
VulkanFramebuffer *FramebufferManagerVulkan::GetTempFBO(int width, int height, VulkanFBOColorDepth colorDepth) {
@ -41,10 +44,31 @@ void FramebufferManagerVulkan::CopyDisplayToOutput() {
}
void FramebufferManagerVulkan::DecimateFBOs() {
}
void FramebufferManagerVulkan::EndFrame() {
}
void FramebufferManagerVulkan::DrawPixels(VirtualFramebuffer *vfb, int dstX, int dstY, const u8 *srcPixels, GEBufferFormat srcPixelFormat, int srcStride, int width, int height) {
// So: Allocate a temporary texture from a (very small) pool, upload content directly into it, schedule a transition
// into the init command buffer, alloc and create an appropriate descriptor set, then bind and draw. no need for uniforms.
}
void FramebufferManagerVulkan::FlushBeforeCopy() {
// Flush anything not yet drawn before blitting, downloading, or uploading.
// This might be a stalled list, or unflushed before a block transfer, etc.
// TODO: It's really bad that we are calling SetRenderFramebuffer here with
// all the irrelevant state checking it'll use to decide what to do. Should
// do something more focused here.
SetRenderFrameBuffer(gstate_c.framebufChanged, gstate_c.skipDrawReason);
drawEngine_->Flush(nullptr);
}
std::vector<FramebufferInfo> FramebufferManagerVulkan::GetFramebufferList() {
return std::vector<FramebufferInfo>();
}

View File

@ -30,25 +30,26 @@ enum VulkanFBOColorDepth {
};
class TextureCacheVulkan;
class DrawEngineVulkan;
class VulkanContext;
class FramebufferManagerVulkan : public FramebufferManagerCommon {
public:
FramebufferManagerVulkan(VulkanContext *vulkan) : vulkan_(vulkan) {}
// Subsequent commands will be enqueued on this buffer.
void SetInstance(VkInstance inst) { inst_ = inst; }
void SetCmdBuffer(VkCommandBuffer cmd) { cmd_ = cmd; }
virtual void ClearBuffer(bool keepState = false) override {
throw std::logic_error("The method or operation is not implemented.");
}
void SetTextureCache(TextureCacheVulkan *texCache) { texCache_ = texCache; }
void SetDrawEngine(DrawEngineVulkan *drawEngine) { drawEngine_ = drawEngine; }
VulkanFramebuffer *GetTempFBO(int width, int height, VulkanFBOColorDepth colorDepth);
virtual void RebindFramebuffer() override {
throw std::logic_error("The method or operation is not implemented.");
}
void RebindFramebuffer() override { } // This makes little sense with Vulkan's model.
virtual bool NotifyStencilUpload(u32 addr, int size, bool skipZero = false) override {
throw std::logic_error("The method or operation is not implemented.");
bool NotifyStencilUpload(u32 addr, int size, bool skipZero = false) override {
return false;
}
virtual void ReadFramebufferToMemory(VirtualFramebuffer *vfb, bool sync, int x, int y, int w, int h) override {
@ -56,28 +57,20 @@ public:
}
virtual void MakePixelTexture(const u8 *srcPixels, GEBufferFormat srcPixelFormat, int srcStride, int width, int height) override {
throw std::logic_error("The method or operation is not implemented.");
}
virtual void DrawPixels(VirtualFramebuffer *vfb, int dstX, int dstY, const u8 *srcPixels, GEBufferFormat srcPixelFormat, int srcStride, int width, int height) override {
throw std::logic_error("The method or operation is not implemented.");
}
void DrawPixels(VirtualFramebuffer *vfb, int dstX, int dstY, const u8 *srcPixels, GEBufferFormat srcPixelFormat, int srcStride, int width, int height) override;
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 {
throw std::logic_error("The method or operation is not implemented.");
}
virtual void FlushBeforeCopy() override {
throw std::logic_error("The method or operation is not implemented.");
}
virtual void FlushBeforeCopy() override;
virtual void DecimateFBOs() override {
throw std::logic_error("The method or operation is not implemented.");
}
void DecimateFBOs() override;
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.");
@ -88,19 +81,15 @@ public:
}
virtual void ResizeFramebufFBO(VirtualFramebuffer *vfb, u16 w, u16 h, bool force = false) override {
throw std::logic_error("The method or operation is not implemented.");
}
virtual void NotifyRenderFramebufferCreated(VirtualFramebuffer *vfb) override {
throw std::logic_error("The method or operation is not implemented.");
}
virtual void NotifyRenderFramebufferSwitched(VirtualFramebuffer *prevVfb, VirtualFramebuffer *vfb, bool isClearingDepth) override {
throw std::logic_error("The method or operation is not implemented.");
}
virtual void NotifyRenderFramebufferUpdated(VirtualFramebuffer *vfb, bool vfbFormatChanged) override {
throw std::logic_error("The method or operation is not implemented.");
}
void DownloadFramebufferForClut(u32 fb_address, u32 loadBytes) override {
@ -123,8 +112,9 @@ public:
std::vector<FramebufferInfo> GetFramebufferList();
private:
VkInstance inst_;
VulkanContext *vulkan_;
VkCommandBuffer cmd_;
TextureCacheVulkan *texCache_;
DrawEngineVulkan *drawEngine_;
};

View File

@ -394,6 +394,7 @@ GPU_Vulkan::GPU_Vulkan(GraphicsContext *ctx)
: vulkan_((VulkanContext *)ctx->GetAPIContext()),
drawEngine_(vulkan_),
textureCache_(vulkan_),
framebufferManager_(vulkan_),
resized_(false),
gfxCtx_(ctx) {
UpdateVsyncInterval(true);
@ -405,6 +406,7 @@ GPU_Vulkan::GPU_Vulkan(GraphicsContext *ctx)
drawEngine_.SetFramebufferManager(&framebufferManager_);
framebufferManager_.Init();
framebufferManager_.SetTextureCache(&textureCache_);
framebufferManager_.SetDrawEngine(&drawEngine_);
textureCache_.SetFramebufferManager(&framebufferManager_);
textureCache_.SetDepalShaderCache(&depalShaderCache_);
textureCache_.SetShaderManager(shaderManager_);
@ -619,7 +621,6 @@ void GPU_Vulkan::CopyDisplayToOutput() {
void GPU_Vulkan::CopyDisplayToOutputInternal() {
// Flush anything left over.
framebufferManager_.RebindFramebuffer();
drawEngine_.Flush(curCmd_);
shaderManager_->DirtyLastShader();