mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-04 11:43:47 +01:00
Merge pull request #21141 from hrydgard/more-misc
Fix problem with block image copies within a framebuffer in Vulkan, misc fixes
This commit is contained in:
16 files changed
+141
-84
No files matched your search
@@ -294,6 +294,7 @@
|
||||
<ClInclude Include="..\ext\aemu_postoffice\client\log_impl.h" />
|
||||
<ClInclude Include="..\ext\aemu_postoffice\client\mutex_impl.h" />
|
||||
<ClInclude Include="..\ext\aemu_postoffice\client\postoffice_client.h" />
|
||||
<ClInclude Include="..\ext\aemu_postoffice\client\sock_impl.h" />
|
||||
<ClInclude Include="..\ext\at3_standalone\at3_decoders.h" />
|
||||
<ClInclude Include="..\ext\at3_standalone\atrac.h" />
|
||||
<ClInclude Include="..\ext\at3_standalone\atrac3data.h" />
|
||||
|
||||
@@ -719,6 +719,9 @@
|
||||
<ClInclude Include="..\ext\aemu_postoffice\client\postoffice_client.h">
|
||||
<Filter>ext\aemu_postoffice</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\ext\aemu_postoffice\client\sock_impl.h">
|
||||
<Filter>ext\aemu_postoffice</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ABI.cpp" />
|
||||
|
||||
@@ -210,18 +210,19 @@ FILE *OpenCFile(const Path &path, const char *mode) {
|
||||
|
||||
#ifdef HAVE_LIBRETRO_VFS
|
||||
if (!strcmp(mode, "r") || !strcmp(mode, "rb") || !strcmp(mode, "rt")) {
|
||||
INFO_LOG(Log::IO, "OpenCFile(%s): Opening content file for read.", path.c_str());
|
||||
return filestream_open(path.c_str(), RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
FILE *f = filestream_open(path.c_str(), RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
INFO_LOG(Log::IO, "OpenCFile(%s): Opening content file for read (libretro vfs): %s", path.c_str(), f ? "ok" : "null");
|
||||
return f;
|
||||
} else if (!strcmp(mode, "w") || !strcmp(mode, "wb") || !strcmp(mode, "wt") || !strcmp(mode, "at") || !strcmp(mode, "a")) {
|
||||
INFO_LOG(Log::IO, "OpenCFile(%s): Opening content file for write.", path.c_str());
|
||||
bool append = !strcmp(mode, "at") || !strcmp(mode, "a");
|
||||
FILE *f = filestream_open(path.c_str(), append && Exists(path) ? RETRO_VFS_FILE_ACCESS_WRITE | RETRO_VFS_FILE_ACCESS_UPDATE_EXISTING : RETRO_VFS_FILE_ACCESS_WRITE, RETRO_VFS_FILE_ACCESS_HINT_NONE);
|
||||
INFO_LOG(Log::IO, "OpenCFile(%s): Opening content file for write (libretro vfs): %s", path.c_str(), f ? "ok" : "null");
|
||||
if (f != nullptr && append) {
|
||||
Fseek(f, 0, SEEK_END);
|
||||
}
|
||||
return f;
|
||||
} else {
|
||||
ERROR_LOG(Log::IO, "OpenCFile(%s): Mode not yet supported: %s", path.c_str(), mode);
|
||||
ERROR_LOG(Log::IO, "OpenCFile(%s): Mode not yet supported (libretro vfs): %s", path.c_str(), mode);
|
||||
return nullptr;
|
||||
}
|
||||
#elif defined(_WIN32) && defined(UNICODE)
|
||||
@@ -1069,7 +1070,7 @@ bool DeleteDir(const Path &path) {
|
||||
#ifdef HAVE_LIBRETRO_VFS
|
||||
if (filestream_delete(path.c_str()) == 0)
|
||||
return true;
|
||||
ERROR_LOG(Log::IO, "DeleteDir: %s", path.c_str());
|
||||
ERROR_LOG(Log::IO, "DeleteDir (libretro vfs): %s", path.c_str());
|
||||
return false;
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
|
||||
@@ -67,7 +67,11 @@ void VulkanBarrierBatch::TransitionColorImageAuto(
|
||||
break;
|
||||
case VK_IMAGE_LAYOUT_GENERAL:
|
||||
// We came from the Mali workaround, and are transitioning back to COLOR_ATTACHMENT_OPTIMAL.
|
||||
srcAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
|
||||
// Alternatively, we're doing an intra-buffer copy. Let's cover both bases if needed.
|
||||
srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT | VK_ACCESS_TRANSFER_READ_BIT;
|
||||
srcStageMask_ |= VK_PIPELINE_STAGE_TRANSFER_BIT;
|
||||
// TODO: Add a check for the mali bug presence.
|
||||
srcAccessMask |= VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT;
|
||||
srcStageMask_ |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
||||
break;
|
||||
case VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL:
|
||||
@@ -105,6 +109,11 @@ void VulkanBarrierBatch::TransitionColorImageAuto(
|
||||
dstAccessMask = VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT;
|
||||
dstStageMask_ |= VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT;
|
||||
break;
|
||||
case VK_IMAGE_LAYOUT_GENERAL:
|
||||
// Used in intra-buffer framebuffer copies. We should add some better metadata...
|
||||
dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT | VK_ACCESS_TRANSFER_WRITE_BIT;
|
||||
dstStageMask_ |= VK_PIPELINE_STAGE_TRANSFER_BIT;
|
||||
break;
|
||||
default:
|
||||
_assert_msg_(false, "Unexpected newLayout: %s", VulkanImageLayoutToString(newImageLayout));
|
||||
break;
|
||||
|
||||
@@ -1384,9 +1384,6 @@ VKRRenderPass *VulkanQueueRunner::PerformBindFramebufferAsRenderTarget(const VKR
|
||||
}
|
||||
|
||||
void VulkanQueueRunner::PerformCopy(const VKRStep &step, VkCommandBuffer cmd) {
|
||||
// The barrier code doesn't handle this case. We'd need to transition to GENERAL to do an intra-image copy.
|
||||
_dbg_assert_(step.copy.src != step.copy.dst);
|
||||
|
||||
VKRFramebuffer *src = step.copy.src;
|
||||
VKRFramebuffer *dst = step.copy.dst;
|
||||
|
||||
@@ -1396,22 +1393,27 @@ void VulkanQueueRunner::PerformCopy(const VKRStep &step, VkCommandBuffer cmd) {
|
||||
// TODO: If dst covers exactly the whole destination, we can set up a UNDEFINED->TRANSFER_DST_OPTIMAL transition,
|
||||
// which can potentially be more efficient.
|
||||
|
||||
const VkImageLayout srcTransferLayout = src != dst ? VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL : VK_IMAGE_LAYOUT_GENERAL;
|
||||
|
||||
if (step.copy.aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
recordBarrier_.TransitionColorImageAuto(&src->color, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
||||
recordBarrier_.TransitionColorImageAuto(&dst->color, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
recordBarrier_.TransitionColorImageAuto(&src->color, srcTransferLayout);
|
||||
if (src != dst) {
|
||||
recordBarrier_.TransitionColorImageAuto(&dst->color, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
}
|
||||
}
|
||||
|
||||
// We can't copy only depth or only stencil unfortunately - or can we?.
|
||||
if (step.copy.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
|
||||
_dbg_assert_(src->depth.image != VK_NULL_HANDLE);
|
||||
|
||||
recordBarrier_.TransitionDepthStencilImageAuto(&src->depth, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
||||
if (dst->depth.layout != VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) {
|
||||
recordBarrier_.TransitionDepthStencilImageAuto(&dst->depth, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
} else {
|
||||
// Kingdom Hearts: Subsequent copies twice to the same depth buffer without any other use.
|
||||
// Not super sure how that happens, but we need a barrier to pass sync validation.
|
||||
SetupTransferDstWriteAfterWrite(dst->depth, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT, &recordBarrier_);
|
||||
recordBarrier_.TransitionDepthStencilImageAuto(&src->depth, srcTransferLayout);
|
||||
if (src != dst) {
|
||||
if (dst->depth.layout != VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL) {
|
||||
recordBarrier_.TransitionDepthStencilImageAuto(&dst->depth, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
} else {
|
||||
// Kingdom Hearts: Subsequent copies twice to the same depth buffer without any other use.
|
||||
// Not super sure how that happens, but we need a barrier to pass sync validation.
|
||||
SetupTransferDstWriteAfterWrite(dst->depth, VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT, &recordBarrier_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1420,14 +1422,18 @@ void VulkanQueueRunner::PerformCopy(const VKRStep &step, VkCommandBuffer cmd) {
|
||||
// If both the targets are multisampled, copy the msaa targets too.
|
||||
// For that, we need to transition them from their normally permanent VK_*_ATTACHMENT_OPTIMAL layouts, and then back.
|
||||
if (step.copy.aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
recordBarrier_.TransitionColorImageAuto(&src->msaaColor, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
||||
recordBarrier_.TransitionColorImageAuto(&dst->msaaColor, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
recordBarrier_.TransitionColorImageAuto(&src->msaaColor, srcTransferLayout);
|
||||
if (src != dst) {
|
||||
recordBarrier_.TransitionColorImageAuto(&dst->msaaColor, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
}
|
||||
}
|
||||
if (step.copy.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
|
||||
// Kingdom Hearts: Subsequent copies to the same depth buffer without any other use.
|
||||
// Not super sure how that happens, but we need a barrier to pass sync validation.
|
||||
recordBarrier_.TransitionDepthStencilImageAuto(&src->msaaDepth, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL);
|
||||
recordBarrier_.TransitionDepthStencilImageAuto(&dst->msaaDepth, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
recordBarrier_.TransitionDepthStencilImageAuto(&src->msaaColor, srcTransferLayout);
|
||||
if (src != dst) {
|
||||
// Kingdom Hearts: Subsequent copies to the same depth buffer without any other use.
|
||||
// Not super sure how that happens, but we need a barrier to pass sync validation.
|
||||
recordBarrier_.TransitionDepthStencilImageAuto(&dst->msaaDepth, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1478,7 +1484,7 @@ void VulkanQueueRunner::PerformCopy(const VKRStep &step, VkCommandBuffer cmd) {
|
||||
1,
|
||||
src->msaaColor.numLayers,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
srcTransferLayout,
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_READ_BIT,
|
||||
VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
|
||||
@@ -1486,20 +1492,22 @@ void VulkanQueueRunner::PerformCopy(const VKRStep &step, VkCommandBuffer cmd) {
|
||||
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT
|
||||
);
|
||||
src->msaaColor.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
recordBarrier_.TransitionImage(
|
||||
dst->msaaColor.image,
|
||||
0,
|
||||
1,
|
||||
dst->msaaColor.numLayers,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT
|
||||
);
|
||||
dst->msaaColor.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
if (src != dst) {
|
||||
recordBarrier_.TransitionImage(
|
||||
dst->msaaColor.image,
|
||||
0,
|
||||
1,
|
||||
dst->msaaColor.numLayers,
|
||||
VK_IMAGE_ASPECT_COLOR_BIT,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
VK_ACCESS_COLOR_ATTACHMENT_READ_BIT | VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT
|
||||
);
|
||||
dst->msaaColor.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
}
|
||||
}
|
||||
if (step.copy.aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
|
||||
recordBarrier_.TransitionImage(
|
||||
@@ -1508,7 +1516,7 @@ void VulkanQueueRunner::PerformCopy(const VKRStep &step, VkCommandBuffer cmd) {
|
||||
1,
|
||||
src->msaaDepth.numLayers,
|
||||
VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
srcTransferLayout,
|
||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_READ_BIT,
|
||||
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,
|
||||
@@ -1516,20 +1524,22 @@ void VulkanQueueRunner::PerformCopy(const VKRStep &step, VkCommandBuffer cmd) {
|
||||
VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT
|
||||
);
|
||||
src->msaaDepth.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
recordBarrier_.TransitionImage(
|
||||
dst->msaaDepth.image,
|
||||
0,
|
||||
1,
|
||||
dst->msaaDepth.numLayers,
|
||||
VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT
|
||||
);
|
||||
dst->msaaDepth.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
if (src != dst) {
|
||||
recordBarrier_.TransitionImage(
|
||||
dst->msaaDepth.image,
|
||||
0,
|
||||
1,
|
||||
dst->msaaDepth.numLayers,
|
||||
VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL,
|
||||
VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT,
|
||||
VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT
|
||||
);
|
||||
dst->msaaDepth.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
}
|
||||
}
|
||||
// Probably not necessary.
|
||||
recordBarrier_.Flush(cmd);
|
||||
|
||||
@@ -1327,6 +1327,10 @@ void VulkanRenderManager::CopyFramebuffer(VKRFramebuffer *src, VkRect2D srcRect,
|
||||
#ifdef _DEBUG
|
||||
SanityCheckPassesOnAdd();
|
||||
#endif
|
||||
// _dbg_assert_msg_(src != dst, "Can't copy within the same buffer");
|
||||
if (src == dst) {
|
||||
// TODO: Check for rectangle self-overlap.
|
||||
}
|
||||
|
||||
_dbg_assert_msg_(srcRect.offset.x >= 0, "srcrect offset x (%d) < 0", srcRect.offset.x);
|
||||
_dbg_assert_msg_(srcRect.offset.y >= 0, "srcrect offset y (%d) < 0", srcRect.offset.y);
|
||||
@@ -1341,35 +1345,44 @@ void VulkanRenderManager::CopyFramebuffer(VKRFramebuffer *src, VkRect2D srcRect,
|
||||
_dbg_assert_msg_(dstPos.x + srcRect.extent.width <= (uint32_t)dst->width, "dstPos + extent x > width");
|
||||
_dbg_assert_msg_(dstPos.y + srcRect.extent.height <= (uint32_t)dst->height, "dstPos + extent y > height");
|
||||
|
||||
VkImageLayout finalSrcLayoutBeforeCopy = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
|
||||
if (src == dst) {
|
||||
// We only use the first loop before, and transition to VK_IMAGE_LAYOUT_GENERAL.
|
||||
finalSrcLayoutBeforeCopy = VK_IMAGE_LAYOUT_GENERAL;
|
||||
}
|
||||
|
||||
for (int i = (int)steps_.size() - 1; i >= 0; i--) {
|
||||
if (steps_[i]->stepType == VKRStepType::RENDER && steps_[i]->render.framebuffer == src) {
|
||||
if (aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
if (steps_[i]->render.finalColorLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
|
||||
steps_[i]->render.finalColorLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
|
||||
steps_[i]->render.finalColorLayout = finalSrcLayoutBeforeCopy;
|
||||
}
|
||||
}
|
||||
if (aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
|
||||
if (steps_[i]->render.finalDepthStencilLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
|
||||
steps_[i]->render.finalDepthStencilLayout = VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL;
|
||||
steps_[i]->render.finalDepthStencilLayout = finalSrcLayoutBeforeCopy;
|
||||
}
|
||||
}
|
||||
steps_[i]->render.numReads++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = (int)steps_.size() - 1; i >= 0; i--) {
|
||||
if (steps_[i]->stepType == VKRStepType::RENDER && steps_[i]->render.framebuffer == dst) {
|
||||
if (aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
if (steps_[i]->render.finalColorLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
|
||||
steps_[i]->render.finalColorLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||
|
||||
if (src != dst) {
|
||||
for (int i = (int)steps_.size() - 1; i >= 0; i--) {
|
||||
if (steps_[i]->stepType == VKRStepType::RENDER && steps_[i]->render.framebuffer == dst) {
|
||||
if (aspectMask & VK_IMAGE_ASPECT_COLOR_BIT) {
|
||||
if (steps_[i]->render.finalColorLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
|
||||
steps_[i]->render.finalColorLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
|
||||
if (steps_[i]->render.finalDepthStencilLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
|
||||
steps_[i]->render.finalDepthStencilLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||
if (aspectMask & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
|
||||
if (steps_[i]->render.finalDepthStencilLayout == VK_IMAGE_LAYOUT_UNDEFINED) {
|
||||
steps_[i]->render.finalDepthStencilLayout = VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1057,6 +1057,10 @@ VKContext::VKContext(VulkanContext *vulkan, bool useRenderThread)
|
||||
bugs_.Infest(Bugs::MALI_CONSTANT_LOAD_BUG); // See issue #15661
|
||||
}
|
||||
|
||||
if (deviceProps.driverVersion == 0xaa9c4b29) {
|
||||
bugs_.Infest(Bugs::EMPTY_RENDERPASS_BROKEN_MALI);
|
||||
}
|
||||
|
||||
// Older ARM devices have very slow geometry shaders, not worth using. At least before 15.
|
||||
// Also seen to cause weird issues on 18, so let's lump it in.
|
||||
if (majorVersion <= 18 || isOldVersion) {
|
||||
|
||||
@@ -722,6 +722,7 @@ const char *Bugs::GetBugName(uint32_t bug) {
|
||||
case GEOMETRY_SHADERS_SLOW_OR_BROKEN: return "GEOMETRY_SHADERS_SLOW_OR_BROKEN";
|
||||
case ADRENO_RESOURCE_DEADLOCK: return "ADRENO_RESOURCE_DEADLOCK";
|
||||
case PVR_BAD_16BIT_TEXFORMATS: return "PVR_BAD_16BIT_TEXFORMATS";
|
||||
case EMPTY_RENDERPASS_BROKEN_MALI: return "EMPTY_RENDERPASS_BROKEN_MALI";
|
||||
default: return "(N/A)";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,6 +354,7 @@ public:
|
||||
UNIFORM_INDEXING_BROKEN = 13, // not a properly diagnosed issue, a workaround attempt: #17386
|
||||
PVR_BAD_16BIT_TEXFORMATS = 14,
|
||||
NO_DEPTH_CANNOT_DISCARD_STENCIL_MALI = 15,
|
||||
EMPTY_RENDERPASS_BROKEN_MALI = 16,
|
||||
MAX_BUG,
|
||||
};
|
||||
|
||||
|
||||
+13
-4
@@ -464,7 +464,9 @@ static int DefaultGPUBackend() {
|
||||
return (int)GPUBackend::OPENGL;
|
||||
}
|
||||
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
return (int)GPUBackend::DIRECT3D11;
|
||||
#elif PPSSPP_PLATFORM(WINDOWS)
|
||||
// On Win10, there's a good chance Vulkan will work by default.
|
||||
if (IsWin10OrHigher()) {
|
||||
return (int)GPUBackend::VULKAN;
|
||||
@@ -1494,13 +1496,20 @@ void Config::PostLoadCleanup() {
|
||||
g_Config.iCpuCore = (int)CPUCore::IR_INTERPRETER;
|
||||
}
|
||||
|
||||
// This caps the exponent 4 (so 16x.). No hardware supports more anyway.
|
||||
// This caps the aniso level exponent to 4 (so 16x.). No hardware supports more anyway.
|
||||
iAnisotropyLevel = std::clamp(iAnisotropyLevel, 0, 4);
|
||||
|
||||
if (iGPUBackend == 1) { // d3d9, no longer supported
|
||||
iGPUBackend = 2; // d3d11
|
||||
if (iGPUBackend == 1) { // d3d9, no longer supported. Fall back to D3D11.
|
||||
iGPUBackend = (int)GPUBackend::DIRECT3D11;
|
||||
} else if (iGPUBackend < 0 || iGPUBackend > 3) {
|
||||
iGPUBackend = (int)DefaultGPUBackend();
|
||||
}
|
||||
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
// Enforce D3D11.
|
||||
iGPUBackend = (int)GPUBackend::DIRECT3D11;
|
||||
#endif
|
||||
|
||||
// Set a default MAC, and correct if it's an old format.
|
||||
if (sMACAddress.length() != 17)
|
||||
sMACAddress = CreateRandMAC();
|
||||
|
||||
@@ -56,7 +56,7 @@ void LocalFileLoader::DetectSizeFd() {
|
||||
#endif
|
||||
|
||||
LocalFileLoader::LocalFileLoader(const Path &filename)
|
||||
: filesize_(0), filename_(filename) {
|
||||
: filename_(filename) {
|
||||
if (filename.empty()) {
|
||||
ERROR_LOG(Log::FileSystem, "LocalFileLoader can't load empty filenames");
|
||||
return;
|
||||
@@ -79,7 +79,7 @@ LocalFileLoader::LocalFileLoader(const Path &filename)
|
||||
|
||||
#if defined(HAVE_LIBRETRO_VFS)
|
||||
file_ = File::OpenCFile(filename, "rb");
|
||||
if (file_ == nullptr) {
|
||||
if (!file_) {
|
||||
return;
|
||||
}
|
||||
filesize_ = File::GetFileSize(file_);
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
|
||||
private:
|
||||
#ifdef HAVE_LIBRETRO_VFS
|
||||
FILE *file_;
|
||||
FILE *file_ = nullptr;
|
||||
#elif !defined(_WIN32)
|
||||
void DetectSizeFd();
|
||||
int fd_ = -1;
|
||||
|
||||
@@ -3452,7 +3452,7 @@ void FramebufferManagerCommon::BlitFramebuffer(VirtualFramebuffer *dst, int dstX
|
||||
|
||||
bool useBlit = channel == RASTER_COLOR ? draw_->GetDeviceCaps().framebufferBlitSupported : false;
|
||||
bool useCopy = channel == RASTER_COLOR ? draw_->GetDeviceCaps().framebufferCopySupported : false;
|
||||
if (dst == currentRenderVfb_ || dst->fbo->MultiSampleLevel() != 0 || src->fbo->MultiSampleLevel() != 0) {
|
||||
if (src != dst && (dst == currentRenderVfb_ || dst->fbo->MultiSampleLevel() != 0 || src->fbo->MultiSampleLevel() != 0)) {
|
||||
// If already bound, using either a blit or a copy is unlikely to be an optimization.
|
||||
// So we're gonna use a raster draw instead. Also multisampling has problems with copies currently.
|
||||
useBlit = false;
|
||||
@@ -3512,7 +3512,8 @@ void FramebufferManagerCommon::BlitFramebuffer(VirtualFramebuffer *dst, int dstX
|
||||
Draw::Framebuffer *srcFBO = src->fbo;
|
||||
if (src == dst) {
|
||||
Draw::Framebuffer *tempFBO = GetTempFBO(TempFBO::BLIT, src->renderWidth, src->renderHeight);
|
||||
BlitUsingRaster(src->fbo, srcX1, srcY1, srcX2, srcY2, tempFBO, dstX1, dstY1, dstX2, dstY2, false, dst->renderScaleFactor, pipeline, tag);
|
||||
// We need to copy to the temp using only the source coordinates, since those are the ones we read in the next blit.
|
||||
BlitUsingRaster(src->fbo, srcX1, srcY1, srcX2, srcY2, tempFBO, srcX1, srcY1, srcX2, srcY2, false, dst->renderScaleFactor, pipeline, tag);
|
||||
srcFBO = tempFBO;
|
||||
}
|
||||
BlitUsingRaster(srcFBO, srcX1, srcY1, srcX2, srcY2, dst->fbo, dstX1, dstY1, dstX2, dstY2, false, dst->renderScaleFactor, pipeline, tag);
|
||||
|
||||
@@ -1028,19 +1028,21 @@ void ImGeDebuggerWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterfa
|
||||
|
||||
bool disableStepButtons = gpuDebug->GetBreakNext() != GPUDebug::BreakNext::NONE && gpuDebug->GetBreakNext() != GPUDebug::BreakNext::DEBUG_RUN;
|
||||
|
||||
constexpr float fastRepeatRate = 0.025f;
|
||||
|
||||
if (disableStepButtons) {
|
||||
ImGui::BeginDisabled();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::RepeatButtonShift("Tex")) {
|
||||
if (ImGui::RepeatButtonShift("Tex", fastRepeatRate)) {
|
||||
gpuDebug->SetBreakNext(GPUDebug::BreakNext::TEX);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::RepeatButtonShift("Prim")) {
|
||||
if (ImGui::RepeatButtonShift("Prim", fastRepeatRate)) {
|
||||
gpuDebug->SetBreakNext(GPUDebug::BreakNext::PRIM);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::RepeatButtonShift("Draw")) {
|
||||
if (ImGui::RepeatButtonShift("Draw", fastRepeatRate)) {
|
||||
gpuDebug->SetBreakNext(GPUDebug::BreakNext::DRAW);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
@@ -1052,7 +1054,7 @@ void ImGeDebuggerWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterfa
|
||||
gpuDebug->SetBreakNext(GPUDebug::BreakNext::CURVE);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::RepeatButtonShift("Single step")) {
|
||||
if (ImGui::RepeatButtonShift("Single step", fastRepeatRate)) {
|
||||
gpuDebug->SetBreakNext(GPUDebug::BreakNext::OP);
|
||||
}
|
||||
if (disableStepButtons) {
|
||||
|
||||
@@ -17,10 +17,11 @@ bool RepeatButton(const char *title) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RepeatButtonShift(const char* label, float repeatRate) {
|
||||
int RepeatButtonShift(const char* label, float repeatRate) {
|
||||
bool clicked = ImGui::Button(label);
|
||||
|
||||
bool shiftHeld = ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift);
|
||||
bool ctrlHeld = ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl);
|
||||
bool held = ImGui::IsItemActive() && shiftHeld;
|
||||
|
||||
static float repeatDelay = 0.25f; // seconds before repeating starts
|
||||
@@ -39,8 +40,9 @@ bool RepeatButtonShift(const char* label, float repeatRate) {
|
||||
int steps = static_cast<int>(t / repeatRate);
|
||||
static int lastStep = -1;
|
||||
if (steps != lastStep) {
|
||||
int count = steps - lastStep;
|
||||
lastStep = steps;
|
||||
return true;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +54,7 @@ bool RepeatButtonShift(const char* label, float repeatRate) {
|
||||
}
|
||||
}
|
||||
|
||||
return clicked;
|
||||
return clicked ? 1 : 0;
|
||||
}
|
||||
|
||||
bool CollapsingHeaderWithCount(const char *title, int count, ImGuiTreeNodeFlags flags) {
|
||||
|
||||
@@ -10,7 +10,7 @@ inline void TextUnformatted(std::string_view str) {
|
||||
}
|
||||
|
||||
bool RepeatButton(const char *title);
|
||||
bool RepeatButtonShift(const char* label, float repeatRate = 0.05f);
|
||||
int RepeatButtonShift(const char* label, float repeatRate = 0.05f);
|
||||
|
||||
bool CollapsingHeaderWithCount(const char *title, int count, ImGuiTreeNodeFlags flags = 0);
|
||||
|
||||
|
||||
Reference in new issue
Block a user