This seems to be the default value when the vertex attribute is disabled, or components aren't defined.
This fixes a regression from #2307 in SMO where a plant in the Wooded Kingdom would draw slightly differently in the depth prepass, leading to depth test failing later on.
GDK has stated that the specific case in Gundam only expects x and y to be 0, and Vulkan's undefined value for z does appear to be 0 when a vertex attribute type does not have that component, hence the value (0, 0, 0, 1).
This worked in Vulkan despite also providing an all 0s attribute due to the vertex attribute binding being R32Float, so the other values were undefined. It should be changed there separately.
* 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
* Return mapped buffer pointer directly for flush, WriteableRegion for textures
A few changes here to generally improve performance, even for platforms not using the persistent buffer flush.
- Texture and buffer flush now return a ReadOnlySpan<byte>. It's guaranteed that this span is pinned in memory, but it will be overwritten on the next flush from that thread, so it is expected that the data is used before calling again.
- As a result, persistent mappings no longer copy to a new array - rather the persistent map is returned directly as a Span<>. A similar host array is used for the glGet flushes instead of allocating new arrays each time.
- Texture flushes now do their layout conversion into a WriteableRegion when the texture is not MultiRange, which allows the flush to happen directly into guest memory rather than into a temporary span, then copied over. This avoids another copy when doing layout conversion.
Overall, this saves 1 data copy for buffer flush, 1 copy for linear textures with matching source/target stride, and 2 copies for block textures or linear textures with mismatching strides.
* Fix tests
* Fix array pointer for Mesa/Intel path
* Address some feedback
* Update method for getting array pointer.
It seems like this method of flushing data is much slower on Mesa drivers, and slightly slower on Intel Windows. Have not tested Intel Mesa, but I'm assuming it is the same as AMD.
This also adds vendor detection for AMD on Unix, which counted as "Unknown" before.
Improves OpenGL performance on FAST RMX and Xenoblade DE/2. Will probably only work on NVIDIA GPUs, but the emulated quads path will still be valid for other GPUs. Note: SLOW RMX gets a bit faster in handheld mode.
I'd recommend checking on platforms without supported host quads to make sure a GL error is actually thrown when attempting GL.Begin(PrimitiveType.Quads)
* Avoid clearning alpha channel by handle when presenting
Previous code was binding then blitting while the framebuffer was bound
and then clearing the alpha channel by its handle.
This ended up triggering a bug since AMD driver 21.4.1 ending up
clearing the whole framebuffer as a result.
New code fix this weird logic by applying the clear on the bound
framebuffer.
Close#2236.
* Address rip's comments
* Fix AMD being broken once again
* openal: Update to OpenTK 4
* Ryujinx.Graphics.OpenGL: Update to OpenTK 4
* Entirely removed OpenTK 3, still wip
* Use SPB for context creation and handling
Still need to test on GLX and readd input support
* Start implementing a new input system
So far only gamepad are supported, no configuration possible via UI but detected via hotplug/removal
Button mapping backend is implemented
TODO: front end, configuration handling and configuration migration
TODO: keyboard support
* Enforce RGB only framebuffer on the GLWidget
Fix possible transparent window
* Implement UI gamepad frontend
Also fix bad mapping of minus button and ensure gamepad config is updated in real time
* Handle controller being disconnected and reconnected again
* Revert "Enforce RGB only framebuffer on the GLWidget"
This reverts commit 0949715d1a03ec793e35e37f7b610cbff2d63965.
* Fix first color clear
* Filter SDL2 events a bit
* Start working on the keyboard detail
- Rework configuration classes a bit to be more clean.
- Integrate fully the keyboard configuration to the front end (TODO: assigner)
- Start skeleton for the GTK3 keyboard driver
* Add KeyboardStateSnapshot and its integration
* Implement keyboard assigner and GTK3 key mapping
TODO: controller configuration mapping and IGamepad implementation for keyboard
* Add missing SR and SL definitions
* Fix copy pasta mistake on config for previous commit
* Implement IGamepad interface for GTK3 keyboard
* Fix some implementation still being commented in the controller ui for keyboard
* Port screen handle code
* Remove all configuration management code and move HidNew to Hid
* Rename InputConfigNew to InputConfig
* Add a version field to the input config
* Prepare serialization and deserialization of new input config and migrate profile loading and saving
* Support input configuration saving to config and bump config version to 23.
* Clean up in ConfigurationState
* Reference SPB via a nuget package
* Move new input system to Ryujinx.Input project and SDL2 detail to Ryujinx.Input.SDL2
* move GTK3 input to the right directory
* Fix triggers on SDL2
* Update to SDL2 2.0.14 via our own fork
* Update buttons definition for SDL2 2.0.14 and report gamepad features
* Implement motion support again with SDL2
TODO: cemu hooks integration
* Switch to latest of nightly SDL2
* SDL2: Fix bugs in gamepad id matching allowing different gamepad to match on the same device index
* Ensure values are set in UI when the gamepad get hot plugged
* Avoid trying to add controllers in the Update method and don't open SDL2 gamepad instance before checking ids
This fixes permanent rumble of pro controller in some hotplug scenario
* Fix more UI bugs
* Move legcay motion code around before reintegration
* gamecontroller UI tweaks here and there
* Hide Motion on non motion configurations
* Update the TODO grave
Some TODO were fixed long time ago or are quite oudated...
* Integrate cemu hooks motion configuration
* Integrate cemu hooks configuration options to the UI again
* cemuhooks => cemuhooks
* Add cemu hook support again
* Fix regression on normal motion and fix some very nasty bugs around
* Fix for XCB multithreads issue on Linux
* Enable motion by default
* Block inputs in the main view when in the controller configuration window
* Some fixes for the controller ui again
* Add joycon support and fixes other hints
* Bug fixes and clean up
- Invert default mapping if not a Nintendo controller
- Keep alive the controller being selected on the controller window (allow to avoid big delay for controller needing time to init when doing button assignment)
- Clean up hints in use
- Remove debug logs around
- Fixes potential double free with SDL2Gamepad
* Move the button assigner and motion logic to the Ryujinx.Input project
* Reimplement raw keyboard hle input
Also move out the logic of the hotkeys
* Move all remaining Input manager stuffs to the Ryujinx.Input project
* Increment configuration version yet again because of master changes
* Ensure input config isn't null when not present
* Fixes for VS not being nice
* Fix broken gamepad caching logic causing crashes on ui
* Ensure the background context is destroyed
* Update dependencies
* Readd retrocompat with old format of the config to avoid parsing and crashes on those versions
Also updated the debug Config.json
* Document new input APIs
* Isolate SDL2Driver to the project and remove external export of it
* Add support for external gamepad db mappings on SDL2
* Last clean up before PR
* Addresses first part of comments
* Address gdkchan's comments
* Do not use JsonException
* Last comment fixes
* Improve Buffer Textures and flush Image Stores
Fixes a number of issues with buffer textures:
- Reworked Buffer Textures to create their buffers in the TextureManager, then bind them with the BufferManager later.
- Fixes an issue where a buffer texture's buffer could be invalidated after it is bound, but before use.
- Fixed width unpacking for large buffer textures. The width is now 32-bit rather than 16.
- Force buffer textures to be rebound whenever any buffer is created, as using the handle id wasn't reliable, and the cost of binding isn't too high.
Fixes vertex explosions and flickering animations in UE4 games.
* Set ImageStore flag... for ImageStore.
* Check the offset and size.
* Initial implementation (3d tex mips broken)
This works rather well for most games, just need to fix 3d texture mips.
* Cleanup
* Address feedback
* Copy Dependencies and various other fixes
* Fix layer/level offset for copy from view<->view.
* Remove dirty flag from dependency
The dirty flag behaviour is not needed - DeferredCopy is all we need.
* Fix tracking mip slices.
* Propagate granularity (fix astral chain)
* Address Feedback pt 1
* Save slice sizes as part of SizeInfo
* Fix nits
* Fix disposing multiple dependencies causing a crash
This list is obviously modified when removing dependencies, so create a copy of it.
* Initial implementation of buffer flush (VERY WIP)
* Host shaders need to be rebuilt for the SSBO write flag.
* New approach with reserved regions and gl sync
* Fix a ton of buffer issues.
* Remove unused buffer unmapped behaviour
* Revert "Remove unused buffer unmapped behaviour"
This reverts commit f1700e52fb8760180ac5e0987a07d409d1e70ece.
* Delete modified ranges on unmap
Fixes potential crashes in Super Smash Bros, where a previously modified range could lie on either side of an unmap.
* Cache some more delegates.
* Dispose Sync on Close
* Also create host sync for GPFifo syncpoint increment.
* Copy buffer optimization, add docs
* Fix race condition with OpenGL Sync
* Enable read tracking on CommandBuffer, insert syncpoint on WaitForIdle
* Performance: Only flush individual pages of SSBO at a time
This avoids flushing large amounts of data when only a small amount is actually used.
* Signal Modified rather than flushing after clear
* Fix some docs and code style.
* Introduce a new test for tracking memory protection.
Sucessfully demonstrates that the bug causing write protection to be cleared by a read action has been fixed. (these tests fail on master)
* Address Comments
* Add host sync for SetReference
This ensures that any indirect draws will correctly flush any related buffer data written before them. Fixes some flashing and misplaced world geometry in MH rise.
* Make PageAlign static
* Re-enable read tracking, for reads.
* Allow copy destination to have a different scale from source
Will result in more scaled copy destinations, but allows scaling in some games that copy textures to the output framebuffer.
* Support copying multiple levels/layers
Uses glFramebufferTextureLayer to copy multiple layers, copies levels individually (and scales the regions).
Remove CopyArrayScaled, since the backend copy handles it now.
* PBO single layer copy, part 1
Still needs ability to take and set width/height slices. (using pack paramaters)
* PBO Copies pt 2
* Some fixes and cleanup.
* Misc Cleanup
* Move handle into the TextureInfo interface.
This interface is shared between texture storages and views.
* Move unscaled copy to the TextureCopy class.
* Address feedback.
* infra: Migrate to .NET 5
This migrate projects and CI to .NET 5
* Remove language version restrictions (now on 9.0 by default)
* infra: pin .NET 5 to avoid later issues
* infra: Cleanup csproj files
* infra: update dependencies
* infra: Add temporary workaround for a bug in Vector128.Create
see https://github.com/dotnet/runtime/issues/44704 for more informations
Here come Salieri, my implementation of a disk shader cache!
"I'm sure you know why I named it that."
"It doesn't really mean anything."
This implementation collects shaders at runtime and cache them to be later compiled when starting a game.
* 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
* WIP Range Tracking
- Texture invalidation seems to have large problems
- Buffer/Pool invalidation may have problems
- Mirror memory tracking puts an additional `add` in compiled code, we likely just want to make HLE access slower if this is the final solution.
- Native project is in the messiest possible location.
- [HACK] JIT memory access always uses native "fast" path
- [HACK] Trying some things with texture invalidation and views.
It works :)
Still a few hacks, messy things, slow things
More work in progress stuff (also move to memory project)
Quite a bit faster now.
- Unmapping GPU VA and CPU VA will now correctly update write tracking regions, and invalidate textures for the former.
- The Virtual range list is now non-overlapping like the physical one.
- Fixed some bugs where regions could leak.
- Introduced a weird bug that I still need to track down (consistent invalid buffer in MK8 ribbon road)
Move some stuff.
I think we'll eventually just put the dll and so for this in a nuget package.
Fix rebase.
[WIP] MultiRegionHandle variable size ranges
- Avoid reprotecting regions that change often (needs some tweaking)
- There's still a bug in buffers, somehow.
- Might want different api for minimum granularity
Fix rebase issue
Commit everything needed for software only tracking.
Remove native components.
Remove more native stuff.
Cleanup
Use a separate window for the background context, update opentk. (fixes linux)
Some experimental changes
Should get things working up to scratch - still need to try some things with flush/modification and res scale.
Include address with the region action.
Initial work to make range tracking work
Still a ton of bugs
Fix some issues with the new stuff.
* Fix texture flush instability
There's still some weird behaviour, but it's much improved without this. (textures with cpu modified data were flushing over it)
* Find the destination texture for Buffer->Texture full copy
Greatly improves performance for nvdec videos (with range tracking)
* Further improve texture tracking
* Disable Memory Tracking for view parents
This is a temporary approach to better match behaviour on master (where invalidations would be soaked up by views, rather than trigger twice)
The assumption is that when views are created to a texture, they will cover all of its data anyways. Of course, this can easily be improved in future.
* Introduce some tracking tests.
WIP
* Complete base tests.
* Add more tests for multiregion, fix existing test.
* Cleanup Part 1
* Remove unnecessary code from memory tracking
* Fix some inconsistencies with 3D texture rule.
* Add dispose tests.
* Use a background thread for the background context.
Rather than setting and unsetting a context as current, doing the work on a dedicated thread with signals seems to be a bit faster.
Also nerf the multithreading test a bit.
* Copy to texture with matching alignment
This extends the copy to work for some videos with unusual size, such as tutorial videos in SMO. It will only occur if the destination texture already exists at XCount size.
* Track reads for buffer copies. Synchronize new buffers before copying overlaps.
* Remove old texture flushing mechanisms.
Range tracking all the way, baby.
* Wake the background thread when disposing.
Avoids a deadlock when games are closed.
* Address Feedback 1
* Separate TextureCopy instance for background thread
Also `BackgroundContextWorker.InBackground` for a more sensible idenfifier for if we're in a background thread.
* Add missing XML docs.
* Address Feedback
* Maybe I should start drinking coffee.
* Some more feedback.
* Remove flush warning, Refocus window after making background context
* 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
* Initial implementation. Still pending better valid-overlap handling,
disposed pool, compressed format flush fix.
* Very messy backend resource cache.
* Oops
* Dispose -> Release
* Improve Release/Dispose.
* More rule refinement.
* View compatibility levels as an enum - you can always know if a view is only copy compatible.
* General cleanup.
Use locking on the resource cache, as it is likely to be used by other threads in future.
* Rename resource cache to resource pool.
* Address some of the smaller nits.
* Fix regression with MK8 lens flare
Texture flushes done the old way should trigger memory tracking.
* Use TextureCreateInfo as a key.
It now implements IEquatable and generates a hashcode based on width/height.
* Fix size change for compressed+non-compressed view combos.
Before, this could set either the compressed or non compressed texture with a size with the wrong size, depending on which texture had its size changed. This caused exceptions when flushing the texture.
Now it correctly takes the block size into account, assuming that these textures are only related because a pixel in the non-compressed texture represents a block in the compressed one.
* Implement JD's suggestion for HashCode Combine
Co-authored-by: jduncanator <1518948+jduncanator@users.noreply.github.com>
* Address feedback
* Address feedback.
Co-authored-by: jduncanator <1518948+jduncanator@users.noreply.github.com>
* Logger class changes only
Now compile-time checking is possible with the help of Nullable Value
types.
* Misc formatting
* Manual optimizations
PrintGuestLog
PrintGuestStackTrace
Surfaceflinger DequeueBuffer
* Reduce SendVibrationXX log level to Debug
* Add Notice log level
This level is always enabled and used to print system info, etc...
Also, rewrite LogColor to switch expression as colors are static
* Unify unhandled exception event handlers
* Print enabled LogLevels during init
* Re-add App Exit disposes in proper order
nit: switch case spacing
* Revert PrintGuestStackTrace to Info logs due to #1407
PrintGuestStackTrace is now called in some critical error handlers
so revert to old behavior as KThread isn't part of Guest.
* Batch replace Logger statements
* 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
* 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.
* Viewport swizzle support on NV and clip origin
* Initialize default viewport swizzle state, emulate viewport swizzle on shaders when not supported
* Address PR feedback
* 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.
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.
* Implement Constant Color blends and init blend states
* Address gdkchan's comments
Also adds Set methods to GpuState
* Fix descriptions of QueryModified
* 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.
* 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
* Some fixes for the new GLRenderer
Changelog:
- Fix transparency of the window on some games on Windows.
- Fix escape key not being able to exit emulation.
- Fix inverted logic in fullscreen event handling.
- Fix a race condition when stoping emulation causing a hang.
- Fix a memory leak of the OpenGL context when stoping emulation (saving ~200MB of RAM when stoping emulation).
- Simplify and document behaviours when exiting the emulator while the
emulation is running.
* Make sure to clear alpha channel when presenting Texture
This fix once and for all the transparency issue on Windows.
* Enforce footer bar size to avoid gl widget to get resized to 1280x724
* Fix full screen inversion in MainWindow and make sure _listStatusBox don't come back when not needed
* Remove previous transparency clear attempt that is useless now
* Remove an extra line return
* add gl rendering widget
* embed renderer into main window
* add input
* fix mouse input
* fix mouse coords
* refresh game list after closing game, remove profiler method
* rebase, hide game list progress bar while game is running
* Some bug fixes
Changelog:
- Reapply some changes that got lost while rebasing from #904
- Make sure to guarantee exclusivity on the GL context (fixing multiple
possible race conditions on Windows)
- Avoid making GLRenderer disposed multiple time
* add fullscreen, enable input on focus, disable aplha
* addressed comments
* Disable transparency in the window
* fix fullscreen state, fix focus, addressed comments
* nit
* addressed nit
Co-authored-by: Thog <thog@protonmail.com>
* 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