Commit Graph

256 Commits

Author SHA1 Message Date
Stenzek c9c0b85056 VideoBackends: Store a backbuffer 'scale'
This is a scaling factor, used for hi-dpi configurations.
2019-01-25 11:15:57 +10:00
Stenzek 36ce47635b RenderWidget: Hook up to ImGui 2019-01-25 11:15:57 +10:00
Stenzek 600d1fc0bc Renderer: Use imgui for drawing debug text and OSD 2019-01-25 11:15:57 +10:00
Stenzek d1868d9475 RenderBase: Implement imgui rendering 2019-01-25 11:10:49 +10:00
Connor McLaughlin 0da5929226
Merge pull request #7626 from weihuoya/vulkan-oom
Always clean cache on render swap
2019-01-08 21:57:25 +10:00
weihuoya 66a7db3850 Always flush on swap 2019-01-08 18:28:59 +08:00
JosJuice a8e5f2b922
Merge pull request #7230 from ligfx/remove_clamp_draw_size
RenderBase: don't clamp draw size to window
2019-01-03 18:26:41 +01:00
Stenzek 2644e920cc Renderer: Add backbuffer format to base class 2018-12-04 17:36:08 +10:00
Stenzek 1adcd47dcb Renderer: Add a base Initialize() method to match Shutdown() 2018-12-04 17:36:08 +10:00
Stenzek 38479dd783 RenderBase: Force a pipeline flush when drawing the XFB to the host
Since we use the common pipelines here and draw vertices if a batch is
currently being built by the vertex loader, we end up trampling over its
pointer, as we share the buffer with the loader, and it has not been
unmapped yet. Force a pipeline flush to avoid this.
2018-12-04 17:36:08 +10:00
JosJuice a42432cae4 RenderBase: Set m_aspect_wide on start
It doesn't feel great to let the value from a previous emulation session
linger around considering that the GC aspect ratio heuristic can use
the previous value of m_aspect_wide when calculating m_aspect_wide.
2018-11-07 19:01:45 +01:00
JosJuice b93b7ec419 Fix the widescreen hack for Wii games with 4:3 forced in game INI 2018-11-07 19:00:24 +01:00
Stenzek 8e2c063d62 TextureCache: Implement deferred/batched EFB copies 2018-11-07 16:25:01 +10:00
Pierre Bourdon 83c3370c2a RenderBase: send performance sample at every end of frame
Not the best integration point, but couldn't think of something better.
This implementation has the benefit to be super simple.
2018-10-27 17:39:54 +02:00
Stenzek 1d827a5223 Renderer: Pull dimensions from GLInterface/Swapchain 2018-10-20 21:11:34 +10:00
Stenzek a3961750a7 Drop Host_GetRenderSurface and pass display to backend 2018-10-20 21:11:34 +10:00
Admiral H. Curtiss d97bc0d359 Correctly adjust the rendered XFB region at non-native internal resolutions when XFB was loaded from console RAM.
If, for whatever reason, the XFB has to be loaded from console memory, it's possible that the texture is returned at native resolution instead of EFB-scaled resolution. In this case, our xfb_rect.right adjustment must also happen at native resolution instead of scaled resolution.
2018-09-13 19:39:49 +02:00
Michael M 2a30e64974 RenderBase: don't clamp draw size to window
It distorts the aspect ratio when cropping, rather than actually cropping.
2018-07-07 13:32:10 -07:00
Techjar 25bfee2233 VideoCommon: Fix auto IR being very overzealous 2018-06-25 00:48:57 -04:00
master0fdisaster 7a90ea2752 Add OSD message for Volume Hotkeys
This pr adds an OnScreenDisplay message when you use the Volume hotkeys.
Just to have visual feedback.
2018-06-06 17:11:43 +02:00
Markus Wick c267262a66
Merge pull request #6786 from stenzek/crop-negative-y
RenderBase: Ensure the draw size does not exceed the window size
2018-05-13 08:55:59 +02:00
spycrab 16e2ac9257 VideoCommon/RenderBase: Refactor OSD messages 2018-05-11 18:24:08 +02:00
Stenzek fd5aaa096c RenderBase: Ensure the draw size does not exceed the window size
This was happening when crop was enabled, causing blank outputs for some
Vulkan drivers (namely radv), as the draw rectangle is used as the
viewport.
2018-05-08 23:19:38 +10:00
Stenzek 9e798eec94 Implement EFB copy filter and gamma in hardware backends
Also makes y_scale a dynamic parameter for EFB copies, as it doesn't
make sense to keep it as part of the uid, otherwise we're generating
redundant shaders.
2018-04-29 19:05:20 +10:00
Stenzek 2687c55cf6 Renderer: Only recreate frame dump texture if dimensions differ
This was a typo, been around for a while. == should be !=. May improve
frame dumping performnace slightly, but I doubt much if any.
2018-04-02 01:15:48 +10:00
Lioncash 50a476c371 Assert: Uppercase assertion macros
Macros should be all upper-cased. This is also kind of a wart that's
been sticking out for quite a while now (we avoid prefixing
underscores).
2018-03-14 22:03:12 -04:00
Stenzek f9c829c7f7 OGL: Re-implement async shader compiling 2018-03-10 15:56:34 +10:00
Stenzek dec0c3bce8 Move shader caches to VideoCommon 2018-03-10 15:56:30 +10:00
Stenzek 4c24a69710 VideoCommon: Add support for Abstract Framebuffers 2018-03-02 20:20:48 +10:00
Stenzek 6374a4c4a8 AbstractTexture: Support multisampled abstract texture 2018-03-01 17:31:24 +10:00
Stenzek de632fc9c8 Renderer: Handle resize events on-demand instead of polling
We now differentiate between a resize event and surface change/destroyed
event, reducing the overhead for resizes in the Vulkan backend. It is
also now now safe to change the surface multiple times if the video thread
is lagging behind.
2018-02-20 01:15:55 +10:00
Stenzek 5359396099 BPFunctions: Move GX viewport conversion to VideoCommon 2018-02-20 00:49:32 +10:00
Anthony 096131c908
Merge pull request #6334 from stenzek/startup
Video Backend Initialization/Core Boot Improvements
2018-02-07 23:35:54 -08:00
Stenzek fe5150cc31
Merge pull request #6303 from TraceBullet/auto-adjust-window-size
Fix Auto-Adjust Window Size option making the window too large
2018-01-29 17:28:44 +10:00
Stenzek d96e8c9d76 VideoBackends: Combine Initialize/Prepare and Cleanup/Shutdown methods
Also allows the work previously done in Prepare to return a failure
status.
2018-01-27 13:53:55 +10:00
TraceBullet ab6f932347 Fix Auto-Adjust Window Size option making the window too large 2018-01-26 10:47:19 -05:00
Stenzek 3f197480ef Renderer: Fix crash on shutdown when frame dumping or taking screenshots 2018-01-26 12:12:00 +10:00
JosJuice a2404c42a1 Treat invalid aspect ratio setting values as Auto 2018-01-06 12:53:53 +01:00
iwubcode 2f7eacd08c Video Common: move frame advance and counter logic to only happen when we actually render a frame. 2017-12-15 12:46:18 -06:00
Stenzek cd68b3606c
Merge pull request #6193 from stenzek/readbacks
Abstract Staging Textures - VideoCommon interface for texture readbacks/uploads
2017-12-01 14:24:06 +10:00
Stenzek 32125cf181 OGL: Fix headless frame dumping
Also skips swapping the window system buffers in headless mode, as there
may not be a surface which can be swapped in the first place. Instead,
we call glFlush() at the end of a frame in this case.
2017-11-23 16:53:55 +10:00
Stenzek 6577365851 VideoCommon: Re-implement asynchronous frame dumping
This was lost as a result of hybrid XFB, now it is back, and ~10%
faster in very brief testing.
2017-11-22 18:49:33 +10:00
Stenzek 56afebeb44 AbstractTexture: Seperate CopyRectangleFromTexture to two methods
ScaleRectangleFromTexture, which does a draw, and
CopyRectangleFromTexture, which where possible, does a bit-for-bit copy.
2017-11-22 18:47:04 +10:00
Stenzek 49a9c33bd7 VideoCommon: Move abstract texture creation function to Renderer 2017-11-22 18:47:04 +10:00
Stenzek 8985cb2f0b Renderer: Re-implement window size frame dumping
This was broken by hybrid XFB, and all frame dumping/screenshots occured
at the full internal resolution.
2017-11-21 17:19:43 +10:00
Lioncash 5337e58284 VideoConfig: Make StereoMode an enum class
Makes for more strongly-typed identifiers (and doesn't pollute
surrounding namespaces)
2017-11-18 23:19:53 -05:00
Lioncash 10697bcbe3 VideoConfig: Make AspectMode an enum class
Makes for more strongly-typed identifiers (and doesn't pollute
surrounding namespaces)
2017-11-18 23:17:56 -05:00
iwubcode 7248dd47d5 Hybrid XFB: Fix lint errors 2017-11-17 22:11:32 -06:00
iwubcode 74610646ce TextureCacheBase: Add XFB specific functions 2017-11-17 22:11:32 -06:00
iwubcode 4964fc87ae Video Backends: Remove the right of the xfb region for games where the
VI stride does not match the VI width
2017-11-17 22:11:32 -06:00
iwubcode a129a53e56 Video Common: Improve texture dumping to work with fifoci and
fifo_comparer
2017-11-17 22:11:32 -06:00
iwubcode 53684701fa HybridXFB: Fix lint errors 2017-11-17 22:11:31 -06:00
iwubcode 65418a76f5 Video Common: Use correct aspect ratio when saving screenshots / video 2017-11-17 22:11:31 -06:00
iwubcode e6d85b0915 Video Common: Avoid 'presenting' duplicate frames by detecting when swap
hasn't changed since the last frame
2017-11-17 22:11:31 -06:00
iwubcode 2295d60fdc VideoCommon: Output gamma now comes from the xfb copy 2017-11-17 22:11:30 -06:00
iwubcode 7f0834c919 Add 'immediate xfb' which reduces xfb latency at the cost of graphical errors 2017-11-17 22:11:30 -06:00
iwubcode e33ab4117d Video Common: Make auto IR work with HybridXFB 2017-11-17 22:11:30 -06:00
iwubcode 33bc286baa Remove old XFB logic 2017-11-17 22:11:29 -06:00
iwubcode 081b92b8a7 Video Common: Only update FPS when frame is renderered which yields more
accurate results
2017-11-17 22:11:29 -06:00
iwubcode b285188de1 Video Backends: Implement vertical scaling for xfb copies. This fixes the
display of PAL games that run in 50hz mode.
2017-11-17 22:11:29 -06:00
iwubcode 65cd085f9b Add new GUI option to skip XFBToRam and remove old XFB options 2017-11-17 22:11:28 -06:00
iwubcode a9f0d1783b Support frame and video dumping from VideoCommon 2017-11-17 22:11:23 -06:00
iwubcode 79387dddb2 Add support for hybrid XFB 2017-11-17 19:47:56 -06:00
JosJuice a310cbec8e Fix incorrect handling of auto IR
Some lines of code in Dolphin just plainly grabbed the value of
g_ActiveConfig.iEFBScale, which resulted in Auto being treated as
0x rather than the actual automatically selected scale.
2017-11-03 16:04:46 +01:00
Chris Burgener cc03e49024 Remove FFMPEG check for Renderer::IsFrameDumping() 2017-08-24 11:15:50 -04:00
Léo Lam b2c41cec0a Config: Include SYSCONF in base layer
Settings that come from the SYSCONF are now included in Dolphin's
config system as part of the base layer. They are handled in a
special way compared to other settings to make sure they are only
loaded from and saved to the SYSCONF (to avoid different, possibly
contradicting sources of truth).
2017-08-11 15:36:31 +08:00
JosJuice f090a94319 Remove non-integer IRs 2017-08-08 12:09:50 +02:00
Stenzek 621287e7eb VideoCommon: Improve precision of FPS counter 2017-07-30 12:38:48 +10:00
Stenzek 3ea9d86faa ShaderGen: Pass host config to shader generation functions
Also moves the host config checks to common.
2017-07-20 17:54:33 +10:00
shuffle2 98eb192226 Merge pull request #5312 from ligfx/cleanupupdatedrawrectangle
RenderBase: clean up UpdateDrawRectangle
2017-06-05 20:03:56 -07:00
Michael Maltese 3ca03373ae MSVC: define HAVE_FFMPEG 2017-05-26 00:53:58 -07:00
Michael Maltese 53acd25de4 Rename define HAVE_LIBAV->HAVE_FFMPEG 2017-05-26 00:53:58 -07:00
Michael Maltese 3158a5bc35 RenderBase: clean up UpdateDrawRectangle 2017-04-24 00:39:25 -07:00
Markus Wick 4e90c5da8b Merge pull request #5234 from lioncash/tuple
RenderBase: Return tuples from CalculateTargetScale and ConvertStereoRectangle instead of using out parameters
2017-04-11 10:27:16 +02:00
Scott Mansell e6476b805e Merge pull request #5008 from ligfx/aspectheuristic
VideoCommon: rework anamorphic widescreen heuristic
2017-04-10 11:30:34 +12:00
Lioncash c7ab6861c2 RenderBase: Return a tuple from ConvertStereoRectangle instead of using out parameters 2017-04-09 15:11:59 -04:00
Lioncash 671b5f9747 RenderBase: Return a tuple from CalculateTargetScale instead of using out parameters 2017-04-09 14:41:51 -04:00
Lioncash cc803db042 RenderBase: Eliminate renderer global accesses within the Renderer class
There's no need to access these globals, the instance itself has access
to these data members and functions.
2017-04-08 20:15:39 -04:00
Lioncash caf25653d8 RenderBase: const correctness 2017-04-08 20:11:29 -04:00
Michael Maltese d10d09ccc1 VideoCommon: rework anamorphic widescreen heuristic
Some widescreen hacks (see below) properly force anamorphic output, but
don't make the last projection in a frame 16:9, so Dolphin doesn't
display it correctly.

