Commit graph

191 commits

Author SHA1 Message Date
degasus
6d2827ff6b PixelShader: Drop redundant warning.
This warning was raised both on UID generation and on shader generation.
2016-10-04 10:13:46 +02:00
degasus
083be0832f LightingShader: Drop xfmem usage.
Our shaders must only depend on the UID, not on any global state.
2016-10-04 10:13:46 +02:00
degasus
829fc8f0ad PixelShaderGen: Drop dstAlphaMode constant in shader generation.
It is already stored within the UID.
2016-10-04 10:13:46 +02:00
Stenzek
bac8c2d441 Vulkan: Work around indexed fragment output bug on AMD drivers 2016-10-01 02:40:02 +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
da43f9a156 PixelShaderGen: Always divide the texture coordinates by q.
Some games will set q to a different value than 1.0 through
texture matrix manipulations. It seems the console will still
do the division in that case.
2016-09-07 21:13:16 +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
Scott Mansell
d958388617 VideoCommon: Fix some warnings. 2016-06-26 23:10:31 +12:00
Scott Mansell
24e5d21780 Multithreadded Shadergen: Second pass over Pixel Shadergen.
Note: It's not 100% perfect, as some of the GPU capablities leak into the
pixel shader UID.

Currently our UIDs don't get exported, so there is no issue. But someone
might want to fix this in the future.
2016-06-26 16:13:21 +12:00
Scott Mansell
1a831cfc7d Multithreadded Shadergen: Second Pass over vertex/lighting Shadergens
As much as possible, the asserts have been moved out of the GetUID
function. But there are some places where asserts depend on variables
that aren't stored in the shader UID.
2016-06-26 16:13:21 +12:00
Scott Mansell
4969415f38 Remove global refrences from common code.
Bug Fix: Previously vertex shaders and geometery shaders didn't track
         antialaising state in their UIDs, which could cause AA bugs
	 on directx.
2016-06-26 16:13:20 +12:00
Scott Mansell
0d996f512b Multithreadded Shadergen: First pass over pixel Shadergen
Bug Fix: It was theoretically possible for a shader with depth writes
         disabled to map to the same UID as a shader with late depth
	 writes.
	 No known test cases trigger this.
2016-06-26 16:13:20 +12:00
Scott Mansell
e99364c7c9 UID Change: Fix bug with indirect stage UIDs
Bug Fix: The normal stage UIDs were randomly overwriting indirect
         stage texture map UID fields. It was possible for multiple
	 shaders with diffrent indirect texture targets to map to
	 the same UID.
         Once again, it dpesn't look like this bug was ever triggered.
2016-06-26 16:13:19 +12:00
Scott Mansell
03f2c9648d Shader UID change: Only store the two bits of components we need.
This frees up 21 bits and allows us to shorten the UID struct by an entire
32 bits.

It's not strictly needed (as it's encoded into the length) but I added a
bit for per-pixel lighiting to make my life easier in the following
commits.
2016-06-26 16:13:19 +12:00
Scott Mansell
53c402dbc5 Multithreadded Shadergen: First Pass over vertex/lighting Shadergens
The only code which touches xfmem is code which writes directly into
uid_data.

All the rest now read their parameters out of uid_data.

I also simplified the lighting code so it always generated seperate
codepaths for alpha and color channels instead of trying to combine
them on the off-chance that the same equation works for all 4 channels.

As modern (post 2008) GPUs generally don't calcualte all 4 channels
in a single vector, this optimisation is pointless. The shader compiler
will undo it during the GLSL/HLSL to IR step.

Bug Fix: The about optimisation was also broken, applying the color light
         equation to the alpha light channel instead of the alpha light
	 euqation. But doesn't look like anything trigged this bug.
2016-06-26 16:13:19 +12:00
Pierre Bourdon
5fcb4bb3ab Further fixes to the formatting change. WX sucks. 2016-06-24 12:16:10 +02:00
Pierre Bourdon
3570c7f03a Reformat all the things. Have fun with merge conflicts. 2016-06-24 10:43:46 +02:00
Jeffrey Pfau
d6517a761c VideoCommon: Simplify indirect texture lookup code slightly 2016-04-23 22:55:52 -07:00
Jeffrey Pfau
aa736bf258 Revert "VideoBackend: Remove extraneous shifts from indirect texture lookups"
This reverts commit 1f1b127b69.
2016-04-23 22:55:42 -07:00
degasus
ef01f234df PixelShaderGen: Fixes implicit type conversion or PR #3772.
This regression did only happen on OpenGL ES.
2016-04-10 12:49:32 +02:00
degasus
10e4f7e7bf PixelShaderGen: Move constant multiplication to constant generation.
No need to do this within the shader per pixel if it can be done once.
2016-04-09 12:25:00 +02:00
Stenzek
e6b2212ec0 ShaderGen: Only specify storage qualifier in interface block when needed
Drivers that don't support GL_ARB_shading_language_420pack require that
the storage qualifier be specified even when inside an interface block.

AMD's driver throws a compile error when "centroid in/out" is used within
an interface block.

