Merge pull request #18725 from hrydgard/additional-beta-fixes

Additional beta fixes
This commit is contained in:
Henrik Rydgård 2024-01-19 00:45:12 +01:00 committed by GitHub
commit 10d16ea488
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 101 additions and 43 deletions

View File

@ -96,6 +96,10 @@ VKAPI_ATTR VkBool32 VKAPI_CALL VulkanDebugUtilsCallback(
// Clear value but no LOAD_OP_CLEAR. Not worth fixing right now.
return false;
case 1544472022:
// MSAA depth resolve write-after-write??
return false;
default:
break;
}

View File

@ -35,6 +35,10 @@ public:
return !descPool_;
}
void SetTag(const char *tag) {
tag_ = tag;
}
private:
VkResult Recreate(bool grow);

View File

@ -1575,7 +1575,7 @@ void VulkanRenderManager::ResetStats() {
VKRPipelineLayout *VulkanRenderManager::CreatePipelineLayout(BindingType *bindingTypes, size_t bindingTypesCount, bool geoShadersEnabled, const char *tag) {
VKRPipelineLayout *layout = new VKRPipelineLayout();
layout->tag = tag;
layout->SetTag(tag);
layout->bindingTypesCount = (uint32_t)bindingTypesCount;
_dbg_assert_(bindingTypesCount <= ARRAY_SIZE(layout->bindingTypes));

View File

@ -192,9 +192,10 @@ struct PackedDescriptor {
};
// Note that we only support a single descriptor set due to compatibility with some ancient devices.
// We should probably eventually give that up.
// We should probably eventually give that up eventually.
struct VKRPipelineLayout {
~VKRPipelineLayout();
enum { MAX_DESC_SET_BINDINGS = 10 };
BindingType bindingTypes[MAX_DESC_SET_BINDINGS];
@ -205,7 +206,8 @@ struct VKRPipelineLayout {
const char *tag = nullptr;
struct FrameData {
FrameData() : pool("GameDescPool", true) {}
FrameData() : pool("N/A", true) {}
VulkanDescSetPool pool;
FastVec<PackedDescriptor> descData_;
FastVec<PendingDescSet> descSets_;
@ -217,6 +219,12 @@ struct VKRPipelineLayout {
FrameData frameData[VulkanContext::MAX_INFLIGHT_FRAMES];
void FlushDescSets(VulkanContext *vulkan, int frame, QueueProfileContext *profile);
void SetTag(const char *tag) {
this->tag = tag;
for (int i = 0; i < ARRAY_SIZE(frameData); i++) {
frameData[i].pool.SetTag(tag);
}
}
};
class VulkanRenderManager {

View File

@ -381,6 +381,9 @@ public:
~VKContext();
void DebugAnnotate(const char *annotation) override;
void Wait() override {
vkDeviceWaitIdle(vulkan_->GetDevice());
}
const DeviceCaps &GetDeviceCaps() const override {
return caps_;

View File

@ -693,6 +693,8 @@ public:
Bugs GetBugs() const { return bugs_; }
virtual void Wait() {}
virtual const DeviceCaps &GetDeviceCaps() const = 0;
virtual uint32_t GetDataFormatSupport(DataFormat fmt) const = 0;
virtual std::vector<std::string> GetFeatureList() const { return std::vector<std::string>(); }

View File

@ -82,7 +82,7 @@ static bool RegisterServer(int port) {
http.SetUserAgent(StringFromFormat("PPSSPP/%s", PPSSPP_GIT_VERSION));
char resource4[1024] = {};
char resource4[1024]{};
if (http.Resolve(REPORT_HOSTNAME, REPORT_PORT, net::DNSType::IPV4)) {
if (http.Connect()) {
std::string ip = fd_util::GetLocalIP(http.sock());
@ -97,7 +97,7 @@ static bool RegisterServer(int port) {
if (http.Resolve(REPORT_HOSTNAME, REPORT_PORT, net::DNSType::IPV6)) {
// If IPv4 was successful, don't give this as much time (it blocks and sometimes IPv6 is broken.)
double timeout = success ? 2.0 : 20.0;
double timeout = success ? 2.0 : 10.0;
// We register both IPv4 and IPv6 in case the other client is using a different one.
if (resource4[0] != 0 && http.Connect(timeout)) {

View File

@ -597,7 +597,7 @@ void SoftwareTransform::BuildDrawingParams(int prim, int vertexCount, u32 vertTy
inds = newInds;
}
} else if (throughmode && g_Config.bSmart2DTexFiltering) {
} else if (throughmode && g_Config.bSmart2DTexFiltering && !gstate_c.textureIsVideo) {
// We check some common cases for pixel mapping.
// TODO: It's not really optimal that some previous step has removed the triangle strip.
if (vertexCount <= 6 && prim == GE_PRIM_TRIANGLES) {
@ -682,7 +682,7 @@ bool SoftwareTransform::ExpandRectangles(int vertexCount, int &numDecodedVerts,
vscale /= gstate_c.curTextureHeight;
}
bool pixelMapped = g_Config.bSmart2DTexFiltering;
bool pixelMapped = g_Config.bSmart2DTexFiltering && !gstate_c.textureIsVideo;
for (int i = 0; i < vertexCount; i += 2) {
const TransformedVertex &transVtxTL = transformed[indsIn[i + 0]];

View File

@ -401,6 +401,7 @@ TexCacheEntry *TextureCacheCommon::SetTexture() {
if (!Memory::IsValidAddress(texaddr)) {
// Bind a null texture and return.
Unbind();
gstate_c.SetTextureIsVideo(false);
gstate_c.SetTextureIs3D(false);
gstate_c.SetTextureIsArray(false);
gstate_c.SetTextureIsFramebuffer(false);
@ -569,6 +570,7 @@ TexCacheEntry *TextureCacheCommon::SetTexture() {
// got one!
gstate_c.curTextureWidth = w;
gstate_c.curTextureHeight = h;
gstate_c.SetTextureIsVideo(false);
gstate_c.SetTextureIs3D((entry->status & TexCacheEntry::STATUS_3D) != 0);
gstate_c.SetTextureIsArray(false);
gstate_c.SetTextureIsBGRA((entry->status & TexCacheEntry::STATUS_BGRA) != 0);
@ -675,6 +677,7 @@ TexCacheEntry *TextureCacheCommon::SetTexture() {
gstate_c.curTextureWidth = w;
gstate_c.curTextureHeight = h;
gstate_c.SetTextureIsVideo(false);
gstate_c.SetTextureIs3D((entry->status & TexCacheEntry::STATUS_3D) != 0);
gstate_c.SetTextureIsArray(false); // Ordinary 2D textures still aren't used by array view in VK. We probably might as well, though, at this point..
gstate_c.SetTextureIsFramebuffer(false);
@ -1197,6 +1200,7 @@ void TextureCacheCommon::SetTextureFramebuffer(const AttachCandidate &candidate)
nextTexture_ = nullptr;
}
gstate_c.SetTextureIsVideo(false);
gstate_c.SetTextureIs3D(false);
gstate_c.SetTextureIsArray(true);
@ -2154,6 +2158,7 @@ void TextureCacheCommon::ApplyTexture() {
ForgetLastTexture();
}
gstate_c.SetTextureIsVideo((entry->status & TexCacheEntry::STATUS_VIDEO) != 0);
if (entry->status & TexCacheEntry::STATUS_CLUT_GPU) {
// Special process.
ApplyTextureDepal(entry);

View File

@ -589,6 +589,9 @@ struct GPUStateCache {
Dirty(DIRTY_FRAGMENTSHADER_STATE);
}
}
void SetTextureIsVideo(bool isVideo) {
textureIsVideo = isVideo;
}
void SetTextureIsBGRA(bool isBGRA) {
if (bgraTexture != isBGRA) {
bgraTexture = isBGRA;
@ -657,6 +660,7 @@ public:
bool needShaderTexClamp;
bool textureIsArray;
bool textureIsFramebuffer;
bool textureIsVideo;
bool useFlagsChanged;
float morphWeights[8];

View File

@ -229,6 +229,7 @@ void TextureCacheVulkan::DeviceLost() {
nextTexture_ = nullptr;
draw_ = nullptr;
Unbind();
}
void TextureCacheVulkan::DeviceRestore(Draw::DrawContext *draw) {
@ -372,8 +373,7 @@ void TextureCacheVulkan::UpdateCurrentClut(GEPaletteFormat clutFormat, u32 clutB
void TextureCacheVulkan::BindTexture(TexCacheEntry *entry) {
if (!entry || !entry->vkTex) {
imageView_ = VK_NULL_HANDLE;
curSampler_ = VK_NULL_HANDLE;
Unbind();
return;
}

View File

@ -277,7 +277,8 @@ void EmuScreen::bootGame(const Path &filename) {
if (!info || info->pending)
return;
SetExtraAssertInfo((info->id + " " + info->GetTitle()).c_str());
extraAssertInfoStr_ = info->id + " " + info->GetTitle();
SetExtraAssertInfo(extraAssertInfoStr_.c_str());
if (!info->id.empty()) {
g_Config.loadGameConfig(info->id, info->GetTitle());
@ -468,6 +469,7 @@ void EmuScreen::dialogFinished(const Screen *dialog, DialogResult result) {
if (Core_IsActive())
UI::EnableFocusMovement(false);
RecreateViews();
SetExtraAssertInfo(extraAssertInfoStr_.c_str());
}
static void AfterSaveStateAction(SaveState::Status status, const std::string &message, void *) {
@ -1612,7 +1614,6 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
PSP_EndHostFrame();
}
screenManager()->getUIContext()->BeginFrame();
if (gpu && !gpu->PresentedThisFrame() && !skipBufferEffects) {
draw->BindFramebufferAsRenderTarget(nullptr, { RPAction::CLEAR, RPAction::CLEAR, RPAction::CLEAR, clearColor }, "EmuScreen_NoFrame");
@ -1620,6 +1621,8 @@ ScreenRenderFlags EmuScreen::render(ScreenRenderMode mode) {
draw->SetScissorRect(0, 0, g_display.pixel_xres, g_display.pixel_yres);
}
screenManager()->getUIContext()->BeginFrame();
if (!(mode & ScreenRenderMode::TOP)) {
// We're in run-behind mode, but we don't want to draw chat, debug UI and stuff.
// So, darken and bail here.

View File

@ -119,5 +119,7 @@ private:
UI::Button *cardboardDisableButton_ = nullptr;
std::string extraAssertInfoStr_;
ControlMapper controlMapper_;
};

View File

@ -227,21 +227,25 @@ u64 GameInfo::GetInstallDataSizeInBytes() {
}
bool GameInfo::LoadFromPath(const Path &gamePath) {
std::lock_guard<std::mutex> guard(lock);
// No need to rebuild if we already have it loaded.
if (filePath_ != gamePath) {
{
std::lock_guard<std::mutex> guard(loaderLock);
fileLoader.reset(ConstructFileLoader(gamePath));
if (!fileLoader)
return false;
{
std::lock_guard<std::mutex> guard(lock);
// No need to rebuild if we already have it loaded.
if (filePath_ == gamePath) {
return true;
}
filePath_ = gamePath;
// This is a fallback title, while we're loading / if unable to load.
title = filePath_.GetFilename();
}
{
std::lock_guard<std::mutex> guard(loaderLock);
fileLoader.reset(ConstructFileLoader(gamePath));
if (!fileLoader)
return false;
}
std::lock_guard<std::mutex> guard(lock);
filePath_ = gamePath;
// This is a fallback title, while we're loading / if unable to load.
title = filePath_.GetFilename();
return true;
}
@ -340,16 +344,19 @@ static bool ReadFileToString(IFileSystem *fs, const char *filename, std::string
if (handle < 0) {
return false;
}
if (mtx) {
std::string data;
data.resize(info.size);
fs->ReadFile(handle, (u8 *)data.data(), info.size);
fs->CloseFile(handle);
std::lock_guard<std::mutex> lock(*mtx);
contents->resize(info.size);
fs->ReadFile(handle, (u8 *)contents->data(), info.size);
*contents = std::move(data);
} else {
contents->resize(info.size);
fs->ReadFile(handle, (u8 *)contents->data(), info.size);
fs->CloseFile(handle);
}
fs->CloseFile(handle);
return true;
}
@ -363,12 +370,13 @@ static bool ReadVFSToString(const char *filename, std::string *contents, std::mu
} else {
*contents = std::string((const char *)data, sz);
}
} else {
return false;
}
delete [] data;
return data != nullptr;
return true;
}
class GameInfoWorkItem : public Task {
public:
GameInfoWorkItem(const Path &gamePath, std::shared_ptr<GameInfo> &info)
@ -472,20 +480,26 @@ public:
if (info_->wantFlags & GAMEINFO_WANTBG) {
if (pbp.GetSubFileSize(PBP_PIC0_PNG) > 0) {
std::string data;
pbp.GetSubFileAsString(PBP_PIC0_PNG, &data);
std::lock_guard<std::mutex> lock(info_->lock);
pbp.GetSubFileAsString(PBP_PIC0_PNG, &info_->pic0.data);
info_->pic0.data = std::move(data);
info_->pic0.dataLoaded = true;
}
if (pbp.GetSubFileSize(PBP_PIC1_PNG) > 0) {
std::string data;
pbp.GetSubFileAsString(PBP_PIC1_PNG, &data);
std::lock_guard<std::mutex> lock(info_->lock);
pbp.GetSubFileAsString(PBP_PIC1_PNG, &info_->pic1.data);
info_->pic1.data = std::move(data);
info_->pic1.dataLoaded = true;
}
}
if (info_->wantFlags & GAMEINFO_WANTSND) {
if (pbp.GetSubFileSize(PBP_SND0_AT3) > 0) {
std::string data;
pbp.GetSubFileAsString(PBP_SND0_AT3, &data);
std::lock_guard<std::mutex> lock(info_->lock);
pbp.GetSubFileAsString(PBP_SND0_AT3, &info_->sndFileData);
info_->sndFileData = std::move(data);
info_->sndDataLoaded = true;
}
}
@ -624,16 +638,17 @@ handleELF:
// Alright, let's fetch the PARAM.SFO.
std::string paramSFOcontents;
if (ReadFileToString(&umd, "/PSP_GAME/PARAM.SFO", &paramSFOcontents, nullptr)) {
std::lock_guard<std::mutex> lock(info_->lock);
info_->paramSFO.ReadSFO((const u8 *)paramSFOcontents.data(), paramSFOcontents.size());
info_->ParseParamSFO();
{
std::lock_guard<std::mutex> lock(info_->lock);
info_->paramSFO.ReadSFO((const u8 *)paramSFOcontents.data(), paramSFOcontents.size());
info_->ParseParamSFO();
}
if (info_->wantFlags & GAMEINFO_WANTBG) {
info_->pic0.dataLoaded = ReadFileToString(&umd, "/PSP_GAME/PIC0.PNG", &info_->pic0.data, nullptr);
info_->pic1.dataLoaded = ReadFileToString(&umd, "/PSP_GAME/PIC1.PNG", &info_->pic1.data, nullptr);
info_->pic0.dataLoaded = ReadFileToString(&umd, "/PSP_GAME/PIC0.PNG", &info_->pic0.data, &info_->lock);
info_->pic1.dataLoaded = ReadFileToString(&umd, "/PSP_GAME/PIC1.PNG", &info_->pic1.data, &info_->lock);
}
if (info_->wantFlags & GAMEINFO_WANTSND) {
info_->sndDataLoaded = ReadFileToString(&umd, "/PSP_GAME/SND0.AT3", &info_->sndFileData, nullptr);
info_->sndDataLoaded = ReadFileToString(&umd, "/PSP_GAME/SND0.AT3", &info_->sndFileData, &info_->lock);
}
}

View File

@ -183,7 +183,7 @@ static Draw::DrawContext *g_draw;
static Draw::Pipeline *colorPipeline;
static Draw::Pipeline *texColorPipeline;
static UIContext *uiContext;
static bool g_restartGraphics;
static int g_restartGraphics;
#ifdef _WIN32
WindowsAudioBackend *winAudioBackend;
@ -1037,11 +1037,15 @@ void NativeFrame(GraphicsContext *graphicsContext) {
PROFILE_END_FRAME();
// This can only be accessed from Windows currently, and causes linking errors with headless etc.
if (g_restartGraphics) {
if (g_restartGraphics == 1) {
// Used for debugging only.
NativeShutdownGraphics();
g_restartGraphics++;
return;
}
else if (g_restartGraphics == 2) {
NativeInitGraphics(graphicsContext);
g_restartGraphics = false;
g_restartGraphics = 0;
}
double startTime = time_now_d();
@ -1183,7 +1187,8 @@ void NativeFrame(GraphicsContext *graphicsContext) {
bool HandleGlobalMessage(UIMessage message, const std::string &value) {
if (message == UIMessage::RESTART_GRAPHICS) {
g_restartGraphics = true;
g_restartGraphics = 1;
return true;
} else if (message == UIMessage::SAVESTATE_DISPLAY_SLOT) {
auto sy = GetI18NCategory(I18NCat::SYSTEM);
std::string msg = StringFromFormat("%s: %d", sy->T("Savestate Slot"), SaveState::GetCurrentSlot() + 1);

View File

@ -266,6 +266,9 @@ void GamePauseScreen::update() {
GamePauseScreen::GamePauseScreen(const Path &filename)
: UIDialogScreenWithGameBackground(filename) {
// So we can tell if something blew up while on the pause screen.
std::string assertStr = "PauseScreen: " + filename.GetFilename();
SetExtraAssertInfo(assertStr.c_str());
}
GamePauseScreen::~GamePauseScreen() {