mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-07 22:37:15 +00:00
Clearing fix, drawpixels fix/hack
This commit is contained in:
parent
b1c256a296
commit
38b50501c2
@ -257,7 +257,7 @@ VkCommandBuffer VulkanContext::BeginSurfaceRenderPass(VkClearValue clear_values[
|
||||
|
||||
void VulkanContext::EndSurfaceRenderPass() {
|
||||
FrameData *frame = &frame_[curFrame_];
|
||||
ILOG("VulkanContext::EndSurfaceRenderPass");
|
||||
// ILOG("VulkanContext::EndSurfaceRenderPass");
|
||||
vkCmdEndRenderPass(frame->cmdBuf);
|
||||
}
|
||||
|
||||
|
@ -90,8 +90,6 @@ FramebufferManagerVulkan::FramebufferManagerVulkan(Draw::DrawContext *draw, Vulk
|
||||
pixelBufObj_(nullptr),
|
||||
currentPBO_(0),
|
||||
curFrame_(0),
|
||||
pipelineBasicTexBackBuffer_(VK_NULL_HANDLE),
|
||||
pipelineBasicTexFrameBuffer_(VK_NULL_HANDLE),
|
||||
pipelinePostShader_(VK_NULL_HANDLE),
|
||||
vulkan2D_(vulkan) {
|
||||
|
||||
@ -300,6 +298,8 @@ void FramebufferManagerVulkan::MakePixelTexture(const u8 *srcPixels, GEBufferFor
|
||||
size_t offset = frameData_[curFrame_].push_->Push(data, width * height * 4, &buffer);
|
||||
drawPixelsTex_->UploadMip(0, width, height, buffer, (uint32_t)offset, width);
|
||||
drawPixelsTex_->EndCreate();
|
||||
|
||||
overrideImageView_ = drawPixelsTex_->GetImageView();
|
||||
}
|
||||
|
||||
void FramebufferManagerVulkan::SetViewport2D(int x, int y, int w, int h) {
|
||||
@ -359,8 +359,8 @@ void FramebufferManagerVulkan::DrawActiveTexture(float x, float y, float w, floa
|
||||
|
||||
VkCommandBuffer cmd = (VkCommandBuffer)draw_->GetNativeObject(Draw::NativeObject::RENDERPASS_COMMANDBUFFER);
|
||||
|
||||
// TODO: Choose linear or nearest appropriately, see GL impl.
|
||||
VkImageView view = (VkImageView)draw_->GetNativeObject(Draw::NativeObject::BOUND_TEXTURE_IMAGEVIEW);
|
||||
VkImageView view = overrideImageView_ ? overrideImageView_ : (VkImageView)draw_->GetNativeObject(Draw::NativeObject::BOUND_TEXTURE_IMAGEVIEW);
|
||||
overrideImageView_ = VK_NULL_HANDLE;
|
||||
vulkan2D_.BindDescriptorSet(cmd, view, linearFilter ? linearSampler_ : nearestSampler_);
|
||||
vkCmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, cur2DPipeline_);
|
||||
VkBuffer vbuffer;
|
||||
@ -462,8 +462,9 @@ VkImageView FramebufferManagerVulkan::BindFramebufferAsColorTexture(int stage, V
|
||||
// Currently rendering to this framebuffer. Need to make a copy.
|
||||
if (!skipCopy && framebuffer == currentRenderVfb_) {
|
||||
// ignore this case for now, doesn't work
|
||||
ILOG("Texturing from current render Vfb!");
|
||||
// ILOG("Texturing from current render Vfb!");
|
||||
return VK_NULL_HANDLE;
|
||||
|
||||
// TODO: Maybe merge with bvfbs_? Not sure if those could be packing, and they're created at a different size.
|
||||
Draw::Framebuffer *renderCopy = GetTempFBO(framebuffer->renderWidth, framebuffer->renderHeight, (Draw::FBColorDepth)framebuffer->colorDepth);
|
||||
if (renderCopy) {
|
||||
|
@ -183,11 +183,8 @@ private:
|
||||
// Basic shaders
|
||||
VkShaderModule fsBasicTex_;
|
||||
VkShaderModule vsBasicTex_;
|
||||
// Might need different pipelines for rendering to backbuffer vs framebuffers due to color format incompatibility
|
||||
VkPipeline pipelineBasicTexBackBuffer_;
|
||||
VkPipeline pipelineBasicTexFrameBuffer_;
|
||||
|
||||
VkPipeline cur2DPipeline_;
|
||||
VkPipeline cur2DPipeline_ = VK_NULL_HANDLE;
|
||||
|
||||
// Postprocessing
|
||||
VkPipeline pipelinePostShader_;
|
||||
@ -195,6 +192,9 @@ private:
|
||||
VkSampler linearSampler_;
|
||||
VkSampler nearestSampler_;
|
||||
|
||||
// hack!
|
||||
VkImageView overrideImageView_ = VK_NULL_HANDLE;
|
||||
|
||||
// Simple 2D drawing engine.
|
||||
Vulkan2D vulkan2D_;
|
||||
};
|
||||
|
@ -510,7 +510,7 @@ private:
|
||||
|
||||
enum {
|
||||
MAX_BOUND_TEXTURES = 1,
|
||||
MAX_FRAME_COMMAND_BUFFERS = 128,
|
||||
MAX_FRAME_COMMAND_BUFFERS = 256,
|
||||
};
|
||||
VKTexture *boundTextures_[MAX_BOUND_TEXTURES];
|
||||
VKSamplerState *boundSamplers_[MAX_BOUND_TEXTURES];
|
||||
@ -818,9 +818,9 @@ VKContext::VKContext(VulkanContext *vulkan)
|
||||
}
|
||||
for (int color = 0; color < 3; color++) {
|
||||
switch ((RPAction)color) {
|
||||
case RPAction::CLEAR: attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; break;
|
||||
case RPAction::KEEP: attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; break;
|
||||
case RPAction::DONT_CARE: attachments[1].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; break;
|
||||
case RPAction::CLEAR: attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_CLEAR; break;
|
||||
case RPAction::KEEP: attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; break;
|
||||
case RPAction::DONT_CARE: attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; break;
|
||||
}
|
||||
vkCreateRenderPass(vulkan_->GetDevice(), &rp, nullptr, &renderPasses_[RPIndex((RPAction)color, (RPAction)depth)]);
|
||||
}
|
||||
@ -899,7 +899,7 @@ void VKContext::WaitRenderCompletion(Framebuffer *fbo) {
|
||||
|
||||
void VKContext::EndFrame() {
|
||||
if (curRenderPass_) {
|
||||
ELOG("EndFrame: Ending render pass");
|
||||
// ELOG("EndFrame: Ending render pass");
|
||||
vulkan_->EndSurfaceRenderPass();
|
||||
curRenderPass_ = VK_NULL_HANDLE;
|
||||
curFramebuffer_ = VK_NULL_HANDLE;
|
||||
@ -1651,7 +1651,8 @@ void VKContext::BindFramebufferAsRenderTarget(Framebuffer *fbo, const RenderPass
|
||||
EndCurrentRenderpass();
|
||||
VkRenderPass renderPass;
|
||||
int numClearVals = 0;
|
||||
VkClearValue clearVal[2] = {};
|
||||
VkClearValue clearVal[2];
|
||||
memset(clearVal, 0, sizeof(clearVal));
|
||||
if (fbo) {
|
||||
VKFramebuffer *fb = (VKFramebuffer *)fbo;
|
||||
fb->cmdBuf = AllocCmdBuf();
|
||||
@ -1696,7 +1697,6 @@ void VKContext::BindFramebufferAsRenderTarget(Framebuffer *fbo, const RenderPass
|
||||
} else {
|
||||
cmd_ = vulkan_->GetSurfaceCommandBuffer();
|
||||
renderPass = vulkan_->GetSurfaceRenderPass();
|
||||
// ILOG("Switching framebuffer to backbuffer (cmd=%x)", (int)(uintptr_t)cmd_);
|
||||
numClearVals = 2;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user