QT Frontend: Add disk shader loading progress bar

Until we get a on screen display or async shader loading, we should at
least have some measure of progress in the meantime. This is 90% a port
from the loading screen I made for yuzu, but with a slightly different
changed detection for when to display the ETA. Now we keep track of a
rolling estimate for shader load ETA and only display a ETA if its going
to take longer than 10 seconds.
This commit is contained in:
James Rowe 2020-01-21 18:48:07 -07:00
parent c0df8271bf
commit 961a7b59c9
8 changed files with 542 additions and 6 deletions

View file

@ -23,6 +23,10 @@ class QOpenGLContext;
class GMainWindow;
class GRenderWindow;
namespace VideoCore {
enum class LoadCallbackStage;
}
class GLContext : public Frontend::GraphicsContext {
public:
explicit GLContext(QOpenGLContext* shared_context);
@ -116,6 +120,8 @@ signals:
void DebugModeLeft();
void ErrorThrown(Core::System::ResultStatus, std::string);
void LoadProgress(VideoCore::LoadCallbackStage stage, std::size_t value, std::size_t total);
};
class OpenGLWindow : public QWindow {
@ -188,6 +194,11 @@ signals:
/// Emitted when the window is closed
void Closed();
/**
* Emitted when the guest first calls SwapBuffers. This is used to hide the loading screen
*/
void FirstFrameDisplayed();
private:
std::pair<u32, u32> ScaleTouch(QPointF pos) const;
void TouchBeginEvent(const QTouchEvent* event);
@ -212,6 +223,7 @@ private:
/// Temporary storage of the screenshot taken
QImage screenshot_image;
bool first_frame = false;
protected:
void showEvent(QShowEvent* event) override;