Commit graph

238 commits

Author SHA1 Message Date
gdkchan 0954e76a26
Improve BRX target detection heuristics (#1591) 2020-10-03 15:43:33 +10:00
gdkchan 1560f236da
Convert 1D texture targets to 2D (#1584)
* Convert 1D texture targets to 2D

* Fix typo

* Simplify some code

* Should mask that too

* Consistency
2020-09-29 22:28:50 +02:00
gdkchan 90ab28d1c6
Align register index between output targets on pixel shaders (#1559) 2020-09-21 13:45:04 +10:00
gdkchan 1eea35554c
Better viewport flipping and depth mode detection method (#1556)
* Use a better viewport flipping approach

* New approach to detect depth mode

* nit: Sort method on the OpenGL backend

* Adjust spacing on comment

* Unswap near and far parameters based on ScaleZ
2020-09-19 19:46:49 -03:00
gdkchan 3d294a9a6c
Fix PSL and MRG flags on XMAD cbuf-reg shader instruction (#1520) 2020-09-01 15:07:20 -03:00
gdkchan 636542d817
Refactor shader translator ShaderConfig and reduce the number of out args (#1438) 2020-07-30 15:53:23 +10:00
gdkchan 991784868f
Fix shader regression on Intel iGPUs by reverting layout changes (#1425) 2020-07-29 08:01:11 +10:00
gdkchan 8dbcae1ff8
Implement BGRA texture support (#1418)
* Implement BGRA texture support

* Missing AppendLine

* Remove empty lines

* Address PR feedback
2020-07-26 00:03:40 -03:00
gdkchan 788ca6a411
Initial transform feedback support (#1370)
* Initial transform feedback support

* Some nits and fixes

* Update ReportCounterType and Write method

* Can't change shader or TFB bindings while TFB is active

* Fix geometry shader input names with new naming
2020-07-15 13:01:10 +10:00
riperiperi 484eb645ae
Implement Zero-Configuration Resolution Scaling (#1365)
* Initial implementation of Render Target Scaling

Works with most games I have. No GUI option right now, it is hardcoded.

Missing handling for texelFetch operation.

* Realtime Configuration, refactoring.

* texelFetch scaling on fragment shader (WIP)

* Improve Shader-Side changes.

* Fix potential crash when no color/depth bound

* Workaround random uses of textures in compute.

This was blacklisting textures in a few games despite causing no bugs. Will eventually add full support so this doesn't break anything.

* Fix scales oscillating when changing between non-native scales.

* Scaled textures on compute, cleanup, lazier uniform update.

* Cleanup.

* Fix stupidity

* Address Thog Feedback.

* Cover most of GDK's feedback (two comments remain)

* Fix bad rename

* Move IsDepthStencil to FormatExtensions, add docs.

* Fix default config, square texture detection.

* Three final fixes:

- Nearest copy when texture is integer format.
- Texture2D -> Texture3D copy correctly blacklists the texture before trying an unscaled copy (caused driver error)
- Discount small textures.

* Remove scale threshold.

Not needed right now - we'll see if we run into problems.

* All CPU modification blacklists scale.

* Fix comment.
2020-07-07 04:41:07 +02:00
gdkchan e13154c83d
Implement shader LEA instruction and improve bindless image load/store (#1355) 2020-07-04 01:48:44 +02:00
gdkchan a15b951721
Fix wrong face culling once and for all (#1277)
* Viewport swizzle support on NV and clip origin

* Initialize default viewport swizzle state, emulate viewport swizzle on shaders when not supported

* Address PR feedback
2020-05-28 09:03:07 +10:00
gdkchan 5795bb1528
Support separate textures and samplers (#1216)
* Support separate textures and samplers

* Add missing bindless flag, fix SNORM format on buffer textures

* Add missing separation

* Add comments about the new handles
2020-05-27 16:07:10 +02:00
gdkchan 0b6d206daa
Omit image format if possible, and fix BA bit (#1280)
* Omit image format if possible, and fix BA bit

* Match extension name
2020-05-27 11:00:21 +02:00
Thog ff7a933ec0
Implement TMML and TMML.B (#1270)
* Implement TMML and TMML.B

This implement TMML and TMML.B instructions

* Fix TmmlB declaration alignment

* Address gdkchan's comments

* Fix inverted encoding definitions
2020-05-23 12:04:35 +02:00
gdkchan b8eb6abecc
Refactor shader GPU state and memory access (#1203)
* Refactor shader GPU state and memory access

* Fix NVDEC project build

* Address PR feedback and add missing XML comments
2020-05-06 11:02:28 +10:00
Ac_K 4c54f36c38
Upgrade projects to C#8 (#1193)
Some parts of our code needs C# 8 who isn't set as default in Visual Studio. To fix this we have to set the C# version correctly in the csproj files and then we are be able to build the project using Visual Studio.
2020-05-04 12:14:48 +10:00
gdkchan 1c9aba6de1
Fix mode and Reg08.H1 decoding on XMAD instruction (#1156) 2020-04-25 23:40:29 +10:00
gdkchan 3cb1fa0e85
Implement texture buffers (#1152)
* Implement texture buffers

* Throw NotSupportedException where appropriate
2020-04-25 23:02:18 +10:00
gdkchan ff86494d68
Remove leftover of debugging code for shader texture format (#1141) 2020-04-22 16:02:07 +02:00
Michael Kuklinski c46edfab85
Update .NET Core to 3.1, and update NuGet Packages (#1121)
* Updated all NuGet packages to latest, and updated the framework from .NET Core 3.0 to 3.1.

* Updating appveyor settings for 3.1

Updating appveyor to use the netcoreapp3.1 path instead of 3.0.

* Removing unneeded NuGet package System.Runtime.CompilerServices.Unsafe.

* Removing unused NuGet package SharpFontCore.

* Removing unused NuGet package TimeZoneConverter.Posix

* Cleaning up by adding newline to a csproj.

* Simplfying a NuGet conditional include, and adding a warning disable for an annoying NuGet package.

* I'm not sure if .travis.yml is still used, but I'm updating its 'dotnet' version to the correct SDK.

* Making the runtime version into its own environment variable so it's a bit easier to change in the future.

* Removing OpenTK.NetStandard reference from Ryujinx.Common

* Fixing indentation in Common.csproj

* Updating the README to specify .NET Core 3.1.

* Reverting the update of the GTKSharp package so it doesn't block the PR.
2020-04-22 14:13:41 +10:00
gdkchan 03711dd7b5
Implement SULD shader instruction (#1117)
* Implement SULD shader instruction

* Some nits
2020-04-22 09:35:28 +10:00
gdkchan 92cc37e365
Fix negation of HADD2 constant buffer source (#1116) 2020-04-15 09:01:26 +10:00
gdkchan e93ca84b14
Better IPA shader instruction implementation (#1082)
* Fix varying interpolation on fragment shader

* Some nits

* Alignment
2020-04-03 11:20:47 +11:00
gdkchan 5b5239ab5b
Remove output interpolation qualifier (#1070) 2020-04-02 12:24:55 +11:00
gdkchan d599fba711
Implement FCMP shader instruction (#1067) 2020-03-30 12:04:00 +02:00
riperiperi f9c859c8ba
Index constant buffer vec4s using ternary expressions. (#1015)
* Index constant buffer vec4s using ternary expressions.

* Remove indexed path.

We determined that it had negligible impact.

* Revert "Remove indexed path."

This reverts commit 25ec4eddfa.

* Revert "Revert "Remove indexed path.""

This reverts commit 7cd52fecb5.
2020-03-29 13:24:54 -03:00
Chenj168 7ad8b3ef75
Move the OpActivator to OpCodeTable class for improve performance (#1001)
* Move the OpActivator to OpCodeTable class, for reduce the use of ConcurrentDictionary

* Modify code style.
2020-03-29 19:52:56 +11:00
Elise 06bf25521f
Implement NOP and stub DEPBAR shader instructions (#1041)
* Implement NOP and stub DEPBAR shader instruction

* Fix a few issues and formatting stuff

* Remove OpCodeNop/Depbar and use OpCode instead

* Fix NOP shader instruction opcode

* Fix formatting
2020-03-26 19:30:16 -03:00
gdkchan 1586450a38
Implement VMNMX shader instruction (#1032)
* Implement VMNMX shader instruction

* No need for the gap on the enum

* Fix typo
2020-03-25 15:49:10 +01:00
gdkchan 6edc929894
Implement ICMP shader instruction (#1010) 2020-03-23 17:32:30 +01:00
gdkchan 49d7b1c7d8
Implement textureQueryLevels (#1007) 2020-03-23 08:31:31 +11:00
gdkchan 8bb64ac69c
Improve shader sampler type selection (#989) 2020-03-15 11:24:45 +11:00
jduncanator 54501962f6
Fix branch with CC and predicate, and a case of SYNC propagation (#967) 2020-03-06 11:09:49 +11:00
gdkchan dc97457bf0
Initial support for double precision shader instructions. (#963)
* Implement DADD, DFMA and DMUL shader instructions

* Rename FP to FP32

* Correct double immediate

* Classic mistake
2020-03-03 15:02:08 +01:00
gdkchan 9e4f668f6c
Update bindless to indexed conversion code pattern match (#938)
* Update bindless to indexed conversion code pattern match

* Correct index shift
2020-02-14 11:29:58 +01:00
gdkchan 5a9dba0756
Sign-extend shader memory instruction offsets (#934) 2020-02-14 01:48:07 +01:00
gdkchan 7e4d986a73
Support compute uniform buffers emulated with global memory (#924) 2020-02-11 01:10:05 +01:00
gdkchan 796e5d14b4
Use correct shader local memory size instead of a hardcoded size (#914)
* Use correct shader local size instead of a hardcoded size

* Remove unused uniform block

* Update XML doc

* Local memory size has 23 bits on maxwell

* Generate compute QMD struct from nv open doc header

* Remove dummy arrays when shared or local memory is not used, other improvements
2020-02-02 14:25:52 +11:00
gdkchan a1a5341baf
Support flat interpolation qualifier on shaders (#915) 2020-02-02 10:18:58 +11:00
gdkchan 81cca88bcd Fix shader output color buffer index when non-sequential render targets are used (#895) 2020-01-19 00:09:46 +01:00
gdkchan b8e3909d80 Add a GetSpan method to the memory manager and use it on GPU (#877) 2020-01-13 10:27:50 +11:00
gdkchan 80707f9311 Add runtime identifiers to new projects 2020-01-09 02:13:00 +01:00
gdkchan 29a825b43b Address PR feedback
Removes a useless null check

Aligns some values to improve readability
2020-01-09 02:13:00 +01:00
gdkchan 912e43e979 Remove some unused args on the shader translator 2020-01-09 02:13:00 +01:00
gdkchan 6407729a1d Fix FADD32I check for Ra negation 2020-01-09 02:13:00 +01:00
gdkchan 18814d44b2 Address PR feedback
Add TODO comment for GL_EXT_polygon_offset_clamp
2020-01-09 02:13:00 +01:00
gdkchan 92703af555 Address PR feedback 2020-01-09 02:13:00 +01:00
gdkchan 9bfb373bdf Remove more unused code 2020-01-09 02:13:00 +01:00
gdkchan 654e617fe7 Some code cleanup 2020-01-09 02:13:00 +01:00
gdkchan 947e14d3be Reimplement limited bindless textures support 2020-01-09 02:13:00 +01:00
gdkchan a718b60d06 Fix exception on shader translator when adding goto temp variable 2020-01-09 02:13:00 +01:00
gdkchan 82957fa96b Support CC on FSET shader instruction, fix CC on ISET.BF shader instruction 2020-01-09 02:13:00 +01:00
gdkchan 9d7a142a48 Support texture rectangle targets (non-normalized coords) 2020-01-09 02:13:00 +01:00
gdkchan 2eccc7023a Partial support for shader memory barriers 2020-01-09 02:13:00 +01:00
gdkchan cfe5fec0cf Remove some usings that are not needed 2020-01-09 02:13:00 +01:00
gdkchan 171c3d54c6 Correct non-constant offset rewrite for texelFetch 2020-01-09 02:13:00 +01:00
gdkchan f2c85c5d58 Support non-constant texture offsets on non-NVIDIA gpus 2020-01-09 02:13:00 +01:00
gdkchan 66d91cbc6c Use dispatch params shared memory size when available 2020-01-09 02:13:00 +01:00
gdkchan 0d9672f3ae Use maximum shared memory size supported by hardware 2020-01-09 02:13:00 +01:00
gdkchan 6b13c5b439 Support bindless texture gather shader instruction 2020-01-09 02:13:00 +01:00
gdkchan 7ce5584f9e Support depth clip mode and disable shader fast math optimization on NVIDIA as a workaround for compiler bugs (?) 2020-01-09 02:13:00 +01:00
gdkchan 17fb11ddb9 Fix wrong maximum id on sampler pool in some cases 2020-01-09 02:13:00 +01:00
gdkchan cb171f6ebf Support shared color mask, implement more shader instructions
Support shared color masks (used by Nouveau and maybe the NVIDIA
driver).
Support draw buffers (also required by OpenGL).
Support viewport transform disable (disabled for now as it breaks some
games).
Fix instanced rendering draw being ignored for multi draw.
Fix IADD and IADD3 immediate shader encodings, that was not matching
some ops.
Implement FFMA32I shader instruction.
Implement IMAD shader instruction.
2020-01-09 02:13:00 +01:00
gdk 6a98c643ca Add a pass to turn global memory access into storage access, and do all storage related transformations on IR 2020-01-09 02:13:00 +01:00
gdk 442485adb3 Partial support for branch with CC, and fix a edge case of branch out of loop on shaders 2020-01-09 02:13:00 +01:00
gdk 99f236fcf0 Simplified F2I shader instruction codegen 2020-01-09 02:13:00 +01:00
gdk b8528c6317 Implement HSET2 shader instruction and fix errors uncovered by Rodrigo tests 2020-01-09 02:13:00 +01:00
gdk e0c95b18eb Add PSET shader instruction 2020-01-09 02:13:00 +01:00
gdk 73e68edd09 Revert "Simplify shader uniform buffer access codegen"
This reverts commit 2fe9ebaf118d690be8d0cb302529dd359d7c402b.
2020-01-09 02:13:00 +01:00
gdk 1df78e7ad6 Simplify shader uniform buffer access codegen 2020-01-09 02:13:00 +01:00
gdk 3ca675223a Remove TranslatorConfig struct 2020-01-09 02:13:00 +01:00
gdk 6a8ba6d600 Add R2P shader instruction 2020-01-09 02:13:00 +01:00
gdk 8eb773d81f Make the shader translator more error resilient (part 2) 2020-01-09 02:13:00 +01:00
gdk 04102e5c9d Make the shader translator more error resilient 2020-01-09 02:13:00 +01:00
gdk eea73bc421 Add missing check for BRX, do not add a out of bounds block to the queue 2020-01-09 02:13:00 +01:00
gdk f0a59f345c Add partial support for the BRX shader instruction 2020-01-09 02:13:00 +01:00
gdk f6e96551bf Fix regression on load/store local (wrong type) 2020-01-09 02:13:00 +01:00
gdk 769c02235f Add ATOMS, LDS, POPC, RED, STS and VOTE shader instructions, start changing the way how global memory is handled 2020-01-09 02:13:00 +01:00
gdk a31fced221 Remove some unused constants and other code 2020-01-09 02:13:00 +01:00
gdk 3ab5c23f49 Add partial support for array of samplers, and add pass to identify them from bindless texture accesses 2020-01-09 02:13:00 +01:00
gdk 278a4c317c Implement BFI, BRK, FLO, FSWZADD, PBK, SHFL and TXD shader instructions, misc. fixes 2020-01-09 02:13:00 +01:00
gdk 3bcc395253 Add shader support for the round mode on the F2F instruction, support mipmaps on ASTC compressed textures 2020-01-09 02:13:00 +01:00
gdk d3fcab8511 Fix shader FMUL32I instruction saturation 2020-01-09 02:13:00 +01:00
gdk 8cba252b23 Add per-source type memory change tracking, simplified state change tracking, other fixes 2020-01-09 02:13:00 +01:00
gdk 1b7d955195 Initial support for image stores, support texture sample on compute 2020-01-09 02:13:00 +01:00
gdk 717ace6f6e Fix incorrect saturation on HADD2 and HMUL2 shader instructions 2020-01-09 02:13:00 +01:00
gdk 1876b346fe Initial work 2020-01-09 02:13:00 +01:00