Commit Graph

3564 Commits

Author SHA1 Message Date
Jonathan Hamilton 8d68adcaf3 Workaround qualcomm driver bug
It seems it doesn't like modifying inout variables in place - so instead
use a temporary for ocol0/ocol1 and only write them once at the end of
the shader
2018-01-05 09:56:46 -08:00
Jonathan Hamilton 29a9ed043b Implement dual-source blending in shader
For some GLES drivers that don't support dual-source blending, but do
support GL_EXT_shader_framebuffer_fetch, this might be useful.
2018-01-05 09:56:46 -08:00
Vlad Firoiu 330881ae80 Allow users to specify the encoder used for framedumping. 2018-01-03 13:23:10 +01:00
Sepalani 44935c23e0 MAX_XFB_HEIGHT: PAL value off by two fixed 2017-12-30 20:22:10 +01:00
iwubcode 50d96a4411 BPStructs: Use static cast for XFB/EFB copies 2017-12-21 21:19:26 -06:00
iwubcode e1332b1d7e Texture Cache Base: Move PAL vertical scaling to be baked into the texture size. This saves on a number of multiplications and fixes an issue where we were multiplying the y-scaling factor by the srcRectangle's height + 1 which was causing a crash in some GC titles 2017-12-21 21:19:26 -06:00
JosJuice a3355a3e4a Only use the "Scaled EFB Copy" setting for EFB, not XFB
The hybrid XFB PR made it apply to both EFB copies and XFB copies.
2017-12-19 12:59:36 +01:00
Emmanuel Gil Peyrot d9c2de90c0 Reimplement EFB copy for intensity formats
This is the direct continuation of #5887, and removes the last usage of
the colmat matrix in EFB copy conversion shaders.
2017-12-19 12:04:56 +01:00
Markus Wick 0bf24f549a
Merge pull request #6190 from JosJuice/is-trivially-copyable-vs
Remove IsTriviallyCopyable hack for VS
2017-12-19 11:15:58 +01:00
Markus Wick 5afd07c033
Merge pull request #6254 from iwubcode/frame_counter_and_advance_fix
Video Common: frame logic fix
2017-12-19 09:44:49 +01:00
JosJuice 4973ae9952 Rename GFX_HACK_COPY_EFB_ENABLED to GFX_HACK_COPY_EFB_SCALED
Not sure why it was named like this... It doesn't affect whether
the copy happens or not, only what resolution it uses.
2017-12-18 21:55:02 +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
Jonathan Hamilton a38103afbf Fix GLES GPU texture conversion shader
GLES doesn't support C-style array initialisers, so stuff like:

Type var[2] = {
VALUE_A,
VALUE_B
};

isn't supported in GLES (it was added in
GL_ARB_shading_language_420pack).

The texture conversion shader used this, so would fail to compile on
GLES.
2017-12-12 22:01:10 +00:00
Markus Wick a70c03a1c0
Merge pull request #6249 from stenzek/texture-dump
Texture dumping regression fixes
2017-12-11 08:44:09 +01:00
Jonathan Hamilton e401004766 Fix an invalid (uint < int) comparison in GLES with ubershaders 2017-12-10 10:52:32 -08:00
Stenzek 2579f8eaa5 TextureCache: Don't dump custom textures
They don't have a basename, therefore were being saved to empty files, and potentially can be compressed.
2017-12-10 15:31:46 +10:00
Leo Lam ecf30cfc74
Merge pull request #6240 from JosJuice/stream-path-encoding
Don't use wrong encoding for paths when opening streams on Windows
2017-12-07 10:04:55 +01:00
degasus 02dd062518 VideoCommon: Drop now unused efb2tex matrix generation. 2017-12-06 09:30:03 +01:00
JosJuice 9d8a82e1d9 Don't use wrong encoding for paths when opening streams on Windows 2017-12-05 21:23:35 +01:00
Stenzek d0601c0a83 TextureConversionShader: Use round() instead of roundEven() in HLSL
HLSL does not define roundEven(), only round(). This means that the
output may differ slightly for OpenGL vs Direct3D. However, it ensures
consistency across OpenGL drivers, as round() in GLSL can go either way.
2017-12-06 03:33:50 +10:00
Stenzek beb35320f6 TextureConverterShaderGen: Make generated shaders HLSL-compatible 2017-12-06 03:33:50 +10:00
Markus Wick 8bcc392d5d
Merge pull request #5887 from linkmauve/alpha-fix
Simplify EFB copy shaders
2017-12-03 11:21:08 +01:00
Léo Lam 67ba326ff6 VideoCommon: Fix -Wformat warnings 2017-12-02 21:48:01 +01:00
Emmanuel Gil Peyrot 85bb1d7bb0 VideoCommon: Reimplement texture format conversion
This fixes the rendering of the scan visor in Metroid Prime 2: Echoes,
as seen in https://fifoci.dolphin-emu.org/dff/mp2-scanner/

