summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/VertexShaderGen.cpp
AgeCommit message (Collapse)Author
2025-05-03VideoCommon: move position/normal matrices to be gettable by function in ↵iwubcode
VertexShaderGen
2025-03-13VideoCommon: move lighting shader logic to callable functionsiwubcode
2025-03-02VideoCommon: mark 'WriteTexCoordTransforms' as 'static'iwubcode
2025-02-14VideoCommon: move texcoord calculations to accessible functions in ↵iwubcode
VertexShaderGen
2024-10-12Cache normals in addition to binormals and tangentsPokechu22
Fixes LIT (https://bugs.dolphin-emu.org/issues/13635). The text does not include normals, but has lighting enabled. With the previous default of (0, 0, 0), lighting was always black (as dot(X, (0, 0, 0)) is always 0). It seems like the normal from the map in the background (0, 0, 1) is re-used. LIT also has the vertex color enabled while vertex color is not specified, the same as SMS's debug cubes; the default MissingColorValue GameINI value of solid white seems to work correctly in this case.
2023-10-24VideoCommon: Fix VS point/line on older GLSLTellowKrinkle
2023-10-06VideoBackends / VideoCommon: add new uniform buffer object for custom shader ↵iwubcode
materials (slot 3, geometry shader buffer moves to slot 4 if available)
2022-11-23Fix build errors related to formatting non-scoped enumsPokechu22
2022-10-22VideoCommon: Move repeated point/line expansion code to ShaderGenCommonTellowKrinkle
2022-10-22VideoCommon: Add vertex shader point and line expansionTellowKrinkle
2022-06-24D3D / VideoCommon: generate HLSL from SPIRViwubcode
2022-04-22VideoCommon: Add comment explaining why only the first normal gets normalizedPokechu22
Co-authored-by: Scott Mansell <phiren@gmail.com>
2022-04-22VideoCommon: Handle emboss texgen with only a single normalPokechu22
Fixes a large number of effects in Rogue Squadron 2 and 3.
2022-04-22VideoCommon: Rename norm0/norm1/norm2 to normal/tangent/binormalPokechu22
2022-04-22VertexShaderGen: Simplify normal calculationPokechu22
This is a readability change; there should be no functional or performance differences.
2021-10-13VideoCommon: Fix color channel logic when per-pixel lighting is in usePokechu22
This was broken in #10012 (specifically by 06579e4d53844e5a45ae18f8eda6c4ee69ebad2c and c3dec343918ff44e90886daf71a6bf0c49033de1).
2021-09-09Merge pull request #10012 from Pokechu22/thps4-green-skyJMC47
UberShaderVertex: Fix Tony Hawk Pro Skater 4
2021-09-07Use custom isnan implementation to avoid HLSL optimizer issuesPokechu22
This adjusts the NaN replacement logic introduced in #9928 to work around the HLSL compiler optimizing away calls to isnan, which caused that functionality to not work with ubershaders on D3D11 and D3D12 (it did work with specialized shaders, despite a warning being logged for both; that warning is also now gone). Note that the `D3DCOMPILE_IEEE_STRICTNESS` flag did not solve this issue, despite the warning suggesting that it might. Suggested by @kayru and @jamiehayes.
2021-08-18VertexShaderGen: Simplify color channel logicPokechu22
2021-07-24Convert NaN to 1 when generating texture coordinatesPokechu22
This fixes eyelids in Shadow the Hedgehog during cutscenes (https://bugs.dolphin-emu.org/issues/11458)
2021-07-05treewide: convert GPLv2+ license info to SPDX tagsPierre Bourdon
SPDX standardizes how source code conveys its copyright and licensing information. See https://spdx.github.io/spdx-spec/1-rationale/ . SPDX tags are adopted in many large projects, including things like the Linux kernel.
2021-06-09Hack to hide debug cubes in Super Mario SunshinePokechu22
... while not breaking other games.
2021-04-02VertexShaderGen: Sonic epsilon hack for OpenGL ESblåhaj
debaf63fe8abc4d534c0cac7540eb8607e2c5c91 moved the "Sonic epsilon hack" to vertex shaders. However, it was only done for targets with depth clamping. If this is not available, for example the target is OpenGL ES, the Sonic problem appears (https://bugs.dolphin-emu.org/issues/11897). A version of the "Sonic epsilon hack" is added for targets without depth clamping.
2021-03-06Convert XFMemory to BitField and enum classPokechu22
Additionally a new ClipDisable union has been added (though it is not currently used by Dolphin).
2020-11-20LightingShaderGen: Always calculate lighting for both color channelsStenzek
Cel-damage depends on lighting being calculated for the first channel even though there is no color in the vertex format (defaults to the material color). If lighting for the channel is not enabled, the vertex will use the default color as before. The default value of the color is determined by the number of elements in the vertex format. This fixes the grey cubes in Super Mario Sunshine. If the color channel count is zero, we set the color to black before the end of the vertex shader. It's possible that this would be undefined behavior on hardware if a vertex color index that was greater than the channel count was used within TEV.
2020-11-09ShaderGenCommon: Rename WriteFmt() to Write()Lioncash
Now that we've converted all of the shader generators over to using fmt, we can drop the old Write() member function and perform a rename operation on the WriteFmt() to turn it into the new Write() function. All changes within this are the removal of a <cstdarg> header, since the previous printf-based Write() required it, and renaming. No functional changes are made at all.
2020-10-19VertexShaderGen: Fix unescaped { in D3D shader.Admiral H. Curtiss
2020-07-24LightingShaderGen: Transition over to fmtLioncash
2020-07-24VertexShaderGen: Transition over to using fmtLioncash
2019-05-30VideoCommon: Remove unnecessary memset on ShaderUid instances.Lioncash
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-01-24ShaderGen: Don't use interface blocks on Vulkan without GSStenzek
Doing so causes the Adreno driver to choke and spew errors about too many output locations/components, when clearly we're under the limit.
2019-01-23ShaderGen: Omit some unused varyings when possibleStenzek
Removes the clipPos varying unless slow-depth is used, and the clipDistance varyings if geometry shaders are not used.
2018-03-14Assert: Uppercase assertion macrosLioncash
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).
2017-11-22LightingShaderGen: Always calculate lighting for both color channelsStenzek
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-07-30ShaderGen: Use consistent variable names for texture coordinatesStenzek
2017-07-20ShaderGen: Pass host config to shader generation functionsStenzek
Also moves the host config checks to common.
2017-07-20ShaderGen: Remove host state from shader uidsStenzek
2017-04-05VideoCommon: rework anamorphic widescreen heuristicMichael Maltese
Some widescreen hacks (see below) properly force anamorphic output, but don't make the last projection in a frame 16:9, so Dolphin doesn't display it correctly. This changes the heuristic code to assume a frame is anamorphic based on the total number of vertex flushes in 4:3 and 16:9 projections that frame. It also adds a bit of "aspect ratio inertia" by making it harder to switch aspect ratios, which takes care of aspect ratio flickering that some games / widescreen hacks would be susceptible with the new logic. I've tested this on SSX Tricky's native anamorphic support, Tom Clancy's Splinter Cell (it stayed in 4:3 the whole time), and on the following widescreen hacks for which the heuristic doesn't currently work: Paper Mario: The Thousand-Year Door (Gecko widescreen code from Nintendont) C202F310 00000003 3DC08042 3DE03FD8 91EEF6D8 4E800020 60000000 00000000 04199598 4E800020 C200F500 00000004 3DE08082 3DC0402B 61CE12A2 91CFA1BC 60000000 387D015C 60000000 00000000 C200F508 00000004 3DE08082 3DC04063 61CEE8D3 91CFA1BC 60000000 7FC3F378 60000000 00000000 The Simpsons: Hit & Run (AR widescreen code from the wiki) 04004600 C002A604 04004604 C09F0014 04004608 FC002040 0400460C 4082000C 04004610 C002A608 04004614 EC630032 04004618 48220508 04041A5C 38600001 04224344 C002A60C 04224B1C 4BDDFAE4 044786B0 3FAAAAAB 04479F28 3FA33333
2017-04-04Add configurable toggle that rounds vertices to the nearest pixel wheniwubcode
w=1. This fixes some games at higher IRs.
2017-03-16VertexShaderGen: Correct for negative viewport dimensions.Jules Blok
2017-02-01ShaderGenCommon: Remove unnecessary includesLioncash
2017-01-13VertexShaderGen: Remove the need for an extra UID.Jules Blok
2016-12-27Update commentsJules Blok
2016-12-27VideoCommon: Don't process the depth range in the vertex shader if it's not ↵Jules Blok
oversized.
2016-10-16VideoCommon: Fix GetInterpolationQualifier callsVincent Duvert
Commit 4969415 modified calls to GetInterpolationQualifier, but mistakenly changed the order of some boolean parameters: GetInterpolationQualifier(true, false) was changed to GetInterpolationQualifier(…, false, true). Should fix #9783.
2016-10-04LightingShader: Drop xfmem usage.degasus
Our shaders must only depend on the UID, not on any global state.
2016-10-01VideoCommon: Add APIType entry for VulkanStenzek
2016-10-01ShaderGen: posmtx should be a 4-component unsigned byteStenzek
This is a global change across backends, so should be tested for regressions.
2016-10-01ShaderGen: Specify attribute/output locations/bindings explicitlyStenzek
This also shifts the SSBO index from index 3 to index 0.
2016-09-01Merge pull request #4164 from Armada651/sonic-clippingJules Blok
VertexShaderGen: Move the sonic epsilon hack to the vertex shader.