Commit graph

3893 commits

Author SHA1 Message Date
Lioncash
14e544eef8 VertexLoader_Position: Make lookup tables immutable
Allows the compiler to place these arrays within the read-only segment.
2019-05-30 10:29:50 -04:00
Lioncash
be9a03b35f VertexLoader_Position: Place helper functions in anonymous namespace 2019-05-30 10:29:50 -04:00
Lioncash
60a1d0593c VertexLoader_Color: Place helper functions in anonymous namespace
While we're at it, convert the define into a constexpr variable.
2019-05-30 10:29:47 -04:00
Léo Lam
4e7a790648
Merge pull request #8140 from lioncash/vertex
VideoCommon/VertexLoader_Normal: Construct look-up table at compile-time
2019-05-30 14:28:59 +02:00
Léo Lam
90c9991086
Merge pull request #8141 from lioncash/init
VideoCommon/ShaderGenCommon: Simplify initialization of ShaderUid class
2019-05-30 14:15:02 +02:00
Lioncash
f7eff6dab8 VideoCommon/ShaderGenCommon: Simplify operator!= for ShaderUid
This can be implemented as the negation of operator==, placing the
comparison logic for equality and inequality in the same place.
2019-05-30 06:41:57 -04:00
Lioncash
954246d10e VideoCommon/ShaderGenCommon: Remove use of a union within ShaderUid
This is only ever used to retrieve a raw view of the given UID data
structure, however it's already valid C++ to retrieve a char/unsigned
char view of an object for bytewise inspection.

u8 maps to unsigned char on all platforms we support, so we can just do
this directly with a reinterpret cast, simplifying the overall
interface.
2019-05-30 06:41:57 -04:00
Lioncash
149a97e396 VideoCommon: Remove unnecessary memset on ShaderUid instances.
Zero-initialization zeroes out all members and padding bits, so this is
safe to do. While we're at it, also add static assertions that enforce
the necessary requirements of a UID type explicitly within the ShaderUid
class.

This way, we can remove several memset calls around the shader
generation code that makes sure the underlying UID data is zeroed out.
Now our ShaderUid class enforces this for us, so we don't need to care about
it at the usage sites.
2019-05-30 06:41:54 -04:00
Lioncash
e60268bd42 VideoCommon/RenderBase: Use a std::string_view with CreateShaderFromSource()
Greatly simplifies the overall interface when it comes to compiling
shaders. Also allows getting rid of a std::string overload of the same
name. Now std::string and const char* both go through the same function.
2019-05-30 03:29:35 -04:00
Lioncash
0084aeb5d7 VideoCommon/VertexLoader_Normal: Use variable template variants of type traits
Same thing, less reading.
2019-05-30 00:52:59 -04:00
Lioncash
8268b6f454 VideoCommon/VertexLoader_Normal: Initialize function table at compile-time
Makes VertexLoader_Normal completely stateless, eliminating the need for
an Init() function, and by extension, also gets rid of the need for the
FifoAnalyzer to have an Init() function.
2019-05-30 00:52:57 -04:00
Lioncash
911755242d VideoCommon/VertexLoader_Normal: Remove E prefix from enums
This is old formatting that used to be used prior to the coding style
being introduced.
2019-05-29 22:15:46 -04:00
Lioncash
3b8fb22d93 VideoCommon/VertexLoader_Normal: Tidy up function declarations
We can use u32 to shorten up the function declarations. While we're at
it, remove unnecessary comments. These don't help with understanding.
2019-05-29 22:13:20 -04:00
Lioncash
8537f8e095 VideoCommon/PixelShaderGen: Fix up wonky comment formatting
This is likely a remnant of the initial transition to clang-format.
2019-05-29 22:03:02 -04:00
Lioncash
45934dd0c5 VideoCommon/PixelShaderGen: Make arrays immutable
Many of the arrays defined within this file weren't declared as
immutable, which can inhibit the strings being put into the read-only
segment. We can declare them constexpr to make them immutable.