This changes the heuristic code to assume a frame is anamorphic based on
the total number of vertex flushes in 4:3 and 16:9 projections that
frame. It also adds a bit of "aspect ratio inertia" by making it harder
to switch aspect ratios, which takes care of aspect ratio flickering
that some games / widescreen hacks would be susceptible with the new
logic.

I've tested this on SSX Tricky's native anamorphic support, Tom Clancy's
Splinter Cell (it stayed in 4:3 the whole time), and on the following
widescreen hacks for which the heuristic doesn't currently work:

Paper Mario: The Thousand-Year Door (Gecko widescreen code from Nintendont)
C202F310 00000003
3DC08042 3DE03FD8
91EEF6D8 4E800020
60000000 00000000
04199598 4E800020
C200F500 00000004
3DE08082 3DC0402B
61CE12A2 91CFA1BC
60000000 387D015C
60000000 00000000
C200F508 00000004
3DE08082 3DC04063
61CEE8D3 91CFA1BC
60000000 7FC3F378
60000000 00000000

The Simpsons: Hit & Run (AR widescreen code from the wiki)
04004600 C002A604
04004604 C09F0014
04004608 FC002040
0400460C 4082000C
04004610 C002A608
04004614 EC630032
04004618 48220508
04041A5C 38600001
04224344 C002A60C
04224B1C 4BDDFAE4
044786B0 3FAAAAAB
04479F28 3FA33333
2017-04-05 17:23:16 -07:00
Jules Blok 0a2b58c896 OGL: Remove support for NV_depth_buffer_float.
We can't clamp the depth values to the 24-bit range while this extension is active.
2017-03-14 01:02:13 +01:00
Markus Wick e99cd57eb3 Merge pull request #4935 from Armada651/depth-range-fix
VideoBackends: Set the maximum range when the depth range is oversized.
2017-03-10 18:05:52 +01:00
Jules Blok 3f41e6d4cf RenderBase: Check if early ztest is enabled before falling back to vertex depth range. 2017-03-10 15:43:32 +01:00
Stenzek 2cd240af0d VideoBackends: Move max texture size to VideoConfig
This stops the virtual method call from within the Renderer constructor.