The alpha channel was off-by-one on Ivy Bridge due to the rounding
after multiplication with colmat.  This commit removes this matrix
altogether in most cases, making them simple GLSL swizzles.
2017-12-02 19:29:01 +01:00
Markus Wick 76fbdbb06e
Merge pull request #5903 from linkmauve/fix-mp2e
Round values in swizzlers
2017-12-02 17:38:21 +01:00
degasus e2a9ee384f VideoCommon: Rename TextureConversionShader namespace. 2017-12-02 15:17:39 +01:00
degasus e8febd0cef VideoCommon: Create a namespace for TextureConversionShaderGen. 2017-12-02 15:17:39 +01:00
Markus Wick 491c10ec96 VideoBackends: Use VideoCommon shader generators for efb2tex copies.
This will generate one shader per copy format. For now, it is the same
shader with the colmat hard coded. So it should already improve the GPU
performance a bit, but a rewrite of the shader generator is suggested.

Half of the patch is done by linkmauve1:
VideoCommon: Reorganise the shader writes.
2017-12-02 15:17:39 +01: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
Markus Wick 96e094e127
Merge pull request #6216 from stenzek/headless-frame-dumping
OGL: Fix headless frame dumping
2017-11-26 11:36:10 +01:00
Jules Blok 7dd207931d UberShaderPixel: Fix the interpolation qualifier for interface blocks.
Fixes MSAA on MacOS with ubershaders enabled.
2017-11-25 21:51:14 +01: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 db1d9de933 AbstractTexture: Drop slow map readback path 2017-11-22 18:49:33 +10:00
Stenzek 193763ca3a TextureCacheBase: Don't crop last row/column of XFB copies
Unsure why this was happening in the first place.
2017-11-22 18:49:33 +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 c2cc128f1b AbstractTexture: Implement Save using new common methods 2017-11-22 18:47:04 +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 f43d85921d VideoBackends: Add AbstractStagingTexture class
Can be used for asynchronous readback or upload of textures.
2017-11-22 18:47:04 +10:00
Stenzek a584ccc7d8 AbstractTexture: Support BGRA8 formats
Used for some driver's swap chains, and EFB to RAM.
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
Leo Lam 73a67aa413
Merge pull request #6204 from stenzek/downscaled-screenshots
Frame Dumping: Fix window-size framedumping
2017-11-22 07:53:23 +01:00
Stenzek efb9759862 LightingShaderGen: Always calculate lighting for both color channels
Cel-damage uses the color from the lighting stage of the vertex pipeline
as texture coordinates, but sets numColorChans to zero.

