Commit Graph

3671 Commits

Author SHA1 Message Date
JosJuice 226b65bd38 Clean up variable naming in HiresTextures::Update 2018-01-10 17:53:51 +01:00
JosJuice c25fffc9a0 Treat custom textures with "_arb" suffix as having arbitrary mipmaps
This is adapted from Bighead's code that was posted at
https://forums.dolphin-emu.org/Thread-dolphin-custom-texture-mipmaps?pid=460867#pid460867

In master, custom textures are never treated as having arbitrary mipmaps,
so we need either a change like this or a change that makes us apply the
arbitrary mipmap heuristic even when a custom texture is used.
2018-01-10 17:51:45 +01:00
Markus Wick 22f469697b
Merge pull request #6290 from JosJuice/invalid-aspect-ratio
Treat invalid aspect ratio setting values as Auto
2018-01-08 13:46:30 +01:00
JosJuice 1557e6ab05 Specify underlying types for enums that get casted from integers
Otherwise we might get UB if the value we cast is larger than the
max value of the underlying type that the compiled picked for the enum.

I haven't done any extensive check through Dolphin to find cases
of this, I'm just fixing the cases I already know of.
2018-01-08 12:14:18 +01:00
JosJuice a2404c42a1 Treat invalid aspect ratio setting values as Auto 2018-01-06 12:53:53 +01:00
Markus Wick 56d153f548 VideoCommon: Apply the yscale as upscaling of the XFB. 2018-01-06 10:36:33 +01:00
Jonathan Hamilton ceb1f8c8cb Enable shader_framebuffer_fetch blend path on ubershaders
Tested on a linux Intel Skylake integrated graphics with
blend_func_extended force-disabled, as it's the only platform I have
that doesn't crash with ubershaders and supports fb_fetch
2018-01-05 09:56:46 -08:00
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
Stenzek 6d32cce2f5 ShaderGen: Output uint when logic op is enabled for D3D ubershaders 2017-09-05 23:49:42 +10:00
Anthony ee6930a231 Merge pull request #6013 from stenzek/d3d-logic-op
D3D: Implement logic op support
2017-09-03 19:26:50 -07:00
Anthony 26e777d80b Merge pull request #5337 from stenzek/d3d-common-blending-state
D3D: Use blending state from VideoCommon
2017-09-03 19:25:46 -07:00
Mat M edf4bfaf5f Merge pull request #5989 from lioncash/constantmgr
ConstantManager: Use std::array where applicable
2017-09-03 13:18:10 -04:00
Jules Blok 75574ec6cc Merge pull request #5946 from stenzek/ubershader-stereo-texture-samples
UberShaderPixel: Fix sampling of EFB copies in stereo modes
2017-09-03 12:26:52 +02:00
Stenzek 0622979d3b ShaderGen: Support writing integer colors when logic op is enabled
This is required for D3D to support logic op.
2017-09-03 16:33:25 +10:00
Stenzek 3dd675e613 Renderer: Change SetBlendState to accept a BlendingState
This decouples the state generation (from the emulated GPU) from the
management of internal backend state.
2017-09-03 14:14:54 +10:00
Stenzek 22b8cbae35 RenderBase: Drop SetColorMask and SetLogicOpMode
These are now incorporated into the blend state for all backends.
2017-09-03 14:14:54 +10:00
Stenzek 7a4348b641 Merge pull request #5649 from JonnyH/WIP/disable-vk-clear-renderpass
Add DriverDetails::BUG to Disable "LoadOp" clear renderpass in vulkan
2017-09-03 13:49:51 +10:00
Pierre Bourdon 425a8cb378 Merge pull request #5718 from mimimi085181/partial-updates-update
Update to partial texture updates
2017-09-03 03:16:55 +02:00
Mat M 657195fad5 Merge pull request #6006 from JonnyH/WIP/parse-imgtec-gl_version-string
Parse IMGTEC's GL_VERSION string format
2017-09-02 17:10:59 -04:00
Markus Wick 30e01834e2 Merge pull request #6002 from lioncash/include
CommandProcessor: Remove unnecessary include
2017-09-02 23:05:58 +02:00
Jonathan Hamilton 658a4a6e29 Mark an ImgTec driver bug as fixed in 1.8@4693462
Now we correctly parse ImgTec's GL_VERSION string we can actually use
the BugInfo's version stuff correctly here
2017-09-02 14:05:16 -07:00
Lioncash 6f97e3faa6 AsyncShaderCompiler: use std::make_unique in CreateWorkItem()
Same behavior, simpler code.
2017-09-02 14:08:00 -04:00
Lioncash 62615c601e AsyncShaderCompiler: Forward arguments to the specified type's constructor in CreateWorkItem()
As this just hands off the arguments to another type's constructor,
perfect forwarding should be used here to preserve any potential move semantics.
2017-09-02 14:06:48 -04:00
Lioncash f6e3a39c0e CommandProcessor: Remove unnecessary include
Gets rid of some indirect inclusion.
2017-09-02 13:34:21 -04:00
Jonathan Hamilton 62e8d25cd1 Add Bug to Disable "LoadOp" clear renderpass in vulkan
This optimisation doesn't work on PowerVR's Vulkan implementation. We
(incorrectly) disallow Framebuffer objects to be used with a different
load or store op than that which they were created with, despite the
spec allowing such.