The initialization here for GL had to be moved to VideoBackend, as the
Renderer constructor will not have been executed before the value is
required.
2017-03-10 00:04:13 +10:00
Stenzek 4012166085 VideoCommon: Fix crash at startup with virtual XFB enabled 2017-03-09 23:39:48 +10:00
Stenzek 459a5ab554 Android: Move screenshot waiting logic to Renderer 2017-03-04 16:53:16 +10:00
Stenzek 811eafda57 VideoCommon: Store last window request width/height
This avoids the need to send a window resize event every frame.
2017-03-04 16:53:12 +10:00
Stenzek 00a0a91513 VideoCommon: Move last EFB scale handling to CalculateTargetSize 2017-03-04 16:53:07 +10:00
Stenzek afc25fdca0 VideoCommon: Rename Renderer s_ prefixes to m_ 2017-03-04 16:42:21 +10:00
Stenzek 238a70b006 VideoCommon: Move some common initialization logic to RenderBase 2017-03-04 16:42:16 +10:00
Stenzek 277829d842 VideoCommon: Eliminate static state in Renderer 2017-03-04 16:39:50 +10:00
Jules Blok a15555fe03 VideoBackends: Use vertex shader depth range if ztexture is used. 2017-02-26 11:34:48 +01:00
Lioncash c85e0a2586 FramebufferManagerBase: Return a std::pair from GetTargetSize
Keeps associated data together. It also eliminates the possibility of out
parameters not being initialized properly. For example, consider the
following example:

