Commit Graph

3717 Commits

Author SHA1 Message Date
Jonathan Hamilton 29b7e33c14 Make arbitrary mipmap detection a config option
Under GFX::Enhancements::ArbitraryMipmapDetection - default enabled
2018-05-16 17:15:38 -07:00
Lioncash 011ee110bc Common/Hash: Namespace code under the Common namespace
Brings more common code under the Common namespace.
2018-05-16 15:39:23 -04: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
Léo Lam 6763a3fce1 Config: Add support for enums
This makes it possible to use enums as the config type.
Default values are now clearer and there's no need for casts
when calling Config::Get/Set anymore.

In order to add support for enums, the common code was updated to
handle enums by using the underlying type when loading/saving settings.

A copy constructor is also provided for conversions from
`ConfigInfo<Enum>` to `ConfigInfo<underlying_type<Enum>>`
so that enum settings can still easily work with code that doesn't care
about the actual enum values (like Graphics{Choice,Radio} in DolphinQt2
which only treat the setting as an integer).
2018-05-12 18:10:26 +02:00
spycrab 16e2ac9257 VideoCommon/RenderBase: Refactor OSD messages 2018-05-11 18:24:08 +02:00
Lioncash ba01f6dba3 CommonFuncs: Convert ROUND_UP_POW2 macro to a function
Also move it to MathUtils where it belongs with the rest of the
power-of-two functions. This gets rid of pollution of the current scope
of any translation unit with b<value> macros that aren't intended to be
used directly.
2018-05-10 19:42:20 -04:00
Lioncash e020f5b04b RenderBase: Remove unused PixelPerfQuery enum
Neither the values or the identifier name of the enum is used anywhere
in the codebase.
2018-05-09 12:11:29 -04: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 a5e410b7c9
Merge pull request #6744 from stenzek/ui-disable-vram-copies
UI: Add Disable EFB Copies to VRAM to Advanced Options
2018-05-04 12:01:29 +10:00
Stenzek 0152f63655 TextureCacheBase: Make "disable vram copies" part of the active config 2018-05-03 14:24:44 +10:00
Stenzek 4faac3a627 TextureConversionShader: Don't sample from adjacent rows when not needed 2018-05-03 14:09:32 +10:00
Stenzek a93830056f TextureConversionShader: Fix more implicit conversion errors 2018-05-03 11:32:06 +10:00
Stenzek 2c6b20bb03 TextureConversionShader: Fix compile errors in OpenGL ES 2018-05-02 21:54:13 +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
Scott Mansell fc96479f12 VideoSoftware: Implement xfb copy filter (Deflickering/Brightness) 2018-04-29 17:56:51 +10:00
JosJuice e604641b12 Remove leftovers of projection hack support 2018-04-13 12:52:42 +02:00
spycrab 40bb9974f2 Reformat all the things! 2018-04-12 21:28:39 +02:00
Anthony 9e2806c181 [AVIDump] fix compilation issues on Linux 2018-04-06 19:53:10 -07:00
Markus Wick c6d0d9a01f
Merge pull request #6578 from JosJuice/remove-projection-hacks
Remove support for projection hacks
2018-04-04 09:10:32 +02:00
Lioncash 74aff4d9ef
HiresTexture: Correct texture hashes
Fixes a regression introduced in 2da8d98b2f
2018-04-03 12:42:05 -04:00
Stenzek 9924434cdf
Merge pull request #6573 from stenzek/bad-shader-uid-cache
ShaderCache: Improve shader UID cache file reliability
2018-04-03 01:00:09 +10:00
Lioncash 672665dec0 AsyncRequests: In-class initialize class members
Prior to this change, it's possible for m_wake_me_up_again to be used
while it's in an uninitialized state from the exposed API.

e.g.

- Using SetEnable after construction would perform an uninitialized read.
- Using PushEvent would perform an uninitialized read by way of operator |=.

internally, an uninitialized read can happen if PullEventsInternal() is
executed before other functions.

