mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Merge pull request #21762 from hrydgard/misc-fixes
Fix imgui upside down, some logging changes etc
This commit is contained in:
14 files changed
+41
-54
No files matched your search
@@ -355,6 +355,7 @@ void LogManager::LogLine(LogLevel level, Log type, const char *file, int line, c
|
||||
}
|
||||
|
||||
void RingbufferLog::Log(const LogMessage &message) {
|
||||
std::lock_guard<std::mutex> lock(ringLock_);
|
||||
messages_[curMessage_] = message;
|
||||
curMessage_++;
|
||||
if (curMessage_ >= MAX_LOGS)
|
||||
|
||||
+10
-2
@@ -57,10 +57,17 @@ class RingbufferLog {
|
||||
public:
|
||||
void Log(const LogMessage &msg);
|
||||
int GetCount() const { return count_ < MAX_LOGS ? count_ : MAX_LOGS; }
|
||||
std::string_view TextAt(int i) const { return messages_[(curMessage_ - i - 1) & (MAX_LOGS - 1)].msg; }
|
||||
LogLevel LevelAt(int i) const { return messages_[(curMessage_ - i - 1) & (MAX_LOGS - 1)].level; }
|
||||
std::string TextAt(int i) const {
|
||||
std::lock_guard<std::mutex> lock(ringLock_);
|
||||
return messages_[(curMessage_ - i - 1) & (MAX_LOGS - 1)].msg;
|
||||
}
|
||||
LogLevel LevelAt(int i) const {
|
||||
std::lock_guard<std::mutex> lock(ringLock_);
|
||||
return messages_[(curMessage_ - i - 1) & (MAX_LOGS - 1)].level;
|
||||
}
|
||||
|
||||
void Clear() {
|
||||
std::lock_guard<std::mutex> lock(ringLock_);
|
||||
curMessage_ = 0;
|
||||
count_ = 0;
|
||||
}
|
||||
@@ -70,6 +77,7 @@ private:
|
||||
LogMessage messages_[MAX_LOGS];
|
||||
int curMessage_ = 0;
|
||||
int count_ = 0;
|
||||
mutable std::mutex ringLock_;
|
||||
};
|
||||
|
||||
class Section;
|
||||
|
||||
@@ -116,28 +116,18 @@ void DisplayProperties::Print() {
|
||||
rot_matrix.print();
|
||||
}
|
||||
|
||||
Lin::Matrix4x4 ComputeOrthoMatrix(float xres, float yres, CoordConvention coordConvention, bool compensateYFlip) {
|
||||
// Y-flip compensation is done elsewhere now.
|
||||
Lin::Matrix4x4 ComputeOrthoMatrix(float xres, float yres, CoordConvention coordConvention) {
|
||||
using namespace Lin;
|
||||
// TODO: Should be able to share the y-flip logic here with the one in postprocessing/presentation, for example.
|
||||
Matrix4x4 ortho;
|
||||
switch (coordConvention) {
|
||||
case CoordConvention::Vulkan:
|
||||
ortho.setOrthoD3D(0.0f, xres, 0, yres, -1.0f, 1.0f);
|
||||
break;
|
||||
case CoordConvention::Direct3D11:
|
||||
if (compensateYFlip) {
|
||||
ortho.setOrthoD3D(0.0f, xres, yres, 0.0f, -1.0f, 1.0f);
|
||||
} else {
|
||||
ortho.setOrthoD3D(0.0f, xres, 0, yres, -1.0f, 1.0f);
|
||||
}
|
||||
ortho.setOrthoD3D(0.0f, xres, 0, yres, -1.0f, 1.0f);
|
||||
break;
|
||||
case CoordConvention::OpenGL:
|
||||
default:
|
||||
if (compensateYFlip) {
|
||||
ortho.setOrthoGL(0.0f, xres, 0, yres, -1.0f, 1.0f);
|
||||
} else {
|
||||
ortho.setOrthoGL(0.0f, xres, yres, 0.0f, -1.0f, 1.0f);
|
||||
}
|
||||
ortho.setOrthoGL(0.0f, xres, yres, 0.0f, -1.0f, 1.0f);
|
||||
break;
|
||||
}
|
||||
// Compensate for rotated display if needed.
|
||||
|
||||
@@ -61,7 +61,7 @@ struct DisplayRect {
|
||||
void RotateRectToDisplay(DisplayRect<float> &rect, float rtWidth, float rtHeight);
|
||||
void RotateRectToDisplay(DisplayRect<int> &rect, int rtWidth, int rtHeight);
|
||||
|
||||
Lin::Matrix4x4 ComputeOrthoMatrix(float xres, float yres, CoordConvention coordConvention, bool compensateYFlip);
|
||||
Lin::Matrix4x4 ComputeOrthoMatrix(float xres, float yres, CoordConvention coordConvention);
|
||||
|
||||
// Take this and run through translation. Returns "Portrait", "Landscape" or later "Square" (the latter being the square shape you get when you open a foldable phone).
|
||||
std::string_view DeviceOrientationToString(DeviceOrientation orientation);
|
||||
@@ -718,7 +718,6 @@ static const ConfigSetting graphicsSettings[] = {
|
||||
ConfigSetting("VendorBugChecksEnabled", SETTING(g_Config, bVendorBugChecksEnabled), true, CfgFlag::DONT_SAVE),
|
||||
ConfigSetting("UseGeometryShader", SETTING(g_Config, bUseGeometryShader), false, CfgFlag::PER_GAME),
|
||||
ConfigSetting("SkipBufferEffects", SETTING(g_Config, bSkipBufferEffects), false, CfgFlag::PER_GAME | CfgFlag::REPORT),
|
||||
ConfigSetting("DisableRangeCulling", SETTING(g_Config, bDisableRangeCulling), false, CfgFlag::PER_GAME | CfgFlag::REPORT),
|
||||
ConfigSetting("DepthRasterMode", SETTING(g_Config, iDepthRasterMode), &DefaultDepthRaster, CfgFlag::PER_GAME | CfgFlag::REPORT),
|
||||
ConfigSetting("SoftwareRenderer", SETTING(g_Config, bSoftwareRendering), false, CfgFlag::PER_GAME),
|
||||
ConfigSetting("SoftwareRendererJit", SETTING(g_Config, bSoftwareRenderingJit), true, CfgFlag::PER_GAME),
|
||||
|
||||
@@ -291,7 +291,6 @@ public:
|
||||
|
||||
// Speedhacks (more will be moved here):
|
||||
bool bSkipBufferEffects;
|
||||
bool bDisableRangeCulling;
|
||||
int iDepthRasterMode;
|
||||
|
||||
int iTexFiltering; // 1 = auto , 2 = nearest , 3 = linear , 4 = auto max quality
|
||||
|
||||
@@ -411,6 +411,11 @@ ISOContainerFileBlockDevice::ISOContainerFileBlockDevice(FileLoader *fileLoader)
|
||||
|
||||
SequentialHandleAllocator alloc;
|
||||
ISOFileSystem iso(&alloc, outerBlockDevice_);
|
||||
if (!iso.Error().empty()) {
|
||||
errorString_ = iso.Error();
|
||||
outerBlockDevice_.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
PSPFileInfo layer0Info = iso.GetFileInfo("/USER_L0.IMG");
|
||||
if (!layer0Info.exists) {
|
||||
|
||||
@@ -154,8 +154,17 @@ ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, std::shared_ptr<BlockDev
|
||||
hAlloc = _hAlloc;
|
||||
|
||||
VolDescriptor desc;
|
||||
if (!blockDevice->ReadBlock(16, (u8*)&desc))
|
||||
if (!blockDevice->ReadBlock(16, (u8*)&desc)) {
|
||||
// TODO: This is kinda wacky.
|
||||
blockDevice->NotifyReadError();
|
||||
errorString_ = "ISO: error reading volume descriptor";
|
||||
return;
|
||||
}
|
||||
|
||||
if (memcmp(desc.cd001, "CD001", 5)) {
|
||||
errorString_ = "ISO: missing CD001 signature";
|
||||
return;
|
||||
}
|
||||
|
||||
entireISO.name.clear();
|
||||
entireISO.isDirectory = false;
|
||||
@@ -172,11 +181,6 @@ ISOFileSystem::ISOFileSystem(IHandleAllocator *_hAlloc, std::shared_ptr<BlockDev
|
||||
treeroot->parent = NULL;
|
||||
treeroot->valid = false;
|
||||
|
||||
if (memcmp(desc.cd001, "CD001", 5)) {
|
||||
ERROR_LOG(Log::FileSystem, "ISO looks bogus, expected CD001 signature not present? Giving up...");
|
||||
return;
|
||||
}
|
||||
|
||||
treeroot->startsector = desc.root.firstDataSector;
|
||||
treeroot->dirsize = desc.root.dataLength;
|
||||
}
|
||||
|
||||
@@ -58,6 +58,8 @@ public:
|
||||
void Describe(char *buf, size_t size) const override { snprintf(buf, size, "ISO"); } // TODO: Ask the fileLoader about the origins
|
||||
|
||||
std::shared_ptr<BlockDevice> GetBlockDevice() override { return blockDevice; }
|
||||
|
||||
const std::string &Error() const { return errorString_; }
|
||||
private:
|
||||
struct TreeEntry {
|
||||
~TreeEntry();
|
||||
@@ -91,12 +93,13 @@ private:
|
||||
|
||||
typedef std::map<u32, OpenFileEntry> EntryMap;
|
||||
EntryMap entries;
|
||||
IHandleAllocator *hAlloc;
|
||||
TreeEntry *treeroot;
|
||||
IHandleAllocator *hAlloc = nullptr;
|
||||
TreeEntry *treeroot = nullptr;
|
||||
std::shared_ptr<BlockDevice> blockDevice;
|
||||
mutable u32 lastReadBlock_;
|
||||
mutable u32 lastReadBlock_ = 0;
|
||||
|
||||
TreeEntry entireISO;
|
||||
TreeEntry entireISO{};
|
||||
std::string errorString_;
|
||||
|
||||
void ReadDirectory(TreeEntry *root) const;
|
||||
const TreeEntry *GetFromPath(std::string_view path, bool catchError = true);
|
||||
|
||||
@@ -492,9 +492,6 @@ void GameSettingsScreen::CreateGraphicsSettings(UI::ViewGroup *graphicsSettings)
|
||||
});
|
||||
skipBufferEffects->SetDisabledPtr(&g_Config.bSoftwareRendering);
|
||||
|
||||
CheckBox *disableCulling = graphicsSettings->Add(new CheckBox(&g_Config.bDisableRangeCulling, gr->T("Disable culling")));
|
||||
disableCulling->SetDisabledPtr(&g_Config.bSoftwareRendering);
|
||||
|
||||
static const char *skipGpuReadbackModes[] = { "No", "Skip", "Copy to texture" };
|
||||
|
||||
PopupMultiChoice *skipGPUReadbacks = graphicsSettings->Add(new PopupMultiChoice(&g_Config.iSkipGPUReadbackMode, gr->T("Skip GPU Readbacks"), skipGpuReadbackModes, 0, ARRAY_SIZE(skipGpuReadbackModes), I18NCat::GRAPHICS, screenManager()));
|
||||
|
||||
+2
-2
@@ -1156,8 +1156,8 @@ void NativeFrame(GraphicsContext *graphicsContext) {
|
||||
g_breakpoints.Frame();
|
||||
|
||||
// Apply the UIContext bounds as a 2D transformation matrix.
|
||||
// NOTE: We compensate for the Y convention in the shaders, so we can use the same matrices in all backends.
|
||||
Matrix4x4 ortho = ComputeOrthoMatrix(g_display.dp_xres, g_display.dp_yres, g_draw->GetDeviceCaps().coordConvention, false);
|
||||
// NOTE: We compensate for the Y and Z conventions in the shaders, so we can use the same matrices in all backends.
|
||||
Matrix4x4 ortho = ComputeOrthoMatrix(g_display.dp_xres, g_display.dp_yres, g_draw->GetDeviceCaps().coordConvention);
|
||||
|
||||
// Can be overridden by sceDisplay which may pass true for the second argument.
|
||||
g_frameTiming.ComputePresentMode(g_draw, false);
|
||||
|
||||
@@ -73,7 +73,7 @@ void ImGui_ImplThin3d_RenderDrawData(ImDrawData* draw_data, Draw::DrawContext *d
|
||||
viewport.MaxDepth = 1.0f;
|
||||
draw->SetViewport(viewport);
|
||||
|
||||
Lin::Matrix4x4 mtx = ComputeOrthoMatrix(draw_data->DisplaySize.x, draw_data->DisplaySize.y, draw->GetDeviceCaps().coordConvention, true);
|
||||
Lin::Matrix4x4 mtx = ComputeOrthoMatrix(draw_data->DisplaySize.x, draw_data->DisplaySize.y, draw->GetDeviceCaps().coordConvention);
|
||||
|
||||
Draw::VsTexColUB ub{};
|
||||
memcpy(ub.WorldViewProj, mtx.getReadPtr(), sizeof(Lin::Matrix4x4));
|
||||
|
||||
@@ -780,15 +780,6 @@ static void check_variables(CoreParameter &coreParam)
|
||||
g_Config.bSkipBufferEffects = true;
|
||||
}
|
||||
|
||||
var.key = "ppsspp_disable_range_culling";
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
{
|
||||
if (!strcmp(var.value, "disabled"))
|
||||
g_Config.bDisableRangeCulling = false;
|
||||
else
|
||||
g_Config.bDisableRangeCulling = true;
|
||||
}
|
||||
|
||||
var.key = "ppsspp_skip_gpu_readbacks";
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
{
|
||||
|
||||
@@ -517,16 +517,6 @@ struct retro_core_option_v2_definition option_defs_us[] = {
|
||||
BOOL_OPTIONS,
|
||||
"disabled"
|
||||
},
|
||||
{
|
||||
"ppsspp_disable_range_culling",
|
||||
"Disable Culling",
|
||||
NULL,
|
||||
"",
|
||||
NULL,
|
||||
"hacks",
|
||||
BOOL_OPTIONS,
|
||||
"disabled"
|
||||
},
|
||||
{
|
||||
"ppsspp_skip_gpu_readbacks",
|
||||
"Skip GPU Readbacks",
|
||||
|
||||
Reference in new issue
Block a user