While we're at it, we can use std::array, to allow bounds conditional
bounds checking with standard libraries. The declarations can also be
shortened in the future when all platform toolchain versions we use
support std::array deduction guides. Currently macOS and FreeBSD
builders fail on them.
2019-05-29 22:00:58 -04:00
Lioncash
e28d08e973 VideoCommon/PixelShaderGen: Brace control structures that travel more than one line
Them's the code formatting rules.
2019-05-29 20:16:41 -04:00
Léo Lam
0cfdcf436d
Merge pull request #8136 from lioncash/arglist
VideoCommon/{NetPlayChatUI/NetPlayGolfUI}: Minor changes
2019-05-29 13:18:03 +02:00
Lioncash
1a0f8e7804 VideoCommon/VertexLoaderX64: Add missing header guard 2019-05-29 06:35:22 -04:00
Lioncash
778623c48c VideoCommon/NetPlayGolfUI: Remove unused header
This header doesn't actually make use of any std::string facilities.
2019-05-29 06:20:57 -04:00
Lioncash
cf0f2bbf1d VideoCommon/NetPlayGolfUI: Default the destructor in the cpp file
Ensures the destruction logic is kept local to the translation unit. It
also doesn't really do much to have it specified in the header.
2019-05-29 06:20:05 -04:00
Lioncash
0fabab0760 VideoCommon/NetPlayGolfUI: Initialize netplay_client in the constructor initializer list 2019-05-29 06:20:05 -04:00
Lioncash
c958fc1278 VideoCommon/NetPlayChatUI: Default destructor in the cpp file
Ensures that the destruction logic is kept local to the translation unit
(making it nicer when it comes to forward declaring non-trivial types).
It also doesn't really do much to define it in the header.
2019-05-29 06:20:05 -04:00
Lioncash
53b115b81e VideoCommon/NetPlayChatUI: Use nullptr where applicable
We gotsa type dedicated to this concept already :P
2019-05-29 06:14:43 -04:00
Lioncash
50a15b7484 VideoCommon/NetPlayChatUI: Take std::string by value in AppendChat()
Given we're simply storing the std::string into a deque. We can emplace
it and move it. Completely avoiding copies with the current usage of the
function.
2019-05-29 06:12:29 -04:00
Lioncash
08223bad9f VideoCommon/NetPlayChatUI: Set member variable within the constructor initializer list
Member variables should be initialized within the constructor
initializer list if possible.
2019-05-29 06:09:49 -04:00
Connor McLaughlin
707266aeed
Merge pull request #8069 from iwubcode/passive_support
VideoCommon: Implement passive stereoscopic 3D
2019-05-12 15:15:34 +10:00
Stenzek
3e29fdb4a7 CommandProcessor: Don't reset the video buffer when FIFO distance is changed
This prevents partially-processed commands from being lost when switching buffers.
2019-05-11 00:31:37 +10:00
weihuoya
e98f43d2af bbox minor fx 2019-05-09 17:30:17 +08:00
Techjar
ff972e3673 Reformat repo to clang-format 7.0 rules 2019-05-06 18:48:04 +00:00
iwubcode
c513bb5309 VideoCommon: Implement passive stereoscopic 3D 2019-05-04 22:58:00 -05:00
Léo Lam
ab9ece9bca Replace MathUtil::Clamp with std::clamp 2019-05-04 23:12:17 +02:00
Léo Lam
99a4ca8de7
Merge pull request #7839 from ShFil119/impr/redundant
Remove redundant initialization
2019-05-04 22:50:51 +02:00
z0z0z
5bacb2e4c6 Disable Vulkan overrides for RADV driver 2019-05-01 07:59:54 -04:00
Filip Gawin
c110ffcdaa Remove redundant initialization 2019-04-30 01:22:24 +02:00
Connor McLaughlin
1b1662773e
Merge pull request #8048 from stenzek/vulkan-negative-scissor-rect
Vulkan: Don't set a negative offset in scissor rect
2019-04-28 23:37:51 +10:00
Stenzek
32359bf2bb Renderer: Adjust target rectangle in the base class 2019-04-28 23:33:24 +10:00
Stenzek
3c64f0c616 Renderer: Adjust source rectangle when crop would draw off screen
This prevents us from requiring an oversized and/or negative viewport by
shrinking the source rectangle instead.
2019-04-28 23:31:57 +10:00
Connor McLaughlin
d2d8d7ce90
Merge pull request #8051 from JosJuice/efb-constexpr
Turn EFB_WIDTH/EFB_HEIGHT into constexpr
2019-04-28 20:37:25 +10:00
JosJuice
ced2306fc5 Turn EFB_WIDTH/EFB_HEIGHT into constexpr
https://bugs.dolphin-emu.org/issues/11692#note-5