Just to avoid the whole possibility of performing uninitialized reads,
we just give the class member a default value of false.
2018-04-01 19:06:43 -04:00
JosJuice 91732e2baf Remove support for projection hacks
This isn't really useful for anything anymore as far as I know.
2018-04-01 21:41:18 +02: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
Stenzek 8587403e0e ShaderCache: Write currently-known UIDs to cache when re-creating file
This way, if we load a UID cache where the data was incomplete (e.g.
Dolphin crashed), we don't lose the existing UIDs which were previously
at the beginning.
2018-04-02 01:13:24 +10:00
Stenzek 36ea2f7a26 ShaderCache: Fix issue where shader cache wasn't recreated when invalid 2018-04-02 01:02:20 +10:00
JosJuice 01ea10824d Put a "last changed in PR" comment next to UID cache version
This will create a merge conflict if two PRs try to increment the
cache version at the same time, which makes it noticeable that the
PR that gets merged last needs to increment the cache version again.
We already use this for savestates and the game list cache.
2018-03-29 22:38:37 +02:00
Lioncash b818cc682c VideoCommon/Vulkan: Explicitly link in xxhash
Lessens the dependency on the LIBS variable (and also makes the required
libraries explicit).
2018-03-28 17:03:16 -04:00
Lioncash fd7ac0d4a3
VideoCommon/CMakeLists: Migrate off add_dolphin_library
Continues the migration work started in 3a4c3bbe01
2018-03-28 09:57:50 -04:00
Markus Wick fc59ec6f13
Merge pull request #6547 from lioncash/dead
PixelShaderGen: Remove dead code in WriteColor()
2018-03-28 10:43:15 +02:00
Lioncash f10198500e PixelShaderGen: Invert conditional in WriteColor()
Puts the true condition body first instead of the false one for better
reading.
2018-03-27 18:53:17 -04:00
Lioncash c9e0045881 PixelShaderGen: Remove dead code in WriteColor()
The outer conditional executes only whenever destination alpha is used.
2018-03-27 18:46:25 -04:00
Lioncash 2da8d98b2f
HiresTextures: Use std::minmax or std::minmax_element where applicable in GenBaseName()
Minimizes repetition.

std::minmax_element can be used for the 256 * 2 case, as it's only performing byte comparisons
and thus, there will always be an element smaller than 0xffff, so it doesn't need to be included
in the set of compared values.
2018-03-27 15:39:05 -04:00
Lioncash d5a1edba09
HiresTextures: Remove unnecessary pointer casts in GenBaseName()
swap16 has an overload that accepts a u8*, performing the same behavior
in a well-defined manner.
2018-03-27 15:19:02 -04:00
Lioncash 9feb18866b
BPStructs: Remove an unnecessary pointer cast in GetBPRegInfo
swap32 has an overload that accepts a u8*, performing the same behavior
in a well-defined manner.
2018-03-27 12:04:16 -04:00
Stenzek 2f1a7cbee1 Implement "Skip" ubershader mode
Skip ubershader mode works the same as hybrid ubershaders in that the
shaders are compiled asynchronously. However, instead of using the
ubershader to draw the object, it skips it entirely until the
specialized shader is made available.