This fixes the windwaker intro "smearing"
2017-08-28 18:01:35 -07:00
Jonathan Hamilton 11057649ee Add VideoLogic (ImgTec) PCI ID 2017-08-28 18:01:16 -07:00
Lioncash 9c1f9c1c00 ConstantManager: Use std::array where applicable
Modernizes the arrays and makes future simplifications possible (e.g. usages within the software renderer).

It also makes cases where we use array->pointer decay explicit.
2017-08-27 15:41:36 -04:00
Chris Burgener cc03e49024 Remove FFMPEG check for Renderer::IsFrameDumping() 2017-08-24 11:15:50 -04:00
JosJuice 09f3f9b41a Remove NonCopyable
The class NonCopyable is, like the name says, supposed to disallow
copying. But should it allow moving?

For a long time, NonCopyable used to not allow moving. (It declared
a deleted copy constructor and assigment operator without declaring
a move constructor and assignment operator, making the compiler
implicitly delete the move constructor and assignment operator.)
That's fine if the classes that inherit from NonCopyable don't need
to be movable or if writing the move constructor and assignment
operator by hand is fine, but that's not the case for all classes,
as I discovered when I was working on the DirectoryBlob PR.

Because of that, I decided to make NonCopyable movable in c7602cc,
allowing me to use NonCopyable in DirectoryBlob.h. That was however
an unfortunate decision, because some of the classes that inherit
from NonCopyable have incorrect behavior when moved by default-
generated move constructors and assignment operators, and do not
explicitly delete the move constructors and assignment operators,
relying on NonCopyable being non-movable.

So what can we do about this? There are four solutions that I can
think of:

1. Make NonCopyable non-movable and tell DirectoryBlob to suck it.

2. Keep allowing moving NonCopyable, and expect that classes that
   don't support moving will delete the move constructor and
   assignment operator manually. Not only is this inconsistent
   (having classes disallow copying one way and disallow moving
   another way), but deleting the move constructor and assignment
   operator manually is too easy to forget compared to how tricky
   the resulting problems are.

3. Have one "MovableNonCopyable" and one "NonMovableNonCopyable".
   It works, but it feels rather silly...

4. Don't have a NonCopyable class at all. Considering that deleting
   the copy constructor and assignment operator only takes two lines
   of code, I don't see much of a reason to keep NonCopyable. I
   suppose that there was more of a point in having NonCopyable back
   in the pre-C++11 days, when it wasn't possible to use "= delete".