We now calculate the colors in all cases, but override the color before
writing it from the vertex shader if numColorChans is set to a lower value.
2017-11-22 01:52:18 +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
Stenzek 39559f6358 VideoConfig: Remove bSupportsInternalResolutionFrameDumps
Field is unused as of Hybrid XFB.
2017-11-21 17:19:43 +10:00
Stenzek 18c1bf19ca VideoCommon: Use constant for number of color channels in XFMemory 2017-11-20 23:18:44 +10:00
Leo Lam 80bcc0d58d
Merge pull request #6186 from lioncash/enum-class
VideoConfig: Make AspectMode and StereoMode enum classes
2017-11-19 15:08:16 +01:00
JosJuice 2ead31c769
Merge pull request #6203 from lioncash/missing-braces-warn
VideoCommon: Resolve -Wmissing-brace warnings
2017-11-19 08:45:13 +01:00
JosJuice 2385a03c2b
Merge pull request #6201 from lioncash/headers
VideoBackends: Remove header inclusions made unnecessary with Hybrid XFB
2017-11-19 08:44:48 +01:00
Lioncash 518f6a3624 VideoCommon: Resolve -Wmissing-brace warnings
Resolves around 5 -Wmissing-brace warnings on macOS.
2017-11-19 01:49:39 -05:00
Lioncash 2bd88bdb9f AbstractTexture: Remove a redundant constructor initializer list entry
This is already initialized in the class definition. This would
previously cause a -Wreorder warning on macOS, as m_config is
defined after m_currently_mapped.
2017-11-19 01:25:55 -05:00
Lioncash 364eaadfe5 VideoBackends: Remove header inclusions made unnecessary with Hybrid XFB
Just some inclusions that weren't removed in the initial Hybrid XFB PR.
2017-11-19 00:53:10 -05: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 dd54617a08 TextureCacheBase: Set uninitialized XFB memory to fuchsia color 2017-11-17 22:11:34 -06:00
iwubcode 8d1cbeb25e Hybrid XFB: Fix lint errors 2017-11-17 22:11:34 -06:00
iwubcode 61541ab243 Enhance xfb dumping to distinguish between the xfbs created from memory and the xfbs created from overlapping copies 2017-11-17 22:11:34 -06:00
iwubcode 8678e8ddd3 Texture Cache Base: Optimization to allow stitched or memory xfb textures to be looked up from cache directly if they were defined previously and their hash hasn't changed 2017-11-17 22:11:33 -06:00
iwubcode 332af8aa49 TextureCacheBase: Fix issue in Rogue Squadron 2 where overlapping textures caused a hash change which would cause us to do a lookup from memory that gave us an incorrect result in XFB2Ram 2017-11-17 22:11:33 -06:00
iwubcode ada37ec642 TextureCacheBase: Remove vertical scaling from EFB path and have copy checks only check EFBs 2017-11-17 22:11:33 -06:00
iwubcode 7248dd47d5 Hybrid XFB: Fix lint errors 2017-11-17 22:11:32 -06:00
iwubcode 2c87a53f11 TextureCacheBase: make sure stitching rectangle bounds don't exceed the
texture size they are meant to represent
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 1090549552 Software Backend: Force EFB/XFB to copy to ram 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 76b775d5be Video Common: Add XFB decoding via the GPU 2017-11-17 22:11:30 -06:00
iwubcode 4d13f69dc1 Remove TODOs 2017-11-17 22:11:29 -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 5a372020ea FifoPlayer: Generate fake VideoInterface updates 2017-11-17 22:11:29 -06:00
iwubcode 2cd9565b18 Add an additional flag fo 'XFB Copy' 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 198d3b69b4 Add ability to dump xfb copies to texture for debugging purposes 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 8ad5ea2ede Call Do for every member of SCPFifoStruct individually
We need this because VS currently doesn't consider
std::is_trivially_copyable<typename
std::remove_volatile<SCPFifoStruct>::type>::value
to be true and because no compiler should consider it
to be true if we replace the volatiles with atomics.
2017-11-13 19:51:16 +01:00
Lioncash 8e654528fc VideoConfig: Add const specifier to IsVSync() member function
This member function doesn't alter VideoConfig's state.
2017-11-10 22:23:15 -05:00
Anthony 4dc425b9c9
Merge pull request #6158 from Tomcc/master
Improved arbitrary mipmap detection (Mario Sunshine water fix)
2017-11-09 18:06:58 -08:00
Tommaso Checchi aa23684d66 Improved detection: it doesn't desaturate the input anymore (woops) also it makes its own whole chain! This way it "notices" much better gradual divergences. Fixes Mario Sunshine, moss on the window in Zelda TP 2017-11-06 21:49:48 -08: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
Tommaso Checchi 5fb6ceac45 Fixed fog, lava, water in Mario Galaxy (and possibly other games) in higher IRs by detecting & fixing the mipmaps that aren't just used for downscaling, but are handmade to create a gradient. 2017-10-27 00:45:20 -07:00
Markus Wick 802fda26ab Merge pull request #6093 from endrift/fix-efb-overflow
VideoCommon: Fix overflow trying to access outside of EFB bounds
2017-10-26 21:01:27 +02:00
Leo Lam 0eafb2f2a2 Merge pull request #6110 from lioncash/texture-config-hash
TextureConfig: Specialize std::hash for TextureConfig
2017-10-11 11:07:09 +02:00
Stenzek edb5f855c2 VideoConfig: Prevent race condition on g_Config when refreshing
There was a race condition between the video thread and the host thread,
if corrections need to be made by VerifyValidity(). Briefly, the config
will contain invalid values. Instead, pause emulation first, which will
flush the video thread, update the config and correct it, then resume
emulation, after which the video thread will detect the config has
changed and act accordingly.
2017-10-10 23:56:33 +10:00
Lioncash c8af9e5f7b TextureConfig: Specialize std::hash for TextureConfig
This allows the hashing for TextureConfig instances to automatically be resolved instead of needing to directly specify it all the time.
2017-10-08 23:55:14 -04:00
Vicki Pfau e0a326a493 VideoCommon: Fix overflow trying to access outside of EFB bounds 2017-10-01 12:09:16 -07:00
Stenzek 24ddea04ce VideoBackends: Move SamplerState to common 2017-09-11 20:01:54 +10:00
Stenzek 340aabbb06 VideoCommon: Add helpers for generating common render states 2017-09-11 20:01:52 +10:00
Stenzek 836b9b9acb Renderer: Move cull mode to a rasterization state object
Also moves logic for primitive handling to VideoCommon.
2017-09-11 20:01:45 +10:00
Stenzek 2869c570f1 Renderer: Move depth state to VideoCommon and seperate from bpmem 2017-09-11 19:40:26 +10:00
Stenzek 134daf3b00 Vulkan: Extend the NVIDIA MSAA bug to render-pass based clears
Calling vkCmdClearAttachments with a partial rect, or specifying a
render area in a render pass with the load op set to clear can cause the
GPU to lock up, or raise a bounds violation. This only occurs on MSAA
framebuffers, and it seems when there are multiple clears in a single
command buffer. Worked around by back to the slow path (drawing quads)
when MSAA is enabled.
2017-09-07 17:05:43 +10:00
Stenzek b573319f8f D3D: Fix shader compile error with logicop and alpha test enabled 2017-09-07 11:48:01 +10:00
Stenzek 84f8ebd95f VideoBackends: Clear uid bits that are unused for the current backend
Currently, this is only the logic op bit, but this will be extended to
the framebuffer fetch/blend modes. In the future, when/if we move to
VideoCommon pipelines, this state will be part of the pipeline UID
anyway, and we can mask it out in the backend by using a two-level map,
so the shaders/programs are shared.
2017-09-05 23:49:42 +10:00