-- some FramebufferManager implementation --

void FBMgrImpl::GetTargetSize(u32* width, u32* height) override
{
  // Do nothing
}

-- somewhere else where the function is used --

u32 width, height;
framebuffer_manager_instance->GetTargetSize(&width, &height);

if (texture_width != width) <-- Uninitialized variable usage
{
  ...
}

It makes it much more obvious to spot any initialization issues, because
it requires something to be returned, as opposed to allowing an
implementation to just not do anything.
2017-02-03 15:27:53 -05:00
Lioncash 1f24cf2a2d RenderBase: Get rid of unnecessary casts 2017-01-31 20:25:50 -05:00
Admiral H. Curtiss b2c40bf4c4 RenderBase: Let the Auto Adjust Window Size option request the final image size rather than the raw framebuffer size. 2017-01-28 11:40:53 +01:00
Admiral H. Curtiss e1fa6c374f RenderBase: Extract the framebuffer size to display size code into function. 2017-01-28 11:40:53 +01:00
Stenzek 5f3c878ba2 FifoPlayer: Save/restore texture memory state for fifo logs 2017-01-03 21:16:05 +10:00
Lioncash 58a5395173 TextureCacheBase: Eliminate static state 2016-12-09 16:50:37 -05:00
Stenzek adc22a5e20 VideoCommon: Add method for calculating full-scale framedump rectangles 2016-11-28 21:54:54 +10:00
Stenzek 6db0ee9561 VideoCommon: Remove backbuffer size parameters from methods
We have the s_backbuffer_{width,height} fields to represent this, so
there's no point in passing them as parameters every time.
2016-11-28 20:14:59 +10:00