Commit graph

66 commits

Author SHA1 Message Date
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
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
iwubcode
53684701fa HybridXFB: Fix lint errors 2017-11-17 22:11:31 -06:00
iwubcode
76b775d5be Video Common: Add XFB decoding via the GPU 2017-11-17 22:11:30 -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
79387dddb2 Add support for hybrid XFB 2017-11-17 19:47:56 -06: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
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
adebe2239e TextureConversionShader: Use integer math for truncating EFB format 2017-06-17 12:17:09 +10:00
Michael Maltese
05b4d14bf0 TextureConversionShader: fix syntax error
Fixes a situation where the following invalid GLSL code is generated:

```glsl
float3 texSample0 = texture(samp0, float3(uv0 + float2(0, 0) * sample_offset, 0.0)).rgb;
float3 texSample0 = floor(float3 texSample0 * 63.0) / 63.0;
float3 texSample1 = texture(samp0, float3(uv0 + float2(1, 0) * sample_offset, 0.0)).rgb;
float3 texSample1 = floor(float3 texSample1 * 63.0) / 63.0;
```
2017-04-12 14:23:25 -07:00
Stenzek
3847e226ab TextureConversionShader: Consider source format of EFB for EFB2RAM
Currently, we use the alpha channel from the EFB even if the current
format does not include an alpha channel. Now, the alpha channel is set
to 1 if the format does not have an alpha channel, as well as truncating
to 5/6 bits per channel. This matches the EFB-to-texture behavior.
2017-04-12 00:11:22 +10:00
Stenzek
fdf2efdac6 TextureConversionShader: Add missing swap for index of C14X2 textures 2017-04-06 23:29:40 +10:00
Stenzek
c6075f4c36 TextureConversionShader: Fix compile error in C14X2 decoder 2017-04-06 13:59:06 +10:00
Stenzek
6ffc16d1b0 VideoCommon: Add texture decoding shader generators 2017-04-01 12:32:10 +10:00
Stenzek
a71381e80a VideoCommon: Add APIType entry for Vulkan 2016-10-01 01:09:11 +10:00
Stenzek
d9c034e8cc ShaderGen: Specify attribute/output locations/bindings explicitly
This also shifts the SSBO index from index 3 to index 0.
2016-10-01 01:09:11 +10:00
Jules Blok
35a270d2a8 TextureConversionShader: Don't use the float specifier in shader code. 2016-08-24 17:42:32 +02:00
Lioncash
14e0b48ae4 VideoCommon: Make API_TYPE an enum class
Allows for forward declarations in most places, which prevents dumping
unrelated VideoCommon.h contents directly into headers.
2016-07-29 19:20:16 -04:00
Pierre Bourdon
3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Stenzek
1ce38a136d TextureConversionShader: Invert depth for Z24 encoder with D3D 2016-02-22 00:09:07 +10:00
Lioncash
d9fec92628 VideoCommon: Header cleanup
Also remedies places where the video backends and core rely on things
being indirectly included.
2016-01-17 20:11:45 -05:00
Jules Blok
daabd88d69 TextureConversionShader: Also invert color encoders if they're used to encode depth. 2016-01-13 01:08:27 +01:00
Scott Mansell
b9be3245e1 Move common EFB copy code into VideoCommon
Addded a few duplicated depth copy texture formats to the enum
in TextureDecoder.h. These texture formats were already implemented
in TextureCacheBase and the ogl/dx11 texture cache implementations.
2015-09-06 21:16:51 +12:00
Markus Wick
ff95fa8a6d Merge pull request #2861 from lioncash/param
VideoCommon: Remove unused parameters
2015-08-17 15:02:44 +02:00
Lioncash
8e17c710f3 TextureConversionShader: Remove an unused parameter 2015-08-16 21:10:54 -04:00
Jules Blok
b01ca1794a Revert "VideoCommon: Clamp integer conversions."
This reverts commit 0f2c72f0f8.
2015-08-15 13:50:43 +02:00
galop1n
2975e53091 D3D: Depth range inversion.
Credits go to Galop1n for designing this technique and to BhaaLseN for cleaning up the commit.
2015-05-26 15:31:31 +02:00
Tillmann Karras
30ebb2459e Set copyright year to when a file was created 2015-05-25 13:22:31 +02:00
Tillmann Karras
cefcb0ace9 Update license headers to GPLv2+ 2015-05-25 13:22:31 +02:00
Jules Blok
d04af15ad4 TextureConversionShader: Use floating point values in clamp(). 2015-05-08 14:32:24 +02:00
Jules Blok
0f2c72f0f8 VideoCommon: Clamp integer conversions. 2015-05-08 14:32:16 +02:00
Jules Blok
c4f85a38e6 VideoBackends: Use proper floating point depth precision. 2015-05-08 14:29:29 +02:00
Jules Blok
139ad3b2b9 TextureConversionShader: Use a Texture2DArray to match the shader resource view. 2015-02-21 11:50:20 +01:00
magumagu
57d94de2ad Fix regression for D3D EFB depth copies.
On D3D, we read from the depth buffer using the format
DXGI_FORMAT_R24_UNORM_X8_TYPELESS (essentially, the "r" component contains
the depth, and the other components contain nothing).
2015-02-03 11:27:27 -08:00
magumagu
b56025e6eb Don't use boolean negation. 2015-01-25 23:28:59 -08:00
magumagu
92189823f3 Fix RGBA8 encoding. 2015-01-25 22:53:30 -08:00
magumagu
b0b99b6922 Fix shader so it's possible to use with D3D Map().
Well, that's not strictly true, but trying to memcpy between two buffers
using different row lengths and different strides is at minimum extremely
unintuitive.
2015-01-25 19:57:09 -08:00
magumagu
6c1bdfe04c More work. 2015-01-25 19:57:07 -08:00
magumagu
ef75f3005d WIP. 2015-01-25 15:49:35 -08:00
Lioncash
9bcadc8029 Common: Remove locale based functions from CommonFuncs.
Since %f isn't used anymore in the shader generators, these can go.
2014-12-05 20:55:29 -05:00
degasus
6670cacddc use GL_TEXTURE_2D_ARRAY for most of our textures 2014-11-23 14:22:22 +01:00
Fiora
94c20db369 Rename Log2 and add IsPow2 to MathUtils for future use
Also remove unused pow2/pow2f functions.
2014-09-08 20:15:45 -07:00
Fiora
07e0c917c6 Revert "JIT64: optimize CA calculations" 2014-09-05 10:26:30 -07:00
Fiora
b51aa4fa89 Rename Log2 and add IsPow2 to MathUtils for future use
Also remove unused pow2/pow2f functions.
2014-09-01 20:41:07 -07:00
Ryan Houdek
bc9ef95643 Support Sampler binding in the shader.
In the cases where we support the binding layout keyword, use it for more than binding UBO location.
This changes it so it is supported for samplers as well.

Instances when this is enabled is if a device supports GL_ARB_shading_language_420pack, or if it supports GLES 3.10.
2014-07-18 17:04:03 -05:00
Tillmann Karras
0ccee6c87b Fix warnings unearthed by #579 2014-07-13 02:16:51 +02:00
degasus
22e1aa5bb4 mark all local functions as static 2014-07-11 16:07:23 +02:00
Ryan Houdek
fd37a768a6 Fix texture conversion shaders for GLSL ES.
Noticed this while messing with EFB to RAM.
We were having an implicit conversion from integer to float, GLSL ES doesn't allow implicit conversion.
Changes it to a explicit conversion to float.
2014-04-22 15:48:26 -05:00
Matthew Parlane
31cfc73a09 Fixes spacing for "for", "while", "switch" and "if"
Also moved && and || to ends of lines instead of start.
Fixed misc vertical alignments and some { needed newlining.
2014-03-11 00:35:07 +13:00