Commit graph

31 commits

Author SHA1 Message Date
riperiperi
ec3e848d79
Add a Multithreading layer for the GAL, multi-thread shader compilation at runtime (#2501)
* Initial Implementation

About as fast as nvidia GL multithreading, can be improved with faster command queuing.

* Struct based command list

Speeds up a bit. Still a lot of time lost to resource copy.

* Do shader init while the render thread is active.

* Introduce circular span pool V1

Ideally should be able to use structs instead of references for storing these spans on commands. Will try that next.

* Refactor SpanRef some more

Use a struct to represent SpanRef, rather than a reference.

* Flush buffers on background thread

* Use a span for UpdateRenderScale.

Much faster than copying the array.

* Calculate command size using reflection

* WIP parallel shaders

* Some minor optimisation

* Only 2 max refs per command now.

The command with 3 refs is gone. 😌

* Don't cast on the GPU side

* Remove redundant casts, force sync on window present

* Fix Shader Cache

* Fix host shader save.

* Fixup to work with new renderer stuff

* Make command Run static, use array of delegates as lookup

Profile says this takes less time than the previous way.

* Bring up to date

* Add settings toggle. Fix Muiltithreading Off mode.

* Fix warning.

* Release tracking lock for flushes

* Fix Conditional Render fast path with threaded gal

* Make handle iteration safe when releasing the lock

This is mostly temporary.

* Attempt to set backend threading on driver

Only really works on nvidia before launching a game.

* Fix race condition with BufferModifiedRangeList, exceptions in tracking actions

* Update buffer set commands

* Some cleanup

* Only use stutter workaround when using opengl renderer non-threaded

* Add host-conditional reservation of counter events

There has always been the possibility that conditional rendering could use a query object just as it is disposed by the counter queue. This change makes it so that when the host decides to use host conditional rendering, the query object is reserved so that it cannot be deleted. Counter events can optionally start reserved, as the threaded implementation can reserve them before the backend creates them, and there would otherwise be a short amount of time where the counter queue could dispose the event before a call to reserve it could be made.

* Address Feedback

* Make counter flush tracked again.

Hopefully does not cause any issues this time.

* Wait for FlushTo on the main queue thread.

Currently assumes only one thread will want to FlushTo (in this case, the GPU thread)

* Add SDL2 headless integration

* Add HLE macro commands.

Co-authored-by: Mary <mary@mary.zone>
2021-08-27 00:31:29 +02:00
mpnico
8e1adb95cf
Add support for HLE macros and accelerate MultiDrawElementsIndirectCount #2 (#2557)
* Add support for HLE macros and accelerate MultiDrawElementsIndirectCount

* Add missing barrier

* Fix index buffer count

* Add support check for each macro hle before use

* Add missing xml doc

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
2021-08-26 23:50:28 +02:00
gdkchan
0f6ec446ea
Replace BGRA and scale uniforms with a uniform block (#2496)
* Replace BGRA and scale uniforms with a uniform block

* Setting the data again on program change is no longer needed

* Optimize and resolve some warnings

* Avoid redundant support buffer updates

* Some optimizations to BindBuffers (now inlined)

* Unify render scale arrays
2021-08-11 21:33:43 +02:00
gdkchan
fefd4619a5
Add support for custom line widths (#2406) 2021-06-25 20:11:54 -03:00
gdkchan
caf049ed15
Avoid some redundant GL calls (#1958) 2021-01-27 08:44:07 +11:00
gdkchan
df820a72de
Implement clear buffer (fast path) (#1902)
* Implement clear buffer (fast path)

* Remove blank line
2021-01-13 08:50:54 +11:00
gdkchan
8d168574eb
Use explicit buffer and texture bindings on shaders (#1666)
* Use explicit buffer and texture bindings on shaders

* More XML docs and other nits
2020-11-08 12:10:00 +01:00
riperiperi
e1da7df207
Support res scale on images, correctly blacklist for SUST, move logic out of backend. (#1657)
* Support res scale on images, correctly blacklist for SUST, move logic
out of backend.

* Fix Typo
2020-11-02 16:53:23 -03:00
gdkchan
812e32f775
Fix transform feedback errors caused by host pause/resume and multiple uses (#1634)
* Fix transform feedback errors caused by host pause/resume

* Fix TFB being used as something else issue with copies

* This is supposed to be StreamCopy
2020-10-25 17:23:42 -03:00
gdkchan
2dcc6333f8
Fix image binding format (#1625)
* Fix image binding format

* XML doc
2020-10-20 19:03:20 -03: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
43c13057da
Implement alpha test using legacy functions (#1426) 2020-07-28 18:30:08 -03:00
mageven
723ae240dc
GL: Implement more Point parameters (#1399)
* Fix GL_INVALID_VALUE on glPointSize calls

* Implement more of Point primitive state

* Use existing Origin enum
2020-07-20 21:59:13 -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
f224769c49
Implement Logical Operation registers and functionality (#1380)
* Implement Logical Operation registers and functionality.

* Address Feedback 1
2020-07-10 14:23:15 -03: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
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
5011640b30
Spanify Graphics Abstraction Layer (#1226)
* Spanify Graphics Abstraction Layer

* Be explicit about BufferHandle size
2020-05-23 11:46:09 +02:00
riperiperi
cd48576f58
Implement Counter Queue and Partial Host Conditional Rendering (#1167)
* Implementation of query queue and host conditional rendering

* Resolve some comments.

* Use overloads instead of passing object.

* Wake the consumer threads when incrementing syncpoints.

Also, do a busy loop when awaiting the counter for a blocking flush, rather than potentially sleeping the thread.

* Ensure there's a command between begin and end query.
2020-05-04 12:24:59 +10:00
mageven
53369e79bd
Implement user-defined clipping on GL state pipeline (#1118) 2020-05-04 12:04:49 +10:00
riperiperi
c2ac45adc5
Fix depth clamp enable bit, unit scale for polygon offset. (#1178)
Verified with deko3d and opengl driver code.
2020-04-30 11:47:24 +10:00
mageven
a728610b40
Implement Constant Color blends (#1119)
* Implement Constant Color blends and init blend states

* Address gdkchan's comments

Also adds Set methods to GpuState

* Fix descriptions of QueryModified
2020-04-25 23:00:43 +10:00
mageven
4960ab85f8
Implement Depth Clamping (#1120)
* Implement Depth Clamping and add misc enums

* Fix formatting
2020-04-17 11:16:49 +10:00
mageven
468d8f841f
Simple GPU fixes (#1093)
* Implement RasterizeEnable

* Match viewport count to hardware

* Simplify ScissorTest tracking around Blits

* Disable RasterizerDiscard around Blits and track its state

* Read RasterizeEnable reg as bool and add doc
2020-04-07 19:19:45 +10:00
gdkchan
ab4867505e
Implement GPU scissors (#1058)
* Implement GPU scissors

* Remove unused using

* Add missing changes for Clear
2020-03-29 14:02:58 +11:00
gdkchan
f373f870f7
Support configurable point size (#916) 2020-02-02 10:19:46 +11:00
gdkchan
2bb39ff03e Replace glFinish with barrier for WaitForIdle (#878) 2020-01-13 09:12:40 +11:00
gdkchan
654e617fe7 Some code cleanup 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
gdk
d786d8d2b9 Support copy of slices to 3D textures, remove old 3D render target layered render support, do not delete textures with existing views created from them 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
Renamed from Ryujinx.Graphics.GAL/IGraphicsPipeline.cs (Browse further)