Also change const into constexpr while we're at it.
2019-04-28 11:50:17 +02:00
Connor McLaughlin
f7199397a0
Merge pull request #8047 from stenzek/d3d-feature-level-10
D3D11: Fix Dolphin crashing on feature level 10.0 devices
2019-04-28 17:07:37 +10:00
Stenzek
53af27b133 FramebufferManager: Fix invalid transitions for 1xIR in EFB cache 2019-04-28 16:13:49 +10:00
Stenzek
51154d6907 FramebufferShaderGen: Don't emit SV_SampleIndex when not using SSAA 2019-04-28 15:26:21 +10:00
Stenzek
d5b3595314 TextureCache: Fix incorrect format string in GetXFBTexture() 2019-04-28 14:32:37 +10:00
iwubcode
c2abf092e9 VideoCommon: Do not reset the gather pipe (WPAR buffer) as this does not reflect what actually happens on real hardware. On hardware, there's no way for the GPU to signal to reset the WPAR buffer. Instead, the WPAR buffer will be reset automatically upon receiving 32 bytes or when spr[WPAR] is written 2019-04-26 22:20:53 -05:00
Connor McLaughlin
59c0e51f5b
Merge pull request #8000 from stenzek/more-videocommon-cleanup
Additional cleanup/fixes from VideoCommon merge
2019-04-22 12:50:22 +10:00
Connor McLaughlin
93be178f28
Merge pull request #7857 from stenzek/opengl-stereo
OGL: Fix stereoscopy
2019-04-22 12:41:12 +10:00
Connor McLaughlin
44d5a71e27
Merge pull request #7965 from jordan-woyak/condvar-fixes
Minor changes to usages of std::condition_variable.
2019-04-21 23:50:53 +10:00
Stenzek
9577d0641b ShaderCache: Fix crash at shutdown on shared shader compilation fail 2019-04-21 14:28:14 +10:00
Stenzek
f8c1ba409c Replace EFBRectangle/TargetRectangle with MathUtil::Rectangle 2019-04-21 14:28:14 +10:00
Connor McLaughlin
5b4ebccf6b
Merge pull request #8012 from stenzek/bounding-box-shaders
PixelShaderGen: Don't emit bounding box shader code for old UIDs when disabled
2019-04-21 13:27:05 +10:00
Stenzek
b09a0e1a60 TextureCache: Check for out-of-range partial copy rect after scaling 2019-04-21 12:54:32 +10:00
Stenzek
3791262d96 TextureCache: Use linear filtering on y-scaled and >1xIR VRAM copies 2019-04-21 12:41:15 +10:00
Stenzek
708bd3d9f7 TextureCache: Simplify XFB reconstruction
This also better handles in-memory interlaced XFB data placed by the CPU
by considering the stride from the VI.
2019-04-21 12:41:15 +10:00
Stenzek
dbaba0062a TextureDecoder: Move XFB decoding to Common
This was previously missing for generic (which is used on ARM).
2019-04-21 12:41:15 +10:00
Stenzek
eddde3e6c8 ShaderGen: Use interface blocks when geometry shaders are supported
We don't use explicit locations in OpenGL currently, so this breaks
when we use alternative names in the geometry shaders.
2019-04-20 23:44:33 +10:00
Stenzek
c6b45c5ca9 ShaderCache: Fix crash if pipeline from uid cache fails creation 2019-04-20 23:16:29 +10:00
Stenzek
96aa762d1e PixelShaderGen: Don't emit bounding box shader code for old UIDs when disabled
If bounding box is enabled when a UID cache is created, then later disabled,
we shouldn't emit the bounding box portion of the shader.