This mode will likely result in broken effects where a game creates an
EFB copy, and does not redraw it every frame. Therefore, it is not a
recommended option, however, it may result in better performance on
low-end systems.
2018-03-26 01:57:41 +10:00
JosJuice 9c70036105
Merge pull request #6503 from lioncash/brace-warn
PixelShaderGen/UberShaderPixel: Silence -Wmissing-braces warnings
2018-03-23 15:29:39 +01:00
Lioncash a52cc8d52b
PixelShaderGen/UberShaderPixel: Silence -Wmissing-braces warnings 2018-03-23 10:06:27 -04:00
Lioncash 2ab29a40eb
AbstractFramebuffer: Silence a -Wlogical-op-parentheses warning in ValidateConfig() 2018-03-23 09:58:19 -04:00
Léo Lam f335790623
Merge pull request #6460 from lioncash/datareader
DataReader: Minor API changes
2018-03-19 15:02:50 +01:00
Markus Wick 98b4716902
Merge pull request #6442 from stenzek/async-compiler-priority
ShaderCache: Implement compile priority
2018-03-19 09:16:53 +01:00
Markus Wick 79b21e1381
Merge pull request #6459 from lioncash/enum
VertexShaderGen: Convert defines to an enum
2018-03-19 08:48:25 +01:00
Lioncash b21a00d290 DataReader: Provide a const qualified variant of GetPointer()
This wouldn't be much of a data reader if it can't access the
read-only data pointer in read-only contexts. Especially if it
can get a writable equivalent in contexts that aren't read-only.
2018-03-18 16:53:04 -04:00
Lioncash ce29c1c42f DataReader: Correct return type of operator=
It's questionable to not return a reference to the instance being
assigned to. It's also quite misleading in terms of expected behavior
relative to everything else. This fixes it to make it consistent with
other classes.
2018-03-18 16:50:59 -04:00
Lioncash ffade65c55 DataReader: Remove __forceinline from trivial functions 2018-03-18 16:49:50 -04:00
Lioncash 4c2ec39199 DataReader: In-class initialize member variables where applicable
Allows the default constructor to be defaulted and ensures the default
values are associated with the member variables directly.

Also corrects a prefixed underscore in the two parameter constructor.
2018-03-18 16:34:51 -04:00
Lioncash fd956f6c69 DataReader: Make size() and Peek() const member functions
These don't modify class state, so they can be const qualified.
2018-03-18 16:33:14 -04:00
Lioncash 2b3b1e8d09 VertexShaderGen: Convert defines to an enum
Unlike defines, these will actually obey namespacing (should one be
added), and also provide a symbol when debugging, as opposed to a magic
value.
2018-03-18 15:45:20 -04:00
Lioncash b68e8b872e VideoBackendBase: Migrate functions from MainBase.cpp to VideoBackendBase.cpp
Given that this only contains functions from the VideoBackendBase class,
it makes more sense to move these to the relevant cpp file to keep them
all together.
2018-03-18 15:33:59 -04:00
Lioncash 13ed716419 MainBase: Remove effectively unused s_FifoShuttingDown variable
This is only ever set and cleared, which is fine, however nothing else
ever actually reads its state to perform differing behavior.
2018-03-17 18:10:43 -04:00
Lioncash 826c11ba3b MainBase: Remove unused s_beginFieldArgs struct
This is only ever memset to zero and never used again.

This also gets rid of an instance of undefined behavior considering the
draft standard for C++17 (N4659) states at [dcl.type.cv] paragraph 5:

"
The semantics of an access through a volatile glvalue are implementation-defined.
If an attempt is made to access an object defined with a volatile-qualified type
through the use of a non-volatile glvalue, the behavior is undefined.
"
2018-03-17 18:07:08 -04:00
Stenzek 93865b327f ShaderCache: Implement compile priority
Currently, when immediately compile shaders is not enabled, the
ubershaders will be placed before any specialized shaders in the compile
queue in hybrid ubershaders mode. This means that Dolphin could
potentially use the ubershaders for a longer time than it would have if
we blocked startup until all shaders were compiled, leading to a drop in
performance.
2018-03-17 01:53:11 +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 517a977444 ShaderCache: Fix several issues in background shader compiling
- In D3D, shaders could be compiled on the main thread, blocking
startup.
- Reduced the latency between a pipeline being requested and used in all
backends in hybrid ubershader mode, when no shader stages were present.
- Fixed a case where async compilation could cause the same UID to be
appended multiple times to the UID cache.
- Fix incorrect number of threads being used when immediately compile
shaders was enabled.
2018-03-15 01:50:47 +10:00
Stenzek 51e4014a35 DriverDetails: Disable primitive restart on Vulkan with Mali driver 2018-03-14 02:56:24 +10:00
Stenzek db810956ec Vulkan: Provide a more accurate method of detecting drivers/vendors
This is needed to differentiate between the open-source Mesa drivers and
their binary counterparts for Intel and AMD.
2018-03-14 02:48:53 +10:00
Henrik Rydgård 6cbb716f60 SSE-optimize UninitializeXFBMemory
Lowest hanging fruit I could find with a profiler.