Our previous behavior was to include the storage qualifier regardless, but
this wasn't working on AMD, therefore we should check for the presence of
the extension and include based on this, instead.
2016-03-30 00:42:50 +10:00
Pierre Bourdon
ae4cb12033 Merge pull request #3719 from Sonicadvance1/workaround_osx_video_drivers
Workaround OS X video driver bug #24983074
2016-03-26 01:43:32 +01:00
Ryan Houdek
3ab7806e24 Workaround OS X video driver bug #24983074
OS X's shader compiler has a bug with interface blocks where interface block members don't properly inherit the layout qualifier from the interface
block.
Work around this limitation by explicitly stating the layout qualifier on both the interface block and every single member inside of that block.
2016-03-09 09:11:00 -06:00
Jules Blok
6d1628eda4 Revert "Merge pull request #3578 from Armada651/forced-slow-depth"
This reverts commit e2a1a085b6, reversing
changes made to 2aea549eef.
2016-02-29 00:55:51 +01:00
Jules Blok
9805f70913 VideoConfig: Replace FastDepthCalc by ForcedSlowDepth.
Fast depth is now more accurate than slow depth and should always be used.
The option will be kept in a different form as it is still used as a hack to fix some games.
Also, the slow depth code path will still be relied upon by cards that don't support GL_ARB_clip_control.
2016-02-08 12:26:55 +01:00
Jeffrey Pfau
1f1b127b69 VideoBackend: Remove extraneous shifts from indirect texture lookups 2016-01-25 19:27:26 -08:00
Pierre Bourdon
24c228c6e9 Merge pull request #3523 from lioncash/video
VideoCommon: Header cleanup
2016-01-18 02:24:50 +01: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
Stenzek
edebadc093 PixelShaderGen: Use bitwise AND for wrapping indirect texture coordinates
(x % y) is not defined in GLSL when sign(x) != sign(y).
This also has the added benefit of behaving the same as sampler wrapping modes, in regards to negative inputs.
2016-01-15 19:46:38 +10:00
Stenzek
617f9d9532 ShaderGen: Remove virtual methods from ShaderGeneratorInterface, move string buffer to ShaderCode
This fixes the crashes occuring at startup with a non-empty shader cache.
Because LinearDiskCache reads/writes to the storage of ShaderUid, ShaderUid must be trivially copyable.
Additionally, adds a static assert to LinearDiskCache to ensure this doesn't happen in the future.

The initialization of ShaderUid data has been moved to the code generation functions, so the above condition holds true.
2016-01-02 17:35:06 +10:00
Lioncash
c151fe582f ShaderGenerators: Remove unnecessary inline keywords
Static by itself is sufficient
2015-12-26 17:57:32 -05:00
Lioncash
8ce3a4aa70 ShaderGeneration: Get rid of static buffers 2015-12-26 17:01:54 -05:00
degasus
e26d9f7c35 MSAA: Store samples in ini files. 2015-12-15 09:41:01 +01:00
Andrew Wickham
d9f1523a7b Make cast from int to float explicit in shader
This should fix this panic message I saw when playing Super Mario Strikers:

Failed to compile pixel shader [...]: error C7011: implicit cast from "int" to "float"
2015-11-30 13:35:46 -08:00
Tillmann Karras
71d1eb3c31 VideoCommon: return code/uid from shader gens
rather than passing in non-const references
2015-11-03 14:40:23 +01:00
Sintendo
c4b56f06f9 Fix a few typos 2015-11-02 21:17:43 +01:00
Tillmann Karras
983978ee66 VideoCommon: flush vertex manager if components change 2015-11-01 22:39:31 +01:00
Tillmann Karras
7066689131 ShaderCaches: remove unneeded typedefs 2015-10-29 14:43:05 +01:00
Scott Mansell
e7b2a22225 Support Conservative Depth as a fallback for EarlyZ
Allows Mesa based drivers to support ZCompLoc
2015-10-18 01:46:54 +13:00
Tillmann Karras
1df455bd13 PixelShaderGen: silence -Wformat-security warnings 2015-10-17 05:05:50 +02:00
Ilia Mirkin
5380fd9dba VideoCommon: fix variable types fed to Write() function 2015-10-16 18:20:36 -04:00
Scott Mansell
645e4cbbee PixelShaderGen: Use arrays of texture samplers. 2015-10-12 05:06:39 +13:00
degasus
1c0366993a VideoBackends: Reimplement SSAA, now for D3D + OGL 2015-09-06 19:40:00 +02:00
Ryan Houdek
9618738278 Remove all of our workarounds for Qualcomm devices we don't support anymore. 2015-09-04 23:45:35 -05:00
Lioncash
71ef0a0245 PixelShaderGen: Use spaces instead of tabs for vertical alignment 2015-09-01 12:20:50 -04:00
Lioncash
91eff28699 PixelShaderGen: Move defines into the implementation file
These aren't used outside of it. This also reduces the amount of things in
the global namespace.
2015-09-01 12:18:18 -04:00
Lioncash
c760ffbd28 BPMemory/XFMemory: Convert defines to enums
These actually convey a concrete type, as well as also providing a
symbolic constant during debugging.
2015-09-01 12:07:10 -04:00
Rohit Nirmal
6252d2d71a Fix building with PCH disabled. 2015-08-28 14:13:28 -05:00