Fixes pipeline creation errors on D3D12 backend for this case.
2019-04-20 23:16:14 +10:00
Connor McLaughlin
c26f53bf84
Merge pull request #7999 from stenzek/pipeline-cache-data
Implement pipeline data cache for OpenGL and D3D12
2019-04-20 12:56:02 +10:00
Jordan Woyak
779e618046 VideoCommon: Change free-look's middle-mouse action to roll the camera. 2019-04-17 05:10:11 -05:00
Stenzek
00b83b4196 ShaderCache: Utilize pipeline cache data where possible 2019-04-16 00:39:43 +10:00
Stenzek
61a656570e AbstractPipeline: Support returning "cache data"
"Cache data" can be used to assist a driver with creating pipelines by
using previously-compiled shader ISA.
2019-04-16 00:09:47 +10:00
Jordan Woyak
d34a9afe04 Minor changes to usages of std::condition_variable. 2019-04-06 17:39:25 -05:00
spycrab
e44433c2f6
Merge pull request #7955 from Techjar/netplay-golf-mode
NetPlay golf mode
2019-04-05 17:25:23 +02:00
Techjar
6c393f9ff4 Add imgui golf mode overlay 2019-04-05 07:01:03 -04:00
Techjar
a318c55cec PixelShaderGen: Fix bounding box coordinates being offset by 1 pixel 2019-04-03 10:09:05 -04:00
Stenzek
f2d8c8d2a8 D3D12: Fix rare case where command list was executed with open queries 2019-04-01 20:49:24 +10:00
Connor McLaughlin
32e330eb35
Merge pull request #7950 from stenzek/out-of-range-efb-copies
BPStructs: Gracefully handle out-of-range EFB copies
2019-04-01 13:08:11 +10:00
Stenzek
113bd60fe7 Implement D3D12 backend 2019-04-01 11:24:55 +10:00
Stenzek
378b605669 BPStructs: Gracefully handle out-of-range EFB copies
Since the copy X and Y coordinates/sizes are 10-bit, the game can configure a
copy region up to 1024x1024. Hardware tests have found that the number of bytes
written does not depend on the configured stride, instead it is based on the
size registers, writing beyond the length  of a single row. The data written
for the pixels which lie outside the EFB bounds does not wrap around instead
returning different colors based on the pixel format of the EFB.

This suggests it's not based on coordinates, but instead on memory addresses.
The effect of a within-bounds size but out-of-bounds offset
(e.g. offset 320,0, size 640,480) are the same.

As it would be difficult to emulate the exact behavior of out-of-bounds reads,
instead of writing the junk data, we don't write anything to RAM at all for
over-sized copies, and clamp to the EFB borders for over-offset copies.
2019-03-31 22:05:53 +10:00
Stenzek
3c455de799 FramebufferManager: Fix broken EFB peeks in GL with MSAA on 2019-03-30 03:14:29 +10:00
Stenzek
087b11e780 TextureCacheBase: Fix possible crash on shutdown with deferred EFB copies 2019-03-29 20:54:44 +10:00
Connor McLaughlin
f3fadd7302
Merge pull request #7869 from stenzek/d3dcommon
D3D: Move sharable D3D11/D3D12 code to common library
2019-03-29 20:40:06 +10:00
Stenzek
d66d778bae PixelShaderGen: Use subgroup reduction operations for bounding box 2019-03-29 20:06:56 +10:00
Connor McLaughlin
1304e963ad
Merge pull request #7895 from stenzek/framebuffer-corruption
FramebufferManager: Don't discard in ReinterpretPixelData
2019-03-29 20:03:13 +10:00
Connor McLaughlin
154eeae8ae
Merge pull request #7915 from stenzek/bbox-scaled-update
VideoBackends: Scale bounding box rectangle in the pixel shader
2019-03-29 19:59:25 +10:00
Stenzek
3b86c93285 VertexManagerBase: Increase vertex/uniform buffer sizes
ZTP was uploading 10MB+ of uniforms per frame, reducing paralellism by
forcing GPU waits.
2019-03-29 19:52:38 +10:00
Stenzek
2a4bca8b4a VideoBackends: Verify validity before doing full renderer init
Prevents attempting to create invalid MSAA configurations, for example.
2019-03-29 19:52:38 +10:00
Stenzek
e9cfcf4632 ShaderCache: Don't create invalid logic op pipelines
uint_output will never be set unless logic ops are enabled. Also clears
the bits so we're not compiling unused pixel shaders on the other
backends.
2019-03-28 20:35:02 +10:00
Stenzek
5732769a3c ShaderCache: Set correct primitive in dummy ubershader pipelines 2019-03-28 20:35:02 +10:00
Stenzek
7dd9d74eec RenderBase: Add EFBHasAlphaChannel() helper 2019-03-28 20:35:02 +10:00
JMC47
b4b0ebae27
Merge pull request #7934 from stenzek/stretched-efb-peeks
FramebufferManager: Fix EFB peek cache stretching last tile
2019-03-27 10:53:47 -04:00
Stenzek
92fa6c34cd FramebufferManager: Fix EFB pokes being offset by 1 in D3D 2019-03-27 23:28:34 +10:00
Stenzek
c28393d6f9 FramebufferManager: Fix EFB peek cache stretching last tile 2019-03-27 22:12:40 +10:00
spycrab
f7897778ff NetPlayChatUI: Add activate chat hotkey 2019-03-26 18:13:32 +01:00
Stenzek
16294acd2a VideoBackends: Scale bounding box rectangle in the pixel shader 2019-03-25 18:47:58 +10:00
Stenzek
cff60f5ba0 FramebufferManager: Only clear tile array when valid
When looking into the Faron Woods fifolog, I noticed this code was quite
high in the profile (~10%). Clearing 4096 entries from the vector isn't
needed every draw, we only need to do this when the cache was actually
valid in the first place.