Not sure this stuff actually needs to be done, but assuming it is, why
not do it quickly? 10x faster, goes from 1% CPU to 0.09%.
2018-03-13 11:55:28 +01:00
Stenzek 427aa188d4 ShaderCache: Use a version number for pipeline UID caches 2018-03-11 14:48:09 +10:00
Stenzek e31cc1f679 ShaderCache: Implement background shader compilation
This enables shaders to be compiled while the game is starting, instead
of blocking startup. If a shader is needed before it is compiled,
emulation will block.
2018-03-10 16:11:19 +10:00
Stenzek 9fa24700b6 VideoConfig: Collapse ubershader configuration fields to a single value 2018-03-10 15:56:45 +10:00
Stenzek 590307b94c ShaderCache: Use memcmp for comparing pipeline UIDs
As these are stored in a map, operator< will become a hot function when
doing lookups, which happen every frame. std::tie generated a rather
large function here with quite a few branches.
2018-03-10 15:56:42 +10:00
Stenzek 41296db083 Renderer: Remove now-redundant Set{Rasterization,Depth,Blending}State 2018-03-10 15:56:40 +10: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 2a6d9e4713 AbstractTexture: Add support for depth textures/formats 2018-03-01 17:31:24 +10:00
Stenzek 6374a4c4a8 AbstractTexture: Support multisampled abstract texture 2018-03-01 17:31:24 +10:00
Stenzek 4316f5f56b AbstractTexture: Add property/attribute accessor helpers 2018-03-01 17:31:24 +10:00
Stenzek e125eaa237 VideoCommon: Drop references to AbstractRawTexture 2018-03-01 17:31:24 +10:00
Markus Wick 227db66e4f OGL: Use glBufferData on Mali.
tl;dr: This PR speedups dolphin on mobiles with the Mali GPU and ES 3.2
drivers by a factor of 10 by using the method with the biggest overhead.
Please keep care not to buy this shit!

The ARM driver team seems to care very well about their customers. But
bad luck, users and open source developers are *not* their customers. So
even device-independent feature requests are just ignored for *years*:

https://community.arm.com/graphics/f/discussions/4645/gl_ext_buffer_storage-support

The bad point, they neither implement any of the other common ways to
stream dynamic content in unextented GL:
- They just ignore the GL_MAP_UNSYNCHRONIZED_BIT flag
- They don't support on-device buffer updates and just stall with
glBufferSubData

It seems like no benchmark is using any dynamic content - and like no
customer cares about anything but benchmarks, or users...

We have a flag to disable the glBufferSubData way, this PR adds the flag
to also disable the unsychronized mapping way. The second one is
available since their ES 3.2 update, but slow as hell.