I decided to go with the fourth one (like the commit title says).
The implementation of the commit is fairly straight-forward, though
I would like to point out that I skipped adding "= delete" lines
for classes whose only reason for being uncopyable is that they
contain uncopyable classes like File::IOFile and std::unique_ptr,
because the compiler makes such classes uncopyable automatically.
2017-08-22 16:40:34 +02:00
N.E.C ebda7db437 VideoCommon: Fix bug #10464 (RA4 format not handled in TextureDecoder) 2017-08-21 10:22:15 -07:00
Jules Blok 390f3f13ba RenderState: Fix incorrect blending factors when removing the color usage. 2017-08-21 16:33:10 +02:00
Stenzek a7f217c3f4 UberShaderPixel: Fix sampling of EFB copies in stereo modes 2017-08-20 18:08:24 +10:00
Anthony 6a272f22de Merge pull request #5478 from stenzek/vulkan-nvidia
Vulkan: Don't use vkCmdClearAttachments on NVIDIA with MSAA
2017-08-14 13:12:41 -07:00
Stenzek f8a64ab1fc UberShaderPixel: Use an if trees instead of switch statements on GL
The switch statements in these functions appear to get transformed into
an if..else chain on NVIDIA's OpenGL/Vulkan drivers, resulting in lower
performance than the D3D counterparts. Transforming the switch into a
binary tree of ifs can increase performance by up to 20%.
2017-08-12 00:16:19 +10:00
Leo Lam c91211b6ce Merge pull request #5867 from leoetlino/widescreen
GameINI: Replace Wii.Widescreen with AspectRatio
2017-08-11 18:23:54 +08: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
Leo Lam e41a9905c0 Merge pull request #5744 from JosJuice/remove-non-integer-irs
Remove non-integer IRs
2017-08-10 17:10:26 +08:00
N.E.C b52aff7966 VideoCommon: Fix typo in comments introduced by #5849 2017-08-09 00:02:27 -07:00
JosJuice f090a94319 Remove non-integer IRs 2017-08-08 12:09:50 +02:00
Emmanuel Gil Peyrot 1b32751367 VideoCommon: Round values in swizzlers.
This was breaking Metroid Prime 2: Echoes’s scanner in some rooms, such
as the one in https://fifoci.dolphin-emu.org/dff/mp2-scanner/

It was found on Ivy Bridge on Mesa, the alpha value read back from the
EFB was off-by-4 in multiple objects, which was a conversion error
because int4() is equivalent to floor() and the value wasn’t always
higher.
2017-08-07 20:20:36 +02:00
mimimi085181 cdbd9863b4 Keep textures that are overwritten by efb copies, if the stride matches
This is supposed to get efb2tex to the same texture as efb2ram, by applying the related efb copies as updates after each other, in the order of their creation.
2017-08-06 03:13:57 +02:00
mimimi085181 4e8ff42503 Do not load overwritten textures by hash
In this case, comparing the hash is not enough to check, if two textures are identical.
2017-08-06 03:13:57 +02:00
mimimi085181 a21ac22e07 fix stored memory stride for normal textures 2017-08-06 03:13:57 +02:00
Léo Lam e58ba76f07 Don't force the aspect ratio in GameINIs
Instead, add a SuggestedAspectRatio option which tells Dolphin which
aspect ratio to use when the aspect ratio option is set to Auto.
2017-08-05 14:27:16 +08:00
N.E.C c3a57bbad5 Video: Clearly separate Texture and EFB Copy formats
Improve bookkeeping around formats. Hopefully make code less confusing.

- Rename TlutFormat -> TLUTFormat to follow conventions.
- Use enum classes to prevent using a Texture format where an EFB Copy format
  is expected or vice-versa.