Should provide a slight general performance boost.
2019-03-24 15:03:04 +10:00
spycrab
c89139d75d
Merge pull request #7903 from spycrab/imgui_np_chat
Add imgui-based Netplay Chat
2019-03-23 21:11:33 +01:00
spycrab
7cfb626a83 Add imgui-based Netplay Chat 2019-03-23 20:13:24 +01:00
spycrab
8cfbbbe9dc VideoCommon/RenderBase: Disable backculling for ImGui 2019-03-21 13:16:21 +01:00
Stenzek
bf0b52efc6 TextureCacheBase: Fix infinite loop in DoPartialTextureUpdates 2019-03-20 20:05:51 +10:00
Stenzek
8aa0ea10d9 FramebufferManager: Don't discard in ReinterpretPixelData
This was causing the depth buffer to be discarded as well, which
has an effect on mobiles (doesn't get loaded into tile memory).

If we find this is hindering performance (remember, the EFB is
only a 640x528 texture), it may be worth changing the interface to
support discarding only the colour buffer.
2019-03-16 23:45:08 +10:00
JosJuice
c71216419b
Merge pull request #7874 from vadosnaprimer/ffv1_fix
FFV1 fix
2019-03-15 23:17:02 +01:00
Stenzek
cce7ac43d4 FramebufferManager: Fix panic in VertexManager with large EFB depth poke batches 2019-03-12 18:26:07 +10:00
feos
7fd940411b decrease gop size (keyint)
this makes seeking a lot smoother (especially at high resolutions), while only adding less than 1% of filesize with this codec.
2019-03-11 22:17:13 +03:00
feos
005e60fa22 change pixel format from BGRA to BGR0
for this kind of footage carrying alpha information makes no sense, and it additionally complicates things by hugely damaging compatibility of the resulting video. after this change alone the video becomes compatible with VfW/WinAPI and tools that rely on it (avisynth, virtualdub).

fixes https://bugs.dolphin-emu.org/issues/11141 and https://bugs.dolphin-emu.org/issues/10193
2019-03-11 22:17:12 +03:00
Stenzek
a218a794cb FramebufferManager: Implement deferred EFB cache invalidation 2019-03-09 12:24:04 +10:00
Stenzek
6bc4bfd26a FramebufferManager: Implement EFB tile cache
The new tile cache is dynamic in size and can be turned on/off.
2019-03-09 12:23:33 +10:00
Stenzek
65216c9e87 VideoConfig: Add SupportsPartialDepthCopies to backend info
D3D11 doesn't support partial copies of depth buffers via
CopySubResource(), so we need to use a different path for the EFB cache.
2019-03-09 12:19:53 +10:00
spycrab
9ca394bbea VideoCommon/RenderBase: Don't destroy pipelines that are in use 2019-03-07 01:59:46 +01:00
Tillmann Karras
05fa667d03 VideoCommon: add EFB peek/poke stats 2019-03-04 02:49:59 +00:00