So how to continue? The last remaining technical way to stream dynamic
content at all is to alloc a new buffer per draw call with glBufferData.
This is very gross, but still a factor 10 speedup compared to stalling
the GPU. Small tests shows that you can expect another 3-5 times speedup
with EXT_buffer_data, so Mali would be on pair with Adreno here. So if
you have bought such a device unfortunately, please try to make noise on
your vendor forums/support and ask for this extension. If you are going
to buy a new mobile, I'd recormend to avoid *any* mobile with a Mali GPU
in it.
2018-02-25 17:12:36 +01:00
Stenzek fec6bb4d56 VideoBackends: Add AbstractShader and AbstractPipeline classes 2018-02-22 22:02:34 +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 c1b39ecc58 BPFunctions: Move upscaling of scissor rect to VideoCommon 2018-02-20 00:49:32 +10:00
Stenzek 5359396099 BPFunctions: Move GX viewport conversion to VideoCommon 2018-02-20 00:49:32 +10:00
Stenzek 340ee8fff8 PixelShaderGen: Implement table-based fog range as in software renderer 2018-02-15 22:19:21 +10:00
Stenzek 93fb0e1e1c TextureCache: Add an option to disable EFB copies to VRAM
The option is named DisableCopyToVRAM under the Hacks section in
GFX.ini. It is intentionally not exposed to the GUI, as users should not
need to use it under normal circumstances. The main use is debugging
issues in the EFB-to-RAM shaders.
2018-02-11 15:48:46 +10:00
Stenzek 84b990faa0 VideoConfig: Remove bForceCopyToRam field
It's the inverse of supports-copy-to-vram.
2018-02-11 15:29:37 +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 260d5b7aa7 BPMemory: Handle fog configuration where both A and C are infinity/NaN
The console appears to behave against standard IEEE754 specification
here, in particular around how NaNs are handled. NaNs appear to have no
effect on the result, and are treated the same as positive or negative
infinity, based on the sign bit.

However, when the result would be NaN (inf - inf, or (-inf) - (-inf)),
this results in a completely fogged color, or unfogged color
respectively. We handle this by returning a constant zero for the A
varaible, and positive or negative infinity for C depending on the sign
bits of the A and C registers. This ensures that no NaN value is passed
to the GPU in the first place, and that the result of the fog
calculation cannot be NaN.
2018-02-01 17:40:39 +10: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 c790077c13 VideoBackend: Remove PeekMessages method
The video thread and backend no longer create any windows, therefore
there will never be any messages dispatched to their thread.
2018-01-27 13:53:55 +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
Stenzek 81ae88d2d5 AbstractTexture: Fix crash in Vulkan backend when freeing texture 2018-01-26 19:12:11 +10:00
Stenzek 38e0b6e2ab AbstractTexture: Move Bind() method to Renderer
This makes state tracking simpler, and enables easier porting to command
lists later on.
2018-01-22 13:22:09 +10:00
degasus a5a0599145 CustomTexture: Drop old texture format. 2018-01-20 17:08:47 +01:00
degasus 0b466249e0 CustomTextures: Drop format convertion. 2018-01-20 16:39:04 +01:00
JosJuice 2441fd28d5 AVIDump: Remove incorrect usage of s_ prefix 2018-01-17 22:19:14 +01:00
Markus Wick e02025b45e
Merge pull request #6307 from rukai/fix-frame-dump-path
Handle framedump path not existing
2018-01-17 22:02:51 +01:00
Lucas Kent 6c7e6016fb Handle framedump path not existing 2018-01-18 07:53:30 +11:00
Markus Wick cb7eede193 VideoCommon: Apply custom texture scale for arbitrary mipmaps.
We want to get the same mipmap level. And if the IR and the custom
texture upscaling fits, we don't need to modify the LOD bias.
2018-01-17 09:02:36 +01:00
Markus Wick 2a43f41ace
Merge pull request #6297 from JosJuice/custom-texture-arb-filename
Treat custom textures with "_arb" suffix as having arbitrary mipmaps
2018-01-15 09:58:30 +01:00
Markus Wick b93ae14272
Merge pull request #6300 from JonnyH/WIP/glsl-es-implicit-int-float-conversions-in-gpu-texture-decode
GLSL-ES doesn't allow implicit int/uint conversions
2018-01-11 22:22:05 +01:00
Jonathan Hamilton 46254a2cf2 Some more implicit uint/float conversions in the texture decode shaders 2018-01-11 11:15:40 -08:00
Jonathan Hamilton f23dd992dd GLSL-ES doesn't allow implicit int/uint conversions 2018-01-11 10:54:55 -08:00
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