- Use common EFBCopyFormat names regardless of depth and YUV configurations.
2017-08-03 18:35:29 -07:00
Stenzek 7f88711186 Vulkan: Add a driver bug for NV when MSAA is enabled
This causes the card to lock up when vkCmdClearAttachments is called,
when multisampling is enabled. Seems to be restricted to Maxwell and
newer?
2017-08-03 17:40:15 +10:00
Stenzek d0bcdc7f89 Merge pull request #5858 from stenzek/ubershader-6-bit-color
Ubershaders: Fix 6-bit color truncation not being applied
2017-08-02 20:10:34 +10:00
Stenzek fe65b26d53 Merge pull request #5834 from stenzek/bc7
Support loading BC7 (BPTC) textures from DDS files
2017-08-01 12:39:19 +10:00
Stenzek 63305e9173 HiresTextures: Support loading BC7 (BPTC) from DDS files 2017-08-01 11:59:38 +10:00
Stenzek 852e30bb8c Ubershaders: Fix 6-bit color truncation not being applied 2017-08-01 00:01:09 +10:00
Stenzek d62dcd397d VideoConfig: Drop force vertex/pixel ubershader settings
This was mainly included for debugging, but could end up being confusing
for users, as well as polluting the GL program cache with a mix of uber
and specialized shaders if the option was changed.
2017-07-31 23:21:38 +10:00
Stenzek b154edb4fb VideoCommon: Move WM_USER_CREATE message to after backend initialization
Fixes the mouse cursor being left visible after ubershader
precompilation when the hide option is checked.
2017-07-30 17:43:59 +10:00
Stenzek d54ca2a16a PixelShaderGen: Don't include host early z support in UID
Disable it at shader generation time instead. This way the UIDs are
sharable.
2017-07-30 17:43:59 +10:00
Stenzek e968c191ff Ubershaders: Support per-pixel lighting 2017-07-30 17:43:59 +10:00
Stenzek c8f31656cb VideoBackends: Support a different number of threads for precompiling
At runtime, we only really want a single shader compiler thread.
However, for initial boots, we can use a higher number to speed things
up.
2017-07-30 17:43:59 +10:00
Stenzek e17efb1d8d ShaderGen: Use consistent variable names for texture coordinates 2017-07-30 17:43:59 +10:00
Stenzek 25338c53e0 NativeVertexFormat: Drop unused virtual method SetupVertexPointers 2017-07-30 17:43:59 +10:00
Stenzek 81b4ed2a81 Vulkan: Uber shader support 2017-07-30 17:43:59 +10:00
Stenzek cd502990fa OGL: Uber shader support 2017-07-30 17:43:59 +10:00
Stenzek 901bf9c257 VideoConfig: Add config options for ubershaders 2017-07-30 17:43:59 +10:00
Stenzek 745d541527 ShaderGen: Implement vertex ubershaders 2017-07-30 17:43:59 +10:00
Stenzek 7d78cf0f6f ShaderGen: Implement pixel ubershaders 2017-07-30 17:43:59 +10:00
Stenzek 07591e7d5c PixelShaderGen: Move header generation to seperate function 2017-07-30 17:43:59 +10:00
Stenzek c783cd2aaf GeometryShaderGen: Add UID enumeration functions 2017-07-30 17:43:59 +10:00
Stenzek 38c48ff72e VertexLoaderManager: Add methods to generate "uber" vertex formats
These vertex formats enable all attributes. Inactive attributes are set
to offset=0, and the smallest type possible. This "optimization" stops
the NV compiler from generating variants of vertex shaders.
2017-07-30 17:43:59 +10:00
Stenzek f48ef65bec XFMemory: Convert several registers to bitfields 2017-07-30 17:43:59 +10:00
Scott Mansell 479abde9f4 BPMemory: Convert a number of unions to BitFields 2017-07-30 17:43:59 +10:00
Stenzek 0a9574eaa1 VideoCommon: Add AsyncShaderCompiler class implementation 2017-07-30 17:43:59 +10: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
Stenzek d01b0bf60f VideoCommon: Move shader cache filename generation to common 2017-07-20 17:46:59 +10:00
Stenzek d1381f5021 VideoConfig: Add host config union
Contains all host state that can affect shadergen.
2017-07-20 17:46:59 +10:00
Stenzek 82c27182a8 ShaderGen: Remove host state from shader uids 2017-07-20 17:46:59 +10:00
Anthony ab5a5ee3ea Merge pull request #5726 from mimimi085181/minimal-tmem-cache-emulation
Implement minimal emulation of TMEM caching
2017-07-11 22:49:19 -07:00
Leo Lam b6c3479bb4 Merge pull request #5720 from JosJuice/file-metadata
FileUtil: Redesign Exists/IsDirectory/GetSize
2017-07-11 00:28:34 +02:00
mimimi085181 53663c00b9 Implement minimal emulation of TMEM caching
This is a remake of https://github.com/dolphin-emu/dolphin/pull/3749

Full credit goes to phire.

Old message:
"If none of the texture registers have changed and TMEM hasn't been invalidated or changed in other ways, we can blindly reuse the old texture cache entries without rehashing.

Not only does this fix the bloom effect in Spyro: A Hero's Tail (The game abused texture cache) but it will also provide speedups for other games which use the same texture over multiple draw calls, especially when safe texture cache is in use."

Changed the pr per phire's instructions to only return the current texture(s) if none of the texture registers were changed. If any texture register was changed, fall back to the default hashing and rebuilding textures from memory.
2017-07-10 01:49:27 +02:00
Jules Blok 8476d0271d PixelShaderGen: Add missing inputs.
This fixes a linkage warning in D3D because of mismatched inputs.
2017-07-05 22:43:39 +02:00
Jules Blok 179602e921 D3D: Add quad-buffer stereoscopy support. 2017-07-05 22:43:39 +02:00
JosJuice 5ca3aee00a FileUtil: Add a class for Exists/IsDirectory/GetSize
Some code was calling more than one of these functions in a row
(in particular, FileUtil.cpp itself did it a lot...), which is
a waste since it's possible to call stat a single time and then
read all three values from the stat struct. This commit adds a
File::FileInfo class that calls stat once on construction and
then lets Exists/IsDirectory/GetSize be executed very quickly.

The performance improvement mostly matters for functions that
can be handling a lot of files, such as File::ScanDirectoryTree.

I've also done some cleanup in code that uses these functions.
For instance, some code had checks like !Exists() || !IsDirectory(),
which is functionally equivalent to !IsDirectory(), and some
code was using File::GetSize even though there was an IOFile
object that the code could call GetSize on.
2017-06-29 19:07:29 +02:00
Shawn Hoffman ed8f293b4f Change "blocking" BlockingLoop::Stop to give up and die after a timeout.
This fixes the global-static fifo object causing infinite hangs in some
cases. Notably, failure to initialize a graphics backend would result in
BlockingLoop::Prepare being called but never executing Run(), leaving the
object in a bad state.
2017-06-25 20:47:30 -07:00
Shawn Hoffman c5fa470ad8 replace DoFileSearch with optimized version 2017-06-23 17:25:53 -07:00
Lioncash 59a947d41d AbstractTexture: Return config by const reference
Returning by const value isn't really necessary (and usually an indicator const reference was intended).
2017-06-18 23:38:42 -04:00
Lioncash 07cddf6f7f AbstractTexture: Add missing includes (and remove unnecessary ones) 2017-06-18 23:29:22 -04:00
Lioncash 0c57543205 VideoCommon: Fix VS filter for AbstractTexture.cpp
This would cause failures when building with VS.
2017-06-18 22:58:02 -04:00
shuffle2 e63c337830 Merge pull request #5305 from iwubcode/abstract_texture
Abstract Texture
2017-06-18 12:57:05 -07:00
Stenzek 68fef47aef Merge pull request #5314 from stenzek/revert-efb-source-truncation
TextureConversionShader: Use integer math for truncating EFB format
2017-06-17 15:21:48 +10:00
Stenzek adebe2239e TextureConversionShader: Use integer math for truncating EFB format 2017-06-17 12:17:09 +10:00
Leo Lam bc9c9b9fe4 Merge pull request #5594 from MerryMage/phack
Cleanup Projection Hack
2017-06-16 18:36:39 +02:00
JosJuice cf94ce6305 Add a namespace to OpenFStream
For consistency with the other functions in FileUtil.h.
2017-06-15 21:34:04 +02:00
JosJuice f09ceaa735 Move IOFile to a separate file
Reduces the number of files that need to be recompiled
when making changes to FileUtil.h.
2017-06-15 21:33:50 +02:00
MerryMage f8a99ca192 VertexShaderManager: Rename projection hack variables 2017-06-15 16:38:10 +01:00
iwubcode e4896d39bd Video Backends: Move and rename HostTextureFormat to AbstractTextureFormat 2017-06-13 00:41:56 -05:00
iwubcode 2cdc93f4ab Video Backends: Split texture cache code out into separate files, introduce 'AbstractTexture' 2017-06-13 00:41:51 -05:00
MerryMage a0b41c83e7 VideoConfig: Remove bRunning
Value was set but not used.
2017-06-11 15:06:12 +01:00
Léo Lam 774587cbd1 VideoConfig: Remove useless header includes 2017-06-10 20:25:27 +02:00
Léo Lam 0e85c47237 VideoConfig: Remove manual panic alert setting load
This code hadn't been touched since 2010. Nowadays, the panic alert
setting is loaded by ConfigManager and applied in UICommon.
VideoConfig has no business messing with it.
2017-06-10 20:24:18 +02:00
Shawn Hoffman 5480efdff2 video: change multisample/AA setting to u32 2017-06-07 20:20:25 -07:00
Shawn Hoffman 9357cee2ef do not assign in conditional statements 2017-06-07 20:09:44 -07:00
Shawn Hoffman e6c15e993b quiet some sign-conversion-in-parameter warnings 2017-06-07 20:09:43 -07:00
Shawn Hoffman e1a3e41bf3 fix various instances of -1 being assigned to unsigned types 2017-06-07 19:52:07 -07:00
Shawn Hoffman be7c6a0819 msvc: disable warning about using setjmp w/c++ objects in scope 2017-06-07 19:52:07 -07:00